Labels: hook, viz, large-repo
Body:
Problem
graphify hook install writes a .git/hooks/post-commit whose _HOOK_SCRIPT calls to_html() unconditionally. On graphs with more than ~5,000 nodes, to_html() raises (the pyvis layout pass blows up). The hook fails after every commit on large repos.
We patched our local copy of the hook (2026-04-25) to gate the viz step:
if G.number_of_nodes() <= 5000:
to_html(...)
else:
print('[graphify hook] HTML viz skipped (> 5000 nodes); graph.json + GRAPH_REPORT.md updated.')
But graphify hook install regenerates the script from upstream _HOOK_SCRIPT, clobbering the patch on every reinstall.
Reproducer
- Install the hook on any repo whose code-graph exceeds 5,000 nodes (a 50k-LOC Django project does it).
- Make a commit.
- Observe the hook fail during
to_html rendering.
Proposal
Any one of:
- Flag.
graphify hook install --no-viz — generates a hook that skips to_html entirely. Simplest, opt-in.
- Env var.
GRAPHIFY_VIZ_NODE_LIMIT=5000 (default) — the generated hook reads the env var and skips to_html above the threshold, printing a warning. Zero-config for most users; tunable for large repos.
- Both. Env var as default behavior,
--no-viz as explicit opt-out.
Option 2 is the safest default — the hook stays useful on every repo size without manual patching, and CI consumers (who don't need the HTML) can set the limit to 0.
Motivation
Keeps the post-commit hook trustworthy across repo sizes. Also unblocks downstream users who don't need the HTML viz at all (CI runners, headless dev boxes).
Labels: hook, viz, large-repo
Body:
Problem
graphify hook installwrites a.git/hooks/post-commitwhose_HOOK_SCRIPTcallsto_html()unconditionally. On graphs with more than ~5,000 nodes,to_html()raises (the pyvis layout pass blows up). The hook fails after every commit on large repos.We patched our local copy of the hook (2026-04-25) to gate the viz step:
But
graphify hook installregenerates the script from upstream_HOOK_SCRIPT, clobbering the patch on every reinstall.Reproducer
to_htmlrendering.Proposal
Any one of:
graphify hook install --no-viz— generates a hook that skipsto_htmlentirely. Simplest, opt-in.GRAPHIFY_VIZ_NODE_LIMIT=5000(default) — the generated hook reads the env var and skipsto_htmlabove the threshold, printing a warning. Zero-config for most users; tunable for large repos.--no-vizas explicit opt-out.Option 2 is the safest default — the hook stays useful on every repo size without manual patching, and CI consumers (who don't need the HTML) can set the limit to 0.
Motivation
Keeps the post-commit hook trustworthy across repo sizes. Also unblocks downstream users who don't need the HTML viz at all (CI runners, headless dev boxes).