@eduardo-afonso/codebase-intelligence 0.1.0 → 2.0.1

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.
Files changed (108) hide show
  1. package/README.md +86 -11
  2. package/README.pt-BR.md +88 -12
  3. package/dist/ai/CodebaseWithAI.d.ts +91 -0
  4. package/dist/ai/CodebaseWithAI.d.ts.map +1 -0
  5. package/dist/ai/CodebaseWithAI.js +149 -0
  6. package/dist/ai/CodebaseWithAI.js.map +1 -0
  7. package/dist/ai/RAGPipeline.d.ts +66 -0
  8. package/dist/ai/RAGPipeline.d.ts.map +1 -0
  9. package/dist/ai/RAGPipeline.js +102 -0
  10. package/dist/ai/RAGPipeline.js.map +1 -0
  11. package/dist/ai/index.d.ts +6 -0
  12. package/dist/ai/index.d.ts.map +1 -0
  13. package/dist/ai/index.js +5 -0
  14. package/dist/ai/index.js.map +1 -0
  15. package/dist/ai/providers/NoopAIProvider.d.ts +23 -0
  16. package/dist/ai/providers/NoopAIProvider.d.ts.map +1 -0
  17. package/dist/ai/providers/NoopAIProvider.js +24 -0
  18. package/dist/ai/providers/NoopAIProvider.js.map +1 -0
  19. package/dist/cli/index.js +168 -8
  20. package/dist/cli/index.js.map +1 -1
  21. package/dist/context/ContextEngine.d.ts +54 -0
  22. package/dist/context/ContextEngine.d.ts.map +1 -0
  23. package/dist/context/ContextEngine.js +179 -0
  24. package/dist/context/ContextEngine.js.map +1 -0
  25. package/dist/context/FileContextBuilder.d.ts +49 -0
  26. package/dist/context/FileContextBuilder.d.ts.map +1 -0
  27. package/dist/context/FileContextBuilder.js +124 -0
  28. package/dist/context/FileContextBuilder.js.map +1 -0
  29. package/dist/context/SemanticChunker.d.ts +105 -0
  30. package/dist/context/SemanticChunker.d.ts.map +1 -0
  31. package/dist/context/SemanticChunker.js +293 -0
  32. package/dist/context/SemanticChunker.js.map +1 -0
  33. package/dist/context/SignatureExtractor.d.ts +49 -0
  34. package/dist/context/SignatureExtractor.d.ts.map +1 -0
  35. package/dist/context/SignatureExtractor.js +167 -0
  36. package/dist/context/SignatureExtractor.js.map +1 -0
  37. package/dist/context/interfaces.d.ts +149 -0
  38. package/dist/context/interfaces.d.ts.map +1 -0
  39. package/dist/context/interfaces.js +13 -0
  40. package/dist/context/interfaces.js.map +1 -0
  41. package/dist/context/strategies/ContextBuildStrategy.d.ts +25 -0
  42. package/dist/context/strategies/ContextBuildStrategy.d.ts.map +1 -0
  43. package/dist/context/strategies/ContextBuildStrategy.js +3 -0
  44. package/dist/context/strategies/ContextBuildStrategy.js.map +1 -0
  45. package/dist/context/strategies/DeepStrategy.d.ts +18 -0
  46. package/dist/context/strategies/DeepStrategy.d.ts.map +1 -0
  47. package/dist/context/strategies/DeepStrategy.js +19 -0
  48. package/dist/context/strategies/DeepStrategy.js.map +1 -0
  49. package/dist/context/strategies/ShallowStrategy.d.ts +15 -0
  50. package/dist/context/strategies/ShallowStrategy.d.ts.map +1 -0
  51. package/dist/context/strategies/ShallowStrategy.js +15 -0
  52. package/dist/context/strategies/ShallowStrategy.js.map +1 -0
  53. package/dist/context/strategies/SignatureStrategy.d.ts +20 -0
  54. package/dist/context/strategies/SignatureStrategy.d.ts.map +1 -0
  55. package/dist/context/strategies/SignatureStrategy.js +59 -0
  56. package/dist/context/strategies/SignatureStrategy.js.map +1 -0
  57. package/dist/context/strategies/index.d.ts +5 -0
  58. package/dist/context/strategies/index.d.ts.map +1 -0
  59. package/dist/context/strategies/index.js +4 -0
  60. package/dist/context/strategies/index.js.map +1 -0
  61. package/dist/context/types.d.ts +136 -0
  62. package/dist/context/types.d.ts.map +1 -0
  63. package/dist/context/types.js +8 -0
  64. package/dist/context/types.js.map +1 -0
  65. package/dist/core/Codebase.d.ts +50 -0
  66. package/dist/core/Codebase.d.ts.map +1 -1
  67. package/dist/core/Codebase.js +104 -0
  68. package/dist/core/Codebase.js.map +1 -1
  69. package/dist/diff/ChangeSetImpactAnalyzer.d.ts +19 -0
  70. package/dist/diff/ChangeSetImpactAnalyzer.d.ts.map +1 -0
  71. package/dist/diff/ChangeSetImpactAnalyzer.js +121 -0
  72. package/dist/diff/ChangeSetImpactAnalyzer.js.map +1 -0
  73. package/dist/diff/GitChangeSetProvider.d.ts +86 -0
  74. package/dist/diff/GitChangeSetProvider.d.ts.map +1 -0
  75. package/dist/diff/GitChangeSetProvider.js +297 -0
  76. package/dist/diff/GitChangeSetProvider.js.map +1 -0
  77. package/dist/diff/errors.d.ts +48 -0
  78. package/dist/diff/errors.d.ts.map +1 -0
  79. package/dist/diff/errors.js +70 -0
  80. package/dist/diff/errors.js.map +1 -0
  81. package/dist/diff/types.d.ts +159 -0
  82. package/dist/diff/types.d.ts.map +1 -0
  83. package/dist/diff/types.js +8 -0
  84. package/dist/diff/types.js.map +1 -0
  85. package/dist/explorer/SnapshotBuilder.d.ts +22 -0
  86. package/dist/explorer/SnapshotBuilder.d.ts.map +1 -0
  87. package/dist/explorer/SnapshotBuilder.js +225 -0
  88. package/dist/explorer/SnapshotBuilder.js.map +1 -0
  89. package/dist/explorer/types.d.ts +88 -0
  90. package/dist/explorer/types.d.ts.map +1 -0
  91. package/dist/explorer/types.js +12 -0
  92. package/dist/explorer/types.js.map +1 -0
  93. package/dist/explorer/ui/App.d.ts +3 -0
  94. package/dist/explorer/ui/App.d.ts.map +1 -0
  95. package/dist/explorer/ui/App.js +43 -0
  96. package/dist/explorer/ui/App.js.map +1 -0
  97. package/dist/explorer/ui/main.d.ts +2 -0
  98. package/dist/explorer/ui/main.d.ts.map +1 -0
  99. package/dist/explorer/ui/main.js +8 -0
  100. package/dist/explorer/ui/main.js.map +1 -0
  101. package/dist/index.d.ts +17 -0
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +16 -0
  104. package/dist/index.js.map +1 -1
  105. package/dist/ui/assets/index-D4w3JVrv.css +1 -0
  106. package/dist/ui/assets/index-DBRKE5qL.js +52 -0
  107. package/dist/ui/index.html +13 -0
  108. package/package.json +50 -50
@@ -0,0 +1,225 @@
1
+ import * as path from 'path';
2
+ import { EXPLORER_SCHEMA_VERSION } from './types.js';
3
+ // ---------------------------------------------------------------------------
4
+ // Internal helpers
5
+ // ---------------------------------------------------------------------------
6
+ /** Normalise a path to forward-slash separators (POSIX). */
7
+ function toPosix(p) {
8
+ return p.split(path.sep).join('/');
9
+ }
10
+ /** Derive the visual node type from a relative POSIX path. */
11
+ function nodeTypeFromPath(relativePath) {
12
+ const basename = relativePath.split('/').pop() ?? '';
13
+ if (/\.(test|spec)\.(ts|tsx|js|jsx|mjs|cjs)$/.test(basename))
14
+ return 'test';
15
+ return 'file';
16
+ }
17
+ /**
18
+ * Map the internal DependencyType string (stored in GraphEdge.type) to the
19
+ * richer ExplorerEdgeType vocabulary.
20
+ */
21
+ function mapEdgeType(type) {
22
+ switch (type) {
23
+ case 'import': return 'import';
24
+ case 'extends':
25
+ case 'implements': return 'references';
26
+ case 'unresolved': return 'unknown';
27
+ default: return 'dependency';
28
+ }
29
+ }
30
+ /**
31
+ * Collect every ancestor directory segment of a POSIX relative path.
32
+ *
33
+ * Example: 'src/auth/AuthService.ts' → ['src', 'src/auth']
34
+ */
35
+ function ancestorDirs(posixRelPath) {
36
+ const parts = posixRelPath.split('/');
37
+ parts.pop(); // remove filename
38
+ const dirs = [];
39
+ let acc = '';
40
+ for (const part of parts) {
41
+ acc = acc ? `${acc}/${part}` : part;
42
+ dirs.push(acc);
43
+ }
44
+ return dirs;
45
+ }
46
+ // ---------------------------------------------------------------------------
47
+ // SnapshotBuilder
48
+ // ---------------------------------------------------------------------------
49
+ /**
50
+ * Builds an {@link ExplorerSnapshot} from an analysed {@link Codebase}.
51
+ *
52
+ * Rules:
53
+ * - The codebase MUST have been analysed (`analyze()` called) before calling
54
+ * `build()`. If not, edges will be empty because the graph will be empty.
55
+ * - IDs are stable POSIX relative paths (e.g. `src/auth/AuthService.ts`).
56
+ * - External / unresolved graph nodes (not present in `codebase.files()`)
57
+ * are silently skipped — we never invent nodes that the analysis cannot prove.
58
+ * - The resulting snapshot is fully JSON-serialisable with no circular refs.
59
+ */
60
+ export class SnapshotBuilder {
61
+ /**
62
+ * @param codebase The analysed codebase instance.
63
+ * @param rootPath The absolute path that was passed to `Codebase.load()`.
64
+ * Used as `ExplorerSnapshot.rootPath`.
65
+ */
66
+ static build(codebase, rootPath) {
67
+ const resolvedRoot = path.resolve(rootPath);
68
+ const files = codebase.files();
69
+ const graph = codebase.graph();
70
+ const info = codebase.projectInfo();
71
+ // Map: POSIX file path → POSIX relative ID
72
+ // Both the graph (via TypeScriptParser) and fast-glob use forward-slash paths,
73
+ // so we normalise all keys to POSIX to guarantee consistent lookups on Windows.
74
+ const absToRel = new Map();
75
+ for (const f of files) {
76
+ absToRel.set(toPosix(f.path), toPosix(f.relativePath));
77
+ }
78
+ // -----------------------------------------------------------------------
79
+ // 1. File nodes
80
+ // -----------------------------------------------------------------------
81
+ const nodes = [];
82
+ const dirIds = new Set();
83
+ for (const f of files) {
84
+ const relId = toPosix(f.relativePath);
85
+ const basename = relId.split('/').pop() ?? relId;
86
+ const type = nodeTypeFromPath(relId);
87
+ // parentId: the immediate containing directory, or undefined for root files
88
+ const lastSlash = relId.lastIndexOf('/');
89
+ const parentId = lastSlash > 0 ? relId.substring(0, lastSlash) : undefined;
90
+ // Metrics will be computed after edges are resolved
91
+ const dependencyCount = 0;
92
+ const dependentCount = 0;
93
+ nodes.push({
94
+ id: relId,
95
+ label: basename,
96
+ path: relId,
97
+ type,
98
+ ...(parentId !== undefined ? { parentId } : {}),
99
+ metrics: {
100
+ dependencyCount,
101
+ dependentCount,
102
+ },
103
+ metadata: {
104
+ sizeBytes: f.size,
105
+ language: f.language,
106
+ },
107
+ });
108
+ // Register ancestor directories for step 2
109
+ for (const dir of ancestorDirs(relId)) {
110
+ dirIds.add(dir);
111
+ }
112
+ }
113
+ // -----------------------------------------------------------------------
114
+ // 2. Directory nodes (derived from file paths — never invented)
115
+ // -----------------------------------------------------------------------
116
+ for (const dirId of dirIds) {
117
+ const parts = dirId.split('/');
118
+ const label = parts[parts.length - 1] ?? dirId;
119
+ const parentId = parts.length > 1
120
+ ? parts.slice(0, parts.length - 1).join('/')
121
+ : undefined;
122
+ nodes.push({
123
+ id: dirId,
124
+ label,
125
+ path: dirId,
126
+ type: 'directory',
127
+ ...(parentId !== undefined ? { parentId } : {}),
128
+ });
129
+ }
130
+ // -----------------------------------------------------------------------
131
+ // 3. Dependency edges (from DependencyGraph)
132
+ // -----------------------------------------------------------------------
133
+ const edges = [];
134
+ const seenEdges = new Set();
135
+ for (const rawAbsId of graph.nodes()) {
136
+ let sourceRel = absToRel.get(rawAbsId);
137
+ if (!sourceRel && rawAbsId.endsWith('.js')) {
138
+ sourceRel = absToRel.get(rawAbsId.slice(0, -3) + '.ts');
139
+ }
140
+ if (!sourceRel)
141
+ continue; // external / unresolved — skip
142
+ const absId = rawAbsId.endsWith('.js') && !absToRel.has(rawAbsId) && absToRel.has(rawAbsId.slice(0, -3) + '.ts')
143
+ ? rawAbsId.slice(0, -3) + '.ts'
144
+ : rawAbsId;
145
+ for (const rawDepAbsId of graph.dependenciesOf(rawAbsId)) {
146
+ let targetRel = absToRel.get(rawDepAbsId);
147
+ if (!targetRel && rawDepAbsId.endsWith('.js')) {
148
+ targetRel = absToRel.get(rawDepAbsId.slice(0, -3) + '.ts');
149
+ }
150
+ if (!targetRel)
151
+ continue; // external / unresolved — skip
152
+ const edgeId = `${sourceRel}→${targetRel}`;
153
+ if (seenEdges.has(edgeId))
154
+ continue;
155
+ seenEdges.add(edgeId);
156
+ const graphEdge = graph.getEdge(rawAbsId, rawDepAbsId);
157
+ edges.push({
158
+ id: edgeId,
159
+ source: sourceRel,
160
+ target: targetRel,
161
+ type: mapEdgeType(graphEdge?.type),
162
+ });
163
+ }
164
+ }
165
+ // -----------------------------------------------------------------------
166
+ // 4. "contains" edges (directory → direct children)
167
+ // -----------------------------------------------------------------------
168
+ for (const node of nodes) {
169
+ if (!node.parentId)
170
+ continue;
171
+ const edgeId = `${node.parentId}→${node.id}`;
172
+ if (seenEdges.has(edgeId))
173
+ continue;
174
+ seenEdges.add(edgeId);
175
+ edges.push({
176
+ id: edgeId,
177
+ source: node.parentId,
178
+ target: node.id,
179
+ type: 'contains',
180
+ });
181
+ }
182
+ // -----------------------------------------------------------------------
183
+ // 4.5. Compute node metrics from resolved edges
184
+ // -----------------------------------------------------------------------
185
+ const nodeMap = new Map();
186
+ for (const node of nodes) {
187
+ nodeMap.set(node.id, node);
188
+ }
189
+ for (const edge of edges) {
190
+ if (edge.type === 'contains')
191
+ continue;
192
+ const sourceNode = nodeMap.get(edge.source);
193
+ if (sourceNode && sourceNode.metrics) {
194
+ sourceNode.metrics.dependencyCount = (sourceNode.metrics.dependencyCount || 0) + 1;
195
+ }
196
+ const targetNode = nodeMap.get(edge.target);
197
+ if (targetNode && targetNode.metrics) {
198
+ targetNode.metrics.dependentCount = (targetNode.metrics.dependentCount || 0) + 1;
199
+ }
200
+ }
201
+ // -----------------------------------------------------------------------
202
+ // 5. Aggregate metadata
203
+ // -----------------------------------------------------------------------
204
+ const fileNodes = nodes.filter((n) => n.type !== 'directory');
205
+ const dirNodes = nodes.filter((n) => n.type === 'directory');
206
+ const depEdges = edges.filter((e) => e.type !== 'contains');
207
+ return {
208
+ schemaVersion: EXPLORER_SCHEMA_VERSION,
209
+ rootPath: resolvedRoot,
210
+ generatedAt: new Date().toISOString(),
211
+ nodes,
212
+ edges,
213
+ metadata: {
214
+ totalFiles: fileNodes.length,
215
+ totalDirectories: dirNodes.length,
216
+ totalEdges: depEdges.length,
217
+ analyzerVersion: '0.1.0',
218
+ ...(info?.languages ? { languages: info.languages } : {}),
219
+ ...(info?.frameworks ? { frameworks: info.frameworks } : {}),
220
+ ...(info?.packageManager ? { packageManager: info.packageManager } : {}),
221
+ },
222
+ };
223
+ }
224
+ }
225
+ //# sourceMappingURL=SnapshotBuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SnapshotBuilder.js","sourceRoot":"","sources":["../../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I,KAAK,WAAW,CAAC,CAAC;QAC9D,MAAM,QAAQ,GAAI,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;QAE7D,OAAO;YACL,aAAa,EAAE,uBAAuB;YACtC,QAAQ,EAAE,YAAY;YACtB,WAAW,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;YACrC,KAAK;YACL,KAAK;YACL,QAAQ,EAAE;gBACR,UAAU,EAAQ,SAAS,CAAC,MAAM;gBAClC,gBAAgB,EAAE,QAAQ,CAAC,MAAM;gBACjC,UAAU,EAAQ,QAAQ,CAAC,MAAM;gBACjC,eAAe,EAAG,OAAO;gBACzB,GAAG,CAAC,IAAI,EAAE,SAAS,CAAI,CAAC,CAAC,EAAE,SAAS,EAAO,IAAI,CAAC,SAAS,EAAE,CAAI,CAAC,CAAC,EAAE,CAAC;gBACpE,GAAG,CAAC,IAAI,EAAE,UAAU,CAAG,CAAC,CAAC,EAAE,UAAU,EAAM,IAAI,CAAC,UAAU,EAAE,CAAG,CAAC,CAAC,EAAE,CAAC;gBACpE,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,IAAI,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACzE;SACF,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Explorer contract — stable, versioned, JSON-serialisable.
3
+ *
4
+ * These types describe the normalised representation of an analysed codebase
5
+ * that the Interactive Map Explorer consumes. They are deliberately decoupled
6
+ * from the internal analysis types so the Explorer UI has no dependency on
7
+ * ts-morph, the parser, or any other analysis detail.
8
+ *
9
+ * Schema version follows semver (MAJOR.MINOR) — bump MAJOR on breaking changes.
10
+ */
11
+ export declare const EXPLORER_SCHEMA_VERSION: '1.0';
12
+ export type ExplorerNodeType = 'file' | 'directory' | 'module' | 'package' | 'test' | 'unknown';
13
+ export interface ExplorerNodeMetrics {
14
+ /** Lines-of-code, if available */
15
+ linesOfCode?: number;
16
+ /** Number of direct dependencies (outgoing edges) */
17
+ dependencyCount?: number;
18
+ /** Number of direct dependents (incoming edges) */
19
+ dependentCount?: number;
20
+ }
21
+ export interface ExplorerNode {
22
+ /** Stable identifier — normalised relative path (POSIX separators) */
23
+ id: string;
24
+ /** Display name — typically the basename */
25
+ label: string;
26
+ /** Normalised relative path from the codebase root (POSIX separators) */
27
+ path: string;
28
+ /** Node category */
29
+ type: ExplorerNodeType;
30
+ /** ID of the containing directory node, absent for the root */
31
+ parentId?: string;
32
+ /** Detected package name from package.json, when available */
33
+ packageName?: string;
34
+ /** Architectural layer label, e.g. "ui", "domain", "infra" */
35
+ layer?: string;
36
+ /** Optional metrics gathered during analysis */
37
+ metrics?: ExplorerNodeMetrics;
38
+ /** Arbitrary extra metadata — must be JSON-serialisable */
39
+ metadata?: Record<string, unknown>;
40
+ }
41
+ export type ExplorerEdgeType = 'import' | 'export' | 'dependency' | 'contains' | 'references' | 'test' | 'unknown';
42
+ export interface ExplorerEdge {
43
+ /** Stable identifier — `"${source}→${target}"` */
44
+ id: string;
45
+ /** ID of the source node (the file that declares the import) */
46
+ source: string;
47
+ /** ID of the target node (the file being imported) */
48
+ target: string;
49
+ /** Relationship kind */
50
+ type: ExplorerEdgeType;
51
+ /** Optional weight, e.g. import frequency */
52
+ weight?: number;
53
+ /** Arbitrary extra metadata — must be JSON-serialisable */
54
+ metadata?: Record<string, unknown>;
55
+ }
56
+ export interface ExplorerSnapshotMetadata {
57
+ totalFiles: number;
58
+ totalDirectories: number;
59
+ totalEdges: number;
60
+ /** Version string of the codebase-intelligence package that produced this */
61
+ analyzerVersion?: string;
62
+ /** Languages detected in the analysed project */
63
+ languages?: string[];
64
+ /** Frameworks detected in the analysed project */
65
+ frameworks?: string[];
66
+ /** Package manager detected in the analysed project */
67
+ packageManager?: string;
68
+ }
69
+ /**
70
+ * The full, self-contained snapshot of an analysed codebase.
71
+ * This is the only value the Explorer UI depends on — it can be loaded from
72
+ * disk or produced in-memory by the SnapshotBuilder.
73
+ */
74
+ export interface ExplorerSnapshot {
75
+ /** Schema version for forward/backward compatibility checks */
76
+ schemaVersion: typeof EXPLORER_SCHEMA_VERSION;
77
+ /** Absolute path of the analysed codebase root */
78
+ rootPath: string;
79
+ /** ISO-8601 timestamp of when the snapshot was generated */
80
+ generatedAt: string;
81
+ /** All nodes (files + directories) */
82
+ nodes: ExplorerNode[];
83
+ /** All directed edges (imports / dependencies / contains) */
84
+ edges: ExplorerEdge[];
85
+ /** Aggregate metadata about the snapshot */
86
+ metadata: ExplorerSnapshotMetadata;
87
+ }
88
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/explorer/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,eAAO,MAAM,uBAAuB,EAAG,KAAc,CAAC;AAMtD,MAAM,MAAM,gBAAgB,GACxB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,SAAS,GACT,MAAM,GACN,SAAS,CAAC;AAEd,MAAM,WAAW,mBAAmB;IAClC,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qDAAqD;IACrD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,mDAAmD;IACnD,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,YAAY;IAC3B,sEAAsE;IACtE,EAAE,EAAE,MAAM,CAAC;IACX,4CAA4C;IAC5C,KAAK,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAC;IACb,oBAAoB;IACpB,IAAI,EAAE,gBAAgB,CAAC;IACvB,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,KAAK,CAAC,EA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,EAAE,CAAC;IACtB,4CAA4C;IAC5C,QAAQ,EAAE,wBAAwB,CAAC;CACpC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Explorer contract — stable, versioned, JSON-serialisable.
3
+ *
4
+ * These types describe the normalised representation of an analysed codebase
5
+ * that the Interactive Map Explorer consumes. They are deliberately decoupled
6
+ * from the internal analysis types so the Explorer UI has no dependency on
7
+ * ts-morph, the parser, or any other analysis detail.
8
+ *
9
+ * Schema version follows semver (MAJOR.MINOR) — bump MAJOR on breaking changes.
10
+ */
11
+ export const EXPLORER_SCHEMA_VERSION = '1.0';
12
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/explorer/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,CAAC,MAAM,uBAAuB,GAAG,KAAc,CAAC"}
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const App: React.FC;
3
+ //# sourceMappingURL=App.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../../../src/explorer/ui/App.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AA0BpE,eAAO,MAAM,GAAG,EAAE,KAAK,CAAC,EA8EvB,CAAC"}
@@ -0,0 +1,43 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React, { useEffect, useState, useMemo, useRef } from 'react';
3
+ import ForceGraph2D, { ForceGraphMethods } from 'react-force-graph-2d';
4
+ export const App = () => {
5
+ const [data, setData] = useState(null);
6
+ const [error, setError] = useState(null);
7
+ const [hoverNode, setHoverNode] = useState(null);
8
+ const fgRef = useRef();
9
+ useEffect(() => {
10
+ fetch('/api/snapshot')
11
+ .then((res) => {
12
+ if (!res.ok)
13
+ throw new Error('Failed to fetch snapshot');
14
+ return res.json();
15
+ })
16
+ .then((json) => setData(json))
17
+ .catch((err) => setError(err.message));
18
+ }, []);
19
+ const graphData = useMemo(() => {
20
+ if (!data)
21
+ return { nodes: [], links: [] };
22
+ // We only map files for the node graph for now (ignore directories to keep it clean)
23
+ // "contains" edges can clutter the view, so we filter them out.
24
+ const fileNodes = data.nodes.filter(n => n.type === 'file' || n.type === 'test');
25
+ const validNodeIds = new Set(fileNodes.map(n => n.id));
26
+ const dependencyEdges = data.edges.filter(e => e.type !== 'contains' && validNodeIds.has(e.source) && validNodeIds.has(e.target));
27
+ return {
28
+ nodes: fileNodes.map(n => ({ ...n })),
29
+ links: dependencyEdges.map(e => ({ ...e }))
30
+ };
31
+ }, [data]);
32
+ if (error) {
33
+ return _jsx("div", { className: "loader-container", children: _jsxs("p", { style: { color: '#f44336' }, children: ["Error: ", error] }) });
34
+ }
35
+ if (!data) {
36
+ return (_jsxs("div", { className: "loader-container", children: [_jsx("div", { className: "spinner" }), _jsx("p", { children: "Analyzing codebase..." })] }));
37
+ }
38
+ return (_jsxs(_Fragment, { children: [_jsxs("div", { className: "overlay", children: [_jsx("h1", { children: "Codebase Intelligence" }), _jsxs("div", { className: "stat-row", children: [_jsx("span", { children: "Files" }), _jsx("span", { children: data.metadata.totalFiles })] }), _jsxs("div", { className: "stat-row", children: [_jsx("span", { children: "Dependencies" }), _jsx("span", { children: data.metadata.totalEdges })] })] }), _jsx(ForceGraph2D, { ref: fgRef, graphData: graphData, nodeLabel: "label", nodeColor: (node) => node.type === 'test' ? '#4CAF50' : '#61dafb', nodeRelSize: 6, nodeVal: (node) => {
39
+ // Bigger nodes for files with many dependencies
40
+ return 1 + Math.log10(1 + (node.metrics?.dependentCount || 0) + (node.metrics?.dependencyCount || 0));
41
+ }, linkColor: () => 'rgba(255, 255, 255, 0.2)', linkDirectionalArrowLength: 3.5, linkDirectionalArrowRelPos: 1, onNodeHover: (node) => setHoverNode(node || null) })] }));
42
+ };
43
+ //# sourceMappingURL=App.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"App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AQ,CAAC,UAAU,GAAQ,IACnC,EACN,eAAK,SAAS,EAAC,UAAU,aACvB,0CAAyB,EACzB,yBAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,GAAQ,IACnC,IACF,EAEN,KAAC,YAAY,IACX,GAAG,EAAE,KAAK,EACV,SAAS,EAAE,SAAS,EACpB,SAAS,EAAC,OAAO,EACjB,SAAS,EAAE,CAAC,IAAS,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,EACtE,WAAW,EAAE,CAAC,EACd,OAAO,EAAE,CAAC,IAAS,EAAE,EAAE;oBACrB,gDAAgD;oBAChD,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,eAAe,IAAI,CAAC,CAAC,CAAC,CAAC;gBACxG,CAAC,EACD,SAAS,EAAE,GAAG,EAAE,CAAC,0BAA0B,EAC3C,0BAA0B,EAAE,GAAG,EAC/B,0BAA0B,EAAE,CAAC,EAC7B,WAAW,EAAE,CAAC,IAAS,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,IAAI,IAAI,CAAC,GACtD,IACD,CACJ,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ import './index.css';
2
+ //# sourceMappingURL=main.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/explorer/ui/main.tsx"],"names":[],"mappings":"AAGA,OAAO,aAAa,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { createRoot } from 'react-dom/client';
4
+ import { App } from './App';
5
+ import './index.css';
6
+ const root = createRoot(document.getElementById('root'));
7
+ root.render(_jsx(React.StrictMode, { children: _jsx(App, {}) }));
8
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../src/explorer/ui/main.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAE,CAAC,CAAC;AAC1D,IAAI,CAAC,MAAM,CACT,KAAC,KAAK,CAAC,UAAU,cACf,KAAC,GAAG,KAAG,GACU,CACpB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -5,4 +5,21 @@ export type { ProjectInfo } from './discovery/ProjectDetector.js';
5
5
  export type { SymbolQuery } from './index/SymbolIndex.js';
6
6
  export type { SearchResult, SearchOptions, SearchMode } from './search/CodeSearch.js';
7
7
  export { CACHE_DIR_NAME } from './core/AnalysisCache.js';
8
+ export type { ContextNode, ContextNodeKind, ContextStrategy, ContextOptions, LLMContextPayload, ContextPayloadMetadata, } from './context/types.js';
9
+ export type { IContextEngine, AIProvider, EmbeddingProvider, VectorStore, VectorSearchResult, } from './context/interfaces.js';
10
+ export { ContextEngine } from './context/ContextEngine.js';
11
+ export { ShallowStrategy, SignatureStrategy, DeepStrategy } from './context/strategies/index.js';
12
+ export type { ContextBuildStrategy } from './context/strategies/index.js';
13
+ export { SignatureExtractor } from './context/SignatureExtractor.js';
14
+ export { NoopAIProvider } from './ai/providers/NoopAIProvider.js';
15
+ export { CodebaseWithAI } from './ai/CodebaseWithAI.js';
16
+ export type { ExplainOptions, AskOptions } from './ai/CodebaseWithAI.js';
17
+ export { SemanticChunker } from './context/SemanticChunker.js';
18
+ export type { SemanticChunk, ChunkerOptions } from './context/SemanticChunker.js';
19
+ export { RAGPipeline } from './ai/RAGPipeline.js';
20
+ export type { RAGPipelineOptions } from './ai/RAGPipeline.js';
21
+ export type { FileChange, ChangeStatus, ChangeSetOptions, ChangeSetProvider, UnanalyzableReason, ChangeSetImpact, } from './diff/types.js';
22
+ export { GitNotAvailableError, NotAGitRepositoryError, InvalidGitRefError, GitCommandError, } from './diff/errors.js';
23
+ export { GitChangeSetProvider } from './diff/GitChangeSetProvider.js';
24
+ export { ChangeSetImpactAnalyzer } from './diff/ChangeSetImpactAnalyzer.js';
8
25
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,YAAY,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,YAAY,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1D,YAAY,EACV,YAAY,EACZ,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,UAAU,EACV,cAAc,EACd,UAAU,EACX,MAAM,iBAAiB,CAAC;AACzB,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAA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AAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC"}
package/dist/index.js CHANGED
@@ -1,4 +1,20 @@
1
1
  // Public API — only expose what consumers need
2
2
  export { Codebase } from './core/Codebase.js';
3
3
  export { CACHE_DIR_NAME } from './core/AnalysisCache.js';
4
+ // Context Engine — CE-2: Implementation
5
+ export { ContextEngine } from './context/ContextEngine.js';
6
+ // Context Engine — CE-3: Strategy classes & SignatureExtractor
7
+ export { ShallowStrategy, SignatureStrategy, DeepStrategy } from './context/strategies/index.js';
8
+ export { SignatureExtractor } from './context/SignatureExtractor.js';
9
+ // Context Engine — CE-4: AI Provider Interface
10
+ export { NoopAIProvider } from './ai/providers/NoopAIProvider.js';
11
+ export { CodebaseWithAI } from './ai/CodebaseWithAI.js';
12
+ // Context Engine — CE-5: Semantic Chunker
13
+ export { SemanticChunker } from './context/SemanticChunker.js';
14
+ // Context Engine — CE-6: EmbeddingProvider + VectorStore Abstractions
15
+ export { RAGPipeline } from './ai/RAGPipeline.js';
16
+ export { GitNotAvailableError, NotAGitRepositoryError, InvalidGitRefError, GitCommandError, } from './diff/errors.js';
17
+ // Diff Impact — DI-2 & DI-3: Provider & Analyzer
18
+ export { GitChangeSetProvider } from './diff/GitChangeSetProvider.js';
19
+ export { ChangeSetImpactAnalyzer } from './diff/ChangeSetImpactAnalyzer.js';
4
20
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAc9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAc9C,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAkBzD,wCAAwC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAE3D,+DAA+D;AAC/D,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAEjG,OAAO,EAAE,kBAAkB,EAAE,MAAM,iCAAiC,CAAC;AAErE,+CAA+C;AAC/C,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAGxD,0CAA0C;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAG/D,sEAAsE;AACtE,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYlD,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,iDAAiD;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AACtE,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1 @@
1
+ body,html,#root{color:#fff;background-color:#0f111a;width:100vw;height:100vh;margin:0;padding:0;font-family:system-ui,-apple-system,sans-serif;overflow:hidden}.loader-container{flex-direction:column;justify-content:center;align-items:center;gap:16px;width:100vw;height:100vh;display:flex}.spinner{border:4px solid #ffffff1a;border-left-color:#61dafb;border-radius:50%;width:40px;height:40px;animation:1s linear infinite spin}@keyframes spin{to{transform:rotate(360deg)}}.overlay{-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);pointer-events:none;z-index:10;background:#0f111acc;border:1px solid #ffffff1a;border-radius:8px;min-width:200px;padding:16px;position:absolute;top:16px;left:16px;box-shadow:0 4px 20px #00000080}.overlay h1{color:#fff;letter-spacing:.5px;margin:0 0 12px;font-size:16px;font-weight:600}.stat-row{color:#aaa;justify-content:space-between;margin-bottom:8px;font-size:13px;display:flex}.stat-row span:last-child{color:#61dafb;font-weight:700}