From 06b6dcd767f419ce589bb4a9bfaa477a3f2a82a7 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sat, 7 Nov 2026 16:53:16 +0000 Subject: [PATCH] fix(c0agent): agents c0mpute --help shows its own usage; 'agents list' after flags manages definitions (v0.121.1) Co-Authored-By: Claude Opus 5.5 --- bin/moshcode.mjs | 2 ++ package.json | 2 +- src/c0agent-repl.mjs | 3 ++- test/c0agent.test.mjs | 2 ++ 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/bin/moshcode.mjs b/bin/moshcode.mjs index bfd2679d..e0eba275 100755 --- a/bin/moshcode.mjs +++ b/bin/moshcode.mjs @@ -308,6 +308,8 @@ function handledHelp(cmd, rest) { // `moshcode [verb] --help`, at any depth. const command = findCommand(cmd); if (!command) return false; + // `agents c0mpute --help` is the c0mpute agent's own usage, not this table's. + if ((command.name === "agents" || command.name === "start") && isC0mputeAgent(rest[0])) return false; // `run` claims --help only before the script filename. if (!wantsHelp(rest, { stopAt: command.name === "run" })) return false; diff --git a/package.json b/package.json index 24897c4d..67e40f58 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moshcode", - "version": "0.121.0", + "version": "0.121.1", "type": "module", "description": "moshcode — a metal wrapper for coding engines and native UGig/CoinPay workflow CLIs, with OpenPRD and moshscript", "repository": { diff --git a/src/c0agent-repl.mjs b/src/c0agent-repl.mjs index a63a0ee2..855b70ee 100644 --- a/src/c0agent-repl.mjs +++ b/src/c0agent-repl.mjs @@ -59,7 +59,8 @@ export function parseArgs(argv) { else if (a === "--permission-mode") opts.mode = argv[++i]; else if (a === "-C" || a === "--cwd") opts.cwd = argv[++i]; else if (a === "-y" || a === "--yes" || a === "--dangerously-skip-permissions") opts.mode = "yolo"; - else if (i === 0 && (a === "agents" || a === "agent")) { opts.manage = argv.slice(1); break; } + // `agents …` as the first word (after any flags) manages definitions; later it's prompt text. + else if (!opts.words.length && opts.print == null && (a === "agents" || a === "agent")) { opts.manage = argv.slice(i + 1); break; } else opts.words.push(a); } if (opts.print === "" && opts.words.length) opts.print = opts.words.join(" "); diff --git a/test/c0agent.test.mjs b/test/c0agent.test.mjs index b76f093b..7af5060b 100644 --- a/test/c0agent.test.mjs +++ b/test/c0agent.test.mjs @@ -295,5 +295,7 @@ test("routing: the names that mean the c0mpute agent, and CLI flags", () => { assert.equal(parseArgs(["-p", "-m", "qwen3:4b"]).model, "qwen3:4b"); assert.equal(parseArgs(["--dangerously-skip-permissions"]).mode, "yolo"); assert.deepEqual(parseArgs(["agents", "show", "plan"]).manage, ["show", "plan"]); + assert.deepEqual(parseArgs(["-C", "/x", "agents", "list"]).manage, ["list"]); + assert.equal(parseArgs(["fix", "the", "agents"]).manage, null); assert.equal(describeCall({ name: "task", input: { agent: "explore", prompt: "find x" } }), "Task(explore: find x)"); });