export declare const GRAPH_VERSION = 6; /** * How a graph element was derived: * - ast-exact: resolved directly from parsed AST, no guessing * - heuristic: directory/name-based inference * - template-prefix: only the static prefix of a template literal was extractable * - ai-inferred: produced by an LLM (never asserted as fact) */ export type Provenance = "ast-exact" | "heuristic" | "template-prefix" | "ai-inferred"; /** Deterministic confidence heuristics (0..1). Not a statistical model. */ export declare const CONFIDENCE: { readonly AST_EXACT: 0.9; readonly HEURISTIC: 0.6; readonly TEMPLATE_PREFIX: 0.4; readonly AI_INFERRED: 0.5; }; /** Map provenance label to fixed confidence score. */ export declare function confidenceForProvenance(p: Provenance): number; export type NodeType = "route" | "handler" | "component" | "test" | "endpoint" | "module" | "function"; export type EdgeKind = "calls" | "imports" | "renders" | "tests" | "http"; export type Severity = "error" | "warn" | "info"; export type IssueKind = "orphaned_endpoint" | "missing_handler" | "dangling_test_ref" | "contract_parse_error" | "contract_missing_route" | "contract_undeclared_route" | "cross_repo_orphan" | "hook_failure" | "untested_feature"; export interface SutraNode { /** Stable deterministic id: `relative/path#symbol`. */ id: string; type: NodeType; name: string; /** Repo-relative POSIX path. */ file: string; line: number; /** Best-effort param/return shape, e.g. "{ email: string }". null if unknown. */ data_shape: string | null; /** Heuristic feature grouping id. */ feature: string; /** Language extractor that produced this node (e.g. "ts", "python-frappe"). */ language: string; /** Certainty score 0..1 inclusive; absent = unknown. */ confidence?: number; /** How this finding was derived; absent = unknown. */ provenance?: Provenance; } export interface SutraEdge { /** node id (or a synthetic id for an http target/endpoint). */ from: string; to: string; kind: EdgeKind; /** Certainty score 0..1 inclusive; absent = unknown. */ confidence?: number; /** How this finding was derived; absent = unknown. */ provenance?: Provenance; } export interface SutraIssue { severity: Severity; kind: IssueKind; /** The thing in question (node id, "METHOD /path", symbol, etc.). */ node: string; feature: string; message: string; /** Certainty score 0..1 inclusive; absent = unknown. */ confidence?: number; /** How this finding was derived; absent = unknown. */ provenance?: Provenance; } export type HealthBand = "green" | "amber" | "red"; export interface FeatureHealthInput { signal: string; available: boolean; weight: number; penalty: number; detail: string; } /** Heuristic structural health — not runtime correctness. */ export interface FeatureHealth { score: number; band: HealthBand; inputs: FeatureHealthInput[]; available_signals: string[]; } export interface SutraFeature { id: string; label: string; node_ids: string[]; issue_count: number; /** Composite structural health score (heuristic, code-derived). */ health: FeatureHealth; /** LLM-generated display name when label_source is ai-inferred. */ ai_name?: string; /** One-line LLM summary when label_source is ai-inferred. */ ai_summary?: string; /** How the display label was derived — heuristic default, ai-inferred when --ai succeeds. */ label_source?: "heuristic" | "ai-inferred"; /** Count of confirmed tests edges into this feature. Static linkage, NOT runtime coverage. */ test_edge_count: number; /** Distinct test node ids referencing into this feature (sorted). */ test_node_ids: string[]; /** True iff at least one confirmed tests edge resolves into this feature. Static presence only. */ tested: boolean; } /** Author-declared endpoint from feature.sutra.md (intent, not ground truth). */ export interface SutraContractEndpoint { method: string; path: string; } /** Parsed contract file — candidate declaration only. */ export interface SutraContract { feature: string; /** Repo-relative path to the contract file. */ file: string; endpoints: SutraContractEndpoint[]; } export type FlowTerminal = "handler" | "db" | "external" | "unresolved" | "truncated"; export interface SutraFlowStep { node: string; edge: SutraEdge | null; } export interface SutraFlow { id: string; entry: string; steps: SutraFlowStep[]; terminal: FlowTerminal; confidence: "confirmed" | "candidate"; } export interface SutraGraph { version: number; repo: string; /** ISO 8601 UTC. */ scanned_at: string; /** Short commit hash, or "unknown" if not a git repo. */ commit: string; nodes: SutraNode[]; edges: SutraEdge[]; issues: SutraIssue[]; features: SutraFeature[]; /** Parsed from feature.sutra.md when present; empty otherwise. */ contracts: SutraContract[]; /** Ordered request paths entry → terminal (Story 2.5). */ flows: SutraFlow[]; } export declare const SUTRA_DIR = ".sutra"; export declare const GRAPH_FILE = "graph.json"; export declare const BASELINE_FILE = "baseline.json"; export declare const GRAPH_PREV_FILE = "graph.prev.json"; export declare const DIFF_FILE = "diff.json"; export declare const VIEW_FILE = "view.html"; export declare const RECONCILE_FILE = "reconcile.json"; export declare const LINK_FILE = "link.json"; export declare const LINK_VERSION = 0; export type LinkResolution = "confirmed" | "broken" | "unresolved"; export interface LinkRepo { name: string; path: string; commit?: string; } export interface LinkedEdge { from: string; to: string; kind: "http"; resolution: LinkResolution; method: string; path: string; } export interface LinkResult { version: number; linked_at: string; repos: LinkRepo[]; edges: LinkedEdge[]; } /** Directories never scanned. */ export declare const EXCLUDED_DIRS: Set; /** Extensions scanned this phase. */ export declare const SCAN_EXTENSIONS: Set; /** True for files we skip even if extension matches (e.g. minified). */ export declare function isExcludedFile(fileName: string): boolean;