@pmelab/gtd 64.2.0 → 65.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 (59) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +36 -26
  3. package/claude/hooks/assist.ts +9 -35
  4. package/claude/hooks/doors.ts +4 -4
  5. package/claude/hooks/git.ts +56 -0
  6. package/claude/hooks/handoff.ts +11 -11
  7. package/claude/hooks/jobs.ts +8 -8
  8. package/claude/hooks/pr.ts +8 -8
  9. package/claude/hooks/register.tsx +16 -78
  10. package/claude/hooks/tools.ts +7 -20
  11. package/claude/hooks/wording.ts +3 -3
  12. package/dist/chunks/{flows-dnIE_qbe.mjs → flows-DGs0W3HI.mjs} +19 -2
  13. package/dist/chunks/{testkit-BwCH8ky6.mjs → testkit-CgrLmpdJ.mjs} +741 -80
  14. package/dist/chunks/{wire-CaPJ9Tme.mjs → wire-BNS8ciNu.mjs} +5 -3
  15. package/dist/flows.mjs +1 -1
  16. package/dist/gtd.bundle.mjs +565 -114
  17. package/dist/gtd.core.mjs +132 -129
  18. package/dist/testkit/gherkin.mjs +1 -1
  19. package/dist/testkit.mjs +2 -2
  20. package/dist/web/main.js +2 -2
  21. package/dist/wire.mjs +1 -1
  22. package/dist/workflow-kit.mjs +1 -1
  23. package/package.json +1 -1
  24. package/src/cli/Cli.ts +5 -5
  25. package/src/cli/History.test.ts +10 -8
  26. package/src/cli/Metrics.test.ts +2 -1
  27. package/src/cli/Program.test.ts +4 -2
  28. package/src/cli/Program.ts +87 -5
  29. package/src/edge/Edge.test.ts +37 -16
  30. package/src/edge/Edge.ts +296 -31
  31. package/src/emit/GitScript.ts +116 -15
  32. package/src/emit/index.ts +7 -0
  33. package/src/flows/config.ts +7 -1
  34. package/src/flows/index.test.ts +1 -0
  35. package/src/flows/index.ts +2 -0
  36. package/src/flows/runtime.ts +32 -1
  37. package/src/platform/RetainedHistory.ts +3 -0
  38. package/src/platform/index.ts +1 -0
  39. package/src/replay/Replay.test.ts +9 -0
  40. package/src/replay/Replay.ts +59 -15
  41. package/src/replay/Trailers.ts +14 -0
  42. package/src/replay/index.ts +1 -1
  43. package/src/step/LandStep.ts +12 -0
  44. package/src/step/RepoSnapshot.ts +11 -0
  45. package/src/step/index.ts +1 -0
  46. package/src/step/planStart.test.ts +4 -3
  47. package/src/step/planStart.ts +7 -0
  48. package/src/step/planStep.ts +17 -12
  49. package/src/step/startBranch.ts +54 -0
  50. package/src/twins/EmittedScriptRecognizer.ts +117 -0
  51. package/src/twins/EmittedScripts.test.ts +147 -1
  52. package/src/twins/InMemRepo.ts +116 -0
  53. package/src/wire/Demand.ts +22 -10
  54. package/src/wire/constants.ts +3 -0
  55. package/src/wire/types.ts +4 -0
  56. package/src/workflow/Workflow.ts +1 -0
  57. package/src/workflow/compile.ts +2 -0
  58. package/src/workflow/load.ts +2 -0
  59. package/claude/hooks/ship.ts +0 -730
@@ -17,6 +17,8 @@ const renderFormat = (fmt, ...args) => {
17
17
  const ACCESS_REFUSAL = "gtd land: this turn wrote outside its write access — revert these paths, then run `gtd land` again:";
18
18
  /** Where a process keeps its pin: the engine and workflow it runs on, as `gtd bundle` prints them. */
19
19
  const PIN_PATH = ".gtd/process.gtdpin";
20
+ /** Where a `run(…, { onFail: "rest" })` body's failure is recorded in the tree: the exit status and the output. */
21
+ const RUN_FAILED_PATH = ".gtd/run-failed.txt";
20
22
  // src/wire/ExitCodes.ts
21
23
  const EXIT_OK = 0;
22
24
  /** Something failed that was never a matter of how gtd was invoked — a refusal or an unexpected error. */
@@ -73,7 +75,7 @@ const beatKindOf = (input) => {
73
75
  * `stalled at "<state>"` stays a stable substring (see
74
76
  * `tests/integration/features/driver-doc.feature`).
75
77
  */
76
- const stallDiagnosis = (state, actor) => `stalled at "${state}": the last gtd(${actor}): ${state} turn landed an empty attempt, the tree is clean, and another dispatch would repeat it.\n\nTwo ways out:\n - sharpen the step's prompt so the turn has something concrete to author\n - pass allowEmpty: true to the step, so an empty turn completes it and the\n flow decides what follows — finishing, or an escalation step after N\n empty turns\n`;
78
+ const stallDiagnosis = (state, actor, failure, blocked) => blocked !== void 0 ? `stalled at "${state}": landing this ship step is refused.\n\n${blocked}\n` : failure !== void 0 ? `stalled at "${state}": the script exited non-zero and its failure is recorded in the tree. Change the tree to run the script again; the step advances only on a zero exit.\n\n${failure}` : `stalled at "${state}": the last gtd(${actor}): ${state} turn landed an empty attempt, the tree is clean, and another dispatch would repeat it.\n\nTwo ways out:\n - sharpen the step's prompt so the turn has something concrete to author\n - pass allowEmpty: true to the step, so an empty turn completes it and the\n flow decides what follows — finishing, or an escalation step after N\n empty turns\n`;
77
79
  /**
78
80
  * Assemble one `Demand` — the ONLY place a rest's resolved content becomes
79
81
  * `Demand.content` (`stallDiagnosis` at `kind === "stalled"`, the rendered
@@ -83,7 +85,7 @@ const stallDiagnosis = (state, actor) => `stalled at "${state}": the last gtd(${
83
85
  */
84
86
  const demandOf = (input) => {
85
87
  const { rendered, kind, session, validate } = input;
86
- const content = kind === "stalled" ? stallDiagnosis(rendered.state, rendered.actor) : rendered.content;
88
+ const content = kind === "stalled" ? stallDiagnosis(rendered.state, rendered.actor, rendered.failure, rendered.blocked) : rendered.content;
87
89
  const skills = rendered.skills !== void 0 && rendered.skills.length > 0 ? rendered.skills : void 0;
88
90
  const access = rendered.access ?? {
89
91
  read: null,
@@ -485,4 +487,4 @@ const compile = (glob) => {
485
487
  return new RegExp(`${pattern}$`, "s");
486
488
  };
487
489
  const globMatches = (path, glob) => compile(glob).test(path);
488
- 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 };
490
+ export { RUN_FAILED_PATH as A, EXIT_RUNTIME_ERROR as C, EXIT_USAGE_ERROR as D, EXIT_STRAYS_FOUND as E, WIRE_SCHEMA as M, renderFormat as N, 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, UNATTRIBUTED_MODEL 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 };
package/dist/flows.mjs CHANGED
@@ -1 +1 @@
1
- export { A as FLOWS_PROTOCOL, j as FlowsProtocolError, M as accessFor, N as agent, s as answered, x as applyScript, P as changes, F as changesSince, c as check, S as checkScript, l as codeChanges, I as codeThreads, r as defineConfig, a as defineWorkflow, u as displayPath, L as envSettings, R as envSettingsOf, z as glob, d as hasThreadFor, B as head, V as human, U as judge, f as judgeDiffShape, W as kept, G as mark, q as matches, C as moveScript, p as numeric, J as openQuestions, w as quote, X as read, Z as refuse, T as removeScript, m as requireAnswers, h as requireProgress, g as requireReplies, _ as requireRevert, v as requireThreadsClosed, Q as restart, E as restoreScript, D as revertScript, $ as run, et as scope, y as seamGate, tt as sectionBodies, nt as sections, rt as settings, it as settingsOf, O as showScript, at as skillsFor, ot as start, st as threads, ct as workflow, k as writeScript, b as wrote } from "./chunks/flows-dnIE_qbe.mjs";
1
+ export { A as FLOWS_PROTOCOL, j as FlowsProtocolError, M as accessFor, N as agent, s as answered, x as applyScript, P as changes, F as changesSince, c as check, S as checkScript, l as codeChanges, I as codeThreads, r as defineConfig, a as defineWorkflow, u as displayPath, L as envSettings, R as envSettingsOf, z as glob, d as hasThreadFor, B as head, V as human, U as judge, f as judgeDiffShape, W as kept, G as mark, q as matches, C as moveScript, p as numeric, J as openQuestions, w as quote, X as read, Z as refuse, T as removeScript, m as requireAnswers, h as requireProgress, g as requireReplies, _ as requireRevert, v as requireThreadsClosed, Q as restart, E as restoreScript, D as revertScript, $ as run, et as scope, y as seamGate, tt as sectionBodies, nt as sections, rt as settings, it as settingsOf, at as ship, O as showScript, ot as skillsFor, st as start, ct as threads, lt as workflow, k as writeScript, b as wrote } from "./chunks/flows-DGs0W3HI.mjs";