ts-knowledge-graph 0.1.1 → 0.1.4

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 (212) hide show
  1. package/README.md +104 -43
  2. package/contribs/web_visualisation/README.md +83 -0
  3. package/contribs/web_visualisation/web/css/style.css +219 -0
  4. package/contribs/web_visualisation/web/data/.gitignore +3 -0
  5. package/contribs/web_visualisation/web/data/kind_descriptions.js +38 -0
  6. package/contribs/web_visualisation/web/index.html +74 -0
  7. package/contribs/web_visualisation/web/js/app.js +910 -0
  8. package/contribs/web_visualisation/web/tsconfig.json +18 -0
  9. package/contribs/web_visualisation/web/types/app_globals.d.ts +146 -0
  10. package/dist/benchmark/benchmark_stats.d.ts +41 -0
  11. package/dist/benchmark/benchmark_stats.d.ts.map +1 -0
  12. package/dist/benchmark/benchmark_stats.js +61 -0
  13. package/dist/benchmark/benchmark_stats.js.map +1 -0
  14. package/dist/benchmark/node_benchmark.d.ts +78 -0
  15. package/dist/benchmark/node_benchmark.d.ts.map +1 -0
  16. package/dist/benchmark/node_benchmark.js +112 -0
  17. package/dist/benchmark/node_benchmark.js.map +1 -0
  18. package/dist/cli.d.ts +0 -9
  19. package/dist/cli.d.ts.map +1 -1
  20. package/dist/cli.js +32 -208
  21. package/dist/cli.js.map +1 -1
  22. package/dist/commands/benchmark_command.d.ts +11 -0
  23. package/dist/commands/benchmark_command.d.ts.map +1 -0
  24. package/dist/commands/benchmark_command.js +91 -0
  25. package/dist/commands/benchmark_command.js.map +1 -0
  26. package/dist/commands/blast_radius_command.d.ts +5 -0
  27. package/dist/commands/blast_radius_command.d.ts.map +1 -0
  28. package/dist/commands/blast_radius_command.js +18 -0
  29. package/dist/commands/blast_radius_command.js.map +1 -0
  30. package/dist/commands/calls_command.d.ts +5 -0
  31. package/dist/commands/calls_command.d.ts.map +1 -0
  32. package/dist/commands/calls_command.js +7 -0
  33. package/dist/commands/calls_command.js.map +1 -0
  34. package/dist/commands/command_helpers.d.ts +15 -0
  35. package/dist/commands/command_helpers.d.ts.map +1 -0
  36. package/dist/commands/command_helpers.js +61 -0
  37. package/dist/commands/command_helpers.js.map +1 -0
  38. package/dist/commands/cost_command.d.ts +13 -0
  39. package/dist/commands/cost_command.d.ts.map +1 -0
  40. package/dist/commands/cost_command.js +122 -0
  41. package/dist/commands/cost_command.js.map +1 -0
  42. package/dist/commands/dead_exports_command.d.ts +5 -0
  43. package/dist/commands/dead_exports_command.d.ts.map +1 -0
  44. package/dist/commands/dead_exports_command.js +7 -0
  45. package/dist/commands/dead_exports_command.js.map +1 -0
  46. package/dist/commands/enrich_command.d.ts +7 -0
  47. package/dist/commands/enrich_command.d.ts.map +1 -0
  48. package/dist/commands/enrich_command.js +62 -0
  49. package/dist/commands/enrich_command.js.map +1 -0
  50. package/dist/commands/extract_command.d.ts +8 -0
  51. package/dist/commands/extract_command.d.ts.map +1 -0
  52. package/dist/commands/extract_command.js +49 -0
  53. package/dist/commands/extract_command.js.map +1 -0
  54. package/dist/commands/find_command.d.ts +5 -0
  55. package/dist/commands/find_command.d.ts.map +1 -0
  56. package/dist/commands/find_command.js +7 -0
  57. package/dist/commands/find_command.js.map +1 -0
  58. package/dist/commands/hotspots_command.d.ts +7 -0
  59. package/dist/commands/hotspots_command.d.ts.map +1 -0
  60. package/dist/commands/hotspots_command.js +67 -0
  61. package/dist/commands/hotspots_command.js.map +1 -0
  62. package/dist/commands/install_command.d.ts +15 -0
  63. package/dist/commands/install_command.d.ts.map +1 -0
  64. package/dist/commands/install_command.js +41 -0
  65. package/dist/commands/install_command.js.map +1 -0
  66. package/dist/commands/load_command.d.ts +6 -0
  67. package/dist/commands/load_command.d.ts.map +1 -0
  68. package/dist/commands/load_command.js +30 -0
  69. package/dist/commands/load_command.js.map +1 -0
  70. package/dist/commands/neighbors_command.d.ts +5 -0
  71. package/dist/commands/neighbors_command.d.ts.map +1 -0
  72. package/dist/commands/neighbors_command.js +17 -0
  73. package/dist/commands/neighbors_command.js.map +1 -0
  74. package/dist/commands/references_command.d.ts +5 -0
  75. package/dist/commands/references_command.d.ts.map +1 -0
  76. package/dist/commands/references_command.js +17 -0
  77. package/dist/commands/references_command.js.map +1 -0
  78. package/dist/commands/verify_command.d.ts +8 -0
  79. package/dist/commands/verify_command.d.ts.map +1 -0
  80. package/dist/commands/verify_command.js +57 -0
  81. package/dist/commands/verify_command.js.map +1 -0
  82. package/dist/commands/web_command.d.ts +46 -0
  83. package/dist/commands/web_command.d.ts.map +1 -0
  84. package/dist/commands/web_command.js +226 -0
  85. package/dist/commands/web_command.js.map +1 -0
  86. package/dist/commands/who_calls_command.d.ts +5 -0
  87. package/dist/commands/who_calls_command.d.ts.map +1 -0
  88. package/dist/commands/who_calls_command.js +7 -0
  89. package/dist/commands/who_calls_command.js.map +1 -0
  90. package/dist/enrich/cpu_profile.d.ts +127 -0
  91. package/dist/enrich/cpu_profile.d.ts.map +1 -0
  92. package/dist/enrich/cpu_profile.js +97 -0
  93. package/dist/enrich/cpu_profile.js.map +1 -0
  94. package/dist/enrich/runtime_enricher.d.ts +56 -0
  95. package/dist/enrich/runtime_enricher.d.ts.map +1 -0
  96. package/dist/enrich/runtime_enricher.js +80 -0
  97. package/dist/enrich/runtime_enricher.js.map +1 -0
  98. package/dist/enrich/runtime_join.d.ts +100 -0
  99. package/dist/enrich/runtime_join.d.ts.map +1 -0
  100. package/dist/enrich/runtime_join.js +227 -0
  101. package/dist/enrich/runtime_join.js.map +1 -0
  102. package/dist/extract/api_extractor.d.ts +24 -0
  103. package/dist/extract/api_extractor.d.ts.map +1 -0
  104. package/dist/extract/api_extractor.js +71 -0
  105. package/dist/extract/api_extractor.js.map +1 -0
  106. package/dist/extract/config_extractor.d.ts +22 -0
  107. package/dist/extract/config_extractor.d.ts.map +1 -0
  108. package/dist/extract/config_extractor.js +61 -0
  109. package/dist/extract/config_extractor.js.map +1 -0
  110. package/dist/extract/endpoint_extractor.d.ts +36 -0
  111. package/dist/extract/endpoint_extractor.d.ts.map +1 -0
  112. package/dist/extract/endpoint_extractor.js +117 -0
  113. package/dist/extract/endpoint_extractor.js.map +1 -0
  114. package/dist/extract/{graph-builder.d.ts → graph_builder.d.ts} +9 -1
  115. package/dist/extract/graph_builder.d.ts.map +1 -0
  116. package/dist/extract/graph_builder.js +61 -0
  117. package/dist/extract/graph_builder.js.map +1 -0
  118. package/dist/extract/node_id.d.ts +24 -0
  119. package/dist/extract/node_id.d.ts.map +1 -0
  120. package/dist/extract/node_id.js +44 -0
  121. package/dist/extract/node_id.js.map +1 -0
  122. package/dist/extract/{project-loader.d.ts → project_loader.d.ts} +1 -1
  123. package/dist/extract/project_loader.d.ts.map +1 -0
  124. package/dist/extract/{project-loader.js → project_loader.js} +1 -1
  125. package/dist/extract/{project-loader.js.map → project_loader.js.map} +1 -1
  126. package/dist/extract/scope_resolver.d.ts +22 -0
  127. package/dist/extract/scope_resolver.d.ts.map +1 -0
  128. package/dist/extract/scope_resolver.js +53 -0
  129. package/dist/extract/scope_resolver.js.map +1 -0
  130. package/dist/extract/semantic_extractor.d.ts +47 -0
  131. package/dist/extract/semantic_extractor.d.ts.map +1 -0
  132. package/dist/extract/{semantic-extractor.js → semantic_extractor.js} +98 -4
  133. package/dist/extract/semantic_extractor.js.map +1 -0
  134. package/dist/extract/{structural-extractor.d.ts → structural_extractor.d.ts} +7 -1
  135. package/dist/extract/{structural-extractor.d.ts.map → structural_extractor.d.ts.map} +1 -1
  136. package/dist/extract/{structural-extractor.js → structural_extractor.js} +24 -14
  137. package/dist/extract/structural_extractor.js.map +1 -0
  138. package/dist/project_root.d.ts +7 -0
  139. package/dist/project_root.d.ts.map +1 -0
  140. package/dist/project_root.js +9 -0
  141. package/dist/project_root.js.map +1 -0
  142. package/dist/query/graph_query.d.ts +262 -0
  143. package/dist/query/graph_query.d.ts.map +1 -0
  144. package/dist/query/graph_query.js +604 -0
  145. package/dist/query/graph_query.js.map +1 -0
  146. package/dist/schema/edge.d.ts +40 -5
  147. package/dist/schema/edge.d.ts.map +1 -1
  148. package/dist/schema/edge.js +70 -0
  149. package/dist/schema/edge.js.map +1 -1
  150. package/dist/schema/node.d.ts +20 -5
  151. package/dist/schema/node.d.ts.map +1 -1
  152. package/dist/schema/node.js +36 -0
  153. package/dist/schema/node.js.map +1 -1
  154. package/dist/schema/runtime_manifest.d.ts +36 -0
  155. package/dist/schema/runtime_manifest.d.ts.map +1 -0
  156. package/dist/schema/runtime_manifest.js +23 -0
  157. package/dist/schema/runtime_manifest.js.map +1 -0
  158. package/dist/store/{jsonl-reader.d.ts → jsonl_reader.d.ts} +1 -1
  159. package/dist/store/{jsonl-reader.d.ts.map → jsonl_reader.d.ts.map} +1 -1
  160. package/dist/store/{jsonl-reader.js → jsonl_reader.js} +1 -1
  161. package/dist/store/{jsonl-reader.js.map → jsonl_reader.js.map} +1 -1
  162. package/dist/store/{jsonl-store.d.ts → jsonl_store.d.ts} +1 -1
  163. package/dist/store/{jsonl-store.d.ts.map → jsonl_store.d.ts.map} +1 -1
  164. package/dist/store/{jsonl-store.js → jsonl_store.js} +1 -1
  165. package/dist/store/{jsonl-store.js.map → jsonl_store.js.map} +1 -1
  166. package/dist/store/kuzu_store.d.ts +66 -0
  167. package/dist/store/kuzu_store.d.ts.map +1 -0
  168. package/dist/store/kuzu_store.js +156 -0
  169. package/dist/store/kuzu_store.js.map +1 -0
  170. package/dist/verify/project_verifier.d.ts +85 -0
  171. package/dist/verify/project_verifier.d.ts.map +1 -0
  172. package/dist/verify/project_verifier.js +138 -0
  173. package/dist/verify/project_verifier.js.map +1 -0
  174. package/dotclaude_folder/skills/code-graph-query/SKILL.md +91 -0
  175. package/package.json +88 -5
  176. package/.env-sample +0 -34
  177. package/dist/agent/agent-tools.d.ts +0 -13
  178. package/dist/agent/agent-tools.d.ts.map +0 -1
  179. package/dist/agent/agent-tools.js +0 -153
  180. package/dist/agent/agent-tools.js.map +0 -1
  181. package/dist/agent/code-editor.d.ts +0 -18
  182. package/dist/agent/code-editor.d.ts.map +0 -1
  183. package/dist/agent/code-editor.js +0 -43
  184. package/dist/agent/code-editor.js.map +0 -1
  185. package/dist/agent/optimizer-agent.d.ts +0 -30
  186. package/dist/agent/optimizer-agent.d.ts.map +0 -1
  187. package/dist/agent/optimizer-agent.js +0 -97
  188. package/dist/agent/optimizer-agent.js.map +0 -1
  189. package/dist/agent/verifier.d.ts +0 -9
  190. package/dist/agent/verifier.d.ts.map +0 -1
  191. package/dist/agent/verifier.js +0 -19
  192. package/dist/agent/verifier.js.map +0 -1
  193. package/dist/extract/graph-builder.d.ts.map +0 -1
  194. package/dist/extract/graph-builder.js +0 -39
  195. package/dist/extract/graph-builder.js.map +0 -1
  196. package/dist/extract/node-id.d.ts +0 -8
  197. package/dist/extract/node-id.d.ts.map +0 -1
  198. package/dist/extract/node-id.js +0 -22
  199. package/dist/extract/node-id.js.map +0 -1
  200. package/dist/extract/project-loader.d.ts.map +0 -1
  201. package/dist/extract/semantic-extractor.d.ts +0 -22
  202. package/dist/extract/semantic-extractor.d.ts.map +0 -1
  203. package/dist/extract/semantic-extractor.js.map +0 -1
  204. package/dist/extract/structural-extractor.js.map +0 -1
  205. package/dist/query/graph-query.d.ts +0 -28
  206. package/dist/query/graph-query.d.ts.map +0 -1
  207. package/dist/query/graph-query.js +0 -93
  208. package/dist/query/graph-query.js.map +0 -1
  209. package/dist/store/kuzu-store.d.ts +0 -14
  210. package/dist/store/kuzu-store.d.ts.map +0 -1
  211. package/dist/store/kuzu-store.js +0 -52
  212. package/dist/store/kuzu-store.js.map +0 -1
@@ -1,22 +1,57 @@
1
1
  import { z } from 'zod';
2
- export declare const EDGE_KINDS: readonly ["CONTAINS", "IMPORTS", "EXPORTS", "EXTENDS", "IMPLEMENTS", "USES_TYPE", "RETURNS", "PARAM_TYPE", "CALLS", "INSTANTIATES", "OVERRIDES", "READS", "WRITES"];
3
- export declare const EdgeKindSchema: z.ZodEnum<["CONTAINS", "IMPORTS", "EXPORTS", "EXTENDS", "IMPLEMENTS", "USES_TYPE", "RETURNS", "PARAM_TYPE", "CALLS", "INSTANTIATES", "OVERRIDES", "READS", "WRITES"]>;
2
+ /**
3
+ * The closed edge vocabulary, grouped by layer (mirrors the README graph-model
4
+ * table).
5
+ *
6
+ * Decision (#31 Part 0): keep a closed `z.enum` rather than an extensible kind
7
+ * registry — simple and explicit. Kùzu stores `kind` as a `STRING`, so a new kind
8
+ * needs no schema migration; its only real costs are this enum, the extractor that
9
+ * emits it, and — for edges — whether it joins {@link REFERENCE_EDGE_KINDS}.
10
+ */
11
+ export declare const EDGE_KINDS: readonly ["CONTAINS", "IMPORTS", "EXPORTS", "EXTENDS", "IMPLEMENTS", "USES_TYPE", "RETURNS", "PARAM_TYPE", "CALLS", "INSTANTIATES", "OVERRIDES", "READS", "WRITES", "READS_CONFIG", "CALLS_EXTERNAL", "HANDLES"];
12
+ export declare const EdgeKindSchema: z.ZodEnum<["CONTAINS", "IMPORTS", "EXPORTS", "EXTENDS", "IMPLEMENTS", "USES_TYPE", "RETURNS", "PARAM_TYPE", "CALLS", "INSTANTIATES", "OVERRIDES", "READS", "WRITES", "READS_CONFIG", "CALLS_EXTERNAL", "HANDLES"]>;
4
13
  export type EdgeKind = z.infer<typeof EdgeKindSchema>;
14
+ /**
15
+ * One-line, onboarding-oriented descriptions for every {@link EdgeKind}, keyed by
16
+ * kind. This is the single source of truth surfaced as hover tooltips in the web
17
+ * visualisation; the `Record<EdgeKind, string>` type makes adding an edge kind
18
+ * without describing it a compile error.
19
+ */
20
+ export declare const EDGE_KIND_DESCRIPTIONS: Record<EdgeKind, string>;
21
+ /**
22
+ * The edge kinds that count as a *reference* to their target — the single source
23
+ * of truth for {@link GraphQuery.references} and the {@link GraphQuery.deadExports}
24
+ * liveness check (the query layer derives its Cypher list from this array).
25
+ *
26
+ * An edge kind is a reference when its presence means the target symbol is *used*:
27
+ * a call, a heritage link, a type mention, an instantiation, a value read, a method
28
+ * override (an override uses the base member it replaces), or an endpoint→handler
29
+ * link (`HANDLES` — a route uses the function that handles it). Deliberately
30
+ * excluded:
31
+ * - `CONTAINS` / `IMPORTS` — containment and module wiring, not use;
32
+ * - `EXPORTS` — marks a symbol as exported; counting it would give every export an
33
+ * inbound edge from its module and defeat dead-export detection;
34
+ * - `WRITES` — mutating a binding is not using its value;
35
+ * - `READS_CONFIG` / `CALLS_EXTERNAL` — their targets are synthesized system-level
36
+ * nodes (a `ConfigFlag`, an `ExternalAPI`), not code symbols subject to
37
+ * dead-export analysis.
38
+ */
39
+ export declare const REFERENCE_EDGE_KINDS: readonly ["CALLS", "EXTENDS", "IMPLEMENTS", "USES_TYPE", "RETURNS", "PARAM_TYPE", "INSTANTIATES", "READS", "OVERRIDES", "HANDLES"];
5
40
  export declare const GraphEdgeSchema: z.ZodObject<{
6
41
  id: z.ZodString;
7
- kind: z.ZodEnum<["CONTAINS", "IMPORTS", "EXPORTS", "EXTENDS", "IMPLEMENTS", "USES_TYPE", "RETURNS", "PARAM_TYPE", "CALLS", "INSTANTIATES", "OVERRIDES", "READS", "WRITES"]>;
42
+ kind: z.ZodEnum<["CONTAINS", "IMPORTS", "EXPORTS", "EXTENDS", "IMPLEMENTS", "USES_TYPE", "RETURNS", "PARAM_TYPE", "CALLS", "INSTANTIATES", "OVERRIDES", "READS", "WRITES", "READS_CONFIG", "CALLS_EXTERNAL", "HANDLES"]>;
8
43
  from: z.ZodString;
9
44
  to: z.ZodString;
10
45
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
11
46
  }, "strip", z.ZodTypeAny, {
12
47
  id: string;
13
- kind: "CONTAINS" | "IMPORTS" | "EXPORTS" | "EXTENDS" | "IMPLEMENTS" | "USES_TYPE" | "RETURNS" | "PARAM_TYPE" | "CALLS" | "INSTANTIATES" | "OVERRIDES" | "READS" | "WRITES";
48
+ kind: "CONTAINS" | "IMPORTS" | "EXPORTS" | "EXTENDS" | "IMPLEMENTS" | "USES_TYPE" | "RETURNS" | "PARAM_TYPE" | "CALLS" | "INSTANTIATES" | "OVERRIDES" | "READS" | "WRITES" | "READS_CONFIG" | "CALLS_EXTERNAL" | "HANDLES";
14
49
  from: string;
15
50
  to: string;
16
51
  metadata?: Record<string, unknown> | undefined;
17
52
  }, {
18
53
  id: string;
19
- kind: "CONTAINS" | "IMPORTS" | "EXPORTS" | "EXTENDS" | "IMPLEMENTS" | "USES_TYPE" | "RETURNS" | "PARAM_TYPE" | "CALLS" | "INSTANTIATES" | "OVERRIDES" | "READS" | "WRITES";
54
+ kind: "CONTAINS" | "IMPORTS" | "EXPORTS" | "EXTENDS" | "IMPLEMENTS" | "USES_TYPE" | "RETURNS" | "PARAM_TYPE" | "CALLS" | "INSTANTIATES" | "OVERRIDES" | "READS" | "WRITES" | "READS_CONFIG" | "CALLS_EXTERNAL" | "HANDLES";
20
55
  from: string;
21
56
  to: string;
22
57
  metadata?: Record<string, unknown> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/schema/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU,qKAcb,CAAC;AAEX,eAAO,MAAM,cAAc,uKAAqB,CAAC;AACjD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAM1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"edge.d.ts","sourceRoot":"","sources":["../../src/schema/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,kNAqBb,CAAC;AAEX,eAAO,MAAM,cAAc,oNAAqB,CAAC;AACjD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAiB3D,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,oBAAoB,oIAWO,CAAC;AAEzC,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;EAM1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -1,20 +1,90 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * The closed edge vocabulary, grouped by layer (mirrors the README graph-model
4
+ * table).
5
+ *
6
+ * Decision (#31 Part 0): keep a closed `z.enum` rather than an extensible kind
7
+ * registry — simple and explicit. Kùzu stores `kind` as a `STRING`, so a new kind
8
+ * needs no schema migration; its only real costs are this enum, the extractor that
9
+ * emits it, and — for edges — whether it joins {@link REFERENCE_EDGE_KINDS}.
10
+ */
2
11
  export const EDGE_KINDS = [
12
+ // Structural — cheap, always emitted (no symbol resolution).
3
13
  'CONTAINS',
4
14
  'IMPORTS',
5
15
  'EXPORTS',
16
+ // Type — require symbol resolution, emitted with `--semantic`.
6
17
  'EXTENDS',
7
18
  'IMPLEMENTS',
8
19
  'USES_TYPE',
9
20
  'RETURNS',
10
21
  'PARAM_TYPE',
22
+ // Behavioral — require symbol resolution, emitted with `--semantic`.
11
23
  'CALLS',
12
24
  'INSTANTIATES',
13
25
  'OVERRIDES',
14
26
  'READS',
15
27
  'WRITES',
28
+ // System-level — detection-gated entities (#31 Part 2+).
29
+ 'READS_CONFIG',
30
+ 'CALLS_EXTERNAL',
31
+ 'HANDLES',
16
32
  ];
17
33
  export const EdgeKindSchema = z.enum(EDGE_KINDS);
34
+ /**
35
+ * One-line, onboarding-oriented descriptions for every {@link EdgeKind}, keyed by
36
+ * kind. This is the single source of truth surfaced as hover tooltips in the web
37
+ * visualisation; the `Record<EdgeKind, string>` type makes adding an edge kind
38
+ * without describing it a compile error.
39
+ */
40
+ export const EDGE_KIND_DESCRIPTIONS = {
41
+ CONTAINS: 'Structural nesting: the source declares or encloses the target (a module contains a class, which contains a method).',
42
+ IMPORTS: 'The source module imports the target.',
43
+ EXPORTS: 'The source module exports the target symbol.',
44
+ EXTENDS: 'The source class or interface extends the target (inheritance).',
45
+ IMPLEMENTS: 'The source class implements the target interface.',
46
+ USES_TYPE: 'The source references the target in a type position.',
47
+ RETURNS: 'The target type appears in the source function or method return type.',
48
+ PARAM_TYPE: 'The target type appears in one of the source parameter types.',
49
+ CALLS: 'The source function or method calls the target.',
50
+ INSTANTIATES: 'The source constructs the target class with new.',
51
+ OVERRIDES: 'The source method overrides the base-class member it replaces.',
52
+ READS: 'The source reads the value of the target variable or property.',
53
+ WRITES: 'The source assigns to the target variable or property.',
54
+ READS_CONFIG: 'The source reads the target configuration flag (an environment variable).',
55
+ CALLS_EXTERNAL: 'The source makes an outbound HTTP call to the target external API.',
56
+ HANDLES: 'Links an HTTP endpoint to the function that handles it (route to handler).',
57
+ };
58
+ /**
59
+ * The edge kinds that count as a *reference* to their target — the single source
60
+ * of truth for {@link GraphQuery.references} and the {@link GraphQuery.deadExports}
61
+ * liveness check (the query layer derives its Cypher list from this array).
62
+ *
63
+ * An edge kind is a reference when its presence means the target symbol is *used*:
64
+ * a call, a heritage link, a type mention, an instantiation, a value read, a method
65
+ * override (an override uses the base member it replaces), or an endpoint→handler
66
+ * link (`HANDLES` — a route uses the function that handles it). Deliberately
67
+ * excluded:
68
+ * - `CONTAINS` / `IMPORTS` — containment and module wiring, not use;
69
+ * - `EXPORTS` — marks a symbol as exported; counting it would give every export an
70
+ * inbound edge from its module and defeat dead-export detection;
71
+ * - `WRITES` — mutating a binding is not using its value;
72
+ * - `READS_CONFIG` / `CALLS_EXTERNAL` — their targets are synthesized system-level
73
+ * nodes (a `ConfigFlag`, an `ExternalAPI`), not code symbols subject to
74
+ * dead-export analysis.
75
+ */
76
+ export const REFERENCE_EDGE_KINDS = [
77
+ 'CALLS',
78
+ 'EXTENDS',
79
+ 'IMPLEMENTS',
80
+ 'USES_TYPE',
81
+ 'RETURNS',
82
+ 'PARAM_TYPE',
83
+ 'INSTANTIATES',
84
+ 'READS',
85
+ 'OVERRIDES',
86
+ 'HANDLES',
87
+ ];
18
88
  export const GraphEdgeSchema = z.object({
19
89
  id: z.string(),
20
90
  kind: EdgeKindSchema,
@@ -1 +1 @@
1
- {"version":3,"file":"edge.js","sourceRoot":"","sources":["../../src/schema/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,UAAU;IACV,SAAS;IACT,SAAS;IACT,SAAS;IACT,YAAY;IACZ,WAAW;IACX,SAAS;IACT,YAAY;IACZ,OAAO;IACP,cAAc;IACd,WAAW;IACX,OAAO;IACP,QAAQ;CACC,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAGjD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC"}
1
+ {"version":3,"file":"edge.js","sourceRoot":"","sources":["../../src/schema/edge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,6DAA6D;IAC7D,UAAU;IACV,SAAS;IACT,SAAS;IACT,+DAA+D;IAC/D,SA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AC,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC"}
@@ -1,7 +1,22 @@
1
1
  import { z } from 'zod';
2
- export declare const NODE_KINDS: readonly ["Module", "Class", "Interface", "TypeAlias", "Enum", "Function", "Method", "Property", "Parameter", "Variable", "ExternalModule"];
3
- export declare const NodeKindSchema: z.ZodEnum<["Module", "Class", "Interface", "TypeAlias", "Enum", "Function", "Method", "Property", "Parameter", "Variable", "ExternalModule"]>;
2
+ /**
3
+ * The closed node vocabulary. See {@link EDGE_KINDS} in `edge.ts` for the
4
+ * closed-enum-vs-registry decision (#31 Part 0); the same reasoning applies here.
5
+ *
6
+ * The system-level group grows one detection-gated extractor at a time (#31).
7
+ * `ConfigFlag` (environment variables) is the first; `Endpoint`, `DatabaseTable`,
8
+ * `QueueTopic`, and `ExternalAPI` arrive in later slices.
9
+ */
10
+ export declare const NODE_KINDS: readonly ["Module", "Class", "Interface", "TypeAlias", "Enum", "Function", "Method", "Property", "Parameter", "Variable", "ExternalModule", "ConfigFlag", "ExternalAPI", "Endpoint"];
11
+ export declare const NodeKindSchema: z.ZodEnum<["Module", "Class", "Interface", "TypeAlias", "Enum", "Function", "Method", "Property", "Parameter", "Variable", "ExternalModule", "ConfigFlag", "ExternalAPI", "Endpoint"]>;
4
12
  export type NodeKind = z.infer<typeof NodeKindSchema>;
13
+ /**
14
+ * One-line, onboarding-oriented descriptions for every {@link NodeKind}, keyed by
15
+ * kind. This is the single source of truth surfaced as hover tooltips in the web
16
+ * visualisation; the `Record<NodeKind, string>` type makes adding a node kind
17
+ * without describing it a compile error.
18
+ */
19
+ export declare const NODE_KIND_DESCRIPTIONS: Record<NodeKind, string>;
5
20
  export declare const RangeSchema: z.ZodObject<{
6
21
  startLine: z.ZodNumber;
7
22
  startColumn: z.ZodNumber;
@@ -21,7 +36,7 @@ export declare const RangeSchema: z.ZodObject<{
21
36
  export type Range = z.infer<typeof RangeSchema>;
22
37
  export declare const GraphNodeSchema: z.ZodObject<{
23
38
  id: z.ZodString;
24
- kind: z.ZodEnum<["Module", "Class", "Interface", "TypeAlias", "Enum", "Function", "Method", "Property", "Parameter", "Variable", "ExternalModule"]>;
39
+ kind: z.ZodEnum<["Module", "Class", "Interface", "TypeAlias", "Enum", "Function", "Method", "Property", "Parameter", "Variable", "ExternalModule", "ConfigFlag", "ExternalAPI", "Endpoint"]>;
25
40
  name: z.ZodString;
26
41
  filePath: z.ZodString;
27
42
  range: z.ZodOptional<z.ZodObject<{
@@ -44,7 +59,7 @@ export declare const GraphNodeSchema: z.ZodObject<{
44
59
  metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
45
60
  }, "strip", z.ZodTypeAny, {
46
61
  id: string;
47
- kind: "Module" | "Class" | "Interface" | "TypeAlias" | "Enum" | "Function" | "Method" | "Property" | "Parameter" | "Variable" | "ExternalModule";
62
+ kind: "Module" | "Class" | "Interface" | "TypeAlias" | "Enum" | "Function" | "Method" | "Property" | "Parameter" | "Variable" | "ExternalModule" | "ConfigFlag" | "ExternalAPI" | "Endpoint";
48
63
  name: string;
49
64
  filePath: string;
50
65
  metadata?: Record<string, unknown> | undefined;
@@ -57,7 +72,7 @@ export declare const GraphNodeSchema: z.ZodObject<{
57
72
  exported?: boolean | undefined;
58
73
  }, {
59
74
  id: string;
60
- kind: "Module" | "Class" | "Interface" | "TypeAlias" | "Enum" | "Function" | "Method" | "Property" | "Parameter" | "Variable" | "ExternalModule";
75
+ kind: "Module" | "Class" | "Interface" | "TypeAlias" | "Enum" | "Function" | "Method" | "Property" | "Parameter" | "Variable" | "ExternalModule" | "ConfigFlag" | "ExternalAPI" | "Endpoint";
61
76
  name: string;
62
77
  filePath: string;
63
78
  metadata?: Record<string, unknown> | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/schema/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,UAAU,6IAYb,CAAC;AAEX,eAAO,MAAM,cAAc,+IAAqB,CAAC;AACjD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAKtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../../src/schema/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,sLAkBb,CAAC;AAEX,eAAO,MAAM,cAAc,wLAAqB,CAAC;AACjD,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAEtD;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAe3D,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;EAKtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEhD,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC"}
@@ -1,5 +1,14 @@
1
1
  import { z } from 'zod';
2
+ /**
3
+ * The closed node vocabulary. See {@link EDGE_KINDS} in `edge.ts` for the
4
+ * closed-enum-vs-registry decision (#31 Part 0); the same reasoning applies here.
5
+ *
6
+ * The system-level group grows one detection-gated extractor at a time (#31).
7
+ * `ConfigFlag` (environment variables) is the first; `Endpoint`, `DatabaseTable`,
8
+ * `QueueTopic`, and `ExternalAPI` arrive in later slices.
9
+ */
2
10
  export const NODE_KINDS = [
11
+ // Code structure.
3
12
  'Module',
4
13
  'Class',
5
14
  'Interface',
@@ -10,9 +19,36 @@ export const NODE_KINDS = [
10
19
  'Property',
11
20
  'Parameter',
12
21
  'Variable',
22
+ // External dependencies, as one opaque node per import specifier.
13
23
  'ExternalModule',
24
+ // System-level entities — detection-gated (#31 Part 2+).
25
+ 'ConfigFlag',
26
+ 'ExternalAPI',
27
+ 'Endpoint',
14
28
  ];
15
29
  export const NodeKindSchema = z.enum(NODE_KINDS);
30
+ /**
31
+ * One-line, onboarding-oriented descriptions for every {@link NodeKind}, keyed by
32
+ * kind. This is the single source of truth surfaced as hover tooltips in the web
33
+ * visualisation; the `Record<NodeKind, string>` type makes adding a node kind
34
+ * without describing it a compile error.
35
+ */
36
+ export const NODE_KIND_DESCRIPTIONS = {
37
+ Module: 'A source file in the codebase.',
38
+ Class: 'A class declaration.',
39
+ Interface: 'An interface declaration.',
40
+ TypeAlias: 'A type alias declaration.',
41
+ Enum: 'An enum declaration.',
42
+ Function: 'A standalone, module-level function.',
43
+ Method: 'A function that belongs to a class or interface.',
44
+ Property: 'A field declared on a class or interface.',
45
+ Parameter: 'A parameter of a function or method.',
46
+ Variable: 'A module- or block-level variable binding.',
47
+ ExternalModule: 'An imported third-party or Node.js module, recorded as one opaque node per import specifier.',
48
+ ConfigFlag: 'An environment-variable configuration flag, detected from process.env reads.',
49
+ ExternalAPI: 'An outbound HTTP host called through fetch(), with one node per host.',
50
+ Endpoint: 'An HTTP route registered by the app, such as app.get("/users", handler).',
51
+ };
16
52
  export const RangeSchema = z.object({
17
53
  startLine: z.number().int(),
18
54
  startColumn: z.number().int(),
@@ -1 +1 @@
1
- {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/schema/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,UAAU,GAAG;IACzB,QAAQ;IACR,OAAO;IACP,WAAW;IACX,WAAW;IACX,MAAM;IACN,UAAU;IACV,QAAQ;IACR,UAAU;IACV,WAAW;IACX,UAAU;IACV,gBAAgB;CACP,CAAC;AAEX,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;AAGjD,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IACnC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC3B,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;IACzB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE;IACd,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC"}
1
+ {"version":3,"file":"node.js","sourceRoot":"","sources":["../../src/schema/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;;;;;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IACpB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,KAAK,EAAE,WAAW,CAAC,QAAQ,EAAE;IAC7B,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAChC,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC1C,CAAC,CAAC"}
@@ -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"}
@@ -8,4 +8,4 @@ export declare class JsonlReader {
8
8
  static read(dir: string): Promise<GraphData>;
9
9
  private static readLines;
10
10
  }
11
- //# sourceMappingURL=jsonl-reader.d.ts.map
11
+ //# 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;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"}
@@ -16,4 +16,4 @@ export class JsonlReader {
16
16
  .map((line) => schema.parse(JSON.parse(line)));
17
17
  }
18
18
  }
19
- //# sourceMappingURL=jsonl-reader.js.map
19
+ //# sourceMappingURL=jsonl_reader.js.map
@@ -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,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAa,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAa,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAO/D,MAAM,OAAO,WAAW;IACvB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAW;QAC5B,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,eAAe,CAAC,CAAC;QACrF,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,eAAe,CAAC,CAAC;QACrF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAI,IAAY,EAAE,MAAoB;QACnE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7C,OAAO,OAAO;aACZ,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;aACxC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACD"}
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,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAa,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAa,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAO/D,MAAM,OAAO,WAAW;IACvB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,GAAW;QAC5B,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,eAAe,CAAC,CAAC;QACrF,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,eAAe,CAAC,CAAC;QACrF,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC;IACzB,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,SAAS,CAAI,IAAY,EAAE,MAAoB;QACnE,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7C,OAAO,OAAO;aACZ,KAAK,CAAC,IAAI,CAAC;aACX,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,CAAC;aACxC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjD,CAAC;CACD"}
@@ -4,4 +4,4 @@ export declare class JsonlStore {
4
4
  static write(outDir: string, nodes: GraphNode[], edges: GraphEdge[]): Promise<void>;
5
5
  private static serialize;
6
6
  }
7
- //# sourceMappingURL=jsonl-store.d.ts.map
7
+ //# 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;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"}
@@ -10,4 +10,4 @@ export class JsonlStore {
10
10
  return rows.map((row) => JSON.stringify(row)).join('\n') + '\n';
11
11
  }
12
12
  }
13
- //# sourceMappingURL=jsonl-store.js.map
13
+ //# sourceMappingURL=jsonl_store.js.map
@@ -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,KA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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"}
@@ -0,0 +1,66 @@
1
+ import type { KuzuValue } from 'kuzu';
2
+ import { GraphEdge } from '../schema/edge.js';
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
+ };
14
+ export declare class KuzuStore {
15
+ private readonly db;
16
+ private readonly conn;
17
+ constructor(dbPath: string);
18
+ initSchema(): Promise<void>;
19
+ load(nodes: GraphNode[], edges: GraphEdge[]): Promise<void>;
20
+ /**
21
+ * Reads every node back from the store, decoding the `metadata` column. Used
22
+ * by enrichment to resolve profile frames against the loaded graph's ranges
23
+ * and to merge new metadata onto existing records.
24
+ */
25
+ readNodes(): Promise<StoredNode[]>;
26
+ /**
27
+ * Overwrites the `metadata` column for the given nodes. The caller is
28
+ * responsible for merging so that only the intended keys change; passing the
29
+ * full record keeps the write idempotent for unchanged keys.
30
+ */
31
+ writeNodeMetadata(entries: {
32
+ id: string;
33
+ metadata: Record<string, unknown>;
34
+ }[]): Promise<void>;
35
+ /**
36
+ * Writes a graph-level metadata record under `key` (a `GraphMeta` row), encoding
37
+ * the value as JSON. Used for facts about the whole graph rather than one node —
38
+ * e.g. the runtime ingest manifest `enrich` records for coverage reporting.
39
+ */
40
+ writeGraphMeta(key: string, value: Record<string, unknown>): Promise<void>;
41
+ /** Reads the graph-level metadata record stored under `key`, decoded, or null when absent. */
42
+ readGraphMeta(key: string): Promise<Record<string, unknown> | null>;
43
+ /** Removes the graph-level metadata record stored under `key`, if any. */
44
+ clearGraphMeta(key: string): Promise<void>;
45
+ /**
46
+ * Serializes an optional metadata record to a JSON string for storage in the
47
+ * `metadata` column. Absent metadata is stored as an empty object so the
48
+ * column is never null.
49
+ */
50
+ private static encodeMetadata;
51
+ /**
52
+ * Decodes the JSON `metadata` column back into a record. A missing, empty, or
53
+ * malformed value decodes to an empty object so callers always receive a record.
54
+ */
55
+ private static decodeMetadata;
56
+ run(cypher: string, params?: Record<string, KuzuValue>): Promise<Record<string, KuzuValue>[]>;
57
+ close(): Promise<void>;
58
+ private static first;
59
+ /**
60
+ * Releases the native memory behind one or more query results. Results left
61
+ * unclosed are finalized after the database shuts down at process exit,
62
+ * which crashes the kuzu native module with a segmentation fault.
63
+ */
64
+ private static closeResults;
65
+ }
66
+ //# sourceMappingURL=kuzu_store.d.ts.map
@@ -0,0 +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;AAE9C,gFAAgF;AAChF,MAAM,MAAM,UAAU,GAAG;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAQF,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,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