claude-code-remote-pilot 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.
Files changed (2) hide show
  1. package/bin/claude-pilot.js +74 -22
  2. package/package.json +1 -1
@@ -11,27 +11,86 @@ if (!fs.existsSync(scriptPath)) {
11
11
  process.exit(1);
12
12
  }
13
13
 
14
+ const readline = require('readline');
15
+
14
16
  function checkDep(cmd) {
15
17
  try { execSync(`command -v ${cmd}`, { stdio: 'ignore' }); return true; }
16
18
  catch { return false; }
17
19
  }
18
20
 
19
- if (!checkDep('tmux')) {
20
- console.error('\nError: tmux is not installed.\n');
21
- console.error('Install it with:\n');
22
- console.error(' macOS: brew install tmux');
23
- console.error(' Ubuntu/Debian: sudo apt install tmux');
24
- console.error(' Fedora/RHEL: sudo dnf install tmux');
25
- console.error(' Arch: sudo pacman -S tmux');
26
- console.error(' WSL: sudo apt install tmux\n');
27
- process.exit(1);
21
+ function detectPlatform() {
22
+ const platform = process.platform;
23
+ if (platform === 'darwin') return 'macos';
24
+ if (platform === 'win32') return 'windows';
25
+ try {
26
+ const release = fs.readFileSync('/etc/os-release', 'utf8');
27
+ if (/ID=arch/i.test(release)) return 'arch';
28
+ if (/ID=(fedora|rhel|centos)/i.test(release)) return 'fedora';
29
+ } catch {}
30
+ return 'debian';
28
31
  }
29
32
 
30
- if (!checkDep('claude')) {
31
- console.error('\nError: Claude Code CLI is not installed.\n');
32
- console.error('Install it with:\n');
33
- console.error(' npm install -g @anthropic-ai/claude-code\n');
34
- process.exit(1);
33
+ function tmuxInstallCmd() {
34
+ const p = detectPlatform();
35
+ if (p === 'macos') return 'brew install tmux';
36
+ if (p === 'arch') return 'sudo pacman -S --noconfirm tmux';
37
+ if (p === 'fedora') return 'sudo dnf install -y tmux';
38
+ return 'sudo apt-get install -y tmux';
39
+ }
40
+
41
+ function prompt(question) {
42
+ return new Promise((resolve) => {
43
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
44
+ rl.question(question, (answer) => { rl.close(); resolve(answer.trim().toLowerCase()); });
45
+ });
46
+ }
47
+
48
+ async function ensureDep(cmd, label, installCmd) {
49
+ if (checkDep(cmd)) return;
50
+ console.log(`\n${label} is not installed.`);
51
+ const answer = await prompt(`Install it now? (y/n) `);
52
+ if (answer !== 'y' && answer !== 'yes') {
53
+ console.log(`Skipping. Run manually: ${installCmd}`);
54
+ process.exit(1);
55
+ }
56
+ console.log(`Running: ${installCmd}\n`);
57
+ try {
58
+ execSync(installCmd, { stdio: 'inherit' });
59
+ console.log(`\n${label} installed successfully.\n`);
60
+ } catch {
61
+ console.error(`\nInstall failed. Try running manually: ${installCmd}`);
62
+ process.exit(1);
63
+ }
64
+ }
65
+
66
+ async function setupTelegram() {
67
+ if (process.env.TELEGRAM_BOT_TOKEN && process.env.TELEGRAM_CHAT_ID) return;
68
+ console.log('\nTelegram notifications are not configured (optional).');
69
+ const answer = await prompt('Set up Telegram now? (y/n) ');
70
+ if (answer !== 'y' && answer !== 'yes') {
71
+ console.log('Skipping. You can set TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID later.\n');
72
+ return;
73
+ }
74
+ const token = await prompt('Enter your Telegram bot token: ');
75
+ const chatId = await prompt('Enter your Telegram chat ID: ');
76
+ if (token) process.env.TELEGRAM_BOT_TOKEN = token.trim();
77
+ if (chatId) process.env.TELEGRAM_CHAT_ID = chatId.trim();
78
+ console.log('Telegram configured for this session.\n');
79
+ }
80
+
81
+ async function main() {
82
+ await ensureDep('tmux', 'tmux', tmuxInstallCmd());
83
+ await ensureDep('claude', 'Claude Code CLI', 'npm install -g @anthropic-ai/claude-code');
84
+ await setupTelegram();
85
+
86
+ const child = spawn('bash', [scriptPath], {
87
+ stdio: 'inherit',
88
+ env: process.env,
89
+ });
90
+
91
+ child.on('exit', (code) => {
92
+ process.exit(code || 0);
93
+ });
35
94
  }
36
95
 
37
96
  if (process.argv.includes('--help') || process.argv.includes('-h')) {
@@ -56,11 +115,4 @@ Attach to tmux:
56
115
  process.exit(0);
57
116
  }
58
117
 
59
- const child = spawn('bash', [scriptPath], {
60
- stdio: 'inherit',
61
- env: process.env,
62
- });
63
-
64
- child.on('exit', (code) => {
65
- process.exit(code || 0);
66
- });
118
+ main();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-code-remote-pilot",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Interactive Claude Code supervisor with tmux, Telegram notifications, and auto-resume after usage limits.",
5
5
  "type": "commonjs",
6
6
  "bin": {