Skip to content

crates csv anonymizer app

Douwe de Vries edited this page Jul 1, 2026 · 1 revision

csv-anonymizer-app

Active contributors: Douwe de Vries

Purpose

csv-anonymizer-app is the lightweight CLI binary and smoke harness for the shared Rust core. It is not the Tauri desktop app UI; it exists to exercise csv-anonymizer-core from a command-line entry point.

Directory layout

Path Role
crates/csv-anonymizer-app/src/cli.rs CLI action enum, argument parsing, command execution, and help text.
crates/csv-anonymizer-app/src/main.rs Process entry point that prints help/version or runs a parsed action.
crates/csv-anonymizer-app/Cargo.toml Binary crate metadata and path dependency on csv-anonymizer-core.

Key abstractions

  • CliAction describes supported actions: help, version, analyze, smoke anonymize, and anonymize.
  • parse_cli_args handles platform-specific startup noise, flags, positional arguments, and column parsing.
  • run_cli creates AnonymizerService and calls shared core APIs.
  • --smoke-anonymize analyzes input, auto-selects sensitive columns with should_auto_select_column, previews samples, then writes output with force: true.
  • The binary name is csv-anonymizer, configured in the crate Cargo.toml.

How it works

sequenceDiagram
    participant Shell as CLI process
    participant Parser as parse_cli_args
    participant Runner as run_cli
    participant Core as AnonymizerService

    Shell->>Parser: args
    Parser-->>Shell: CliAction
    Shell->>Runner: CliAction
    Runner->>Core: analyze_csv or anonymize_csv
    Core-->>Runner: metadata or result
    Runner-->>Shell: stdout or error
Loading

The CLI intentionally keeps behavior thin. Analysis prints row count and per-column detector output. Anonymization passes selected column indexes directly to the core. The smoke path proves that analysis, preview, auto-selection, and output writing work together without going through Tauri or React.

Integration points

  • csv-anonymizer-core provides all domain behavior.
  • Root scripts such as node scripts/rust-smoke.mjs can use the CLI smoke path.
  • Release tooling references this crate for smoke validation and legacy native macOS packaging paths.
  • Workspace checks include this crate through cargo test --workspace, cargo check --workspace, and cargo clippy --workspace --all-targets.

Entry points for modification

  • Change supported CLI commands or flags in crates/csv-anonymizer-app/src/cli.rs.
  • Change process-level error handling or entry behavior in crates/csv-anonymizer-app/src/main.rs.
  • Change binary metadata or dependencies in crates/csv-anonymizer-app/Cargo.toml.
  • Prefer adding shared behavior to csv-anonymizer-core instead of duplicating it in the CLI.

Key source files

  • crates/csv-anonymizer-app/src/cli.rs
  • crates/csv-anonymizer-app/src/main.rs
  • crates/csv-anonymizer-app/Cargo.toml

Clone this wiki locally