@shareworker/code-review-mcp 0.1.0 → 0.1.2
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/README.md +150 -55
- package/dist/bundler.js +2 -2
- package/dist/bundler.js.map +1 -1
- package/dist/diff-parser.d.ts.map +1 -1
- package/dist/diff-parser.js +11 -6
- package/dist/diff-parser.js.map +1 -1
- package/dist/git.d.ts +17 -0
- package/dist/git.d.ts.map +1 -1
- package/dist/git.js +31 -0
- package/dist/git.js.map +1 -1
- package/dist/index.js +93 -2
- package/dist/index.js.map +1 -1
- package/dist/position.js +3 -3
- package/dist/position.js.map +1 -1
- package/dist/reflect.js +6 -3
- package/dist/reflect.js.map +1 -1
- package/package.json +1 -1
- package/README +0 -155
- package/skills/code +0 -139
- package/skills/code-review/SK +0 -139
- package/skills/code-review/SKILL +0 -139
package/skills/code-review/SKILL
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: code-review
|
|
3
|
-
description: |
|
|
4
|
-
AI-powered code review using the code-review-mcp server. Reviews git changes
|
|
5
|
-
(workspace, range, or commit) for code quality issues with deterministic file
|
|
6
|
-
coverage, precise comment positioning, and deterministic reflection. Use when
|
|
7
|
-
the user asks to review code, review a pull request, review staged/unstaged
|
|
8
|
-
changes, review a commit, or compare branches for code quality.
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
# Code Review Skill
|
|
12
|
-
|
|
13
|
-
This skill orchestrates the `@shareworker/code-review-mcp` MCP server to perform
|
|
14
|
-
structured code reviews. The server provides deterministic engineering (file
|
|
15
|
-
selection, bundling, rule matching, comment positioning, comment reflection);
|
|
16
|
-
you (the host LLM) provide the reasoning (generating comments, semantic review).
|
|
17
|
-
|
|
18
|
-
## Trigger Conditions
|
|
19
|
-
|
|
20
|
-
Activate this skill when the user says any of:
|
|
21
|
-
- "review code" / "review my changes"
|
|
22
|
-
- "review PR" / "review pull request"
|
|
23
|
-
- "review commit" / "review this commit"
|
|
24
|
-
- "review staged/unstaged changes"
|
|
25
|
-
- "compare branches for code quality"
|
|
26
|
-
|
|
27
|
-
## Complete Flow
|
|
28
|
-
|
|
29
|
-
You MUST follow this flow in order. Do not skip steps.
|
|
30
|
-
|
|
31
|
-
### Step 1: Get review targets
|
|
32
|
-
|
|
33
|
-
Call `get_review_targets` to determine which files need review.
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
get_review_targets(mode: "workspace" | "range" | "commit", from?, to?, commit?)
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
- **workspace**: review staged + unstaged + untracked changes (default when user says "review my changes")
|
|
40
|
-
- **range**: review `from..to` (when user says "compare branches" or "review PR")
|
|
41
|
-
- **commit**: review a specific commit (when user says "review commit abc123")
|
|
42
|
-
|
|
43
|
-
The response includes a `diff_ref` — you MUST pass this to all downstream tools.
|
|
44
|
-
|
|
45
|
-
### Step 2: Bundle files
|
|
46
|
-
|
|
47
|
-
Call `get_file_bundle` with the file paths from step 1 and the `diff_ref`.
|
|
48
|
-
|
|
49
|
-
```
|
|
50
|
-
get_file_bundle(files: [...], diff_ref: "<from step 1>")
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
This groups related files (test/source pairs, i18n variants) into review bundles
|
|
54
|
-
with a 20000 char cap. Review each bundle as a unit.
|
|
55
|
-
|
|
56
|
-
### Step 3: Review each bundle
|
|
57
|
-
|
|
58
|
-
For each bundle:
|
|
59
|
-
|
|
60
|
-
1. **Get rules**: Call `match_rules(path)` for each file in the bundle to get
|
|
61
|
-
the `prompt_section` (review rules to apply).
|
|
62
|
-
|
|
63
|
-
2. **Read file content**: Use your native capabilities (read/grep/glob) to read
|
|
64
|
-
the full file content for each file. The diff alone is not enough — you need
|
|
65
|
-
the full file to understand context.
|
|
66
|
-
|
|
67
|
-
3. **Generate comments**: Using the `prompt_section` + diff + full file content,
|
|
68
|
-
generate review comments. Each comment has:
|
|
69
|
-
- `path`: file path
|
|
70
|
-
- `content`: the comment text
|
|
71
|
-
- `existing_code` (optional): the code snippet the comment references
|
|
72
|
-
- `suggestion_code` (optional): suggested fix code
|
|
73
|
-
|
|
74
|
-
4. **Position each comment**: Call `position_comment` to locate each comment to
|
|
75
|
-
precise line numbers:
|
|
76
|
-
```
|
|
77
|
-
position_comment(path, content, existing_code, suggestion_code, hint_line?, diff_ref)
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
5. **Reflect each comment**: Call `reflect_comment` on every positioned comment:
|
|
81
|
-
```
|
|
82
|
-
reflect_comment(path, content, start_line, end_line, existing_code?, diff_ref)
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
### Step 4: Filter and output
|
|
86
|
-
|
|
87
|
-
- **Discard** all comments where `reflect_comment` returns `verdict: "drop"`.
|
|
88
|
-
- **Keep** comments where `verdict: "keep"`.
|
|
89
|
-
- Optionally perform a semantic self-review on kept comments (is the suggestion
|
|
90
|
-
technically correct?). This is your responsibility, not the server's.
|
|
91
|
-
- Classify kept comments by priority and output.
|
|
92
|
-
|
|
93
|
-
## Hard Constraints (MUST follow)
|
|
94
|
-
|
|
95
|
-
1. **You MUST call `reflect_comment` on every comment.** Comments that have not
|
|
96
|
-
been reflected MUST NOT be output to the user.
|
|
97
|
-
|
|
98
|
-
2. **Comments where `reflect_comment` returns `drop` MUST be discarded**, not
|
|
99
|
-
shown to the user.
|
|
100
|
-
|
|
101
|
-
3. **You MUST call `get_review_targets` before `get_file_bundle`.** Do not skip
|
|
102
|
-
either step.
|
|
103
|
-
|
|
104
|
-
4. **You MUST pass the `diff_ref` returned by `get_review_targets`** to
|
|
105
|
-
`get_file_bundle`, `position_comment`, and `reflect_comment`. Do not rely on
|
|
106
|
-
the `"HEAD"` default unless you ran `get_review_targets` in `workspace` mode.
|
|
107
|
-
|
|
108
|
-
## Output Format
|
|
109
|
-
|
|
110
|
-
```markdown
|
|
111
|
-
## Code Review Results
|
|
112
|
-
|
|
113
|
-
**Files reviewed**: N
|
|
114
|
-
**Issues found**: X high priority / Y medium priority
|
|
115
|
-
|
|
116
|
-
### High Priority
|
|
117
|
-
|
|
118
|
-
- **`path/to/file.ts:42`** -- Brief description
|
|
119
|
-
> Recommendation: How to fix
|
|
120
|
-
|
|
121
|
-
### Medium Priority
|
|
122
|
-
|
|
123
|
-
- **`path/to/file.ts:88`** -- Brief description
|
|
124
|
-
> Recommendation: How to fix (if applicable)
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
**Priority classification**:
|
|
128
|
-
- **High**: Obvious bugs, security issues, clear mistakes, well-founded
|
|
129
|
-
suggestions with precise fix proposals
|
|
130
|
-
- **Medium**: Reasonable but context-dependent concerns, style/performance
|
|
131
|
-
suggestions, fixes requiring manual implementation
|
|
132
|
-
- **Low**: Discarded silently (likely false positives, lacking context, nitpicks)
|
|
133
|
-
|
|
134
|
-
## Key Boundary
|
|
135
|
-
|
|
136
|
-
The server does NOT call any LLM. `reflect_comment` is pure deterministic logic
|
|
137
|
-
(checks line ranges, code existence). Semantic-level reflection (is the
|
|
138
|
-
suggestion technically correct?) is YOUR job. After `reflect_comment` returns
|
|
139
|
-
`keep`, you may perform a semantic self-review before outputting.
|