#!/usr/bin/env node
// check-pear-version.js - Check Pear runtime version
//
// This script checks the current Pear runtime and Bare version.
// WDK now uses bare-node-runtime/global for compatibility, so no shims needed.
//
// Run this to check versions:
// node check-pear-version.js
import { execSync } from 'child_process'
function stripAnsi(str) {
// Remove ANSI escape codes
return str.replace(/\x1b\[[0-9;]*m/g, '')
}
function parseBareVersion(versionOutput) {
// Strip ANSI codes first
const clean = stripAnsi(versionOutput)
// Parse output like: "bare: 1.24.3"
const match = clean.match(/bare:\s*(\d+\.\d+\.\d+)/)
return match ? match[1] : null
}
try {
// Get Pear versions
const output = execSync('pear versions', { encoding: 'utf8' })
const bareVersion = parseBareVersion(output)
if (!bareVersion) {
console.log('⚠️ Could not detect Bare version from Pear runtime')
process.exit(0)
}
console.log(`Current Pear runtime: Bare v${bareVersion}`)
console.log('')
console.log('✅ WDK compatibility: Using bare-node-runtime/global')
console.log(' No shims needed - direct imports work with Bare v1.24.3+')
console.log('')
process.exit(0)
} catch (err) {
console.error('❌ Error checking Pear version:', err.message)
process.exit(0)
}