fix(headless): normalize auto alias to autonomous

This commit is contained in:
Mikael Hugo 2026-05-15 14:32:00 +02:00
parent 44fcfb643c
commit 0a332f4cba
3 changed files with 17 additions and 4 deletions

View file

@ -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 =

View file

@ -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",

View file

@ -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);
}