/** * graphify.ts — read a graphify `graph.json` knowledge-graph dump and expose a * lexical map from spec triggers to code-graph nodes. * * Why lexical, not embeddings: matching spec triggers against code-symbol names * is a *connection* problem (does a behavior have a corresponding implementation * site?), not a *semantic-similarity* problem. graphify already extracts symbol * names via tree-sitter; we tokenize trigger phrases and node labels and score * by token overlap. This keeps `specify` zero-API-key for the deterministic * coverage pass — the AI verify skill reasons over the result, it does not need * to re-run embeddings to know which symbols a trigger plausibly touches. * * The spec itself stays code-free: triggers are behavior phrases. The mapping * lives here, outside the spec, exactly as the design requires. */ import type { SpecTrigger } from '../spec/triggers.js'; export interface GraphNode { id: string; label: string; norm_label?: string; file_type?: string; source_file?: string; source_location?: string; } export interface GraphifyGraph { nodes: GraphNode[]; } export interface NodeMatch { id: string; label: string; source_file?: string; source_location?: string; score: number; } export interface TriggerCoverage { trigger: string; spec_file: string; matches: NodeMatch[]; covered: boolean; } /** Split a phrase / symbol name into normalized word tokens (camelCase + snake + kebab aware). */ export declare function tokenize(text: string): string[]; /** Load a graphify graph.json. Returns only code nodes (file_type === 'code'). */ export declare function loadGraph(graphPath: string): GraphNode[]; /** * Map every spec trigger to its best-matching code-graph nodes. * * @param threshold minimum score for a node to count as a match (default 0.5, * matching the docs-drift convention). * @param topK keep at most this many matches per trigger. */ export declare function mapTriggersToGraph(triggers: SpecTrigger[], nodes: GraphNode[], threshold?: number, topK?: number): TriggerCoverage[]; //# sourceMappingURL=graphify.d.ts.map