@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
|
@@ -5,7 +5,9 @@
|
|
|
5
5
|
import { extractOwnerRepo, parseGitHubUrl, isOwnRepo, isUntrackedOrg } from './urls.js';
|
|
6
6
|
import { isBelowMinStars } from './types.js';
|
|
7
7
|
import { debug, warn } from './logger.js';
|
|
8
|
+
import { describeError } from './errors.js';
|
|
8
9
|
import { getHttpCache } from './http-cache.js';
|
|
10
|
+
import { searchAllPages } from './pagination.js';
|
|
9
11
|
const MODULE = 'github-stats';
|
|
10
12
|
/** TTL for cached PR count results (24 hours — these stats change slowly). */
|
|
11
13
|
export const PR_COUNTS_CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
@@ -72,6 +74,35 @@ export function mentionedIssueUrls(title, body, prUrl) {
|
|
|
72
74
|
}
|
|
73
75
|
return [...urls];
|
|
74
76
|
}
|
|
77
|
+
/** GitHub rejects a search whose text is longer than this. */
|
|
78
|
+
const MAX_SEARCH_QUERY_CHARS = 256;
|
|
79
|
+
/**
|
|
80
|
+
* Room kept inside that limit for what callers add around the scope: the
|
|
81
|
+
* state qualifiers (`is:pr is:closed is:unmerged`) and two date bounds.
|
|
82
|
+
*/
|
|
83
|
+
const SCOPE_QUERY_BUDGET = MAX_SEARCH_QUERY_CHARS - 96;
|
|
84
|
+
/** An organisation login that is safe to put in a search query. */
|
|
85
|
+
const ORG_LOGIN_RE = /^[\w.-]+$/;
|
|
86
|
+
/**
|
|
87
|
+
* Which of the user's PRs the ledgers and their counts cover: public
|
|
88
|
+
* repositories only, not the user's own, and not organisations in
|
|
89
|
+
* `config.untrackedOrgs` (the user's employer). One fragment, so the merged
|
|
90
|
+
* and closed ledger fetches and the count searches cannot drift apart: a
|
|
91
|
+
* count taken over a wider set than the ledger can hold would report a gap
|
|
92
|
+
* no back-fill closes.
|
|
93
|
+
*/
|
|
94
|
+
export function externalPRScope(username, untrackedOrgs = []) {
|
|
95
|
+
const base = `is:public author:${username} -user:${username}`;
|
|
96
|
+
const exclusions = untrackedOrgs.map((org) => ` -org:${org}`).join('');
|
|
97
|
+
// No cap on the number of exclusions: a live search with ten `-org:` terms
|
|
98
|
+
// was accepted and returned a count. GitHub's documented limit of five
|
|
99
|
+
// operators is about the AND / OR / NOT keywords, not `-qualifier` terms.
|
|
100
|
+
const isExact = untrackedOrgs.every((org) => ORG_LOGIN_RE.test(org)) && base.length + exclusions.length <= SCOPE_QUERY_BUDGET;
|
|
101
|
+
if (!isExact) {
|
|
102
|
+
debug(MODULE, 'untrackedOrgs do not fit in a search query; filtering results instead, totals are not comparable.');
|
|
103
|
+
}
|
|
104
|
+
return { query: isExact ? base + exclusions : base, isExact };
|
|
105
|
+
}
|
|
75
106
|
/** Returns an empty PRCountsResult. Used as the fallback when stats fetches fail or username is empty. */
|
|
76
107
|
export function emptyPRCountsResult() {
|
|
77
108
|
return {
|
|
@@ -94,7 +125,8 @@ function isCachedPRCounts(v) {
|
|
|
94
125
|
typeof obj.monthlyOpenedCounts === 'object' &&
|
|
95
126
|
obj.monthlyOpenedCounts !== null &&
|
|
96
127
|
typeof obj.dailyActivityCounts === 'object' &&
|
|
97
|
-
obj.dailyActivityCounts !== null
|
|
128
|
+
obj.dailyActivityCounts !== null &&
|
|
129
|
+
['number', 'undefined'].includes(typeof obj.totalCount));
|
|
98
130
|
}
|
|
99
131
|
/**
|
|
100
132
|
* Shared paginated search for user PR counts with histogram tracking.
|
|
@@ -104,14 +136,19 @@ function isCachedPRCounts(v) {
|
|
|
104
136
|
* string (e.g. mergedAt or closedAt) used for monthly counts and daily activity.
|
|
105
137
|
* Return an empty string to skip histogram tracking for that item.
|
|
106
138
|
*/
|
|
107
|
-
async function fetchUserPRCounts(octokit, githubUsername, query, label, accumulateRepo, starFilter) {
|
|
139
|
+
async function fetchUserPRCounts(octokit, githubUsername, query, label, accumulateRepo, starFilter, untrackedOrgs) {
|
|
108
140
|
if (!githubUsername) {
|
|
109
141
|
return emptyPRCountsResult();
|
|
110
142
|
}
|
|
111
143
|
// Check for a fresh cached result (avoids 10-20 paginated API calls)
|
|
112
144
|
const cache = getHttpCache();
|
|
113
145
|
const minStarsSuffix = starFilter ? `:stars${starFilter.minStars}` : '';
|
|
114
|
-
|
|
146
|
+
// v4: public repositories only, untracked organisations excluded (#1924).
|
|
147
|
+
// Sorted, so reordering the setting does not discard a fresh cache entry.
|
|
148
|
+
const orgKey = untrackedOrgs.map((org) => org.toLowerCase()).sort((a, b) => a.localeCompare(b));
|
|
149
|
+
const orgsSuffix = orgKey.length > 0 ? `:-${orgKey.join(',')}` : '';
|
|
150
|
+
const cacheKey = `pr-counts:v4:${label}:${githubUsername}${minStarsSuffix}${orgsSuffix}`;
|
|
151
|
+
const scope = externalPRScope(githubUsername, untrackedOrgs);
|
|
115
152
|
const cached = cache.getIfFresh(cacheKey, PR_COUNTS_CACHE_TTL_MS);
|
|
116
153
|
if (cached && isCachedPRCounts(cached)) {
|
|
117
154
|
debug(MODULE, `Using cached ${label} PR counts for @${githubUsername}`);
|
|
@@ -122,6 +159,7 @@ async function fetchUserPRCounts(octokit, githubUsername, query, label, accumula
|
|
|
122
159
|
dailyActivityCounts: cached.dailyActivityCounts,
|
|
123
160
|
searchedPRs: Array.isArray(cached.searchedPRs) ? cached.searchedPRs : [],
|
|
124
161
|
truncated: cached.truncated === true,
|
|
162
|
+
totalCount: cached.totalCount,
|
|
125
163
|
};
|
|
126
164
|
}
|
|
127
165
|
debug(MODULE, `Fetching ${label} PR counts for @${githubUsername}...`);
|
|
@@ -135,7 +173,7 @@ async function fetchUserPRCounts(octokit, githubUsername, query, label, accumula
|
|
|
135
173
|
let totalCount;
|
|
136
174
|
while (true) {
|
|
137
175
|
const { data } = await octokit.search.issuesAndPullRequests({
|
|
138
|
-
q: `is:pr ${query}
|
|
176
|
+
q: `is:pr ${query} ${scope.query}`,
|
|
139
177
|
sort: 'updated',
|
|
140
178
|
order: 'desc',
|
|
141
179
|
per_page: 100,
|
|
@@ -150,8 +188,9 @@ async function fetchUserPRCounts(octokit, githubUsername, query, label, accumula
|
|
|
150
188
|
}
|
|
151
189
|
const { owner } = parsed;
|
|
152
190
|
const repo = `${owner}/${parsed.repo}`;
|
|
153
|
-
// Skip own repos (PRs to your own repos aren't OSS contributions)
|
|
154
|
-
|
|
191
|
+
// Skip own repos (PRs to your own repos aren't OSS contributions) and
|
|
192
|
+
// untracked organisations (never counted, whether or not the query excluded them).
|
|
193
|
+
if (isOwnRepo(owner, githubUsername) || isUntrackedOrg(owner, untrackedOrgs))
|
|
155
194
|
continue;
|
|
156
195
|
searchedPRs.push({ url: item.html_url, title: item.title ?? '' });
|
|
157
196
|
// Skip repos below the minimum star threshold (#576).
|
|
@@ -193,6 +232,7 @@ async function fetchUserPRCounts(octokit, githubUsername, query, label, accumula
|
|
|
193
232
|
warn(MODULE, `Pagination capped at ${MAX_PAGINATION_PAGES} pages: fetched ${fetched} of ${totalCount} ${label} PRs. Stats may be incomplete for prolific contributors.`);
|
|
194
233
|
}
|
|
195
234
|
debug(MODULE, `Found ${fetched} ${label} PRs across ${repos.size} repos`);
|
|
235
|
+
const comparableTotal = scope.isExact ? totalCount : undefined;
|
|
196
236
|
// Cache the aggregated result (Map → entries array for JSON serialization).
|
|
197
237
|
// Note: truncated results (from pagination cap) are cached with the same TTL. This is an
|
|
198
238
|
// accepted tradeoff — prolific contributors (300+ PRs) may see slightly incomplete stats
|
|
@@ -200,18 +240,27 @@ async function fetchUserPRCounts(octokit, githubUsername, query, label, accumula
|
|
|
200
240
|
cache.set(cacheKey, '', {
|
|
201
241
|
reposEntries: Array.from(repos.entries()),
|
|
202
242
|
truncated: isTruncated,
|
|
243
|
+
totalCount: comparableTotal,
|
|
203
244
|
monthlyCounts,
|
|
204
245
|
monthlyOpenedCounts,
|
|
205
246
|
dailyActivityCounts,
|
|
206
247
|
searchedPRs,
|
|
207
248
|
});
|
|
208
|
-
return {
|
|
249
|
+
return {
|
|
250
|
+
repos,
|
|
251
|
+
monthlyCounts,
|
|
252
|
+
monthlyOpenedCounts,
|
|
253
|
+
dailyActivityCounts,
|
|
254
|
+
searchedPRs,
|
|
255
|
+
totalCount: comparableTotal,
|
|
256
|
+
truncated: isTruncated,
|
|
257
|
+
};
|
|
209
258
|
}
|
|
210
259
|
/**
|
|
211
260
|
* Fetch merged PR counts and latest merge dates per repository for the configured user.
|
|
212
261
|
* Also builds a monthly histogram of all merges for the contribution timeline.
|
|
213
262
|
*/
|
|
214
|
-
export function fetchUserMergedPRCounts(octokit, githubUsername, starFilter) {
|
|
263
|
+
export function fetchUserMergedPRCounts(octokit, githubUsername, starFilter, untrackedOrgs = []) {
|
|
215
264
|
return fetchUserPRCounts(octokit, githubUsername, 'is:merged', 'merged', (repos, repo, item) => {
|
|
216
265
|
if (!item.pull_request?.merged_at) {
|
|
217
266
|
warn(MODULE, `merged_at missing for merged PR ${item.html_url}${item.closed_at ? ', falling back to closed_at' : ', no date available'}`);
|
|
@@ -228,17 +277,32 @@ export function fetchUserMergedPRCounts(octokit, githubUsername, starFilter) {
|
|
|
228
277
|
repos.set(repo, { count: 1, lastMergedAt: mergedAt });
|
|
229
278
|
}
|
|
230
279
|
return mergedAt;
|
|
231
|
-
}, starFilter);
|
|
280
|
+
}, starFilter, untrackedOrgs);
|
|
232
281
|
}
|
|
233
282
|
/**
|
|
234
283
|
* Fetch closed-without-merge PR counts per repository for the configured user.
|
|
235
284
|
* Used to populate closedWithoutMergeCount in repo scores for accurate merge rate.
|
|
236
285
|
*/
|
|
237
|
-
export function fetchUserClosedPRCounts(octokit, githubUsername, starFilter) {
|
|
286
|
+
export function fetchUserClosedPRCounts(octokit, githubUsername, starFilter, untrackedOrgs = []) {
|
|
238
287
|
return fetchUserPRCounts(octokit, githubUsername, 'is:closed is:unmerged', 'closed', (repos, repo, item) => {
|
|
239
288
|
repos.set(repo, (repos.get(repo) || 0) + 1);
|
|
240
289
|
return item.closed_at || '';
|
|
241
|
-
}, starFilter);
|
|
290
|
+
}, starFilter, untrackedOrgs);
|
|
291
|
+
}
|
|
292
|
+
/** Word a partial recent-PR search: a failed later page, else the counts read. */
|
|
293
|
+
function describeRecentListTruncation(label, search) {
|
|
294
|
+
const read = search.items.length;
|
|
295
|
+
if (search.failure) {
|
|
296
|
+
const cause = describeError(search.failure.error);
|
|
297
|
+
return {
|
|
298
|
+
label: `recently ${label} PR search failed on page ${search.failure.page} (${read} read)`,
|
|
299
|
+
message: `Recently ${label} PR search failed on page ${search.failure.page} (${cause}); only the ${read} result(s) from the page(s) before it were read. Some recently ${label} PRs may be missing this run.`,
|
|
300
|
+
};
|
|
301
|
+
}
|
|
302
|
+
return {
|
|
303
|
+
label: `recently ${label} PR search truncated (${read} of ${search.totalCount})`,
|
|
304
|
+
message: `Recently ${label} PR search is partial: read the ${read} most recently updated of ${search.totalCount} result(s). Some recently ${label} PRs may be missing this run.`,
|
|
305
|
+
};
|
|
242
306
|
}
|
|
243
307
|
/**
|
|
244
308
|
* Shared helper: search for recent PRs and filter out own repos.
|
|
@@ -250,8 +314,15 @@ export function fetchUserClosedPRCounts(octokit, githubUsername, starFilter) {
|
|
|
250
314
|
* vanishes from any `closed:>=X` filter even though the API returns a correct
|
|
251
315
|
* `closed_at`. `updated` is the sort key, so it is always indexed. We narrow to
|
|
252
316
|
* the real window here with `dateOf`.
|
|
317
|
+
*
|
|
318
|
+
* Reads up to `SEARCH_MAX_PAGES` pages (`searchAllPages`). When the list is
|
|
319
|
+
* still partial (more results than were read, a later page failed, or GitHub
|
|
320
|
+
* flagged the search incomplete), what was read is returned and the
|
|
321
|
+
* recent-list truncation is logged and pushed to `truncations`, so the caller
|
|
322
|
+
* can report it and hold back anything that reads "not in this list" as a
|
|
323
|
+
* fact (#1928).
|
|
253
324
|
*/
|
|
254
|
-
async function fetchRecentPRs(octokit, config, query, label, days, mapItem, dateOf) {
|
|
325
|
+
async function fetchRecentPRs(octokit, config, query, label, days, mapItem, dateOf, truncations) {
|
|
255
326
|
if (!config.githubUsername) {
|
|
256
327
|
warn(MODULE, `Skipping recently ${label} PRs fetch: no githubUsername configured. Run /setup-oss to configure.`);
|
|
257
328
|
return [];
|
|
@@ -260,14 +331,25 @@ async function fetchRecentPRs(octokit, config, query, label, days, mapItem, date
|
|
|
260
331
|
sinceDate.setDate(sinceDate.getDate() - days);
|
|
261
332
|
const since = sinceDate.toISOString().split('T', 1)[0]; // YYYY-MM-DD
|
|
262
333
|
debug(MODULE, `Fetching recently ${label} PRs for @${config.githubUsername} (since ${since})...`);
|
|
263
|
-
|
|
264
|
-
|
|
334
|
+
// The shared scope keeps untracked organisations out of the search itself,
|
|
335
|
+
// so their PRs use no page slots; the owner filter below stays for a list
|
|
336
|
+
// that does not fit in a query.
|
|
337
|
+
const scope = externalPRScope(config.githubUsername, config.untrackedOrgs);
|
|
338
|
+
const search = await searchAllPages((page) => octokit.search.issuesAndPullRequests({
|
|
339
|
+
page,
|
|
340
|
+
q: query.replace('{scope}', scope.query).replace('{since}', since),
|
|
265
341
|
sort: 'updated',
|
|
266
342
|
order: 'desc',
|
|
267
343
|
per_page: 100,
|
|
268
|
-
});
|
|
344
|
+
}));
|
|
345
|
+
const { items } = search;
|
|
346
|
+
if (search.truncated) {
|
|
347
|
+
const truncation = describeRecentListTruncation(label, search);
|
|
348
|
+
warn(MODULE, truncation.message);
|
|
349
|
+
truncations?.push(truncation);
|
|
350
|
+
}
|
|
269
351
|
const results = [];
|
|
270
|
-
for (const item of
|
|
352
|
+
for (const item of items) {
|
|
271
353
|
const parsed = parseGitHubUrl(item.html_url);
|
|
272
354
|
if (!parsed) {
|
|
273
355
|
warn(MODULE, `Could not parse GitHub URL from API response: ${item.html_url}`);
|
|
@@ -293,8 +375,8 @@ async function fetchRecentPRs(octokit, config, query, label, days, mapItem, date
|
|
|
293
375
|
* Fetch PRs closed without merge in the last N days.
|
|
294
376
|
* Returns lightweight ClosedPR objects for surfacing in the daily digest.
|
|
295
377
|
*/
|
|
296
|
-
export async function fetchRecentlyClosedPRs(octokit, config, days = 7) {
|
|
297
|
-
return fetchRecentPRs(octokit, config, 'is:pr is:closed is:unmerged
|
|
378
|
+
export async function fetchRecentlyClosedPRs(octokit, config, days = 7, truncations) {
|
|
379
|
+
return fetchRecentPRs(octokit, config, 'is:pr is:closed is:unmerged {scope} updated:>={since}', 'closed', days, (item, { repo, number }) => ({
|
|
298
380
|
url: item.html_url,
|
|
299
381
|
repo,
|
|
300
382
|
number,
|
|
@@ -303,14 +385,14 @@ export async function fetchRecentlyClosedPRs(octokit, config, days = 7) {
|
|
|
303
385
|
// Free on the search result — feeds the outcome ledger (#1461).
|
|
304
386
|
openedAt: item.created_at || undefined,
|
|
305
387
|
issueUrl: closingIssueUrl(item.body, item.html_url),
|
|
306
|
-
}), (item) => item.closed_at);
|
|
388
|
+
}), (item) => item.closed_at, truncations);
|
|
307
389
|
}
|
|
308
390
|
/**
|
|
309
391
|
* Fetch PRs merged in the last N days.
|
|
310
392
|
* Returns lightweight MergedPR objects for surfacing as wins in the dashboard.
|
|
311
393
|
*/
|
|
312
|
-
export async function fetchRecentlyMergedPRs(octokit, config, days = 7) {
|
|
313
|
-
return fetchRecentPRs(octokit, config, 'is:pr is:merged
|
|
394
|
+
export async function fetchRecentlyMergedPRs(octokit, config, days = 7, truncations) {
|
|
395
|
+
return fetchRecentPRs(octokit, config, 'is:pr is:merged {scope} updated:>={since}', 'merged', days, (item, { repo, number }) => {
|
|
314
396
|
const mergedAt = item.pull_request?.merged_at;
|
|
315
397
|
if (!mergedAt) {
|
|
316
398
|
warn(MODULE, `merged_at missing for merged PR ${item.html_url}${item.closed_at ? ', falling back to closed_at' : ', no date available'}`);
|
|
@@ -325,96 +407,199 @@ export async function fetchRecentlyMergedPRs(octokit, config, days = 7) {
|
|
|
325
407
|
openedAt: item.created_at || undefined,
|
|
326
408
|
issueUrl: closingIssueUrl(item.body, item.html_url),
|
|
327
409
|
};
|
|
328
|
-
}, (item) => item.pull_request?.merged_at || item.closed_at);
|
|
410
|
+
}, (item) => item.pull_request?.merged_at || item.closed_at, truncations);
|
|
329
411
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
412
|
+
/**
|
|
413
|
+
* Most PRs a ledger gap fetch takes in one run (the Search API's own cap for
|
|
414
|
+
* a single query). A search matching more returns nothing: the caller stores
|
|
415
|
+
* no rows, so the ledger's newest entry stays where it was, the next run asks
|
|
416
|
+
* for the same range, and `ledger-backfill` (no limit) is the way out.
|
|
417
|
+
*/
|
|
418
|
+
export const LEDGER_GAP_MAX_RESULTS = 1000;
|
|
419
|
+
/** What the daily run and the dashboard report when a merged-ledger gap fetch is truncated. */
|
|
420
|
+
export const MERGED_LEDGER_TRUNCATED_MESSAGE = `More than ${LEDGER_GAP_MAX_RESULTS} merged PRs changed since the merged-PR ledger was last filled, ` +
|
|
421
|
+
'so none were stored. Run `ledger-backfill` to fetch the full history.';
|
|
422
|
+
/** What the daily run and the dashboard report when a closed-ledger gap fetch is truncated. */
|
|
423
|
+
export const CLOSED_LEDGER_TRUNCATED_MESSAGE = `More than ${LEDGER_GAP_MAX_RESULTS} closed PRs changed since the closed-PR ledger was last filled, ` +
|
|
424
|
+
'so none were stored. Run `ledger-backfill` to fetch the full history.';
|
|
425
|
+
/**
|
|
426
|
+
* A ledger with fewer rows than this that is short of GitHub's all-time count
|
|
427
|
+
* is refetched from the start (#1504, #1925): a recent row stored ahead of the
|
|
428
|
+
* history behind it would otherwise hide that history from every gap fetch.
|
|
429
|
+
* Past it a short ledger keeps its watermark, so a contributor whose count
|
|
430
|
+
* legitimately exceeds the ledger doesn't refetch everything on every run;
|
|
431
|
+
* the count warning and `ledger-backfill` cover that case.
|
|
432
|
+
*/
|
|
433
|
+
export const LEDGER_BACKFILL_CEILING = 300;
|
|
434
|
+
/**
|
|
435
|
+
* The watermark a ledger gap fetch starts from: undefined (all time) when the
|
|
436
|
+
* ledger holds `stored` rows, fewer than `allTimeCount` and under
|
|
437
|
+
* {@link LEDGER_BACKFILL_CEILING}; otherwise `watermark`. An unknown count
|
|
438
|
+
* keeps the watermark.
|
|
439
|
+
*/
|
|
440
|
+
export function gapFetchWatermark(watermark, stored, allTimeCount) {
|
|
441
|
+
return stored < (allTimeCount ?? 0) && stored < LEDGER_BACKFILL_CEILING ? undefined : watermark;
|
|
442
|
+
}
|
|
443
|
+
/** How far before the watermark a gap fetch starts: covers clock skew and search indexing lag. */
|
|
444
|
+
const LEDGER_GAP_OVERLAP_MS = 24 * 60 * 60 * 1000;
|
|
445
|
+
/**
|
|
446
|
+
* The search bound for a ledger watermark (its newest stored date): one
|
|
447
|
+
* overlap earlier, at second precision. An absent or unparseable watermark
|
|
448
|
+
* gives undefined, which means "all time".
|
|
449
|
+
*/
|
|
450
|
+
export function withLedgerOverlap(watermark = '') {
|
|
451
|
+
const time = Date.parse(watermark);
|
|
452
|
+
if (Number.isNaN(time))
|
|
453
|
+
return undefined;
|
|
454
|
+
const bound = new Date(time - LEDGER_GAP_OVERLAP_MS);
|
|
455
|
+
return `${bound.toISOString().slice(0, 19)}Z`;
|
|
456
|
+
}
|
|
457
|
+
/**
|
|
458
|
+
* Up to MAX_PAGINATION_PAGES pages of `q`, oldest-created first. That order
|
|
459
|
+
* never changes while paging (a PR's creation date is fixed), and it lets the
|
|
460
|
+
* caller continue past the page cap with a `created:>=` bound instead of deep
|
|
461
|
+
* pages. Stops after the first page when the total exceeds `maxResults`.
|
|
462
|
+
*/
|
|
463
|
+
async function fetchSearchWindow(octokit, q, maxResults) {
|
|
464
|
+
const items = [];
|
|
465
|
+
let totalCount = 0;
|
|
466
|
+
let isExhausted = false;
|
|
467
|
+
for (let page = 1; !isExhausted && page <= MAX_PAGINATION_PAGES && totalCount <= maxResults; page++) {
|
|
343
468
|
const { data } = await octokit.search.issuesAndPullRequests({
|
|
344
469
|
q,
|
|
345
|
-
sort: '
|
|
346
|
-
order: '
|
|
470
|
+
sort: 'created',
|
|
471
|
+
order: 'asc',
|
|
347
472
|
per_page: 100,
|
|
348
473
|
page,
|
|
349
474
|
});
|
|
350
475
|
totalCount = data.total_count;
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
476
|
+
items.push(...data.items);
|
|
477
|
+
isExhausted = items.length >= totalCount || data.items.length === 0;
|
|
478
|
+
}
|
|
479
|
+
return { items, totalCount, isExhausted };
|
|
480
|
+
}
|
|
481
|
+
/** The stored-shape record for a search item, or undefined when it is skipped. */
|
|
482
|
+
function toStoredRecord(item, config, adapter) {
|
|
483
|
+
const parsed = parseGitHubUrl(item.html_url);
|
|
484
|
+
if (!parsed) {
|
|
485
|
+
warn(MODULE, `Skipping ${adapter.kind} PR with unparseable URL: ${item.html_url}`);
|
|
486
|
+
return undefined;
|
|
487
|
+
}
|
|
488
|
+
if (isOwnRepo(parsed.owner, config.githubUsername))
|
|
489
|
+
return undefined;
|
|
490
|
+
// Never stored, whether or not the query could exclude the organisation.
|
|
491
|
+
if (isUntrackedOrg(parsed.owner, config.untrackedOrgs))
|
|
492
|
+
return undefined;
|
|
493
|
+
const date = adapter.extractDate(item);
|
|
494
|
+
if (!date) {
|
|
495
|
+
warn(MODULE, `Skipping ${adapter.kind} PR with no ${adapter.dateNoun} date: ${item.html_url}`);
|
|
496
|
+
return undefined;
|
|
497
|
+
}
|
|
498
|
+
return adapter.buildRecord(item, date);
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* A window that ended on its page cap without a later creation date to
|
|
502
|
+
* continue from (300 PRs created in one second, or no creation dates). The
|
|
503
|
+
* walk would repeat it forever, so it counts as truncated.
|
|
504
|
+
*/
|
|
505
|
+
function isWalkStuck(page, cursor, next) {
|
|
506
|
+
return !page.isExhausted && (!next || next === cursor);
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Every PR matching the adapter's query for `since`, or `truncated` when
|
|
510
|
+
* there are more than `maxResults`. Walks the results in windows of
|
|
511
|
+
* MAX_PAGINATION_PAGES pages, each starting at the creation date the last one
|
|
512
|
+
* ended on, so no request goes to a deep page. A request failure rejects;
|
|
513
|
+
* nothing partial is returned either way.
|
|
514
|
+
*/
|
|
515
|
+
async function fetchPRsSince(octokit, config, adapter, since, maxResults) {
|
|
516
|
+
if (!config.githubUsername) {
|
|
517
|
+
warn(MODULE, `Skipping ${adapter.kind} PRs fetch: no githubUsername configured.`);
|
|
518
|
+
return { prs: [], truncated: false };
|
|
519
|
+
}
|
|
520
|
+
const scope = externalPRScope(config.githubUsername, config.untrackedOrgs);
|
|
521
|
+
const baseQuery = adapter.buildQuery(scope.query, since);
|
|
522
|
+
debug(MODULE, `Fetching ${adapter.kind} PRs: ${baseQuery}`);
|
|
523
|
+
const prs = [];
|
|
524
|
+
const seen = new Set();
|
|
525
|
+
let query = baseQuery;
|
|
526
|
+
let cursor;
|
|
527
|
+
for (;;) {
|
|
528
|
+
const page = await fetchSearchWindow(octokit, query, maxResults);
|
|
529
|
+
const next = page.items.at(-1)?.created_at ?? undefined;
|
|
530
|
+
if (page.totalCount > maxResults || isWalkStuck(page, cursor, next)) {
|
|
531
|
+
warn(MODULE, `Not storing ${adapter.kind} PRs: the search matched ${page.totalCount}, more than one run fetches.`);
|
|
532
|
+
return { prs: [], truncated: true };
|
|
365
533
|
}
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
534
|
+
for (const item of page.items) {
|
|
535
|
+
const record = toStoredRecord(item, config, adapter);
|
|
536
|
+
if (record && !seen.has(record.url))
|
|
537
|
+
prs.push(record);
|
|
538
|
+
seen.add(item.html_url);
|
|
369
539
|
}
|
|
370
|
-
page
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
540
|
+
if (page.isExhausted)
|
|
541
|
+
break;
|
|
542
|
+
cursor = next;
|
|
543
|
+
query = `${baseQuery} created:>=${cursor}`;
|
|
374
544
|
}
|
|
375
|
-
debug(MODULE, `Fetched ${
|
|
376
|
-
return
|
|
545
|
+
debug(MODULE, `Fetched ${prs.length} ${adapter.kind} PRs`);
|
|
546
|
+
return { prs, truncated: false };
|
|
377
547
|
}
|
|
548
|
+
const MERGED_ADAPTER = {
|
|
549
|
+
kind: 'merged',
|
|
550
|
+
dateNoun: 'merge',
|
|
551
|
+
// Bounded on `updated`, not `merged`: GitHub can index a PR for `updated:`
|
|
552
|
+
// while its merge-date facet is missing (see fetchRecentPRs), and such a PR
|
|
553
|
+
// would never match `merged:>`. Every PR merged after a date was also
|
|
554
|
+
// updated after it, so this is a superset; re-seen rows dedupe on write.
|
|
555
|
+
buildQuery: (scope, s) => `is:pr is:merged ${scope}` + (s ? ` updated:>${s}` : ''),
|
|
556
|
+
extractDate: (item) => item.pull_request?.merged_at || item.closed_at || '',
|
|
557
|
+
buildRecord: (item, date) => ({
|
|
558
|
+
url: item.html_url,
|
|
559
|
+
title: item.title,
|
|
560
|
+
mergedAt: date,
|
|
561
|
+
// Free on the search result — feeds the outcome ledger (#1461).
|
|
562
|
+
openedAt: item.created_at || undefined,
|
|
563
|
+
issueUrl: closingIssueUrl(item.body, item.html_url),
|
|
564
|
+
}),
|
|
565
|
+
};
|
|
378
566
|
/**
|
|
379
|
-
*
|
|
380
|
-
*
|
|
381
|
-
*
|
|
567
|
+
* The one fetch that fills the merged-PR ledger (#1924), shared by the daily
|
|
568
|
+
* run, the dashboard and `ledger-backfill`: every merged PR updated since
|
|
569
|
+
* `watermark` (the ledger's newest `mergedAt`) minus a one-day overlap, or
|
|
570
|
+
* all of them when there is no watermark.
|
|
571
|
+
*
|
|
572
|
+
* `truncated` (more than `maxResults` matches) returns no rows. Callers must
|
|
573
|
+
* then add nothing newer to the ledger, so its watermark does not move past
|
|
574
|
+
* the range that was not fetched. `ledger-backfill` passes `Infinity`.
|
|
382
575
|
*/
|
|
383
|
-
export async function fetchMergedPRsSince(octokit, config,
|
|
384
|
-
return fetchPRsSince(octokit, config,
|
|
385
|
-
kind: 'merged',
|
|
386
|
-
dateNoun: 'merge',
|
|
387
|
-
buildQuery: (u, s) => `is:pr is:merged author:${u} -user:${u}${s ? ` merged:>${s}` : ''}`,
|
|
388
|
-
extractDate: (item) => item.pull_request?.merged_at || item.closed_at || '',
|
|
389
|
-
buildRecord: (item, date) => ({
|
|
390
|
-
url: item.html_url,
|
|
391
|
-
title: item.title,
|
|
392
|
-
mergedAt: date,
|
|
393
|
-
// Free on the search result — feeds the outcome ledger (#1461).
|
|
394
|
-
openedAt: item.created_at || undefined,
|
|
395
|
-
issueUrl: closingIssueUrl(item.body, item.html_url),
|
|
396
|
-
}),
|
|
397
|
-
}, since);
|
|
576
|
+
export async function fetchMergedPRsSince(octokit, config, watermark, maxResults = LEDGER_GAP_MAX_RESULTS) {
|
|
577
|
+
return fetchPRsSince(octokit, config, MERGED_ADAPTER, withLedgerOverlap(watermark), maxResults);
|
|
398
578
|
}
|
|
579
|
+
const CLOSED_ADAPTER = {
|
|
580
|
+
kind: 'closed',
|
|
581
|
+
dateNoun: 'close',
|
|
582
|
+
// `is:unmerged` leaves out merged PRs, which GitHub also counts as closed.
|
|
583
|
+
// Bounded on `updated` for the same reason as MERGED_ADAPTER: the close-date
|
|
584
|
+
// facet can be missing from the index (see fetchRecentPRs).
|
|
585
|
+
buildQuery: (scope, s) => `is:pr is:closed is:unmerged ${scope}` + (s ? ` updated:>${s}` : ''),
|
|
586
|
+
extractDate: (item) => item.closed_at || '',
|
|
587
|
+
buildRecord: (item, date) => ({
|
|
588
|
+
url: item.html_url,
|
|
589
|
+
title: item.title,
|
|
590
|
+
closedAt: date,
|
|
591
|
+
// Free on the search result — feeds the outcome ledger (#1461).
|
|
592
|
+
openedAt: item.created_at || undefined,
|
|
593
|
+
issueUrl: closingIssueUrl(item.body, item.html_url),
|
|
594
|
+
}),
|
|
595
|
+
};
|
|
399
596
|
/**
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
597
|
+
* The closed-without-merge mirror of {@link fetchMergedPRsSince} (#1925),
|
|
598
|
+
* shared by the daily run, the dashboard and `ledger-backfill`: every closed
|
|
599
|
+
* PR updated since `watermark` (the ledger's newest `closedAt`) minus a
|
|
600
|
+
* one-day overlap, or all of them when there is no watermark. Same
|
|
601
|
+
* `truncated` contract: no rows, so the watermark does not move.
|
|
404
602
|
*/
|
|
405
|
-
export async function fetchClosedPRsSince(octokit, config,
|
|
406
|
-
return fetchPRsSince(octokit, config,
|
|
407
|
-
kind: 'closed',
|
|
408
|
-
dateNoun: 'close',
|
|
409
|
-
buildQuery: (u, s) => `is:pr is:closed is:unmerged author:${u} -user:${u}${s ? ` closed:>${s}` : ''}`,
|
|
410
|
-
extractDate: (item) => item.closed_at || '',
|
|
411
|
-
buildRecord: (item, date) => ({
|
|
412
|
-
url: item.html_url,
|
|
413
|
-
title: item.title,
|
|
414
|
-
closedAt: date,
|
|
415
|
-
// Free on the search result — feeds the outcome ledger (#1461).
|
|
416
|
-
openedAt: item.created_at || undefined,
|
|
417
|
-
issueUrl: closingIssueUrl(item.body, item.html_url),
|
|
418
|
-
}),
|
|
419
|
-
}, since);
|
|
603
|
+
export async function fetchClosedPRsSince(octokit, config, watermark, maxResults = LEDGER_GAP_MAX_RESULTS) {
|
|
604
|
+
return fetchPRsSince(octokit, config, CLOSED_ADAPTER, withLedgerOverlap(watermark), maxResults);
|
|
420
605
|
}
|
|
@@ -106,13 +106,3 @@ export declare function cachedRequest<T>(cache: HttpCache, url: string, fetcher:
|
|
|
106
106
|
data: T;
|
|
107
107
|
headers?: Record<string, string>;
|
|
108
108
|
}>): Promise<T>;
|
|
109
|
-
/**
|
|
110
|
-
* Time-based cache wrapper (no ETag / conditional requests).
|
|
111
|
-
*
|
|
112
|
-
* If a cached result exists and is younger than `maxAgeMs`, returns it.
|
|
113
|
-
* Otherwise calls `fetcher`, caches the result, and returns it.
|
|
114
|
-
*
|
|
115
|
-
* Use this for expensive operations whose results change slowly
|
|
116
|
-
* (e.g. search queries, project health checks).
|
|
117
|
-
*/
|
|
118
|
-
export declare function cachedTimeBased<T>(cache: HttpCache, key: string, maxAgeMs: number, fetcher: () => Promise<T>): Promise<T>;
|
package/dist/core/http-cache.js
CHANGED
|
@@ -334,25 +334,6 @@ export async function cachedRequest(cache, url, fetcher) {
|
|
|
334
334
|
cleanup();
|
|
335
335
|
}
|
|
336
336
|
}
|
|
337
|
-
/**
|
|
338
|
-
* Time-based cache wrapper (no ETag / conditional requests).
|
|
339
|
-
*
|
|
340
|
-
* If a cached result exists and is younger than `maxAgeMs`, returns it.
|
|
341
|
-
* Otherwise calls `fetcher`, caches the result, and returns it.
|
|
342
|
-
*
|
|
343
|
-
* Use this for expensive operations whose results change slowly
|
|
344
|
-
* (e.g. search queries, project health checks).
|
|
345
|
-
*/
|
|
346
|
-
export async function cachedTimeBased(cache, key, maxAgeMs, fetcher) {
|
|
347
|
-
const cached = cache.getIfFresh(key, maxAgeMs);
|
|
348
|
-
if (cached) {
|
|
349
|
-
debug(MODULE, `Time-based cache hit for ${key}`);
|
|
350
|
-
return cached;
|
|
351
|
-
}
|
|
352
|
-
const result = await fetcher();
|
|
353
|
-
cache.set(key, '', result);
|
|
354
|
-
return result;
|
|
355
|
-
}
|
|
356
337
|
/**
|
|
357
338
|
* Detect whether an error is a 304 Not Modified response.
|
|
358
339
|
* Octokit throws a RequestError with status 304 for conditional requests.
|
package/dist/core/index.d.ts
CHANGED
|
@@ -2,24 +2,26 @@
|
|
|
2
2
|
* Core module exports
|
|
3
3
|
* Re-exports all core functionality for convenient imports
|
|
4
4
|
*/
|
|
5
|
-
export { StateManager, getStateManager, getStateManagerAsync, ensureGistPersistence, bootstrapGistBestEffort, type GistPersistenceStatus, maybeCheckpoint, resetStateManager, type Stats, type ReleaseIssueResult, } from './state.js';
|
|
6
|
-
export { renderGistWarning, type GistHealth, type GistHealthDegradedCause, type GistWarningCause, } from './gist-health.js';
|
|
5
|
+
export { StateManager, getStateManager, getStateManagerAsync, ensureGistPersistence, bootstrapGistBestEffort, unknownPersistenceModeWarning, type GistPersistenceStatus, maybeCheckpoint, resetStateManager, type Stats, type ReleaseIssueResult, } from './state.js';
|
|
6
|
+
export { renderGistWarning, renderUnknownModeWarning, type GistHealth, type GistHealthDegradedCause, type GistWarningCause, } from './gist-health.js';
|
|
7
7
|
export { GistStateStore } from './gist-state-store.js';
|
|
8
8
|
export { guidelinesFilename, repoFromGuidelinesFilename, GUIDELINES_FILE_PREFIX, GUIDELINES_MAX_BYTES, GuidelinesNotAvailableError, GuidelinesTooLargeError, } from './guidelines-store.js';
|
|
9
9
|
export { PRMonitor, type PRCheckFailure, type FetchPRsResult, computeDisplayLabel, classifyCICheck, classifyFailingChecks, } from './pr-monitor.js';
|
|
10
10
|
export { IssueConversationMonitor, MAX_DIRECT_ENGAGED_FETCHES, type FetchCommentedIssuesOptions, type FetchCommentedIssuesResult, } from './issue-conversation.js';
|
|
11
11
|
export { isBotAuthor, isAcknowledgmentComment, isReactionOnlyComment, isQuoteReplyTo, isStatusNudge, } from './comment-utils.js';
|
|
12
|
-
export { wrapUntrustedContent, fenceFetchedPR, fenceFetchedPRTitles, labelGuidelinesContent, GUIDELINES_PROVENANCE_NOTE, extractFromFence, safeExtractFromFence, UNTRUSTED_OPEN_TAG_NAME, UNTRUSTED_CLOSE_TAG, type UntrustedContentMeta, } from './untrusted-content.js';
|
|
12
|
+
export { wrapUntrustedContent, fenceFetchedPR, fenceFetchedPRTitles, fenceTitlesDeep, labelGuidelinesContent, GUIDELINES_PROVENANCE_NOTE, extractFromFence, safeExtractFromFence, UNTRUSTED_OPEN_TAG_NAME, UNTRUSTED_CLOSE_TAG, type UntrustedContentMeta, } from './untrusted-content.js';
|
|
13
13
|
export { getOctokit, checkRateLimit, type RateLimitInfo } from './github.js';
|
|
14
14
|
export { parseGitHubUrl, issueRefKey, splitRepo, isOwnRepo } from './urls.js';
|
|
15
15
|
export { daysBetween, formatRelativeTime, byDateDescending } from './dates.js';
|
|
16
16
|
export { getCLIVersion, getDataDir, resolveDataDir, getStatePath, getBackupDir, getCacheDir, stateFileExists, } from './paths.js';
|
|
17
17
|
export { getGitHubToken, getGitHubTokenAsync, requireGitHubToken, resetGitHubTokenCache, detectGitHubUsername, } from './auth.js';
|
|
18
18
|
export { DEFAULT_CONCURRENCY } from './concurrency.js';
|
|
19
|
-
export { OssAutopilotError, ConfigurationError, ValidationError, GistPermissionError, ConcurrencyError, GistConcurrencyError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, errorMessage, getHttpStatusCode, isRateLimitError, isRateLimitOrAuthError, nonFatalCatch, resolveErrorCode, } from './errors.js';
|
|
19
|
+
export { OssAutopilotError, ConfigurationError, ValidationError, GistPermissionError, ConcurrencyError, StateLockTimeoutError, NewerStateVersionError, GistConcurrencyError, GistDiscoveryError, GistFileSizeError, GIST_FILE_SIZE_REMEDY, assertAttended, errorMessage, getHttpStatusCode, isRateLimitError, isRateLimitOrAuthError, nonFatalCatch, resolveErrorCode, } from './errors.js';
|
|
20
20
|
export { enableDebug, isDebugEnabled, debug, info, warn, timed } from './logger.js';
|
|
21
21
|
export { HttpCache, getHttpCache, cachedRequest, type CacheEntry } from './http-cache.js';
|
|
22
|
-
export { CRITICAL_STATUSES, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, isCoveredByDismiss, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest,
|
|
22
|
+
export { CRITICAL_STATUSES, shouldAutoUnshelve, shelveReasonsOf, withoutShelvedNeedsAddressing, applyStatusOverrides, computeRepoSignals, computeLedgerRepoSignals, groupPRsByRepo, assessCapacity, collectActionableIssues, computeActionMenu, isCoveredByDismiss, toShelvedPRRef, buildStarFilter, firstMaintainerResponseFromDigest, lastReviewStateFromDigest, } from './daily-logic.js';
|
|
23
|
+
/** @deprecated Since #1948; will be removed in the next major version. */
|
|
24
|
+
export { formatActionHint, formatBriefSummary, formatSummary, printDigest } from '../commands/daily-render.js';
|
|
23
25
|
export { collectEngagedIssues, toIssueEngagement, LEDGER_LINK_MAX_AGE_DAYS, type CollectEngagedIssuesOptions, type EngagedIssue, type EngagedIssuesInput, type EngagedPRLink, } from './engaged-issues.js';
|
|
24
26
|
export { computeContributionStats, type ContributionStats, type ComputeStatsInput } from './stats.js';
|
|
25
27
|
export { selectClosedPRStatusCandidates, toClosedPRStatusUpdate, CLOSED_PR_STATUS_WINDOW_DAYS, type ClosedPRStatusUpdate, type ClosedPRStatusCandidate, type IssueLinkedPR, } from './closed-pr-status.js';
|
|
@@ -31,6 +33,11 @@ export { classifyLinkedPR, isLinkedPRStalled, STALLED_PR_THRESHOLD_DAYS, type Li
|
|
|
31
33
|
export { classifyIssueAvailability, fetchIssueVerification, verifyIssuesBatch, MAX_VERIFY_CONCURRENCY, RULED_OUT_VERDICTS, type BatchVerificationResult, type IssueAvailabilityVerdict, type IssueVerification, type LinkedPRLinkType, type VerifiedLinkedPR, type VerifyIssueParams, } from './issue-verification.js';
|
|
32
34
|
export { classifyAttentionBucket, summarizeAttentionBuckets, shouldSuggestClose, STUCK_CI_THRESHOLD_DAYS, DORMANT_FOLLOWUP_THRESHOLD_DAYS, type AttentionBucket, type AttentionInput, type AttentionSummary, } from './pr-attention.js';
|
|
33
35
|
export { scanForAntiLLMPolicy, type AntiLLMCategory, type AntiLLMMatch, type AntiLLMScanResult, } from './anti-llm-policy.js';
|
|
36
|
+
/**
|
|
37
|
+
* Formatter detection behind the deprecated detect-formatters command.
|
|
38
|
+
*
|
|
39
|
+
* @deprecated Since #1948; will be removed in the next major version.
|
|
40
|
+
*/
|
|
34
41
|
export { detectFormatters, diagnoseCIFormatterFailure, getPreferredFormatter, type DetectedFormatter, type FormatterDetectionResult, type CIFormatterDiagnosis, type FormatterName, } from './formatter-detection.js';
|
|
35
42
|
export { CONFIG_KEY_REGISTRY, type ConfigKeyDef, type SettableVia, isKnownKey, getKeyDef, getSetupKeys, getConfigKeys, suggestKey, formatUnknownKeyError, } from './config-registry.js';
|
|
36
43
|
export { DashboardDataSchema, DashboardStatsSchema, validateDashboardData, type DashboardDataParsed, } from './dashboard-data-schema.js';
|