/** * Spec-to-File Mapper * * Reads existing OpenSpec specs and builds a bidirectional mapping * between spec domains and source files. This is the core data structure * that enables drift detection. */ import type { SpecMap } from '../../types/index.js'; export interface SpecMapperOptions { rootPath: string; openspecPath: string; repoStructurePath?: string; } /** * Extract source files from the spec header line: * > Source files: src/foo.ts, src/bar.ts */ export declare function parseSpecHeader(content: string): { sourceFiles: string[]; generatedDate: string | null; }; /** * Extract file references, requirements, and entities from spec body */ export declare function parseSpecReferences(content: string): { files: string[]; requirements: string[]; entities: string[]; }; /** * Try to infer a domain for a file path based on directory structure. * Uses word-boundary matching to avoid false positives (e.g., domain "auth" * should match "auth-service.ts" but not "authorize.ts"). */ export declare function inferDomainFromPath(filePath: string, knownDomains: string[]): string | null; /** * Build a bidirectional map between spec domains and source files */ export declare function buildSpecMap(options: SpecMapperOptions): Promise; /** * Load spec content for a domain, reading the spec file from disk. * Returns the markdown content truncated to maxChars, or null if unavailable. */ export declare function getSpecContent(domain: string, specMap: SpecMap, rootPath: string, maxChars?: number): Promise; /** * Find which domains a file maps to, using direct lookup + directory inference */ export declare function matchFileToDomains(filePath: string, specMap: SpecMap): string[]; export interface ADRMapping { id: string; title: string; adrPath: string; relatedDomains: string[]; relatedLayers: string[]; status: string; } export interface ADRMap { byId: Map; byDomain: Map; } /** * Parse the ## Related section from an ADR file to extract domains and layers. */ export declare function parseADRRelated(content: string): { domains: string[]; layers: string[]; }; /** * Build an ADR map by reading all ADR files from the decisions directory. * Returns null if no decisions directory exists. */ export declare function buildADRMap(options: SpecMapperOptions): Promise; //# sourceMappingURL=spec-mapper.d.ts.map