@open-tomato/rafa 0.45.0 → 0.46.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 (140) hide show
  1. package/README.md +255 -23
  2. package/dist/PROMPT.md +18 -1
  3. package/dist/adapters/logger/settings.d.ts +132 -0
  4. package/dist/bugs/closest.d.ts +19 -0
  5. package/dist/bugs/fenced.d.ts +8 -0
  6. package/dist/bugs/places.d.ts +20 -0
  7. package/dist/bugs/record.d.ts +145 -0
  8. package/dist/bugs/title.d.ts +83 -0
  9. package/dist/bundled/agents/doc-updater.md +17 -3
  10. package/dist/bundled/agents/loop-implementer.md +14 -2
  11. package/dist/bundled/operators/skills/rafa-stretch-pit-stop/SKILL.md +10 -3
  12. package/dist/bundled/operators/skills/rafa-stretch-sweep/SKILL.md +5 -0
  13. package/dist/bundled/skills/dev-planner/SKILL.md +101 -18
  14. package/dist/cli.js +74726 -62960
  15. package/dist/config/entry.d.ts +119 -0
  16. package/dist/config/index.d.ts +36 -0
  17. package/dist/config/index.js +51 -0
  18. package/dist/config/shape.d.ts +232 -0
  19. package/dist/config-registry.d.ts +127 -0
  20. package/dist/config-schema-board-project.d.ts +157 -0
  21. package/dist/config-schema-bugs.d.ts +71 -0
  22. package/dist/config-schema-errors.d.ts +54 -0
  23. package/dist/config-schema-features.d.ts +64 -0
  24. package/dist/config-schema-hub.d.ts +150 -0
  25. package/dist/config-schema-issues.d.ts +95 -0
  26. package/dist/config-schema-logger.d.ts +91 -0
  27. package/dist/config-schema-loop-continue.d.ts +122 -0
  28. package/dist/config-schema-loop-retries.d.ts +94 -0
  29. package/dist/config-schema-release.d.ts +307 -0
  30. package/dist/config-schema-tests.d.ts +170 -0
  31. package/dist/config-schema-triage.d.ts +142 -0
  32. package/dist/config-schema-wrap-up.d.ts +96 -0
  33. package/dist/core/command/command.d.ts +228 -0
  34. package/dist/core/command/confirm.d.ts +67 -0
  35. package/dist/core/command/index.d.ts +112 -0
  36. package/dist/core/command/lazy.d.ts +54 -0
  37. package/dist/core/command/registry-types.d.ts +96 -0
  38. package/dist/core/command/running.d.ts +96 -0
  39. package/dist/core/command/spends.d.ts +39 -0
  40. package/dist/core/command/types.d.ts +92 -0
  41. package/dist/core/command/version.d.ts +4 -0
  42. package/dist/core/config/branch-template.d.ts +20 -0
  43. package/dist/core/config/config-items.d.ts +86 -0
  44. package/dist/core/config/config-load.d.ts +47 -0
  45. package/dist/core/config/config-origins.d.ts +57 -0
  46. package/dist/core/config/config-readers.d.ts +167 -0
  47. package/dist/core/config/config-schema.d.ts +207 -0
  48. package/dist/core/config/config-sections.d.ts +493 -0
  49. package/dist/core/config/config.d.ts +320 -0
  50. package/dist/core/config/core-section.d.ts +39 -0
  51. package/dist/core/config/dangerous.d.ts +58 -0
  52. package/dist/core/config/default-routing.d.ts +16 -0
  53. package/dist/core/config/index.d.ts +141 -0
  54. package/dist/core/config/scope.d.ts +42 -0
  55. package/dist/core/config/section.d.ts +206 -0
  56. package/dist/core/config/sections.d.ts +45 -0
  57. package/dist/core/config/standard-schema.d.ts +27 -0
  58. package/dist/core/git/commit.d.ts +232 -0
  59. package/dist/core/git/gh-runner.d.ts +24 -0
  60. package/dist/core/git/git.d.ts +22 -0
  61. package/dist/core/git/index.d.ts +85 -0
  62. package/dist/core/loop/claude.d.ts +388 -0
  63. package/dist/core/loop/hop-record.d.ts +52 -0
  64. package/dist/core/loop/index.d.ts +179 -0
  65. package/dist/core/loop/session-env.d.ts +20 -0
  66. package/dist/core/loop/session-record-parse.d.ts +63 -0
  67. package/dist/core/loop/sessions.d.ts +408 -0
  68. package/dist/core/loop/suite-failure.d.ts +25 -0
  69. package/dist/core/output/active.d.ts +100 -0
  70. package/dist/core/output/stream.d.ts +20 -0
  71. package/dist/core/output/text.d.ts +55 -0
  72. package/dist/core/plan/block-reader.d.ts +46 -0
  73. package/dist/core/plan/blocks.d.ts +139 -0
  74. package/dist/core/plan/declaration.d.ts +366 -0
  75. package/dist/core/plan/plan-stamp.d.ts +75 -0
  76. package/dist/core/runtime/identity.d.ts +21 -0
  77. package/dist/core/runtime/index.d.ts +46 -0
  78. package/dist/effort/store/bring-forward.d.ts +131 -0
  79. package/dist/effort/store/check-rows.d.ts +31 -0
  80. package/dist/effort/store/commit-stats.d.ts +42 -0
  81. package/dist/effort/store/copy.d.ts +35 -0
  82. package/dist/effort/store/development-build.d.ts +105 -0
  83. package/dist/effort/store/effort-levels.d.ts +13 -0
  84. package/dist/effort/store/findings.d.ts +214 -0
  85. package/dist/effort/store/fix-schema.d.ts +184 -0
  86. package/dist/effort/store/index.js +10 -7
  87. package/dist/effort/store/location.d.ts +44 -0
  88. package/dist/effort/store/merge-commit-gaps.d.ts +68 -0
  89. package/dist/effort/store/merge-conflicts.d.ts +91 -0
  90. package/dist/effort/store/merge-rules.d.ts +82 -0
  91. package/dist/effort/store/merge-store.d.ts +211 -0
  92. package/dist/effort/store/merge-union.d.ts +92 -0
  93. package/dist/effort/store/migrate.d.ts +146 -0
  94. package/dist/effort/store/migrations.d.ts +92 -0
  95. package/dist/effort/store/ndjson-files.d.ts +114 -0
  96. package/dist/effort/store/origins.d.ts +116 -0
  97. package/dist/effort/store/plan-stubs.d.ts +79 -0
  98. package/dist/effort/store/rebuild-aside.d.ts +172 -0
  99. package/dist/effort/store/schema-plan.d.ts +102 -0
  100. package/dist/effort/store/session-row-types.d.ts +64 -0
  101. package/dist/effort/store/settings.d.ts +13 -0
  102. package/dist/effort/store/sqlite.d.ts +340 -0
  103. package/dist/effort/store/store-generation.d.ts +17 -0
  104. package/dist/effort/store/store-identity.d.ts +220 -0
  105. package/dist/effort/store/store-meta.d.ts +305 -0
  106. package/dist/effort/store/store-replaced.d.ts +72 -0
  107. package/dist/effort/store/types.d.ts +223 -0
  108. package/dist/errors/codes.d.ts +56 -0
  109. package/dist/errors/rafa-codes.d.ts +36 -0
  110. package/dist/index-2a7nb3an.js +125 -0
  111. package/dist/{index-r28fzsvc.js → index-39kbcw68.js} +350 -165
  112. package/dist/{index-nv34ptht.js → index-77ajfffn.js} +14 -9
  113. package/dist/index-cy98y87p.js +2597 -0
  114. package/dist/index-gqz4jn6j.js +13447 -0
  115. package/dist/index-gvek4r8m.js +710 -0
  116. package/dist/index-j4k2vdz3.js +1125 -0
  117. package/dist/index-jh1r4kcn.js +1067 -0
  118. package/dist/{index-mgh2s9bj.js → index-ykggr043.js} +58 -455
  119. package/dist/index-z1w83f81.js +4 -0
  120. package/dist/index.js +14715 -21516
  121. package/dist/learning/index.js +5 -6
  122. package/dist/plan/index.js +12 -11
  123. package/dist/plan-prompt.md +3 -1
  124. package/dist/ports/index.d.ts +732 -0
  125. package/dist/ports/learning.d.ts +101 -0
  126. package/dist/ports/log-level.d.ts +13 -0
  127. package/dist/ports/spec-review.d.ts +66 -0
  128. package/dist/pr/checks.d.ts +133 -0
  129. package/dist/pr/types.d.ts +422 -0
  130. package/dist/ready-4f8edezt.js +2016 -0
  131. package/dist/release-templates/release-bot-fragment.yml +153 -0
  132. package/dist/release-templates/release-publish.yml +110 -0
  133. package/dist/release-templates/release-settle.yml +122 -0
  134. package/dist/release-templates/release-tag.yml +102 -0
  135. package/dist/report/parse.d.ts +415 -0
  136. package/dist/schema/project-id.d.ts +79 -0
  137. package/dist/schema/tiers.d.ts +107 -0
  138. package/package.json +41 -3
  139. package/dist/index-hf2k497d.js +0 -16
  140. package/dist/index-nsr78ct2.js +0 -8219
@@ -0,0 +1,91 @@
1
+ /**
2
+ * The `logger` section of the config schema: the six keys the logger
3
+ * reads (#950), each one's field, its default, its spec and its reader.
4
+ * {@link LOGGER_SECTION} hands them to core as one `ConfigSection`,
5
+ * package `logger`, and the `declare module` below adds
6
+ * {@link LoggerConfigSettings} to `RafaConfig`.
7
+ * {@link LoggerShape} holds the keys a file writes, which
8
+ * `src/config/shape.ts` composes into `ConfigShape`, the nested file shape.
9
+ * `config-registry.ts`'s `CONFIG_DEFAULTS` and `SETTINGS`
10
+ * spread the objects below right after the `errors` section. It has its
11
+ * own module for the reason `config-schema-errors.ts` gives.
12
+ *
13
+ * ## The keys
14
+ *
15
+ * - `logger.level` is the loudest ORDERED level written: `error`,
16
+ * `warn` (the default) or `debug`. `api` is refused here: it sits
17
+ * outside the order and has its own key.
18
+ * - `logger.modules` gives one module a level of its own, over
19
+ * `logger.level`: `modules: { board: { level: debug } }`. It is one
20
+ * of the map settings `config.ts` merges across layers (its spec
21
+ * sets `map`), so the user's and the project's maps are joined by
22
+ * module name, the project's entry winning for a module both name. A module's mapping
23
+ * holds `level` today, and any other key is kept and warned about.
24
+ * - `logger.api` turns on `api` entries, the metadata of each request
25
+ * to a service. Off by default.
26
+ * - `logger.theme` is `default` or `plain`, which writes no colour.
27
+ * - `logger.callSite` names the calling file on `debug` lines.
28
+ * - `logger.kind` names the logger adapter, `console` by default. A
29
+ * kind nothing registered is not refused at load, since the registry
30
+ * an add-on fills is not at hand here: the active logger warns once
31
+ * and stays on `console` (`adapters/logger/active.ts`).
32
+ *
33
+ * ## When they take effect
34
+ *
35
+ * `loadConfig` (`config-load.ts`) calls core's load hook as soon as a
36
+ * config is read, and `src/config-registry.ts` sets that hook to hand
37
+ * {@link loggerSettingsOf} to the logger. A command's logger exists
38
+ * before that, so until a command loads its config the defaults apply.
39
+ *
40
+ * None of the keys is a `CommandLineSetting`: the verbosity flags are the
41
+ * command line's say over what is written.
42
+ */
43
+ import type { LoggerSettings, LoggerTheme } from './adapters/logger/settings.js';
44
+ import type { ConfigSection, SettingSpec } from '@open-tomato/rafa/core/config';
45
+ import type { LogLevel } from '@open-tomato/rafa/ports/log-level';
46
+ declare module '@open-tomato/rafa/core/config/config-schema' {
47
+ /** The `logger` section's fields, added to core's. */
48
+ interface RafaConfig extends LoggerConfigSettings {
49
+ }
50
+ }
51
+ /**
52
+ * The `logger` keys a file writes, each `logger.modules` entry a mapping
53
+ * holding `level`; `src/config/shape.ts` composes them into `ConfigShape`.
54
+ */
55
+ export interface LoggerShape {
56
+ readonly logger: {
57
+ readonly kind: string;
58
+ readonly level: LogLevel;
59
+ readonly theme: LoggerTheme;
60
+ readonly modules: Readonly<Record<string, {
61
+ readonly level: LogLevel;
62
+ }>>;
63
+ readonly callSite: boolean;
64
+ readonly api: boolean;
65
+ };
66
+ }
67
+ /** The `logger` settings. */
68
+ export interface LoggerConfigSettings {
69
+ /** The logger adapter's kind. `logger.kind`. */
70
+ loggerKind: string;
71
+ /** The loudest ordered level written. `logger.level`. */
72
+ loggerLevel: LogLevel;
73
+ /** How lines are coloured. `logger.theme`. */
74
+ loggerTheme: LoggerTheme;
75
+ /** A level per module, over `logger.level`. `logger.modules`. */
76
+ loggerModules: ReadonlyMap<string, LogLevel>;
77
+ /** Whether a `debug` line names the calling file. `logger.callSite`. */
78
+ loggerCallSite: boolean;
79
+ /** Whether `api` entries are written. `logger.api`. */
80
+ loggerApi: boolean;
81
+ }
82
+ /** The defaults: the console logger at `warn`, nothing else turned on. */
83
+ export declare const LOGGER_DEFAULTS: Readonly<LoggerConfigSettings>;
84
+ /** Every `logger` setting. */
85
+ export declare const LOGGER_SETTINGS: {
86
+ readonly [K in keyof LoggerConfigSettings]: SettingSpec<K>;
87
+ };
88
+ /** The `logger` section: the six `logger` keys, with their defaults and no check. */
89
+ export declare const LOGGER_SECTION: ConfigSection;
90
+ /** The settings a logger reads, from a resolved config's `logger` fields. */
91
+ export declare function loggerSettingsOf(config: LoggerConfigSettings): LoggerSettings;
@@ -0,0 +1,122 @@
1
+ /**
2
+ * The four keys `rafa loop start --continue` reads, with their fields,
3
+ * their defaults, their specs and their readers:
4
+ * `loop.retriesOnContinue`, `loop.continue.criteria`,
5
+ * `loop.continue.criteriaMode` and `loop.forceWrapUp.maxNewFailures`.
6
+ * {@link LOOP_CONTINUE_SECTION} hands them to core as one
7
+ * `ConfigSection`, package `loop-continue`, and the `declare module`
8
+ * below adds {@link LoopContinueSettings} to `RafaConfig`.
9
+ * {@link LoopContinueShape} holds its part of the shared `loop` namespace,
10
+ * which `src/config/shape.ts` composes into `LoopShape` of `ConfigShape`,
11
+ * the nested file shape.
12
+ * `config-registry.ts`'s `CONFIG_DEFAULTS` and `SETTINGS`
13
+ * spread the objects below right after `loop.retries` and ahead of
14
+ * `loop.wrapUp`, so the order settings are reported in holds the `loop`
15
+ * section together.
16
+ *
17
+ * The keys have their own module, as `config-schema-loop-retries.ts`
18
+ * has, because `config-schema.ts`'s own note asks a new section for a
19
+ * sibling, and the two count readers are rules about VALUES that only
20
+ * these keys read. `config-registry.ts` imports this file to spread it; a
21
+ * caller reads the settings off the resolved `RafaConfig`.
22
+ *
23
+ * ## The keys
24
+ *
25
+ * Under `--continue`, a stop that would end the run is handed to a
26
+ * decision instead (`start/decision-prompt.ts`, `start/decision-parse.ts`):
27
+ * retry the task with a new approach, stop, jump over it, or defer it
28
+ * until a later task is done.
29
+ *
30
+ * - `loop.retriesOnContinue` is the retry budget a `--continue` run
31
+ * opens when `--retry` is not typed: `false` or a whole number from
32
+ * 1 to 3, default `1`, counted in a row as `loop.retries` is
33
+ * (`start/retry-budget.ts`). A run without `--continue` never reads it.
34
+ * It follows `loop.retries`' rules: `false` and not `0` means no
35
+ * retry, and `0`, a negative number, a fraction, anything above 3,
36
+ * `true` and a quoted number are refused.
37
+ * - `loop.continue.criteria` is the project's own criteria file, read
38
+ * from the project root on every decision, default
39
+ * `.rafa/continue-criteria.md`. A missing file is not an error here:
40
+ * whether it may be missing is the mode's rule.
41
+ * - `loop.continue.criteriaMode` says how the project file meets the
42
+ * bundled base criteria: `extend` (the default) appends it under the
43
+ * base, `replace` uses it alone, and a `replace` whose file is
44
+ * missing is refused when the run starts.
45
+ * - `loop.forceWrapUp.maxNewFailures` is how many NEW suite failures
46
+ * `--force-wrap-up` tolerates before it refuses the wrap-up: `false`
47
+ * (the default, none tolerated) or a whole number from 1 to 50, with
48
+ * the same refusals as the retry count. Inherited baseline failures
49
+ * are not counted.
50
+ *
51
+ * None is a `CommandLineSetting`: the flags that outrank a key for one
52
+ * run (`--retry=<n>`) are read by `start/run-setup.ts`.
53
+ */
54
+ import type { ConfigSection, SettingSpec } from '@open-tomato/rafa/core/config';
55
+ import type { Reader } from '@open-tomato/rafa/core/config/sections';
56
+ declare module '@open-tomato/rafa/core/config/config-schema' {
57
+ /** The `loop-continue` section's fields, added to core's. */
58
+ interface RafaConfig extends LoopContinueSettings {
59
+ }
60
+ }
61
+ /**
62
+ * The `loop` keys `loop start --continue` reads, the section's part of
63
+ * the shared `loop` namespace; `src/config/shape.ts` composes it into
64
+ * `LoopShape`.
65
+ */
66
+ export interface LoopContinueShape {
67
+ readonly retriesOnContinue: ContinueCount;
68
+ readonly continue: {
69
+ readonly criteria: string;
70
+ readonly criteriaMode: ContinueCriteriaMode;
71
+ };
72
+ readonly forceWrapUp: {
73
+ readonly maxNewFailures: ContinueCount;
74
+ };
75
+ }
76
+ /** The fewest retries `loop.retriesOnContinue` accepts as a number. */
77
+ export declare const RETRIES_ON_CONTINUE_MIN = 1;
78
+ /** The most retries `loop.retriesOnContinue` accepts. */
79
+ export declare const RETRIES_ON_CONTINUE_MAX = 3;
80
+ /** The fewest new failures `loop.forceWrapUp.maxNewFailures` accepts as a number. */
81
+ export declare const FORCE_WRAP_UP_MAX_NEW_FAILURES_MIN = 1;
82
+ /** The most new failures `loop.forceWrapUp.maxNewFailures` accepts. */
83
+ export declare const FORCE_WRAP_UP_MAX_NEW_FAILURES_MAX = 50;
84
+ /** How the project criteria file meets the bundled base criteria. */
85
+ export declare const CONTINUE_CRITERIA_MODES: readonly ["extend", "replace"];
86
+ /** One of {@link CONTINUE_CRITERIA_MODES}. */
87
+ export type ContinueCriteriaMode = (typeof CONTINUE_CRITERIA_MODES)[number];
88
+ /** A whole-number count a key bounds, or `false` for none. */
89
+ export type ContinueCount = number | false;
90
+ /** The settings `loop start --continue` reads, resolved. */
91
+ export interface LoopContinueSettings {
92
+ /**
93
+ * The retries a `--continue` run opens when `--retry` is not typed,
94
+ * or `false` for none. `loop.retriesOnContinue`.
95
+ */
96
+ loopRetriesOnContinue: ContinueCount;
97
+ /** The project criteria file, from the project root. `loop.continue.criteria`. */
98
+ loopContinueCriteria: string;
99
+ /** How the project criteria meet the base. `loop.continue.criteriaMode`. */
100
+ loopContinueCriteriaMode: ContinueCriteriaMode;
101
+ /**
102
+ * The new suite failures `--force-wrap-up` tolerates, or `false` for
103
+ * none. `loop.forceWrapUp.maxNewFailures`.
104
+ */
105
+ loopForceWrapUpMaxNewFailures: ContinueCount;
106
+ }
107
+ /** Accepts `false` or a whole number from 1 to 3; the module note says why. */
108
+ export declare const retriesOnContinue: Reader<ContinueCount>;
109
+ /** Accepts `false` or a whole number from 1 to 50; the module note says why. */
110
+ export declare const forceWrapUpMaxNewFailures: Reader<ContinueCount>;
111
+ /** Accepts a non-blank path, kept as written. */
112
+ export declare const continueCriteria: Reader<string>;
113
+ /** Accepts `extend` or `replace`. */
114
+ export declare const continueCriteriaMode: Reader<ContinueCriteriaMode>;
115
+ /** What the four settings resolve to when no layer names them. */
116
+ export declare const LOOP_CONTINUE_DEFAULTS: Readonly<LoopContinueSettings>;
117
+ /** The four settings' specs. */
118
+ export declare const LOOP_CONTINUE_SETTINGS: {
119
+ readonly [K in keyof LoopContinueSettings]: SettingSpec<K>;
120
+ };
121
+ /** The `loop-continue` section: the four keys `loop start --continue` reads, with their defaults and no check. */
122
+ export declare const LOOP_CONTINUE_SECTION: ConfigSection;
@@ -0,0 +1,94 @@
1
+ /**
2
+ * `loop.retries`, the loop's own retry count: how many times in a row
3
+ * one run re-enters its task loop after a stop a blind re-run is known
4
+ * to pass, with its field, its default, its spec and its reader.
5
+ * {@link LOOP_RETRIES_SECTION} hands it to core as one `ConfigSection`,
6
+ * package `loop-retries`, and the `declare module` below adds
7
+ * {@link LoopRetriesSettings} to `RafaConfig`.
8
+ * {@link LoopRetriesShape} holds its part of the shared `loop` namespace,
9
+ * which `src/config/shape.ts` composes into `LoopShape` of `ConfigShape`,
10
+ * the nested file shape.
11
+ * `config-registry.ts`'s `CONFIG_DEFAULTS` and `SETTINGS`
12
+ * spread the objects below right after `loop.worktreeDir` and ahead of
13
+ * `loop.wrapUp`, so the order settings are reported in holds the `loop`
14
+ * section together.
15
+ *
16
+ * The key has its own module, as `config-schema-wrap-up.ts` has, because
17
+ * `config-schema.ts`'s own note asks a new section for a sibling, and
18
+ * the reader is a rule about a VALUE that only this key reads, so it
19
+ * sits here beside it. `config-registry.ts` imports this file to spread
20
+ * it; a caller reads the setting off the resolved `RafaConfig`, and
21
+ * `start/run-setup.ts` checks `--retry` against the same two bounds.
22
+ *
23
+ * ## The key
24
+ *
25
+ * A soft stop of `rafa loop start` (a red suite step, a session that
26
+ * exited nonzero, a session that left neither a report nor a commit)
27
+ * ends the run today, and the person runs `rafa loop start` again by
28
+ * hand, which resumes at the `[BLOCKED]` line or the inserted repair.
29
+ * `loop.retries` is how many of those re-runs the loop makes itself,
30
+ * in a row, at those stops alone (`start/retry-budget.ts`): a task done
31
+ * past the stop, neither the stopped task nor a repair, starts the count
32
+ * over.
33
+ *
34
+ *
35
+ * - It defaults to `false`: no retry, so a run stops where it always
36
+ * did until a person asks for more.
37
+ * - It accepts a whole number from 1 to 3. Each retry spends at least
38
+ * one more session, so the cap of 3 bounds what a run whose stop
39
+ * keeps coming back can spend before it halts: a task that keeps
40
+ * failing never starts its own count over.
41
+ * - `false` means no retry. It is spelled `false` and not `0`, so a
42
+ * number always names retries that run; `0` is refused, as are a
43
+ * negative number, a fraction and anything above 3. `true` is
44
+ * refused too: it names no count, and reading it as some count
45
+ * would be a choice nobody wrote.
46
+ *
47
+ * A quoted `"2"` is refused, as every other reader refuses a string
48
+ * spelled like its type. The key is not a `CommandLineSetting`: the
49
+ * flag that outranks it for one run is `loop start --retry=<n>`, read
50
+ * by `start/run-setup.ts`.
51
+ */
52
+ import type { ConfigSection, SettingSpec } from '@open-tomato/rafa/core/config';
53
+ import type { Reader } from '@open-tomato/rafa/core/config/sections';
54
+ declare module '@open-tomato/rafa/core/config/config-schema' {
55
+ /** The `loop-retries` section's fields, added to core's. */
56
+ interface RafaConfig extends LoopRetriesSettings {
57
+ }
58
+ }
59
+ /**
60
+ * `loop.retries`, the section's part of the shared `loop` namespace;
61
+ * `src/config/shape.ts` composes it into `LoopShape`.
62
+ */
63
+ export interface LoopRetriesShape {
64
+ readonly retries: LoopRetries;
65
+ }
66
+ /** The fewest retries `loop.retries` accepts as a number. */
67
+ export declare const LOOP_RETRIES_MIN = 1;
68
+ /** The most retries `loop.retries` accepts. */
69
+ export declare const LOOP_RETRIES_MAX = 3;
70
+ /** How many times in a row one run re-enters its loop after a retry-safe stop, or `false` for none. */
71
+ export type LoopRetries = number | false;
72
+ /** The `loop.retries` setting, resolved. */
73
+ export interface LoopRetriesSettings {
74
+ /**
75
+ * The retries in a row one run makes after a retry-safe stop, or
76
+ * `false` for none. `loop.retries`.
77
+ */
78
+ loopRetries: LoopRetries;
79
+ }
80
+ /** True for a whole number from {@link LOOP_RETRIES_MIN} to {@link LOOP_RETRIES_MAX}. */
81
+ export declare function isLoopRetryCount(raw: unknown): raw is number;
82
+ /**
83
+ * Accepts `false` or a whole number from 1 to 3, each as itself; the
84
+ * module note says why `0`, `true` and a quoted number are refused.
85
+ */
86
+ export declare const loopRetries: Reader<LoopRetries>;
87
+ /** What `loop.retries` resolves to when no layer names it. */
88
+ export declare const LOOP_RETRIES_DEFAULTS: Readonly<LoopRetriesSettings>;
89
+ /** The `loop.retries` setting spec. */
90
+ export declare const LOOP_RETRIES_SETTINGS: {
91
+ readonly [K in keyof LoopRetriesSettings]: SettingSpec<K>;
92
+ };
93
+ /** The `loop-retries` section: `loop.retries`, with their defaults and no check. */
94
+ export declare const LOOP_RETRIES_SECTION: ConfigSection;
@@ -0,0 +1,307 @@
1
+ /**
2
+ * The `pr` and `release` sections of the config schema, and the one
3
+ * `dangerous` key the release plan adds: each setting's field, its
4
+ * default and its spec. {@link RELEASE_SECTION} hands them to core as
5
+ * one `ConfigSection`, package `release`, and the `declare module` below
6
+ * adds {@link PrSettings}, {@link ReleaseSettings} and
7
+ * {@link DangerousReleaseSettings} to `RafaConfig`.
8
+ * {@link ReleaseShape} holds the keys a file writes and
9
+ * {@link ReleaseDangerousShape} its part of the shared `dangerous`
10
+ * namespace, which `src/config/shape.ts` composes into `ConfigShape`,
11
+ * the nested file shape.
12
+ * `config-registry.ts`'s `CONFIG_DEFAULTS` and `SETTINGS`
13
+ * spread the objects below at the places the two sections always sat,
14
+ * and the `dangerous` key right after `dangerous.acceptStaleRefs`, so
15
+ * the order settings are reported in, and the order a warning lists keys
16
+ * in, holds each key's section.
17
+ *
18
+ * They moved out of `config-schema.ts` when that module stood at 780
19
+ * lines, measured with `wc -l`, before the release plan's six keys
20
+ * joined these two sections and `dangerous`: new keys in a module near
21
+ * the 800-line cap of `context/source.md` would be paid for by
22
+ * rewrapping prose. The six keys then joined here. Every rule the schema module states about a KEY
23
+ * still holds here, and `config-sections.ts` still holds every rule
24
+ * about a VALUE. `config-registry.ts` imports this file to spread it; a
25
+ * caller reads these settings off the resolved `RafaConfig`.
26
+ *
27
+ * ## The `pr` section
28
+ *
29
+ * `.rafa/specs/rafa-20-pr-commands.md` spells it `pr: { provider: gh | none,
30
+ * mergeMethod: squash | merge | rebase, base: <default branch> }`, and
31
+ * names `pr.resolveBudget` as what a `triage --resolve` session's
32
+ * `--max-budget-usd` comes from. Four readings it leaves to this module:
33
+ *
34
+ * - `pr.provider` and `pr.base` default to NULL, and null here means
35
+ * "nobody has said", not "off". The spec's default for the provider
36
+ * is `gh` when `origin` is a GitHub remote and `none` otherwise, and
37
+ * its default base is whatever the remote calls its default branch;
38
+ * neither is a value this module can spell, because both are read
39
+ * off the repository at use (`pr/provider.ts`). Writing either
40
+ * default as a literal would be the silent choice the config refuses
41
+ * everywhere else: `prBase: 'main'` would open a pull request into a
42
+ * branch that may not exist on a repository whose default is
43
+ * `master`. A file spelling `provider:` or `base:` with no value
44
+ * says nothing, as every null does, and resolves to the same null.
45
+ * - `pr.mergeMethod` defaults to `squash`, the first method the spec
46
+ * lists and the one the merge flow is written for: it deletes the
47
+ * local branch with `-D` because a squash leaves it unmerged in
48
+ * git's eyes.
49
+ * - `pr.resolveBudget` defaults to 2 US dollars, which the attempt
50
+ * guard's default of two attempts caps at 4 for one pull request.
51
+ * It is a number and not null: the spec has every resolve run carry
52
+ * `--max-budget-usd`, so a session with no budget is not a state
53
+ * this setting can be left in.
54
+ * - No `pr` setting is a `CommandLineSetting`. `pr merge` takes
55
+ * a `--method` flag, but that flag is the command's own argument for
56
+ * one merge, read by the command beside this setting, and not a
57
+ * layer over the config: a global `--merge-method` nobody typed
58
+ * would be a flag this module invented.
59
+ * - `pr.versionCollision` defaults to `report`. It sets how `rafa pr
60
+ * merge` reacts to a branch the release guard reads as `missing`
61
+ * (source changes and no fragment) or `stale` (a stamped version
62
+ * the base branch has passed): `report` names it and merges,
63
+ * `allow` is silent, `ask` asks and `refuse` stops. A `collision` is
64
+ * not this setting's: it always refuses, unless
65
+ * `dangerous.acceptVersionCollision` says otherwise. A default of
66
+ * `refuse` would stop every project whose branches still stamp their
67
+ * own versions the day it upgrades.
68
+ *
69
+ * ## The `release` section
70
+ *
71
+ * `.rafa/specs/rafa-21-changelog-and-release.md` spells it `release: {
72
+ * enabled: auto, versionFile: package.json, changelog: CHANGELOG.md,
73
+ * heading: "## {version} — {date}, {title}" }`, and those four values
74
+ * are the defaults here. Four readings it leaves to this module:
75
+ *
76
+ * - `release.enabled` is not a flag. `auto`, its default, is a third
77
+ * value meaning "on when both files below exist" — a reading
78
+ * `release/enabled.ts` makes against a disk, which no value here
79
+ * could stand for. What the reader takes beside it, and why `on`
80
+ * and `off` are refused, is `config-sections.ts`'s to say.
81
+ * - `release.versionFile` and `release.changelog` are paths relative
82
+ * to the repository root, and neither is null. Null elsewhere here
83
+ * means "nobody has said", and the spec has said: `package.json`
84
+ * and `CHANGELOG.md`. The absence the spec cares about is the
85
+ * FILE's — "a project with no version file gets the changelog
86
+ * entry under a date heading and no bump" — which is a question
87
+ * about a disk, answered at use and not spellable as a default.
88
+ * - `release.heading` is free text. The spec makes it a template so
89
+ * "a consumer's changelog has another shape" is an edit rather
90
+ * than a fork, and which placeholders it may carry, and what an
91
+ * unknown one renders to, is `release/changelog.ts`'s to say. So
92
+ * nothing here refuses a heading for the placeholders it spells.
93
+ * - No `release` setting is a `CommandLineSetting`, for the
94
+ * reason the `pr` section gives: the `release` commands read these
95
+ * settings beside their own arguments, and a global flag nobody
96
+ * typed would be one this module invented.
97
+ *
98
+ * Four more `release` settings belong to the plan in which no branch
99
+ * owns a version number — a branch commits one change fragment, and
100
+ * `rafa release settle` folds the fragments into a version on the base
101
+ * branch after the merges:
102
+ *
103
+ * - `release.fragments` defaults to `.changes`, the directory a
104
+ * fragment is written into. It is a path relative to the repository
105
+ * root and never under `.rafa/`, which is gitignored; the reader,
106
+ * `config-readers.ts`'s `fragmentsDirectory`, says why.
107
+ * - `release.strategy` defaults to `semver-by-level`, and that is the
108
+ * only value it accepts today: a closed list of one, so a file
109
+ * naming a strategy that does not exist is refused rather than
110
+ * folded by a strategy it did not name.
111
+ * - `release.settle` defaults to `push`: settle pushes the settled
112
+ * commit to the base branch, and `pr` opens a pull request with it
113
+ * instead, for a base branch that takes no direct push.
114
+ * - `release.tag` defaults to `manual`: `rafa release tag` stays the
115
+ * one write of the tag, and `settle` has settle put it on the
116
+ * commit it pushes.
117
+ *
118
+ * One more `release` setting is text `rafa release tag` prints and
119
+ * `rafa release publish` runs:
120
+ *
121
+ * - `release.publishCommand` defaults to `npm publish`, the command
122
+ * `rafa release tag` names for the publish after the tag and
123
+ * `rafa release publish` runs in each tagged unit's folder. It is free
124
+ * text, so a project that publishes with another tool, or with a
125
+ * flag such as `--tag next`, says so here. It was read off the
126
+ * manifest's `packageManager` field until 2026-09-30, which named
127
+ * `bun publish` for this repository while its releases are
128
+ * published with `npm publish`: the tool a project installs with is
129
+ * not the tool it publishes with.
130
+ *
131
+ * One more `release` setting says who publishes a tagged version:
132
+ *
133
+ * - `release.publish` defaults to `manual`: a person runs the publish
134
+ * after the tag. `ci` says the pushed tag publishes through the
135
+ * project's CI workflow instead. It is the third key the release
136
+ * ladder is read off, beside `release.settle` and `release.tag`.
137
+ *
138
+ * One more `release` setting is for the repository that releases rafa:
139
+ *
140
+ * - `release.moveLock` defaults to `false`. When it is `true`, settle
141
+ * also writes `rafa.lock` at the repository root to the version it
142
+ * settles, in the same release commit as the version file and the
143
+ * changelog, so the repository's own lock follows the rafa it
144
+ * publishes. It is read through `flag`, so `"true"`, `yes` and `1`
145
+ * are refused, and it is not a `CommandLineSetting`.
146
+ *
147
+ * ## The `dangerous` key
148
+ *
149
+ * `dangerous.acceptVersionCollision` has `rafa pr merge` accept, on
150
+ * every run, a branch the release guard reads as a `collision` — its
151
+ * version already on the base branch with different notes — which it
152
+ * refuses whatever `pr.versionCollision` says. It is read as `dangerous.acceptStaleRefs`
153
+ * is, for the reasons `config-schema.ts`'s "The `dangerous` section"
154
+ * gives: it defaults to `false` and not null, it goes through `flag` so
155
+ * `"true"`, `yes` and `1` are refused, and it is not a
156
+ * `CommandLineSetting`.
157
+ */
158
+ import type { MergeMethod } from './pr/types.js';
159
+ import type { ConfigSection, SettingSpec } from '@open-tomato/rafa/core/config';
160
+ import type { PrProvider, Reader, ReleaseEnabled, ReleasePublishMode, ReleaseSettleMode, ReleaseStrategy, ReleaseTagMode, VersionCollisionMode } from '@open-tomato/rafa/core/config/sections';
161
+ declare module '@open-tomato/rafa/core/config/config-schema' {
162
+ /** The `release` section's fields, added to core's. */
163
+ interface RafaConfig extends PrSettings, ReleaseSettings, DangerousReleaseSettings {
164
+ }
165
+ }
166
+ /**
167
+ * The `pr` and `release` keys a file writes, both namespaces this
168
+ * section's alone; `src/config/shape.ts` composes them into `ConfigShape`.
169
+ */
170
+ export interface ReleaseShape {
171
+ readonly pr: {
172
+ readonly provider: PrProvider;
173
+ readonly mergeMethod: MergeMethod;
174
+ readonly base: string;
175
+ readonly resolveBudget: number;
176
+ readonly versionCollision: VersionCollisionMode;
177
+ };
178
+ readonly release: {
179
+ readonly enabled: ReleaseEnabled;
180
+ readonly versionFile: string;
181
+ readonly changelog: string;
182
+ readonly heading: string;
183
+ readonly fragments: string;
184
+ readonly strategy: ReleaseStrategy;
185
+ readonly settle: ReleaseSettleMode;
186
+ readonly tag: ReleaseTagMode;
187
+ readonly publishCommand: string;
188
+ readonly publish: ReleasePublishMode;
189
+ readonly moveLock: boolean;
190
+ };
191
+ }
192
+ /**
193
+ * `dangerous.acceptVersionCollision`, the section's part of the shared
194
+ * `dangerous` namespace; `src/config/shape.ts` composes it into
195
+ * `DangerousShape` beside core's consents.
196
+ */
197
+ export interface ReleaseDangerousShape {
198
+ readonly acceptVersionCollision: boolean;
199
+ }
200
+ /** The `pr` section's settings, resolved. */
201
+ export interface PrSettings {
202
+ /**
203
+ * The provider every `pr` action goes through, or null to read it off
204
+ * the `origin` remote. `pr.provider`.
205
+ */
206
+ prProvider: PrProvider | null;
207
+ /** How `pr merge` merges, unless `--method` names another. `pr.mergeMethod`. */
208
+ prMergeMethod: MergeMethod;
209
+ /**
210
+ * The branch a pull request is opened into, or null for whatever the
211
+ * remote calls its default branch. `pr.base`.
212
+ */
213
+ prBase: string | null;
214
+ /**
215
+ * The budget in US dollars each `pr triage --resolve` session is
216
+ * spawned with. `pr.resolveBudget`.
217
+ */
218
+ prResolveBudget: number;
219
+ /**
220
+ * How `pr merge` reacts to a branch the release guard reads as
221
+ * `missing` or `stale`. `pr.versionCollision`.
222
+ */
223
+ prVersionCollision: VersionCollisionMode;
224
+ }
225
+ /** The `release` section's settings, resolved. */
226
+ export interface ReleaseSettings {
227
+ /**
228
+ * Whether a run bumps the version and writes a changelog entry, or
229
+ * `auto` to decide it off the two files below. `release.enabled`.
230
+ */
231
+ releaseEnabled: ReleaseEnabled;
232
+ /**
233
+ * The manifest the version is read from and written back to, from
234
+ * the repository root. `release.versionFile`.
235
+ */
236
+ releaseVersionFile: string;
237
+ /**
238
+ * The changelog an entry is inserted into, from the repository root.
239
+ * `release.changelog`.
240
+ */
241
+ releaseChangelog: string;
242
+ /** The template one entry's heading is rendered from. `release.heading`. */
243
+ releaseHeading: string;
244
+ /**
245
+ * The directory change fragments are written into, from the
246
+ * repository root. `release.fragments`.
247
+ */
248
+ releaseFragments: string;
249
+ /** The strategy the fragments are folded into a version by. `release.strategy`. */
250
+ releaseStrategy: ReleaseStrategy;
251
+ /** How settle lands the settled version on the base branch. `release.settle`. */
252
+ releaseSettle: ReleaseSettleMode;
253
+ /** Who tags a settled version. `release.tag`. */
254
+ releaseTag: ReleaseTagMode;
255
+ /** The command `rafa release tag` prints for the publish and `rafa release publish` runs. `release.publishCommand`. */
256
+ releasePublishCommand: string;
257
+ /** Who publishes a tagged version: a person, or CI on the pushed tag. `release.publish`. */
258
+ releasePublish: ReleasePublishMode;
259
+ /**
260
+ * Whether settle also writes `rafa.lock` to the version it settles,
261
+ * in the same release commit. `release.moveLock`.
262
+ */
263
+ releaseMoveLock: boolean;
264
+ }
265
+ /** The `dangerous` setting the release plan adds, resolved. */
266
+ export interface DangerousReleaseSettings {
267
+ /**
268
+ * Whether `pr merge` accepts, on every run, a branch the release
269
+ * guard reads as a `collision`. `dangerous.acceptVersionCollision`.
270
+ */
271
+ dangerousAcceptVersionCollision: boolean;
272
+ }
273
+ /** What every `pr` setting resolves to when no layer names it. */
274
+ export declare const PR_DEFAULTS: Readonly<PrSettings>;
275
+ /** What every `release` setting resolves to when no layer names it. */
276
+ export declare const RELEASE_DEFAULTS: Readonly<ReleaseSettings>;
277
+ /** What the release plan's `dangerous` setting resolves to when no layer names it. */
278
+ export declare const DANGEROUS_RELEASE_DEFAULTS: Readonly<DangerousReleaseSettings>;
279
+ /**
280
+ * Accepts one of the pull request port's three merge methods. The list
281
+ * is the port's (`pr/types.ts`), which spells them to match what
282
+ * `gh pr merge` takes, so a second spelling here could not disagree
283
+ * with it.
284
+ *
285
+ * It sits here, beside the one setting that reads it, and not among
286
+ * core's readers in `config-sections.ts`, so no core file imports
287
+ * `pr/types.ts`. The port is reached at `./pr/types.js` and not through
288
+ * the `./pr/index.js` barrel, because the barrel carries `pr/gh.ts`,
289
+ * which imports the config's sections barrel and the `gh` spawner:
290
+ * importing it here would put the CLI adapter behind every config read.
291
+ * `pr/types.ts` imports types alone, so this import reaches nothing back.
292
+ */
293
+ export declare const mergeMethod: Reader<MergeMethod>;
294
+ /** The `pr` section's setting specs, in the order problems are reported. */
295
+ export declare const PR_SETTINGS: {
296
+ readonly [K in keyof PrSettings]: SettingSpec<K>;
297
+ };
298
+ /** The `release` section's setting specs, in the order problems are reported. */
299
+ export declare const RELEASE_SETTINGS: {
300
+ readonly [K in keyof ReleaseSettings]: SettingSpec<K>;
301
+ };
302
+ /** The release plan's `dangerous` setting spec. */
303
+ export declare const DANGEROUS_RELEASE_SETTINGS: {
304
+ readonly [K in keyof DangerousReleaseSettings]: SettingSpec<K>;
305
+ };
306
+ /** The `release` section: the `pr` and `release` keys and `dangerous.acceptVersionCollision`, with their defaults and no check. */
307
+ export declare const RELEASE_SECTION: ConfigSection;