Skip to content

feat(cli): support chaining multiple commands with ;#246

Open
bouclem wants to merge 1 commit into
MCPHackers:mainfrom
bouclem:feat/cli-multiple-commands
Open

feat(cli): support chaining multiple commands with ;#246
bouclem wants to merge 1 commit into
MCPHackers:mainfrom
bouclem:feat/cli-multiple-commands

Conversation

@bouclem
Copy link
Copy Markdown

@bouclem bouclem commented May 26, 2026

Closes #61.

Adds support for chaining multiple commands in a single line (or single invocation) using ; as a separator. Works the same way in both interactive mode and when passing args directly:

> setup 1.2.5; decompile; build
java -jar RetroMCP.jar setup 1.2.5 ";" decompile

The separator can be a standalone token (";") or attached to a previous token (1.2.5;).

Behavior

  • Commands run in order
  • If a command fails (unknown command, task returned error), the rest of the queue is dropped with a warning, similar to shell && semantics
  • exit mid-chain stops execution as before
  • Empty segments (e.g. setup ;; decompile) are skipped silently
  • Single commands behave identically to today

Implementation

  • Pulled the per-command logic in MainCLI's constructor into a queue-based loop
  • Added two small helpers: splitCommands(String[]) for tokenizing by ; and readInteractiveCommands() for the interactive prompt
  • No changes to parseArg, setMode, setParams, or any task code

Testing

  • gradlew build passes
  • Verified help; help setup; exit chains correctly in interactive mode
  • Verified help ";" "help" "setup" chains correctly via CLI args
  • Verified bogus_cmd; help; exit aborts the rest after the unknown command
  • No behavioral change for users running single commands

Closes MCPHackers#61. The CLI now accepts multiple commands per line or per invocation, separated by ;. Works the same way in interactive mode and when passing args directly:

  setup 1.2.5; decompile

  java -jar RetroMCP.jar setup 1.2.5 ';' decompile

If any command in the chain fails (unknown command or task error), the remaining queued commands are dropped with a warning, mirroring shell && semantics. exit mid-chain stops the loop as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature suggestion] Multiple commands in a row in CLI.

1 participant