@magnusekdahl/parallix 1.3.0 → 1.3.2

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 (63) hide show
  1. package/README.md +4 -2
  2. package/config/integration-pipelines.json +5 -0
  3. package/docs/adr/0048-fail-closed-harness-defense-against-agent-hallucinations.md +161 -0
  4. package/docs/adr/index.md +2 -0
  5. package/docs/authority-reference.md +8 -5
  6. package/lib/agents/agents.js +37 -5
  7. package/lib/agents/agents.ts +43 -6
  8. package/lib/agents/claude.js +3 -1
  9. package/lib/agents/claude.ts +3 -1
  10. package/lib/agents/codex.js +3 -1
  11. package/lib/agents/codex.ts +3 -1
  12. package/lib/agents/opencode.js +5 -3
  13. package/lib/agents/opencode.ts +5 -3
  14. package/lib/commands/active.js +21 -3
  15. package/lib/commands/active.ts +7 -2
  16. package/lib/commands/config.js +6 -1
  17. package/lib/commands/config.ts +6 -1
  18. package/lib/commands/coverage-gate.js +19 -1
  19. package/lib/commands/coverage-gate.ts +6 -1
  20. package/lib/commands/diff.js +6 -1
  21. package/lib/commands/diff.ts +6 -1
  22. package/lib/commands/draft.js +31 -1
  23. package/lib/commands/draft.ts +6 -1
  24. package/lib/commands/handoff.js +12 -1
  25. package/lib/commands/handoff.ts +6 -1
  26. package/lib/commands/integrate.js +103 -27
  27. package/lib/commands/integrate.ts +67 -31
  28. package/lib/commands/mission-start.js +12 -3
  29. package/lib/commands/mission-start.ts +7 -2
  30. package/lib/commands/rebase.js +10 -2
  31. package/lib/commands/rebase.ts +6 -2
  32. package/lib/commands/repair-handoff.js +13 -3
  33. package/lib/commands/repair-handoff.ts +7 -2
  34. package/lib/commands/resolve-conflict.js +8 -2
  35. package/lib/commands/resolve-conflict.ts +7 -2
  36. package/lib/commands/review.js +6 -1
  37. package/lib/commands/review.ts +6 -1
  38. package/lib/commands/setup-review.js +8 -3
  39. package/lib/commands/setup-review.ts +8 -3
  40. package/lib/commands/setup.js +8 -2
  41. package/lib/commands/setup.ts +7 -2
  42. package/lib/commands/stats-backfill.js +14 -3
  43. package/lib/commands/stats-backfill.ts +7 -2
  44. package/lib/commands/stats.js +33 -1
  45. package/lib/commands/stats.ts +7 -2
  46. package/lib/commands/status.js +8 -1
  47. package/lib/commands/status.ts +6 -1
  48. package/lib/commands/verify.js +11 -2
  49. package/lib/commands/verify.ts +7 -2
  50. package/lib/core/gitignore.js +9 -1
  51. package/lib/core/gitignore.ts +6 -1
  52. package/lib/core/persistent-data-migration.js +4 -2
  53. package/lib/core/persistent-data-migration.ts +4 -2
  54. package/lib/index.js +36 -36
  55. package/lib/index.ts +18 -18
  56. package/lib/review/review-loop.js +12 -7
  57. package/lib/review/review-loop.ts +10 -7
  58. package/lib/review/review.js +51 -1
  59. package/lib/review/review.ts +6 -1
  60. package/lib/tools/setup-review.js +7 -4
  61. package/lib/tools/setup-review.ts +2 -2
  62. package/package.json +1 -1
  63. package/px.js +26 -14
@@ -80,6 +80,18 @@ var __importStar = (this && this.__importStar) || (function () {
80
80
  return result;
81
81
  };
82
82
  })();
83
+ Object.defineProperty(exports, "__esModule", { value: true });
84
+ exports.DEFAULT_TEST_TIMEOUT_MS = exports.COVERAGE_INCLUDES = exports.COVERAGE_EXCLUDES = void 0;
85
+ exports.run = run;
86
+ exports.cleanupPerRunScratch = cleanupPerRunScratch;
87
+ exports.createPerRunScratchDirs = createPerRunScratchDirs;
88
+ exports.discoverTestFiles = discoverTestFiles;
89
+ exports.listTempEntries = listTempEntries;
90
+ exports.registerExitHandlers = registerExitHandlers;
91
+ exports.resetPerRunScratchState = resetPerRunScratchState;
92
+ exports.resolveTestTimeoutMs = resolveTestTimeoutMs;
93
+ exports.runTests = runTests;
94
+ exports.shouldCleanTempDir = shouldCleanTempDir;
83
95
  const node_child_process_1 = require("node:child_process");
84
96
  const fs = __importStar(require("node:fs"));
85
97
  const os = __importStar(require("node:os"));
@@ -109,6 +121,7 @@ const COVERAGE_INCLUDES = [
109
121
  'index.js',
110
122
  'lib/**/*.js'
111
123
  ];
124
+ exports.COVERAGE_INCLUDES = COVERAGE_INCLUDES;
112
125
  const COVERAGE_EXCLUDES = [
113
126
  'test/**',
114
127
  'prompts/**',
@@ -116,10 +129,12 @@ const COVERAGE_EXCLUDES = [
116
129
  '.workflow/**',
117
130
  'node_modules/**'
118
131
  ];
132
+ exports.COVERAGE_EXCLUDES = COVERAGE_EXCLUDES;
119
133
  // The full suite regularly exceeds 10 minutes in this repository, especially
120
134
  // under cold caches. Keep the gate generous so it can finish without a manual
121
135
  // override while still failing on real hangs.
122
136
  const DEFAULT_TEST_TIMEOUT_MS = 3_600_000;
137
+ exports.DEFAULT_TEST_TIMEOUT_MS = DEFAULT_TEST_TIMEOUT_MS;
123
138
  const PER_RUN_SCRATCH = [];
124
139
  let threshold = 90;
125
140
  let dryRun = false;
@@ -387,4 +402,7 @@ run.resetPerRunScratchState = resetPerRunScratchState;
387
402
  run.resolveTestTimeoutMs = resolveTestTimeoutMs;
388
403
  run.runTests = runTests;
389
404
  run.shouldCleanTempDir = shouldCleanTempDir;
390
- module.exports = run;
405
+ exports.default = run;
406
+ if (typeof module !== 'undefined') {
407
+ module.exports = run;
408
+ }
@@ -359,4 +359,9 @@ function run(args: string[], options: CoverageGateOptions = {}) {
359
359
  (run as any).resolveTestTimeoutMs = resolveTestTimeoutMs;
360
360
  (run as any).runTests = runTests;
361
361
  (run as any).shouldCleanTempDir = shouldCleanTempDir;
362
- export = run;
362
+ export default run;
363
+ export { run, cleanupPerRunScratch, createPerRunScratchDirs, COVERAGE_EXCLUDES, COVERAGE_INCLUDES, DEFAULT_TEST_TIMEOUT_MS, discoverTestFiles, listTempEntries, registerExitHandlers, resetPerRunScratchState, resolveTestTimeoutMs, runTests, shouldCleanTempDir };
364
+
365
+ // CJS compat: ensure require() returns the function directly
366
+ declare const module: { exports: any } | undefined;
367
+ if (typeof module !== 'undefined') { module.exports = run; }
@@ -35,6 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.diff = diff;
38
40
  const node_child_process_1 = __importDefault(require("node:child_process"));
39
41
  const node_path_1 = __importDefault(require("node:path"));
40
42
  const git_js_1 = require("../core/git.js");
@@ -143,4 +145,7 @@ async function diff(args, { gitFn = git_js_1.git, spawnSyncFn = node_child_proce
143
145
  fmt.log.info(`Refer to ${fmt.path('docs/developer-setup/review-tooling.md')} for setup guidance.`);
144
146
  exitFn(1);
145
147
  }
146
- module.exports = diff;
148
+ exports.default = diff;
149
+ if (typeof module !== 'undefined') {
150
+ module.exports = diff;
151
+ }
@@ -122,4 +122,9 @@ async function diff(args: any, {
122
122
  exitFn(1);
123
123
  }
124
124
 
125
- export = diff;
125
+ export default diff;
126
+ export { diff };
127
+
128
+ // CJS compat: ensure require() returns the function directly
129
+ declare const module: { exports: any } | undefined;
130
+ if (typeof module !== 'undefined') { module.exports = diff; }
@@ -32,6 +32,32 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.draft = void 0;
37
+ exports.runDraftCommand = runDraftCommand;
38
+ exports.recordDraftStats = recordDraftStats;
39
+ exports.buildDraftPrompt = buildDraftPrompt;
40
+ exports.recordDraftImplementer = recordDraftImplementer;
41
+ exports.enforceDraftCommitSafety = enforceDraftCommitSafety;
42
+ exports.fallbackDraftCommitMessage = fallbackDraftCommitMessage;
43
+ exports.bootstrapBacklogTask = bootstrapBacklogTask;
44
+ exports.ensureGraphifyWorkspace = ensureGraphifyWorkspace;
45
+ exports.ensureGraphifyIgnore = ensureGraphifyIgnore;
46
+ exports.ensureMissionBranch = ensureMissionBranch;
47
+ exports.ensureMissionBaseBranchRecorded = ensureMissionBaseBranchRecorded;
48
+ exports.ensureWorktree = ensureWorktree;
49
+ exports.ensureMissionFile = ensureMissionFile;
50
+ exports.ensureDraftRepoConfigCommitted = ensureDraftRepoConfigCommitted;
51
+ exports.ensureRepoExists = ensureRepoExists;
52
+ exports.classifyDraftEntries = classifyDraftEntries;
53
+ exports.isUnmergedStatus = isUnmergedStatus;
54
+ exports.isDeletedStatus = isDeletedStatus;
55
+ exports.isMissionTaskPath = isMissionTaskPath;
56
+ exports.isExpectedDraftPath = isExpectedDraftPath;
57
+ exports.validateDraftClassification = validateDraftClassification;
58
+ exports.normalizeDraftClassification = normalizeDraftClassification;
59
+ exports.buildRestartPrompt = buildRestartPrompt;
60
+ exports.restartDraftAgent = restartDraftAgent;
35
61
  // @ts-nocheck
36
62
  const fs = __importStar(require("node:fs"));
37
63
  const path = __importStar(require("node:path"));
@@ -887,4 +913,8 @@ function recordDraftStats({ slug, rootDir, agentFamily, result, log = fmt.log.pl
887
913
  }
888
914
  /** @type {typeof draft & {draft: typeof draft, runDraftCommand: typeof runDraftCommand, recordDraftStats: typeof recordDraftStats, buildDraftPrompt: typeof buildDraftPrompt, recordDraftImplementer: typeof recordDraftImplementer, enforceDraftCommitSafety: typeof enforceDraftCommitSafety, fallbackDraftCommitMessage: typeof fallbackDraftCommitMessage, bootstrapBacklogTask: typeof bootstrapBacklogTask, ensureGraphifyWorkspace: typeof ensureGraphifyWorkspace, ensureGraphifyIgnore: typeof ensureGraphifyIgnore, ensureMissionBranch: typeof ensureMissionBranch, ensureMissionBaseBranchRecorded: typeof ensureMissionBaseBranchRecorded, ensureWorktree: typeof ensureWorktree, ensureMissionFile: typeof ensureMissionFile, ensureDraftRepoConfigCommitted: typeof ensureDraftRepoConfigCommitted, ensureRepoExists: typeof ensureRepoExists, classifyDraftEntries: typeof classifyDraftEntries, isUnmergedStatus: typeof isUnmergedStatus, isDeletedStatus: typeof isDeletedStatus, isMissionTaskPath: typeof isMissionTaskPath, isExpectedDraftPath: typeof isExpectedDraftPath, validateDraftClassification: typeof validateDraftClassification, normalizeDraftClassification: typeof normalizeDraftClassification, buildRestartPrompt: typeof buildRestartPrompt, restartDraftAgent: typeof restartDraftAgent}} */
889
915
  const _draftExport = Object.assign(draft, { draft, runDraftCommand, recordDraftStats, buildDraftPrompt, recordDraftImplementer, enforceDraftCommitSafety, fallbackDraftCommitMessage, bootstrapBacklogTask, ensureGraphifyWorkspace, ensureGraphifyIgnore, ensureMissionBranch, ensureMissionBaseBranchRecorded, ensureWorktree, ensureMissionFile, ensureDraftRepoConfigCommitted, ensureRepoExists, classifyDraftEntries, isUnmergedStatus, isDeletedStatus, isMissionTaskPath, isExpectedDraftPath, validateDraftClassification, normalizeDraftClassification, buildRestartPrompt, restartDraftAgent });
890
- module.exports = _draftExport;
916
+ exports.draft = _draftExport;
917
+ exports.default = _draftExport;
918
+ if (typeof module !== 'undefined') {
919
+ module.exports = _draftExport;
920
+ }
@@ -1018,4 +1018,9 @@ function recordDraftStats({ slug, rootDir, agentFamily, result, log = fmt.log.pl
1018
1018
 
1019
1019
  /** @type {typeof draft & {draft: typeof draft, runDraftCommand: typeof runDraftCommand, recordDraftStats: typeof recordDraftStats, buildDraftPrompt: typeof buildDraftPrompt, recordDraftImplementer: typeof recordDraftImplementer, enforceDraftCommitSafety: typeof enforceDraftCommitSafety, fallbackDraftCommitMessage: typeof fallbackDraftCommitMessage, bootstrapBacklogTask: typeof bootstrapBacklogTask, ensureGraphifyWorkspace: typeof ensureGraphifyWorkspace, ensureGraphifyIgnore: typeof ensureGraphifyIgnore, ensureMissionBranch: typeof ensureMissionBranch, ensureMissionBaseBranchRecorded: typeof ensureMissionBaseBranchRecorded, ensureWorktree: typeof ensureWorktree, ensureMissionFile: typeof ensureMissionFile, ensureDraftRepoConfigCommitted: typeof ensureDraftRepoConfigCommitted, ensureRepoExists: typeof ensureRepoExists, classifyDraftEntries: typeof classifyDraftEntries, isUnmergedStatus: typeof isUnmergedStatus, isDeletedStatus: typeof isDeletedStatus, isMissionTaskPath: typeof isMissionTaskPath, isExpectedDraftPath: typeof isExpectedDraftPath, validateDraftClassification: typeof validateDraftClassification, normalizeDraftClassification: typeof normalizeDraftClassification, buildRestartPrompt: typeof buildRestartPrompt, restartDraftAgent: typeof restartDraftAgent}} */
1020
1020
  const _draftExport = Object.assign(draft, { draft, runDraftCommand, recordDraftStats, buildDraftPrompt, recordDraftImplementer, enforceDraftCommitSafety, fallbackDraftCommitMessage, bootstrapBacklogTask, ensureGraphifyWorkspace, ensureGraphifyIgnore, ensureMissionBranch, ensureMissionBaseBranchRecorded, ensureWorktree, ensureMissionFile, ensureDraftRepoConfigCommitted, ensureRepoExists, classifyDraftEntries, isUnmergedStatus, isDeletedStatus, isMissionTaskPath, isExpectedDraftPath, validateDraftClassification, normalizeDraftClassification, buildRestartPrompt, restartDraftAgent });
1021
- export = _draftExport;
1021
+ export default _draftExport;
1022
+ export { _draftExport as draft, draft, runDraftCommand, recordDraftStats, buildDraftPrompt, recordDraftImplementer, enforceDraftCommitSafety, fallbackDraftCommitMessage, bootstrapBacklogTask, ensureGraphifyWorkspace, ensureGraphifyIgnore, ensureMissionBranch, ensureMissionBaseBranchRecorded, ensureWorktree, ensureMissionFile, ensureDraftRepoConfigCommitted, ensureRepoExists, classifyDraftEntries, isUnmergedStatus, isDeletedStatus, isMissionTaskPath, isExpectedDraftPath, validateDraftClassification, normalizeDraftClassification, buildRestartPrompt, restartDraftAgent };
1023
+
1024
+ // CJS compat: ensure require() returns the function directly
1025
+ declare const module: { exports: any } | undefined;
1026
+ if (typeof module !== 'undefined') { module.exports = _draftExport; }
@@ -32,6 +32,12 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.gatekeeper = exports.handoff = void 0;
37
+ exports.verifyHandoff = verifyHandoff;
38
+ exports.performHandoff = performHandoff;
39
+ exports.runDeclaredGates = runDeclaredGates;
40
+ exports.captureNelAtHandoff = captureNelAtHandoff;
35
41
  // @ts-nocheck
36
42
  const fs = __importStar(require("node:fs"));
37
43
  const path = __importStar(require("node:path"));
@@ -43,6 +49,7 @@ const forgejo = __importStar(require("../tools/forgejo.js"));
43
49
  const review_state_js_1 = require("../review/review-state.js");
44
50
  const setupReview = __importStar(require("../tools/setup-review.js"));
45
51
  const gatekeeper = __importStar(require("../tools/gatekeeper.js"));
52
+ exports.gatekeeper = gatekeeper;
46
53
  const fmt = __importStar(require("../core/fmt.js"));
47
54
  const verification_js_1 = require("../core/verification.js");
48
55
  const product_config_js_1 = require("../core/product-config.js");
@@ -666,4 +673,8 @@ const _exports = {
666
673
  const _namedExports = { verifyHandoff, performHandoff, gatekeeper, runDeclaredGates, captureNelAtHandoff };
667
674
  /** @type {typeof handoffCommand & {verifyHandoff: typeof verifyHandoff, performHandoff: typeof performHandoff, gatekeeper: typeof gatekeeper, runDeclaredGates: typeof runDeclaredGates, captureNelAtHandoff: typeof captureNelAtHandoff}} */
668
675
  const _handoffExport = Object.assign(handoffCommand, _namedExports);
669
- module.exports = _handoffExport;
676
+ exports.handoff = _handoffExport;
677
+ exports.default = _handoffExport;
678
+ if (typeof module !== 'undefined') {
679
+ module.exports = _handoffExport;
680
+ }
@@ -691,4 +691,9 @@ const _exports = {
691
691
  const _namedExports = { verifyHandoff, performHandoff, gatekeeper, runDeclaredGates, captureNelAtHandoff };
692
692
  /** @type {typeof handoffCommand & {verifyHandoff: typeof verifyHandoff, performHandoff: typeof performHandoff, gatekeeper: typeof gatekeeper, runDeclaredGates: typeof runDeclaredGates, captureNelAtHandoff: typeof captureNelAtHandoff}} */
693
693
  const _handoffExport = Object.assign(handoffCommand, _namedExports);
694
- export = _handoffExport;
694
+ export default _handoffExport;
695
+ export { _handoffExport as handoff, verifyHandoff, performHandoff, gatekeeper, runDeclaredGates, captureNelAtHandoff };
696
+
697
+ // CJS compat: ensure require() returns the function directly
698
+ declare const module: { exports: any } | undefined;
699
+ if (typeof module !== 'undefined') { module.exports = _handoffExport; }
@@ -35,6 +35,43 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.SYNC_MERGED_DIAGNOSTICS = exports.VARIANT_B_AUTOMATION_SUMMARY = exports.getPrimaryWorktree = void 0;
40
+ exports.integrate = integrate;
41
+ exports.formatRecordedStatsRow = formatRecordedStatsRow;
42
+ exports.detectChangedAreas = detectChangedAreas;
43
+ exports.parseFilesToAreas = parseFilesToAreas;
44
+ exports.loadIntegrationConfig = loadIntegrationConfig;
45
+ exports.getIntegrationGatePlan = getIntegrationGatePlan;
46
+ exports.printIntegrationGatePlan = printIntegrationGatePlan;
47
+ exports.buildIntegrationGateEnv = buildIntegrationGateEnv;
48
+ exports.resolveIntegrationVerificationWorktree = resolveIntegrationVerificationWorktree;
49
+ exports.buildIntegrationVerificationInvocation = buildIntegrationVerificationInvocation;
50
+ exports.executeIntegrationGates = executeIntegrationGates;
51
+ exports.orderIntegrationGates = orderIntegrationGates;
52
+ exports.gateMatchesChangedAreas = gateMatchesChangedAreas;
53
+ exports.buildIntegrationContext = buildIntegrationContext;
54
+ exports.resolveConflictsForMission = resolveConflictsForMission;
55
+ exports.cleanupMissionWorktree = cleanupMissionWorktree;
56
+ exports.rewriteWorktreePaths = rewriteWorktreePaths;
57
+ exports.finalizeVariantACloseout = finalizeVariantACloseout;
58
+ exports.isNoMergeToAbortResult = isNoMergeToAbortResult;
59
+ exports.buildConflictResolutionPrompt = buildConflictResolutionPrompt;
60
+ exports.stashMainCheckoutIfNeeded = stashMainCheckoutIfNeeded;
61
+ exports.restoreMainCheckoutStash = restoreMainCheckoutStash;
62
+ exports.evaluateTaskStatusForIntegration = evaluateTaskStatusForIntegration;
63
+ exports.promoteTaskForIntegrationIfNeeded = promoteTaskForIntegrationIfNeeded;
64
+ exports.findExistingSquashCommit = findExistingSquashCommit;
65
+ exports.printIntegrationPreflight = printIntegrationPreflight;
66
+ exports.resolveForgejoUserForIntegration = resolveForgejoUserForIntegration;
67
+ exports.getUnresolvedIndexConflicts = getUnresolvedIndexConflicts;
68
+ exports.parseStashPopCollisionFiles = parseStashPopCollisionFiles;
69
+ exports.reportStashPopFailure = reportStashPopFailure;
70
+ exports.maybeUpdateGraphifyOnPrimary = maybeUpdateGraphifyOnPrimary;
71
+ exports.printDiagnosticTable = printDiagnosticTable;
72
+ exports.recordPostIntegrationStats = recordPostIntegrationStats;
73
+ exports.recordPostIntegrationStatsOrAbort = recordPostIntegrationStatsOrAbort;
74
+ exports.reportSyncMergedFailure = reportSyncMergedFailure;
38
75
  const node_fs_1 = __importDefault(require("node:fs"));
39
76
  const node_os_1 = __importDefault(require("node:os"));
40
77
  const node_path_1 = __importDefault(require("node:path"));
@@ -46,12 +83,14 @@ const forgejo_js_1 = require("../tools/forgejo.js");
46
83
  const fmt = __importStar(require("../core/fmt.js"));
47
84
  const runtime_matrix_js_1 = require("../core/runtime-matrix.js");
48
85
  const mission_utils_js_1 = require("../core/mission-utils.js");
86
+ Object.defineProperty(exports, "getPrimaryWorktree", { enumerable: true, get: function () { return mission_utils_js_1.getPrimaryWorktree; } });
49
87
  const stats_js_1 = __importDefault(require("./stats.js"));
50
88
  const verification = __importStar(require("../core/verification.js"));
51
89
  const { formatVerificationCommand } = verification;
52
90
  const product_config_js_1 = require("../core/product-config.js");
53
91
  const review_state_js_1 = require("../review/review-state.js");
54
92
  const VARIANT_B_AUTOMATION_SUMMARY = 'Variant B automation: Backlog task closeout, worktree-path rewrite, squash commit with hook-enforced validation, Forgejo sync-merged, and mission worktree cleanup.';
93
+ exports.VARIANT_B_AUTOMATION_SUMMARY = VARIANT_B_AUTOMATION_SUMMARY;
55
94
  /** @type{{symptom: string, cause: string, fix: string}[]} */
56
95
  const SYNC_MERGED_DIAGNOSTICS = [
57
96
  { symptom: 'sync-merged reports generic failure; PR still open', cause: 'allow_manual_merge disabled or drifted off in Forgejo settings', fix: 'Enable "Allow manual merge" in Forgejo PR settings and retry.' },
@@ -60,6 +99,7 @@ const SYNC_MERGED_DIAGNOSTICS = [
60
99
  { symptom: 'curl: (7) Failed to connect to localhost port 3300', cause: 'Forgejo service not reachable from current runtime (sandbox/network)', fix: 'Ensure Forgejo is running (scripts/start-runner.sh) or use FORGEJO_URL override if external.' },
61
100
  { symptom: 'PR marked merged but remote branch still exists', cause: 'Remote branch deletion failed (permissions or network)', fix: 'px review <slug> --close (to trigger cleanup; identity resolves from review-state).' }
62
101
  ];
102
+ exports.SYNC_MERGED_DIAGNOSTICS = SYNC_MERGED_DIAGNOSTICS;
63
103
  /** @extends{Error} */
64
104
  class IntegrationAbort extends Error {
65
105
  }
@@ -280,18 +320,73 @@ function detectChangedAreas(slug, opts = {}) {
280
320
  function parseFilesToAreas(filesOutput) {
281
321
  const areas = new Set();
282
322
  const knownAreas = ['lib', 'server', 'auth-server', 'web-client', 'docs', 'workflow', 'android', 'kubernetes'];
323
+ const workflowOwnedDirs = new Set(['test', 'scripts', 'config', 'prompts', 'data']);
324
+ const workflowRootFiles = new Set([
325
+ 'px.ts',
326
+ 'px.js',
327
+ 'index.ts',
328
+ 'index.js',
329
+ 'package.json',
330
+ 'package-lock.json',
331
+ 'workflow.config.json',
332
+ 'tsconfig.json',
333
+ 'tsconfig.base.json',
334
+ 'eslint.config.js',
335
+ 'eslint.config.mjs',
336
+ 'eslint.config.cjs'
337
+ ]);
283
338
  filesOutput.split('\n').forEach((file) => {
284
339
  file = file.trim();
285
340
  if (!file) {
286
341
  return;
287
342
  }
343
+ if (!file.includes('/')) {
344
+ if (workflowRootFiles.has(file)) {
345
+ areas.add('workflow');
346
+ }
347
+ return;
348
+ }
288
349
  const topDir = file.split('/')[0];
289
350
  if (knownAreas.includes(topDir)) {
290
351
  areas.add(topDir);
352
+ return;
353
+ }
354
+ if (workflowOwnedDirs.has(topDir)) {
355
+ areas.add('workflow');
291
356
  }
292
357
  });
293
358
  return Array.from(areas);
294
359
  }
360
+ /** @param {{gates?: Record<string, any>}} config */
361
+ function orderIntegrationGates(config) {
362
+ const gateEntries = Object.entries(config.gates || {});
363
+ const gates = gateEntries
364
+ .map(([key, value]) => ({
365
+ key,
366
+ command: value.command,
367
+ order: value.order || 0,
368
+ run_last: value.run_last || false
369
+ }));
370
+ const nonRunLast = gates.filter(g => !g.run_last).sort((a, b) => a.order - b.order);
371
+ const runLastGates = gates.filter(g => g.run_last).sort((a, b) => a.order - b.order);
372
+ return [...nonRunLast, ...runLastGates];
373
+ }
374
+ /** @param {string} gateKey @param {string[]} changedAreas */
375
+ function gateMatchesChangedAreas(gateKey, changedAreas) {
376
+ if (changedAreas.length === 0) {
377
+ return true;
378
+ }
379
+ if (changedAreas.includes(gateKey)) {
380
+ return true;
381
+ }
382
+ if (gateKey === 'web-e2e') {
383
+ return changedAreas.includes('web-client');
384
+ }
385
+ if (gateKey === 'workflow') {
386
+ return changedAreas.includes('workflow') || changedAreas.includes('lib');
387
+ }
388
+ return false;
389
+ }
295
390
  /**
296
391
  * Load integration pipelines config from repo-side file
297
392
  */
@@ -338,32 +433,8 @@ function getIntegrationGatePlan(slug, opts = {}) {
338
433
  return { gates: [], changedAreas: [], configError: null };
339
434
  }
340
435
  // Build list of gates to run, preserving order with run_last handling
341
- const gateEntries = Object.entries(config.gates);
342
- const gates = gateEntries
343
- .map(([key, value]) => ({
344
- key,
345
- command: value.command,
346
- order: value.order || 0,
347
- run_last: value.run_last || false
348
- }));
349
- // Separate into run_last and non-run_last, sort each by order
350
- const nonRunLast = gates.filter(g => !g.run_last).sort((a, b) => a.order - b.order);
351
- const runLastGates = gates.filter(g => g.run_last).sort((a, b) => a.order - b.order);
352
- // Combine: non-run_last first (by order), then run_last (by order)
353
- const orderedGates = [...nonRunLast, ...runLastGates];
354
- // Filter to only relevant gates (based on changed areas)
355
- const relevantGates = [];
356
- for (const gate of orderedGates) {
357
- // Always include web-e2e if web-client changed
358
- if (gate.key === 'web-e2e') {
359
- if (changedAreas.includes('web-client') || changedAreas.length === 0) {
360
- relevantGates.push(gate);
361
- }
362
- }
363
- else if (changedAreas.includes(gate.key) || changedAreas.length === 0) {
364
- relevantGates.push(gate);
365
- }
366
- }
436
+ const orderedGates = orderIntegrationGates(config);
437
+ const relevantGates = orderedGates.filter(gate => gateMatchesChangedAreas(gate.key, changedAreas));
367
438
  return { gates: relevantGates, changedAreas, configError: null };
368
439
  }
369
440
  /**
@@ -1530,7 +1601,12 @@ integrate.buildIntegrationGateEnv = buildIntegrationGateEnv;
1530
1601
  integrate.resolveIntegrationVerificationWorktree = resolveIntegrationVerificationWorktree;
1531
1602
  integrate.buildIntegrationVerificationInvocation = buildIntegrationVerificationInvocation;
1532
1603
  integrate.executeIntegrationGates = executeIntegrationGates;
1604
+ integrate.orderIntegrationGates = orderIntegrationGates;
1605
+ integrate.gateMatchesChangedAreas = gateMatchesChangedAreas;
1533
1606
  integrate.buildIntegrationContext = buildIntegrationContext;
1534
1607
  // Re-export getPrimaryWorktree from mission-utils
1535
1608
  integrate.getPrimaryWorktree = mission_utils_js_1.getPrimaryWorktree;
1536
- module.exports = (integrate);
1609
+ exports.default = integrate;
1610
+ if (typeof module !== 'undefined') {
1611
+ module.exports = integrate;
1612
+ }
@@ -268,21 +268,75 @@ function detectChangedAreas(slug: string, opts: {gitRunner?: Function, rootDir?:
268
268
  */
269
269
  /** @param {string} filesOutput */
270
270
  function parseFilesToAreas(filesOutput: string) {
271
- const areas = new Set();
271
+ const areas = new Set<string>();
272
272
  const knownAreas = ['lib', 'server', 'auth-server', 'web-client', 'docs', 'workflow', 'android', 'kubernetes'];
273
+ const workflowOwnedDirs = new Set(['test', 'scripts', 'config', 'prompts', 'data']);
274
+ const workflowRootFiles = new Set([
275
+ 'px.ts',
276
+ 'px.js',
277
+ 'index.ts',
278
+ 'index.js',
279
+ 'package.json',
280
+ 'package-lock.json',
281
+ 'workflow.config.json',
282
+ 'tsconfig.json',
283
+ 'tsconfig.base.json',
284
+ 'eslint.config.js',
285
+ 'eslint.config.mjs',
286
+ 'eslint.config.cjs'
287
+ ]);
273
288
 
274
289
  filesOutput.split('\n').forEach((file: string) => {
275
290
  file = file.trim();
276
291
  if (!file) {return;}
292
+ if (!file.includes('/')) {
293
+ if (workflowRootFiles.has(file)) {
294
+ areas.add('workflow');
295
+ }
296
+ return;
297
+ }
277
298
  const topDir = file.split('/')[0];
278
299
  if (knownAreas.includes(topDir)) {
279
300
  areas.add(topDir);
301
+ return;
302
+ }
303
+ if (workflowOwnedDirs.has(topDir)) {
304
+ areas.add('workflow');
280
305
  }
281
306
  });
282
307
 
283
308
  return Array.from(areas);
284
309
  }
285
310
 
311
+ /** @param {{gates?: Record<string, any>}} config */
312
+ function orderIntegrationGates(config: {gates?: Record<string, any>}) {
313
+ const gateEntries = Object.entries(config.gates || {});
314
+ const gates = gateEntries
315
+ .map(([key, value]: [string, any]) => ({
316
+ key,
317
+ command: value.command,
318
+ order: value.order || 0,
319
+ run_last: value.run_last || false
320
+ }));
321
+
322
+ const nonRunLast = gates.filter(g => !g.run_last).sort((a, b) => a.order - b.order);
323
+ const runLastGates = gates.filter(g => g.run_last).sort((a, b) => a.order - b.order);
324
+ return [...nonRunLast, ...runLastGates];
325
+ }
326
+
327
+ /** @param {string} gateKey @param {string[]} changedAreas */
328
+ function gateMatchesChangedAreas(gateKey: string, changedAreas: string[]) {
329
+ if (changedAreas.length === 0) {return true;}
330
+ if (changedAreas.includes(gateKey)) {return true;}
331
+ if (gateKey === 'web-e2e') {
332
+ return changedAreas.includes('web-client');
333
+ }
334
+ if (gateKey === 'workflow') {
335
+ return changedAreas.includes('workflow') || changedAreas.includes('lib');
336
+ }
337
+ return false;
338
+ }
339
+
286
340
  /**
287
341
  * Load integration pipelines config from repo-side file
288
342
  */
@@ -334,34 +388,8 @@ function getIntegrationGatePlan(slug: string, opts: {runIntegrationGates?: boole
334
388
  }
335
389
 
336
390
  // Build list of gates to run, preserving order with run_last handling
337
- const gateEntries = Object.entries(config.gates);
338
- const gates = gateEntries
339
- .map(([key, value]: [string, any]) => ({
340
- key,
341
- command: value.command,
342
- order: value.order || 0,
343
- run_last: value.run_last || false
344
- }));
345
-
346
- // Separate into run_last and non-run_last, sort each by order
347
- const nonRunLast = gates.filter(g => !g.run_last).sort((a, b) => a.order - b.order);
348
- const runLastGates = gates.filter(g => g.run_last).sort((a, b) => a.order - b.order);
349
-
350
- // Combine: non-run_last first (by order), then run_last (by order)
351
- const orderedGates = [...nonRunLast, ...runLastGates];
352
-
353
- // Filter to only relevant gates (based on changed areas)
354
- const relevantGates = [];
355
- for (const gate of orderedGates) {
356
- // Always include web-e2e if web-client changed
357
- if (gate.key === 'web-e2e') {
358
- if (changedAreas.includes('web-client') || changedAreas.length === 0) {
359
- relevantGates.push(gate);
360
- }
361
- } else if (changedAreas.includes(gate.key) || changedAreas.length === 0) {
362
- relevantGates.push(gate);
363
- }
364
- }
391
+ const orderedGates = orderIntegrationGates(config);
392
+ const relevantGates = orderedGates.filter(gate => gateMatchesChangedAreas(gate.key, changedAreas));
365
393
 
366
394
  return { gates: relevantGates, changedAreas, configError: null };
367
395
  }
@@ -458,7 +486,7 @@ async function executeIntegrationGates(gates: any, opts: {commandRunner?: Functi
458
486
  return { ok: true, failedGate: null, error: null };
459
487
  }
460
488
 
461
- interface IntegrateFn extends Function {
489
+ export interface IntegrateFn extends Function {
462
490
  resolveConflictsForMission: typeof resolveConflictsForMission;
463
491
  cleanupMissionWorktree: typeof cleanupMissionWorktree;
464
492
  rewriteWorktreePaths: typeof rewriteWorktreePaths;
@@ -492,6 +520,8 @@ interface IntegrateFn extends Function {
492
520
  resolveIntegrationVerificationWorktree: typeof resolveIntegrationVerificationWorktree;
493
521
  buildIntegrationVerificationInvocation: typeof buildIntegrationVerificationInvocation;
494
522
  executeIntegrationGates: typeof executeIntegrationGates;
523
+ orderIntegrationGates: typeof orderIntegrationGates;
524
+ gateMatchesChangedAreas: typeof gateMatchesChangedAreas;
495
525
  buildIntegrationContext: typeof buildIntegrationContext;
496
526
  getPrimaryWorktree: typeof getPrimaryWorktree;
497
527
  }
@@ -1682,7 +1712,13 @@ function buildConflictResolutionPrompt(slug: string = '<slug>', area: string = '
1682
1712
  (integrate as any).resolveIntegrationVerificationWorktree = resolveIntegrationVerificationWorktree;
1683
1713
  (integrate as any).buildIntegrationVerificationInvocation = buildIntegrationVerificationInvocation;
1684
1714
  (integrate as any).executeIntegrationGates = executeIntegrationGates;
1715
+ (integrate as any).orderIntegrationGates = orderIntegrationGates;
1716
+ (integrate as any).gateMatchesChangedAreas = gateMatchesChangedAreas;
1685
1717
  (integrate as any).buildIntegrationContext = buildIntegrationContext;
1686
1718
  // Re-export getPrimaryWorktree from mission-utils
1687
1719
  (integrate as any).getPrimaryWorktree = getPrimaryWorktree;
1688
- export = /** @type {any} */ (integrate) as unknown as IntegrateFn;
1720
+ export default integrate;
1721
+ export { integrate, formatRecordedStatsRow, detectChangedAreas, parseFilesToAreas, loadIntegrationConfig, getIntegrationGatePlan, printIntegrationGatePlan, buildIntegrationGateEnv, resolveIntegrationVerificationWorktree, buildIntegrationVerificationInvocation, executeIntegrationGates, orderIntegrationGates, gateMatchesChangedAreas, buildIntegrationContext, getPrimaryWorktree, resolveConflictsForMission, cleanupMissionWorktree, rewriteWorktreePaths, finalizeVariantACloseout, isNoMergeToAbortResult, buildConflictResolutionPrompt, VARIANT_B_AUTOMATION_SUMMARY, stashMainCheckoutIfNeeded, restoreMainCheckoutStash, evaluateTaskStatusForIntegration, promoteTaskForIntegrationIfNeeded, findExistingSquashCommit, printIntegrationPreflight, resolveForgejoUserForIntegration, getUnresolvedIndexConflicts, parseStashPopCollisionFiles, reportStashPopFailure, maybeUpdateGraphifyOnPrimary, SYNC_MERGED_DIAGNOSTICS, printDiagnosticTable, recordPostIntegrationStats, recordPostIntegrationStatsOrAbort, reportSyncMergedFailure };
1722
+ // CJS compat: ensure require() returns the function directly
1723
+ declare const module: { exports: any } | undefined;
1724
+ if (typeof module !== 'undefined') { module.exports = integrate; }
@@ -32,6 +32,12 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ var __importDefault = (this && this.__importDefault) || function (mod) {
36
+ return (mod && mod.__esModule) ? mod : { "default": mod };
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.missionStart = missionStart;
40
+ exports.completePreflightOrExit = completePreflightOrExit;
35
41
  const fs = __importStar(require("node:fs"));
36
42
  const path = __importStar(require("node:path"));
37
43
  const fmt = __importStar(require("../core/fmt.js"));
@@ -43,7 +49,7 @@ const state_map_js_1 = require("../core/state-map.js");
43
49
  const mission_utils_js_1 = require("../core/mission-utils.js");
44
50
  const forgejo_js_1 = require("../tools/forgejo.js");
45
51
  const product_config_js_2 = require("../core/product-config.js");
46
- const stats = require("./stats.js");
52
+ const stats_js_1 = __importDefault(require("./stats.js"));
47
53
  /** @param {string[]} args @param {{log?: Function, error?: Function, cwdFn?: Function, getCurrentBranchFn?: Function, resolveTaskFileFn?: Function, getTaskStatusFn?: Function, toVirtualFn?: Function, findMissionDirFn?: Function, findCheckpointsFn?: Function, getFirstLineFn?: Function, inferSlugFn?: Function, getMissionYearFn?: Function, conventionalWorktreePathFn?: Function, getLastCommitFn?: Function, getPrStatusFn?: Function, evaluateRepositoryReadinessFn?: Function, evaluateReviewSetupFn?: Function, adapterChecklistFn?: Function, resolveMissionClassificationFn?: Function, isForgejoReviewEnabledFn?: Function, fsExistsSync?: Function, resolveMissionBaseBranchFn?: Function, getPrimaryBranchFn?: Function, gitFn?: Function, command?: string, returnResult?: boolean}} opts */
48
54
  function missionStart(args, opts = {}) {
49
55
  const log = opts.log || fmt.log.plain;
@@ -64,7 +70,7 @@ function missionStart(args, opts = {}) {
64
70
  const evaluateRepositoryReadinessFn = opts.evaluateRepositoryReadinessFn || product_config_js_1.evaluateRepositoryReadiness;
65
71
  const evaluateReviewSetupFn = opts.evaluateReviewSetupFn || setup_review_js_1.evaluateReviewSetup;
66
72
  const adapterChecklistFn = opts.adapterChecklistFn || product_config_js_1.adapterChecklist;
67
- const resolveMissionClassificationFn = opts.resolveMissionClassificationFn || stats.resolveMissionClassification;
73
+ const resolveMissionClassificationFn = opts.resolveMissionClassificationFn || stats_js_1.default.resolveMissionClassification;
68
74
  const isForgejoReviewEnabledFn = opts.isForgejoReviewEnabledFn || product_config_js_2.isForgejoReviewEnabled;
69
75
  const fsExistsSync = opts.fsExistsSync || fs.existsSync;
70
76
  const resolveMissionBaseBranchFn = opts.resolveMissionBaseBranchFn || mission_utils_js_1.resolveMissionBaseBranch;
@@ -301,4 +307,7 @@ function completePreflightOrExit(overallFail, returnResult, options = {}) {
301
307
  }
302
308
  }
303
309
  missionStart.completePreflightOrExit = completePreflightOrExit;
304
- module.exports = missionStart;
310
+ exports.default = missionStart;
311
+ if (typeof module !== 'undefined') {
312
+ module.exports = missionStart;
313
+ }
@@ -9,7 +9,7 @@ import { toVirtual } from '../core/state-map.js';
9
9
  import { findMissionDir, findCheckpoints, getFirstLine, inferSlug, getMissionYear, conventionalWorktreePath, resolveMissionBaseBranch, getPrimaryBranch } from '../core/mission-utils.js';
10
10
  import { getPrStatus } from '../tools/forgejo.js';
11
11
  import { isForgejoReviewEnabled } from '../core/product-config.js';
12
- import stats = require('./stats.js');
12
+ import stats from './stats.js';
13
13
 
14
14
  /** @param {string[]} args @param {{log?: Function, error?: Function, cwdFn?: Function, getCurrentBranchFn?: Function, resolveTaskFileFn?: Function, getTaskStatusFn?: Function, toVirtualFn?: Function, findMissionDirFn?: Function, findCheckpointsFn?: Function, getFirstLineFn?: Function, inferSlugFn?: Function, getMissionYearFn?: Function, conventionalWorktreePathFn?: Function, getLastCommitFn?: Function, getPrStatusFn?: Function, evaluateRepositoryReadinessFn?: Function, evaluateReviewSetupFn?: Function, adapterChecklistFn?: Function, resolveMissionClassificationFn?: Function, isForgejoReviewEnabledFn?: Function, fsExistsSync?: Function, resolveMissionBaseBranchFn?: Function, getPrimaryBranchFn?: Function, gitFn?: Function, command?: string, returnResult?: boolean}} opts */
15
15
  function missionStart(args: string[], opts: { log?: Function, error?: Function, cwdFn?: Function, getCurrentBranchFn?: Function, resolveTaskFileFn?: Function, getTaskStatusFn?: Function, toVirtualFn?: Function, findMissionDirFn?: Function, findCheckpointsFn?: Function, getFirstLineFn?: Function, inferSlugFn?: Function, getMissionYearFn?: Function, conventionalWorktreePathFn?: Function, getLastCommitFn?: Function, getPrStatusFn?: Function, evaluateRepositoryReadinessFn?: Function, evaluateReviewSetupFn?: Function, adapterChecklistFn?: Function, resolveMissionClassificationFn?: Function, isForgejoReviewEnabledFn?: Function, fsExistsSync?: Function, resolveMissionBaseBranchFn?: Function, getPrimaryBranchFn?: Function, gitFn?: Function, command?: string, returnResult?: boolean } = {}) {
@@ -260,4 +260,9 @@ function completePreflightOrExit(overallFail: boolean, returnResult: boolean, op
260
260
 
261
261
  (missionStart as any).completePreflightOrExit = completePreflightOrExit;
262
262
 
263
- export = missionStart;
263
+ export default missionStart;
264
+ export { missionStart, completePreflightOrExit };
265
+
266
+ // CJS compat: ensure require() returns the function directly
267
+ declare const module: { exports: any } | undefined;
268
+ if (typeof module !== 'undefined') { module.exports = missionStart; }
@@ -35,6 +35,11 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.rebase = rebase;
40
+ exports.buildRebasePrompt = buildRebasePrompt;
41
+ exports.parseConflictFilesFromRebaseOutput = parseConflictFilesFromRebaseOutput;
42
+ exports.parseConflictFilesFromGitStatus = parseConflictFilesFromGitStatus;
38
43
  const node_path_1 = __importDefault(require("node:path"));
39
44
  const git_js_1 = require("../core/git.js");
40
45
  const integrate_js_1 = __importDefault(require("./integrate.js"));
@@ -53,7 +58,7 @@ const verification_js_1 = require("../core/verification.js");
53
58
  * Usage: px rebase [<slug>] [--push]
54
59
  */
55
60
  /** @param {string[]} args @param {{inferSlugFn?: Function, findMissionDirFn?: Function, findMissionAreaFn?: Function, getCurrentBranchFn?: Function, resolveConflictsFn?: Function, startAgentFn?: Function, createPrFn?: Function, readTokenFn?: Function, resolveForgejoUserFn?: Function, resolveTaskFileFn?: Function, getTaskImplementerFn?: Function, detectRebaseStateFn?: Function, resolveMissionBaseBranchFn?: Function, gitFn?: Function, exitFn?: Function, isForgejoReviewEnabledFn?: Function, fetchReviewBranchFn?: Function}} opts */
56
- async function rebase(args, { inferSlugFn = mission_utils_js_1.inferSlug, findMissionDirFn = mission_utils_js_1.findMissionDir, findMissionAreaFn = mission_utils_js_1.findMissionArea, getCurrentBranchFn = git_js_1.getCurrentBranch, resolveConflictsFn = /** @type {import('./integrate.js').IntegrateFn} */ (integrate_js_1.default).resolveConflictsForMission, startAgentFn = agents_js_1.startAgent, createPrFn = forgejo_js_1.createPr, readTokenFn = forgejo_js_1.readToken, resolveForgejoUserFn = forgejo_js_1.resolveForgejoUser, resolveTaskFileFn = backlog_js_1.resolveTaskFile, getTaskImplementerFn = backlog_js_1.getTaskImplementer, detectRebaseStateFn = git_js_1.detectRebaseState, resolveMissionBaseBranchFn = mission_utils_js_1.resolveMissionBaseBranch, gitFn = git_js_1.git, exitFn = ((code) => process.exit(code)), isForgejoReviewEnabledFn = product_config_js_1.isForgejoReviewEnabled, fetchReviewBranchFn = forgejo_js_1.fetchReviewBranch, } = {}) {
61
+ async function rebase(args, { inferSlugFn = mission_utils_js_1.inferSlug, findMissionDirFn = mission_utils_js_1.findMissionDir, findMissionAreaFn = mission_utils_js_1.findMissionArea, getCurrentBranchFn = git_js_1.getCurrentBranch, resolveConflictsFn = integrate_js_1.default.resolveConflictsForMission, startAgentFn = agents_js_1.startAgent, createPrFn = forgejo_js_1.createPr, readTokenFn = forgejo_js_1.readToken, resolveForgejoUserFn = forgejo_js_1.resolveForgejoUser, resolveTaskFileFn = backlog_js_1.resolveTaskFile, getTaskImplementerFn = backlog_js_1.getTaskImplementer, detectRebaseStateFn = git_js_1.detectRebaseState, resolveMissionBaseBranchFn = mission_utils_js_1.resolveMissionBaseBranch, gitFn = git_js_1.git, exitFn = ((code) => process.exit(code)), isForgejoReviewEnabledFn = product_config_js_1.isForgejoReviewEnabled, fetchReviewBranchFn = forgejo_js_1.fetchReviewBranch, } = {}) {
57
62
  const flags = args.filter(a => a.startsWith('--'));
58
63
  const params = args.filter(a => !a.startsWith('--'));
59
64
  const isPush = flags.includes('--push');
@@ -656,4 +661,7 @@ function buildRebasePrompt({ slug, area, worktreePath, missionSpecificFiles, sha
656
661
  rebase.buildRebasePrompt = buildRebasePrompt;
657
662
  rebase.parseConflictFilesFromRebaseOutput = parseConflictFilesFromRebaseOutput;
658
663
  rebase.parseConflictFilesFromGitStatus = parseConflictFilesFromGitStatus;
659
- module.exports = rebase;
664
+ exports.default = rebase;
665
+ if (typeof module !== 'undefined') {
666
+ module.exports = rebase;
667
+ }
@@ -22,7 +22,7 @@ async function rebase(args: string[], {
22
22
  findMissionDirFn = findMissionDir,
23
23
  findMissionAreaFn = findMissionArea,
24
24
  getCurrentBranchFn = getCurrentBranch,
25
- resolveConflictsFn = /** @type {import('./integrate.js').IntegrateFn} */ (integrate).resolveConflictsForMission,
25
+ resolveConflictsFn = (integrate as any).resolveConflictsForMission,
26
26
  startAgentFn = startAgent,
27
27
  createPrFn = createPr,
28
28
  readTokenFn = readToken,
@@ -632,4 +632,8 @@ function buildRebasePrompt({ slug, area, worktreePath, missionSpecificFiles, sha
632
632
  (rebase as any).buildRebasePrompt = buildRebasePrompt;
633
633
  (rebase as any).parseConflictFilesFromRebaseOutput = parseConflictFilesFromRebaseOutput;
634
634
  (rebase as any).parseConflictFilesFromGitStatus = parseConflictFilesFromGitStatus;
635
- export = rebase;
635
+ export default rebase;
636
+ export { rebase, buildRebasePrompt, parseConflictFilesFromRebaseOutput, parseConflictFilesFromGitStatus };
637
+ // CJS compat: ensure require() returns the function directly
638
+ declare const module: { exports: any } | undefined;
639
+ if (typeof module !== 'undefined') { module.exports = rebase; }