opencode-magi 0.1.0 → 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.
Files changed (43) hide show
  1. package/README.md +33 -10
  2. package/dist/commands.js +4 -0
  3. package/dist/config/output.js +11 -2
  4. package/dist/config/resolve.js +124 -26
  5. package/dist/config/validate.js +486 -191
  6. package/dist/config/worktree.js +19 -0
  7. package/dist/github/commands.js +349 -17
  8. package/dist/index.js +257 -27
  9. package/dist/orchestrator/ci.js +1 -1
  10. package/dist/orchestrator/findings.js +4 -3
  11. package/dist/orchestrator/inline-comments.js +73 -0
  12. package/dist/orchestrator/majority.js +14 -0
  13. package/dist/orchestrator/merge.js +24 -4
  14. package/dist/orchestrator/report.js +15 -1
  15. package/dist/orchestrator/review-context.js +309 -0
  16. package/dist/orchestrator/review.js +78 -10
  17. package/dist/orchestrator/run-manager.js +418 -20
  18. package/dist/orchestrator/triage.js +1119 -0
  19. package/dist/permissions/editor.json +8 -1
  20. package/dist/prompts/compose.js +172 -15
  21. package/dist/prompts/contracts.js +119 -12
  22. package/dist/prompts/output.js +149 -14
  23. package/dist/prompts/templates/{close-reconsideration.md → review/close-reconsideration.md} +1 -2
  24. package/dist/prompts/templates/review/review.md +13 -0
  25. package/dist/prompts/templates/triage/acceptance.md +7 -0
  26. package/dist/prompts/templates/triage/action.md +5 -0
  27. package/dist/prompts/templates/triage/category.md +10 -0
  28. package/dist/prompts/templates/triage/comment-classification.md +7 -0
  29. package/dist/prompts/templates/triage/comment.md +5 -0
  30. package/dist/prompts/templates/triage/create.md +7 -0
  31. package/dist/prompts/templates/triage/duplicate.md +7 -0
  32. package/dist/prompts/templates/triage/existing-pr.md +7 -0
  33. package/dist/prompts/templates/triage/question.md +5 -0
  34. package/dist/prompts/templates/triage/reconsider.md +5 -0
  35. package/package.json +28 -27
  36. package/schema.json +234 -90
  37. package/dist/prompts/templates/rereview-close-reconsideration.md +0 -6
  38. package/dist/prompts/templates/review.md +0 -7
  39. /package/dist/prompts/templates/{ci-classification-after-edit.md → merge/ci-classification.md} +0 -0
  40. /package/dist/prompts/templates/{edit.md → merge/edit.md} +0 -0
  41. /package/dist/prompts/templates/{ci-classification.md → review/ci-classification.md} +0 -0
  42. /package/dist/prompts/templates/{finding-validation.md → review/finding-validation.md} +0 -0
  43. /package/dist/prompts/templates/{rereview.md → review/rereview.md} +0 -0
package/schema.json CHANGED
@@ -5,13 +5,11 @@
5
5
  "additionalProperties": false,
6
6
  "properties": {
7
7
  "$schema": { "type": "string" },
8
- "agents": { "$ref": "#/$defs/agents" },
9
- "automation": {
8
+ "agents": {
10
9
  "type": "object",
11
10
  "additionalProperties": false,
12
11
  "properties": {
13
- "merge": { "type": "boolean", "default": true },
14
- "close": { "type": "boolean", "default": true }
12
+ "permissions": { "$ref": "#/$defs/permissions" }
15
13
  }
16
14
  },
17
15
  "clear": {
@@ -24,24 +22,6 @@
24
22
  "branch": { "type": "boolean", "default": true }
25
23
  }
26
24
  },
27
- "checks": {
28
- "type": "object",
29
- "additionalProperties": false,
30
- "properties": {
31
- "exclude": { "type": "array", "items": { "type": "string" } },
32
- "waitAfterEdit": { "type": "boolean" },
33
- "waitBeforeReview": { "type": "boolean" },
34
- "retryFailedJobs": { "type": "integer", "minimum": 0, "default": 3 }
35
- }
36
- },
37
- "concurrency": {
38
- "type": "object",
39
- "additionalProperties": false,
40
- "properties": {
41
- "runs": { "type": "integer", "minimum": 1, "default": 3 },
42
- "reviewers": { "type": "integer", "minimum": 1, "default": 3 }
43
- }
44
- },
45
25
  "github": {
46
26
  "type": "object",
47
27
  "required": ["owner", "repo"],
@@ -59,81 +39,72 @@
59
39
  }
60
40
  },
61
41
  "language": { "type": "string" },
62
- "merge": {
63
- "type": "object",
64
- "additionalProperties": false,
65
- "properties": {
66
- "approvalPolicy": {
67
- "enum": ["majority", "unanimous"],
68
- "default": "majority"
69
- },
70
- "method": { "enum": ["merge", "squash", "rebase"] },
71
- "auto": { "type": "boolean" },
72
- "deleteBranch": { "type": "boolean" },
73
- "mergeQueue": { "type": "boolean", "default": false },
74
- "maxThreadResolutionCycles": {
75
- "type": "integer",
76
- "minimum": 0,
77
- "default": 5,
78
- "description": "Maximum resolution attempts per unresolved review thread. Set 0 for unlimited attempts."
79
- }
80
- }
81
- },
42
+ "merge": { "$ref": "#/$defs/merge" },
82
43
  "output": {
83
44
  "type": "object",
84
45
  "additionalProperties": false,
85
46
  "properties": {
86
- "dirs": {
87
- "type": "object",
88
- "additionalProperties": false,
89
- "properties": {
90
- "pr": { "type": "string" }
91
- }
92
- },
93
47
  "repairAttempts": { "type": "integer", "minimum": 0, "default": 3 }
94
48
  }
95
49
  },
96
- "prompts": { "$ref": "#/$defs/prompts" },
97
- "safety": {
50
+ "review": { "$ref": "#/$defs/review" },
51
+ "triage": { "$ref": "#/$defs/triage" }
52
+ },
53
+ "$defs": {
54
+ "reviewer": {
98
55
  "type": "object",
56
+ "required": ["model", "account"],
99
57
  "additionalProperties": false,
100
58
  "properties": {
101
- "allowAuthors": { "type": "array", "items": { "type": "string" } },
102
- "blockedPaths": { "type": "array", "items": { "type": "string" } },
103
- "maxChangedFiles": { "type": "integer", "minimum": 0 },
104
- "requiredLabels": { "type": "array", "items": { "type": "string" } }
59
+ "id": { "type": "string", "pattern": "^[A-Za-z0-9_-]+$" },
60
+ "model": { "type": "string", "minLength": 1 },
61
+ "options": { "type": "object", "additionalProperties": true },
62
+ "account": { "type": "string", "minLength": 1 },
63
+ "permissions": { "$ref": "#/$defs/permissions" },
64
+ "persona": { "type": "string" }
105
65
  }
106
66
  },
107
- "worktree": {
67
+ "editor": {
108
68
  "type": "object",
69
+ "required": ["model", "account", "author"],
109
70
  "additionalProperties": false,
110
71
  "properties": {
111
- "dir": { "type": "string" }
72
+ "model": { "type": "string", "minLength": 1 },
73
+ "options": { "type": "object", "additionalProperties": true },
74
+ "account": { "type": "string", "minLength": 1 },
75
+ "author": {
76
+ "type": "object",
77
+ "required": ["name", "email"],
78
+ "additionalProperties": false,
79
+ "properties": {
80
+ "name": { "type": "string", "minLength": 1 },
81
+ "email": { "type": "string", "minLength": 1 }
82
+ }
83
+ },
84
+ "permissions": { "$ref": "#/$defs/permissions" },
85
+ "persona": { "type": "string" }
112
86
  }
113
- }
114
- },
115
- "$defs": {
116
- "reviewer": {
87
+ },
88
+ "triageAgent": {
117
89
  "type": "object",
118
- "required": ["model", "account"],
90
+ "required": ["model"],
119
91
  "additionalProperties": false,
120
92
  "properties": {
121
93
  "id": { "type": "string", "pattern": "^[A-Za-z0-9_-]+$" },
122
94
  "model": { "type": "string", "minLength": 1 },
123
95
  "options": { "type": "object", "additionalProperties": true },
124
- "account": { "type": "string", "minLength": 1 },
125
- "permission": { "$ref": "#/$defs/permission" },
96
+ "permissions": { "$ref": "#/$defs/permissions" },
126
97
  "persona": { "type": "string" }
127
98
  }
128
99
  },
129
- "editor": {
100
+ "triageCreator": {
130
101
  "type": "object",
131
- "required": ["model", "account", "author"],
102
+ "required": ["model", "author"],
132
103
  "additionalProperties": false,
133
104
  "properties": {
105
+ "account": { "type": "string", "minLength": 1 },
134
106
  "model": { "type": "string", "minLength": 1 },
135
107
  "options": { "type": "object", "additionalProperties": true },
136
- "account": { "type": "string", "minLength": 1 },
137
108
  "author": {
138
109
  "type": "object",
139
110
  "required": ["name", "email"],
@@ -143,21 +114,211 @@
143
114
  "email": { "type": "string", "minLength": 1 }
144
115
  }
145
116
  },
146
- "permission": { "$ref": "#/$defs/permission" },
117
+ "permissions": { "$ref": "#/$defs/permissions" },
147
118
  "persona": { "type": "string" }
148
119
  }
149
120
  },
150
- "agents": {
121
+ "automation": {
122
+ "type": "object",
123
+ "additionalProperties": false,
124
+ "properties": {
125
+ "merge": { "type": "boolean", "default": true },
126
+ "close": { "type": "boolean" }
127
+ }
128
+ },
129
+ "reviewChecks": {
130
+ "type": "object",
131
+ "additionalProperties": false,
132
+ "properties": {
133
+ "exclude": { "type": "array", "items": { "type": "string" } },
134
+ "wait": { "type": "boolean", "default": true },
135
+ "retryFailedJobs": { "type": "integer", "minimum": 0, "default": 3 }
136
+ }
137
+ },
138
+ "mergeChecks": {
151
139
  "type": "object",
152
140
  "additionalProperties": false,
153
141
  "properties": {
154
- "permissions": { "$ref": "#/$defs/permission" },
155
- "reviewers": {
142
+ "wait": { "type": "boolean", "default": true }
143
+ }
144
+ },
145
+ "concurrency": {
146
+ "type": "object",
147
+ "additionalProperties": false,
148
+ "properties": {
149
+ "runs": { "type": "integer", "minimum": 1, "default": 3 },
150
+ "reviewers": { "type": "integer", "minimum": 1, "default": 3 }
151
+ }
152
+ },
153
+ "triageConcurrency": {
154
+ "type": "object",
155
+ "additionalProperties": false,
156
+ "properties": {
157
+ "runs": { "type": "integer", "minimum": 1, "default": 3 }
158
+ }
159
+ },
160
+ "safety": {
161
+ "type": "object",
162
+ "additionalProperties": false,
163
+ "properties": {
164
+ "allowAuthors": { "type": "array", "items": { "type": "string" } },
165
+ "blockedPaths": { "type": "array", "items": { "type": "string" } },
166
+ "maxChangedFiles": { "type": "integer", "minimum": 0 },
167
+ "requiredLabels": { "type": "array", "items": { "type": "string" } }
168
+ }
169
+ },
170
+ "reviewPrompts": {
171
+ "type": "object",
172
+ "additionalProperties": false,
173
+ "properties": {
174
+ "review": { "type": "string" },
175
+ "rereview": { "type": "string" },
176
+ "reviewGuidelines": { "type": "string" },
177
+ "ciClassification": { "type": "string" },
178
+ "findingValidation": { "type": "string" },
179
+ "closeReconsideration": { "type": "string" }
180
+ }
181
+ },
182
+ "mergePrompts": {
183
+ "type": "object",
184
+ "additionalProperties": false,
185
+ "properties": {
186
+ "edit": { "type": "string" },
187
+ "editGuidelines": { "type": "string" },
188
+ "ciClassification": { "type": "string" }
189
+ }
190
+ },
191
+ "triagePrompts": {
192
+ "type": "object",
193
+ "additionalProperties": false,
194
+ "properties": {
195
+ "existingPr": { "type": "string" },
196
+ "duplicate": { "type": "string" },
197
+ "category": { "type": "string" },
198
+ "acceptance": { "type": "string" },
199
+ "action": { "type": "string" },
200
+ "question": { "type": "string" },
201
+ "comment": { "type": "string" },
202
+ "commentClassification": { "type": "string" },
203
+ "reconsider": { "type": "string" },
204
+ "create": { "type": "string" },
205
+ "createGuidelines": { "type": "string" }
206
+ }
207
+ },
208
+ "triageCategory": {
209
+ "type": "object",
210
+ "additionalProperties": false,
211
+ "required": ["id"],
212
+ "properties": {
213
+ "id": {
214
+ "type": "string",
215
+ "pattern": "^[A-Za-z0-9_-]+$",
216
+ "not": { "enum": ["ASK", "none"] }
217
+ },
218
+ "labels": { "type": "array", "items": { "type": "string" } },
219
+ "types": { "type": "array", "items": { "type": "string" } },
220
+ "description": { "type": "string" }
221
+ }
222
+ },
223
+ "triageAutomation": {
224
+ "type": "object",
225
+ "additionalProperties": false,
226
+ "properties": {
227
+ "close": { "type": "boolean", "default": false },
228
+ "create": { "type": "boolean", "default": false },
229
+ "review": { "type": "boolean", "default": false },
230
+ "merge": { "type": "boolean", "default": false },
231
+ "clear": {
232
+ "type": "array",
233
+ "items": { "type": "string" },
234
+ "default": ["triage"]
235
+ }
236
+ }
237
+ },
238
+ "triageSafety": {
239
+ "type": "object",
240
+ "additionalProperties": false,
241
+ "properties": {
242
+ "requiredLabels": { "type": "array", "items": { "type": "string" } },
243
+ "blockedLabels": { "type": "array", "items": { "type": "string" } },
244
+ "allowAuthors": { "type": "array", "items": { "type": "string" } },
245
+ "allowMentionActors": {
246
+ "type": "array",
247
+ "items": { "type": "string" }
248
+ },
249
+ "allowMentionRoles": { "type": "array", "items": { "type": "string" } }
250
+ }
251
+ },
252
+ "reviewMerge": {
253
+ "type": "object",
254
+ "additionalProperties": false,
255
+ "properties": {
256
+ "approvalPolicy": {
257
+ "enum": ["majority", "unanimous"],
258
+ "default": "majority"
259
+ },
260
+ "method": { "enum": ["merge", "squash", "rebase"] },
261
+ "auto": { "type": "boolean" },
262
+ "deleteBranch": { "type": "boolean" },
263
+ "queue": { "type": "boolean", "default": false }
264
+ }
265
+ },
266
+ "review": {
267
+ "type": "object",
268
+ "additionalProperties": false,
269
+ "properties": {
270
+ "agents": {
156
271
  "type": "array",
157
272
  "minItems": 3,
158
273
  "items": { "$ref": "#/$defs/reviewer" }
159
274
  },
160
- "editor": { "$ref": "#/$defs/editor" }
275
+ "prompts": { "$ref": "#/$defs/reviewPrompts" },
276
+ "checks": { "$ref": "#/$defs/reviewChecks" },
277
+ "safety": { "$ref": "#/$defs/safety" },
278
+ "automation": { "$ref": "#/$defs/automation" },
279
+ "concurrency": { "$ref": "#/$defs/concurrency" },
280
+ "merge": { "$ref": "#/$defs/reviewMerge" },
281
+ "output": { "type": "string" },
282
+ "worktree": { "type": "string" }
283
+ }
284
+ },
285
+ "merge": {
286
+ "type": "object",
287
+ "additionalProperties": false,
288
+ "properties": {
289
+ "editor": { "$ref": "#/$defs/editor" },
290
+ "checks": { "$ref": "#/$defs/mergeChecks" },
291
+ "prompts": { "$ref": "#/$defs/mergePrompts" },
292
+ "automation": { "$ref": "#/$defs/automation" },
293
+ "maxThreadResolutionCycles": {
294
+ "type": "integer",
295
+ "minimum": 0,
296
+ "default": 5,
297
+ "description": "Maximum resolution attempts per unresolved review thread. Set 0 for unlimited attempts."
298
+ }
299
+ }
300
+ },
301
+ "triage": {
302
+ "type": "object",
303
+ "additionalProperties": false,
304
+ "properties": {
305
+ "account": { "type": "string", "minLength": 1 },
306
+ "agents": {
307
+ "type": "array",
308
+ "minItems": 3,
309
+ "items": { "$ref": "#/$defs/triageAgent" }
310
+ },
311
+ "creator": { "$ref": "#/$defs/triageCreator" },
312
+ "categories": {
313
+ "type": "array",
314
+ "items": { "$ref": "#/$defs/triageCategory" }
315
+ },
316
+ "automation": { "$ref": "#/$defs/triageAutomation" },
317
+ "safety": { "$ref": "#/$defs/triageSafety" },
318
+ "concurrency": { "$ref": "#/$defs/triageConcurrency" },
319
+ "prompts": { "$ref": "#/$defs/triagePrompts" },
320
+ "output": { "type": "string" },
321
+ "worktree": { "type": "string" }
161
322
  }
162
323
  },
163
324
  "permissionAction": { "enum": ["allow", "ask", "deny"] },
@@ -170,7 +331,7 @@
170
331
  }
171
332
  ]
172
333
  },
173
- "permission": {
334
+ "permissions": {
174
335
  "oneOf": [
175
336
  { "$ref": "#/$defs/permissionAction" },
176
337
  {
@@ -178,23 +339,6 @@
178
339
  "additionalProperties": { "$ref": "#/$defs/permissionRule" }
179
340
  }
180
341
  ]
181
- },
182
- "prompts": {
183
- "type": "object",
184
- "additionalProperties": false,
185
- "properties": {
186
- "review": { "type": "string" },
187
- "rereview": { "type": "string" },
188
- "edit": { "type": "string" },
189
- "editGuidelines": { "type": "string" },
190
- "findingValidation": { "type": "string" },
191
- "closeReconsideration": { "type": "string" },
192
- "rereviewCloseReconsideration": { "type": "string" },
193
- "ciClassification": { "type": "string" },
194
- "ciClassificationAfterEdit": { "type": "string" },
195
- "report": { "type": "string" },
196
- "reviewGuidelines": { "type": "string" }
197
- }
198
342
  }
199
343
  }
200
344
  }
@@ -1,6 +0,0 @@
1
- You requested CLOSE while re-reviewing pull request #{pr} in {owner}/{repo}, but the other reviewers did not.
2
- Reconsider your decision and choose MERGE or CHANGES_REQUESTED instead.
3
- Use the existing re-review session context.
4
- Original close reason:
5
- {closeReason}
6
- Do not edit files or perform write operations.
@@ -1,7 +0,0 @@
1
- Review pull request #{pr} for {owner}/{repo}.
2
- The PR worktree is {worktreePath}.
3
- Review only the diff from {baseSha} to {headSha}.
4
- Use: git -C {jsonEncodedWorktreePath} diff {baseSha}...{headSha}
5
- Do not edit files or perform write operations.
6
-
7
- {ciFailureContextBlock}