@pmelab/gtd 5.1.0 → 6.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/cli.md CHANGED
@@ -4,6 +4,10 @@
4
4
  Usage: gtd [command] [options]
5
5
 
6
6
  Commands:
7
+ init <workflow> Scaffold a .gtdrc.json for this repo with the chosen
8
+ bundled workflow inline (one of: simple, advanced). Run
9
+ once per repo; refuses if a gtd config already exists.
10
+ Leaves the file uncommitted for you to review and commit
7
11
  step <actor> Authenticate as <actor>, match the resolved rest's
8
12
  declared patterns against the pending changes, and commit
9
13
  (or squash) the one resulting transition. Pass
@@ -17,8 +21,6 @@ Commands:
17
21
  a clean tree resting at the workflow's initial state
18
22
  next Print the resolved rest's rendered script/prompt/message
19
23
  (no mutation)
20
- run Execute the resolved rest's emitted script, then step its
21
- actor (the built-in script driver)
22
24
  status Print the resolved rest's state/actor and which declared
23
25
  pattern (if any) each pending change matches (no mutation)
24
26
  validate Format and validate the steering file the resolved rest
@@ -27,6 +29,8 @@ Commands:
27
29
  mermaid Print the active workflow's shape as Mermaid
28
30
  stateDiagram-v2 source (no mutation)
29
31
  lsp Start the LSP server for .gtd/ steering files (stdio)
32
+ version Print version and exit
33
+ help Print this help and exit
30
34
 
31
35
  Options:
32
36
  --json Output structured JSON instead of plain text
@@ -36,11 +40,12 @@ Options:
36
40
  --help, -h Print this help and exit
37
41
  ```
38
42
 
39
- `--version` (`-v`) and `--help` (`-h`) short-circuit before any git or
40
- repository-state work — they run outside a repo and in any repo state. Bare
41
- `gtd` (no subcommand) is a usage error: it prints the help text and exits 1
42
- without touching the repository. Every other command must be run from the
43
- **repository root** — gtd derives the workflow, pending changes, and process
43
+ `--version` (`-v`) / `gtd version` and `--help` (`-h`) / `gtd help`
44
+ short-circuit before any git or repository-state work — they run outside a repo
45
+ and in any repo state (the bare subcommands are exact equivalents of their flag
46
+ forms). Bare `gtd` (no subcommand) is a usage error: it prints the help text and
47
+ exits 1 without touching the repository. Every other command must be run from
48
+ the **repository root** — gtd derives the workflow, pending changes, and process
44
49
  history relative to cwd, so it refuses with a clear error if invoked from a
45
50
  subdirectory.
46
51
 
@@ -52,6 +57,28 @@ mistyped flag can never degrade a JSON caller to plain-text mode. A bare
52
57
  `--model`, `--model` without `--cost`, or either flag on any command other than
53
58
  `gtd step` are all usage errors.
54
59
 
60
+ ## `gtd init <workflow>`
61
+
62
+ Scaffolds a `.gtdrc.json` at the repository root with one of the bundled
63
+ workflow templates inline under a `workflow:` key, plus a `$schema` link.
64
+ `<workflow>` is required and must be `simple` or `advanced` (a missing or
65
+ unknown name is a usage error listing both). gtd ships **no** default workflow,
66
+ so this is the one-time setup step for a repo; a state command run before it
67
+ fails with `gtd: no workflow configured — run \`gtd init <simple|advanced>\` …`.
68
+
69
+ - `simple` — the 10-state machine (see
70
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)).
71
+ - `advanced` — the fuller machine (see
72
+ [advanced-workflow.md](examples/advanced-workflow.md)).
73
+
74
+ The file is written **uncommitted**; review and commit it before your first
75
+ `gtd step` (an uncommitted `.gtdrc.json` is a pending change the initial state
76
+ would otherwise capture). `gtd init` refuses if any gtd config already exists,
77
+ requires the repository root, and — with `gtd lsp` — is one of the two commands
78
+ that run with no workflow configured. `--json` prints
79
+ `{"written":".gtdrc.json","workflow":"<name>"}`. See
80
+ [Configuration](configuration.md#gtd-init).
81
+
55
82
  ## `gtd step <actor> [--cost=<n>] [--model=<name>]`
56
83
 
57
84
  Authenticates `<actor>` against the resolved rest and performs the ONE resulting
@@ -295,9 +322,9 @@ Then:
295
322
  approve), has nothing to validate and exits `0`
296
323
  (`nothing to validate at "<state>"`). Nothing is formatted in that case.
297
324
 
298
- This is how the bundled default keeps its steering files well-formed without an
299
- in-machine validation state — and the check runs whoever last touched the file,
300
- agent or human:
325
+ This is how the `simple` template keeps its steering files well-formed without
326
+ an in-machine validation state — and the check runs whoever last touched the
327
+ file, agent or human:
301
328
 
302
329
  - **The producing agent self-validates.** Plain `gtd next` appends a "run
303
330
  `gtd validate` and fix all violations" instruction to a `prompt` rest that
@@ -378,8 +405,9 @@ with no `.gtdrc` in sight. Also registers an `executeCommand`,
378
405
  naming the state instead — bind it to an editor keybinding for a "jump to the
379
406
  active steering file" command.
380
407
 
381
- Dispatched before the repository-root guard and auto-init — the server needs no
382
- git/workflow state of its own. Rejects `--json` (exit 1,
408
+ Dispatched before the repository-root guard and the config-reading path — the
409
+ server needs no git/workflow state of its own (like `gtd init`, it runs with no
410
+ workflow configured). Rejects `--json` (exit 1,
383
411
  `gtd lsp does not accept --json`) and extra positional arguments — it's a
384
412
  long-running server, not a state command. Runs until the client disconnects (the
385
413
  LSP `exit` notification), then exits cleanly.
@@ -413,5 +441,6 @@ the plain-text one.
413
441
  - **Repository root invocation.** Every state subcommand (`step`/`review`/
414
442
  `next`/`status`/`mermaid`) must run from the git repository root — the
415
443
  workflow, pending changes, and process history are resolved against the
416
- process cwd. `--help`/`--version`, `format`, and `lsp` skip this guard
417
- entirely (and any git/`.gtdrc` dependency along with it).
444
+ process cwd. `--help`/`--version` (and the `help`/`version` subcommands),
445
+ `format`, and `lsp` skip this guard entirely (and any git/`.gtdrc` dependency
446
+ along with it).
@@ -1,10 +1,11 @@
1
1
  # Configuration
2
2
 
3
- gtd reads an optional `.gtdrc` config file via
4
- [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig). With no config, the
5
- bundled default workflow applies (see
6
- [STATES.md](../STATES.md#10-the-bundled-default-workflow)). Supported filenames
7
- (searched in this order):
3
+ gtd reads a required `.gtdrc` config file via
4
+ [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig). gtd ships **no**
5
+ default workflow: scaffold one for the repo with [`gtd init`](#gtd-init) (once),
6
+ which writes a `.gtdrc.json` carrying a bundled workflow template inline. A
7
+ state command run with no `workflow:` configured fails, pointing you at
8
+ `gtd init`. Supported filenames (searched in this order):
8
9
 
9
10
  - `.gtdrc`
10
11
  - `.gtdrc.json`
@@ -17,16 +18,17 @@ bundled default workflow applies (see
17
18
 
18
19
  v3's `.gtdrc` has exactly three blessed top-level keys:
19
20
 
20
- - **`workflow`** (object, optional) — the whole machine definition (its states,
21
- plus its own `vars:` defaults and `modes:`), compiled by
22
- `src/PatternConfig.ts`. Absent = the bundled default workflow. See
21
+ - **`workflow`** (object, **required**) — the whole machine definition (its
22
+ states, plus its own `vars:` defaults and `modes:`), compiled by
23
+ `src/PatternConfig.ts`. Absent = a hard error pointing at
24
+ [`gtd init`](#gtd-init); there is no bundled default. See
23
25
  ["The `workflow:` key" below](#the-workflow-key) for its schema.
24
26
  - **`vars`** (object, optional) — a flat `name -> scalar` map, one layer of the
25
27
  merged `it.vars` every template sees — see ["Variables"](#variables) below.
26
28
  - **`modes`** (object, optional) — steering-file modes (`format:`/`validate:`
27
29
  shell commands), layered over the active workflow's own `modes:` and gtd's
28
30
  built-in validators, so a project can plug its formatter or linter into the
29
- BUNDLED default without re-declaring a workflow. See
31
+ configured workflow without re-declaring that mode on the workflow itself. See
30
32
  ["`modes:`"](#modes--pluggable-steering-file-modes) below.
31
33
  - **`$schema`** (string, optional) — stripped before validation, so it never
32
34
  counts as an unknown key. Point it at the published schema for editor-backed
@@ -37,16 +39,18 @@ Any other top-level key is **rejected** (`onExcessProperty: "error"`) — v3 has
37
39
  no `testCommand`, `fixAttemptCap`, `reviewThreshold`, `agenticReview`, `squash`,
38
40
  `learning`, `decisionLog`, or `models` keys; all of that machinery is gone (see
39
41
  [Upgrading](upgrading.md)). The engine blesses no VARIABLE NAMES either —
40
- `testCommand` (the bundled default workflow's own var, see
41
- ["Variables"](#variables)) is workflow-authored data like any other `it.vars`
42
- entry, not a special key gtd interprets.
42
+ `testCommand` (the bundled templates' own var, see ["Variables"](#variables)) is
43
+ workflow-authored data like any other `it.vars` entry, not a special key gtd
44
+ interprets.
43
45
 
44
46
  ## The `workflow:` key
45
47
 
46
48
  The `workflow:` key is the **only** definition source — there is no `extends`,
47
- no merge-over-a-built-in; the bundled default workflow is itself a YAML asset
48
- compiled through the exact same compiler (`src/workflows/default.yaml` →
49
- `compileWorkflowConfig`). Its shape:
49
+ no merge-over-a-built-in. The bundled templates `gtd init` scaffolds are
50
+ themselves YAML assets (`src/workflows/simple.yaml`,
51
+ `src/workflows/advanced.yaml`) compiled through the exact same compiler
52
+ (`compileWorkflowConfig`); `gtd init` just writes one of them, inline, under
53
+ this key. Its shape:
50
54
 
51
55
  ```yaml
52
56
  workflow:
@@ -219,9 +223,9 @@ Because `grilling` re-enters itself around the answer loop, every lap emits
219
223
  `building` emits a different label (`build`), which is where the driver clears
220
224
  memory for a fresh implementation turn. A loop of same-labelled turns retains; a
221
225
  differently-labelled state at a phase boundary clears. This is exactly how the
222
- bundled default scopes its four agent states (`plan`/`build`/`fix`/`review` —
223
- see [STATES.md §10](../STATES.md#10-the-bundled-default-workflow)), and how the
224
- loop driver reads it is spelled out in `skills/loop/SKILL.md`.
226
+ `simple` template scopes its four agent states (`plan`/`build`/`fix`/`review` —
227
+ see [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)), and how
228
+ the loop driver reads it is spelled out in `skills/loop/SKILL.md`.
225
229
 
226
230
  Like `model`, `memory:` is rendered as an Eta template through the same context
227
231
  as the state's content — a plain label (`plan`) passes through unchanged, while
@@ -239,7 +243,8 @@ A state may additionally declare `file:` — an Eta template naming THE steering
239
243
  file this state is about: the file a human/editor should look at while the
240
244
  machine rests here (rendered through the same `it.vars`-carrying context as
241
245
  content/`model`; must render non-empty). Forbidden on a commit state (never at
242
- rest). Multiple states may share one `file:` (and, in the bundled default, do):
246
+ rest). Multiple states may share one `file:` (and, in the `simple` template,
247
+ do):
243
248
 
244
249
  ```yaml
245
250
  workflow:
@@ -357,16 +362,20 @@ So for a state declaring `mode: qa`:
357
362
  | both | its `format:` | its `validate:` |
358
363
 
359
364
  That is what makes the built-in modes extensible rather than all-or-nothing —
360
- and the top-level key means a project on the BUNDLED default workflow can plug
361
- in its formatter without copying a single state:
362
-
363
- ```yaml
364
- # .gtdrc — keep the bundled default workflow, add your own markdown formatter
365
- modes:
366
- qa:
367
- format: "npx prettier --write <%= it.file %>"
368
- review:
369
- format: "npx prettier --write <%= it.file %>"
365
+ and the top-level key means a project can plug its formatter into whichever
366
+ workflow it scaffolded (`gtd init simple`/`advanced`) without re-declaring a
367
+ `modes:` block on the workflow itself. Add it alongside the `workflow:` key in
368
+ your `.gtdrc.json`:
369
+
370
+ ```jsonc
371
+ // .gtdrc.json — the workflow from `gtd init`, plus your own markdown formatter
372
+ {
373
+ "workflow": { "...": "..." },
374
+ "modes": {
375
+ "qa": { "format": "npx prettier --write <%= it.file %>" },
376
+ "review": { "format": "npx prettier --write <%= it.file %>" },
377
+ },
378
+ }
370
379
  ```
371
380
 
372
381
  **Known limitation — no live editor support for a custom mode.** `gtd lsp`
@@ -411,7 +420,7 @@ workflow:
411
420
  "* **": building
412
421
  ```
413
422
 
414
- The bundled default enables `reviewWindow: true` on `await-review` (no
423
+ The `simple` template enables `reviewWindow: true` on `await-review` (no
415
424
  `reviewBase` state, so the base is the whole cycle). The pure engine never
416
425
  observes an open window — it is opened/closed entirely at the edge; the real
417
426
  head is preserved under `refs/gtd/review-head` (the base under
@@ -528,10 +537,10 @@ Every template — `script`/`prompt`/`message`/`commit`, and `model`/`memory`/
528
537
  layers, **later wins**:
529
538
 
530
539
  1. **The workflow's own `vars:` key** (sibling to `states:`, shown above) — the
531
- workflow author's declared defaults. The bundled default workflow declares
540
+ workflow author's declared defaults. The `simple` template declares
532
541
  `vars: { testCommand: "npm test" }`, read by `checking`'s script as
533
542
  `<%~ it.vars.testCommand %>` (see
534
- [STATES.md §10](../STATES.md#10-the-bundled-default-workflow)).
543
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)).
535
544
  2. **A top-level `.gtdrc` `vars:` key** (a sibling of `workflow:`, NOT nested
536
545
  inside it) — per-repo tuning without redefining the whole workflow. Subject
537
546
  to the same cwd→home deep merge as everything else in `.gtdrc` (innermost
@@ -549,7 +558,7 @@ alongside every other config-shape finding (see
549
558
  already strings.
550
559
 
551
560
  ```yaml
552
- # .gtdrc — overriding the bundled default's testCommand
561
+ # .gtdrc — overriding the `simple` template's testCommand
553
562
  vars:
554
563
  testCommand: npm run test:ci
555
564
  ```
@@ -635,19 +644,38 @@ finds along the way. All found levels are **deep-merged**, with the **innermost
635
644
  directory cascades to every checkout beneath it, while any individual checkout
636
645
  can still override with its own `.gtdrc`.
637
646
 
638
- ## Auto-init
647
+ ## `gtd init`
648
+
649
+ gtd ships **no** default workflow, so a repo must scaffold one before any state
650
+ command works:
639
651
 
640
- On every **state command** (`step`, `next`, `run`, `status`) that has passed the
641
- repo-root guard, if the cwd→root walk finds **no** config anywhere, gtd creates
642
- and commits a starter `.gtdrc.json` at the repository root containing only a
643
- `$schema` link. Auto-init never runs for `--version`/`--help`, `format`,
644
- bare/unknown commands, or an invocation refused by the repo-root guard — those
645
- perform no repository mutation of any kind. On a repo with no commits yet, or
646
- whose HEAD isn't a `gtd(actor): state` commit, the stub is committed as its own
647
- `chore: add .gtdrc.json`. If HEAD is already a `gtd(actor): state` commit
648
- (mid-process), the stub is instead **amended into HEAD** — stacking a fresh
649
- boundary commit there would produce an unrecognized HEAD that resolves back to
650
- the workflow's initial state.
652
+ ```bash
653
+ gtd init simple # or: gtd init advanced
654
+ ```
655
+
656
+ `gtd init <workflow>` writes a `.gtdrc.json` at the repository root with the
657
+ chosen bundled template's whole workflow inline under a `workflow:` key, plus a
658
+ `$schema` link (so editors pick up completion/validation). The two templates:
659
+
660
+ - **`simple`** — the 10-state machine walked through in
661
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates): idle →
662
+ grilling ⇄ grilling-answer → building → checking ⇄ fixing (→ escalate) →
663
+ reviewing → await-review, resting back at idle on approval (no squash).
664
+ - **`advanced`** — the fuller machine (two-phase Q&A planning, an architecture
665
+ phase, task decomposition, a per-task build queue, and a squash finale),
666
+ walked through at
667
+ [docs/examples/advanced-workflow.md](examples/advanced-workflow.md).
668
+
669
+ The file is written **uncommitted** — review it, then commit it before your
670
+ first `gtd step` (an uncommitted `.gtdrc.json` is a pending change the initial
671
+ state's `* **` edge would otherwise capture). `gtd init` refuses if any gtd
672
+ config already exists (remove it first to re-init), requires the repository
673
+ root, and is one of the two commands (with `gtd lsp`) that run with no workflow
674
+ configured. A state command run before `gtd init` fails with:
675
+
676
+ ```
677
+ gtd: no workflow configured — run `gtd init <simple|advanced>` to create .gtdrc.json
678
+ ```
651
679
 
652
680
  ## A complete example
653
681
 
@@ -720,8 +748,8 @@ agent-encoded verdict") for the worked example.
720
748
 
721
749
  ## A fuller example: two-phase planning, task decomposition, agent-prepared review
722
750
 
723
- The bundled default above is deliberately small. For a heavier machine — Q&A
724
- planning loops, an architecture phase, task decomposition, the deterministic
725
- per-task `picking` arbiter, and agent-prepared `.gtd/REVIEW.md` review — see
726
- [docs/examples/advanced-workflow.md](examples/advanced-workflow.md), a
727
- copy-paste-ready `.gtdrc` recipe.
751
+ The example above is deliberately small (it is close to the `simple` template).
752
+ For a heavier machine — Q&A planning loops, an architecture phase, task
753
+ decomposition, the deterministic per-task `picking` arbiter, and agent-prepared
754
+ `.gtd/REVIEW.md` review — run `gtd init advanced`, walked through at
755
+ [docs/examples/advanced-workflow.md](examples/advanced-workflow.md).
@@ -31,16 +31,18 @@ registry to keep in sync: a workflow's content strings are either inline in its
31
31
  YAML/`.gtdrc` or a `./`-relative file reference auto-inlined at config load
32
32
  (`src/PatternConfig.ts`) — see
33
33
  [Configuration](configuration.md#content-values-inline-or-a-file-reference). The
34
- bundled default workflow (`src/workflows/default.yaml`) is imported as raw text
35
- via tsdown's `.yaml`-as-text loader (`tsdown.config.ts`) and compiled through
36
- the same path a `.gtdrc` `workflow:` key goes through
37
- (`src/workflows/default.ts`) — no privileged code path.
34
+ bundled workflow templates (`src/workflows/simple.yaml`,
35
+ `src/workflows/advanced.yaml`) `gtd init` scaffolds are imported as raw text via
36
+ tsdown's `.yaml`-as-text loader (`tsdown.config.ts`) and compiled through the
37
+ same path a `.gtdrc` `workflow:` key goes through (`src/workflows/templates.ts`)
38
+ — no privileged code path.
38
39
 
39
40
  `npm run dev` runs `src/main.ts` directly via Node's native TypeScript
40
41
  type-stripping (requires Node 22.6+). It registers `dev/hooks.mjs`, which
41
42
  resolves `./Foo.js` specifiers to the on-disk `./Foo.ts` and imports `*.yaml`
42
43
  files as raw text, mirroring tsdown's `.yaml`-as-text loader — this is what lets
43
- `src/workflows/default.yaml` resolve when running from source.
44
+ `src/workflows/simple.yaml` and `src/workflows/advanced.yaml` resolve when
45
+ running from source.
44
46
 
45
47
  The decision core is pure and IO-free: the pattern machine's shape (states,
46
48
  patterns, retry) is a plain-data `WorkflowDefinition` (`src/PatternMachine.ts`),
@@ -1,15 +1,17 @@
1
- # Example: the full grilling → architecting → decompose → picking → review machine
1
+ # The `advanced` template: the full grilling → architecting → decompose → picking → review machine
2
2
 
3
- This is the fuller machine gtd shipped as its bundled default before the bundled
4
- default was drastically simplified (see
5
- [STATES.md §10](../../STATES.md#10-the-bundled-default-workflow) for what ships
6
- today — including the two steering-file validation loops the current default
7
- carries over `.gtd/TODO.md` and `.gtd/REVIEW.md`, which this example's own
8
- `grilling`/`reviewing` phases predate and don't validate). It is preserved here
9
- as a copy-paste-ready `.gtdrc` recipe for anyone who wants the heavier shape
10
- back.
3
+ This walks through the **`advanced`** bundled workflow template — the fuller
4
+ machine `gtd init advanced` scaffolds (`src/workflows/advanced.yaml`). The other
5
+ bundled template, **`simple`** (`gtd init simple`), is the smaller 10-state
6
+ machine walked through in
7
+ [STATES.md §10](../../STATES.md#10-the-bundled-workflow-templates) — including
8
+ the two steering-file validation loops it carries over `.gtd/TODO.md` and
9
+ `.gtd/REVIEW.md`, which this machine's own `grilling`/`reviewing` phases predate
10
+ and don't validate. `gtd init advanced` writes the block below directly, so you
11
+ normally don't paste it by hand; it's reproduced here as the annotated
12
+ reference.
11
13
 
12
- Compared to the simplified bundled default, this machine adds:
14
+ Compared to the `simple` template, this machine adds:
13
15
 
14
16
  - **Two-phase human-in-the-loop planning with Q&A loops** — `grilling` ⇄
15
17
  `grilling-answer` develops a product-level plan from `.gtd/TODO.md` one open
@@ -29,9 +31,9 @@ Compared to the simplified bundled default, this machine adds:
29
31
  [STATES.md §11](../../STATES.md#11-the-review-checkout-window).
30
32
  - **A squash finale** — approval at `await-review` moves to `squashing` (the
31
33
  agent authors `.gtd/COMMIT_MSG.md`) and then `done`, a `commit:` state that
32
- squashes the whole cycle into one commit. The simplified bundled default drops
33
- this: it rests at `idle` on approval instead and leaves every turn commit in
34
- history for the human to squash (or not) however they choose.
34
+ squashes the whole cycle into one commit. The `simple` template drops this: it
35
+ rests at `idle` on approval instead and leaves every turn commit in history
36
+ for the human to squash (or not) however they choose.
35
37
 
36
38
  This example also carries `file:`/`mode:` annotations on every state that rests
37
39
  on a steering file (see the state table below and
@@ -44,11 +46,12 @@ actions/diagnostics off those declarations rather than a hardcoded basename:
44
46
  `review`-format (`vars.reviewFile`), and `fixing`/`escalate` declare `file:`
45
47
  alone (`vars.feedbackFile` is plain text, no LSP format).
46
48
 
47
- Paste the block below under a top-level `workflow:` key in your own `.gtdrc` (or
48
- `.gtdrc.yaml`) — it's the complete definition, unmodified in content from the
49
- version this example is frozen from, only re-indented to nest under `workflow:`.
50
- See [Configuration](../configuration.md) for the `.gtdrc` schema this slots
51
- into.
49
+ Running `gtd init advanced` writes this whole definition into `.gtdrc.json`
50
+ under a `workflow:` key for you. The block below is the same definition in YAML
51
+ form (the source is `src/workflows/advanced.yaml`), nested under `workflow:` —
52
+ paste it into your own `.gtdrc`/`.gtdrc.yaml` if you'd rather hand-author or
53
+ tweak it. See [Configuration](../configuration.md) for the `.gtdrc` schema this
54
+ slots into.
52
55
 
53
56
  ## State table
54
57
 
@@ -225,7 +228,7 @@ workflow:
225
228
  actor: check
226
229
  script: |
227
230
  #!/usr/bin/env bash
228
- # gtd check turn (the queue arbiter) — the driver (`gtd run`) executes
231
+ # gtd check turn (the queue arbiter) — the loop driver executes
229
232
  # this verbatim, then steps the check actor. Mechanics only: take the
230
233
  # first task file (by name) under .gtd/tasks/ into .gtd/NEXT.md, or
231
234
  # remove .gtd/NEXT.md when the queue is empty. What NEXT.md's
@@ -268,7 +271,7 @@ workflow:
268
271
  actor: check
269
272
  script: |
270
273
  #!/usr/bin/env bash
271
- # gtd check turn — the driver (`gtd run`) executes this verbatim, then
274
+ # gtd check turn — the loop driver executes this verbatim, then
272
275
  # steps the check actor. Mechanics only: run the test suite and record a
273
276
  # red run's output as .gtd/FEEDBACK.md. What that output MEANS (another
274
277
  # fix round vs escalation) is decided by the workflow's own `on`/`retry`
@@ -436,8 +439,8 @@ event) accepts the current phase's draft and moves on; any other pending change
436
439
  loops back for another round. `picking` is a `script` state whose only job is to
437
440
  inspect `.gtd/tasks/` (a tree property patterns can't see directly) and turn it
438
441
  into a diff patterns CAN see — see the walkthrough in
439
- [STATES.md §10](../../STATES.md#10-the-bundled-default-workflow) (the version of
440
- that section frozen alongside this example) for the full state-by-state
442
+ [STATES.md §10](../../STATES.md#10-the-bundled-workflow-templates) (the version
443
+ of that section frozen alongside this example) for the full state-by-state
441
444
  narrative, including the `on`-declaration-order subtlety at `picking` and the
442
445
  `fixing` retry-cap pooling caveat.
443
446
 
package/docs/upgrading.md CHANGED
@@ -15,8 +15,8 @@ design — v1 and v2 subjects alike.** v3's `resolveState`
15
15
  subject naming a state and an actor the active workflow currently declares;
16
16
  everything else — a v1 `gtd: grilling`, a v2 `gtd(agent): building`, a plain
17
17
  `chore: …` commit, anything from a foreign repo — parses as unrecognized and
18
- lands at the workflow's initial state (`idle` in the bundled default). There is
19
- no special-casing for "this looks like an old gtd commit": the mechanism is
18
+ lands at the workflow's initial state (`idle` in the `simple` template). There
19
+ is no special-casing for "this looks like an old gtd commit": the mechanism is
20
20
  exactly the same one that already made v1 history inert to v2, and v2 history
21
21
  inert to a differently-configured workflow — v3 just applies it uniformly to all
22
22
  prior history instead of drawing a v1/v2 line.
@@ -41,8 +41,8 @@ upgrading.
41
41
  all gone — `workflow:` and `vars:` are the only two blessed keys (see
42
42
  [Configuration](configuration.md)). A check's command now lives inline in its
43
43
  own `script:` content, reading a workflow-declared `it.vars` entry (the
44
- bundled default's `testCommand`, overridable via the top-level `vars:` key or
45
- a `GTD_VAR_testCommand` environment variable — see
44
+ `simple` template's `testCommand`, overridable via the top-level `vars:` key
45
+ or a `GTD_VAR_testCommand` environment variable — see
46
46
  [Configuration's "Variables"](configuration.md#variables)) rather than a
47
47
  blessed `testCommand` config key; squashing is a `commit:` state instead of a
48
48
  boolean flag; there is no learning phase, no decision log, and no model
@@ -53,17 +53,17 @@ upgrading.
53
53
  v3.0 rewrite, then RE-INTRODUCED as the explicit state property it was always
54
54
  meant to become: a state declaring `reviewWindow: true` opens the window while
55
55
  the machine rests there (base = the process start, or a state marked
56
- `reviewBase: true`). The bundled default 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).
56
+ `reviewBase: true`). The `simple` template enables it on `await-review`.
57
+ Unlike v2's hardwired gate, it is pure workflow DATA and the engine stays
58
+ oblivious — see [STATES.md §11](../STATES.md) and the `file:`/`mode:`
59
+ neighbours in [configuration.md](configuration.md).
60
60
  - **`forceApprove`, content-inspection verdicts.** FEEDBACK.md emptiness,
61
61
  checkbox-only REVIEW.md diffs, and doc-structure validation are gone as ENGINE
62
62
  mechanisms — verdicts are now expressed purely by which file a turn writes or
63
- deletes, matched by an ordinary `on` pattern. The bundled default workflow's
64
- own checkbox-review verdict (`review-deciding`) is ordinary WORKFLOW data (an
65
- `on` pattern), not an engine hook: `D REVIEW.md` = approve, `M REVIEW.md` =
66
- route to the deterministic decider, in the bundled default. Deterministic
63
+ deletes, matched by an ordinary `on` pattern. The `simple` 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 `simple` template. Deterministic
67
67
  format-checking of the steering files is likewise no longer a pair of
68
68
  in-machine `check`/`script` states — the old `todo-validating`/
69
69
  `review-validating` states and their `.gtd/FORMAT.md` steering file are gone,
@@ -71,21 +71,23 @@ upgrading.
71
71
  (see
72
72
  [docs/design/steering-file-validation-command.md](design/steering-file-validation-command.md)
73
73
  and [STATES.md §12](../STATES.md)).
74
- - **`gtd review <target>`.** Gone in the initial v3 rewrite (the command surface
75
- was `step` / `next` / `run` / `status` / `validate` / `mermaid` / `lsp`), then
76
- RETURNED in this version with different, narrower semantics: it no longer
77
- inspects an arbitrary target the way v2 did — it starts a brand NEW review
78
- process at a workflow-declared `reviewEntry: true` state, reviewing
79
- `<target>..HEAD` (e.g. a colleague's PR branch with no gtd process of its own)
80
- by writing one empty entry commit with a `Gtd-Review-Base:` trailer and
81
- reusing the workflow's existing review/feedback machinery unmodified — see
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
82
81
  [STATES.md §11](../STATES.md#11-the-review-checkout-window) and
83
- [CLI reference](cli.md#gtd-review-commitish---json).
82
+ [CLI reference](cli.md#gtd-review-commitish---json). The current command
83
+ surface is `init` / `step` / `next` / `status` / `validate` / `mermaid` /
84
+ `review` / `lsp`.
85
+
84
86
  - **`gtd format <file>`, and the bundled prettier with it.** gtd no longer
85
87
  formats anything on its own: a steering-file mode declares its own `format:`
86
88
  SHELL COMMAND, so a project brings whatever formatter it already uses. Adding
87
89
  four lines to `.gtdrc` restores (and improves on) the old auto-formatting for
88
- the bundled default workflow:
90
+ the `simple` template:
89
91
 
90
92
  ```yaml
91
93
  modes:
@@ -114,25 +116,33 @@ upgrading.
114
116
  itself only understands the two built-ins), the LSP reads that same config the
115
117
  CLI does to build its path→mode dispatch, and `gtd.openSteeringFile` resolves
116
118
  the current state and shows its `file:`. No mapping declared at all (the
117
- bundled default's predecessor shape, or any workflow with no `file:`/`mode:`)
118
- falls back to basename dispatch (`TODO.md`/`REVIEW.md`), same as before this
119
- addition.
119
+ `simple` template's predecessor shape, or any workflow with no
120
+ `file:`/`mode:`) falls back to basename dispatch (`TODO.md`/`REVIEW.md`), same
121
+ as before this addition.
120
122
 
121
123
  ## How to adopt
122
124
 
123
- `workflow:` is optional — with no config at all, the bundled default workflow
124
- applies: a single-shot `grilling` plan, direct `building`, a `checking`/`fixing`
125
- loop, and a direct-diff `await-review` that rests the cycle back at `idle` on
126
- approval — no squash; every turn commit stays in history for you to squash
127
- however you like, or not at all (see
128
- [STATES.md §10](../STATES.md#10-the-bundled-default-workflow)) — expressed as
129
- data rather than baked into the engine. The fuller grilling ⇄ grilling-answer /
130
- architecting ⇄ architecting-answer / decompose / picking / reviewing shape v2
131
- shipped — including a squash finale — is preserved as a copy-paste `.gtdrc`
132
- example at [docs/examples/advanced-workflow.md](examples/advanced-workflow.md)
133
- rather than the bundled default. Nothing to do for a repo that's happy with the
134
- default shape beyond a normal `npm install -g @pmelab/gtd` upgrade, from a
135
- settled `idle` boundary.
125
+ `workflow:` is now **required** — gtd ships no default workflow, so after
126
+ upgrading each repo must scaffold one **once**:
127
+
128
+ ```bash
129
+ gtd init simple # or: gtd init advanced
130
+ ```
131
+
132
+ `gtd init simple` writes a `.gtdrc.json` with the `simple` template inline: a
133
+ single-shot `grilling` plan, direct `building`, a `checking`/`fixing` loop, and
134
+ a direct-diff `await-review` that rests the cycle back at `idle` on approval —
135
+ no squash; every turn commit stays in history for you to squash however you
136
+ like, or not at all (see
137
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)).
138
+ `gtd init advanced` writes the fuller grilling ⇄ grilling-answer / architecting
139
+ ⇄ architecting-answer / decompose / picking / reviewing machine — including a
140
+ squash finale — walked through at
141
+ [docs/examples/advanced-workflow.md](examples/advanced-workflow.md). Review and
142
+ commit the generated `.gtdrc.json`, then continue from a settled `idle`
143
+ boundary. **Note:** a repo relying on earlier gtd's auto-created `.gtdrc.json`
144
+ `$schema` stub (which carried no `workflow:`) will now fail until you `gtd init`
145
+ — the stub alone is no longer enough.
136
146
 
137
147
  A repo that customized v2's `workflow:` key (actors, gates, guard vocabulary,
138
148
  ladders) needs to rewrite it from scratch in the v3 schema — see
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmelab/gtd",
3
- "version": "5.1.0",
3
+ "version": "6.1.0",
4
4
  "private": false,
5
5
  "description": "Git-aware CLI that emits the next prompt for an autonomous coding agent based on the current repository state",
6
6
  "bin": {