opencode-magi 0.1.0 → 0.2.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.
- package/README.md +14 -10
- package/dist/config/output.js +1 -1
- package/dist/config/resolve.js +44 -26
- package/dist/config/validate.js +199 -191
- package/dist/config/worktree.js +13 -0
- package/dist/github/commands.js +8 -4
- package/dist/index.js +5 -1
- package/dist/orchestrator/merge.js +8 -1
- package/dist/orchestrator/review.js +30 -2
- package/dist/orchestrator/run-manager.js +10 -3
- package/dist/prompts/compose.js +10 -14
- package/dist/prompts/templates/{close-reconsideration.md → review/close-reconsideration.md} +1 -2
- package/package.json +24 -26
- package/schema.json +110 -91
- package/dist/prompts/templates/rereview-close-reconsideration.md +0 -6
- /package/dist/prompts/templates/{ci-classification-after-edit.md → merge/ci-classification.md} +0 -0
- /package/dist/prompts/templates/{edit.md → merge/edit.md} +0 -0
- /package/dist/prompts/templates/{ci-classification.md → review/ci-classification.md} +0 -0
- /package/dist/prompts/templates/{finding-validation.md → review/finding-validation.md} +0 -0
- /package/dist/prompts/templates/{rereview.md → review/rereview.md} +0 -0
- /package/dist/prompts/templates/{review.md → review/review.md} +0 -0
package/README.md
CHANGED
|
@@ -36,6 +36,8 @@ Add the plugin to `opencode.json`.
|
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
|
+
Restart OpenCode. Done.
|
|
40
|
+
|
|
39
41
|
### Configure
|
|
40
42
|
|
|
41
43
|
Configure global defaults in `~/.config/opencode/magi.json` and project overrides in `<project>/.opencode/magi.json`.
|
|
@@ -58,9 +60,9 @@ Add the following content to the configuration file.
|
|
|
58
60
|
|
|
59
61
|
```json
|
|
60
62
|
{
|
|
61
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
62
|
-
"
|
|
63
|
-
"
|
|
63
|
+
"$schema": "https://raw.githubusercontent.com/magi-ai/opencode-magi/main/schema.json",
|
|
64
|
+
"review": {
|
|
65
|
+
"agents": [
|
|
64
66
|
{
|
|
65
67
|
"account": "your-account-1",
|
|
66
68
|
"model": "openai/gpt-5.5"
|
|
@@ -78,7 +80,7 @@ Add the following content to the configuration file.
|
|
|
78
80
|
}
|
|
79
81
|
```
|
|
80
82
|
|
|
81
|
-
`agents
|
|
83
|
+
`review.agents[].account` is the GitHub account used to post reviews and approvals. Must be authenticated with `gh auth token --user <account>` and must be unique.
|
|
82
84
|
|
|
83
85
|
#### Set project config
|
|
84
86
|
|
|
@@ -94,13 +96,13 @@ Add the following content to the configuration file.
|
|
|
94
96
|
|
|
95
97
|
```json
|
|
96
98
|
{
|
|
97
|
-
"$schema": "https://raw.githubusercontent.com/
|
|
99
|
+
"$schema": "https://raw.githubusercontent.com/magi-ai/opencode-magi/main/schema.json",
|
|
98
100
|
"github": {
|
|
99
101
|
"owner": "your-owner",
|
|
100
102
|
"repo": "your-repo"
|
|
101
103
|
},
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
+
"review": {
|
|
105
|
+
"agents": [
|
|
104
106
|
{
|
|
105
107
|
"account": "your-account-1",
|
|
106
108
|
"model": "openai/gpt-5.5"
|
|
@@ -113,7 +115,9 @@ Add the following content to the configuration file.
|
|
|
113
115
|
"account": "your-account-3",
|
|
114
116
|
"model": "opencode/kimi-k2-6"
|
|
115
117
|
}
|
|
116
|
-
]
|
|
118
|
+
]
|
|
119
|
+
},
|
|
120
|
+
"merge": {
|
|
117
121
|
"editor": {
|
|
118
122
|
"account": "your-editor-account",
|
|
119
123
|
"model": "openai/gpt-5.5",
|
|
@@ -126,7 +130,7 @@ Add the following content to the configuration file.
|
|
|
126
130
|
}
|
|
127
131
|
```
|
|
128
132
|
|
|
129
|
-
`agents
|
|
133
|
+
`review.agents[].account` is the GitHub account used to post reviews and approvals. Must be authenticated with `gh auth token --user <account>` and must be unique. `merge.editor.account` is used by `/magi:merge` to push fixes, close PRs, and merge PRs.
|
|
130
134
|
|
|
131
135
|
#### Validate config
|
|
132
136
|
|
|
@@ -152,7 +156,7 @@ Run commands from OpenCode.
|
|
|
152
156
|
|
|
153
157
|
- [Commands](docs/commands/index.md)
|
|
154
158
|
- [Config](docs/config.md)
|
|
155
|
-
- [Prompts](docs/prompts.md)
|
|
159
|
+
- [Prompts](docs/prompts/index.md)
|
|
156
160
|
|
|
157
161
|
## Contributing
|
|
158
162
|
|
package/dist/config/output.js
CHANGED
|
@@ -6,7 +6,7 @@ function resolvePath(directory, path) {
|
|
|
6
6
|
return isAbsolute(path) ? path : join(directory, path);
|
|
7
7
|
}
|
|
8
8
|
export function outputBaseDir(directory, config, kind) {
|
|
9
|
-
return resolvePath(directory, config.output
|
|
9
|
+
return resolvePath(directory, config.review?.output ?? DEFAULT_OUTPUT_DIRS[kind]);
|
|
10
10
|
}
|
|
11
11
|
export function outputBaseDirs(directory, config) {
|
|
12
12
|
return [outputBaseDir(directory, config, "pr")];
|
package/dist/config/resolve.js
CHANGED
|
@@ -44,20 +44,22 @@ export function mergePermissions(base, override) {
|
|
|
44
44
|
return merged;
|
|
45
45
|
}
|
|
46
46
|
export function resolveReviewerPermission(agents, reviewer) {
|
|
47
|
-
return mergePermissions(mergePermissions(DEFAULT_REVIEWER_PERMISSION, agents.permissions), reviewer.
|
|
47
|
+
return mergePermissions(mergePermissions(DEFAULT_REVIEWER_PERMISSION, agents.permissions), reviewer.permissions);
|
|
48
48
|
}
|
|
49
49
|
export function resolveEditorPermission(agents, editor) {
|
|
50
|
-
return mergePermissions(mergePermissions(DEFAULT_EDITOR_PERMISSION, agents.permissions), editor.
|
|
50
|
+
return mergePermissions(mergePermissions(DEFAULT_EDITOR_PERMISSION, agents.permissions), editor.permissions);
|
|
51
51
|
}
|
|
52
|
-
export function resolveAgents(
|
|
52
|
+
export function resolveAgents(config) {
|
|
53
|
+
const agents = config.agents ?? {};
|
|
54
|
+
const editor = config.merge?.editor;
|
|
53
55
|
return {
|
|
54
|
-
editor:
|
|
56
|
+
editor: editor
|
|
55
57
|
? {
|
|
56
|
-
...
|
|
57
|
-
permission: resolveEditorPermission(agents,
|
|
58
|
+
...editor,
|
|
59
|
+
permission: resolveEditorPermission(agents, editor),
|
|
58
60
|
}
|
|
59
61
|
: undefined,
|
|
60
|
-
reviewers: (agents
|
|
62
|
+
reviewers: (config.review?.agents ?? []).map((reviewer, index) => ({
|
|
61
63
|
...reviewer,
|
|
62
64
|
key: reviewerKey(reviewer, index),
|
|
63
65
|
index,
|
|
@@ -72,20 +74,21 @@ export function resolveRepository(config) {
|
|
|
72
74
|
throw new Error("github.repo is required");
|
|
73
75
|
return {
|
|
74
76
|
alias: config.github.repo,
|
|
75
|
-
agents: resolveAgents(config
|
|
77
|
+
agents: resolveAgents(config),
|
|
76
78
|
automation: {
|
|
77
|
-
close: config.automation?.close ??
|
|
78
|
-
merge: config.automation?.merge ?? true,
|
|
79
|
+
close: config.merge?.automation?.close ?? false,
|
|
80
|
+
merge: config.merge?.automation?.merge ?? true,
|
|
79
81
|
},
|
|
80
82
|
checks: {
|
|
81
|
-
exclude: config.checks?.exclude ?? [],
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
83
|
+
exclude: config.review?.checks?.exclude ?? [],
|
|
84
|
+
retryFailedJobs: config.review?.checks?.retryFailedJobs ?? 3,
|
|
85
|
+
wait: config.review?.checks?.wait ?? true,
|
|
86
|
+
waitAfterEdit: config.merge?.checks?.wait ?? true,
|
|
87
|
+
waitBeforeReview: config.review?.checks?.wait ?? true,
|
|
85
88
|
},
|
|
86
89
|
concurrency: {
|
|
87
|
-
runs: config.concurrency?.runs ?? 3,
|
|
88
|
-
reviewers: config.concurrency?.reviewers ?? 3,
|
|
90
|
+
runs: config.review?.concurrency?.runs ?? 3,
|
|
91
|
+
reviewers: config.review?.concurrency?.reviewers ?? 3,
|
|
89
92
|
},
|
|
90
93
|
github: {
|
|
91
94
|
apiRetryAttempts: config.github.apiRetryAttempts ?? 3,
|
|
@@ -95,19 +98,34 @@ export function resolveRepository(config) {
|
|
|
95
98
|
},
|
|
96
99
|
language: config.language,
|
|
97
100
|
merge: {
|
|
98
|
-
approvalPolicy: config.merge?.approvalPolicy ?? "majority",
|
|
99
|
-
method: config.merge?.method ?? "squash",
|
|
100
|
-
auto: config.merge?.auto ?? true,
|
|
101
|
-
deleteBranch: config.merge?.deleteBranch ?? true,
|
|
102
|
-
|
|
101
|
+
approvalPolicy: config.review?.merge?.approvalPolicy ?? "majority",
|
|
102
|
+
method: config.review?.merge?.method ?? "squash",
|
|
103
|
+
auto: config.review?.merge?.auto ?? true,
|
|
104
|
+
deleteBranch: config.review?.merge?.deleteBranch ?? true,
|
|
105
|
+
queue: config.review?.merge?.queue ?? false,
|
|
106
|
+
mergeQueue: config.review?.merge?.queue ?? false,
|
|
103
107
|
maxThreadResolutionCycles: config.merge?.maxThreadResolutionCycles ?? 5,
|
|
104
108
|
},
|
|
105
|
-
prompts:
|
|
109
|
+
prompts: {
|
|
110
|
+
ciClassification: config.review?.prompts?.ciClassification,
|
|
111
|
+
ciClassificationAfterEdit: config.merge?.prompts?.ciClassification,
|
|
112
|
+
closeReconsideration: config.review?.prompts?.closeReconsideration,
|
|
113
|
+
edit: config.merge?.prompts?.edit,
|
|
114
|
+
editGuidelines: config.merge?.prompts?.editGuidelines,
|
|
115
|
+
findingValidation: config.review?.prompts?.findingValidation,
|
|
116
|
+
rereview: config.review?.prompts?.rereview,
|
|
117
|
+
review: config.review?.prompts?.review,
|
|
118
|
+
reviewGuidelines: config.review?.prompts?.reviewGuidelines,
|
|
119
|
+
},
|
|
120
|
+
reviewAutomation: {
|
|
121
|
+
close: config.review?.automation?.close ?? false,
|
|
122
|
+
merge: config.review?.automation?.merge ?? false,
|
|
123
|
+
},
|
|
106
124
|
safety: {
|
|
107
|
-
allowAuthors: config.safety?.allowAuthors ?? [],
|
|
108
|
-
blockedPaths: config.safety?.blockedPaths ?? [],
|
|
109
|
-
maxChangedFiles: config.safety?.maxChangedFiles,
|
|
110
|
-
requiredLabels: config.safety?.requiredLabels ?? [],
|
|
125
|
+
allowAuthors: config.review?.safety?.allowAuthors ?? [],
|
|
126
|
+
blockedPaths: config.review?.safety?.blockedPaths ?? [],
|
|
127
|
+
maxChangedFiles: config.review?.safety?.maxChangedFiles,
|
|
128
|
+
requiredLabels: config.review?.safety?.requiredLabels ?? [],
|
|
111
129
|
},
|
|
112
130
|
};
|
|
113
131
|
}
|