ts-knowledge-graph 0.1.4 → 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 (136) hide show
  1. package/README.md +26 -8
  2. package/contribs/{web_visualisation → webview}/README.md +7 -7
  3. package/contribs/webview/web/css/style.css +310 -0
  4. package/contribs/{web_visualisation → webview}/web/index.html +40 -5
  5. package/contribs/{web_visualisation → webview}/web/js/app.js +378 -39
  6. package/contribs/{web_visualisation/web/data → webview/web/js_autogenerated}/kind_descriptions.js +2 -1
  7. package/contribs/{web_visualisation → webview}/web/types/app_globals.d.ts +11 -3
  8. package/dist/cli.d.ts.map +1 -1
  9. package/dist/cli.js +6 -2
  10. package/dist/cli.js.map +1 -1
  11. package/dist/cluster/cluster_weights.d.ts +20 -0
  12. package/dist/cluster/cluster_weights.d.ts.map +1 -0
  13. package/dist/cluster/cluster_weights.js +32 -0
  14. package/dist/cluster/cluster_weights.js.map +1 -0
  15. package/dist/cluster/community_detector.d.ts +61 -0
  16. package/dist/cluster/community_detector.d.ts.map +1 -0
  17. package/dist/cluster/community_detector.js +120 -0
  18. package/dist/cluster/community_detector.js.map +1 -0
  19. package/dist/cluster/community_labeler.d.ts +84 -0
  20. package/dist/cluster/community_labeler.d.ts.map +1 -0
  21. package/dist/cluster/community_labeler.js +194 -0
  22. package/dist/cluster/community_labeler.js.map +1 -0
  23. package/dist/cluster/graph_clusterer.d.ts +47 -0
  24. package/dist/cluster/graph_clusterer.d.ts.map +1 -0
  25. package/dist/cluster/graph_clusterer.js +126 -0
  26. package/dist/cluster/graph_clusterer.js.map +1 -0
  27. package/dist/commands/benchmark_command.d.ts.map +1 -1
  28. package/dist/commands/benchmark_command.js +13 -10
  29. package/dist/commands/benchmark_command.js.map +1 -1
  30. package/dist/commands/blast_radius_command.d.ts.map +1 -1
  31. package/dist/commands/blast_radius_command.js +6 -5
  32. package/dist/commands/blast_radius_command.js.map +1 -1
  33. package/dist/commands/cluster_command.d.ts +7 -0
  34. package/dist/commands/cluster_command.d.ts.map +1 -0
  35. package/dist/commands/cluster_command.js +55 -0
  36. package/dist/commands/cluster_command.js.map +1 -0
  37. package/dist/commands/command_helpers.d.ts +9 -4
  38. package/dist/commands/command_helpers.d.ts.map +1 -1
  39. package/dist/commands/command_helpers.js +13 -8
  40. package/dist/commands/command_helpers.js.map +1 -1
  41. package/dist/commands/cost_command.d.ts.map +1 -1
  42. package/dist/commands/cost_command.js +25 -8
  43. package/dist/commands/cost_command.js.map +1 -1
  44. package/dist/commands/enrich_command.d.ts.map +1 -1
  45. package/dist/commands/enrich_command.js +7 -5
  46. package/dist/commands/enrich_command.js.map +1 -1
  47. package/dist/commands/extract_command.d.ts.map +1 -1
  48. package/dist/commands/extract_command.js +12 -6
  49. package/dist/commands/extract_command.js.map +1 -1
  50. package/dist/commands/hotspots_command.d.ts.map +1 -1
  51. package/dist/commands/hotspots_command.js +6 -5
  52. package/dist/commands/hotspots_command.js.map +1 -1
  53. package/dist/commands/install_command.d.ts +15 -5
  54. package/dist/commands/install_command.d.ts.map +1 -1
  55. package/dist/commands/install_command.js +61 -23
  56. package/dist/commands/install_command.js.map +1 -1
  57. package/dist/commands/load_command.d.ts.map +1 -1
  58. package/dist/commands/load_command.js +18 -13
  59. package/dist/commands/load_command.js.map +1 -1
  60. package/dist/commands/neighbors_command.d.ts.map +1 -1
  61. package/dist/commands/neighbors_command.js +6 -5
  62. package/dist/commands/neighbors_command.js.map +1 -1
  63. package/dist/commands/references_command.d.ts.map +1 -1
  64. package/dist/commands/references_command.js +6 -5
  65. package/dist/commands/references_command.js.map +1 -1
  66. package/dist/commands/report_command.d.ts +16 -0
  67. package/dist/commands/report_command.d.ts.map +1 -0
  68. package/dist/commands/report_command.js +115 -0
  69. package/dist/commands/report_command.js.map +1 -0
  70. package/dist/commands/webview_command.d.ts +36 -0
  71. package/dist/commands/webview_command.d.ts.map +1 -0
  72. package/dist/commands/webview_command.js +186 -0
  73. package/dist/commands/webview_command.js.map +1 -0
  74. package/dist/enrich/cpu_profile.d.ts +33 -0
  75. package/dist/enrich/cpu_profile.d.ts.map +1 -1
  76. package/dist/enrich/cpu_profile.js +88 -0
  77. package/dist/enrich/cpu_profile.js.map +1 -1
  78. package/dist/enrich/runtime_enricher.d.ts +8 -0
  79. package/dist/enrich/runtime_enricher.d.ts.map +1 -1
  80. package/dist/enrich/runtime_enricher.js +18 -0
  81. package/dist/enrich/runtime_enricher.js.map +1 -1
  82. package/dist/enrich/runtime_join.d.ts +25 -1
  83. package/dist/enrich/runtime_join.d.ts.map +1 -1
  84. package/dist/enrich/runtime_join.js +43 -0
  85. package/dist/enrich/runtime_join.js.map +1 -1
  86. package/dist/extract/git_source.d.ts +23 -0
  87. package/dist/extract/git_source.d.ts.map +1 -0
  88. package/dist/extract/git_source.js +75 -0
  89. package/dist/extract/git_source.js.map +1 -0
  90. package/dist/query/graph_query.d.ts +36 -1
  91. package/dist/query/graph_query.d.ts.map +1 -1
  92. package/dist/query/graph_query.js +69 -6
  93. package/dist/query/graph_query.js.map +1 -1
  94. package/dist/report/graph_report.d.ts +51 -0
  95. package/dist/report/graph_report.d.ts.map +1 -0
  96. package/dist/report/graph_report.js +312 -0
  97. package/dist/report/graph_report.js.map +1 -0
  98. package/dist/report/pdf_renderer.d.ts +22 -0
  99. package/dist/report/pdf_renderer.d.ts.map +1 -0
  100. package/dist/report/pdf_renderer.js +54 -0
  101. package/dist/report/pdf_renderer.js.map +1 -0
  102. package/dist/report/report_data.d.ts +128 -0
  103. package/dist/report/report_data.d.ts.map +1 -0
  104. package/dist/report/report_data.js +191 -0
  105. package/dist/report/report_data.js.map +1 -0
  106. package/dist/schema/edge.d.ts +5 -5
  107. package/dist/schema/edge.d.ts.map +1 -1
  108. package/dist/schema/edge.js +3 -0
  109. package/dist/schema/edge.js.map +1 -1
  110. package/dist/schema/source_manifest.d.ts +30 -0
  111. package/dist/schema/source_manifest.d.ts.map +1 -0
  112. package/dist/schema/source_manifest.js +21 -0
  113. package/dist/schema/source_manifest.js.map +1 -0
  114. package/dist/store/jsonl_reader.d.ts +4 -0
  115. package/dist/store/jsonl_reader.d.ts.map +1 -1
  116. package/dist/store/jsonl_reader.js +13 -1
  117. package/dist/store/jsonl_reader.js.map +1 -1
  118. package/dist/store/jsonl_store.d.ts +2 -1
  119. package/dist/store/jsonl_store.d.ts.map +1 -1
  120. package/dist/store/jsonl_store.js +4 -1
  121. package/dist/store/jsonl_store.js.map +1 -1
  122. package/dist/store/kuzu_store.d.ts +13 -0
  123. package/dist/store/kuzu_store.d.ts.map +1 -1
  124. package/dist/store/kuzu_store.js +29 -0
  125. package/dist/store/kuzu_store.js.map +1 -1
  126. package/dist/store/output_folder.d.ts +43 -0
  127. package/dist/store/output_folder.d.ts.map +1 -0
  128. package/dist/store/output_folder.js +61 -0
  129. package/dist/store/output_folder.js.map +1 -0
  130. package/dotclaude_folder/commands/code-graph-interview.md +123 -0
  131. package/dotclaude_folder/commands/code-graph-optimize.md +65 -0
  132. package/dotclaude_folder/skills/code-graph-query/SKILL.md +4 -4
  133. package/package.json +72 -62
  134. package/contribs/web_visualisation/web/css/style.css +0 -219
  135. package/contribs/web_visualisation/web/tsconfig.json +0 -18
  136. /package/contribs/{web_visualisation/web/data → webview/web/js_autogenerated}/.gitignore +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"extract_command.d.ts","sourceRoot":"","sources":["../../src/commands/extract_command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,qBAAa,cAAc;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;mBAWlB,GAAG;IAkBxB,OAAO,CAAC,MAAM,CAAC,cAAc;IAW7B,OAAO,CAAC,MAAM,CAAC,OAAO;CAOtB"}
1
+ {"version":3,"file":"extract_command.d.ts","sourceRoot":"","sources":["../../src/commands/extract_command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,qBAAa,cAAc;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;mBAWlB,GAAG;IAsBxB,OAAO,CAAC,MAAM,CAAC,cAAc;IAW7B,OAAO,CAAC,MAAM,CAAC,OAAO;CAOtB"}
@@ -1,15 +1,17 @@
1
1
  import { resolve } from 'node:path';
2
2
  import chalk from 'chalk';
3
+ import { GitSource } from '../extract/git_source.js';
3
4
  import { GraphBuilder } from '../extract/graph_builder.js';
4
5
  import { ProjectLoader } from '../extract/project_loader.js';
5
6
  import { JsonlStore } from '../store/jsonl_store.js';
6
- import { DEFAULT_GRAPH_DIR } from './command_helpers.js';
7
+ import { OutputFolder } from '../store/output_folder.js';
8
+ import { CommandHelpers } from './command_helpers.js';
7
9
  export class ExtractCommand {
8
10
  static register(program) {
9
- program
11
+ const command = program
10
12
  .command('extract')
11
- .argument('<root>', 'path to the TypeScript project to parse')
12
- .option('-o, --out <dir>', 'output directory for the JSONL graph', DEFAULT_GRAPH_DIR)
13
+ .argument('<root>', 'path to the TypeScript project to parse');
14
+ CommandHelpers.addOutputFolderOption(command)
13
15
  .option('--semantic', 'resolve heritage and CALLS edges (slower)', false)
14
16
  .action(async (root, options) => {
15
17
  await ExtractCommand.run(root, options);
@@ -17,15 +19,19 @@ export class ExtractCommand {
17
19
  }
18
20
  static async run(root, options) {
19
21
  const rootPath = resolve(root);
20
- const outPath = resolve(options.out);
22
+ const outPath = new OutputFolder(options.outputFolder).graphDir;
21
23
  console.log(chalk.cyan(`Loading project at ${rootPath} ...`));
22
24
  const project = ProjectLoader.load(rootPath);
23
25
  const builder = new GraphBuilder();
24
26
  builder.build(project, rootPath, { semantic: options.semantic });
25
27
  const nodes = builder.getNodes();
26
28
  const edges = builder.getEdges();
27
- await JsonlStore.write(outPath, nodes, edges);
29
+ const source = await GitSource.detect(rootPath);
30
+ await JsonlStore.write(outPath, nodes, edges, source);
28
31
  console.log(chalk.green(`✓ ${nodes.length} nodes, ${edges.length} edges -> ${outPath}`));
32
+ if (source !== undefined) {
33
+ console.log(chalk.gray(` source: ${source.baseUrl} @ ${source.commit.slice(0, 7)}${source.prefix === '' ? '' : ` (${source.prefix})`}`));
34
+ }
29
35
  ExtractCommand.printBreakdown(nodes, edges);
30
36
  }
31
37
  static printBreakdown(nodes, edges) {
@@ -1 +1 @@
1
- {"version":3,"file":"extract_command.js","sourceRoot":"","sources":["../../src/commands/extract_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAG7D,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAOzD,MAAM,OAAO,cAAc;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC/B,OAAO;aACL,OAAO,CAAC,SAAS,CAAC;aAClB,QAAQ,CAAC,QAAQ,EAAE,yCAAyC,CAAC;aAC7D,MAAM,CAAC,iBAAiB,EAAE,sCAAsC,EAAE,iBAAiB,CAAC;aACpF,MAAM,CAAC,YAAY,EAAE,2CAA2C,EAAE,KAAK,CAAC;aACxE,MAAM,CAAC,KAAK,EAAE,IAAY,EAAE,OAAuB,EAAE,EAAE;YACvD,MAAM,cAAc,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAY,EAAE,OAAuB;QAC7D,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAErC,OAAO,C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C,GAAG,CAAC,KAAK,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;QAC9C,CAAC;IACF,CAAC;IAEO,MAAM,CAAC,OAAO,CAAC,MAAgB;QACtC,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;QACzC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC5B,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACjD,CAAC;QACD,OAAO,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1D,CAAC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"hotspots_command.d.ts","sourceRoot":"","sources":["../../src/commands/hotspots_command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAYpC,qBAAa,eAAe;IAC3B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IA0BvC,OAAO,CAAC,MAAM,CAAC,KAAK;IAsBpB,OAAO,CAAC,MAAM,CAAC,WAAW;CAe1B"}
1
+ {"version":3,"file":"hotspots_command.d.ts","sourceRoot":"","sources":["../../src/commands/hotspots_command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,qBAAa,eAAe;IAC3B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IA0BvC,OAAO,CAAC,MAAM,CAAC,KAAK;IAsBpB,OAAO,CAAC,MAAM,CAAC,WAAW;CAe1B"}
@@ -1,12 +1,13 @@
1
1
  import chalk from 'chalk';
2
- import { CommandHelpers, DEFAULT_DB_PATH } from './command_helpers.js';
2
+ import { OutputFolder } from '../store/output_folder.js';
3
+ import { CommandHelpers } from './command_helpers.js';
3
4
  const METRICS = ['self-time', 'samples', 'callers', 'call-count', 'blast-radius'];
4
5
  export class HotspotsCommand {
5
6
  static register(program) {
6
- program
7
+ const command = program
7
8
  .command('hotspots')
8
- .description('rank nodes by optimization leverage (runtime self-time, fan-in, call-count, or blast radius)')
9
- .option('-d, --db <path>', 'Kùzu database path', DEFAULT_DB_PATH)
9
+ .description('rank nodes by optimization leverage (runtime self-time, fan-in, call-count, or blast radius)');
10
+ CommandHelpers.addOutputFolderOption(command)
10
11
  .option('--by <metric>', `ranking metric: ${METRICS.join(', ')} (default: self-time when enriched, else callers)`)
11
12
  .option('--limit <n>', 'maximum number of hotspots to return', '20')
12
13
  .option('--measured-only', 'restrict ranking to nodes that carry runtime metrics', false)
@@ -17,7 +18,7 @@ export class HotspotsCommand {
17
18
  process.exitCode = 1;
18
19
  return;
19
20
  }
20
- await CommandHelpers.withQuery(options.db, async (query) => {
21
+ await CommandHelpers.withQuery(new OutputFolder(options.outputFolder), async (query) => {
21
22
  const report = await query.hotspots({
22
23
  by: options.by,
23
24
  limit: Number(options.limit),
@@ -1 +1 @@
1
- {"version":3,"file":"hotspots_command.js","sourceRoot":"","sources":["../../src/commands/hotspots_command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,cAAc,EAAE,eAAe,EAAgB,MAAM,sBAAsB,CAAC;AAQrF,MAAM,OAAO,GAAoB,CAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,cAAc,CAAC,CAAC;AAEnG,MAAM,OAAO,eAAe;IAC3B,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC/B,OAAO;aACL,OAAO,CAAC,UAAU,CAAC;aACnB,WAAW,CAAC,8FAA8F,CAAC;aAC3G,MAAM,CAAC,iBAAiB,EA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CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC;QAChK,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,QAAQ,CAAC,MAAM,aAAa,CAAC,CAAC,CAAC;IACnE,CAAC;IAEO,MAAM,CAAC,WAAW,CAAC,MAAqB,EAAE,KAAa;QAC9D,IAAI,MAAM,KAAK,WAAW,EAAE,CAAC;YAC5B,OAAO,GAAG,KAAK,KAAK,CAAC;QACtB,CAAC;QACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,GAAG,KAAK,UAAU,CAAC;QAC3B,CAAC;QACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YAC1B,OAAO,GAAG,KAAK,UAAU,CAAC;QAC3B,CAAC;QACD,IAAI,MAAM,KAAK,YAAY,EAAE,CAAC;YAC7B,OAAO,GAAG,KAAK,QAAQ,CAAC;QACzB,CAAC;QACD,OAAO,GAAG,KAAK,WAAW,CAAC;IAC5B,CAAC;CACD"}
@@ -1,15 +1,25 @@
1
1
  import { Command } from 'commander';
2
+ /** Outcome of mirroring the bundled assets, as relative paths under `.claude/`. */
3
+ export type InstallResult = {
4
+ installed: string[];
5
+ skipped: string[];
6
+ };
2
7
  /**
3
- * Installs the bundled Claude Code skill into a target project so an agent can
4
- * query the knowledge graph through the ts-knowledge-graph CLI.
8
+ * Installs the bundled Claude Code assets every slash command and skill under
9
+ * `dotclaude_folder/` into a target project's `.claude/` directory, so an agent
10
+ * can drive the knowledge graph through the ts-knowledge-graph CLI.
5
11
  */
6
12
  export declare class InstallCommand {
7
13
  static register(program: Command): void;
8
14
  private static run;
9
15
  /**
10
- * Resolves the bundled SKILL.md from the package root, which works whether
11
- * running via tsx from `src` or from the built `dist` output.
16
+ * Copies every file under `sourceRoot` into `targetRoot`, preserving the
17
+ * relative tree (so `commands/` and `skills/` land where Claude Code reads
18
+ * them). Existing files are left untouched unless `force` is true. Returns the
19
+ * relative paths that were written and those that were skipped.
12
20
  */
13
- private static sourceSkillPath;
21
+ static mirror(sourceRoot: string, targetRoot: string, force: boolean): InstallResult;
22
+ /** Recursively collects every file path under a directory, depth-first. */
23
+ private static collectFiles;
14
24
  }
15
25
  //# sourceMappingURL=install_command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"install_command.d.ts","sourceRoot":"","sources":["../../src/commands/install_command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC;;;GAGG;AACH,qBAAa,cAAc;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;mBAWlB,GAAG;IAcxB;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,eAAe;CAG9B"}
1
+ {"version":3,"file":"install_command.d.ts","sourceRoot":"","sources":["../../src/commands/install_command.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAUpC,mFAAmF;AACnF,MAAM,MAAM,aAAa,GAAG;IAC3B,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AACH,qBAAa,cAAc;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;IAWvC,OAAO,CAAC,MAAM,CAAC,GAAG;IAsBlB;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,aAAa;IAqBpF,2EAA2E;IAC3E,OAAO,CAAC,MAAM,CAAC,YAAY;CAc3B"}
@@ -1,41 +1,79 @@
1
- import { copyFileSync, existsSync, mkdirSync } from 'node:fs';
2
- import { dirname, resolve } from 'node:path';
1
+ import { copyFileSync, existsSync, mkdirSync, readdirSync } from 'node:fs';
2
+ import { dirname, join, relative, resolve } from 'node:path';
3
3
  import chalk from 'chalk';
4
4
  import { PROJECT_ROOT } from '../project_root.js';
5
- const SKILL_SOURCE_PATH = 'dotclaude_folder/skills/code-graph-query/SKILL.md';
6
- const SKILL_TARGET_PATH = 'skills/code-graph-query/SKILL.md';
5
+ const SOURCE_DIR = 'dotclaude_folder';
6
+ const TARGET_DIR = '.claude';
7
7
  /**
8
- * Installs the bundled Claude Code skill into a target project so an agent can
9
- * query the knowledge graph through the ts-knowledge-graph CLI.
8
+ * Installs the bundled Claude Code assets every slash command and skill under
9
+ * `dotclaude_folder/` into a target project's `.claude/` directory, so an agent
10
+ * can drive the knowledge graph through the ts-knowledge-graph CLI.
10
11
  */
11
12
  export class InstallCommand {
12
13
  static register(program) {
13
14
  program
14
15
  .command('install')
15
- .description('install the ts-knowledge-graph Claude Code skill into a project')
16
- .argument('[destFolder]', 'project root to install the skill into', process.cwd())
17
- .option('--force', 'overwrite an existing SKILL.md', false)
18
- .action(async (destFolder, options) => {
19
- await InstallCommand.run(destFolder, options);
16
+ .description('install the ts-knowledge-graph Claude Code commands and skills into a project')
17
+ .argument('[destFolder]', "project root to install into (its '.claude/' directory)", process.cwd())
18
+ .option('--force', 'overwrite files that already exist', false)
19
+ .action((destFolder, options) => {
20
+ InstallCommand.run(destFolder, options);
20
21
  });
21
22
  }
22
- static async run(destFolder, options) {
23
- const source = InstallCommand.sourceSkillPath();
24
- const target = resolve(destFolder, SKILL_TARGET_PATH);
25
- if (existsSync(target) === true && options.force === false) {
26
- console.log(chalk.yellow(`✗ ${target} already exists — pass --force to overwrite`));
23
+ static run(destFolder, options) {
24
+ const sourceRoot = resolve(PROJECT_ROOT, SOURCE_DIR);
25
+ if (existsSync(sourceRoot) === false) {
26
+ console.log(chalk.red(`✗ bundled assets not found at ${sourceRoot}`));
27
27
  return;
28
28
  }
29
- mkdirSync(dirname(target), { recursive: true });
30
- copyFileSync(source, target);
31
- console.log(chalk.green(`✓ installed skill -> ${target}`));
29
+ const targetRoot = resolve(destFolder, TARGET_DIR);
30
+ const result = InstallCommand.mirror(sourceRoot, targetRoot, options.force);
31
+ for (const rel of result.installed) {
32
+ console.log(chalk.green(`✓ ${rel}`));
33
+ }
34
+ for (const rel of result.skipped) {
35
+ console.log(chalk.yellow(`✗ skip (exists): ${rel}`));
36
+ }
37
+ const summary = `installed ${result.installed.length} file(s) into ${targetRoot}`;
38
+ const hint = result.skipped.length > 0 ? `, skipped ${result.skipped.length} (pass --force to overwrite)` : '';
39
+ console.log(chalk.bold(`\n${summary}${hint}`));
32
40
  }
33
41
  /**
34
- * Resolves the bundled SKILL.md from the package root, which works whether
35
- * running via tsx from `src` or from the built `dist` output.
42
+ * Copies every file under `sourceRoot` into `targetRoot`, preserving the
43
+ * relative tree (so `commands/` and `skills/` land where Claude Code reads
44
+ * them). Existing files are left untouched unless `force` is true. Returns the
45
+ * relative paths that were written and those that were skipped.
36
46
  */
37
- static sourceSkillPath() {
38
- return resolve(PROJECT_ROOT, SKILL_SOURCE_PATH);
47
+ static mirror(sourceRoot, targetRoot, force) {
48
+ const installed = [];
49
+ const skipped = [];
50
+ for (const source of InstallCommand.collectFiles(sourceRoot)) {
51
+ const rel = relative(sourceRoot, source);
52
+ const target = join(targetRoot, rel);
53
+ if (existsSync(target) === true && force === false) {
54
+ skipped.push(rel);
55
+ continue;
56
+ }
57
+ mkdirSync(dirname(target), { recursive: true });
58
+ copyFileSync(source, target);
59
+ installed.push(rel);
60
+ }
61
+ return { installed, skipped };
62
+ }
63
+ /** Recursively collects every file path under a directory, depth-first. */
64
+ static collectFiles(dir) {
65
+ const files = [];
66
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
67
+ const full = join(dir, entry.name);
68
+ if (entry.isDirectory() === true) {
69
+ files.push(...InstallCommand.collectFiles(full));
70
+ continue;
71
+ }
72
+ if (entry.isFile() === true) {
73
+ files.push(full);
74
+ }
75
+ }
76
+ return files;
39
77
  }
40
78
  }
41
79
  //# sourceMappingURL=install_command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"install_command.js","sourceRoot":"","sources":["../../src/commands/install_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,iBAAiB,GAAG,mDAAmD,CAAC;AAC9E,MAAM,iBAAiB,GAAG,kCAAkC,CAAC;AAM7D;;;GAGG;AACH,MAAM,OAAO,cAAc;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC/B,OAAO;aACL,OAAO,CAAC,SAAS,CAAC;aAClB,WAAW,CAAC,iEAAiE,CAAC;aAC9E,QAAQ,CAAC,cAAc,EAAE,wCAAwC,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC;aACjF,MAAM,CAAC,SAAS,EAAE,gCAAgC,EAAE,KAAK,CAAC;aAC1D,MAAM,CAAC,KAAK,EAAE,UAAkB,EAAE,OAAuB,EAAE,EAAE;YAC7D,MAAM,cAAc,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC;IAEO,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,UAAkB,EAAE,OAAuB;QACnE,MAAM,MAAM,GAAG,cAAc,CAAC,eAAe,EAAE,CAAC;QAChD,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;QAEtD,IAAI,UAAU,CAAC,MAAM,CAAC,KAAK,IA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CAAC,CAAC,CAAC;gBACjD,SAAS;YACV,CAAC;YACD,IAAI,KAAK,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE,CAAC;gBAC7B,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAClB,CAAC;QACF,CAAC;QACD,OAAO,KAAK,CAAC;IACd,CAAC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"load_command.d.ts","sourceRoot":"","sources":["../../src/commands/load_command.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,qBAAa,WAAW;IACvB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;mBAWlB,GAAG;CAWxB"}
1
+ {"version":3,"file":"load_command.d.ts","sourceRoot":"","sources":["../../src/commands/load_command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQpC,qBAAa,WAAW;IACvB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;mBAUlB,GAAG;CAexB"}
@@ -1,27 +1,32 @@
1
- import { resolve } from 'node:path';
2
1
  import chalk from 'chalk';
3
2
  import { RUNTIME_MANIFEST_KEY } from '../schema/runtime_manifest.js';
3
+ import { SOURCE_MANIFEST_KEY } from '../schema/source_manifest.js';
4
4
  import { JsonlReader } from '../store/jsonl_reader.js';
5
5
  import { KuzuStore } from '../store/kuzu_store.js';
6
- import { DEFAULT_DB_PATH, DEFAULT_GRAPH_DIR } from './command_helpers.js';
6
+ import { OutputFolder } from '../store/output_folder.js';
7
+ import { CommandHelpers } from './command_helpers.js';
7
8
  export class LoadCommand {
8
9
  static register(program) {
9
- program
10
+ const command = program
10
11
  .command('load')
11
- .description('load a JSONL graph into an embedded Kùzu database')
12
- .argument('[graphDir]', 'directory holding nodes.jsonl and edges.jsonl', DEFAULT_GRAPH_DIR)
13
- .option('-d, --db <path>', 'Kùzu database path', DEFAULT_DB_PATH)
14
- .action(async (graphDir, options) => {
15
- await LoadCommand.run(graphDir, options.db);
12
+ .description('load a JSONL graph into an embedded Kùzu database');
13
+ CommandHelpers.addOutputFolderOption(command)
14
+ .action(async (options) => {
15
+ await LoadCommand.run(new OutputFolder(options.outputFolder));
16
16
  });
17
17
  }
18
- static async run(graphDir, dbPath) {
19
- const resolvedDb = resolve(dbPath);
20
- console.log(chalk.cyan(`Loading ${resolve(graphDir)} into ${resolvedDb} ...`));
21
- const { nodes, edges } = await JsonlReader.read(resolve(graphDir));
22
- const store = new KuzuStore(resolvedDb);
18
+ static async run(folder) {
19
+ console.log(chalk.cyan(`Loading ${folder.graphDir} into ${folder.dbPath} ...`));
20
+ const { nodes, edges, source } = await JsonlReader.read(folder.graphDir);
21
+ const store = new KuzuStore(folder.dbPath);
23
22
  await store.initSchema();
24
23
  await store.load(nodes, edges);
24
+ if (source === undefined) {
25
+ await store.clearGraphMeta(SOURCE_MANIFEST_KEY);
26
+ }
27
+ else {
28
+ await store.writeGraphMeta(SOURCE_MANIFEST_KEY, source);
29
+ }
25
30
  await store.clearGraphMeta(RUNTIME_MANIFEST_KEY);
26
31
  await store.close();
27
32
  console.log(chalk.green(`✓ loaded ${nodes.length} nodes, ${edges.length} edges`));
@@ -1 +1 @@
1
- {"version":3,"file":"load_command.js","sourceRoot":"","sources":["../../src/commands/load_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE1E,MAAM,OAAO,WAAW;IACvB,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC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AC1B,MAAM,KAAK,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC;QACjD,CAAC;aAAM,CAAC;YACP,MAAM,KAAK,CAAC,cAAc,CAAC,mBAAmB,EAAE,MAAM,CAAC,CAAC;QACzD,CAAC;QACD,MAAM,KAAK,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;QACjD,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,YAAY,KAAK,CAAC,MAAM,WAAW,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC,CAAC;IACnF,CAAC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"neighbors_command.d.ts","sourceRoot":"","sources":["../../src/commands/neighbors_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,qBAAa,gBAAgB;IAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAavC"}
1
+ {"version":3,"file":"neighbors_command.d.ts","sourceRoot":"","sources":["../../src/commands/neighbors_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,qBAAa,gBAAgB;IAC5B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAavC"}
@@ -1,14 +1,15 @@
1
- import { CommandHelpers, DEFAULT_DB_PATH } from './command_helpers.js';
1
+ import { OutputFolder } from '../store/output_folder.js';
2
+ import { CommandHelpers } from './command_helpers.js';
2
3
  export class NeighborsCommand {
3
4
  static register(program) {
4
- program
5
+ const command = program
5
6
  .command('neighbors')
6
7
  .description('show the one-hop neighbourhood of <id>')
7
- .argument('<id>', 'node id to inspect')
8
- .option('-d, --db <path>', 'Kùzu database path', DEFAULT_DB_PATH)
8
+ .argument('<id>', 'node id to inspect');
9
+ CommandHelpers.addOutputFolderOption(command)
9
10
  .option('--json', 'emit raw JSON', false)
10
11
  .action(async (id, options) => {
11
- await CommandHelpers.withQuery(options.db, async (query) => {
12
+ await CommandHelpers.withQuery(new OutputFolder(options.outputFolder), async (query) => {
12
13
  CommandHelpers.printNeighbors(await query.neighborhood(id), options.json === true);
13
14
  });
14
15
  });
@@ -1 +1 @@
1
- {"version":3,"file":"neighbors_command.js","sourceRoot":"","sources":["../../src/commands/neighbors_command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAgB,MAAM,sBAAsB,CAAC;AAErF,MAAM,OAAO,gBAAgB;IAC5B,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC/B,OAAO;aACL,OAAO,CAAC,WAAW,CAAC;aACpB,WAAW,CAAC,wCAAwC,CAAC;aACrD,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;aACtC,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,CAAC;aAChE,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;aACxC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,OAAqB,EAAE,EAAE;YACnD,MAAM,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBAC1D,cAAc,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACD"}
1
+ {"version":3,"file":"neighbors_command.js","sourceRoot":"","sources":["../../src/commands/neighbors_command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAC;AAEpE,MAAM,OAAO,gBAAgB;IAC5B,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC/B,MAAM,OAAO,GAAG,OAAO;aACrB,OAAO,CAAC,WAAW,CAAC;aACpB,WAAW,CAAC,wCAAwC,CAAC;aACrD,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;QACzC,cAAc,CAAC,qBAAqB,CAAC,OAAO,CAAC;aAC3C,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;aACxC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,OAAqB,EAAE,EAAE;YACnD,MAAM,cAAc,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACtF,cAAc,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YACpF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACD"}
@@ -1 +1 @@
1
- {"version":3,"file":"references_command.d.ts","sourceRoot":"","sources":["../../src/commands/references_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,qBAAa,iBAAiB;IAC7B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAavC"}
1
+ {"version":3,"file":"references_command.d.ts","sourceRoot":"","sources":["../../src/commands/references_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,qBAAa,iBAAiB;IAC7B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;CAavC"}
@@ -1,14 +1,15 @@
1
- import { CommandHelpers, DEFAULT_DB_PATH } from './command_helpers.js';
1
+ import { OutputFolder } from '../store/output_folder.js';
2
+ import { CommandHelpers } from './command_helpers.js';
2
3
  export class ReferencesCommand {
3
4
  static register(program) {
4
- program
5
+ const command = program
5
6
  .command('references')
6
7
  .description('list everything that references <id> (calls, type usage, heritage, new)')
7
- .argument('<id>', 'node id to inspect')
8
- .option('-d, --db <path>', 'Kùzu database path', DEFAULT_DB_PATH)
8
+ .argument('<id>', 'node id to inspect');
9
+ CommandHelpers.addOutputFolderOption(command)
9
10
  .option('--json', 'emit raw JSON', false)
10
11
  .action(async (id, options) => {
11
- await CommandHelpers.withQuery(options.db, async (query) => {
12
+ await CommandHelpers.withQuery(new OutputFolder(options.outputFolder), async (query) => {
12
13
  CommandHelpers.printNeighbors(await query.references(id), options.json === true);
13
14
  });
14
15
  });
@@ -1 +1 @@
1
- {"version":3,"file":"references_command.js","sourceRoot":"","sources":["../../src/commands/references_command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAgB,MAAM,sBAAsB,CAAC;AAErF,MAAM,OAAO,iBAAiB;IAC7B,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC/B,OAAO;aACL,OAAO,CAAC,YAAY,CAAC;aACrB,WAAW,CAAC,yEAAyE,CAAC;aACtF,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC;aACtC,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,EAAE,eAAe,CAAC;aAChE,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;aACxC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,OAAqB,EAAE,EAAE;YACnD,MAAM,cAAc,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBAC1D,cAAc,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YAClF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACD"}
1
+ {"version":3,"file":"references_command.js","sourceRoot":"","sources":["../../src/commands/references_command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAgB,MAAM,sBAAsB,CAAC;AAEpE,MAAM,OAAO,iBAAiB;IAC7B,MAAM,CAAC,QAAQ,CAAC,OAAgB;QAC/B,MAAM,OAAO,GAAG,OAAO;aACrB,OAAO,CAAC,YAAY,CAAC;aACrB,WAAW,CAAC,yEAAyE,CAAC;aACtF,QAAQ,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;QACzC,cAAc,CAAC,qBAAqB,CAAC,OAAO,CAAC;aAC3C,MAAM,CAAC,QAAQ,EAAE,eAAe,EAAE,KAAK,CAAC;aACxC,MAAM,CAAC,KAAK,EAAE,EAAU,EAAE,OAAqB,EAAE,EAAE;YACnD,MAAM,cAAc,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;gBACtF,cAAc,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,UAAU,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;YAClF,CAAC,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACD"}
@@ -0,0 +1,16 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `report` command — gathers a {@link GraphReportData} from the loaded graph and
4
+ * writes a CODEBASE_BRIEF in the chosen format. `markdown` and `json` come
5
+ * straight from the pure {@link GraphReport} renderer; `pdf` renders the visual
6
+ * HTML and converts it through the optional {@link PdfRenderer}, falling back to
7
+ * the HTML when no engine is installed.
8
+ */
9
+ export declare class ReportCommand {
10
+ static register(program: Command): void;
11
+ private static run;
12
+ private static gather;
13
+ private static emitPdf;
14
+ private static clampLimit;
15
+ }
16
+ //# sourceMappingURL=report_command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report_command.d.ts","sourceRoot":"","sources":["../../src/commands/report_command.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAwBpC;;;;;;GAMG;AACH,qBAAa,aAAa;IACzB,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;mBAclB,GAAG;mBA6BH,MAAM;mBAgBN,OAAO;IAuB5B,OAAO,CAAC,MAAM,CAAC,UAAU;CAWzB"}
@@ -0,0 +1,115 @@
1
+ import { existsSync } from 'node:fs';
2
+ import { writeFile } from 'node:fs/promises';
3
+ import { basename } from 'node:path';
4
+ import chalk from 'chalk';
5
+ import { GraphQuery } from '../query/graph_query.js';
6
+ import { GraphReport } from '../report/graph_report.js';
7
+ import { ReportData } from '../report/report_data.js';
8
+ import { PdfRenderer, PdfUnavailableError } from '../report/pdf_renderer.js';
9
+ import { KuzuStore } from '../store/kuzu_store.js';
10
+ import { OutputFolder } from '../store/output_folder.js';
11
+ import { CommandHelpers } from './command_helpers.js';
12
+ const FORMATS = ['markdown', 'pdf', 'json'];
13
+ const EXTENSION = { markdown: 'md', pdf: 'pdf', json: 'json' };
14
+ const DEFAULT_LIMIT = 10;
15
+ const MAX_LIMIT = 100;
16
+ /**
17
+ * `report` command — gathers a {@link GraphReportData} from the loaded graph and
18
+ * writes a CODEBASE_BRIEF in the chosen format. `markdown` and `json` come
19
+ * straight from the pure {@link GraphReport} renderer; `pdf` renders the visual
20
+ * HTML and converts it through the optional {@link PdfRenderer}, falling back to
21
+ * the HTML when no engine is installed.
22
+ */
23
+ export class ReportCommand {
24
+ static register(program) {
25
+ const command = program
26
+ .command('report')
27
+ .description('generate a CODEBASE_BRIEF summarising structure, impact, runtime, and boundary');
28
+ CommandHelpers.addOutputFolderOption(command)
29
+ .option('--format <format>', `output format: ${FORMATS.join(', ')}`, 'markdown')
30
+ .option('--output <file>', 'output file (default: <output-folder>/CODEBASE_BRIEF.<ext>)')
31
+ .option('--limit <n>', 'maximum rows per ranking', String(DEFAULT_LIMIT))
32
+ .option('--stdout', 'write to stdout instead of a file (markdown/json only)', false)
33
+ .action(async (options) => {
34
+ await ReportCommand.run(options);
35
+ });
36
+ }
37
+ static async run(options) {
38
+ if (FORMATS.includes(options.format) === false) {
39
+ console.error(chalk.red(`unknown format '${options.format}' — choose one of: ${FORMATS.join(', ')}`));
40
+ process.exitCode = 1;
41
+ return;
42
+ }
43
+ const format = options.format;
44
+ const folder = new OutputFolder(options.outputFolder);
45
+ if (existsSync(folder.dbPath) === false) {
46
+ console.error(chalk.red(`database not found at ${folder.dbPath} — run \`extract\` then \`load\` first`));
47
+ process.exitCode = 1;
48
+ return;
49
+ }
50
+ const data = await ReportCommand.gather(folder, options);
51
+ if (format === 'pdf') {
52
+ await ReportCommand.emitPdf(data, folder, options);
53
+ return;
54
+ }
55
+ const content = GraphReport.render(data, format);
56
+ if (options.stdout === true) {
57
+ console.log(content);
58
+ return;
59
+ }
60
+ const outPath = options.output ?? folder.reportPath(EXTENSION[format]);
61
+ await writeFile(outPath, content, 'utf8');
62
+ console.log(chalk.green(`✓ wrote ${outPath}`));
63
+ }
64
+ static async gather(folder, options) {
65
+ const store = new KuzuStore(folder.dbPath);
66
+ await store.initSchema();
67
+ try {
68
+ const query = new GraphQuery(store);
69
+ return await ReportData.gather(store, query, {
70
+ generatedAt: new Date().toISOString().slice(0, 10),
71
+ project: basename(folder.path),
72
+ outputFolder: options.outputFolder,
73
+ limit: ReportCommand.clampLimit(options.limit),
74
+ });
75
+ }
76
+ finally {
77
+ await store.close();
78
+ }
79
+ }
80
+ static async emitPdf(data, folder, options) {
81
+ if (options.stdout === true) {
82
+ console.error(chalk.red('--stdout is not supported for --format pdf — choose markdown or json, or drop --stdout'));
83
+ process.exitCode = 1;
84
+ return;
85
+ }
86
+ const outPath = options.output ?? folder.reportPath('pdf');
87
+ const html = GraphReport.renderVisualHtml(data);
88
+ try {
89
+ const pdf = await PdfRenderer.fromHtml(html);
90
+ await writeFile(outPath, pdf);
91
+ console.log(chalk.green(`✓ wrote ${outPath}`));
92
+ }
93
+ catch (error) {
94
+ if (error instanceof PdfUnavailableError === false) {
95
+ throw error;
96
+ }
97
+ const htmlPath = outPath.replace(/\.pdf$/, '.html');
98
+ await writeFile(htmlPath, html, 'utf8');
99
+ console.warn(chalk.yellow(`! ${error.message}`));
100
+ console.warn(chalk.yellow(` wrote the HTML layout to ${htmlPath} — open it and print to PDF, or install the engine for direct PDF output.`));
101
+ }
102
+ }
103
+ static clampLimit(value) {
104
+ const parsed = Number(value);
105
+ if (Number.isFinite(parsed) === false) {
106
+ return DEFAULT_LIMIT;
107
+ }
108
+ const floored = Math.floor(parsed);
109
+ if (floored < 1) {
110
+ return DEFAULT_LIMIT;
111
+ }
112
+ return floored > MAX_LIMIT ? MAX_LIMIT : floored;
113
+ }
114
+ }
115
+ //# sourceMappingURL=report_command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report_command.js","sourceRoot":"","sources":["../../src/commands/report_command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAmB,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAItD,MAAM,OAAO,GAAmB,CAAC,UAAU,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;AAC5D,MAAM,SA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EAAE,CAAC;gBACpD,MAAM,KAAK,CAAC;YACb,CAAC;YACD,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;YACpD,MAAM,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;YACxC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACjD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,8BAA8B,QAAQ,2EAA2E,CAAC,CAAC,CAAC;QAC/I,CAAC;IACF,CAAC;IAEO,MAAM,CAAC,UAAU,CAAC,KAAa;QACtC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE,CAAC;YACvC,OAAO,aAAa,CAAC;QACtB,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YACjB,OAAO,aAAa,CAAC;QACtB,CAAC;QACD,OAAO,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC;IAClD,CAAC;CACD"}
@@ -0,0 +1,36 @@
1
+ import { Command } from 'commander';
2
+ /**
3
+ * `webview` command — serves the knowledge graph database in an interactive web
4
+ * visualisation. The graph is read from Kùzu once at startup and injected into
5
+ * the page as `/js_autogenerated/graph_data.js`; all other assets are served statically
6
+ * from the contribs/webview/web directory.
7
+ */
8
+ export declare class WebviewCommand {
9
+ static register(program: Command): void;
10
+ private static run;
11
+ /**
12
+ * Reads every node and edge from the database and renders them as the
13
+ * `window.GRAPH_DATA` script the visualisation page loads on boot.
14
+ */
15
+ private static buildDataScript;
16
+ /**
17
+ * Decodes the JSON `metadata` column into a record so the visualisation can
18
+ * read `metadata.runtime`. A missing, empty (`{}`), or malformed value yields
19
+ * `undefined`, which `JSON.stringify` omits — keeping the payload small and
20
+ * letting un-enriched nodes simply carry no metadata.
21
+ */
22
+ private static decodeMetadata;
23
+ /**
24
+ * Resolves the GitHub source for the served graph. Prefers the provenance
25
+ * `extract` recorded in the database — it pins the exact commit and in-repo
26
+ * `prefix` that was parsed — and falls back to detecting it live from
27
+ * `sourceDir` for graphs built before provenance was captured. Returns
28
+ * `undefined` when neither is available, so the page shows plain-text paths.
29
+ */
30
+ private static resolveGitHubSource;
31
+ /** Reads the source provenance `load` stored in the database, or `undefined` when absent or malformed. */
32
+ private static readStoredSource;
33
+ private static handle;
34
+ private static notFound;
35
+ }
36
+ //# sourceMappingURL=webview_command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webview_command.d.ts","sourceRoot":"","sources":["../../src/commands/webview_command.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA+BpC;;;;;GAKG;AACH,qBAAa,cAAc;IAC1B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI;mBAYlB,GAAG;IAqBxB;;;OAGG;mBACkB,eAAe;IAsCpC;;;;;OAKG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAe7B;;;;;;OAMG;mBACkB,mBAAmB;IAexC,0GAA0G;mBACrF,gBAAgB;mBAehB,MAAM;IAwB3B,OAAO,CAAC,MAAM,CAAC,QAAQ;CAIvB"}