@bakers-build/addon-herdr 0.6.1-next.2 → 0.6.1-next.3
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/workspace.d.ts +6 -0
- package/dist/src/workspace.js +17 -3
- package/package.json +5 -5
package/dist/src/workspace.d.ts
CHANGED
|
@@ -88,6 +88,11 @@ export interface HerdrWorkspaceOptions {
|
|
|
88
88
|
execGit?: GitExec;
|
|
89
89
|
/** Optional logger for the best-effort open-layout path (defaults to noop). */
|
|
90
90
|
logger?: ConductorLogger;
|
|
91
|
+
/**
|
|
92
|
+
* Default `false`: before creating a worktree, set `branch.autoSetupMerge=false`
|
|
93
|
+
* in `root`, and give runs `push.default=current`. `true` leaves Git alone.
|
|
94
|
+
*/
|
|
95
|
+
autoSetupMerge?: boolean;
|
|
91
96
|
}
|
|
92
97
|
/** Git-safe branch validation: safe ref chars only, no leading dot, no `..`. */
|
|
93
98
|
export declare function validateBranch(branch: string): void;
|
|
@@ -162,6 +167,7 @@ export declare function herdrWorkspace(opts?: {
|
|
|
162
167
|
worktreeDir?: string;
|
|
163
168
|
baseBranch?: string;
|
|
164
169
|
open?: OpenLayout;
|
|
170
|
+
autoSetupMerge?: boolean;
|
|
165
171
|
/** Overrideable git exec for root derivation (tests). */
|
|
166
172
|
execGit?: RootGitExec;
|
|
167
173
|
/** Overrideable herdr exec (tests) — sibling of `execGit`. */
|
package/dist/src/workspace.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { resolve } from 'node:path';
|
|
2
|
-
import { loadInstructions } from '@bakers-build/addon-workspace-git';
|
|
2
|
+
import { loadInstructions, runBranchGit, } from '@bakers-build/addon-workspace-git';
|
|
3
3
|
import { exec } from '@bakers-build/core';
|
|
4
4
|
import { herdrAgentHost } from './agents.js';
|
|
5
5
|
import { renderTemplate } from './config.js';
|
|
@@ -145,6 +145,9 @@ export class HerdrWorkspace {
|
|
|
145
145
|
throw new Error('herdr workspace requires a branch name');
|
|
146
146
|
}
|
|
147
147
|
validateBranch(branch);
|
|
148
|
+
const extra = this.options.autoSetupMerge
|
|
149
|
+
? {}
|
|
150
|
+
: { env: await runBranchGit(this.root, this.logger) };
|
|
148
151
|
const worktrees = parseWorktreeList(await this.execHerdr(['worktree', 'list', '--cwd', this.root, '--json']));
|
|
149
152
|
const existing = worktrees.find((w) => w.branch === branch);
|
|
150
153
|
if (existing) {
|
|
@@ -165,7 +168,12 @@ export class HerdrWorkspace {
|
|
|
165
168
|
'--json',
|
|
166
169
|
]), 'worktree open');
|
|
167
170
|
}
|
|
168
|
-
return {
|
|
171
|
+
return {
|
|
172
|
+
path,
|
|
173
|
+
instructions: loadInstructions(path),
|
|
174
|
+
created: false,
|
|
175
|
+
...extra,
|
|
176
|
+
};
|
|
169
177
|
}
|
|
170
178
|
// Fresh: create the git worktree + herdr workspace in one call. Base the
|
|
171
179
|
// new branch on the (freshly fetched) remote tracking branch, not the
|
|
@@ -213,7 +221,12 @@ export class HerdrWorkspace {
|
|
|
213
221
|
}
|
|
214
222
|
// The `after_create` hook is run by the executor (BB-84), not here — the
|
|
215
223
|
// workspace only reports that it created a fresh worktree.
|
|
216
|
-
return {
|
|
224
|
+
return {
|
|
225
|
+
path,
|
|
226
|
+
instructions: loadInstructions(path),
|
|
227
|
+
created: true,
|
|
228
|
+
...extra,
|
|
229
|
+
};
|
|
217
230
|
}
|
|
218
231
|
/**
|
|
219
232
|
* Apply the open layout to the root pane captured by the most recent
|
|
@@ -340,6 +353,7 @@ export function herdrWorkspace(opts = {}) {
|
|
|
340
353
|
...(opts.baseBranch ? { baseBranch: opts.baseBranch } : {}),
|
|
341
354
|
...(opts.open ? { open: opts.open } : {}),
|
|
342
355
|
...(opts.execHerdr ? { execHerdr: opts.execHerdr } : {}),
|
|
356
|
+
...(opts.autoSetupMerge ? { autoSetupMerge: true } : {}),
|
|
343
357
|
...(deps?.logger ? { logger: deps.logger } : {}),
|
|
344
358
|
});
|
|
345
359
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bakers-build/addon-herdr",
|
|
3
|
-
"version": "0.6.1-next.
|
|
3
|
+
"version": "0.6.1-next.3",
|
|
4
4
|
"description": "bakers.build herdr integration: spawn executor + per-ticket worktree workspace.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
"directory": "bakers-cli/addons/herdr"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@bakers-build/addon-workspace-git": "^0.6.1-next.
|
|
24
|
+
"@bakers-build/addon-workspace-git": "^0.6.1-next.3"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
|
-
"@bakers-build/conductor": "^0.6.1-next.
|
|
28
|
-
"@bakers-build/core": "^0.6.1-next.
|
|
27
|
+
"@bakers-build/conductor": "^0.6.1-next.3",
|
|
28
|
+
"@bakers-build/core": "^0.6.1-next.3"
|
|
29
29
|
},
|
|
30
30
|
"bakersBuild": {
|
|
31
|
-
"commit": "
|
|
31
|
+
"commit": "1531a0bb0d34ccf6b54a051fcb8b016902c31f0f",
|
|
32
32
|
"channel": "next"
|
|
33
33
|
}
|
|
34
34
|
}
|