serpentine analyze

Analyze a project and output the code reference graph as text or JSON.

Analyze a project and output the code reference graph. The default format is text (one edge per line as caller --type--> callee); use --format json for structured output suitable for programmatic use or agent consumption.

serpentine analyze [PATH] [OPTIONS]

Options

OptionDescription
-o, --output PATHWrite output to file instead of stdout
--format TEXTOutput format: text (default) or json
--prettyPretty-print JSON output
--select TEXTSelector expression to filter nodes
--exclude TEXTExclusion pattern (same syntax as --select)
--edges-onlyOutput only the edges array (compact, JSON only)
--sourceInclude source code blocks in text output
--include-assignmentsInclude variable/assignment nodes in text output
--include-standardInclude stdlib nodes (default: off)
--include-third-partyInclude third-party nodes (default: off)
--state TEXTFilter by change state: modified, added, deleted

Examples

Dump the full graph as text:

serpentine analyze .

Get JSON output, pretty-printed:

serpentine analyze . --format json --pretty

Get just the edges for a subgraph (compact, agent-friendly):

serpentine analyze . --select "+src.auth.*+" --edges-only --pretty

Save output to a file:

serpentine analyze . --format json -o graph.json

Filter by recently modified files:

serpentine analyze . --state modified --format json --pretty

Text output format

Each line in text output is one edge:

src.auth.views.login --calls--> src.auth.models.User.get
src.auth.views.login --has-a--> src.auth.forms.LoginForm
src.auth.models.User --is-a--> django.db.models.Model

This format is easy to scan and works well piped into other tools.

Edge types

TypeMeaning
callsOne entity calls another as a function
has-aA variable holds an instance of a class (constructor call)
referencesOne entity names another without calling it
is-aInheritance — one class extends another

Selectors

Use --select to focus on a subgraph. See the Selectors reference for the full syntax, including upstream (+pattern), downstream (pattern+), and bounded-hop traversal.