@bakers-build/conductor 0.8.0 → 0.8.1-next.10

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/config-plan.js +14 -29
  2. package/dist/src/cli/config-schema.d.ts +4 -4
  3. package/dist/src/cli/config-schema.js +5 -5
  4. package/dist/src/cli/config-templates.js +18 -24
  5. package/dist/src/cli/config-validation.d.ts +1 -1
  6. package/dist/src/cli/config-validation.js +27 -131
  7. package/dist/src/cli/project-context.d.ts +5 -8
  8. package/dist/src/cli/project-context.js +25 -68
  9. package/dist/src/commands/conductor.d.ts +2 -2
  10. package/dist/src/commands/conductor.js +24 -24
  11. package/dist/src/commands/oven-tools.js +1 -1
  12. package/dist/src/config.d.ts +16 -17
  13. package/dist/src/config.js +70 -136
  14. package/dist/src/contract.d.ts +2 -2
  15. package/dist/src/contract.js +1 -1
  16. package/dist/src/core/conductor.d.ts +3 -3
  17. package/dist/src/core/conductor.js +67 -35
  18. package/dist/src/core/mr-changes.js +3 -1
  19. package/dist/src/core/start-hooks.d.ts +3 -0
  20. package/dist/src/core/start-hooks.js +58 -0
  21. package/dist/src/core/tool-server.d.ts +1 -1
  22. package/dist/src/plugins/agent.d.ts +10 -3
  23. package/dist/src/plugins/agent.js +11 -3
  24. package/dist/src/plugins/executor.d.ts +12 -1
  25. package/dist/src/plugins/plugins.d.ts +2 -2
  26. package/dist/src/plugins/preset.d.ts +5 -5
  27. package/dist/src/plugins/remote.d.ts +9 -6
  28. package/dist/src/plugins/tools.d.ts +1 -0
  29. package/dist/src/plugins/tools.js +3 -3
  30. package/dist/src/plugins/workspace.d.ts +1 -1
  31. package/dist/src/preset.js +3 -2
  32. package/dist/src/types.d.ts +5 -4
  33. package/package.json +5 -5
  34. package/dist/src/core/required-skills.d.ts +0 -7
  35. package/dist/src/core/required-skills.js +0 -157
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bakers-build/conductor",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-next.10",
4
4
  "description": "bakers.build conductor engine + CLI: registers, claims tickets via JSON:API, dispatches agents.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -32,14 +32,14 @@
32
32
  "dependencies": {
33
33
  "@dropsh/plugin-jsonapi-schema": "^0.8.2",
34
34
  "@dropsh/plugin-oauth2": "^0.8.2",
35
- "@bakers-build/core": "^0.8.0",
36
- "@bakers-build/message": "^0.8.0",
35
+ "@bakers-build/core": "^0.8.1-next.10",
36
+ "@bakers-build/message": "^0.8.1-next.10",
37
37
  "@modelcontextprotocol/sdk": "1.32.1",
38
38
  "commander": "^12.1.0",
39
39
  "dropsh": "^0.8.2"
40
40
  },
41
41
  "bakersBuild": {
42
- "commit": "082d8c57436f78e751f5a9a26a4446cec42209ce",
43
- "channel": "latest"
42
+ "commit": "ceb44a12624feaa85cb2b0c9f84345399b38bf50",
43
+ "channel": "next"
44
44
  }
45
45
  }
@@ -1,7 +0,0 @@
1
- export declare function checkRequiredSkills(worktree: string, home: string, ticket: {
2
- type?: string;
3
- recipe?: string;
4
- }): {
5
- required: string[];
6
- missing: string[];
7
- };
@@ -1,157 +0,0 @@
1
- /**
2
- * The skills a run must be able to load: every skill named in the worktree's
3
- * `WORKFLOW.md` › `## bb-phase-work`, the ticket's recipe skill
4
- * `bb-recipe-<recipe>`, and the recipe's `metadata.requires` for the ticket's
5
- * type. Available are the worktree's own skills and the plugins installed in
6
- * the run's agent home; the user's own agent home never counts.
7
- */
8
- import { existsSync, readdirSync, readFileSync } from 'node:fs';
9
- import { basename, dirname, join } from 'node:path';
10
- const read = (path) => {
11
- try {
12
- return readFileSync(path, 'utf8');
13
- }
14
- catch {
15
- return '';
16
- }
17
- };
18
- const frontmatter = (text) => /^---\n([\s\S]*?)\n---/.exec(text)?.[1] ?? '';
19
- /** Skill directories (holding a SKILL.md) directly under `dir`, by their frontmatter name. */
20
- function skillsIn(dir) {
21
- let entries;
22
- try {
23
- entries = readdirSync(dir);
24
- }
25
- catch {
26
- return [];
27
- }
28
- return entries.flatMap((entry) => skillAt(join(dir, entry), entry));
29
- }
30
- /** A skill directory's SKILL.md by its frontmatter name, if it holds one. */
31
- function skillAt(dir, fallback) {
32
- const path = join(dir, 'SKILL.md');
33
- if (!existsSync(path))
34
- return [];
35
- const name = /^name:\s*(\S+)\s*$/m.exec(frontmatter(read(path)))?.[1];
36
- return [[name ?? fallback, path]];
37
- }
38
- /** Every SKILL.md at or below `dir`, by its frontmatter name. */
39
- function skillsBelow(dir) {
40
- let files;
41
- try {
42
- files = readdirSync(dir, { recursive: true, encoding: 'utf8' });
43
- }
44
- catch {
45
- return [];
46
- }
47
- return files
48
- .filter((file) => basename(file) === 'SKILL.md')
49
- .filter((file) => !file.includes('node_modules/'))
50
- .flatMap((file) => {
51
- const skillDir = join(dir, dirname(file));
52
- return skillAt(skillDir, basename(skillDir));
53
- });
54
- }
55
- /**
56
- * `<plugin>:<skill>` for each skill of the plugin rooted at `root`. The
57
- * manifest names the plugin and its `skills` paths (one or a list); without
58
- * one, the plugin is `fallback` with `skills/`. Like the harnesses, every
59
- * SKILL.md below a skills path counts.
60
- */
61
- function pluginSkills(root, fallback) {
62
- let manifest = {};
63
- for (const kind of ['.claude-plugin', '.codex-plugin']) {
64
- try {
65
- manifest = JSON.parse(read(join(root, kind, 'plugin.json')));
66
- break;
67
- }
68
- catch { }
69
- }
70
- const plugin = typeof manifest.name === 'string' ? manifest.name : fallback;
71
- const paths = (Array.isArray(manifest.skills)
72
- ? manifest.skills
73
- : [manifest.skills ?? 'skills']).filter((path) => typeof path === 'string');
74
- return paths
75
- .flatMap((path) => skillsBelow(join(root, path)))
76
- .map(([name, path]) => [`${plugin}:${name}`, path]);
77
- }
78
- const dirs = (dir) => {
79
- try {
80
- return readdirSync(dir, { withFileTypes: true })
81
- .filter((entry) => entry.isDirectory())
82
- .map((entry) => entry.name);
83
- }
84
- catch {
85
- return [];
86
- }
87
- };
88
- function availableSkills(worktree, home) {
89
- const found = new Map();
90
- const add = (pairs) => {
91
- for (const [name, path] of pairs)
92
- if (!found.has(name))
93
- found.set(name, path);
94
- };
95
- for (const root of ['.claude/skills', '.agents/skills']) {
96
- const dir = join(worktree, root);
97
- add(skillsIn(dir));
98
- // A skills-directory plugin, such as the `bakers` skills of this repository.
99
- for (const entry of dirs(dir))
100
- if (existsSync(join(dir, entry, '.claude-plugin', 'plugin.json')) ||
101
- existsSync(join(dir, entry, '.codex-plugin', 'plugin.json')))
102
- add(pluginSkills(join(dir, entry), entry));
103
- }
104
- // Both harnesses install to plugins/cache/<marketplace>/<plugin>/<version>.
105
- const cache = join(home, 'plugins', 'cache');
106
- for (const marketplace of dirs(cache))
107
- for (const plugin of dirs(join(cache, marketplace)))
108
- for (const version of dirs(join(cache, marketplace, plugin)))
109
- add(pluginSkills(join(cache, marketplace, plugin, version), plugin));
110
- return found;
111
- }
112
- /** The backticked names in the last column of the `## bb-phase-work` table. */
113
- function workflowSkills(worktree) {
114
- const section = /^## bb-phase-work\s*$([\s\S]*?)(?=^## |(?![\s\S]))/m.exec(read(join(worktree, 'WORKFLOW.md')))?.[1] ?? '';
115
- return section
116
- .split('\n')
117
- .filter((line) => line.trim().startsWith('|'))
118
- .flatMap((line) => {
119
- const cells = line
120
- .trim()
121
- .replace(/^\||\|$/g, '')
122
- .split('|');
123
- return [...(cells.at(-1) ?? '').matchAll(/`([^`]+)`/g)].map((m) => m[1]);
124
- });
125
- }
126
- /**
127
- * A recipe's `metadata.requires` (space-separated skill names), replaced by
128
- * `requires-<type>` when the recipe declares one for the ticket's type.
129
- */
130
- function recipeRequires(skillFile, type) {
131
- const lists = new Map();
132
- for (const m of frontmatter(read(skillFile)).matchAll(/^\s+requires(?:-([\w-]+))?:\s*"?([^"\n]*)"?\s*$/gm))
133
- lists.set(m[1] ?? 'default', m[2]);
134
- const list = (type && lists.get(type)) ?? lists.get('default') ?? '';
135
- return list.split(/\s+/).filter(Boolean);
136
- }
137
- function lookup(found, name) {
138
- if (name.includes(':'))
139
- return found.get(name);
140
- return (found.get(name) ?? [...found].find(([key]) => key.endsWith(`:${name}`))?.[1]);
141
- }
142
- export function checkRequiredSkills(worktree, home, ticket) {
143
- const found = availableSkills(worktree, home);
144
- const required = workflowSkills(worktree);
145
- if (ticket.recipe) {
146
- const recipe = `bb-recipe-${ticket.recipe}`;
147
- required.push(recipe);
148
- const path = lookup(found, recipe);
149
- if (path)
150
- required.push(...recipeRequires(path, ticket.type));
151
- }
152
- const unique = [...new Set(required)];
153
- return {
154
- required: unique,
155
- missing: unique.filter((name) => !lookup(found, name)),
156
- };
157
- }