brainy/test-env-flag.ts
David Snelling 26c7d61185 CHECKPOINT: Brainy 2.0 API refactor - pre-fixes state
Current state:
- Unified augmentation system to BrainyAugmentation interface
- Changed methods to specific noun/verb naming (addNoun, getNoun, etc)
- Made old methods private
- Combined getNouns into single unified method
- Neural API exists and is complete
- Triple Intelligence uses correct Brainy operators (not MongoDB)

Issues identified:
- Documentation incorrectly shows MongoDB operators (code is correct)
- Need to ensure all features are properly exposed
- Need to verify nothing was lost in simplification

This commit serves as a rollback point before applying fixes.
2025-08-25 09:52:32 -07:00

55 lines
No EOL
1.8 KiB
TypeScript

#!/usr/bin/env tsx
import { HybridModelManager } from './src/utils/hybridModelManager.js'
async function testEnvironmentFlag() {
console.log('Testing BRAINY_ALLOW_REMOTE_MODELS=false flag...')
// Test with flag set to false
process.env.BRAINY_ALLOW_REMOTE_MODELS = 'false'
console.log(`Set BRAINY_ALLOW_REMOTE_MODELS=${process.env.BRAINY_ALLOW_REMOTE_MODELS}`)
try {
const manager = new HybridModelManager()
const model = await manager.getPrimaryModel()
console.log('✅ Model options:')
console.log(` localFilesOnly: ${model.options?.localFilesOnly}`)
console.log(` model: ${model.options?.model}`)
console.log(` cacheDir: ${model.options?.cacheDir}`)
if (model.options?.localFilesOnly === true) {
console.log('✅ SUCCESS: BRAINY_ALLOW_REMOTE_MODELS=false is working correctly!')
} else {
console.log('❌ FAILURE: localFilesOnly should be true when BRAINY_ALLOW_REMOTE_MODELS=false')
}
} catch (error) {
console.error('❌ Error testing flag:', error.message)
}
console.log('\n' + '='.repeat(50))
// Test with flag set to true
process.env.BRAINY_ALLOW_REMOTE_MODELS = 'true'
console.log(`Set BRAINY_ALLOW_REMOTE_MODELS=${process.env.BRAINY_ALLOW_REMOTE_MODELS}`)
try {
const manager = new HybridModelManager()
const model = await manager.getPrimaryModel()
console.log('✅ Model options:')
console.log(` localFilesOnly: ${model.options?.localFilesOnly}`)
if (model.options?.localFilesOnly === false) {
console.log('✅ SUCCESS: BRAINY_ALLOW_REMOTE_MODELS=true is working correctly!')
} else {
console.log('❌ FAILURE: localFilesOnly should be false when BRAINY_ALLOW_REMOTE_MODELS=true')
}
} catch (error) {
console.error('❌ Error testing flag:', error.message)
}
}
testEnvironmentFlag().catch(console.error)