import { ResourceResult, ResourceType } from '../utils/types.js'; /** * The bundled `res/` content as a closed, immutable index. * * Every spec, instruction, and snippet is discovered once from its directory * listing. Lookups take a metadata type and an optional snippet id as **keys**; * a file path is only ever a name the directory listing returned, never one * built from caller input. A type or id that is not in the index is simply not * found — `x/../../README` cannot address a file outside `res/`. */ /** File names per resource kind, as returned by `readdir`. */ export type ResourceListing = Record; /** The parsed index: metadata type → file name (snippets: id → file name, ids in order). */ export interface ResourceIndex { /** Metadata types with an API spec, sorted. The spec set defines the supported types. */ readonly types: readonly string[]; readonly spec: ReadonlyMap; readonly instruct: ReadonlyMap; readonly snippets: ReadonlyMap>; } /** * Build the index from directory listings. Pure: no I/O, no defaults. * Non-matching names (README, temp files) are ignored. */ export declare function buildResourceIndex(listing: ResourceListing): ResourceIndex; /** * The one shared view of `res/`. Constructed synchronously; the index is read * once, on {@link load} or the first lookup (single-flight). A listing failure * rejects instead of degrading: the directories ship with the package and are * checked at startup (`findMissingResourcePaths`), so a failure is a broken * install, not an empty catalog. */ export declare class ResourceCatalog { private readonly directories; private indexPromise?; constructor(directories?: Record); /** Read and index the resource directories (idempotent). */ load(): Promise; /** * The supported metadata types that have a resource of this kind, from that * kind's own index: a spec type without a guide or a snippet is not listed * for `instruct` or `snippet`. */ listMetadataTypes(kind: ResourceType): Promise; /** Snippet ids for a metadata type, in order; empty when it has none. */ listSnippets(metadataType: string): Promise; /** * Read one resource. A snippet is addressed by its id: a missing id, or one * that does not exist, is **not found** (never another snippet). */ getResource(resourceType: ResourceType, metadataType: string, id?: string): Promise; private fileFor; } //# sourceMappingURL=resourceCatalog.d.ts.map