claude-remote-cli 0.1.1
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/README.md +110 -0
- package/bin/claude-remote-cli.js +51 -0
- package/config.example.json +11 -0
- package/package.json +50 -0
- package/public/app.js +706 -0
- package/public/index.html +134 -0
- package/public/style.css +803 -0
- package/public/vendor/addon-fit.js +2 -0
- package/public/vendor/xterm.css +218 -0
- package/public/vendor/xterm.js +2 -0
- package/server/auth.js +58 -0
- package/server/config.js +25 -0
- package/server/index.js +306 -0
- package/server/sessions.js +104 -0
- package/server/ws.js +100 -0
package/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# claude-remote-cli
|
|
2
|
+
|
|
3
|
+
Remote web interface for interacting with Claude Code CLI sessions from any device.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
### Install from npm
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g claude-remote-cli
|
|
11
|
+
claude-remote-cli
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
### Or run from source
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
git clone https://github.com/donovan-yohan/claude-remote-cli.git
|
|
18
|
+
cd claude-remote-cli
|
|
19
|
+
npm install
|
|
20
|
+
node server/index.js
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
On first launch you'll be prompted to set a PIN. Then open `http://localhost:3456` in your browser.
|
|
24
|
+
|
|
25
|
+
## Prerequisites
|
|
26
|
+
|
|
27
|
+
- **Node.js 20+**
|
|
28
|
+
- **Claude Code CLI** installed and available in your PATH (or configure `claudeCommand` in config)
|
|
29
|
+
|
|
30
|
+
## CLI Usage
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
claude-remote-cli [options]
|
|
34
|
+
|
|
35
|
+
Options:
|
|
36
|
+
--port <port> Override server port (default: 3456)
|
|
37
|
+
--host <host> Override bind address (default: 0.0.0.0)
|
|
38
|
+
--config <path> Path to config.json
|
|
39
|
+
--version, -v Show version
|
|
40
|
+
--help, -h Show this help
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Configuration
|
|
44
|
+
|
|
45
|
+
Config is stored at `~/.config/claude-remote-cli/config.json` (created on first run).
|
|
46
|
+
|
|
47
|
+
When running from source, it uses `./config.json` in the project root instead.
|
|
48
|
+
|
|
49
|
+
| Field | Default | Description |
|
|
50
|
+
|-------|---------|-------------|
|
|
51
|
+
| `host` | `0.0.0.0` | Bind address |
|
|
52
|
+
| `port` | `3456` | Server port |
|
|
53
|
+
| `cookieTTL` | `24h` | Auth cookie lifetime (e.g. `30m`, `12h`, `7d`) |
|
|
54
|
+
| `rootDirs` | `[]` | Directories containing your git repos (scanned one level deep) |
|
|
55
|
+
| `claudeCommand` | `claude` | Path to the Claude Code CLI binary |
|
|
56
|
+
| `claudeArgs` | `[]` | Extra arguments passed to every Claude session |
|
|
57
|
+
|
|
58
|
+
Root directories can also be managed from the **Settings** button in the app.
|
|
59
|
+
|
|
60
|
+
### PIN Management
|
|
61
|
+
|
|
62
|
+
The PIN hash is stored in config under `pinHash`. To reset:
|
|
63
|
+
|
|
64
|
+
1. Delete the `pinHash` field from your config file
|
|
65
|
+
2. Restart the server
|
|
66
|
+
3. You'll be prompted to set a new PIN
|
|
67
|
+
|
|
68
|
+
## Features
|
|
69
|
+
|
|
70
|
+
- **PIN-protected access** with rate limiting
|
|
71
|
+
- **Worktree isolation** — each session runs in its own Claude Code `--worktree`
|
|
72
|
+
- **Resume sessions** — click inactive worktrees to reconnect
|
|
73
|
+
- **Sidebar filters** — filter by root directory, repo, or text search
|
|
74
|
+
- **Inline rename** — rename sessions with the pencil icon (syncs with Claude Code's `/rename`)
|
|
75
|
+
- **Scrollback buffer** — reconnect to a session and see prior output
|
|
76
|
+
- **Touch toolbar** — mobile-friendly buttons for special keys (arrows, Enter, Escape, Ctrl+C, Tab, y/n)
|
|
77
|
+
- **Responsive layout** — works on desktop and mobile with slide-out sidebar
|
|
78
|
+
|
|
79
|
+
## Architecture
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
claude-remote-cli/
|
|
83
|
+
├── bin/
|
|
84
|
+
│ └── claude-remote-cli.js # CLI entry point
|
|
85
|
+
├── server/
|
|
86
|
+
│ ├── index.js # Express server, REST API routes
|
|
87
|
+
│ ├── sessions.js # PTY session manager (node-pty)
|
|
88
|
+
│ ├── ws.js # WebSocket relay (PTY ↔ browser)
|
|
89
|
+
│ ├── auth.js # PIN hashing, verification, rate limiting
|
|
90
|
+
│ └── config.js # Config loading/saving
|
|
91
|
+
├── public/
|
|
92
|
+
│ ├── index.html # Single-page app
|
|
93
|
+
│ ├── app.js # Frontend logic
|
|
94
|
+
│ ├── style.css # Styles (dark theme)
|
|
95
|
+
│ └── vendor/ # Self-hosted xterm.js + addon-fit
|
|
96
|
+
├── config.example.json
|
|
97
|
+
└── package.json
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Remote Access
|
|
101
|
+
|
|
102
|
+
To access from your phone or another device, expose the server via a tunnel or VPN:
|
|
103
|
+
|
|
104
|
+
- **Tailscale** (recommended): Install on both devices, access via Tailscale IP
|
|
105
|
+
- **Cloudflare Tunnel**: `cloudflared tunnel --url http://localhost:3456`
|
|
106
|
+
- **ngrok**: `ngrok http 3456`
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
'use strict';
|
|
3
|
+
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
// Parse CLI flags
|
|
8
|
+
const args = process.argv.slice(2);
|
|
9
|
+
|
|
10
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
11
|
+
console.log(`Usage: claude-remote-cli [options]
|
|
12
|
+
|
|
13
|
+
Options:
|
|
14
|
+
--port <port> Override server port (default: 3456)
|
|
15
|
+
--host <host> Override bind address (default: 0.0.0.0)
|
|
16
|
+
--config <path> Path to config.json (default: ~/.config/claude-remote-cli/config.json)
|
|
17
|
+
--version, -v Show version
|
|
18
|
+
--help, -h Show this help`);
|
|
19
|
+
process.exit(0);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (args.includes('--version') || args.includes('-v')) {
|
|
23
|
+
const pkg = require('../package.json');
|
|
24
|
+
console.log(pkg.version);
|
|
25
|
+
process.exit(0);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function getArg(flag) {
|
|
29
|
+
const idx = args.indexOf(flag);
|
|
30
|
+
if (idx === -1 || idx + 1 >= args.length) return undefined;
|
|
31
|
+
return args[idx + 1];
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// Determine config directory
|
|
35
|
+
const configDir = getArg('--config')
|
|
36
|
+
? path.dirname(getArg('--config'))
|
|
37
|
+
: path.join(process.env.HOME || process.env.USERPROFILE || '~', '.config', 'claude-remote-cli');
|
|
38
|
+
|
|
39
|
+
const configPath = getArg('--config') || path.join(configDir, 'config.json');
|
|
40
|
+
|
|
41
|
+
// Ensure config directory exists
|
|
42
|
+
if (!fs.existsSync(configDir)) {
|
|
43
|
+
fs.mkdirSync(configDir, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Pass config path and CLI overrides to the server
|
|
47
|
+
process.env.CLAUDE_REMOTE_CONFIG = configPath;
|
|
48
|
+
if (getArg('--port')) process.env.CLAUDE_REMOTE_PORT = getArg('--port');
|
|
49
|
+
if (getArg('--host')) process.env.CLAUDE_REMOTE_HOST = getArg('--host');
|
|
50
|
+
|
|
51
|
+
require('../server/index.js');
|
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-remote-cli",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Remote web interface for Claude Code CLI sessions",
|
|
5
|
+
"main": "server/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"claude-remote-cli": "bin/claude-remote-cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"bin/",
|
|
11
|
+
"server/",
|
|
12
|
+
"public/",
|
|
13
|
+
"config.example.json"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"start": "node server/index.js",
|
|
17
|
+
"test": "node --test test/*.test.js",
|
|
18
|
+
"postinstall": "chmod +x node_modules/node-pty/prebuilds/darwin-arm64/spawn-helper 2>/dev/null || true"
|
|
19
|
+
},
|
|
20
|
+
"engines": {
|
|
21
|
+
"node": ">=20.0.0"
|
|
22
|
+
},
|
|
23
|
+
"keywords": [
|
|
24
|
+
"claude",
|
|
25
|
+
"claude-code",
|
|
26
|
+
"remote",
|
|
27
|
+
"cli",
|
|
28
|
+
"terminal",
|
|
29
|
+
"mobile",
|
|
30
|
+
"web",
|
|
31
|
+
"pty"
|
|
32
|
+
],
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "git+https://github.com/donovan-yohan/claude-remote-cli.git"
|
|
36
|
+
},
|
|
37
|
+
"license": "MIT",
|
|
38
|
+
"author": "Donovan Yohan",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"bcrypt": "^5.1.1",
|
|
41
|
+
"cookie-parser": "^1.4.7",
|
|
42
|
+
"express": "^4.21.0",
|
|
43
|
+
"node-pty": "^1.0.0",
|
|
44
|
+
"ws": "^8.18.0"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@playwright/test": "^1.58.2",
|
|
48
|
+
"playwright": "^1.58.2"
|
|
49
|
+
}
|
|
50
|
+
}
|