claude-code-remote-pilot 0.1.3 → 0.1.5
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/bin/claude-pilot.js +50 -5
- package/claude-pilot.sh +3 -2
- package/package.json +1 -1
package/bin/claude-pilot.js
CHANGED
|
@@ -78,10 +78,38 @@ async function setupTelegram() {
|
|
|
78
78
|
console.log('Telegram configured for this session.\n');
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
+
function printGuide() {
|
|
82
|
+
const session = process.env.CLAUDE_SESSION;
|
|
83
|
+
const workdir = process.env.CLAUDE_WORKDIR;
|
|
84
|
+
console.log(`
|
|
85
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
86
|
+
Claude Code Remote Pilot — Ready
|
|
87
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
88
|
+
|
|
89
|
+
Session : ${session}
|
|
90
|
+
Dir : ${workdir}
|
|
91
|
+
|
|
92
|
+
To talk to Claude:
|
|
93
|
+
tmux attach -t ${session}
|
|
94
|
+
|
|
95
|
+
To detach without stopping Claude:
|
|
96
|
+
Press Ctrl+B then D
|
|
97
|
+
|
|
98
|
+
The pilot will:
|
|
99
|
+
• detect usage/rate limits
|
|
100
|
+
• wait for the reset
|
|
101
|
+
• send "continue" automatically
|
|
102
|
+
• notify you via Telegram (if configured)
|
|
103
|
+
|
|
104
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
105
|
+
`);
|
|
106
|
+
}
|
|
107
|
+
|
|
81
108
|
async function main() {
|
|
82
109
|
await ensureDep('tmux', 'tmux', tmuxInstallCmd());
|
|
83
110
|
await ensureDep('claude', 'Claude Code CLI', 'npm install -g @anthropic-ai/claude-code');
|
|
84
111
|
await setupTelegram();
|
|
112
|
+
printGuide();
|
|
85
113
|
|
|
86
114
|
const child = spawn('bash', [scriptPath], {
|
|
87
115
|
stdio: 'inherit',
|
|
@@ -98,21 +126,38 @@ if (process.argv.includes('--help') || process.argv.includes('-h')) {
|
|
|
98
126
|
Claude Code Remote Pilot
|
|
99
127
|
|
|
100
128
|
Usage:
|
|
101
|
-
claude-remote-pilot
|
|
129
|
+
claude-remote-pilot [--session <name>]
|
|
130
|
+
|
|
131
|
+
Options:
|
|
132
|
+
--session <name> Name for this Claude session (defaults to current directory name)
|
|
102
133
|
|
|
103
134
|
Environment variables:
|
|
104
135
|
TELEGRAM_BOT_TOKEN
|
|
105
136
|
TELEGRAM_CHAT_ID
|
|
106
|
-
CLAUDE_SESSION
|
|
107
137
|
CLAUDE_COMMAND
|
|
108
138
|
|
|
109
139
|
Example:
|
|
110
|
-
|
|
140
|
+
claude-remote-pilot --session my-project
|
|
141
|
+
TELEGRAM_BOT_TOKEN=xxx TELEGRAM_CHAT_ID=123456 claude-remote-pilot --session api
|
|
111
142
|
|
|
112
|
-
Attach to
|
|
113
|
-
tmux attach -t
|
|
143
|
+
Attach to session:
|
|
144
|
+
tmux attach -t <name>
|
|
114
145
|
`);
|
|
115
146
|
process.exit(0);
|
|
116
147
|
}
|
|
117
148
|
|
|
149
|
+
// Parse --session flag, fall back to current directory name
|
|
150
|
+
const sessionFlagIndex = process.argv.indexOf('--session');
|
|
151
|
+
const sessionName = sessionFlagIndex !== -1
|
|
152
|
+
? process.argv[sessionFlagIndex + 1]
|
|
153
|
+
: path.basename(process.cwd());
|
|
154
|
+
|
|
155
|
+
if (!sessionName || sessionName.startsWith('--')) {
|
|
156
|
+
console.error('Error: --session requires a name, e.g. --session my-project');
|
|
157
|
+
process.exit(1);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
process.env.CLAUDE_SESSION = sessionName;
|
|
161
|
+
process.env.CLAUDE_WORKDIR = process.cwd();
|
|
162
|
+
|
|
118
163
|
main();
|
package/claude-pilot.sh
CHANGED
|
@@ -23,6 +23,7 @@ set -u
|
|
|
23
23
|
|
|
24
24
|
CLAUDE_SESSION="${CLAUDE_SESSION:-claude}"
|
|
25
25
|
CLAUDE_COMMAND="${CLAUDE_COMMAND:-claude}"
|
|
26
|
+
CLAUDE_WORKDIR="${CLAUDE_WORKDIR:-$PWD}"
|
|
26
27
|
CHECK_INTERVAL_SECONDS="${CHECK_INTERVAL_SECONDS:-30}"
|
|
27
28
|
LIMIT_FALLBACK_WAIT_SECONDS="${LIMIT_FALLBACK_WAIT_SECONDS:-300}"
|
|
28
29
|
POST_RESUME_COOLDOWN_SECONDS="${POST_RESUME_COOLDOWN_SECONDS:-180}"
|
|
@@ -146,8 +147,8 @@ ensure_tmux_session() {
|
|
|
146
147
|
exit 1
|
|
147
148
|
fi
|
|
148
149
|
|
|
149
|
-
tmux new-session -d -s "$CLAUDE_SESSION" "$CLAUDE_COMMAND"
|
|
150
|
-
log "Started tmux session '$CLAUDE_SESSION'
|
|
150
|
+
tmux new-session -d -s "$CLAUDE_SESSION" -c "$CLAUDE_WORKDIR" "$CLAUDE_COMMAND"
|
|
151
|
+
log "Started tmux session '$CLAUDE_SESSION' in $CLAUDE_WORKDIR"
|
|
151
152
|
send_telegram "Claude Pilot: started tmux session '$CLAUDE_SESSION'."
|
|
152
153
|
}
|
|
153
154
|
|
package/package.json
CHANGED