@oss-autopilot/core 3.42.5 → 3.43.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-pre-action.js +8 -3
- package/dist/cli-registry.js +272 -25
- package/dist/cli.bundle.cjs +183 -154
- package/dist/commands/check-integration.js +1 -0
- package/dist/commands/cleanup.d.ts +76 -0
- package/dist/commands/cleanup.js +269 -0
- package/dist/commands/comments.d.ts +6 -0
- package/dist/commands/comments.js +6 -2
- package/dist/commands/config.js +37 -5
- package/dist/commands/daily-dismiss-filter.d.ts +7 -0
- package/dist/commands/daily-dismiss-filter.js +17 -1
- package/dist/commands/daily-ledger.d.ts +122 -0
- package/dist/commands/daily-ledger.js +225 -0
- package/dist/commands/daily-recent-prs.d.ts +26 -0
- package/dist/commands/daily-recent-prs.js +55 -0
- package/dist/commands/daily.d.ts +2 -1
- package/dist/commands/daily.js +59 -89
- package/dist/commands/dashboard-cache.d.ts +2 -0
- package/dist/commands/dashboard-cache.js +33 -8
- package/dist/commands/dashboard-data.js +71 -36
- package/dist/commands/dashboard-gist-sync.js +3 -1
- package/dist/commands/dashboard-lifecycle.js +1 -1
- package/dist/commands/dashboard-process.d.ts +14 -1
- package/dist/commands/dashboard-process.js +46 -7
- package/dist/commands/dashboard-server.js +89 -23
- package/dist/commands/detect-formatters.js +1 -0
- package/dist/commands/dismiss.js +5 -2
- package/dist/commands/doctor.d.ts +15 -1
- package/dist/commands/doctor.js +73 -5
- package/dist/commands/draft.d.ts +77 -0
- package/dist/commands/draft.js +218 -0
- package/dist/commands/eval.js +1 -0
- package/dist/commands/guidelines.d.ts +23 -1
- package/dist/commands/guidelines.js +49 -4
- package/dist/commands/index.d.ts +24 -4
- package/dist/commands/index.js +15 -3
- package/dist/commands/issue-thread.d.ts +46 -0
- package/dist/commands/issue-thread.js +123 -0
- package/dist/commands/ledger-backfill.d.ts +9 -0
- package/dist/commands/ledger-backfill.js +44 -1
- package/dist/commands/list-mark-done.d.ts +2 -1
- package/dist/commands/list-mark-done.js +3 -1
- package/dist/commands/list-move-tier.d.ts +2 -1
- package/dist/commands/list-move-tier.js +3 -1
- package/dist/commands/local-repos.js +10 -5
- package/dist/commands/locate-issue-list.d.ts +40 -17
- package/dist/commands/locate-issue-list.js +148 -88
- package/dist/commands/move.js +7 -1
- package/dist/commands/overnight-handoff.d.ts +17 -7
- package/dist/commands/overnight-handoff.js +36 -14
- package/dist/commands/overnight-push-prep.d.ts +13 -8
- package/dist/commands/overnight-push-prep.js +106 -34
- package/dist/commands/overnight-tool-rules.d.ts +54 -0
- package/dist/commands/overnight-tool-rules.js +217 -0
- package/dist/commands/overnight.d.ts +5 -6
- package/dist/commands/overnight.js +61 -140
- package/dist/commands/parse-list.js +7 -1
- package/dist/commands/policy.d.ts +86 -0
- package/dist/commands/policy.js +263 -0
- package/dist/commands/pr-preflight.d.ts +43 -0
- package/dist/commands/pr-preflight.js +294 -0
- package/dist/commands/repo-vet.d.ts +9 -0
- package/dist/commands/repo-vet.js +36 -11
- package/dist/commands/scout-bridge.js +18 -8
- package/dist/commands/search.js +7 -0
- package/dist/commands/setup.d.ts +3 -3
- package/dist/commands/setup.js +46 -18
- package/dist/commands/skip-add.js +10 -1
- package/dist/commands/startup.d.ts +5 -3
- package/dist/commands/startup.js +65 -49
- package/dist/commands/state-cmd.d.ts +2 -0
- package/dist/commands/state-cmd.js +5 -1
- package/dist/commands/stats.js +1 -0
- package/dist/commands/status.js +1 -0
- package/dist/commands/strategy.js +1 -0
- package/dist/commands/vet-list.d.ts +6 -0
- package/dist/commands/vet-list.js +25 -0
- package/dist/commands/vet.d.ts +12 -0
- package/dist/commands/vet.js +118 -1
- package/dist/core/__fixtures__/prompt-injection-payloads.js +31 -0
- package/dist/core/anti-llm-policy.d.ts +3 -0
- package/dist/core/anti-llm-policy.js +3 -0
- package/dist/core/auth.js +2 -0
- package/dist/core/ci-analysis.d.ts +7 -2
- package/dist/core/ci-analysis.js +76 -21
- package/dist/core/commit-date.d.ts +19 -0
- package/dist/core/commit-date.js +17 -0
- package/dist/core/config-registry.js +11 -5
- package/dist/core/contributing.d.ts +2 -3
- package/dist/core/contributing.js +2 -3
- package/dist/core/daily-logic.d.ts +27 -5
- package/dist/core/daily-logic.js +57 -19
- package/dist/core/errors.d.ts +37 -3
- package/dist/core/errors.js +54 -5
- package/dist/core/gist-health.d.ts +15 -3
- package/dist/core/gist-health.js +8 -0
- package/dist/core/gist-state-store.d.ts +24 -4
- package/dist/core/gist-state-store.js +97 -46
- package/dist/core/github-stats.d.ts +104 -16
- package/dist/core/github-stats.js +282 -97
- package/dist/core/http-cache.d.ts +0 -10
- package/dist/core/http-cache.js +0 -19
- package/dist/core/index.d.ts +12 -5
- package/dist/core/index.js +15 -5
- package/dist/core/issue-conversation.d.ts +8 -2
- package/dist/core/issue-conversation.js +31 -12
- package/dist/core/local-config.d.ts +95 -0
- package/dist/core/local-config.js +271 -0
- package/dist/core/merged-pr-notes.d.ts +2 -2
- package/dist/core/pagination.d.ts +55 -0
- package/dist/core/pagination.js +59 -0
- package/dist/core/paths.d.ts +7 -0
- package/dist/core/paths.js +9 -0
- package/dist/core/pr-assembly.js +6 -2
- package/dist/core/pr-graphql.d.ts +37 -3
- package/dist/core/pr-graphql.js +73 -12
- package/dist/core/pr-monitor.d.ts +29 -12
- package/dist/core/pr-monitor.js +71 -23
- package/dist/core/pr-preflight.d.ts +113 -0
- package/dist/core/pr-preflight.js +364 -0
- package/dist/core/pr-quality-rubric.d.ts +0 -6
- package/dist/core/pr-quality-rubric.js +0 -8
- package/dist/core/pr-template.d.ts +2 -0
- package/dist/core/pr-template.js +5 -1
- package/dist/core/repo-policy.d.ts +105 -0
- package/dist/core/repo-policy.js +400 -0
- package/dist/core/repo-score-manager.d.ts +48 -0
- package/dist/core/repo-score-manager.js +111 -1
- package/dist/core/review-analysis.d.ts +34 -19
- package/dist/core/review-analysis.js +67 -10
- package/dist/core/reviewed-prs-fetch.js +11 -29
- package/dist/core/reviewed-prs.js +8 -15
- package/dist/core/stale-data.d.ts +41 -0
- package/dist/core/stale-data.js +115 -0
- package/dist/core/state-persistence.d.ts +62 -27
- package/dist/core/state-persistence.js +338 -117
- package/dist/core/state-schema.d.ts +113 -210
- package/dist/core/state-schema.js +165 -80
- package/dist/core/state.d.ts +60 -8
- package/dist/core/state.js +192 -46
- package/dist/core/status-determination.js +26 -8
- package/dist/core/strategy.js +3 -1
- package/dist/core/types.d.ts +22 -1
- package/dist/core/types.js +1 -0
- package/dist/core/untrusted-content.d.ts +30 -11
- package/dist/core/untrusted-content.js +77 -42
- package/dist/core/urls.d.ts +9 -0
- package/dist/core/urls.js +18 -0
- package/dist/dashboard/assets/{chart-panel-DPKNBUts.js → chart-panel-C_C1lFTI.js} +1 -1
- package/dist/dashboard/assets/{index-B25bZOYX.js → index-B--H66Jk.js} +1 -1
- package/dist/dashboard/index.html +1 -1
- package/dist/formatters/json.d.ts +262 -6
- package/dist/formatters/json.js +77 -1
- package/package.json +1 -1
- package/dist/core/ci-enforced-tools.d.ts +0 -35
- package/dist/core/ci-enforced-tools.js +0 -109
- package/dist/core/comment-decision.d.ts +0 -79
- package/dist/core/comment-decision.js +0 -82
- package/dist/core/extraction-categories.d.ts +0 -55
- package/dist/core/extraction-categories.js +0 -108
- package/dist/core/follow-up-history.d.ts +0 -40
- package/dist/core/follow-up-history.js +0 -71
- package/dist/core/issue-effort.d.ts +0 -29
- package/dist/core/issue-effort.js +0 -47
- package/dist/core/maintainer-hints.d.ts +0 -23
- package/dist/core/maintainer-hints.js +0 -36
- package/dist/core/workflow-state.d.ts +0 -56
- package/dist/core/workflow-state.js +0 -101
package/dist/commands/setup.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getStateManager, DEFAULT_CONFIG, formatUnknownKeyError, getSetupKeys, maybeCheckpoint, } from '../core/index.js';
|
|
6
6
|
import { ValidationError } from '../core/errors.js';
|
|
7
|
+
import { MACHINE_PATH_KEYS, assertSafeMachinePath, setMachinePath, setMachineScanPaths } from '../core/local-config.js';
|
|
7
8
|
import { validateGitHubUsername } from './validation.js';
|
|
8
|
-
import { PROJECT_CATEGORIES, ISSUE_SCOPES, DIFF_TOOLS
|
|
9
|
+
import { PROJECT_CATEGORIES, ISSUE_SCOPES, DIFF_TOOLS } from '../core/types.js';
|
|
9
10
|
const MODULE = 'setup';
|
|
10
11
|
/** Parse and validate a positive integer setting value. */
|
|
11
12
|
function parsePositiveInt(value, settingName) {
|
|
@@ -28,6 +29,32 @@ function parseComplexIssues(value) {
|
|
|
28
29
|
}
|
|
29
30
|
return value;
|
|
30
31
|
}
|
|
32
|
+
/** Settings kept in this machine's local file, never synced (#1950, #2010). */
|
|
33
|
+
const MACHINE_LOCAL_KEYS = new Set([...MACHINE_PATH_KEYS, 'localRepoScanPaths']);
|
|
34
|
+
/**
|
|
35
|
+
* Refuse unknown keys, and path values with a shell metacharacter (#1934),
|
|
36
|
+
* before any pair is applied.
|
|
37
|
+
*/
|
|
38
|
+
function prevalidateSettings(settings) {
|
|
39
|
+
const knownKeys = new Set(getSetupKeys());
|
|
40
|
+
for (const setting of settings) {
|
|
41
|
+
const [key] = setting.split('=', 1);
|
|
42
|
+
if (!knownKeys.has(key)) {
|
|
43
|
+
throw new ValidationError(formatUnknownKeyError(key, 'setup'));
|
|
44
|
+
}
|
|
45
|
+
if (MACHINE_LOCAL_KEYS.has(key)) {
|
|
46
|
+
assertSafeMachinePath(key, setting.slice(key.length + 1));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** True when every `key=value` names a path kept in this machine's local file. */
|
|
51
|
+
function isMachineLocalOnly(settings) {
|
|
52
|
+
return settings.every((setting) => MACHINE_LOCAL_KEYS.has(setting.split('=', 1)[0]));
|
|
53
|
+
}
|
|
54
|
+
/** Warning for the config keys retired in #1948: still accepted and stored, never read. */
|
|
55
|
+
function retiredKeyWarning(key) {
|
|
56
|
+
return `${key} is retired and not read by oss-autopilot; it is kept for compatibility`;
|
|
57
|
+
}
|
|
31
58
|
/**
|
|
32
59
|
* Interactive setup wizard or direct setting application.
|
|
33
60
|
*
|
|
@@ -53,13 +80,7 @@ export async function runSetup(options) {
|
|
|
53
80
|
// mid-loop would leave earlier successful updates applied in memory (a real
|
|
54
81
|
// issue for long-running consumers like the MCP server and dashboard that
|
|
55
82
|
// share the StateManager singleton across requests).
|
|
56
|
-
|
|
57
|
-
for (const setting of options.set) {
|
|
58
|
-
const [key] = setting.split('=', 1);
|
|
59
|
-
if (!knownKeys.has(key)) {
|
|
60
|
-
throw new ValidationError(formatUnknownKeyError(key, 'setup'));
|
|
61
|
-
}
|
|
62
|
-
}
|
|
83
|
+
prevalidateSettings(options.set);
|
|
63
84
|
// Named so the Gist conflict path can re-apply the same settings on a
|
|
64
85
|
// refreshed baseline (maybeCheckpoint below).
|
|
65
86
|
const applySettings = () => {
|
|
@@ -140,11 +161,6 @@ export async function runSetup(options) {
|
|
|
140
161
|
results[key] = String(threshold);
|
|
141
162
|
break;
|
|
142
163
|
}
|
|
143
|
-
case 'skippedIssuesPath': {
|
|
144
|
-
stateManager.updateConfig({ skippedIssuesPath: value || undefined });
|
|
145
|
-
results[key] = value || '(cleared)';
|
|
146
|
-
break;
|
|
147
|
-
}
|
|
148
164
|
case 'autoExtractLearnings': {
|
|
149
165
|
if (value !== 'true' && value !== 'false') {
|
|
150
166
|
throw new ValidationError(`Invalid value for autoExtractLearnings: "${value}". Must be "true" or "false".`);
|
|
@@ -161,6 +177,7 @@ export async function runSetup(options) {
|
|
|
161
177
|
const enabled = value === 'true';
|
|
162
178
|
stateManager.updateConfig({ autoFormatBeforePush: enabled });
|
|
163
179
|
results[key] = String(enabled);
|
|
180
|
+
warnings.push(retiredKeyWarning(key));
|
|
164
181
|
break;
|
|
165
182
|
}
|
|
166
183
|
case 'trustOwnRepoWrites': {
|
|
@@ -170,6 +187,7 @@ export async function runSetup(options) {
|
|
|
170
187
|
const trusted = value === 'true';
|
|
171
188
|
stateManager.updateConfig({ trustOwnRepoWrites: trusted });
|
|
172
189
|
results[key] = String(trusted);
|
|
190
|
+
warnings.push(retiredKeyWarning(key));
|
|
173
191
|
break;
|
|
174
192
|
}
|
|
175
193
|
case 'includeDocIssues': {
|
|
@@ -327,9 +345,13 @@ export async function runSetup(options) {
|
|
|
327
345
|
results[key] = value;
|
|
328
346
|
break;
|
|
329
347
|
}
|
|
330
|
-
case 'issueListPath':
|
|
331
|
-
|
|
332
|
-
results[key] = value || '(cleared)';
|
|
348
|
+
case 'issueListPath':
|
|
349
|
+
case 'skippedIssuesPath': {
|
|
350
|
+
results[key] = setMachinePath(key, value || undefined) || '(cleared)';
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
case 'localRepoScanPaths': {
|
|
354
|
+
results[key] = setMachineScanPaths(value).join(', ') || '(cleared, using defaults)';
|
|
333
355
|
break;
|
|
334
356
|
}
|
|
335
357
|
case 'diffTool': {
|
|
@@ -364,6 +386,7 @@ export async function runSetup(options) {
|
|
|
364
386
|
const minutes = parsePositiveInt(value, 'healthCheckFreshnessMinutes');
|
|
365
387
|
stateManager.updateConfig({ healthCheckFreshnessMinutes: minutes });
|
|
366
388
|
results[key] = String(minutes);
|
|
389
|
+
warnings.push(retiredKeyWarning(key));
|
|
367
390
|
break;
|
|
368
391
|
}
|
|
369
392
|
case 'reviewMaxPasses': {
|
|
@@ -389,7 +412,11 @@ export async function runSetup(options) {
|
|
|
389
412
|
// Push the settings mutation to the Gist in gist mode (no-op locally).
|
|
390
413
|
// Without this the change only hits the local cache and the next
|
|
391
414
|
// bootstrap reverts it from the Gist (#1440).
|
|
392
|
-
|
|
415
|
+
// Path settings are written to this machine's local file only (#1950), so
|
|
416
|
+
// a call that sets nothing else has nothing to push.
|
|
417
|
+
const gistSyncWarning = isMachineLocalOnly(options.set)
|
|
418
|
+
? null
|
|
419
|
+
: await maybeCheckpoint(stateManager, MODULE, () => stateManager.batch(applySettings));
|
|
393
420
|
return {
|
|
394
421
|
success: true,
|
|
395
422
|
settings: results,
|
|
@@ -411,7 +438,7 @@ export async function runSetup(options) {
|
|
|
411
438
|
projectCategories: config.projectCategories ?? [],
|
|
412
439
|
preferredOrgs: config.preferredOrgs ?? [],
|
|
413
440
|
scope: config.scope ?? [],
|
|
414
|
-
persistence: config.persistence
|
|
441
|
+
persistence: config.persistence === 'gist' ? 'gist' : 'local',
|
|
415
442
|
},
|
|
416
443
|
};
|
|
417
444
|
}
|
|
@@ -503,6 +530,7 @@ export async function runSetup(options) {
|
|
|
503
530
|
* Check whether initial setup has been completed.
|
|
504
531
|
* @returns Setup status and configured username
|
|
505
532
|
*/
|
|
533
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- async keeps the Promise-returning contract callers rely on; the body has no await yet
|
|
506
534
|
export async function runCheckSetup() {
|
|
507
535
|
const stateManager = getStateManager();
|
|
508
536
|
return {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import * as fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
2
3
|
import { loadSkippedIssues } from './skip-file-parser.js';
|
|
3
4
|
import { getStateManager } from '../core/index.js';
|
|
5
|
+
import { getMachinePath } from '../core/local-config.js';
|
|
4
6
|
// Keep in sync with GITHUB_URL_RE in skip-file-parser.ts. Captures are kept
|
|
5
7
|
// (despite being unused here) so the regex stays byte-identical to the parser
|
|
6
8
|
// version where the captures are needed.
|
|
@@ -20,7 +22,7 @@ function formatUtcDate(d) {
|
|
|
20
22
|
* @throws when no path can be resolved or the URL isn't a GitHub issue/PR URL.
|
|
21
23
|
*/
|
|
22
24
|
export function runSkipAdd(options) {
|
|
23
|
-
const skipFilePath = options.skipFilePath ?? getStateManager().getState().config
|
|
25
|
+
const skipFilePath = options.skipFilePath ?? getMachinePath('skippedIssuesPath', getStateManager().getState().config);
|
|
24
26
|
if (!skipFilePath) {
|
|
25
27
|
throw new Error('No skipped-issues path configured. Set one via `oss-autopilot setup --set skippedIssuesPath=<path>` or pass --path.');
|
|
26
28
|
}
|
|
@@ -37,6 +39,13 @@ export function runSkipAdd(options) {
|
|
|
37
39
|
};
|
|
38
40
|
}
|
|
39
41
|
if (!fs.existsSync(skipFilePath)) {
|
|
42
|
+
// A path whose directory is missing is usually another machine's synced
|
|
43
|
+
// value (#1950): say so instead of failing with a bare ENOENT, and never
|
|
44
|
+
// create directories for it.
|
|
45
|
+
if (!fs.existsSync(path.dirname(path.resolve(skipFilePath)))) {
|
|
46
|
+
throw new Error(`Skipped-issues file ${skipFilePath} cannot be created: its directory does not exist on this machine. ` +
|
|
47
|
+
'Set the path for this machine via `oss-autopilot setup --set skippedIssuesPath=<path>` or pass --path.');
|
|
48
|
+
}
|
|
40
49
|
fs.writeFileSync(skipFilePath, FILE_HEADER);
|
|
41
50
|
}
|
|
42
51
|
const date = formatUtcDate(options.now ?? new Date());
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* `node cli.bundle.cjs startup --json` call, reducing UI noise in Claude Code.
|
|
8
8
|
*/
|
|
9
9
|
import { type StartupOutput, type IssueListInfo } from '../formatters/json.js';
|
|
10
|
-
export { parseIssueListPathFromConfig } from './locate-issue-list.js';
|
|
11
10
|
/**
|
|
12
11
|
* Count available and completed items in an issue list file.
|
|
13
12
|
* Available items exclude any vetting status that moves an item out of the
|
|
@@ -23,10 +22,13 @@ export declare function countIssueListItems(content: string): {
|
|
|
23
22
|
blockedCount: number;
|
|
24
23
|
};
|
|
25
24
|
/**
|
|
26
|
-
* Detect
|
|
25
|
+
* Detect the configured issue list file.
|
|
26
|
+
* @param shouldSuggest - With no configured list, return a list found in
|
|
27
|
+
* the current directory as `source: 'auto-detected'` for the user to confirm
|
|
28
|
+
* (#1933). Only `/oss` startup asks; nothing about it is saved.
|
|
27
29
|
* @returns Issue list info with path and item counts, or undefined if not found
|
|
28
30
|
*/
|
|
29
|
-
export declare function detectIssueList(): IssueListInfo | undefined;
|
|
31
|
+
export declare function detectIssueList(shouldSuggest?: boolean): IssueListInfo | undefined;
|
|
30
32
|
/**
|
|
31
33
|
* Open a URL in the default system browser.
|
|
32
34
|
* @param url - URL to open
|
package/dist/commands/startup.js
CHANGED
|
@@ -16,12 +16,9 @@ import { executeDailyCheck } from './daily.js';
|
|
|
16
16
|
import { launchDashboardServer } from './dashboard-lifecycle.js';
|
|
17
17
|
import { recordBrowserOpened } from './dashboard-process.js';
|
|
18
18
|
import { parseIssueList } from './parse-list.js';
|
|
19
|
-
import { detectIssueListPath, persistConfigPath } from './locate-issue-list.js';
|
|
19
|
+
import { detectIssueListPath, persistConfigPath, suggestIssueListPath } from './locate-issue-list.js';
|
|
20
|
+
import { getMachinePath, setMachinePath } from '../core/local-config.js';
|
|
20
21
|
import { overnightFreshness } from './overnight.js';
|
|
21
|
-
// Path detection moved to locate-issue-list.ts (#1463) so the daily
|
|
22
|
-
// merge-loop can use it without an import cycle through this module.
|
|
23
|
-
// Re-exported here for back-compat with existing consumers/tests.
|
|
24
|
-
export { parseIssueListPathFromConfig } from './locate-issue-list.js';
|
|
25
22
|
/**
|
|
26
23
|
* Count available and completed items in an issue list file.
|
|
27
24
|
* Available items exclude any vetting status that moves an item out of the
|
|
@@ -36,34 +33,11 @@ export function countIssueListItems(content) {
|
|
|
36
33
|
return { availableCount, completedCount, blockedCount };
|
|
37
34
|
}
|
|
38
35
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
36
|
+
* The skipped-issues file for a configured list: the configured path (a
|
|
37
|
+
* relative one anchored to the list's directory), else `skipped-issues.md`
|
|
38
|
+
* next to the list, saved for this machine when found.
|
|
41
39
|
*/
|
|
42
|
-
|
|
43
|
-
// Steps 1-3 (state config → legacy config.md → known-path probes) live in
|
|
44
|
-
// locate-issue-list.ts (#1463), shared with the daily merge-loop.
|
|
45
|
-
const located = detectIssueListPath();
|
|
46
|
-
if (!located)
|
|
47
|
-
return undefined;
|
|
48
|
-
const issueListPath = located.path;
|
|
49
|
-
const source = located.source;
|
|
50
|
-
// 4. Count available/completed items
|
|
51
|
-
let availableCount = 0;
|
|
52
|
-
let completedCount = 0;
|
|
53
|
-
let blockedCount = 0;
|
|
54
|
-
let readError;
|
|
55
|
-
try {
|
|
56
|
-
const content = fs.readFileSync(issueListPath, 'utf8');
|
|
57
|
-
({ availableCount, completedCount, blockedCount } = countIssueListItems(content));
|
|
58
|
-
}
|
|
59
|
-
catch (error) {
|
|
60
|
-
// Surface the failure in the envelope (#1448): a 0/0 count from an
|
|
61
|
-
// unreadable list is indistinguishable from a genuinely empty list, and
|
|
62
|
-
// an agent seeing 0 available may trigger a redundant fresh search.
|
|
63
|
-
readError = errorMessage(error);
|
|
64
|
-
console.error(`[STARTUP] Failed to read issue list at ${issueListPath}:`, readError);
|
|
65
|
-
}
|
|
66
|
-
// 5. Detect skipped issues file
|
|
40
|
+
function detectSkippedIssuesPath(issueListPath) {
|
|
67
41
|
let skippedIssuesPath;
|
|
68
42
|
// Check config first. A relative skippedIssuesPath is anchored to the issue
|
|
69
43
|
// list's (now absolute) directory — a stable base — not CWD, and upgraded to
|
|
@@ -73,8 +47,7 @@ export function detectIssueList() {
|
|
|
73
47
|
// unrelated working directory. A multi-segment relative that doesn't resolve
|
|
74
48
|
// here safely falls through to the list-dir default probe below.
|
|
75
49
|
try {
|
|
76
|
-
const
|
|
77
|
-
const configuredSkipPath = stateManager.getState().config.skippedIssuesPath;
|
|
50
|
+
const configuredSkipPath = getMachinePath('skippedIssuesPath', getStateManager().getState().config);
|
|
78
51
|
if (configuredSkipPath) {
|
|
79
52
|
const resolvedSkip = path.isAbsolute(configuredSkipPath)
|
|
80
53
|
? configuredSkipPath
|
|
@@ -99,18 +72,17 @@ export function detectIssueList() {
|
|
|
99
72
|
// (#1330). Without persistence, the auto-detect printed the path on
|
|
100
73
|
// every startup but nothing else honored it — search would re-surface
|
|
101
74
|
// already-skipped candidates round after round.
|
|
102
|
-
if (!skippedIssuesPath
|
|
75
|
+
if (!skippedIssuesPath) {
|
|
103
76
|
const defaultSkipPath = path.join(path.dirname(issueListPath), 'skipped-issues.md');
|
|
104
77
|
if (fs.existsSync(defaultSkipPath)) {
|
|
105
78
|
skippedIssuesPath = defaultSkipPath;
|
|
106
79
|
try {
|
|
107
|
-
|
|
108
|
-
//
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
const current = stateManager.getState().config.skippedIssuesPath;
|
|
80
|
+
// Only write when no path is configured: re-running startup
|
|
81
|
+
// shouldn't rewrite the value on every run if it is already there.
|
|
82
|
+
// The write goes to this machine's local settings (#1950).
|
|
83
|
+
const current = getMachinePath('skippedIssuesPath', getStateManager().getState().config);
|
|
112
84
|
if (!current) {
|
|
113
|
-
|
|
85
|
+
setMachinePath('skippedIssuesPath', defaultSkipPath, 'probe');
|
|
114
86
|
}
|
|
115
87
|
}
|
|
116
88
|
catch (err) {
|
|
@@ -121,6 +93,41 @@ export function detectIssueList() {
|
|
|
121
93
|
}
|
|
122
94
|
}
|
|
123
95
|
}
|
|
96
|
+
return skippedIssuesPath;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Detect the configured issue list file.
|
|
100
|
+
* @param shouldSuggest - With no configured list, return a list found in
|
|
101
|
+
* the current directory as `source: 'auto-detected'` for the user to confirm
|
|
102
|
+
* (#1933). Only `/oss` startup asks; nothing about it is saved.
|
|
103
|
+
* @returns Issue list info with path and item counts, or undefined if not found
|
|
104
|
+
*/
|
|
105
|
+
export function detectIssueList(shouldSuggest = false) {
|
|
106
|
+
// Path lookup lives in locate-issue-list.ts (#1463), shared with the daily merge-loop.
|
|
107
|
+
const located = detectIssueListPath() ?? (shouldSuggest ? suggestIssueListPath() : undefined);
|
|
108
|
+
if (!located)
|
|
109
|
+
return undefined;
|
|
110
|
+
const issueListPath = located.path;
|
|
111
|
+
const source = located.source;
|
|
112
|
+
// 4. Count available/completed items
|
|
113
|
+
let availableCount = 0;
|
|
114
|
+
let completedCount = 0;
|
|
115
|
+
let blockedCount = 0;
|
|
116
|
+
let readError;
|
|
117
|
+
try {
|
|
118
|
+
const content = fs.readFileSync(issueListPath, 'utf8');
|
|
119
|
+
({ availableCount, completedCount, blockedCount } = countIssueListItems(content));
|
|
120
|
+
}
|
|
121
|
+
catch (error) {
|
|
122
|
+
// Surface the failure in the envelope (#1448): a 0/0 count from an
|
|
123
|
+
// unreadable list is indistinguishable from a genuinely empty list, and
|
|
124
|
+
// an agent seeing 0 available may trigger a redundant fresh search.
|
|
125
|
+
readError = errorMessage(error);
|
|
126
|
+
console.error(`[STARTUP] Failed to read issue list at ${issueListPath}:`, readError);
|
|
127
|
+
}
|
|
128
|
+
// 5. Detect skipped issues file. A suggested list is not confirmed yet
|
|
129
|
+
// (#1933), so its directory is not searched for one.
|
|
130
|
+
const skippedIssuesPath = source === 'configured' ? detectSkippedIssuesPath(issueListPath) : undefined;
|
|
124
131
|
return {
|
|
125
132
|
path: issueListPath,
|
|
126
133
|
source,
|
|
@@ -208,6 +215,10 @@ function shouldOpenBrowser(spaResult, throttleMs) {
|
|
|
208
215
|
return true; // clock skew or future timestamp; treat as stale
|
|
209
216
|
return elapsed >= throttleMs;
|
|
210
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Returns `refresh-started` for a 202 (the server refreshes in the background
|
|
220
|
+
* and has not finished), `refreshed` for a completed refresh, null on failure.
|
|
221
|
+
*/
|
|
211
222
|
async function triggerDashboardRefresh(port) {
|
|
212
223
|
try {
|
|
213
224
|
const base = `http://127.0.0.1:${port}`;
|
|
@@ -218,24 +229,27 @@ async function triggerDashboardRefresh(port) {
|
|
|
218
229
|
await prime.text().catch(() => { });
|
|
219
230
|
if (!prime.ok || !csrfToken) {
|
|
220
231
|
console.error(`[STARTUP] Dashboard refresh returned ${prime.status}: no CSRF token from /api/data`);
|
|
221
|
-
return
|
|
232
|
+
return null;
|
|
222
233
|
}
|
|
223
234
|
const res = await fetch(`${base}/api/refresh`, {
|
|
224
235
|
method: 'POST',
|
|
225
|
-
|
|
236
|
+
// Ask for a 202 and a background refresh: the full GitHub fetch outlives
|
|
237
|
+
// this timeout, which used to log a failure for a refresh that then
|
|
238
|
+
// completed (#1927).
|
|
239
|
+
headers: { Origin: `http://oss.localhost:${port}`, 'X-CSRF-Token': csrfToken, Prefer: 'respond-async' },
|
|
226
240
|
signal: AbortSignal.timeout(5000),
|
|
227
241
|
});
|
|
228
242
|
if (!res.ok) {
|
|
229
243
|
const body = await res.text().catch(() => '');
|
|
230
244
|
console.error(`[STARTUP] Dashboard refresh returned ${res.status}: ${body}`);
|
|
231
|
-
return
|
|
245
|
+
return null;
|
|
232
246
|
}
|
|
233
247
|
await res.text().catch(() => { });
|
|
234
|
-
return
|
|
248
|
+
return res.status === 202 ? 'refresh-started' : 'refreshed';
|
|
235
249
|
}
|
|
236
250
|
catch (error) {
|
|
237
251
|
console.error(`[STARTUP] Could not trigger dashboard refresh: ${errorMessage(error)}`);
|
|
238
|
-
return
|
|
252
|
+
return null;
|
|
239
253
|
}
|
|
240
254
|
}
|
|
241
255
|
/**
|
|
@@ -302,8 +316,7 @@ export async function runStartup() {
|
|
|
302
316
|
if (spaResult) {
|
|
303
317
|
dashboardUrl = spaResult.url;
|
|
304
318
|
if (spaResult.alreadyRunning) {
|
|
305
|
-
|
|
306
|
-
dashboardStatus = refreshed ? 'refreshed' : 'running';
|
|
319
|
+
dashboardStatus = (await triggerDashboardRefresh(spaResult.port)) ?? 'running';
|
|
307
320
|
}
|
|
308
321
|
else {
|
|
309
322
|
dashboardStatus = 'opened';
|
|
@@ -334,11 +347,14 @@ export async function runStartup() {
|
|
|
334
347
|
else if (dashboardStatus === 'refreshed') {
|
|
335
348
|
daily.briefSummary += ' | Dashboard refreshed';
|
|
336
349
|
}
|
|
350
|
+
else if (dashboardStatus === 'refresh-started') {
|
|
351
|
+
daily.briefSummary += ' | Dashboard refresh started';
|
|
352
|
+
}
|
|
337
353
|
else if (dashboardStatus === 'running') {
|
|
338
354
|
daily.briefSummary += ' | Dashboard running';
|
|
339
355
|
}
|
|
340
356
|
// 5. Detect issue list
|
|
341
|
-
const issueList = detectIssueList();
|
|
357
|
+
const issueList = detectIssueList(true);
|
|
342
358
|
// 6. Pass through dashboard-build status set by the workflow shell (#1293).
|
|
343
359
|
// The workflow runs the SPA build BEFORE invoking startup, so the status
|
|
344
360
|
// arrives here via env vars rather than being something runStartup itself
|
|
@@ -9,6 +9,8 @@ export interface InvalidUrlEntry {
|
|
|
9
9
|
}
|
|
10
10
|
export interface StateShowOutput {
|
|
11
11
|
persistence: 'local' | 'gist';
|
|
12
|
+
/** The stored mode, present only when it is one a newer release added (#2005); `persistence` is then `local`. */
|
|
13
|
+
storedPersistence?: string;
|
|
12
14
|
gistId: string | null;
|
|
13
15
|
gistDegraded: boolean;
|
|
14
16
|
lastRunAt: string | undefined;
|
|
@@ -9,11 +9,15 @@ import { getStatePath, getGistIdPath } from '../core/paths.js';
|
|
|
9
9
|
import { parseGitHubUrl } from '../core/urls.js';
|
|
10
10
|
import { warn } from '../core/logger.js';
|
|
11
11
|
const MODULE = 'state-cmd';
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- async keeps the Promise-returning contract callers rely on; the body has no await yet
|
|
12
13
|
export async function runStateShow(options = {}) {
|
|
13
14
|
const sm = getStateManager();
|
|
14
15
|
const state = sm.getState();
|
|
16
|
+
const stored = state.config.persistence;
|
|
15
17
|
const output = {
|
|
16
|
-
|
|
18
|
+
// An unknown mode a newer release wrote runs as local (#2005).
|
|
19
|
+
persistence: stored === 'gist' ? 'gist' : 'local',
|
|
20
|
+
...(stored && stored !== 'local' && stored !== 'gist' && { storedPersistence: stored }),
|
|
17
21
|
gistId: state.gistId ?? null,
|
|
18
22
|
gistDegraded: sm.isGistDegraded(),
|
|
19
23
|
lastRunAt: state.lastRunAt,
|
package/dist/commands/stats.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { getStateManager } from '../core/index.js';
|
|
6
6
|
import { computeContributionStats } from '../core/stats.js';
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- async keeps the Promise-returning contract callers rely on; the body has no await yet
|
|
7
8
|
export async function runStats() {
|
|
8
9
|
const stateManager = getStateManager();
|
|
9
10
|
const state = stateManager.getState();
|
package/dist/commands/status.js
CHANGED
|
@@ -12,6 +12,7 @@ import { buildStalenessWarning } from '../formatters/json.js';
|
|
|
12
12
|
* @param options.offline - When true, adds cache freshness metadata
|
|
13
13
|
* @returns Contribution stats (merge rate, PR counts, repo breakdown)
|
|
14
14
|
*/
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- async keeps the Promise-returning contract callers rely on; the body has no await yet
|
|
15
16
|
export async function runStatus(options) {
|
|
16
17
|
const stateManager = getStateManager();
|
|
17
18
|
const stats = stateManager.getStats();
|
|
@@ -17,6 +17,7 @@ import { computeStrategy, STRATEGY_MIN_PRS } from '../core/strategy.js';
|
|
|
17
17
|
* message }` when state is below the merged-PR floor, and `{ strategy }`
|
|
18
18
|
* with the full typed result otherwise.
|
|
19
19
|
*/
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/require-await -- async keeps the Promise-returning contract callers rely on; the body has no await yet
|
|
20
21
|
export async function runStrategy() {
|
|
21
22
|
const stateManager = getStateManager();
|
|
22
23
|
const state = stateManager.getState();
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vet-list command (#764)
|
|
3
3
|
* Re-vets all available issues in a curated issue list file via @oss-scout/core.
|
|
4
|
+
*
|
|
5
|
+
* Each vetted repo's contribution policy (#2013) is read from scout's
|
|
6
|
+
* CONTRIBUTING text and anti-LLM scan only (no extra GitHub reads; `vet` adds
|
|
7
|
+
* the PR template and README-linked docs), applied to the row as in `vet` (a
|
|
8
|
+
* ban makes it a skip), and recorded once after the fan-out without replacing
|
|
9
|
+
* a stored reading unless it is a ban.
|
|
4
10
|
*/
|
|
5
11
|
import { type VetListOutput, type VetOutput, type VetListItemStatus } from '../formatters/json.js';
|
|
6
12
|
import { type IssueAvailabilityVerdict } from '../core/index.js';
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vet-list command (#764)
|
|
3
3
|
* Re-vets all available issues in a curated issue list file via @oss-scout/core.
|
|
4
|
+
*
|
|
5
|
+
* Each vetted repo's contribution policy (#2013) is read from scout's
|
|
6
|
+
* CONTRIBUTING text and anti-LLM scan only (no extra GitHub reads; `vet` adds
|
|
7
|
+
* the PR template and README-linked docs), applied to the row as in `vet` (a
|
|
8
|
+
* ban makes it a skip), and recorded once after the fan-out without replacing
|
|
9
|
+
* a stored reading unless it is a ban.
|
|
4
10
|
*/
|
|
5
11
|
import * as fs from 'node:fs';
|
|
6
12
|
import { adaptScoutLinkedPR, buildCandidateLinkedPR, createAutopilotScout } from './scout-bridge.js';
|
|
@@ -9,6 +15,9 @@ import { detectIssueList } from './startup.js';
|
|
|
9
15
|
import { computeSuccessGrade, gradeFromCandidate, reconcileRecommendation } from '../core/issue-grading.js';
|
|
10
16
|
import { repoCapField } from '../core/repo-cap.js';
|
|
11
17
|
import { ValidationError } from '../core/errors.js';
|
|
18
|
+
import { storedPolicy } from '../core/repo-policy.js';
|
|
19
|
+
import { policyFields, vetPolicy } from './vet.js';
|
|
20
|
+
import { recordVetPolicies } from './policy.js';
|
|
12
21
|
import { getStateManager, classifyLinkedPR, pickSnapshotFromVet, persistPickSnapshots, traitsFromVerification, isFirstInRepo, getOctokit, requireGitHubToken, parseGitHubUrl, verifyIssuesBatch, RULED_OUT_VERDICTS, workClaimVetFields, } from '../core/index.js';
|
|
13
22
|
const UNKNOWN_GRADE = computeSuccessGrade({ avgResponseDays: null, mergeRate: null, daysSinceLastCommit: null });
|
|
14
23
|
const KNOWN_SKIP_REASONS = new Set([
|
|
@@ -144,6 +153,19 @@ function ruledOutVetOutput(v) {
|
|
|
144
153
|
grade: UNKNOWN_GRADE,
|
|
145
154
|
};
|
|
146
155
|
}
|
|
156
|
+
/**
|
|
157
|
+
* {@link vetPolicy} for one candidate, added to `readings` when there is one.
|
|
158
|
+
* Returns the reading to show on the row: like the write (`fillOnly`), a
|
|
159
|
+
* stored record wins over it unless it is a ban.
|
|
160
|
+
*/
|
|
161
|
+
function readPolicy(candidate, readings) {
|
|
162
|
+
const policy = vetPolicy(candidate);
|
|
163
|
+
if (!policy)
|
|
164
|
+
return null;
|
|
165
|
+
readings.push({ repo: candidate.issue.repo, policy });
|
|
166
|
+
const isStored = storedPolicy(getStateManager().getState(), candidate.issue.repo) !== null;
|
|
167
|
+
return !isStored || policy.aiPolicy === 'banned' ? policy : null;
|
|
168
|
+
}
|
|
147
169
|
function toMessage(error) {
|
|
148
170
|
return error instanceof Error ? error.message : String(error);
|
|
149
171
|
}
|
|
@@ -197,6 +219,7 @@ export async function runVetList(options = {}) {
|
|
|
197
219
|
const scout = await createAutopilotScout();
|
|
198
220
|
// Vet-time predictions for calibration (#1824), recorded once after the fan-out.
|
|
199
221
|
const picks = [];
|
|
222
|
+
const policies = [];
|
|
200
223
|
/**
|
|
201
224
|
* Run scout's grade/health vet for an issue (the search-driven path). A pick is
|
|
202
225
|
* recorded only with a `verification`: on the verify-errored fallback, without
|
|
@@ -236,6 +259,7 @@ export async function runVetList(options = {}) {
|
|
|
236
259
|
slmTriage: candidate.slmTriage ?? null,
|
|
237
260
|
grade,
|
|
238
261
|
...repoCapField(getStateManager().getState(), candidate.issue.repo),
|
|
262
|
+
...policyFields(candidate, readPolicy(candidate, policies)),
|
|
239
263
|
};
|
|
240
264
|
if (verification) {
|
|
241
265
|
const pick = pickSnapshotFromVet(vetResult, 'vet-list', {
|
|
@@ -339,6 +363,7 @@ export async function runVetList(options = {}) {
|
|
|
339
363
|
const workers = Array.from({ length: Math.min(concurrency, items.length) }, () => processNext());
|
|
340
364
|
await Promise.all(workers);
|
|
341
365
|
const pickPersistence = await persistPickSnapshots(getStateManager(), picks);
|
|
366
|
+
await recordVetPolicies(policies, { fillOnly: true });
|
|
342
367
|
// 4. Compute summary
|
|
343
368
|
const summary = {
|
|
344
369
|
total: results.length,
|
package/dist/commands/vet.d.ts
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
* Vet command
|
|
3
3
|
* Vets a specific issue before working on it via @oss-scout/core
|
|
4
4
|
*/
|
|
5
|
+
import { createAutopilotScout } from './scout-bridge.js';
|
|
5
6
|
import { type VetOutput } from '../formatters/json.js';
|
|
7
|
+
import { type PolicyDoc, type RepoPolicy } from '../core/repo-policy.js';
|
|
6
8
|
export { type VetOutput } from '../formatters/json.js';
|
|
7
9
|
interface VetOptions {
|
|
8
10
|
issueUrl: string;
|
|
@@ -16,3 +18,13 @@ interface VetOptions {
|
|
|
16
18
|
* @throws {ValidationError} If the URL is not a valid GitHub issue URL
|
|
17
19
|
*/
|
|
18
20
|
export declare function runVet(options: VetOptions): Promise<VetOutput>;
|
|
21
|
+
export type ScoutCandidate = Awaited<ReturnType<Awaited<ReturnType<typeof createAutopilotScout>>['vetIssue']>>;
|
|
22
|
+
/**
|
|
23
|
+
* The repo's contribution policy as far as vet read it (#1953): scout's
|
|
24
|
+
* CONTRIBUTING text and `extraDocs` through the policy parsers, plus scout's own
|
|
25
|
+
* anti-LLM scan (which also reads README and CODE_OF_CONDUCT). Null when vet
|
|
26
|
+
* read nothing or the scan result is missing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function vetPolicy(candidate: ScoutCandidate, extraDocs?: readonly PolicyDoc[]): RepoPolicy | null;
|
|
29
|
+
/** The policy that applies to the candidate's repo, with `derived` as the fresh reading; a ban makes the issue a skip. */
|
|
30
|
+
export declare function policyFields(candidate: ScoutCandidate, derived: RepoPolicy | null): Partial<VetOutput>;
|