@pmelab/gtd 6.7.0 → 6.9.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,12 +4,12 @@
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 (one of: simple, advanced); its agent
9
- prompts are written as editable Markdown under gtd-prompts/
10
- and referenced from the config. Run once per repo; refuses
11
- if a gtd config already exists. Leaves the files uncommitted
12
- for you to review and commit
7
+ init Scaffold a .gtdrc.json for this repo with the bundled
8
+ unified workflow; its agent prompts are written as editable
9
+ Markdown under gtd-prompts/ and referenced from the config.
10
+ Takes no argument. Run once per repo; refuses if a gtd
11
+ config already exists. Leaves the files uncommitted for you
12
+ to review and commit
13
13
  step <actor> Authenticate as <actor>, match the resolved rest's
14
14
  declared patterns against the pending changes, and commit
15
15
  (or squash) the one resulting transition. Pass
@@ -59,19 +59,22 @@ mistyped flag can never degrade a JSON caller to plain-text mode. A bare
59
59
  `--model`, `--model` without `--cost`, or either flag on any command other than
60
60
  `gtd step` are all usage errors.
61
61
 
62
- ## `gtd init <workflow>`
62
+ ## `gtd init`
63
63
 
64
- Scaffolds a `.gtdrc.json` at the repository root with one of the bundled
65
- workflow templates inline under a `workflow:` key, plus a `$schema` link.
66
- `<workflow>` is required and must be `simple` or `advanced` (a missing or
67
- unknown name is a usage error listing both). gtd ships **no** default workflow,
68
- so this is the one-time setup step for a repo; a state command run before it
69
- fails with `gtd: no workflow configured — run \`gtd init <simple|advanced>\` …`.
64
+ Scaffolds a `.gtdrc.json` at the repository root with the bundled **unified**
65
+ workflow template inline under a `workflow:` key, plus a `$schema` link. It
66
+ takes **no argument** — passing one is a usage error
67
+ (`gtd init: too many arguments — init takes no argument`). gtd ships **no**
68
+ default workflow, so this is the one-time setup step for a repo; a state command
69
+ run before it fails with `gtd: no workflow configured — run \`gtd init\` to
70
+ create .gtdrc.json`.
70
71
 
71
- - `simple` — the 10-state machine (see
72
- [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)).
73
- - `advanced` — the fuller machine (see
74
- [advanced-workflow.md](examples/advanced-workflow.md)).
72
+ The unified template has three entry points into one shared review/squash tail
73
+ (see [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)): creating
74
+ `.gtd/TODO.md` starts the simple flow (grilling → building → checking), creating
75
+ `.gtd/REQUIREMENTS.md` starts the advanced flow (two-phase Q&A planning,
76
+ per-package parallel build, agentic spec-review), and `gtd review <commitish>`
77
+ enters review directly.
75
78
 
76
79
  The file is written **uncommitted**; review and commit it before your first
77
80
  `gtd step` (an uncommitted `.gtdrc.json` is a pending change the initial state
@@ -79,7 +82,7 @@ would otherwise capture). `gtd init` refuses if the repo root already has its
79
82
  own gtd config (a global/ancestor config, e.g. `~/.gtdrc`, does not count),
80
83
  requires the repository root, and — with `gtd lsp` — is one of the two commands
81
84
  that run with no workflow configured. `--json` prints
82
- `{"written":".gtdrc.json","workflow":"<name>"}`. See
85
+ `{"written":".gtdrc.json","workflow":"unified","prompts":[…]}`. See
83
86
  [Configuration](configuration.md#gtd-init).
84
87
 
85
88
  ## `gtd step <actor> [--cost=<n>] [--model=<name>]`
@@ -325,9 +328,9 @@ Then:
325
328
  approve), has nothing to validate and exits `0`
326
329
  (`nothing to validate at "<state>"`). Nothing is formatted in that case.
327
330
 
328
- This is how the `simple` template keeps its steering files well-formed without
329
- an in-machine validation state — and the check runs whoever last touched the
330
- file, agent or human:
331
+ This is how the unified template keeps its steering files well-formed without an
332
+ in-machine validation state — and the check runs whoever last touched the file,
333
+ agent or human:
331
334
 
332
335
  - **The producing agent self-validates.** Plain `gtd next` appends a "run
333
336
  `gtd validate` and fix all violations" instruction to a `prompt` rest that
@@ -40,7 +40,7 @@ Any other top-level key is **rejected** (`onExcessProperty: "error"`) — v3 has
40
40
  no `testCommand`, `fixAttemptCap`, `reviewThreshold`, `agenticReview`, `squash`,
41
41
  `learning`, `decisionLog`, or `models` keys; all of that machinery is gone (see
42
42
  [Upgrading](upgrading.md)). The engine blesses no VARIABLE NAMES either —
43
- `testCommand` (the bundled templates' own var, see ["Variables"](#variables)) is
43
+ `testCommand` (the bundled template's own var, see ["Variables"](#variables)) is
44
44
  workflow-authored data like any other `it.vars` entry, not a special key gtd
45
45
  interprets.
46
46
 
@@ -53,10 +53,9 @@ interprets.
53
53
  > behind it.
54
54
 
55
55
  The `workflow:` key is the **only** definition source — there is no `extends`,
56
- no merge-over-a-built-in. The bundled templates `gtd init` scaffolds are
57
- themselves YAML assets (`src/workflows/simple.yaml`,
58
- `src/workflows/advanced.yaml`) compiled through the exact same compiler
59
- (`compileWorkflowConfig`); `gtd init` just writes one of them, inline, under
56
+ no merge-over-a-built-in. The bundled template `gtd init` scaffolds is itself a
57
+ YAML asset (`src/workflows/unified.yaml`) compiled through the exact same
58
+ compiler (`compileWorkflowConfig`); `gtd init` just writes it, inline, under
60
59
  this key. Its shape:
61
60
 
62
61
  ```yaml
@@ -93,11 +92,23 @@ engine, and [§3](../STATES.md#3-pattern-grammar) for the pattern grammar.
93
92
  ### Content values: inline or a file reference
94
93
 
95
94
  A `script`/`prompt`/`message`/`commit` value starting with `./` or `../` is a
96
- **file reference** — resolved relative to the config file's own directory and
97
- read at load time. A missing or unreadable file reference is a **load error**,
98
- collected and thrown with every other config problem — never silently treated as
99
- inline text. Any other string (including one that merely contains a `/`, or an
100
- absolute path) is inline Eta template source, used verbatim.
95
+ **file reference** — resolved relative to **the directory of the `.gtdrc` that
96
+ declared it** (not the directory `gtd` runs from) and read at load time. A
97
+ missing or unreadable file reference is a **load error**, collected and thrown
98
+ with every other config problem — never silently treated as inline text. Any
99
+ other string (including one that merely contains a `/`, or an absolute path) is
100
+ inline Eta template source, used verbatim.
101
+
102
+ Because references anchor to the declaring file, a `.gtdrc` and its
103
+ `gtd-prompts/` (or `prompts/`) directory can live **outside** the repo — e.g. in
104
+ a parent directory shared across several repos. gtd still runs from the repo
105
+ root, discovers the parent `.gtdrc` by walking up the directory chain (see
106
+ ["Lookup and precedence"](#lookup-and-precedence) — cwd→home), and inlines each
107
+ level's `./`-relative references against that level's own directory. When
108
+ workflows are layered across levels, every reference resolves against the file
109
+ that wrote it, so a parent's `./gtd-prompts/x.md` and a child's never collide.
110
+ You can scaffold such a shared config by running [`gtd init`](#gtd-init) from
111
+ that parent directory — it need not be a git repository.
101
112
 
102
113
  ```yaml
103
114
  workflow:
@@ -230,9 +241,10 @@ Because `grilling` re-enters itself around the answer loop, every lap emits
230
241
  `building` emits a different label (`build`), which is where the driver clears
231
242
  memory for a fresh implementation turn. A loop of same-labelled turns retains; a
232
243
  differently-labelled state at a phase boundary clears. This is exactly how the
233
- `simple` template scopes its four agent states (`plan`/`build`/`fix`/`review` —
234
- see [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)), and how
235
- the loop driver reads it is spelled out in `skills/loop/SKILL.md`.
244
+ unified template scopes its agent states across the four `plan`/`build`/`fix`/
245
+ `review` memory tiers (see
246
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)), and how the
247
+ loop driver reads it is spelled out in `skills/loop/SKILL.md`.
236
248
 
237
249
  Like `model`, `memory:` is rendered as an Eta template through the same context
238
250
  as the state's content — a plain label (`plan`) passes through unchanged, while
@@ -250,8 +262,7 @@ A state may additionally declare `file:` — an Eta template naming THE steering
250
262
  file this state is about: the file a human/editor should look at while the
251
263
  machine rests here (rendered through the same `it.vars`-carrying context as
252
264
  content/`model`; must render non-empty). Forbidden on a commit state (never at
253
- rest). Multiple states may share one `file:` (and, in the `simple` template,
254
- do):
265
+ rest). Multiple states may share one `file:` (and, in the unified template, do):
255
266
 
256
267
  ```yaml
257
268
  workflow:
@@ -369,12 +380,11 @@ So for a state declaring `mode: qa`:
369
380
  | both | its `format:` | its `validate:` |
370
381
 
371
382
  That is what makes the built-in modes extensible rather than all-or-nothing —
372
- and the top-level key means a project can plug its formatter into whichever
373
- workflow it scaffolded (`gtd init simple`/`advanced`) without re-declaring a
374
- `modes:` block on the workflow itself. **`gtd init` seeds exactly this block by
375
- default** (the Prettier suggestion below), so a fresh repo already formats its
376
- steering files — edit or drop it to taste. It sits alongside the `workflow:` key
377
- in your `.gtdrc.json`:
383
+ and the top-level key means a project can plug its formatter into the workflow
384
+ it scaffolded (`gtd init`) without re-declaring a `modes:` block on the workflow
385
+ itself. **`gtd init` seeds exactly this block by default** (the Prettier
386
+ suggestion below), so a fresh repo already formats its steering files — edit or
387
+ drop it to taste. It sits alongside the `workflow:` key in your `.gtdrc.json`:
378
388
 
379
389
  ```jsonc
380
390
  // .gtdrc.json — the workflow from `gtd init`, plus your own markdown formatter
@@ -429,10 +439,11 @@ workflow:
429
439
  "* **": building
430
440
  ```
431
441
 
432
- The `simple` template enables `reviewWindow: true` on `await-review` (no
433
- `reviewBase` state, so the base is the whole cycle). The pure engine never
434
- observes an open window — it is opened/closed entirely at the edge; the real
435
- head is preserved under `refs/gtd/review-head` (the base under
442
+ The unified template enables `reviewWindow: true` on `await-review` and marks
443
+ `review-deciding` `reviewBase: true`, so the first review covers the whole cycle
444
+ but each subsequent feedback round's window narrows to `last-review..HEAD`. The
445
+ pure engine never observes an open window — it is opened/closed entirely at the
446
+ edge; the real head is preserved under `refs/gtd/review-head` (the base under
436
447
  `refs/gtd/review-base`) for the window's lifetime. See
437
448
  [STATES.md §11](../STATES.md) for the full lifecycle.
438
449
 
@@ -546,15 +557,14 @@ Every template — `script`/`prompt`/`message`/`commit`, and `model`/`memory`/
546
557
  layers, **later wins**:
547
558
 
548
559
  1. **The workflow's own `vars:` key** (sibling to `states:`, shown above) — the
549
- workflow author's declared defaults. The `simple` template declares
560
+ workflow author's declared defaults. The unified template declares
550
561
  `vars: { testCommand: "npm test" }`, read by `checking`'s script as
551
562
  `<%~ it.vars.testCommand %>` (see
552
- [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)). Both
553
- bundled templates also declare two model-tier vars — `plannerModel` (default
554
- `smart`) and `coderModel` (default `base`) — that every agent state's
555
- `model:` resolves through (`model: <%= it.vars.plannerModel %>`), so
556
- repointing one var here (or via layer 2/3 below) changes every state on that
557
- tier at once.
563
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)). The bundled
564
+ template also declares two model-tier vars — `plannerModel` (default `smart`)
565
+ and `coderModel` (default `base`) — that every agent state's `model:`
566
+ resolves through (`model: <%= it.vars.plannerModel %>`), so repointing one
567
+ var here (or via layer 2/3 below) changes every state on that tier at once.
558
568
  2. **A top-level `.gtdrc` `vars:` key** (a sibling of `workflow:`, NOT nested
559
569
  inside it) — per-repo tuning without redefining the whole workflow. Subject
560
570
  to the same cwd→home deep merge as everything else in `.gtdrc` (innermost
@@ -572,7 +582,7 @@ alongside every other config-shape finding (see
572
582
  already strings.
573
583
 
574
584
  ```yaml
575
- # .gtdrc — overriding the `simple` template's testCommand
585
+ # .gtdrc — overriding the unified template's testCommand
576
586
  vars:
577
587
  testCommand: npm run test:ci
578
588
  ```
@@ -664,22 +674,34 @@ gtd ships **no** default workflow, so a repo must scaffold one before any state
664
674
  command works:
665
675
 
666
676
  ```bash
667
- gtd init simple # or: gtd init advanced
677
+ gtd init # takes no argument
668
678
  ```
669
679
 
670
- `gtd init <workflow>` writes a `.gtdrc.json` at the repository root with the
671
- chosen bundled template's workflow under a `workflow:` key, plus a `$schema`
672
- link (so editors pick up completion/validation). Each **agent state's prompt**
673
- is written as a standalone Markdown file under `gtd-prompts/<state>.md` and the
674
- config references it via a `./gtd-prompts/<state>.md`
680
+ `gtd init` writes a `.gtdrc.json` at the repository root with the bundled
681
+ unified template's workflow under a `workflow:` key, plus a `$schema` link (so
682
+ editors pick up completion/validation). It takes **no argument** — passing one
683
+ is a usage error (`gtd init: too many arguments — init takes no argument`). Each
684
+ **agent state's prompt** is written as a standalone Markdown file under
685
+ `gtd-prompts/<state>.md` and the config references it via a
686
+ `./gtd-prompts/<state>.md`
675
687
  [file reference](#content-values-inline-or-a-file-reference) — gtd inlines it at
676
688
  load time, so a prompt is editable Markdown and editing it changes the workflow
677
689
  with no config edit. Human `message:` blocks and check `script:` bodies stay
678
690
  inline in the config (they are workflow mechanics, not prompts).
679
691
 
692
+ `gtd init` writes only config — it derives no git state — so it need not run in
693
+ a git repository. It runs at a **repository root** or in a directory **outside
694
+ any repository** (scaffolding a shared config a nested repo picks up by walking
695
+ up — see the parent-dir note under
696
+ [file references](#content-values-inline-or-a-file-reference)); its guidance
697
+ adjusts to say there is nothing to commit when it is not in a repo. It refuses
698
+ only to write into a repository **subdirectory**, where the upward config walk
699
+ would never find the file. Either way, it will not overwrite an existing config
700
+ at that directory (remove it first to re-scaffold).
701
+
680
702
  It also seeds a top-level [`modes:`](#modes--pluggable-steering-file-modes)
681
703
  block as a ready-to-edit suggestion — a Prettier `format:` for each built-in
682
- steering-file mode the templates use:
704
+ steering-file mode the template uses:
683
705
 
684
706
  ```jsonc
685
707
  "modes": {
@@ -694,16 +716,22 @@ this is the one default it suggests: a fresh repo auto-formats its steering
694
716
  files out of the box, and you edit or drop the block freely (swap Prettier for
695
717
  dprint, point at a script, or delete the key).
696
718
 
697
- The two templates:
719
+ The one bundled template has three entry points into a shared review/squash tail
720
+ (all walked through in
721
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)):
722
+
723
+ - **the simple flow** — creating `.gtd/TODO.md` starts idle → grilling ⇄
724
+ grilling-answer → building → checking ⇄ fixing (→ escalate) → reviewing →
725
+ await-review.
726
+ - **the advanced flow** — creating `.gtd/REQUIREMENTS.md` starts the fuller
727
+ machine: two-phase Q&A planning (product then architecture), package
728
+ decomposition, a per-package parallel build queue with an agentic spec-review
729
+ gate, then the same shared tail.
730
+ - **`gtd review <commitish>`** — enters the shared `reviewing` state directly to
731
+ review a foreign branch.
698
732
 
699
- - **`simple`** — the 10-state machine walked through in
700
- [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates): idle →
701
- grilling ⇄ grilling-answer → building → checking ⇄ fixing (→ escalate) →
702
- reviewing → await-review, resting back at idle on approval (no squash).
703
- - **`advanced`** — the fuller machine (two-phase Q&A planning, an architecture
704
- phase, task decomposition, a per-task build queue, and a squash finale),
705
- walked through at
706
- [docs/examples/advanced-workflow.md](examples/advanced-workflow.md).
733
+ Both file-created flows converge on `reviewing` → `await-review`, and a full
734
+ sign-off squashes the whole cycle into one commit.
707
735
 
708
736
  The files are written **uncommitted** — review them, then commit `.gtdrc.json`
709
737
  and `gtd-prompts/` before your first `gtd step` (an uncommitted file is a
@@ -715,7 +743,7 @@ that run with no workflow configured. A state command run before `gtd init`
715
743
  fails with:
716
744
 
717
745
  ```
718
- gtd: no workflow configured — run `gtd init <simple|advanced>` to create .gtdrc.json
746
+ gtd: no workflow configured — run `gtd init` to create .gtdrc.json
719
747
  ```
720
748
 
721
749
  ## A complete example
@@ -778,19 +806,22 @@ the file.
778
806
 
779
807
  ## Recipe: a per-task builder loop without a script state
780
808
 
781
- A `picking`-style queue arbiter (see
782
- [docs/examples/advanced-workflow.md](examples/advanced-workflow.md)) is a
783
- `script` state that turns a task-queue glob into a diff patterns can see. A
784
- driver that can't run scripts can get the same per-task loop out of pure
785
- prompt/`on` declarations instead, at the cost of trusting the agent to honor a
786
- marker protocol rather than a deterministic `ls`: see
809
+ A `picking`-style queue arbiter (the bundled unified template's advanced flow
810
+ carries one — see
811
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)) is a `script`
812
+ state that turns a task-queue glob into a diff patterns can see. A driver that
813
+ can't run scripts can get the same per-task loop out of pure prompt/`on`
814
+ declarations instead, at the cost of trusting the agent to honor a marker
815
+ protocol rather than a deterministic `ls`: see
787
816
  [docs/design/work-packages.md §3](design/work-packages.md) ("Option B —
788
817
  agent-encoded verdict") for the worked example.
789
818
 
790
819
  ## A fuller example: two-phase planning, task decomposition, agent-prepared review
791
820
 
792
- The example above is deliberately small (it is close to the `simple` template).
793
- For a heavier machine — Q&A planning loops, an architecture phase, task
794
- decomposition, the deterministic per-task `picking` arbiter, and agent-prepared
795
- `.gtd/REVIEW.md` review — run `gtd init advanced`, walked through at
796
- [docs/examples/advanced-workflow.md](examples/advanced-workflow.md).
821
+ The example above is deliberately small (it is close to the bundled unified
822
+ template's simple flow). For a heavier machine — Q&A planning loops, an
823
+ architecture phase, task decomposition, the deterministic per-task `picking`
824
+ arbiter, and agent-prepared `.gtd/REVIEW.md` review — the unified template's
825
+ **advanced flow** (started by creating `.gtd/REQUIREMENTS.md`) is exactly that,
826
+ walked through in
827
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates).
@@ -68,8 +68,8 @@ patterns desyncs the machine. The vars are a DRY mechanism inside templates and
68
68
  the state↔file association, not a rename switch. (Making pattern keys var-aware
69
69
  at compile time is noted as possible future work.)
70
70
 
71
- The advanced example (`docs/examples/advanced-workflow.md`) gains the same
72
- `file:`/`mode:` annotations (it is the LSP-heavy flow), including
71
+ The advanced flow of the bundled unified template (see STATES.md §10) gains the
72
+ same `file:`/`mode:` annotations (it is the LSP-heavy flow), including
73
73
  `architectureFile` for its architecting phases (also `qa`-format).
74
74
 
75
75
  ## 3. The LSP becomes config-driven
@@ -105,7 +105,7 @@ The advanced example (`docs/examples/advanced-workflow.md`) gains the same
105
105
  | `src/Edge.ts` / `src/program.ts` | Render `file:` at rest; `file`/`mode` in both `--json` payloads + plain `status` lines. |
106
106
  | `src/Lsp.ts` | Config discovery, path→mode dispatch (with basename fallback), `gtd.openSteeringFile`. |
107
107
  | `src/workflows/default.yaml` | §2's vars + per-state `file:`/`mode:`; templates switch to filename vars. |
108
- | Docs | STATES.md property table + §10; configuration.md (`file:`/`mode:` section + mode vocabulary + the pattern-literal limitation); cli.md JSON contracts; examples/advanced-workflow.md annotations; upgrading note (jump command is back, config-driven). |
108
+ | Docs | STATES.md property table + §10; configuration.md (`file:`/`mode:` section + mode vocabulary + the pattern-literal limitation); cli.md JSON contracts; the bundled unified template's advanced-flow annotations (STATES.md §10); upgrading note (jump command is back, config-driven). |
109
109
  | Tests | Unit: validation (mode vocabulary, mode-requires-file, commit-state prohibition, aggregation), compile, `file:` render + failure path; LSP path→mode dispatch, fallback, openSteeringFile (pure helpers). E2e: `driver-json-status.feature` file/mode emission (present + omitted); `lsp.feature` @live — documentSymbol served for a CUSTOM-named qa file mapped via a real `.gtdrc` (proving config-driven dispatch), and the jump command returning the rendered path at a known state. |
110
110
  | Live verification | Scratch repo with a custom workflow whose `file:` uses a var: `gtd status` shows the rendered `File:`/`Mode:`; LSP smoke against the custom filename; default workflow spot-check (`grilling` → `File: .gtd/TODO.md`, `Mode: qa`). |
111
111
 
@@ -306,8 +306,8 @@ sub-millisecond — safe to run on every invocation, exactly like today's
306
306
  - **The bundled default must stay finding-free** — findings 7 and 10 are
307
307
  calibrated against it (`fixing`'s cap bounds the check loop; the literal
308
308
  `.gtd/...` patterns match the declared default vars). Any new check must be
309
- validated against `default.yaml` and `docs/examples/advanced-workflow.md`
310
- before landing.
309
+ validated against the bundled unified template (`src/workflows/unified.yaml`,
310
+ covering both its simple and advanced flows) before landing.
311
311
  - **Warning channel is the only architectural change** — everything else slots
312
312
  into the existing collect-and-merge flow in `compileWorkflowConfig`.
313
313
 
@@ -133,7 +133,7 @@ review-deciding branch condition. Findings go into `.gtd/FORMAT.md` verbatim
133
133
  | `STATES.md` §10 | New table + walkthrough (both loops, the declaration-order subtleties, the hygiene invariant). |
134
134
  | `tests/integration/features/default-workflow.feature` | Rewritten: malformed-TODO lap (simulate `todo-validating` by writing `.gtd/FORMAT.md` + `gtd step check` — @inmem never executes scripts), valid draft → answer lap → accept; malformed-REVIEW lap; tick-all approve → `idle` with empty `.gtd/`; partial-tick feedback → TODO.md extraction → `grilling`; delete-shortcut approve; retry/escalation kept. |
135
135
  | `smoke.feature` | Hop updates (`grilling` now routes to `todo-validating`). |
136
- | Docs | `configuration.md` / `README.md` walkthrough mentions; `docs/examples/advanced-workflow.md` intro gains one line noting the default now carries the validation loops (the example itself is NOT reworked in this change — noted as a possible follow-up to rebase it on the new default). |
136
+ | Docs | `configuration.md` / `README.md` walkthrough mentions; the advanced flow is now part of the bundled unified template (see STATES.md §10) rather than a standalone example. |
137
137
  | Live verification | Real-script drive (`gtd run` at each validator) covering: agent writes malformed TODO → FORMAT.md → fixed lap; answers folded; malformed REVIEW lap; tick-all approve; partial-tick feedback extracting TODO.md; final tree `.gtd`-free at idle. |
138
138
 
139
139
  ## 5. The LSP server comes back (v3-shaped)
@@ -1,12 +1,11 @@
1
1
  # Design: the builder / work-packages flow as pure workflow configuration
2
2
 
3
- > Status: LANDED, then relocated (2026-07-22) — Option A shipped in the bundled
4
- > default workflow's `picking` state; the bundled default has since been
5
- > drastically simplified and no longer includes it. The full Option-A machine
6
- > now lives as a copy-paste example at
7
- > [docs/examples/advanced-workflow.md](../examples/advanced-workflow.md). The
8
- > rest of this document is kept as the decision record: why Option A was chosen
9
- > over B/C/D, and the process-per-task topology (§6) remains a documented,
3
+ > Status: LANDED — Option A shipped in the bundled default workflow's `picking`
4
+ > state. It now lives in the bundled **unified** template's advanced flow (the
5
+ > `picking` state, reached by starting a cycle with `.gtd/REQUIREMENTS.md` — see
6
+ > [STATES.md §10](../../STATES.md#10-the-bundled-workflow-templates)). The rest
7
+ > of this document is kept as the decision record: why Option A was chosen over
8
+ > B/C/D, and the process-per-task topology (§6) remains a documented,
10
9
  > unimplemented recipe.
11
10
  >
12
11
  > Context (as originally written): v2 had an engine-level package loop
@@ -31,18 +31,16 @@ 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 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.
34
+ bundled workflow template (`src/workflows/unified.yaml`) `gtd init` scaffolds is
35
+ imported as raw text via tsdown's `.yaml`-as-text loader (`tsdown.config.ts`)
36
+ and compiled through the same path a `.gtdrc` `workflow:` key goes through
37
+ (`src/workflows/templates.ts`) — no privileged code path.
39
38
 
40
39
  `npm run dev` runs `src/main.ts` directly via Node's native TypeScript
41
40
  type-stripping (requires Node 22.6+). It registers `dev/hooks.mjs`, which
42
41
  resolves `./Foo.js` specifiers to the on-disk `./Foo.ts` and imports `*.yaml`
43
42
  files as raw text, mirroring tsdown's `.yaml`-as-text loader — this is what lets
44
- `src/workflows/simple.yaml` and `src/workflows/advanced.yaml` resolve when
45
- running from source.
43
+ `src/workflows/unified.yaml` resolve when running from source.
46
44
 
47
45
  The decision core is pure and IO-free: the pattern machine's shape (states,
48
46
  patterns, retry) is a plain-data `WorkflowDefinition` (`src/PatternMachine.ts`),
package/docs/upgrading.md CHANGED
@@ -16,7 +16,7 @@ subject (or the bare `gtd(<actor>): <to>`) naming a state and an actor the
16
16
  active workflow currently declares; everything else — a v1 `gtd: grilling`, a v2
17
17
  `gtd(agent): building`, a plain `chore: …` commit, anything from a foreign repo
18
18
  — parses as unrecognized and lands at the workflow's initial state (`idle` in
19
- the `simple` template). There is no special-casing for "this looks like an old
19
+ the unified template). There is no special-casing for "this looks like an old
20
20
  gtd commit": the mechanism is exactly the same one that already made v1 history
21
21
  inert to v2, and v2 history inert to a differently-configured workflow — v3 just
22
22
  applies it uniformly to all 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
- `simple` template's `testCommand`, overridable via the top-level `vars:` key
45
- or a `GTD_VAR_testCommand` environment variable — see
44
+ unified template's `testCommand`, overridable via the top-level `vars:` key or
45
+ 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 `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).
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
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 `simple` template's own
63
+ deletes, matched by an ordinary `on` pattern. The unified template's own
64
64
  checkbox-review verdict (`review-deciding`) is ordinary WORKFLOW data (an `on`
65
65
  pattern), not an engine hook: `D REVIEW.md` = approve, `M REVIEW.md` = route
66
- to the deterministic decider, in the `simple` template. Deterministic
66
+ to the deterministic decider, in the unified 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,
@@ -87,7 +87,7 @@ upgrading.
87
87
  formats anything on its own: a steering-file mode declares its own `format:`
88
88
  SHELL COMMAND, so a project brings whatever formatter it already uses. Adding
89
89
  four lines to `.gtdrc` restores (and improves on) the old auto-formatting for
90
- the `simple` template:
90
+ the unified template:
91
91
 
92
92
  ```yaml
93
93
  modes:
@@ -116,9 +116,9 @@ upgrading.
116
116
  itself only understands the two built-ins), the LSP reads that same config the
117
117
  CLI does to build its path→mode dispatch, and `gtd.openSteeringFile` resolves
118
118
  the current state and shows its `file:`. No mapping declared at all (the
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.
119
+ bundled template's predecessor shape, or any workflow with no `file:`/`mode:`)
120
+ falls back to basename dispatch (`TODO.md`/`REVIEW.md`), same as before this
121
+ addition.
122
122
 
123
123
  ## How to adopt
124
124
 
@@ -126,20 +126,20 @@ upgrading.
126
126
  upgrading each repo must scaffold one **once**:
127
127
 
128
128
  ```bash
129
- gtd init simple # or: gtd init advanced
129
+ gtd init # takes no argument
130
130
  ```
131
131
 
132
- `gtd init simple` writes a `.gtdrc.json` for the `simple` template (its agent
133
- prompts extracted to editable `gtd-prompts/*.md` files the config references): a
134
- single-shot `grilling` plan, direct `building`, a `checking`/`fixing` loop, and
135
- a direct-diff `await-review` that rests the cycle back at `idle` on approval —
136
- no squash; every turn commit stays in history for you to squash however you
137
- like, or not at all (see
138
- [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)).
139
- `gtd init advanced` writes the fuller grilling ⇄ grilling-answer / architecting
140
- ⇄ architecting-answer / decompose / picking / reviewing machine — including a
141
- squash finale — walked through at
142
- [docs/examples/advanced-workflow.md](examples/advanced-workflow.md). Review and
132
+ `gtd init` (no argument) writes a `.gtdrc.json` for the single bundled
133
+ **unified** template (its agent prompts extracted to editable `gtd-prompts/*.md`
134
+ files the config references). The template forks on which steering file you
135
+ create: `.gtd/TODO.md` starts the **simple flow** (a single-shot `grilling`
136
+ plan, direct `building`, a `checking`/`fixing` loop), while
137
+ `.gtd/REQUIREMENTS.md` starts the **advanced flow** (two-phase grilling ⇄
138
+ grilling-answer / architecting ⇄ architecting-answer / decompose / picking /
139
+ per-package build with an agentic spec-review gate). Both converge on the same
140
+ `reviewing` → `await-review` tail, and a full sign-off squashes the whole cycle
141
+ into one commit (see
142
+ [STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)). Review and
143
143
  commit the generated `.gtdrc.json` (and its `gtd-prompts/` directory), then
144
144
  continue from a settled `idle` boundary. **Note:** a repo relying on earlier
145
145
  gtd's auto-created `.gtdrc.json` `$schema` stub (which carried no `workflow:`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmelab/gtd",
3
- "version": "6.7.0",
3
+ "version": "6.9.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": {