dsh-code-review-graph 0.0.0-stage → 0.1.1
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.
- package/LICENSE +22 -0
- package/NOTICE +12 -0
- package/README.en.md +120 -0
- package/README.md +113 -2
- package/capabilities.json +1790 -0
- package/cordis.patch.yml +3 -0
- package/dist/backend.js +215 -0
- package/dist/backend.js.map +7 -0
- package/dist/client.js +103 -0
- package/dist/client.js.map +7 -0
- package/dist/html.js +17 -0
- package/dist/html.js.map +7 -0
- package/dist/index.js +511 -0
- package/dist/index.js.map +7 -0
- package/dist/refactor.js +68 -0
- package/dist/refactor.js.map +7 -0
- package/dist/safety.js +52 -0
- package/dist/safety.js.map +7 -0
- package/dist/setup.js +78 -0
- package/dist/setup.js.map +7 -0
- package/dist/workflows.js +30 -0
- package/dist/workflows.js.map +7 -0
- package/docs/capabilities.md +103 -0
- package/docs/release-0.1.1.md +30 -0
- package/docs/validation.md +161 -0
- package/engine.json +8 -0
- package/package.json +38 -4
- package/skills/build-graph/SKILL.md +26 -0
- package/skills/debug-issue/SKILL.md +23 -0
- package/skills/explore-codebase/SKILL.md +24 -0
- package/skills/refactor-safely/SKILL.md +24 -0
- package/skills/review-changes/SKILL.md +27 -0
- package/skills/review-delta/SKILL.md +25 -0
- package/skills/review-pr/SKILL.md +48 -0
package/package.json
CHANGED
|
@@ -1,6 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-code-review-graph",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Local code intelligence, review workflows and interactive graphs for DeepSeek Harness",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": "github:sumingwang233/dsh-code-review-graph",
|
|
8
|
+
"engines": { "node": ">=22.19" },
|
|
9
|
+
"exports": { ".": "./dist/index.js", "./client": "./dist/client.js", "./package.json": "./package.json" },
|
|
10
|
+
"bin": { "dsh-crg": "./dist/setup.js" },
|
|
11
|
+
"files": ["dist", "cordis.patch.yml", "engine.json", "capabilities.json", "skills", "LICENSE", "NOTICE", "README.md", "README.en.md", "docs/capabilities.md", "docs/validation.md", "docs/release-0.1.1.md"],
|
|
12
|
+
"dsh": { "bundle": { "patch": "./cordis.patch.yml" }, "client": { "platform": "web", "inject": ["@deepseek-ai/dsh-api-workspace-files", "@deepseek-ai/dsh-client-ui-sidebar-right", "@deepseek-ai/dsh-api-remotes"] } },
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "node scripts/build.mjs",
|
|
15
|
+
"typecheck": "tsc --noEmit",
|
|
16
|
+
"test": "node --test tests/*.test.mjs",
|
|
17
|
+
"test:integration": "node --test tests/integration.mjs",
|
|
18
|
+
"test:browser": "node --test tests/browser.mjs",
|
|
19
|
+
"test:desktop": "node --test tests/desktop.mjs",
|
|
20
|
+
"test:install": "node --test tests/install.mjs",
|
|
21
|
+
"test:setup": "node --test tests/setup.mjs",
|
|
22
|
+
"test:backend": "node --test tests/backend.mjs",
|
|
23
|
+
"prepare:tests": "node scripts/prepare-test-runtime.mjs",
|
|
24
|
+
"prepack": "npm run typecheck && npm run build"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": { "@modelcontextprotocol/sdk": "1.32.1", "ajv": "8.20.0" },
|
|
27
|
+
"peerDependencies": { "@deepseek-ai/cordis": "^4.0.0", "@deepseek-ai/schemastery": "^3.18.0", "react": "^18.2.0" },
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@deepseek-ai/cordis": "4.0.4", "@deepseek-ai/schemastery": "3.18.4",
|
|
30
|
+
"@deepseek-ai/dsh-tools": "0.2.0-rc.2", "@deepseek-ai/dsh-agent": "0.2.0-rc.2",
|
|
31
|
+
"@deepseek-ai/dsh-session": "0.2.0-rc.2", "@deepseek-ai/dsh-fs": "0.2.0-rc.2",
|
|
32
|
+
"@deepseek-ai/dsh-sandbox-policy": "0.2.0-rc.2", "@deepseek-ai/dsh-skill": "0.2.0-rc.2",
|
|
33
|
+
"@deepseek-ai/dsh-system-prompt": "0.2.0-rc.2",
|
|
34
|
+
"@deepseek-ai/dsh-client-ui-sidebar-right": "0.2.0-rc.2", "@deepseek-ai/dsh-client-ui-slots": "0.2.0-rc.2", "@deepseek-ai/dsh-client-ui-renderer": "0.2.0-rc.2",
|
|
35
|
+
"@deepseek-ai/dsh-api-remotes": "0.2.0-rc.2", "@deepseek-ai/dsh-client-ui-session": "0.2.0-rc.2",
|
|
36
|
+
"@deepseek-ai/dsh-api-workspace-files": "0.2.0-rc.2",
|
|
37
|
+
"@types/node": "^24.0.0", "@types/react": "^18.3.0", "react": "18.3.1", "react-dom": "18.3.1",
|
|
38
|
+
"typescript": "^5.9.0", "esbuild": "^0.25.0", "@playwright/test": "^1.55.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: build-graph
|
|
3
|
+
description: Build or update the code review knowledge graph. Run this first to initialize, or let hooks keep it updated automatically.
|
|
4
|
+
argument-hint: "[full]"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Build Graph
|
|
8
|
+
|
|
9
|
+
Build or incrementally update the knowledge graph for this repository.
|
|
10
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
13
|
+
1. Call `list_graph_stats_tool`. If `last_updated` is null, the graph has never been built.
|
|
14
|
+
2. For a first build, or when the argument is `full`, call `build_or_update_graph_tool(full_rebuild=True)`. Otherwise call `build_or_update_graph_tool()` for an incremental update.
|
|
15
|
+
3. Report the response: `status` (`ok`, `partial` or `error`) and `summary`.
|
|
16
|
+
|
|
17
|
+
## When to Use
|
|
18
|
+
|
|
19
|
+
- First set-up of a repository, or after a branch switch or large refactor.
|
|
20
|
+
- When the graph looks stale. Hooks installed by `code-review-graph install` run an update after each edit and before each commit, so manual builds are rarely needed.
|
|
21
|
+
|
|
22
|
+
## Notes
|
|
23
|
+
|
|
24
|
+
- The database is `.code-review-graph/graph.db` in the repository root.
|
|
25
|
+
- Binary files, dependency and build directories, and patterns in `.code-review-graphignore` are skipped.
|
|
26
|
+
- For the list of supported languages call `get_docs_section_tool(section_name="languages")`.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug-issue
|
|
3
|
+
description: Systematically debug issues using graph-powered code navigation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## Debug Issue
|
|
7
|
+
|
|
8
|
+
Trace a bug through the knowledge graph before reading source.
|
|
9
|
+
|
|
10
|
+
### Steps
|
|
11
|
+
|
|
12
|
+
1. Call `semantic_search_nodes_tool` to find code related to the issue.
|
|
13
|
+
2. Call `query_graph_tool` with `callers_of` and `callees_of` to trace the call chain in both directions.
|
|
14
|
+
3. Call `get_flow_tool` for the execution path that reaches the suspect code. Its entry point is where the bug is triggered.
|
|
15
|
+
4. Call `detect_changes_tool` to check whether a recent change caused the issue.
|
|
16
|
+
5. Call `get_impact_radius_tool` on the suspect files to see what a fix would affect.
|
|
17
|
+
|
|
18
|
+
## Token Efficiency Rules
|
|
19
|
+
- Call `get_minimal_context_tool(task="<your task>")` before any other graph tool.
|
|
20
|
+
- Pass `detail_level="minimal"` wherever a tool accepts it. Use "standard" only when minimal is not enough.
|
|
21
|
+
- Prefer a targeted `query_graph_tool` call over a broad listing call.
|
|
22
|
+
- Budget: about five tool calls and 800 tokens of graph output per task.
|
|
23
|
+
- 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: 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.
|