squidclaw 0.2.1 → 0.2.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/squidclaw.js +2 -0
- package/lib/cli/uninstall-cmd.js +73 -0
- package/package.json +1 -1
package/bin/squidclaw.js
CHANGED
|
@@ -499,6 +499,8 @@ if (process.argv.length <= 2) {
|
|
|
499
499
|
process.exit(0);
|
|
500
500
|
}
|
|
501
501
|
|
|
502
|
+
import { registerUninstallCommand } from '../lib/cli/uninstall-cmd.js';
|
|
503
|
+
registerUninstallCommand(program);
|
|
502
504
|
program.parse();
|
|
503
505
|
|
|
504
506
|
// ── TUI ────────────────────────────────────────────────
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 🦑 Uninstall Command
|
|
3
|
+
* Clean removal of Squidclaw — data, config, everything
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { getHome } from '../core/config.js';
|
|
7
|
+
import { rmSync, existsSync } from 'fs';
|
|
8
|
+
import { join } from 'path';
|
|
9
|
+
import readline from 'readline';
|
|
10
|
+
|
|
11
|
+
function ask(question) {
|
|
12
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
13
|
+
return new Promise(resolve => rl.question(question, ans => { rl.close(); resolve(ans.trim().toLowerCase()); }));
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function registerUninstallCommand(program) {
|
|
17
|
+
program
|
|
18
|
+
.command('uninstall')
|
|
19
|
+
.description('🗑️ Remove Squidclaw completely (data, config, everything)')
|
|
20
|
+
.option('--keep-data', 'Keep agent data and conversations')
|
|
21
|
+
.option('-y, --yes', 'Skip confirmation')
|
|
22
|
+
.action(async (opts) => {
|
|
23
|
+
const home = getHome();
|
|
24
|
+
|
|
25
|
+
console.log(`
|
|
26
|
+
🦑 Squidclaw Uninstaller
|
|
27
|
+
────────────────────────
|
|
28
|
+
This will remove:`);
|
|
29
|
+
|
|
30
|
+
if (!opts.keepData) {
|
|
31
|
+
console.log(` • Config: ${home}/config.json`);
|
|
32
|
+
console.log(` • Database: ${home}/squidclaw.db`);
|
|
33
|
+
console.log(` • Agents: ${home}/agents/`);
|
|
34
|
+
console.log(` • Channels: ${home}/channels/`);
|
|
35
|
+
console.log(` • Knowledge: ${home}/knowledge/`);
|
|
36
|
+
console.log(` • Logs: ${home}/logs/`);
|
|
37
|
+
console.log(` • Everything in: ${home}/`);
|
|
38
|
+
} else {
|
|
39
|
+
console.log(` • npm package only (keeping data in ${home}/)`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
console.log();
|
|
43
|
+
|
|
44
|
+
if (!opts.yes) {
|
|
45
|
+
const answer = await ask(' Are you sure? Type "yes" to confirm: ');
|
|
46
|
+
if (answer !== 'yes') {
|
|
47
|
+
console.log(' ❌ Cancelled\n');
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Stop running engine first
|
|
53
|
+
try {
|
|
54
|
+
await fetch('http://127.0.0.1:9500/api/engine/stop', { method: 'POST' }).catch(() => {});
|
|
55
|
+
} catch {}
|
|
56
|
+
|
|
57
|
+
if (!opts.keepData) {
|
|
58
|
+
// Remove data directory
|
|
59
|
+
if (existsSync(home)) {
|
|
60
|
+
rmSync(home, { recursive: true, force: true });
|
|
61
|
+
console.log(` ✅ Removed ${home}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
console.log(`
|
|
66
|
+
✅ Data cleaned! Now run:
|
|
67
|
+
|
|
68
|
+
npm uninstall -g squidclaw
|
|
69
|
+
|
|
70
|
+
👋 Thanks for trying Squidclaw! 🦑
|
|
71
|
+
`);
|
|
72
|
+
});
|
|
73
|
+
}
|