@iflow-mcp/camoneart-maestro 5.0.0
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/CHANGELOG.md +949 -0
- package/LICENSE +21 -0
- package/README.ja.md +550 -0
- package/README.md +576 -0
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +7407 -0
- package/dist/cli.js.map +1 -0
- package/dist/mcp/server.d.ts +28 -0
- package/dist/mcp/server.js +847 -0
- package/dist/mcp/server.js.map +1 -0
- package/package.json +93 -0
- package/scripts/generate-completions.js +51 -0
- package/scripts/maestro-tmux-attach +101 -0
- package/scripts/update-scoop-manifest.js +80 -0
package/README.md
ADDED
|
@@ -0,0 +1,576 @@
|
|
|
1
|
+
# Maestro
|
|
2
|
+
|
|
3
|
+
[](https://nodejs.org/)
|
|
4
|
+
[](https://www.npmjs.com/package/@camoneart/maestro)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
**English** | **[Japanese](/README.ja.md)**
|
|
8
|
+
|
|
9
|
+

|
|
10
|
+
**A CLI tool that conducts Git worktrees like an orchestra and accelerates parallel development with Claude Code.**
|
|
11
|
+
|
|
12
|
+
<br />
|
|
13
|
+
|
|
14
|
+
https://github.com/user-attachments/assets/6415804a-3dd0-48ac-91eb-1c3adad70ae7
|
|
15
|
+
|
|
16
|
+
## Table of Contents
|
|
17
|
+
|
|
18
|
+
- [Overview](#overview)
|
|
19
|
+
- [Key Features](#key-features)
|
|
20
|
+
- [Installation](#installation)
|
|
21
|
+
- [Updating](#updating)
|
|
22
|
+
- [Requirements](#requirements)
|
|
23
|
+
- [Quick Start](#quick-start)
|
|
24
|
+
- [Command Reference](#command-reference)
|
|
25
|
+
- [Advanced Features](#advanced-features)
|
|
26
|
+
- [Configuration](#configuration)
|
|
27
|
+
- [Troubleshooting](#troubleshooting)
|
|
28
|
+
- [Contributing](#contributing)
|
|
29
|
+
- [License](#license)
|
|
30
|
+
|
|
31
|
+
## Overview
|
|
32
|
+
|
|
33
|
+
Maestro is a CLI that makes Git worktree management intuitive. When working on multiple branches in parallel you can treat each branch as an independent “orchestra member” without changing directories.
|
|
34
|
+
|
|
35
|
+
### Why Maestro?
|
|
36
|
+
|
|
37
|
+
| Pain Point | Maestro’s Approach | Benefit |
|
|
38
|
+
| ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------------------------------------------------- |
|
|
39
|
+
| **Inefficient parallel development**<br>Frequent branch switches, stashes and context switching | **Automatic Worktree management**<br>Each feature lives in its own directory | Zero branch-switch cost, smooth multitasking |
|
|
40
|
+
| **Hard to keep track of tasks** | **CLI list & status**<br>Visualise all performers (worktrees) | Instantly know where you are and the current progress |
|
|
41
|
+
| **Heavy review / merge workload** | **Claude Code integration**<br>AI diff reviews & automated PR flow | Drastically reduces review time |
|
|
42
|
+
|
|
43
|
+
## Key Features
|
|
44
|
+
|
|
45
|
+
| Feature | Description |
|
|
46
|
+
| ------------------------- | --------------------------------------------------- |
|
|
47
|
+
| 🎼 **Orchestra UI** | Operate worktrees as performers in an intuitive way |
|
|
48
|
+
| 🤖 **Claude AI** | AI diff reviews & code suggestions |
|
|
49
|
+
| 🔗 **GitHub integration** | Reliable worktree creation from Issues / PRs with rich metadata |
|
|
50
|
+
| 🎯 **tmux / fzf** | Keyboard-only, lightning-fast switching |
|
|
51
|
+
| 📊 **Status** | Real-time worktree status and health monitoring |
|
|
52
|
+
| 🔄 **Auto Sync** | Propagate file changes in real time |
|
|
53
|
+
| 📸 **Snapshot** | Save / restore any state with one command |
|
|
54
|
+
| 🏥 **Health Check** | Detect & auto-fix orphaned / conflicting branches |
|
|
55
|
+
| 🛡️ **Auto Rollback** | Intelligent cleanup prevents orphaned worktrees |
|
|
56
|
+
|
|
57
|
+
## Installation
|
|
58
|
+
|
|
59
|
+
### Homebrew (recommended)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
brew install camoneart/tap/maestro
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- Homebrew installs completion scripts for **zsh / fish / bash** automatically.<br>
|
|
66
|
+
- For bash you also need `brew install bash-completion@2`. See [Shell Completion](#shell-completion).
|
|
67
|
+
|
|
68
|
+
### npm
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install -g @camoneart/maestro
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### pnpm
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
# If pnpm is not installed yet
|
|
78
|
+
npm install -g pnpm
|
|
79
|
+
|
|
80
|
+
pnpm add -g @camoneart/maestro
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Updating
|
|
84
|
+
|
|
85
|
+
### Homebrew
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
brew upgrade camoneart/tap/maestro
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### npm
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm update -g @camoneart/maestro
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### pnpm
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pnpm update -g @camoneart/maestro
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Requirements
|
|
104
|
+
|
|
105
|
+
| Requirement | Version | Purpose | Install Command |
|
|
106
|
+
|-------------|---------|---------|-----------------|
|
|
107
|
+
| **Node.js** | >=20.0.0 | JavaScript runtime | [nodejs.org](https://nodejs.org/) |
|
|
108
|
+
| **Git** | >=2.22 | Worktree support | `brew install git` |
|
|
109
|
+
| **tmux** (optional) | Any | Session management | `brew install tmux` |
|
|
110
|
+
| **fzf** (optional) | Any | Fuzzy finding | `brew install fzf` |
|
|
111
|
+
| **GitHub CLI** (optional) | Any | GitHub integration | `brew install gh` |
|
|
112
|
+
|
|
113
|
+
## Quick Start
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
# 1. Install (Homebrew example)
|
|
117
|
+
brew install camoneart/tap/maestro
|
|
118
|
+
|
|
119
|
+
# 2. Move to your Git project
|
|
120
|
+
cd ~/path/to/your-repo
|
|
121
|
+
|
|
122
|
+
# 2.5. Initialize maestro for your project (NEW!)
|
|
123
|
+
mst init # Interactive setup
|
|
124
|
+
# or: mst init --yes # Quick setup with defaults
|
|
125
|
+
|
|
126
|
+
# 3. Create a performer (worktree)
|
|
127
|
+
mst create feature/awesome-feature # create only
|
|
128
|
+
|
|
129
|
+
# 4. Jump into the performer’s shell
|
|
130
|
+
mst shell feature/awesome-feature # open a shell inside
|
|
131
|
+
|
|
132
|
+
# ── one-liner (tmux + Claude) ──
|
|
133
|
+
# Create the worktree, prompt for tmux session attachment, and set up Claude Code workspace
|
|
134
|
+
mst create feature/awesome-feature --tmux --claude-md
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### Tips
|
|
138
|
+
|
|
139
|
+
- `mst shell <branch>` lets you enter any performer after creation (fzf prompt when omitted).
|
|
140
|
+
- `--tmux` creates a dedicated tmux session with branch name title and prompts for attachment (automatically attaches in non-TTY environments); combine with `--claude-md` to set up Claude Code workspace files.
|
|
141
|
+
- `--tmux-h`/`--tmux-v` splits the current tmux pane horizontally/vertically with improved focus management (focuses first pane) and unified pane titles.
|
|
142
|
+
- `--tmux-h-panes <number>`/`--tmux-v-panes <number>` creates multiple horizontal/vertical panes with specified count, all displaying consistent branch name titles.
|
|
143
|
+
- `--tmux-layout <type>` applies specific tmux layout (even-horizontal, even-vertical, main-horizontal, main-vertical, tiled).
|
|
144
|
+
|
|
145
|
+
### Basic Usage Examples
|
|
146
|
+
|
|
147
|
+
| Goal | Command Example |
|
|
148
|
+
| --------------------------------- | ---------------------------------------------------------------------------- |
|
|
149
|
+
| **Parallel dev** Feature + bugfix | `mst create feature/auth --tmux --claude-md`<br>`mst create bugfix/login-issue` |
|
|
150
|
+
| **List performers** | `mst list` |
|
|
151
|
+
| **List with GitHub metadata** | `mst list --metadata` |
|
|
152
|
+
| **Fast switch** via tmux | `mst tmux` |
|
|
153
|
+
| **Create from GitHub Issue** | `mst create 123` |
|
|
154
|
+
| **Create from PR** | `mst github checkout 456` |
|
|
155
|
+
| **Create from PR with tmux** | `mst github checkout 456 --tmux-h` |
|
|
156
|
+
| **List GitHub issues/PRs** | `mst github list` |
|
|
157
|
+
| **Push with PR** | `mst push --pr` |
|
|
158
|
+
| **Push with draft PR** | `mst push --draft-pr` |
|
|
159
|
+
| **Auto review & merge** | `mst review --auto-flow` |
|
|
160
|
+
|
|
161
|
+
## Command Reference
|
|
162
|
+
|
|
163
|
+
See the full [Command Reference](./docs/COMMANDS.md).
|
|
164
|
+
|
|
165
|
+
### Main Commands
|
|
166
|
+
|
|
167
|
+
| Command | Description | Example |
|
|
168
|
+
| ----------- | ---------------------------- | ------------------------------ |
|
|
169
|
+
| `init` | Initialize project config | `mst init --yes` |
|
|
170
|
+
| `create` | Create a new worktree | `mst create feature/login` |
|
|
171
|
+
| `list` | List worktrees | `mst list` |
|
|
172
|
+
| `delete` | Orchestra members exit the stage with automatic tmux session cleanup | `mst delete feature/old --keep-session` |
|
|
173
|
+
| `tmux` | Open in tmux | `mst tmux` |
|
|
174
|
+
| `sync` | Real-time file sync | `mst sync --auto` |
|
|
175
|
+
| `push` | Push and create PR | `mst push --pr` |
|
|
176
|
+
| `github` | GitHub integration | `mst github checkout 123` |
|
|
177
|
+
| `health` | Health check | `mst health --fix` |
|
|
178
|
+
| `where` | Show current performer | `mst where` |
|
|
179
|
+
|
|
180
|
+
All sub-commands and options are documented in the [Command Reference](./docs/COMMANDS.md).
|
|
181
|
+
|
|
182
|
+
#### One-line Cheat Sheet
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
mst create feature/my-ui --tmux --claude-md # create + AI + tmux
|
|
186
|
+
mst create feature/api --tmux-h-panes 3 # create + 3 horizontal panes (unified titles)
|
|
187
|
+
mst create feature/tdd --tmux-h-panes 4 --tmux-layout tiled # 4-pane grid layout
|
|
188
|
+
mst list # list performers
|
|
189
|
+
mst tmux # switch via fzf
|
|
190
|
+
mst push --pr # push with PR
|
|
191
|
+
mst review --auto-flow # auto review & merge
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## Advanced Features
|
|
195
|
+
|
|
196
|
+
Maestro ships with **power commands** that automate tedious tasks in a single line.
|
|
197
|
+
|
|
198
|
+
| Feature | Command Example | What It Automates |
|
|
199
|
+
| --------------------------- | --------------------------------------------------------------------- | --------------------------------------------------------------------------- |
|
|
200
|
+
| **Auto Review & Merge 🚀** | `mst review --auto-flow` | Fetch → rebase → AI review → Conventional Commit → open PR — all in one go |
|
|
201
|
+
| **GitHub Integration 🔗** | `mst github list` <br>`mst github checkout 123 --tmux-h` <br>`mst list --metadata` | List and checkout GitHub issues/PRs with reliable worktree creation, comprehensive metadata storage, and tmux integration |
|
|
202
|
+
| **Snapshot 📸** | `mst snapshot -m "before-refactor"` <br>`mst snapshot --restore <id>` | Save / restore any working state instantly |
|
|
203
|
+
| **Health Check 🏥** | `mst health` <br>`mst health --fix` | Detects stale / orphaned / conflicted branches and fixes them automatically |
|
|
204
|
+
|
|
205
|
+
Need more? Run `mst <command> --help`.
|
|
206
|
+
|
|
207
|
+
## Configuration
|
|
208
|
+
|
|
209
|
+
### 📁 Project Configuration `.maestro.json`
|
|
210
|
+
|
|
211
|
+
Maestro reads **`.maestro.json` at the project root** to customise behaviour.<br>
|
|
212
|
+
Key settings are summarised below; a full example follows.
|
|
213
|
+
|
|
214
|
+
### ⚙️ Configuration Management
|
|
215
|
+
|
|
216
|
+
Maestro provides commands to manage configuration settings using dot notation:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Get configuration values
|
|
220
|
+
mst config get ui.pathDisplay # Get path display setting
|
|
221
|
+
mst config get development.autoSetup # Get auto-setup setting
|
|
222
|
+
|
|
223
|
+
# Set configuration values
|
|
224
|
+
mst config set ui.pathDisplay relative # Auto-detects as user setting
|
|
225
|
+
mst config set --user ui.pathDisplay relative # Explicitly save to user settings
|
|
226
|
+
mst config set --project worktrees.path "../" # Explicitly save to project settings
|
|
227
|
+
mst config set development.defaultEditor cursor # Set default editor (user setting)
|
|
228
|
+
|
|
229
|
+
# Reset to defaults
|
|
230
|
+
mst config reset ui.pathDisplay # Reset path display to default
|
|
231
|
+
mst config reset development.autoSetup # Reset auto-setup to default
|
|
232
|
+
|
|
233
|
+
# View and manage configuration files
|
|
234
|
+
mst config show # Show current effective config
|
|
235
|
+
mst config path # Show config file locations
|
|
236
|
+
mst config init # Create project configuration
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
**Path Display Configuration:**
|
|
240
|
+
The `ui.pathDisplay` setting controls how file paths are shown across all commands. When set to `"relative"`, paths are displayed relative to the current working directory. When set to `"absolute"` (default), full absolute paths are shown. This affects commands like `github`, `review`, `shell`, `exec`, and `health`.
|
|
241
|
+
|
|
242
|
+
**Claude Configuration:**
|
|
243
|
+
- `markdownMode: "shared"` - Creates symlink to main repository's CLAUDE.md (default)
|
|
244
|
+
- `markdownMode: "split"` - Creates independent CLAUDE.md for each worktree
|
|
245
|
+
|
|
246
|
+
| Category | Key | Purpose | Default / Example |
|
|
247
|
+
| ----------- | -------------- | ------------------------------------- | ----------------------------------- |
|
|
248
|
+
| worktrees | `path` | Where to store performers | `../maestro-{branch}` |
|
|
249
|
+
| | `directoryPrefix` | Prefix for worktree directories | `""` (empty string) |
|
|
250
|
+
| | `branchPrefix` | Prefix for new branches | `feature/` |
|
|
251
|
+
| development | `autoSetup` | Auto-run `npm install` after `create` | `true` |
|
|
252
|
+
| | `syncFiles` | Files to sync across worktrees | `[".env", ".env.local"]` |
|
|
253
|
+
| | `defaultEditor`| Default editor for opening | `cursor` |
|
|
254
|
+
| tmux | `enabled` | Enable tmux integration | `false` |
|
|
255
|
+
| | `openIn` | Open in window or pane | `window` (`window` or `pane`) |
|
|
256
|
+
| | `sessionNaming`| Session naming pattern | `{branch}` |
|
|
257
|
+
| claude | `markdownMode` | CLAUDE.md file management mode | `shared` (`shared` or `split`) |
|
|
258
|
+
| github | `autoFetch` | Auto-fetch before operations | `true` |
|
|
259
|
+
| | `branchNaming.prTemplate` | PR branch naming template | `pr-{number}` |
|
|
260
|
+
| | `branchNaming.issueTemplate` | Issue branch naming template | `issue-{number}` |
|
|
261
|
+
| ui | `pathDisplay` | Path display format in all commands that show paths | `absolute` (`absolute` or `relative`) |
|
|
262
|
+
| hooks | `afterCreate` | Command after creation | `npm install` |
|
|
263
|
+
| | `beforeDelete` | Command before deletion | `echo "Deleting $ORCHESTRA_MEMBER"` |
|
|
264
|
+
|
|
265
|
+
#### Full Example with Default Values
|
|
266
|
+
|
|
267
|
+
```json
|
|
268
|
+
{
|
|
269
|
+
"worktrees": {
|
|
270
|
+
"path": "../maestro-{branch}",
|
|
271
|
+
"directoryPrefix": "",
|
|
272
|
+
"branchPrefix": "feature/"
|
|
273
|
+
},
|
|
274
|
+
"development": {
|
|
275
|
+
"autoSetup": true,
|
|
276
|
+
"syncFiles": [".env", ".env.local"],
|
|
277
|
+
"defaultEditor": "cursor"
|
|
278
|
+
},
|
|
279
|
+
"tmux": {
|
|
280
|
+
"enabled": false,
|
|
281
|
+
"openIn": "window",
|
|
282
|
+
"sessionNaming": "{branch}"
|
|
283
|
+
},
|
|
284
|
+
"claude": {
|
|
285
|
+
"markdownMode": "shared"
|
|
286
|
+
},
|
|
287
|
+
"github": {
|
|
288
|
+
"autoFetch": true,
|
|
289
|
+
"branchNaming": {
|
|
290
|
+
"prTemplate": "pr-{number}",
|
|
291
|
+
"issueTemplate": "issue-{number}"
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
"ui": {
|
|
295
|
+
"pathDisplay": "absolute"
|
|
296
|
+
},
|
|
297
|
+
"hooks": {
|
|
298
|
+
"afterCreate": "npm install",
|
|
299
|
+
"beforeDelete": "echo \\\"Deleting performer: $ORCHESTRA_MEMBER\\\""
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### 📋 Complete Configuration Reference
|
|
305
|
+
|
|
306
|
+
All available configuration options for `.maestro.json`:
|
|
307
|
+
|
|
308
|
+
| Category | Key | Type | Default | Description |
|
|
309
|
+
|----------|-----|------|---------|-------------|
|
|
310
|
+
| **worktrees** | | | | Worktree location and naming |
|
|
311
|
+
| | `path` | string | `"../maestro-{branch}"` | Directory pattern for worktrees (`{branch}` is replaced with branch name) |
|
|
312
|
+
| | `directoryPrefix` | string | `""` | Prefix added to all worktree directory names |
|
|
313
|
+
| | `branchPrefix` | string | `""` | Default prefix for new branch names |
|
|
314
|
+
| **development** | | | | Development environment settings |
|
|
315
|
+
| | `autoSetup` | boolean | `true` | Auto-run setup commands after worktree creation |
|
|
316
|
+
| | `syncFiles` | string[] | `[".env", ".env.local"]` | Files to sync across worktrees |
|
|
317
|
+
| | `defaultEditor` | string | `"cursor"` | Default editor (`vscode`, `cursor`, `none`) |
|
|
318
|
+
| **postCreate** | | | *(not in defaults)* | Post-creation automation |
|
|
319
|
+
| | `copyFiles` | string[] | - | Files to copy from main worktree after creation |
|
|
320
|
+
| | `commands` | string[] | - | Commands to execute after worktree creation |
|
|
321
|
+
| **tmux** | | | | tmux integration settings |
|
|
322
|
+
| | `enabled` | boolean | `false` | Enable tmux integration |
|
|
323
|
+
| | `openIn` | string | `"window"` | Open in `window` or `pane` |
|
|
324
|
+
| | `sessionNaming` | string | `"{branch}"` | Session naming pattern |
|
|
325
|
+
| **claude** | | | | Claude Code integration |
|
|
326
|
+
| | `markdownMode` | string | `"shared"` | CLAUDE.md mode: `shared` (symlink) or `split` (independent) |
|
|
327
|
+
| **github** | | | | GitHub integration settings |
|
|
328
|
+
| | `autoFetch` | boolean | `true` | Auto-fetch before operations |
|
|
329
|
+
| | `branchNaming.prTemplate` | string | `"pr-{number}"` | PR branch naming template |
|
|
330
|
+
| | `branchNaming.issueTemplate` | string | `"issue-{number}"` | Issue branch naming template |
|
|
331
|
+
| **ui** | | | | User interface settings |
|
|
332
|
+
| | `pathDisplay` | string | `"absolute"` | Path display format: `absolute` or `relative` |
|
|
333
|
+
| **hooks** | | | | Lifecycle hooks |
|
|
334
|
+
| | `afterCreate` | string \| string[] | - | Commands to run after worktree creation |
|
|
335
|
+
| | `beforeDelete` | string | - | Command to run before worktree deletion |
|
|
336
|
+
|
|
337
|
+
> **Note**: For detailed configuration examples and advanced usage, see [Configuration Guide](./docs/CONFIGURATION.md).
|
|
338
|
+
|
|
339
|
+
### 🤖 MCP Integration Setup
|
|
340
|
+
|
|
341
|
+
Add Maestro as an MCP server to Claude Code using the modern command:
|
|
342
|
+
|
|
343
|
+
#### Local Scope (Default - only for current project, private to you)
|
|
344
|
+
```bash
|
|
345
|
+
claude mcp add maestro -s local -- npx -y @camoneart/maestro maestro-mcp-server
|
|
346
|
+
# Or without -s flag (local is default)
|
|
347
|
+
claude mcp add maestro -- npx -y @camoneart/maestro maestro-mcp-server
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
#### Project Scope (saved in .mcp.json for team sharing via version control)
|
|
351
|
+
```bash
|
|
352
|
+
claude mcp add maestro -s project -- npx -y @camoneart/maestro maestro-mcp-server
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
#### User Scope (available across all projects on the machine)
|
|
356
|
+
```bash
|
|
357
|
+
claude mcp add maestro -s user -- npx -y @camoneart/maestro maestro-mcp-server
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
#### For global installation users
|
|
361
|
+
If you've installed Maestro globally, use:
|
|
362
|
+
```bash
|
|
363
|
+
claude mcp add maestro -s user -- maestro-mcp-server
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
This will automatically configure Claude Code to use Maestro's MCP server for orchestra management at the chosen scope level.
|
|
367
|
+
|
|
368
|
+
**Note**: The traditional manual configuration in `.claude/mcp_settings.json` is no longer supported. Use the `claude mcp add` command instead.
|
|
369
|
+
|
|
370
|
+
### 🐚 Shell Completion
|
|
371
|
+
|
|
372
|
+
Maestro provides completion scripts for **bash / zsh / fish**.
|
|
373
|
+
|
|
374
|
+
| Install Method | bash | zsh / fish |
|
|
375
|
+
| -------------- | ---------------------------------------- | -------------- |
|
|
376
|
+
| Homebrew | Auto (bash requires `bash-completion@2`) | Auto |
|
|
377
|
+
| npm / pnpm | Manual (below) | Manual (below) |
|
|
378
|
+
|
|
379
|
+
#### bash manual setup (npm / pnpm installs)
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
brew install bash-completion@2 # if not installed
|
|
383
|
+
|
|
384
|
+
echo 'eval "$(mst completion bash)"' >> ~/.bashrc
|
|
385
|
+
source ~/.bashrc
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
#### zsh manual setup
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
mkdir -p ~/.zsh/completions
|
|
392
|
+
mst completion zsh > ~/.zsh/completions/_mst
|
|
393
|
+
autoload -U compinit && compinit
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
#### fish manual setup
|
|
397
|
+
|
|
398
|
+
```bash
|
|
399
|
+
mst completion fish > ~/.config/fish/completions/mst.fish
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Troubleshooting
|
|
403
|
+
|
|
404
|
+
### 🛡️ Automatic Rollback Protection
|
|
405
|
+
|
|
406
|
+
Maestro includes **intelligent automatic rollback functionality** that prevents orphaned worktrees when creation fails during post-processing steps:
|
|
407
|
+
|
|
408
|
+
**How It Works:**
|
|
409
|
+
- **Tracks Creation State**: Monitors whether worktree creation succeeded
|
|
410
|
+
- **Detects Post-Creation Failures**: Catches errors during tmux session creation, environment setup, or other post-processing
|
|
411
|
+
- **Automatic Cleanup**: Immediately removes created worktrees and branches when failures occur
|
|
412
|
+
- **Clear Feedback**: Provides user-friendly messages about cleanup process
|
|
413
|
+
- **Fallback Instructions**: Shows manual cleanup commands if automatic rollback fails
|
|
414
|
+
|
|
415
|
+
**Example:**
|
|
416
|
+
```bash
|
|
417
|
+
# If tmux session creation fails:
|
|
418
|
+
mst create feature/new-feature --tmux
|
|
419
|
+
|
|
420
|
+
# Maestro automatically cleans up:
|
|
421
|
+
⚠️ An error occurred during post-processing. Cleaning up created resources...
|
|
422
|
+
✅ Cleanup completed
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
**Benefits:**
|
|
426
|
+
- **No Orphaned Worktrees**: Maintains clean repository state even when errors occur
|
|
427
|
+
- **Better Error Recovery**: Reduces manual cleanup required after failures
|
|
428
|
+
- **Improved User Experience**: Clear feedback and recovery instructions
|
|
429
|
+
|
|
430
|
+
### ❓ Common Errors and Fixes
|
|
431
|
+
|
|
432
|
+
| Error | Likely Cause | One-line Fix |
|
|
433
|
+
| ---------------------------------------------- | --------------------------------------- | --------------------------------- |
|
|
434
|
+
| **Git is too old** <br>`fatal: unknown option` | Git < 2.22 | `brew install git` |
|
|
435
|
+
| **fzf not found** | fzf not installed | `brew install fzf` |
|
|
436
|
+
| **tmux not found** | tmux not installed | `brew install tmux` |
|
|
437
|
+
| **Too many tmux panes** <br>`Unable to create session with N panes due to terminal size` | Terminal window too small for requested panes | Resize window or reduce panes (max: 10 horizontal, 15 vertical) |
|
|
438
|
+
| **GitHub PR/Issue not found** <br>`Error: PR/Issue #999 が見つかりません` | Specified non-existent Issue/PR number | Check correct number or verify repository |
|
|
439
|
+
|
|
440
|
+
### Other error codes
|
|
441
|
+
|
|
442
|
+
| Code | Cause | Fix |
|
|
443
|
+
| ------------ | ---------------------- | --------------------------------------- |
|
|
444
|
+
| `ENOENT` | Git binary not found | Check PATH or reinstall Git |
|
|
445
|
+
|
|
446
|
+
### ⚠️ CLI Option Validation and Error Handling
|
|
447
|
+
|
|
448
|
+
Maestro now includes **strict CLI option validation** to prevent execution with invalid options:
|
|
449
|
+
|
|
450
|
+
**Immediate Exit on Invalid Options**:
|
|
451
|
+
- **Early Detection**: Commands exit immediately when unknown or invalid options are provided
|
|
452
|
+
- **Prevents Execution**: Commands will not proceed with any operations when invalid options are detected
|
|
453
|
+
- **Clear Error Messages**: Specific feedback about which options are invalid
|
|
454
|
+
|
|
455
|
+
**Example**:
|
|
456
|
+
```bash
|
|
457
|
+
# Invalid option provided:
|
|
458
|
+
mst create feature/test --invalid-option value
|
|
459
|
+
|
|
460
|
+
# Output:
|
|
461
|
+
error: unknown option '--invalid-option'
|
|
462
|
+
|
|
463
|
+
# Command exits with error code 1 - no resources created
|
|
464
|
+
```
|
|
465
|
+
|
|
466
|
+
**Benefits**:
|
|
467
|
+
- **Prevents Unintended Operations**: Commands won't execute with typos in option names
|
|
468
|
+
- **Clean Exit**: Immediate feedback with error code 1
|
|
469
|
+
- **Better Developer Experience**: Immediate feedback about command usage errors
|
|
470
|
+
|
|
471
|
+
### ⚠️ Directory Existence Checking and Interactive Handling
|
|
472
|
+
|
|
473
|
+
Maestro includes **intelligent directory existence checking** with interactive resolution options when creating worktrees:
|
|
474
|
+
|
|
475
|
+
**Smart Directory Management**:
|
|
476
|
+
- **Early Detection**: Checks if target directory already exists before worktree creation
|
|
477
|
+
- **Interactive Resolution**: Presents user with multiple resolution options when conflicts occur
|
|
478
|
+
- **Clean Handling**: Ensures consistent behavior across create, github, and review commands
|
|
479
|
+
- **Safe Operations**: All operations include confirmation prompts and clear feedback
|
|
480
|
+
|
|
481
|
+
**Available Resolution Options**:
|
|
482
|
+
When a directory already exists, Maestro offers these interactive choices:
|
|
483
|
+
- **Delete and Recreate**: Removes existing directory and creates fresh worktree
|
|
484
|
+
- **Use Alternative Name**: Automatically generates unique directory name (e.g., `branch-name-2`)
|
|
485
|
+
- **Cancel Operation**: Safely exits without making any changes
|
|
486
|
+
|
|
487
|
+
**Enhanced User Experience**:
|
|
488
|
+
```bash
|
|
489
|
+
# Example interaction when directory exists:
|
|
490
|
+
mst create feature/new-feature
|
|
491
|
+
|
|
492
|
+
⚠️ Directory '../feature/new-feature' already exists
|
|
493
|
+
|
|
494
|
+
? How would you like to proceed?
|
|
495
|
+
❯ Delete existing directory and create new
|
|
496
|
+
Use alternative name (feature/new-feature-2)
|
|
497
|
+
Cancel
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
**Benefits**:
|
|
501
|
+
- **Prevents Conflicts**: No more worktree creation failures due to existing directories
|
|
502
|
+
- **User Control**: Clear choices for handling existing directories
|
|
503
|
+
- **Automatic Alternatives**: Smart generation of alternative names when needed
|
|
504
|
+
- **Safe Cancellation**: Easy exit option when conflicts can't be resolved
|
|
505
|
+
|
|
506
|
+
### ⚠️ tmux Multi-Pane Validation and Error Handling
|
|
507
|
+
|
|
508
|
+
Maestro also includes **early validation for tmux pane creation** to prevent resource waste and provide better user experience:
|
|
509
|
+
|
|
510
|
+
**Smart Pre-Validation**:
|
|
511
|
+
- **Early Detection**: Validates pane count limits BEFORE creating any resources (worktree, branch, tmux session)
|
|
512
|
+
- **Prevents Resource Creation**: Command exits with error code 1 immediately when validation fails
|
|
513
|
+
- **No Cleanup Needed**: Since no resources are created, no rollback is required
|
|
514
|
+
- **Maximum Limits**: 10 panes for horizontal splits, 15 panes for vertical splits
|
|
515
|
+
|
|
516
|
+
**Enhanced Error Messages**:
|
|
517
|
+
```bash
|
|
518
|
+
# Early validation error message:
|
|
519
|
+
Error: Unable to create session with 20 panes due to terminal size. Please resize your terminal window or reduce the number of panes. (horizontal split)
|
|
520
|
+
|
|
521
|
+
# Command exits immediately - no resources created
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
**Quick Solutions**:
|
|
525
|
+
```bash
|
|
526
|
+
# If this fails due to pane limit:
|
|
527
|
+
mst create feature/api --tmux-h-panes 20
|
|
528
|
+
|
|
529
|
+
# Reduce to allowed limit:
|
|
530
|
+
mst create feature/api --tmux-h-panes 8
|
|
531
|
+
|
|
532
|
+
# Switch to vertical for higher limits:
|
|
533
|
+
mst create feature/api --tmux-v-panes 12 --tmux-layout main-vertical
|
|
534
|
+
|
|
535
|
+
# Use space-efficient layouts:
|
|
536
|
+
mst create feature/api --tmux-h-panes 6 --tmux-layout tiled
|
|
537
|
+
```
|
|
538
|
+
|
|
539
|
+
**Validation Benefits**:
|
|
540
|
+
- **Clean Exit**: Command exits with error code 1 when validation fails
|
|
541
|
+
- **No Resource Waste**: Prevents creation of worktrees that would need cleanup
|
|
542
|
+
- **Better Performance**: Immediate feedback without waiting for tmux operations
|
|
543
|
+
- **Clear Guidance**: Specific error messages with actionable solutions
|
|
544
|
+
|
|
545
|
+
**Pane Limits**:
|
|
546
|
+
- **Horizontal splits**: Maximum 10 panes (smaller screen space per pane)
|
|
547
|
+
- **Vertical splits**: Maximum 15 panes (more vertical space available)
|
|
548
|
+
- **Validation triggers**: Only for multi-pane options (`--tmux-h-panes` > 2, `--tmux-v-panes` > 2)
|
|
549
|
+
|
|
550
|
+
If the issue persists, search or open a new ticket in the [Issues](https://github.com/camoneart/maestro/issues).
|
|
551
|
+
|
|
552
|
+
### 🔍 Debug Mode
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
# Verbose logs to console
|
|
556
|
+
DEBUG=mst:* mst create feature/debug
|
|
557
|
+
|
|
558
|
+
# Save detailed logs to a file
|
|
559
|
+
DEBUG=mst:* mst review --auto-flow &> maestro-debug.log
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
## Contributing
|
|
563
|
+
|
|
564
|
+
### 🤝 Contribution Workflow
|
|
565
|
+
|
|
566
|
+
1. Open an [Issue](https://github.com/camoneart/maestro/issues) for bugs or feature requests.
|
|
567
|
+
2. Fork the repo and create a branch like `feat/your-topic`.
|
|
568
|
+
3. Run `pnpm lint && pnpm test` and make sure everything passes.
|
|
569
|
+
4. Commit with **Conventional Commits**.
|
|
570
|
+
5. Open a Pull Request and fill out the template.
|
|
571
|
+
|
|
572
|
+
See the [Contributing Guide](/CONTRIBUTING.md) and [Code of Conduct](/CODE_OF_CONDUCT.md) for details.
|
|
573
|
+
|
|
574
|
+
## License
|
|
575
|
+
|
|
576
|
+
Licensed under the [MIT License](./LICENSE).
|