Reference
CLI & CI gate
promptflow runs the engine offline with exact OpenAI token counts. Every command reads a file or stdin (-) and accepts --json for machine-readable output.
Install
The
@promptflow/cli npm package is not published yet. Build it from the repository:shell
git clone https://github.com/vijayrajpalanisamy88/Prompt.git && cd Prompt
corepack enable && pnpm install
pnpm --filter @promptflow/engine build && pnpm --filter @promptflow/cli build
alias promptflow="node $PWD/packages/cli/dist/cli.js"Commands
| Command | Does | Exit code |
|---|---|---|
analyze <file> | Quality, dimensions, findings, tokens, intent | 0 |
optimize <file> | Verified optimization. --mode, --goal, --budget, --write | 0 |
validate <file> | Findings only | 1 on any critical finding |
compare <a> <b> | Token, quality, and findings delta | 0 |
tokens <file> | Count and estimated input cost (--model) | 0 |
scan <file> | Injection risk, sensitive data, undelimited variables | 1 on a critical security finding |
sanitize <file> | Prints text with sensitive values replaced | 0 |
check <glob…> | CI gate over prompt files | 1 if any file fails |
models | Model catalogue and reference prices | 0 |
The check gate
A file fails when its quality is below --min-score, its tokens exceed --max-tokens, or it has a finding at or above --fail-on (default critical, so leaked keys always fail). Settings can live in .promptflowrc.json at the repository root:
.promptflowrc.json
{
"include": ["prompts/**/*.md", "src/**/*.prompt.txt"],
"model": "gpt-4.1",
"minScore": 70,
"maxTokens": 2000,
"failOn": "critical",
"ignore": ["missing_length_guidance"]
}.github/workflows/prompts.yml
name: Prompt quality
on: [pull_request]
jobs:
prompts:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with: { node-version: 22 }
# Until @promptflow/cli is on npm, build it from the PromptFlow repository:
- run: |
git clone --depth 1 https://github.com/vijayrajpalanisamy88/Prompt.git /tmp/promptflow
cd /tmp/promptflow && pnpm install --frozen-lockfile
pnpm --filter @promptflow/engine build && pnpm --filter @promptflow/cli build
- run: node /tmp/promptflow/packages/cli/dist/cli.js checkGlobs are resolved relative to the working directory and skip node_modules, .git, and build output.