feat(cli): add init --target to wire project-level editor MCP config#78
Merged
Conversation
`codegraph init` gains `-t/--target`: after indexing it writes project-level MCP config for the named agents — the project-scoped analog of `install --target=… --local`. This lets editors that launch the server from a non-project CWD (Kiro, Cursor) get the project's absolute --path in one step. - init --target accepts the same values as install (csv ids, auto, all, none) and defaults to none (index only); config + --path are written under the project being initialized, even when [path] differs from CWD. Idempotent. - reuse the install engine via run_install_local_targets(project_root, flag), forcing Location::Local; no duplicated config-writing logic. - installer(kiro): clearer global-vs-local guidance notes — global explains why no entry is written and how to install per project; local echoes the written project path and the per-project re-run reminder. - docs(cli): document init --target, the editor-adaptation rationale (Kiro/Cursor need --path), and per-agent behavior.
The init_target kiro test substring-matched the raw mcp.json string, which failed on Windows where path backslashes are escaped as \\ in serialized JSON. Parse the JSON and compare the --path arg as a serde value instead.
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
codegraph initgains-t/--target: after indexing it writes project-level MCP config for the named agents — the project-scoped analog ofinstall --target=… --local. This lets editors that launch the server from a non-project CWD (Kiro, Cursor) get the project's absolute--pathin one step, instead of runninginitthen a separateinstall.init --targetaccepts the same values asinstall(csv ids likekiro,cursor, plusauto,all,none) and defaults tonone(index only —codegraph initis unchanged). The config and its--pathare written under the project being initialized, even when[path]differs from CWD. Idempotent.run_install_local_targets(project_root, flag), forcingLocation::Local— no duplicated config-writing logic (run_installnow delegates to a sharedrun_install_with_ctx).init --target, the editor-adaptation rationale (Kiro/Cursor need--path), and per-agent behavior.Verification
make cigreen locally (fmt + clippy-D warnings+ full workspace test + guardrail); pre-push gate green.init --target=kirowrites project-localmcp.jsonpinning the concrete project path (idempotent across two runs);init --target=nonewrites nothing.init --target=kiro,cursorindexes + writes both editors' project-level config with concrete--path; idempotent re-run keeps the path; defaultinitwrites no editor config but does build the index.Cargo.lockdiff is version-only churn (no new dependencies).