@pmelab/gtd 7.11.2 → 8.1.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/docs/upgrading.md DELETED
@@ -1,293 +0,0 @@
1
- # Upgrading to v3 (BREAKING CHANGE)
2
-
3
- ## v3 is a clean break
4
-
5
- v3 ("the pattern machine") deletes the entire v2 definition model — gates, guard
6
- functions, actor kinds, interrupt/fallback ladders, capture rules, turn and
7
- routing rules, `Gtd-Counters` trailers, conflicts, the review checkout window —
8
- and replaces it with the much smaller pattern machine described in
9
- [STATES.md](../STATES.md): named states, each with one content kind and an
10
- ordered map of change-patterns to next states.
11
-
12
- **All pre-v3 history is unrecognized and resolves to the initial state, by
13
- design — v1 and v2 subjects alike.** v3's `resolveState`
14
- (`src/PatternMachine.ts`) only recognizes its own `gtd(<actor>): <from> → <to>`
15
- subject (or the bare `gtd(<actor>): <to>`) naming a state and an actor the
16
- active workflow currently declares; everything else — a v1 `gtd: grilling`, a v2
17
- `gtd(agent): building`, a plain `chore: …` commit, anything from a foreign repo
18
- — parses as unrecognized and lands at the workflow's initial state (`idle` in
19
- the unified template). There is no special-casing for "this looks like an old
20
- gtd commit": the mechanism is exactly the same one that already made v1 history
21
- inert to v2, and v2 history inert to a differently-configured workflow — v3 just
22
- applies it uniformly to all prior history instead of drawing a v1/v2 line.
23
-
24
- **Finish or squash any in-flight cycle first.** A repo mid-cycle on v1 or v2 has
25
- no v3-shaped commit backing its steering files; upgrading mid-cycle lands cold
26
- at the initial state with those files still pending, which the new workflow's
27
- `on` patterns will classify as ordinary pending changes, not as the phase they
28
- used to represent. Finish the cycle (or squash it) on the old binary first, or
29
- manually clean up the steering files and commit a plain boundary, before
30
- upgrading.
31
-
32
- ## What died
33
-
34
- - **Counters.** `Gtd-Counters` trailers, `fixAttemptCap`/`reviewThreshold`
35
- config keys, and the counter-stamp machinery are gone. The only budget
36
- affordance left is a state's own `retry: { max, otherwise }`
37
- (§[STATES.md](../STATES.md#7-retry)) — a plain per-process entry cap
38
- redirected at write time, with no trailer to read back.
39
- - **`.gtdrc` keys.** The old `testCommand`, `fixAttemptCap`, `reviewThreshold`,
40
- `agenticReview`, `squash`, `learning`, `decisionLog`, and `models` keys are
41
- all gone — `workflow:` and `vars:` are the only two blessed keys (see
42
- [Configuration](configuration.md)). A check's command now lives inline in its
43
- own `script:` content, reading a workflow-declared `it.vars` entry (the
44
- unified template's `testCommand`, overridable via the top-level `vars:` key or
45
- a `GTD_TESTCOMMAND` environment variable — see
46
- [Configuration's "Variables"](configuration.md#variables)) rather than a
47
- blessed `testCommand` config key; squashing is a `commit:` state instead of a
48
- boolean flag; there is no learning phase, no decision log, and no model
49
- tiering — a workflow author is free to build any of that shape back with
50
- states of their own, but gtd no longer bakes it in.
51
- - **The review checkout window.** v2 rewound HEAD/index to the review base while
52
- a human review rested, so editors would show the diff directly. Dropped in the
53
- v3.0 rewrite, then RE-INTRODUCED as the explicit state property it was always
54
- meant to become: a state declaring `reviewWindow: true` opens the window while
55
- the machine rests there (base = the process start, or a state marked
56
- `reviewBase: true`). The unified template enables it on `await-review`. Unlike
57
- v2's hardwired gate, it is pure workflow DATA and the engine stays oblivious —
58
- see [STATES.md §11](../STATES.md) and the `file:`/`mode:` neighbours in
59
- [configuration.md](configuration.md).
60
- - **`forceApprove`, content-inspection verdicts.** FEEDBACK.md emptiness,
61
- checkbox-only REVIEW.md diffs, and doc-structure validation are gone as ENGINE
62
- mechanisms — verdicts are now expressed purely by which file a turn writes or
63
- deletes, matched by an ordinary `on` pattern. The unified template's own
64
- checkbox-review verdict (`review-deciding`) is ordinary WORKFLOW data (an `on`
65
- pattern), not an engine hook: `D REVIEW.md` = approve, `M REVIEW.md` = route
66
- to the deterministic decider, in the unified template. Deterministic
67
- format-checking of the steering files is likewise no longer a pair of
68
- in-machine `check`/`script` states — the old `todo-validating`/
69
- `review-validating` states and their `.gtd/FORMAT.md` steering file are gone,
70
- replaced by the `gtd validate` command plus producing-agent self-validation
71
- (see
72
- [docs/design/steering-file-validation-command.md](design/steering-file-validation-command.md)
73
- and [STATES.md §12](../STATES.md)).
74
- - **`gtd review <target>`.** Gone in the initial v3 rewrite, then RETURNED in
75
- this version with different, narrower semantics: it no longer inspects an
76
- arbitrary target the way v2 did — it starts a brand NEW review process at a
77
- workflow-declared `reviewEntry: true` state, reviewing `<target>..HEAD` (e.g.
78
- a colleague's PR branch with no gtd process of its own) by writing one empty
79
- entry commit with a `Gtd-Review-Base:` trailer and reusing the workflow's
80
- existing review/feedback machinery unmodified — see
81
- [STATES.md §11](../STATES.md#11-the-review-checkout-window) and
82
- [CLI reference](cli.md#gtd-review-commitish---json). The current command
83
- surface is `init` / `step` / `next` / `status` / `validate` / `review` /
84
- `lsp`.
85
-
86
- - **`gtd mermaid` → `gtd visualize`.** The static Mermaid emitter has been
87
- replaced by `gtd visualize`, which serves an interactive diagram of the active
88
- workflow (main flow, sub-machines, per-state details) on a local web server —
89
- see [CLI reference](cli.md#gtd-visualize---portn---no-open---json). Both are
90
- read-only views of the active workflow; nothing in the machine changes.
91
-
92
- - **`gtd format <file>`, and the bundled prettier with it.** gtd no longer
93
- formats anything on its own: a steering-file mode declares its own `format:`
94
- SHELL COMMAND, so a project brings whatever formatter it already uses. Adding
95
- four lines to `.gtdrc` restores (and improves on) the old auto-formatting for
96
- the unified template:
97
-
98
- ```yaml
99
- modes:
100
- qa:
101
- format: "npx prettier --write <%= it.file %>"
102
- review:
103
- format: "npx prettier --write <%= it.file %>"
104
- ```
105
-
106
- Validation is unaffected — `qa`/`review` remain gtd's own built-in validators.
107
- See
108
- [docs/design/pluggable-steering-modes.md](design/pluggable-steering-modes.md)
109
- and [Configuration](configuration.md#modes--pluggable-steering-file-modes).
110
-
111
- - **Model tiers, the decision log.** No `models` config key, no `Gtd-Decisions`
112
- trailer scan, no grilling/architecting "prior decisions" context assembled
113
- from history.
114
- - **LSP.** Deleted at the v3 rewrite, then resurrected file-format-keyed rather
115
- than state-keyed (`gtd lsp` — see
116
- [Development](development.md#the-lsp-server)). The `gtd.openSteeringFile`
117
- command is BACK (see
118
- [docs/design/state-file-association.md](design/state-file-association.md)) —
119
- config-driven rather than the v2 hardcoded state→file map: any state may
120
- declare a `file:` (an Eta template) and a `mode:` (the file's format — the
121
- built-in `qa`/`review`, or a workflow-declared `modes:` entry, though the LSP
122
- itself only understands the two built-ins), the LSP reads that same config the
123
- CLI does to build its path→mode dispatch, and `gtd.openSteeringFile` resolves
124
- the current state and shows its `file:`. No mapping declared at all (the
125
- bundled template's predecessor shape, or any workflow with no `file:`/`mode:`)
126
- falls back to basename dispatch (`TODO.md`/`REVIEW.md`), same as before this
127
- addition.
128
-
129
- ## How to adopt
130
-
131
- `workflow:` is **optional** — gtd ships the bundled **unified** workflow as its
132
- built-in default, so after upgrading a repo works with **no** config and no init
133
- at all. The default forks on which steering file you create: `.gtd/TODO.md`
134
- starts the **simple flow** (a `planning` ⇄ `plan-review` plan-iteration loop,
135
- direct `building`, a `checking`/`fixing` loop), while `.gtd/REQUIREMENTS.md`
136
- starts the **advanced flow** (two-phase grilling ⇄ grilling-answer /
137
- architecting ⇄ architecting-answer / decompose / picking / per-package build
138
- with an agentic spec-review gate). Both converge on the same `reviewing` →
139
- `await-review` tail, and a full sign-off squashes the whole cycle into one
140
- commit (see [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)).
141
-
142
- `gtd init` is now optional and no longer writes a workflow — it seeds only a
143
- minimal `.gtdrc.json` (a `testCommand` var and a Prettier formatting
144
- suggestion). Run it if you want to tune those; otherwise nothing is required:
145
-
146
- ```bash
147
- gtd init # optional — seeds testCommand + a formatting suggestion
148
- ```
149
-
150
- A repo that customized v2's `workflow:` key (actors, gates, guard vocabulary,
151
- ladders) needs to rewrite it from scratch in the v3 schema — see
152
- [Configuration](configuration.md) for the schema and a complete worked example.
153
- There is no automatic migration: the two vocabularies don't map field-for-field
154
- (guards become patterns, capture rules become `on` targets, counters become
155
- `retry`), so a v2 `workflow:` config is simply invalid v3 config and fails
156
- loudly at load time rather than silently misinterpreting.
157
-
158
- **Re-copy the loop skill.** If you vendor `skills/loop/` into a consuming repo
159
- or agent harness, upgrading the `gtd` binary also means re-copying that skill
160
- from this release.
161
-
162
- ## Unreleased: bundled prompts no longer name `.gtd/`; a new `stateDir` var
163
-
164
- The bundled template's agent prompts used to open with a sentence naming `.gtd/`
165
- as the directory the agent must never touch except its own owned file. That
166
- framing broke down once a project repointed a steering-file var (e.g.
167
- `reviewFile`) outside `.gtd/`: the prompt still pointed the agent at a directory
168
- that no longer held the file it was writing. Every prompt's opener now states a
169
- path-agnostic principle instead — "this workflow steers itself through its own
170
- state files — treat them as its private scratchpad, never as project code or
171
- documentation" — and names only the specific file(s) its `vars:` entry owns.
172
-
173
- The check scripts also gained a new `vars.stateDir` (default `.gtd`) —
174
- independent of the per-file vars — naming only where they keep their own
175
- scratch/bookkeeping (the `.check-output` temp file, `review-deciding`'s
176
- exclusion of gtd's other state files). Each script now also creates its target
177
- file's own parent directory (`mkdir -p "$(dirname "$feedback")"`, etc.), so a
178
- per-file var repointed outside `stateDir` (or to a nested path with no existing
179
- parent) no longer fails to write.
180
-
181
- **Fully backward-compatible: no config change is needed.** Both `stateDir` and
182
- every per-file var keep their existing `.gtd/…` defaults, so an unconfigured
183
- repo renders byte-identical scripts and behavior to before. A repo that already
184
- relocated a steering-file var outside `.gtd/` (working around issue #128 for
185
- `reviewFile`) can keep its override as-is; nothing further to change.
186
-
187
- ## The var-override env prefix is now `GTD_<UPPERCASE-name>`, not `GTD_VAR_<name>`
188
-
189
- The environment-variable layer of `it.vars` (see
190
- [Configuration's "Variables"](configuration.md#variables)) changed its naming
191
- scheme: the exact-case `GTD_VAR_<name>` prefix is gone, replaced by
192
- `GTD_<UPPERCASE-name>` matched case-insensitively against each name already
193
- declared by the workflow's own `vars:` or the top-level `.gtdrc` `vars:` key.
194
- `GTD_VAR_testCommand` becomes `GTD_TESTCOMMAND`; `GTD_VAR_plannerModel` becomes
195
- `GTD_PLANNERMODEL`.
196
-
197
- This is also a narrowing, not just a rename: because an uppercased env key can't
198
- round-trip back to an arbitrary camelCase name, the environment can no longer
199
- introduce a var no config layer declared — a `GTD_*` env var matching no
200
- declared name is now silently ignored, where it previously appeared verbatim
201
- under its post-prefix name.
202
-
203
- ## 7.4: `gtd-loop` is gone — bare `gtd` and `gtd loop` run it directly
204
-
205
- `gtd-loop`, the standalone loop-driver binary installed alongside `gtd`, no
206
- longer exists. Its body now lives in `bin/gtd` itself, which is a bash entry
207
- script that dispatches on its first argument:
208
-
209
- | behavior | before (≤ 7.3) | from 7.4 |
210
- | ------------------------------------------------------ | ---------------------------------------------- | ----------------------------------------------- |
211
- | `gtd-loop` | separate installed binary | removed |
212
- | bare `gtd` (no subcommand) | usage error, prints help, exits 1 | runs the loop driver immediately |
213
- | `gtd loop` | not a recognized subcommand | runs the loop driver immediately |
214
- | any other subcommand (`step`, `status`, `validate`, …) | handled by `node dist/gtd.bundle.mjs` directly | same, now reached via `bin/gtd`'s hand-off/exec |
215
-
216
- **Bare `gtd` is a behavior flip, not merely an addition** — the same kind of
217
- change as the v1 → v2 label grammar below: previously it printed the help text
218
- and exited 1 without touching the repository; from 7.4 it launches the loop
219
- driver immediately, identically to `gtd loop`. A script that relied on bare
220
- `gtd` failing fast (e.g. to detect a missing subcommand) now gets a running loop
221
- instead of an error.
222
-
223
- Because `bin/gtd` is a bash script for every invocation now, **running `gtd` at
224
- all — including any subcommand — requires bash**. Before 7.4, only the loop
225
- driver (`gtd-loop`) needed bash; a subcommand could be invoked directly via the
226
- bundle (e.g. `node node_modules/.bin/gtd`) with no bash in between. This is
227
- intentional and accepted, not an oversight: gtd's loop, its `script`-content
228
- checks, and a steering-file mode's own `format:`/`validate:` commands already
229
- run via `bash -c` (see
230
- [Configuration](configuration.md#modes--pluggable-steering-file-modes)) — gtd
231
- already assumes a unix/bash agent environment everywhere else, so the entry
232
- point catching up removes an inconsistency rather than introducing a new
233
- dependency.
234
-
235
- **Migration:**
236
-
237
- - Anyone invoking `gtd-loop` directly — in scripts, CI, or docs — should invoke
238
- `gtd` or `gtd loop` instead.
239
- - Anyone relying on `node node_modules/.bin/gtd` resolving straight to the
240
- bundle should note `gtd` is now a bash script that execs the bundle for
241
- subcommands, so behavior for actual subcommands (`gtd step`, `gtd status`,
242
- etc.) is unchanged — only the underlying file changed.
243
-
244
- ## 7.2: the review checkout window is now per worktree
245
-
246
- The review checkout window's two refs moved from the SHARED `refs/gtd/*`
247
- namespace to git's PER-WORKTREE `refs/worktree/*` one:
248
-
249
- | before (≤ 7.1) | from 7.2 |
250
- | ---------------------- | ------------------------------- |
251
- | `refs/gtd/review-head` | `refs/worktree/gtd/review-head` |
252
- | `refs/gtd/review-base` | `refs/worktree/gtd/review-base` |
253
-
254
- Nothing in a `.gtdrc` or a workflow definition references those names, so **no
255
- config change is needed**. What changes is behaviour in a repository checked out
256
- as several linked worktrees (`git worktree add`, one `.git` shared between
257
- them): each worktree now has its own window, so a review resting in one no
258
- longer "closes" from another — which, on the shared refs, mixed-reset that other
259
- worktree's branch onto the reviewing worktree's saved head and left every
260
- sibling refusing with "a process is already underway".
261
-
262
- A window an OLDER gtd left open across the upgrade still closes from the legacy
263
- refs, so an in-flight review in a single-worktree repo needs no attention. In a
264
- multi-worktree repo gtd cannot tell which worktree a shared ref belongs to, so
265
- it closes only when HEAD is contained in the saved head and otherwise refuses
266
- with the exact recovery commands — run them in the worktree that owns the
267
- window:
268
-
269
- ```bash
270
- git reset --mixed refs/gtd/review-head
271
- git update-ref -d refs/gtd/review-head
272
- git update-ref -d refs/gtd/review-base
273
- ```
274
-
275
- 7.2 also adds [`gtd abandon`](cli.md#gtd-abandon---json), the supported way out
276
- of a process that will never be finished (it closes the window, then rewinds
277
- HEAD to the process's start parent, keeping everything the process produced as
278
- uncommitted changes) — no hand-editing of refs required.
279
-
280
- ## Prior breaking change: the v1 → v2 label grammar (historical)
281
-
282
- v2 replaced v1's undifferentiated turn labels with six labels carrying the
283
- branch outcome at capture time, moved steering files under `.gtd/`, and
284
- introduced `Gtd-Counters` commit trailers. All of that is itself now superseded
285
- by v3's clean break above — a v1 or v2 repo upgrades to v3 the same way
286
- (finish/squash any in-flight cycle, then upgrade from a settled boundary);
287
- there's no reason to upgrade v1 → v2 → v3 in two hops.
288
-
289
- For maintainers: this repo releases via `semantic-release` reading Conventional
290
- Commits, and needs **no config change** for a major bump — but the release
291
- commit/PR **must carry a `BREAKING CHANGE:` footer** (or a `!` after the type)
292
- for `@semantic-release/commit-analyzer` to compute the next major version rather
293
- than a minor/patch bump.