# saransh-kaushik/nopush architecture

> Architecture diagram of the GitHub repository saransh-kaushik/nopush, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/saransh-kaushik/nopush
- Repository: https://github.com/saransh-kaushik/nopush

## Overview

NoPush is a local CLI application that turns Git changes into structured AI review feedback. Its architecture is centered on a single pipeline: collect changes from Git, build a prompt, send it to an LLM provider, normalize the response into review findings, and render those findings in the terminal or optionally post them to GitHub.

1. Entry points and CLI boundary  
The executable starts in `src/nopush/__main__.py` and flows into the CLI package. `src/nopush/cli/app.py` likely wires the command set, while `src/nopush/cli/commands/` contains the user-facing actions: `init` for project setup and `review` for running the review pipeline.

2. Configuration subsystem  
`src/nopush/config/` is the local project configuration boundary. The README indicates a `nopush.yaml` file in the repo root, and the config manager/schema/constants files suggest the app loads, validates, and applies settings such as provider, model, review depth, and ignore paths before review starts.

3. Git change ingestion  
`src/nopush/git/` is responsible for turning repository state into reviewable input. The diff parser and Git models indicate support for staged changes, uncommitted diffs, or file-based selection. This is the first major data transformation step: raw Git diff data becomes structured internal diff objects.

4. Prompt construction  
`src/nopush/prompts/` converts parsed diffs into LLM-ready prompts. The builder and templates modules suggest a templated prompt strategy, likely chunking and formatting code changes with context-aware instructions so the provider receives a bounded, structured input.

5. Provider abstraction layer  
`src/nopush/providers/` isolates model/vendor specifics behind a common interface. `base.py` defines the contract, while `openai.py`, `anthropic.py`, and `gemini.py` implement provider-specific API calls. `registry.py` is the selection boundary that maps config values like `provider: openai` to the correct implementation.

6. Review orchestration  
`src/nopush/review/engine.py` is the core coordinator. It likely receives Git diffs, invokes prompt building, calls the selected provider, and converts the returned text into structured review results defined in `review/models.py`. This is the main internal control flow of the application.

7. Structured review output  
The README describes findings with severity, file paths, line numbers, explanations, and suggestions. That indicates the engine does not expose raw model output directly; it normalizes responses into a typed review model before presentation. This is important for diagramming because it separates model inference from user-visible review data.

8. Terminal rendering  
`src/nopush/cli/renderer.py` is the presentation boundary for the console. It formats the structured review output into readable, colorized terminal text. This layer depends on the review model but should not know about Git parsing or provider APIs.

9. GitHub integration  
`src/nopush/github/commenter.py` is a secondary output channel. It likely posts review findings back to GitHub, which means the architecture supports two sinks: local terminal output and remote GitHub commenting. This is separate from the core review pipeline and should be shown as an optional post-processing path.

10. End-to-end data flow  
The main runtime flow is: CLI command -> load config -> read Git diff -> build prompt -> call provider -> parse/normalize findings -> render in terminal. If GitHub posting is enabled, the structured findings also flow into the commenter after review generation.

11. Cross-cutting concerns  
Ignore rules from config affect which files reach the Git parser and prompt builder. Provider choice and model selection affect the network boundary. Review depth likely changes prompt verbosity or chunking strategy. These are configuration-driven controls that influence multiple subsystems without creating separate services.

12. Tooling and validation  
The repository is Python-based and packaged via `pyproject.toml`. The `.github/workflows` files and tests under `tests/` show CI and unit coverage around CLI, config, Git parsing, prompt building, providers, and review orchestration. That mirrors the architecture and is a good hint for diagram boundaries: each subsystem is tested in isolation.

13. Architectural summary  
NoPush is a modular, local-first command-line pipeline with clear separation between input collection, prompt generation, model invocation, result normalization, and presentation. The main diagram should show the review engine as the hub, with Git, config, prompts, providers, and rendering as distinct layers, plus an optional GitHub integration path at the output edge.

Main entry points: [`src/nopush/review/engine.py`](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/review/engine.py) (Review engine), [`src/nopush/providers/registry.py`](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/registry.py) (Provider select), [`src/nopush/cli/commands/review_cmd.py`](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/commands/review_cmd.py) (Review), [`src/nopush/cli/app.py`](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/app.py) (CLI app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry & CLI"]
  node_main(("nopush<br/>entrypoint<br/>[__main__.py]"))
  node_cli_app["CLI app<br/>command router<br/>[app.py]"]
  node_init_cmd["Init<br/>setup command<br/>[init_cmd.py]"]
  node_review_cmd["Review<br/>[review_cmd.py]"]
end

subgraph group_core["Core Pipeline"]
  node_config_mgr["Config<br/>[manager.py]"]
  node_git_diff["Git diff<br/>diff parser<br/>[diff_parser.py]"]
  node_prompt_builder["Prompt builder<br/>prompt composer<br/>[builder.py]"]
  node_review_engine{{"Review engine<br/>orchestrator<br/>[engine.py]"}}
  node_review_models["Review model<br/>finding schema<br/>[models.py]"]
end

subgraph group_providers["LLM Providers"]
  node_provider_registry["Provider select<br/>provider registry<br/>[registry.py]"]
  node_provider_base["Provider API<br/>provider contract<br/>[base.py]"]
  node_openai["OpenAI<br/>llm adapter<br/>[openai.py]"]
  node_anthropic["Anthropic<br/>llm adapter<br/>[anthropic.py]"]
  node_gemini["Gemini<br/>llm adapter<br/>[gemini.py]"]
end

subgraph group_outputs["Outputs"]
  node_renderer["Terminal<br/>cli renderer<br/>[renderer.py]"]
  node_github_commenter["GitHub post<br/>github sink<br/>[commenter.py]"]
end

node_main -->|"start"| node_cli_app
node_cli_app -->|"init"| node_init_cmd
node_cli_app -->|"review"| node_review_cmd
node_review_cmd -->|"load config"| node_config_mgr
node_review_cmd -->|"collect changes"| node_git_diff
node_review_cmd -->|"run"| node_review_engine
node_config_mgr -->|"provider choice"| node_provider_registry
node_config_mgr -->|"rules"| node_prompt_builder
node_git_diff -->|"diffs"| node_prompt_builder
node_prompt_builder -->|"prompt"| node_review_engine
node_review_engine -->|"select"| node_provider_registry
node_provider_registry -->|"implements"| node_provider_base
node_provider_registry -->|"openai"| node_openai
node_provider_registry -->|"anthropic"| node_anthropic
node_provider_registry -->|"gemini"| node_gemini
node_review_engine -->|"normalize"| node_review_models
node_review_engine -->|"render"| node_renderer
node_review_engine -->|"optional post"| node_github_commenter
node_review_models -->|"format"| node_renderer
node_review_models -->|"comment data"| node_github_commenter

click node_main "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/__main__.py"
click node_cli_app "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/app.py"
click node_init_cmd "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/commands/init_cmd.py"
click node_review_cmd "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/commands/review_cmd.py"
click node_config_mgr "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/config/manager.py"
click node_git_diff "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/git/diff_parser.py"
click node_prompt_builder "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/prompts/builder.py"
click node_review_engine "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/review/engine.py"
click node_review_models "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/review/models.py"
click node_provider_registry "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/registry.py"
click node_provider_base "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/base.py"
click node_openai "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/openai.py"
click node_anthropic "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/anthropic.py"
click node_gemini "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/gemini.py"
click node_renderer "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/renderer.py"
click node_github_commenter "https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/github/commenter.py"

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_main,node_cli_app,node_init_cmd,node_review_cmd toneBlue
class node_config_mgr,node_git_diff,node_prompt_builder,node_review_engine,node_review_models toneAmber
class node_provider_registry,node_provider_base,node_openai,node_anthropic,node_gemini toneMint
class node_renderer,node_github_commenter toneRose
```

## Components

### Entry & CLI

Executable entrypoint and user-facing commands

- [nopush](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/__main__.py): entrypoint · Module entry for the executable · `src/nopush/__main__.py`
- [CLI app](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/app.py): command router · Wires the command set and runtime CLI boundary · `src/nopush/cli/app.py`
- [Init](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/commands/init_cmd.py): setup command · Project initialization command · `src/nopush/cli/commands/init_cmd.py`
- [Review](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/commands/review_cmd.py): review command · Runs the review pipeline from the CLI · `src/nopush/cli/commands/review_cmd.py`

### Core Pipeline

Configuration, diff ingestion, prompt building, review orchestration, and result modeling

- [Config](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/config/manager.py): config loader · Loads and validates local review settings · `src/nopush/config/manager.py`
- [Git diff](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/git/diff_parser.py): diff parser · Converts repository changes into structured diff objects · `src/nopush/git/diff_parser.py`
- [Prompt builder](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/prompts/builder.py): prompt composer · Formats diffs and instructions into LLM-ready prompts · `src/nopush/prompts/builder.py`
- [Review engine](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/review/engine.py): orchestrator · Coordinates config, prompt generation, provider calls, and normalization · `src/nopush/review/engine.py`
- [Review model](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/review/models.py): finding schema · Typed findings and review result structures · `src/nopush/review/models.py`

### LLM Providers

Vendor abstraction and concrete API integrations

- [Provider select](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/registry.py): provider registry · Maps configuration to the active LLM implementation · `src/nopush/providers/registry.py`
- [Provider API](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/base.py): provider contract · Common interface for model vendors · `src/nopush/providers/base.py`
- [OpenAI](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/openai.py): llm adapter · OpenAI provider implementation · `src/nopush/providers/openai.py`
- [Anthropic](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/anthropic.py): llm adapter · Anthropic provider implementation · `src/nopush/providers/anthropic.py`
- [Gemini](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/providers/gemini.py): llm adapter · Gemini provider implementation · `src/nopush/providers/gemini.py`

### Outputs

Terminal rendering and optional GitHub posting

- [Terminal](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/cli/renderer.py): cli renderer · Formats structured findings for console output · `src/nopush/cli/renderer.py`
- [GitHub post](https://github.com/saransh-kaushik/nopush/blob/main/src/nopush/github/commenter.py): github sink · Posts structured review feedback back to GitHub · `src/nopush/github/commenter.py`

## Connections

- nopush → CLI app: start · Executable hands off to the CLI application
- CLI app → Init: init · Dispatches project setup commands
- CLI app → Review: review · Dispatches the review workflow
- Review → Config: load config · Reads local repository settings before review
- Review → Git diff: collect changes · Turns Git state into structured review input
- Review → Review engine: run · Invokes the review pipeline
- Config → Provider select: provider choice · Selects the active vendor from config
- Config → Prompt builder: rules · Supplies review depth and ignore settings
- Git diff → Prompt builder: diffs · Provides structured change data for prompt construction
- Prompt builder → Review engine: prompt · Feeds LLM-ready prompt content into orchestration
- Review engine → Provider select: select · Resolves the configured provider implementation
- Provider select → Provider API: implements · Registry targets the shared provider contract
- Provider select → OpenAI: openai · Chooses the OpenAI adapter when configured
- Provider select → Anthropic: anthropic · Chooses the Anthropic adapter when configured
- Provider select → Gemini: gemini · Chooses the Gemini adapter when configured
- Review engine → Review model: normalize · Converts raw model output into structured findings
- Review engine → Terminal: render · Sends findings to terminal presentation
- Review engine → GitHub post: optional post · Posts findings to GitHub when enabled
- Review model → Terminal: format · Renderer consumes typed review results
- Review model → GitHub post: comment data · GitHub integration uses the same structured findings
