chore: fix --version weird error

This commit is contained in:
Ralph Khreish
2025-09-23 11:45:46 +02:00
parent 100482722f
commit 6bbd777552
3 changed files with 20 additions and 26 deletions

View File

@@ -5079,25 +5079,7 @@ function setupCLI() {
const programInstance = new Command()
.name('dev')
.description('AI-driven development task management')
.version(() => {
// Read version directly from package.json ONLY
try {
const packageJsonPath = path.join(process.cwd(), 'package.json');
if (fs.existsSync(packageJsonPath)) {
const packageJson = JSON.parse(
fs.readFileSync(packageJsonPath, 'utf8')
);
return packageJson.version;
}
} catch (error) {
// Silently fall back to 'unknown'
log(
'warn',
'Could not read package.json for version info in .version()'
);
}
return 'unknown'; // Default fallback if package.json fails
})
.version(process.env.TM_PUBLIC_VERSION || 'unknown')
.helpOption('-h, --help', 'Display help')
.addHelpCommand(false); // Disable default help command