@magnusekdahl/parallix 1.2.1 → 1.3.0

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 (79) hide show
  1. package/index.js +190 -185
  2. package/lib/commands/active.js +502 -579
  3. package/lib/commands/active.ts +665 -0
  4. package/lib/commands/checkpoint.js +98 -74
  5. package/lib/commands/checkpoint.ts +79 -0
  6. package/lib/commands/config.js +61 -31
  7. package/lib/commands/config.ts +47 -0
  8. package/lib/commands/coverage-gate.js +271 -246
  9. package/lib/commands/coverage-gate.ts +362 -0
  10. package/lib/commands/diff.js +140 -119
  11. package/lib/commands/diff.ts +125 -0
  12. package/lib/commands/draft.js +770 -923
  13. package/lib/commands/draft.ts +1021 -0
  14. package/lib/commands/handoff.js +588 -608
  15. package/lib/commands/handoff.ts +694 -0
  16. package/lib/commands/integrate.js +1331 -1468
  17. package/lib/commands/integrate.ts +1688 -0
  18. package/lib/commands/mission-start.js +279 -237
  19. package/lib/commands/mission-start.ts +263 -0
  20. package/lib/commands/rebase.js +606 -582
  21. package/lib/commands/rebase.ts +635 -0
  22. package/lib/commands/repair-handoff.js +181 -179
  23. package/lib/commands/repair-handoff.ts +228 -0
  24. package/lib/commands/resolve-conflict.js +121 -102
  25. package/lib/commands/resolve-conflict.ts +112 -0
  26. package/lib/commands/review.js +3 -4
  27. package/lib/commands/review.ts +14 -0
  28. package/lib/commands/setup-review.js +4 -5
  29. package/lib/commands/setup-review.ts +14 -0
  30. package/lib/commands/setup.js +3 -3
  31. package/lib/commands/setup.ts +2 -0
  32. package/lib/commands/stats-backfill.js +394 -359
  33. package/lib/commands/stats-backfill.ts +418 -0
  34. package/lib/commands/stats.js +1424 -1665
  35. package/lib/commands/stats.ts +2186 -0
  36. package/lib/commands/status.js +219 -200
  37. package/lib/commands/status.ts +219 -0
  38. package/lib/commands/verify.js +3 -1
  39. package/lib/commands/verify.ts +2 -0
  40. package/lib/core/nels.js +112 -127
  41. package/lib/core/nels.ts +189 -0
  42. package/lib/core/subagent-limit.js +15 -16
  43. package/lib/core/subagent-limit.ts +25 -0
  44. package/lib/index.js +142 -59
  45. package/lib/index.ts +134 -0
  46. package/lib/review/rebase.js +142 -145
  47. package/lib/review/rebase.ts +188 -0
  48. package/lib/review/review-adapter.js +99 -87
  49. package/lib/review/review-adapter.ts +198 -0
  50. package/lib/review/review-artifacts.js +486 -629
  51. package/lib/review/review-artifacts.ts +622 -0
  52. package/lib/review/review-commands.js +1220 -1373
  53. package/lib/review/review-commands.ts +1579 -0
  54. package/lib/review/review-events.js +544 -886
  55. package/lib/review/review-events.ts +954 -0
  56. package/lib/review/review-loop.js +945 -1020
  57. package/lib/review/review-loop.ts +1174 -0
  58. package/lib/review/review-polling.js +86 -115
  59. package/lib/review/review-polling.ts +194 -0
  60. package/lib/review/review-prompts.js +154 -189
  61. package/lib/review/review-prompts.ts +182 -0
  62. package/lib/review/review-state.js +246 -225
  63. package/lib/review/review-state.ts +353 -0
  64. package/lib/review/review.js +63 -84
  65. package/lib/review/review.ts +138 -0
  66. package/lib/tools/backlog.js +694 -680
  67. package/lib/tools/backlog.ts +835 -0
  68. package/lib/tools/forgejo.js +1270 -1405
  69. package/lib/tools/forgejo.ts +1793 -0
  70. package/lib/tools/gatekeeper.js +106 -96
  71. package/lib/tools/gatekeeper.ts +124 -0
  72. package/lib/tools/redgreen.js +200 -181
  73. package/lib/tools/redgreen.ts +221 -0
  74. package/lib/tools/sessions.js +58 -52
  75. package/lib/tools/sessions.ts +81 -0
  76. package/lib/tools/setup-review.js +902 -975
  77. package/lib/tools/setup-review.ts +1152 -0
  78. package/package.json +4 -4
  79. package/px.js +226 -208
@@ -1,220 +1,239 @@
1
- const { detectRebaseState, getCurrentBranch, getUncommittedCount, getLastThreeCommits, run } = require('../core/git');
2
- const { findTaskFile, getTaskStatus } = require('../tools/backlog');
3
- const { findMissionDir, findCheckpoints, getFirstLine, inferSlug, missionBranchPrefix, missionBranchName } = require('../core/mission-utils');
4
- const { WORKFLOW_AGENT_NAMES, eligibleAgentsForStep, readAgentConfigOrExit, workflowLauncherStatus } = require('../agents/agents');
5
- const { getPrStatus } = require('../tools/forgejo');
6
- const path = require('path');
7
- const fmt = require('../core/fmt');
8
-
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ const git_js_1 = require("../core/git.js");
36
+ const backlog_js_1 = require("../tools/backlog.js");
37
+ const mission_utils_js_1 = require("../core/mission-utils.js");
38
+ const agents_js_1 = require("../agents/agents.js");
39
+ const forgejo_js_1 = require("../tools/forgejo.js");
40
+ const path = __importStar(require("node:path"));
41
+ const fmt = __importStar(require("../core/fmt.js"));
9
42
  /** @param {string} porcelain */
10
43
  function parseWorktreeList(porcelain) {
11
- const entries = [];
12
- /** @type{{path: string, branch: string | null} | null} */
13
- let current = null;
14
-
15
- for (const line of porcelain.split('\n')) {
16
- if (!line.trim()) {
17
- if (current) {
18
- entries.push(current);
19
- current = null;
20
- }
21
- continue;
22
- }
23
-
24
- if (line.startsWith('worktree ')) {
25
- if (current) {entries.push(current);}
26
- current = { path: line.slice('worktree '.length).trim(), branch: null };
27
- continue;
44
+ const entries = [];
45
+ /** @type{{path: string, branch: string | null} | null} */
46
+ let current = null;
47
+ for (const line of porcelain.split('\n')) {
48
+ if (!line.trim()) {
49
+ if (current) {
50
+ entries.push(current);
51
+ current = null;
52
+ }
53
+ continue;
54
+ }
55
+ if (line.startsWith('worktree ')) {
56
+ if (current) {
57
+ entries.push(current);
58
+ }
59
+ current = { path: line.slice('worktree '.length).trim(), branch: null };
60
+ continue;
61
+ }
62
+ if (line.startsWith('branch ') && current) {
63
+ current.branch = line.slice('branch '.length).trim();
64
+ }
28
65
  }
29
-
30
- if (line.startsWith('branch ') && current) {
31
- current.branch = line.slice('branch '.length).trim();
66
+ if (current) {
67
+ entries.push(current);
32
68
  }
33
- }
34
-
35
- if (current) {entries.push(current);}
36
- return entries;
69
+ return entries;
37
70
  }
38
-
39
- function findStaleMissionWorktrees({
40
- gitRun = run,
41
- findTaskFileFn = findTaskFile,
42
- getTaskStatusFn = getTaskStatus,
43
- primaryWorktree = null
44
- } = {}) {
45
- const result = gitRun('git', ['worktree', 'list', '--porcelain']);
46
- if (result.status !== 0) {
47
- return [];
48
- }
49
-
50
- /** @type {string | null} */
51
- let resolvedPrimary = primaryWorktree;
52
- if (!resolvedPrimary) {
53
- try {
54
- const { getPrimaryWorktree } = require('../core/mission-utils');
55
- resolvedPrimary = getPrimaryWorktree();
56
- } catch (_) {
57
- resolvedPrimary = null;
71
+ function findStaleMissionWorktrees({ gitRun = git_js_1.run, findTaskFileFn = backlog_js_1.findTaskFile, getTaskStatusFn = backlog_js_1.getTaskStatus, primaryWorktree = null } = {}) {
72
+ const result = gitRun('git', ['worktree', 'list', '--porcelain']);
73
+ if (result.status !== 0) {
74
+ return [];
75
+ }
76
+ /** @type {string | null} */
77
+ let resolvedPrimary = primaryWorktree;
78
+ if (!resolvedPrimary) {
79
+ try {
80
+ resolvedPrimary = (0, mission_utils_js_1.getPrimaryWorktree)();
81
+ }
82
+ catch (_) {
83
+ resolvedPrimary = null;
84
+ }
58
85
  }
59
- }
60
-
61
- return parseWorktreeList(result.stdout)
62
- .filter(entry => entry.path !== resolvedPrimary)
63
- .map(entry => {
64
- const branchRef = entry.branch || '';
65
- const prefix = missionBranchPrefix(resolvedPrimary || process.cwd());
66
- const normalizedRefPrefix = `refs/heads/${prefix}`;
67
- const match = branchRef.startsWith(normalizedRefPrefix)
68
- ? [branchRef, branchRef.slice(normalizedRefPrefix.length)]
69
- : null;
70
- if (!match) {return null;}
71
-
72
- const slug = match[1];
73
- const taskFile = findTaskFileFn(slug);
74
- const taskStatus = taskFile ? getTaskStatusFn(taskFile) : null;
75
- if (taskStatus !== 'done' && taskFile) {
76
- return null;
77
- }
78
-
79
- return {
80
- slug,
81
- path: entry.path,
82
- branch: branchRef,
83
- taskStatus: taskStatus || 'missing',
84
- cleanupCommand: taskStatus === 'done'
85
- ? `scripts/cleanup-mission-worktree.sh ${slug}`
86
- : `git worktree remove ${entry.path} && git branch -D ${missionBranchName(slug, resolvedPrimary || process.cwd())}`
87
- };
86
+ return parseWorktreeList(result.stdout)
87
+ .filter(entry => entry.path !== resolvedPrimary)
88
+ .map(entry => {
89
+ const branchRef = entry.branch || '';
90
+ const prefix = (0, mission_utils_js_1.missionBranchPrefix)(resolvedPrimary || process.cwd());
91
+ const normalizedRefPrefix = `refs/heads/${prefix}`;
92
+ const match = branchRef.startsWith(normalizedRefPrefix)
93
+ ? [branchRef, branchRef.slice(normalizedRefPrefix.length)]
94
+ : null;
95
+ if (!match) {
96
+ return null;
97
+ }
98
+ const slug = match[1];
99
+ const taskFile = findTaskFileFn(slug);
100
+ const taskStatus = taskFile ? getTaskStatusFn(taskFile) : null;
101
+ if (taskStatus !== 'done' && taskFile) {
102
+ return null;
103
+ }
104
+ return {
105
+ slug,
106
+ path: entry.path,
107
+ branch: branchRef,
108
+ taskStatus: taskStatus || 'missing',
109
+ cleanupCommand: taskStatus === 'done'
110
+ ? `scripts/cleanup-mission-worktree.sh ${slug}`
111
+ : `git worktree remove ${entry.path} && git branch -D ${(0, mission_utils_js_1.missionBranchName)(slug, resolvedPrimary || process.cwd())}`
112
+ };
88
113
  })
89
- .filter(Boolean);
114
+ .filter(Boolean);
90
115
  }
91
-
92
116
  /** @param {string} ref */
93
117
  function formatWorktreeBranch(ref) {
94
- if (!ref) {return '(detached HEAD)';}
95
- return ref.replace(/^refs\/heads\//, '');
118
+ if (!ref) {
119
+ return '(detached HEAD)';
120
+ }
121
+ return ref.replace(/^refs\/heads\//, '');
96
122
  }
97
-
98
123
  /** @param {Function} log @param {string} label @param {{detached?: boolean, unmergedFiles: string[]}} rebaseState */
99
124
  function logRebaseDiagnostics(log, label, rebaseState) {
100
- const detachedText = rebaseState.detached ? 'detached HEAD, ' : '';
101
- log(`${label}: ${detachedText}${rebaseState.unmergedFiles.length} unmerged file(s)`);
102
- rebaseState.unmergedFiles.forEach(file => {
103
- log(` - ${file}`);
104
- });
125
+ const detachedText = rebaseState.detached ? 'detached HEAD, ' : '';
126
+ log(`${label}: ${detachedText}${rebaseState.unmergedFiles.length} unmerged file(s)`);
127
+ rebaseState.unmergedFiles.forEach(file => {
128
+ log(` - ${file}`);
129
+ });
105
130
  }
106
-
107
131
  /** @param {string[]} args @param {{exit?: Function, log?: Function, inferSlugFn?: Function, getCurrentBranchFn?: Function, findTaskFileFn?: Function, getTaskStatusFn?: Function, findMissionDirFn?: Function, findCheckpointsFn?: Function, getFirstLineFn?: Function, getPrStatusFn?: Function, findStaleMissionWorktreesFn?: Function, readAgentConfigOrExitFn?: Function, eligibleAgentsForStepFn?: Function, allWorkflowAgentNamesFn?: Function, workflowLauncherStatusFn?: Function, getLastThreeCommitsFn?: Function, getUncommittedCountFn?: Function, detectRebaseStateFn?: Function}} opts */
108
- function status(args, opts = {}) {
109
- const exit = opts.exit || process.exit;
110
- const log = opts.log || fmt.log.plain;
111
- const inferSlugFn = opts.inferSlugFn || inferSlug;
112
- const getCurrentBranchFn = opts.getCurrentBranchFn || getCurrentBranch;
113
- const findTaskFileFn = opts.findTaskFileFn || findTaskFile;
114
- const getTaskStatusFn = opts.getTaskStatusFn || getTaskStatus;
115
- const findMissionDirFn = opts.findMissionDirFn || findMissionDir;
116
- const findCheckpointsFn = opts.findCheckpointsFn || findCheckpoints;
117
- const getFirstLineFn = opts.getFirstLineFn || getFirstLine;
118
- const getPrStatusFn = opts.getPrStatusFn || getPrStatus;
119
- const findStaleMissionWorktreesFn = opts.findStaleMissionWorktreesFn || findStaleMissionWorktrees;
120
- const readAgentConfigOrExitFn = opts.readAgentConfigOrExitFn || readAgentConfigOrExit;
121
- const eligibleAgentsForStepFn = opts.eligibleAgentsForStepFn || eligibleAgentsForStep;
122
- const allWorkflowAgentNamesFn = opts.allWorkflowAgentNamesFn || (() => WORKFLOW_AGENT_NAMES);
123
- const workflowLauncherStatusFn = opts.workflowLauncherStatusFn || workflowLauncherStatus;
124
- const getLastThreeCommitsFn = opts.getLastThreeCommitsFn || getLastThreeCommits;
125
- const getUncommittedCountFn = opts.getUncommittedCountFn || getUncommittedCount;
126
- const detectRebaseStateFn = opts.detectRebaseStateFn || detectRebaseState;
127
-
128
- const explicitSlug = args[0];
129
- const slug = inferSlugFn(explicitSlug);
130
-
131
- log(fmt.bold('--- Mission Status ---'));
132
- log(`Branch: ${fmt.branch(getCurrentBranchFn())}`);
133
- log(`Worktree: ${fmt.path(process.cwd())}`);
134
-
135
- try {
136
- const rebaseState = detectRebaseStateFn(process.cwd());
137
- if (rebaseState.inProgress && rebaseState.detached) {
138
- logRebaseDiagnostics(log, 'Detached HEAD: rebase in progress', rebaseState);
139
- }
140
- } catch (_) {
141
- // Ignore transient worktree/git-state failures in status output.
142
- }
143
-
144
- if (slug) {
145
- const taskFile = findTaskFileFn(slug);
146
- const taskStatus = getTaskStatusFn(taskFile);
147
- log(`Backlog status: ${taskStatus || 'unknown'}`);
148
-
149
- const missionDir = findMissionDirFn(slug);
150
- if (missionDir) {
151
- const checkpoints = findCheckpointsFn(missionDir);
152
- if (checkpoints.length > 0) {
153
- const lastCP = checkpoints[checkpoints.length - 1];
154
- const firstLine = getFirstLineFn(lastCP);
155
- log(`Last checkpoint: ${path.basename(lastCP)} - ${firstLine}`);
156
- } else {
157
- log('Last checkpoint: none');
158
- }
159
- } else {
160
- log('Last checkpoint: unknown');
132
+ function status(args, opts) {
133
+ const exit = opts.exit || process.exit;
134
+ const log = opts.log || fmt.log.plain;
135
+ const inferSlugFn = opts.inferSlugFn || mission_utils_js_1.inferSlug;
136
+ const getCurrentBranchFn = opts.getCurrentBranchFn || git_js_1.getCurrentBranch;
137
+ const findTaskFileFn = opts.findTaskFileFn || backlog_js_1.findTaskFile;
138
+ const getTaskStatusFn = opts.getTaskStatusFn || backlog_js_1.getTaskStatus;
139
+ const findMissionDirFn = opts.findMissionDirFn || mission_utils_js_1.findMissionDir;
140
+ const findCheckpointsFn = opts.findCheckpointsFn || mission_utils_js_1.findCheckpoints;
141
+ const getFirstLineFn = opts.getFirstLineFn || mission_utils_js_1.getFirstLine;
142
+ const getPrStatusFn = opts.getPrStatusFn || forgejo_js_1.getPrStatus;
143
+ const findStaleMissionWorktreesFn = opts.findStaleMissionWorktreesFn || findStaleMissionWorktrees;
144
+ const readAgentConfigOrExitFn = opts.readAgentConfigOrExitFn || agents_js_1.readAgentConfigOrExit;
145
+ const eligibleAgentsForStepFn = opts.eligibleAgentsForStepFn || agents_js_1.eligibleAgentsForStep;
146
+ const allWorkflowAgentNamesFn = opts.allWorkflowAgentNamesFn || (() => agents_js_1.WORKFLOW_AGENT_NAMES);
147
+ const workflowLauncherStatusFn = opts.workflowLauncherStatusFn || agents_js_1.workflowLauncherStatus;
148
+ const getLastThreeCommitsFn = opts.getLastThreeCommitsFn || git_js_1.getLastThreeCommits;
149
+ const getUncommittedCountFn = opts.getUncommittedCountFn || git_js_1.getUncommittedCount;
150
+ const detectRebaseStateFn = opts.detectRebaseStateFn || git_js_1.detectRebaseState;
151
+ const explicitSlug = args[0];
152
+ const slug = inferSlugFn(explicitSlug);
153
+ log(fmt.bold('--- Mission Status ---'));
154
+ log(`Branch: ${fmt.branch(getCurrentBranchFn())}`);
155
+ log(`Worktree: ${fmt.path(process.cwd())}`);
156
+ try {
157
+ const rebaseState = detectRebaseStateFn(process.cwd());
158
+ if (rebaseState.inProgress && rebaseState.detached) {
159
+ logRebaseDiagnostics(log, 'Detached HEAD: rebase in progress', rebaseState);
160
+ }
161
161
  }
162
-
163
- // Forgejo PR state
164
- const pr = getPrStatusFn(missionBranchName(slug));
165
- if (pr.exists) {
166
- log(`Forgejo PR: #${pr.number} (${pr.state})`);
167
- } else if (pr.raw) {
168
- log(`Forgejo PR: unavailable (${pr.raw})`);
169
- } else {
170
- log('Forgejo PR: none');
162
+ catch (_) {
163
+ // Ignore transient worktree/git-state failures in status output.
171
164
  }
172
- }
173
-
174
- if (!explicitSlug) {
175
- const staleWorktrees = findStaleMissionWorktreesFn();
176
- staleWorktrees.forEach(/** @param {{path: string, branch: string | null, taskStatus: string | null, cleanupCommand?: string}} entry */ (entry) => {
177
- log(`Stale worktree: ${fmt.path(entry.path)} (task: ${entry.taskStatus})`);
178
- try {
179
- const rebaseState = detectRebaseStateFn(entry.path);
180
- if (rebaseState.inProgress) {
181
- logRebaseDiagnostics(log, `Rebase in progress on ${formatWorktreeBranch(entry.branch || '')}`, rebaseState);
165
+ if (slug) {
166
+ const taskFile = findTaskFileFn(slug);
167
+ const taskStatus = getTaskStatusFn(taskFile);
168
+ log(`Backlog status: ${taskStatus || 'unknown'}`);
169
+ const missionDir = findMissionDirFn(slug);
170
+ if (missionDir) {
171
+ const checkpoints = findCheckpointsFn(missionDir);
172
+ if (checkpoints.length > 0) {
173
+ const lastCP = checkpoints[checkpoints.length - 1];
174
+ const firstLine = getFirstLineFn(lastCP);
175
+ log(`Last checkpoint: ${path.basename(lastCP)} - ${firstLine}`);
176
+ }
177
+ else {
178
+ log('Last checkpoint: none');
179
+ }
182
180
  }
183
- } catch (_) {
184
- // Ignore stale worktrees that disappear during inspection.
185
- }
186
- log(` Cleanup: ${fmt.command(entry.cleanupCommand || '')}`);
187
- });
188
- }
189
-
190
- // Agent eligibility matrix
191
- const config = readAgentConfigOrExitFn();
192
- const draftEligible = eligibleAgentsForStepFn('draft', { config });
193
- const activeEligible = eligibleAgentsForStepFn('active', { config });
194
- const baseAgents = allWorkflowAgentNamesFn();
195
- const allAgents = [...new Set([...baseAgents, ...draftEligible, ...activeEligible])].sort();
196
- const envOverride = process.env.WORKFLOW_AGENT;
197
- log('Agent launcher matrix:');
198
- for (const agent of allAgents) {
199
- const launcher = workflowLauncherStatusFn(agent);
200
- const support = launcher.supported ? 'supported' : 'blocked';
201
- const draftMark = draftEligible.includes(agent) ? 'draft' : '-';
202
- const activeMark = activeEligible.includes(agent) ? 'active' : '-';
203
- log(` ${fmt.agent(agent)}: ${support} | eligible: ${draftMark},${activeMark}`);
204
- }
205
- if (envOverride) {
206
- log(` (WORKFLOW_AGENT override: ${fmt.agent(envOverride)})`);
207
- }
208
-
209
- const lastThree = getLastThreeCommitsFn();
210
- log('Last 3 commits:');
211
- lastThree.forEach(/** @param {string} c */ (c) => log(` - ${c}`));
212
-
213
- log(`Uncommitted files: ${getUncommittedCountFn()}`);
214
- log(fmt.bold('----------------------'));
215
- exit(0);
181
+ else {
182
+ log('Last checkpoint: unknown');
183
+ }
184
+ // Forgejo PR state
185
+ const pr = getPrStatusFn((0, mission_utils_js_1.missionBranchName)(slug));
186
+ if (pr.exists) {
187
+ log(`Forgejo PR: #${pr.number} (${pr.state})`);
188
+ }
189
+ else if (pr.raw) {
190
+ log(`Forgejo PR: unavailable (${pr.raw})`);
191
+ }
192
+ else {
193
+ log('Forgejo PR: none');
194
+ }
195
+ }
196
+ if (!explicitSlug) {
197
+ const staleWorktrees = findStaleMissionWorktreesFn();
198
+ staleWorktrees.forEach((entry) => {
199
+ log(`Stale worktree: ${fmt.path(entry.path)} (task: ${entry.taskStatus})`);
200
+ try {
201
+ const rebaseState = detectRebaseStateFn(entry.path);
202
+ if (rebaseState.inProgress) {
203
+ logRebaseDiagnostics(log, `Rebase in progress on ${formatWorktreeBranch(entry.branch || '')}`, rebaseState);
204
+ }
205
+ }
206
+ catch (_) {
207
+ // Ignore stale worktrees that disappear during inspection.
208
+ }
209
+ log(` Cleanup: ${fmt.command(entry.cleanupCommand || '')}`);
210
+ });
211
+ }
212
+ // Agent eligibility matrix
213
+ const config = readAgentConfigOrExitFn();
214
+ const draftEligible = eligibleAgentsForStepFn('draft', { config });
215
+ const activeEligible = eligibleAgentsForStepFn('active', { config });
216
+ const baseAgents = allWorkflowAgentNamesFn();
217
+ const allAgents = [...new Set([...baseAgents, ...draftEligible, ...activeEligible])].sort();
218
+ const envOverride = process.env.WORKFLOW_AGENT;
219
+ log('Agent launcher matrix:');
220
+ for (const agent of allAgents) {
221
+ const launcher = workflowLauncherStatusFn(agent);
222
+ const support = launcher.supported ? 'supported' : 'blocked';
223
+ const draftMark = draftEligible.includes(agent) ? 'draft' : '-';
224
+ const activeMark = activeEligible.includes(agent) ? 'active' : '-';
225
+ log(` ${fmt.agent(agent)}: ${support} | eligible: ${draftMark},${activeMark}`);
226
+ }
227
+ if (envOverride) {
228
+ log(` (WORKFLOW_AGENT override: ${fmt.agent(envOverride)})`);
229
+ }
230
+ const lastThree = getLastThreeCommitsFn();
231
+ log('Last 3 commits:');
232
+ lastThree.forEach((c) => log(` - ${c}`));
233
+ log(`Uncommitted files: ${getUncommittedCountFn()}`);
234
+ log(fmt.bold('----------------------'));
235
+ exit(0);
216
236
  }
217
-
237
+ status.parseWorktreeList = parseWorktreeList;
238
+ status.findStaleMissionWorktrees = findStaleMissionWorktrees;
218
239
  module.exports = status;
219
- module.exports.parseWorktreeList = parseWorktreeList;
220
- module.exports.findStaleMissionWorktrees = findStaleMissionWorktrees;