@pmelab/gtd 1.5.4 → 1.6.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/README.md CHANGED
@@ -442,19 +442,31 @@ loop before the next one starts.
442
442
  (`gtd: done`) → **Squashing** → **Idle**. The Squashing agent authors a
443
443
  conventional-commits message from the full process diff and squashes all
444
444
  intermediate `gtd: *` commits into one with `git reset --soft <base>` +
445
- `git commit`, then **gtd STOPs**. Post-squash review does not fire
445
+ <<<<<<< HEAD `git commit`, then **gtd STOPs**. The base is the parent of the
446
+ current cycle's start marker **nearest to HEAD** (the last `gtd: new task`;
447
+ for legacy cycles the last contiguous `gtd: grilling` run), and on a feature
448
+ branch it never reaches below the merge-base with the default branch — stray
449
+ markers left behind by older squashes can never drag the squash into
450
+ previously shipped features. Post-squash review does not fire automatically —
451
+ it fires only on the next manual `gtd` run (when the squash commit is the
452
+ boundary HEAD and a reviewable diff exists). Squashing fires when the tree
453
+ has no unrelated code dirty — a lone untracked `SQUASH_MSG.md` is tolerated
454
+ and deleted before the squash commit. If unrelated code is dirty at
455
+ `gtd: done`, gtd routes to **New Feature** instead. Set `squash: false` in
456
+ ======= `git commit`, then **gtd STOPs**. Post-squash review does not fire
446
457
  automatically — it fires only on the next manual `gtd` run (when the squash
447
458
  commit is the boundary HEAD and a reviewable diff exists). Squashing fires
448
459
  when the tree has no unrelated code dirty — a lone untracked `SQUASH_MSG.md`
449
460
  is tolerated and deleted before the squash commit. If unrelated code is dirty
450
461
  at `gtd: done`, gtd routes to **New Feature** instead. Set `squash: false` in
451
- `.gtdrc` to skip squashing and go straight to Idle. Checking off REVIEW.md
452
- checkboxes (`- [ ]` `- [x]`) also counts as approval and routes to **Done**
453
- they are navigation aids, not feedback. Only **non-checkbox** edits (code
454
- changes, inline comments, textual annotations in REVIEW.md) trigger **Accept
455
- Review**, which seeds a fresh `TODO.md` from your feedback, discards your
456
- code edits, removes `REVIEW.md`, and re-enters Grilling the loop starts
457
- over.
462
+ > > > > > > > origin/46-config-schema `.gtdrc` to skip squashing and go
463
+ > > > > > > > straight to Idle. Checking off REVIEW.md checkboxes (`- [ ]` →
464
+ > > > > > > > `- [x]`) also counts as approval and routes to **Done** they
465
+ > > > > > > > are navigation aids, not feedback. Only **non-checkbox** edits
466
+ > > > > > > > (code changes, inline comments, textual annotations in
467
+ > > > > > > > REVIEW.md) trigger **Accept Review**, which seeds a fresh
468
+ > > > > > > > `TODO.md` from your feedback, discards your code edits, removes
469
+ > > > > > > > `REVIEW.md`, and re-enters Grilling — the loop starts over.
458
470
 
459
471
  ## Configuration
460
472
 
@@ -496,6 +508,11 @@ built-in defaults apply. Supported filenames (searched in this order):
496
508
  - `states.*` — per-state overrides keyed by the six agent states: `decompose`
497
509
  (shared by the Grilled and Planning states), `grilling`, `building`,
498
510
  `fixing`, `agentic-review`, `clean`. Unknown `states` keys are **rejected**.
511
+ - **`$schema`** (string, optional) — a recognized key that is **stripped before
512
+ validation**, so it never counts as an unknown key. Point it at the published
513
+ schema to get schema-backed autocompletion and inline docs in your editor. A
514
+ `schema.json` is generated from the config schema at build time and ships with
515
+ the package (and is published/committed on release).
499
516
 
500
517
  ### Validation and errors
501
518
 
@@ -526,6 +543,28 @@ This makes the worktree-parent case easy: drop a single `.gtdrc` in a shared
526
543
  parent directory and it cascades to **all** checkouts/worktrees beneath it,
527
544
  while any individual checkout can still override settings with its own `.gtdrc`.
528
545
 
546
+ ### Auto-init
547
+
548
+ On every run, if the cwd→root walk finds **no** config anywhere, gtd creates and
549
+ commits a starter config at the **git root**: a `.gtdrc.json` containing only a
550
+ `$schema` link:
551
+
552
+ ```json
553
+ {
554
+ "$schema": "https://raw.githubusercontent.com/pmelab/gtd/main/schema.json"
555
+ }
556
+ ```
557
+
558
+ It is committed as `chore: add .gtdrc.json`. This wires up editor autocompletion
559
+ out of the box; add any settings below the `$schema` line to override the
560
+ defaults.
561
+
562
+ Auto-init is skipped when HEAD is a `gtd: transport` commit: transport is a
563
+ consume-only handoff HEAD (mixed-reset in the Transport pre-pass), so committing
564
+ a config stub on top of it would displace the transport commit — and, when it is
565
+ the repository root, silently mask the "cannot reset transport commit" error.
566
+ The stub is created on a later run, once the transport HEAD has been consumed.
567
+
529
568
  ### Example
530
569
 
531
570
  ```yaml
@@ -710,6 +749,26 @@ This mirrors the `format:check` step enforced in CI (`prettier --check .`),
710
749
  keeping committed code consistently formatted without requiring a separate
711
750
  manual format pass.
712
751
 
752
+ ### Prompt templates
753
+
754
+ Each prompt-bearing state has a self-contained Eta template in
755
+ `src/prompts/*.md` that owns its full prompt — header, context, body, and tail.
756
+ Shared fragments live as partials in `src/prompts/partials/`: `header`, the
757
+ context renderers (`context`, `package`, `diff`, `feedback`), and three tail
758
+ variants (`auto-advance`, `neutral`, `stop`). Templates compose them via Eta's
759
+ `<%~ include("@name", { … }) %>` syntax; dynamic values such as the resolved
760
+ model string are injected as Eta variables (`<%= model %>`).
761
+
762
+ At module load, `src/Prompt.ts` registers every template on a single `new Eta()`
763
+ instance via `loadTemplate`. `readFile` and `resolvePath` are nulled afterward
764
+ so rendering resolves exclusively from the in-memory cache — the compiled ESM
765
+ bundle carries no runtime `fs` dependency.
766
+
767
+ `buildPrompt(result, resolveModel?, output?)` selects the state's template,
768
+ builds a view-model (model string, tail partial name, context), renders it,
769
+ collapses runs of three or more blank lines to two, and ensures exactly one
770
+ trailing newline.
771
+
713
772
  `npm run dev` runs `src/main.ts` directly via Node's native TypeScript
714
773
  type-stripping (requires Node 22.6+). It registers `dev/hooks.mjs`, which fills
715
774
  the two gaps the tsup build otherwise covers: resolving `./Foo.js` specifiers to