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