opencode-magi 0.0.0-dev-20260522104834 → 0.0.0-dev-20260522105233

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.
@@ -330,10 +330,13 @@ export async function removeIssueLabels(exec, repository, issue, labels, account
330
330
  return removed;
331
331
  }
332
332
  export async function fetchPullRequestReviews(exec, repository, pr) {
333
- const query = `query($owner: String!, $repo: String!, $pr: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $pr) { reviews(first: 100) { nodes { author { login } submittedAt state body commit { oid } } } } } }`;
333
+ const query = `query($owner: String!, $repo: String!, $pr: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $pr) { reviews(first: 100) { nodes { author { login } submittedAt state body commit { oid } comments(first: 100) { nodes { body path line startLine } } } } } } }`;
334
334
  const raw = await exec(`gh api${ghHostOption(repository)} graphql -f query=${shellQuote(query)} -F owner=${shellQuote(repository.github.owner)} -F repo=${shellQuote(repository.github.repo)} -F pr=${pr}`);
335
335
  const data = JSON.parse(raw);
336
- return data.data.repository.pullRequest.reviews.nodes;
336
+ return data.data.repository.pullRequest.reviews.nodes.map((review) => ({
337
+ ...review,
338
+ comments: review.comments?.nodes ?? [],
339
+ }));
337
340
  }
338
341
  export async function fetchPullRequestCommits(exec, repository, pr) {
339
342
  const query = `query($owner: String!, $repo: String!, $pr: Int!) { repository(owner: $owner, name: $repo) { pullRequest(number: $pr) { commits(first: 100) { nodes { commit { oid committedDate parents { totalCount } } } } } } }`;
@@ -182,10 +182,42 @@ function reviewFindingsFromBody(body) {
182
182
  }
183
183
  return { findings };
184
184
  }
185
+ function parsePostedFindingComment(body) {
186
+ const match = /^\*\*Issue:\*\*\s*([\s\S]*?)\s*\r?\n\r?\n\*\*Fix:\*\*\s*([\s\S]+?)\s*$/.exec(body);
187
+ if (!match)
188
+ return undefined;
189
+ return {
190
+ fix: match[2]?.trim() || "Please address this before merging.",
191
+ issue: match[1]?.trim() || "Review finding.",
192
+ };
193
+ }
194
+ function reviewFindingsFromComments(comments) {
195
+ return {
196
+ findings: (comments ?? []).flatMap((comment) => {
197
+ if (comment.line == null)
198
+ return [];
199
+ const parsed = parsePostedFindingComment(comment.body);
200
+ if (!parsed)
201
+ return [];
202
+ return [
203
+ {
204
+ ...parsed,
205
+ line: comment.line,
206
+ path: comment.path,
207
+ startLine: comment.startLine ?? undefined,
208
+ },
209
+ ];
210
+ }),
211
+ };
212
+ }
185
213
  export function reviewOutputFromState(review) {
186
214
  const verdict = reviewStateToVerdict(review.state);
187
- if (verdict === "CHANGES_REQUESTED")
215
+ if (verdict === "CHANGES_REQUESTED") {
216
+ const fromComments = reviewFindingsFromComments(review.comments);
217
+ if (fromComments.findings.length)
218
+ return { ...fromComments, verdict };
188
219
  return { ...reviewFindingsFromBody(review.body), verdict };
220
+ }
189
221
  return verdict === "CLOSE"
190
222
  ? {
191
223
  findings: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-magi",
3
- "version": "0.0.0-dev-20260522104834",
3
+ "version": "0.0.0-dev-20260522105233",
4
4
  "description": "Multi-agent PR review and merge orchestration plugin for OpenCode.",
5
5
  "license": "MIT",
6
6
  "author": "Hirotomo Yamada <hirotomo.yamada@avap.co.jp>",