@oss-autopilot/core 0.58.0 → 0.59.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.
Files changed (51) hide show
  1. package/dist/cli-registry.js +54 -0
  2. package/dist/cli.bundle.cjs +49 -45
  3. package/dist/commands/comments.d.ts +28 -0
  4. package/dist/commands/comments.js +28 -0
  5. package/dist/commands/config.d.ts +11 -0
  6. package/dist/commands/config.js +11 -0
  7. package/dist/commands/daily.d.ts +26 -2
  8. package/dist/commands/daily.js +26 -2
  9. package/dist/commands/detect-formatters.d.ts +11 -0
  10. package/dist/commands/detect-formatters.js +24 -0
  11. package/dist/commands/dismiss.d.ts +17 -0
  12. package/dist/commands/dismiss.js +17 -0
  13. package/dist/commands/index.d.ts +3 -1
  14. package/dist/commands/index.js +2 -0
  15. package/dist/commands/init.d.ts +8 -0
  16. package/dist/commands/init.js +8 -0
  17. package/dist/commands/move.d.ts +10 -0
  18. package/dist/commands/move.js +10 -0
  19. package/dist/commands/search.d.ts +18 -0
  20. package/dist/commands/search.js +18 -0
  21. package/dist/commands/setup.d.ts +17 -0
  22. package/dist/commands/setup.js +17 -0
  23. package/dist/commands/shelve.d.ts +16 -0
  24. package/dist/commands/shelve.js +16 -0
  25. package/dist/commands/startup.d.ts +16 -7
  26. package/dist/commands/startup.js +16 -7
  27. package/dist/commands/status.d.ts +8 -0
  28. package/dist/commands/status.js +8 -0
  29. package/dist/commands/track.d.ts +16 -0
  30. package/dist/commands/track.js +16 -0
  31. package/dist/commands/vet.d.ts +8 -0
  32. package/dist/commands/vet.js +8 -0
  33. package/dist/core/daily-logic.d.ts +60 -7
  34. package/dist/core/daily-logic.js +52 -7
  35. package/dist/core/formatter-detection.d.ts +61 -0
  36. package/dist/core/formatter-detection.js +360 -0
  37. package/dist/core/github.d.ts +25 -2
  38. package/dist/core/github.js +25 -2
  39. package/dist/core/index.d.ts +1 -0
  40. package/dist/core/index.js +1 -0
  41. package/dist/core/issue-discovery.d.ts +46 -6
  42. package/dist/core/issue-discovery.js +46 -6
  43. package/dist/core/logger.d.ts +13 -0
  44. package/dist/core/logger.js +13 -0
  45. package/dist/core/pr-monitor.d.ts +43 -8
  46. package/dist/core/pr-monitor.js +43 -8
  47. package/dist/core/state.d.ts +167 -0
  48. package/dist/core/state.js +167 -0
  49. package/dist/core/types.d.ts +2 -8
  50. package/dist/formatters/json.d.ts +5 -0
  51. package/package.json +6 -3
@@ -16,6 +16,34 @@ interface ClaimOptions {
16
16
  issueUrl: string;
17
17
  message?: string;
18
18
  }
19
+ /**
20
+ * Fetch all comments, reviews, and inline review comments for a PR.
21
+ * Filters out the user's own comments and optionally bot comments.
22
+ *
23
+ * @param options - Comment fetch options
24
+ * @param options.prUrl - Full GitHub PR URL
25
+ * @param options.showBots - Include bot comments (default: false)
26
+ * @returns Categorized comments with review, inline, and discussion sections
27
+ * @throws {ValidationError} If the URL is not a valid GitHub PR URL
28
+ */
19
29
  export declare function runComments(options: CommentsOptions): Promise<CommentsOutput>;
30
+ /**
31
+ * Post a comment on a GitHub issue or PR.
32
+ *
33
+ * @param options - Post options
34
+ * @param options.url - Full GitHub issue or PR URL
35
+ * @param options.message - Comment body text
36
+ * @returns Object with commentUrl (the new comment's URL) and url (the original issue/PR URL)
37
+ * @throws {ValidationError} If the URL or message is invalid
38
+ */
20
39
  export declare function runPost(options: PostOptions): Promise<PostOutput>;
40
+ /**
41
+ * Post a claim comment on a GitHub issue and track it locally.
42
+ *
43
+ * @param options - Claim options
44
+ * @param options.issueUrl - Full GitHub issue URL
45
+ * @param options.message - Custom claim message (default: standard claim text)
46
+ * @returns URLs of the created comment and claimed issue
47
+ * @throws {ValidationError} If the URL or message is invalid
48
+ */
21
49
  export declare function runClaim(options: ClaimOptions): Promise<ClaimOutput>;
@@ -5,6 +5,16 @@
5
5
  import { getStateManager, getOctokit, parseGitHubUrl, requireGitHubToken } from '../core/index.js';
6
6
  import { paginateAll } from '../core/pagination.js';
7
7
  import { validateUrl, validateMessage, validateGitHubUrl, PR_URL_PATTERN, ISSUE_OR_PR_URL_PATTERN, ISSUE_URL_PATTERN, } from './validation.js';
8
+ /**
9
+ * Fetch all comments, reviews, and inline review comments for a PR.
10
+ * Filters out the user's own comments and optionally bot comments.
11
+ *
12
+ * @param options - Comment fetch options
13
+ * @param options.prUrl - Full GitHub PR URL
14
+ * @param options.showBots - Include bot comments (default: false)
15
+ * @returns Categorized comments with review, inline, and discussion sections
16
+ * @throws {ValidationError} If the URL is not a valid GitHub PR URL
17
+ */
8
18
  export async function runComments(options) {
9
19
  validateUrl(options.prUrl);
10
20
  validateGitHubUrl(options.prUrl, PR_URL_PATTERN, 'PR');
@@ -96,6 +106,15 @@ export async function runComments(options) {
96
106
  },
97
107
  };
98
108
  }
109
+ /**
110
+ * Post a comment on a GitHub issue or PR.
111
+ *
112
+ * @param options - Post options
113
+ * @param options.url - Full GitHub issue or PR URL
114
+ * @param options.message - Comment body text
115
+ * @returns Object with commentUrl (the new comment's URL) and url (the original issue/PR URL)
116
+ * @throws {ValidationError} If the URL or message is invalid
117
+ */
99
118
  export async function runPost(options) {
100
119
  validateUrl(options.url);
101
120
  validateGitHubUrl(options.url, ISSUE_OR_PR_URL_PATTERN, 'issue or PR');
@@ -122,6 +141,15 @@ export async function runPost(options) {
122
141
  url: options.url,
123
142
  };
124
143
  }
144
+ /**
145
+ * Post a claim comment on a GitHub issue and track it locally.
146
+ *
147
+ * @param options - Claim options
148
+ * @param options.issueUrl - Full GitHub issue URL
149
+ * @param options.message - Custom claim message (default: standard claim text)
150
+ * @returns URLs of the created comment and claimed issue
151
+ * @throws {ValidationError} If the URL or message is invalid
152
+ */
125
153
  export async function runClaim(options) {
126
154
  validateUrl(options.issueUrl);
127
155
  validateGitHubUrl(options.issueUrl, ISSUE_URL_PATTERN, 'issue');
@@ -13,5 +13,16 @@ export interface ConfigSetOutput {
13
13
  value: string;
14
14
  }
15
15
  export type ConfigCommandOutput = ConfigOutput | ConfigSetOutput;
16
+ /**
17
+ * Read or write user configuration settings.
18
+ * When called without a key, returns the full config.
19
+ * When called with a key and value, updates the setting.
20
+ *
21
+ * @param options - Config options
22
+ * @param options.key - Setting key (e.g., 'username', 'add-language', 'exclude-repo')
23
+ * @param options.value - Setting value (required when key is provided)
24
+ * @returns Current config (when reading) or success confirmation (when writing)
25
+ * @throws {Error} If the key is unknown or the value is invalid
26
+ */
16
27
  export declare function runConfig(options: ConfigOptions): Promise<ConfigCommandOutput>;
17
28
  export {};
@@ -11,6 +11,17 @@ function validateScope(value) {
11
11
  }
12
12
  return value;
13
13
  }
14
+ /**
15
+ * Read or write user configuration settings.
16
+ * When called without a key, returns the full config.
17
+ * When called with a key and value, updates the setting.
18
+ *
19
+ * @param options - Config options
20
+ * @param options.key - Setting key (e.g., 'username', 'add-language', 'exclude-repo')
21
+ * @param options.value - Setting value (required when key is provided)
22
+ * @returns Current config (when reading) or success confirmation (when writing)
23
+ * @throws {Error} If the key is unknown or the value is invalid
24
+ */
14
25
  export async function runConfig(options) {
15
26
  const stateManager = getStateManager();
16
27
  const currentConfig = stateManager.getState().config;
@@ -12,6 +12,9 @@ export { applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacit
12
12
  /**
13
13
  * Build a star filter from state for use in fetchUserPRCounts.
14
14
  * Returns undefined if no star data is available (first run).
15
+ *
16
+ * @param state - Current agent state (read-only)
17
+ * @returns Star filter with minimum threshold and known counts, or undefined on first run
15
18
  */
16
19
  export declare function buildStarFilter(state: Readonly<AgentState>): StarFilter | undefined;
17
20
  /**
@@ -43,15 +46,36 @@ export interface DailyCheckResult {
43
46
  * 3. updateAnalytics — store monthly chart data
44
47
  * 4. partitionPRs — shelve/unshelve, generate digest
45
48
  * 5. generateDigestOutput — capacity, dismiss filter, action menu assembly
49
+ *
50
+ * @param token - GitHub personal access token
51
+ * @returns Deduplicated daily output
52
+ * @throws {ConfigurationError} If no GitHub username is configured in state
46
53
  */
47
54
  export declare function executeDailyCheck(token: string): Promise<DailyOutput>;
48
55
  /**
49
- * Run the daily check and return deduplicated DailyOutput.
50
- * Errors propagate to the caller.
56
+ * Run the daily PR check and return a deduplicated digest.
57
+ *
58
+ * Fetches all open PRs from GitHub, computes status for each,
59
+ * updates repo scores, and assembles the action menu.
60
+ *
61
+ * @returns Deduplicated daily output with PR digest, capacity, and action menu
62
+ * @throws {ConfigurationError} If no GitHub token is available
63
+ *
64
+ * @example
65
+ * ```typescript
66
+ * import { runDaily } from '@oss-autopilot/core/commands';
67
+ *
68
+ * const output = await runDaily();
69
+ * console.log(output.briefSummary);
70
+ * console.log(`${output.actionableIssues.length} issues need attention`);
71
+ * ```
51
72
  */
52
73
  export declare function runDaily(): Promise<DailyOutput>;
53
74
  /**
54
75
  * Run the daily check and return the full (non-deduplicated) result.
55
76
  * Used by CLI text mode where printDigest() needs full PR objects.
77
+ *
78
+ * @returns Full daily check result with non-deduplicated PR objects
79
+ * @throws {ConfigurationError} If no GitHub token is available
56
80
  */
57
81
  export declare function runDailyForDisplay(): Promise<DailyCheckResult>;
@@ -19,6 +19,9 @@ export { applyStatusOverrides, computeRepoSignals, groupPRsByRepo, assessCapacit
19
19
  /**
20
20
  * Build a star filter from state for use in fetchUserPRCounts.
21
21
  * Returns undefined if no star data is available (first run).
22
+ *
23
+ * @param state - Current agent state (read-only)
24
+ * @returns Star filter with minimum threshold and known counts, or undefined on first run
22
25
  */
23
26
  export function buildStarFilter(state) {
24
27
  const minStars = state.config.minStars ?? 50;
@@ -402,6 +405,10 @@ function toDailyOutput(result) {
402
405
  * 3. updateAnalytics — store monthly chart data
403
406
  * 4. partitionPRs — shelve/unshelve, generate digest
404
407
  * 5. generateDigestOutput — capacity, dismiss filter, action menu assembly
408
+ *
409
+ * @param token - GitHub personal access token
410
+ * @returns Deduplicated daily output
411
+ * @throws {ConfigurationError} If no GitHub username is configured in state
405
412
  */
406
413
  export async function executeDailyCheck(token) {
407
414
  const result = await executeDailyCheckInternal(token);
@@ -436,8 +443,22 @@ async function executeDailyCheckInternal(token) {
436
443
  return generateDigestOutput(digest, activePRs, shelvedPRs, commentedIssues, failures, previousLastDigestAt);
437
444
  }
438
445
  /**
439
- * Run the daily check and return deduplicated DailyOutput.
440
- * Errors propagate to the caller.
446
+ * Run the daily PR check and return a deduplicated digest.
447
+ *
448
+ * Fetches all open PRs from GitHub, computes status for each,
449
+ * updates repo scores, and assembles the action menu.
450
+ *
451
+ * @returns Deduplicated daily output with PR digest, capacity, and action menu
452
+ * @throws {ConfigurationError} If no GitHub token is available
453
+ *
454
+ * @example
455
+ * ```typescript
456
+ * import { runDaily } from '@oss-autopilot/core/commands';
457
+ *
458
+ * const output = await runDaily();
459
+ * console.log(output.briefSummary);
460
+ * console.log(`${output.actionableIssues.length} issues need attention`);
461
+ * ```
441
462
  */
442
463
  export async function runDaily() {
443
464
  // Token is guaranteed by the preAction hook in cli.ts for non-LOCAL_ONLY_COMMANDS.
@@ -447,6 +468,9 @@ export async function runDaily() {
447
468
  /**
448
469
  * Run the daily check and return the full (non-deduplicated) result.
449
470
  * Used by CLI text mode where printDigest() needs full PR objects.
471
+ *
472
+ * @returns Full daily check result with non-deduplicated PR objects
473
+ * @throws {ConfigurationError} If no GitHub token is available
450
474
  */
451
475
  export async function runDailyForDisplay() {
452
476
  const token = requireGitHubToken();
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Detect formatters command (#703)
3
+ * Scans a local repository for configured formatters/linters.
4
+ * Optionally diagnoses CI log output for formatting failures.
5
+ */
6
+ import type { DetectFormattersOutput } from '../formatters/json.js';
7
+ export type { DetectFormattersOutput };
8
+ export declare function runDetectFormatters(options: {
9
+ repoPath?: string;
10
+ ciLog?: string;
11
+ }): Promise<DetectFormattersOutput>;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * Detect formatters command (#703)
3
+ * Scans a local repository for configured formatters/linters.
4
+ * Optionally diagnoses CI log output for formatting failures.
5
+ */
6
+ import * as fs from 'fs';
7
+ import * as path from 'path';
8
+ import { detectFormatters, diagnoseCIFormatterFailure } from '../core/formatter-detection.js';
9
+ import { errorMessage } from '../core/errors.js';
10
+ export async function runDetectFormatters(options) {
11
+ const repoPath = path.resolve(options.repoPath ?? process.cwd());
12
+ const output = { ...detectFormatters(repoPath) };
13
+ if (options.ciLog) {
14
+ let logContent;
15
+ try {
16
+ logContent = fs.readFileSync(path.resolve(options.ciLog), 'utf-8');
17
+ }
18
+ catch (err) {
19
+ throw new Error(`Failed to read CI log file: ${errorMessage(err)}`, { cause: err });
20
+ }
21
+ output.ciDiagnosis = diagnoseCIFormatterFailure(logContent, repoPath);
22
+ }
23
+ return output;
24
+ }
@@ -11,9 +11,26 @@ export interface UndismissOutput {
11
11
  undismissed: boolean;
12
12
  url: string;
13
13
  }
14
+ /**
15
+ * Dismiss an issue's reply notifications without posting a comment.
16
+ * The dismissal auto-resurfaces when new responses arrive after the dismiss timestamp.
17
+ *
18
+ * @param options - Dismiss options
19
+ * @param options.url - Full GitHub issue URL
20
+ * @returns Whether the issue was newly dismissed (false if already dismissed)
21
+ * @throws {ValidationError} If the URL is not a valid GitHub issue URL
22
+ */
14
23
  export declare function runDismiss(options: {
15
24
  url: string;
16
25
  }): Promise<DismissOutput>;
26
+ /**
27
+ * Restore a dismissed issue to notifications.
28
+ *
29
+ * @param options - Undismiss options
30
+ * @param options.url - Full GitHub issue URL
31
+ * @returns Whether the issue was undismissed (false if not currently dismissed)
32
+ * @throws {ValidationError} If the URL is not a valid GitHub issue URL
33
+ */
17
34
  export declare function runUndismiss(options: {
18
35
  url: string;
19
36
  }): Promise<UndismissOutput>;
@@ -5,6 +5,15 @@
5
5
  */
6
6
  import { getStateManager } from '../core/index.js';
7
7
  import { ISSUE_URL_PATTERN, validateGitHubUrl, validateUrl } from './validation.js';
8
+ /**
9
+ * Dismiss an issue's reply notifications without posting a comment.
10
+ * The dismissal auto-resurfaces when new responses arrive after the dismiss timestamp.
11
+ *
12
+ * @param options - Dismiss options
13
+ * @param options.url - Full GitHub issue URL
14
+ * @returns Whether the issue was newly dismissed (false if already dismissed)
15
+ * @throws {ValidationError} If the URL is not a valid GitHub issue URL
16
+ */
8
17
  export async function runDismiss(options) {
9
18
  validateUrl(options.url);
10
19
  validateGitHubUrl(options.url, ISSUE_URL_PATTERN, 'issue');
@@ -12,6 +21,14 @@ export async function runDismiss(options) {
12
21
  const added = stateManager.dismissIssue(options.url, new Date().toISOString());
13
22
  return { dismissed: added, url: options.url };
14
23
  }
24
+ /**
25
+ * Restore a dismissed issue to notifications.
26
+ *
27
+ * @param options - Undismiss options
28
+ * @param options.url - Full GitHub issue URL
29
+ * @returns Whether the issue was undismissed (false if not currently dismissed)
30
+ * @throws {ValidationError} If the URL is not a valid GitHub issue URL
31
+ */
15
32
  export async function runUndismiss(options) {
16
33
  validateUrl(options.url);
17
34
  validateGitHubUrl(options.url, ISSUE_URL_PATTERN, 'issue');
@@ -59,11 +59,13 @@ export { runCheckSetup } from './setup.js';
59
59
  export { runParseList } from './parse-list.js';
60
60
  /** Check if new files are properly referenced/integrated. */
61
61
  export { runCheckIntegration } from './check-integration.js';
62
+ /** Detect formatters/linters configured in a local repository (#703). */
63
+ export { runDetectFormatters } from './detect-formatters.js';
62
64
  /** Scan for locally cloned repos. */
63
65
  export { runLocalRepos } from './local-repos.js';
64
66
  export type { DailyOutput, SearchOutput, StartupOutput, StatusOutput, TrackOutput } from '../formatters/json.js';
65
67
  export type { VetOutput, CommentsOutput, PostOutput, ClaimOutput } from '../formatters/json.js';
66
- export type { ConfigOutput, ParseIssueListOutput, CheckIntegrationOutput, LocalReposOutput, } from '../formatters/json.js';
68
+ export type { ConfigOutput, DetectFormattersOutput, ParseIssueListOutput, CheckIntegrationOutput, LocalReposOutput, } from '../formatters/json.js';
67
69
  export type { ReadOutput } from './read.js';
68
70
  export type { ShelveOutput, UnshelveOutput } from './shelve.js';
69
71
  export type { MoveOutput, MoveTarget } from './move.js';
@@ -64,5 +64,7 @@ export { runCheckSetup } from './setup.js';
64
64
  export { runParseList } from './parse-list.js';
65
65
  /** Check if new files are properly referenced/integrated. */
66
66
  export { runCheckIntegration } from './check-integration.js';
67
+ /** Detect formatters/linters configured in a local repository (#703). */
68
+ export { runDetectFormatters } from './detect-formatters.js';
67
69
  /** Scan for locally cloned repos. */
68
70
  export { runLocalRepos } from './local-repos.js';
@@ -6,6 +6,14 @@ export interface InitOutput {
6
6
  username: string;
7
7
  message: string;
8
8
  }
9
+ /**
10
+ * Initialize with a GitHub username.
11
+ *
12
+ * @param options - Init options
13
+ * @param options.username - GitHub username to configure
14
+ * @returns Confirmation with username and next-step instructions
15
+ * @throws {ValidationError} If the username is invalid
16
+ */
9
17
  export declare function runInit(options: {
10
18
  username: string;
11
19
  }): Promise<InitOutput>;
@@ -4,6 +4,14 @@
4
4
  */
5
5
  import { getStateManager } from '../core/index.js';
6
6
  import { validateGitHubUsername } from './validation.js';
7
+ /**
8
+ * Initialize with a GitHub username.
9
+ *
10
+ * @param options - Init options
11
+ * @param options.username - GitHub username to configure
12
+ * @returns Confirmation with username and next-step instructions
13
+ * @throws {ValidationError} If the username is invalid
14
+ */
7
15
  export async function runInit(options) {
8
16
  validateGitHubUsername(options.username);
9
17
  const stateManager = getStateManager();
@@ -10,6 +10,16 @@ export interface MoveOutput {
10
10
  /** Human-readable description of what happened. */
11
11
  description: string;
12
12
  }
13
+ /**
14
+ * Move a PR between states: attention, waiting, shelved, or auto (computed).
15
+ *
16
+ * @param options - Move options
17
+ * @param options.prUrl - Full GitHub PR URL
18
+ * @param options.target - Target state: 'attention' | 'waiting' | 'shelved' | 'auto'
19
+ * @returns The move result with a human-readable description
20
+ * @throws {ValidationError} If the URL is not a valid GitHub PR URL
21
+ * @throws {Error} If the target is invalid
22
+ */
13
23
  export declare function runMove(options: {
14
24
  prUrl: string;
15
25
  target: string;
@@ -5,6 +5,16 @@
5
5
  import { getStateManager } from '../core/index.js';
6
6
  import { PR_URL_PATTERN, validateGitHubUrl, validateUrl } from './validation.js';
7
7
  export const VALID_TARGETS = ['attention', 'waiting', 'shelved', 'auto'];
8
+ /**
9
+ * Move a PR between states: attention, waiting, shelved, or auto (computed).
10
+ *
11
+ * @param options - Move options
12
+ * @param options.prUrl - Full GitHub PR URL
13
+ * @param options.target - Target state: 'attention' | 'waiting' | 'shelved' | 'auto'
14
+ * @returns The move result with a human-readable description
15
+ * @throws {ValidationError} If the URL is not a valid GitHub PR URL
16
+ * @throws {Error} If the target is invalid
17
+ */
8
18
  export async function runMove(options) {
9
19
  validateUrl(options.prUrl);
10
20
  validateGitHubUrl(options.prUrl, PR_URL_PATTERN, 'PR');
@@ -7,4 +7,22 @@ export { type SearchOutput } from '../formatters/json.js';
7
7
  interface SearchOptions {
8
8
  maxResults: number;
9
9
  }
10
+ /**
11
+ * Search GitHub for contributable issues using multi-phase discovery.
12
+ *
13
+ * @param options - Search configuration
14
+ * @param options.maxResults - Maximum number of candidates to return
15
+ * @returns Search results with scored candidates and exclusion lists
16
+ * @throws {ConfigurationError} If no GitHub token is available
17
+ *
18
+ * @example
19
+ * ```typescript
20
+ * import { runSearch } from '@oss-autopilot/core/commands';
21
+ *
22
+ * const results = await runSearch({ maxResults: 10 });
23
+ * for (const c of results.candidates) {
24
+ * console.log(`${c.issue.repo}#${c.issue.number} — ${c.viabilityScore}/100`);
25
+ * }
26
+ * ```
27
+ */
10
28
  export declare function runSearch(options: SearchOptions): Promise<SearchOutput>;
@@ -3,6 +3,24 @@
3
3
  * Searches for new issues to work on
4
4
  */
5
5
  import { IssueDiscovery, requireGitHubToken, getStateManager, DEFAULT_CONFIG } from '../core/index.js';
6
+ /**
7
+ * Search GitHub for contributable issues using multi-phase discovery.
8
+ *
9
+ * @param options - Search configuration
10
+ * @param options.maxResults - Maximum number of candidates to return
11
+ * @returns Search results with scored candidates and exclusion lists
12
+ * @throws {ConfigurationError} If no GitHub token is available
13
+ *
14
+ * @example
15
+ * ```typescript
16
+ * import { runSearch } from '@oss-autopilot/core/commands';
17
+ *
18
+ * const results = await runSearch({ maxResults: 10 });
19
+ * for (const c of results.candidates) {
20
+ * console.log(`${c.issue.repo}#${c.issue.number} — ${c.viabilityScore}/100`);
21
+ * }
22
+ * ```
23
+ */
6
24
  export async function runSearch(options) {
7
25
  const token = requireGitHubToken();
8
26
  const discovery = new IssueDiscovery(token);
@@ -43,6 +43,23 @@ export interface CheckSetupOutput {
43
43
  setupComplete: boolean;
44
44
  username: string;
45
45
  }
46
+ /**
47
+ * Interactive setup wizard or direct setting application.
48
+ *
49
+ * Three modes:
50
+ * 1. `--set key=value` — Apply settings directly
51
+ * 2. Setup complete — Return current config
52
+ * 3. Setup required — Return prompts for interactive setup
53
+ *
54
+ * @param options - Setup options
55
+ * @param options.reset - Force re-setup even if already complete
56
+ * @param options.set - Key=value pairs to apply directly
57
+ * @returns Setup result (applied settings, current config, or setup prompts)
58
+ */
46
59
  export declare function runSetup(options: SetupOptions): Promise<SetupOutput>;
60
+ /**
61
+ * Check whether initial setup has been completed.
62
+ * @returns Setup status and configured username
63
+ */
47
64
  export declare function runCheckSetup(): Promise<CheckSetupOutput>;
48
65
  export {};
@@ -14,6 +14,19 @@ function parsePositiveInt(value, settingName) {
14
14
  }
15
15
  return parsed;
16
16
  }
17
+ /**
18
+ * Interactive setup wizard or direct setting application.
19
+ *
20
+ * Three modes:
21
+ * 1. `--set key=value` — Apply settings directly
22
+ * 2. Setup complete — Return current config
23
+ * 3. Setup required — Return prompts for interactive setup
24
+ *
25
+ * @param options - Setup options
26
+ * @param options.reset - Force re-setup even if already complete
27
+ * @param options.set - Key=value pairs to apply directly
28
+ * @returns Setup result (applied settings, current config, or setup prompts)
29
+ */
17
30
  export async function runSetup(options) {
18
31
  const stateManager = getStateManager();
19
32
  const config = stateManager.getState().config;
@@ -292,6 +305,10 @@ export async function runSetup(options) {
292
305
  ],
293
306
  };
294
307
  }
308
+ /**
309
+ * Check whether initial setup has been completed.
310
+ * @returns Setup status and configured username
311
+ */
295
312
  export async function runCheckSetup() {
296
313
  const stateManager = getStateManager();
297
314
  return {
@@ -17,9 +17,25 @@ export interface UnshelveOutput {
17
17
  url: string;
18
18
  }
19
19
  export { PR_URL_PATTERN };
20
+ /**
21
+ * Shelve a PR, hiding it from daily digest and capacity calculations.
22
+ *
23
+ * @param options - Shelve options
24
+ * @param options.prUrl - Full GitHub PR URL
25
+ * @returns Whether the PR was newly shelved (false if already shelved)
26
+ * @throws {ValidationError} If the URL is not a valid GitHub PR URL
27
+ */
20
28
  export declare function runShelve(options: {
21
29
  prUrl: string;
22
30
  }): Promise<ShelveOutput>;
31
+ /**
32
+ * Unshelve a PR, restoring it to the daily digest.
33
+ *
34
+ * @param options - Unshelve options
35
+ * @param options.prUrl - Full GitHub PR URL
36
+ * @returns Whether the PR was removed from the shelf (false if not shelved)
37
+ * @throws {ValidationError} If the URL is not a valid GitHub PR URL
38
+ */
23
39
  export declare function runUnshelve(options: {
24
40
  prUrl: string;
25
41
  }): Promise<UnshelveOutput>;
@@ -11,6 +11,14 @@ import { getStateManager } from '../core/index.js';
11
11
  import { PR_URL_PATTERN, validateGitHubUrl, validateUrl } from './validation.js';
12
12
  // Re-export for backward compatibility with tests
13
13
  export { PR_URL_PATTERN };
14
+ /**
15
+ * Shelve a PR, hiding it from daily digest and capacity calculations.
16
+ *
17
+ * @param options - Shelve options
18
+ * @param options.prUrl - Full GitHub PR URL
19
+ * @returns Whether the PR was newly shelved (false if already shelved)
20
+ * @throws {ValidationError} If the URL is not a valid GitHub PR URL
21
+ */
14
22
  export async function runShelve(options) {
15
23
  validateUrl(options.prUrl);
16
24
  validateGitHubUrl(options.prUrl, PR_URL_PATTERN, 'PR');
@@ -22,6 +30,14 @@ export async function runShelve(options) {
22
30
  });
23
31
  return { shelved: added, url: options.prUrl };
24
32
  }
33
+ /**
34
+ * Unshelve a PR, restoring it to the daily digest.
35
+ *
36
+ * @param options - Unshelve options
37
+ * @param options.prUrl - Full GitHub PR URL
38
+ * @returns Whether the PR was removed from the shelf (false if not shelved)
39
+ * @throws {ValidationError} If the URL is not a valid GitHub PR URL
40
+ */
25
41
  export async function runUnshelve(options) {
26
42
  validateUrl(options.prUrl);
27
43
  validateGitHubUrl(options.prUrl, PR_URL_PATTERN, 'PR');
@@ -9,13 +9,17 @@
9
9
  import { type StartupOutput, type IssueListInfo } from '../formatters/json.js';
10
10
  /**
11
11
  * Parse issueListPath from a config file's YAML frontmatter.
12
- * Returns the path string or undefined if not found.
12
+ * @param configContent - Raw content of the config.md file
13
+ * @returns The path string or undefined if not found
13
14
  */
14
15
  export declare function parseIssueListPathFromConfig(configContent: string): string | undefined;
15
16
  /**
16
17
  * Count available and completed items in an issue list file.
17
- * Available: list items (- [) NOT struck through or marked Done.
18
+ * Available: list items (`- [`) NOT struck through or marked Done.
18
19
  * Completed: list items that ARE struck through or marked Done.
20
+ *
21
+ * @param content - Raw markdown content of the issue list
22
+ * @returns Counts of available and completed items
19
23
  */
20
24
  export declare function countIssueListItems(content: string): {
21
25
  availableCount: number;
@@ -23,17 +27,22 @@ export declare function countIssueListItems(content: string): {
23
27
  };
24
28
  /**
25
29
  * Detect an issue list file from config or known paths.
26
- * Returns IssueListInfo or undefined if no list found.
30
+ * @returns Issue list info with path and item counts, or undefined if not found
27
31
  */
28
32
  export declare function detectIssueList(): IssueListInfo | undefined;
33
+ /**
34
+ * Open a URL in the default system browser.
35
+ * @param url - URL to open
36
+ */
29
37
  export declare function openInBrowser(url: string): void;
30
38
  /**
31
39
  * Run startup checks and return structured output.
32
40
  * Returns StartupOutput with one of three shapes:
33
- * 1. Setup incomplete: { version, setupComplete: false }
34
- * 2. Auth failure: { version, setupComplete: true, authError: "..." }
35
- * 3. Success: { version, setupComplete: true, daily, dashboardUrl?, issueList? }
41
+ * 1. Setup incomplete: `{ version, setupComplete: false }`
42
+ * 2. Auth failure: `{ version, setupComplete: true, authError: "..." }`
43
+ * 3. Success: `{ version, setupComplete: true, daily, dashboardUrl?, issueList? }`
36
44
  *
37
- * Errors from the daily check propagate to the caller.
45
+ * @returns Startup output with auth/setup status and daily digest
46
+ * @throws {Error} If the daily check fails (auth or network errors propagate)
38
47
  */
39
48
  export declare function runStartup(): Promise<StartupOutput>;