@oss-autopilot/core 0.47.2 → 0.49.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.bundle.cjs +48 -48
- package/dist/cli.bundle.cjs.map +3 -3
- package/dist/commands/daily.d.ts +1 -1
- package/dist/commands/daily.js +15 -8
- package/dist/commands/dashboard-data.d.ts +8 -2
- package/dist/commands/dashboard-data.js +53 -9
- package/dist/commands/dashboard-lifecycle.js +1 -1
- package/dist/commands/dashboard-process.js +1 -1
- package/dist/commands/dashboard-server.js +16 -48
- package/dist/core/daily-logic.d.ts +3 -2
- package/dist/core/daily-logic.js +72 -2
- package/dist/core/github-stats.d.ts +10 -1
- package/dist/core/github-stats.js +58 -0
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/state.d.ts +17 -1
- package/dist/core/state.js +37 -3
- package/dist/core/types.d.ts +10 -2
- package/dist/formatters/json.d.ts +4 -0
- package/dist/formatters/json.js +1 -0
- package/package.json +1 -1
package/dist/core/state.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* State management for the OSS Contribution Agent
|
|
3
3
|
* Persists state to a JSON file in ~/.oss-autopilot/
|
|
4
4
|
*/
|
|
5
|
-
import { AgentState, TrackedIssue, RepoScore, RepoScoreUpdate, StateEvent, StateEventType, DailyDigest, LocalRepoCache, SnoozeInfo, StatusOverride, FetchedPRStatus, StoredMergedPR } from './types.js';
|
|
5
|
+
import { AgentState, TrackedIssue, RepoScore, RepoScoreUpdate, StateEvent, StateEventType, DailyDigest, LocalRepoCache, SnoozeInfo, StatusOverride, FetchedPRStatus, StoredMergedPR, StoredClosedPR } from './types.js';
|
|
6
6
|
/**
|
|
7
7
|
* Acquire an advisory file lock using exclusive-create (`wx` flag).
|
|
8
8
|
* If the lock file already exists but is stale (older than LOCK_TIMEOUT_MS or corrupt),
|
|
@@ -129,6 +129,22 @@ export declare class StateManager {
|
|
|
129
129
|
* @returns ISO date string of the most recent merge, or undefined if no stored PRs.
|
|
130
130
|
*/
|
|
131
131
|
getMergedPRWatermark(): string | undefined;
|
|
132
|
+
/**
|
|
133
|
+
* Get all stored closed PRs.
|
|
134
|
+
* @returns Array of stored closed PRs, sorted by closedAt desc.
|
|
135
|
+
*/
|
|
136
|
+
getClosedPRs(): StoredClosedPR[];
|
|
137
|
+
/**
|
|
138
|
+
* Add new closed PRs to the stored list. Deduplicates by URL and sorts by closedAt desc.
|
|
139
|
+
* @param prs - New closed PRs to add.
|
|
140
|
+
*/
|
|
141
|
+
addClosedPRs(prs: StoredClosedPR[]): void;
|
|
142
|
+
/**
|
|
143
|
+
* Get the most recent closedAt timestamp from stored closed PRs.
|
|
144
|
+
* Used as the watermark for incremental fetching.
|
|
145
|
+
* @returns ISO date string of the most recent close, or undefined if no stored PRs.
|
|
146
|
+
*/
|
|
147
|
+
getClosedPRWatermark(): string | undefined;
|
|
132
148
|
/**
|
|
133
149
|
* Store cached local repo scan results (#84).
|
|
134
150
|
* @param cache - The scan results, paths scanned, and timestamp.
|
package/dist/core/state.js
CHANGED
|
@@ -576,10 +576,44 @@ export class StateManager {
|
|
|
576
576
|
if (!prs || prs.length === 0)
|
|
577
577
|
return undefined;
|
|
578
578
|
// List is sorted desc by mergedAt, so first element is most recent
|
|
579
|
-
|
|
580
|
-
|
|
579
|
+
return prs[0].mergedAt || undefined;
|
|
580
|
+
}
|
|
581
|
+
/**
|
|
582
|
+
* Get all stored closed PRs.
|
|
583
|
+
* @returns Array of stored closed PRs, sorted by closedAt desc.
|
|
584
|
+
*/
|
|
585
|
+
getClosedPRs() {
|
|
586
|
+
return this.state.closedPRs ?? [];
|
|
587
|
+
}
|
|
588
|
+
/**
|
|
589
|
+
* Add new closed PRs to the stored list. Deduplicates by URL and sorts by closedAt desc.
|
|
590
|
+
* @param prs - New closed PRs to add.
|
|
591
|
+
*/
|
|
592
|
+
addClosedPRs(prs) {
|
|
593
|
+
if (prs.length === 0)
|
|
594
|
+
return;
|
|
595
|
+
if (!this.state.closedPRs) {
|
|
596
|
+
this.state.closedPRs = [];
|
|
597
|
+
}
|
|
598
|
+
const existingUrls = new Set(this.state.closedPRs.map((pr) => pr.url));
|
|
599
|
+
const newPRs = prs.filter((pr) => !existingUrls.has(pr.url));
|
|
600
|
+
if (newPRs.length === 0)
|
|
601
|
+
return;
|
|
602
|
+
this.state.closedPRs.push(...newPRs);
|
|
603
|
+
this.state.closedPRs.sort((a, b) => b.closedAt.localeCompare(a.closedAt));
|
|
604
|
+
debug(MODULE, `Added ${newPRs.length} closed PRs (total: ${this.state.closedPRs.length})`);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Get the most recent closedAt timestamp from stored closed PRs.
|
|
608
|
+
* Used as the watermark for incremental fetching.
|
|
609
|
+
* @returns ISO date string of the most recent close, or undefined if no stored PRs.
|
|
610
|
+
*/
|
|
611
|
+
getClosedPRWatermark() {
|
|
612
|
+
const prs = this.state.closedPRs;
|
|
613
|
+
if (!prs || prs.length === 0)
|
|
581
614
|
return undefined;
|
|
582
|
-
|
|
615
|
+
// List is sorted desc by closedAt, so first element is most recent
|
|
616
|
+
return prs[0].closedAt || undefined;
|
|
583
617
|
}
|
|
584
618
|
/**
|
|
585
619
|
* Store cached local repo scan results (#84).
|
package/dist/core/types.d.ts
CHANGED
|
@@ -298,7 +298,7 @@ export interface StateEvent {
|
|
|
298
298
|
/** Event-specific payload (e.g., `{ repo: "owner/repo", number: 42 }` for PR events). */
|
|
299
299
|
data: Record<string, unknown>;
|
|
300
300
|
}
|
|
301
|
-
/** Minimal record of a PR that was closed without being merged, used in the daily digest. */
|
|
301
|
+
/** Minimal record of a PR that was closed without being merged, used in the daily digest and dashboard detail view. */
|
|
302
302
|
export interface ClosedPR {
|
|
303
303
|
url: string;
|
|
304
304
|
repo: string;
|
|
@@ -313,7 +313,13 @@ export interface StoredMergedPR {
|
|
|
313
313
|
title: string;
|
|
314
314
|
mergedAt: string;
|
|
315
315
|
}
|
|
316
|
-
/** Minimal
|
|
316
|
+
/** Minimal closed PR data persisted in state.json. Repo/number derived from URL at display time. */
|
|
317
|
+
export interface StoredClosedPR {
|
|
318
|
+
url: string;
|
|
319
|
+
title: string;
|
|
320
|
+
closedAt: string;
|
|
321
|
+
}
|
|
322
|
+
/** Minimal record of a PR that was merged, used in the daily digest and dashboard detail view. */
|
|
317
323
|
export interface MergedPR {
|
|
318
324
|
url: string;
|
|
319
325
|
repo: string;
|
|
@@ -391,6 +397,8 @@ export interface AgentState {
|
|
|
391
397
|
localRepoCache?: LocalRepoCache;
|
|
392
398
|
/** All merged PRs stored incrementally. Source of truth for the merged PR detail view. */
|
|
393
399
|
mergedPRs?: StoredMergedPR[];
|
|
400
|
+
/** All closed PRs stored incrementally. Source of truth for the closed PR detail view. */
|
|
401
|
+
closedPRs?: StoredClosedPR[];
|
|
394
402
|
activeIssues: TrackedIssue[];
|
|
395
403
|
}
|
|
396
404
|
/** Cached results from scanning the filesystem for local git clones (#84). */
|
|
@@ -25,6 +25,8 @@ export interface ActionableIssue {
|
|
|
25
25
|
type: ActionableIssueType;
|
|
26
26
|
pr: FetchedPR;
|
|
27
27
|
label: string;
|
|
28
|
+
/** True if the PR was created after the last daily digest (first time seen). */
|
|
29
|
+
isNewContribution: boolean;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* Compact version of ActionableIssue for JSON output.
|
|
@@ -36,6 +38,8 @@ export interface CompactActionableIssue {
|
|
|
36
38
|
type: ActionableIssueType;
|
|
37
39
|
prUrl: string;
|
|
38
40
|
label: string;
|
|
41
|
+
/** True if the PR was created after the last daily digest (first time seen). */
|
|
42
|
+
isNewContribution: boolean;
|
|
39
43
|
}
|
|
40
44
|
/**
|
|
41
45
|
* A single action menu item pre-computed by the CLI.
|
package/dist/formatters/json.js
CHANGED