@suwujs/codex-vault 0.3.0 → 0.3.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/bin/cli.js +15 -31
- package/package.json +1 -1
- package/plugin/VERSION +1 -1
package/bin/cli.js
CHANGED
|
@@ -166,22 +166,26 @@ function cmdUninstall() {
|
|
|
166
166
|
const cwd = process.cwd();
|
|
167
167
|
const versionFile = path.join(cwd, 'vault', '.codex-vault', 'version');
|
|
168
168
|
|
|
169
|
-
// 1. Check installation
|
|
170
|
-
|
|
169
|
+
// 1. Check installation (also check legacy .codex-mem path)
|
|
170
|
+
const legacyVersionFile = path.join(cwd, 'vault', '.codex-mem', 'version');
|
|
171
|
+
if (!fs.existsSync(versionFile) && !fs.existsSync(legacyVersionFile)) {
|
|
171
172
|
console.error('codex-vault is not installed in this directory.');
|
|
172
173
|
console.error('Nothing to uninstall.');
|
|
173
174
|
process.exit(1);
|
|
174
175
|
}
|
|
175
176
|
|
|
176
|
-
const
|
|
177
|
+
const activeVersionFile = fs.existsSync(versionFile) ? versionFile : legacyVersionFile;
|
|
178
|
+
const installedVersion = fs.readFileSync(activeVersionFile, 'utf8').trim();
|
|
177
179
|
console.log(`Uninstalling codex-vault v${installedVersion}...`);
|
|
178
180
|
console.log('NOTE: vault/ data (brain/, work/, sources/) is preserved.\n');
|
|
179
181
|
|
|
180
|
-
// 2. Remove vault/.codex-vault/ (hooks + version + backups)
|
|
181
|
-
const
|
|
182
|
-
|
|
183
|
-
fs.
|
|
184
|
-
|
|
182
|
+
// 2. Remove vault/.codex-vault/ and legacy vault/.codex-mem/ (hooks + version + backups)
|
|
183
|
+
for (const dirName of ['.codex-vault', '.codex-mem']) {
|
|
184
|
+
const dir = path.join(cwd, 'vault', dirName);
|
|
185
|
+
if (fs.existsSync(dir)) {
|
|
186
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
187
|
+
console.log(` [x] Removed vault/${dirName}/`);
|
|
188
|
+
}
|
|
185
189
|
}
|
|
186
190
|
|
|
187
191
|
// 3. Clean .claude/settings.json
|
|
@@ -201,8 +205,7 @@ function cmdUninstall() {
|
|
|
201
205
|
// 7. Clean CLAUDE.md
|
|
202
206
|
cleanInstructionFile(path.join(cwd, 'CLAUDE.md'), 'CLAUDE.md');
|
|
203
207
|
|
|
204
|
-
// 8.
|
|
205
|
-
cleanAgentsMd(cwd);
|
|
208
|
+
// 8. AGENTS.md — leave untouched (may contain user's own agent instructions)
|
|
206
209
|
|
|
207
210
|
// Summary
|
|
208
211
|
console.log('\ncodex-vault has been uninstalled.');
|
|
@@ -239,7 +242,8 @@ function cleanHooksJson(filePath, label) {
|
|
|
239
242
|
const hooks = entry.hooks || [];
|
|
240
243
|
// Keep the entry only if none of its hook commands belong to codex-vault
|
|
241
244
|
const isVaultEntry = hooks.some(
|
|
242
|
-
(h) => typeof h.command === 'string' &&
|
|
245
|
+
(h) => typeof h.command === 'string' &&
|
|
246
|
+
(h.command.includes('codex-vault/hooks/') || h.command.includes('codex-mem/hooks/'))
|
|
243
247
|
);
|
|
244
248
|
return !isVaultEntry;
|
|
245
249
|
});
|
|
@@ -392,26 +396,6 @@ function cleanInstructionFile(filePath, label) {
|
|
|
392
396
|
}
|
|
393
397
|
}
|
|
394
398
|
|
|
395
|
-
/**
|
|
396
|
-
* Handle AGENTS.md: if it's just "@CLAUDE.md", delete it.
|
|
397
|
-
* Otherwise apply the same section-removal logic as CLAUDE.md.
|
|
398
|
-
*/
|
|
399
|
-
function cleanAgentsMd(cwd) {
|
|
400
|
-
const filePath = path.join(cwd, 'AGENTS.md');
|
|
401
|
-
if (!fs.existsSync(filePath)) return;
|
|
402
|
-
|
|
403
|
-
const content = fs.readFileSync(filePath, 'utf8');
|
|
404
|
-
|
|
405
|
-
// If content is just @CLAUDE.md (possibly with whitespace), delete the file
|
|
406
|
-
if (content.trim() === '@CLAUDE.md') {
|
|
407
|
-
fs.unlinkSync(filePath);
|
|
408
|
-
console.log(' [x] Removed AGENTS.md (@CLAUDE.md reference)');
|
|
409
|
-
return;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
// Otherwise, apply the same section-removal logic
|
|
413
|
-
cleanInstructionFile(filePath, 'AGENTS.md');
|
|
414
|
-
}
|
|
415
399
|
|
|
416
400
|
/**
|
|
417
401
|
* Check if a directory is empty.
|
package/package.json
CHANGED
package/plugin/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.3.
|
|
1
|
+
0.3.2
|