Skip to content

Commit b8a9c9e

Browse files
committed
fix: sync opencode versions from source file
1 parent ef01bdf commit b8a9c9e

4 files changed

Lines changed: 27 additions & 20 deletions

File tree

.version-bump.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,10 @@
162162
"name": "opencode",
163163
"version_file": "OPENCODE_VERSION",
164164
"files": [
165+
{
166+
"path": "OPENCODE_VERSION",
167+
"field": "__raw__"
168+
},
165169
{
166170
"path": "plugins/xberg/package.json",
167171
"field": "version"

CONTRIBUTING.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,16 @@ Install locally and test manually in your agent harness. Ask the agent to perfor
9595

9696
## Version Bumps
9797

98-
Update VERSION, run the bump script, and tag:
98+
Set the target version with the bump script, then tag:
9999

100100
```bash
101-
echo X.Y.Z > VERSION
102101
scripts/bump-version.sh X.Y.Z
103102
git commit -am "chore: release vX.Y.Z"
104103
git tag vX.Y.Z && git push --tags
105104
```
106105

106+
For opencode packages, use `scripts/bump-version.sh --group opencode X.Y.Z` to bump or `scripts/bump-version.sh --group opencode` to re-sync from `OPENCODE_VERSION`.
107+
107108
## Prose Style
108109

109110
Keep skills and docs terse and imperative. Lead with what the agent should do, not marketing:

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ plugins/
172172
└── crawlberg/
173173
└── plugin.json
174174
scripts/
175-
├── bump-version.sh # lockstep version bump
175+
├── bump-version.sh # version bump/sync
176176
└── validate-manifests.sh # CI parity check
177177
```
178178

@@ -183,11 +183,12 @@ Two independent version lines:
183183
- **Marketplace plugins** (Claude / Codex / Cursor / Factory / GitHub / Gemini manifests) track `VERSION`.
184184
- **opencode npm packages** (`@xberg-io/opencode-*`) track `OPENCODE_VERSION` and publish to npm.
185185

186-
`bump-version.sh` writes the version file and every manifest in that group; `validate-manifests.sh` checks both groups.
186+
`bump-version.sh` writes the version file and every manifest in that group when given a version. Without a version, it syncs the group's manifests from its source-of-truth version file. `validate-manifests.sh` checks both groups.
187187

188188
```bash
189189
scripts/bump-version.sh 0.2.3 # marketplace plugins (default group)
190190
scripts/bump-version.sh --group opencode 0.1.1 # opencode npm packages
191+
scripts/bump-version.sh --group opencode # resync from OPENCODE_VERSION
191192
scripts/validate-manifests.sh
192193
git commit -am "chore: release"
193194
git tag vX.Y.Z && git push --tags

scripts/bump-version.sh

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
#!/usr/bin/env bash
22
# Bump versions for a version group declared in .version-bump.json.
3-
# Usage: scripts/bump-version.sh [--group <name>] <new-semver>
3+
# Usage: scripts/bump-version.sh [--group <name>] [new-semver]
44
# default group: marketplace (tracks VERSION — the claude/codex/cursor/factory
55
# /github/gemini plugin manifests). The opencode group tracks OPENCODE_VERSION
66
# (the @xberg-io/opencode-* npm packages, versioned independently).
77
# Examples:
88
# scripts/bump-version.sh 0.2.3 # bump the marketplace plugins
99
# scripts/bump-version.sh --group opencode 0.1.1 # bump the npm packages
10+
# scripts/bump-version.sh --group opencode # sync packages from OPENCODE_VERSION
1011
set -euo pipefail
1112

1213
command -v jq >/dev/null 2>&1 || {
@@ -41,36 +42,36 @@ while [ $# -gt 0 ]; do
4142
esac
4243
done
4344

44-
[ -n "$NEW" ] || {
45-
echo "Usage: $0 [--group <name>] <new-semver>" >&2
46-
exit 2
47-
}
48-
4945
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
5046
CONFIG="$REPO_ROOT/.version-bump.json"
5147
[ -f "$CONFIG" ] || {
5248
echo "bump-version: $CONFIG not found" >&2
5349
exit 1
5450
}
5551

56-
# semver (with optional pre-release / build metadata)
57-
if ! [[ "$NEW" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then
58-
echo "bump-version: '$NEW' is not a valid semver" >&2
59-
exit 2
60-
fi
61-
6252
version_file="$(jq -r --arg g "$GROUP" '.groups[] | select(.name == $g) | .version_file' "$CONFIG")"
6353
if [ -z "$version_file" ] || [ "$version_file" = "null" ]; then
6454
echo "bump-version: unknown group '$GROUP' (known: $(jq -r '.groups[].name' "$CONFIG" | paste -sd, -))" >&2
6555
exit 2
6656
fi
6757

58+
if [ -z "$NEW" ]; then
59+
[ -f "$REPO_ROOT/$version_file" ] || {
60+
echo "bump-version: $version_file not found for group '$GROUP'" >&2
61+
exit 1
62+
}
63+
NEW="$(tr -d '[:space:]' <"$REPO_ROOT/$version_file")"
64+
fi
65+
66+
# semver (with optional pre-release / build metadata)
67+
if ! [[ "$NEW" =~ ^[0-9]+\.[0-9]+\.[0-9]+([-+][0-9A-Za-z.-]+)?$ ]]; then
68+
echo "bump-version: '$NEW' is not a valid semver" >&2
69+
exit 2
70+
fi
71+
6872
# Convert a dotted field like "plugins.0.version" into a jq path ".plugins[0].version".
6973
dotted_to_jq_path() { echo ".$1" | sed -E 's/\.([0-9]+)/[\1]/g'; }
7074

71-
# Write the group's source-of-truth version file.
72-
printf '%s\n' "$NEW" >"$REPO_ROOT/$version_file"
73-
7475
written=0
7576
missing=0
7677
while IFS=$'\t' read -r relpath field; do
@@ -90,4 +91,4 @@ while IFS=$'\t' read -r relpath field; do
9091
written=$((written + 1))
9192
done < <(jq -r --arg g "$GROUP" '.groups[] | select(.name == $g) | .files[] | [.path, .field] | @tsv' "$CONFIG")
9293

93-
echo "bump-version: group '$GROUP' -> $NEW (wrote $version_file and $written files, $missing skipped)"
94+
echo "bump-version: group '$GROUP' -> $NEW (wrote $written files, $missing skipped)"

0 commit comments

Comments
 (0)