@plexor-dev/claude-code-plugin 0.1.0-beta.12 → 0.1.0-beta.14
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-login.md +17 -9
- package/hooks/intercept.js +8 -0
- package/package.json +1 -1
- package/scripts/plexor-cli.sh +41 -0
package/commands/plexor-login.md
CHANGED
|
@@ -12,7 +12,7 @@ Authenticate with your Plexor account to enable LLM cost optimization.
|
|
|
12
12
|
|
|
13
13
|
Use the Read tool to read `~/.plexor/config.json`.
|
|
14
14
|
|
|
15
|
-
If the file exists and has
|
|
15
|
+
If the file exists and has `auth.api_key` that starts with "plx_", the user is already authenticated. Show them:
|
|
16
16
|
```
|
|
17
17
|
Plexor Login
|
|
18
18
|
============
|
|
@@ -35,20 +35,28 @@ Tell them: "Please provide your Plexor API key (starts with 'plx_'):"
|
|
|
35
35
|
|
|
36
36
|
**Step 3: Save the configuration**
|
|
37
37
|
|
|
38
|
-
Once the user provides an API key, use the Write tool to create/update `~/.plexor/config.json`:
|
|
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
39
|
|
|
40
40
|
```json
|
|
41
41
|
{
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
|
|
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
|
+
}
|
|
49
55
|
}
|
|
50
56
|
```
|
|
51
57
|
|
|
58
|
+
**IMPORTANT**: If the user provided the API key as an argument (e.g., `/plexor-login plx_abc123`), use that key directly instead of asking for it.
|
|
59
|
+
|
|
52
60
|
**Step 4: Verify the key works**
|
|
53
61
|
|
|
54
62
|
Make a test request to verify authentication:
|
package/hooks/intercept.js
CHANGED
|
@@ -164,6 +164,14 @@ async function main() {
|
|
|
164
164
|
input = await readStdin();
|
|
165
165
|
request = JSON.parse(input);
|
|
166
166
|
|
|
167
|
+
// Issue #687: Auto-disable hook when ANTHROPIC_BASE_URL points to Plexor
|
|
168
|
+
// If already using Plexor as proxy, don't run local hook (avoid double-processing)
|
|
169
|
+
const baseUrl = process.env.ANTHROPIC_BASE_URL || '';
|
|
170
|
+
if (baseUrl.includes('plexor')) {
|
|
171
|
+
logger.debug('Plexor proxy detected via ANTHROPIC_BASE_URL, passing through');
|
|
172
|
+
return output(request);
|
|
173
|
+
}
|
|
174
|
+
|
|
167
175
|
// CRITICAL: Check for slash commands FIRST (before agentic check)
|
|
168
176
|
// Slash commands like /plexor-status should pass through unchanged
|
|
169
177
|
// Must check before isAgenticRequest since all Claude Code requests have tools
|
package/package.json
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Plexor CLI - Claude Code with intelligent optimization
|
|
3
|
+
|
|
4
|
+
# Only show Plexor branding if ANTHROPIC_BASE_URL points to Plexor
|
|
5
|
+
if [[ "$ANTHROPIC_BASE_URL" == *"plexor"* ]]; then
|
|
6
|
+
# Colors
|
|
7
|
+
CYAN='\033[0;36m'
|
|
8
|
+
GREEN='\033[0;32m'
|
|
9
|
+
YELLOW='\033[0;33m'
|
|
10
|
+
DIM='\033[2m'
|
|
11
|
+
NC='\033[0m' # No Color
|
|
12
|
+
|
|
13
|
+
# Plexor ASCII art
|
|
14
|
+
echo -e "${CYAN}"
|
|
15
|
+
cat << 'EOF'
|
|
16
|
+
____ __
|
|
17
|
+
/ __ \/ /__ _ ______ _____
|
|
18
|
+
/ /_/ / / _ \| |/_/ __ \/ ___/
|
|
19
|
+
/ ____/ / __/> </ /_/ / /
|
|
20
|
+
/_/ /_/\___/_/|_|\____/_/
|
|
21
|
+
|
|
22
|
+
EOF
|
|
23
|
+
echo -e "${NC}"
|
|
24
|
+
|
|
25
|
+
# Show status
|
|
26
|
+
CONFIG_FILE="$HOME/.plexor/config.json"
|
|
27
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
28
|
+
ENABLED=$(jq -r '.settings.enabled // false' "$CONFIG_FILE" 2>/dev/null)
|
|
29
|
+
MODE=$(jq -r '.settings.mode // "balanced"' "$CONFIG_FILE" 2>/dev/null)
|
|
30
|
+
|
|
31
|
+
if [ "$ENABLED" = "true" ]; then
|
|
32
|
+
echo -e "${GREEN}●${NC} Optimization: ${GREEN}Active${NC} (${MODE} mode)"
|
|
33
|
+
else
|
|
34
|
+
echo -e "${YELLOW}○${NC} Optimization: ${DIM}Disabled${NC}"
|
|
35
|
+
fi
|
|
36
|
+
echo ""
|
|
37
|
+
fi
|
|
38
|
+
fi
|
|
39
|
+
|
|
40
|
+
# Launch claude with all arguments passed through
|
|
41
|
+
exec claude "$@"
|