@on-par/factory-cli 0.9.8-next.7 → 0.9.8-next.70
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/doctor-harness.d.ts +11 -0
- package/dist/cli/doctor-harness.d.ts.map +1 -1
- package/dist/cli/doctor-harness.js +43 -1
- package/dist/cli/doctor-harness.js.map +1 -1
- package/dist/cli/doctor-opencode-probe.d.ts +22 -0
- package/dist/cli/doctor-opencode-probe.d.ts.map +1 -0
- package/dist/cli/doctor-opencode-probe.js +110 -0
- package/dist/cli/doctor-opencode-probe.js.map +1 -0
- package/dist/cli/doctor.d.ts +30 -8
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +114 -44
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/first-run.d.ts +3 -1
- package/dist/cli/first-run.d.ts.map +1 -1
- package/dist/cli/first-run.js +5 -2
- package/dist/cli/first-run.js.map +1 -1
- package/dist/cli/github-stub.js +1 -1
- package/dist/cli/github-stub.js.map +1 -1
- package/dist/cli/harness-check.d.ts +27 -0
- package/dist/cli/harness-check.d.ts.map +1 -0
- package/dist/cli/harness-check.js +58 -0
- package/dist/cli/harness-check.js.map +1 -0
- package/dist/cli/help-groups.js +1 -1
- package/dist/cli/help-groups.js.map +1 -1
- package/dist/cli/index.d.ts +21 -18
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +62 -56
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/program-run-work.js +2 -2
- package/dist/cli/program-run-work.js.map +1 -1
- package/dist/cli/program-setup.d.ts.map +1 -1
- package/dist/cli/program-setup.js +10 -1
- package/dist/cli/program-setup.js.map +1 -1
- package/dist/cli/queue-add-json.d.ts +3 -1
- package/dist/cli/queue-add-json.d.ts.map +1 -1
- package/dist/cli/queue-add-json.js +1 -0
- package/dist/cli/queue-add-json.js.map +1 -1
- package/dist/cli/queue-output.d.ts +9 -0
- package/dist/cli/queue-output.d.ts.map +1 -0
- package/dist/cli/queue-output.js +38 -0
- package/dist/cli/queue-output.js.map +1 -0
- package/dist/cli/run-lane.d.ts +3 -0
- package/dist/cli/run-lane.d.ts.map +1 -1
- package/dist/cli/run-lane.js +6 -1
- package/dist/cli/run-lane.js.map +1 -1
- package/dist/cli/run.d.ts.map +1 -1
- package/dist/cli/run.js +13 -1
- package/dist/cli/run.js.map +1 -1
- package/dist/cli/self-update-apply.d.ts +2 -0
- package/dist/cli/self-update-apply.d.ts.map +1 -1
- package/dist/cli/self-update-apply.js +49 -6
- package/dist/cli/self-update-apply.js.map +1 -1
- package/dist/cli/self-update.d.ts +4 -0
- package/dist/cli/self-update.d.ts.map +1 -1
- package/dist/cli/self-update.js +1 -1
- package/dist/cli/self-update.js.map +1 -1
- package/dist/cli/ship.d.ts.map +1 -1
- package/dist/cli/ship.js +17 -9
- package/dist/cli/ship.js.map +1 -1
- package/dist/cli/status.d.ts +5 -0
- package/dist/cli/status.d.ts.map +1 -1
- package/dist/cli/status.js +5 -4
- package/dist/cli/status.js.map +1 -1
- package/dist/cli/stop-sentinel.d.ts +4 -0
- package/dist/cli/stop-sentinel.d.ts.map +1 -1
- package/dist/cli/stop-sentinel.js +11 -0
- package/dist/cli/stop-sentinel.js.map +1 -1
- package/dist/cli/supervise.d.ts +5 -0
- package/dist/cli/supervise.d.ts.map +1 -1
- package/dist/cli/supervise.js +1 -0
- package/dist/cli/supervise.js.map +1 -1
- package/dist/cli/triage-open-prs.d.ts +10 -0
- package/dist/cli/triage-open-prs.d.ts.map +1 -0
- package/dist/cli/triage-open-prs.js +38 -0
- package/dist/cli/triage-open-prs.js.map +1 -0
- package/dist/cli/update-state.d.ts +2 -0
- package/dist/cli/update-state.d.ts.map +1 -1
- package/dist/cli/update-state.js +14 -0
- package/dist/cli/update-state.js.map +1 -1
- package/dist/cli/worktree-reap.d.ts +31 -0
- package/dist/cli/worktree-reap.d.ts.map +1 -0
- package/dist/cli/worktree-reap.js +72 -0
- package/dist/cli/worktree-reap.js.map +1 -0
- package/package.json +3 -3
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// packages/cli/src/cli/worktree-reap.ts — eager lane-worktree reaps (#1007, #3008), moved out of index.ts
|
|
2
|
+
import { resolveSandboxPolicy } from '@on-par/factory-core';
|
|
3
|
+
import { logEvent, resolveEffectiveConfig, withFileLock, withGitLock, worktreeSandboxFor, } from '@on-par/factory-core/internal';
|
|
4
|
+
/** The repo's current docker-sandbox descriptor for worktree-gc sweeps, or undefined for
|
|
5
|
+
* every other runtime/config state (including a fixture config with no `sandbox` key). */
|
|
6
|
+
export function gcWorktreeSandbox(sandboxCfg, repoRoot) {
|
|
7
|
+
if (!sandboxCfg)
|
|
8
|
+
return undefined;
|
|
9
|
+
const policy = resolveSandboxPolicy(sandboxCfg, { worktree: repoRoot, repoRoot });
|
|
10
|
+
return worktreeSandboxFor(policy?.runtime);
|
|
11
|
+
}
|
|
12
|
+
/** Shared body of both reaps: resolves the lane's conventional worktree under the git+file
|
|
13
|
+
* lock pairing every worktree mutation site uses. Failures are logged as a warn and never surface. */
|
|
14
|
+
async function reapUnderLock(rt, [issue, repoRoot, ghRepo, paths, prefixOverride], failure, reap) {
|
|
15
|
+
let worktreePath;
|
|
16
|
+
try {
|
|
17
|
+
const factoryConfig = rt.configLoaders.loadFactoryConfigForRepo(paths.config);
|
|
18
|
+
const branchPrefix = prefixOverride ?? resolveEffectiveConfig(rt.configLoaders.loadRepoConfig(repoRoot)).branchPrefix;
|
|
19
|
+
const resolved = rt.worktreePathFor(repoRoot, ghRepo, issue, branchPrefix);
|
|
20
|
+
worktreePath = resolved;
|
|
21
|
+
const log = (type, msg) => logEvent(paths.events, type, issue, msg);
|
|
22
|
+
const sandbox = gcWorktreeSandbox(factoryConfig.sandbox, repoRoot);
|
|
23
|
+
const result = await withGitLock(repoRoot, () => withFileLock(paths.gitLock, () => reap(resolved, { issue, branchPrefix, log, sandbox })));
|
|
24
|
+
return { worktreePath, result };
|
|
25
|
+
}
|
|
26
|
+
catch (err) {
|
|
27
|
+
logEvent(paths.events, 'warn', issue, `${failure}: ${err?.message ?? String(err)}`);
|
|
28
|
+
return { worktreePath, result: undefined };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/** Eagerly reaps a parked lane's own worktree inside `factory run` (#1007). All the safety
|
|
32
|
+
* gates live in reapLaneWorktree. A reap failure is logged as a warn and never surfaces —
|
|
33
|
+
* parking must always succeed. */
|
|
34
|
+
export async function reapParkedLane(rt, reap, args) {
|
|
35
|
+
await reapUnderLock(rt, args, 'parked-lane worktree reap failed', (worktreePath, opts) => reap(args[1], worktreePath, opts));
|
|
36
|
+
}
|
|
37
|
+
/** The one run-output line for a PR-less ship's reap: where the worktree is and why it was kept
|
|
38
|
+
* or removed (#3009). `undefined` means the reap threw, so the state is unknown. */
|
|
39
|
+
export function formatShipReapLine(worktreePath, result) {
|
|
40
|
+
const unverified = `📌 Kept worktree ${worktreePath} — its state could not be verified, so nothing was removed`;
|
|
41
|
+
if (result === undefined)
|
|
42
|
+
return unverified;
|
|
43
|
+
const withBranch = result.branch ? ` and branch ${result.branch}` : '';
|
|
44
|
+
switch (result.outcome) {
|
|
45
|
+
case 'removed':
|
|
46
|
+
return `🧹 Removed worktree ${worktreePath}${result.branchDeleted ? ` and branch ${result.branch}` : ''} — no PR was opened and nothing was committed`;
|
|
47
|
+
case 'kept-dirty':
|
|
48
|
+
return `📌 Kept worktree ${worktreePath}${withBranch} — it has uncommitted changes`;
|
|
49
|
+
case 'kept-committed':
|
|
50
|
+
return `📌 Kept worktree ${worktreePath}${withBranch} — it has commits beyond the base`;
|
|
51
|
+
case 'kept-branch-mismatch':
|
|
52
|
+
return `📌 Kept worktree ${worktreePath} — it is on '${result.branch}', not this issue's lane branch`;
|
|
53
|
+
case 'kept-unverified':
|
|
54
|
+
return unverified;
|
|
55
|
+
case 'absent':
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/** Removes a one-shot `factory ship`'s worktree and branch when it ended without a PR and left
|
|
60
|
+
* them clean with no commits (#3008). All safety gates live in reapCleanShipWorktree; a
|
|
61
|
+
* failure is logged as a warn and never changes the ship's exit. */
|
|
62
|
+
export async function reapPrlessShip(rt, reap, args) {
|
|
63
|
+
const done = await reapUnderLock(rt, args, 'PR-less ship worktree cleanup failed', (worktreePath, opts) => reap(args[1], worktreePath, opts));
|
|
64
|
+
if (done.worktreePath === undefined) {
|
|
65
|
+
console.log(`📌 Kept the worktree for issue #${args[0]} — its state could not be verified, so nothing was removed`);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
const line = formatShipReapLine(done.worktreePath, done.result);
|
|
69
|
+
if (line !== null)
|
|
70
|
+
console.log(line);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=worktree-reap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-reap.js","sourceRoot":"","sources":["../../src/cli/worktree-reap.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAG1G,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAGL,QAAQ,EACR,sBAAsB,EAGtB,YAAY,EACZ,WAAW,EACX,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAYvC;2FAC2F;AAC3F,MAAM,UAAU,iBAAiB,CAC/B,UAAgD,EAChD,QAAgB;IAEhB,IAAI,CAAC,UAAU;QAAE,OAAO,SAAS,CAAC;IAClC,MAAM,MAAM,GAAG,oBAAoB,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IAClF,OAAO,kBAAkB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED;uGACuG;AACvG,KAAK,UAAU,aAAa,CAC1B,EAAe,EACf,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,CAAsD,EACrG,OAAe,EACf,I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sCAAsC,EAAE,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE,CACxG,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,CAClC,CAAC;IACF,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,CAAC,GAAG,CAAC,mCAAmC,IAAI,CAAC,CAAC,CAAC,4DAA4D,CAAC,CAAC;QACpH,OAAO;IACT,CAAC;IACD,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAChE,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@on-par/factory-cli",
|
|
3
|
-
"version": "0.9.8-next.
|
|
3
|
+
"version": "0.9.8-next.70",
|
|
4
4
|
"description": "On PAR Dev's Software Factory CLI: takes a GitHub issue through plan, build and check with AI agents, then opens a ready-for-review PR.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-agents",
|
|
@@ -47,8 +47,8 @@
|
|
|
47
47
|
"@octokit/plugin-retry": "^8.1.1",
|
|
48
48
|
"@octokit/plugin-throttling": "^11.0.5",
|
|
49
49
|
"@octokit/rest": "^22.0.0",
|
|
50
|
-
"@on-par/factory-core": "0.9.8-next.
|
|
51
|
-
"@on-par/factory-tui": "0.9.8-next.
|
|
50
|
+
"@on-par/factory-core": "0.9.8-next.70",
|
|
51
|
+
"@on-par/factory-tui": "0.9.8-next.70",
|
|
52
52
|
"commander": "^15.0.0"
|
|
53
53
|
},
|
|
54
54
|
"license": "MIT",
|