Skip to content

Commit 4bd7506

Browse files
committed
v1.0.3
1 parent e0ba9b7 commit 4bd7506

6 files changed

Lines changed: 281 additions & 2 deletions

File tree

Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ RUN npm i -g opencode-ai
121121
COPY scripts/entrypoint.sh /usr/local/bin/entrypoint.sh
122122
COPY scripts/bootstrap.sh /usr/local/bin/bootstrap.sh
123123
COPY config/opencode.json /usr/local/share/holycode/opencode.json
124+
COPY config/skills /usr/local/share/holycode/skills
124125
RUN chmod +x /usr/local/bin/entrypoint.sh /usr/local/bin/bootstrap.sh
125126

126127
# ---------- s6-overlay service: opencode web ----------

README.md

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,9 @@ services:
370370

371371
> Plugin toggles (`ENABLE_CLAUDE_AUTH`, `ENABLE_OH_MY_OPENAGENT`) take effect on container restart. Set the env var and run `docker compose down && up -d`.
372372

373-
> `ENABLE_OH_MY_OPENAGENT=true` enables the plugin through the main OpenCode config at `/home/opencode/.config/opencode/opencode.json`. On the host, that file appears under whatever host path you bind to `/home/opencode`.
373+
> `ENABLE_OH_MY_OPENAGENT=true` enables the plugin through the main OpenCode config at `/home/opencode/.config/opencode/opencode.json`. On the host, that file appears under whatever host path you bind to `/home/opencode`. On boot, HolyCode also checks whether the plugin package is missing and installs it if needed.
374374

375-
> This toggle should not be read as “HolyCode will always auto-create a separate plugin-specific config file on the host.” The guaranteed file to check first is `opencode.json` in the OpenCode config directory.
375+
> `ENABLE_OH_MY_OPENAGENT=true` enables the plugin. The built-in `/oh-my-openagent-setup` skill is the supported way to create or update the plugin-specific config file at `~/.config/opencode/oh-my-openagent.jsonc`.
376376

377377
> `GIT_USER_NAME` and `GIT_USER_EMAIL` are only applied on first boot. To re-apply, delete the sentinel file and restart: `docker exec holycode rm /home/opencode/.config/opencode/.holycode-bootstrapped` then `docker compose restart`.
378378

@@ -541,6 +541,34 @@ docker exec -it holycode bash -c "opencode providers list"
541541
docker exec -it holycode bash -c "opencode providers login"
542542
```
543543

544+
### oh-my-openagent setup and reconfiguration
545+
546+
If you enabled `ENABLE_OH_MY_OPENAGENT=true`, use the shipped setup skill to create or refresh the plugin-specific config:
547+
548+
```text
549+
/oh-my-openagent-setup
550+
```
551+
552+
That flow is the supported path for:
553+
554+
- first-time oh-my-openagent setup
555+
- reconfiguring after adding or removing providers
556+
- restoring the intended picker defaults so only the primary agents are visible
557+
558+
HolyCode's default picker policy is:
559+
560+
- visible: `sisyphus`, `hephaestus`, `prometheus`, `atlas`
561+
- hidden subagents: `oracle`, `librarian`, `explore`, `metis`, `momus`, `multimodal-looker`, `sisyphus-junior`
562+
563+
If you add a new provider later and the visible default model still looks stale, rerun `/oh-my-openagent-setup`, then run:
564+
565+
```bash
566+
docker exec -it holycode bash -c "bunx oh-my-opencode doctor"
567+
docker exec -it holycode bash -c "bunx oh-my-opencode refresh-model-capabilities"
568+
```
569+
570+
HolyCode can guide the supported refresh path, but upstream OpenCode and oh-my-openagent model-resolution behavior still controls the final visible model state.
571+
544572
### Useful commands
545573

546574
| Command | What it does |
@@ -552,6 +580,8 @@ docker exec -it holycode bash -c "opencode providers login"
552580
| `opencode serve` | Headless API server |
553581
| `opencode providers list` | Show configured providers |
554582
| `opencode providers login` | Add or switch provider |
583+
| `bunx oh-my-opencode doctor` | Diagnose oh-my-openagent config and model resolution |
584+
| `bunx oh-my-opencode refresh-model-capabilities` | Refresh provider/model capability cache after provider changes |
555585
| `opencode models` | List available models |
556586
| `opencode models <provider>` | List models for a specific provider |
557587
| `opencode stats` | Show token usage and costs |
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
---
2+
name: oh-my-openagent-setup
3+
description: Configure or reconfigure oh-my-openagent for HolyCode. Mirrors the upstream provider questionnaire, writes plugin config, keeps only primary agents visible, and prints doctor/refresh/auth follow-up steps.
4+
---
5+
6+
# oh-my-openagent-setup
7+
8+
Use this skill when the user wants to:
9+
10+
- set up oh-my-openagent for the first time
11+
- reconfigure it after adding or removing providers
12+
- fix confusing picker visibility
13+
- refresh the expected model/config path after provider changes
14+
15+
This skill manages HolyCode's supported setup flow. Keep it close to upstream oh-my-openagent behavior, but apply HolyCode defaults for agent visibility and safety.
16+
17+
---
18+
19+
## Step 0 — Confirm the working context
20+
21+
1. Verify you are inside a HolyCode container or a HolyCode-backed OpenCode environment.
22+
2. Use these paths as the defaults unless the user explicitly says otherwise:
23+
- Main OpenCode config: `~/.config/opencode/opencode.json`
24+
- oh-my-openagent config: `~/.config/opencode/oh-my-openagent.jsonc`
25+
- Skills directory: `~/.config/opencode/skills/`
26+
3. If `opencode.json` does not exist, explain that HolyCode/OpenCode is not bootstrapped yet and stop.
27+
28+
---
29+
30+
## Step 1 — Detect current state
31+
32+
Before asking questions, inspect the current config state and summarize it briefly:
33+
34+
1. Is `oh-my-openagent` already present in the `plugin` array of `opencode.json`?
35+
2. Does `oh-my-openagent.jsonc` already exist?
36+
3. If it exists, extract any current values that match the questionnaire fields below.
37+
4. If a previous backup exists, mention it but do not restore it automatically.
38+
39+
If the plugin-specific config already exists, this run should behave as **reconfiguration mode**.
40+
41+
---
42+
43+
## Step 2 — Ask the upstream-style questionnaire
44+
45+
Ask the user these questions in order. If reconfiguring, show the current value as the default.
46+
47+
1. Claude subscription: `yes`, `no`, or `max20`
48+
2. OpenAI subscription: `yes` or `no`
49+
3. Gemini availability: `yes` or `no`
50+
4. GitHub Copilot availability: `yes` or `no`
51+
5. OpenCode Zen availability: `yes` or `no`
52+
6. Z.ai Coding Plan availability: `yes` or `no`
53+
7. OpenCode Go availability: `yes` or `no`
54+
55+
Do not invent extra product questions unless the user explicitly asks for advanced customization.
56+
57+
---
58+
59+
## Step 3 — Apply HolyCode defaults
60+
61+
When writing `oh-my-openagent.jsonc`, enforce this visibility policy unless the user explicitly asks for something else:
62+
63+
### Visible primary agents
64+
65+
- `sisyphus`
66+
- `hephaestus`
67+
- `prometheus`
68+
- `atlas`
69+
70+
### Hidden subagents
71+
72+
- `oracle`
73+
- `librarian`
74+
- `explore`
75+
- `metis`
76+
- `momus`
77+
- `multimodal-looker`
78+
- `sisyphus-junior`
79+
80+
Set visible agents to `mode: "all"` and subagents to `mode: "subagent"`.
81+
82+
---
83+
84+
## Step 4 — Write the configs safely
85+
86+
### A. Ensure plugin registration
87+
88+
Update `opencode.json` so the `plugin` array includes `oh-my-openagent` exactly once.
89+
90+
### B. Back up the existing plugin config
91+
92+
If `oh-my-openagent.jsonc` already exists, create a backup first:
93+
94+
- `oh-my-openagent.jsonc.bak`
95+
96+
If that name already exists, append a timestamp rather than overwriting the existing backup.
97+
98+
### C. Write or update `oh-my-openagent.jsonc`
99+
100+
The file should:
101+
102+
1. include the upstream schema URL if available
103+
2. store the questionnaire answers in a clean, editable JSONC structure
104+
3. include HolyCode's default agent visibility policy
105+
4. preserve unrelated user fields where practical during reconfiguration
106+
107+
If preserving unrelated fields would be unsafe because the file is malformed, stop and explain the problem instead of blindly rewriting.
108+
109+
---
110+
111+
## Step 5 — Explain stale-model behavior honestly
112+
113+
Do **not** claim that HolyCode fully fixes upstream model-resolution bugs.
114+
115+
Instead, explain this clearly:
116+
117+
- Adding a provider later does not always update the visible default model automatically.
118+
- HolyCode's supported fix path is to rerun `/oh-my-openagent-setup`, then refresh model capabilities, then verify provider/model state.
119+
- Provider auth still belongs to OpenCode/provider login, not this skill.
120+
121+
---
122+
123+
## Step 6 — Print the follow-up commands
124+
125+
Always finish by showing the next actions the user may need.
126+
127+
### Provider auth
128+
129+
```bash
130+
opencode providers list
131+
opencode providers login
132+
```
133+
134+
### Verify oh-my-openagent setup
135+
136+
```bash
137+
bunx oh-my-opencode doctor
138+
```
139+
140+
### Refresh model capabilities after provider changes
141+
142+
```bash
143+
bunx oh-my-opencode refresh-model-capabilities
144+
```
145+
146+
If the UI still shows a stale visible default after provider changes, tell the user to:
147+
148+
1. rerun `/oh-my-openagent-setup`
149+
2. refresh model capabilities
150+
3. reopen or reselect the model in the UI if needed
151+
152+
---
153+
154+
## Rules
155+
156+
- Keep the questionnaire close to upstream.
157+
- Do not perform provider authentication for the user.
158+
- Do not expose subagents in the picker by default.
159+
- Do not overwrite an existing plugin config without making a backup first.
160+
- Do not silently destroy malformed config files.
161+
- Keep explanations concise and practical.

docs/CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,23 @@ All notable changes to HolyCode will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/), and this project adheres to [Semantic Versioning](https://semver.org/).
66

7+
## [1.0.3] - 04/04/2026
8+
9+
### Added
10+
11+
- Ship a built-in `/oh-my-openagent-setup` skill for first-time setup and reruns after provider changes
12+
- Copy HolyCode-managed OpenCode skills into `~/.config/opencode/skills` on boot without overwriting existing user skill folders
13+
- Ensure enabled plugin packages are installed on boot if they are missing from the OpenCode cache
14+
15+
### Changed
16+
17+
- Document `/oh-my-openagent-setup` as the supported path for writing `oh-my-openagent.jsonc`
18+
- Document the default picker policy so only Sisyphus, Hephaestus, Prometheus, and Atlas are visible by default
19+
20+
### Fixed
21+
22+
- Add an explicit rerun + doctor + model-capability refresh path for stale visible default-model behavior after provider changes
23+
724
## [1.0.2] - 04/03/2026
825

926
### Changed

scripts/bootstrap.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,31 @@ PUID="${PUID:-1000}"
1313
PGID="${PGID:-1000}"
1414
SOURCE_DIR="/usr/local/share/holycode"
1515

16+
sync_shipped_skills() {
17+
local source_skills_dir="$SOURCE_DIR/skills"
18+
local target_skills_dir="$OC_HOME/.config/opencode/skills"
19+
20+
[ -d "$source_skills_dir" ] || return 0
21+
22+
mkdir -p "$target_skills_dir"
23+
24+
find "$source_skills_dir" -mindepth 1 -maxdepth 1 -type d | while read -r skill_dir; do
25+
local skill_name target_dir
26+
skill_name=$(basename "$skill_dir")
27+
target_dir="$target_skills_dir/$skill_name"
28+
29+
if [ -e "$target_dir" ]; then
30+
echo "[bootstrap] Skill '$skill_name' already exists, skipping"
31+
continue
32+
fi
33+
34+
cp -R "$skill_dir" "$target_dir"
35+
echo "[bootstrap] Installed built-in skill '$skill_name'"
36+
done
37+
38+
chown -R "$PUID:$PGID" "$target_skills_dir"
39+
}
40+
1641
echo "[bootstrap] Running first-boot initialization..."
1742

1843
# ---------- Copy default opencode.json ----------
@@ -23,6 +48,8 @@ else
2348
echo "[bootstrap] opencode.json already exists, skipping"
2449
fi
2550

51+
sync_shipped_skills
52+
2653
# ---------- Git configuration ----------
2754
GIT_USER_NAME="${GIT_USER_NAME:-HolyCode User}"
2855
GIT_USER_EMAIL="${GIT_USER_EMAIL:-noreply@holycode.local}"

scripts/entrypoint.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,44 @@ OC_USER="opencode"
1111
OC_HOME="/home/opencode"
1212
WORKSPACE_DIR="/workspace"
1313

14+
sync_shipped_skills() {
15+
local source_skills_dir="/usr/local/share/holycode/skills"
16+
local target_skills_dir="$OC_HOME/.config/opencode/skills"
17+
18+
[ -d "$source_skills_dir" ] || return 0
19+
20+
mkdir -p "$target_skills_dir"
21+
chown "$PUID:$PGID" "$target_skills_dir"
22+
23+
find "$source_skills_dir" -mindepth 1 -maxdepth 1 -type d | while read -r skill_dir; do
24+
local skill_name target_dir
25+
skill_name=$(basename "$skill_dir")
26+
target_dir="$target_skills_dir/$skill_name"
27+
28+
if [ -e "$target_dir" ]; then
29+
continue
30+
fi
31+
32+
cp -R "$skill_dir" "$target_dir"
33+
chown -R "$PUID:$PGID" "$target_dir"
34+
echo "[entrypoint] Installed built-in skill '$skill_name'"
35+
done
36+
}
37+
38+
ensure_plugin_installed() {
39+
local plugin_name="$1"
40+
local plugin_dir="$OC_HOME/.cache/opencode/node_modules/$plugin_name"
41+
42+
if [ -f "$plugin_dir/package.json" ]; then
43+
return 0
44+
fi
45+
46+
echo "[entrypoint] Plugin '$plugin_name' missing, installing"
47+
if ! runuser -u "$OC_USER" -- opencode plugin "$plugin_name" -g; then
48+
echo "[entrypoint] WARNING: Failed to install plugin '$plugin_name'"
49+
fi
50+
}
51+
1452
# ---------- UID/GID remapping ----------
1553
PUID="${PUID:-1000}"
1654
PGID="${PGID:-1000}"
@@ -34,6 +72,7 @@ chown "$PUID:$PGID" "$OC_HOME"
3472
# Pre-create OpenCode directories (bind mount may start empty)
3573
for dir in \
3674
"$OC_HOME/.config/opencode" \
75+
"$OC_HOME/.config/opencode/skills" \
3776
"$OC_HOME/.local/share/opencode" \
3877
"$OC_HOME/.local/state/opencode" \
3978
"$OC_HOME/.cache/opencode" \
@@ -98,6 +137,8 @@ if [ ! -f "$SENTINEL" ]; then
98137
fi
99138
fi
100139

140+
sync_shipped_skills
141+
101142
# ---------- Plugin toggles (run every boot for enable/disable) ----------
102143
CONFIG_FILE="$OC_HOME/.config/opencode/opencode.json"
103144
if [ -f "$CONFIG_FILE" ]; then
@@ -115,6 +156,7 @@ with open('$CONFIG_FILE', 'w') as f:
115156
json.dump(config, f, indent=2)
116157
" 2>/dev/null && echo "[entrypoint] Claude Auth plugin enabled"
117158
fi
159+
ensure_plugin_installed "opencode-claude-auth"
118160
else
119161
if grep -q "opencode-claude-auth" "$CONFIG_FILE" 2>/dev/null; then
120162
runuser -u "$OC_USER" -- python3 -c "
@@ -143,6 +185,7 @@ with open('$CONFIG_FILE', 'w') as f:
143185
json.dump(config, f, indent=2)
144186
" 2>/dev/null && echo "[entrypoint] oh-my-openagent plugin enabled"
145187
fi
188+
ensure_plugin_installed "oh-my-openagent"
146189
else
147190
if grep -q "oh-my-openagent" "$CONFIG_FILE" 2>/dev/null; then
148191
runuser -u "$OC_USER" -- python3 -c "

0 commit comments

Comments
 (0)