@vyuhlabs/dxkit 2.23.0 → 2.24.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.
- package/CHANGELOG.md +34 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +67 -0
- package/dist/cli.js.map +1 -1
- package/dist/generator.d.ts.map +1 -1
- package/dist/generator.js +5 -0
- package/dist/generator.js.map +1 -1
- package/dist/issue-cli.d.ts +2 -1
- package/dist/issue-cli.d.ts.map +1 -1
- package/dist/issue-cli.js +4 -0
- package/dist/issue-cli.js.map +1 -1
- package/dist/loop/scaffold.d.ts +4 -0
- package/dist/loop/scaffold.d.ts.map +1 -1
- package/dist/loop/scaffold.js +7 -7
- package/dist/loop/scaffold.js.map +1 -1
- package/dist/ship-installers.d.ts +20 -0
- package/dist/ship-installers.d.ts.map +1 -1
- package/dist/ship-installers.js +17 -16
- package/dist/ship-installers.js.map +1 -1
- package/dist/uninstall/index.d.ts +47 -0
- package/dist/uninstall/index.d.ts.map +1 -0
- package/dist/uninstall/index.js +418 -0
- package/dist/uninstall/index.js.map +1 -0
- package/dist/uninstall/reversals.d.ts +70 -0
- package/dist/uninstall/reversals.d.ts.map +1 -0
- package/dist/uninstall/reversals.js +202 -0
- package/dist/uninstall/reversals.js.map +1 -0
- package/package.json +1 -1
- package/templates/.claude/skills/dxkit-uninstall/SKILL.md +55 -0
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The uninstall engine — plan (pure, read-only) then execute. Its one job is to
|
|
4
|
+
* restore the repo's PRE-DXKIT state: remove every file dxkit created, and
|
|
5
|
+
* surgically reverse every additive merge dxkit made into a pre-existing user
|
|
6
|
+
* file, without touching a byte the user owns.
|
|
7
|
+
*
|
|
8
|
+
* `planUninstall` reads the manifest (`.vyuh-dxkit.json`) + the install flags and
|
|
9
|
+
* builds an ordered action list, marking any dxkit-created file the user has
|
|
10
|
+
* since edited as `skip-modified` (surfaced, never clobbered). `executeUninstall`
|
|
11
|
+
* applies a plan. The CLI wraps them with dry-run-by-default + confirmation.
|
|
12
|
+
*/
|
|
13
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
16
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
17
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
18
|
+
}
|
|
19
|
+
Object.defineProperty(o, k2, desc);
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
25
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
26
|
+
}) : function(o, v) {
|
|
27
|
+
o["default"] = v;
|
|
28
|
+
});
|
|
29
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
30
|
+
var ownKeys = function(o) {
|
|
31
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
32
|
+
var ar = [];
|
|
33
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
34
|
+
return ar;
|
|
35
|
+
};
|
|
36
|
+
return ownKeys(o);
|
|
37
|
+
};
|
|
38
|
+
return function (mod) {
|
|
39
|
+
if (mod && mod.__esModule) return mod;
|
|
40
|
+
var result = {};
|
|
41
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
42
|
+
__setModuleDefault(result, mod);
|
|
43
|
+
return result;
|
|
44
|
+
};
|
|
45
|
+
})();
|
|
46
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
47
|
+
exports.planUninstall = planUninstall;
|
|
48
|
+
exports.executeUninstall = executeUninstall;
|
|
49
|
+
const fs = __importStar(require("fs"));
|
|
50
|
+
const path = __importStar(require("path"));
|
|
51
|
+
const child_process_1 = require("child_process");
|
|
52
|
+
const files_1 = require("../files");
|
|
53
|
+
const update_1 = require("../update");
|
|
54
|
+
const file_1 = require("../allowlist/file");
|
|
55
|
+
const reversals_1 = require("./reversals");
|
|
56
|
+
/** Files dxkit MERGES into (reverted, not deleted) — never delete-file these. */
|
|
57
|
+
const MERGE_TARGETS = new Set(['.gitignore', 'CLAUDE.md', '.claude/settings.json', 'package.json']);
|
|
58
|
+
/** Curated, intentionally git-tracked `.dxkit/` paths kept under --keep-baselines. */
|
|
59
|
+
const CURATED_DXKIT = ['baselines', file_1.ALLOWLIST_FILENAME, file_1.ALLOWLIST_REASONS_FILENAME, 'external'];
|
|
60
|
+
function readManifest(cwd) {
|
|
61
|
+
try {
|
|
62
|
+
return JSON.parse(fs.readFileSync(path.join(cwd, '.vyuh-dxkit.json'), 'utf-8'));
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function exists(cwd, rel) {
|
|
69
|
+
return fs.existsSync(path.join(cwd, rel));
|
|
70
|
+
}
|
|
71
|
+
/** Ship-installer artifacts keyed by install flag (not in manifest.files — the
|
|
72
|
+
* generator's `track()` covers only its own templates). */
|
|
73
|
+
function gatedArtifacts(flags) {
|
|
74
|
+
const out = [];
|
|
75
|
+
if (flags.withHooks)
|
|
76
|
+
out.push('.githooks/pre-push');
|
|
77
|
+
if (flags.withPrecommit)
|
|
78
|
+
out.push('.githooks/pre-commit');
|
|
79
|
+
if (flags.withCiGuardrails)
|
|
80
|
+
out.push('.github/workflows/dxkit-guardrails.yml');
|
|
81
|
+
if (flags.withBaselineRefresh)
|
|
82
|
+
out.push('.github/workflows/dxkit-baseline-refresh.yml');
|
|
83
|
+
if (flags.withPrReview)
|
|
84
|
+
out.push('.github/workflows/pr-review.yml');
|
|
85
|
+
// deep-sast refresh is opt-in and not tracked in installFlags — detect by file.
|
|
86
|
+
out.push('.github/workflows/dxkit-deep-sast-refresh.yml');
|
|
87
|
+
if (flags.withDevcontainer) {
|
|
88
|
+
out.push('.devcontainer/devcontainer.json', '.devcontainer/post-create.sh', '.devcontainer/install-agent-clis.sh');
|
|
89
|
+
}
|
|
90
|
+
out.push('.dxkit-ignore');
|
|
91
|
+
return out;
|
|
92
|
+
}
|
|
93
|
+
/** Build the ordered uninstall plan without touching the filesystem. */
|
|
94
|
+
function planUninstall(cwd, opts = {}) {
|
|
95
|
+
const manifest = readManifest(cwd);
|
|
96
|
+
const flags = manifest?.installFlags ?? (0, update_1.detectInstallFlags)(cwd);
|
|
97
|
+
const actions = [];
|
|
98
|
+
const warnings = [];
|
|
99
|
+
const del = (rel, detail, evolving = true, storedHash = null) => {
|
|
100
|
+
if (!exists(cwd, rel)) {
|
|
101
|
+
actions.push({ kind: 'delete-file', target: rel, detail, status: 'absent' });
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
// Hash-guard non-evolving dxkit files: a mismatch means the user edited a
|
|
105
|
+
// dxkit-created file. Removing it still restores pre-dxkit state, but we
|
|
106
|
+
// surface it and skip unless --force.
|
|
107
|
+
if (!evolving && storedHash) {
|
|
108
|
+
let current = '';
|
|
109
|
+
try {
|
|
110
|
+
current = (0, files_1.sha256)(fs.readFileSync(path.join(cwd, rel), 'utf-8'));
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
/* unreadable → treat as present */
|
|
114
|
+
}
|
|
115
|
+
if (current && current !== storedHash && !opts.force) {
|
|
116
|
+
warnings.push(`${rel} was edited after dxkit created it — skipped (use --force to remove)`);
|
|
117
|
+
actions.push({ kind: 'delete-file', target: rel, detail, status: 'skip-modified' });
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
actions.push({ kind: 'delete-file', target: rel, detail, status: 'pending' });
|
|
122
|
+
};
|
|
123
|
+
// 1. Additive-merge reversals (surgical — preserve user content). No-op when
|
|
124
|
+
// the marker is absent, so always safe to attempt.
|
|
125
|
+
if (exists(cwd, '.gitignore') && (0, reversals_1.stripAllGitignoreBlocks)(read(cwd, '.gitignore')).changed) {
|
|
126
|
+
actions.push({
|
|
127
|
+
kind: 'revert-gitignore',
|
|
128
|
+
target: '.gitignore',
|
|
129
|
+
detail: 'strip dxkit runtime-output entries',
|
|
130
|
+
status: 'pending',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
if (exists(cwd, 'CLAUDE.md')) {
|
|
134
|
+
const claudeEntry = manifest?.files['CLAUDE.md'];
|
|
135
|
+
const current = read(cwd, 'CLAUDE.md');
|
|
136
|
+
const stripped = (0, reversals_1.stripClaudeLoopBlock)(current);
|
|
137
|
+
if (claudeEntry && claudeEntry.hash && (0, files_1.sha256)(stripped.content) === claudeEntry.hash) {
|
|
138
|
+
// dxkit created the whole file, and stripping dxkit's own loop block leaves
|
|
139
|
+
// exactly the recorded dxkit shim (no user edits) → remove the whole file
|
|
140
|
+
// (pre-dxkit state had no CLAUDE.md).
|
|
141
|
+
actions.push({
|
|
142
|
+
kind: 'delete-file',
|
|
143
|
+
target: 'CLAUDE.md',
|
|
144
|
+
detail: 'dxkit-created Claude config',
|
|
145
|
+
status: 'pending',
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
else if (claudeEntry && stripped.changed) {
|
|
149
|
+
// dxkit created it but the user has since edited the shim → keep their
|
|
150
|
+
// version, remove only dxkit's loop block; surface that we kept the file.
|
|
151
|
+
actions.push({
|
|
152
|
+
kind: 'revert-claude',
|
|
153
|
+
target: 'CLAUDE.md',
|
|
154
|
+
detail: 'strip the dxkit loop block (keeping your edits)',
|
|
155
|
+
status: 'pending',
|
|
156
|
+
});
|
|
157
|
+
warnings.push('CLAUDE.md was created by dxkit but you edited it — kept your version, removed only the loop block');
|
|
158
|
+
}
|
|
159
|
+
else if (!claudeEntry && stripped.changed) {
|
|
160
|
+
// The user's own pre-existing CLAUDE.md that dxkit only appended to.
|
|
161
|
+
actions.push({
|
|
162
|
+
kind: 'revert-claude',
|
|
163
|
+
target: 'CLAUDE.md',
|
|
164
|
+
detail: 'strip the dxkit loop block',
|
|
165
|
+
status: 'pending',
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
if (exists(cwd, '.claude/settings.json')) {
|
|
170
|
+
const parsed = tryJson(read(cwd, '.claude/settings.json'));
|
|
171
|
+
const dxkitCreated = !!manifest?.files['.claude/settings.json'];
|
|
172
|
+
if (parsed && (0, reversals_1.stripSettingsDxkit)(parsed, { dxkitCreated }).changed) {
|
|
173
|
+
actions.push({
|
|
174
|
+
kind: 'revert-settings',
|
|
175
|
+
target: '.claude/settings.json',
|
|
176
|
+
detail: 'remove dxkit hooks (context-hook / stop-gate)',
|
|
177
|
+
status: 'pending',
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
if (opts.removeDevDependency && exists(cwd, 'package.json')) {
|
|
182
|
+
const parsed = tryJson(read(cwd, 'package.json'));
|
|
183
|
+
if (parsed && (0, reversals_1.stripPackageJsonDxkit)(parsed).changed) {
|
|
184
|
+
actions.push({
|
|
185
|
+
kind: 'revert-package',
|
|
186
|
+
target: 'package.json',
|
|
187
|
+
detail: 'remove @vyuhlabs/dxkit devDependency + postinstall',
|
|
188
|
+
status: 'pending',
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// 2. Delete generator-created files from the manifest (except merge targets).
|
|
193
|
+
for (const [rel, entry] of Object.entries(manifest?.files ?? {})) {
|
|
194
|
+
if (MERGE_TARGETS.has(rel))
|
|
195
|
+
continue;
|
|
196
|
+
del(rel, 'dxkit-created file', entry.evolving, entry.hash);
|
|
197
|
+
}
|
|
198
|
+
// 3. Delete gated ship-installer artifacts by flag / presence.
|
|
199
|
+
for (const rel of gatedArtifacts(flags)) {
|
|
200
|
+
if (exists(cwd, rel))
|
|
201
|
+
del(rel, 'dxkit-installed artifact');
|
|
202
|
+
}
|
|
203
|
+
// 4. Runtime trees.
|
|
204
|
+
if (exists(cwd, '.dxkit')) {
|
|
205
|
+
if (opts.keepBaselines) {
|
|
206
|
+
// Delete each top-level .dxkit entry except the curated ones.
|
|
207
|
+
for (const name of safeReaddir(path.join(cwd, '.dxkit'))) {
|
|
208
|
+
if (CURATED_DXKIT.includes(name))
|
|
209
|
+
continue;
|
|
210
|
+
const rel = `.dxkit/${name}`;
|
|
211
|
+
actions.push({
|
|
212
|
+
kind: statIsDir(cwd, rel) ? 'delete-dir' : 'delete-file',
|
|
213
|
+
target: rel,
|
|
214
|
+
detail: 'dxkit runtime output',
|
|
215
|
+
status: 'pending',
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
actions.push({
|
|
221
|
+
kind: 'delete-dir',
|
|
222
|
+
target: '.dxkit',
|
|
223
|
+
detail: 'all dxkit state (baselines, reports, loop, policy)',
|
|
224
|
+
status: 'pending',
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if (exists(cwd, 'graphify-out')) {
|
|
229
|
+
actions.push({
|
|
230
|
+
kind: 'delete-dir',
|
|
231
|
+
target: 'graphify-out',
|
|
232
|
+
detail: 'graph analyzer output',
|
|
233
|
+
status: 'pending',
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
// 5. Unset the git hooksPath if dxkit pointed it at .githooks.
|
|
237
|
+
if (flags.withHooks && gitHooksPath(cwd) === '.githooks') {
|
|
238
|
+
actions.push({
|
|
239
|
+
kind: 'git-config-unset',
|
|
240
|
+
target: 'core.hooksPath',
|
|
241
|
+
detail: 'unset core.hooksPath (was .githooks)',
|
|
242
|
+
status: 'pending',
|
|
243
|
+
});
|
|
244
|
+
}
|
|
245
|
+
// 6. The manifest itself — always last, and only when nothing was skipped.
|
|
246
|
+
// If we skipped a user-edited dxkit file, keep the manifest so a later
|
|
247
|
+
// `uninstall --force` can still find and remove it.
|
|
248
|
+
if (exists(cwd, '.vyuh-dxkit.json')) {
|
|
249
|
+
const hasSkips = actions.some((a) => a.status === 'skip-modified');
|
|
250
|
+
actions.push({
|
|
251
|
+
kind: 'delete-file',
|
|
252
|
+
target: '.vyuh-dxkit.json',
|
|
253
|
+
detail: hasSkips
|
|
254
|
+
? 'the dxkit install manifest (kept — edited files were skipped)'
|
|
255
|
+
: 'the dxkit install manifest',
|
|
256
|
+
status: hasSkips ? 'skip-modified' : 'pending',
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
const empty = actions.every((a) => a.status === 'absent');
|
|
260
|
+
return { actions, warnings, flags, empty };
|
|
261
|
+
}
|
|
262
|
+
/** Apply a plan. Only `pending` actions run; `absent`/`skip-modified` are recorded. */
|
|
263
|
+
function executeUninstall(cwd, plan, opts = {}) {
|
|
264
|
+
const removed = [];
|
|
265
|
+
const reverted = [];
|
|
266
|
+
const skipped = [];
|
|
267
|
+
for (const a of plan.actions) {
|
|
268
|
+
if (a.status !== 'pending') {
|
|
269
|
+
if (a.status === 'skip-modified')
|
|
270
|
+
skipped.push(a.target);
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
273
|
+
const abs = path.join(cwd, a.target);
|
|
274
|
+
switch (a.kind) {
|
|
275
|
+
case 'delete-file':
|
|
276
|
+
rm(abs);
|
|
277
|
+
pruneEmptyParents(cwd, abs);
|
|
278
|
+
removed.push(a.target);
|
|
279
|
+
break;
|
|
280
|
+
case 'delete-dir':
|
|
281
|
+
fs.rmSync(abs, { recursive: true, force: true });
|
|
282
|
+
pruneEmptyParents(cwd, abs);
|
|
283
|
+
removed.push(a.target);
|
|
284
|
+
break;
|
|
285
|
+
case 'revert-gitignore': {
|
|
286
|
+
const out = (0, reversals_1.stripAllGitignoreBlocks)(read(cwd, '.gitignore')).content;
|
|
287
|
+
if (out === '')
|
|
288
|
+
rm(abs);
|
|
289
|
+
else
|
|
290
|
+
fs.writeFileSync(abs, out, 'utf-8');
|
|
291
|
+
reverted.push(a.target);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case 'revert-claude': {
|
|
295
|
+
const out = (0, reversals_1.stripClaudeLoopBlock)(read(cwd, 'CLAUDE.md')).content;
|
|
296
|
+
if (out === '')
|
|
297
|
+
rm(abs);
|
|
298
|
+
else
|
|
299
|
+
fs.writeFileSync(abs, out, 'utf-8');
|
|
300
|
+
reverted.push(a.target);
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
case 'revert-settings': {
|
|
304
|
+
const original = read(cwd, '.claude/settings.json');
|
|
305
|
+
const parsed = tryJson(original);
|
|
306
|
+
const manifest = readManifest(cwd);
|
|
307
|
+
const dxkitCreated = !!manifest?.files['.claude/settings.json'];
|
|
308
|
+
const { result, isDxkitOnly } = (0, reversals_1.stripSettingsDxkit)(parsed, { dxkitCreated });
|
|
309
|
+
if (isDxkitOnly) {
|
|
310
|
+
rm(abs);
|
|
311
|
+
pruneEmptyParents(cwd, abs);
|
|
312
|
+
}
|
|
313
|
+
else {
|
|
314
|
+
fs.writeFileSync(abs, serializePreserving(original, result), 'utf-8');
|
|
315
|
+
}
|
|
316
|
+
reverted.push(a.target);
|
|
317
|
+
break;
|
|
318
|
+
}
|
|
319
|
+
case 'revert-package': {
|
|
320
|
+
const original = read(cwd, 'package.json');
|
|
321
|
+
const { result } = (0, reversals_1.stripPackageJsonDxkit)(tryJson(original));
|
|
322
|
+
// Preserve the file's original indent + trailing-newline style so the
|
|
323
|
+
// reverted file is byte-identical to its pre-dxkit content (git-clean).
|
|
324
|
+
fs.writeFileSync(abs, serializePreserving(original, result), 'utf-8');
|
|
325
|
+
reverted.push(a.target);
|
|
326
|
+
break;
|
|
327
|
+
}
|
|
328
|
+
case 'git-config-unset':
|
|
329
|
+
try {
|
|
330
|
+
(0, child_process_1.execFileSync)('git', ['config', '--unset', 'core.hooksPath'], { cwd, stdio: 'ignore' });
|
|
331
|
+
}
|
|
332
|
+
catch {
|
|
333
|
+
/* best-effort */
|
|
334
|
+
}
|
|
335
|
+
reverted.push(a.target);
|
|
336
|
+
break;
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
void opts;
|
|
340
|
+
return { removed, reverted, skipped };
|
|
341
|
+
}
|
|
342
|
+
// ─── small fs helpers ───────────────────────────────────────────────────────
|
|
343
|
+
function read(cwd, rel) {
|
|
344
|
+
return fs.readFileSync(path.join(cwd, rel), 'utf-8');
|
|
345
|
+
}
|
|
346
|
+
/** Re-serialize `obj` matching `original`'s indentation and trailing-newline
|
|
347
|
+
* style, so a surgical JSON revert leaves the file byte-identical to how the
|
|
348
|
+
* user's editor/tooling would have written it (no spurious git diff). */
|
|
349
|
+
function serializePreserving(original, obj) {
|
|
350
|
+
const m = original.match(/\n([ \t]+)"/);
|
|
351
|
+
const indent = m ? (m[1][0] === '\t' ? '\t' : m[1].length) : 2;
|
|
352
|
+
const json = JSON.stringify(obj, null, indent);
|
|
353
|
+
return original.endsWith('\n') ? json + '\n' : json;
|
|
354
|
+
}
|
|
355
|
+
function tryJson(s) {
|
|
356
|
+
try {
|
|
357
|
+
const v = JSON.parse(s);
|
|
358
|
+
return v && typeof v === 'object' ? v : null;
|
|
359
|
+
}
|
|
360
|
+
catch {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
function rm(abs) {
|
|
365
|
+
try {
|
|
366
|
+
fs.rmSync(abs, { force: true });
|
|
367
|
+
}
|
|
368
|
+
catch {
|
|
369
|
+
/* ignore */
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
function statIsDir(cwd, rel) {
|
|
373
|
+
try {
|
|
374
|
+
return fs.statSync(path.join(cwd, rel)).isDirectory();
|
|
375
|
+
}
|
|
376
|
+
catch {
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
function safeReaddir(abs) {
|
|
381
|
+
try {
|
|
382
|
+
return fs.readdirSync(abs);
|
|
383
|
+
}
|
|
384
|
+
catch {
|
|
385
|
+
return [];
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
function gitHooksPath(cwd) {
|
|
389
|
+
try {
|
|
390
|
+
return ((0, child_process_1.execFileSync)('git', ['config', '--get', 'core.hooksPath'], {
|
|
391
|
+
cwd,
|
|
392
|
+
encoding: 'utf-8',
|
|
393
|
+
stdio: ['ignore', 'pipe', 'ignore'],
|
|
394
|
+
}).trim() || null);
|
|
395
|
+
}
|
|
396
|
+
catch {
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
}
|
|
400
|
+
/** After removing a file/dir, delete any now-empty ancestor directories up to
|
|
401
|
+
* (but not including) cwd — cleans up dxkit-only dir trees (.claude/skills, …)
|
|
402
|
+
* while leaving any dir that still holds user content. */
|
|
403
|
+
function pruneEmptyParents(cwd, abs) {
|
|
404
|
+
let dir = path.dirname(abs);
|
|
405
|
+
const root = path.resolve(cwd);
|
|
406
|
+
while (path.resolve(dir) !== root && path.resolve(dir).startsWith(root)) {
|
|
407
|
+
try {
|
|
408
|
+
if (fs.readdirSync(dir).length > 0)
|
|
409
|
+
break;
|
|
410
|
+
fs.rmdirSync(dir);
|
|
411
|
+
}
|
|
412
|
+
catch {
|
|
413
|
+
break;
|
|
414
|
+
}
|
|
415
|
+
dir = path.dirname(dir);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/uninstall/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FH,sCA0KC;AASD,4CA4EC;AA5VD,uCAAyB;AACzB,2CAA6B;AAC7B,iDAA6C;AAE7C,oCAAkC;AAClC,sCAAkE;AAClE,4CAAmF;AAEnF,2CAKqB;AAuCrB,iFAAiF;AACjF,MAAM,a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AC;gBAAE,MAAM;YAC1C,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;QACpB,CAAC;QAAC,MAAM,CAAC;YACP,MAAM;QACR,CAAC;QACD,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure reversals for dxkit's additive merges — the inverse of each installer's
|
|
3
|
+
* merge into a PRE-EXISTING user file. Each takes the current file content and
|
|
4
|
+
* returns the content with ONLY dxkit's additions removed, preserving the
|
|
5
|
+
* user's own lines/keys byte-for-byte. These are the load-bearing functions for
|
|
6
|
+
* the uninstall feature's primary guarantee: restore the pre-dxkit state.
|
|
7
|
+
*
|
|
8
|
+
* The markers are imported from the installer modules (not re-declared), so a
|
|
9
|
+
* marker change breaks install and uninstall together (recipe symmetry).
|
|
10
|
+
*/
|
|
11
|
+
/** Result of a reversal: the new content and whether anything was removed.
|
|
12
|
+
* `content: null` means "the file is now empty of everything but dxkit's own
|
|
13
|
+
* content — the caller may delete it" (used when dxkit created the file). */
|
|
14
|
+
export interface ReversalResult {
|
|
15
|
+
readonly changed: boolean;
|
|
16
|
+
readonly content: string;
|
|
17
|
+
}
|
|
18
|
+
/** Stealth-mode header (mirrors `STEALTH_HEADER` in cli.ts; kept as a literal
|
|
19
|
+
* here to avoid importing the CLI entry module). */
|
|
20
|
+
export declare const STEALTH_HEADER = "# dxkit (stealth mode \u2014 local only, not committed)";
|
|
21
|
+
/**
|
|
22
|
+
* Remove a dxkit block from `.gitignore`. The installer writes each block as
|
|
23
|
+
* `\n<HEADER>\n<entries…>\n` (a header line followed by its entries, up to the
|
|
24
|
+
* next blank line or EOF). We strip from the header line through the run of
|
|
25
|
+
* non-blank lines that follows it, leaving every other line — including the
|
|
26
|
+
* user's own entries — untouched.
|
|
27
|
+
*/
|
|
28
|
+
export declare function stripGitignoreBlock(content: string, header: string): ReversalResult;
|
|
29
|
+
/** Strip both the runtime-outputs block and the stealth block from `.gitignore`. */
|
|
30
|
+
export declare function stripAllGitignoreBlocks(content: string): ReversalResult;
|
|
31
|
+
/**
|
|
32
|
+
* Remove the dxkit loop block delimited by `<!-- dxkit:loop:start -->` …
|
|
33
|
+
* `<!-- dxkit:loop:end -->` from `CLAUDE.md`, including the sentinels and the
|
|
34
|
+
* surrounding blank lines the installer added. Everything else is preserved.
|
|
35
|
+
*/
|
|
36
|
+
export declare function stripClaudeLoopBlock(content: string): ReversalResult;
|
|
37
|
+
type JsonRecord = Record<string, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Remove dxkit's contributions from a parsed `settings.json`:
|
|
40
|
+
* - the Stop hook whose command invokes `hook stop-gate` (loop gate),
|
|
41
|
+
* - the PreToolUse hook whose command invokes `context-hook` (passive graph).
|
|
42
|
+
* Empty `hooks.Stop` / `hooks.PreToolUse` arrays and an empty `hooks` object are
|
|
43
|
+
* pruned. The user's other hooks, permissions, and keys are preserved.
|
|
44
|
+
*
|
|
45
|
+
* `dxkitCreated` (the file is in the manifest) additionally strips the
|
|
46
|
+
* dxkit-authored permission block and reports `content: '{}'`-equivalent
|
|
47
|
+
* emptiness via `isDxkitOnly` so the caller can delete the file outright.
|
|
48
|
+
*/
|
|
49
|
+
export declare function stripSettingsDxkit(parsed: JsonRecord, opts?: {
|
|
50
|
+
dxkitCreated: boolean;
|
|
51
|
+
}): {
|
|
52
|
+
changed: boolean;
|
|
53
|
+
result: JsonRecord;
|
|
54
|
+
isDxkitOnly: boolean;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Remove dxkit's contributions from a parsed `package.json`:
|
|
58
|
+
* - the `@vyuhlabs/dxkit` devDependency,
|
|
59
|
+
* - the `vyuh-dxkit hooks activate` postinstall (trimming a chained ` && …`
|
|
60
|
+
* suffix, or dropping the whole `postinstall` key when it was the sole cmd).
|
|
61
|
+
* Nothing else is touched. Returns which pieces were removed for reporting.
|
|
62
|
+
*/
|
|
63
|
+
export declare function stripPackageJsonDxkit(parsed: JsonRecord): {
|
|
64
|
+
changed: boolean;
|
|
65
|
+
result: JsonRecord;
|
|
66
|
+
removedDevDep: boolean;
|
|
67
|
+
removedPostinstall: boolean;
|
|
68
|
+
};
|
|
69
|
+
export {};
|
|
70
|
+
//# sourceMappingURL=reversals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reversals.d.ts","sourceRoot":"","sources":["../../src/uninstall/reversals.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAKH;;8EAE8E;AAC9E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAID;qDACqD;AACrD,eAAO,MAAM,cAAc,4DAAuD,CAAC;AAEnF;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAwBnF;AAED,oFAAoF;AACpF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAIvE;AAID;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CAUpE;AAID,KAAK,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,UAAU,EAClB,IAAI,GAAE;IAAE,YAAY,EAAE,OAAO,CAAA;CAA4B,GACxD;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,UAAU,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAmChE;AAsBD;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,GAAG;IACzD,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,UAAU,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,EAAE,OAAO,CAAC;CAC7B,CAqCA"}
|