Skip to content

Commit 733d5f0

Browse files
kinncjclaude
andcommitted
Stop writing speculative opencode statusline keys
opencode 1.14.x validates its config strictly and refuses to start when unknown top-level keys are present. The speculative `statusline` and `experimental.statusline` writes we added pending anomalyco/opencode#8619 now produce `Unrecognized key: statusline` and fail 4 of 5 startup requests (config.providers, provider.list, app.agents, config.get). Drop the writes. statusline.sh is still copied to ~/.config/opencode/ so it's ready if upstream ships the hook. On install, if a previous version left the legacy keys behind, strip them so existing users recover without editing opencode.json by hand. Tests inverted accordingly: install no longer creates opencode.json from scratch, and a new migration test covers the strip-legacy-keys path. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent b763314 commit 733d5f0

3 files changed

Lines changed: 58 additions & 26 deletions

File tree

‎CHANGELOG.md‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [0.2.4] - 2026-05-18
11+
12+
### Fixed
13+
- `installers/opencode.sh` no longer writes the `statusline` and
14+
`experimental.statusline` keys. opencode 1.14.x validates its config
15+
strictly and refuses to start when those keys are present — it prints
16+
`Unrecognized key: statusline` and 4 of 5 startup requests fail
17+
(`config.providers`, `provider.list`, `app.agents`, `config.get`).
18+
We still copy `statusline.sh` into `~/.config/opencode/` so it's ready
19+
if upstream ever ships anomalyco/opencode#8619, but the JSON write is
20+
gone. If a previous install left those keys behind, install now strips
21+
them, so users recover without editing the file by hand.
22+
1023
## [0.2.3] - 2026-05-13
1124

1225
### Changed

‎installers/opencode.sh‎

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,19 @@ fi
2020
copy_statusline "$DEST"
2121

2222
# OpenCode does NOT yet ship a script-driven statusline — tracked as an open
23-
# feature request at anomalyco/opencode#8619. We write the two key shapes
24-
# that have been proposed (top-level "statusline" and "experimental.statusline")
25-
# so that whichever the runtime eventually adopts will pick it up without a
26-
# re-install. Until shipped, this is dead JSON; the AGENTS.md drop is what
27-
# actually carries weight.
28-
# shellcheck disable=SC2016 # $schema and $cmd are jq variables bound by --arg
29-
json_set "$SETTINGS" \
30-
--arg schema "https://opencode.ai/config.json" \
31-
--arg cmd "$DEST" \
32-
'. + {
33-
"$schema": $schema,
34-
"statusline": {"command": $cmd},
35-
"experimental": (.experimental // {} | . + {"statusline": {"command": $cmd}})
36-
}'
23+
# feature request at anomalyco/opencode#8619. Earlier versions of this
24+
# installer speculatively wrote `statusline` and `experimental.statusline`
25+
# config keys; opencode's schema is strict and now refuses to start when
26+
# unknown keys are present, so we no longer write them. If a prior install
27+
# left those keys behind, strip them so opencode boots again. The AGENTS.md
28+
# drop is what actually carries weight today.
29+
if [ -f "$SETTINGS" ] && jq -e '.statusline? // .experimental.statusline?' "$SETTINGS" >/dev/null 2>&1; then
30+
info "removing legacy speculative statusline keys from $SETTINGS"
31+
json_set "$SETTINGS" 'del(.statusline) | del(.experimental.statusline) | if .experimental == {} then del(.experimental) else . end'
32+
fi
3733

3834
warn "opencode upstream has NOT shipped a statusline hook yet"
3935
info "tracking issue: https://github.com/anomalyco/opencode/issues/8619"
40-
info "we wrote the proposed config keys speculatively so a future ship auto-activates"
41-
info "today, opencode renders its built-in footer and ignores these keys"
42-
ok "opencode config written (statusline pending upstream)"
36+
info "statusline.sh is installed at $DEST and ready for when upstream ships the hook"
37+
info "today, opencode renders its built-in footer; AGENTS.md is the active surface"
38+
ok "opencode statusline staged (pending upstream)"

‎tests/installers/opencode.bats‎

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,32 @@ load test_helper
66
setup() { setup_fake_home; }
77
teardown() { teardown_fake_home; }
88

9-
@test "opencode: install writes both statusline and experimental.statusline" {
9+
@test "opencode: install stages statusline.sh but does NOT write speculative config keys" {
10+
# opencode's config schema is strict and refuses to start with unknown
11+
# top-level keys; we used to speculatively write `statusline` /
12+
# `experimental.statusline` pending anomalyco/opencode#8619 and it
13+
# bricked startup. Install must now leave the config alone.
1014
run_installer opencode
1115
[ "$status" -eq 0 ]
1216
[ -x "$HOME/.config/opencode/statusline.sh" ]
13-
[ -f "$HOME/.config/opencode/opencode.json" ]
14-
run jq_get "$HOME/.config/opencode/opencode.json" '.statusline.command'
15-
[ "$output" = "$HOME/.config/opencode/statusline.sh" ]
16-
run jq_get "$HOME/.config/opencode/opencode.json" '.experimental.statusline.command'
17-
[ "$output" = "$HOME/.config/opencode/statusline.sh" ]
17+
[ ! -e "$HOME/.config/opencode/opencode.json" ]
18+
}
19+
20+
@test "opencode: install strips legacy speculative keys from existing config" {
21+
mkdir -p "$HOME/.config/opencode"
22+
cat > "$HOME/.config/opencode/opencode.json" <<EOF
23+
{
24+
"\$schema": "https://opencode.ai/config.json",
25+
"statusline": {"command": "/old/path/statusline.sh"},
26+
"experimental": {"statusline": {"command": "/old/path/statusline.sh"}}
27+
}
28+
EOF
29+
run_installer opencode
30+
[ "$status" -eq 0 ]
31+
run jq_get "$HOME/.config/opencode/opencode.json" '.statusline'
32+
[ "$output" = "null" ]
33+
run jq_get "$HOME/.config/opencode/opencode.json" '.experimental'
34+
[ "$output" = "null" ]
1835
run jq_get "$HOME/.config/opencode/opencode.json" '."$schema"'
1936
[ "$output" = "https://opencode.ai/config.json" ]
2037
}
@@ -26,9 +43,15 @@ teardown() { teardown_fake_home; }
2643
[ ! -e "$HOME/.config/opencode/statusline.sh" ]
2744
}
2845

29-
@test "opencode: uninstall strips both statusline keys" {
30-
run_installer opencode
31-
[ -f "$HOME/.config/opencode/opencode.json" ]
46+
@test "opencode: uninstall strips legacy statusline keys if present" {
47+
mkdir -p "$HOME/.config/opencode"
48+
cat > "$HOME/.config/opencode/opencode.json" <<EOF
49+
{
50+
"statusline": {"command": "/old/path/statusline.sh"},
51+
"experimental": {"statusline": {"command": "/old/path/statusline.sh"}}
52+
}
53+
EOF
54+
cp /dev/null "$HOME/.config/opencode/statusline.sh"
3255
UNINSTALL=1 run_installer opencode
3356
[ "$status" -eq 0 ]
3457
[ ! -e "$HOME/.config/opencode/statusline.sh" ]

0 commit comments

Comments
 (0)