# amma-dada/linecounter architecture

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

- Interactive diagram: https://gitdiagram.com/amma-dada/linecounter
- Repository: https://github.com/amma-dada/linecounter

## Overview

LineCounter is a Rust line-counting tool with both a terminal CLI and a Tauri desktop app. Users provide a file, directory, or pasted text; the relevant entry point calls the counting engine, which returns detailed line, word, character, and file statistics. The desktop product also documents an inspector/editor, batch reports, and live paste counting. The excerpts establish CLI and backend calls; UI implementation details and several advertised features are documented only in the README, so those links are marked unverified.

Main entry points: [`src-tauri/src/main.rs`](https://github.com/amma-dada/linecounter/blob/main/src-tauri/src/main.rs) (Tauri Backend), [`ui/index.html`](https://github.com/amma-dada/linecounter/blob/main/ui/index.html) (Desktop UI), [`src/main.rs`](https://github.com/amma-dada/linecounter/blob/main/src/main.rs) (Terminal CLI), [`src/counter.rs`](https://github.com/amma-dada/linecounter/blob/main/src/counter.rs) (CLI Counter Engine)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User Entry Points"]
  node_cli["Terminal CLI<br/>[main.rs]"]
  node_desktop_app["Tauri Backend<br/>[main.rs]"]
end

subgraph group_desktop["Desktop Workflows"]
  node_desktop_ui["Desktop UI<br/>[index.html]"]
  node_inspector["File Inspector<br/>[index.html]"]
  node_editor["Code Editor<br/>[index.html]"]
  node_batch["Batch Scanner<br/>[index.html]"]
  node_paste["Live Paste<br/>[index.html]"]
end

subgraph group_engine["Counting Engine"]
  node_cli_engine["CLI Counter Engine<br/>[counter.rs]"]
  node_desktop_engine["Desktop Counter Engine<br/>[counter.rs]"]
end

node_user(("User"))

node_user -->|"provides path"| node_cli
node_user -->|"uses app"| node_desktop_ui
node_cli -->|"counts and scans"| node_cli_engine
node_desktop_ui -.->|"invokes commands"| node_desktop_app
node_desktop_app -->|"counts and scans"| node_desktop_engine
node_desktop_app -.->|"serves workflow"| node_inspector
node_desktop_app -.->|"saves edits"| node_editor
node_desktop_app -.->|"scans paths"| node_batch
node_desktop_app -.->|"counts text"| node_paste
node_inspector -.->|"displays results"| node_desktop_ui
node_editor -.->|"edits code"| node_desktop_ui
node_batch -.->|"exports reports"| node_desktop_ui
node_paste -.->|"shows counts"| node_desktop_ui

click node_cli "https://github.com/amma-dada/linecounter/blob/main/src/main.rs"
click node_desktop_app "https://github.com/amma-dada/linecounter/blob/main/src-tauri/src/main.rs"
click node_desktop_ui "https://github.com/amma-dada/linecounter/blob/main/ui/index.html"
click node_inspector "https://github.com/amma-dada/linecounter/blob/main/ui/index.html"
click node_editor "https://github.com/amma-dada/linecounter/blob/main/ui/index.html"
click node_batch "https://github.com/amma-dada/linecounter/blob/main/ui/index.html"
click node_paste "https://github.com/amma-dada/linecounter/blob/main/ui/index.html"
click node_cli_engine "https://github.com/amma-dada/linecounter/blob/main/src/counter.rs"
click node_desktop_engine "https://github.com/amma-dada/linecounter/blob/main/src-tauri/src/counter.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_desktop_app,node_user toneBlue
class node_desktop_ui,node_inspector,node_editor,node_batch,node_paste toneAmber
class node_cli_engine,node_desktop_engine toneMint
```

## Components

### User Entry Points

- [Terminal CLI](https://github.com/amma-dada/linecounter/blob/main/src/main.rs): `src/main.rs`
- [Tauri Backend](https://github.com/amma-dada/linecounter/blob/main/src-tauri/src/main.rs): `src-tauri/src/main.rs`

### Desktop Workflows

- [Desktop UI](https://github.com/amma-dada/linecounter/blob/main/ui/index.html): `ui/index.html`
- [File Inspector](https://github.com/amma-dada/linecounter/blob/main/ui/index.html): `ui/index.html`
- [Code Editor](https://github.com/amma-dada/linecounter/blob/main/ui/index.html): `ui/index.html`
- [Batch Scanner](https://github.com/amma-dada/linecounter/blob/main/ui/index.html): `ui/index.html`
- [Live Paste](https://github.com/amma-dada/linecounter/blob/main/ui/index.html): `ui/index.html`

### Counting Engine

- [CLI Counter Engine](https://github.com/amma-dada/linecounter/blob/main/src/counter.rs): `src/counter.rs`
- [Desktop Counter Engine](https://github.com/amma-dada/linecounter/blob/main/src-tauri/src/counter.rs): `src-tauri/src/counter.rs`

### Other components

- **User**

## Connections

- User → Terminal CLI: provides path (evidence: `README.md`)
- User → Desktop UI: uses app (evidence: `README.md`)
- Terminal CLI → CLI Counter Engine: counts and scans (evidence: `src/main.rs`)
- Desktop UI → Tauri Backend: invokes commands
- Tauri Backend → Desktop Counter Engine: counts and scans (evidence: `src-tauri/src/main.rs`)
- Tauri Backend → File Inspector: serves workflow
- Tauri Backend → Code Editor: saves edits
- Tauri Backend → Batch Scanner: scans paths
- Tauri Backend → Live Paste: counts text
- File Inspector → Desktop UI: displays results
- Code Editor → Desktop UI: edits code
- Batch Scanner → Desktop UI: exports reports
- Live Paste → Desktop UI: shows counts
