@gethmy/agent 1.20.0 → 1.20.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/cli.js +31 -11
- package/dist/index.js +31 -11
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -2459,17 +2459,26 @@ function cleanupWorktree(worktreePath, branchName) {
|
|
|
2459
2459
|
const repoRoot = execFileSync3("git", ["rev-parse", "--show-toplevel"], {
|
|
2460
2460
|
encoding: "utf-8"
|
|
2461
2461
|
}).trim();
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2462
|
+
if (existsSync2(worktreePath)) {
|
|
2463
|
+
try {
|
|
2464
|
+
execFileSync3("git", ["worktree", "remove", worktreePath, "--force"], {
|
|
2465
|
+
cwd: repoRoot,
|
|
2466
|
+
stdio: "pipe"
|
|
2467
|
+
});
|
|
2468
|
+
log.info(TAG6, `Removed worktree: ${worktreePath}`);
|
|
2469
|
+
} catch (err) {
|
|
2470
|
+
log.warn(TAG6, `Failed to remove worktree cleanly: ${err instanceof Error ? err.message : err}`);
|
|
2471
|
+
if (existsSync2(worktreePath)) {
|
|
2472
|
+
rmSync(worktreePath, { recursive: true, force: true });
|
|
2473
|
+
}
|
|
2474
|
+
try {
|
|
2475
|
+
execFileSync3("git", ["worktree", "prune", "--expire=now"], {
|
|
2476
|
+
cwd: repoRoot,
|
|
2477
|
+
stdio: "pipe"
|
|
2478
|
+
});
|
|
2479
|
+
} catch {}
|
|
2472
2480
|
}
|
|
2481
|
+
} else {
|
|
2473
2482
|
try {
|
|
2474
2483
|
execFileSync3("git", ["worktree", "prune", "--expire=now"], {
|
|
2475
2484
|
cwd: repoRoot,
|
|
@@ -2491,9 +2500,19 @@ function resolveRepoRoot() {
|
|
|
2491
2500
|
encoding: "utf-8"
|
|
2492
2501
|
}).trim();
|
|
2493
2502
|
}
|
|
2503
|
+
function localBranchExists(branchName, repoRoot) {
|
|
2504
|
+
try {
|
|
2505
|
+
execFileSync3("git", ["show-ref", "--verify", "--quiet", `refs/heads/${branchName}`], { cwd: repoRoot, stdio: "ignore" });
|
|
2506
|
+
return true;
|
|
2507
|
+
} catch {
|
|
2508
|
+
return false;
|
|
2509
|
+
}
|
|
2510
|
+
}
|
|
2494
2511
|
function branchAheadOfItsRemote(branchName, repoRoot = resolveRepoRoot()) {
|
|
2512
|
+
if (!localBranchExists(branchName, repoRoot))
|
|
2513
|
+
return false;
|
|
2495
2514
|
try {
|
|
2496
|
-
const out = execFileSync3("git", ["rev-list", branchName, "--not", "--remotes=origin"], { cwd: repoRoot, encoding: "utf-8" }).trim();
|
|
2515
|
+
const out = execFileSync3("git", ["rev-list", branchName, "--not", "--remotes=origin"], { cwd: repoRoot, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
2497
2516
|
return out.length > 0;
|
|
2498
2517
|
} catch {
|
|
2499
2518
|
return false;
|
|
@@ -8003,6 +8022,7 @@ class Worker {
|
|
|
8003
8022
|
stageGateEvaluation = await this.collectStageGateEvidence(card, stageRun.stage, worktreePath, subtasks);
|
|
8004
8023
|
} : undefined;
|
|
8005
8024
|
const completed = await runCompletion(this.client, card, this.branchName, this.worktreePath, this.config, this.id, this.lastSessionStats, this.workspaceId, this.sessionId, this.stateStore, this.onCardCompleted, onBeforeWorktreeCleanup);
|
|
8025
|
+
this.worktreePath = null;
|
|
8006
8026
|
this.verificationFailed = !completed;
|
|
8007
8027
|
if (completed && stageRun) {
|
|
8008
8028
|
const outcome = await this.advanceFromGateEvaluation(card, stageRun.stage, stageRun.index, stageRun.def, stageGateEvaluation);
|
package/dist/index.js
CHANGED
|
@@ -2458,17 +2458,26 @@ function cleanupWorktree(worktreePath, branchName) {
|
|
|
2458
2458
|
const repoRoot = execFileSync3("git", ["rev-parse", "--show-toplevel"], {
|
|
2459
2459
|
encoding: "utf-8"
|
|
2460
2460
|
}).trim();
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2461
|
+
if (existsSync2(worktreePath)) {
|
|
2462
|
+
try {
|
|
2463
|
+
execFileSync3("git", ["worktree", "remove", worktreePath, "--force"], {
|
|
2464
|
+
cwd: repoRoot,
|
|
2465
|
+
stdio: "pipe"
|
|
2466
|
+
});
|
|
2467
|
+
log.info(TAG6, `Removed worktree: ${worktreePath}`);
|
|
2468
|
+
} catch (err) {
|
|
2469
|
+
log.warn(TAG6, `Failed to remove worktree cleanly: ${err instanceof Error ? err.message : err}`);
|
|
2470
|
+
if (existsSync2(worktreePath)) {
|
|
2471
|
+
rmSync(worktreePath, { recursive: true, force: true });
|
|
2472
|
+
}
|
|
2473
|
+
try {
|
|
2474
|
+
execFileSync3("git", ["worktree", "prune", "--expire=now"], {
|
|
2475
|
+
cwd: repoRoot,
|
|
2476
|
+
stdio: "pipe"
|
|
2477
|
+
});
|
|
2478
|
+
} catch {}
|
|
2471
2479
|
}
|
|
2480
|
+
} else {
|
|
2472
2481
|
try {
|
|
2473
2482
|
execFileSync3("git", ["worktree", "prune", "--expire=now"], {
|
|
2474
2483
|
cwd: repoRoot,
|
|
@@ -2490,9 +2499,19 @@ function resolveRepoRoot() {
|
|
|
2490
2499
|
encoding: "utf-8"
|
|
2491
2500
|
}).trim();
|
|
2492
2501
|
}
|
|
2502
|
+
function localBranchExists(branchName, repoRoot) {
|
|
2503
|
+
try {
|
|
2504
|
+
execFileSync3("git", ["show-ref", "--verify", "--quiet", `refs/heads/${branchName}`], { cwd: repoRoot, stdio: "ignore" });
|
|
2505
|
+
return true;
|
|
2506
|
+
} catch {
|
|
2507
|
+
return false;
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2493
2510
|
function branchAheadOfItsRemote(branchName, repoRoot = resolveRepoRoot()) {
|
|
2511
|
+
if (!localBranchExists(branchName, repoRoot))
|
|
2512
|
+
return false;
|
|
2494
2513
|
try {
|
|
2495
|
-
const out = execFileSync3("git", ["rev-list", branchName, "--not", "--remotes=origin"], { cwd: repoRoot, encoding: "utf-8" }).trim();
|
|
2514
|
+
const out = execFileSync3("git", ["rev-list", branchName, "--not", "--remotes=origin"], { cwd: repoRoot, encoding: "utf-8", stdio: ["ignore", "pipe", "pipe"] }).trim();
|
|
2496
2515
|
return out.length > 0;
|
|
2497
2516
|
} catch {
|
|
2498
2517
|
return false;
|
|
@@ -8002,6 +8021,7 @@ class Worker {
|
|
|
8002
8021
|
stageGateEvaluation = await this.collectStageGateEvidence(card, stageRun.stage, worktreePath, subtasks);
|
|
8003
8022
|
} : undefined;
|
|
8004
8023
|
const completed = await runCompletion(this.client, card, this.branchName, this.worktreePath, this.config, this.id, this.lastSessionStats, this.workspaceId, this.sessionId, this.stateStore, this.onCardCompleted, onBeforeWorktreeCleanup);
|
|
8024
|
+
this.worktreePath = null;
|
|
8005
8025
|
this.verificationFailed = !completed;
|
|
8006
8026
|
if (completed && stageRun) {
|
|
8007
8027
|
const outcome = await this.advanceFromGateEvaluation(card, stageRun.stage, stageRun.index, stageRun.def, stageGateEvaluation);
|