@ez-corp/ez-ai-pipeline

中文文档
1.4.4发布于 2026/01/09MITTypeScriptES Module近 30 天下载 2082

A production-ready CLI tool that executes prompt optimization pipelines using the OpenCode SDK

原始使用文档
文档目录36 节
  1. Features
  2. Installation
  3. Quick Start
  4. 1. Set up your API key (or use CLI mode)
  5. 2. Run an included pipeline
  6. 3. View results in the web dashboard
  7. 4. Create your own pipeline
  8. Commands
  9. run - Execute a pipeline
  10. list - Show available pipelines
  11. validate - Validate a pipeline configuration
  12. init - Create a new pipeline from template
  13. web - Start the web dashboard
  14. Included Pipelines
  15. prompt-optimizer
  16. pipeline-generator
  17. Pipeline Configuration
  18. Stage Types
  19. Variable Sources
  20. Conditions
  21. Skip If
  22. Run If
  23. Early Exit
  24. Output
  25. Web API
  26. REST Endpoints
  27. Running a Pipeline via API
  28. WebSocket for Real-Time Updates
  29. Development
  30. Project Structure
  31. Supported Models
  32. Anthropic
  33. OpenAI
  34. Google
  35. License
  36. Contributing

EZ AI Pipeline

npm version License: MIT

A production-ready CLI tool for executing prompt optimization pipelines using AI models. Features a beautiful terminal interface, multi-stage pipeline execution, cost-efficient model selection, and a built-in web dashboard.

Features

  • Multi-Stage Pipelines: Define complex workflows with multiple AI processing stages
  • Conditional Execution: Skip stages, run conditionally, or exit early based on results
  • Cost Tracking: Automatic token counting and cost calculation for all API calls
  • Beautiful Terminal UI: Progress indicators, spinners, and formatted output
  • Variable Interpolation: Pass data between stages using template variables
  • Multiple Output Formats: JSON, Markdown, and text parsing support
  • Pause/Resume/Cancel: Control pipeline execution in real-time
  • Web Dashboard: Built-in web viewer to browse pipeline outputs
  • Included Pipelines: Ships with ready-to-use pipelines (prompt-optimizer, pipeline-generator)

Installation

# Install globally from npm
npm install -g @ez-corp/ez-ai-pipeline

# Or use with npx
npx @ez-corp/ez-ai-pipeline --help

Quick Start

1. Set up your API key (or use CLI mode)

# Option A: Use your Anthropic API key
export ANTHROPIC_API_KEY="your-api-key"

# Option B: Use CLI mode with Claude Code (no API key needed)
# Just have Claude Code installed and authenticated

2. Run an included pipeline

ez-ai-pipeline run -p prompt-optimizer -i "Write a blog post about productivity"

3. View results in the web dashboard

ez-ai-pipeline web

4. Create your own pipeline

ez-ai-pipeline init my-pipeline

Commands

run - Execute a pipeline

ez-ai-pipeline run --pipeline <id> --input <text>
ez-ai-pipeline run --pipeline <id> --input-file <path>
ez-ai-pipeline run --pipeline <id> --input <text> --output ./results/
ez-ai-pipeline run --pipeline <id> --input <text> --json  # JSON output only
ez-ai-pipeline run --pipeline <id> --input <text> --quiet # Minimal output

list - Show available pipelines

ez-ai-pipeline list
ez-ai-pipeline list --json

validate - Validate a pipeline configuration

ez-ai-pipeline validate --pipeline <id>

init - Create a new pipeline from template

ez-ai-pipeline init <name>

web - Start the web dashboard

ez-ai-pipeline web              # Start on default port 3000
ez-ai-pipeline web -p 8080      # Start on custom port

Opens a local web interface to browse pipelines and execute them directly in your browser.

Features:

  • Run Pipelines: Execute any pipeline with real-time progress tracking
  • Live Progress: Watch stages complete with WebSocket-powered updates
  • Cost Tracking: See costs accumulate as each stage finishes
  • View Outputs: Browse all pipeline execution results
  • Stage Details: Explore stage-by-stage outputs and configurations
  • CLI Mode: Use Claude Code, OpenCode, or Aider instead of API keys

Execution Modes:

  • API Mode: Uses your Anthropic API key (default when ANTHROPIC_API_KEY is set)
  • CLI Mode: Shells out to Claude Code, OpenCode, or Aider (no API key required)

The dashboard auto-detects installed CLI tools and lets you choose your preferred execution mode.

Running Pipelines from the Web:

  1. Start the web dashboard: ez-ai-pipeline web
  2. Navigate to a pipeline from the sidebar
  3. Select execution mode (API or CLI) and tool if using CLI mode
  4. Enter your prompt in the textarea
  5. Click "Run Pipeline" or press Ctrl+Enter
  6. Watch real-time progress as each stage executes
  7. View the final optimized output

Keyboard Shortcuts:

  • Ctrl+Enter - Run the pipeline
  • Escape - Cancel a running execution

Included Pipelines

The package ships with ready-to-use pipelines:

prompt-optimizer

Optimizes prompts for better AI responses. Analyzes input, identifies improvements, and generates an enhanced version.

ez-ai-pipeline run -p prompt-optimizer -i "Your prompt to optimize"

pipeline-generator

Generates new pipeline configurations from natural language descriptions.

ez-ai-pipeline run -p pipeline-generator -i "Create a pipeline that summarizes articles"

Pipeline Configuration

Pipelines are TypeScript files in the pipelines/ directory:

import type { PipelineConfig } from "../src/typings/pipeline.ts";

const config: PipelineConfig = {
  pipeline: {
    id: "my-pipeline",
    name: "My Pipeline",
    version: "1.0.0",
    description: "Description of what this pipeline does",
    settings: {
      enableCaching: true,
      enableEarlyExit: true,
      maxRetries: 2,
      timeoutMs: 300000,
    },
  },
  stages: [
    {
      id: "stage-1",
      name: "Analyze Input",
      type: "analyze",
      model: {
        providerID: "anthropic",
        modelID: "claude-haiku-4-5-20251001",
        tier: "small",
        maxTokens: 1024,
        temperature: 0.1,
      },
      prompt: {
        systemPrompt: "You are an expert analyst.",
        template: `Analyze this: {{input_prompt}}`,
        variables: [
          { name: "input_prompt", source: "input", path: "prompt", required: true },
        ],
      },
      output: {
        format: "json",
        extract: [
          { name: "result", path: "result", required: true },
        ],
      },
    },
  ],
};

export default config;

Stage Types

  • analyze - Analyze and extract information
  • structure - Restructure or organize content
  • enhance - Improve or enrich content
  • validate - Validate results against criteria
  • test - Test outputs or run checks
  • iterate - Make iterative improvements
  • custom - Custom processing stage

Variable Sources

Variables can be sourced from:

  • input - The original input to the pipeline
  • previousStage - Output from a previous stage
  • context - Accumulated context throughout the pipeline
  • static - Static values defined in the configuration

Conditions

Skip If

Skip a stage if a condition is met:

conditions: {
  skipIf: {
    condition: { path: "status", equals: "complete" },
    sourceStage: "stage-1",
  },
}

Run If

Only run a stage if a condition is met:

conditions: {
  runIf: {
    condition: { path: "needsWork", equals: true },
    sourceStage: "stage-1",
  },
}

Early Exit

Exit the pipeline early if a condition is met:

conditions: {
  earlyExit: {
    condition: { path: "overall", equals: "COMPLETE" },
    returnStage: "stage-1",
  },
}

Output

Results are saved to the outputs/ directory:

  • result-{pipeline}-{timestamp}.json - Full pipeline results
  • prompt-{pipeline}-{timestamp}.md - Optimized prompt (for prompt pipelines)

Web API

The web dashboard exposes a REST API and WebSocket endpoint for programmatic access:

REST Endpoints

MethodEndpointDescription
GET/api/pipelinesList all available pipelines
GET/api/pipelines/:idGet pipeline configuration
POST/api/pipelines/:id/runStart pipeline execution
GET/api/executions/:idGet execution status
POST/api/executions/:id/cancelCancel running execution
GET/api/outputsList all execution outputs
GET/api/outputs/:filenameGet specific output file
GET/api/config/statusCheck if API key is configured

Running a Pipeline via API

# Start execution
curl -X POST http://localhost:3000/api/pipelines/prompt-optimizer/run \
  -H "Content-Type: application/json" \
  -d '{"input": "Your prompt to optimize"}'

# Response: { "executionId": "exec_123...", "pipelineId": "prompt-optimizer", "status": "started" }

# Check status
curl http://localhost:3000/api/executions/exec_123...

# Cancel execution
curl -X POST http://localhost:3000/api/executions/exec_123.../cancel

WebSocket for Real-Time Updates

Connect to ws://localhost:3000/ws for real-time execution progress:

const ws = new WebSocket('ws://localhost:3000/ws');

// Subscribe to an execution
ws.send(JSON.stringify({ type: 'subscribe', executionId: 'exec_123...' }));

// Receive events
ws.onmessage = (event) => {
  const data = JSON.parse(event.data);
  // Event types: stage:started, stage:completed, stage:failed,
  //              stage:skipped, execution:completed, execution:cancelled
  console.log(data);
};

Development

# Run tests
bun test

# Type check
bun run typecheck

# Format code
bun run format

Project Structure

ez-ai-pipeline/
├── src/
│   ├── index.ts              # CLI entry point
│   ├── cli/                  # CLI commands and UI
│   │   └── commands/         # Command implementations (run, list, validate, init, web)
│   ├── core/                 # Pipeline execution engine
│   ├── schema/               # Zod schemas and validation
│   ├── typings/              # TypeScript type definitions
│   ├── utils/                # Utilities (cost, templates, etc.)
│   └── config/               # Configuration and constants
├── pipelines/                # Included pipeline definitions
├── web/                      # Web dashboard source
├── web-dist/                 # Built web assets (included in npm package)
├── outputs/                  # Generated outputs
├── tests/                    # Test files
└── package.json

Supported Models

Anthropic

  • claude-opus-4-5-20250929 (large)
  • claude-sonnet-4-5-20250929 (medium)
  • claude-haiku-4-5-20251001 (small)

OpenAI

  • gpt-4o (medium)
  • gpt-4o-mini (small)
  • gpt-4-turbo (large)

Google

  • gemini-1.5-pro (large)
  • gemini-1.5-flash (small)
  • gemini-2.0-flash (small)

License

MIT License - see LICENSE for details.

Contributing

See CONTRIBUTING.md for contribution guidelines.

版本与发布记录

@ez-corp/ez-ai-pipeline 共发布 11 个版本,首次发布于 2025/12/22;过去 12 个月发布了 11 个版本。

版本发布日期距今
1.4.4latest2026/01/0910 个月前
1.4.32026/01/0910 个月前
1.4.22026/01/0910 个月前
1.4.12025/12/2410 个月前
1.4.02025/12/2310 个月前
1.3.02025/12/2210 个月前

关于 @ez-corp/ez-ai-pipeline 的常见问题

@ez-corp/ez-ai-pipeline 是什么?

A production-ready CLI tool that executes prompt optimization pipelines using the OpenCode SDK

如何安装 @ez-corp/ez-ai-pipeline?

在项目目录运行 npm install @ez-corp/ez-ai-pipeline,或使用 pnpm add / yarn add / bun add。它还提供命令行工具 ez-ai-pipeline,可以用 npx ez-ai-pipeline 直接运行。

@ez-corp/ez-ai-pipeline 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@ez-corp/ez-ai-pipeline 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@ez-corp/ez-ai-pipeline 需要什么版本的 Node.js?

package.json 的 engines 字段要求 Node.js >=18.0.0。版本不符时 npm 默认只给出警告,开启 engine-strict 后会拒绝安装。

@ez-corp/ez-ai-pipeline 可以商用吗?

@ez-corp/ez-ai-pipeline 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@ez-corp/ez-ai-pipeline 的下载量有多少?

根据 npm 官方下载统计,@ez-corp/ez-ai-pipeline 在 2026/10/14 – 2026/11/12 这 30 天内被下载 2,082 次,日均约 69 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@ez-corp/ez-ai-pipeline 还在维护吗?

最新版本 1.4.4 发布于 2026/01/09(10 个月前);至今共发布 11 个版本,其中过去 12 个月发布了 11 个;首次发布于 2025/12/22。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。