@plexor-dev/claude-code-plugin 0.1.0-beta.21 → 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/commands/plexor-config.md +15 -31
- package/commands/plexor-enabled.md +14 -42
- package/commands/plexor-login.md +13 -72
- package/commands/plexor-logout.md +13 -30
- package/commands/plexor-mode.md +14 -36
- package/commands/plexor-provider.md +14 -36
- package/commands/plexor-settings.md +14 -46
- package/lib/plexor-client.js +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.js +72 -23
|
@@ -4,41 +4,25 @@ description: Configure Plexor settings (user)
|
|
|
4
4
|
|
|
5
5
|
# Plexor Config
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run this command to view configuration details:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
```bash
|
|
10
|
+
node ~/.claude/plugins/plexor/commands/plexor-config.js
|
|
11
|
+
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Options:
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
=============
|
|
19
|
-
No configuration found. Run /plexor-login to set up Plexor.
|
|
15
|
+
```bash
|
|
16
|
+
node ~/.claude/plugins/plexor/commands/plexor-config.js --raw # Show raw JSON
|
|
17
|
+
node ~/.claude/plugins/plexor/commands/plexor-config.js --paths # Show file paths
|
|
20
18
|
```
|
|
21
19
|
|
|
22
|
-
|
|
20
|
+
Use the Bash tool to execute this command.
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
API Key: [show "configured" if apiKey exists, otherwise "not configured"]
|
|
30
|
-
Mode: [mode]
|
|
31
|
-
Provider: [preferredProvider]
|
|
32
|
-
Local Cache: [localCacheEnabled]
|
|
33
|
-
Timeout: [timeout]ms
|
|
34
|
-
|
|
35
|
-
Configuration file: ~/.plexor/config.json
|
|
36
|
-
|
|
37
|
-
Other commands:
|
|
38
|
-
- /plexor-settings - View/edit all settings
|
|
39
|
-
- /plexor-mode - Change optimization mode
|
|
40
|
-
- /plexor-provider - Change provider
|
|
41
|
-
- /plexor-enabled - Enable/disable proxy
|
|
42
|
-
```
|
|
22
|
+
**IMPORTANT**: After running this command and displaying the output, STOP. Do not:
|
|
23
|
+
- Read any files
|
|
24
|
+
- Explore the codebase
|
|
25
|
+
- Run additional commands
|
|
26
|
+
- Ask follow-up questions
|
|
43
27
|
|
|
44
|
-
|
|
28
|
+
The command output is the complete response. Simply show the output and wait for the user's next input.
|
|
@@ -4,53 +4,25 @@ description: Enable or disable Plexor proxy (routes all traffic through Plexor A
|
|
|
4
4
|
|
|
5
5
|
# Plexor Enabled
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run this command to view or toggle the Plexor proxy:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Step 1: Read current configuration**
|
|
12
|
-
|
|
13
|
-
Use the Read tool to read `~/.plexor/config.json` and check the current `enabled` status.
|
|
14
|
-
|
|
15
|
-
**Step 2: Ask user what they want to do**
|
|
16
|
-
|
|
17
|
-
Use the `AskUserQuestion` tool to present options:
|
|
18
|
-
|
|
19
|
-
Question: "Enable or disable Plexor proxy?"
|
|
20
|
-
Header: "Proxy"
|
|
21
|
-
Options:
|
|
22
|
-
1. **Enable** - Route traffic through Plexor for optimization (60-90% cost savings)
|
|
23
|
-
2. **Disable** - Direct to Anthropic (no optimization, full price)
|
|
24
|
-
|
|
25
|
-
**Step 3: Update the configuration**
|
|
26
|
-
|
|
27
|
-
Use the Read tool to get the current config, then use the Write tool to update `~/.plexor/config.json`:
|
|
28
|
-
- If **Enable**: Set `"enabled": true`
|
|
29
|
-
- If **Disable**: Set `"enabled": false`
|
|
30
|
-
|
|
31
|
-
Keep all other settings unchanged.
|
|
32
|
-
|
|
33
|
-
**Step 4: Show confirmation**
|
|
34
|
-
|
|
35
|
-
If **Enabled**:
|
|
9
|
+
```bash
|
|
10
|
+
node ~/.claude/plugins/plexor/commands/plexor-enabled.js
|
|
36
11
|
```
|
|
37
|
-
Plexor Proxy: ENABLED
|
|
38
12
|
|
|
39
|
-
|
|
40
|
-
- 60-90% cost reduction via intelligent provider routing
|
|
41
|
-
- Automatic selection of Mistral/DeepSeek/Gemini based on task
|
|
42
|
-
- Usage tracking and savings analytics
|
|
13
|
+
To enable or disable, pass an argument:
|
|
43
14
|
|
|
44
|
-
|
|
45
|
-
|
|
15
|
+
```bash
|
|
16
|
+
node ~/.claude/plugins/plexor/commands/plexor-enabled.js true
|
|
17
|
+
node ~/.claude/plugins/plexor/commands/plexor-enabled.js false
|
|
46
18
|
```
|
|
47
19
|
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
Plexor Proxy: DISABLED
|
|
20
|
+
Use the Bash tool to execute this command.
|
|
51
21
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
22
|
+
**IMPORTANT**: After running this command and displaying the output, STOP. Do not:
|
|
23
|
+
- Read any files
|
|
24
|
+
- Explore the codebase
|
|
25
|
+
- Run additional commands
|
|
26
|
+
- Ask follow-up questions
|
|
55
27
|
|
|
56
|
-
|
|
28
|
+
The command output is the complete response. Simply show the output and wait for the user's next input.
|
package/commands/plexor-login.md
CHANGED
|
@@ -4,83 +4,24 @@ description: Authenticate with Plexor to enable optimization (user)
|
|
|
4
4
|
|
|
5
5
|
# Plexor Login
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run this command to authenticate with Plexor:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Step 1: Check existing authentication**
|
|
12
|
-
|
|
13
|
-
Use the Read tool to read `~/.plexor/config.json`.
|
|
14
|
-
|
|
15
|
-
If the file exists and has `auth.api_key` that starts with "plx_", the user is already authenticated. Show them:
|
|
16
|
-
```
|
|
17
|
-
Plexor Login
|
|
18
|
-
============
|
|
19
|
-
Already authenticated!
|
|
20
|
-
API Key: plx_****[last 4 chars]
|
|
21
|
-
API URL: [apiUrl from config]
|
|
22
|
-
Status: [Enabled/Disabled]
|
|
23
|
-
|
|
24
|
-
Run /plexor-status to see your usage statistics.
|
|
25
|
-
Run /plexor-logout to sign out.
|
|
9
|
+
```bash
|
|
10
|
+
node ~/.claude/plugins/plexor/commands/plexor-login.js
|
|
26
11
|
```
|
|
27
12
|
|
|
28
|
-
|
|
13
|
+
To login with an API key:
|
|
29
14
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- https://plexor.dev/signup (to create an account)
|
|
33
|
-
|
|
34
|
-
Tell them: "Please provide your Plexor API key (starts with 'plx_'):"
|
|
35
|
-
|
|
36
|
-
**Step 3: Save the configuration**
|
|
37
|
-
|
|
38
|
-
Once the user provides an API key (or it was passed as an argument), use the Write tool to create/update `~/.plexor/config.json`:
|
|
39
|
-
|
|
40
|
-
```json
|
|
41
|
-
{
|
|
42
|
-
"version": 1,
|
|
43
|
-
"auth": {
|
|
44
|
-
"api_key": "[user's API key]",
|
|
45
|
-
"authenticated_at": "[current ISO timestamp]"
|
|
46
|
-
},
|
|
47
|
-
"settings": {
|
|
48
|
-
"enabled": true,
|
|
49
|
-
"apiUrl": "https://api.plexor.dev",
|
|
50
|
-
"preferred_provider": "auto",
|
|
51
|
-
"mode": "balanced",
|
|
52
|
-
"localCacheEnabled": true,
|
|
53
|
-
"timeout": 5000
|
|
54
|
-
}
|
|
55
|
-
}
|
|
15
|
+
```bash
|
|
16
|
+
node ~/.claude/plugins/plexor/commands/plexor-login.js plx_your_api_key_here
|
|
56
17
|
```
|
|
57
18
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
**Step 4: Verify the key works**
|
|
61
|
-
|
|
62
|
-
Make a test request to verify authentication:
|
|
63
|
-
```
|
|
64
|
-
GET https://api.plexor.dev/api/users/me
|
|
65
|
-
Authorization: Bearer [apiKey]
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
If successful, show:
|
|
69
|
-
```
|
|
70
|
-
Plexor Login
|
|
71
|
-
============
|
|
72
|
-
Authentication successful!
|
|
73
|
-
|
|
74
|
-
Your API key has been saved to ~/.plexor/config.json
|
|
75
|
-
|
|
76
|
-
Next steps:
|
|
77
|
-
1. Run /plexor-status to see your usage
|
|
78
|
-
2. Run /plexor-enabled true to enable the proxy
|
|
79
|
-
3. Start saving on LLM costs!
|
|
80
|
-
|
|
81
|
-
Dashboard: https://plexor.dev/dashboard
|
|
82
|
-
```
|
|
19
|
+
Use the Bash tool to execute this command.
|
|
83
20
|
|
|
84
|
-
|
|
21
|
+
**IMPORTANT**: After running this command and displaying the output, STOP. Do not:
|
|
22
|
+
- Read any files
|
|
23
|
+
- Explore the codebase
|
|
24
|
+
- Run additional commands
|
|
25
|
+
- Ask follow-up questions
|
|
85
26
|
|
|
86
|
-
|
|
27
|
+
The command output is the complete response. Simply show the output and wait for the user's next input.
|
|
@@ -4,41 +4,24 @@ description: Log out from Plexor and clear credentials (user)
|
|
|
4
4
|
|
|
5
5
|
# Plexor Logout
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run this command to log out and clear credentials:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Step 1: Read current configuration**
|
|
12
|
-
|
|
13
|
-
Use the Read tool to read `~/.plexor/config.json`.
|
|
14
|
-
|
|
15
|
-
If the file doesn't exist or has no `apiKey`, show:
|
|
16
|
-
```
|
|
17
|
-
Plexor Logout
|
|
18
|
-
=============
|
|
19
|
-
You are not currently logged in.
|
|
20
|
-
Run /plexor-login to authenticate.
|
|
9
|
+
```bash
|
|
10
|
+
node ~/.claude/plugins/plexor/commands/plexor-logout.js
|
|
21
11
|
```
|
|
22
12
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
If authenticated, use the Write tool to update `~/.plexor/config.json`:
|
|
26
|
-
- Remove or clear the `apiKey` field (set to empty string "")
|
|
27
|
-
- Keep all other settings (mode, preferredProvider, etc.)
|
|
28
|
-
|
|
29
|
-
**Step 3: Show confirmation**
|
|
13
|
+
To also clear the cache:
|
|
30
14
|
|
|
15
|
+
```bash
|
|
16
|
+
node ~/.claude/plugins/plexor/commands/plexor-logout.js --clear-cache
|
|
31
17
|
```
|
|
32
|
-
Plexor Logout
|
|
33
|
-
=============
|
|
34
|
-
Successfully logged out!
|
|
35
18
|
|
|
36
|
-
|
|
37
|
-
- Settings preserved (mode, provider preferences)
|
|
19
|
+
Use the Bash tool to execute this command.
|
|
38
20
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
21
|
+
**IMPORTANT**: After running this command and displaying the output, STOP. Do not:
|
|
22
|
+
- Read any files
|
|
23
|
+
- Explore the codebase
|
|
24
|
+
- Run additional commands
|
|
25
|
+
- Ask follow-up questions
|
|
43
26
|
|
|
44
|
-
|
|
27
|
+
The command output is the complete response. Simply show the output and wait for the user's next input.
|
package/commands/plexor-mode.md
CHANGED
|
@@ -4,46 +4,24 @@ description: Set Plexor optimization mode (eco/balanced/quality/passthrough) (us
|
|
|
4
4
|
|
|
5
5
|
# Plexor Mode
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run this command to view or set the optimization mode:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Use the Read tool to read `~/.plexor/config.json` and check the current `mode` setting.
|
|
14
|
-
|
|
15
|
-
**Step 2: Ask user which mode they want**
|
|
16
|
-
|
|
17
|
-
Use the `AskUserQuestion` tool:
|
|
18
|
-
|
|
19
|
-
Question: "Which optimization mode would you like to use?"
|
|
20
|
-
Header: "Mode"
|
|
21
|
-
Options:
|
|
22
|
-
1. **eco** - Maximum savings (~$0.04/1M tokens) - Uses Ministral 3B
|
|
23
|
-
2. **balanced** - Good balance (~$0.15/1M) - DeepSeek, Gemini Flash, Mistral Small
|
|
24
|
-
3. **quality** - Premium models (~$5/1M) - Claude Opus, Gemini Pro, Mistral Large
|
|
25
|
-
4. **passthrough** - No optimization - Direct to requested model
|
|
26
|
-
|
|
27
|
-
**Step 3: Update the configuration**
|
|
28
|
-
|
|
29
|
-
Use the Read tool to get the current config, then use the Write tool to update `~/.plexor/config.json`:
|
|
30
|
-
- Set the `mode` field to the selected value: "eco", "balanced", "quality", or "passthrough"
|
|
31
|
-
|
|
32
|
-
Keep all other settings unchanged.
|
|
9
|
+
```bash
|
|
10
|
+
node ~/.claude/plugins/plexor/commands/plexor-mode.js
|
|
11
|
+
```
|
|
33
12
|
|
|
34
|
-
|
|
13
|
+
To set a specific mode, pass it as an argument:
|
|
35
14
|
|
|
15
|
+
```bash
|
|
16
|
+
node ~/.claude/plugins/plexor/commands/plexor-mode.js balanced
|
|
36
17
|
```
|
|
37
|
-
Plexor Mode: [SELECTED MODE]
|
|
38
18
|
|
|
39
|
-
|
|
40
|
-
- eco: Maximum cost savings using Ministral 3B ($0.04/$0.04 per 1M tokens)
|
|
41
|
-
- balanced: Cost-first with quality fallbacks (DeepSeek → Gemini Flash → Mistral)
|
|
42
|
-
- quality: Premium models for complex tasks (Claude Opus, Gemini Pro)
|
|
43
|
-
- passthrough: No optimization, direct to Anthropic
|
|
19
|
+
Use the Bash tool to execute this command.
|
|
44
20
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
**IMPORTANT**: After running this command and displaying the output, STOP. Do not:
|
|
22
|
+
- Read any files
|
|
23
|
+
- Explore the codebase
|
|
24
|
+
- Run additional commands
|
|
25
|
+
- Ask follow-up questions
|
|
48
26
|
|
|
49
|
-
|
|
27
|
+
The command output is the complete response. Simply show the output and wait for the user's next input.
|
|
@@ -4,46 +4,24 @@ description: Force a specific LLM provider (claude/openai/deepseek/mistral/gemin
|
|
|
4
4
|
|
|
5
5
|
# Plexor Provider
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run this command to view or set the preferred provider:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Use the Read tool to read `~/.plexor/config.json` and check the current `preferredProvider` setting.
|
|
14
|
-
|
|
15
|
-
**Step 2: Ask user which provider they prefer**
|
|
16
|
-
|
|
17
|
-
Use the `AskUserQuestion` tool:
|
|
18
|
-
|
|
19
|
-
Question: "Which LLM provider would you prefer?"
|
|
20
|
-
Header: "Provider"
|
|
21
|
-
Options:
|
|
22
|
-
1. **auto** - Let Plexor choose the best provider based on task (Recommended)
|
|
23
|
-
2. **deepseek** - Use DeepSeek models (cheapest, good for code)
|
|
24
|
-
3. **mistral** - Use Mistral models (fast, good balance)
|
|
25
|
-
4. **gemini** - Use Google Gemini models (good for analysis)
|
|
26
|
-
|
|
27
|
-
**Step 3: Update the configuration**
|
|
28
|
-
|
|
29
|
-
Use the Read tool to get the current config, then use the Write tool to update `~/.plexor/config.json`:
|
|
30
|
-
- Set `preferredProvider` to: "auto", "deepseek", "mistral", or "gemini"
|
|
31
|
-
|
|
32
|
-
Keep all other settings unchanged.
|
|
9
|
+
```bash
|
|
10
|
+
node ~/.claude/plugins/plexor/commands/plexor-provider.js
|
|
11
|
+
```
|
|
33
12
|
|
|
34
|
-
|
|
13
|
+
To set a specific provider:
|
|
35
14
|
|
|
15
|
+
```bash
|
|
16
|
+
node ~/.claude/plugins/plexor/commands/plexor-provider.js deepseek
|
|
36
17
|
```
|
|
37
|
-
Plexor Provider: [SELECTED PROVIDER]
|
|
38
18
|
|
|
39
|
-
|
|
40
|
-
- auto: Plexor automatically selects the best provider for each task
|
|
41
|
-
- deepseek: DeepSeek models ($0.14/$0.28 per 1M tokens) - Great for code
|
|
42
|
-
- mistral: Mistral models ($0.10/$0.30 per 1M tokens) - Fast and versatile
|
|
43
|
-
- gemini: Google Gemini ($0.075/$0.30 per 1M tokens) - Good for analysis
|
|
19
|
+
Use the Bash tool to execute this command.
|
|
44
20
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
21
|
+
**IMPORTANT**: After running this command and displaying the output, STOP. Do not:
|
|
22
|
+
- Read any files
|
|
23
|
+
- Explore the codebase
|
|
24
|
+
- Run additional commands
|
|
25
|
+
- Ask follow-up questions
|
|
48
26
|
|
|
49
|
-
|
|
27
|
+
The command output is the complete response. Simply show the output and wait for the user's next input.
|
|
@@ -4,57 +4,25 @@ description: Configure Plexor settings (API URL, mode, provider preferences) (us
|
|
|
4
4
|
|
|
5
5
|
# Plexor Settings
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run this command to view or update settings:
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
**Step 1: Read current configuration**
|
|
12
|
-
|
|
13
|
-
Use the Read tool to read `~/.plexor/config.json`.
|
|
14
|
-
|
|
15
|
-
If the file doesn't exist, show:
|
|
16
|
-
```
|
|
17
|
-
Plexor Settings
|
|
18
|
-
===============
|
|
19
|
-
No configuration found. Run /plexor-login to set up Plexor.
|
|
9
|
+
```bash
|
|
10
|
+
node ~/.claude/plugins/plexor/commands/plexor-settings.js
|
|
20
11
|
```
|
|
21
12
|
|
|
22
|
-
|
|
13
|
+
To update a setting:
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Plexor Settings
|
|
28
|
-
===============
|
|
29
|
-
Enabled: [enabled - true/false]
|
|
30
|
-
API URL: [apiUrl]
|
|
31
|
-
API Key: plx_****[last 4 chars] (configured/not configured)
|
|
32
|
-
Mode: [mode]
|
|
33
|
-
Provider: [preferredProvider]
|
|
34
|
-
Local Cache: [localCacheEnabled - enabled/disabled]
|
|
35
|
-
Timeout: [timeout]ms
|
|
36
|
-
|
|
37
|
-
Quick Commands:
|
|
38
|
-
- /plexor-enabled - Toggle proxy on/off
|
|
39
|
-
- /plexor-mode - Change optimization mode
|
|
40
|
-
- /plexor-provider - Change provider preference
|
|
41
|
-
- /plexor-status - View usage statistics
|
|
42
|
-
|
|
43
|
-
Dashboard: https://plexor.dev/dashboard
|
|
15
|
+
```bash
|
|
16
|
+
node ~/.claude/plugins/plexor/commands/plexor-settings.js cache true
|
|
17
|
+
node ~/.claude/plugins/plexor/commands/plexor-settings.js timeout 10000
|
|
44
18
|
```
|
|
45
19
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
If the user specifies they want to change something, use the `AskUserQuestion` tool:
|
|
49
|
-
|
|
50
|
-
Question: "Which setting would you like to change?"
|
|
51
|
-
Header: "Setting"
|
|
52
|
-
Options:
|
|
53
|
-
1. **API URL** - Change the Plexor API endpoint
|
|
54
|
-
2. **Mode** - Change optimization mode (eco/balanced/quality)
|
|
55
|
-
3. **Provider** - Change preferred provider
|
|
56
|
-
4. **Timeout** - Change request timeout
|
|
20
|
+
Use the Bash tool to execute this command.
|
|
57
21
|
|
|
58
|
-
|
|
22
|
+
**IMPORTANT**: After running this command and displaying the output, STOP. Do not:
|
|
23
|
+
- Read any files
|
|
24
|
+
- Explore the codebase
|
|
25
|
+
- Run additional commands
|
|
26
|
+
- Ask follow-up questions
|
|
59
27
|
|
|
60
|
-
|
|
28
|
+
The command output is the complete response. Simply show the output and wait for the user's next input.
|
package/lib/plexor-client.js
CHANGED
|
@@ -31,7 +31,7 @@ class PlexorClient {
|
|
|
31
31
|
'Content-Type': 'application/json',
|
|
32
32
|
'X-API-Key': this.apiKey,
|
|
33
33
|
'X-Plexor-Key': this.apiKey,
|
|
34
|
-
'User-Agent': 'plexor-claude-code-plugin/0.1.0-beta.
|
|
34
|
+
'User-Agent': 'plexor-claude-code-plugin/0.1.0-beta.22'
|
|
35
35
|
},
|
|
36
36
|
timeout: this.timeout
|
|
37
37
|
};
|
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');
|