export type MetadataType = 'ApexClass' | 'ApexTrigger' | 'LightningComponentBundle' | 'CustomObject' | 'CustomField' | 'Flow' | 'PermissionSet' | 'CustomLabel'; export type MetadataEntry = { apiName: string; type: MetadataType; path: string; category?: string; dependencies: string[]; dependents?: string[]; lastModified?: string; hash?: string; /** Org-Wide Default sharing model, extracted from the object XML (CustomObject only). */ sharingModel?: string; /** * References the parser could not statically resolve (e.g. dynamic SOQL, * `Type.forName`). Surfaced so consumers know the edge set is incomplete. */ ambiguousRefs?: string[]; }; export type MetadataIndex = { version: string; /** Version of the metadata parser contract, independent of the plugin release. */ parserVersion?: string; pluginVersion?: string; generatedAt: string; generatedBy: string; mode: 'full' | 'git-diff' | 'hash-compare'; refreshMode?: 'full-rebuild' | 'delta-triggered-full-rebuild' | 'unchanged'; sourceRoot: string; /** Coverage is always relative to sourceRoot; it never implies full-org coverage. */ scope?: 'source-root-full' | 'filtered'; contract?: { include: MetadataType[]; exclude: MetadataType[]; }; sourceDigest?: string; sourceCommit?: string; dirty?: boolean; stats: { totalEntries: number; byType: Record; totalDependencies: number; orphanEntries: number; }; entries: MetadataEntry[]; dependencyGraph: { edges: Array<{ from: string; to: string; type: string; }>; }; }; export type MetadataParser = { type: MetadataType; glob: string; parse(filePath: string, content: string): MetadataEntry | MetadataEntry[] | null; extractDependencies(entry: MetadataEntry, content: string): string[]; }; export type IndexOptions = { sourceDir: string; mode: 'full' | 'git-diff' | 'hash-compare'; include?: MetadataType[]; exclude?: MetadataType[]; format?: 'json' | 'md'; };