2026-07-27 14:59:24 +08:00
|
|
|
/**
|
2026-07-29 13:58:21 +08:00
|
|
|
* Boot the self-referential Cordis tools under Web or ACP, defaulting to Web. This is a repository demo wrapper, not a product CLI feature.
|
2026-07-27 14:59:24 +08:00
|
|
|
*/
|
|
|
|
|
import { spawn } from 'node:child_process'
|
|
|
|
|
|
|
|
|
|
const SURFACES = new Map([
|
2026-07-29 13:58:21 +08:00
|
|
|
// The browser surface with the cordis toolset layered on: `dsh web --config`
|
|
|
|
|
// applies this overlay over the shipped web composition; it owns port 3081.
|
2026-08-06 04:40:32 +08:00
|
|
|
['web', ['--import', 'tsx', 'apps/cli/src/bin.ts', 'web', '--patch', 'examples/web-cordis/cordis.yml']],
|
2026-07-27 14:59:24 +08:00
|
|
|
['acp', ['--import', 'tsx', 'packages/examples/acp-demo/src/bin.ts', '--config', 'examples/acp-agent/cordis-tools.cordis.yml']],
|
|
|
|
|
])
|
|
|
|
|
|
2026-07-29 13:58:21 +08:00
|
|
|
const surface = process.argv[2] ?? 'web'
|
2026-07-27 14:59:24 +08:00
|
|
|
const args = SURFACES.get(surface)
|
|
|
|
|
if (args === undefined || process.argv.length > 3) {
|
2026-07-29 13:58:21 +08:00
|
|
|
console.error('usage: pnpm run demo:cordis [web|acp]')
|
2026-07-27 14:59:24 +08:00
|
|
|
process.exit(2)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (surface === 'web') console.log('Cordis Web: http://127.0.0.1:3081')
|
|
|
|
|
const child = spawn(process.execPath, args, { stdio: 'inherit' })
|
|
|
|
|
child.on('exit', (code, signal) => { process.exit(signal === null ? code ?? 1 : 1) })
|