@oss-autopilot/core 3.26.0 → 3.28.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.
@@ -124,7 +124,10 @@ export function formatSummary(digest, capacity, issueResponses = []) {
124
124
  const capacityIcon = capacity.hasCapacity ? '✅' : '⚠️';
125
125
  const capacityLabel = capacity.hasCapacity ? 'Ready for new work' : 'Focus on existing PRs';
126
126
  const shelvedNote = capacity.shelvedPRCount > 0 ? ` + ${capacity.shelvedPRCount} shelved` : '';
127
- lines.push(`**Capacity:** ${capacityIcon} ${capacityLabel} (${capacity.activePRCount}/${capacity.maxActivePRs} PRs${shelvedNote})`);
127
+ const countLabel = capacity.maxActivePRs > 0
128
+ ? `${capacity.activePRCount}/${capacity.maxActivePRs} PRs`
129
+ : `${capacity.activePRCount} PRs, no limit`;
130
+ lines.push(`**Capacity:** ${capacityIcon} ${capacityLabel} (${countLabel}${shelvedNote})`);
128
131
  return lines.join('\n');
129
132
  }
130
133
  /**
@@ -15,14 +15,37 @@ export interface LaunchResult {
15
15
  */
16
16
  lastBrowserOpenedAt?: string;
17
17
  }
18
+ /**
19
+ * The script to spawn `dashboard serve` with. From the CLI that is argv[1]
20
+ * (cli.bundle.cjs in production, cli.ts in dev). From another host process
21
+ * such as the MCP server, argv[1] is that host's own entry, so use the core
22
+ * CLI bundle that ships beside the dashboard assets instead (#1735).
23
+ */
24
+ export declare function resolveCliEntry(argv1: string, assetsDir: string): string;
25
+ /**
26
+ * Stop the running dashboard server if a different CLI version launched it (#548).
27
+ *
28
+ * The server's refresh path re-classifies PRs with its own bundled code and
29
+ * writes the result to state, so an old-version server overwrites whatever a
30
+ * newer `daily` just wrote (#1709). The server cannot detect this itself:
31
+ * plugin updates install into a new versioned directory, so the old server's
32
+ * own package.json never changes. Callers running the current CLI (startup,
33
+ * `daily`) therefore make the check.
34
+ *
35
+ * Returns the running server when it is left up (same or unknown version, or
36
+ * the kill failed), or null when none is running or the stale one was stopped.
37
+ */
38
+ export declare function stopStaleDashboardServer(): Promise<LaunchResult | null>;
18
39
  /**
19
40
  * Launch the interactive dashboard SPA server as a detached background process.
20
41
  *
21
42
  * Returns the server URL if launched successfully, or null if the SPA assets
22
43
  * are not available (dashboard is skipped).
23
44
  *
24
- * If a server is already running (detected via PID file + health probe),
25
- * returns its URL without launching a new one.
45
+ * If a server from the current version is already running (detected via PID
46
+ * file + health probe), returns its URL without launching a new one. A server
47
+ * from another version is stopped first, even when the assets are missing and
48
+ * no replacement can be launched (#1709).
26
49
  */
27
50
  export declare function launchDashboardServer(options?: {
28
51
  port?: number;
@@ -4,85 +4,101 @@
4
4
  * and detecting whether a server is already running.
5
5
  */
6
6
  import { spawn } from 'node:child_process';
7
+ import * as fs from 'node:fs';
8
+ import * as path from 'node:path';
7
9
  import { findRunningDashboardServer, isDashboardServerRunning, readDashboardServerInfo, removeDashboardServerInfo, } from './dashboard-process.js';
8
10
  import { resolveAssetsDir } from './dashboard.js';
9
11
  import { getCLIVersion } from '../core/index.js';
10
12
  const DEFAULT_PORT = 3000;
11
13
  const POLL_INTERVAL_MS = 200;
12
14
  const MAX_POLL_ATTEMPTS = 25; // 5 seconds total
15
+ /**
16
+ * The script to spawn `dashboard serve` with. From the CLI that is argv[1]
17
+ * (cli.bundle.cjs in production, cli.ts in dev). From another host process
18
+ * such as the MCP server, argv[1] is that host's own entry, so use the core
19
+ * CLI bundle that ships beside the dashboard assets instead (#1735).
20
+ */
21
+ export function resolveCliEntry(argv1, assetsDir) {
22
+ if (/^cli\.(?:bundle\.cjs|ts|js)$/.test(path.basename(argv1)))
23
+ return argv1;
24
+ const coreBundle = path.resolve(assetsDir, '../../core/dist/cli.bundle.cjs');
25
+ return fs.existsSync(coreBundle) ? coreBundle : argv1;
26
+ }
13
27
  function sleep(ms) {
14
28
  return new Promise((resolve) => setTimeout(resolve, ms));
15
29
  }
30
+ /**
31
+ * Stop the running dashboard server if a different CLI version launched it (#548).
32
+ *
33
+ * The server's refresh path re-classifies PRs with its own bundled code and
34
+ * writes the result to state, so an old-version server overwrites whatever a
35
+ * newer `daily` just wrote (#1709). The server cannot detect this itself:
36
+ * plugin updates install into a new versioned directory, so the old server's
37
+ * own package.json never changes. Callers running the current CLI (startup,
38
+ * `daily`) therefore make the check.
39
+ *
40
+ * Returns the running server when it is left up (same or unknown version, or
41
+ * the kill failed), or null when none is running or the stale one was stopped.
42
+ */
43
+ export async function stopStaleDashboardServer() {
44
+ const existing = await findRunningDashboardServer();
45
+ if (!existing)
46
+ return null;
47
+ const info = readDashboardServerInfo();
48
+ // PID file disappeared between health check and now (race condition).
49
+ if (!info)
50
+ return null;
51
+ const running = {
52
+ url: existing.url,
53
+ port: existing.port,
54
+ alreadyRunning: true,
55
+ lastBrowserOpenedAt: info.lastBrowserOpenedAt,
56
+ };
57
+ const currentVersion = getCLIVersion();
58
+ if (!info.version || currentVersion === '0.0.0' || info.version === currentVersion) {
59
+ return running;
60
+ }
61
+ console.error(`[DASHBOARD] Dashboard server version mismatch (running: ${info.version}, current: ${currentVersion}). Stopping it...`);
62
+ try {
63
+ process.kill(info.pid, 'SIGTERM');
64
+ }
65
+ catch (err) {
66
+ // ESRCH = already exited
67
+ if (err.code !== 'ESRCH') {
68
+ console.error(`[DASHBOARD] Could not kill outdated dashboard (PID ${info.pid}): ${err.message}`);
69
+ // Could not kill old server (e.g. EPERM); report it as running rather
70
+ // than letting the caller attempt a doomed spawn on the same port.
71
+ return running;
72
+ }
73
+ }
74
+ removeDashboardServerInfo();
75
+ return null;
76
+ }
16
77
  /**
17
78
  * Launch the interactive dashboard SPA server as a detached background process.
18
79
  *
19
80
  * Returns the server URL if launched successfully, or null if the SPA assets
20
81
  * are not available (dashboard is skipped).
21
82
  *
22
- * If a server is already running (detected via PID file + health probe),
23
- * returns its URL without launching a new one.
83
+ * If a server from the current version is already running (detected via PID
84
+ * file + health probe), returns its URL without launching a new one. A server
85
+ * from another version is stopped first, even when the assets are missing and
86
+ * no replacement can be launched (#1709).
24
87
  */
25
88
  export async function launchDashboardServer(options) {
26
89
  // 1. Check if SPA assets exist
27
90
  const assetsDir = resolveAssetsDir();
28
91
  if (!assetsDir) {
92
+ await stopStaleDashboardServer();
29
93
  return null;
30
94
  }
31
- // 2. Check if a server is already running
32
- const existing = await findRunningDashboardServer();
33
- if (existing) {
34
- // If the running server is from a different CLI version, kill it and relaunch
35
- // so the dashboard uses the current version's code (#548)
36
- const info = readDashboardServerInfo();
37
- const currentVersion = getCLIVersion();
38
- if (!info) {
39
- // PID file disappeared between health check and now (race condition).
40
- // Fall through to launch a new server.
41
- }
42
- else if (info.version && currentVersion !== '0.0.0' && info.version !== currentVersion) {
43
- console.error(`[STARTUP] Dashboard server version mismatch (running: ${info.version}, current: ${currentVersion}). Restarting...`);
44
- let killed = false;
45
- try {
46
- process.kill(info.pid, 'SIGTERM');
47
- killed = true;
48
- }
49
- catch (err) {
50
- const code = err.code;
51
- if (code === 'ESRCH') {
52
- killed = true; // Already exited
53
- }
54
- else {
55
- console.error(`[STARTUP] Could not kill outdated dashboard (PID ${info.pid}): ${err.message}`);
56
- }
57
- }
58
- if (killed) {
59
- removeDashboardServerInfo();
60
- }
61
- else {
62
- // Could not kill old server (e.g. EPERM); return it rather than
63
- // attempting a doomed spawn on the same port.
64
- return {
65
- url: existing.url,
66
- port: existing.port,
67
- alreadyRunning: true,
68
- lastBrowserOpenedAt: info?.lastBrowserOpenedAt,
69
- };
70
- }
71
- // Fall through to launch a new server
72
- }
73
- else {
74
- return {
75
- url: existing.url,
76
- port: existing.port,
77
- alreadyRunning: true,
78
- lastBrowserOpenedAt: info.lastBrowserOpenedAt,
79
- };
80
- }
81
- }
95
+ // 2. Reuse a running server unless it is from a different CLI version
96
+ const running = await stopStaleDashboardServer();
97
+ if (running)
98
+ return running;
82
99
  // 3. Launch as detached child process
83
100
  const port = options?.port ?? DEFAULT_PORT;
84
- // process.argv[1] is the CLI entry point (cli.bundle.cjs in production, cli.ts in dev)
85
- const cliPath = process.argv[1];
101
+ const cliPath = resolveCliEntry(process.argv[1], assetsDir);
86
102
  const child = spawn('node', [cliPath, 'dashboard', 'serve', '--port', String(port), '--no-open'], {
87
103
  detached: true,
88
104
  stdio: 'ignore',
@@ -204,11 +204,22 @@ export declare const LAUNCHD_LABEL = "com.oss-autopilot.overnight";
204
204
  */
205
205
  export declare const OVERNIGHT_DISALLOWED_TOOLS: string;
206
206
  export declare const OVERNIGHT_ALLOWED_TOOLS: string;
207
+ /**
208
+ * The settings layer the scheduled job runs with instead of the user's own
209
+ * (#1697). Permission allow rules union across settings layers, and a user
210
+ * whose day-to-day settings allow bare `Bash` would otherwise void the
211
+ * enumerated allowlist entirely: only the deny list would apply. So the job
212
+ * drops user, project and local settings (`--setting-sources ""`) and gets
213
+ * this file, which carries only what it needs from them: the plugin itself.
214
+ */
215
+ export declare function renderOvernightSettings(): string;
207
216
  /** Pure: the launchd plist that runs `/oss-overnight` headlessly. */
208
- export declare function renderLaunchdPlist(options: Pick<ScheduleOptions, 'hour' | 'claudePath'>, logPath: string): string;
217
+ export declare function renderLaunchdPlist(options: Pick<ScheduleOptions, 'hour' | 'claudePath'>, logPath: string, settingsPath: string): string;
209
218
  export interface ScheduleOutput {
210
219
  plist: string;
211
220
  plistPath: string;
221
+ /** The settings layer the job runs with (see renderOvernightSettings); written with --install. */
222
+ settingsPath: string;
212
223
  installed: boolean;
213
224
  /** The one command the user runs to (re)load the job. */
214
225
  loadCommand: string;
@@ -449,6 +449,30 @@ export const OVERNIGHT_DISALLOWED_TOOLS = [
449
449
  'Bash(npm deprecate *)',
450
450
  'Bash(pnpm publish)',
451
451
  'Bash(pnpm publish *)',
452
+ // Direct shell escapes inside the allowed programs (#1728): `npm exec` IS
453
+ // npx, `pnpm dlx`/`pnpm exec` run arbitrary packages, and `node -e` runs
454
+ // arbitrary JS — each can spawn `git push` and void the push denies above.
455
+ // The residual (a repo's own test scripts run arbitrary code) is documented
456
+ // in commands/oss-overnight.md and cannot be closed by tool rules.
457
+ 'Bash(npm exec)',
458
+ 'Bash(npm exec *)',
459
+ 'Bash(npm x)',
460
+ 'Bash(npm x *)',
461
+ 'Bash(npm * exec *)',
462
+ 'Bash(pnpm dlx *)',
463
+ 'Bash(pnpm * dlx *)',
464
+ 'Bash(pnpm exec)',
465
+ 'Bash(pnpm exec *)',
466
+ 'Bash(pnpm * exec *)',
467
+ 'Bash(node -e *)',
468
+ 'Bash(node --eval *)',
469
+ 'Bash(node -p *)',
470
+ 'Bash(node -pe *)',
471
+ 'Bash(node --print *)',
472
+ // The same escapes after a leading flag (`node --no-warnings -e`,
473
+ // `pnpm --dir x exec`), mirroring the `git * push` deny.
474
+ 'Bash(node * -e *)',
475
+ 'Bash(node * --eval *)',
452
476
  'AskUserQuestion',
453
477
  ].join(',');
454
478
  export const OVERNIGHT_ALLOWED_TOOLS = [
@@ -475,17 +499,34 @@ export const OVERNIGHT_ALLOWED_TOOLS = [
475
499
  function xmlEscape(s) {
476
500
  return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
477
501
  }
502
+ /**
503
+ * The settings layer the scheduled job runs with instead of the user's own
504
+ * (#1697). Permission allow rules union across settings layers, and a user
505
+ * whose day-to-day settings allow bare `Bash` would otherwise void the
506
+ * enumerated allowlist entirely: only the deny list would apply. So the job
507
+ * drops user, project and local settings (`--setting-sources ""`) and gets
508
+ * this file, which carries only what it needs from them: the plugin itself.
509
+ */
510
+ export function renderOvernightSettings() {
511
+ return `${JSON.stringify({ enabledPlugins: { 'oss-autopilot@oss-autopilot': true } }, null, 2)}\n`;
512
+ }
478
513
  /** Pure: the launchd plist that runs `/oss-overnight` headlessly. */
479
- export function renderLaunchdPlist(options, logPath) {
514
+ export function renderLaunchdPlist(options, logPath, settingsPath) {
480
515
  // Headless `-p` starts in manual permission mode, where any unapproved tool
481
516
  // call fails (nobody can answer). `dontAsk` + the enumerated allowlist above
482
- // is the documented unattended shape and the enforcement half of the gate.
517
+ // is the documented unattended shape and the enforcement half of the gate,
518
+ // and only holds with the user's own settings out of the picture (see
519
+ // renderOvernightSettings).
483
520
  const args = [
484
521
  options.claudePath,
485
522
  '-p',
486
523
  '/oss-overnight',
487
524
  '--permission-mode',
488
525
  'dontAsk',
526
+ '--setting-sources',
527
+ '',
528
+ '--settings',
529
+ settingsPath,
489
530
  '--allowedTools',
490
531
  OVERNIGHT_ALLOWED_TOOLS,
491
532
  '--disallowedTools',
@@ -544,14 +585,18 @@ export function runOvernightSchedule(options) {
544
585
  const claudePath = resolveClaudePath(options.claudePath);
545
586
  const plistPath = path.join(os.homedir(), 'Library', 'LaunchAgents', `${LAUNCHD_LABEL}.plist`);
546
587
  const logPath = path.join(getReportsDir(), 'overnight-launchd.log');
547
- const plist = renderLaunchdPlist({ hour: options.hour, claudePath }, logPath);
588
+ const settingsPath = path.join(getReportsDir(), 'overnight-settings.json');
589
+ const plist = renderLaunchdPlist({ hour: options.hour, claudePath }, logPath, settingsPath);
548
590
  if (options.install) {
549
591
  fs.mkdirSync(path.dirname(plistPath), { recursive: true });
550
592
  fs.writeFileSync(plistPath, plist, { mode: 0o644 });
593
+ fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
594
+ fs.writeFileSync(settingsPath, renderOvernightSettings(), { mode: 0o600 });
551
595
  }
552
596
  return {
553
597
  plist,
554
598
  plistPath,
599
+ settingsPath,
555
600
  installed: options.install,
556
601
  loadCommand: `launchctl bootout gui/$(id -u) ${plistPath} 2>/dev/null; launchctl bootstrap gui/$(id -u) ${plistPath}`,
557
602
  };
@@ -51,9 +51,17 @@ function isCompleted(line) {
51
51
  return true;
52
52
  return false;
53
53
  }
54
- /** Extract a score from a sub-bullet line (e.g., "Score 8/10" or "Score 7.5/10") */
55
- function extractScore(line) {
56
- const match = line.match(/Score\s+(\d+(?:\.\d+)?)\/10/i);
54
+ /**
55
+ * Extract a score from a sub-bullet line. Accepts `Score 8/10` anywhere in the
56
+ * line, or any bare `N/10` / `N.N/10` inside the first bold span
57
+ * (`**Pursue (7/10)**`, `**Vetted 2026-09-16: 7/10, pursue first.**`) (#1730).
58
+ *
59
+ * `strict` (used by the on-disk prune) accepts only `Score N/10` and the pinned
60
+ * `(N/10)` form, so a date-like `3/10` in a span never deletes an entry.
61
+ */
62
+ function extractScore(line, strict = false) {
63
+ const bare = strict ? /\((\d+(?:\.\d+)?)\/10\)/ : /(?<![\d.])(\d+(?:\.\d+)?)\/10\b/;
64
+ const match = line.match(/Score\s+(\d+(?:\.\d+)?)\/10/i) ?? firstBoldSpan(line)?.match(bare);
57
65
  return match ? parseFloat(match[1]) : undefined;
58
66
  }
59
67
  /**
@@ -140,6 +148,20 @@ function isSubBulletDeletable(line) {
140
148
  function isSubBulletInProgress(line) {
141
149
  return spanStartsWithKeyword(line, /^(?:In Progress|Waiting|Wait|Post findings first|Ship now|Viable not urgent|PR OPEN|IMPLEMENTED)(?![\p{L}\p{N}])/iu);
142
150
  }
151
+ /**
152
+ * Check if a sub-bullet's first bold span says the item is blocked on
153
+ * something outside the user's control (#1730). Runs after the terminal /
154
+ * in-progress checks, so a span that STARTS with `Wait` still lands in
155
+ * `completed` as before; this catches `blocked` / `wait` later in the span.
156
+ */
157
+ function isSubBulletBlocked(line) {
158
+ const span = firstBoldSpan(line);
159
+ return span !== null && /\b(?:blocked|wait(?:ing|s)?)\b/i.test(span);
160
+ }
161
+ /** A `##` section whose items are vetted but blocked (`## Queued ...`, `## Blocked on ...`) (#1730). */
162
+ function isBlockedSection(heading) {
163
+ return /^Queued\b/i.test(heading) || /\bblocked\b/i.test(heading);
164
+ }
143
165
  /** Leading-whitespace width with tabs expanded to two columns. */
144
166
  function indentWidth(line) {
145
167
  return line.match(/^\s*/)[0].replace(/\t/g, ' ').length;
@@ -149,19 +171,42 @@ export function parseIssueList(content) {
149
171
  const lines = content.split('\n');
150
172
  const available = [];
151
173
  const completed = [];
174
+ const blocked = [];
152
175
  let currentTier = 'Uncategorized';
176
+ // Heading level that set currentTier. A `###` under a `##` tier is a
177
+ // sub-group (repo heading, blocker note) and must not clobber the tier (#1730).
178
+ let tierLevel = 0;
179
+ let currentGroup;
180
+ let sectionBlocked = false;
153
181
  let lastItem = null;
154
182
  // Track which array the last item was placed in so sub-bullets can move it
155
- let lastItemInAvailable = false;
183
+ let lastBucket = null;
184
+ const moveLastItem = (to) => {
185
+ const idx = lastBucket.indexOf(lastItem);
186
+ if (idx !== -1)
187
+ lastBucket.splice(idx, 1);
188
+ to.push(lastItem);
189
+ lastBucket = to;
190
+ };
156
191
  // Indentation of the line that created lastItem — a line is a sub-bullet
157
192
  // only when indented deeper than its parent (handles wholly-indented lists
158
193
  // whose sibling items share the same indent).
159
194
  let lastItemIndent = 0;
160
195
  for (const line of lines) {
161
196
  // Check for section headings (# or ##)
162
- const headingMatch = line.match(/^#{1,3}\s+(.+)/);
197
+ const headingMatch = line.match(/^(#{1,3})\s+(.+)/);
163
198
  if (headingMatch) {
164
- currentTier = headingMatch[1].trim();
199
+ const level = headingMatch[1].length;
200
+ const text = headingMatch[2].trim();
201
+ if (level === 3 && tierLevel === 2) {
202
+ currentGroup = text;
203
+ }
204
+ else {
205
+ currentTier = text;
206
+ tierLevel = level;
207
+ currentGroup = undefined;
208
+ sectionBlocked = isBlockedSection(text);
209
+ }
165
210
  lastItem = null;
166
211
  continue;
167
212
  }
@@ -186,15 +231,12 @@ export function parseIssueList(content) {
186
231
  if (score !== undefined) {
187
232
  lastItem.score = score;
188
233
  }
189
- // Check if sub-bullet marks item as terminal or in-progress
190
- if (lastItemInAvailable && (isSubBulletTerminal(line) || isSubBulletInProgress(line))) {
191
- // Move from available to completed
192
- const idx = available.indexOf(lastItem);
193
- if (idx !== -1) {
194
- available.splice(idx, 1);
195
- completed.push(lastItem);
196
- lastItemInAvailable = false;
197
- }
234
+ // Check if sub-bullet marks item as terminal/in-progress, or blocked
235
+ if (lastBucket !== completed && (isSubBulletTerminal(line) || isSubBulletInProgress(line))) {
236
+ moveLastItem(completed);
237
+ }
238
+ else if (lastBucket === available && isSubBulletBlocked(line)) {
239
+ moveLastItem(blocked);
198
240
  }
199
241
  continue;
200
242
  }
@@ -208,16 +250,11 @@ export function parseIssueList(content) {
208
250
  number: ghUrl.number,
209
251
  title: title || `#${ghUrl.number}`,
210
252
  tier: currentTier,
253
+ ...(currentGroup !== undefined ? { group: currentGroup } : {}),
211
254
  url: ghUrl.url,
212
255
  };
213
- if (isCompleted(line)) {
214
- completed.push(item);
215
- lastItemInAvailable = false;
216
- }
217
- else {
218
- available.push(item);
219
- lastItemInAvailable = true;
220
- }
256
+ lastBucket = isCompleted(line) ? completed : sectionBlocked ? blocked : available;
257
+ lastBucket.push(item);
221
258
  lastItem = item;
222
259
  lastItemIndent = indent;
223
260
  }
@@ -229,32 +266,29 @@ export function parseIssueList(content) {
229
266
  // `available[]`. Curators add a terminal annotation (`**hold**`,
230
267
  // `Done`, etc.) on a later occurrence precisely to override an
231
268
  // earlier "pursue" line; the terminal classification wins.
269
+ // - Likewise a URL in `blocked[]` is filtered out of `available[]`,
270
+ // and a URL in `completed[]` out of `blocked[]` (#1730).
232
271
  // - Within each bucket, the first occurrence is kept (preserves the
233
272
  // parse order and the tier of the original entry).
234
- const completedUrls = new Set(completed.map((item) => item.url));
235
- const dedupedAvailable = [];
236
- const seenAvailable = new Set();
237
- for (const item of available) {
238
- if (completedUrls.has(item.url))
239
- continue;
240
- if (seenAvailable.has(item.url))
241
- continue;
242
- seenAvailable.add(item.url);
243
- dedupedAvailable.push(item);
244
- }
245
- const dedupedCompleted = [];
246
- const seenCompleted = new Set();
247
- for (const item of completed) {
248
- if (seenCompleted.has(item.url))
249
- continue;
250
- seenCompleted.add(item.url);
251
- dedupedCompleted.push(item);
252
- }
273
+ const dedupe = (items, ...exclude) => {
274
+ const seen = new Set(exclude.flatMap((bucket) => bucket.map((item) => item.url)));
275
+ return items.filter((item) => {
276
+ if (seen.has(item.url))
277
+ return false;
278
+ seen.add(item.url);
279
+ return true;
280
+ });
281
+ };
282
+ const dedupedCompleted = dedupe(completed);
283
+ const dedupedBlocked = dedupe(blocked, completed);
284
+ const dedupedAvailable = dedupe(available, completed, blocked);
253
285
  return {
254
286
  available: dedupedAvailable,
255
287
  completed: dedupedCompleted,
288
+ blocked: dedupedBlocked,
256
289
  availableCount: dedupedAvailable.length,
257
290
  completedCount: dedupedCompleted.length,
291
+ blockedCount: dedupedBlocked.length,
258
292
  };
259
293
  }
260
294
  /**
@@ -304,7 +338,7 @@ export function pruneIssueList(content, minScore = 6) {
304
338
  if (isSubBulletDeletable(lines[j])) {
305
339
  shouldRemove = true;
306
340
  }
307
- const score = extractScore(lines[j]);
341
+ const score = extractScore(lines[j], true);
308
342
  if (score !== undefined && score < minScore) {
309
343
  shouldRemove = true;
310
344
  }
@@ -66,7 +66,7 @@ export async function runSetup(options) {
66
66
  break;
67
67
  }
68
68
  case 'maxActivePRs': {
69
- const maxPRs = parsePositiveInt(value, 'maxActivePRs');
69
+ const maxPRs = parseNonNegativeInt(value, 'maxActivePRs');
70
70
  stateManager.updateConfig({ maxActivePRs: maxPRs });
71
71
  results[key] = String(maxPRs);
72
72
  break;
@@ -14,10 +14,13 @@ export { parseIssueListPathFromConfig } from './locate-issue-list.js';
14
14
  * actionable pool — strikethrough, `**Done**`, and sub-bullet markers like
15
15
  * `**Skip**`, `**Merged**`, `**Dropped**`, `**Closed**`, `**In Progress**`,
16
16
  * `**Waiting**`. Matches the parse-issue-list command's classification (#907).
17
+ * Blocked items (`## Queued ...` sections, `**... blocked ...**` sub-bullets)
18
+ * are counted separately in `blockedCount` (#1730).
17
19
  */
18
20
  export declare function countIssueListItems(content: string): {
19
21
  availableCount: number;
20
22
  completedCount: number;
23
+ blockedCount: number;
21
24
  };
22
25
  /**
23
26
  * Detect an issue list file from config or known paths.
@@ -28,10 +28,12 @@ export { parseIssueListPathFromConfig } from './locate-issue-list.js';
28
28
  * actionable pool — strikethrough, `**Done**`, and sub-bullet markers like
29
29
  * `**Skip**`, `**Merged**`, `**Dropped**`, `**Closed**`, `**In Progress**`,
30
30
  * `**Waiting**`. Matches the parse-issue-list command's classification (#907).
31
+ * Blocked items (`## Queued ...` sections, `**... blocked ...**` sub-bullets)
32
+ * are counted separately in `blockedCount` (#1730).
31
33
  */
32
34
  export function countIssueListItems(content) {
33
- const { availableCount, completedCount } = parseIssueList(content);
34
- return { availableCount, completedCount };
35
+ const { availableCount, completedCount, blockedCount } = parseIssueList(content);
36
+ return { availableCount, completedCount, blockedCount };
35
37
  }
36
38
  /**
37
39
  * Detect an issue list file from config or known paths.
@@ -48,10 +50,11 @@ export function detectIssueList() {
48
50
  // 4. Count available/completed items
49
51
  let availableCount = 0;
50
52
  let completedCount = 0;
53
+ let blockedCount = 0;
51
54
  let readError;
52
55
  try {
53
56
  const content = fs.readFileSync(issueListPath, 'utf8');
54
- ({ availableCount, completedCount } = countIssueListItems(content));
57
+ ({ availableCount, completedCount, blockedCount } = countIssueListItems(content));
55
58
  }
56
59
  catch (error) {
57
60
  // Surface the failure in the envelope (#1448): a 0/0 count from an
@@ -123,6 +126,7 @@ export function detectIssueList() {
123
126
  source,
124
127
  availableCount,
125
128
  completedCount,
129
+ blockedCount,
126
130
  skippedIssuesPath,
127
131
  ...(readError !== undefined ? { readError } : {}),
128
132
  };
@@ -164,7 +164,10 @@ export async function runVetList(options = {}) {
164
164
  issueListPath = detected.path;
165
165
  }
166
166
  const parsed = await runParseList({ filePath: issueListPath });
167
- if (parsed.available.length === 0) {
167
+ // Blocked items (#1730) are re-vetted too: they wait longest, so they are the
168
+ // likeliest to be closed or claimed in the meantime.
169
+ const items = [...parsed.available, ...parsed.blocked];
170
+ if (items.length === 0) {
168
171
  return {
169
172
  results: [],
170
173
  summary: {
@@ -180,7 +183,6 @@ export async function runVetList(options = {}) {
180
183
  },
181
184
  };
182
185
  }
183
- const items = parsed.available;
184
186
  // 2. Verify FIRST (#1494): one deterministic GraphQL check per entry, in a
185
187
  // bounded batch. The verdict is closing-vs-mention aware, so it carries
186
188
  // the authoritative status — and ruling issues out here means we skip
@@ -35,6 +35,16 @@ const PATTERNS = [
35
35
  // Explicit "no X" bans against AI/LLM nouns.
36
36
  { category: 'explicit_ban', regex: /\bno\s+(ai|llm)[\s-](generated|authored|written|assisted|contributions?)/i },
37
37
  { category: 'explicit_ban', regex: /\b(ban|banned|banning)\s+(ai|llm)\b/i },
38
+ // Modal prohibition: "LLMs must not be used", "AI must not be submitted", etc.
39
+ // Scoped to the noun immediately before "must not" to avoid matching
40
+ // unrelated prohibitions that happen to mention AI elsewhere in the sentence.
41
+ { category: 'explicit_ban', regex: /\b(ai|llm)s?\s+must\s+not\b/i },
42
+ // "this is forbidden" or "is forbidden" scoped to a sentence containing an AI/LLM noun.
43
+ // Use a sentence-fragment bound ([^.!\n?]) to avoid matching "AI is useful. Plagiarism is forbidden."
44
+ {
45
+ category: 'explicit_ban',
46
+ regex: /\b(ai|llm|generative\s+ai)\b[^.!?\n]{1,80}?\bforbidden\b|\bforbidden\b[^.!?\n]{1,80}?\b(ai|llm|generative\s+ai)\b/i,
47
+ },
38
48
  // Named-tool bans. Optionally match a "-generated/-authored/-…"
39
49
  // continuation (clear ban wording), and use a negative lookahead to
40
50
  // reject unrelated hyphen-words like "no copilot-style autocomplete"
@@ -10,6 +10,12 @@ export declare function isConditionalChecklistItem(line: string): boolean;
10
10
  * Only flags if there ARE checkboxes and some are unchecked.
11
11
  * Conditional items (containing "if applicable", "(if ...)", etc.) are
12
12
  * excluded from the incomplete count (#152).
13
+ *
14
+ * Checkbox groups are parsed by markdown headings. Special handling applies (#1718):
15
+ * - Sections containing "leave unchecked where/if not applicable" are skipped entirely.
16
+ * - Sections whose heading matches "type of change" / "kind of change" / "category"
17
+ * are treated as single-select radio groups: satisfied when at least one box is
18
+ * checked, so the remaining unchecked boxes are not counted as incomplete.
13
19
  */
14
20
  export declare function analyzeChecklist(body: string): {
15
21
  hasIncompleteChecklist: boolean;