定制 carmelosantana/coqui-toolkit-pencil-dev 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

carmelosantana/coqui-toolkit-pencil-dev

Composer 安装命令:

composer require carmelosantana/coqui-toolkit-pencil-dev

包简介

Pencil.dev design toolkit for Coqui — create, manipulate, and export .pen design files programmatically. Supports element CRUD, reusable components, design tokens, CSS variable sync, and code export (HTML/CSS, React, SVG).

README 文档

README

A Coqui toolkit for creating, manipulating, and exporting Pencil.dev design documents (.pen files). Provides direct JSON-based document manipulation with no API keys or running application needed.

Features

  • Document management — create, read, list, validate .pen files
  • Element CRUD — insert, update, move, copy, delete design elements (rectangles, ellipses, text, frames, groups, etc.)
  • Reusable components — mark elements as components, create instances with descendant overrides
  • Design tokens — manage variables (color, number, string, boolean) with themed values
  • CSS sync — import CSS custom properties into Pencil variables and export back
  • Code export — generate HTML/CSS, React/Tailwind JSX, SVG, or raw JSON from designs
  • Pencil CLI — check CLI status, run commands, generate batch configs

Installation

composer require coquibot/coqui-toolkit-pencil-dev

The toolkit is auto-discovered by Coqui via extra.php-agents.toolkits in composer.json. No additional configuration is needed.

Available Tools

Tool Description
pencil_document Create, read, list, validate, and inspect .pen files
pencil_design Insert, get, update, move, copy, and delete design elements
pencil_component Create reusable components and instantiate them as ref elements
pencil_variable Manage design variables (tokens), themes, and CSS import/export
pencil_export Export designs to HTML/CSS, React/Tailwind, SVG, or JSON
pencil_cli Check Pencil CLI status, run commands, generate batch configs

Usage Examples

Create a Design

pencil_document(action: "create", path: "landing-page.pen", width: 1440, height: 900)
pencil_design(action: "insert", path: "landing-page.pen", type: "text", parent_id: "<frame_id>", properties: '{"content": "Hello World", "fontSize": 48, "fontWeight": 700}')

Build a Component Library

# Mark an element as a reusable component
pencil_component(action: "create", path: "design.pen", component_id: "<button_id>", name: "Primary Button")

# Create an instance with overrides
pencil_component(action: "instantiate", path: "design.pen", component_id: "<button_id>", descendants: '{"label_id": {"content": "Submit"}}')

Import CSS Variables

pencil_variable(action: "import_css", path: "design.pen", css: ":root { --primary: #3B82F6; --font-size-base: 16px; }")

Export to React

pencil_export(action: "react", path: "design.pen", component_name: "HeroSection", output_path: "HeroSection.jsx")

Export to HTML

pencil_export(action: "html", path: "design.pen", output_path: "preview.html")

Export to SVG

pencil_export(action: "svg", path: "design.pen", output_path: "icon.svg")

The .pen Format

A .pen file is a JSON document with this structure:

{
    "version": "1",
    "children": [
        {
            "id": "frame-1",
            "type": "frame",
            "width": 1440,
            "height": 900,
            "layout": "vertical",
            "children": [...]
        }
    ],
    "variables": {
        "primary": { "type": "color", "value": "#3B82F6" }
    },
    "themes": {
        "mode": { "Light": true, "Dark": false }
    }
}

Element Types

rectangle, ellipse, line, polygon, path, text, frame, group, ref, icon_font, note, prompt, context

Containers

frame and group can hold children. Frames support flexbox layout with layout, justifyContent, alignItems, gap, and padding.

Components

Any element with reusable: true is a component. ref elements are instances that reference a component and can override properties via descendants.

Variables

Design tokens stored in variables. Referenced in element properties with $variableName syntax. Support themed values.

MCP Live Preview

When Pencil desktop is running with its MCP server, use Coqui's mcp_client toolkit to access live preview and screenshot features:

  • batch_design — generate designs from prompts
  • get_screenshot — capture design screenshots
  • get_variables / set_variables — live variable management

Development

# Install dependencies
composer install

# Run tests
composer test

# Static analysis
composer analyse

License

MIT

carmelosantana/coqui-toolkit-pencil-dev 适用场景与选型建议

carmelosantana/coqui-toolkit-pencil-dev 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 08 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「toolkit」 「components」 「export」 「design」 「design-tokens」 「php-agents」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 carmelosantana/coqui-toolkit-pencil-dev 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 carmelosantana/coqui-toolkit-pencil-dev 我们能提供哪些服务?
定制开发 / 二次开发

基于 carmelosantana/coqui-toolkit-pencil-dev 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 41
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-08