
    Ki                    F    d Z ddlmZ dZd
ddZddZdddZddZd
ddZy	)a0  MCP prompt templates for Code Review Graph.

Provides 5 pre-built prompt workflows, all enforcing token-efficient
detail_level="minimal" first patterns with get_minimal_context entry point.

1. review_changes   - pre-commit review using detect_changes + affected_flows
2. architecture_map - architecture docs using communities, flows, Mermaid
3. debug_issue      - guided debugging using search, flow tracing
4. onboard_developer - new dev orientation using stats, architecture, flows
5. pre_merge_check  - PR readiness with risk scoring, test gaps, dead code
    )annotationsui  ## Rules for Token-Efficient Graph Usage
1. ALWAYS call `get_minimal_context` first with a task description.
2. Use `detail_level="minimal"` on all tool calls unless the minimal output is insufficient.
3. Only escalate to `detail_level="standard"` or `"verbose"` for the specific entities that need deeper inspection.
4. Never request more than 3 tool calls per turn unless absolutely necessary.
5. Prefer targeted queries (query_graph with a specific symbol) over broad scans (list_communities with full members).
6. When reviewing changes: detect_changes(detail_level="minimal") → only expand on high-risk items.
c                "    dt          d|  ddgS )zcPre-commit review workflow.

    Args:
        base: Git ref to diff against. Default: HEAD~1.
    userzN
## Review Workflow
1. Call `get_minimal_context(task="review changes against uf  ")` to get risk overview.
2. If risk is "low": call `detect_changes(detail_level="minimal")` → report summary + any test gaps.
3. If risk is "medium" or "high":
   a. Call `detect_changes(detail_level="standard")` for full change list.
   b. For each high-risk function, call `query_graph(pattern="callers_of", target=<func>, detail_level="minimal")`.
   c. Call `get_affected_flows(detail_level="minimal")` only if >3 changed functions.
4. Summarize: risk level, what changed, test gaps, specific improvements needed.

Do NOT call get_review_context unless you need source code snippets for a specific function.rolecontent_TOKEN_EFFICIENCY_PREAMBLEbases    e/home/jay/workspace/scripts/.codegraph-venv/lib/python3.12/site-packages/code_review_graph/prompts.pyreview_changes_promptr       s3     -. /M & 45	
     c                     dt          ddgS )z$Architecture documentation workflow.r   a  
## Architecture Mapping Workflow
1. Call `get_minimal_context(task="map architecture")`.
2. Call `get_architecture_overview(detail_level="minimal")` for community coupling summary.
3. Call `list_flows(detail_level="minimal")` for critical flow names + criticality scores.
4. Only call `get_community(name=<X>, detail_level="standard")` for the 1-2 communities the user is most interested in.
5. Produce a concise Mermaid diagram showing communities as boxes and key flows as arrows.r   r	    r   r   architecture_map_promptr   B   s&     -. /1 1	
 r   c                .    | xs d}dt          d| ddgS )zbGuided debugging workflow.

    Args:
        description: Description of the issue to debug.
    z<description>r   z=
## Debug Workflow
1. Call `get_minimal_context(task="debug: a  ")`.
2. Call `semantic_search_nodes(query=<keywords from description>, detail_level="minimal", limit=5)`.
3. For the top 1-2 results, call `query_graph(pattern="callers_of", target=<name>, detail_level="minimal")`.
4. If the issue involves execution flow: call `get_flow(name=<relevant flow>)` for the single most relevant flow.
5. Only call `get_review_context` or `get_impact_radius` if you need to trace the blast radius of a specific change.r   r	   )description	desc_parts     r   debug_issue_promptr   Y   s@     .I -. /= + 
NN	
 r   c                     dt          ddgS )z#New developer orientation workflow.r   u  
## Onboarding Workflow
1. Call `get_minimal_context(task="onboard developer")`.
2. Call `list_graph_stats()` for technology overview.
3. Call `get_architecture_overview(detail_level="minimal")` for the 30-second mental model.
4. Call `list_communities(detail_level="minimal")` — present as a table of module names + sizes.
5. Call `list_flows(detail_level="minimal")` — highlight the top 3 critical flows.
6. Only drill into a specific community or flow if the developer asks.r   r	   r   r   r   onboard_developer_promptr   w   s&     -. /" "	
 r   c                    dt          ddgS )zdPR readiness check workflow.

    Args:
        base: Git ref to diff against. Default: HEAD~1.
    r   a~  
## Pre-Merge Check Workflow
1. Call `get_minimal_context(task="pre-merge check")`.
2. Call `detect_changes(detail_level="minimal")` for risk score and test gaps.
3. If risk > 0.4: call `get_affected_flows(detail_level="minimal")`.
4. If test_gap_count > 0: call `query_graph(pattern="tests_for", target=<each untested function>, detail_level="minimal")` for up to 3 functions.
5. Call `refactor(mode="dead_code", detail_level="minimal")` to check for newly dead code.
6. Only call `find_large_functions` or `get_impact_radius` if risk > 0.7.
7. Output: GO/NO-GO recommendation with 1-sentence justification + list of required follow-ups.r   r	   r   s    r   pre_merge_check_promptr      s&     -. /? ?	
 r   N)zHEAD~1)r   strreturn
list[dict])r   r   ) )r   r   r   r   )	__doc__
__future__r   r
   r   r   r   r   r   r   r   r   <module>r!      s3   
 # "D.<.r   