@pmelab/gtd 60.1.0 → 61.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +7 -0
  3. package/dist/chunks/{testkit-BhTey1Do.mjs → testkit-C9sq0x07.mjs} +1695 -1454
  4. package/dist/chunks/{wire-DZ8R1RU9.mjs → wire-CPNSm_9N.mjs} +27 -12
  5. package/dist/gtd.bundle.mjs +1666 -1449
  6. package/dist/gtd.core.mjs +86 -86
  7. package/dist/testkit/gherkin.mjs +1 -1
  8. package/dist/testkit.mjs +1 -1
  9. package/dist/wire.mjs +2 -2
  10. package/package.json +1 -1
  11. package/src/cli/History.test.ts +10 -1
  12. package/src/cli/Metrics.test.ts +10 -1
  13. package/src/cli/Program.test.ts +30 -19
  14. package/src/cli/Program.ts +4 -1
  15. package/src/cli/Strays.ts +3 -2
  16. package/src/edge/Edge.test.ts +78 -25
  17. package/src/edge/Edge.ts +161 -28
  18. package/src/emit/GitScript.ts +21 -3
  19. package/src/emit/index.ts +3 -0
  20. package/src/gherkin/messages.test.ts +1 -0
  21. package/src/gherkin/module-config.feature +1 -0
  22. package/src/gherkin/more-steps.feature +1 -0
  23. package/src/gherkin/testkit.feature +2 -1
  24. package/src/install/Install.ts +9 -2
  25. package/src/replay/Format.test.ts +35 -8
  26. package/src/replay/Format.ts +7 -4
  27. package/src/replay/Replay.test.ts +54 -0
  28. package/src/replay/Replay.ts +61 -17
  29. package/src/replay/Trailers.test.ts +12 -12
  30. package/src/replay/Trailers.ts +35 -20
  31. package/src/replay/Tree.ts +11 -0
  32. package/src/replay/index.ts +3 -0
  33. package/src/step/LandStep.ts +1 -0
  34. package/src/step/RepoSnapshot.ts +2 -0
  35. package/src/step/planStart.test.ts +2 -2
  36. package/src/step/planStep.test.ts +4 -4
  37. package/src/step/planStep.ts +10 -8
  38. package/src/testkit/TestRepo.test.ts +4 -1
  39. package/src/testkit/TestRepo.ts +3 -1
  40. package/src/twins/EmittedScriptRecognizer.ts +32 -1
  41. package/src/twins/GitTiers.ts +23 -0
  42. package/src/twins/InMemRepo.ts +14 -0
  43. package/src/twins/PinBeats.ts +33 -0
  44. package/src/twins/index.ts +1 -0
  45. package/src/wire/BeatDocument.ts +26 -5
  46. package/src/wire/Demand.ts +16 -6
  47. package/src/wire/constants.ts +3 -0
  48. package/src/wire/types.ts +4 -0
@@ -15,6 +15,8 @@ const renderFormat = (fmt, ...args) => {
15
15
  };
16
16
  /** The first line of the landing refusal for a turn that wrote outside its `write` access — a stable marker drivers and tests grep for. */
17
17
  const ACCESS_REFUSAL = "gtd land: this turn wrote outside its write access — revert these paths, then run `gtd land` again:";
18
+ /** Where a process keeps its pin: the engine and workflow it runs on, as `gtd bundle` prints them. */
19
+ const PIN_PATH = ".gtd/process.gtdpin";
18
20
  //#endregion
19
21
  //#region src/wire/ExitCodes.ts
20
22
  const EXIT_OK = 0;
@@ -89,14 +91,20 @@ const demandOf = (input) => {
89
91
  read: null,
90
92
  write: null
91
93
  };
92
- return kind === "prompt" ? {
94
+ if (kind === "prompt") return {
93
95
  kind,
94
96
  content,
95
97
  session,
96
98
  validate,
97
99
  skills,
98
100
  access
99
- } : {
101
+ };
102
+ if (kind === "script" && rendered.pin !== void 0) return {
103
+ kind,
104
+ content,
105
+ pin: rendered.pin
106
+ };
107
+ return {
100
108
  kind,
101
109
  content
102
110
  };
@@ -149,33 +157,39 @@ const assertNeverDemand = (demand) => {
149
157
  * falling through to "no session."
150
158
  */
151
159
  const dispatchFieldsOf = (demand) => {
160
+ const none = {
161
+ session: void 0,
162
+ validate: void 0,
163
+ skills: void 0,
164
+ access: void 0,
165
+ pin: void 0
166
+ };
152
167
  switch (demand.kind) {
153
168
  case "prompt": return {
169
+ ...none,
154
170
  session: demand.session,
155
171
  validate: demand.validate,
156
172
  skills: demand.skills,
157
173
  access: demand.access
158
174
  };
175
+ case "script": return {
176
+ ...none,
177
+ pin: demand.pin
178
+ };
159
179
  case "capture":
160
180
  case "message":
161
- case "script":
162
- case "stalled": return {
163
- session: void 0,
164
- validate: void 0,
165
- skills: void 0,
166
- access: void 0
167
- };
181
+ case "stalled": return none;
168
182
  default: return assertNeverDemand(demand);
169
183
  }
170
184
  };
171
185
  /**
172
- * Flatten a `Demand` plus its `BeatStatus` into the single 25-key document
186
+ * Flatten a `Demand` plus its `BeatStatus` into the single 26-key document
173
187
  * `gtd next --json` emits — the ONLY place the two are joined. `cost`/
174
188
  * `costByModel` are omitted together, exactly when no cost was recorded
175
189
  * (`cost <= 0`).
176
190
  */
177
191
  const beatDocument = (demand, status) => {
178
- const { session, validate, skills, access } = dispatchFieldsOf(demand);
192
+ const { session, validate, skills, access, pin } = dispatchFieldsOf(demand);
179
193
  const hasCost = status.cost > 0;
180
194
  return {
181
195
  schema: 1,
@@ -187,6 +201,7 @@ const beatDocument = (demand, status) => {
187
201
  model: status.model,
188
202
  system: status.system,
189
203
  validate,
204
+ pin,
190
205
  log: status.log,
191
206
  state: status.state,
192
207
  actor: status.actor,
@@ -482,4 +497,4 @@ const compile = (glob) => {
482
497
  };
483
498
  const globMatches = (path, glob) => compile(glob).test(path);
484
499
  //#endregion
485
- export { WIRE_SCHEMA as A, EXIT_RUNTIME_ERROR as C, EXIT_USAGE_ERROR as D, EXIT_STRAYS_FOUND as E, ACCESS_REFUSAL as O, EXIT_OK as S, EXIT_SIGTERM as T, BEAT_KINDS as _, renderScriptJson as a, stallDiagnosis as b, landProseText as c, renderLandPlain as d, DEMAND_BRIEFING as f, statusOf as g, renderBeatJson as h, judgeJson as i, renderFormat as j, UNATTRIBUTED_MODEL as k, noopText as l, beatDocument as m, resolveSession as n, scriptFields as o, renderBeatPlain as p, selectPath as r, landFields as s, globMatches as t, renderLandJson as u, beatKindOf as v, EXIT_SIGINT as w, EXIT_CODES as x, demandOf as y };
500
+ export { UNATTRIBUTED_MODEL as A, EXIT_RUNTIME_ERROR as C, EXIT_USAGE_ERROR as D, EXIT_STRAYS_FOUND as E, renderFormat as M, ACCESS_REFUSAL as O, EXIT_OK as S, EXIT_SIGTERM as T, BEAT_KINDS as _, renderScriptJson as a, stallDiagnosis as b, landProseText as c, renderLandPlain as d, DEMAND_BRIEFING as f, statusOf as g, renderBeatJson as h, judgeJson as i, WIRE_SCHEMA as j, PIN_PATH as k, noopText as l, beatDocument as m, resolveSession as n, scriptFields as o, renderBeatPlain as p, selectPath as r, landFields as s, globMatches as t, renderLandJson as u, beatKindOf as v, EXIT_SIGINT as w, EXIT_CODES as x, demandOf as y };