@plexor-dev/claude-code-plugin 0.1.0-beta.22 → 0.1.0-beta.23
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/package.json +1 -1
- package/scripts/postinstall.js +72 -23
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -35,6 +35,22 @@ const COMMANDS_SOURCE = path.join(__dirname, '..', 'commands');
|
|
|
35
35
|
const CLAUDE_COMMANDS_DIR = path.join(HOME_DIR, '.claude', 'commands');
|
|
36
36
|
const PLEXOR_PLUGINS_DIR = path.join(HOME_DIR, '.claude', 'plugins', 'plexor', 'commands');
|
|
37
37
|
const PLEXOR_CONFIG_DIR = path.join(HOME_DIR, '.plexor');
|
|
38
|
+
const PLEXOR_CONFIG_FILE = path.join(PLEXOR_CONFIG_DIR, 'config.json');
|
|
39
|
+
|
|
40
|
+
// Default configuration for new installs
|
|
41
|
+
const DEFAULT_CONFIG = {
|
|
42
|
+
version: 1,
|
|
43
|
+
auth: {
|
|
44
|
+
mode: "pending",
|
|
45
|
+
authenticated_at: null
|
|
46
|
+
},
|
|
47
|
+
settings: {
|
|
48
|
+
enabled: true,
|
|
49
|
+
apiUrl: "https://api.plexor.dev",
|
|
50
|
+
mode: "balanced",
|
|
51
|
+
localCacheEnabled: true
|
|
52
|
+
}
|
|
53
|
+
};
|
|
38
54
|
|
|
39
55
|
function main() {
|
|
40
56
|
try {
|
|
@@ -47,6 +63,17 @@ function main() {
|
|
|
47
63
|
// Create ~/.plexor/ with secure permissions (owner only)
|
|
48
64
|
fs.mkdirSync(PLEXOR_CONFIG_DIR, { recursive: true, mode: 0o700 });
|
|
49
65
|
|
|
66
|
+
// Create default config.json if it doesn't exist
|
|
67
|
+
let configCreated = false;
|
|
68
|
+
if (!fs.existsSync(PLEXOR_CONFIG_FILE)) {
|
|
69
|
+
fs.writeFileSync(
|
|
70
|
+
PLEXOR_CONFIG_FILE,
|
|
71
|
+
JSON.stringify(DEFAULT_CONFIG, null, 2),
|
|
72
|
+
{ mode: 0o600 }
|
|
73
|
+
);
|
|
74
|
+
configCreated = true;
|
|
75
|
+
}
|
|
76
|
+
|
|
50
77
|
// Get list of command files (.md for Claude, .js for executors)
|
|
51
78
|
const mdFiles = fs.readdirSync(COMMANDS_SOURCE)
|
|
52
79
|
.filter(f => f.endsWith('.md'));
|
|
@@ -93,42 +120,64 @@ function main() {
|
|
|
93
120
|
jsInstalled.push(file);
|
|
94
121
|
}
|
|
95
122
|
|
|
96
|
-
//
|
|
123
|
+
// Detect shell type
|
|
124
|
+
const shell = process.env.SHELL || '';
|
|
125
|
+
const isZsh = shell.includes('zsh');
|
|
126
|
+
const shellRc = isZsh ? '~/.zshrc' : '~/.bashrc';
|
|
127
|
+
|
|
128
|
+
// Print success message with clear onboarding steps
|
|
97
129
|
console.log('');
|
|
98
|
-
console.log('
|
|
99
|
-
console.log(' ║
|
|
100
|
-
console.log(' ║ Plexor Claude Code Plugin installed successfully!
|
|
101
|
-
console.log(' ║
|
|
102
|
-
console.log('
|
|
130
|
+
console.log(' ╔═══════════════════════════════════════════════════════════════════╗');
|
|
131
|
+
console.log(' ║ ║');
|
|
132
|
+
console.log(' ║ Plexor Claude Code Plugin installed successfully! ║');
|
|
133
|
+
console.log(' ║ ║');
|
|
134
|
+
console.log(' ╚═══════════════════════════════════════════════════════════════════╝');
|
|
103
135
|
console.log('');
|
|
104
|
-
console.log(' Commands installed to ~/.claude/commands/:');
|
|
105
|
-
installed.forEach(cmd => {
|
|
106
|
-
console.log(` /${cmd}`);
|
|
107
|
-
});
|
|
108
136
|
|
|
109
|
-
if (
|
|
110
|
-
console.log('');
|
|
111
|
-
console.log(' Existing files backed up (.backup):');
|
|
112
|
-
backed_up.forEach(f => console.log(` ${f}`));
|
|
137
|
+
if (configCreated) {
|
|
138
|
+
console.log(' ✓ Created ~/.plexor/config.json');
|
|
113
139
|
}
|
|
114
|
-
|
|
140
|
+
console.log(` ✓ Installed ${installed.length} slash commands to ~/.claude/commands/`);
|
|
115
141
|
if (jsInstalled.length > 0) {
|
|
116
|
-
console.log(
|
|
117
|
-
console.log(' Executors installed to ~/.claude/plugins/plexor/commands/:');
|
|
118
|
-
jsInstalled.forEach(f => console.log(` ${f}`));
|
|
142
|
+
console.log(` ✓ Installed ${jsInstalled.length} executors to ~/.claude/plugins/plexor/`);
|
|
119
143
|
}
|
|
144
|
+
console.log('');
|
|
120
145
|
|
|
146
|
+
// CRITICAL: Make the required step VERY obvious
|
|
147
|
+
console.log(' ┌─────────────────────────────────────────────────────────────────┐');
|
|
148
|
+
console.log(' │ REQUIRED: Run this command to enable Plexor routing: │');
|
|
149
|
+
console.log(' └─────────────────────────────────────────────────────────────────┘');
|
|
121
150
|
console.log('');
|
|
122
|
-
console.log('
|
|
123
|
-
console.log(' 1. Open Claude Code');
|
|
124
|
-
console.log(' 2. Run /plexor-setup to configure (handles MAX + API key users)');
|
|
125
|
-
console.log(' 3. Start saving on LLM costs!');
|
|
151
|
+
console.log(' For Claude MAX users (OAuth):');
|
|
126
152
|
console.log('');
|
|
127
|
-
console.log('
|
|
153
|
+
console.log(` echo 'export ANTHROPIC_BASE_URL="https://api.plexor.dev/gateway/anthropic"' >> ${shellRc}`);
|
|
154
|
+
console.log(` source ${shellRc}`);
|
|
155
|
+
console.log('');
|
|
156
|
+
console.log(' For API key users (get key at https://plexor.dev/dashboard):');
|
|
157
|
+
console.log('');
|
|
158
|
+
console.log(` echo 'export ANTHROPIC_BASE_URL="https://api.plexor.dev/gateway/anthropic"' >> ${shellRc}`);
|
|
159
|
+
console.log(` echo 'export ANTHROPIC_API_KEY="plx_your_key_here"' >> ${shellRc}`);
|
|
160
|
+
console.log(` source ${shellRc}`);
|
|
161
|
+
console.log('');
|
|
162
|
+
console.log(' ┌─────────────────────────────────────────────────────────────────┐');
|
|
163
|
+
console.log(' │ Then start Claude Code and run: /plexor-status │');
|
|
164
|
+
console.log(' └─────────────────────────────────────────────────────────────────┘');
|
|
165
|
+
console.log('');
|
|
166
|
+
console.log(' Available commands:');
|
|
167
|
+
console.log(' /plexor-status - Check connection and see savings');
|
|
168
|
+
console.log(' /plexor-mode - Switch modes (eco/balanced/quality)');
|
|
169
|
+
console.log(' /plexor-login - Authenticate with API key');
|
|
170
|
+
console.log(' /plexor-settings - View/modify settings');
|
|
128
171
|
console.log('');
|
|
129
172
|
console.log(' Documentation: https://plexor.dev/docs');
|
|
130
173
|
console.log('');
|
|
131
174
|
|
|
175
|
+
if (backed_up.length > 0) {
|
|
176
|
+
console.log(' Note: Existing files backed up (.backup):');
|
|
177
|
+
backed_up.forEach(f => console.log(` ${f}`));
|
|
178
|
+
console.log('');
|
|
179
|
+
}
|
|
180
|
+
|
|
132
181
|
} catch (error) {
|
|
133
182
|
console.error('');
|
|
134
183
|
console.error(' Plexor plugin installation failed');
|