run-media-write-live-smoke.mjs
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠ breaking
10 days ago
| 1 | #!/usr/bin/env node |
| 2 | /** |
| 3 | * Operator helper — mint a dev Hub JWT and run verify-media-write-smoke.mjs --live-propose. |
| 4 | * Avoids passing tokens on the shell command line. |
| 5 | * |
| 6 | * Prerequisites: HUB_JWT_SECRET in .env; self-hosted Hub running; seed-media-write-staging.mjs run. |
| 7 | * |
| 8 | * Usage: |
| 9 | * HUB_PORT=3456 node scripts/run-media-write-live-smoke.mjs |
| 10 | */ |
| 11 | |
| 12 | import { spawnSync } from 'node:child_process'; |
| 13 | import path from 'node:path'; |
| 14 | import { fileURLToPath } from 'node:url'; |
| 15 | import dotenv from 'dotenv'; |
| 16 | import jwt from 'jsonwebtoken'; |
| 17 | |
| 18 | const __dirname = path.dirname(fileURLToPath(import.meta.url)); |
| 19 | const repoRoot = path.resolve(__dirname, '..'); |
| 20 | dotenv.config({ path: path.join(repoRoot, '.env') }); |
| 21 | |
| 22 | const secret = process.env.HUB_JWT_SECRET; |
| 23 | if (!secret) { |
| 24 | console.error('HUB_JWT_SECRET required in .env'); |
| 25 | process.exit(1); |
| 26 | } |
| 27 | |
| 28 | const port = process.env.HUB_PORT || '3333'; |
| 29 | const token = jwt.sign( |
| 30 | { |
| 31 | sub: 'google:smoke-admin', |
| 32 | name: 'Smoke Admin', |
| 33 | role: 'admin', |
| 34 | }, |
| 35 | secret, |
| 36 | { expiresIn: '1h' }, |
| 37 | ); |
| 38 | |
| 39 | const env = { |
| 40 | ...process.env, |
| 41 | KNOWTATION_HUB_API: `http://localhost:${port}`, |
| 42 | KNOWTATION_HUB_TOKEN: token, |
| 43 | KNOWTATION_HUB_VAULT_ID: process.env.KNOWTATION_HUB_VAULT_ID || 'default', |
| 44 | }; |
| 45 | |
| 46 | const result = spawnSync( |
| 47 | process.execPath, |
| 48 | [path.join(__dirname, 'verify-media-write-smoke.mjs'), '--live-propose'], |
| 49 | { env, stdio: 'inherit' }, |
| 50 | ); |
| 51 | |
| 52 | process.exit(result.status ?? 1); |
File History
1 commit
sha256:b5f647cb9c409f563d4671fe3fc05ddea01fabfed9b41fc11cb923588e1c1baf
mirror: GitHub Phase A durable MCP OAuth (#270)
Human
minor
⚠
10 days ago