usebeeline 0.1.6 → 0.1.8
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/usebeeline.mjs +129 -57
- package/package.json +1 -1
package/dist/usebeeline.mjs
CHANGED
|
@@ -37962,7 +37962,7 @@ import { createHash as createHash13 } from "node:crypto";
|
|
|
37962
37962
|
import { existsSync as existsSync8, mkdirSync as mkdirSync3 } from "node:fs";
|
|
37963
37963
|
import { mkdir as mkdir26, readdir as readdir9, realpath as realpath2, rm as rm14 } from "node:fs/promises";
|
|
37964
37964
|
import { dirname as dirname26, relative as relative3, resolve as resolve35, sep as sep2 } from "node:path";
|
|
37965
|
-
import { promisify as
|
|
37965
|
+
import { promisify as promisify8 } from "node:util";
|
|
37966
37966
|
|
|
37967
37967
|
// apps/body/dist/grant-runner.js
|
|
37968
37968
|
import { execFile as execFile8 } from "node:child_process";
|
|
@@ -38705,7 +38705,7 @@ import { createHash as createHash12 } from "node:crypto";
|
|
|
38705
38705
|
import { mkdir as mkdir25, readFile as readFile26, writeFile as writeFile20 } from "node:fs/promises";
|
|
38706
38706
|
import { homedir as homedir17, hostname as hostname3 } from "node:os";
|
|
38707
38707
|
import { dirname as dirname25, join as join18, resolve as resolve34 } from "node:path";
|
|
38708
|
-
import { promisify as
|
|
38708
|
+
import { promisify as promisify7 } from "node:util";
|
|
38709
38709
|
|
|
38710
38710
|
// apps/body/dist/agent-command-catalog.js
|
|
38711
38711
|
function agentCommandCatalogPublisher(input) {
|
|
@@ -39587,13 +39587,62 @@ export default async function (pi) {
|
|
|
39587
39587
|
|
|
39588
39588
|
// apps/body/dist/corner-branch-sync.js
|
|
39589
39589
|
import { execFile as execFile10 } from "node:child_process";
|
|
39590
|
-
|
|
39591
|
-
var
|
|
39590
|
+
var CORNER_GIT_SYNC_TIMEOUT_MS = 12e4;
|
|
39591
|
+
var CORNER_GIT_SYNC_KILL_GRACE_MS = 1e3;
|
|
39592
|
+
var CornerGitSyncInterruptedError = class extends Error {
|
|
39593
|
+
};
|
|
39592
39594
|
async function syncCornerBranch(input) {
|
|
39593
|
-
const git =
|
|
39594
|
-
|
|
39595
|
-
|
|
39596
|
-
|
|
39595
|
+
const git = async (args) => {
|
|
39596
|
+
const controller = new AbortController();
|
|
39597
|
+
const signal = input.signal ? AbortSignal.any([input.signal, controller.signal]) : controller.signal;
|
|
39598
|
+
const timer = setTimeout(() => controller.abort(), CORNER_GIT_SYNC_TIMEOUT_MS);
|
|
39599
|
+
const interrupted = () => new CornerGitSyncInterruptedError(`corner git sync ${args[0]} ${controller.signal.aborted ? `timed out after ${CORNER_GIT_SYNC_TIMEOUT_MS}ms` : "stopped"}`);
|
|
39600
|
+
try {
|
|
39601
|
+
if (signal.aborted)
|
|
39602
|
+
throw interrupted();
|
|
39603
|
+
return await new Promise((resolve42, reject) => {
|
|
39604
|
+
let killTimer;
|
|
39605
|
+
let stdout6 = "";
|
|
39606
|
+
let failure = null;
|
|
39607
|
+
const child = input.git ? void 0 : execFile10("git", ["-C", input.worktreePath, ...args], {
|
|
39608
|
+
...input.env ? { env: input.env } : {},
|
|
39609
|
+
signal,
|
|
39610
|
+
maxBuffer: 4 * 1024 * 1024
|
|
39611
|
+
}, (error, output) => {
|
|
39612
|
+
failure = error;
|
|
39613
|
+
stdout6 = output;
|
|
39614
|
+
});
|
|
39615
|
+
const abort = () => {
|
|
39616
|
+
if (!child) {
|
|
39617
|
+
cleanup();
|
|
39618
|
+
reject(interrupted());
|
|
39619
|
+
} else {
|
|
39620
|
+
killTimer = setTimeout(() => child.kill("SIGKILL"), CORNER_GIT_SYNC_KILL_GRACE_MS);
|
|
39621
|
+
}
|
|
39622
|
+
};
|
|
39623
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
39624
|
+
const cleanup = () => {
|
|
39625
|
+
signal.removeEventListener("abort", abort);
|
|
39626
|
+
if (killTimer)
|
|
39627
|
+
clearTimeout(killTimer);
|
|
39628
|
+
};
|
|
39629
|
+
if (child)
|
|
39630
|
+
child.once("close", () => {
|
|
39631
|
+
cleanup();
|
|
39632
|
+
if (signal.aborted)
|
|
39633
|
+
reject(interrupted());
|
|
39634
|
+
else if (failure)
|
|
39635
|
+
reject(failure);
|
|
39636
|
+
else
|
|
39637
|
+
resolve42(stdout6);
|
|
39638
|
+
});
|
|
39639
|
+
else
|
|
39640
|
+
input.git(args).then(resolve42, reject).finally(cleanup);
|
|
39641
|
+
});
|
|
39642
|
+
} finally {
|
|
39643
|
+
clearTimeout(timer);
|
|
39644
|
+
}
|
|
39645
|
+
};
|
|
39597
39646
|
const remoteRef = `refs/remotes/origin/${input.featureBranch}`;
|
|
39598
39647
|
const fetched = await git([
|
|
39599
39648
|
"fetch",
|
|
@@ -39619,14 +39668,23 @@ async function syncCornerBranch(input) {
|
|
|
39619
39668
|
try {
|
|
39620
39669
|
await git(behind ? ["merge", "--ff-only", remote] : ["rebase", remote]);
|
|
39621
39670
|
return behind ? "fast-forwarded" : "rebased";
|
|
39622
|
-
} catch {
|
|
39623
|
-
|
|
39671
|
+
} catch (error) {
|
|
39672
|
+
if (error instanceof CornerGitSyncInterruptedError)
|
|
39673
|
+
throw error;
|
|
39674
|
+
await git(["rebase", "--abort"]).catch((error2) => {
|
|
39675
|
+
if (error2 instanceof CornerGitSyncInterruptedError)
|
|
39676
|
+
throw error2;
|
|
39677
|
+
});
|
|
39624
39678
|
await git(["reset", "--hard", remote]);
|
|
39625
39679
|
return "realigned";
|
|
39626
39680
|
}
|
|
39627
39681
|
}
|
|
39628
39682
|
async function contains(git, head, ancestor) {
|
|
39629
|
-
return git(["merge-base", "--is-ancestor", ancestor, head]).then(() => true, () =>
|
|
39683
|
+
return git(["merge-base", "--is-ancestor", ancestor, head]).then(() => true, (error) => {
|
|
39684
|
+
if (error instanceof CornerGitSyncInterruptedError)
|
|
39685
|
+
throw error;
|
|
39686
|
+
return false;
|
|
39687
|
+
});
|
|
39630
39688
|
}
|
|
39631
39689
|
|
|
39632
39690
|
// apps/body/dist/room-session.js
|
|
@@ -39928,8 +39986,8 @@ async function awaitInstitutionalContext(fetch2, log2 = console.warn, budgetMs =
|
|
|
39928
39986
|
import { execFile as execFile11 } from "node:child_process";
|
|
39929
39987
|
import { access as access2, appendFile, mkdir as mkdir20, readFile as readFile23 } from "node:fs/promises";
|
|
39930
39988
|
import { dirname as dirname22, isAbsolute as isAbsolute3, resolve as resolve30 } from "node:path";
|
|
39931
|
-
import { promisify as
|
|
39932
|
-
var
|
|
39989
|
+
import { promisify as promisify6 } from "node:util";
|
|
39990
|
+
var execFileAsync6 = promisify6(execFile11);
|
|
39933
39991
|
var CODEGRAPH_MCP_SERVER_NAME = "codegraph";
|
|
39934
39992
|
var CODEGRAPH_INDEX_PATH = ".codegraph/codegraph.db";
|
|
39935
39993
|
var CODEGRAPH_PREPARE_TIMEOUT_MS = 12e4;
|
|
@@ -39956,7 +40014,7 @@ function codegraphFingerprintServers(config, servers, mounted = Boolean(config.c
|
|
|
39956
40014
|
}
|
|
39957
40015
|
async function isGitWorktree(cwd) {
|
|
39958
40016
|
try {
|
|
39959
|
-
const { stdout: stdout6 } = await
|
|
40017
|
+
const { stdout: stdout6 } = await execFileAsync6("git", ["rev-parse", "--show-toplevel"], {
|
|
39960
40018
|
cwd,
|
|
39961
40019
|
timeout: 1e4
|
|
39962
40020
|
});
|
|
@@ -39967,7 +40025,7 @@ async function isGitWorktree(cwd) {
|
|
|
39967
40025
|
}
|
|
39968
40026
|
async function excludeIndexFromGitStatus(cwd) {
|
|
39969
40027
|
try {
|
|
39970
|
-
const { stdout: stdout6 } = await
|
|
40028
|
+
const { stdout: stdout6 } = await execFileAsync6("git", ["rev-parse", "--git-path", "info/exclude"], {
|
|
39971
40029
|
cwd,
|
|
39972
40030
|
timeout: 1e4
|
|
39973
40031
|
});
|
|
@@ -39993,7 +40051,7 @@ async function prepareCodegraphIndex(config, cwd) {
|
|
|
39993
40051
|
const indexed = await access2(indexPath).then(() => true, () => false);
|
|
39994
40052
|
const args = indexed ? ["sync", "--quiet", cwd] : ["init", "--yes", cwd];
|
|
39995
40053
|
try {
|
|
39996
|
-
await
|
|
40054
|
+
await execFileAsync6(command, args, {
|
|
39997
40055
|
cwd,
|
|
39998
40056
|
env: { ...process.env, CODEGRAPH_TELEMETRY: "0", CODEGRAPH_NO_DAEMON: "1" },
|
|
39999
40057
|
timeout: CODEGRAPH_PREPARE_TIMEOUT_MS,
|
|
@@ -42629,7 +42687,7 @@ function describe3(error) {
|
|
|
42629
42687
|
}
|
|
42630
42688
|
|
|
42631
42689
|
// apps/body/dist/monolith-corner-turn.js
|
|
42632
|
-
var
|
|
42690
|
+
var execFileAsync7 = promisify7(execFile12);
|
|
42633
42691
|
var TOOL_ARGUMENT_MAX_BYTES = 1200;
|
|
42634
42692
|
var TOOL_OUTPUT_MAX_BYTES = 3200;
|
|
42635
42693
|
var TOOL_PATH_LIMIT = 12;
|
|
@@ -42639,8 +42697,8 @@ function isCornerChecksTurn(trigger, restates) {
|
|
|
42639
42697
|
async function cornerUndeliveredRepositoryState(worktreePath, featureBranch, targetBranch) {
|
|
42640
42698
|
try {
|
|
42641
42699
|
const [{ stdout: status }, ahead] = await Promise.all([
|
|
42642
|
-
|
|
42643
|
-
featureBranch ? firstResolvedRemoteRef(worktreePath, [featureBranch, targetBranch]).then((remoteRef) => remoteRef ?
|
|
42700
|
+
execFileAsync7("git", ["-C", worktreePath, "status", "--porcelain=v1"]),
|
|
42701
|
+
featureBranch ? firstResolvedRemoteRef(worktreePath, [featureBranch, targetBranch]).then((remoteRef) => remoteRef ? execFileAsync7("git", [
|
|
42644
42702
|
"-C",
|
|
42645
42703
|
worktreePath,
|
|
42646
42704
|
"rev-list",
|
|
@@ -42660,7 +42718,7 @@ async function firstResolvedRemoteRef(worktreePath, branches) {
|
|
|
42660
42718
|
if (!branch)
|
|
42661
42719
|
continue;
|
|
42662
42720
|
const ref = `refs/remotes/origin/${branch}`;
|
|
42663
|
-
const resolved = await
|
|
42721
|
+
const resolved = await execFileAsync7("git", ["-C", worktreePath, "rev-parse", "--verify", ref]).then(() => true).catch(() => false);
|
|
42664
42722
|
if (resolved)
|
|
42665
42723
|
return ref;
|
|
42666
42724
|
}
|
|
@@ -42815,7 +42873,7 @@ async function cornerToolActivity(call, worktreePath, requestedBy) {
|
|
|
42815
42873
|
let title = oneLine(redactToolDetail(call.title ?? "")) || `${operation} tool`;
|
|
42816
42874
|
if (isSuccessfulCommit(call)) {
|
|
42817
42875
|
try {
|
|
42818
|
-
const shown = await
|
|
42876
|
+
const shown = await execFileAsync7("git", ["-C", worktreePath, "show", "--format=%s", "--name-only", "--no-renames", "HEAD"], { maxBuffer: 1024 * 1024 });
|
|
42819
42877
|
const lines = shown.stdout.split(/\r?\n/);
|
|
42820
42878
|
const subject = oneLine(lines.shift() ?? "commit");
|
|
42821
42879
|
const files = new Set(lines.map(oneLine).filter(Boolean));
|
|
@@ -43189,8 +43247,8 @@ var MonolithCornerTurnLoop = class {
|
|
|
43189
43247
|
const repository = this.options.repository;
|
|
43190
43248
|
let githubEnv = repository ? { GH_TOKEN: repository.githubToken, GITHUB_TOKEN: repository.githubToken } : {};
|
|
43191
43249
|
if (repository && this.options.config.runtimeConfigPath && this.options.config.agentHomeRoot) {
|
|
43192
|
-
const gitBinary = (await
|
|
43193
|
-
const ghBinary = await
|
|
43250
|
+
const gitBinary = (await execFileAsync7("which", ["git"])).stdout.trim();
|
|
43251
|
+
const ghBinary = await execFileAsync7("which", ["gh"]).then((result) => result.stdout.trim()).catch(() => void 0);
|
|
43194
43252
|
githubEnv = await installCornerGitHubWrappers({
|
|
43195
43253
|
root: this.options.config.agentHomeRoot,
|
|
43196
43254
|
runtimeConfigPath: this.options.config.runtimeConfigPath,
|
|
@@ -43426,7 +43484,7 @@ var MonolithCornerTurnLoop = class {
|
|
|
43426
43484
|
this.options.api.execute("getCornerRestoreState", {
|
|
43427
43485
|
cornerId: this.options.cornerId
|
|
43428
43486
|
}),
|
|
43429
|
-
|
|
43487
|
+
execFileAsync7("git", ["-C", this.options.worktreePath, "rev-parse", "HEAD"]).then(({ stdout: stdout6 }) => stdout6.trim())
|
|
43430
43488
|
]);
|
|
43431
43489
|
const pr = restore.lifecycle?.pr;
|
|
43432
43490
|
if (restore.lifecycle?.checks !== "passing" || !pr?.number || !pr.headSha || pr.headSha !== localHead)
|
|
@@ -44064,11 +44122,25 @@ ${deviceGrantResumePrompt(grantedDevice, result.agentText)}`);
|
|
|
44064
44122
|
}
|
|
44065
44123
|
if (!token)
|
|
44066
44124
|
throw new Error("corner repository credential lookup returned no token");
|
|
44067
|
-
|
|
44068
|
-
|
|
44069
|
-
|
|
44070
|
-
|
|
44071
|
-
|
|
44125
|
+
const stop = new AbortController();
|
|
44126
|
+
let watchStop;
|
|
44127
|
+
const checkStop = () => {
|
|
44128
|
+
if (this.forcedStop || this.currentTurn && this.stoppedTurns.has(this.currentTurn.requestId))
|
|
44129
|
+
stop.abort();
|
|
44130
|
+
else
|
|
44131
|
+
watchStop = setTimeout(checkStop, 25);
|
|
44132
|
+
};
|
|
44133
|
+
checkStop();
|
|
44134
|
+
try {
|
|
44135
|
+
await syncCornerBranch({
|
|
44136
|
+
worktreePath: this.options.worktreePath,
|
|
44137
|
+
featureBranch: repository.featureBranch,
|
|
44138
|
+
env: { ...process.env, GH_TOKEN: token, GITHUB_TOKEN: token, GIT_TERMINAL_PROMPT: "0" },
|
|
44139
|
+
signal: this.options.signal ? AbortSignal.any([this.options.signal, stop.signal]) : stop.signal
|
|
44140
|
+
});
|
|
44141
|
+
} finally {
|
|
44142
|
+
clearTimeout(watchStop);
|
|
44143
|
+
}
|
|
44072
44144
|
}
|
|
44073
44145
|
async run() {
|
|
44074
44146
|
const { api, cornerId, signal, supervisor: supervisor2 } = this.options;
|
|
@@ -44671,19 +44743,19 @@ async function materializeCornerWorktree(input) {
|
|
|
44671
44743
|
await mkdir26(dirname26(path), { recursive: true, mode: 448 });
|
|
44672
44744
|
const authEnv = githubGitEnv(input.token);
|
|
44673
44745
|
if (!existsSync8(resolve35(gitCommonDir, "HEAD"))) {
|
|
44674
|
-
await
|
|
44746
|
+
await execFileAsync8("git", ["clone", "--bare", remote, gitCommonDir], {
|
|
44675
44747
|
env: authEnv,
|
|
44676
44748
|
maxBuffer: 4 * 1024 * 1024
|
|
44677
44749
|
});
|
|
44678
44750
|
}
|
|
44679
|
-
await
|
|
44751
|
+
await execFileAsync8("git", [
|
|
44680
44752
|
`--git-dir=${gitCommonDir}`,
|
|
44681
44753
|
"fetch",
|
|
44682
44754
|
"--prune",
|
|
44683
44755
|
"origin",
|
|
44684
44756
|
`+refs/heads/${input.targetBranch}:refs/remotes/origin/${input.targetBranch}`
|
|
44685
44757
|
], { env: authEnv, maxBuffer: 4 * 1024 * 1024 });
|
|
44686
|
-
const restored = await
|
|
44758
|
+
const restored = await execFileAsync8("git", [
|
|
44687
44759
|
`--git-dir=${gitCommonDir}`,
|
|
44688
44760
|
"fetch",
|
|
44689
44761
|
"origin",
|
|
@@ -44695,7 +44767,7 @@ async function materializeCornerWorktree(input) {
|
|
|
44695
44767
|
});
|
|
44696
44768
|
if (!existsSync8(resolve35(path, ".git"))) {
|
|
44697
44769
|
await rm14(path, { recursive: true, force: true });
|
|
44698
|
-
await
|
|
44770
|
+
await execFileAsync8("git", [
|
|
44699
44771
|
`--git-dir=${gitCommonDir}`,
|
|
44700
44772
|
"worktree",
|
|
44701
44773
|
"add",
|
|
@@ -44712,14 +44784,14 @@ async function materializeCornerWorktree(input) {
|
|
|
44712
44784
|
console.log(`[thin-core] corner ${input.cornerId} warm node_modules: ${seed.reason}${seed.detail ? ` (${seed.detail})` : ""}`);
|
|
44713
44785
|
}
|
|
44714
44786
|
}
|
|
44715
|
-
await
|
|
44787
|
+
await execFileAsync8("git", [
|
|
44716
44788
|
`--git-dir=${gitCommonDir}`,
|
|
44717
44789
|
"config",
|
|
44718
44790
|
"extensions.worktreeConfig",
|
|
44719
44791
|
"true"
|
|
44720
44792
|
]);
|
|
44721
|
-
await
|
|
44722
|
-
await
|
|
44793
|
+
await execFileAsync8("git", ["-C", path, "config", "--worktree", "core.bare", "false"]);
|
|
44794
|
+
await execFileAsync8("git", [
|
|
44723
44795
|
"-C",
|
|
44724
44796
|
path,
|
|
44725
44797
|
"config",
|
|
@@ -44727,7 +44799,7 @@ async function materializeCornerWorktree(input) {
|
|
|
44727
44799
|
"credential.https://github.com.helper",
|
|
44728
44800
|
"!f() { echo username=x-access-token; echo password=$GH_TOKEN; }; f"
|
|
44729
44801
|
]);
|
|
44730
|
-
await
|
|
44802
|
+
await execFileAsync8("git", [
|
|
44731
44803
|
"-C",
|
|
44732
44804
|
path,
|
|
44733
44805
|
"config",
|
|
@@ -44735,7 +44807,7 @@ async function materializeCornerWorktree(input) {
|
|
|
44735
44807
|
"user.name",
|
|
44736
44808
|
input.committer.name
|
|
44737
44809
|
]);
|
|
44738
|
-
await
|
|
44810
|
+
await execFileAsync8("git", [
|
|
44739
44811
|
"-C",
|
|
44740
44812
|
path,
|
|
44741
44813
|
"config",
|
|
@@ -44743,7 +44815,7 @@ async function materializeCornerWorktree(input) {
|
|
|
44743
44815
|
"user.email",
|
|
44744
44816
|
`${input.committer.publicKey.slice(0, 16)}@users.noreply.github.com`
|
|
44745
44817
|
]);
|
|
44746
|
-
const top = (await
|
|
44818
|
+
const top = (await execFileAsync8("git", ["-C", path, "rev-parse", "--show-toplevel"])).stdout.trim();
|
|
44747
44819
|
if (await realpath2(top) !== await realpath2(path)) {
|
|
44748
44820
|
throw new Error(`corner worktree escaped its isolated root: ${top}`);
|
|
44749
44821
|
}
|
|
@@ -44770,7 +44842,7 @@ async function discoverCornerWorktree(supervisorRoot, cornerId) {
|
|
|
44770
44842
|
if (!canonicalPath || relative3(canonicalRoot, canonicalPath) !== cornerId) {
|
|
44771
44843
|
throw new Error(`refusing corner ${cornerId} whose checkout path is not canonical`);
|
|
44772
44844
|
}
|
|
44773
|
-
const common = await
|
|
44845
|
+
const common = await execFileAsync8("git", ["-C", path, "rev-parse", "--git-common-dir"]).catch(() => void 0);
|
|
44774
44846
|
if (!common)
|
|
44775
44847
|
return void 0;
|
|
44776
44848
|
const gitCommonDir = resolve35(path, common.stdout.trim());
|
|
@@ -44797,12 +44869,12 @@ async function removeCornerWorktreeAndBranches(worktree, options = {}) {
|
|
|
44797
44869
|
const worktreeExists = existsSync8(worktree.path);
|
|
44798
44870
|
const localExists = await gitRefExists(worktree.gitCommonDir, localRef);
|
|
44799
44871
|
if (worktreeExists) {
|
|
44800
|
-
const checkedOut = await
|
|
44872
|
+
const checkedOut = await execFileAsync8("git", ["-C", worktree.path, "symbolic-ref", "--quiet", "HEAD"], { maxBuffer: 4 * 1024 * 1024 }).then((result) => result.stdout.trim(), () => void 0);
|
|
44801
44873
|
if (!worktree.recovered && checkedOut !== localRef) {
|
|
44802
44874
|
throw new Error(`corner worktree branch mismatch: expected ${localRef}`);
|
|
44803
44875
|
}
|
|
44804
44876
|
await assertCornerWorktreePublished(worktree);
|
|
44805
|
-
await
|
|
44877
|
+
await execFileAsync8("git", [
|
|
44806
44878
|
`--git-dir=${worktree.gitCommonDir}`,
|
|
44807
44879
|
"worktree",
|
|
44808
44880
|
"remove",
|
|
@@ -44826,7 +44898,7 @@ async function removeCornerWorktreeAndBranches(worktree, options = {}) {
|
|
|
44826
44898
|
await deleteExactRemoteBranch(worktree.gitCommonDir, remoteRef, worktree.token);
|
|
44827
44899
|
}
|
|
44828
44900
|
if (await gitRefExists(worktree.gitCommonDir, localRef)) {
|
|
44829
|
-
await
|
|
44901
|
+
await execFileAsync8("git", [
|
|
44830
44902
|
`--git-dir=${worktree.gitCommonDir}`,
|
|
44831
44903
|
"branch",
|
|
44832
44904
|
"--delete",
|
|
@@ -44837,13 +44909,13 @@ async function removeCornerWorktreeAndBranches(worktree, options = {}) {
|
|
|
44837
44909
|
}
|
|
44838
44910
|
}
|
|
44839
44911
|
async function assertCornerWorktreePublished(worktree) {
|
|
44840
|
-
const status = async () => (await
|
|
44841
|
-
const originalHead = (await
|
|
44912
|
+
const status = async () => (await execFileAsync8("git", ["-C", worktree.path, "status", "--porcelain=v1", "--untracked-files=all"], { maxBuffer: 4 * 1024 * 1024 })).stdout.trim();
|
|
44913
|
+
const originalHead = (await execFileAsync8("git", ["-C", worktree.path, "rev-parse", "--verify", "HEAD"])).stdout.trim();
|
|
44842
44914
|
if (await status())
|
|
44843
44915
|
throw new Error(`corner ${worktree.cornerId} has unpushed working-tree work`);
|
|
44844
44916
|
let published = await originContains(worktree.gitCommonDir, originalHead);
|
|
44845
44917
|
if (!published) {
|
|
44846
|
-
await
|
|
44918
|
+
await execFileAsync8("git", [
|
|
44847
44919
|
`--git-dir=${worktree.gitCommonDir}`,
|
|
44848
44920
|
"fetch",
|
|
44849
44921
|
"--prune",
|
|
@@ -44854,13 +44926,13 @@ async function assertCornerWorktreePublished(worktree) {
|
|
|
44854
44926
|
}
|
|
44855
44927
|
if (!published)
|
|
44856
44928
|
throw new Error(`corner ${worktree.cornerId} has unpushed commits`);
|
|
44857
|
-
const settledHead = (await
|
|
44929
|
+
const settledHead = (await execFileAsync8("git", ["-C", worktree.path, "rev-parse", "--verify", "HEAD"])).stdout.trim();
|
|
44858
44930
|
if (settledHead !== originalHead || await status()) {
|
|
44859
44931
|
throw new Error(`corner ${worktree.cornerId} changed during cleanup`);
|
|
44860
44932
|
}
|
|
44861
44933
|
}
|
|
44862
44934
|
async function originContains(gitCommonDir, head) {
|
|
44863
|
-
const result = await
|
|
44935
|
+
const result = await execFileAsync8("git", [
|
|
44864
44936
|
`--git-dir=${gitCommonDir}`,
|
|
44865
44937
|
"for-each-ref",
|
|
44866
44938
|
"--format=%(refname)",
|
|
@@ -44870,7 +44942,7 @@ async function originContains(gitCommonDir, head) {
|
|
|
44870
44942
|
]);
|
|
44871
44943
|
return Boolean(result.stdout.trim());
|
|
44872
44944
|
}
|
|
44873
|
-
var
|
|
44945
|
+
var execFileAsync8 = promisify8(execFile13);
|
|
44874
44946
|
async function removeCornerScratchWorkspace(input) {
|
|
44875
44947
|
const expected = resolve35(input.roomRoot, "scratch");
|
|
44876
44948
|
if (resolve35(input.scratchPath) !== expected) {
|
|
@@ -45433,12 +45505,12 @@ var RoomRuntimeCoordinator = class {
|
|
|
45433
45505
|
const token = remote.startsWith("https://github.com/") ? await this.parentRepositoryToken(roomId) : void 0;
|
|
45434
45506
|
const env = token ? githubGitEnv(token.token) : process.env;
|
|
45435
45507
|
if (!existsSync8(resolve35(path, ".git"))) {
|
|
45436
|
-
await
|
|
45508
|
+
await execFileAsync8("git", ["clone", "--no-checkout", remote, path], {
|
|
45437
45509
|
env,
|
|
45438
45510
|
maxBuffer: 4 * 1024 * 1024
|
|
45439
45511
|
});
|
|
45440
45512
|
}
|
|
45441
|
-
const fetched = await
|
|
45513
|
+
const fetched = await execFileAsync8("git", [
|
|
45442
45514
|
"-C",
|
|
45443
45515
|
path,
|
|
45444
45516
|
"fetch",
|
|
@@ -45454,7 +45526,7 @@ var RoomRuntimeCoordinator = class {
|
|
|
45454
45526
|
void this.options.daemonApi.execute("noteEmptyRoomRepository", { roomId }).catch((error) => console.warn(`[thin-core] Room ${roomId} empty-repository notice failed:`, error));
|
|
45455
45527
|
return this.roomRoot(roomId);
|
|
45456
45528
|
}
|
|
45457
|
-
await
|
|
45529
|
+
await execFileAsync8("git", ["-C", path, "checkout", "--detach", "--force", `origin/${targetBranch}`], {
|
|
45458
45530
|
env,
|
|
45459
45531
|
maxBuffer: 4 * 1024 * 1024
|
|
45460
45532
|
});
|
|
@@ -45469,7 +45541,7 @@ var RoomRuntimeCoordinator = class {
|
|
|
45469
45541
|
const cwd = await this.materializeRoomCheckout(roomId, repository);
|
|
45470
45542
|
if (cwd === this.roomRoot(roomId))
|
|
45471
45543
|
return { cwd };
|
|
45472
|
-
const { stdout: stdout6 } = await
|
|
45544
|
+
const { stdout: stdout6 } = await execFileAsync8("git", ["-C", cwd, "rev-parse", "--verify", "HEAD"]);
|
|
45473
45545
|
return { cwd, branch, commit: stdout6.trim() };
|
|
45474
45546
|
} catch (error) {
|
|
45475
45547
|
console.warn(`[thin-core] Room ${roomId} checkout refresh unavailable:`, error);
|
|
@@ -46003,7 +46075,7 @@ function githubGitEnv(token) {
|
|
|
46003
46075
|
}
|
|
46004
46076
|
async function gitRefExists(gitCommonDir, ref) {
|
|
46005
46077
|
try {
|
|
46006
|
-
await
|
|
46078
|
+
await execFileAsync8("git", [
|
|
46007
46079
|
`--git-dir=${gitCommonDir}`,
|
|
46008
46080
|
"show-ref",
|
|
46009
46081
|
"--verify",
|
|
@@ -46019,7 +46091,7 @@ async function gitRefExists(gitCommonDir, ref) {
|
|
|
46019
46091
|
}
|
|
46020
46092
|
async function repositoryHeadRef(gitCommonDir) {
|
|
46021
46093
|
try {
|
|
46022
|
-
const head = await
|
|
46094
|
+
const head = await execFileAsync8("git", [
|
|
46023
46095
|
`--git-dir=${gitCommonDir}`,
|
|
46024
46096
|
"symbolic-ref",
|
|
46025
46097
|
"--quiet",
|
|
@@ -46039,7 +46111,7 @@ ${gitStderr(error)}`);
|
|
|
46039
46111
|
}
|
|
46040
46112
|
async function deleteExactRemoteBranch(gitCommonDir, remoteRef, token, options = {}) {
|
|
46041
46113
|
const authEnv = githubGitEnv(token);
|
|
46042
|
-
const listRemote = () =>
|
|
46114
|
+
const listRemote = () => execFileAsync8("git", [`--git-dir=${gitCommonDir}`, "ls-remote", "--heads", "origin", remoteRef], {
|
|
46043
46115
|
env: authEnv,
|
|
46044
46116
|
maxBuffer: 4 * 1024 * 1024
|
|
46045
46117
|
});
|
|
@@ -46055,7 +46127,7 @@ async function deleteExactRemoteBranch(gitCommonDir, remoteRef, token, options =
|
|
|
46055
46127
|
try {
|
|
46056
46128
|
const remote = await listRemote();
|
|
46057
46129
|
if (remote.stdout.trim()) {
|
|
46058
|
-
await
|
|
46130
|
+
await execFileAsync8("git", [`--git-dir=${gitCommonDir}`, "push", "origin", `:${remoteRef}`], {
|
|
46059
46131
|
env: authEnv,
|
|
46060
46132
|
maxBuffer: 4 * 1024 * 1024
|
|
46061
46133
|
});
|