@open-tomato/rafa 0.45.0 → 0.47.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 +285 -23
- package/dist/PROMPT.md +18 -1
- package/dist/adapters/logger/settings.d.ts +132 -0
- package/dist/bugs/closest.d.ts +19 -0
- package/dist/bugs/fenced.d.ts +8 -0
- package/dist/bugs/places.d.ts +20 -0
- package/dist/bugs/record.d.ts +145 -0
- package/dist/bugs/title.d.ts +83 -0
- package/dist/bundled/agents/doc-updater.md +17 -3
- package/dist/bundled/agents/loop-implementer.md +14 -2
- package/dist/bundled/operators/skills/rafa-stretch-pit-stop/SKILL.md +10 -3
- package/dist/bundled/operators/skills/rafa-stretch-sweep/SKILL.md +5 -0
- package/dist/bundled/skills/dev-planner/SKILL.md +101 -18
- package/dist/cli.js +76536 -64285
- package/dist/config/entry.d.ts +119 -0
- package/dist/config/index.d.ts +41 -0
- package/dist/config/index.js +54 -0
- package/dist/config/shape.d.ts +235 -0
- package/dist/config/templates.d.ts +64 -0
- package/dist/config-registry.d.ts +136 -0
- package/dist/config-schema-board-project.d.ts +157 -0
- package/dist/config-schema-bugs.d.ts +71 -0
- package/dist/config-schema-checks.d.ts +114 -0
- package/dist/config-schema-errors.d.ts +54 -0
- package/dist/config-schema-features.d.ts +64 -0
- package/dist/config-schema-hub.d.ts +152 -0
- package/dist/config-schema-issues.d.ts +95 -0
- package/dist/config-schema-logger.d.ts +91 -0
- package/dist/config-schema-loop-continue.d.ts +122 -0
- package/dist/config-schema-loop-retries.d.ts +94 -0
- package/dist/config-schema-release.d.ts +306 -0
- package/dist/config-schema-tests.d.ts +178 -0
- package/dist/config-schema-triage.d.ts +142 -0
- package/dist/config-schema-wrap-up.d.ts +96 -0
- package/dist/core/command/command.d.ts +228 -0
- package/dist/core/command/confirm.d.ts +73 -0
- package/dist/core/command/index.d.ts +130 -0
- package/dist/core/command/lazy.d.ts +54 -0
- package/dist/core/command/registry-types.d.ts +96 -0
- package/dist/core/command/running.d.ts +96 -0
- package/dist/core/command/shared-flags.d.ts +40 -0
- package/dist/core/command/spends.d.ts +39 -0
- package/dist/core/command/types.d.ts +92 -0
- package/dist/core/command/version.d.ts +4 -0
- package/dist/core/config/branch-template.d.ts +20 -0
- package/dist/core/config/config-items.d.ts +86 -0
- package/dist/core/config/config-load-module.d.ts +43 -0
- package/dist/core/config/config-load.d.ts +78 -0
- package/dist/core/config/config-origins.d.ts +58 -0
- package/dist/core/config/config-readers.d.ts +167 -0
- package/dist/core/config/config-schema.d.ts +212 -0
- package/dist/core/config/config-sections.d.ts +493 -0
- package/dist/core/config/config.d.ts +385 -0
- package/dist/core/config/core-section.d.ts +39 -0
- package/dist/core/config/dangerous.d.ts +58 -0
- package/dist/core/config/default-routing.d.ts +16 -0
- package/dist/core/config/index.d.ts +145 -0
- package/dist/core/config/merge-method.d.ts +40 -0
- package/dist/core/config/scope.d.ts +42 -0
- package/dist/core/config/section.d.ts +286 -0
- package/dist/core/config/sections.d.ts +53 -0
- package/dist/core/config/standard-schema.d.ts +27 -0
- package/dist/core/git/commit.d.ts +232 -0
- package/dist/core/git/gh-runner.d.ts +24 -0
- package/dist/core/git/git.d.ts +22 -0
- package/dist/core/git/index.d.ts +85 -0
- package/dist/core/loop/claude.d.ts +388 -0
- package/dist/core/loop/hop-record.d.ts +52 -0
- package/dist/core/loop/index.d.ts +179 -0
- package/dist/core/loop/session-env.d.ts +20 -0
- package/dist/core/loop/session-record-parse.d.ts +70 -0
- package/dist/core/loop/sessions.d.ts +420 -0
- package/dist/core/loop/suite-failure.d.ts +25 -0
- package/dist/core/output/active.d.ts +100 -0
- package/dist/core/output/stream.d.ts +20 -0
- package/dist/core/output/text.d.ts +55 -0
- package/dist/core/plan/block-reader.d.ts +46 -0
- package/dist/core/plan/blocks.d.ts +139 -0
- package/dist/core/plan/declaration.d.ts +366 -0
- package/dist/core/plan/plan-stamp.d.ts +75 -0
- package/dist/core/runtime/identity.d.ts +21 -0
- package/dist/core/runtime/index.d.ts +46 -0
- package/dist/effort/store/bring-forward.d.ts +131 -0
- package/dist/effort/store/check-rows.d.ts +31 -0
- package/dist/effort/store/commit-stats.d.ts +42 -0
- package/dist/effort/store/copy.d.ts +35 -0
- package/dist/effort/store/development-build.d.ts +105 -0
- package/dist/effort/store/effort-levels.d.ts +13 -0
- package/dist/effort/store/findings.d.ts +214 -0
- package/dist/effort/store/fix-schema.d.ts +184 -0
- package/dist/effort/store/index.js +10 -7
- package/dist/effort/store/location.d.ts +44 -0
- package/dist/effort/store/merge-commit-gaps.d.ts +68 -0
- package/dist/effort/store/merge-conflicts.d.ts +91 -0
- package/dist/effort/store/merge-rules.d.ts +82 -0
- package/dist/effort/store/merge-store.d.ts +211 -0
- package/dist/effort/store/merge-union.d.ts +92 -0
- package/dist/effort/store/migrate.d.ts +146 -0
- package/dist/effort/store/migrations.d.ts +92 -0
- package/dist/effort/store/ndjson-files.d.ts +114 -0
- package/dist/effort/store/origins.d.ts +116 -0
- package/dist/effort/store/plan-stubs.d.ts +79 -0
- package/dist/effort/store/rebuild-aside.d.ts +172 -0
- package/dist/effort/store/schema-plan.d.ts +102 -0
- package/dist/effort/store/session-row-types.d.ts +64 -0
- package/dist/effort/store/settings.d.ts +13 -0
- package/dist/effort/store/sqlite.d.ts +340 -0
- package/dist/effort/store/store-generation.d.ts +17 -0
- package/dist/effort/store/store-identity.d.ts +220 -0
- package/dist/effort/store/store-meta.d.ts +305 -0
- package/dist/effort/store/store-replaced.d.ts +72 -0
- package/dist/effort/store/types.d.ts +223 -0
- package/dist/errors/codes.d.ts +56 -0
- package/dist/errors/rafa-codes.d.ts +36 -0
- package/dist/{index-nv34ptht.js → index-38ktnyvz.js} +14 -9
- package/dist/index-3mwsr6wg.js +1070 -0
- package/dist/index-7dgc5g1t.js +13480 -0
- package/dist/index-cbqvgda6.js +766 -0
- package/dist/index-eay1bd2w.js +2632 -0
- package/dist/index-f1y86zbb.js +125 -0
- package/dist/index-n3e31fmw.js +1041 -0
- package/dist/{index-r28fzsvc.js → index-nwzx41g1.js} +351 -166
- package/dist/index-pzpb1rf7.js +153 -0
- package/dist/{index-mgh2s9bj.js → index-r5q2pdky.js} +65 -457
- package/dist/index-z1w83f81.js +4 -0
- package/dist/index.js +17592 -24119
- package/dist/learning/index.js +5 -6
- package/dist/plan/index.js +12 -11
- package/dist/plan-prompt.md +3 -1
- package/dist/ports/index.d.ts +732 -0
- package/dist/ports/learning.d.ts +101 -0
- package/dist/ports/log-level.d.ts +13 -0
- package/dist/ports/spec-review.d.ts +66 -0
- package/dist/ready-6p40c3gw.js +2007 -0
- package/dist/release-templates/release-bot-fragment.yml +153 -0
- package/dist/release-templates/release-publish.yml +110 -0
- package/dist/release-templates/release-settle.yml +122 -0
- package/dist/release-templates/release-tag.yml +102 -0
- package/dist/report/parse.d.ts +415 -0
- package/dist/schema/project-id.d.ts +79 -0
- package/dist/schema/tiers.d.ts +107 -0
- package/package.json +62 -3
- package/dist/index-hf2k497d.js +0 -16
- package/dist/index-nsr78ct2.js +0 -8219
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How a pull request is merged: the {@link MergeMethod} words, the
|
|
3
|
+
* {@link MERGE_METHODS} list a reader validates against and the
|
|
4
|
+
* {@link isMergeMethod} guard.
|
|
5
|
+
*
|
|
6
|
+
* They sat in `src/pr/types.ts`, the pull request port, until the
|
|
7
|
+
* monorepo cut: the `pr.mergeMethod` setting in
|
|
8
|
+
* `src/config-schema-release.ts` read them there, which tied the
|
|
9
|
+
* release section to `src/pr/`. Here they are a core leaf, importing
|
|
10
|
+
* nothing, so the section and the port both read them from the sections
|
|
11
|
+
* barrel `./sections.ts`, and `src/pr/types.ts` re-exports them under
|
|
12
|
+
* the same names for the port's own importers.
|
|
13
|
+
*
|
|
14
|
+
* The setting's reader, `mergeMethod`, stays in
|
|
15
|
+
* `src/config-schema-release.ts` beside the one setting that reads it:
|
|
16
|
+
* this file holds the words, not a reading of the config.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* How a merge is made. GitHub's three, and no other: `gh pr merge`
|
|
20
|
+
* takes exactly `--squash`, `--merge` and `--rebase`, and a provider
|
|
21
|
+
* that cannot do one of them refuses the call rather than substituting
|
|
22
|
+
* another, which would rewrite history the operator did not ask for.
|
|
23
|
+
*/
|
|
24
|
+
export type MergeMethod = 'squash' | 'merge' | 'rebase';
|
|
25
|
+
/**
|
|
26
|
+
* The merge methods, in the order a refusal lists them.
|
|
27
|
+
*
|
|
28
|
+
* A runtime value beside the type so the config reader and the
|
|
29
|
+
* `--method` flag validate against one list rather than each spelling
|
|
30
|
+
* the three words again. Frozen: a caller that pushed onto it would
|
|
31
|
+
* change what every later refusal says it accepts.
|
|
32
|
+
*/
|
|
33
|
+
export declare const MERGE_METHODS: readonly MergeMethod[];
|
|
34
|
+
/**
|
|
35
|
+
* Whether a value is one of {@link MERGE_METHODS}.
|
|
36
|
+
*
|
|
37
|
+
* @param value - Anything, a flag's value or a config reading.
|
|
38
|
+
* @returns True when the value is exactly one of the three words.
|
|
39
|
+
*/
|
|
40
|
+
export declare function isMergeMethod(value: unknown): value is MergeMethod;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One scope's paths, and the project the dispatcher resolved: the
|
|
3
|
+
* shapes `resolveScope` answers in `packages/rafa/src/project/scope.ts`, and
|
|
4
|
+
* {@link scopeAt}, which builds a scope from its base directory.
|
|
5
|
+
*
|
|
6
|
+
* The walk itself, `resolveScope` with its refusals and its hint, stays
|
|
7
|
+
* in `packages/rafa/src/project/scope.ts`, which imports these names from the config
|
|
8
|
+
* barrel and re-exports them under the same names. Core holds the
|
|
9
|
+
* shapes alone, so `RafaContext` can name the project a command runs in
|
|
10
|
+
* and the session store can find a project's `.rafa` directory without
|
|
11
|
+
* importing a file above core.
|
|
12
|
+
*/
|
|
13
|
+
import type { ConfigRoots } from './config-load.js';
|
|
14
|
+
/** One scope's paths: its `.rafa` directory and its config file. */
|
|
15
|
+
export interface Scope {
|
|
16
|
+
/** `<base>/.rafa`. */
|
|
17
|
+
readonly dir: string;
|
|
18
|
+
/**
|
|
19
|
+
* The config file. For a project found, the first of
|
|
20
|
+
* {@link CONFIG_LOOKUP} its root holds; otherwise, and for the user
|
|
21
|
+
* scope, `<base>/.rafa/config.yaml`, the file `rafa init` writes.
|
|
22
|
+
*/
|
|
23
|
+
readonly configFile: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The walk found a project. The answer is the `ConfigRoots` for
|
|
27
|
+
* `loadConfig`: `root` is the project root, a real path, and `home` is
|
|
28
|
+
* the home as the caller gave it.
|
|
29
|
+
*/
|
|
30
|
+
export interface ProjectFound extends ConfigRoots {
|
|
31
|
+
readonly found: true;
|
|
32
|
+
/** The project scope, under `root`. */
|
|
33
|
+
readonly project: Scope;
|
|
34
|
+
/** The user scope, under `home`. */
|
|
35
|
+
readonly user: Scope;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* The scope under `base`: `base` is a project root or a home directory.
|
|
39
|
+
* `configFile` is `file` when given, the lookup name found under
|
|
40
|
+
* `base`, and `<base>/.rafa/config.yaml` otherwise.
|
|
41
|
+
*/
|
|
42
|
+
export declare function scopeAt(base: string, file?: string): Scope;
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The section contract: how a slice of the config schema is handed to
|
|
3
|
+
* core, and the registry core reads the merged slices from.
|
|
4
|
+
*
|
|
5
|
+
* A {@link ConfigSection} is one package's part of the schema: its
|
|
6
|
+
* `settings` (each setting's file key, reader and command-line flag, as
|
|
7
|
+
* a partial of the record of every setting, {@link SettingsRecord}), its
|
|
8
|
+
* `defaults` (a partial of {@link RafaConfig}), and the cross-key
|
|
9
|
+
* `checks` run over the resolved config. {@link registerConfigSections}
|
|
10
|
+
* merges sections into the active registry, which {@link activeSettings},
|
|
11
|
+
* {@link activeDefaults} and {@link activeChecks} answer, and the key
|
|
12
|
+
* indexes below are read off. Core names no section here: the list of
|
|
13
|
+
* sections lives outside `packages/rafa/src/core/`, in `src/config-registry.ts`, the
|
|
14
|
+
* module that calls {@link registerConfigSections}.
|
|
15
|
+
*
|
|
16
|
+
* {@link registeredDefaults} and {@link registeredSettings} answer the
|
|
17
|
+
* same two records typed whole, as {@link RafaConfig} and
|
|
18
|
+
* {@link SettingsRecord}, for a feature file that reads a default or a
|
|
19
|
+
* spec without importing that module; each refuses with a
|
|
20
|
+
* {@link ConfigSectionError} naming it while nothing is registered.
|
|
21
|
+
*
|
|
22
|
+
* This file imports types alone, so it loads first in any order and can
|
|
23
|
+
* be imported by value from the loader and from every section file
|
|
24
|
+
* without closing a runtime cycle.
|
|
25
|
+
*
|
|
26
|
+
* ## The refusals
|
|
27
|
+
*
|
|
28
|
+
* A registration that breaks one of four rules throws a
|
|
29
|
+
* {@link ConfigSectionError} listing every problem it found, one
|
|
30
|
+
* sentence each, and leaves the active registry as it was:
|
|
31
|
+
*
|
|
32
|
+
* - A setting name registered by one section and again by another, in
|
|
33
|
+
* this call or an earlier one. The sentence names both packages, the
|
|
34
|
+
* one holding the name first.
|
|
35
|
+
* - A file key defined by one section and again by another under a
|
|
36
|
+
* different setting name. Two settings read off one key would
|
|
37
|
+
* answer one value under two names, so the sentence names both
|
|
38
|
+
* packages and both setting names, the one holding the key first.
|
|
39
|
+
* - A file key opening with `dangerous.` defined by one section and
|
|
40
|
+
* again by another under the same setting name. A `dangerous.*` key
|
|
41
|
+
* is a person's consent to a risk, so a second package defining it
|
|
42
|
+
* could widen what that consent was given for; the sentence names
|
|
43
|
+
* both packages, and the setting-name sentence is read beside it.
|
|
44
|
+
* Any other key redefined under the same name reads the setting-name
|
|
45
|
+
* sentence alone.
|
|
46
|
+
* - A {@link RafaConfig} field no section defines: a default given for
|
|
47
|
+
* a field no registered section has a setting for, or a setting no
|
|
48
|
+
* registered section gives a default for. The sentence names the
|
|
49
|
+
* package that gave the half it has. Types are erased at runtime, so
|
|
50
|
+
* a field declared on {@link RafaConfig} that no section mentions at
|
|
51
|
+
* all is out of this module's reach; the module that lists the
|
|
52
|
+
* sections is where a complete set is held.
|
|
53
|
+
*
|
|
54
|
+
* The completeness rule reads the registry as it would stand after the
|
|
55
|
+
* call, so a section whose setting and default come in two calls is
|
|
56
|
+
* refused at the first. A section's package must be a non-empty string,
|
|
57
|
+
* since every refusal names one.
|
|
58
|
+
*
|
|
59
|
+
* The key rules compare one section with the sections before it, in
|
|
60
|
+
* this call or an earlier one; two setting names one section gives the
|
|
61
|
+
* same key are not compared with each other.
|
|
62
|
+
*
|
|
63
|
+
* ## A registry is a value
|
|
64
|
+
*
|
|
65
|
+
* {@link mergeConfigSections} answers a new {@link ConfigSectionRegistry}
|
|
66
|
+
* and leaves the one it was handed unchanged; each section is copied and
|
|
67
|
+
* frozen as it is accepted, so editing a section object afterwards
|
|
68
|
+
* changes nothing registered. The active registry is the one
|
|
69
|
+
* module-level value: {@link registerConfigSections} replaces it with a
|
|
70
|
+
* merge and answers the one it replaced, and
|
|
71
|
+
* {@link restoreConfigSections} puts one back. Bun runs every test file
|
|
72
|
+
* in one process, so a case that registers puts the previous registry
|
|
73
|
+
* back in a `finally`, or every file bun runs later reads its sections.
|
|
74
|
+
* {@link EMPTY_CONFIG_REGISTRY} is the registry before any registration.
|
|
75
|
+
*
|
|
76
|
+
* ## The key indexes
|
|
77
|
+
*
|
|
78
|
+
* `config.ts` sorts a file's keys through three indexes of the active
|
|
79
|
+
* registry's settings: {@link activeSettingByKey}, the setting each
|
|
80
|
+
* dotted file key names; {@link activeSectionPaths}, every dotted prefix
|
|
81
|
+
* a setting sits under, which are the sections a file may open; and
|
|
82
|
+
* {@link activeKnownKeysAbove}, the keys a warning about an unknown key
|
|
83
|
+
* lists. Each is built on first read and kept per registry, so a
|
|
84
|
+
* registration or a restore is read at once and a registry is indexed
|
|
85
|
+
* once. Keys are looked up in a `Map` and a `Set`, never with `in` or an
|
|
86
|
+
* object index: `Bun.YAML.parse` returns a key spelled `constructor`,
|
|
87
|
+
* `toString` or `__proto__` as an ordinary own key, and an object lookup
|
|
88
|
+
* would match it against `Object.prototype` instead.
|
|
89
|
+
*
|
|
90
|
+
* The indexes follow registration order: the keys under a path are
|
|
91
|
+
* listed in the order their settings were registered. The registry
|
|
92
|
+
* registers its sections cut into the order the schema has always
|
|
93
|
+
* reported problems in, so a warning lists the keys it always listed;
|
|
94
|
+
* `src/config-registry.test.ts` holds the indexes to the registry's own.
|
|
95
|
+
*
|
|
96
|
+
* ## The load hook
|
|
97
|
+
*
|
|
98
|
+
* A setting core resolves can be read by a module outside `packages/rafa/src/core/`
|
|
99
|
+
* that core must not import: the logger's settings are read through
|
|
100
|
+
* `loggerSettingsOf` in `packages/rafa/src/config-schema-logger.ts`. So the module that
|
|
101
|
+
* lists the sections also hands core one {@link ConfigLoadHook} with
|
|
102
|
+
* {@link setConfigLoadHook}, and `loadConfig` (`config-load.ts`) calls
|
|
103
|
+
* {@link activeConfigLoadHook} with every config it resolves, before it
|
|
104
|
+
* prints the config's warnings. The hook is a module-level value of its
|
|
105
|
+
* own, beside the registry rather than in it: restoring a registry
|
|
106
|
+
* leaves the hook as it was, and a case that sets one puts the previous
|
|
107
|
+
* hook back in a `finally`, as a case that registers does.
|
|
108
|
+
*
|
|
109
|
+
* ## The template hook
|
|
110
|
+
*
|
|
111
|
+
* A config template is a named entry a file adopts with its `templates`
|
|
112
|
+
* key, and the templates live outside `packages/rafa/src/core/` too,
|
|
113
|
+
* in `src/config/templates.ts`, which core must not import. So core
|
|
114
|
+
* takes one {@link ConfigTemplateHook} through
|
|
115
|
+
* {@link setConfigTemplateHook}, for the module that lists the sections
|
|
116
|
+
* to set, and answers it off {@link activeConfigTemplateHook} for the
|
|
117
|
+
* loader to call by name. The hook answers the entry a name
|
|
118
|
+
* stands for, a mapping nested as a file nests its keys (the shape of a
|
|
119
|
+
* `ConfigEntry`, `src/config/entry.ts`, typed here as a plain
|
|
120
|
+
* {@link Mapping} since core imports nothing from `src/config/`), or null
|
|
121
|
+
* for a name it does not know, and may carry the `names` it knows, which
|
|
122
|
+
* the loader lists when it refuses a name. Like the load hook it is a module-level
|
|
123
|
+
* value of its own, beside the registry: restoring a registry leaves it
|
|
124
|
+
* as it was, and a case that sets one puts the previous hook back in a
|
|
125
|
+
* `finally`.
|
|
126
|
+
*/
|
|
127
|
+
import type { SettingOrigin } from './config-origins.js';
|
|
128
|
+
import type { ConfigSetting, RafaConfig, SettingSpec } from './config-schema.js';
|
|
129
|
+
import type { Mapping } from './config-sections.js';
|
|
130
|
+
import type { ConfigSource } from './config.js';
|
|
131
|
+
/** Every setting's spec, by name: the record a section hands a part of. */
|
|
132
|
+
export type SettingsRecord = {
|
|
133
|
+
readonly [K in ConfigSetting]: SettingSpec<K>;
|
|
134
|
+
};
|
|
135
|
+
/** What a section's check reads: the resolved values, their layers and the files read. */
|
|
136
|
+
export interface ConfigCheckInput {
|
|
137
|
+
/** The value each setting resolved to. */
|
|
138
|
+
readonly config: Readonly<RafaConfig>;
|
|
139
|
+
/** The layer that answered each setting. */
|
|
140
|
+
readonly sources: Readonly<Record<ConfigSetting, ConfigSource>>;
|
|
141
|
+
/** The project's file consulted, or null when there was none. */
|
|
142
|
+
readonly path: string | null;
|
|
143
|
+
/** The user scope's file consulted, or null when there was none. */
|
|
144
|
+
readonly userPath: string | null;
|
|
145
|
+
/**
|
|
146
|
+
* The file and entry that answered each setting, null where the
|
|
147
|
+
* command line or a default did: the one reading that tells a scope's
|
|
148
|
+
* local file from its module file, and the user scope's two files,
|
|
149
|
+
* which both report `user`, apart.
|
|
150
|
+
*/
|
|
151
|
+
readonly provenance: Readonly<Record<ConfigSetting, SettingOrigin | null>>;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* A cross-key refusal: the problems the resolved config holds, one
|
|
155
|
+
* sentence each, or an empty list when it holds none.
|
|
156
|
+
*/
|
|
157
|
+
export type ConfigCheck = (input: ConfigCheckInput) => readonly string[];
|
|
158
|
+
/** One package's slice of the config schema. */
|
|
159
|
+
export interface ConfigSection {
|
|
160
|
+
/** The package the section belongs to, named by every refusal. */
|
|
161
|
+
readonly package: string;
|
|
162
|
+
/** The specs of the settings the section defines. */
|
|
163
|
+
readonly settings: Partial<SettingsRecord>;
|
|
164
|
+
/** The default of each setting the section defines. */
|
|
165
|
+
readonly defaults: Partial<RafaConfig>;
|
|
166
|
+
/** The cross-key refusals run over the resolved config. */
|
|
167
|
+
readonly checks?: readonly ConfigCheck[];
|
|
168
|
+
}
|
|
169
|
+
/** The sections merged so far, and what core reads off them. */
|
|
170
|
+
export interface ConfigSectionRegistry {
|
|
171
|
+
/** Every section accepted, copied and frozen, in registration order. */
|
|
172
|
+
readonly sections: readonly ConfigSection[];
|
|
173
|
+
/** Every setting's spec, in registration order. */
|
|
174
|
+
readonly settings: Readonly<Partial<SettingsRecord>>;
|
|
175
|
+
/** Every setting's default. */
|
|
176
|
+
readonly defaults: Readonly<Partial<RafaConfig>>;
|
|
177
|
+
/** Every section's checks, in registration order. */
|
|
178
|
+
readonly checks: readonly ConfigCheck[];
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* A registration refused: a setting name defined twice, a file key two
|
|
182
|
+
* sections define under two setting names or a `dangerous.` key under
|
|
183
|
+
* one, a field no section defines, or a section with no package name.
|
|
184
|
+
*/
|
|
185
|
+
export declare class ConfigSectionError extends Error {
|
|
186
|
+
/** Every problem found, one sentence each. */
|
|
187
|
+
readonly problems: readonly string[];
|
|
188
|
+
constructor(problems: readonly string[]);
|
|
189
|
+
}
|
|
190
|
+
/** The registry before any registration: no section, setting, default or check. */
|
|
191
|
+
export declare const EMPTY_CONFIG_REGISTRY: ConfigSectionRegistry;
|
|
192
|
+
/**
|
|
193
|
+
* A new registry holding `registry`'s sections and then `sections`, or a
|
|
194
|
+
* {@link ConfigSectionError} listing every problem found; see the module
|
|
195
|
+
* note. `registry` is left unchanged either way.
|
|
196
|
+
*/
|
|
197
|
+
export declare function mergeConfigSections(registry: ConfigSectionRegistry, sections: readonly ConfigSection[]): ConfigSectionRegistry;
|
|
198
|
+
/**
|
|
199
|
+
* Merges `sections` into the active registry, or throws a
|
|
200
|
+
* {@link ConfigSectionError} and leaves it unchanged. Answers the
|
|
201
|
+
* registry it replaced, for {@link restoreConfigSections}.
|
|
202
|
+
*/
|
|
203
|
+
export declare function registerConfigSections(sections: readonly ConfigSection[]): ConfigSectionRegistry;
|
|
204
|
+
/** Makes `registry` the active one: what {@link registerConfigSections} answered, or {@link EMPTY_CONFIG_REGISTRY}. */
|
|
205
|
+
export declare function restoreConfigSections(registry: ConfigSectionRegistry): void;
|
|
206
|
+
/** Every registered section, in registration order. */
|
|
207
|
+
export declare function activeSections(): readonly ConfigSection[];
|
|
208
|
+
/** Every registered setting's spec, in registration order. */
|
|
209
|
+
export declare function activeSettings(): Readonly<Partial<SettingsRecord>>;
|
|
210
|
+
/** Every registered setting's default. */
|
|
211
|
+
export declare function activeDefaults(): Readonly<Partial<RafaConfig>>;
|
|
212
|
+
/** Every registered section's checks, in registration order. */
|
|
213
|
+
export declare function activeChecks(): readonly ConfigCheck[];
|
|
214
|
+
/**
|
|
215
|
+
* Every setting's default, typed as the whole {@link RafaConfig}: the
|
|
216
|
+
* active registry's defaults, the same object {@link activeDefaults}
|
|
217
|
+
* answers, for a file outside `packages/rafa/src/core/` that reads a
|
|
218
|
+
* default without importing the module that lists the sections.
|
|
219
|
+
*
|
|
220
|
+
* Throws a {@link ConfigSectionError} naming `src/config-registry.ts`
|
|
221
|
+
* while no section is registered, as `loadConfig` refuses then. Types
|
|
222
|
+
* are erased at runtime, so core cannot list the {@link ConfigSetting}
|
|
223
|
+
* names and refuses an empty registry alone: the completeness rule
|
|
224
|
+
* pairs every registered setting with its default, and
|
|
225
|
+
* `src/config-registry.test.ts` holds what the registration answers
|
|
226
|
+
* here equal to the registry's whole `CONFIG_DEFAULTS`. Read it when a
|
|
227
|
+
* default is needed, never as a module loads: an entry registers after
|
|
228
|
+
* its imports have loaded.
|
|
229
|
+
*/
|
|
230
|
+
export declare function registeredDefaults(): Readonly<RafaConfig>;
|
|
231
|
+
/**
|
|
232
|
+
* Every setting's spec, typed as the whole {@link SettingsRecord}: the
|
|
233
|
+
* active registry's settings, the same object {@link activeSettings}
|
|
234
|
+
* answers. Refuses as {@link registeredDefaults} does, on the same
|
|
235
|
+
* reading, and `src/config-registry.test.ts` holds it equal to the
|
|
236
|
+
* registry's whole `SETTINGS`.
|
|
237
|
+
*/
|
|
238
|
+
export declare function registeredSettings(): SettingsRecord;
|
|
239
|
+
/** Every registered setting's name, by the dotted key a file spells it with. */
|
|
240
|
+
export declare function activeSettingByKey(): ReadonlyMap<string, ConfigSetting>;
|
|
241
|
+
/** Every dotted prefix a registered setting sits under: the sections a file opens. */
|
|
242
|
+
export declare function activeSectionPaths(): ReadonlySet<string>;
|
|
243
|
+
/**
|
|
244
|
+
* The nearest path above `key` with registered keys, and those keys, in
|
|
245
|
+
* registration order. An item path such as `modules[0]` looks up the
|
|
246
|
+
* item keys of `modules`.
|
|
247
|
+
*
|
|
248
|
+
* @param key - A dotted key a file spelled, `modules[0].kind` included.
|
|
249
|
+
* @returns The path the keys sit under, `''` for the top, and the keys.
|
|
250
|
+
*/
|
|
251
|
+
export declare function activeKnownKeysAbove(key: string): [string, readonly string[]];
|
|
252
|
+
/**
|
|
253
|
+
* What `loadConfig` hands every config it resolves to, before printing
|
|
254
|
+
* its warnings: the reading of settings a module outside `packages/rafa/src/core/`
|
|
255
|
+
* acts on. See the module note.
|
|
256
|
+
*/
|
|
257
|
+
export type ConfigLoadHook = (config: Readonly<RafaConfig>) => void;
|
|
258
|
+
/**
|
|
259
|
+
* Makes `hook` the one `loadConfig` calls, or clears it with null.
|
|
260
|
+
* Answers the hook it replaced, for a caller to put back.
|
|
261
|
+
*/
|
|
262
|
+
export declare function setConfigLoadHook(hook: ConfigLoadHook | null): ConfigLoadHook | null;
|
|
263
|
+
/** The hook `loadConfig` calls with every config it resolves, or null when none is set. */
|
|
264
|
+
export declare function activeConfigLoadHook(): ConfigLoadHook | null;
|
|
265
|
+
/**
|
|
266
|
+
* The entry a config template's name stands for, a mapping nested as a
|
|
267
|
+
* file nests its keys, or null for a name the hook does not know. See
|
|
268
|
+
* "The template hook" in the module note.
|
|
269
|
+
*/
|
|
270
|
+
export interface ConfigTemplateHook {
|
|
271
|
+
/** The entry `name` stands for, or null for a name the hook does not know. */
|
|
272
|
+
(name: string): Mapping | null;
|
|
273
|
+
/**
|
|
274
|
+
* Every name the hook knows, which `loadConfig` lists when it refuses
|
|
275
|
+
* one a file gives. Absent from a hook that cannot list its names.
|
|
276
|
+
*/
|
|
277
|
+
readonly names?: readonly string[];
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Makes `hook` the one core reads a config template's entry from, or
|
|
281
|
+
* clears it with null. Answers the hook it replaced, for a caller to put
|
|
282
|
+
* back.
|
|
283
|
+
*/
|
|
284
|
+
export declare function setConfigTemplateHook(hook: ConfigTemplateHook | null): ConfigTemplateHook | null;
|
|
285
|
+
/** The hook core reads a config template's entry from, or null when none is set. */
|
|
286
|
+
export declare function activeConfigTemplateHook(): ConfigTemplateHook | null;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The barrel over the config's value readers: every name
|
|
3
|
+
* `config-sections.ts`, `config-readers.ts`, `branch-template.ts` and
|
|
4
|
+
* `merge-method.ts` export, and nothing else.
|
|
5
|
+
*
|
|
6
|
+
* A file outside `packages/rafa/src/core/` imports this file and never the four behind
|
|
7
|
+
* it (`scripts/survey/core-barrels.ts` measures that, and
|
|
8
|
+
* `src/tests/core-barrels.sweep.test.ts` holds it against the tree). A
|
|
9
|
+
* file inside `packages/rafa/src/core/` imports the four directly and never this file.
|
|
10
|
+
*
|
|
11
|
+
* ## Why the pair has a barrel of its own
|
|
12
|
+
*
|
|
13
|
+
* `packages/rafa/src/core/config/` has three barrels, all listed under `CORE_BARRELS`
|
|
14
|
+
* in `scripts/survey/core-moves.ts`. This one holds the leaf pair: the
|
|
15
|
+
* two files import each other one way (`config-readers.ts` reads
|
|
16
|
+
* `config-sections.ts`), `node:path`, and four modules that import none
|
|
17
|
+
* of the config back. The schema's section files (`src/config-schema-*.ts`)
|
|
18
|
+
* import the pair by value. While `config-merged.ts` imported them by
|
|
19
|
+
* value in turn, one barrel over the pair and the schema would have made
|
|
20
|
+
* every section file import a barrel that imports it back: a runtime
|
|
21
|
+
* cycle that fails as a `ReferenceError` at load, in one import order
|
|
22
|
+
* only. That file is retired, and measured since, no value import of a
|
|
23
|
+
* file behind `index.ts` reaches a section file, so that cycle is no
|
|
24
|
+
* longer what keeps the two barrels apart; they stay as the move left
|
|
25
|
+
* them, a name with one barrel to be learned from.
|
|
26
|
+
*
|
|
27
|
+
* `branch-template.ts` joined the pair with the readers of a branch name
|
|
28
|
+
* through the `naming.branch` template, `branchGlob` and `stubOfBranch`.
|
|
29
|
+
* It imports `config-readers.ts` alone, so it is a leaf as the pair is,
|
|
30
|
+
* and it sits beside `branchFromTemplate`, the writer it reads back.
|
|
31
|
+
*
|
|
32
|
+
* `merge-method.ts` joined with the words `pr.mergeMethod` takes, its
|
|
33
|
+
* list and its guard, moved out of `src/pr/types.ts` so the release
|
|
34
|
+
* section reads them without reaching the pull request port. It imports
|
|
35
|
+
* nothing, so it is a leaf too, and `src/pr/types.ts` re-exports its
|
|
36
|
+
* names from here.
|
|
37
|
+
*
|
|
38
|
+
* ## What it exports
|
|
39
|
+
*
|
|
40
|
+
* Each name is spelled, types apart from values, as the entries
|
|
41
|
+
* `src/index.ts` and `src/plan/index.ts` spell theirs.
|
|
42
|
+
*
|
|
43
|
+
* `sections.test.ts` holds the list to the four files: every name any
|
|
44
|
+
* of them exports is here once, as the same binding, and no name is here
|
|
45
|
+
* that none of them exports.
|
|
46
|
+
*/
|
|
47
|
+
export type { ReleasePublishMode, ReleaseSettleMode, ReleaseStrategy, ReleaseTagMode, VersionCollisionMode, } from './config-readers.js';
|
|
48
|
+
export type { BoardRelationshipMode, ClaimsAhead, ClaimsStaleAfter, ClaudeSettingSource, ConfigExtra, ConfigVersion, DuplicatesLevel, InjectMode, LessonSwitch, Mapping, OutputMode, PrProvider, Reader, Reading, ReleaseEnabled, RouteTarget, SkillResolverName, StoreBackend, SyncStrategy, TierPin, TierSwitch, ValueAt, } from './config-sections.js';
|
|
49
|
+
export type { MergeMethod } from './merge-method.js';
|
|
50
|
+
export { branchGlob, stubOfBranch } from './branch-template.js';
|
|
51
|
+
export { BRANCH_STUB, branchFromTemplate, branchTemplate, DEFAULT_BRANCH_TEMPLATE, directory, fragmentsDirectory, isBranchTemplate, mapOf, RELEASE_PUBLISH_MODES, RELEASE_SETTLE_MODES, RELEASE_STRATEGIES, RELEASE_TAG_MODES, releaseFile, releasePublishMode, releaseSettleMode, releaseStrategy, releaseTagMode, routeTable, tierPins, trackerKind, VERSION_COLLISION_MODES, versionCollisionMode, } from './config-readers.js';
|
|
52
|
+
export { below, BOARD_PROJECT_TEMPLATE_DEFAULT, BOARD_RELATIONSHIP_MODES, BUSY_TIMEOUT_MAX_MS, BUSY_TIMEOUT_MIN_MS, busyTimeoutMs, claimDurationHours, CLAIMS_AHEAD, CLAIMS_STALE_DISABLED, claimsAhead, claimsStaleAfter, CLAUDE_SETTING_SOURCES, confidence, CONFIDENCE_MAX, CONFIDENCE_MIN, CONFIG_VERSIONS, dayCount, describeValue, DUPLICATE_LEVELS, duplicatesLevel, flag, githubLogin, INJECT_MODES, isBusyTimeoutMs, isGitHubLogin, isMapping, issueNumber, LESSON_SWITCHES, lessonSwitch, listOf, mapReading, messageOf, oneOf, OUTPUT_MODES, PR_PROVIDERS, projectNumber, projectUrl, recurrenceCount, refused, refusedWith, RELEASE_AUTO, releaseEnabled, routeTarget, SKILL_RESOLVERS, skillResolverName, STORE_BACKENDS, subsetOf, SYNC_STRATEGIES, text, TIER_SWITCHES, tierPin, tierSwitch, usdAmount, } from './config-sections.js';
|
|
53
|
+
export { isMergeMethod, MERGE_METHODS } from './merge-method.js';
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ConfigSection } from './section.js';
|
|
2
|
+
import type { StandardSchemaV1 } from '@open-tomato/define-config';
|
|
3
|
+
/** The vendor every schema built here names. */
|
|
4
|
+
export declare const SCHEMA_VENDOR = "rafa";
|
|
5
|
+
/**
|
|
6
|
+
* One pair of `createLoader`'s `schema` list: the key path of the
|
|
7
|
+
* subtree, outermost key first, and the schema that subtree must
|
|
8
|
+
* satisfy. The empty path names the whole value.
|
|
9
|
+
*/
|
|
10
|
+
export type ConfigSchemaSection = readonly [path: readonly string[], schema: StandardSchemaV1];
|
|
11
|
+
/**
|
|
12
|
+
* A Standard Schema V1 schema whose `validate` runs `section`'s readers
|
|
13
|
+
* over the merged mapping and answers one issue per refusal at the
|
|
14
|
+
* refused key's path; see the module note.
|
|
15
|
+
*
|
|
16
|
+
* @param section - The section whose settings' readers judge the value.
|
|
17
|
+
* @returns A schema validating synchronously, vendor {@link SCHEMA_VENDOR}.
|
|
18
|
+
*/
|
|
19
|
+
export declare function schemaOf(section: ConfigSection): StandardSchemaV1;
|
|
20
|
+
/**
|
|
21
|
+
* The `[path, schema]` list `createLoader`'s `schema` option takes: one
|
|
22
|
+
* pair per section, in the order given, each at the empty path.
|
|
23
|
+
*
|
|
24
|
+
* @param sections - The sections to validate the merged config with.
|
|
25
|
+
* @returns One frozen pair per section.
|
|
26
|
+
*/
|
|
27
|
+
export declare function schemaSectionsOf(sections: readonly ConfigSection[]): readonly ConfigSchemaSection[];
|