@pmelab/gtd 9.13.0 → 9.14.1

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 CHANGED
@@ -1,7 +1,9 @@
1
1
  # gi[t]hings.**done**
2
2
 
3
- > „Fix all the tests." „✅ All tests pass!" „The E2E suite is red." „Ah, you
4
- > mean _those_ tests."
3
+ 🤓: „Fix all the tests."
4
+ 🤖: „✅ All tests pass!"
5
+ 😡: „The E2E suite is red."
6
+ 🤖: „Ah, you mean _those_ tests."
5
7
 
6
8
  **Chat is a terrible source of truth. Git isn't.**
7
9
 
@@ -21,9 +23,233 @@ Or run without installing (prefix every `gtd` below with `npx`) — see
21
23
  [Configuration](https://github.com/pmelab/gtd/blob/main/docs/configuration.md)
22
24
  for the settings most projects tune.
23
25
 
24
- ## First run
26
+ ## Quick start
25
27
 
26
- Paste this into your coding agent:
28
+ Pipe the output of `gtd install` into your coding agent and answer its
29
+ questions. It should build you a script that will autonomously run the process
30
+ for you. Ask your agent if you have any questions.
31
+
32
+ ## Why
33
+
34
+ - **Durable & replayable.** The workflow state _is_ your git history — a pure
35
+ fold over commit subjects and the working tree. Kill the session, reboot, come
36
+ back next week: run the driver and it resumes exactly where it stopped.
37
+ - **Shareable.** Push the branch, and the workflow travels with it — the state
38
+ lives in the commits, so another machine (or another person) picks up exactly
39
+ where you left off.
40
+ - **Files, not chat.** Conversation lives in files like `REQUIREMENTS.md` or
41
+ `ARCHITECTURE.md`. Request changes by editing them, approve by leaving the
42
+ tree clean — all in your own editor. There is no chat UI that could flicker.
43
+ - **Harness agnostic.** gtd emits prompts to stdout (or JSON). Claude Code, a
44
+ bash loop, a CI job, or you reading it out loud to your sentient cat — the
45
+ workflow doesn't care who executes it.
46
+
47
+ See [gtd --help](https://github.com/pmelab/gtd/blob/main/docs/cli.md) for the
48
+ full command/flag reference, and
49
+ [Configuration](https://github.com/pmelab/gtd/blob/main/docs/configuration.md)
50
+ for how to inspect or replace the workflow itself.
51
+
52
+ ## Basic concept
53
+
54
+ Two commands make up the whole cycle. **`gtd next` says what to do now.
55
+ `gtd land` records that it is done — as a commit.** Everything else follows from
56
+ that.
57
+
58
+ The fastest way to understand it is to drive a few beats by hand. Any git
59
+ repository with at least one commit will do — the first two beats need no setup
60
+ at all, and `gtd init` seeds the one setting that matters later (your test
61
+ command).
62
+
63
+ ### Beat 1 — `gtd next` says whose turn it is
64
+
65
+ ```bash
66
+ gtd next
67
+ ```
68
+
69
+ ```
70
+ No active gtd process.
71
+
72
+ To start one, make ANY change — a hand-edit to real code, a scratch note,
73
+ anything at all. TODO.md is a good default place to start sketching.
74
+ ```
75
+
76
+ This means its your turn. Add a `TODO.md` file with a detailed, well articulated
77
+ idea:
78
+
79
+ ```bash
80
+ echo "Make a billion dollar SaaS. Make no mistakes." > TODO.md
81
+ ```
82
+
83
+ Ask again, and gtd leads with what to do, then reports what it sees:
84
+
85
+ ```
86
+ The edit is already made — run `gtd land` to land it.
87
+ State: idle
88
+ Awaits: human
89
+ Pending:
90
+ A TODO.md -> * **
91
+ Next: Start → unwind
92
+ ```
93
+
94
+ Your change matched the pattern `* **`, which routes to the `unwind` state. For
95
+ the moment its not important what that is. Important is the fact that changes to
96
+ the source tree control what is going to happen next.
97
+
98
+ ### Beat 2 — `gtd land` records it as a commit
99
+
100
+ `gtd land` tells you, in one line, exactly what it would do:
101
+
102
+ ```bash
103
+ gtd land
104
+ ```
105
+
106
+ ```
107
+ commit everything with this message: gtd(human): idle → unwind
108
+ (run `gtd land --json=script | sh` to get the landing script)
109
+ ```
110
+
111
+ You could run that commit by hand. Take the script instead — it adds the
112
+ precondition checks and retries you would otherwise have to remember:
113
+
114
+ ```bash
115
+ gtd land --json=script | sh
116
+ ```
117
+
118
+ ```
119
+ -> idle → unwind
120
+ TODO.md
121
+ ```
122
+
123
+ ```bash
124
+ $ git log --oneline
125
+ 0fb0300 gtd(human): idle → unwind
126
+ 75b6836 chore: initial commit
127
+ ```
128
+
129
+ One beat, one commit. That commit **is** the state — nothing is stored anywhere
130
+ else, which is why the process survives a reboot and travels with the branch.
131
+
132
+ ### Beat 3 — the same two commands, now for a machine
133
+
134
+ ```bash
135
+ gtd next
136
+ ```
137
+
138
+ ```
139
+ Run this script:
140
+ State: unwind
141
+ Awaits: check
142
+ Label: Unwinding your input
143
+
144
+ #!/usr/bin/env sh
145
+ ...
146
+ git revert --no-commit "$commit" 2> .gtd/.unwind-error
147
+ ```
148
+
149
+ `Awaits: check` means this beat is not yours: it is a script. gtd never runs
150
+ anything itself, so run it and land it exactly as before:
151
+
152
+ ```bash
153
+ sh -c "$(gtd next --json=content)"
154
+ gtd land --json=script | sh
155
+ ```
156
+
157
+ `--json=<field>` is how a script reads one value out of a beat. Bare `--json`
158
+ prints the whole document; `--json=content` prints just that field, raw, with no
159
+ quoting to strip and no `jq` to install. Plain `gtd next` is for you to read —
160
+ the leading `Run this script:` line makes it prose, not something to pipe.
161
+
162
+ Keep going and the beats keep arriving. The next one checks that your test
163
+ baseline is green:
164
+
165
+ ```
166
+ State: start-gate.check
167
+ Awaits: check
168
+ Next: C → design.triage
169
+ ```
170
+
171
+ `C` is the clean-tree pattern: the suite passed, nothing changed, so move on to
172
+ triage. A red suite instead writes `.gtd/FEEDBACK.md`, which matches a different
173
+ pattern and routes to `start-gate.blocked` — same two commands, different
174
+ outcome, decided entirely by what the beat left in the tree.
175
+
176
+ Land the green one, and the beat after it belongs to an agent.
177
+
178
+ ### Beat 4 — handing a beat to Claude
179
+
180
+ ```bash
181
+ gtd next | head -2
182
+ ```
183
+
184
+ ```
185
+ This file is a deliverable, not a chat reply — size follows the work, and
186
+ padding is the target of any cut. Lead with the answer immediately; never ...
187
+ ```
188
+
189
+ No header at all this time. That is the prompt itself — those bytes are the
190
+ agent's input, so gtd prints nothing around them. Selectors are how you find out
191
+ whose turn it is:
192
+
193
+ ```bash
194
+ gtd next --json=kind # prompt
195
+ gtd next --json=state # design.triage
196
+ gtd next --json=file # .gtd/REQUIREMENTS.md
197
+ ```
198
+
199
+ Now hand it over. Pipe plain `gtd next` straight in — at a prompt rest that
200
+ output already **is** the bare content, so it costs one render instead of two,
201
+ and it keeps a full diff off the command line, which is capped at 4 KB by POSIX
202
+ and around 1 MB on macOS:
203
+
204
+ ```bash
205
+ gtd next | claude -p --dangerously-skip-permissions
206
+ ```
207
+
208
+ Reading a value twice is free: **`gtd next` never mutates**, so a peek and a
209
+ dispatch are the same call.
210
+
211
+ The prompt tells the agent to asses your request and write
212
+ `.gtd/REQUIREMENTS.md`, and that file is the turn. Land it like any other beat:
213
+
214
+ ```bash
215
+ gtd land --json=script | sh
216
+ ```
217
+
218
+ `gtd next --json=validate` is there if you want to check the agent's work first:
219
+ a ready-to-run script that validates the file the prompt asked for and prints a
220
+ complete fix prompt on failure, ready to pipe straight back into the same
221
+ session.
222
+
223
+ ### Then automate the beats
224
+
225
+ That was not very convenient. But it is easy to put it into a loop. Way more
226
+ convenient!
227
+
228
+ ```bash
229
+ while :; do
230
+ case "$(gtd next --json=kind)" in
231
+ # A deterministic script to execute
232
+ script) gtd next --json=content | sh ;;
233
+ # A prompt for an agent
234
+ prompt) gtd next | claude -p --dangerously-skip-permissions ;;
235
+ # A message printed for a human
236
+ message) gtd next; exit 0 ;;
237
+ # Nothing left to do, abort.
238
+ stalled) gtd next >&2; exit 1 ;;
239
+ esac
240
+ gtd land --json=script | sh
241
+ done
242
+ ```
243
+
244
+ This is a very basic implementation, but there are a lot of options to integrate
245
+ this with your environment. See
246
+ [Driving the loop](https://github.com/pmelab/gtd/blob/main/docs/driver.md) for
247
+ the full protocol.
248
+
249
+ ### Then let an agent build your own
250
+
251
+ But lets be honest, who reads documentation these days. Paste this into your
252
+ coding agent:
27
253
 
28
254
  ```
29
255
  !gtd install
@@ -39,50 +265,41 @@ resting state declares none. That fallback is also how you begin: on a clean
39
265
  repository the edit command opens the empty `.gtd/TODO.md`, and whatever you
40
266
  write there is the first sketch the whole process gets planned from.
41
267
 
42
- Writing a driver by hand instead? See
43
- [Driving the loop](https://github.com/pmelab/gtd/blob/main/docs/driver.md) for
44
- the full protocol and a complete minimal reference implementation.
268
+ ### The workflow it ships with
45
269
 
46
- ## Why
270
+ One built-in workflow drives all of that. From where you sit, it has four
271
+ moments — everything between them runs without you.
47
272
 
48
- - **Durable & replayable.** The workflow state _is_ your git history — a pure
49
- fold over commit subjects and the working tree. Kill the session, reboot, come
50
- back next week: run the driver and it resumes exactly where it stopped.
51
- - **Shareable.** Push the branch, and the workflow travels with it — the state
52
- lives in the commits, so another machine (or another person) picks up exactly
53
- where you left off.
54
- - **Files, not chat.** Plans live in `.gtd/` steering files (`REQUIREMENTS.md`,
55
- `ARCHITECTURE.md`, the package files under `.gtd/packages/`). Request changes
56
- by editing them, approve by leaving the tree clean — all in your own editor.
57
- There is no chat UI to lose.
58
- - **Harness agnostic.** gtd emits prompts to stdout (or JSON). Claude Code, a
59
- bash loop, a CI job, or you reading it out loud — the workflow doesn't care
60
- who executes it.
273
+ 1. **You sketch.** Change anything, or write the idea into `.gtd/TODO.md`. Rough
274
+ is fine; it is treated as a sketch, not as work.
275
+ 2. **You answer questions.** Planning stops and hands you a file with its open
276
+ questions in it — what the thing should do first, then how it should be
277
+ built. Answer them in your editor, in the file, and start the loop again.
278
+ 3. **You wait.** The work is split into packages and built one at a time, each
279
+ one checked against your test suite and fixed until it passes.
280
+ 4. **You review.** You get a review document listing what changed and what to
281
+ look at. Tick the boxes to approve, or write what is wrong. Approving ends
282
+ the process; feedback sends it back to step 2 for a fresh plan — it never
283
+ patches over a design you rejected.
61
284
 
62
- The loop behind all of this is one beat, repeated:
285
+ You never talk to it. Every exchange is a file in `.gtd/` that you edit in your
286
+ own editor, and every answer you give is a commit. Your test suite is the gate
287
+ throughout: a red baseline stops the process before it starts, and a red package
288
+ is fixed before the next one begins.
289
+
290
+ Two side doors skip step 1. `gtd --entry fix-precheck` repairs a red baseline as
291
+ its own reviewed commit instead of starting a process. And
63
292
 
64
293
  ```bash
65
- while :; do
66
- out="$(gtd next --sh)"
67
- eval "$out"
68
- case "$gtd_kind" in
69
- script) sh -c "$gtd_content" ;;
70
- prompt) printf '%s' "$gtd_content" | your-agent ;;
71
- esac
72
- gtd land
73
- done
294
+ gtd --entry review-gate.check --var reviewBase=<commitish>
74
295
  ```
75
296
 
76
- gtd itself never executes anything — the driver owns running scripts, and every
77
- `gtd next` call is strictly mutation-free, safe to poll or peek at any time. See
78
- [Driving the loop](https://github.com/pmelab/gtd/blob/main/docs/driver.md) for
79
- the full protocol, including the `message`/`capture` gates and the stalled case
80
- this sketch leaves out.
297
+ starts a pure review of everything from `<commitish>` to HEAD — straight to step
298
+ 4, no planning and no building.
81
299
 
82
- See [gtd --help](https://github.com/pmelab/gtd/blob/main/docs/cli.md) for the
83
- full command/flag reference, and
84
- [Configuration](https://github.com/pmelab/gtd/blob/main/docs/configuration.md)
85
- for how to inspect or replace the workflow itself.
300
+ The workflow itself is data, not code: a `.gtdrc` `workflow:` key replaces it
301
+ wholesale. See
302
+ [Configuration](https://github.com/pmelab/gtd/blob/main/docs/configuration.md).
86
303
 
87
304
  ## License
88
305