@harness-engineering/graph 0.4.0 → 0.4.2

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/README.md CHANGED
@@ -73,27 +73,29 @@ const results = fusion.search('authentication handler', { topK: 10 });
73
73
 
74
74
  ## Key Classes
75
75
 
76
- | Class | Description |
77
- | ------------------------- | ------------------------------------------------------------------------------- |
78
- | `GraphStore` | In-memory graph backed by LokiJS with indexed node/edge collections |
79
- | `VectorStore` | Optional vector index for semantic similarity search (hnswlib) |
80
- | `ContextQL` | BFS-based graph traversal engine with type filtering and observability pruning |
81
- | `project` | Projection utility to select specific fields from query results |
82
- | `CodeIngestor` | Parses TypeScript/JavaScript files into file, class, function, and method nodes |
83
- | `GitIngestor` | Extracts commit history and co-change relationships from git |
84
- | `KnowledgeIngestor` | Ingests ADRs, learnings, and markdown knowledge artifacts |
85
- | `TopologicalLinker` | Creates structural edges (imports, calls, references) between code nodes |
86
- | `FusionLayer` | Hybrid search combining keyword matching and semantic similarity scores |
87
- | `Assembler` | Phase-aware context assembly with token budgets and coverage reports |
88
- | `SyncManager` | Orchestrates connector syncs with incremental update tracking |
89
- | `GraphEntropyAdapter` | Detects graph drift and dead code for entropy monitoring |
90
- | `GraphConstraintAdapter` | Validates dependency rules and layer boundary violations |
91
- | `GraphFeedbackAdapter` | Computes impact analysis and harness check data from graph state |
92
- | `saveGraph` / `loadGraph` | Serializes and deserializes the graph store to/from disk |
76
+ | Class | Description |
77
+ | ------------------------------ | ------------------------------------------------------------------------------------ |
78
+ | `GraphStore` | In-memory graph backed by LokiJS with indexed node/edge collections |
79
+ | `VectorStore` | Optional vector index for semantic similarity search (hnswlib) |
80
+ | `ContextQL` | BFS-based graph traversal engine with type filtering and observability pruning |
81
+ | `project` | Projection utility to select specific fields from query results |
82
+ | `CodeIngestor` | Parses TypeScript/JavaScript files into file, class, function, and method nodes |
83
+ | `GitIngestor` | Extracts commit history and co-change relationships from git |
84
+ | `KnowledgeIngestor` | Ingests ADRs, learnings, and markdown knowledge artifacts |
85
+ | `TopologicalLinker` | Creates structural edges (imports, calls, references) between code nodes |
86
+ | `FusionLayer` | Hybrid search combining keyword matching and semantic similarity scores |
87
+ | `Assembler` | Phase-aware context assembly with token budgets and coverage reports |
88
+ | `SyncManager` | Orchestrates connector syncs with incremental update tracking |
89
+ | `GraphEntropyAdapter` | Detects graph drift and dead code for entropy monitoring |
90
+ | `GraphConstraintAdapter` | Validates dependency rules and layer boundary violations |
91
+ | `GraphFeedbackAdapter` | Computes impact analysis and harness check data from graph state |
92
+ | `CascadeSimulator` | Probability-weighted BFS for cascading failure simulation (`compute_blast_radius`) |
93
+ | `CompositeProbabilityStrategy` | Default edge probability strategy blending edge type, change frequency, and coupling |
94
+ | `saveGraph` / `loadGraph` | Serializes and deserializes the graph store to/from disk |
93
95
 
94
96
  ## Node Types
95
97
 
96
- 24 node types organized by category:
98
+ 28 node types organized by category:
97
99
 
98
100
  | Category | Types |
99
101
  | ----------------- | -------------------------------------------------------------------------------------- |
@@ -102,19 +104,23 @@ const results = fusion.search('authentication handler', { topK: 10 });
102
104
  | **VCS** | `commit`, `build`, `test_result` |
103
105
  | **Observability** | `span`, `metric`, `log` |
104
106
  | **Structural** | `layer`, `pattern`, `constraint`, `violation` |
107
+ | **Design** | `design_token`, `aesthetic_intent`, `design_constraint` |
108
+ | **Traceability** | `requirement` |
105
109
 
106
110
  Observability types (`span`, `metric`, `log`) are pruned by default in ContextQL queries to reduce noise.
107
111
 
108
112
  ## Edge Types
109
113
 
110
- 17 edge types organized by category:
114
+ 24 edge types organized by category:
111
115
 
112
- | Category | Types |
113
- | ------------- | ----------------------------------------------------------------------------------------- |
114
- | **Code** | `contains`, `imports`, `calls`, `implements`, `inherits`, `references` |
115
- | **Knowledge** | `applies_to`, `caused_by`, `resolved_by`, `documents`, `violates`, `specifies`, `decided` |
116
- | **VCS** | `co_changes_with`, `triggered_by`, `failed_in` |
117
- | **Execution** | `executed_by`, `measured_by` |
116
+ | Category | Types |
117
+ | ---------------- | ----------------------------------------------------------------------------------------- |
118
+ | **Code** | `contains`, `imports`, `calls`, `implements`, `inherits`, `references` |
119
+ | **Knowledge** | `applies_to`, `caused_by`, `resolved_by`, `documents`, `violates`, `specifies`, `decided` |
120
+ | **VCS** | `co_changes_with`, `triggered_by`, `failed_in` |
121
+ | **Execution** | `executed_by`, `measured_by` |
122
+ | **Design** | `uses_token`, `declares_intent`, `violates_design`, `platform_binding` |
123
+ | **Traceability** | `requires`, `verified_by`, `tested_by` |
118
124
 
119
125
  Edges carry an optional `confidence` score (0-1) used by the FusionLayer for ranking.
120
126
 
package/dist/index.d.mts CHANGED
@@ -176,7 +176,11 @@ declare class GraphStore {
176
176
  addEdge(edge: GraphEdge): void;
177
177
  batchAddEdges(edges: readonly GraphEdge[]): void;
178
178
  getEdges(query: EdgeQuery): GraphEdge[];
179
+ /** Pick the most selective index to start from. */
180
+ private selectCandidates;
179
181
  getNeighbors(nodeId: string, direction?: 'outbound' | 'inbound' | 'both'): GraphNode[];
182
+ private collectNeighborIds;
183
+ private resolveNodes;
180
184
  get nodeCount(): number;
181
185
  get edgeCount(): number;
182
186
  clear(): void;
@@ -252,6 +256,9 @@ declare class ContextQL {
252
256
 
253
257
  declare function project(nodes: readonly GraphNode[], spec: ProjectionSpec | undefined): Partial<GraphNode>[];
254
258
 
259
+ type NodeCategory = 'tests' | 'docs' | 'code' | 'other';
260
+ /** Classify a graph node into an impact category. */
261
+ declare function classifyNodeCategory(node: GraphNode): NodeCategory;
255
262
  interface ImpactGroups {
256
263
  readonly tests: readonly GraphNode[];
257
264
  readonly docs: readonly GraphNode[];
@@ -320,8 +327,16 @@ declare class GitIngestor {
320
327
  private readonly gitRunner?;
321
328
  constructor(store: GraphStore, gitRunner?: GitRunner | undefined);
322
329
  ingest(rootDir: string): Promise<IngestResult>;
330
+ private ingestCommit;
331
+ private ingestCoChanges;
323
332
  private runGit;
324
333
  private parseGitLog;
334
+ /**
335
+ * Process one line from git log output, updating the in-progress commit builder
336
+ * and flushing completed commits into the accumulator.
337
+ * Returns the updated current builder (null if flushed and not replaced).
338
+ */
339
+ private processLogLine;
325
340
  private computeCoChanges;
326
341
  }
327
342
 
@@ -363,10 +378,22 @@ declare class RequirementIngestor {
363
378
  * and create requirement nodes with convention-based edges.
364
379
  */
365
380
  ingestSpecs(specsDir: string): Promise<IngestResult>;
381
+ private ingestFeatureDir;
382
+ private ingestSpec;
383
+ private ingestRequirement;
366
384
  /**
367
385
  * Parse markdown content and extract numbered items from recognized sections.
368
386
  */
369
387
  private extractRequirements;
388
+ /**
389
+ * Check if a line is a section heading and return updated section state,
390
+ * or return null if the line is not a heading.
391
+ */
392
+ private processHeadingLine;
393
+ /**
394
+ * Build a requirement GraphNode from a matched numbered-item line.
395
+ */
396
+ private buildRequirementNode;
370
397
  /**
371
398
  * Convention-based linking: match requirement to code/test files
372
399
  * by feature name in their path.
@@ -429,6 +456,7 @@ declare class JiraConnector implements GraphConnector {
429
456
  private readonly httpClient;
430
457
  constructor(httpClient?: HttpClient);
431
458
  ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
459
+ private fetchAllIssues;
432
460
  private processIssue;
433
461
  }
434
462
 
@@ -447,6 +475,7 @@ declare class ConfluenceConnector implements GraphConnector {
447
475
  private readonly httpClient;
448
476
  constructor(httpClient?: HttpClient);
449
477
  ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
478
+ private fetchAllPagesHandled;
450
479
  private fetchAllPages;
451
480
  private processPage;
452
481
  }
@@ -457,6 +486,7 @@ declare class CIConnector implements GraphConnector {
457
486
  private readonly httpClient;
458
487
  constructor(httpClient?: HttpClient);
459
488
  ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
489
+ private fetchAndIngestRuns;
460
490
  }
461
491
 
462
492
  interface FusionResult {
@@ -475,6 +505,9 @@ declare class FusionLayer {
475
505
  private readonly semanticWeight;
476
506
  constructor(store: GraphStore, vectorStore?: VectorStore, keywordWeight?: number, semanticWeight?: number);
477
507
  search(query: string, topK?: number, queryEmbedding?: readonly number[]): FusionResult[];
508
+ private buildSemanticScores;
509
+ private resolveWeights;
510
+ private scoreNodes;
478
511
  private extractKeywords;
479
512
  private keywordScore;
480
513
  private singleKeywordScore;
@@ -519,6 +552,7 @@ declare class GraphEntropyAdapter {
519
552
  * 4. If target exists -> compare lastModified timestamps to determine staleness
520
553
  */
521
554
  computeDriftData(): GraphDriftData;
555
+ private classifyDocEdge;
522
556
  /**
523
557
  * BFS from entry points to find reachable vs unreachable code nodes.
524
558
  *
@@ -640,6 +674,9 @@ declare class GraphAnomalyAdapter {
640
674
  private readonly store;
641
675
  constructor(store: GraphStore);
642
676
  detect(options?: AnomalyDetectionOptions): AnomalyReport;
677
+ private filterMetrics;
678
+ private computeAllOutliers;
679
+ private computeOverlap;
643
680
  private collectMetricValues;
644
681
  private computeZScoreOutliers;
645
682
  private findArticulationPoints;
@@ -736,6 +773,14 @@ declare class EntityExtractor {
736
773
  * @returns Array of raw entity strings in priority order, deduplicated
737
774
  */
738
775
  extract(query: string): readonly string[];
776
+ /** Strategy 1: Quoted strings. Returns the set of consumed tokens. */
777
+ private extractQuoted;
778
+ /** Strategy 2: PascalCase/camelCase tokens. Returns the set of consumed tokens. */
779
+ private extractCasing;
780
+ /** Strategy 3: File paths. Returns the set of consumed tokens. */
781
+ private extractPaths;
782
+ /** Strategy 4: Remaining significant nouns after stop-word and intent-keyword removal. */
783
+ private extractNouns;
739
784
  }
740
785
 
741
786
  /**
@@ -823,17 +868,17 @@ declare class Assembler {
823
868
  assembleContext(intent: string, tokenBudget?: number): AssembledContext;
824
869
  private expandSearchResults;
825
870
  private truncateToFit;
826
- /**
827
- * Compute a token budget allocation across node types.
828
- */
871
+ private countNodesByType;
872
+ private computeModuleDensity;
873
+ private computeTypeWeights;
874
+ private allocateProportionally;
829
875
  computeBudget(totalTokens: number, phase?: string): GraphBudget;
830
876
  /**
831
877
  * Filter graph nodes relevant to a development phase.
832
878
  */
833
879
  filterForPhase(phase: string): GraphFilterResult;
834
- /**
835
- * Generate a markdown repository map from graph structure.
836
- */
880
+ private buildModuleLines;
881
+ private buildEntryPointLines;
837
882
  generateMap(): string;
838
883
  /**
839
884
  * Check documentation coverage of code nodes.
@@ -900,6 +945,8 @@ declare class GraphConstraintAdapter {
900
945
  private readonly store;
901
946
  constructor(store: GraphStore);
902
947
  computeDependencyGraph(): GraphDependencyData;
948
+ private collectFileNodePaths;
949
+ private collectImportEdges;
903
950
  computeLayerViolations(layers: LayerDef[], rootDir: string): GraphLayerViolation[];
904
951
  private resolveLayer;
905
952
  }
@@ -953,7 +1000,10 @@ declare class GraphFeedbackAdapter {
953
1000
  private readonly store;
954
1001
  constructor(store: GraphStore);
955
1002
  computeImpactData(changedFiles: string[]): GraphImpactData;
1003
+ private collectFileImpact;
956
1004
  computeHarnessCheckData(): GraphHarnessCheckData;
1005
+ private countUndocumentedFiles;
1006
+ private countUnreachableNodes;
957
1007
  }
958
1008
 
959
1009
  interface TaskDefinition {
@@ -988,6 +1038,8 @@ declare class TaskIndependenceAnalyzer {
988
1038
  private readonly store;
989
1039
  constructor(store?: GraphStore);
990
1040
  analyze(params: IndependenceCheckParams): IndependenceResult;
1041
+ private buildFileSets;
1042
+ private computeAllPairs;
991
1043
  private validate;
992
1044
  private expandViaGraph;
993
1045
  private computePairOverlap;
@@ -1022,6 +1074,10 @@ declare class ConflictPredictor {
1022
1074
  private readonly store;
1023
1075
  constructor(store?: GraphStore);
1024
1076
  predict(params: IndependenceCheckParams): ConflictPrediction;
1077
+ private buildMetricMaps;
1078
+ private classifyConflicts;
1079
+ private countBySeverity;
1080
+ private classifyTransitiveOverlap;
1025
1081
  private classifyPair;
1026
1082
  private severityRank;
1027
1083
  private computePercentile;
@@ -1030,6 +1086,91 @@ declare class ConflictPredictor {
1030
1086
  private generateVerdict;
1031
1087
  }
1032
1088
 
1033
- declare const VERSION = "0.2.0";
1089
+ interface ProbabilityStrategy {
1090
+ /** Compute failure propagation probability for a single edge (0..1). */
1091
+ getEdgeProbability(edge: GraphEdge, fromNode: GraphNode, toNode: GraphNode): number;
1092
+ }
1093
+ interface CascadeSimulationOptions {
1094
+ /** Minimum cumulative probability to continue traversal. Default: 0.05 */
1095
+ readonly probabilityFloor?: number;
1096
+ /** Maximum BFS depth. Default: 10 */
1097
+ readonly maxDepth?: number;
1098
+ /** Filter to specific edge types. Default: all edge types. */
1099
+ readonly edgeTypes?: readonly string[];
1100
+ /** Pluggable probability strategy. Default: CompositeProbabilityStrategy. */
1101
+ readonly strategy?: ProbabilityStrategy;
1102
+ }
1103
+ interface CascadeNode {
1104
+ readonly nodeId: string;
1105
+ readonly name: string;
1106
+ readonly path?: string;
1107
+ readonly type: string;
1108
+ readonly cumulativeProbability: number;
1109
+ readonly depth: number;
1110
+ readonly incomingEdge: string;
1111
+ readonly parentId: string;
1112
+ }
1113
+ interface CascadeLayer {
1114
+ readonly depth: number;
1115
+ readonly nodes: readonly CascadeNode[];
1116
+ readonly categoryBreakdown: {
1117
+ readonly code: number;
1118
+ readonly tests: number;
1119
+ readonly docs: number;
1120
+ readonly other: number;
1121
+ };
1122
+ }
1123
+ interface CascadeResult {
1124
+ readonly sourceNodeId: string;
1125
+ readonly sourceName: string;
1126
+ readonly layers: readonly CascadeLayer[];
1127
+ readonly flatSummary: readonly CascadeNode[];
1128
+ readonly summary: {
1129
+ readonly totalAffected: number;
1130
+ readonly maxDepthReached: number;
1131
+ readonly highRisk: number;
1132
+ readonly mediumRisk: number;
1133
+ readonly lowRisk: number;
1134
+ readonly categoryBreakdown: {
1135
+ readonly code: number;
1136
+ readonly tests: number;
1137
+ readonly docs: number;
1138
+ readonly other: number;
1139
+ };
1140
+ readonly amplificationPoints: readonly string[];
1141
+ readonly truncated: boolean;
1142
+ };
1143
+ }
1144
+
1145
+ /**
1146
+ * Default probability strategy blending three signals:
1147
+ * - 50% edge type base weight
1148
+ * - 30% normalized change frequency of target node
1149
+ * - 20% normalized coupling strength of target node
1150
+ */
1151
+ declare class CompositeProbabilityStrategy implements ProbabilityStrategy {
1152
+ private readonly changeFreqMap;
1153
+ private readonly couplingMap;
1154
+ static readonly BASE_WEIGHTS: Record<string, number>;
1155
+ private static readonly FALLBACK_WEIGHT;
1156
+ private static readonly EDGE_TYPE_BLEND;
1157
+ private static readonly CHANGE_FREQ_BLEND;
1158
+ private static readonly COUPLING_BLEND;
1159
+ constructor(changeFreqMap: Map<string, number>, couplingMap: Map<string, number>);
1160
+ getEdgeProbability(edge: GraphEdge, _fromNode: GraphNode, toNode: GraphNode): number;
1161
+ }
1162
+
1163
+ declare class CascadeSimulator {
1164
+ private readonly store;
1165
+ constructor(store: GraphStore);
1166
+ simulate(sourceNodeId: string, options?: CascadeSimulationOptions): CascadeResult;
1167
+ private seedQueue;
1168
+ private runBfs;
1169
+ private expandNode;
1170
+ private buildDefaultStrategy;
1171
+ private buildResult;
1172
+ }
1173
+
1174
+ declare const VERSION = "0.4.1";
1034
1175
 
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 };
1176
+ export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AskGraphResult, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, type CascadeLayer, type CascadeNode, type CascadeResult, type CascadeSimulationOptions, CascadeSimulator, type ClassificationResult, CodeIngestor, CompositeProbabilityStrategy, 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 NodeCategory, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type OverlapDetail, type PairResult, type ProbabilityStrategy, 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, classifyNodeCategory, groupNodesByImpact, linkToCode, loadGraph, project, queryTraceability, saveGraph };
package/dist/index.d.ts CHANGED
@@ -176,7 +176,11 @@ declare class GraphStore {
176
176
  addEdge(edge: GraphEdge): void;
177
177
  batchAddEdges(edges: readonly GraphEdge[]): void;
178
178
  getEdges(query: EdgeQuery): GraphEdge[];
179
+ /** Pick the most selective index to start from. */
180
+ private selectCandidates;
179
181
  getNeighbors(nodeId: string, direction?: 'outbound' | 'inbound' | 'both'): GraphNode[];
182
+ private collectNeighborIds;
183
+ private resolveNodes;
180
184
  get nodeCount(): number;
181
185
  get edgeCount(): number;
182
186
  clear(): void;
@@ -252,6 +256,9 @@ declare class ContextQL {
252
256
 
253
257
  declare function project(nodes: readonly GraphNode[], spec: ProjectionSpec | undefined): Partial<GraphNode>[];
254
258
 
259
+ type NodeCategory = 'tests' | 'docs' | 'code' | 'other';
260
+ /** Classify a graph node into an impact category. */
261
+ declare function classifyNodeCategory(node: GraphNode): NodeCategory;
255
262
  interface ImpactGroups {
256
263
  readonly tests: readonly GraphNode[];
257
264
  readonly docs: readonly GraphNode[];
@@ -320,8 +327,16 @@ declare class GitIngestor {
320
327
  private readonly gitRunner?;
321
328
  constructor(store: GraphStore, gitRunner?: GitRunner | undefined);
322
329
  ingest(rootDir: string): Promise<IngestResult>;
330
+ private ingestCommit;
331
+ private ingestCoChanges;
323
332
  private runGit;
324
333
  private parseGitLog;
334
+ /**
335
+ * Process one line from git log output, updating the in-progress commit builder
336
+ * and flushing completed commits into the accumulator.
337
+ * Returns the updated current builder (null if flushed and not replaced).
338
+ */
339
+ private processLogLine;
325
340
  private computeCoChanges;
326
341
  }
327
342
 
@@ -363,10 +378,22 @@ declare class RequirementIngestor {
363
378
  * and create requirement nodes with convention-based edges.
364
379
  */
365
380
  ingestSpecs(specsDir: string): Promise<IngestResult>;
381
+ private ingestFeatureDir;
382
+ private ingestSpec;
383
+ private ingestRequirement;
366
384
  /**
367
385
  * Parse markdown content and extract numbered items from recognized sections.
368
386
  */
369
387
  private extractRequirements;
388
+ /**
389
+ * Check if a line is a section heading and return updated section state,
390
+ * or return null if the line is not a heading.
391
+ */
392
+ private processHeadingLine;
393
+ /**
394
+ * Build a requirement GraphNode from a matched numbered-item line.
395
+ */
396
+ private buildRequirementNode;
370
397
  /**
371
398
  * Convention-based linking: match requirement to code/test files
372
399
  * by feature name in their path.
@@ -429,6 +456,7 @@ declare class JiraConnector implements GraphConnector {
429
456
  private readonly httpClient;
430
457
  constructor(httpClient?: HttpClient);
431
458
  ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
459
+ private fetchAllIssues;
432
460
  private processIssue;
433
461
  }
434
462
 
@@ -447,6 +475,7 @@ declare class ConfluenceConnector implements GraphConnector {
447
475
  private readonly httpClient;
448
476
  constructor(httpClient?: HttpClient);
449
477
  ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
478
+ private fetchAllPagesHandled;
450
479
  private fetchAllPages;
451
480
  private processPage;
452
481
  }
@@ -457,6 +486,7 @@ declare class CIConnector implements GraphConnector {
457
486
  private readonly httpClient;
458
487
  constructor(httpClient?: HttpClient);
459
488
  ingest(store: GraphStore, config: ConnectorConfig): Promise<IngestResult>;
489
+ private fetchAndIngestRuns;
460
490
  }
461
491
 
462
492
  interface FusionResult {
@@ -475,6 +505,9 @@ declare class FusionLayer {
475
505
  private readonly semanticWeight;
476
506
  constructor(store: GraphStore, vectorStore?: VectorStore, keywordWeight?: number, semanticWeight?: number);
477
507
  search(query: string, topK?: number, queryEmbedding?: readonly number[]): FusionResult[];
508
+ private buildSemanticScores;
509
+ private resolveWeights;
510
+ private scoreNodes;
478
511
  private extractKeywords;
479
512
  private keywordScore;
480
513
  private singleKeywordScore;
@@ -519,6 +552,7 @@ declare class GraphEntropyAdapter {
519
552
  * 4. If target exists -> compare lastModified timestamps to determine staleness
520
553
  */
521
554
  computeDriftData(): GraphDriftData;
555
+ private classifyDocEdge;
522
556
  /**
523
557
  * BFS from entry points to find reachable vs unreachable code nodes.
524
558
  *
@@ -640,6 +674,9 @@ declare class GraphAnomalyAdapter {
640
674
  private readonly store;
641
675
  constructor(store: GraphStore);
642
676
  detect(options?: AnomalyDetectionOptions): AnomalyReport;
677
+ private filterMetrics;
678
+ private computeAllOutliers;
679
+ private computeOverlap;
643
680
  private collectMetricValues;
644
681
  private computeZScoreOutliers;
645
682
  private findArticulationPoints;
@@ -736,6 +773,14 @@ declare class EntityExtractor {
736
773
  * @returns Array of raw entity strings in priority order, deduplicated
737
774
  */
738
775
  extract(query: string): readonly string[];
776
+ /** Strategy 1: Quoted strings. Returns the set of consumed tokens. */
777
+ private extractQuoted;
778
+ /** Strategy 2: PascalCase/camelCase tokens. Returns the set of consumed tokens. */
779
+ private extractCasing;
780
+ /** Strategy 3: File paths. Returns the set of consumed tokens. */
781
+ private extractPaths;
782
+ /** Strategy 4: Remaining significant nouns after stop-word and intent-keyword removal. */
783
+ private extractNouns;
739
784
  }
740
785
 
741
786
  /**
@@ -823,17 +868,17 @@ declare class Assembler {
823
868
  assembleContext(intent: string, tokenBudget?: number): AssembledContext;
824
869
  private expandSearchResults;
825
870
  private truncateToFit;
826
- /**
827
- * Compute a token budget allocation across node types.
828
- */
871
+ private countNodesByType;
872
+ private computeModuleDensity;
873
+ private computeTypeWeights;
874
+ private allocateProportionally;
829
875
  computeBudget(totalTokens: number, phase?: string): GraphBudget;
830
876
  /**
831
877
  * Filter graph nodes relevant to a development phase.
832
878
  */
833
879
  filterForPhase(phase: string): GraphFilterResult;
834
- /**
835
- * Generate a markdown repository map from graph structure.
836
- */
880
+ private buildModuleLines;
881
+ private buildEntryPointLines;
837
882
  generateMap(): string;
838
883
  /**
839
884
  * Check documentation coverage of code nodes.
@@ -900,6 +945,8 @@ declare class GraphConstraintAdapter {
900
945
  private readonly store;
901
946
  constructor(store: GraphStore);
902
947
  computeDependencyGraph(): GraphDependencyData;
948
+ private collectFileNodePaths;
949
+ private collectImportEdges;
903
950
  computeLayerViolations(layers: LayerDef[], rootDir: string): GraphLayerViolation[];
904
951
  private resolveLayer;
905
952
  }
@@ -953,7 +1000,10 @@ declare class GraphFeedbackAdapter {
953
1000
  private readonly store;
954
1001
  constructor(store: GraphStore);
955
1002
  computeImpactData(changedFiles: string[]): GraphImpactData;
1003
+ private collectFileImpact;
956
1004
  computeHarnessCheckData(): GraphHarnessCheckData;
1005
+ private countUndocumentedFiles;
1006
+ private countUnreachableNodes;
957
1007
  }
958
1008
 
959
1009
  interface TaskDefinition {
@@ -988,6 +1038,8 @@ declare class TaskIndependenceAnalyzer {
988
1038
  private readonly store;
989
1039
  constructor(store?: GraphStore);
990
1040
  analyze(params: IndependenceCheckParams): IndependenceResult;
1041
+ private buildFileSets;
1042
+ private computeAllPairs;
991
1043
  private validate;
992
1044
  private expandViaGraph;
993
1045
  private computePairOverlap;
@@ -1022,6 +1074,10 @@ declare class ConflictPredictor {
1022
1074
  private readonly store;
1023
1075
  constructor(store?: GraphStore);
1024
1076
  predict(params: IndependenceCheckParams): ConflictPrediction;
1077
+ private buildMetricMaps;
1078
+ private classifyConflicts;
1079
+ private countBySeverity;
1080
+ private classifyTransitiveOverlap;
1025
1081
  private classifyPair;
1026
1082
  private severityRank;
1027
1083
  private computePercentile;
@@ -1030,6 +1086,91 @@ declare class ConflictPredictor {
1030
1086
  private generateVerdict;
1031
1087
  }
1032
1088
 
1033
- declare const VERSION = "0.2.0";
1089
+ interface ProbabilityStrategy {
1090
+ /** Compute failure propagation probability for a single edge (0..1). */
1091
+ getEdgeProbability(edge: GraphEdge, fromNode: GraphNode, toNode: GraphNode): number;
1092
+ }
1093
+ interface CascadeSimulationOptions {
1094
+ /** Minimum cumulative probability to continue traversal. Default: 0.05 */
1095
+ readonly probabilityFloor?: number;
1096
+ /** Maximum BFS depth. Default: 10 */
1097
+ readonly maxDepth?: number;
1098
+ /** Filter to specific edge types. Default: all edge types. */
1099
+ readonly edgeTypes?: readonly string[];
1100
+ /** Pluggable probability strategy. Default: CompositeProbabilityStrategy. */
1101
+ readonly strategy?: ProbabilityStrategy;
1102
+ }
1103
+ interface CascadeNode {
1104
+ readonly nodeId: string;
1105
+ readonly name: string;
1106
+ readonly path?: string;
1107
+ readonly type: string;
1108
+ readonly cumulativeProbability: number;
1109
+ readonly depth: number;
1110
+ readonly incomingEdge: string;
1111
+ readonly parentId: string;
1112
+ }
1113
+ interface CascadeLayer {
1114
+ readonly depth: number;
1115
+ readonly nodes: readonly CascadeNode[];
1116
+ readonly categoryBreakdown: {
1117
+ readonly code: number;
1118
+ readonly tests: number;
1119
+ readonly docs: number;
1120
+ readonly other: number;
1121
+ };
1122
+ }
1123
+ interface CascadeResult {
1124
+ readonly sourceNodeId: string;
1125
+ readonly sourceName: string;
1126
+ readonly layers: readonly CascadeLayer[];
1127
+ readonly flatSummary: readonly CascadeNode[];
1128
+ readonly summary: {
1129
+ readonly totalAffected: number;
1130
+ readonly maxDepthReached: number;
1131
+ readonly highRisk: number;
1132
+ readonly mediumRisk: number;
1133
+ readonly lowRisk: number;
1134
+ readonly categoryBreakdown: {
1135
+ readonly code: number;
1136
+ readonly tests: number;
1137
+ readonly docs: number;
1138
+ readonly other: number;
1139
+ };
1140
+ readonly amplificationPoints: readonly string[];
1141
+ readonly truncated: boolean;
1142
+ };
1143
+ }
1144
+
1145
+ /**
1146
+ * Default probability strategy blending three signals:
1147
+ * - 50% edge type base weight
1148
+ * - 30% normalized change frequency of target node
1149
+ * - 20% normalized coupling strength of target node
1150
+ */
1151
+ declare class CompositeProbabilityStrategy implements ProbabilityStrategy {
1152
+ private readonly changeFreqMap;
1153
+ private readonly couplingMap;
1154
+ static readonly BASE_WEIGHTS: Record<string, number>;
1155
+ private static readonly FALLBACK_WEIGHT;
1156
+ private static readonly EDGE_TYPE_BLEND;
1157
+ private static readonly CHANGE_FREQ_BLEND;
1158
+ private static readonly COUPLING_BLEND;
1159
+ constructor(changeFreqMap: Map<string, number>, couplingMap: Map<string, number>);
1160
+ getEdgeProbability(edge: GraphEdge, _fromNode: GraphNode, toNode: GraphNode): number;
1161
+ }
1162
+
1163
+ declare class CascadeSimulator {
1164
+ private readonly store;
1165
+ constructor(store: GraphStore);
1166
+ simulate(sourceNodeId: string, options?: CascadeSimulationOptions): CascadeResult;
1167
+ private seedQueue;
1168
+ private runBfs;
1169
+ private expandNode;
1170
+ private buildDefaultStrategy;
1171
+ private buildResult;
1172
+ }
1173
+
1174
+ declare const VERSION = "0.4.1";
1034
1175
 
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 };
1176
+ export { type AnomalyDetectionOptions, type AnomalyReport, type ArticulationPoint, type AskGraphResult, type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, type CascadeLayer, type CascadeNode, type CascadeResult, type CascadeSimulationOptions, CascadeSimulator, type ClassificationResult, CodeIngestor, CompositeProbabilityStrategy, 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 NodeCategory, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type OverlapDetail, type PairResult, type ProbabilityStrategy, 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, classifyNodeCategory, groupNodesByImpact, linkToCode, loadGraph, project, queryTraceability, saveGraph };