@pmelab/gtd 9.14.0 → 10.0.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.
Files changed (3) hide show
  1. package/README.md +94 -87
  2. package/dist/gtd.bundle.mjs +113 -448
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -37,12 +37,12 @@ for you. Ask your agent if you have any questions.
37
37
  - **Shareable.** Push the branch, and the workflow travels with it — the state
38
38
  lives in the commits, so another machine (or another person) picks up exactly
39
39
  where you left off.
40
- - **Files, not chat.** Plans live in `.gtd/` steering files (`REQUIREMENTS.md`,
40
+ - **Files, not chat.** Conversation lives in files like `REQUIREMENTS.md` or
41
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 to lose.
42
+ tree clean — all in your own editor. There is no chat UI that could flicker.
43
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 — the workflow doesn't care
45
- who executes it.
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
46
 
47
47
  See [gtd --help](https://github.com/pmelab/gtd/blob/main/docs/cli.md) for the
48
48
  full command/flag reference, and
@@ -70,20 +70,22 @@ gtd next
70
70
  No active gtd process.
71
71
 
72
72
  To start one, make ANY change — a hand-edit to real code, a scratch note,
73
- anything at all. .gtd/TODO.md is a good default place to start sketching.
73
+ anything at all. TODO.md is a good default place to start sketching.
74
74
  ```
75
75
 
76
76
  This means its your turn. Add a `TODO.md` file with a detailed, well articulated
77
77
  idea:
78
78
 
79
79
  ```bash
80
- mkdir -p .gtd
81
80
  echo "Make a billion dollar SaaS. Make no mistakes." > TODO.md
82
81
  ```
83
82
 
84
- Ask again, and the header now reports what gtd sees:
83
+ Ask again, and gtd leads with what to do, then reports what it sees:
85
84
 
86
85
  ```
86
+ The edit is already made — run `gtd land` to land it.
87
+ State: idle
88
+ Awaits: human
87
89
  Pending:
88
90
  A TODO.md -> * **
89
91
  Next: Start → unwind
@@ -95,16 +97,27 @@ the source tree control what is going to happen next.
95
97
 
96
98
  ### Beat 2 — `gtd land` records it as a commit
97
99
 
98
- `gtd land` prints a shell script and deliberately does not run it. Read it, then
99
- pipe it:
100
+ `gtd land` tells you, in one line, exactly what it would do:
100
101
 
101
102
  ```bash
102
- gtd land | sh
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 spells out the
112
+ exact message and reports what landed:
113
+
114
+ ```bash
115
+ gtd land --json=script | sh
103
116
  ```
104
117
 
105
118
  ```
106
119
  -> idle → unwind
107
- .gtd/TODO.md
120
+ TODO.md
108
121
  ```
109
122
 
110
123
  ```bash
@@ -123,25 +136,28 @@ gtd next
123
136
  ```
124
137
 
125
138
  ```
139
+ Run this script:
126
140
  State: unwind
127
141
  Awaits: check
128
142
  Label: Unwinding your input
129
143
 
130
144
  #!/usr/bin/env sh
131
145
  ...
132
- git revert --no-commit "$commit"
146
+ git revert --no-commit "$commit" 2> .gtd/.unwind-error
133
147
  ```
134
148
 
135
149
  `Awaits: check` means this beat is not yours: it is a script. gtd never runs
136
150
  anything itself, so run it and land it exactly as before:
137
151
 
138
152
  ```bash
139
- eval "$(gtd next --sh)"; sh -c "$gtd_content"
140
- gtd land | sh
153
+ sh -c "$(gtd next --json=content)"
154
+ gtd land --json=script | sh
141
155
  ```
142
156
 
143
- Plain `gtd next` prints that human-readable header, so it is not pipeable into
144
- `sh` — the runnable bytes come from `--sh` or `--json`.
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.
145
161
 
146
162
  Keep going and the beats keep arriving. The next one checks that your test
147
163
  baseline is green:
@@ -170,76 +186,70 @@ This file is a deliverable, not a chat reply — size follows the work, and
170
186
  padding is the target of any cut. Lead with the answer immediately; never ...
171
187
  ```
172
188
 
173
- That is the prompt itself — those bytes are an agent's input, so gtd prints
174
- nothing around them. Ask for structure when you want to know whose turn it is:
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:
175
192
 
176
193
  ```bash
177
- eval "$(gtd next --sh)"
178
- printf '%s / %s / %s\n' "$gtd_kind" "$gtd_state" "$gtd_file"
194
+ gtd next --json=kind # prompt
195
+ gtd next --json=state # design.triage
196
+ gtd next --json=file # .gtd/REQUIREMENTS.md
179
197
  ```
180
198
 
181
- ```
182
- prompt / design.triage / .gtd/REQUIREMENTS.md
183
- ```
184
-
185
- Now hand it over.
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:
186
203
 
187
204
  ```bash
188
- printf '%s' "$gtd_content" | claude -p --session-id "$gtd_session_id" \
189
- --model "$gtd_model" --dangerously-skip-permissions
205
+ gtd next | claude -p --dangerously-skip-permissions
190
206
  ```
191
207
 
192
- Two of those variables are worth understanding:
193
-
194
- - **`$gtd_session_id`** is derived from your history, never stored, so the same
195
- part of the workflow always resumes the same conversation — across restarts,
196
- and even on another machine that checks out the branch. Because it is derived
197
- rather than remembered, treat `$gtd_session_resume` as a hint: try the flag it
198
- points at, and fall back to the other one if the agent rejects it.
199
- - **`$gtd_model`** is an opaque hint the workflow declared (`smart` and `base`
200
- in the bundled one). gtd never interprets it — you map it onto whatever your
201
- agent calls that tier.
208
+ Reading a value twice is free: **`gtd next` never mutates**, so a peek and a
209
+ dispatch are the same call.
202
210
 
203
- The agent writes `.gtd/REQUIREMENTS.md`, and that file is the turn. Land it like
204
- any other beat:
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:
205
213
 
206
214
  ```bash
207
- gtd land | sh
215
+ gtd land --json=script | sh
208
216
  ```
209
217
 
210
- `$gtd_validate` is there if you want to check the agent's work first: a
211
- ready-to-run script that validates the file the prompt asked for and prints a
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
212
220
  complete fix prompt on failure, ready to pipe straight back into the same
213
221
  session.
214
222
 
215
223
  ### Then automate the beats
216
224
 
217
- That was not very convenient. Running this manually doesn't make us faster. But
218
- it is easy to put it into a loop:
225
+ That was not very convenient. But it is easy to put it into a loop. Way more
226
+ convenient!
219
227
 
220
228
  ```bash
221
229
  while :; do
222
- out="$(gtd next --sh)"
223
- eval "$out"
224
- case "$gtd_kind" in
225
- script) sh -c "$gtd_content" ;;
226
- prompt) printf '%s' "$gtd_content" | your-agent ;;
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 ;;
227
239
  esac
228
- gtd land | sh
240
+ gtd land --json=script | sh
229
241
  done
230
242
  ```
231
243
 
232
- gtd itself never executes anything — the driver owns running scripts, and every
233
- `gtd next` call is strictly mutation-free, safe to poll or peek at any time. See
244
+ This is a very basic implementation, but there are a lot of options to integrate
245
+ this with your environment. See
234
246
  [Driving the loop](https://github.com/pmelab/gtd/blob/main/docs/driver.md) for
235
- the full protocol, including the `message`/`capture` gates, the stalled case,
236
- and refusal handling — a real driver captures `gtd land --sh` and pipes its
237
- `$gtd_script`, because a refusal exits non-zero with an empty script that `| sh`
238
- would swallow.
247
+ the full protocol.
239
248
 
240
249
  ### Then let an agent build your own
241
250
 
242
- Paste this into your coding agent:
251
+ But lets be honest, who reads documentation these days. Paste this into your
252
+ coding agent:
243
253
 
244
254
  ```
245
255
  !gtd install
@@ -257,42 +267,39 @@ write there is the first sketch the whole process gets planned from.
257
267
 
258
268
  ### The workflow it ships with
259
269
 
260
- Those beats all come from one built-in workflow. It is data, not code — a
261
- `.gtdrc` `workflow:` key replaces it wholesale. Condensed:
262
-
263
- 1. **idle** (you) — change anything. gtd treats it as a _sketch_, not as work.
264
- 2. **unwind** (script) — reverts your sketch back out of the tree; its intent
265
- survives in history for the next step to read.
266
- 3. **start-gate** (script) — the suite must be green before new work starts. Red
267
- routes to you, with the failing output in `.gtd/FEEDBACK.md`.
268
- 4. **design** (agent, then you) — triages the reverted diff into
269
- `.gtd/REQUIREMENTS.md`. Open product questions come back for you to answer
270
- inline in that file.
271
- 5. **architecture** (agent, then you) — turns it into `.gtd/ARCHITECTURE.md`,
272
- asks technical questions the same way, then decomposes the work into one
273
- package per concern under `.gtd/packages/`.
274
- 6. **packages** (agent, looped) — per package: build, run the checks, fix what
275
- is red, review it against its own package file, close it out. Repeats until
276
- no package is left.
277
- 7. **review** (agent, then you) — an agent writes `.gtd/REVIEW.md`; you tick its
278
- boxes or write feedback into it. A clean sign-off ends the process; feedback
279
- re-enters at step 2.
280
- 8. **idle** — done, and HEAD is a linear history of every turn that got you
281
- there.
282
-
283
- Two side doors skip the front of that list. `gtd --entry fix-precheck` repairs a
284
- red baseline as its own reviewed commit instead of starting a process. And
270
+ One built-in workflow drives all of that. From where you sit, it has four
271
+ moments — everything between them runs without you.
272
+
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.
284
+
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
285
292
 
286
293
  ```bash
287
294
  gtd --entry review-gate.check --var reviewBase=<commitish>
288
295
  ```
289
296
 
290
- starts a pure review: it enters at step 7 with no planning or building at all,
291
- reviewing everything from `<commitish>` to HEAD. Sign-off ends it; feedback
292
- re-enters at step 2 as a full re-plan lap.
297
+ starts a pure review of everything from `<commitish>` to HEAD — straight to step
298
+ 4, no planning and no building.
293
299
 
294
- Every numbered step above is just beats. `gtd next` prints one, you or an agent
295
- do it, `gtd land` commits it — all the way down.
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).
296
303
 
297
304
  ## License
298
305