@harness-engineering/graph 0.3.4 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const NODE_TYPES: readonly ["repository", "module", "file", "class", "interface", "function", "method", "variable", "adr", "decision", "learning", "failure", "issue", "document", "skill", "conversation", "commit", "build", "test_result", "span", "metric", "log", "layer", "pattern", "constraint", "violation", "design_token", "aesthetic_intent", "design_constraint"];
3
+ declare const NODE_TYPES: readonly ["repository", "module", "file", "class", "interface", "function", "method", "variable", "adr", "decision", "learning", "failure", "issue", "document", "skill", "conversation", "commit", "build", "test_result", "span", "metric", "log", "layer", "pattern", "constraint", "violation", "design_token", "aesthetic_intent", "design_constraint", "requirement"];
4
4
  type NodeType = (typeof NODE_TYPES)[number];
5
- declare const EDGE_TYPES: readonly ["contains", "imports", "calls", "implements", "inherits", "references", "applies_to", "caused_by", "resolved_by", "documents", "violates", "specifies", "decided", "co_changes_with", "triggered_by", "failed_in", "executed_by", "measured_by", "uses_token", "declares_intent", "violates_design", "platform_binding"];
5
+ declare const EDGE_TYPES: readonly ["contains", "imports", "calls", "implements", "inherits", "references", "applies_to", "caused_by", "resolved_by", "documents", "violates", "specifies", "decided", "co_changes_with", "triggered_by", "failed_in", "executed_by", "measured_by", "uses_token", "declares_intent", "violates_design", "platform_binding", "requires", "verified_by", "tested_by"];
6
6
  type EdgeType = (typeof EDGE_TYPES)[number];
7
7
  declare const OBSERVABILITY_TYPES: ReadonlySet<NodeType>;
8
8
  interface SourceLocation {
@@ -70,7 +70,7 @@ interface GraphMetadata {
70
70
  declare const CURRENT_SCHEMA_VERSION = 1;
71
71
  declare const GraphNodeSchema: z.ZodObject<{
72
72
  id: z.ZodString;
73
- type: z.ZodEnum<["repository", "module", "file", "class", "interface", "function", "method", "variable", "adr", "decision", "learning", "failure", "issue", "document", "skill", "conversation", "commit", "build", "test_result", "span", "metric", "log", "layer", "pattern", "constraint", "violation", "design_token", "aesthetic_intent", "design_constraint"]>;
73
+ type: z.ZodEnum<["repository", "module", "file", "class", "interface", "function", "method", "variable", "adr", "decision", "learning", "failure", "issue", "document", "skill", "conversation", "commit", "build", "test_result", "span", "metric", "log", "layer", "pattern", "constraint", "violation", "design_token", "aesthetic_intent", "design_constraint", "requirement"]>;
74
74
  name: z.ZodString;
75
75
  path: z.ZodOptional<z.ZodString>;
76
76
  location: z.ZodOptional<z.ZodObject<{
@@ -99,7 +99,7 @@ declare const GraphNodeSchema: z.ZodObject<{
99
99
  lastModified: z.ZodOptional<z.ZodString>;
100
100
  }, "strip", z.ZodTypeAny, {
101
101
  id: string;
102
- type: "function" | "repository" | "module" | "file" | "class" | "interface" | "method" | "variable" | "adr" | "decision" | "learning" | "failure" | "issue" | "document" | "skill" | "conversation" | "commit" | "build" | "test_result" | "span" | "metric" | "log" | "layer" | "pattern" | "constraint" | "violation" | "design_token" | "aesthetic_intent" | "design_constraint";
102
+ type: "function" | "repository" | "module" | "file" | "class" | "interface" | "method" | "variable" | "adr" | "decision" | "learning" | "failure" | "issue" | "document" | "skill" | "conversation" | "commit" | "build" | "test_result" | "span" | "metric" | "log" | "layer" | "pattern" | "constraint" | "violation" | "design_token" | "aesthetic_intent" | "design_constraint" | "requirement";
103
103
  name: string;
104
104
  metadata: Record<string, unknown>;
105
105
  path?: string | undefined;
@@ -116,7 +116,7 @@ declare const GraphNodeSchema: z.ZodObject<{
116
116
  lastModified?: string | undefined;
117
117
  }, {
118
118
  id: string;
119
- type: "function" | "repository" | "module" | "file" | "class" | "interface" | "method" | "variable" | "adr" | "decision" | "learning" | "failure" | "issue" | "document" | "skill" | "conversation" | "commit" | "build" | "test_result" | "span" | "metric" | "log" | "layer" | "pattern" | "constraint" | "violation" | "design_token" | "aesthetic_intent" | "design_constraint";
119
+ type: "function" | "repository" | "module" | "file" | "class" | "interface" | "method" | "variable" | "adr" | "decision" | "learning" | "failure" | "issue" | "document" | "skill" | "conversation" | "commit" | "build" | "test_result" | "span" | "metric" | "log" | "layer" | "pattern" | "constraint" | "violation" | "design_token" | "aesthetic_intent" | "design_constraint" | "requirement";
120
120
  name: string;
121
121
  metadata: Record<string, unknown>;
122
122
  path?: string | undefined;
@@ -135,17 +135,17 @@ declare const GraphNodeSchema: z.ZodObject<{
135
135
  declare const GraphEdgeSchema: z.ZodObject<{
136
136
  from: z.ZodString;
137
137
  to: z.ZodString;
138
- type: z.ZodEnum<["contains", "imports", "calls", "implements", "inherits", "references", "applies_to", "caused_by", "resolved_by", "documents", "violates", "specifies", "decided", "co_changes_with", "triggered_by", "failed_in", "executed_by", "measured_by", "uses_token", "declares_intent", "violates_design", "platform_binding"]>;
138
+ type: z.ZodEnum<["contains", "imports", "calls", "implements", "inherits", "references", "applies_to", "caused_by", "resolved_by", "documents", "violates", "specifies", "decided", "co_changes_with", "triggered_by", "failed_in", "executed_by", "measured_by", "uses_token", "declares_intent", "violates_design", "platform_binding", "requires", "verified_by", "tested_by"]>;
139
139
  confidence: z.ZodOptional<z.ZodNumber>;
140
140
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
141
141
  }, "strip", z.ZodTypeAny, {
142
- type: "contains" | "imports" | "calls" | "implements" | "inherits" | "references" | "applies_to" | "caused_by" | "resolved_by" | "documents" | "violates" | "specifies" | "decided" | "co_changes_with" | "triggered_by" | "failed_in" | "executed_by" | "measured_by" | "uses_token" | "declares_intent" | "violates_design" | "platform_binding";
142
+ type: "contains" | "imports" | "calls" | "implements" | "inherits" | "references" | "applies_to" | "caused_by" | "resolved_by" | "documents" | "violates" | "specifies" | "decided" | "co_changes_with" | "triggered_by" | "failed_in" | "executed_by" | "measured_by" | "uses_token" | "declares_intent" | "violates_design" | "platform_binding" | "requires" | "verified_by" | "tested_by";
143
143
  from: string;
144
144
  to: string;
145
145
  metadata?: Record<string, unknown> | undefined;
146
146
  confidence?: number | undefined;
147
147
  }, {
148
- type: "contains" | "imports" | "calls" | "implements" | "inherits" | "references" | "applies_to" | "caused_by" | "resolved_by" | "documents" | "violates" | "specifies" | "decided" | "co_changes_with" | "triggered_by" | "failed_in" | "executed_by" | "measured_by" | "uses_token" | "declares_intent" | "violates_design" | "platform_binding";
148
+ type: "contains" | "imports" | "calls" | "implements" | "inherits" | "references" | "applies_to" | "caused_by" | "resolved_by" | "documents" | "violates" | "specifies" | "decided" | "co_changes_with" | "triggered_by" | "failed_in" | "executed_by" | "measured_by" | "uses_token" | "declares_intent" | "violates_design" | "platform_binding" | "requires" | "verified_by" | "tested_by";
149
149
  from: string;
150
150
  to: string;
151
151
  metadata?: Record<string, unknown> | undefined;
@@ -163,10 +163,11 @@ interface EdgeQuery {
163
163
  readonly type?: EdgeType;
164
164
  }
165
165
  declare class GraphStore {
166
- private readonly db;
167
- private nodes;
168
- private edges;
169
- constructor();
166
+ private nodeMap;
167
+ private edgeMap;
168
+ private edgesByFrom;
169
+ private edgesByTo;
170
+ private edgesByType;
170
171
  addNode(node: GraphNode): void;
171
172
  batchAddNodes(nodes: readonly GraphNode[]): void;
172
173
  getNode(id: string): GraphNode | null;
@@ -181,7 +182,7 @@ declare class GraphStore {
181
182
  clear(): void;
182
183
  save(dirPath: string): Promise<void>;
183
184
  load(dirPath: string): Promise<boolean>;
184
- private stripLokiMeta;
185
+ private removeEdgeInternal;
185
186
  }
186
187
 
187
188
  /**
@@ -300,6 +301,12 @@ declare class CodeIngestor {
300
301
  private computeMaxNesting;
301
302
  private countParameters;
302
303
  private detectLanguage;
304
+ /**
305
+ * Scan file contents for @req annotations and create verified_by edges
306
+ * linking requirement nodes to the annotated files.
307
+ * Format: // @req <feature-name>#<index>
308
+ */
309
+ private extractReqAnnotations;
303
310
  }
304
311
 
305
312
  type GitRunner = (rootDir: string, args: string[]) => Promise<string>;
@@ -347,6 +354,31 @@ declare class KnowledgeIngestor {
347
354
  private findMarkdownFiles;
348
355
  }
349
356
 
357
+ declare class RequirementIngestor {
358
+ private readonly store;
359
+ constructor(store: GraphStore);
360
+ /**
361
+ * Scan a specs directory for `<feature>/proposal.md` files,
362
+ * extract numbered requirements from recognized sections,
363
+ * and create requirement nodes with convention-based edges.
364
+ */
365
+ ingestSpecs(specsDir: string): Promise<IngestResult>;
366
+ /**
367
+ * Parse markdown content and extract numbered items from recognized sections.
368
+ */
369
+ private extractRequirements;
370
+ /**
371
+ * Convention-based linking: match requirement to code/test files
372
+ * by feature name in their path.
373
+ */
374
+ private linkByPathPattern;
375
+ /**
376
+ * Convention-based linking: match requirement text to code nodes
377
+ * by keyword overlap (function/class names appearing in requirement text).
378
+ */
379
+ private linkByKeywordOverlap;
380
+ }
381
+
350
382
  type HttpClient = (url: string, options?: {
351
383
  headers?: Record<string, string>;
352
384
  }) => Promise<{
@@ -809,6 +841,39 @@ declare class Assembler {
809
841
  checkCoverage(): GraphCoverageReport;
810
842
  }
811
843
 
844
+ interface TracedFile {
845
+ readonly path: string;
846
+ readonly confidence: number;
847
+ readonly method: 'convention' | 'annotation' | 'plan-file-map';
848
+ }
849
+ interface RequirementCoverage {
850
+ readonly requirementId: string;
851
+ readonly requirementName: string;
852
+ readonly index: number;
853
+ readonly codeFiles: readonly TracedFile[];
854
+ readonly testFiles: readonly TracedFile[];
855
+ readonly status: 'full' | 'code-only' | 'test-only' | 'none';
856
+ readonly maxConfidence: number;
857
+ }
858
+ interface TraceabilityResult {
859
+ readonly specPath: string;
860
+ readonly featureName: string;
861
+ readonly requirements: readonly RequirementCoverage[];
862
+ readonly summary: {
863
+ readonly total: number;
864
+ readonly withCode: number;
865
+ readonly withTests: number;
866
+ readonly fullyTraced: number;
867
+ readonly untraceable: number;
868
+ readonly coveragePercent: number;
869
+ };
870
+ }
871
+ interface TraceabilityOptions {
872
+ readonly specPath?: string;
873
+ readonly featureName?: string;
874
+ }
875
+ declare function queryTraceability(store: GraphStore, options?: TraceabilityOptions): TraceabilityResult[];
876
+
812
877
  interface GraphDependencyData {
813
878
  readonly nodes: readonly string[];
814
879
  readonly edges: ReadonlyArray<{
@@ -967,4 +1032,4 @@ declare class ConflictPredictor {
967
1032
 
968
1033
  declare const VERSION = "0.2.0";
969
1034
 
970
- export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AskGraphResult, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, type ClassificationResult, CodeIngestor, type ConflictDetail, type ConflictPrediction, ConflictPredictor, type ConflictSeverity, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, EntityExtractor, EntityResolver, FusionLayer, type FusionResult, GitIngestor, type GitRunner, GraphAnomalyAdapter, type GraphBudget, GraphComplexityAdapter, type GraphComplexityHotspot, type GraphComplexityResult, type GraphConnector, GraphConstraintAdapter, GraphCouplingAdapter, type GraphCouplingFileData, type GraphCouplingResult, type GraphCoverageReport, type GraphDeadCodeData, type GraphDependencyData, type GraphDriftData, type GraphEdge, GraphEdgeSchema, GraphEntropyAdapter, GraphFeedbackAdapter, type GraphFilterResult, type GraphHarnessCheckData, type GraphImpactData, type GraphLayerViolation, type GraphMetadata, type GraphNode, GraphNodeSchema, type GraphSnapshotSummary, GraphStore, type HttpClient, INTENTS, type ImpactGroups, type IndependenceCheckParams, type IndependenceResult, type IngestResult, type Intent, IntentClassifier, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type OverlapDetail, type PairResult, type ProjectionSpec, type ResolvedEntity, ResponseFormatter, SlackConnector, type SourceLocation, type StatisticalOutlier, SyncManager, type SyncMetadata, type TaskDefinition, TaskIndependenceAnalyzer, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, askGraph, groupNodesByImpact, linkToCode, loadGraph, project, saveGraph };
1035
+ export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AskGraphResult, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, type ClassificationResult, CodeIngestor, type ConflictDetail, type ConflictPrediction, ConflictPredictor, type ConflictSeverity, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, EntityExtractor, EntityResolver, FusionLayer, type FusionResult, GitIngestor, type GitRunner, GraphAnomalyAdapter, type GraphBudget, GraphComplexityAdapter, type GraphComplexityHotspot, type GraphComplexityResult, type GraphConnector, GraphConstraintAdapter, GraphCouplingAdapter, type GraphCouplingFileData, type GraphCouplingResult, type GraphCoverageReport, type GraphDeadCodeData, type GraphDependencyData, type GraphDriftData, type GraphEdge, GraphEdgeSchema, GraphEntropyAdapter, GraphFeedbackAdapter, type GraphFilterResult, type GraphHarnessCheckData, type GraphImpactData, type GraphLayerViolation, type GraphMetadata, type GraphNode, GraphNodeSchema, type GraphSnapshotSummary, GraphStore, type HttpClient, INTENTS, type ImpactGroups, type IndependenceCheckParams, type IndependenceResult, type IngestResult, type Intent, IntentClassifier, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type OverlapDetail, type PairResult, type ProjectionSpec, type RequirementCoverage, RequirementIngestor, type ResolvedEntity, ResponseFormatter, SlackConnector, type SourceLocation, type StatisticalOutlier, SyncManager, type SyncMetadata, type TaskDefinition, TaskIndependenceAnalyzer, TopologicalLinker, type TraceabilityOptions, type TraceabilityResult, type TracedFile, VERSION, type VectorSearchResult, VectorStore, askGraph, groupNodesByImpact, linkToCode, loadGraph, project, queryTraceability, saveGraph };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { z } from 'zod';
2
2
 
3
- declare const NODE_TYPES: readonly ["repository", "module", "file", "class", "interface", "function", "method", "variable", "adr", "decision", "learning", "failure", "issue", "document", "skill", "conversation", "commit", "build", "test_result", "span", "metric", "log", "layer", "pattern", "constraint", "violation", "design_token", "aesthetic_intent", "design_constraint"];
3
+ declare const NODE_TYPES: readonly ["repository", "module", "file", "class", "interface", "function", "method", "variable", "adr", "decision", "learning", "failure", "issue", "document", "skill", "conversation", "commit", "build", "test_result", "span", "metric", "log", "layer", "pattern", "constraint", "violation", "design_token", "aesthetic_intent", "design_constraint", "requirement"];
4
4
  type NodeType = (typeof NODE_TYPES)[number];
5
- declare const EDGE_TYPES: readonly ["contains", "imports", "calls", "implements", "inherits", "references", "applies_to", "caused_by", "resolved_by", "documents", "violates", "specifies", "decided", "co_changes_with", "triggered_by", "failed_in", "executed_by", "measured_by", "uses_token", "declares_intent", "violates_design", "platform_binding"];
5
+ declare const EDGE_TYPES: readonly ["contains", "imports", "calls", "implements", "inherits", "references", "applies_to", "caused_by", "resolved_by", "documents", "violates", "specifies", "decided", "co_changes_with", "triggered_by", "failed_in", "executed_by", "measured_by", "uses_token", "declares_intent", "violates_design", "platform_binding", "requires", "verified_by", "tested_by"];
6
6
  type EdgeType = (typeof EDGE_TYPES)[number];
7
7
  declare const OBSERVABILITY_TYPES: ReadonlySet<NodeType>;
8
8
  interface SourceLocation {
@@ -70,7 +70,7 @@ interface GraphMetadata {
70
70
  declare const CURRENT_SCHEMA_VERSION = 1;
71
71
  declare const GraphNodeSchema: z.ZodObject<{
72
72
  id: z.ZodString;
73
- type: z.ZodEnum<["repository", "module", "file", "class", "interface", "function", "method", "variable", "adr", "decision", "learning", "failure", "issue", "document", "skill", "conversation", "commit", "build", "test_result", "span", "metric", "log", "layer", "pattern", "constraint", "violation", "design_token", "aesthetic_intent", "design_constraint"]>;
73
+ type: z.ZodEnum<["repository", "module", "file", "class", "interface", "function", "method", "variable", "adr", "decision", "learning", "failure", "issue", "document", "skill", "conversation", "commit", "build", "test_result", "span", "metric", "log", "layer", "pattern", "constraint", "violation", "design_token", "aesthetic_intent", "design_constraint", "requirement"]>;
74
74
  name: z.ZodString;
75
75
  path: z.ZodOptional<z.ZodString>;
76
76
  location: z.ZodOptional<z.ZodObject<{
@@ -99,7 +99,7 @@ declare const GraphNodeSchema: z.ZodObject<{
99
99
  lastModified: z.ZodOptional<z.ZodString>;
100
100
  }, "strip", z.ZodTypeAny, {
101
101
  id: string;
102
- type: "function" | "repository" | "module" | "file" | "class" | "interface" | "method" | "variable" | "adr" | "decision" | "learning" | "failure" | "issue" | "document" | "skill" | "conversation" | "commit" | "build" | "test_result" | "span" | "metric" | "log" | "layer" | "pattern" | "constraint" | "violation" | "design_token" | "aesthetic_intent" | "design_constraint";
102
+ type: "function" | "repository" | "module" | "file" | "class" | "interface" | "method" | "variable" | "adr" | "decision" | "learning" | "failure" | "issue" | "document" | "skill" | "conversation" | "commit" | "build" | "test_result" | "span" | "metric" | "log" | "layer" | "pattern" | "constraint" | "violation" | "design_token" | "aesthetic_intent" | "design_constraint" | "requirement";
103
103
  name: string;
104
104
  metadata: Record<string, unknown>;
105
105
  path?: string | undefined;
@@ -116,7 +116,7 @@ declare const GraphNodeSchema: z.ZodObject<{
116
116
  lastModified?: string | undefined;
117
117
  }, {
118
118
  id: string;
119
- type: "function" | "repository" | "module" | "file" | "class" | "interface" | "method" | "variable" | "adr" | "decision" | "learning" | "failure" | "issue" | "document" | "skill" | "conversation" | "commit" | "build" | "test_result" | "span" | "metric" | "log" | "layer" | "pattern" | "constraint" | "violation" | "design_token" | "aesthetic_intent" | "design_constraint";
119
+ type: "function" | "repository" | "module" | "file" | "class" | "interface" | "method" | "variable" | "adr" | "decision" | "learning" | "failure" | "issue" | "document" | "skill" | "conversation" | "commit" | "build" | "test_result" | "span" | "metric" | "log" | "layer" | "pattern" | "constraint" | "violation" | "design_token" | "aesthetic_intent" | "design_constraint" | "requirement";
120
120
  name: string;
121
121
  metadata: Record<string, unknown>;
122
122
  path?: string | undefined;
@@ -135,17 +135,17 @@ declare const GraphNodeSchema: z.ZodObject<{
135
135
  declare const GraphEdgeSchema: z.ZodObject<{
136
136
  from: z.ZodString;
137
137
  to: z.ZodString;
138
- type: z.ZodEnum<["contains", "imports", "calls", "implements", "inherits", "references", "applies_to", "caused_by", "resolved_by", "documents", "violates", "specifies", "decided", "co_changes_with", "triggered_by", "failed_in", "executed_by", "measured_by", "uses_token", "declares_intent", "violates_design", "platform_binding"]>;
138
+ type: z.ZodEnum<["contains", "imports", "calls", "implements", "inherits", "references", "applies_to", "caused_by", "resolved_by", "documents", "violates", "specifies", "decided", "co_changes_with", "triggered_by", "failed_in", "executed_by", "measured_by", "uses_token", "declares_intent", "violates_design", "platform_binding", "requires", "verified_by", "tested_by"]>;
139
139
  confidence: z.ZodOptional<z.ZodNumber>;
140
140
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
141
141
  }, "strip", z.ZodTypeAny, {
142
- type: "contains" | "imports" | "calls" | "implements" | "inherits" | "references" | "applies_to" | "caused_by" | "resolved_by" | "documents" | "violates" | "specifies" | "decided" | "co_changes_with" | "triggered_by" | "failed_in" | "executed_by" | "measured_by" | "uses_token" | "declares_intent" | "violates_design" | "platform_binding";
142
+ type: "contains" | "imports" | "calls" | "implements" | "inherits" | "references" | "applies_to" | "caused_by" | "resolved_by" | "documents" | "violates" | "specifies" | "decided" | "co_changes_with" | "triggered_by" | "failed_in" | "executed_by" | "measured_by" | "uses_token" | "declares_intent" | "violates_design" | "platform_binding" | "requires" | "verified_by" | "tested_by";
143
143
  from: string;
144
144
  to: string;
145
145
  metadata?: Record<string, unknown> | undefined;
146
146
  confidence?: number | undefined;
147
147
  }, {
148
- type: "contains" | "imports" | "calls" | "implements" | "inherits" | "references" | "applies_to" | "caused_by" | "resolved_by" | "documents" | "violates" | "specifies" | "decided" | "co_changes_with" | "triggered_by" | "failed_in" | "executed_by" | "measured_by" | "uses_token" | "declares_intent" | "violates_design" | "platform_binding";
148
+ type: "contains" | "imports" | "calls" | "implements" | "inherits" | "references" | "applies_to" | "caused_by" | "resolved_by" | "documents" | "violates" | "specifies" | "decided" | "co_changes_with" | "triggered_by" | "failed_in" | "executed_by" | "measured_by" | "uses_token" | "declares_intent" | "violates_design" | "platform_binding" | "requires" | "verified_by" | "tested_by";
149
149
  from: string;
150
150
  to: string;
151
151
  metadata?: Record<string, unknown> | undefined;
@@ -163,10 +163,11 @@ interface EdgeQuery {
163
163
  readonly type?: EdgeType;
164
164
  }
165
165
  declare class GraphStore {
166
- private readonly db;
167
- private nodes;
168
- private edges;
169
- constructor();
166
+ private nodeMap;
167
+ private edgeMap;
168
+ private edgesByFrom;
169
+ private edgesByTo;
170
+ private edgesByType;
170
171
  addNode(node: GraphNode): void;
171
172
  batchAddNodes(nodes: readonly GraphNode[]): void;
172
173
  getNode(id: string): GraphNode | null;
@@ -181,7 +182,7 @@ declare class GraphStore {
181
182
  clear(): void;
182
183
  save(dirPath: string): Promise<void>;
183
184
  load(dirPath: string): Promise<boolean>;
184
- private stripLokiMeta;
185
+ private removeEdgeInternal;
185
186
  }
186
187
 
187
188
  /**
@@ -300,6 +301,12 @@ declare class CodeIngestor {
300
301
  private computeMaxNesting;
301
302
  private countParameters;
302
303
  private detectLanguage;
304
+ /**
305
+ * Scan file contents for @req annotations and create verified_by edges
306
+ * linking requirement nodes to the annotated files.
307
+ * Format: // @req <feature-name>#<index>
308
+ */
309
+ private extractReqAnnotations;
303
310
  }
304
311
 
305
312
  type GitRunner = (rootDir: string, args: string[]) => Promise<string>;
@@ -347,6 +354,31 @@ declare class KnowledgeIngestor {
347
354
  private findMarkdownFiles;
348
355
  }
349
356
 
357
+ declare class RequirementIngestor {
358
+ private readonly store;
359
+ constructor(store: GraphStore);
360
+ /**
361
+ * Scan a specs directory for `<feature>/proposal.md` files,
362
+ * extract numbered requirements from recognized sections,
363
+ * and create requirement nodes with convention-based edges.
364
+ */
365
+ ingestSpecs(specsDir: string): Promise<IngestResult>;
366
+ /**
367
+ * Parse markdown content and extract numbered items from recognized sections.
368
+ */
369
+ private extractRequirements;
370
+ /**
371
+ * Convention-based linking: match requirement to code/test files
372
+ * by feature name in their path.
373
+ */
374
+ private linkByPathPattern;
375
+ /**
376
+ * Convention-based linking: match requirement text to code nodes
377
+ * by keyword overlap (function/class names appearing in requirement text).
378
+ */
379
+ private linkByKeywordOverlap;
380
+ }
381
+
350
382
  type HttpClient = (url: string, options?: {
351
383
  headers?: Record<string, string>;
352
384
  }) => Promise<{
@@ -809,6 +841,39 @@ declare class Assembler {
809
841
  checkCoverage(): GraphCoverageReport;
810
842
  }
811
843
 
844
+ interface TracedFile {
845
+ readonly path: string;
846
+ readonly confidence: number;
847
+ readonly method: 'convention' | 'annotation' | 'plan-file-map';
848
+ }
849
+ interface RequirementCoverage {
850
+ readonly requirementId: string;
851
+ readonly requirementName: string;
852
+ readonly index: number;
853
+ readonly codeFiles: readonly TracedFile[];
854
+ readonly testFiles: readonly TracedFile[];
855
+ readonly status: 'full' | 'code-only' | 'test-only' | 'none';
856
+ readonly maxConfidence: number;
857
+ }
858
+ interface TraceabilityResult {
859
+ readonly specPath: string;
860
+ readonly featureName: string;
861
+ readonly requirements: readonly RequirementCoverage[];
862
+ readonly summary: {
863
+ readonly total: number;
864
+ readonly withCode: number;
865
+ readonly withTests: number;
866
+ readonly fullyTraced: number;
867
+ readonly untraceable: number;
868
+ readonly coveragePercent: number;
869
+ };
870
+ }
871
+ interface TraceabilityOptions {
872
+ readonly specPath?: string;
873
+ readonly featureName?: string;
874
+ }
875
+ declare function queryTraceability(store: GraphStore, options?: TraceabilityOptions): TraceabilityResult[];
876
+
812
877
  interface GraphDependencyData {
813
878
  readonly nodes: readonly string[];
814
879
  readonly edges: ReadonlyArray<{
@@ -967,4 +1032,4 @@ declare class ConflictPredictor {
967
1032
 
968
1033
  declare const VERSION = "0.2.0";
969
1034
 
970
- export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AskGraphResult, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, type ClassificationResult, CodeIngestor, type ConflictDetail, type ConflictPrediction, ConflictPredictor, type ConflictSeverity, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, EntityExtractor, EntityResolver, FusionLayer, type FusionResult, GitIngestor, type GitRunner, GraphAnomalyAdapter, type GraphBudget, GraphComplexityAdapter, type GraphComplexityHotspot, type GraphComplexityResult, type GraphConnector, GraphConstraintAdapter, GraphCouplingAdapter, type GraphCouplingFileData, type GraphCouplingResult, type GraphCoverageReport, type GraphDeadCodeData, type GraphDependencyData, type GraphDriftData, type GraphEdge, GraphEdgeSchema, GraphEntropyAdapter, GraphFeedbackAdapter, type GraphFilterResult, type GraphHarnessCheckData, type GraphImpactData, type GraphLayerViolation, type GraphMetadata, type GraphNode, GraphNodeSchema, type GraphSnapshotSummary, GraphStore, type HttpClient, INTENTS, type ImpactGroups, type IndependenceCheckParams, type IndependenceResult, type IngestResult, type Intent, IntentClassifier, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type OverlapDetail, type PairResult, type ProjectionSpec, type ResolvedEntity, ResponseFormatter, SlackConnector, type SourceLocation, type StatisticalOutlier, SyncManager, type SyncMetadata, type TaskDefinition, TaskIndependenceAnalyzer, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, askGraph, groupNodesByImpact, linkToCode, loadGraph, project, saveGraph };
1035
+ export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AskGraphResult, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, type ClassificationResult, CodeIngestor, type ConflictDetail, type ConflictPrediction, ConflictPredictor, type ConflictSeverity, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, EntityExtractor, EntityResolver, FusionLayer, type FusionResult, GitIngestor, type GitRunner, GraphAnomalyAdapter, type GraphBudget, GraphComplexityAdapter, type GraphComplexityHotspot, type GraphComplexityResult, type GraphConnector, GraphConstraintAdapter, GraphCouplingAdapter, type GraphCouplingFileData, type GraphCouplingResult, type GraphCoverageReport, type GraphDeadCodeData, type GraphDependencyData, type GraphDriftData, type GraphEdge, GraphEdgeSchema, GraphEntropyAdapter, GraphFeedbackAdapter, type GraphFilterResult, type GraphHarnessCheckData, type GraphImpactData, type GraphLayerViolation, type GraphMetadata, type GraphNode, GraphNodeSchema, type GraphSnapshotSummary, GraphStore, type HttpClient, INTENTS, type ImpactGroups, type IndependenceCheckParams, type IndependenceResult, type IngestResult, type Intent, IntentClassifier, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type OverlapDetail, type PairResult, type ProjectionSpec, type RequirementCoverage, RequirementIngestor, type ResolvedEntity, ResponseFormatter, SlackConnector, type SourceLocation, type StatisticalOutlier, SyncManager, type SyncMetadata, type TaskDefinition, TaskIndependenceAnalyzer, TopologicalLinker, type TraceabilityOptions, type TraceabilityResult, type TracedFile, VERSION, type VectorSearchResult, VectorStore, askGraph, groupNodesByImpact, linkToCode, loadGraph, project, queryTraceability, saveGraph };