feat(release-tooling): support beta/rc prerelease versions

set-version.js now accepts an optional -beta.N / -rc.N suffix (beta and rc only). The version-format pattern moves to a single source — scripts/version-regex.js — consumed by set-version.js (input gate + config.ts footer write) and pre-deploy.ts (footer parse); qa-check.sh's bash copy is widened to match, so prerelease versions no longer trip a false version-mismatch.
This commit is contained in:
Charles Wiltgen
2026-06-12 09:57:10 -07:00
parent ff60d327de
commit bc48c7366f
4 changed files with 20 additions and 5 deletions
+2 -1
View File
@@ -13,6 +13,7 @@
import fs from "node:fs";
import path from "node:path";
import { execSync } from "node:child_process";
import { VERSION_CORE } from "./version-regex.js";
import { scanReferencedToolBinaries } from "../axiom-mcp/src/scripts/binary-coverage.ts";
import { MCP_TOOL_BINARIES } from "../axiom-mcp/src/tools/binaries.ts";
import {
@@ -445,7 +446,7 @@ if (fs.existsSync(metadataPath)) {
const configPath = path.join(root, "docs/.vitepress/config.ts");
if (fs.existsSync(configPath)) {
const configContent = fs.readFileSync(configPath, "utf8");
const vMatch = configContent.match(/• v(\d+\.\d+\.\d+)/);
const vMatch = configContent.match(new RegExp(`• v(${VERSION_CORE})`));
if (vMatch) versions["config.ts"] = vMatch[1];
else warn("version", "Version not found in docs/.vitepress/config.ts footer");
}
+1 -1
View File
@@ -78,7 +78,7 @@ echo "🔢 Checking version consistency..."
PLUGIN_VERSION=$(node -e "console.log(require('./.claude-plugin/plugins/axiom/claude-code.json').version)")
MARKETPLACE_VERSION=$(node -e "console.log(require('./.claude-plugin/marketplace.json').plugins[0].version)")
# VitePress version is in the footer copyright - extract from built site or config
VITEPRESS_VERSION=$(grep -o "v[0-9]\+\.[0-9]\+\.[0-9]\+" docs/.vitepress/config.ts | head -1 | sed 's/v//' || echo "$PLUGIN_VERSION")
VITEPRESS_VERSION=$(grep -oE "v[0-9]+\.[0-9]+\.[0-9]+(-(beta|rc)\.[0-9]+)?" docs/.vitepress/config.ts | head -1 | sed 's/v//' || echo "$PLUGIN_VERSION")
echo " Plugin: $PLUGIN_VERSION"
echo " Marketplace: $MARKETPLACE_VERSION"
+5 -3
View File
@@ -3,6 +3,7 @@ import fs from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
import { execSync } from 'node:child_process';
import { VERSION_RE, VERSION_CORE } from './version-regex.js';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
@@ -12,9 +13,10 @@ const args = process.argv.slice(2);
const tagFlag = args.includes('--tag');
const version = args.find(a => !a.startsWith('-'));
if (!version?.match(/^\d+\.\d+\.\d+$/)) {
console.error('❌ Usage: node set-version.js X.Y.Z [--tag]');
if (!version?.match(VERSION_RE)) {
console.error('❌ Usage: node set-version.js X.Y.Z[-beta.N|-rc.N] [--tag]');
console.error(' Example: node set-version.js 0.9.37');
console.error(' Example: node set-version.js 27.0.0-beta.1 (prerelease — beta/rc only)');
console.error(' Example: node set-version.js 0.9.37 --tag (also creates annotated git tag v0.9.37)');
process.exit(1);
}
@@ -332,7 +334,7 @@ try {
throw new Error(`VitePress config not found: ${configPath}`);
}
let configContent = fs.readFileSync(configPath, 'utf8');
const versionRegex = /(copyright: '[^']*• v)(\d+\.\d+\.\d+)(')/;
const versionRegex = new RegExp(`(copyright: '[^']*• v)(${VERSION_CORE})(')`);
if (!versionRegex.test(configContent)) {
throw new Error('Version string not found in config.ts footer');
}
+12
View File
@@ -0,0 +1,12 @@
// Shared version-format pattern for Axiom's release tooling.
//
// Accepts `X.Y.Z` with an optional `-beta.N` / `-rc.N` prerelease suffix
// (beta and rc only — no alpha, no arbitrary identifiers). Kept in one place so
// the three JS/TS sites that must agree cannot drift:
// - set-version.js — input validation (anchored) AND the config.ts footer WRITE
// - pre-deploy.ts — the config.ts footer PARSE for the version-parity gate
//
// scripts/qa-check.sh has its own bash copy of this pattern (it can't import JS);
// keep it in sync by hand if this changes.
export const VERSION_CORE = String.raw`\d+\.\d+\.\d+(?:-(?:beta|rc)\.\d+)?`;
export const VERSION_RE = new RegExp(`^${VERSION_CORE}$`);