mirror of
https://github.com/Jeuners/ECC.git
synced 2026-09-17 18:46:11 +02:00
fix: harden orchestration status and skill docs
This commit is contained in:
parent
ddab6f1190
commit
52daf17cb5
15 changed files with 206 additions and 16 deletions
|
|
@ -20,9 +20,32 @@ function usage() {
|
|||
|
||||
function parseArgs(argv) {
|
||||
const args = argv.slice(2);
|
||||
const target = args.find(arg => !arg.startsWith('--'));
|
||||
const writeIndex = args.indexOf('--write');
|
||||
const writePath = writeIndex >= 0 ? args[writeIndex + 1] : null;
|
||||
let target = null;
|
||||
let writePath = null;
|
||||
|
||||
for (let index = 0; index < args.length; index += 1) {
|
||||
const arg = args[index];
|
||||
|
||||
if (arg === '--write') {
|
||||
const candidate = args[index + 1];
|
||||
if (!candidate || candidate.startsWith('--')) {
|
||||
throw new Error('--write requires an output path');
|
||||
}
|
||||
writePath = candidate;
|
||||
index += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (arg.startsWith('--')) {
|
||||
throw new Error(`Unknown flag: ${arg}`);
|
||||
}
|
||||
|
||||
if (target) {
|
||||
throw new Error('Expected a single session name or plan path');
|
||||
}
|
||||
|
||||
target = arg;
|
||||
}
|
||||
|
||||
return { target, writePath };
|
||||
}
|
||||
|
|
@ -56,4 +79,4 @@ if (require.main === module) {
|
|||
}
|
||||
}
|
||||
|
||||
module.exports = { main };
|
||||
module.exports = { main, parseArgs };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue