@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.
- package/dist/src/config.d.ts +6 -10
- package/dist/src/config.js +3 -3
- package/dist/src/index.js +6 -6
- package/dist/src/preset.d.ts +1 -1
- package/dist/src/preset.js +1 -1
- package/dist/src/workspace.d.ts +5 -5
- package/dist/src/workspace.js +6 -6
- package/options.schema.json +88 -0
- package/package.json +10 -8
package/dist/src/config.d.ts
CHANGED
|
@@ -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}`, `{
|
|
7
|
-
* `{
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
package/dist/src/config.js
CHANGED
|
@@ -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]?.
|
|
4
|
-
options.default?.
|
|
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
|
|
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
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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.
|
|
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
|
-
|
|
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.
|
|
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]) => {
|
package/dist/src/preset.d.ts
CHANGED
|
@@ -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
|
|
3
|
+
export declare const worktrees: Preset['worktrees'];
|
|
4
4
|
export declare const scopes: Preset['scopes'];
|
package/dist/src/preset.js
CHANGED
package/dist/src/workspace.d.ts
CHANGED
|
@@ -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 `{
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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;
|
package/dist/src/workspace.js
CHANGED
|
@@ -236,7 +236,7 @@ export class OrcaWorkspace {
|
|
|
236
236
|
}
|
|
237
237
|
export function orcaWorkspace(opts = {}) {
|
|
238
238
|
return {
|
|
239
|
-
kind: '
|
|
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.
|
|
250
|
-
...(opts.
|
|
251
|
-
...(opts.
|
|
252
|
-
? { adoptTimeoutMs: opts.
|
|
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.
|
|
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.
|
|
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.
|
|
24
|
-
"@bakers-build/addon-workspace-git": "^0.
|
|
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.
|
|
28
|
-
"@bakers-build/core": "^0.
|
|
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": "
|
|
33
|
+
"commit": "c4a887bee37bb2fed14bb9ba15ad0aacf0e26f7e",
|
|
32
34
|
"channel": "next"
|
|
33
35
|
}
|
|
34
36
|
}
|