Imported from tallesborges/zdx (
crates/zdx-cli/AGENTS.md). Install upstream withnpx skills add tallesborges/zdx --skill zdx-cli. Copyright stays with the author.
zdx-cli development guide
Scope: CLI argument parsing/router, subcommands, and interactive/exec mode entrypoints.
Where things are
src/main.rs: binary entrypointbuild.rs: compile-time CLI version/build metadatasrc/cli/: argument structs + command dispatchsrc/cli/commands/automations.rs: automations commands (list,validate,run)src/cli/commands/bg.rs: background-process commands (zdx bg list [--json],zdx bg kill <bg_id>); thin wrapper overzdx_engine::background_activitysrc/cli/commands/bot.rs: Telegram bot setup/init command handler (zdx bot init)src/cli/commands/daemon.rs: scheduled automations daemon loopsrc/cli/commands/imagine.rs: image generation command handler (zdx imagine)src/cli/commands/speak.rs: text-to-speech command handler (zdx speak); thin wrapper overzdx_engine::audio::speak::synthesize_speechsrc/cli/commands/transcribe.rs: speech-to-text command handler (zdx transcribe <file>;--model,--language,--diarize,--json,--list-models); wrapszdx_engine::audio::transcribe::transcribe_audio_detailed+supported_modelssrc/cli/commands/memory.rs: native memory indexing/search/read commands (zdx memory index/status/search/get)src/cli/commands/mcp.rs: MCP helper commands (servers,tools,schema,call)src/cli/commands/stats.rs: usage/cost summary command handler (zdx stats)src/cli/commands/quota.rs: live subscription-quota command handler (zdx quota,--json); thin renderer over the sharedsubscription_quota::fetch_snapshot()APIsrc/cli/commands/service.rs: launchd service commands (zdx service install|uninstall|start|stop|restart|status|logs [bot|daemon|all]; restart supports--force); thin wrapper overzdx_engine::servicesrc/cli/commands/telegram.rs: Telegram utility commandssrc/cli/commands/worktree.rs: worktree command handlersrc/modes/exec.rs: non-interactive streaming modesrc/modes/mod.rs: mode exports (exec + feature-gated TUI)tests/integration/: CLI integration tests (assert_cmd, fixtures), aggregated into a single test binary viatests/integration/main.rs. Add new test files astests/integration/<name>.rsand register them withmod <name>;inmain.rs(for examplethreads_export.rscoverszdx threads export,exec_subagent.rscoverszdx exec --subagent,service.rscoverszdx service status/target validation without mutating launchd).
Conventions
-
tests/integration/opencode_go_headers.rscovers OpenCode session routing, identity isolation, and stability across requests. -
Keep CLI glue thin; shared behavior belongs in
zdx-engine. -
Prefer integration tests in
crates/zdx-cli/tests/integration/for CLI behavior. Do not add top-leveltests/*.rsfiles — they would compile as separate test binaries and slow downjust ci.
Checks
- Default final verification after code changes:
just cifrom repo root - Intermediate iteration for this crate:
cargo test -p zdx-cli--lib --bins --tests - Use
just lintorjust testonly when intentionally running one half of CI
Maintenance
- Add/move/delete
.rsfiles in this crate: update this file. - Add/move/delete prompt layer files in this crate: update this file.
- Command behavior contract changes: update
docs/SPEC.mdas needed.