A command-line tool for storing and finding code snippets using semantic search.
BlueprintsCLI stores code snippets in a PostgreSQL database and finds them using vector similarity search. It includes an AI integration that generates descriptions and categories automatically.
The tool has two interfaces:
- Interactive menu system for guided workflows
- Direct command-line interface for specific operations
- Store code snippets with metadata
- List stored snippets in table, summary, or JSON format
- Search snippets using natural language queries
- View individual snippets with optional AI analysis
- Edit snippet metadata
- Delete snippets
- Export snippet code to files
- Uses Google Gemini API for text generation and embeddings
- Generates descriptions automatically when storing snippets
- Assigns categories automatically
- Creates 768-dimensional vector embeddings for semantic search
- Provides code analysis and improvement suggestions
- Interactive menu system using TTY toolkit components
- Command-line interface using Thor framework
- Terminal tables, prompts, and progress indicators
- Log viewing with pagination
- Ruby 3.0 or later
- PostgreSQL with pgvector extension
- Google Gemini API key
# Clone repository
git clone <repository-url>
cd blueprintsCLI
# Install Ruby dependencies
bundle install
# Create database
rake db:create
rake db:migrate
# Set up configuration
bin/blueprintsCLI config setupexport GEMINI_API_KEY="your-gemini-api-key"
export DATABASE_URL="postgresql://postgres:password@localhost:5432/blueprints"bin/blueprintsCLI config setupbin/blueprintsCLIbin/blueprintsCLI blueprint submit path/to/file.rb
bin/blueprintsCLI blueprint submit "puts 'Hello World'"bin/blueprintsCLI blueprint list
bin/blueprintsCLI blueprint list --format jsonbin/blueprintsCLI blueprint search "http server ruby"bin/blueprintsCLI blueprint view 42
bin/blueprintsCLI blueprint view 42 --analyzebin/blueprintsCLI blueprint edit 42
bin/blueprintsCLI blueprint delete 42
bin/blueprintsCLI blueprint export 42 output.rbbin/blueprintsCLI config show
bin/blueprintsCLI config setup
bin/blueprintsCLI config validate
bin/blueprintsCLI config resetThe application follows this structure:
CLI Layer → Commands → Actions → Database/AI Services
- CLI Layer: Thor framework handles command parsing and routing
- Commands: Route operations and validate input
- Actions: Execute business logic (inherit from Sublayer::Actions::Base)
- Database: PostgreSQL with Sequel ORM and pgvector extension
- AI Services: Google Gemini API via Sublayer framework
blueprintstable: stores code, metadata, and vector embeddingscategoriestable: stores category definitionsblueprints_categoriestable: many-to-many relationships
Uses TTY::Config for configuration management with support for:
- Environment variables (with
BLUEPRINTS_prefix) - YAML configuration files
- Validation rules
- Multiple provider configurations
bundle exec rspecbundle exec rubocopbundle exec yard docbundle exec pry- Thor: command-line interface framework
- Sequel: database ORM
- TTY toolkit: terminal user interface components
- Sublayer: AI framework wrapper
- PostgreSQL: database storage
- pgvector: vector similarity search extension
- Google Gemini API: text generation and embeddings
MIT License
- Fork the repository
- Create a feature branch
- Make changes and add tests
- Run tests and linter
- Submit pull request