ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

OpenDesign 插件测试夹具解析:sample-plugin 的双文件清单结构与 Phase 1 安装闭环

OpenDesign 插件测试夹具解析:sample-plugin 的双文件清单结构与 Phase 1 安装闭环 AI 应用人工智能AI 技能设计系统媒体生成【免费下载链接】open-design Best DeepSeek Harness Design Plugin. The open-source Claude Design alternative. ️ Local-first desktop app. ️ Your coding agent becomes the design engine: prototypes, landing pages, dashboards, slides, images video — real files, HTML/PDF/PPTX/MP4 export. Claude Code / Codex / Cursor / DeepSeek Harness / OpenCode 20 CLIs via BYOK.项目地址https://gitcode.com/gh_mirrors/opend/open-design点击查看免费下载OpenDesign 的插件系统以SKILL.md为可执行契约、以open-design.json为增强型 sidecar而 apps/daemon/tests/fixtures/plugin-fixtures/README.md 正是这套机制的最小可运行标本一个自包含的声明式插件夹具被 Phase 1 插件系统测试作为端到端闭环e2e-1的输入。阅读本文后你将掌握open-design.json清单的每个核心字段的语义、sidecar 与 SKILL.md 的合并优先级、以及安装 → 列出 → 应用 → 快照 → 诊断整条闭环是如何在仓库测试中落地验证的——这套知识可直接复用于编写你自己的 OpenDesign 插件。一、plugin-fixtures 是什么Phase 1 测试的声明式插件标本插件夹具目录 apps/daemon/tests/fixtures/plugin-fixtures/ 是插件系统测试专用的固定输入。README 中明确了两条定位服务对象Phase 1 插件系统测试对应 docs/plans/plugins-implementation.md 中记录的 e2e-1 闭环验收组织方式每个子文件夹都是一个自包含的 OpenDesign 插件按 docs/plugins-spec.md §5 的约定组织随时可以交给od plugin install --source path安装。当前夹具只含一个子目录sample-plugin/内部是两个文件open-design.json—— 规范清单canonical manifestSKILL.md—— 伴随的技能文件companion。README 特别强调了这套双文件设计的意图sidecar 拥有主优先级primary precedence而SKILL.md之所以存在是为了在删除open-design.json之后让 daemon 的兼容适配器compat adapter可以被隔离测试。也就是说一个夹具同时覆盖了插件系统的两条解析路径——完整清单路径与纯 SKILL 降级路径。二、解剖 sample-pluginopen-design.json 清单逐字段解析sample-plugin的清单是 spec v1 中最精简的合法形态适合逐字段拆解。完整内容见 apps/daemon/tests/fixtures/plugin-fixtures/sample-plugin/open-design.json逐段含义如下顶层标识与元数据{ $schema: https://open-design.ai/schemas/plugin.v1.json, specVersion: 1.0.0, name: sample-plugin, title: Sample Plugin, version: 1.0.0, description: Phase 1 e2e fixture used by od plugin install/apply walkthroughs., license: MIT, tags: [sample, phase1] }$schema清单所遵循的 JSON Schemadocs/schemas/open-design.plugin.v1.json的对外地址供编辑器补全与校验specVersion插件规范版本与插件自身的version是两回事。spec §5.1 指出它会冻结进 apply 快照用于回放replay一致性name插件唯一 id安装后installed_plugins表即以此为主键version插件包版本任何行为、元数据、pipeline、inputs 或内置资源变更都应升版license、tags分发元数据spec 中tags用于 marketplace 筛选。od 命名空间可执行行为声明od: { kind: skill, taskKind: new-generation, useCase: { query: Generate a {{topic}} brief for {{audience}}. }, context: { skills: [{ ref: open-design-landing }], atoms: [todo-write, discovery-question-form] }, inputs: [ { name: topic, type: string, required: true, label: Topic }, { name: audience, type: select, options: [VC pitch, general], default: general } ], capabilities: [prompt:inject] }对照 spec §5.1 的字段参考各字段语义如下字段语义sample-plugin 中的用法od.kind注册表分类skill/scenario/atom/bundleskill即作为普通技能被注册od.taskKind四大产品场景之一new-generation/code-migration/figma-migration/tune-collabnew-generation驱动 marketplace 过滤与默认输入模板od.useCase.query点击使用时填入 brief 框的确切文本{{var}}占位符绑定到od.inputs用{{topic}}、{{audience}}两个占位符模板化查询od.context.skills类型化上下文条目编译为ContextItemspec §5.2引用open-design-landing技能注入提示栈od.context.atoms无序集声明插件需要的 atomdaemon 按默认顺序使用todo-write规划、discovery-question-form澄清od.inputs详情页表单字段其值回填useCase.querytopic必填字符串、audience下拉单选默认generalod.capabilities声明式能力列表restricted插件缺省时为[prompt:inject]显式声明prompt:inject提示注入总是被允许值得注意的细节context.skills的ref是open-design-landing——这与仓库中的 design-templates/open-design-landing/ 模板命名一致说明夹具刻意引用了仓库内真实存在的技能资产从而让od plugin doctor的上下文引用检查resolved-context ref check在闭环测试中有真实可解析的目标。三、SKILL.md 半边兼容适配器的隔离测试场sample-plugin 的 SKILL.md 不是摆设。它带有od:frontmatter--- name: sample-plugin description: Phase 1 sample plugin synthesizing a SKILL.md frontmatter for backwards-compat tests. od: kind: skill taskKind: new-generation preview: type: deck ---正文则描述了一个三步工作流先经 discovery question form atom 确认用户 brief再用 TodoWrite 规划最后以 deck 产物形式输出 brief。这份SKILL.md的存在意义在 README 中说得非常直白当一次安装缺少显式 sidecar 时只需删掉open-design.json纯 SKILL 兼容层级legacy compat tier必须保持诚实可测。这正是 spec §5.4 描述的机制当插件没有open-design.json但SKILL.md已含od:frontmatter 时packages/plugin-runtime 的adapters/agent-skill.ts会从 frontmatter **合成synthesize**一个最小PluginManifest且映射必须稳定避免遗留技能协议与新插件 schema 产生语义漂移。由此形成三种消费形态SKILL.md单独存在 → 任何按 SKILL 协议消费的 agentClaude Code、Cursor、Codex 等都能直接运行加上open-design.json→ 解锁 OD 的 marketplace 卡片、预览、一键使用、类型化上下文条只有open-design.json→ 按 spec §5 属于metadata-only 预设不可直接触发 agent 运行od plugin doctor会提示作者补上SKILL.md或.claude-plugin/plugin.json。四、sidecar 合并优先级open-design.json winsREADME 强调的sidecar 有主优先级在 spec 与实现计划中有三重印证合并规则spec §5.4 明确如果open-design.json与SKILL.mdfrontmatter 同时存在open-design.json胜出wins但加载器必须保留适配器告警。packages/plugin-runtime/src/merge.ts正是负责sidecar 适配器合并的模块。不变量 I1实现计划 docs/plans/plugins-implementation.md 的第 1 条不变量规定SKILL.md是底线flooropen-design.json是 sidecar二者永不双向耦合并明确打包的 e2e fixture 同时携带两个半边由apps/daemon/tests/plugins-e2e-fixture.test.ts演练合并器。合成与缓存installed_plugins表的manifest_json列缓存的就是open-design.json或合成的结果即注册表在安装时已完成合并落盘。这意味着插件作者可以增量迁移先让旧 SKILL 原样可运行再逐步补充 OD marketplace 元数据两个消费通道互不破坏。五、Phase 1 闭环install → list → apply → snapshot → doctor夹具的价值最终体现在它驱动了 e2e-1 闭环测试apps/daemon/tests/plugins-e2e-fixture.test.ts。该测试刻意只走 daemon 内部模块、不起 HTTP 服务从而在 CI 上无头运行。测试步骤与对应模块如下步骤调用断言要点1. 安装installFromLocalFolder(db, { source: FIXTURE_DIR, roots: { userPluginsRoot } })事件流中出现success2. 列出listInstalledPlugins(db)恰好 1 条记录id sample-plugintitle Sample Plugin3. 应用applyPlugin({ plugin, inputs: { topic: AI design tools }, registry })返回AppliedPluginSnapshotpluginId sample-pluginmanifestSourceDigest匹配^[0-9a-f]{64}$sha256 hex4. 快照createSnapshot(db, {...})→getSnapshot(db, snapId)snapshotId 为 UUID重取后manifestSourceDigest与inputs.topic原样保留5. 诊断doctorPlugin(plugin, {...})report.ok true其中两个细节尤其值得关注纯函数边界applyPlugin本身不写数据库、不动文件系统——快照由snapshots.ts的createSnapshot单独持久化。这印证了实现计划中的不变量 I2Apply 是纯函数副作用只在POST /api/projects/POST /api/runs之后发生也对应定义完成标准中的 e2e-8100 次 apply 只增长 100 条快照行、项目目录字节数不变。输入模板绑定inputs: { topic: AI design tools }会在 apply 时把{{topic}}占位符解析为实际文本最终快照里inputs.topic被持久化证明useCase.query模板化机制在闭环中真实生效。六、如何复现这条路径命令行走查夹具的设计目标之一就是可直接交给 CLI 消费。在已启动 daemon 的环境中可以这样走od plugin install --source apps/daemon/tests/fixtures/plugin-fixtures/sample-plugin od plugin list # 应看到 sample-plugin / Sample Plugin od plugin info sample-plugin od plugin apply sample-plugin --input topicAI design tools --input audiencegeneral od plugin doctor sample-plugin # 输出 ok: true若想验证兼容适配器路径把sample-plugin目录下的open-design.json临时移走后再次安装/applydaemon 将走SKILL.mdfrontmatter 合成清单的降级路径。安装器本身带有路径穿越防护、50 MiB 大小上限与符号链接拒绝等守卫见实现计划 Phase 1 对installer.ts的描述od plugin install还支持github:owner/repo、https://…/plugin.tar.gz与裸插件名经 marketplace 解析等多种 source 形态具体语法见 docs/plugins-spec.md。七、从夹具到正式插件你能从中复用什么把 sample-plugin 当作模板向正式插件演进时遵循 spec §5 的升级阶梯保持SKILL.md可运行——这是跨目录Claude Code / Cursor / Codex / 各类 catalog的通用契约补充open-design.jsonsidecar——从本夹具的 11 个顶层/od 字段起步逐步加入title_i18n、preview、pipeline.stages、genui.surfaces、connectors等高级声明用od plugin doctor持续校验——它覆盖 schema 校验、SKILL.md 解析、atom id 存在性、上下文引用检查、digest 漂移检测spec §5.3 能力词汇表与 §12 退出码可作验收依据注意context.atoms与pipeline的关系——两者并存时pipeline优先context.atoms只作为上下文条元数据spec §5.1。八、延伸阅读插件规范正文docs/plugins-spec.md含 §5open-design.jsonschema、§5.2ContextItem联合类型、§5.3 能力词汇表实现计划与不变量docs/plans/plugins-implementation.md技能协议SKILL.md 与od:frontmatter 语义docs/skills-protocol.md运行时适配器与合并逻辑packages/plugin-runtime契约类型PluginManifest、AppliedPluginSnapshot等packages/contracts/src/plugins/一句话总结plugin-fixtures/sample-plugin是 OpenDesign 插件系统最小的完整真理源——它用一个双文件夹具同时锁定了 sidecar 合并优先级、SKILL 兼容降级与安装→应用→快照→诊断闭环三条核心不变量是理解整个插件架构的最佳切入点。赞分享AI 应用人工智能AI 技能设计系统媒体生成【免费下载链接】open-design Best DeepSeek Harness Design Plugin. The open-source Claude Design alternative. ️ Local-first desktop app. ️ Your coding agent becomes the design engine: prototypes, landing pages, dashboards, slides, images video — real files, HTML/PDF/PPTX/MP4 export. Claude Code / Codex / Cursor / DeepSeek Harness / OpenCode 20 CLIs via BYOK.项目地址https://gitcode.com/gh_mirrors/opend/open-design点击查看免费下载相关推荐如何快速上手MaxViT图像分类模型5分钟安装与使用教程如何快速上手MaxViT图像分类模型5分钟安装与使用教程 想要在5分钟内快速掌握MaxViT图像分类模型吗这篇终极指南将带你从零开始轻松上手这款强大的图像Deep-TEMPEST 快速上手指南Conda 与 Pyenv 两种环境搭建全流程Deep TEMPEST 快速上手指南Conda 与 Pyenv 两种环境搭建全流程 Deep TEMPEST 是一个利用深度学习从 HDMI 电磁辐射中恢复Unity Test测试夹具使用教程构建结构化测试套件Unity Test测试夹具使用教程构建结构化测试套件 Unity Test测试夹具是Unity测试框架的强大扩展为C语言开发者提供结构化测试套件的终极解决测试嵌入式创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考
返回列表