@bakers-build/addon-orca 0.7.1-next.7 → 0.8.1-next.1

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;
@@ -236,7 +236,7 @@ export class OrcaWorkspace {
236
236
  }
237
237
  export function orcaWorkspace(opts = {}) {
238
238
  return {
239
- kind: 'workspace',
239
+ kind: 'worktree',
240
240
  id: 'orca',
241
241
  requiredModules: [],
242
242
  async createWorkspace(config, deps) {
@@ -246,12 +246,12 @@ export function orcaWorkspace(opts = {}) {
246
246
  });
247
247
  return new OrcaWorkspace({
248
248
  root,
249
- ...(opts.worktreeDir ? { worktreeDir: opts.worktreeDir } : {}),
250
- ...(opts.baseBranch ? { baseBranch: opts.baseBranch } : {}),
251
- ...(opts.adoptTimeoutMs !== undefined
252
- ? { adoptTimeoutMs: opts.adoptTimeoutMs }
249
+ ...(opts.worktree_dir ? { worktreeDir: opts.worktree_dir } : {}),
250
+ ...(opts.base_branch ? { baseBranch: opts.base_branch } : {}),
251
+ ...(opts.adopt_timeout_ms !== undefined
252
+ ? { adoptTimeoutMs: opts.adopt_timeout_ms }
253
253
  : {}),
254
- ...(opts.autoSetupMerge ? { autoSetupMerge: true } : {}),
254
+ ...(opts.auto_setup_merge ? { autoSetupMerge: true } : {}),
255
255
  ...(deps?.logger ? { logger: deps.logger } : {}),
256
256
  });
257
257
  },
@@ -0,0 +1,88 @@
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 conductor supplies none. Default `claude`."
10
+ },
11
+ "open": {
12
+ "type": "object",
13
+ "description": "Overview terminal of a fresh worktree; `{}` opens nothing. Templates expand {identifier}, {branch}, {title}, {worktree_path}.",
14
+ "properties": {
15
+ "command": {
16
+ "type": "string"
17
+ },
18
+ "title": {
19
+ "type": "string"
20
+ }
21
+ },
22
+ "additionalProperties": false
23
+ },
24
+ "root": {
25
+ "type": "string",
26
+ "description": "Main clone; otherwise derived from the git common dir."
27
+ },
28
+ "default": {
29
+ "$ref": "#/$defs/state"
30
+ },
31
+ "states": {
32
+ "type": "object",
33
+ "additionalProperties": {
34
+ "$ref": "#/$defs/state"
35
+ }
36
+ },
37
+ "launch_watch": {
38
+ "type": "object",
39
+ "description": "Launch-watch windows: wait start_timeout_ms (default 60000) for the wrapper to start, then timeout_ms (default 4000) in which an immediate agent exit fails the launch.",
40
+ "properties": {
41
+ "timeout_ms": {
42
+ "type": "integer",
43
+ "minimum": 0
44
+ },
45
+ "start_timeout_ms": {
46
+ "type": "integer",
47
+ "minimum": 0
48
+ },
49
+ "poll_ms": {
50
+ "type": "integer",
51
+ "minimum": 0
52
+ }
53
+ },
54
+ "additionalProperties": false
55
+ },
56
+ "adopt_timeout_ms": {
57
+ "type": "integer",
58
+ "minimum": 0,
59
+ "description": "How long to wait for Orca to adopt a worktree. Default 35000."
60
+ },
61
+ "worktree_dir": {
62
+ "type": "string",
63
+ "description": "Directory (relative to root, or absolute) for new worktrees. Default `.bakers-worktrees`."
64
+ },
65
+ "base_branch": {
66
+ "type": "string",
67
+ "description": "Base ref for new branches. Default: the upstream of the root's HEAD."
68
+ },
69
+ "auto_setup_merge": {
70
+ "type": "boolean",
71
+ "description": "`true` leaves Git's branch.autoSetupMerge alone. Default `false`."
72
+ }
73
+ },
74
+ "additionalProperties": false,
75
+ "$defs": {
76
+ "state": {
77
+ "type": "object",
78
+ "properties": {
79
+ "tab_label": {
80
+ "type": "string",
81
+ "pattern": "\\{identifier\\}",
82
+ "description": "Terminal title template; must contain {identifier}. Also {state}, {title}, {title_slug}, {run_uuid}, {workspace_path}."
83
+ }
84
+ },
85
+ "additionalProperties": false
86
+ }
87
+ }
88
+ }
package/package.json CHANGED
@@ -1,15 +1,17 @@
1
1
  {
2
2
  "name": "@bakers-build/addon-orca",
3
- "version": "0.7.1-next.7",
3
+ "version": "0.8.1-next.1",
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.7.1-next.7",
24
- "@bakers-build/addon-workspace-git": "^0.7.1-next.7"
25
+ "@bakers-build/addon-herdr": "^0.8.1-next.1",
26
+ "@bakers-build/addon-workspace-git": "^0.8.1-next.1"
25
27
  },
26
28
  "peerDependencies": {
27
- "@bakers-build/conductor": "^0.7.1-next.7",
28
- "@bakers-build/core": "^0.7.1-next.7"
29
+ "@bakers-build/conductor": "^0.8.1-next.1",
30
+ "@bakers-build/core": "^0.8.1-next.1"
29
31
  },
30
32
  "bakersBuild": {
31
- "commit": "082d8c57436f78e751f5a9a26a4446cec42209ce",
33
+ "commit": "c4a887bee37bb2fed14bb9ba15ad0aacf0e26f7e",
32
34
  "channel": "next"
33
35
  }
34
36
  }