@bakers-build/core 0.8.0 → 0.8.1-next.2

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 (35) hide show
  1. package/dist/src/cli/bakers-dir.d.ts +8 -8
  2. package/dist/src/cli/bakers-dir.js +30 -33
  3. package/dist/src/cli/config-inventory.d.ts +2 -0
  4. package/dist/src/cli/config-inventory.js +45 -72
  5. package/dist/src/cli/config-report.d.ts +2 -2
  6. package/dist/src/cli/config-source.js +1 -1
  7. package/dist/src/cli/config-validate.d.ts +49 -0
  8. package/dist/src/cli/config-validate.js +400 -0
  9. package/dist/src/cli/import-config.d.ts +2 -2
  10. package/dist/src/cli/import-config.js +5 -5
  11. package/dist/src/cli/load-bakers-config.d.ts +2 -2
  12. package/dist/src/cli/load-bakers-config.js +20 -49
  13. package/dist/src/cli/machine-context.d.ts +8 -12
  14. package/dist/src/cli/machine-context.js +12 -18
  15. package/dist/src/cli/version-check.d.ts +1 -1
  16. package/dist/src/cli/version-check.js +1 -1
  17. package/dist/src/config-types.generated.d.ts +173 -0
  18. package/dist/src/config-types.generated.js +3 -0
  19. package/dist/src/core/logger.d.ts +3 -3
  20. package/dist/src/core/logger.js +5 -5
  21. package/dist/src/core/proc.d.ts +1 -1
  22. package/dist/src/core/proc.js +8 -5
  23. package/dist/src/index.d.ts +3 -1
  24. package/dist/src/index.js +2 -3
  25. package/dist/src/plugins/discover-addons.d.ts +2 -2
  26. package/dist/src/plugins/discover-addons.js +9 -9
  27. package/dist/src/plugins/preset.d.ts +9 -20
  28. package/dist/src/plugins/preset.js +6 -6
  29. package/dist/src/plugins/scoped-addons.d.ts +5 -14
  30. package/dist/src/plugins/scoped-addons.js +11 -36
  31. package/package.json +6 -4
  32. package/schema/connection.schema.json +57 -0
  33. package/schema/harness-options.schema.json +46 -0
  34. package/schema/machine.schema.json +77 -0
  35. package/schema/project.schema.json +262 -0
@@ -2,15 +2,8 @@ import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
3
  import { pathToFileURL } from 'node:url';
4
4
  import { homeBbDir } from './bakers-dir.js';
5
- /**
6
- * Warn once that a leftover `max_parallel` in a config file is ignored: the
7
- * run budget is set on the machine in the backend.
8
- */
9
- export function warnIgnoredMaxParallel(path, raw) {
10
- if ('max_parallel' in raw)
11
- console.warn(`warning: max_parallel in ${path} is ignored; the run budget is set on the machine in the backend.`);
12
- }
13
- /** Canonical machine-context path: `<BB_HOME or ~/.bakers>/machine.config.js`. */
5
+ import { assertValidConfig } from './config-validate.js';
6
+ /** Canonical machine-context path: `<BAKERS_HOME or ~/.bakers>/machine.config.js`. */
14
7
  export function machineContextPath() {
15
8
  return join(homeBbDir(), 'machine.config.js');
16
9
  }
@@ -25,12 +18,14 @@ const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
25
18
  function isUuid(value) {
26
19
  return typeof value === 'string' && UUID.test(value);
27
20
  }
21
+ /** The configuration schema version every file kind is at. */
22
+ export const CONFIG_SCHEMA_VERSION = 1;
28
23
  /**
29
24
  * Every config file (machine, connection, project) is at schema version 1.
30
25
  * Any other version, in the `schema_version` field or the
31
- * `@bakers-schema-version` header, predates the fresh start and is refused.
26
+ * `@bakers-schema-version` header, is refused.
32
27
  */
33
- export function assertSchemaVersion1(path, raw, remedy = 'remove the file and run bakers init') {
28
+ export function assertSchemaVersion(path, raw) {
34
29
  let text = '';
35
30
  try {
36
31
  text = readFileSync(path, 'utf8');
@@ -40,14 +35,14 @@ export function assertSchemaVersion1(path, raw, remedy = 'remove the file and ru
40
35
  ...(raw.schema_version !== undefined ? [raw.schema_version] : []),
41
36
  ...[...text.matchAll(/@bakers-schema-version\s+(\d+)/g)].map((m) => Number(m[1])),
42
37
  ];
43
- const other = versions.find((version) => version !== 1);
38
+ const other = versions.find((version) => version !== CONFIG_SCHEMA_VERSION);
44
39
  if (other !== undefined)
45
- throw new Error(`${path}: schema version ${String(other)} is not supported; ${remedy}`);
40
+ throw new Error(`${path}: schema version ${String(other)} is not supported; remove the file and run bakers init`);
46
41
  }
47
42
  /**
48
43
  * Import an existing context module's default export, or `{}` if absent/broken.
49
- * An old file (`user_id`, a schema version other than 1) throws, naming
50
- * `bakers init`, which rewrites it in place. An existing machine keeps its
44
+ * A file at another schema version, or one the machine schema rejects,
45
+ * throws naming the file and every problem. An existing machine keeps its
51
46
  * `machine_id` as it is; only a UUID is normalised to lowercase.
52
47
  */
53
48
  export async function readMachineContext(path) {
@@ -66,9 +61,8 @@ export async function readMachineContext(path) {
66
61
  if (!raw || typeof raw !== 'object')
67
62
  return {};
68
63
  const ctx = raw;
69
- assertSchemaVersion1(resolved, ctx, 'run bakers init to rewrite it');
70
- if ('user_id' in ctx)
71
- throw new Error(`${resolved}: user_id is retired (the server takes the owner from sign-in); run bakers init to rewrite the file`);
64
+ assertSchemaVersion(resolved, ctx);
65
+ assertValidConfig('machine', ctx, resolved);
72
66
  return {
73
67
  ...ctx,
74
68
  ...(isUuid(ctx.machine_id)
@@ -5,7 +5,7 @@ export declare const UNKNOWN_VERSION = "0.0.0";
5
5
  export declare const UPDATE_CHECK_TTL_MS: number;
6
6
  /**
7
7
  * A module-level const would freeze the answer at import time, before a test
8
- * (or a container) sets BB_HOME — so this is a function, resolved through
8
+ * (or a container) sets BAKERS_HOME — so this is a function, resolved through
9
9
  * the one place that decides where `.bakers` lives.
10
10
  */
11
11
  export declare function defaultUpdateCachePath(): string;
@@ -10,7 +10,7 @@ export const UNKNOWN_VERSION = '0.0.0';
10
10
  export const UPDATE_CHECK_TTL_MS = 24 * 60 * 60 * 1000;
11
11
  /**
12
12
  * A module-level const would freeze the answer at import time, before a test
13
- * (or a container) sets BB_HOME — so this is a function, resolved through
13
+ * (or a container) sets BAKERS_HOME — so this is a function, resolved through
14
14
  * the one place that decides where `.bakers` lives.
15
15
  */
16
16
  export function defaultUpdateCachePath() {
@@ -0,0 +1,173 @@
1
+ /** A project's committed conductor configuration: .bakers/project.config.js and its variants .bakers/project.<name>.config.js. */
2
+ export interface ProjectConfig {
3
+ /** Configuration schema version. */
4
+ schema_version?: 1;
5
+ /** The bakers.build project this repository belongs to. */
6
+ project: {
7
+ /** Project name on the server; BAKERS_PROJECT overrides it. */
8
+ name: string;
9
+ /** Team workspace the project belongs to. */
10
+ workspace?: string;
11
+ };
12
+ permissions?: {
13
+ mode?: "sandbox" | "system" | "yolo";
14
+ sandbox?: {
15
+ deny_read?: Array<string>;
16
+ allow_write?: Array<string>;
17
+ trusted_commands?: Array<string>;
18
+ };
19
+ };
20
+ /** Addons this project uses. */
21
+ addons?: Array<string | {
22
+ use: string;
23
+ alias?: string;
24
+ /** The addon's options. */
25
+ with?: unknown;
26
+ priority?: (...args: never[]) => unknown;
27
+ }>;
28
+ /** Explicit server slot; wins over an addon's. */
29
+ server?: {
30
+ kind: string;
31
+ [key: string]: unknown;
32
+ } | {
33
+ use: string;
34
+ export?: string;
35
+ /** Options passed to the factory. */
36
+ with?: unknown;
37
+ };
38
+ /** Explicit executor slot; the machine's wins over it. */
39
+ executor?: {
40
+ kind: string;
41
+ [key: string]: unknown;
42
+ } | {
43
+ use: string;
44
+ export?: string;
45
+ /** Options passed to the factory. */
46
+ with?: unknown;
47
+ };
48
+ /** Explicit worktree slot; wins over an addon's. */
49
+ worktree?: {
50
+ kind: string;
51
+ [key: string]: unknown;
52
+ } | {
53
+ use: string;
54
+ export?: string;
55
+ /** Options passed to the factory. */
56
+ with?: unknown;
57
+ };
58
+ /** States this conductor serves; empty or absent serves all. */
59
+ states?: Array<string>;
60
+ /** Agent prompt; placeholders {identifier}, {state}, {run_uuid}, {ticket_uuid}. */
61
+ prompt?: string;
62
+ /** Poll interval in milliseconds. Default 5000. */
63
+ poll_interval_ms?: number;
64
+ /** Run lease in seconds. Default 300. */
65
+ lease_seconds?: number;
66
+ /** Restart the foreground conductor when a config file changes. Default true. */
67
+ restart_on_change?: boolean;
68
+ /** Upload transcripts where the server allows it. Default true. */
69
+ capture_logs?: boolean;
70
+ /** Shell commands the conductor runs in a ticket's worktree. */
71
+ hooks?: {
72
+ after_create?: string;
73
+ before_run?: string;
74
+ after_run?: string;
75
+ after_done?: string;
76
+ on_freeze?: string;
77
+ on_resume?: string;
78
+ /** Command, or commands by profile, offered to runs as provision_up(profile?). */
79
+ provision_up?: string | {
80
+ [key: string]: string;
81
+ };
82
+ };
83
+ /** Agent plugin marketplaces every run of this project installs. */
84
+ marketplaces?: Array<{
85
+ /** a remote Git URL (https, ssh or git@) */
86
+ url: string;
87
+ /** Branch or tag. */
88
+ ref: string;
89
+ plugins: Array<string>;
90
+ }>;
91
+ /** Function choosing the agent for a ticket; replaces the shipped selection. */
92
+ select_agent?: (...args: never[]) => unknown;
93
+ }
94
+ /** This machine's private configuration: ~/.bakers/machine.config.js. */
95
+ export interface MachineConfig {
96
+ /** Configuration schema version. */
97
+ schema_version?: 1;
98
+ /** Host key; bakers init writes a UUID. */
99
+ machine_id: string;
100
+ /** Display name for people. */
101
+ label: string;
102
+ /** Selection policy for the agents the addons contribute. */
103
+ agents?: {
104
+ /** Extra agent variants built from installed harnesses. */
105
+ catalog?: Array<{
106
+ harness: string;
107
+ alias?: string;
108
+ /** The harness options. */
109
+ with?: unknown;
110
+ }>;
111
+ enabled?: Array<string>;
112
+ disabled?: Array<string>;
113
+ /** Named routes from states (or *) to aliases; routes.default is the automatic one. */
114
+ routes?: {
115
+ [key: string]: {
116
+ [key: string]: string;
117
+ };
118
+ };
119
+ };
120
+ /** Addons this machine uses. */
121
+ addons?: Array<string | {
122
+ use: string;
123
+ alias?: string;
124
+ /** The addon's options. */
125
+ with?: unknown;
126
+ priority?: (...args: never[]) => unknown;
127
+ }>;
128
+ /** Share local preview links through bakers ports. Default false. */
129
+ tunnel?: boolean;
130
+ permissions?: {
131
+ mode?: "sandbox" | "system" | "yolo";
132
+ sandbox?: {
133
+ deny_read?: Array<string>;
134
+ allow_write?: Array<string>;
135
+ trusted_commands?: Array<string>;
136
+ };
137
+ };
138
+ /** This machine's executor; overrides every project's. */
139
+ executor?: {
140
+ kind: string;
141
+ [key: string]: unknown;
142
+ } | {
143
+ use: string;
144
+ export?: string;
145
+ /** Options passed to the factory. */
146
+ with?: unknown;
147
+ };
148
+ }
149
+ /** A connection to a bakers.build server: ~/.bakers/connections/<id>.js, or a project's .bakers/connection.config.js. dropsh reads the same file. */
150
+ export interface ConnectionConfig {
151
+ /** Configuration schema version. */
152
+ schema_version?: 1;
153
+ site: {
154
+ /** The server's absolute HTTP(S) URL. */
155
+ base_url: string;
156
+ /** JSON:API path prefix. Default /jsonapi. */
157
+ jsonapi_prefix?: string;
158
+ };
159
+ /** Workspace bakers ui starts focused on. */
160
+ workspace_id?: string;
161
+ /** dropsh plugins: { plugin, export?, with?, options? }, or constructed plugins. */
162
+ plugins?: Array<unknown | {
163
+ [key: string]: unknown;
164
+ }>;
165
+ /** Connection addons, such as auth providers. */
166
+ addons?: Array<string | {
167
+ use: string;
168
+ alias?: string;
169
+ /** The addon's options. */
170
+ with?: unknown;
171
+ priority?: (...args: never[]) => unknown;
172
+ }>;
173
+ }
@@ -0,0 +1,3 @@
1
+ // Generated from core/schema/*.schema.json by core/scripts/schema-types.mjs.
2
+ // Do not edit: change the schema and run `node core/scripts/schema-types.mjs`.
3
+ export {};
@@ -20,7 +20,7 @@ export interface ConductorLogger {
20
20
  }
21
21
  /**
22
22
  * Pick the log sink. Precedence: explicit CLI override (`sink`) > the
23
- * BB_CONDUCTOR_LOG env var > default (`both` on a TTY, `file` otherwise).
23
+ * BAKERS_CONDUCTOR_LOG env var > default (`both` on a TTY, `file` otherwise).
24
24
  *
25
25
  * BB-237: the TTY default used to be stdout-ONLY, which made the conductor's
26
26
  * own diagnostics non-durable exactly where it normally runs — inside a herdr
@@ -28,7 +28,7 @@ export interface ConductorLogger {
28
28
  * worktree + ticket + err) was therefore written nowhere and died with the pane,
29
29
  * so an aborting worktree bootstrap left no trace to find. The default now tees:
30
30
  * the operator keeps pretty stdout AND the record lands in `log.txt`. An
31
- * EXPLICIT `stdout` / `file` (CLI flag or BB_CONDUCTOR_LOG) keeps its exact
31
+ * EXPLICIT `stdout` / `file` (CLI flag or BAKERS_CONDUCTOR_LOG) keeps its exact
32
32
  * previous meaning — one stream, chosen deliberately.
33
33
  *
34
34
  * BB-450 D4: `checkoutRoot` is now genuinely the checkout root (its `.bakers`
@@ -40,7 +40,7 @@ export interface ConductorLogger {
40
40
  export declare function resolveSink(env: NodeJS.ProcessEnv, isTTY: boolean, checkoutRoot: string, override?: string): LogSink;
41
41
  /**
42
42
  * Pick the log level. Precedence: explicit CLI override (`level`) >
43
- * the BB_LOG_LEVEL env var > info.
43
+ * the BAKERS_LOG_LEVEL env var > info.
44
44
  */
45
45
  export declare function resolveLevel(env: NodeJS.ProcessEnv, override?: string): string;
46
46
  export declare function createLogger(opts: {
@@ -5,7 +5,7 @@ import { resolveCliVersion } from '../cli/version-check.js';
5
5
  import { configHomeOf } from './checkout-root.js';
6
6
  /**
7
7
  * Pick the log sink. Precedence: explicit CLI override (`sink`) > the
8
- * BB_CONDUCTOR_LOG env var > default (`both` on a TTY, `file` otherwise).
8
+ * BAKERS_CONDUCTOR_LOG env var > default (`both` on a TTY, `file` otherwise).
9
9
  *
10
10
  * BB-237: the TTY default used to be stdout-ONLY, which made the conductor's
11
11
  * own diagnostics non-durable exactly where it normally runs — inside a herdr
@@ -13,7 +13,7 @@ import { configHomeOf } from './checkout-root.js';
13
13
  * worktree + ticket + err) was therefore written nowhere and died with the pane,
14
14
  * so an aborting worktree bootstrap left no trace to find. The default now tees:
15
15
  * the operator keeps pretty stdout AND the record lands in `log.txt`. An
16
- * EXPLICIT `stdout` / `file` (CLI flag or BB_CONDUCTOR_LOG) keeps its exact
16
+ * EXPLICIT `stdout` / `file` (CLI flag or BAKERS_CONDUCTOR_LOG) keeps its exact
17
17
  * previous meaning — one stream, chosen deliberately.
18
18
  *
19
19
  * BB-450 D4: `checkoutRoot` is now genuinely the checkout root (its `.bakers`
@@ -24,7 +24,7 @@ import { configHomeOf } from './checkout-root.js';
24
24
  */
25
25
  export function resolveSink(env, isTTY, checkoutRoot, override) {
26
26
  const path = join(configHomeOf(checkoutRoot), 'log.txt');
27
- const choice = override ?? env.BB_CONDUCTOR_LOG;
27
+ const choice = override ?? env.BAKERS_CONDUCTOR_LOG;
28
28
  if (choice === 'stdout')
29
29
  return { kind: 'stdout' };
30
30
  if (choice === 'file')
@@ -35,10 +35,10 @@ export function resolveSink(env, isTTY, checkoutRoot, override) {
35
35
  }
36
36
  /**
37
37
  * Pick the log level. Precedence: explicit CLI override (`level`) >
38
- * the BB_LOG_LEVEL env var > info.
38
+ * the BAKERS_LOG_LEVEL env var > info.
39
39
  */
40
40
  export function resolveLevel(env, override) {
41
- return override ?? env.BB_LOG_LEVEL ?? 'info';
41
+ return override ?? env.BAKERS_LOG_LEVEL ?? 'info';
42
42
  }
43
43
  export function createLogger(opts) {
44
44
  const env = opts.env ?? process.env;
@@ -87,7 +87,7 @@ export interface RunProcessProbe {
87
87
  }
88
88
  export declare function defaultRunProcessProbe(): RunProcessProbe;
89
89
  /**
90
- * Ends every process of this OS user that carries `BB_RUN_UUID=<runUuid>`:
90
+ * Ends every process of this OS user that carries `BAKERS_RUN_UUID=<runUuid>`:
91
91
  * the run's agent, its sandbox and background commands that outlive the
92
92
  * PTY. SIGTERM first, SIGKILL for survivors after `graceMs`. Best-effort.
93
93
  * shortcut: a process that clears its environment is not found; track
@@ -1,13 +1,16 @@
1
1
  import { readdirSync, readFileSync, statSync } from 'node:fs';
2
2
  /**
3
3
  * Substrings a live bakers-conductor foreground process's command line must all
4
- * contain (see `cmdStartBody`'s `fgCmd`: `bakers oven … start --foreground
4
+ * contain (see `cmdStartBody`'s `fgCmd`: `bakers conductor … start --foreground
5
5
  * --no-update-check`). Deliberately loose — the proof this function performs
6
6
  * is "is a bakers conductor foreground loop", not an exact argv match.
7
7
  */
8
- const CONDUCTOR_CMDLINE_MARKERS = ['oven', 'start', '--foreground'];
8
+ const CONDUCTOR_CMDLINE_MARKERS = ['start', '--foreground'];
9
+ /** `conductor`, or `oven` for a conductor an older CLI started. */
10
+ const CONDUCTOR_COMMAND = /(^|[\s\0])(conductor|oven)([\s\0]|$)/;
9
11
  function looksLikeBbConductor(cmdline) {
10
- return CONDUCTOR_CMDLINE_MARKERS.every((marker) => cmdline.includes(marker));
12
+ return (CONDUCTOR_COMMAND.test(cmdline) &&
13
+ CONDUCTOR_CMDLINE_MARKERS.every((marker) => cmdline.includes(marker)));
11
14
  }
12
15
  /**
13
16
  * Signals a process only after proving it is a bakers conductor owned by the
@@ -178,7 +181,7 @@ export function defaultRunProcessProbe() {
178
181
  };
179
182
  }
180
183
  /**
181
- * Ends every process of this OS user that carries `BB_RUN_UUID=<runUuid>`:
184
+ * Ends every process of this OS user that carries `BAKERS_RUN_UUID=<runUuid>`:
182
185
  * the run's agent, its sandbox and background commands that outlive the
183
186
  * PTY. SIGTERM first, SIGKILL for survivors after `graceMs`. Best-effort.
184
187
  * shortcut: a process that clears its environment is not found; track
@@ -188,7 +191,7 @@ export async function killRunProcesses(runUuid, probe = defaultRunProcessProbe()
188
191
  if (!probe.supported || runUuid === '') {
189
192
  return { supported: probe.supported, pids: [] };
190
193
  }
191
- const marker = `BB_RUN_UUID=${runUuid}`;
194
+ const marker = `BAKERS_RUN_UUID=${runUuid}`;
192
195
  const uid = process.getuid?.();
193
196
  const ofRun = (pid) => probe.environOf(pid)?.includes(marker) === true;
194
197
  const pids = probe
@@ -6,14 +6,16 @@ export { type ConfigOnlineOptions, createBbConnectionClient, createBbConnectionC
6
6
  export type { ConfigChange, ConfigFileKind, ConfigFileReport, ConfigFinding, ConfigFindingCode, ConfigLayer, ConfigLocation, ConfigOperation, ConfigReport, ConfigScope, } from './cli/config-report.js';
7
7
  export { configRecheckCommand, finalizeConfigReport, } from './cli/config-report.js';
8
8
  export { type ConfigSourceInspection, type ConfigSourceProperty, declaresTopLevelKey, findDefaultExportObject, inspectConfigSource, matchDelimiter, type PropEntry, readKey, scanTopLevelProperties, scanToTopLevelComma, skipBlockComment, skipLineComment, skipString, skipTrivia, } from './cli/config-source.js';
9
+ export { addonOptionProblems, assertValidConfig, type ConfigKind, checkConfigText, configAjv, coreSchemaPath, type SchemaProblem, type StaticConfig, staticConfig, validateConfig, } from './cli/config-validate.js';
9
10
  export { HOME_IMPORT_EXPRESSION_PATTERN, importConfig, } from './cli/import-config.js';
10
11
  export { type LayeredUiEntryLayer, machineUiConfigPath, projectConductorConfigPath, readUiEntryLayers, } from './cli/layered-ui-entries.js';
11
12
  export { type BbConnectionConfig, BbConnectionConfigError, type BbConnectionGlobals, type BbConnectionLoadOptions, type BbConnectionSelection, type EffectiveConnectionField, loadBbConfig, loadBbConnectionBootstrap, reportLoadedBbConfigFields, resolveBbConnectionSelection, } from './cli/load-bakers-config.js';
12
- export { type AgentRoutes, assertSchemaVersion1, type MachineContext, machineContextPath, readMachineContext, resolveMachineContextPath, warnIgnoredMaxParallel, } from './cli/machine-context.js';
13
+ export { type AgentRoutes, assertSchemaVersion, CONFIG_SCHEMA_VERSION, type MachineContext, machineContextPath, readMachineContext, resolveMachineContextPath, } from './cli/machine-context.js';
13
14
  export { corePackageRoot } from './cli/paths.js';
14
15
  export { resolveModuleEslintStyle } from './cli/resolve-module.js';
15
16
  export { BB_PACKAGE, checkForUpdate, declineUpdate, defaultUpdateCachePath, fetchLatestVersion, fetchUpdateNotice, printVersionLine, REGISTRY_LATEST_URL, resolveCliVersion, UNKNOWN_VERSION, UPDATE_CHECK_TTL_MS, type UpdateCheckOptions, type UpdateCheckResult, updateNotice, } from './cli/version-check.js';
16
17
  export { discoverBbWorkspaces, loadReadyBbConnection, resolveWorkspaceSelector, type WorkspaceChoice, type WorkspaceRecoveryOptions, workspaceSearchCommand, } from './cli/workspace-recovery.js';
18
+ export type { ConnectionConfig, MachineConfig, ProjectConfig, } from './config-types.generated.js';
17
19
  export { configHomeOf, defaultRootGitExec, deriveCheckoutRoot, type RootGitExec, } from './core/checkout-root.js';
18
20
  export { CommandRunner, ExecError, exec, setDefaultCommandRunner, } from './core/exec.js';
19
21
  export { type GitSandboxPaths, gitSandboxPaths, withoutGitDirs, } from './core/git-sandbox.js';
package/dist/src/index.js CHANGED
@@ -8,10 +8,11 @@ export { configRecheckCommand, finalizeConfigReport, } from './cli/config-report
8
8
  // BB-218 strip pass share one answer to "which top-level properties does this
9
9
  // config source declare?" — core is layer 0 and cannot import the conductor's copy.
10
10
  export { declaresTopLevelKey, findDefaultExportObject, inspectConfigSource, matchDelimiter, readKey, scanTopLevelProperties, scanToTopLevelComma, skipBlockComment, skipLineComment, skipString, skipTrivia, } from './cli/config-source.js';
11
+ export { addonOptionProblems, assertValidConfig, checkConfigText, configAjv, coreSchemaPath, staticConfig, validateConfig, } from './cli/config-validate.js';
11
12
  export { HOME_IMPORT_EXPRESSION_PATTERN, importConfig, } from './cli/import-config.js';
12
13
  export { machineUiConfigPath, projectConductorConfigPath, readUiEntryLayers, } from './cli/layered-ui-entries.js';
13
14
  export { BbConnectionConfigError, loadBbConfig, loadBbConnectionBootstrap, reportLoadedBbConfigFields, resolveBbConnectionSelection, } from './cli/load-bakers-config.js';
14
- export { assertSchemaVersion1, machineContextPath, readMachineContext, resolveMachineContextPath, warnIgnoredMaxParallel, } from './cli/machine-context.js';
15
+ export { assertSchemaVersion, CONFIG_SCHEMA_VERSION, machineContextPath, readMachineContext, resolveMachineContextPath, } from './cli/machine-context.js';
15
16
  export { corePackageRoot } from './cli/paths.js';
16
17
  export { resolveModuleEslintStyle } from './cli/resolve-module.js';
17
18
  export { BB_PACKAGE, checkForUpdate, declineUpdate, defaultUpdateCachePath, fetchLatestVersion, fetchUpdateNotice, printVersionLine, REGISTRY_LATEST_URL, resolveCliVersion, UNKNOWN_VERSION, UPDATE_CHECK_TTL_MS, updateNotice, } from './cli/version-check.js';
@@ -40,5 +41,3 @@ export { bumpUiRefresh, UI_REFRESH_FILE } from './core/ui-refresh.js';
40
41
  export { AddonUnresolvedError, discoverAddons, loadAddonPreset, resolveConductorSlots, } from './plugins/discover-addons.js';
41
42
  export { emptyContributions, PRESET_FUNCTION_KEYS, SURFACE_KEYS, } from './plugins/preset.js';
42
43
  export { discoverScoped, readConfigAddons, readEffectiveAddon, scopeAddons, } from './plugins/scoped-addons.js';
43
- // BB-194 AC-2: there is no agent-host contract here; `bakers ui` no longer
44
- // hosts agents.
@@ -64,9 +64,9 @@ export interface ResolvedConductorSlots<R = unknown, E = unknown, W = unknown, A
64
64
  }
65
65
  /** Resolve discovered conductor contributions into the four engine slots. */
66
66
  export declare function resolveConductorSlots<R, E, W, A>(contributions: {
67
- remotes: R[];
67
+ servers: R[];
68
68
  executors: E[];
69
- workspaces: W[];
69
+ worktrees: W[];
70
70
  agents: A[];
71
71
  }, logger?: ConductorLogger): ResolvedConductorSlots<R, E, W, A>;
72
72
  export {};
@@ -42,13 +42,13 @@ function warnFrom(logger) {
42
42
  export function normalizeEntry(entry) {
43
43
  if (typeof entry === 'string')
44
44
  return { spec: entry, opts: undefined };
45
- const spec = entry.use ?? entry.name;
45
+ const spec = entry.use;
46
46
  if (typeof spec !== 'string' || spec.trim() === '') {
47
- throw new Error(`addons[] entry must name a package via a string or { use } / { name }; got ${JSON.stringify(entry)}`);
47
+ throw new Error(`addons[] entry must name a package via a string or { use }; got ${JSON.stringify(entry)}`);
48
48
  }
49
49
  return {
50
50
  spec,
51
- opts: entry.with ?? entry.options,
51
+ opts: entry.with,
52
52
  ...(entry.alias !== undefined ? { alias: entry.alias } : {}),
53
53
  ...(entry.priority ? { priority: entry.priority } : {}),
54
54
  };
@@ -99,9 +99,9 @@ function adaptDefaultExport(mod, spec, warn) {
99
99
  ...conn,
100
100
  ];
101
101
  },
102
- remotes: (acc, opts) => routeByKind(factory, opts, 'remote', acc),
102
+ servers: (acc, opts) => routeByKind(factory, opts, 'server', acc),
103
103
  executors: (acc, opts) => routeByKind(factory, opts, 'executor', acc),
104
- workspaces: (acc, opts) => routeByKind(factory, opts, 'workspace', acc),
104
+ worktrees: (acc, opts) => routeByKind(factory, opts, 'worktree', acc),
105
105
  agents: (acc, opts) => {
106
106
  const built = factory(opts);
107
107
  const list = Array.isArray(built) ? built : [built];
@@ -111,9 +111,9 @@ function adaptDefaultExport(mod, spec, warn) {
111
111
  };
112
112
  }
113
113
  function isEngineKind(kind) {
114
- return (kind === 'remote' ||
114
+ return (kind === 'server' ||
115
115
  kind === 'executor' ||
116
- kind === 'workspace' ||
116
+ kind === 'worktree' ||
117
117
  kind === 'agent');
118
118
  }
119
119
  function routeByKind(factory, opts, kind, acc) {
@@ -359,9 +359,9 @@ function resolveSingleton(list, kind, logger) {
359
359
  }
360
360
  /** Resolve discovered conductor contributions into the four engine slots. */
361
361
  export function resolveConductorSlots(contributions, logger) {
362
- const remote = resolveSingleton(contributions.remotes, 'remote', logger);
362
+ const remote = resolveSingleton(contributions.servers, 'server', logger);
363
363
  const executor = resolveSingleton(contributions.executors, 'executor', logger);
364
- const workspace = resolveSingleton(contributions.workspaces, 'workspace', logger);
364
+ const workspace = resolveSingleton(contributions.worktrees, 'worktree', logger);
365
365
  return {
366
366
  ...(remote ? { remote } : {}),
367
367
  ...(executor ? { executor } : {}),
@@ -1,7 +1,7 @@
1
1
  import type { DropSHPlugin } from 'dropsh/plugin';
2
2
  import type { ConfigScope } from '../cli/config-report.js';
3
3
  /** The config files an addon may be listed in: `~/.bakers/machine.config.js`
4
- * (`machine`) and the project's `.bakers/conductor.config.js` (`project`). */
4
+ * (`machine`) and the project's `.bakers/project.config.js` (`project`). */
5
5
  export type AddonScope = Extract<ConfigScope, 'machine' | 'project'>;
6
6
  /**
7
7
  * A lazy command pointer (moved here from the host, BB-201, + `describe`). The
@@ -20,6 +20,8 @@ export interface CommandDescriptor {
20
20
  export?: string;
21
21
  /** Keep dispatch available while omitting the command from help. */
22
22
  hidden?: boolean;
23
+ /** Hidden alternative names that run this command (`oven` → `conductor`). */
24
+ aliases?: string[];
23
25
  /** `bakers help <name>` runs `bakers <name> --help`, for plugins that render their own help. */
24
26
  forwardHelp?: boolean;
25
27
  }
@@ -33,16 +35,12 @@ export type BbSurface = 'command' | 'conductor' | 'connection';
33
35
  * contribution's own `.kind`.
34
36
  */
35
37
  export type AddonEntry = string | {
36
- /** The addon package (bakers.build term). */
37
- use?: string;
38
- /** Storybook's term for the same field; accepted as an alias. */
39
- name?: string;
38
+ /** The addon package. */
39
+ use: string;
40
40
  /** Options handed to the addon's accumulators as `opts`. */
41
41
  with?: unknown;
42
42
  /** Select a named agent variant, or name a single custom contribution. */
43
43
  alias?: string;
44
- /** Alias for `with`. */
45
- options?: unknown;
46
44
  /**
47
45
  * Agent-surface only: the static per-ticket priority (see the conductor
48
46
  * surface's `selectAgent`). The ticket type belongs to the conductor
@@ -62,11 +60,11 @@ export type AddonEntry = string | {
62
60
  export interface DiscoveredContributions {
63
61
  commands: CommandDescriptor[];
64
62
  /** Opaque: `RemotePlugin[]` on the conductor surface. */
65
- remotes: unknown[];
63
+ servers: unknown[];
66
64
  /** Opaque: `ExecutorPlugin[]` on the conductor surface. */
67
65
  executors: unknown[];
68
66
  /** Opaque: `WorkspacePlugin[]` on the conductor surface. */
69
- workspaces: unknown[];
67
+ worktrees: unknown[];
70
68
  /** Opaque: `AgentCandidate[]` on the conductor surface. */
71
69
  agents: unknown[];
72
70
  /** Opaque: `HookListener[]` on the conductor surface (BB-599). */
@@ -136,19 +134,10 @@ export interface BbPreset<O = unknown> {
136
134
  * `with`, when given, replaces the project `with` whole.
137
135
  */
138
136
  mergeWith?: (project: unknown, machine: unknown) => unknown;
139
- /**
140
- * Check one entry's own `with` (`undefined` when it has none); each problem
141
- * names its key relative to `with`. `bakers config check --online` reports
142
- * them as `addon_with_invalid`.
143
- */
144
- checkWith?: (value: unknown) => {
145
- key: string;
146
- message: string;
147
- }[];
148
137
  commands?: (acc: CommandDescriptor[], opts: O) => CommandDescriptor[] | Promise<CommandDescriptor[]>;
149
- remotes?: OpaqueAccumulator<O>;
138
+ servers?: OpaqueAccumulator<O>;
150
139
  executors?: OpaqueAccumulator<O>;
151
- workspaces?: OpaqueAccumulator<O>;
140
+ worktrees?: OpaqueAccumulator<O>;
152
141
  agents?: OpaqueAccumulator<O>;
153
142
  hooks?: OpaqueAccumulator<O>;
154
143
  connectionPlugins?: (acc: DropSHPlugin[], opts: O) => DropSHPlugin[] | Promise<DropSHPlugin[]>;
@@ -8,7 +8,7 @@
8
8
  //
9
9
  // The three bakers.build surfaces (each named for its config home):
10
10
  // - command → the `@bakers-build/bakers` host registry (CommandDescriptor[]).
11
- // - conductor → the run engine (remote / executor / workspace / agent /
11
+ // - conductor → the run engine (server / executor / worktree / agent /
12
12
  // lifecycle hook listeners).
13
13
  // - connection → dropsh (auth + renderer plugins).
14
14
  //
@@ -28,15 +28,15 @@
28
28
  /** The extension points each surface runs (the preset function names to call). */
29
29
  export const SURFACE_KEYS = {
30
30
  command: ['commands'],
31
- conductor: ['remotes', 'executors', 'workspaces', 'agents', 'hooks'],
31
+ conductor: ['servers', 'executors', 'worktrees', 'agents', 'hooks'],
32
32
  connection: ['connectionPlugins', 'uiEntries'],
33
33
  };
34
34
  /** The preset function keys, for shape-detection during discovery. */
35
35
  export const PRESET_FUNCTION_KEYS = [
36
36
  'commands',
37
- 'remotes',
37
+ 'servers',
38
38
  'executors',
39
- 'workspaces',
39
+ 'worktrees',
40
40
  'agents',
41
41
  'hooks',
42
42
  'connectionPlugins',
@@ -46,9 +46,9 @@ export const PRESET_FUNCTION_KEYS = [
46
46
  export function emptyContributions() {
47
47
  return {
48
48
  commands: [],
49
- remotes: [],
49
+ servers: [],
50
50
  executors: [],
51
- workspaces: [],
51
+ worktrees: [],
52
52
  agents: [],
53
53
  hooks: [],
54
54
  connectionPlugins: [],
@@ -18,22 +18,13 @@ export interface EffectiveAddon {
18
18
  /** The resolved preset module path. */
19
19
  key: string;
20
20
  }
21
- /** An entry listed in a scope its addon does not declare, or whose own
22
- * `with` its addon's `checkWith` rejects (`index` into that scope's list). */
21
+ /** An entry listed in a scope its addon does not declare. */
23
22
  export type AddonScopeFinding = {
24
23
  code: 'addon_scope_not_allowed';
25
24
  spec: string;
26
25
  path: string;
27
26
  scope: AddonScope;
28
27
  allowed: AddonScope[];
29
- } | {
30
- code: 'addon_with_invalid';
31
- spec: string;
32
- path: string;
33
- scope: AddonScope;
34
- index: number;
35
- key: string;
36
- message: string;
37
28
  };
38
29
  /**
39
30
  * Build the effective addon list from the machine and project scopes. An
@@ -51,19 +42,19 @@ export declare function scopeAddons(inputs: AddonScopeInput[], opts?: {
51
42
  /** Run `surface` over the effective list, each entry against its own bases. */
52
43
  export declare function discoverScoped(addons: EffectiveAddon[], surface: BbSurface, opts?: Omit<NonNullable<Parameters<typeof discoverAddons>[3]>, 'entryBases'>): Promise<DiscoveredContributions>;
53
44
  /**
54
- * `<BB_HOME or ~/.bakers>/machine.config.js`. `home` stays optional and, when
45
+ * `<BAKERS_HOME or ~/.bakers>/machine.config.js`. `home` stays optional and, when
55
46
  * given, still wins (a fixture that pins an explicit home) — but an absent one
56
47
  * must reach `homeBbDir()`'s resolver rather than collapsing to the OS home
57
- * first, or `BB_HOME` never relocates this file.
48
+ * first, or `BAKERS_HOME` never relocates this file.
58
49
  */
59
50
  export declare function machineUiConfigPath(home?: string): string;
60
- /** The nearest project `.bakers/conductor.config.js` above `cwd`, or undefined. */
51
+ /** The nearest project `.bakers/project.config.js` above `cwd`, or undefined. */
61
52
  export declare function projectConductorConfigPath(cwd: string, home?: string): string | undefined;
62
53
  /** A config file's `addons[]`, or `[]` when the file is absent or broken. */
63
54
  export declare function readConfigAddons(path: string): Promise<AddonEntry[]>;
64
55
  /**
65
56
  * The effective entry for one addon package from `machine.config.js` and the
66
- * nearest project `.bakers/conductor.config.js` above `cwd` (or `projectPath`).
57
+ * nearest project `.bakers/project.config.js` above `cwd` (or `projectPath`).
67
58
  * `bases` are appended to each scope's own (e.g. the caller's install).
68
59
  */
69
60
  export declare function readEffectiveAddon(spec: string, opts: {