@plexor-dev/claude-code-plugin 0.1.0-beta.31 → 0.1.0-beta.33
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 +1 -1
- package/commands/plexor-enabled.js +63 -3
- package/commands/plexor-enabled.md +2 -21
- package/commands/plexor-login.js +141 -14
- package/commands/plexor-login.md +3 -19
- package/commands/plexor-logout.js +23 -5
- package/commands/plexor-logout.md +2 -20
- package/commands/plexor-setup.md +5 -2
- package/commands/plexor-status.js +67 -11
- package/commands/plexor-status.md +1 -13
- package/commands/plexor-uninstall.js +293 -0
- package/commands/plexor-uninstall.md +12 -0
- package/hooks/intercept.js +17 -21
- package/hooks/track-response.js +2 -2
- package/lib/config.js +1 -1
- package/lib/constants.js +19 -1
- package/lib/settings-manager.js +56 -8
- package/package.json +3 -2
- package/scripts/postinstall.js +48 -0
- package/scripts/uninstall.js +129 -42
package/scripts/uninstall.js
CHANGED
|
@@ -1,67 +1,154 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* Plexor Claude Code Plugin - Uninstall Script
|
|
4
|
+
* Plexor Claude Code Plugin - Comprehensive Uninstall Script
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Runs on npm uninstall (when npm actually calls it).
|
|
7
|
+
* Also callable directly: node scripts/uninstall.js
|
|
8
|
+
*
|
|
9
|
+
* Performs complete cleanup:
|
|
10
|
+
* 1. Removes Plexor routing from ~/.claude/settings.json
|
|
11
|
+
* 2. Removes slash command files from ~/.claude/commands/
|
|
12
|
+
* 3. Removes plugin directory from ~/.claude/plugins/plexor/
|
|
13
|
+
* 4. Restores any backups if they exist
|
|
8
14
|
*/
|
|
9
15
|
|
|
10
16
|
const fs = require('fs');
|
|
11
17
|
const path = require('path');
|
|
12
|
-
const os = require('os');
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
const
|
|
19
|
+
// Get home directory - support both Unix and Windows
|
|
20
|
+
const home = process.env.HOME || process.env.USERPROFILE;
|
|
21
|
+
if (!home) {
|
|
22
|
+
console.log('Warning: HOME not set, skipping cleanup');
|
|
23
|
+
process.exit(0);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
console.log('');
|
|
27
|
+
console.log(' Plexor plugin cleanup...');
|
|
28
|
+
console.log('');
|
|
29
|
+
|
|
30
|
+
const results = {
|
|
31
|
+
routing: false,
|
|
32
|
+
commands: [],
|
|
33
|
+
restored: [],
|
|
34
|
+
pluginDir: false
|
|
35
|
+
};
|
|
16
36
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
37
|
+
// 1. Remove routing from settings.json
|
|
38
|
+
// This is CRITICAL - do NOT depend on settings-manager module since it may not load during uninstall
|
|
39
|
+
try {
|
|
40
|
+
const settingsPath = path.join(home, '.claude', 'settings.json');
|
|
41
|
+
if (fs.existsSync(settingsPath)) {
|
|
42
|
+
const data = fs.readFileSync(settingsPath, 'utf8');
|
|
43
|
+
if (data && data.trim()) {
|
|
44
|
+
const settings = JSON.parse(data);
|
|
45
|
+
if (settings.env) {
|
|
46
|
+
const hadBaseUrl = !!settings.env.ANTHROPIC_BASE_URL;
|
|
47
|
+
const hadAuthToken = !!settings.env.ANTHROPIC_AUTH_TOKEN;
|
|
48
|
+
|
|
49
|
+
delete settings.env.ANTHROPIC_BASE_URL;
|
|
50
|
+
delete settings.env.ANTHROPIC_AUTH_TOKEN;
|
|
51
|
+
|
|
52
|
+
// Clean up empty env block
|
|
53
|
+
if (Object.keys(settings.env).length === 0) {
|
|
54
|
+
delete settings.env;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (hadBaseUrl || hadAuthToken) {
|
|
58
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), { mode: 0o600 });
|
|
59
|
+
results.routing = true;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
} catch (e) {
|
|
65
|
+
console.log(` Warning: Could not clean settings.json: ${e.message}`);
|
|
66
|
+
}
|
|
22
67
|
|
|
23
|
-
|
|
24
|
-
|
|
68
|
+
// 2. Remove slash command files
|
|
69
|
+
// These are the Plexor-specific command files that get installed to ~/.claude/commands/
|
|
70
|
+
const plexorCommands = [
|
|
71
|
+
'plexor-config.md',
|
|
72
|
+
'plexor-enabled.md',
|
|
73
|
+
'plexor-login.md',
|
|
74
|
+
'plexor-logout.md',
|
|
75
|
+
'plexor-mode.md',
|
|
76
|
+
'plexor-provider.md',
|
|
77
|
+
'plexor-settings.md',
|
|
78
|
+
'plexor-setup.md',
|
|
79
|
+
'plexor-status.md',
|
|
80
|
+
'plexor-uninstall.md'
|
|
81
|
+
];
|
|
25
82
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
83
|
+
try {
|
|
84
|
+
const commandsDir = path.join(home, '.claude', 'commands');
|
|
85
|
+
if (fs.existsSync(commandsDir)) {
|
|
86
|
+
for (const cmd of plexorCommands) {
|
|
87
|
+
const cmdPath = path.join(commandsDir, cmd);
|
|
88
|
+
const backupPath = cmdPath + '.backup';
|
|
29
89
|
|
|
30
|
-
if (fs.existsSync(
|
|
31
|
-
fs.unlinkSync(
|
|
32
|
-
|
|
90
|
+
if (fs.existsSync(cmdPath)) {
|
|
91
|
+
fs.unlinkSync(cmdPath);
|
|
92
|
+
results.commands.push(cmd.replace('.md', ''));
|
|
33
93
|
|
|
34
94
|
// Restore backup if it exists
|
|
35
95
|
if (fs.existsSync(backupPath)) {
|
|
36
|
-
fs.renameSync(backupPath,
|
|
37
|
-
restored.push(
|
|
96
|
+
fs.renameSync(backupPath, cmdPath);
|
|
97
|
+
results.restored.push(cmd);
|
|
38
98
|
}
|
|
39
99
|
}
|
|
40
100
|
}
|
|
101
|
+
}
|
|
102
|
+
} catch (e) {
|
|
103
|
+
console.log(` Warning: Could not clean commands: ${e.message}`);
|
|
104
|
+
}
|
|
41
105
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
restored.forEach(f => console.log(` ${f}`));
|
|
53
|
-
}
|
|
106
|
+
// 3. Remove plugin directory
|
|
107
|
+
try {
|
|
108
|
+
const pluginDir = path.join(home, '.claude', 'plugins', 'plexor');
|
|
109
|
+
if (fs.existsSync(pluginDir)) {
|
|
110
|
+
fs.rmSync(pluginDir, { recursive: true, force: true });
|
|
111
|
+
results.pluginDir = true;
|
|
112
|
+
}
|
|
113
|
+
} catch (e) {
|
|
114
|
+
console.log(` Warning: Could not remove plugin directory: ${e.message}`);
|
|
115
|
+
}
|
|
54
116
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
117
|
+
// Output results
|
|
118
|
+
if (results.routing || results.commands.length > 0 || results.pluginDir) {
|
|
119
|
+
console.log(' Plexor plugin uninstalled');
|
|
120
|
+
console.log('');
|
|
60
121
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
console.
|
|
122
|
+
if (results.routing) {
|
|
123
|
+
console.log(' Removed Plexor routing from Claude settings');
|
|
124
|
+
console.log(' (Claude Code now connects directly to Anthropic)');
|
|
125
|
+
console.log('');
|
|
64
126
|
}
|
|
127
|
+
|
|
128
|
+
if (results.commands.length > 0) {
|
|
129
|
+
console.log(' Removed commands:');
|
|
130
|
+
results.commands.forEach(cmd => console.log(` /${cmd}`));
|
|
131
|
+
console.log('');
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (results.restored.length > 0) {
|
|
135
|
+
console.log(' Restored from backup:');
|
|
136
|
+
results.restored.forEach(f => console.log(` ${f}`));
|
|
137
|
+
console.log('');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
if (results.pluginDir) {
|
|
141
|
+
console.log(' Removed plugin directory');
|
|
142
|
+
console.log('');
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.log(' Note: ~/.plexor/ config directory was preserved.');
|
|
146
|
+
console.log(' To remove it: rm -rf ~/.plexor');
|
|
147
|
+
console.log('');
|
|
148
|
+
} else {
|
|
149
|
+
console.log(' No Plexor components found to clean up.');
|
|
150
|
+
console.log('');
|
|
65
151
|
}
|
|
66
152
|
|
|
67
|
-
|
|
153
|
+
console.log(' Cleanup complete');
|
|
154
|
+
console.log('');
|