fix release process
Release / release (push) Successful in 8s

This commit is contained in:
2026-09-10 13:57:21 +02:00
parent fa3d0da80b
commit 3fae7e084e
4 changed files with 20 additions and 16 deletions
+4 -4
View File
@@ -14,7 +14,7 @@ curl -fsSL https://git.krtss.de/StanPonomarev/stanp-opencode/raw/branch/main/ins
From a checkout, run `bash install.sh` directly. Rerun the same script to upgrade to the latest published, non-prerelease Gitea release. From a checkout, run `bash install.sh` directly. Rerun the same script to upgrade to the latest published, non-prerelease Gitea release.
The installer downloads `stanp-opencode.tgz` and its SHA-256 checksum, verifies the archive, and installs its dependencies with lifecycle scripts disabled. It activates the plugin only after importing and checking the native V2 export. Downloads, dependency installation, and validation failures leave the previous active plugin untouched. The checksum detects corruption; it is not a signature independent of the release server. The installer downloads `stanp-opencode.tgz` and its SHA-256 checksum, verifies and extracts the self-contained archive, then activates the plugin only after importing and checking the native V2 export. Download, extraction, and validation failures leave the previous active plugin untouched. The checksum detects corruption; it is not a signature independent of the release server.
Installation defaults to `~/.config/opencode` and respects `XDG_CONFIG_HOME`. Override it explicitly when needed: Installation defaults to `~/.config/opencode` and respects `XDG_CONFIG_HOME`. Override it explicitly when needed:
@@ -22,7 +22,7 @@ Installation defaults to `~/.config/opencode` and respects `XDG_CONFIG_HOME`. Ov
OPENCODE_CONFIG_DIR=/path/to/opencode-config bash install.sh OPENCODE_CONFIG_DIR=/path/to/opencode-config bash install.sh
``` ```
The installer atomically updates the `plugins/stanp-opencode` symlink for [V2 automatic plugin discovery](https://opencode.ai/v2/docs/plugins), with dependencies in a private `stanp-opencode/install.*` directory beneath the same config directory. It does not edit `opencode.json` or `opencode.jsonc`, install OpenCode itself, or configure provider credentials. Older private installation directories are retained so running sessions can finish; remove unused ones after restarting OpenCode. The installer atomically replaces `plugins/stanp-opencode.js` for [V2 automatic plugin discovery](https://opencode.ai/v2/docs/plugins). It does not create symlinks, install package dependencies, edit `opencode.json` or `opencode.jsonc`, install OpenCode itself, or configure provider credentials.
Restart `opencode2` after installation (or `opencode2 service restart` for an existing service). Connect your provider, then select `coordinate` in the agent picker. The default configuration uses OpenAI GPT models; agents are only enabled when the required models are available. Restart `opencode2` after installation (or `opencode2 service restart` for an existing service). Connect your provider, then select `coordinate` in the agent picker. The default configuration uses OpenAI GPT models; agents are only enabled when the required models are available.
@@ -34,7 +34,7 @@ See [GPT configuration](examples/gpt.opencode.jsonc) and [custom model assignmen
{ {
"plugins": [ "plugins": [
{ {
"package": "./plugins/stanp-opencode", "package": "./plugins/stanp-opencode.js",
"options": { "options": {
"mode": "gpt", "mode": "gpt",
"provider": "openai", "provider": "openai",
@@ -51,4 +51,4 @@ The plugin supplies session-local `todoread` and `todowrite` tools when no other
## Uninstall ## Uninstall
Remove the `plugins/stanp-opencode` symlink from the selected config directory and remove any explicit configuration entry for it, then restart OpenCode. Once no running session uses it, the private `stanp-opencode` installation directory can also be removed. Remove `plugins/stanp-opencode.js` from the selected config directory and remove any explicit configuration entry for it, then restart OpenCode.
+13 -10
View File
@@ -1,15 +1,15 @@
#!/usr/bin/env bash #!/usr/bin/env bash
set -euo pipefail set -euo pipefail
for command in bun curl jq sha256sum; do for command in bun curl jq sha256sum tar; do
command -v "$command" >/dev/null || { printf 'Required command not found: %s\n' "$command" >&2; exit 1; } command -v "$command" >/dev/null || { printf 'Required command not found: %s\n' "$command" >&2; exit 1; }
done done
config="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}" config="${OPENCODE_CONFIG_DIR:-${XDG_CONFIG_HOME:-$HOME/.config}/opencode}"
mkdir -p "$config" mkdir -p "$config"
config=$(cd "$config" && pwd -P) config=$(cd "$config" && pwd -P)
mkdir -p "$config/stanp-opencode" "$config/plugins" mkdir -p "$config/plugins"
install=$(mktemp -d "$config/stanp-opencode/install.XXXXXXXX") install=$(mktemp -d "$config/install.stanp-opencode.XXXXXXXX")
cleanup() { cleanup() {
if [[ -n "$install" ]]; then rm -rf "$install"; fi if [[ -n "$install" ]]; then rm -rf "$install"; fi
} }
@@ -33,8 +33,7 @@ if [[ ! "$actual" =~ ^[a-fA-F0-9]{64}$ || "$actual" != "$checksum" ]]; then
exit 1 exit 1
fi fi
printf '{"private":true,"type":"module"}\n' > "$install/package.json" tar -xzf "$install/stanp-opencode.tgz" -C "$install"
(cd "$install" && bun add --production --ignore-scripts --no-cache ./stanp-opencode.tgz)
bun -e ' bun -e '
if (!await Bun.file(process.argv[1]).exists()) { if (!await Bun.file(process.argv[1]).exists()) {
throw new Error("Latest release lacks the OpenCode V2 directory entrypoint. Publish a V2-compatible release first."); throw new Error("Latest release lacks the OpenCode V2 directory entrypoint. Publish a V2-compatible release first.");
@@ -43,10 +42,14 @@ bun -e '
if (!plugin || plugin.id !== "stanp-opencode" || typeof plugin.setup !== "function") { if (!plugin || plugin.id !== "stanp-opencode" || typeof plugin.setup !== "function") {
throw new Error("Latest release is not a native OpenCode V2 plugin. Publish a V2-compatible release first."); throw new Error("Latest release is not a native OpenCode V2 plugin. Publish a V2-compatible release first.");
} }
' "$install/node_modules/stanp-opencode/index.js" ' "$install/package/dist/index.js"
tag=$(jq -r '.tag_name' "$install/release.json") tag=$(jq -r '.tag_name' "$install/release.json")
ln -s "../stanp-opencode/$(basename "$install")/node_modules/stanp-opencode" "$install/plugin" if ! mv -f "$install/package/dist/index.js" "$config/plugins/stanp-opencode.js"; then
mv -Tf "$install/plugin" "$config/plugins/stanp-opencode" printf 'Could not activate plugin; installation unchanged\n' >&2
install="" exit 1
printf 'Installed stanp-opencode %s into %s/plugins/stanp-opencode\nRestart opencode2 to load it.\n' "$tag" "$config" fi
if [[ -L "$config/plugins/stanp-opencode" ]]; then
rm -f "$config/plugins/stanp-opencode"
fi
printf 'Installed stanp-opencode %s into %s/plugins/stanp-opencode.js\nRestart opencode2 to load it.\n' "$tag" "$config"
+1 -1
View File
@@ -26,7 +26,7 @@
"format": "oxfmt --write .", "format": "oxfmt --write .",
"format:check": "oxfmt --check .", "format:check": "oxfmt --check .",
"test": "bun test", "test": "bun test",
"build": "bun build src/index.ts --outdir dist --target bun --format esm --packages external && tsc --project tsconfig.build.json --emitDeclarationOnly" "build": "bun build src/index.ts --outdir dist --target bun --format esm && tsc --project tsconfig.build.json --emitDeclarationOnly"
}, },
"devDependencies": { "devDependencies": {
"@opencode/client": "0.0.0-beta-19378", "@opencode/client": "0.0.0-beta-19378",
+2 -1
View File
@@ -174,7 +174,7 @@ test("installs an importable native plugin under XDG without changing user confi
process.execPath, process.execPath,
"-e", "-e",
"const { default: plugin } = await import(process.argv[1]); console.log(JSON.stringify([plugin.id, plugin.setup()]));", "const { default: plugin } = await import(process.argv[1]); console.log(JSON.stringify([plugin.id, plugin.setup()]));",
join(config, "plugins", "stanp-opencode"), join(config, "plugins", "stanp-opencode.js"),
], ],
directory, directory,
env, env,
@@ -184,6 +184,7 @@ test("installs an importable native plugin under XDG without changing user confi
stdout: '["stanp-opencode","native-ready"]\n', stdout: '["stanp-opencode","native-ready"]\n',
}); });
expect(await readFile(join(config, "opencode.jsonc"), "utf8")).toBe(configContents); expect(await readFile(join(config, "opencode.jsonc"), "utf8")).toBe(configContents);
expect(await Bun.file(join(config, "plugins", "stanp-opencode")).exists()).toBe(false);
expect( expect(
await readFile(join(config, "stanp-opencode", "install.previous", "index.js"), "utf8"), await readFile(join(config, "stanp-opencode", "install.previous", "index.js"), "utf8"),
).toBe(previousPlugin); ).toBe(previousPlugin);