# rsavnani18/pixelkit-cli architecture

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

- Interactive diagram: https://gitdiagram.com/rsavnani18/pixelkit-cli
- Repository: https://github.com/rsavnani18/pixelkit-cli

## Overview

PixelKit CLI converts supported images to WebP or PNG. Users invoke a converter with an optional path; the command parses it, then either validates one file directly or scans and validates a directory before interactive selection. The command invokes conversion and reports per-file results and progress. The graph also includes global CLI options and converter registration. Converter internals are represented at their implementation paths; unsampled helpers and UI details are not inferred beyond the indexed references and README capabilities.

Main entry points: [`src/commands/webp.ts`](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/commands/webp.ts) (WebP Command), [`src/commands/png.ts`](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/commands/png.ts) (PNG Command), [`src/cli/index.ts`](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/cli/index.ts) (CLI Entry), [`src/converters/webp/index.ts`](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/webp/index.ts) (WebP Converter)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI Entry"]
  node_entry["CLI Entry<br/>[index.ts]"]
  node_global["Global Options<br/>[commands.ts]"]
end

subgraph group_workflow["Conversion Workflow"]
  node_arguments["Path Arguments<br/>[arguments.ts]"]
  node_webp_command["WebP Command<br/>[webp.ts]"]
  node_png_command["PNG Command<br/>[png.ts]"]
  node_scanner["Directory Scanner<br/>[scanner.ts]"]
  node_validator["Image Validator<br/>[file-validator.ts]"]
end

subgraph group_converters["Format Converters"]
  node_registry["Converter Registry<br/>[registry.ts]"]
  node_webp["WebP Converter<br/>[index.ts]"]
  node_webp_options["WebP Options<br/>[options.ts]"]
  node_png["PNG Converter<br/>[index.ts]"]
  node_png_options["PNG Options<br/>[options.ts]"]
  node_engine["Conversion Engine<br/>[converter.ts]"]
  node_output["Output Protection<br/>[output-manager.ts]"]
end

subgraph group_terminal["Terminal UI"]
  node_selector["Image Selector<br/>[image-selector.ts]"]
  node_progress["Progress Display<br/>[progress.ts]"]
  node_messages["Status Messages<br/>[messages.ts]"]
end

node_developer(("Developer"))

node_developer -->|"invokes"| node_entry
node_entry -->|"dispatches options"| node_global
node_entry -->|"loads WebP"| node_webp_command
node_entry -->|"loads PNG"| node_png_command
node_webp_command -->|"parses path"| node_arguments
node_png_command -->|"parses path"| node_arguments
node_webp_command -->|"gets definition"| node_registry
node_png_command -->|"gets definition"| node_registry
node_global -->|"lists converters"| node_registry
node_webp_command -->|"scans directory"| node_scanner
node_png_command -->|"scans directory"| node_scanner
node_webp_command -->|"validates files"| node_validator
node_png_command -->|"validates files"| node_validator
node_webp_command -->|"selects images"| node_selector
node_png_command -->|"selects images"| node_selector
node_webp_command -->|"converts files"| node_webp
node_png_command -->|"converts files"| node_png
node_webp_command -->|"renders progress"| node_progress
node_png_command -->|"renders progress"| node_progress
node_webp_command -->|"reports results"| node_messages
node_png_command -->|"reports results"| node_messages
node_webp -->|"delegates conversion"| node_engine
node_png -->|"delegates conversion"| node_engine
node_engine -->|"checks output"| node_output
node_webp -->|"uses options"| node_webp_options
node_png -->|"uses options"| node_png_options

click node_entry "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/cli/index.ts"
click node_global "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/cli/commands.ts"
click node_arguments "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/cli/arguments.ts"
click node_webp_command "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/commands/webp.ts"
click node_png_command "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/commands/png.ts"
click node_scanner "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/core/scanner.ts"
click node_validator "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/core/file-validator.ts"
click node_selector "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/ui/image-selector.ts"
click node_progress "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/ui/progress.ts"
click node_messages "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/ui/messages.ts"
click node_registry "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/registry.ts"
click node_webp "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/webp/index.ts"
click node_webp_options "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/webp/options.ts"
click node_png "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/png/index.ts"
click node_png_options "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/png/options.ts"
click node_engine "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/core/converter.ts"
click node_output "https://github.com/rsavnani18/pixelkit-cli/blob/main/src/core/output-manager.ts"

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_entry,node_global toneBlue
class node_arguments,node_webp_command,node_png_command,node_scanner,node_validator toneAmber
class node_registry,node_webp,node_webp_options,node_png,node_png_options,node_engine,node_output toneMint
class node_selector,node_progress,node_messages toneRose
class node_developer toneIndigo
```

## Components

### CLI Entry

- [CLI Entry](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/cli/index.ts): `src/cli/index.ts`
- [Global Options](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/cli/commands.ts): `src/cli/commands.ts`

### Conversion Workflow

- [Path Arguments](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/cli/arguments.ts): `src/cli/arguments.ts`
- [WebP Command](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/commands/webp.ts): `src/commands/webp.ts`
- [PNG Command](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/commands/png.ts): `src/commands/png.ts`
- [Directory Scanner](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/core/scanner.ts): `src/core/scanner.ts`
- [Image Validator](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/core/file-validator.ts): `src/core/file-validator.ts`

### Format Converters

- [Converter Registry](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/registry.ts): `src/converters/registry.ts`
- [WebP Converter](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/webp/index.ts): `src/converters/webp/index.ts`
- [WebP Options](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/webp/options.ts): `src/converters/webp/options.ts`
- [PNG Converter](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/png/index.ts): `src/converters/png/index.ts`
- [PNG Options](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/converters/png/options.ts): `src/converters/png/options.ts`
- [Conversion Engine](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/core/converter.ts): `src/core/converter.ts`
- [Output Protection](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/core/output-manager.ts): `src/core/output-manager.ts`

### Terminal UI

- [Image Selector](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/ui/image-selector.ts): `src/ui/image-selector.ts`
- [Progress Display](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/ui/progress.ts): `src/ui/progress.ts`
- [Status Messages](https://github.com/rsavnani18/pixelkit-cli/blob/main/src/ui/messages.ts): `src/ui/messages.ts`

### Other components

- **Developer**

## Connections

- Developer → CLI Entry: invokes (evidence: `README.md`)
- CLI Entry → Global Options: dispatches options (evidence: `src/cli/index.ts`)
- CLI Entry → WebP Command: loads WebP (evidence: `src/cli/index.ts`)
- CLI Entry → PNG Command: loads PNG (evidence: `src/cli/index.ts`)
- WebP Command → Path Arguments: parses path (evidence: `src/commands/webp.ts`)
- PNG Command → Path Arguments: parses path (evidence: `src/commands/png.ts`)
- WebP Command → Converter Registry: gets definition (evidence: `src/commands/webp.ts`)
- PNG Command → Converter Registry: gets definition (evidence: `src/commands/png.ts`)
- Global Options → Converter Registry: lists converters (evidence: `src/cli/commands.ts`)
- WebP Command → Directory Scanner: scans directory (evidence: `src/commands/webp.ts`)
- PNG Command → Directory Scanner: scans directory (evidence: `src/commands/png.ts`)
- WebP Command → Image Validator: validates files (evidence: `src/commands/webp.ts`)
- PNG Command → Image Validator: validates files (evidence: `src/commands/png.ts`)
- WebP Command → Image Selector: selects images (evidence: `src/commands/webp.ts`)
- PNG Command → Image Selector: selects images (evidence: `src/commands/png.ts`)
- WebP Command → WebP Converter: converts files (evidence: `src/commands/webp.ts`)
- PNG Command → PNG Converter: converts files (evidence: `src/commands/png.ts`)
- WebP Command → Progress Display: renders progress (evidence: `src/commands/webp.ts`)
- PNG Command → Progress Display: renders progress (evidence: `src/commands/png.ts`)
- WebP Command → Status Messages: reports results (evidence: `src/commands/webp.ts`)
- PNG Command → Status Messages: reports results (evidence: `src/commands/png.ts`)
- WebP Converter → Conversion Engine: delegates conversion (evidence: `src/converters/webp/index.ts`)
- PNG Converter → Conversion Engine: delegates conversion (evidence: `src/converters/png/index.ts`)
- Conversion Engine → Output Protection: checks output (evidence: `src/core/converter.ts`)
- WebP Converter → WebP Options: uses options (evidence: `src/converters/webp/index.ts`)
- PNG Converter → PNG Options: uses options (evidence: `src/converters/png/index.ts`)
