Skip to main content

Map a Python source tree into typed-edge markdown for fast AI navigation.

Project description

Trailmap

Map a source tree into typed-edge markdown so an AI can find any symbol and see how it connects without reading the source. Python and TypeScript. Design and rationale in DESIGN.md.

Python analysis uses the standard library only. Other languages are opt-in extras, so the base install stays dependency-free.

Install

pip install trailmap                # Python analysis, zero dependencies
pip install trailmap[typescript]    # adds TypeScript/TSX (tree-sitter)

Installs a trailmap console command. Or run it in place: python -m trailmap ....

Languages

Python (stdlib ast, always available) and TypeScript/TSX (tree-sitter, the typescript extra). Trailmap maps whatever it recognizes in a tree and skips files whose language extra isn't installed, telling you what to install. Each new language is an adapter behind its own extra; the core stays pure Python.

Run

python -m trailmap <source-tree> -o <output-dir>

Map Trailmap's own source (the demo):

python -m trailmap trailmap -o trailmap-out

Output

  • INDEX.md — front door and how-to-read.
  • modules/<module>.md — one page per module; frontmatter has imports, body has a section per symbol with its edges.
  • symbols.tsvfqn kind file line signature. Grep this to locate a symbol.
  • edges.tsvsrc type dst confidence resolved. Grep src for dependencies, dst for dependents.
  • candidates.tsv — for a ?-unresolved call, the possible in-project targets (caller method candidate n_candidates). A lead, kept out of edges.tsv.
  • trailmap.json — the full structured graph.

Edges are ast/parser (precise, trust) or heuristic (a lead). Unresolved targets keep a trailing ?.

Status

Early (0.1). Python (stdlib ast) and TypeScript/TSX (tree-sitter extra). Resolution is best-effort without a type checker: it follows imports, inferred receiver types, the inheritance chain, and in-project star imports, and offers candidate leads for the rest. Limits are in DESIGN.md. The core is language-agnostic; new languages are adapters behind their own extra.

License

MIT. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

trailmap-0.3.0.tar.gz (151.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

trailmap-0.3.0-py3-none-any.whl (26.2 kB view details)

Uploaded Python 3

File details

Details for the file trailmap-0.3.0.tar.gz.

File metadata

  • Download URL: trailmap-0.3.0.tar.gz
  • Upload date:
  • Size: 151.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for trailmap-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c9c7ab4320e4feb8819d7d8ad9c379aabc691daf57efaf402544d330b1b24fc1
MD5 18cbae0c6dc2c2ebd878262566c2f55b
BLAKE2b-256 52401246ac2a5b39973d7aa27726894f855992a11dee5533d5c1eac195f43366

See more details on using hashes here.

File details

Details for the file trailmap-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: trailmap-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.11

File hashes

Hashes for trailmap-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b83d344832ea630d2866493e20683f03d2a92e3c2688e6e726ebca1baa537c81
MD5 4ea1ac6b6073dfd257da954ad3547f4e
BLAKE2b-256 dcf5e6c6fbf64514ac7854d1fff04fb31852ec56d7d98f9b6060950d211f2b45

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page