@nova-infra/d2c
v2.3.0
Published
Agent-friendly Figma design context CLI
Readme
@nova-infra/d2c (nova-d2c)
Figma 设计上下文 CLI。
nova-d2c 的定位是“设计上下文 CLI”,提供可组合、可脚本化的 Figma 设计上下文(文件、节点、树、tokens、资源)输出。
官网与文档:
- 官网:https://nova-d2c.pages.dev
- 命令文档:https://nova-d2c.pages.dev/#commands
- npmjs:https://www.npmjs.com/package/@nova-infra/d2c
- 改名迁移说明:docs/changes/rename-to-nova-d2c.md
npm 分发
npm 包按 native binary 分发,目前只保留 macOS 和 Windows 二进制。公开包只包含平台二进制、一个很薄的启动器、package.json 和 README,不发布 TypeScript 源码、核心 JS bundle 或 sourcemap。
安装
npm install -g @nova-infra/d2c临时执行:
npx -y @nova-infra/d2c doctor
bunx @nova-infra/d2c doctor快速上手
# 1) 初始化检查
nova-d2c doctor
# 2) 获取文件级上下文
nova-d2c files get "https://www.figma.com/design/xxx"
# 3) 解析目标节点
nova-d2c nodes resolve "https://www.figma.com/design/xxx" --name "login button"
# 4) 提取节点并导出资源
nova-d2c nodes get "https://www.figma.com/design/xxx" --node-id 1:2
nova-d2c assets export "https://www.figma.com/design/xxx" --node-id 1:2 --out ./assets
# 5) 输出 handoff 包
nova-d2c handoff build "https://www.figma.com/design/xxx" --node-id 1:2 --out ./handoff约定
所有对外对接场景默认用 --json。
命令总览
nova-d2c doctor
nova-d2c init
nova-d2c --json files get <figma-url|file-key>
nova-d2c --json nodes explore <figma-url|file-key>
nova-d2c --json nodes resolve <figma-url|file-key> [--name <keyword>]
nova-d2c --json nodes get <figma-url|file-key> --node-id <node-id>
nova-d2c --json tree get <figma-url|file-key> --node-id <node-id>
nova-d2c --json tokens styles <figma-url|file-key> --node-id <node-id>
nova-d2c --json tokens variables <figma-url|file-key> --node-id <node-id>
nova-d2c --json assets export <figma-url|file-key> --node-id <node-id> --out <dir>
nova-d2c --json handoff build <figma-url|file-key> --node-id <node-id> --out <dir>
nova-d2c --json request get /v1/me
nova-d2c --describe --format skill约束与说明
- 明确定位为“设计上下文 CLI”,不做代码生成输出。
- 对外仅保留当前命令面,不提供旧命令兼容说明。
- 读取结果默认缓存 5 分钟,使用
--no-cache强制刷新。
选项速查(常用)
| 选项 | 说明 |
|------|------|
| --node-id | 指定目标节点 ID,支持 1:2 |
| --name | 节点名称关键词 |
| --limit | discovery 场景返回条数 |
| --depth | 节点遍历深度 |
| --out | 输出目录 |
| --no-cache | 强制刷新 |
| --token | 明确指定 Figma Token |
缓存
读取类命令首次结果缓存 5 分钟。支持 --no-cache 直连 API。
License
MIT
