opencode-magi 0.0.0-dev-20260520190626 → 0.0.0-dev-20260520193633
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/config/resolve.js +2 -0
- package/dist/config/validate.js +15 -1
- package/dist/index.js +11 -3
- package/dist/orchestrator/run-manager.js +31 -0
- package/dist/orchestrator/triage.js +1 -0
- package/package.json +1 -1
- package/schema.json +2 -0
package/dist/config/resolve.js
CHANGED
|
@@ -184,6 +184,8 @@ export function resolveRepository(config) {
|
|
|
184
184
|
clear: config.triage?.automation?.clear ?? ["triage"],
|
|
185
185
|
close: config.triage?.automation?.close ?? false,
|
|
186
186
|
create: config.triage?.automation?.create ?? false,
|
|
187
|
+
merge: config.triage?.automation?.merge ?? false,
|
|
188
|
+
review: config.triage?.automation?.review ?? false,
|
|
187
189
|
},
|
|
188
190
|
categories: resolveTriageCategories(config),
|
|
189
191
|
concurrency: {
|
package/dist/config/validate.js
CHANGED
|
@@ -99,7 +99,13 @@ const AUTOMATION_KEYS = new Set(["close", "merge"]);
|
|
|
99
99
|
const CLEAR_KEYS = new Set(["branch", "output", "session", "worktree"]);
|
|
100
100
|
const CONCURRENCY_KEYS = new Set(["reviewers", "runs"]);
|
|
101
101
|
const OUTPUT_KEYS = new Set(["repairAttempts"]);
|
|
102
|
-
const TRIAGE_AUTOMATION_KEYS = new Set([
|
|
102
|
+
const TRIAGE_AUTOMATION_KEYS = new Set([
|
|
103
|
+
"clear",
|
|
104
|
+
"close",
|
|
105
|
+
"create",
|
|
106
|
+
"merge",
|
|
107
|
+
"review",
|
|
108
|
+
]);
|
|
103
109
|
const TRIAGE_CATEGORY_KEYS = new Set(["description", "id", "labels", "types"]);
|
|
104
110
|
const TRIAGE_CONCURRENCY_KEYS = new Set(["runs"]);
|
|
105
111
|
const TRIAGE_SAFETY_KEYS = new Set([
|
|
@@ -634,7 +640,15 @@ function validateTriage(config, errors, options) {
|
|
|
634
640
|
validateKnownKeys(automation, "triage.automation", TRIAGE_AUTOMATION_KEYS, errors);
|
|
635
641
|
validateBoolean(automation?.close, "triage.automation.close", errors);
|
|
636
642
|
validateBoolean(automation?.create, "triage.automation.create", errors);
|
|
643
|
+
validateBoolean(automation?.merge, "triage.automation.merge", errors);
|
|
644
|
+
validateBoolean(automation?.review, "triage.automation.review", errors);
|
|
637
645
|
validateStringArray(automation?.clear, "triage.automation.clear", errors);
|
|
646
|
+
if (automation?.review && !automation.create) {
|
|
647
|
+
errors.push("triage.automation.review requires triage.automation.create to be true");
|
|
648
|
+
}
|
|
649
|
+
if (automation?.merge && !automation.create) {
|
|
650
|
+
errors.push("triage.automation.merge requires triage.automation.create to be true");
|
|
651
|
+
}
|
|
638
652
|
validateKnownKeys(concurrency, "triage.concurrency", TRIAGE_CONCURRENCY_KEYS, errors);
|
|
639
653
|
if (concurrency?.runs != null &&
|
|
640
654
|
(typeof concurrency.runs !== "number" ||
|
package/dist/index.js
CHANGED
|
@@ -170,11 +170,17 @@ export function parseIssueRunArguments(value, dryRun = false) {
|
|
|
170
170
|
case "--no-create":
|
|
171
171
|
setConfigOverride(configOverrides, ["triage", "automation", "create"], token === "--create");
|
|
172
172
|
break;
|
|
173
|
-
case "--
|
|
174
|
-
|
|
173
|
+
case "--review":
|
|
174
|
+
case "--no-review":
|
|
175
|
+
setConfigOverride(configOverrides, ["triage", "automation", "review"], token === "--review");
|
|
175
176
|
break;
|
|
176
177
|
case "--merge":
|
|
177
178
|
case "--no-merge":
|
|
179
|
+
setConfigOverride(configOverrides, ["triage", "automation", "merge"], token === "--merge");
|
|
180
|
+
break;
|
|
181
|
+
case "--run-concurrency":
|
|
182
|
+
setConfigOverride(configOverrides, ["triage", "concurrency", "runs"], parseIntegerFlag(nextFlagValue(tokens, ++index, token), token, 1));
|
|
183
|
+
break;
|
|
178
184
|
case "--max-cycles":
|
|
179
185
|
case "--retry-failed-jobs":
|
|
180
186
|
case "--reviewer-concurrency":
|
|
@@ -507,7 +513,9 @@ export const MagiPlugin = async ({ client, directory }) => {
|
|
|
507
513
|
directory,
|
|
508
514
|
exec: retryingExec,
|
|
509
515
|
modelCatalog: await modelCatalog(),
|
|
510
|
-
|
|
516
|
+
requireEditor: config.triage?.automation?.merge === true,
|
|
517
|
+
requireReview: config.triage?.automation?.review === true ||
|
|
518
|
+
config.triage?.automation?.merge === true,
|
|
511
519
|
requireTriage: true,
|
|
512
520
|
});
|
|
513
521
|
if (!validation.ok)
|
|
@@ -89,6 +89,13 @@ function prUrl(repository, pr) {
|
|
|
89
89
|
const host = repository.github.host || "github.com";
|
|
90
90
|
return `https://${host}/${repository.github.owner}/${repository.github.repo}/pull/${pr}`;
|
|
91
91
|
}
|
|
92
|
+
function pullRequestNumberFromUrl(url) {
|
|
93
|
+
const match = url.match(/(?:^|\/)pull\/(\d+)(?:[/?#].*)?$/);
|
|
94
|
+
if (!match)
|
|
95
|
+
return undefined;
|
|
96
|
+
const pr = Number.parseInt(match[1], 10);
|
|
97
|
+
return Number.isInteger(pr) && pr > 0 ? pr : undefined;
|
|
98
|
+
}
|
|
92
99
|
function issueUrl(repository, issue) {
|
|
93
100
|
const host = repository.github.host || "github.com";
|
|
94
101
|
return `https://${host}/${repository.github.owner}/${repository.github.repo}/issues/${issue}`;
|
|
@@ -1335,6 +1342,30 @@ export class MagiRunManager {
|
|
|
1335
1342
|
"",
|
|
1336
1343
|
result.report,
|
|
1337
1344
|
].join("\n"), { reply: true });
|
|
1345
|
+
const followUpPr = result.prUrl
|
|
1346
|
+
? pullRequestNumberFromUrl(result.prUrl)
|
|
1347
|
+
: undefined;
|
|
1348
|
+
const triageAutomation = input.repository.triage?.automation;
|
|
1349
|
+
if (followUpPr != null && triageAutomation?.merge) {
|
|
1350
|
+
await this.startMerge({
|
|
1351
|
+
config: input.config,
|
|
1352
|
+
dryRun: input.dryRun,
|
|
1353
|
+
parentSessionId: input.parentSessionId,
|
|
1354
|
+
pr: followUpPr,
|
|
1355
|
+
repository: input.repository,
|
|
1356
|
+
signal: input.signal,
|
|
1357
|
+
});
|
|
1358
|
+
}
|
|
1359
|
+
else if (followUpPr != null && triageAutomation?.review) {
|
|
1360
|
+
await this.startReview({
|
|
1361
|
+
config: input.config,
|
|
1362
|
+
dryRun: input.dryRun,
|
|
1363
|
+
parentSessionId: input.parentSessionId,
|
|
1364
|
+
pr: followUpPr,
|
|
1365
|
+
repository: input.repository,
|
|
1366
|
+
signal: input.signal,
|
|
1367
|
+
});
|
|
1368
|
+
}
|
|
1338
1369
|
this.active.delete(input.runId);
|
|
1339
1370
|
this.controllers.delete(input.runId);
|
|
1340
1371
|
}
|
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-20260520193633",
|
|
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>",
|
package/schema.json
CHANGED
|
@@ -225,6 +225,8 @@
|
|
|
225
225
|
"properties": {
|
|
226
226
|
"close": { "type": "boolean", "default": false },
|
|
227
227
|
"create": { "type": "boolean", "default": false },
|
|
228
|
+
"review": { "type": "boolean", "default": false },
|
|
229
|
+
"merge": { "type": "boolean", "default": false },
|
|
228
230
|
"clear": {
|
|
229
231
|
"type": "array",
|
|
230
232
|
"items": { "type": "string" },
|