@oss-autopilot/core 3.27.0 → 3.28.1
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-pre-action.d.ts +9 -0
- package/dist/cli-pre-action.js +95 -0
- package/dist/cli-registry.js +11 -1
- package/dist/cli.bundle.cjs +116 -113
- package/dist/cli.js +4 -87
- package/dist/commands/comments.js +3 -1
- package/dist/commands/dashboard-lifecycle.d.ts +25 -2
- package/dist/commands/dashboard-lifecycle.js +71 -55
- package/dist/commands/dashboard-server.js +1 -1
- package/dist/commands/dashboard.d.ts +2 -2
- package/dist/commands/dashboard.js +13 -5
- package/dist/commands/overnight-push-prep.js +4 -0
- package/dist/commands/overnight.js +31 -1
- 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/ci-analysis.js +11 -4
- package/dist/core/errors.d.ts +17 -0
- package/dist/core/errors.js +25 -0
- package/dist/core/paths.d.ts +9 -1
- package/dist/core/paths.js +11 -1
- package/dist/core/pr-monitor.d.ts +2 -2
- package/dist/core/pr-monitor.js +9 -6
- package/dist/core/review-analysis.d.ts +6 -2
- package/dist/core/review-analysis.js +13 -4
- package/dist/core/types.d.ts +1 -1
- package/dist/dashboard/assets/chart-panel-0drzwc3-.js +3 -0
- package/dist/dashboard/assets/confetti.module-BYDB1iN2.js +2 -0
- package/dist/dashboard/assets/index-C0LCGMVi.js +50 -0
- package/dist/dashboard/assets/index-CTiG-vjC.css +1 -0
- package/dist/dashboard/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
- package/dist/dashboard/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
- package/dist/dashboard/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/dashboard/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-400-normal-BDKaGhyp.woff +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-400-normal-Dhut76fR.woff2 +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-500-normal-Bf-nb4oT.woff2 +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-500-normal-DYtqi0QS.woff +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-600-normal-BR_Ojra4.woff +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-600-normal-DLTa1BUW.woff2 +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-700-normal-CfpNZvy6.woff2 +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-700-normal-DqEcQeE5.woff +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-800-normal-BRNHt2w0.woff +0 -0
- package/dist/dashboard/assets/plus-jakarta-sans-latin-800-normal-CusIZhrK.woff2 +0 -0
- package/dist/dashboard/favicon.svg +83 -0
- package/dist/dashboard/index.html +54 -0
- package/dist/formatters/json.d.ts +19 -0
- package/dist/formatters/json.js +3 -0
- package/package.json +3 -2
|
@@ -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/ci-analysis.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getHttpStatusCode, errorMessage } from './errors.js';
|
|
6
6
|
import { debug, warn } from './logger.js';
|
|
7
|
+
import { paginateAll } from './pagination.js';
|
|
7
8
|
/** Return a fresh unknown CI status (avoids shared mutable state between callers). */
|
|
8
9
|
function unknownCIStatus() {
|
|
9
10
|
return { status: 'unknown', failingCheckNames: [], failingCheckConclusions: new Map() };
|
|
@@ -315,10 +316,16 @@ export async function getCIStatus(octokit, owner, repo, sha) {
|
|
|
315
316
|
return unknownCIStatus();
|
|
316
317
|
try {
|
|
317
318
|
// Fetch both combined status and check runs in parallel
|
|
318
|
-
const [statusResponse,
|
|
319
|
-
|
|
319
|
+
const [statusResponse, checkRuns] = await Promise.all([
|
|
320
|
+
// per_page 100: the default page holds 30 statuses, and analyzeCombinedStatus
|
|
321
|
+
// only sees the page it is given.
|
|
322
|
+
octokit.repos.getCombinedStatusForRef({ owner, repo, ref: sha, per_page: 100 }),
|
|
320
323
|
// 404 is expected for repos without check runs configured; log other errors for debugging
|
|
321
|
-
|
|
324
|
+
// Paginated: the default page is 30 check runs, and a failing check on a
|
|
325
|
+
// later page would otherwise read as passing.
|
|
326
|
+
paginateAll((page) => octokit.checks
|
|
327
|
+
.listForRef({ owner, repo, ref: sha, per_page: 100, page })
|
|
328
|
+
.then((res) => ({ data: res.data.check_runs }))).catch((err) => {
|
|
322
329
|
const status = getHttpStatusCode(err);
|
|
323
330
|
// Rate limit errors must propagate — matches listReviewComments pattern (#481)
|
|
324
331
|
if (status === 429)
|
|
@@ -338,7 +345,7 @@ export async function getCIStatus(octokit, owner, repo, sha) {
|
|
|
338
345
|
}),
|
|
339
346
|
]);
|
|
340
347
|
const combinedStatus = statusResponse.data;
|
|
341
|
-
const allCheckRuns =
|
|
348
|
+
const allCheckRuns = checkRuns ?? [];
|
|
342
349
|
return computeCIStatus(allCheckRuns, combinedStatus);
|
|
343
350
|
}
|
|
344
351
|
catch (error) {
|
package/dist/core/errors.d.ts
CHANGED
|
@@ -20,6 +20,23 @@ export declare class OssAutopilotError extends Error {
|
|
|
20
20
|
export declare class ConfigurationError extends OssAutopilotError {
|
|
21
21
|
constructor(message: string);
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Set by the scheduled overnight job (see `renderLaunchdPlist`). Any defined
|
|
25
|
+
* value, even an empty one, marks the run as unattended. Nobody
|
|
26
|
+
* is present to approve anything in that run, so the commands that write to
|
|
27
|
+
* GitHub refuse while it is set.
|
|
28
|
+
*/
|
|
29
|
+
export declare const UNATTENDED_ENV = "OSS_AUTOPILOT_UNATTENDED";
|
|
30
|
+
/**
|
|
31
|
+
* Refuse a GitHub-writing action during an unattended run.
|
|
32
|
+
*
|
|
33
|
+
* The overnight allowlist has to permit `node`, because the run itself calls
|
|
34
|
+
* this CLI, so a deny rule on the command line cannot keep the model away from
|
|
35
|
+
* `post`, `claim` or `overnight push-prep`. The check lives here instead, where
|
|
36
|
+
* every route to the write (CLI, MCP tool, library import) passes through it.
|
|
37
|
+
* This closes the direct path; it is not a sandbox against arbitrary code.
|
|
38
|
+
*/
|
|
39
|
+
export declare function assertAttended(action: string): void;
|
|
23
40
|
/**
|
|
24
41
|
* Input validation errors (invalid URLs, out-of-range values).
|
|
25
42
|
*/
|
package/dist/core/errors.js
CHANGED
|
@@ -28,6 +28,31 @@ export class ConfigurationError extends OssAutopilotError {
|
|
|
28
28
|
this.name = 'ConfigurationError';
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Set by the scheduled overnight job (see `renderLaunchdPlist`). Any defined
|
|
33
|
+
* value, even an empty one, marks the run as unattended. Nobody
|
|
34
|
+
* is present to approve anything in that run, so the commands that write to
|
|
35
|
+
* GitHub refuse while it is set.
|
|
36
|
+
*/
|
|
37
|
+
export const UNATTENDED_ENV = 'OSS_AUTOPILOT_UNATTENDED';
|
|
38
|
+
/**
|
|
39
|
+
* Refuse a GitHub-writing action during an unattended run.
|
|
40
|
+
*
|
|
41
|
+
* The overnight allowlist has to permit `node`, because the run itself calls
|
|
42
|
+
* this CLI, so a deny rule on the command line cannot keep the model away from
|
|
43
|
+
* `post`, `claim` or `overnight push-prep`. The check lives here instead, where
|
|
44
|
+
* every route to the write (CLI, MCP tool, library import) passes through it.
|
|
45
|
+
* This closes the direct path; it is not a sandbox against arbitrary code.
|
|
46
|
+
*/
|
|
47
|
+
export function assertAttended(action) {
|
|
48
|
+
// Any defined value counts, including '' and '0'. If a value could switch the
|
|
49
|
+
// guard off, prefixing the command with `${UNATTENDED_ENV}=0` would be the
|
|
50
|
+
// shortest way around it.
|
|
51
|
+
if (process.env[UNATTENDED_ENV] !== undefined) {
|
|
52
|
+
throw new ConfigurationError(`Refusing to ${action} during an unattended run (${UNATTENDED_ENV} is set). ` +
|
|
53
|
+
'Run it yourself in an interactive session.');
|
|
54
|
+
}
|
|
55
|
+
}
|
|
31
56
|
/**
|
|
32
57
|
* Input validation errors (invalid URLs, out-of-range values).
|
|
33
58
|
*/
|
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`
|
package/dist/core/paths.js
CHANGED
|
@@ -115,7 +115,15 @@ export function stateFileExists() {
|
|
|
115
115
|
return fs.existsSync(stateFile);
|
|
116
116
|
}
|
|
117
117
|
/**
|
|
118
|
-
*
|
|
118
|
+
* Return the @oss-autopilot/core version.
|
|
119
|
+
*
|
|
120
|
+
* Bundled builds (the CLI bundle and the MCP server bundle, which inlines core)
|
|
121
|
+
* get it injected at bundle time. That matters for the MCP server: its argv[1]
|
|
122
|
+
* is the mcp-server bundle, so the package.json lookup below would return the
|
|
123
|
+
* mcp-server version, never equal to the core version the dashboard server
|
|
124
|
+
* records in its PID file (#1732).
|
|
125
|
+
*
|
|
126
|
+
* Unbundled runs fall back to package.json relative to the running entry point.
|
|
119
127
|
* Resolves `../package.json` from the real path of `process.argv[1]` (the bundle
|
|
120
128
|
* entry point). An npm install runs the CLI through the `node_modules/.bin/oss-autopilot`
|
|
121
129
|
* symlink, and Node leaves `process.argv[1]` as the symlink, so without `realpathSync`
|
|
@@ -123,6 +131,8 @@ export function stateFileExists() {
|
|
|
123
131
|
* Falls back to '0.0.0' if the file is unreadable.
|
|
124
132
|
*/
|
|
125
133
|
export function getCLIVersion() {
|
|
134
|
+
if (typeof __OSS_AUTOPILOT_CORE_VERSION__ === 'string')
|
|
135
|
+
return __OSS_AUTOPILOT_CORE_VERSION__;
|
|
126
136
|
try {
|
|
127
137
|
const entry = fs.realpathSync(process.argv[1]);
|
|
128
138
|
const pkgPath = path.join(path.dirname(entry), '..', 'package.json');
|
|
@@ -40,8 +40,8 @@ export interface FetchPRsResult {
|
|
|
40
40
|
* - Post-fetch viewer-mismatch guardrail (configured username differs
|
|
41
41
|
* from the authenticated viewer when the search returned zero PRs).
|
|
42
42
|
* - Search API 1000-result truncation (#1057 M25).
|
|
43
|
-
* - Per-PR comment pagination truncation (#1456) — newest
|
|
44
|
-
* dropped, so unresponded-comment detection may be incomplete.
|
|
43
|
+
* - Per-PR comment or review pagination truncation (#1456) — newest entries
|
|
44
|
+
* dropped, so review-decision / unresponded-comment detection may be incomplete.
|
|
45
45
|
* Callers (daily, dashboard) surface these so users see the signal.
|
|
46
46
|
*/
|
|
47
47
|
warnings?: string[];
|
package/dist/core/pr-monitor.js
CHANGED
|
@@ -317,10 +317,13 @@ export class PRMonitor {
|
|
|
317
317
|
// Fetch PR data, comments, reviews, and inline review comments in parallel.
|
|
318
318
|
// listReviewComments is non-critical (used for self-reply detection), so degrade
|
|
319
319
|
// gracefully on failure rather than dropping the entire PR (#199).
|
|
320
|
-
const [prResponse, commentsResult,
|
|
320
|
+
const [prResponse, commentsResult, reviewsResult, reviewCommentsResult] = await Promise.all([
|
|
321
321
|
this.octokit.pulls.get({ owner, repo, pull_number: number }),
|
|
322
322
|
paginateAllDetailed((page) => this.octokit.issues.listComments({ owner, repo, issue_number: number, per_page: 100, page })),
|
|
323
|
-
this
|
|
323
|
+
// Paginated: PRs land on this REST path precisely when GraphQL's review
|
|
324
|
+
// cap overflowed, and listReviews returns oldest-first, so an unpaginated
|
|
325
|
+
// call would drop the newest verdicts.
|
|
326
|
+
paginateAllDetailed((page) => this.octokit.pulls.listReviews({ owner, repo, pull_number: number, per_page: 100, page })),
|
|
324
327
|
paginateAllDetailed((page) => this.octokit.pulls.listReviewComments({ owner, repo, pull_number: number, per_page: 100, page })).catch((err) => {
|
|
325
328
|
const status = getHttpStatusCode(err);
|
|
326
329
|
// Rate limit errors must propagate — silently swallowing them hides
|
|
@@ -352,14 +355,14 @@ export class PRMonitor {
|
|
|
352
355
|
// (#1456): comments arrive oldest-first, so hitting the cap drops the
|
|
353
356
|
// NEWEST maintainer feedback — status determination (unresponded-comment
|
|
354
357
|
// detection) may be wrong for this PR.
|
|
355
|
-
if (commentsResult.truncated || reviewCommentsResult.truncated) {
|
|
356
|
-
const message = `Comment pagination cap reached for ${owner}/${repo}#${number}; the newest comments were not ` +
|
|
357
|
-
`fetched and unresponded-comment detection may be incomplete.`;
|
|
358
|
+
if (commentsResult.truncated || reviewsResult.truncated || reviewCommentsResult.truncated) {
|
|
359
|
+
const message = `Comment pagination cap reached for ${owner}/${repo}#${number}; the newest comments or reviews were not ` +
|
|
360
|
+
`fetched and review-decision / unresponded-comment detection may be incomplete.`;
|
|
358
361
|
warnings?.push(message);
|
|
359
362
|
warn(MODULE, message);
|
|
360
363
|
}
|
|
361
364
|
const ghPR = prResponse.data;
|
|
362
|
-
const reviews =
|
|
365
|
+
const reviews = reviewsResult.items;
|
|
363
366
|
const ciStatus = await getCIStatus(this.octokit, owner, repo, ghPR.head.sha);
|
|
364
367
|
// The commit date is only consulted (and only fetched) when the PR has an
|
|
365
368
|
// unresponded maintainer comment or a changes-requested review — the shared
|
|
@@ -17,8 +17,12 @@ export interface ReviewComment {
|
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* Determine review decision from reviews list.
|
|
20
|
-
* Groups reviews by user, keeping
|
|
21
|
-
*
|
|
20
|
+
* Groups reviews by user, keeping each user's latest verdict, then checks
|
|
21
|
+
* for CHANGES_REQUESTED or APPROVED states.
|
|
22
|
+
*
|
|
23
|
+
* Only APPROVED, CHANGES_REQUESTED and DISMISSED change a reviewer's standing
|
|
24
|
+
* verdict on GitHub. COMMENTED is also what GitHub records for every inline
|
|
25
|
+
* reply, so it must not overwrite an earlier verdict from the same reviewer.
|
|
22
26
|
*/
|
|
23
27
|
export declare function determineReviewDecision(reviews: Array<{
|
|
24
28
|
state?: string | null;
|
|
@@ -6,19 +6,28 @@
|
|
|
6
6
|
import { isBotAuthor, isAcknowledgmentComment } from './comment-utils.js';
|
|
7
7
|
/**
|
|
8
8
|
* Determine review decision from reviews list.
|
|
9
|
-
* Groups reviews by user, keeping
|
|
10
|
-
*
|
|
9
|
+
* Groups reviews by user, keeping each user's latest verdict, then checks
|
|
10
|
+
* for CHANGES_REQUESTED or APPROVED states.
|
|
11
|
+
*
|
|
12
|
+
* Only APPROVED, CHANGES_REQUESTED and DISMISSED change a reviewer's standing
|
|
13
|
+
* verdict on GitHub. COMMENTED is also what GitHub records for every inline
|
|
14
|
+
* reply, so it must not overwrite an earlier verdict from the same reviewer.
|
|
11
15
|
*/
|
|
12
16
|
export function determineReviewDecision(reviews) {
|
|
13
17
|
if (reviews.length === 0) {
|
|
14
18
|
return 'review_required';
|
|
15
19
|
}
|
|
16
|
-
// Group reviews by user, keeping
|
|
20
|
+
// Group reviews by user, keeping each user's latest verdict
|
|
17
21
|
const latestByUser = new Map();
|
|
18
22
|
for (const review of reviews) {
|
|
19
23
|
const login = review.user?.login;
|
|
20
24
|
const state = review.state;
|
|
21
|
-
if (login
|
|
25
|
+
if (!login || !state)
|
|
26
|
+
continue;
|
|
27
|
+
if (state === 'DISMISSED') {
|
|
28
|
+
latestByUser.delete(login);
|
|
29
|
+
}
|
|
30
|
+
else if (state === 'APPROVED' || state === 'CHANGES_REQUESTED') {
|
|
22
31
|
latestByUser.set(login, state);
|
|
23
32
|
}
|
|
24
33
|
}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -73,7 +73,7 @@ export interface RepoGroup {
|
|
|
73
73
|
repo: string;
|
|
74
74
|
prs: FetchedPR[];
|
|
75
75
|
}
|
|
76
|
-
/**
|
|
76
|
+
/** Pull request review decision, computed from the PR's reviews by `determineReviewDecision`. */
|
|
77
77
|
export type ReviewDecision = 'approved' | 'changes_requested' | 'review_required' | 'unknown';
|
|
78
78
|
/** Input options for `determineStatus()` (see status-determination.ts). */
|
|
79
79
|
export interface DetermineStatusInput {
|