@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
@@ -32,9 +32,16 @@ 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.repairHandoff = repairHandoff;
40
+ exports.isRelaunchableError = isRelaunchableError;
41
+ exports.buildRelaunchPrompt = buildRelaunchPrompt;
35
42
  const git_js_1 = require("../core/git.js");
36
43
  const missionUtils = __importStar(require("../core/mission-utils.js"));
37
- const rebase = require("./rebase.js");
44
+ const rebase_js_1 = __importDefault(require("./rebase.js"));
38
45
  const fmt = __importStar(require("../core/fmt.js"));
39
46
  /**
40
47
  * Check if an error message indicates a relaunchable content error (missing/empty goal-check table).
@@ -110,7 +117,7 @@ function buildRelaunchPrompt(errorMsg, slug, worktree) {
110
117
  async function repairHandoff(slug, worktree, errorMsg, options = {}) {
111
118
  /** @type {{gitFn?: Function, rebaseFn?: Function, log?: Function, error?: Function}} */
112
119
  const opts = options;
113
- const { gitFn = git_js_1.git, rebaseFn = rebase, log = fmt.log.plain, error = fmt.log.plainError } = opts;
120
+ const { gitFn = git_js_1.git, rebaseFn = rebase_js_1.default, log = fmt.log.plain, error = fmt.log.plainError } = opts;
114
121
  const rootDir = worktree || process.cwd();
115
122
  let repaired = false;
116
123
  let blocker = null;
@@ -229,4 +236,7 @@ async function repairHandoff(slug, worktree, errorMsg, options = {}) {
229
236
  }
230
237
  repairHandoff.isRelaunchableError = isRelaunchableError;
231
238
  repairHandoff.buildRelaunchPrompt = buildRelaunchPrompt;
232
- module.exports = repairHandoff;
239
+ exports.default = repairHandoff;
240
+ if (typeof module !== 'undefined') {
241
+ module.exports = repairHandoff;
242
+ }
@@ -1,6 +1,6 @@
1
1
  import { git, getCurrentBranch } from '../core/git.js';
2
2
  import * as missionUtils from '../core/mission-utils.js';
3
- import rebase = require('./rebase.js');
3
+ import rebase from './rebase.js';
4
4
  import * as fmt from '../core/fmt.js';
5
5
 
6
6
  /**
@@ -225,4 +225,9 @@ async function repairHandoff(slug: string, worktree: string, errorMsg: string, o
225
225
  (repairHandoff as any).isRelaunchableError = isRelaunchableError;
226
226
  (repairHandoff as any).buildRelaunchPrompt = buildRelaunchPrompt;
227
227
 
228
- export = repairHandoff;
228
+ export default repairHandoff;
229
+ export { repairHandoff, isRelaunchableError, buildRelaunchPrompt };
230
+
231
+ // CJS compat: ensure require() returns the function directly
232
+ declare const module: { exports: any } | undefined;
233
+ if (typeof module !== 'undefined') { module.exports = repairHandoff; }
@@ -35,6 +35,9 @@ 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.resolveConflict = resolveConflict;
40
+ exports.buildAgentResolutionPrompt = buildAgentResolutionPrompt;
38
41
  const integrate_js_1 = __importDefault(require("./integrate.js"));
39
42
  const mission_utils_js_1 = require("../core/mission-utils.js");
40
43
  const agents_js_1 = require("../agents/agents.js");
@@ -77,7 +80,7 @@ function buildAgentResolutionPrompt({ slug, area, worktreePath, missionSpecificF
77
80
  ].join('\n');
78
81
  }
79
82
  /** @param {string[]} args @param {{resolveConflictsFn?: Function, startAgentFn?: Function, exitFn?: Function}} opts */
80
- async function resolveConflict(args, { resolveConflictsFn = /** @type {import('./integrate.js').IntegrateFn} */ (integrate_js_1.default).resolveConflictsForMission, startAgentFn = agents_js_1.startAgent, exitFn = ((code) => process.exit(code)), } = {}) {
83
+ async function resolveConflict(args, { resolveConflictsFn = integrate_js_1.default.resolveConflictsForMission, startAgentFn = agents_js_1.startAgent, exitFn = ((code) => process.exit(code)), } = {}) {
81
84
  const explicitSlug = args[0];
82
85
  const slug = (0, mission_utils_js_1.inferSlug)(explicitSlug);
83
86
  if (!slug) {
@@ -128,4 +131,7 @@ async function resolveConflict(args, { resolveConflictsFn = /** @type {import('.
128
131
  exitFn(0);
129
132
  }
130
133
  resolveConflict.buildAgentResolutionPrompt = buildAgentResolutionPrompt;
131
- module.exports = resolveConflict;
134
+ exports.default = resolveConflict;
135
+ if (typeof module !== 'undefined') {
136
+ module.exports = resolveConflict;
137
+ }
@@ -45,7 +45,7 @@ function buildAgentResolutionPrompt({ slug, area, worktreePath, missionSpecificF
45
45
 
46
46
  /** @param {string[]} args @param {{resolveConflictsFn?: Function, startAgentFn?: Function, exitFn?: Function}} opts */
47
47
  async function resolveConflict(args: string[], {
48
- resolveConflictsFn = /** @type {import('./integrate.js').IntegrateFn} */ (integrate).resolveConflictsForMission,
48
+ resolveConflictsFn = (integrate as any).resolveConflictsForMission,
49
49
  startAgentFn = startAgent,
50
50
  exitFn = ((code: number) => process.exit(code)) as (code: number) => void,
51
51
  }: {resolveConflictsFn?: Function, startAgentFn?: Function, exitFn?: (code: number) => void} = {}) {
@@ -109,4 +109,9 @@ async function resolveConflict(args: string[], {
109
109
  }
110
110
 
111
111
  (resolveConflict as any).buildAgentResolutionPrompt = buildAgentResolutionPrompt;
112
- export = resolveConflict;
112
+ export default resolveConflict;
113
+ export { resolveConflict, buildAgentResolutionPrompt };
114
+
115
+ // CJS compat: ensure require() returns the function directly
116
+ declare const module: { exports: any } | undefined;
117
+ if (typeof module !== 'undefined') { module.exports = resolveConflict; }
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.reviewCommand = reviewCommand;
2
4
  const review_commands_js_1 = require("../review/review-commands.js");
3
5
  /**
4
6
  * Workflow command entry point for `review`.
@@ -10,4 +12,7 @@ const review_commands_js_1 = require("../review/review-commands.js");
10
12
  async function reviewCommand(args) {
11
13
  await (0, review_commands_js_1.review)(args);
12
14
  }
13
- module.exports = reviewCommand;
15
+ exports.default = reviewCommand;
16
+ if (typeof module !== 'undefined') {
17
+ module.exports = reviewCommand;
18
+ }
@@ -11,4 +11,9 @@ async function reviewCommand(args: string[]) {
11
11
  await review(args);
12
12
  }
13
13
 
14
- export = reviewCommand;
14
+ export default reviewCommand;
15
+ export { reviewCommand };
16
+
17
+ // CJS compat: ensure require() returns the function directly
18
+ declare const module: { exports: any } | undefined;
19
+ if (typeof module !== 'undefined') { module.exports = reviewCommand; }
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
- const setupReviewModule = require("../tools/setup-review.js");
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupReviewCommand = setupReviewCommand;
4
+ const setup_review_js_1 = require("../tools/setup-review.js");
3
5
  /**
4
6
  * Workflow command entry point for `setup-review`.
5
7
  * Delegates to the Forgejo bootstrap tool (tools/setup-review.js).
@@ -8,6 +10,9 @@ const setupReviewModule = require("../tools/setup-review.js");
8
10
  */
9
11
  /** @param {string[]} args @param {{[key: string]: any}} [options] */
10
12
  async function setupReviewCommand(args, options) {
11
- await setupReviewModule.setupReview(args, options);
13
+ await (0, setup_review_js_1.setupReview)(args, options);
14
+ }
15
+ exports.default = setupReviewCommand;
16
+ if (typeof module !== 'undefined') {
17
+ module.exports = setupReviewCommand;
12
18
  }
13
- module.exports = setupReviewCommand;
@@ -1,4 +1,4 @@
1
- import setupReviewModule = require('../tools/setup-review.js');
1
+ import { setupReview } from '../tools/setup-review.js';
2
2
 
3
3
  /**
4
4
  * Workflow command entry point for `setup-review`.
@@ -8,7 +8,12 @@ import setupReviewModule = require('../tools/setup-review.js');
8
8
  */
9
9
  /** @param {string[]} args @param {{[key: string]: any}} [options] */
10
10
  async function setupReviewCommand(args: string[], options?: {[key: string]: any}) {
11
- await setupReviewModule.setupReview(args, options);
11
+ await setupReview(args, options);
12
12
  }
13
13
 
14
- export = setupReviewCommand;
14
+ export default setupReviewCommand;
15
+ export { setupReviewCommand };
16
+
17
+ // CJS compat: ensure require() returns the function directly
18
+ declare const module: { exports: any } | undefined;
19
+ if (typeof module !== 'undefined') { module.exports = setupReviewCommand; }
@@ -1,3 +1,9 @@
1
1
  "use strict";
2
- const setupReview = require("../tools/setup-review.js");
3
- module.exports = setupReview.setupWizard;
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setupWizard = void 0;
4
+ const setup_review_js_1 = require("../tools/setup-review.js");
5
+ Object.defineProperty(exports, "setupWizard", { enumerable: true, get: function () { return setup_review_js_1.setupWizard; } });
6
+ exports.default = setup_review_js_1.setupWizard;
7
+ if (typeof module !== 'undefined') {
8
+ module.exports = setup_review_js_1.setupWizard;
9
+ }
@@ -1,2 +1,7 @@
1
- import setupReview = require('../tools/setup-review.js');
2
- export = setupReview.setupWizard;
1
+ import { setupWizard } from '../tools/setup-review.js';
2
+ export default setupWizard;
3
+ export { setupWizard };
4
+
5
+ // CJS compat: ensure require() returns the function directly
6
+ declare const module: { exports: any } | undefined;
7
+ if (typeof module !== 'undefined') { module.exports = setupWizard; }
@@ -32,15 +32,23 @@ 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.statsBackfill = statsBackfill;
40
+ exports.collectHistoricalStatsBackfill = collectHistoricalStatsBackfill;
41
+ exports.inferHistoricalClassificationFromMissionDoc = inferHistoricalClassificationFromMissionDoc;
42
+ exports.extractDateOnly = extractDateOnly;
35
43
  const fs = __importStar(require("node:fs"));
36
44
  const path = __importStar(require("node:path"));
37
45
  const fmt = __importStar(require("../core/fmt.js"));
38
- const stats = require("./stats.js");
46
+ const stats_js_1 = __importDefault(require("./stats.js"));
39
47
  const git_js_1 = require("../core/git.js");
40
48
  const backlog_js_1 = require("../tools/backlog.js");
41
49
  const mission_utils_js_1 = require("../core/mission-utils.js");
42
50
  function getStats() {
43
- return stats;
51
+ return stats_js_1.default;
44
52
  }
45
53
  function hasCheckpointFiles(missionDir) {
46
54
  if (!missionDir || !fs.existsSync(missionDir)) {
@@ -434,4 +442,7 @@ function statsBackfill(args, options = {}) {
434
442
  statsBackfill.collectHistoricalStatsBackfill = collectHistoricalStatsBackfill;
435
443
  statsBackfill.inferHistoricalClassificationFromMissionDoc = inferHistoricalClassificationFromMissionDoc;
436
444
  statsBackfill.extractDateOnly = extractDateOnly;
437
- module.exports = statsBackfill;
445
+ exports.default = statsBackfill;
446
+ if (typeof module !== 'undefined') {
447
+ module.exports = statsBackfill;
448
+ }
@@ -2,7 +2,7 @@ import * as fs from 'node:fs';
2
2
  import * as path from 'node:path';
3
3
 
4
4
  import * as fmt from '../core/fmt.js';
5
- import stats = require('./stats.js');
5
+ import stats from './stats.js';
6
6
  import { git } from '../core/git.js';
7
7
  import {
8
8
  getTaskFrontmatterValue,
@@ -415,4 +415,9 @@ function statsBackfill(args: string[], options: BackfillOptions = {}) {
415
415
  (statsBackfill as any).collectHistoricalStatsBackfill = collectHistoricalStatsBackfill;
416
416
  (statsBackfill as any).inferHistoricalClassificationFromMissionDoc = inferHistoricalClassificationFromMissionDoc;
417
417
  (statsBackfill as any).extractDateOnly = extractDateOnly;
418
- export = statsBackfill;
418
+ export default statsBackfill;
419
+ export { statsBackfill, collectHistoricalStatsBackfill, inferHistoricalClassificationFromMissionDoc, extractDateOnly };
420
+
421
+ // CJS compat: ensure require() returns the function directly
422
+ declare const module: { exports: any } | undefined;
423
+ if (typeof module !== 'undefined') { module.exports = statsBackfill; }
@@ -34,6 +34,32 @@ var __importStar = (this && this.__importStar) || (function () {
34
34
  return result;
35
35
  };
36
36
  })();
37
+ Object.defineProperty(exports, "__esModule", { value: true });
38
+ exports.USAGE_NUMBERS = exports.LEGACY_HEADERS = exports.STATS_HEADERS = void 0;
39
+ exports.stats = stats;
40
+ exports.resolveRepoStatsCsvPath = resolveRepoStatsCsvPath;
41
+ exports.resolveStatsRepoName = resolveStatsRepoName;
42
+ exports.resolveStatsFilePath = resolveStatsFilePath;
43
+ exports.resolveStatsCsvPath = resolveStatsCsvPath;
44
+ exports.resolveStatsPath = resolveStatsPath;
45
+ exports.recordIntegrationStats = recordIntegrationStats;
46
+ exports.renderWeeklyStatsReport = renderWeeklyStatsReport;
47
+ exports.renderMissionPhaseReport = renderMissionPhaseReport;
48
+ exports.renderRangeStatsReport = renderRangeStatsReport;
49
+ exports.buildWeeklyWindows = buildWeeklyWindows;
50
+ exports.resolveMissionClassification = resolveMissionClassification;
51
+ exports.deriveImplementerAndFixRounds = deriveImplementerAndFixRounds;
52
+ exports.upsertStatsRow = upsertStatsRow;
53
+ exports.loadStatsCsv = loadStatsCsv;
54
+ exports.saveStatsCsv = saveStatsCsv;
55
+ exports.normalizeStatsRow = normalizeStatsRow;
56
+ exports.canonicalizeStatsRow = canonicalizeStatsRow;
57
+ exports.recordStageStats = recordStageStats;
58
+ exports.accumulateStageStats = accumulateStageStats;
59
+ exports.recordActiveStats = recordActiveStats;
60
+ exports.recordReviewStats = recordReviewStats;
61
+ exports.telemetryToStatsFields = telemetryToStatsFields;
62
+ exports.formatDateOnly = formatDateOnly;
37
63
  const fs = __importStar(require("node:fs"));
38
64
  const path = __importStar(require("node:path"));
39
65
  const fmt = __importStar(require("../core/fmt.js"));
@@ -49,6 +75,7 @@ const storage = __importStar(require("../core/storage.js"));
49
75
  // The original 5-column schema. Retained for backward-compatible CSV detection
50
76
  // and one-time header migration of legacy stats files (task-1251).
51
77
  const LEGACY_HEADERS = ['date', 'mission', 'classification', 'implementer', 'pr_fix_rounds'];
78
+ exports.LEGACY_HEADERS = LEGACY_HEADERS;
52
79
  // Extended 21-column telemetry schema (task-1314 + task-1251). Legacy 5-column rows are
53
80
  // migrated in-memory on load: the legacy columns are preserved and the new
54
81
  // columns default to '' (text) or '0' (numeric). On the next write the file
@@ -60,12 +87,14 @@ const STATS_HEADERS = [
60
87
  'tool_calls', 'openai_usage_before', 'openai_usage_after',
61
88
  'openai_usage_delta', 'duration_minutes', 'cost_usd'
62
89
  ];
90
+ exports.STATS_HEADERS = STATS_HEADERS;
63
91
  // Columns coerced to non-negative integers on canonicalization.
64
92
  const USAGE_NUMBERS = new Set([
65
93
  'pr_fix_rounds', 'input_tokens', 'output_tokens', 'cached_tokens',
66
94
  'context_tokens', 'tool_calls', 'openai_usage_before', 'openai_usage_after',
67
95
  'openai_usage_delta', 'duration_minutes'
68
96
  ]);
97
+ exports.USAGE_NUMBERS = USAGE_NUMBERS;
69
98
  const VALID_CLASSIFICATIONS = new Set(['ai_sdlc', 'user_value', 'unknown']);
70
99
  const SHIPPED_STATS_CSV_PATH = path.join(__dirname, '..', 'data', 'stats.seed.csv');
71
100
  function getStorage() {
@@ -1903,6 +1932,10 @@ function stats(args, options = {}) {
1903
1932
  log(report);
1904
1933
  }
1905
1934
  }
1935
+ exports.default = stats;
1936
+ if (typeof module !== 'undefined') {
1937
+ module.exports = stats;
1938
+ }
1906
1939
  stats.STATS_HEADERS = STATS_HEADERS;
1907
1940
  stats.STATS_CSV_PATH = resolveRepoStatsCsvPath();
1908
1941
  stats.LEGACY_STATS_CSV_PATH = resolveRepoStatsCsvPath();
@@ -1954,4 +1987,3 @@ stats._internals = {
1954
1987
  colorMissionCounts,
1955
1988
  printStatsUsage,
1956
1989
  };
1957
- module.exports = stats;
@@ -2132,7 +2132,12 @@ function stats(args: string[], options: {log?: Function, error?: Function, exit?
2132
2132
  }
2133
2133
  }
2134
2134
 
2135
- export = stats;
2135
+ export default stats;
2136
+ export { stats, STATS_HEADERS, resolveRepoStatsCsvPath, resolveStatsRepoName, resolveStatsFilePath, resolveStatsCsvPath, resolveStatsPath, recordIntegrationStats, renderWeeklyStatsReport, renderMissionPhaseReport, renderRangeStatsReport, buildWeeklyWindows, resolveMissionClassification, deriveImplementerAndFixRounds, upsertStatsRow, loadStatsCsv, saveStatsCsv, normalizeStatsRow, canonicalizeStatsRow, recordStageStats, accumulateStageStats, recordActiveStats, recordReviewStats, telemetryToStatsFields, formatDateOnly, LEGACY_HEADERS, USAGE_NUMBERS };
2137
+
2138
+ // CJS compat: ensure require() returns the function directly
2139
+ declare const module: { exports: any } | undefined;
2140
+ if (typeof module !== 'undefined') { module.exports = stats; }
2136
2141
  (stats as any).STATS_HEADERS = STATS_HEADERS;
2137
2142
  (stats as any).STATS_CSV_PATH = resolveRepoStatsCsvPath();
2138
2143
  (stats as any).LEGACY_STATS_CSV_PATH = resolveRepoStatsCsvPath();
@@ -2183,4 +2188,4 @@ export = stats;
2183
2188
  colorAverageFixRounds,
2184
2189
  colorMissionCounts,
2185
2190
  printStatsUsage,
2186
- };
2191
+ };
@@ -32,6 +32,10 @@ var __importStar = (this && this.__importStar) || (function () {
32
32
  return result;
33
33
  };
34
34
  })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.status = status;
37
+ exports.parseWorktreeList = parseWorktreeList;
38
+ exports.findStaleMissionWorktrees = findStaleMissionWorktrees;
35
39
  const git_js_1 = require("../core/git.js");
36
40
  const backlog_js_1 = require("../tools/backlog.js");
37
41
  const mission_utils_js_1 = require("../core/mission-utils.js");
@@ -236,4 +240,7 @@ function status(args, opts) {
236
240
  }
237
241
  status.parseWorktreeList = parseWorktreeList;
238
242
  status.findStaleMissionWorktrees = findStaleMissionWorktrees;
239
- module.exports = status;
243
+ exports.default = status;
244
+ if (typeof module !== 'undefined') {
245
+ module.exports = status;
246
+ }
@@ -216,4 +216,9 @@ function status(args: string[], opts: {exit?: Function, log?: Function, inferSlu
216
216
 
217
217
  (status as any).parseWorktreeList = parseWorktreeList;
218
218
  (status as any).findStaleMissionWorktrees = findStaleMissionWorktrees;
219
- export = status;
219
+ export default status;
220
+ export { status, parseWorktreeList, findStaleMissionWorktrees };
221
+
222
+ // CJS compat: ensure require() returns the function directly
223
+ declare const module: { exports: any } | undefined;
224
+ if (typeof module !== 'undefined') { module.exports = status; }
@@ -1,3 +1,12 @@
1
1
  "use strict";
2
- const verify = require("../core/verification.js");
3
- module.exports = verify;
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.verify = void 0;
7
+ const verification_js_1 = __importDefault(require("../core/verification.js"));
8
+ exports.verify = verification_js_1.default;
9
+ exports.default = verification_js_1.default;
10
+ if (typeof module !== 'undefined') {
11
+ module.exports = verification_js_1.default;
12
+ }
@@ -1,2 +1,7 @@
1
- import verify = require('../core/verification.js');
2
- export = verify;
1
+ import verify from '../core/verification.js';
2
+ export default verify;
3
+ export { verify };
4
+
5
+ // CJS compat: ensure require() returns the function directly
6
+ declare const module: { exports: any } | undefined;
7
+ if (typeof module !== 'undefined') { module.exports = verify; }
@@ -2,6 +2,10 @@
2
2
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.WORKFLOW_ENTRIES = void 0;
7
+ exports.ensureWorkflowGitignore = ensureWorkflowGitignore;
8
+ exports.ensureWorkflowGitignoreFn = ensureWorkflowGitignore;
5
9
  const node_fs_1 = __importDefault(require("node:fs"));
6
10
  const node_path_1 = __importDefault(require("node:path"));
7
11
  const WORKFLOW_ENTRIES = [
@@ -13,6 +17,7 @@ const WORKFLOW_ENTRIES = [
13
17
  'workflow/config/agents.local.json',
14
18
  'agents.local.json',
15
19
  ];
20
+ exports.WORKFLOW_ENTRIES = WORKFLOW_ENTRIES;
16
21
  function ensureWorkflowGitignore(rootDir, options = {}) {
17
22
  const { existsSyncFn = node_fs_1.default.existsSync, lstatSyncFn = node_fs_1.default.lstatSync, readFileSyncFn = node_fs_1.default.readFileSync, writeFileSyncFn = node_fs_1.default.writeFileSync, logFn = () => { }, } = options;
18
23
  const gitignorePath = node_path_1.default.join(rootDir, '.gitignore');
@@ -62,4 +67,7 @@ function ensureWorkflowGitignore(rootDir, options = {}) {
62
67
  }
63
68
  ensureWorkflowGitignore.WORKFLOW_ENTRIES = WORKFLOW_ENTRIES;
64
69
  ensureWorkflowGitignore.ensureWorkflowGitignore = ensureWorkflowGitignore;
65
- module.exports = ensureWorkflowGitignore;
70
+ exports.default = ensureWorkflowGitignore;
71
+ if (typeof module !== 'undefined') {
72
+ module.exports = ensureWorkflowGitignore;
73
+ }
@@ -100,4 +100,9 @@ function ensureWorkflowGitignore(rootDir: string, options: EnsureOptions = {}):
100
100
  (ensureWorkflowGitignore as EnsureWorkflowGitignoreFn).WORKFLOW_ENTRIES = WORKFLOW_ENTRIES;
101
101
  (ensureWorkflowGitignore as EnsureWorkflowGitignoreFn).ensureWorkflowGitignore = ensureWorkflowGitignore as EnsureWorkflowGitignoreFn;
102
102
 
103
- export = ensureWorkflowGitignore;
103
+ export default ensureWorkflowGitignore;
104
+ export { ensureWorkflowGitignore, WORKFLOW_ENTRIES, ensureWorkflowGitignore as ensureWorkflowGitignoreFn };
105
+
106
+ // CJS compat: ensure require() returns the function directly
107
+ declare const module: { exports: any } | undefined;
108
+ if (typeof module !== 'undefined') { module.exports = ensureWorkflowGitignore; }
@@ -42,12 +42,14 @@ exports.migrateAgentBlocklists = migrateAgentBlocklists;
42
42
  const node_fs_1 = __importDefault(require("node:fs"));
43
43
  const node_path_1 = __importDefault(require("node:path"));
44
44
  const storage = __importStar(require("./storage.js"));
45
+ const node_module_1 = require("node:module");
46
+ const _require = (0, node_module_1.createRequire)(__filename);
45
47
  /** Cached stats module — loaded lazily to break circular dependency with `../commands/stats.js`. */
46
48
  let _stats = null;
47
49
  /** Lazily load the stats module to break the circular dependency. */
48
50
  function getStats() {
49
51
  if (!_stats) {
50
- _stats = require('../commands/stats.js');
52
+ _stats = _require('../commands/stats.js');
51
53
  }
52
54
  return _stats;
53
55
  }
@@ -182,7 +184,7 @@ function migrateStats(options = {}) {
182
184
  const opts = options;
183
185
  const sourcePaths = (opts.sourcePaths || [opts.sourcePath].filter(Boolean));
184
186
  const destinationPath = opts.destinationPath || storage.resolveStatsPath({ ensureDir: true });
185
- const sourceRows = sourcePaths.flatMap((sourcePath) => readStatsRows(sourcePath, {}));
187
+ const sourceRows = sourcePaths.map((sourcePath) => readStatsRows(sourcePath, {})).flat();
186
188
  // Fresh-install guard: when no source file exists or all sources are empty,
187
189
  // there is no telemetry to import. Returning early prevents writing a
188
190
  // header-only destination file that would masquerade as valid stats.
@@ -1,13 +1,15 @@
1
1
  import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import * as storage from './storage.js';
4
+ import { createRequire } from 'node:module';
5
+ const _require = createRequire(__filename);
4
6
 
5
7
  /** Cached stats module — loaded lazily to break circular dependency with `../commands/stats.js`. */
6
8
  let _stats: any = null;
7
9
 
8
10
  /** Lazily load the stats module to break the circular dependency. */
9
11
  function getStats(): any {
10
- if (!_stats) {_stats = require('../commands/stats.js');}
12
+ if (!_stats) {_stats = _require('../commands/stats.js');}
11
13
  return _stats;
12
14
  }
13
15
 
@@ -145,7 +147,7 @@ function migrateStats(options: { sourcePaths?: string[]; sourcePath?: string; de
145
147
  const opts = options;
146
148
  const sourcePaths = (opts.sourcePaths || [opts.sourcePath].filter(Boolean)) as string[];
147
149
  const destinationPath = opts.destinationPath || storage.resolveStatsPath({ ensureDir: true });
148
- const sourceRows = sourcePaths.flatMap((sourcePath: string) => readStatsRows(sourcePath, {}));
150
+ const sourceRows = sourcePaths.map((sourcePath: string) => readStatsRows(sourcePath, {})).flat();
149
151
 
150
152
  // Fresh-install guard: when no source file exists or all sources are empty,
151
153
  // there is no telemetry to import. Returning early prevents writing a
package/lib/index.js CHANGED
@@ -63,46 +63,46 @@ const limitHitMod = __importStar(require("./agents/limit-hit.js"));
63
63
  const mistralMod = __importStar(require("./agents/mistral.js"));
64
64
  const opencodeMod = __importStar(require("./agents/opencode.js"));
65
65
  // commands/ — mixed export styles
66
- const active = require("./commands/active.js");
67
- exports.active = active;
66
+ const active_js_1 = __importDefault(require("./commands/active.js"));
67
+ exports.active = active_js_1.default;
68
68
  const checkpoint_js_1 = __importDefault(require("./commands/checkpoint.js"));
69
69
  exports.checkpoint = checkpoint_js_1.default;
70
- const config = require("./commands/config.js");
71
- exports.config = config;
72
- const coverageGate = require("./commands/coverage-gate.js");
73
- exports.coverageGate = coverageGate;
74
- const diff = require("./commands/diff.js");
75
- exports.diff = diff;
76
- const draft = require("./commands/draft.js");
77
- exports.draft = draft;
78
- const handoff = require("./commands/handoff.js");
79
- exports.handoff = handoff;
80
- const integrate = require("./commands/integrate.js");
81
- exports.integrate = integrate;
82
- const missionStart = require("./commands/mission-start.js");
83
- exports.missionStart = missionStart;
84
- const rebase = require("./commands/rebase.js");
85
- exports.rebase = rebase;
86
- const repairHandoff = require("./commands/repair-handoff.js");
87
- exports.repairHandoff = repairHandoff;
88
- const resolveConflict = require("./commands/resolve-conflict.js");
89
- exports.resolveConflict = resolveConflict;
90
- const setup = require("./commands/setup.js");
91
- exports.setup = setup;
92
- const stats = require("./commands/stats.js");
93
- exports.stats = stats;
94
- const statsBackfill = require("./commands/stats-backfill.js");
95
- exports.statsBackfill = statsBackfill;
96
- const status = require("./commands/status.js");
97
- exports.status = status;
98
- const verify = require("./commands/verify.js");
99
- exports.verify = verify;
70
+ const config_js_1 = __importDefault(require("./commands/config.js"));
71
+ exports.config = config_js_1.default;
72
+ const coverage_gate_js_1 = __importDefault(require("./commands/coverage-gate.js"));
73
+ exports.coverageGate = coverage_gate_js_1.default;
74
+ const diff_js_1 = __importDefault(require("./commands/diff.js"));
75
+ exports.diff = diff_js_1.default;
76
+ const draft_js_1 = __importDefault(require("./commands/draft.js"));
77
+ exports.draft = draft_js_1.default;
78
+ const handoff_js_1 = __importDefault(require("./commands/handoff.js"));
79
+ exports.handoff = handoff_js_1.default;
80
+ const integrate_js_1 = __importDefault(require("./commands/integrate.js"));
81
+ exports.integrate = integrate_js_1.default;
82
+ const mission_start_js_1 = __importDefault(require("./commands/mission-start.js"));
83
+ exports.missionStart = mission_start_js_1.default;
84
+ const rebase_js_1 = __importDefault(require("./commands/rebase.js"));
85
+ exports.rebase = rebase_js_1.default;
86
+ const repair_handoff_js_1 = __importDefault(require("./commands/repair-handoff.js"));
87
+ exports.repairHandoff = repair_handoff_js_1.default;
88
+ const resolve_conflict_js_1 = __importDefault(require("./commands/resolve-conflict.js"));
89
+ exports.resolveConflict = resolve_conflict_js_1.default;
90
+ const setup_js_1 = __importDefault(require("./commands/setup.js"));
91
+ exports.setup = setup_js_1.default;
92
+ const stats_js_1 = __importDefault(require("./commands/stats.js"));
93
+ exports.stats = stats_js_1.default;
94
+ const stats_backfill_js_1 = __importDefault(require("./commands/stats-backfill.js"));
95
+ exports.statsBackfill = stats_backfill_js_1.default;
96
+ const status_js_1 = __importDefault(require("./commands/status.js"));
97
+ exports.status = status_js_1.default;
98
+ const verify_js_1 = __importDefault(require("./commands/verify.js"));
99
+ exports.verify = verify_js_1.default;
100
100
  // core/ — mixed export styles
101
101
  const fmtMod = __importStar(require("./core/fmt.js"));
102
102
  exports.fmt = fmtMod;
103
103
  const gitMod = __importStar(require("./core/git.js"));
104
- const gitignore = require("./core/gitignore.js");
105
- exports.gitignore = gitignore;
104
+ const gitignore_js_1 = __importDefault(require("./core/gitignore.js"));
105
+ exports.gitignore = gitignore_js_1.default;
106
106
  const missionUtilsMod = __importStar(require("./core/mission-utils.js"));
107
107
  const persistentDataMigrationMod = __importStar(require("./core/persistent-data-migration.js"));
108
108
  const productConfigMod = __importStar(require("./core/product-config.js"));
@@ -112,8 +112,8 @@ const stateMapMod = __importStar(require("./core/state-map.js"));
112
112
  const storageMod = __importStar(require("./core/storage.js"));
113
113
  const verificationMod = __importStar(require("./core/verification.js"));
114
114
  // review/ — mixed export styles
115
- const review = require("./review/review.js");
116
- exports.review = review;
115
+ const review_js_1 = __importDefault(require("./review/review.js"));
116
+ exports.review = review_js_1.default;
117
117
  const reviewArtifactsMod = __importStar(require("./review/review-artifacts.js"));
118
118
  const reviewCommandsMod = __importStar(require("./review/review-commands.js"));
119
119
  const reviewEventsMod = __importStar(require("./review/review-events.js"));