@pmelab/gtd 58.1.0 → 59.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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +115 -390
- package/dist/chunks/{Schema-B3o6eRNU.mjs → testkit-CMBAAyRK.mjs} +13409 -3351
- package/dist/gtd.bundle.mjs +76 -59
- package/dist/testkit/gherkin.mjs +30 -2
- package/dist/testkit.mjs +1 -1
- package/package.json +3 -42
- package/skills/authoring/SKILL.md +31 -25
- package/src/cli/Cli.test.ts +15 -19
- package/src/cli/Cli.ts +2 -4
- package/src/cli/Program.test.ts +60 -29
- package/src/cli/Program.ts +5 -7
- package/src/edge/Edge.ts +3 -3
- package/src/flags/index.test.ts +0 -13
- package/src/flags/index.ts +1 -3
- package/src/gherkin/git-control.feature +78 -0
- package/src/gherkin/index.ts +35 -1
- package/src/install/Install.test.ts +14 -11
- package/src/install/Install.ts +38 -15
- package/src/install/index.ts +1 -2
- package/src/replay/Replay.test.ts +1 -1
- package/src/replay/index.ts +1 -1
- package/src/step/planStart.ts +6 -1
- package/src/testkit/TestRepo.test.ts +118 -2
- package/src/testkit/TestRepo.ts +57 -6
- package/src/testkit/index.ts +1 -0
- package/src/twins/EmittedScriptRecognizer.ts +12 -14
- package/src/twins/FlowScripts.ts +10 -9
- package/src/twins/InMemRepo.ts +26 -1
- package/src/twins/Layers.ts +12 -1
- package/src/twins/index.ts +6 -1
- package/src/workflow/index.ts +1 -0
- package/src/workflow/load.test.ts +138 -113
- package/src/workflow/load.ts +1 -1
- package/src/workflow/vars.test.ts +30 -3
- package/src/workflow/vars.ts +34 -2
- package/src/workflow-kit/index.ts +1 -1
- package/dist/chunks/reserved-lMYCaapY.mjs +0 -1990
- package/dist/chunks/review-Bfaror38.mjs +0 -427
- package/dist/chunks/tail-Bd7L940p.mjs +0 -355
- package/dist/chunks/testkit-D1-auYau.mjs +0 -10362
- package/dist/workflows/cleanup.mjs +0 -36
- package/dist/workflows/feature.mjs +0 -1018
- package/dist/workflows/fix.mjs +0 -41
- package/dist/workflows/review.mjs +0 -45
- package/dist/workflows/rollout.mjs +0 -48
- package/dist/workflows.mjs +0 -40651
- package/src/install/ConfigScaffold.ts +0 -22
- package/src/workflows/cleanup/cleanup-path.feature +0 -94
- package/src/workflows/cleanup/cleanup.feature +0 -315
- package/src/workflows/cleanup/cleanup.test.ts +0 -276
- package/src/workflows/cleanup/cleanup.ts +0 -52
- package/src/workflows/cleanup/index.ts +0 -6
- package/src/workflows/feature/acceptance-criteria-tier.feature +0 -25
- package/src/workflows/feature/acceptance-criteria.feature +0 -389
- package/src/workflows/feature/criteria-coverage.feature +0 -102
- package/src/workflows/feature/criteria.test.ts +0 -147
- package/src/workflows/feature/criteria.ts +0 -267
- package/src/workflows/feature/fast-path.feature +0 -93
- package/src/workflows/feature/feature.test.ts +0 -338
- package/src/workflows/feature/feature.ts +0 -156
- package/src/workflows/feature/green.ts +0 -19
- package/src/workflows/feature/index.ts +0 -18
- package/src/workflows/feature/lens-models.feature +0 -69
- package/src/workflows/feature/lens-review.feature +0 -566
- package/src/workflows/feature/naive-acceptance.feature +0 -147
- package/src/workflows/feature/naive-test.feature +0 -263
- package/src/workflows/feature/one-step-land.feature +0 -93
- package/src/workflows/feature/planning.ts +0 -41
- package/src/workflows/feature/refactor-absorbs.feature +0 -131
- package/src/workflows/feature/refactor-first.feature +0 -158
- package/src/workflows/feature/refactor-lens-models.feature +0 -79
- package/src/workflows/feature/refactor-rebuild.feature +0 -273
- package/src/workflows/feature/refactor-review.feature +0 -1528
- package/src/workflows/feature/refactor.test.ts +0 -1220
- package/src/workflows/feature/refactor.ts +0 -368
- package/src/workflows/feature/release-flag.feature +0 -167
- package/src/workflows/feature/release-flag.test.ts +0 -49
- package/src/workflows/feature/release-flag.ts +0 -46
- package/src/workflows/feature/review-gate.feature +0 -241
- package/src/workflows/feature/reviewer-walkthrough.feature +0 -142
- package/src/workflows/feature/risk-tier.feature +0 -351
- package/src/workflows/feature/seam-rejection.feature +0 -146
- package/src/workflows/feature/seam.feature +0 -297
- package/src/workflows/feature/seam.test.ts +0 -527
- package/src/workflows/feature/seam.ts +0 -426
- package/src/workflows/feature/standards.feature +0 -354
- package/src/workflows/feature/steps.test.ts +0 -65
- package/src/workflows/feature/steps.ts +0 -45
- package/src/workflows/feature/tier-pin.feature +0 -66
- package/src/workflows/feature/tier.test.ts +0 -166
- package/src/workflows/feature/tier.ts +0 -56
- package/src/workflows/fix/fix-lens-origin.feature +0 -114
- package/src/workflows/fix/fix-quality.feature +0 -212
- package/src/workflows/fix/fix.feature +0 -79
- package/src/workflows/fix/fix.test.ts +0 -74
- package/src/workflows/fix/fix.ts +0 -52
- package/src/workflows/fix/index.ts +0 -6
- package/src/workflows/index.ts +0 -47
- package/src/workflows/review/index.ts +0 -6
- package/src/workflows/review/review-door.feature +0 -199
- package/src/workflows/review/review.test.ts +0 -27
- package/src/workflows/review/review.ts +0 -60
- package/src/workflows/rollout/index.ts +0 -6
- package/src/workflows/rollout/rollout.feature +0 -510
- package/src/workflows/rollout/rollout.test.ts +0 -263
- package/src/workflows/rollout/rollout.ts +0 -82
- package/src/workflows/shared/__fixtures__/feature-collecting-prompt.txt +0 -98
- package/src/workflows/shared/access.test.ts +0 -62
- package/src/workflows/shared/access.ts +0 -24
- package/src/workflows/shared/config.fixture.ts +0 -12
- package/src/workflows/shared/fences.ts +0 -24
- package/src/workflows/shared/health.test.ts +0 -148
- package/src/workflows/shared/health.ts +0 -191
- package/src/workflows/shared/learn.test.ts +0 -140
- package/src/workflows/shared/learn.ts +0 -201
- package/src/workflows/shared/lenses.test.ts +0 -39
- package/src/workflows/shared/lenses.ts +0 -294
- package/src/workflows/shared/options.test.ts +0 -157
- package/src/workflows/shared/options.ts +0 -92
- package/src/workflows/shared/progress.feature +0 -124
- package/src/workflows/shared/prose.ts +0 -263
- package/src/workflows/shared/recheck.feature +0 -60
- package/src/workflows/shared/registry.test.ts +0 -345
- package/src/workflows/shared/registry.ts +0 -183
- package/src/workflows/shared/reserved.ts +0 -11
- package/src/workflows/shared/review.test.ts +0 -1062
- package/src/workflows/shared/review.ts +0 -446
- package/src/workflows/shared/skills.test.ts +0 -121
- package/src/workflows/shared/skills.ts +0 -49
- package/src/workflows/shared/standards.test.ts +0 -90
- package/src/workflows/shared/standards.ts +0 -156
- package/src/workflows/shared/steps.test.ts +0 -219
- package/src/workflows/shared/steps.ts +0 -201
- package/src/workflows/shared/tail.test.ts +0 -454
- package/src/workflows/shared/tail.ts +0 -264
- package/src/workflows/shared/text.fixture.ts +0 -128
- package/src/workflows/shared/text.test.ts +0 -1430
- package/src/workflows/shared/text.ts +0 -1700
- package/src/workflows/shared/threads.test.ts +0 -129
- package/src/workflows/shared/vars.ts +0 -47
- package/src/workflows/shared/workflows.steps.ts +0 -54
|
@@ -1,276 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest"
|
|
2
|
-
import { CONFIG_SCAFFOLD } from "../../install/index.js"
|
|
3
|
-
import { testRepo, type TestRepo } from "../../testkit/index.js"
|
|
4
|
-
import { reviewDoc } from "../shared/config.fixture.js"
|
|
5
|
-
|
|
6
|
-
type Actors = NonNullable<Parameters<TestRepo["drive"]>[0]>
|
|
7
|
-
|
|
8
|
-
const CONFIG = `${CONFIG_SCAFFOLD}export { cleanup } from "@pmelab/gtd/workflows"\n`
|
|
9
|
-
|
|
10
|
-
const REGISTRY = `export const FLAGS = [
|
|
11
|
-
{ name: "alpha", owner: "a", expiry: "2027-01-01", kind: "release" },
|
|
12
|
-
{ name: "ops1", owner: "c", expiry: "2027-03-01", kind: "ops" },
|
|
13
|
-
{ name: "live", owner: "d", expiry: "2027-04-01", kind: "release", defaultOn: true },
|
|
14
|
-
] as const
|
|
15
|
-
`
|
|
16
|
-
const WITHOUT_LIVE = REGISTRY.replace(/ \{ name: "live".*\n/, "")
|
|
17
|
-
const SOURCE = "export const on = process.env.GTD_FLAG_LIVE !== '0'\n"
|
|
18
|
-
|
|
19
|
-
const repoWith = () =>
|
|
20
|
-
testRepo({
|
|
21
|
-
workflow: CONFIG,
|
|
22
|
-
env: { GTD_QUALITYREVIEWS: "" },
|
|
23
|
-
files: { "src/flags/index.ts": REGISTRY, "src/a.ts": SOURCE },
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
describe("the cleanup workflow", () => {
|
|
27
|
-
it("lands a removal and reaches the review", async () => {
|
|
28
|
-
const repo = repoWith()
|
|
29
|
-
await repo.start("cleanup", "--var", "flag=live")
|
|
30
|
-
const rest = await repo.drive({
|
|
31
|
-
"cleanup.removing": (beat, r) => {
|
|
32
|
-
expect(beat.content).toContain("live")
|
|
33
|
-
r.write("src/flags/index.ts", WITHOUT_LIVE)
|
|
34
|
-
r.write("src/a.ts", "export const on = true\n")
|
|
35
|
-
},
|
|
36
|
-
"build.health.check": () => undefined,
|
|
37
|
-
})
|
|
38
|
-
expect(rest).toMatchObject({ state: "build.review.reviewing", actor: "agent" })
|
|
39
|
-
})
|
|
40
|
-
|
|
41
|
-
it("refuses to start over a pending hand-off", async () => {
|
|
42
|
-
const repo = testRepo({
|
|
43
|
-
workflow: CONFIG,
|
|
44
|
-
files: {
|
|
45
|
-
"src/flags/index.ts": REGISTRY,
|
|
46
|
-
".gtd/REVIEW.md": "# Review: abc1234\n",
|
|
47
|
-
".gtd/REVIEW.orig.md": "# Review: abc1234\n",
|
|
48
|
-
},
|
|
49
|
-
})
|
|
50
|
-
await expect(repo.start("cleanup", "--var", "flag=live")).rejects.toThrow(
|
|
51
|
-
".gtd/REVIEW.orig.md is a pending hand-off",
|
|
52
|
-
)
|
|
53
|
-
})
|
|
54
|
-
|
|
55
|
-
it("refuses a turn that leaves the registry entry", async () => {
|
|
56
|
-
const repo = repoWith()
|
|
57
|
-
await repo.start("cleanup", "--var", "flag=live")
|
|
58
|
-
await expect(
|
|
59
|
-
repo.drive({ "cleanup.removing": (_, r) => r.write("src/a.ts", "export const on = true\n") }),
|
|
60
|
-
).rejects.toThrow('gtd land: cleanup: src/flags/index.ts still declares flag "live"')
|
|
61
|
-
})
|
|
62
|
-
|
|
63
|
-
it("refuses a turn leaving the env var in a shipped source, naming path:line", async () => {
|
|
64
|
-
const repo = repoWith()
|
|
65
|
-
await repo.start("cleanup", "--var", "flag=live")
|
|
66
|
-
await expect(
|
|
67
|
-
repo.drive({ "cleanup.removing": (_, r) => r.write("src/flags/index.ts", WITHOUT_LIVE) }),
|
|
68
|
-
).rejects.toThrow("gtd land: cleanup: src/a.ts:1 still names GTD_FLAG_LIVE")
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
it.each([
|
|
72
|
-
[[], "gtd: cleanup needs --var flag=<name>"],
|
|
73
|
-
[["--var", "flag=nope"], 'gtd: cleanup: no flag "nope" in src/flags/index.ts'],
|
|
74
|
-
[["--var", "flag=ops1"], 'gtd: cleanup: flag "ops1" is ops, not release'],
|
|
75
|
-
[["--var", "flag=alpha"], 'gtd: cleanup: flag "alpha" is not default-on — roll it out first'],
|
|
76
|
-
])("refuses %j at start", async (args, message) => {
|
|
77
|
-
await expect(repoWith().start("cleanup", ...args)).rejects.toThrow(message)
|
|
78
|
-
})
|
|
79
|
-
})
|
|
80
|
-
|
|
81
|
-
describe("the cleanup guard over every later agent turn", () => {
|
|
82
|
-
const FEEDBACK = ".gtd/FEEDBACK.md"
|
|
83
|
-
const CLEAN = "export const on = true\n"
|
|
84
|
-
const NAMED = "export const on = process.env.GTD_FLAG_LIVE\n"
|
|
85
|
-
const REMOVED: Actors = {
|
|
86
|
-
"cleanup.removing": (_, r) => {
|
|
87
|
-
r.write("src/flags/index.ts", WITHOUT_LIVE)
|
|
88
|
-
r.write("src/a.ts", CLEAN)
|
|
89
|
-
},
|
|
90
|
-
"build.health.check": () => undefined,
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// One lens finding, judged mechanical, so it reaches the fix turn.
|
|
94
|
-
const MECHANICAL: Actors = {
|
|
95
|
-
"build.quality.correctness.reviewing": (_, r) =>
|
|
96
|
-
r.write(".gtd/QUALITY.md", "# Quality\n\n## a finding\n\nFix it.\n"),
|
|
97
|
-
"build.quality.triage": () => '[{"id":"Q1","answer":"mechanical","p":0.9}]',
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Without the shipped access rules, which would refuse a source write from a read-only turn first: the guard is the second line.
|
|
101
|
-
const NO_ACCESS = CONFIG.replace(" access,\n", "")
|
|
102
|
-
|
|
103
|
-
const guarded = (lenses = "", workflow = CONFIG) =>
|
|
104
|
-
testRepo({
|
|
105
|
-
workflow,
|
|
106
|
-
env: { GTD_QUALITYREVIEWS: lenses },
|
|
107
|
-
files: {
|
|
108
|
-
"src/flags/index.ts": REGISTRY,
|
|
109
|
-
"src/a.ts": SOURCE,
|
|
110
|
-
"src/calc.ts": "export const add = 1\n",
|
|
111
|
-
},
|
|
112
|
-
})
|
|
113
|
-
|
|
114
|
-
const redOnce = (): Actors => {
|
|
115
|
-
let runs = 0
|
|
116
|
-
return {
|
|
117
|
-
"build.health.check": (_, r) => {
|
|
118
|
-
if (runs++ === 0) r.write(FEEDBACK, "1 failing\n")
|
|
119
|
-
},
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
const driven = async (repo: ReturnType<typeof guarded>, actors: Actors) => {
|
|
124
|
-
await repo.start("cleanup", "--var", "flag=live")
|
|
125
|
-
return repo.drive({ ...REMOVED, ...actors })
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
it("refuses a build.fix that restores the registry entry", async () => {
|
|
129
|
-
await expect(
|
|
130
|
-
driven(guarded(), {
|
|
131
|
-
...redOnce(),
|
|
132
|
-
"build.fix": (_, r) => r.write("src/flags/index.ts", REGISTRY),
|
|
133
|
-
}),
|
|
134
|
-
).rejects.toThrow('src/flags/index.ts still declares flag "live"')
|
|
135
|
-
})
|
|
136
|
-
|
|
137
|
-
it("refuses a build.fix that adds the env var to a source, naming path:line", async () => {
|
|
138
|
-
await expect(
|
|
139
|
-
driven(guarded(), { ...redOnce(), "build.fix": (_, r) => r.write("src/b.ts", NAMED) }),
|
|
140
|
-
).rejects.toThrow("gtd land: cleanup: src/b.ts:1 still names GTD_FLAG_LIVE")
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
it("lets a build.fix add the env var to a test file", async () => {
|
|
144
|
-
const rest = await driven(guarded(), {
|
|
145
|
-
...redOnce(),
|
|
146
|
-
"build.fix": (_, r) => r.write("src/b.test.ts", NAMED),
|
|
147
|
-
})
|
|
148
|
-
expect(rest.state).toBe("build.review.reviewing")
|
|
149
|
-
})
|
|
150
|
-
|
|
151
|
-
it("lets a build.fix touching only another file reach the review", async () => {
|
|
152
|
-
const rest = await driven(guarded(), {
|
|
153
|
-
...redOnce(),
|
|
154
|
-
"build.fix": (_, r) => r.write("src/other.ts", CLEAN),
|
|
155
|
-
})
|
|
156
|
-
expect(rest).toMatchObject({ state: "build.review.reviewing", actor: "agent" })
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
it("refuses the human's build.health.stop landing that restores the registry entry", async () => {
|
|
160
|
-
let stopped = false
|
|
161
|
-
let runs = 0
|
|
162
|
-
const repo = guarded()
|
|
163
|
-
await repo.start("cleanup", "--var", "flag=live")
|
|
164
|
-
await expect(
|
|
165
|
-
repo.drive({
|
|
166
|
-
...REMOVED,
|
|
167
|
-
"build.health.check": (_, r) => {
|
|
168
|
-
if (!stopped) r.write(FEEDBACK, `failing ${runs++}\n`)
|
|
169
|
-
},
|
|
170
|
-
"build.health.recheck": (_, r) => r.write(FEEDBACK, `failing ${runs++}\n`),
|
|
171
|
-
"build.health.describe": () => undefined,
|
|
172
|
-
"build.health.judge": () => '[{"id":"verdict","answer":"progress","p":0.9}]',
|
|
173
|
-
"build.fix": (_, r) => r.write("src/other.ts", `export const n = ${runs}\n`),
|
|
174
|
-
"build.health.stop": (_, r) => {
|
|
175
|
-
stopped = true
|
|
176
|
-
r.write("src/flags/index.ts", REGISTRY)
|
|
177
|
-
},
|
|
178
|
-
}),
|
|
179
|
-
).rejects.toThrow('still declares flag "live"')
|
|
180
|
-
})
|
|
181
|
-
|
|
182
|
-
it("refuses an escalation describe turn that re-adds the env var", async () => {
|
|
183
|
-
let runs = 0
|
|
184
|
-
await expect(
|
|
185
|
-
driven(guarded("", NO_ACCESS), {
|
|
186
|
-
"build.health.check": (_, r) => r.write(FEEDBACK, `failing ${runs++}\n`),
|
|
187
|
-
"build.health.recheck": (_, r) => r.write(FEEDBACK, `failing ${runs++}\n`),
|
|
188
|
-
"build.health.judge": () => '[{"id":"verdict","answer":"progress","p":0.9}]',
|
|
189
|
-
"build.fix": (_, r) => r.write("src/other.ts", `export const n = ${runs}\n`),
|
|
190
|
-
"build.health.describe": (_, r) => r.write("src/b.ts", NAMED),
|
|
191
|
-
}),
|
|
192
|
-
).rejects.toThrow("src/b.ts:1 still names GTD_FLAG_LIVE")
|
|
193
|
-
})
|
|
194
|
-
|
|
195
|
-
it("refuses a quality fix turn that re-adds the env var", async () => {
|
|
196
|
-
await expect(
|
|
197
|
-
driven(guarded("correctness", NO_ACCESS), {
|
|
198
|
-
...MECHANICAL,
|
|
199
|
-
"build.fix.quality.fixing": (_, r) => r.write("src/b.ts", NAMED),
|
|
200
|
-
}),
|
|
201
|
-
).rejects.toThrow("src/b.ts:1 still names GTD_FLAG_LIVE")
|
|
202
|
-
})
|
|
203
|
-
|
|
204
|
-
it("refuses a quality lens turn that re-adds the env var", async () => {
|
|
205
|
-
await expect(
|
|
206
|
-
driven(guarded("correctness", NO_ACCESS), {
|
|
207
|
-
"build.quality.correctness.reviewing": (_, r) => r.write("src/b.ts", NAMED),
|
|
208
|
-
}),
|
|
209
|
-
).rejects.toThrow("src/b.ts:1 still names GTD_FLAG_LIVE")
|
|
210
|
-
})
|
|
211
|
-
|
|
212
|
-
it("refuses a quality fix turn that restores the registry entry", async () => {
|
|
213
|
-
await expect(
|
|
214
|
-
driven(guarded("correctness"), {
|
|
215
|
-
...MECHANICAL,
|
|
216
|
-
"build.fix.quality.fixing": (_, r) => r.write("src/flags/index.ts", REGISTRY),
|
|
217
|
-
}),
|
|
218
|
-
).rejects.toThrow('still declares flag "live"')
|
|
219
|
-
})
|
|
220
|
-
|
|
221
|
-
it("refuses a risk fix turn that restores the registry entry", async () => {
|
|
222
|
-
await expect(
|
|
223
|
-
driven(guarded(), {
|
|
224
|
-
"build.review.reviewing": (_, r) => r.write(".gtd/REVIEW.md", reviewDoc("Risk: leaks")),
|
|
225
|
-
"build.review.fix.risks.fixing": (_, r) => r.write("src/flags/index.ts", REGISTRY),
|
|
226
|
-
}),
|
|
227
|
-
).rejects.toThrow('still declares flag "live"')
|
|
228
|
-
})
|
|
229
|
-
|
|
230
|
-
it("refuses a review turn that re-adds the env var", async () => {
|
|
231
|
-
await expect(
|
|
232
|
-
driven(guarded("", NO_ACCESS), {
|
|
233
|
-
"build.review.reviewing": (_, r) => {
|
|
234
|
-
r.write(".gtd/REVIEW.md", reviewDoc("fine"))
|
|
235
|
-
r.write("src/b.ts", NAMED)
|
|
236
|
-
},
|
|
237
|
-
}),
|
|
238
|
-
).rejects.toThrow("src/b.ts:1 still names GTD_FLAG_LIVE")
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
it("leaves the human's review sign-off unguarded", async () => {
|
|
242
|
-
const repo = guarded()
|
|
243
|
-
await repo.start("cleanup", "--var", "flag=live")
|
|
244
|
-
const rest = await repo.drive({
|
|
245
|
-
...REMOVED,
|
|
246
|
-
"build.review.reviewing": (_, r) => r.write(".gtd/REVIEW.md", reviewDoc("fine")),
|
|
247
|
-
})
|
|
248
|
-
expect(rest.state).toBe("build.review.await-review")
|
|
249
|
-
repo.write("src/flags/index.ts", REGISTRY)
|
|
250
|
-
await repo.land()
|
|
251
|
-
const done = await repo.drive({ "build.review.closing": () => undefined })
|
|
252
|
-
expect(done.state).not.toBe("build.review.await-review")
|
|
253
|
-
})
|
|
254
|
-
|
|
255
|
-
it("does not blame a later fix turn for the entry the human restored at sign-off", async () => {
|
|
256
|
-
const repo = guarded()
|
|
257
|
-
await repo.start("cleanup", "--var", "flag=live")
|
|
258
|
-
let runs = 0
|
|
259
|
-
const check: Actors = {
|
|
260
|
-
"build.health.check": (_, r) => {
|
|
261
|
-
if (runs++ === 1) r.write(FEEDBACK, "1 failing\n")
|
|
262
|
-
},
|
|
263
|
-
}
|
|
264
|
-
const rest = await repo.drive({
|
|
265
|
-
...REMOVED,
|
|
266
|
-
...check,
|
|
267
|
-
"build.review.reviewing": (_, r) => r.write(".gtd/REVIEW.md", reviewDoc("fine")),
|
|
268
|
-
})
|
|
269
|
-
expect(rest.state).toBe("build.review.await-review")
|
|
270
|
-
repo.write("src/flags/index.ts", REGISTRY)
|
|
271
|
-
repo.write("src/hand.ts", CLEAN)
|
|
272
|
-
await repo.land()
|
|
273
|
-
await repo.drive({ ...check, "build.fix": (_, r) => r.write("src/other.ts", CLEAN) })
|
|
274
|
-
expect(repo.subjects()).toContain("gtd(agent): build.fix → build.health.check")
|
|
275
|
-
})
|
|
276
|
-
})
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { agent, changes, glob, read, refuse, scope, start, vars } from "../../flows/index.js"
|
|
2
|
-
import { flagShipped } from "../shared/options.js"
|
|
3
|
-
import { flagReferences, registryEntry, requireFlag } from "../shared/registry.js"
|
|
4
|
-
import { coder } from "../shared/steps.js"
|
|
5
|
-
import { handOffTail, refusePendingHandOff } from "../shared/tail.js"
|
|
6
|
-
|
|
7
|
-
const removingPrompt = (name: string, registry: string): string =>
|
|
8
|
-
`Clean up the release flag "${name}", which is default-on: delete its entry in ${registry}, and remove every \`GTD_FLAG_${name.toUpperCase()}\` check from the shipped sources. Keep the flag-on path; delete code only the off path reached, including tests that pin the off path.`
|
|
9
|
-
|
|
10
|
-
export const cleanupFlow = async (): Promise<void> => {
|
|
11
|
-
const registry = vars.flagRegistry ?? ""
|
|
12
|
-
const name = vars.flag ?? ""
|
|
13
|
-
// Before the turn, never after: replay re-runs every pre-turn check.
|
|
14
|
-
refusePendingHandOff()
|
|
15
|
-
requireFlag("cleanup", registry, name, true)
|
|
16
|
-
// After `removing` both checks are per-turn: only a turn that touched the registry or a source is refused, so the human's unguarded sign-off edits are never blamed on a later agent turn.
|
|
17
|
-
let scanned = false
|
|
18
|
-
const guard = (): void => {
|
|
19
|
-
const turn = scanned ? changes() : undefined
|
|
20
|
-
if (
|
|
21
|
-
(turn === undefined || turn.some((c) => c.path === registry)) &&
|
|
22
|
-
registryEntry(read(registry) ?? "", name) !== undefined
|
|
23
|
-
) {
|
|
24
|
-
refuse(`gtd land: cleanup: ${registry} still declares flag "${name}"`)
|
|
25
|
-
}
|
|
26
|
-
const paths =
|
|
27
|
-
turn === undefined
|
|
28
|
-
? [...glob("src/**/*.ts"), ...glob("src/**/*.tsx")]
|
|
29
|
-
: turn
|
|
30
|
-
.filter((c) => c.status !== "deleted")
|
|
31
|
-
.map((c) => c.path)
|
|
32
|
-
.filter((path) => path.startsWith("src/") && /\.tsx?$/.test(path))
|
|
33
|
-
const hits = flagReferences(
|
|
34
|
-
paths.map((path) => ({ path, text: read(path) ?? "" })),
|
|
35
|
-
name,
|
|
36
|
-
)
|
|
37
|
-
if (hits.length > 0) {
|
|
38
|
-
refuse(`gtd land: cleanup: ${hits.join(", ")} still names GTD_FLAG_${name.toUpperCase()}`)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
await scope("cleanup", async () => {
|
|
42
|
-
await agent("removing", removingPrompt(name, registry), {
|
|
43
|
-
label: `Removing ${name}`,
|
|
44
|
-
model: coder(),
|
|
45
|
-
})
|
|
46
|
-
guard()
|
|
47
|
-
scanned = true
|
|
48
|
-
})
|
|
49
|
-
await handOffTail(false, start(), guard)
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
export const cleanup = flagShipped(cleanupFlow, "cleanup")
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
@inmem
|
|
2
|
-
Feature: with GTD_FLAG_RISK_TIER on, stated acceptance criteria never skip design
|
|
3
|
-
|
|
4
|
-
The risk tier is proposed at `design.triage` and set at the design gate, so
|
|
5
|
-
with the flag on a sketch that states its own criteria still runs triage and
|
|
6
|
-
is never judged at `design.clear`.
|
|
7
|
-
|
|
8
|
-
Scenario: stated criteria go through triage, where the tier is proposed and set
|
|
9
|
-
Given the shipped workflows, as gtd install scaffolds them
|
|
10
|
-
And an environment variable "GTD_QUALITYREVIEWS" set to ""
|
|
11
|
-
And an environment variable "GTD_FLAG_RISK_TIER" set to "1"
|
|
12
|
-
And step "unwind" changes nothing
|
|
13
|
-
And step "start-gate.check" changes nothing
|
|
14
|
-
And a file "TODO.md" with:
|
|
15
|
-
"""
|
|
16
|
-
## Acceptance criteria
|
|
17
|
-
|
|
18
|
-
- `greeting` reads "Hello, world".
|
|
19
|
-
"""
|
|
20
|
-
When the process is driven
|
|
21
|
-
Then the process rests at "design.triage"
|
|
22
|
-
And the commit subjects end with:
|
|
23
|
-
"""
|
|
24
|
-
gtd(check): start-gate.check → design.triage
|
|
25
|
-
"""
|