Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ All notable changes to Lobster will be documented in this file.

## Unreleased

- Show the usage for `lobster help run`, `help resume`, `help doctor`, `help version` and `help help`, the same text `lobster run --help` prints, instead of failing with `Unknown command: run` (exit code 2); thanks @KrasimirKralev.
- Reject a non-object or empty `--args-json` on `lobster run`, `lobster graph`, and `workflows.run` instead of running the workflow on its default args or failing with a raw `TypeError`; thanks @KrasimirKralev.

## 2026.11.1 - 2026-11-05
Expand Down
7 changes: 7 additions & 0 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import type { WorkflowGraphFormat } from "./workflows/graph.js";
import { finalizePipelineToolRun } from "./pipeline_resume_state.js";
import { forceTerminateAbortableProcesses } from "./abortable_process.js";

const USAGE_TOPICS = new Set(["run", "resume", "doctor", "version", "help"]);

export async function runCli(argv) {
const cancellation = createCliCancellation();
try {
Expand Down Expand Up @@ -49,6 +51,11 @@ async function runCliWithSignal(
process.stdout.write(graphHelpText());
return;
}
// These built-ins are documented in the top-level usage, which `<topic> --help` prints too.
if (USAGE_TOPICS.has(topic)) {
process.stdout.write(helpText());
return;
}
const cmd = registry.get(topic);
if (!cmd) {
process.stderr.write(`Unknown command: ${topic}\n`);
Expand Down
23 changes: 23 additions & 0 deletions test/cli_run_errors.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,26 @@ test("help graph shows the graph help listed under Commands", () => {
assert.match(result.stdout, /--format\s+Output format: mermaid \(default\), dot, ascii/);
assert.equal(result.stderr, "");
});

for (const topic of ["run", "resume", "doctor", "version", "help"]) {
test(`help ${topic} shows the usage that documents it instead of Unknown command`, () => {
const result = spawnSync(process.execPath, ["bin/lobster.js", "help", topic], {
encoding: "utf8",
});
const flagHelp = spawnSync(process.execPath, ["bin/lobster.js", topic, "--help"], {
encoding: "utf8",
});
assert.equal(result.status, 0);
assert.equal(result.stderr, "");
assert.match(result.stdout, new RegExp(`^ lobster ${topic}\\b`, "m"));
assert.equal(result.stdout, flagHelp.stdout);
});
}

test("help with an unknown topic still fails", () => {
const result = spawnSync(process.execPath, ["bin/lobster.js", "help", "nope"], {
encoding: "utf8",
});
assert.equal(result.status, 2);
assert.equal(result.stderr, "Unknown command: nope\n");
});
Loading