Skip to content

feat(smitebot): add working doctor command (checks + --json + docs)#77

Open
Ashish-Kumar-Dash wants to merge 5 commits into
morehouse:masterfrom
Ashish-Kumar-Dash:feat/smitebot-doctor-command
Open

feat(smitebot): add working doctor command (checks + --json + docs)#77
Ashish-Kumar-Dash wants to merge 5 commits into
morehouse:masterfrom
Ashish-Kumar-Dash:feat/smitebot-doctor-command

Conversation

@Ashish-Kumar-Dash
Copy link
Copy Markdown
Contributor

@Ashish-Kumar-Dash Ashish-Kumar-Dash commented May 14, 2026

Summary

This PR introduces the first working smitebot command: doctor.

It adds smitebot crate and implements prerequisite checks needed before running Smite campaigns, with both human and machine readable(JSON) output.

What’s included

  • Add smitebot as a workspace member.
  • Add smitebot crate dependencies (clap, serde, serde_json, thiserror).
  • Implement smitebot doctor command (no stub-only command surface).
  • Implement --json output for CI/machine parsing.
  • Return non-zero exit code when any check fails.
  • Add focused unit tests for report logic/path helpers/JSON shape.
  • Add concise README docs, including install + direct smitebot doctor usage.

Checks implemented

  • x86_64 architecture
  • /dev/kvm accessible
  • Docker daemon reachable (docker info)
  • AFL++ tools on PATH:
    • afl-fuzz
    • afl-cmin
    • afl-tmin
    • afl-whatsup
  • Nyx packer hget presence
  • libnyx.so discoverable via LD_LIBRARY_PATH
  • VMware backdoor enabled
  • Required Smite scripts exist and are executable

Validation

cargo fmt --all --check
cargo clippy -p smitebot --all-targets -- -D warnings
cargo test -p smitebot
cargo run -p smitebot -- doctor
cargo run -p smitebot -- doctor --json

ping @morehouse @NishantBansal2003

Comment thread Cargo.toml
Comment thread Cargo.toml Outdated
Comment thread smitebot/README.md
Comment thread smitebot/README.md Outdated
Comment thread smitebot/README.md Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
@Ashish-Kumar-Dash Ashish-Kumar-Dash force-pushed the feat/smitebot-doctor-command branch 2 times, most recently from 3561e70 to 60c0eb9 Compare May 15, 2026 19:31
@Ashish-Kumar-Dash
Copy link
Copy Markdown
Contributor Author

made the required changes after the review & squashed the commits to a single one

Copy link
Copy Markdown
Contributor

@NishantBansal2003 NishantBansal2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just skimming through the changes (haven’t reviewed them deeply yet) but one main comment I wanted to add is that the code lacks Rust docs for each function, as well as some inline comments.

Also, I think the implementation could be simplified quite a bit and made more readable by following more idiomatic Rust patterns. Right now, I see quite a bit of redundancy in the code, such as repeated if/else patterns, duplicated check names like "Docker daemon reachable" etc etc.
I also think using proper error types would be better than returning strings explicitly.

You can also check https://github.com/dergoegge/fuzzamoto/tree/master/fuzzamoto-cli for some project/code structure ideas.

Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/README.md
Comment thread smitebot/src/main.rs Outdated
@Ashish-Kumar-Dash
Copy link
Copy Markdown
Contributor Author

Ashish-Kumar-Dash commented May 16, 2026

Refactored doctor so failed checks use typed CheckFailure variants instead of strings, which makes the code easier to extend and unrepetitive while keeping the same output, also cleaned up the command flow, added docs for each func, fixed ~ handling for --aflpp-path, made libnyx use the resolved AFL++ root, and switched to the faster docker version check.
Also, I feel main.rs does not need to be perfect at this stage, I’m keeping it clean enough for the first working command, and we can keep reshaping the structure as more commands land and better abstractions are spotted. Just my thoughts, since it might get messy as more commands keep adding

Copy link
Copy Markdown
Contributor

@NishantBansal2003 NishantBansal2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't reviewed the tests yet, but I think we can add more unit tests. I know there are some cases we can't test, but wherever possible, it would be great to add them, for example, tests for helper functions, error cases, and error display as well (since that is the most user visible part)

Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
@Ashish-Kumar-Dash Ashish-Kumar-Dash force-pushed the feat/smitebot-doctor-command branch from 5a4e352 to 37627ef Compare May 17, 2026 11:27
@Ashish-Kumar-Dash
Copy link
Copy Markdown
Contributor Author

Refactored doctor so each check now returns Result<(), CheckFailure>, and DoctorCheck::new(...) turns that into report output. This keeps the check logic cleaner, & avoids repeated pass/fail boilerplate.

Also moved repeated tool/script/dockerfile lists into constants and added more helper/error-display tests(now 11)

Copy link
Copy Markdown
Contributor

@NishantBansal2003 NishantBansal2003 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some more comments (feel free to ignore some nits if you disagree)

I still think the test module can be improved. Also, could you add inline comments in the tests wherever some workaround is used to achieve a particular check case? I think that would make it easier to understand what is being done and why.

Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
Comment thread smitebot/src/main.rs Outdated
@Ashish-Kumar-Dash Ashish-Kumar-Dash force-pushed the feat/smitebot-doctor-command branch from f3e9834 to a4dfca6 Compare May 19, 2026 12:54
@Ashish-Kumar-Dash
Copy link
Copy Markdown
Contributor Author

ping @NishantBansal2003 , I split smitebot into a more modular CLI layout like the fuzzamoto CLI: main.rs is now just clap wiring, the doctor logic lives in commands/doctor.rs, and shared helpers moved into utils/. It will keep PRs smaller and the command implementations isolated.

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.

3 participants