JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8
  • Score
    100M100P100Q36309F
  • License MIT

CLI tool that enhances prompts using AI providers for better terminal agent interactions

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 test

Code 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 analysis

Configuration

# 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 openai

File 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-here

Method 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 --verbose

Manual Testing Workflow

  1. Setup: Configure at least one provider
  2. Basic Test: Run a simple enhancement
  3. Template Test: Try different templates
  4. File Test: Test file input/output
  5. 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:

  1. Create Provider Class:

    // src/providers/newprovider.ts
    export class NewProvider extends BaseProvider {
      async enhance(request: EnhanceRequest): Promise<EnhanceResponse> {
        // Implementation
      }
    }
  2. Update Provider Factory:

    // src/providers/index.ts
    case 'newprovider':
      return new NewProvider(provider);
  3. 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" --verbose

Common Issues

  1. API Key Issues:

    # Check configuration
    bun run dev config-show
    
    # Test connectivity
    bun run dev test --provider openai
  2. Template Issues:

    # List available templates
    bun run dev providers
    
    # Try without template
    bun run dev "test prompt"
  3. 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

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run tests: bun run test
  5. Run linting: bun run lint
  6. Commit changes: git commit -m 'Add amazing feature'
  7. Push to branch: git push origin feature/amazing-feature
  8. Open a Pull Request

๐Ÿ“„ License

MIT License - see LICENSE file for details.

๐Ÿ™ Acknowledgments


Built with โค๏ธ using TypeScript and Bun