🔖 Checkpoint: Edit /workspaces/claude-code-flow/src/core/version.ts

This commit is contained in:
rUv committed 2025-08-05 20:10:22 +00:00
1 parent c6e3efedfb
commit 066eefa7f8
2 files changed
+42

No files matched your search

+1
View File
@@ -0,0 +1 @@
{"checkpoint": "task-20250805-201003", "task": "{{user_prompt}} ", "timestamp": "2025-08-05T20:10:04Z", "commit": "4222cd4e92d659659198d0ce1c5c4c7628cd0cf2", "github_release": "true"}
+41
View File
@@ -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());
}