@vyuhlabs/dxkit 2.5.2 → 2.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (264) hide show
  1. package/CHANGELOG.md +218 -13
  2. package/README.md +220 -369
  3. package/dist/allowlist/categories.d.ts +120 -0
  4. package/dist/allowlist/categories.d.ts.map +1 -0
  5. package/dist/allowlist/categories.js +194 -0
  6. package/dist/allowlist/categories.js.map +1 -0
  7. package/dist/allowlist/cli.d.ts +95 -0
  8. package/dist/allowlist/cli.d.ts.map +1 -0
  9. package/dist/allowlist/cli.js +454 -0
  10. package/dist/allowlist/cli.js.map +1 -0
  11. package/dist/allowlist/diff.d.ts +67 -0
  12. package/dist/allowlist/diff.d.ts.map +1 -0
  13. package/dist/allowlist/diff.js +147 -0
  14. package/dist/allowlist/diff.js.map +1 -0
  15. package/dist/allowlist/file.d.ts +249 -0
  16. package/dist/allowlist/file.d.ts.map +1 -0
  17. package/dist/allowlist/file.js +497 -0
  18. package/dist/allowlist/file.js.map +1 -0
  19. package/dist/allowlist/gather.d.ts +61 -0
  20. package/dist/allowlist/gather.d.ts.map +1 -0
  21. package/dist/allowlist/gather.js +143 -0
  22. package/dist/allowlist/gather.js.map +1 -0
  23. package/dist/allowlist/hint.d.ts +80 -0
  24. package/dist/allowlist/hint.d.ts.map +1 -0
  25. package/dist/allowlist/hint.js +271 -0
  26. package/dist/allowlist/hint.js.map +1 -0
  27. package/dist/allowlist/inline.d.ts +149 -0
  28. package/dist/allowlist/inline.d.ts.map +1 -0
  29. package/dist/allowlist/inline.js +306 -0
  30. package/dist/allowlist/inline.js.map +1 -0
  31. package/dist/analyzers/bom/discovery.d.ts +3 -4
  32. package/dist/analyzers/bom/discovery.d.ts.map +1 -1
  33. package/dist/analyzers/bom/discovery.js +3 -4
  34. package/dist/analyzers/bom/discovery.js.map +1 -1
  35. package/dist/analyzers/bom/types.d.ts +1 -1
  36. package/dist/analyzers/dashboard/index.d.ts.map +1 -1
  37. package/dist/analyzers/dashboard/index.js +42 -5
  38. package/dist/analyzers/dashboard/index.js.map +1 -1
  39. package/dist/analyzers/quality/detailed.d.ts +8 -1
  40. package/dist/analyzers/quality/detailed.d.ts.map +1 -1
  41. package/dist/analyzers/quality/detailed.js +43 -10
  42. package/dist/analyzers/quality/detailed.js.map +1 -1
  43. package/dist/analyzers/security/detailed.d.ts +8 -1
  44. package/dist/analyzers/security/detailed.d.ts.map +1 -1
  45. package/dist/analyzers/security/detailed.js +14 -1
  46. package/dist/analyzers/security/detailed.js.map +1 -1
  47. package/dist/analyzers/tests/detailed.d.ts +8 -1
  48. package/dist/analyzers/tests/detailed.d.ts.map +1 -1
  49. package/dist/analyzers/tests/detailed.js +26 -7
  50. package/dist/analyzers/tests/detailed.js.map +1 -1
  51. package/dist/analyzers/tools/cloc.js +3 -3
  52. package/dist/analyzers/tools/cloc.js.map +1 -1
  53. package/dist/analyzers/tools/exclusions.d.ts +12 -12
  54. package/dist/analyzers/tools/exclusions.d.ts.map +1 -1
  55. package/dist/analyzers/tools/exclusions.js +27 -13
  56. package/dist/analyzers/tools/exclusions.js.map +1 -1
  57. package/dist/analyzers/tools/graphify.d.ts +39 -5
  58. package/dist/analyzers/tools/graphify.d.ts.map +1 -1
  59. package/dist/analyzers/tools/graphify.js +609 -45
  60. package/dist/analyzers/tools/graphify.js.map +1 -1
  61. package/dist/analyzers/tools/nuget-package-reference.d.ts +4 -4
  62. package/dist/analyzers/tools/nuget-package-reference.js +4 -4
  63. package/dist/analyzers/tools/osv-scanner-fix.d.ts +4 -5
  64. package/dist/analyzers/tools/osv-scanner-fix.d.ts.map +1 -1
  65. package/dist/analyzers/tools/osv-scanner-fix.js +4 -5
  66. package/dist/analyzers/tools/osv-scanner-fix.js.map +1 -1
  67. package/dist/analyzers/tools/parallel.d.ts.map +1 -1
  68. package/dist/analyzers/tools/parallel.js +7 -0
  69. package/dist/analyzers/tools/parallel.js.map +1 -1
  70. package/dist/analyzers/tools/vendored-advisor.d.ts.map +1 -1
  71. package/dist/analyzers/tools/vendored-advisor.js +3 -4
  72. package/dist/analyzers/tools/vendored-advisor.js.map +1 -1
  73. package/dist/analyzers/xlsx/licenses.d.ts +7 -7
  74. package/dist/analyzers/xlsx/licenses.js +7 -7
  75. package/dist/baseline/baseline-file.d.ts +7 -0
  76. package/dist/baseline/baseline-file.d.ts.map +1 -1
  77. package/dist/baseline/baseline-file.js +22 -1
  78. package/dist/baseline/baseline-file.js.map +1 -1
  79. package/dist/baseline/check-renderers.d.ts +13 -1
  80. package/dist/baseline/check-renderers.d.ts.map +1 -1
  81. package/dist/baseline/check-renderers.js +67 -1
  82. package/dist/baseline/check-renderers.js.map +1 -1
  83. package/dist/baseline/check.d.ts +33 -7
  84. package/dist/baseline/check.d.ts.map +1 -1
  85. package/dist/baseline/check.js +90 -64
  86. package/dist/baseline/check.js.map +1 -1
  87. package/dist/baseline/create.d.ts +35 -7
  88. package/dist/baseline/create.d.ts.map +1 -1
  89. package/dist/baseline/create.js +43 -5
  90. package/dist/baseline/create.js.map +1 -1
  91. package/dist/baseline/entry-to-located.d.ts +6 -1
  92. package/dist/baseline/entry-to-located.d.ts.map +1 -1
  93. package/dist/baseline/entry-to-located.js +20 -2
  94. package/dist/baseline/entry-to-located.js.map +1 -1
  95. package/dist/baseline/finding-identity.d.ts.map +1 -1
  96. package/dist/baseline/finding-identity.js +15 -13
  97. package/dist/baseline/finding-identity.js.map +1 -1
  98. package/dist/baseline/modes.d.ts +140 -0
  99. package/dist/baseline/modes.d.ts.map +1 -0
  100. package/dist/baseline/modes.js +179 -0
  101. package/dist/baseline/modes.js.map +1 -0
  102. package/dist/baseline/policy.d.ts +64 -0
  103. package/dist/baseline/policy.d.ts.map +1 -1
  104. package/dist/baseline/policy.js +102 -1
  105. package/dist/baseline/policy.js.map +1 -1
  106. package/dist/baseline/producers/health.d.ts +2 -2
  107. package/dist/baseline/producers/health.d.ts.map +1 -1
  108. package/dist/baseline/producers/health.js.map +1 -1
  109. package/dist/baseline/producers/index.d.ts +11 -5
  110. package/dist/baseline/producers/index.d.ts.map +1 -1
  111. package/dist/baseline/producers/index.js +12 -9
  112. package/dist/baseline/producers/index.js.map +1 -1
  113. package/dist/baseline/producers/quality.d.ts +3 -3
  114. package/dist/baseline/producers/quality.d.ts.map +1 -1
  115. package/dist/baseline/producers/quality.js.map +1 -1
  116. package/dist/baseline/producers/secret-hmac.d.ts +2 -2
  117. package/dist/baseline/producers/secret-hmac.d.ts.map +1 -1
  118. package/dist/baseline/producers/secret-hmac.js.map +1 -1
  119. package/dist/baseline/producers/security.d.ts +2 -2
  120. package/dist/baseline/producers/security.d.ts.map +1 -1
  121. package/dist/baseline/producers/security.js.map +1 -1
  122. package/dist/baseline/producers/stale-allow.d.ts +70 -0
  123. package/dist/baseline/producers/stale-allow.d.ts.map +1 -0
  124. package/dist/baseline/producers/stale-allow.js +111 -0
  125. package/dist/baseline/producers/stale-allow.js.map +1 -0
  126. package/dist/baseline/producers/tests.d.ts +2 -2
  127. package/dist/baseline/producers/tests.d.ts.map +1 -1
  128. package/dist/baseline/producers/tests.js.map +1 -1
  129. package/dist/baseline/ref-baseline.d.ts +114 -0
  130. package/dist/baseline/ref-baseline.d.ts.map +1 -0
  131. package/dist/baseline/ref-baseline.js +260 -0
  132. package/dist/baseline/ref-baseline.js.map +1 -0
  133. package/dist/baseline/sanitize.d.ts +80 -0
  134. package/dist/baseline/sanitize.d.ts.map +1 -0
  135. package/dist/baseline/sanitize.js +91 -0
  136. package/dist/baseline/sanitize.js.map +1 -0
  137. package/dist/baseline/show.d.ts.map +1 -1
  138. package/dist/baseline/show.js +9 -3
  139. package/dist/baseline/show.js.map +1 -1
  140. package/dist/baseline/types.d.ts +73 -26
  141. package/dist/baseline/types.d.ts.map +1 -1
  142. package/dist/baseline/types.js +7 -1
  143. package/dist/baseline/types.js.map +1 -1
  144. package/dist/baseline/visibility.d.ts +61 -0
  145. package/dist/baseline/visibility.d.ts.map +1 -0
  146. package/dist/baseline/visibility.js +121 -0
  147. package/dist/baseline/visibility.js.map +1 -0
  148. package/dist/cli.d.ts.map +1 -1
  149. package/dist/cli.js +168 -6
  150. package/dist/cli.js.map +1 -1
  151. package/dist/dashboard/graph-adapter.d.ts +151 -0
  152. package/dist/dashboard/graph-adapter.d.ts.map +1 -0
  153. package/dist/dashboard/graph-adapter.js +415 -0
  154. package/dist/dashboard/graph-adapter.js.map +1 -0
  155. package/dist/dashboard/graph-tab.d.ts +109 -0
  156. package/dist/dashboard/graph-tab.d.ts.map +1 -0
  157. package/dist/dashboard/graph-tab.js +297 -0
  158. package/dist/dashboard/graph-tab.js.map +1 -0
  159. package/dist/dashboard/vendor/vis-network.min.js +34 -0
  160. package/dist/doctor.d.ts.map +1 -1
  161. package/dist/doctor.js +106 -16
  162. package/dist/doctor.js.map +1 -1
  163. package/dist/explore/cli/api-surface.d.ts +12 -0
  164. package/dist/explore/cli/api-surface.d.ts.map +1 -0
  165. package/dist/explore/cli/api-surface.js +57 -0
  166. package/dist/explore/cli/api-surface.js.map +1 -0
  167. package/dist/explore/cli/communities.d.ts +10 -0
  168. package/dist/explore/cli/communities.d.ts.map +1 -0
  169. package/dist/explore/cli/communities.js +47 -0
  170. package/dist/explore/cli/communities.js.map +1 -0
  171. package/dist/explore/cli/context.d.ts +16 -0
  172. package/dist/explore/cli/context.d.ts.map +1 -0
  173. package/dist/explore/cli/context.js +118 -0
  174. package/dist/explore/cli/context.js.map +1 -0
  175. package/dist/explore/cli/entry-points.d.ts +12 -0
  176. package/dist/explore/cli/entry-points.d.ts.map +1 -0
  177. package/dist/explore/cli/entry-points.js +85 -0
  178. package/dist/explore/cli/entry-points.js.map +1 -0
  179. package/dist/explore/cli/feature.d.ts +16 -0
  180. package/dist/explore/cli/feature.d.ts.map +1 -0
  181. package/dist/explore/cli/feature.js +89 -0
  182. package/dist/explore/cli/feature.js.map +1 -0
  183. package/dist/explore/cli/file.d.ts +12 -0
  184. package/dist/explore/cli/file.d.ts.map +1 -0
  185. package/dist/explore/cli/file.js +139 -0
  186. package/dist/explore/cli/file.js.map +1 -0
  187. package/dist/explore/cli/hot-files.d.ts +11 -0
  188. package/dist/explore/cli/hot-files.d.ts.map +1 -0
  189. package/dist/explore/cli/hot-files.js +63 -0
  190. package/dist/explore/cli/hot-files.js.map +1 -0
  191. package/dist/explore/context-hook.d.ts +42 -0
  192. package/dist/explore/context-hook.d.ts.map +1 -0
  193. package/dist/explore/context-hook.js +131 -0
  194. package/dist/explore/context-hook.js.map +1 -0
  195. package/dist/explore/finding-context.d.ts +69 -0
  196. package/dist/explore/finding-context.d.ts.map +1 -0
  197. package/dist/explore/finding-context.js +102 -0
  198. package/dist/explore/finding-context.js.map +1 -0
  199. package/dist/explore/format.d.ts +64 -0
  200. package/dist/explore/format.d.ts.map +1 -0
  201. package/dist/explore/format.js +99 -0
  202. package/dist/explore/format.js.map +1 -0
  203. package/dist/explore/load.d.ts +50 -0
  204. package/dist/explore/load.d.ts.map +1 -0
  205. package/dist/explore/load.js +197 -0
  206. package/dist/explore/load.js.map +1 -0
  207. package/dist/explore/queries.d.ts +413 -0
  208. package/dist/explore/queries.d.ts.map +1 -0
  209. package/dist/explore/queries.js +855 -0
  210. package/dist/explore/queries.js.map +1 -0
  211. package/dist/explore/types.d.ts +130 -0
  212. package/dist/explore/types.d.ts.map +1 -0
  213. package/dist/explore/types.js +28 -0
  214. package/dist/explore/types.js.map +1 -0
  215. package/dist/explore-cli.d.ts +45 -0
  216. package/dist/explore-cli.d.ts.map +1 -0
  217. package/dist/explore-cli.js +213 -0
  218. package/dist/explore-cli.js.map +1 -0
  219. package/dist/generator.d.ts.map +1 -1
  220. package/dist/generator.js +19 -0
  221. package/dist/generator.js.map +1 -1
  222. package/dist/issue-cli.d.ts +62 -0
  223. package/dist/issue-cli.d.ts.map +1 -0
  224. package/dist/issue-cli.js +252 -0
  225. package/dist/issue-cli.js.map +1 -0
  226. package/dist/languages/csharp.d.ts.map +1 -1
  227. package/dist/languages/csharp.js +32 -11
  228. package/dist/languages/csharp.js.map +1 -1
  229. package/dist/languages/go.d.ts.map +1 -1
  230. package/dist/languages/go.js +5 -0
  231. package/dist/languages/go.js.map +1 -1
  232. package/dist/languages/index.d.ts +27 -0
  233. package/dist/languages/index.d.ts.map +1 -1
  234. package/dist/languages/index.js +35 -0
  235. package/dist/languages/index.js.map +1 -1
  236. package/dist/languages/java.d.ts.map +1 -1
  237. package/dist/languages/java.js +5 -0
  238. package/dist/languages/java.js.map +1 -1
  239. package/dist/languages/kotlin.d.ts.map +1 -1
  240. package/dist/languages/kotlin.js +5 -0
  241. package/dist/languages/kotlin.js.map +1 -1
  242. package/dist/languages/python.d.ts.map +1 -1
  243. package/dist/languages/python.js +5 -0
  244. package/dist/languages/python.js.map +1 -1
  245. package/dist/languages/ruby.d.ts.map +1 -1
  246. package/dist/languages/ruby.js +5 -0
  247. package/dist/languages/ruby.js.map +1 -1
  248. package/dist/languages/rust.d.ts.map +1 -1
  249. package/dist/languages/rust.js +5 -0
  250. package/dist/languages/rust.js.map +1 -1
  251. package/dist/languages/types.d.ts +79 -0
  252. package/dist/languages/types.d.ts.map +1 -1
  253. package/dist/languages/typescript.d.ts.map +1 -1
  254. package/dist/languages/typescript.js +6 -1
  255. package/dist/languages/typescript.js.map +1 -1
  256. package/package.json +2 -1
  257. package/templates/.claude/skills/dxkit-action/SKILL.md +126 -12
  258. package/templates/.claude/skills/dxkit-onboard/SKILL.md +31 -3
  259. package/templates/.claude/skills/dxkit-reports/SKILL.md +3 -1
  260. package/templates/AGENTS.md.template +8 -1
  261. package/dist/baseline/producers/licenses.d.ts +0 -23
  262. package/dist/baseline/producers/licenses.d.ts.map +0 -1
  263. package/dist/baseline/producers/licenses.js +0 -46
  264. package/dist/baseline/producers/licenses.js.map +0 -1
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+ /**
3
+ * `vyuh-dxkit explore entry-points` — what does this repo do?
4
+ *
5
+ * Cross-references graph nodes with the active packs'
6
+ * architecturalShape (per CLAUDE.md Rule 8 — no hardcoded framework
7
+ * strings here). Detects the project's stack via `detect(cwd)` so
8
+ * only active-pack patterns contribute.
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.runEntryPoints = runEntryPoints;
12
+ const detect_1 = require("../../detect");
13
+ const languages_1 = require("../../languages");
14
+ const queries_1 = require("../queries");
15
+ const format_1 = require("../format");
16
+ const DEFAULT_LIMIT = 10;
17
+ function runEntryPoints(graph, _positionals, values, cwd) {
18
+ const limit = parseLimit(values.limit, DEFAULT_LIMIT);
19
+ const stack = (0, detect_1.detect)(cwd);
20
+ const primaryPaths = (0, languages_1.allPrimaryComponentPaths)(stack.languages);
21
+ const routePaths = (0, languages_1.allRoutePaths)(stack.languages);
22
+ const vocabulary = (0, languages_1.dominantVocabulary)(stack.languages);
23
+ const results = (0, queries_1.entryPointsQuery)(graph, primaryPaths, routePaths, limit);
24
+ if (values.json) {
25
+ (0, format_1.printJson)((0, format_1.envelope)('explore.entry-points', { limit, primaryPaths, routePaths, packs: graph.meta.packs }, graph, results));
26
+ return;
27
+ }
28
+ if (primaryPaths.length === 0 && routePaths.length === 0) {
29
+ (0, format_1.printMarkdown)((0, format_1.markdownHeader)('Entry points', 'what does this repo do?', graph), `No entry-point patterns declared for the active packs (${graph.meta.packs.join(', ') || 'none detected'}).\n\n` +
30
+ 'Each language pack declares its own primary-component / route path conventions in `LanguageSupport.architecturalShape` (CLAUDE.md Rule 8). Packs without conventional entry-point paths (e.g. Rust) intentionally omit them.');
31
+ return;
32
+ }
33
+ if (results.length === 0) {
34
+ (0, format_1.printMarkdown)((0, format_1.markdownHeader)('Entry points', 'what does this repo do?', graph), `No source files matched the active packs' entry-point patterns.\n\n` +
35
+ `Patterns tried: ${[...primaryPaths, ...routePaths].map((p) => `\`${p}\``).join(', ')}\n\n` +
36
+ `Either this repo has no conventional entry points, or the patterns don't match this codebase's structure.`);
37
+ return;
38
+ }
39
+ // Group by componentType + emit one table per group.
40
+ const grouped = new Map();
41
+ for (const r of results) {
42
+ const key = r.componentType;
43
+ const list = grouped.get(key) ?? [];
44
+ list.push(r);
45
+ grouped.set(key, list);
46
+ }
47
+ const sections = [];
48
+ sections.push((0, format_1.markdownHeader)('Entry points', 'what does this repo do?', graph));
49
+ // Vocabulary line so the reader knows the pack's framing.
50
+ const vocabLine = [];
51
+ if (vocabulary?.components)
52
+ vocabLine.push(`components → **${vocabulary.components}**`);
53
+ if (vocabulary?.routes)
54
+ vocabLine.push(`routes → **${vocabulary.routes}**`);
55
+ if (vocabulary?.models)
56
+ vocabLine.push(`models → **${vocabulary.models}**`);
57
+ if (vocabLine.length > 0) {
58
+ sections.push(`*Pack vocabulary*: ${vocabLine.join(', ')}.`);
59
+ }
60
+ for (const [type, rows] of grouped) {
61
+ sections.push(`### ${capitalize(type)} (${rows.length})`);
62
+ sections.push((0, format_1.markdownTable)(['Path', 'Symbol', 'Calls out', 'Pack'], rows.map((r) => ({
63
+ Path: r.line ? `${r.sourceFile}:${r.line}` : r.sourceFile,
64
+ Symbol: r.symbol,
65
+ 'Calls out': r.callsOut,
66
+ Pack: r.pack,
67
+ }))));
68
+ }
69
+ sections.push((0, format_1.markdownFooter)('Drill into one: `vyuh-dxkit explore file <path>`.'));
70
+ (0, format_1.printMarkdown)(...sections);
71
+ }
72
+ function capitalize(s) {
73
+ if (!s)
74
+ return s;
75
+ return s[0].toUpperCase() + s.slice(1);
76
+ }
77
+ function parseLimit(raw, defaultValue) {
78
+ if (!raw)
79
+ return defaultValue;
80
+ const n = parseInt(raw, 10);
81
+ if (isNaN(n) || n < 1)
82
+ return defaultValue;
83
+ return Math.min(n, 1000);
84
+ }
85
+ //# sourceMappingURL=entry-points.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-points.js","sourceRoot":"","sources":["../../../src/explore/cli/entry-points.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;AAkBH,wCAqFC;AArGD,yCAAsC;AACtC,+CAA8F;AAC9F,wCAAqE;AACrE,sCAO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AC,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,YAAY,CAAC;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * `vyuh-dxkit explore feature <keyword>` — where is feature X
3
+ * implemented? The marquee query of the explore CLI.
4
+ *
5
+ * Three-stage resolution (per Sprint 0 spec):
6
+ * 1. Direct symbolIndex match
7
+ * 2. Substring expansion (opt-in via --substring; off by default)
8
+ * 3. Structural expansion (community + 1-hop callers/callees)
9
+ *
10
+ * On zero hits, prints "did you mean..." suggestions from
11
+ * edit-distance against symbolIndex keys.
12
+ */
13
+ import type { Graph } from '../types';
14
+ import type { ExploreCliValues } from '../../explore-cli';
15
+ export declare function runFeature(graph: Graph, positionals: ReadonlyArray<string>, values: ExploreCliValues): void;
16
+ //# sourceMappingURL=feature.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.d.ts","sourceRoot":"","sources":["../../../src/explore/cli/feature.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAWH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,wBAAgB,UAAU,CACxB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,EAClC,MAAM,EAAE,gBAAgB,GACvB,IAAI,CA4DN"}
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ /**
3
+ * `vyuh-dxkit explore feature <keyword>` — where is feature X
4
+ * implemented? The marquee query of the explore CLI.
5
+ *
6
+ * Three-stage resolution (per Sprint 0 spec):
7
+ * 1. Direct symbolIndex match
8
+ * 2. Substring expansion (opt-in via --substring; off by default)
9
+ * 3. Structural expansion (community + 1-hop callers/callees)
10
+ *
11
+ * On zero hits, prints "did you mean..." suggestions from
12
+ * edit-distance against symbolIndex keys.
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.runFeature = runFeature;
16
+ const queries_1 = require("../queries");
17
+ const format_1 = require("../format");
18
+ const DEFAULT_LIMIT = 50;
19
+ function runFeature(graph, positionals, values) {
20
+ const keyword = positionals[0];
21
+ if (!keyword) {
22
+ process.stderr.write('Usage: vyuh-dxkit explore feature <keyword> [--substring] [--limit 50]\n');
23
+ process.exit(1);
24
+ }
25
+ const limit = parseLimit(values.limit, DEFAULT_LIMIT);
26
+ const substring = !!values.substring;
27
+ const result = (0, queries_1.featureQuery)(graph, keyword, { limit, substring });
28
+ if (values.json) {
29
+ (0, format_1.printJson)((0, format_1.envelope)('explore.feature', { keyword, limit, substring }, graph, result));
30
+ return;
31
+ }
32
+ const sections = [];
33
+ sections.push((0, format_1.markdownHeader)('Feature', `\`${keyword}\``, graph));
34
+ if (result.results.length === 0) {
35
+ if (result.suggestions.length > 0) {
36
+ const lines = result.suggestions
37
+ .map((s) => ` - \`${s.key}\` (${s.hits} hit${s.hits === 1 ? '' : 's'})`)
38
+ .join('\n');
39
+ sections.push(`No exact symbol match for \`${keyword}\`. Related symbols (substring or typo-distance):\n\n${lines}\n\nRerun with \`--substring\` to expand structurally from these (the typical "where is X implemented?" workflow), or pick a specific symbol above.`);
40
+ }
41
+ else {
42
+ sections.push(`No symbols matched \`${keyword}\` (no close alternatives found either). Try a different keyword, rerun with \`--substring\` for broader matching, or check \`vyuh-dxkit explore communities\` to see the natural-module structure.`);
43
+ }
44
+ (0, format_1.printMarkdown)(...sections);
45
+ return;
46
+ }
47
+ // Summary line + central entry point (if any).
48
+ const totalSeeds = result.results.reduce((sum, c) => sum + c.seedHits, 0);
49
+ sections.push(`**Seed matches**: ${totalSeeds} symbol${totalSeeds === 1 ? '' : 's'} across ${result.results.length} cluster${result.results.length === 1 ? '' : 's'}.`);
50
+ // Per-cluster sections.
51
+ for (const cluster of result.results) {
52
+ sections.push(buildClusterSection(cluster));
53
+ }
54
+ if (result.centralEntryPoint) {
55
+ const cep = result.centralEntryPoint;
56
+ const where = cep.line ? `${cep.sourceFile}:${cep.line}` : cep.sourceFile;
57
+ sections.push(`\nThe most-called seed symbol is **\`${cep.symbol}\`** at \`${where}\` — called from ${cep.calledFrom} place${cep.calledFrom === 1 ? '' : 's'}. A natural starting read.`);
58
+ }
59
+ sections.push((0, format_1.markdownFooter)('Drill into one: `vyuh-dxkit explore file <path>`.'));
60
+ (0, format_1.printMarkdown)(...sections);
61
+ }
62
+ function buildClusterSection(cluster) {
63
+ const lines = [];
64
+ const id = cluster.clusterId + 1;
65
+ const role = cluster.role;
66
+ const seedNote = cluster.seedHits === 0 ? ' (expansion only — no direct seed)' : '';
67
+ lines.push(`### Cluster ${id} — ${role}${seedNote}`);
68
+ if (cluster.communityId !== undefined) {
69
+ lines.push(`*Community*: ${cluster.communityId}${cluster.dominantSourceDir ? ` (${cluster.dominantSourceDir})` : ''}`);
70
+ }
71
+ if (cluster.keySymbols.length > 0) {
72
+ lines.push(`*Key symbols*: ${cluster.keySymbols.map((s) => `\`${s}\``).join(', ')}`);
73
+ }
74
+ lines.push('');
75
+ lines.push((0, format_1.markdownTable)(['File'], cluster.files.slice(0, 12).map((f) => ({ File: f }))));
76
+ if (cluster.files.length > 12) {
77
+ lines.push(`\n*+ ${cluster.files.length - 12} more file${cluster.files.length - 12 === 1 ? '' : 's'}*`);
78
+ }
79
+ return lines.join('\n');
80
+ }
81
+ function parseLimit(raw, defaultValue) {
82
+ if (!raw)
83
+ return defaultValue;
84
+ const n = parseInt(raw, 10);
85
+ if (isNaN(n) || n < 1)
86
+ return defaultValue;
87
+ return Math.min(n, 1000);
88
+ }
89
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.js","sourceRoot":"","sources":["../../../src/explore/cli/feature.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;AAgBH,gCAgEC;AA9ED,wCAA+D;AAC/D,sCAOmB;A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IACf,KAAK,CAAC,IAAI,CACR,IAAA,sBAAa,EACX,CAAC,MAAM,CAAU,EACjB,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,CACrD,CACF,CAAC;IACF,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QAC9B,KAAK,CAAC,IAAI,CACR,QAAQ,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,aAAa,OAAO,CAAC,KAAK,CAAC,MAAM,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAC5F,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,UAAU,CAAC,GAAuB,EAAE,YAAoB;IAC/D,IAAI,CAAC,GAAG;QAAE,OAAO,YAAY,CAAC;IAC9B,MAAM,CAAC,GAAG,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,YAAY,CAAC;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;AAC3B,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * `vyuh-dxkit explore file <path>` — drill into a single file's
3
+ * neighborhood. Per CLAUDE.md Rule 12: graph traversal flows through
4
+ * queries.ts.
5
+ *
6
+ * If the user passes an absolute path, convert to project-relative
7
+ * (the graph artifact uses project-relative paths throughout).
8
+ */
9
+ import type { Graph } from '../types';
10
+ import type { ExploreCliValues } from '../../explore-cli';
11
+ export declare function runFile(graph: Graph, positionals: ReadonlyArray<string>, values: ExploreCliValues, cwd: string): void;
12
+ //# sourceMappingURL=file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/explore/cli/file.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,wBAAgB,OAAO,CACrB,KAAK,EAAE,KAAK,EACZ,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,EAClC,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,MAAM,GACV,IAAI,CAqHN"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ /**
3
+ * `vyuh-dxkit explore file <path>` — drill into a single file's
4
+ * neighborhood. Per CLAUDE.md Rule 12: graph traversal flows through
5
+ * queries.ts.
6
+ *
7
+ * If the user passes an absolute path, convert to project-relative
8
+ * (the graph artifact uses project-relative paths throughout).
9
+ */
10
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ var desc = Object.getOwnPropertyDescriptor(m, k);
13
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
+ desc = { enumerable: true, get: function() { return m[k]; } };
15
+ }
16
+ Object.defineProperty(o, k2, desc);
17
+ }) : (function(o, m, k, k2) {
18
+ if (k2 === undefined) k2 = k;
19
+ o[k2] = m[k];
20
+ }));
21
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
23
+ }) : function(o, v) {
24
+ o["default"] = v;
25
+ });
26
+ var __importStar = (this && this.__importStar) || (function () {
27
+ var ownKeys = function(o) {
28
+ ownKeys = Object.getOwnPropertyNames || function (o) {
29
+ var ar = [];
30
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
+ return ar;
32
+ };
33
+ return ownKeys(o);
34
+ };
35
+ return function (mod) {
36
+ if (mod && mod.__esModule) return mod;
37
+ var result = {};
38
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ })();
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ exports.runFile = runFile;
45
+ const path = __importStar(require("node:path"));
46
+ const queries_1 = require("../queries");
47
+ const format_1 = require("../format");
48
+ function runFile(graph, positionals, values, cwd) {
49
+ const rawPath = positionals[0];
50
+ if (!rawPath) {
51
+ process.stderr.write('Usage: vyuh-dxkit explore file <path>\nProvide a path (relative or absolute) to a source file in the repo.\n');
52
+ process.exit(1);
53
+ }
54
+ // Convert absolute to project-relative if needed. Graphify writes
55
+ // project-relative paths to graph.json so the lookup key must
56
+ // match that shape.
57
+ const resolved = path.isAbsolute(rawPath)
58
+ ? path.relative(cwd, rawPath).replace(/\\/g, '/')
59
+ : rawPath.replace(/\\/g, '/');
60
+ const result = (0, queries_1.fileSummaryQuery)(graph, resolved);
61
+ if (values.json) {
62
+ (0, format_1.printJson)((0, format_1.envelope)('explore.file', { path: resolved }, graph, result));
63
+ return;
64
+ }
65
+ if (!result.found) {
66
+ (0, format_1.printMarkdown)((0, format_1.markdownHeader)('File', resolved, graph), `File \`${resolved}\` is not in the graph. Common reasons:\n` +
67
+ `- File doesn't exist (typo in path?)\n` +
68
+ `- Excluded by .dxkit-ignore / minified-detection / unsupported extension\n` +
69
+ `- Pack for this file's language isn't active in the project`);
70
+ return;
71
+ }
72
+ const symbolRows = result.symbols.map((s) => ({
73
+ Kind: s.kind,
74
+ Symbol: s.label,
75
+ Line: s.line ?? '',
76
+ Exported: s.exported === undefined ? '?' : s.exported ? '✓' : '·',
77
+ 'Calls in': s.callsIn,
78
+ 'Calls out': s.callsOut,
79
+ }));
80
+ const symbolHeaders = ['Kind', 'Symbol', 'Line', 'Exported', 'Calls in', 'Calls out'];
81
+ const callerRows = result.callerFiles
82
+ .slice(0, 20)
83
+ .map((c) => ({ File: c.sourceFile, Calls: c.count }));
84
+ const calleeRows = result.calleeFiles
85
+ .slice(0, 20)
86
+ .map((c) => ({ File: c.sourceFile, Calls: c.count }));
87
+ const sections = [];
88
+ sections.push((0, format_1.markdownHeader)('File', resolved, graph));
89
+ // Community + summary line
90
+ const summary = [];
91
+ if (result.communityId !== undefined) {
92
+ const dir = result.communityLabel || '—';
93
+ const pack = result.communityPack || '—';
94
+ summary.push(`**Community**: ${result.communityId} (${dir}, ${pack})`);
95
+ }
96
+ const kindCounts = {};
97
+ for (const s of result.symbols)
98
+ kindCounts[s.kind] = (kindCounts[s.kind] ?? 0) + 1;
99
+ const symBreakdown = Object.entries(kindCounts)
100
+ .map(([k, c]) => `${c} ${k}${c === 1 ? '' : 's'}`)
101
+ .join(', ');
102
+ if (symBreakdown)
103
+ summary.push(`**Symbols**: ${symBreakdown}`);
104
+ const exportedSymbols = result.symbols.filter((s) => s.exported === true);
105
+ if (exportedSymbols.length > 0) {
106
+ summary.push(`**Exported**: ${exportedSymbols
107
+ .map((s) => s.label)
108
+ .slice(0, 8)
109
+ .join(', ')}${exportedSymbols.length > 8 ? ` (+${exportedSymbols.length - 8} more)` : ''}`);
110
+ }
111
+ if (summary.length > 0)
112
+ sections.push(summary.join('\n'));
113
+ if (symbolRows.length > 0) {
114
+ sections.push('### Symbols defined here');
115
+ sections.push((0, format_1.markdownTable)(symbolHeaders, symbolRows));
116
+ }
117
+ if (callerRows.length > 0) {
118
+ sections.push(`### Callers (${result.callerFiles.length} file${result.callerFiles.length === 1 ? '' : 's'})`);
119
+ sections.push((0, format_1.markdownTable)(['File', 'Calls'], callerRows));
120
+ }
121
+ else {
122
+ sections.push('### Callers\n\nNo other files call into this file. Either it is a leaf module (entry point, top-level CLI handler) or its consumers are outside the graphify-extracted set.');
123
+ }
124
+ if (calleeRows.length > 0) {
125
+ sections.push(`### Callees (${result.calleeFiles.length} file${result.calleeFiles.length === 1 ? '' : 's'})`);
126
+ sections.push((0, format_1.markdownTable)(['File', 'Calls'], calleeRows));
127
+ }
128
+ if (result.importsOut.length > 0) {
129
+ sections.push(`### Imports out (${result.importsOut.length} file${result.importsOut.length === 1 ? '' : 's'})`);
130
+ sections.push(result.importsOut.map((i) => `- ${i.sourceFile}`).join('\n'));
131
+ }
132
+ if (result.importsIn.length > 0) {
133
+ sections.push(`### Imports in (${result.importsIn.length} file${result.importsIn.length === 1 ? '' : 's'})`);
134
+ sections.push(result.importsIn.map((i) => `- ${i.sourceFile}`).join('\n'));
135
+ }
136
+ sections.push((0, format_1.markdownFooter)('Drill into a caller: `vyuh-dxkit explore file <path>`.'));
137
+ (0, format_1.printMarkdown)(...sections);
138
+ }
139
+ //# sourceMappingURL=file.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/explore/cli/file.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeH,0BA0HC;AAvID,gDAAkC;AAClC,wCAA8C;AAC9C,sCAOmB;AAInB,SAAgB,OAAO,CACrB,KAAY,EACZ,WAAkC,EAClC,MAAwB,EACxB,GAAW;IAEX,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC;IAC/B,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,8GAA8G,CAC/G,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,kEAAkE;IAClE,8DAA8D;IAC9D,oBAAoB;IACpB,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;QACvC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;QACjD,CA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AC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAC9F,CAAC;QACF,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAC7E,CAAC;IAED,QAAQ,CAAC,IAAI,CAAC,IAAA,uBAAc,EAAC,wDAAwD,CAAC,CAAC,CAAC;IAExF,IAAA,sBAAa,EAAC,GAAG,QAAQ,CAAC,CAAC;AAC7B,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * `vyuh-dxkit explore hot-files` — files most depended on.
3
+ *
4
+ * Pure pipeline: parse args → call hotFilesQuery → format output.
5
+ * No graph traversal in here (CLAUDE.md Rule 12 enforces);
6
+ * everything goes through src/explore/queries.ts.
7
+ */
8
+ import type { Graph } from '../types';
9
+ import type { ExploreCliValues } from '../../explore-cli';
10
+ export declare function runHotFiles(graph: Graph, _positionals: ReadonlyArray<string>, values: ExploreCliValues): void;
11
+ //# sourceMappingURL=hot-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hot-files.d.ts","sourceRoot":"","sources":["../../../src/explore/cli/hot-files.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAWH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACtC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAI1D,wBAAgB,WAAW,CACzB,KAAK,EAAE,KAAK,EACZ,YAAY,EAAE,aAAa,CAAC,MAAM,CAAC,EACnC,MAAM,EAAE,gBAAgB,GACvB,IAAI,CAqCN"}
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ /**
3
+ * `vyuh-dxkit explore hot-files` — files most depended on.
4
+ *
5
+ * Pure pipeline: parse args → call hotFilesQuery → format output.
6
+ * No graph traversal in here (CLAUDE.md Rule 12 enforces);
7
+ * everything goes through src/explore/queries.ts.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.runHotFiles = runHotFiles;
11
+ const queries_1 = require("../queries");
12
+ const format_1 = require("../format");
13
+ const DEFAULT_LIMIT = 20;
14
+ function runHotFiles(graph, _positionals, values) {
15
+ const limit = parseLimit(values.limit, DEFAULT_LIMIT);
16
+ const results = (0, queries_1.hotFilesQuery)(graph, limit);
17
+ if (values.json) {
18
+ (0, format_1.printJson)((0, format_1.envelope)('explore.hot-files', { limit }, graph, results));
19
+ return;
20
+ }
21
+ // Markdown: header, table, footer hint.
22
+ const rows = results.map((r) => ({
23
+ Path: r.sourceFile,
24
+ 'Calls in': r.callsIn,
25
+ 'Imports in': r.importsIn,
26
+ 'Calls out': r.callsOut,
27
+ Community: r.communityLabel
28
+ ? `${r.communityId} (${r.communityLabel})`
29
+ : r.communityId !== undefined
30
+ ? String(r.communityId)
31
+ : '',
32
+ }));
33
+ const headers = ['Path', 'Calls in', 'Imports in', 'Calls out', 'Community'];
34
+ if (results.length === 0) {
35
+ (0, format_1.printMarkdown)((0, format_1.markdownHeader)('Hot files', "what's central?", graph), 'No files found in the graph. Either the repo has no inbound call edges, or the graph artifact is empty.');
36
+ return;
37
+ }
38
+ (0, format_1.printMarkdown)((0, format_1.markdownHeader)('Hot files', "what's central?", graph), (0, format_1.markdownTable)(headers, rows), explainResults(results), (0, format_1.markdownFooter)('Drill into one: `vyuh-dxkit explore file <path>`.'));
39
+ }
40
+ /**
41
+ * One-line interpretation hint below the table. A file with high
42
+ * "calls in" + low "calls out" is foundational infrastructure;
43
+ * inverting that signals a coordinator / orchestrator.
44
+ */
45
+ function explainResults(results) {
46
+ if (results.length === 0)
47
+ return '';
48
+ const top = results[0];
49
+ const ratio = top.callsOut > 0 ? top.callsIn / top.callsOut : top.callsIn;
50
+ if (ratio >= 3) {
51
+ return `A file with high "calls in" + low "calls out" is foundational infrastructure. \`${top.sourceFile}\` looks like one.`;
52
+ }
53
+ return 'A file with high "calls in" + low "calls out" is foundational infrastructure.';
54
+ }
55
+ function parseLimit(raw, defaultValue) {
56
+ if (!raw)
57
+ return defaultValue;
58
+ const n = parseInt(raw, 10);
59
+ if (isNaN(n) || n < 1)
60
+ return defaultValue;
61
+ return Math.min(n, 1000); // sanity cap
62
+ }
63
+ //# sourceMappingURL=hot-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hot-files.js","sourceRoot":"","sources":["../../../src/explore/cli/hot-files.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAgBH,kCAyCC;AAvDD,wCAA+D;AAC/D,sCAOmB;AAInB,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,SAAgB,WAAW,CACzB,KAAY,EACZ,YAAmC,EACnC,MAAwB;IAExB,MAAM,KAAK,GAAG,UAAU,CAAC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,IAAA,uBAAa,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;IAE5C,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,IAAA,kBAAS,EAAC,IAAA,iBAAQ,EAAC,mBAAmB,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC;QACpE,OAAO;IACT,CAAC;IAED,wCAAwC;IACxC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC/B,IAAI,EAAE,CAAC,CAAC,UAAU;QAClB,UAAU,EAAE,CAAC,CAAC,OAAO;QACrB,YAAY,EAAE,CAAC,CAAC,SAAS;QACzB,WAAW,EAAE,CAAC,CAAC,QAAQ;QACvB,SAAS,EAAE,CAAC,CAAC,cAAc;YACzB,CAAC,CAAC,GAAG,CAAC,CAAC,WAAW,KAAK,CAAC,CAAC,cAAc,GAAG;YAC1C,CAAC,CAA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,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC5B,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,YAAY,CAAC;IAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,aAAa;AACzC,CAAC"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * `vyuh-dxkit context-hook` — the Claude Code PreToolUse hook that
3
+ * delivers the token-reduction win passively. Wired into a scaffolded
4
+ * repo's `.claude/settings.json` with a `Grep|Glob` matcher: when an
5
+ * agent is about to search the codebase, this hook injects a slim
6
+ * structural map as `additionalContext` so the agent needs fewer
7
+ * follow-up whole-file reads.
8
+ *
9
+ * THE CONTRACT IS FAIL-OPEN + ADDITIVE. This hook can only ever ADD
10
+ * context; it never blocks the tool, never replaces grep output, and
11
+ * stays a silent no-op (exit 0, no stdout) on ANY problem — missing
12
+ * graph.json, parse error, no keyword match, unreadable stdin. So
13
+ * Claude Code behaves exactly as it does today whenever the graph is
14
+ * absent or unhelpful; the hook is pure upside.
15
+ *
16
+ * Claude Code passes the tool call as JSON on stdin
17
+ * (`{ tool_name, tool_input: { pattern, ... }, ... }`) and reads a
18
+ * JSON object on stdout with `hookSpecificOutput.additionalContext`.
19
+ */
20
+ import { type ContextResult } from './queries';
21
+ import type { Graph } from './types';
22
+ /**
23
+ * Entry point for `case 'context-hook'`. Reads stdin, runs the query,
24
+ * writes the hook output. Wrapped so nothing it does can fail the
25
+ * tool call: every failure path resolves to a silent no-op.
26
+ */
27
+ export declare function runContextHook(cwd: string): Promise<void>;
28
+ /**
29
+ * Extract the search keyword from the PreToolUse payload. Both Grep
30
+ * and Glob carry it on `tool_input.pattern`. Returns undefined for
31
+ * anything we can't confidently read (→ no-op upstream).
32
+ */
33
+ export declare function extractPattern(rawStdin: string): string | undefined;
34
+ /**
35
+ * Compact `additionalContext` body. Terser than the CLI's markdown
36
+ * (the hook pays this cost on every grep): an anchor line, blast
37
+ * radius, and the top symbols grouped by their leading community.
38
+ * Leads with a one-line provenance + best-effort caveat so the agent
39
+ * calibrates trust.
40
+ */
41
+ export declare function formatHookContext(result: ContextResult, graph: Graph): string;
42
+ //# sourceMappingURL=context-hook.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-hook.d.ts","sourceRoot":"","sources":["../../src/explore/context-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAgB,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAE7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKrC;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0B/D;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAcnE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,CAiC7E"}
@@ -0,0 +1,131 @@
1
+ "use strict";
2
+ /**
3
+ * `vyuh-dxkit context-hook` — the Claude Code PreToolUse hook that
4
+ * delivers the token-reduction win passively. Wired into a scaffolded
5
+ * repo's `.claude/settings.json` with a `Grep|Glob` matcher: when an
6
+ * agent is about to search the codebase, this hook injects a slim
7
+ * structural map as `additionalContext` so the agent needs fewer
8
+ * follow-up whole-file reads.
9
+ *
10
+ * THE CONTRACT IS FAIL-OPEN + ADDITIVE. This hook can only ever ADD
11
+ * context; it never blocks the tool, never replaces grep output, and
12
+ * stays a silent no-op (exit 0, no stdout) on ANY problem — missing
13
+ * graph.json, parse error, no keyword match, unreadable stdin. So
14
+ * Claude Code behaves exactly as it does today whenever the graph is
15
+ * absent or unhelpful; the hook is pure upside.
16
+ *
17
+ * Claude Code passes the tool call as JSON on stdin
18
+ * (`{ tool_name, tool_input: { pattern, ... }, ... }`) and reads a
19
+ * JSON object on stdout with `hookSpecificOutput.additionalContext`.
20
+ */
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.runContextHook = runContextHook;
23
+ exports.extractPattern = extractPattern;
24
+ exports.formatHookContext = formatHookContext;
25
+ const queries_1 = require("./queries");
26
+ const load_1 = require("./load");
27
+ /** Stingier than the manual CLI's 2000 — the hook fires on every grep. */
28
+ const HOOK_BUDGET = 1500;
29
+ /**
30
+ * Entry point for `case 'context-hook'`. Reads stdin, runs the query,
31
+ * writes the hook output. Wrapped so nothing it does can fail the
32
+ * tool call: every failure path resolves to a silent no-op.
33
+ */
34
+ async function runContextHook(cwd) {
35
+ try {
36
+ const raw = await readStdin();
37
+ if (!raw.trim())
38
+ return;
39
+ const pattern = extractPattern(raw);
40
+ if (!pattern)
41
+ return;
42
+ const graph = (0, load_1.tryLoadGraph)(cwd);
43
+ if (!graph)
44
+ return;
45
+ const result = (0, queries_1.contextQuery)(graph, pattern, { budget: HOOK_BUDGET, substring: true });
46
+ if (!result.matched || result.selection.length === 0)
47
+ return;
48
+ const additionalContext = formatHookContext(result, graph);
49
+ process.stdout.write(JSON.stringify({
50
+ hookSpecificOutput: {
51
+ hookEventName: 'PreToolUse',
52
+ additionalContext,
53
+ },
54
+ }));
55
+ }
56
+ catch {
57
+ // Fail-open: errors produce no output; the tool proceeds normally.
58
+ }
59
+ }
60
+ /**
61
+ * Extract the search keyword from the PreToolUse payload. Both Grep
62
+ * and Glob carry it on `tool_input.pattern`. Returns undefined for
63
+ * anything we can't confidently read (→ no-op upstream).
64
+ */
65
+ function extractPattern(rawStdin) {
66
+ let parsed;
67
+ try {
68
+ parsed = JSON.parse(rawStdin);
69
+ }
70
+ catch {
71
+ return undefined;
72
+ }
73
+ if (!parsed || typeof parsed !== 'object')
74
+ return undefined;
75
+ const toolInput = parsed.tool_input;
76
+ if (!toolInput || typeof toolInput !== 'object')
77
+ return undefined;
78
+ const pattern = toolInput.pattern;
79
+ if (typeof pattern !== 'string')
80
+ return undefined;
81
+ const trimmed = pattern.trim();
82
+ return trimmed.length > 0 ? trimmed : undefined;
83
+ }
84
+ /**
85
+ * Compact `additionalContext` body. Terser than the CLI's markdown
86
+ * (the hook pays this cost on every grep): an anchor line, blast
87
+ * radius, and the top symbols grouped by their leading community.
88
+ * Leads with a one-line provenance + best-effort caveat so the agent
89
+ * calibrates trust.
90
+ */
91
+ function formatHookContext(result, graph) {
92
+ const lines = [];
93
+ lines.push(`dxkit graph context for \`${result.query}\` (from .dxkit/reports/graph.json, generated ${graph.meta.generatedAt.slice(0, 10)} — structural hint, grep results remain authoritative):`);
94
+ if (result.anchor) {
95
+ const a = result.anchor;
96
+ const where = a.line ? `${a.sourceFile}:${a.line}` : a.sourceFile;
97
+ lines.push(`- Start here: \`${a.symbol}\` (${where}), called from ${a.calledFrom} place(s).`);
98
+ }
99
+ if (result.blastRadius.callers > 0) {
100
+ lines.push(`- Blast radius: ${result.blastRadius.callers} caller(s) across ${result.blastRadius.callerFiles} file(s).`);
101
+ }
102
+ // Top symbols overall (seeds first, then by in-degree), capped tight.
103
+ const top = [...result.selection]
104
+ .sort((a, b) => a.hop - b.hop || b.callsIn - a.callsIn)
105
+ .slice(0, 10);
106
+ if (top.length > 0) {
107
+ lines.push('- Relevant symbols:');
108
+ for (const s of top) {
109
+ const where = s.line ? `${s.sourceFile}:${s.line}` : s.sourceFile;
110
+ lines.push(` ${s.symbol} (${where})`);
111
+ }
112
+ }
113
+ if (result.truncated) {
114
+ lines.push(`- (+${result.omittedCount} more symbols in the wider neighborhood)`);
115
+ }
116
+ return lines.join('\n');
117
+ }
118
+ /** Read all of stdin as a string. Resolves '' if stdin is a TTY/empty. */
119
+ function readStdin() {
120
+ return new Promise((resolve) => {
121
+ if (process.stdin.isTTY) {
122
+ resolve('');
123
+ return;
124
+ }
125
+ const chunks = [];
126
+ process.stdin.on('data', (c) => chunks.push(Buffer.from(c)));
127
+ process.stdin.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')));
128
+ process.stdin.on('error', () => resolve(''));
129
+ });
130
+ }
131
+ //# sourceMappingURL=context-hook.js.map