From ee7ea98e1aba600046867ef956001f76df74da91 Mon Sep 17 00:00:00 2001 From: Affaan Mustafa Date: Sun, 12 Apr 2026 03:00:44 -0700 Subject: [PATCH] fix: sync install architecture version examples --- scripts/release.sh | 25 +++++++++++++++++++++++-- tests/plugin-manifest.test.js | 8 ++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/scripts/release.sh b/scripts/release.sh index e1ebfdb1..27377222 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -20,6 +20,7 @@ OPENCODE_PACKAGE_JSON=".opencode/package.json" OPENCODE_PACKAGE_LOCK_JSON=".opencode/package-lock.json" README_FILE="README.md" ZH_CN_README_FILE="docs/zh-CN/README.md" +SELECTIVE_INSTALL_ARCHITECTURE_DOC="docs/SELECTIVE-INSTALL-ARCHITECTURE.md" # Function to show usage usage() { @@ -54,7 +55,7 @@ if [[ -n "$(git status --porcelain --untracked-files=all)" ]]; then fi # Verify versioned manifests exist -for FILE in "$ROOT_PACKAGE_JSON" "$PACKAGE_LOCK_JSON" "$ROOT_AGENTS_MD" "$TR_AGENTS_MD" "$ZH_CN_AGENTS_MD" "$AGENT_YAML" "$VERSION_FILE" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$OPENCODE_PACKAGE_LOCK_JSON" "$README_FILE" "$ZH_CN_README_FILE"; do +for FILE in "$ROOT_PACKAGE_JSON" "$PACKAGE_LOCK_JSON" "$ROOT_AGENTS_MD" "$TR_AGENTS_MD" "$ZH_CN_AGENTS_MD" "$AGENT_YAML" "$VERSION_FILE" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$OPENCODE_PACKAGE_LOCK_JSON" "$README_FILE" "$ZH_CN_README_FILE" "$SELECTIVE_INSTALL_ARCHITECTURE_DOC"; do if [[ ! -f "$FILE" ]]; then echo "Error: $FILE not found" exit 1 @@ -125,6 +126,25 @@ update_readme_version_row() { ' "$file" "$VERSION" "$label" } +update_selective_install_repo_version() { + local file="$1" + node -e ' + const fs = require("fs"); + const file = process.argv[1]; + const version = process.argv[2]; + const current = fs.readFileSync(file, "utf8"); + const updated = current.replace( + /("repoVersion":\s*")[0-9][0-9.]*(")/, + `$1${version}$2` + ); + if (updated === current) { + console.error(`Error: could not update repoVersion example in ${file}`); + process.exit(1); + } + fs.writeFileSync(file, updated); + ' "$file" "$VERSION" +} + update_agents_version() { local file="$1" local label="$2" @@ -204,13 +224,14 @@ update_version "$OPENCODE_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": update_package_lock_version "$OPENCODE_PACKAGE_LOCK_JSON" update_readme_version_row "$README_FILE" "Version" update_readme_version_row "$ZH_CN_README_FILE" "版本" +update_selective_install_repo_version "$SELECTIVE_INSTALL_ARCHITECTURE_DOC" # Verify the bumped release surface is still internally consistent before # writing a release commit, tag, or push. node tests/plugin-manifest.test.js # Stage, commit, tag, and push -git add "$ROOT_PACKAGE_JSON" "$PACKAGE_LOCK_JSON" "$ROOT_AGENTS_MD" "$TR_AGENTS_MD" "$ZH_CN_AGENTS_MD" "$AGENT_YAML" "$VERSION_FILE" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$OPENCODE_PACKAGE_LOCK_JSON" "$README_FILE" "$ZH_CN_README_FILE" +git add "$ROOT_PACKAGE_JSON" "$PACKAGE_LOCK_JSON" "$ROOT_AGENTS_MD" "$TR_AGENTS_MD" "$ZH_CN_AGENTS_MD" "$AGENT_YAML" "$VERSION_FILE" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$OPENCODE_PACKAGE_LOCK_JSON" "$README_FILE" "$ZH_CN_README_FILE" "$SELECTIVE_INSTALL_ARCHITECTURE_DOC" git commit -m "chore: bump plugin version to $VERSION" git tag "v$VERSION" git push origin main "v$VERSION" diff --git a/tests/plugin-manifest.test.js b/tests/plugin-manifest.test.js index 1ea26fd8..b2b03888 100644 --- a/tests/plugin-manifest.test.js +++ b/tests/plugin-manifest.test.js @@ -28,6 +28,7 @@ const zhCnAgentsPath = path.join(repoRoot, 'docs', 'zh-CN', 'AGENTS.md'); const agentYamlPath = path.join(repoRoot, 'agent.yaml'); const versionFilePath = path.join(repoRoot, 'VERSION'); const zhCnReadmePath = path.join(repoRoot, 'docs', 'zh-CN', 'README.md'); +const selectiveInstallArchitecturePath = path.join(repoRoot, 'docs', 'SELECTIVE-INSTALL-ARCHITECTURE.md'); const opencodePackageJsonPath = path.join(repoRoot, '.opencode', 'package.json'); const opencodePackageLockPath = path.join(repoRoot, '.opencode', 'package-lock.json'); @@ -123,6 +124,13 @@ test('VERSION file matches package.json', () => { assert.strictEqual(versionFile, expectedVersion); }); +test('docs/SELECTIVE-INSTALL-ARCHITECTURE.md repoVersion example matches package.json', () => { + const source = fs.readFileSync(selectiveInstallArchitecturePath, 'utf8'); + const match = source.match(/"repoVersion":\s*"([0-9][0-9.]*)"/); + assert.ok(match, 'Expected docs/SELECTIVE-INSTALL-ARCHITECTURE.md to declare a repoVersion example'); + assert.strictEqual(match[1], expectedVersion); +}); + // ── Claude plugin manifest ──────────────────────────────────────────────────── console.log('\n=== .claude-plugin/plugin.json ===\n');