@tryglen/cli 0.24.5 → 0.24.7
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/README.md +12 -0
- package/dist/_utils/codex-hooks-setup.d.ts +6 -1
- package/dist/_utils/codex-hooks-setup.js +34 -11
- package/dist/_utils/codex-hooks-setup.js.map +1 -1
- package/dist/_utils/git-hook-setup.d.ts +10 -1
- package/dist/_utils/git-hook-setup.js +54 -2
- package/dist/_utils/git-hook-setup.js.map +1 -1
- package/dist/_utils/install-receipt.d.ts +32 -0
- package/dist/_utils/install-receipt.js +126 -0
- package/dist/_utils/install-receipt.js.map +1 -0
- package/dist/_utils/purge-agent-plugins.d.ts +8 -0
- package/dist/_utils/purge-agent-plugins.js +62 -0
- package/dist/_utils/purge-agent-plugins.js.map +1 -0
- package/dist/_utils/purge-claude-statusline.d.ts +12 -0
- package/dist/_utils/purge-claude-statusline.js +57 -0
- package/dist/_utils/purge-claude-statusline.js.map +1 -0
- package/dist/_utils/purge-local-state.d.ts +7 -0
- package/dist/_utils/purge-local-state.js +40 -0
- package/dist/_utils/purge-local-state.js.map +1 -0
- package/dist/bin.js +1 -1
- package/dist/bin.js.map +1 -1
- package/dist/commands/ingest.js +56 -40
- package/dist/commands/ingest.js.map +1 -1
- package/dist/commands/install.js +39 -4
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/uninstall.d.ts +6 -9
- package/dist/commands/uninstall.js +104 -54
- package/dist/commands/uninstall.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,65 +1,115 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { join } from "node:path";
|
|
2
3
|
import { cliErr } from "../_utils/cli-error.js";
|
|
3
|
-
import {
|
|
4
|
+
import { uninstallCodexHooks } from "../_utils/codex-hooks-setup.js";
|
|
5
|
+
import { findBin } from "../_utils/find-bin.js";
|
|
6
|
+
import { uninstallPrepareCommitMsgHook } from "../_utils/git-hook-setup.js";
|
|
7
|
+
import { installReceipt } from "../_utils/install-receipt.js";
|
|
8
|
+
import { purgeAgentPlugins } from "../_utils/purge-agent-plugins.js";
|
|
9
|
+
import { purgeClaudeStatusline } from "../_utils/purge-claude-statusline.js";
|
|
10
|
+
import { purgeLocalState } from "../_utils/purge-local-state.js";
|
|
4
11
|
import { err, ok } from "../_utils/result.js";
|
|
5
|
-
import {
|
|
12
|
+
import { runBin } from "../_utils/run-bin.js";
|
|
13
|
+
import { removeGlenPathBlock } from "../_utils/shell-profile.js";
|
|
6
14
|
import { isInstalled } from "../_utils/which.js";
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
15
|
+
const details = (value) => Array.isArray(value) ? value : [value];
|
|
16
|
+
const absentGlobalPackage = (value) => /not installed|not found|does not exist|up to date/i.test(value);
|
|
17
|
+
/** Completely removes every safely identifiable local artifact owned by Glen. */
|
|
18
|
+
const uninstall = async (context = {}) => {
|
|
19
|
+
process.stdout.write("\n 🏔️ glen — complete uninstall\n\n");
|
|
20
|
+
// Inventory everything before ~/.glen (including binary overrides and the
|
|
21
|
+
// receipt itself) is deleted.
|
|
22
|
+
const home = context.home ?? homedir();
|
|
23
|
+
const cwd = context.cwd ?? process.cwd();
|
|
24
|
+
const receipt = await installReceipt.read();
|
|
25
|
+
const bins = {
|
|
26
|
+
claude: findBin("claude"),
|
|
27
|
+
codex: findBin("codex"),
|
|
28
|
+
pi: findBin("pi"),
|
|
29
|
+
npm: findBin("npm"),
|
|
30
|
+
};
|
|
31
|
+
const cursorDetected = isInstalled("cursor");
|
|
32
|
+
const canonicalDir = join(home, ".glen");
|
|
33
|
+
const claudeSettingsPath = receipt?.claudeSettings?.path ??
|
|
34
|
+
process.env.GLEN_CLAUDE_SETTINGS_PATH ??
|
|
35
|
+
join(home, ".claude", "settings.json");
|
|
36
|
+
const profiles = [
|
|
37
|
+
...(receipt?.shellProfiles ?? []),
|
|
38
|
+
join(home, ".zprofile"),
|
|
39
|
+
join(home, ".bash_profile"),
|
|
40
|
+
].filter((path, index, all) => all.indexOf(path) === index);
|
|
41
|
+
const overrideFiles = [
|
|
42
|
+
...(receipt?.statePaths ?? []),
|
|
43
|
+
process.env.GLEN_CREDENTIALS_PATH,
|
|
44
|
+
process.env.GLEN_STATE_PATH,
|
|
45
|
+
process.env.GLEN_AGENTS_PATH,
|
|
46
|
+
process.env.GLEN_INSTALL_RECEIPT_PATH,
|
|
47
|
+
].filter((path) => typeof path === "string" && path.length > 0);
|
|
48
|
+
const residuals = [];
|
|
49
|
+
const plugins = await purgeAgentPlugins({
|
|
50
|
+
home,
|
|
51
|
+
claude: bins.claude,
|
|
52
|
+
codex: bins.codex,
|
|
53
|
+
pi: bins.pi,
|
|
54
|
+
});
|
|
55
|
+
if (!plugins.ok)
|
|
56
|
+
residuals.push(...plugins.error);
|
|
57
|
+
const codexHooks = await uninstallCodexHooks(receipt?.codexFiles ?? undefined);
|
|
58
|
+
if (!codexHooks.ok)
|
|
59
|
+
residuals.push(...details(codexHooks.error));
|
|
60
|
+
const statusline = await purgeClaudeStatusline({
|
|
61
|
+
path: claudeSettingsPath,
|
|
62
|
+
receipt: receipt?.claudeSettings ?? null,
|
|
63
|
+
});
|
|
64
|
+
if (!statusline.ok)
|
|
65
|
+
residuals.push(...statusline.error);
|
|
66
|
+
for (const snapshot of receipt?.gitHooks ?? []) {
|
|
67
|
+
const hook = await uninstallPrepareCommitMsgHook({ cwd, snapshot });
|
|
68
|
+
if (!hook.ok)
|
|
69
|
+
residuals.push(hook.error);
|
|
32
70
|
}
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
process.stdout.write(" codex plugin remove glen\n");
|
|
41
|
-
}
|
|
42
|
-
if (claudeInstalled) {
|
|
43
|
-
process.stdout.write(" claude plugin uninstall glen@glen\n");
|
|
44
|
-
}
|
|
45
|
-
if (cursorInstalled) {
|
|
46
|
-
process.stdout.write(" Cursor: remove the glen plugin from Cursor's plugin settings (no CLI)\n");
|
|
47
|
-
}
|
|
48
|
-
if (piInstalled) {
|
|
49
|
-
process.stdout.write(` pi remove ${PI_PLUGIN_SOURCE}\n`);
|
|
71
|
+
const legacyHook = await uninstallPrepareCommitMsgHook({ cwd });
|
|
72
|
+
if (!legacyHook.ok)
|
|
73
|
+
residuals.push(legacyHook.error);
|
|
74
|
+
for (const profile of profiles) {
|
|
75
|
+
const removed = await removeGlenPathBlock(profile);
|
|
76
|
+
if (!removed.ok) {
|
|
77
|
+
residuals.push(`${removed.error.what} at ${profile}: ${removed.error.remedy}`);
|
|
50
78
|
}
|
|
51
79
|
}
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
80
|
+
const localState = await purgeLocalState({
|
|
81
|
+
canonicalDir,
|
|
82
|
+
overrideFiles,
|
|
83
|
+
npxRoot: join(home, ".npm", "_npx"),
|
|
84
|
+
});
|
|
85
|
+
if (!localState.ok)
|
|
86
|
+
residuals.push(...localState.error);
|
|
87
|
+
if (cursorDetected) {
|
|
88
|
+
residuals.push("Cursor may still contain the Glen plugin; open Cursor plugin settings (or /add-plugin) and remove Glen manually");
|
|
89
|
+
}
|
|
90
|
+
// Self-removal is intentionally last. Every earlier cleanup step can still
|
|
91
|
+
// rely on this running CLI even if another step fails.
|
|
92
|
+
if (bins.npm) {
|
|
93
|
+
const globalCli = runBin(bins.npm, ["uninstall", "-g", "@tryglen/cli"], {
|
|
94
|
+
timeoutMs: 300_000,
|
|
95
|
+
});
|
|
96
|
+
if (!globalCli.ok) {
|
|
97
|
+
const failure = globalCli.error.stderrTail ||
|
|
98
|
+
globalCli.error.spawnError ||
|
|
99
|
+
"npm uninstall failed";
|
|
100
|
+
if (!absentGlobalPackage(failure)) {
|
|
101
|
+
residuals.push(`${bins.npm} uninstall -g @tryglen/cli: ${failure}`);
|
|
102
|
+
}
|
|
60
103
|
}
|
|
61
104
|
}
|
|
62
|
-
|
|
105
|
+
if (residuals.length > 0) {
|
|
106
|
+
return err(cliErr({
|
|
107
|
+
what: "glen uninstall left local residue",
|
|
108
|
+
why: residuals.join("\n"),
|
|
109
|
+
remedy: "run the listed cleanup steps, then re-run `glen uninstall` if the command remains available",
|
|
110
|
+
}));
|
|
111
|
+
}
|
|
112
|
+
process.stdout.write(" ✓ Glen has been completely removed from this machine.\n\n");
|
|
63
113
|
return ok(undefined);
|
|
64
114
|
};
|
|
65
115
|
export { uninstall };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"uninstall.js","sourceRoot":"","sources":["../../src/commands/uninstall.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAiB,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,6BAA6B,EAAE,MAAM,6BAA6B,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAA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