@oss-autopilot/core 0.58.0 → 0.59.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-registry.js +54 -0
- package/dist/cli.bundle.cjs +49 -45
- package/dist/commands/comments.d.ts +28 -0
- package/dist/commands/comments.js +28 -0
- package/dist/commands/config.d.ts +11 -0
- package/dist/commands/config.js +11 -0
- package/dist/commands/daily.d.ts +26 -2
- package/dist/commands/daily.js +26 -2
- package/dist/commands/detect-formatters.d.ts +11 -0
- package/dist/commands/detect-formatters.js +24 -0
- package/dist/commands/dismiss.d.ts +17 -0
- package/dist/commands/dismiss.js +17 -0
- package/dist/commands/index.d.ts +3 -1
- package/dist/commands/index.js +2 -0
- package/dist/commands/init.d.ts +8 -0
- package/dist/commands/init.js +8 -0
- package/dist/commands/move.d.ts +10 -0
- package/dist/commands/move.js +10 -0
- package/dist/commands/search.d.ts +18 -0
- package/dist/commands/search.js +18 -0
- package/dist/commands/setup.d.ts +17 -0
- package/dist/commands/setup.js +17 -0
- package/dist/commands/shelve.d.ts +16 -0
- package/dist/commands/shelve.js +16 -0
- package/dist/commands/startup.d.ts +16 -7
- package/dist/commands/startup.js +16 -7
- package/dist/commands/status.d.ts +8 -0
- package/dist/commands/status.js +8 -0
- package/dist/commands/track.d.ts +16 -0
- package/dist/commands/track.js +16 -0
- package/dist/commands/vet.d.ts +8 -0
- package/dist/commands/vet.js +8 -0
- package/dist/core/daily-logic.d.ts +60 -7
- package/dist/core/daily-logic.js +52 -7
- package/dist/core/formatter-detection.d.ts +61 -0
- package/dist/core/formatter-detection.js +360 -0
- package/dist/core/github.d.ts +25 -2
- package/dist/core/github.js +25 -2
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/issue-discovery.d.ts +46 -6
- package/dist/core/issue-discovery.js +46 -6
- package/dist/core/logger.d.ts +13 -0
- package/dist/core/logger.js +13 -0
- package/dist/core/pr-monitor.d.ts +43 -8
- package/dist/core/pr-monitor.js +43 -8
- package/dist/core/state.d.ts +167 -0
- package/dist/core/state.js +167 -0
- package/dist/core/types.d.ts +2 -8
- package/dist/formatters/json.d.ts +5 -0
- package/package.json +6 -3
package/dist/core/logger.d.ts
CHANGED
|
@@ -9,18 +9,31 @@ export declare function enableDebug(): void;
|
|
|
9
9
|
export declare function isDebugEnabled(): boolean;
|
|
10
10
|
/**
|
|
11
11
|
* Log a debug message. Only outputs when --debug is enabled.
|
|
12
|
+
* @param module - Module name for log prefix
|
|
13
|
+
* @param message - Log message
|
|
14
|
+
* @param args - Additional values to log
|
|
12
15
|
*/
|
|
13
16
|
export declare function debug(module: string, message: string, ...args: unknown[]): void;
|
|
14
17
|
/**
|
|
15
18
|
* Log an informational message. Always outputs to stderr.
|
|
16
19
|
* Use for user-facing progress indicators during long-running operations.
|
|
20
|
+
* @param module - Module name for log prefix
|
|
21
|
+
* @param message - Log message
|
|
22
|
+
* @param args - Additional values to log
|
|
17
23
|
*/
|
|
18
24
|
export declare function info(module: string, message: string, ...args: unknown[]): void;
|
|
19
25
|
/**
|
|
20
26
|
* Log a warning. Always outputs.
|
|
27
|
+
* @param module - Module name for log prefix
|
|
28
|
+
* @param message - Warning message
|
|
29
|
+
* @param args - Additional values to log
|
|
21
30
|
*/
|
|
22
31
|
export declare function warn(module: string, message: string, ...args: unknown[]): void;
|
|
23
32
|
/**
|
|
24
33
|
* Time an async operation and log duration in debug mode.
|
|
34
|
+
* @param module - Module name for log prefix
|
|
35
|
+
* @param label - Operation label for the timing log
|
|
36
|
+
* @param fn - Async function to time
|
|
37
|
+
* @returns The result of the async function
|
|
25
38
|
*/
|
|
26
39
|
export declare function timed<T>(module: string, label: string, fn: () => Promise<T>): Promise<T>;
|
package/dist/core/logger.js
CHANGED
|
@@ -14,6 +14,9 @@ export function isDebugEnabled() {
|
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Log a debug message. Only outputs when --debug is enabled.
|
|
17
|
+
* @param module - Module name for log prefix
|
|
18
|
+
* @param message - Log message
|
|
19
|
+
* @param args - Additional values to log
|
|
17
20
|
*/
|
|
18
21
|
export function debug(module, message, ...args) {
|
|
19
22
|
if (!debugEnabled)
|
|
@@ -24,6 +27,9 @@ export function debug(module, message, ...args) {
|
|
|
24
27
|
/**
|
|
25
28
|
* Log an informational message. Always outputs to stderr.
|
|
26
29
|
* Use for user-facing progress indicators during long-running operations.
|
|
30
|
+
* @param module - Module name for log prefix
|
|
31
|
+
* @param message - Log message
|
|
32
|
+
* @param args - Additional values to log
|
|
27
33
|
*/
|
|
28
34
|
export function info(module, message, ...args) {
|
|
29
35
|
const timestamp = new Date().toISOString();
|
|
@@ -31,6 +37,9 @@ export function info(module, message, ...args) {
|
|
|
31
37
|
}
|
|
32
38
|
/**
|
|
33
39
|
* Log a warning. Always outputs.
|
|
40
|
+
* @param module - Module name for log prefix
|
|
41
|
+
* @param message - Warning message
|
|
42
|
+
* @param args - Additional values to log
|
|
34
43
|
*/
|
|
35
44
|
export function warn(module, message, ...args) {
|
|
36
45
|
const timestamp = new Date().toISOString();
|
|
@@ -38,6 +47,10 @@ export function warn(module, message, ...args) {
|
|
|
38
47
|
}
|
|
39
48
|
/**
|
|
40
49
|
* Time an async operation and log duration in debug mode.
|
|
50
|
+
* @param module - Module name for log prefix
|
|
51
|
+
* @param label - Operation label for the timing log
|
|
52
|
+
* @param fn - Async function to time
|
|
53
|
+
* @returns The result of the async function
|
|
41
54
|
*/
|
|
42
55
|
export async function timed(module, label, fn) {
|
|
43
56
|
if (!debugEnabled)
|
|
@@ -21,6 +21,9 @@ export { determineStatus } from './status-determination.js';
|
|
|
21
21
|
/**
|
|
22
22
|
* Check if a PR has a merge conflict based on GitHub's mergeable flag and mergeable_state.
|
|
23
23
|
* Returns true when mergeable is explicitly false or the mergeable_state is 'dirty'.
|
|
24
|
+
*
|
|
25
|
+
* @param mergeable - GitHub's mergeable flag (null when not yet computed)
|
|
26
|
+
* @param mergeableState - GitHub's mergeable_state string
|
|
24
27
|
*/
|
|
25
28
|
export declare function hasMergeConflict(mergeable: boolean | null, mergeableState: string | null): boolean;
|
|
26
29
|
export interface PRCheckFailure {
|
|
@@ -31,13 +34,35 @@ export interface FetchPRsResult {
|
|
|
31
34
|
prs: FetchedPR[];
|
|
32
35
|
failures: PRCheckFailure[];
|
|
33
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Fetches and enriches open PRs from GitHub for the configured user.
|
|
39
|
+
*
|
|
40
|
+
* In v2, all PR data is fetched fresh on each run — no local PR tracking.
|
|
41
|
+
* CI status, reviews, merge conflicts, and maintainer comments are enriched
|
|
42
|
+
* for each PR to compute a {@link FetchedPRStatus}.
|
|
43
|
+
*/
|
|
34
44
|
export declare class PRMonitor {
|
|
35
45
|
private octokit;
|
|
36
46
|
private stateManager;
|
|
47
|
+
/**
|
|
48
|
+
* @param githubToken - GitHub personal access token or token from `gh auth token`
|
|
49
|
+
*/
|
|
37
50
|
constructor(githubToken: string);
|
|
38
51
|
/**
|
|
39
|
-
* Fetch all open PRs for the configured user fresh from GitHub
|
|
40
|
-
* This is the main entry point for the v2 architecture
|
|
52
|
+
* Fetch all open PRs for the configured user fresh from GitHub.
|
|
53
|
+
* This is the main entry point for the v2 architecture.
|
|
54
|
+
*
|
|
55
|
+
* @returns All open PRs enriched with status, plus any failures
|
|
56
|
+
* @throws {ConfigurationError} If no GitHub username is configured
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* import { PRMonitor, requireGitHubToken } from '@oss-autopilot/core';
|
|
61
|
+
*
|
|
62
|
+
* const monitor = new PRMonitor(requireGitHubToken());
|
|
63
|
+
* const { prs, failures } = await monitor.fetchUserOpenPRs();
|
|
64
|
+
* console.log(`Found ${prs.length} open PRs, ${failures.length} failures`);
|
|
65
|
+
* ```
|
|
41
66
|
*/
|
|
42
67
|
fetchUserOpenPRs(): Promise<FetchPRsResult>;
|
|
43
68
|
/**
|
|
@@ -51,7 +76,8 @@ export declare class PRMonitor {
|
|
|
51
76
|
private buildFetchedPR;
|
|
52
77
|
/**
|
|
53
78
|
* Fetch merged PR counts and latest merge dates per repository for the configured user.
|
|
54
|
-
*
|
|
79
|
+
* @param starFilter - Optional filter to exclude low-star repos
|
|
80
|
+
* @returns Per-repo merged counts with monthly breakdowns
|
|
55
81
|
*/
|
|
56
82
|
fetchUserMergedPRCounts(starFilter?: StarFilter): Promise<PRCountsResult<{
|
|
57
83
|
count: number;
|
|
@@ -59,7 +85,8 @@ export declare class PRMonitor {
|
|
|
59
85
|
}>>;
|
|
60
86
|
/**
|
|
61
87
|
* Fetch closed-without-merge PR counts per repository for the configured user.
|
|
62
|
-
*
|
|
88
|
+
* @param starFilter - Optional filter to exclude low-star repos
|
|
89
|
+
* @returns Per-repo closed counts with monthly breakdowns
|
|
63
90
|
*/
|
|
64
91
|
fetchUserClosedPRCounts(starFilter?: StarFilter): Promise<PRCountsResult<number>>;
|
|
65
92
|
/**
|
|
@@ -72,20 +99,28 @@ export declare class PRMonitor {
|
|
|
72
99
|
}>>;
|
|
73
100
|
/**
|
|
74
101
|
* Fetch PRs closed without merge in the last N days.
|
|
75
|
-
*
|
|
102
|
+
* @param days - Lookback window in days (default: 7)
|
|
103
|
+
* @returns Recently closed PRs
|
|
76
104
|
*/
|
|
77
105
|
fetchRecentlyClosedPRs(days?: number): Promise<ClosedPR[]>;
|
|
78
106
|
/**
|
|
79
107
|
* Fetch PRs merged in the last N days.
|
|
80
|
-
*
|
|
108
|
+
* @param days - Lookback window in days (default: 7)
|
|
109
|
+
* @returns Recently merged PRs
|
|
81
110
|
*/
|
|
82
111
|
fetchRecentlyMergedPRs(days?: number): Promise<MergedPR[]>;
|
|
83
112
|
/**
|
|
84
|
-
* Generate a daily digest from fetched PRs
|
|
113
|
+
* Generate a daily digest from fetched PRs.
|
|
114
|
+
* @param prs - All open PRs (active + shelved)
|
|
115
|
+
* @param recentlyClosedPRs - PRs closed without merge in the last 7 days
|
|
116
|
+
* @param recentlyMergedPRs - PRs merged in the last 7 days
|
|
117
|
+
* @returns Daily digest with categorized PRs and summary stats
|
|
85
118
|
*/
|
|
86
119
|
generateDigest(prs: FetchedPR[], recentlyClosedPRs?: ClosedPR[], recentlyMergedPRs?: MergedPR[]): DailyDigest;
|
|
87
120
|
/**
|
|
88
|
-
* Update repository scores based on observed PR (called when we detect merged/closed PRs)
|
|
121
|
+
* Update repository scores based on observed PR (called when we detect merged/closed PRs).
|
|
122
|
+
* @param repo - Repository in "owner/repo" format
|
|
123
|
+
* @param wasMerged - true if the PR was merged, false if closed without merge
|
|
89
124
|
*/
|
|
90
125
|
updateRepoScoreFromObservedPR(repo: string, wasMerged: boolean): Promise<void>;
|
|
91
126
|
}
|
package/dist/core/pr-monitor.js
CHANGED
|
@@ -35,22 +35,47 @@ export { determineStatus } from './status-determination.js';
|
|
|
35
35
|
/**
|
|
36
36
|
* Check if a PR has a merge conflict based on GitHub's mergeable flag and mergeable_state.
|
|
37
37
|
* Returns true when mergeable is explicitly false or the mergeable_state is 'dirty'.
|
|
38
|
+
*
|
|
39
|
+
* @param mergeable - GitHub's mergeable flag (null when not yet computed)
|
|
40
|
+
* @param mergeableState - GitHub's mergeable_state string
|
|
38
41
|
*/
|
|
39
42
|
export function hasMergeConflict(mergeable, mergeableState) {
|
|
40
43
|
return mergeable === false || mergeableState === 'dirty';
|
|
41
44
|
}
|
|
42
45
|
const MODULE = 'pr-monitor';
|
|
43
46
|
const MAX_CONCURRENT_REQUESTS = DEFAULT_CONCURRENCY;
|
|
47
|
+
/**
|
|
48
|
+
* Fetches and enriches open PRs from GitHub for the configured user.
|
|
49
|
+
*
|
|
50
|
+
* In v2, all PR data is fetched fresh on each run — no local PR tracking.
|
|
51
|
+
* CI status, reviews, merge conflicts, and maintainer comments are enriched
|
|
52
|
+
* for each PR to compute a {@link FetchedPRStatus}.
|
|
53
|
+
*/
|
|
44
54
|
export class PRMonitor {
|
|
45
55
|
octokit;
|
|
46
56
|
stateManager;
|
|
57
|
+
/**
|
|
58
|
+
* @param githubToken - GitHub personal access token or token from `gh auth token`
|
|
59
|
+
*/
|
|
47
60
|
constructor(githubToken) {
|
|
48
61
|
this.octokit = getOctokit(githubToken);
|
|
49
62
|
this.stateManager = getStateManager();
|
|
50
63
|
}
|
|
51
64
|
/**
|
|
52
|
-
* Fetch all open PRs for the configured user fresh from GitHub
|
|
53
|
-
* This is the main entry point for the v2 architecture
|
|
65
|
+
* Fetch all open PRs for the configured user fresh from GitHub.
|
|
66
|
+
* This is the main entry point for the v2 architecture.
|
|
67
|
+
*
|
|
68
|
+
* @returns All open PRs enriched with status, plus any failures
|
|
69
|
+
* @throws {ConfigurationError} If no GitHub username is configured
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```typescript
|
|
73
|
+
* import { PRMonitor, requireGitHubToken } from '@oss-autopilot/core';
|
|
74
|
+
*
|
|
75
|
+
* const monitor = new PRMonitor(requireGitHubToken());
|
|
76
|
+
* const { prs, failures } = await monitor.fetchUserOpenPRs();
|
|
77
|
+
* console.log(`Found ${prs.length} open PRs, ${failures.length} failures`);
|
|
78
|
+
* ```
|
|
54
79
|
*/
|
|
55
80
|
async fetchUserOpenPRs() {
|
|
56
81
|
const config = this.stateManager.getState().config;
|
|
@@ -287,7 +312,8 @@ export class PRMonitor {
|
|
|
287
312
|
}
|
|
288
313
|
/**
|
|
289
314
|
* Fetch merged PR counts and latest merge dates per repository for the configured user.
|
|
290
|
-
*
|
|
315
|
+
* @param starFilter - Optional filter to exclude low-star repos
|
|
316
|
+
* @returns Per-repo merged counts with monthly breakdowns
|
|
291
317
|
*/
|
|
292
318
|
async fetchUserMergedPRCounts(starFilter) {
|
|
293
319
|
const config = this.stateManager.getState().config;
|
|
@@ -295,7 +321,8 @@ export class PRMonitor {
|
|
|
295
321
|
}
|
|
296
322
|
/**
|
|
297
323
|
* Fetch closed-without-merge PR counts per repository for the configured user.
|
|
298
|
-
*
|
|
324
|
+
* @param starFilter - Optional filter to exclude low-star repos
|
|
325
|
+
* @returns Per-repo closed counts with monthly breakdowns
|
|
299
326
|
*/
|
|
300
327
|
async fetchUserClosedPRCounts(starFilter) {
|
|
301
328
|
const config = this.stateManager.getState().config;
|
|
@@ -357,7 +384,8 @@ export class PRMonitor {
|
|
|
357
384
|
}
|
|
358
385
|
/**
|
|
359
386
|
* Fetch PRs closed without merge in the last N days.
|
|
360
|
-
*
|
|
387
|
+
* @param days - Lookback window in days (default: 7)
|
|
388
|
+
* @returns Recently closed PRs
|
|
361
389
|
*/
|
|
362
390
|
async fetchRecentlyClosedPRs(days = 7) {
|
|
363
391
|
const config = this.stateManager.getState().config;
|
|
@@ -365,14 +393,19 @@ export class PRMonitor {
|
|
|
365
393
|
}
|
|
366
394
|
/**
|
|
367
395
|
* Fetch PRs merged in the last N days.
|
|
368
|
-
*
|
|
396
|
+
* @param days - Lookback window in days (default: 7)
|
|
397
|
+
* @returns Recently merged PRs
|
|
369
398
|
*/
|
|
370
399
|
async fetchRecentlyMergedPRs(days = 7) {
|
|
371
400
|
const config = this.stateManager.getState().config;
|
|
372
401
|
return fetchRecentlyMergedPRsImpl(this.octokit, config, days);
|
|
373
402
|
}
|
|
374
403
|
/**
|
|
375
|
-
* Generate a daily digest from fetched PRs
|
|
404
|
+
* Generate a daily digest from fetched PRs.
|
|
405
|
+
* @param prs - All open PRs (active + shelved)
|
|
406
|
+
* @param recentlyClosedPRs - PRs closed without merge in the last 7 days
|
|
407
|
+
* @param recentlyMergedPRs - PRs merged in the last 7 days
|
|
408
|
+
* @returns Daily digest with categorized PRs and summary stats
|
|
376
409
|
*/
|
|
377
410
|
generateDigest(prs, recentlyClosedPRs = [], recentlyMergedPRs = []) {
|
|
378
411
|
const now = new Date().toISOString();
|
|
@@ -399,7 +432,9 @@ export class PRMonitor {
|
|
|
399
432
|
};
|
|
400
433
|
}
|
|
401
434
|
/**
|
|
402
|
-
* Update repository scores based on observed PR (called when we detect merged/closed PRs)
|
|
435
|
+
* Update repository scores based on observed PR (called when we detect merged/closed PRs).
|
|
436
|
+
* @param repo - Repository in "owner/repo" format
|
|
437
|
+
* @param wasMerged - true if the PR was merged, false if closed without merge
|
|
403
438
|
*/
|
|
404
439
|
async updateRepoScoreFromObservedPR(repo, wasMerged) {
|
|
405
440
|
if (wasMerged) {
|
package/dist/core/state.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export declare class StateManager {
|
|
|
30
30
|
/**
|
|
31
31
|
* Execute multiple mutations as a single batch, deferring disk I/O until the
|
|
32
32
|
* batch completes. Nested `batch()` calls are flattened — only the outermost saves.
|
|
33
|
+
* @param fn - The function containing mutations to batch
|
|
33
34
|
*/
|
|
34
35
|
batch(fn: () => void): void;
|
|
35
36
|
/**
|
|
@@ -63,51 +64,217 @@ export declare class StateManager {
|
|
|
63
64
|
* Returns true if state was reloaded, false if unchanged or in-memory mode.
|
|
64
65
|
*/
|
|
65
66
|
reloadIfChanged(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Store the latest daily digest and update the digest timestamp.
|
|
69
|
+
* @param digest - The daily digest to store
|
|
70
|
+
*/
|
|
66
71
|
setLastDigest(digest: DailyDigest): void;
|
|
72
|
+
/**
|
|
73
|
+
* Update monthly merged PR counts for dashboard display.
|
|
74
|
+
* @param counts - Monthly merged PR counts keyed by YYYY-MM
|
|
75
|
+
*/
|
|
67
76
|
setMonthlyMergedCounts(counts: Record<string, number>): void;
|
|
77
|
+
/**
|
|
78
|
+
* Update monthly closed PR counts for dashboard display.
|
|
79
|
+
* @param counts - Monthly closed PR counts keyed by YYYY-MM
|
|
80
|
+
*/
|
|
68
81
|
setMonthlyClosedCounts(counts: Record<string, number>): void;
|
|
82
|
+
/**
|
|
83
|
+
* Update monthly opened PR counts for dashboard display.
|
|
84
|
+
* @param counts - Monthly opened PR counts keyed by YYYY-MM
|
|
85
|
+
*/
|
|
69
86
|
setMonthlyOpenedCounts(counts: Record<string, number>): void;
|
|
87
|
+
/**
|
|
88
|
+
* Update daily activity counts for dashboard display.
|
|
89
|
+
* @param counts - Daily activity counts keyed by YYYY-MM-DD
|
|
90
|
+
*/
|
|
70
91
|
setDailyActivityCounts(counts: Record<string, number>): void;
|
|
92
|
+
/**
|
|
93
|
+
* Update the local repository cache.
|
|
94
|
+
* @param cache - Local repository cache mapping repo names to paths
|
|
95
|
+
*/
|
|
71
96
|
setLocalRepoCache(cache: LocalRepoCache): void;
|
|
97
|
+
/** Returns all stored merged PRs (sorted by merge date descending via addMergedPRs). */
|
|
72
98
|
getMergedPRs(): StoredMergedPR[];
|
|
99
|
+
/**
|
|
100
|
+
* Add merged PRs to storage, deduplicating by URL.
|
|
101
|
+
* @param prs - Merged PRs to add (duplicates by URL are ignored)
|
|
102
|
+
*/
|
|
73
103
|
addMergedPRs(prs: StoredMergedPR[]): void;
|
|
104
|
+
/** Returns the most recent merge date, used as a watermark for incremental fetching. */
|
|
74
105
|
getMergedPRWatermark(): string | undefined;
|
|
106
|
+
/** Returns all stored closed-without-merge PRs (sorted by close date descending via addClosedPRs). */
|
|
75
107
|
getClosedPRs(): StoredClosedPR[];
|
|
108
|
+
/**
|
|
109
|
+
* Add closed PRs to storage, deduplicating by URL.
|
|
110
|
+
* @param prs - Closed PRs to add (duplicates by URL are ignored)
|
|
111
|
+
*/
|
|
76
112
|
addClosedPRs(prs: StoredClosedPR[]): void;
|
|
113
|
+
/** Returns the most recent close date, used as a watermark for incremental fetching. */
|
|
77
114
|
getClosedPRWatermark(): string | undefined;
|
|
115
|
+
/**
|
|
116
|
+
* Merge partial config updates into the current configuration.
|
|
117
|
+
* @param config - Partial config object to merge
|
|
118
|
+
*/
|
|
78
119
|
updateConfig(config: Partial<AgentState['config']>): void;
|
|
120
|
+
/**
|
|
121
|
+
* Append a new event to the event log and auto-persist.
|
|
122
|
+
* Events are capped at 1000 to prevent unbounded growth.
|
|
123
|
+
* @param type - The event type identifier
|
|
124
|
+
* @param data - Arbitrary event payload
|
|
125
|
+
*/
|
|
79
126
|
appendEvent(type: StateEventType, data: Record<string, unknown>): void;
|
|
127
|
+
/**
|
|
128
|
+
* Filter events by type.
|
|
129
|
+
* @param type - The event type to filter by
|
|
130
|
+
* @returns Events matching the given type
|
|
131
|
+
*/
|
|
80
132
|
getEventsByType(type: StateEventType): StateEvent[];
|
|
133
|
+
/**
|
|
134
|
+
* Filter events within a date range.
|
|
135
|
+
* @param since - Start of range (inclusive)
|
|
136
|
+
* @param until - End of range (inclusive), defaults to now
|
|
137
|
+
* @returns Events within the date range
|
|
138
|
+
*/
|
|
81
139
|
getEventsInRange(since: Date, until?: Date): StateEvent[];
|
|
140
|
+
/**
|
|
141
|
+
* Track a new issue. No-op if the issue URL is already tracked.
|
|
142
|
+
* @param issue - The issue to track
|
|
143
|
+
*/
|
|
82
144
|
addIssue(issue: TrackedIssue): void;
|
|
145
|
+
/**
|
|
146
|
+
* Add a repository to the trusted projects list. No-op if already trusted.
|
|
147
|
+
* @param repo - Repository in "owner/repo" format
|
|
148
|
+
*/
|
|
83
149
|
addTrustedProject(repo: string): void;
|
|
84
150
|
private static matchesExclusion;
|
|
151
|
+
/**
|
|
152
|
+
* Remove excluded repos/orgs from trusted projects.
|
|
153
|
+
* @param repos - Repository names to exclude
|
|
154
|
+
* @param orgs - Organization names to exclude
|
|
155
|
+
*/
|
|
85
156
|
cleanupExcludedData(repos: string[], orgs: string[]): void;
|
|
157
|
+
/** Returns cached starred repository names. */
|
|
86
158
|
getStarredRepos(): string[];
|
|
159
|
+
/**
|
|
160
|
+
* Update the cached starred repositories and timestamp.
|
|
161
|
+
* @param repos - Repository names in "owner/repo" format
|
|
162
|
+
*/
|
|
87
163
|
setStarredRepos(repos: string[]): void;
|
|
164
|
+
/** Returns true if starred repos cache is older than 24 hours. */
|
|
88
165
|
isStarredReposStale(): boolean;
|
|
166
|
+
/**
|
|
167
|
+
* Shelve a PR URL, hiding it from daily digest and capacity.
|
|
168
|
+
* @param url - The PR URL to shelve
|
|
169
|
+
* @returns true if newly shelved, false if already shelved
|
|
170
|
+
*/
|
|
89
171
|
shelvePR(url: string): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Unshelve a PR URL, restoring it to daily digest.
|
|
174
|
+
* @param url - The PR URL to unshelve
|
|
175
|
+
* @returns true if removed from shelf, false if not shelved
|
|
176
|
+
*/
|
|
90
177
|
unshelvePR(url: string): boolean;
|
|
178
|
+
/**
|
|
179
|
+
* Check if a PR is currently shelved.
|
|
180
|
+
* @param url - The PR URL to check
|
|
181
|
+
* @returns true if the PR is shelved
|
|
182
|
+
*/
|
|
91
183
|
isPRShelved(url: string): boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Dismiss an issue's notifications. Auto-resurfaces on new activity.
|
|
186
|
+
* @param url - The issue URL to dismiss
|
|
187
|
+
* @param timestamp - ISO timestamp of dismissal
|
|
188
|
+
* @returns true if newly dismissed, false if already dismissed
|
|
189
|
+
*/
|
|
92
190
|
dismissIssue(url: string, timestamp: string): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Restore a dismissed issue to notifications.
|
|
193
|
+
* @param url - The issue URL to undismiss
|
|
194
|
+
* @returns true if undismissed, false if not currently dismissed
|
|
195
|
+
*/
|
|
93
196
|
undismissIssue(url: string): boolean;
|
|
197
|
+
/**
|
|
198
|
+
* Get the timestamp when an issue was dismissed, or undefined if not dismissed.
|
|
199
|
+
* @param url - The issue URL to check
|
|
200
|
+
*/
|
|
94
201
|
getIssueDismissedAt(url: string): string | undefined;
|
|
202
|
+
/**
|
|
203
|
+
* Set a manual status override for a PR. Auto-clears when the PR has new activity.
|
|
204
|
+
* @param url - The PR URL
|
|
205
|
+
* @param status - The overridden status
|
|
206
|
+
* @param lastActivityAt - ISO timestamp of PR's last activity when override was set
|
|
207
|
+
*/
|
|
95
208
|
setStatusOverride(url: string, status: FetchedPRStatus, lastActivityAt: string): void;
|
|
209
|
+
/**
|
|
210
|
+
* Remove a manual status override for a PR.
|
|
211
|
+
* @param url - The PR URL
|
|
212
|
+
* @returns true if an override was removed, false if none existed
|
|
213
|
+
*/
|
|
96
214
|
clearStatusOverride(url: string): boolean;
|
|
215
|
+
/**
|
|
216
|
+
* Get the status override for a PR, auto-clearing if new activity has occurred.
|
|
217
|
+
* @param url - The PR URL
|
|
218
|
+
* @param currentUpdatedAt - PR's current updatedAt timestamp for staleness check
|
|
219
|
+
* @returns The override if still valid, undefined otherwise
|
|
220
|
+
*/
|
|
97
221
|
getStatusOverride(url: string, currentUpdatedAt?: string): StatusOverride | undefined;
|
|
222
|
+
/**
|
|
223
|
+
* Get the score record for a repository.
|
|
224
|
+
* @param repo - Repository in "owner/repo" format
|
|
225
|
+
* @returns Read-only score record, or undefined if not tracked
|
|
226
|
+
*/
|
|
98
227
|
getRepoScore(repo: string): Readonly<RepoScore> | undefined;
|
|
228
|
+
/**
|
|
229
|
+
* Update scoring data for a repository.
|
|
230
|
+
* @param repo - Repository in "owner/repo" format
|
|
231
|
+
* @param updates - Partial score fields to merge
|
|
232
|
+
*/
|
|
99
233
|
updateRepoScore(repo: string, updates: RepoScoreUpdate): void;
|
|
234
|
+
/**
|
|
235
|
+
* Increment the merged PR count for a repository.
|
|
236
|
+
* @param repo - Repository in "owner/repo" format
|
|
237
|
+
*/
|
|
100
238
|
incrementMergedCount(repo: string): void;
|
|
239
|
+
/**
|
|
240
|
+
* Increment the closed-without-merge PR count.
|
|
241
|
+
* @param repo - Repository in "owner/repo" format
|
|
242
|
+
*/
|
|
101
243
|
incrementClosedCount(repo: string): void;
|
|
244
|
+
/**
|
|
245
|
+
* Mark a repository as hostile (score zeroed).
|
|
246
|
+
* @param repo - Repository in "owner/repo" format
|
|
247
|
+
*/
|
|
102
248
|
markRepoHostile(repo: string): void;
|
|
249
|
+
/** Returns repository names that have at least one merged PR. */
|
|
103
250
|
getReposWithMergedPRs(): string[];
|
|
251
|
+
/** Returns repository names with open PRs but no merged PRs yet. */
|
|
104
252
|
getReposWithOpenPRs(): string[];
|
|
253
|
+
/**
|
|
254
|
+
* Returns repos above the score threshold.
|
|
255
|
+
* @param minScore - Minimum score (default: config.minRepoScoreThreshold)
|
|
256
|
+
*/
|
|
105
257
|
getHighScoringRepos(minScore?: number): string[];
|
|
258
|
+
/**
|
|
259
|
+
* Returns repos below the score threshold.
|
|
260
|
+
* @param maxScore - Maximum score (default: config.minRepoScoreThreshold)
|
|
261
|
+
*/
|
|
106
262
|
getLowScoringRepos(maxScore?: number): string[];
|
|
263
|
+
/** Returns aggregate contribution statistics (merge rate, PR counts, repo breakdown). */
|
|
107
264
|
getStats(): Stats;
|
|
108
265
|
}
|
|
109
266
|
/**
|
|
110
267
|
* Get the singleton StateManager instance, creating it on first call.
|
|
268
|
+
* @returns The shared StateManager instance
|
|
269
|
+
*
|
|
270
|
+
* @example
|
|
271
|
+
* ```typescript
|
|
272
|
+
* import { getStateManager } from '@oss-autopilot/core';
|
|
273
|
+
*
|
|
274
|
+
* const state = getStateManager();
|
|
275
|
+
* const config = state.getState().config;
|
|
276
|
+
* console.log(config.githubUsername);
|
|
277
|
+
* ```
|
|
111
278
|
*/
|
|
112
279
|
export declare function getStateManager(): StateManager;
|
|
113
280
|
/**
|