@oss-autopilot/core 3.10.0 → 3.11.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 (38) hide show
  1. package/dist/cli-registry.d.ts +7 -0
  2. package/dist/cli-registry.js +29 -5
  3. package/dist/cli.bundle.cjs +114 -114
  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.js +47 -2
  8. package/dist/commands/dashboard-data.d.ts +17 -0
  9. package/dist/commands/dashboard-data.js +49 -0
  10. package/dist/commands/dashboard-server.js +93 -24
  11. package/dist/commands/dismiss.d.ts +4 -0
  12. package/dist/commands/dismiss.js +4 -4
  13. package/dist/commands/guidelines.d.ts +19 -0
  14. package/dist/commands/guidelines.js +23 -4
  15. package/dist/commands/index.d.ts +3 -1
  16. package/dist/commands/index.js +2 -0
  17. package/dist/commands/move.d.ts +2 -0
  18. package/dist/commands/move.js +12 -8
  19. package/dist/commands/repo-vet.js +30 -8
  20. package/dist/commands/shelve.d.ts +4 -0
  21. package/dist/commands/shelve.js +4 -4
  22. package/dist/core/gist-state-store.js +42 -7
  23. package/dist/core/index.d.ts +1 -1
  24. package/dist/core/index.js +1 -1
  25. package/dist/core/issue-conversation.js +15 -2
  26. package/dist/core/paths.d.ts +12 -0
  27. package/dist/core/paths.js +16 -0
  28. package/dist/core/pr-comments-fetcher.d.ts +10 -2
  29. package/dist/core/pr-comments-fetcher.js +22 -4
  30. package/dist/core/state-persistence.d.ts +31 -9
  31. package/dist/core/state-persistence.js +51 -16
  32. package/dist/core/state.d.ts +18 -1
  33. package/dist/core/state.js +35 -3
  34. package/dist/core/untrusted-content.d.ts +24 -3
  35. package/dist/core/untrusted-content.js +31 -3
  36. package/dist/formatters/json.d.ts +9 -1
  37. package/dist/formatters/json.js +12 -0
  38. 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));
@@ -654,6 +659,9 @@ export const commands = [
654
659
  .option('--json', 'Output as JSON')
655
660
  .action((prUrl, options) => executeAction(options, async () => (await import('./commands/comments.js')).runComments({ prUrl, showBots: options.bots }), async (data) => {
656
661
  const { formatRelativeTime } = await import('./core/dates.js');
662
+ // Bodies arrive `<github-content>`-fenced for agent consumers
663
+ // (#1372); unwrap for human terminal display.
664
+ const { safeExtractFromFence } = await import('./core/untrusted-content.js');
657
665
  console.log(`\nFetching comments for: ${prUrl}\n`);
658
666
  console.log(`## ${data.pr.title}\n`);
659
667
  console.log(`**Status:** ${data.pr.state} | **Mergeable:** ${data.pr.mergeable ?? 'checking...'}`);
@@ -670,7 +678,7 @@ export const commands = [
670
678
  const time = review.submittedAt ? formatRelativeTime(review.submittedAt) : '';
671
679
  console.log(`${state} **@${review.user}** (${review.state}) - ${time}`);
672
680
  if (review.body) {
673
- console.log(`> ${review.body.split('\n').join('\n> ')}\n`);
681
+ console.log(`> ${safeExtractFromFence(review.body).split('\n').join('\n> ')}\n`);
674
682
  }
675
683
  }
676
684
  }
@@ -679,7 +687,7 @@ export const commands = [
679
687
  for (const comment of data.reviewComments) {
680
688
  const time = formatRelativeTime(comment.createdAt);
681
689
  console.log(`**@${comment.user}** on \`${comment.path}\` - ${time}`);
682
- console.log(`> ${comment.body.split('\n').join('\n> ')}`);
690
+ console.log(`> ${safeExtractFromFence(comment.body).split('\n').join('\n> ')}`);
683
691
  console.log('');
684
692
  }
685
693
  }
@@ -688,7 +696,7 @@ export const commands = [
688
696
  for (const comment of data.issueComments) {
689
697
  const time = formatRelativeTime(comment.createdAt);
690
698
  console.log(`**@${comment.user}** - ${time}`);
691
- console.log(`> ${comment.body?.split('\n').join('\n> ')}\n`);
699
+ console.log(`> ${comment.body == null ? '' : safeExtractFromFence(comment.body).split('\n').join('\n> ')}\n`);
692
700
  }
693
701
  }
694
702
  if (data.reviewComments.length === 0 && data.issueComments.length === 0 && data.reviews.length === 0) {
@@ -1375,6 +1383,22 @@ export const commands = [
1375
1383
  const group = program
1376
1384
  .command('guidelines')
1377
1385
  .description('Manage per-repo learning guidelines extracted from PR feedback (#867)');
1386
+ group
1387
+ .command('list')
1388
+ .description('List repos with stored guidelines (always empty in local mode)')
1389
+ .option('--json', 'Output as JSON')
1390
+ .action(async (options) => {
1391
+ await executeAction(options, async () => (await import('./commands/guidelines.js')).runGuidelinesList(), (data) => {
1392
+ if (data.count === 0) {
1393
+ console.log(`No guidelines stored for any repo (storage: ${data.storageMode}).`);
1394
+ }
1395
+ else {
1396
+ console.log(`${data.count} repo(s) with stored guidelines:`);
1397
+ for (const repo of data.repos)
1398
+ console.log(` ${repo}`);
1399
+ }
1400
+ });
1401
+ });
1378
1402
  group
1379
1403
  .command('view')
1380
1404
  .description('Read the per-repo guidelines file (returns null when none exists or in local mode)')