@oss-autopilot/core 3.42.5 → 3.44.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 +428 -27
- package/dist/cli.bundle.cjs +212 -156
- package/dist/commands/check-integration.js +5 -1
- package/dist/commands/cleanup.d.ts +80 -0
- package/dist/commands/cleanup.js +334 -0
- package/dist/commands/comments.d.ts +14 -1
- package/dist/commands/comments.js +17 -5
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +63 -6
- 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 +150 -0
- package/dist/commands/daily-ledger.js +248 -0
- package/dist/commands/daily-recent-prs.d.ts +26 -0
- package/dist/commands/daily-recent-prs.js +55 -0
- package/dist/commands/daily-render.d.ts +2 -1
- package/dist/commands/daily-render.js +4 -1
- package/dist/commands/daily.d.ts +5 -1
- package/dist/commands/daily.js +83 -93
- package/dist/commands/dashboard-cache.d.ts +2 -0
- package/dist/commands/dashboard-cache.js +33 -8
- package/dist/commands/dashboard-data.js +113 -69
- package/dist/commands/dashboard-gist-sync.js +3 -1
- package/dist/commands/dashboard-lifecycle.d.ts +36 -8
- package/dist/commands/dashboard-lifecycle.js +132 -39
- package/dist/commands/dashboard-process.d.ts +49 -1
- package/dist/commands/dashboard-process.js +111 -12
- package/dist/commands/dashboard-server.js +89 -23
- package/dist/commands/detect-formatters.js +1 -0
- package/dist/commands/dismiss.js +11 -7
- package/dist/commands/doctor.d.ts +15 -1
- package/dist/commands/doctor.js +66 -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/fork-prune.d.ts +58 -0
- package/dist/commands/fork-prune.js +247 -0
- package/dist/commands/guidelines.d.ts +69 -2
- package/dist/commands/guidelines.js +158 -14
- package/dist/commands/index.d.ts +29 -4
- package/dist/commands/index.js +20 -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 +14 -8
- package/dist/commands/overnight-push-prep.js +107 -35
- 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 +90 -0
- package/dist/commands/policy.js +276 -0
- package/dist/commands/pr-create.d.ts +48 -0
- package/dist/commands/pr-create.js +200 -0
- package/dist/commands/pr-preflight.d.ts +69 -0
- package/dist/commands/pr-preflight.js +348 -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 +160 -48
- package/dist/commands/skip-add.js +10 -1
- package/dist/commands/startup.d.ts +12 -3
- package/dist/commands/startup.js +82 -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 +6 -0
- package/dist/commands/strategy.js +1 -0
- package/dist/commands/validation.d.ts +5 -0
- package/dist/commands/validation.js +5 -0
- package/dist/commands/vet-list.d.ts +6 -0
- package/dist/commands/vet-list.js +26 -1
- package/dist/commands/vet.d.ts +20 -0
- package/dist/commands/vet.js +133 -2
- package/dist/commands/work.d.ts +4 -0
- package/dist/commands/work.js +34 -11
- 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 +45 -0
- package/dist/core/commit-date.js +45 -0
- package/dist/core/compliance-score.d.ts +3 -0
- package/dist/core/compliance-score.js +13 -9
- package/dist/core/config-registry.d.ts +27 -2
- package/dist/core/config-registry.js +94 -7
- package/dist/core/contributing.d.ts +2 -3
- package/dist/core/contributing.js +2 -3
- package/dist/core/daily-logic.d.ts +30 -5
- package/dist/core/daily-logic.js +68 -19
- package/dist/core/errors.d.ts +37 -3
- package/dist/core/errors.js +54 -5
- package/dist/core/fork-prune.d.ts +149 -0
- package/dist/core/fork-prune.js +333 -0
- 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 +98 -51
- package/dist/core/github-stats.d.ts +110 -16
- package/dist/core/github-stats.js +295 -110
- package/dist/core/http-cache.d.ts +0 -10
- package/dist/core/http-cache.js +0 -19
- package/dist/core/index.d.ts +13 -6
- package/dist/core/index.js +16 -6
- 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 +270 -0
- package/dist/core/merged-pr-notes.d.ts +2 -2
- package/dist/core/pacing.d.ts +41 -0
- package/dist/core/pacing.js +115 -0
- 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.d.ts +2 -0
- package/dist/core/pr-assembly.js +6 -2
- package/dist/core/pr-graphql.d.ts +53 -4
- package/dist/core/pr-graphql.js +87 -14
- package/dist/core/pr-monitor.d.ts +35 -12
- package/dist/core/pr-monitor.js +110 -26
- package/dist/core/pr-preflight.d.ts +154 -0
- package/dist/core/pr-preflight.js +753 -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/prose-script.d.ts +72 -0
- package/dist/core/prose-script.js +223 -0
- package/dist/core/repo-policy.d.ts +111 -0
- package/dist/core/repo-policy.js +428 -0
- package/dist/core/repo-score-manager.d.ts +66 -0
- package/dist/core/repo-score-manager.js +140 -1
- package/dist/core/review-analysis.d.ts +49 -21
- package/dist/core/review-analysis.js +89 -15
- package/dist/core/reviewed-prs-fetch.js +11 -29
- package/dist/core/reviewed-prs.js +8 -15
- package/dist/core/stale-data.d.ts +78 -0
- package/dist/core/stale-data.js +153 -0
- package/dist/core/state-persistence.d.ts +62 -27
- package/dist/core/state-persistence.js +338 -119
- package/dist/core/state-schema.d.ts +152 -210
- package/dist/core/state-schema.js +232 -80
- package/dist/core/state.d.ts +81 -8
- package/dist/core/state.js +239 -46
- package/dist/core/status-determination.js +32 -12
- 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 +95 -42
- package/dist/core/urls.d.ts +33 -0
- package/dist/core/urls.js +94 -0
- package/dist/dashboard/assets/chart-panel-B-nLVgzQ.js +3 -0
- package/dist/dashboard/assets/index-5IvMGokL.js +55 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/formatters/json.d.ts +432 -10
- package/dist/formatters/json.js +156 -1
- package/package.json +6 -6
- 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/dashboard/assets/chart-panel-DPKNBUts.js +0 -3
- package/dist/dashboard/assets/index-B25bZOYX.js +0 -55
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* (daily-logic.test.ts) — pure rendering, easy to assert on string output.
|
|
16
16
|
*/
|
|
17
17
|
import { formatRelativeTime } from '../core/dates.js';
|
|
18
|
+
import { pacingLines } from '../core/pacing.js';
|
|
18
19
|
/**
|
|
19
20
|
* Format a maintainer action hint as a human-readable label.
|
|
20
21
|
*/
|
|
@@ -58,7 +59,7 @@ export function formatBriefSummary(digest, issueCount, issueResponseCount = 0, a
|
|
|
58
59
|
* Used in JSON output for Claude to display verbatim — includes all PR sections,
|
|
59
60
|
* issue replies, and capacity status.
|
|
60
61
|
*/
|
|
61
|
-
export function formatSummary(digest, capacity, issueResponses = []) {
|
|
62
|
+
export function formatSummary(digest, capacity, issueResponses = [], pacing = null) {
|
|
62
63
|
const lines = [];
|
|
63
64
|
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', '');
|
|
64
65
|
if (digest.needsAddressingPRs.length > 0) {
|
|
@@ -121,6 +122,8 @@ export function formatSummary(digest, capacity, issueResponses = []) {
|
|
|
121
122
|
? `${capacity.activePRCount}/${capacity.maxActivePRs} PRs`
|
|
122
123
|
: `${capacity.activePRCount} PRs, no limit`;
|
|
123
124
|
lines.push(`**Capacity:** ${capacityIcon} ${capacityLabel} (${countLabel}${shelvedNote})`);
|
|
125
|
+
for (const line of pacingLines(pacing))
|
|
126
|
+
lines.push(`**Pacing:** ${line}`);
|
|
124
127
|
return lines.join('\n');
|
|
125
128
|
}
|
|
126
129
|
/**
|
package/dist/commands/daily.d.ts
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
import { type WorkClaim, type ClosedPRStatusUpdate, type MergedPRNotes, type ReviewedPRFollowUp, type AttentionSummary, type DailyDigest, type CommentedIssue, type PRCheckFailure, type RepoGroup } from '../core/index.js';
|
|
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
|
+
import { type PacingStatus } from '../core/pacing.js';
|
|
13
|
+
export { applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, CRITICAL_STATUSES, } from '../core/index.js';
|
|
14
|
+
export { formatBriefSummary, formatSummary, printDigest } from './daily-render.js';
|
|
13
15
|
/**
|
|
14
16
|
* Internal result of the daily check, using full (non-deduplicated) types.
|
|
15
17
|
* Consumed by printDigest() (text mode) and converted to DailyOutput (JSON mode)
|
|
@@ -73,6 +75,8 @@ export interface DailyCheckResult {
|
|
|
73
75
|
* {@link DailyOutput.workClaims}.
|
|
74
76
|
*/
|
|
75
77
|
workClaims?: WorkClaim[];
|
|
78
|
+
/** Pacing counts (#1911); set only when a pacing cap is set. See {@link DailyOutput.pacing}. */
|
|
79
|
+
pacing?: PacingStatus;
|
|
76
80
|
}
|
|
77
81
|
/**
|
|
78
82
|
* Convert a full DailyCheckResult to the compact DailyOutput for JSON serialization (#287).
|
package/dist/commands/daily.js
CHANGED
|
@@ -6,30 +6,36 @@
|
|
|
6
6
|
* Domain logic lives in src/core/daily-logic.ts; this file is a thin
|
|
7
7
|
* orchestration layer that wires up the phases and handles I/O.
|
|
8
8
|
*/
|
|
9
|
-
import { getStateManager, parseGitHubUrl, issueRefKey, PRMonitor, IssueConversationMonitor, requireGitHubToken, renderGistWarning, CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, GistConcurrencyError, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, collectEngagedIssues,
|
|
9
|
+
import { getStateManager, parseGitHubUrl, issueRefKey, PRMonitor, IssueConversationMonitor, requireGitHubToken, renderGistWarning, renderUnknownModeWarning, CRITICAL_STATUSES, shouldAutoUnshelve, shelveReasonsOf, withoutShelvedNeedsAddressing, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, GistConcurrencyError, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, collectEngagedIssues, getOctokit, toShelvedPRRef, summarizeAttentionBuckets, shouldSuggestClose, selectClosedPRStatusCandidates, toClosedPRStatusUpdate, activeWorkClaims, finishedImplementations, } from '../core/index.js';
|
|
10
10
|
import { errorMessage, isRateLimitOrAuthError } from '../core/errors.js';
|
|
11
11
|
import { DEFAULT_CONCURRENCY, runWorkerPool } from '../core/concurrency.js';
|
|
12
12
|
import { wrapUntrustedContent } from '../core/untrusted-content.js';
|
|
13
13
|
import { computeStrategy, shouldComputeStrategy } from '../core/strategy.js';
|
|
14
14
|
import { debug, warn } from '../core/logger.js';
|
|
15
15
|
import { emptyPRCountsResult } from '../core/github-stats.js';
|
|
16
|
-
import { findRepoTransfers } from '../core/repo-score-manager.js';
|
|
17
16
|
import { updateMonthlyAnalytics } from './dashboard-data.js';
|
|
18
17
|
import { deduplicateDigest, compactActionableIssues, compactRepoGroups, buildStalenessWarning, } from '../formatters/json.js';
|
|
19
18
|
import { reconcileMergedPRsWithList } from './merge-loop.js';
|
|
19
|
+
import { guidelineProposalStatus, isProposalRepo } from './guidelines.js';
|
|
20
20
|
import { describeError, httpStatusLabel, isGoneError, nonFatalCatchWithWarning, recordWarning, } from './daily-warnings.js';
|
|
21
|
+
import { formatBriefSummary, formatSummary } from './daily-render.js';
|
|
22
|
+
import { getPacingStatus } from '../core/pacing.js';
|
|
21
23
|
import { fenceMergedPRNotes, runMergedPRNotesPhase } from './daily-merged-pr-notes.js';
|
|
24
|
+
import { fetchRecentPRLists } from './daily-recent-prs.js';
|
|
22
25
|
import { fenceReviewedPR, runReviewedPRsPhase } from './daily-reviewed-prs.js';
|
|
23
|
-
import { batchOnFreshBaseline, filterDismissedIssues } from './daily-dismiss-filter.js';
|
|
26
|
+
import { batchOnFreshBaseline, filterDismissedIssues, reloadOrWarn } from './daily-dismiss-filter.js';
|
|
27
|
+
import { applyRepoMetadata, fetchClosedLedgerGap, fetchMergedLedgerGap, resetStaleClosedCounts, storeClosedLedger, storeMergedLedger, syncLedgersWithGitHub, } from './daily-ledger.js';
|
|
24
28
|
const MODULE = 'daily';
|
|
25
29
|
// Re-export domain functions so existing consumers (tests, dashboard, startup)
|
|
26
30
|
// can continue importing from './daily.js' without changes.
|
|
27
|
-
export { applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef,
|
|
31
|
+
export { applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, toShelvedPRRef, CRITICAL_STATUSES, } from '../core/index.js';
|
|
32
|
+
export { formatBriefSummary, formatSummary, printDigest } from './daily-render.js';
|
|
28
33
|
// buildStarFilter moved to core/daily-logic.ts so the dashboard layer can
|
|
29
34
|
// reuse it without crossing the commands → sibling-command boundary
|
|
30
35
|
// (#1208 M7). Re-exported here for backward compatibility with anyone
|
|
31
36
|
// importing from this module.
|
|
32
|
-
import { buildStarFilter
|
|
37
|
+
import { buildStarFilter } from '../core/daily-logic.js';
|
|
38
|
+
import { cachedForkPruneLine } from './fork-prune.js';
|
|
33
39
|
/** Lowercased `owner/repo` of a GitHub PR or issue URL, or undefined when it does not parse. */
|
|
34
40
|
function repoKeyOf(url) {
|
|
35
41
|
const parsed = parseGitHubUrl(url);
|
|
@@ -107,8 +113,7 @@ async function fetchPRData(prMonitor, token, warnings) {
|
|
|
107
113
|
// Fetch merged PR counts, closed PR counts, recently closed PRs, recently merged PRs, and commented issues in parallel
|
|
108
114
|
// All stats fetches are non-critical (cosmetic/scoring), so isolate their failure
|
|
109
115
|
const issueMonitor = new IssueConversationMonitor(token);
|
|
110
|
-
|
|
111
|
-
const [mergedResult, closedResult, recentlyClosedPRs, recentlyMergedPRs] = await Promise.all([
|
|
116
|
+
const [mergedResult, closedResult, recentPRs] = await Promise.all([
|
|
112
117
|
prMonitor.fetchUserMergedPRCounts(starFilter).catch(nonFatalCatchWithWarning({
|
|
113
118
|
warnings,
|
|
114
119
|
phase: 'fetch',
|
|
@@ -121,24 +126,11 @@ async function fetchPRData(prMonitor, token, warnings) {
|
|
|
121
126
|
operation: 'fetch closed PR counts',
|
|
122
127
|
fallback: emptyPRCountsResult(),
|
|
123
128
|
})),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
operation: 'fetch recently closed PRs',
|
|
128
|
-
fallback: [],
|
|
129
|
-
})),
|
|
130
|
-
prMonitor.fetchRecentlyMergedPRs().catch((error) => {
|
|
131
|
-
// Phase 3.6 treats a fallback here as an incomplete view of the
|
|
132
|
-
// user's PRs (a just-merged successor would be invisible).
|
|
133
|
-
didRecentlyMergedFetchFail = true;
|
|
134
|
-
return nonFatalCatchWithWarning({
|
|
135
|
-
warnings,
|
|
136
|
-
phase: 'fetch',
|
|
137
|
-
operation: 'fetch recently merged PRs',
|
|
138
|
-
fallback: [],
|
|
139
|
-
})(error);
|
|
140
|
-
}),
|
|
129
|
+
// Phase 3.6 treats a failed or partial merged list as an incomplete view
|
|
130
|
+
// of the user's PRs (a just-merged successor would be invisible).
|
|
131
|
+
fetchRecentPRLists(prMonitor, warnings),
|
|
141
132
|
]);
|
|
133
|
+
const { recentlyClosedPRs, recentlyMergedPRs } = recentPRs;
|
|
142
134
|
// Issue conversations run after the PR lists: the engaged set (#1862)
|
|
143
135
|
// needs the open, recently closed and recently merged PRs. The fetch has
|
|
144
136
|
// custom messaging based on the error content, so it keeps its bespoke catch.
|
|
@@ -183,8 +175,7 @@ async function fetchPRData(prMonitor, token, warnings) {
|
|
|
183
175
|
const successorGaps = { everywhere: [], failedRepos: new Set() };
|
|
184
176
|
if (fetchResult.searchTruncated)
|
|
185
177
|
successorGaps.everywhere.push('the open-PR search was truncated');
|
|
186
|
-
|
|
187
|
-
successorGaps.everywhere.push('the recently-merged fetch failed');
|
|
178
|
+
successorGaps.everywhere.push(...recentPRs.successorGapReasons);
|
|
188
179
|
for (const failure of failures) {
|
|
189
180
|
const repoKey = repoKeyOf(failure.prUrl);
|
|
190
181
|
if (repoKey)
|
|
@@ -194,8 +185,10 @@ async function fetchPRData(prMonitor, token, warnings) {
|
|
|
194
185
|
}
|
|
195
186
|
return {
|
|
196
187
|
searchedPRs: [...mergedResult.searchedPRs, ...closedResult.searchedPRs],
|
|
197
|
-
recentlyMergedFetchFailed:
|
|
198
|
-
|
|
188
|
+
recentlyMergedFetchFailed: recentPRs.recentlyMergedFetchFailed,
|
|
189
|
+
truncatedSearches: { merged: mergedResult.truncated, closed: closedResult.truncated },
|
|
190
|
+
mergedTotalCount: mergedResult.totalCount,
|
|
191
|
+
closedTotalCount: closedResult.totalCount,
|
|
199
192
|
successorGaps,
|
|
200
193
|
prs,
|
|
201
194
|
failures,
|
|
@@ -215,20 +208,19 @@ async function fetchPRData(prMonitor, token, warnings) {
|
|
|
215
208
|
* Applies stale repo reset, updates merged/closed counts, computes and stores
|
|
216
209
|
* repo signals from open PR data, refreshes star counts, and syncs trusted projects.
|
|
217
210
|
*/
|
|
218
|
-
async function updateRepoScores(prMonitor, prs, mergedCounts,
|
|
211
|
+
async function updateRepoScores(prMonitor, prs, mergedCounts, truncatedSearches, closedCounts, searchedPRs, warnings) {
|
|
219
212
|
const stateManager = getStateManager();
|
|
220
213
|
// Batch all synchronous score mutations for a single disk write.
|
|
221
214
|
// Per-repo try-catch: a single corrupted repo should not prevent updates to others.
|
|
222
215
|
// Outer try-catch: save failure should not crash the daily check (in-memory mutations still apply).
|
|
223
216
|
try {
|
|
224
217
|
batchOnFreshBaseline(stateManager, () => {
|
|
225
|
-
//
|
|
226
|
-
//
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
}
|
|
218
|
+
// Counts below are written in steps (reset or search count, then the
|
|
219
|
+
// ledger raise); only the net change re-evaluates a repo (#2045).
|
|
220
|
+
const outcomesBefore = stateManager.snapshotRepoOutcomes();
|
|
221
|
+
// Re-key transferred repos and evict reopened/merged PRs from the closed
|
|
222
|
+
// ledger before anything below reads or writes repoScores (#1923).
|
|
223
|
+
syncLedgersWithGitHub(stateManager, searchedPRs, prs);
|
|
232
224
|
// Reset stale repos first (so excluded/removed repos get zeroed).
|
|
233
225
|
// Guard: if the API returned zero results but we have existing repos with merged PRs,
|
|
234
226
|
// skip the reset to avoid wiping scores due to transient API failures.
|
|
@@ -236,7 +228,7 @@ async function updateRepoScores(prMonitor, prs, mergedCounts, wasMergedSearchTru
|
|
|
236
228
|
if (mergedCounts.size === 0 && existingReposWithMerges.length > 0) {
|
|
237
229
|
warn(MODULE, `Skipping stale repo reset: API returned 0 merged PR results but state has ${existingReposWithMerges.length} repo(s) with merges. Possible API issue.`);
|
|
238
230
|
}
|
|
239
|
-
else if (
|
|
231
|
+
else if (truncatedSearches.merged) {
|
|
240
232
|
// A repo absent from a pagination-capped search may still have merges (#1897).
|
|
241
233
|
debug(MODULE, 'Skipping stale repo reset: merged PR search was truncated.');
|
|
242
234
|
}
|
|
@@ -270,11 +262,9 @@ async function updateRepoScores(prMonitor, prs, mergedCounts, wasMergedSearchTru
|
|
|
270
262
|
});
|
|
271
263
|
warn(MODULE, `[MERGED_COUNT_UPDATES_FAILED] ${mergedCountFailures} of ${mergedCounts.size} merged count update(s) failed.`);
|
|
272
264
|
}
|
|
273
|
-
// Populate closedWithoutMergeCount in repo scores
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
warn(MODULE, `API returned 0 closed PR results but state has ${existingReposWithClosed.length} repo(s) with closed PRs. Possible transient API issue.`);
|
|
277
|
-
}
|
|
265
|
+
// Populate closedWithoutMergeCount in repo scores: zero the repos that
|
|
266
|
+
// left the closed search, then write the counts it returned.
|
|
267
|
+
resetStaleClosedCounts(stateManager, closedCounts, truncatedSearches.closed);
|
|
278
268
|
let closedCountFailures = 0;
|
|
279
269
|
for (const [repo, count] of closedCounts) {
|
|
280
270
|
try {
|
|
@@ -332,6 +322,7 @@ async function updateRepoScores(prMonitor, prs, mergedCounts, wasMergedSearchTru
|
|
|
332
322
|
});
|
|
333
323
|
warn(MODULE, `[SIGNAL_UPDATES_FAILED] ${signalUpdateFailures} of ${repoSignals.size} signal update(s) failed. This may indicate corrupted state.`);
|
|
334
324
|
}
|
|
325
|
+
stateManager.restoreUnchangedEvaluations(outcomesBefore);
|
|
335
326
|
});
|
|
336
327
|
}
|
|
337
328
|
catch (error) {
|
|
@@ -353,24 +344,8 @@ async function updateRepoScores(prMonitor, prs, mergedCounts, wasMergedSearchTru
|
|
|
353
344
|
// Batch metadata + trust sync mutations for a single disk write
|
|
354
345
|
try {
|
|
355
346
|
batchOnFreshBaseline(stateManager, () => {
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
try {
|
|
359
|
-
stateManager.updateRepoScore(repo, { stargazersCount: stars, language });
|
|
360
|
-
}
|
|
361
|
-
catch (error) {
|
|
362
|
-
metadataUpdateFailures++;
|
|
363
|
-
warn(MODULE, `Failed to update metadata for ${repo}: ${errorMessage(error)}`);
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
if (metadataUpdateFailures > 0) {
|
|
367
|
-
warnings.push({
|
|
368
|
-
phase: 'repo-scores',
|
|
369
|
-
operation: 'update repo metadata',
|
|
370
|
-
message: `${metadataUpdateFailures} of ${repoMetadata.size} metadata update(s) failed. This may indicate corrupted state.`,
|
|
371
|
-
});
|
|
372
|
-
warn(MODULE, `[METADATA_UPDATES_FAILED] ${metadataUpdateFailures} of ${repoMetadata.size} metadata update(s) failed.`);
|
|
373
|
-
}
|
|
347
|
+
// Stars and languages in, then untracked and private repositories out (#1924).
|
|
348
|
+
applyRepoMetadata(stateManager, repoMetadata, warnings);
|
|
374
349
|
// Auto-sync trustedProjects from repos with merged PRs
|
|
375
350
|
let trustSyncFailures = 0;
|
|
376
351
|
for (const [repo] of mergedCounts) {
|
|
@@ -426,14 +401,17 @@ function partitionPRs(prMonitor, prs, recentlyClosedPRs, recentlyMergedPRs, warn
|
|
|
426
401
|
let digest;
|
|
427
402
|
try {
|
|
428
403
|
batchOnFreshBaseline(stateManager, () => {
|
|
404
|
+
const shelvedPRInfo = stateManager.getState().config.shelvedPRInfo;
|
|
429
405
|
for (const pr of overriddenPRs) {
|
|
430
406
|
if (stateManager.isPRShelved(pr.url)) {
|
|
431
|
-
if (
|
|
407
|
+
if (shouldAutoUnshelve(pr, shelvedPRInfo)) {
|
|
432
408
|
stateManager.unshelvePR(pr.url);
|
|
433
409
|
autoUnshelvedPRs.push(toShelvedPRRef(pr));
|
|
434
410
|
activePRs.push(pr);
|
|
435
411
|
}
|
|
436
412
|
else {
|
|
413
|
+
// Still shelved: record its reasons if the shelve could not (#1922).
|
|
414
|
+
stateManager.fillShelvedPRReasons(pr.url, shelveReasonsOf(pr));
|
|
437
415
|
shelvedPRs.push(toShelvedPRRef(pr));
|
|
438
416
|
}
|
|
439
417
|
}
|
|
@@ -451,7 +429,7 @@ function partitionPRs(prMonitor, prs, recentlyClosedPRs, recentlyMergedPRs, warn
|
|
|
451
429
|
// output) reflect dashboard/CLI reclassifications.
|
|
452
430
|
// Note: digest.openPRs contains ALL fetched PRs (including shelved).
|
|
453
431
|
// We override summary fields below to reflect active-only counts.
|
|
454
|
-
digest = prMonitor.generateDigest(overriddenPRs, recentlyClosedPRs, recentlyMergedPRs);
|
|
432
|
+
digest = withoutShelvedNeedsAddressing(prMonitor.generateDigest(overriddenPRs, recentlyClosedPRs, recentlyMergedPRs), shelvedPRs);
|
|
455
433
|
// Attach shelve info to digest
|
|
456
434
|
digest.shelvedPRs = shelvedPRs;
|
|
457
435
|
digest.autoUnshelvedPRs = autoUnshelvedPRs;
|
|
@@ -487,7 +465,7 @@ function partitionPRs(prMonitor, prs, recentlyClosedPRs, recentlyMergedPRs, warn
|
|
|
487
465
|
throw new Error(`Daily digest generation failed and no previously persisted digest exists to fall back to` +
|
|
488
466
|
(recorded ? `: ${recorded.message}` : '.'));
|
|
489
467
|
}
|
|
490
|
-
return { activePRs, shelvedPRs, autoUnshelvedPRs, digest: persisted };
|
|
468
|
+
return { activePRs, shelvedPRs, autoUnshelvedPRs, digest: withoutShelvedNeedsAddressing(persisted, shelvedPRs) };
|
|
491
469
|
}
|
|
492
470
|
return { activePRs, shelvedPRs, autoUnshelvedPRs, digest };
|
|
493
471
|
}
|
|
@@ -500,7 +478,7 @@ function generateDigestOutput(digest, activePRs, shelvedPRs, commentedIssues, fa
|
|
|
500
478
|
const stateManager = getStateManager();
|
|
501
479
|
// Assess capacity from active PRs only (shelved PRs excluded). Reload first
|
|
502
480
|
// so maxActivePRs reflects a config change made while the run was fetching.
|
|
503
|
-
stateManager
|
|
481
|
+
reloadOrWarn(stateManager, warnings);
|
|
504
482
|
const capacity = assessCapacity(activePRs, stateManager.getState().config.maxActivePRs, shelvedPRs.length);
|
|
505
483
|
// One nudge per issue (#1863): an issue listed under closedPRStatusUpdates
|
|
506
484
|
// leaves the commented-issue list for this run unless it carries a new
|
|
@@ -517,7 +495,12 @@ function generateDigestOutput(digest, activePRs, shelvedPRs, commentedIssues, fa
|
|
|
517
495
|
// Filter dismissed issues: suppress if dismissed after last response, resurface + auto-undismiss if new activity.
|
|
518
496
|
const filteredCommentedIssues = filterDismissedIssues(stateManager, remainingCommentedIssues, warnings);
|
|
519
497
|
const issueResponses = filteredCommentedIssues.filter((i) => i.status === 'new_response');
|
|
520
|
-
|
|
498
|
+
// Counted over this run's digest, which may not be saved to state yet (#1911).
|
|
499
|
+
const pacing = getPacingStatus({ ...stateManager.getState(), lastDigest: digest });
|
|
500
|
+
// The fork line reads the last fork-prune dry run's cached count: daily makes no fork scan (#1912).
|
|
501
|
+
const forkPruneLine = cachedForkPruneLine();
|
|
502
|
+
const baseSummary = formatSummary(digest, capacity, issueResponses, pacing);
|
|
503
|
+
const summary = forkPruneLine ? `${baseSummary}\n${forkPruneLine}\n` : baseSummary;
|
|
521
504
|
// Auto-undismiss mutations are auto-saved by undismissIssue()
|
|
522
505
|
const actionableIssues = collectActionableIssues(activePRs, previousLastDigestAt);
|
|
523
506
|
digest.summary.totalNeedingAttention = actionableIssues.length;
|
|
@@ -570,6 +553,7 @@ function generateDigestOutput(digest, activePRs, shelvedPRs, commentedIssues, fa
|
|
|
570
553
|
warnings,
|
|
571
554
|
strategySummary,
|
|
572
555
|
...(workClaims.length > 0 && { workClaims }),
|
|
556
|
+
...(pacing && { pacing }),
|
|
573
557
|
};
|
|
574
558
|
}
|
|
575
559
|
const CLOSED_PR_STATUS_OPERATION = 'closed-PR status updates';
|
|
@@ -799,6 +783,7 @@ export function toDailyOutput(result) {
|
|
|
799
783
|
...(result.mergedPRNotes && { mergedPRNotes: result.mergedPRNotes.map((entry) => fenceMergedPRNotes(entry)) }),
|
|
800
784
|
...(result.reviewedPRs && { reviewedPRs: result.reviewedPRs.map((entry) => fenceReviewedPR(entry)) }),
|
|
801
785
|
...(result.workClaims && { workClaims: result.workClaims }),
|
|
786
|
+
...(result.pacing && { pacing: result.pacing }),
|
|
802
787
|
};
|
|
803
788
|
}
|
|
804
789
|
/**
|
|
@@ -846,7 +831,9 @@ async function executeDailyCheckInternal(token) {
|
|
|
846
831
|
// `gistInitWarning` duplicate — see `jsonSuccess` in formatters/json.ts.
|
|
847
832
|
const gistHealth = getStateManager().getGistHealth();
|
|
848
833
|
if (gistHealth.degraded) {
|
|
849
|
-
recordWarning(warnings, 'gist-init', 'Gist persistence degraded', null,
|
|
834
|
+
recordWarning(warnings, 'gist-init', 'Gist persistence degraded', null, gistHealth.degraded.cause === 'unknown-mode'
|
|
835
|
+
? renderUnknownModeWarning(gistHealth.degraded.mode)
|
|
836
|
+
: renderGistWarning(gistHealth.degraded.cause));
|
|
850
837
|
}
|
|
851
838
|
// Surface Gist staleness up-front so consumers see it even if Phase 1 fails (#1193).
|
|
852
839
|
const staleness = getStateManager().getStateStaleness();
|
|
@@ -861,9 +848,14 @@ async function executeDailyCheckInternal(token) {
|
|
|
861
848
|
(loadRecovery.rejectedPath ? `; rejected file preserved at ${loadRecovery.rejectedPath}` : '')));
|
|
862
849
|
}
|
|
863
850
|
// Phase 1: Fetch all PR data from GitHub
|
|
864
|
-
const { prs, failures, mergedCounts,
|
|
851
|
+
const { prs, failures, mergedCounts, truncatedSearches, mergedTotalCount, closedTotalCount, closedCounts, searchedPRs, monthlyCounts, monthlyClosedCounts, openedFromMerged, openedFromClosed, recentlyClosedPRs, recentlyMergedPRs, recentlyMergedFetchFailed, commentedIssues, successorGaps, } = await fetchPRData(prMonitor, token, warnings);
|
|
865
852
|
// Phase 2: Update repo scores (signals, star counts, trust sync)
|
|
866
|
-
await updateRepoScores(prMonitor, prs, mergedCounts,
|
|
853
|
+
await updateRepoScores(prMonitor, prs, mergedCounts, truncatedSearches, closedCounts, searchedPRs, warnings);
|
|
854
|
+
// Merges and closes since each ledger's newest entry, fetched before Phase 3 adds to it (#1924, #1925).
|
|
855
|
+
const [mergedGap, closedGap] = await Promise.all([
|
|
856
|
+
fetchMergedLedgerGap(getOctokit(token), getStateManager(), warnings, mergedTotalCount),
|
|
857
|
+
fetchClosedLedgerGap(getOctokit(token), getStateManager(), warnings, closedTotalCount),
|
|
858
|
+
]);
|
|
867
859
|
// Phase 3: Persist monthly analytics and store merged/closed PR history.
|
|
868
860
|
// try-catch: analytics are supplementary — save failure should not crash the daily check.
|
|
869
861
|
try {
|
|
@@ -886,28 +878,20 @@ async function executeDailyCheckInternal(token) {
|
|
|
886
878
|
// missing ledger fields in place), so overlaps are safe. openedAt comes
|
|
887
879
|
// free from the search result; firstMaintainerResponseAt is best-effort
|
|
888
880
|
// from the previous run's enriched digest — zero new API calls (#1461).
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
title: pr.title,
|
|
904
|
-
closedAt: pr.closedAt,
|
|
905
|
-
openedAt: pr.openedAt,
|
|
906
|
-
firstMaintainerResponseAt: firstMaintainerResponseFromDigest(previousDigest, pr.url),
|
|
907
|
-
issueUrl: pr.issueUrl,
|
|
908
|
-
...lastReviewStateFromDigest(previousDigest, pr.url),
|
|
909
|
-
})));
|
|
910
|
-
}
|
|
881
|
+
storeMergedLedger(getStateManager(), {
|
|
882
|
+
gap: mergedGap,
|
|
883
|
+
allTimeCount: mergedTotalCount,
|
|
884
|
+
recentlyMergedPRs,
|
|
885
|
+
previousDigest,
|
|
886
|
+
warnings,
|
|
887
|
+
});
|
|
888
|
+
storeClosedLedger(getStateManager(), {
|
|
889
|
+
gap: closedGap,
|
|
890
|
+
allTimeCount: closedTotalCount,
|
|
891
|
+
recentlyClosedPRs,
|
|
892
|
+
previousDigest,
|
|
893
|
+
warnings,
|
|
894
|
+
});
|
|
911
895
|
});
|
|
912
896
|
}
|
|
913
897
|
catch (error) {
|
|
@@ -939,13 +923,19 @@ async function executeDailyCheckInternal(token) {
|
|
|
939
923
|
if (unextractedMergeCount > 0 && sm.getState().config.autoExtractLearnings) {
|
|
940
924
|
unextractedMergeCount = 0;
|
|
941
925
|
if (sm.isGistMode()) {
|
|
942
|
-
const
|
|
926
|
+
const repoSet = new Set();
|
|
943
927
|
for (const pr of unextracted) {
|
|
944
928
|
const parsed = parseGitHubUrl(pr.url);
|
|
945
929
|
if (parsed)
|
|
946
|
-
|
|
930
|
+
repoSet.add(`${parsed.owner}/${parsed.repo}`);
|
|
947
931
|
}
|
|
948
|
-
|
|
932
|
+
const repos = [...repoSet].sort();
|
|
933
|
+
// Proposal state per repo (#2041): the host neither builds paths nor re-extracts.
|
|
934
|
+
const prsOf = (repo) => unextracted.filter((pr) => pr.url.startsWith(`https://github.com/${repo}/`));
|
|
935
|
+
const proposals = repos
|
|
936
|
+
.filter((repo) => isProposalRepo(repo))
|
|
937
|
+
.map((repo) => guidelineProposalStatus(repo, prsOf(repo)));
|
|
938
|
+
pendingLearnings = { repos, proposals, prCount: unextracted.length };
|
|
949
939
|
}
|
|
950
940
|
else {
|
|
951
941
|
warnings.push({
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { type DashboardJsonData } from './dashboard-data.js';
|
|
11
11
|
import { type DailyDigest, type AgentState, type CommentedIssue, type MergedPR, type ClosedPR } from '../core/types.js';
|
|
12
|
+
/** Forget cached foreign-checkout verdicts so the next lookup re-runs Git. */
|
|
13
|
+
export declare function clearForeignVerdicts(): void;
|
|
12
14
|
/**
|
|
13
15
|
* Get the mtime of the vetted issue list file in ms, or null if unknown.
|
|
14
16
|
* Used to detect external edits and invalidate the cached dashboard payload.
|
|
@@ -11,11 +11,36 @@ import * as fs from 'node:fs';
|
|
|
11
11
|
import { getStateManager, applyStatusOverrides, classifyAttentionBucket, isCoveredByDismiss } from '../core/index.js';
|
|
12
12
|
import { errorMessage } from '../core/errors.js';
|
|
13
13
|
import { warn } from '../core/logger.js';
|
|
14
|
+
import { findRefKey } from '../core/urls.js';
|
|
14
15
|
import { computePRsByRepo, computeTopRepos, getMonthlyData, buildDashboardStats, reconcileShelvePartition, storedToMergedPRs, storedToClosedPRs, } from './dashboard-data.js';
|
|
15
|
-
import {
|
|
16
|
+
import { detectIssueListPath, isForeignCheckout } from './locate-issue-list.js';
|
|
16
17
|
import { parseIssueList } from './parse-list.js';
|
|
17
18
|
import { isBelowMinStars, } from '../core/types.js';
|
|
18
19
|
const MODULE = 'dashboard-server';
|
|
20
|
+
// Foreign-checkout verdicts keyed by checkout dir + GitHub username (#2012).
|
|
21
|
+
// The dashboard polls /api/data, and the check runs two synchronous `git`
|
|
22
|
+
// calls; the configured path and its source are still read on every call, so
|
|
23
|
+
// `setup --set issueListPath=...` takes effect on the next request. GET
|
|
24
|
+
// /api/data clears these when state reloads or the list file changes, so a
|
|
25
|
+
// remote change in the list's checkout is seen at the next such event.
|
|
26
|
+
const foreignVerdicts = new Map();
|
|
27
|
+
/** Forget cached foreign-checkout verdicts so the next lookup re-runs Git. */
|
|
28
|
+
export function clearForeignVerdicts() {
|
|
29
|
+
foreignVerdicts.clear();
|
|
30
|
+
}
|
|
31
|
+
function isForeignCheckoutCached(dir) {
|
|
32
|
+
const key = `${dir}\0${getStateManager().getState().config.githubUsername}`;
|
|
33
|
+
let verdict = foreignVerdicts.get(key);
|
|
34
|
+
if (verdict === undefined) {
|
|
35
|
+
verdict = isForeignCheckout(dir);
|
|
36
|
+
foreignVerdicts.set(key, verdict);
|
|
37
|
+
}
|
|
38
|
+
return verdict;
|
|
39
|
+
}
|
|
40
|
+
/** The configured issue list path for the dashboard: no item counting, Git checked once per checkout. */
|
|
41
|
+
function dashboardIssueListPath() {
|
|
42
|
+
return detectIssueListPath(isForeignCheckoutCached)?.path;
|
|
43
|
+
}
|
|
19
44
|
/**
|
|
20
45
|
* Read and parse the vetted issue list file (non-fatal on failure).
|
|
21
46
|
*
|
|
@@ -26,10 +51,10 @@ const MODULE = 'dashboard-server';
|
|
|
26
51
|
*/
|
|
27
52
|
function readVettedIssues(failures) {
|
|
28
53
|
try {
|
|
29
|
-
const
|
|
30
|
-
if (!
|
|
54
|
+
const listPath = dashboardIssueListPath();
|
|
55
|
+
if (!listPath)
|
|
31
56
|
return null;
|
|
32
|
-
const content = fs.readFileSync(
|
|
57
|
+
const content = fs.readFileSync(listPath, 'utf8');
|
|
33
58
|
return parseIssueList(content);
|
|
34
59
|
}
|
|
35
60
|
catch (error) {
|
|
@@ -44,10 +69,10 @@ function readVettedIssues(failures) {
|
|
|
44
69
|
*/
|
|
45
70
|
export function getIssueListMtimeMs() {
|
|
46
71
|
try {
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
72
|
+
const listPath = dashboardIssueListPath();
|
|
73
|
+
if (!listPath)
|
|
49
74
|
return null;
|
|
50
|
-
return fs.statSync(
|
|
75
|
+
return fs.statSync(listPath).mtimeMs;
|
|
51
76
|
}
|
|
52
77
|
catch {
|
|
53
78
|
return null;
|
|
@@ -101,7 +126,7 @@ export function buildDashboardJson(digest, state, commentedIssues, allMergedPRs,
|
|
|
101
126
|
const issueResponses = commentedIssues.filter((i) => {
|
|
102
127
|
if (i.status !== 'new_response')
|
|
103
128
|
return false;
|
|
104
|
-
const dismissedAt = dismissedIssues[i.url];
|
|
129
|
+
const dismissedAt = dismissedIssues[findRefKey(dismissedIssues, i.url) ?? i.url];
|
|
105
130
|
return !dismissedAt || !isCoveredByDismiss(dismissedAt, i.lastResponseAt);
|
|
106
131
|
});
|
|
107
132
|
// Build repo metadata map from repoScores — omit repos without stars or language to avoid empty entries
|