chore(release): 4.0.0

Major release: Enterprise-scale cost optimization and performance features

Features:
- Cloud storage lifecycle management (GCS Autoclass, AWS Intelligent-Tiering, Azure)
- Batch operations (1000x faster deletions: 533 entities/sec vs 0.5/sec)
- FileSystem compression (60-80% space savings with gzip)
- OPFS quota monitoring for browser storage
- Enhanced CLI system (47 commands, 9 storage management commands)

Cost Impact:
- Up to 96% storage cost savings
- $138,000/year → $5,940/year @ 500TB scale

Breaking Changes: NONE
- 100% backward compatible
- All new features are opt-in
- No migration required
This commit is contained in:
David Snelling 2025-10-17 14:47:53 -07:00
parent 92c96246fb
commit 00aae8023c
26 changed files with 9121 additions and 939 deletions

View file

@ -232,15 +232,52 @@ async function handleSimilarCommand(neural: any, argv: CommandArguments): Promis
}
async function handleClustersCommand(neural: any, argv: CommandArguments): Promise<void> {
const spinner = ora('🎯 Finding semantic clusters...').start()
let spinner: any = null
try {
const options = {
let options: any = {
algorithm: argv.algorithm as any,
threshold: argv.threshold,
maxClusters: argv.limit
}
// Interactive mode if no algorithm specified or using defaults
if (!argv.algorithm || argv.algorithm === 'hierarchical') {
const answers = await inquirer.prompt([
{
type: 'list',
name: 'algorithm',
message: 'Choose clustering algorithm:',
default: argv.algorithm || 'hierarchical',
choices: [
{ name: '🌳 Hierarchical (Tree-based, best for natural grouping)', value: 'hierarchical' },
{ name: '📊 K-Means (Fixed number of clusters)', value: 'kmeans' },
{ name: '🎯 DBSCAN (Density-based, finds arbitrary shapes)', value: 'dbscan' }
]
},
{
type: 'number',
name: 'maxClusters',
message: 'Maximum number of clusters:',
default: argv.limit || 5,
when: (answers: any) => answers.algorithm === 'kmeans'
},
{
type: 'number',
name: 'threshold',
message: 'Similarity threshold (0-1):',
default: argv.threshold || 0.7,
validate: (input: number) => (input >= 0 && input <= 1) || 'Must be between 0 and 1'
}
])
options = {
algorithm: answers.algorithm,
threshold: answers.threshold,
maxClusters: answers.maxClusters || options.maxClusters
}
}
const spinner = ora('🎯 Finding semantic clusters...').start()
const clusters = await neural.clusters(argv.query || options)
spinner.succeed(`✅ Found ${clusters.length} clusters`)
@ -271,9 +308,9 @@ async function handleClustersCommand(neural: any, argv: CommandArguments): Promi
if (argv.output) {
await saveToFile(argv.output, clusters, argv.format!)
}
} catch (error) {
spinner.fail('💥 Failed to find clusters')
if (spinner) spinner.fail('💥 Failed to find clusters')
throw error
}
}
@ -575,14 +612,97 @@ function showHelp(): void {
console.log('')
}
// Commander-compatible wrappers
export const neuralCommands = {
similar: handleSimilarCommand,
cluster: handleClustersCommand,
hierarchy: handleHierarchyCommand,
related: handleNeighborsCommand,
// path: handlePathCommand, // Coming in v3.21.0 - requires graph traversal implementation
outliers: handleOutliersCommand,
visualize: handleVisualizeCommand
async similar(a?: string, b?: string, options?: any) {
const brain = new Brainy()
const neural = brain.neural()
// Build argv-style object for handler
const argv: CommandArguments = {
_: ['neural', 'similar', a || '', b || ''].filter(x => x),
id: a,
query: b,
explain: options?.explain,
...options
}
await handleSimilarCommand(neural, argv)
},
async cluster(options?: any) {
const brain = new Brainy()
const neural = brain.neural()
const argv: CommandArguments = {
_: ['neural', 'cluster'],
algorithm: options?.algorithm || 'hierarchical',
threshold: options?.threshold ? parseFloat(options.threshold) : 0.7,
limit: options?.maxClusters ? parseInt(options.maxClusters) : 10,
query: options?.near,
...options
}
await handleClustersCommand(neural, argv)
},
async hierarchy(id?: string, options?: any) {
const brain = new Brainy()
const neural = brain.neural()
const argv: CommandArguments = {
_: ['neural', 'hierarchy', id || ''].filter(x => x),
id,
...options
}
await handleHierarchyCommand(neural, argv)
},
async related(id?: string, options?: any) {
const brain = new Brainy()
const neural = brain.neural()
const argv: CommandArguments = {
_: ['neural', 'related', id || ''].filter(x => x),
id,
limit: options?.limit ? parseInt(options.limit) : 10,
threshold: options?.radius ? parseFloat(options.radius) : 0.3,
...options
}
await handleNeighborsCommand(neural, argv)
},
async outliers(options?: any) {
const brain = new Brainy()
const neural = brain.neural()
const argv: CommandArguments = {
_: ['neural', 'outliers'],
threshold: options?.threshold ? parseFloat(options.threshold) : 0.3,
explain: options?.explain,
...options
}
await handleOutliersCommand(neural, argv)
},
async visualize(options?: any) {
const brain = new Brainy()
const neural = brain.neural()
const argv: CommandArguments = {
_: ['neural', 'visualize'],
format: options?.format || 'json',
dimensions: options?.dimensions ? parseInt(options.dimensions) : 2,
limit: options?.maxNodes ? parseInt(options.maxNodes) : 500,
output: options?.output,
...options
}
await handleVisualizeCommand(neural, argv)
}
}
export default neuralCommand