Add CodeFlow Card GitHub Action (v1)#53
Conversation
Ships a same-repo subdirectory action at card/ that runs codeflow's analyzer headlessly and writes a self-updating SVG card to the consuming repo's README. Same analyzer as the web app — the Action loads codeflow's index.html and runs the analyzer block in a Node vm context, guaranteeing zero drift. - Sentinel comments wrap the analyzer block (CODEFLOW_ANALYZER_*) and the derived metrics block (CODEFLOW_METRICS_*) in index.html. The existing Worker bootstrap and golden test switch to the sentinels. - Action panels: health grade w/ delta, scale (files/fns/LOC/langs) with sparklines, fragility (top blast radius), hidden costs. - Optional opt-in PR receipts: sticky comment on each merged PR with a thermal-receipt-style itemization of the merge. - State persists to .github/codeflow-card.json so sparklines and deltas populate after the second run. - Zero npm deps — ships as plain Node 20 with built-ins only. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c60183ea49
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return; | ||
| } | ||
| for (const entry of entries) { | ||
| if (entry.name.startsWith('.git')) continue; |
There was a problem hiding this comment.
Limit .git skip to the actual VCS directory
The repo walk currently skips any entry whose name starts with .git, which also excludes .github, .gitignore, .gitattributes, and .gitmodules. That means valid project files (for example scripts under .github/actions) are never analyzed, so file/function/LOC totals and dependency-derived metrics can be systematically underreported compared with the main analyzer behavior.
Useful? React with 👍 / 👎.
|
|
||
| const { Parser, buildAnalysisData, calcBlast, calcHealth } = loadAnalyzer(indexHtmlPath); | ||
|
|
||
| const { analyzed, allFns } = await buildAnalyzed(repoRoot, Parser); |
There was a problem hiding this comment.
Exclude generated state/output files from analysis
Analysis runs across the whole workspace before rendering, but the configured state/output paths are never excluded. If a user sets state outside a skipped directory (for example codeflow-card.json at repo root), the second run starts analyzing its own history file, and each subsequent run inflates LOC/language trends even when source code is unchanged.
Useful? React with 👍 / 👎.
Style variants (selected via the new `style:` input, default `compact`):
- compact 720x140 Grade left, scale stats right
- row 720x60 Status-bar strip
- minimal 720x40 Single mono text line
- hero 720x200 Splashy gradient + grade + 2x2 grid
- detailed 720x900+ Information-rich: grade, scale, languages bar,
composition (connections, tests, folders, fn stats, patterns),
top folders, fragility, hidden costs
Privacy controls so a public README doesn't have to display judgment:
- show-grade: false hides the letter grade everywhere
- show-score: false hides the /100 score, keeps the letter
Configurable accent (sparklines, link, pin):
- accent: <preset> purple|teal|cyan|green|pink|blue|amber|red
- accent: <css color> any CSS color, e.g. #ff6b6b
Footer "powered by codeflow" is now wrapped in <a> linking to the codeflow
repo. Falls back to plain text in <img> contexts where SVG links don't fire.
State snapshot expanded to capture top folders, top languages with %,
function size stats, test file ratio, patterns, duplicates, layer
violations — all surfaced in `detailed`.
card/examples/ holds 10 ready-rendered SVGs (compact, compact-private,
compact-teal, compact-pink, row, minimal, hero, hero-private, detailed,
detailed-private) generated against this repo, embedded in the README
as a style gallery.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* Add CodeFlow Card workflow Installs braedonsaunders/codeflow/card on every merge to main and every closed PR. Renders an auto-updating SVG card to .github/codeflow-card.svg which can be embedded in the README. Will only function once braedonsaunders/codeflow#53 (which adds the card/ subdirectory action) is merged. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Configure private compact card + initial SVG + README image Workflow uses style: compact with show-grade/show-score: false so a public README shows codebase scale (files, fns, LOC, langs, tests) without a letter grade or score. Pre-renders the initial SVG so the README image is live the moment this PR merges; subsequent merges to main / closed PRs will overwrite .github/codeflow-card.svg automatically. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Braedon Saunders <braedonsaunders@Braedons-MacBook-Pro.local> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Summary
Ships v1 of the CodeFlow Card — a same-repo subdirectory GitHub Action at
card/that drops a self-updating SVG card on any repo's README, recomputed on every merge.The Action loads codeflow's analyzer directly out of
index.htmland runs it in a Nodevmcontext. Same analyzer as the web app, zero drift, single source of truth.What's in the card
Plus opt-in PR receipts: a thermal-receipt-style sticky comment on every merged PR itemizing the merge (
+/- LOC, blast-radius before/after, grade delta).Implementation notes
index.html—CODEFLOW_ANALYZER_*wrapsParser+buildAnalysisData,CODEFLOW_METRICS_*wrapscalcBlast+calcHealth. The existing Worker bootstrap andtests/codeflow-golden.test.mjsboth switch to these sentinels.node_modulesto maintain.uses: braedonsaunders/codeflow/card@v1. One repo, one star count, one analyzer.card/README.md.Test plan
node --test tests/codeflow-golden.test.mjspasses (sentinel switch is non-breaking)tests/fixtures/golden-worldwrites a valid SVG + JSON stateindex.html)@main, will activate once this merges)v1after merge so users can pin to a stable refFollow-ups (deferred to v1.1)
autotheme via<picture>element.github/codeflow-card.ymlconfig file for power users🤖 Generated with Claude Code