@oss-autopilot/core 3.29.2 → 3.30.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 +86 -86
- package/dist/commands/setup.js +3 -2
- package/dist/core/compliance-score.d.ts +2 -3
- package/dist/core/compliance-score.js +9 -2
- package/dist/core/config-registry.js +6 -0
- package/dist/core/github-stats.d.ts +2 -0
- package/dist/core/github-stats.js +3 -1
- package/dist/core/maintainer-analysis.js +13 -1
- package/dist/core/pr-monitor.js +3 -1
- package/dist/core/pr-quality-rubric.js +1 -1
- package/dist/core/state-schema.d.ts +2 -0
- package/dist/core/state-schema.js +6 -0
- package/dist/core/urls.d.ts +2 -0
- package/dist/core/urls.js +5 -0
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -261,7 +261,8 @@ export async function runSetup(options) {
|
|
|
261
261
|
results[key] = dedupedCategories.length > 0 ? dedupedCategories.join(', ') : '(empty)';
|
|
262
262
|
break;
|
|
263
263
|
}
|
|
264
|
-
case 'preferredOrgs':
|
|
264
|
+
case 'preferredOrgs':
|
|
265
|
+
case 'untrackedOrgs': {
|
|
265
266
|
const orgs = value
|
|
266
267
|
.split(',')
|
|
267
268
|
.map((o) => o.trim())
|
|
@@ -279,7 +280,7 @@ export async function runSetup(options) {
|
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
282
|
const dedupedOrgs = [...new Set(validOrgs)];
|
|
282
|
-
stateManager.updateConfig({
|
|
283
|
+
stateManager.updateConfig({ [key]: dedupedOrgs });
|
|
283
284
|
results[key] = dedupedOrgs.length > 0 ? dedupedOrgs.join(', ') : '(empty)';
|
|
284
285
|
break;
|
|
285
286
|
}
|
|
@@ -85,9 +85,8 @@ export interface LinkedIssueInfo {
|
|
|
85
85
|
export interface RepoContext {
|
|
86
86
|
/**
|
|
87
87
|
* Whether the target repo has any visible test infrastructure
|
|
88
|
-
* (`test/`, `tests/`, `__tests__/`, `spec/`, etc.).
|
|
89
|
-
*
|
|
90
|
-
* required by the project.
|
|
88
|
+
* (`test/`, `tests/`, `__tests__/`, `spec/`, etc.). Only changes the
|
|
89
|
+
* detail text of a no-tests warn; a PR without tests is never a `fail`.
|
|
91
90
|
*/
|
|
92
91
|
hasTestInfrastructure?: boolean;
|
|
93
92
|
/**
|
|
@@ -191,7 +191,7 @@ function checkFocusedChanges(meta) {
|
|
|
191
191
|
}
|
|
192
192
|
return { status: 'warn', weight, detail };
|
|
193
193
|
}
|
|
194
|
-
const TEST_FILE_PATTERN = /(?:^|\/)(?:tests?|__tests__|spec)\/|\.(?:test|spec)\.[jt]sx?$|\.test_
|
|
194
|
+
const TEST_FILE_PATTERN = /(?:^|\/)(?:tests?|__tests__|spec)\/|\.(?:test|spec)\.[cm]?[jt]sx?$|\.test_|_test\.(?:go|py|rb)$|(?:^|\/)test_[^/]+\.py$|_spec\.rb$/i;
|
|
195
195
|
function checkTests(meta, repoContext) {
|
|
196
196
|
const weight = WEIGHTS.tests;
|
|
197
197
|
const hasTestFile = meta.files.some((f) => TEST_FILE_PATTERN.test(f));
|
|
@@ -205,7 +205,14 @@ function checkTests(meta, repoContext) {
|
|
|
205
205
|
detail: 'no tests, but project has no visible test infrastructure',
|
|
206
206
|
};
|
|
207
207
|
}
|
|
208
|
-
|
|
208
|
+
// Warn, never fail: a fail pushes agents to add filler tests to data-only
|
|
209
|
+
// changes. Whether a test is needed is a judgment about the diff (does it
|
|
210
|
+
// guard a nameable regression?), which file names can't make.
|
|
211
|
+
return {
|
|
212
|
+
status: 'warn',
|
|
213
|
+
weight,
|
|
214
|
+
detail: 'no test files; fine if nothing testable changed, a bug fix needs a regression test',
|
|
215
|
+
};
|
|
209
216
|
}
|
|
210
217
|
const CONVENTIONAL_TITLE = /^(?:feat|fix|chore|docs|refactor|test|perf|build|ci|style|revert)(?:\([^)]+\))?!?:\s+\S/i;
|
|
211
218
|
const VAGUE_EXACT = new Set(['wip', 'test', 'hello', 'tmp', 'temp', 'untitled']);
|
|
@@ -104,6 +104,12 @@ export const CONFIG_KEY_REGISTRY = [
|
|
|
104
104
|
settableVia: 'setup',
|
|
105
105
|
valueHint: 'comma-separated list',
|
|
106
106
|
},
|
|
107
|
+
{
|
|
108
|
+
key: 'untrackedOrgs',
|
|
109
|
+
description: 'GitHub orgs whose PRs are not tracked (e.g. work repos). Discovery is unaffected (whole-list replace).',
|
|
110
|
+
settableVia: 'setup',
|
|
111
|
+
valueHint: 'comma-separated list',
|
|
112
|
+
},
|
|
107
113
|
{
|
|
108
114
|
key: 'aiPolicyBlocklist',
|
|
109
115
|
description: 'Repos (owner/repo) with anti-AI contribution policies to block from discovery.',
|
|
@@ -34,6 +34,7 @@ export declare function fetchUserClosedPRCounts(octokit: Octokit, githubUsername
|
|
|
34
34
|
*/
|
|
35
35
|
export declare function fetchRecentlyClosedPRs(octokit: Octokit, config: {
|
|
36
36
|
githubUsername: string;
|
|
37
|
+
untrackedOrgs?: string[];
|
|
37
38
|
}, days?: number): Promise<ClosedPR[]>;
|
|
38
39
|
/**
|
|
39
40
|
* Fetch PRs merged in the last N days.
|
|
@@ -41,6 +42,7 @@ export declare function fetchRecentlyClosedPRs(octokit: Octokit, config: {
|
|
|
41
42
|
*/
|
|
42
43
|
export declare function fetchRecentlyMergedPRs(octokit: Octokit, config: {
|
|
43
44
|
githubUsername: string;
|
|
45
|
+
untrackedOrgs?: string[];
|
|
44
46
|
}, days?: number): Promise<MergedPR[]>;
|
|
45
47
|
/**
|
|
46
48
|
* Fetch merged PRs since a watermark date for incremental storage.
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* GitHub Stats - Fetching merged/closed PR counts with star-based filtering.
|
|
3
3
|
* Extracted from PRMonitor to isolate statistics-gathering API calls (#263).
|
|
4
4
|
*/
|
|
5
|
-
import { extractOwnerRepo, parseGitHubUrl, isOwnRepo } from './urls.js';
|
|
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
8
|
import { getHttpCache } from './http-cache.js';
|
|
@@ -205,6 +205,8 @@ async function fetchRecentPRs(octokit, config, query, label, days, mapItem, date
|
|
|
205
205
|
// Skip own repos
|
|
206
206
|
if (isOwnRepo(parsed.owner, config.githubUsername))
|
|
207
207
|
continue;
|
|
208
|
+
if (isUntrackedOrg(parsed.owner, config.untrackedOrgs))
|
|
209
|
+
continue;
|
|
208
210
|
// The query bounds on `updated`, so an old PR that just got a comment can
|
|
209
211
|
// come back. Narrow to the actual close/merge window here.
|
|
210
212
|
const date = dateOf(item);
|
|
@@ -42,7 +42,19 @@ export function extractMaintainerActionHints(commentBody, reviewDecision) {
|
|
|
42
42
|
'needs test',
|
|
43
43
|
'need test',
|
|
44
44
|
];
|
|
45
|
-
|
|
45
|
+
// Skip a keyword preceded by a negation ("don't add tests", "no need to add test"),
|
|
46
|
+
// unless a clause boundary sits between them ("no blockers, add tests").
|
|
47
|
+
const negatedBefore = (idx) => {
|
|
48
|
+
const m = /\b(?:no|not|don['’]?t|without|unnecessary|skip)\b([^.!?,;:\n]{0,20})$/.exec(lower.slice(0, idx));
|
|
49
|
+
return m !== null && !/\b(?:and|but|until|then|so)\b/.test(m[1]);
|
|
50
|
+
};
|
|
51
|
+
if (testKeywords.some((kw) => {
|
|
52
|
+
for (let i = lower.indexOf(kw); i !== -1; i = lower.indexOf(kw, i + 1)) {
|
|
53
|
+
if (!negatedBefore(i))
|
|
54
|
+
return true;
|
|
55
|
+
}
|
|
56
|
+
return false;
|
|
57
|
+
})) {
|
|
46
58
|
hints.push('tests_requested');
|
|
47
59
|
}
|
|
48
60
|
// Documentation requests
|
package/dist/core/pr-monitor.js
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
*/
|
|
15
15
|
import { getOctokit } from './github.js';
|
|
16
16
|
import { getStateManager } from './state.js';
|
|
17
|
-
import { parseGitHubUrl, extractOwnerRepo, isOwnRepo } from './urls.js';
|
|
17
|
+
import { parseGitHubUrl, extractOwnerRepo, isOwnRepo, isUntrackedOrg } from './urls.js';
|
|
18
18
|
import { DEFAULT_CONCURRENCY, runWorkerPool } from './concurrency.js';
|
|
19
19
|
import { ConfigurationError, ValidationError, errorMessage, getHttpStatusCode, isInvalidUserSearchError, isRateLimitOrAuthError, } from './errors.js';
|
|
20
20
|
import { paginateAllDetailed } from './pagination.js';
|
|
@@ -227,6 +227,8 @@ export class PRMonitor {
|
|
|
227
227
|
}
|
|
228
228
|
if (isOwnRepo(parsed.owner, searchUsername))
|
|
229
229
|
return false;
|
|
230
|
+
if (isUntrackedOrg(parsed.owner, initialConfig.untrackedOrgs))
|
|
231
|
+
return false;
|
|
230
232
|
return true;
|
|
231
233
|
});
|
|
232
234
|
debug('pr-monitor', `Filtered to ${filteredItems.length} PRs after excluding own repos`);
|
|
@@ -77,7 +77,7 @@ export const PR_QUALITY_RUBRIC = [
|
|
|
77
77
|
{
|
|
78
78
|
id: 'tests',
|
|
79
79
|
label: 'Tests Included',
|
|
80
|
-
description: '
|
|
80
|
+
description: 'Only when the change has behavior to guard (bug fix, new logic); never filler',
|
|
81
81
|
tier: 'conditional',
|
|
82
82
|
weight: 15,
|
|
83
83
|
},
|
|
@@ -257,6 +257,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
|
|
|
257
257
|
}>>>;
|
|
258
258
|
excludeRepos: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
259
259
|
excludeOrgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
260
|
+
untrackedOrgs: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
260
261
|
avoidRepos: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
261
262
|
boostIssueTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
262
263
|
trustedProjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -533,6 +534,7 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
533
534
|
}>>>;
|
|
534
535
|
excludeRepos: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
535
536
|
excludeOrgs: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
537
|
+
untrackedOrgs: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
536
538
|
avoidRepos: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
537
539
|
boostIssueTypes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
538
540
|
trustedProjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
@@ -201,6 +201,12 @@ export const AgentConfigSchema = z.object({
|
|
|
201
201
|
scope: z.array(IssueScopeSchema).optional(),
|
|
202
202
|
excludeRepos: z.array(z.string()).default([]),
|
|
203
203
|
excludeOrgs: z.array(z.string()).optional(),
|
|
204
|
+
/**
|
|
205
|
+
* Orgs whose PRs are left out of PR tracking (open, recently closed and
|
|
206
|
+
* recently merged lists), e.g. an employer's public repos. Unlike
|
|
207
|
+
* `excludeOrgs`, which only affects discovery (#591).
|
|
208
|
+
*/
|
|
209
|
+
untrackedOrgs: z.array(z.string()).default([]),
|
|
204
210
|
/**
|
|
205
211
|
* Repos (owner/repo) to softly downrank in discovery results (#1464).
|
|
206
212
|
* Milder than `excludeRepos`' hard filter: scout pushes matches below
|
package/dist/core/urls.d.ts
CHANGED
|
@@ -61,3 +61,5 @@ export declare function splitRepo(repoFullName: string): {
|
|
|
61
61
|
* Used to skip a user's own repos (PRs to your own repos aren't OSS contributions).
|
|
62
62
|
*/
|
|
63
63
|
export declare function isOwnRepo(owner: string, username: string): boolean;
|
|
64
|
+
/** True when `owner` is listed in `config.untrackedOrgs` (case-insensitive). */
|
|
65
|
+
export declare function isUntrackedOrg(owner: string, untrackedOrgs?: readonly string[]): boolean;
|
package/dist/core/urls.js
CHANGED
|
@@ -99,3 +99,8 @@ export function splitRepo(repoFullName) {
|
|
|
99
99
|
export function isOwnRepo(owner, username) {
|
|
100
100
|
return owner.toLowerCase() === username.toLowerCase();
|
|
101
101
|
}
|
|
102
|
+
/** True when `owner` is listed in `config.untrackedOrgs` (case-insensitive). */
|
|
103
|
+
export function isUntrackedOrg(owner, untrackedOrgs = []) {
|
|
104
|
+
const ownerLower = owner.toLowerCase();
|
|
105
|
+
return untrackedOrgs.some((org) => org.toLowerCase() === ownerLower);
|
|
106
|
+
}
|