Repository navigation
feat(code-graph): graphify's code graph as one Rust binary, with an interactive graph.html - #138
Merged
Merged
Conversation
…nteractive graph.html New lab labs/code-graph: tree-sitter extraction (Rust, Python, JavaScript, TypeScript, Scala, Fortran, Gleam, Nix), Louvain clustering, query/path/explain, graph.json in graphify's schema (readable by marola-devkit's route.py), GRAPH_REPORT.md and a self-contained graph.html with a layout computed in Rust and a 5 KB hand-written viewer. No Python, no network at run time, byte-identical output for one tree. Written new: graphify (Apache-2.0) was read for behaviour only; the name is neutral. labs/viz is not changed. Also adds the lab to the CI matrix and one row to the root README. AGENTS.md: the hard rule's exceptions now name the code-graph viewer (labs/code-graph/assets/viewer.js). The owner approved this guardrail change by name, on 2026-10-21. Tested: nix flake check --no-update-lock-file in labs/code-graph (build + 9 cargo tests, clippy -D warnings, fmt, lab-json, size, smoke) passes; nixpkgs-fmt, statix, deadnix, actionlint and reuse lint clean; differential against nixpkgs graphify 0.9.74 on this repo and on labs/viz/example (see the lab README) Co-Authored-By: Claude <[email protected]>
…ar that does not overflow - extract skips any directory below the root that has its own .git (a submodule has a .git file, a nested repository a .git directory): they are other repositories. --exclude PATH (repeatable, relative to DIR) skips more. A test covers both. - --title TEXT names the page (header and <title>); the default is the directory name. - graph.html: a community name in the sidebar is cut with an ellipsis, the full name is in a title attribute, and the sidebar never scrolls sideways. - The first commit of this PR left out the files outside labs/code-graph by mistake. This commit adds them: the AGENTS.md exception for the code-graph viewer (the owner approved this guardrail change by name, on 2026-10-21), "code-graph" in the CI labs matrix, and the root README row. Tested: nix flake check --no-update-lock-file in labs/code-graph (8 cargo tests incl. the new one, clippy -D warnings, fmt, lab-json, size, smoke) passes; nixpkgs-fmt clean; code-graph extract on ptbr-writter with --exclude vendor gives 115 nodes Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
A new lab,
labs/code-graph: graphify's code-only graph as one Rust binary. It has no Python, no pip, no model and no network at run time.code-graph extract DIRwritesgraph.json(graphify's schema),GRAPH_REPORT.mdandgraph.html.query,path,explain,cluster-only,updateandhtmlare there too.graph.htmlis one offline file: the layout is computed in Rust, the SVG is complete with JavaScript off, and a 4.8 KB hand-written viewer (assets/viewer.js, inlined withinclude_str!) adds pan, zoom, search, click-to-focus and a community legend. Light and dark followprefers-color-scheme.graph.json,GRAPH_REPORT.mdandgraph.html(tested).labs/vizis not changed. A follow-up can switchvizto this binary.Licence of graphify
Apache-2.0 (with older MIT parts and a NOTICE). It allows a re-implementation. No source is copied: the behaviour and the format were learnt from the output and from reading it. Apache-2.0 section 6 gives no right to the name, so the binary is
code-graph, "compatible with graphify's graph.json". Details and pins are in the lab README.Needs the owner before merge: AGENTS.md
AGENTS.mdchanges in this PR (a guardrail file): the hard rule's exceptions now also name "the code-graph viewer (labs/code-graph/assets/viewer.js, hand-written and dependency-free, inlined into each generated graph.html; approved by the owner on 2026-10-21)". The owner approved this change by name in the task..github/workflows/ci.ymlalso getscode-graphin the labs matrix (the owner asked for the lab).Sizes (x86_64-linux, nixpkgs 6510408d)
packages.defaultbinarypackages.static(musl)xz -9e(measurement only)graphify0.9.74 closuregraph.htmlof this repositoryjust graphwrites it to~/.cache/code-graph/<name>/)Differential check against graphify 0.9.74
On this repository (Rust files only, same node ids in both):
calls532 of graphify's 553 are also here (this tool writes 698);contains625 of 625;method38 of 45;imports_from12 of 14. graphify writesreferencesandcase_ofedges, this tool does not. Clustering is Louvain here and Leiden in graphify, so partitions differ (45 and 49 communities). Onlabs/viz/examplethe 5 nodes and 5 edges are the same, plus one extraimportsedge. The 166 extracallsedges were not checked by a person. Full table: lab README.Not implemented
Documents, papers, images and video, every LLM pass (community labels,
add,install, MCP server), Markdown pages and links,referencesedges, the other 30 graphify languages, the extraction cache,.gitignorehandling,--dfs.What a consumer does
Nothing. No exported shape changes.
labs/vizand marola-devkit keep using graphify until a follow-up PR.Tested
nix flake check --no-update-lock-fileinlabs/code-graph(build with 9 cargo tests, clippy-D warnings, fmt, lab-json, size, smoke);nixpkgs-fmt,statix,deadnix,actionlint,reuse lint;just --summaryon just 1.21-safe syntax (no new attributes); a headless Chrome check ofgraph.htmlat 1280 px (search, node click and legend click work). CI is off on pull requests, so these ran locally.