opencode-magi 0.0.0-dev-20260519012916 → 0.0.0-dev-20260519013159
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
CHANGED
|
@@ -41,7 +41,7 @@ async function withWorktreeCreateLock(key, run) {
|
|
|
41
41
|
async function checkoutPullRequestWithRetry(exec, repository, pr, worktreePath) {
|
|
42
42
|
for (let attempt = 0;; attempt += 1) {
|
|
43
43
|
try {
|
|
44
|
-
await exec(`gh pr checkout ${pr} --repo ${shellQuote(repoSpecifier(repository))}`, {
|
|
44
|
+
await exec(`gh pr checkout ${pr} --repo ${shellQuote(repoSpecifier(repository))} --detach`, {
|
|
45
45
|
cwd: worktreePath,
|
|
46
46
|
});
|
|
47
47
|
return;
|
|
@@ -70,6 +70,9 @@ export function repoSpecifier(repository) {
|
|
|
70
70
|
? repoSlug(repository)
|
|
71
71
|
: `${host}/${repoSlug(repository)}`;
|
|
72
72
|
}
|
|
73
|
+
function repositoryGitUrl(repository, owner, repo) {
|
|
74
|
+
return `https://${githubHost(repository)}/${owner}/${repo}.git`;
|
|
75
|
+
}
|
|
73
76
|
export function ghHostOption(repository) {
|
|
74
77
|
const host = githubHost(repository);
|
|
75
78
|
return host === "github.com" ? "" : ` --hostname ${shellQuote(host)}`;
|
|
@@ -78,7 +81,7 @@ export async function ghToken(exec, repository, account) {
|
|
|
78
81
|
return (await exec(`gh auth token${ghHostOption(repository)} --user ${shellQuote(account)}`)).trim();
|
|
79
82
|
}
|
|
80
83
|
export async function fetchPullRequest(exec, repository, pr) {
|
|
81
|
-
const json = await exec(`gh pr view ${pr} --repo ${shellQuote(repoSpecifier(repository))} --json number,title,url,isDraft,baseRefOid,headRefOid,baseRefName,headRefName`);
|
|
84
|
+
const json = await exec(`gh pr view ${pr} --repo ${shellQuote(repoSpecifier(repository))} --json number,title,url,isDraft,baseRefOid,headRefOid,baseRefName,headRefName,headRepository,headRepositoryOwner`);
|
|
82
85
|
return JSON.parse(json);
|
|
83
86
|
}
|
|
84
87
|
export async function fetchPullRequestReviews(exec, repository, pr) {
|
|
@@ -318,9 +321,10 @@ export async function closePullRequest(exec, repository, pr, account) {
|
|
|
318
321
|
const token = await ghToken(exec, repository, account);
|
|
319
322
|
return exec(`GH_TOKEN=${shellQuote(token)} gh pr close ${pr} --repo ${shellQuote(repoSpecifier(repository))}`);
|
|
320
323
|
}
|
|
321
|
-
export async function pushHead(exec, repository, worktreePath, account) {
|
|
324
|
+
export async function pushHead(exec, repository, worktreePath, account, head) {
|
|
322
325
|
const token = await ghToken(exec, repository, account);
|
|
323
|
-
|
|
326
|
+
const url = repositoryGitUrl(repository, head.owner, head.repo);
|
|
327
|
+
await exec(`git -c credential.helper= -c credential.helper=${shellQuote(`!f() { echo username=x-access-token; echo password=${token}; }; f`)} push ${shellQuote(url)} ${shellQuote(`HEAD:refs/heads/${head.ref}`)}`, { cwd: worktreePath });
|
|
324
328
|
}
|
|
325
329
|
export async function configureGitIdentity(exec, worktreePath, identity) {
|
|
326
330
|
if (identity.name) {
|
|
@@ -109,7 +109,13 @@ async function runEditor(input, worktreePath, cycle, unresolvedThreads) {
|
|
|
109
109
|
await input.onProgress?.({ cycle, type: "editor_completed" });
|
|
110
110
|
if (!input.dryRun) {
|
|
111
111
|
if (result.value.mode === "EDITED") {
|
|
112
|
-
await
|
|
112
|
+
const meta = await fetchPullRequest(input.exec, input.repository, input.pr);
|
|
113
|
+
const headOwner = meta.headRepositoryOwner?.login;
|
|
114
|
+
const headRepo = meta.headRepository?.name;
|
|
115
|
+
if (!headOwner || !headRepo) {
|
|
116
|
+
throw new Error("Pull request head repository is missing");
|
|
117
|
+
}
|
|
118
|
+
await pushHead(input.exec, input.repository, worktreePath, editor.account, { owner: headOwner, ref: meta.headRefName, repo: headRepo });
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
throwIfAborted(input.signal);
|
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-20260519013159",
|
|
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>",
|