# LexAI CLI — Prompt Builder Part of the [LexAI monorepo](../../README.md) (`packages/cli`). Complements the [Chrome](../chrome/README.md) and [VS Code](../vscode/README.md) packages. Improve a rough idea into a **paste-ready engineered prompt** before you fire it at Claude Code, Cursor, or another agent. BYO-LLM only — no LexAI servers. Uses the same Prompt Builder core as the Chrome and VS Code extensions. ## Install (from this repo) ```bash # from repo root npm run cli:install npm run cli:build # make `lexai` available on your PATH cd packages/cli && npm link ``` Or run without linking: ```bash node packages/cli/out/cli.js prompt "your rough idea" ``` ## Setup ```powershell # PowerShell $env:LEXAI_API_KEY = "sk-..." $env:LEXAI_PROVIDER = "openai" # optional: openai | anthropic | groq | openrouter $env:LEXAI_MODEL = "gpt-4o" # optional ``` Optional defaults file (no API key allowed here): `~/.lexai/config.json` ```json { "provider": "openai", "model": "gpt-4o", "pattern": "role", "persona": "Expert Developer", "format": "Markdown", "style": "Concise" } ``` Precedence: **flags > config file > env > defaults**. Key is always from `LEXAI_API_KEY`. ## Usage ```bash lexai prompt "add rate limiting to the express auth routes" echo "debug flaky playwright on CI" | lexai prompt --pattern role --persona "Expert Developer" lexai prompt -f draft.txt --format Markdown --model gpt-4o lexai prompt --list lexai prompt --help ``` The engineered prompt is written to **stdout** (pipe-safe). Progress and errors go to **stderr**. ```powershell # Windows: copy to clipboard lexai prompt "write a unit test for parseConfig" | Set-Clipboard ``` ### Flags | Flag | Meaning | | --- | --- | | `-f, --file ` | Read input from file | | `--pattern ` | Pattern id (`auto`, `role`, `cot`, …) — see `--list` | | `--persona ` | Persona preset or free text | | `--format ` | Output format hint | | `--style ` | Style the engineered prompt should request | | `--provider` / `--model` | Provider overrides | | `-l, --list` | List patterns, personas, formats, styles | | `-h, --help` | Help | Exit codes: `0` success · `1` user/config error · `2` provider/network error ## Scope **In:** Make Prompt / Prompt Builder only. **Out:** Fix/Rephrase/Code Assist, reading VS Code/Chrome keys, auto-running shell commands.