ghostterm 1.1.1 β†’ 1.1.2

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 (3) hide show
  1. package/README.md +196 -65
  2. package/bin/ghostterm.js +12 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,39 +1,34 @@
1
- # GhostTerm πŸ‘»
2
-
3
- **A mobile terminal for Claude Code fans.** Control your PC from your phone β€” real CLI, not a toy.
4
-
5
- > *GhostTerm is not affiliated with Anthropic. Just a fan who couldn't stop using Claude Code.*
6
-
7
- ---
8
-
9
- ## Screenshots
10
-
11
1
  <p align="center">
12
2
  <img src="https://ghostterm.pages.dev/img/banner.png" width="500" alt="GhostTerm Banner">
13
3
  </p>
14
4
 
5
+ <h1 align="center">GhostTerm</h1>
15
6
  <p align="center">
16
- <img src="https://ghostterm.pages.dev/img/office-busy.jpg" width="220" alt="Ghosts working">
17
- <img src="https://ghostterm.pages.dev/img/pixel-office.jpg" width="220" alt="Pixel office overview">
18
- <img src="https://ghostterm.pages.dev/img/claude-code.jpg" width="220" alt="Claude Code on phone">
7
+ <strong>A mobile terminal for Claude Code fans.</strong><br>
8
+ Control your PC from your phone β€” real CLI, not a toy.
19
9
  </p>
20
-
21
10
  <p align="center">
22
- <em>Halloween-themed pixel office Β· 4 animated ghost terminals Β· Claude Code on your phone</em>
11
+ <a href="https://www.npmjs.com/package/ghostterm"><img src="https://img.shields.io/npm/v/ghostterm.svg" alt="npm version"></a>
12
+ <a href="https://www.npmjs.com/package/ghostterm"><img src="https://img.shields.io/npm/dm/ghostterm.svg" alt="npm downloads"></a>
13
+ <img src="https://img.shields.io/node/v/ghostterm" alt="node version">
14
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="license">
23
15
  </p>
24
16
 
17
+ > *GhostTerm is not affiliated with Anthropic. Just a fan who couldn't stop using Claude Code.*
18
+
25
19
  ---
26
20
 
27
- ## Why GhostTerm?
21
+ ## What is GhostTerm?
22
+
23
+ GhostTerm lets you **control your PC terminal from your phone** over the internet. It's built specifically for [Claude Code](https://docs.anthropic.com/en/docs/claude-code) users who want to:
28
24
 
29
- You're running Claude Code on your PC. You walk away. Now what?
25
+ - Run `claude --dangerously-skip-permissions` and monitor everything from their phone
26
+ - Approve/deny tool calls from anywhere (bus, bed, coffee shop)
27
+ - Manage 4 terminal sessions simultaneously
30
28
 
31
- - **Run `--dangerously-skip-permissions`** β€” let Claude go full auto, monitor from your phone while it codes for you
32
- - **4 terminal sessions at once** β€” more than Anthropic's official app
33
- - **Real xterm.js terminal** β€” full ANSI colors, scrollback, not a dumbed-down GUI
34
- - **Built-in shortcut keys** β€” `y` / `n` for approvals, `Tab`, `Ctrl+C`, arrow keys, all one-tap
35
- - **`claude` quick-launch button** β€” start new sessions, resume, or continue with one tap
36
- - **Pixel office mode** β€” see all 4 terminals as cute ghost desks
29
+ No VPN. No Tailscale. No port forwarding. Just one command.
30
+
31
+ ---
37
32
 
38
33
  ## Quick Start
39
34
 
@@ -47,13 +42,83 @@ First run opens a browser for Google sign-in. After that, it remembers you.
47
42
 
48
43
  ### 2. On your phone
49
44
 
50
- Open **[ghostterm.pages.dev](https://ghostterm.pages.dev)** β€” sign in with the same Google account.
45
+ Open **[ghostterm.pages.dev](https://ghostterm.pages.dev)** in any mobile browser. Sign in with the same Google account.
46
+
47
+ **That's it.** Your terminal appears on your phone.
48
+
49
+ ---
50
+
51
+ ## Screenshots
52
+
53
+ <p align="center">
54
+ <img src="https://ghostterm.pages.dev/img/office-busy.jpg" width="220" alt="Ghosts working">
55
+ <img src="https://ghostterm.pages.dev/img/pixel-office.jpg" width="220" alt="Pixel office">
56
+ <img src="https://ghostterm.pages.dev/img/claude-code.jpg" width="220" alt="Claude Code on phone">
57
+ </p>
58
+ <p align="center">
59
+ <em>Pixel ghost office Β· 4 terminal sessions Β· Claude Code on your phone</em>
60
+ </p>
61
+
62
+ ---
63
+
64
+ ## Features
65
+
66
+ ### Terminal
67
+
68
+ - **Real xterm.js terminal** β€” full ANSI colors, 256-color, scrollback buffer
69
+ - **4 simultaneous sessions** β€” more than Anthropic's official mobile app
70
+ - **Auto-resize** β€” terminal adapts to your phone's screen size
71
+ - **Scrollback history** β€” scroll up to see previous output, page up/down buttons
72
+
73
+ ### Controls
74
+
75
+ - **Quick keys** β€” one-tap `y`/`n` for Claude Code approvals
76
+ - **D-pad** β€” arrow keys, Enter, Tab, Shift+Tab
77
+ - **`claude` button** β€” quick-launch menu: new session, resume, continue, dangerous mode
78
+ - **Ctrl+C** β€” interrupt running processes
79
+ - **Text input** β€” full keyboard input with Send button
80
+ - **Copy mode** β€” select and copy terminal text
81
+
82
+ ### File Transfer
83
+
84
+ - **Screenshot** β€” capture your phone screen and send it to your PC terminal
85
+ - **File upload** β€” upload files directly from your phone to your desktop
86
+
87
+ ### Visual
88
+
89
+ - **Pixel office mode** β€” see all 4 terminals as cute ghost desks in a Halloween-themed pixel office
90
+ - **Ghost cell previews** β€” live miniature terminal previews in the header
91
+ - **Dark theme** β€” easy on the eyes, matches terminal aesthetics
92
+
93
+ ### Connection
94
+
95
+ - **Google auto-pairing** β€” sign in once, auto-reconnects forever
96
+ - **Encrypted relay** β€” all traffic over WSS (WebSocket Secure)
97
+ - **Zero data stored** β€” the relay only forwards messages
98
+ - **Auto-reconnect** β€” handles network drops gracefully
99
+
100
+ ---
101
+
102
+ ## How It Works
103
+
104
+ ```
105
+ Phone (browser) ──WSS──> Relay (Fly.io Tokyo) <──WSS── PC (ghostterm)
106
+ encrypted WebSocket
107
+ auto-pairs by Google account
108
+ zero data stored
109
+ ```
110
+
111
+ 1. `npx ghostterm` starts a companion process on your PC that connects to the relay server
112
+ 2. The companion spawns a real PTY (pseudo-terminal) using `node-pty`
113
+ 3. Your phone connects to the same relay via WebSocket
114
+ 4. The relay matches both sides by Google account and forwards messages
115
+ 5. Terminal output streams to your phone; your input streams to the PTY
51
116
 
52
- That's it. Your terminal appears on your phone. No VPN. No Tailscale. No port forwarding.
117
+ ---
53
118
 
54
119
  ## Use Cases
55
120
 
56
- ### πŸ”₯ The "Dangerous" Workflow
121
+ ### The "Dangerous" Workflow
57
122
 
58
123
  ```bash
59
124
  claude --dangerously-skip-permissions
@@ -61,75 +126,141 @@ claude --dangerously-skip-permissions
61
126
 
62
127
  Let Claude Code run fully autonomous on your PC. Monitor everything from your phone. Intervene when needed. Go make coffee.
63
128
 
64
- ### πŸ–₯️ Multi-Session Power
129
+ ### Multi-Session Power
65
130
 
66
131
  4 ghost cells = 4 terminals. Run Claude Code in one, `git log` in another, `npm test` in a third. Switch between them with a tap.
67
132
 
68
- ### πŸ“± On-the-Go Approval
133
+ ### On-the-Go Approval
69
134
 
70
135
  Claude Code asking "May I edit server.js?" β€” tap `y` from the bus. No need to rush back to your desk.
71
136
 
72
- ### πŸ“Έ Screenshot & Upload
137
+ ---
73
138
 
74
- Take a screenshot of your phone screen and send it to your PC terminal. Upload files directly from your phone to your desktop.
139
+ ## System Requirements
75
140
 
76
- ## Features
141
+ ### PC (Companion)
77
142
 
78
- | Feature | GhostTerm | Anthropic Mobile |
79
- |---|---|---|
80
- | Real CLI terminal | βœ… | ❌ |
81
- | Simultaneous sessions | 4 | 1 |
82
- | `--dangerously-skip-permissions` | βœ… monitor from phone | ❌ |
83
- | Custom shortcut keys | βœ… y/n/Tab/Ctrl+C | ❌ |
84
- | Pixel office view | βœ… | ❌ |
85
- | File upload to PC | βœ… | ❌ |
86
- | No VPN needed | βœ… | N/A |
87
- | Google auto-pairing | βœ… | - |
143
+ - **Node.js** 18 or later
144
+ - **Operating System**: Windows, macOS, or Linux
145
+ - **Platform-specific build tools** (for `node-pty`):
146
+ - **Windows**: Visual Studio Build Tools or `npm install -g windows-build-tools`
147
+ - **macOS**: `xcode-select --install`
148
+ - **Linux**: `apt install build-essential` (Debian/Ubuntu) or equivalent
149
+ - **Google account** for pairing
150
+
151
+ ### Phone (Client)
152
+
153
+ - Any modern browser (iOS Safari 15+, Chrome, Firefox, Edge)
154
+ - Internet connection
155
+
156
+ ---
88
157
 
89
- ## Controls
158
+ ## Configuration
90
159
 
91
- **Top bar**: 4 ghost cells (tap to switch terminals, `+` to create new) Β· `🏠` pixel office view Β· `A` font size Β· `β–Ό` hide controls
160
+ ### Environment Variables
92
161
 
93
- **Quick keys**: `y` / `n` (approve/deny) Β· `S+Tab` (shift-tab) Β· `/ cmd` (slash commands) Β· `Tab` Β· `←Bksp`
162
+ | Variable | Default | Description |
163
+ |---|---|---|
164
+ | `GHOSTTERM_RELAY` | `wss://ghostterm-relay.fly.dev` | Custom relay server URL |
94
165
 
95
- **Left column**: `⏻ claude` (launch menu: new / resume / continue / dangerous mode) · `Stop` (Ctrl+C) · `Close` (kill session)
166
+ ### Custom Relay
96
167
 
97
- **Center**: D-pad (↑↓←→) + `Enter`
168
+ If you want to self-host the relay:
98
169
 
99
- **Right column**: `Line↡` (newline) Β· `⬇` (scroll to bottom) Β· `Space` Β· `β–²β–Ό` (page up/down) Β· `Copy` (select mode)
170
+ ```bash
171
+ GHOSTTERM_RELAY=wss://your-relay.example.com npx ghostterm
172
+ ```
100
173
 
101
- **Bottom**: Text input + `Send` Β· `πŸ“· Shot` (screenshot to PC) Β· `πŸ“ File` (upload to PC)
174
+ ---
102
175
 
103
176
  ## Pricing
104
177
 
105
- - **Free**: 1 hour/day, full features
178
+ - **Free**: 1 hour/day, all features included
106
179
  - **Pro**: $5/month or $12/quarter β€” unlimited access
107
180
 
108
- ## How It Works
181
+ ---
182
+
183
+ ## Troubleshooting
184
+
185
+ ### "Failed to install node-pty" / build errors
186
+
187
+ `node-pty` requires native compilation. Make sure you have build tools installed:
188
+
189
+ ```bash
190
+ # Windows (run as Administrator)
191
+ npm install -g windows-build-tools
109
192
 
193
+ # macOS
194
+ xcode-select --install
195
+
196
+ # Linux (Debian/Ubuntu)
197
+ sudo apt install build-essential python3
110
198
  ```
111
- Phone (browser) ──WSS──▢ Relay (Fly.io Tokyo) ◀──WSS── PC (ghostterm)
112
- encrypted WebSocket
113
- auto-pairs by Google account
114
- zero data stored
199
+
200
+ ### "Google sign-in window doesn't open"
201
+
202
+ - Make sure your default browser isn't blocking pop-ups
203
+ - Try running `npx ghostterm` again β€” it retries automatically
204
+ - If behind a corporate proxy, ensure `accounts.google.com` is accessible
205
+
206
+ ### "Phone can't connect" / "Waiting for companion..."
207
+
208
+ - Ensure the PC companion is still running (`npx ghostterm`)
209
+ - Both devices must use the **same Google account**
210
+ - Check your phone's internet connection
211
+ - Try refreshing the page on your phone
212
+
213
+ ### "Terminal shows garbled text"
214
+
215
+ - Make sure your phone browser supports modern CSS/JS
216
+ - Try switching to a different terminal session (tap a ghost cell)
217
+ - Clear browser cache and reload
218
+
219
+ ### "Session keeps disconnecting"
220
+
221
+ - Check your network stability on both PC and phone
222
+ - The relay auto-reconnects with exponential backoff
223
+ - If using a VPN, try disabling it (GhostTerm doesn't need one)
224
+
225
+ ### node-pty on Apple Silicon (M1/M2/M3)
226
+
227
+ If you see architecture mismatch errors:
228
+
229
+ ```bash
230
+ # Force rebuild for current architecture
231
+ npm rebuild node-pty
115
232
  ```
116
233
 
117
- All traffic is encrypted (WSS). The relay only forwards messages β€” no terminal data is stored.
234
+ ---
235
+
236
+ ## Uninstall
237
+
238
+ GhostTerm stores a refresh token in `~/.ghostterm/` for auto-login. To fully remove:
118
239
 
119
- ## Requirements
240
+ ```bash
241
+ rm -rf ~/.ghostterm
242
+ ```
120
243
 
121
- - **PC**: Node.js 18+
122
- - Windows: may need `npm install -g windows-build-tools`
123
- - macOS: `xcode-select --install`
124
- - Linux: `apt install build-essential`
125
- - **Phone**: Any modern browser (iOS Safari, Chrome, etc.)
244
+ ---
126
245
 
127
- ## Environment Variables
246
+ ## Security
128
247
 
129
- | Variable | Default | Description |
130
- |---|---|---|
131
- | `GHOSTTERM_RELAY` | `wss://ghostterm-relay.fly.dev` | Custom relay server URL |
248
+ - All communication is encrypted via WSS (WebSocket Secure)
249
+ - Google OAuth 2.0 for authentication β€” GhostTerm never sees your Google password
250
+ - The relay server is stateless β€” no terminal data is stored
251
+ - Pair codes expire after 5 minutes
252
+ - Brute-force protection on pair code entry
253
+ - Rate limiting on all WebSocket connections
254
+ - Connection limits per IP address
255
+
256
+ ---
132
257
 
133
258
  ## License
134
259
 
135
260
  MIT
261
+
262
+ ---
263
+
264
+ <p align="center">
265
+ Built with frustration and love by a Claude Code addict.
266
+ </p>
package/bin/ghostterm.js CHANGED
@@ -409,8 +409,19 @@ function handleRelayMessage(msg) {
409
409
 
410
410
  case 'upload':
411
411
  try {
412
+ const UPLOAD_MAX_SIZE = 5 * 1024 * 1024; // 5MB
413
+ const UPLOAD_EXT_WHITELIST = ['.png', '.jpg', '.jpeg', '.pdf', '.txt', '.md', '.json', '.csv', '.py', '.js', '.ts', '.html', '.css'];
414
+ const ext = (msg.ext || '.png').toLowerCase();
415
+ if (!UPLOAD_EXT_WHITELIST.includes(ext)) {
416
+ sendToRelay({ type: 'upload_error', message: `File type not allowed: ${ext}` });
417
+ break;
418
+ }
412
419
  const buf = Buffer.from(msg.data, 'base64');
413
- const filename = `${Date.now()}-${Math.random().toString(36).slice(2, 6)}${msg.ext || '.png'}`;
420
+ if (buf.length > UPLOAD_MAX_SIZE) {
421
+ sendToRelay({ type: 'upload_error', message: `File too large: ${(buf.length / 1024 / 1024).toFixed(1)}MB (max 5MB)` });
422
+ break;
423
+ }
424
+ const filename = `${Date.now()}-${Math.random().toString(36).slice(2, 6)}${ext}`;
414
425
  const filePath = path.join(UPLOAD_DIR, filename);
415
426
  fs.writeFileSync(filePath, buf);
416
427
  sendToRelay({ type: 'upload_result', path: filePath, filename, size: buf.length });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ghostterm",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Mobile terminal for Claude Code β€” control your PC from your phone",
5
5
  "bin": {
6
6
  "ghostterm": "bin/ghostterm.js"