feat: implement comprehensive type safety system with BrainyTypes API

Major enhancements for type safety and developer experience:

- Add BrainyTypes static API for type management and AI-powered suggestions
- Implement strict type validation for all 31 NounType categories
- Remove dangerous generic add() method that bypassed type safety
- Add intelligent type inference with confidence scoring
- Provide helpful error messages with typo suggestions using Levenshtein distance
- Update all internal code, examples, and documentation to use typed methods
- Enhance CLI with new type management commands (types, suggest, validate)

Breaking changes:
- Remove deprecated add() method - use addNoun() with explicit type parameter
- All addNoun() calls now require explicit type as second parameter

This release significantly improves type safety across the entire system while
maintaining backward compatibility for properly typed method calls.

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
David Snelling 2025-09-01 09:37:36 -07:00
parent 7e0c111d3c
commit 0f4ab52ad9
40 changed files with 1704 additions and 497 deletions

View file

@ -16,9 +16,9 @@ async function main() {
await brain.init()
// 2. Add some sample data
await brain.add("The quick brown fox", { type: "sentence", category: "animals" })
await brain.add("Machine learning models", { type: "tech", category: "AI" })
await brain.add("Natural language processing", { type: "tech", category: "NLP" })
await brain.addNoun("The quick brown fox", 'Content', { type: "sentence", category: "animals" })
await brain.addNoun("Machine learning models", 'Content', { type: "tech", category: "AI" })
await brain.addNoun("Natural language processing", 'Content', { type: "tech", category: "NLP" })
// 3. Create and register the API Server augmentation
const apiServer = new APIServerAugmentation({