minivibe 0.1.1 → 0.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.
- package/GETTING_STARTED.md +241 -0
- package/README.md +104 -71
- package/package.json +4 -2
- package/vibe.js +41 -15
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# Getting Started with MiniVibe CLI
|
|
2
|
+
|
|
3
|
+
This guide walks you through setting up MiniVibe CLI to control Claude Code from your iOS device.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
Before you begin, ensure you have:
|
|
8
|
+
|
|
9
|
+
1. **Node.js 18+** installed
|
|
10
|
+
2. **Claude Code CLI** installed and working (`claude --version`)
|
|
11
|
+
3. **MiniVibe iOS app** installed on your iPhone/iPad
|
|
12
|
+
4. **Python 3** (macOS/Linux) or **node-pty** (Windows)
|
|
13
|
+
|
|
14
|
+
## Step 1: Install MiniVibe CLI
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install -g minivibe
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Verify installation:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
vibe --help
|
|
24
|
+
vibe-agent --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Step 2: Authenticate
|
|
28
|
+
|
|
29
|
+
### On Desktop/Laptop (with browser)
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
vibe --login
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
This opens your browser for Google sign-in. After signing in, authentication is saved automatically.
|
|
36
|
+
|
|
37
|
+
### On Server/EC2 (headless)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
vibe --login --headless
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
You'll see output like:
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
Requesting device code...
|
|
47
|
+
Visit: https://ws.neng.ai/device
|
|
48
|
+
Code: ABC123
|
|
49
|
+
|
|
50
|
+
Code expires in 5 minutes.
|
|
51
|
+
Waiting for authentication...
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
1. On your phone or another computer, visit the URL shown
|
|
55
|
+
2. Enter the code
|
|
56
|
+
3. Sign in with Google
|
|
57
|
+
4. The CLI will automatically detect the login and save your token
|
|
58
|
+
|
|
59
|
+
## Step 3: Choose Your Setup
|
|
60
|
+
|
|
61
|
+
### Option A: Direct Mode (Simple)
|
|
62
|
+
|
|
63
|
+
Best for: Single session, desktop use
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
vibe --bridge wss://ws.neng.ai
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Option B: Agent Mode (Recommended for Servers)
|
|
70
|
+
|
|
71
|
+
Best for: EC2, multiple sessions, persistent connection
|
|
72
|
+
|
|
73
|
+
**Terminal 1 - Start the agent:**
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
vibe-agent --bridge wss://ws.neng.ai
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Keep this running. The agent maintains the bridge connection and manages all sessions.
|
|
80
|
+
|
|
81
|
+
**Terminal 2+ - Create sessions:**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
vibe --agent
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Step 4: Connect from iOS
|
|
88
|
+
|
|
89
|
+
1. Open the **MiniVibe** app on your iOS device
|
|
90
|
+
2. Sign in with the same Google account
|
|
91
|
+
3. Your sessions will appear automatically
|
|
92
|
+
4. Tap a session to view, send messages, and approve permissions
|
|
93
|
+
|
|
94
|
+
## Common Workflows
|
|
95
|
+
|
|
96
|
+
### Basic Development Session
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Start a named session
|
|
100
|
+
vibe --agent --name "Feature: User Auth"
|
|
101
|
+
|
|
102
|
+
# Claude will start, you can work locally
|
|
103
|
+
# Monitor and control from iOS app
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Automated Tasks
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
# Skip all permission prompts (use with caution!)
|
|
110
|
+
vibe --agent --dangerously-skip-permissions "Run all tests and fix failures"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Resume Previous Session
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# Find session ID from iOS app or previous output
|
|
117
|
+
vibe --agent --resume abc12345-6789-...
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Running Agent as a Service
|
|
121
|
+
|
|
122
|
+
### Using systemd (Linux)
|
|
123
|
+
|
|
124
|
+
Create `/etc/systemd/system/vibe-agent.service`:
|
|
125
|
+
|
|
126
|
+
```ini
|
|
127
|
+
[Unit]
|
|
128
|
+
Description=MiniVibe Agent
|
|
129
|
+
After=network.target
|
|
130
|
+
|
|
131
|
+
[Service]
|
|
132
|
+
Type=simple
|
|
133
|
+
User=ubuntu
|
|
134
|
+
WorkingDirectory=/home/ubuntu
|
|
135
|
+
ExecStart=/usr/bin/vibe-agent --bridge wss://ws.neng.ai
|
|
136
|
+
Restart=always
|
|
137
|
+
RestartSec=10
|
|
138
|
+
|
|
139
|
+
[Install]
|
|
140
|
+
WantedBy=multi-user.target
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Enable and start:
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
sudo systemctl enable vibe-agent
|
|
147
|
+
sudo systemctl start vibe-agent
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Using tmux/screen
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Start in detached tmux session
|
|
154
|
+
tmux new-session -d -s vibe-agent "vibe-agent --bridge wss://ws.neng.ai"
|
|
155
|
+
|
|
156
|
+
# Attach to view logs
|
|
157
|
+
tmux attach -t vibe-agent
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Using pm2
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
npm install -g pm2
|
|
164
|
+
pm2 start vibe-agent -- --bridge wss://ws.neng.ai
|
|
165
|
+
pm2 save
|
|
166
|
+
pm2 startup
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Troubleshooting
|
|
170
|
+
|
|
171
|
+
### "Session file not found"
|
|
172
|
+
|
|
173
|
+
This is normal during startup. The session file is created when Claude starts processing. If it persists:
|
|
174
|
+
|
|
175
|
+
1. Check Claude Code is installed: `claude --version`
|
|
176
|
+
2. Check the projects directory exists: `ls ~/.claude/projects/`
|
|
177
|
+
|
|
178
|
+
### "Authentication failed"
|
|
179
|
+
|
|
180
|
+
Token may have expired. Re-authenticate:
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
vibe --logout
|
|
184
|
+
vibe --login --headless
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Agent not discovered
|
|
188
|
+
|
|
189
|
+
If `vibe --agent` can't find the agent:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Specify agent URL explicitly
|
|
193
|
+
vibe --agent ws://localhost:9999
|
|
194
|
+
|
|
195
|
+
# Check agent is running
|
|
196
|
+
ps aux | grep vibe-agent
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Permission prompts not appearing on iOS
|
|
200
|
+
|
|
201
|
+
1. Ensure you're signed into the same Google account on both CLI and iOS
|
|
202
|
+
2. Check the session is "active" in the iOS app
|
|
203
|
+
3. Verify bridge connection: look for "Connected to bridge" in CLI output
|
|
204
|
+
|
|
205
|
+
## Architecture Overview
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
Your Mac/PC Cloud Your iPhone
|
|
209
|
+
┌─────────────────┐ ┌─────────────┐
|
|
210
|
+
│ │ │ │
|
|
211
|
+
│ Terminal 1 │ │ MiniVibe │
|
|
212
|
+
│ ┌───────────┐ │ ┌─────────────────┐ │ App │
|
|
213
|
+
│ │vibe-agent │──┼────▶│ Bridge Server │◀─────────────────│ │
|
|
214
|
+
│ └───────────┘ │ │ ws.neng.ai │ │ - View │
|
|
215
|
+
│ ▲ │ └─────────────────┘ │ - Chat │
|
|
216
|
+
│ │ │ │ - Approve │
|
|
217
|
+
│ Terminal 2 │ │ │
|
|
218
|
+
│ ┌───────────┐ │ └─────────────┘
|
|
219
|
+
│ │ vibe │──┘
|
|
220
|
+
│ │ + Claude │
|
|
221
|
+
│ └───────────┘
|
|
222
|
+
│ │
|
|
223
|
+
└─────────────────┘
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
1. **vibe-agent** connects to the bridge server and stays connected
|
|
227
|
+
2. **vibe --agent** connects to the local agent, which spawns Claude Code
|
|
228
|
+
3. Messages flow: iOS ↔ Bridge ↔ Agent ↔ vibe ↔ Claude
|
|
229
|
+
4. Permissions appear on iOS for approval
|
|
230
|
+
|
|
231
|
+
## Next Steps
|
|
232
|
+
|
|
233
|
+
- Explore session management in the iOS app
|
|
234
|
+
- Set up multiple named sessions for different projects
|
|
235
|
+
- Configure auto-start on your development servers
|
|
236
|
+
- Check token usage in iOS Settings
|
|
237
|
+
|
|
238
|
+
## Getting Help
|
|
239
|
+
|
|
240
|
+
- GitHub Issues: https://github.com/python3isfun/neng/issues
|
|
241
|
+
- Check `vibe --help` and `vibe-agent --help` for all options
|
package/README.md
CHANGED
|
@@ -1,40 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# MiniVibe CLI
|
|
2
2
|
|
|
3
|
-
CLI wrapper for Claude Code with mobile remote control via MiniVibe.
|
|
3
|
+
CLI wrapper for Claude Code with mobile remote control via MiniVibe iOS app.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
7
|
- Remote control Claude Code from your iOS device
|
|
8
|
+
- Agent mode for managing multiple sessions
|
|
8
9
|
- Session management with resume capability
|
|
9
10
|
- Permission handling from mobile
|
|
10
11
|
- Token usage tracking
|
|
11
12
|
- Headless authentication for servers (EC2, etc.)
|
|
13
|
+
- Skip permissions mode for automation
|
|
12
14
|
|
|
13
|
-
##
|
|
15
|
+
## Quick Start
|
|
14
16
|
|
|
15
17
|
```bash
|
|
16
|
-
#
|
|
17
|
-
|
|
18
|
-
cd vibe-cli
|
|
18
|
+
# Install globally from npm
|
|
19
|
+
npm install -g minivibe
|
|
19
20
|
|
|
20
|
-
#
|
|
21
|
-
|
|
21
|
+
# Authenticate (one-time)
|
|
22
|
+
vibe --login # Desktop (opens browser)
|
|
23
|
+
vibe --login --headless # Server/EC2 (device code)
|
|
22
24
|
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
+
# Option 1: Direct bridge connection
|
|
26
|
+
vibe --bridge wss://ws.neng.ai
|
|
27
|
+
|
|
28
|
+
# Option 2: Agent mode (recommended for servers)
|
|
29
|
+
vibe-agent --bridge wss://ws.neng.ai & # Start agent
|
|
30
|
+
vibe --agent # Create sessions
|
|
25
31
|
```
|
|
26
32
|
|
|
27
|
-
|
|
33
|
+
See [GETTING_STARTED.md](GETTING_STARTED.md) for detailed setup instructions.
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### From npm (Recommended)
|
|
28
38
|
|
|
29
39
|
```bash
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
npm install -g minivibe
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This installs two commands:
|
|
44
|
+
- `vibe` - Start Claude Code sessions
|
|
45
|
+
- `vibe-agent` - Background agent for managing sessions
|
|
46
|
+
|
|
47
|
+
### From Source
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
git clone https://github.com/python3isfun/neng.git
|
|
51
|
+
cd neng/vibe-cli
|
|
52
|
+
npm install
|
|
53
|
+
npm link
|
|
38
54
|
```
|
|
39
55
|
|
|
40
56
|
## Authentication
|
|
@@ -61,67 +77,59 @@ Displays a device code. Visit the URL on any device to authenticate.
|
|
|
61
77
|
vibe --token <firebase-token>
|
|
62
78
|
```
|
|
63
79
|
|
|
64
|
-
Get token from MiniVibe iOS app Settings > Copy Token for CLI.
|
|
80
|
+
Get token from MiniVibe iOS app: Settings > Copy Token for CLI.
|
|
65
81
|
|
|
66
|
-
## Usage
|
|
82
|
+
## Usage Modes
|
|
67
83
|
|
|
68
|
-
###
|
|
84
|
+
### Direct Bridge Mode
|
|
69
85
|
|
|
70
|
-
|
|
71
|
-
# Interactive session
|
|
72
|
-
vibe
|
|
73
|
-
|
|
74
|
-
# With initial prompt
|
|
75
|
-
vibe "Fix the bug in main.js"
|
|
76
|
-
|
|
77
|
-
# Connect to bridge server
|
|
78
|
-
vibe --bridge wss://ws.neng.ai
|
|
79
|
-
|
|
80
|
-
# With prompt and bridge
|
|
81
|
-
vibe --bridge wss://ws.neng.ai "Deploy the application"
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
### Session Management
|
|
86
|
+
Connect directly to the bridge server:
|
|
85
87
|
|
|
86
88
|
```bash
|
|
87
|
-
|
|
88
|
-
vibe --
|
|
89
|
-
|
|
90
|
-
# Resume a previous session
|
|
91
|
-
vibe --resume <session-id> --bridge wss://ws.neng.ai
|
|
89
|
+
vibe --bridge wss://ws.neng.ai
|
|
90
|
+
vibe --bridge wss://ws.neng.ai "Fix the bug in main.js"
|
|
92
91
|
```
|
|
93
92
|
|
|
94
|
-
###
|
|
93
|
+
### Agent Mode (Recommended for Servers)
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
Use a local agent to manage sessions:
|
|
97
96
|
|
|
98
97
|
```bash
|
|
99
|
-
|
|
98
|
+
# Terminal 1: Start the agent (runs continuously)
|
|
99
|
+
vibe-agent --bridge wss://ws.neng.ai
|
|
100
|
+
|
|
101
|
+
# Terminal 2+: Create sessions via agent
|
|
102
|
+
vibe --agent
|
|
103
|
+
vibe --agent "Deploy the application"
|
|
104
|
+
vibe --agent --name "Backend Work"
|
|
100
105
|
```
|
|
101
106
|
|
|
102
|
-
**
|
|
107
|
+
**Benefits of Agent Mode:**
|
|
108
|
+
- Single bridge connection for multiple sessions
|
|
109
|
+
- Start/stop sessions remotely from iOS app
|
|
110
|
+
- Sessions survive network hiccups
|
|
111
|
+
- Cleaner process management
|
|
103
112
|
|
|
104
|
-
### Local
|
|
113
|
+
### Local Mode (No Bridge)
|
|
105
114
|
|
|
106
|
-
|
|
115
|
+
Run without remote control:
|
|
107
116
|
|
|
108
117
|
```bash
|
|
109
|
-
#
|
|
110
|
-
vibe
|
|
111
|
-
|
|
112
|
-
# Specify agent URL
|
|
113
|
-
vibe --agent ws://localhost:9999
|
|
118
|
+
vibe # Interactive
|
|
119
|
+
vibe "Explain this code" # With prompt
|
|
114
120
|
```
|
|
115
121
|
|
|
116
122
|
## Options
|
|
117
123
|
|
|
124
|
+
### vibe
|
|
125
|
+
|
|
118
126
|
| Option | Description |
|
|
119
127
|
|--------|-------------|
|
|
120
|
-
| `--bridge <url>` | Connect to bridge server
|
|
121
|
-
| `--agent [url]` | Connect via local vibe-agent |
|
|
128
|
+
| `--bridge <url>` | Connect to bridge server |
|
|
129
|
+
| `--agent [url]` | Connect via local vibe-agent (default: auto-discover) |
|
|
122
130
|
| `--name <name>` | Name this session (shown in mobile app) |
|
|
123
131
|
| `--resume <id>` | Resume a previous session |
|
|
124
|
-
| `--login` | Sign in with Google
|
|
132
|
+
| `--login` | Sign in with Google |
|
|
125
133
|
| `--headless` | Use device code flow for headless environments |
|
|
126
134
|
| `--token <token>` | Set Firebase auth token manually |
|
|
127
135
|
| `--logout` | Remove stored auth token |
|
|
@@ -129,11 +137,46 @@ vibe --agent ws://localhost:9999
|
|
|
129
137
|
| `--node-pty` | Use Node.js PTY wrapper (required for Windows) |
|
|
130
138
|
| `--help, -h` | Show help message |
|
|
131
139
|
|
|
140
|
+
### vibe-agent
|
|
141
|
+
|
|
142
|
+
| Option | Description |
|
|
143
|
+
|--------|-------------|
|
|
144
|
+
| `--bridge <url>` | Bridge server URL (required) |
|
|
145
|
+
| `--port <port>` | Local WebSocket port (default: 9999) |
|
|
146
|
+
| `--help, -h` | Show help message |
|
|
147
|
+
|
|
132
148
|
## In-Session Commands
|
|
133
149
|
|
|
134
150
|
| Command | Description |
|
|
135
151
|
|---------|-------------|
|
|
136
152
|
| `/name <name>` | Rename the current session |
|
|
153
|
+
| `//` | Type literal `/` (escape sequence) |
|
|
154
|
+
| `Escape` | Cancel command mode, forward to Claude |
|
|
155
|
+
| `Ctrl+C` | Cancel command mode, forward to Claude |
|
|
156
|
+
|
|
157
|
+
## Skip Permissions Mode
|
|
158
|
+
|
|
159
|
+
For automated/headless environments where you trust the execution context:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
vibe --dangerously-skip-permissions --bridge wss://ws.neng.ai
|
|
163
|
+
vibe --dangerously-skip-permissions --agent
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Warning:** This mode auto-approves ALL tool executions (commands, file writes, etc.) without prompting. Only use in trusted/sandboxed environments.
|
|
167
|
+
|
|
168
|
+
## Architecture
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
172
|
+
│ MiniVibe │────▶│ Bridge │◀────│ vibe-agent │◀────│ vibe │
|
|
173
|
+
│ iOS App │ │ Server │ │ (daemon) │ │ (session) │
|
|
174
|
+
└─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Direct mode:** `vibe --bridge` connects directly to bridge server
|
|
178
|
+
|
|
179
|
+
**Agent mode:** `vibe --agent` connects to local `vibe-agent`, which manages bridge connection
|
|
137
180
|
|
|
138
181
|
## Requirements
|
|
139
182
|
|
|
@@ -159,21 +202,11 @@ May also need Visual Studio Build Tools and Python for native compilation.
|
|
|
159
202
|
|
|
160
203
|
## Files
|
|
161
204
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
169
|
-
│ MiniVibe │────▶│ Bridge │◀────│ vibe-cli │
|
|
170
|
-
│ iOS App │ │ Server │ │ + Claude │
|
|
171
|
-
└─────────────┘ └─────────────┘ └─────────────┘
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
1. **vibe-cli** wraps Claude Code and connects to the bridge server
|
|
175
|
-
2. **Bridge server** relays messages between mobile and CLI
|
|
176
|
-
3. **MiniVibe iOS** provides remote control, permission approval, and session monitoring
|
|
205
|
+
| Path | Description |
|
|
206
|
+
|------|-------------|
|
|
207
|
+
| `~/.vibe/auth.json` | Stored authentication (token + refresh token) |
|
|
208
|
+
| `~/.vibe/token` | Legacy token file |
|
|
209
|
+
| `~/.vibe-agent/port` | Agent port file for auto-discovery |
|
|
177
210
|
|
|
178
211
|
## License
|
|
179
212
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "minivibe",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CLI wrapper for Claude Code with mobile remote control",
|
|
5
5
|
"author": "neng.ai",
|
|
6
6
|
"homepage": "https://github.com/python3isfun/neng",
|
|
@@ -21,7 +21,9 @@
|
|
|
21
21
|
"login.html",
|
|
22
22
|
"pty-wrapper.py",
|
|
23
23
|
"pty-wrapper-node.js",
|
|
24
|
-
"agent/"
|
|
24
|
+
"agent/",
|
|
25
|
+
"README.md",
|
|
26
|
+
"GETTING_STARTED.md"
|
|
25
27
|
],
|
|
26
28
|
"engines": {
|
|
27
29
|
"node": ">=18.0.0"
|
package/vibe.js
CHANGED
|
@@ -413,6 +413,7 @@ Options:
|
|
|
413
413
|
|
|
414
414
|
In-Session Commands:
|
|
415
415
|
/name <name> Rename the current session
|
|
416
|
+
// Type literal '/' (escape sequence)
|
|
416
417
|
|
|
417
418
|
Authentication:
|
|
418
419
|
Use --login to sign in via browser, or get token from MiniVibe iOS app.
|
|
@@ -1535,11 +1536,6 @@ function setupTerminalInput() {
|
|
|
1535
1536
|
}
|
|
1536
1537
|
process.stdin.resume();
|
|
1537
1538
|
process.stdin.on('data', (data) => {
|
|
1538
|
-
// Debug: log what bytes the keyboard sends (only when not in command mode)
|
|
1539
|
-
if (data.length <= 4 && !inCommandMode) {
|
|
1540
|
-
logStatus(`Keyboard input: ${data.length} bytes, hex: ${data.toString('hex')}`);
|
|
1541
|
-
}
|
|
1542
|
-
|
|
1543
1539
|
const str = data.toString();
|
|
1544
1540
|
|
|
1545
1541
|
// Check for command mode
|
|
@@ -1568,17 +1564,36 @@ function setupTerminalInput() {
|
|
|
1568
1564
|
}
|
|
1569
1565
|
}
|
|
1570
1566
|
|
|
1571
|
-
// Ctrl+C
|
|
1572
|
-
if (
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1567
|
+
// Ctrl+C - always forward to Claude (cancel any prompt)
|
|
1568
|
+
if (code === 0x03) {
|
|
1569
|
+
if (inCommandMode) {
|
|
1570
|
+
// Clear the echoed command text
|
|
1571
|
+
for (let i = 0; i < commandBuffer.length; i++) {
|
|
1572
|
+
process.stdout.write('\b \b');
|
|
1573
|
+
}
|
|
1574
|
+
commandBuffer = '';
|
|
1575
|
+
inCommandMode = false;
|
|
1576
|
+
}
|
|
1577
|
+
// Always forward Ctrl+C to Claude
|
|
1578
|
+
if (claudeProcess && isRunning && claudeProcess.stdin && claudeProcess.stdin.writable) {
|
|
1579
|
+
claudeProcess.stdin.write('\x03');
|
|
1580
|
+
}
|
|
1581
|
+
continue;
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
// Escape - exit command mode and forward to Claude
|
|
1585
|
+
if (code === 0x1b) {
|
|
1586
|
+
if (inCommandMode) {
|
|
1587
|
+
// Clear the echoed command text
|
|
1588
|
+
for (let i = 0; i < commandBuffer.length; i++) {
|
|
1589
|
+
process.stdout.write('\b \b');
|
|
1590
|
+
}
|
|
1591
|
+
commandBuffer = '';
|
|
1592
|
+
inCommandMode = false;
|
|
1576
1593
|
}
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
// Forward Ctrl+C to Claude if not in command mode
|
|
1581
|
-
// (but we just exited, so do nothing)
|
|
1594
|
+
// Always forward Escape to Claude (for canceling prompts)
|
|
1595
|
+
if (claudeProcess && isRunning && claudeProcess.stdin && claudeProcess.stdin.writable) {
|
|
1596
|
+
claudeProcess.stdin.write('\x1b');
|
|
1582
1597
|
}
|
|
1583
1598
|
continue;
|
|
1584
1599
|
}
|
|
@@ -1607,6 +1622,17 @@ function setupTerminalInput() {
|
|
|
1607
1622
|
|
|
1608
1623
|
// In command mode - buffer the character
|
|
1609
1624
|
if (inCommandMode) {
|
|
1625
|
+
// Check for '//' escape - send literal '/' to Claude
|
|
1626
|
+
if (char === '/' && commandBuffer === '/') {
|
|
1627
|
+
// User typed '//' - exit command mode and send '/' to Claude
|
|
1628
|
+
process.stdout.write('\b \b'); // Erase the first '/'
|
|
1629
|
+
inCommandMode = false;
|
|
1630
|
+
commandBuffer = '';
|
|
1631
|
+
if (claudeProcess && isRunning && claudeProcess.stdin && claudeProcess.stdin.writable) {
|
|
1632
|
+
claudeProcess.stdin.write('/');
|
|
1633
|
+
}
|
|
1634
|
+
continue;
|
|
1635
|
+
}
|
|
1610
1636
|
commandBuffer += char;
|
|
1611
1637
|
// Echo to terminal
|
|
1612
1638
|
process.stdout.write(char);
|