@axelgar/opentree 0.0.0 โ 0.1.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +332 -0
- package/package.json +5 -5
package/README.md
ADDED
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
# opentree
|
|
2
|
+
|
|
3
|
+
**Orchestrate parallel AI coding sessions in isolated git worktrees.**
|
|
4
|
+
|
|
5
|
+
Think [Conductor](https://conductor.build), but for the terminal.
|
|
6
|
+
|
|
7
|
+
opentree is a cross-platform CLI tool that manages multiple AI coding agent sessions. Each session runs in an isolated git worktree with its own branch, orchestrated via tmux. Perfect for working on multiple features/fixes simultaneously without context-switching overhead.
|
|
8
|
+
|
|
9
|
+
<img src="docs/screenshot.png" style="width: 100%;max-width: 100%;">
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- **๐ณ Isolated Workspaces**: Each workspace = git worktree + branch + tmux window
|
|
14
|
+
- **๐ค Agent Integration**: Launch OpenCode (or other agents) automatically in each workspace
|
|
15
|
+
- **๐ TUI Dashboard**: Interactive terminal UI for managing workspaces (press `?` for help)
|
|
16
|
+
- **๐ Parallel Development**: Work on multiple branches simultaneously without checkout overhead
|
|
17
|
+
- **๐ Diff Viewer**: Review changes before committing
|
|
18
|
+
- **๐ PR Creation**: Create GitHub PRs directly from the TUI with auto-generated title and body
|
|
19
|
+
- **๐ Issue Workflow**: Create a workspace directly from a GitHub issue number
|
|
20
|
+
- **โ
CI Status**: Live CI check status displayed per workspace
|
|
21
|
+
- **๐ Filter & Sort**: Filter workspaces by name, sort by name/age/activity/PR status
|
|
22
|
+
- **๐งน Clean Lifecycle**: Archive workspaces after merge, keeping your repo tidy
|
|
23
|
+
- **โจ๏ธ Shell Completion**: Tab completion for workspace names in bash, zsh, and fish
|
|
24
|
+
|
|
25
|
+
## Requirements
|
|
26
|
+
|
|
27
|
+
- **Git** (2.5+) - for worktree support
|
|
28
|
+
- **tmux** (2.0+) - for session orchestration
|
|
29
|
+
- **OpenCode** (optional) - default coding agent ([install](https://github.com/anomalyco/opencode))
|
|
30
|
+
- **GitHub CLI** (`gh`) (optional) - for PR creation and issue fetching ([install](https://cli.github.com/))
|
|
31
|
+
|
|
32
|
+
## Installation
|
|
33
|
+
|
|
34
|
+
### Homebrew (macOS/Linux)
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
brew install axelgar/tap/opentree
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### npm
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npm install -g @axelgar/opentree
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### From Source
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
git clone https://github.com/axelgar/opentree.git
|
|
50
|
+
cd opentree
|
|
51
|
+
go build -o opentree ./cmd/opentree
|
|
52
|
+
sudo mv opentree /usr/local/bin/
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Using Go Install
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
go install github.com/axelgar/opentree/cmd/opentree@latest
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Quick Start
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
# Navigate to any git repository
|
|
65
|
+
cd ~/my-project
|
|
66
|
+
|
|
67
|
+
# Launch TUI dashboard (interactive mode)
|
|
68
|
+
opentree
|
|
69
|
+
|
|
70
|
+
# Or use CLI commands directly
|
|
71
|
+
opentree new feat/add-auth # Create workspace
|
|
72
|
+
opentree issue 42 # Create workspace from GitHub issue #42
|
|
73
|
+
opentree list # List all workspaces
|
|
74
|
+
opentree attach feat/add-auth # Attach to tmux window
|
|
75
|
+
opentree diff feat/add-auth # Review changes
|
|
76
|
+
opentree pr feat/add-auth # Create GitHub PR
|
|
77
|
+
opentree delete feat/add-auth # Clean up workspace
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Usage
|
|
81
|
+
|
|
82
|
+
### TUI Mode (Interactive)
|
|
83
|
+
|
|
84
|
+
Run `opentree` without arguments to launch the interactive dashboard:
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
opentree
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Navigation:**
|
|
91
|
+
|
|
92
|
+
- `โ`/`k` - move up
|
|
93
|
+
- `โ`/`j` - move down
|
|
94
|
+
|
|
95
|
+
**Actions:**
|
|
96
|
+
|
|
97
|
+
- `n` - Create new workspace (prompts for branch name, then base branch)
|
|
98
|
+
- `i` - Create workspace from a GitHub issue number
|
|
99
|
+
- `Enter` - Attach to selected workspace
|
|
100
|
+
- `d` - Show diff for selected workspace
|
|
101
|
+
- `p` - Create PR for selected workspace (auto-generates title and body from commits)
|
|
102
|
+
- `o` - Open PR in browser
|
|
103
|
+
- `x` - Delete selected workspace (shows diff confirmation if uncommitted changes)
|
|
104
|
+
- `space` - Toggle multi-select on current workspace
|
|
105
|
+
- `/` - Filter workspaces by name
|
|
106
|
+
- `s` - Cycle sort order (name โ age โ activity โ PR)
|
|
107
|
+
- `E` - Toggle error log
|
|
108
|
+
- `?` - Toggle full help
|
|
109
|
+
- `q` - Quit
|
|
110
|
+
|
|
111
|
+
The TUI also shows a live **agent output preview** for the selected workspace and **CI check status** badges for open PRs.
|
|
112
|
+
|
|
113
|
+
### CLI Mode (Direct Commands)
|
|
114
|
+
|
|
115
|
+
#### Create a Workspace
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
opentree new <branch-name> [flags]
|
|
119
|
+
|
|
120
|
+
# Examples
|
|
121
|
+
opentree new feat/user-auth # Create workspace with branch
|
|
122
|
+
opentree new fix/login-bug --base dev # Branch off 'dev' instead of 'main'
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Creates:
|
|
126
|
+
|
|
127
|
+
1. Git worktree at `.opentree/<branch-name>/`
|
|
128
|
+
2. New branch (or checks out existing)
|
|
129
|
+
3. tmux window in `opentree-<repo>` session
|
|
130
|
+
4. Launches the configured coding agent in the workspace
|
|
131
|
+
|
|
132
|
+
#### Create Workspace from GitHub Issue
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
opentree issue <number> [flags]
|
|
136
|
+
|
|
137
|
+
# Examples
|
|
138
|
+
opentree issue 42 # Workspace from issue #42
|
|
139
|
+
opentree issue 42 --base dev # Branch off 'dev'
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Fetches the issue from GitHub, auto-generates a branch name (e.g. `issue-42-add-dark-mode`), and writes a `TASK.md` file with the issue title, labels, and description into the worktree so the AI agent can start working immediately. Requires the `gh` CLI.
|
|
143
|
+
|
|
144
|
+
#### List Workspaces
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
opentree list
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
Shows table with: branch name, status, last modified time.
|
|
151
|
+
|
|
152
|
+
#### Attach to Workspace
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
opentree attach <branch-name>
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Attaches to the workspace's tmux window. Detach with `Ctrl+b d`.
|
|
159
|
+
|
|
160
|
+
#### Show Diff
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
opentree diff <branch-name>
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Shows `git diff` between workspace and base branch.
|
|
167
|
+
|
|
168
|
+
#### Create Pull Request
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
opentree pr <branch-name> [flags]
|
|
172
|
+
|
|
173
|
+
# Examples
|
|
174
|
+
opentree pr feat/user-auth # Interactive prompts
|
|
175
|
+
opentree pr feat/user-auth --title "Add user auth" --body "..." # Non-interactive
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Requires GitHub CLI (`gh`) to be authenticated.
|
|
179
|
+
|
|
180
|
+
#### Delete Workspace
|
|
181
|
+
|
|
182
|
+
```bash
|
|
183
|
+
opentree delete <branch-name>
|
|
184
|
+
|
|
185
|
+
# Examples
|
|
186
|
+
opentree delete feat/user-auth
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Removes the worktree, kills the tmux window, and deletes the branch. If uncommitted changes are detected, a diff is shown and confirmation is required before proceeding.
|
|
190
|
+
|
|
191
|
+
#### Install Shell Completion
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
opentree install-completion
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Auto-detects your shell (zsh, bash, or fish) and installs tab completion. After installation, workspace names will be completed when using `attach`, `delete`, `pr`, and `diff` commands.
|
|
198
|
+
|
|
199
|
+
## Configuration
|
|
200
|
+
|
|
201
|
+
Create `opentree.toml` in your repo root or `~/.config/opentree/opentree.toml`. opentree searches up the directory tree for the config file, similar to how git finds `.git`.
|
|
202
|
+
|
|
203
|
+
```toml
|
|
204
|
+
[worktree]
|
|
205
|
+
base_dir = ".opentree" # Where to store worktrees (relative to repo root)
|
|
206
|
+
default_base = "main" # Default base branch
|
|
207
|
+
|
|
208
|
+
[agent]
|
|
209
|
+
command = "opencode" # Command to launch agent
|
|
210
|
+
args = [] # Additional arguments
|
|
211
|
+
|
|
212
|
+
[tmux]
|
|
213
|
+
session_prefix = "opentree" # Prefix for the tmux session name
|
|
214
|
+
|
|
215
|
+
[github]
|
|
216
|
+
auto_push = false # Auto-push branch before creating PR
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
### Using Different Agents
|
|
220
|
+
|
|
221
|
+
To use a different coding agent instead of OpenCode:
|
|
222
|
+
|
|
223
|
+
```toml
|
|
224
|
+
[agent]
|
|
225
|
+
command = "claude" # Or "aider", "cursor", etc.
|
|
226
|
+
args = ["--some-flag"]
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
Or override per workspace:
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
OPENTREE_AGENT_COMMAND="claude" opentree new feat/my-feature
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## How It Works
|
|
236
|
+
|
|
237
|
+
1. **Worktrees**: Git worktrees allow multiple checkouts of the same repo in different directories. Each workspace lives in `.opentree/<branch-name>/`.
|
|
238
|
+
|
|
239
|
+
2. **tmux Orchestration**: A single tmux session (`opentree-<repo>`) manages all workspaces. Each workspace = one tmux window. Attach to work, detach to switch.
|
|
240
|
+
|
|
241
|
+
3. **State Persistence**: Workspace metadata (branch, created time, agent, issue number) stored in `.opentree/state.json`.
|
|
242
|
+
|
|
243
|
+
4. **Agent Integration**: When creating a workspace, opentree launches your configured agent (default: OpenCode) inside the tmux window, ready to code.
|
|
244
|
+
|
|
245
|
+
5. **Issue Context**: When using `opentree issue`, a `TASK.md` file is written to the worktree containing the issue details, giving the AI agent immediate context.
|
|
246
|
+
|
|
247
|
+
## Workflow Example
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
# Start working on a feature
|
|
251
|
+
opentree new feat/add-dark-mode
|
|
252
|
+
|
|
253
|
+
# Or pick up a GitHub issue directly
|
|
254
|
+
opentree issue 42
|
|
255
|
+
|
|
256
|
+
# (tmux attaches automatically, agent launches)
|
|
257
|
+
# (work with AI agent, make changes...)
|
|
258
|
+
# (detach with Ctrl+b d when done)
|
|
259
|
+
|
|
260
|
+
# While that's building, start a bugfix in parallel
|
|
261
|
+
opentree new fix/header-overflow
|
|
262
|
+
|
|
263
|
+
# (work on bugfix...)
|
|
264
|
+
# (detach)
|
|
265
|
+
|
|
266
|
+
# Review changes for first feature
|
|
267
|
+
opentree diff feat/add-dark-mode
|
|
268
|
+
|
|
269
|
+
# Create PR when ready (auto-generates title and body from commits)
|
|
270
|
+
opentree pr feat/add-dark-mode
|
|
271
|
+
|
|
272
|
+
# Clean up after merge
|
|
273
|
+
opentree delete feat/add-dark-mode
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
## Troubleshooting
|
|
277
|
+
|
|
278
|
+
### "Error: not a git repository"
|
|
279
|
+
|
|
280
|
+
opentree must be run from inside a git repository. Navigate to your project root first.
|
|
281
|
+
|
|
282
|
+
### "Error: tmux not found"
|
|
283
|
+
|
|
284
|
+
Install tmux:
|
|
285
|
+
|
|
286
|
+
- **macOS**: `brew install tmux`
|
|
287
|
+
- **Ubuntu/Debian**: `sudo apt install tmux`
|
|
288
|
+
- **Arch**: `sudo pacman -S tmux`
|
|
289
|
+
|
|
290
|
+
### "Error: opencode not found"
|
|
291
|
+
|
|
292
|
+
Install OpenCode from [github.com/anomalyco/opencode](https://github.com/anomalyco/opencode), or configure a different agent in `opentree.toml`.
|
|
293
|
+
|
|
294
|
+
### "Error: gh not found"
|
|
295
|
+
|
|
296
|
+
Install GitHub CLI from [cli.github.com](https://cli.github.com/), then authenticate:
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
gh auth login
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### Workspaces not appearing in TUI
|
|
303
|
+
|
|
304
|
+
State file might be corrupted. Check `.opentree/state.json` or delete and recreate workspaces.
|
|
305
|
+
|
|
306
|
+
## Contributing
|
|
307
|
+
|
|
308
|
+
Contributions welcome! Please open an issue or PR.
|
|
309
|
+
|
|
310
|
+
### Development Setup
|
|
311
|
+
|
|
312
|
+
```bash
|
|
313
|
+
git clone https://github.com/axelgar/opentree.git
|
|
314
|
+
cd opentree
|
|
315
|
+
go mod download
|
|
316
|
+
go build -o opentree ./cmd/opentree
|
|
317
|
+
./opentree --help
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Architecture
|
|
321
|
+
|
|
322
|
+
See [PLAN.md](PLAN.md) for detailed architecture documentation.
|
|
323
|
+
|
|
324
|
+
## License
|
|
325
|
+
|
|
326
|
+
MIT License - see [LICENSE](LICENSE) for details.
|
|
327
|
+
|
|
328
|
+
## Acknowledgments
|
|
329
|
+
|
|
330
|
+
- Inspired by [Conductor.build](https://conductor.build) by Sahil Lavingia
|
|
331
|
+
- Built with [Bubble Tea](https://github.com/charmbracelet/bubbletea) TUI framework
|
|
332
|
+
- Integrates with [OpenCode](https://github.com/anomalyco/opencode) AI coding agent
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axelgar/opentree",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.14",
|
|
4
4
|
"description": "Git worktree manager CLI for orchestrating parallel AI coding sessions",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"bin/opentree"
|
|
16
16
|
],
|
|
17
17
|
"optionalDependencies": {
|
|
18
|
-
"@axelgar/opentree-linux-x64": "0.
|
|
19
|
-
"@axelgar/opentree-linux-arm64": "0.
|
|
20
|
-
"@axelgar/opentree-darwin-x64": "0.
|
|
21
|
-
"@axelgar/opentree-darwin-arm64": "0.
|
|
18
|
+
"@axelgar/opentree-linux-x64": "0.1.14",
|
|
19
|
+
"@axelgar/opentree-linux-arm64": "0.1.14",
|
|
20
|
+
"@axelgar/opentree-darwin-x64": "0.1.14",
|
|
21
|
+
"@axelgar/opentree-darwin-arm64": "0.1.14"
|
|
22
22
|
},
|
|
23
23
|
"engines": {
|
|
24
24
|
"node": ">=18"
|