|
| 1 | +--- |
| 2 | +description: Set up a containerized worktree for a GitHub issue or PR |
| 3 | +--- |
| 4 | + |
| 5 | +Set up a containerized worktree, then ask the user to re-open the agent from it. |
| 6 | + |
| 7 | +## Input |
| 8 | + |
| 9 | +The user provided: `$ARGUMENTS` |
| 10 | + |
| 11 | +This can be: |
| 12 | +- **Issue URL**: contains `/issues/` (e.g. `https://github.com/frontman-ai/frontman/issues/462`) |
| 13 | +- **Issue number**: a plain number (e.g. `462`) |
| 14 | +- **PR URL**: contains `/pull/` (e.g. `https://github.com/frontman-ai/frontman/pull/99`) |
| 15 | +- **PR number**: prefixed with `#` or context makes it clear it's a PR |
| 16 | + |
| 17 | +## Steps |
| 18 | + |
| 19 | +### 1. Detect input type and determine branch name |
| 20 | + |
| 21 | +- **Issue** (contains `/issues/` or is a plain number): |
| 22 | + ```bash |
| 23 | + gh issue view <NUMBER> --json number,title,body,labels |
| 24 | + ``` |
| 25 | + Branch name: `issue-<NUMBER>-<short-slug>` (slug: max 4 words from title, kebab-case) |
| 26 | + |
| 27 | +- **PR** (contains `/pull/`): |
| 28 | + ```bash |
| 29 | + gh pr view <NUMBER> --json number,title,body,headRefName,labels |
| 30 | + ``` |
| 31 | + Branch name: use the PR's `headRefName` as-is. |
| 32 | + Fetch the branch: `git fetch origin <branch-name>` |
| 33 | + |
| 34 | +### 2. Set up containerized worktree |
| 35 | + |
| 36 | +1. Check infra: `make infra-status` — run `make infra-up` if needed |
| 37 | +2. Check if pod already exists: `make worktree-pod-list` |
| 38 | + - If running → skip creation |
| 39 | + - If stopped → `make worktree-pod-start BRANCH=<branch-name>` |
| 40 | + - If missing → `make worktree-pod-create BRANCH=<branch-name>` |
| 41 | +3. Verify: `make worktree-pod-list` |
| 42 | + |
| 43 | +### 3. Tell the user to re-open the agent |
| 44 | + |
| 45 | +Print this message (fill in the branch name): |
| 46 | + |
| 47 | +``` |
| 48 | +Worktree is ready. To start working, open your agent from the worktree directory: |
| 49 | +
|
| 50 | + cd .worktrees/<branch-name> |
| 51 | + # then start your agent (claude, opencode, etc.) |
| 52 | +
|
| 53 | +Start the dev servers in another terminal: |
| 54 | +
|
| 55 | + make worktree-pod-dev BRANCH=<branch-name> |
| 56 | +``` |
| 57 | + |
| 58 | +**Do NOT attempt to implement anything.** The agent cannot operate on files in the worktree from the repo root. The user must re-open the agent from the worktree directory. |
0 commit comments