dsh-code-review-graph 0.0.0-stage → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: explore-codebase
3
+ description: Navigate and understand codebase structure using the knowledge graph
4
+ ---
5
+
6
+ ## Explore Codebase
7
+
8
+ Use the code-review-graph MCP tools to find your way around the codebase.
9
+
10
+ ### Steps
11
+
12
+ 1. Call `get_architecture_overview_tool` for the community structure. Call `list_communities_tool`, then `get_community_tool`, only for the modules you need.
13
+ 2. Call `semantic_search_nodes_tool` to find a function or class by name or keyword.
14
+ 3. Call `query_graph_tool` with `callers_of`, `callees_of` or `imports_of` to trace relationships. `children_of` on a file lists its functions and classes.
15
+ 4. Call `list_flows_tool`, then `get_flow_tool` for one flow, to follow an execution path.
16
+ 5. Call `find_large_functions_tool` to find oversized functions.
17
+ 6. Call `list_graph_stats_tool` only when you need node, edge and language counts.
18
+
19
+ ## Token Efficiency Rules
20
+ - Call `get_minimal_context_tool(task="<your task>")` before any other graph tool.
21
+ - Pass `detail_level="minimal"` wherever a tool accepts it. Use "standard" only when minimal is not enough.
22
+ - Prefer a targeted `query_graph_tool` call over a broad listing call.
23
+ - Budget: about five tool calls and 800 tokens of graph output per task.
24
+ - Read the implementation and its tests before changing code. The graph narrows scope; it does not replace the source.
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: refactor-safely
3
+ description: Plan and execute safe refactoring using dependency analysis
4
+ ---
5
+
6
+ ## Refactor Safely
7
+
8
+ Plan a refactor from the dependency graph and apply renames from a preview.
9
+
10
+ ### Steps
11
+
12
+ 1. Call `refactor_tool` with `mode="suggest"` for refactoring candidates, or `mode="dead_code"` for unreferenced code.
13
+ 2. For a rename, call `refactor_tool` with `mode="rename"`, `old_name` and `new_name`. Check the returned edit list before applying.
14
+ 3. Call `apply_refactor_tool` with the returned `refactor_id` to apply the rename.
15
+ 4. Before a large refactor, call `get_impact_radius_tool` and `get_affected_flows_tool` to see the dependents and critical paths involved.
16
+ 5. Call `find_large_functions_tool` to find functions worth splitting.
17
+ 6. After the change, call `detect_changes_tool` to confirm the impact matches the plan.
18
+
19
+ ## Token Efficiency Rules
20
+ - Call `get_minimal_context_tool(task="<your task>")` before any other graph tool.
21
+ - Pass `detail_level="minimal"` wherever a tool accepts it. Use "standard" only when minimal is not enough.
22
+ - Prefer a targeted `query_graph_tool` call over a broad listing call.
23
+ - Budget: about five tool calls and 800 tokens of graph output per task.
24
+ - Read the implementation and its tests before changing code. The graph narrows scope; it does not replace the source.
@@ -0,0 +1,27 @@
1
+ ---
2
+ name: review-changes
3
+ description: Perform a structured code review using change detection and impact
4
+ ---
5
+
6
+ ## Review Changes
7
+
8
+ Review a change set with risk scores and blast radius from the knowledge graph.
9
+
10
+ ### Steps
11
+
12
+ 1. Call `detect_changes_tool` for risk-scored changed functions, test gaps and affected flows.
13
+ 2. Call `get_affected_flows_tool` only when you need the steps of an affected flow.
14
+ 3. For each high-risk function, call `query_graph_tool` with `pattern="tests_for"` to check test coverage.
15
+ 4. Call `get_impact_radius_tool` when the blast radius is not clear from step 1.
16
+ 5. Suggest specific test cases for untested changes.
17
+
18
+ ### Output Format
19
+
20
+ Group findings by risk level (high, medium, low). For each finding give what changed and why it matters, its test coverage, and the suggested fix. End with a merge recommendation.
21
+
22
+ ## Token Efficiency Rules
23
+ - Call `get_minimal_context_tool(task="<your task>")` before any other graph tool.
24
+ - Pass `detail_level="minimal"` wherever a tool accepts it. Use "standard" only when minimal is not enough.
25
+ - Prefer a targeted `query_graph_tool` call over a broad listing call.
26
+ - Budget: about five tool calls and 800 tokens of graph output per task.
27
+ - Read the implementation and its tests before changing code. The graph narrows scope; it does not replace the source.
@@ -0,0 +1,25 @@
1
+ ---
2
+ name: review-delta
3
+ description: Review only changes since last commit using impact analysis. Token-efficient delta review with automatic blast-radius detection.
4
+ argument-hint: "[file or function name]"
5
+ ---
6
+
7
+ # Review Delta
8
+
9
+ Review only the changed code and its blast radius.
10
+
11
+ ## Steps
12
+
13
+ 1. Call `get_minimal_context_tool(task="review changes")`. If it returns `status: not_ready`, call `build_or_update_graph_tool()` and continue.
14
+ 2. Call `detect_changes_tool(detail_level="minimal")` for risk-scored changed functions, test gaps and affected flows. Changes come from `git diff` against `HEAD~1`; if the argument names a file, pass it in `changed_files`.
15
+ 3. Call `get_review_context_tool(detail_level="minimal")` when you need source snippets for the changed areas and `review_guidance` (untested functions, wide blast radius, inheritance changes).
16
+ 4. For each untested high-risk function, confirm with `query_graph_tool(pattern="tests_for", target="<function>")`.
17
+ 5. Use `detail_level="standard"` only for a high-risk item the minimal output leaves unclear. Do not load whole files unless a snippet is not enough.
18
+
19
+ ## Report
20
+
21
+ - Summary: one line
22
+ - Risk: low, medium or high, from the blast radius
23
+ - Issues: bugs, missing tests, style
24
+ - Blast radius: impacted files and functions
25
+ - Recommendations
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: review-pr
3
+ description: Review a PR or branch diff using the knowledge graph for full structural context. Outputs a structured review with blast-radius analysis.
4
+ argument-hint: "[PR number or branch name]"
5
+ ---
6
+
7
+ # Review PR
8
+
9
+ Review all commits of a pull request or branch against its base branch.
10
+
11
+ ## Steps
12
+
13
+ 1. Identify the changes. With a branch name run `git diff --name-only main...<branch>`; otherwise diff the current branch against `main` (or `master`). Use that ref as `base` below.
14
+ 2. Call `get_minimal_context_tool(task="review PR", base="main")`. If it returns `status: not_ready`, call `build_or_update_graph_tool()` and continue.
15
+ 3. Call `detect_changes_tool(base="main", detail_level="minimal")` for risk-scored changed functions, test gaps and affected flows across the whole branch.
16
+ 4. For high-risk functions call `query_graph_tool(pattern="callers_of", target="<function>")` and `query_graph_tool(pattern="tests_for", target="<function>")`. Flag public API changes whose callers were not updated.
17
+ 5. Call `get_review_context_tool(base="main")` for source snippets, or `get_impact_radius_tool(base="main")` for the full dependent list, only when step 3 leaves a high-risk item unclear.
18
+ 6. Read the changed source of the highest-impact files first. Do not load whole files unless the change needs it.
19
+
20
+ ## Output
21
+
22
+ ```
23
+ ## PR Review: <title>
24
+
25
+ ### Summary
26
+ <1-3 sentences>
27
+
28
+ ### Risk
29
+ - Overall: Low / Medium / High
30
+ - Blast radius: <n> files, <m> functions
31
+ - Test coverage: <covered> of <changed> changed functions
32
+
33
+ ### Files
34
+ #### <path>
35
+ - Changes: <what>
36
+ - Impact: <who depends on it>
37
+ - Issues: <bugs, style, concerns>
38
+
39
+ ### Missing Tests
40
+ - <function> in <file>
41
+
42
+ ### Recommendations
43
+ 1. <action>
44
+ ```
45
+
46
+ ## Tips
47
+
48
+ - Use `semantic_search_nodes_tool` to find related code the PR may have missed.