# slill/windows-grep architecture

> Architecture diagram of the GitHub repository slill/windows-grep, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/slill/windows-grep
- Repository: https://github.com/slill/windows-grep

## Overview

Windows Grep is a Windows-focused, grep-style command-line file search utility. The documented workflow starts with a command and search term, selects and filters files, searches content, names, or hashes, optionally modifies or deletes matches, then prints results and summaries. It also documents an optional interactive shell and searches inside common document formats. The graph captures these capabilities, but source excerpts do not show the full entry-point dispatch or document-extraction implementation; uncertain links are omitted or marked unverified.

Main entry points: [`WindowsGrep/src/services/grep_service.rs`](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/services/grep_service.rs) (Search engine), [`WindowsGrep/src/services/native_service.rs`](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/services/native_service.rs) (Shell actions), [`WindowsGrep/src/models/grep_result.rs`](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/grep_result.rs) (Search results), [`WindowsGrep/src/utils/windows_utils.rs`](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/windows_utils.rs) (File selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Command entry"]
  node_cli["CLI command<br/>[main.rs]"]
  node_flags["Search flags<br/>[command_flag.rs]"]
  node_flag_utils["Flag parsing"]
end

subgraph group_search["Search workflow"]
  node_search_service["Search engine<br/>[grep_service.rs]"]
  node_hash_type["Hash algorithms<br/>[hash_type.rs]"]
  node_search_results["Search results<br/>[grep_result.rs]"]
  node_metrics["Search metrics<br/>[search_metrics.rs]"]
  node_result_scope["Result scopes<br/>[result_scope.rs]"]
end

subgraph group_filesystem["File operations"]
  node_file_selection["File selection<br/>[windows_utils.rs]"]
  node_file_item["File records<br/>[file_item.rs]"]
  node_size_type["Size units<br/>[file_size_type.rs]"]
  node_file_utils["File helpers<br/>[file_utils.rs]"]
end

subgraph group_output["Results and output"]
  node_console_item["Colored items<br/>[console_item.rs]"]
  node_console_service["Console output<br/>[console_service.rs]"]
end

subgraph group_shell["Interactive shell"]
  node_native_commands["Shell commands"]
  node_native_command["Shell request<br/>[native_command.rs]"]
  node_shell_parser["Shell parsing"]
  node_native_service["Shell actions<br/>[native_service.rs]"]
  node_console_utils["Console helpers<br/>[console_utils.rs]"]
end

node_user(("CLI user"))

node_user -->|"runs command"| node_cli
node_cli -.->|"starts search"| node_search_service
node_search_service -->|"parses options"| node_flag_utils
node_flag_utils -->|"uses definitions"| node_flags
node_search_service -->|"collects files"| node_file_selection
node_file_selection -->|"returns entries"| node_file_item
node_search_service -.->|"uses helpers"| node_file_utils
node_search_service -->|"selects hash"| node_hash_type
node_file_selection -.->|"formats sizes"| node_size_type
node_search_service -->|"builds matches"| node_search_results
node_search_service -->|"tracks counts"| node_metrics
node_search_results -->|"formats by scope"| node_result_scope
node_search_results -->|"stores source file"| node_file_item
node_search_results -->|"formats output"| node_console_item
node_search_service -->|"writes results"| node_console_service
node_console_service -->|"prints items"| node_console_item
node_cli -.->|"offers shell"| node_shell_parser
node_shell_parser -->|"recognizes commands"| node_native_commands
node_shell_parser -->|"builds requests"| node_native_command
node_native_service -->|"handles request"| node_native_command
node_native_service -->|"dispatches actions"| node_native_commands
node_native_service -->|"lists files"| node_file_selection
node_native_service -->|"writes output"| node_console_service
node_native_service -->|"clears console"| node_console_utils

click node_cli "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/main.rs"
click node_flags "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/command_flag.rs"
click node_flag_utils "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/command_flag_utils.rs"
click node_search_service "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/services/grep_service.rs"
click node_file_selection "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/windows_utils.rs"
click node_file_item "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/file_item.rs"
click node_hash_type "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/hash_type.rs"
click node_size_type "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/file_size_type.rs"
click node_file_utils "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/file_utils.rs"
click node_search_results "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/grep_result.rs"
click node_metrics "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/search_metrics.rs"
click node_result_scope "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/result_scope.rs"
click node_console_item "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/console_item.rs"
click node_console_service "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/services/console_service.rs"
click node_native_commands "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/native_command_type.rs"
click node_native_command "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/native_command.rs"
click node_shell_parser "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/windows_grep_utils.rs"
click node_native_service "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/services/native_service.rs"
click node_console_utils "https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/console_utils.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_flags,node_flag_utils,node_user toneBlue
class node_search_service,node_hash_type,node_search_results,node_metrics,node_result_scope toneAmber
class node_file_selection,node_file_item,node_size_type,node_file_utils toneMint
class node_console_item,node_console_service toneRose
class node_native_commands,node_native_command,node_shell_parser,node_native_service,node_console_utils toneIndigo
```

## Components

### Command entry

- [CLI command](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/main.rs): `WindowsGrep/src/main.rs`
- [Search flags](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/command_flag.rs): `WindowsGrep/src/enums/command_flag.rs`
- [Flag parsing](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/command_flag_utils.rs): `WindowsGrep/src/utils/command_flag_utils.rs`

### Search workflow

- [Search engine](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/services/grep_service.rs): `WindowsGrep/src/services/grep_service.rs`
- [Hash algorithms](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/hash_type.rs): `WindowsGrep/src/enums/hash_type.rs`
- [Search results](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/grep_result.rs): `WindowsGrep/src/models/grep_result.rs`
- [Search metrics](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/search_metrics.rs): `WindowsGrep/src/models/search_metrics.rs`
- [Result scopes](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/result_scope.rs): `WindowsGrep/src/enums/result_scope.rs`

### File operations

- [File selection](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/windows_utils.rs): `WindowsGrep/src/utils/windows_utils.rs`
- [File records](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/file_item.rs): `WindowsGrep/src/models/file_item.rs`
- [Size units](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/file_size_type.rs): `WindowsGrep/src/enums/file_size_type.rs`
- [File helpers](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/file_utils.rs): `WindowsGrep/src/utils/file_utils.rs`

### Results and output

- [Colored items](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/console_item.rs): `WindowsGrep/src/models/console_item.rs`
- [Console output](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/services/console_service.rs): `WindowsGrep/src/services/console_service.rs`

### Interactive shell

- [Shell commands](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/enums/native_command_type.rs): `WindowsGrep/src/enums/native_command_type.rs`
- [Shell request](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/models/native_command.rs): `WindowsGrep/src/models/native_command.rs`
- [Shell parsing](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/windows_grep_utils.rs): `WindowsGrep/src/utils/windows_grep_utils.rs`
- [Shell actions](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/services/native_service.rs): `WindowsGrep/src/services/native_service.rs`
- [Console helpers](https://github.com/slill/windows-grep/blob/master/WindowsGrep/src/utils/console_utils.rs): `WindowsGrep/src/utils/console_utils.rs`

### Other components

- **CLI user**

## Connections

- CLI user → CLI command: runs command (evidence: `README.md`)
- CLI command → Search engine: starts search
- Search engine → Flag parsing: parses options (evidence: `WindowsGrep/src/services/grep_service.rs`)
- Flag parsing → Search flags: uses definitions (evidence: `WindowsGrep/src/utils/command_flag_utils.rs`)
- Search engine → File selection: collects files (evidence: `WindowsGrep/src/services/grep_service.rs`)
- File selection → File records: returns entries (evidence: `WindowsGrep/src/utils/windows_utils.rs`)
- Search engine → File helpers: uses helpers (evidence: `WindowsGrep/src/services/grep_service.rs`)
- Search engine → Hash algorithms: selects hash (evidence: `WindowsGrep/src/services/grep_service.rs`)
- File selection → Size units: formats sizes (evidence: `WindowsGrep/src/utils/windows_utils.rs`)
- Search engine → Search results: builds matches (evidence: `WindowsGrep/src/services/grep_service.rs`)
- Search engine → Search metrics: tracks counts (evidence: `WindowsGrep/src/services/grep_service.rs`)
- Search results → Result scopes: formats by scope (evidence: `WindowsGrep/src/models/grep_result.rs`)
- Search results → File records: stores source file (evidence: `WindowsGrep/src/models/grep_result.rs`)
- Search results → Colored items: formats output (evidence: `WindowsGrep/src/models/grep_result.rs`)
- Search engine → Console output: writes results (evidence: `WindowsGrep/src/services/grep_service.rs`)
- Console output → Colored items: prints items (evidence: `WindowsGrep/src/services/console_service.rs`)
- CLI command → Shell parsing: offers shell
- Shell parsing → Shell commands: recognizes commands (evidence: `WindowsGrep/src/utils/windows_grep_utils.rs`)
- Shell parsing → Shell request: builds requests (evidence: `WindowsGrep/src/utils/windows_grep_utils.rs`)
- Shell actions → Shell request: handles request (evidence: `WindowsGrep/src/services/native_service.rs`)
- Shell actions → Shell commands: dispatches actions (evidence: `WindowsGrep/src/services/native_service.rs`)
- Shell actions → File selection: lists files (evidence: `WindowsGrep/src/services/native_service.rs`)
- Shell actions → Console output: writes output (evidence: `WindowsGrep/src/services/native_service.rs`)
- Shell actions → Console helpers: clears console (evidence: `WindowsGrep/src/services/native_service.rs`)
