@on-par/factory-cli 0.9.14-next.9 → 0.9.14

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.
Files changed (121) hide show
  1. package/dist/cli/cost-json.d.ts +9 -2
  2. package/dist/cli/cost-json.d.ts.map +1 -1
  3. package/dist/cli/cost-json.js +29 -2
  4. package/dist/cli/cost-json.js.map +1 -1
  5. package/dist/cli/daemon-load.d.ts +14 -0
  6. package/dist/cli/daemon-load.d.ts.map +1 -0
  7. package/dist/cli/daemon-load.js +75 -0
  8. package/dist/cli/daemon-load.js.map +1 -0
  9. package/dist/cli/daemon.d.ts +5 -1
  10. package/dist/cli/daemon.d.ts.map +1 -1
  11. package/dist/cli/daemon.js +15 -4
  12. package/dist/cli/daemon.js.map +1 -1
  13. package/dist/cli/doctor-config.d.ts.map +1 -1
  14. package/dist/cli/doctor-config.js +15 -1
  15. package/dist/cli/doctor-config.js.map +1 -1
  16. package/dist/cli/doctor-health.d.ts +1 -0
  17. package/dist/cli/doctor-health.d.ts.map +1 -1
  18. package/dist/cli/doctor-health.js +5 -3
  19. package/dist/cli/doctor-health.js.map +1 -1
  20. package/dist/cli/doctor-verify.d.ts +32 -0
  21. package/dist/cli/doctor-verify.d.ts.map +1 -0
  22. package/dist/cli/doctor-verify.js +126 -0
  23. package/dist/cli/doctor-verify.js.map +1 -0
  24. package/dist/cli/doctor.d.ts +1 -0
  25. package/dist/cli/doctor.d.ts.map +1 -1
  26. package/dist/cli/doctor.js +12 -10
  27. package/dist/cli/doctor.js.map +1 -1
  28. package/dist/cli/index.d.ts +12 -2
  29. package/dist/cli/index.d.ts.map +1 -1
  30. package/dist/cli/index.js +31 -1
  31. package/dist/cli/index.js.map +1 -1
  32. package/dist/cli/json-contract.d.ts +24 -0
  33. package/dist/cli/json-contract.d.ts.map +1 -1
  34. package/dist/cli/json-contract.js +24 -1
  35. package/dist/cli/json-contract.js.map +1 -1
  36. package/dist/cli/land-pr.d.ts.map +1 -1
  37. package/dist/cli/land-pr.js +22 -18
  38. package/dist/cli/land-pr.js.map +1 -1
  39. package/dist/cli/lane-heartbeat.d.ts +7 -0
  40. package/dist/cli/lane-heartbeat.d.ts.map +1 -0
  41. package/dist/cli/lane-heartbeat.js +33 -0
  42. package/dist/cli/lane-heartbeat.js.map +1 -0
  43. package/dist/cli/lane-park-comment.d.ts +19 -0
  44. package/dist/cli/lane-park-comment.d.ts.map +1 -0
  45. package/dist/cli/lane-park-comment.js +27 -0
  46. package/dist/cli/lane-park-comment.js.map +1 -0
  47. package/dist/cli/lane-pause.d.ts +19 -0
  48. package/dist/cli/lane-pause.d.ts.map +1 -0
  49. package/dist/cli/lane-pause.js +56 -0
  50. package/dist/cli/lane-pause.js.map +1 -0
  51. package/dist/cli/notify.d.ts +37 -0
  52. package/dist/cli/notify.d.ts.map +1 -0
  53. package/dist/cli/notify.js +95 -0
  54. package/dist/cli/notify.js.map +1 -0
  55. package/dist/cli/program-advanced.d.ts.map +1 -1
  56. package/dist/cli/program-advanced.js +13 -1
  57. package/dist/cli/program-advanced.js.map +1 -1
  58. package/dist/cli/program-run-work.d.ts.map +1 -1
  59. package/dist/cli/program-run-work.js +2 -0
  60. package/dist/cli/program-run-work.js.map +1 -1
  61. package/dist/cli/program-setup.d.ts.map +1 -1
  62. package/dist/cli/program-setup.js +2 -1
  63. package/dist/cli/program-setup.js.map +1 -1
  64. package/dist/cli/queue-merged-closing-pr.d.ts +5 -0
  65. package/dist/cli/queue-merged-closing-pr.d.ts.map +1 -0
  66. package/dist/cli/queue-merged-closing-pr.js +70 -0
  67. package/dist/cli/queue-merged-closing-pr.js.map +1 -0
  68. package/dist/cli/queue-preflight.d.ts +7 -0
  69. package/dist/cli/queue-preflight.d.ts.map +1 -1
  70. package/dist/cli/queue-preflight.js +54 -11
  71. package/dist/cli/queue-preflight.js.map +1 -1
  72. package/dist/cli/run-lane-decompose.d.ts +12 -0
  73. package/dist/cli/run-lane-decompose.d.ts.map +1 -0
  74. package/dist/cli/run-lane-decompose.js +27 -0
  75. package/dist/cli/run-lane-decompose.js.map +1 -0
  76. package/dist/cli/run-lane.d.ts +17 -3
  77. package/dist/cli/run-lane.d.ts.map +1 -1
  78. package/dist/cli/run-lane.js +46 -89
  79. package/dist/cli/run-lane.js.map +1 -1
  80. package/dist/cli/run.d.ts +1 -0
  81. package/dist/cli/run.d.ts.map +1 -1
  82. package/dist/cli/run.js +30 -1
  83. package/dist/cli/run.js.map +1 -1
  84. package/dist/cli/runs.d.ts +1 -1
  85. package/dist/cli/runs.d.ts.map +1 -1
  86. package/dist/cli/runs.js +8 -10
  87. package/dist/cli/runs.js.map +1 -1
  88. package/dist/cli/ship-steps.d.ts +1 -0
  89. package/dist/cli/ship-steps.d.ts.map +1 -1
  90. package/dist/cli/ship-steps.js +4 -1
  91. package/dist/cli/ship-steps.js.map +1 -1
  92. package/dist/cli/ship.d.ts +2 -0
  93. package/dist/cli/ship.d.ts.map +1 -1
  94. package/dist/cli/ship.js +1 -0
  95. package/dist/cli/ship.js.map +1 -1
  96. package/dist/cli/status.d.ts.map +1 -1
  97. package/dist/cli/status.js +61 -30
  98. package/dist/cli/status.js.map +1 -1
  99. package/dist/cli/steer.d.ts +1 -0
  100. package/dist/cli/steer.d.ts.map +1 -1
  101. package/dist/cli/steer.js +55 -28
  102. package/dist/cli/steer.js.map +1 -1
  103. package/dist/cli/steerability-report.d.ts +1 -1
  104. package/dist/cli/steerability-report.d.ts.map +1 -1
  105. package/dist/cli/steerability-report.js +4 -7
  106. package/dist/cli/steerability-report.js.map +1 -1
  107. package/dist/cli/supervise.d.ts +1 -0
  108. package/dist/cli/supervise.d.ts.map +1 -1
  109. package/dist/cli/supervise.js +10 -3
  110. package/dist/cli/supervise.js.map +1 -1
  111. package/dist/cli/worktree-keep.d.ts +18 -0
  112. package/dist/cli/worktree-keep.d.ts.map +1 -0
  113. package/dist/cli/worktree-keep.js +47 -0
  114. package/dist/cli/worktree-keep.js.map +1 -0
  115. package/dist/cli/worktree-reap.d.ts.map +1 -1
  116. package/dist/cli/worktree-reap.js +5 -3
  117. package/dist/cli/worktree-reap.js.map +1 -1
  118. package/package.json +4 -4
  119. package/schemas/cost.schema.json +39 -1
  120. package/schemas/daemon-status.schema.json +44 -1
  121. package/schemas/logs-line.schema.json +10 -0
package/dist/cli/index.js CHANGED
@@ -62,6 +62,7 @@ import { DeepCheckError, createDeepModelRunner, runIssueCheck } from './ready-ch
62
62
  import { childRunSucceeded, formatChildRunSummary, runChildrenInOrder } from './run-children.js';
63
63
  import { readRunFlagOverrides, recordDraftPrFlag } from './run-flags.js';
64
64
  import { runStalenessGuard } from './staleness.js';
65
+ import { runWorktreeKeep, runWorktreeRelease } from './worktree-keep.js';
65
66
  import { gcWorktreeSandbox, reapParkedLane, reapPrlessShip } from './worktree-reap.js';
66
67
  const DEFAULT_CONFIG_LOADERS = {
67
68
  loadModelsConfig,
@@ -1947,6 +1948,28 @@ export async function cmdWorktreeGc(opts) {
1947
1948
  const report = opts.dryRun ? await run() : await withGitLock(repoRoot, () => withFileLock(paths.gitLock, run));
1948
1949
  console.log(internalOps.formatGcReport(report));
1949
1950
  }
1951
+ /** `factory worktree keep <issue>` (#3318): protect the lane worktree from GC while finishing by hand. */
1952
+ export async function cmdWorktreeKeep(issueArg, opts) {
1953
+ const issue = parseIssueArg(issueArg);
1954
+ const repoRoot = await getRepoRoot();
1955
+ const paths = getFactoryPaths(repoRoot);
1956
+ const ghRepo = await getGitHubRepo();
1957
+ const branchPrefix = branchPrefixOrExit(opts.branchPrefix);
1958
+ await runWorktreeKeep(issue, { reason: opts.reason }, {
1959
+ keepsFile: paths.worktreeKeeps,
1960
+ worktreePath: (n) => worktreePathFor(repoRoot, ghRepo, n, branchPrefix),
1961
+ withLock: (fn) => withFileLock(paths.gitLock, fn),
1962
+ });
1963
+ }
1964
+ /** `factory worktree release <issue>` (#3318): drop the issue's keep record. */
1965
+ export async function cmdWorktreeRelease(issueArg) {
1966
+ const issue = parseIssueArg(issueArg);
1967
+ const paths = getFactoryPaths(await getRepoRoot());
1968
+ await runWorktreeRelease(issue, {
1969
+ keepsFile: paths.worktreeKeeps,
1970
+ withLock: (fn) => withFileLock(paths.gitLock, fn),
1971
+ });
1972
+ }
1950
1973
  /** `factory reset <issue...>` (#1787): wipes an issue's local state; see reset.ts. */
1951
1974
  export async function cmdReset(issues, opts) {
1952
1975
  let nums;
@@ -2207,6 +2230,8 @@ export async function cmdUnpark(issueArg, opts = {}) {
2207
2230
  try {
2208
2231
  const [owner, repo] = (await getGitHubRepo()).split('/');
2209
2232
  result = await runUnpark({
2233
+ keepsFile: getFactoryPaths(await getRepoRoot()).worktreeKeeps,
2234
+ warn: (msg) => console.error(styleText('yellow', `factory: ${msg}`)),
2210
2235
  client: createOctokitQueueClient(getOctokit()),
2211
2236
  owner,
2212
2237
  repo,
@@ -2598,6 +2623,7 @@ export function laneQueueDeps(queue, lane) {
2598
2623
  releaseIssue: (issue, outcome) => queue.release(issue, outcome),
2599
2624
  heartbeat: (issue) => queue.heartbeat(issue),
2600
2625
  countRemaining: async () => (await queue.list(lane)).length,
2626
+ queueChildren: (parent, children) => queue.enqueueAfter(lane, parent, children),
2601
2627
  };
2602
2628
  }
2603
2629
  export { preflightQueuedIssue };
@@ -2764,9 +2790,10 @@ export async function superviseLoop(deps) {
2764
2790
  else {
2765
2791
  pct = reading.pct;
2766
2792
  source = reading.source;
2793
+ let detail = reading.detail;
2767
2794
  if (cycle > 1 || !now) {
2768
2795
  while (pct >= resumeAt) {
2769
- writeLine(`[factory] supervise: trailing usage (${source}) ${Math.round(pct * 100)}% >= resume gate ${Math.round(resumeAt * 100)}% — waiting ${pollMs / 1000}s`);
2796
+ writeLine(`[factory] supervise: trailing usage (${source}) ${Math.round(pct * 100)}% >= resume gate ${Math.round(resumeAt * 100)}% (${detail}) — waiting ${pollMs / 1000}s`);
2770
2797
  await sleep(pollMs);
2771
2798
  reading = await readUsageFn();
2772
2799
  if (reading === null) {
@@ -2777,6 +2804,7 @@ export async function superviseLoop(deps) {
2777
2804
  }
2778
2805
  pct = reading.pct;
2779
2806
  source = reading.source;
2807
+ detail = reading.detail;
2780
2808
  }
2781
2809
  }
2782
2810
  }
@@ -3135,6 +3163,8 @@ export const PROGRAM_HANDLERS = {
3135
3163
  cmdDaemonLogs,
3136
3164
  cmdSelfUpdateCheck,
3137
3165
  cmdWorktreeGc,
3166
+ cmdWorktreeKeep,
3167
+ cmdWorktreeRelease,
3138
3168
  cmdReset,
3139
3169
  cmdSupervise: runSupervise,
3140
3170
  cmdStop,