@oss-autopilot/core 3.28.0 → 3.29.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 (50) hide show
  1. package/dist/cli-pre-action.d.ts +9 -0
  2. package/dist/cli-pre-action.js +95 -0
  3. package/dist/cli-registry.js +5 -1
  4. package/dist/cli.bundle.cjs +116 -116
  5. package/dist/cli.js +4 -87
  6. package/dist/commands/comments.js +3 -1
  7. package/dist/commands/daily.js +32 -6
  8. package/dist/commands/dashboard-server.js +1 -1
  9. package/dist/commands/dashboard.d.ts +2 -2
  10. package/dist/commands/dashboard.js +13 -5
  11. package/dist/commands/guidelines.d.ts +8 -0
  12. package/dist/commands/guidelines.js +2 -1
  13. package/dist/commands/overnight-handoff.d.ts +59 -0
  14. package/dist/commands/overnight-handoff.js +212 -0
  15. package/dist/commands/overnight-push-prep.d.ts +7 -0
  16. package/dist/commands/overnight-push-prep.js +97 -25
  17. package/dist/commands/overnight.d.ts +22 -1
  18. package/dist/commands/overnight.js +68 -7
  19. package/dist/core/ci-analysis.js +11 -4
  20. package/dist/core/errors.d.ts +17 -0
  21. package/dist/core/errors.js +25 -0
  22. package/dist/core/pr-monitor.d.ts +2 -2
  23. package/dist/core/pr-monitor.js +9 -6
  24. package/dist/core/repo-score-manager.js +23 -2
  25. package/dist/core/review-analysis.d.ts +6 -2
  26. package/dist/core/review-analysis.js +13 -4
  27. package/dist/core/state-persistence.js +25 -11
  28. package/dist/core/status-determination.js +10 -1
  29. package/dist/core/types.d.ts +1 -1
  30. package/dist/dashboard/assets/chart-panel-0drzwc3-.js +3 -0
  31. package/dist/dashboard/assets/confetti.module-BYDB1iN2.js +2 -0
  32. package/dist/dashboard/assets/index-C0LCGMVi.js +50 -0
  33. package/dist/dashboard/assets/index-CTiG-vjC.css +1 -0
  34. package/dist/dashboard/assets/jetbrains-mono-latin-400-normal-6-qcROiO.woff +0 -0
  35. package/dist/dashboard/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  36. package/dist/dashboard/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  37. package/dist/dashboard/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
  38. package/dist/dashboard/assets/plus-jakarta-sans-latin-400-normal-BDKaGhyp.woff +0 -0
  39. package/dist/dashboard/assets/plus-jakarta-sans-latin-400-normal-Dhut76fR.woff2 +0 -0
  40. package/dist/dashboard/assets/plus-jakarta-sans-latin-500-normal-Bf-nb4oT.woff2 +0 -0
  41. package/dist/dashboard/assets/plus-jakarta-sans-latin-500-normal-DYtqi0QS.woff +0 -0
  42. package/dist/dashboard/assets/plus-jakarta-sans-latin-600-normal-BR_Ojra4.woff +0 -0
  43. package/dist/dashboard/assets/plus-jakarta-sans-latin-600-normal-DLTa1BUW.woff2 +0 -0
  44. package/dist/dashboard/assets/plus-jakarta-sans-latin-700-normal-CfpNZvy6.woff2 +0 -0
  45. package/dist/dashboard/assets/plus-jakarta-sans-latin-700-normal-DqEcQeE5.woff +0 -0
  46. package/dist/dashboard/assets/plus-jakarta-sans-latin-800-normal-BRNHt2w0.woff +0 -0
  47. package/dist/dashboard/assets/plus-jakarta-sans-latin-800-normal-CusIZhrK.woff2 +0 -0
  48. package/dist/dashboard/favicon.svg +83 -0
  49. package/dist/dashboard/index.html +54 -0
  50. package/package.json +3 -2
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The CLI's preAction hook: debug flag, auth gate, and Gist persistence
3
+ * bootstrap. Lives outside cli.ts because cli.ts parses argv and may call
4
+ * process.exit at import time, so nothing in it can be imported by a test.
5
+ * Tests previously exercised a hand-copied replica of this hook, which drifted.
6
+ */
7
+ import type { Command } from 'commander';
8
+ /** Install the preAction hook. `localOnlySet` holds the registry names that skip the auth gate. */
9
+ export declare function installPreAction(program: Command, localOnlySet: ReadonlySet<string>): void;
@@ -0,0 +1,95 @@
1
+ /**
2
+ * The CLI's preAction hook: debug flag, auth gate, and Gist persistence
3
+ * bootstrap. Lives outside cli.ts because cli.ts parses argv and may call
4
+ * process.exit at import time, so nothing in it can be imported by a test.
5
+ * Tests previously exercised a hand-copied replica of this hook, which drifted.
6
+ */
7
+ import { getGitHubTokenAsync, enableDebug, debug } from './core/index.js';
8
+ /** Install the preAction hook. `localOnlySet` holds the registry names that skip the auth gate. */
9
+ export function installPreAction(program, localOnlySet) {
10
+ program.hook('preAction', async (thisCommand, actionCommand) => {
11
+ // Enable debug logging if --debug flag is set
12
+ const globalOpts = thisCommand.opts();
13
+ if (globalOpts.debug) {
14
+ enableDebug();
15
+ debug('cli', `Running command: ${actionCommand.name()}`);
16
+ }
17
+ // actionCommand is the command being executed (e.g., 'status', 'daily').
18
+ // For subcommand groups (e.g. `guidelines view`), Commander returns the
19
+ // leaf name `view` — but the registry sets `localOnly` on the parent
20
+ // entry `guidelines`. Walk the parent chain so a `localOnly` ancestor
21
+ // covers all its leaves (#1208 M2). Without this, `guidelines view` —
22
+ // which works fine in local mode (returns storageMode: 'local-unavailable')
23
+ // — would still hit the auth gate and fail.
24
+ let cmd = actionCommand;
25
+ let isLocalOnly = false;
26
+ while (cmd) {
27
+ if (localOnlySet.has(cmd.name())) {
28
+ isLocalOnly = true;
29
+ break;
30
+ }
31
+ cmd = cmd.parent;
32
+ }
33
+ if (!isLocalOnly) {
34
+ const token = await getGitHubTokenAsync();
35
+ if (!token) {
36
+ // Honor --json at the CLI boundary so machine consumers (plugins, MCP
37
+ // stdio harnesses, scripts) get a parseable envelope instead of a
38
+ // stderr blob followed by a non-zero exit. Commander has already parsed
39
+ // the action's own options, so we check both the action command and the
40
+ // raw argv as a fallback (#1056 M20).
41
+ const wantsJson = Boolean(actionCommand.opts().json) || process.argv.includes('--json');
42
+ if (wantsJson) {
43
+ const { outputJsonError } = await import('./formatters/json.js');
44
+ outputJsonError('GitHub authentication required. Install gh CLI and run `gh auth login`, or set GITHUB_TOKEN.', 'AUTH_REQUIRED');
45
+ }
46
+ else {
47
+ console.error('Error: GitHub authentication required.');
48
+ console.error('');
49
+ console.error('Option 1 (Recommended): Install and authenticate GitHub CLI');
50
+ console.error(' Install: https://cli.github.com/');
51
+ console.error(' Then run: gh auth login');
52
+ console.error('');
53
+ console.error('Option 2: Set GITHUB_TOKEN environment variable');
54
+ console.error(' export GITHUB_TOKEN="your-github-token-here"');
55
+ console.error('');
56
+ console.error('Then run your command again.');
57
+ }
58
+ process.exit(1);
59
+ }
60
+ // Activate Gist persistence if configured, before any command runs.
61
+ // Shared helper peeks at the state file and only pre-sets the singleton
62
+ // when Gist mode is the configured persistence (#1000). Hard errors
63
+ // still throw (#1202); the resolving degraded modes are surfaced in the
64
+ // JSON envelope so --json consumers see them too (#1433).
65
+ const { ensureGistPersistence, renderGistWarning } = await import('./core/index.js');
66
+ const status = await ensureGistPersistence(token);
67
+ if (status === 'degraded' || status === 'state-unreadable') {
68
+ const { setEnvelopeGistWarning } = await import('./formatters/json.js');
69
+ // Shared renderer (#1444). 'degraded' is ensureGistPersistence's
70
+ // deliberate conflation of the transient init fallback and a #1443
71
+ // degraded bootstrap — rendered as the init-fallback cause, as before.
72
+ setEnvelopeGistWarning(renderGistWarning(status === 'degraded' ? 'init-fallback' : 'state-unreadable'));
73
+ }
74
+ }
75
+ else {
76
+ // #1431: localOnly skips the AUTH GATE, not gist persistence. Mutating
77
+ // localOnly commands (shelve/move/dismiss/override/...) already call
78
+ // maybeCheckpoint, which silently no-ops when the singleton never
79
+ // bootstrapped — so a gist-configured user's CLI mutations were written
80
+ // local-only with no warning and never reached the Gist. Best-effort
81
+ // bootstrap; the warning semantics live (and are unit-tested) in
82
+ // bootstrapGistBestEffort.
83
+ const { bootstrapGistBestEffort } = await import('./core/index.js');
84
+ const localOnlyWarning = await bootstrapGistBestEffort(getGitHubTokenAsync);
85
+ if (localOnlyWarning) {
86
+ console.error(`Warning: ${localOnlyWarning}`);
87
+ // Also thread it into the JSON envelope: shelve/move/dismiss --json
88
+ // consumers (the agent harness) must see the mutation will not sync —
89
+ // stderr alone is invisible to them (#1433).
90
+ const { setEnvelopeGistWarning } = await import('./formatters/json.js');
91
+ setEnvelopeGistWarning(localOnlyWarning);
92
+ }
93
+ }
94
+ });
95
+ }
@@ -1367,9 +1367,10 @@ export const commands = [
1367
1367
  .command('record')
1368
1368
  .description('Record a branch an agent prepared for the latest overnight run')
1369
1369
  .requiredOption('--url <url>', 'PR or issue URL the branch is for')
1370
- .requiredOption('--branch <name>', 'Local branch name')
1370
+ .option('--branch <name>', 'Local branch name (required unless --from-report supplies it)')
1371
1371
  .option('--worktree <path>', 'Worktree path holding the branch')
1372
1372
  .option('--note <text>', 'One-line summary of what was prepared')
1373
+ .option('--from-report <file>', "File holding the preparer's four-line report; supplies branch, worktree and note without putting agent text on the command line")
1373
1374
  .option('--json', 'Output as JSON')
1374
1375
  .action(async (options) => {
1375
1376
  await executeAction(options, async () => (await import('./commands/overnight.js')).runOvernightRecord({
@@ -1377,6 +1378,7 @@ export const commands = [
1377
1378
  branch: options.branch,
1378
1379
  worktree: options.worktree,
1379
1380
  note: options.note,
1381
+ fromReport: options.fromReport,
1380
1382
  }), (data) => {
1381
1383
  console.log(`Recorded (${data.preparedCount} prepared): ${data.reportPath}`);
1382
1384
  if (data.reportRecreated)
@@ -1390,11 +1392,13 @@ export const commands = [
1390
1392
  .description("Record that tonight's list issue could not be implemented, so the next run moves on (#1715)")
1391
1393
  .requiredOption('--url <url>', 'The issue URL from the report\'s "Implement tonight" line')
1392
1394
  .option('--note <text>', 'Why it was blocked')
1395
+ .option('--from-report <file>', "File holding the preparer's four-line report; supplies the note")
1393
1396
  .option('--json', 'Output as JSON')
1394
1397
  .action(async (options) => {
1395
1398
  await executeAction(options, async () => (await import('./commands/overnight.js')).runOvernightImplementBlocked({
1396
1399
  url: options.url,
1397
1400
  note: options.note,
1401
+ fromReport: options.fromReport,
1398
1402
  }), (data) => {
1399
1403
  console.log(`Recorded as blocked (${data.attemptCount} attempts on the list): ${data.url}`);
1400
1404
  if (data.gistSyncWarning)