demo-ptc.mjs 574 B

123456789101112131415161718
  1. /** Run one headless task through the shipped PTC mode composition. Requires a model credential. */
  2. import { spawn } from 'node:child_process'
  3. const task = process.argv.slice(2).join(' ').trim()
  4. || 'Inspect this repository with PTC mode and report its top-level architecture.'
  5. const child = spawn(process.execPath, [
  6. '--import',
  7. 'tsx/esm',
  8. 'apps/cli/src/bin.ts',
  9. '--profile',
  10. 'headless',
  11. task,
  12. ], {
  13. stdio: 'inherit',
  14. env: { ...process.env, DSH_TOOLS_MODE: 'ptc' },
  15. })
  16. child.on('exit', (code, signal) => { process.exit(signal !== null ? 1 : code ?? 1) })