@open-tomato/rafa 0.46.0 → 0.48.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 (94) hide show
  1. package/README.md +70 -37
  2. package/dist/adapters/logger/settings.d.ts +2 -2
  3. package/dist/bugs/places.d.ts +1 -1
  4. package/dist/bugs/record.d.ts +1 -1
  5. package/dist/bundled/skills/dev-planner/SKILL.md +2 -2
  6. package/dist/cli.js +73457 -72996
  7. package/dist/config/index.d.ts +5 -0
  8. package/dist/config/index.js +6 -4
  9. package/dist/config/shape.d.ts +20 -15
  10. package/dist/config/templates.d.ts +64 -0
  11. package/dist/config-registry.d.ts +21 -12
  12. package/dist/config-schema-board-project.d.ts +3 -3
  13. package/dist/config-schema-bugs.d.ts +3 -3
  14. package/dist/config-schema-checks.d.ts +114 -0
  15. package/dist/config-schema-errors.d.ts +3 -3
  16. package/dist/config-schema-features.d.ts +4 -4
  17. package/dist/config-schema-hub.d.ts +6 -4
  18. package/dist/config-schema-issues.d.ts +2 -2
  19. package/dist/config-schema-logger.d.ts +3 -3
  20. package/dist/config-schema-loop-continue.d.ts +3 -3
  21. package/dist/config-schema-loop-retries.d.ts +4 -4
  22. package/dist/config-schema-release.d.ts +23 -24
  23. package/dist/config-schema-tests.d.ts +35 -27
  24. package/dist/config-schema-triage.d.ts +3 -3
  25. package/dist/config-schema-wrap-up.d.ts +4 -4
  26. package/dist/core/command/command.d.ts +1 -1
  27. package/dist/core/command/confirm.d.ts +11 -5
  28. package/dist/core/command/global-flags.d.ts +25 -0
  29. package/dist/core/command/index.d.ts +47 -23
  30. package/dist/core/command/registry-types.d.ts +4 -4
  31. package/dist/core/command/shared-flags.d.ts +40 -0
  32. package/dist/core/command/types.d.ts +3 -2
  33. package/dist/core/config/branch-template.d.ts +2 -0
  34. package/dist/core/config/config-items.d.ts +1 -1
  35. package/dist/core/config/config-load-module.d.ts +43 -0
  36. package/dist/core/config/config-load.d.ts +43 -12
  37. package/dist/core/config/config-origins.d.ts +31 -30
  38. package/dist/core/config/config-schema.d.ts +11 -0
  39. package/dist/core/config/config-sections.d.ts +15 -14
  40. package/dist/core/config/config.d.ts +90 -25
  41. package/dist/core/config/core-section.d.ts +1 -1
  42. package/dist/core/config/default-routing.d.ts +1 -1
  43. package/dist/core/config/index.d.ts +14 -10
  44. package/dist/core/config/merge-method.d.ts +40 -0
  45. package/dist/core/config/scope.d.ts +2 -2
  46. package/dist/core/config/section.d.ts +81 -1
  47. package/dist/core/config/sections.d.ts +17 -6
  48. package/dist/core/git/gh-runner.d.ts +1 -1
  49. package/dist/core/git/git.d.ts +34 -0
  50. package/dist/core/git/index.d.ts +13 -8
  51. package/dist/core/loop/claude.d.ts +11 -5
  52. package/dist/core/loop/hop-record.d.ts +6 -6
  53. package/dist/core/loop/index.d.ts +9 -8
  54. package/dist/core/loop/session-record-parse.d.ts +9 -2
  55. package/dist/core/loop/sessions.d.ts +23 -11
  56. package/dist/core/loop/suite-failure.d.ts +8 -6
  57. package/dist/core/output/active.d.ts +1 -1
  58. package/dist/core/plan/block-reader.d.ts +1 -1
  59. package/dist/core/runtime/identity.d.ts +13 -0
  60. package/dist/core/runtime/index.d.ts +12 -6
  61. package/dist/effort/store/check-rows.d.ts +1 -1
  62. package/dist/effort/store/commit-stats.d.ts +1 -1
  63. package/dist/effort/store/index.js +7 -8
  64. package/dist/effort/store/merge-commit-gaps.d.ts +1 -1
  65. package/dist/effort/store/plan-stubs.d.ts +1 -1
  66. package/dist/effort/store/session-row-types.d.ts +2 -2
  67. package/dist/errors/rafa-codes.d.ts +1 -1
  68. package/dist/index-2xzkzwm6.js +670 -0
  69. package/dist/index-ajv88fkm.js +448 -0
  70. package/dist/{index-ykggr043.js → index-fpgmdmww.js} +13 -5
  71. package/dist/index-g91ys6kw.js +249 -0
  72. package/dist/{index-cy98y87p.js → index-jx3x70xh.js} +1111 -638
  73. package/dist/{index-gvek4r8m.js → index-m672ptpg.js} +84 -26
  74. package/dist/{index-39kbcw68.js → index-w5qbpdtp.js} +415 -842
  75. package/dist/{index-gqz4jn6j.js → index-z4r20zwr.js} +8974 -11438
  76. package/dist/{index-j4k2vdz3.js → index-zsak0jy6.js} +124 -290
  77. package/dist/index.js +24940 -18766
  78. package/dist/learning/index.js +221 -12
  79. package/dist/plan/index.js +10 -9
  80. package/dist/ports/index.d.ts +7 -7
  81. package/dist/ports/learning.d.ts +5 -4
  82. package/dist/ports/spec-review.d.ts +1 -1
  83. package/dist/ready-gax3hhtt.js +241 -0
  84. package/dist/release-templates/release-bot-fragment.yml +6 -6
  85. package/dist/release-templates/release-publish.yml +8 -8
  86. package/dist/release-templates/release-settle.yml +8 -7
  87. package/dist/release-templates/release-tag.yml +8 -7
  88. package/package.json +53 -2
  89. package/dist/index-77ajfffn.js +0 -223
  90. package/dist/index-jh1r4kcn.js +0 -1067
  91. package/dist/index-z1w83f81.js +0 -4
  92. package/dist/pr/checks.d.ts +0 -133
  93. package/dist/pr/types.d.ts +0 -422
  94. package/dist/ready-4f8edezt.js +0 -2016
package/README.md CHANGED
@@ -594,21 +594,52 @@ rafa· no pr no open pull request for feat/rafa-485
594
594
 
595
595
  ## Configuration
596
596
 
597
- rafa reads its settings from one file per scope. The project scope is
597
+ rafa reads its settings from two files per scope. The project scope is
598
598
  the repository's root; the user scope is `~/.rafa/`, read under every
599
- project on the machine. In each scope the lookup takes the first of
600
- three names that is a file, and the others are not read:
601
-
602
- 1. `rafa.config.ts`, a TypeScript module
603
- 2. `rafa.config.mjs`, a JavaScript module
604
- 3. `.rafa/config.yaml` in the project, `~/.rafa/config.yaml` for the user
605
-
606
- The layers stack: rafa's defaults, under the user scope's file, under the
607
- project's. A setting the project's file names outranks the same one in
608
- the user's, key by key; a setting neither file names takes its default.
599
+ project on the machine. Each scope reads both of its files, when they
600
+ are there:
601
+
602
+ 1. Its module file: `rafa.config.ts`, a TypeScript module, or else
603
+ `rafa.config.mjs`, a JavaScript module. This is your file, which rafa
604
+ never writes.
605
+ 2. Its YAML file, `.rafa/config.yaml` in the project and
606
+ `~/.rafa/config.yaml` for the user: the local layer, read over the
607
+ module file key by key. It is the file rafa writes, with `config set`,
608
+ `stretch start` and `stretch end`.
609
+
610
+ The layers stack: rafa's defaults, under the user scope's two files,
611
+ under the project's two. A setting the project's files name outranks the
612
+ same one in the user's, key by key, and within a scope the YAML file's
613
+ value outranks the module file's; a setting no file names takes its
614
+ default.
609
615
  `rafa init` writes both YAML files with every setting commented out at
610
616
  its default, so uncomment a line, with its section line, to change it.
611
617
 
618
+ Two keys choose the tests a check point runs: `checks`, one list per
619
+ check point, and `templates`, which adopts a named set of values. A
620
+ project with no entries runs no check at any check point:
621
+
622
+ ```yaml
623
+ # .rafa/config.yaml
624
+ checks:
625
+ task: []
626
+ ```
627
+
628
+ `templates: [escalation]` adopts the `escalation` template, which sets
629
+ `checks.task: [affected]`, `checks.stage: [related, integration]` and
630
+ `checks.loop: [full]`, and restores the steps rafa ran before these keys
631
+ existed:
632
+
633
+ ```yaml
634
+ # .rafa/config.yaml
635
+ templates: [escalation]
636
+ ```
637
+
638
+ This repository's own `rafa.config.ts` is its person's file: it carries
639
+ the `templates` key and decision 0009's `checks` table, which
640
+ `context/verification.md` records. The `.rafa/config.yaml` of a checkout
641
+ keeps only what rafa writes there.
642
+
612
643
  Tab indentation in `.rafa/config.yaml` is refused with rafa's own error
613
644
  on every Bun version, before the parser sees the file. The error names
614
645
  the line that carries a tab; use spaces only.
@@ -629,10 +660,10 @@ Pick the lightest form your situation needs:
629
660
  - **A JS or TS project that installs rafa as a dev dependency.** Write
630
661
  `satisfies Config` or `defineConfig`, both from
631
662
  `@open-tomato/rafa/config`, and your editor checks the entries.
632
- - **A project moving from YAML to TypeScript.** For a while both files
633
- sit side by side. The TypeScript file is read, and a warning names the
634
- YAML file as not read; `rafa doctor` lists it until its keys have
635
- moved, and then it can be removed.
663
+ - **A project moving from YAML to TypeScript.** Both files can sit side
664
+ by side for as long as you like. Both are read, the YAML file's keys
665
+ over the TypeScript file's, so a key moves to the TypeScript file once
666
+ it is removed from the YAML file.
636
667
 
637
668
  The same setting in each form:
638
669
 
@@ -666,37 +697,36 @@ package installed where the file runs. For this iteration it can be
666
697
  solved with something simple attacking the type project specifically,
667
698
  but the bigger issue remains.
668
699
 
669
- Some routes were set aside, each for one reason. Merging both files of
670
- one scope is not done: a scope reads one file, so one answer per key.
671
- A Bun plugin redirecting the import does not resolve, as measured.
700
+ Some routes were set aside, each for one reason. A Bun plugin redirecting the import does not resolve, as measured.
672
701
  Setting `NODE_PATH` and starting rafa again is not done: it would start
673
702
  a second process to load one file. Requiring a local install, as ESLint
674
703
  and Vite do, is not done: it would refuse the global Python case above.
675
704
 
676
- ### Shadowed YAML and `rafa config show`
677
-
678
- When a scope holds a module file and a YAML file, the YAML file is not
679
- read, and every load says so:
705
+ ### Both files of a scope and `rafa config show`
680
706
 
681
- ```text
682
- rafa config: /repo/.rafa/config.yaml is not read: /repo/rafa.config.ts holds the project scope's config, so move its keys into rafa.config.ts and remove it
683
- ```
707
+ When a scope holds a module file and a YAML file, both are read and
708
+ neither is warned about: the YAML file is the local layer over the
709
+ module file, the interim form of #893's local layer until a file rafa
710
+ generates under `.rafa/` replaces it.
684
711
 
685
712
  `rafa config show` prints every setting with its merged value, nested
686
713
  as a config file spells it. `rafa config show --sources` prints one line
687
- per setting instead: its value, the layer that answered (`project`,
688
- `user` or `default`) and, for a file, the file and the zero-based entry
689
- that last set it; a YAML file is entry 0. `--output=json` carries the
690
- same data for a script. The two views are refused together.
714
+ per setting instead, with the layer that answered it and the file each
715
+ key came from. The layer is `local` for the project's YAML file,
716
+ `project` for its module file, `user` for either of the user scope's two
717
+ files, `default` for a setting no file names, and `template:<name>` for a
718
+ setting a config template answered. For a file, the line names the file
719
+ and the zero-based entry that last set the setting; a YAML file is
720
+ entry 0. `--output=json` carries the same data for a script. The two
721
+ views are refused together.
691
722
 
692
723
  ### Changing a key with `config set`
693
724
 
694
- `rafa config set <key>=<value>` edits the project's `.rafa/config.yaml`
695
- in place and keeps its comments. In a project whose config is
696
- `rafa.config.ts` or `rafa.config.mjs`, it refuses with exit 1, naming
697
- that file and writing nothing, because a module is code the command does
698
- not rewrite. Edit the module by hand until #893 gives the command a file
699
- to write.
725
+ `rafa config set <key>=<value>` edits the local layer, the project's
726
+ `.rafa/config.yaml`, in place and keeps its comments. Beside a
727
+ `rafa.config.ts` or `rafa.config.mjs` it still edits that YAML file, and
728
+ the key it sets wins over the module file's value, key by key. rafa never
729
+ writes the module file.
700
730
 
701
731
  ### `dangerous.*` settings
702
732
 
@@ -859,15 +889,18 @@ sort out what happened.
859
889
  | Key | Default | What it sets |
860
890
  |---|---|---|
861
891
  | `loop.worktreeDir` | `.rafa/worktrees` | the directory where `--as-worktree` creates worktrees, absolute or relative to the project root |
892
+ | `loop.worktreeSetup` | `null` | a shell command run in a new or reused `--as-worktree` worktree before the first session; null runs nothing |
862
893
  | `dangerous.selfUpdateDuringLoop` | `false` | whether `rafa self-update` runs while a loop of this project is live |
863
894
 
864
- Both take a string and a boolean as written; quoted values are refused.
895
+ All three take a string or a boolean as written; a boolean in quotes is refused.
865
896
 
866
897
  ```yaml
867
898
  # empty: loops run in the current checkout, guarded
868
899
  # --as-worktree puts them in .rafa/worktrees (the default)
869
900
 
870
901
  loop:
902
+ # worktreeSetup: null # the default: nothing runs in a new worktree
903
+ # worktreeSetup: bun install --frozen-lockfile # installs the packages before the first session
871
904
  worktreeDir: ../rafa-loops # worktrees beside the repository
872
905
 
873
906
  dangerous:
@@ -1048,7 +1081,7 @@ builds. `bun run snapshot` in this checkout, or `rafa self-update` run
1048
1081
  inside it, builds, copies `dist/` into `~/.rafa/runtime/<version>/` with
1049
1082
  the version from `package.json`, points `~/.rafa/bin/rafa` at the copied
1050
1083
  `cli.js`, and prints the path the link resolves to, exiting 0. Both
1051
- install the same way (`src/runtime/install.ts`). The bin is not in
1084
+ install the same way (`packages/rafa-run/src/runtime/install.ts`). The bin is not in
1052
1085
  `~/.bun/bin`, where `bun link` in this checkout re-points `rafa` at the
1053
1086
  checkout's `dist/` with no message, so put `~/.rafa/bin` on `PATH` ahead
1054
1087
  of `~/.bun/bin`; both warn when it is not, and `rafa doctor` checks it.
@@ -30,7 +30,7 @@
30
30
  * - **The module-level value.** Outside every scope the reader answers
31
31
  * one module-level value and the setter replaces it, the defaults
32
32
  * until something sets another. A config loaded outside every
33
- * command sets it, as the module loader (`src/modules/load.ts`) and
33
+ * command sets it, as the module loader (`packages/rafa/src/modules/load.ts`) and
34
34
  * the command hook (`src/status/hook.ts`) load one around an
35
35
  * invocation; no command reads it.
36
36
  *
@@ -82,7 +82,7 @@
82
82
  * module state, so a case that sets settings outside a scope sets `null`
83
83
  * after it.
84
84
  */
85
- import type { LogLevel } from '@open-tomato/rafa/ports/log-level';
85
+ import type { LogLevel } from '../../ports/log-level.js';
86
86
  /** How a logger colours its lines. */
87
87
  export type LoggerTheme = 'default' | 'plain';
88
88
  /** The ordered levels, quietest first. `api` is not one of them. */
@@ -11,7 +11,7 @@
11
11
  * over the suggestion.
12
12
  *
13
13
  * This module imports nothing, so the config schema
14
- * (`src/config-schema-issues.ts`) reads the built-in places without
14
+ * (`packages/rafa/src/config-schema-issues.ts`) reads the built-in places without
15
15
  * reaching the modules that read the config.
16
16
  */
17
17
  /** The places every project has, in the order a refusal lists them. */
@@ -56,7 +56,7 @@
56
56
  * Nothing here redacts: a caller takes local paths and secrets out of
57
57
  * the values before it builds the record.
58
58
  */
59
- import type { ErrorCodeEntry } from '@open-tomato/rafa/errors/codes';
59
+ import type { ErrorCodeEntry } from '../errors/codes.js';
60
60
  /** A bug's fields, each null until something fills it. */
61
61
  export interface BugRecord {
62
62
  /** One line saying what is wrong; the title's last part. */
@@ -354,7 +354,7 @@ The block strip rule means:
354
354
  - A block in a stage description does not appear in the operator log line
355
355
  - A block anywhere in the plan does not appear in a commit subject or commit body
356
356
 
357
- The strip happens where the loop reads the next task, `findNextTask` in `src/utils/tracker.ts`, and it follows fences the way a renderer shows them (`packages/rafa/src/core/plan/blocks.ts`):
357
+ The strip happens where the loop reads the next task, `findNextTask` in `packages/rafa/src/utils/tracker.ts`, and it follows fences the way a renderer shows them (`packages/rafa/src/core/plan/blocks.ts`):
358
358
 
359
359
  - Only a closed, top-level `rafa:*` block hides its lines. Every other fence is transparent, so a `- [ ] ` line at column 0 inside a `markdown` or `text` illustration, or inside a `rafa:` fence nested in one, is dispatched as a task. A plan that illustrates the format indents its example lines.
360
360
  - A `rafa:` fence that is never closed hides nothing, because taking the rest of the document as its body would end the plan with its tasks unrun. `parsePlan` reports it as `unclosed-block`, and each open task line after it as `task-in-block`.
@@ -554,7 +554,7 @@ The wrap-up session always receives `full` regardless of the configured mode.
554
554
 
555
555
  ## PREREQUISITES.md format
556
556
 
557
- `<plan.dir>/PREREQUISITES-<stub>.md` lists the setup a plan needs that no task can put in place. It is parsed: `src/preflight/prerequisites-md.ts` reads it and merges its items into the configured `prerequisites` for the plan beside it, `<plan.dir>/PLAN-<stub>.md`, and for no other plan.
557
+ `<plan.dir>/PREREQUISITES-<stub>.md` lists the setup a plan needs that no task can put in place. It is parsed: `packages/rafa/src/preflight/prerequisites-md.ts` reads it and merges its items into the configured `prerequisites` for the plan beside it, `<plan.dir>/PLAN-<stub>.md`, and for no other plan.
558
558
 
559
559
  ```markdown
560
560
  # Prerequisites