commandmate 0.2.10 → 0.2.12

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 (70) hide show
  1. package/.env.example +2 -1
  2. package/.next/BUILD_ID +1 -1
  3. package/.next/app-build-manifest.json +12 -12
  4. package/.next/app-path-routes-manifest.json +1 -1
  5. package/.next/build-manifest.json +2 -2
  6. package/.next/cache/.tsbuildinfo +1 -1
  7. package/.next/cache/config.json +3 -3
  8. package/.next/cache/webpack/client-production/0.pack +0 -0
  9. package/.next/cache/webpack/client-production/1.pack +0 -0
  10. package/.next/cache/webpack/client-production/2.pack +0 -0
  11. package/.next/cache/webpack/client-production/index.pack +0 -0
  12. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  13. package/.next/cache/webpack/edge-server-production/index.pack +0 -0
  14. package/.next/cache/webpack/server-production/0.pack +0 -0
  15. package/.next/cache/webpack/server-production/index.pack +0 -0
  16. package/.next/next-server.js.nft.json +1 -1
  17. package/.next/prerender-manifest.json +1 -1
  18. package/.next/required-server-files.json +1 -1
  19. package/.next/routes-manifest.json +1 -1
  20. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  21. package/.next/server/app/api/app/update-check/route.js +1 -1
  22. package/.next/server/app/api/repositories/clone/[jobId]/route.js +1 -1
  23. package/.next/server/app/api/repositories/clone/route.js +1 -1
  24. package/.next/server/app/api/repositories/route.js +2 -2
  25. package/.next/server/app/api/repositories/route.js.nft.json +1 -1
  26. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js +1 -1
  27. package/.next/server/app/api/worktrees/[id]/auto-yes/route.js.nft.json +1 -1
  28. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  29. package/.next/server/app/api/worktrees/[id]/current-output/route.js.nft.json +1 -1
  30. package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js +1 -1
  31. package/.next/server/app/api/worktrees/[id]/search/route.js +1 -1
  32. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route.js +1 -1
  33. package/.next/server/app/page_client-reference-manifest.js +1 -1
  34. package/.next/server/app/worktrees/[id]/files/[...path]/page.js +1 -1
  35. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  36. package/.next/server/app/worktrees/[id]/page.js +3 -3
  37. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  38. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  39. package/.next/server/app-paths-manifest.json +10 -10
  40. package/.next/server/chunks/2509.js +1 -0
  41. package/.next/server/chunks/369.js +1 -1
  42. package/.next/server/chunks/5488.js +4 -4
  43. package/.next/server/chunks/7808.js +1 -1
  44. package/.next/server/chunks/8693.js +1 -0
  45. package/.next/server/chunks/8744.js +1 -1
  46. package/.next/server/chunks/9238.js +14 -14
  47. package/.next/server/chunks/9367.js +2 -2
  48. package/.next/server/functions-config-manifest.json +1 -1
  49. package/.next/server/pages/500.html +1 -1
  50. package/.next/server/server-reference-manifest.json +1 -1
  51. package/.next/static/chunks/5970-2e18108d0cabd8af.js +1 -0
  52. package/.next/static/chunks/9178-88850a7c48deea07.js +1 -0
  53. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-4a3c0861367e0391.js +1 -0
  54. package/.next/static/chunks/app/worktrees/[id]/page-c99258f57461962c.js +1 -0
  55. package/.next/static/css/897ffb669f47c97b.css +3 -0
  56. package/.next/trace +5 -5
  57. package/README.md +154 -181
  58. package/dist/server/src/config/auto-yes-config.js +44 -2
  59. package/dist/server/src/lib/auto-yes-manager.js +249 -41
  60. package/dist/server/src/lib/claude-session.js +60 -21
  61. package/dist/server/src/lib/prompt-key.js +30 -0
  62. package/package.json +19 -7
  63. package/.next/server/chunks/667.js +0 -1
  64. package/.next/static/chunks/5970-dc8fb1c8c0217636.js +0 -1
  65. package/.next/static/chunks/8864-2f60eadc8404fdd0.js +0 -1
  66. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-ce9ac3658f2b7d91.js +0 -1
  67. package/.next/static/chunks/app/worktrees/[id]/page-1b8e4c49fbaf3f99.js +0 -1
  68. package/.next/static/css/a69d9c70fce558b4.css +0 -3
  69. /package/.next/static/{NGcx1ej6oVBba0MO0bwCg → ym6mA6Dl9wX62h3AoYO45}/_buildManifest.js +0 -0
  70. /package/.next/static/{NGcx1ej6oVBba0MO0bwCg → ym6mA6Dl9wX62h3AoYO45}/_ssgManifest.js +0 -0
package/README.md CHANGED
@@ -8,220 +8,131 @@
8
8
 
9
9
  [English](./README.md) | [日本語](./docs/ja/README.md)
10
10
 
11
- <!-- TODO: Add a 30-second demo GIF here to boost adoption -->
12
- <!-- Example: ![CommandMate Demo](./docs/assets/demo.gif) -->
11
+ <p align="center">
12
+ <img src="./docs/images/demo-mobile.gif" alt="CommandMate mobile demo" width="300">
13
+ </p>
13
14
 
14
- > **Your AI coding companion never miss a prompt, work from anywhere.**
15
+ > **Claude Code keeps coding while you're away. Check in from your phone.**
15
16
 
16
- - **Detect prompt/confirmation state** in real-time
17
- - **Send instructions from mobile or desktop** — no need to sit at your PC
18
- - **Manage sessions per Git worktree** — run parallel tasks with ease
17
+ Not a "remote control" — a **mobile dev cockpit**.
19
18
 
20
- ```bash
21
- npm install -g commandmate
22
- ```
23
-
24
- ![Desktop view](./docs/images/screenshot-desktop.png)
25
-
26
- ## Table of Contents
27
-
28
- - [What is this?](#what-is-this)
29
- - [Who is this for?](#who-is-this-for)
30
- - [What makes it unique?](#what-makes-it-unique)
31
- - [Quick Start](#quick-start-3-steps)
32
- - [Troubleshooting](#troubleshooting)
33
- - [How it works](#how-it-works)
34
- - [Key Features](#key-features)
35
- - [Use Cases](#use-cases)
36
- - [Security](#security)
37
- - [CLI Commands](#cli-commands)
38
- - [Developer Setup](#developer-setup)
39
- - [FAQ](#faq)
40
- - [Documentation](#documentation)
41
- - [Contributing](#contributing)
42
-
43
- ---
44
-
45
- ## What is this?
46
-
47
- A development companion tool that manages Claude Code sessions per Git worktree and lets you send instructions from your browser.
48
-
49
- During your commute, childcare breaks, or lunch — send the next instruction as easily as replying to an email, and keep your side projects moving forward.
19
+ CommandMate manages Claude Code and Codex CLI sessions per Git worktree and gives you a Web UI you can operate from any browser, including your phone. Auto Yes keeps the agent running autonomously while you monitor progress, review code changes, edit instructions, and send screenshot-based directions — all from your pocket.
50
20
 
51
- ## Who is this for?
21
+ Of course, it works great on desktop too — the two-column layout gives you a full overview of all sessions and worktrees at a glance.
52
22
 
53
- **Great fit:**
54
- - Developers juggling childcare, commutes, or meetings — can't sit at the PC all day
55
- - Users who miss Claude Code's input prompts and lose flow
56
- - Teams using Git worktree for parallel development but finding tmux management tedious
23
+ <p align="center">
24
+ <img src="./docs/images/demo-desktop.gif" alt="CommandMate desktop demo" width="600">
25
+ </p>
57
26
 
58
- **Not ideal for:**
59
- - GUI IDE-only workflows (CommandMate is terminal/CLI-based)
60
- - Multi-user SaaS expectations (CommandMate is designed for local, individual use)
61
-
62
- ## What makes it unique?
27
+ ```bash
28
+ npx commandmate
29
+ ```
63
30
 
64
- CommandMate is not a terminal replacement. It **complements** Claude Code by focusing on three things:
31
+ ---
65
32
 
66
- - **Prompt detection** — know instantly when Claude Code needs your input
67
- - **Response UI** — reply from any browser, including your phone
68
- - **Worktree organization** — manage multiple sessions in one place
33
+ ## The 6 Pillars
69
34
 
70
- Supports **Claude Code**, **Codex CLI**, and **Gemini CLI**. Built with the Strategy pattern for extensibility — adding new CLI tools is straightforward.
35
+ | Pillar | What it does | Why it matters |
36
+ |--------|-------------|----------------|
37
+ | **Auto Yes Mode** | Agent runs without stopping for confirmations | No babysitting — Claude Code keeps working while you're away |
38
+ | **Git Worktree Sessions** | One session per worktree, parallel execution | Multiple tasks progress simultaneously |
39
+ | **Mobile Web UI** | Full session control from any browser | Monitor and steer from your phone |
40
+ | **File Viewer** | Browse worktree files from the browser | Review code changes without touching your PC |
41
+ | **Markdown Editor** | Edit Markdown files in the browser | Update AI instructions on the go |
42
+ | **Screenshot Instructions** | Attach images to your prompts | Snap a bug → "Fix this" — the agent sees the screenshot |
71
43
 
72
44
  ---
73
45
 
74
- ## Quick Start (3 Steps)
46
+ ## Quick Start
75
47
 
76
48
  **Prerequisites:** macOS / Linux, Node.js v20+, npm, git, tmux, openssl
77
49
 
78
- > Windows is not supported due to the tmux dependency. WSL2 has not been tested.
79
-
80
50
  ```bash
81
- # 1. Install
82
- npm install -g commandmate
51
+ # Install & start in one command
52
+ npx commandmate
83
53
 
84
- # 2. Initialize (dependency check, environment setup, DB init)
54
+ # Or install globally
55
+ npm install -g commandmate
85
56
  commandmate init
86
-
87
- # 3. Start
88
57
  commandmate start --daemon
89
58
  ```
90
59
 
91
60
  Open http://localhost:3000 in your browser.
92
61
 
93
- **Useful commands:**
94
-
95
- ```bash
96
- commandmate status # Check server status
97
- commandmate stop # Stop the server
98
- ```
99
-
100
62
  See the [CLI Setup Guide](./docs/en/user-guide/cli-setup-guide.md) for details.
101
63
 
102
64
  ---
103
65
 
104
- ## Troubleshooting
66
+ ## Comparison
105
67
 
106
- **Claude CLI not found / path changed?**
107
- If you switch between npm and standalone versions of Claude CLI, the path may change. CommandMate auto-detects the new path on the next session start. To set a custom path, add `CLAUDE_PATH=/path/to/claude` to `.env`.
68
+ | Feature | CommandMate | Happy Coder | claude-squad | Omnara |
69
+ |---------|:-----------:|:-----------:|:------------:|:------:|
70
+ | Auto Yes Mode | Yes | No | Yes (TUI only) | No |
71
+ | Git Worktree Management | Yes | No | Yes (TUI only) | No |
72
+ | Mobile Web UI | Yes | Yes | **No** | Yes |
73
+ | File Viewer | Yes | No | No | No |
74
+ | Markdown Editor | Yes | No | No | No |
75
+ | Screenshot Instructions | Yes | No | Not possible | No |
76
+ | Free / OSS | Yes | Free + Paid | Yes | $20/mo |
77
+ | Runs 100% Locally | Yes | Server-routed | Yes | Cloud fallback |
78
+
79
+ ---
80
+
81
+ ## Workflow
108
82
 
109
- **Port conflict?**
110
- ```bash
111
- commandmate start -p 3001
112
83
  ```
84
+ 1. Start tasks on your PC
85
+ $ commandmate start --daemon
86
+ → Claude Code begins working with Auto Yes
113
87
 
114
- **Session stuck or not responding?**
115
- Check tmux sessions directly. CommandMate manages sessions with the naming format `mcbd-{tool}-{worktree}`:
88
+ 2. Close your laptop and go
116
89
 
117
- ```bash
118
- # List all CommandMate sessions
119
- tmux list-sessions | grep mcbd
90
+ 3. Check in from your phone
91
+ Web UI shows all sessions at a glance
120
92
 
121
- # View session output (without attaching)
122
- tmux capture-pane -t "mcbd-claude-feature-123" -p
93
+ 4. Review code changes
94
+ File Viewer lets you read diffs on mobile
123
95
 
124
- # Attach to inspect (detach with Ctrl+b then d)
125
- tmux attach -t "mcbd-claude-feature-123"
96
+ 5. Adjust direction
97
+ Edit a Markdown instruction file, or type a new prompt
126
98
 
127
- # Kill a broken session
128
- tmux kill-session -t "mcbd-claude-feature-123"
99
+ 6. Snap a bug
100
+ Screenshot Instructions: attach a photo and say "Fix this"
101
+
102
+ 7. Claude Code sees the image and starts fixing
129
103
  ```
130
104
 
131
- > **Note:** When attached, avoid typing directly into the session — this can interfere with CommandMate's session management. Use `Ctrl+b` then `d` to detach and operate through the CommandMate UI instead.
105
+ ---
132
106
 
133
- **Sessions fail when launching from within Claude Code?**
134
- Claude Code sets `CLAUDECODE=1` to prevent nesting. CommandMate removes this automatically, but if it persists, run: `tmux set-environment -g -u CLAUDECODE`
107
+ ## Security
108
+
109
+ Runs **100% locally**. No external server, no cloud relay, no account required. The only network traffic is Claude CLI's own API calls.
110
+
111
+ - Fully open-source ([MIT License](./LICENSE))
112
+ - Local database, local sessions
113
+ - For remote access, use a VPN or authenticated reverse proxy
114
+
115
+ See the [Security Guide](./docs/security-guide.md) and [Trust & Safety](./docs/en/TRUST_AND_SAFETY.md) for details.
135
116
 
136
117
  ---
137
118
 
138
119
  ## How it works
139
120
 
140
- CommandMate treats Claude Code (CLI) as a managed "execution session", making its state (running / waiting for input / idle) visible through a web UI.
141
-
142
121
  ```mermaid
143
122
  flowchart LR
144
123
  A["Browser / Phone"] -->|HTTP| B["CommandMate Server"]
145
124
  B --> C["Session Manager"]
146
- C -->|"spawn / attach"| D["tmux sessions<br/>(per worktree)"]
125
+ C -->|"spawn / attach"| D["tmux sessions\n(per worktree)"]
147
126
  D --> E["Claude Code CLI"]
148
- C <-->|"read / write"| F[("Local DB<br/>& State")]
127
+ C <-->|"read / write"| F[("Local DB\n& State")]
149
128
  ```
150
129
 
151
- Each Git worktree gets its own tmux session, so you can run multiple tasks in parallel without interference.
130
+ Each Git worktree gets its own tmux session, so multiple tasks run in parallel without interference.
152
131
 
153
132
  ---
154
133
 
155
- ## Key Features
156
-
157
- - **Prompt/confirmation detection** — Real-time status display in the sidebar (idle/ready/running/waiting)
158
- - **Send instructions from browser** — Operate via message UI from both mobile and desktop
159
- - **Execution history & notes** — Retains conversation history per branch with note-taking support
160
- - **Markdown log viewer** — View Claude's detailed output in Markdown format
161
- - **File viewer** — Browse worktree files from the browser with file operations (move, copy, delete)
162
- - **File timestamps** — Display file creation time in the file tree
163
- - **Auto Yes mode** — Control automatic approval with a confirmation dialog
164
- - **Repository management** — Remove repositories from app management (actual files are not deleted)
165
- - **Clone URL registration** — Clone and register repositories by specifying HTTPS/SSH URLs
166
- - **Multi-CLI support** — Optimized for Claude Code, with Codex CLI and Gemini CLI support
167
- - **Responsive UI** — Two-column layout on desktop, tab-based layout on mobile
168
-
169
134
  <details>
170
- <summary>Screenshots</summary>
171
-
172
- ### Worktree Detail View (Message / Console / History)
173
-
174
- | Desktop | Mobile (History) | Mobile (Terminal) |
175
- |---------|-----------------|-------------------|
176
- | ![Desktop - Worktree detail](./docs/images/screenshot-worktree-desktop.png) | ![Mobile - History](./docs/images/screenshot-worktree-mobile.png) | ![Mobile - Terminal](./docs/images/screenshot-worktree-mobile-terminal.png) |
177
-
178
- ### Top Page (Mobile)
179
-
180
- ![Mobile view](./docs/images/screenshot-mobile.png)
181
-
182
- </details>
183
-
184
- ---
185
-
186
- ## Use Cases
187
-
188
- ### 1. Commute — pick up where you left off
189
-
190
- - **Morning:** Kick off a task with Claude Code before leaving
191
- - **Commute:** Check status on your phone, send the next instruction
192
- - **Evening:** Review the results and merge when you get home
193
-
194
- ### 2. Childcare — 5-minute windows add up
195
-
196
- - Split tasks across worktrees so each runs independently
197
- - Check which sessions are waiting via CommandMate
198
- - In a 5-minute break, send the next instruction and keep things moving
199
-
200
- ### 3. Parallel development — one UI for all your worktrees
201
-
202
- - No need to juggle tmux panes manually
203
- - See status of all worktrees at a glance in the sidebar
204
- - Focus on decisions, not terminal management
205
-
206
- ---
207
-
208
- ## Security
209
-
210
- CommandMate runs **entirely locally** — the app, database, and sessions all stay on your machine. The only external communication is Claude CLI's own API calls.
211
-
212
- **Recommended setup:**
213
- - Use on `localhost` or within the same LAN
214
- - For remote access, use a VPN or authenticated reverse proxy (Basic Auth, OIDC, etc.)
215
- - Enabling external access via `commandmate init` sets `CM_BIND=0.0.0.0` — access from the same LAN at `http://<your-PC-IP>:3000`
216
-
217
- **Do NOT:**
218
- - Expose to the internet without authentication (never bind `0.0.0.0` without a reverse proxy)
219
-
220
- See the [Security Guide](./docs/security-guide.md) and [Trust & Safety](./docs/en/TRUST_AND_SAFETY.md) for details.
221
-
222
- ---
223
-
224
- ## CLI Commands
135
+ <summary><strong>CLI Commands</strong></summary>
225
136
 
226
137
  ### Basic
227
138
 
@@ -278,11 +189,90 @@ Requires [gh CLI](https://cli.github.com/) to be installed.
278
189
 
279
190
  See `commandmate --help` for all options.
280
191
 
281
- ---
192
+ </details>
193
+
194
+ <details>
195
+ <summary><strong>Screenshots</strong></summary>
282
196
 
283
- ## Developer Setup
197
+ ### Desktop
284
198
 
285
- For contributors or those building a development environment, use git clone.
199
+ ![Desktop view](./docs/images/screenshot-desktop.png)
200
+
201
+ ### Worktree Detail View (Message / Console / History)
202
+
203
+ | Desktop | Mobile (History) | Mobile (Terminal) |
204
+ |---------|-----------------|-------------------|
205
+ | ![Desktop - Worktree detail](./docs/images/screenshot-worktree-desktop.png) | ![Mobile - History](./docs/images/screenshot-worktree-mobile.png) | ![Mobile - Terminal](./docs/images/screenshot-worktree-mobile-terminal.png) |
206
+
207
+ ### Top Page (Mobile)
208
+
209
+ ![Mobile view](./docs/images/screenshot-mobile.png)
210
+
211
+ </details>
212
+
213
+ <details>
214
+ <summary><strong>Troubleshooting & FAQ</strong></summary>
215
+
216
+ ### Claude CLI not found / path changed?
217
+
218
+ If you switch between npm and standalone versions of Claude CLI, the path may change. CommandMate auto-detects the new path on the next session start. To set a custom path, add `CLAUDE_PATH=/path/to/claude` to `.env`.
219
+
220
+ ### Port conflict?
221
+
222
+ ```bash
223
+ commandmate start -p 3001
224
+ ```
225
+
226
+ ### Session stuck or not responding?
227
+
228
+ Check tmux sessions directly. CommandMate manages sessions with the naming format `mcbd-{tool}-{worktree}`:
229
+
230
+ ```bash
231
+ # List all CommandMate sessions
232
+ tmux list-sessions | grep mcbd
233
+
234
+ # View session output (without attaching)
235
+ tmux capture-pane -t "mcbd-claude-feature-123" -p
236
+
237
+ # Attach to inspect (detach with Ctrl+b then d)
238
+ tmux attach -t "mcbd-claude-feature-123"
239
+
240
+ # Kill a broken session
241
+ tmux kill-session -t "mcbd-claude-feature-123"
242
+ ```
243
+
244
+ > **Note:** When attached, avoid typing directly into the session — this can interfere with CommandMate's session management. Use `Ctrl+b` then `d` to detach and operate through the CommandMate UI instead.
245
+
246
+ ### Sessions fail when launching from within Claude Code?
247
+
248
+ Claude Code sets `CLAUDECODE=1` to prevent nesting. CommandMate removes this automatically, but if it persists, run: `tmux set-environment -g -u CLAUDECODE`
249
+
250
+ ### FAQ
251
+
252
+ **Q: How do I use CommandMate from my phone?**
253
+ A: CommandMate runs a web server on your PC. To access it from your phone, your phone and PC must be on the same network (Wi-Fi). Run `commandmate init` and enable external access — this sets `CM_BIND=0.0.0.0`. Then open `http://<your-PC-IP>:3000` in your phone's browser.
254
+
255
+ **Q: Can I access it from outside my home network?**
256
+ A: Yes. Use a tunneling service like [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/) to securely expose your local server without opening router ports. Alternatively, a VPN or an authenticated reverse proxy (Basic Auth, OIDC, etc.) also works. **Do not** expose the server directly to the internet without authentication.
257
+
258
+ **Q: Does it work on iPhone / Android?**
259
+ A: Yes. CommandMate's Web UI is responsive and works on any modern mobile browser (Safari, Chrome, etc.). No app install required.
260
+
261
+ **Q: Is tmux required?**
262
+ A: CommandMate uses tmux internally to manage CLI sessions. You don't need to operate tmux directly — CommandMate handles it for you.
263
+
264
+ **Q: What about Claude Code's permissions?**
265
+ A: Claude Code's own permission settings apply as-is. CommandMate does not expand permissions. See [Trust & Safety](./docs/en/TRUST_AND_SAFETY.md) for details.
266
+
267
+ **Q: Can multiple people use it?**
268
+ A: Currently designed for individual use. Simultaneous multi-user access is not supported.
269
+
270
+ </details>
271
+
272
+ <details>
273
+ <summary><strong>Developer Setup</strong></summary>
274
+
275
+ For contributors or those building a development environment:
286
276
 
287
277
  ```bash
288
278
  git clone https://github.com/Kewton/CommandMate.git
@@ -290,8 +280,7 @@ cd CommandMate
290
280
  ./scripts/setup.sh # Auto-runs dependency check, env setup, build, and launch
291
281
  ```
292
282
 
293
- <details>
294
- <summary>Manual Setup (for customization)</summary>
283
+ ### Manual Setup (for customization)
295
284
 
296
285
  ```bash
297
286
  git clone https://github.com/Kewton/CommandMate.git
@@ -306,25 +295,10 @@ npm start
306
295
 
307
296
  > **Note**: `./scripts/*` scripts are only available in the development environment. For global installs (`npm install -g`), use the `commandmate` CLI.
308
297
 
309
- > **Note**: Legacy environment variable names (`MCBD_*`) are still supported for backward compatibility, but using the new names (`CM_*`) is recommended.
310
-
311
298
  </details>
312
299
 
313
300
  ---
314
301
 
315
- ## FAQ
316
-
317
- **Q: Is tmux required?**
318
- A: CommandMate uses tmux internally to manage CLI sessions. You don't need to operate tmux directly — CommandMate handles it for you. If something goes wrong, you can inspect sessions via tmux commands (see [Troubleshooting](#troubleshooting)).
319
-
320
- **Q: What about Claude Code's permissions?**
321
- A: Claude Code's own permission settings apply as-is. CommandMate does not expand permissions. See [Trust & Safety](./docs/en/TRUST_AND_SAFETY.md) for details.
322
-
323
- **Q: Can multiple people use it?**
324
- A: Currently designed for individual use. Simultaneous multi-user access is not supported.
325
-
326
- ---
327
-
328
302
  ## Documentation
329
303
 
330
304
  | Document | Description |
@@ -335,7 +309,6 @@ A: Currently designed for individual use. Simultaneous multi-user access is not
335
309
  | [Concept](./docs/en/concept.md) | Vision and problems solved |
336
310
  | [Architecture](./docs/en/architecture.md) | System design |
337
311
  | [Deployment Guide](./docs/en/DEPLOYMENT.md) | Production environment setup |
338
- | [Migration Guide](./docs/en/migration-to-commandmate.md) | Migrating from MyCodeBranchDesk |
339
312
  | [UI/UX Guide](./docs/en/UI_UX_GUIDE.md) | UI implementation details |
340
313
  | [Trust & Safety](./docs/en/TRUST_AND_SAFETY.md) | Security and permissions |
341
314
 
@@ -2,16 +2,22 @@
2
2
  /**
3
3
  * Auto-Yes Configuration Constants
4
4
  *
5
- * Shared config for Auto-Yes duration settings.
5
+ * Shared config for Auto-Yes duration settings and stop pattern validation.
6
6
  * Used by both server (auto-yes-manager.ts, route.ts) and client
7
7
  * (AutoYesConfirmDialog.tsx, AutoYesToggle.tsx) components.
8
8
  *
9
9
  * Issue #225: Duration selection feature
10
+ * Issue #314: Stop condition (regex) validation
10
11
  */
12
+ var __importDefault = (this && this.__importDefault) || function (mod) {
13
+ return (mod && mod.__esModule) ? mod : { "default": mod };
14
+ };
11
15
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.DURATION_LABELS = exports.DEFAULT_AUTO_YES_DURATION = exports.ALLOWED_DURATIONS = void 0;
16
+ exports.MAX_STOP_PATTERN_LENGTH = exports.DURATION_LABELS = exports.DEFAULT_AUTO_YES_DURATION = exports.ALLOWED_DURATIONS = void 0;
13
17
  exports.isAllowedDuration = isAllowedDuration;
18
+ exports.validateStopPattern = validateStopPattern;
14
19
  exports.formatTimeRemaining = formatTimeRemaining;
20
+ const safe_regex2_1 = __importDefault(require("safe-regex2"));
15
21
  /** Allowed Auto-Yes durations in milliseconds */
16
22
  exports.ALLOWED_DURATIONS = [3600000, 10800000, 28800000];
17
23
  /** Default Auto-Yes duration (1 hour = 3600000ms) */
@@ -29,6 +35,42 @@ exports.DURATION_LABELS = {
29
35
  function isAllowedDuration(value) {
30
36
  return typeof value === 'number' && exports.ALLOWED_DURATIONS.includes(value);
31
37
  }
38
+ // =============================================================================
39
+ // Stop Pattern Validation (Issue #314)
40
+ // =============================================================================
41
+ /** Maximum length for stop pattern (security: prevent excessive regex complexity) */
42
+ exports.MAX_STOP_PATTERN_LENGTH = 500;
43
+ /**
44
+ * Validate a stop pattern (regular expression string).
45
+ *
46
+ * Security measures:
47
+ * - Length limit (MAX_STOP_PATTERN_LENGTH)
48
+ * - safe-regex2 for catastrophic backtracking detection (ReDoS prevention)
49
+ * - RegExp constructor for syntax validation
50
+ * - Error messages are fixed strings only (no error.message passthrough for XSS prevention)
51
+ *
52
+ * @param pattern - Regular expression pattern string to validate
53
+ * @returns Validation result with fixed-string error messages
54
+ */
55
+ function validateStopPattern(pattern) {
56
+ if (pattern.length > exports.MAX_STOP_PATTERN_LENGTH) {
57
+ return { valid: false, error: `Pattern must be ${exports.MAX_STOP_PATTERN_LENGTH} characters or less` };
58
+ }
59
+ // safe-regex2 detects catastrophic backtracking patterns (ReDoS prevention)
60
+ if (!(0, safe_regex2_1.default)(pattern)) {
61
+ return { valid: false, error: 'Pattern may cause performance issues (catastrophic backtracking detected)' };
62
+ }
63
+ try {
64
+ new RegExp(pattern);
65
+ return { valid: true };
66
+ }
67
+ catch {
68
+ return { valid: false, error: 'Invalid regular expression syntax' };
69
+ }
70
+ }
71
+ // =============================================================================
72
+ // Time Formatting
73
+ // =============================================================================
32
74
  /** Milliseconds per second */
33
75
  const MS_PER_SECOND = 1000;
34
76
  /** Milliseconds per minute */