Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .claude/skills/git-workflow/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ mise run git:sync # Sync current branch after base PR merge
4. Push -> git push -u origin feature/your-feature
5. PR -> gh pr create -a "@me" -t "feat: ..."
6. Open -> mise run git:open-pr <pr#> (CI wait -> browser -> merge watch -> cleanup)
⚠ Run ONCE after final push. If CI fails, stop watcher -> fix -> push -> relaunch.
7. Cleanup -> (auto: merge detected -> git:cleanup runs)
```

Expand All @@ -59,11 +60,17 @@ Claude: [Bash(run_in_background=true)] mise run git:open-pr -- <pr#>

3 phases run automatically:
1. **CI wait** — `gh pr checks --watch` waits for CI to pass
2. **Open in browser** — Opens PR page in default browser
2. **Open in browser** — Uses `scripts/open-url.local.sh` if present (gitignored), else default browser
3. **Merge watch** — Polls PR state every 30s
- MERGED -> macOS notification + `mise run git:cleanup` -> exit
- CLOSED -> message -> exit

**Singleton rule — only ONE watcher per PR:**
- `git:open-pr` must run **only once** per PR — after the final push, when no more changes are expected.
- If CI fails and you need to push a fix: **stop the existing watcher** with `TaskStop` first, fix and push, then launch a new `git:open-pr`.
- Never have multiple `git:open-pr` background tasks running for the same PR.
- Use `--no-wait` to skip CI wait phase when you just want the merge watcher.

**Claude behavior**: When background task output arrives via `<system-reminder>`, Claude MUST:
1. Read the output file with `TaskOutput` or `Read`
2. Report the result to the user immediately
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ Cargo.lock
.gemini/
.codex/

# Local hooks (user-specific, not committed)
scripts/*.local.sh

/tmp/
OUTPUT.md
crates/agtrace-sdk/examples/debug/
8 changes: 7 additions & 1 deletion tasks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,14 @@ if [[ "$WAIT_CI" == true && -n "$PR_NUMBER" ]]; then
fi

# Phase 2: Open in browser
# Use local hook if available (gitignored), otherwise default browser
echo "[git:open-pr] Phase 2/3: Opening PR in browser..."
gh pr view "$PR_NUMBER" --web
OPEN_HOOK="./scripts/open-url.local.sh"
if [[ -x "$OPEN_HOOK" ]]; then
"$OPEN_HOOK" "$URL"
else
gh pr view "$PR_NUMBER" --web
fi

# Phase 3: Watch for merge
if [[ -n "$PR_NUMBER" ]]; then
Expand Down