Skip to content

dependabit / manifest/src / readManifest

Function: readManifest()

ts
function readManifest(path): Promise<{
  dependencies: {
     accessMethod: "context7" | "arxiv" | "openapi" | "github-api" | "http";
     auth?: {
        secretEnvVar?: string;
        type: "token" | "oauth" | "basic" | "none";
     };
     changeHistory: {
        detectedAt: string;
        falsePositive: boolean;
        issueNumber?: number;
        newVersion?: string;
        oldVersion?: string;
        severity: "breaking" | "major" | "minor";
     }[];
     currentStateHash: string;
     currentVersion?: string;
     description?: string;
     detectedAt: string;
     detectionConfidence: number;
     detectionMethod:   | "llm-analysis"
        | "manual"
        | "package-json"
        | "requirements-txt"
        | "code-comment";
     id: string;
     lastChanged?: string;
     lastChecked: string;
     monitoring?: {
        checkFrequency: "hourly" | "daily" | "weekly" | "monthly";
        enabled: boolean;
        ignoreChanges: boolean;
        severityOverride?: "breaking" | "major" | "minor";
     };
     name: string;
     referencedIn: {
        context?: string;
        file: string;
        line?: number;
     }[];
     type:   | "reference-implementation"
        | "schema"
        | "documentation"
        | "research-paper"
        | "api-example"
        | "other";
     url: string;
  }[];
  generatedAt: string;
  generatedBy: {
     action: string;
     llmModel?: string;
     llmProvider: string;
     version: string;
  };
  repository: {
     branch: string;
     commit: string;
     name: string;
     owner: string;
  };
  statistics: {
     averageConfidence: number;
     byAccessMethod: Record<string, number>;
     byDetectionMethod: Record<string, number>;
     byType: Record<string, number>;
     falsePositiveRate?: number;
     totalDependencies: number;
  };
  version: "1.0.0";
}>;

Defined in: packages/manifest/src/manifest.ts:24

Reads a manifest JSON file from disk and validates it against DependencyManifestSchema.

Parameters

ParameterTypeDescription
pathstringAbsolute or process-relative path to the manifest file.

Returns

Promise<{ dependencies: { accessMethod: "context7" | "arxiv" | "openapi" | "github-api" | "http"; auth?: { secretEnvVar?: string; type: "token" | "oauth" | "basic" | "none"; }; changeHistory: { detectedAt: string; falsePositive: boolean; issueNumber?: number; newVersion?: string; oldVersion?: string; severity: "breaking" | "major" | "minor"; }[]; currentStateHash: string; currentVersion?: string; description?: string; detectedAt: string; detectionConfidence: number; detectionMethod: | "llm-analysis" | "manual" | "package-json" | "requirements-txt" | "code-comment"; id: string; lastChanged?: string; lastChecked: string; monitoring?: { checkFrequency: "hourly" | "daily" | "weekly" | "monthly"; enabled: boolean; ignoreChanges: boolean; severityOverride?: "breaking" | "major" | "minor"; }; name: string; referencedIn: { context?: string; file: string; line?: number; }[]; type: | "reference-implementation" | "schema" | "documentation" | "research-paper" | "api-example" | "other"; url: string; }[]; generatedAt: string; generatedBy: { action: string; llmModel?: string; llmProvider: string; version: string; }; repository: { branch: string; commit: string; name: string; owner: string; }; statistics: { averageConfidence: number; byAccessMethod: Record<string, number>; byDetectionMethod: Record<string, number>; byType: Record<string, number>; falsePositiveRate?: number; totalDependencies: number; }; version: "1.0.0"; }>

The validated manifest object.

Throws

If the file content does not match the schema.

Throws

If the file cannot be read (e.g., not found, permissions).

Use When

Loading an existing manifest to pass to the monitor or detector.

Pitfalls

  • The file is parsed as JSON, not YAML. Passing a YAML manifest path will throw a SyntaxError; use readConfig for YAML.

Released under the MIT License.