@oss-autopilot/core 3.27.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.
- package/dist/cli-registry.js +11 -1
- package/dist/cli.bundle.cjs +110 -107
- package/dist/commands/dashboard-lifecycle.d.ts +25 -2
- package/dist/commands/dashboard-lifecycle.js +71 -55
- package/dist/commands/overnight.js +24 -0
- package/dist/commands/parse-list.js +77 -43
- package/dist/commands/startup.d.ts +3 -0
- package/dist/commands/startup.js +7 -3
- package/dist/commands/vet-list.js +4 -2
- package/dist/core/anti-llm-policy.js +10 -0
- package/dist/core/checklist-analysis.d.ts +6 -0
- package/dist/core/checklist-analysis.js +90 -14
- package/dist/core/paths.d.ts +9 -1
- package/dist/core/paths.js +11 -1
- package/dist/formatters/json.d.ts +19 -0
- package/dist/formatters/json.js +3 -0
- package/package.json +1 -1
|
@@ -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
|
|
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
|
|
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.
|
|
32
|
-
const
|
|
33
|
-
if (
|
|
34
|
-
|
|
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
|
-
|
|
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',
|
|
@@ -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 = [
|
|
@@ -51,9 +51,17 @@ function isCompleted(line) {
|
|
|
51
51
|
return true;
|
|
52
52
|
return false;
|
|
53
53
|
}
|
|
54
|
-
/**
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
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(
|
|
197
|
+
const headingMatch = line.match(/^(#{1,3})\s+(.+)/);
|
|
163
198
|
if (headingMatch) {
|
|
164
|
-
|
|
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
|
|
190
|
-
if (
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
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
|
-
|
|
214
|
-
|
|
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
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
const
|
|
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
|
}
|
|
@@ -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.
|
package/dist/commands/startup.js
CHANGED
|
@@ -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
|
-
|
|
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;
|
|
@@ -11,31 +11,107 @@ const CONDITIONAL_CHECKLIST_PATTERN = /\(if\s|\bif applicable\b|\bif needed\b|\b
|
|
|
11
11
|
export function isConditionalChecklistItem(line) {
|
|
12
12
|
return CONDITIONAL_CHECKLIST_PATTERN.test(line.toLowerCase());
|
|
13
13
|
}
|
|
14
|
+
// Matches markdown headings; `\S` after whitespace prevents backtracking with `.*` (#1718)
|
|
15
|
+
const HEADING_RE = /^#{1,6}\s+(\S.*)/;
|
|
16
|
+
/**
|
|
17
|
+
* Matches headings that indicate a mutually-exclusive "type of change" radio group
|
|
18
|
+
* where exactly one option should be selected. (#1718)
|
|
19
|
+
*/
|
|
20
|
+
const TYPE_OF_CHANGE_RE = /type\s+of\s+change|kind\s+of\s+change|category/i;
|
|
21
|
+
/**
|
|
22
|
+
* Split a PR body into sections delimited by markdown headings.
|
|
23
|
+
* Content before the first heading is returned as a section with heading = null.
|
|
24
|
+
*/
|
|
25
|
+
function parseSections(body) {
|
|
26
|
+
const lines = body.split('\n');
|
|
27
|
+
const sections = [];
|
|
28
|
+
let currentHeading = null;
|
|
29
|
+
let currentLines = [];
|
|
30
|
+
for (const line of lines) {
|
|
31
|
+
const headingMatch = HEADING_RE.exec(line);
|
|
32
|
+
if (headingMatch) {
|
|
33
|
+
if (currentHeading !== null || currentLines.length > 0) {
|
|
34
|
+
sections.push({ heading: currentHeading, lines: currentLines });
|
|
35
|
+
}
|
|
36
|
+
currentHeading = headingMatch[1].trim();
|
|
37
|
+
currentLines = [];
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
currentLines.push(line);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Flush the final section
|
|
44
|
+
if (currentHeading !== null || currentLines.length > 0) {
|
|
45
|
+
sections.push({ heading: currentHeading, lines: currentLines });
|
|
46
|
+
}
|
|
47
|
+
return sections;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Return true if a section contains a "leave unchecked where/if not applicable" note
|
|
51
|
+
* in the first few non-checkbox lines, signalling that unchecked boxes are intentional.
|
|
52
|
+
* (#1718)
|
|
53
|
+
*/
|
|
54
|
+
function hasLeaveUncheckedNote(section) {
|
|
55
|
+
const nonCheckboxLines = section.lines.filter((l) => !/- \[x\]/i.test(l));
|
|
56
|
+
// Only inspect the first 5 non-checkbox lines — the note is always near the top
|
|
57
|
+
return nonCheckboxLines.slice(0, 5).some((l) => {
|
|
58
|
+
const lower = l.toLowerCase();
|
|
59
|
+
return lower.includes('leave unchecked') && (lower.includes('not applicable') || lower.includes('n/a'));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Analyze a single checkbox section and return its effective counts.
|
|
64
|
+
* Returns null if the section should be entirely skipped.
|
|
65
|
+
*/
|
|
66
|
+
function analyzeSectionItems(section) {
|
|
67
|
+
const sectionText = section.lines.join('\n');
|
|
68
|
+
const checked = (sectionText.match(/- \[x\]/gi) ?? []).length;
|
|
69
|
+
const uncheckedLines = section.lines.filter((l) => /^.*- \[ \].*$/.test(l));
|
|
70
|
+
if (checked === 0 && uncheckedLines.length === 0)
|
|
71
|
+
return null;
|
|
72
|
+
if (hasLeaveUncheckedNote(section))
|
|
73
|
+
return null;
|
|
74
|
+
// Type-of-change radio group: when ≥1 box is checked, remaining unchecked boxes are
|
|
75
|
+
// intentional (single-select) and must not be counted as incomplete. (#1718)
|
|
76
|
+
const isTypeOfChange = section.heading !== null && TYPE_OF_CHANGE_RE.test(section.heading);
|
|
77
|
+
if (isTypeOfChange && checked >= 1)
|
|
78
|
+
return { checked, nonConditionalUnchecked: 0 };
|
|
79
|
+
const nonConditionalUnchecked = uncheckedLines.filter((l) => !isConditionalChecklistItem(l));
|
|
80
|
+
return { checked, nonConditionalUnchecked: nonConditionalUnchecked.length };
|
|
81
|
+
}
|
|
14
82
|
/**
|
|
15
83
|
* Analyze PR body for incomplete checklists (unchecked markdown checkboxes).
|
|
16
84
|
* Looks for patterns like "- [ ]" (unchecked) vs "- [x]" (checked).
|
|
17
85
|
* Only flags if there ARE checkboxes and some are unchecked.
|
|
18
86
|
* Conditional items (containing "if applicable", "(if ...)", etc.) are
|
|
19
87
|
* excluded from the incomplete count (#152).
|
|
88
|
+
*
|
|
89
|
+
* Checkbox groups are parsed by markdown headings. Special handling applies (#1718):
|
|
90
|
+
* - Sections containing "leave unchecked where/if not applicable" are skipped entirely.
|
|
91
|
+
* - Sections whose heading matches "type of change" / "kind of change" / "category"
|
|
92
|
+
* are treated as single-select radio groups: satisfied when at least one box is
|
|
93
|
+
* checked, so the remaining unchecked boxes are not counted as incomplete.
|
|
20
94
|
*/
|
|
21
95
|
export function analyzeChecklist(body) {
|
|
22
96
|
if (!body)
|
|
23
97
|
return { hasIncompleteChecklist: false };
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
98
|
+
const sections = parseSections(body);
|
|
99
|
+
let totalChecked = 0;
|
|
100
|
+
let totalNonConditionalUnchecked = 0;
|
|
101
|
+
for (const section of sections) {
|
|
102
|
+
// null means no checkboxes or section is intentionally skipped
|
|
103
|
+
const result = analyzeSectionItems(section);
|
|
104
|
+
if (result === null)
|
|
105
|
+
continue;
|
|
106
|
+
totalChecked += result.checked;
|
|
107
|
+
totalNonConditionalUnchecked += result.nonConditionalUnchecked;
|
|
108
|
+
}
|
|
109
|
+
const effectiveTotal = totalChecked + totalNonConditionalUnchecked;
|
|
110
|
+
// No checkboxes, or every section was skipped (leave-unchecked) or fully conditional
|
|
111
|
+
if (effectiveTotal === 0)
|
|
32
112
|
return { hasIncompleteChecklist: false };
|
|
33
|
-
// Filter out conditional checklist items that are intentionally unchecked
|
|
34
|
-
const nonConditionalUnchecked = uncheckedLines.filter((line) => !isConditionalChecklistItem(line));
|
|
35
|
-
// Use consistent total that excludes conditional items (matches hasIncompleteChecklist logic)
|
|
36
|
-
const effectiveTotal = checked + nonConditionalUnchecked.length;
|
|
37
113
|
return {
|
|
38
|
-
hasIncompleteChecklist:
|
|
39
|
-
checklistStats: { checked, total: effectiveTotal },
|
|
114
|
+
hasIncompleteChecklist: totalNonConditionalUnchecked > 0,
|
|
115
|
+
checklistStats: { checked: totalChecked, total: effectiveTotal },
|
|
40
116
|
};
|
|
41
117
|
}
|
package/dist/core/paths.d.ts
CHANGED
|
@@ -75,7 +75,15 @@ export declare function getStateCachePath(): string;
|
|
|
75
75
|
*/
|
|
76
76
|
export declare function stateFileExists(): boolean;
|
|
77
77
|
/**
|
|
78
|
-
*
|
|
78
|
+
* Return the @oss-autopilot/core version.
|
|
79
|
+
*
|
|
80
|
+
* Bundled builds (the CLI bundle and the MCP server bundle, which inlines core)
|
|
81
|
+
* get it injected at bundle time. That matters for the MCP server: its argv[1]
|
|
82
|
+
* is the mcp-server bundle, so the package.json lookup below would return the
|
|
83
|
+
* mcp-server version, never equal to the core version the dashboard server
|
|
84
|
+
* records in its PID file (#1732).
|
|
85
|
+
*
|
|
86
|
+
* Unbundled runs fall back to package.json relative to the running entry point.
|
|
79
87
|
* Resolves `../package.json` from the real path of `process.argv[1]` (the bundle
|
|
80
88
|
* entry point). An npm install runs the CLI through the `node_modules/.bin/oss-autopilot`
|
|
81
89
|
* symlink, and Node leaves `process.argv[1]` as the symlink, so without `realpathSync`
|