Skip to content

feat: CLI improvements — JSON output, SSH readiness, error handling#11

Open
jasonhernandez wants to merge 5 commits into
aljoscha:mainfrom
jasonhernandez:feat/cli-improvements
Open

feat: CLI improvements — JSON output, SSH readiness, error handling#11
jasonhernandez wants to merge 5 commits into
aljoscha:mainfrom
jasonhernandez:feat/cli-improvements

Conversation

@jasonhernandez
Copy link
Copy Markdown
Collaborator

Summary

Five independent CLI improvements:

  1. vm create --format json: returns VM metadata as JSON on stdout. All progress messages go to stderr so stdout is clean for piping.
  2. SSH readiness wait: after vm create, polls SSH until the VM responds (configurable --wait seconds).
  3. Clean up VM on failed start: if vm start fails after vm create, automatically deletes the orphaned state.
  4. Improved image-not-found error: better error message when the specified image doesn't exist.
  5. Single-arg exec fix: ember exec vm -- "echo hi | tee /tmp/out" passes the command verbatim instead of re-quoting.

Files changed

File What
src/cli/vm.rs JSON output, SSH wait, failed-start cleanup, image error
src/cli/exec.rs Single-arg command fix

Test plan

  • 26 unit tests pass, cargo build clean, cargo clippy clean
  • Manual: ember vm create test --image base --format json outputs JSON
  • Manual: ember vm create test --image nonexistent shows helpful error
  • Manual: ember exec test -- "echo hi | tee /tmp/out" works

🤖 Generated with Claude Code

jasonhernandez and others added 5 commits April 14, 2026 16:26
Show build, pull, and list commands instead of only suggesting pull.
Most custom images (ubuntu-dev, ubuntu-slim) need to be built from
a Dockerfile, not pulled from a registry.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
If `ember vm create` succeeds but the subsequent start fails (e.g.,
ember-vz crash, missing binary), delete the created VM instead of
leaving orphaned state behind. Previously, the start rollback only
cleaned up network/process but left the VM metadata and disk.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
`ember vm create` now waits up to 90s (configurable via --wait) for
SSH to become reachable before reporting success. This means `ember
exec` works immediately after create — no manual polling needed.

Also add --wait flag to `ember exec` for configuring the SSH connect
timeout (default: 30s, can be increased for heavy images).

If the wait times out, the VM is still running — just SSH is slow.
A hint is printed suggesting `ember exec --wait`.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When `ember exec vm -- "echo hi | tee /tmp/out"` has one argument
after `--`, pass it directly to the SSH channel without quoting.
The remote shell interprets pipes and redirects correctly.

Previously, shell_escape_join would single-quote arguments containing
`|` or `>`, preventing the remote shell from interpreting them.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- `ember vm create --format json` returns VM metadata as JSON on stdout
- All progress messages (Cloning, Growing, Injecting, Starting, Waiting)
  now go to stderr so stdout is clean for JSON piping
- `ember exec` also reformatted by cargo fmt

This makes ember scriptable: `ember vm create foo --image bar --format json | jq .`
outputs clean JSON while progress is visible on stderr.

201 tests pass (186 ember + 15 emberd), clippy clean.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@jasonhernandez jasonhernandez marked this pull request as ready for review April 15, 2026 00:01
@jasonhernandez jasonhernandez requested a review from aljoscha April 15, 2026 00:01
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.

1 participant