# enthonydev/our-commit architecture

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

- Interactive diagram: https://gitdiagram.com/enthonydev/our-commit
- Repository: https://github.com/enthonydev/our-commit

## Overview

OUR COMMIT is a TypeScript CLI that turns staged Git changes into a Conventional Commits suggestion using a selected AI provider. The main workflow reads the staged diff and file names, truncates oversized diffs, builds a Portuguese or English prompt, requests generated text, and displays it; only `--apply` triggers `git commit`. The README documents both provider options and these user-facing behaviors. Source excerpts show the CLI orchestration and provider calls; edges are limited to those relationships.

Main entry points: [`src/index.ts`](https://github.com/enthonydev/our-commit/blob/main/src/index.ts) (Commit CLI), [`src/llmProvider.ts`](https://github.com/enthonydev/our-commit/blob/main/src/llmProvider.ts) (Provider adapter), [`src/gitDiff.ts`](https://github.com/enthonydev/our-commit/blob/main/src/gitDiff.ts) (Staged changes), [`src/promptBuilder.ts`](https://github.com/enthonydev/our-commit/blob/main/src/promptBuilder.ts) (Prompt builder)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI orchestration"]
  node_cli["Commit CLI<br/>[index.ts]"]
end

subgraph group_context["Change context"]
  node_staged["Staged changes<br/>[gitDiff.ts]"]
  node_prompt["Prompt builder<br/>[promptBuilder.ts]"]
end

subgraph group_generation["Message generation"]
  node_provider["Provider adapter<br/>[llmProvider.ts]"]
end

node_developer(("Developer"))
node_anthropic["Anthropic API"]
node_openai["OpenAI API"]
node_git["Git"]

node_developer -->|"runs"| node_cli
node_cli -->|"reads staging"| node_staged
node_staged -->|"reads diff"| node_git
node_cli -->|"builds prompt"| node_prompt
node_prompt -->|"returns prompt"| node_cli
node_cli -->|"requests text"| node_provider
node_provider -->|"calls when selected"| node_anthropic
node_provider -->|"calls when selected"| node_openai
node_cli -->|"shows suggestion"| node_developer
node_cli -->|"commits on apply"| node_git

click node_cli "https://github.com/enthonydev/our-commit/blob/main/src/index.ts"
click node_staged "https://github.com/enthonydev/our-commit/blob/main/src/gitDiff.ts"
click node_prompt "https://github.com/enthonydev/our-commit/blob/main/src/promptBuilder.ts"
click node_provider "https://github.com/enthonydev/our-commit/blob/main/src/llmProvider.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_cli toneBlue
class node_staged,node_prompt toneAmber
class node_provider,node_anthropic,node_openai toneMint
class node_developer,node_git toneIndigo
```

## Components

### CLI orchestration

- [Commit CLI](https://github.com/enthonydev/our-commit/blob/main/src/index.ts): `src/index.ts`

### Change context

- [Staged changes](https://github.com/enthonydev/our-commit/blob/main/src/gitDiff.ts): `src/gitDiff.ts`
- [Prompt builder](https://github.com/enthonydev/our-commit/blob/main/src/promptBuilder.ts): `src/promptBuilder.ts`

### Message generation

- [Provider adapter](https://github.com/enthonydev/our-commit/blob/main/src/llmProvider.ts): `src/llmProvider.ts`

### Other components

- **Developer**
- **Anthropic API**
- **OpenAI API**
- **Git**

## Connections

- Developer → Commit CLI: runs (evidence: `README.md`)
- Commit CLI → Staged changes: reads staging (evidence: `src/index.ts`)
- Staged changes → Git: reads diff (evidence: `src/gitDiff.ts`)
- Commit CLI → Prompt builder: builds prompt (evidence: `src/index.ts`)
- Prompt builder → Commit CLI: returns prompt (evidence: `src/index.ts`)
- Commit CLI → Provider adapter: requests text (evidence: `src/index.ts`)
- Provider adapter → Anthropic API: calls when selected (evidence: `src/llmProvider.ts`)
- Provider adapter → OpenAI API: calls when selected (evidence: `src/llmProvider.ts`)
- Commit CLI → Developer: shows suggestion (evidence: `src/index.ts`)
- Commit CLI → Git: commits on apply (evidence: `src/index.ts`)
