@pmelab/gtd 58.2.0 → 59.0.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.
Files changed (150) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +120 -395
  3. package/dist/chunks/{Schema-B3o6eRNU.mjs → testkit-07Z_ENch.mjs} +13503 -3460
  4. package/dist/chunks/{wire-C12dahrH.mjs → wire-BTUhRGXj.mjs} +1 -1
  5. package/dist/flows.mjs +1 -1
  6. package/dist/gtd.bundle.mjs +484 -497
  7. package/dist/testkit/gherkin.mjs +145 -65
  8. package/dist/testkit.mjs +1 -1
  9. package/dist/wire.mjs +1 -1
  10. package/package.json +3 -42
  11. package/skills/authoring/SKILL.md +34 -27
  12. package/src/cli/Cli.test.ts +148 -71
  13. package/src/cli/Cli.ts +384 -463
  14. package/src/cli/Help.test.ts +47 -0
  15. package/src/cli/Help.ts +70 -0
  16. package/src/cli/Program.test.ts +127 -33
  17. package/src/cli/Program.ts +70 -25
  18. package/src/edge/Edge.ts +4 -4
  19. package/src/emit/Emit.test.ts +1 -1
  20. package/src/emit/Emit.ts +1 -1
  21. package/src/flags/index.test.ts +0 -13
  22. package/src/flags/index.ts +1 -3
  23. package/src/flows/factory.ts +3 -1
  24. package/src/gherkin/index.ts +135 -71
  25. package/src/gherkin/messages.test.ts +90 -0
  26. package/src/gherkin/messages.ts +84 -0
  27. package/src/install/Install.test.ts +14 -11
  28. package/src/install/Install.ts +38 -15
  29. package/src/install/index.ts +1 -2
  30. package/src/replay/Replay.test.ts +1 -1
  31. package/src/replay/index.ts +1 -1
  32. package/src/step/planStart.ts +6 -1
  33. package/src/testkit/TestRepo.test.ts +47 -2
  34. package/src/testkit/TestRepo.ts +51 -6
  35. package/src/twins/EmittedScriptRecognizer.ts +5 -8
  36. package/src/twins/FlowScripts.ts +1 -1
  37. package/src/wire/Land.ts +1 -1
  38. package/src/workflow/index.ts +1 -0
  39. package/src/workflow/load.test.ts +138 -113
  40. package/src/workflow/load.ts +7 -7
  41. package/src/workflow/skills.test.ts +5 -5
  42. package/src/workflow/skills.ts +1 -1
  43. package/src/workflow/vars.test.ts +30 -3
  44. package/src/workflow/vars.ts +34 -2
  45. package/src/workflow-kit/index.ts +1 -1
  46. package/dist/chunks/reserved-lMYCaapY.mjs +0 -1990
  47. package/dist/chunks/review-Bfaror38.mjs +0 -427
  48. package/dist/chunks/tail-Bd7L940p.mjs +0 -355
  49. package/dist/chunks/testkit-JDtpNKyi.mjs +0 -10410
  50. package/dist/workflows/cleanup.mjs +0 -36
  51. package/dist/workflows/feature.mjs +0 -1018
  52. package/dist/workflows/fix.mjs +0 -41
  53. package/dist/workflows/review.mjs +0 -45
  54. package/dist/workflows/rollout.mjs +0 -48
  55. package/dist/workflows.mjs +0 -40651
  56. package/src/install/ConfigScaffold.ts +0 -22
  57. package/src/workflows/cleanup/cleanup-path.feature +0 -94
  58. package/src/workflows/cleanup/cleanup.feature +0 -315
  59. package/src/workflows/cleanup/cleanup.test.ts +0 -276
  60. package/src/workflows/cleanup/cleanup.ts +0 -52
  61. package/src/workflows/cleanup/index.ts +0 -6
  62. package/src/workflows/feature/acceptance-criteria-tier.feature +0 -25
  63. package/src/workflows/feature/acceptance-criteria.feature +0 -389
  64. package/src/workflows/feature/criteria-coverage.feature +0 -102
  65. package/src/workflows/feature/criteria.test.ts +0 -147
  66. package/src/workflows/feature/criteria.ts +0 -267
  67. package/src/workflows/feature/fast-path.feature +0 -93
  68. package/src/workflows/feature/feature.test.ts +0 -338
  69. package/src/workflows/feature/feature.ts +0 -156
  70. package/src/workflows/feature/green.ts +0 -19
  71. package/src/workflows/feature/index.ts +0 -18
  72. package/src/workflows/feature/lens-models.feature +0 -69
  73. package/src/workflows/feature/lens-review.feature +0 -566
  74. package/src/workflows/feature/naive-acceptance.feature +0 -147
  75. package/src/workflows/feature/naive-test.feature +0 -263
  76. package/src/workflows/feature/one-step-land.feature +0 -93
  77. package/src/workflows/feature/planning.ts +0 -41
  78. package/src/workflows/feature/refactor-absorbs.feature +0 -131
  79. package/src/workflows/feature/refactor-first.feature +0 -158
  80. package/src/workflows/feature/refactor-lens-models.feature +0 -79
  81. package/src/workflows/feature/refactor-rebuild.feature +0 -273
  82. package/src/workflows/feature/refactor-review.feature +0 -1528
  83. package/src/workflows/feature/refactor.test.ts +0 -1220
  84. package/src/workflows/feature/refactor.ts +0 -368
  85. package/src/workflows/feature/release-flag.feature +0 -167
  86. package/src/workflows/feature/release-flag.test.ts +0 -49
  87. package/src/workflows/feature/release-flag.ts +0 -46
  88. package/src/workflows/feature/review-gate.feature +0 -241
  89. package/src/workflows/feature/reviewer-walkthrough.feature +0 -142
  90. package/src/workflows/feature/risk-tier.feature +0 -351
  91. package/src/workflows/feature/seam-rejection.feature +0 -146
  92. package/src/workflows/feature/seam.feature +0 -297
  93. package/src/workflows/feature/seam.test.ts +0 -527
  94. package/src/workflows/feature/seam.ts +0 -426
  95. package/src/workflows/feature/standards.feature +0 -354
  96. package/src/workflows/feature/steps.test.ts +0 -65
  97. package/src/workflows/feature/steps.ts +0 -45
  98. package/src/workflows/feature/tier-pin.feature +0 -66
  99. package/src/workflows/feature/tier.test.ts +0 -166
  100. package/src/workflows/feature/tier.ts +0 -56
  101. package/src/workflows/fix/fix-lens-origin.feature +0 -114
  102. package/src/workflows/fix/fix-quality.feature +0 -212
  103. package/src/workflows/fix/fix.feature +0 -79
  104. package/src/workflows/fix/fix.test.ts +0 -74
  105. package/src/workflows/fix/fix.ts +0 -52
  106. package/src/workflows/fix/index.ts +0 -6
  107. package/src/workflows/index.ts +0 -47
  108. package/src/workflows/review/index.ts +0 -6
  109. package/src/workflows/review/review-door.feature +0 -199
  110. package/src/workflows/review/review.test.ts +0 -27
  111. package/src/workflows/review/review.ts +0 -60
  112. package/src/workflows/rollout/index.ts +0 -6
  113. package/src/workflows/rollout/rollout.feature +0 -510
  114. package/src/workflows/rollout/rollout.test.ts +0 -263
  115. package/src/workflows/rollout/rollout.ts +0 -82
  116. package/src/workflows/shared/__fixtures__/feature-collecting-prompt.txt +0 -98
  117. package/src/workflows/shared/access.test.ts +0 -62
  118. package/src/workflows/shared/access.ts +0 -24
  119. package/src/workflows/shared/config.fixture.ts +0 -12
  120. package/src/workflows/shared/fences.ts +0 -24
  121. package/src/workflows/shared/health.test.ts +0 -148
  122. package/src/workflows/shared/health.ts +0 -191
  123. package/src/workflows/shared/learn.test.ts +0 -140
  124. package/src/workflows/shared/learn.ts +0 -201
  125. package/src/workflows/shared/lenses.test.ts +0 -39
  126. package/src/workflows/shared/lenses.ts +0 -294
  127. package/src/workflows/shared/options.test.ts +0 -157
  128. package/src/workflows/shared/options.ts +0 -92
  129. package/src/workflows/shared/progress.feature +0 -124
  130. package/src/workflows/shared/prose.ts +0 -263
  131. package/src/workflows/shared/recheck.feature +0 -60
  132. package/src/workflows/shared/registry.test.ts +0 -345
  133. package/src/workflows/shared/registry.ts +0 -183
  134. package/src/workflows/shared/reserved.ts +0 -11
  135. package/src/workflows/shared/review.test.ts +0 -1062
  136. package/src/workflows/shared/review.ts +0 -446
  137. package/src/workflows/shared/skills.test.ts +0 -121
  138. package/src/workflows/shared/skills.ts +0 -49
  139. package/src/workflows/shared/standards.test.ts +0 -90
  140. package/src/workflows/shared/standards.ts +0 -156
  141. package/src/workflows/shared/steps.test.ts +0 -219
  142. package/src/workflows/shared/steps.ts +0 -201
  143. package/src/workflows/shared/tail.test.ts +0 -454
  144. package/src/workflows/shared/tail.ts +0 -264
  145. package/src/workflows/shared/text.fixture.ts +0 -128
  146. package/src/workflows/shared/text.test.ts +0 -1430
  147. package/src/workflows/shared/text.ts +0 -1700
  148. package/src/workflows/shared/threads.test.ts +0 -129
  149. package/src/workflows/shared/vars.ts +0 -47
  150. package/src/workflows/shared/workflows.steps.ts +0 -54
@@ -1,1528 +0,0 @@
1
- @inmem
2
- Feature: the refactor is reviewed on its own before the feature is implemented
3
-
4
- After a refactor-first judgment the refactor is built, quality-lapped and
5
- reviewed on its own. Review edits re-run the refactor, never the design;
6
- the feature that follows is quality-lapped from the refactor's
7
- sign-off, then reviewed. The flags are pinned so the per-flag test runs never move it off
8
- its path.
9
-
10
- Background:
11
- Given the shipped workflows, as gtd install scaffolds them
12
- And an environment variable "GTD_QUALITYREVIEWS" set to ""
13
- And an environment variable "GTD_FLAG_RISK_TIER" set to "0"
14
-
15
- Scenario: with a narrowed seamAllow a test file added by the refactor is refused
16
- Given an environment variable "GTD_REFACTORQUALITYREVIEWS" set to ""
17
- And an environment variable "GTD_SEAMALLOW" set to "docs/**"
18
- And a file "src/calc.ts" with:
19
- """
20
- export const add = (a: number, b: number) => a + b
21
- """
22
- And a file "src/calc.test.ts" with:
23
- """
24
- import { expect, it } from "vitest"
25
- it("adds", () => expect(1 + 1).toBe(2))
26
- """
27
- And a file "src/*.ts" with:
28
- """
29
- export const literalGlobName = 1
30
- """
31
- And the working tree is committed as "feat: add calculator"
32
- And a file "TODO.md" with:
33
- """
34
- # Add subtract
35
-
36
- subtract(a, b) returns the difference.
37
- """
38
- And step "unwind" changes nothing
39
- And step "start-gate.check" changes nothing
40
- And step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
41
- """
42
- # Requirements
43
-
44
- ## Concerns
45
-
46
- ### Subtract
47
-
48
- - `subtract(a, b)` returns `a - b`.
49
-
50
- ## Impact
51
-
52
- - the greeting module
53
-
54
- ## Release Flag
55
-
56
- new
57
-
58
- ## Acceptance Criteria
59
-
60
- - AC-1: the change behaves as described.
61
- """
62
- And step "design.gate.answer" changes nothing
63
- And step "seam.check" changes nothing
64
- And step "seam.naive" writes "src/acceptance.test.ts" with:
65
- """
66
- it("[AC-1] holds", () => {})
67
- """
68
- And step "seam.naive" writes "src/calc.ts" with:
69
- """
70
- export const add = (a: number, b: number) => a + b
71
- export const subtract = (a: number, b: number) => a - b
72
- """
73
- And judge step "seam.judge" answers:
74
- """
75
- [{"id":"shape","answer":"refactor-first","p":0.9}]
76
- """
77
- And step "seam.note" writes ".gtd/REFACTOR-NOTE.md" with:
78
- """
79
- Seam: the existing code the strays touch.
80
- """
81
- And step "refactor.deriving" runs its script
82
- And step "refactor.building" writes "src/calc.ts" with:
83
- """
84
- export const op = (a: number, b: number, sign: number) => a + sign * b
85
- export const add = (a: number, b: number) => op(a, b, 1)
86
- """
87
- And step "refactor.health.check" changes nothing
88
- And step "refactor.closing" runs its script
89
- And step "refactor.build.review.carrying" runs its script
90
- And step "refactor.build.review.reviewing" writes ".gtd/REVIEW.md" with:
91
- """
92
- # Review: abc1234
93
-
94
- <!-- base: 0000000 -->
95
-
96
- ## calc
97
-
98
- - [ ] ./src/calc.ts#1-2
99
- add built on the shared op
100
- """
101
- And step "refactor.build.review.closing" runs its script
102
-
103
-
104
- And step "seam.naive" writes "src/calc.test.ts" with:
105
- """
106
- import { expect, it } from "vitest"
107
- it("adds", () => expect(2 + 2).toBe(4))
108
- """
109
- And step "refactor.building" writes "src/calc.spec.ts" with:
110
- """
111
- import { expect, it } from "vitest"
112
- it("adds", () => expect(3 + 3).toBe(6))
113
- """
114
- Then driving the process is refused with "refactor-tests"
115
-
116
-
117
- Scenario: refactorQualityReviews picks the refactor's lenses and qualityReviews does not reach them
118
- Given an environment variable "GTD_REFACTORQUALITYREVIEWS" set to "correctness"
119
- And an environment variable "GTD_QUALITYREVIEWS" set to "owasp-security"
120
- And a file "src/calc.ts" with:
121
- """
122
- export const add = (a: number, b: number) => a + b
123
- """
124
- And a file "src/calc.test.ts" with:
125
- """
126
- import { expect, it } from "vitest"
127
- it("adds", () => expect(1 + 1).toBe(2))
128
- """
129
- And a file "src/*.ts" with:
130
- """
131
- export const literalGlobName = 1
132
- """
133
- And the working tree is committed as "feat: add calculator"
134
- And a file "TODO.md" with:
135
- """
136
- # Add subtract
137
-
138
- subtract(a, b) returns the difference.
139
- """
140
- And step "unwind" changes nothing
141
- And step "start-gate.check" changes nothing
142
- And step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
143
- """
144
- # Requirements
145
-
146
- ## Concerns
147
-
148
- ### Subtract
149
-
150
- - `subtract(a, b)` returns `a - b`.
151
-
152
- ## Impact
153
-
154
- - the greeting module
155
-
156
- ## Release Flag
157
-
158
- new
159
-
160
- ## Acceptance Criteria
161
-
162
- - AC-1: the change behaves as described.
163
- """
164
- And step "design.gate.answer" changes nothing
165
- And step "seam.check" changes nothing
166
- And step "seam.naive" writes "src/acceptance.test.ts" with:
167
- """
168
- it("[AC-1] holds", () => {})
169
- """
170
- And step "seam.naive" writes "src/calc.ts" with:
171
- """
172
- export const add = (a: number, b: number) => a + b
173
- export const subtract = (a: number, b: number) => a - b
174
- """
175
- And judge step "seam.judge" answers:
176
- """
177
- [{"id":"shape","answer":"refactor-first","p":0.9}]
178
- """
179
- And step "seam.note" writes ".gtd/REFACTOR-NOTE.md" with:
180
- """
181
- Seam: the existing code the strays touch.
182
- """
183
- And step "refactor.deriving" runs its script
184
- And step "refactor.building" writes "src/calc.ts" with:
185
- """
186
- export const op = (a: number, b: number, sign: number) => a + sign * b
187
- export const add = (a: number, b: number) => op(a, b, 1)
188
- """
189
- And step "refactor.health.check" changes nothing
190
- And step "refactor.closing" runs its script
191
- And step "refactor.build.review.carrying" runs its script
192
- And step "refactor.build.review.reviewing" writes ".gtd/REVIEW.md" with:
193
- """
194
- # Review: abc1234
195
-
196
- <!-- base: 0000000 -->
197
-
198
- ## calc
199
-
200
- - [ ] ./src/calc.ts#1-2
201
- add built on the shared op
202
- """
203
- And step "refactor.build.review.closing" runs its script
204
-
205
-
206
- And step "refactor.build.quality.correctness.reviewing" changes nothing
207
- When the process is driven
208
- Then the process rests at "refactor.build.review.await-review"
209
- And the commit subjects end with:
210
- """
211
- gtd(check): refactor.closing → refactor.build.quality.correctness.reviewing
212
- gtd(agent): refactor.build.quality.correctness.reviewing → refactor.build.review.reviewing
213
- gtd(agent): refactor.build.review.reviewing → refactor.build.review.await-review
214
- """
215
-
216
-
217
- Rule: with the refactor lenses blank
218
-
219
- Background:
220
- Given an environment variable "GTD_REFACTORQUALITYREVIEWS" set to ""
221
- And a file "src/calc.ts" with:
222
- """
223
- export const add = (a: number, b: number) => a + b
224
- """
225
- And a file "src/calc.test.ts" with:
226
- """
227
- import { expect, it } from "vitest"
228
- it("adds", () => expect(1 + 1).toBe(2))
229
- """
230
- And a file "src/*.ts" with:
231
- """
232
- export const literalGlobName = 1
233
- """
234
- And the working tree is committed as "feat: add calculator"
235
- And a file "TODO.md" with:
236
- """
237
- # Add subtract
238
-
239
- subtract(a, b) returns the difference.
240
- """
241
- And step "unwind" changes nothing
242
- And step "start-gate.check" changes nothing
243
- And step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
244
- """
245
- # Requirements
246
-
247
- ## Concerns
248
-
249
- ### Subtract
250
-
251
- - `subtract(a, b)` returns `a - b`.
252
-
253
- ## Impact
254
-
255
- - the greeting module
256
-
257
- ## Release Flag
258
-
259
- new
260
-
261
- ## Acceptance Criteria
262
-
263
- - AC-1: the change behaves as described.
264
- """
265
- And step "design.gate.answer" changes nothing
266
- And step "seam.check" changes nothing
267
- And step "seam.naive" writes "src/acceptance.test.ts" with:
268
- """
269
- it("[AC-1] holds", () => {})
270
- """
271
- And step "seam.naive" writes "src/calc.ts" with:
272
- """
273
- export const add = (a: number, b: number) => a + b
274
- export const subtract = (a: number, b: number) => a - b
275
- """
276
- And judge step "seam.judge" answers:
277
- """
278
- [{"id":"shape","answer":"refactor-first","p":0.9}]
279
- """
280
- And step "seam.note" writes ".gtd/REFACTOR-NOTE.md" with:
281
- """
282
- Seam: the existing code the strays touch.
283
- """
284
- And step "refactor.deriving" runs its script
285
- And step "refactor.building" writes "src/calc.ts" with:
286
- """
287
- export const op = (a: number, b: number, sign: number) => a + sign * b
288
- export const add = (a: number, b: number) => op(a, b, 1)
289
- """
290
- And step "refactor.health.check" changes nothing
291
- And step "refactor.closing" runs its script
292
- And step "refactor.build.review.carrying" runs its script
293
- And step "refactor.build.review.reviewing" writes ".gtd/REVIEW.md" with:
294
- """
295
- # Review: abc1234
296
-
297
- <!-- base: 0000000 -->
298
-
299
- ## calc
300
-
301
- - [ ] ./src/calc.ts#1-2
302
- add built on the shared op
303
- """
304
- And step "refactor.build.review.closing" runs its script
305
-
306
- Scenario: an edit note at the refactor review re-derives the refactor, never the design
307
- When the process is driven
308
- Then the process rests at "refactor.build.review.await-review"
309
- Given a file ".gtd/REVIEW.md" with:
310
- """
311
- # Review: abc1234
312
-
313
- <!-- base: 0000000 -->
314
-
315
- ## calc
316
-
317
- - [ ] ./src/calc.ts#1-2
318
- add built on the shared op[^why]
319
-
320
- [^why]:
321
- - H: name the helper `combine`
322
- """
323
- And step "refactor.build.review.collecting" writes ".gtd/REFACTOR.md" with:
324
- """
325
- Name the shared helper `combine`.
326
- """
327
- And step "refactor.build.review.collecting" writes ".gtd/REVIEW.md" with:
328
- """
329
- # Review: abc1234
330
-
331
- <!-- base: 0000000 -->
332
-
333
- ## calc
334
-
335
- - [ ] ./src/calc.ts#1-2
336
- add built on the shared op[^why]
337
-
338
- [^why]:
339
- - H: name the helper `combine`
340
- - A: noted in the refactor package.
341
- """
342
- When gtd lands
343
- And the process is driven
344
- Then the process rests at "refactor.build.review.await-review"
345
- And ".gtd/REFACTOR.md" contains "combine"
346
- Given a file ".gtd/REVIEW.md" with:
347
- """
348
- # Review: abc1234
349
-
350
- <!-- base: 0000000 -->
351
-
352
- ## calc
353
-
354
- - [ ] ./src/calc.ts#1-2
355
- add built on the shared op
356
- """
357
- And step "refactor.re-unwind" runs its script
358
- And step "refactor.building" writes "src/calc.ts" with:
359
- """
360
- export const combine = (a: number, b: number, sign: number) => a + sign * b
361
- export const add = (a: number, b: number) => combine(a, b, 1)
362
- """
363
- And step "refactor.deriving" is prompted with "Review feedback"
364
- When gtd lands
365
- And the process is driven
366
- Then the process rests at "refactor.build.review.await-review"
367
- And the commit subjects end with:
368
- """
369
- gtd(human): refactor.build.review.await-review → refactor.build.review.closing
370
- gtd(check): refactor.build.review.closing → refactor.re-unwind
371
- gtd(check): refactor.re-unwind → refactor.deriving
372
- gtd(check): refactor.deriving → refactor.building
373
- gtd(agent): refactor.building → refactor.health.check
374
- gtd(check): refactor.health.check → refactor.closing
375
- gtd(check): refactor.closing → refactor.build.review.reviewing
376
- gtd(agent): refactor.build.review.reviewing → refactor.build.review.await-review
377
- """
378
-
379
- Scenario: a question answered at the refactor review reaches the re-derived package as ### Answered Questions
380
- When the process is driven
381
- Then the process rests at "refactor.build.review.await-review"
382
- Given a file ".gtd/REVIEW.md" with:
383
- """
384
- # Review: abc1234
385
-
386
- <!-- base: 0000000 -->
387
-
388
- ## calc
389
-
390
- - [ ] ./src/calc.ts#1-1
391
- why a shared op?
392
- - [ ] ./src/calc.ts#2-2
393
- rename the helper to combine
394
- """
395
- And judge step "refactor.build.review.triage" answers:
396
- """
397
- [{"id":"note-1","answer":"question","p":0.9},{"id":"note-2","answer":"edit","p":0.9}]
398
- """
399
- And step "refactor.build.review.answer-review-questions" writes ".gtd/REVIEW.md" with:
400
- """
401
- # Review: abc1234
402
-
403
- <!-- base: 0000000 -->
404
-
405
- ## calc
406
-
407
- - [ ] ./src/calc.ts#1-1
408
- why a shared op?
409
- A: add and subtract differ only by sign.
410
- - [ ] ./src/calc.ts#2-2
411
- rename the helper to combine
412
- """
413
- And step "refactor.build.review.collecting" writes ".gtd/REFACTOR.md" with:
414
- """
415
- ## Rename
416
-
417
- Name the shared helper `combine`.
418
-
419
- ## Answered Questions
420
-
421
- ### why a shared op?
422
-
423
- add and subtract differ only by sign.
424
- """
425
- And step "refactor.re-unwind" runs its script
426
- And step "refactor.deriving" runs its script
427
- When gtd lands
428
- And the process is driven
429
- Then ".gtd/REFACTOR.md" contains "## Review feedback"
430
- And ".gtd/REFACTOR.md" contains "### Answered Questions"
431
-
432
- Scenario: a human code edit at the refactor review is reverted by refactor.re-unwind
433
- When the process is driven
434
- Then the process rests at "refactor.build.review.await-review"
435
- Given a file "src/calc.ts" with:
436
- """
437
- export const op = (a: number, b: number, sign: number) => a + sign * b
438
- export const add = (a: number, b: number) => op(a, b, 1)
439
- // TODO: rename op to adjust
440
- """
441
- And step "refactor.build.review.collecting" writes ".gtd/REFACTOR.md" with:
442
- """
443
- Rename op to adjust in the shared helper.
444
- """
445
- And step "refactor.re-unwind" runs its script
446
- And step "refactor.building" writes "src/calc.ts" with:
447
- """
448
- export const adjust = (a: number, b: number, sign: number) => a + sign * b
449
- export const add = (a: number, b: number) => adjust(a, b, 1)
450
- """
451
- When gtd lands
452
- And the process is driven
453
- Then the process rests at "refactor.build.review.await-review"
454
- And "src/calc.ts" does not contain "TODO"
455
- And the commit subjects end with:
456
- """
457
- gtd(human): refactor.build.review.await-review → refactor.build.review.closing
458
- gtd(check): refactor.build.review.closing → refactor.build.review.collecting
459
- gtd(agent): refactor.build.review.collecting → refactor.re-unwind
460
- gtd(check): refactor.re-unwind → refactor.deriving
461
- gtd(check): refactor.deriving → refactor.building
462
- gtd(agent): refactor.building → refactor.health.check
463
- gtd(check): refactor.health.check → refactor.closing
464
- gtd(check): refactor.closing → refactor.build.review.reviewing
465
- gtd(agent): refactor.build.review.reviewing → refactor.build.review.await-review
466
- """
467
-
468
- Scenario: an edit note the collecting turn leaves out refuses the landing and never signs off
469
- When the process is driven
470
- Then the process rests at "refactor.build.review.await-review"
471
- Given a file ".gtd/REVIEW.md" with:
472
- """
473
- # Review: abc1234
474
-
475
- <!-- base: 0000000 -->
476
-
477
- ## calc
478
-
479
- - [ ] ./src/calc.ts#1-2
480
- add built on the shared op — this should change behaviour, not just structure
481
- """
482
- And judge step "refactor.build.review.triage" answers:
483
- """
484
- [{"id":"note-1","answer":"edit","p":0.9}]
485
- """
486
- And step "refactor.build.review.collecting" changes nothing
487
- When gtd lands
488
- Then driving the process is refused with "refactor-feedback"
489
- And driving the process is refused with "note-1"
490
- And driving the process is refused with "gtd abandon"
491
-
492
- Scenario: a code hand-edit the collecting turn leaves out refuses the landing naming the path
493
- When the process is driven
494
- Then the process rests at "refactor.build.review.await-review"
495
- Given a file "src/calc.ts" with:
496
- """
497
- export const op = (a: number, b: number, sign: number) => a + sign * b
498
- export const add = (a: number, b: number) => op(a, b, 1)
499
- // TODO: rename op to adjust
500
- """
501
- And step "refactor.build.review.collecting" changes nothing
502
- When gtd lands
503
- Then driving the process is refused with "refactor-feedback"
504
- And driving the process is refused with "src/calc.ts"
505
-
506
- Scenario: a hand-edit round with a line note rests at a closed collecting turn that folds both and holds no reply rules
507
- When the process is driven
508
- Then the process rests at "refactor.build.review.await-review"
509
- Given a file "src/calc.ts" with:
510
- """
511
- export const op = (a: number, b: number, sign: number) => a + sign * b
512
- export const add = (a: number, b: number) => op(a, b, 1)
513
- // TODO: rename op to adjust
514
- """
515
- And a file ".gtd/REVIEW.md" with:
516
- """
517
- # Review: abc1234
518
-
519
- <!-- base: 0000000 -->
520
-
521
- ## calc
522
-
523
- - [ ] ./src/calc.ts#1-2 rename the helper
524
- add built on the shared op
525
- """
526
- When gtd lands
527
- And the process is driven
528
- Then the process rests at "refactor.build.review.collecting"
529
- And the resting step's content contains "Fold every hand-edit and every note the human left that round"
530
- And the resting step's content does not contain "A one-shot footnote needs no reply"
531
- And the resting step's content does not contain "Code threads waiting on you"
532
-
533
- Scenario: a praise line note on a hand-edit round is never named by the refusal
534
- When the process is driven
535
- Then the process rests at "refactor.build.review.await-review"
536
- Given a file "src/calc.ts" with:
537
- """
538
- export const op = (a: number, b: number, sign: number) => a + sign * b
539
- export const add = (a: number, b: number) => op(a, b, 1)
540
- // TODO: rename op to adjust
541
- """
542
- And a file ".gtd/REVIEW.md" with:
543
- """
544
- # Review: abc1234
545
-
546
- <!-- base: 0000000 -->
547
-
548
- ## calc
549
-
550
- - [ ] ./src/calc.ts#1-2
551
- add built on the shared op, lovely work
552
- """
553
- And step "refactor.build.review.collecting" changes nothing
554
- When gtd lands
555
- Then driving the process is refused with "hand-edited src/calc.ts"
556
- And driving the process is refused without "lovely work"
557
-
558
- Scenario: a thread question at the refactor review gets one reply and no refactor package
559
- When the process is driven
560
- Then the process rests at "refactor.build.review.await-review"
561
- Given a file ".gtd/REVIEW.md" with:
562
- """
563
- # Review: abc1234
564
-
565
- <!-- base: 0000000 -->
566
-
567
- ## calc
568
-
569
- - [ ] ./src/calc.ts#1-2
570
- add built on the shared op[^q]
571
-
572
- [^q]:
573
- - H: why a shared op?
574
- """
575
- And step "refactor.build.review.collecting" writes ".gtd/REVIEW.md" with:
576
- """
577
- # Review: abc1234
578
-
579
- <!-- base: 0000000 -->
580
-
581
- ## calc
582
-
583
- - [ ] ./src/calc.ts#1-2
584
- add built on the shared op[^q]
585
-
586
- [^q]:
587
- - H: why a shared op?
588
- - A: add and subtract differ only by sign.
589
- """
590
- When gtd lands
591
- And the process is driven
592
- Then the process rests at "refactor.build.review.await-review"
593
- And ".gtd/REFACTOR.md" does not exist
594
- And ".gtd/REVIEW.md" contains "A: add and subtract differ only by sign."
595
-
596
- Scenario: a no-change landing after the in-gate reply signs off and the feature follows
597
- Given step "implement.building" writes "src/calc.ts" with:
598
- """
599
- export const op = (a: number, b: number, sign: number) => a + sign * b
600
- export const add = (a: number, b: number) => op(a, b, 1)
601
- export const subtract = (a: number, b: number) => op(a, b, -1)
602
- """
603
- And step "implement.building" writes "src/acceptance.test.ts" with:
604
- """
605
- it("[AC-1] holds", () => {})
606
- """
607
- And step "implement.health.check" changes nothing
608
- And step "implement.closing" runs its script
609
- When the process is driven
610
- Then the process rests at "refactor.build.review.await-review"
611
- Given a file ".gtd/REVIEW.md" with:
612
- """
613
- # Review: abc1234
614
-
615
- <!-- base: 0000000 -->
616
-
617
- ## calc
618
-
619
- - [ ] ./src/calc.ts#1-2
620
- add built on the shared op[^q]
621
-
622
- [^q]:
623
- - H: why a shared op?
624
- """
625
- And step "refactor.build.review.collecting" writes ".gtd/REVIEW.md" with:
626
- """
627
- # Review: abc1234
628
-
629
- <!-- base: 0000000 -->
630
-
631
- ## calc
632
-
633
- - [ ] ./src/calc.ts#1-2
634
- add built on the shared op[^q]
635
-
636
- [^q]:
637
- - H: why a shared op?
638
- - A: add and subtract differ only by sign.
639
- """
640
- When gtd lands
641
- And the process is driven
642
- Then the process rests at "refactor.build.review.await-review"
643
- Given a file ".gtd/REVIEW.md" with:
644
- """
645
- # Review: abc1234
646
-
647
- <!-- base: 0000000 -->
648
-
649
- ## calc
650
-
651
- - [ ] ./src/calc.ts#1-2
652
- add built on the shared op[^q]
653
-
654
- [^q]:
655
- - H: why a shared op?
656
- - A: add and subtract differ only by sign.
657
- - H: understood, thanks. No change needed.
658
- """
659
- And step "refactor.build.review.collecting" writes ".gtd/REVIEW.md" with:
660
- """
661
- # Review: abc1234
662
-
663
- <!-- base: 0000000 -->
664
-
665
- ## calc
666
-
667
- - [ ] ./src/calc.ts#1-2
668
- add built on the shared op
669
- """
670
- When gtd lands
671
- And the process is driven
672
- Then the process rests at "build.review.reviewing"
673
- And "src/calc.ts" contains "subtract"
674
-
675
- Scenario: a praise-only one-shot footnote signs off and the feature follows
676
- Given step "implement.building" writes "src/calc.ts" with:
677
- """
678
- export const op = (a: number, b: number, sign: number) => a + sign * b
679
- export const add = (a: number, b: number) => op(a, b, 1)
680
- export const subtract = (a: number, b: number) => op(a, b, -1)
681
- """
682
- And step "implement.building" writes "src/acceptance.test.ts" with:
683
- """
684
- it("[AC-1] holds", () => {})
685
- """
686
- And step "implement.health.check" changes nothing
687
- And step "implement.closing" runs its script
688
- When the process is driven
689
- Then the process rests at "refactor.build.review.await-review"
690
- Given a file ".gtd/REVIEW.md" with:
691
- """
692
- # Review: abc1234
693
-
694
- <!-- base: 0000000 -->
695
-
696
- ## calc
697
-
698
- - [ ] ./src/calc.ts#1-2
699
- add built on the shared op[^n1]
700
-
701
- [^n1]:
702
- Lovely helper.
703
- """
704
- And judge step "refactor.build.review.triage" answers:
705
- """
706
- [{"id":"note-1","answer":"praise","p":0.9}]
707
- """
708
- When gtd lands
709
- And the process is driven
710
- Then the process rests at "build.review.reviewing"
711
- And "src/calc.ts" contains "subtract"
712
-
713
- Scenario: a one-shot footnote judged edit that collecting leaves out refuses naming its anchor
714
- When the process is driven
715
- Then the process rests at "refactor.build.review.await-review"
716
- Given a file ".gtd/REVIEW.md" with:
717
- """
718
- # Review: abc1234
719
-
720
- <!-- base: 0000000 -->
721
-
722
- ## calc
723
-
724
- - [ ] ./src/calc.ts#1-2
725
- add built on the shared op[^n1]
726
-
727
- [^n1]:
728
- Rename the helper.
729
- """
730
- And judge step "refactor.build.review.triage" answers:
731
- """
732
- [{"id":"note-1","answer":"edit","p":0.9}]
733
- """
734
- And step "refactor.build.review.collecting" changes nothing
735
- When gtd lands
736
- Then driving the process is refused with "refactor-feedback"
737
- And driving the process is refused with "[^n1]"
738
- And driving the process is refused with "Rename the helper."
739
-
740
- Scenario: a one-shot footnote landed after an in-gate thread reply is judged, not signed off unjudged
741
- When the process is driven
742
- Then the process rests at "refactor.build.review.await-review"
743
- Given a file ".gtd/REVIEW.md" with:
744
- """
745
- # Review: abc1234
746
-
747
- <!-- base: 0000000 -->
748
-
749
- ## calc
750
-
751
- - [ ] ./src/calc.ts#1-2
752
- add built on the shared op[^q]
753
-
754
- [^q]:
755
- - H: why a shared op?
756
- """
757
- And step "refactor.build.review.collecting" writes ".gtd/REVIEW.md" with:
758
- """
759
- # Review: abc1234
760
-
761
- <!-- base: 0000000 -->
762
-
763
- ## calc
764
-
765
- - [ ] ./src/calc.ts#1-2
766
- add built on the shared op[^q]
767
-
768
- [^q]:
769
- - H: why a shared op?
770
- - A: add and subtract differ only by sign.
771
- """
772
- When gtd lands
773
- And the process is driven
774
- Then the process rests at "refactor.build.review.await-review"
775
- Given a file ".gtd/REVIEW.md" with:
776
- """
777
- # Review: abc1234
778
-
779
- <!-- base: 0000000 -->
780
-
781
- ## calc
782
-
783
- - [ ] ./src/calc.ts#1-2
784
- add built on the shared op[^n1]
785
-
786
- [^n1]:
787
- Rename the helper.
788
- """
789
- And judge step "refactor.build.review.triage" answers:
790
- """
791
- [{"id":"note-1","answer":"edit","p":0.9}]
792
- """
793
- And step "refactor.build.review.collecting" from now on changes nothing
794
- When gtd lands
795
- Then driving the process is refused with "refactor-feedback"
796
- And driving the process is refused with "[^n1]"
797
-
798
- Scenario: a change note left behind by a thread-only settled round refuses naming the note
799
- When the process is driven
800
- Then the process rests at "refactor.build.review.await-review"
801
- Given a file ".gtd/REVIEW.md" with:
802
- """
803
- # Review: abc1234
804
-
805
- <!-- base: 0000000 -->
806
-
807
- ## calc
808
-
809
- - [ ] ./src/calc.ts#1-2
810
- add built on the shared op - this should change behaviour, not just structure[^q]
811
-
812
- [^q]:
813
- - H: why a shared op?
814
- """
815
- And step "refactor.build.review.collecting" rewrites ".gtd/REVIEW.md" with:
816
- """
817
- # Review: abc1234
818
-
819
- <!-- base: 0000000 -->
820
-
821
- ## calc
822
-
823
- - [ ] ./src/calc.ts#1-2
824
- add built on the shared op - this should change behaviour, not just structure[^q]
825
-
826
- [^q]:
827
- - H: why a shared op?
828
- - A: add and subtract differ only by sign.
829
- """
830
- When gtd lands
831
- And the process is driven
832
- Then the process rests at "refactor.build.review.await-review"
833
- Given a file ".gtd/REVIEW.md" with:
834
- """
835
- # Review: abc1234
836
-
837
- <!-- base: 0000000 -->
838
-
839
- ## calc
840
-
841
- - [ ] ./src/calc.ts#1-2
842
- add built on the shared op - this should change behaviour, not just structure[^q]
843
-
844
- [^q]:
845
- - H: why a shared op?
846
- - A: add and subtract differ only by sign.
847
- - H: understood, thanks. No change needed.
848
- """
849
- And step "refactor.build.review.collecting" rewrites ".gtd/REVIEW.md" with:
850
- """
851
- # Review: abc1234
852
-
853
- <!-- base: 0000000 -->
854
-
855
- ## calc
856
-
857
- - [ ] ./src/calc.ts#1-2
858
- add built on the shared op - this should change behaviour, not just structure
859
- """
860
- And judge step "refactor.build.review.triage" answers:
861
- """
862
- [{"id":"note-1","answer":"edit","p":0.9}]
863
- """
864
- When gtd lands
865
- Then driving the process is refused with "refactor-feedback"
866
- And driving the process is refused with "note-1"
867
- And driving the process is refused with "gtd abandon"
868
-
869
- Scenario: a hand-edit made before the thread refuses a thread-only settled round naming the path
870
- When the process is driven
871
- Then the process rests at "refactor.build.review.await-review"
872
- Given a file "src/calc.ts" with:
873
- """
874
- export const op = (a: number, b: number, sign: number) => a + sign * b
875
- export const add = (a: number, b: number) => op(a, b, 1)
876
- // TODO: rename op to adjust
877
- """
878
- And a file ".gtd/REVIEW.md" with:
879
- """
880
- # Review: abc1234
881
-
882
- <!-- base: 0000000 -->
883
-
884
- ## calc
885
-
886
- - [ ] ./src/calc.ts#1-2
887
- add built on the shared op[^q]
888
-
889
- [^q]:
890
- - H: why a shared op?
891
- """
892
- And step "refactor.build.review.collecting" rewrites ".gtd/REVIEW.md" with:
893
- """
894
- # Review: abc1234
895
-
896
- <!-- base: 0000000 -->
897
-
898
- ## calc
899
-
900
- - [ ] ./src/calc.ts#1-2
901
- add built on the shared op[^q]
902
-
903
- [^q]:
904
- - H: why a shared op?
905
- - A: add and subtract differ only by sign.
906
- """
907
- When gtd lands
908
- And the process is driven
909
- Then the process rests at "refactor.build.review.await-review"
910
- Given a file ".gtd/REVIEW.md" with:
911
- """
912
- # Review: abc1234
913
-
914
- <!-- base: 0000000 -->
915
-
916
- ## calc
917
-
918
- - [ ] ./src/calc.ts#1-2
919
- add built on the shared op[^q]
920
-
921
- [^q]:
922
- - H: why a shared op?
923
- - A: add and subtract differ only by sign.
924
- - H: understood, thanks. No change needed.
925
- """
926
- And step "refactor.build.review.collecting" rewrites ".gtd/REVIEW.md" with:
927
- """
928
- # Review: abc1234
929
-
930
- <!-- base: 0000000 -->
931
-
932
- ## calc
933
-
934
- - [ ] ./src/calc.ts#1-2
935
- add built on the shared op
936
- """
937
- When gtd lands
938
- Then driving the process is refused with "refactor-feedback"
939
- And driving the process is refused with "hand-edited src/calc.ts"
940
-
941
- Scenario: a praise note and a concluded thread on a settled round sign off and the feature follows
942
- Given step "implement.building" writes "src/calc.ts" with:
943
- """
944
- export const op = (a: number, b: number, sign: number) => a + sign * b
945
- export const add = (a: number, b: number) => op(a, b, 1)
946
- export const subtract = (a: number, b: number) => op(a, b, -1)
947
- """
948
- And step "implement.building" writes "src/acceptance.test.ts" with:
949
- """
950
- it("[AC-1] holds", () => {})
951
- """
952
- And step "implement.health.check" changes nothing
953
- And step "implement.closing" runs its script
954
- When the process is driven
955
- Then the process rests at "refactor.build.review.await-review"
956
- Given a file ".gtd/REVIEW.md" with:
957
- """
958
- # Review: abc1234
959
-
960
- <!-- base: 0000000 -->
961
-
962
- ## calc
963
-
964
- - [ ] ./src/calc.ts#1-2
965
- add built on the shared op, lovely work[^q]
966
-
967
- [^q]:
968
- - H: why a shared op?
969
- """
970
- And step "refactor.build.review.collecting" rewrites ".gtd/REVIEW.md" with:
971
- """
972
- # Review: abc1234
973
-
974
- <!-- base: 0000000 -->
975
-
976
- ## calc
977
-
978
- - [ ] ./src/calc.ts#1-2
979
- add built on the shared op, lovely work[^q]
980
-
981
- [^q]:
982
- - H: why a shared op?
983
- - A: add and subtract differ only by sign.
984
- """
985
- When gtd lands
986
- And the process is driven
987
- Then the process rests at "refactor.build.review.await-review"
988
- Given a file ".gtd/REVIEW.md" with:
989
- """
990
- # Review: abc1234
991
-
992
- <!-- base: 0000000 -->
993
-
994
- ## calc
995
-
996
- - [ ] ./src/calc.ts#1-2
997
- add built on the shared op, lovely work[^q]
998
-
999
- [^q]:
1000
- - H: why a shared op?
1001
- - A: add and subtract differ only by sign.
1002
- - H: understood, thanks. No change needed.
1003
- """
1004
- And step "refactor.build.review.collecting" rewrites ".gtd/REVIEW.md" with:
1005
- """
1006
- # Review: abc1234
1007
-
1008
- <!-- base: 0000000 -->
1009
-
1010
- ## calc
1011
-
1012
- - [ ] ./src/calc.ts#1-2
1013
- add built on the shared op, lovely work
1014
- """
1015
- And judge step "refactor.build.review.triage" answers:
1016
- """
1017
- [{"id":"note-1","answer":"praise","p":0.9}]
1018
- """
1019
- When gtd lands
1020
- And the process is driven
1021
- Then the process rests at "build.review.reviewing"
1022
- And "src/calc.ts" contains "subtract"
1023
-
1024
- Scenario: a praise-only refactor review still signs off and the feature follows
1025
- Given step "implement.building" writes "src/calc.ts" with:
1026
- """
1027
- export const op = (a: number, b: number, sign: number) => a + sign * b
1028
- export const add = (a: number, b: number) => op(a, b, 1)
1029
- export const subtract = (a: number, b: number) => op(a, b, -1)
1030
- """
1031
- And step "implement.building" writes "src/acceptance.test.ts" with:
1032
- """
1033
- it("[AC-1] holds", () => {})
1034
- """
1035
- And step "implement.health.check" changes nothing
1036
- And step "implement.closing" runs its script
1037
- When the process is driven
1038
- Then the process rests at "refactor.build.review.await-review"
1039
- Given a file ".gtd/REVIEW.md" with:
1040
- """
1041
- # Review: abc1234
1042
-
1043
- <!-- base: 0000000 -->
1044
-
1045
- ## calc
1046
-
1047
- - [x] ./src/calc.ts#1-2
1048
- add built on the shared op
1049
- """
1050
- When gtd lands
1051
- And the process is driven
1052
- Then the process rests at "build.review.reviewing"
1053
- And "src/calc.ts" contains "subtract"
1054
-
1055
- Scenario: a nit fix in the refactor that changes a non-stray is refused, though a glob stray widens the write access
1056
- Given step "seam.naive" writes "src/*.ts" with:
1057
- """
1058
- export const literalGlobName = 2
1059
- """
1060
- When the process is driven
1061
- Then the process rests at "refactor.build.review.await-review"
1062
- Given a file ".gtd/REVIEW.md" with:
1063
- """
1064
- # Review: abc1234
1065
-
1066
- <!-- base: 0000000 -->
1067
-
1068
- ## calc
1069
-
1070
- - [ ] ./src/calc.ts#1-2
1071
- add built on the shared op — rename `sign` to `direction`
1072
- """
1073
- And judge step "refactor.build.review.triage" answers:
1074
- """
1075
- [{"id":"note-1","answer":"nit","p":0.9}]
1076
- """
1077
- And step "refactor.build.review.fix.nits.fixing" writes "src/other.ts" with:
1078
- """
1079
- export const other = 1
1080
- """
1081
- When gtd lands
1082
- Then driving the process is refused with "refactor-scope"
1083
-
1084
- Scenario: the nit-fix turn in the refactor may write the strays and .gtd/** only
1085
- Given step "seam.naive" writes "src/*.ts" with:
1086
- """
1087
- export const literalGlobName = 2
1088
- """
1089
- When the process is driven
1090
- Then the process rests at "refactor.build.review.await-review"
1091
- Given a file ".gtd/REVIEW.md" with:
1092
- """
1093
- # Review: abc1234
1094
-
1095
- <!-- base: 0000000 -->
1096
-
1097
- ## calc
1098
-
1099
- - [ ] ./src/calc.ts#1-2
1100
- add built on the shared op — rename `sign` to `direction`
1101
- """
1102
- And judge step "refactor.build.review.triage" answers:
1103
- """
1104
- [{"id":"note-1","answer":"nit","p":0.9}]
1105
- """
1106
- When gtd lands
1107
- And the process is driven
1108
- Then the process rests at "refactor.build.review.fix.nits.fixing"
1109
- And the output of gtd "next --json=access.write" contains "src/*.ts"
1110
- And the output of gtd "next --json=access.write" contains ".gtd/**"
1111
-
1112
- Scenario: a blank refactorQualityReviews runs no refactor quality lap
1113
- When the process is driven
1114
- Then the process rests at "refactor.build.review.await-review"
1115
- And the commit subjects end with:
1116
- """
1117
- gtd(check): refactor.closing → refactor.build.review.reviewing
1118
- gtd(agent): refactor.build.review.reviewing → refactor.build.review.await-review
1119
- """
1120
-
1121
- Scenario: a reviewer walks the human through the whole refactor, every chunk pointing at its code
1122
- When the process is driven
1123
- Then the process rests at "refactor.build.review.await-review"
1124
- And ".gtd/REVIEW.md" contains:
1125
- """
1126
- ## calc
1127
-
1128
- - [ ] ./src/calc.ts#1-2
1129
- add built on the shared op
1130
- """
1131
- And no commit body contains "refactor.build.review.composing"
1132
-
1133
- Scenario: a risk the refactor's re-review marks again reaches the human unfixed
1134
- Given step "refactor.build.review.reviewing" writes ".gtd/REVIEW.md" with:
1135
- """
1136
- # Review: abc1234
1137
-
1138
- <!-- base: 0000000 -->
1139
-
1140
- ## calc
1141
-
1142
- - [ ] ./src/calc.ts#1-2 — Risk: drops the sign
1143
- """
1144
- When the process is driven
1145
- Then the process rests at "refactor.build.review.fix.risks.fixing"
1146
- Given step "refactor.build.review.reviewing" is no longer scripted
1147
- And step "refactor.build.review.reviewing" replaces the text "Risk: drops the sign" in ".gtd/REVIEW.md" with "Risk: still drops the sign"
1148
- And step "refactor.build.review.fix.risks.fixing" changes nothing
1149
- And step "refactor.build.health.check" changes nothing
1150
- When the process is driven
1151
- Then the process rests at "refactor.build.review.await-review"
1152
- And ".gtd/REVIEW.md" contains:
1153
- """
1154
- ## calc
1155
-
1156
- - [ ] ./src/calc.ts#1-2 — Risk: still drops the sign
1157
- """
1158
- And ".gtd/REVIEW.md" contains "## calc" exactly once
1159
- And the commit subjects end with:
1160
- """
1161
- gtd(agent): refactor.build.review.reviewing → refactor.build.review.fix.risks.fixing
1162
- gtd(agent): refactor.build.review.fix.risks.fixing → refactor.build.health.check
1163
- gtd(check): refactor.build.health.check → refactor.build.review.reviewing
1164
- gtd(agent): refactor.build.review.reviewing → refactor.build.review.await-review
1165
- """
1166
-
1167
- Rule: with a quality lens on both the refactor and the feature
1168
-
1169
- Background:
1170
- Given an environment variable "GTD_REFACTORQUALITYREVIEWS" set to "correctness"
1171
- And an environment variable "GTD_QUALITYREVIEWS" set to "correctness"
1172
- And a file "src/calc.ts" with:
1173
- """
1174
- export const add = (a: number, b: number) => a + b
1175
- """
1176
- And a file "src/calc.test.ts" with:
1177
- """
1178
- import { expect, it } from "vitest"
1179
- it("adds", () => expect(1 + 1).toBe(2))
1180
- """
1181
- And a file "src/*.ts" with:
1182
- """
1183
- export const literalGlobName = 1
1184
- """
1185
- And the working tree is committed as "feat: add calculator"
1186
- And a file "TODO.md" with:
1187
- """
1188
- # Add subtract
1189
-
1190
- subtract(a, b) returns the difference.
1191
- """
1192
- And step "unwind" changes nothing
1193
- And step "start-gate.check" changes nothing
1194
- And step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
1195
- """
1196
- # Requirements
1197
-
1198
- ## Concerns
1199
-
1200
- ### Subtract
1201
-
1202
- - `subtract(a, b)` returns `a - b`.
1203
-
1204
- ## Impact
1205
-
1206
- - the greeting module
1207
-
1208
- ## Release Flag
1209
-
1210
- new
1211
-
1212
- ## Acceptance Criteria
1213
-
1214
- - AC-1: the change behaves as described.
1215
- """
1216
- And step "design.gate.answer" changes nothing
1217
- And step "seam.check" changes nothing
1218
- And step "seam.naive" writes "src/acceptance.test.ts" with:
1219
- """
1220
- it("[AC-1] holds", () => {})
1221
- """
1222
- And step "seam.naive" writes "src/calc.ts" with:
1223
- """
1224
- export const add = (a: number, b: number) => a + b
1225
- export const subtract = (a: number, b: number) => a - b
1226
- """
1227
- And judge step "seam.judge" answers:
1228
- """
1229
- [{"id":"shape","answer":"refactor-first","p":0.9}]
1230
- """
1231
- And step "seam.note" writes ".gtd/REFACTOR-NOTE.md" with:
1232
- """
1233
- Seam: the existing code the strays touch.
1234
- """
1235
- And step "refactor.deriving" runs its script
1236
- And step "refactor.building" writes "src/calc.ts" with:
1237
- """
1238
- export const op = (a: number, b: number, sign: number) => a + sign * b
1239
- export const add = (a: number, b: number) => op(a, b, 1)
1240
- """
1241
- And step "refactor.health.check" changes nothing
1242
- And step "refactor.closing" runs its script
1243
- And step "refactor.build.review.carrying" runs its script
1244
- And step "refactor.build.review.reviewing" writes ".gtd/REVIEW.md" with:
1245
- """
1246
- # Review: abc1234
1247
-
1248
- <!-- base: 0000000 -->
1249
-
1250
- ## calc
1251
-
1252
- - [ ] ./src/calc.ts#1-2
1253
- add built on the shared op
1254
- """
1255
- And step "refactor.build.review.closing" runs its script
1256
-
1257
- Scenario: the refactor's and the feature's quality laps each review from their own base
1258
- When the process is driven
1259
- Then the process rests at "refactor.build.quality.correctness.reviewing"
1260
- And the resting step's content contains the hash of the commit "gtd(agent): seam.note → refactor.deriving"
1261
- Given step "refactor.build.quality.correctness.reviewing" changes nothing
1262
- And step "implement.building" writes "src/calc.ts" with:
1263
- """
1264
- export const op = (a: number, b: number, sign: number) => a + sign * b
1265
- export const add = (a: number, b: number) => op(a, b, 1)
1266
- export const subtract = (a: number, b: number) => op(a, b, -1)
1267
- """
1268
- And step "implement.building" writes "src/acceptance.test.ts" with:
1269
- """
1270
- it("[AC-1] holds", () => {})
1271
- """
1272
- And step "implement.health.check" changes nothing
1273
- And step "implement.closing" runs its script
1274
- When the process is driven
1275
- Then the process rests at "refactor.build.review.await-review"
1276
- Given a file ".gtd/REVIEW.md" with:
1277
- """
1278
- # Review: abc1234
1279
-
1280
- <!-- base: 0000000 -->
1281
-
1282
- ## calc
1283
-
1284
- - [x] ./src/calc.ts#1-2
1285
- add built on the shared op
1286
- """
1287
- When gtd lands
1288
- And the process is driven
1289
- Then the process rests at "build.quality.correctness.reviewing"
1290
- And the resting step's content contains the hash of the commit "gtd(check): refactor.build.review.closing → implement.building"
1291
- Given step "build.quality.correctness.reviewing" changes nothing
1292
- When the process is driven
1293
- Then the process rests at "build.review.reviewing"
1294
- And the commit subjects end with:
1295
- """
1296
- gtd(check): implement.closing → build.quality.correctness.reviewing
1297
- gtd(agent): build.quality.correctness.reviewing → build.review.reviewing
1298
- """
1299
-
1300
- Rule: a refactor package never carries a test file, and demoted headings stop at ######
1301
-
1302
- Background:
1303
- Given an environment variable "GTD_REFACTORQUALITYREVIEWS" set to ""
1304
- And an environment variable "GTD_SEAMALLOW" set to "docs/**"
1305
- And a file "src/calc.ts" with:
1306
- """
1307
- export const add = (a: number, b: number) => a + b
1308
- """
1309
- And a file "src/calc.test.ts" with:
1310
- """
1311
- import { expect, it } from "vitest"
1312
- it("adds", () => expect(1 + 1).toBe(2))
1313
- """
1314
- And the working tree is committed as "feat: add calculator"
1315
- And a file "TODO.md" with:
1316
- """
1317
- # Add subtract
1318
-
1319
- subtract(a, b) returns the difference.
1320
- """
1321
- And step "unwind" changes nothing
1322
- And step "start-gate.check" changes nothing
1323
- And step "design.triage" writes ".gtd/REQUIREMENTS.md" with:
1324
- """
1325
- # Requirements
1326
-
1327
- ## Concerns
1328
-
1329
- ### Subtract
1330
-
1331
- - `subtract(a, b)` returns `a - b`.
1332
-
1333
- ## Impact
1334
-
1335
- - the greeting module
1336
-
1337
- ## Release Flag
1338
-
1339
- new
1340
-
1341
- ## Acceptance Criteria
1342
-
1343
- - AC-1: the change behaves as described.
1344
- """
1345
- And step "design.gate.answer" changes nothing
1346
- And judge step "seam.judge" answers:
1347
- """
1348
- [{"id":"shape","answer":"refactor-first","p":0.9}]
1349
- """
1350
- And step "seam.note" writes ".gtd/REFACTOR-NOTE.md" with:
1351
- """
1352
- Seam: the existing code the strays touch.
1353
- """
1354
-
1355
- Scenario: a test-file stray is dropped from the derived refactor package
1356
- Given step "seam.check" changes nothing
1357
- And step "seam.naive" writes "src/acceptance.test.ts" with:
1358
- """
1359
- it("[AC-1] holds", () => {})
1360
- """
1361
- And step "seam.naive" writes "src/calc.ts" with:
1362
- """
1363
- export const add = (a: number, b: number) => a + b
1364
- export const subtract = (a: number, b: number) => a - b
1365
- """
1366
- And step "seam.naive" writes "src/calc.test.ts" with:
1367
- """
1368
- import { expect, it } from "vitest"
1369
- it("subtracts", () => expect(3 - 1).toBe(2))
1370
- """
1371
- And step "refactor.deriving" runs its script
1372
- When the process is driven
1373
- Then the process rests at "refactor.building"
1374
- And ".gtd/REFACTOR.md" contains "src/calc.ts"
1375
- And ".gtd/REFACTOR.md" does not contain "src/calc.test.ts"
1376
-
1377
- Scenario: the refactor updates an existing test's call sites to the seam's new shape
1378
- Given step "seam.check" changes nothing
1379
- And step "seam.naive" writes "src/acceptance.test.ts" with:
1380
- """
1381
- it("[AC-1] holds", () => {})
1382
- """
1383
- And step "seam.naive" writes "src/calc.ts" with:
1384
- """
1385
- export const add = ({ a, b }: { a: number; b: number }) => a + b
1386
- export const subtract = ({ a, b }: { a: number; b: number }) => a - b
1387
- """
1388
- And step "refactor.deriving" runs its script
1389
- And step "refactor.building" writes "src/calc.ts" with:
1390
- """
1391
- export const add = ({ a, b }: { a: number; b: number }) => a + b
1392
- """
1393
- And step "refactor.building" writes "src/calc.test.ts" with:
1394
- """
1395
- import { expect, it } from "vitest"
1396
- import { add } from "./calc"
1397
- it("adds", () => expect(add({ a: 1, b: 1 })).toBe(2))
1398
- """
1399
- When the process is driven
1400
- Then the process rests at "refactor.health.check"
1401
-
1402
- Scenario: the refactor may not drop an assertion from an existing test
1403
- Given step "seam.check" changes nothing
1404
- And step "seam.naive" writes "src/acceptance.test.ts" with:
1405
- """
1406
- it("[AC-1] holds", () => {})
1407
- """
1408
- And step "seam.naive" writes "src/calc.ts" with:
1409
- """
1410
- export const add = (a: number, b: number) => a + b
1411
- export const subtract = (a: number, b: number) => a - b
1412
- """
1413
- And step "refactor.deriving" runs its script
1414
- And step "refactor.building" writes "src/calc.test.ts" with:
1415
- """
1416
- import { it } from "vitest"
1417
- it("adds", () => {})
1418
- """
1419
- Then driving the process is refused with "refactor-tests"
1420
-
1421
- Scenario: a refactor-first whose strays are all test files goes straight to implement
1422
- Given step "seam.check" changes nothing
1423
- And step "seam.naive" writes "src/acceptance.test.ts" with:
1424
- """
1425
- it("[AC-1] holds", () => {})
1426
- """
1427
- And step "seam.naive" writes "src/calc.test.ts" with:
1428
- """
1429
- import { expect, it } from "vitest"
1430
- it("subtracts", () => expect(3 - 1).toBe(2))
1431
- """
1432
- When the process is driven
1433
- Then the process rests at "implement.building"
1434
- And ".gtd/REFACTOR.md" does not exist
1435
-
1436
- Scenario: collected review headings re-derive at ### with the deepest capped at ######
1437
- Given step "seam.check" changes nothing
1438
- And step "seam.naive" writes "src/acceptance.test.ts" with:
1439
- """
1440
- it("[AC-1] holds", () => {})
1441
- """
1442
- And step "seam.naive" writes "src/calc.ts" with:
1443
- """
1444
- export const add = (a: number, b: number) => a + b
1445
- export const subtract = (a: number, b: number) => a - b
1446
- """
1447
- And step "refactor.deriving" runs its script
1448
- And step "refactor.building" writes "src/calc.ts" with:
1449
- """
1450
- export const op = (a: number, b: number, sign: number) => a + sign * b
1451
- export const add = (a: number, b: number) => op(a, b, 1)
1452
- """
1453
- And step "refactor.health.check" changes nothing
1454
- And step "refactor.closing" runs its script
1455
- And step "refactor.build.review.carrying" runs its script
1456
- And step "refactor.build.review.reviewing" writes ".gtd/REVIEW.md" with:
1457
- """
1458
- # Review: abc1234
1459
-
1460
- <!-- base: 0000000 -->
1461
-
1462
- ## calc
1463
-
1464
- - [ ] ./src/calc.ts#1-2
1465
- add built on the shared op
1466
- """
1467
- When the process is driven
1468
- Then the process rests at "refactor.build.review.await-review"
1469
- Given a file ".gtd/REVIEW.md" with:
1470
- """
1471
- # Review: abc1234
1472
-
1473
- <!-- base: 0000000 -->
1474
-
1475
- ## calc
1476
-
1477
- - [ ] ./src/calc.ts#1-2
1478
- add built on the shared op[^why]
1479
-
1480
- [^why]:
1481
- - H: name the helper `combine`
1482
- """
1483
- And step "refactor.build.review.collecting" writes ".gtd/REFACTOR.md" with:
1484
- """
1485
- # Rename
1486
-
1487
- ##### Detail
1488
-
1489
- Name the shared helper `combine`.
1490
- """
1491
- And step "refactor.build.review.collecting" writes ".gtd/REVIEW.md" with:
1492
- """
1493
- # Review: abc1234
1494
-
1495
- <!-- base: 0000000 -->
1496
-
1497
- ## calc
1498
-
1499
- - [ ] ./src/calc.ts#1-2
1500
- add built on the shared op[^why]
1501
-
1502
- [^why]:
1503
- - H: name the helper `combine`
1504
- - A: noted in the refactor package.
1505
- """
1506
- When gtd lands
1507
- And the process is driven
1508
- Then the process rests at "refactor.build.review.await-review"
1509
- Given a file ".gtd/REVIEW.md" with:
1510
- """
1511
- # Review: abc1234
1512
-
1513
- <!-- base: 0000000 -->
1514
-
1515
- ## calc
1516
-
1517
- - [ ] ./src/calc.ts#1-2
1518
- add built on the shared op
1519
- """
1520
- And step "refactor.build.review.closing" runs its script
1521
- And step "refactor.re-unwind" runs its script
1522
- And step "refactor.building" is no longer scripted
1523
- When gtd lands
1524
- And the process is driven
1525
- Then the process rests at "refactor.building"
1526
- And ".gtd/REFACTOR.md" contains "## Review feedback"
1527
- And ".gtd/REFACTOR.md" contains "### Rename"
1528
- And ".gtd/REFACTOR.md" contains "###### Detail"