@vyuhlabs/dxkit 2.5.0 → 2.5.2

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 (179) hide show
  1. package/CHANGELOG.md +231 -0
  2. package/README.md +48 -28
  3. package/dist/analyzers/tools/graphify.d.ts.map +1 -1
  4. package/dist/analyzers/tools/graphify.js +9 -5
  5. package/dist/analyzers/tools/graphify.js.map +1 -1
  6. package/dist/analyzers/tools/tool-registry.d.ts +19 -1
  7. package/dist/analyzers/tools/tool-registry.d.ts.map +1 -1
  8. package/dist/analyzers/tools/tool-registry.js +50 -8
  9. package/dist/analyzers/tools/tool-registry.js.map +1 -1
  10. package/dist/cli.d.ts.map +1 -1
  11. package/dist/cli.js +104 -11
  12. package/dist/cli.js.map +1 -1
  13. package/dist/constants.d.ts.map +1 -1
  14. package/dist/constants.js +0 -10
  15. package/dist/constants.js.map +1 -1
  16. package/dist/detect.d.ts.map +1 -1
  17. package/dist/detect.js +0 -15
  18. package/dist/detect.js.map +1 -1
  19. package/dist/doctor.d.ts +78 -1
  20. package/dist/doctor.d.ts.map +1 -1
  21. package/dist/doctor.js +509 -103
  22. package/dist/doctor.js.map +1 -1
  23. package/dist/generator.d.ts +1 -1
  24. package/dist/generator.d.ts.map +1 -1
  25. package/dist/generator.js +96 -135
  26. package/dist/generator.js.map +1 -1
  27. package/dist/hooks-cli.d.ts +20 -0
  28. package/dist/hooks-cli.d.ts.map +1 -0
  29. package/dist/hooks-cli.js +145 -0
  30. package/dist/hooks-cli.js.map +1 -0
  31. package/dist/languages/csharp.d.ts.map +1 -1
  32. package/dist/languages/csharp.js +5 -0
  33. package/dist/languages/csharp.js.map +1 -1
  34. package/dist/languages/go.d.ts.map +1 -1
  35. package/dist/languages/go.js +5 -0
  36. package/dist/languages/go.js.map +1 -1
  37. package/dist/languages/index.d.ts +43 -0
  38. package/dist/languages/index.d.ts.map +1 -1
  39. package/dist/languages/index.js +76 -0
  40. package/dist/languages/index.js.map +1 -1
  41. package/dist/languages/java.d.ts.map +1 -1
  42. package/dist/languages/java.js +5 -0
  43. package/dist/languages/java.js.map +1 -1
  44. package/dist/languages/kotlin.d.ts.map +1 -1
  45. package/dist/languages/kotlin.js +10 -0
  46. package/dist/languages/kotlin.js.map +1 -1
  47. package/dist/languages/python.d.ts.map +1 -1
  48. package/dist/languages/python.js +13 -0
  49. package/dist/languages/python.js.map +1 -1
  50. package/dist/languages/ruby.d.ts.map +1 -1
  51. package/dist/languages/ruby.js +5 -0
  52. package/dist/languages/ruby.js.map +1 -1
  53. package/dist/languages/rust.d.ts.map +1 -1
  54. package/dist/languages/rust.js +5 -0
  55. package/dist/languages/rust.js.map +1 -1
  56. package/dist/languages/types.d.ts +47 -0
  57. package/dist/languages/types.d.ts.map +1 -1
  58. package/dist/languages/typescript.d.ts.map +1 -1
  59. package/dist/languages/typescript.js +6 -0
  60. package/dist/languages/typescript.js.map +1 -1
  61. package/dist/prompts.d.ts.map +1 -1
  62. package/dist/prompts.js +0 -5
  63. package/dist/prompts.js.map +1 -1
  64. package/dist/setup-branch-protection.d.ts +34 -0
  65. package/dist/setup-branch-protection.d.ts.map +1 -0
  66. package/dist/setup-branch-protection.js +190 -0
  67. package/dist/setup-branch-protection.js.map +1 -0
  68. package/dist/setup-gh.d.ts +75 -0
  69. package/dist/setup-gh.d.ts.map +1 -0
  70. package/dist/setup-gh.js +213 -0
  71. package/dist/setup-gh.js.map +1 -0
  72. package/dist/setup-prebuild.d.ts +34 -0
  73. package/dist/setup-prebuild.d.ts.map +1 -0
  74. package/dist/setup-prebuild.js +181 -0
  75. package/dist/setup-prebuild.js.map +1 -0
  76. package/dist/ship-installers.d.ts +6 -0
  77. package/dist/ship-installers.d.ts.map +1 -1
  78. package/dist/ship-installers.js +135 -5
  79. package/dist/ship-installers.js.map +1 -1
  80. package/dist/tools-cli.d.ts.map +1 -1
  81. package/dist/tools-cli.js +45 -9
  82. package/dist/tools-cli.js.map +1 -1
  83. package/dist/types.d.ts +24 -6
  84. package/dist/types.d.ts.map +1 -1
  85. package/dist/update.d.ts +41 -0
  86. package/dist/update.d.ts.map +1 -1
  87. package/dist/update.js +154 -15
  88. package/dist/update.js.map +1 -1
  89. package/dist/upgrade.d.ts +88 -0
  90. package/dist/upgrade.d.ts.map +1 -0
  91. package/dist/upgrade.js +324 -0
  92. package/dist/upgrade.js.map +1 -0
  93. package/package.json +1 -1
  94. package/templates/.claude/skills/dxkit-action/SKILL.md +150 -0
  95. package/templates/.claude/skills/dxkit-config/SKILL.md +124 -0
  96. package/templates/.claude/skills/dxkit-fix/SKILL.md +165 -0
  97. package/templates/.claude/skills/dxkit-hooks/SKILL.md +109 -0
  98. package/templates/.claude/skills/dxkit-init/SKILL.md +93 -0
  99. package/templates/.claude/skills/dxkit-learn/SKILL.md +84 -0
  100. package/templates/.claude/skills/dxkit-onboard/SKILL.md +246 -0
  101. package/templates/.claude/skills/dxkit-reports/SKILL.md +111 -0
  102. package/templates/.claude/skills/dxkit-update/SKILL.md +164 -0
  103. package/templates/.devcontainer/devcontainer.json +13 -48
  104. package/templates/.devcontainer/post-create.sh +37 -8
  105. package/templates/AGENTS.md.template +137 -0
  106. package/templates/CLAUDE.md.template +16 -111
  107. package/dist/codebase-scanner.d.ts +0 -36
  108. package/dist/codebase-scanner.d.ts.map +0 -1
  109. package/dist/codebase-scanner.js +0 -687
  110. package/dist/codebase-scanner.js.map +0 -1
  111. package/templates/.claude/agents/doc-writer.md +0 -107
  112. package/templates/.claude/agents/knowledge-bot.md +0 -64
  113. package/templates/.claude/agents/onboarding.md +0 -62
  114. package/templates/.claude/agents/quality-reviewer.md +0 -85
  115. package/templates/.claude/agents-available/code-reviewer.md +0 -29
  116. package/templates/.claude/agents-available/codebase-explorer.md +0 -100
  117. package/templates/.claude/agents-available/dashboard-builder.md +0 -433
  118. package/templates/.claude/agents-available/debugger.md +0 -29
  119. package/templates/.claude/agents-available/dependency-mapper.md +0 -80
  120. package/templates/.claude/agents-available/dev-report.md +0 -108
  121. package/templates/.claude/agents-available/doc-writer.md +0 -107
  122. package/templates/.claude/agents-available/feature-builder.md +0 -163
  123. package/templates/.claude/agents-available/feature-planner.md +0 -185
  124. package/templates/.claude/agents-available/health-auditor.md +0 -95
  125. package/templates/.claude/agents-available/hooks-configurator.md +0 -211
  126. package/templates/.claude/agents-available/knowledge-bot.md +0 -62
  127. package/templates/.claude/agents-available/plan-executor.md +0 -133
  128. package/templates/.claude/agents-available/strategic-planner.md +0 -141
  129. package/templates/.claude/agents-available/test-gap-finder.md +0 -67
  130. package/templates/.claude/agents-available/test-writer.md +0 -34
  131. package/templates/.claude/agents-available/vulnerability-scanner.md +0 -173
  132. package/templates/.claude/commands/ask.md +0 -7
  133. package/templates/.claude/commands/build-feature.md +0 -26
  134. package/templates/.claude/commands/build.md.template +0 -30
  135. package/templates/.claude/commands/check.md.template +0 -43
  136. package/templates/.claude/commands/dashboard.md +0 -28
  137. package/templates/.claude/commands/deps.md +0 -15
  138. package/templates/.claude/commands/dev-report.md +0 -50
  139. package/templates/.claude/commands/docs.md +0 -21
  140. package/templates/.claude/commands/doctor.md +0 -29
  141. package/templates/.claude/commands/enable-agent.md +0 -12
  142. package/templates/.claude/commands/execute-plan.md +0 -25
  143. package/templates/.claude/commands/explore-codebase.md +0 -12
  144. package/templates/.claude/commands/export-pdf.md +0 -30
  145. package/templates/.claude/commands/feature.md +0 -25
  146. package/templates/.claude/commands/fix-issue.md +0 -12
  147. package/templates/.claude/commands/fix.md.template +0 -32
  148. package/templates/.claude/commands/health.md +0 -58
  149. package/templates/.claude/commands/help.md +0 -36
  150. package/templates/.claude/commands/learn.md +0 -48
  151. package/templates/.claude/commands/onboarding.md +0 -21
  152. package/templates/.claude/commands/plan.md +0 -20
  153. package/templates/.claude/commands/quality.md.template +0 -65
  154. package/templates/.claude/commands/session-end.md +0 -40
  155. package/templates/.claude/commands/session-start.md +0 -30
  156. package/templates/.claude/commands/setup-hooks.md +0 -18
  157. package/templates/.claude/commands/stealth-mode.md +0 -17
  158. package/templates/.claude/commands/test-gaps.md +0 -49
  159. package/templates/.claude/commands/test.md.template +0 -40
  160. package/templates/.claude/commands/vulnerabilities.md +0 -49
  161. package/templates/.claude/skills/build/SKILL.md.template +0 -90
  162. package/templates/.claude/skills/deploy/SKILL.md.template +0 -111
  163. package/templates/.claude/skills/deploy/references/gotchas.md +0 -5
  164. package/templates/.claude/skills/doctor/SKILL.md +0 -31
  165. package/templates/.claude/skills/gcloud/SKILL.md +0 -66
  166. package/templates/.claude/skills/gcloud/references/gotchas.md +0 -5
  167. package/templates/.claude/skills/learned/SKILL.md +0 -55
  168. package/templates/.claude/skills/learned/references/conventions.md +0 -11
  169. package/templates/.claude/skills/learned/references/deny-recommendations.md +0 -18
  170. package/templates/.claude/skills/learned/references/gotchas.md +0 -11
  171. package/templates/.claude/skills/pulumi/SKILL.md +0 -73
  172. package/templates/.claude/skills/quality/SKILL.md.template +0 -89
  173. package/templates/.claude/skills/quality/references/gotchas.md +0 -5
  174. package/templates/.claude/skills/review/SKILL.md.template +0 -74
  175. package/templates/.claude/skills/scaffold/SKILL.md.template +0 -113
  176. package/templates/.claude/skills/secrets/SKILL.md +0 -51
  177. package/templates/.claude/skills/session/SKILL.md +0 -32
  178. package/templates/.claude/skills/test/SKILL.md.template +0 -116
  179. package/templates/.claude/skills/test/references/gotchas.md +0 -5
@@ -0,0 +1,165 @@
1
+ ---
2
+ name: dxkit-fix
3
+ description: Repair a broken dxkit install — read doctor's structured output and walk the customer through each fix. Use when the user asks "fix dxkit", "fix my dxkit install", "doctor says X but Y is broken", "the pre-push hook isn't firing", "vyuh-dxkit command not found", or anything else that points at a broken-install state. Hands off to dxkit-init for fresh installs and dxkit-hooks for hook-specific deep dives.
4
+ ---
5
+
6
+ # dxkit-fix
7
+
8
+ This skill repairs broken dxkit installs. It does NOT install dxkit from scratch (that's `dxkit-init`) and it does NOT triage code findings (that's `dxkit-action`). Use it when something about the install itself is wrong — hooks not firing, vyuh-dxkit not on PATH, scanner toolchain missing pieces, baseline absent, etc.
9
+
10
+ ## How dxkit-fix works
11
+
12
+ The skill consumes `npx vyuh-dxkit doctor --json` output. Doctor returns a structured `DoctorReport` with a `summary.fixable[]` array — every failing check carries:
13
+
14
+ - `label` — the problem in one line
15
+ - `fix.hint` — the human-readable explanation
16
+ - `fix.command` — the shell command that repairs it (optional)
17
+ - `fix.skill` — a more specific dxkit-* skill that can deep-dive (optional)
18
+
19
+ The skill iterates `summary.fixable[]`, asks the customer for confirmation on each fix (with the command shown), runs it, then re-runs doctor at the end to verify everything closed.
20
+
21
+ ## The repair loop
22
+
23
+ ```
24
+ [1] Run doctor in JSON mode → npx vyuh-dxkit doctor --json
25
+ [2] Read summary.fixable[] → enumerate broken signals + fix commands
26
+ [3] For each fixable:
27
+ [3a] Show the customer: label + hint + command
28
+ [3b] Confirm (default Y)
29
+ [3c] Run the command in their shell
30
+ [3d] Note success/failure
31
+ [4] Re-run doctor → verify the previously-fixable list is now empty
32
+ [5] Report what remains → any non-fixable failures + which dxkit-* skill handles them
33
+ ```
34
+
35
+ ## Steps
36
+
37
+ ### 1. Snapshot the broken state
38
+
39
+ ```bash
40
+ npx vyuh-dxkit doctor --json > /tmp/dxkit-doctor.json
41
+ ```
42
+
43
+ Capturing to a file (instead of piping inline) lets the customer re-read what was broken if a fix takes multiple iterations.
44
+
45
+ ### 2. Read the fixable list
46
+
47
+ The JSON has shape `{ schema: "doctor.v1", checks: [...], summary: { fixable: [...] } }`. Iterate `summary.fixable` only — each entry has `ok: false` AND a `fix` block. Failing checks WITHOUT a fix block are informational (e.g. a missing optional toolchain) and shouldn't be touched here.
48
+
49
+ ### 3. Walk the customer through each fix
50
+
51
+ For every fixable entry, present:
52
+
53
+ | Field | What to show |
54
+ |---|---|
55
+ | `label` | Section heading ("git hooks active — not activated") |
56
+ | `fix.hint` | One-line "what this means" explanation |
57
+ | `fix.command` | The exact shell command, in a code block |
58
+ | `fix.skill` (if present and ≠ dxkit-fix) | "For a deeper walkthrough, ask Claude Code: 'set up hooks'" (or whatever the skill's trigger is) |
59
+
60
+ Then ASK the customer: "Run this fix? [Y/n]". Default Y. If they decline, skip and move on.
61
+
62
+ When they confirm, run the command. Stream output. Note the exit code.
63
+
64
+ ### 4. Idempotency check
65
+
66
+ Every fix command in the doctor output is designed to be idempotent — re-running it on a working install is a no-op (or a refresh). So even if a customer answers Y twice by accident, nothing breaks.
67
+
68
+ ### 5. Verify with a second doctor run
69
+
70
+ After all fixes are applied (or declined), run `npx vyuh-dxkit doctor --json` again. The new `summary.fixable[]` should be a strict subset of the first run's. If something didn't close, surface it with the original `fix.hint` and offer to retry or escalate to the more specific skill.
71
+
72
+ ## What dxkit-fix can repair
73
+
74
+ Driven by doctor's tier 3 (operational health) — these are the canonical repairables today:
75
+
76
+ | Symptom (doctor label) | Fix command | Notes |
77
+ |---|---|---|
78
+ | `git hooks active` not active | `npx vyuh-dxkit hooks activate` | Sets `core.hooksPath = .githooks`. Refuses to clobber husky/lefthook configs. |
79
+ | `baseline captured` missing | `npx vyuh-dxkit baseline create` | First-run: locks in today's findings as "pre-existing." Warn customer this is value-laden — see "Capturing the FIRST baseline" below. |
80
+ | `vyuh-dxkit on PATH` not found | `npm install -g @vyuhlabs/dxkit` | Global install ensures the bare CLI works in any shell session. |
81
+ | `scanner toolchain` missing pieces | `npx vyuh-dxkit tools install --yes` | Reinstalls any ✗ tools per TOOL_DEFS. Idempotent on already-installed tools. |
82
+ | `.npmrc legacy-peer-deps persistence` missing | `echo "legacy-peer-deps=true" >> .npmrc` | Locks in the peer-dep resolution mode for future `npm install` calls. |
83
+ | `CI guardrails workflow` missing | `npx vyuh-dxkit init --with-ci --yes` | Adds the dxkit-guardrails.yml workflow. Idempotent. |
84
+ | Agent DX tier failures (manifest missing, AGENTS.md missing, .claude/* missing) | `npx vyuh-dxkit init --full --yes` or `npx vyuh-dxkit update` | Init for fresh installs; update for refreshes. |
85
+
86
+ ## Capturing the FIRST baseline — be deliberate
87
+
88
+ Of all the fixes, `baseline create` is the only one with permanent consequences. The baseline records the fingerprint of every finding currently in the repo and tells future scans "these are pre-existing — don't block on them."
89
+
90
+ If the customer's repo has uncaptured findings that are real security issues (hardcoded secrets, leaked API keys, etc.), creating a baseline NOW locks those in as accepted. They won't trip the guardrail check.
91
+
92
+ Before running `baseline create` on a customer who has NEVER captured one, surface this tradeoff:
93
+
94
+ > Capturing a baseline locks in **N** current findings as "pre-existing." If any of those are real defects you'd want to fix first (secrets to rotate, vulnerable deps to upgrade), tell me and I'll show you what's flagged so we can triage before baseline.
95
+ >
96
+ > Skip baseline now if: you have secrets in the repo, or you'd rather fix-as-you-go than accept the current state.
97
+ > Capture baseline now if: the codebase is a known-messy brownfield and you want guardrails on future regressions specifically.
98
+
99
+ If they say "show me what's flagged first," hand off to `dxkit-action` — that skill triages findings before baseline lock-in.
100
+
101
+ ## What dxkit-fix can NOT repair
102
+
103
+ These need a different skill or human action:
104
+
105
+ - **Code findings** (hardcoded secrets, lint errors, duplicates, missing tests) — `dxkit-action` handles triage + fixing. Doctor only flags that the install is working; the analyzer results are a separate surface.
106
+ - **Branch protection on the GitHub repo** — needs `gh api` credentials + repo-admin rights. The `setup-branch-protection` CLI (when available) wraps this. If doctor flags the workflow as missing but the customer's CI is healthy on PRs, this is a documentation gap, not an install gap.
107
+ - **Real secret rotation** — even after dxkit detects a hardcoded API key, the credential needs to be rotated in its issuing provider's UI by a human.
108
+ - **External tool toolchains** (e.g. a Go compiler for stacks that don't have Go) — dxkit's TOOL_DEFS install most scanner tools; toolchains for the customer's project itself are out of scope.
109
+
110
+ ## When to delegate to a more specific dxkit-* skill
111
+
112
+ Doctor's `fix.skill` field signals "this is more nuanced than a single command — walk through it via that skill." Cases:
113
+
114
+ | `fix.skill` | When to delegate |
115
+ |---|---|
116
+ | `dxkit-init` | Customer doesn't have a manifest at all — they need the full first-install flow, not a repair. |
117
+ | `dxkit-hooks` | Hook-related repair where the customer also wants chaining advice (husky/lefthook integration, bypass workflow, removal). |
118
+ | `dxkit-config` | Customer wants to tune what dxkit flags (e.g. exclude a vendored dir, adjust severity policy) rather than fix a broken state. |
119
+ | (no skill, command only) | Plain repair — apply the command and move on. |
120
+
121
+ If `fix.skill === "dxkit-fix"`, that's the default path — handle it here.
122
+
123
+ ## Idempotency + safety
124
+
125
+ Every repair this skill drives is idempotent and reversible:
126
+
127
+ - `hooks activate` is no-op if hooks already pointed at .githooks
128
+ - `baseline create` refuses to overwrite an existing baseline without `--force` — so accidentally running it twice can't corrupt state
129
+ - `tools install --yes` skips already-installed tools (per TOOL_DEFS check command)
130
+ - `npm install -g @vyuhlabs/dxkit` upgrades or installs as needed; no data loss
131
+ - `.npmrc` append is line-deduplicated
132
+
133
+ So a customer who declines a fix, then runs into it again later, can re-invoke the skill with no penalty.
134
+
135
+ ## Failure modes
136
+
137
+ If a fix command fails (non-zero exit):
138
+
139
+ 1. **Capture the stderr** so the customer can see why
140
+ 2. **Don't auto-retry** — the customer's environment may have a problem the fix can't solve (no network, permission denied, registry hiccup)
141
+ 3. **Suggest a manual workaround** if there's an obvious one (e.g. for global install failures, suggest `sudo npm install -g` on systems where the npm prefix isn't user-writable)
142
+ 4. **Continue with the remaining fixes** — one failure shouldn't block the rest
143
+
144
+ Surface failures in the final summary alongside what DID get fixed.
145
+
146
+ ## Final summary
147
+
148
+ After the loop completes, structure the report:
149
+
150
+ ```
151
+ ✓ Repaired:
152
+ • git hooks active
153
+ • vyuh-dxkit on PATH
154
+
155
+ ✗ Failed:
156
+ • baseline captured — `vyuh-dxkit baseline create` exit 1 (no .dxkit/ write permission?)
157
+
158
+ → Skipped:
159
+ • .npmrc legacy-peer-deps persistence (you declined)
160
+
161
+ Remaining issues (not auto-fixable):
162
+ • CI guardrails workflow missing → ask 'set up dxkit init' to walk through init --with-ci
163
+ ```
164
+
165
+ End with a one-line CTA: "Run `npx vyuh-dxkit doctor` to confirm the final state, or ask 'fix dxkit' again if anything new comes up."
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: dxkit-hooks
3
+ description: Install, configure, troubleshoot, or remove dxkit git hooks. Use when the user asks "set up hooks", "pre-push isn't firing", "how do I chain with husky", "bypass the hook", or anything about pre-commit/pre-push behavior in a dxkit-managed repo.
4
+ ---
5
+
6
+ # dxkit-hooks
7
+
8
+ This skill handles the git-hook surface dxkit ships. Use it to install hooks, debug "the hook didn't fire," chain dxkit with an existing hook system, or guide a bypass.
9
+
10
+ ## What dxkit ships
11
+
12
+ `.githooks/pre-push` (default-on under `--full`) — runs the guardrail check before code leaves the developer's machine. Fast on warm scanner caches (~10-30s).
13
+
14
+ `.githooks/pre-commit` (opt-in via `--with-precommit-hook`) — same guardrail check but on every commit. Slower on large repos (~1-3 min on 500+ file repos). Not in `--full` by default because the wall-clock cost gates adoption.
15
+
16
+ Both run `npx vyuh-dxkit guardrail check`. The check exits 1 (blocking) on net-new findings vs. the baseline.
17
+
18
+ ## Installation
19
+
20
+ ```bash
21
+ # Pre-push only (recommended for most teams)
22
+ npx vyuh-dxkit init --with-hooks --yes
23
+
24
+ # Both pre-commit + pre-push
25
+ npx vyuh-dxkit init --with-hooks --with-precommit-hook --yes
26
+
27
+ # Add to an existing dxkit install (idempotent)
28
+ npx vyuh-dxkit init --with-precommit-hook --yes
29
+ ```
30
+
31
+ Existing hooks at `.githooks/<name>` or `.husky/<name>` trigger sidecar-write mode: dxkit puts its hook at `.githooks/<name>.dxkit` and emits a chain note instead of clobbering.
32
+
33
+ ## Activation
34
+
35
+ Hooks activate by setting `core.hooksPath = .githooks` in the local git config. Dxkit wires this via `npm postinstall` so every clone + `npm install` runs it automatically. Manual:
36
+
37
+ ```bash
38
+ # Either of these works
39
+ npx vyuh-dxkit hooks activate
40
+ git config core.hooksPath .githooks
41
+ ```
42
+
43
+ `npx vyuh-dxkit hooks activate` is idempotent — refuses to clobber a custom hooksPath (husky's `.husky`, lefthook's `.lefthook`, etc.). Run it to confirm the current state.
44
+
45
+ ## Troubleshooting "hook didn't fire"
46
+
47
+ Walk this checklist:
48
+
49
+ 1. **Hook file exists**: `ls -la .githooks/pre-push` — should be executable.
50
+ 2. **hooksPath is wired**: `git config --local --get core.hooksPath` should print `.githooks`. If empty or pointing elsewhere, run `npx vyuh-dxkit hooks activate`.
51
+ 3. **dxkit binary is on PATH**: from the repo root, `which npx vyuh-dxkit` should resolve (either project-local `./node_modules/.bin/vyuh-dxkit` or global). The hook delegates to whichever it finds.
52
+ 4. **Baseline exists**: `test -f .dxkit/baselines/main.json` — without a baseline the guardrail has nothing to compare against. Run `npx vyuh-dxkit baseline create`.
53
+ 5. **Run the check by hand**: `npx vyuh-dxkit guardrail check` from the repo root. Expected: exits 1 on net-new findings (red), 0 on clean diff (green).
54
+
55
+ If all five pass and the hook still doesn't fire, the most common cause is a competing hook system. `git config --global --get core.hooksPath` could be set globally to something else.
56
+
57
+ ## Chaining with husky / lefthook / other hook managers
58
+
59
+ When dxkit detects an existing hook (`.husky/pre-commit` or `.githooks/pre-commit`), it writes `.githooks/pre-commit.dxkit` instead and prints a chain note. To wire them together, add a line at the end of the existing hook:
60
+
61
+ ```bash
62
+ # .husky/pre-commit (after husky's own logic)
63
+ sh .githooks/pre-commit.dxkit
64
+ ```
65
+
66
+ Order matters: run the fast lint/format hooks first, then dxkit's guardrail last (so dxkit sees the actual final diff).
67
+
68
+ For pre-push, same pattern with `.githooks/pre-push.dxkit`.
69
+
70
+ ## Bypass (emergency)
71
+
72
+ When a hook blocks a push and the fix needs to land NOW (incident response, hotfix):
73
+
74
+ ```bash
75
+ git push --no-verify
76
+ ```
77
+
78
+ This skips ALL git hooks (not just dxkit's). After the emergency:
79
+
80
+ 1. Open the .dxkit/reports/ from the blocked push to understand what got bypassed.
81
+ 2. Either fix the regression in a follow-up commit OR
82
+ 3. Re-baseline if the regression is intentional and accepted:
83
+ ```bash
84
+ npx vyuh-dxkit baseline create --force
85
+ git add .dxkit/baselines/main.json
86
+ git commit -m "chore(baseline): accept regression from <ref>"
87
+ ```
88
+
89
+ Re-baselining is a deliberate action — it grants future scans permission to keep the regression. Don't do it casually; use the policy file to suppress noisy finding kinds instead.
90
+
91
+ ## Disabling pre-commit (keeping pre-push)
92
+
93
+ If pre-commit becomes a wall-clock blocker:
94
+
95
+ ```bash
96
+ rm .githooks/pre-commit
97
+ ```
98
+
99
+ `git config core.hooksPath` stays pointed at `.githooks/` (don't unset it). Future `init` calls won't re-add pre-commit unless `--with-precommit-hook` is passed.
100
+
101
+ ## Removing dxkit hooks entirely
102
+
103
+ ```bash
104
+ git config --local --unset core.hooksPath
105
+ rm -rf .githooks
106
+ # Also remove the postinstall line from package.json if you want a clean uninstall
107
+ ```
108
+
109
+ The CI workflows in `.github/workflows/dxkit-*.yml` continue to enforce the guardrail at PR-time, so removing local hooks doesn't disable the safety guarantees — just shifts them to CI-only.
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: dxkit-init
3
+ description: Walk the user through installing and configuring dxkit on a fresh repo. Use when the user asks "how do I install dxkit?", "set up dxkit on this repo", "what flags should I use?", or wants to scaffold the guardrail surface. Defers to dxkit-config / dxkit-hooks for post-install tuning.
4
+ ---
5
+
6
+ # dxkit-init
7
+
8
+ This skill scaffolds dxkit on a repo: chooses flags, runs `init`, captures a baseline, and points at the next steps.
9
+
10
+ ## Decision tree
11
+
12
+ Ask the user what they want, then pick the right invocation:
13
+
14
+ 1. **"Just give me everything"** → `npm init @vyuhlabs/dxkit` (collapses install + init), or if dxkit is already a devDep: `npx vyuh-dxkit init --full --yes`
15
+ 2. **"I only want the agent context, no guardrails yet"** → `npx vyuh-dxkit init --with-dxkit-agents --yes`
16
+ 3. **"I want guardrails but no CI"** → `npx vyuh-dxkit init --with-hooks --with-dxkit-agents --yes`
17
+ 4. **"I want the full setup but no pre-commit"** → `--full --yes` already does this (pre-commit is opt-in via `--with-precommit-hook` because it's slow on large repos)
18
+ 5. **"Interactive — talk me through it"** → `npx vyuh-dxkit init` (no `--yes`) and let it prompt
19
+
20
+ ## Flag reference
21
+
22
+ | Flag | What it ships | Default under `--full`? |
23
+ |---|---|---|
24
+ | `--with-dxkit-agents` | The 6 dxkit-* skills + AGENTS.md + CLAUDE.md shim | Yes |
25
+ | `--with-hooks` | `.githooks/pre-push` + postinstall activation wire-up | Yes |
26
+ | `--with-precommit-hook` | Adds `.githooks/pre-commit` (slow on large repos) | No (still opt-in) |
27
+ | `--with-devcontainer` | `.devcontainer/devcontainer.json` (per-stack features) + post-create.sh | Yes |
28
+ | `--with-ci` | `.github/workflows/dxkit-guardrails.yml` (PR gate) | Yes |
29
+ | `--with-baseline-refresh` | `.github/workflows/dxkit-baseline-refresh.yml` (post-merge regen) | Yes |
30
+ | `--with-pr-review` | `.github/workflows/pr-review.yml` (AI PR review; needs `ANTHROPIC_API_KEY`) | No (still opt-in) |
31
+
32
+ `--yes` accepts all prompts; `--force` overwrites existing files instead of writing `.dxkit` sidecars on conflict.
33
+
34
+ ## Steps
35
+
36
+ 1. **Detect the stack** before installing — let the user confirm:
37
+ ```bash
38
+ npx vyuh-dxkit init --detect
39
+ ```
40
+ This auto-detects and previews what `init --full` would do without writing anything.
41
+
42
+ 2. **Run init**:
43
+ ```bash
44
+ # Most common case — full setup, no prompts
45
+ npx vyuh-dxkit init --full --yes
46
+ ```
47
+
48
+ 3. **Capture the brownfield baseline** — must do this before hooks/CI become useful:
49
+ ```bash
50
+ npx vyuh-dxkit baseline create
51
+ git add .dxkit/baselines/
52
+ git commit -m "chore: capture dxkit baseline"
53
+ ```
54
+
55
+ 4. **Verify the install**:
56
+ ```bash
57
+ npx vyuh-dxkit doctor
58
+ ```
59
+ This checks: hooks active, baseline present, workflows installed, scanner toolchain available.
60
+
61
+ 5. **Hand off**:
62
+ - For policy / exclusions / scoring thresholds → `dxkit-config` skill
63
+ - For hook troubleshooting → `dxkit-hooks` skill
64
+ - For running reports → `dxkit-reports` skill
65
+ - For branch protection (manual today, automated in next release): GitHub repo settings → Branches → require `dxkit guardrails` check + require PR review
66
+
67
+ ## Common pitfalls
68
+
69
+ - **No package.json**: `npm init @vyuhlabs/dxkit` seeds a minimal one. For Python-only / Go-only repos, install dxkit globally instead: `npm install -g @vyuhlabs/dxkit && npx vyuh-dxkit init --full --yes`.
70
+ - **Existing .claude/ from 2.5.0**: dxkit init is additive — your existing `.claude/` files are preserved. To switch to the new dxkit-specific shape, delete the old `.claude/` dir first, then re-init.
71
+ - **Peer-dep ERESOLVE during `npm install`**: `npm init @vyuhlabs/dxkit` automatically retries with `--legacy-peer-deps`. Manual installs may need that flag.
72
+ - **Brownfield repo with thousands of existing findings**: that's normal — the baseline records them all once. Guardrail only blocks net-new findings.
73
+
74
+ ## What `init --full` writes
75
+
76
+ A complete install lays down ~15-20 files (down from the 2.5.0 ~73-file scaffold). Per-repo:
77
+
78
+ - `.dxkit/baselines/main.json` (after `baseline create`)
79
+ - `.dxkit-ignore` (starter template)
80
+ - `.npx vyuh-dxkit.json` (manifest)
81
+ - `.githooks/pre-push`
82
+ - `.github/workflows/dxkit-guardrails.yml`
83
+ - `.github/workflows/dxkit-baseline-refresh.yml`
84
+ - `.devcontainer/devcontainer.json` (per-stack features)
85
+ - `.devcontainer/post-create.sh`
86
+ - `.devcontainer/install-agent-clis.sh`
87
+ - `.claude/skills/dxkit-{learn,init,config,hooks,reports,action}/SKILL.md`
88
+ - `.claude/rules/<lang>.md` (per active language pack)
89
+ - `.claude/settings.json` (narrowed: dxkit-binary permissions only)
90
+ - `AGENTS.md` (project prose context for any agent — Claude, Codex, Cursor, Aider)
91
+ - `CLAUDE.md` (shim pointing at AGENTS.md)
92
+ - `package.json` (postinstall = `npx vyuh-dxkit hooks activate`)
93
+ - `.gitignore` (additive: `.dxkit/reports/`, `.dxkit/cache/`, `graphify-out/`)
@@ -0,0 +1,84 @@
1
+ ---
2
+ name: dxkit-learn
3
+ description: Answer questions about dxkit — what each scanner does, what a baseline is, what the 6 health dimensions score, how guardrails work. Use when the user asks "what does dxkit X do?", "what's a baseline?", "what's the slop score?", "how do hooks fit in?", or anything else about dxkit concepts.
4
+ ---
5
+
6
+ # dxkit-learn
7
+
8
+ This skill explains how dxkit works. Reach for it when the user asks about dxkit concepts before they take an action.
9
+
10
+ ## Mental model
11
+
12
+ dxkit measures a codebase along **6 dimensions** (Security, Code Quality, Tests, Documentation, Maintainability, Developer Experience) using deterministic scanners (gitleaks, semgrep, cloc, jscpd, graphify, ruff, eslint, …). Findings are anchored to a **baseline** (`.dxkit/baselines/main.json`) so today's pre-existing issues don't block tomorrow's PR. A **guardrail check** diffs current state against the baseline and blocks net-new regressions. Hooks + CI wire the guardrail into the developer's workflow.
13
+
14
+ The three contracts to remember:
15
+
16
+ 1. **Baseline = the brownfield anchor**. Pre-existing findings are recorded once; future scans only block on *additions*.
17
+ 2. **Hooks fire fast (pre-push); CI fires thorough**. Both use the same guardrail logic.
18
+ 3. **Reports are deterministic** — same code + same baseline = same findings. The salt mode (`deterministic` vs `random`) controls per-finding identity stability across runs.
19
+
20
+ ## The 6 dimensions
21
+
22
+ Each dimension is a 0-100 score with letter grade (A≥80, B≥60, C≥40, D≥20, E<20):
23
+
24
+ | Dimension | What scores it down |
25
+ |---|---|
26
+ | **Security** | Secret leaks (gitleaks), SAST findings (semgrep), dependency vulns (osv-scanner / npm-audit / pip-audit / etc.), TLS-bypass patterns |
27
+ | **Code Quality** | Lint findings (eslint / ruff / golangci-lint / clippy / detekt / rubocop / dotnet-format), high duplication (jscpd), code-pattern slop |
28
+ | **Tests** | Missing test coverage on primary-architecture files; missing test runner config; below-threshold line coverage |
29
+ | **Documentation** | Missing/empty README; missing doc-comments on public APIs (XML-doc/JSDoc/TSDoc/godoc/etc.); below-threshold comment ratio |
30
+ | **Maintainability** | Function/file size outliers, deep cyclomatic complexity, god-objects, high orphan-module count, dead imports |
31
+ | **Developer Experience** | Missing `.gitignore` / `.editorconfig` / `package.json` engines pin / devcontainer / hooks / CI workflow |
32
+
33
+ Run `npx vyuh-dxkit health` to see all six at once. Each dimension report has a "top actions" list — the changes that would lift the score the most.
34
+
35
+ ## The scanner toolchain
36
+
37
+ dxkit doesn't write parsers — it orchestrates established tools and computes scores. The full list is in `TOOL_DEFS` (or run `npx vyuh-dxkit tools list`). Key ones:
38
+
39
+ - **gitleaks** — secret scanning (API keys, AWS credentials, GitHub tokens)
40
+ - **semgrep** — multi-language SAST (auto config picks rulesets per active language pack)
41
+ - **cloc** — language-aware line counting (excludes comments + blanks)
42
+ - **jscpd** — copy-paste detection
43
+ - **graphify** — AST-based metrics (functions, classes, cohesion, god-nodes, dead imports)
44
+ - **osv-scanner** — dependency vulnerabilities (npm/pip/cargo/go/gem/maven via OSV.dev)
45
+ - Per-language linters: eslint (TS), ruff (Python), golangci-lint (Go), clippy (Rust), dotnet-format (C#), detekt (Kotlin), pmd (Java), rubocop (Ruby)
46
+
47
+ If a tool isn't installed, dxkit degrades gracefully (the affected dimension reports a partial score with a "missing tool" note instead of crashing).
48
+
49
+ ## Baselines explained
50
+
51
+ A baseline is the per-finding identity snapshot of a scan. Every finding has a **fingerprint** (SHA-1[0:16] of file+rule+line-window+content). The baseline stores those fingerprints. The guardrail diffs today's scan against the baseline:
52
+
53
+ - Fingerprint in scan + in baseline → **existing** (ignored)
54
+ - Fingerprint in scan + NOT in baseline → **added** (blocks)
55
+ - Fingerprint in baseline + NOT in scan → **removed** (silently good)
56
+
57
+ That's why "fix a critical, leave the medium" works — the medium's fingerprint stays in the baseline; only net-new findings count.
58
+
59
+ Commands:
60
+
61
+ ```bash
62
+ npx vyuh-dxkit baseline create # Capture current state into .dxkit/baselines/main.json
63
+ npx vyuh-dxkit baseline show # Summarize what's recorded
64
+ npx vyuh-dxkit baseline show --kind secret # Drill into a specific finding kind
65
+ npx vyuh-dxkit guardrail check # Diff current scan vs baseline; exit 1 on net-new
66
+ ```
67
+
68
+ ## Hooks
69
+
70
+ Two hooks ship under `.githooks/`:
71
+
72
+ - **pre-push** (always-on under `--full`): runs the guardrail check before code leaves the developer's machine. Fast on warm scanner caches (~10-30s).
73
+ - **pre-commit** (opt-in via `--with-precommit-hook`): same logic, fires on every commit. Slower on large repos until incremental scanning lands.
74
+
75
+ Activation is wired via `npm postinstall` so `npm install` after `git clone` sets `core.hooksPath = .githooks` automatically.
76
+
77
+ ## How to learn more
78
+
79
+ - `npx vyuh-dxkit <subcommand> --help` — flag reference
80
+ - `npx vyuh-dxkit baseline show` — what your repo already has recorded
81
+ - `.dxkit/reports/` — every analyzer's markdown + JSON output from the last run
82
+ - `npx vyuh-dxkit dashboard` — single HTML view of every report
83
+
84
+ When the user asks specifically about a scanner or a finding type, point them at the relevant report or run the relevant analyzer command directly.