@oss-autopilot/core 3.10.0 → 3.12.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 (52) hide show
  1. package/dist/cli-registry.d.ts +7 -0
  2. package/dist/cli-registry.js +58 -5
  3. package/dist/cli.bundle.cjs +165 -112
  4. package/dist/cli.js +11 -3
  5. package/dist/commands/comments.js +31 -15
  6. package/dist/commands/compliance-score.js +12 -4
  7. package/dist/commands/daily-render.d.ts +2 -1
  8. package/dist/commands/daily-render.js +8 -2
  9. package/dist/commands/daily.d.ts +3 -1
  10. package/dist/commands/daily.js +54 -4
  11. package/dist/commands/dashboard-data.d.ts +17 -0
  12. package/dist/commands/dashboard-data.js +62 -4
  13. package/dist/commands/dashboard-server.js +100 -26
  14. package/dist/commands/dismiss.d.ts +4 -0
  15. package/dist/commands/dismiss.js +4 -4
  16. package/dist/commands/guidelines.d.ts +19 -0
  17. package/dist/commands/guidelines.js +23 -4
  18. package/dist/commands/index.d.ts +5 -1
  19. package/dist/commands/index.js +4 -0
  20. package/dist/commands/list-move-tier.d.ts +11 -3
  21. package/dist/commands/list-move-tier.js +18 -7
  22. package/dist/commands/move.d.ts +2 -0
  23. package/dist/commands/move.js +12 -8
  24. package/dist/commands/repo-vet.js +30 -8
  25. package/dist/commands/search.js +17 -3
  26. package/dist/commands/shelve.d.ts +4 -0
  27. package/dist/commands/shelve.js +4 -4
  28. package/dist/commands/verify-issue.d.ts +20 -0
  29. package/dist/commands/verify-issue.js +32 -0
  30. package/dist/core/daily-logic.js +65 -52
  31. package/dist/core/gist-state-store.js +42 -7
  32. package/dist/core/index.d.ts +3 -1
  33. package/dist/core/index.js +3 -1
  34. package/dist/core/issue-conversation.js +15 -2
  35. package/dist/core/issue-verification.d.ts +91 -0
  36. package/dist/core/issue-verification.js +270 -0
  37. package/dist/core/paths.d.ts +12 -0
  38. package/dist/core/paths.js +16 -0
  39. package/dist/core/pr-attention.d.ts +52 -0
  40. package/dist/core/pr-attention.js +76 -0
  41. package/dist/core/pr-comments-fetcher.d.ts +10 -2
  42. package/dist/core/pr-comments-fetcher.js +22 -4
  43. package/dist/core/state-persistence.d.ts +31 -9
  44. package/dist/core/state-persistence.js +51 -16
  45. package/dist/core/state.d.ts +18 -1
  46. package/dist/core/state.js +35 -3
  47. package/dist/core/types.d.ts +7 -0
  48. package/dist/core/untrusted-content.d.ts +24 -3
  49. package/dist/core/untrusted-content.js +31 -3
  50. package/dist/formatters/json.d.ts +83 -2
  51. package/dist/formatters/json.js +55 -1
  52. package/package.json +7 -7
@@ -17,5 +17,12 @@ interface CLICommandDef {
17
17
  /** Register this command on the given Commander program. */
18
18
  register(program: Command): void;
19
19
  }
20
+ /**
21
+ * Shared error handler for CLI action catch blocks. Exported so cli.ts can
22
+ * route preAction-hook rejections (corrupt Gist, missing gist scope, rate
23
+ * limit during bootstrap) through the same formatting instead of letting
24
+ * them surface as raw unhandled rejections (#1386).
25
+ */
26
+ export declare function handleCommandError(err: unknown, json?: boolean): never;
20
27
  export declare const commands: CLICommandDef[];
21
28
  export {};
@@ -10,8 +10,13 @@
10
10
  */
11
11
  import { errorMessage, resolveErrorCode } from './core/errors.js';
12
12
  import { outputJson, outputJsonError, outputJsonValidated } from './formatters/json.js';
13
- /** Shared error handler for CLI action catch blocks. */
14
- function handleCommandError(err, json) {
13
+ /**
14
+ * Shared error handler for CLI action catch blocks. Exported so cli.ts can
15
+ * route preAction-hook rejections (corrupt Gist, missing gist scope, rate
16
+ * limit during bootstrap) through the same formatting instead of letting
17
+ * them surface as raw unhandled rejections (#1386).
18
+ */
19
+ export function handleCommandError(err, json) {
15
20
  const msg = errorMessage(err);
16
21
  if (json) {
17
22
  outputJsonError(msg, resolveErrorCode(err));
@@ -306,6 +311,9 @@ export const commands = [
306
311
  }
307
312
  return runSearch({ maxResults });
308
313
  }, (data) => {
314
+ if (data.hiddenOwnPRCount > 0) {
315
+ console.log(`Hidden: ${data.hiddenOwnPRCount} candidate(s) were issues you already have open PRs for.`);
316
+ }
309
317
  if (data.candidates.length === 0) {
310
318
  if (data.rateLimitWarning) {
311
319
  console.warn(`\n${data.rateLimitWarning}\n`);
@@ -446,6 +454,32 @@ export const commands = [
446
454
  }));
447
455
  },
448
456
  },
457
+ // ── Verify Issue ───────────────────────────────────────────────────────
458
+ {
459
+ name: 'verify-issue',
460
+ register(program) {
461
+ program
462
+ .command('verify-issue <issue-url>')
463
+ .description('Deterministically verify issue state and linked-PR claims before vetting (#1353, #1354)')
464
+ .option('--json', 'Output as JSON')
465
+ .action(async (issueUrl, options) => {
466
+ const { VerifyIssueOutputSchema } = await import('./formatters/json.js');
467
+ await executeAction(options, async () => (await import('./commands/verify-issue.js')).runVerifyIssue({ issueUrl }), (data) => {
468
+ console.log(`\n${data.owner}/${data.repo}#${data.number}: ${data.title}`);
469
+ const reasonLabel = data.stateReason ? ` (${data.stateReason})` : '';
470
+ console.log(` State: ${data.state}${reasonLabel}${data.closedAt ? ` — closed ${data.closedAt}` : ''}`);
471
+ console.log(` Verdict: ${data.verdict} — ${data.verdictReason}`);
472
+ if (data.assignees.length > 0)
473
+ console.log(` Assignees: ${data.assignees.join(', ')}`);
474
+ for (const pr of data.linkedPRs) {
475
+ const own = pr.isOwn ? ' (yours)' : '';
476
+ const draft = pr.isDraft ? ' [draft]' : '';
477
+ console.log(` PR #${pr.number} [${pr.state}]${draft} ${pr.linkType} by ${pr.author ?? 'ghost'}${own}: ${pr.url}`);
478
+ }
479
+ }, VerifyIssueOutputSchema);
480
+ });
481
+ },
482
+ },
449
483
  // ── Vet List ──────────────────────────────────────────────────────────
450
484
  {
451
485
  name: 'vet-list',
@@ -654,6 +688,9 @@ export const commands = [
654
688
  .option('--json', 'Output as JSON')
655
689
  .action((prUrl, options) => executeAction(options, async () => (await import('./commands/comments.js')).runComments({ prUrl, showBots: options.bots }), async (data) => {
656
690
  const { formatRelativeTime } = await import('./core/dates.js');
691
+ // Bodies arrive `<github-content>`-fenced for agent consumers
692
+ // (#1372); unwrap for human terminal display.
693
+ const { safeExtractFromFence } = await import('./core/untrusted-content.js');
657
694
  console.log(`\nFetching comments for: ${prUrl}\n`);
658
695
  console.log(`## ${data.pr.title}\n`);
659
696
  console.log(`**Status:** ${data.pr.state} | **Mergeable:** ${data.pr.mergeable ?? 'checking...'}`);
@@ -670,7 +707,7 @@ export const commands = [
670
707
  const time = review.submittedAt ? formatRelativeTime(review.submittedAt) : '';
671
708
  console.log(`${state} **@${review.user}** (${review.state}) - ${time}`);
672
709
  if (review.body) {
673
- console.log(`> ${review.body.split('\n').join('\n> ')}\n`);
710
+ console.log(`> ${safeExtractFromFence(review.body).split('\n').join('\n> ')}\n`);
674
711
  }
675
712
  }
676
713
  }
@@ -679,7 +716,7 @@ export const commands = [
679
716
  for (const comment of data.reviewComments) {
680
717
  const time = formatRelativeTime(comment.createdAt);
681
718
  console.log(`**@${comment.user}** on \`${comment.path}\` - ${time}`);
682
- console.log(`> ${comment.body.split('\n').join('\n> ')}`);
719
+ console.log(`> ${safeExtractFromFence(comment.body).split('\n').join('\n> ')}`);
683
720
  console.log('');
684
721
  }
685
722
  }
@@ -688,7 +725,7 @@ export const commands = [
688
725
  for (const comment of data.issueComments) {
689
726
  const time = formatRelativeTime(comment.createdAt);
690
727
  console.log(`**@${comment.user}** - ${time}`);
691
- console.log(`> ${comment.body?.split('\n').join('\n> ')}\n`);
728
+ console.log(`> ${comment.body == null ? '' : safeExtractFromFence(comment.body).split('\n').join('\n> ')}\n`);
692
729
  }
693
730
  }
694
731
  if (data.reviewComments.length === 0 && data.issueComments.length === 0 && data.reviews.length === 0) {
@@ -1375,6 +1412,22 @@ export const commands = [
1375
1412
  const group = program
1376
1413
  .command('guidelines')
1377
1414
  .description('Manage per-repo learning guidelines extracted from PR feedback (#867)');
1415
+ group
1416
+ .command('list')
1417
+ .description('List repos with stored guidelines (always empty in local mode)')
1418
+ .option('--json', 'Output as JSON')
1419
+ .action(async (options) => {
1420
+ await executeAction(options, async () => (await import('./commands/guidelines.js')).runGuidelinesList(), (data) => {
1421
+ if (data.count === 0) {
1422
+ console.log(`No guidelines stored for any repo (storage: ${data.storageMode}).`);
1423
+ }
1424
+ else {
1425
+ console.log(`${data.count} repo(s) with stored guidelines:`);
1426
+ for (const repo of data.repos)
1427
+ console.log(` ${repo}`);
1428
+ }
1429
+ });
1430
+ });
1378
1431
  group
1379
1432
  .command('view')
1380
1433
  .description('Read the per-repo guidelines file (returns null when none exists or in local mode)')