From 066eefa7f85752c518977e06b094ebdbdb366ac5 Mon Sep 17 00:00:00 2001 From: rUv Date: Tue, 5 Aug 2025 20:10:22 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=96=20Checkpoint:=20Edit=20/workspaces?= =?UTF-8?q?/claude-code-flow/src/core/version.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/checkpoints/task-1754424604.json | 1 + src/core/version.ts | 41 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 .claude/checkpoints/task-1754424604.json create mode 100644 src/core/version.ts diff --git a/.claude/checkpoints/task-1754424604.json b/.claude/checkpoints/task-1754424604.json new file mode 100644 index 0000000000..32e0853e08 --- /dev/null +++ b/.claude/checkpoints/task-1754424604.json @@ -0,0 +1 @@ +{"checkpoint": "task-20250805-201003", "task": "{{user_prompt}} ", "timestamp": "2025-08-05T20:10:04Z", "commit": "4222cd4e92d659659198d0ce1c5c4c7628cd0cf2", "github_release": "true"} diff --git a/src/core/version.ts b/src/core/version.ts new file mode 100644 index 0000000000..47dbdc836e --- /dev/null +++ b/src/core/version.ts @@ -0,0 +1,41 @@ +/** + * Centralized version management + * Reads version from package.json to ensure consistency + */ + +import { readFileSync } from 'fs'; +import { join, dirname } from 'path'; +import { fileURLToPath } from 'url'; + +// Get the directory of this module +const __filename = fileURLToPath(import.meta.url); +const __dirname = dirname(__filename); + +// Read version from package.json +let VERSION: string; +let BUILD_DATE: string; + +try { + // Navigate to project root and read package.json + const packageJsonPath = join(__dirname, '../../package.json'); + const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8')); + VERSION = packageJson.version; + BUILD_DATE = new Date().toISOString().split('T')[0]; +} catch (error) { + // Fallback version if package.json can't be read + console.warn('Warning: Could not read version from package.json, using fallback'); + VERSION = '2.0.0-alpha.87'; + BUILD_DATE = new Date().toISOString().split('T')[0]; +} + +export { VERSION, BUILD_DATE }; + +// Helper function to get formatted version string +export function getVersionString(includeV = true): string { + return includeV ? `v${VERSION}` : VERSION; +} + +// Helper function for version display in CLI +export function displayVersion(): void { + console.log(getVersionString()); +} \ No newline at end of file