@pmelab/gtd 24.0.0 → 24.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (196) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +31 -5
  3. package/claude/hooks/access.ts +1 -1
  4. package/dist/chunks/Schema-Dh-mkwkq.mjs +25353 -0
  5. package/dist/chunks/reserved-ejn-LVYO.mjs +1388 -0
  6. package/dist/chunks/rolldown-runtime-8H4AJuhK.mjs +14 -0
  7. package/dist/chunks/steering-D-PvRC5W.mjs +16296 -0
  8. package/dist/chunks/wire-DA7q2ikx.mjs +473 -0
  9. package/dist/flows.mjs +525 -0
  10. package/dist/gtd.bundle.mjs +43339 -55575
  11. package/dist/steering.mjs +2 -0
  12. package/dist/testkit.mjs +13006 -0
  13. package/dist/wire.mjs +2 -0
  14. package/dist/workflow-kit.mjs +352 -0
  15. package/dist/workflows/feature.mjs +315 -0
  16. package/dist/workflows/fix.mjs +40 -0
  17. package/dist/workflows/review.mjs +25 -0
  18. package/dist/workflows.mjs +8 -6
  19. package/package.json +69 -8
  20. package/src/cli/Cli.test.ts +1329 -0
  21. package/src/cli/Cli.ts +1348 -0
  22. package/src/cli/Program.test.ts +2262 -0
  23. package/src/cli/Program.ts +1331 -0
  24. package/src/cli/ToolCommands.ts +43 -0
  25. package/src/cli/index.ts +14 -0
  26. package/src/edge/Edge.test.ts +1016 -0
  27. package/src/edge/Edge.ts +1225 -0
  28. package/src/edge/index.ts +16 -0
  29. package/src/emit/Emit.test.ts +425 -0
  30. package/src/emit/Emit.ts +139 -0
  31. package/src/emit/GitScript.test.ts +260 -0
  32. package/src/emit/GitScript.ts +131 -0
  33. package/src/emit/ModeContradiction.test.ts +120 -0
  34. package/src/emit/ModeContradiction.ts +66 -0
  35. package/src/emit/OutcomeScript.test.ts +238 -0
  36. package/src/emit/OutcomeScript.ts +73 -0
  37. package/src/emit/SteeringMode.test.ts +274 -0
  38. package/src/emit/SteeringMode.ts +256 -0
  39. package/src/emit/index.ts +40 -0
  40. package/src/install/ConfigScaffold.ts +19 -0
  41. package/src/install/Install.test.ts +426 -0
  42. package/src/install/Install.ts +634 -0
  43. package/src/install/Version.ts +27 -0
  44. package/src/install/index.ts +3 -0
  45. package/src/platform/CommandRunner.ts +74 -0
  46. package/src/platform/Commentary.test.ts +126 -0
  47. package/src/platform/Commentary.ts +92 -0
  48. package/src/platform/Git.test.ts +50 -0
  49. package/src/platform/Git.ts +552 -0
  50. package/src/platform/Host.ts +42 -0
  51. package/src/platform/RetainedHistory.test.ts +65 -0
  52. package/src/platform/RetainedHistory.ts +34 -0
  53. package/src/platform/Workspace.test.ts +669 -0
  54. package/src/platform/Workspace.ts +631 -0
  55. package/src/platform/WorktreeState.test.ts +162 -0
  56. package/src/platform/WorktreeState.ts +50 -0
  57. package/src/platform/index.ts +22 -0
  58. package/src/replay/Access.test.ts +53 -0
  59. package/src/replay/Access.ts +46 -0
  60. package/src/replay/Format.test.ts +20 -0
  61. package/src/replay/Format.ts +14 -0
  62. package/src/replay/Replay.test.ts +887 -0
  63. package/src/replay/Replay.ts +669 -0
  64. package/src/replay/Trailers.test.ts +117 -0
  65. package/src/replay/Trailers.ts +213 -0
  66. package/src/replay/Tree.test.ts +25 -0
  67. package/src/replay/Tree.ts +45 -0
  68. package/src/replay/index.ts +11 -0
  69. package/src/steering/Blocks.fixture.ts +6 -0
  70. package/src/steering/Blocks.test.ts +167 -0
  71. package/src/steering/Blocks.ts +321 -0
  72. package/src/steering/CodeThreads.test.ts +127 -0
  73. package/src/steering/CodeThreads.ts +197 -0
  74. package/src/steering/Edits.test.ts +19 -0
  75. package/src/steering/Edits.ts +20 -0
  76. package/src/steering/Eol.test.ts +16 -0
  77. package/src/steering/Eol.ts +2 -0
  78. package/src/steering/FORMATS.md +58 -0
  79. package/src/steering/Footnotes.test.ts +977 -0
  80. package/src/steering/Footnotes.ts +661 -0
  81. package/src/steering/Inline.fixture.ts +7 -0
  82. package/src/steering/Inline.test.ts +227 -0
  83. package/src/steering/Inline.ts +195 -0
  84. package/src/steering/MarkdownTree.test.ts +247 -0
  85. package/src/steering/MarkdownTree.ts +260 -0
  86. package/src/steering/Outline.ts +19 -0
  87. package/src/steering/SteeringFormat.test.ts +91 -0
  88. package/src/steering/SteeringFormat.ts +267 -0
  89. package/src/steering/SteeringFormats.test.ts +163 -0
  90. package/src/steering/Threads.ts +163 -0
  91. package/src/steering/contract.test.ts +264 -0
  92. package/src/steering/fixtures/code-threads/cache.stripped.ts.txt +6 -0
  93. package/src/steering/fixtures/code-threads/cache.ts.md +15 -0
  94. package/src/steering/fixtures/free-form/notes.md +12 -0
  95. package/src/steering/fixtures/free-form/notes.read.json +42 -0
  96. package/src/steering/fixtures/qa/answered.md +23 -0
  97. package/src/steering/fixtures/qa/answered.read.json +119 -0
  98. package/src/steering/fixtures/qa/requirements.md +160 -0
  99. package/src/steering/fixtures/qa/requirements.read.json +475 -0
  100. package/src/steering/fixtures/review/review.md +76 -0
  101. package/src/steering/fixtures/review/review.read.json +237 -0
  102. package/src/steering/fixtures/review/ticked.md +23 -0
  103. package/src/steering/fixtures/review/ticked.read.json +99 -0
  104. package/src/steering/fixtures/review-notes/baseline.md +14 -0
  105. package/src/steering/fixtures/review-notes/noted.md +19 -0
  106. package/src/steering/freeform.test.ts +311 -0
  107. package/src/steering/freeform.ts +148 -0
  108. package/src/steering/index.test.ts +62 -0
  109. package/src/steering/index.ts +140 -0
  110. package/src/steering/qa.test.ts +2160 -0
  111. package/src/steering/qa.ts +1104 -0
  112. package/src/steering/review.test.ts +1829 -0
  113. package/src/steering/review.ts +1180 -0
  114. package/src/step/LandStep.ts +31 -0
  115. package/src/step/RepoSnapshot.ts +29 -0
  116. package/src/step/accessRefusal.test.ts +58 -0
  117. package/src/step/accessRefusal.ts +26 -0
  118. package/src/step/index.ts +5 -0
  119. package/src/step/planStart.test.ts +202 -0
  120. package/src/step/planStart.ts +167 -0
  121. package/src/step/planStep.test.ts +104 -0
  122. package/src/step/planStep.ts +89 -0
  123. package/src/step/snapshot.fixture.ts +28 -0
  124. package/src/testkit/EmittedScriptRecognizer.test.ts +639 -0
  125. package/src/testkit/EmittedScriptRecognizer.ts +642 -0
  126. package/src/testkit/FakeGitOperations.ts +95 -0
  127. package/src/testkit/GitTiers.test.ts +11 -0
  128. package/src/testkit/GitTiers.ts +1052 -0
  129. package/src/testkit/InMemRepo.ts +467 -0
  130. package/src/testkit/Layers.test.ts +58 -0
  131. package/src/testkit/Layers.ts +241 -0
  132. package/src/testkit/StrictGitOperations.ts +31 -0
  133. package/src/testkit/TestRepo.test.ts +119 -0
  134. package/src/testkit/TestRepo.ts +274 -0
  135. package/src/testkit/cliIo.ts +36 -0
  136. package/src/testkit/index.ts +9 -0
  137. package/src/testkit/steps.ts +177 -0
  138. package/src/testkit/testkit.feature +65 -0
  139. package/src/wire/BeatDocument.test.ts +419 -0
  140. package/src/wire/BeatDocument.ts +114 -0
  141. package/src/wire/BeatPlain.test.ts +113 -0
  142. package/src/wire/BeatPlain.ts +127 -0
  143. package/src/wire/BeatStatus.test.ts +59 -0
  144. package/src/wire/BeatStatus.ts +81 -0
  145. package/src/wire/Demand.test.ts +142 -0
  146. package/src/wire/Demand.ts +108 -0
  147. package/src/wire/ExitCodes.test.ts +21 -0
  148. package/src/wire/ExitCodes.ts +16 -0
  149. package/src/wire/Glob.ts +29 -0
  150. package/src/wire/Judge.ts +22 -0
  151. package/src/wire/Land.test.ts +120 -0
  152. package/src/wire/Land.ts +75 -0
  153. package/src/wire/Select.test.ts +148 -0
  154. package/src/wire/Select.ts +78 -0
  155. package/src/wire/Sessions.test.ts +59 -0
  156. package/src/wire/Sessions.ts +39 -0
  157. package/src/wire/WireSchema.test.ts +162 -0
  158. package/src/wire/constants.ts +22 -0
  159. package/src/wire/golden/1/beat-capture.json +34 -0
  160. package/src/wire/golden/1/beat-message.json +34 -0
  161. package/src/wire/golden/1/beat-prompt.json +44 -0
  162. package/src/wire/golden/1/beat-script.json +34 -0
  163. package/src/wire/golden/1/beat-stalled.json +34 -0
  164. package/src/wire/golden/1/judge.json +14 -0
  165. package/src/wire/golden/1/land-noop.json +10 -0
  166. package/src/wire/golden/1/land.json +10 -0
  167. package/src/wire/index.ts +12 -0
  168. package/src/wire/types.ts +46 -0
  169. package/src/workflow/Diagnostic.test.ts +93 -0
  170. package/src/workflow/Diagnostic.ts +54 -0
  171. package/src/workflow/SteeringFormats.test.ts +27 -0
  172. package/src/workflow/SteeringFormats.ts +6 -0
  173. package/src/workflow/Workflow.ts +77 -0
  174. package/src/workflow/compile.test.ts +53 -0
  175. package/src/workflow/compile.ts +56 -0
  176. package/src/workflow/discovery.ts +122 -0
  177. package/src/workflow/fingerprint.test.ts +52 -0
  178. package/src/workflow/fingerprint.ts +53 -0
  179. package/src/workflow/index.ts +33 -0
  180. package/src/workflow/load.test.ts +1017 -0
  181. package/src/workflow/load.ts +836 -0
  182. package/src/workflow/skills.test.ts +109 -0
  183. package/src/workflow/skills.ts +90 -0
  184. package/src/workflow/vars.ts +33 -0
  185. package/src/workflows/feature/feature.test.ts +27 -33
  186. package/src/workflows/feature/index.ts +10 -0
  187. package/src/workflows/fix/fix.feature +80 -0
  188. package/src/workflows/fix/fix.test.ts +58 -78
  189. package/src/workflows/fix/index.ts +6 -0
  190. package/src/workflows/index.ts +2 -10
  191. package/src/workflows/review/index.ts +6 -0
  192. package/src/workflows/review/review.test.ts +85 -29
  193. package/src/workflows/review/review.ts +3 -1
  194. package/src/workflows/shared/config.fixture.ts +12 -0
  195. package/src/workflows/shared/reserved.ts +11 -0
  196. package/src/workflows/shared/workflows.steps.ts +7 -0
@@ -0,0 +1,40 @@
1
+ import { read, refuse, removeScript, run, scope, start } from "../flows.mjs";
2
+ import { d as reviewNotes, f as reviewRisks } from "../chunks/steering-D-PvRC5W.mjs";
3
+ import { H as fixReviewNotesPrompt, O as agentWithSkills, S as coder, V as finisherSystem, a as REVIEW_ORIG, b as REVIEW, d as shipped, f as defaults, i as skills, m as baseline, n as summary, p as envDefaults, r as access, s as handOffTail, t as steering } from "../chunks/reserved-ejn-LVYO.mjs";
4
+ //#region src/workflows/fix/fix.ts
5
+ /**
6
+ * Fix every note a human left in a handed-off `.gtd/REVIEW.md` and every
7
+ * risk its reviewer marked, in one turn; the review files go once it is done.
8
+ */
9
+ const fixReviewNotes = () => scope("notes", async () => {
10
+ const record = read(".gtd/REVIEW.md") ?? "";
11
+ const orig = read(REVIEW_ORIG);
12
+ if (orig === void 0) return refuse(`gtd: ${REVIEW} has no ${REVIEW_ORIG}, so it was not handed off by a review — remove it, or restore ${REVIEW_ORIG}.`);
13
+ await agentWithSkills("fixing", fixReviewNotesPrompt(reviewNotes(orig, record), reviewRisks(record)), {
14
+ label: "Fixing your review notes",
15
+ file: REVIEW,
16
+ model: coder(),
17
+ system: finisherSystem(),
18
+ allowEmpty: true
19
+ });
20
+ await run("closing", removeScript([REVIEW, REVIEW_ORIG]), { label: "Closing the review" });
21
+ });
22
+ /**
23
+ * Fix what a review handed on, else repair a red baseline — then the
24
+ * hand-off review of the result. A note there is handed to the next `fix`.
25
+ */
26
+ const fixFlow = async () => {
27
+ if (read(".gtd/REVIEW.md") !== void 0) {
28
+ await fixReviewNotes();
29
+ return handOffTail(false, start());
30
+ }
31
+ if (read(".gtd/REVIEW.orig.md") !== void 0) return refuse(`gtd: ${REVIEW_ORIG} has no ${REVIEW} — remove it, or restore ${REVIEW}.`);
32
+ if (await baseline("fix-precheck")) return;
33
+ await handOffTail(true, start());
34
+ };
35
+ const fix = shipped(fixFlow, { fix: {} });
36
+ //#endregion
37
+ //#region src/workflows/fix/index.ts
38
+ var fix_default = fix;
39
+ //#endregion
40
+ export { access, fix_default as default, defaults, envDefaults, fix, fixFlow, fixReviewNotes, skills, steering, summary };
@@ -0,0 +1,25 @@
1
+ import { start } from "../flows.mjs";
2
+ import { J as reviewGateBlockedMessage, c as refusePendingHandOff, d as shipped, f as defaults, h as gate, i as skills, n as summary, p as envDefaults, r as access, s as handOffTail, t as steering } from "../chunks/reserved-ejn-LVYO.mjs";
3
+ //#region src/workflows/review/review.ts
4
+ /**
5
+ * Pure review of everything since `reviewBase`: a green gate, the quality
6
+ * lap, then the human review. A note ends the process with `.gtd/REVIEW.md`
7
+ * left for `fix`; it never re-plans.
8
+ */
9
+ const reviewFlow = async () => {
10
+ refusePendingHandOff();
11
+ await gate("review-gate", reviewGateBlockedMessage());
12
+ await handOffTail(false, start());
13
+ };
14
+ const review = shipped(reviewFlow, { review: {
15
+ args: [{
16
+ name: "base",
17
+ optional: true
18
+ }],
19
+ vars: ({ base }) => base === void 0 ? {} : { reviewBase: base }
20
+ } }, (_workflow, vars) => vars.reviewBase || "");
21
+ //#endregion
22
+ //#region src/workflows/review/index.ts
23
+ var review_default = review;
24
+ //#endregion
25
+ export { access, review_default as default, defaults, envDefaults, review, reviewFlow, skills, steering, summary };
@@ -37678,6 +37678,14 @@ const access = (vars) => ({
37678
37678
  ...lensScopes("build.quality", lensesOf(vars.qualityReviews ?? ""), () => ({ write: [] }))
37679
37679
  });
37680
37680
  //#endregion
37681
+ //#region src/workflows/shared/reserved.ts
37682
+ const summary = summaryPrompt;
37683
+ const steering = {
37684
+ [REQUIREMENTS]: "qa",
37685
+ [ARCHITECTURE]: "qa",
37686
+ [REVIEW]: "review"
37687
+ };
37688
+ //#endregion
37681
37689
  //#region src/workflows/review/review.ts
37682
37690
  /**
37683
37691
  * Pure review of everything since `reviewBase`: a green gate, the quality
@@ -37735,12 +37743,6 @@ const fix = shipped(fixFlow, { fix: {} });
37735
37743
  //#endregion
37736
37744
  //#region src/workflows/index.ts
37737
37745
  var workflows_default = feature;
37738
- const summary = summaryPrompt;
37739
- const steering = {
37740
- [REQUIREMENTS]: "qa",
37741
- [ARCHITECTURE]: "qa",
37742
- [REVIEW]: "review"
37743
- };
37744
37746
  /**
37745
37747
  * @deprecated Empty: each shipped workflow builds its own doors, so a config
37746
37748
  * gets `fix` and `review [base]` by exporting `fix` and `review`.
package/package.json CHANGED
@@ -1,22 +1,61 @@
1
1
  {
2
2
  "name": "@pmelab/gtd",
3
- "version": "24.0.0",
3
+ "version": "24.1.0",
4
4
  "private": false,
5
5
  "description": "Git-aware CLI that emits the next prompt for an autonomous coding agent based on the current repository state",
6
6
  "bin": {
7
7
  "gtd": "dist/gtd.bundle.mjs"
8
8
  },
9
9
  "exports": {
10
- "./flows": "./src/flows/index.ts",
10
+ "./flows": {
11
+ "types": "./src/flows/index.ts",
12
+ "source": "./src/flows/index.ts",
13
+ "default": "./dist/flows.mjs"
14
+ },
15
+ "./wire": {
16
+ "types": "./src/wire/index.ts",
17
+ "source": "./src/wire/index.ts",
18
+ "default": "./dist/wire.mjs"
19
+ },
20
+ "./steering": {
21
+ "types": "./src/steering/index.ts",
22
+ "source": "./src/steering/index.ts",
23
+ "default": "./dist/steering.mjs"
24
+ },
25
+ "./workflow-kit": {
26
+ "types": "./src/workflow-kit/index.ts",
27
+ "source": "./src/workflow-kit/index.ts",
28
+ "default": "./dist/workflow-kit.mjs"
29
+ },
11
30
  "./workflows": {
12
31
  "types": "./src/workflows/index.ts",
13
32
  "source": "./src/workflows/index.ts",
14
33
  "default": "./dist/workflows.mjs"
15
34
  },
35
+ "./workflows/feature": {
36
+ "types": "./src/workflows/feature/index.ts",
37
+ "source": "./src/workflows/feature/index.ts",
38
+ "default": "./dist/workflows/feature.mjs"
39
+ },
40
+ "./workflows/review": {
41
+ "types": "./src/workflows/review/index.ts",
42
+ "source": "./src/workflows/review/index.ts",
43
+ "default": "./dist/workflows/review.mjs"
44
+ },
45
+ "./workflows/fix": {
46
+ "types": "./src/workflows/fix/index.ts",
47
+ "source": "./src/workflows/fix/index.ts",
48
+ "default": "./dist/workflows/fix.mjs"
49
+ },
16
50
  "./workflow": {
17
51
  "types": "./src/workflows/index.ts",
18
52
  "source": "./src/workflows/index.ts",
19
53
  "default": "./dist/workflows.mjs"
54
+ },
55
+ "./testkit": {
56
+ "types": "./src/testkit/index.ts",
57
+ "source": "./src/testkit/index.ts",
58
+ "default": "./dist/testkit.mjs"
20
59
  }
21
60
  },
22
61
  "files": [
@@ -24,6 +63,17 @@
24
63
  "src/flows/",
25
64
  "src/workflows/",
26
65
  "src/workflow-kit/",
66
+ "src/wire/",
67
+ "src/steering/",
68
+ "src/testkit/",
69
+ "src/cli/",
70
+ "src/edge/",
71
+ "src/emit/",
72
+ "src/install/",
73
+ "src/platform/",
74
+ "src/replay/",
75
+ "src/step/",
76
+ "src/workflow/",
27
77
  "README.md",
28
78
  "LICENSE",
29
79
  ".claude-plugin/plugin.json",
@@ -51,20 +101,21 @@
51
101
  "scripts": {
52
102
  "prepare": "husky",
53
103
  "dev": "node dev/run.mjs",
54
- "build": "tsdown --filter web && npx @tailwindcss/cli -i src/web/styles.css -o dist/web/main.css --minify && node scripts/inline-web-client.mjs && tsdown --filter gtd && tsdown --filter workflows",
104
+ "build": "tsdown --filter web && npx @tailwindcss/cli -i src/web/styles.css -o dist/web/main.css --minify && node scripts/inline-web-client.mjs && tsdown --filter gtd && tsdown --filter workflows && tsdown --filter entrypoints",
55
105
  "postbuild": "node scripts/assert-no-test-doubles.mjs",
56
106
  "watch": "tsdown --watch",
57
107
  "bench:replay": "node scripts/bench-replay.mjs",
58
- "test": "turbo run format:check typecheck lint lint:sh lint:boundaries test:unit test:e2e:inmem test:e2e:live test:web analyze",
59
- "test:fast": "turbo run format:check typecheck lint lint:sh lint:boundaries test:unit test:web analyze",
108
+ "test": "turbo run format:check typecheck lint lint:sh lint:boundaries test:unit test:workflows test:e2e:inmem test:e2e:live test:web analyze",
109
+ "test:fast": "turbo run format:check typecheck lint lint:sh lint:boundaries test:unit test:workflows test:web analyze",
60
110
  "test:unit": "vitest run --project unit",
111
+ "test:workflows": "vitest run --project workflows",
61
112
  "test:watch": "vitest",
62
- "test:changed": "vitest run --project unit --project e2e-inmem --changed HEAD",
113
+ "test:changed": "vitest run --project unit --project e2e-inmem --project workflows --changed HEAD",
63
114
  "test:e2e": "npm run test:e2e:inmem && npm run test:e2e:live",
64
115
  "typecheck": "tsc --noEmit && tsc --noEmit -p src/web/tsconfig.json",
65
116
  "lint": "oxlint .",
66
117
  "lint:sh": "jiti scripts/generate-shell-corpus.ts --check && shellcheck -s sh tests/shell/corpus/*.sh",
67
- "lint:boundaries": "node scripts/lint-boundaries.mjs",
118
+ "lint:boundaries": "depcruise src tests claude",
68
119
  "format": "oxfmt --write .",
69
120
  "format:check": "oxfmt --check .",
70
121
  "test:mutation": "stryker run",
@@ -130,7 +181,17 @@
130
181
  "zustand": "^5.0.15"
131
182
  },
132
183
  "peerDependencies": {
133
- "typescript": "^5"
184
+ "quickpickle": ">=1.11.2",
185
+ "typescript": "^5",
186
+ "vitest": ">=3.2.0"
187
+ },
188
+ "peerDependenciesMeta": {
189
+ "quickpickle": {
190
+ "optional": true
191
+ },
192
+ "vitest": {
193
+ "optional": true
194
+ }
134
195
  },
135
196
  "dependencies": {
136
197
  "@effect/platform": "^0.94.2",