demo-cordis.mjs 1.1 KB

123456789101112131415161718192021222324
  1. /**
  2. * Boot the self-referential Cordis tools under TUI, Web, or ACP, defaulting
  3. * to TUI. This is a repository demo wrapper, not a product CLI feature.
  4. */
  5. import { spawn } from 'node:child_process'
  6. const SURFACES = new Map([
  7. ['tui', ['--import', 'tsx', 'apps/cli/src/bin.ts', '--config', 'examples/cordis-agent/cordis.yml']],
  8. // `dsh web` does not accept alternate configs yet. The TUI config escape
  9. // hatch still boots this browser-only tree; the config owns port 3081.
  10. ['web', ['--import', 'tsx', 'apps/cli/src/bin.ts', '--config', 'examples/web-cordis/cordis.yml']],
  11. ['acp', ['--import', 'tsx', 'packages/examples/acp-demo/src/bin.ts', '--config', 'examples/acp-agent/cordis-tools.cordis.yml']],
  12. ])
  13. const surface = process.argv[2] ?? 'tui'
  14. const args = SURFACES.get(surface)
  15. if (args === undefined || process.argv.length > 3) {
  16. console.error('usage: pnpm run demo:cordis [tui|web|acp]')
  17. process.exit(2)
  18. }
  19. if (surface === 'web') console.log('Cordis Web: http://127.0.0.1:3081')
  20. const child = spawn(process.execPath, args, { stdio: 'inherit' })
  21. child.on('exit', (code, signal) => { process.exit(signal === null ? code ?? 1 : 1) })