# braedonsaunders/codeflow architecture

> Architecture diagram of the GitHub repository braedonsaunders/codeflow, 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/braedonsaunders/codeflow
- Repository: https://github.com/braedonsaunders/codeflow

## Overview

CodeFlow turns a GitHub repository or local files into an interactive architecture view and codebase insights; its CLI serves the same browser UI. The separate GitHub Action analyzes a checked-out repository, records a health snapshot, renders an SVG card, and can post a merged-PR receipt. The browser product is represented by index.html because its implementation was not sampled; README-documented capabilities and workflows are shown, but their internal wiring is not asserted. Card edges follow the sampled action and analysis code.

Main entry points: [`index.html`](https://github.com/braedonsaunders/codeflow/blob/main/index.html) (Browser UI), [`card/index.js`](https://github.com/braedonsaunders/codeflow/blob/main/card/index.js) (Action entry), [`card/lib/analysis.js`](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/analysis.js) (Analysis pipeline), [`card/render/styles.js`](https://github.com/braedonsaunders/codeflow/blob/main/card/render/styles.js) (Card styles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser analysis"]
  node_web_ui["Browser UI<br/>[index.html]"]
  node_repo_access["Repository access<br/>[index.html]"]
  node_local_scan["Local scanning<br/>[index.html]"]
end

subgraph group_insights["Architecture insights"]
  node_dependency_graph["Dependency graph<br/>[index.html]"]
  node_code_canvas["Code canvas<br/>[index.html]"]
  node_code_insights["Code insights<br/>[index.html]"]
  node_health_activity["Health and activity<br/>[index.html]"]
  node_markdown_graph["Markdown graph<br/>[index.html]"]
  node_pr_impact["PR impact<br/>[index.html]"]
end

subgraph group_card_analysis["Card analysis"]
  node_action_entry["Action entry<br/>[index.js]"]
  node_input_config["Action inputs<br/>[inputs.js]"]
  node_repo_collection["File collection<br/>[collect.js]"]
  node_exclude_patterns["Exclude matching<br/>[exclude.js]"]
  node_analysis_pipeline["Analysis pipeline<br/>[analysis.js]"]
  node_analyzer_loader["Analyzer loader<br/>[analyzer.js]"]
  node_snapshot["Health snapshot<br/>[state.js]"]
end

subgraph group_card_output["Card outputs"]
  node_history_file[("Snapshot history<br/>[state.js]")]
  node_card_renderer["SVG card renderer<br/>[card.js]"]
  node_style_renderers["Card styles<br/>[styles.js]"]
  node_theme["Theme palette<br/>[theme.js]"]
  node_sparkline["Sparkline<br/>[sparkline.js]"]
  node_receipt_markdown["PR receipt<br/>[receipt-md.js]"]
end

subgraph group_integrations["GitHub integrations"]
  node_git_commit["Git commit<br/>[git.js]"]
  node_pr_comment["PR comment API<br/>[pr.js]"]
end

node_user(("Engineer"))
node_cli["Local CLI<br/>[codeflow.mjs]"]
node_github_repo[("GitHub repository")]
node_local_files[("Local files")]
node_github_action(("GitHub Actions"))
node_github_pr["GitHub PR"]

node_user -->|"opens"| node_web_ui
node_user -->|"runs"| node_cli
node_cli -->|"serves UI"| node_web_ui
node_web_ui -->|"analyzes URL"| node_repo_access
node_repo_access -->|"fetches from"| node_github_repo
node_web_ui -->|"analyzes files"| node_local_scan
node_local_scan -->|"reads locally"| node_local_files
node_web_ui -->|"shows graph"| node_dependency_graph
node_web_ui -->|"opens code view"| node_code_canvas
node_web_ui -->|"shows analysis"| node_code_insights
node_web_ui -->|"shows metrics"| node_health_activity
node_web_ui -->|"graphs notes"| node_markdown_graph
node_web_ui -->|"analyzes PR"| node_pr_impact
node_github_action -->|"invokes"| node_action_entry
node_action_entry -->|"loads inputs"| node_input_config
node_action_entry -->|"analyzes repository"| node_analysis_pipeline
node_analysis_pipeline -->|"loads analyzer"| node_analyzer_loader
node_analysis_pipeline -->|"collects files"| node_repo_collection
node_repo_collection -->|"filters paths"| node_exclude_patterns
node_analysis_pipeline -->|"derives snapshot"| node_snapshot
node_action_entry -->|"reads and writes"| node_history_file
node_action_entry -->|"renders snapshot"| node_card_renderer
node_card_renderer -->|"dispatches style"| node_style_renderers
node_style_renderers -->|"selects palette"| node_theme
node_style_renderers -->|"renders sparkline"| node_sparkline
node_action_entry -->|"renders receipt"| node_receipt_markdown
node_action_entry -->|"upserts comment"| node_pr_comment
node_pr_comment -->|"posts comment"| node_github_pr
node_action_entry -->|"commits outputs"| node_git_commit

click node_cli "https://github.com/braedonsaunders/codeflow/blob/main/cli/codeflow.mjs"
click node_web_ui "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_repo_access "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_local_scan "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_dependency_graph "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_code_canvas "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_code_insights "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_health_activity "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_markdown_graph "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_pr_impact "https://github.com/braedonsaunders/codeflow/blob/main/index.html"
click node_action_entry "https://github.com/braedonsaunders/codeflow/blob/main/card/index.js"
click node_input_config "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/inputs.js"
click node_repo_collection "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/collect.js"
click node_exclude_patterns "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/exclude.js"
click node_analysis_pipeline "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/analysis.js"
click node_analyzer_loader "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/analyzer.js"
click node_snapshot "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/state.js"
click node_history_file "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/state.js"
click node_card_renderer "https://github.com/braedonsaunders/codeflow/blob/main/card/render/card.js"
click node_style_renderers "https://github.com/braedonsaunders/codeflow/blob/main/card/render/styles.js"
click node_theme "https://github.com/braedonsaunders/codeflow/blob/main/card/render/theme.js"
click node_sparkline "https://github.com/braedonsaunders/codeflow/blob/main/card/render/sparkline.js"
click node_receipt_markdown "https://github.com/braedonsaunders/codeflow/blob/main/card/render/receipt-md.js"
click node_git_commit "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/git.js"
click node_pr_comment "https://github.com/braedonsaunders/codeflow/blob/main/card/lib/pr.js"

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_web_ui,node_repo_access,node_local_scan toneBlue
class node_dependency_graph,node_code_canvas,node_code_insights,node_health_activity,node_markdown_graph,node_pr_impact,node_github_repo,node_local_files toneAmber
class node_action_entry,node_input_config,node_repo_collection,node_exclude_patterns,node_analysis_pipeline,node_analyzer_loader,node_snapshot toneMint
class node_history_file,node_card_renderer,node_style_renderers,node_theme,node_sparkline,node_receipt_markdown toneRose
class node_git_commit,node_pr_comment,node_user,node_github_action,node_github_pr toneIndigo
class node_cli toneTeal
```

## Components

### Browser analysis

- [Browser UI](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`
- [Repository access](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`
- [Local scanning](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`

### Architecture insights

- [Dependency graph](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`
- [Code canvas](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`
- [Code insights](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`
- [Health and activity](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`
- [Markdown graph](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`
- [PR impact](https://github.com/braedonsaunders/codeflow/blob/main/index.html): `index.html`

### Card analysis

- [Action entry](https://github.com/braedonsaunders/codeflow/blob/main/card/index.js): `card/index.js`
- [Action inputs](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/inputs.js): `card/lib/inputs.js`
- [File collection](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/collect.js): `card/lib/collect.js`
- [Exclude matching](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/exclude.js): `card/lib/exclude.js`
- [Analysis pipeline](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/analysis.js): `card/lib/analysis.js`
- [Analyzer loader](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/analyzer.js): `card/lib/analyzer.js`
- [Health snapshot](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/state.js): `card/lib/state.js`

### Card outputs

- [Snapshot history](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/state.js): `card/lib/state.js`
- [SVG card renderer](https://github.com/braedonsaunders/codeflow/blob/main/card/render/card.js): `card/render/card.js`
- [Card styles](https://github.com/braedonsaunders/codeflow/blob/main/card/render/styles.js): `card/render/styles.js`
- [Theme palette](https://github.com/braedonsaunders/codeflow/blob/main/card/render/theme.js): `card/render/theme.js`
- [Sparkline](https://github.com/braedonsaunders/codeflow/blob/main/card/render/sparkline.js): `card/render/sparkline.js`
- [PR receipt](https://github.com/braedonsaunders/codeflow/blob/main/card/render/receipt-md.js): `card/render/receipt-md.js`

### GitHub integrations

- [Git commit](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/git.js): `card/lib/git.js`
- [PR comment API](https://github.com/braedonsaunders/codeflow/blob/main/card/lib/pr.js): `card/lib/pr.js`

### Other components

- **Engineer**
- [Local CLI](https://github.com/braedonsaunders/codeflow/blob/main/cli/codeflow.mjs): `cli/codeflow.mjs`
- **GitHub repository**
- **Local files**
- **GitHub Actions**
- **GitHub PR**

## Connections

- Engineer → Browser UI: opens (evidence: `README.md`)
- Engineer → Local CLI: runs (evidence: `README.md`)
- Local CLI → Browser UI: serves UI (evidence: `README.md`)
- Browser UI → Repository access: analyzes URL (evidence: `README.md`)
- Repository access → GitHub repository: fetches from (evidence: `README.md`)
- Browser UI → Local scanning: analyzes files (evidence: `README.md`)
- Local scanning → Local files: reads locally (evidence: `README.md`)
- Browser UI → Dependency graph: shows graph (evidence: `README.md`)
- Browser UI → Code canvas: opens code view (evidence: `README.md`)
- Browser UI → Code insights: shows analysis (evidence: `README.md`)
- Browser UI → Health and activity: shows metrics (evidence: `README.md`)
- Browser UI → Markdown graph: graphs notes (evidence: `README.md`)
- Browser UI → PR impact: analyzes PR (evidence: `README.md`)
- GitHub Actions → Action entry: invokes (evidence: `card/index.js`)
- Action entry → Action inputs: loads inputs (evidence: `card/index.js`)
- Action entry → Analysis pipeline: analyzes repository (evidence: `card/index.js`)
- Analysis pipeline → Analyzer loader: loads analyzer (evidence: `card/lib/analysis.js`)
- Analysis pipeline → File collection: collects files (evidence: `card/lib/analysis.js`)
- File collection → Exclude matching: filters paths (evidence: `card/lib/collect.js`)
- Analysis pipeline → Health snapshot: derives snapshot (evidence: `card/lib/analysis.js`)
- Action entry → Snapshot history: reads and writes (evidence: `card/index.js`)
- Action entry → SVG card renderer: renders snapshot (evidence: `card/index.js`)
- SVG card renderer → Card styles: dispatches style (evidence: `card/render/card.js`)
- Card styles → Theme palette: selects palette (evidence: `card/render/styles.js`)
- Card styles → Sparkline: renders sparkline (evidence: `card/render/styles.js`)
- Action entry → PR receipt: renders receipt (evidence: `card/index.js`)
- Action entry → PR comment API: upserts comment (evidence: `card/index.js`)
- PR comment API → GitHub PR: posts comment
- Action entry → Git commit: commits outputs (evidence: `card/index.js`)
