demo-cordis.mjs 1.0 KB

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