npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@kleosr/pe2-cli

v4.0.2

Published

PE2-CLI: Convert raw prompts to PE2-optimized prompts — Rust native binary

Downloads

169

Readme


📦 Install

# Via npm (meta-package, no postinstall scripts)
npm install -g @kleosr/pe2-cli

# From source (requires Rust 1.81+)
cargo install --git https://github.com/kleosr/PE2-CLI

# Or grab a binary from the releases page
# https://github.com/kleosr/PE2-CLI/releases

🚀 Usage

# Interactive mode — just run it
pe2

# One-shot
pe2 "Write a blog post about AI"

# From a file
pe2 path/to/prompt.txt

# With overrides
pe2 "Explain quantum computing" --provider openai --model gpt-4o --iterations 5

# Config menu
pe2 --config

No arguments = interactive mode. First run will prompt you to set up your provider and API key.

⚙️ Configuration

Settings live in ~/.kleosr-pe2/config.json. Change them through the interactive menu (/config) or edit the file directly.

| Flag | What it does | |------|-------------| | -p, --provider | LLM provider: openai, anthropic, google, openrouter, ollama | | -m, --model | Model identifier (check your provider's docs) | | --api-key | Your API key (or set the env var below) | | -o, --output-file | Where to save the result | | -i, --iterations | Refinement pass count (auto-detected by default) | | --max-tokens | Max response tokens (default: 1024) | | --temperature | Sampling temperature (default: 0.3) |

Environment Variables

| Provider | Variable | |----------|----------| | OpenAI | OPENAI_API_KEY | | Anthropic | ANTHROPIC_API_KEY | | Google | GOOGLE_API_KEY | | OpenRouter | OPENROUTER_API_KEY | | Ollama (local) | OLLAMA_BASE_URL |

🔄 How It Works

  1. Complexity analysis — scores your prompt on 5 factors (tech, domain, structure, logic, special chars), maps to difficulty tiers
  2. LLM call — sends it with a structured JSON template
  3. Refinement loop — auto-detects complexity; simple prompts get 1 pass, technical deep-dives get up to 5
  4. Output — writes to ./pe2-prompts/ as markdown with full history and metrics
{
  "context": "…",
  "role": "…",
  "task": "…",
  "constraints": "…",
  "output": "…"
}

Every prompt is returned as a structured PE² JSON document.

🏗️ Architecture

crates/
├── pe2-core/       — config, analysis, engine/pipeline, templates
├── pe2-providers/  — 5 adapters: OpenAI, Anthropic, Google, Ollama, OpenRouter
├── pe2-tui/        — banner, spinner, themed display, interactive REPL (crossterm)
├── pe2-cli/        — binary entry: clap args, single-prompt + interactive modes
└── pe2-bindings/   — napi-rs bridge (optional, Node.js native addon)

Clean dependency chain — no circular deps. ~3,200 lines of Rust across 36 source files.

🛠️ Development

git clone https://github.com/kleosr/PE2-CLI.git
cd PE2-CLI
cargo build
cargo test
cargo run -- --help

Tests live in crates/*/tests/. Run with cargo test.

🤖 CI/CD

Push a v* tag and GitHub Actions:

  1. Runs cargo test
  2. Matrix builds across 6 platforms (linux x64/arm64, darwin x64/arm64, windows x64/arm64)
  3. Uploads release tarballs

🦀 Why Rust?

I wrote the first version in Node.js. It worked, but:

  • ~300ms startup waiting for the runtime to warm up
  • GC pauses during prompt refinement
  • Callbacks and promises for concurrency

Rust fixed all of it. Single static binary, ~2ms startup, zero GC, and tokio async everywhere. Five concurrent provider calls? No problem.

Built with Cursor.

📄 License

ISC