@minakoto00/skills 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.
- package/LICENSE +21 -0
- package/README.md +50 -0
- package/bin/skills.js +58 -0
- package/install-skill.sh +213 -0
- package/package.json +16 -0
- package/skills/review-pr/README.md +163 -0
- package/skills/review-pr/SKILL.md +180 -0
- package/skills/review-pr/docs/examples.md +106 -0
- package/skills/review-pr/scripts/cluster_review_issues.sh +110 -0
- package/skills/review-pr/scripts/common.sh +101 -0
- package/skills/review-pr/scripts/detect_platform.sh +55 -0
- package/skills/review-pr/scripts/fetch_review_comments.sh +301 -0
- package/skills/review-pr/scripts/plan_review_validation_dispatch.sh +74 -0
- package/skills/review-pr/scripts/post_review_comment.sh +89 -0
- package/skills/review-pr/scripts/repo_policy.sh +132 -0
- package/skills/review-pr/scripts/resolve_review_target.sh +160 -0
- package/skills/review-pr/scripts/worktree_sync.sh +118 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 minakoto00
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# VCS Review Flow
|
|
2
|
+
|
|
3
|
+
`VCS Review Flow` is a `skills.sh`-ready repository of skills for reviewing GitHub pull requests and GitLab merge requests through local worktrees. Install the skill you need, then follow the skill-local guide for workflow details.
|
|
4
|
+
|
|
5
|
+
## Quickstart
|
|
6
|
+
|
|
7
|
+
Primary install:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npx skills add minakoto00/vcs-review-flow --skill review-pr
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Optional shortcut:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @minakoto00/skills install review-pr
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Available Skills
|
|
20
|
+
|
|
21
|
+
- `review-pr`: Review the latest open PR or MR in a dedicated worktree and turn remote feedback into a validated change plan. See `skills/review-pr/README.md`.
|
|
22
|
+
|
|
23
|
+
## Updates
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx skills check
|
|
27
|
+
npx skills update
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Advanced Manual Install
|
|
31
|
+
|
|
32
|
+
For local development or power users, the repo still includes `install-skill.sh`.
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
bash ./install-skill.sh
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Use `bash ./install-skill.sh --help` for scripted flags and dry-run options.
|
|
39
|
+
|
|
40
|
+
## Repository Layout
|
|
41
|
+
|
|
42
|
+
- `skills/review-pr/README.md`: full guide for the `review-pr` skill
|
|
43
|
+
- `skills/review-pr/SKILL.md`: skill entrypoint used by agents
|
|
44
|
+
- `skills/review-pr/scripts/`: helper scripts used by the skill workflow
|
|
45
|
+
- `install-skill.sh`: advanced manual installer
|
|
46
|
+
- `bin/skills.js`: npm wrapper for `npx @minakoto00/skills install review-pr`
|
|
47
|
+
|
|
48
|
+
## License
|
|
49
|
+
|
|
50
|
+
This repository and the published `@minakoto00/skills` package are available under the MIT License. See `LICENSE`.
|
package/bin/skills.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { spawnSync } = require("node:child_process");
|
|
4
|
+
|
|
5
|
+
const REPOSITORY = "minakoto00/vcs-review-flow";
|
|
6
|
+
const SUPPORTED_SKILLS = new Set(["review-pr"]);
|
|
7
|
+
|
|
8
|
+
function usage() {
|
|
9
|
+
console.error("Usage: @minakoto00/skills install <skill-name> [--dry-run]");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function fail(message) {
|
|
13
|
+
console.error(message);
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function buildInstallArgs(skillName) {
|
|
18
|
+
return ["skills", "add", REPOSITORY, "--skill", skillName];
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function npxCommand() {
|
|
22
|
+
return process.platform === "win32" ? "npx.cmd" : "npx";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const args = process.argv.slice(2);
|
|
26
|
+
const dryRunIndex = args.indexOf("--dry-run");
|
|
27
|
+
const dryRun = dryRunIndex !== -1;
|
|
28
|
+
|
|
29
|
+
if (dryRun) {
|
|
30
|
+
args.splice(dryRunIndex, 1);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const [command, skillName] = args;
|
|
34
|
+
|
|
35
|
+
if (command !== "install" || !skillName || args.length !== 2) {
|
|
36
|
+
usage();
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!SUPPORTED_SKILLS.has(skillName)) {
|
|
41
|
+
fail(`unsupported skill: ${skillName}`);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const installArgs = buildInstallArgs(skillName);
|
|
45
|
+
const renderedCommand = [npxCommand(), ...installArgs].join(" ");
|
|
46
|
+
|
|
47
|
+
if (dryRun) {
|
|
48
|
+
console.log(renderedCommand);
|
|
49
|
+
process.exit(0);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const result = spawnSync(npxCommand(), installArgs, { stdio: "inherit" });
|
|
53
|
+
|
|
54
|
+
if (result.error) {
|
|
55
|
+
fail(result.error.message);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
process.exit(result.status ?? 1);
|
package/install-skill.sh
ADDED
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
|
|
5
|
+
# shellcheck source=./skills/review-pr/scripts/common.sh
|
|
6
|
+
source "$SCRIPT_DIR/skills/review-pr/scripts/common.sh"
|
|
7
|
+
|
|
8
|
+
agent=
|
|
9
|
+
scope=
|
|
10
|
+
method=
|
|
11
|
+
project_root=
|
|
12
|
+
conflict_strategy=
|
|
13
|
+
dry_run=false
|
|
14
|
+
|
|
15
|
+
usage() {
|
|
16
|
+
cat <<'USAGE'
|
|
17
|
+
Usage: install-skill.sh [--agent codex|claude] [--scope user-global|project-local] [--method symlink|copy] [--project-root <path>] [--conflict replace|backup|cancel] [--dry-run]
|
|
18
|
+
|
|
19
|
+
Interactive installer for the review-pr skill.
|
|
20
|
+
USAGE
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
prompt_with_default() {
|
|
24
|
+
local prompt=$1
|
|
25
|
+
local default_value=$2
|
|
26
|
+
local value
|
|
27
|
+
printf '%s [%s]: ' "$prompt" "$default_value" >&2
|
|
28
|
+
read -r value
|
|
29
|
+
printf '%s' "${value:-$default_value}"
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
choose_option() {
|
|
33
|
+
local prompt=$1
|
|
34
|
+
local default_value=$2
|
|
35
|
+
shift 2
|
|
36
|
+
local options=("$@")
|
|
37
|
+
local answer
|
|
38
|
+
while true; do
|
|
39
|
+
printf '%s\n' "$prompt" >&2
|
|
40
|
+
local index=1
|
|
41
|
+
for option in "${options[@]}"; do
|
|
42
|
+
if [[ "$option" == "$default_value" ]]; then
|
|
43
|
+
printf ' %s. %s (default)\n' "$index" "$option" >&2
|
|
44
|
+
else
|
|
45
|
+
printf ' %s. %s\n' "$index" "$option" >&2
|
|
46
|
+
fi
|
|
47
|
+
index=$((index + 1))
|
|
48
|
+
done
|
|
49
|
+
printf '> ' >&2
|
|
50
|
+
read -r answer
|
|
51
|
+
answer=${answer:-$default_value}
|
|
52
|
+
if [[ "$answer" == "$default_value" ]]; then
|
|
53
|
+
printf '%s\n' "$default_value"
|
|
54
|
+
return 0
|
|
55
|
+
fi
|
|
56
|
+
if [[ "$answer" =~ ^[0-9]+$ ]] && (( answer >= 1 && answer <= ${#options[@]} )); then
|
|
57
|
+
printf '%s\n' "${options[answer-1]}"
|
|
58
|
+
return 0
|
|
59
|
+
fi
|
|
60
|
+
for option in "${options[@]}"; do
|
|
61
|
+
if [[ "$answer" == "$option" ]]; then
|
|
62
|
+
printf '%s\n' "$option"
|
|
63
|
+
return 0
|
|
64
|
+
fi
|
|
65
|
+
done
|
|
66
|
+
printf 'Invalid choice. Try again.\n' >&2
|
|
67
|
+
done
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
determine_target_root() {
|
|
71
|
+
case "$agent:$scope" in
|
|
72
|
+
codex:user-global)
|
|
73
|
+
printf '%s/.agents/skills\n' "$HOME"
|
|
74
|
+
;;
|
|
75
|
+
codex:project-local)
|
|
76
|
+
printf '%s/.agents/skills\n' "$project_root"
|
|
77
|
+
;;
|
|
78
|
+
claude:user-global)
|
|
79
|
+
printf '%s/.claude/skills\n' "$HOME"
|
|
80
|
+
;;
|
|
81
|
+
claude:project-local)
|
|
82
|
+
printf '%s/.claude/skills\n' "$project_root"
|
|
83
|
+
;;
|
|
84
|
+
*)
|
|
85
|
+
die "unsupported install target: $agent:$scope"
|
|
86
|
+
;;
|
|
87
|
+
esac
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
while [[ $# -gt 0 ]]; do
|
|
91
|
+
case "$1" in
|
|
92
|
+
--agent)
|
|
93
|
+
agent=$2
|
|
94
|
+
shift 2
|
|
95
|
+
;;
|
|
96
|
+
--scope)
|
|
97
|
+
scope=$2
|
|
98
|
+
shift 2
|
|
99
|
+
;;
|
|
100
|
+
--method)
|
|
101
|
+
method=$2
|
|
102
|
+
shift 2
|
|
103
|
+
;;
|
|
104
|
+
--project-root)
|
|
105
|
+
project_root=$2
|
|
106
|
+
shift 2
|
|
107
|
+
;;
|
|
108
|
+
--conflict)
|
|
109
|
+
conflict_strategy=$2
|
|
110
|
+
shift 2
|
|
111
|
+
;;
|
|
112
|
+
--dry-run)
|
|
113
|
+
dry_run=true
|
|
114
|
+
shift
|
|
115
|
+
;;
|
|
116
|
+
--help|-h)
|
|
117
|
+
usage
|
|
118
|
+
exit 0
|
|
119
|
+
;;
|
|
120
|
+
*)
|
|
121
|
+
die "unknown argument: $1"
|
|
122
|
+
;;
|
|
123
|
+
esac
|
|
124
|
+
done
|
|
125
|
+
|
|
126
|
+
if [[ -z "$agent" ]]; then
|
|
127
|
+
agent=$(choose_option "Select target agent" codex codex claude)
|
|
128
|
+
fi
|
|
129
|
+
|
|
130
|
+
if [[ -z "$scope" ]]; then
|
|
131
|
+
scope=$(choose_option "Select install scope" user-global user-global project-local)
|
|
132
|
+
fi
|
|
133
|
+
|
|
134
|
+
if [[ -z "$method" ]]; then
|
|
135
|
+
method=$(choose_option "Select install method" symlink symlink copy)
|
|
136
|
+
fi
|
|
137
|
+
|
|
138
|
+
if [[ "$scope" == project-local ]]; then
|
|
139
|
+
default_root=$(pwd)
|
|
140
|
+
if [[ -z "$project_root" ]]; then
|
|
141
|
+
project_root=$(prompt_with_default "Project root" "$default_root")
|
|
142
|
+
fi
|
|
143
|
+
project_root=$(normalize_path "$project_root")
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
case "$agent" in
|
|
147
|
+
codex|claude) ;;
|
|
148
|
+
*) die "agent must be codex or claude" ;;
|
|
149
|
+
esac
|
|
150
|
+
|
|
151
|
+
case "$scope" in
|
|
152
|
+
user-global|project-local) ;;
|
|
153
|
+
*) die "scope must be user-global or project-local" ;;
|
|
154
|
+
esac
|
|
155
|
+
|
|
156
|
+
case "$method" in
|
|
157
|
+
symlink|copy) ;;
|
|
158
|
+
*) die "method must be symlink or copy" ;;
|
|
159
|
+
esac
|
|
160
|
+
|
|
161
|
+
source_dir=$(normalize_path "$SCRIPT_DIR/skills/review-pr")
|
|
162
|
+
skill_name=review-pr
|
|
163
|
+
target_root=$(determine_target_root)
|
|
164
|
+
target_path="$target_root/$skill_name"
|
|
165
|
+
|
|
166
|
+
if [[ "$dry_run" == true ]]; then
|
|
167
|
+
print_kv agent "$agent"
|
|
168
|
+
print_kv scope "$scope"
|
|
169
|
+
print_kv method "$method"
|
|
170
|
+
print_kv source_dir "$source_dir"
|
|
171
|
+
print_kv target_root "$target_root"
|
|
172
|
+
print_kv target_path "$target_path"
|
|
173
|
+
print_kv project_root "$project_root"
|
|
174
|
+
exit 0
|
|
175
|
+
fi
|
|
176
|
+
|
|
177
|
+
mkdir -p "$target_root"
|
|
178
|
+
|
|
179
|
+
if [[ -e "$target_path" || -L "$target_path" ]]; then
|
|
180
|
+
if [[ -z "$conflict_strategy" ]]; then
|
|
181
|
+
conflict_strategy=$(choose_option "Existing installation found. Choose conflict action" cancel cancel replace backup)
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
case "$conflict_strategy" in
|
|
185
|
+
cancel)
|
|
186
|
+
printf 'Installation cancelled.\n'
|
|
187
|
+
exit 0
|
|
188
|
+
;;
|
|
189
|
+
replace)
|
|
190
|
+
rm -rf "$target_path"
|
|
191
|
+
;;
|
|
192
|
+
backup)
|
|
193
|
+
mv "$target_path" "$target_path.bak.$(date +%Y%m%d%H%M%S)"
|
|
194
|
+
;;
|
|
195
|
+
*)
|
|
196
|
+
die "conflict strategy must be replace, backup, or cancel"
|
|
197
|
+
;;
|
|
198
|
+
esac
|
|
199
|
+
fi
|
|
200
|
+
|
|
201
|
+
case "$method" in
|
|
202
|
+
symlink)
|
|
203
|
+
ln -s "$source_dir" "$target_path"
|
|
204
|
+
;;
|
|
205
|
+
copy)
|
|
206
|
+
cp -R "$source_dir" "$target_path"
|
|
207
|
+
;;
|
|
208
|
+
esac
|
|
209
|
+
|
|
210
|
+
print_kv agent "$agent"
|
|
211
|
+
print_kv scope "$scope"
|
|
212
|
+
print_kv method "$method"
|
|
213
|
+
print_kv target_path "$target_path"
|
package/package.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@minakoto00/skills",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Convenience installer for skills hosted in minakoto00/vcs-review-flow.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"minakoto-skills": "bin/skills.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"README.md",
|
|
10
|
+
"LICENSE",
|
|
11
|
+
"bin/",
|
|
12
|
+
"install-skill.sh",
|
|
13
|
+
"skills/"
|
|
14
|
+
],
|
|
15
|
+
"license": "MIT"
|
|
16
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# Review PR
|
|
2
|
+
|
|
3
|
+
`review-pr` reviews the latest open GitHub pull request or GitLab merge request through a local worktree, gathers remote feedback, validates which comments still matter, and then either implements fixes locally or posts a concrete proposal back to the remote.
|
|
4
|
+
|
|
5
|
+
## What It Does
|
|
6
|
+
|
|
7
|
+
- resolves the latest open MR/PR, or a user-specified MR/PR number
|
|
8
|
+
- fetches MR/PR review feedback and splits it into `code-review comments` and `discussion comments`
|
|
9
|
+
- detects GitHub vs GitLab from the repo remote
|
|
10
|
+
- inspects `AGENTS.md` and `CLAUDE.md` before any worktree action
|
|
11
|
+
- reuses or creates the correct local worktree for the MR/PR source branch
|
|
12
|
+
- syncs the worktree to the remote branch head
|
|
13
|
+
- supports a review flow that ends with a change plan and explicit finish options
|
|
14
|
+
- can post proposed changes back as a GitLab or GitHub comment instead of implementing locally
|
|
15
|
+
|
|
16
|
+
## Prerequisites
|
|
17
|
+
|
|
18
|
+
- `git`
|
|
19
|
+
- `jq`
|
|
20
|
+
- `gh` for GitHub repositories
|
|
21
|
+
- `glab` for GitLab repositories
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
Primary install:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx skills add minakoto00/vcs-review-flow --skill review-pr
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Optional shortcut:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx @minakoto00/skills install review-pr
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## How It Works
|
|
38
|
+
|
|
39
|
+
From a repository you want to review, the core steps are:
|
|
40
|
+
|
|
41
|
+
1. Detect the platform.
|
|
42
|
+
2. Resolve the latest open MR/PR or a specific one.
|
|
43
|
+
3. Fetch comment summaries for the MR/PR.
|
|
44
|
+
4. Inspect repo policy from `AGENTS.md` and `CLAUDE.md`.
|
|
45
|
+
5. Ask the user whether to include code-review comments in scope.
|
|
46
|
+
6. Ask the user whether to include discussion comments in scope.
|
|
47
|
+
7. Reuse or create the source-branch worktree.
|
|
48
|
+
8. Run review in that worktree.
|
|
49
|
+
9. Produce a change plan.
|
|
50
|
+
10. Choose whether to implement locally or post the proposal remotely.
|
|
51
|
+
|
|
52
|
+
If comments are present:
|
|
53
|
+
- ask the user whether to include code-review comments in scope
|
|
54
|
+
- ask the user whether to include discussion comments in scope
|
|
55
|
+
- only the approved comment categories move forward
|
|
56
|
+
- resolved code-review feedback is excluded by default
|
|
57
|
+
- outdated threads are validated separately from unresolved threads
|
|
58
|
+
- group approved unresolved and outdated code-review feedback into issue clusters before validation
|
|
59
|
+
- dispatch several subagents in parallel when approved comments need validation
|
|
60
|
+
- search only within changed files for same-pattern candidates
|
|
61
|
+
- report same-pattern candidates separately from the original issues
|
|
62
|
+
- show a verification report before planning fixes
|
|
63
|
+
- if the user confirms, keep the confirmed issues in scope even when tests do not yet cover them
|
|
64
|
+
|
|
65
|
+
## Flowchart
|
|
66
|
+
|
|
67
|
+
```mermaid
|
|
68
|
+
flowchart TD
|
|
69
|
+
A[Resolve repository root] --> B[Detect GitHub or GitLab]
|
|
70
|
+
B --> C{Latest open review target or explicit number?}
|
|
71
|
+
C -->|Latest| D[Resolve latest MR or PR]
|
|
72
|
+
C -->|Specific| E[Resolve specified MR or PR]
|
|
73
|
+
D --> F[Fetch review comments]
|
|
74
|
+
E --> F
|
|
75
|
+
F --> G{Include code-review comments?}
|
|
76
|
+
G -->|Yes| H{Include discussion comments?}
|
|
77
|
+
G -->|No| H
|
|
78
|
+
H --> I[Inspect AGENTS.md and CLAUDE.md policy]
|
|
79
|
+
I --> J[Reuse or create worktree]
|
|
80
|
+
J --> K[Run review in worktree]
|
|
81
|
+
K --> L[Validate approved comments and same-pattern candidates]
|
|
82
|
+
L --> M[Confirm verification report]
|
|
83
|
+
M --> N[Produce change plan]
|
|
84
|
+
N --> O{Finish option}
|
|
85
|
+
O -->|1| P[Implement on original source branch]
|
|
86
|
+
O -->|2| Q[Implement, then merge or cherry-pick elsewhere]
|
|
87
|
+
O -->|3| R[Post comment-only proposal]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Local Development
|
|
91
|
+
|
|
92
|
+
When running the skill directly from a clone of this repository, use the scripts under `skills/review-pr/`.
|
|
93
|
+
|
|
94
|
+
Detect platform:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
bash ./skills/review-pr/scripts/detect_platform.sh --repo /path/to/repo
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Resolve the latest open MR/PR:
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
bash ./skills/review-pr/scripts/resolve_review_target.sh \
|
|
104
|
+
--repo /path/to/repo \
|
|
105
|
+
--latest
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Resolve a specific MR/PR number:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
bash ./skills/review-pr/scripts/resolve_review_target.sh \
|
|
112
|
+
--repo /path/to/repo \
|
|
113
|
+
--number 123
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Inspect repo worktree policy:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
bash ./skills/review-pr/scripts/repo_policy.sh \
|
|
120
|
+
--repo /path/to/repo
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Fetch review comments:
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
bash ./skills/review-pr/scripts/fetch_review_comments.sh \
|
|
127
|
+
--repo /path/to/repo \
|
|
128
|
+
--number 123 \
|
|
129
|
+
--platform github \
|
|
130
|
+
--json
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
Prepare or reuse the worktree:
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
bash ./skills/review-pr/scripts/worktree_sync.sh \
|
|
137
|
+
--repo /path/to/repo \
|
|
138
|
+
--source-branch feat/example \
|
|
139
|
+
--head-sha abcdef1234567890
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Post a comment-only proposal:
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
bash ./skills/review-pr/scripts/post_review_comment.sh \
|
|
146
|
+
--repo /path/to/repo \
|
|
147
|
+
--number 123 \
|
|
148
|
+
--body-file /tmp/review-plan.md
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Safety Rules
|
|
152
|
+
|
|
153
|
+
- The skill reads both `AGENTS.md` and `CLAUDE.md` when present.
|
|
154
|
+
- If those files conflict on worktree policy, it stops instead of guessing.
|
|
155
|
+
- If an existing worktree is dirty, it stops before syncing.
|
|
156
|
+
- It does not force-push unless the user explicitly asks.
|
|
157
|
+
- It requires `gh` or `glab` authentication for live remote operations.
|
|
158
|
+
|
|
159
|
+
## Related Files
|
|
160
|
+
|
|
161
|
+
- `skills/review-pr/SKILL.md`: skill entrypoint and workflow contract
|
|
162
|
+
- `skills/review-pr/scripts/`: runtime helpers for platform detection, target resolution, policy parsing, worktree sync, and comment posting
|
|
163
|
+
- `skills/review-pr/docs/examples.md`: extra examples
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-pr
|
|
3
|
+
description: Use when you need to review or update the latest open GitLab merge request or GitHub pull request through a local worktree, or when a user provides a specific MR or PR number.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review PR
|
|
7
|
+
|
|
8
|
+
Use this skill when the user wants you to pull, review, or update a remote GitLab MR or GitHub PR through a local worktree instead of switching the current checkout.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- `git`
|
|
13
|
+
- `jq`
|
|
14
|
+
- `gh` for GitHub repositories
|
|
15
|
+
- `glab` for GitLab repositories
|
|
16
|
+
|
|
17
|
+
## Workflow
|
|
18
|
+
|
|
19
|
+
1. Resolve the repository root.
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
git rev-parse --show-toplevel
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
2. Detect the VCS platform.
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
bash scripts/detect_platform.sh --repo <repo-root>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
3. Resolve the review target.
|
|
32
|
+
|
|
33
|
+
Latest open MR/PR:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
bash scripts/resolve_review_target.sh --repo <repo-root> --latest
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Specific MR/PR number:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
bash scripts/resolve_review_target.sh --repo <repo-root> --number <number>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
4. Fetch remote review comments for the resolved MR/PR.
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
bash scripts/fetch_review_comments.sh --repo <repo-root> --number <number> --platform <github|gitlab> --json
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Rules:
|
|
52
|
+
- if `code-review comments` exist, ask the user whether to include code-review comments in scope before continuing
|
|
53
|
+
- if `discussion comments` exist, ask the user whether to include discussion comments in scope after the code-review comment decision
|
|
54
|
+
- only the approved comment categories enter the active review scope
|
|
55
|
+
- preserve richer remote metadata for approved code-review comments when the platform provides it
|
|
56
|
+
- resolved code-review feedback is excluded from review scope by default
|
|
57
|
+
- outdated code-review feedback is validated separately from unresolved threads
|
|
58
|
+
- approved unresolved and outdated code-review feedback is grouped into issue clusters before validation
|
|
59
|
+
- if any categories are approved, dispatch several subagents in parallel to validate whether those approved comments still make sense
|
|
60
|
+
- subagents search only within changed files for same-pattern candidates
|
|
61
|
+
- report same-pattern candidates separately from the original issue clusters
|
|
62
|
+
- present a simple verification report before planning fixes
|
|
63
|
+
- ask the user to confirm the verification report before planning fixes
|
|
64
|
+
- if the user confirms, treat the confirmed comments as in-scope issues even when tests do not yet cover them
|
|
65
|
+
|
|
66
|
+
5. Inspect repository policy before touching worktrees.
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bash scripts/repo_policy.sh --repo <repo-root>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Read both `AGENTS.md` and `CLAUDE.md` when present. If they conflict on worktree location or workflow, surface that conflict instead of guessing.
|
|
73
|
+
|
|
74
|
+
6. Reuse or create the worktree for the MR/PR source branch.
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
bash scripts/worktree_sync.sh \
|
|
78
|
+
--repo <repo-root> \
|
|
79
|
+
--source-branch <source-branch> \
|
|
80
|
+
--head-sha <head-sha>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Rules:
|
|
84
|
+
- if the matching worktree already exists locally, sync it to the latest remote branch head
|
|
85
|
+
- if the matching worktree does not exist, create it in the repo-approved location
|
|
86
|
+
- if the existing worktree has uncommitted changes, stop and ask before syncing
|
|
87
|
+
|
|
88
|
+
7. Run review from the prepared worktree.
|
|
89
|
+
|
|
90
|
+
If the environment exposes a review skill such as `requesting-code-review`, invoke it with:
|
|
91
|
+
- the user's review request
|
|
92
|
+
- the resolved base/head context
|
|
93
|
+
- the approved comment categories plus their pulled comment content
|
|
94
|
+
- the richer remote metadata for approved code-review comments
|
|
95
|
+
- the prepared worktree path
|
|
96
|
+
|
|
97
|
+
If no dedicated review skill is available, perform the review directly with a code-review mindset.
|
|
98
|
+
|
|
99
|
+
8. If approved comment categories were selected, validate them before fix planning.
|
|
100
|
+
|
|
101
|
+
For approved comments:
|
|
102
|
+
- exclude resolved code-review feedback from active validation by default
|
|
103
|
+
- validate outdated threads separately from unresolved threads
|
|
104
|
+
- group approved code-review feedback into issue clusters before dispatch
|
|
105
|
+
- dispatch several subagents in parallel to classify each selected comment or issue cluster as likely valid, unclear, or likely stale
|
|
106
|
+
- search only within changed files for same-pattern candidates
|
|
107
|
+
- report same-pattern candidates separately from the original issue clusters
|
|
108
|
+
- produce a verification report with a short reason for each classification
|
|
109
|
+
- ask the user to confirm the verification report before planning fixes
|
|
110
|
+
|
|
111
|
+
9. After review and any required confirmation, produce a change plan.
|
|
112
|
+
|
|
113
|
+
The change plan must include:
|
|
114
|
+
- key findings being addressed
|
|
115
|
+
- likely files or areas to change
|
|
116
|
+
- implementation direction
|
|
117
|
+
- verification steps
|
|
118
|
+
|
|
119
|
+
If the user confirmed approved comments as valid, include them in the change plan even when tests do not yet cover them.
|
|
120
|
+
|
|
121
|
+
10. Present exactly these finish options.
|
|
122
|
+
|
|
123
|
+
```text
|
|
124
|
+
1. Implement locally on the original source branch, commit, and push to update the MR/PR.
|
|
125
|
+
2. Implement locally on the original source branch, commit there, then merge or cherry-pick into a user-specified branch.
|
|
126
|
+
3. Do not implement locally; post the proposed changes as a GitLab/GitHub comment with concrete patch guidance.
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## Safety Stops
|
|
130
|
+
|
|
131
|
+
- Stop if `gh` or `glab` is missing for the detected platform.
|
|
132
|
+
- Stop if authentication fails.
|
|
133
|
+
- Stop if there are no open MRs/PRs.
|
|
134
|
+
- Stop if the remote source branch no longer exists.
|
|
135
|
+
- Stop before syncing a dirty worktree.
|
|
136
|
+
- Never force-push unless the user explicitly asks.
|
|
137
|
+
|
|
138
|
+
## Quick Reference
|
|
139
|
+
|
|
140
|
+
Detect platform:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
bash scripts/detect_platform.sh --repo <repo-root>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Resolve latest target:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
bash scripts/resolve_review_target.sh --repo <repo-root> --latest
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Resolve explicit target:
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
bash scripts/resolve_review_target.sh --repo <repo-root> --number 123
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Inspect repo policy:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
bash scripts/repo_policy.sh --repo <repo-root>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
Sync worktree:
|
|
165
|
+
|
|
166
|
+
```bash
|
|
167
|
+
bash scripts/worktree_sync.sh --repo <repo-root> --source-branch feat/example --head-sha <sha>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Fetch review comments:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
bash scripts/fetch_review_comments.sh --repo <repo-root> --number 123 --platform github --json
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Post comment-only proposal:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
bash scripts/post_review_comment.sh --repo <repo-root> --number 123 --body-file /tmp/review-plan.md
|
|
180
|
+
```
|