feat: optional PATH argument for host, serve, mcp, and watch commands#67
Open
sattva1 wants to merge 1 commit intoharshkedia177:mainfrom
Open
feat: optional PATH argument for host, serve, mcp, and watch commands#67sattva1 wants to merge 1 commit intoharshkedia177:mainfrom
sattva1 wants to merge 1 commit intoharshkedia177:mainfrom
Conversation
…ost` commands - Replace hardcoded Path.cwd() with an explicit path argument (defaults to .) across affected commands - Add set_db_path() to mcp/server.py for injecting a custom DB path in standalone MCP server mode - Propagate resolved repo_path into _run_shared_host() and _start_host_background() instead of re-deriving it from cwd - Refactor watch() to delegate to _initialize_writable_storage() instead of duplicating init logic - Add path validation (must be an existing directory) with early exit on failure - Add tests covering PATH argument visibility in --help, rejection of non-existent paths, set_db_path(), and _start_host_background() path forwarding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #65.
Adds an optional
[PATH]positional argument towatch,host,serve, andmcpcommands, matching the existinganalyzepattern. This allows running Axon against a project directory withoutcd-ing into it — critical when Axon is installed globally and the target project has its own isolated virtualenv.Changes
src/axon/mcp/server.py— Newset_db_path()setter following the existingset_storage()/set_lock()injection pattern. Allows the CLI to configure the MCP server's database path before entering the event loop.src/axon/cli/main.py:watch,host,serve,mcpacceptpath: Path = typer.Argument(Path("."), ...)with early directory validation_run_shared_host()takesrepo_pathas a parameter instead of hardcodingPath.cwd()_start_host_background()passes the path as an explicit positional argument to the subprocesswatch()refactored to delegate to_initialize_writable_storage()(was duplicating ~15 lines of init logic)serve()callsset_db_path()before the watch/no-watch branch, so both code paths honor the pathui()updated to passrepo_pathto_run_shared_host()(API contract change, no new argument)tests/cli/test_main.py— 10 new tests: help text visibility, non-existent path rejection,set_db_path()global update, subprocess command verification.Usage
Backward compatible — all commands default to
.(current directory).