fix(mosaic): stop yolo runtime from leaking runtime name as first user message #455
Reference in New Issue
Block a user
Delete Branch "fix/yolo-runtime-initial-arg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes mosaicstack/stack#454.
mosaic yolo <runtime>was forwarding the runtime name (e.g.claude) as the first positional argument to the underlying CLI, which Claude Code interpreted as the initial user message. As a secondary consequence, the mission-auto-prompt path (hasMissionNoArgs) was bypassed.Root cause
Commander.js includes declared positional arguments in
cmd.args. Theyolo <runtime>action handler forwardedcmd.argsverbatim tolaunchRuntime, so formosaic yolo claudethe forwarded args were["claude"]. The non-yolo<runtime>subcommands were unaffected because they don't declare any positionals.Fix
registerRuntimeLaunchers(program, handler)factory exposing aRuntimeLaunchHandlertype so the commander wiring is unit-testable without spawning subprocesses.cmd.argsin the yolo action:handler(runtime, cmd.args.slice(1), true).registerLaunchCommandsdelegates to the factory with the reallaunchRuntimeas the handler.Tests
Adds
packages/mosaic/src/commands/launch.spec.ts(11 tests):(runtime, [], false).(runtime, [], true). Critical regression assertion.All 11 pass. Full mosaic suite is 270/271 — the 1 unrelated failure (
uninstall.spec.ts:138) is pre-existing on branch main and was confirmed before this PR landed.Test plan
pnpm --filter @mosaicstack/mosaic run typecheckgreenpnpm --filter @mosaicstack/mosaic run lintgreenpnpm typecheck/pnpm lint/pnpm format:checkgreenAffected version
Ships in
mosaicstack/mosaic0.0.30.