create-religion 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,6 +24,10 @@ guess past broken configuration.
24
24
  **Read the spec.** If `religion/context/current-work.md` is still the stub, or its status
25
25
  is already complete, stop and say to run /feature, /fix, or
26
26
  /rollback first.
27
+ When it is the stub and `religion status --json` lists items under `inFlight` with `here`
28
+ false, or the handoff lists items in flight in other worktrees, name each with its worktree
29
+ and branch, and say that resuming one means working from that worktree. Never start one of
30
+ them again here.
27
31
 
28
32
  **Take the context.** Conventions from `religion/context/coding-standards.md`, the data
29
33
  model from the project overview. Code that ignores them is rework, not progress.
@@ -56,6 +60,17 @@ They differ only in how the work leaves the branch at completion, which is not t
56
60
  concern. On a resume the branch exists already, so check it out rather than creating a
57
61
  second one.
58
62
 
63
+ **With `workflow.parallelItems` on**, under either of those modes, a feature from the build
64
+ plan starts in its own worktree instead: follow `reference/item-worktree.md`, which creates
65
+ it on that branch beside the project and moves the spec there. Creating it is part of
66
+ positioning the work, as creating the branch is; removing it is deleting files, and asks.
67
+ An automated run keeps the plain branch, since it removes each item's branch once it lands,
68
+ and a worktree holding the branch would stop that. From then on the item is the worktree's.
69
+ Move the session into it where the tool can; otherwise address every file and
70
+ command to the worktree's path, and tell the user to open later sessions there, since hooks
71
+ keep running where a session started. A resume inside the worktree is the ordinary resume
72
+ below. Fixes, rollbacks and refactor campaigns keep the branch above.
73
+
59
74
  Either way, if the project is not a git repository, say so and ask the user to initialize
60
75
  one. The loop needs history to be reviewable.
61
76
 
@@ -194,7 +209,8 @@ block completion, so close the loop now rather than discovering it later.
194
209
 
195
210
  For each `open` P0 or P1:
196
211
 
197
- 1. **Append it to the spec's build steps** first (`- [ ] Repair F-03 - <title>`), so the
212
+ 1. **Append it to the spec's build steps** first (`- [ ] Repair 39a/F-2 - <title>`, using
213
+ the identifier exactly as the ledger heads it), so the
198
214
  repair is on the record and survives a cleared context. That changes what the spec asks
199
215
  for, so record it as an amendment naming the finding, and renew the stamp.
200
216
  2. Build it through the same loop as Step 2: smallest change, diff, explanation, evidence.
@@ -0,0 +1,116 @@
1
+ # Starting an item in its own worktree
2
+
3
+ Used when `workflow.parallelItems` is `true`, `git.mode` is `branch-per-item` or
4
+ `pull-request`, the spec is a feature from the build plan, and no automated run is underway.
5
+ The item gets its own git worktree beside the project, on the branch Step 1 would otherwise
6
+ create, and its spec moves there. The main checkout is then idle, and `/feature` can spec
7
+ the next item from it.
8
+
9
+ Run each block as **one** command. Each runs in a subshell, so a stop ends that block and never
10
+ the shell a tool keeps between commands, and nothing set in one block survives into the next:
11
+ each sets what it needs. A block that stops ends the start: report what it printed and stop.
12
+
13
+ A branch whose name holds a `'` is refused before anything runs, since the blocks quote it.
14
+
15
+ ## 1. Check, then create
16
+
17
+ (
18
+ root=$(git rev-parse --show-toplevel) || exit 1
19
+ [ "$(git -C "$root" rev-parse --absolute-git-dir)" = "$(git -C "$root" rev-parse --path-format=absolute --git-common-dir)" ] ||
20
+ { echo "not the main checkout: $root"; exit 1; }
21
+ [ -z "$(git -C "$root" status --porcelain -- . ':!religion/context/current-work.md' ':!religion/context/handoff.md')" ] ||
22
+ { echo "uncommitted changes beyond the spec"; exit 1; }
23
+ branch='<the branch Step 1 names>'
24
+ tree="${root%/*}/${root##*/}.$(printf '%s' "$branch" | tr / -)"
25
+ [ ! -e "$tree" ] && [ ! -L "$tree" ] || { echo "already exists: $tree"; exit 1; }
26
+ ! git -C "$root" show-ref --verify --quiet "refs/heads/$branch" || { echo "branch exists: $branch"; exit 1; }
27
+ git -C "$root" worktree add -q -b "$branch" "$tree" HEAD || exit 1
28
+ echo "$tree"
29
+ )
30
+
31
+ Started from inside a linked worktree, the first check stops: that worktree is an item already,
32
+ and a second one made from it would land on top of it. Anything uncommitted but the spec and
33
+ the generated handoff stops it too, settings and plan edits included, since the worktree is
34
+ made from `HEAD` and would run without them. Commit them first.
35
+
36
+ The path is the project's directory name, a dot, and the branch with each `/` as `-`, in the
37
+ project's parent directory: `religion` building `feature/export-reports` gets
38
+ `religion.feature-export-reports`. Landing the item later looks for it there, so never choose
39
+ another. A path or branch that already exists is another item's, or a start that stopped after
40
+ this block: when the path is a worktree on this item's branch and the main checkout still holds
41
+ the spec, go on to block 2; otherwise stop and say which, never reusing or replacing it.
42
+
43
+ ## 2. Copy what git does not carry, then move the spec
44
+
45
+ Safe to run again until block 3 has run, and it refuses after that. Use the same branch as
46
+ block 1:
47
+
48
+ (
49
+ root=$(git rev-parse --show-toplevel) || exit 1
50
+ branch='<the branch Step 1 names>'
51
+ tree="${root%/*}/${root##*/}.$(printf '%s' "$branch" | tr / -)"
52
+ [ "$(git -C "$tree" branch --show-current 2>/dev/null)" = "$branch" ] || { echo "not this item's worktree: $tree"; exit 1; }
53
+ spec="religion/context/current-work.md"
54
+ ! grep -q '_Nothing in progress' "$root/$spec" || { echo "the main checkout holds no spec to move"; exit 1; }
55
+ if [ -f "$tree/$spec" ] && ! grep -q '_Nothing in progress' "$tree/$spec" && ! cmp -s "$root/$spec" "$tree/$spec"; then
56
+ echo "the worktree already holds another spec"; exit 1
57
+ fi
58
+ for f in .claude/settings.json .claude/settings.local.json .claude/hooks; do
59
+ if [ -e "$root/$f" ] && git -C "$root" check-ignore -q "$f"; then
60
+ mkdir -p "$tree/$(dirname "$f")" && cp -RPp "$root/$f" "$tree/$(dirname "$f")/" || exit 1
61
+ fi
62
+ done
63
+ if git -C "$root" check-ignore -q religion; then
64
+ (cd "$root/religion" && find . -path ./.state -prune -o -type f -print) > "$tree.files" || exit 1
65
+ while IFS= read -r f; do
66
+ mkdir -p "$tree/religion/$(dirname "$f")" && cp -Pp "$root/religion/$f" "$tree/religion/$f" || exit 1
67
+ done < "$tree.files"
68
+ rm -f "$tree.files"
69
+ fi
70
+ for d in node_modules; do
71
+ [ -d "$root/$d" ] || continue
72
+ [ -e "$tree/$d" ] || [ -L "$tree/$d" ] || ln -s "$root/$d" "$tree/$d" || exit 1
73
+ git -C "$tree" check-ignore -q "$d" || printf '/%s\n' "$d" >> "$(git -C "$root" rev-parse --path-format=absolute --git-path info/exclude)" || exit 1
74
+ done
75
+ if git -C "$root" check-ignore -q religion && [ -f "$root/religion/context/findings.md" ]; then
76
+ mkdir -p "$tree/religion/.state" && cp -p "$root/religion/context/findings.md" "$tree/religion/.state/findings-at-start.md" || exit 1
77
+ fi
78
+ mkdir -p "$tree/religion/context" && cp -p "$root/$spec" "$tree/$spec" && cmp -s "$root/$spec" "$tree/$spec" || exit 1
79
+ echo "copied"
80
+ )
81
+
82
+ The installer's output that git ignores is copied only where git ignores it; a tracked copy is
83
+ already in the worktree. When `religion/` itself is ignored, which `doctor` reports as "state is
84
+ local only", every state file but `religion/.state/` is copied, since each worktree keeps its own
85
+ activity record; the ledger as it stood is saved in the worktree's `religion/.state/` as
86
+ `findings-at-start.md`, the base landing later tells this item's findings apart by. The list of files is written beside the worktree, not piped, so a failed copy
87
+ stops the block in every shell; a block that stopped there leaves that list, `<worktree>.files`,
88
+ and the rerun removes it.
89
+
90
+ The checks at the top are what make a rerun safe. Once block 3 has reset the main checkout's
91
+ spec, there is nothing to move, and copying would put the stub over the only copy of the spec.
92
+ A worktree that already holds a different spec belongs to work that has started, and copying the
93
+ main checkout's over it would replace that work.
94
+
95
+ Each installed dependency directory at the project root that the gate needs is linked, never
96
+ installed: an install needs its own yes. Name each one in the `for d` list; `node_modules` is the
97
+ usual one. A pattern such as `node_modules/` matches a directory but not a link to one, so a link
98
+ git would not ignore is added to the repository's own exclude file, which is never committed;
99
+ without that, the link would be committed with the item's work.
100
+
101
+ ## 3. Reset the main checkout's spec
102
+
103
+ Only after block 2 printed `copied`: reset the main checkout's
104
+ `religion/context/current-work.md` to its stub, exactly as shipped, as `/complete` does.
105
+ The spec now lives only in the worktree. That is a move, not a deletion: if the copy did not
106
+ match, nothing is reset, and the spec is still where it was.
107
+
108
+ ## 4. Confirm
109
+
110
+ From the main checkout, `religion status` lists the item under `inFlight` with its branch and
111
+ `here` false, and reports nothing active. From the worktree, it reports the item as active, and
112
+ `religion doctor` there names the main checkout in its git check. Without the `religion`
113
+ command, the handoff and the two specs say the same.
114
+
115
+ From here on, every file and command of this item is the worktree's. Removing the worktree is
116
+ deleting files, so it asks, every time.
@@ -67,7 +67,9 @@ Stop on any failure. Do not repair a mismatch by choosing a nearby commit.
67
67
  1. Every recorded identifier matches `^[0-9a-f]{40}$`. Reject abbreviated or uppercase
68
68
  values.
69
69
  2. Every recorded commit resolves in this repository and is an ancestor of `HEAD`.
70
- 3. The recorded base is the parent of the earliest recorded commit.
70
+ 3. The recorded base is the parent of the earliest recorded commit. For an item landed on top
71
+ of another, that commit is the merge that brought the other in, and the base must be its
72
+ second parent, what it brought in: the first parent would reverse the other item's work.
71
73
  4. The working tree is clean apart from the rollback spec being written.
72
74
 
73
75
  ## Step 3 - preview the product diff
@@ -43,7 +43,8 @@ Implementation lands one small step at a time, each with a diff to read and evid
43
43
  its stated outcome was met.
44
44
 
45
45
  `religion/context/current-work.md` holds exactly one work item. Finish it, archive it,
46
- then start the next. Progress lives in checkboxes inside that file, so a cleared context
46
+ then start the next. With `workflow.parallelItems` on, other items may be in flight in other
47
+ git worktrees, one each; they land one at a time. Progress lives in checkboxes inside that file, so a cleared context
47
48
  costs nothing: a fresh session reads which steps are ticked and resumes from the first
48
49
  one that is not.
49
50
 
@@ -35,7 +35,8 @@ Implementation lands one small step at a time, each with a diff to read and evid
35
35
  its stated outcome was met.
36
36
 
37
37
  `religion/context/current-work.md` holds exactly one work item. Finish it, archive it,
38
- then start the next. Progress lives in checkboxes inside that file, so a cleared context
38
+ then start the next. With `workflow.parallelItems` on, other items may be in flight in other
39
+ git worktrees, one each; they land one at a time. Progress lives in checkboxes inside that file, so a cleared context
39
40
  costs nothing: a fresh session reads which steps are ticked and resumes from the first
40
41
  one that is not.
41
42
 
@@ -2,7 +2,8 @@
2
2
  "schemaVersion": 1,
3
3
  "workflow": {
4
4
  "stepReview": "every",
5
- "parallelSteps": false
5
+ "parallelSteps": false,
6
+ "parallelItems": false
6
7
  },
7
8
  "git": {
8
9
  "mode": "trunk",