fix: add minimum bun version check to smart-install.js
Bun 1.1.14+ is required because: - `.changes` property on SQLite statements (added in 1.1.14) - Multi-statement SQL support in db.run() (fixed in 1.0.26) Older versions cause silent failures in database migrations. Fixes #519 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,36 @@ function getBunPath() {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Minimum required bun version
|
||||||
|
* v1.1.14+ required for .changes property and multi-statement SQL support
|
||||||
|
*/
|
||||||
|
const MIN_BUN_VERSION = '1.1.14';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compare semver versions
|
||||||
|
*/
|
||||||
|
function compareVersions(v1, v2) {
|
||||||
|
const parts1 = v1.split('.').map(Number);
|
||||||
|
const parts2 = v2.split('.').map(Number);
|
||||||
|
for (let i = 0; i < 3; i++) {
|
||||||
|
const p1 = parts1[i] || 0;
|
||||||
|
const p2 = parts2[i] || 0;
|
||||||
|
if (p1 > p2) return 1;
|
||||||
|
if (p1 < p2) return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check if bun version meets minimum requirements
|
||||||
|
*/
|
||||||
|
function isBunVersionSufficient() {
|
||||||
|
const version = getBunVersion();
|
||||||
|
if (!version) return false;
|
||||||
|
return compareVersions(version, MIN_BUN_VERSION) >= 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get Bun version if installed
|
* Get Bun version if installed
|
||||||
*/
|
*/
|
||||||
@@ -377,7 +407,7 @@ function installDeps() {
|
|||||||
|
|
||||||
// Main execution
|
// Main execution
|
||||||
try {
|
try {
|
||||||
// Step 1: Ensure Bun is installed (REQUIRED)
|
// Step 1: Ensure Bun is installed and meets minimum version (REQUIRED)
|
||||||
if (!isBunInstalled()) {
|
if (!isBunInstalled()) {
|
||||||
installBun();
|
installBun();
|
||||||
|
|
||||||
@@ -389,6 +419,25 @@ try {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Step 1.5: Ensure Bun version is sufficient
|
||||||
|
if (!isBunVersionSufficient()) {
|
||||||
|
const currentVersion = getBunVersion();
|
||||||
|
console.error(`⚠️ Bun ${currentVersion} is outdated. Minimum required: ${MIN_BUN_VERSION}`);
|
||||||
|
console.error(' Upgrading bun...');
|
||||||
|
try {
|
||||||
|
execSync('bun upgrade', { stdio: 'inherit', shell: IS_WINDOWS });
|
||||||
|
if (!isBunVersionSufficient()) {
|
||||||
|
console.error(`❌ Bun upgrade failed. Please manually upgrade: bun upgrade`);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
console.error(`✅ Bun upgraded to ${getBunVersion()}`);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(`❌ Failed to upgrade bun: ${error.message}`);
|
||||||
|
console.error(' Please manually upgrade: bun upgrade');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Step 2: Ensure uv is installed (REQUIRED for vector search)
|
// Step 2: Ensure uv is installed (REQUIRED for vector search)
|
||||||
if (!isUvInstalled()) {
|
if (!isUvInstalled()) {
|
||||||
installUv();
|
installUv();
|
||||||
|
|||||||
Reference in New Issue
Block a user