@pmelab/gtd 6.14.0 → 7.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/README.md +21 -19
- package/dist/gtd.bundle.mjs +850 -322
- package/docs/cli.md +69 -72
- package/docs/configuration.md +120 -57
- package/docs/development.md +2 -1
- package/docs/upgrading.md +23 -21
- package/package.json +1 -1
- package/schema.json +180 -0
package/docs/cli.md
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
Usage: gtd [command] [options]
|
|
5
5
|
|
|
6
6
|
Commands:
|
|
7
|
-
init Scaffold a .gtdrc.json for this repo
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
to review and commit
|
|
7
|
+
init Scaffold a minimal .gtdrc.json for this repo, seeding a
|
|
8
|
+
testCommand var (npm test) and a ready-to-edit Prettier
|
|
9
|
+
formatting suggestion under modes:. Writes no workflow — gtd
|
|
10
|
+
runs the bundled unified workflow as its built-in default.
|
|
11
|
+
Takes no argument. Refuses if a gtd config already exists.
|
|
12
|
+
Leaves the file uncommitted for you 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
|
|
@@ -32,14 +32,15 @@ Commands:
|
|
|
32
32
|
validate Format and validate the steering file the resolved rest
|
|
33
33
|
declares, with its mode's commands (its file:/mode:);
|
|
34
34
|
exits non-zero with the findings when it is invalid
|
|
35
|
-
mermaid Print the active workflow's shape as Mermaid
|
|
36
|
-
stateDiagram-v2 source (no mutation)
|
|
37
35
|
lsp Start the LSP server for .gtd/ steering files (stdio)
|
|
36
|
+
visualize Serve an interactive diagram of the active workflow locally
|
|
38
37
|
version Print version and exit
|
|
39
38
|
help Print this help and exit
|
|
40
39
|
|
|
41
40
|
Options:
|
|
42
41
|
--json Output structured JSON instead of plain text
|
|
42
|
+
--port=<n> (gtd visualize only) port to serve on (default: a free port)
|
|
43
|
+
--no-open (gtd visualize only) do not open the browser
|
|
43
44
|
--cost=<n> (gtd step only) record the invocation's token cost
|
|
44
45
|
--model=<name> (gtd step only, with --cost) tag that cost's model
|
|
45
46
|
--version, -v Print version and exit
|
|
@@ -65,15 +66,17 @@ mistyped flag can never degrade a JSON caller to plain-text mode. A bare
|
|
|
65
66
|
|
|
66
67
|
## `gtd init`
|
|
67
68
|
|
|
68
|
-
Scaffolds a `.gtdrc.json` at the repository root
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
Scaffolds a **minimal** `.gtdrc.json` at the repository root, plus a `$schema`
|
|
70
|
+
link. It writes **no** `workflow:` key — gtd runs the bundled **unified**
|
|
71
|
+
workflow as its built-in default, so a state command works out of the box with
|
|
72
|
+
no config and no init at all. What `gtd init` seeds is the two things most
|
|
73
|
+
projects tune: a `vars: { "testCommand": "npm test" }` entry (the var the
|
|
74
|
+
bundled workflow's check script reads) and a ready-to-edit `modes:` block
|
|
75
|
+
suggesting a Prettier `format:` for each built-in steering-file mode
|
|
76
|
+
(`qa`/`review`). It takes **no argument** — passing one is a usage error
|
|
77
|
+
(`gtd init: too many arguments — init takes no argument`).
|
|
78
|
+
|
|
79
|
+
The bundled default has four entry points — each behind a green-baseline gate
|
|
77
80
|
that runs the suite before starting — into one shared review/squash tail (see
|
|
78
81
|
[STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)): creating
|
|
79
82
|
`.gtd/TODO.md` starts the simple flow (planning → building → checking), creating
|
|
@@ -81,15 +84,16 @@ that runs the suite before starting — into one shared review/squash tail (see
|
|
|
81
84
|
per-package parallel build, agentic spec-review), `gtd review <commitish>`
|
|
82
85
|
enters review directly, and `gtd fix` goes straight into repairing failing
|
|
83
86
|
tests. A red baseline halts at a `*-start-blocked` gate rather than starting new
|
|
84
|
-
work.
|
|
87
|
+
work. To CUSTOMIZE that machine, add your own `workflow:` key (a full definition
|
|
88
|
+
— there is no `extends`/merge); see
|
|
89
|
+
[Configuration](configuration.md#the-workflow-key).
|
|
85
90
|
|
|
86
91
|
The file is written **uncommitted**; review and commit it before your first
|
|
87
92
|
`gtd step` (an uncommitted `.gtdrc.json` is a pending change the initial state
|
|
88
93
|
would otherwise capture). `gtd init` refuses if the repo root already has its
|
|
89
|
-
own gtd config (a global/ancestor config, e.g. `~/.gtdrc`, does not count)
|
|
90
|
-
requires the repository root
|
|
91
|
-
|
|
92
|
-
`{"written":".gtdrc.json","workflow":"unified","prompts":[…]}`. See
|
|
94
|
+
own gtd config (a global/ancestor config, e.g. `~/.gtdrc`, does not count) and
|
|
95
|
+
requires the repository root (or a directory outside any repo). `--json` prints
|
|
96
|
+
`{"written":".gtdrc.json","inRepo":true}`. See
|
|
93
97
|
[Configuration](configuration.md#gtd-init).
|
|
94
98
|
|
|
95
99
|
## `gtd step <actor> [--cost=<n>] [--model=<name>]`
|
|
@@ -391,46 +395,6 @@ agent or human:
|
|
|
391
395
|
|
|
392
396
|
`gtd validate` takes no arguments.
|
|
393
397
|
|
|
394
|
-
## `gtd mermaid`
|
|
395
|
-
|
|
396
|
-
Pure emitter of the active workflow's **shape** — not the resolved rest — as
|
|
397
|
-
Mermaid [`stateDiagram-v2`](https://mermaid.js.org/syntax/stateDiagram.html)
|
|
398
|
-
source (see `src/Mermaid.ts`): one node per declared state, the `[*] -->`
|
|
399
|
-
initial-state marker, one edge per declared `on` row labeled with its raw
|
|
400
|
-
pattern string (same declaration order the engine itself evaluates), a `--> [*]`
|
|
401
|
-
edge for every commit state (final, no outgoing edges — see
|
|
402
|
-
[STATES.md §8](../STATES.md#8-the-squash-lifecycle)), and one `note right of`
|
|
403
|
-
per rest naming its actor, content kind, and retry cap (e.g.
|
|
404
|
-
`agent · prompt · retry 3→escalate`). No git, no HEAD resolution, no template
|
|
405
|
-
rendering — purely a function of the compiled `WorkflowDefinition`, so its
|
|
406
|
-
output is identical regardless of the current process/branch state.
|
|
407
|
-
|
|
408
|
-
```
|
|
409
|
-
$ gtd mermaid
|
|
410
|
-
stateDiagram-v2
|
|
411
|
-
state "idle" as idle
|
|
412
|
-
state "planning" as planning
|
|
413
|
-
...
|
|
414
|
-
[*] --> idle
|
|
415
|
-
idle --> planning : * **
|
|
416
|
-
...
|
|
417
|
-
note right of idle : human · message
|
|
418
|
-
...
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
Pipe it straight into a `.md`/`.mmd` file, a GitHub issue/PR description, or any
|
|
422
|
-
Mermaid-aware renderer (GitHub, GitLab, VS Code, Obsidian, the
|
|
423
|
-
[Mermaid Live Editor](https://mermaid.live)) to get a diagram of a custom
|
|
424
|
-
`.gtdrc` `workflow:` with no hand-maintained docs required.
|
|
425
|
-
|
|
426
|
-
State names are aliased to Mermaid-safe identifiers (non-word characters fold to
|
|
427
|
-
`_`; a digit-led name gets an `s_` prefix) via a `state "<name>" as <alias>`
|
|
428
|
-
declaration up front, so a hyphenated name like `plan-review` still displays
|
|
429
|
-
with its exact declared spelling. Rejects `--json` (exit 1,
|
|
430
|
-
`gtd mermaid does not accept --json`) — there is no structured shape to emit
|
|
431
|
-
beyond the Mermaid source itself — and takes no arguments (extra positional args
|
|
432
|
-
are rejected).
|
|
433
|
-
|
|
434
398
|
## `gtd lsp`
|
|
435
399
|
|
|
436
400
|
Starts an LSP server over stdio for `.gtd/` steering files — document symbols
|
|
@@ -460,11 +424,44 @@ naming the state instead — bind it to an editor keybinding for a "jump to the
|
|
|
460
424
|
active steering file" command.
|
|
461
425
|
|
|
462
426
|
Dispatched before the repository-root guard and the config-reading path — the
|
|
463
|
-
server needs no git/workflow state of its own (like `gtd init`, it
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
427
|
+
server needs no git/workflow state of its own (like `gtd init`, it needs no
|
|
428
|
+
config to run). Rejects `--json` (exit 1, `gtd lsp does not accept --json`) and
|
|
429
|
+
extra positional arguments — it's a long-running server, not a state command.
|
|
430
|
+
Runs until the client disconnects (the LSP `exit` notification), then exits
|
|
431
|
+
cleanly.
|
|
432
|
+
|
|
433
|
+
## `gtd visualize [--port=<n>] [--no-open] [--json]`
|
|
434
|
+
|
|
435
|
+
Serve an interactive diagram of the ACTIVE workflow on a local web server: the
|
|
436
|
+
main flow as a graph (one box per sub-machine), and a click-through inspector
|
|
437
|
+
with each state's actor, content kind, model/memory, steering file+mode, retry,
|
|
438
|
+
flags, and outgoing/incoming edges. This is the replacement for the removed
|
|
439
|
+
`gtd mermaid` — a live viewer instead of a static diagram dump.
|
|
440
|
+
|
|
441
|
+
```
|
|
442
|
+
$ gtd visualize
|
|
443
|
+
gtd visualize running at http://127.0.0.1:53017 — Ctrl-C to stop
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
The server serves two routes: `/` (the self-contained HTML page) and
|
|
447
|
+
`/workflow.json` (the model the page renders). It runs until interrupted
|
|
448
|
+
(Ctrl-C), then closes cleanly. Options (orthogonal, `gtd visualize` only):
|
|
449
|
+
|
|
450
|
+
- `--port=<n>` (or `--port <n>`) — serve on a specific port (0–65535); the
|
|
451
|
+
default is a free ephemeral port, printed on start.
|
|
452
|
+
- `--no-open` — do not open the default browser (the URL is always printed).
|
|
453
|
+
- `--json` — print the workflow model to stdout and exit WITHOUT starting a
|
|
454
|
+
server. The model is `{ states, initial, groups, vars }`; each state carries
|
|
455
|
+
its `actor`/`kind`/`model`/`memory`/`file`/`mode`/`retry`/`flags`, its `on`
|
|
456
|
+
edges, its computed `incoming` edges, and its sub-machine `group`. `groups`
|
|
457
|
+
lists each sub-machine invocation and the concrete states it produced.
|
|
458
|
+
|
|
459
|
+
Dispatched before the repository-root guard and the config-reading path's review
|
|
460
|
+
window — it reads the active workflow (the built-in default when none is
|
|
461
|
+
configured) but touches no git/HEAD/review-window state. The diagram is rendered
|
|
462
|
+
with Mermaid loaded from a CDN, so the graph needs network access the first time
|
|
463
|
+
a browser loads the page; the inspector works offline regardless. Rejects
|
|
464
|
+
unknown options and unexpected positional arguments.
|
|
468
465
|
|
|
469
466
|
## Error envelope
|
|
470
467
|
|
|
@@ -493,8 +490,8 @@ the plain-text one.
|
|
|
493
490
|
green run, and the check's `"C"` pattern never fires. Gitignore every path
|
|
494
491
|
your scripts write before wiring gtd into a repo.
|
|
495
492
|
- **Repository root invocation.** Every state subcommand (`step`/`review`/
|
|
496
|
-
`next`/`status
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
`
|
|
500
|
-
|
|
493
|
+
`next`/`status`) must run from the git repository root — the workflow, pending
|
|
494
|
+
changes, and process history are resolved against the process cwd.
|
|
495
|
+
`--help`/`--version` (and the `help`/`version` subcommands), `lsp`, and
|
|
496
|
+
`visualize` skip this guard entirely (`visualize` still reads the `.gtdrc`
|
|
497
|
+
workflow, but needs no git state).
|
package/docs/configuration.md
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
# Configuration
|
|
2
2
|
|
|
3
|
-
gtd reads
|
|
4
|
-
[cosmiconfig](https://github.com/cosmiconfig/cosmiconfig). gtd ships
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
`
|
|
9
|
-
(
|
|
3
|
+
gtd reads an optional `.gtdrc` config file via
|
|
4
|
+
[cosmiconfig](https://github.com/cosmiconfig/cosmiconfig). gtd ships the bundled
|
|
5
|
+
**unified** workflow as its **built-in default**: with no `workflow:` configured
|
|
6
|
+
anywhere in the cwd→home config chain, that default is used automatically, so a
|
|
7
|
+
state command works out of the box with no config at all.
|
|
8
|
+
[`gtd init`](#gtd-init) is optional — it seeds a minimal `.gtdrc.json` with the
|
|
9
|
+
two things most projects tune (a `testCommand` var and a Prettier formatting
|
|
10
|
+
suggestion), not the workflow. To CUSTOMIZE the machine itself, add your own
|
|
11
|
+
[`workflow:`](#the-workflow-key) key. Supported filenames (searched in this
|
|
12
|
+
order):
|
|
10
13
|
|
|
11
14
|
- `.gtdrc`
|
|
12
15
|
- `.gtdrc.json`
|
|
@@ -19,10 +22,11 @@ prompts as editable Markdown under `gtd-prompts/`). A state command run with no
|
|
|
19
22
|
|
|
20
23
|
v3's `.gtdrc` has exactly three blessed top-level keys:
|
|
21
24
|
|
|
22
|
-
- **`workflow`** (object,
|
|
23
|
-
|
|
24
|
-
`src/PatternConfig.ts`. Absent =
|
|
25
|
-
|
|
25
|
+
- **`workflow`** (object, optional) — the whole machine definition (its states,
|
|
26
|
+
plus its own `vars:` defaults and `modes:`), compiled by
|
|
27
|
+
`src/PatternConfig.ts`. Absent = gtd's built-in default (the bundled unified
|
|
28
|
+
workflow) is used. Declare it to fully REPLACE that default with your own
|
|
29
|
+
machine (there is no `extends`/merge). See
|
|
26
30
|
["The `workflow:` key" below](#the-workflow-key) for its schema.
|
|
27
31
|
- **`vars`** (object, optional) — a flat `name -> scalar` map, one layer of the
|
|
28
32
|
merged `it.vars` every template sees — see ["Variables"](#variables) below.
|
|
@@ -52,11 +56,12 @@ interprets.
|
|
|
52
56
|
> verify a change compiles. This section is the exhaustive schema reference
|
|
53
57
|
> behind it.
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
no merge-over-a-built-in. The
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
A declared `workflow:` key fully REPLACES gtd's built-in default — there is no
|
|
60
|
+
`extends`, no merge-over-a-built-in. The built-in default is itself a YAML asset
|
|
61
|
+
(`src/workflows/unified.yaml`) compiled through the exact same compiler
|
|
62
|
+
(`compileWorkflowConfig`) your own `workflow:` value goes through — no
|
|
63
|
+
privileged code path — so you can materialize it into config form as a starting
|
|
64
|
+
point to edit (`renderInitConfig` in `src/workflows/templates.ts`). Its shape:
|
|
60
65
|
|
|
61
66
|
```yaml
|
|
62
67
|
workflow:
|
|
@@ -107,8 +112,8 @@ root, discovers the parent `.gtdrc` by walking up the directory chain (see
|
|
|
107
112
|
level's `./`-relative references against that level's own directory. When
|
|
108
113
|
workflows are layered across levels, every reference resolves against the file
|
|
109
114
|
that wrote it, so a parent's `./gtd-prompts/x.md` and a child's never collide.
|
|
110
|
-
|
|
111
|
-
|
|
115
|
+
(This is a capability of a `.gtdrc` you write yourself — `gtd init` seeds only
|
|
116
|
+
`vars:`/`modes:`, not a `workflow:` with file references.)
|
|
112
117
|
|
|
113
118
|
```yaml
|
|
114
119
|
workflow:
|
|
@@ -380,16 +385,17 @@ So for a state declaring `mode: qa`:
|
|
|
380
385
|
| both | its `format:` | its `validate:` |
|
|
381
386
|
|
|
382
387
|
That is what makes the built-in modes extensible rather than all-or-nothing —
|
|
383
|
-
and the top-level key means a project can plug its formatter into the
|
|
384
|
-
|
|
385
|
-
itself. **`gtd init` seeds exactly this block by default** (the
|
|
386
|
-
suggestion below), so a fresh repo already formats its steering files —
|
|
387
|
-
drop it to taste. It
|
|
388
|
+
and the top-level key means a project can plug its formatter into the built-in
|
|
389
|
+
default workflow (or its own) without re-declaring a `modes:` block on the
|
|
390
|
+
workflow itself. **`gtd init` seeds exactly this block by default** (the
|
|
391
|
+
Prettier suggestion below), so a fresh repo already formats its steering files —
|
|
392
|
+
edit or drop it to taste. It is what a scaffolded `.gtdrc.json` contains
|
|
393
|
+
(`gtd init` writes no `workflow:` key — the built-in default is used):
|
|
388
394
|
|
|
389
395
|
```jsonc
|
|
390
|
-
// .gtdrc.json —
|
|
396
|
+
// .gtdrc.json — as scaffolded by `gtd init`: a testCommand var and the markdown formatter
|
|
391
397
|
{
|
|
392
|
-
"
|
|
398
|
+
"vars": { "testCommand": "npm test" },
|
|
393
399
|
"modes": {
|
|
394
400
|
"qa": { "format": "npx prettier --write <%= it.file %>" },
|
|
395
401
|
"review": { "format": "npx prettier --write <%= it.file %>" },
|
|
@@ -582,6 +588,71 @@ done:
|
|
|
582
588
|
command), and gtd never interprets the number's unit (tokens, cents, whatever
|
|
583
589
|
the driver records) or the model name — it only records, sums, and groups them.
|
|
584
590
|
|
|
591
|
+
## Sub-machines (`submachines:` / `use:`)
|
|
592
|
+
|
|
593
|
+
Two OPTIONAL top-level keys let you factor repeated or complex clusters of
|
|
594
|
+
states into reusable **sub-machines** that are expanded into ordinary concrete
|
|
595
|
+
states at load time (see [STATES.md §13](../STATES.md) and
|
|
596
|
+
`src/Submachines.ts`). They add NO runtime behavior — the engine only ever sees
|
|
597
|
+
the expanded states — so a workflow authored with them is exactly a workflow
|
|
598
|
+
written flat.
|
|
599
|
+
|
|
600
|
+
```yaml
|
|
601
|
+
workflow:
|
|
602
|
+
submachines:
|
|
603
|
+
gate: # authored once
|
|
604
|
+
params: [onGreen] # names referenced as `$onGreen` below
|
|
605
|
+
states:
|
|
606
|
+
check:
|
|
607
|
+
actor: check
|
|
608
|
+
script: <%~ it.vars.testCommand %>
|
|
609
|
+
on:
|
|
610
|
+
"A .gtd/FEEDBACK.md": blocked # a local state -> renamed by `as:`
|
|
611
|
+
"C": "$onGreen" # a param -> bound by `with:`
|
|
612
|
+
blocked:
|
|
613
|
+
actor: human
|
|
614
|
+
file: <%= it.vars.feedbackFile %>
|
|
615
|
+
message: "fix the baseline"
|
|
616
|
+
on: { "* **": check }
|
|
617
|
+
use:
|
|
618
|
+
- submachine: gate
|
|
619
|
+
as: { check: start-check, blocked: start-blocked } # local -> concrete (omit for identity)
|
|
620
|
+
with: { onGreen: planning } # bind each `$param`
|
|
621
|
+
set: { check: { reviewEntry: true } } # optional extra fields on a renamed state
|
|
622
|
+
states:
|
|
623
|
+
idle:
|
|
624
|
+
{ actor: human, initial: true, message: "…", on: { "* **": start-check } }
|
|
625
|
+
planning: { actor: agent, prompt: "…", on: { "* **": start-check } }
|
|
626
|
+
```
|
|
627
|
+
|
|
628
|
+
Rules:
|
|
629
|
+
|
|
630
|
+
- **`submachines: { <name>: { params, states } }`** — `states` are ordinary
|
|
631
|
+
state definitions, except an `on`/`retry.otherwise` target or any whole field
|
|
632
|
+
value may be a `$param` placeholder.
|
|
633
|
+
- **`use:`** is an ordered list. Each entry names a `submachine:` and may set:
|
|
634
|
+
- **`as:`** — a `local -> concreteName` rename map. Omit it (or a given local)
|
|
635
|
+
for identity. Alias to the names a flat workflow would use to keep history
|
|
636
|
+
and `git log` unchanged.
|
|
637
|
+
- **`with:`** — bindings for the sub-machine's `$param`s.
|
|
638
|
+
- **`set:`** — extra fields merged onto a renamed state (e.g. `reviewEntry`).
|
|
639
|
+
- **Substitution is WHOLE-VALUE only.** `$name` resolves only when it is the
|
|
640
|
+
entire value of a field or target — never a substring — so bash `$x`/`${x}`
|
|
641
|
+
and Eta `<%= it.vars.x %>` inside content are untouched. Pass per-instance
|
|
642
|
+
text (a whole message/prompt/`describe`) as a whole `$name` binding.
|
|
643
|
+
- A target naming one of the sub-machine's own locals is rewritten via `as:`;
|
|
644
|
+
any other target passes through verbatim (a concrete top-level state). `on`
|
|
645
|
+
PATTERN keys are never substituted.
|
|
646
|
+
- Expansion strips `submachines:`/`use:`; the merged `states` are then compiled
|
|
647
|
+
and `validateDefinition`'d normally. Unknown sub-machine, unbound `$param`,
|
|
648
|
+
and generated-name collisions are load-time errors, aggregated with the rest.
|
|
649
|
+
|
|
650
|
+
`gtd init` scaffolds the EXPANDED flat config, so a fresh project never sees
|
|
651
|
+
`submachines:`/`use:` unless it adds them itself. The bundled template is
|
|
652
|
+
authored with them (dedup: `assertGreen`/`makeGreen`/`qaLoop`; comprehension:
|
|
653
|
+
`planLoop`/`humanReview`/`specGate`/`packageLoop`) and its golden test pins that
|
|
654
|
+
expansion is byte-identical to the flat form.
|
|
655
|
+
|
|
585
656
|
## Variables
|
|
586
657
|
|
|
587
658
|
Every template — `script`/`prompt`/`message`/`commit`, and `model`/`memory`/
|
|
@@ -702,24 +773,21 @@ can still override with its own `.gtdrc`.
|
|
|
702
773
|
|
|
703
774
|
## `gtd init`
|
|
704
775
|
|
|
705
|
-
gtd ships
|
|
706
|
-
command works
|
|
776
|
+
gtd ships the bundled unified workflow as its **built-in default**, so a state
|
|
777
|
+
command works out of the box with **no** config and no init at all. `gtd init`
|
|
778
|
+
is therefore optional — it just seeds the two things most projects tune:
|
|
707
779
|
|
|
708
780
|
```bash
|
|
709
781
|
gtd init # takes no argument
|
|
710
782
|
```
|
|
711
783
|
|
|
712
|
-
`gtd init` writes a `.gtdrc.json` at the repository root
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
[file reference](#content-values-inline-or-a-file-reference) — gtd inlines it at
|
|
720
|
-
load time, so a prompt is editable Markdown and editing it changes the workflow
|
|
721
|
-
with no config edit. Human `message:` blocks and check `script:` bodies stay
|
|
722
|
-
inline in the config (they are workflow mechanics, not prompts).
|
|
784
|
+
`gtd init` writes a **minimal** `.gtdrc.json` at the repository root — a
|
|
785
|
+
`$schema` link (so editors pick up completion/validation), a
|
|
786
|
+
`vars: { "testCommand": "npm test" }` entry (the var the built-in workflow's
|
|
787
|
+
check script reads), and a ready-to-edit `modes:` formatting suggestion (below).
|
|
788
|
+
It writes **no** `workflow:` key — the built-in default is used until you
|
|
789
|
+
declare your own. It takes **no argument** — passing one is a usage error
|
|
790
|
+
(`gtd init: too many arguments — init takes no argument`).
|
|
723
791
|
|
|
724
792
|
`gtd init` writes only config — it derives no git state — so it need not run in
|
|
725
793
|
a git repository. It runs at a **repository root** or in a directory **outside
|
|
@@ -731,9 +799,9 @@ only to write into a repository **subdirectory**, where the upward config walk
|
|
|
731
799
|
would never find the file. Either way, it will not overwrite an existing config
|
|
732
800
|
at that directory (remove it first to re-scaffold).
|
|
733
801
|
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
802
|
+
The [`modes:`](#modes--pluggable-steering-file-modes) block it seeds is a
|
|
803
|
+
ready-to-edit suggestion — a Prettier `format:` for each built-in steering-file
|
|
804
|
+
mode the default workflow uses:
|
|
737
805
|
|
|
738
806
|
```jsonc
|
|
739
807
|
"modes": {
|
|
@@ -748,8 +816,8 @@ this is the one default it suggests: a fresh repo auto-formats its steering
|
|
|
748
816
|
files out of the box, and you edit or drop the block freely (swap Prettier for
|
|
749
817
|
dprint, point at a script, or delete the key).
|
|
750
818
|
|
|
751
|
-
The
|
|
752
|
-
(all walked through in
|
|
819
|
+
The built-in default workflow has three entry points into a shared review/squash
|
|
820
|
+
tail (all walked through in
|
|
753
821
|
[STATES.md §10](../STATES.md#10-the-bundled-workflow-templates)):
|
|
754
822
|
|
|
755
823
|
- **the simple flow** — creating `.gtd/TODO.md` starts idle → planning ⇄
|
|
@@ -763,20 +831,15 @@ The one bundled template has three entry points into a shared review/squash tail
|
|
|
763
831
|
review a foreign branch.
|
|
764
832
|
|
|
765
833
|
Both file-created flows converge on `reviewing` → `await-review`, and a full
|
|
766
|
-
sign-off squashes the whole cycle into one commit.
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
fails with:
|
|
776
|
-
|
|
777
|
-
```
|
|
778
|
-
gtd: no workflow configured — run `gtd init` to create .gtdrc.json
|
|
779
|
-
```
|
|
834
|
+
sign-off squashes the whole cycle into one commit. To CUSTOMIZE any of this, add
|
|
835
|
+
a [`workflow:`](#the-workflow-key) key that fully replaces the default.
|
|
836
|
+
|
|
837
|
+
The file is written **uncommitted** — review it, then commit `.gtdrc.json`
|
|
838
|
+
before your first `gtd step` (an uncommitted file is a pending change the
|
|
839
|
+
initial state's `* **` edge would otherwise capture). `gtd init` refuses if the
|
|
840
|
+
repo root already has its OWN gtd config (remove it first to re-init; a
|
|
841
|
+
global/ancestor config such as `~/.gtdrc` does not count) and requires the
|
|
842
|
+
repository root (or a directory outside any repo).
|
|
780
843
|
|
|
781
844
|
## A complete example
|
|
782
845
|
|
package/docs/development.md
CHANGED
|
@@ -31,7 +31,8 @@ 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 template (`src/workflows/unified.yaml`)
|
|
34
|
+
bundled workflow template (`src/workflows/unified.yaml`) gtd runs as its
|
|
35
|
+
built-in default (and materializes into config form via `renderInitConfig`) is
|
|
35
36
|
imported as raw text via tsdown's `.yaml`-as-text loader (`tsdown.config.ts`)
|
|
36
37
|
and compiled through the same path a `.gtdrc` `workflow:` key goes through
|
|
37
38
|
(`src/workflows/templates.ts`) — no privileged code path.
|
package/docs/upgrading.md
CHANGED
|
@@ -80,8 +80,14 @@ upgrading.
|
|
|
80
80
|
existing review/feedback machinery unmodified — see
|
|
81
81
|
[STATES.md §11](../STATES.md#11-the-review-checkout-window) and
|
|
82
82
|
[CLI reference](cli.md#gtd-review-commitish---json). The current command
|
|
83
|
-
surface is `init` / `step` / `next` / `status` / `validate` / `
|
|
84
|
-
`
|
|
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.
|
|
85
91
|
|
|
86
92
|
- **`gtd format <file>`, and the bundled prettier with it.** gtd no longer
|
|
87
93
|
formats anything on its own: a steering-file mode declares its own `format:`
|
|
@@ -122,29 +128,25 @@ upgrading.
|
|
|
122
128
|
|
|
123
129
|
## How to adopt
|
|
124
130
|
|
|
125
|
-
`workflow:` is
|
|
126
|
-
upgrading
|
|
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:
|
|
127
145
|
|
|
128
146
|
```bash
|
|
129
|
-
gtd init #
|
|
147
|
+
gtd init # optional — seeds testCommand + a formatting suggestion
|
|
130
148
|
```
|
|
131
149
|
|
|
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 `planning` ⇄ `plan-review`
|
|
136
|
-
plan-iteration loop, 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
|
-
commit the generated `.gtdrc.json` (and its `gtd-prompts/` directory), then
|
|
144
|
-
continue from a settled `idle` boundary. **Note:** a repo relying on earlier
|
|
145
|
-
gtd's auto-created `.gtdrc.json` `$schema` stub (which carried no `workflow:`)
|
|
146
|
-
will now fail until you `gtd init` — the stub alone is no longer enough.
|
|
147
|
-
|
|
148
150
|
A repo that customized v2's `workflow:` key (actors, gates, guard vocabulary,
|
|
149
151
|
ladders) needs to rewrite it from scratch in the v3 schema — see
|
|
150
152
|
[Configuration](configuration.md) for the schema and a complete worked example.
|