Skip to content

feat: switch execute to orchestrator API#174

Merged
AlephNotation merged 7 commits intomainfrom
ty/exec-api
Apr 9, 2026
Merged

feat: switch execute to orchestrator API#174
AlephNotation merged 7 commits intomainfrom
ty/exec-api

Conversation

@AlephNotation
Copy link
Copy Markdown
Contributor

@AlephNotation AlephNotation commented Apr 7, 2026

Summary

Switches vers execute from direct SSH to the orchestrator's exec streaming API.

Execute via orchestrator API

vers execute now uses POST /api/v1/vm/{id}/exec/stream by default. Commands flow through the vsock agent inside the VM, which means they automatically inherit /etc/environment (env vars).

vers execute <vm> ls -la /
vers execute --ssh <vm> echo "legacy path"   # direct SSH fallback
vers execute -w /app <vm> npm start           # working directory support

Key changes:

  • Streams NDJSON output (stdout/stderr) in real time
  • Propagates remote exit codes to the CLI process
  • --ssh flag preserves legacy SSH behavior
  • SetInterspersed(false) so command flags like -la pass through correctly
  • --workdir / -w for remote working directory

Files changed

File Change
cmd/execute.go API by default, --ssh fallback, --workdir, flag passthrough
internal/handlers/execute.go Dual path: API streaming + SSH fallback
internal/services/vm/exec.go New — orchestrator exec stream client
internal/presenters/execute_types.go Added ExitCode to view
cmd/env.go Minor help text cleanup

- Execute now uses POST /api/v1/vm/{id}/exec/stream by default
  instead of direct SSH. This routes through the vsock agent,
  which inherits /etc/environment (secrets/env vars). --ssh flag
  preserves legacy SSH behavior.

- Flags pass through correctly to remote commands (SetInterspersed)

- New 'vers secret' command (set/list/delete) with:
  - Masked output by default (--reveal to show)
  - Hidden terminal input when value omitted
  - Piped stdin support

- New exec service (internal/services/vm/exec.go) for orchestrator API

- Cross-reference from 'vers env' help to 'vers secret'
@AlephNotation AlephNotation changed the title feat: switch execute to orchestrator API, add secret command feat: switch execute to orchestrator API Apr 9, 2026
@AlephNotation AlephNotation merged commit c3f1b60 into main Apr 9, 2026
6 checks passed
@AlephNotation AlephNotation deleted the ty/exec-api branch April 9, 2026 22:41
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