From 0a332f4cba4863e17cdde14b79e0b78f18603fb5 Mon Sep 17 00:00:00 2001 From: Mikael Hugo Date: Fri, 15 May 2026 14:32:00 +0200 Subject: [PATCH] fix(headless): normalize auto alias to autonomous --- src/headless.ts | 5 +++-- src/tests/headless-cli-surface.test.ts | 9 ++++++++- src/tests/headless-events.test.ts | 7 ++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/headless.ts b/src/headless.ts index 2f484bd47..a13b7069d 100644 --- a/src/headless.ts +++ b/src/headless.ts @@ -470,7 +470,7 @@ export function parseHeadlessArgs(argv: string[]): HeadlessOptions { options.commandArgs.push(arg); } } else if (!commandSeen) { - if (arg === "autonomous") { + if (arg === "autonomous" || arg === "auto") { options.command = "autonomous"; options.chainAutonomous = true; } else { @@ -641,7 +641,8 @@ async function runHeadlessOnce( // per-unit timeout via auto-supervisor. Disable the overall timeout unless the // user explicitly set --timeout. const isAutonomousCommand = options.command === "autonomous"; - const wasRequestedAutonomousCommand = requestedCommand === "autonomous"; + const wasRequestedAutonomousCommand = + requestedCommand === "autonomous" || requestedCommand === "auto"; // discuss and plan are multi-turn: they involve multiple question rounds, // codebase scanning, and artifact writing before the workflow completes (#3547). const isMultiTurnCommand = diff --git a/src/tests/headless-cli-surface.test.ts b/src/tests/headless-cli-surface.test.ts index 30fb6e368..5da669f37 100644 --- a/src/tests/headless-cli-surface.test.ts +++ b/src/tests/headless-cli-surface.test.ts @@ -121,7 +121,7 @@ function parseHeadlessArgs(argv: string[]): HeadlessOptions { options.commandArgs.push(arg); } } else if (!commandSeen) { - if (arg === "autonomous") { + if (arg === "autonomous" || arg === "auto") { options.command = "autonomous"; options.chainAutonomous = true; } else { @@ -196,6 +196,13 @@ test("autonomous command is accepted as headless command", () => { assert.deepEqual(opts.commandArgs, []); }); +test("auto alias is normalized to autonomous headless command", () => { + const opts = parseHeadlessArgs(["node", "sf", "headless", "auto"]); + assert.equal(opts.command, "autonomous"); + assert.equal(opts.chainAutonomous, true); + assert.deepEqual(opts.commandArgs, []); +}); + test("autonomous command preserves command arguments", () => { const opts = parseHeadlessArgs([ "node", diff --git a/src/tests/headless-events.test.ts b/src/tests/headless-events.test.ts index 79843e705..374bff66d 100644 --- a/src/tests/headless-events.test.ts +++ b/src/tests/headless-events.test.ts @@ -79,7 +79,12 @@ function parseHeadlessArgs(argv: string[]): HeadlessOptions { } } else if (!positionalStarted) { positionalStarted = true; - options.command = arg; + if (arg === "autonomous" || arg === "auto") { + options.command = "autonomous"; + options.chainAutonomous = true; + } else { + options.command = arg; + } } else { options.commandArgs.push(arg); }