@promptforgee/cli
v0.1.4
Published
PromptForge cli package
Readme
Why this package exists
Evaluating and optimizing prompts should not require writing custom Node.js scripts every time.
@promptforgee/cli brings the power of the PromptForge ecosystem directly to your terminal. It allows developers to analyze raw prompts, optimize prompt files, manage configurations, and test output quality straight from the command line—integrating seamlessly into CI/CD pipelines or local development workflows.
Features
- Analyze on the Fly: Get instant diagnostic reports on text files or piped input.
- Optimize Locally: Automatically rewrite messy prompt files into clean, optimized versions.
- Template Generation: Scaffold new PromptForge builder scripts instantly.
- System Doctor: Validate your environment and configuration.
- Unix Philosophy: Built to be piped, parsed, and integrated into shell scripts.
Installation
# Global installation (recommended for CLI usage)
npm install -g @promptforgee/cli
# Local installation as a dev dependency
npm install -D @promptforgee/cliNote: You can also run it directly using npx @promptforgee/cli <command>.
Quick Start
# Initialize a new PromptForge configuration in your project
promptforge init
# Analyze a raw text prompt file
promptforge analyze ./my-prompt.txt
# Optimize a prompt and output it to a new file
promptforge optimize ./messy-prompt.txt > ./clean-prompt.txt
# Scaffold a new prompt file using a template
promptforge template create CodeReviewer ./prompts/review.tsAPI Overview (Commands)
| Command | Description |
| ------------------- | ------------------------------------------------------------------------------------------------------------ |
| init | Creates a promptforge.config.json in the current directory. |
| analyze <file> | Runs @promptforgee/analyzer on the specified file and prints a diagnostic report. |
| optimize <file> | Runs @promptforgee/optimizer on the specified file. Prints to stdout by default. |
| doctor | Checks your environment, config files, and dependencies for issues. |
| template [action] | Interacts with @promptforgee/templates. Use ls to list available templates or create to scaffold code. |
| generate <file> | Compiles a TypeScript/JavaScript Prompt builder script into a final formatted string (e.g., Markdown). |
Real-world Example
Adding a CI check in GitHub Actions to ensure no bad prompts are merged into the main branch:
# .github/workflows/prompt-check.yml
name: PromptLint
on: [pull_request]
jobs:
lint-prompts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm ci
- name: Analyze Prompts
# Exits with error code 1 if analysis score falls below a threshold
run: npx promptforge analyze ./prompts/*.txt --threshold 80Ecosystem
The CLI orchestrates various PromptForge packages through a unified command-line experience.
@promptforgee/cli (You are here) ↓ @promptforgee/analyzer (Powered by) ↓ @promptforgee/optimizer (Powered by) ↓ @promptforgee/templates (Powered by)
Documentation
For full documentation and advanced usage, visit promptforge.dev/docs/cli.
Examples
Check out our Examples directory for more real-world use cases.
Roadmap
- 🚧 Interactive Prompt REPL (Read-Eval-Print Loop) for testing against LLMs directly.
- 🚧 Git pre-commit hooks integration.
- 🚧 Bulk analysis formatting (JSON, CSV output).
Contributing
We welcome contributions! Please read our Contributing Guide to get started.
License
MIT © Omnikon-Org
