Codebase File Map Implementation Plan

For agentic workers: REQUIRED SUB-SKILL: Use superpowers:subagent-driven-development (recommended) or superpowers:executing-plans to implement this plan task-by-task. Steps use checkbox (- [ ]) syntax for tracking.

Goal: Add file-level codebase indexing events and graph projection.

Architecture: Create a focused zaxy.codebase collector, add a code.file.indexed extractor, expose MemoryFabric.ingest_codebase, and wire a CLI command that appends events through the existing fabric.

Tech Stack: Python 3.11, pathlib, hashlib, Typer, pytest, ruff.

---

Task 1: Codebase Collector

Files:

Test that collect_codebase_events() indexes supported source files with language, sha256, bytes, and lines; skips hidden/cache/dependency directories; and rejects missing roots.

Run: pytest --no-cov tests/test_codebase.py -q

Expected: fail because zaxy.codebase does not exist.

Add supported suffixes, excluded directory names, language inference, and event payload generation.

Run: pytest --no-cov tests/test_codebase.py -q

Expected: pass.

Task 2: Extractor

Files:

Test code.file.indexed creates a code_file entity and indexed_code_file edge from actor to file.

Run: pytest --no-cov tests/test_extract.py -q

Expected: fail because no extractor is registered.

Register code.file.indexed and preserve code file metadata.

Run: pytest --no-cov tests/test_extract.py -q

Expected: pass.

Task 3: Fabric And CLI

Files:

Test MemoryFabric.ingest_codebase() appends collected code events to the requested session. Test zaxy index-codebase PATH --session-id default reports the indexed count with MemoryFabric mocked.

Run: pytest --no-cov tests/test_core.py tests/test_cli.py -q

Expected: fail because the method and command do not exist.

Add ingest_codebase() beside document/transcript ingestion and a Typer command that calls it.

Run: pytest --no-cov tests/test_codebase.py tests/test_extract.py tests/test_core.py tests/test_cli.py -q

Expected: pass.

Task 4: Docs And Verification

Files:

Explain file-level scope, command usage, event shape, and future symbol extraction.

Run:

ruff check src/zaxy/codebase.py src/zaxy/extract.py src/zaxy/core.py src/zaxy/__main__.py tests/test_codebase.py tests/test_extract.py tests/test_core.py tests/test_cli.py
pytest --no-cov tests/test_codebase.py tests/test_extract.py tests/test_core.py tests/test_cli.py tests/test_docs_site.py -q
pytest --no-cov -m "not integration"

Expected: all checks pass.