Skip to content

refactor(ao-cli): split main.rs into modules (#50)#71

Merged
duonghb53 merged 2 commits into
mainfrom
ao-87877bd9-feat-issue-50
Apr 15, 2026
Merged

refactor(ao-cli): split main.rs into modules (#50)#71
duonghb53 merged 2 commits into
mainfrom
ao-87877bd9-feat-issue-50

Conversation

@duonghb53
Copy link
Copy Markdown
Owner

Summary

Structural refactor of crates/ao-cli: the previous monolithic main.rs (~3.6k lines) is split into focused modules so ongoing TS→Rust CLI porting is easier to navigate and test.

What changed

  • main.rs (~145 lines): crate docs, tracing init, clap parse, and command dispatch only.
  • cli/: args.rs (all clap types), auto_scm.rs, plugins.rs (agent/runtime selection, MultiAgent, duplicate-issue error), agent_config.rs, project.rs, printing.rs, spawn_helpers.rs, local_issue.rs, browser.rs, lifecycle_wiring.rs (shared notifier setup).
  • commands/: one module per command area (start, spawn, status, watch, send, pr, dashboard, kill, cleanup, doctor, review_check).
  • session/: restore, attach.
  • tests.rs: cross-module unit tests (unchanged assertions; imports updated).

Behavior

No intentional changes to outputs, defaults, flags, or project resolution. watch and dashboard now share a single notifier_registry_from_config helper to avoid duplicated wiring.

Verification

  • cargo test -p ao-cli
  • cargo test --workspace
  • cargo clippy --workspace --all-targets
  • Spot-check: ao-rs --help

Closes #50

Made with Cursor

Extract clap definitions to cli/args.rs, shared wiring (AutoScm, plugin
selection, project resolution, printing, local issues, spawn helpers,
browser, lifecycle notifier setup) under cli/, and one file per command
area under commands/. Session restore/attach live under session/.

Deduplicate notifier registration between watch and dashboard via
cli/lifecycle_wiring.rs. Keep main.rs as tracing init plus command
dispatch; move unit tests to src/tests.rs.

Behavior and CLI surface are unchanged. Verified with cargo test -p ao-cli,
cargo test --workspace, cargo clippy --workspace --all-targets.

Refs: #50
Made-with: Cursor
@duonghb53 duonghb53 merged commit 257061a into main Apr 15, 2026
2 checks passed
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.

CLI refactor: split crates/ao-cli main.rs into modules

1 participant