Skip to content

Quick Start

This tutorial walks you through installing axm-ast and exploring a Python project.

Prerequisites

  • Python 3.12+
  • uv (recommended) or pip

Installation

uv add axm-ast

Or with pip:

pip install axm-ast

Verify the installation:

axm-ast version

Step 1: Get Project Context

The context command gives an AI agent everything it needs in one call:

axm-ast context src/mylib
๐Ÿ“‹ mylib
  layout: src (16 modules, 151 functions, 9 classes)
  python: >=3.12

๐Ÿ”ง Stack
  cli: cyclopts     models: pydantic     tests: pytest
  lint: ruff         types: mypy          packaging: hatchling

๐Ÿ›  AXM Tools
  axm-ast: โœ…

๐Ÿ“ Patterns
  exports: __all__ in 13 modules
  tests: 12 test files

๐Ÿ“ฆ Modules (ranked)
  cli               โ˜…โ˜…โ˜…โ˜…โ˜…  (describe, inspect, graph, search, callers...)
  core.analyzer     โ˜…โ˜…โ˜…โ˜…โ˜†  (analyze_package, build_import_graph...)
  core.docs         โ˜…โ˜…โ˜…โ˜†โ˜†  (discover_docs, build_docs_tree...)

JSON output

Add --json to any command for machine-readable output.

Step 2: Describe the Package

Get a detailed view of all symbols:

axm-ast describe src/mylib --detail detailed

Or a compressed AI-friendly view:

axm-ast describe src/mylib --compress

The compressed view shows only signatures, first docstring lines, __all__, and relative imports โ€” ideal for fitting into LLM context windows.

Step 3: Visualize the Dependency Graph

axm-ast graph src/mylib --format mermaid
graph TD
    cli["cli"]
    core_analyzer["core.analyzer"]
    core_parser["core.parser"]
    models_nodes["models.nodes"]
    cli --> core_analyzer
    core_analyzer --> core_parser
    core_analyzer --> models_nodes

Step 4: Find Who Calls a Function

axm-ast callers src/mylib --symbol analyze_package
๐Ÿ“ž 7 caller(s) of 'analyze_package':

  cli:89 in describe()
    analyze_package(project_path)
  cli:272 in graph()
    analyze_package(project_path)
  core.context:246 in build_context()
    analyze_package(path)
  core.impact:203 in analyze_impact()
    analyze_package(path)

Step 5: Analyze Change Impact

Before modifying a function, check the blast radius:

axm-ast impact src/mylib --symbol analyze_package
๐Ÿ’ฅ Impact analysis for 'analyze_package' โ€” HIGH

  ๐Ÿ“ Defined in: core.analyzer (L38)
  ๐Ÿ“ž Direct callers (7): cli, core.context, core.impact
  ๐Ÿ“„ Affected modules (5): axm_ast, cli, core, core.context, core.impact
  ๐Ÿงช Tests to rerun (7): test_analyzer, test_callers, test_compress...
  ๐Ÿ“ฆ Re-exported in (5): axm_ast, cli, core, core.context, core.impact

Step 6: Dump Documentation

Get the full documentation tree in one call:

axm-ast docs .
๐Ÿ“– README.md
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# mylib
Python AST introspection CLI...

๐Ÿ“ Documentation tree
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
docs/
โ”œโ”€โ”€ howto
โ”‚   โ””โ”€โ”€ describe.md
โ”œโ”€โ”€ tutorials
โ”‚   โ””โ”€โ”€ quickstart.md
โ””โ”€โ”€ index.md

๐Ÿ“„ docs/index.md
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
# Home
...

Tree-only mode

Use --tree to quickly see the documentation structure without file contents.

Next Steps