Before publishing the CLI package to npm, you can test it locally to ensure it works as expected:
```bash
# Test the CLI package locally
npm run test-cli
```
This script:
1. Builds the main package
2. Creates a local tarball of the main package
3. Builds the CLI package
4. Updates the CLI package to use the local main package
5. Creates a local tarball of the CLI package
6. Installs the CLI package globally for testing
After running this script, you can use the CLI commands as if you had installed the package from npm:
```bash
# Test the CLI
brainy --version
brainy init
brainy add "Test data" '{"noun":"Thing"}'
brainy search "test"
```
When you're done testing, you can uninstall the CLI package:
```bash
npm uninstall -g @soulcraft/brainy-cli
```
## Publishing
### Publishing the CLI Package
If you need to publish the CLI package to npm, please refer to the [CLI Publishing Guide](docs/publishing-cli.md) for detailed instructions.
## Development Usage
```bash
# Run the CLI directly from the source
npm run cli help
# Generate a random graph for testing
npm run cli generate-random-graph --noun-count 20 --verb-count 40
```
## Node.js 24 Optimizations
Brainy takes advantage of several optimizations available in Node.js 24:
1.**Improved Worker Threads Performance**: The multithreading system has been completely rewritten to leverage Node.js 24's enhanced Worker Threads API, resulting in better performance for compute-intensive operations like embedding generation and vector similarity calculations.
2.**Worker Pool Management**: A sophisticated worker pool system reuses worker threads to minimize the overhead of creating and destroying threads, leading to more efficient resource utilization.
3.**Dynamic Module Imports**: Uses the new `node:` protocol prefix for importing core modules, which provides better performance and more reliable module resolution.
4.**ES Modules Optimizations**: Takes advantage of Node.js 24's improved ESM implementation for faster module loading and execution.
5.**Enhanced Error Handling**: Implements more robust error handling patterns available in Node.js 24 for better stability and debugging.
These optimizations are particularly beneficial for:
- Large-scale vector operations
- Batch processing of embeddings
- Real-time data processing pipelines
- High-throughput search operations
## Development Workflow
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Submit a pull request
## Reporting Issues
We use GitHub issues to track bugs and feature requests. Please use the provided issue templates when creating a new issue: