ts-knowledge-graph 0.1.2 → 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 (255) hide show
  1. package/README.md +74 -34
  2. package/contribs/web_visualisation/README.md +28 -0
  3. package/contribs/web_visualisation/web/css/style.css +104 -0
  4. package/contribs/web_visualisation/web/data/.gitignore +1 -0
  5. package/contribs/web_visualisation/web/data/kind_descriptions.js +38 -0
  6. package/contribs/web_visualisation/web/index.html +20 -4
  7. package/contribs/web_visualisation/web/js/app.js +581 -35
  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.map +1 -1
  19. package/dist/cli.js +10 -2
  20. package/dist/cli.js.map +1 -1
  21. package/dist/commands/benchmark_command.d.ts +11 -0
  22. package/dist/commands/benchmark_command.d.ts.map +1 -0
  23. package/dist/commands/benchmark_command.js +91 -0
  24. package/dist/commands/benchmark_command.js.map +1 -0
  25. package/dist/commands/blast_radius_command.js +1 -1
  26. package/dist/commands/blast_radius_command.js.map +1 -1
  27. package/dist/commands/cost_command.d.ts +13 -0
  28. package/dist/commands/cost_command.d.ts.map +1 -0
  29. package/dist/commands/cost_command.js +122 -0
  30. package/dist/commands/cost_command.js.map +1 -0
  31. package/dist/commands/{load.d.ts → enrich_command.d.ts} +3 -2
  32. package/dist/commands/enrich_command.d.ts.map +1 -0
  33. package/dist/commands/enrich_command.js +62 -0
  34. package/dist/commands/enrich_command.js.map +1 -0
  35. package/dist/commands/hotspots_command.d.ts +7 -0
  36. package/dist/commands/hotspots_command.d.ts.map +1 -0
  37. package/dist/commands/hotspots_command.js +67 -0
  38. package/dist/commands/hotspots_command.js.map +1 -0
  39. package/dist/commands/install_command.d.ts +2 -3
  40. package/dist/commands/install_command.d.ts.map +1 -1
  41. package/dist/commands/install_command.js +7 -8
  42. package/dist/commands/install_command.js.map +1 -1
  43. package/dist/commands/load_command.d.ts.map +1 -1
  44. package/dist/commands/load_command.js +2 -0
  45. package/dist/commands/load_command.js.map +1 -1
  46. package/dist/commands/verify_command.d.ts +8 -0
  47. package/dist/commands/verify_command.d.ts.map +1 -0
  48. package/dist/commands/verify_command.js +57 -0
  49. package/dist/commands/verify_command.js.map +1 -0
  50. package/dist/commands/web_command.d.ts +27 -0
  51. package/dist/commands/web_command.d.ts.map +1 -1
  52. package/dist/commands/web_command.js +109 -3
  53. package/dist/commands/web_command.js.map +1 -1
  54. package/dist/enrich/cpu_profile.d.ts +127 -0
  55. package/dist/enrich/cpu_profile.d.ts.map +1 -0
  56. package/dist/enrich/cpu_profile.js +97 -0
  57. package/dist/enrich/cpu_profile.js.map +1 -0
  58. package/dist/enrich/runtime_enricher.d.ts +56 -0
  59. package/dist/enrich/runtime_enricher.d.ts.map +1 -0
  60. package/dist/enrich/runtime_enricher.js +80 -0
  61. package/dist/enrich/runtime_enricher.js.map +1 -0
  62. package/dist/enrich/runtime_join.d.ts +100 -0
  63. package/dist/enrich/runtime_join.d.ts.map +1 -0
  64. package/dist/enrich/runtime_join.js +227 -0
  65. package/dist/enrich/runtime_join.js.map +1 -0
  66. package/dist/extract/api_extractor.d.ts +24 -0
  67. package/dist/extract/api_extractor.d.ts.map +1 -0
  68. package/dist/extract/api_extractor.js +71 -0
  69. package/dist/extract/api_extractor.js.map +1 -0
  70. package/dist/extract/config_extractor.d.ts +22 -0
  71. package/dist/extract/config_extractor.d.ts.map +1 -0
  72. package/dist/extract/config_extractor.js +61 -0
  73. package/dist/extract/config_extractor.js.map +1 -0
  74. package/dist/extract/endpoint_extractor.d.ts +36 -0
  75. package/dist/extract/endpoint_extractor.d.ts.map +1 -0
  76. package/dist/extract/endpoint_extractor.js +117 -0
  77. package/dist/extract/endpoint_extractor.js.map +1 -0
  78. package/dist/extract/graph_builder.d.ts +8 -0
  79. package/dist/extract/graph_builder.d.ts.map +1 -1
  80. package/dist/extract/graph_builder.js +23 -1
  81. package/dist/extract/graph_builder.js.map +1 -1
  82. package/dist/extract/node_id.d.ts +16 -0
  83. package/dist/extract/node_id.d.ts.map +1 -1
  84. package/dist/extract/node_id.js +22 -0
  85. package/dist/extract/node_id.js.map +1 -1
  86. package/dist/extract/scope_resolver.d.ts +22 -0
  87. package/dist/extract/scope_resolver.d.ts.map +1 -0
  88. package/dist/extract/scope_resolver.js +53 -0
  89. package/dist/extract/scope_resolver.js.map +1 -0
  90. package/dist/extract/semantic_extractor.d.ts +25 -0
  91. package/dist/extract/semantic_extractor.d.ts.map +1 -1
  92. package/dist/extract/semantic_extractor.js +96 -2
  93. package/dist/extract/semantic_extractor.js.map +1 -1
  94. package/dist/extract/structural_extractor.d.ts +6 -0
  95. package/dist/extract/structural_extractor.d.ts.map +1 -1
  96. package/dist/extract/structural_extractor.js +22 -12
  97. package/dist/extract/structural_extractor.js.map +1 -1
  98. package/dist/project_root.d.ts +7 -0
  99. package/dist/project_root.d.ts.map +1 -0
  100. package/dist/project_root.js +9 -0
  101. package/dist/project_root.js.map +1 -0
  102. package/dist/query/graph_query.d.ts +234 -0
  103. package/dist/query/graph_query.d.ts.map +1 -1
  104. package/dist/query/graph_query.js +522 -11
  105. package/dist/query/graph_query.js.map +1 -1
  106. package/dist/schema/edge.d.ts +40 -5
  107. package/dist/schema/edge.d.ts.map +1 -1
  108. package/dist/schema/edge.js +70 -0
  109. package/dist/schema/edge.js.map +1 -1
  110. package/dist/schema/node.d.ts +20 -5
  111. package/dist/schema/node.d.ts.map +1 -1
  112. package/dist/schema/node.js +36 -0
  113. package/dist/schema/node.js.map +1 -1
  114. package/dist/schema/runtime_manifest.d.ts +36 -0
  115. package/dist/schema/runtime_manifest.d.ts.map +1 -0
  116. package/dist/schema/runtime_manifest.js +23 -0
  117. package/dist/schema/runtime_manifest.js.map +1 -0
  118. package/dist/store/kuzu_store.d.ts +46 -0
  119. package/dist/store/kuzu_store.d.ts.map +1 -1
  120. package/dist/store/kuzu_store.js +95 -5
  121. package/dist/store/kuzu_store.js.map +1 -1
  122. package/dist/verify/project_verifier.d.ts +85 -0
  123. package/dist/verify/project_verifier.d.ts.map +1 -0
  124. package/dist/verify/project_verifier.js +138 -0
  125. package/dist/verify/project_verifier.js.map +1 -0
  126. package/{skills/ts-knowledge-graph → dotclaude_folder/skills/code-graph-query}/SKILL.md +2 -2
  127. package/package.json +86 -7
  128. package/.env-sample +0 -34
  129. package/dist/agent/agent-tools.d.ts +0 -13
  130. package/dist/agent/agent-tools.d.ts.map +0 -1
  131. package/dist/agent/agent-tools.js +0 -153
  132. package/dist/agent/agent-tools.js.map +0 -1
  133. package/dist/agent/agent_tools.d.ts +0 -13
  134. package/dist/agent/agent_tools.d.ts.map +0 -1
  135. package/dist/agent/agent_tools.js +0 -153
  136. package/dist/agent/agent_tools.js.map +0 -1
  137. package/dist/agent/code-editor.d.ts +0 -18
  138. package/dist/agent/code-editor.d.ts.map +0 -1
  139. package/dist/agent/code-editor.js +0 -43
  140. package/dist/agent/code-editor.js.map +0 -1
  141. package/dist/agent/code_editor.d.ts +0 -18
  142. package/dist/agent/code_editor.d.ts.map +0 -1
  143. package/dist/agent/code_editor.js +0 -43
  144. package/dist/agent/code_editor.js.map +0 -1
  145. package/dist/agent/optimizer-agent.d.ts +0 -30
  146. package/dist/agent/optimizer-agent.d.ts.map +0 -1
  147. package/dist/agent/optimizer-agent.js +0 -97
  148. package/dist/agent/optimizer-agent.js.map +0 -1
  149. package/dist/agent/optimizer_agent.d.ts +0 -30
  150. package/dist/agent/optimizer_agent.d.ts.map +0 -1
  151. package/dist/agent/optimizer_agent.js +0 -97
  152. package/dist/agent/optimizer_agent.js.map +0 -1
  153. package/dist/agent/verifier.d.ts +0 -9
  154. package/dist/agent/verifier.d.ts.map +0 -1
  155. package/dist/agent/verifier.js +0 -19
  156. package/dist/agent/verifier.js.map +0 -1
  157. package/dist/commands/blast-radius.d.ts +0 -5
  158. package/dist/commands/blast-radius.d.ts.map +0 -1
  159. package/dist/commands/blast-radius.js +0 -18
  160. package/dist/commands/blast-radius.js.map +0 -1
  161. package/dist/commands/blast_radius.d.ts +0 -5
  162. package/dist/commands/blast_radius.d.ts.map +0 -1
  163. package/dist/commands/blast_radius.js +0 -18
  164. package/dist/commands/blast_radius.js.map +0 -1
  165. package/dist/commands/calls.d.ts +0 -5
  166. package/dist/commands/calls.d.ts.map +0 -1
  167. package/dist/commands/calls.js +0 -7
  168. package/dist/commands/calls.js.map +0 -1
  169. package/dist/commands/command-helpers.d.ts +0 -15
  170. package/dist/commands/command-helpers.d.ts.map +0 -1
  171. package/dist/commands/command-helpers.js +0 -61
  172. package/dist/commands/command-helpers.js.map +0 -1
  173. package/dist/commands/dead-exports.d.ts +0 -5
  174. package/dist/commands/dead-exports.d.ts.map +0 -1
  175. package/dist/commands/dead-exports.js +0 -7
  176. package/dist/commands/dead-exports.js.map +0 -1
  177. package/dist/commands/dead_exports.d.ts +0 -5
  178. package/dist/commands/dead_exports.d.ts.map +0 -1
  179. package/dist/commands/dead_exports.js +0 -7
  180. package/dist/commands/dead_exports.js.map +0 -1
  181. package/dist/commands/extract.d.ts +0 -8
  182. package/dist/commands/extract.d.ts.map +0 -1
  183. package/dist/commands/extract.js +0 -49
  184. package/dist/commands/extract.js.map +0 -1
  185. package/dist/commands/find.d.ts +0 -5
  186. package/dist/commands/find.d.ts.map +0 -1
  187. package/dist/commands/find.js +0 -7
  188. package/dist/commands/find.js.map +0 -1
  189. package/dist/commands/load.d.ts.map +0 -1
  190. package/dist/commands/load.js +0 -28
  191. package/dist/commands/load.js.map +0 -1
  192. package/dist/commands/neighbors.d.ts +0 -5
  193. package/dist/commands/neighbors.d.ts.map +0 -1
  194. package/dist/commands/neighbors.js +0 -17
  195. package/dist/commands/neighbors.js.map +0 -1
  196. package/dist/commands/optimize.d.ts +0 -6
  197. package/dist/commands/optimize.d.ts.map +0 -1
  198. package/dist/commands/optimize.js +0 -59
  199. package/dist/commands/optimize.js.map +0 -1
  200. package/dist/commands/optimize_command.d.ts +0 -6
  201. package/dist/commands/optimize_command.d.ts.map +0 -1
  202. package/dist/commands/optimize_command.js +0 -59
  203. package/dist/commands/optimize_command.js.map +0 -1
  204. package/dist/commands/references.d.ts +0 -5
  205. package/dist/commands/references.d.ts.map +0 -1
  206. package/dist/commands/references.js +0 -17
  207. package/dist/commands/references.js.map +0 -1
  208. package/dist/commands/web.d.ts +0 -19
  209. package/dist/commands/web.d.ts.map +0 -1
  210. package/dist/commands/web.js +0 -120
  211. package/dist/commands/web.js.map +0 -1
  212. package/dist/commands/who-calls.d.ts +0 -5
  213. package/dist/commands/who-calls.d.ts.map +0 -1
  214. package/dist/commands/who-calls.js +0 -7
  215. package/dist/commands/who-calls.js.map +0 -1
  216. package/dist/commands/who_calls.d.ts +0 -5
  217. package/dist/commands/who_calls.d.ts.map +0 -1
  218. package/dist/commands/who_calls.js +0 -7
  219. package/dist/commands/who_calls.js.map +0 -1
  220. package/dist/extract/graph-builder.d.ts +0 -16
  221. package/dist/extract/graph-builder.d.ts.map +0 -1
  222. package/dist/extract/graph-builder.js +0 -39
  223. package/dist/extract/graph-builder.js.map +0 -1
  224. package/dist/extract/node-id.d.ts +0 -8
  225. package/dist/extract/node-id.d.ts.map +0 -1
  226. package/dist/extract/node-id.js +0 -22
  227. package/dist/extract/node-id.js.map +0 -1
  228. package/dist/extract/project-loader.d.ts +0 -5
  229. package/dist/extract/project-loader.d.ts.map +0 -1
  230. package/dist/extract/project-loader.js +0 -19
  231. package/dist/extract/project-loader.js.map +0 -1
  232. package/dist/extract/semantic-extractor.d.ts +0 -22
  233. package/dist/extract/semantic-extractor.d.ts.map +0 -1
  234. package/dist/extract/semantic-extractor.js +0 -254
  235. package/dist/extract/semantic-extractor.js.map +0 -1
  236. package/dist/extract/structural-extractor.d.ts +0 -18
  237. package/dist/extract/structural-extractor.d.ts.map +0 -1
  238. package/dist/extract/structural-extractor.js +0 -97
  239. package/dist/extract/structural-extractor.js.map +0 -1
  240. package/dist/query/graph-query.d.ts +0 -28
  241. package/dist/query/graph-query.d.ts.map +0 -1
  242. package/dist/query/graph-query.js +0 -93
  243. package/dist/query/graph-query.js.map +0 -1
  244. package/dist/store/jsonl-reader.d.ts +0 -11
  245. package/dist/store/jsonl-reader.d.ts.map +0 -1
  246. package/dist/store/jsonl-reader.js +0 -19
  247. package/dist/store/jsonl-reader.js.map +0 -1
  248. package/dist/store/jsonl-store.d.ts +0 -7
  249. package/dist/store/jsonl-store.d.ts.map +0 -1
  250. package/dist/store/jsonl-store.js +0 -13
  251. package/dist/store/jsonl-store.js.map +0 -1
  252. package/dist/store/kuzu-store.d.ts +0 -14
  253. package/dist/store/kuzu-store.d.ts.map +0 -1
  254. package/dist/store/kuzu-store.js +0 -52
  255. package/dist/store/kuzu-store.js.map +0 -1
@@ -0,0 +1,85 @@
1
+ /**
2
+ * The reusable verify path for the optimization loop: run the project's
3
+ * type-check and test gates and reduce them to one pass/fail verdict, plus the
4
+ * honesty flags an agent needs (was *behaviour* verified, or only types?).
5
+ *
6
+ * A type-check proves the edit compiles; it cannot see a swapped operator, an
7
+ * off-by-one, or a dropped branch. Running the test suite alongside `tsc` is
8
+ * what turns "still compiles" into "still works". When a project has no test
9
+ * script the test gate degrades to skipped and {@link VerifyReport.behaviorVerified}
10
+ * stays false, so the caller can report the change as unverified rather than
11
+ * implying it was behaviourally checked.
12
+ */
13
+ /** The two correctness gates, run in order. */
14
+ export type CheckName = 'typecheck' | 'test';
15
+ /** A gate ran and passed, ran and failed, or never ran. */
16
+ export type CheckStatus = 'pass' | 'fail' | 'skipped';
17
+ /** A gate resolved from the project's package.json: its command, or why it was skipped. */
18
+ export type PlannedCheck = {
19
+ name: CheckName;
20
+ /** The shell command to run, or `null` when the gate is skipped. */
21
+ command: string | null;
22
+ /** Why the gate will not run (e.g. no matching npm script), set when `command` is null. */
23
+ skippedReason?: string;
24
+ };
25
+ /** The outcome of executing (or skipping) one gate. */
26
+ export type CheckResult = {
27
+ name: CheckName;
28
+ command: string | null;
29
+ status: CheckStatus;
30
+ /** Process exit code; `null` when the gate was skipped or the process died on a signal. */
31
+ exitCode: number | null;
32
+ durationMs: number;
33
+ /** Combined stdout+stderr, tail-bounded to the last `outputTailLines` lines. */
34
+ output: string;
35
+ skippedReason?: string;
36
+ };
37
+ /** The single verdict the optimize loop consumes to keep or revert an edit. */
38
+ export type VerifyReport = {
39
+ /** True when at least one gate ran and no gate that ran failed. */
40
+ ok: boolean;
41
+ /** True only when the test gate actually ran and passed — behaviour, not just types, was checked. */
42
+ behaviorVerified: boolean;
43
+ /** True when a gate was skipped (e.g. the project has no test script), so `ok` is weaker than a full pass. */
44
+ degraded: boolean;
45
+ checks: CheckResult[];
46
+ /** A one-line, quotable verdict that states exactly what was and was not verified. */
47
+ summary: string;
48
+ };
49
+ export type VerifyOptions = {
50
+ /** Project root whose package.json is read and whose scripts are run. Defaults to `process.cwd()`. */
51
+ cwd?: string;
52
+ /** npm script name for the type-check gate. Default `typecheck`. */
53
+ typecheckScript?: string;
54
+ /** npm script name for the test gate. Default `test`. */
55
+ testScript?: string;
56
+ /** Skip the type-check gate entirely. */
57
+ skipTypecheck?: boolean;
58
+ /** Skip the test gate entirely (degrades to type-check-only, reported honestly). */
59
+ skipTests?: boolean;
60
+ /** Keep only the last N lines of each gate's captured output. Default 80. */
61
+ outputTailLines?: number;
62
+ };
63
+ /** How a planned gate is executed. Injectable so tests need not spawn npm. */
64
+ export type CheckExecutor = (command: string, cwd: string) => Promise<{
65
+ exitCode: number | null;
66
+ output: string;
67
+ }>;
68
+ export declare class ProjectVerifier {
69
+ /**
70
+ * Run the project's verify gates and return one verdict. `exec` defaults to a
71
+ * real subprocess spawn; tests inject a fake to avoid running npm.
72
+ */
73
+ static verify(options?: VerifyOptions, exec?: CheckExecutor): Promise<VerifyReport>;
74
+ /** Resolve each gate against the project's scripts, deciding what will run and what is skipped (pure). */
75
+ static planChecks(scripts: Record<string, string>, options?: VerifyOptions): PlannedCheck[];
76
+ /** Reduce a set of gate results to the single verdict, including the honesty flags (pure). */
77
+ static summarize(checks: CheckResult[]): VerifyReport;
78
+ private static planOne;
79
+ private static runCheck;
80
+ private static buildSummary;
81
+ private static readScripts;
82
+ private static tail;
83
+ private static spawnCommand;
84
+ }
85
+ //# sourceMappingURL=project_verifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project_verifier.d.ts","sourceRoot":"","sources":["../../src/verify/project_verifier.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;GAWG;AAEH,+CAA+C;AAC/C,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,MAAM,CAAC;AAE7C,2DAA2D;AAC3D,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;AAEtD,2FAA2F;AAC3F,MAAM,MAAM,YAAY,GAAG;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,oEAAoE;IACpE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2FAA2F;IAC3F,aAAa,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,uDAAuD;AACvD,MAAM,MAAM,WAAW,GAAG;IACzB,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,WAAW,CAAC;IACpB,2FAA2F;IAC3F,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;C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,QAAQ;IAwB7B,OAAO,CAAC,MAAM,CAAC,YAAY;mBAoBN,WAAW;IAmBhC,OAAO,CAAC,MAAM,CAAC,IAAI;IAWnB,OAAO,CAAC,MAAM,CAAC,YAAY;CAkB3B"}
@@ -0,0 +1,138 @@
1
+ import { spawn } from 'node:child_process';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { resolve } from 'node:path';
4
+ import { z } from 'zod';
5
+ const DEFAULT_TYPECHECK_SCRIPT = 'typecheck';
6
+ const DEFAULT_TEST_SCRIPT = 'test';
7
+ const DEFAULT_TAIL_LINES = 80;
8
+ const PackageJsonSchema = z.object({ scripts: z.record(z.unknown()).optional() });
9
+ export class ProjectVerifier {
10
+ /**
11
+ * Run the project's verify gates and return one verdict. `exec` defaults to a
12
+ * real subprocess spawn; tests inject a fake to avoid running npm.
13
+ */
14
+ static async verify(options = {}, exec = ProjectVerifier.spawnCommand) {
15
+ const cwd = resolve(options.cwd ?? process.cwd());
16
+ const tailLines = options.outputTailLines ?? DEFAULT_TAIL_LINES;
17
+ const scripts = await ProjectVerifier.readScripts(cwd);
18
+ const plan = ProjectVerifier.planChecks(scripts, options);
19
+ const results = [];
20
+ for (const check of plan) {
21
+ results.push(await ProjectVerifier.runCheck(check, cwd, tailLines, exec));
22
+ }
23
+ return ProjectVerifier.summarize(results);
24
+ }
25
+ /** Resolve each gate against the project's scripts, deciding what will run and what is skipped (pure). */
26
+ static planChecks(scripts, options = {}) {
27
+ const typecheckScript = options.typecheckScript ?? DEFAULT_TYPECHECK_SCRIPT;
28
+ const testScript = options.testScript ?? DEFAULT_TEST_SCRIPT;
29
+ return [
30
+ ProjectVerifier.planOne('typecheck', typecheckScript, scripts, options.skipTypecheck === true),
31
+ ProjectVerifier.planOne('test', testScript, scripts, options.skipTests === true),
32
+ ];
33
+ }
34
+ /** Reduce a set of gate results to the single verdict, including the honesty flags (pure). */
35
+ static summarize(checks) {
36
+ const ran = checks.filter((check) => check.status !== 'skipped');
37
+ const failed = ran.filter((check) => check.status === 'fail');
38
+ const test = checks.find((check) => check.name === 'test');
39
+ const behaviorVerified = test !== undefined && test.status === 'pass';
40
+ const ok = ran.length > 0 && failed.length === 0;
41
+ const degraded = checks.some((check) => check.status === 'skipped');
42
+ const summary = ProjectVerifier.buildSummary(ran, failed, test, ok, behaviorVerified);
43
+ return { ok, behaviorVerified, degraded, checks, summary };
44
+ }
45
+ static planOne(name, script, scripts, skip) {
46
+ if (skip === true) {
47
+ return { name, command: null, skippedReason: 'skipped by request' };
48
+ }
49
+ if (typeof scripts[script] !== 'string') {
50
+ return { name, command: null, skippedReason: `no "${script}" script in package.json` };
51
+ }
52
+ return { name, command: `npm run ${script}` };
53
+ }
54
+ static async runCheck(check, cwd, tailLines, exec) {
55
+ if (check.command === null) {
56
+ return {
57
+ name: check.name,
58
+ command: null,
59
+ status: 'skipped',
60
+ exitCode: null,
61
+ durationMs: 0,
62
+ output: '',
63
+ skippedReason: check.skippedReason,
64
+ };
65
+ }
66
+ const startedAt = Date.now();
67
+ const { exitCode, output } = await exec(check.command, cwd);
68
+ return {
69
+ name: check.name,
70
+ command: check.command,
71
+ status: exitCode === 0 ? 'pass' : 'fail',
72
+ exitCode,
73
+ durationMs: Date.now() - startedAt,
74
+ output: ProjectVerifier.tail(output, tailLines),
75
+ };
76
+ }
77
+ static buildSummary(ran, failed, test, ok, behaviorVerified) {
78
+ if (ran.length === 0) {
79
+ return 'could not verify: no type-check or test script found — change is unverified';
80
+ }
81
+ if (ok === false) {
82
+ return `FAILED: ${failed.map((check) => check.name).join(' and ')} did not pass — revert the edit`;
83
+ }
84
+ if (behaviorVerified === true) {
85
+ return `verified: ${ran.map((check) => check.name).join(' + ')} passed (behaviour checked)`;
86
+ }
87
+ const why = test?.skippedReason ?? 'tests did not run';
88
+ return `type-check passed, but ${why} — behaviour NOT verified`;
89
+ }
90
+ static async readScripts(cwd) {
91
+ try {
92
+ const raw = await readFile(resolve(cwd, 'package.json'), 'utf8');
93
+ const parsed = PackageJsonSchema.safeParse(JSON.parse(raw));
94
+ if (parsed.success === false) {
95
+ return {};
96
+ }
97
+ const scripts = {};
98
+ for (const [name, value] of Object.entries(parsed.data.scripts ?? {})) {
99
+ if (typeof value === 'string') {
100
+ scripts[name] = value;
101
+ }
102
+ }
103
+ return scripts;
104
+ }
105
+ catch {
106
+ return {};
107
+ }
108
+ }
109
+ static tail(text, lines) {
110
+ if (lines <= 0) {
111
+ return text;
112
+ }
113
+ const allLines = text.split('\n');
114
+ if (allLines.length <= lines) {
115
+ return text;
116
+ }
117
+ return allLines.slice(allLines.length - lines).join('\n');
118
+ }
119
+ static spawnCommand(command, cwd) {
120
+ return new Promise((resolvePromise) => {
121
+ const child = spawn(command, { cwd, shell: true });
122
+ let output = '';
123
+ const append = (chunk) => {
124
+ output += chunk.toString();
125
+ };
126
+ child.stdout.on('data', append);
127
+ child.stderr.on('data', append);
128
+ child.on('error', (error) => {
129
+ output += `\n${error.message}`;
130
+ resolvePromise({ exitCode: 1, output });
131
+ });
132
+ child.on('close', (code) => {
133
+ resolvePromise({ exitCode: code, output });
134
+ });
135
+ });
136
+ }
137
+ }
138
+ //# sourceMappingURL=project_verifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"project_verifier.js","sourceRoot":"","sources":["../../src/verify/project_verifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0ExB,MAAM,wBAAwB,GAAG,WAAW,CAAC;AAC7C,MAAM,mBAAmB,GAAG,MAAM,CAAC;AACnC,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAE9B,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAA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,cAAc,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YAC5C,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACJ,CAAC;CACD"}
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: ts-knowledge-graph
2
+ name: code-graph-query
3
3
  description: >-
4
4
  Query a TypeScript codebase as a knowledge graph to answer impact, caller,
5
5
  dependency, and dead-code questions. Use this instead of grep/glob for
@@ -8,7 +8,7 @@ description: >-
8
8
  ts-knowledge-graph CLI and a built graph database.
9
9
  ---
10
10
 
11
- # ts-knowledge-graph
11
+ # code-graph-query
12
12
 
13
13
  Answer structural questions about a TypeScript project by querying a semantic
14
14
  knowledge graph (built with the TypeScript compiler API) rather than reading or
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-knowledge-graph",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Parse TypeScript source into a knowledge graph for autonomous code optimization",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,10 +9,9 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "contribs/web_visualisation/web",
12
- "skills/ts-knowledge-graph/SKILL.md",
12
+ "dotclaude_folder/skills/code-graph-query/SKILL.md",
13
13
  "README.md",
14
- "LICENSE",
15
- ".env-sample"
14
+ "LICENSE"
16
15
  ],
17
16
  "engines": {
18
17
  "node": ">=18"
@@ -25,15 +24,95 @@
25
24
  "web": "tsx src/cli.ts web",
26
25
  "dev": "tsx src/cli.ts",
27
26
  "build": "tsc -p tsconfig.build.json",
27
+ "clean": "npm run clean:dist && npm run clean:outputs",
28
+ "clean:dist": "rm -rf ./dist",
29
+ "clean:outputs": "rm -rf ./outputs/*/",
30
+ "symlink:dotclaude": "bash scripts/symlink_dotclaude.sh",
28
31
  "publish:all": "npm run build && npm version patch && npm publish",
29
- "typecheck": "tsc --noEmit",
30
- "test": "node --import tsx --test \"test/**/*.test.ts\""
32
+ "typecheck": "tsc --noEmit && tsc -p contribs/web_visualisation/web/tsconfig.json",
33
+ "test": "node --import tsx --test \"tests/**/*.test.ts\"",
34
+ "verify": "tsx src/cli.ts verify",
35
+ "project01": "npm run project01:rebuild && npm run project01:dead-exports",
36
+ "project01:tour": "bash scripts/project_01_tour.sh",
37
+ "project01:rebuild": "npm run project01:clean && npm run project01:extract && npm run project01:load",
38
+ "project01:clean": "rm -rf ./outputs/project_01",
39
+ "project01:extract": "tsx src/cli.ts extract sample_projects/project_01 --semantic --out ./outputs/project_01/graph",
40
+ "project01:load": "tsx src/cli.ts load ./outputs/project_01/graph --db ./outputs/project_01/graph.kuzu",
41
+ "project01:enrich": "bash scripts/profile_and_enrich.sh project_01",
42
+ "project01:benchmark": "tsx src/cli.ts benchmark titleCase --workload scripts/benchmarks/project_01_workload.ts --db ./outputs/project_01/graph.kuzu --root ./sample_projects/project_01 --runs 5",
43
+ "project01:verify": "tsx src/cli.ts verify --cwd sample_projects/project_01",
44
+ "project01:dead-exports": "tsx src/cli.ts dead-exports --db ./outputs/project_01/graph.kuzu",
45
+ "project01:hotspots": "tsx src/cli.ts hotspots --db ./outputs/project_01/graph.kuzu",
46
+ "project01:cost": "tsx src/cli.ts cost --db ./outputs/project_01/graph.kuzu",
47
+ "project01:find": "tsx src/cli.ts find --db ./outputs/project_01/graph.kuzu",
48
+ "project01:who-calls": "tsx src/cli.ts who-calls --db ./outputs/project_01/graph.kuzu",
49
+ "project01:calls": "tsx src/cli.ts calls --db ./outputs/project_01/graph.kuzu",
50
+ "project01:references": "tsx src/cli.ts references --db ./outputs/project_01/graph.kuzu",
51
+ "project01:neighbors": "tsx src/cli.ts neighbors --db ./outputs/project_01/graph.kuzu",
52
+ "project01:blast-radius": "tsx src/cli.ts blast-radius --db ./outputs/project_01/graph.kuzu",
53
+ "project01:web": "tsx src/cli.ts web --db ./outputs/project_01/graph.kuzu",
54
+ "project02": "npm run project02:rebuild && npm run project02:dead-exports",
55
+ "project02:tour": "bash scripts/project_02_tour.sh",
56
+ "project02:rebuild": "npm run project02:clean && npm run project02:extract && npm run project02:load",
57
+ "project02:clean": "rm -rf ./outputs/project_02",
58
+ "project02:extract": "tsx src/cli.ts extract sample_projects/project_02 --semantic --out ./outputs/project_02/graph",
59
+ "project02:load": "tsx src/cli.ts load ./outputs/project_02/graph --db ./outputs/project_02/graph.kuzu",
60
+ "project02:enrich": "bash scripts/profile_and_enrich.sh project_02",
61
+ "project02:benchmark": "tsx src/cli.ts benchmark parseTerm --workload scripts/benchmarks/project_02_workload.ts --db ./outputs/project_02/graph.kuzu --root ./sample_projects/project_02 --runs 5",
62
+ "project02:verify": "tsx src/cli.ts verify --cwd sample_projects/project_02",
63
+ "project02:dead-exports": "tsx src/cli.ts dead-exports --db ./outputs/project_02/graph.kuzu",
64
+ "project02:hotspots": "tsx src/cli.ts hotspots --db ./outputs/project_02/graph.kuzu",
65
+ "project02:cost": "tsx src/cli.ts cost --db ./outputs/project_02/graph.kuzu",
66
+ "project02:find": "tsx src/cli.ts find --db ./outputs/project_02/graph.kuzu",
67
+ "project02:who-calls": "tsx src/cli.ts who-calls --db ./outputs/project_02/graph.kuzu",
68
+ "project02:calls": "tsx src/cli.ts calls --db ./outputs/project_02/graph.kuzu",
69
+ "project02:references": "tsx src/cli.ts references --db ./outputs/project_02/graph.kuzu",
70
+ "project02:neighbors": "tsx src/cli.ts neighbors --db ./outputs/project_02/graph.kuzu",
71
+ "project02:blast-radius": "tsx src/cli.ts blast-radius --db ./outputs/project_02/graph.kuzu",
72
+ "project02:web": "tsx src/cli.ts web --db ./outputs/project_02/graph.kuzu",
73
+ "project03": "npm run project03:rebuild && npm run project03:dead-exports",
74
+ "project03:tour": "bash scripts/project_03_tour.sh",
75
+ "project03:rebuild": "npm run project03:clean && npm run project03:extract && npm run project03:load",
76
+ "project03:clean": "rm -rf ./outputs/project_03",
77
+ "project03:extract": "tsx src/cli.ts extract sample_projects/project_03 --semantic --out ./outputs/project_03/graph",
78
+ "project03:load": "tsx src/cli.ts load ./outputs/project_03/graph --db ./outputs/project_03/graph.kuzu",
79
+ "project03:enrich": "bash scripts/profile_and_enrich.sh project_03",
80
+ "project03:benchmark": "tsx src/cli.ts benchmark describe --workload scripts/benchmarks/project_03_workload.ts --db ./outputs/project_03/graph.kuzu --root ./sample_projects/project_03 --runs 5",
81
+ "project03:verify": "tsx src/cli.ts verify --cwd sample_projects/project_03",
82
+ "project03:dead-exports": "tsx src/cli.ts dead-exports --db ./outputs/project_03/graph.kuzu",
83
+ "project03:hotspots": "tsx src/cli.ts hotspots --db ./outputs/project_03/graph.kuzu",
84
+ "project03:cost": "tsx src/cli.ts cost --db ./outputs/project_03/graph.kuzu",
85
+ "project03:find": "tsx src/cli.ts find --db ./outputs/project_03/graph.kuzu",
86
+ "project03:who-calls": "tsx src/cli.ts who-calls --db ./outputs/project_03/graph.kuzu",
87
+ "project03:calls": "tsx src/cli.ts calls --db ./outputs/project_03/graph.kuzu",
88
+ "project03:references": "tsx src/cli.ts references --db ./outputs/project_03/graph.kuzu",
89
+ "project03:neighbors": "tsx src/cli.ts neighbors --db ./outputs/project_03/graph.kuzu",
90
+ "project03:blast-radius": "tsx src/cli.ts blast-radius --db ./outputs/project_03/graph.kuzu",
91
+ "project03:web": "tsx src/cli.ts web --db ./outputs/project_03/graph.kuzu",
92
+ "project04": "npm run project04:rebuild && npm run project04:dead-exports",
93
+ "project04:tour": "bash scripts/project_04_tour.sh",
94
+ "project04:rebuild": "npm run project04:clean && npm run project04:extract && npm run project04:load",
95
+ "project04:clean": "rm -rf ./outputs/project_04",
96
+ "project04:extract": "tsx src/cli.ts extract sample_projects/project_04 --semantic --out ./outputs/project_04/graph",
97
+ "project04:load": "tsx src/cli.ts load ./outputs/project_04/graph --db ./outputs/project_04/graph.kuzu",
98
+ "project04:enrich": "bash scripts/profile_and_enrich.sh project_04",
99
+ "project04:workload": "tsx scripts/benchmarks/project_04_workload.ts",
100
+ "project04:verify": "tsx src/cli.ts verify --cwd sample_projects/project_04",
101
+ "project04:dead-exports": "tsx src/cli.ts dead-exports --db ./outputs/project_04/graph.kuzu",
102
+ "project04:hotspots": "tsx src/cli.ts hotspots --db ./outputs/project_04/graph.kuzu",
103
+ "project04:cost": "tsx src/cli.ts cost --db ./outputs/project_04/graph.kuzu",
104
+ "project04:find": "tsx src/cli.ts find --db ./outputs/project_04/graph.kuzu",
105
+ "project04:who-calls": "tsx src/cli.ts who-calls --db ./outputs/project_04/graph.kuzu",
106
+ "project04:calls": "tsx src/cli.ts calls --db ./outputs/project_04/graph.kuzu",
107
+ "project04:references": "tsx src/cli.ts references --db ./outputs/project_04/graph.kuzu",
108
+ "project04:neighbors": "tsx src/cli.ts neighbors --db ./outputs/project_04/graph.kuzu",
109
+ "project04:blast-radius": "tsx src/cli.ts blast-radius --db ./outputs/project_04/graph.kuzu",
110
+ "project04:web": "tsx src/cli.ts web --db ./outputs/project_04/graph.kuzu"
31
111
  },
32
112
  "dependencies": {
33
113
  "chalk": "^5.3.0",
34
114
  "commander": "^12.1.0",
35
115
  "kuzu": "^0.11.3",
36
- "openai": "^6.42.0",
37
116
  "ts-morph": "^23.0.0",
38
117
  "zod": "^3.23.8"
39
118
  },
package/.env-sample DELETED
@@ -1,34 +0,0 @@
1
- # Copy to .env and pick ONE provider block below.
2
- # The agent uses the OpenAI-compatible chat-completions API, so any provider
3
- # exposing that surface works — only the three variables below change.
4
- #
5
- # OPENAI_API_KEY auth token for the provider (any non-empty string for local servers)
6
- # OPENAI_BASE_URL the provider's OpenAI-compatible endpoint (omit for openai.com)
7
- # OPENAI_MODEL model name, in the provider's naming scheme
8
-
9
- # --- OpenAI (default) -------------------------------------------------------
10
- OPENAI_API_KEY=sk-...
11
- # OPENAI_BASE_URL is not needed — defaults to https://api.openai.com/v1
12
- OPENAI_MODEL=gpt-5.1
13
-
14
- # --- OpenRouter (any model behind one key) ----------------------------------
15
- # OPENAI_API_KEY=sk-or-v1-...
16
- # OPENAI_BASE_URL=https://openrouter.ai/api/v1
17
- # OPENAI_MODEL=anthropic/claude-sonnet-4.5
18
- # OPENAI_MODEL=openai/gpt-5.1
19
- # OPENAI_MODEL=deepseek/deepseek-chat-v3.1
20
-
21
- # --- Ollama (local, free) ---------------------------------------------------
22
- # OPENAI_API_KEY=ollama
23
- # OPENAI_BASE_URL=http://localhost:11434/v1
24
- # OPENAI_MODEL=qwen2.5-coder:32b
25
-
26
- # --- LM Studio (local) ------------------------------------------------------
27
- # OPENAI_API_KEY=lm-studio
28
- # OPENAI_BASE_URL=http://localhost:1234/v1
29
- # OPENAI_MODEL=local-model
30
-
31
- # --- vLLM (self-hosted) -----------------------------------------------------
32
- # OPENAI_API_KEY=token-abc123
33
- # OPENAI_BASE_URL=http://localhost:8000/v1
34
- # OPENAI_MODEL=Qwen/Qwen2.5-Coder-32B-Instruct
@@ -1,13 +0,0 @@
1
- import OpenAI from 'openai';
2
- import { GraphQuery } from '../query/graph-query.js';
3
- export declare const PROPOSE_TOOL_NAME = "propose_optimization";
4
- export declare const AGENT_TOOLS: OpenAI.Chat.Completions.ChatCompletionTool[];
5
- export declare class AgentTools {
6
- private readonly query;
7
- private readonly rootPath;
8
- constructor(query: GraphQuery, rootPath: string);
9
- dispatch(name: string, input: Record<string, unknown>): Promise<string>;
10
- private readFile;
11
- private static stringify;
12
- }
13
- //# sourceMappingURL=agent-tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-tools.d.ts","sourceRoot":"","sources":["../../src/agent/agent-tools.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,eAAO,MAAM,iBAAiB,yBAAyB,CAAC;AAExD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAyGnE,CAAC;AAEF,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAKzC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;YAqB/D,QAAQ;IAetB,OAAO,CAAC,MAAM,CAAC,SAAS;CAGxB"}
@@ -1,153 +0,0 @@
1
- import { readFile } from 'node:fs/promises';
2
- import { resolve } from 'node:path';
3
- export const PROPOSE_TOOL_NAME = 'propose_optimization';
4
- export const AGENT_TOOLS = [
5
- {
6
- type: 'function',
7
- function: {
8
- name: 'find_symbol',
9
- description: 'Resolve a symbol name (substring, case-insensitive) to candidate node ids. Always start here to obtain ids; never invent ids.',
10
- parameters: {
11
- type: 'object',
12
- properties: { name: { type: 'string', description: 'symbol name or substring' } },
13
- required: ['name'],
14
- },
15
- },
16
- },
17
- {
18
- type: 'function',
19
- function: {
20
- name: 'who_calls',
21
- description: 'List the direct callers of a function/method node id.',
22
- parameters: {
23
- type: 'object',
24
- properties: { id: { type: 'string', description: 'node id from find_symbol' } },
25
- required: ['id'],
26
- },
27
- },
28
- },
29
- {
30
- type: 'function',
31
- function: {
32
- name: 'references',
33
- description: 'List everything that references a symbol or type (calls, type usage, heritage, instantiation, value reads). Use this to judge whether a symbol is safe to remove.',
34
- parameters: {
35
- type: 'object',
36
- properties: { id: { type: 'string', description: 'node id from find_symbol' } },
37
- required: ['id'],
38
- },
39
- },
40
- },
41
- {
42
- type: 'function',
43
- function: {
44
- name: 'blast_radius',
45
- description: 'List every symbol transitively impacted by changing a node id (transitive callers).',
46
- parameters: {
47
- type: 'object',
48
- properties: {
49
- id: { type: 'string', description: 'node id from find_symbol' },
50
- depth: { type: 'integer', description: 'max traversal depth (default 10)' },
51
- },
52
- required: ['id'],
53
- },
54
- },
55
- },
56
- {
57
- type: 'function',
58
- function: {
59
- name: 'neighbors',
60
- description: 'Show the one-hop neighbourhood (incoming and outgoing edges) of a node id.',
61
- parameters: {
62
- type: 'object',
63
- properties: { id: { type: 'string', description: 'node id from find_symbol' } },
64
- required: ['id'],
65
- },
66
- },
67
- },
68
- {
69
- type: 'function',
70
- function: {
71
- name: 'dead_exports',
72
- description: 'List exported symbols that have no inbound references anywhere in the project — prime candidates for safe removal.',
73
- parameters: { type: 'object', properties: {} },
74
- },
75
- },
76
- {
77
- type: 'function',
78
- function: {
79
- name: 'read_file',
80
- description: 'Read a project source file (optionally a line range) to see exact text before proposing an edit.',
81
- parameters: {
82
- type: 'object',
83
- properties: {
84
- path: { type: 'string', description: 'project-relative file path, e.g. src/schema/node.ts' },
85
- startLine: { type: 'integer', description: 'first line (1-based, optional)' },
86
- endLine: { type: 'integer', description: 'last line (inclusive, optional)' },
87
- },
88
- required: ['path'],
89
- },
90
- },
91
- },
92
- {
93
- type: 'function',
94
- function: {
95
- name: PROPOSE_TOOL_NAME,
96
- description: 'Propose ONE safe edit. The harness applies it, runs the TypeScript type-checker, and keeps it only if type-checking passes (otherwise it is reverted and you get the errors). `find` must match the file exactly and uniquely.',
97
- parameters: {
98
- type: 'object',
99
- properties: {
100
- filePath: { type: 'string', description: 'project-relative file path' },
101
- find: { type: 'string', description: 'exact text to replace (must be unique in the file)' },
102
- replace: { type: 'string', description: 'replacement text (empty string to delete)' },
103
- rationale: { type: 'string', description: 'why this change is safe and beneficial' },
104
- },
105
- required: ['filePath', 'find', 'replace', 'rationale'],
106
- },
107
- },
108
- },
109
- ];
110
- export class AgentTools {
111
- constructor(query, rootPath) {
112
- this.query = query;
113
- this.rootPath = rootPath;
114
- }
115
- async dispatch(name, input) {
116
- switch (name) {
117
- case 'find_symbol':
118
- return AgentTools.stringify(await this.query.find(String(input.name)));
119
- case 'who_calls':
120
- return AgentTools.stringify(await this.query.whoCalls(String(input.id)));
121
- case 'references':
122
- return AgentTools.stringify(await this.query.references(String(input.id)));
123
- case 'blast_radius':
124
- return AgentTools.stringify(await this.query.blastRadius(String(input.id), Number(input.depth ?? 10)));
125
- case 'neighbors':
126
- return AgentTools.stringify(await this.query.neighborhood(String(input.id)));
127
- case 'dead_exports':
128
- return AgentTools.stringify(await this.query.deadExports());
129
- case 'read_file':
130
- return this.readFile(input);
131
- default:
132
- return `unknown tool: ${name}`;
133
- }
134
- }
135
- async readFile(input) {
136
- const absolute = resolve(this.rootPath, String(input.path));
137
- const content = await readFile(absolute, 'utf8').catch(() => undefined);
138
- if (content === undefined) {
139
- return `file not found: ${String(input.path)}`;
140
- }
141
- const lines = content.split('\n');
142
- const start = input.startLine === undefined ? 1 : Number(input.startLine);
143
- const end = input.endLine === undefined ? lines.length : Number(input.endLine);
144
- return lines
145
- .slice(start - 1, end)
146
- .map((line, index) => `${start + index}\t${line}`)
147
- .join('\n');
148
- }
149
- static stringify(value) {
150
- return JSON.stringify(value, null, 2);
151
- }
152
- }
153
- //# sourceMappingURL=agent-tools.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-tools.js","sourceRoot":"","sources":["../../src/agent/agent-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,CAAC,MAAM,iBAAiB,GAAG,sBAAsB,CAAC;AAExD,MAAM,CAAC,MAAM,WAAW,GAAiD;IACxE;QACC,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACT,IAAI,EAAE,aAAa;YACnB,WAAW,EAAE,+HAA+H;YAC5I,UAAU,EAAE;gBACX,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,0BAA0B,EAAE,EAAE;gBACjF,QAAQ,EAAE,CAAC,MAAM,CAAC;aAClB;SACD;KACD;IACD;QACC,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE;YACT,IAAI,EAAE,WAAW;YACjB,WAAW,EAAE,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AAC,QAAQ,CAAC,KAA8B;QACpD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;QACxE,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;YAC3B,OAAO,mBAAmB,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QAChD,CAAC;QACD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAClC,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;QAC1E,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/E,OAAO,KAAK;aACV,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC;aACrB,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,GAAG,KAAK,KAAK,IAAI,EAAE,CAAC;aACjD,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEO,MAAM,CAAC,SAAS,CAAC,KAAc;QACtC,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;IACvC,CAAC;CACD"}
@@ -1,13 +0,0 @@
1
- import OpenAI from 'openai';
2
- import { GraphQuery } from '../query/graph_query.js';
3
- export declare const PROPOSE_TOOL_NAME = "propose_optimization";
4
- export declare const AGENT_TOOLS: OpenAI.Chat.Completions.ChatCompletionTool[];
5
- export declare class AgentTools {
6
- private readonly query;
7
- private readonly rootPath;
8
- constructor(query: GraphQuery, rootPath: string);
9
- dispatch(name: string, input: Record<string, unknown>): Promise<string>;
10
- private readFile;
11
- private static stringify;
12
- }
13
- //# sourceMappingURL=agent_tools.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent_tools.d.ts","sourceRoot":"","sources":["../../src/agent/agent_tools.ts"],"names":[],"mappings":"AAEA,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,eAAO,MAAM,iBAAiB,yBAAyB,CAAC;AAExD,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,kBAAkB,EAyGnE,CAAC;AAEF,qBAAa,UAAU;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;gBAEtB,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM;IAKzC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;YAqB/D,QAAQ;IAetB,OAAO,CAAC,MAAM,CAAC,SAAS;CAGxB"}