@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.
- package/CHANGELOG.md +231 -0
- package/README.md +48 -28
- package/dist/analyzers/tools/graphify.d.ts.map +1 -1
- package/dist/analyzers/tools/graphify.js +9 -5
- package/dist/analyzers/tools/graphify.js.map +1 -1
- package/dist/analyzers/tools/tool-registry.d.ts +19 -1
- package/dist/analyzers/tools/tool-registry.d.ts.map +1 -1
- package/dist/analyzers/tools/tool-registry.js +50 -8
- package/dist/analyzers/tools/tool-registry.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +104 -11
- package/dist/cli.js.map +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +0 -10
- package/dist/constants.js.map +1 -1
- package/dist/detect.d.ts.map +1 -1
- package/dist/detect.js +0 -15
- package/dist/detect.js.map +1 -1
- package/dist/doctor.d.ts +78 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +509 -103
- package/dist/doctor.js.map +1 -1
- package/dist/generator.d.ts +1 -1
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +96 -135
- package/dist/generator.js.map +1 -1
- package/dist/hooks-cli.d.ts +20 -0
- package/dist/hooks-cli.d.ts.map +1 -0
- package/dist/hooks-cli.js +145 -0
- package/dist/hooks-cli.js.map +1 -0
- package/dist/languages/csharp.d.ts.map +1 -1
- package/dist/languages/csharp.js +5 -0
- package/dist/languages/csharp.js.map +1 -1
- package/dist/languages/go.d.ts.map +1 -1
- package/dist/languages/go.js +5 -0
- package/dist/languages/go.js.map +1 -1
- package/dist/languages/index.d.ts +43 -0
- package/dist/languages/index.d.ts.map +1 -1
- package/dist/languages/index.js +76 -0
- package/dist/languages/index.js.map +1 -1
- package/dist/languages/java.d.ts.map +1 -1
- package/dist/languages/java.js +5 -0
- package/dist/languages/java.js.map +1 -1
- package/dist/languages/kotlin.d.ts.map +1 -1
- package/dist/languages/kotlin.js +10 -0
- package/dist/languages/kotlin.js.map +1 -1
- package/dist/languages/python.d.ts.map +1 -1
- package/dist/languages/python.js +13 -0
- package/dist/languages/python.js.map +1 -1
- package/dist/languages/ruby.d.ts.map +1 -1
- package/dist/languages/ruby.js +5 -0
- package/dist/languages/ruby.js.map +1 -1
- package/dist/languages/rust.d.ts.map +1 -1
- package/dist/languages/rust.js +5 -0
- package/dist/languages/rust.js.map +1 -1
- package/dist/languages/types.d.ts +47 -0
- package/dist/languages/types.d.ts.map +1 -1
- package/dist/languages/typescript.d.ts.map +1 -1
- package/dist/languages/typescript.js +6 -0
- package/dist/languages/typescript.js.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +0 -5
- package/dist/prompts.js.map +1 -1
- package/dist/setup-branch-protection.d.ts +34 -0
- package/dist/setup-branch-protection.d.ts.map +1 -0
- package/dist/setup-branch-protection.js +190 -0
- package/dist/setup-branch-protection.js.map +1 -0
- package/dist/setup-gh.d.ts +75 -0
- package/dist/setup-gh.d.ts.map +1 -0
- package/dist/setup-gh.js +213 -0
- package/dist/setup-gh.js.map +1 -0
- package/dist/setup-prebuild.d.ts +34 -0
- package/dist/setup-prebuild.d.ts.map +1 -0
- package/dist/setup-prebuild.js +181 -0
- package/dist/setup-prebuild.js.map +1 -0
- package/dist/ship-installers.d.ts +6 -0
- package/dist/ship-installers.d.ts.map +1 -1
- package/dist/ship-installers.js +135 -5
- package/dist/ship-installers.js.map +1 -1
- package/dist/tools-cli.d.ts.map +1 -1
- package/dist/tools-cli.js +45 -9
- package/dist/tools-cli.js.map +1 -1
- package/dist/types.d.ts +24 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/update.d.ts +41 -0
- package/dist/update.d.ts.map +1 -1
- package/dist/update.js +154 -15
- package/dist/update.js.map +1 -1
- package/dist/upgrade.d.ts +88 -0
- package/dist/upgrade.d.ts.map +1 -0
- package/dist/upgrade.js +324 -0
- package/dist/upgrade.js.map +1 -0
- package/package.json +1 -1
- package/templates/.claude/skills/dxkit-action/SKILL.md +150 -0
- package/templates/.claude/skills/dxkit-config/SKILL.md +124 -0
- package/templates/.claude/skills/dxkit-fix/SKILL.md +165 -0
- package/templates/.claude/skills/dxkit-hooks/SKILL.md +109 -0
- package/templates/.claude/skills/dxkit-init/SKILL.md +93 -0
- package/templates/.claude/skills/dxkit-learn/SKILL.md +84 -0
- package/templates/.claude/skills/dxkit-onboard/SKILL.md +246 -0
- package/templates/.claude/skills/dxkit-reports/SKILL.md +111 -0
- package/templates/.claude/skills/dxkit-update/SKILL.md +164 -0
- package/templates/.devcontainer/devcontainer.json +13 -48
- package/templates/.devcontainer/post-create.sh +37 -8
- package/templates/AGENTS.md.template +137 -0
- package/templates/CLAUDE.md.template +16 -111
- package/dist/codebase-scanner.d.ts +0 -36
- package/dist/codebase-scanner.d.ts.map +0 -1
- package/dist/codebase-scanner.js +0 -687
- package/dist/codebase-scanner.js.map +0 -1
- package/templates/.claude/agents/doc-writer.md +0 -107
- package/templates/.claude/agents/knowledge-bot.md +0 -64
- package/templates/.claude/agents/onboarding.md +0 -62
- package/templates/.claude/agents/quality-reviewer.md +0 -85
- package/templates/.claude/agents-available/code-reviewer.md +0 -29
- package/templates/.claude/agents-available/codebase-explorer.md +0 -100
- package/templates/.claude/agents-available/dashboard-builder.md +0 -433
- package/templates/.claude/agents-available/debugger.md +0 -29
- package/templates/.claude/agents-available/dependency-mapper.md +0 -80
- package/templates/.claude/agents-available/dev-report.md +0 -108
- package/templates/.claude/agents-available/doc-writer.md +0 -107
- package/templates/.claude/agents-available/feature-builder.md +0 -163
- package/templates/.claude/agents-available/feature-planner.md +0 -185
- package/templates/.claude/agents-available/health-auditor.md +0 -95
- package/templates/.claude/agents-available/hooks-configurator.md +0 -211
- package/templates/.claude/agents-available/knowledge-bot.md +0 -62
- package/templates/.claude/agents-available/plan-executor.md +0 -133
- package/templates/.claude/agents-available/strategic-planner.md +0 -141
- package/templates/.claude/agents-available/test-gap-finder.md +0 -67
- package/templates/.claude/agents-available/test-writer.md +0 -34
- package/templates/.claude/agents-available/vulnerability-scanner.md +0 -173
- package/templates/.claude/commands/ask.md +0 -7
- package/templates/.claude/commands/build-feature.md +0 -26
- package/templates/.claude/commands/build.md.template +0 -30
- package/templates/.claude/commands/check.md.template +0 -43
- package/templates/.claude/commands/dashboard.md +0 -28
- package/templates/.claude/commands/deps.md +0 -15
- package/templates/.claude/commands/dev-report.md +0 -50
- package/templates/.claude/commands/docs.md +0 -21
- package/templates/.claude/commands/doctor.md +0 -29
- package/templates/.claude/commands/enable-agent.md +0 -12
- package/templates/.claude/commands/execute-plan.md +0 -25
- package/templates/.claude/commands/explore-codebase.md +0 -12
- package/templates/.claude/commands/export-pdf.md +0 -30
- package/templates/.claude/commands/feature.md +0 -25
- package/templates/.claude/commands/fix-issue.md +0 -12
- package/templates/.claude/commands/fix.md.template +0 -32
- package/templates/.claude/commands/health.md +0 -58
- package/templates/.claude/commands/help.md +0 -36
- package/templates/.claude/commands/learn.md +0 -48
- package/templates/.claude/commands/onboarding.md +0 -21
- package/templates/.claude/commands/plan.md +0 -20
- package/templates/.claude/commands/quality.md.template +0 -65
- package/templates/.claude/commands/session-end.md +0 -40
- package/templates/.claude/commands/session-start.md +0 -30
- package/templates/.claude/commands/setup-hooks.md +0 -18
- package/templates/.claude/commands/stealth-mode.md +0 -17
- package/templates/.claude/commands/test-gaps.md +0 -49
- package/templates/.claude/commands/test.md.template +0 -40
- package/templates/.claude/commands/vulnerabilities.md +0 -49
- package/templates/.claude/skills/build/SKILL.md.template +0 -90
- package/templates/.claude/skills/deploy/SKILL.md.template +0 -111
- package/templates/.claude/skills/deploy/references/gotchas.md +0 -5
- package/templates/.claude/skills/doctor/SKILL.md +0 -31
- package/templates/.claude/skills/gcloud/SKILL.md +0 -66
- package/templates/.claude/skills/gcloud/references/gotchas.md +0 -5
- package/templates/.claude/skills/learned/SKILL.md +0 -55
- package/templates/.claude/skills/learned/references/conventions.md +0 -11
- package/templates/.claude/skills/learned/references/deny-recommendations.md +0 -18
- package/templates/.claude/skills/learned/references/gotchas.md +0 -11
- package/templates/.claude/skills/pulumi/SKILL.md +0 -73
- package/templates/.claude/skills/quality/SKILL.md.template +0 -89
- package/templates/.claude/skills/quality/references/gotchas.md +0 -5
- package/templates/.claude/skills/review/SKILL.md.template +0 -74
- package/templates/.claude/skills/scaffold/SKILL.md.template +0 -113
- package/templates/.claude/skills/secrets/SKILL.md +0 -51
- package/templates/.claude/skills/session/SKILL.md +0 -32
- package/templates/.claude/skills/test/SKILL.md.template +0 -116
- package/templates/.claude/skills/test/references/gotchas.md +0 -5
package/dist/upgrade.js
ADDED
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* `vyuh-dxkit upgrade` — combined CLI for the dxkit upgrade flow.
|
|
4
|
+
*
|
|
5
|
+
* Two modes, one subcommand:
|
|
6
|
+
*
|
|
7
|
+
* `--plan [--json]` — preview only. Emits UpgradePlan JSON
|
|
8
|
+
* (consumed by dxkit-update skill) or text-prose summary. No
|
|
9
|
+
* mutations. Used to inspect what an upgrade would do before
|
|
10
|
+
* committing.
|
|
11
|
+
*
|
|
12
|
+
* (no flag, or `--yes`) — execute. Runs the three-step upgrade:
|
|
13
|
+
* 1. `npm install @vyuhlabs/dxkit@<target>` (binary)
|
|
14
|
+
* 2. `npx vyuh-dxkit update` (scaffold refresh)
|
|
15
|
+
* 3. `npx vyuh-dxkit doctor` (verify)
|
|
16
|
+
* Then prints devcontainer-rebuild instructions if .devcontainer/
|
|
17
|
+
* was refreshed.
|
|
18
|
+
*
|
|
19
|
+
* Architectural mirror of the doctor → dxkit-fix pattern: structured
|
|
20
|
+
* CLI output (--plan --json) for skill consumption, execution mode
|
|
21
|
+
* for direct human use. Same shape, different content.
|
|
22
|
+
*/
|
|
23
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
26
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
27
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
28
|
+
}
|
|
29
|
+
Object.defineProperty(o, k2, desc);
|
|
30
|
+
}) : (function(o, m, k, k2) {
|
|
31
|
+
if (k2 === undefined) k2 = k;
|
|
32
|
+
o[k2] = m[k];
|
|
33
|
+
}));
|
|
34
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}) : function(o, v) {
|
|
37
|
+
o["default"] = v;
|
|
38
|
+
});
|
|
39
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
40
|
+
var ownKeys = function(o) {
|
|
41
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
42
|
+
var ar = [];
|
|
43
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
44
|
+
return ar;
|
|
45
|
+
};
|
|
46
|
+
return ownKeys(o);
|
|
47
|
+
};
|
|
48
|
+
return function (mod) {
|
|
49
|
+
if (mod && mod.__esModule) return mod;
|
|
50
|
+
var result = {};
|
|
51
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
52
|
+
__setModuleDefault(result, mod);
|
|
53
|
+
return result;
|
|
54
|
+
};
|
|
55
|
+
})();
|
|
56
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
+
exports.classifyDelta = classifyDelta;
|
|
58
|
+
exports.buildUpgradePlan = buildUpgradePlan;
|
|
59
|
+
exports.runUpgrade = runUpgrade;
|
|
60
|
+
const fs = __importStar(require("fs"));
|
|
61
|
+
const path = __importStar(require("path"));
|
|
62
|
+
const child_process_1 = require("child_process");
|
|
63
|
+
const logger = __importStar(require("./logger"));
|
|
64
|
+
// ────────────────────────────────────────────────────────────────────
|
|
65
|
+
// Version helpers
|
|
66
|
+
// ────────────────────────────────────────────────────────────────────
|
|
67
|
+
function readScaffoldVersion(cwd) {
|
|
68
|
+
const manifestPath = path.join(cwd, '.vyuh-dxkit.json');
|
|
69
|
+
if (!fs.existsSync(manifestPath))
|
|
70
|
+
return null;
|
|
71
|
+
try {
|
|
72
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
73
|
+
return manifest.version ?? null;
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function readBinaryVersion(cwd) {
|
|
80
|
+
try {
|
|
81
|
+
const out = (0, child_process_1.execSync)('npx --no-install vyuh-dxkit --version 2>/dev/null', {
|
|
82
|
+
cwd,
|
|
83
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
84
|
+
encoding: 'utf-8',
|
|
85
|
+
});
|
|
86
|
+
return out.trim() || null;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
function readLatestPublished() {
|
|
93
|
+
try {
|
|
94
|
+
const out = (0, child_process_1.execSync)('npm view @vyuhlabs/dxkit version 2>/dev/null', {
|
|
95
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
96
|
+
encoding: 'utf-8',
|
|
97
|
+
timeout: 15000,
|
|
98
|
+
});
|
|
99
|
+
return out.trim();
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
// npm registry unreachable — return empty so caller can decide
|
|
103
|
+
return '';
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Classify the delta between two semver-shaped strings. Returns
|
|
108
|
+
* `'none'` if equal, `'downgrade'` if target < current.
|
|
109
|
+
*/
|
|
110
|
+
function classifyDelta(current, target) {
|
|
111
|
+
if (!current || !target)
|
|
112
|
+
return 'none';
|
|
113
|
+
const [c1, c2, c3] = current.split('.').map((n) => parseInt(n, 10));
|
|
114
|
+
const [t1, t2, t3] = target.split('.').map((n) => parseInt(n, 10));
|
|
115
|
+
if (Number.isNaN(c1) || Number.isNaN(t1))
|
|
116
|
+
return 'none';
|
|
117
|
+
if (t1 > c1)
|
|
118
|
+
return 'major';
|
|
119
|
+
if (t1 < c1)
|
|
120
|
+
return 'downgrade';
|
|
121
|
+
if (t2 > c2)
|
|
122
|
+
return 'minor';
|
|
123
|
+
if (t2 < c2)
|
|
124
|
+
return 'downgrade';
|
|
125
|
+
if (t3 > c3)
|
|
126
|
+
return 'patch';
|
|
127
|
+
if (t3 < c3)
|
|
128
|
+
return 'downgrade';
|
|
129
|
+
return 'none';
|
|
130
|
+
}
|
|
131
|
+
// ────────────────────────────────────────────────────────────────────
|
|
132
|
+
// Plan construction
|
|
133
|
+
// ────────────────────────────────────────────────────────────────────
|
|
134
|
+
function buildUpgradePlan(cwd, opts = {}) {
|
|
135
|
+
const scaffold = readScaffoldVersion(cwd);
|
|
136
|
+
const binary = (opts._readBinary ?? readBinaryVersion)(cwd);
|
|
137
|
+
const latest = opts.target ?? (opts._readLatest ?? readLatestPublished)();
|
|
138
|
+
// Use binary version as the "current" anchor for delta classification —
|
|
139
|
+
// it's what npm install will replace. Scaffold version informs whether
|
|
140
|
+
// vyuh-dxkit update is needed even when binary is already up to date.
|
|
141
|
+
const delta = classifyDelta(binary, latest);
|
|
142
|
+
const steps = [];
|
|
143
|
+
const warnings = [];
|
|
144
|
+
if (!latest) {
|
|
145
|
+
warnings.push('Could not query npm for the latest version (registry unreachable or rate-limited). ' +
|
|
146
|
+
'Pass --target=X.Y.Z to upgrade to a specific version.');
|
|
147
|
+
}
|
|
148
|
+
// Step 1: binary upgrade. Always included unless delta is none AND
|
|
149
|
+
// scaffold already matches.
|
|
150
|
+
if (delta !== 'none' || (scaffold && binary && scaffold !== binary)) {
|
|
151
|
+
if (latest) {
|
|
152
|
+
steps.push({
|
|
153
|
+
command: `npm install @vyuhlabs/dxkit@${latest}`,
|
|
154
|
+
purpose: `Install dxkit binary ${binary ?? '(missing)'} → ${latest}`,
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
// Step 2: scaffold refresh. Always run when scaffold ≠ binary OR after
|
|
159
|
+
// a binary upgrade (scaffold may need updating to match the new binary).
|
|
160
|
+
if (latest) {
|
|
161
|
+
steps.push({
|
|
162
|
+
command: 'npx vyuh-dxkit update',
|
|
163
|
+
purpose: 'Refresh scaffold (.devcontainer, .githooks, .claude/skills, CI workflows)',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// Step 3: verify with doctor.
|
|
167
|
+
if (latest) {
|
|
168
|
+
steps.push({
|
|
169
|
+
command: 'npx vyuh-dxkit doctor',
|
|
170
|
+
purpose: 'Verify operational health post-upgrade',
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
// Optional: devcontainer rebuild reminder. We mark this optional so
|
|
174
|
+
// dxkit-update can surface it as a "you also need to do this manually"
|
|
175
|
+
// step rather than something the CLI can execute.
|
|
176
|
+
const hasDevcontainer = fs.existsSync(path.join(cwd, '.devcontainer', 'devcontainer.json'));
|
|
177
|
+
if (hasDevcontainer && delta !== 'none') {
|
|
178
|
+
steps.push({
|
|
179
|
+
command: '# Rebuild devcontainer: VSCode Command Palette → "Dev Containers: Rebuild Container"',
|
|
180
|
+
purpose: 'Pick up devcontainer.json changes (if any) — manual step',
|
|
181
|
+
optional: true,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
// Warnings.
|
|
185
|
+
if (delta === 'major') {
|
|
186
|
+
warnings.push(`Major version jump (${binary} → ${latest}). Read CHANGELOG.md for breaking changes ` +
|
|
187
|
+
'before running the upgrade.');
|
|
188
|
+
}
|
|
189
|
+
if (delta === 'downgrade') {
|
|
190
|
+
warnings.push(`Target version ${latest} is OLDER than installed ${binary}. ` +
|
|
191
|
+
'Downgrades are not officially supported; baseline + manifest schemas may differ.');
|
|
192
|
+
}
|
|
193
|
+
if (scaffold && binary && scaffold !== binary) {
|
|
194
|
+
warnings.push(`Scaffold version (${scaffold}) doesn't match binary (${binary}). ` +
|
|
195
|
+
'Step 2 (vyuh-dxkit update) will reconcile.');
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
schema: 'upgrade-plan.v1',
|
|
199
|
+
generatedAt: new Date().toISOString(),
|
|
200
|
+
cwd,
|
|
201
|
+
current: { binary, scaffold },
|
|
202
|
+
target: latest,
|
|
203
|
+
delta,
|
|
204
|
+
steps,
|
|
205
|
+
warnings,
|
|
206
|
+
changelogNote: latest
|
|
207
|
+
? `For per-version details: https://github.com/vyuh-labs/dxkit/blob/main/CHANGELOG.md`
|
|
208
|
+
: '',
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
// ────────────────────────────────────────────────────────────────────
|
|
212
|
+
// Renderers
|
|
213
|
+
// ────────────────────────────────────────────────────────────────────
|
|
214
|
+
function renderPlanProse(plan) {
|
|
215
|
+
logger.header('vyuh-dxkit upgrade --plan');
|
|
216
|
+
logger.info(`Current: scaffold ${plan.current.scaffold ?? '(none)'} + binary ${plan.current.binary ?? '(none)'}`);
|
|
217
|
+
logger.info(`Target: ${plan.target || '(latest unavailable)'}`);
|
|
218
|
+
logger.info(`Delta: ${plan.delta}`);
|
|
219
|
+
if (plan.warnings.length) {
|
|
220
|
+
console.log(''); // slop-ok
|
|
221
|
+
for (const w of plan.warnings)
|
|
222
|
+
logger.warn(w);
|
|
223
|
+
}
|
|
224
|
+
if (plan.steps.length) {
|
|
225
|
+
console.log(''); // slop-ok
|
|
226
|
+
logger.info('Plan:');
|
|
227
|
+
plan.steps.forEach((s, i) => {
|
|
228
|
+
const marker = s.optional ? '○' : '●';
|
|
229
|
+
logger.dim(` ${marker} [${i + 1}/${plan.steps.length}] ${s.purpose}`);
|
|
230
|
+
logger.dim(` ${s.command}`);
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
if (plan.changelogNote) {
|
|
234
|
+
console.log(''); // slop-ok
|
|
235
|
+
logger.dim(plan.changelogNote);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
// ────────────────────────────────────────────────────────────────────
|
|
239
|
+
// Execution
|
|
240
|
+
// ────────────────────────────────────────────────────────────────────
|
|
241
|
+
function runStep(step, cwd, dryRun) {
|
|
242
|
+
if (step.optional) {
|
|
243
|
+
// Optional steps are never auto-executed — surfaced for the
|
|
244
|
+
// customer to do manually.
|
|
245
|
+
return true;
|
|
246
|
+
}
|
|
247
|
+
logger.info(`→ ${step.purpose}`);
|
|
248
|
+
logger.dim(` ${step.command}`);
|
|
249
|
+
if (dryRun) {
|
|
250
|
+
logger.dim(' (dry-run; skipping)');
|
|
251
|
+
return true;
|
|
252
|
+
}
|
|
253
|
+
// Shell out to a real shell so npx/npm work the same way as the
|
|
254
|
+
// customer's terminal would. We DON'T use spawnSync's shell:true
|
|
255
|
+
// bash escaping concerns because the commands here are all dxkit-
|
|
256
|
+
// controlled — no customer input flows into them.
|
|
257
|
+
const result = (0, child_process_1.spawnSync)('bash', ['-c', step.command], {
|
|
258
|
+
cwd,
|
|
259
|
+
stdio: 'inherit',
|
|
260
|
+
});
|
|
261
|
+
return result.status === 0;
|
|
262
|
+
}
|
|
263
|
+
async function runUpgradeExecution(cwd, plan, opts) {
|
|
264
|
+
// Print the plan so the customer sees what's about to happen.
|
|
265
|
+
renderPlanProse(plan);
|
|
266
|
+
if (plan.steps.length === 0) {
|
|
267
|
+
console.log(''); // slop-ok
|
|
268
|
+
logger.success('Already up to date — nothing to do.');
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
if (!opts.yes && !opts.dryRun) {
|
|
272
|
+
// We don't bundle a real prompt library here — the upgrade is
|
|
273
|
+
// intended either non-interactive (--yes) or driven by the
|
|
274
|
+
// dxkit-update skill (which handles confirmation). Surface the
|
|
275
|
+
// hint so a direct human invocation knows to add --yes.
|
|
276
|
+
console.log(''); // slop-ok
|
|
277
|
+
logger.warn('Interactive confirmation is not implemented for this command. ' +
|
|
278
|
+
'Re-run with --yes to execute, --dry-run to print without executing, ' +
|
|
279
|
+
'or use the dxkit-update skill for a guided upgrade.');
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
console.log(''); // slop-ok
|
|
283
|
+
logger.header('Executing upgrade');
|
|
284
|
+
const optionalAfter = [];
|
|
285
|
+
for (const step of plan.steps) {
|
|
286
|
+
if (step.optional) {
|
|
287
|
+
optionalAfter.push(step);
|
|
288
|
+
continue;
|
|
289
|
+
}
|
|
290
|
+
const ok = runStep(step, cwd, !!opts.dryRun);
|
|
291
|
+
if (!ok) {
|
|
292
|
+
logger.fail(`Step failed: ${step.purpose}`);
|
|
293
|
+
logger.dim(' Upgrade aborted. Re-run `vyuh-dxkit doctor` to see current state.');
|
|
294
|
+
process.exitCode = 1;
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
console.log(''); // slop-ok
|
|
299
|
+
logger.success(`Upgraded to ${plan.target}.`);
|
|
300
|
+
if (optionalAfter.length) {
|
|
301
|
+
console.log(''); // slop-ok
|
|
302
|
+
logger.info('Manual steps still required:');
|
|
303
|
+
for (const s of optionalAfter)
|
|
304
|
+
logger.dim(` • ${s.purpose}\n ${s.command}`);
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
// ────────────────────────────────────────────────────────────────────
|
|
308
|
+
// Entry point
|
|
309
|
+
// ────────────────────────────────────────────────────────────────────
|
|
310
|
+
async function runUpgrade(cwd, opts = {}) {
|
|
311
|
+
const plan = buildUpgradePlan(cwd, opts);
|
|
312
|
+
if (opts.planOnly) {
|
|
313
|
+
if (opts.json) {
|
|
314
|
+
// Logger already routes to stderr in --json mode (cli.ts sets it).
|
|
315
|
+
console.log(JSON.stringify(plan, null, 2)); // slop-ok
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
renderPlanProse(plan);
|
|
319
|
+
}
|
|
320
|
+
return;
|
|
321
|
+
}
|
|
322
|
+
await runUpgradeExecution(cwd, plan, opts);
|
|
323
|
+
}
|
|
324
|
+
//# sourceMappingURL=upgrade.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqHH,sCAYC;AAMD,4CA6FC;AAyHD,gCAcC;AAzWD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAAoD;AAEpD,iDAAmC;AAiEnC,uEAAuE;AACvE,kBAAkB;AAClB,uEAAuE;AAEvE,SAAS,mBAAmB,CAAC,GAAW;IACtC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IACxD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC;QAAE,OAAO,IAAI,CAAC;IAC9C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAa,CAAC;QAChF,OAAO,QAAQ,CAAC,OAAO,IAAI,IAAI,CAAC;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAW;IACpC,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,IAAA,wBAAQ,EAAC,mDAAmD,EAAE;YACxE,GAAG;YACH,KAAK,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC;YACnC,QAAQ,EAAE,OAAO;SAClB,CAAC,CAAC;QACH,OAAO,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,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AM,GAAG,CAAC,CAAC;IAC9C,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,UAAU;QAC3B,MAAM,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC;QAC5C,KAAK,MAAM,CAAC,IAAI,aAAa;YAAE,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAClF,CAAC;AACH,CAAC;AAED,uEAAuE;AACvE,cAAc;AACd,uEAAuE;AAEhE,KAAK,UAAU,UAAU,CAAC,GAAW,EAAE,OAAoB,EAAE;IAClE,MAAM,IAAI,GAAG,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEzC,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACd,mEAAmE;YACnE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU;QACxD,CAAC;aAAM,CAAC;YACN,eAAe,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC;QACD,OAAO;IACT,CAAC;IAED,MAAM,mBAAmB,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC7C,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dxkit-action
|
|
3
|
+
description: Read a dxkit report and execute fixes — prioritize findings by severity, plan the fix sequence, run the fix, verify the score moved, re-baseline if appropriate. Use when the user says "fix these findings", "act on the health report", "close out these vulnerabilities", or after dxkit-reports has surfaced something concrete.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# dxkit-action
|
|
7
|
+
|
|
8
|
+
This skill takes a dxkit report and drives the fix loop with the user. Reach for it after `dxkit-reports` has surfaced concrete findings.
|
|
9
|
+
|
|
10
|
+
## The action loop
|
|
11
|
+
|
|
12
|
+
```
|
|
13
|
+
[1] Read the report → understand what's flagged
|
|
14
|
+
[2] Prioritize → severity + reachability + cost
|
|
15
|
+
[3] Plan → ordered list of edits
|
|
16
|
+
[4] Execute → fix one finding at a time
|
|
17
|
+
[5] Verify → re-run the analyzer, confirm score moved
|
|
18
|
+
[6] Decide on baseline → commit fix or accept-as-baseline
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Don't skip [5]. Re-running the analyzer is the only way to confirm the fix landed correctly.
|
|
22
|
+
|
|
23
|
+
## Priority order
|
|
24
|
+
|
|
25
|
+
Walk findings in this order (highest to lowest):
|
|
26
|
+
|
|
27
|
+
1. **CRITICAL** secrets (leaked credentials) — these are public-internet-facing. Stop everything and rotate.
|
|
28
|
+
2. **CRITICAL / HIGH** SAST findings in primary-architecture paths (controllers/handlers/services for backend; components/pages for frontend).
|
|
29
|
+
3. **CRITICAL / HIGH** dep-vulns with known exploits + a patched version available.
|
|
30
|
+
4. **HIGH** test-gap findings on primary-architecture files.
|
|
31
|
+
5. **MEDIUM** SAST / dep-vuln.
|
|
32
|
+
6. **LOW** anything (often defer to backlog).
|
|
33
|
+
|
|
34
|
+
Skip items where reachability is "no" (graphify can't find a call path) UNLESS the finding is a secret leak (those don't depend on reachability).
|
|
35
|
+
|
|
36
|
+
## Common fix recipes
|
|
37
|
+
|
|
38
|
+
### Secret in code
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
# 1. Rotate the credential immediately (in the issuing provider's UI)
|
|
42
|
+
# 2. Remove the secret from the file
|
|
43
|
+
# 3. If the secret was committed: `git filter-repo` or BFG to scrub history
|
|
44
|
+
# 4. Re-scan to confirm gitleaks no longer reports it
|
|
45
|
+
npx vyuh-dxkit vulnerabilities --json | jq '.summary.findings'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Don't try to redact the secret in place — the git history still has it. Rotation is the only true fix.
|
|
49
|
+
|
|
50
|
+
### SAST finding (semgrep)
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# 1. Read the finding's rule + line range from the report
|
|
54
|
+
# 2. Open the file, understand why semgrep flagged it
|
|
55
|
+
# 3. Either FIX (preferred) or SUPPRESS (carefully)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Suppression is `// nosemgrep: <rule-id>` on the offending line. Use sparingly — every suppression is a future maintenance burden. Better: fix the underlying issue.
|
|
59
|
+
|
|
60
|
+
### Dependency vulnerability
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# Find the patched version (osv-scanner / npm-audit / etc. report it)
|
|
64
|
+
npm install <pkg>@<patched-version>
|
|
65
|
+
# Re-run the scan
|
|
66
|
+
npx vyuh-dxkit vulnerabilities
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
For peer-dep conflicts: `npm install <pkg>@<patched-version> --legacy-peer-deps` (matches the post-create.sh fallback chain).
|
|
70
|
+
|
|
71
|
+
For Python: `pip install --upgrade <pkg>=<patched>` then re-pip-freeze. For Go: `go get <pkg>@<patched>` then `go mod tidy`. For Ruby: edit Gemfile, `bundle update <pkg>`. For Rust: `cargo update -p <pkg> --precise <patched>`.
|
|
72
|
+
|
|
73
|
+
### Test gap
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# 1. Read the source file the test-gap analyzer flagged
|
|
77
|
+
# 2. Write a test that exercises the file's primary contract
|
|
78
|
+
# 3. Run the test runner to confirm it passes
|
|
79
|
+
npm test # or pytest, go test, cargo test, etc.
|
|
80
|
+
# 4. Re-run test-gaps to confirm the file dropped off the list
|
|
81
|
+
npx vyuh-dxkit test-gaps
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Don't write tests that just import the module — write tests that exercise behavior. Useless tests inflate the count but don't move the dimension.
|
|
85
|
+
|
|
86
|
+
### Slop / code-pattern finding
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Read the slop check report at .dxkit/reports/
|
|
90
|
+
# Most slop hits are in committed AI-generated prose: README sections,
|
|
91
|
+
# CHANGELOG entries, doc comments. Rewrite by hand to remove the patterns.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
If the finding is a false positive, add `// slop-ok: <reason>` on the offending line (or `# slop-ok` for non-JS).
|
|
95
|
+
|
|
96
|
+
## Verification — never skip
|
|
97
|
+
|
|
98
|
+
After each fix:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Re-run the SPECIFIC analyzer that flagged the finding
|
|
102
|
+
npx vyuh-dxkit vulnerabilities # or quality / test-gaps / health
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
The fix is verified when:
|
|
106
|
+
- The specific finding fingerprint disappears from the report.
|
|
107
|
+
- The dimension score moves in the right direction.
|
|
108
|
+
- (Optional) The dashboard's diff view confirms the count dropped.
|
|
109
|
+
|
|
110
|
+
If the finding's still there: the fix didn't work, try again.
|
|
111
|
+
|
|
112
|
+
## Baseline decisions
|
|
113
|
+
|
|
114
|
+
Once a finding is fixed AND verified gone, the workflow depends on what changed:
|
|
115
|
+
|
|
116
|
+
| Scenario | Action |
|
|
117
|
+
|---|---|
|
|
118
|
+
| Fix landed via a code change | Commit the code. Baseline is unchanged. Future scans confirm the fix held. |
|
|
119
|
+
| Fix landed via a config change (e.g., new entry in `.dxkit-ignore`) | Re-baseline: `npx vyuh-dxkit baseline create --force`. Commit both `.dxkit-ignore` and the new baseline. |
|
|
120
|
+
| Finding accepted as known + not blocking | Re-baseline with explicit reason in the commit message. Future scans treat it as pre-existing, not net-new. |
|
|
121
|
+
| Finding is genuinely a false positive | First try suppression on the offending line. If you can't suppress, re-baseline. |
|
|
122
|
+
|
|
123
|
+
**Never** re-baseline a finding silently — the commit message should explain why the regression is accepted. Future maintainers reading `git log .dxkit/baselines/` should see the rationale.
|
|
124
|
+
|
|
125
|
+
## Workflow guardrail
|
|
126
|
+
|
|
127
|
+
After fixing N findings, run the guardrail check before pushing:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
npx vyuh-dxkit guardrail check
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Exit 0 = your fixes didn't introduce any net-new regressions (you only removed/fixed things). Exit 1 = something new appeared; address that before pushing.
|
|
134
|
+
|
|
135
|
+
## When fixes get expensive
|
|
136
|
+
|
|
137
|
+
Sometimes the right call is: don't fix, accept as baseline.
|
|
138
|
+
|
|
139
|
+
Examples:
|
|
140
|
+
- Legacy code on a deprecation path (sunset > fix)
|
|
141
|
+
- A SAST finding in vendored code you don't maintain
|
|
142
|
+
- A test gap on a one-off script that doesn't merit tests
|
|
143
|
+
|
|
144
|
+
In those cases: accept-as-baseline with a commit message explaining the call. dxkit's baseline IS designed to support this — the brownfield contract is "today's mess is acknowledged; tomorrow's must be a real improvement." Use it.
|
|
145
|
+
|
|
146
|
+
## Hand-offs
|
|
147
|
+
|
|
148
|
+
- For ignore-file edits as part of a fix → `dxkit-config` skill
|
|
149
|
+
- For hook-related issues during a fix push → `dxkit-hooks` skill
|
|
150
|
+
- For re-running reports between fixes → `dxkit-reports` skill
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: dxkit-config
|
|
3
|
+
description: Edit dxkit configuration — add/remove paths in .dxkit-ignore, tune .npx vyuh-dxkit.json, adjust .dxkit/policy.json guardrail severity. Use when the user wants to exclude a directory from scanning, change scoring thresholds, or modify what blocks a PR.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# dxkit-config
|
|
7
|
+
|
|
8
|
+
This skill modifies the three configuration files dxkit reads. Reach for it when the user asks to "ignore this vendored directory," "stop flagging X," "make the guardrail stricter/laxer," or "what controls Y."
|
|
9
|
+
|
|
10
|
+
## The three config files
|
|
11
|
+
|
|
12
|
+
| File | Purpose | When to edit |
|
|
13
|
+
|---|---|---|
|
|
14
|
+
| `.dxkit-ignore` | Extra paths dxkit's analyzers should skip (gitignore-style format) | Vendored code, generated code, test fixtures, large data files |
|
|
15
|
+
| `.npx vyuh-dxkit.json` | Manifest of detected stack + custom settings (regenerated by `init` / `update`) | Rare — usually let `dxkit update` regenerate. Override version pins or framework detection here. |
|
|
16
|
+
| `.dxkit/policy.json` | Severity policy for guardrail check | Customize what blocks a PR (e.g., demote `medium` to warning) |
|
|
17
|
+
|
|
18
|
+
## Adding a path to `.dxkit-ignore`
|
|
19
|
+
|
|
20
|
+
Format mirrors `.gitignore`: directory/, file-glob, multi-segment paths.
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Append a vendored directory
|
|
24
|
+
echo 'vendor/' >> .dxkit-ignore
|
|
25
|
+
|
|
26
|
+
# Append a generated-code dir
|
|
27
|
+
echo 'src/generated/' >> .dxkit-ignore
|
|
28
|
+
|
|
29
|
+
# Append a glob (auto-generated TypeScript types)
|
|
30
|
+
echo '*.generated.ts' >> .dxkit-ignore
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or use Edit to add multiple entries cleanly. The file accepts comments (`#`).
|
|
34
|
+
|
|
35
|
+
After editing, the **next** `baseline create` picks up the change. Existing baselines stay valid (the file's content hash is recorded in the baseline envelope, so a mismatch surfaces as a "baseline regenerated against newer .dxkit-ignore" note rather than an error).
|
|
36
|
+
|
|
37
|
+
### Common exclusions
|
|
38
|
+
|
|
39
|
+
```gitignore
|
|
40
|
+
# Vendored third-party code committed to git
|
|
41
|
+
vendor/
|
|
42
|
+
third_party/
|
|
43
|
+
|
|
44
|
+
# Generated code
|
|
45
|
+
generated/
|
|
46
|
+
*.generated.ts
|
|
47
|
+
*.designer.cs
|
|
48
|
+
*.pb.go
|
|
49
|
+
src/proto-types/
|
|
50
|
+
|
|
51
|
+
# Legacy code you don't want to track findings against
|
|
52
|
+
legacy/
|
|
53
|
+
deprecated/
|
|
54
|
+
|
|
55
|
+
# Test fixtures that inflate metrics
|
|
56
|
+
fixtures/large/
|
|
57
|
+
test/fixtures/
|
|
58
|
+
|
|
59
|
+
# Build artifacts (most are gitignored already, but defensive)
|
|
60
|
+
dist/
|
|
61
|
+
build/
|
|
62
|
+
target/
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Tuning `.npx vyuh-dxkit.json`
|
|
66
|
+
|
|
67
|
+
This file is mostly auto-generated. Common manual edits:
|
|
68
|
+
|
|
69
|
+
```json
|
|
70
|
+
{
|
|
71
|
+
"framework": "express", // Override if auto-detection picked wrong
|
|
72
|
+
"languages": {
|
|
73
|
+
"typescript": true,
|
|
74
|
+
"python": false
|
|
75
|
+
},
|
|
76
|
+
"testRunner": {
|
|
77
|
+
"framework": "vitest", // Override auto-detected test runner
|
|
78
|
+
"command": "npm test"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
When you edit this file, run `npx vyuh-dxkit update` to propagate changes through the rest of the scaffold (per-language rules, devcontainer features, etc.). Use `--force` only if you've also edited evolving files — otherwise `update` preserves customer changes.
|
|
84
|
+
|
|
85
|
+
## Customizing `.dxkit/policy.json`
|
|
86
|
+
|
|
87
|
+
The policy file controls what severity counts as "blocking" for the guardrail. Default:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"code": { "block": ["critical", "high"], "warn": ["medium"] },
|
|
92
|
+
"dependency": { "block": ["critical", "high"], "warn": ["medium"] },
|
|
93
|
+
"secret": { "block": ["critical", "high", "medium", "low"] },
|
|
94
|
+
"test-gap": { "block": ["critical"], "warn": ["high"] },
|
|
95
|
+
"duplicate": { "warn": ["all"] }
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Each finding-kind has `block` (exit 1) and `warn` (log only) lists. Adjust to your team's tolerance:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
// Stricter — block medium SAST findings too
|
|
103
|
+
{ "code": { "block": ["critical", "high", "medium"] } }
|
|
104
|
+
|
|
105
|
+
// Laxer — make secret medium/low non-blocking (don't recommend)
|
|
106
|
+
{ "secret": { "block": ["critical", "high"] } }
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Run `npx vyuh-dxkit guardrail check --policy=.dxkit/policy.json` to test the new policy. If no `policy.json` exists, dxkit uses the built-in defaults.
|
|
110
|
+
|
|
111
|
+
## Workflow
|
|
112
|
+
|
|
113
|
+
When the user asks for a config change:
|
|
114
|
+
|
|
115
|
+
1. Identify which file owns the concern (path exclusion → `.dxkit-ignore`; severity routing → `.dxkit/policy.json`; detection override → `.npx vyuh-dxkit.json`).
|
|
116
|
+
2. Open the file, propose the edit, confirm.
|
|
117
|
+
3. After writing, run `npx vyuh-dxkit baseline create --force` if exclusions changed (so the baseline doesn't carry stale findings from the now-excluded paths).
|
|
118
|
+
4. Commit both: the config file + the regenerated baseline.
|
|
119
|
+
|
|
120
|
+
## What NOT to do
|
|
121
|
+
|
|
122
|
+
- Don't edit `.dxkit/cache/` or `.dxkit/reports/` — they're regenerated on every run (gitignored).
|
|
123
|
+
- Don't manually mutate `.dxkit/baselines/main.json` — use `baseline create --force` to regenerate.
|
|
124
|
+
- Don't add `.dxkit/` to `.dxkit-ignore` — dxkit itself doesn't scan its own outputs.
|