@harness-engineering/graph 0.4.2 → 0.5.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/README.md CHANGED
@@ -66,9 +66,9 @@ const context = cql.execute({
66
66
  });
67
67
 
68
68
  // 4. Search with FusionLayer (keyword + optional semantic)
69
- const vectorStore = new VectorStore();
69
+ const vectorStore = new VectorStore(1536);
70
70
  const fusion = new FusionLayer(store, vectorStore);
71
- const results = fusion.search('authentication handler', { topK: 10 });
71
+ const results = fusion.search('authentication handler', 10);
72
72
  ```
73
73
 
74
74
  ## Key Classes
@@ -76,9 +76,9 @@ const results = fusion.search('authentication handler', { topK: 10 });
76
76
  | Class | Description |
77
77
  | ------------------------------ | ------------------------------------------------------------------------------------ |
78
78
  | `GraphStore` | In-memory graph backed by LokiJS with indexed node/edge collections |
79
- | `VectorStore` | Optional vector index for semantic similarity search (hnswlib) |
79
+ | `VectorStore` | In-memory brute-force cosine similarity vector store |
80
80
  | `ContextQL` | BFS-based graph traversal engine with type filtering and observability pruning |
81
- | `project` | Projection utility to select specific fields from query results |
81
+ | `project` (function) | Projection utility to select specific fields from query results |
82
82
  | `CodeIngestor` | Parses TypeScript/JavaScript files into file, class, function, and method nodes |
83
83
  | `GitIngestor` | Extracts commit history and co-change relationships from git |
84
84
  | `KnowledgeIngestor` | Ingests ADRs, learnings, and markdown knowledge artifacts |
@@ -92,35 +92,56 @@ const results = fusion.search('authentication handler', { topK: 10 });
92
92
  | `CascadeSimulator` | Probability-weighted BFS for cascading failure simulation (`compute_blast_radius`) |
93
93
  | `CompositeProbabilityStrategy` | Default edge probability strategy blending edge type, change frequency, and coupling |
94
94
  | `saveGraph` / `loadGraph` | Serializes and deserializes the graph store to/from disk |
95
+ | `BusinessKnowledgeIngestor` | Ingests business rules, processes, concepts, terms, and metrics as graph nodes |
96
+ | `RequirementIngestor` | Ingests requirement specifications as traceability nodes |
97
+ | `DesignIngestor` | Ingests design tokens and aesthetic intents |
98
+ | `DesignConstraintAdapter` | Validates design constraints against graph state |
99
+ | `GraphComplexityAdapter` | Computes complexity metrics from graph structure |
100
+ | `GraphCouplingAdapter` | Measures coupling between modules via graph edges |
101
+ | `GraphAnomalyAdapter` | Detects structural anomalies in the graph |
102
+ | `TaskIndependenceAnalyzer` | Determines if tasks can be executed in parallel |
103
+ | `ConflictPredictor` | Predicts merge conflicts from co-change patterns |
104
+ | `askGraph` | Natural language query interface for the knowledge graph |
105
+ | `IntentClassifier` | Classifies natural language query intent for NLQ |
106
+ | `EntityExtractor` | Extracts entity references from natural language queries |
107
+ | `EntityResolver` | Resolves extracted entities to graph nodes |
108
+ | `ResponseFormatter` | Formats NLQ results for display |
109
+ | `queryTraceability` | Queries requirement-to-test traceability chains |
110
+ | `PackedSummaryCache` | Caches packed context summaries as graph nodes |
111
+ | `groupNodesByImpact` | Groups nodes by cascading impact for blast radius analysis |
95
112
 
96
113
  ## Node Types
97
114
 
98
- 28 node types organized by category:
115
+ 37 node types organized by category:
99
116
 
100
- | Category | Types |
101
- | ----------------- | -------------------------------------------------------------------------------------- |
102
- | **Code** | `repository`, `module`, `file`, `class`, `interface`, `function`, `method`, `variable` |
103
- | **Knowledge** | `adr`, `decision`, `learning`, `failure`, `issue`, `document`, `skill`, `conversation` |
104
- | **VCS** | `commit`, `build`, `test_result` |
105
- | **Observability** | `span`, `metric`, `log` |
106
- | **Structural** | `layer`, `pattern`, `constraint`, `violation` |
107
- | **Design** | `design_token`, `aesthetic_intent`, `design_constraint` |
108
- | **Traceability** | `requirement` |
117
+ | Category | Types |
118
+ | ---------------------- | ------------------------------------------------------------------------------------------- |
119
+ | **Code** | `repository`, `module`, `file`, `class`, `interface`, `function`, `method`, `variable` |
120
+ | **Knowledge** | `adr`, `decision`, `learning`, `failure`, `issue`, `document`, `skill`, `conversation` |
121
+ | **VCS** | `commit`, `build`, `test_result`, `execution_outcome` |
122
+ | **Observability** | `span`, `metric`, `log` |
123
+ | **Structural** | `layer`, `pattern`, `constraint`, `violation` |
124
+ | **Design** | `design_token`, `aesthetic_intent`, `design_constraint` |
125
+ | **Traceability** | `requirement` |
126
+ | **Business Knowledge** | `business_rule`, `business_process`, `business_concept`, `business_term`, `business_metric` |
127
+ | **Cache** | `packed_summary` |
109
128
 
110
129
  Observability types (`span`, `metric`, `log`) are pruned by default in ContextQL queries to reduce noise.
111
130
 
112
131
  ## Edge Types
113
132
 
114
- 24 edge types organized by category:
133
+ 29 edge types organized by category:
115
134
 
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` |
135
+ | Category | Types |
136
+ | ---------------------- | ----------------------------------------------------------------------------------------- |
137
+ | **Code** | `contains`, `imports`, `calls`, `implements`, `inherits`, `references` |
138
+ | **Knowledge** | `applies_to`, `caused_by`, `resolved_by`, `documents`, `violates`, `specifies`, `decided` |
139
+ | **VCS** | `co_changes_with`, `triggered_by`, `failed_in`, `outcome_of` |
140
+ | **Execution** | `executed_by`, `measured_by` |
141
+ | **Design** | `uses_token`, `declares_intent`, `violates_design`, `platform_binding` |
142
+ | **Traceability** | `requires`, `verified_by`, `tested_by` |
143
+ | **Business Knowledge** | `governs`, `measures` |
144
+ | **Cache** | `caches` |
124
145
 
125
146
  Edges carry an optional `confidence` score (0-1) used by the FusionLayer for ranking.
126
147
 
@@ -167,19 +188,12 @@ await loadGraph(restored, '/path/to/graph.json');
167
188
 
168
189
  ## Dependencies
169
190
 
170
- | Package | Purpose |
171
- | ----------- | --------------------------------------------------------- |
172
- | `lokijs` | In-memory document database backing the graph store |
173
- | `minimatch` | Glob pattern matching for file filtering during ingestion |
174
- | `zod` | Runtime schema validation for graph nodes and edges |
175
-
176
- Optional peer dependencies:
177
-
178
- | Package | Purpose |
179
- | ------------------------ | ------------------------------------------------------------- |
180
- | `hnswlib-node` | HNSW vector index for semantic search in VectorStore |
181
- | `tree-sitter` | AST-based code parsing (future upgrade path for CodeIngestor) |
182
- | `tree-sitter-typescript` | TypeScript grammar for tree-sitter |
191
+ | Package | Purpose |
192
+ | ----------------------------------- | --------------------------------------------------------- |
193
+ | `minimatch` | Glob pattern matching for file filtering during ingestion |
194
+ | `zod` | Runtime schema validation for graph nodes and edges |
195
+ | `tree-sitter` (optional) | Enhanced TypeScript AST parsing for code ingestion |
196
+ | `tree-sitter-typescript` (optional) | TypeScript grammar for tree-sitter |
183
197
 
184
198
  ## License
185
199