BlueprintsCLI is an intelligent code management and generation tool built on the Sublayer AI Agent framework. It transforms how you store, organize, and generate code by combining semantic search with AI-powered code generation, creating a personalized code blueprint library that learns from your patterns and generates contextually relevant code.
Powered by Sublayer: BlueprintsCLI leverages Sublayer's modular architecture with AI Actions, Generators, and Agents to create an intelligent, autonomous code management system that adapts to your development workflow.
Unlike traditional snippet managers, BlueprintsCLI:
- Learns from your code patterns - AI analyzes and categorizes your blueprints automatically
- Generates contextual code - Uses your existing blueprints as context for new code generation
- Semantic search - Find blueprints by meaning, not just keywords
- AI-enhanced metadata - Automatically generates names, descriptions, and categories
- Language agnostic - Supports 25+ programming languages and file types
Turn any code into a searchable, AI-enhanced blueprint:
# Submit from file
bin/blueprintsCLI blueprint submit path/to/my_script.rb
# Submit directly
bin/blueprintsCLI blueprint submit "
def fibonacci(n)
return n if n <= 1
fibonacci(n-1) + fibonacci(n-2)
end
"What happens automatically:
- π€ AI generates a descriptive name
- π Creates detailed description from code analysis
- π·οΈ Assigns relevant categories
- π Generates 768-dimensional vector embeddings for semantic search
- π― Detects language, file type, and blueprint patterns
Find blueprints using natural language:
# Find by functionality
bin/blueprintsCLI blueprint search "recursive algorithm fibonacci"
# Find by technology
bin/blueprintsCLI blueprint search "web server sinatra ruby"
# Find by pattern
bin/blueprintsCLI blueprint search "database connection pooling"Use your blueprint library to generate new code:
# Generate with natural language prompt
bin/blueprintsCLI generate --prompt "Create a Ruby web API with authentication using my existing patterns"
# Specify output directory
bin/blueprintsCLI generate --prompt "Build a calculator class" --output ./generated
# Control context size
bin/blueprintsCLI generate --prompt "Create tests for user model" --limit 10Generation Process:
- Context Discovery - Searches your blueprints for relevant patterns
- AI Generation - Uses Google Gemini with your blueprints as context
- Multi-file Output - Creates structured project files
- Pattern Matching - Applies your coding style and conventions
Launch the guided interface:
bin/blueprintsCLIFeatures:
- Step-by-step blueprint submission
- Guided search and discovery
- Interactive code generation workflow
- Real-time preview and editing
For scripting and automation:
bin/blueprintsCLI blueprint submit code.rb
bin/blueprintsCLI blueprint search "authentication"
bin/blueprintsCLI generate --prompt "API client"BlueprintsCLI's AI capabilities are powered by Sublayer's modular components:
- Submit Action: Auto-generates metadata using AI Generators
- Generate Action: Orchestrates code creation with blueprint context
- Search Action: Performs semantic search with vector similarity
- Description Generator: Creates clear, developer-focused explanations
- Name Generator: Produces meaningful names from code analysis
- Category Generator: Automatically assigns relevant tags
- Improvement Generator: Suggests code enhancements
- File Monitoring: Detect and update blueprints on code changes
- Quality Assurance: Continuous code improvement suggestions
- Test Integration: Automated testing of generated code
- Smart Naming: Generates meaningful names from code analysis
- Rich Descriptions: Creates detailed explanations of functionality
- Category Assignment: Automatically tags with relevant categories
- Type Detection: Identifies language, framework, and architectural patterns
- Pattern Recognition: Learns from your existing code style
- Technology Consistency: Uses frameworks and libraries from your blueprints
- Architectural Alignment: Follows your project structure patterns
- Best Practices: Incorporates security and performance patterns from your code
- Uses Google's text-embedding-004 model
- 768-dimensional vector space for precise matching
- Semantic understanding beyond keyword matching
- Distance-based relevance scoring
Blueprints are automatically organized by:
- Functionality: algorithms, data structures, utilities
- Technology: frameworks, libraries, APIs
- Architecture: patterns, designs, components
- Domain: web, mobile, data, system administration
- Language: ruby, python, javascript, etc.
bin/blueprintsCLI generate --prompt "Create a REST API for user management with JWT authentication"Output: Multi-file project with routes, models, middleware, and tests
bin/blueprintsCLI generate --prompt "Implement a binary search tree with traversal methods"Output: Complete class with insertion, deletion, and traversal algorithms
bin/blueprintsCLI generate --prompt "Build a CSV processor with validation and transformation"Output: Modular pipeline with error handling and logging
# View blueprint with AI analysis
bin/blueprintsCLI blueprint view 42 --analyze
# Export blueprint code
bin/blueprintsCLI blueprint export 42 output.rb
# Edit blueprint metadata
bin/blueprintsCLI blueprint edit 42# List with filtering
bin/blueprintsCLI blueprint list --format json | jq '.[] | select(.language == "ruby")'
# Search with limits
bin/blueprintsCLI blueprint search "database" --limit 20- Ruby 3.1+
- PostgreSQL with pgvector extension
- Google Gemini API key
# Clone and install
git clone <repository-url>
cd blueprintsCLI
bundle install
# Database setup
rake db:create
rake db:migrate
# Configuration
bin/blueprintsCLI config setup
export GEMINI_API_KEY="your-api-key"
# First blueprint
bin/blueprintsCLI blueprint submit "puts 'Hello, BlueprintsCLI!'"# ~/.config/BlueprintsCLI/config.yml
ai:
provider: gemini
model: gemini-2.0-flash
database:
url: postgresql://postgres:password@localhost:5432/blueprints
generation:
default_output_dir: ./generated
default_limit: 5Languages (25+): Ruby, Python, JavaScript, TypeScript, Java, Go, Rust, C++, C#, PHP, Swift, Kotlin, Scala, Clojure, Haskell, and more
File Types: Source code, configuration files, documentation, scripts, templates, schemas
Frameworks Detected: Rails, Sinatra, Flask, Django, React, Vue, Express, Spring, and many others
- Store and organize your utility functions
- Build a searchable knowledge base of solutions
- Generate variations of your proven patterns
- Centralize team coding patterns and best practices
- Accelerate onboarding with contextual code examples
- Maintain consistency across projects
- Generate boilerplate code from natural language
- Combine existing patterns into new solutions
- Iterate quickly with AI-assisted development
- Analyze code patterns and improvements
- Generate examples for specific concepts
- Build understanding through contextual exploration
BlueprintsCLI is architected using the Sublayer framework, a model-agnostic Ruby AI Agent framework that provides modular, intelligent components:
Actions perform specific operations and handle business logic without complex decision-making:
Submit- Processes blueprint submission with AI-enhanced metadata generationGenerate- Orchestrates code generation using existing blueprints as contextSearch- Handles semantic search queries with vector similarityView- Displays blueprints with optional AI analysisConfig- Manages configuration setup and validation
Example Action implementation:
class Submit < Sublayer::Actions::Base
def call
generate_missing_metadata # AI-powered name/description generation
validate_blueprint_data # Data validation
create_blueprint # Database persistence
end
endGenerators focus on single AI generation tasks, producing specific outputs:
Description- Generates clear, developer-focused code descriptionsName- Creates meaningful blueprint names from code analysisCategory- Automatically assigns relevant categoriesImprovement- Suggests code enhancements and optimizations
Example Generator implementation:
class Description < Sublayer::Generators::Base
llm_output_adapter type: :single_string,
name: 'description',
description: 'Clear, concise code functionality description'
def prompt
"Analyze this #{@language} code and provide a clear description: #{@code}"
end
endAutonomous entities for monitoring and automated tasks (extensible for future features):
- File change monitoring - Automatically update blueprints when source files change
- Test integration - Run tests on generated code and suggest improvements
- Code quality - Monitor and suggest blueprint improvements
Sublayer's flexible provider system supports multiple AI models:
- Google Gemini (default) -
gemini-2.0-flashfor generation,text-embedding-004for embeddings - OpenAI - GPT models with text-embedding-3-small
- Claude - Anthropic's models for advanced reasoning
- Local models - Via Ollama integration
Configuration example:
ai:
sublayer:
provider: gemini
model: gemini-2.0-flash
embedding_model: text-embedding-004- CLI Framework: Thor with dynamic command discovery
- Database: PostgreSQL with pgvector for vector similarity
- Search: 768-dimensional semantic vector space
- UI: TTY toolkit for rich terminal interfaces
- Configuration: TTY::Config with environment variable mapping
- AI Integration: Dual-layer with Sublayer + RubyLLM for maximum flexibility
# Run tests
bundle exec rspec
# Code quality
bundle exec rubocop
# Documentation
bundle exec yard doc
# Interactive console
bundle exec pryBlueprintsCLI's Sublayer architecture makes it easy to add new AI-powered features:
class CustomGenerator < Sublayer::Generators::Base
llm_output_adapter type: :single_string,
name: 'output',
description: 'Generated content'
def initialize(input:)
@input = input
end
def prompt
"Process this input: #{@input}"
end
endclass CustomAction < Sublayer::Actions::Base
def initialize(params)
@params = params
end
def call
# Use generators and perform operations
result = CustomGenerator.new(input: @params[:input]).generate
# Process result...
end
endclass MonitoringAgent < Sublayer::Agents::Base
trigger_on_files_changed { ["**/*.rb"] }
goal_condition { @analysis_complete }
step do
# Analyze changed files
# Update relevant blueprints
# Set @analysis_complete = true
end
endGenerate AI-powered YARD documentation:
bin/blueprintsCLI docs generate lib/my_class.rb- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature - Make changes and add tests
- Run test suite:
bundle exec rspec - Submit pull request
MIT License - see LICENSE file for details
Start building your intelligent code blueprint library today!
bin/blueprintsCLI