#!/usr/bin/env node /** * Version bump utility * Usage: node scripts/version.js [patch|minor|major] */ const fs = require('fs'); const path = require('path'); const pkgPath = path.join(__dirname, '../package.json'); const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8')); const [,, bump = 'patch'] = process.argv; const [major, minor, patch] = pkg.version.split('.').map(Number); let newVersion; switch (bump) { case 'major': newVersion = `${major + 1}.0.0`; break; case 'minor': newVersion = `${major}.${minor + 1}.0`; break; case 'patch': newVersion = `${major}.${minor}.${patch + 1}`; break; default: console.error('Usage: node scripts/version.js [patch|minor|major]'); process.exit(1); } pkg.version = newVersion; fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n'); console.log(`🔖 Version bumped: ${pkg.version} → ${newVersion}`); console.log(' Run: git add package.json && git commit -m "release: v' + newVersion + '"');