Jelajahi Sumber

refactor(skills): fold new-lane worktree provisioning into git-ops; drop standalone skill

Skill-creation-protocol Step 0 forbids duplicating an existing skill, and git-ops already owns worktree ops (survey/create/land/prune/remove). So the lane-provisioning primitive folds into git-ops instead of a parallel worktree-ops skill.

- git-ops/scripts/new-lane.sh: fast inline lane provisioning (lane/<slug> in a sibling worktree + gitignored env-file carry-over) — the collision remedy. - git-ops/SKILL.md: documented in Worktree Operations (table row + 'Lane provisioning' subsection). - removes skills/new-lane/ (the standalone skill from 9a25e52).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
0xDarkMatter 3 minggu lalu
induk
melakukan
0982db00a4
3 mengubah file dengan 22 tambahan dan 51 penghapusan
  1. 20 1
      skills/git-ops/SKILL.md
  2. 2 1
      skills/git-ops/scripts/new-lane.sh
  3. 0 49
      skills/new-lane/SKILL.md

+ 20 - 1
skills/git-ops/SKILL.md

@@ -360,11 +360,30 @@ Worktrees are first-class in this skill. The classification is:
 | Op | Tier | How |
 |----|------|-----|
 | **Survey** | T1 | `bash scripts/worktree-survey.sh` — read-only, reports per-worktree state + drift |
-| **Create** | T2 | `git worktree add .claude/worktrees/<name> -b <branch>` via agent (respects project conventions) |
+| **New lane** | T2 (inline) | `bash scripts/new-lane.sh <slug> [base]` — fast scripted provisioning: branch `lane/<slug>` in a **sibling** worktree `<repo>-<slug>` (outside `.claude/`) + carries over gitignored env files. The one-command collision remedy — see "Lane provisioning" below |
+| **Create (bespoke)** | T2 | `git worktree add <path> -b <branch>` via agent — for non-standard layouts the script doesn't cover |
 | **Land** | T2 | Rebase worktree branch onto trunk + test + fast-forward. Multi-step procedure — see "Worktree Land Procedure" below |
 | **Prune (clean)** | T2 | `git worktree prune` for ghost entries (registered but FS-missing). Always safe, no data loss possible |
 | **Remove** | **T3** | `git worktree remove <path>` — destroys filesystem state. Requires preflight + explicit confirm per worktree |
 
+### Lane provisioning (the collision remedy)
+
+`scripts/new-lane.sh <slug> [base-branch]` is the fast, model-invocable way to isolate parallel
+work — the remedy the peer-writer guards (`session-start-unicode-scan.sh` at boot,
+`pre-write-peer-guard.sh` mid-session) point you to. It:
+
+- creates branch `lane/<slug>` in a **sibling** worktree `<repo>/../<repo>-<slug>` — outside
+  `.claude/` so headless agents can write there (see `rules/worktree-boundaries.md`) — off
+  `[base-branch]` (default: current branch);
+- **carries over gitignored env files** (`.dev.vars`, `.env*`, `.secrets`) the fresh worktree
+  would otherwise lack, so the lane runs immediately;
+- prints the worktree path on stdout (everything else on stderr), so it composes:
+  `cd "$(bash scripts/new-lane.sh hotfix main)"`;
+- refuses if the branch or path already exists — never clobbers.
+
+Run it **inline** (deterministic, non-destructive); land the lane back via the Worktree Land
+Procedure below or `fleet-ops`. Reach for it whenever two sessions would otherwise share one checkout.
+
 ### Survey-first discipline
 
 Never recommend prune/remove without first running `scripts/worktree-survey.sh`

+ 2 - 1
skills/new-lane/scripts/new-lane.sh → skills/git-ops/scripts/new-lane.sh

@@ -2,6 +2,7 @@
 # new-lane.sh — create an isolated git worktree + branch ("lane") for parallel work, carrying over
 # the gitignored env files a fresh worktree won't have. The one-command remedy when the peer-writer
 # guard fires, or any time you want to parallelise without two sessions sharing one checkout.
+# Part of the git-ops skill (Worktree Operations → "Lane provisioning").
 #
 # Usage:   new-lane.sh <slug> [base-branch]
 #   <slug>        short kebab name -> branch lane/<slug>, worktree <repo>/../<repo>-<slug>
@@ -18,7 +19,7 @@ set -euo pipefail
 
 case "${1:-}" in
    -h|--help|"")
-    sed -n '2,18p' "$0" | sed 's/^# \{0,1\}//' >&2
+    sed -n '2,19p' "$0" | sed 's/^# \{0,1\}//' >&2
     [ -z "${1:-}" ] && exit 2 || exit 0 ;;
 esac
 

+ 0 - 49
skills/new-lane/SKILL.md

@@ -1,49 +0,0 @@
----
-name: new-lane
-description: "Create an isolated git worktree + branch ('lane') for parallel work in one step, carrying over the gitignored env files a fresh worktree lacks. Use when the peer-writer guard warns that another session is editing this checkout, when you want to parallelise work without two sessions sharing one working tree, or when asked to 'spin up a worktree / lane / isolated branch'. Triggers on: new lane, isolate this work, worktree for X, parallel session without collision, peer-writer advisory, move to a worktree, spin up a lane."
-license: MIT
-allowed-tools: "Bash"
-metadata:
-  author: claude-mods
-  related-skills: "git-ops, fleet-ops"
----
-
-# New Lane
-
-The one-command remedy for the collision problem: **one writer, one worktree, one branch.** When two
-sessions share a checkout they fight over a single index/HEAD (see
-[worktree-boundaries](../../rules/worktree-boundaries.md) → "Provisioning discipline"). This skill
-spins up an isolated *lane* so parallel work never collides.
-
-Reach for it when:
-- the **peer-writer guard** fires (`session-start-unicode-scan.sh` at boot, or `pre-write-peer-guard.sh`
-  mid-session) — another session is editing this tree; move your work into its own lane;
-- you're about to start a second stream of work and don't want to share the checkout;
-- the user asks to "isolate this", "spin up a worktree/lane", or "branch this off without touching main".
-
-## Use
-
-```bash
-bash scripts/new-lane.sh <slug> [base-branch]
-```
-
-- `<slug>` → branch `lane/<slug>`, worktree at `<repo>/../<repo>-<slug>` (sibling dir — outside the
-  repo, never under `.claude/`, no long-path nesting).
-- `[base-branch]` defaults to the current branch.
-
-It creates the worktree+branch and **carries over gitignored env files** (`.dev.vars`, `.env*`,
-`.secrets`) the fresh worktree would otherwise be missing — the "right settings" that make the lane
-immediately runnable. The new worktree's absolute path is printed on stdout (everything else on
-stderr), so it composes: `cd "$(bash scripts/new-lane.sh hotfix main)"`.
-
-## After
-
-Open a Claude session with its cwd set to the printed worktree path — that session is the lane's sole
-writer. Land the lane back onto the base branch through **[fleet-ops](../fleet-ops/SKILL.md)** (the
-test-gated landing queue), not by sharing the checkout again.
-
-## Boundaries
-
-- Refuses if the branch or worktree path already exists (exit 1) — never clobbers.
-- Does **not** spawn the session or run installs; it provisions the isolated tree, nothing more.
-- Never touches `.claude/worktrees/` or another session's lanes (see worktree-boundaries).