Skip to content

Commit 6d72d1b

Browse files
authored
Merge pull request #5 from dango85/docs/v1.3.0-parallel-agents-pr-policy
docs: v1.3.0 parallel-agents guidance + PR workflow for main
2 parents 909a7da + 00b64ac commit 6d72d1b

9 files changed

Lines changed: 121 additions & 13 deletions

.github/pull_request_template.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
## Summary
2+
3+
<!-- What does this PR change and why? -->
4+
5+
## Checklist
6+
7+
- [ ] Targets **`main`** via a **feature branch** (not direct commits to `main`)
8+
- [ ] `CHANGELOG.md` updated if this is user-visible (version bump when releasing)
9+
- [ ] CI passes (Actions)

ADMIN_REPLY_SPEC_KIT_PR.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Comment to post on the github/spec-kit PR (e.g. hook overrides / modifies_hooks)
2+
3+
Use or shorten as needed.
4+
5+
---
6+
7+
Thanks for the feedback — I agree with the boundary and I’m **closing / withdrawing this PR** in favor of the approach you described.
8+
9+
**Cross-extension configuration:** I won’t ship logic where one extension rewrites another’s hooks or config on install (including `modifies_hooks` targeting the Git extension). That coupling is brittle when the Git extension evolves and it conflicts with **Git becoming opt-in at 1.0.0**.
10+
11+
**Parallel worktrees:** The real issue is that `before_specify → speckit.git.feature` runs `git checkout` / `git checkout -b` on the **shared** primary checkout, which disrupts parallel agents. Worktree-based flows should rely on **`git worktree add -b`** (branch created in the new worktree, primary `HEAD` unchanged) and on **explicit** project config: users who need a stable primary branch can set `enabled: false` on that hook in **`.specify/extensions.yml`**.
12+
13+
**Presets:** Opinionated “worktree-first” command text and ordering should live in a **preset** that overrides only the commands that need to differ — so teams stay in control.
14+
15+
**Spec-kit follow-up:** No spec-kit changes are required from this PR. The operational guidance (*parallel agents*, `.specify/extensions.yml`, presets) lives in the **Worktrees extension** repository README so it ships with the extension.
16+
17+
---

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 1.3.0 (2026-04-14)
4+
5+
### Added
6+
- README section **Parallel agents and the Git extension**: manual `.specify/extensions.yml` change to disable Git’s `before_specify` hook when you need a stable primary checkout; branch base `--base-ref HEAD`; honest note on `after_specify` ordering vs running specify from the worktree root
7+
- Command doc prerequisites: Git extension vs `git` CLI, and corrected branch-creation rule (worktree can create the branch with `git worktree add -b`)
8+
9+
### Changed
10+
- Documentation-only release aligned with Spec Kit maintainer guidance: no cross-extension hook mutation on install; optional future **preset** for worktree-first command overrides called out in README
11+
312
## 1.2.1 (2026-04-14)
413

514
### Removed

CONTRIBUTING.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Contributing
2+
3+
This is a public repository. Changes should follow the usual **GitHub flow**: work on a **branch**, open a **pull request** into `main`, and merge only after review — **not** by committing directly to `main`.
4+
5+
## For contributors
6+
7+
1. **Fork** the repository (or use a branch if you have write access).
8+
2. Create a **feature branch** from up-to-date `main`:
9+
10+
```bash
11+
git fetch origin
12+
git checkout -b your-branch-name origin/main
13+
```
14+
15+
3. Make commits with clear messages.
16+
4. **Push** your branch and open a **pull request** targeting `main`.
17+
5. Wait for CI (GitHub Actions) to pass and for maintainer review.
18+
19+
## For maintainers
20+
21+
- Merge contributions via **Pull request****Merge** (squash or merge commit, per repo preference).
22+
- **Do not** push commits directly to `main` for routine changes; use a short-lived branch and PR so history and review stay consistent with contributor expectations.
23+
- In repository **Settings → Rules → Rulesets** (or **Branch protection rules**), protect `main`: require a pull request before merging, and require status checks where appropriate.
24+
25+
## Releases
26+
27+
After a change to versioned files (`extension.yml`, `CHANGELOG.md`, `catalog-entry.json`) is **merged** to `main`:
28+
29+
1. Tag a semantic version (e.g. `v1.3.0`) on the merge commit.
30+
2. Push the tag so `download_url` and install snippets that point at `/archive/refs/tags/v…` stay valid.
31+
32+
See [PUBLISH.md](PUBLISH.md) for catalog and distribution notes.

PUBLISH.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,23 @@
11
# Publishing steps
22

3-
## 1. Push to GitHub
3+
## 1. Land changes on `main` via pull request
4+
5+
Do **not** push routine commits directly to `main`. See [CONTRIBUTING.md](CONTRIBUTING.md).
46

57
```bash
68
cd /Users/abiyadav/SourceCode/spec-kit-worktree-parallel
9+
git fetch origin && git checkout -b your-branch origin/main
10+
# … commit …
11+
git push -u origin your-branch
12+
gh pr create --base main --head your-branch
13+
# After review, merge the PR on GitHub
14+
```
15+
16+
Initial repo setup (one-time):
17+
18+
```bash
719
gh repo create dango85/spec-kit-worktree-parallel --public --source . --push
8-
# or manually:
9-
git remote add origin https://github.com/dango85/spec-kit-worktree-parallel.git
10-
git push -u origin main --tags
20+
# or: git remote add origin https://github.com/dango85/spec-kit-worktree-parallel.git
1121
```
1222

1323
## 2. Submit catalog PR to github/spec-kit
@@ -27,5 +37,5 @@ Reference issues: #61, #1476
2737
## 3. Install in any repo
2838

2939
```bash
30-
specify extension add --from https://github.com/dango85/spec-kit-worktree-parallel/archive/refs/tags/v1.0.0.zip
40+
specify extension add --from https://github.com/dango85/spec-kit-worktree-parallel/archive/refs/tags/v1.3.0.zip
3141
```

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
[![Tests](https://github.com/dango85/spec-kit-worktree-parallel/actions/workflows/test.yml/badge.svg)](https://github.com/dango85/spec-kit-worktree-parallel/actions/workflows/test.yml)
44

5+
**Contributing:** use a **branch + pull request** into `main` — see [CONTRIBUTING.md](CONTRIBUTING.md).
6+
57
A [Spec Kit](https://github.com/github/spec-kit) extension for **default-on** git worktree isolation — work on multiple features (or run parallel agents) without checkout switching.
68

79
## Why another worktree extension?
@@ -10,12 +12,14 @@ The community [spec-kit-worktree](https://github.com/Quratulain-bilal/spec-kit-w
1012

1113
1. **Default-on** — worktrees are created automatically after `/speckit.specify`. Opt *out* with `--in-place`, rather than opting in.
1214
2. **Nested layout by default** — worktrees live at `.worktrees/<branch>/` inside the repo (gitignored, self-contained). Sibling-dir layout (`../<repo>--<branch>`) is available as an option for IDE-per-feature workflows.
13-
3. **Deterministic bash script** — a real script (`create-worktree.sh`) with `--json` output, `--dry-run`, and `SPECIFY_WORKTREE_PATH` override, suitable for CI and scripted workflows.
15+
3. **Deterministic bash script** — a real script (`create-worktree.sh`) with `--json` output, `--dry-run`, `--base-ref`, and `SPECIFY_WORKTREE_PATH` override, suitable for CI and scripted workflows.
16+
17+
This extension **does not** change another extension’s configuration on install (for example it does not disable the Git extension’s hooks). You opt into hook changes explicitly in `.specify/extensions.yml` when you need them (see below).
1418

1519
## Installation
1620

1721
```bash
18-
specify extension add --from https://github.com/dango85/spec-kit-worktree-parallel/archive/refs/tags/v1.0.0.zip
22+
specify extension add --from https://github.com/dango85/spec-kit-worktree-parallel/archive/refs/tags/v1.3.0.zip
1923
```
2024

2125
## Layout modes
@@ -48,6 +52,30 @@ parent/
4852

4953
Open each directory in its own IDE window. Switch with `layout: "sibling"` in `worktree-config.yml`.
5054

55+
## Parallel agents and the Git extension
56+
57+
**Git extension vs `git` on your PATH:** This extension requires the **`git` CLI** only. It does not require the Spec Kit **Git extension** (`speckit.git.*`). That distinction matters because the Git extension registers **`before_specify → speckit.git.feature`**, which runs `git checkout` / `git checkout -b` on **whatever directory the agent is using as the repo root**. On a **shared** primary clone, that moves `HEAD` for everyone and fights parallel worktrees.
58+
59+
**What this extension does instead:** `create-worktree.sh` uses **`git worktree add`** (and **`git worktree add -b`** for a new branch). That creates the feature branch **inside the new worktree** and leaves the primary checkout’s `HEAD` alone.
60+
61+
**If the Git extension is installed and you want a stable primary checkout:** edit **`.specify/extensions.yml`** and set **`enabled: false`** on the `before_specify` entry whose **`extension`** is **`git`** and **`command`** is **`speckit.git.feature`**. Your file may include extra keys (`optional`, `prompt`, …); only `enabled` needs to change.
62+
63+
```yaml
64+
hooks:
65+
before_specify:
66+
- extension: git
67+
command: speckit.git.feature
68+
enabled: false
69+
optional: false
70+
# …other keys from your install stay as-is…
71+
```
72+
73+
After disabling that hook, **feature branch naming** is no longer applied by `speckit.git.feature` before specify. Use **`create-new-feature.sh --dry-run --json`** from the Git extension if you still want the same numbering **without** a checkout, or agree on branch names in the specify step. **Branch from current `HEAD`** when creating a worktree: pass **`--base-ref HEAD`** to `create-worktree.sh` (default base is `main` / `origin/main` when present).
74+
75+
**`after_specify` ordering:** This extension’s hook runs **after** `/speckit.specify`. Spec files are written to the **current** working tree first, then the worktree is created. For **full** isolation, run specify **from the worktree root** (worktree-first workflow). A Spec Kit **preset** that overrides only the commands you need is the maintainers’ recommended way to encode that workflow explicitly; this repo does not ship that preset yet.
76+
77+
**Spec Kit 1.0.0:** The Git extension is expected to become **opt-in**. Do not assume `before_specify` / `speckit.git.feature` is always present; keep the worktree flow valid with Git extension off.
78+
5179
## Configuration
5280

5381
Create `.specify/extensions/worktrees/worktree-config.yml` to override defaults:

catalog-entry.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
"id": "worktrees",
55
"description": "Default-on worktree isolation for parallel agents — sibling or nested layout",
66
"author": "dango85",
7-
"version": "1.0.0",
8-
"download_url": "https://github.com/dango85/spec-kit-worktree-parallel/archive/refs/tags/v1.0.0.zip",
7+
"version": "1.3.0",
8+
"download_url": "https://github.com/dango85/spec-kit-worktree-parallel/archive/refs/tags/v1.3.0.zip",
99
"repository": "https://github.com/dango85/spec-kit-worktree-parallel",
1010
"homepage": "https://github.com/dango85/spec-kit-worktree-parallel",
1111
"documentation": "https://github.com/dango85/spec-kit-worktree-parallel/blob/main/README.md",
@@ -29,6 +29,6 @@
2929
"downloads": 0,
3030
"stars": 0,
3131
"created_at": "2026-04-13T00:00:00Z",
32-
"updated_at": "2026-04-13T00:00:00Z"
32+
"updated_at": "2026-04-14T00:00:00Z"
3333
}
3434
}

commands/speckit.worktrees.create.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ You **MUST** consider the user input before proceeding (if not empty). The user
2222
1. Verify the project is a git repository (`git rev-parse --show-toplevel`)
2323
2. Verify `git worktree` is available (`git worktree list` succeeds)
2424

25+
**Git extension (optional):** The Spec Kit Git extension’s `before_specify → speckit.git.feature` checks out the feature branch on the **current** tree. For parallel agents on one primary clone, maintainers recommend disabling that hook in `.specify/extensions.yml` and relying on `git worktree add -b` (this script) so the primary `HEAD` stays put. See the extension README *Parallel agents and the Git extension*.
26+
2527
## Configuration
2628

2729
Read configuration from `.specify/extensions/worktrees/worktree-config.yml` if it exists. Defaults apply when the file is absent.
@@ -50,6 +52,7 @@ Environment variable `SPECIFY_WORKTREE_PATH` overrides the computed path entirel
5052
bash "$(dirname "$0")/../scripts/bash/create-worktree.sh" \
5153
--json \
5254
[--layout sibling|nested] \
55+
[--base-ref HEAD|main|origin/main|…] \
5356
[--path <override>] \
5457
[--in-place] \
5558
[--dry-run] \
@@ -67,7 +70,7 @@ Environment variable `SPECIFY_WORKTREE_PATH` overrides the computed path entirel
6770
- Run `git worktree add -b <branch> <path> <base-ref>` (new branch) or `git worktree add <path> <branch>` (existing branch)
6871
- For nested layout, ensure `.worktrees/` is in `.gitignore`
6972

70-
3. **Verify spec artifacts**: Check that `specs/<branch>/` exists in the new worktree. List which artifacts are present (spec.md, plan.md, tasks.md).
73+
3. **Verify spec artifacts**: Prefer `specs/<branch>/` **in the worktree** when using a worktree-first workflow. If `/speckit.specify` ran on the primary checkout first (`after_specify` hook order), artifacts may still be under the primary tree — report where they actually are.
7174

7275
4. **Report**: Output a summary:
7376

@@ -93,4 +96,4 @@ Environment variable `SPECIFY_WORKTREE_PATH` overrides the computed path entirel
9396
- **One worktree per branch** — refuse to create a duplicate; report the existing path instead
9497
- **Never modify the primary checkout** — worktree operations happen in the new directory only
9598
- **Always update .gitignore for nested layout** — add the `dotworktrees_dir` value if not present
96-
- **Validate branch exists**for existing branches; for new branches the `after_specify` hook should have already created the branch via the git extension
99+
- **New vs existing branch**if the branch does not exist locally, `git worktree add -b` creates it from the configured base ref; if it already exists, the worktree attaches to it. Do not assume the Git extension ran `speckit.git.feature` first (it may be disabled for parallel worktrees)

extension.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ schema_version: "1.0"
33
extension:
44
id: worktrees
55
name: "Worktrees"
6-
version: "1.2.1"
6+
version: "1.3.0"
77
description: "Default-on worktree isolation for parallel agents — sibling or nested layout"
88
author: "dango85"
99
repository: "https://github.com/dango85/spec-kit-worktree-parallel"

0 commit comments

Comments
 (0)