(deps: TestDeps)
| 8455 | } |
| 8456 | |
| 8457 | export function createTestArtifactCommand(deps: TestDeps): Command { |
| 8458 | const artifact = new Command('artifact').description( |
| 8459 | 'Download run-scoped artifact bundles (M3.3 piece-4)', |
| 8460 | ); |
| 8461 | artifact |
| 8462 | .command('get <run-id>') |
| 8463 | .description( |
| 8464 | [ |
| 8465 | 'Download the §7 failure-context bundle for a specific run.', |
| 8466 | '', |
| 8467 | 'Default <dir>: ./.testsprite/runs/<run-id>/', |
| 8468 | '', |
| 8469 | 'Exit codes:', |
| 8470 | ' 0 bundle written successfully', |
| 8471 | ' 3 authentication error (AUTH_* scope)', |
| 8472 | ' 4 run not found / not ready / no failure / cancelled', |
| 8473 | ' 5 validation error (bad --out, meta.runId mismatch)', |
| 8474 | ' 6 conflict — snapshot in flight (retried once)', |
| 8475 | ' 10 transport failure (.partial left on disk)', |
| 8476 | ].join('\n'), |
| 8477 | ) |
| 8478 | .option( |
| 8479 | '--out <dir>', |
| 8480 | [ |
| 8481 | 'Directory to write the §7 disk layout (default: ./.testsprite/runs/<run-id>/).', |
| 8482 | 'Parent must exist. The bundle dir itself is created if absent.', |
| 8483 | ].join(' '), |
| 8484 | ) |
| 8485 | .option('--failed-only', 'Keep only the failed step plus its immediate neighbors (±1)') |
| 8486 | .addHelpText('after', GLOBAL_OPTS_HINT) |
| 8487 | .action( |
| 8488 | async (runId: string, cmdOpts: { out?: string; failedOnly?: boolean }, command: Command) => { |
| 8489 | await runArtifactGet( |
| 8490 | { |
| 8491 | ...resolveCommonOptions(command), |
| 8492 | runId, |
| 8493 | out: cmdOpts.out, |
| 8494 | failedOnly: Boolean(cmdOpts.failedOnly), |
| 8495 | }, |
| 8496 | deps, |
| 8497 | ); |
| 8498 | }, |
| 8499 | ); |
| 8500 | return artifact; |
| 8501 | } |
| 8502 | |
| 8503 | function createTestFailureCommand(deps: TestDeps): Command { |
| 8504 | const failure = new Command('failure').description('Export the latest-failure agent bundle'); |
no test coverage detected