@bakers-build/conductor 0.0.0-stage → 0.1.0-next.42
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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/src/bakers-project-context.d.ts +12 -0
- package/dist/src/bakers-project-context.js +59 -0
- package/dist/src/cli/config-plan.d.ts +35 -0
- package/dist/src/cli/config-plan.js +1264 -0
- package/dist/src/cli/config-schema.d.ts +137 -0
- package/dist/src/cli/config-schema.js +239 -0
- package/dist/src/cli/config-source-edit.d.ts +17 -0
- package/dist/src/cli/config-source-edit.js +95 -0
- package/dist/src/cli/config-templates.d.ts +43 -0
- package/dist/src/cli/config-templates.js +130 -0
- package/dist/src/cli/config-validation.d.ts +12 -0
- package/dist/src/cli/config-validation.js +353 -0
- package/dist/src/cli/migrate-addon-names.d.ts +82 -0
- package/dist/src/cli/migrate-addon-names.js +334 -0
- package/dist/src/cli/project-context.d.ts +21 -0
- package/dist/src/cli/project-context.js +105 -0
- package/dist/src/commands/conductor.d.ts +91 -0
- package/dist/src/commands/conductor.js +843 -0
- package/dist/src/config.d.ts +109 -0
- package/dist/src/config.js +712 -0
- package/dist/src/contract.d.ts +13 -0
- package/dist/src/contract.js +19 -0
- package/dist/src/core/action-queue.d.ts +31 -0
- package/dist/src/core/action-queue.js +69 -0
- package/dist/src/core/attempt.d.ts +25 -0
- package/dist/src/core/attempt.js +41 -0
- package/dist/src/core/conductor.d.ts +236 -0
- package/dist/src/core/conductor.js +1293 -0
- package/dist/src/core/host-key.d.ts +19 -0
- package/dist/src/core/host-key.js +27 -0
- package/dist/src/core/inbox-runtime.d.ts +48 -0
- package/dist/src/core/inbox-runtime.js +180 -0
- package/dist/src/core/mr-changes.d.ts +18 -0
- package/dist/src/core/mr-changes.js +47 -0
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.js +27 -0
- package/dist/src/plugins/agent-args.d.ts +43 -0
- package/dist/src/plugins/agent-args.js +221 -0
- package/dist/src/plugins/agent.d.ts +121 -0
- package/dist/src/plugins/agent.js +12 -0
- package/dist/src/plugins/executor.d.ts +182 -0
- package/dist/src/plugins/executor.js +1 -0
- package/dist/src/plugins/message.d.ts +61 -0
- package/dist/src/plugins/message.js +47 -0
- package/dist/src/plugins/plugins.d.ts +96 -0
- package/dist/src/plugins/plugins.js +120 -0
- package/dist/src/plugins/preset.d.ts +61 -0
- package/dist/src/plugins/preset.js +23 -0
- package/dist/src/plugins/process-host.d.ts +7 -0
- package/dist/src/plugins/process-host.js +1 -0
- package/dist/src/plugins/remote.d.ts +420 -0
- package/dist/src/plugins/remote.js +1 -0
- package/dist/src/plugins/workspace.d.ts +69 -0
- package/dist/src/plugins/workspace.js +1 -0
- package/dist/src/preset.d.ts +2 -0
- package/dist/src/preset.js +8 -0
- package/dist/src/types.d.ts +132 -0
- package/dist/src/types.js +6 -0
- package/package.json +38 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 keytec GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @bakers-build/conductor
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
bakers.build conductor engine + CLI: registers, claims tickets via JSON:API, dispatches agents.
|
|
4
|
+
|
|
5
|
+
Part of the bakers.build CLI. Install the meta package `@bakers-build/bakers` to get the `bakers` CLI with all addons. Source: https://git.key-tec.de/bakers-build/bakers-build (bakers-cli/).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JsonApiClient } from 'dropsh/plugin';
|
|
2
|
+
import type { BbProjectSelection } from './cli/project-context.js';
|
|
3
|
+
export interface ResolvedBbProjectContext {
|
|
4
|
+
projectId: string;
|
|
5
|
+
project: string;
|
|
6
|
+
workspaceId: string;
|
|
7
|
+
workspace: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class AmbiguousProjectNameError extends Error {
|
|
10
|
+
readonly name = "AmbiguousProjectNameError";
|
|
11
|
+
}
|
|
12
|
+
export declare function resolveBbProjectContext(client: JsonApiClient, selection: BbProjectSelection): Promise<ResolvedBbProjectContext>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
export class AmbiguousProjectNameError extends Error {
|
|
2
|
+
name = 'AmbiguousProjectNameError';
|
|
3
|
+
}
|
|
4
|
+
export async function resolveBbProjectContext(client, selection) {
|
|
5
|
+
let selectedWorkspace;
|
|
6
|
+
if (selection.workspace) {
|
|
7
|
+
const workspaces = await client
|
|
8
|
+
.collection('bb_workspace')
|
|
9
|
+
.where('name', '=', selection.workspace)
|
|
10
|
+
.page(2)
|
|
11
|
+
.list();
|
|
12
|
+
const matchingWorkspace = workspaces[0];
|
|
13
|
+
if (workspaces.length !== 1 || !matchingWorkspace) {
|
|
14
|
+
const reachable = await client
|
|
15
|
+
.collection('bb_workspace')
|
|
16
|
+
.page(100)
|
|
17
|
+
.list();
|
|
18
|
+
const names = reachable.map((row) => row.attr('name') ?? row.id);
|
|
19
|
+
throw new Error(`${workspaces.length ? 'Ambiguous' : 'Unknown'} workspace "${selection.workspace}". Reachable workspaces: ${names.join(', ') || '(none)'}.`);
|
|
20
|
+
}
|
|
21
|
+
selectedWorkspace = { id: matchingWorkspace.id, name: selection.workspace };
|
|
22
|
+
}
|
|
23
|
+
let query = client
|
|
24
|
+
.collection('bb_project')
|
|
25
|
+
.where('name', '=', selection.project);
|
|
26
|
+
if (selectedWorkspace)
|
|
27
|
+
query = query.where('group_id.workspace_id.id', '=', selectedWorkspace.id);
|
|
28
|
+
const projects = await query.page(2).list();
|
|
29
|
+
if (projects.length === 0) {
|
|
30
|
+
const reachable = selectedWorkspace
|
|
31
|
+
? selectedWorkspace.name
|
|
32
|
+
: (await client.collection('bb_workspace').page(100).list())
|
|
33
|
+
.map((row) => row.attr('name') ?? row.id)
|
|
34
|
+
.join(', ');
|
|
35
|
+
throw new Error(`bakers.build project "${selection.project}" not found. Reachable workspaces: ${reachable || '(none)'}.`);
|
|
36
|
+
}
|
|
37
|
+
const contexts = await Promise.all(projects.map(async (project) => {
|
|
38
|
+
const groupId = project.rel('group_id');
|
|
39
|
+
if (!groupId)
|
|
40
|
+
throw new Error(`bakers.build project "${selection.project}" has no owning group.`);
|
|
41
|
+
const group = await client.resource('bb_group', groupId);
|
|
42
|
+
const workspaceId = group.rel('workspace_id');
|
|
43
|
+
if (!workspaceId)
|
|
44
|
+
throw new Error(`bakers.build project "${selection.project}" has no owning workspace.`);
|
|
45
|
+
const workspace = await client.resource('bb_workspace', workspaceId);
|
|
46
|
+
return {
|
|
47
|
+
projectId: project.id,
|
|
48
|
+
project: selection.project,
|
|
49
|
+
workspaceId,
|
|
50
|
+
workspace: workspace.attr('name') ?? workspaceId,
|
|
51
|
+
};
|
|
52
|
+
}));
|
|
53
|
+
if (contexts.length > 1)
|
|
54
|
+
throw new AmbiguousProjectNameError(`bakers.build project "${selection.project}" is ambiguous: ${contexts.map((row) => `${row.workspace}/${row.project} (${row.projectId})`).join(', ')}. Commit bakers.workspace to disambiguate.`);
|
|
55
|
+
const context = contexts[0];
|
|
56
|
+
if (!context)
|
|
57
|
+
throw new Error(`bakers.build project "${selection.project}" not found.`);
|
|
58
|
+
return context;
|
|
59
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ConfigInventoryOptions, type ConfigReport } from '@bakers-build/core';
|
|
2
|
+
import { type ConnectionAuthType } from './config-templates.js';
|
|
3
|
+
export interface ConfigPlanOptions extends ConfigInventoryOptions {
|
|
4
|
+
inputs?: {
|
|
5
|
+
machineId?: string;
|
|
6
|
+
userId?: string;
|
|
7
|
+
maxParallel?: number;
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
clientId?: string;
|
|
10
|
+
secret?: string;
|
|
11
|
+
workspaceId?: string;
|
|
12
|
+
workspace?: string;
|
|
13
|
+
authType?: ConnectionAuthType;
|
|
14
|
+
/** The operator's own answer for each lifecycle hook; bakers-cli names no provisioning tool. */
|
|
15
|
+
hooks?: {
|
|
16
|
+
after_create?: string;
|
|
17
|
+
after_done?: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface ConfigWrite {
|
|
22
|
+
path: string;
|
|
23
|
+
before: string | null;
|
|
24
|
+
after: string | null;
|
|
25
|
+
mode: number;
|
|
26
|
+
}
|
|
27
|
+
/** Only report is safe to serialize. Writes contain private source text. */
|
|
28
|
+
export interface ConfigPlan {
|
|
29
|
+
report: ConfigReport;
|
|
30
|
+
writes: ConfigWrite[];
|
|
31
|
+
fingerprints: Map<string, string | null>;
|
|
32
|
+
}
|
|
33
|
+
/** Inventory, transform in memory, validate the complete proposed installation. */
|
|
34
|
+
export declare function planConfig(options?: ConfigPlanOptions): ConfigPlan;
|
|
35
|
+
export declare function applyConfigPlan(plan: ConfigPlan): ConfigReport;
|