Skip to content

Refactor scan::run into a ScanContext struct #3

Open

Description

@utof

Context

crates/cli/src/cmd/scan.rs::run has 8+ parameters and growing. The desktop crate's commands.rs duplicates much of the same logic. Phase 1c spec acknowledged this as tech debt and deferred a `ScanContext` struct.

Action

Create a `ScanContext` builder that holds scanner, hasher, file_repo, volume_repo, device_id, cancel flag, and args. Both CLI and desktop construct it and call `context.run()`. This also eliminates the scan logic duplication between CLI and desktop.

Priority

Medium — current code works but the parameter count and duplication will get worse as phases 3+ add more scan features (watching, progress events).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions