Multi-Agent Collaboration for Team and Friends
TypeScript agent-automationagent-orchestrationagent-workflowai-agentsai-collaborationai-memoryai-workforceautonomous-agentsclaude-codeclaude-code-skillscodexcoding-agentmulti-agentmultiple-agentone-person-businessone-person-companyone-person-teamopencodesolopreneur
daemon(cli): `-h`/`--help` prints plain text, not a JSON envelope
Gus8cef5690f294
diff --git a/src/daemon/src/cli/index.test.ts b/src/daemon/src/cli/index.test.tsindex 1b89a1768..221a8e0e1 100644--- a/src/daemon/src/cli/index.test.ts+++ b/src/daemon/src/cli/index.test.ts@@ -110,6 +110,32 @@ describe("envelope contract", () => {await main(["inbox", "pull"]);expect(parseEnvelope(cap.lines()).error).toContain("no ServerApi available");});++ it("`-h` prints PLAIN TEXT usage, NOT a JSON envelope (Gus 架构#473)", async () => {+ const code = await main(["-h"]);+ expect(code).toBe(0);+ const out = cap.lines().join("");+ // Human usage text — commander's help, not `{"success":{"usage":…}}`.+ expect(out).toContain("Usage:");+ expect(out.trimStart().startsWith("{")).toBe(false); // not JSON+ expect(() => JSON.parse(out)).toThrow(); // definitively not the envelope+ });++ it("a subcommand `-h` is also plain text", async () => {+ await main(["message", "-h"]);+ const out = cap.lines().join("");+ expect(out).toContain("Usage:");+ expect(out.trimStart().startsWith("{")).toBe(false);+ });++ it("BOUNDARY: normal commands + errors still emit JSON (only -h is text)", async () => {+ // Guard Gus's caveat (#477): the -h→text change must NOT bleed into the+ // JSON output every other command/agent path depends on.+ setApiForTesting(stubApi());+ await main(["bogus", "command"]); // unknownCommand → still JSON+ const env = parseEnvelope(cap.lines()); // parseEnvelope asserts exactly one JSON line+ expect(env.error).toContain("unknown command");+ });});describe("channel alignment (message send)", () => {diff --git a/src/daemon/src/cli/index.ts b/src/daemon/src/cli/index.tsindex 995a05740..9cc4b0da0 100755--- a/src/daemon/src/cli/index.ts+++ b/src/daemon/src/cli/index.ts@@ -877,9 +877,12 @@ export async function main(argv = process.argv.slice(2)): Promise<number> {} catch (err) {if (err instanceof CommanderError) {if (err.code === "commander.helpDisplayed" || err.code === "commander.help") {- // Help requested — find the relevant command and output its help text- const helpText = getHelpText(program, argv);- printEnvelope({ success: { usage: helpText } });+ // `-h`/`--help` is a HUMAN reading usage in a terminal — print the plain+ // commander usage text, NOT the agent JSON envelope. Help is the one+ // path that's human-facing; every other outcome (success results,+ // errors, unknownCommand) stays a one-JSON-line envelope for agents to+ // consume. (Gus 架构#473: -h wrongly returned `{"success":{"usage":…}}`.)+ process.stdout.write(getHelpText(program, argv) + "\n");} else if (err.code === "commander.unknownCommand") {printEnvelope({ error: `unknown command: ${argv.join(" ") || "(none)"}. Run \`alook help\`.` });} else {