diff --git a/scripts/sync-plugin-versions.ts b/scripts/sync-plugin-versions.ts index 803659806c7..052f9f114a5 100644 --- a/scripts/sync-plugin-versions.ts +++ b/scripts/sync-plugin-versions.ts @@ -68,6 +68,10 @@ function syncBuildOpenClawVersion(pkg: PackageJson, targetVersion: string): bool return true; } +function changelogVersionForPackageVersion(version: string): string { + return version.replace(/-beta\.\d+$/u, ""); +} + function ensureChangelogEntry(changelogPath: string, version: string, write: boolean): boolean { if (!existsSync(changelogPath)) { return false; @@ -127,7 +131,8 @@ export function syncPluginVersions( } const changelogPath = join(extensionsDir, dir.name, "CHANGELOG.md"); - if (ensureChangelogEntry(changelogPath, targetVersion, write)) { + const changelogVersion = changelogVersionForPackageVersion(targetVersion); + if (ensureChangelogEntry(changelogPath, changelogVersion, write)) { changelogged.push(pkg.name); } diff --git a/src/scripts/sync-plugin-versions.test.ts b/src/scripts/sync-plugin-versions.test.ts index e5dfd465948..61078d51391 100644 --- a/src/scripts/sync-plugin-versions.test.ts +++ b/src/scripts/sync-plugin-versions.test.ts @@ -112,4 +112,34 @@ describe("syncPluginVersions", () => { expect(unchangedPackage.peerDependencies?.openclaw).toBe(">=2026.4.1"); expect(unchangedPackage.openclaw?.compat?.pluginApi).toBe(">=2026.4.1"); }); + + it("uses the base release version for beta changelog entries", () => { + const rootDir = makeTempDir(tempDirs, "openclaw-sync-plugin-versions-beta-changelog-"); + + writeJson(path.join(rootDir, "package.json"), { + name: "openclaw", + version: "2026.5.3-beta.1", + }); + writeJson(path.join(rootDir, "extensions/matrix/package.json"), { + name: "@openclaw/matrix", + version: "2026.5.3-beta.1", + }); + fs.mkdirSync(path.join(rootDir, "extensions/matrix"), { recursive: true }); + fs.writeFileSync( + path.join(rootDir, "extensions/matrix/CHANGELOG.md"), + "# Changelog\n\n## 2026.5.2\n\n### Changes\n\n- Previous release.\n", + "utf8", + ); + + const summary = syncPluginVersions(rootDir); + const changelog = fs.readFileSync(path.join(rootDir, "extensions/matrix/CHANGELOG.md"), "utf8"); + + expect(summary.changelogged).toEqual(["@openclaw/matrix"]); + expect(changelog).toContain("## 2026.5.3\n\n### Changes\n- Version alignment"); + expect(changelog).not.toContain("## 2026.5.3-beta.1"); + + const checkSummary = syncPluginVersions(rootDir, { write: false }); + + expect(checkSummary.changelogged).toEqual([]); + }); });