@bakers-build/bakers 0.9.1-next.5 → 0.9.1-next.7
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/config.js +68 -61
- package/package.json +37 -37
package/dist/src/config.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { hostname } from 'node:os';
|
|
2
|
-
import { dirname, join } from 'node:path';
|
|
2
|
+
import { dirname, join, resolve } from 'node:path';
|
|
3
3
|
import { createInterface } from 'node:readline';
|
|
4
4
|
import { pathToFileURL } from 'node:url';
|
|
5
|
-
import { homeBbDir,
|
|
5
|
+
import { finalizeConfigReport, homeBbDir, inventoryConfig, readAddonCapabilities, reportLoadedBbConfigFields, resolveBbConnectionSelection, } from '@bakers-build/core';
|
|
6
6
|
import { Option } from 'commander';
|
|
7
7
|
/** Terminal-only input. Secret characters are never echoed. */
|
|
8
8
|
async function promptInput(label, secret = false) {
|
|
@@ -36,63 +36,40 @@ const SCOPE_FILE = {
|
|
|
36
36
|
machine: '~/.bakers/machine.config.js',
|
|
37
37
|
project: '.bakers/project.config.js',
|
|
38
38
|
};
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
scope: f.kind === 'machine' ? 'machine' : 'project',
|
|
73
|
-
path: f.path,
|
|
74
|
-
entries: await readConfigAddons(f.path),
|
|
75
|
-
bases: [
|
|
76
|
-
pathToFileURL(`${dirname(f.path)}/`).href,
|
|
77
|
-
...(f.kind === 'machine' ? [] : [pathToFileURL(`${cwd}/`).href]),
|
|
78
|
-
...hostBases,
|
|
79
|
-
],
|
|
80
|
-
}))), { unresolved: 'skip', logger: { warn: () => { } } });
|
|
81
|
-
for (const finding of findings) {
|
|
82
|
-
const allowed = finding.allowed.map((s) => SCOPE_FILE[s]).join(' or ');
|
|
83
|
-
report.findings.push({
|
|
84
|
-
...base,
|
|
85
|
-
code: 'addon_scope_not_allowed',
|
|
86
|
-
severity: 'error',
|
|
87
|
-
path: finding.path,
|
|
88
|
-
expected: `'${finding.spec}' may be configured only in ${allowed}.`,
|
|
89
|
-
observed: finding.spec,
|
|
90
|
-
owner: finding.scope,
|
|
91
|
-
remediation: `Move '${finding.spec}' from addons[] of ${finding.path} to addons[] of ${allowed}.`,
|
|
92
|
-
});
|
|
39
|
+
/** Check declared scopes without evaluating the user's configuration. */
|
|
40
|
+
function checkAddonScopes(report, planning) {
|
|
41
|
+
const inventory = inventoryConfig(planning);
|
|
42
|
+
for (const file of report.files.filter((f) => f.selected && (f.kind === 'machine' || f.kind === 'project'))) {
|
|
43
|
+
const source = inventory.sources.get(file.path);
|
|
44
|
+
if (!source)
|
|
45
|
+
continue;
|
|
46
|
+
for (const [key, property] of source.properties) {
|
|
47
|
+
if (!/^addons\[\d+\](?:\.use)?$/.test(key) ||
|
|
48
|
+
typeof property.value !== 'string')
|
|
49
|
+
continue;
|
|
50
|
+
const spec = property.value;
|
|
51
|
+
const allowed = planning.capabilities?.[spec]?.scopes;
|
|
52
|
+
const scope = file.kind === 'machine' ? 'machine' : 'project';
|
|
53
|
+
if (!allowed || allowed.includes(scope))
|
|
54
|
+
continue;
|
|
55
|
+
const target = allowed.map((s) => SCOPE_FILE[s]).join(' or ');
|
|
56
|
+
report.findings.push({
|
|
57
|
+
stage: 'schema',
|
|
58
|
+
key: 'addons',
|
|
59
|
+
related: [],
|
|
60
|
+
statically_determined: true,
|
|
61
|
+
recheck: 'bakers config check --scope all',
|
|
62
|
+
code: 'addon_scope_not_allowed',
|
|
63
|
+
severity: 'error',
|
|
64
|
+
path: file.path,
|
|
65
|
+
expected: `'${spec}' may be configured only in ${target}.`,
|
|
66
|
+
observed: spec,
|
|
67
|
+
owner: scope,
|
|
68
|
+
remediation: `Move '${spec}' from addons[] of ${file.path} to addons[] of ${target}.`,
|
|
69
|
+
});
|
|
70
|
+
finalizeConfigReport(report);
|
|
71
|
+
}
|
|
93
72
|
}
|
|
94
|
-
if (findings.length > 0 && report.result !== 'failed')
|
|
95
|
-
report.result = 'blocked';
|
|
96
73
|
}
|
|
97
74
|
/** `, N values not checked`: a passing result never hides what it skipped. */
|
|
98
75
|
function notCheckedSummary(report) {
|
|
@@ -113,6 +90,8 @@ export function renderConfigReport(report, dryRun = false) {
|
|
|
113
90
|
const { tunnel, source } = report.machine_policy;
|
|
114
91
|
lines.push(`Machine tunnel: ${tunnel === null ? 'unresolved' : tunnel} (from ${source})`);
|
|
115
92
|
}
|
|
93
|
+
for (const [slot, origin] of Object.entries(report.slot_sources ?? {}))
|
|
94
|
+
lines.push(`${slot[0]?.toUpperCase()}${slot.slice(1)}: ${origin}`);
|
|
116
95
|
if (report.executor_source)
|
|
117
96
|
lines.push(`Executor: from ${report.executor_source}`);
|
|
118
97
|
if (report.connection_resolution) {
|
|
@@ -163,9 +142,12 @@ function buildConfigCommand(parent, operation, deps, hiddenScope, description) {
|
|
|
163
142
|
.option('--connection <id>', 'named connection from ~/.bakers/connections')
|
|
164
143
|
.option('--yes', 'disable prompts and automatic selections')
|
|
165
144
|
.option('--online', 'authenticate and verify each selected workspace (project scopes); resolve addons[] entries to check their scopes');
|
|
145
|
+
if (operation === 'init')
|
|
146
|
+
for (const slot of ['server', 'executor', 'worktree'])
|
|
147
|
+
command.option(`--${slot} <package>`, `project ${slot} addon`);
|
|
166
148
|
if (operation !== 'check')
|
|
167
149
|
command
|
|
168
|
-
.option('--dry-run', 'report planned changes without
|
|
150
|
+
.option('--dry-run', 'report planned changes without config evaluation, network or writes')
|
|
169
151
|
.addOption(new Option('--project-connection <choice>', 'retired; use --connection'))
|
|
170
152
|
.option('--label <name>', 'machine display label (default: the short hostname)')
|
|
171
153
|
.option('--base-url <url>', 'connection server URL')
|
|
@@ -179,7 +161,7 @@ function buildConfigCommand(parent, operation, deps, hiddenScope, description) {
|
|
|
179
161
|
command.action(async (options) => {
|
|
180
162
|
if (hiddenScope !== undefined && options.scope === undefined)
|
|
181
163
|
options.scope = hiddenScope;
|
|
182
|
-
const { applyConfigPlan, planConfig } = await import('@bakers-build/conductor/config');
|
|
164
|
+
const { applyConfigPlan, planConfig, DEFAULT_SLOT_ADDON } = await import('@bakers-build/conductor/config');
|
|
183
165
|
if (options.projectConnection !== undefined)
|
|
184
166
|
throw new Error('--project-connection is retired; use --connection <id> or BAKERS_CONNECTION.');
|
|
185
167
|
const cwd = deps.cwd ?? process.cwd();
|
|
@@ -272,6 +254,28 @@ function buildConfigCommand(parent, operation, deps, hiddenScope, description) {
|
|
|
272
254
|
});
|
|
273
255
|
planning.connectionPath = selectedConnection.path;
|
|
274
256
|
}
|
|
257
|
+
planning.slots = {};
|
|
258
|
+
for (const slot of ['server', 'executor', 'worktree'])
|
|
259
|
+
if (options[slot] !== undefined)
|
|
260
|
+
planning.slots[slot] = options[slot];
|
|
261
|
+
// Static inventory supplies package names; only preset modules are imported.
|
|
262
|
+
const sources = inventoryConfig(planning).sources;
|
|
263
|
+
const projectBases = [
|
|
264
|
+
pathToFileURL(`${resolve(cwd, options.path ?? '.')}/`).href,
|
|
265
|
+
import.meta.url,
|
|
266
|
+
];
|
|
267
|
+
planning.capabilities = {};
|
|
268
|
+
for (const [path, source] of sources) {
|
|
269
|
+
const specs = [...source.properties]
|
|
270
|
+
.filter(([key, property]) => /^addons\[\d+\](?:\.use)?$/.test(key) &&
|
|
271
|
+
typeof property.value === 'string')
|
|
272
|
+
.map(([, property]) => property.value);
|
|
273
|
+
Object.assign(planning.capabilities, await readAddonCapabilities(specs, [
|
|
274
|
+
pathToFileURL(`${dirname(path)}/`).href,
|
|
275
|
+
...projectBases,
|
|
276
|
+
]));
|
|
277
|
+
}
|
|
278
|
+
Object.assign(planning.capabilities, await readAddonCapabilities([...Object.values(planning.slots), DEFAULT_SLOT_ADDON], projectBases));
|
|
275
279
|
let plan = planConfig(planning);
|
|
276
280
|
if (operation === 'init' &&
|
|
277
281
|
options.project &&
|
|
@@ -371,15 +375,18 @@ function buildConfigCommand(parent, operation, deps, hiddenScope, description) {
|
|
|
371
375
|
const current = planConfig({
|
|
372
376
|
...planning,
|
|
373
377
|
operation: 'check',
|
|
378
|
+
slots: {},
|
|
374
379
|
}).report;
|
|
375
380
|
report.files = current.files;
|
|
376
381
|
report.findings = current.findings;
|
|
377
382
|
report.result = current.result;
|
|
378
383
|
report.verification = current.verification;
|
|
384
|
+
if (current.slot_sources)
|
|
385
|
+
report.slot_sources = current.slot_sources;
|
|
379
386
|
}
|
|
380
387
|
}
|
|
381
388
|
if (!cancelled && operation === 'check')
|
|
382
|
-
|
|
389
|
+
checkAddonScopes(report, planning);
|
|
383
390
|
// A device-code connection authenticates from a session that sign-in
|
|
384
391
|
// creates, and nothing has signed in yet when `init` has only just
|
|
385
392
|
// written the file. Verifying here therefore reports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/bakers",
|
|
3
|
-
"version": "0.9.1-next.
|
|
3
|
+
"version": "0.9.1-next.7",
|
|
4
4
|
"description": "bakers.build meta package: the `bakers` plugin-host CLI + all runtime plugins. Global install target.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -38,45 +38,45 @@
|
|
|
38
38
|
"jsonapi"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@bakers-build/addon-agents": "^0.9.1-next.
|
|
42
|
-
"@bakers-build/addon-auth-basic": "^0.9.1-next.
|
|
43
|
-
"@bakers-build/addon-claude": "^0.9.1-next.
|
|
44
|
-
"@bakers-build/addon-codex": "^0.9.1-next.
|
|
45
|
-
"@bakers-build/addon-ddev": "^0.9.1-next.
|
|
46
|
-
"@bakers-build/addon-deployment": "^0.9.1-next.
|
|
47
|
-
"@bakers-build/addon-dropsh": "^0.9.1-next.
|
|
48
|
-
"@bakers-build/addon-essentials": "^0.9.1-next.
|
|
49
|
-
"@bakers-build/addon-bakers-ui": "^0.9.1-next.
|
|
50
|
-
"@bakers-build/addon-bakers-ui-artifacts": "^0.9.1-next.
|
|
51
|
-
"@bakers-build/addon-forge": "^0.9.1-next.
|
|
52
|
-
"@bakers-build/addon-forge-github": "^0.9.1-next.
|
|
53
|
-
"@bakers-build/addon-forge-gitlab": "^0.9.1-next.
|
|
54
|
-
"@bakers-build/addon-grok": "^0.9.1-next.
|
|
55
|
-
"@bakers-build/addon-herdr": "^0.9.1-next.
|
|
56
|
-
"@bakers-build/addon-herdr-core": "^0.9.1-next.
|
|
57
|
-
"@bakers-build/addon-info": "^0.9.1-next.
|
|
58
|
-
"@bakers-build/addon-kimi": "^0.9.1-next.
|
|
59
|
-
"@bakers-build/addon-opencode": "^0.9.1-next.
|
|
60
|
-
"@bakers-build/addon-orca": "^0.9.1-next.
|
|
61
|
-
"@bakers-build/addon-pi": "^0.9.1-next.
|
|
62
|
-
"@bakers-build/addon-ports": "^0.9.1-next.
|
|
63
|
-
"@bakers-build/addon-ports-cloudflare": "^0.9.1-next.
|
|
64
|
-
"@bakers-build/addon-ports-cloudflare-quick": "^0.9.1-next.
|
|
65
|
-
"@bakers-build/addon-ports-frp": "^0.9.1-next.
|
|
66
|
-
"@bakers-build/addon-remote-drupal": "^0.9.1-next.
|
|
67
|
-
"@bakers-build/addon-runtime-docker": "^0.9.1-next.
|
|
68
|
-
"@bakers-build/addon-runtime-bwrap": "^0.9.1-next.
|
|
69
|
-
"@bakers-build/addon-tailscale": "^0.9.1-next.
|
|
70
|
-
"@bakers-build/addon-track": "^0.9.1-next.
|
|
71
|
-
"@bakers-build/addon-workspace": "^0.9.1-next.
|
|
72
|
-
"@bakers-build/addon-workspace-git": "^0.9.1-next.
|
|
73
|
-
"@bakers-build/conductor": "^0.9.1-next.
|
|
74
|
-
"@bakers-build/core": "^0.9.1-next.
|
|
75
|
-
"@bakers-build/ui": "^0.9.1-next.
|
|
41
|
+
"@bakers-build/addon-agents": "^0.9.1-next.7",
|
|
42
|
+
"@bakers-build/addon-auth-basic": "^0.9.1-next.7",
|
|
43
|
+
"@bakers-build/addon-claude": "^0.9.1-next.7",
|
|
44
|
+
"@bakers-build/addon-codex": "^0.9.1-next.7",
|
|
45
|
+
"@bakers-build/addon-ddev": "^0.9.1-next.7",
|
|
46
|
+
"@bakers-build/addon-deployment": "^0.9.1-next.7",
|
|
47
|
+
"@bakers-build/addon-dropsh": "^0.9.1-next.7",
|
|
48
|
+
"@bakers-build/addon-essentials": "^0.9.1-next.7",
|
|
49
|
+
"@bakers-build/addon-bakers-ui": "^0.9.1-next.7",
|
|
50
|
+
"@bakers-build/addon-bakers-ui-artifacts": "^0.9.1-next.7",
|
|
51
|
+
"@bakers-build/addon-forge": "^0.9.1-next.7",
|
|
52
|
+
"@bakers-build/addon-forge-github": "^0.9.1-next.7",
|
|
53
|
+
"@bakers-build/addon-forge-gitlab": "^0.9.1-next.7",
|
|
54
|
+
"@bakers-build/addon-grok": "^0.9.1-next.7",
|
|
55
|
+
"@bakers-build/addon-herdr": "^0.9.1-next.7",
|
|
56
|
+
"@bakers-build/addon-herdr-core": "^0.9.1-next.7",
|
|
57
|
+
"@bakers-build/addon-info": "^0.9.1-next.7",
|
|
58
|
+
"@bakers-build/addon-kimi": "^0.9.1-next.7",
|
|
59
|
+
"@bakers-build/addon-opencode": "^0.9.1-next.7",
|
|
60
|
+
"@bakers-build/addon-orca": "^0.9.1-next.7",
|
|
61
|
+
"@bakers-build/addon-pi": "^0.9.1-next.7",
|
|
62
|
+
"@bakers-build/addon-ports": "^0.9.1-next.7",
|
|
63
|
+
"@bakers-build/addon-ports-cloudflare": "^0.9.1-next.7",
|
|
64
|
+
"@bakers-build/addon-ports-cloudflare-quick": "^0.9.1-next.7",
|
|
65
|
+
"@bakers-build/addon-ports-frp": "^0.9.1-next.7",
|
|
66
|
+
"@bakers-build/addon-remote-drupal": "^0.9.1-next.7",
|
|
67
|
+
"@bakers-build/addon-runtime-docker": "^0.9.1-next.7",
|
|
68
|
+
"@bakers-build/addon-runtime-bwrap": "^0.9.1-next.7",
|
|
69
|
+
"@bakers-build/addon-tailscale": "^0.9.1-next.7",
|
|
70
|
+
"@bakers-build/addon-track": "^0.9.1-next.7",
|
|
71
|
+
"@bakers-build/addon-workspace": "^0.9.1-next.7",
|
|
72
|
+
"@bakers-build/addon-workspace-git": "^0.9.1-next.7",
|
|
73
|
+
"@bakers-build/conductor": "^0.9.1-next.7",
|
|
74
|
+
"@bakers-build/core": "^0.9.1-next.7",
|
|
75
|
+
"@bakers-build/ui": "^0.9.1-next.7",
|
|
76
76
|
"commander": "^12.1.0"
|
|
77
77
|
},
|
|
78
78
|
"bakersBuild": {
|
|
79
|
-
"commit": "
|
|
79
|
+
"commit": "03781c6f8dc8c4c3d87fdcf12ae37df35abc6286",
|
|
80
80
|
"channel": "next"
|
|
81
81
|
}
|
|
82
82
|
}
|