Package Exports
- promptboost
- promptboost/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (promptboost) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
PromptBoost CLI ๐
A powerful command-line tool that enhances prompts using AI providers to optimize interactions with terminal agents like Claude Code, Gemini CLI, Open Code, and more.
โจ Features
- ๐ค Multiple AI Providers: OpenAI, Anthropic, Grok (xAI), Google Gemini
- ๐จ Smart Templates: Coding, analysis, and general-purpose templates
- โ๏ธ Easy Configuration: Secure API key management with environment variables
- ๐ฏ Beautiful Output: Colorized CLI with clear formatting
- ๐ File Operations: Read from files, save to files
- ๐ Robust Error Handling: Retry logic and graceful fallbacks
- โก Fast Performance: Built with Bun for lightning-fast execution
๐ Quick Start
Prerequisites
- Bun (latest version)
- API keys for at least one provider
Installation (Development)
# Clone the repository
git clone <your-repo-url>
cd promptup
# Install dependencies
bun install
# Run the CLI in development mode
bun run dev --help๐ง Development Setup
Project Structure
promptup/
โโโ src/
โ โโโ commands/ # CLI command implementations
โ โ โโโ enhance.ts # Main enhancement command
โ โ โโโ config.ts # Configuration management
โ โ โโโ test.ts # Provider testing
โ โโโ providers/ # AI provider implementations
โ โ โโโ base.ts # Abstract base provider
โ โ โโโ openai.ts # OpenAI integration
โ โ โโโ anthropic.ts # Anthropic Claude integration
โ โ โโโ grok.ts # xAI Grok integration
โ โ โโโ google.ts # Google Gemini integration
โ โโโ utils/ # Utility modules
โ โ โโโ config.ts # Configuration management
โ โ โโโ logger.ts # Logging utility
โ โ โโโ template.ts # Template engine
โ โโโ types/ # TypeScript type definitions
โ โ โโโ index.ts # All interface definitions
โ โโโ index.ts # Main CLI entry point
โโโ templates/ # Built-in prompt templates
โ โโโ general.md # General-purpose template
โ โโโ coding.md # Software development template
โ โโโ analysis.md # Data analysis template
โโโ config/
โ โโโ default.json # Default configuration
โโโ tests/ # Test files (future)Development Commands
# Start development server
bun run dev
# Type checking
bun run typecheck
# Linting and formatting
bun run lint
bun run format
# Build for production
bun run build
# Run tests
bun run testCode Style
This project uses Biome for linting and formatting:
- Indentation: 2 spaces
- Quotes: Single quotes for JavaScript, double for JSON
- Semicolons: Always required
- Line width: 100 characters
๐ฏ Usage Examples
Basic Enhancement
# Enhance a simple prompt
bun run dev "Create a React component"
# Use a specific provider
bun run dev "Fix my code" --provider anthropic
# Apply a template
bun run dev "Analyze this data" --template analysisConfiguration
# Set up OpenAI
bun run dev config-set --provider-name openai --key sk-your-key-here
# Set up Anthropic
bun run dev config-set --provider-name anthropic --key ant-your-key-here
# View current configuration
bun run dev config-show
# Test provider connectivity
bun run dev test --provider openaiFile Operations
# Enhance prompt from file
bun run dev --file prompt.txt
# Save enhanced prompt to file
bun run dev "My prompt" --output enhanced.txt
# Different output formats
bun run dev "My prompt" --format plain๐ API Key Configuration
Method 1: CLI Configuration
bun run dev config-set --provider-name openai --key sk-your-key-here
bun run dev config-set --provider-name anthropic --key ant-your-key-here
bun run dev config-set --provider-name grok --key xai-your-key-here
bun run dev config-set --provider-name google --key AIza-your-key-hereMethod 2: Environment Variables
export PROMPTBOOST_OPENAI_KEY="sk-your-key-here"
export PROMPTBOOST_ANTHROPIC_KEY="ant-your-key-here"
export PROMPTBOOST_GROK_KEY="xai-your-key-here"
export PROMPTBOOST_GOOGLE_KEY="AIza-your-key-here"
export PROMPTBOOST_DEFAULT_PROVIDER="openai"Method 3: Config File
Configuration is stored in ~/.promptboost/config.json:
{
"version": "1.0.0",
"defaultProvider": "openai",
"providers": {
"openai": {
"apiKey": "sk-your-key-here",
"model": "gpt-4o",
"enabled": true
}
}
}๐งช Testing
Provider Testing
# Test all configured providers
bun run dev test
# Test specific provider
bun run dev test --provider openai
# Verbose testing
bun run dev test --verboseManual Testing Workflow
- Setup: Configure at least one provider
- Basic Test: Run a simple enhancement
- Template Test: Try different templates
- File Test: Test file input/output
- Error Test: Test with invalid API keys
๐๏ธ Architecture
Provider System
- BaseProvider: Abstract class with common functionality
- Retry Logic: Exponential backoff for failed requests
- Error Handling: Provider-specific error codes and messages
- Token Counting: Rough estimation for usage tracking
Configuration System
- Secure Storage: API keys stored with 600 permissions
- Environment Override: Environment variables take precedence
- Validation: Configuration validation with helpful error messages
- Migration: Future-proof configuration versioning
Template System
- Variable Substitution:
{USER_PROMPT}replacement - Markdown Support: Rich template formatting
- Custom Templates: User-defined templates (future feature)
๐ Adding New Providers
To add a new AI provider:
Create Provider Class:
// src/providers/newprovider.ts export class NewProvider extends BaseProvider { async enhance(request: EnhanceRequest): Promise<EnhanceResponse> { // Implementation } }
Update Provider Factory:
// src/providers/index.ts case 'newprovider': return new NewProvider(provider);
Add Default Configuration:
// src/utils/config.ts newprovider: { name: 'newprovider', apiKey: '', model: 'default-model', baseUrl: 'https://api.newprovider.com', enabled: false, }
๐ Debugging
Enable Debug Logging
bun run dev "test prompt" --verboseCommon Issues
API Key Issues:
# Check configuration bun run dev config-show # Test connectivity bun run dev test --provider openai
Template Issues:
# List available templates bun run dev providers # Try without template bun run dev "test prompt"
File Permission Issues:
# Check config file permissions ls -la ~/.promptboost/config.json # Should show: -rw------- (600)
๐ฎ Future Features
- Interactive mode with menus
- History and analytics
- Caching system
- Batch file processing
- Plugin system
- Local LLM support (Ollama)
๐ค Contributing
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Run tests:
bun run test - Run linting:
bun run lint - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
๐ License
MIT License - see LICENSE file for details.
๐ Acknowledgments
- Bun - Fast JavaScript runtime
- Commander.js - CLI framework
- Biome - Linting and formatting
- Picocolors - Terminal colors
Built with โค๏ธ using TypeScript and Bun