feat: add complete silent mode for TUI applications

- Add silent option to BrainyConfig to suppress ALL console output
- Override console methods (log, info, warn, error) when silent=true
- Add LogLevel.SILENT to Logger for proper silent mode support
- Propagate silent mode to all augmentations automatically
- Update augmentation configs to support silent property
- Restore console methods properly on brain.close()
- Perfect for terminal UI applications that need clean output

Usage:
```javascript
const brain = new Brainy({
  storage: { type: 'filesystem', path: './data' },
  silent: true  // Complete silence - zero console output
})
```

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David Snelling 2025-09-16 13:18:49 -07:00
parent 4d3e21a0f7
commit 27fb3ef905
6 changed files with 74 additions and 10 deletions

View file

@ -18,6 +18,7 @@ export interface CacheConfig {
ttl?: number
enabled?: boolean
invalidateOnWrite?: boolean
silent?: boolean // Silent mode support
}
/**
@ -80,6 +81,11 @@ export class CacheAugmentation extends BaseAugmentation {
type: 'boolean',
default: true,
description: 'Automatically invalidate cache on data modifications'
},
silent: {
type: 'boolean',
default: false,
description: 'Suppress all console output'
}
},
additionalProperties: false

View file

@ -12,18 +12,21 @@ import type { VectorDocument, GraphVerb } from '../../coreTypes.js'
export interface DisplayConfig {
/** Enable/disable the augmentation */
enabled: boolean
/** LRU cache size for computed display fields */
cacheSize: number
/** Use lazy computation (recommended for performance) */
lazyComputation: boolean
/** Batch processing size for multiple requests */
batchSize: number
/** Minimum confidence threshold for AI type detection */
confidenceThreshold: number
/** Silent mode - suppress all console output */
silent?: boolean
// No icon configuration needed - clean, minimal approach

View file

@ -28,6 +28,7 @@ export interface MetricsConfig {
trackStorageSizes?: boolean
persistMetrics?: boolean
metricsInterval?: number
silent?: boolean // New: Silent mode support
}
/**

View file

@ -290,9 +290,14 @@ export class UniversalDisplayAugmentation extends BaseAugmentation {
*/
private createExploreMethod(entity: any) {
return async (): Promise<void> => {
// Respect silent mode
if (this.config.silent) {
return
}
console.log(`\n📋 Entity Exploration: ${entity.id || 'unknown'}`)
console.log('━'.repeat(50))
// Show user data
console.log('\n👤 User Data:')
const userData = entity.metadata || entity
@ -313,7 +318,7 @@ export class UniversalDisplayAugmentation extends BaseAugmentation {
} catch (error) {
console.log(` Error computing display fields: ${error}`)
}
console.log('')
}
}