@bakers-build/conductor 0.5.1-next.849 → 0.5.1-next.851
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/dist/src/cli/config-plan.d.ts +2 -2
- package/dist/src/cli/config-plan.js +22 -503
- package/dist/src/cli/config-schema.d.ts +4 -78
- package/dist/src/cli/config-schema.js +5 -144
- package/dist/src/cli/config-templates.d.ts +1 -12
- package/dist/src/cli/config-templates.js +11 -52
- package/dist/src/cli/config-validation.js +22 -39
- package/dist/src/cli/project-context.js +1 -1
- package/dist/src/commands/conductor.d.ts +9 -1
- package/dist/src/commands/conductor.js +103 -21
- package/dist/src/config.d.ts +1 -1
- package/dist/src/config.js +31 -37
- package/dist/src/contract.d.ts +1 -0
- package/dist/src/contract.js +1 -0
- package/dist/src/core/conductor.d.ts +11 -18
- package/dist/src/core/conductor.js +33 -37
- package/dist/src/index.d.ts +0 -2
- package/dist/src/index.js +0 -7
- package/dist/src/plugins/remote.d.ts +19 -1
- package/dist/src/plugins/remote.js +13 -1
- package/dist/src/types.d.ts +9 -14
- package/package.json +4 -4
- package/dist/src/cli/migrate-addon-names.d.ts +0 -82
- package/dist/src/cli/migrate-addon-names.js +0 -334
- package/dist/src/core/host-key.d.ts +0 -19
- package/dist/src/core/host-key.js +0 -27
|
@@ -18,84 +18,10 @@ export interface ConnectionConfigMigration {
|
|
|
18
18
|
apply(currentText: string): string;
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* (config dir / host module / cwd), whereas `@bakers-build/addon-essentials` is a
|
|
26
|
-
* real dependency of both the host and the engine and therefore resolves in the
|
|
27
|
-
* monorepo AND from a global `@bakers-build/bakers` install. No `export:` is needed —
|
|
28
|
-
* the package default-exports its factory.
|
|
29
|
-
*/
|
|
30
|
-
export declare const RENDERER_PLUGIN_PACKAGE = "@bakers-build/addon-essentials";
|
|
31
|
-
/** The exact `plugins[]` element text the v1→v2 migration and the scaffold emit. */
|
|
32
|
-
export declare const RENDERER_PLUGIN_ENTRY = "{ plugin: '@bakers-build/addon-essentials' },";
|
|
33
|
-
/**
|
|
34
|
-
* BB-226 (v1 → v2): insert the renderer aggregator as the FIRST `plugins[]`
|
|
35
|
-
* element, so `bakers dropsh --format md` works instead of failing with
|
|
36
|
-
* `E_CONFIG: Unknown format 'md'. Available: json`.
|
|
37
|
-
*
|
|
38
|
-
* A pure TEXT transform — the upgrade runner must never execute a possibly
|
|
39
|
-
* side-effecting config module. Idempotent: text that already names the package
|
|
40
|
-
* in CODE is returned unchanged (whole-line `//` comments are stripped for that
|
|
41
|
-
* probe, so the template's own explanatory header does not read as a hit), and a
|
|
42
|
-
* config with no `plugins: [` array literal (an `addons: []`-shaped or
|
|
43
|
-
* hand-reshaped file) is left alone rather than guessed at.
|
|
44
|
-
*/
|
|
45
|
-
export declare function addRendererPluginEntry(text: string): string;
|
|
46
|
-
/** The dropsh plugin package whose entries carry a connection's OAuth identity. */
|
|
47
|
-
export declare const OAUTH2_PLUGIN_PACKAGE = "@dropsh/plugin-oauth2";
|
|
48
|
-
/**
|
|
49
|
-
* The id of the ONE oauth2 provider a bakers.build connection declares (BB-391 D1).
|
|
50
|
-
*
|
|
51
|
-
* `bakers`, not `session`: the entry names the CONNECTION, not a capability. Until
|
|
52
|
-
* v3 a config declared two providers that differed only by scope — `session`
|
|
53
|
-
* (`bb:session`) and `pm` (`bakers:project_manager`) — and every write had to
|
|
54
|
-
* pick one. What that choice cost is what BB-391 removes; the id therefore
|
|
55
|
-
* names the connection, and the surviving scope carries the capability.
|
|
56
|
-
*/
|
|
57
|
-
export declare const OAUTH2_PROVIDER_ID = "bakers";
|
|
58
|
-
/**
|
|
59
|
-
* The ONE OAuth2 scope a bakers.build connection requests (BB-391 D1, as revised).
|
|
60
|
-
*
|
|
61
|
-
* There is exactly one, and there is not zero. `bb:session`'s role carries
|
|
62
|
-
* the ceiling of what a machine identity may do.
|
|
63
|
-
*
|
|
64
|
-
* Zero was the original design, and a live control plane refuted it:
|
|
65
|
-
* `simple_oauth`'s Oauth2AccessPolicy rewrites a token account's permissions
|
|
66
|
-
* with `overwrite: TRUE`, and for a `client_credentials` token — every bakers.build
|
|
67
|
-
* machine identity — the set becomes EXACTLY the scope's permissions, with
|
|
68
|
-
* neither user_role nor OG-rank permissions surviving. A request naming no scope
|
|
69
|
-
* against a consumer holding no default scopes does not even mint a token.
|
|
70
|
-
*/
|
|
71
|
-
export declare const OAUTH2_SCOPE = "bb:session";
|
|
72
|
-
/**
|
|
73
|
-
* BB-391 (v2 → v3): collapse a connection's oauth2 entries into ONE `bakers`
|
|
74
|
-
* provider on ONE scope — the whole of the one-identity change, as a pure text
|
|
75
|
-
* transform.
|
|
76
|
-
*
|
|
77
|
-
* A MIGRATION rather than a cutover (spec D3): operators have hand-edited these
|
|
78
|
-
* files — a pinned literal `baseUrl`, a per-install `workspace_id`, an extra
|
|
79
|
-
* `addons[]` entry — so every value outside the two elements being merged is
|
|
80
|
-
* carried over verbatim, and the runner never EXECUTES a possibly
|
|
81
|
-
* side-effecting config module.
|
|
82
|
-
*
|
|
83
|
-
* The FIRST oauth2 element survives (it is the one v2 marked `default: true`);
|
|
84
|
-
* the rest are removed line-and-all. A config with no oauth2 element is left
|
|
85
|
-
* exactly as it is — that is the one silent no-op, and it is silent because
|
|
86
|
-
* there is nothing to collapse. An element that IS there but cannot be given the
|
|
87
|
-
* `bakers` identity throws (see {@link ensureProviderId}) rather than passing
|
|
88
|
-
* through unchanged.
|
|
89
|
-
*/
|
|
90
|
-
export declare function collapseOauth2Providers(text: string): string;
|
|
91
|
-
/**
|
|
92
|
-
* The ordered, contiguous migration chain. v1 was the pre-BB-226 shape (auth
|
|
93
|
-
* plugins only); v2 adds the markdown renderer entry; v3 collapses the two
|
|
94
|
-
* differently-scoped oauth2 providers into ONE identity on ONE scope (BB-391)
|
|
95
|
-
* — one, not zero: see {@link OAUTH2_SCOPE} for why the scope survives.
|
|
96
|
-
* Nothing below v1 is a versioned config (v0 = seed / hand-authored / untouched).
|
|
97
|
-
* `BB_CONFIG_SCHEMA_VERSION` derives from the chain's last `to` — never
|
|
98
|
-
* hardcode it.
|
|
21
|
+
* The ordered, contiguous migration chain. bakers restarted every config file
|
|
22
|
+
* at schema v1, so the chain is empty; a later shape change adds
|
|
23
|
+
* its `v1 → v2` step here. `BB_CONFIG_SCHEMA_VERSION` derives from the chain's
|
|
24
|
+
* last `to` — never hardcode it.
|
|
99
25
|
*/
|
|
100
26
|
export declare const CONNECTION_MIGRATIONS: ConnectionConfigMigration[];
|
|
101
27
|
/** The current connection-config schema version — single source of truth. */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { readFileSync } from 'node:fs';
|
|
2
|
-
import { ConfigSourceEditor } from './config-source-edit.js';
|
|
3
2
|
// BB-216: schema versioning for the generated CONNECTION config
|
|
4
3
|
// (`bakers.config.js`, project + home). Decoupled from the npm package semver —
|
|
5
4
|
// the schema version bumps only when the config SHAPE changes, not every
|
|
@@ -12,150 +11,12 @@ import { ConfigSourceEditor } from './config-source-edit.js';
|
|
|
12
11
|
const MARKER_RE = /@bakers-schema-version\s+(\d+)/;
|
|
13
12
|
const HEADER_LINE_RE = /^\/\/ @bakers-schema-version \d+\n/;
|
|
14
13
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* (config dir / host module / cwd), whereas `@bakers-build/addon-essentials` is a
|
|
20
|
-
* real dependency of both the host and the engine and therefore resolves in the
|
|
21
|
-
* monorepo AND from a global `@bakers-build/bakers` install. No `export:` is needed —
|
|
22
|
-
* the package default-exports its factory.
|
|
14
|
+
* The ordered, contiguous migration chain. bakers restarted every config file
|
|
15
|
+
* at schema v1, so the chain is empty; a later shape change adds
|
|
16
|
+
* its `v1 → v2` step here. `BB_CONFIG_SCHEMA_VERSION` derives from the chain's
|
|
17
|
+
* last `to` — never hardcode it.
|
|
23
18
|
*/
|
|
24
|
-
export const
|
|
25
|
-
/** The exact `plugins[]` element text the v1→v2 migration and the scaffold emit. */
|
|
26
|
-
export const RENDERER_PLUGIN_ENTRY = `{ plugin: '${RENDERER_PLUGIN_PACKAGE}' },`;
|
|
27
|
-
/**
|
|
28
|
-
* BB-226 (v1 → v2): insert the renderer aggregator as the FIRST `plugins[]`
|
|
29
|
-
* element, so `bakers dropsh --format md` works instead of failing with
|
|
30
|
-
* `E_CONFIG: Unknown format 'md'. Available: json`.
|
|
31
|
-
*
|
|
32
|
-
* A pure TEXT transform — the upgrade runner must never execute a possibly
|
|
33
|
-
* side-effecting config module. Idempotent: text that already names the package
|
|
34
|
-
* in CODE is returned unchanged (whole-line `//` comments are stripped for that
|
|
35
|
-
* probe, so the template's own explanatory header does not read as a hit), and a
|
|
36
|
-
* config with no `plugins: [` array literal (an `addons: []`-shaped or
|
|
37
|
-
* hand-reshaped file) is left alone rather than guessed at.
|
|
38
|
-
*/
|
|
39
|
-
export function addRendererPluginEntry(text) {
|
|
40
|
-
const e = new ConfigSourceEditor(text);
|
|
41
|
-
const array = e.property('plugins');
|
|
42
|
-
if (array?.nodeType !== 'ArrayExpression')
|
|
43
|
-
return text;
|
|
44
|
-
if ([...e.source.properties].some(([key, p]) => /^plugins\[\d+\]\.plugin$/.test(key) &&
|
|
45
|
-
p.value === RENDERER_PLUGIN_PACKAGE))
|
|
46
|
-
return text;
|
|
47
|
-
e.replace(array.valueStart + 1, array.valueStart + 1, `\n ${RENDERER_PLUGIN_ENTRY}`);
|
|
48
|
-
return e.text;
|
|
49
|
-
}
|
|
50
|
-
/** The dropsh plugin package whose entries carry a connection's OAuth identity. */
|
|
51
|
-
export const OAUTH2_PLUGIN_PACKAGE = '@dropsh/plugin-oauth2';
|
|
52
|
-
/**
|
|
53
|
-
* The id of the ONE oauth2 provider a bakers.build connection declares (BB-391 D1).
|
|
54
|
-
*
|
|
55
|
-
* `bakers`, not `session`: the entry names the CONNECTION, not a capability. Until
|
|
56
|
-
* v3 a config declared two providers that differed only by scope — `session`
|
|
57
|
-
* (`bb:session`) and `pm` (`bakers:project_manager`) — and every write had to
|
|
58
|
-
* pick one. What that choice cost is what BB-391 removes; the id therefore
|
|
59
|
-
* names the connection, and the surviving scope carries the capability.
|
|
60
|
-
*/
|
|
61
|
-
export const OAUTH2_PROVIDER_ID = 'bakers';
|
|
62
|
-
/**
|
|
63
|
-
* The ONE OAuth2 scope a bakers.build connection requests (BB-391 D1, as revised).
|
|
64
|
-
*
|
|
65
|
-
* There is exactly one, and there is not zero. `bb:session`'s role carries
|
|
66
|
-
* the ceiling of what a machine identity may do.
|
|
67
|
-
*
|
|
68
|
-
* Zero was the original design, and a live control plane refuted it:
|
|
69
|
-
* `simple_oauth`'s Oauth2AccessPolicy rewrites a token account's permissions
|
|
70
|
-
* with `overwrite: TRUE`, and for a `client_credentials` token — every bakers.build
|
|
71
|
-
* machine identity — the set becomes EXACTLY the scope's permissions, with
|
|
72
|
-
* neither user_role nor OG-rank permissions surviving. A request naming no scope
|
|
73
|
-
* against a consumer holding no default scopes does not even mint a token.
|
|
74
|
-
*/
|
|
75
|
-
export const OAUTH2_SCOPE = 'bb:session';
|
|
76
|
-
/**
|
|
77
|
-
* BB-391 (v2 → v3): collapse a connection's oauth2 entries into ONE `bakers`
|
|
78
|
-
* provider on ONE scope — the whole of the one-identity change, as a pure text
|
|
79
|
-
* transform.
|
|
80
|
-
*
|
|
81
|
-
* A MIGRATION rather than a cutover (spec D3): operators have hand-edited these
|
|
82
|
-
* files — a pinned literal `baseUrl`, a per-install `workspace_id`, an extra
|
|
83
|
-
* `addons[]` entry — so every value outside the two elements being merged is
|
|
84
|
-
* carried over verbatim, and the runner never EXECUTES a possibly
|
|
85
|
-
* side-effecting config module.
|
|
86
|
-
*
|
|
87
|
-
* The FIRST oauth2 element survives (it is the one v2 marked `default: true`);
|
|
88
|
-
* the rest are removed line-and-all. A config with no oauth2 element is left
|
|
89
|
-
* exactly as it is — that is the one silent no-op, and it is silent because
|
|
90
|
-
* there is nothing to collapse. An element that IS there but cannot be given the
|
|
91
|
-
* `bakers` identity throws (see {@link ensureProviderId}) rather than passing
|
|
92
|
-
* through unchanged.
|
|
93
|
-
*/
|
|
94
|
-
export function collapseOauth2Providers(text) {
|
|
95
|
-
const e = new ConfigSourceEditor(text);
|
|
96
|
-
const entries = [...e.source.properties]
|
|
97
|
-
.filter(([key, p]) => /^plugins\[\d+\]\.plugin$/.test(key) &&
|
|
98
|
-
p.value === OAUTH2_PLUGIN_PACKAGE)
|
|
99
|
-
.map(([key]) => key.replace(/\.plugin$/, ''));
|
|
100
|
-
const first = entries[0];
|
|
101
|
-
if (!first)
|
|
102
|
-
return text;
|
|
103
|
-
if (e.property(`${first}.with`)?.nodeType !== 'ObjectExpression')
|
|
104
|
-
throw new Error('Cannot migrate oauth2 without a with object.');
|
|
105
|
-
for (const duplicate of entries.slice(1).reverse()) {
|
|
106
|
-
for (const key of ['client_id', 'client_secret', 'token_url', 'type']) {
|
|
107
|
-
if (e.expression(`${first}.with.${key}`) !==
|
|
108
|
-
e.expression(`${duplicate}.with.${key}`))
|
|
109
|
-
throw new Error('OAuth providers have conflicting connection inputs.');
|
|
110
|
-
}
|
|
111
|
-
e.remove(duplicate);
|
|
112
|
-
}
|
|
113
|
-
for (const [key, value] of [
|
|
114
|
-
['id', "'bakers'"],
|
|
115
|
-
['scope', "'bb:session'"],
|
|
116
|
-
['default', 'true'],
|
|
117
|
-
]) {
|
|
118
|
-
if (e.expression(`${first}.with.${key}`) !== value)
|
|
119
|
-
e.set(`${first}.with.${key}`, value);
|
|
120
|
-
}
|
|
121
|
-
return e.text;
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* The ordered, contiguous migration chain. v1 was the pre-BB-226 shape (auth
|
|
125
|
-
* plugins only); v2 adds the markdown renderer entry; v3 collapses the two
|
|
126
|
-
* differently-scoped oauth2 providers into ONE identity on ONE scope (BB-391)
|
|
127
|
-
* — one, not zero: see {@link OAUTH2_SCOPE} for why the scope survives.
|
|
128
|
-
* Nothing below v1 is a versioned config (v0 = seed / hand-authored / untouched).
|
|
129
|
-
* `BB_CONFIG_SCHEMA_VERSION` derives from the chain's last `to` — never
|
|
130
|
-
* hardcode it.
|
|
131
|
-
*/
|
|
132
|
-
export const CONNECTION_MIGRATIONS = [
|
|
133
|
-
{
|
|
134
|
-
from: 1,
|
|
135
|
-
to: 2,
|
|
136
|
-
description: `add the ${RENDERER_PLUGIN_PACKAGE} renderer entry to plugins[]`,
|
|
137
|
-
apply: addRendererPluginEntry,
|
|
138
|
-
},
|
|
139
|
-
{
|
|
140
|
-
from: 2,
|
|
141
|
-
to: 3,
|
|
142
|
-
description: `collapse the two ${OAUTH2_PLUGIN_PACKAGE} entries into one ` +
|
|
143
|
-
`'${OAUTH2_PROVIDER_ID}' provider on scope '${OAUTH2_SCOPE}'`,
|
|
144
|
-
apply: collapseOauth2Providers,
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
from: 3,
|
|
148
|
-
to: 4,
|
|
149
|
-
description: 'connection owns credentials and workspace independently of machine context',
|
|
150
|
-
apply: (text) => {
|
|
151
|
-
const source = new ConfigSourceEditor(text);
|
|
152
|
-
if (/const (baseUrl|clientId|clientSecret|workspaceId) = [^;]*machine\.(base_url|client_id|client_secret|workspace_id)/.test(text) ||
|
|
153
|
-
[...source.source.properties.keys()].some((key) => /\bmachine\.(base_url|client_id|client_secret|workspace_id)\b/.test(source.expression(key) ?? '')))
|
|
154
|
-
throw new Error('Connection ownership requires scoped cross-file planning.');
|
|
155
|
-
return text;
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
];
|
|
19
|
+
export const CONNECTION_MIGRATIONS = [];
|
|
159
20
|
/** The current connection-config schema version — single source of truth. */
|
|
160
21
|
export const BB_CONFIG_SCHEMA_VERSION = CONNECTION_MIGRATIONS.at(-1)?.to ?? 1;
|
|
161
22
|
/** Parse the `@bakers-schema-version` marker from config text; `0` when absent. */
|
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
export declare const DEFAULT_CONDUCTOR_AGENT_ADDONS = "[{ use: '@bakers-build/addon-herdr' }, { use: '@bakers-build/addon-claude', alias: 'opus' }]";
|
|
2
|
-
/**
|
|
3
|
-
* A dynamic-import expression for a user-global config file, as source text.
|
|
4
|
-
*
|
|
5
|
-
* The result goes into a COMMITTED file, so it must name no path from the
|
|
6
|
-
* machine that generated it: an absolute path resolves nowhere on the next
|
|
7
|
-
* checkout, and loadMachine() swallows that failure, leaving conductor_id
|
|
8
|
-
* undefined with nothing erroring. BB_HOME is the relocation knob; HOME
|
|
9
|
-
* stays the fallback so the generated text works on a machine that sets
|
|
10
|
-
* neither.
|
|
11
|
-
*/
|
|
12
|
-
export declare function configImportExpression(name: string): string;
|
|
13
2
|
export type ConnectionAuthType = 'oauth2_client_credentials' | 'oauth2_device_code';
|
|
14
3
|
/** Current connection template inputs never come from machine context. */
|
|
15
4
|
export interface ConnectionInputs {
|
|
@@ -23,7 +12,7 @@ export interface ConnectionInputs {
|
|
|
23
12
|
export declare function renderGlobalConnection(inputs: ConnectionInputs): string;
|
|
24
13
|
export declare function renderHostMachine(inputs: {
|
|
25
14
|
machineId: string;
|
|
26
|
-
|
|
15
|
+
label?: string;
|
|
27
16
|
maxParallel: number;
|
|
28
17
|
}): string;
|
|
29
18
|
export declare function renderCommittedConfig(inputs: {
|
|
@@ -1,17 +1,4 @@
|
|
|
1
1
|
export const DEFAULT_CONDUCTOR_AGENT_ADDONS = "[{ use: '@bakers-build/addon-herdr' }, { use: '@bakers-build/addon-claude', alias: 'opus' }]";
|
|
2
|
-
/**
|
|
3
|
-
* A dynamic-import expression for a user-global config file, as source text.
|
|
4
|
-
*
|
|
5
|
-
* The result goes into a COMMITTED file, so it must name no path from the
|
|
6
|
-
* machine that generated it: an absolute path resolves nowhere on the next
|
|
7
|
-
* checkout, and loadMachine() swallows that failure, leaving conductor_id
|
|
8
|
-
* undefined with nothing erroring. BB_HOME is the relocation knob; HOME
|
|
9
|
-
* stays the fallback so the generated text works on a machine that sets
|
|
10
|
-
* neither.
|
|
11
|
-
*/
|
|
12
|
-
export function configImportExpression(name) {
|
|
13
|
-
return `\`\${process.env.BB_HOME ?? \`\${process.env.HOME}/.bakers\`}/${name}\``;
|
|
14
|
-
}
|
|
15
2
|
export function renderGlobalConnection(inputs) {
|
|
16
3
|
// The device-code grant has no client_secret in @dropsh/plugin-oauth2's
|
|
17
4
|
// config union, so the key is omitted rather than rendered undefined
|
|
@@ -27,10 +14,10 @@ export function renderGlobalConnection(inputs) {
|
|
|
27
14
|
? `client_id: ${JSON.stringify(inputs.clientId)},
|
|
28
15
|
device_authorization_url: ${JSON.stringify(`${baseUrl}/oauth/device_authorization`)},`
|
|
29
16
|
: `client_id: ${JSON.stringify(inputs.clientId)}, client_secret: ${JSON.stringify(inputs.secret ?? '')},`;
|
|
30
|
-
return `// @bakers-schema-version
|
|
17
|
+
return `// @bakers-schema-version 1
|
|
31
18
|
// Global bakers.build connection: credentials and optional legacy workspace. Keep this file private.
|
|
32
19
|
export default {
|
|
33
|
-
schema_version:
|
|
20
|
+
schema_version: 1,
|
|
34
21
|
site: { base_url: ${JSON.stringify(inputs.baseUrl)}, jsonapi_prefix: '/jsonapi' },
|
|
35
22
|
${inputs.workspaceId ? ` workspace_id: ${JSON.stringify(inputs.workspaceId)},\n` : ''}
|
|
36
23
|
plugins: [
|
|
@@ -45,20 +32,20 @@ ${inputs.workspaceId ? ` workspace_id: ${JSON.stringify(inputs.workspaceId)},\n
|
|
|
45
32
|
`;
|
|
46
33
|
}
|
|
47
34
|
export function renderHostMachine(inputs) {
|
|
48
|
-
return `// @bakers-schema-version
|
|
35
|
+
return `// @bakers-schema-version 1
|
|
49
36
|
// Local host identity and capacity. Server credentials belong to bakers.config.js.
|
|
50
37
|
export default {
|
|
51
|
-
schema_version:
|
|
38
|
+
schema_version: 1,
|
|
52
39
|
machine_id: ${JSON.stringify(inputs.machineId)},
|
|
53
|
-
|
|
54
|
-
max_parallel: ${inputs.maxParallel},
|
|
40
|
+
${inputs.label ? ` label: ${JSON.stringify(inputs.label)},\n` : ''} max_parallel: ${inputs.maxParallel},
|
|
55
41
|
};
|
|
56
42
|
`;
|
|
57
43
|
}
|
|
58
44
|
export function renderCommittedConfig(inputs) {
|
|
59
|
-
return `// Canonical bakers.build conductor engine configuration — committed
|
|
60
|
-
//
|
|
61
|
-
//
|
|
45
|
+
return `// Canonical bakers.build conductor engine configuration — committed and
|
|
46
|
+
// identical for everyone. It carries no identity: a conductor is this machine
|
|
47
|
+
// (machine.config.js) + this project + the variant (this file's stem).
|
|
48
|
+
// Connections belong to bakers.config.js.
|
|
62
49
|
//
|
|
63
50
|
// IMPORT-FREE (BB-78): the plugin slots are \`{ plugin, with }\` descriptors
|
|
64
51
|
// naming the REAL published package, not \`import\`ed constructors.
|
|
@@ -66,39 +53,11 @@ export function renderCommittedConfig(inputs) {
|
|
|
66
53
|
// conductor install). Every addon package default-exports its single factory, so
|
|
67
54
|
// no slot needs an \`export:\` — EXCEPT the merged herdr workspace
|
|
68
55
|
// (\`@bakers-build/addon-herdr\` default-exports the executor, so the workspace names
|
|
69
|
-
// \`export: 'herdrWorkspace'\` — BB-139).
|
|
70
|
-
// \`{ plugin: '@bakers-build/bakers/plugins', export: 'drupalRemote' }\` host-barrel
|
|
71
|
-
// descriptor with the real addon package \`@bakers-build/addon-remote-drupal\`.
|
|
72
|
-
|
|
73
|
-
// The user-global machine context: host identity and capacity, shared
|
|
74
|
-
// by every project on this machine. Never committed.
|
|
75
|
-
async function loadMachine() {
|
|
76
|
-
try {
|
|
77
|
-
return (await import(${configImportExpression('machine.config.js')})).default ?? {};
|
|
78
|
-
} catch {}
|
|
79
|
-
return {};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// OPTIONAL per-project override — create conductor.config.local.js beside this
|
|
83
|
-
// file to override machine-local values (conductor_id, model, …).
|
|
84
|
-
async function loadLocal() {
|
|
85
|
-
try { return (await import('./conductor.config.local.js')).default ?? {}; } catch {}
|
|
86
|
-
return {};
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const machine = await loadMachine();
|
|
90
|
-
const local = await loadLocal();
|
|
91
|
-
const project = ${JSON.stringify(inputs.project)};
|
|
92
|
-
const composedConductorId =
|
|
93
|
-
machine.user_id && machine.machine_id
|
|
94
|
-
? \`\${machine.user_id}-\${machine.machine_id}-\${project}\`
|
|
95
|
-
: undefined;
|
|
56
|
+
// \`export: 'herdrWorkspace'\` — BB-139).
|
|
96
57
|
|
|
97
58
|
export default {
|
|
98
59
|
bakers: { project: ${JSON.stringify(inputs.project)}${inputs.bakersWorkspace ? `, workspace: ${JSON.stringify(inputs.bakersWorkspace)}` : ''} },
|
|
99
|
-
//
|
|
100
|
-
// machine.config.js as max_parallel — do not set max_parallel here.
|
|
101
|
-
conductor_id: local.conductor_id ?? composedConductorId,
|
|
60
|
+
// Host capacity lives on machine.config.js as max_parallel — do not set it here.
|
|
102
61
|
// Set to false to keep this conductor's transcripts out of the log store
|
|
103
62
|
// (e.g. large, uninteresting, or subject to a local policy). Default true;
|
|
104
63
|
// metrics are unaffected either way.
|
|
@@ -71,7 +71,24 @@ function validateConductorSources(options, editors, report) {
|
|
|
71
71
|
add('misplaced_key', legacy, `Committed bakers.build identity belongs under bakers.${legacy === 'project' ? 'project' : 'workspace'}.`);
|
|
72
72
|
const finding = report.findings.at(-1);
|
|
73
73
|
if (finding)
|
|
74
|
-
finding.remediation = `
|
|
74
|
+
finding.remediation = `Move ${legacy} to bakers.${legacy === 'project' ? 'project' : 'workspace'} in ${shellQuote(file.path)}, then run ${recheck}.`;
|
|
75
|
+
}
|
|
76
|
+
// A conductor is machine + project + variant: no project file names an id.
|
|
77
|
+
for (const [source, path] of [
|
|
78
|
+
[editor, file.path],
|
|
79
|
+
[localEditor, localFile?.path],
|
|
80
|
+
]) {
|
|
81
|
+
if (!source || !path)
|
|
82
|
+
continue;
|
|
83
|
+
for (const key of ['conductor_id', 'machine_id', 'label']) {
|
|
84
|
+
const property = source.property(key);
|
|
85
|
+
if (!property)
|
|
86
|
+
continue;
|
|
87
|
+
add('retired_key', key, 'No identity in a project config: a conductor is machine + project + variant.', property, path);
|
|
88
|
+
const finding = report.findings.at(-1);
|
|
89
|
+
if (finding)
|
|
90
|
+
finding.remediation = `Remove ${key} from ${shellQuote(path)}; the machine identity comes from bakers init.`;
|
|
91
|
+
}
|
|
75
92
|
}
|
|
76
93
|
const bakers = editor.property('bakers');
|
|
77
94
|
const bakersExpression = editor.expression('bakers');
|
|
@@ -83,45 +100,12 @@ function validateConductorSources(options, editors, report) {
|
|
|
83
100
|
add('unsupported_source_shape', 'bakers', 'A statically inspectable bakers object without spreads is required.');
|
|
84
101
|
const finding = report.findings.at(-1);
|
|
85
102
|
if (finding)
|
|
86
|
-
finding.remediation = `
|
|
103
|
+
finding.remediation = `Write bakers as a literal object without spreads in ${shellQuote(file.path)}, then run ${recheck}.`;
|
|
87
104
|
}
|
|
88
105
|
const validateIdentity = (key) => {
|
|
89
|
-
const property = editor.property(key)
|
|
90
|
-
(key === 'conductor_id' ? editor.property('machine_id') : undefined);
|
|
91
|
-
const expression = property ? editor.expression(property.key) : undefined;
|
|
92
|
-
const generatedConductor = key === 'conductor_id' &&
|
|
93
|
-
/^(?:local\.(?:conductor_id|machine_id)\s*\?\?\s*)+(?:composedConductorId|composedMachineId)$/.test(expression ?? '') &&
|
|
94
|
-
/const composed(?:Conductor|Machine)Id\s*=/.test(editor.text) &&
|
|
95
|
-
/machine\.user_id/.test(editor.text) &&
|
|
96
|
-
/machine\.machine_id/.test(editor.text);
|
|
97
|
-
if (generatedConductor) {
|
|
98
|
-
if (!localEditor)
|
|
99
|
-
return;
|
|
100
|
-
const localMatches = (expression ?? '').matchAll(/local\.(conductor_id|machine_id)\s*\?\?/g);
|
|
101
|
-
for (const match of localMatches) {
|
|
102
|
-
const localKey = match[1];
|
|
103
|
-
if (!localKey)
|
|
104
|
-
continue;
|
|
105
|
-
const override = localEditor.property(localKey);
|
|
106
|
-
if (!override) {
|
|
107
|
-
if (!localEditor.source.unknownKeys)
|
|
108
|
-
continue;
|
|
109
|
-
add('unknown_value', localKey, 'A nonempty effective conductor identity.', undefined, localFile?.path ?? file.path);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (override.staticallyDetermined && override.value === null)
|
|
113
|
-
continue;
|
|
114
|
-
if (override.staticallyDetermined &&
|
|
115
|
-
typeof override.value === 'string' &&
|
|
116
|
-
override.value.trim() !== '')
|
|
117
|
-
return;
|
|
118
|
-
add(override.staticallyDetermined ? 'invalid_value' : 'unknown_value', localKey, 'A nonempty effective conductor identity.', override, localFile?.path ?? file.path);
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
106
|
+
const property = editor.property(key);
|
|
123
107
|
if (!property) {
|
|
124
|
-
add(editor.source.unknownKeys ? 'unknown_value' : 'missing_required_key', key,
|
|
108
|
+
add(editor.source.unknownKeys ? 'unknown_value' : 'missing_required_key', key, 'A nonempty conductor project.');
|
|
125
109
|
}
|
|
126
110
|
else if (property.staticallyDetermined &&
|
|
127
111
|
typeof property.value === 'string' &&
|
|
@@ -129,11 +113,10 @@ function validateConductorSources(options, editors, report) {
|
|
|
129
113
|
return;
|
|
130
114
|
}
|
|
131
115
|
else {
|
|
132
|
-
add(property.staticallyDetermined ? 'invalid_value' : 'unknown_value', key,
|
|
116
|
+
add(property.staticallyDetermined ? 'invalid_value' : 'unknown_value', key, 'A nonempty conductor project.', property);
|
|
133
117
|
}
|
|
134
118
|
};
|
|
135
119
|
validateIdentity('bakers.project');
|
|
136
|
-
validateIdentity('conductor_id');
|
|
137
120
|
const addon = editor.property('addons');
|
|
138
121
|
const addonSlots = new Set();
|
|
139
122
|
let addonsAreOpaque = false;
|
|
@@ -4,7 +4,7 @@ import { ConfigSourceEditor } from './config-source-edit.js';
|
|
|
4
4
|
/** Read committed bakers.build identity without executing conductor source. */
|
|
5
5
|
export function readBbProjectSelection(path) {
|
|
6
6
|
const editor = new ConfigSourceEditor(readFileSync(path, 'utf8'));
|
|
7
|
-
const invalid = () => new Error(`Cannot read committed bakers.project in ${path};
|
|
7
|
+
const invalid = () => new Error(`Cannot read committed bakers.project in ${path}; set bakers: { project: '<name>' } as a literal, without a top-level project or bb_workspace.`);
|
|
8
8
|
const bakers = editor.property('bakers');
|
|
9
9
|
const bakersExpression = editor.expression('bakers');
|
|
10
10
|
const bakersHasSpread = bakersExpression
|
|
@@ -57,7 +57,10 @@ export interface BbCliDeps {
|
|
|
57
57
|
stdoutIsTTY?: boolean;
|
|
58
58
|
/** Environment for CI / selector detection. Defaults to process.env. */
|
|
59
59
|
env?: NodeJS.ProcessEnv;
|
|
60
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* One prompt line (the update and the takeover question); empty string is
|
|
62
|
+
* default yes. Reject to cancel.
|
|
63
|
+
*/
|
|
61
64
|
askUpdate?: (question: string) => Promise<string>;
|
|
62
65
|
/** Invoke `bakers` with an argv array (no binary name). */
|
|
63
66
|
runBb?: (args: string[]) => Promise<void>;
|
|
@@ -67,6 +70,11 @@ export interface BbCliDeps {
|
|
|
67
70
|
* provider); otherwise logs a single clear line and returns false.
|
|
68
71
|
*/
|
|
69
72
|
export declare function ensureAuthenticated(config: ConductorFileConfig, logger: ConductorLogger): Promise<boolean>;
|
|
73
|
+
/** `oven start --adopt <uuid>` / `--new`: the takeover decision, given up front. */
|
|
74
|
+
export interface TakeoverChoice {
|
|
75
|
+
adopt?: string;
|
|
76
|
+
createNew?: boolean;
|
|
77
|
+
}
|
|
70
78
|
/**
|
|
71
79
|
* Other conductor records that name the SAME checkout as `own` (BB-450 D6,
|
|
72
80
|
* AC-19) — the exact ambiguity BB-281 recorded in the field: one checkout,
|