mirror of
https://github.com/affaan-m/everything-claude-code.git
synced 2026-04-13 21:33:32 +08:00
fix: keep localized release docs version-synced
This commit is contained in:
@@ -8,6 +8,8 @@ VERSION="${1:-}"
|
|||||||
ROOT_PACKAGE_JSON="package.json"
|
ROOT_PACKAGE_JSON="package.json"
|
||||||
PACKAGE_LOCK_JSON="package-lock.json"
|
PACKAGE_LOCK_JSON="package-lock.json"
|
||||||
ROOT_AGENTS_MD="AGENTS.md"
|
ROOT_AGENTS_MD="AGENTS.md"
|
||||||
|
TR_AGENTS_MD="docs/tr/AGENTS.md"
|
||||||
|
ZH_CN_AGENTS_MD="docs/zh-CN/AGENTS.md"
|
||||||
AGENT_YAML="agent.yaml"
|
AGENT_YAML="agent.yaml"
|
||||||
VERSION_FILE="VERSION"
|
VERSION_FILE="VERSION"
|
||||||
PLUGIN_JSON=".claude-plugin/plugin.json"
|
PLUGIN_JSON=".claude-plugin/plugin.json"
|
||||||
@@ -17,6 +19,7 @@ CODEX_PLUGIN_JSON=".codex-plugin/plugin.json"
|
|||||||
OPENCODE_PACKAGE_JSON=".opencode/package.json"
|
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"
|
||||||
|
|
||||||
# Function to show usage
|
# Function to show usage
|
||||||
usage() {
|
usage() {
|
||||||
@@ -51,7 +54,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" "$AGENT_YAML" "$VERSION_FILE" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$OPENCODE_PACKAGE_LOCK_JSON" "$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"; do
|
||||||
if [[ ! -f "$FILE" ]]; then
|
if [[ ! -f "$FILE" ]]; then
|
||||||
echo "Error: $FILE not found"
|
echo "Error: $FILE not found"
|
||||||
exit 1
|
exit 1
|
||||||
@@ -102,39 +105,45 @@ update_package_lock_version() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_readme_version_row() {
|
update_readme_version_row() {
|
||||||
|
local file="$1"
|
||||||
|
local label="$2"
|
||||||
node -e '
|
node -e '
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const file = process.argv[1];
|
const file = process.argv[1];
|
||||||
const version = process.argv[2];
|
const version = process.argv[2];
|
||||||
|
const label = process.argv[3];
|
||||||
const current = fs.readFileSync(file, "utf8");
|
const current = fs.readFileSync(file, "utf8");
|
||||||
const updated = current.replace(
|
const updated = current.replace(
|
||||||
/^\| \*\*Version\*\* \| Plugin \| Plugin \| Reference config \| [0-9][0-9.]* \|$/m,
|
new RegExp(`^\\| \\*\\*${label}\\*\\* \\| Plugin \\| Plugin \\| Reference config \\| [0-9][0-9.]* \\|$`, "m"),
|
||||||
`| **Version** | Plugin | Plugin | Reference config | ${version} |`
|
`| **${label}** | Plugin | Plugin | Reference config | ${version} |`
|
||||||
);
|
);
|
||||||
if (updated === current) {
|
if (updated === current) {
|
||||||
console.error(`Error: could not update README version row in ${file}`);
|
console.error(`Error: could not update README version row in ${file}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
fs.writeFileSync(file, updated);
|
fs.writeFileSync(file, updated);
|
||||||
' "$README_FILE" "$VERSION"
|
' "$file" "$VERSION" "$label"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_agents_version() {
|
update_agents_version() {
|
||||||
|
local file="$1"
|
||||||
|
local label="$2"
|
||||||
node -e '
|
node -e '
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const file = process.argv[1];
|
const file = process.argv[1];
|
||||||
const version = process.argv[2];
|
const version = process.argv[2];
|
||||||
|
const label = process.argv[3];
|
||||||
const current = fs.readFileSync(file, "utf8");
|
const current = fs.readFileSync(file, "utf8");
|
||||||
const updated = current.replace(
|
const updated = current.replace(
|
||||||
/^\*\*Version:\*\* [0-9][0-9.]*$/m,
|
new RegExp(`^\\*\\*${label}:\\*\\* [0-9][0-9.]*$`, "m"),
|
||||||
`**Version:** ${version}`
|
`**${label}:** ${version}`
|
||||||
);
|
);
|
||||||
if (updated === current) {
|
if (updated === current) {
|
||||||
console.error(`Error: could not update AGENTS version line in ${file}`);
|
console.error(`Error: could not update AGENTS version line in ${file}`);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
fs.writeFileSync(file, updated);
|
fs.writeFileSync(file, updated);
|
||||||
' "$ROOT_AGENTS_MD" "$VERSION"
|
' "$file" "$VERSION" "$label"
|
||||||
}
|
}
|
||||||
|
|
||||||
update_agent_yaml_version() {
|
update_agent_yaml_version() {
|
||||||
@@ -182,7 +191,9 @@ update_codex_marketplace_version() {
|
|||||||
# Update all shipped package/plugin manifests
|
# Update all shipped package/plugin manifests
|
||||||
update_version "$ROOT_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$ROOT_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
update_package_lock_version "$PACKAGE_LOCK_JSON"
|
update_package_lock_version "$PACKAGE_LOCK_JSON"
|
||||||
update_agents_version
|
update_agents_version "$ROOT_AGENTS_MD" "Version"
|
||||||
|
update_agents_version "$TR_AGENTS_MD" "Sürüm"
|
||||||
|
update_agents_version "$ZH_CN_AGENTS_MD" "版本"
|
||||||
update_agent_yaml_version
|
update_agent_yaml_version
|
||||||
update_version_file
|
update_version_file
|
||||||
update_version "$PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
@@ -191,14 +202,15 @@ update_codex_marketplace_version
|
|||||||
update_version "$CODEX_PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$CODEX_PLUGIN_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
update_version "$OPENCODE_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
update_version "$OPENCODE_PACKAGE_JSON" "s|\"version\": *\"[^\"]*\"|\"version\": \"$VERSION\"|"
|
||||||
update_package_lock_version "$OPENCODE_PACKAGE_LOCK_JSON"
|
update_package_lock_version "$OPENCODE_PACKAGE_LOCK_JSON"
|
||||||
update_readme_version_row
|
update_readme_version_row "$README_FILE" "Version"
|
||||||
|
update_readme_version_row "$ZH_CN_README_FILE" "版本"
|
||||||
|
|
||||||
# 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" "$AGENT_YAML" "$VERSION_FILE" "$PLUGIN_JSON" "$MARKETPLACE_JSON" "$CODEX_MARKETPLACE_JSON" "$CODEX_PLUGIN_JSON" "$OPENCODE_PACKAGE_JSON" "$OPENCODE_PACKAGE_LOCK_JSON" "$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"
|
||||||
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"
|
||||||
|
|||||||
@@ -23,8 +23,11 @@ const repoRootWithSep = `${repoRoot}${path.sep}`;
|
|||||||
const packageJsonPath = path.join(repoRoot, 'package.json');
|
const packageJsonPath = path.join(repoRoot, 'package.json');
|
||||||
const packageLockPath = path.join(repoRoot, 'package-lock.json');
|
const packageLockPath = path.join(repoRoot, 'package-lock.json');
|
||||||
const rootAgentsPath = path.join(repoRoot, 'AGENTS.md');
|
const rootAgentsPath = path.join(repoRoot, 'AGENTS.md');
|
||||||
|
const trAgentsPath = path.join(repoRoot, 'docs', 'tr', 'AGENTS.md');
|
||||||
|
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 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');
|
||||||
|
|
||||||
@@ -93,6 +96,20 @@ test('AGENTS.md version line matches package.json', () => {
|
|||||||
assert.strictEqual(match[1], expectedVersion);
|
assert.strictEqual(match[1], expectedVersion);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('docs/tr/AGENTS.md version line matches package.json', () => {
|
||||||
|
const agentsSource = fs.readFileSync(trAgentsPath, 'utf8');
|
||||||
|
const match = agentsSource.match(/^\*\*Sürüm:\*\* ([0-9][0-9.]*)$/m);
|
||||||
|
assert.ok(match, 'Expected docs/tr/AGENTS.md to declare a top-level version line');
|
||||||
|
assert.strictEqual(match[1], expectedVersion);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('docs/zh-CN/AGENTS.md version line matches package.json', () => {
|
||||||
|
const agentsSource = fs.readFileSync(zhCnAgentsPath, 'utf8');
|
||||||
|
const match = agentsSource.match(/^\*\*版本:\*\* ([0-9][0-9.]*)$/m);
|
||||||
|
assert.ok(match, 'Expected docs/zh-CN/AGENTS.md to declare a top-level version line');
|
||||||
|
assert.strictEqual(match[1], expectedVersion);
|
||||||
|
});
|
||||||
|
|
||||||
test('agent.yaml version matches package.json', () => {
|
test('agent.yaml version matches package.json', () => {
|
||||||
const agentYamlSource = fs.readFileSync(agentYamlPath, 'utf8');
|
const agentYamlSource = fs.readFileSync(agentYamlPath, 'utf8');
|
||||||
const match = agentYamlSource.match(/^version:\s*([0-9][0-9.]*)$/m);
|
const match = agentYamlSource.match(/^version:\s*([0-9][0-9.]*)$/m);
|
||||||
@@ -394,6 +411,13 @@ test('README version row matches package.json', () => {
|
|||||||
assert.strictEqual(match[1], expectedVersion);
|
assert.strictEqual(match[1], expectedVersion);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('docs/zh-CN/README.md version row matches package.json', () => {
|
||||||
|
const readme = fs.readFileSync(zhCnReadmePath, 'utf8');
|
||||||
|
const match = readme.match(/^\| \*\*版本\*\* \| 插件 \| 插件 \| 参考配置 \| ([0-9][0-9.]*) \|$/m);
|
||||||
|
assert.ok(match, 'Expected docs/zh-CN/README.md version summary row');
|
||||||
|
assert.strictEqual(match[1], expectedVersion);
|
||||||
|
});
|
||||||
|
|
||||||
// ── Summary ───────────────────────────────────────────────────────────────────
|
// ── Summary ───────────────────────────────────────────────────────────────────
|
||||||
console.log(`\nPassed: ${passed}`);
|
console.log(`\nPassed: ${passed}`);
|
||||||
console.log(`Failed: ${failed}`);
|
console.log(`Failed: ${failed}`);
|
||||||
|
|||||||
Reference in New Issue
Block a user