@bugsbunnycodes1998/cartographer-core 0.1.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.
Files changed (220) hide show
  1. package/dist/__tests__/pipeline.test.d.ts +2 -0
  2. package/dist/__tests__/pipeline.test.d.ts.map +1 -0
  3. package/dist/__tests__/pipeline.test.js +58 -0
  4. package/dist/__tests__/pipeline.test.js.map +1 -0
  5. package/dist/analysis/call-graph.d.ts +13 -0
  6. package/dist/analysis/call-graph.d.ts.map +1 -0
  7. package/dist/analysis/call-graph.js +133 -0
  8. package/dist/analysis/call-graph.js.map +1 -0
  9. package/dist/analysis/dependency-graph.d.ts +8 -0
  10. package/dist/analysis/dependency-graph.d.ts.map +1 -0
  11. package/dist/analysis/dependency-graph.js +101 -0
  12. package/dist/analysis/dependency-graph.js.map +1 -0
  13. package/dist/analysis/git/archaeology.d.ts +20 -0
  14. package/dist/analysis/git/archaeology.d.ts.map +1 -0
  15. package/dist/analysis/git/archaeology.js +61 -0
  16. package/dist/analysis/git/archaeology.js.map +1 -0
  17. package/dist/analysis/git/bus-factor.d.ts +17 -0
  18. package/dist/analysis/git/bus-factor.d.ts.map +1 -0
  19. package/dist/analysis/git/bus-factor.js +90 -0
  20. package/dist/analysis/git/bus-factor.js.map +1 -0
  21. package/dist/analysis/git/churn.d.ts +26 -0
  22. package/dist/analysis/git/churn.d.ts.map +1 -0
  23. package/dist/analysis/git/churn.js +127 -0
  24. package/dist/analysis/git/churn.js.map +1 -0
  25. package/dist/analysis/git/contributors.d.ts +14 -0
  26. package/dist/analysis/git/contributors.d.ts.map +1 -0
  27. package/dist/analysis/git/contributors.js +60 -0
  28. package/dist/analysis/git/contributors.js.map +1 -0
  29. package/dist/analysis/git/evolution.d.ts +10 -0
  30. package/dist/analysis/git/evolution.d.ts.map +1 -0
  31. package/dist/analysis/git/evolution.js +127 -0
  32. package/dist/analysis/git/evolution.js.map +1 -0
  33. package/dist/analysis/git/index.d.ts +6 -0
  34. package/dist/analysis/git/index.d.ts.map +1 -0
  35. package/dist/analysis/git/index.js +6 -0
  36. package/dist/analysis/git/index.js.map +1 -0
  37. package/dist/analysis/go-visitor.d.ts +4 -0
  38. package/dist/analysis/go-visitor.d.ts.map +1 -0
  39. package/dist/analysis/go-visitor.js +295 -0
  40. package/dist/analysis/go-visitor.js.map +1 -0
  41. package/dist/analysis/health/indicators.d.ts +25 -0
  42. package/dist/analysis/health/indicators.d.ts.map +1 -0
  43. package/dist/analysis/health/indicators.js +53 -0
  44. package/dist/analysis/health/indicators.js.map +1 -0
  45. package/dist/analysis/health/scorer.d.ts +26 -0
  46. package/dist/analysis/health/scorer.d.ts.map +1 -0
  47. package/dist/analysis/health/scorer.js +97 -0
  48. package/dist/analysis/health/scorer.js.map +1 -0
  49. package/dist/analysis/health/test-coverage.d.ts +19 -0
  50. package/dist/analysis/health/test-coverage.d.ts.map +1 -0
  51. package/dist/analysis/health/test-coverage.js +67 -0
  52. package/dist/analysis/health/test-coverage.js.map +1 -0
  53. package/dist/analysis/import-resolver.d.ts +10 -0
  54. package/dist/analysis/import-resolver.d.ts.map +1 -0
  55. package/dist/analysis/import-resolver.js +353 -0
  56. package/dist/analysis/import-resolver.js.map +1 -0
  57. package/dist/analysis/index.d.ts +22 -0
  58. package/dist/analysis/index.d.ts.map +1 -0
  59. package/dist/analysis/index.js +24 -0
  60. package/dist/analysis/index.js.map +1 -0
  61. package/dist/analysis/java-visitor.d.ts +4 -0
  62. package/dist/analysis/java-visitor.d.ts.map +1 -0
  63. package/dist/analysis/java-visitor.js +257 -0
  64. package/dist/analysis/java-visitor.js.map +1 -0
  65. package/dist/analysis/metrics.d.ts +19 -0
  66. package/dist/analysis/metrics.d.ts.map +1 -0
  67. package/dist/analysis/metrics.js +70 -0
  68. package/dist/analysis/metrics.js.map +1 -0
  69. package/dist/analysis/module-detector.d.ts +3 -0
  70. package/dist/analysis/module-detector.d.ts.map +1 -0
  71. package/dist/analysis/module-detector.js +257 -0
  72. package/dist/analysis/module-detector.js.map +1 -0
  73. package/dist/analysis/parser.d.ts +13 -0
  74. package/dist/analysis/parser.d.ts.map +1 -0
  75. package/dist/analysis/parser.js +92 -0
  76. package/dist/analysis/parser.js.map +1 -0
  77. package/dist/analysis/python-visitor.d.ts +4 -0
  78. package/dist/analysis/python-visitor.d.ts.map +1 -0
  79. package/dist/analysis/python-visitor.js +306 -0
  80. package/dist/analysis/python-visitor.js.map +1 -0
  81. package/dist/analysis/rust-visitor.d.ts +4 -0
  82. package/dist/analysis/rust-visitor.d.ts.map +1 -0
  83. package/dist/analysis/rust-visitor.js +318 -0
  84. package/dist/analysis/rust-visitor.js.map +1 -0
  85. package/dist/analysis/semantic/cache.d.ts +16 -0
  86. package/dist/analysis/semantic/cache.d.ts.map +1 -0
  87. package/dist/analysis/semantic/cache.js +26 -0
  88. package/dist/analysis/semantic/cache.js.map +1 -0
  89. package/dist/analysis/semantic/openai-client.d.ts +21 -0
  90. package/dist/analysis/semantic/openai-client.d.ts.map +1 -0
  91. package/dist/analysis/semantic/openai-client.js +73 -0
  92. package/dist/analysis/semantic/openai-client.js.map +1 -0
  93. package/dist/analysis/semantic/prompts.d.ts +32 -0
  94. package/dist/analysis/semantic/prompts.d.ts.map +1 -0
  95. package/dist/analysis/semantic/prompts.js +134 -0
  96. package/dist/analysis/semantic/prompts.js.map +1 -0
  97. package/dist/analysis/semantic/summarizer.d.ts +36 -0
  98. package/dist/analysis/semantic/summarizer.d.ts.map +1 -0
  99. package/dist/analysis/semantic/summarizer.js +229 -0
  100. package/dist/analysis/semantic/summarizer.js.map +1 -0
  101. package/dist/analysis/ts-js-visitor.d.ts +4 -0
  102. package/dist/analysis/ts-js-visitor.d.ts.map +1 -0
  103. package/dist/analysis/ts-js-visitor.js +390 -0
  104. package/dist/analysis/ts-js-visitor.js.map +1 -0
  105. package/dist/analysis/visitor-registry.d.ts +5 -0
  106. package/dist/analysis/visitor-registry.d.ts.map +1 -0
  107. package/dist/analysis/visitor-registry.js +17 -0
  108. package/dist/analysis/visitor-registry.js.map +1 -0
  109. package/dist/analysis/visitor-utils.d.ts +38 -0
  110. package/dist/analysis/visitor-utils.d.ts.map +1 -0
  111. package/dist/analysis/visitor-utils.js +110 -0
  112. package/dist/analysis/visitor-utils.js.map +1 -0
  113. package/dist/errors.d.ts +20 -0
  114. package/dist/errors.d.ts.map +1 -0
  115. package/dist/errors.js +39 -0
  116. package/dist/errors.js.map +1 -0
  117. package/dist/expeditions/custom.d.ts +11 -0
  118. package/dist/expeditions/custom.d.ts.map +1 -0
  119. package/dist/expeditions/custom.js +61 -0
  120. package/dist/expeditions/custom.js.map +1 -0
  121. package/dist/expeditions/danger-zones.d.ts +9 -0
  122. package/dist/expeditions/danger-zones.d.ts.map +1 -0
  123. package/dist/expeditions/danger-zones.js +42 -0
  124. package/dist/expeditions/danger-zones.js.map +1 -0
  125. package/dist/expeditions/generator.d.ts +21 -0
  126. package/dist/expeditions/generator.d.ts.map +1 -0
  127. package/dist/expeditions/generator.js +78 -0
  128. package/dist/expeditions/generator.js.map +1 -0
  129. package/dist/expeditions/grand-tour.d.ts +10 -0
  130. package/dist/expeditions/grand-tour.d.ts.map +1 -0
  131. package/dist/expeditions/grand-tour.js +96 -0
  132. package/dist/expeditions/grand-tour.js.map +1 -0
  133. package/dist/expeditions/request-flow.d.ts +11 -0
  134. package/dist/expeditions/request-flow.d.ts.map +1 -0
  135. package/dist/expeditions/request-flow.js +138 -0
  136. package/dist/expeditions/request-flow.js.map +1 -0
  137. package/dist/grammars/tree-sitter-go.wasm +0 -0
  138. package/dist/grammars/tree-sitter-java.wasm +0 -0
  139. package/dist/grammars/tree-sitter-javascript.wasm +0 -0
  140. package/dist/grammars/tree-sitter-python.wasm +0 -0
  141. package/dist/grammars/tree-sitter-rust.wasm +0 -0
  142. package/dist/grammars/tree-sitter-tsx.wasm +0 -0
  143. package/dist/grammars/tree-sitter-typescript.wasm +0 -0
  144. package/dist/graph/builder.d.ts +23 -0
  145. package/dist/graph/builder.d.ts.map +1 -0
  146. package/dist/graph/builder.js +131 -0
  147. package/dist/graph/builder.js.map +1 -0
  148. package/dist/graph/exporter.d.ts +5 -0
  149. package/dist/graph/exporter.d.ts.map +1 -0
  150. package/dist/graph/exporter.js +20 -0
  151. package/dist/graph/exporter.js.map +1 -0
  152. package/dist/graph/layout.d.ts +3 -0
  153. package/dist/graph/layout.d.ts.map +1 -0
  154. package/dist/graph/layout.js +257 -0
  155. package/dist/graph/layout.js.map +1 -0
  156. package/dist/graph/store.d.ts +13 -0
  157. package/dist/graph/store.d.ts.map +1 -0
  158. package/dist/graph/store.js +145 -0
  159. package/dist/graph/store.js.map +1 -0
  160. package/dist/index.d.ts +17 -0
  161. package/dist/index.d.ts.map +1 -0
  162. package/dist/index.js +12 -0
  163. package/dist/index.js.map +1 -0
  164. package/dist/ingestion/cloner.d.ts +18 -0
  165. package/dist/ingestion/cloner.d.ts.map +1 -0
  166. package/dist/ingestion/cloner.js +62 -0
  167. package/dist/ingestion/cloner.js.map +1 -0
  168. package/dist/ingestion/file-tree.d.ts +3 -0
  169. package/dist/ingestion/file-tree.d.ts.map +1 -0
  170. package/dist/ingestion/file-tree.js +85 -0
  171. package/dist/ingestion/file-tree.js.map +1 -0
  172. package/dist/ingestion/index.d.ts +5 -0
  173. package/dist/ingestion/index.d.ts.map +1 -0
  174. package/dist/ingestion/index.js +5 -0
  175. package/dist/ingestion/index.js.map +1 -0
  176. package/dist/ingestion/language-detector.d.ts +8 -0
  177. package/dist/ingestion/language-detector.d.ts.map +1 -0
  178. package/dist/ingestion/language-detector.js +37 -0
  179. package/dist/ingestion/language-detector.js.map +1 -0
  180. package/dist/ingestion/path-resolver.d.ts +7 -0
  181. package/dist/ingestion/path-resolver.d.ts.map +1 -0
  182. package/dist/ingestion/path-resolver.js +30 -0
  183. package/dist/ingestion/path-resolver.js.map +1 -0
  184. package/dist/logger.d.ts +3 -0
  185. package/dist/logger.d.ts.map +1 -0
  186. package/dist/logger.js +11 -0
  187. package/dist/logger.js.map +1 -0
  188. package/dist/pipeline.d.ts +3 -0
  189. package/dist/pipeline.d.ts.map +1 -0
  190. package/dist/pipeline.js +223 -0
  191. package/dist/pipeline.js.map +1 -0
  192. package/dist/types/analysis.d.ts +51 -0
  193. package/dist/types/analysis.d.ts.map +1 -0
  194. package/dist/types/analysis.js +2 -0
  195. package/dist/types/analysis.js.map +1 -0
  196. package/dist/types/config.d.ts +19 -0
  197. package/dist/types/config.d.ts.map +1 -0
  198. package/dist/types/config.js +2 -0
  199. package/dist/types/config.js.map +1 -0
  200. package/dist/types/edges.d.ts +8 -0
  201. package/dist/types/edges.d.ts.map +1 -0
  202. package/dist/types/edges.js +2 -0
  203. package/dist/types/edges.js.map +1 -0
  204. package/dist/types/expeditions.d.ts +19 -0
  205. package/dist/types/expeditions.d.ts.map +1 -0
  206. package/dist/types/expeditions.js +2 -0
  207. package/dist/types/expeditions.js.map +1 -0
  208. package/dist/types/graph.d.ts +29 -0
  209. package/dist/types/graph.d.ts.map +1 -0
  210. package/dist/types/graph.js +2 -0
  211. package/dist/types/graph.js.map +1 -0
  212. package/dist/types/index.d.ts +7 -0
  213. package/dist/types/index.d.ts.map +1 -0
  214. package/dist/types/index.js +2 -0
  215. package/dist/types/index.js.map +1 -0
  216. package/dist/types/nodes.d.ts +35 -0
  217. package/dist/types/nodes.d.ts.map +1 -0
  218. package/dist/types/nodes.js +2 -0
  219. package/dist/types/nodes.js.map +1 -0
  220. package/package.json +36 -0
@@ -0,0 +1,134 @@
1
+ /**
2
+ * Prompt template functions for hierarchical LLM summarization.
3
+ *
4
+ * Each function returns a { system, user } pair suitable for passing to
5
+ * OpenAIClient.completeJSON(). All prompts request JSON output with a strict schema.
6
+ */
7
+ const MAX_CONTENT_LINES = 500;
8
+ /**
9
+ * Truncate source content to a maximum number of lines, appending a marker if truncated.
10
+ */
11
+ function truncateContent(content, maxLines = MAX_CONTENT_LINES) {
12
+ const lines = content.split("\n");
13
+ if (lines.length <= maxLines) {
14
+ return content;
15
+ }
16
+ return lines.slice(0, maxLines).join("\n") + `\n[... ${lines.length - maxLines} more lines]`;
17
+ }
18
+ export function fileSummaryPrompt(filePath, content, functionSummaries, imports, exports) {
19
+ const truncated = truncateContent(content);
20
+ const system = `You are a code analyst. Respond with JSON only.
21
+ You analyze source code files and produce structured summaries.
22
+ Your response MUST be a valid JSON object with exactly this schema:
23
+ {
24
+ "role": "<one sentence describing what this file does>",
25
+ "responsibilities": ["<responsibility 1>", "<responsibility 2>", ...],
26
+ "layer": "<one of: api, middleware, business_logic, data_access, utility, configuration, presentation, infrastructure, testing>",
27
+ "importance_score": <number 1-10>,
28
+ "tags": ["<tag1>", "<tag2>", ...]
29
+ }`;
30
+ const functionSection = functionSummaries.length > 0
31
+ ? `\nKey functions:\n${functionSummaries.map((f) => `- ${f}`).join("\n")}`
32
+ : "";
33
+ const importSection = imports.length > 0 ? `\nImports:\n${imports.map((i) => `- ${i}`).join("\n")}` : "";
34
+ const exportSection = exports.length > 0 ? `\nExports:\n${exports.map((e) => `- ${e}`).join("\n")}` : "";
35
+ const user = `Analyze this source file and produce a structured summary.
36
+
37
+ File: ${filePath}
38
+ ${importSection}
39
+ ${exportSection}
40
+ ${functionSection}
41
+
42
+ Source code:
43
+ \`\`\`
44
+ ${truncated}
45
+ \`\`\``;
46
+ return { system, user };
47
+ }
48
+ export function moduleSummaryPrompt(moduleName, fileSummaries, dependencies) {
49
+ const system = `You are a software architect. Respond with JSON only.
50
+ You analyze modules (groups of related files) and produce structured summaries.
51
+ Your response MUST be a valid JSON object with exactly this schema:
52
+ {
53
+ "purpose": "<one sentence describing the module's purpose>",
54
+ "pattern": "<architectural pattern used, e.g. MVC controller layer, service layer, utility library>",
55
+ "responsibilities": ["<responsibility 1>", "<responsibility 2>", ...],
56
+ "risks": ["<risk 1>", "<risk 2>", ...],
57
+ "layer": "<one of: api, middleware, business_logic, data_access, utility, configuration, presentation, infrastructure, testing>"
58
+ }`;
59
+ const filesSection = fileSummaries.map((f) => `- ${f.path}: ${f.role}`).join("\n");
60
+ const depsSection = dependencies.length > 0
61
+ ? `\nDependencies (modules this module imports from):\n${dependencies.map((d) => `- ${d}`).join("\n")}`
62
+ : "\nNo external module dependencies.";
63
+ const user = `Analyze this module and produce a structured summary.
64
+
65
+ Module: ${moduleName}
66
+
67
+ Files in this module:
68
+ ${filesSection}
69
+ ${depsSection}`;
70
+ return { system, user };
71
+ }
72
+ export function expeditionPrompt(question, callGraphSummary, moduleSummaries) {
73
+ const system = `You are a codebase tour guide. Respond with JSON only.
74
+ You create guided tours (expeditions) through a codebase visualized as a 3D city.
75
+ Each tour is a sequence of steps that visit specific nodes in the graph.
76
+
77
+ Your response MUST be a valid JSON object with exactly this schema:
78
+ {
79
+ "title": "<short title for the tour, max 60 chars>",
80
+ "description": "<one sentence describing the tour>",
81
+ "steps": [
82
+ {
83
+ "nodeId": "<the exact node ID to visit, e.g. mod:auth or file:src/auth/token.ts or fn:src/auth/token.ts:validateToken>",
84
+ "zoomLevel": <0 for satellite/module overview, 1 for neighborhood/file level, 2 for street/detail level, 3 for interior/function level>,
85
+ "narration": "<1-2 sentences explaining what the viewer is seeing and why it matters>",
86
+ "highlightEdges": [],
87
+ "highlightNodes": ["<additional node IDs to highlight>"],
88
+ "duration": <seconds to stay on this step, 4-10>,
89
+ "action": null
90
+ }
91
+ ]
92
+ }
93
+
94
+ IMPORTANT:
95
+ - Only use nodeIds that appear in the provided module/file/function list.
96
+ - Keep tours between 4-12 steps.
97
+ - Start with broad overview (zoomLevel 0-1) and zoom in (zoomLevel 2-3) for important details.
98
+ - Make narration conversational and insightful, not just restating the node name.`;
99
+ const modulesSection = moduleSummaries.join("\n");
100
+ const callGraphSection = callGraphSummary
101
+ ? `\nCall graph (caller -> callee):\n${callGraphSummary}`
102
+ : "\nNo call graph data available.";
103
+ const user = `Create a guided tour answering this question: "${question}"
104
+
105
+ Available modules and summaries:
106
+ ${modulesSection}
107
+ ${callGraphSection}`;
108
+ return { system, user };
109
+ }
110
+ export function systemSummaryPrompt(moduleSummaries, dependencyGraph) {
111
+ const system = `You are a software architect. Respond with JSON only.
112
+ You analyze entire codebases and produce high-level architectural summaries.
113
+ Your response MUST be a valid JSON object with exactly this schema:
114
+ {
115
+ "architecture_style": "<e.g. layered monolith, microservices, modular monolith, MVC, etc.>",
116
+ "narrative": "<2-4 sentence description of what this system does and how it is organized>",
117
+ "patterns": ["<pattern 1>", "<pattern 2>", ...],
118
+ "anti_patterns": ["<anti-pattern or risk 1>", ...],
119
+ "critical_path": ["<module name 1>", "<module name 2>", ...]
120
+ }`;
121
+ const modulesSection = moduleSummaries.map((m) => `- ${m.name}: ${m.purpose}`).join("\n");
122
+ const graphSection = dependencyGraph.length > 0
123
+ ? dependencyGraph.map((e) => ` ${e.from} -> ${e.to}`).join("\n")
124
+ : " (no inter-module dependencies)";
125
+ const user = `Analyze this codebase and produce a high-level architectural summary.
126
+
127
+ Modules:
128
+ ${modulesSection}
129
+
130
+ Module dependency graph:
131
+ ${graphSection}`;
132
+ return { system, user };
133
+ }
134
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/analysis/semantic/prompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAE9B;;GAEG;AACH,SAAS,eAAe,CAAC,OAAe,EAAE,WAAmB,iBAAiB;IAC5E,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAClC,IAAI,KAAK,CAAC,MAAM,IAAI,QAAQ,EAAE,CAAC;QAC7B,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,UAAU,KAAK,CAAC,MAAM,GAAG,QAAQ,cAAc,CAAC;AAC/F,CAAC;AAED,MAAM,UAAU,iBAAiB,C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C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;QACjE,CAAC,CAAC,kCAAkC,CAAC;IAEzC,MAAM,IAAI,GAAG;;;EAGb,cAAc;;;EAGd,YAAY,EAAE,CAAC;IAEf,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;AAC1B,CAAC"}
@@ -0,0 +1,36 @@
1
+ import type Database from "better-sqlite3";
2
+ import type { FileAnalysis, ModuleInfo, GraphEdge, ProgressEvent } from "../../types/index.js";
3
+ import { OpenAIClient } from "./openai-client.js";
4
+ export interface FileSummary {
5
+ summary: string;
6
+ explanation: string;
7
+ layer: string;
8
+ tags: string[];
9
+ }
10
+ export interface ModuleSummary {
11
+ summary: string;
12
+ explanation: string;
13
+ layer: string;
14
+ tags: string[];
15
+ }
16
+ export interface SummarizationResult {
17
+ fileSummaries: Map<string, FileSummary>;
18
+ moduleSummaries: Map<string, ModuleSummary>;
19
+ systemSummary: {
20
+ architectureStyle: string;
21
+ narrative: string;
22
+ } | null;
23
+ totalTokensUsed: number;
24
+ }
25
+ /**
26
+ * Run hierarchical LLM summarization across the analyzed codebase.
27
+ *
28
+ * Phase 1: File-level (gpt-4o-mini, batched with concurrency)
29
+ * Phase 2: Module-level (gpt-4o, sequential per module)
30
+ * Phase 3: System-level (gpt-4o, single call)
31
+ *
32
+ * Results are cached in SQLite by content hash. If a file has not changed,
33
+ * its cached summary is reused.
34
+ */
35
+ export declare function summarizeHierarchically(client: OpenAIClient, db: Database.Database, analyses: FileAnalysis[], modules: ModuleInfo[], moduleEdges: GraphEdge[], rootDir: string, onProgress?: (event: ProgressEvent) => void): Promise<SummarizationResult>;
36
+ //# sourceMappingURL=summarizer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"summarizer.d.ts","sourceRoot":"","sources":["../../../src/analysis/semantic/summarizer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC/F,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAclD,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,mBAAmB;IAClC,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACxC,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;IAC5C,aAAa,EAAE;QAAE,iBAAiB,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACvE,eAAe,EAAE,MAAM,CAAC;CACzB;AA0BD;;;;;;;;;GASG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,YAAY,EACpB,EAAE,EAAE,QAAQ,CAAC,QAAQ,EACrB,QAAQ,EAAE,YAAY,EAAE,EACxB,OAAO,EAAE,UAAU,EAAE,EACrB,WAAW,EAAE,SAAS,EAAE,EACxB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,GAC1C,OAAO,CAAC,mBAAmB,CAAC,CAgR9B"}
@@ -0,0 +1,229 @@
1
+ import { relative } from "node:path";
2
+ import { OpenAIClient } from "./openai-client.js";
3
+ import { createCacheKey, getCachedResult, setCachedResult } from "./cache.js";
4
+ import { fileSummaryPrompt, moduleSummaryPrompt, systemSummaryPrompt } from "./prompts.js";
5
+ import { logger } from "../../logger.js";
6
+ function normalizePath(p) {
7
+ return p.replace(/\\/g, "/");
8
+ }
9
+ /** Models used at each summarization level. */
10
+ const FILE_MODEL = "gpt-4o-mini";
11
+ const MODULE_MODEL = "gpt-4o";
12
+ const SYSTEM_MODEL = "gpt-4o";
13
+ /**
14
+ * Run hierarchical LLM summarization across the analyzed codebase.
15
+ *
16
+ * Phase 1: File-level (gpt-4o-mini, batched with concurrency)
17
+ * Phase 2: Module-level (gpt-4o, sequential per module)
18
+ * Phase 3: System-level (gpt-4o, single call)
19
+ *
20
+ * Results are cached in SQLite by content hash. If a file has not changed,
21
+ * its cached summary is reused.
22
+ */
23
+ export async function summarizeHierarchically(client, db, analyses, modules, moduleEdges, rootDir, onProgress) {
24
+ let totalTokensUsed = 0;
25
+ const fileSummaries = new Map();
26
+ const moduleSummaries = new Map();
27
+ let systemSummary = null;
28
+ // ── Phase 1: File-level summaries ──────────────────────────────
29
+ onProgress?.({
30
+ stage: "llm",
31
+ message: "Summarizing files...",
32
+ current: 0,
33
+ total: analyses.length,
34
+ });
35
+ const filePromises = analyses.map((analysis, index) => async () => {
36
+ const relPath = normalizePath(relative(rootDir, analysis.filePath));
37
+ const cacheKey = createCacheKey(analysis.content);
38
+ const cached = getCachedResult(db, cacheKey, "file");
39
+ if (cached) {
40
+ try {
41
+ const parsed = JSON.parse(cached);
42
+ fileSummaries.set(relPath, {
43
+ summary: parsed.role,
44
+ explanation: parsed.responsibilities.join("; "),
45
+ layer: parsed.layer,
46
+ tags: parsed.tags,
47
+ });
48
+ onProgress?.({
49
+ stage: "llm",
50
+ message: `Summarizing files... (cached: ${analysis.filePath})`,
51
+ current: index + 1,
52
+ total: analyses.length,
53
+ });
54
+ return;
55
+ }
56
+ catch {
57
+ logger.warn(`Corrupt cache entry for ${analysis.filePath}, re-summarizing`);
58
+ }
59
+ }
60
+ try {
61
+ const functionSummaries = analysis.functions.map((fn) => `${fn.name}(${fn.params.join(", ")})${fn.returnType ? `: ${fn.returnType}` : ""} — complexity: ${fn.complexity}`);
62
+ const imports = analysis.imports.map((imp) => `${imp.names.join(", ")} from "${imp.source}"`);
63
+ const exports = analysis.exports.map((exp) => `${exp.name} (${exp.kind})`);
64
+ const prompt = fileSummaryPrompt(analysis.filePath, analysis.content, functionSummaries, imports, exports);
65
+ const { result, tokensUsed } = await client.completeJSON([
66
+ { role: "system", content: prompt.system },
67
+ { role: "user", content: prompt.user },
68
+ ], FILE_MODEL);
69
+ totalTokensUsed += tokensUsed;
70
+ fileSummaries.set(relPath, {
71
+ summary: result.role,
72
+ explanation: Array.isArray(result.responsibilities)
73
+ ? result.responsibilities.join("; ")
74
+ : String(result.responsibilities ?? ""),
75
+ layer: result.layer,
76
+ tags: Array.isArray(result.tags) ? result.tags : [],
77
+ });
78
+ setCachedResult(db, cacheKey, FILE_MODEL, "file", JSON.stringify(result), tokensUsed);
79
+ }
80
+ catch (err) {
81
+ logger.warn(`Failed to summarize file ${relPath}: ${String(err)}`);
82
+ }
83
+ onProgress?.({
84
+ stage: "llm",
85
+ message: `Summarizing files...`,
86
+ current: index + 1,
87
+ total: analyses.length,
88
+ });
89
+ });
90
+ // Execute file summaries with concurrency (managed by OpenAIClient's p-limit)
91
+ await Promise.all(filePromises.map((fn) => fn()));
92
+ // ── Phase 2: Module-level summaries ────────────────────────────
93
+ onProgress?.({
94
+ stage: "llm",
95
+ message: "Summarizing modules...",
96
+ current: 0,
97
+ total: modules.length,
98
+ });
99
+ for (let i = 0; i < modules.length; i++) {
100
+ const mod = modules[i];
101
+ // Build file summaries for this module
102
+ const moduleFileSummaries = [];
103
+ for (const filePath of mod.files) {
104
+ const summary = fileSummaries.get(filePath);
105
+ if (summary) {
106
+ moduleFileSummaries.push({ path: filePath, role: summary.summary });
107
+ }
108
+ }
109
+ // Find dependencies of this module
110
+ const dependencies = moduleEdges
111
+ .filter((e) => e.sourceId === mod.id)
112
+ .map((e) => e.targetId.replace(/^mod:/, ""));
113
+ const cacheKey = createCacheKey(mod.name, ...moduleFileSummaries.map((f) => `${f.path}:${f.role}`), ...dependencies);
114
+ const cached = getCachedResult(db, cacheKey, "module");
115
+ if (cached) {
116
+ try {
117
+ const parsed = JSON.parse(cached);
118
+ moduleSummaries.set(mod.id, {
119
+ summary: parsed.purpose,
120
+ explanation: parsed.responsibilities.join("; "),
121
+ layer: parsed.layer,
122
+ tags: parsed.risks,
123
+ });
124
+ onProgress?.({
125
+ stage: "llm",
126
+ message: `Summarizing modules... (cached: ${mod.name})`,
127
+ current: i + 1,
128
+ total: modules.length,
129
+ });
130
+ continue;
131
+ }
132
+ catch {
133
+ logger.warn(`Corrupt cache entry for module ${mod.name}, re-summarizing`);
134
+ }
135
+ }
136
+ if (moduleFileSummaries.length === 0) {
137
+ onProgress?.({
138
+ stage: "llm",
139
+ message: `Summarizing modules... (skipped: ${mod.name}, no file summaries)`,
140
+ current: i + 1,
141
+ total: modules.length,
142
+ });
143
+ continue;
144
+ }
145
+ try {
146
+ const prompt = moduleSummaryPrompt(mod.name, moduleFileSummaries, dependencies);
147
+ const { result, tokensUsed } = await client.completeJSON([
148
+ { role: "system", content: prompt.system },
149
+ { role: "user", content: prompt.user },
150
+ ], MODULE_MODEL);
151
+ totalTokensUsed += tokensUsed;
152
+ moduleSummaries.set(mod.id, {
153
+ summary: result.purpose,
154
+ explanation: Array.isArray(result.responsibilities)
155
+ ? result.responsibilities.join("; ")
156
+ : String(result.responsibilities ?? ""),
157
+ layer: result.layer,
158
+ tags: Array.isArray(result.risks) ? result.risks : [],
159
+ });
160
+ setCachedResult(db, cacheKey, MODULE_MODEL, "module", JSON.stringify(result), tokensUsed);
161
+ }
162
+ catch (err) {
163
+ logger.warn(`Failed to summarize module ${mod.name}: ${String(err)}`);
164
+ }
165
+ onProgress?.({
166
+ stage: "llm",
167
+ message: `Summarizing modules...`,
168
+ current: i + 1,
169
+ total: modules.length,
170
+ });
171
+ }
172
+ // ── Phase 3: System-level summary ─────────────────────────────
173
+ onProgress?.({ stage: "llm", message: "Generating system summary..." });
174
+ const allModuleSummaries = [];
175
+ for (const mod of modules) {
176
+ const summary = moduleSummaries.get(mod.id);
177
+ if (summary) {
178
+ allModuleSummaries.push({ name: mod.name, purpose: summary.summary });
179
+ }
180
+ }
181
+ const depGraph = moduleEdges
182
+ .filter((e) => e.kind === "imports")
183
+ .map((e) => ({
184
+ from: e.sourceId.replace(/^mod:/, ""),
185
+ to: e.targetId.replace(/^mod:/, ""),
186
+ }));
187
+ if (allModuleSummaries.length > 0) {
188
+ const cacheKey = createCacheKey(...allModuleSummaries.map((m) => `${m.name}:${m.purpose}`), ...depGraph.map((e) => `${e.from}->${e.to}`));
189
+ const cached = getCachedResult(db, cacheKey, "system");
190
+ if (cached) {
191
+ try {
192
+ const parsed = JSON.parse(cached);
193
+ systemSummary = {
194
+ architectureStyle: parsed.architecture_style,
195
+ narrative: parsed.narrative,
196
+ };
197
+ }
198
+ catch {
199
+ logger.warn("Corrupt cache entry for system summary, re-summarizing");
200
+ }
201
+ }
202
+ if (!systemSummary) {
203
+ try {
204
+ const prompt = systemSummaryPrompt(allModuleSummaries, depGraph);
205
+ const { result, tokensUsed } = await client.completeJSON([
206
+ { role: "system", content: prompt.system },
207
+ { role: "user", content: prompt.user },
208
+ ], SYSTEM_MODEL);
209
+ totalTokensUsed += tokensUsed;
210
+ systemSummary = {
211
+ architectureStyle: result.architecture_style,
212
+ narrative: result.narrative,
213
+ };
214
+ setCachedResult(db, cacheKey, SYSTEM_MODEL, "system", JSON.stringify(result), tokensUsed);
215
+ }
216
+ catch (err) {
217
+ logger.warn(`Failed to generate system summary: ${String(err)}`);
218
+ }
219
+ }
220
+ }
221
+ onProgress?.({ stage: "llm", message: "LLM summarization complete." });
222
+ return {
223
+ fileSummaries,
224
+ moduleSummaries,
225
+ systemSummary,
226
+ totalTokensUsed,
227
+ };
228
+ }
229
+ //# sourceMappingURL=summarizer.js.map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,CAAC;gBAEF,eAAe,IAAI,UAAU,CAAC;gBAE9B,aAAa,GAAG;oBACd,iBAAiB,EAAE,MAAM,CAAC,kBAAkB;oBAC5C,SAAS,EAAE,MAAM,CAAC,SAAS;iBAC5B,CAAC;gBAEF,eAAe,CACb,EAAE,EACF,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,EACtB,UAAU,CACX,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,MAAM,CAAC,IAAI,CAAC,sCAAsC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YACnE,CAAC;QACH,CAAC;IACH,CAAC;IAED,UAAU,EAAE,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC,CAAC;IAEvE,OAAO;QACL,aAAa;QACb,eAAe;QACf,aAAa;QACb,eAAe;KAChB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type Parser from "web-tree-sitter";
2
+ import type { FileAnalysis } from "../types/index.js";
3
+ export declare function visitFile(content: string, tree: Parser.Tree, filePath: string): FileAnalysis;
4
+ //# sourceMappingURL=ts-js-visitor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ts-js-visitor.d.ts","sourceRoot":"","sources":["../../src/analysis/ts-js-visitor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,KAAK,EAAE,YAAY,EAA2E,MAAM,mBAAmB,CAAC;AA4Y/H,wBAAgB,SAAS,CACvB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,CAAC,IAAI,EACjB,QAAQ,EAAE,MAAM,GACf,YAAY,CAmCd"}