Skip to main content
fensu map renders a function’s call lineage as a deterministic terminal tree. It is the read-and-explore counterpart to fensu check’s enforcement: where check imposes the repository’s structure, map lets you see it. It is useful for recovering the mental map of a large codebase on demand, without paying a model to rediscover it each time.
fensu map does not require Fensu configuration or rule adoption. It resolves import roots on its own, so you can run it on any Python repository.

Usage

Point it at a function to get its downstream call tree:
Each node is one resolved call, shown with its function name and a path:line location. Calls are listed in source order, and locations are repository-relative by default so editors can make them clickable.

Selecting a symbol

The symbol argument accepts function and method selectors: If a bare name or Class.method is ambiguous across the resolved roots, Fensu lists full dotted keys and asks you to qualify the selector rather than guessing.

Import roots

--root names a Python import root and may be repeated to map across several independent package trees:
When you do not pass --root, fensu map uses your configured Fensu roots if a configuration is present, otherwise it infers src/, and otherwise falls back to the repository root.

Options

Path display modes trade detail for readability. compact keeps a leading segment and the filename, which stays legible in deeply layered repositories:
Color is automatic for terminals, can be forced with --color, and respects the NO_COLOR environment variable. Map index caching follows the configured [cache].enabled value when configuration is available and defaults to enabled otherwise. It shares Fensu’s persistent cache storage but remains separate from cached check results.

What the walk resolves

The current provider is a conservative pure-Python analysis of project functions and methods. It resolves:
  • same-module calls,
  • absolute and relative direct imports,
  • module aliases,
  • namespace packages,
  • calls across multiple import roots,
  • concrete method calls through constructors, imports, annotations, and self or cls dispatch.
It does not guess dynamic dispatch. Calls made through a function parameter are shown as unresolved seams rather than invented targets. Protocol and dynamic method calls remain unresolved rather than guessed. This keeps the map trustworthy: what it draws, it can stand behind.

Markers

The tree marks three deterministic conditions so the output is stable and unambiguous:
  • depth limit: the branch was truncated at --depth.
  • cycle: a function reachable from itself; only the looping branch stops, and siblings continue normally.
  • unresolved: a dynamic call the provider will not guess.

Exit codes

An unknown symbol reports a clear error:

Not yet available

fensu map is deliberately conservative today. The following are planned and not part of current behavior: upstream (incoming-call) mapping, protocol dispatch resolution, JSON output, helper collapsing and layered rendering, and docstring captions. This page documents only what the command does now.