ts-knowledge-graph 0.1.2 → 0.1.6

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 (335) hide show
  1. package/README.md +99 -41
  2. package/contribs/webview/README.md +83 -0
  3. package/contribs/webview/web/css/style.css +310 -0
  4. package/contribs/webview/web/index.html +109 -0
  5. package/contribs/webview/web/js/app.js +1249 -0
  6. package/contribs/webview/web/js_autogenerated/.gitignore +3 -0
  7. package/contribs/webview/web/js_autogenerated/kind_descriptions.js +39 -0
  8. package/contribs/webview/web/types/app_globals.d.ts +154 -0
  9. package/dist/benchmark/benchmark_stats.d.ts +41 -0
  10. package/dist/benchmark/benchmark_stats.d.ts.map +1 -0
  11. package/dist/benchmark/benchmark_stats.js +61 -0
  12. package/dist/benchmark/benchmark_stats.js.map +1 -0
  13. package/dist/benchmark/node_benchmark.d.ts +78 -0
  14. package/dist/benchmark/node_benchmark.d.ts.map +1 -0
  15. package/dist/benchmark/node_benchmark.js +112 -0
  16. package/dist/benchmark/node_benchmark.js.map +1 -0
  17. package/dist/cli.d.ts.map +1 -1
  18. package/dist/cli.js +16 -4
  19. package/dist/cli.js.map +1 -1
  20. package/dist/cluster/cluster_weights.d.ts +20 -0
  21. package/dist/cluster/cluster_weights.d.ts.map +1 -0
  22. package/dist/cluster/cluster_weights.js +32 -0
  23. package/dist/cluster/cluster_weights.js.map +1 -0
  24. package/dist/cluster/community_detector.d.ts +61 -0
  25. package/dist/cluster/community_detector.d.ts.map +1 -0
  26. package/dist/cluster/community_detector.js +120 -0
  27. package/dist/cluster/community_detector.js.map +1 -0
  28. package/dist/cluster/community_labeler.d.ts +84 -0
  29. package/dist/cluster/community_labeler.d.ts.map +1 -0
  30. package/dist/cluster/community_labeler.js +194 -0
  31. package/dist/cluster/community_labeler.js.map +1 -0
  32. package/dist/cluster/graph_clusterer.d.ts +47 -0
  33. package/dist/cluster/graph_clusterer.d.ts.map +1 -0
  34. package/dist/cluster/graph_clusterer.js +126 -0
  35. package/dist/cluster/graph_clusterer.js.map +1 -0
  36. package/dist/commands/benchmark_command.d.ts +11 -0
  37. package/dist/commands/benchmark_command.d.ts.map +1 -0
  38. package/dist/commands/benchmark_command.js +94 -0
  39. package/dist/commands/benchmark_command.js.map +1 -0
  40. package/dist/commands/blast_radius_command.d.ts.map +1 -1
  41. package/dist/commands/blast_radius_command.js +7 -6
  42. package/dist/commands/blast_radius_command.js.map +1 -1
  43. package/dist/commands/cluster_command.d.ts +7 -0
  44. package/dist/commands/cluster_command.d.ts.map +1 -0
  45. package/dist/commands/cluster_command.js +55 -0
  46. package/dist/commands/cluster_command.js.map +1 -0
  47. package/dist/commands/command_helpers.d.ts +9 -4
  48. package/dist/commands/command_helpers.d.ts.map +1 -1
  49. package/dist/commands/command_helpers.js +13 -8
  50. package/dist/commands/command_helpers.js.map +1 -1
  51. package/dist/commands/cost_command.d.ts +13 -0
  52. package/dist/commands/cost_command.d.ts.map +1 -0
  53. package/dist/commands/cost_command.js +139 -0
  54. package/dist/commands/cost_command.js.map +1 -0
  55. package/dist/commands/{load.d.ts → enrich_command.d.ts} +3 -2
  56. package/dist/commands/enrich_command.d.ts.map +1 -0
  57. package/dist/commands/enrich_command.js +64 -0
  58. package/dist/commands/enrich_command.js.map +1 -0
  59. package/dist/commands/extract_command.d.ts.map +1 -1
  60. package/dist/commands/extract_command.js +12 -6
  61. package/dist/commands/extract_command.js.map +1 -1
  62. package/dist/commands/hotspots_command.d.ts +7 -0
  63. package/dist/commands/hotspots_command.d.ts.map +1 -0
  64. package/dist/commands/hotspots_command.js +68 -0
  65. package/dist/commands/hotspots_command.js.map +1 -0
  66. package/dist/commands/install_command.d.ts +15 -6
  67. package/dist/commands/install_command.d.ts.map +1 -1
  68. package/dist/commands/install_command.js +62 -25
  69. package/dist/commands/install_command.js.map +1 -1
  70. package/dist/commands/load_command.d.ts.map +1 -1
  71. package/dist/commands/load_command.js +20 -13
  72. package/dist/commands/load_command.js.map +1 -1
  73. package/dist/commands/neighbors_command.d.ts.map +1 -1
  74. package/dist/commands/neighbors_command.js +6 -5
  75. package/dist/commands/neighbors_command.js.map +1 -1
  76. package/dist/commands/references_command.d.ts.map +1 -1
  77. package/dist/commands/references_command.js +6 -5
  78. package/dist/commands/references_command.js.map +1 -1
  79. package/dist/commands/report_command.d.ts +16 -0
  80. package/dist/commands/report_command.d.ts.map +1 -0
  81. package/dist/commands/report_command.js +115 -0
  82. package/dist/commands/report_command.js.map +1 -0
  83. package/dist/commands/verify_command.d.ts +8 -0
  84. package/dist/commands/verify_command.d.ts.map +1 -0
  85. package/dist/commands/verify_command.js +57 -0
  86. package/dist/commands/verify_command.js.map +1 -0
  87. package/dist/commands/web_command.d.ts +27 -0
  88. package/dist/commands/web_command.d.ts.map +1 -1
  89. package/dist/commands/web_command.js +109 -3
  90. package/dist/commands/web_command.js.map +1 -1
  91. package/dist/commands/webview_command.d.ts +36 -0
  92. package/dist/commands/webview_command.d.ts.map +1 -0
  93. package/dist/commands/webview_command.js +186 -0
  94. package/dist/commands/webview_command.js.map +1 -0
  95. package/dist/enrich/cpu_profile.d.ts +160 -0
  96. package/dist/enrich/cpu_profile.d.ts.map +1 -0
  97. package/dist/enrich/cpu_profile.js +185 -0
  98. package/dist/enrich/cpu_profile.js.map +1 -0
  99. package/dist/enrich/runtime_enricher.d.ts +64 -0
  100. package/dist/enrich/runtime_enricher.d.ts.map +1 -0
  101. package/dist/enrich/runtime_enricher.js +98 -0
  102. package/dist/enrich/runtime_enricher.js.map +1 -0
  103. package/dist/enrich/runtime_join.d.ts +124 -0
  104. package/dist/enrich/runtime_join.d.ts.map +1 -0
  105. package/dist/enrich/runtime_join.js +270 -0
  106. package/dist/enrich/runtime_join.js.map +1 -0
  107. package/dist/extract/api_extractor.d.ts +24 -0
  108. package/dist/extract/api_extractor.d.ts.map +1 -0
  109. package/dist/extract/api_extractor.js +71 -0
  110. package/dist/extract/api_extractor.js.map +1 -0
  111. package/dist/extract/config_extractor.d.ts +22 -0
  112. package/dist/extract/config_extractor.d.ts.map +1 -0
  113. package/dist/extract/config_extractor.js +61 -0
  114. package/dist/extract/config_extractor.js.map +1 -0
  115. package/dist/extract/endpoint_extractor.d.ts +36 -0
  116. package/dist/extract/endpoint_extractor.d.ts.map +1 -0
  117. package/dist/extract/endpoint_extractor.js +117 -0
  118. package/dist/extract/endpoint_extractor.js.map +1 -0
  119. package/dist/extract/git_source.d.ts +23 -0
  120. package/dist/extract/git_source.d.ts.map +1 -0
  121. package/dist/extract/git_source.js +75 -0
  122. package/dist/extract/git_source.js.map +1 -0
  123. package/dist/extract/graph_builder.d.ts +8 -0
  124. package/dist/extract/graph_builder.d.ts.map +1 -1
  125. package/dist/extract/graph_builder.js +23 -1
  126. package/dist/extract/graph_builder.js.map +1 -1
  127. package/dist/extract/node_id.d.ts +16 -0
  128. package/dist/extract/node_id.d.ts.map +1 -1
  129. package/dist/extract/node_id.js +22 -0
  130. package/dist/extract/node_id.js.map +1 -1
  131. package/dist/extract/scope_resolver.d.ts +22 -0
  132. package/dist/extract/scope_resolver.d.ts.map +1 -0
  133. package/dist/extract/scope_resolver.js +53 -0
  134. package/dist/extract/scope_resolver.js.map +1 -0
  135. package/dist/extract/semantic_extractor.d.ts +25 -0
  136. package/dist/extract/semantic_extractor.d.ts.map +1 -1
  137. package/dist/extract/semantic_extractor.js +96 -2
  138. package/dist/extract/semantic_extractor.js.map +1 -1
  139. package/dist/extract/structural_extractor.d.ts +6 -0
  140. package/dist/extract/structural_extractor.d.ts.map +1 -1
  141. package/dist/extract/structural_extractor.js +22 -12
  142. package/dist/extract/structural_extractor.js.map +1 -1
  143. package/dist/project_root.d.ts +7 -0
  144. package/dist/project_root.d.ts.map +1 -0
  145. package/dist/project_root.js +9 -0
  146. package/dist/project_root.js.map +1 -0
  147. package/dist/query/graph_query.d.ts +269 -0
  148. package/dist/query/graph_query.d.ts.map +1 -1
  149. package/dist/query/graph_query.js +585 -11
  150. package/dist/query/graph_query.js.map +1 -1
  151. package/dist/report/graph_report.d.ts +51 -0
  152. package/dist/report/graph_report.d.ts.map +1 -0
  153. package/dist/report/graph_report.js +312 -0
  154. package/dist/report/graph_report.js.map +1 -0
  155. package/dist/report/pdf_renderer.d.ts +22 -0
  156. package/dist/report/pdf_renderer.d.ts.map +1 -0
  157. package/dist/report/pdf_renderer.js +54 -0
  158. package/dist/report/pdf_renderer.js.map +1 -0
  159. package/dist/report/report_data.d.ts +128 -0
  160. package/dist/report/report_data.d.ts.map +1 -0
  161. package/dist/report/report_data.js +191 -0
  162. package/dist/report/report_data.js.map +1 -0
  163. package/dist/schema/edge.d.ts +40 -5
  164. package/dist/schema/edge.d.ts.map +1 -1
  165. package/dist/schema/edge.js +73 -0
  166. package/dist/schema/edge.js.map +1 -1
  167. package/dist/schema/node.d.ts +20 -5
  168. package/dist/schema/node.d.ts.map +1 -1
  169. package/dist/schema/node.js +36 -0
  170. package/dist/schema/node.js.map +1 -1
  171. package/dist/schema/runtime_manifest.d.ts +36 -0
  172. package/dist/schema/runtime_manifest.d.ts.map +1 -0
  173. package/dist/schema/runtime_manifest.js +23 -0
  174. package/dist/schema/runtime_manifest.js.map +1 -0
  175. package/dist/schema/source_manifest.d.ts +30 -0
  176. package/dist/schema/source_manifest.d.ts.map +1 -0
  177. package/dist/schema/source_manifest.js +21 -0
  178. package/dist/schema/source_manifest.js.map +1 -0
  179. package/dist/store/jsonl_reader.d.ts +4 -0
  180. package/dist/store/jsonl_reader.d.ts.map +1 -1
  181. package/dist/store/jsonl_reader.js +13 -1
  182. package/dist/store/jsonl_reader.js.map +1 -1
  183. package/dist/store/jsonl_store.d.ts +2 -1
  184. package/dist/store/jsonl_store.d.ts.map +1 -1
  185. package/dist/store/jsonl_store.js +4 -1
  186. package/dist/store/jsonl_store.js.map +1 -1
  187. package/dist/store/kuzu_store.d.ts +59 -0
  188. package/dist/store/kuzu_store.d.ts.map +1 -1
  189. package/dist/store/kuzu_store.js +124 -5
  190. package/dist/store/kuzu_store.js.map +1 -1
  191. package/dist/store/output_folder.d.ts +43 -0
  192. package/dist/store/output_folder.d.ts.map +1 -0
  193. package/dist/store/output_folder.js +61 -0
  194. package/dist/store/output_folder.js.map +1 -0
  195. package/dist/verify/project_verifier.d.ts +85 -0
  196. package/dist/verify/project_verifier.d.ts.map +1 -0
  197. package/dist/verify/project_verifier.js +138 -0
  198. package/dist/verify/project_verifier.js.map +1 -0
  199. package/dotclaude_folder/commands/code-graph-interview.md +123 -0
  200. package/dotclaude_folder/commands/code-graph-optimize.md +65 -0
  201. package/{skills/ts-knowledge-graph → dotclaude_folder/skills/code-graph-query}/SKILL.md +6 -6
  202. package/package.json +99 -10
  203. package/.env-sample +0 -34
  204. package/contribs/web_visualisation/README.md +0 -55
  205. package/contribs/web_visualisation/web/css/style.css +0 -115
  206. package/contribs/web_visualisation/web/data/.gitignore +0 -2
  207. package/contribs/web_visualisation/web/index.html +0 -58
  208. package/contribs/web_visualisation/web/js/app.js +0 -364
  209. package/dist/agent/agent-tools.d.ts +0 -13
  210. package/dist/agent/agent-tools.d.ts.map +0 -1
  211. package/dist/agent/agent-tools.js +0 -153
  212. package/dist/agent/agent-tools.js.map +0 -1
  213. package/dist/agent/agent_tools.d.ts +0 -13
  214. package/dist/agent/agent_tools.d.ts.map +0 -1
  215. package/dist/agent/agent_tools.js +0 -153
  216. package/dist/agent/agent_tools.js.map +0 -1
  217. package/dist/agent/code-editor.d.ts +0 -18
  218. package/dist/agent/code-editor.d.ts.map +0 -1
  219. package/dist/agent/code-editor.js +0 -43
  220. package/dist/agent/code-editor.js.map +0 -1
  221. package/dist/agent/code_editor.d.ts +0 -18
  222. package/dist/agent/code_editor.d.ts.map +0 -1
  223. package/dist/agent/code_editor.js +0 -43
  224. package/dist/agent/code_editor.js.map +0 -1
  225. package/dist/agent/optimizer-agent.d.ts +0 -30
  226. package/dist/agent/optimizer-agent.d.ts.map +0 -1
  227. package/dist/agent/optimizer-agent.js +0 -97
  228. package/dist/agent/optimizer-agent.js.map +0 -1
  229. package/dist/agent/optimizer_agent.d.ts +0 -30
  230. package/dist/agent/optimizer_agent.d.ts.map +0 -1
  231. package/dist/agent/optimizer_agent.js +0 -97
  232. package/dist/agent/optimizer_agent.js.map +0 -1
  233. package/dist/agent/verifier.d.ts +0 -9
  234. package/dist/agent/verifier.d.ts.map +0 -1
  235. package/dist/agent/verifier.js +0 -19
  236. package/dist/agent/verifier.js.map +0 -1
  237. package/dist/commands/blast-radius.d.ts +0 -5
  238. package/dist/commands/blast-radius.d.ts.map +0 -1
  239. package/dist/commands/blast-radius.js +0 -18
  240. package/dist/commands/blast-radius.js.map +0 -1
  241. package/dist/commands/blast_radius.d.ts +0 -5
  242. package/dist/commands/blast_radius.d.ts.map +0 -1
  243. package/dist/commands/blast_radius.js +0 -18
  244. package/dist/commands/blast_radius.js.map +0 -1
  245. package/dist/commands/calls.d.ts +0 -5
  246. package/dist/commands/calls.d.ts.map +0 -1
  247. package/dist/commands/calls.js +0 -7
  248. package/dist/commands/calls.js.map +0 -1
  249. package/dist/commands/command-helpers.d.ts +0 -15
  250. package/dist/commands/command-helpers.d.ts.map +0 -1
  251. package/dist/commands/command-helpers.js +0 -61
  252. package/dist/commands/command-helpers.js.map +0 -1
  253. package/dist/commands/dead-exports.d.ts +0 -5
  254. package/dist/commands/dead-exports.d.ts.map +0 -1
  255. package/dist/commands/dead-exports.js +0 -7
  256. package/dist/commands/dead-exports.js.map +0 -1
  257. package/dist/commands/dead_exports.d.ts +0 -5
  258. package/dist/commands/dead_exports.d.ts.map +0 -1
  259. package/dist/commands/dead_exports.js +0 -7
  260. package/dist/commands/dead_exports.js.map +0 -1
  261. package/dist/commands/extract.d.ts +0 -8
  262. package/dist/commands/extract.d.ts.map +0 -1
  263. package/dist/commands/extract.js +0 -49
  264. package/dist/commands/extract.js.map +0 -1
  265. package/dist/commands/find.d.ts +0 -5
  266. package/dist/commands/find.d.ts.map +0 -1
  267. package/dist/commands/find.js +0 -7
  268. package/dist/commands/find.js.map +0 -1
  269. package/dist/commands/load.d.ts.map +0 -1
  270. package/dist/commands/load.js +0 -28
  271. package/dist/commands/load.js.map +0 -1
  272. package/dist/commands/neighbors.d.ts +0 -5
  273. package/dist/commands/neighbors.d.ts.map +0 -1
  274. package/dist/commands/neighbors.js +0 -17
  275. package/dist/commands/neighbors.js.map +0 -1
  276. package/dist/commands/optimize.d.ts +0 -6
  277. package/dist/commands/optimize.d.ts.map +0 -1
  278. package/dist/commands/optimize.js +0 -59
  279. package/dist/commands/optimize.js.map +0 -1
  280. package/dist/commands/optimize_command.d.ts +0 -6
  281. package/dist/commands/optimize_command.d.ts.map +0 -1
  282. package/dist/commands/optimize_command.js +0 -59
  283. package/dist/commands/optimize_command.js.map +0 -1
  284. package/dist/commands/references.d.ts +0 -5
  285. package/dist/commands/references.d.ts.map +0 -1
  286. package/dist/commands/references.js +0 -17
  287. package/dist/commands/references.js.map +0 -1
  288. package/dist/commands/web.d.ts +0 -19
  289. package/dist/commands/web.d.ts.map +0 -1
  290. package/dist/commands/web.js +0 -120
  291. package/dist/commands/web.js.map +0 -1
  292. package/dist/commands/who-calls.d.ts +0 -5
  293. package/dist/commands/who-calls.d.ts.map +0 -1
  294. package/dist/commands/who-calls.js +0 -7
  295. package/dist/commands/who-calls.js.map +0 -1
  296. package/dist/commands/who_calls.d.ts +0 -5
  297. package/dist/commands/who_calls.d.ts.map +0 -1
  298. package/dist/commands/who_calls.js +0 -7
  299. package/dist/commands/who_calls.js.map +0 -1
  300. package/dist/extract/graph-builder.d.ts +0 -16
  301. package/dist/extract/graph-builder.d.ts.map +0 -1
  302. package/dist/extract/graph-builder.js +0 -39
  303. package/dist/extract/graph-builder.js.map +0 -1
  304. package/dist/extract/node-id.d.ts +0 -8
  305. package/dist/extract/node-id.d.ts.map +0 -1
  306. package/dist/extract/node-id.js +0 -22
  307. package/dist/extract/node-id.js.map +0 -1
  308. package/dist/extract/project-loader.d.ts +0 -5
  309. package/dist/extract/project-loader.d.ts.map +0 -1
  310. package/dist/extract/project-loader.js +0 -19
  311. package/dist/extract/project-loader.js.map +0 -1
  312. package/dist/extract/semantic-extractor.d.ts +0 -22
  313. package/dist/extract/semantic-extractor.d.ts.map +0 -1
  314. package/dist/extract/semantic-extractor.js +0 -254
  315. package/dist/extract/semantic-extractor.js.map +0 -1
  316. package/dist/extract/structural-extractor.d.ts +0 -18
  317. package/dist/extract/structural-extractor.d.ts.map +0 -1
  318. package/dist/extract/structural-extractor.js +0 -97
  319. package/dist/extract/structural-extractor.js.map +0 -1
  320. package/dist/query/graph-query.d.ts +0 -28
  321. package/dist/query/graph-query.d.ts.map +0 -1
  322. package/dist/query/graph-query.js +0 -93
  323. package/dist/query/graph-query.js.map +0 -1
  324. package/dist/store/jsonl-reader.d.ts +0 -11
  325. package/dist/store/jsonl-reader.d.ts.map +0 -1
  326. package/dist/store/jsonl-reader.js +0 -19
  327. package/dist/store/jsonl-reader.js.map +0 -1
  328. package/dist/store/jsonl-store.d.ts +0 -7
  329. package/dist/store/jsonl-store.d.ts.map +0 -1
  330. package/dist/store/jsonl-store.js +0 -13
  331. package/dist/store/jsonl-store.js.map +0 -1
  332. package/dist/store/kuzu-store.d.ts +0 -14
  333. package/dist/store/kuzu-store.d.ts.map +0 -1
  334. package/dist/store/kuzu-store.js +0 -52
  335. package/dist/store/kuzu-store.js.map +0 -1
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The `GraphMeta` key under which the runtime ingest manifest is stored. It lives
4
+ * at the graph level — one record for the whole graph — rather than on a node,
5
+ * which is why it does not collide with the per-node `metadata.runtime`.
6
+ */
7
+ export declare const RUNTIME_MANIFEST_KEY = "runtime";
8
+ /**
9
+ * Graph-level coverage facts recorded by `enrich`: how much of the profiled cost
10
+ * was attributed to graph nodes versus dropped by the join. Persisted so a later
11
+ * query — `cost` in particular — can report **coverage** (the fraction of total
12
+ * measured cost the attribution actually accounts for) instead of silently
13
+ * presenting a partial picture. `total*` are profile-wide; `matched*` are the part
14
+ * attached to nodes; the difference is what the join dropped.
15
+ */
16
+ export declare const RuntimeManifestSchema: z.ZodObject<{
17
+ source: z.ZodString;
18
+ totalSamples: z.ZodNumber;
19
+ matchedSamples: z.ZodNumber;
20
+ totalSelfMicros: z.ZodNumber;
21
+ matchedSelfMicros: z.ZodNumber;
22
+ }, "strip", z.ZodTypeAny, {
23
+ source: string;
24
+ totalSamples: number;
25
+ matchedSamples: number;
26
+ totalSelfMicros: number;
27
+ matchedSelfMicros: number;
28
+ }, {
29
+ source: string;
30
+ totalSamples: number;
31
+ matchedSamples: number;
32
+ totalSelfMicros: number;
33
+ matchedSelfMicros: number;
34
+ }>;
35
+ export type RuntimeManifest = z.infer<typeof RuntimeManifestSchema>;
36
+ //# sourceMappingURL=runtime_manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime_manifest.d.ts","sourceRoot":"","sources":["../../src/schema/runtime_manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAE9C;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAMhC,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -0,0 +1,23 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The `GraphMeta` key under which the runtime ingest manifest is stored. It lives
4
+ * at the graph level — one record for the whole graph — rather than on a node,
5
+ * which is why it does not collide with the per-node `metadata.runtime`.
6
+ */
7
+ export const RUNTIME_MANIFEST_KEY = 'runtime';
8
+ /**
9
+ * Graph-level coverage facts recorded by `enrich`: how much of the profiled cost
10
+ * was attributed to graph nodes versus dropped by the join. Persisted so a later
11
+ * query — `cost` in particular — can report **coverage** (the fraction of total
12
+ * measured cost the attribution actually accounts for) instead of silently
13
+ * presenting a partial picture. `total*` are profile-wide; `matched*` are the part
14
+ * attached to nodes; the difference is what the join dropped.
15
+ */
16
+ export const RuntimeManifestSchema = z.object({
17
+ source: z.string(),
18
+ totalSamples: z.number(),
19
+ matchedSamples: z.number(),
20
+ totalSelfMicros: z.number(),
21
+ matchedSelfMicros: z.number(),
22
+ });
23
+ //# sourceMappingURL=runtime_manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime_manifest.js","sourceRoot":"","sources":["../../src/schema/runtime_manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,SAAS,CAAC;AAE9C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;IAC3B,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE;CAC7B,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The `GraphMeta` key under which the source-repository manifest is stored. Like
4
+ * {@link RUNTIME_MANIFEST_KEY}, it is a graph-level record — one per graph — and
5
+ * is written by `load` from the provenance `extract` captured at parse time.
6
+ */
7
+ export declare const SOURCE_MANIFEST_KEY = "source";
8
+ /**
9
+ * Git provenance of the analysed project, captured by `extract` at the exact
10
+ * commit and root it parsed so the `web` visualisation can turn each file path
11
+ * into a GitHub permalink. `prefix` is the analysed root's path within the
12
+ * repository — `''` at the repo root, otherwise `sub/dir/` with a trailing
13
+ * slash — and is prepended to each node's root-relative `filePath` to form the
14
+ * repository-relative path.
15
+ */
16
+ export declare const SourceManifestSchema: z.ZodObject<{
17
+ baseUrl: z.ZodString;
18
+ commit: z.ZodString;
19
+ prefix: z.ZodString;
20
+ }, "strip", z.ZodTypeAny, {
21
+ baseUrl: string;
22
+ commit: string;
23
+ prefix: string;
24
+ }, {
25
+ baseUrl: string;
26
+ commit: string;
27
+ prefix: string;
28
+ }>;
29
+ export type SourceManifest = z.infer<typeof SourceManifestSchema>;
30
+ //# sourceMappingURL=source_manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source_manifest.d.ts","sourceRoot":"","sources":["../../src/schema/source_manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAE5C;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;EAI/B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ /**
3
+ * The `GraphMeta` key under which the source-repository manifest is stored. Like
4
+ * {@link RUNTIME_MANIFEST_KEY}, it is a graph-level record — one per graph — and
5
+ * is written by `load` from the provenance `extract` captured at parse time.
6
+ */
7
+ export const SOURCE_MANIFEST_KEY = 'source';
8
+ /**
9
+ * Git provenance of the analysed project, captured by `extract` at the exact
10
+ * commit and root it parsed so the `web` visualisation can turn each file path
11
+ * into a GitHub permalink. `prefix` is the analysed root's path within the
12
+ * repository — `''` at the repo root, otherwise `sub/dir/` with a trailing
13
+ * slash — and is prepended to each node's root-relative `filePath` to form the
14
+ * repository-relative path.
15
+ */
16
+ export const SourceManifestSchema = z.object({
17
+ baseUrl: z.string(),
18
+ commit: z.string(),
19
+ prefix: z.string(),
20
+ });
21
+ //# sourceMappingURL=source_manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source_manifest.js","sourceRoot":"","sources":["../../src/schema/source_manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,QAAQ,CAAC;AAE5C;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC"}
@@ -1,11 +1,15 @@
1
1
  import { GraphEdge } from '../schema/edge.js';
2
2
  import { GraphNode } from '../schema/node.js';
3
+ import { SourceManifest } from '../schema/source_manifest.js';
3
4
  export type GraphData = {
4
5
  nodes: GraphNode[];
5
6
  edges: GraphEdge[];
7
+ source?: SourceManifest;
6
8
  };
7
9
  export declare class JsonlReader {
8
10
  static read(dir: string): Promise<GraphData>;
11
+ /** Reads the optional `source.json` provenance manifest; an absent or malformed file yields `undefined`. */
12
+ private static readSource;
9
13
  private static readLines;
10
14
  }
11
15
  //# sourceMappingURL=jsonl_reader.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl_reader.d.ts","sourceRoot":"","sources":["../../src/store/jsonl_reader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAE/D,MAAM,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,EAAE,CAAC;CACnB,CAAC;AAEF,qBAAa,WAAW;WACV,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;mBAM7B,SAAS;CAO9B"}
1
+ {"version":3,"file":"jsonl_reader.d.ts","sourceRoot":"","sources":["../../src/store/jsonl_reader.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,SAAS,EAAmB,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAwB,MAAM,8BAA8B,CAAC;AAEpF,MAAM,MAAM,SAAS,GAAG;IACvB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,cAAc,CAAC;CACxB,CAAC;AAEF,qBAAa,WAAW;WACV,IAAI,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC;IAOlD,4GAA4G;mBACvF,UAAU;mBASV,SAAS;CAO9B"}
@@ -2,11 +2,23 @@ import { readFile } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { GraphEdgeSchema } from '../schema/edge.js';
4
4
  import { GraphNodeSchema } from '../schema/node.js';
5
+ import { SourceManifestSchema } from '../schema/source_manifest.js';
5
6
  export class JsonlReader {
6
7
  static async read(dir) {
7
8
  const nodes = await JsonlReader.readLines(join(dir, 'nodes.jsonl'), GraphNodeSchema);
8
9
  const edges = await JsonlReader.readLines(join(dir, 'edges.jsonl'), GraphEdgeSchema);
9
- return { nodes, edges };
10
+ const source = await JsonlReader.readSource(join(dir, 'source.json'));
11
+ return { nodes, edges, source };
12
+ }
13
+ /** Reads the optional `source.json` provenance manifest; an absent or malformed file yields `undefined`. */
14
+ static async readSource(path) {
15
+ try {
16
+ const parsed = SourceManifestSchema.safeParse(JSON.parse(await readFile(path, 'utf8')));
17
+ return parsed.success === true ? parsed.data : undefined;
18
+ }
19
+ catch {
20
+ return undefined;
21
+ }
10
22
  }
11
23
  static async readLines(path, schema) {
12
24
  const content = await readFile(path, 'utf8');
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl_reader.js","sourceRoot":"","sources":["../../src/store/jsonl_reader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,E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I,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACD"}
@@ -1,7 +1,8 @@
1
1
  import { GraphEdge } from '../schema/edge.js';
2
2
  import { GraphNode } from '../schema/node.js';
3
+ import { SourceManifest } from '../schema/source_manifest.js';
3
4
  export declare class JsonlStore {
4
- static write(outDir: string, nodes: GraphNode[], edges: GraphEdge[]): Promise<void>;
5
+ static write(outDir: string, nodes: GraphNode[], edges: GraphEdge[], source?: SourceManifest): Promise<void>;
5
6
  private static serialize;
6
7
  }
7
8
  //# sourceMappingURL=jsonl_store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl_store.d.ts","sourceRoot":"","sources":["../../src/store/jsonl_store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,qBAAa,UAAU;WACT,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAMzF,OAAO,CAAC,MAAM,CAAC,SAAS;CAGxB"}
1
+ {"version":3,"file":"jsonl_store.d.ts","sourceRoot":"","sources":["../../src/store/jsonl_store.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,qBAAa,UAAU;WACT,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IASlH,OAAO,CAAC,MAAM,CAAC,SAAS;CAGxB"}
@@ -1,10 +1,13 @@
1
1
  import { mkdir, writeFile } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  export class JsonlStore {
4
- static async write(outDir, nodes, edges) {
4
+ static async write(outDir, nodes, edges, source) {
5
5
  await mkdir(outDir, { recursive: true });
6
6
  await writeFile(join(outDir, 'nodes.jsonl'), JsonlStore.serialize(nodes), 'utf8');
7
7
  await writeFile(join(outDir, 'edges.jsonl'), JsonlStore.serialize(edges), 'utf8');
8
+ if (source !== undefined) {
9
+ await writeFile(join(outDir, 'source.json'), JSON.stringify(source) + '\n', 'utf8');
10
+ }
8
11
  }
9
12
  static serialize(rows) {
10
13
  return rows.map((row) => JSON.stringify(row)).join('\n') + '\n';
@@ -1 +1 @@
1
- {"version":3,"file":"jsonl_store.js","sourceRoot":"","sources":["../../src/store/jsonl_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,OAAO,UAAU;IACtB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,KAAkB,EAAE,KAAkB;QACxE,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;QAClF,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;IACnF,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,IAAe;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjE,CAAC;CACD"}
1
+ {"version":3,"file":"jsonl_store.js","sourceRoot":"","sources":["../../src/store/jsonl_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAKjC,MAAM,OAAO,UAAU;IACtB,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,KAAkB,EAAE,KAAkB,EAAE,MAAuB;QACjG,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;QAClF,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;QAClF,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,MAAM,SAAS,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG,IAAI,EAAE,MAAM,CAAC,CAAC;QACrF,CAAC;IACF,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,IAAe;QACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACjE,CAAC;CACD"}
@@ -1,12 +1,71 @@
1
1
  import type { KuzuValue } from 'kuzu';
2
2
  import { GraphEdge } from '../schema/edge.js';
3
3
  import { GraphNode } from '../schema/node.js';
4
+ /** A stored node read back from Kùzu, with its metadata decoded to a record. */
5
+ export type StoredNode = {
6
+ id: string;
7
+ kind: string;
8
+ name: string;
9
+ filePath: string;
10
+ startLine: number;
11
+ endLine: number;
12
+ metadata: Record<string, unknown>;
13
+ };
4
14
  export declare class KuzuStore {
5
15
  private readonly db;
6
16
  private readonly conn;
7
17
  constructor(dbPath: string);
8
18
  initSchema(): Promise<void>;
9
19
  load(nodes: GraphNode[], edges: GraphEdge[]): Promise<void>;
20
+ /**
21
+ * Inserts or updates edges by (`from`, `to`, `kind`) — the same merge `load`
22
+ * uses for its edge pass — onto an already-loaded graph; both endpoint nodes
23
+ * must already exist. Used by `enrich` to attach the runtime call graph after
24
+ * the static graph is loaded.
25
+ */
26
+ writeEdges(edges: GraphEdge[]): Promise<void>;
27
+ /**
28
+ * Removes every edge of a given kind. Used by `enrich` to clear the prior
29
+ * runtime call graph before writing a fresh one, so a re-run never leaves stale
30
+ * edges behind.
31
+ */
32
+ clearEdgesByKind(kind: string): Promise<void>;
33
+ /**
34
+ * Reads every node back from the store, decoding the `metadata` column. Used
35
+ * by enrichment to resolve profile frames against the loaded graph's ranges
36
+ * and to merge new metadata onto existing records.
37
+ */
38
+ readNodes(): Promise<StoredNode[]>;
39
+ /**
40
+ * Overwrites the `metadata` column for the given nodes. The caller is
41
+ * responsible for merging so that only the intended keys change; passing the
42
+ * full record keeps the write idempotent for unchanged keys.
43
+ */
44
+ writeNodeMetadata(entries: {
45
+ id: string;
46
+ metadata: Record<string, unknown>;
47
+ }[]): Promise<void>;
48
+ /**
49
+ * Writes a graph-level metadata record under `key` (a `GraphMeta` row), encoding
50
+ * the value as JSON. Used for facts about the whole graph rather than one node —
51
+ * e.g. the runtime ingest manifest `enrich` records for coverage reporting.
52
+ */
53
+ writeGraphMeta(key: string, value: Record<string, unknown>): Promise<void>;
54
+ /** Reads the graph-level metadata record stored under `key`, decoded, or null when absent. */
55
+ readGraphMeta(key: string): Promise<Record<string, unknown> | null>;
56
+ /** Removes the graph-level metadata record stored under `key`, if any. */
57
+ clearGraphMeta(key: string): Promise<void>;
58
+ /**
59
+ * Serializes an optional metadata record to a JSON string for storage in the
60
+ * `metadata` column. Absent metadata is stored as an empty object so the
61
+ * column is never null.
62
+ */
63
+ private static encodeMetadata;
64
+ /**
65
+ * Decodes the JSON `metadata` column back into a record. A missing, empty, or
66
+ * malformed value decodes to an empty object so callers always receive a record.
67
+ */
68
+ private static decodeMetadata;
10
69
  run(cypher: string, params?: Record<string, KuzuValue>): Promise<Record<string, KuzuValue>[]>;
11
70
  close(): Promise<void>;
12
71
  private static first;
@@ -1 +1 @@
1
- {"version":3,"file":"kuzu_store.d.ts","sourceRoot":"","sources":["../../src/store/kuzu_store.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AACtC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAO9C,qBAAa,SAAS;IACrB,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAW;IAC9B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;gBAEtB,MAAM,EAAE,MAAM;IAMpB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAuB3D,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;IAW7F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,OAAO,CAAC,MAAM,CAAC,KAAK;IAIpB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;CAK3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,CAAC;IAapG;;;;OAIG;IACG,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhF,8FAA8F;IACxF,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;IAQzE,0EAA0E;IACpE,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKhD;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAI7B;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAevB,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,CAAC;IAW7F,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAK5B,OAAO,CAAC,MAAM,CAAC,KAAK;IAIpB;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,YAAY;CAK3B"}
@@ -2,8 +2,9 @@ import { mkdirSync } from 'node:fs';
2
2
  import { dirname } from 'node:path';
3
3
  import { Connection, Database } from 'kuzu';
4
4
  const SCHEMA = [
5
- 'CREATE NODE TABLE IF NOT EXISTS GraphNode (id STRING, kind STRING, name STRING, filePath STRING, exported BOOLEAN, startLine INT64, endLine INT64, PRIMARY KEY (id))',
6
- 'CREATE REL TABLE IF NOT EXISTS Edge (FROM GraphNode TO GraphNode, kind STRING)',
5
+ 'CREATE NODE TABLE IF NOT EXISTS GraphNode (id STRING, kind STRING, name STRING, filePath STRING, exported BOOLEAN, startLine INT64, endLine INT64, metadata STRING, PRIMARY KEY (id))',
6
+ 'CREATE REL TABLE IF NOT EXISTS Edge (FROM GraphNode TO GraphNode, kind STRING, metadata STRING)',
7
+ 'CREATE NODE TABLE IF NOT EXISTS GraphMeta (key STRING, value STRING, PRIMARY KEY (key))',
7
8
  ];
8
9
  export class KuzuStore {
9
10
  constructor(dbPath) {
@@ -17,7 +18,7 @@ export class KuzuStore {
17
18
  }
18
19
  }
19
20
  async load(nodes, edges) {
20
- const nodeStmt = await this.conn.prepare('MERGE (n:GraphNode {id: $id}) SET n.kind = $kind, n.name = $name, n.filePath = $filePath, n.exported = $exported, n.startLine = $startLine, n.endLine = $endLine');
21
+ const nodeStmt = await this.conn.prepare('MERGE (n:GraphNode {id: $id}) SET n.kind = $kind, n.name = $name, n.filePath = $filePath, n.exported = $exported, n.startLine = $startLine, n.endLine = $endLine, n.metadata = $metadata');
21
22
  for (const node of nodes) {
22
23
  KuzuStore.closeResults(await this.conn.execute(nodeStmt, {
23
24
  id: node.id,
@@ -27,11 +28,129 @@ export class KuzuStore {
27
28
  exported: node.exported ?? false,
28
29
  startLine: node.range?.startLine ?? 0,
29
30
  endLine: node.range?.endLine ?? 0,
31
+ metadata: KuzuStore.encodeMetadata(node.metadata),
30
32
  }));
31
33
  }
32
- const edgeStmt = await this.conn.prepare('MATCH (f:GraphNode {id: $from}), (t:GraphNode {id: $to}) MERGE (f)-[:Edge {kind: $kind}]->(t)');
34
+ const edgeStmt = await this.conn.prepare('MATCH (f:GraphNode {id: $from}), (t:GraphNode {id: $to}) MERGE (f)-[e:Edge {kind: $kind}]->(t) SET e.metadata = $metadata');
33
35
  for (const edge of edges) {
34
- KuzuStore.closeResults(await this.conn.execute(edgeStmt, { from: edge.from, to: edge.to, kind: edge.kind }));
36
+ KuzuStore.closeResults(await this.conn.execute(edgeStmt, {
37
+ from: edge.from,
38
+ to: edge.to,
39
+ kind: edge.kind,
40
+ metadata: KuzuStore.encodeMetadata(edge.metadata),
41
+ }));
42
+ }
43
+ }
44
+ /**
45
+ * Inserts or updates edges by (`from`, `to`, `kind`) — the same merge `load`
46
+ * uses for its edge pass — onto an already-loaded graph; both endpoint nodes
47
+ * must already exist. Used by `enrich` to attach the runtime call graph after
48
+ * the static graph is loaded.
49
+ */
50
+ async writeEdges(edges) {
51
+ if (edges.length === 0) {
52
+ return;
53
+ }
54
+ const stmt = await this.conn.prepare('MATCH (f:GraphNode {id: $from}), (t:GraphNode {id: $to}) MERGE (f)-[e:Edge {kind: $kind}]->(t) SET e.metadata = $metadata');
55
+ for (const edge of edges) {
56
+ KuzuStore.closeResults(await this.conn.execute(stmt, {
57
+ from: edge.from,
58
+ to: edge.to,
59
+ kind: edge.kind,
60
+ metadata: KuzuStore.encodeMetadata(edge.metadata),
61
+ }));
62
+ }
63
+ }
64
+ /**
65
+ * Removes every edge of a given kind. Used by `enrich` to clear the prior
66
+ * runtime call graph before writing a fresh one, so a re-run never leaves stale
67
+ * edges behind.
68
+ */
69
+ async clearEdgesByKind(kind) {
70
+ const stmt = await this.conn.prepare('MATCH (:GraphNode)-[e:Edge {kind: $kind}]->(:GraphNode) DELETE e');
71
+ KuzuStore.closeResults(await this.conn.execute(stmt, { kind }));
72
+ }
73
+ /**
74
+ * Reads every node back from the store, decoding the `metadata` column. Used
75
+ * by enrichment to resolve profile frames against the loaded graph's ranges
76
+ * and to merge new metadata onto existing records.
77
+ */
78
+ async readNodes() {
79
+ const rows = await this.run('MATCH (n:GraphNode) RETURN n.id AS id, n.kind AS kind, n.name AS name, n.filePath AS filePath, n.startLine AS startLine, n.endLine AS endLine, n.metadata AS metadata');
80
+ return rows.map((row) => ({
81
+ id: String(row.id),
82
+ kind: String(row.kind),
83
+ name: String(row.name),
84
+ filePath: String(row.filePath),
85
+ startLine: Number(row.startLine),
86
+ endLine: Number(row.endLine),
87
+ metadata: KuzuStore.decodeMetadata(row.metadata),
88
+ }));
89
+ }
90
+ /**
91
+ * Overwrites the `metadata` column for the given nodes. The caller is
92
+ * responsible for merging so that only the intended keys change; passing the
93
+ * full record keeps the write idempotent for unchanged keys.
94
+ */
95
+ async writeNodeMetadata(entries) {
96
+ if (entries.length === 0) {
97
+ return;
98
+ }
99
+ const stmt = await this.conn.prepare('MATCH (n:GraphNode {id: $id}) SET n.metadata = $metadata');
100
+ for (const entry of entries) {
101
+ KuzuStore.closeResults(await this.conn.execute(stmt, {
102
+ id: entry.id,
103
+ metadata: KuzuStore.encodeMetadata(entry.metadata),
104
+ }));
105
+ }
106
+ }
107
+ /**
108
+ * Writes a graph-level metadata record under `key` (a `GraphMeta` row), encoding
109
+ * the value as JSON. Used for facts about the whole graph rather than one node —
110
+ * e.g. the runtime ingest manifest `enrich` records for coverage reporting.
111
+ */
112
+ async writeGraphMeta(key, value) {
113
+ const stmt = await this.conn.prepare('MERGE (m:GraphMeta {key: $key}) SET m.value = $value');
114
+ KuzuStore.closeResults(await this.conn.execute(stmt, { key, value: KuzuStore.encodeMetadata(value) }));
115
+ }
116
+ /** Reads the graph-level metadata record stored under `key`, decoded, or null when absent. */
117
+ async readGraphMeta(key) {
118
+ const rows = await this.run('MATCH (m:GraphMeta {key: $key}) RETURN m.value AS value', { key });
119
+ if (rows.length === 0) {
120
+ return null;
121
+ }
122
+ return KuzuStore.decodeMetadata(rows[0].value);
123
+ }
124
+ /** Removes the graph-level metadata record stored under `key`, if any. */
125
+ async clearGraphMeta(key) {
126
+ const stmt = await this.conn.prepare('MATCH (m:GraphMeta {key: $key}) DELETE m');
127
+ KuzuStore.closeResults(await this.conn.execute(stmt, { key }));
128
+ }
129
+ /**
130
+ * Serializes an optional metadata record to a JSON string for storage in the
131
+ * `metadata` column. Absent metadata is stored as an empty object so the
132
+ * column is never null.
133
+ */
134
+ static encodeMetadata(metadata) {
135
+ return JSON.stringify(metadata ?? {});
136
+ }
137
+ /**
138
+ * Decodes the JSON `metadata` column back into a record. A missing, empty, or
139
+ * malformed value decodes to an empty object so callers always receive a record.
140
+ */
141
+ static decodeMetadata(value) {
142
+ if (typeof value !== 'string' || value.length === 0) {
143
+ return {};
144
+ }
145
+ try {
146
+ const parsed = JSON.parse(value);
147
+ if (typeof parsed === 'object' && parsed !== null) {
148
+ return parsed;
149
+ }
150
+ return {};
151
+ }
152
+ catch {
153
+ return {};
35
154
  }
36
155
  }
37
156
  async run(cypher, params) {
@@ -1 +1 @@
1
- {"version":3,"file":"kuzu_store.js","sourceRoot":"","sources":["../../src/store/kuzu_store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAe,MAAM,MAAM,CAAC;AAKzD,MAAM,MAAM,GAAG;IACd,sKAAsK;IACtK,gFAAgF;CAChF,CAAC;AAEF,MAAM,OAAO,SAAS;IAIrB,YAAY,MAAc;QACzB,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAChD,IAAI,CAAC,EAAE,GAAG,IAAI,QAAQ,CAAC,MAAM,CAAC,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,UAAU;QACf,KAAK,MAAM,SAAS,IAAI,MAAM,EAAE,CAAC;YAChC,SAAS,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC1D,CAAC;IACF,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,KAAkB,EAAE,KAAkB;QAChD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CACvC,kKAAkK,CAClK,CAAC;QACF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YAC1B,SAAS,CAAC,YAAY,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE;gBACxD,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,IAAI,EAAE,IAAI,CAAC,IAAI;gBAC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M,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC;QACpE,IAAI,CAAC;YACJ,OAAO,MAAM,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC;QAC/C,CAAC;gBAAS,CAAC;YACV,SAAS,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAChC,CAAC;IACF,CAAC;IAED,KAAK,CAAC,KAAK;QACV,MAAM,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;QACxB,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,MAAmC;QACvD,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IACnD,CAAC;IAED;;;;OAIG;IACK,MAAM,CAAC,YAAY,CAAC,MAAmC;QAC9D,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9D,IAAI,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;IACF,CAAC;CACD"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * The single source of truth for the output-folder layout. Every artifact a CLI
3
+ * command reads or writes under the output folder is derived from one root, so
4
+ * callers pass `--output-folder` and never an individual file path:
5
+ *
6
+ * <root>/graph/ nodes.jsonl, edges.jsonl, source.json (JsonlStore / JsonlReader)
7
+ * <root>/graph.kuzu embedded Kùzu database (KuzuStore)
8
+ * <root>/prof/ V8 .cpuprofile files (profile_and_enrich.sh)
9
+ * <root>/bench/ <target>.baseline.json benchmark baselines
10
+ *
11
+ * The directory segment names live only here. The store classes own the JSONL
12
+ * filenames (a format concern), and both `KuzuStore` and `JsonlStore` create
13
+ * their own parent directories, so this type never touches the filesystem.
14
+ */
15
+ export declare class OutputFolder {
16
+ private readonly root;
17
+ constructor(root: string);
18
+ /** The output folder root itself (absolute). */
19
+ get path(): string;
20
+ /** Directory holding nodes.jsonl, edges.jsonl, and source.json. */
21
+ get graphDir(): string;
22
+ /** Embedded Kùzu database path. */
23
+ get dbPath(): string;
24
+ /** Directory for V8 .cpuprofile files. */
25
+ get profDir(): string;
26
+ /** Directory for benchmark baselines. */
27
+ get benchDir(): string;
28
+ /** Baseline file for one benchmark target, e.g. `<root>/bench/titleCase.baseline.json`. */
29
+ baselinePath(target: string): string;
30
+ /**
31
+ * Path of the generated codebase brief for a given file extension (`md`, `pdf`,
32
+ * or `json`). Like {@link OutputFolder.dbPath}, the basename lives only here so
33
+ * every output path stays derived from the one root.
34
+ */
35
+ reportPath(extension: string): string;
36
+ /**
37
+ * Make a benchmark target name safe as a filename. Targets are symbol names
38
+ * (e.g. `titleCase`) but could contain path-like characters; collapse anything
39
+ * outside [A-Za-z0-9._-] to '_' so the baseline path stays inside benchDir.
40
+ */
41
+ private static sanitizeTarget;
42
+ }
43
+ //# sourceMappingURL=output_folder.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output_folder.d.ts","sourceRoot":"","sources":["../../src/store/output_folder.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;GAaG;AACH,qBAAa,YAAY;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAElB,IAAI,EAAE,MAAM;IAIxB,gDAAgD;IAChD,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,mEAAmE;IACnE,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,mCAAmC;IACnC,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,0CAA0C;IAC1C,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,yCAAyC;IACzC,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED,2FAA2F;IAC3F,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAIpC;;;;OAIG;IACH,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM;IAIrC;;;;OAIG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;CAG7B"}
@@ -0,0 +1,61 @@
1
+ import { join, resolve } from 'node:path';
2
+ /**
3
+ * The single source of truth for the output-folder layout. Every artifact a CLI
4
+ * command reads or writes under the output folder is derived from one root, so
5
+ * callers pass `--output-folder` and never an individual file path:
6
+ *
7
+ * <root>/graph/ nodes.jsonl, edges.jsonl, source.json (JsonlStore / JsonlReader)
8
+ * <root>/graph.kuzu embedded Kùzu database (KuzuStore)
9
+ * <root>/prof/ V8 .cpuprofile files (profile_and_enrich.sh)
10
+ * <root>/bench/ <target>.baseline.json benchmark baselines
11
+ *
12
+ * The directory segment names live only here. The store classes own the JSONL
13
+ * filenames (a format concern), and both `KuzuStore` and `JsonlStore` create
14
+ * their own parent directories, so this type never touches the filesystem.
15
+ */
16
+ export class OutputFolder {
17
+ constructor(root) {
18
+ this.root = resolve(root);
19
+ }
20
+ /** The output folder root itself (absolute). */
21
+ get path() {
22
+ return this.root;
23
+ }
24
+ /** Directory holding nodes.jsonl, edges.jsonl, and source.json. */
25
+ get graphDir() {
26
+ return join(this.root, 'graph');
27
+ }
28
+ /** Embedded Kùzu database path. */
29
+ get dbPath() {
30
+ return join(this.root, 'graph.kuzu');
31
+ }
32
+ /** Directory for V8 .cpuprofile files. */
33
+ get profDir() {
34
+ return join(this.root, 'prof');
35
+ }
36
+ /** Directory for benchmark baselines. */
37
+ get benchDir() {
38
+ return join(this.root, 'bench');
39
+ }
40
+ /** Baseline file for one benchmark target, e.g. `<root>/bench/titleCase.baseline.json`. */
41
+ baselinePath(target) {
42
+ return join(this.benchDir, `${OutputFolder.sanitizeTarget(target)}.baseline.json`);
43
+ }
44
+ /**
45
+ * Path of the generated codebase brief for a given file extension (`md`, `pdf`,
46
+ * or `json`). Like {@link OutputFolder.dbPath}, the basename lives only here so
47
+ * every output path stays derived from the one root.
48
+ */
49
+ reportPath(extension) {
50
+ return join(this.root, `CODEBASE_BRIEF.${extension}`);
51
+ }
52
+ /**
53
+ * Make a benchmark target name safe as a filename. Targets are symbol names
54
+ * (e.g. `titleCase`) but could contain path-like characters; collapse anything
55
+ * outside [A-Za-z0-9._-] to '_' so the baseline path stays inside benchDir.
56
+ */
57
+ static sanitizeTarget(target) {
58
+ return target.replace(/[^A-Za-z0-9._-]+/g, '_');
59
+ }
60
+ }
61
+ //# sourceMappingURL=output_folder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output_folder.js","sourceRoot":"","sources":["../../src/store/output_folder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,YAAY;IAGxB,YAAY,IAAY;QACvB,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3B,CAAC;IAED,gDAAgD;IAChD,IAAI,IAAI;QACP,OAAO,IAAI,CAAC,IAAI,CAAC;IAClB,CAAC;IAED,mEAAmE;IACnE,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,mCAAmC;IACnC,IAAI,MAAM;QACT,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IACtC,CAAC;IAED,0CAA0C;IAC1C,IAAI,OAAO;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAChC,CAAC;IAED,yCAAyC;IACzC,IAAI,QAAQ;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,2FAA2F;IAC3F,YAAY,CAAC,MAAc;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,YAAY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