feat: add project-review workflow (whole-project / single-feature review)
Adds the project-review workflow for code review independent of the git diff. The scope is parsed from the user instruction: 全面/整个项目 -> whole-project (score every source file), otherwise feature + target keyword (locate the code with semantic search + graph queries). - scoring_tools.py: score_review_func gains all_files=True to score every source file in the graph via store.get_all_files() - main.py: score_review_tool gains all_files param; registers the project_review MCP prompt (prompts 6->7) - prompts.py: project_review_prompt(scope, target) with whole-project and feature branches (fixed a precedence bug that truncated the feature text) - skills.py + skills/project-review/: new read-only project-review skill with shared checklists - .opencode/command/code-review-graph-project-review.md: slash command - tests: test_project_review.py (prompt rendering), TestProjectReviewPrompt, skill count assertions 5->6, all_files wiring checks - docs: prompts (6->7) + project-review entries across COMMANDS, CLAUDE, README (+localized), INDEX, architecture, LLM-OPTIMIZED-REFERENCE, CHANGELOG
This commit is contained in:
@@ -809,8 +809,8 @@ _SKILLS: dict[str, dict[str, str]] = {
|
||||
"### Step 8 - Report\n"
|
||||
"Call `generate_report_tool(review_data=<collected verdict, "
|
||||
"metrics, findings, tier, scope>)` to write "
|
||||
"`code-review-report.html`. Also present the text report "
|
||||
"inline.\n\n"
|
||||
"`code-review-report.html` and `code-review-report.md` (default "
|
||||
"`format=\"both\"`). Also present the text report inline.\n\n"
|
||||
"### Step 9 - Persistence (optional)\n"
|
||||
"If the `gstack-review-log` binary is available, record the "
|
||||
"review outcome (status, counts, quality score, per-finding "
|
||||
@@ -830,6 +830,89 @@ _SKILLS: dict[str, dict[str, str]] = {
|
||||
"≤1200 total output tokens."
|
||||
),
|
||||
},
|
||||
"project-review.md": {
|
||||
"name": "project-review",
|
||||
"description": (
|
||||
"Whole-project or single-feature code review (not diff-based) "
|
||||
"using graph-wide analysis and objective scoring"
|
||||
),
|
||||
"body": (
|
||||
"## Project Review\n\n"
|
||||
"Review the entire codebase or a single feature/module, "
|
||||
"independent of the git diff. Two scopes, driven by the "
|
||||
"user's instruction:\n"
|
||||
"- **whole-project**: \"对项目代码进行全面审查\", \"全面审查\", "
|
||||
"\"整个项目\" → review every source file in the graph.\n"
|
||||
"- **feature**: \"审查 <功能/模块> 的代码\" (e.g. payment, "
|
||||
"auth) → review only the code related to the target.\n\n"
|
||||
"**This skill is READ-ONLY.** Every finding is presented to the "
|
||||
"user for a manual fix decision. Never apply code changes, "
|
||||
"commit, or push.\n\n"
|
||||
"### Token Efficiency Rules\n"
|
||||
'- ALWAYS start with `get_minimal_context(task="project review")`. '
|
||||
'Use `detail_level="minimal"` on all calls; escalate to '
|
||||
'"standard" only when a metric or finding needs evidence.\n\n'
|
||||
"### Step 0 - Parse the scope\n"
|
||||
"Read the user's instruction and set scope: whole-project "
|
||||
"(contains 全面/整个项目/所有/all) or feature + target "
|
||||
"(extract the feature/module keyword). Declare both in the "
|
||||
"report header.\n\n"
|
||||
"### Step 1 - Graph ready\n"
|
||||
"1. Call `build_or_update_graph_tool()` to ensure the graph is "
|
||||
"current.\n"
|
||||
"2. Call `get_minimal_context_tool(task=\"project review\")` "
|
||||
"for stats and community overview.\n\n"
|
||||
"### Step 2 - Architecture map\n"
|
||||
"Call `get_architecture_overview_tool(detail_level=\"minimal\")` "
|
||||
"and `list_communities_tool(detail_level=\"minimal\")` to map "
|
||||
"the module structure.\n\n"
|
||||
"### Step 3 - High-risk scan (whole-project)\n"
|
||||
"Call `get_knowledge_gaps_tool()`, `get_hub_nodes_tool()`, "
|
||||
"`get_bridge_nodes_tool()`, `find_large_functions_tool()` and "
|
||||
"`get_surprising_connections_tool()` to locate hotspots, "
|
||||
"chokepoints, untested areas and odd coupling.\n\n"
|
||||
"### Step 4 - Objective scoring\n"
|
||||
"- whole-project: `score_review_tool(all_files=True)` scores "
|
||||
"every source file in the graph.\n"
|
||||
"- feature: locate the target files with "
|
||||
"`semantic_search_nodes_tool(query=<target>)` and "
|
||||
"`query_graph_tool(pattern=\"children_of\", target=<target>)`, "
|
||||
"then `score_review_tool(changed_files=<files>)` and "
|
||||
"`get_impact_radius_tool(changed_files=<files>)` for the "
|
||||
"blast radius.\n\n"
|
||||
"### Step 5 - Chain decomposition\n"
|
||||
"Inspect the scored code across eight categories (interface, "
|
||||
"business, data, utility, error handling, security, "
|
||||
"performance, observability) and apply the gstack CRITICAL "
|
||||
"sub-pass (SQL & Data Safety, Race Conditions, LLM Output "
|
||||
"Trust Boundary, Shell Injection, Enum Completeness). Mark "
|
||||
"each ✅ / ⚠️ / —.\n\n"
|
||||
"### Step 6 - Manual adjudication (READ-ONLY)\n"
|
||||
"Present every finding with severity (🔴 blocker / 🟡 major / "
|
||||
"🔵 minor), confidence (1-10), file:line and a proposed fix. "
|
||||
"Group by severity and ask the user per batch: fix / skip / "
|
||||
"self-fix. 🔴 blockers cannot be batch-skipped. **Do not "
|
||||
"modify code.**\n\n"
|
||||
"### Step 7 - Acceptance gate\n"
|
||||
"Any 🔴 blocker → verdict `❌ FAIL`. Classify each finding as "
|
||||
"Ready / Needs Fix / Unusable.\n\n"
|
||||
"### Step 8 - Report\n"
|
||||
"Call `generate_report_tool(review_data=<verdict, scope, "
|
||||
"metrics, findings>)` to write `code-review-report.html` and "
|
||||
"`code-review-report.md` (default `format=\"both\"`).\n\n"
|
||||
"### Output Format\n"
|
||||
"`Project Review: N issues (X blocker, Y major, Z minor) — "
|
||||
"verdict: ✅ PASS / ❌ FAIL`. List each issue with severity, "
|
||||
"confidence, file:line, problem, and proposed fix.\n\n"
|
||||
"## Token Efficiency Rules\n"
|
||||
'- ALWAYS start with `get_minimal_context(task="project review")` '
|
||||
"before any other graph tool.\n"
|
||||
'- Use `detail_level="minimal"` on all calls. Only escalate to '
|
||||
'"standard" when minimal is insufficient.\n'
|
||||
"- Target: complete a project review in ≤12 tool calls and "
|
||||
"≤1800 total output tokens."
|
||||
),
|
||||
},
|
||||
"debug-issue.md": {
|
||||
"name": "debug-issue",
|
||||
"description": "Systematically debug issues using graph-powered code navigation",
|
||||
|
||||
Reference in New Issue
Block a user