@harness-engineering/graph 0.2.0 → 0.2.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/dist/index.d.mts +97 -13
- package/dist/index.d.ts +97 -13
- package/dist/index.js +534 -49
- package/dist/index.mjs +530 -49
- package/package.json +14 -1
- package/dist/.tsbuildinfo +0 -1
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"];
|
|
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"];
|
|
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"];
|
|
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"];
|
|
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"]>;
|
|
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"]>;
|
|
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";
|
|
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";
|
|
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";
|
|
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";
|
|
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"]>;
|
|
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"]>;
|
|
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";
|
|
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";
|
|
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";
|
|
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";
|
|
149
149
|
from: string;
|
|
150
150
|
to: string;
|
|
151
151
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -264,13 +264,15 @@ declare class CodeIngestor {
|
|
|
264
264
|
*/
|
|
265
265
|
private findClosingBrace;
|
|
266
266
|
/**
|
|
267
|
-
* Second pass:
|
|
268
|
-
*
|
|
267
|
+
* Second pass: scan each file for identifiers matching known callable names,
|
|
268
|
+
* then create file-to-file "calls" edges. Uses regex heuristic (not AST).
|
|
269
269
|
*/
|
|
270
270
|
private extractCallsEdges;
|
|
271
|
-
private escapeRegex;
|
|
272
271
|
private extractImports;
|
|
273
272
|
private resolveImportPath;
|
|
273
|
+
private computeCyclomaticComplexity;
|
|
274
|
+
private computeMaxNesting;
|
|
275
|
+
private countParameters;
|
|
274
276
|
private detectLanguage;
|
|
275
277
|
}
|
|
276
278
|
|
|
@@ -469,6 +471,62 @@ declare class GraphEntropyAdapter {
|
|
|
469
471
|
computeSnapshotSummary(): GraphSnapshotSummary;
|
|
470
472
|
}
|
|
471
473
|
|
|
474
|
+
interface GraphComplexityHotspot {
|
|
475
|
+
readonly file: string;
|
|
476
|
+
readonly function: string;
|
|
477
|
+
readonly changeFrequency: number;
|
|
478
|
+
readonly complexity: number;
|
|
479
|
+
readonly hotspotScore: number;
|
|
480
|
+
}
|
|
481
|
+
interface GraphComplexityResult {
|
|
482
|
+
readonly hotspots: readonly GraphComplexityHotspot[];
|
|
483
|
+
readonly percentile95Score: number;
|
|
484
|
+
}
|
|
485
|
+
declare class GraphComplexityAdapter {
|
|
486
|
+
private readonly store;
|
|
487
|
+
constructor(store: GraphStore);
|
|
488
|
+
/**
|
|
489
|
+
* Compute complexity hotspots by combining cyclomatic complexity with change frequency.
|
|
490
|
+
*
|
|
491
|
+
* 1. Find all function and method nodes
|
|
492
|
+
* 2. For each, find the containing file and count commit nodes referencing that file
|
|
493
|
+
* 3. Compute hotspotScore = changeFrequency * cyclomaticComplexity
|
|
494
|
+
* 4. Sort descending by score
|
|
495
|
+
* 5. Compute 95th percentile
|
|
496
|
+
*/
|
|
497
|
+
computeComplexityHotspots(): GraphComplexityResult;
|
|
498
|
+
private computePercentile;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
interface GraphCouplingFileData {
|
|
502
|
+
readonly file: string;
|
|
503
|
+
readonly fanIn: number;
|
|
504
|
+
readonly fanOut: number;
|
|
505
|
+
readonly couplingRatio: number;
|
|
506
|
+
readonly transitiveDepth: number;
|
|
507
|
+
}
|
|
508
|
+
interface GraphCouplingResult {
|
|
509
|
+
readonly files: readonly GraphCouplingFileData[];
|
|
510
|
+
}
|
|
511
|
+
declare class GraphCouplingAdapter {
|
|
512
|
+
private readonly store;
|
|
513
|
+
constructor(store: GraphStore);
|
|
514
|
+
/**
|
|
515
|
+
* Compute coupling data for all file nodes in the graph.
|
|
516
|
+
*
|
|
517
|
+
* For each file:
|
|
518
|
+
* - fanOut: number of outbound 'imports' edges
|
|
519
|
+
* - fanIn: number of inbound 'imports' edges from other files
|
|
520
|
+
* - couplingRatio: fanOut / (fanIn + fanOut), rounded to 2 decimals (0 if both are 0)
|
|
521
|
+
* - transitiveDepth: longest chain of outbound 'imports' edges via BFS
|
|
522
|
+
*/
|
|
523
|
+
computeCouplingData(): GraphCouplingResult;
|
|
524
|
+
/**
|
|
525
|
+
* BFS from a node following outbound 'imports' edges to find the maximum depth.
|
|
526
|
+
*/
|
|
527
|
+
private computeTransitiveDepth;
|
|
528
|
+
}
|
|
529
|
+
|
|
472
530
|
interface AssembledContext {
|
|
473
531
|
readonly nodes: readonly GraphNode[];
|
|
474
532
|
readonly edges: readonly GraphEdge[];
|
|
@@ -550,6 +608,32 @@ declare class GraphConstraintAdapter {
|
|
|
550
608
|
private resolveLayer;
|
|
551
609
|
}
|
|
552
610
|
|
|
611
|
+
declare class DesignIngestor {
|
|
612
|
+
private readonly store;
|
|
613
|
+
constructor(store: GraphStore);
|
|
614
|
+
ingestTokens(tokensPath: string): Promise<IngestResult>;
|
|
615
|
+
ingestDesignIntent(designPath: string): Promise<IngestResult>;
|
|
616
|
+
ingestAll(designDir: string): Promise<IngestResult>;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
interface DesignViolation {
|
|
620
|
+
code: string;
|
|
621
|
+
file: string;
|
|
622
|
+
message: string;
|
|
623
|
+
severity: 'error' | 'warn' | 'info';
|
|
624
|
+
value?: string;
|
|
625
|
+
suggestion?: string;
|
|
626
|
+
}
|
|
627
|
+
type DesignStrictness = 'strict' | 'standard' | 'permissive';
|
|
628
|
+
declare class DesignConstraintAdapter {
|
|
629
|
+
private readonly store;
|
|
630
|
+
constructor(store: GraphStore);
|
|
631
|
+
checkForHardcodedColors(source: string, file: string, strictness?: DesignStrictness): DesignViolation[];
|
|
632
|
+
checkForHardcodedFonts(source: string, file: string, strictness?: DesignStrictness): DesignViolation[];
|
|
633
|
+
checkAll(source: string, file: string, strictness?: DesignStrictness): DesignViolation[];
|
|
634
|
+
private mapSeverity;
|
|
635
|
+
}
|
|
636
|
+
|
|
553
637
|
interface GraphImpactData {
|
|
554
638
|
readonly affectedTests: ReadonlyArray<{
|
|
555
639
|
testFile: string;
|
|
@@ -576,6 +660,6 @@ declare class GraphFeedbackAdapter {
|
|
|
576
660
|
computeHarnessCheckData(): GraphHarnessCheckData;
|
|
577
661
|
}
|
|
578
662
|
|
|
579
|
-
declare const VERSION = "0.
|
|
663
|
+
declare const VERSION = "0.2.0";
|
|
580
664
|
|
|
581
|
-
export { type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, CodeIngestor, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, EDGE_TYPES, type EdgeQuery, type EdgeType, FusionLayer, type FusionResult, GitIngestor, type GitRunner, type GraphBudget, type GraphConnector, GraphConstraintAdapter, 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, type IngestResult, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type ProjectionSpec, SlackConnector, type SourceLocation, SyncManager, type SyncMetadata, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, linkToCode, loadGraph, project, saveGraph };
|
|
665
|
+
export { type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, CodeIngestor, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, FusionLayer, type FusionResult, GitIngestor, type GitRunner, 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, type IngestResult, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type ProjectionSpec, SlackConnector, type SourceLocation, SyncManager, type SyncMetadata, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, linkToCode, loadGraph, project, 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"];
|
|
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"];
|
|
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"];
|
|
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"];
|
|
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"]>;
|
|
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"]>;
|
|
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";
|
|
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";
|
|
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";
|
|
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";
|
|
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"]>;
|
|
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"]>;
|
|
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";
|
|
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";
|
|
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";
|
|
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";
|
|
149
149
|
from: string;
|
|
150
150
|
to: string;
|
|
151
151
|
metadata?: Record<string, unknown> | undefined;
|
|
@@ -264,13 +264,15 @@ declare class CodeIngestor {
|
|
|
264
264
|
*/
|
|
265
265
|
private findClosingBrace;
|
|
266
266
|
/**
|
|
267
|
-
* Second pass:
|
|
268
|
-
*
|
|
267
|
+
* Second pass: scan each file for identifiers matching known callable names,
|
|
268
|
+
* then create file-to-file "calls" edges. Uses regex heuristic (not AST).
|
|
269
269
|
*/
|
|
270
270
|
private extractCallsEdges;
|
|
271
|
-
private escapeRegex;
|
|
272
271
|
private extractImports;
|
|
273
272
|
private resolveImportPath;
|
|
273
|
+
private computeCyclomaticComplexity;
|
|
274
|
+
private computeMaxNesting;
|
|
275
|
+
private countParameters;
|
|
274
276
|
private detectLanguage;
|
|
275
277
|
}
|
|
276
278
|
|
|
@@ -469,6 +471,62 @@ declare class GraphEntropyAdapter {
|
|
|
469
471
|
computeSnapshotSummary(): GraphSnapshotSummary;
|
|
470
472
|
}
|
|
471
473
|
|
|
474
|
+
interface GraphComplexityHotspot {
|
|
475
|
+
readonly file: string;
|
|
476
|
+
readonly function: string;
|
|
477
|
+
readonly changeFrequency: number;
|
|
478
|
+
readonly complexity: number;
|
|
479
|
+
readonly hotspotScore: number;
|
|
480
|
+
}
|
|
481
|
+
interface GraphComplexityResult {
|
|
482
|
+
readonly hotspots: readonly GraphComplexityHotspot[];
|
|
483
|
+
readonly percentile95Score: number;
|
|
484
|
+
}
|
|
485
|
+
declare class GraphComplexityAdapter {
|
|
486
|
+
private readonly store;
|
|
487
|
+
constructor(store: GraphStore);
|
|
488
|
+
/**
|
|
489
|
+
* Compute complexity hotspots by combining cyclomatic complexity with change frequency.
|
|
490
|
+
*
|
|
491
|
+
* 1. Find all function and method nodes
|
|
492
|
+
* 2. For each, find the containing file and count commit nodes referencing that file
|
|
493
|
+
* 3. Compute hotspotScore = changeFrequency * cyclomaticComplexity
|
|
494
|
+
* 4. Sort descending by score
|
|
495
|
+
* 5. Compute 95th percentile
|
|
496
|
+
*/
|
|
497
|
+
computeComplexityHotspots(): GraphComplexityResult;
|
|
498
|
+
private computePercentile;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
interface GraphCouplingFileData {
|
|
502
|
+
readonly file: string;
|
|
503
|
+
readonly fanIn: number;
|
|
504
|
+
readonly fanOut: number;
|
|
505
|
+
readonly couplingRatio: number;
|
|
506
|
+
readonly transitiveDepth: number;
|
|
507
|
+
}
|
|
508
|
+
interface GraphCouplingResult {
|
|
509
|
+
readonly files: readonly GraphCouplingFileData[];
|
|
510
|
+
}
|
|
511
|
+
declare class GraphCouplingAdapter {
|
|
512
|
+
private readonly store;
|
|
513
|
+
constructor(store: GraphStore);
|
|
514
|
+
/**
|
|
515
|
+
* Compute coupling data for all file nodes in the graph.
|
|
516
|
+
*
|
|
517
|
+
* For each file:
|
|
518
|
+
* - fanOut: number of outbound 'imports' edges
|
|
519
|
+
* - fanIn: number of inbound 'imports' edges from other files
|
|
520
|
+
* - couplingRatio: fanOut / (fanIn + fanOut), rounded to 2 decimals (0 if both are 0)
|
|
521
|
+
* - transitiveDepth: longest chain of outbound 'imports' edges via BFS
|
|
522
|
+
*/
|
|
523
|
+
computeCouplingData(): GraphCouplingResult;
|
|
524
|
+
/**
|
|
525
|
+
* BFS from a node following outbound 'imports' edges to find the maximum depth.
|
|
526
|
+
*/
|
|
527
|
+
private computeTransitiveDepth;
|
|
528
|
+
}
|
|
529
|
+
|
|
472
530
|
interface AssembledContext {
|
|
473
531
|
readonly nodes: readonly GraphNode[];
|
|
474
532
|
readonly edges: readonly GraphEdge[];
|
|
@@ -550,6 +608,32 @@ declare class GraphConstraintAdapter {
|
|
|
550
608
|
private resolveLayer;
|
|
551
609
|
}
|
|
552
610
|
|
|
611
|
+
declare class DesignIngestor {
|
|
612
|
+
private readonly store;
|
|
613
|
+
constructor(store: GraphStore);
|
|
614
|
+
ingestTokens(tokensPath: string): Promise<IngestResult>;
|
|
615
|
+
ingestDesignIntent(designPath: string): Promise<IngestResult>;
|
|
616
|
+
ingestAll(designDir: string): Promise<IngestResult>;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
interface DesignViolation {
|
|
620
|
+
code: string;
|
|
621
|
+
file: string;
|
|
622
|
+
message: string;
|
|
623
|
+
severity: 'error' | 'warn' | 'info';
|
|
624
|
+
value?: string;
|
|
625
|
+
suggestion?: string;
|
|
626
|
+
}
|
|
627
|
+
type DesignStrictness = 'strict' | 'standard' | 'permissive';
|
|
628
|
+
declare class DesignConstraintAdapter {
|
|
629
|
+
private readonly store;
|
|
630
|
+
constructor(store: GraphStore);
|
|
631
|
+
checkForHardcodedColors(source: string, file: string, strictness?: DesignStrictness): DesignViolation[];
|
|
632
|
+
checkForHardcodedFonts(source: string, file: string, strictness?: DesignStrictness): DesignViolation[];
|
|
633
|
+
checkAll(source: string, file: string, strictness?: DesignStrictness): DesignViolation[];
|
|
634
|
+
private mapSeverity;
|
|
635
|
+
}
|
|
636
|
+
|
|
553
637
|
interface GraphImpactData {
|
|
554
638
|
readonly affectedTests: ReadonlyArray<{
|
|
555
639
|
testFile: string;
|
|
@@ -576,6 +660,6 @@ declare class GraphFeedbackAdapter {
|
|
|
576
660
|
computeHarnessCheckData(): GraphHarnessCheckData;
|
|
577
661
|
}
|
|
578
662
|
|
|
579
|
-
declare const VERSION = "0.
|
|
663
|
+
declare const VERSION = "0.2.0";
|
|
580
664
|
|
|
581
|
-
export { type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, CodeIngestor, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, EDGE_TYPES, type EdgeQuery, type EdgeType, FusionLayer, type FusionResult, GitIngestor, type GitRunner, type GraphBudget, type GraphConnector, GraphConstraintAdapter, 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, type IngestResult, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type ProjectionSpec, SlackConnector, type SourceLocation, SyncManager, type SyncMetadata, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, linkToCode, loadGraph, project, saveGraph };
|
|
665
|
+
export { type AssembledContext, Assembler, CIConnector, CURRENT_SCHEMA_VERSION, CodeIngestor, ConfluenceConnector, type ConnectorConfig, ContextQL, type ContextQLParams, type ContextQLResult, DesignConstraintAdapter, DesignIngestor, type DesignStrictness, type DesignViolation, EDGE_TYPES, type EdgeQuery, type EdgeType, FusionLayer, type FusionResult, GitIngestor, type GitRunner, 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, type IngestResult, JiraConnector, KnowledgeIngestor, type LinkResult, NODE_TYPES, type NodeQuery, type NodeType, OBSERVABILITY_TYPES, type ProjectionSpec, SlackConnector, type SourceLocation, SyncManager, type SyncMetadata, TopologicalLinker, VERSION, type VectorSearchResult, VectorStore, linkToCode, loadGraph, project, saveGraph };
|