Skip to content

feat(cli): --source-root flag for multi-root ingestion #131

Description

@zaebee

Problem

When ingesting from the repo root, Python import names (cgis.*) don't match the file-path FQNs (src.cgis.*). This produces ~2853 phantom unresolved cross-island edges because the resolver can't match raw_call:cgis.foo to the node src.cgis.foo.

Solution

Add --source-root / -s (repeatable) to cgis ingest. The pipeline builds FQNs relative to the nearest source root instead of CWD.

Implementation sketch

  • IngestionPipeline.__init__ gets source_roots: list[str] | None = None
  • file_path_to_module_fqn(path, source_root) — compute relative to source_root
  • CLI: --source-root / -s with Multiple=True in cgis ingest
  • Multiple roots → independent sub-graphs in one DB/JSON without FQN collisions (e.g. --source-root src --source-root ui/src)

Test cases

# FQN should be cgis.* not src.cgis.*
uv run cgis ingest . --source-root src --output graph.json

# Two independent sub-graphs without collisions
uv run cgis ingest . --source-root src --source-root ui/src --output graph.json

Unit test: ingest src/cgis with source_root="src" → node IDs start with cgis., without it → src.cgis..

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsprintCurrent sprint

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions