@oss-autopilot/core 0.42.1 → 0.42.3
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 +804 -751
- package/dist/cli.js +14 -14
- package/dist/commands/daily.d.ts +0 -1
- package/dist/commands/daily.js +4 -3
- package/dist/commands/dashboard-components.d.ts +33 -0
- package/dist/commands/dashboard-components.js +57 -0
- package/dist/commands/dashboard-formatters.d.ts +20 -0
- package/dist/commands/dashboard-formatters.js +33 -0
- package/dist/commands/dashboard-scripts.d.ts +7 -0
- package/dist/commands/dashboard-scripts.js +281 -0
- package/dist/commands/dashboard-styles.d.ts +5 -0
- package/dist/commands/dashboard-styles.js +765 -0
- package/dist/commands/dashboard-templates.d.ts +6 -18
- package/dist/commands/dashboard-templates.js +30 -1134
- package/dist/commands/dismiss.d.ts +4 -6
- package/dist/commands/dismiss.js +11 -13
- package/dist/commands/validation.d.ts +3 -1
- package/dist/commands/validation.js +8 -2
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/issue-discovery.d.ts +5 -0
- package/dist/core/issue-discovery.js +56 -79
- package/dist/core/logger.d.ts +5 -0
- package/dist/core/logger.js +8 -0
- package/dist/core/pr-monitor.js +5 -0
- package/dist/core/review-analysis.js +10 -7
- package/dist/core/state.d.ts +7 -7
- package/dist/core/state.js +7 -7
- package/dist/core/test-utils.d.ts +14 -0
- package/dist/core/test-utils.js +125 -0
- package/dist/core/types.d.ts +1 -1
- package/dist/formatters/json.d.ts +0 -1
- package/package.json +1 -1
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared test factories for oss-autopilot.
|
|
3
|
+
*
|
|
4
|
+
* Centralises mock object construction so that when types gain new required
|
|
5
|
+
* fields we only update one place. Every factory accepts a `Partial<T>`
|
|
6
|
+
* override bag — callers only specify the fields relevant to their test.
|
|
7
|
+
*/
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// FetchedPR
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
export function makeFetchedPR(overrides = {}) {
|
|
12
|
+
const repo = overrides.repo ?? 'owner/repo';
|
|
13
|
+
const number = overrides.number ?? 1;
|
|
14
|
+
return {
|
|
15
|
+
id: 1,
|
|
16
|
+
url: `https://github.com/${repo}/pull/${number}`,
|
|
17
|
+
repo,
|
|
18
|
+
number,
|
|
19
|
+
title: 'Test PR',
|
|
20
|
+
status: 'healthy',
|
|
21
|
+
displayLabel: '[Healthy]',
|
|
22
|
+
displayDescription: 'Everything looks good',
|
|
23
|
+
createdAt: '2025-06-01T00:00:00Z',
|
|
24
|
+
updatedAt: '2025-06-15T00:00:00Z',
|
|
25
|
+
daysSinceActivity: 2,
|
|
26
|
+
ciStatus: 'passing',
|
|
27
|
+
failingCheckNames: [],
|
|
28
|
+
classifiedChecks: [],
|
|
29
|
+
hasMergeConflict: false,
|
|
30
|
+
reviewDecision: 'approved',
|
|
31
|
+
hasUnrespondedComment: false,
|
|
32
|
+
hasIncompleteChecklist: false,
|
|
33
|
+
maintainerActionHints: [],
|
|
34
|
+
...overrides,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
// DailyDigest
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
export function makeDailyDigest(overrides = {}) {
|
|
41
|
+
return {
|
|
42
|
+
generatedAt: '2025-06-20T00:00:00Z',
|
|
43
|
+
openPRs: [],
|
|
44
|
+
prsNeedingResponse: [],
|
|
45
|
+
ciFailingPRs: [],
|
|
46
|
+
ciBlockedPRs: [],
|
|
47
|
+
ciNotRunningPRs: [],
|
|
48
|
+
mergeConflictPRs: [],
|
|
49
|
+
needsRebasePRs: [],
|
|
50
|
+
missingRequiredFilesPRs: [],
|
|
51
|
+
incompleteChecklistPRs: [],
|
|
52
|
+
needsChangesPRs: [],
|
|
53
|
+
changesAddressedPRs: [],
|
|
54
|
+
waitingOnMaintainerPRs: [],
|
|
55
|
+
approachingDormant: [],
|
|
56
|
+
dormantPRs: [],
|
|
57
|
+
healthyPRs: [],
|
|
58
|
+
recentlyClosedPRs: [],
|
|
59
|
+
recentlyMergedPRs: [],
|
|
60
|
+
shelvedPRs: [],
|
|
61
|
+
autoUnshelvedPRs: [],
|
|
62
|
+
summary: {
|
|
63
|
+
totalActivePRs: 0,
|
|
64
|
+
totalNeedingAttention: 0,
|
|
65
|
+
totalMergedAllTime: 0,
|
|
66
|
+
mergeRate: 0,
|
|
67
|
+
},
|
|
68
|
+
...overrides,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
// ---------------------------------------------------------------------------
|
|
72
|
+
// ShelvedPRRef
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
export function makeShelvedPRRef(overrides = {}) {
|
|
75
|
+
return {
|
|
76
|
+
number: 1,
|
|
77
|
+
url: 'https://github.com/owner/repo/pull/1',
|
|
78
|
+
title: 'Shelved PR',
|
|
79
|
+
repo: 'owner/repo',
|
|
80
|
+
daysSinceActivity: 45,
|
|
81
|
+
status: 'healthy',
|
|
82
|
+
...overrides,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
// ---------------------------------------------------------------------------
|
|
86
|
+
// CapacityAssessment
|
|
87
|
+
// ---------------------------------------------------------------------------
|
|
88
|
+
export function makeCapacityAssessment(overrides = {}) {
|
|
89
|
+
return {
|
|
90
|
+
hasCapacity: true,
|
|
91
|
+
activePRCount: 3,
|
|
92
|
+
maxActivePRs: 10,
|
|
93
|
+
shelvedPRCount: 0,
|
|
94
|
+
criticalIssueCount: 0,
|
|
95
|
+
reason: 'You have capacity',
|
|
96
|
+
...overrides,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
// ---------------------------------------------------------------------------
|
|
100
|
+
// AgentState (partial — for tests that need a state object)
|
|
101
|
+
// ---------------------------------------------------------------------------
|
|
102
|
+
export function makeAgentState(overrides = {}) {
|
|
103
|
+
return {
|
|
104
|
+
version: 2,
|
|
105
|
+
repoScores: {},
|
|
106
|
+
config: {
|
|
107
|
+
setupComplete: false,
|
|
108
|
+
githubUsername: 'testuser',
|
|
109
|
+
excludeRepos: [],
|
|
110
|
+
maxActivePRs: 10,
|
|
111
|
+
dormantThresholdDays: 30,
|
|
112
|
+
approachingDormantDays: 25,
|
|
113
|
+
maxIssueAgeDays: 90,
|
|
114
|
+
languages: [],
|
|
115
|
+
labels: [],
|
|
116
|
+
trustedProjects: [],
|
|
117
|
+
minRepoScoreThreshold: 4,
|
|
118
|
+
starredRepos: [],
|
|
119
|
+
},
|
|
120
|
+
events: [],
|
|
121
|
+
lastRunAt: '2025-06-20T00:00:00Z',
|
|
122
|
+
activeIssues: [],
|
|
123
|
+
...overrides,
|
|
124
|
+
};
|
|
125
|
+
}
|
package/dist/core/types.d.ts
CHANGED
|
@@ -451,7 +451,7 @@ export interface AgentConfig {
|
|
|
451
451
|
aiPolicyBlocklist?: string[];
|
|
452
452
|
/** PR URLs manually shelved by the user. Shelved PRs are excluded from capacity and actionable issues. Auto-unshelved when maintainers engage. */
|
|
453
453
|
shelvedPRUrls?: string[];
|
|
454
|
-
/** Issue URLs dismissed by the user, mapped to ISO timestamp of when dismissed. Issues with new responses after the dismiss timestamp resurface automatically. */
|
|
454
|
+
/** Issue/PR URLs dismissed by the user, mapped to ISO timestamp of when dismissed. Issues with new responses after the dismiss timestamp resurface automatically. Named dismissedIssues for state backward compatibility (#416). */
|
|
455
455
|
dismissedIssues?: Record<string, string>;
|
|
456
456
|
/** PR URLs with snoozed CI failures, mapped to snooze metadata. Snoozed PRs are excluded from actionable CI failure list until expiry. */
|
|
457
457
|
snoozedPRs?: Record<string, SnoozeInfo>;
|