@oss-autopilot/core 3.17.3 → 3.19.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.
@@ -24,7 +24,7 @@ export { runStatus } from './status.js';
24
24
  /** On-demand strategy snapshot via the typed `computeStrategy` core function (#1243 step 4). */
25
25
  export { runStrategy } from './strategy.js';
26
26
  /** Search GitHub for contributable issues using multi-strategy discovery. */
27
- export { runSearch, MAX_SEARCH_RESULTS } from './search.js';
27
+ export { runSearch, MAX_SEARCH_RESULTS, DEFAULT_SEARCH_RESULTS } from './search.js';
28
28
  /** Surface feature-scoped opportunities in repos with 3+ merged PRs (scout 0.9.0). */
29
29
  export { runFeatures, MAX_FEATURES_RESULTS } from './features.js';
30
30
  /** Vet a single GitHub issue for claimability (open, unassigned, no linked PRs, repo health). */
@@ -25,7 +25,7 @@ export { runStatus } from './status.js';
25
25
  /** On-demand strategy snapshot via the typed `computeStrategy` core function (#1243 step 4). */
26
26
  export { runStrategy } from './strategy.js';
27
27
  /** Search GitHub for contributable issues using multi-strategy discovery. */
28
- export { runSearch, MAX_SEARCH_RESULTS } from './search.js';
28
+ export { runSearch, MAX_SEARCH_RESULTS, DEFAULT_SEARCH_RESULTS } from './search.js';
29
29
  /** Surface feature-scoped opportunities in repos with 3+ merged PRs (scout 0.9.0). */
30
30
  export { runFeatures, MAX_FEATURES_RESULTS } from './features.js';
31
31
  /** Vet a single GitHub issue for claimability (open, unassigned, no linked PRs, repo health). */
@@ -2,6 +2,7 @@
2
2
  * Search command
3
3
  * Searches for new issues to work on via @oss-scout/core
4
4
  */
5
+ import { type SearchStrategy } from '@oss-scout/core';
5
6
  import { getStateManager } from '../core/index.js';
6
7
  import { type SearchOutput } from '../formatters/json.js';
7
8
  export { type SearchOutput } from '../formatters/json.js';
@@ -11,6 +12,14 @@ export { type SearchOutput } from '../formatters/json.js';
11
12
  * lands in one place instead of three (#1002).
12
13
  */
13
14
  export declare const MAX_SEARCH_RESULTS = 100;
15
+ /**
16
+ * Default issue-search result count when no count is passed (#1571). Sized to
17
+ * leave headroom past scout's affinity phases (merged-PR + starred), which can
18
+ * fill a small cap on their own and starve the broad/maintained phases via the
19
+ * `allCandidates.length < maxResults` gate. Shared between CLI
20
+ * (`cli-registry.ts`), MCP tool (`tools.ts`), and MCP prompt (`prompts.ts`).
21
+ */
22
+ export declare const DEFAULT_SEARCH_RESULTS = 15;
14
23
  /**
15
24
  * Diversity-counterweight ratio (#1244). Moved to `scout-bridge.ts` in #1464
16
25
  * (it is now also baked into the bridge-built `ScoutPreferences`); re-exported
@@ -19,7 +28,23 @@ export declare const MAX_SEARCH_RESULTS = 100;
19
28
  export { SEARCH_DIVERSITY_RATIO } from './scout-bridge.js';
20
29
  interface SearchOptions {
21
30
  maxResults: number;
31
+ /**
32
+ * Restrict discovery to specific scout phases (#1244 selector surface).
33
+ * Undefined runs scout's default staged pipeline (all phases). Passed
34
+ * straight through to `scout.search`, which gates each phase on the set.
35
+ */
36
+ strategies?: SearchStrategy[];
22
37
  }
38
+ /**
39
+ * Parse and validate a comma-separated `--strategy` value into scout strategies.
40
+ *
41
+ * Mirrors oss-scout's own CLI validation so an unknown token fails fast with a
42
+ * clear message instead of silently running all phases. Returns `undefined`
43
+ * for an absent/empty value so scout falls back to its default (all phases).
44
+ *
45
+ * @throws {Error} If any token is not a valid scout strategy.
46
+ */
47
+ export declare function parseSearchStrategies(raw: string | undefined): SearchStrategy[] | undefined;
23
48
  /**
24
49
  * Retention window for the search seen-set (#1528). Entries older than this are
25
50
  * culled so the list stays bounded. Set well beyond oss-scout's rotation TTL
@@ -3,6 +3,7 @@
3
3
  * Searches for new issues to work on via @oss-scout/core
4
4
  */
5
5
  import { adaptScoutLinkedPR, buildCandidateLinkedPR, createAutopilotScout, SEARCH_DIVERSITY_RATIO, } from './scout-bridge.js';
6
+ import { SearchStrategySchema } from '@oss-scout/core';
6
7
  import { classifyLinkedPR, getStateManager } from '../core/index.js';
7
8
  import { gradeFromCandidate } from '../core/issue-grading.js';
8
9
  import { computeStrategy } from '../core/strategy.js';
@@ -15,12 +16,48 @@ const MODULE = 'search';
15
16
  * lands in one place instead of three (#1002).
16
17
  */
17
18
  export const MAX_SEARCH_RESULTS = 100;
19
+ /**
20
+ * Default issue-search result count when no count is passed (#1571). Sized to
21
+ * leave headroom past scout's affinity phases (merged-PR + starred), which can
22
+ * fill a small cap on their own and starve the broad/maintained phases via the
23
+ * `allCandidates.length < maxResults` gate. Shared between CLI
24
+ * (`cli-registry.ts`), MCP tool (`tools.ts`), and MCP prompt (`prompts.ts`).
25
+ */
26
+ export const DEFAULT_SEARCH_RESULTS = 15;
18
27
  /**
19
28
  * Diversity-counterweight ratio (#1244). Moved to `scout-bridge.ts` in #1464
20
29
  * (it is now also baked into the bridge-built `ScoutPreferences`); re-exported
21
30
  * here so existing importers keep working.
22
31
  */
23
32
  export { SEARCH_DIVERSITY_RATIO } from './scout-bridge.js';
33
+ /**
34
+ * Parse and validate a comma-separated `--strategy` value into scout strategies.
35
+ *
36
+ * Mirrors oss-scout's own CLI validation so an unknown token fails fast with a
37
+ * clear message instead of silently running all phases. Returns `undefined`
38
+ * for an absent/empty value so scout falls back to its default (all phases).
39
+ *
40
+ * @throws {Error} If any token is not a valid scout strategy.
41
+ */
42
+ export function parseSearchStrategies(raw) {
43
+ if (raw === undefined)
44
+ return undefined;
45
+ const tokens = raw
46
+ .split(',')
47
+ .map((s) => s.trim())
48
+ .filter(Boolean);
49
+ if (tokens.length === 0)
50
+ return undefined;
51
+ const strategies = [];
52
+ for (const token of tokens) {
53
+ const parsed = SearchStrategySchema.safeParse(token);
54
+ if (!parsed.success) {
55
+ throw new Error(`Unknown search strategy "${token}". Valid strategies: merged, starred, broad, maintained, all`);
56
+ }
57
+ strategies.push(parsed.data);
58
+ }
59
+ return strategies;
60
+ }
24
61
  /**
25
62
  * Search GitHub for contributable issues using multi-phase discovery.
26
63
  *
@@ -140,6 +177,7 @@ export async function runSearch(options) {
140
177
  const broadPhaseDelayMs = readScoutDelayOverride('OSS_AUTOPILOT_SCOUT_BROAD_PHASE_DELAY_MS');
141
178
  const result = await scout.search({
142
179
  maxResults: options.maxResults,
180
+ ...(options.strategies ? { strategies: options.strategies } : {}),
143
181
  preferLanguages,
144
182
  preferRepos,
145
183
  diversityRatio: SEARCH_DIVERSITY_RATIO,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oss-autopilot/core",
3
- "version": "3.17.3",
3
+ "version": "3.19.0",
4
4
  "description": "CLI and core library for managing open source contributions",
5
5
  "type": "module",
6
6
  "bin": {
@@ -61,12 +61,12 @@
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "^26.1.0",
64
- "@vitest/coverage-v8": "^4.1.8",
64
+ "@vitest/coverage-v8": "^4.1.9",
65
65
  "esbuild": "^0.28.1",
66
- "tsx": "^4.22.4",
67
- "typedoc": "^0.28.19",
66
+ "tsx": "^4.23.0",
67
+ "typedoc": "^0.28.20",
68
68
  "typescript": "^5.9.3",
69
- "vitest": "^4.1.8"
69
+ "vitest": "^4.1.9"
70
70
  },
71
71
  "scripts": {
72
72
  "build": "tsc",