Skip to content

Add optional path argument to host, serve, and mcp commands #65

@sattva1

Description

@sattva1

Problem

axon analyze accepts an optional [PATH] argument, allowing it to index a project from anywhere:

axon analyze /home/user/projects/my-app

This creates .axon/ storage inside the target project. However, host, serve, and mcp commands hardcode Path.cwd().resolve() as the repo path (cli/main.py:490, cli/main.py:927), so they can only operate on the project you're currently inside.

This creates a problem when Axon is installed globally (or in a separate environment) and the target project uses its own isolated virtualenv (e.g., via pyenv). You can analyze the project from outside, but you can't run host --watch or serve against it — and you can't run them from inside the project dir because axon isn't on that venv's PATH.

Proposed Solution

Add an optional [PATH] argument to host, serve, and mcp, matching the existing analyze signature:

axon host --watch /home/user/projects/my-app
axon serve --watch /home/user/projects/my-app
axon mcp /home/user/projects/my-app

When provided, use that path instead of Path.cwd() for storage resolution, file watching, and all repo-scoped operations.

Scope

Small change — thread the optional path argument through:

  • host_run_shared_host()repo_path parameter (currently hardcoded at line 490)
  • serverepo_path (currently hardcoded at line 927)
  • mcpmcp_main()_load_storage() (already accepts repo_path, just needs the CLI plumbing)

_load_storage() already handles an optional repo_path parameter with a Path.cwd() fallback (line 54), so the storage layer is ready — it's just the CLI entry points that need the argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions