code_map
code_map renders an ASCII diagram showing how modules and files depend on each other. Use it to visualize the architecture of a project or a specific subdirectory.
code_map()code_map(path="src/api", depth=2)Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
path | string | — | Limit diagram to a specific module or directory |
depth | number | 2 | Levels of dependency nesting to show (1–3) |
Output
Section titled “Output”src/├── api/│ ├── controllers/ ──→ services/│ └── middleware/ ──→ services/auth├── services/│ ├── AuthService ──→ db/, cache/│ ├── OrderService ──→ PaymentService, InventoryService│ └── UserService ──→ db/└── db/ └── client ──→ (postgres)When to use
Section titled “When to use”- Understand the layered architecture of an unfamiliar project
- Identify circular dependencies or unexpected cross-module imports
- Document the system for a new team member
- Plan a refactor that needs to respect module boundaries