overlord-cli 0.2608261137.0 → 0.2608261310.0
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/connectors/adapters/antigravity/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/claude/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/codex/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/cursor/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/opencode/conformance-manifest.yaml +1 -1
- package/dist/connectors/adapters/pi/conformance-manifest.yaml +1 -1
- package/dist/index.js +123 -98
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17538,7 +17538,8 @@ var init_terminal_profile_types2 = __esm({
|
|
|
17538
17538
|
DEFAULT_OPEN_VIEWER_ON_LAUNCH = true;
|
|
17539
17539
|
DEFAULT_LAUNCH_SESSION_DEFAULTS = {
|
|
17540
17540
|
executionProvider: { ...DEFAULT_EXECUTION_PROVIDER },
|
|
17541
|
-
openViewerOnLaunch: DEFAULT_OPEN_VIEWER_ON_LAUNCH
|
|
17541
|
+
openViewerOnLaunch: DEFAULT_OPEN_VIEWER_ON_LAUNCH,
|
|
17542
|
+
worktreeBranchAutomationEnabled: false
|
|
17542
17543
|
};
|
|
17543
17544
|
LAUNCH_SESSION_METADATA_KEY = "launchSession";
|
|
17544
17545
|
}
|
|
@@ -18196,6 +18197,14 @@ function worktreeIsDirty(worktreePath) {
|
|
|
18196
18197
|
const status = runGitResult(worktreePath, ["status", "--porcelain"]);
|
|
18197
18198
|
return status.ok && status.stdout.length > 0;
|
|
18198
18199
|
}
|
|
18200
|
+
function resolveBranchCheckoutPath({ repoPath, branchName, worktreePathHint }) {
|
|
18201
|
+
if (worktreePathHint && existsSync19(worktreePathHint)) {
|
|
18202
|
+
const current = runGitResult(worktreePathHint, ["branch", "--show-current"]);
|
|
18203
|
+
if (current.ok && current.stdout === branchName)
|
|
18204
|
+
return worktreePathHint;
|
|
18205
|
+
}
|
|
18206
|
+
return worktreePathForBranch(repoPath, branchName);
|
|
18207
|
+
}
|
|
18199
18208
|
function worktreePathForBranch(repoPath, branch) {
|
|
18200
18209
|
const out = runGitResult(repoPath, ["worktree", "list", "--porcelain"]);
|
|
18201
18210
|
if (!out.ok)
|
|
@@ -18305,24 +18314,29 @@ var init_worktree_git = __esm({
|
|
|
18305
18314
|
});
|
|
18306
18315
|
|
|
18307
18316
|
// ../packages/core/dist/service/local-target/branch-actions-git.js
|
|
18308
|
-
|
|
18317
|
+
function resolveActionCheckout(input) {
|
|
18318
|
+
const path36 = resolveBranchCheckoutPath({
|
|
18319
|
+
repoPath: input.primaryRepoPath,
|
|
18320
|
+
branchName: input.branchName,
|
|
18321
|
+
worktreePathHint: input.worktreePath
|
|
18322
|
+
});
|
|
18323
|
+
if (path36)
|
|
18324
|
+
return { ok: true, path: path36 };
|
|
18325
|
+
return {
|
|
18326
|
+
ok: false,
|
|
18327
|
+
code: "BRANCH_NO_WORKTREE",
|
|
18328
|
+
message: `${input.branchName} is not checked out in any worktree of ${input.primaryRepoPath} (expected ${input.worktreePath}).`
|
|
18329
|
+
};
|
|
18330
|
+
}
|
|
18331
|
+
function isPrimaryRepo(candidate, primaryRepoPath) {
|
|
18332
|
+
return resolveRealPath(candidate) === resolveRealPath(primaryRepoPath);
|
|
18333
|
+
}
|
|
18309
18334
|
function integrateBranch(input) {
|
|
18310
|
-
const { branchName, baseBranch,
|
|
18311
|
-
|
|
18312
|
-
|
|
18313
|
-
|
|
18314
|
-
|
|
18315
|
-
message: `The branch's worktree is not present at ${worktreePath}.`
|
|
18316
|
-
};
|
|
18317
|
-
}
|
|
18318
|
-
const wtBranch = runGitResult(worktreePath, ["branch", "--show-current"]);
|
|
18319
|
-
if (!wtBranch.ok || wtBranch.stdout !== branchName) {
|
|
18320
|
-
return {
|
|
18321
|
-
ok: false,
|
|
18322
|
-
code: "BRANCH_WORKTREE_MISMATCH",
|
|
18323
|
-
message: `The worktree at ${worktreePath} is not checked out on ${branchName}.`
|
|
18324
|
-
};
|
|
18325
|
-
}
|
|
18335
|
+
const { branchName, baseBranch, primaryRepoPath } = input;
|
|
18336
|
+
const checkout = resolveActionCheckout(input);
|
|
18337
|
+
if (!checkout.ok)
|
|
18338
|
+
return checkout;
|
|
18339
|
+
const worktreePath = checkout.path;
|
|
18326
18340
|
if (worktreeIsDirty(worktreePath)) {
|
|
18327
18341
|
return {
|
|
18328
18342
|
ok: false,
|
|
@@ -18381,7 +18395,7 @@ function integrateBranch(input) {
|
|
|
18381
18395
|
};
|
|
18382
18396
|
}
|
|
18383
18397
|
function commitBranch(input) {
|
|
18384
|
-
const { branchName
|
|
18398
|
+
const { branchName } = input;
|
|
18385
18399
|
const trimmed6 = (input.message ?? "").trim();
|
|
18386
18400
|
if (!trimmed6) {
|
|
18387
18401
|
return {
|
|
@@ -18390,21 +18404,10 @@ function commitBranch(input) {
|
|
|
18390
18404
|
message: "A commit message is required."
|
|
18391
18405
|
};
|
|
18392
18406
|
}
|
|
18393
|
-
|
|
18394
|
-
|
|
18395
|
-
|
|
18396
|
-
|
|
18397
|
-
message: `The branch's worktree is not present at ${worktreePath}.`
|
|
18398
|
-
};
|
|
18399
|
-
}
|
|
18400
|
-
const wtBranch = runGitResult(worktreePath, ["branch", "--show-current"]);
|
|
18401
|
-
if (!wtBranch.ok || wtBranch.stdout !== branchName) {
|
|
18402
|
-
return {
|
|
18403
|
-
ok: false,
|
|
18404
|
-
code: "BRANCH_WORKTREE_MISMATCH",
|
|
18405
|
-
message: `The worktree at ${worktreePath} is not checked out on ${branchName}.`
|
|
18406
|
-
};
|
|
18407
|
-
}
|
|
18407
|
+
const checkout = resolveActionCheckout(input);
|
|
18408
|
+
if (!checkout.ok)
|
|
18409
|
+
return checkout;
|
|
18410
|
+
const worktreePath = checkout.path;
|
|
18408
18411
|
if (!worktreeIsDirty(worktreePath)) {
|
|
18409
18412
|
return {
|
|
18410
18413
|
ok: false,
|
|
@@ -18434,7 +18437,7 @@ function commitBranch(input) {
|
|
|
18434
18437
|
return { ok: true, summary: `Committed changes on ${branchName}.` };
|
|
18435
18438
|
}
|
|
18436
18439
|
function pushParent(input) {
|
|
18437
|
-
const { branchName, baseBranch,
|
|
18440
|
+
const { branchName, baseBranch, primaryRepoPath } = input;
|
|
18438
18441
|
const repo = worktreePathForBranch(primaryRepoPath, baseBranch) ?? primaryRepoPath;
|
|
18439
18442
|
const push = runGitResult(repo, ["push", "origin", baseBranch]);
|
|
18440
18443
|
if (!push.ok) {
|
|
@@ -18446,7 +18449,12 @@ function pushParent(input) {
|
|
|
18446
18449
|
};
|
|
18447
18450
|
}
|
|
18448
18451
|
let summary = `Pushed ${baseBranch} to origin.`;
|
|
18449
|
-
|
|
18452
|
+
const worktreePath = resolveBranchCheckoutPath({
|
|
18453
|
+
repoPath: primaryRepoPath,
|
|
18454
|
+
branchName,
|
|
18455
|
+
worktreePathHint: input.worktreePath
|
|
18456
|
+
});
|
|
18457
|
+
if (worktreePath && !isPrimaryRepo(worktreePath, primaryRepoPath) && !worktreeIsDirty(worktreePath)) {
|
|
18450
18458
|
if (removeGitWorktree({ primaryRepoPath, worktreePath, force: false })) {
|
|
18451
18459
|
summary += ` Removed the merged worktree for ${branchName}.`;
|
|
18452
18460
|
}
|
|
@@ -18454,8 +18462,12 @@ function pushParent(input) {
|
|
|
18454
18462
|
return { ok: true, summary };
|
|
18455
18463
|
}
|
|
18456
18464
|
function publishBranch(input) {
|
|
18457
|
-
const { branchName,
|
|
18458
|
-
const repo =
|
|
18465
|
+
const { branchName, primaryRepoPath } = input;
|
|
18466
|
+
const repo = resolveBranchCheckoutPath({
|
|
18467
|
+
repoPath: primaryRepoPath,
|
|
18468
|
+
branchName,
|
|
18469
|
+
worktreePathHint: input.worktreePath
|
|
18470
|
+
}) ?? primaryRepoPath;
|
|
18459
18471
|
const push = runGitResult(repo, ["push", "-u", "origin", branchName]);
|
|
18460
18472
|
if (!push.ok) {
|
|
18461
18473
|
return {
|
|
@@ -18505,7 +18517,7 @@ var init_branch_status_git = __esm({
|
|
|
18505
18517
|
});
|
|
18506
18518
|
|
|
18507
18519
|
// ../packages/core/dist/service/local-target/commit-message-diff-git.js
|
|
18508
|
-
import { existsSync as
|
|
18520
|
+
import { existsSync as existsSync20 } from "node:fs";
|
|
18509
18521
|
function collectWorktreeChanges(worktreePath) {
|
|
18510
18522
|
const status = runGitResult(worktreePath, ["status", "--porcelain"]);
|
|
18511
18523
|
const diff = runGitResult(worktreePath, ["diff", "HEAD"]);
|
|
@@ -18521,7 +18533,7 @@ ${diff.stdout}`);
|
|
|
18521
18533
|
return sections.join("\n\n");
|
|
18522
18534
|
}
|
|
18523
18535
|
function gatherCommitMessageDiff(worktreePath) {
|
|
18524
|
-
if (!
|
|
18536
|
+
if (!existsSync20(worktreePath)) {
|
|
18525
18537
|
return {
|
|
18526
18538
|
ok: false,
|
|
18527
18539
|
code: "BRANCH_NO_WORKTREE",
|
|
@@ -18582,7 +18594,7 @@ var init_result = __esm({
|
|
|
18582
18594
|
});
|
|
18583
18595
|
|
|
18584
18596
|
// ../packages/core/dist/service/local-target/in-process-provider.js
|
|
18585
|
-
import { existsSync as
|
|
18597
|
+
import { existsSync as existsSync21 } from "node:fs";
|
|
18586
18598
|
function failLatchCommand({ target, error, fallback }) {
|
|
18587
18599
|
const message = error instanceof Error ? error.message : fallback;
|
|
18588
18600
|
return fail(target, error instanceof LatchSessionAbsentError ? "LATCH_SESSION_ABSENT" : "TARGET_OPERATION_FAILED", message);
|
|
@@ -18617,7 +18629,7 @@ var init_in_process_provider = __esm({
|
|
|
18617
18629
|
*/
|
|
18618
18630
|
async observeResource(input) {
|
|
18619
18631
|
const observedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
18620
|
-
const state =
|
|
18632
|
+
const state = existsSync21(input.path) ? "available" : "missing";
|
|
18621
18633
|
return ok(this.target, { state, observedAt });
|
|
18622
18634
|
}
|
|
18623
18635
|
/**
|
|
@@ -19065,7 +19077,7 @@ var init_local_target_mutation_runner = __esm({
|
|
|
19065
19077
|
|
|
19066
19078
|
// src/change-ledger.ts
|
|
19067
19079
|
import { createHash as createHash8, randomUUID as randomUUID2 } from "node:crypto";
|
|
19068
|
-
import { existsSync as
|
|
19080
|
+
import { existsSync as existsSync22, realpathSync as realpathSync4, unlinkSync as unlinkSync3 } from "node:fs";
|
|
19069
19081
|
import path21 from "node:path";
|
|
19070
19082
|
function canonicalObjectiveId(objectiveId) {
|
|
19071
19083
|
return typeof objectiveId === "string" ? objectiveId.trim() : "";
|
|
@@ -19092,7 +19104,7 @@ function readLedger(input) {
|
|
|
19092
19104
|
const expected = emptyLedger(input);
|
|
19093
19105
|
const target = ledgerPath(input);
|
|
19094
19106
|
try {
|
|
19095
|
-
if (!
|
|
19107
|
+
if (!existsSync22(target)) return expected;
|
|
19096
19108
|
const raw = readBoundedUtf8File(target, MAX_LEDGER_FILE_BYTES);
|
|
19097
19109
|
if (raw === null) return null;
|
|
19098
19110
|
const value = JSON.parse(raw);
|
|
@@ -19133,7 +19145,7 @@ function mutateLedger(input, mutation, fallback, options = {}) {
|
|
|
19133
19145
|
const target = ledgerPath(normalized);
|
|
19134
19146
|
try {
|
|
19135
19147
|
return withLocalFileLock(target, () => {
|
|
19136
|
-
if (options.requireExisting && !
|
|
19148
|
+
if (options.requireExisting && !existsSync22(target)) return fallback;
|
|
19137
19149
|
const ledger = readLedger(normalized);
|
|
19138
19150
|
if (!ledger) return fallback;
|
|
19139
19151
|
const result = mutation(ledger);
|
|
@@ -19222,7 +19234,7 @@ function compileIgnorePattern(rawPattern) {
|
|
|
19222
19234
|
}
|
|
19223
19235
|
function loadIgnoreRules(root) {
|
|
19224
19236
|
const target = path21.join(root, ".overlordignore");
|
|
19225
|
-
if (!
|
|
19237
|
+
if (!existsSync22(target)) return { rules: [], unavailable: false };
|
|
19226
19238
|
const contents = readBoundedUtf8File(target, MAX_IGNORE_FILE_BYTES);
|
|
19227
19239
|
if (contents === null) return { rules: [], unavailable: true };
|
|
19228
19240
|
const lines2 = contents.split("\n");
|
|
@@ -19250,7 +19262,7 @@ function isIgnoredPath(rules, relativePath) {
|
|
|
19250
19262
|
function canonicalCandidate(absolutePath) {
|
|
19251
19263
|
let existing = absolutePath;
|
|
19252
19264
|
const suffix = [];
|
|
19253
|
-
while (!
|
|
19265
|
+
while (!existsSync22(existing)) {
|
|
19254
19266
|
const parent = path21.dirname(existing);
|
|
19255
19267
|
if (parent === existing) return path21.resolve(absolutePath);
|
|
19256
19268
|
suffix.unshift(path21.basename(existing));
|
|
@@ -19409,7 +19421,7 @@ function removeChangeLedger(input) {
|
|
|
19409
19421
|
const target = ledgerPath(normalized);
|
|
19410
19422
|
try {
|
|
19411
19423
|
return withLocalFileLock(target, () => {
|
|
19412
|
-
if (!
|
|
19424
|
+
if (!existsSync22(target)) return true;
|
|
19413
19425
|
const ledger = readLedger(normalized);
|
|
19414
19426
|
if (!ledger) return false;
|
|
19415
19427
|
if (ledger.evidence.some((entry) => !entry.syncedAt)) return false;
|
|
@@ -19453,7 +19465,7 @@ var init_change_ledger = __esm({
|
|
|
19453
19465
|
|
|
19454
19466
|
// src/active-objective-sessions.ts
|
|
19455
19467
|
import { createHash as createHash9 } from "node:crypto";
|
|
19456
|
-
import { existsSync as
|
|
19468
|
+
import { existsSync as existsSync23, readdirSync as readdirSync4 } from "node:fs";
|
|
19457
19469
|
import path22 from "node:path";
|
|
19458
19470
|
function normalizeIdentifier(value) {
|
|
19459
19471
|
return typeof value === "string" ? value.trim() : "";
|
|
@@ -19503,7 +19515,7 @@ function readManifest2(workingDirectory) {
|
|
|
19503
19515
|
const expected = emptyManifest(workingDirectory);
|
|
19504
19516
|
try {
|
|
19505
19517
|
const target = manifestPath2(workingDirectory);
|
|
19506
|
-
if (!
|
|
19518
|
+
if (!existsSync23(target)) return expected;
|
|
19507
19519
|
const raw = readBoundedUtf8File(target, MAX_ACTIVE_SESSION_MANIFEST_BYTES);
|
|
19508
19520
|
if (raw === null) return null;
|
|
19509
19521
|
const value = JSON.parse(raw);
|
|
@@ -19639,7 +19651,7 @@ function resolveWorkingDirectoryForObjective({
|
|
|
19639
19651
|
const matches = [];
|
|
19640
19652
|
const root = path22.join(resolveGlobalDataDir(), "active-objective-sessions");
|
|
19641
19653
|
try {
|
|
19642
|
-
if (!
|
|
19654
|
+
if (!existsSync23(root)) return null;
|
|
19643
19655
|
for (const name of readdirSync4(root).slice(0, MAX_ACTIVE_SESSION_MANIFEST_FILES)) {
|
|
19644
19656
|
if (!name.endsWith(".json")) continue;
|
|
19645
19657
|
try {
|
|
@@ -19917,7 +19929,7 @@ var init_branch_planning = __esm({
|
|
|
19917
19929
|
|
|
19918
19930
|
// src/branch-preparation.ts
|
|
19919
19931
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
19920
|
-
import { existsSync as
|
|
19932
|
+
import { existsSync as existsSync24, mkdirSync as mkdirSync11, statSync as statSync6 } from "node:fs";
|
|
19921
19933
|
import os4 from "node:os";
|
|
19922
19934
|
import path25 from "node:path";
|
|
19923
19935
|
function runGit3(cwd, args, options = {}) {
|
|
@@ -19986,8 +19998,26 @@ function resolveBaseBranch(gitRoot, mission) {
|
|
|
19986
19998
|
if (checkedOut && refExists(gitRoot, checkedOut)) return checkedOut;
|
|
19987
19999
|
return repoDefaultBranch(gitRoot);
|
|
19988
20000
|
}
|
|
20001
|
+
function worktreeCheckouts(gitRoot) {
|
|
20002
|
+
const checkouts = /* @__PURE__ */ new Map();
|
|
20003
|
+
let currentPath = null;
|
|
20004
|
+
for (const line of lines(
|
|
20005
|
+
runGit3(gitRoot, ["worktree", "list", "--porcelain"], { optional: true })
|
|
20006
|
+
)) {
|
|
20007
|
+
if (line.startsWith("worktree ")) {
|
|
20008
|
+
currentPath = line.slice("worktree ".length);
|
|
20009
|
+
} else if (line.startsWith("branch ") && currentPath) {
|
|
20010
|
+
const branch = line.replace(/^branch refs\/heads\//, "");
|
|
20011
|
+
if (branch && !checkouts.has(branch)) checkouts.set(branch, currentPath);
|
|
20012
|
+
}
|
|
20013
|
+
}
|
|
20014
|
+
return checkouts;
|
|
20015
|
+
}
|
|
19989
20016
|
function currentWorktrees(gitRoot) {
|
|
19990
|
-
return
|
|
20017
|
+
return [...worktreeCheckouts(gitRoot).keys()];
|
|
20018
|
+
}
|
|
20019
|
+
function existingCheckout(gitRoot, branch) {
|
|
20020
|
+
return worktreeCheckouts(gitRoot).get(branch) ?? null;
|
|
19991
20021
|
}
|
|
19992
20022
|
function revParse(gitRoot, ref) {
|
|
19993
20023
|
return runGit3(gitRoot, ["rev-parse", "--verify", "--quiet", `${ref}^{commit}`], {
|
|
@@ -20089,7 +20119,7 @@ function ensureBranchRef(gitRoot, decision) {
|
|
|
20089
20119
|
function ensureWorktree(gitRoot, decision) {
|
|
20090
20120
|
ensureBranchRef(gitRoot, decision);
|
|
20091
20121
|
mkdirSync11(path25.dirname(decision.worktreePath), { recursive: true });
|
|
20092
|
-
if (
|
|
20122
|
+
if (existsSync24(decision.worktreePath)) {
|
|
20093
20123
|
if (!statSync6(decision.worktreePath).isDirectory()) {
|
|
20094
20124
|
throw new Error(`Worktree path exists and is not a directory: ${decision.worktreePath}`);
|
|
20095
20125
|
}
|
|
@@ -20102,30 +20132,32 @@ function ensureWorktree(gitRoot, decision) {
|
|
|
20102
20132
|
`Worktree path is checked out on ${existingBranch}, expected ${decision.branch}: ${decision.worktreePath}`
|
|
20103
20133
|
);
|
|
20104
20134
|
}
|
|
20105
|
-
return;
|
|
20135
|
+
return decision.worktreePath;
|
|
20106
20136
|
}
|
|
20107
20137
|
runGit3(gitRoot, ["worktree", "prune"], { optional: true });
|
|
20108
20138
|
if (decision.action === "reuse") {
|
|
20139
|
+
const checkout = existingCheckout(gitRoot, decision.branch);
|
|
20140
|
+
if (checkout) return checkout;
|
|
20109
20141
|
runGit3(gitRoot, ["worktree", "add", decision.worktreePath, decision.branch]);
|
|
20110
|
-
return;
|
|
20142
|
+
return decision.worktreePath;
|
|
20111
20143
|
}
|
|
20112
20144
|
runGit3(gitRoot, ["worktree", "add", "-b", decision.branch, decision.worktreePath, decision.from]);
|
|
20145
|
+
return decision.worktreePath;
|
|
20113
20146
|
}
|
|
20114
20147
|
function ensureBranchCheckout(gitRoot, decision) {
|
|
20115
20148
|
ensureBranchRef(gitRoot, decision);
|
|
20149
|
+
const checkout = existingCheckout(gitRoot, decision.branch);
|
|
20150
|
+
if (checkout) return checkout;
|
|
20116
20151
|
const exists = runGit3(gitRoot, ["rev-parse", "--verify", "--quiet", decision.branch], {
|
|
20117
20152
|
optional: true
|
|
20118
20153
|
});
|
|
20119
|
-
if (!exists) {
|
|
20120
|
-
if (decision.action === "reuse") {
|
|
20121
|
-
runGit3(gitRoot, ["checkout", decision.branch]);
|
|
20122
|
-
return;
|
|
20123
|
-
}
|
|
20154
|
+
if (!exists && decision.action !== "reuse") {
|
|
20124
20155
|
runGit3(gitRoot, ["branch", decision.branch, decision.from]);
|
|
20125
20156
|
}
|
|
20126
20157
|
runGit3(gitRoot, ["checkout", decision.branch]);
|
|
20158
|
+
return gitRoot;
|
|
20127
20159
|
}
|
|
20128
|
-
function resolveBranchDecision(mission,
|
|
20160
|
+
function resolveBranchDecision(mission, automationEnabled) {
|
|
20129
20161
|
const branch = mission.branch;
|
|
20130
20162
|
if (branch && typeof branch.willPrepareBranch === "boolean" && typeof branch.willUseWorktree === "boolean") {
|
|
20131
20163
|
return {
|
|
@@ -20135,8 +20167,8 @@ function resolveBranchDecision(mission, workspaceAutomationEnabled) {
|
|
|
20135
20167
|
}
|
|
20136
20168
|
const raw = branch?.worktreePreference;
|
|
20137
20169
|
const preference = raw === "worktree" || raw === "branch" ? raw : null;
|
|
20138
|
-
const willPrepareBranch = preference === "worktree" || preference === "branch" || preference === null &&
|
|
20139
|
-
const willUseWorktree = preference === "worktree" || preference === null &&
|
|
20170
|
+
const willPrepareBranch = preference === "worktree" || preference === "branch" || preference === null && automationEnabled;
|
|
20171
|
+
const willUseWorktree = preference === "worktree" || preference === null && automationEnabled;
|
|
20140
20172
|
return { willPrepareBranch, willUseWorktree };
|
|
20141
20173
|
}
|
|
20142
20174
|
function resolveLaunchResourceKey({
|
|
@@ -20213,7 +20245,7 @@ async function prepareMissionBranch({
|
|
|
20213
20245
|
);
|
|
20214
20246
|
const { willPrepareBranch, willUseWorktree } = resolveBranchDecision(
|
|
20215
20247
|
mission,
|
|
20216
|
-
options.
|
|
20248
|
+
options.automationEnabled
|
|
20217
20249
|
);
|
|
20218
20250
|
const overrideFlag = options.overrideBranch?.trim() || null;
|
|
20219
20251
|
const prepareBranch = willPrepareBranch || Boolean(overrideFlag);
|
|
@@ -20243,13 +20275,13 @@ async function prepareMissionBranch({
|
|
|
20243
20275
|
});
|
|
20244
20276
|
const isolated = Boolean(isolation) && !overrideBranch;
|
|
20245
20277
|
if (useWorktree) {
|
|
20246
|
-
ensureWorktree(gitRoot, decision);
|
|
20278
|
+
const worktreePath = ensureWorktree(gitRoot, decision);
|
|
20247
20279
|
return {
|
|
20248
|
-
workingDirectory:
|
|
20280
|
+
workingDirectory: worktreePath,
|
|
20249
20281
|
branchAutomation: {
|
|
20250
20282
|
branchName: decision.branch,
|
|
20251
20283
|
baseBranch: decision.baseBranch,
|
|
20252
|
-
worktreePath
|
|
20284
|
+
worktreePath,
|
|
20253
20285
|
resourceKey,
|
|
20254
20286
|
action: decision.action,
|
|
20255
20287
|
cycle: decision.cycle,
|
|
@@ -20257,13 +20289,13 @@ async function prepareMissionBranch({
|
|
|
20257
20289
|
}
|
|
20258
20290
|
};
|
|
20259
20291
|
}
|
|
20260
|
-
ensureBranchCheckout(gitRoot, decision);
|
|
20292
|
+
const checkoutPath = ensureBranchCheckout(gitRoot, decision);
|
|
20261
20293
|
return {
|
|
20262
|
-
workingDirectory:
|
|
20294
|
+
workingDirectory: checkoutPath,
|
|
20263
20295
|
branchAutomation: {
|
|
20264
20296
|
branchName: decision.branch,
|
|
20265
20297
|
baseBranch: decision.baseBranch,
|
|
20266
|
-
worktreePath:
|
|
20298
|
+
worktreePath: checkoutPath,
|
|
20267
20299
|
resourceKey,
|
|
20268
20300
|
action: decision.action,
|
|
20269
20301
|
cycle: decision.cycle,
|
|
@@ -21696,7 +21728,7 @@ var init_launch = __esm({
|
|
|
21696
21728
|
});
|
|
21697
21729
|
|
|
21698
21730
|
// src/launch-bootstrap.ts
|
|
21699
|
-
import { existsSync as
|
|
21731
|
+
import { existsSync as existsSync25, readdirSync as readdirSync5, readFileSync as readFileSync16, statSync as statSync7 } from "node:fs";
|
|
21700
21732
|
import path30 from "node:path";
|
|
21701
21733
|
function firstCapture(match) {
|
|
21702
21734
|
if (!match) return null;
|
|
@@ -21719,7 +21751,7 @@ function recoverLaunchBootstrapFromProjectTmp({
|
|
|
21719
21751
|
const trimmedMission = missionId.trim();
|
|
21720
21752
|
if (!trimmedMission) return empty;
|
|
21721
21753
|
const tmpDir = projectTmpDir(workingDirectory);
|
|
21722
|
-
if (!
|
|
21754
|
+
if (!existsSync25(tmpDir)) return empty;
|
|
21723
21755
|
const prefix = `launch-${safeMissionPart(trimmedMission)}-`;
|
|
21724
21756
|
let newest = null;
|
|
21725
21757
|
try {
|
|
@@ -22703,7 +22735,7 @@ var init_resource_observations = __esm({
|
|
|
22703
22735
|
|
|
22704
22736
|
// src/runner-identity.ts
|
|
22705
22737
|
import { randomUUID as randomUUID3 } from "node:crypto";
|
|
22706
|
-
import { existsSync as
|
|
22738
|
+
import { existsSync as existsSync26, mkdirSync as mkdirSync12, readFileSync as readFileSync18, writeFileSync as writeFileSync11 } from "node:fs";
|
|
22707
22739
|
import { hostname as hostname4 } from "node:os";
|
|
22708
22740
|
import path32 from "node:path";
|
|
22709
22741
|
function envValue(name) {
|
|
@@ -22717,7 +22749,7 @@ function resolveRunnerInstanceId(dataDir = resolveGlobalDataDir()) {
|
|
|
22717
22749
|
const pinned = envValue("OVERLORD_RUNNER_INSTANCE_ID");
|
|
22718
22750
|
if (pinned) return pinned;
|
|
22719
22751
|
const statePath = runnerInstanceStatePath(dataDir);
|
|
22720
|
-
if (
|
|
22752
|
+
if (existsSync26(statePath)) {
|
|
22721
22753
|
try {
|
|
22722
22754
|
const parsed = JSON.parse(readFileSync18(statePath, "utf8"));
|
|
22723
22755
|
if (typeof parsed.runnerInstanceId === "string" && parsed.runnerInstanceId.trim()) {
|
|
@@ -22773,7 +22805,7 @@ var init_runner_identity = __esm({
|
|
|
22773
22805
|
import { execFile as execFile2 } from "node:child_process";
|
|
22774
22806
|
import {
|
|
22775
22807
|
chmodSync as chmodSync6,
|
|
22776
|
-
existsSync as
|
|
22808
|
+
existsSync as existsSync27,
|
|
22777
22809
|
mkdirSync as mkdirSync13,
|
|
22778
22810
|
readFileSync as readFileSync19,
|
|
22779
22811
|
rmSync as rmSync5,
|
|
@@ -22839,7 +22871,7 @@ function runnerServiceStatePath(dataDir = resolveGlobalDataDir()) {
|
|
|
22839
22871
|
}
|
|
22840
22872
|
function readRunnerServiceState(dataDir = resolveGlobalDataDir()) {
|
|
22841
22873
|
const filePath = runnerServiceStatePath(dataDir);
|
|
22842
|
-
if (!
|
|
22874
|
+
if (!existsSync27(filePath)) return emptyRunnerServiceState();
|
|
22843
22875
|
try {
|
|
22844
22876
|
const parsed = JSON.parse(readFileSync19(filePath, "utf8"));
|
|
22845
22877
|
return { ...emptyRunnerServiceState(), ...parsed };
|
|
@@ -22864,7 +22896,7 @@ function applyPollJitter(intervalMs, random = Math.random) {
|
|
|
22864
22896
|
function resolveOverlordAppInvocation({
|
|
22865
22897
|
platform: platform2 = process.platform,
|
|
22866
22898
|
homedir: homedir2 = os5.homedir(),
|
|
22867
|
-
exists =
|
|
22899
|
+
exists = existsSync27
|
|
22868
22900
|
} = {}) {
|
|
22869
22901
|
if (platform2 !== "darwin") return null;
|
|
22870
22902
|
const appDirs = [
|
|
@@ -22912,7 +22944,7 @@ function parseLaunchdEnvPath(plist) {
|
|
|
22912
22944
|
return match?.[1] ?? null;
|
|
22913
22945
|
}
|
|
22914
22946
|
function inspectInstalledLaunchdPlist(plistPath) {
|
|
22915
|
-
if (!
|
|
22947
|
+
if (!existsSync27(plistPath)) return { processType: null, path: null };
|
|
22916
22948
|
try {
|
|
22917
22949
|
const plist = readFileSync19(plistPath, "utf8");
|
|
22918
22950
|
return {
|
|
@@ -23143,10 +23175,10 @@ var init_runner_service = __esm({
|
|
|
23143
23175
|
`launchctl still reports ${LAUNCHD_LABEL} as loaded after bootout; left ${this.unitPath()} in place so the service can be repaired with \`ovld runner service restart\`.`
|
|
23144
23176
|
);
|
|
23145
23177
|
}
|
|
23146
|
-
if (
|
|
23178
|
+
if (existsSync27(this.unitPath())) rmSync5(this.unitPath());
|
|
23147
23179
|
}
|
|
23148
23180
|
async status() {
|
|
23149
|
-
const installed =
|
|
23181
|
+
const installed = existsSync27(this.unitPath());
|
|
23150
23182
|
try {
|
|
23151
23183
|
const { stdout } = await this.exec(["list"]);
|
|
23152
23184
|
const line = stdout.split("\n").find((row) => row.includes(LAUNCHD_LABEL));
|
|
@@ -23189,14 +23221,14 @@ var init_runner_service = __esm({
|
|
|
23189
23221
|
await runCommand("systemctl", ["--user", "disable", this.identifier]);
|
|
23190
23222
|
} catch {
|
|
23191
23223
|
}
|
|
23192
|
-
if (
|
|
23224
|
+
if (existsSync27(this.unitPath())) rmSync5(this.unitPath());
|
|
23193
23225
|
try {
|
|
23194
23226
|
await runCommand("systemctl", ["--user", "daemon-reload"]);
|
|
23195
23227
|
} catch {
|
|
23196
23228
|
}
|
|
23197
23229
|
}
|
|
23198
23230
|
async status() {
|
|
23199
|
-
const installed =
|
|
23231
|
+
const installed = existsSync27(this.unitPath());
|
|
23200
23232
|
try {
|
|
23201
23233
|
const { stdout } = await runCommand("systemctl", ["--user", "is-active", this.identifier]);
|
|
23202
23234
|
return { installed, running: stdout.trim() === "active" ? "running" : "stopped" };
|
|
@@ -23263,7 +23295,7 @@ var init_select_prompt = __esm({
|
|
|
23263
23295
|
|
|
23264
23296
|
// src/session-key.ts
|
|
23265
23297
|
import { createHash as createHash10 } from "node:crypto";
|
|
23266
|
-
import { existsSync as
|
|
23298
|
+
import { existsSync as existsSync28, opendirSync, rmSync as rmSync6 } from "node:fs";
|
|
23267
23299
|
import path34 from "node:path";
|
|
23268
23300
|
function sessionKeyCachePath({
|
|
23269
23301
|
missionId,
|
|
@@ -23277,7 +23309,7 @@ function sessionKeyCachePath({
|
|
|
23277
23309
|
}
|
|
23278
23310
|
function readSessionKeyFile(filePath) {
|
|
23279
23311
|
try {
|
|
23280
|
-
if (!
|
|
23312
|
+
if (!existsSync28(filePath)) return void 0;
|
|
23281
23313
|
const contents = readBoundedUtf8File(filePath, MAX_SESSION_KEY_CACHE_FILE_BYTES);
|
|
23282
23314
|
if (contents === null) return void 0;
|
|
23283
23315
|
const raw = JSON.parse(contents);
|
|
@@ -23330,7 +23362,7 @@ function clearCachedSessionKey({
|
|
|
23330
23362
|
const trimmedSessionKey = sessionKey?.trim();
|
|
23331
23363
|
if (trimmedSessionKey) {
|
|
23332
23364
|
const cacheDir = path34.join(resolveGlobalDataDir(), "protocol-session-keys");
|
|
23333
|
-
if (
|
|
23365
|
+
if (existsSync28(cacheDir)) {
|
|
23334
23366
|
const directory = opendirSync(cacheDir);
|
|
23335
23367
|
let scanned = 0;
|
|
23336
23368
|
let incomplete = false;
|
|
@@ -23362,7 +23394,7 @@ function clearCachedSessionKey({
|
|
|
23362
23394
|
}
|
|
23363
23395
|
}
|
|
23364
23396
|
for (const filePath of files) {
|
|
23365
|
-
if (
|
|
23397
|
+
if (existsSync28(filePath)) rmSync6(filePath);
|
|
23366
23398
|
}
|
|
23367
23399
|
} catch {
|
|
23368
23400
|
}
|
|
@@ -23595,11 +23627,10 @@ function parseLaunchEnvVarsValue(value) {
|
|
|
23595
23627
|
}
|
|
23596
23628
|
return vars;
|
|
23597
23629
|
}
|
|
23598
|
-
async function readWorktreeBranchAutomationEnabled(runtime
|
|
23630
|
+
async function readWorktreeBranchAutomationEnabled(runtime) {
|
|
23599
23631
|
try {
|
|
23600
23632
|
const settings = await fetchLaunchSettings({
|
|
23601
|
-
backend: runtime.backend
|
|
23602
|
-
workspaceId
|
|
23633
|
+
backend: runtime.backend
|
|
23603
23634
|
});
|
|
23604
23635
|
return settings.worktreeBranchAutomationEnabled === true;
|
|
23605
23636
|
} catch (error) {
|
|
@@ -24397,10 +24428,7 @@ async function runManagementCommand({
|
|
|
24397
24428
|
missionId,
|
|
24398
24429
|
workingDirectory,
|
|
24399
24430
|
objectiveId: objectiveId ?? void 0,
|
|
24400
|
-
|
|
24401
|
-
scopedRuntime,
|
|
24402
|
-
missionWorkspaceId
|
|
24403
|
-
),
|
|
24431
|
+
automationEnabled: await readWorktreeBranchAutomationEnabled(scopedRuntime),
|
|
24404
24432
|
dryRun,
|
|
24405
24433
|
overrideBranch: flagValue(parsed.flags, "--branch"),
|
|
24406
24434
|
noWorktree: flagBoolean(parsed.flags, "--no-worktree")
|
|
@@ -24797,10 +24825,7 @@ The runner will not register a target for you \u2014 declare this machine first,
|
|
|
24797
24825
|
missionId,
|
|
24798
24826
|
workingDirectory: String(requestRecord.workingDirectory ?? process.cwd()),
|
|
24799
24827
|
objectiveId: String(requestRecord.objectiveId ?? ""),
|
|
24800
|
-
|
|
24801
|
-
runtime,
|
|
24802
|
-
requestWorkspaceId
|
|
24803
|
-
),
|
|
24828
|
+
automationEnabled: await readWorktreeBranchAutomationEnabled(runtime),
|
|
24804
24829
|
dryRun,
|
|
24805
24830
|
overrideBranch: flagValue(parsed.flags, "--branch"),
|
|
24806
24831
|
noWorktree: flagBoolean(parsed.flags, "--no-worktree")
|