@bakers-build/addon-orca 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.
@@ -1,13 +1,14 @@
1
+ import type { LaunchWatchOptions } from '@bakers-build/addon-herdr/shared';
1
2
  import type { RootGitExec } from '@bakers-build/core';
2
3
  import type { OrcaOpenLayout } from './workspace.js';
3
4
  export interface OrcaStateConfig {
4
5
  /**
5
6
  * Terminal title template; must contain `{identifier}`. Other vars:
6
- * `{state}` (the state the run was started for), `{title}`, `{titleSlug}`,
7
- * `{runUuid}`, `{workspacePath}`. `startRun`
7
+ * `{state}` (the state the run was started for), `{title}`, `{title_slug}`,
8
+ * `{run_uuid}`, `{workspace_path}`. `startRun`
8
9
  * appends ` #<run.id>`, the token `cleanupRun` finds the run's terminal by.
9
10
  */
10
- tabLabel?: string;
11
+ tab_label?: string;
11
12
  }
12
13
  export interface OrcaExecutorOptions {
13
14
  /** Fallback agent command when the conductor supplies none. */
@@ -21,14 +22,9 @@ export interface OrcaExecutorOptions {
21
22
  default?: OrcaStateConfig;
22
23
  states?: Record<string, OrcaStateConfig>;
23
24
  /** Same windows as herdr: wait for `started` (60 s), then an exit window (4 s). */
24
- launchWatch?: {
25
- timeoutMs?: number;
26
- startTimeoutMs?: number;
27
- pollMs?: number;
28
- sleep?: (ms: number) => Promise<void>;
29
- };
25
+ launch_watch?: Omit<LaunchWatchOptions, 'readPane'>;
30
26
  /** How long `startRun` waits for Orca to adopt the worktree. Default 35 s. */
31
- adoptTimeoutMs?: number;
27
+ adopt_timeout_ms?: number;
32
28
  }
33
29
  export declare const DEFAULT_TAB_LABEL = "{identifier} \u00B7 {state}";
34
30
  export declare function resolveTabLabel(options: OrcaExecutorOptions, state: string): string;
@@ -1,10 +1,10 @@
1
1
  export const DEFAULT_TAB_LABEL = '{identifier} · {state}';
2
2
  export function resolveTabLabel(options, state) {
3
- const tabLabel = options.states?.[state]?.tabLabel ??
4
- options.default?.tabLabel ??
3
+ const tabLabel = options.states?.[state]?.tab_label ??
4
+ options.default?.tab_label ??
5
5
  DEFAULT_TAB_LABEL;
6
6
  if (!tabLabel.includes('{identifier}')) {
7
- throw new Error(`orca tabLabel must contain {identifier}: ${tabLabel}`);
7
+ throw new Error(`orca tab_label must contain {identifier}: ${tabLabel}`);
8
8
  }
9
9
  return tabLabel;
10
10
  }
package/dist/src/index.js CHANGED
@@ -65,9 +65,9 @@ export class OrcaExecutor {
65
65
  identifier: input.ticket.identifier,
66
66
  state: input.ticket.state,
67
67
  title: input.ticket.title,
68
- titleSlug: slugify(input.ticket.title),
69
- runUuid: input.run.uuid,
70
- workspacePath: input.workspacePath,
68
+ title_slug: slugify(input.ticket.title),
69
+ run_uuid: input.run.uuid,
70
+ workspace_path: input.workspacePath,
71
71
  })} #${input.run.id}`;
72
72
  let launch;
73
73
  let handle;
@@ -106,7 +106,7 @@ export class OrcaExecutor {
106
106
  ]);
107
107
  const readHandle = handle;
108
108
  await watchLaunch(launch, {
109
- ...(this.options.launchWatch ?? {}),
109
+ ...(this.options.launch_watch ?? {}),
110
110
  readPane: () => this.readTail(readHandle),
111
111
  });
112
112
  return { sessionRef: input.ticket.branchName };
@@ -204,7 +204,7 @@ export class OrcaExecutor {
204
204
  identifier: ctx.identifier,
205
205
  branch: ctx.branch,
206
206
  title: ctx.title,
207
- worktreePath: path,
207
+ worktree_path: path,
208
208
  };
209
209
  try {
210
210
  await this.adopt(path);
@@ -236,7 +236,7 @@ export class OrcaExecutor {
236
236
  if (this.options.root) {
237
237
  await registerRepo(this.execOrca, this.options.root);
238
238
  }
239
- await waitForAdoption(this.execOrca, path, this.options.adoptTimeoutMs ?? DEFAULT_ADOPT_TIMEOUT_MS, this.sleep);
239
+ await waitForAdoption(this.execOrca, path, this.options.adopt_timeout_ms ?? DEFAULT_ADOPT_TIMEOUT_MS, this.sleep);
240
240
  }
241
241
  commandFor(input) {
242
242
  const env = Object.entries(input.env ?? {}).map(([key, value]) => {
@@ -1,4 +1,4 @@
1
1
  import type { Preset } from '@bakers-build/conductor/contract';
2
2
  export declare const executors: Preset['executors'];
3
- export declare const workspaces: Preset['workspaces'];
3
+ export declare const worktrees: Preset['worktrees'];
4
4
  export declare const scopes: Preset['scopes'];
@@ -3,7 +3,7 @@ export const executors = (acc, opts) => [
3
3
  ...acc,
4
4
  orcaExecutor(opts),
5
5
  ];
6
- export const workspaces = (acc, opts) => [
6
+ export const worktrees = (acc, opts) => [
7
7
  ...acc,
8
8
  orcaWorkspace(opts),
9
9
  ];
@@ -5,7 +5,7 @@ export type GitExec = (args: string[]) => Promise<string>;
5
5
  export type Sleep = (ms: number) => Promise<void>;
6
6
  /**
7
7
  * The overview terminal a FRESH worktree opens. `{identifier}`, `{branch}`,
8
- * `{title}` and `{worktreePath}` expand in both; `open: {}` opens nothing.
8
+ * `{title}` and `{worktree_path}` expand in both; `open: {}` opens nothing.
9
9
  */
10
10
  export interface OrcaOpenLayout {
11
11
  command?: string;
@@ -78,10 +78,10 @@ export declare class OrcaWorkspace implements BbWorkspace {
78
78
  export declare function orcaWorkspace(opts?: {
79
79
  /** Explicit repo-root override; otherwise derived from the git common dir. */
80
80
  root?: string;
81
- worktreeDir?: string;
82
- baseBranch?: string;
83
- adoptTimeoutMs?: number;
84
- autoSetupMerge?: boolean;
81
+ worktree_dir?: string;
82
+ base_branch?: string;
83
+ adopt_timeout_ms?: number;
84
+ auto_setup_merge?: boolean;
85
85
  /** Overrideable git exec for root derivation (tests). */
86
86
  execGit?: RootGitExec;
87
87
  }): WorkspacePlugin;
@@ -1,6 +1,6 @@
1
1
  import { existsSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
- import { resolveBaseRef, restoreWritable, validateBranch, } from '@bakers-build/addon-herdr/shared';
3
+ import { resolveBaseRef, restoreWritable, } from '@bakers-build/addon-herdr/shared';
4
4
  import { loadInstructions, removeGitWorktree, runBranchGit, } from '@bakers-build/addon-workspace-git';
5
5
  import { deriveCheckoutRoot, exec } from '@bakers-build/core';
6
6
  import { assertOrcaReachable, createOrcaExec, isRecord, OrcaError, } from './orca-cli.js';
@@ -105,7 +105,6 @@ export class OrcaWorkspace {
105
105
  if (branch === undefined) {
106
106
  throw new Error('orca workspace requires a branch name');
107
107
  }
108
- validateBranch(branch);
109
108
  const extra = this.options.autoSetupMerge
110
109
  ? {}
111
110
  : { env: await runBranchGit(this.root, this.logger) };
@@ -153,7 +152,7 @@ export class OrcaWorkspace {
153
152
  return;
154
153
  }
155
154
  try {
156
- await this.execGit(['-C', this.root, 'fetch', 'origin', branch]);
155
+ await this.execGit(['-C', this.root, 'fetch', 'origin', '--', branch]);
157
156
  }
158
157
  catch {
159
158
  // Non-fatal: the branch is simply not on origin (yet).
@@ -236,7 +235,7 @@ export class OrcaWorkspace {
236
235
  }
237
236
  export function orcaWorkspace(opts = {}) {
238
237
  return {
239
- kind: 'workspace',
238
+ kind: 'worktree',
240
239
  id: 'orca',
241
240
  requiredModules: [],
242
241
  async createWorkspace(config, deps) {
@@ -246,12 +245,12 @@ export function orcaWorkspace(opts = {}) {
246
245
  });
247
246
  return new OrcaWorkspace({
248
247
  root,
249
- ...(opts.worktreeDir ? { worktreeDir: opts.worktreeDir } : {}),
250
- ...(opts.baseBranch ? { baseBranch: opts.baseBranch } : {}),
251
- ...(opts.adoptTimeoutMs !== undefined
252
- ? { adoptTimeoutMs: opts.adoptTimeoutMs }
248
+ ...(opts.worktree_dir ? { worktreeDir: opts.worktree_dir } : {}),
249
+ ...(opts.base_branch ? { baseBranch: opts.base_branch } : {}),
250
+ ...(opts.adopt_timeout_ms !== undefined
251
+ ? { adoptTimeoutMs: opts.adopt_timeout_ms }
253
252
  : {}),
254
- ...(opts.autoSetupMerge ? { autoSetupMerge: true } : {}),
253
+ ...(opts.auto_setup_merge ? { autoSetupMerge: true } : {}),
255
254
  ...(deps?.logger ? { logger: deps.logger } : {}),
256
255
  });
257
256
  },
@@ -0,0 +1,109 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://bakers.build/schema/addon-orca/options.schema.json",
4
+ "title": "Orca executor + worktree options",
5
+ "type": "object",
6
+ "properties": {
7
+ "command": {
8
+ "type": "string",
9
+ "description": "Fallback agent command when the agent addons supply none.",
10
+ "default": "claude"
11
+ },
12
+ "open": {
13
+ "type": "object",
14
+ "description": "Overview terminal of a fresh worktree; when omitted it runs `bakers ui --ticket {identifier}` titled `{identifier} · {title}`, `{}` opens none. Templates expand {identifier}, {branch}, {title}, {worktree_path}.",
15
+ "properties": {
16
+ "command": {
17
+ "type": "string",
18
+ "description": "Command of the overview terminal.",
19
+ "default": "bakers ui --ticket {identifier}"
20
+ },
21
+ "title": {
22
+ "type": "string",
23
+ "description": "Title of the overview terminal.",
24
+ "default": "{identifier} · {title}"
25
+ }
26
+ },
27
+ "additionalProperties": false
28
+ },
29
+ "root": {
30
+ "type": "string",
31
+ "description": "Main clone path; derived from Git's common directory when omitted."
32
+ },
33
+ "default": {
34
+ "$ref": "#/$defs/state",
35
+ "description": "Agent terminal settings for every run; a `states` entry beats it."
36
+ },
37
+ "states": {
38
+ "type": "object",
39
+ "additionalProperties": {
40
+ "$ref": "#/$defs/state"
41
+ },
42
+ "description": "Agent terminal settings per workflow state.",
43
+ "propertyNames": {
44
+ "title": "state"
45
+ }
46
+ },
47
+ "launch_watch": {
48
+ "type": "object",
49
+ "description": "Launch-watch windows: how long a start may take and how soon an agent exit counts as a failed launch.",
50
+ "properties": {
51
+ "timeout_ms": {
52
+ "type": "integer",
53
+ "minimum": 0,
54
+ "description": "Window after start in which an immediate agent exit fails the launch; 0 skips it.",
55
+ "default": 4000
56
+ },
57
+ "start_timeout_ms": {
58
+ "type": "integer",
59
+ "minimum": 0,
60
+ "description": "How long the launch waits for the wrapper to report the start.",
61
+ "default": 60000
62
+ },
63
+ "poll_ms": {
64
+ "type": "integer",
65
+ "minimum": 0,
66
+ "description": "Polling interval of both windows.",
67
+ "default": 50
68
+ }
69
+ },
70
+ "additionalProperties": false
71
+ },
72
+ "adopt_timeout_ms": {
73
+ "type": "integer",
74
+ "minimum": 0,
75
+ "description": "How long to wait for Orca to adopt a new worktree.",
76
+ "default": 35000
77
+ },
78
+ "worktree_dir": {
79
+ "type": "string",
80
+ "description": "Directory for new worktrees, relative to `root` or absolute.",
81
+ "default": ".bakers-worktrees"
82
+ },
83
+ "base_branch": {
84
+ "type": "string",
85
+ "description": "Base ref for new branches; when omitted, the remote-tracking branch of the checked-out branch."
86
+ },
87
+ "auto_setup_merge": {
88
+ "type": "boolean",
89
+ "description": "`false` sets Git's `branch.autoSetupMerge=false` in the root repository, so run branches have no upstream and push with `push.default=current` (see workspace-git); `true` leaves Git alone.",
90
+ "default": false
91
+ }
92
+ },
93
+ "additionalProperties": false,
94
+ "$defs": {
95
+ "state": {
96
+ "type": "object",
97
+ "properties": {
98
+ "tab_label": {
99
+ "type": "string",
100
+ "pattern": "\\{identifier\\}",
101
+ "description": "Agent terminal title; must contain {identifier}, also expands {state}, {title}, {title_slug}, {run_uuid}, {workspace_path}. ` #<run id>` is always appended.",
102
+ "default": "{identifier} · {state}"
103
+ }
104
+ },
105
+ "additionalProperties": false,
106
+ "description": "Agent terminal settings of a run."
107
+ }
108
+ }
109
+ }
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@bakers-build/addon-orca",
3
- "version": "0.8.0",
3
+ "version": "0.8.1-next.10",
4
4
  "description": "bakers.build Orca integration: executor + per-ticket worktree workspace hosted in Orca.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "exports": {
8
8
  ".": "./dist/src/index.js",
9
- "./preset": "./dist/src/preset.js"
9
+ "./preset": "./dist/src/preset.js",
10
+ "./options.schema.json": "./options.schema.json"
10
11
  },
11
12
  "files": [
12
- "dist/src"
13
+ "dist/src",
14
+ "options.schema.json"
13
15
  ],
14
16
  "publishConfig": {
15
17
  "access": "public"
@@ -20,15 +22,15 @@
20
22
  "directory": "bakers-cli/addons/orca"
21
23
  },
22
24
  "dependencies": {
23
- "@bakers-build/addon-herdr": "^0.8.0",
24
- "@bakers-build/addon-workspace-git": "^0.8.0"
25
+ "@bakers-build/addon-herdr": "^0.8.1-next.10",
26
+ "@bakers-build/addon-workspace-git": "^0.8.1-next.10"
25
27
  },
26
28
  "peerDependencies": {
27
- "@bakers-build/conductor": "^0.8.0",
28
- "@bakers-build/core": "^0.8.0"
29
+ "@bakers-build/conductor": "^0.8.1-next.10",
30
+ "@bakers-build/core": "^0.8.1-next.10"
29
31
  },
30
32
  "bakersBuild": {
31
- "commit": "082d8c57436f78e751f5a9a26a4446cec42209ce",
32
- "channel": "latest"
33
+ "commit": "ceb44a12624feaa85cb2b0c9f84345399b38bf50",
34
+ "channel": "next"
33
35
  }
34
36
  }