Skip to content

Commit c46999d

Browse files
committed
feat(skill): enable customize-opencode by default, point at full schema
Flips OPENCODE_EXPERIMENTAL_CUSTOMIZE_SKILL on for every channel; set the env var to false to opt out. The unstable-channel default helper had no other users, so it goes away. Adds a 'Full schema reference' section at the top of the skill so the model knows to fetch https://opencode.ai/config.json for any field the skill body does not cover, instead of guessing.
1 parent 52f7ba7 commit c46999d

3 files changed

Lines changed: 22 additions & 18 deletions

File tree

packages/core/src/flag/flag.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Config } from "effect"
2-
import { InstallationChannel } from "../installation/version"
32

43
function truthy(key: string) {
54
const value = process.env[key]?.toLowerCase()
@@ -11,13 +10,6 @@ function falsy(key: string) {
1110
return value === "false" || value === "0"
1211
}
1312

14-
// Channels where new experiments default to ON (unstable / internal users).
15-
// Stable channels (`prod`, `latest`) stay opt-in.
16-
const UNSTABLE_CHANNELS = new Set(["dev", "beta", "local"])
17-
function unstableDefault(key: string) {
18-
return truthy(key) || (!falsy(key) && UNSTABLE_CHANNELS.has(InstallationChannel))
19-
}
20-
2113
function number(key: string) {
2214
const value = process.env[key]
2315
if (!value) return undefined
@@ -56,9 +48,9 @@ export const Flag = {
5648
OPENCODE_DISABLE_CLAUDE_CODE_PROMPT: OPENCODE_DISABLE_CLAUDE_CODE || truthy("OPENCODE_DISABLE_CLAUDE_CODE_PROMPT"),
5749
OPENCODE_DISABLE_CLAUDE_CODE_SKILLS,
5850
OPENCODE_DISABLE_EXTERNAL_SKILLS: truthy("OPENCODE_DISABLE_EXTERNAL_SKILLS"),
59-
// Default-on for dev/beta/local; opt-in for stable. Set
60-
// OPENCODE_EXPERIMENTAL_CUSTOMIZE_SKILL=false to force off, =true to force on.
61-
OPENCODE_EXPERIMENTAL_CUSTOMIZE_SKILL: unstableDefault("OPENCODE_EXPERIMENTAL_CUSTOMIZE_SKILL"),
51+
// Default-on for every channel. Set OPENCODE_EXPERIMENTAL_CUSTOMIZE_SKILL=false
52+
// to opt out.
53+
OPENCODE_EXPERIMENTAL_CUSTOMIZE_SKILL: !falsy("OPENCODE_EXPERIMENTAL_CUSTOMIZE_SKILL"),
6254
OPENCODE_FAKE_VCS: process.env["OPENCODE_FAKE_VCS"],
6355
OPENCODE_SERVER_PASSWORD: process.env["OPENCODE_SERVER_PASSWORD"],
6456
OPENCODE_SERVER_USERNAME: process.env["OPENCODE_SERVER_USERNAME"],

packages/opencode/src/skill/prompt/customize-opencode.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,22 @@
77
# Customizing opencode
88

99
opencode validates its own config strictly and refuses to start when a field
10-
is wrong. The shapes below are the accepted shapes. When in doubt, fetch
11-
`https://opencode.ai/config.json` (the JSON Schema) and validate against it.
10+
is wrong. The shapes below cover the common surface area, but they are a
11+
**summary, not the source of truth**.
1212

13-
Every `opencode.json` should declare `"$schema": "https://opencode.ai/config.json"`
13+
## Full schema reference
14+
15+
The authoritative list of every config option, with exact field types, enums,
16+
defaults, and descriptions, lives in the published JSON Schema:
17+
18+
**<https://opencode.ai/config.json>**
19+
20+
If a field is not documented in this skill, or you need to confirm an exact
21+
shape before writing config, **fetch that URL and read the schema directly**
22+
rather than guessing. opencode hard-fails on invalid config, so the cost of a
23+
wrong shape is a broken startup.
24+
25+
Every `opencode.json` should also declare `"$schema": "https://opencode.ai/config.json"`
1426
so the user's editor catches mistakes as they type.
1527

1628
## Where files live
@@ -343,7 +355,8 @@ When a user's config is broken and opencode won't start, these env vars help:
343355
## When proposing edits
344356

345357
- Validate against the schema before writing. If you are unsure of a field's
346-
exact shape, fetch `https://opencode.ai/config.json` rather than guessing.
358+
exact shape, or the field is not covered above, fetch
359+
`https://opencode.ai/config.json` and read the schema rather than guessing.
347360
- Preserve `$schema` and any existing fields the user did not ask to change.
348361
- For agent, skill, and plugin definitions, prefer creating new files in the
349362
correct location over inlining everything in `opencode.json`.

packages/opencode/test/preload.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ process.env["XDG_STATE_HOME"] = path.join(dir, "state")
3636
process.env["OPENCODE_MODELS_PATH"] = path.join(import.meta.dir, "tool", "fixtures", "models-api.json")
3737
process.env["OPENCODE_EXPERIMENTAL_EVENT_SYSTEM"] = "true"
3838
// Tests assert exact skill counts from disk discovery; the built-in
39-
// customize-opencode skill is opt-in for stable channels and on by default
40-
// for unstable channels (including "local" where CI runs). Disable it here
41-
// so disk-discovery tests aren't off-by-one.
39+
// customize-opencode skill is on by default. Disable it here so
40+
// disk-discovery tests aren't off-by-one.
4241
process.env["OPENCODE_EXPERIMENTAL_CUSTOMIZE_SKILL"] = "false"
4342

4443
// Set test home directory to isolate tests from user's actual home directory

0 commit comments

Comments
 (0)