opencode-magi 0.0.0-dev-20260522220322 → 0.0.0-dev-20260522220355
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/dist/github/commands.js +75 -13
- package/package.json +1 -1
package/dist/github/commands.js
CHANGED
|
@@ -392,19 +392,43 @@ export async function removeIssueLabels(exec, repository, issue, labels, account
|
|
|
392
392
|
return removed;
|
|
393
393
|
}
|
|
394
394
|
export async function fetchPullRequestReviews(exec, repository, pr) {
|
|
395
|
-
const query = `query($owner: String!, $repo: String!, $pr: Int
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
395
|
+
const query = `query($owner: String!, $repo: String!, $pr: Int!, $cursor: String) { repository(owner: $owner, name: $repo) { pullRequest(number: $pr) { reviews(first: 100, after: $cursor) { nodes { author { login } submittedAt state body commit { oid } comments(first: 100) { nodes { body path line startLine } } } pageInfo { hasNextPage endCursor } } } } }`;
|
|
396
|
+
const reviews = [];
|
|
397
|
+
let cursor;
|
|
398
|
+
for (;;) {
|
|
399
|
+
const cursorFlag = cursor ? ` -F cursor=${shellQuote(cursor)}` : "";
|
|
400
|
+
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}${cursorFlag}`);
|
|
401
|
+
const data = JSON.parse(raw);
|
|
402
|
+
const connection = data.data.repository.pullRequest.reviews;
|
|
403
|
+
reviews.push(...connection.nodes);
|
|
404
|
+
if (!connection.pageInfo?.hasNextPage)
|
|
405
|
+
break;
|
|
406
|
+
cursor = connection.pageInfo.endCursor;
|
|
407
|
+
if (!cursor)
|
|
408
|
+
throw new Error("GitHub reviews page was truncated");
|
|
409
|
+
}
|
|
410
|
+
return reviews.map((review) => ({
|
|
399
411
|
...review,
|
|
400
412
|
comments: review.comments?.nodes ?? [],
|
|
401
413
|
}));
|
|
402
414
|
}
|
|
403
415
|
export async function fetchPullRequestCommits(exec, repository, pr) {
|
|
404
|
-
const query = `query($owner: String!, $repo: String!, $pr: Int
|
|
405
|
-
const
|
|
406
|
-
|
|
407
|
-
|
|
416
|
+
const query = `query($owner: String!, $repo: String!, $pr: Int!, $cursor: String) { repository(owner: $owner, name: $repo) { pullRequest(number: $pr) { commits(first: 100, after: $cursor) { nodes { commit { oid committedDate parents { totalCount } } } pageInfo { hasNextPage endCursor } } } } }`;
|
|
417
|
+
const commits = [];
|
|
418
|
+
let cursor;
|
|
419
|
+
for (;;) {
|
|
420
|
+
const cursorFlag = cursor ? ` -F cursor=${shellQuote(cursor)}` : "";
|
|
421
|
+
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}${cursorFlag}`);
|
|
422
|
+
const data = JSON.parse(raw);
|
|
423
|
+
const connection = data.data.repository.pullRequest.commits;
|
|
424
|
+
commits.push(...connection.nodes);
|
|
425
|
+
if (!connection.pageInfo?.hasNextPage)
|
|
426
|
+
break;
|
|
427
|
+
cursor = connection.pageInfo.endCursor;
|
|
428
|
+
if (!cursor)
|
|
429
|
+
throw new Error("GitHub commits page was truncated");
|
|
430
|
+
}
|
|
431
|
+
return commits.map(({ commit }) => ({
|
|
408
432
|
committedDate: commit.committedDate,
|
|
409
433
|
oid: commit.oid,
|
|
410
434
|
parentCount: commit.parents.totalCount,
|
|
@@ -664,11 +688,49 @@ export async function configureGitIdentity(exec, worktreePath, identity) {
|
|
|
664
688
|
}
|
|
665
689
|
}
|
|
666
690
|
export async function fetchUnresolvedThreads(exec, repository, pr, author) {
|
|
667
|
-
const
|
|
668
|
-
const
|
|
669
|
-
const
|
|
670
|
-
|
|
671
|
-
|
|
691
|
+
const threadQuery = `query($owner: String!, $repo: String!, $pr: Int!, $cursor: String) { repository(owner: $owner, name: $repo) { pullRequest(number: $pr) { reviewThreads(first: 100, after: $cursor) { nodes { id isResolved comments(first: 100) { nodes { databaseId author { login } path line body createdAt } pageInfo { hasNextPage endCursor } } } pageInfo { hasNextPage endCursor } } } } }`;
|
|
692
|
+
const commentQuery = `query($threadId: ID!, $cursor: String) { node(id: $threadId) { ... on PullRequestReviewThread { comments(first: 100, after: $cursor) { nodes { databaseId author { login } path line body createdAt } pageInfo { hasNextPage endCursor } } } } }`;
|
|
693
|
+
const threads = [];
|
|
694
|
+
let cursor;
|
|
695
|
+
async function fetchRemainingComments(threadId, initialCursor) {
|
|
696
|
+
const comments = [];
|
|
697
|
+
let commentsCursor = initialCursor;
|
|
698
|
+
for (;;) {
|
|
699
|
+
const raw = await exec(`gh api${ghHostOption(repository)} graphql -f query=${shellQuote(commentQuery)} -F threadId=${shellQuote(threadId)} -F cursor=${shellQuote(commentsCursor)}`);
|
|
700
|
+
const data = JSON.parse(raw);
|
|
701
|
+
const connection = data.data.node?.comments;
|
|
702
|
+
if (!connection)
|
|
703
|
+
throw new Error("GitHub review thread comments were missing");
|
|
704
|
+
comments.push(...connection.nodes);
|
|
705
|
+
if (!connection.pageInfo?.hasNextPage)
|
|
706
|
+
break;
|
|
707
|
+
const nextCursor = connection.pageInfo.endCursor;
|
|
708
|
+
if (!nextCursor)
|
|
709
|
+
throw new Error("GitHub review thread comments page was truncated");
|
|
710
|
+
commentsCursor = nextCursor;
|
|
711
|
+
}
|
|
712
|
+
return comments;
|
|
713
|
+
}
|
|
714
|
+
for (;;) {
|
|
715
|
+
const cursorFlag = cursor ? ` -F cursor=${shellQuote(cursor)}` : "";
|
|
716
|
+
const raw = await exec(`gh api${ghHostOption(repository)} graphql -f query=${shellQuote(threadQuery)} -F owner=${shellQuote(repository.github.owner)} -F repo=${shellQuote(repository.github.repo)} -F pr=${pr}${cursorFlag}`);
|
|
717
|
+
const data = JSON.parse(raw);
|
|
718
|
+
const connection = data.data.repository.pullRequest.reviewThreads;
|
|
719
|
+
for (const thread of connection.nodes) {
|
|
720
|
+
const commentsCursor = thread.comments.pageInfo?.endCursor;
|
|
721
|
+
if (thread.comments.pageInfo?.hasNextPage) {
|
|
722
|
+
if (!commentsCursor)
|
|
723
|
+
throw new Error("GitHub review thread comments page was truncated");
|
|
724
|
+
thread.comments.nodes.push(...(await fetchRemainingComments(thread.id, commentsCursor)));
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
threads.push(...connection.nodes);
|
|
728
|
+
if (!connection.pageInfo?.hasNextPage)
|
|
729
|
+
break;
|
|
730
|
+
cursor = connection.pageInfo.endCursor;
|
|
731
|
+
if (!cursor)
|
|
732
|
+
throw new Error("GitHub review threads page was truncated");
|
|
733
|
+
}
|
|
672
734
|
return threads.flatMap((thread) => {
|
|
673
735
|
if (thread.isResolved || !thread.comments.nodes.length)
|
|
674
736
|
return [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-magi",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260522220355",
|
|
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>",
|