@pmelab/gtd 1.5.5 → 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,9 +442,9 @@ 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**. The base is the parent of the current
446
- cycle's start marker **nearest to HEAD** (the last `gtd: new task`; for
447
- legacy cycles the last contiguous `gtd: grilling` run), and on a feature
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
448
  branch it never reaches below the merge-base with the default branch — stray
449
449
  markers left behind by older squashes can never drag the squash into
450
450
  previously shipped features. Post-squash review does not fire automatically —
@@ -453,13 +453,20 @@ loop before the next one starts.
453
453
  has no unrelated code dirty — a lone untracked `SQUASH_MSG.md` is tolerated
454
454
  and deleted before the squash commit. If unrelated code is dirty at
455
455
  `gtd: done`, gtd routes to **New Feature** instead. Set `squash: false` in
456
- `.gtdrc` to skip squashing and go straight to Idle. Checking off REVIEW.md
457
- checkboxes (`- [ ]` `- [x]`) also counts as approval and routes to **Done**
458
- they are navigation aids, not feedback. Only **non-checkbox** edits (code
459
- changes, inline comments, textual annotations in REVIEW.md) trigger **Accept
460
- Review**, which seeds a fresh `TODO.md` from your feedback, discards your
461
- code edits, removes `REVIEW.md`, and re-enters Grilling the loop starts
462
- over.
456
+ ======= `git commit`, then **gtd STOPs**. Post-squash review does not fire
457
+ automatically it fires only on the next manual `gtd` run (when the squash
458
+ commit is the boundary HEAD and a reviewable diff exists). Squashing fires
459
+ when the tree has no unrelated code dirty — a lone untracked `SQUASH_MSG.md`
460
+ is tolerated and deleted before the squash commit. If unrelated code is dirty
461
+ at `gtd: done`, gtd routes to **New Feature** instead. Set `squash: false` in
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.
463
470
 
464
471
  ## Configuration
465
472
 
@@ -501,6 +508,11 @@ built-in defaults apply. Supported filenames (searched in this order):
501
508
  - `states.*` — per-state overrides keyed by the six agent states: `decompose`
502
509
  (shared by the Grilled and Planning states), `grilling`, `building`,
503
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).
504
516
 
505
517
  ### Validation and errors
506
518
 
@@ -531,6 +543,28 @@ This makes the worktree-parent case easy: drop a single `.gtdrc` in a shared
531
543
  parent directory and it cascades to **all** checkouts/worktrees beneath it,
532
544
  while any individual checkout can still override settings with its own `.gtdrc`.
533
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
+
534
568
  ### Example
535
569
 
536
570
  ```yaml
@@ -715,6 +749,26 @@ This mirrors the `format:check` step enforced in CI (`prettier --check .`),
715
749
  keeping committed code consistently formatted without requiring a separate
716
750
  manual format pass.
717
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
+
718
772
  `npm run dev` runs `src/main.ts` directly via Node's native TypeScript
719
773
  type-stripping (requires Node 22.6+). It registers `dev/hooks.mjs`, which fills
720
774
  the two gaps the tsup build otherwise covers: resolving `./Foo.js` specifiers to