Repository navigation
fix(cli): --importers arg errors, --hubs/--file, status subcommand, empty topology hint - #294
Merged
Merged
Conversation
…hint - --importers <relative file> run from a subdirectory now resolves the file from the working directory and uses the enclosing repository as the project, the same inference an absolute path already got. A flag missing its value prints one "Run 'codemap --help'" line instead of the full flag dump (still exit 2). - --hubs and --file <f> print the same text as the MCP get_hubs and get_file_context tools: the handlers' bodies moved into exported HubsText/FileContextText, which both call. - codemap status prints version, project root, config path and the watch daemon state (reuses runWatchSubcommand "status"). - An empty topology graph names the manifests the registered providers read (Gradle, Maven, sbt, SwiftPM, Python) and points single-module projects at codemap --deps. The line lives in topology.FormatGraph, so the MCP get_topology output gets it too. Closes #289 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWQw8AjoCA1yjN3T59vk46
There was a problem hiding this comment.
🟡 Changes recommended
A moderate active issue remains because the new --hubs and --file routes ignore per-invocation scan filters such as --exclude and --max-files, causing incorrect results.
1 open issue
What changed in this PR
This pull request improves several CLI workflows: importer argument handling, hub/file reports, the status subcommand, and guidance for empty topology results. It also shares report rendering between the CLI and MCP interfaces.
Changes:
- Improves
--importerserrors and repository-root path resolution. - Adds
--hubs,--file, andcodemap status. - Extracts shared hub and file-context renderers for CLI and MCP.
- Adds actionable empty-topology guidance and regression coverage.
| File | Summary |
|---|---|
topology/format.go |
Adds empty-topology guidance. Moderate issue: unmatched ecosystem filters can incorrectly trigger the --deps recommendation. |
mcp/surface_hygiene_test.go |
Updates handler output-wrapper expectations after renderer extraction. |
mcp/main.go |
Extracts reusable HubsText and FileContextText renderers. |
main.go |
Adds CLI flags, status handling, importer resolution, and shared report routes. Moderate issues: conflicting --hubs/--file flags perform duplicate graph scans (1 vote), and CLI scan filters are ignored by the new routes (3 votes). Nit: --file errors can incorrectly refer to --importers (1 vote). |
main_cli_rough_edges_test.go |
Adds regression coverage for the CLI rough edges and empty-topology behavior. |
This pull request requires changes.
Review effort: Lite
HubsText and FileContextText always scanned with ConfiguredFilters, so the CLI's per-invocation filter overrides were ignored. Both now take the filters; MCP handlers pass ConfiguredFilters, the CLI passes its merged set. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FWQw8AjoCA1yjN3T59vk46
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.

Closes #289.
Four CLI rough edges from exercising every command in 4.7.1. Correction to the issue:
--importers <file>from the repo root already worked; the broken cases were the no-value form and running from a subdirectory.codemap --importerswith no value: still exit 2, but printsflag needs an argument: -importers/Run 'codemap --help' for usage.instead of the full flag dump (flag.Usageinmain.go, so every flag error gets the one-line hint). From a subdirectory, a relative file now resolves to the enclosing git repo (resolveImportersInvocation), matching absolute paths;-Cand an explicit path still win.--hubsand--file <f>added; MCP handler bodies moved to exportedHubsText/FileContextTextinmcp/main.goso CLI and MCP share one implementation.mcp/surface_hygiene_test.gocounts updated (output still goes throughtextResult).codemap statussubcommand: version, project root, config path, watch daemon state; reusesResolveNearestGitRoot,config.ConfigPath,runWatchSubcommand("status"). Listed in--help.--topology(and MCPget_topology):No modules found: topology reads multi-module manifests (Gradle, Maven, sbt, SwiftPM, Python). For a single-module project use 'codemap --deps'.Names only the registered providers.Tests:
main_cli_rough_edges_test.go, one per fix.go test ./cmd/ . ./mcp/ ./topology/,gofmt -lclean. Left out:--jsonfor--hubs/--file.🤖 Generated with Claude Code
https://claude.ai/code/session_01FWQw8AjoCA1yjN3T59vk46