opencode-review-helper 0.1.6 → 0.3.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 +26 -5
- package/dist/agents/impact-explorer.d.ts +13 -0
- package/dist/agents/impact-explorer.d.ts.map +1 -0
- package/dist/agents/impact-explorer.js +36 -0
- package/dist/agents/impact-explorer.js.map +1 -0
- package/dist/agents/index.d.ts +4 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +4 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/review-helper.d.ts +12 -0
- package/dist/agents/review-helper.d.ts.map +1 -0
- package/dist/agents/review-helper.js +71 -0
- package/dist/agents/review-helper.js.map +1 -0
- package/dist/agents/review-order.d.ts +13 -0
- package/dist/agents/review-order.d.ts.map +1 -0
- package/dist/agents/review-order.js +31 -0
- package/dist/agents/review-order.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -1
- package/dist/tools/review-order.d.ts.map +1 -1
- package/dist/tools/review-order.js +97 -4
- package/dist/tools/review-order.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
|
@@ -21,11 +21,27 @@ Restart opencode after setup to load the plugin. The plugin uses `@latest` so it
|
|
|
21
21
|
|
|
22
22
|
## Usage
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
### Slash Command: `/review-order`
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
The quickest way to use this plugin:
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
/review-order
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
This runs the full workflow:
|
|
33
|
+
1. Analyzes changed files and determines initial review order
|
|
34
|
+
2. Finds external files impacted by the changes
|
|
35
|
+
3. Merges everything into a single prioritized list
|
|
36
|
+
|
|
37
|
+
Output is a unified table showing all files to review, with changed files first (prioritized by dependencies and impact) followed by external files that may need attention.
|
|
38
|
+
|
|
39
|
+
### Agent: `review-helper`
|
|
40
|
+
|
|
41
|
+
The plugin provides a `review-helper` agent that orchestrates two subagents:
|
|
42
|
+
|
|
43
|
+
- `review-helper:review-order` - Determines optimal file review order
|
|
44
|
+
- `review-helper:impact-explorer` - Finds external code impacted by changes
|
|
29
45
|
|
|
30
46
|
The agent does NOT make up its own recommendations or analysis—it only presents what the tools return. It also does NOT automatically run tests or apply fixes.
|
|
31
47
|
|
|
@@ -77,10 +93,15 @@ The plugin also exposes two tools directly:
|
|
|
77
93
|
|
|
78
94
|
Suggests optimal order to review changed files.
|
|
79
95
|
|
|
96
|
+
Arguments:
|
|
97
|
+
- `files` (optional): Specific files to analyze. If omitted, uses git diff.
|
|
98
|
+
- `instructions` (optional): Custom ordering instructions
|
|
99
|
+
- `impact_data` (optional): Impact analysis results to merge external files into the list
|
|
100
|
+
|
|
80
101
|
Output:
|
|
81
102
|
- Prioritized file list with rationale
|
|
82
103
|
- Dependency graph showing import relationships
|
|
83
|
-
- Scores based on: type priority, dependents count, complexity
|
|
104
|
+
- Scores based on: type priority, dependents count, complexity, external impact
|
|
84
105
|
|
|
85
106
|
### `impact_analysis`
|
|
86
107
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const IMPACT_EXPLORER_DESCRIPTION = "Subagent that analyzes external impact using the impact_analysis tool.";
|
|
2
|
+
export declare const IMPACT_EXPLORER_PROMPT = "You run the impact_analysis tool and return its output.\n\n## Usage\nCall the impact_analysis tool. It will:\n- Find all git-changed files\n- Identify external files that import/use the changed code\n- Report direct consumers and transitive dependencies\n\n## Output\nReturn the tool output verbatim. Do not add commentary.\n\n## Structured Output for Orchestrator\nWhen the orchestrator needs structured data for merging, extract and return:\n\n```json\n{\n \"direct\": [\n { \"file\": \"path/to/consumer.ts\", \"line\": 15, \"type\": \"import\" }\n ],\n \"transitive\": [\n { \"file\": \"path/to/indirect.ts\", \"line\": 42, \"type\": \"via path/to/consumer.ts\" }\n ]\n}\n```";
|
|
3
|
+
export declare const createImpactExplorerAgent: (model: string) => {
|
|
4
|
+
description: string;
|
|
5
|
+
mode: "subagent";
|
|
6
|
+
model: string;
|
|
7
|
+
color: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
tools: {
|
|
10
|
+
impact_analysis: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=impact-explorer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact-explorer.d.ts","sourceRoot":"","sources":["../../src/agents/impact-explorer.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B,2EAA2E,CAAC;AAEpH,eAAO,MAAM,sBAAsB,qrBAuB5B,CAAC;AAER,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM;;;;;;;;;CASrD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export const IMPACT_EXPLORER_DESCRIPTION = `Subagent that analyzes external impact using the impact_analysis tool.`;
|
|
2
|
+
export const IMPACT_EXPLORER_PROMPT = `You run the impact_analysis tool and return its output.
|
|
3
|
+
|
|
4
|
+
## Usage
|
|
5
|
+
Call the impact_analysis tool. It will:
|
|
6
|
+
- Find all git-changed files
|
|
7
|
+
- Identify external files that import/use the changed code
|
|
8
|
+
- Report direct consumers and transitive dependencies
|
|
9
|
+
|
|
10
|
+
## Output
|
|
11
|
+
Return the tool output verbatim. Do not add commentary.
|
|
12
|
+
|
|
13
|
+
## Structured Output for Orchestrator
|
|
14
|
+
When the orchestrator needs structured data for merging, extract and return:
|
|
15
|
+
|
|
16
|
+
\`\`\`json
|
|
17
|
+
{
|
|
18
|
+
"direct": [
|
|
19
|
+
{ "file": "path/to/consumer.ts", "line": 15, "type": "import" }
|
|
20
|
+
],
|
|
21
|
+
"transitive": [
|
|
22
|
+
{ "file": "path/to/indirect.ts", "line": 42, "type": "via path/to/consumer.ts" }
|
|
23
|
+
]
|
|
24
|
+
}
|
|
25
|
+
\`\`\``;
|
|
26
|
+
export const createImpactExplorerAgent = (model) => ({
|
|
27
|
+
description: IMPACT_EXPLORER_DESCRIPTION,
|
|
28
|
+
mode: "subagent",
|
|
29
|
+
model,
|
|
30
|
+
color: "#00CED1",
|
|
31
|
+
prompt: IMPACT_EXPLORER_PROMPT,
|
|
32
|
+
tools: {
|
|
33
|
+
impact_analysis: true,
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
//# sourceMappingURL=impact-explorer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"impact-explorer.js","sourceRoot":"","sources":["../../src/agents/impact-explorer.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,2BAA2B,GAAG,wEAAwE,CAAC;AAEpH,MAAM,CAAC,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;OAuB/B,CAAC;AAER,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC;IAC3D,WAAW,EAAE,2BAA2B;IACxC,IAAI,EAAE,UAAmB;IACzB,KAAK;IACL,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,sBAAsB;IAC9B,KAAK,EAAE;QACL,eAAe,EAAE,IAAI;KACtB;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/agents/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const REVIEW_HELPER_DESCRIPTION = "Comprehensive code reviewer for AI-generated changes. Analyzes:\n- Optimal review order based on file dependencies\n- Impact on code outside the changeset (transitive)\n\nDoes NOT automatically run tests or fix code. For debugging help, explicitly ask.\n\nExamples:\n<example>\nContext: User completed AI-assisted implementation\nuser: \"Review the changes Claude just made\"\nassistant: \"I'll analyze the changes for review order and impact.\"\n</example>\n\n<example>\nContext: Large PR review\nuser: \"What should I look at first in this PR?\"\nassistant: \"I'll determine the optimal review order based on dependencies.\"\n</example>\n\n<example>\nContext: Concern about breaking changes\nuser: \"What else might this break?\"\nassistant: \"I'll analyze transitive impact on code outside these changes.\"\n</example>";
|
|
2
|
+
export declare const REVIEW_HELPER_PROMPT = "You are a code review orchestrator that coordinates subagents to produce a unified review order.\n\n## Workflow\n\nWhen invoked (especially via /review-order), execute this sequence:\n\n### Step 1: Get Initial Review Order\nSpawn the `review-helper:review-order` subagent:\n- It runs the review_order tool on changed files\n- Returns a prioritized file list\n\n### Step 2: Get Impact Analysis\nSpawn the `review-helper:impact-explorer` subagent:\n- It runs the impact_analysis tool\n- Returns external files that depend on the changed code\n\n### Step 3: Get Final Merged Order\nSpawn `review-helper:review-order` again, passing the impact data:\n- Provide the impact analysis results as impact_data argument\n- It merges external files into the list\n- It boosts priority for files with high external impact\n- Returns the final unified review order\n\n### Step 4: Present Results\nOutput ONLY the final merged review order table. Do not add commentary.\n\n## Output Format\n\nPresent a single table:\n\n| # | File | Reason | Score |\n|---|------|--------|-------|\n| 1 | `path/to/file.ts` | Foundation file; 3 external consumers | 85 |\n| 2 | `path/to/other.ts` | Type priority: 7 | 70 |\n| 3 | `external/consumer.ts` *(external)* | External: imports changed code | 25 |\n\nThat's it. One unified table with all files to review.";
|
|
3
|
+
export declare const reviewHelperAgent: {
|
|
4
|
+
description: string;
|
|
5
|
+
mode: "primary";
|
|
6
|
+
color: string;
|
|
7
|
+
prompt: string;
|
|
8
|
+
tools: {
|
|
9
|
+
task: boolean;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=review-helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-helper.d.ts","sourceRoot":"","sources":["../../src/agents/review-helper.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,yBAAyB,0zBAuB3B,CAAC;AAEZ,eAAO,MAAM,oBAAoB,uzCAoCsB,CAAC;AAExD,eAAO,MAAM,iBAAiB;;;;;;;;CAQ7B,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export const REVIEW_HELPER_DESCRIPTION = `Comprehensive code reviewer for AI-generated changes. Analyzes:
|
|
2
|
+
- Optimal review order based on file dependencies
|
|
3
|
+
- Impact on code outside the changeset (transitive)
|
|
4
|
+
|
|
5
|
+
Does NOT automatically run tests or fix code. For debugging help, explicitly ask.
|
|
6
|
+
|
|
7
|
+
Examples:
|
|
8
|
+
<example>
|
|
9
|
+
Context: User completed AI-assisted implementation
|
|
10
|
+
user: "Review the changes Claude just made"
|
|
11
|
+
assistant: "I'll analyze the changes for review order and impact."
|
|
12
|
+
</example>
|
|
13
|
+
|
|
14
|
+
<example>
|
|
15
|
+
Context: Large PR review
|
|
16
|
+
user: "What should I look at first in this PR?"
|
|
17
|
+
assistant: "I'll determine the optimal review order based on dependencies."
|
|
18
|
+
</example>
|
|
19
|
+
|
|
20
|
+
<example>
|
|
21
|
+
Context: Concern about breaking changes
|
|
22
|
+
user: "What else might this break?"
|
|
23
|
+
assistant: "I'll analyze transitive impact on code outside these changes."
|
|
24
|
+
</example>`;
|
|
25
|
+
export const REVIEW_HELPER_PROMPT = `You are a code review orchestrator that coordinates subagents to produce a unified review order.
|
|
26
|
+
|
|
27
|
+
## Workflow
|
|
28
|
+
|
|
29
|
+
When invoked (especially via /review-order), execute this sequence:
|
|
30
|
+
|
|
31
|
+
### Step 1: Get Initial Review Order
|
|
32
|
+
Spawn the \`review-helper:review-order\` subagent:
|
|
33
|
+
- It runs the review_order tool on changed files
|
|
34
|
+
- Returns a prioritized file list
|
|
35
|
+
|
|
36
|
+
### Step 2: Get Impact Analysis
|
|
37
|
+
Spawn the \`review-helper:impact-explorer\` subagent:
|
|
38
|
+
- It runs the impact_analysis tool
|
|
39
|
+
- Returns external files that depend on the changed code
|
|
40
|
+
|
|
41
|
+
### Step 3: Get Final Merged Order
|
|
42
|
+
Spawn \`review-helper:review-order\` again, passing the impact data:
|
|
43
|
+
- Provide the impact analysis results as impact_data argument
|
|
44
|
+
- It merges external files into the list
|
|
45
|
+
- It boosts priority for files with high external impact
|
|
46
|
+
- Returns the final unified review order
|
|
47
|
+
|
|
48
|
+
### Step 4: Present Results
|
|
49
|
+
Output ONLY the final merged review order table. Do not add commentary.
|
|
50
|
+
|
|
51
|
+
## Output Format
|
|
52
|
+
|
|
53
|
+
Present a single table:
|
|
54
|
+
|
|
55
|
+
| # | File | Reason | Score |
|
|
56
|
+
|---|------|--------|-------|
|
|
57
|
+
| 1 | \`path/to/file.ts\` | Foundation file; 3 external consumers | 85 |
|
|
58
|
+
| 2 | \`path/to/other.ts\` | Type priority: 7 | 70 |
|
|
59
|
+
| 3 | \`external/consumer.ts\` *(external)* | External: imports changed code | 25 |
|
|
60
|
+
|
|
61
|
+
That's it. One unified table with all files to review.`;
|
|
62
|
+
export const reviewHelperAgent = {
|
|
63
|
+
description: REVIEW_HELPER_DESCRIPTION,
|
|
64
|
+
mode: "primary",
|
|
65
|
+
color: "#FF6B6B",
|
|
66
|
+
prompt: REVIEW_HELPER_PROMPT,
|
|
67
|
+
tools: {
|
|
68
|
+
task: true,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=review-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-helper.js","sourceRoot":"","sources":["../../src/agents/review-helper.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;WAuB9B,CAAC;AAEZ,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;uDAoCmB,CAAC;AAExD,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,WAAW,EAAE,yBAAyB;IACtC,IAAI,EAAE,SAAkB;IACxB,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,oBAAoB;IAC5B,KAAK,EAAE;QACL,IAAI,EAAE,IAAI;KACX;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const REVIEW_ORDER_DESCRIPTION = "Subagent that determines optimal file review order using the review_order tool.";
|
|
2
|
+
export declare const REVIEW_ORDER_PROMPT = "You run the review_order tool and return its output.\n\n## Basic Usage\nCall the review_order tool with no arguments to analyze git diff.\n\n## With Impact Data\nIf you receive impact_data in your prompt, pass it to the review_order tool:\n\n```\nreview_order({ impact_data: { direct: [...], transitive: [...] } })\n```\n\nThe tool will:\n- Merge external impacted files into the review list\n- Boost priority for files with many external consumers\n- Mark external files appropriately\n\n## Output\nReturn the tool output verbatim. Do not add commentary.";
|
|
3
|
+
export declare const createReviewOrderAgent: (model: string) => {
|
|
4
|
+
description: string;
|
|
5
|
+
mode: "subagent";
|
|
6
|
+
model: string;
|
|
7
|
+
color: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
tools: {
|
|
10
|
+
review_order: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=review-order.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-order.d.ts","sourceRoot":"","sources":["../../src/agents/review-order.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,wBAAwB,oFAAoF,CAAC;AAE1H,eAAO,MAAM,mBAAmB,gjBAkBwB,CAAC;AAEzD,eAAO,MAAM,sBAAsB,GAAI,OAAO,MAAM;;;;;;;;;CASlD,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export const REVIEW_ORDER_DESCRIPTION = `Subagent that determines optimal file review order using the review_order tool.`;
|
|
2
|
+
export const REVIEW_ORDER_PROMPT = `You run the review_order tool and return its output.
|
|
3
|
+
|
|
4
|
+
## Basic Usage
|
|
5
|
+
Call the review_order tool with no arguments to analyze git diff.
|
|
6
|
+
|
|
7
|
+
## With Impact Data
|
|
8
|
+
If you receive impact_data in your prompt, pass it to the review_order tool:
|
|
9
|
+
|
|
10
|
+
\`\`\`
|
|
11
|
+
review_order({ impact_data: { direct: [...], transitive: [...] } })
|
|
12
|
+
\`\`\`
|
|
13
|
+
|
|
14
|
+
The tool will:
|
|
15
|
+
- Merge external impacted files into the review list
|
|
16
|
+
- Boost priority for files with many external consumers
|
|
17
|
+
- Mark external files appropriately
|
|
18
|
+
|
|
19
|
+
## Output
|
|
20
|
+
Return the tool output verbatim. Do not add commentary.`;
|
|
21
|
+
export const createReviewOrderAgent = (model) => ({
|
|
22
|
+
description: REVIEW_ORDER_DESCRIPTION,
|
|
23
|
+
mode: "subagent",
|
|
24
|
+
model,
|
|
25
|
+
color: "#4ECDC4",
|
|
26
|
+
prompt: REVIEW_ORDER_PROMPT,
|
|
27
|
+
tools: {
|
|
28
|
+
review_order: true,
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=review-order.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-order.js","sourceRoot":"","sources":["../../src/agents/review-order.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,wBAAwB,GAAG,iFAAiF,CAAC;AAE1H,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;;;;;;;;wDAkBqB,CAAC;AAEzD,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC;IACxD,WAAW,EAAE,wBAAwB;IACrC,IAAI,EAAE,UAAmB;IACzB,KAAK;IACL,KAAK,EAAE,SAAS;IAChB,MAAM,EAAE,mBAAmB;IAC3B,KAAK,EAAE;QACL,YAAY,EAAE,IAAI;KACnB;CACF,CAAC,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;AAUlD,eAAO,MAAM,kBAAkB,EAAE,MA4BhC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
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
|
+
import { reviewHelperAgent, createReviewOrderAgent, createImpactExplorerAgent, } from "./agents/index.js";
|
|
3
5
|
export const ReviewHelperPlugin = async ({ project, client, $, directory }) => {
|
|
4
6
|
return {
|
|
5
7
|
tool: {
|
|
6
8
|
review_order: reviewOrderTool,
|
|
7
9
|
impact_analysis: impactAnalysisTool,
|
|
8
10
|
},
|
|
11
|
+
config: async (openCodeConfig) => {
|
|
12
|
+
const pluginConfig = await loadConfig(directory);
|
|
13
|
+
const explorerModel = pluginConfig.models?.explorer ?? "google/gemini-3-flash";
|
|
14
|
+
openCodeConfig.agent = {
|
|
15
|
+
...openCodeConfig.agent,
|
|
16
|
+
"review-helper": reviewHelperAgent,
|
|
17
|
+
"review-helper:review-order": createReviewOrderAgent(explorerModel),
|
|
18
|
+
"review-helper:impact-explorer": createImpactExplorerAgent(explorerModel),
|
|
19
|
+
};
|
|
20
|
+
openCodeConfig.command = {
|
|
21
|
+
...openCodeConfig.command,
|
|
22
|
+
"review-order": {
|
|
23
|
+
template: "Run the review-order workflow: get initial file order, analyze impact, then produce final prioritized review order with external impacted files merged in.",
|
|
24
|
+
description: "Get optimal file review order with impact analysis",
|
|
25
|
+
agent: "review-helper",
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
},
|
|
9
29
|
};
|
|
10
30
|
};
|
|
11
31
|
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;AACzC,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,mBAAmB,CAAC;AAE3B,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,iBAAiB;gBAClC,4BAA4B,EAAE,sBAAsB,CAAC,aAAa,CAAC;gBACnE,+BAA+B,EAAE,yBAAyB,CAAC,aAAa,CAAC;aAC1E,CAAC;YAEF,cAAc,CAAC,OAAO,GAAG;gBACvB,GAAG,cAAc,CAAC,OAAO;gBACzB,cAAc,EAAE;oBACd,QAAQ,EAAE,4JAA4J;oBACtK,WAAW,EAAE,oDAAoD;oBACjE,KAAK,EAAE,eAAe;iBACvB;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-order.d.ts","sourceRoot":"","sources":["../../src/tools/review-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;
|
|
1
|
+
{"version":3,"file":"review-order.d.ts","sourceRoot":"","sources":["../../src/tools/review-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAiNrE,eAAO,MAAM,eAAe,EAAE,cAkI5B,CAAC"}
|
|
@@ -81,6 +81,62 @@ function generateReason(fileScore) {
|
|
|
81
81
|
const topReasons = fileScore.reasons.slice(0, 2);
|
|
82
82
|
return topReasons.join("; ");
|
|
83
83
|
}
|
|
84
|
+
function countExternalConsumers(impactData) {
|
|
85
|
+
const counts = new Map();
|
|
86
|
+
const allImpacts = [...(impactData.direct || []), ...(impactData.transitive || [])];
|
|
87
|
+
for (const impact of allImpacts) {
|
|
88
|
+
if (impact.type) {
|
|
89
|
+
const viaMatch = impact.type.match(/via (.+)/);
|
|
90
|
+
if (viaMatch) {
|
|
91
|
+
const viaFile = viaMatch[1];
|
|
92
|
+
counts.set(viaFile, (counts.get(viaFile) || 0) + 1);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return counts;
|
|
97
|
+
}
|
|
98
|
+
function boostScoresForExternalConsumers(scores, externalConsumerCount) {
|
|
99
|
+
const MAX_BOOST = 50;
|
|
100
|
+
const BOOST_PER_CONSUMER = 10;
|
|
101
|
+
for (const score of scores) {
|
|
102
|
+
const consumerCount = externalConsumerCount.get(score.file) || 0;
|
|
103
|
+
if (consumerCount > 0) {
|
|
104
|
+
const boost = Math.min(consumerCount * BOOST_PER_CONSUMER, MAX_BOOST);
|
|
105
|
+
score.score += boost;
|
|
106
|
+
score.reasons.push(`${consumerCount} external consumer(s)`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function addExternalFilesToScores(impactData, changedFileSet, externalScores) {
|
|
111
|
+
const BASE_EXTERNAL_SCORE = 25;
|
|
112
|
+
const seenExternals = new Set();
|
|
113
|
+
const directFiles = impactData.direct || [];
|
|
114
|
+
for (const impact of directFiles) {
|
|
115
|
+
if (changedFileSet.has(impact.file) || seenExternals.has(impact.file))
|
|
116
|
+
continue;
|
|
117
|
+
seenExternals.add(impact.file);
|
|
118
|
+
const directImportCount = directFiles.filter((d) => d.file === impact.file).length;
|
|
119
|
+
const transitiveCount = (impactData.transitive || []).filter((t) => t.file === impact.file).length;
|
|
120
|
+
let score = BASE_EXTERNAL_SCORE;
|
|
121
|
+
const reasons = ["External: imports changed code"];
|
|
122
|
+
if (directImportCount > 1) {
|
|
123
|
+
score += directImportCount * 5;
|
|
124
|
+
reasons.push(`${directImportCount} direct imports`);
|
|
125
|
+
}
|
|
126
|
+
if (transitiveCount > 0) {
|
|
127
|
+
score += 10;
|
|
128
|
+
reasons.push("Also has transitive impact");
|
|
129
|
+
}
|
|
130
|
+
externalScores.push({
|
|
131
|
+
file: impact.file,
|
|
132
|
+
score,
|
|
133
|
+
reasons,
|
|
134
|
+
dependencies: [],
|
|
135
|
+
dependents: [],
|
|
136
|
+
isExternal: true,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
84
140
|
export const reviewOrderTool = tool({
|
|
85
141
|
description: "Analyze changed files and suggest optimal review order based on dependencies, file type priority, and complexity. Returns a prioritized list with rationale for reviewing each file.",
|
|
86
142
|
args: {
|
|
@@ -92,6 +148,27 @@ export const reviewOrderTool = tool({
|
|
|
92
148
|
.string()
|
|
93
149
|
.optional()
|
|
94
150
|
.describe("Additional ordering instructions (e.g., 'review migrations before models')"),
|
|
151
|
+
impact_data: tool.schema
|
|
152
|
+
.object({
|
|
153
|
+
direct: tool.schema
|
|
154
|
+
.array(tool.schema.object({
|
|
155
|
+
file: tool.schema.string(),
|
|
156
|
+
line: tool.schema.number().optional(),
|
|
157
|
+
type: tool.schema.string().optional(),
|
|
158
|
+
}))
|
|
159
|
+
.optional()
|
|
160
|
+
.describe("Direct consumers of changed files"),
|
|
161
|
+
transitive: tool.schema
|
|
162
|
+
.array(tool.schema.object({
|
|
163
|
+
file: tool.schema.string(),
|
|
164
|
+
line: tool.schema.number().optional(),
|
|
165
|
+
type: tool.schema.string().optional(),
|
|
166
|
+
}))
|
|
167
|
+
.optional()
|
|
168
|
+
.describe("Transitive consumers of changed files"),
|
|
169
|
+
})
|
|
170
|
+
.optional()
|
|
171
|
+
.describe("Impact analysis results to merge into review order. External files will be added to the list."),
|
|
95
172
|
},
|
|
96
173
|
async execute(args, ctx) {
|
|
97
174
|
const cwd = process.cwd();
|
|
@@ -108,7 +185,7 @@ export const reviewOrderTool = tool({
|
|
|
108
185
|
else {
|
|
109
186
|
filesToAnalyze = await getChangedFiles(cwd);
|
|
110
187
|
}
|
|
111
|
-
if (filesToAnalyze.length === 0) {
|
|
188
|
+
if (filesToAnalyze.length === 0 && !args.impact_data) {
|
|
112
189
|
return JSON.stringify({
|
|
113
190
|
order: [],
|
|
114
191
|
dependency_graph: {},
|
|
@@ -117,8 +194,19 @@ export const reviewOrderTool = tool({
|
|
|
117
194
|
}
|
|
118
195
|
const dependencyGraph = await buildDependencyGraph(filesToAnalyze.map((f) => f.file), cwd);
|
|
119
196
|
const scores = computeScores(filesToAnalyze, dependencyGraph, config.review_order.type_priority);
|
|
197
|
+
const impactData = args.impact_data;
|
|
198
|
+
const externalScores = [];
|
|
199
|
+
const changedFileSet = new Set(filesToAnalyze.map((f) => f.file));
|
|
200
|
+
if (impactData) {
|
|
201
|
+
const externalConsumerCount = countExternalConsumers(impactData);
|
|
202
|
+
boostScoresForExternalConsumers(scores, externalConsumerCount);
|
|
203
|
+
addExternalFilesToScores(impactData, changedFileSet, externalScores);
|
|
204
|
+
scores.sort((a, b) => b.score - a.score);
|
|
205
|
+
externalScores.sort((a, b) => b.score - a.score);
|
|
206
|
+
}
|
|
207
|
+
const allScores = [...scores, ...externalScores];
|
|
120
208
|
const result = {
|
|
121
|
-
order:
|
|
209
|
+
order: allScores.map((s, i) => ({
|
|
122
210
|
rank: i + 1,
|
|
123
211
|
file: s.file,
|
|
124
212
|
reason: generateReason(s),
|
|
@@ -127,10 +215,15 @@ export const reviewOrderTool = tool({
|
|
|
127
215
|
dependency_graph: Object.fromEntries(dependencyGraph),
|
|
128
216
|
};
|
|
129
217
|
let output = "## Review Order\n\n";
|
|
218
|
+
if (impactData) {
|
|
219
|
+
output += "_Includes external files impacted by changes_\n\n";
|
|
220
|
+
}
|
|
130
221
|
output += "| # | File | Reason | Score |\n";
|
|
131
222
|
output += "|---|------|--------|-------|\n";
|
|
132
|
-
for (
|
|
133
|
-
|
|
223
|
+
for (let i = 0; i < allScores.length; i++) {
|
|
224
|
+
const score = allScores[i];
|
|
225
|
+
const marker = score.isExternal ? " *(external)*" : "";
|
|
226
|
+
output += `| ${i + 1} | \`${score.file}\`${marker} | ${generateReason(score)} | ${score.score} |\n`;
|
|
134
227
|
}
|
|
135
228
|
if (Object.keys(result.dependency_graph).length > 0) {
|
|
136
229
|
output += "\n## Dependency Graph\n\n";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-order.js","sourceRoot":"","sources":["../../src/tools/review-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAuB,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAoB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAW,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"review-order.js","sourceRoot":"","sources":["../../src/tools/review-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAuB,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,eAAe,EAAoB,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAW,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAgCvD,SAAS,mBAAmB,CAAC,IAAY,EAAE,YAAsB;IAC/D,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACrC,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,WAAW,EAAE,CAAC;IAE/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7C,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;QAC3C,IACE,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC;YACxB,IAAI,CAAC,QAAQ,CA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OAAO,IAAI,eAAe,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;gBACjF,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC;YACtB,MAAM,IAAI,gDAAgD,IAAI,CAAC,YAAY,KAAK,CAAC;YACjF,MAAM,IAAI,yFAAyF,CAAC;QACtG,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-review-helper",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.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
|