@pmelab/gtd 23.2.0 → 24.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 (50) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +13 -6
  3. package/dist/gtd.bundle.mjs +34 -12
  4. package/dist/workflows.mjs +1952 -1725
  5. package/package.json +2 -1
  6. package/skills/authoring/SKILL.md +5 -4
  7. package/src/flows/factory.ts +5 -1
  8. package/src/flows/runtime.ts +3 -0
  9. package/src/workflow-kit/health.test.ts +30 -0
  10. package/src/workflow-kit/health.ts +86 -0
  11. package/src/workflow-kit/index.ts +7 -0
  12. package/src/workflow-kit/quality.test.ts +17 -0
  13. package/src/workflow-kit/quality.ts +45 -0
  14. package/src/workflow-kit/review.ts +324 -0
  15. package/src/{workflows → workflow-kit}/scenarios.ts +21 -28
  16. package/src/workflows/feature/feature.test.ts +38 -0
  17. package/src/workflows/{bundled.ts → feature/feature.ts} +11 -63
  18. package/src/workflows/{packages.test.ts → feature/packages.test.ts} +2 -2
  19. package/src/workflows/{packages.ts → feature/packages.ts} +3 -3
  20. package/src/workflows/{planning.ts → feature/planning.ts} +2 -3
  21. package/src/workflows/{review.test.ts → feature/review.test.ts} +9 -44
  22. package/src/workflows/feature/review.ts +106 -0
  23. package/src/workflows/feature/steps.test.ts +82 -0
  24. package/src/workflows/feature/steps.ts +92 -0
  25. package/src/workflows/fix/fix.test.ts +94 -0
  26. package/src/workflows/fix/fix.ts +52 -0
  27. package/src/workflows/index.ts +44 -2
  28. package/src/workflows/review/review.test.ts +43 -0
  29. package/src/workflows/review/review.ts +31 -0
  30. package/src/workflows/{access.test.ts → shared/access.test.ts} +1 -1
  31. package/src/workflows/{access.ts → shared/access.ts} +3 -5
  32. package/src/workflows/{health.test.ts → shared/health.test.ts} +1 -1
  33. package/src/workflows/{health.ts → shared/health.ts} +38 -55
  34. package/src/workflows/{options.test.ts → shared/options.test.ts} +2 -2
  35. package/src/workflows/{options.ts → shared/options.ts} +14 -2
  36. package/src/workflows/{scenarios.test.ts → shared/scenarios.test.ts} +1 -1
  37. package/src/workflows/shared/scenarios.ts +35 -0
  38. package/src/workflows/{skills.test.ts → shared/skills.test.ts} +3 -1
  39. package/src/workflows/{skills.ts → shared/skills.ts} +7 -6
  40. package/src/workflows/{steps.test.ts → shared/steps.test.ts} +1 -66
  41. package/src/workflows/{steps.ts → shared/steps.ts} +8 -98
  42. package/src/workflows/shared/tail.test.ts +205 -0
  43. package/src/workflows/shared/tail.ts +135 -0
  44. package/src/workflows/{text.fixture.ts → shared/text.fixture.ts} +2 -2
  45. package/src/workflows/{text.ts → shared/text.ts} +48 -7
  46. package/src/workflows/{threads.test.ts → shared/threads.test.ts} +1 -1
  47. package/src/workflows/review.ts +0 -362
  48. /package/src/workflows/{prose.ts → shared/prose.ts} +0 -0
  49. /package/src/workflows/{text.test.ts → shared/text.test.ts} +0 -0
  50. /package/src/workflows/{vars.ts → shared/vars.ts} +0 -0
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gtd",
3
- "version": "23.2.0",
3
+ "version": "24.0.0",
4
4
  "description": "Drive the gtd loop inside Claude Code: agent turns run as subagents, gtd decides every beat",
5
5
  "author": {
6
6
  "name": "Philipp Melab"
package/README.md CHANGED
@@ -501,17 +501,24 @@ the agent may overturn the answer. See
501
501
  [Configuration](https://github.com/pmelab/gtd/blob/main/docs/configuration.md)
502
502
  for its `ui:` settings.
503
503
 
504
- The bundled workflows are named `feature` (the ordinary start above), `fix` and
505
- `review`. Two doors start the other two and skip step 1. `gtd door fix` repairs
506
- a red baseline as its own reviewed commit instead of starting a process. And
504
+ The bundled workflows are named `feature` (the ordinary start above), `review`
505
+ and `fix`. They are independent: `review` and `fix` never plan, and they meet
506
+ only in `.gtd/REVIEW.md`. Each brings its own door. This command:
507
507
 
508
508
  ```bash
509
509
  gtd door review <commitish>
510
510
  ```
511
511
 
512
- starts a pure review of everything from `<commitish>` to HEAD — straight to step
513
- 4, no planning and no building. `gtd doors` lists every door; a `gtd.config.ts`
514
- can add its own. `gtd --workflow <name>` starts any workflow by name.
512
+ starts a pure review of everything from `<commitish>` to HEAD. It goes straight
513
+ to step 4, with no planning and no building. Sign off and it closes. Leave notes
514
+ and the process ends with `.gtd/REVIEW.md` (and the reviewer's original,
515
+ `.gtd/REVIEW.orig.md`) left for `gtd door fix`. Until `fix` consumes them,
516
+ starting `feature` or `review` is refused; remove both files to abandon the
517
+ hand-off. `gtd door fix` fixes those notes and every `Risk:` in one turn, then
518
+ asks for your review of the fix. With no review waiting, it repairs a red
519
+ baseline as its own reviewed commit instead. `gtd doors` lists the doors of the
520
+ workflows your `gtd.config.ts` exports, plus any it adds.
521
+ `gtd --workflow <name>` starts any workflow by name.
515
522
 
516
523
  The workflow itself is a plain async TypeScript function, and the
517
524
  `gtd.config.ts` at the repository root names it: the one `gtd install` writes
@@ -32061,8 +32061,9 @@ its next human gate, not just a starter: \`gtd-door review\` on a RED baseline
32061
32061
  hands off to \`gtd-build\`, which halts at the blocked gate and prints it,
32062
32062
  rather than starting the review; \`gtd-door fix\` on a GREEN suite is a no-op
32063
32063
  straight back to \`idle\` — the exec'd \`gtd-build\` exits immediately on it.
32064
- \`gtd doors\` lists the doors a repository offers (the bundled \`fix\` and
32065
- \`review [base]\`, plus any its config declares). Refuses with
32064
+ \`gtd doors\` lists the doors a repository offers (those of the workflows its
32065
+ config exports — the bundled \`fix\` and \`review [base]\` — plus any it
32066
+ declares). Refuses with
32066
32067
  \`usage: gtd-door <name> [args...]\` on stderr and exit \`2\` when the name is
32067
32068
  missing — nothing was even attempted. Default path: \`~/.local/bin/gtd-door\`.
32068
32069
 
@@ -32171,7 +32172,8 @@ const renderBriefing = () => HEADER() + BEAT_PROTOCOL + JSON_FIELD_REFERENCE + D
32171
32172
  //#region src/install/ConfigScaffold.ts
32172
32173
  const CONFIG_SCAFFOLD = `// The workflows gtd runs here: gtd's shipped feature, review and fix.
32173
32174
  // Every exported function is startable with \`gtd --workflow <name>\`; the
32174
- // default export is what a change in the tree starts.
32175
+ // default export is what a change in the tree starts. Each workflow brings
32176
+ // its own doors: \`gtd door review [base]\` and \`gtd door fix\`.
32175
32177
  export {
32176
32178
  feature as default,
32177
32179
  feature,
@@ -32180,11 +32182,9 @@ export {
32180
32182
  defaults,
32181
32183
  envDefaults,
32182
32184
  summary,
32183
- base,
32184
32185
  steering,
32185
32186
  skills,
32186
32187
  access,
32187
- doors,
32188
32188
  } from "@pmelab/gtd/workflows"
32189
32189
  `;
32190
32190
  var FlowsProtocolError = class extends Error {
@@ -49820,7 +49820,7 @@ const load = gen(function* () {
49820
49820
  const define = (entry) => ({
49821
49821
  flow: entry.flow,
49822
49822
  summary: entry.file.summary,
49823
- base: entry.file.base,
49823
+ base: (w, v) => entry.file.base?.(w, v) ?? entry.base?.(w, v),
49824
49824
  steering,
49825
49825
  modes: compiled.modes,
49826
49826
  skills: entry.file.skills,
@@ -50019,6 +50019,25 @@ const doorsFrom = (exports) => {
50019
50019
  }
50020
50020
  return new Map(Object.entries(value));
50021
50021
  };
50022
+ /**
50023
+ * Each exported workflow's own doors, onto the name it is exported under. The
50024
+ * `doors` export adds to them and settles a name two workflows both declare.
50025
+ */
50026
+ const derivedDoors = (catalogue, declared) => {
50027
+ const doors = /* @__PURE__ */ new Map();
50028
+ for (const [workflow, loaded] of catalogue) for (const [name, spec] of Object.entries(loaded.doors ?? {})) {
50029
+ const door = {
50030
+ ...spec,
50031
+ workflow
50032
+ };
50033
+ const problem = doorProblem(name, door);
50034
+ if (problem !== void 0) throw new Error(`workflow "${workflow}" builds door "${name}", which ${problem}`);
50035
+ const other = doors.get(name);
50036
+ if (other !== void 0 && !declared.has(name)) throw new Error(`door "${name}" is built by workflows "${other.workflow}" and "${workflow}" — declare it in the "doors" export to choose one (a declared door replaces the derived one, so restate its args and vars)`);
50037
+ doors.set(name, door);
50038
+ }
50039
+ return new Map([...doors, ...declared]);
50040
+ };
50022
50041
  /** Sort the doors and check each names a startable workflow. */
50023
50042
  const checkDoors = (declared, catalogue) => {
50024
50043
  const doors = new Map([...declared].sort(([a], [b]) => a.localeCompare(b)));
@@ -50055,7 +50074,7 @@ const loadWorkflows = (module, shipped) => {
50055
50074
  return {
50056
50075
  file,
50057
50076
  catalogue,
50058
- doors: rejections.length > 0 ? /* @__PURE__ */ new Map() : checkDoors(doorsFrom(exports), catalogue),
50077
+ doors: rejections.length > 0 ? /* @__PURE__ */ new Map() : checkDoors(derivedDoors(catalogue, doorsFrom(exports)), catalogue),
50059
50078
  default: defaultWorkflow && {
50060
50079
  ...defaultWorkflow,
50061
50080
  name: defaultName
@@ -50087,7 +50106,9 @@ const buildWorkflow = (name, value, file, rejections) => {
50087
50106
  return {
50088
50107
  flow: result.build.flow,
50089
50108
  file,
50090
- ...builtSettings(name, file, result.build)
50109
+ ...builtSettings(name, file, result.build),
50110
+ doors: result.build.doors,
50111
+ base: result.build.base
50091
50112
  };
50092
50113
  };
50093
50114
  /** A factory's settings over its file's, held to the rules a file's own exports are. */
@@ -70081,10 +70102,11 @@ const COMMAND_ROWS = [
70081
70102
  "Start a process through a named shortcut, mapping the",
70082
70103
  "positional args to that workflow's process settings — the",
70083
70104
  "same start `gtd --workflow` makes, printed the same way.",
70084
- "Doors come from the config's `doors` export; gtd's shipped",
70085
- "ones are `fix` and `review [base]`. An unknown door, or too",
70086
- "few or too many args, is a usage error (exit 2) naming the",
70087
- "doors or the door's synopsis"
70105
+ "Each workflow the config exports brings its own doors (gtd's",
70106
+ "`fix` brings `fix`, `review` brings `review [base]`), plus",
70107
+ "the config's `doors` export. An unknown door, or too few or",
70108
+ "too many args, is a usage error (exit 2) naming the doors or",
70109
+ "the door's synopsis"
70088
70110
  ]
70089
70111
  },
70090
70112
  {