Version: 0.9.56
What happens
.j2 files are not classified by graphify.detect at all — not as code, not as
document. In a codegen-based repo this can be a large share of the editable
surface: in ours it is 71 tracked files, 0 detected, 0 nodes.
Why this is worse than a missing extension
Codegen projects usually carry a hard rule: never edit the generated file — change
the template or the generator, then regenerate. The generated modules are marked
DO NOT EDIT MANUALLY and are overwritten on every build.
The graph therefore describes exactly the wrong half of that relationship. Every
generated module has nodes; the templates they come from have none. An agent asking
the graph "where do I change X" is pointed at files that must not be edited, and
cannot see the file that must.
This inverts the graph's purpose for any template-driven project (Jinja, Handlebars,
ERB, Mustache, Liquid): the more of the codebase is generated, the less the graph
describes what a developer or agent is allowed to touch.
What we tried
So there appears to be no supported way to tell graphify to treat an extension as a
document.
Suggestions, smallest first
- Classify
.j2, .jinja, .jinja2 as documents so the semantic pass reads them
as text. This alone restores the template → generated link, since templates carry
prose, structure and the generator header.
- Optionally, strip the outer extension for classification:
module.py.j2 → treat
as Python for AST, since template files are usually <real-ext>.j2.
- Or reintroduce a minimal type-map in
.graphifyrc, e.g.
document_extensions=.j2,.jinja2.
Option 1 would be enough for us.
Reproduce
mkdir -p demo/src/build/templates && cd demo
printf 'class {{ name }}:\n pass\n' > src/build/templates/module.py.j2
printf 'class Generated:\n pass\n' > src/build/module.py
graphify extract . --code-only
# graphify-out/graph.json contains src/build/module.py and no template node
Note the second effect visible in the same snippet: a source directory named
build/ is dropped by _SKIP_DIRS before extraction. That default is right for
most repos, so this is not a bug report — but the two together mean a
template-driven project can lose both its generator sources and its templates
without any warning in the output.
Version: 0.9.56
What happens
.j2files are not classified bygraphify.detectat all — not as code, not asdocument. In a codegen-based repo this can be a large share of the editable
surface: in ours it is 71 tracked files, 0 detected, 0 nodes.
Why this is worse than a missing extension
Codegen projects usually carry a hard rule: never edit the generated file — change
the template or the generator, then regenerate. The generated modules are marked
DO NOT EDIT MANUALLYand are overwritten on every build.The graph therefore describes exactly the wrong half of that relationship. Every
generated module has nodes; the templates they come from have none. An agent asking
the graph "where do I change X" is pointed at files that must not be edited, and
cannot see the file that must.
This inverts the graph's purpose for any template-driven project (Jinja, Handlebars,
ERB, Mustache, Liquid): the more of the codebase is generated, the less the graph
describes what a developer or agent is allowed to touch.
What we tried
.graphifyignoreonly excludes; it cannot include..graphifyincludewas removed in 0.9.25 (.graphifyinclude is dead code: loaded on every detect() run but never consumed #2112)..graphifyrcis read only byhooks.pyand supports a single key,viz_node_limit.So there appears to be no supported way to tell graphify to treat an extension as a
document.
Suggestions, smallest first
.j2,.jinja,.jinja2as documents so the semantic pass reads themas text. This alone restores the template → generated link, since templates carry
prose, structure and the generator header.
module.py.j2→ treatas Python for AST, since template files are usually
<real-ext>.j2..graphifyrc, e.g.document_extensions=.j2,.jinja2.Option 1 would be enough for us.
Reproduce
Note the second effect visible in the same snippet: a source directory named
build/is dropped by_SKIP_DIRSbefore extraction. That default is right formost repos, so this is not a bug report — but the two together mean a
template-driven project can lose both its generator sources and its templates
without any warning in the output.