my-opencode 1.3.4 → 3.0.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/LICENSE +21 -21
- package/README.md +309 -271
- package/agents/architect.md +30 -30
- package/agents/backend-dev.md +29 -0
- package/agents/business-analyst.md +30 -0
- package/agents/code-reviewer.md +29 -29
- package/agents/design-evidence.md +29 -0
- package/agents/frontend-dev.md +29 -0
- package/agents/system-designer.md +30 -0
- package/agents/team-lead.md +65 -60
- package/agents/tech-writer.md +30 -30
- package/agents/test-engineer.md +30 -30
- package/agents/verifier.md +38 -33
- package/bin/cli.js +366 -364
- package/bin/moc +206 -198
- package/bin/moc.js +9 -3
- package/opencode.json +240 -170
- package/package.json +53 -51
- package/plugins/README.md +74 -67
- package/plugins/provider-profile.mjs +238 -194
- package/scripts/postinstall.js +202 -202
- package/scripts/validate-role-flow.mjs +90 -0
- package/skills/adr/SKILL.md +91 -91
- package/skills/adr/references/templates.md +100 -100
- package/skills/adr/scripts/README.md +5 -5
- package/skills/design-evidence/SKILL.md +56 -0
- package/skills/dev-flow/SKILL.md +126 -188
- package/skills/dev-flow/references/code-phase.md +35 -72
- package/skills/dev-flow/references/contract-phase.md +66 -81
- package/skills/dev-flow/references/verify-phase.md +70 -129
- package/skills/dev-flow/scripts/README.md +3 -3
- package/skills/docs-gen/SKILL.md +162 -162
- package/skills/docs-gen/references/doc-styles.md +216 -216
- package/skills/docs-gen/scripts/README.md +5 -5
- package/skills/orchestrate/SKILL.md +63 -112
- package/skills/orchestrate/references/orchestration-patterns.md +49 -56
- package/skills/pr-review/SKILL.md +110 -110
- package/skills/pr-review/references/review-dimensions.md +117 -117
- package/skills/pr-review/references/security-checklist.md +122 -122
- package/skills/pr-review/scripts/README.md +5 -5
- package/skills/test-gen/SKILL.md +143 -143
- package/skills/test-gen/references/framework-detection.md +105 -105
- package/skills/test-gen/references/test-patterns.md +260 -260
- package/skills/test-gen/scripts/README.md +5 -5
- package/agents/executor.md +0 -30
- package/agents/fullstack-dev.md +0 -57
- package/agents/spec-writer.md +0 -37
package/bin/moc
CHANGED
|
@@ -1,199 +1,207 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
-
|
|
3
|
-
profile=
|
|
4
|
-
known_profiles="opencode openai
|
|
5
|
-
|
|
6
|
-
print_help() {
|
|
7
|
-
cat <<'EOF'
|
|
8
|
-
Usage:
|
|
9
|
-
moc [profile] [opencode-args...]
|
|
10
|
-
moc --help
|
|
11
|
-
moc doctor [profile]
|
|
12
|
-
moc print-config [profile]
|
|
13
|
-
|
|
14
|
-
Profiles:
|
|
15
|
-
opencode | openai |
|
|
16
|
-
|
|
17
|
-
Examples:
|
|
18
|
-
moc
|
|
19
|
-
moc
|
|
20
|
-
moc
|
|
21
|
-
moc
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- `moc`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
active_profile
|
|
32
|
-
printf '
|
|
33
|
-
printf '
|
|
34
|
-
printf '
|
|
35
|
-
printf '
|
|
36
|
-
printf '
|
|
37
|
-
printf '
|
|
38
|
-
printf '
|
|
39
|
-
printf '
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
fi
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
if [ -
|
|
183
|
-
if
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
2
|
+
|
|
3
|
+
profile=
|
|
4
|
+
known_profiles="opencode openai copilot anthropic"
|
|
5
|
+
|
|
6
|
+
print_help() {
|
|
7
|
+
cat <<'EOF'
|
|
8
|
+
Usage:
|
|
9
|
+
moc [profile] [opencode-args...]
|
|
10
|
+
moc --help
|
|
11
|
+
moc doctor [profile]
|
|
12
|
+
moc print-config [profile]
|
|
13
|
+
|
|
14
|
+
Profiles:
|
|
15
|
+
opencode | openai | copilot | anthropic
|
|
16
|
+
|
|
17
|
+
Examples:
|
|
18
|
+
moc
|
|
19
|
+
moc openai --list-agents
|
|
20
|
+
moc doctor anthropic
|
|
21
|
+
moc print-config anthropic
|
|
22
|
+
|
|
23
|
+
Notes:
|
|
24
|
+
- `moc` without extra args launches interactive opencode.
|
|
25
|
+
- Use `moc doctor` or `moc print-config` for non-interactive debugging.
|
|
26
|
+
EOF
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
print_doctor() {
|
|
30
|
+
active_profile=$1
|
|
31
|
+
printf 'profile=%s\n' "$active_profile"
|
|
32
|
+
printf 'plugin_path=%s\n' "$plugin_path"
|
|
33
|
+
printf 'config_path=%s\n' "$config_path"
|
|
34
|
+
printf 'cache_content_path=%s\n' "$cache_content_path"
|
|
35
|
+
printf 'cache_meta_path=%s\n' "$cache_meta_path"
|
|
36
|
+
printf 'plugin_exists=%s\n' "$( [ -f "$plugin_path" ] && printf yes || printf no )"
|
|
37
|
+
printf 'config_exists=%s\n' "$( [ -f "$config_path" ] && printf yes || printf no )"
|
|
38
|
+
printf 'cache_content_exists=%s\n' "$( [ -f "$cache_content_path" ] && printf yes || printf no )"
|
|
39
|
+
printf 'cache_meta_exists=%s\n' "$( [ -f "$cache_meta_path" ] && printf yes || printf no )"
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
case "${1-}" in
|
|
43
|
+
--help|-h|help)
|
|
44
|
+
print_help
|
|
45
|
+
exit 0
|
|
46
|
+
;;
|
|
47
|
+
"")
|
|
48
|
+
profile=opencode
|
|
49
|
+
;;
|
|
50
|
+
doctor)
|
|
51
|
+
profile=${2-opencode}
|
|
52
|
+
;;
|
|
53
|
+
print-config)
|
|
54
|
+
profile=${2-opencode}
|
|
55
|
+
;;
|
|
56
|
+
opencode|openai|copilot|anthropic)
|
|
57
|
+
profile=$1
|
|
58
|
+
shift
|
|
59
|
+
;;
|
|
60
|
+
esac
|
|
61
|
+
|
|
62
|
+
if [ -z "$profile" ]; then
|
|
63
|
+
exec opencode "$@"
|
|
64
|
+
fi
|
|
65
|
+
|
|
66
|
+
case "$profile" in
|
|
67
|
+
opencode|openai|copilot|anthropic)
|
|
68
|
+
;;
|
|
69
|
+
*)
|
|
70
|
+
printf '%s\n' "moc: unknown profile '$profile'. Must be one of: $known_profiles" >&2
|
|
71
|
+
exit 1
|
|
72
|
+
;;
|
|
73
|
+
esac
|
|
74
|
+
|
|
75
|
+
exec_opencode_with_profile() {
|
|
76
|
+
# Profile launches always use a private server (--standalone). A background
|
|
77
|
+
# service started without this profile env would otherwise ignore it.
|
|
78
|
+
standalone_flag=--standalone
|
|
79
|
+
for arg in "$@"; do
|
|
80
|
+
if [ "$arg" = "--standalone" ]; then
|
|
81
|
+
standalone_flag=
|
|
82
|
+
fi
|
|
83
|
+
done
|
|
84
|
+
|
|
85
|
+
exec env \
|
|
86
|
+
OPENCODE_PROVIDER_PROFILE="$profile" \
|
|
87
|
+
OPENCODE_CONFIG_CONTENT="$config_content" \
|
|
88
|
+
opencode ${standalone_flag:+"$standalone_flag"} "$@"
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
plugin_path=.opencode/plugins/provider-profile.mjs
|
|
92
|
+
config_path=.opencode/opencode.json
|
|
93
|
+
cache_dir=.opencode/cache/provider-profile
|
|
94
|
+
cache_content_path=$cache_dir/$profile.json
|
|
95
|
+
cache_meta_path=$cache_dir/$profile.meta
|
|
96
|
+
|
|
97
|
+
get_mtime() {
|
|
98
|
+
if stat -f %m "$1" >/dev/null 2>&1; then
|
|
99
|
+
stat -f %m "$1"
|
|
100
|
+
else
|
|
101
|
+
stat -c %Y "$1"
|
|
102
|
+
fi
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
read_meta() {
|
|
106
|
+
meta_profile=
|
|
107
|
+
meta_plugin_mtime=
|
|
108
|
+
meta_config_mtime=
|
|
109
|
+
|
|
110
|
+
[ -f "$1" ] || return 1
|
|
111
|
+
|
|
112
|
+
while IFS='=' read -r key value; do
|
|
113
|
+
case "$key" in
|
|
114
|
+
profile) meta_profile=$value ;;
|
|
115
|
+
plugin_mtime) meta_plugin_mtime=$value ;;
|
|
116
|
+
config_mtime) meta_config_mtime=$value ;;
|
|
117
|
+
esac
|
|
118
|
+
done < "$1"
|
|
119
|
+
|
|
120
|
+
[ -n "$meta_profile" ] && [ -n "$meta_plugin_mtime" ] && [ -n "$meta_config_mtime" ]
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
write_cache() {
|
|
124
|
+
tmp_content=$cache_content_path.tmp.$$
|
|
125
|
+
tmp_meta=$cache_meta_path.tmp.$$
|
|
126
|
+
|
|
127
|
+
if ! mkdir -p "$cache_dir" 2>/dev/null; then
|
|
128
|
+
return 1
|
|
129
|
+
fi
|
|
130
|
+
|
|
131
|
+
if ! printf '%s\n' "$1" > "$tmp_content"; then
|
|
132
|
+
rm -f "$tmp_content" "$tmp_meta"
|
|
133
|
+
return 1
|
|
134
|
+
fi
|
|
135
|
+
|
|
136
|
+
if ! {
|
|
137
|
+
printf 'profile=%s\n' "$profile"
|
|
138
|
+
printf 'plugin_mtime=%s\n' "$plugin_mtime"
|
|
139
|
+
printf 'config_mtime=%s\n' "$config_mtime"
|
|
140
|
+
} > "$tmp_meta"; then
|
|
141
|
+
rm -f "$tmp_content" "$tmp_meta"
|
|
142
|
+
return 1
|
|
143
|
+
fi
|
|
144
|
+
|
|
145
|
+
if ! mv "$tmp_content" "$cache_content_path" || ! mv "$tmp_meta" "$cache_meta_path"; then
|
|
146
|
+
rm -f "$tmp_content" "$tmp_meta"
|
|
147
|
+
return 1
|
|
148
|
+
fi
|
|
149
|
+
|
|
150
|
+
return 0
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if [ ! -f "$plugin_path" ]; then
|
|
154
|
+
printf '%s\n' "moc: plugin not found at $plugin_path; falling back to plain opencode" >&2
|
|
155
|
+
exec opencode "$@"
|
|
156
|
+
fi
|
|
157
|
+
|
|
158
|
+
if [ ! -f "$config_path" ]; then
|
|
159
|
+
printf '%s\n' "moc: config not found at $config_path; cannot compute provider profile override" >&2
|
|
160
|
+
exit 1
|
|
161
|
+
fi
|
|
162
|
+
|
|
163
|
+
case "${1-}" in
|
|
164
|
+
doctor)
|
|
165
|
+
print_doctor "$profile"
|
|
166
|
+
exit 0
|
|
167
|
+
;;
|
|
168
|
+
esac
|
|
169
|
+
|
|
170
|
+
plugin_mtime=$(get_mtime "$plugin_path") || {
|
|
171
|
+
printf '%s\n' "moc: failed to read plugin mtime from $plugin_path" >&2
|
|
172
|
+
exit 1
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
config_mtime=$(get_mtime "$config_path") || {
|
|
176
|
+
printf '%s\n' "moc: failed to read config mtime from $config_path" >&2
|
|
177
|
+
exit 1
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
config_content=
|
|
181
|
+
|
|
182
|
+
if read_meta "$cache_meta_path" && [ -f "$cache_content_path" ]; then
|
|
183
|
+
if [ "$meta_profile" = "$profile" ] \
|
|
184
|
+
&& [ "$meta_plugin_mtime" = "$plugin_mtime" ] \
|
|
185
|
+
&& [ "$meta_config_mtime" = "$config_mtime" ]; then
|
|
186
|
+
config_content=$(tr -d '\n' < "$cache_content_path") || config_content=
|
|
187
|
+
fi
|
|
188
|
+
fi
|
|
189
|
+
|
|
190
|
+
if [ -z "$config_content" ]; then
|
|
191
|
+
if ! config_content=$(OPENCODE_PROVIDER_PROFILE=$profile node "$plugin_path"); then
|
|
192
|
+
printf '%s\n' "moc: failed to compute OPENCODE_CONFIG_CONTENT from $plugin_path" >&2
|
|
193
|
+
exit 1
|
|
194
|
+
fi
|
|
195
|
+
|
|
196
|
+
write_cache "$config_content" || \
|
|
197
|
+
printf '%s\n' "moc: warning: failed to update cache at $cache_dir; continuing with fresh config" >&2
|
|
198
|
+
fi
|
|
199
|
+
|
|
200
|
+
case "${1-}" in
|
|
201
|
+
print-config)
|
|
202
|
+
printf '%s\n' "$config_content"
|
|
203
|
+
exit 0
|
|
204
|
+
;;
|
|
205
|
+
esac
|
|
206
|
+
|
|
207
|
+
exec_opencode_with_profile "$@"
|
package/bin/moc.js
CHANGED
|
@@ -5,8 +5,8 @@ import fs from 'node:fs';
|
|
|
5
5
|
import path from 'node:path';
|
|
6
6
|
import { spawn, spawnSync } from 'node:child_process';
|
|
7
7
|
|
|
8
|
-
const knownProfiles = new Set(['opencode', 'openai', '
|
|
9
|
-
const knownProfilesText = 'opencode openai
|
|
8
|
+
const knownProfiles = new Set(['opencode', 'openai', 'copilot', 'anthropic']);
|
|
9
|
+
const knownProfilesText = 'opencode openai copilot anthropic';
|
|
10
10
|
const signalExitCodes = {
|
|
11
11
|
SIGHUP: 1,
|
|
12
12
|
SIGINT: 2,
|
|
@@ -341,7 +341,13 @@ function main() {
|
|
|
341
341
|
process.exit(0);
|
|
342
342
|
}
|
|
343
343
|
|
|
344
|
-
|
|
344
|
+
// Profile launches always use a private server (--standalone). A background
|
|
345
|
+
// service started without this profile env would otherwise ignore it.
|
|
346
|
+
const launchArgs = forwardedArgs.includes('--standalone')
|
|
347
|
+
? forwardedArgs
|
|
348
|
+
: ['--standalone', ...forwardedArgs];
|
|
349
|
+
|
|
350
|
+
spawnOpencode(launchArgs, {
|
|
345
351
|
OPENCODE_PROVIDER_PROFILE: profile,
|
|
346
352
|
OPENCODE_CONFIG_CONTENT: configContent,
|
|
347
353
|
});
|