@oss-autopilot/core 3.32.0 → 3.33.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.
Files changed (69) hide show
  1. package/dist/cli-pre-action.js +20 -20
  2. package/dist/cli-registry.js +23 -23
  3. package/dist/cli.bundle.cjs +100 -99
  4. package/dist/commands/check-integration.d.ts +2 -2
  5. package/dist/commands/comments.js +3 -3
  6. package/dist/commands/compliance-score.js +1 -1
  7. package/dist/commands/config.js +1 -1
  8. package/dist/commands/daily-render.js +6 -13
  9. package/dist/commands/daily.d.ts +1 -2
  10. package/dist/commands/daily.js +3 -3
  11. package/dist/commands/dashboard-cache.js +1 -1
  12. package/dist/commands/dashboard-data.js +5 -6
  13. package/dist/commands/dashboard-lifecycle.js +3 -5
  14. package/dist/commands/dashboard-server.js +3 -3
  15. package/dist/commands/detect-formatters.d.ts +1 -1
  16. package/dist/commands/dismiss.js +2 -2
  17. package/dist/commands/doctor.js +3 -3
  18. package/dist/commands/features.js +1 -1
  19. package/dist/commands/guidelines.js +5 -5
  20. package/dist/commands/init.js +1 -1
  21. package/dist/commands/local-repos.d.ts +1 -1
  22. package/dist/commands/overnight.js +13 -18
  23. package/dist/commands/parse-list.d.ts +2 -2
  24. package/dist/commands/parse-list.js +7 -7
  25. package/dist/commands/repo-vet.js +3 -3
  26. package/dist/commands/search.d.ts +8 -0
  27. package/dist/commands/search.js +21 -19
  28. package/dist/commands/setup.js +8 -8
  29. package/dist/commands/startup.js +1 -1
  30. package/dist/commands/status.d.ts +1 -1
  31. package/dist/commands/vet-list.js +1 -1
  32. package/dist/commands/vet.js +1 -1
  33. package/dist/core/__fixtures__/prompt-injection-payloads.js +1 -1
  34. package/dist/core/anti-llm-policy.js +3 -3
  35. package/dist/core/checklist-analysis.d.ts +3 -0
  36. package/dist/core/checklist-analysis.js +67 -16
  37. package/dist/core/ci-analysis.js +1 -1
  38. package/dist/core/comment-decision.js +1 -1
  39. package/dist/core/compliance-score.js +2 -2
  40. package/dist/core/daily-logic.js +1 -2
  41. package/dist/core/display-utils.js +1 -1
  42. package/dist/core/errors.js +4 -5
  43. package/dist/core/follow-up-history.d.ts +1 -2
  44. package/dist/core/follow-up-history.js +1 -1
  45. package/dist/core/github-stats.js +1 -1
  46. package/dist/core/guidelines-store.js +2 -2
  47. package/dist/core/http-cache.js +1 -2
  48. package/dist/core/index.d.ts +1 -1
  49. package/dist/core/index.js +1 -1
  50. package/dist/core/issue-conversation.js +1 -1
  51. package/dist/core/issue-effort.js +12 -6
  52. package/dist/core/paths.d.ts +7 -0
  53. package/dist/core/paths.js +25 -3
  54. package/dist/core/pr-comments-fetcher.js +1 -1
  55. package/dist/core/review-analysis.js +5 -9
  56. package/dist/core/state-persistence.js +1 -1
  57. package/dist/core/state.js +2 -2
  58. package/dist/core/strategy.js +2 -3
  59. package/dist/core/untrusted-content.js +9 -9
  60. package/dist/core/urls.js +1 -1
  61. package/dist/dashboard/assets/chart-panel-DPKNBUts.js +3 -0
  62. package/dist/dashboard/assets/{confetti.module-BYDB1iN2.js → confetti.module-D2UmBLOm.js} +1 -1
  63. package/dist/dashboard/assets/index-B25bZOYX.js +55 -0
  64. package/dist/dashboard/index.html +1 -1
  65. package/dist/formatters/json.d.ts +2 -2
  66. package/dist/formatters/json.js +2 -2
  67. package/package.json +2 -2
  68. package/dist/dashboard/assets/chart-panel-CmNIsCjO.js +0 -3
  69. package/dist/dashboard/assets/index-CTKGc-Ns.js +0 -55
@@ -2,9 +2,9 @@
2
2
  * Check integration command (#83)
3
3
  * Detects new files in the current branch that aren't referenced elsewhere
4
4
  */
5
- import type { CheckIntegrationOutput, NewFileInfo } from '../formatters/json.js';
5
+ import type { CheckIntegrationOutput } from '../formatters/json.js';
6
6
  interface CheckIntegrationOptions {
7
7
  base: string;
8
8
  }
9
- export type { CheckIntegrationOutput, NewFileInfo };
10
9
  export declare function runCheckIntegration(options: CheckIntegrationOptions): Promise<CheckIntegrationOutput>;
10
+ export { type CheckIntegrationOutput, type NewFileInfo } from '../formatters/json.js';
@@ -144,7 +144,7 @@ export async function runComments(options) {
144
144
  inlineCommentCount: relevantReviewComments.length,
145
145
  discussionCommentCount: relevantIssueComments.length,
146
146
  },
147
- ...(warnings.length > 0 ? { warnings } : {}),
147
+ ...(warnings.length > 0 && { warnings }),
148
148
  };
149
149
  }
150
150
  /**
@@ -274,7 +274,7 @@ export async function runClaim(options) {
274
274
  return {
275
275
  commentUrl: comment.html_url,
276
276
  issueUrl: options.issueUrl,
277
- ...(gistSyncWarning ? { gistSyncWarning } : {}),
278
- ...(stateSaveWarning ? { stateSaveWarning } : {}),
277
+ ...(gistSyncWarning && { gistSyncWarning }),
278
+ ...(stateSaveWarning && { stateSaveWarning }),
279
279
  };
280
280
  }
@@ -92,7 +92,7 @@ async function verifyLinkedIssues(octokit, prRepo, refs, now = new Date()) {
92
92
  return { number, repo: fullRepo, crossRepo, state: 'open' };
93
93
  }
94
94
  const closedAt = data.closed_at ? new Date(data.closed_at) : null;
95
- const closedDaysAgo = closedAt ? Math.floor((now.getTime() - closedAt.getTime()) / 86400000) : undefined;
95
+ const closedDaysAgo = closedAt ? Math.floor((now.getTime() - closedAt.getTime()) / 86_400_000) : undefined;
96
96
  return { number, repo: fullRepo, crossRepo, state: 'closed', closedDaysAgo };
97
97
  }
98
98
  catch (err) {
@@ -184,5 +184,5 @@ export async function runConfig(options) {
184
184
  // Without this the change only hits the local cache and the next
185
185
  // bootstrap reverts it from the Gist (#1440).
186
186
  const gistSyncWarning = await maybeCheckpoint(stateManager, MODULE);
187
- return { success: true, key: options.key, value, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
187
+ return { success: true, key: options.key, value, ...(gistSyncWarning && { gistSyncWarning }) };
188
188
  }
@@ -60,24 +60,18 @@ export function formatBriefSummary(digest, issueCount, issueResponseCount = 0, a
60
60
  */
61
61
  export function formatSummary(digest, capacity, issueResponses = []) {
62
62
  const lines = [];
63
- lines.push('## OSS Dashboard');
64
- lines.push('');
65
- lines.push(`\u{1F4CA} **${digest.summary.totalActivePRs} Active PRs** | ${digest.summary.totalMergedAllTime} Merged | ${digest.summary.mergeRate}% Merge Rate`);
66
- lines.push('✓ Dashboard generated — say "open dashboard" to view in browser');
67
- lines.push('');
63
+ lines.push('## OSS Dashboard', '', `\u{1F4CA} **${digest.summary.totalActivePRs} Active PRs** | ${digest.summary.totalMergedAllTime} Merged | ${digest.summary.mergeRate}% Merge Rate`, '✓ Dashboard generated — say "open dashboard" to view in browser', '');
68
64
  if (digest.needsAddressingPRs.length > 0) {
69
65
  lines.push('### ❌ Needs Addressing');
70
66
  for (const pr of digest.needsAddressingPRs) {
71
- lines.push(`- [${pr.repo}#${pr.number}](${pr.url}): ${pr.title}`);
72
- lines.push(` └─ ${pr.displayLabel} ${pr.displayDescription}`);
67
+ lines.push(`- [${pr.repo}#${pr.number}](${pr.url}): ${pr.title}`, ` └─ ${pr.displayLabel} ${pr.displayDescription}`);
73
68
  }
74
69
  lines.push('');
75
70
  }
76
71
  if (digest.waitingOnMaintainerPRs.length > 0) {
77
72
  lines.push('### ⏳ Waiting on Maintainer');
78
73
  for (const pr of digest.waitingOnMaintainerPRs) {
79
- lines.push(`- [${pr.repo}#${pr.number}](${pr.url}): ${pr.title}`);
80
- lines.push(` └─ ${pr.displayDescription}`);
74
+ lines.push(`- [${pr.repo}#${pr.number}](${pr.url}): ${pr.title}`, ` └─ ${pr.displayDescription}`);
81
75
  }
82
76
  lines.push('');
83
77
  }
@@ -98,10 +92,9 @@ export function formatSummary(digest, capacity, issueResponses = []) {
98
92
  lines.push('');
99
93
  }
100
94
  if (digest.autoUnshelvedPRs.length > 0) {
101
- lines.push('### \u{1F514} Auto-Unshelved');
102
- lines.push('> These PRs were shelved but a maintainer engaged — moved back to active.');
95
+ lines.push('### \u{1F514} Auto-Unshelved', '> These PRs were shelved but a maintainer engaged — moved back to active.');
103
96
  for (const pr of digest.autoUnshelvedPRs) {
104
- lines.push(`- [${pr.repo}#${pr.number}](${pr.url}): ${pr.title} (${pr.status.replace(/_/g, ' ')})`);
97
+ lines.push(`- [${pr.repo}#${pr.number}](${pr.url}): ${pr.title} (${pr.status.replaceAll('_', ' ')})`);
105
98
  }
106
99
  lines.push('');
107
100
  }
@@ -178,7 +171,7 @@ export function printDigest(digest, capacity, commentedIssues = []) {
178
171
  if (digest.autoUnshelvedPRs.length > 0) {
179
172
  console.log('\u{1F514} Auto-Unshelved:');
180
173
  for (const pr of digest.autoUnshelvedPRs) {
181
- console.log(` - ${pr.repo}#${pr.number}: ${pr.title} (${pr.status.replace(/_/g, ' ')})`);
174
+ console.log(` - ${pr.repo}#${pr.number}: ${pr.title} (${pr.status.replaceAll('_', ' ')})`);
182
175
  }
183
176
  console.log('');
184
177
  }
@@ -10,8 +10,6 @@ import { type AttentionSummary, type DailyDigest, type CommentedIssue, type PRCh
10
10
  import { type StrategyResult } from '../core/strategy.js';
11
11
  import { type DailyOutput, type DailyWarning, type CapacityAssessment, type ActionableIssue, type ActionMenu, type MergedPRListUpdate, type PendingLearnings } from '../formatters/json.js';
12
12
  export { applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, formatBriefSummary, formatSummary, printDigest, CRITICAL_STATUSES, } from '../core/index.js';
13
- import { buildStarFilter } from '../core/daily-logic.js';
14
- export { buildStarFilter };
15
13
  /**
16
14
  * Internal result of the daily check, using full (non-deduplicated) types.
17
15
  * Consumed by printDigest() (text mode) and converted to DailyOutput (JSON mode)
@@ -107,3 +105,4 @@ export declare function runDaily(): Promise<DailyOutput>;
107
105
  * @throws {ConfigurationError} If no GitHub token is available
108
106
  */
109
107
  export declare function runDailyForDisplay(): Promise<DailyCheckResult>;
108
+ export { buildStarFilter } from '../core/daily-logic.js';
@@ -67,7 +67,6 @@ export { applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacit
67
67
  // (#1208 M7). Re-exported here for backward compatibility with anyone
68
68
  // importing from this module.
69
69
  import { buildStarFilter, firstMaintainerResponseFromDigest } from '../core/daily-logic.js';
70
- export { buildStarFilter };
71
70
  // ---------------------------------------------------------------------------
72
71
  // Phase functions
73
72
  // ---------------------------------------------------------------------------
@@ -584,8 +583,8 @@ export function toDailyOutput(result) {
584
583
  strategySummary: result.strategySummary,
585
584
  // Conditional spread (not a plain assignment) so merge-free runs carry
586
585
  // no `listUpdates` key at all — serialized output and goldens unchanged.
587
- ...(result.listUpdates ? { listUpdates: result.listUpdates } : {}),
588
- ...(result.pendingLearnings ? { pendingLearnings: result.pendingLearnings } : {}),
586
+ ...(result.listUpdates && { listUpdates: result.listUpdates }),
587
+ ...(result.pendingLearnings && { pendingLearnings: result.pendingLearnings }),
589
588
  };
590
589
  }
591
590
  /**
@@ -814,3 +813,4 @@ export async function runDailyForDisplay() {
814
813
  const token = requireGitHubToken();
815
814
  return executeDailyCheckInternal(token);
816
815
  }
816
+ export { buildStarFilter } from '../core/daily-logic.js';
@@ -214,6 +214,6 @@ export class DashboardCache {
214
214
  * call sites re-stat after the build. */
215
215
  rebuild(state, allMergedPRs, allClosedPRs, issueListMtimeMs) {
216
216
  this.cachedJsonData = buildDashboardJson(this.cachedDigest, state, this.cachedCommentedIssues, allMergedPRs, allClosedPRs, this.mergeWarnings(this.cachedPartialFailures));
217
- this.cachedIssueListMtimeMs = issueListMtimeMs !== undefined ? issueListMtimeMs : getIssueListMtimeMs();
217
+ this.cachedIssueListMtimeMs = issueListMtimeMs === undefined ? getIssueListMtimeMs() : issueListMtimeMs;
218
218
  }
219
219
  }
@@ -3,13 +3,12 @@
3
3
  * Handles GitHub API calls, PR grouping, stats computation, and monthly chart data.
4
4
  * Consumed by the dashboard HTTP server (dashboard-server.ts) for the SPA API.
5
5
  */
6
- import { getStateManager, PRMonitor, IssueConversationMonitor, getOctokit, CRITICAL_STATUSES, applyStatusOverrides, } from '../core/index.js';
6
+ import { getStateManager, PRMonitor, IssueConversationMonitor, getOctokit, CRITICAL_STATUSES, applyStatusOverrides, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, } from '../core/index.js';
7
7
  import { errorMessage, isRateLimitOrAuthError } from '../core/errors.js';
8
8
  import { warn } from '../core/logger.js';
9
9
  import { emptyPRCountsResult, fetchMergedPRsSince, fetchClosedPRsSince } from '../core/github-stats.js';
10
10
  import { parseGitHubUrl } from '../core/urls.js';
11
11
  import { isBelowMinStars, } from '../core/types.js';
12
- import { toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest } from '../core/index.js';
13
12
  const MODULE = 'dashboard-data';
14
13
  export function buildDashboardStats(digest, state, storedMergedCount, storedClosedCount) {
15
14
  const summary = digest.summary || {
@@ -21,12 +20,12 @@ export function buildDashboardStats(digest, state, storedMergedCount, storedClos
21
20
  const minStars = state.config.minStars ?? 50;
22
21
  // Merged: use the higher of stored count vs repoScores aggregate to avoid regressions
23
22
  // when the stored list hasn't caught up yet (initial fetch caps at 300 PRs)
24
- const mergedPRs = storedMergedCount !== undefined
25
- ? Math.max(storedMergedCount, summary.totalMergedAllTime)
26
- : summary.totalMergedAllTime;
23
+ const mergedPRs = storedMergedCount === undefined
24
+ ? summary.totalMergedAllTime
25
+ : Math.max(storedMergedCount, summary.totalMergedAllTime);
27
26
  // Closed: same anti-regression strategy — use the higher of stored count vs repoScores aggregate
28
27
  const aggregateClosedCount = Object.values(state.repoScores || {}).reduce((sum, s) => sum + (isBelowMinStars(s.stargazersCount, minStars) ? 0 : s.closedWithoutMergeCount || 0), 0);
29
- const closedPRs = storedClosedCount !== undefined ? Math.max(storedClosedCount, aggregateClosedCount) : aggregateClosedCount;
28
+ const closedPRs = storedClosedCount === undefined ? aggregateClosedCount : Math.max(storedClosedCount, aggregateClosedCount);
30
29
  return {
31
30
  activePRs: summary.totalActivePRs,
32
31
  shelvedPRs: (digest.shelvedPRs || []).length,
@@ -125,11 +125,9 @@ export async function launchDashboardServer(options) {
125
125
  return null;
126
126
  }
127
127
  const info = readDashboardServerInfo();
128
- if (info) {
129
- // PID file appeared — verify the server is responding
130
- if (await isDashboardServerRunning(info.port)) {
131
- return { url: `http://oss.localhost:${info.port}`, port: info.port, alreadyRunning: false };
132
- }
128
+ // PID file appeared — verify the server is responding
129
+ if (info && (await isDashboardServerRunning(info.port))) {
130
+ return { url: `http://oss.localhost:${info.port}`, port: info.port, alreadyRunning: false };
133
131
  }
134
132
  }
135
133
  // 5. Timeout — server didn't start in time; kill orphan process
@@ -165,7 +165,7 @@ function sendError(res, statusCode, message) {
165
165
  * from arbitrary error messages (#1446 item 2).
166
166
  */
167
167
  function sanitizeHeaderValue(value) {
168
- return value.replace(/[\r\n]+/g, ' ').trim();
168
+ return value.replaceAll(/[\r\n]+/g, ' ').trim();
169
169
  }
170
170
  /**
171
171
  * True when an error is an optimistic-concurrency conflict on state.json
@@ -580,9 +580,9 @@ export async function startDashboardServer(options) {
580
580
  // Decode URL, handling malformed percent-encoding
581
581
  let urlPath;
582
582
  try {
583
- urlPath = decodeURIComponent(requestUrl.split('?')[0]);
583
+ urlPath = decodeURIComponent(requestUrl.split('?', 1)[0]);
584
584
  }
585
- catch (_err) {
585
+ catch {
586
586
  warn(MODULE, `Malformed URL received: ${requestUrl}`);
587
587
  sendError(res, 400, 'Malformed URL');
588
588
  return;
@@ -4,8 +4,8 @@
4
4
  * Optionally diagnoses CI log output for formatting failures.
5
5
  */
6
6
  import type { DetectFormattersOutput } from '../formatters/json.js';
7
- export type { DetectFormattersOutput };
8
7
  export declare function runDetectFormatters(options: {
9
8
  repoPath?: string;
10
9
  ciLog?: string;
11
10
  }): Promise<DetectFormattersOutput>;
11
+ export { type DetectFormattersOutput } from '../formatters/json.js';
@@ -21,7 +21,7 @@ export async function runDismiss(options) {
21
21
  const stateManager = getStateManager();
22
22
  const added = stateManager.dismissIssue(options.url, new Date().toISOString());
23
23
  const gistSyncWarning = await maybeCheckpoint(stateManager, MODULE);
24
- return { dismissed: added, url: options.url, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
24
+ return { dismissed: added, url: options.url, ...(gistSyncWarning && { gistSyncWarning }) };
25
25
  }
26
26
  /**
27
27
  * Restore a dismissed issue to notifications.
@@ -37,5 +37,5 @@ export async function runUndismiss(options) {
37
37
  const stateManager = getStateManager();
38
38
  const removed = stateManager.undismissIssue(options.url);
39
39
  const gistSyncWarning = await maybeCheckpoint(stateManager, MODULE);
40
- return { undismissed: removed, url: options.url, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
40
+ return { undismissed: removed, url: options.url, ...(gistSyncWarning && { gistSyncWarning }) };
41
41
  }
@@ -31,7 +31,7 @@ function errCode(err) {
31
31
  export async function checkGhCli() {
32
32
  try {
33
33
  const { stdout } = await execFileAsync('gh', ['--version'], { timeout: GH_CMD_TIMEOUT_MS });
34
- const versionLine = stdout.split('\n')[0]?.trim() || 'gh present';
34
+ const versionLine = stdout.split('\n', 1)[0]?.trim() || 'gh present';
35
35
  return { name: 'gh CLI installed', status: 'ok', message: versionLine };
36
36
  }
37
37
  catch (err) {
@@ -74,7 +74,7 @@ export async function checkGhAuth() {
74
74
  }
75
75
  }
76
76
  export async function checkGitHubToken(preloadedToken) {
77
- const token = preloadedToken !== undefined ? preloadedToken : await getGitHubTokenAsync();
77
+ const token = preloadedToken === undefined ? await getGitHubTokenAsync() : preloadedToken;
78
78
  if (!token) {
79
79
  return {
80
80
  name: 'GitHub token resolvable',
@@ -258,7 +258,7 @@ export async function checkScoutResolvable(importer = defaultScoutImporter) {
258
258
  }
259
259
  }
260
260
  export async function checkGitHubRateLimit(preloadedToken) {
261
- const token = preloadedToken !== undefined ? preloadedToken : await getGitHubTokenAsync();
261
+ const token = preloadedToken === undefined ? await getGitHubTokenAsync() : preloadedToken;
262
262
  if (!token) {
263
263
  return {
264
264
  name: 'GitHub rate limit',
@@ -87,7 +87,7 @@ function toFeaturesCandidate(scoutCandidate, getState) {
87
87
  lastMergedAt: repoScoreRecord.lastMergedAt,
88
88
  }
89
89
  : undefined,
90
- ...(linkedPR ? { linkedPR } : {}),
90
+ ...(linkedPR && { linkedPR }),
91
91
  horizon: scoutCandidate.horizon,
92
92
  };
93
93
  }
@@ -78,7 +78,7 @@ export async function runGuidelinesStore(options) {
78
78
  repo: options.repo,
79
79
  byteSize: Buffer.byteLength(options.content, 'utf8'),
80
80
  stored: true,
81
- ...(gistSyncWarning ? { gistSyncWarning } : {}),
81
+ ...(gistSyncWarning && { gistSyncWarning }),
82
82
  };
83
83
  }
84
84
  /**
@@ -101,7 +101,7 @@ export async function runMarkExtracted(options) {
101
101
  marked++;
102
102
  }
103
103
  const gistSyncWarning = marked > 0 ? await maybeCheckpoint(sm, MODULE) : null;
104
- return { repo: options.repo, marked, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
104
+ return { repo: options.repo, marked, ...(gistSyncWarning && { gistSyncWarning }) };
105
105
  }
106
106
  /** Tombstone the guidelines file for `repo`. */
107
107
  export async function runGuidelinesReset(options) {
@@ -117,7 +117,7 @@ export async function runGuidelinesReset(options) {
117
117
  // Push to Gist — see runGuidelinesStore note (#1200).
118
118
  gistSyncWarning = await maybeCheckpoint(sm, MODULE);
119
119
  }
120
- return { repo: options.repo, deleted: existed, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
120
+ return { repo: options.repo, deleted: existed, ...(gistSyncWarning && { gistSyncWarning }) };
121
121
  }
122
122
  /**
123
123
  * Fetch raw PR comment bundles for the most recent merged/closed PRs in `repo`
@@ -202,8 +202,8 @@ export async function runFetchCorpus(options) {
202
202
  prCount: bundles.length,
203
203
  skipped,
204
204
  failures,
205
- ...(gistSyncWarning ? { gistSyncWarning } : {}),
206
- ...(warnings.length > 0 ? { warnings } : {}),
205
+ ...(gistSyncWarning && { gistSyncWarning }),
206
+ ...(warnings.length > 0 && { warnings }),
207
207
  };
208
208
  }
209
209
  function clampLimit(limit) {
@@ -25,6 +25,6 @@ export async function runInit(options) {
25
25
  return {
26
26
  username: options.username,
27
27
  message: 'Username saved. Run `daily` to fetch your open PRs from GitHub.',
28
- ...(gistSyncWarning ? { gistSyncWarning } : {}),
28
+ ...(gistSyncWarning && { gistSyncWarning }),
29
29
  };
30
30
  }
@@ -7,7 +7,7 @@ interface LocalReposOptions {
7
7
  scan?: boolean;
8
8
  paths?: string[];
9
9
  }
10
- export type { LocalReposOutput, LocalRepoInfo };
11
10
  /** Scan directories for git repos, returning a map of owner/repo -> local path */
12
11
  export declare function scanForRepos(scanPaths: string[]): Record<string, LocalRepoInfo>;
13
12
  export declare function runLocalRepos(options: LocalReposOptions): Promise<LocalReposOutput>;
13
+ export { type LocalReposOutput, type LocalRepoInfo } from '../formatters/json.js';
@@ -72,7 +72,7 @@ export const IMPLEMENT_TIER = 'Pursue';
72
72
  * user's (one PR per repo at a time keeps maintainers' review load sane and
73
73
  * respects repos with a one-open-PR rule) and that no earlier run attempted.
74
74
  */
75
- export function pickImplementCandidate(items, openPRs, attempts, listPath, languageOf = () => undefined) {
75
+ export function pickImplementCandidate(items, openPRs, attempts, listPath, languageOf = () => { }) {
76
76
  const busyRepos = new Set(openPRs.map((p) => p.repo.toLowerCase()));
77
77
  const tried = new Set(attempts.map((a) => a.url));
78
78
  for (const it of items) {
@@ -108,7 +108,7 @@ function loadListItems() {
108
108
  }
109
109
  }
110
110
  /** Pure: split the daily check into prepare vs judgment items. */
111
- export function bucketize(daily, languageOf = () => undefined) {
111
+ export function bucketize(daily, languageOf = () => { }) {
112
112
  const prepare = [];
113
113
  const judgment = [];
114
114
  for (const issue of daily.actionableIssues) {
@@ -170,23 +170,18 @@ export function writePreparedSection(reportPath, prepared) {
170
170
  /** Pure: the morning report. Prepared branches are appended by `record`. */
171
171
  export function renderReport(out, prepared = []) {
172
172
  const lines = [];
173
- lines.push(`# Overnight report — ${reportDateFor(new Date(out.runAt))}`, '');
174
- lines.push(`Run at ${out.runAt}. Nothing was pushed, posted, or merged.`, '');
175
- lines.push(`Attention: ${out.attention.needsAttention} need attention, ${out.attention.stuckCI} stuck CI, ${out.attention.dormantFollowup} dormant, ${out.attention.waiting} waiting.`, '');
176
- lines.push(renderPreparedSection(prepared));
177
- lines.push(`## Implement tonight (${out.implement ? 1 : 0})`, '');
173
+ lines.push(`# Overnight report — ${reportDateFor(new Date(out.runAt))}`, '', `Run at ${out.runAt}. Nothing was pushed, posted, or merged.`, '', `Attention: ${out.attention.needsAttention} need attention, ${out.attention.stuckCI} stuck CI, ${out.attention.dormantFollowup} dormant, ${out.attention.waiting} waiting.`, '');
174
+ lines.push(renderPreparedSection(prepared), `## Implement tonight (${out.implement ? 1 : 0})`, '');
178
175
  if (out.implement)
179
176
  lines.push(`- ${out.implement.repo}#${out.implement.number} ${out.implement.url} — ${out.implement.reason}`);
180
177
  else
181
178
  lines.push('_No list issue queued: the Pursue tier is empty, exhausted, or every repo has an open PR of yours._');
182
- lines.push('');
183
- lines.push(`## Queued for preparation (${out.prepare.length})`, '');
179
+ lines.push('', `## Queued for preparation (${out.prepare.length})`, '');
184
180
  if (out.prepare.length === 0)
185
181
  lines.push('_Nothing to prepare._');
186
182
  for (const i of out.prepare)
187
183
  lines.push(`- ${i.label} ${i.url} — ${i.reason}`);
188
- lines.push('');
189
- lines.push(`## Needs your judgment (${out.judgment.length})`, '');
184
+ lines.push('', `## Needs your judgment (${out.judgment.length})`, '');
190
185
  if (out.judgment.length === 0)
191
186
  lines.push('_Nothing waiting on you._');
192
187
  for (const i of out.judgment)
@@ -246,7 +241,7 @@ export async function runOvernight() {
246
241
  prepareCount: prepare.length,
247
242
  judgmentCount: judgment.length,
248
243
  prepared: carried,
249
- ...(implement ? { implementUrl: implement.url } : {}),
244
+ ...(implement && { implementUrl: implement.url }),
250
245
  implementAttempts: attempts,
251
246
  };
252
247
  sm.setLastOvernight(record);
@@ -262,8 +257,8 @@ export async function runOvernight() {
262
257
  ...body,
263
258
  reportPath,
264
259
  carriedPrepared: carried.length,
265
- ...(gistSyncWarning ? { gistSyncWarning } : {}),
266
- ...(daily.pendingLearnings ? { pendingLearnings: daily.pendingLearnings } : {}),
260
+ ...(gistSyncWarning && { gistSyncWarning }),
261
+ ...(daily.pendingLearnings && { pendingLearnings: daily.pendingLearnings }),
267
262
  };
268
263
  }
269
264
  /**
@@ -317,7 +312,7 @@ export async function runOvernightImplementBlocked(options) {
317
312
  if (dropDir)
318
313
  exportHandoff(dropDir, { ...last, implementAttempts });
319
314
  const gistSyncWarning = await maybeCheckpoint(sm, MODULE);
320
- return { url: options.url, attemptCount: implementAttempts.length, ...(gistSyncWarning ? { gistSyncWarning } : {}) };
315
+ return { url: options.url, attemptCount: implementAttempts.length, ...(gistSyncWarning && { gistSyncWarning }) };
321
316
  }
322
317
  /** Append one prepared branch to state and to the report of the latest run. */
323
318
  export async function runOvernightRecord(options) {
@@ -365,8 +360,8 @@ export async function runOvernightRecord(options) {
365
360
  return {
366
361
  reportPath: last.reportPath,
367
362
  preparedCount: prepared.length,
368
- ...(reportRecreated ? { reportRecreated: true } : {}),
369
- ...(gistSyncWarning ? { gistSyncWarning } : {}),
363
+ ...(reportRecreated && { reportRecreated: true }),
364
+ ...(gistSyncWarning && { gistSyncWarning }),
370
365
  };
371
366
  }
372
367
  /** Pure: swap the "Prepared branches" section (up to the next `## `) for `section`. */
@@ -563,7 +558,7 @@ export const OVERNIGHT_ALLOWED_TOOLS = [
563
558
  'Bash(npm *)',
564
559
  ].join(',');
565
560
  function xmlEscape(s) {
566
- return s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
561
+ return s.replaceAll('&', '&amp;').replaceAll('<', '&lt;').replaceAll('>', '&gt;');
567
562
  }
568
563
  /**
569
564
  * The settings layer the scheduled job runs with instead of the user's own
@@ -2,11 +2,10 @@
2
2
  * Parse issue list command (#82)
3
3
  * Parses markdown issue lists into structured JSON with tier classification
4
4
  */
5
- import type { ParseIssueListOutput, ParsedIssueItem } from '../formatters/json.js';
5
+ import type { ParseIssueListOutput } from '../formatters/json.js';
6
6
  interface ParseListOptions {
7
7
  filePath: string;
8
8
  }
9
- export type { ParseIssueListOutput, ParsedIssueItem };
10
9
  /** Parse a markdown string into structured issue items */
11
10
  export declare function parseIssueList(content: string): ParseIssueListOutput;
12
11
  /**
@@ -24,3 +23,4 @@ export declare function pruneIssueList(content: string, minScore?: number): {
24
23
  removedCount: number;
25
24
  };
26
25
  export declare function runParseList(options: ParseListOptions): Promise<ParseIssueListOutput>;
26
+ export { type ParseIssueListOutput, type ParsedIssueItem } from '../formatters/json.js';
@@ -22,17 +22,17 @@ function extractGitHubUrl(line) {
22
22
  /** Extract issue title from a markdown line (text after URL or checkbox) */
23
23
  function extractTitle(line) {
24
24
  // Remove markdown link syntax: [title](url) -> title
25
- let cleaned = line.replace(/\[([^\]]+)\]\([^)]+\)/g, '$1');
25
+ let cleaned = line.replaceAll(/\[([^\]]+)\]\([^)]+\)/g, '$1');
26
26
  // Remove bare URLs
27
- cleaned = cleaned.replace(/https?:\/\/\S+/g, '');
27
+ cleaned = cleaned.replaceAll(/https?:\/\/\S+/g, '');
28
28
  // Remove list markers (-, *, +, numbered)
29
29
  cleaned = cleaned.replace(/^\s*[-*+]\s*/, '').replace(/^\s*\d+\.\s*/, '');
30
30
  // Remove checkboxes
31
31
  cleaned = cleaned.replace(/\[[ x]\]\s*/i, '');
32
32
  // Remove strikethrough markers
33
- cleaned = cleaned.replace(/~~/g, '');
33
+ cleaned = cleaned.replaceAll('~~', '');
34
34
  // Remove "Done" markers
35
- cleaned = cleaned.replace(/\bdone\b/gi, '');
35
+ cleaned = cleaned.replaceAll(/\bdone\b/gi, '');
36
36
  // Remove leading/trailing punctuation and whitespace
37
37
  cleaned = cleaned.replace(/^[\s\-\u2013\u2014:]+/, '').replace(/[\s\-\u2013\u2014:]+$/, '');
38
38
  return cleaned.trim();
@@ -164,7 +164,7 @@ function isBlockedSection(heading) {
164
164
  }
165
165
  /** Leading-whitespace width with tabs expanded to two columns. */
166
166
  function indentWidth(line) {
167
- return line.match(/^\s*/)[0].replace(/\t/g, ' ').length;
167
+ return line.match(/^\s*/)[0].replaceAll('\t', ' ').length;
168
168
  }
169
169
  /** Parse a markdown string into structured issue items */
170
170
  export function parseIssueList(content) {
@@ -250,7 +250,7 @@ export function parseIssueList(content) {
250
250
  number: ghUrl.number,
251
251
  title: title || `#${ghUrl.number}`,
252
252
  tier: currentTier,
253
- ...(currentGroup !== undefined ? { group: currentGroup } : {}),
253
+ ...(currentGroup !== undefined && { group: currentGroup }),
254
254
  url: ghUrl.url,
255
255
  };
256
256
  lastBucket = isCompleted(line) ? completed : sectionBlocked ? blocked : available;
@@ -351,7 +351,7 @@ export function pruneIssueList(content, minScore = 6) {
351
351
  }
352
352
  }
353
353
  // Skip cruft lines: "Skip (N issues)", standalone "---", old "Removed" labels
354
- if (/^\s*skip\s*\(\d+\s*issues?\)/i.test(line.replace(/[#*]/g, '').trim())) {
354
+ if (/^\s*skip\s*\(\d+\s*issues?\)/i.test(line.replaceAll(/[#*]/g, '').trim())) {
355
355
  continue;
356
356
  }
357
357
  if (/^---\s*$/.test(line)) {
@@ -16,7 +16,7 @@ import { warn } from '../core/logger.js';
16
16
  import { validateRepoIdentifier } from './validation.js';
17
17
  import { computeRepoVet } from '../core/repo-vet.js';
18
18
  const MODULE = 'repo-vet';
19
- const DAY_MS = 86400000;
19
+ const DAY_MS = 86_400_000;
20
20
  const COMMUNITY_HEALTH_PATHS = [
21
21
  // Each entry can live at the repo root OR under .github/. We probe both
22
22
  // because some repos prefer the visible-at-root convention and some
@@ -189,7 +189,7 @@ function summarizeCommits(commits, now) {
189
189
  */
190
190
  export async function runRepoVet(options) {
191
191
  validateRepoIdentifier(options.repo);
192
- const [owner, repo] = options.repo.split('/');
192
+ const [owner, repo] = options.repo.split('/', 2);
193
193
  const token = requireGitHubToken();
194
194
  const octokit = getOctokit(token);
195
195
  const now = new Date();
@@ -271,6 +271,6 @@ export async function runRepoVet(options) {
271
271
  communityHealth: { ...communityHealth, incomplete: communityHealthSummary.incomplete },
272
272
  maintainerActivity: { ...maintainerActivity, releasesIncomplete },
273
273
  ...rest,
274
- ...(historyScore !== undefined ? { historyScore } : {}),
274
+ ...(historyScore !== undefined && { historyScore }),
275
275
  };
276
276
  }
@@ -40,6 +40,14 @@ interface SearchOptions {
40
40
  * an interactive search rather than a scheduled one.
41
41
  */
42
42
  full?: boolean;
43
+ /**
44
+ * Persist the seen-set and rotation cursor (default true). A headless search
45
+ * on a second machine that shares the Gist state must pass false: otherwise
46
+ * every issue it surfaces is hidden from the user's interactive searches for
47
+ * the seen-set TTL. With false nothing is checkpointed, so the rotation
48
+ * cursor does not advance either; pair it with `full`.
49
+ */
50
+ record?: boolean;
43
51
  }
44
52
  /**
45
53
  * Parse and validate a comma-separated `--strategy` value into scout strategies.
@@ -172,28 +172,31 @@ export async function runSearch(options) {
172
172
  const broadPhaseDelayMs = readScoutDelayOverride('OSS_AUTOPILOT_SCOUT_BROAD_PHASE_DELAY_MS');
173
173
  const result = await scout.search({
174
174
  maxResults: options.maxResults,
175
- ...(options.strategies ? { strategies: options.strategies } : {}),
176
- ...(options.full ? { full: true } : {}),
175
+ ...(options.strategies && { strategies: options.strategies }),
176
+ ...(options.full && { full: true }),
177
177
  preferLanguages,
178
178
  preferRepos,
179
179
  diversityRatio: SEARCH_DIVERSITY_RATIO,
180
180
  // Pinned so searchSeen's retention (state-prune.ts) always outlives it.
181
181
  recentlySurfacedTtlDays: SCOUT_ROTATION_TTL_DAYS,
182
- ...(interPhaseDelayMs !== undefined ? { interPhaseDelayMs } : {}),
183
- ...(broadPhaseDelayMs !== undefined ? { broadPhaseDelayMs } : {}),
182
+ ...(interPhaseDelayMs !== undefined && { interPhaseDelayMs }),
183
+ ...(broadPhaseDelayMs !== undefined && { broadPhaseDelayMs }),
184
184
  });
185
185
  // Record everything scout surfaced this round into the durable seen-set so
186
186
  // the next search rotates past it (#1528). Done before the own-PR filter so
187
187
  // hidden-but-surfaced issues also rotate out. Persists to AgentState.
188
- recordSearchSeen(stateManager, result.candidates.map((c) => c.issue.url));
189
- // Scout advanced its broad-phase language cursor in its own (provided,
190
- // non-persisted) state; copy it back so the next run starts from the next
191
- // language slice instead of offset 0 every time (#1630).
192
- stateManager.setSearchRotation(scout.getState().searchRotation);
193
- // In Gist mode setSearchSeen only writes the local cache; without a
194
- // checkpoint the seen-set never reaches the Gist and the next startup's
195
- // Gist refetch overwrites the cache with the empty remote copy (#1629).
196
- const gistSyncWarning = await maybeCheckpoint(stateManager, MODULE);
188
+ let gistSyncWarning = null;
189
+ if (options.record !== false) {
190
+ recordSearchSeen(stateManager, result.candidates.map((c) => c.issue.url));
191
+ // Scout advanced its broad-phase language cursor in its own (provided,
192
+ // non-persisted) state; copy it back so the next run starts from the next
193
+ // language slice instead of offset 0 every time (#1630).
194
+ stateManager.setSearchRotation(scout.getState().searchRotation);
195
+ // In Gist mode setSearchSeen only writes the local cache; without a
196
+ // checkpoint the seen-set never reaches the Gist and the next startup's
197
+ // Gist refetch overwrites the cache with the empty remote copy (#1629).
198
+ gistSyncWarning = await maybeCheckpoint(stateManager, MODULE);
199
+ }
197
200
  // #1354: never surface issues the user already has an open PR for. Uses
198
201
  // scout's structured linked-PR metadata when present; candidates without it
199
202
  // pass through (the issue-scout agent re-checks via verify-issue anyway).
@@ -260,15 +263,14 @@ export async function runSearch(options) {
260
263
  lastMergedAt: repoScoreRecord.lastMergedAt,
261
264
  }
262
265
  : undefined,
263
- ...(linkedPR ? { linkedPR } : {}),
266
+ ...(linkedPR && { linkedPR }),
264
267
  // Scout 1.0 folded the boostScore/boostReasons/diversitySlot trio into a
265
268
  // single `personalization` field (#158). Derive the flat output fields
266
269
  // from it so this command's JSON shape is unchanged.
267
- ...(c.personalization?.kind === 'boosted' ? { boostScore: c.personalization.score } : {}),
268
- ...(c.personalization?.kind === 'boosted' && c.personalization.reasons.length > 0
269
- ? { boostReasons: c.personalization.reasons }
270
- : {}),
271
- ...(c.personalization?.kind === 'diversity' ? { diversitySlot: true } : {}),
270
+ ...(c.personalization?.kind === 'boosted' && { boostScore: c.personalization.score }),
271
+ ...(c.personalization?.kind === 'boosted' &&
272
+ c.personalization.reasons.length > 0 && { boostReasons: c.personalization.reasons }),
273
+ ...(c.personalization?.kind === 'diversity' && { diversitySlot: true }),
272
274
  };
273
275
  }),
274
276
  excludedRepos: result.excludedRepos,