Skip to content

refactor(cli): split main.rs into commands/ module directory#47

Merged
mostafa merged 1 commit into
mainfrom
feat/modularize-cli
Apr 30, 2026
Merged

refactor(cli): split main.rs into commands/ module directory#47
mostafa merged 1 commit into
mainfrom
feat/modularize-cli

Conversation

@mostafa
Copy link
Copy Markdown
Member

@mostafa mostafa commented Apr 30, 2026

Summary

  • Split crates/rsigma-cli/src/main.rs (2222 lines) into a commands/ module directory with 6 submodules for better maintainability
  • No functionality changes: pure restructuring with identical test results (71 tests pass, full workspace clippy clean)
  • Shared helpers (event filter, correlation config, input format parsing, pipeline/collection loading) remain in main.rs for reuse by both commands/ and daemon/

Test plan

  • cargo fmt --all -- --check passes
  • cargo clippy --workspace --all-targets --all-features -- -D warnings passes (zero warnings)
  • cargo test -p rsigma passes (71 tests, 0 failures)

Modularize the 2222-line main.rs into focused submodules for
maintainability. No logic, behavior, or API changes -- pure
restructuring with identical test results (71 tests pass).

New structure:
  main.rs             -- CLI definitions, dispatch, daemon, shared helpers
  commands/
    mod.rs            -- submodule declarations and re-exports
    parse.rs          -- parse, condition, stdin subcommands
    validate.rs       -- validate subcommand
    lint.rs           -- lint subcommand, schema validation, Painter
    eval.rs           -- eval subcommand, stream/line evaluation helpers
    convert.rs        -- convert, list-targets, list-formats subcommands
@mostafa mostafa merged commit 2436abd into main Apr 30, 2026
8 checks passed
@mostafa mostafa deleted the feat/modularize-cli branch April 30, 2026 14:44
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