| 6 | const path = require('path'); |
| 7 | const config = require('../core/config'); |
| 8 | const { |
| 9 | collectSkillCandidates, |
| 10 | normalizeRoutingInput, |
| 11 | parseDeterministicCommand, |
| 12 | parseRequestEnvelope, |
| 13 | resolveDeterministicCommand, |
| 14 | routeForSkill, |
| 15 | validateRouteOverride, |
| 16 | } = require('../core/skills/routing'); |
| 17 | |
| 18 | function parseArgs(argv) { |
| 19 | const args = { |
| 20 | input: [], |
| 21 | json: false, |
| 22 | projectRoot: process.cwd(), |
| 23 | routeOverride: null, |
| 24 | help: false, |
| 25 | }; |
| 26 | |
| 27 | for (let index = 0; index < argv.length; index++) { |
| 28 | const arg = argv[index]; |
| 29 | if (arg === '--json') args.json = true; |
| 30 | else if (arg === '--project-root') args.projectRoot = path.resolve(argv[++index] || '.'); |
| 31 | else if (arg === '--route') { |
| 32 | const value = argv[++index]; |
| 33 | if (!value) throw new Error('--route requires a route such as /test-gen'); |
| 34 | args.routeOverride = value; |
| 35 | } |