brainy/cortex-wrapper.js
David Snelling 0fef72aa24 feat: add Cortex CLI, augmentation system, and enterprise features
Major enhancements to Brainy vector + graph database:

Core Features (FREE):
- Cortex CLI: Complete command center for database management
- Neural Import: AI-powered data understanding and entity extraction
- Augmentation Pipeline: 8-stage extensible processing system
- Brainy Chat: Natural language interface to query data
- Performance monitoring and health diagnostics
- Backup/restore with compression and encryption
- Webhook system for enterprise integrations

Infrastructure:
- Clean separation of core (open source) and premium features
- Lazy-loaded augmentations with zero performance impact
- Comprehensive documentation for all new features
- Full TypeScript support with proper interfaces

Performance:
- Zero impact on core operations (proven with benchmarks)
- 2-3% performance improvement from better caching
- Package size remains at 643KB (no bloat)

Security:
- Removed sensitive files from Git history
- Added .gitignore rules for PDFs and private files
- Premium features in separate private repository

Premium Features (separate repository):
- Quantum Vault connectors (Notion, Salesforce, Slack, Asana)
- Licensing system for premium augmentations
- Revenue projections and business model

This commit maintains 100% backward compatibility while adding
powerful enterprise features as progressive enhancements.
2025-08-07 19:33:03 -07:00

50 lines
No EOL
1.5 KiB
JavaScript

#!/usr/bin/env node
// Wrapper to ensure Cortex commands exit properly
import { Cortex } from './dist/cortex/cortex.js'
// Create Cortex instance
const cortex = new Cortex()
// Wrap all methods to ensure process exits
const wrapMethod = (method) => {
return async (...args) => {
try {
await method.call(cortex, ...args)
// Exit after successful completion
setTimeout(() => process.exit(0), 100)
} catch (error) {
console.error(error)
process.exit(1)
}
}
}
// Export wrapped Cortex
export const wrappedCortex = {
init: wrapMethod(cortex.init),
chat: cortex.chat.bind(cortex), // Interactive, handle differently
add: wrapMethod(cortex.add),
search: wrapMethod(cortex.search),
advancedSearch: cortex.advancedSearch.bind(cortex), // Interactive
addVerb: wrapMethod(cortex.addVerb),
explore: cortex.explore.bind(cortex), // Interactive
configSet: wrapMethod(cortex.configSet),
configGet: wrapMethod(cortex.configGet),
configList: wrapMethod(cortex.configList),
migrate: wrapMethod(cortex.migrate),
stats: wrapMethod(cortex.stats),
listFields: wrapMethod(cortex.listFields),
setupLLM: cortex.setupLLM.bind(cortex), // Interactive
embed: wrapMethod(cortex.embed),
similarity: wrapMethod(cortex.similarity),
importEnv: wrapMethod(cortex.importEnv),
exportEnv: wrapMethod(cortex.exportEnv),
backup: wrapMethod(cortex.backup),
restore: wrapMethod(cortex.restore),
health: wrapMethod(cortex.health),
delete: wrapMethod(cortex.delete),
update: wrapMethod(cortex.update)
}
export default wrappedCortex