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
4 changes: 2 additions & 2 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ Set `provider: "none"` to strip all ticket steps from `ticket`/`sprint`/review f
| `team` | — | Linear team name/key or GitHub org. |
| `project` | — | Linear project name. |
| `ticketPrefix` | — | e.g. `INC-`; detects ticket IDs in branches/PR titles. |
| `labelMapFile` | `.claude/label-mapping.md` | PR/tracker label source of truth. |
| `labelMapFile` | `.claude/label-mapping.md` | PR/tracker label source of truth. On an install without the `claude-code` target the doc lives at `.rig/label-mapping.md`, and the installer writes that path instead. |
| `githubIntegration` | `false` | If true, GitHub drives PR/merge transitions (In Progress on PR-open, In Review, Done on merge); skills set only the start-of-work In Progress, which GitHub can't observe before a PR exists. |

## `review`
| Key | Default | Meaning |
|---|---|---|
| `patternsFile` | `.claude/REVIEWER.md` | The P0–P3 review catalog. |
| `patternsFile` | `.claude/REVIEWER.md` | The P0–P3 review catalog. On an install without the `claude-code` target the catalog lives at `.rig/REVIEWER.md`, and the installer writes that path instead. |
| `bot` | `none` | `codex`\|`claude`\|`bugbot`\|`none`. Which PR bot `rig-review fix` polls/re-triggers. |
| `botRetrigger` | — | Comment that re-triggers the bot, e.g. `@codex review`. |
| `maxRounds` | `5` | Max fix↔re-review rounds before handing to a human. |
Expand Down
10 changes: 10 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,23 @@ copy_no_clobber() {
}

# --- Shared: project profile (agent-agnostic) --------------------------------
# The example profile carries .claude/ paths for the two support docs. Without
# the claude-code target those files were installed under .rig/, so ship the
# profile pointing where the docs actually are rather than at a dead path.
write_profile() {
if [[ -e "$TARGET/.rig/config.json" ]]; then
echo " skip (exists): .rig/config.json"
else
mkdir -p "$TARGET/.rig"
cp "$RIG_DIR/rig.config.example.json" "$TARGET/.rig/config.json"
cp "$RIG_DIR/rig.schema.json" "$TARGET/.rig/schema.json"
if [[ " ${TARGETS[*]} " != *" claude-code "* ]]; then
sed -i.bak -e 's|"\.claude/REVIEWER\.md"|".rig/REVIEWER.md"|' \
-e 's|"\.claude/label-mapping\.md"|".rig/label-mapping.md"|' \
"$TARGET/.rig/config.json"
rm -f "$TARGET/.rig/config.json.bak"
echo " (no claude-code target: patternsFile/labelMapFile point at .rig/)"
fi
echo " wrote: .rig/config.json (EDIT THIS — it currently holds the example values)"
fi
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/setup-worktree.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ esac
# Optional session name (do it early so any job list updates even if a later
# step is slow). set-session-name.sh ships alongside this script; it's
# Claude-Code-only and no-ops elsewhere. Resolve it as this script's sibling so
# it works under .claude/scripts/ or rig/scripts/.
# it works under .claude/scripts/ or .rig/scripts/.
if [ -n "$SESSION_NAME" ]; then
set_name="$(cd "$(dirname "${BASH_SOURCE[0]:-$0}")" && pwd)/set-session-name.sh"
if [ -x "$set_name" ]; then
Expand Down
37 changes: 29 additions & 8 deletions skills/rig-worktree/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ ad-hoc branches, parallel experiments) and that implement-style flows and
prune/rig-tidy steps can delegate to.

The logic lives in two scripts so the invariants live in one place:
`.claude/scripts/setup-worktree.sh` (create) and
`.claude/scripts/remove-worktree.sh` (teardown). **Creation encodes
`<SCRIPTS>/setup-worktree.sh` (create) and
`<SCRIPTS>/remove-worktree.sh` (teardown), where `<SCRIPTS>` is resolved
per install (see *Configuration*). **Creation encodes
three invariants that bite if skipped** — fetch-before-branch (stale
local refs silently start you on a pre-merge tip), env symlinks (missing
secrets read as flaky/timeout test failures, not "config not found"),
Expand All @@ -26,6 +27,18 @@ inline; call the scripts.

## Configuration

**Script location (`<SCRIPTS>`).** Where the helper scripts live depends on
which target installed them, so resolve — don't assume — from the repo root
(`git rev-parse --show-toplevel`), first hit wins:

1. `.claude/scripts/` — the `claude-code` target (on a dual-target install this
is a symlink at `.rig/scripts/`, so either entry finds the same file).
2. `.rig/scripts/` — the `agents-md` target (Codex, Cursor, Gemini CLI, …),
where there is no `.claude/` at all.

If neither holds `setup-worktree.sh`, say so and stop rather than
reimplementing the script inline — its invariants are the whole point.

Reads `.rig/config.json` (missing keys → defaults):

| Key | Default | Used for |
Expand Down Expand Up @@ -62,7 +75,9 @@ only required argument.
`.claude/worktrees/<last segment of branch>` (so `alice/feat-521-foo`
→ `.claude/worktrees/feat-521-foo`). This is the directory the Claude Code
harness manages, so a worktree created here can be adopted natively via
`EnterWorktree`/`ExitWorktree`.
`EnterWorktree`/`ExitWorktree`. The default is unchanged on non-Claude
agents — it's then just a path with no special meaning, so pass `--path` if
you'd rather not have a `.claude/` dir in the repo.
- `--reuse` — if the worktree/branch already exists, fetch and
hard-reset it to `<base>` instead of failing. Use this for a
"reuse a child worktree" path.
Expand Down Expand Up @@ -93,18 +108,24 @@ only required argument.
from the ticket title — fetch it if you have a tracker, else ask).

3. **Run the script** from the repo root, passing the resolved base and
install command:
install command. Resolve `<SCRIPTS>` first (see *Configuration*):

```bash
"$(git rev-parse --show-toplevel)/.claude/scripts/setup-worktree.sh" \
ROOT="$(git rev-parse --show-toplevel)"
for d in "$ROOT/.claude/scripts" "$ROOT/.rig/scripts"; do
[ -x "$d/setup-worktree.sh" ] && SCRIPTS="$d" && break
done
[ -n "$SCRIPTS" ] || { echo "rig scripts not found under .claude/ or .rig/" >&2; exit 1; }

"$SCRIPTS/setup-worktree.sh" \
<branch> [--base <baseRef>] [--install-cmd "<install cmd>"] [--reuse]
```

The script prints progress to stderr and the **absolute worktree
path as the last line of stdout**, so capture it:

```bash
WT=$("$(git rev-parse --show-toplevel)/.claude/scripts/setup-worktree.sh" \
WT=$("$SCRIPTS/setup-worktree.sh" \
alice/feat-521-rename --base origin/main --install-cmd "bun install" | tail -1)
```

Expand Down Expand Up @@ -142,10 +163,10 @@ End with a one-line hint, e.g. *"2 worktrees on MERGED branches —

Safely tear a worktree down via the shared script. Dirty worktrees are
**skipped, not removed** (a skip is a normal outcome, not an error) —
pass `--force-dirty` to override.
pass `--force-dirty` to override. Resolve `<SCRIPTS>` as in *Create* step 3:

```bash
"$(git rev-parse --show-toplevel)/.claude/scripts/remove-worktree.sh" \
"$SCRIPTS/remove-worktree.sh" \
<branch|path> [--force-dirty] [--keep-branch]
```

Expand Down
Loading