docs/ascii-commit-visualization-pipeline.md
This explains how commit analysis data becomes ASCII-style diagrams in myflow.
Scope:
box-of-rainFlow generates commit explanations with:
f explain-commits 3 --force
Implementation:
src/explain_commits.rsai-task.sh with provider/model fixed to Kimi defaults (nvidia + moonshotai/kimi-k2.5).sha, short_sha, subject, author, dategit diff --name-onlyOutput per project (default):
docs/commits/<date>-<short_sha>-<slug>.mddocs/commits/<date>-<short_sha>-<slug>.jsondocs/commits/.index.json (digest/index cache)Notes:
--force bypasses digest skip logic.--out-dir can override default output location.The sidecar .json mirrors Flow’s ExplainedCommit shape:
shashort_shasubjectauthordatesummarychangesfiles (array of changed file paths)markdown_filegenerated_atThis is the source of truth consumed by the UI.
Flow server exposes commit explanations over HTTP:
GET /projects/:name/commit-explanations?limit=50GET /projects/:name/commit-explanations/:shaImplementation:
src/log_server.rs:
project_commit_explanationsproject_commit_explanation_detailsrc/explain_commits.rs:
list_explained_commitsget_explained_commitmyflow fetches these endpoints through flowFetch model atoms:
/projects/$project/commit-explanations/projects/$project/commit-explanations/$shaModel file:
~/code/myflow/web/lib/models/flow-projects.tsRelevant type:
FlowExplainedCommitDiagram rendering is client-side in myflow and uses box-of-rain.
Theme/options:
~/code/myflow/web/lib/diagram-theme.tsDIAGRAM_SVG_OPTIONS:
box-of-rain actually doesbox-of-rain has two explicit stages:
render(nodeDef)NodeDef + connections).renderSvg(ascii, svgOptions)Important: layout and paint are separate.
If shape/connectors are wrong, the bug is in NodeDef/connections.
If colors/spacing/fonts are wrong, the bug is in SvgOptions.
Core graph primitives used in myflow:
id: stable node identifier for edge wiring.children: lines rendered inside a box.border: visual style (rounded, bold).childDirection: relative arrangement (horizontal).connections: explicit edges, each with:
from, tofromSide, toSide (left|right|top|bottom).Timeline shape (conceptual):
c0 ──> c1 ──> c2
Files impact shape (conceptual):
commit ──> dirA
commit ──> dirB
commit ──> dirC
File:
~/code/myflow/web/lib/commit-timeline-diagram.tsxAlgorithm:
short_shai -> i+1 (right to left sides)render(nodeDef) -> ASCII layoutrenderSvg(ascii, DIAGRAM_SVG_OPTIONS) -> SVGdangerouslySetInnerHTMLConceptual NodeDef sketch:
{
children: [
{ id: "c0", border: "rounded", children: ["2daa3fd", "feat: sub-agent"] },
{ id: "c1", border: "rounded", children: ["f298c48", "memories rollout"] },
],
childDirection: "horizontal",
connections: [{ from: "c0", to: "c1", fromSide: "right", toSide: "left" }],
}
Mounted at:
~/code/myflow/web/pages/flow/$project/index.tsxFile:
~/code/myflow/web/lib/files-impact-diagram.tsxAlgorithm:
commit.files by top path bucket:
+N more overflow linecommit -> each_dirConceptual NodeDef sketch:
{
children: [
{ id: "commit", border: "bold", children: ["2daa3fd", "feat: sub-agent"] },
{ id: "d0", border: "rounded", children: ["codex-rs/core/", " agent.rs", " mod.rs"] },
],
childDirection: "horizontal",
connections: [{ from: "commit", to: "d0", fromSide: "right", toSide: "left" }],
}
Mounted at:
~/code/myflow/web/pages/flow/$project/commit/$sha.tsxuseMemof explain-commits N in the target repof server)box-of-rain dependency resolves in myflow runtime build/api base URL error in browser:
web/lib/auth-client.ts (relative /api alone is invalid for BetterAuth client config)From target repo (example: codex):
cd ~/repos/openai/codex
f explain-commits 3 --force
From Flow:
f server --host 127.0.0.1 --port 9050
curl 'http://127.0.0.1:9050/projects/codex/commit-explanations?limit=3'
Then open myflow:
/flow/codex/flow/codex/commit/<sha>