claude-pool 0.1.1 → 0.1.3
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/.claude/commands/limits.md +5 -0
- package/.claude/commands/pool-limits.md +5 -0
- package/.claude/commands/pool-switch.md +6 -0
- package/.claude/commands/pool.md +5 -0
- package/.claude/commands/switch.md +6 -0
- package/bin/cli.js +4 -1
- package/package.json +1 -1
- package/src/runner.js +4 -0
- package/src/setup.js +15 -3
package/bin/cli.js
CHANGED
|
@@ -4,7 +4,7 @@ import { ConfigManager } from '../src/config.js';
|
|
|
4
4
|
import { MetricsEngine } from '../src/metrics.js';
|
|
5
5
|
import { QuotaEngine } from '../src/quota.js';
|
|
6
6
|
import { ProcessRunner } from '../src/runner.js';
|
|
7
|
-
import { runSetupWizard, checkAuthStatus, runAccountLogin } from '../src/setup.js';
|
|
7
|
+
import { runSetupWizard, checkAuthStatus, runAccountLogin, ensureAllSlashCommands } from '../src/setup.js';
|
|
8
8
|
import { colors, formatTokenCount, makePill, makeGauge, printTable } from '../src/ui.js';
|
|
9
9
|
|
|
10
10
|
const KNOWN_COMMANDS = new Set([
|
|
@@ -35,6 +35,9 @@ const firstArg = args[0];
|
|
|
35
35
|
const cfg = new ConfigManager();
|
|
36
36
|
|
|
37
37
|
async function handleCommand() {
|
|
38
|
+
const accounts = cfg.loadAccounts();
|
|
39
|
+
ensureAllSlashCommands(accounts);
|
|
40
|
+
|
|
38
41
|
if (!firstArg || (!firstArg.startsWith('-') && !KNOWN_COMMANDS.has(firstArg))) {
|
|
39
42
|
// Default: run interactive session with failover
|
|
40
43
|
const runner = new ProcessRunner(cfg);
|
package/package.json
CHANGED
package/src/runner.js
CHANGED
|
@@ -4,6 +4,7 @@ import os from 'os';
|
|
|
4
4
|
import { SessionSyncEngine } from './sessionSync.js';
|
|
5
5
|
import { MetricsEngine } from './metrics.js';
|
|
6
6
|
import { QuotaEngine } from './quota.js';
|
|
7
|
+
import { ensureAllSlashCommands } from './setup.js';
|
|
7
8
|
import { renderSessionHeader, renderFailoverBanner, colors } from './ui.js';
|
|
8
9
|
|
|
9
10
|
export class ProcessRunner {
|
|
@@ -59,6 +60,9 @@ export class ProcessRunner {
|
|
|
59
60
|
return;
|
|
60
61
|
}
|
|
61
62
|
|
|
63
|
+
// Automatically ensure /limits, /pool, /switch are installed across all accounts and project
|
|
64
|
+
ensureAllSlashCommands(accounts);
|
|
65
|
+
|
|
62
66
|
let resumeSessionId = null;
|
|
63
67
|
for (let i = 0; i < extraArgs.length; i++) {
|
|
64
68
|
if ((extraArgs[i] === '-r' || extraArgs[i] === '--resume') && i + 1 < extraArgs.length) {
|
package/src/setup.js
CHANGED
|
@@ -64,19 +64,19 @@ export function installSlashCommands(configDir) {
|
|
|
64
64
|
// /pool
|
|
65
65
|
fs.writeFileSync(
|
|
66
66
|
path.join(cmdDir, 'pool.md'),
|
|
67
|
-
'---\ndescription: View Claude Pool token dashboard and status\n---\
|
|
67
|
+
'---\ndescription: View Claude Pool token dashboard and status\n---\nHere is the live Claude Pool token dashboard:\n!`claude-pool dashboard`\n',
|
|
68
68
|
'utf8'
|
|
69
69
|
);
|
|
70
70
|
// /limits
|
|
71
71
|
fs.writeFileSync(
|
|
72
72
|
path.join(cmdDir, 'limits.md'),
|
|
73
|
-
'---\ndescription: View remaining session and weekly quotas across all accounts in the pool\n---\
|
|
73
|
+
'---\ndescription: View remaining session and weekly quotas across all accounts in the pool\n---\nHere are the live Claude Pool quota metrics and limits:\n!`claude-pool limits`\n',
|
|
74
74
|
'utf8'
|
|
75
75
|
);
|
|
76
76
|
// /switch
|
|
77
77
|
fs.writeFileSync(
|
|
78
78
|
path.join(cmdDir, 'switch.md'),
|
|
79
|
-
'---\ndescription: Switch active Claude account in the pool\n---\
|
|
79
|
+
'---\ndescription: Switch active Claude account in the pool\n---\n!`claude-pool switch $ARGUMENTS`\n\nIf the switch was successful, inform the user their active session was synchronized and they can run `/exit` to restart immediately on the newly active account.\n',
|
|
80
80
|
'utf8'
|
|
81
81
|
);
|
|
82
82
|
// Also include /pool-limits and /pool-switch aliases
|
|
@@ -85,6 +85,18 @@ export function installSlashCommands(configDir) {
|
|
|
85
85
|
} catch {}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
export function ensureAllSlashCommands(accounts = []) {
|
|
89
|
+
try {
|
|
90
|
+
installSlashCommands(path.join(os.homedir(), '.claude'));
|
|
91
|
+
for (const a of accounts) {
|
|
92
|
+
if (a && a.configDir) installSlashCommands(a.configDir);
|
|
93
|
+
}
|
|
94
|
+
// Also install to current working directory .claude if it exists or in project
|
|
95
|
+
const localClaudeDir = path.join(process.cwd(), '.claude');
|
|
96
|
+
installSlashCommands(localClaudeDir);
|
|
97
|
+
} catch {}
|
|
98
|
+
}
|
|
99
|
+
|
|
88
100
|
export async function runSetupWizard() {
|
|
89
101
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
90
102
|
|