@ghostspeak/cli
Version:
Command-line interface for GhostSpeak AI Agent Commerce Protocol - Production Ready Beta
46 lines (39 loc) • 1.31 kB
JavaScript
import { fileURLToPath } from 'url'
import { dirname, join } from 'path'
import { existsSync, symlinkSync, unlinkSync } from 'fs'
import { execSync } from 'child_process'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
// Only run postinstall for global installations
function isGlobalInstall() {
try {
const npmPrefix = execSync('npm prefix -g', { encoding: 'utf-8' }).trim()
const currentPath = process.cwd()
return currentPath.includes(npmPrefix)
} catch {
return false
}
}
function setupGlobalCommands() {
if (!isGlobalInstall()) {
console.log('📦 GhostSpeak CLI installed locally')
return
}
console.log('🚀 Setting up global GhostSpeak commands...')
try {
// The bin field in package.json should handle this automatically
console.log('✅ Commands registered:')
console.log(' - ghostspeak')
console.log(' - gs (alias)')
console.log('')
console.log('💡 You can now use:')
console.log(' $ ghostspeak <command>')
console.log(' $ gs <command>')
} catch (error) {
console.error('⚠️ Warning: Could not verify command installation')
console.error(' You may need to add npm global bin to your PATH')
}
}
// Run setup
setupGlobalCommands()