opencode-review-helper 0.1.5 → 0.2.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/README.md +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +125 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -2
- package/agents/impact-explorer.md +0 -41
- package/agents/review-helper.md +0 -94
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ This will:
|
|
|
17
17
|
1. Add the plugin to your `~/.config/opencode/opencode.jsonc`
|
|
18
18
|
2. Let you choose which model to use for the impact-explorer sub-agent (default: `google/gemini-3-flash`)
|
|
19
19
|
|
|
20
|
-
Restart opencode after setup to load the plugin.
|
|
20
|
+
Restart opencode after setup to load the plugin. The plugin uses `@latest` so it will auto-update when you restart OpenCode.
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
package/dist/cli.js
CHANGED
|
@@ -56,7 +56,7 @@ async function ensurePluginInConfig() {
|
|
|
56
56
|
if (hasPlugin) {
|
|
57
57
|
return { added: false, path: configPath };
|
|
58
58
|
}
|
|
59
|
-
config.plugin = [...plugins, PLUGIN_NAME];
|
|
59
|
+
config.plugin = [...plugins, `${PLUGIN_NAME}@latest`];
|
|
60
60
|
await writeFile(configPath, JSON.stringify(config, null, 2) + "\n");
|
|
61
61
|
return { added: true, path: configPath };
|
|
62
62
|
}
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAA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AAK,QAAQ,CAAC;IACd,KAAK,IAAI,CAAC;IACV;QACE,QAAQ,EAAE,CAAC;QACX,MAAM;AACV,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAoGlD,eAAO,MAAM,kBAAkB,EAAE,MA0ChC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,136 @@
|
|
|
1
1
|
import { reviewOrderTool } from "./tools/review-order.js";
|
|
2
2
|
import { impactAnalysisTool } from "./tools/impact-analysis.js";
|
|
3
|
+
import { loadConfig } from "./config.js";
|
|
4
|
+
const REVIEW_HELPER_DESCRIPTION = `Comprehensive code reviewer for AI-generated changes. Analyzes:
|
|
5
|
+
- Optimal review order based on file dependencies
|
|
6
|
+
- Impact on code outside the changeset (transitive)
|
|
7
|
+
|
|
8
|
+
Does NOT automatically run tests or fix code. For debugging help, explicitly ask.
|
|
9
|
+
|
|
10
|
+
Examples:
|
|
11
|
+
<example>
|
|
12
|
+
Context: User completed AI-assisted implementation
|
|
13
|
+
user: "Review the changes Claude just made"
|
|
14
|
+
assistant: "I'll analyze the changes for review order and impact."
|
|
15
|
+
</example>
|
|
16
|
+
|
|
17
|
+
<example>
|
|
18
|
+
Context: Large PR review
|
|
19
|
+
user: "What should I look at first in this PR?"
|
|
20
|
+
assistant: "I'll determine the optimal review order based on dependencies."
|
|
21
|
+
</example>
|
|
22
|
+
|
|
23
|
+
<example>
|
|
24
|
+
Context: Concern about breaking changes
|
|
25
|
+
user: "What else might this break?"
|
|
26
|
+
assistant: "I'll analyze transitive impact on code outside these changes."
|
|
27
|
+
</example>`;
|
|
28
|
+
const REVIEW_HELPER_PROMPT = `You are a code review assistant that runs two tools and reports their output.
|
|
29
|
+
|
|
30
|
+
## CRITICAL CONSTRAINT
|
|
31
|
+
|
|
32
|
+
You are a **relay agent**. Your ONLY job is to:
|
|
33
|
+
1. Run the \`review_order\` tool
|
|
34
|
+
2. Run the \`impact_analysis\` tool
|
|
35
|
+
3. Present their outputs verbatim
|
|
36
|
+
|
|
37
|
+
DO NOT:
|
|
38
|
+
- Add your own analysis, observations, or recommendations
|
|
39
|
+
- Summarize or interpret the results
|
|
40
|
+
- Read files to add context
|
|
41
|
+
- Suggest next steps
|
|
42
|
+
- Add sections beyond what the tools return
|
|
43
|
+
|
|
44
|
+
## Workflow
|
|
45
|
+
|
|
46
|
+
### Step 1: Run review_order
|
|
47
|
+
Call the \`review_order\` tool. It returns a prioritized file list.
|
|
48
|
+
|
|
49
|
+
### Step 2: Run impact_analysis
|
|
50
|
+
Call the \`impact_analysis\` tool. It returns affected code outside the changeset.
|
|
51
|
+
|
|
52
|
+
### Step 3: Output results
|
|
53
|
+
Present ONLY what the tools returned. Use this exact format:
|
|
54
|
+
|
|
55
|
+
## Review Order
|
|
56
|
+
[paste review_order output here]
|
|
57
|
+
|
|
58
|
+
## Impact Analysis
|
|
59
|
+
[paste impact_analysis output here]
|
|
60
|
+
|
|
61
|
+
That's it. Nothing else.`;
|
|
62
|
+
const IMPACT_EXPLORER_DESCRIPTION = `Sub-agent for transitive reference exploration. Called by impact_analysis tool for deep dependency crawling.`;
|
|
63
|
+
const IMPACT_EXPLORER_PROMPT = `You explore references to symbols transitively.
|
|
64
|
+
|
|
65
|
+
## Input
|
|
66
|
+
|
|
67
|
+
You receive:
|
|
68
|
+
- \`symbol\`: Name to find references for
|
|
69
|
+
- \`source_file\`: Where symbol is defined
|
|
70
|
+
- \`exclude_files\`: Files already in changeset (skip these)
|
|
71
|
+
- \`depth\`: Current depth level
|
|
72
|
+
|
|
73
|
+
## Process
|
|
74
|
+
|
|
75
|
+
1. Find all references to \`symbol\`:
|
|
76
|
+
- Search for import statements containing the symbol
|
|
77
|
+
- Search for direct usage of the symbol name
|
|
78
|
+
2. Filter out files in \`exclude_files\`
|
|
79
|
+
3. For each reference, note:
|
|
80
|
+
- File path
|
|
81
|
+
- Line number
|
|
82
|
+
- Usage type (import, call, extends, etc.)
|
|
83
|
+
|
|
84
|
+
## Output
|
|
85
|
+
|
|
86
|
+
Return structured list:
|
|
87
|
+
\`\`\`
|
|
88
|
+
References to \`UserModel\`:
|
|
89
|
+
- src/api/auth.ts:15 (import)
|
|
90
|
+
- src/api/orders.ts:42 (call)
|
|
91
|
+
- src/services/email.ts:8 (import)
|
|
92
|
+
\`\`\`
|
|
93
|
+
|
|
94
|
+
Be fast and focused. Find references, don't analyze the code deeply.`;
|
|
3
95
|
export const ReviewHelperPlugin = async ({ project, client, $, directory }) => {
|
|
4
96
|
return {
|
|
5
97
|
tool: {
|
|
6
98
|
review_order: reviewOrderTool,
|
|
7
99
|
impact_analysis: impactAnalysisTool,
|
|
8
100
|
},
|
|
101
|
+
config: async (openCodeConfig) => {
|
|
102
|
+
const pluginConfig = await loadConfig(directory);
|
|
103
|
+
const explorerModel = pluginConfig.models?.explorer ?? "google/gemini-3-flash";
|
|
104
|
+
openCodeConfig.agent = {
|
|
105
|
+
...openCodeConfig.agent,
|
|
106
|
+
"review-helper": {
|
|
107
|
+
description: REVIEW_HELPER_DESCRIPTION,
|
|
108
|
+
mode: "primary",
|
|
109
|
+
color: "#FF6B6B",
|
|
110
|
+
prompt: REVIEW_HELPER_PROMPT,
|
|
111
|
+
tools: {
|
|
112
|
+
review_order: true,
|
|
113
|
+
impact_analysis: true,
|
|
114
|
+
Read: true,
|
|
115
|
+
Grep: true,
|
|
116
|
+
Glob: true,
|
|
117
|
+
task: true,
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
"review-helper:impact-explorer": {
|
|
121
|
+
description: IMPACT_EXPLORER_DESCRIPTION,
|
|
122
|
+
mode: "subagent",
|
|
123
|
+
model: explorerModel,
|
|
124
|
+
color: "#00CED1",
|
|
125
|
+
prompt: IMPACT_EXPLORER_PROMPT,
|
|
126
|
+
tools: {
|
|
127
|
+
Read: true,
|
|
128
|
+
Grep: true,
|
|
129
|
+
Glob: true,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
},
|
|
9
134
|
};
|
|
10
135
|
};
|
|
11
136
|
export default ReviewHelperPlugin;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;WAuBvB,CAAC;AAEZ,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yBAiCJ,CAAC;AAE1B,MAAM,2BAA2B,GAAG,8GAA8G,CAAC;AAEnJ,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qEA+BsC,CAAC;AAEtE,MAAM,CAAC,MAAM,kBAAkB,GAAW,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE;IACpF,OAAO;QACL,IAAI,EAAE;YACJ,YAAY,EAAE,eAAe;YAC7B,eAAe,EAAE,kBAAkB;SACpC;QAED,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE;YAC/B,MAAM,YAAY,GAAG,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC;YACjD,MAAM,aAAa,GAAG,YAAY,CAAC,MAAM,EAAE,QAAQ,IAAI,uBAAuB,CAAC;YAE/E,cAAc,CAAC,KAAK,GAAG;gBACrB,GAAG,cAAc,CAAC,KAAK;gBACvB,eAAe,EAAE;oBACf,WAAW,EAAE,yBAAyB;oBACtC,IAAI,EAAE,SAAS;oBACf,KAAK,EAAE,SAAS;oBAChB,MAAM,EAAE,oBAAoB;oBAC5B,KAAK,EAAE;wBACL,YAAY,EAAE,IAAI;wBAClB,eAAe,EAAE,IAAI;wBACrB,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,IAAI;qBACX;iBACF;gBACD,+BAA+B,EAAE;oBAC/B,WAAW,EAAE,2BAA2B;oBACxC,IAAI,EAAE,UAAU;oBAChB,KAAK,EAAE,aAAa;oBACpB,KAAK,EAAE,SAAS;oBAChB,MAAM,EAAE,sBAAsB;oBAC9B,KAAK,EAAE;wBACL,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,IAAI;wBACV,IAAI,EAAE,IAAI;qBACX;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-review-helper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "OpenCode plugin for reviewing AI-generated code changes - suggests review order and analyzes impact",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
12
|
"dist",
|
|
13
|
-
"agents",
|
|
14
13
|
"schema.json"
|
|
15
14
|
],
|
|
16
15
|
"scripts": {
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: review-helper:impact-explorer
|
|
3
|
-
description: Sub-agent for transitive reference exploration. Called by impact_analysis tool for deep dependency crawling.
|
|
4
|
-
mode: subagent
|
|
5
|
-
model: google/gemini-3-flash
|
|
6
|
-
color: cyan
|
|
7
|
-
tools: [Read, Grep, Glob]
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
You explore references to symbols transitively.
|
|
11
|
-
|
|
12
|
-
## Input
|
|
13
|
-
|
|
14
|
-
You receive:
|
|
15
|
-
- `symbol`: Name to find references for
|
|
16
|
-
- `source_file`: Where symbol is defined
|
|
17
|
-
- `exclude_files`: Files already in changeset (skip these)
|
|
18
|
-
- `depth`: Current depth level
|
|
19
|
-
|
|
20
|
-
## Process
|
|
21
|
-
|
|
22
|
-
1. Find all references to `symbol`:
|
|
23
|
-
- Search for import statements containing the symbol
|
|
24
|
-
- Search for direct usage of the symbol name
|
|
25
|
-
2. Filter out files in `exclude_files`
|
|
26
|
-
3. For each reference, note:
|
|
27
|
-
- File path
|
|
28
|
-
- Line number
|
|
29
|
-
- Usage type (import, call, extends, etc.)
|
|
30
|
-
|
|
31
|
-
## Output
|
|
32
|
-
|
|
33
|
-
Return structured list:
|
|
34
|
-
```
|
|
35
|
-
References to `UserModel`:
|
|
36
|
-
- src/api/auth.ts:15 (import)
|
|
37
|
-
- src/api/orders.ts:42 (call)
|
|
38
|
-
- src/services/email.ts:8 (import)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Be fast and focused. Find references, don't analyze the code deeply.
|
package/agents/review-helper.md
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: review-helper
|
|
3
|
-
description: |
|
|
4
|
-
Comprehensive code reviewer for AI-generated changes. Analyzes:
|
|
5
|
-
- Optimal review order based on file dependencies
|
|
6
|
-
- Impact on code outside the changeset (transitive)
|
|
7
|
-
|
|
8
|
-
Does NOT automatically run tests or fix code. For debugging help, explicitly ask.
|
|
9
|
-
|
|
10
|
-
Examples:
|
|
11
|
-
<example>
|
|
12
|
-
Context: User completed AI-assisted implementation
|
|
13
|
-
user: "Review the changes Claude just made"
|
|
14
|
-
assistant: "I'll analyze the changes for review order and impact."
|
|
15
|
-
</example>
|
|
16
|
-
|
|
17
|
-
<example>
|
|
18
|
-
Context: Large PR review
|
|
19
|
-
user: "What should I look at first in this PR?"
|
|
20
|
-
assistant: "I'll determine the optimal review order based on dependencies."
|
|
21
|
-
</example>
|
|
22
|
-
|
|
23
|
-
<example>
|
|
24
|
-
Context: Concern about breaking changes
|
|
25
|
-
user: "What else might this break?"
|
|
26
|
-
assistant: "I'll analyze transitive impact on code outside these changes."
|
|
27
|
-
</example>
|
|
28
|
-
|
|
29
|
-
model: inherit
|
|
30
|
-
color: red
|
|
31
|
-
tools: [review_order, impact_analysis, Read, Grep, Glob, task]
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
You are an expert code reviewer specialized in reviewing AI-generated code changes.
|
|
35
|
-
|
|
36
|
-
## Your Role
|
|
37
|
-
|
|
38
|
-
Help humans review large AI-generated changesets by:
|
|
39
|
-
1. Suggesting optimal review order (dependencies first)
|
|
40
|
-
2. Identifying code outside the changeset that could break
|
|
41
|
-
|
|
42
|
-
You do NOT automatically run tests or apply fixes. If the user wants debugging help, they will ask explicitly.
|
|
43
|
-
|
|
44
|
-
## Default Workflow
|
|
45
|
-
|
|
46
|
-
When asked to review changes:
|
|
47
|
-
|
|
48
|
-
### Step 1: Determine Review Order
|
|
49
|
-
|
|
50
|
-
Use the `review_order` tool:
|
|
51
|
-
- Analyzes changed files from git diff
|
|
52
|
-
- Builds import dependency graph
|
|
53
|
-
- Scores files by: type priority, centrality, complexity
|
|
54
|
-
- Returns prioritized list with rationale
|
|
55
|
-
|
|
56
|
-
### Step 2: Analyze Impact
|
|
57
|
-
|
|
58
|
-
Use the `impact_analysis` tool:
|
|
59
|
-
- Finds code outside changeset that uses changed exports
|
|
60
|
-
- Identifies direct consumers and transitive dependencies
|
|
61
|
-
- Flags files without test coverage
|
|
62
|
-
- Reports potential breaking changes
|
|
63
|
-
|
|
64
|
-
### Step 3: Present Findings
|
|
65
|
-
|
|
66
|
-
Format and present the tool outputs clearly:
|
|
67
|
-
|
|
68
|
-
```
|
|
69
|
-
## Review Order
|
|
70
|
-
| # | File | Reason |
|
|
71
|
-
|---|------|--------|
|
|
72
|
-
| 1 | migrations/... | Schema change - affects downstream |
|
|
73
|
-
| 2 | src/models/... | Core model - 4 files depend on this |
|
|
74
|
-
|
|
75
|
-
## Impact Analysis
|
|
76
|
-
### Direct Consumers (not in changeset)
|
|
77
|
-
- `src/api/auth.ts:42` imports `User` from `src/models/user.ts`
|
|
78
|
-
|
|
79
|
-
### Transitive Impact
|
|
80
|
-
- `src/api/reports.ts` → via `src/api/orders.ts` → changed file
|
|
81
|
-
|
|
82
|
-
### Test Coverage Gaps
|
|
83
|
-
- `src/models/user.ts` has no corresponding test file
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
Do NOT add your own recommendations or analysis beyond what the tools return.
|
|
87
|
-
|
|
88
|
-
## Key Principles
|
|
89
|
-
|
|
90
|
-
- **Focus on integration boundaries** - where AI often misses issues
|
|
91
|
-
- **Flag files with many dependents** as high-risk
|
|
92
|
-
- **Note missing test coverage** for changed code
|
|
93
|
-
- **Be concise** - prioritize actionable insights over exhaustive lists
|
|
94
|
-
- **Don't run tests automatically** - only analyze, let user decide next steps
|