# justmeetpatel/zit architecture

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

- Interactive diagram: https://gitdiagram.com/justmeetpatel/zit
- Repository: https://github.com/justmeetpatel/zit

## Overview

zit is a Rust terminal UI for safely managing Git repositories, GitHub workflows, and optional AI-assisted guidance. The principal flow is: a user launches the TUI, navigates a routed view, performs a Git or GitHub operation, and receives refreshed repository state or guidance. Git domain modules delegate native commands to the Git runner, while AI requests carry repository context through a provider client to the optional Lambda/Bedrock backend. The tree and excerpts establish the major capabilities, but some feature wiring is inferred only from documented structure.

Main entry points: [`src/app.rs`](https://github.com/justmeetpatel/zit/blob/main/src/app.rs) (App Orchestrator), [`src/git/runner.rs`](https://github.com/justmeetpatel/zit/blob/main/src/git/runner.rs) (Git Runner), [`src/main.rs`](https://github.com/justmeetpatel/zit/blob/main/src/main.rs) (Terminal Entry), [`src/config.rs`](https://github.com/justmeetpatel/zit/blob/main/src/config.rs) (Config Loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["TUI Runtime"]
  node_main["Terminal Entry<br/>[main.rs]"]
  node_app["App Orchestrator<br/>[app.rs]"]
  node_ui_views["Feature Views"]
end

subgraph group_git["Git Operations"]
  node_git_runner["Git Runner<br/>[runner.rs]"]
  node_repo_state[("Repository State")]
  node_staging_commit["Stage Commit<br/>[diff.rs]"]
  node_history_recovery["History Recovery<br/>[log.rs]"]
  node_branching["Branch Operations<br/>[branch.rs]"]
  node_merge_tools["Merge Workflows<br/>[merge.rs]"]
  node_stash_tools["Stash Manager<br/>[stash.rs]"]
  node_advanced_git["Advanced Git<br/>[bisect.rs]"]
end

subgraph group_ai["AI Assistance"]
  node_ai_client["AI Client<br/>[client.rs]"]
  node_ai_provider["AI Providers<br/>[provider.rs]"]
  node_lambda["Mentor Lambda<br/>[handler.py]"]
end

subgraph group_github["GitHub Integration"]
  node_github_ops["GitHub Operations<br/>[github_auth.rs]"]
end

subgraph group_security["Configuration Security"]
  node_config["Config Loader<br/>[config.rs]"]
  node_keychain[("OS Keychain<br/>[keychain.rs]")]
  node_secret_scan["Secret Scanner<br/>[secrets.rs]"]
end

node_user(("Git User"))
node_github_service["GitHub Service"]
node_bedrock["Amazon Bedrock"]

node_user -->|"launches"| node_main
node_main -->|"runs loop"| node_app
node_main -->|"renders views"| node_ui_views
node_main -->|"dispatches input"| node_app
node_app -->|"handles staging"| node_staging_commit
node_app -->|"handles branches"| node_branching
node_app -->|"handles history"| node_history_recovery
node_app -->|"handles merges"| node_merge_tools
node_app -->|"handles stashes"| node_stash_tools
node_app -->|"runs workflows"| node_advanced_git
node_app -->|"handles GitHub"| node_github_ops
node_app -->|"scans commits"| node_secret_scan
node_staging_commit -->|"runs git"| node_git_runner
node_branching -->|"runs git"| node_git_runner
node_history_recovery -->|"runs git"| node_git_runner
node_merge_tools -->|"runs git"| node_git_runner
node_stash_tools -->|"runs git"| node_git_runner
node_advanced_git -->|"runs git"| node_git_runner
node_git_runner -->|"reads writes"| node_repo_state
node_app -.->|"requests guidance"| node_ai_client
node_ai_client -->|"selects provider"| node_ai_provider
node_ai_provider -.->|"sends context"| node_lambda
node_lambda -->|"invokes model"| node_bedrock
node_github_ops -->|"calls API"| node_github_service
node_config -->|"migrates secrets"| node_keychain
node_main -->|"loads settings"| node_config
node_app -->|"uses settings"| node_config

click node_main "https://github.com/justmeetpatel/zit/blob/main/src/main.rs"
click node_app "https://github.com/justmeetpatel/zit/blob/main/src/app.rs"
click node_ui_views "https://github.com/justmeetpatel/zit/tree/main/src/ui"
click node_git_runner "https://github.com/justmeetpatel/zit/blob/main/src/git/runner.rs"
click node_staging_commit "https://github.com/justmeetpatel/zit/blob/main/src/git/diff.rs"
click node_history_recovery "https://github.com/justmeetpatel/zit/blob/main/src/git/log.rs"
click node_branching "https://github.com/justmeetpatel/zit/blob/main/src/git/branch.rs"
click node_merge_tools "https://github.com/justmeetpatel/zit/blob/main/src/git/merge.rs"
click node_stash_tools "https://github.com/justmeetpatel/zit/blob/main/src/git/stash.rs"
click node_advanced_git "https://github.com/justmeetpatel/zit/blob/main/src/git/bisect.rs"
click node_github_ops "https://github.com/justmeetpatel/zit/blob/main/src/git/github_auth.rs"
click node_ai_client "https://github.com/justmeetpatel/zit/blob/main/src/ai/client.rs"
click node_ai_provider "https://github.com/justmeetpatel/zit/blob/main/src/ai/provider.rs"
click node_lambda "https://github.com/justmeetpatel/zit/blob/main/aws/lambda/handler.py"
click node_config "https://github.com/justmeetpatel/zit/blob/main/src/config.rs"
click node_keychain "https://github.com/justmeetpatel/zit/blob/main/src/keychain.rs"
click node_secret_scan "https://github.com/justmeetpatel/zit/blob/main/src/git/secrets.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_main,node_app,node_ui_views,node_user toneBlue
class node_git_runner,node_repo_state,node_staging_commit,node_history_recovery,node_branching,node_merge_tools,node_stash_tools,node_advanced_git toneAmber
class node_ai_client,node_ai_provider,node_lambda toneMint
class node_github_ops toneRose
class node_config,node_keychain,node_secret_scan,node_github_service,node_bedrock toneIndigo
```

## Components

### TUI Runtime

- [Terminal Entry](https://github.com/justmeetpatel/zit/blob/main/src/main.rs): `src/main.rs`
- [App Orchestrator](https://github.com/justmeetpatel/zit/blob/main/src/app.rs): `src/app.rs`
- [Feature Views](https://github.com/justmeetpatel/zit/tree/main/src/ui): `src/ui`

### Git Operations

- [Git Runner](https://github.com/justmeetpatel/zit/blob/main/src/git/runner.rs): `src/git/runner.rs`
- **Repository State**
- [Stage Commit](https://github.com/justmeetpatel/zit/blob/main/src/git/diff.rs): `src/git/diff.rs`
- [History Recovery](https://github.com/justmeetpatel/zit/blob/main/src/git/log.rs): `src/git/log.rs`
- [Branch Operations](https://github.com/justmeetpatel/zit/blob/main/src/git/branch.rs): `src/git/branch.rs`
- [Merge Workflows](https://github.com/justmeetpatel/zit/blob/main/src/git/merge.rs): `src/git/merge.rs`
- [Stash Manager](https://github.com/justmeetpatel/zit/blob/main/src/git/stash.rs): `src/git/stash.rs`
- [Advanced Git](https://github.com/justmeetpatel/zit/blob/main/src/git/bisect.rs): `src/git/bisect.rs`

### AI Assistance

- [AI Client](https://github.com/justmeetpatel/zit/blob/main/src/ai/client.rs): `src/ai/client.rs`
- [AI Providers](https://github.com/justmeetpatel/zit/blob/main/src/ai/provider.rs): `src/ai/provider.rs`
- [Mentor Lambda](https://github.com/justmeetpatel/zit/blob/main/aws/lambda/handler.py): `aws/lambda/handler.py`

### GitHub Integration

- [GitHub Operations](https://github.com/justmeetpatel/zit/blob/main/src/git/github_auth.rs): `src/git/github_auth.rs`

### Configuration Security

- [Config Loader](https://github.com/justmeetpatel/zit/blob/main/src/config.rs): `src/config.rs`
- [OS Keychain](https://github.com/justmeetpatel/zit/blob/main/src/keychain.rs): `src/keychain.rs`
- [Secret Scanner](https://github.com/justmeetpatel/zit/blob/main/src/git/secrets.rs): `src/git/secrets.rs`

### Other components

- **Git User**
- **GitHub Service**
- **Amazon Bedrock**

## Connections

- Git User → Terminal Entry: launches
- Terminal Entry → App Orchestrator: runs loop
- Terminal Entry → Feature Views: renders views
- Terminal Entry → App Orchestrator: dispatches input
- App Orchestrator → Stage Commit: handles staging
- App Orchestrator → Branch Operations: handles branches
- App Orchestrator → History Recovery: handles history
- App Orchestrator → Merge Workflows: handles merges
- App Orchestrator → Stash Manager: handles stashes
- App Orchestrator → Advanced Git: runs workflows
- App Orchestrator → GitHub Operations: handles GitHub
- App Orchestrator → Secret Scanner: scans commits
- Stage Commit → Git Runner: runs git
- Branch Operations → Git Runner: runs git
- History Recovery → Git Runner: runs git
- Merge Workflows → Git Runner: runs git
- Stash Manager → Git Runner: runs git
- Advanced Git → Git Runner: runs git
- Git Runner → Repository State: reads writes
- App Orchestrator → AI Client: requests guidance
- AI Client → AI Providers: selects provider
- AI Providers → Mentor Lambda: sends context
- Mentor Lambda → Amazon Bedrock: invokes model
- GitHub Operations → GitHub Service: calls API
- Config Loader → OS Keychain: migrates secrets
- Terminal Entry → Config Loader: loads settings
- App Orchestrator → Config Loader: uses settings
