fix: sync install architecture version examples

This commit is contained in:
Affaan Mustafa
2026-04-12 03:00:44 -07:00
parent 0233203415
commit ee7ea98e1a
2 changed files with 31 additions and 2 deletions

View File

@@ -20,6 +20,7 @@ OPENCODE_PACKAGE_JSON=".opencode/package.json"
OPENCODE_PACKAGE_LOCK_JSON=".opencode/package-lock.json" OPENCODE_PACKAGE_LOCK_JSON=".opencode/package-lock.json"
README_FILE="README.md" README_FILE="README.md"
ZH_CN_README_FILE="docs/zh-CN/README.md" ZH_CN_README_FILE="docs/zh-CN/README.md"
SELECTIVE_INSTALL_ARCHITECTURE_DOC="docs/SELECTIVE-INSTALL-ARCHITECTURE.md"
# Function to show usage # Function to show usage
usage() { usage() {
@@ -54,7 +55,7 @@ if [[ -n "$(git status --porcelain --untracked-files=all)" ]]; then
fi fi
# Verify versioned manifests exist # 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 if [[ ! -f "$FILE" ]]; then
echo "Error: $FILE not found" echo "Error: $FILE not found"
exit 1 exit 1
@@ -125,6 +126,25 @@ update_readme_version_row() {
' "$file" "$VERSION" "$label" ' "$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() { update_agents_version() {
local file="$1" local file="$1"
local label="$2" local label="$2"
@@ -204,13 +224,14 @@ update_version "$OPENCODE_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\":
update_package_lock_version "$OPENCODE_PACKAGE_LOCK_JSON" update_package_lock_version "$OPENCODE_PACKAGE_LOCK_JSON"
update_readme_version_row "$README_FILE" "Version" update_readme_version_row "$README_FILE" "Version"
update_readme_version_row "$ZH_CN_README_FILE" "版本" 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 # Verify the bumped release surface is still internally consistent before
# writing a release commit, tag, or push. # writing a release commit, tag, or push.
node tests/plugin-manifest.test.js node tests/plugin-manifest.test.js
# Stage, commit, tag, and push # 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 commit -m "chore: bump plugin version to $VERSION"
git tag "v$VERSION" git tag "v$VERSION"
git push origin main "v$VERSION" git push origin main "v$VERSION"

View File

@@ -28,6 +28,7 @@ const zhCnAgentsPath = path.join(repoRoot, 'docs', 'zh-CN', 'AGENTS.md');
const agentYamlPath = path.join(repoRoot, 'agent.yaml'); const agentYamlPath = path.join(repoRoot, 'agent.yaml');
const versionFilePath = path.join(repoRoot, 'VERSION'); const versionFilePath = path.join(repoRoot, 'VERSION');
const zhCnReadmePath = path.join(repoRoot, 'docs', 'zh-CN', 'README.md'); 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 opencodePackageJsonPath = path.join(repoRoot, '.opencode', 'package.json');
const opencodePackageLockPath = path.join(repoRoot, '.opencode', 'package-lock.json'); const opencodePackageLockPath = path.join(repoRoot, '.opencode', 'package-lock.json');
@@ -123,6 +124,13 @@ test('VERSION file matches package.json', () => {
assert.strictEqual(versionFile, expectedVersion); 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 ──────────────────────────────────────────────────── // ── Claude plugin manifest ────────────────────────────────────────────────────
console.log('\n=== .claude-plugin/plugin.json ===\n'); console.log('\n=== .claude-plugin/plugin.json ===\n');