Repository navigation
Conversation
…tool - Add index_dependencies parameter to add_code_to_graph tool schema in tool_definitions.py - Implement _collect_python_imports() using ast module to extract top-level import names - Implement _filter_and_resolve_dependencies() to filter stdlib/local modules and resolve external packages - Modify add_code_to_graph() in indexing_handlers.py to queue dependency indexing jobs when index_dependencies=True - Add comprehensive unit tests in tests/unit/tools/test_index_dependencies.py Co-authored-by: yashraj4
…ontext#1320) Add --role and --role-file options to 'cgc mcp start' that inject a role-specific system prompt into the MCP initialize response. Injection point: the initialize response's 'instructions' field and 'serverInfo.systemPrompt' field. When no role is configured both fields are byte-identical to the current behaviour. Built-in roles: reviewer, architect, auditor, explainer. Custom roles: --role custom (reads ~/.codegraphcontext/role.md) or --role-file <path>. Precedence: --role > CGC_MCP_ROLE env > .cgc/config.json > neutral. Role files are validated: max 64 KB, must be regular files, subject to path sandbox with ~/.codegraphcontext/ always allowed. 30 unit tests covering byte-identical default, injection, size cap, path sandbox, and precedence.
|
@yashraj4 is attempting to deploy a commit to the shashankss1205's projects Team on Vercel. A member of the Team first needs to authorize it. |
Shashankss1205
left a comment
Collaborator
There was a problem hiding this comment.
Role prompt feature is still draft; review config path restrictions and distribution/package behavior before marking ready.
This was referenced Oct 15, 2026
This branch has not been deployed
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 #1320
Injection point decision
The role is injected into the MCP
\initialize\response — specifically both the\instructions\field and\serverInfo.systemPrompt\field. This is the standard MCP mechanism for system-level instructions.Why this point:
\ tools/list\) or tool results (`\ tools/call) — zero blast radius on the 25+ existing tools\instructions\from\initialize\What was built
CLI options on \cgc mcp start\
\
--role reviewer | architect | auditor | explainer | custom | neutral
--role-file Path to a custom role .md file (max 64 KB)
\\
Built-in roles (\src/codegraphcontext/roles/)
\ reviewer.md\— senior code reviewer persona\architect.md\— software architect persona\editor.md\— dead code/risk auditor persona\explainer.md\— code onboarding/documentation personaPrecedence (stated once, tested)
ole\ key in .cgc/config.json\
--role-file\ overrides the content source regardless of which role name was selected. Without an explicit --role, it implies \custom.
Role file validation
Byte-identical default (the critical invariant)
With no role configured:
esolve_role_prompt()\ returns \None\
Tested by: \TestUnconfiguredByteIdentical\ (5 tests asserting byte equality).
Files changed
Test results
\
30 passed in 1.45s
\\
Covers: byte-identical default, role injection, size cap, directory rejection, missing file, empty file, path sandbox, \CGC_ALLOW_ALL_PATHS, precedence (CLI > env > config > default), unknown role error, all built-in roles load.