@oss-autopilot/core 0.41.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/LICENSE +21 -0
- package/README.md +85 -0
- package/dist/cli.bundle.cjs +17657 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.js +325 -0
- package/dist/commands/check-integration.d.ts +10 -0
- package/dist/commands/check-integration.js +192 -0
- package/dist/commands/comments.d.ts +24 -0
- package/dist/commands/comments.js +311 -0
- package/dist/commands/config.d.ts +11 -0
- package/dist/commands/config.js +82 -0
- package/dist/commands/daily.d.ts +29 -0
- package/dist/commands/daily.js +433 -0
- package/dist/commands/dashboard-data.d.ts +45 -0
- package/dist/commands/dashboard-data.js +132 -0
- package/dist/commands/dashboard-templates.d.ts +23 -0
- package/dist/commands/dashboard-templates.js +1627 -0
- package/dist/commands/dashboard.d.ts +18 -0
- package/dist/commands/dashboard.js +134 -0
- package/dist/commands/dismiss.d.ts +13 -0
- package/dist/commands/dismiss.js +49 -0
- package/dist/commands/init.d.ts +10 -0
- package/dist/commands/init.js +27 -0
- package/dist/commands/local-repos.d.ts +14 -0
- package/dist/commands/local-repos.js +155 -0
- package/dist/commands/parse-list.d.ts +13 -0
- package/dist/commands/parse-list.js +139 -0
- package/dist/commands/read.d.ts +12 -0
- package/dist/commands/read.js +33 -0
- package/dist/commands/search.d.ts +10 -0
- package/dist/commands/search.js +74 -0
- package/dist/commands/setup.d.ts +15 -0
- package/dist/commands/setup.js +276 -0
- package/dist/commands/shelve.d.ts +13 -0
- package/dist/commands/shelve.js +49 -0
- package/dist/commands/snooze.d.ts +18 -0
- package/dist/commands/snooze.js +83 -0
- package/dist/commands/startup.d.ts +33 -0
- package/dist/commands/startup.js +197 -0
- package/dist/commands/status.d.ts +10 -0
- package/dist/commands/status.js +43 -0
- package/dist/commands/track.d.ts +16 -0
- package/dist/commands/track.js +59 -0
- package/dist/commands/validation.d.ts +43 -0
- package/dist/commands/validation.js +112 -0
- package/dist/commands/vet.d.ts +10 -0
- package/dist/commands/vet.js +36 -0
- package/dist/core/checklist-analysis.d.ts +17 -0
- package/dist/core/checklist-analysis.js +39 -0
- package/dist/core/ci-analysis.d.ts +78 -0
- package/dist/core/ci-analysis.js +163 -0
- package/dist/core/comment-utils.d.ts +15 -0
- package/dist/core/comment-utils.js +52 -0
- package/dist/core/concurrency.d.ts +5 -0
- package/dist/core/concurrency.js +15 -0
- package/dist/core/daily-logic.d.ts +77 -0
- package/dist/core/daily-logic.js +512 -0
- package/dist/core/display-utils.d.ts +10 -0
- package/dist/core/display-utils.js +100 -0
- package/dist/core/errors.d.ts +24 -0
- package/dist/core/errors.js +34 -0
- package/dist/core/github-stats.d.ts +73 -0
- package/dist/core/github-stats.js +272 -0
- package/dist/core/github.d.ts +19 -0
- package/dist/core/github.js +60 -0
- package/dist/core/http-cache.d.ts +97 -0
- package/dist/core/http-cache.js +269 -0
- package/dist/core/index.d.ts +15 -0
- package/dist/core/index.js +15 -0
- package/dist/core/issue-conversation.d.ts +29 -0
- package/dist/core/issue-conversation.js +231 -0
- package/dist/core/issue-discovery.d.ts +85 -0
- package/dist/core/issue-discovery.js +589 -0
- package/dist/core/issue-filtering.d.ts +51 -0
- package/dist/core/issue-filtering.js +103 -0
- package/dist/core/issue-scoring.d.ts +40 -0
- package/dist/core/issue-scoring.js +92 -0
- package/dist/core/issue-vetting.d.ts +49 -0
- package/dist/core/issue-vetting.js +536 -0
- package/dist/core/logger.d.ts +21 -0
- package/dist/core/logger.js +49 -0
- package/dist/core/maintainer-analysis.d.ts +10 -0
- package/dist/core/maintainer-analysis.js +59 -0
- package/dist/core/pagination.d.ts +11 -0
- package/dist/core/pagination.js +20 -0
- package/dist/core/pr-monitor.d.ts +109 -0
- package/dist/core/pr-monitor.js +594 -0
- package/dist/core/review-analysis.d.ts +72 -0
- package/dist/core/review-analysis.js +163 -0
- package/dist/core/state.d.ts +371 -0
- package/dist/core/state.js +1089 -0
- package/dist/core/types.d.ts +507 -0
- package/dist/core/types.js +34 -0
- package/dist/core/utils.d.ts +249 -0
- package/dist/core/utils.js +422 -0
- package/dist/formatters/json.d.ts +269 -0
- package/dist/formatters/json.js +88 -0
- package/package.json +67 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-paginate an Octokit list endpoint. Fetches additional pages when
|
|
3
|
+
* the result count equals per_page (indicating more data may exist).
|
|
4
|
+
*
|
|
5
|
+
* @param fetchPage Function that fetches a single page given a page number
|
|
6
|
+
* @param perPage Items per page (default 100)
|
|
7
|
+
* @param maxPages Maximum pages to fetch (default 10 = 1000 items)
|
|
8
|
+
*/
|
|
9
|
+
export declare function paginateAll<T>(fetchPage: (page: number) => Promise<{
|
|
10
|
+
data: T[];
|
|
11
|
+
}>, perPage?: number, maxPages?: number): Promise<T[]>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Maximum pages to fetch to prevent runaway pagination */
|
|
2
|
+
const MAX_PAGES = 10;
|
|
3
|
+
/**
|
|
4
|
+
* Auto-paginate an Octokit list endpoint. Fetches additional pages when
|
|
5
|
+
* the result count equals per_page (indicating more data may exist).
|
|
6
|
+
*
|
|
7
|
+
* @param fetchPage Function that fetches a single page given a page number
|
|
8
|
+
* @param perPage Items per page (default 100)
|
|
9
|
+
* @param maxPages Maximum pages to fetch (default 10 = 1000 items)
|
|
10
|
+
*/
|
|
11
|
+
export async function paginateAll(fetchPage, perPage = 100, maxPages = MAX_PAGES) {
|
|
12
|
+
const allItems = [];
|
|
13
|
+
for (let page = 1; page <= maxPages; page++) {
|
|
14
|
+
const { data } = await fetchPage(page);
|
|
15
|
+
allItems.push(...data);
|
|
16
|
+
if (data.length < perPage)
|
|
17
|
+
break; // No more pages
|
|
18
|
+
}
|
|
19
|
+
return allItems;
|
|
20
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PR Monitor - Fetches and checks PR status from GitHub.
|
|
3
|
+
* v2: fetchUserOpenPRs() is stateless (no local PR tracking),
|
|
4
|
+
* Score methods still write to state.
|
|
5
|
+
*
|
|
6
|
+
* Decomposed into focused modules (#263):
|
|
7
|
+
* - ci-analysis.ts: CI check classification and analysis
|
|
8
|
+
* - review-analysis.ts: Review decision and comment detection
|
|
9
|
+
* - checklist-analysis.ts: PR body checklist analysis
|
|
10
|
+
* - maintainer-analysis.ts: Maintainer action hint extraction
|
|
11
|
+
* - display-utils.ts: Display label computation
|
|
12
|
+
* - github-stats.ts: Merged/closed PR counts and star fetching
|
|
13
|
+
*/
|
|
14
|
+
import { FetchedPR, DailyDigest, ClosedPR, MergedPR } from './types.js';
|
|
15
|
+
export { computeDisplayLabel } from './display-utils.js';
|
|
16
|
+
export { classifyCICheck, classifyFailingChecks } from './ci-analysis.js';
|
|
17
|
+
export { isConditionalChecklistItem } from './checklist-analysis.js';
|
|
18
|
+
export interface PRCheckFailure {
|
|
19
|
+
prUrl: string;
|
|
20
|
+
error: string;
|
|
21
|
+
}
|
|
22
|
+
export interface FetchPRsResult {
|
|
23
|
+
prs: FetchedPR[];
|
|
24
|
+
failures: PRCheckFailure[];
|
|
25
|
+
}
|
|
26
|
+
export declare class PRMonitor {
|
|
27
|
+
private octokit;
|
|
28
|
+
private stateManager;
|
|
29
|
+
constructor(githubToken: string);
|
|
30
|
+
/**
|
|
31
|
+
* Fetch all open PRs for the configured user fresh from GitHub
|
|
32
|
+
* This is the main entry point for the v2 architecture
|
|
33
|
+
*/
|
|
34
|
+
fetchUserOpenPRs(): Promise<FetchPRsResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Fetch detailed information for a single PR
|
|
37
|
+
*/
|
|
38
|
+
private fetchPRDetails;
|
|
39
|
+
/**
|
|
40
|
+
* Build a FetchedPR object from computed fields and attach display labels.
|
|
41
|
+
* Centralizes PR construction and display label computation (#79).
|
|
42
|
+
*/
|
|
43
|
+
private buildFetchedPR;
|
|
44
|
+
/**
|
|
45
|
+
* Determine the overall status of a PR
|
|
46
|
+
*/
|
|
47
|
+
private determineStatus;
|
|
48
|
+
/**
|
|
49
|
+
* Check if PR has merge conflict
|
|
50
|
+
*/
|
|
51
|
+
private hasMergeConflict;
|
|
52
|
+
/**
|
|
53
|
+
* Get CI status from combined status API and check runs.
|
|
54
|
+
* Returns status and names of failing checks for diagnostics.
|
|
55
|
+
* Delegates analysis to ci-analysis module.
|
|
56
|
+
*/
|
|
57
|
+
private getCIStatus;
|
|
58
|
+
/**
|
|
59
|
+
* Fetch merged PR counts and latest merge dates per repository for the configured user.
|
|
60
|
+
* Delegates to github-stats module.
|
|
61
|
+
*/
|
|
62
|
+
fetchUserMergedPRCounts(): Promise<{
|
|
63
|
+
repos: Map<string, {
|
|
64
|
+
count: number;
|
|
65
|
+
lastMergedAt: string;
|
|
66
|
+
}>;
|
|
67
|
+
monthlyCounts: Record<string, number>;
|
|
68
|
+
monthlyOpenedCounts: Record<string, number>;
|
|
69
|
+
dailyActivityCounts: Record<string, number>;
|
|
70
|
+
}>;
|
|
71
|
+
/**
|
|
72
|
+
* Fetch closed-without-merge PR counts per repository for the configured user.
|
|
73
|
+
* Delegates to github-stats module.
|
|
74
|
+
*/
|
|
75
|
+
fetchUserClosedPRCounts(): Promise<{
|
|
76
|
+
repos: Map<string, number>;
|
|
77
|
+
monthlyCounts: Record<string, number>;
|
|
78
|
+
monthlyOpenedCounts: Record<string, number>;
|
|
79
|
+
dailyActivityCounts: Record<string, number>;
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* Fetch GitHub star counts for a list of repositories.
|
|
83
|
+
* Delegates to github-stats module.
|
|
84
|
+
*/
|
|
85
|
+
fetchRepoStarCounts(repos: string[]): Promise<Map<string, number>>;
|
|
86
|
+
/**
|
|
87
|
+
* Shared helper: search for recent PRs and filter out own repos, excluded repos/orgs.
|
|
88
|
+
* Returns parsed search results that pass all filters.
|
|
89
|
+
*/
|
|
90
|
+
private fetchRecentPRs;
|
|
91
|
+
/**
|
|
92
|
+
* Fetch PRs closed without merge in the last N days.
|
|
93
|
+
* Delegates to github-stats module.
|
|
94
|
+
*/
|
|
95
|
+
fetchRecentlyClosedPRs(days?: number): Promise<ClosedPR[]>;
|
|
96
|
+
/**
|
|
97
|
+
* Fetch PRs merged in the last N days.
|
|
98
|
+
* Delegates to github-stats module.
|
|
99
|
+
*/
|
|
100
|
+
fetchRecentlyMergedPRs(days?: number): Promise<MergedPR[]>;
|
|
101
|
+
/**
|
|
102
|
+
* Generate a daily digest from fetched PRs
|
|
103
|
+
*/
|
|
104
|
+
generateDigest(prs: FetchedPR[], recentlyClosedPRs?: ClosedPR[], recentlyMergedPRs?: MergedPR[]): DailyDigest;
|
|
105
|
+
/**
|
|
106
|
+
* Update repository scores based on observed PR (called when we detect merged/closed PRs)
|
|
107
|
+
*/
|
|
108
|
+
updateRepoScoreFromObservedPR(repo: string, wasMerged: boolean): Promise<void>;
|
|
109
|
+
}
|