@stdout-design/cli

中文文档
0.9.0发布于 2026/11/02MITTypeScriptES Module构建来源已验证

stdout-design CLI — shallow front door to @stdout-design/core and @stdout-design/dev-server

原始使用文档
文档目录12 节
  1. Quick start
  2. Installation
  3. Commands
  4. studio render
  5. studio dev
  6. studio init
  7. Writing templates
  8. AI agent integration
  9. Project structure
  10. Configuration
  11. Platform presets
  12. License

@stdout-design/cli

npm version MIT license TypeScript Bun PRs welcome

Storybook for images — in your repo and speaking to your agents.

A CLI for rendering your own TSX components into pixel-perfect social and marketing images. Live preview studio, batch rendering from data, and MCP server for AI agents.

Quick start

# Install
bun add -d @stdout-design/cli

# Scaffold a project
npx @stdout-design/cli init

# Render an image
npx @stdout-design/cli render bento-feature --title "Hello" --out hello.png

# Or open the live studio
npx @stdout-design/cli dev

Installation

bun add -d @stdout-design/cli

Or globally:

bun add -g @stdout-design/cli

Prerequisites: Node.js 22.22+, Bun 1.2+.

Commands

CommandDescription
studio initScaffold a new studio project
studio devStart the live preview studio
studio render <template>Render a single template or batch
studio cache statsShow cache statistics
studio cache cleanClear the render cache
studio lintCheck templates for compatibility

Run commands with npx @stdout-design/cli <command>, or install globally with bun add -g @stdout-design/cli to use studio <command> directly.

studio render

studio render <template> [options]
OptionDescription
--key valuePass props to the template
--data file.csvBatch render from CSV or JSON
--preset nameOutput preset (default: og)
--locale langLocale for i18n
--out-dir pathOutput directory (default: ./out/)
--out file.pngSingle output file

studio dev

Starts a dev server on localhost:3000 with:

  • Hot-reload when templates change
  • Auto-generated prop panel
  • Side-by-side preview across presets
  • Export templates to PNG

studio init

Scaffolds a new studio project with:

  • TypeScript configuration
  • Example templates to get started
  • Sample data files for batch rendering
  • Locale files for i18n

Writing templates

A template is a TSX component with typed props:

type Props = {
  title: string;
  stat: string;
};

export default function MilestoneCard({ title, stat }: Props) {
  return (
    <div className="rounded-2xl bg-black p-8 text-white">
      <h1 className="text-4xl font-bold">{title}</h1>
      <p className="mt-2 text-lg">{stat}</p>
    </div>
  );
}

Drop it in templates/ and it's immediately renderable.

AI agent integration

Add to your agent's MCP config:

{
  "mcpServers": {
    "stdout-design": {
      "command": "npx",
      "args": ["-y", "@stdout-design/cli", "mcp"]
    }
  }
}

Available tools: list_templates, render, render_batch, list_presets

Project structure

my-project/
├── studio.config.ts      template registry, presets, locales
├── templates/            your TSX components
├── data/                 CSV/JSON for batch renders
├── locales/              translation files
└── out/                  rendered assets (gitignored)

Configuration

export default {
  templates: "./templates",
  presets: [
    { name: "og", width: 1200, height: 630 },
    { name: "instagram", width: 1080, height: 1080 },
  ],
  locales: ["en", "ar"],
  outDir: "./out",
};

Platform presets

PresetSizeUse
og1200×630Open Graph / social cards
x-card1200×675X (Twitter) cards
linkedin1200×627LinkedIn link previews
instagram1080×1080Instagram feed posts
instagram-story1080×1920Instagram stories
appstore1290×2796App Store screenshots
playstore1080×1920Play Store screenshots

License

MIT

版本与发布记录

@stdout-design/cli 共发布 32 个版本,首次发布于 2026/07/12;过去 12 个月发布了 32 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.9.0latest2026/11/021 天前
0.8.02026/11/021 天前
0.7.12026/11/021 天前
0.7.02026/10/258 天前
0.6.02026/10/259 天前
0.5.02026/10/259 天前

关于 @stdout-design/cli 的常见问题

@stdout-design/cli 是什么?

stdout-design CLI - @stdout-design/core和@stdout-design/dev-server的浅前门

如何安装 @stdout-design/cli?

在项目目录运行 npm install @stdout-design/cli,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:zod(^4.4.3)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。它还提供命令行工具 studio,可以用 npx studio 直接运行。

@stdout-design/cli 支持 TypeScript 吗?

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

@stdout-design/cli 支持 ESM 还是 CommonJS?

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

@stdout-design/cli 需要什么版本的 Node.js?

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

@stdout-design/cli 可以商用吗?

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

@stdout-design/cli 还在维护吗?

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