docs/ez-agent-ruby/cmd/ez-agent-ruby.md

ez-agent-ruby wrapper

ez-agent-ruby is the self-extracting Linux/amd64 Ruby interpreter: it selects, installs, validates, and runs its private curated CRuby payload. For Ruby APIs or Workflow extensions, see ../lib/ez_agent.md; for the add-on overview, see ../../ez-agent-ruby.md. To create the runtime ZIP, see package-runtime.md.

What owns each part?

RoleAuthority
Public executable and payload choiceez-agent-ruby/cmd/ez-agent-ruby/ (main.go, embedded production payload, test stub)
Invocation, install, state, execution, and pruning../internal/launcher.md
Payload identity and installed-tree manifest../internal/runtimepayload.md
Runtime ZIP productionpackage-runtime.md and cmd/package-runtime/

Production builds embed payload.zip; builds without the runtime_payload tag carry no payload. Build the production binary from the repository root with just build; generated ZIPs and build/ output are not source authorities.

How do I invoke or manage it?

Use Ruby normally:

sh
1ez-agent-ruby [Ruby options] [script.rb] [arguments...]

All non-launcher arguments pass unchanged to the private Ruby. Launcher options are leading commands: --ez-runtime-home PATH is recognized only first, and --save may immediately follow it. Management commands reject trailing arguments; a sole --help or -h shows launcher context before Ruby help. Failures print ez-agent-ruby: ... and exit 1.

NeedLeading commandEffect
Help--ez-helpPrint launcher help; do not inspect payload or state.
Locate--ez-runtime-pathPrint selected/base runtime path; do not install.
Check an installed tree--ez-runtime-verifyValidate the selected tree, including a recorded noexec fallback, and print ok; never repair it.
Ensure a runtime exists--ez-runtime-installReuse or install the embedded payload, then exit without output.
Inspect the active runtime--ez-runtime-infoInstall if needed, record state, then print Ruby, runtime, and path.
Read notices--ez-runtime-noticesInstall if needed, then print share/ez-agent-ruby/NOTICES.txt.
Remove old managed runtimes--ez-runtime-pruneInstall current runtime if needed, remove eligible old siblings, print a count; not process-safe (see below).

Where does the runtime install?

Runtime homes are auto or absolute paths. State lives at ${XDG_DATA_HOME:-$HOME/.local/share}/ez-agent/ez-agent-ruby.json; default managed trees are content-addressed beneath the selected data home. In auto mode only, an EACCES execution-probe failure can use a secure $HOME/.local/bin base, creating missing directories without changing existing permissions. Explicit homes never fall back.

  • Reuse requires intact payload contents and safe, usable permissions, not exact archive permission bits. Owner-readable files and owner-executable binaries can have tighter permissions, including read-only files. Extraction respects the process umask; reuse neither widens modes nor rewrites unchanged state.
  • Corrupt, incomplete, extra, or manifest-mismatched content is rejected rather than overwritten. Group/other write access and privilege-changing executable bits are rejected. Read access to launcher state or completion manifests is harmless and permitted; newly written state is still private.

What must I not assume about safety or portability?

  • The payload identity is exact; see internal/runtimepayload/manifest.go before changing it.
  • Ruby and launcher environments discard RUBYOPT, RUBYLIB, RUBYPATH, RubyGems/Bundler injection settings, and BUNDLE_*; do not rely on inherited Ruby library or gem state.
  • The launcher also discards inherited EZ_AGENT_WEBFETCH. If an executable ez-agent-webfetch sibling exists, it exports that absolute path for the Ruby process. This pairs each public launcher with its own fetcher even when launchers share a content-addressed CRuby tree. A missing sibling is non-fatal: ordinary Ruby still runs, and EzAgent::WebFetch validates and resolves the selected executable through its documented best-effort fallback order.
  • Installation, validation, and notice display work offline. Executed Ruby is not a network sandbox.
  • Pruning preserves malformed, unsafe, symlinked, and invalid candidates, but cannot know whether another process is using a valid old runtime.

Where is the detail authority?

  • CLI flow and user-facing help: ez-agent-ruby/internal/launcher/launcher.go; behavioral coverage: internal/launcher/*_test.go.
  • State validation: internal/launcher/state.go and state_test.go; manifest rules: internal/runtimepayload/manifest.go and manifest_test.go.
  • Packaging and build prerequisites: cmd/package-runtime/main.go, ez-agent-ruby/README.md, and ez-agent-ruby/THIRD_PARTY.md.
  • Builtin Ruby skills need this executable beside the physical ez-agent-builtin, not merely on PATH. Generic daemon/socket frames belong in the JSONL API reference.