VisualSpec

io.github.utkarshx27由 GitHub 账号 utkarshx27 发布v0.1.0更新于 Oct 24, 2026

Structured, constraint-aware visual generation and deterministic layout for AI agents

已验证STDIO仅桌面开发者工具媒体与设计

概览

AI 生成的概览

让助手把需求转成结构化视觉规格,确定性地渲染排版与版式,并结合可选 AI 图像生成社交媒体图片。

可以做什么
VisualSpec 把自然语言需求转换为机器可读的 YAML 视觉规格,进行 schema 校验,并用 SVG 排版引擎在本地渲染精确的标题、副标题、徽章和安全边距。它还能运行完整流程,把 AI 生成的基础图像与确定性文字叠加合成,然后对边距、尺寸、行数和文案不变量做视觉质检,并执行局部修复。工具包括 visual_brief_to_spec、visual_validate_spec、visual_render、visual_generate、visual_check_qa、visual_repair 和 visual_list_resources。
适用场景
适合需要文案、排版和平台尺寸都精确可控的社交或营销图片,而不是完全交给图像模型。支持 Instagram、LinkedIn 和通用社交格式,以及产品发布、引言卡片和数字卡片模板。确定性渲染无需任何图像 API 密钥。
运行要求
以 npm 包形式通过 stdio 在本地运行,需要 Node.js 和 npx。可选的 GEMINI_API_KEY 或 OPENAI_API_KEY 用于启用 AI 图像生成;没有它们时只能做确定性渲染和模拟生成。仅限桌面端,无远程端点。
安装前请注意
可选的 GEMINI_API_KEY 和 OPENAI_API_KEY 是环境变量形式的密钥,会用于向相应服务商发送生成请求。生成过程会向本地输出目录写入文件和产物包。发布素材前应检查生成请求和质检报告。

安装

在 SourceWeft 中

  1. 打开 控制台中的 VisualSpec,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

VisualSpec

Deterministic visual generation for AI agents.
AI creates the imagery. VisualSpec guarantees the typography and layout.

[VisualSpec Generation Pipeline Demo]

[npm package] [MCP Registry] [License] [Tests] [GitHub stars]

bash
# Instant workspace setup (no clone required)npx @utkarshx27/visualspec init
# Launch local MCP Server for Cursor, Claude Desktop, or Antigravitynpx @utkarshx27/visualspec mcp

The Core Problem

Most image-generation workflows fail for social and marketing graphics because a single natural-language prompt is expected to handle too many concerns at once:

  • subject & background
  • exact typography & wording
  • platform dimensions & safe margins
  • visual hierarchy & negative space
  • brand color rules & constraints

Image models frequently hallucinate gibberish text, truncate words, or disregard composition rules.

The Solution: Layer Separation

VisualSpec separates generative concerns from deterministic concerns:

  1. Generative Layers (AI Models): Photography, 3D subjects, atmospheric backgrounds, textures, lighting.
  2. Deterministic Layers (Code & SVG Engine): Exact headlines, subtitles, badges, logos, metrics, safe margins, and layout rules.
  3. Structured Visual Spec: A machine-readable YAML specification that acts as the single contract.
  4. Visual QA & Targeted Repair: Verifies geometry, margins, and exact copy invariants, synthesizing localized repairs without regenerating entire scenes.
text
User Brief / Intent       │       ▼   Visual Spec (spec.yaml)       │   ┌───┴──────────────┐   ▼                  ▼Platform Pack    Template Pack   │                  │   └───┬──────────────┘       ▼   Spec Resolver       │   ┌───┴───────────────────────┐   ▼                           ▼Model Adapter           Deterministic Layout(Generative Base)       (SVG Typography / Overlay)   │                           │   └───┬───────────────────────┘       ▼  Compositor (Sharp)       │       ▼   Visual QA (Constraints, Safe Margins, Exact Copy)       │       ├── PASS ──► Final Asset Bundle       │       └── FAIL ──► Targeted Repair Planner

Documentation


Quickstart

Instant Run (No Install Required)

bash
# Initialize a new VisualSpec workspacenpx @utkarshx27/visualspec init
# Launch local MCP Server for Cursor, Claude, or Antigravity IDEnpx @utkarshx27/visualspec mcp

Or Install Globally

bash
npm install -g @utkarshx27/visualspec
# Use CLI commands directlyvisual initvisual mcp

Or Build from Source

bash
git clone https://github.com/utkarshx27/visualspec.gitcd visualspecnpm installnpm run build

1. Initialize a Project

bash
npx @utkarshx27/visualspec init

2. Validate a Visual Spec

bash
npx @utkarshx27/visualspec validate examples/product-launch/spec.yaml

3. Inspect the Compiled Generation Prompt

bash
npx @utkarshx27/visualspec compile examples/product-launch/spec.yaml --provider openai

4. Deterministic Render (No API Key Required)

Render layout, typography, and background styling locally:

bash
npx @utkarshx27/visualspec render examples/product-launch/spec.yaml --output ./output/demo-launch

5. Run the Full Generation Pipeline

bash
npx @utkarshx27/visualspec generate examples/product-launch/spec.yaml --provider mock --output ./output/demo-launch

6. Verify Asset Quality with Visual QA

bash
npx @utkarshx27/visualspec check ./output/demo-launch/final.png --spec examples/product-launch/spec.yaml

Model Context Protocol (MCP) Server

VisualSpec runs as a native MCP server over stdio, enabling AI coding assistants (Cursor, Claude Code, Gemini CLI, and Antigravity IDE) to invoke visual tools directly:

bash
# Launch MCP server over stdionpx @utkarshx27/visualspec mcp
# Or if installed globallyvisual mcp

Available MCP Tools

  • visual_brief_to_spec: Convert natural language requests into valid VisualSpec YAML.
  • visual_validate_spec: Schema validation for specs.
  • visual_render: Deterministic layout & typography rendering (zero API key).
  • visual_generate: Full image model adapter + deterministic text overlay pipeline.
  • visual_check_qa: Inspect safe margins, line counts, dimensions, and invariants.
  • visual_repair: Automated diagnosis and localized typography/layout repair.
  • visual_list_resources: List supported platform packs and templates.

See the MCP Setup Guide for Cursor, Claude Desktop, and Antigravity IDE configuration snippets.


Output Bundle

Every generation creates a complete, reproducible debug bundle:

text
output/demo-launch/├── final.png                 # Platform-ready asset├── visual-spec.yaml          # Original input specification├── resolved-spec.yaml        # Full spec with platform & template rules applied├── generation-request.json   # Exact prompt and negative parameters sent to model├── qa-report.json            # Deterministic and constraint QA verification results└── metadata.json             # Execution timestamps and file index

Supported Platforms & Templates

Platforms

  • Instagram: Feed portrait (1080x1350, 4:5), Square (1080x1080, 1:1), Story (1080x1920, 9:16).
  • LinkedIn: Feed portrait (1080x1350), Square (1080x1080), Banner (1200x628).
  • Generic Social: Universal 1:1, 4:5, and 16:9 social formats.

Templates

  • Product Launch: High-impact headline, feature pill, product visual region, supporting subhead.
  • Quote Card: Center-focused editorial quote, author attribution, minimal atmospheric glow.
  • Stat Card: Large numeric hero metric, descriptive label, and data context notes.

Agent Skills

The framework includes 10 standardized skill definitions located in ./skills/:

  • using-visualspec: Master workflow instructions.
  • visual-brief: Brief extraction and analysis.
  • visual-spec: YAML authoring and schema rules.
  • composition: Spatial hierarchy and negative space allocation.
  • typography: Font family classing and line budgeting.
  • strict-constraints: Invariant taxonomy and forbidden parameters.
  • social-instagram: Instagram-specific design reasoning.
  • social-linkedin: LinkedIn-specific design reasoning.
  • visual-qa: Automated inspection and validation.
  • visual-repair: Localized diagnosis and patch generation.

Roadmap & Open Contributions

We welcome contributions! Key areas to build together:

  • Additional Platforms: X/Twitter (Header, Post), YouTube Thumbnails, Pinterest, TikTok Cover.
  • Additional Templates: Testimonial, Product Comparison, Event Announcement, Feature List.
  • Additional Image Model Adapters: Flux, Stable Diffusion / ComfyUI, Midjourney API.
  • Brand Packs: Multi-brand palette overrides, custom font loading, logo clear space rules.
  • Visual Studio: Local web playground / viewer for real-time spec inspection and margin toggling.

Contributing

Contributions are welcome! Please check our:


Testing

Run the automated test suite:

bash
npm test

All 28 tests run offline without requiring any third-party API keys.


License

Licensed under the Apache License, Version 2.0.

来源:README.md,提交 cd28b8e

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分