flow-status ยท diff

git:20260802.4726ccf to git:20260811.98c8688

1 added, 1 removed. Audit A to A.

---
name: "flow-status"
description: "Flow: Status of Active Worktrees - Show all active worktrees with their issue, branch, dirty state, and PR status."
---
<!-- GENERATED by claude-power-pack - scripts/codex-skill-sync.py; edit .claude/commands/flow/status.md instead -->
## Codex harness adaptations
Generated from a Claude Code command. Where the procedure references these Claude-only surfaces, adapt as follows:
- - Native worktrees (`EnterWorktree`/`ExitWorktree` tool calls, `.claude/worktrees/` paths): use plain git instead - `git worktree add <path> -b <branch>`, work inside it, then `git worktree remove <path>` when done.
+ - Native worktrees (`EnterWorktree`/`ExitWorktree` tool calls, `.claude/worktrees/` paths): use plain git instead, with the worktree as a VISIBLE SIBLING of the repo - `git worktree add ../<repo>-<branch> -b <branch>` (or `$FLOW_WORKTREE_BASE/<repo>-<branch>` when that env var is set), work inside it, then `git worktree remove ../<repo>-<branch>` when done.
# Flow: Status of Active Worktrees
Show all active worktrees with their issue, branch, dirty state, and PR status.
## Instructions
When the user invokes `/flow-status`, perform these steps:
### Step 1: Detect Repository
```bash
REPO=$(basename "$(git rev-parse --show-toplevel)")
```
### Step 2: List Worktrees
```bash
git worktree list
```
### Step 3: For Each Worktree, Gather State
For each worktree (skip the main repo entry):
```bash
# Get branch name
BRANCH=$(git -C "$WORKTREE_PATH" branch --show-current 2>/dev/null)
# Extract issue number from branch name (issue-N-*)
ISSUE_NUM=$(echo "$BRANCH" | grep -oP 'issue-\K[0-9]+' || echo "")
# Check for uncommitted changes
DIRTY=$(git -C "$WORKTREE_PATH" status --porcelain 2>/dev/null | wc -l)
# Check for unpushed commits
UNPUSHED=$(git -C "$WORKTREE_PATH" rev-list --count origin/main..HEAD 2>/dev/null || echo "0")
# Check PR status (if branch is pushed)
if [[ -n "$BRANCH" ]]; then
PR_INFO=$(gh pr list --head "$BRANCH" --json number,url,state --jq '.[0]' 2>/dev/null || echo "")
fi
```
### Step 4: Fetch Issue Titles
For each detected issue number:
```bash
ISSUE_TITLE=$(gh issue view "$ISSUE_NUM" --json title --jq '.title' 2>/dev/null || echo "Unknown")
```
### Step 5: Output
```markdown
## Flow Status - {repo}
| Worktree | Issue | Branch | Status | PR |
|----------|-------|--------|--------|----|
| ../my-repo-issue-42-fix-login | #42 Fix login bug | issue-42-fix-login | 3 dirty files, 2 unpushed | - |
| ../my-repo-issue-55-add-tests | #55 Add tests | issue-55-add-tests | Clean | PR #78 (OPEN) |
### Suggestions
- **#42**: Has uncommitted work - commit or stash before switching
- **#55**: PR is open - check for reviews, then `/flow-merge`
```
### Step 6: Detect Stale Branches
Check for local branches that may need cleanup:
```bash
# Count local issue-* branches with no active worktree
WORKTREE_BRANCHES=$(git worktree list --porcelain | grep "^branch " | sed 's|branch refs/heads/||')
STALE_COUNT=0
for branch in $(git branch | grep 'issue-' | sed 's/^[ *]*//'); do
echo "$WORKTREE_BRANCHES" | grep -q "^${branch}$" && continue
STALE_COUNT=$((STALE_COUNT + 1))
done
# Check for prunable worktree references
PRUNABLE=$(git worktree list --porcelain | grep -c "prunable" || echo "0")
```
If stale branches or prunable references exist, append to output:
```markdown
### Cleanup Available
- {N} local issue branches with no active worktree
- {M} stale worktree references
Run `/flow-cleanup` to remove stale branches and references.
```
## Notes
- Worktrees are visible siblings outside the repo (issue #627): `git worktree list` shows them at `<parent>/<repo>-<branch>`, or under `$FLOW_WORKTREE_BASE` when set - not `.claude/worktrees/`
- Worktrees on `main` or non-issue branches are listed but marked as "(not issue-linked)"
- If no worktrees exist besides main, report "No active worktrees. Run `/flow-start <issue>` to begin."
- Keep output concise - this is a quick status check
- Stale branch detection helps identify cleanup opportunities