@softure-ai/skills 0.14.0 → 0.16.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.
- package/ONBOARD.md +2 -1
- package/README.md +6 -1
- package/WORKFLOW.md +55 -9
- package/package.json +3 -2
- package/rules/AGENTS.md +41 -11
- package/skills/softure-archive/SKILL.md +30 -6
- package/skills/softure-init/SKILL.md +9 -3
- package/skills/softure-worktree/SKILL.md +103 -47
- package/skills/softure-worktree/scripts/wt-merge-check.py +187 -0
- package/skills/softure-worktree/scripts/wt-roadmap.py +172 -18
- package/skills/softure-worktree/scripts/wt_config.py +3 -2
- package/skills/softure-worktree-manager/SKILL.md +21 -8
- package/skills/softure-worktree-manager/scripts/wm-resume.sh +5 -4
package/ONBOARD.md
CHANGED
|
@@ -143,4 +143,5 @@ result, and wait for my word before anything leaves the working tree. Talk to me
|
|
|
143
143
|
- Switching mode is the owner's explicit word: change `mode` in `context/workflow.json`, re-run the
|
|
144
144
|
installer, commit both as `docs(rules): switch to <mode> mode` (WORKFLOW §8).
|
|
145
145
|
- A hosted project's main chat (for example a claude.ai project) needs the one-paragraph pointer from
|
|
146
|
-
WORKFLOW §8.5 in its project instructions; the AUTO prompt prints it when it is missing
|
|
146
|
+
WORKFLOW §8.5 in its project instructions; the AUTO prompt prints it when it is missing, and every
|
|
147
|
+
thread checks it at session start and tells the coordinator, which then reads `AGENTS.md` itself.
|
package/README.md
CHANGED
|
@@ -46,7 +46,12 @@ for SOFTURE package bugs and for gaps in these skills) lives in the rules block,
|
|
|
46
46
|
runs in a checkout, cloud ones included, reads it from `AGENTS.md` without being told. A hosted
|
|
47
47
|
project's coordinator (for example a claude.ai project's main chat) is started outside the checkout:
|
|
48
48
|
paste the one-paragraph pointer from WORKFLOW §8.5 (`softure-init` prints it) into the project
|
|
49
|
-
instructions, and it starts the run by itself.
|
|
49
|
+
instructions, and it starts the run by itself. The paste is checked, not assumed: the first thread
|
|
50
|
+
that finds it missing tells the coordinator, which then reads the rules from the main branch at once
|
|
51
|
+
and asks the owner to paste it. The roadmap state lives on the main branch, written only by
|
|
52
|
+
`wt-roadmap.py` (branches never edit `roadmap.md`), and a branch merges the main branch in again only
|
|
53
|
+
when `wt-merge-check.py` finds an overlap, a migration or a dependency change, so a serial merge
|
|
54
|
+
without overlap costs minutes, not a full test run. Tune it with `autonomy` (WORKFLOW §2). Switch modes only on the
|
|
50
55
|
owner's word: change `mode`, re-run the installer, commit both.
|
|
51
56
|
|
|
52
57
|
Per-project choices go into `context/workflow.json` → `install` and are applied on every install,
|
package/WORKFLOW.md
CHANGED
|
@@ -74,15 +74,26 @@ or languages.
|
|
|
74
74
|
"worktree": {
|
|
75
75
|
"setup": ["npm ci", "cp ../{repo}/.env .env"], // run inside a fresh worktree
|
|
76
76
|
"maxParallel": 4,
|
|
77
|
-
"cloudState": "main" // cloud sessions: "main" pushes the claim
|
|
78
|
-
//
|
|
77
|
+
"cloudState": "main" // cloud sessions: "main" pushes the claim, every stage and the final done to origin/<main>
|
|
78
|
+
// at once (default; branches never edit roadmap.md, so merging <main> in never conflicts
|
|
79
|
+
// on it); "branch" commits them on the session branch only, <main> changes only by the merge
|
|
79
80
|
},
|
|
80
81
|
"release": { "owner": true }, // releases and deploys are never done by skills when true; false lets an autonomous
|
|
81
82
|
// project release through its own pipeline (never a production deploy, §8.4)
|
|
82
83
|
"autonomy": { // optional, read only when mode is "autonomous" (§8.4)
|
|
83
84
|
"source": "roadmap", // "roadmap": items come from roadmap.md; "issues": the forge's open issues are the queue
|
|
84
|
-
"merge": "pr", // "pr": pull request
|
|
85
|
+
"merge": "pr", // "pr": pull request, merged on the forge after green checks (default);
|
|
85
86
|
// "push": local --no-ff merge, then push <main> through the pre-push hook
|
|
87
|
+
"remergeMain": "when-needed", // "when-needed" (default): merge <main> into the branch before the merge only when
|
|
88
|
+
// wt-merge-check.py finds an overlapping file, a migration or a dependency change;
|
|
89
|
+
// "on-conflict": only when the merge would conflict (the forge reports the PR not
|
|
90
|
+
// mergeable, or a local trial merge conflicts); the merged result is then not tested
|
|
91
|
+
// before the merge, so an incompatible but non-conflicting change surfaces on <main>
|
|
92
|
+
// or in the release gate; "always": before every merge
|
|
93
|
+
"relatedTests": null, // e.g. "npx vitest related --run {files}": the test gate after a merge of <main>, for the
|
|
94
|
+
// files the branch changes; null = the full test gate
|
|
95
|
+
"fullGatePaths": [], // extra globs that force the full gates after a merge of <main> (built in: lockfiles,
|
|
96
|
+
// package manifests, test runner and TypeScript config, test setup, hook config, CI)
|
|
86
97
|
"reports": { "every": 60, "hours": null } // coordinator status reports: minutes (default 60, 0 = off), optional "10:00-22:30"
|
|
87
98
|
// window; one recurring routine on full hours, `every` rounded up to a multiple of 60.
|
|
88
99
|
// `hours: null` = around the clock (24/7), recommended for autonomous runs: the routine
|
|
@@ -117,10 +128,18 @@ Parallel sessions push often, and every push can start the project's CI. The ski
|
|
|
117
128
|
- the full integration suite runs once per item (`cadence: "change"`) or once per roadmap (`"roadmap"`), never
|
|
118
129
|
twice on the same commit: `integration.lookup` lets `wt-integration.sh` reuse a stored green result, and
|
|
119
130
|
`integration.coveredByRelease` hands the roadmap's run to the release pipeline when a release follows anyway;
|
|
120
|
-
- a "finish" item does not start a run of its own under `cadence: "roadmap"
|
|
131
|
+
- a "finish" item does not start a run of its own under `cadence: "roadmap"`;
|
|
132
|
+
- before a merge, `<main>` is merged into the branch only when needed (`autonomy.remergeMain`), and such a merge
|
|
133
|
+
re-runs only what it can break (`autonomy.relatedTests`), so a merge without overlap costs no push and no hook.
|
|
134
|
+
In a busy repository nearly every merge sees a migration or a dependency change from the one before it, and
|
|
135
|
+
`"when-needed"` then re-merges almost every time; `"on-conflict"` merges a pull request on its green-at-READY
|
|
136
|
+
checks unless the merge would conflict. It trades a CI run per merge for testing the merged result only on
|
|
137
|
+
`<main>` and in the release gate.
|
|
121
138
|
|
|
122
139
|
The project's side: when the git hooks already run the gates (`pre-commit`, `pre-push`), CI does not need to
|
|
123
|
-
repeat them on every pushed branch.
|
|
140
|
+
repeat them on every pushed branch. A pre-push hook needs a cheap path for a push whose changed files are all
|
|
141
|
+
under `context/` (the roadmap commits of `wt-roadmap.py`): skip typecheck, lint and tests, keep the language
|
|
142
|
+
check. Without it every stage costs a full suite, which is what `cloudState: "branch"` works around. Run CI on pull requests, on the main branch or on demand, skip changes
|
|
124
143
|
that touch only documents, and cancel superseded runs (`concurrency`).
|
|
125
144
|
|
|
126
145
|
## 3. Artifacts
|
|
@@ -185,8 +204,17 @@ Files this change owns exclusively, things it must not touch, deadlines.
|
|
|
185
204
|
|
|
186
205
|
## Notes
|
|
187
206
|
Free-form. Orchestrators append signals here.
|
|
207
|
+
|
|
208
|
+
## Roadmap handoff (only on a change branch, written by softure-archive --handoff)
|
|
209
|
+
- **Status:** done | done_code (waiting: <what>)
|
|
210
|
+
- **Done:** <the `## Done` outcome, one line>
|
|
211
|
+
- **Owner check:** <item text> (Manual N.M) (one line per check)
|
|
212
|
+
- **Before the next release:** <step> (one line per step)
|
|
188
213
|
```
|
|
189
214
|
|
|
215
|
+
`## Roadmap handoff` carries the roadmap transition of a change archived on its branch: the branch never edits
|
|
216
|
+
`roadmap.md`, and `wt-roadmap.py done <change-id>` applies these lines on `<main>` right after the merge (§5).
|
|
217
|
+
|
|
190
218
|
**Status values (exact strings, in this order):**
|
|
191
219
|
|
|
192
220
|
| status | set by | meaning / resume point |
|
|
@@ -262,9 +290,13 @@ Why this order; which items may run in parallel and which files each one owns.
|
|
|
262
290
|
|
|
263
291
|
`Mode` is `autonomous` (an orchestrator may run it end to end) or `owner` (needs the owner at the keyboard).
|
|
264
292
|
In `--auto`, decisions go to a `## Decisions (auto)` section at the end of roadmap.md.
|
|
265
|
-
`softure-archive`
|
|
266
|
-
|
|
267
|
-
|
|
293
|
+
`softure-archive` decides the transition to `done` / `done_code`. On the main branch it rewrites the row and the
|
|
294
|
+
item block and appends to `## Done` itself. On a change branch (`softure-worktree`, unless `worktree.cloudState` is
|
|
295
|
+
`"branch"`) it writes the same decision into the archived `change.md` → `## Roadmap handoff`, and
|
|
296
|
+
`wt-roadmap.py done <change-id>` applies it on `<main>` right after the merge. **A change branch never edits
|
|
297
|
+
`roadmap.md`**: every stage, from `in_progress` to `done`, is one script commit on `<main>`, so merging `<main>` into a
|
|
298
|
+
branch never conflicts on the roadmap. Orchestrators fall back to `wt-roadmap.py done` themselves when a thread did not
|
|
299
|
+
run it.
|
|
268
300
|
Each item block may carry `- **Input:** <path>` (e.g. the change folder), which tells research where its brief lives.
|
|
269
301
|
`change.md` is defined **only** in §4. softure-roadmap `--open-changes` and softure-new write the same format.
|
|
270
302
|
|
|
@@ -482,6 +514,20 @@ AGENTS.md (the managed SOFTURE block) and context/workflow.json from the main br
|
|
|
482
514
|
coordinator described there: follow "Operating mode: autonomous", starting with "Start of a run".
|
|
483
515
|
```
|
|
484
516
|
|
|
517
|
+
A coordinator without the pointer runs on the harness defaults (ask the owner before every merge),
|
|
518
|
+
so the paste is verified, never assumed:
|
|
519
|
+
- **Thread check.** Every thread of a hosted autonomous project checks, at session start, whether
|
|
520
|
+
the project instructions it was given contain this pointer (or any reference to this repository's
|
|
521
|
+
`AGENTS.md`). If not, its first message to the coordinator says so, carries the snippet with
|
|
522
|
+
`<owner>/<repo>` filled in from `origin`, and asks the coordinator to tell the owner where to paste
|
|
523
|
+
it. The thread then carries on with its change (`softure-worktree` → Cloud session).
|
|
524
|
+
- **Coordinator self-check.** A coordinator told by a thread (or noticing itself) that it has not
|
|
525
|
+
loaded the managed block reads `AGENTS.md` and `context/workflow.json` from the main branch at once
|
|
526
|
+
and follows them for the rest of the run, without waiting for the paste: from then on it gives the
|
|
527
|
+
go and runs the merge queue itself. It posts the snippet to the owner in the main chat, with where
|
|
528
|
+
to paste it (the hosted project's instructions), records in memory that the pointer is missing, and
|
|
529
|
+
repeats it as an owner step in every report until the owner confirms the paste.
|
|
530
|
+
|
|
485
531
|
**New roadmap.** When the owner hands over a new roadmap, the coordinator starts one roadmap thread
|
|
486
532
|
that only runs `softure-roadmap`, merges `roadmap.md` and ends. Only then does it start one thread
|
|
487
533
|
per ready item. A single thread never records a roadmap and implements its items.
|
|
@@ -495,7 +541,7 @@ runs in a checkout and reads the block itself.
|
|
|
495
541
|
| step | local | hosted project |
|
|
496
542
|
| --- | --- | --- |
|
|
497
543
|
| launch (M3) | `wm-launch.sh` | start a thread session with the standard brief (item ID, change-id, outcome, base, owned files, waits for, merge path, report-to, "follow AGENTS.md → Operating mode: autonomous") |
|
|
498
|
-
| in-flight state (M0.1) | `wm-resume.sh` | roadmap rows on `origin/<main
|
|
544
|
+
| in-flight state (M0.1) | `wm-resume.sh` | roadmap rows on `origin/<main>`, live for every stage (with `cloudState: "branch"` they show only at merge, so also memory), the harness's thread list, open pull requests |
|
|
499
545
|
| watch (M4) | `wm-watch.sh` Monitor | thread messages and the report routine; no polling when PR events reach the threads, otherwise each thread polls its own CI (below) |
|
|
500
546
|
| READY / merged report | `SendMessage` | cross-session message to the coordinator's session, never a reply in the thread |
|
|
501
547
|
| go | a signal in the conversation | coordinator-to-thread message |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softure-ai/skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.0",
|
|
4
4
|
"description": "SOFTURE agent skills: a spec-driven delivery workflow (shape → prd → roadmap → plan → implement → review) plus parallel worktree orchestration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"postinstall": "node scripts/install.mjs --postinstall",
|
|
25
|
-
"validate": "node scripts/validate.mjs"
|
|
25
|
+
"validate": "node scripts/validate.mjs",
|
|
26
|
+
"test": "python3 -m unittest discover -s tests"
|
|
26
27
|
},
|
|
27
28
|
"engines": {
|
|
28
29
|
"node": ">=20"
|
package/rules/AGENTS.md
CHANGED
|
@@ -86,7 +86,10 @@ so every session reads it here itself; it is not consent relayed by another sess
|
|
|
86
86
|
to this section instead of quoting chat messages. **Only a production deploy or release waits for the
|
|
87
87
|
owner's word** (see Releases). Nothing in this section needs to be told to a fresh session again;
|
|
88
88
|
a hosted project's coordinator that does not run inside a checkout gets one pointer to it in the
|
|
89
|
-
project instructions (WORKFLOW §8.5).
|
|
89
|
+
project instructions (WORKFLOW §8.5). A thread whose project instructions lack that pointer tells the
|
|
90
|
+
coordinator in its first message, with the snippet filled in; the coordinator then reads this block
|
|
91
|
+
and `context/workflow.json` from the main branch at once and follows them for the rest of the run,
|
|
92
|
+
without waiting for the paste (WORKFLOW §8.5, Bootstrap).
|
|
90
93
|
|
|
91
94
|
**Decide, don't ask.** Take the recommended option and record it under `## Decisions (auto)` in the
|
|
92
95
|
artifact. Small product decisions are yours: the owner trusts the recommendation and corrects it
|
|
@@ -171,9 +174,16 @@ Only a "stop" or "pause" from the owner, recorded in memory, holds it back.
|
|
|
171
174
|
|
|
172
175
|
**Thread duties:**
|
|
173
176
|
- Run the whole chain for its change (`softure-worktree`), deciding by the rules above.
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
+
- **Check the coordinator's bootstrap** in a hosted project: at session start, look for the WORKFLOW
|
|
178
|
+
§8.5 pointer (or any reference to this repository's `AGENTS.md`) in the project instructions the
|
|
179
|
+
session was given. When it is missing, the first message to the coordinator says so, carries the
|
|
180
|
+
snippet with `<owner>/<repo>` filled in, and asks the coordinator to tell the owner where to paste
|
|
181
|
+
it. Then carry on with the change.
|
|
182
|
+
- At READY (green PR, the main branch merged in when Merging below says it is needed): send the
|
|
183
|
+
condensed result to the coordinator and wait for its go. Never write that it waits for the owner.
|
|
184
|
+
Without a coordinator, merge at READY.
|
|
185
|
+
- After the go: merge (below), then record the roadmap state on the main branch
|
|
186
|
+
(`wt-roadmap.py done <change-id>`) and send the merge result to the coordinator.
|
|
177
187
|
- **Watch your own CI when PR events cannot reach you.** At session start, check whether pull request
|
|
178
188
|
activity can reach the thread (the subscription succeeds, the forge app has access to the
|
|
179
189
|
repository). If not, after every push check the pull request's checks yourself until they finish:
|
|
@@ -185,16 +195,34 @@ Only a "stop" or "pause" from the owner, recorded in memory, holds it back.
|
|
|
185
195
|
|
|
186
196
|
**Merging.**
|
|
187
197
|
- Merges are serial, first ready first merged. A ready merge never waits for the owner.
|
|
188
|
-
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
198
|
+
- **The roadmap state lives on the main branch, never on a change branch.** Branches do not edit
|
|
199
|
+
`roadmap.md`: `wt-roadmap.py` writes every stage on the main branch (`open`, `stage`, `ready`), and
|
|
200
|
+
the thread runs `wt-roadmap.py done <change-id>` right after its merge; it takes the `## Done`,
|
|
201
|
+
owner-check and release lines from the archived `change.md` (`softure-archive --handoff`). Only
|
|
202
|
+
`worktree.cloudState: "branch"` keeps the old flow, where the branch carries its own row.
|
|
203
|
+
- **Merge the main branch in only when needed** (`autonomy.remergeMain: "when-needed"`, the default).
|
|
204
|
+
After the go, run `softure-worktree/scripts/wt-merge-check.py`. `merge-as-is` (the forge reports the
|
|
205
|
+
pull request mergeable, and since the branch last merged it the main branch brought no migration, no
|
|
206
|
+
dependency change and no file the branch also changes): merge the pull request as it is; its checks
|
|
207
|
+
were green at READY. `remerge`: merge the fresh main branch in, resolve conflicts yourself, run the
|
|
208
|
+
`RUN` lines it prints, push. The main branch is the source of truth: what it has and the branch lacks
|
|
209
|
+
is pulled in and wired. `"on-conflict"`: `merge-as-is` unless the merge would conflict (the forge
|
|
210
|
+
reports the pull request not mergeable: pass `--not-mergeable`; or the script's trial merge
|
|
211
|
+
conflicts); overlap, migrations and dependency changes alone do not force a merge of the main
|
|
212
|
+
branch, so the merged result is first tested on the main branch and in the release gate.
|
|
213
|
+
`"always"`: merge the main branch in before every merge.
|
|
214
|
+
- **A merge of the main branch re-runs only what it can break:** every gate except the test gate, plus
|
|
215
|
+
`autonomy.relatedTests` for the files the branch changes. The full suite runs again only when the
|
|
216
|
+
incoming changes add a migration or touch dependencies, test setup or config (`wt-merge-check.py`
|
|
217
|
+
prints `GATES full`), and once per roadmap in the release gate.
|
|
218
|
+
- **Merge on green without polling.** When a merge has to wait for checks, enable the forge's auto-merge
|
|
219
|
+
for the pull request at go time where it is available; poll the checks only where it is not.
|
|
193
220
|
- `autonomy.merge: "pr"` (default): open a pull request (`Closes #N` when it solves an issue), wait for
|
|
194
221
|
green checks, merge it on the forge; the forge deletes the head branch. `"push"`: `git merge --no-ff`
|
|
195
222
|
locally, then push the main branch through the pre-push hook.
|
|
196
223
|
- When one thread has had to chase the main branch several times, the coordinator tells the others
|
|
197
|
-
to hold their merges until it lands.
|
|
224
|
+
to hold their merges until it lands. Under `remergeMain: "on-conflict"` the go never asks for
|
|
225
|
+
"Update branch" or a merge of the main branch: the thread merges on `wt-merge-check.py`'s verdict.
|
|
198
226
|
- Hooks stay on: never `--no-verify`, never force-push, never disable or loosen a test to get green.
|
|
199
227
|
Long hooks run in the background with the longest timeout; a hung one is killed by its PID and
|
|
200
228
|
re-run.
|
|
@@ -278,7 +306,9 @@ needs the fix is `blocked (<repo>#<N>)`.
|
|
|
278
306
|
- Public text (issues, pull requests, commits, docs) stays neutral: no personal references, no names
|
|
279
307
|
of private projects (write "an adopting app").
|
|
280
308
|
|
|
281
|
-
**Releases.**
|
|
309
|
+
**Releases.** `release.owner` gates tagging, publishing and deploying only, never merging pull
|
|
310
|
+
requests into the main branch: merges always follow the coordinator's go (Merging). With
|
|
311
|
+
`release.owner: true` nothing is tagged, published or deployed: work ends
|
|
282
312
|
`done_code` with the owner's steps under `## Before the next release`, and a release follows only the
|
|
283
313
|
owner's word for that release. With `release.owner: false` the coordinator releases once per wave
|
|
284
314
|
through the project's own pipeline (version-bump pull request → merge → the pipeline publishes); with
|
|
@@ -8,7 +8,7 @@ description: >
|
|
|
8
8
|
checks for the owner, fix links, and commit. Handles changes without a plan, a roadmap with
|
|
9
9
|
someone else's uncommitted edits, and a half-finished earlier run. Use when the user says
|
|
10
10
|
"archive the change", "close this change", "we're done with X", or after softure-impl-review.
|
|
11
|
-
argument-hint: "<change-id | path> [--auto] [--done-code \"<what waits>\"]"
|
|
11
|
+
argument-hint: "<change-id | path> [--auto] [--done-code \"<what waits>\"] [--handoff]"
|
|
12
12
|
allowed-tools:
|
|
13
13
|
- Read
|
|
14
14
|
- Glob
|
|
@@ -77,7 +77,9 @@ hard stops. Sample reports: [references/example-archive.md](references/example-a
|
|
|
77
77
|
is the `created` date from change.md, not today. `git mv` stages the rename with the
|
|
78
78
|
committed content only, so run `git add context/archive/<created>-<id>` afterwards or the
|
|
79
79
|
stamp stays out of the commit.
|
|
80
|
-
3. **Update the roadmap** (when change.md has `roadmap_item`, or a row with `` `<id>` `` exists)
|
|
80
|
+
3. **Update the roadmap** (when change.md has `roadmap_item`, or a row with `` `<id>` `` exists).
|
|
81
|
+
With `--handoff` (a change branch, see *Inside a worktree*), do not touch `roadmap.md`: write
|
|
82
|
+
the same decisions into `change.md` → `## Roadmap handoff` instead (below), then go on with step 5.
|
|
81
83
|
- Match exactly: the row whose second cell is `` `<id>` ``. One item can spawn several
|
|
82
84
|
changes, so a near miss is never closed. If `roadmap_item` names an ID whose row carries a
|
|
83
85
|
different change-id, report it and leave the row alone.
|
|
@@ -139,15 +141,37 @@ checks. Pick `done_code` whenever any Manual item is open or the change affects
|
|
|
139
141
|
|
|
140
142
|
## Inside a worktree
|
|
141
143
|
|
|
142
|
-
Archive **on the change branch**, before the merge.
|
|
143
|
-
|
|
144
|
-
|
|
144
|
+
Archive **on the change branch**, before the merge. `softure-worktree` passes `--handoff` (unless
|
|
145
|
+
`worktree.cloudState` is `"branch"`): the branch never edits `roadmap.md`, because the roadmap
|
|
146
|
+
state lives on the main branch and is written only by `wt-roadmap.py`. Steps 3 and 4 then write
|
|
147
|
+
one section at the end of the archived `change.md` (WORKFLOW §4), in this exact form:
|
|
148
|
+
|
|
149
|
+
```markdown
|
|
150
|
+
## Roadmap handoff
|
|
151
|
+
- **Status:** done_code (waiting: <what waits>)
|
|
152
|
+
- **Done:** <outcome, one line>
|
|
153
|
+
- **Owner check:** <item text> (Manual N.M)
|
|
154
|
+
- **Before the next release:** <what must happen before the next deploy>
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
`Status` is `done` or `done_code (waiting: <what>)`, chosen as in step 3 (no date: the script
|
|
158
|
+
stamps the merge day). One `Owner check` line per open Manual item or owner-targeted deferred
|
|
159
|
+
finding, one `Before the next release` line per deploy prerequisite; leave out lines that have
|
|
160
|
+
nothing to say. Right after the merge, `wt-roadmap.py done <change-id>` reads the section from
|
|
161
|
+
the main branch and writes the row, the item block, `## Done`, `## Owner decisions and checks`
|
|
162
|
+
and `## Before the next release`. The report says `roadmap: handed off (wt-roadmap.py done after
|
|
163
|
+
the merge)`.
|
|
164
|
+
|
|
165
|
+
Without `--handoff` (`cloudState: "branch"`), the roadmap edits are made on the branch and
|
|
166
|
+
conflict textually with other merged changes; that is expected. `softure-worktree` resolves them
|
|
167
|
+
row by row during the merge. Do not touch rows of other items.
|
|
145
168
|
|
|
146
169
|
## Checklist
|
|
147
170
|
|
|
148
171
|
- [ ] No uncommitted files of the change before and after; nobody else's WIP or staged work in the commit.
|
|
149
172
|
- [ ] `status: archived` and `archived_at` set, the stamp inside the commit; folder named by `created`.
|
|
150
|
-
- [ ] Roadmap row last cell, item block status, `## Done` and `updated` all changed (or the skip is reported)
|
|
173
|
+
- [ ] Roadmap row last cell, item block status, `## Done` and `updated` all changed (or the skip is reported);
|
|
174
|
+
with `--handoff`, `roadmap.md` untouched and `## Roadmap handoff` written instead.
|
|
151
175
|
- [ ] Open Manual items listed for the owner; deploy prerequisites under `## Before the next release`.
|
|
152
176
|
- [ ] No dangling links; one commit, conventional message, not pushed.
|
|
153
177
|
|
|
@@ -94,7 +94,12 @@ start any work: no change, PRD or roadmap is created here.
|
|
|
94
94
|
8. **Report** a status block, one line per artifact (`created`, `present` or `merged: <keys>`),
|
|
95
95
|
then the unresolved values the owner should fill in, every inferred value with its reason,
|
|
96
96
|
and the next step. With `mode: "autonomous"`, end it with the project-instructions snippet
|
|
97
|
-
for hosted projects (WORKFLOW §8.5), `<owner>/<repo>` filled in from `origin`, ready to paste
|
|
97
|
+
for hosted projects (WORKFLOW §8.5), `<owner>/<repo>` filled in from `origin`, ready to paste,
|
|
98
|
+
and list the paste among the unresolved values as an open owner step
|
|
99
|
+
(`[ ] paste the WORKFLOW §8.5 pointer into the hosted project's instructions`). It stays open
|
|
100
|
+
until a session confirms the pointer is present: a re-run of init in an autonomous project lists
|
|
101
|
+
it again unless the owner confirmed it, and every hosted thread checks it at session start
|
|
102
|
+
(`softure-worktree` → Cloud session), so nothing later assumes the paste happened.
|
|
98
103
|
Then stop: do not chain into other skills.
|
|
99
104
|
|
|
100
105
|
## `workflow.json`
|
|
@@ -130,10 +135,10 @@ only when it was detected or the user asked for it:
|
|
|
130
135
|
| `integration.cadence` | `"change"` (every change runs the suite before archive) | the user wants one run per roadmap (`"roadmap"`) |
|
|
131
136
|
| `integration.lookup` | every call starts a run | the project stores results per commit (e.g. a git note) and has a command that prints one |
|
|
132
137
|
| `integration.coveredByRelease` | `false` | the release pipeline runs the same full suite on the released commit |
|
|
133
|
-
| `worktree.cloudState` | `"main"` | the user runs cloud sessions
|
|
138
|
+
| `worktree.cloudState` | `"main"` (roadmap state on the main branch, branches never edit `roadmap.md`) | the user runs cloud sessions whose pre-push hook has no cheap path for `context/`-only pushes and wants the state on the branch (`"branch"`) |
|
|
134
139
|
| `research.sources` | none | step 2 found docs, ADRs or a PRD (interactive: listed in the plan; `--auto`: only paths that exist) |
|
|
135
140
|
| `install` | gitignore the skills, inject all rule sections | the user wants committed skills or fewer rule sections (the language section always ships; `allowNonEnglishCode: true` only on the owner's explicit word) |
|
|
136
|
-
| `autonomy` | roadmap as the work source, merge via pull request, reports every 60 min around the clock (`reports.every`, `reports.hours: null`; routines fire at most hourly; the routine is also the run's heartbeat, so keep it 24/7) | `mode` is `autonomous` and the user names issues as the queue, merges by push, or another report cadence |
|
|
141
|
+
| `autonomy` | roadmap as the work source, merge via pull request, `<main>` merged into a branch only when needed (`remergeMain: "when-needed"`; `"on-conflict"` when the main branch takes a migration or a dependency change on nearly every merge and the owner accepts testing the merged result on main and in the release gate; add `relatedTests`, e.g. `npx vitest related --run {files}`, when the test runner has one), reports every 60 min around the clock (`reports.every`, `reports.hours: null`; routines fire at most hourly; the routine is also the run's heartbeat, so keep it 24/7) | `mode` is `autonomous` and the user names issues as the queue, merges by push, or another report cadence |
|
|
137
142
|
|
|
138
143
|
Content of the README files, and a complete worked example (detection, plan, report) for a
|
|
139
144
|
fictional repo: read `references/templates.md` **when writing the READMEs** and
|
|
@@ -154,6 +159,7 @@ Optional keys other than `research.sources` are never written in `--auto`.
|
|
|
154
159
|
- [ ] Every gate in `workflow.json` points at something that exists, or is `null`.
|
|
155
160
|
- [ ] Gate commands use the repo's package manager.
|
|
156
161
|
- [ ] The report lists the unresolved values the owner should fill in, and every inferred value.
|
|
162
|
+
- [ ] With `mode: "autonomous"`: the §8.5 snippet is printed and the paste is an open owner step.
|
|
157
163
|
|
|
158
164
|
## Do not
|
|
159
165
|
|
|
@@ -123,15 +123,24 @@ Read `mode` at A0 (`python3 <S>/wt_config.py mode`; WORKFLOW §8, the project's
|
|
|
123
123
|
an open thread;
|
|
124
124
|
2. no coordinator: go straight on;
|
|
125
125
|
3. then Phase B by `autonomy.merge`:
|
|
126
|
-
- `"pr"` (default):
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
`
|
|
126
|
+
- `"pr"` (default): the pull request was opened at READY (`Closes #N` when
|
|
127
|
+
the change solves an issue). After the go, run
|
|
128
|
+
`python3 <S>/wt-merge-check.py` (add `--not-mergeable` when the forge
|
|
129
|
+
reports the pull request not mergeable). `VERDICT merge-as-is` and the
|
|
130
|
+
forge reports the pull request mergeable → merge it as it is (its checks
|
|
131
|
+
were green at READY). `VERDICT remerge` (or `autonomy.remergeMain: "always"`)
|
|
132
|
+
→ merge `origin/<main>` into the branch (A5), run the `RUN` lines it
|
|
133
|
+
printed, push, and enable the forge's auto-merge for the pull request
|
|
134
|
+
(`gh pr merge <N> --auto --merge` or the forge tool) so it merges on
|
|
135
|
+
green without polling; where auto-merge is not available, wait for
|
|
136
|
+
green checks and merge (`gh pr merge <N> --merge`). The forge deletes
|
|
137
|
+
the head branch. Confirm `origin/<main>` contains the merge, run
|
|
138
|
+
`python3 <S>/wt-roadmap.py done <change-id>` (it pushes the roadmap
|
|
139
|
+
state to `origin/<main>`), then the local cleanup of step 5. A red check
|
|
140
|
+
is fixed on the branch, never bypassed;
|
|
141
|
+
- `"push"`: Phase B as written (its `wt-roadmap.py done` included), then
|
|
142
|
+
push `<main>` through the pre-push hook (step 6's "no push" does not
|
|
143
|
+
apply). A rejected push → fetch, merge `origin/<main>`, push again;
|
|
135
144
|
4. report the merge (SHA, PR) to the coordinator or the project chat, and
|
|
136
145
|
close the session's thread when the harness has one.
|
|
137
146
|
|
|
@@ -157,15 +166,30 @@ add`), the change-id lives in `context/changes/`, the READY and merge reports
|
|
|
157
166
|
go to the coordinator's session by cross-session message, the go comes back
|
|
158
167
|
the same way, and the thread is resolved only after its pull request is merged.
|
|
159
168
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
`
|
|
169
|
+
**Bootstrap check (hosted thread, autonomous mode), in A0.** The coordinator
|
|
170
|
+
follows the managed block only if the project instructions point it there
|
|
171
|
+
(WORKFLOW §8.5, Bootstrap); without the pointer it runs on the harness defaults
|
|
172
|
+
and holds ready merges for the owner. So, at session start, look for the
|
|
173
|
+
pointer in the project instructions this session was given (the snippet, or
|
|
174
|
+
any reference to this repository's `AGENTS.md`). When it is missing, or there
|
|
175
|
+
are no project instructions at all, the first message to the coordinator says
|
|
176
|
+
so, carries the snippet from WORKFLOW §8.5 with `<owner>/<repo>` filled in from
|
|
177
|
+
`git remote get-url origin`, and asks the coordinator to read `AGENTS.md` and
|
|
178
|
+
`context/workflow.json` from the main branch now and to tell the owner where to
|
|
179
|
+
paste the snippet. Then carry on with the change; the check never blocks it.
|
|
180
|
+
|
|
181
|
+
**`worktree.cloudState: "branch"`** changes points 1, 6 and 7: the claim and
|
|
182
|
+
every stage are committed **on the session branch only** (`wt-roadmap.py` does
|
|
183
|
+
it by itself in that mode), A4 archives without `--handoff` (the branch writes
|
|
184
|
+
its own `done` row), and nothing goes to `origin/<main>` before the merge. The
|
|
185
|
+
price: every merge of `<main>` into the branch conflicts on `roadmap.md`, so a
|
|
186
|
+
merge can never skip the back-merge. Use it only when a push to `<main>` is
|
|
187
|
+
expensive (a pre-push hook without a cheap path for `context/`-only pushes,
|
|
188
|
+
WORKFLOW §2 → CI minutes) and a coordinator assigns the items — then the
|
|
189
|
+
assignment, not a claim on `<main>`, keeps two sessions off one item, so A1
|
|
190
|
+
takes the item it was given and does not need `origin/<main>` to show it free.
|
|
191
|
+
Default `"main"` is the flow below: the roadmap state lives on `origin/<main>`,
|
|
192
|
+
live for every stage, and the branch never edits `roadmap.md`.
|
|
169
193
|
|
|
170
194
|
**1. Claim first, on origin, before anything else.** Right after A1 picks the
|
|
171
195
|
item — before installing dependencies, before research — mark it taken **on
|
|
@@ -190,8 +214,8 @@ SHA before you start research.
|
|
|
190
214
|
The row says `cloud session, branch <session-branch> — do not take in another
|
|
191
215
|
session`. If `open` refuses because the row is already `in_progress`, another
|
|
192
216
|
session owns it: pick again (A1), never take it over. Every `stage` call later
|
|
193
|
-
in the chain
|
|
194
|
-
see live state. A1's "not already taken" check reads **`origin/<main>`**
|
|
217
|
+
in the chain, `ready`, and `done` after the merge go to origin the same way, so
|
|
218
|
+
the owner and every other session see live state. A1's "not already taken" check reads **`origin/<main>`**
|
|
195
219
|
(`git fetch origin <main> && git show origin/<main>:context/foundation/roadmap.md`),
|
|
196
220
|
not the local file.
|
|
197
221
|
|
|
@@ -239,9 +263,12 @@ project's CI on origin: push at READY and to sync before the merge, **never per
|
|
|
239
263
|
phase or per commit** (WORKFLOW §2, CI minutes).
|
|
240
264
|
|
|
241
265
|
**6. READY.** A3.8 runs before A4, as locally (unless the cadence defers it).
|
|
242
|
-
A5
|
|
243
|
-
|
|
244
|
-
|
|
266
|
+
A5 works on `origin/<main>` (after `git fetch origin <main>`), not the local
|
|
267
|
+
one, and with `autonomy.merge: "pr"` merges it in only when
|
|
268
|
+
`wt-merge-check.py` says `remerge` (A5). Then `wt-roadmap.py ready
|
|
269
|
+
<change-id>` (pushed to origin; with `cloudState: "branch"` committed on the
|
|
270
|
+
branch), push the session branch, open the pull request (with `autonomy.merge:
|
|
271
|
+
"pr"`), report, stop.
|
|
245
272
|
|
|
246
273
|
**No deploy from a cloud session, ever** — and, while `release.owner` is true,
|
|
247
274
|
from any session: no ssh to servers, no tags, no `gh release`, no edit of
|
|
@@ -273,9 +300,11 @@ git push origin <main> # the pre-push hook is the classic
|
|
|
273
300
|
Let the pre-push hook run — it *is* the full gate on `<main>` that A5 defers
|
|
274
301
|
to. If it fails, fix on the session branch, merge again, push again; never
|
|
275
302
|
`--no-verify`. A rejected push (`<main>` moved) → fetch, merge `origin/<main>`
|
|
276
|
-
into `<main>`, push again.
|
|
277
|
-
|
|
278
|
-
|
|
303
|
+
into `<main>`, push again. Then `python3 <S>/wt-roadmap.py done <change-id>`
|
|
304
|
+
records `done` / `done_code` on `origin/<main>` from the archived change's
|
|
305
|
+
`## Roadmap handoff` (with `cloudState: "branch"` the row arrived with the
|
|
306
|
+
merge itself). No worktree to remove; don't delete the session branch (the
|
|
307
|
+
harness owns it).
|
|
279
308
|
|
|
280
309
|
## The Prime Directive
|
|
281
310
|
|
|
@@ -452,8 +481,9 @@ folder"), use exactly that source. Moving an entry from `context/backlog/` into
|
|
|
452
481
|
> **Cloud session:** replaced by *Cloud session* points 1–3.
|
|
453
482
|
|
|
454
483
|
Order matters: **mark the roadmap on `<main>` first, then branch from it**, so
|
|
455
|
-
the
|
|
456
|
-
|
|
484
|
+
the claim is on `<main>` before any work starts. From here on the branch never
|
|
485
|
+
edits `roadmap.md` (A4); every later stage is a `wt-roadmap.py` commit on
|
|
486
|
+
`<main>`.
|
|
457
487
|
|
|
458
488
|
```bash
|
|
459
489
|
python3 <S>/wt-roadmap.py open <change-id> [--note "prerequisite X on branch Y — merge after X"]
|
|
@@ -790,23 +820,41 @@ owner. This rule may be the only thing between a session and production.
|
|
|
790
820
|
|
|
791
821
|
### A4 — Archive on the branch
|
|
792
822
|
|
|
793
|
-
Stage `archive`, then `/softure-archive <change-id> --auto` — **no
|
|
794
|
-
`<main>`** (the change branch may go to origin, `<main>` never). It
|
|
795
|
-
`change.md`, moves the folder to `context/archive/<created>-<id>/` and
|
|
796
|
-
`chore(archive): close <change-id>`. Commit uncommitted files of the
|
|
797
|
-
folder first (they are yours). Then, on the branch:
|
|
798
|
-
|
|
799
|
-
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
(`
|
|
823
|
+
Stage `archive`, then `/softure-archive <change-id> --auto --handoff` — **no
|
|
824
|
+
push of `<main>`** (the change branch may go to origin, `<main>` never). It
|
|
825
|
+
stamps `change.md`, moves the folder to `context/archive/<created>-<id>/` and
|
|
826
|
+
commits `chore(archive): close <change-id>`. Commit uncommitted files of the
|
|
827
|
+
change folder first (they are yours). Then, on the branch:
|
|
828
|
+
|
|
829
|
+
- **`roadmap.md` is not touched on the branch.** The archived `change.md`
|
|
830
|
+
carries `## Roadmap handoff` instead: `Status: done`, or `done_code
|
|
831
|
+
(waiting: <what waits for the release>)` when the change awaits a deploy
|
|
832
|
+
(pure document changes stay `done`), the `## Done` outcome, the owner checks
|
|
833
|
+
and the steps for `## Before the next release`. `wt-roadmap.py done
|
|
834
|
+
<change-id>` writes all of it on `<main>` right after the merge (Phase B).
|
|
835
|
+
With `cloudState: "branch"` archive without `--handoff`: the branch's row and
|
|
836
|
+
item block must read `done` / `done_code`, and the `## Done` line is there.
|
|
803
837
|
- Re-point links: documents that referenced `context/changes/<id>/` must now
|
|
804
838
|
point to `context/archive/<date>-<id>/` (`grep -rn "changes/<id>"`).
|
|
805
839
|
- Commit on the branch.
|
|
806
840
|
|
|
807
841
|
### A5 — Sync with `<main>` and prove it
|
|
808
842
|
|
|
809
|
-
`<main>` moved while you worked. It
|
|
843
|
+
`<main>` moved while you worked. It usually does.
|
|
844
|
+
|
|
845
|
+
**Autonomous mode with `autonomy.merge: "pr"`: merge it in only when needed.** Run
|
|
846
|
+
`python3 <S>/wt-merge-check.py` (it fetches `origin/<main>`). `VERDICT
|
|
847
|
+
merge-as-is` → skip the merge; READY says `<main> not merged in
|
|
848
|
+
(wt-merge-check: merge-as-is)` and the pull request is merged as it is after
|
|
849
|
+
the go. `VERDICT remerge` → merge as below, then run the `RUN` lines it printed
|
|
850
|
+
(the gates the merge can break: `GATES related` or `full`) before pushing.
|
|
851
|
+
`autonomy.remergeMain: "on-conflict"` → `remerge` only when the merge would
|
|
852
|
+
conflict (its trial merge, or `--not-mergeable` when the forge says so);
|
|
853
|
+
overlap, migrations and dependency changes are printed but do not force it, and
|
|
854
|
+
a go under this policy never asks for "Update branch".
|
|
855
|
+
`autonomy.remergeMain: "always"` → always merge. The same check runs again
|
|
856
|
+
after the go (*Operating mode*), because `<main>` keeps moving. Otherwise
|
|
857
|
+
(manual mode, or `autonomy.merge: "push"`) the branch is always made current:
|
|
810
858
|
|
|
811
859
|
```bash
|
|
812
860
|
cd <WT> && git merge <main> # merge, NOT rebase: ## Progress holds the branch's SHAs
|
|
@@ -817,15 +865,15 @@ check them:
|
|
|
817
865
|
|
|
818
866
|
| File | Resolution |
|
|
819
867
|
| --- | --- |
|
|
820
|
-
| `roadmap.md
|
|
821
|
-
| `roadmap.md`, every other row and section | **`<main>`** |
|
|
868
|
+
| `roadmap.md` | **`<main>`**: the branch never edits it (A4 hands off). Only with `cloudState: "branch"`: your row and block from the **branch** (`done` / `done_code`), every other row and section from `<main>` |
|
|
822
869
|
| `lessons.md` | `<main>`'s entries first, yours after, **renumbered** to the next free number (`wt-status.sh`). Update every reference to your old numbers (plan, reviews, archive docs, code comments): `grep -rn "L-<old>"`. |
|
|
823
870
|
| migration number collision (`migrations.dir`) | `<main>`'s migration keeps its number. Save your migration body (it may hold hand edits). Remove your migration and whatever metadata the generator keeps for it, take `<main>`'s metadata, run `migrations.regenerate`, then diff the new file against the saved body and restore any hand edits. Update prose that names the number. |
|
|
824
871
|
| `change.md` / archive docs of other changes | union: keep `<main>`'s links and add yours |
|
|
825
872
|
| code | resolve on the merits; this is the only row that needs thought |
|
|
826
873
|
|
|
827
|
-
Then commit the merge. **No full gates after a back-merge
|
|
828
|
-
|
|
874
|
+
Then commit the merge. **No full gates after a back-merge** (with
|
|
875
|
+
`autonomy.merge: "pr"`, the `RUN` lines of `wt-merge-check.py` instead). The
|
|
876
|
+
pre-commit hook is enough; don't run the test gate or integration on the merged tree, and
|
|
829
877
|
don't repeat A3.8 — the item's integration run was on the pre-merge branch,
|
|
830
878
|
and that is the one READY reports. Full gates run twice anyway: in the
|
|
831
879
|
worktree before the back-merge, and the classic way on `<main>` after Phase B
|
|
@@ -851,7 +899,7 @@ Write it in `chatLanguage` (default: `language`), for someone who wasn't there:
|
|
|
851
899
|
```
|
|
852
900
|
<ID> `<change-id>` — ready to merge.
|
|
853
901
|
|
|
854
|
-
Branch <change-id> (worktree ../<repo>-<change-id>), <N> commits, <main> merged in @ <sha
|
|
902
|
+
Branch <change-id> (worktree ../<repo>-<change-id>), <N> commits, <main> merged in @ <sha> | <main> not merged in (wt-merge-check: merge-as-is).
|
|
855
903
|
Gates on the branch before merging <main>: <each gate> ✓ (tests <count>)
|
|
856
904
|
integration: <green|red|n/a|not configured> <passed>/<total> on <sha> — <url>; new reds: <list or "none">
|
|
857
905
|
(reds already on <main>: <list or "none">; flaky: <list or "none">)
|
|
@@ -881,7 +929,9 @@ means sleeping until someone nudges you. Then, after every push of a branch
|
|
|
881
929
|
with an open pull request (READY, and Phase B after the go), check its checks
|
|
882
930
|
yourself until they finish: a scheduled wake-up every few minutes, for at most
|
|
883
931
|
about 60 minutes, then report to the coordinator what is still pending. When
|
|
884
|
-
the checks are green after the go, merge at once.
|
|
932
|
+
the checks are green after the go, merge at once. After the go, prefer the
|
|
933
|
+
forge's auto-merge (*Operating mode*, step 3): it merges on green by itself,
|
|
934
|
+
so there is nothing to poll for.
|
|
885
935
|
|
|
886
936
|
## Phase B — merge (on the owner's signal; autonomous mode: see *Operating mode*)
|
|
887
937
|
|
|
@@ -924,6 +974,11 @@ merge at the end.
|
|
|
924
974
|
proof that `<main>` holds exactly the branch's tree. The full gates on that
|
|
925
975
|
tree run the classic way on `<main>` afterwards; say that in the report.
|
|
926
976
|
With `--no-tests`, the owner has also waived that later run; say so.
|
|
977
|
+
Then record the roadmap state on `<main>`: `python3 <S>/wt-roadmap.py done
|
|
978
|
+
<change-id>` (a documents-only commit of the row, the item block, `## Done`,
|
|
979
|
+
the owner checks and the release steps from the archived change's
|
|
980
|
+
`## Roadmap handoff`; with `cloudState: "branch"` the merge already brought
|
|
981
|
+
them).
|
|
927
982
|
5. **Cleanup — only your own:**
|
|
928
983
|
```bash
|
|
929
984
|
git -C <WT> status --short # must be empty (ignored files are fine)
|
|
@@ -961,13 +1016,14 @@ merge at the end.
|
|
|
961
1016
|
- **See the test fail before you believe the fix**; an arithmetic fix gets an
|
|
962
1017
|
oracle of a different kind.
|
|
963
1018
|
- **`<main>` is written by exactly two things:** `wt-roadmap.py` (one row per
|
|
964
|
-
commit) and the final
|
|
1019
|
+
commit, `done` included) and the final merge. **The branch never edits
|
|
1020
|
+
`roadmap.md`** (unless `cloudState: "branch"`). Nothing else from this skill lands on
|
|
965
1021
|
`<main>`, and nothing lands there before the owner's signal. Refs this skill
|
|
966
1022
|
may push: the change branch and whatever the project's integration command
|
|
967
1023
|
pushes — nothing else.
|
|
968
1024
|
- **The roadmap on `<main>` always shows where the change is:** `in_progress`
|
|
969
1025
|
from A2 with the current stage, `ready_to_merge` at READY,
|
|
970
|
-
`done` / `done_code` after the merge.
|
|
1026
|
+
`done` / `done_code` right after the merge (`wt-roadmap.py done`).
|
|
971
1027
|
- **Every file edit from A2 to B1 lands under `<WT>`**, never in the main tree.
|
|
972
1028
|
- **Integration: the full suite, once per item** (cadence `change`; once per
|
|
973
1029
|
roadmap at the coordinator's M7 with cadence `roadmap`) — A3.8, after impl-review and
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Decide whether a change branch must merge the main branch in again before its merge, and which gates
|
|
3
|
+
that merge has to re-run.
|
|
4
|
+
|
|
5
|
+
wt-merge-check.py [--base <ref>] [--no-fetch] [--not-mergeable]
|
|
6
|
+
|
|
7
|
+
Run in the change branch's checkout (worktree or cloud session), after the go and before merging the
|
|
8
|
+
pull request. Compares what `<main>` brought since the branch last merged it (merge-base..origin/<main>)
|
|
9
|
+
with what the branch changes (merge-base..HEAD) and prints:
|
|
10
|
+
|
|
11
|
+
VERDICT merge-as-is | remerge
|
|
12
|
+
GATES none | related | full
|
|
13
|
+
<one line per finding: incoming, conflict, overlap, migrations, dependencies, test setup/config>
|
|
14
|
+
RUN <command> (only with `remerge`: the gates to run on the merged tree, in order)
|
|
15
|
+
|
|
16
|
+
`conflict` is a local trial merge (`git merge-tree --write-tree`, nothing is written to the branch or the
|
|
17
|
+
working tree): `none`, `yes` with the conflicting files, or `unknown` when this git cannot run it (2.38+
|
|
18
|
+
needed). Pass `--not-mergeable` when the forge reports the pull request not mergeable; it counts as a
|
|
19
|
+
conflict under every policy.
|
|
20
|
+
|
|
21
|
+
`merge-as-is` — `<main>` has not moved, or `autonomy.remergeMain` finds no reason to merge it in:
|
|
22
|
+
- `"when-needed"` (the default): `<main>` brought no migration, no dependency change and no file the
|
|
23
|
+
branch also changes (a conflict always comes with such a file);
|
|
24
|
+
- `"on-conflict"`: the merge does not conflict. Overlap, migrations and dependency changes are still
|
|
25
|
+
printed (and still decide GATES when a remerge does happen), but they do not force a remerge. The
|
|
26
|
+
merged result is then not tested before the merge: a change that is incompatible without conflicting
|
|
27
|
+
surfaces on `<main>` or in the release gate instead of on the branch.
|
|
28
|
+
Merge the pull request as it is, provided the forge reports it mergeable and its checks were green at
|
|
29
|
+
READY. No push, no hook.
|
|
30
|
+
|
|
31
|
+
`remerge` — merge `origin/<main>` into the branch, resolve, run the RUN lines, push. GATES says what the
|
|
32
|
+
merge can break:
|
|
33
|
+
- `related`: every gate except `gates.test`, then `autonomy.relatedTests` with `{files}` replaced by
|
|
34
|
+
the files the branch changes (on the merged tree);
|
|
35
|
+
- `full`: every gate — the incoming changes add a migration or touch dependencies, test setup or
|
|
36
|
+
config (built-in patterns plus `autonomy.fullGatePaths`), or `autonomy.relatedTests` is not set.
|
|
37
|
+
|
|
38
|
+
`autonomy.remergeMain: "always"` keeps the old behaviour (always `remerge`; GATES is still computed).
|
|
39
|
+
The release gate runs the full suite once per roadmap either way (WORKFLOW.md §2).
|
|
40
|
+
"""
|
|
41
|
+
from __future__ import annotations
|
|
42
|
+
|
|
43
|
+
import argparse
|
|
44
|
+
import fnmatch
|
|
45
|
+
import os
|
|
46
|
+
import shlex
|
|
47
|
+
import subprocess
|
|
48
|
+
import sys
|
|
49
|
+
|
|
50
|
+
sys.dont_write_bytecode = True # no __pycache__ inside the consumer's .claude/skills
|
|
51
|
+
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
|
|
52
|
+
from wt_config import load_config # noqa: E402
|
|
53
|
+
|
|
54
|
+
POLICIES = ("when-needed", "on-conflict", "always")
|
|
55
|
+
DEPENDENCY_FILES = {
|
|
56
|
+
"package.json", "package-lock.json", "npm-shrinkwrap.json", "pnpm-lock.yaml", "pnpm-workspace.yaml",
|
|
57
|
+
"yarn.lock", "bun.lock", "bun.lockb", ".npmrc", ".nvmrc", ".node-version",
|
|
58
|
+
"requirements.txt", "pyproject.toml", "poetry.lock", "uv.lock", "Pipfile", "Pipfile.lock",
|
|
59
|
+
"go.mod", "go.sum", "Cargo.toml", "Cargo.lock", "Gemfile", "Gemfile.lock",
|
|
60
|
+
"composer.json", "composer.lock", "Directory.Packages.props", "packages.lock.json",
|
|
61
|
+
}
|
|
62
|
+
FULL_GATE_PATTERNS = [
|
|
63
|
+
"vitest.config.*", "vitest.setup.*", "vitest.workspace.*", "jest.config.*", "jest.setup.*",
|
|
64
|
+
"playwright.config.*", "tsconfig*.json", "eslint.config.*", ".eslintrc*", "biome.json*",
|
|
65
|
+
"babel.config.*", ".babelrc*", "lefthook.yml", "lefthook.yaml", ".husky/*", ".github/workflows/*",
|
|
66
|
+
"test/setup*", "tests/setup*", "**/test-setup.*", "**/setupTests.*",
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def git(*args: str) -> str:
|
|
71
|
+
return subprocess.run(["git", *args], check=True, capture_output=True, text=True).stdout
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def changed(rev_a: str, rev_b: str) -> list[str]:
|
|
75
|
+
return [f for f in git("diff", "--name-only", "--no-renames", rev_a, rev_b).splitlines() if f]
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def matches(path: str, patterns: list[str]) -> bool:
|
|
79
|
+
name = os.path.basename(path)
|
|
80
|
+
return any(fnmatch.fnmatch(path, p) or fnmatch.fnmatch(name, p) for p in patterns)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def listing(files: list[str], limit: int = 8) -> str:
|
|
84
|
+
if not files:
|
|
85
|
+
return "none"
|
|
86
|
+
more = f" (+{len(files) - limit} more)" if len(files) > limit else ""
|
|
87
|
+
return ", ".join(files[:limit]) + more
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def trial_merge(merge_base: str, head: str, base_sha: str) -> tuple[str, list[str]]:
|
|
91
|
+
"""Merge `base_sha` into `head` in memory. Returns ("none" | "yes" | "unknown", conflicting files)."""
|
|
92
|
+
result = subprocess.run(
|
|
93
|
+
["git", "merge-tree", "--write-tree", "--name-only", "--no-messages",
|
|
94
|
+
f"--merge-base={merge_base}", head, base_sha],
|
|
95
|
+
capture_output=True, text=True,
|
|
96
|
+
)
|
|
97
|
+
if result.returncode == 0:
|
|
98
|
+
return "none", []
|
|
99
|
+
if result.returncode == 1:
|
|
100
|
+
lines = [line for line in result.stdout.splitlines()[1:] if line]
|
|
101
|
+
return "yes", sorted(set(lines))
|
|
102
|
+
return "unknown", []
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def main() -> None:
|
|
106
|
+
parser = argparse.ArgumentParser(add_help=True, description=__doc__.split("\n\n")[0])
|
|
107
|
+
parser.add_argument("--base", help="ref of the main branch to compare with (default: origin/<main>)")
|
|
108
|
+
parser.add_argument("--no-fetch", action="store_true")
|
|
109
|
+
parser.add_argument("--not-mergeable", action="store_true",
|
|
110
|
+
help="the forge reports the pull request not mergeable (a conflict with the main branch)")
|
|
111
|
+
opts = parser.parse_args()
|
|
112
|
+
|
|
113
|
+
config = load_config()
|
|
114
|
+
main_ref = config["mainBranch"]
|
|
115
|
+
autonomy = config.get("autonomy") or {}
|
|
116
|
+
base = opts.base or f"origin/{main_ref}"
|
|
117
|
+
if not opts.no_fetch and not opts.base:
|
|
118
|
+
subprocess.run(["git", "fetch", "-q", "origin", main_ref], check=False)
|
|
119
|
+
|
|
120
|
+
head = git("rev-parse", "HEAD").strip()
|
|
121
|
+
base_sha = git("rev-parse", base).strip()
|
|
122
|
+
merge_base = git("merge-base", head, base_sha).strip()
|
|
123
|
+
incoming = changed(merge_base, base_sha)
|
|
124
|
+
ours = changed(merge_base, head)
|
|
125
|
+
overlap = sorted(set(incoming) & set(ours))
|
|
126
|
+
|
|
127
|
+
migrations_dir = ((config.get("migrations") or {}).get("dir") or "").rstrip("/")
|
|
128
|
+
migrations = [f for f in incoming if migrations_dir and f.startswith(migrations_dir + "/")]
|
|
129
|
+
dependencies = [f for f in incoming if os.path.basename(f) in DEPENDENCY_FILES]
|
|
130
|
+
setup = [f for f in incoming if matches(f, FULL_GATE_PATTERNS + list(autonomy.get("fullGatePaths") or []))]
|
|
131
|
+
|
|
132
|
+
policy = autonomy.get("remergeMain") or "when-needed"
|
|
133
|
+
if policy not in POLICIES:
|
|
134
|
+
sys.exit(f"autonomy.remergeMain={policy!r} is not one of: {', '.join(POLICIES)}")
|
|
135
|
+
moved = merge_base != base_sha
|
|
136
|
+
conflict, conflicting = trial_merge(merge_base, head, base_sha) if moved else ("none", [])
|
|
137
|
+
conflicts = opts.not_mergeable or conflict != "none" # unknown counts as a conflict: never guess clean
|
|
138
|
+
if policy == "always":
|
|
139
|
+
needed = moved or opts.not_mergeable
|
|
140
|
+
elif policy == "on-conflict":
|
|
141
|
+
needed = conflicts
|
|
142
|
+
else:
|
|
143
|
+
# a textual conflict always shows up as an overlapping file
|
|
144
|
+
needed = opts.not_mergeable or (moved and bool(overlap or migrations or dependencies))
|
|
145
|
+
related_cmd = autonomy.get("relatedTests")
|
|
146
|
+
full = bool(migrations or dependencies or setup) or not related_cmd
|
|
147
|
+
|
|
148
|
+
print(f"VERDICT {'remerge' if needed else 'merge-as-is'}")
|
|
149
|
+
print(f"GATES {'none' if not needed else ('full' if full else 'related')}")
|
|
150
|
+
if not moved:
|
|
151
|
+
print(f"incoming: none — {base} ({base_sha[:8]}) is already in the branch")
|
|
152
|
+
else:
|
|
153
|
+
count = int(git("rev-list", "--count", f"{merge_base}..{base_sha}").strip())
|
|
154
|
+
print(f"incoming: {len(incoming)} files in {count} commits since {merge_base[:8]} ({base} {base_sha[:8]})")
|
|
155
|
+
if conflict == "yes":
|
|
156
|
+
print(f"conflict: yes — {listing(conflicting)}")
|
|
157
|
+
elif conflict == "unknown":
|
|
158
|
+
print("conflict: unknown — `git merge-tree --write-tree` failed (git 2.38+ needed); treated as a conflict")
|
|
159
|
+
else:
|
|
160
|
+
print("conflict: none")
|
|
161
|
+
if opts.not_mergeable:
|
|
162
|
+
print("forge: the pull request is not mergeable (--not-mergeable)")
|
|
163
|
+
print(f"overlap: {listing(overlap)}")
|
|
164
|
+
print(f"migrations: {listing(migrations)}")
|
|
165
|
+
print(f"dependencies: {listing(dependencies)}")
|
|
166
|
+
print(f"test setup/config: {listing(setup)}")
|
|
167
|
+
print(f"policy: autonomy.remergeMain={policy}; relatedTests={'set' if related_cmd else 'not set'}")
|
|
168
|
+
if not needed:
|
|
169
|
+
return
|
|
170
|
+
|
|
171
|
+
gates = config.get("gates") or {}
|
|
172
|
+
if full:
|
|
173
|
+
for name, cmd in gates.items():
|
|
174
|
+
if cmd:
|
|
175
|
+
print(f"RUN {cmd}")
|
|
176
|
+
return
|
|
177
|
+
for name, cmd in gates.items():
|
|
178
|
+
if cmd and name != "test":
|
|
179
|
+
print(f"RUN {cmd}")
|
|
180
|
+
existing = set(git("ls-tree", "-r", "--name-only", head).splitlines())
|
|
181
|
+
files = [f for f in ours if f in existing and not f.startswith("context/")]
|
|
182
|
+
if files:
|
|
183
|
+
print(f"RUN {related_cmd.replace('{files}', ' '.join(shlex.quote(f) for f in files))}")
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
if __name__ == "__main__":
|
|
187
|
+
main()
|
|
@@ -4,12 +4,25 @@
|
|
|
4
4
|
wt-roadmap.py open <change-id> [--note "…"] [--dry-run]
|
|
5
5
|
wt-roadmap.py stage <change-id> "<stage>" [--dry-run]
|
|
6
6
|
wt-roadmap.py ready <change-id> [--dry-run]
|
|
7
|
+
wt-roadmap.py done <change-id> [--dry-run]
|
|
8
|
+
wt-roadmap.py done_code <change-id> --waiting "<what>" [--dry-run]
|
|
7
9
|
(cloud sessions additionally: [--cloud] [--branch <branch>] — see below)
|
|
8
10
|
|
|
9
11
|
`open` — status -> **in_progress** (research, since <today>; worktree `../<repo>-<id>`, branch `<id>`[; note])
|
|
10
12
|
`stage` — replaces only the stage inside the parentheses: research -> frame -> plan -> plan-review ->
|
|
11
13
|
implement N/M -> impl-review -> integration -> archive (WORKFLOW.md §5)
|
|
12
14
|
`ready` — **in_progress** (<stage>, since …; <where>) -> **ready_to_merge** (since <today>; <where>)
|
|
15
|
+
`done` — run right after the change's merge: the row and the item block -> `done` (or
|
|
16
|
+
`done_code (<today>; waiting: <what>)`), plus the `## Done`, `## Owner decisions and checks`
|
|
17
|
+
and `## Before the next release` lines. All of it comes from the `## Roadmap handoff`
|
|
18
|
+
section that `softure-archive --handoff` wrote into the archived change.md
|
|
19
|
+
(`context/archive/<created>-<id>/change.md` on the main branch). `done` follows the
|
|
20
|
+
handoff's status; `done_code --waiting "…"` forces `done_code` with that text. Lines
|
|
21
|
+
already present are not added twice, so a re-run is safe.
|
|
22
|
+
|
|
23
|
+
Branches never edit roadmap.md (unless `worktree.cloudState` is "branch"): the roadmap state lives
|
|
24
|
+
on the main branch, written only by this script, so merging the main branch into a change branch
|
|
25
|
+
never conflicts on it.
|
|
13
26
|
|
|
14
27
|
Why a script instead of editing the file: sessions in worktrees used to edit the main tree's
|
|
15
28
|
roadmap without committing. Someone else's uncommitted rows then sat in `roadmap.md`, every
|
|
@@ -30,9 +43,11 @@ fresh state. `--branch <name>` overrides the branch written into the row (defaul
|
|
|
30
43
|
|
|
31
44
|
With `worktree.cloudState: "branch"` in context/workflow.json, a cloud session instead commits
|
|
32
45
|
the edit **on its own branch** (the checkout) and pushes nothing: the branch carries the state
|
|
33
|
-
and `<main>` changes only through the merge.
|
|
34
|
-
|
|
35
|
-
that
|
|
46
|
+
and `<main>` changes only through the merge. Every merge of `<main>` into such a branch then
|
|
47
|
+
conflicts on the roadmap, so prefer the default and give the project's pre-push hook a cheap path
|
|
48
|
+
for pushes that touch only `context/` (WORKFLOW.md §2, CI minutes). Use "branch" only when a
|
|
49
|
+
coordinator assigns the items (so nobody needs to see a claim on `<main>`) and a push to `<main>`
|
|
50
|
+
stays expensive or contended by many sessions.
|
|
36
51
|
"""
|
|
37
52
|
from __future__ import annotations
|
|
38
53
|
|
|
@@ -56,6 +71,9 @@ ROW_RE = re.compile(r"^(?P<head>\|.*\|\s*)(?P<status>[^|]*?)(?P<tail>\s*\|\s*)$"
|
|
|
56
71
|
ID_RE = re.compile(r"^\| \*\*([A-Z]+-\d+)\*\* \|")
|
|
57
72
|
STAGE_RE = re.compile(r"(in_progress\*{0,2} \()([^,;)]*)(, since )")
|
|
58
73
|
READY_RE = re.compile(r"(\*{0,2})in_progress(\*{0,2}) \([^,;)]*, since [0-9-]+; ")
|
|
74
|
+
HANDOFF_RE = re.compile(r"^- \*\*(?P<key>[^*]+):\*\* ?(?P<value>.*)$")
|
|
75
|
+
ARCHIVED_RE = re.compile(r"^Archived [0-9-]+: (?P<outcome>.+?)\.?$")
|
|
76
|
+
DONE_CODE_RE = re.compile(r"^done_code \((?:[0-9-]+; )?waiting: (?P<waiting>.+)\)$")
|
|
59
77
|
|
|
60
78
|
|
|
61
79
|
def git(repo: str, *args: str, env: dict[str, str] | None = None) -> str:
|
|
@@ -89,8 +107,93 @@ def item_id(line: str, change_id: str) -> str:
|
|
|
89
107
|
return match.group(1) if match else change_id
|
|
90
108
|
|
|
91
109
|
|
|
110
|
+
def read_handoff(repo: str, rev: str, change_id: str) -> dict:
|
|
111
|
+
"""Read the archived change folder of `change_id` at `rev` and its `## Roadmap handoff` section.
|
|
112
|
+
|
|
113
|
+
Returns {"archive", "status", "waiting", "outcome", "owner": [...], "release": [...]}. Without a
|
|
114
|
+
handoff section (an archive written before it existed) the outcome falls back to the
|
|
115
|
+
`Archived <date>: <outcome>.` line under `## Notes`, the status to `done`.
|
|
116
|
+
"""
|
|
117
|
+
names = git(repo, "ls-tree", "-d", "--name-only", rev, "context/archive/").splitlines()
|
|
118
|
+
pattern = re.compile(rf"^context/archive/[0-9]{{4}}-[0-9]{{2}}-[0-9]{{2}}-{re.escape(change_id)}$")
|
|
119
|
+
hits = [name for name in names if pattern.match(name)]
|
|
120
|
+
if len(hits) != 1:
|
|
121
|
+
sys.exit(f"{len(hits)} archive folders for `{change_id}` on {rev} — expected exactly 1 "
|
|
122
|
+
f"(run `done` only after the change's merge, which carries its archive commit)")
|
|
123
|
+
text = git(repo, "show", f"{rev}:{hits[0]}/change.md")
|
|
124
|
+
handoff = {"archive": hits[0][len("context/"):] + "/", "status": "done", "waiting": None,
|
|
125
|
+
"outcome": None, "owner": [], "release": [], "found": False}
|
|
126
|
+
section = None
|
|
127
|
+
for line in text.splitlines():
|
|
128
|
+
if line.startswith("## "):
|
|
129
|
+
section = line[3:].strip()
|
|
130
|
+
continue
|
|
131
|
+
if section == "Notes" and handoff["outcome"] is None:
|
|
132
|
+
archived = ARCHIVED_RE.match(line.strip())
|
|
133
|
+
if archived:
|
|
134
|
+
handoff["outcome"] = archived["outcome"]
|
|
135
|
+
if section != "Roadmap handoff":
|
|
136
|
+
continue
|
|
137
|
+
match = HANDOFF_RE.match(line.strip())
|
|
138
|
+
if not match:
|
|
139
|
+
continue
|
|
140
|
+
handoff["found"] = True
|
|
141
|
+
key, value = match["key"].strip().lower(), match["value"].strip()
|
|
142
|
+
if key == "status":
|
|
143
|
+
waiting = DONE_CODE_RE.match(value)
|
|
144
|
+
handoff["status"] = "done_code" if waiting else "done"
|
|
145
|
+
handoff["waiting"] = waiting["waiting"] if waiting else None
|
|
146
|
+
elif key == "done":
|
|
147
|
+
handoff["outcome"] = value
|
|
148
|
+
elif key == "owner check":
|
|
149
|
+
handoff["owner"].append(value)
|
|
150
|
+
elif key == "before the next release":
|
|
151
|
+
handoff["release"].append(value)
|
|
152
|
+
return handoff
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
def append_to_section(lines: list[str], heading: str, entry: str, before: tuple[str, ...]) -> None:
|
|
156
|
+
"""Append `entry` at the end of `## <heading>`; create the section in front of the first of `before`
|
|
157
|
+
that exists (else at the end of the file). An entry already present is not added again."""
|
|
158
|
+
if any(line.rstrip("\n") == entry for line in lines):
|
|
159
|
+
return
|
|
160
|
+
start = next((k for k, line in enumerate(lines) if line.rstrip() == f"## {heading}"), None)
|
|
161
|
+
if start is None:
|
|
162
|
+
at = next((k for k, line in enumerate(lines) if line.rstrip() in {f"## {b}" for b in before}), None)
|
|
163
|
+
block = [f"## {heading}\n", f"{entry}\n", "\n"]
|
|
164
|
+
if at is None:
|
|
165
|
+
if lines and not lines[-1].endswith("\n"):
|
|
166
|
+
lines[-1] += "\n"
|
|
167
|
+
if lines and lines[-1].strip():
|
|
168
|
+
block.insert(0, "\n")
|
|
169
|
+
lines.extend(block[:-1])
|
|
170
|
+
else:
|
|
171
|
+
lines[at:at] = block
|
|
172
|
+
return
|
|
173
|
+
end = next((k for k in range(start + 1, len(lines)) if lines[k].startswith("## ")), len(lines))
|
|
174
|
+
while end > start + 1 and not lines[end - 1].strip():
|
|
175
|
+
end -= 1
|
|
176
|
+
if end == len(lines) and lines and not lines[-1].endswith("\n"):
|
|
177
|
+
lines[-1] += "\n"
|
|
178
|
+
lines.insert(end, f"{entry}\n")
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
def done_status(handoff: dict, mode: str, arg: str | None, today: str) -> str:
|
|
182
|
+
if mode == "done_code" or handoff["status"] == "done_code":
|
|
183
|
+
return f"done_code ({today}; waiting: {arg or handoff['waiting']})"
|
|
184
|
+
return "done"
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
def unchanged(old: str, new: str, target: str) -> bool:
|
|
188
|
+
"""A re-run (e.g. `done` after a retry) whose edit is already in place commits nothing."""
|
|
189
|
+
if re.sub(r"(?m)^updated: .*$", "", old) != re.sub(r"(?m)^updated: .*$", "", new):
|
|
190
|
+
return False
|
|
191
|
+
print(f"roadmap on {target} already up to date — nothing to commit")
|
|
192
|
+
return True
|
|
193
|
+
|
|
194
|
+
|
|
92
195
|
def edit(text: str, mode: str, change_id: str, arg: str | None, repo_name: str,
|
|
93
|
-
cloud_branch: str | None = None) -> str:
|
|
196
|
+
cloud_branch: str | None = None, handoff: dict | None = None) -> str:
|
|
94
197
|
lines = text.splitlines(keepends=True)
|
|
95
198
|
i = find_row(lines, change_id)
|
|
96
199
|
today = dt.date.today().isoformat()
|
|
@@ -107,6 +210,13 @@ def edit(text: str, mode: str, change_id: str, arg: str | None, repo_name: str,
|
|
|
107
210
|
where = f"worktree `../{repo_name}-{change_id}`, branch `{change_id}`"
|
|
108
211
|
lines[i] = set_row_status(lines[i], f"**in_progress** (research, since {today}; {where}{note})")
|
|
109
212
|
body_status = f"- **Status:** in_progress (research, since {today}; {where}{note})\n"
|
|
213
|
+
elif mode in ("done", "done_code"):
|
|
214
|
+
status = done_status(handoff, mode, arg, today)
|
|
215
|
+
current = row_status(lines[i]).strip()
|
|
216
|
+
if current.startswith(("done", "**done")):
|
|
217
|
+
status = current.replace("**", "") # a re-run keeps the recorded date and text
|
|
218
|
+
lines[i] = set_row_status(lines[i], status)
|
|
219
|
+
body_status = f"- **Status:** {status}\n"
|
|
110
220
|
elif mode == "stage":
|
|
111
221
|
new, count = STAGE_RE.subn(lambda m: f"{m[1]}{arg}{m[3]}", lines[i], count=1)
|
|
112
222
|
if count != 1:
|
|
@@ -126,7 +236,7 @@ def edit(text: str, mode: str, change_id: str, arg: str | None, repo_name: str,
|
|
|
126
236
|
len(lines),
|
|
127
237
|
)
|
|
128
238
|
sidx = next((k for k in range(cid + 1, end) if lines[k].startswith("- **Status:**")), None)
|
|
129
|
-
if mode
|
|
239
|
+
if mode in ("open", "done", "done_code"):
|
|
130
240
|
if sidx is None:
|
|
131
241
|
lines.insert(cid + 1, body_status)
|
|
132
242
|
else:
|
|
@@ -136,17 +246,44 @@ def edit(text: str, mode: str, change_id: str, arg: str | None, repo_name: str,
|
|
|
136
246
|
elif sidx is not None:
|
|
137
247
|
lines[sidx] = READY_RE.sub(lambda m: f"{m[1]}ready_to_merge{m[2]} (since {today}; ", lines[sidx], count=1)
|
|
138
248
|
|
|
249
|
+
if mode in ("done", "done_code"):
|
|
250
|
+
rid = item_id(lines[i], change_id)
|
|
251
|
+
outcome = handoff["outcome"] or "delivered"
|
|
252
|
+
for check in handoff["owner"]:
|
|
253
|
+
append_to_section(lines, "Owner decisions and checks",
|
|
254
|
+
f"- [ ] **{rid}**: {check}. {handoff['archive']}plan.md", ("Done", "Decisions (auto)"))
|
|
255
|
+
for step in handoff["release"]:
|
|
256
|
+
append_to_section(lines, "Before the next release", f"- [ ] {step} (**{rid}**)",
|
|
257
|
+
("Owner decisions and checks", "Done", "Decisions (auto)"))
|
|
258
|
+
append_to_section(lines, "Done", f"- **{rid}** `{change_id}`: {outcome}; archived in `{handoff['archive']}`",
|
|
259
|
+
("Decisions (auto)",))
|
|
260
|
+
|
|
139
261
|
out = "".join(lines)
|
|
140
262
|
return re.sub(r"(?m)^updated: .*$", f"updated: {today}", out, count=1)
|
|
141
263
|
|
|
142
264
|
|
|
143
|
-
def commit_message(text: str, mode: str, change_id: str, arg: str | None, where: str
|
|
265
|
+
def commit_message(text: str, mode: str, change_id: str, arg: str | None, where: str,
|
|
266
|
+
new_text: str | None = None) -> str:
|
|
144
267
|
lines = text.splitlines(keepends=True)
|
|
145
268
|
rid = item_id(lines[find_row(lines, change_id)], change_id)
|
|
146
|
-
label = {"open": f"in_progress ({where})", "stage": arg or "", "ready": "ready_to_merge"
|
|
269
|
+
label = {"open": f"in_progress ({where})", "stage": arg or "", "ready": "ready_to_merge",
|
|
270
|
+
"done": "done", "done_code": "done_code"}[mode]
|
|
271
|
+
if mode in ("done", "done_code") and new_text is not None:
|
|
272
|
+
new_lines = new_text.splitlines(keepends=True)
|
|
273
|
+
label = row_status(new_lines[find_row(new_lines, change_id)]).strip().split(" ")[0]
|
|
147
274
|
return f"docs(roadmap): {rid} {label}\n\n{COAUTHOR}"
|
|
148
275
|
|
|
149
276
|
|
|
277
|
+
def load_handoff(repo: str, rev: str, mode: str, change_id: str) -> dict | None:
|
|
278
|
+
if mode not in ("done", "done_code"):
|
|
279
|
+
return None
|
|
280
|
+
handoff = read_handoff(repo, rev, change_id)
|
|
281
|
+
if not handoff["found"]:
|
|
282
|
+
print(f"note: {handoff['archive']}change.md has no `## Roadmap handoff` — status `done` unless forced, "
|
|
283
|
+
f"no owner-check or release lines", file=sys.stderr)
|
|
284
|
+
return handoff
|
|
285
|
+
|
|
286
|
+
|
|
150
287
|
def push_roadmap_commit(repo: str, sha: str, main: str, env: dict[str, str]) -> subprocess.CompletedProcess:
|
|
151
288
|
"""Push `sha` to `origin/<main>` from a throwaway worktree, never from the session checkout.
|
|
152
289
|
|
|
@@ -184,11 +321,15 @@ def run_cloud(mode: str, change_id: str, arg: str | None, branch: str | None, dr
|
|
|
184
321
|
git(repo, "fetch", "-q", "origin", main)
|
|
185
322
|
base = git(repo, "rev-parse", f"origin/{main}").strip()
|
|
186
323
|
old = git(repo, "show", f"{base}:{ROADMAP}")
|
|
187
|
-
|
|
324
|
+
handoff = load_handoff(repo, base, mode, change_id)
|
|
325
|
+
new = edit(old, mode, change_id, arg, repo_name, cloud_branch=branch if mode == "open" else None,
|
|
326
|
+
handoff=handoff)
|
|
188
327
|
if dry:
|
|
189
328
|
sys.stdout.writelines(difflib.unified_diff(old.splitlines(True), new.splitlines(True), f"origin/{main}", "commit"))
|
|
190
329
|
return
|
|
191
|
-
|
|
330
|
+
if unchanged(old, new, f"origin/{main}"):
|
|
331
|
+
return
|
|
332
|
+
msg = commit_message(old, mode, change_id, arg, f"cloud session, branch {branch}", new)
|
|
192
333
|
session = os.environ.get("CLAUDE_CODE_REMOTE_SESSION_ID", "")
|
|
193
334
|
if session.startswith("cse_"):
|
|
194
335
|
msg += f"\nClaude-Session: https://claude.ai/code/session_{session[4:]}"
|
|
@@ -226,13 +367,17 @@ def run_cloud_branch(mode: str, change_id: str, arg: str | None, branch: str | N
|
|
|
226
367
|
work_path = os.path.join(repo, ROADMAP)
|
|
227
368
|
with open(work_path, encoding="utf-8") as fh:
|
|
228
369
|
old = fh.read()
|
|
229
|
-
|
|
370
|
+
handoff = load_handoff(repo, "HEAD", mode, change_id)
|
|
371
|
+
new = edit(old, mode, change_id, arg, repo_name, cloud_branch=branch if mode == "open" else None,
|
|
372
|
+
handoff=handoff)
|
|
230
373
|
if dry:
|
|
231
374
|
sys.stdout.writelines(difflib.unified_diff(old.splitlines(True), new.splitlines(True), current, "commit"))
|
|
232
375
|
return
|
|
376
|
+
if unchanged(old, new, current):
|
|
377
|
+
return
|
|
233
378
|
with open(work_path, "w", encoding="utf-8") as fh:
|
|
234
379
|
fh.write(new)
|
|
235
|
-
msg = commit_message(old, mode, change_id, arg, f"cloud session, branch {branch}")
|
|
380
|
+
msg = commit_message(old, mode, change_id, arg, f"cloud session, branch {branch}", new)
|
|
236
381
|
session = os.environ.get("CLAUDE_CODE_REMOTE_SESSION_ID", "")
|
|
237
382
|
if session.startswith("cse_"):
|
|
238
383
|
msg += f"\nClaude-Session: https://claude.ai/code/session_{session[4:]}"
|
|
@@ -252,7 +397,7 @@ def run_local(mode: str, change_id: str, arg: str | None, dry: bool) -> None:
|
|
|
252
397
|
work_path = os.path.join(main_wt, ROADMAP)
|
|
253
398
|
if dry:
|
|
254
399
|
head_text = git(main_wt, "show", f"HEAD:{ROADMAP}")
|
|
255
|
-
new_head = edit(head_text, mode, change_id, arg, repo_name)
|
|
400
|
+
new_head = edit(head_text, mode, change_id, arg, repo_name, handoff=load_handoff(main_wt, "HEAD", mode, change_id))
|
|
256
401
|
sys.stdout.writelines(difflib.unified_diff(head_text.splitlines(True), new_head.splitlines(True), "HEAD", "commit"))
|
|
257
402
|
return
|
|
258
403
|
|
|
@@ -270,11 +415,15 @@ def run_local(mode: str, change_id: str, arg: str | None, dry: bool) -> None:
|
|
|
270
415
|
|
|
271
416
|
head_sha = git(main_wt, "rev-parse", "HEAD").strip()
|
|
272
417
|
head_text = git(main_wt, "show", f"{head_sha}:{ROADMAP}")
|
|
273
|
-
|
|
274
|
-
|
|
418
|
+
handoff = load_handoff(main_wt, head_sha, mode, change_id)
|
|
419
|
+
new_head = edit(head_text, mode, change_id, arg, repo_name, handoff=handoff)
|
|
420
|
+
if unchanged(head_text, new_head, main):
|
|
421
|
+
return
|
|
422
|
+
msg = commit_message(head_text, mode, change_id, arg, "separate worktree", new_head)
|
|
275
423
|
with open(work_path, encoding="utf-8") as fh:
|
|
276
424
|
work_text = fh.read()
|
|
277
|
-
new_work = new_head if work_text == head_text else edit(work_text, mode, change_id, arg, repo_name
|
|
425
|
+
new_work = new_head if work_text == head_text else edit(work_text, mode, change_id, arg, repo_name,
|
|
426
|
+
handoff=handoff)
|
|
278
427
|
|
|
279
428
|
with tempfile.NamedTemporaryFile("w", delete=False, encoding="utf-8") as tmp:
|
|
280
429
|
tmp.write(new_head)
|
|
@@ -306,7 +455,11 @@ def main() -> None:
|
|
|
306
455
|
dry = "--dry-run" in argv
|
|
307
456
|
cloud = "--cloud" in argv or os.environ.get("CLAUDE_CODE_REMOTE") == "true"
|
|
308
457
|
args = [a for a in argv if a not in ("--dry-run", "--cloud")]
|
|
309
|
-
note = branch = None
|
|
458
|
+
note = branch = waiting = None
|
|
459
|
+
if "--waiting" in args:
|
|
460
|
+
k = args.index("--waiting")
|
|
461
|
+
waiting = args[k + 1]
|
|
462
|
+
del args[k:k + 2]
|
|
310
463
|
if "--note" in args:
|
|
311
464
|
k = args.index("--note")
|
|
312
465
|
note = args[k + 1]
|
|
@@ -316,14 +469,15 @@ def main() -> None:
|
|
|
316
469
|
branch = args[k + 1]
|
|
317
470
|
del args[k:k + 2]
|
|
318
471
|
valid = (
|
|
319
|
-
len(args) >= 2 and args[0] in ("open", "stage", "ready")
|
|
472
|
+
len(args) >= 2 and args[0] in ("open", "stage", "ready", "done", "done_code")
|
|
320
473
|
and (args[0] != "stage" or len(args) == 3)
|
|
321
474
|
and (args[0] == "stage" or len(args) == 2)
|
|
475
|
+
and (args[0] != "done_code" or bool(waiting))
|
|
322
476
|
)
|
|
323
477
|
if not valid:
|
|
324
478
|
sys.exit(__doc__)
|
|
325
479
|
mode, change_id = args[0], args[1]
|
|
326
|
-
arg = note
|
|
480
|
+
arg = {"open": note, "stage": args[2] if mode == "stage" else None, "done_code": waiting}.get(mode)
|
|
327
481
|
if cloud and (load_config().get("worktree") or {}).get("cloudState") == "branch":
|
|
328
482
|
run_cloud_branch(mode, change_id, arg, branch, dry)
|
|
329
483
|
elif cloud:
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
Always reads the config of the MAIN worktree (first entry of `git worktree list`), so every
|
|
10
10
|
worktree and every script sees the same values. `mainBranch` falls back to origin's HEAD, then
|
|
11
11
|
"main"; `worktree.maxParallel` to 4; `language` to "en"; `mode` to "manual";
|
|
12
|
-
`autonomy.reports.every` to 60.
|
|
12
|
+
`autonomy.reports.every` to 60; `autonomy.remergeMain` to "when-needed" ("on-conflict" and "always"
|
|
13
|
+
are the other values).
|
|
13
14
|
|
|
14
15
|
Importable: `from wt_config import load_config, main_root, main_branch`.
|
|
15
16
|
"""
|
|
@@ -26,7 +27,7 @@ DEFAULTS = {
|
|
|
26
27
|
"language": "en",
|
|
27
28
|
"worktree": {"maxParallel": 4, "setup": []},
|
|
28
29
|
"release": {"owner": True},
|
|
29
|
-
"autonomy": {"reports": {"every": 60, "hours": None}},
|
|
30
|
+
"autonomy": {"reports": {"every": 60, "hours": None}, "remergeMain": "when-needed"},
|
|
30
31
|
}
|
|
31
32
|
|
|
32
33
|
|
|
@@ -120,6 +120,15 @@ project's main-chat session: no shell over the workers, no `claude agents`, no
|
|
|
120
120
|
| READY, go | `SendMessage` | cross-session messages, both ways |
|
|
121
121
|
| M5 cleanup | `claude stop` + worktree removal | the thread resolves itself after its pull request is merged; on its merge result check it and resolve it if still open |
|
|
122
122
|
|
|
123
|
+
The coordinator reaches these rules only through the pointer in the project
|
|
124
|
+
instructions (WORKFLOW §8.5, Bootstrap). When a thread reports that the pointer
|
|
125
|
+
is missing, or the coordinator notices it has not loaded the managed block, it
|
|
126
|
+
reads `AGENTS.md` and `context/workflow.json` from the main branch at once and
|
|
127
|
+
follows them for the rest of the run, without waiting for the paste: it gives
|
|
128
|
+
the go and runs the merge queue itself from then on. It posts the snippet to
|
|
129
|
+
the owner with where to paste it, records the missing pointer in memory, and
|
|
130
|
+
repeats it as an owner step in every report until the owner confirms it.
|
|
131
|
+
|
|
123
132
|
A fresh main-chat session starts the run by itself (`AGENTS.md` → Start of a
|
|
124
133
|
run); it does not wait for this skill to be invoked. It loads the project's
|
|
125
134
|
memory and coordinator conventions first, and records the run state there
|
|
@@ -206,7 +215,7 @@ exactly like one it launched. Act on each line:
|
|
|
206
215
|
| `ADOPT` | worker process alive and working | nothing to wake — add it to the Monitor. When `coord` is not this session, also `SendMessage <change-id>`: "the coordinator is now <this session> — I do the merge; send questions here; keep working, no reply needed" |
|
|
207
216
|
| `NUDGE` | worker alive but its last message is a usage limit, a machine sleep or an API/network error | usage limit with a reset time still ahead → wait for it (one-shot `CronCreate` at that time); otherwise `SendMessage` "you were interrupted by <cause> — continue from <last commit/step>". If the send fails ("not reachable"), treat as `RELAUNCH` |
|
|
208
217
|
| `RELAUNCH` | no live worker process; worktree and branch still there | `claude stop <session>` (clears the dead entry — `wm-launch.sh` refuses a name whose state is not `done`), then `wm-launch.sh <ID> <change-id> <this session>`; the worker resumes from its branch (`/softure-worktree` A0, resume ladder). Check `git -C <WT> status` first — uncommitted files stay, the worker picks them up |
|
|
209
|
-
| `FIX-ROW` | `<main>` already has the merge commit, the row was never flipped |
|
|
218
|
+
| `FIX-ROW` | `<main>` already has the merge commit, the row was never flipped | `python3 <S>/wt-roadmap.py done <change-id>` (row, block, `## Done`, owner checks and release steps from the archived `change.md`; documents only); remove a leftover worktree/branch if the merge is on `<main>` (`git branch -d` refuses otherwise — good) |
|
|
210
219
|
| `REPORT` | row in flight, no branch and no worktree | tell the owner; don't guess — the change may live on another machine or in a cloud session |
|
|
211
220
|
|
|
212
221
|
`coord` is the coordinator named in the worker's launch prompt (`wm-launch.sh`
|
|
@@ -470,13 +479,15 @@ points of this skill:
|
|
|
470
479
|
then behind — B2 back-merges it inside its worktree (`git -C <WT> merge
|
|
471
480
|
<main>`) with the A5 conflict table, commits with the hook only, and comes
|
|
472
481
|
back. That is this session's job now, not the worker's.
|
|
473
|
-
- **Conflicts and collisions — resolve, don't stop:** roadmap
|
|
474
|
-
|
|
482
|
+
- **Conflicts and collisions — resolve, don't stop:** `roadmap.md` →
|
|
483
|
+
`<main>` (branches never edit it; only with `cloudState: "branch"`: the
|
|
484
|
+
merged change's row → branch, other rows → `<main>`); `lessons.md` → renumber to the next free
|
|
475
485
|
(`wt-status.sh`) and fix references; migration number clash → `<main>`
|
|
476
486
|
keeps its number, regenerate yours (`migrations.regenerate`) and restore
|
|
477
487
|
hand edits (A5); code → on the merits, then run the tests of the touched
|
|
478
488
|
files.
|
|
479
|
-
**
|
|
489
|
+
**With `cloudState: "branch"`, resolve the roadmap row by row, never hunk by
|
|
490
|
+
hunk.** One conflict hunk
|
|
480
491
|
often spans several adjacent table rows: yours plus a neighbour whose stage
|
|
481
492
|
moved on `<main>` meanwhile. Taking the whole hunk from the branch puts that
|
|
482
493
|
neighbour back to a stale stage. Inside each hunk, pair the lines by row ID:
|
|
@@ -510,7 +521,8 @@ points of this skill:
|
|
|
510
521
|
|
|
511
522
|
One signal, one place: if a check gates the deploy, it goes to the release
|
|
512
523
|
section and the decisions section only points at it. Don't duplicate what
|
|
513
|
-
the worker already wrote there
|
|
524
|
+
the worker already wrote there, nor what `wt-roadmap.py done` took from the
|
|
525
|
+
archived change's `## Roadmap handoff`. **Nothing to report → write nothing** — an
|
|
514
526
|
empty entry is noise in the lists the owner reads before a deploy. Commit
|
|
515
527
|
together with the merge's roadmap fix-up (documents only, own paths).
|
|
516
528
|
|
|
@@ -522,9 +534,10 @@ points of this skill:
|
|
|
522
534
|
`<main>`** are a signal of their own: unless a roadmap row already carries
|
|
523
535
|
them, queue them as a new row and a worker ("does not fix"), with the test
|
|
524
536
|
names and the run URL in its `change.md`.
|
|
525
|
-
- **Roadmap:** after the merge the row must read `done` / `done_code` (
|
|
526
|
-
|
|
527
|
-
|
|
537
|
+
- **Roadmap:** after the merge the row must read `done` / `done_code` (Phase B
|
|
538
|
+
ran `wt-roadmap.py done`; with `cloudState: "branch"` the branch wrote it at
|
|
539
|
+
archive). Check it on `<main>`; if it still says `ready_to_merge`, run
|
|
540
|
+
`python3 <S>/wt-roadmap.py done <change-id>` yourself.
|
|
528
541
|
- **Report** per merge, three lines: merge SHA, conflicts and how resolved,
|
|
529
542
|
what waits for the release.
|
|
530
543
|
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
# ADOPT worker process alive and working → take over its merge
|
|
15
15
|
# NUDGE worker process alive but blocked (usage limit, sleep, network) → SendMessage "continue"
|
|
16
16
|
# RELAUNCH no live worker process, worktree/branch still there → claude stop <id>; wm-launch.sh
|
|
17
|
-
# FIX-ROW the main branch already has the merge commit, row not updated →
|
|
17
|
+
# FIX-ROW the main branch already has the merge commit, row not updated → wt-roadmap.py done
|
|
18
18
|
# REPORT in flight on the roadmap but no branch and no worktree → tell the owner
|
|
19
19
|
#
|
|
20
20
|
# Why: the owner clears the coordinator session and runs the skill again; workers keep running
|
|
@@ -114,10 +114,11 @@ for rid, cid, stage in rows:
|
|
|
114
114
|
coord_alive = "?" if coord == "?" else ("yes" if coord in live_names else "no")
|
|
115
115
|
|
|
116
116
|
stuck = re.search(r"session limit|went to sleep|API Error|Can't reach|rate limit", last, re.I)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
elif merged:
|
|
117
|
+
# Merged first: the row stays `ready_to_merge` until `wt-roadmap.py done` runs after the merge.
|
|
118
|
+
if merged:
|
|
120
119
|
action = "FIX-ROW"
|
|
120
|
+
elif stage == "ready_to_merge":
|
|
121
|
+
action = "MERGE"
|
|
121
122
|
elif not has_branch and wt == "no":
|
|
122
123
|
action = "REPORT"
|
|
123
124
|
elif a and a.get("pid") and (a.get("state") in ("working",) or a.get("status") == "busy") and not stuck:
|