@oss-autopilot/core 1.1.0 → 1.2.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.
@@ -3,6 +3,7 @@
3
3
  * Shows or updates configuration
4
4
  */
5
5
  import { getStateManager } from '../core/index.js';
6
+ import { ValidationError } from '../core/errors.js';
6
7
  import { ISSUE_SCOPES } from '../core/types.js';
7
8
  import { validateGitHubUsername } from './validation.js';
8
9
  function validateScope(value) {
@@ -105,6 +106,14 @@ export async function runConfig(options) {
105
106
  case 'issueListPath':
106
107
  stateManager.updateConfig({ issueListPath: value || undefined });
107
108
  break;
109
+ case 'scoreThreshold': {
110
+ const threshold = Number(value);
111
+ if (!Number.isInteger(threshold) || threshold < 1 || threshold > 10) {
112
+ throw new ValidationError(`Invalid value for scoreThreshold: "${value}". Must be an integer between 1 and 10.`);
113
+ }
114
+ stateManager.updateConfig({ scoreThreshold: threshold });
115
+ break;
116
+ }
108
117
  default:
109
118
  throw new Error(`Unknown config key: ${options.key}`);
110
119
  }
@@ -24,6 +24,7 @@ export interface SetupCompleteOutput {
24
24
  projectCategories: ProjectCategory[];
25
25
  preferredOrgs: string[];
26
26
  scope: IssueScope[];
27
+ scoreThreshold: number;
27
28
  };
28
29
  }
29
30
  export interface SetupPrompt {
@@ -9,11 +9,19 @@ import { PROJECT_CATEGORIES, ISSUE_SCOPES } from '../core/types.js';
9
9
  /** Parse and validate a positive integer setting value. */
10
10
  function parsePositiveInt(value, settingName) {
11
11
  const parsed = Number(value);
12
- if (!Number.isFinite(parsed) || parsed < 1 || !Number.isInteger(parsed)) {
12
+ if (!Number.isInteger(parsed) || parsed < 1) {
13
13
  throw new ValidationError(`Invalid value for ${settingName}: "${value}". Must be a positive integer.`);
14
14
  }
15
15
  return parsed;
16
16
  }
17
+ /** Parse and validate an integer within a specific range [min, max]. */
18
+ function parseBoundedInt(value, settingName, min, max) {
19
+ const parsed = Number(value);
20
+ if (!Number.isInteger(parsed) || parsed < min || parsed > max) {
21
+ throw new ValidationError(`Invalid value for ${settingName}: "${value}". Must be an integer between ${min} and ${max}.`);
22
+ }
23
+ return parsed;
24
+ }
17
25
  /**
18
26
  * Interactive setup wizard or direct setting application.
19
27
  *
@@ -84,9 +92,15 @@ export async function runSetup(options) {
84
92
  results[key] = value !== 'false' ? 'true' : 'false';
85
93
  }
86
94
  break;
95
+ case 'scoreThreshold': {
96
+ const threshold = parseBoundedInt(value, 'scoreThreshold', 1, 10);
97
+ stateManager.updateConfig({ scoreThreshold: threshold });
98
+ results[key] = String(threshold);
99
+ break;
100
+ }
87
101
  case 'minStars': {
88
102
  const stars = Number(value);
89
- if (!Number.isFinite(stars) || !Number.isInteger(stars) || stars < 0) {
103
+ if (!Number.isInteger(stars) || stars < 0) {
90
104
  throw new ValidationError(`Invalid value for minStars: "${value}". Must be a non-negative integer.`);
91
105
  }
92
106
  stateManager.updateConfig({ minStars: stars });
@@ -225,6 +239,7 @@ export async function runSetup(options) {
225
239
  projectCategories: config.projectCategories ?? [],
226
240
  preferredOrgs: config.preferredOrgs ?? [],
227
241
  scope: config.scope ?? [],
242
+ scoreThreshold: config.scoreThreshold,
228
243
  },
229
244
  };
230
245
  }
@@ -281,6 +296,13 @@ export async function runSetup(options) {
281
296
  default: [],
282
297
  type: 'list',
283
298
  },
299
+ {
300
+ setting: 'scoreThreshold',
301
+ prompt: 'Minimum vet score (1-10) for issues to keep after vetting? Issues below this are auto-filtered.',
302
+ current: config.scoreThreshold,
303
+ default: 6,
304
+ type: 'number',
305
+ },
284
306
  {
285
307
  setting: 'aiPolicyBlocklist',
286
308
  prompt: 'Repos with anti-AI contribution policies to block (owner/repo, comma-separated)?',
@@ -209,6 +209,7 @@ export declare const AgentConfigSchema: z.ZodObject<{
209
209
  trustedProjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
210
210
  githubUsername: z.ZodDefault<z.ZodString>;
211
211
  minRepoScoreThreshold: z.ZodDefault<z.ZodNumber>;
212
+ scoreThreshold: z.ZodDefault<z.ZodNumber>;
212
213
  starredRepos: z.ZodDefault<z.ZodArray<z.ZodString>>;
213
214
  starredReposLastFetched: z.ZodOptional<z.ZodString>;
214
215
  showHealthCheck: z.ZodOptional<z.ZodBoolean>;
@@ -354,6 +355,7 @@ export declare const AgentStateSchema: z.ZodObject<{
354
355
  trustedProjects: z.ZodDefault<z.ZodArray<z.ZodString>>;
355
356
  githubUsername: z.ZodDefault<z.ZodString>;
356
357
  minRepoScoreThreshold: z.ZodDefault<z.ZodNumber>;
358
+ scoreThreshold: z.ZodDefault<z.ZodNumber>;
357
359
  starredRepos: z.ZodDefault<z.ZodArray<z.ZodString>>;
358
360
  starredReposLastFetched: z.ZodOptional<z.ZodString>;
359
361
  showHealthCheck: z.ZodOptional<z.ZodBoolean>;
@@ -135,6 +135,7 @@ export const AgentConfigSchema = z.object({
135
135
  trustedProjects: z.array(z.string()).default([]),
136
136
  githubUsername: z.string().default(''),
137
137
  minRepoScoreThreshold: z.number().default(4),
138
+ scoreThreshold: z.number().int().min(1).max(10).default(6),
138
139
  starredRepos: z.array(z.string()).default([]),
139
140
  starredReposLastFetched: z.string().optional(),
140
141
  showHealthCheck: z.boolean().optional(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-autopilot/core",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "CLI and core library for managing open source contributions",
5
5
  "type": "module",
6
6
  "bin": {