ReviewOS

also looking at this

stacks/drone

feat: run configured modeled cargo delivery and phase failures

#97
Merged chris wants to merge codex/cargo-delivery-runtime into main
38 files +2114 -30
app/Commands/CargoDeliver.tsadded+23-0
Changes to app/Commands/CargoDeliver.ts
@@ -0,0 +1,23 @@
1import { defineCommand } from '@stacksjs/cli'
2import { printAsync, printErrorAsync } from '../../resources/functions/cli/output'
3import { cargoDeliveryScenarios, cargoDeliverySummary, simulateCargoDelivery } from '../../resources/functions/drone/cargo/delivery'
4
5export default defineCommand({
6 name: 'cargo:deliver',
7 description: 'Simulate owned cargo release, modeled recipient evidence and a finite alternate landing',
8 options: {
9 '--scenario <name>': { description: cargoDeliveryScenarios.join(', '), default: 'nominal' },
10 },
11 async handle(options) {
12 try {
13 const summary = cargoDeliverySummary(simulateCargoDelivery({ scenario: options.scenario }))
14 if (!summary.demonstrationMatched) process.exitCode = 1
15 await printAsync(JSON.stringify(summary))
16 }
17 catch {
18 process.exitCode = 1
19 try { await printErrorAsync('Cargo delivery simulation failed: invalid input, unavailable result or output failure') }
20 catch { /* Closed stderr cannot turn a failed output into success. */ }
21 }
22 },
23})