@design-parity/action

中文文档
1.18.0发布于 2026/11/07Apache-2.0TypeScriptES Module构建来源已验证近 30 天下载 3638

集成层:电线解析器,适配器,候选,检查,diff,和策略进入等分运行,并浮出判断(CLI现在;GitHub Action surface to follow).

中文使用文档
文档目录5 节
  1. 这是什么(这个增量)
  2. GitHub 动作
  3. 仍待出(问题8)
  4. 使用
  5. 硬化

@ design- parity/ action

集成层——它将每个其他的软件包连接到一个对等运行和 将结果贴在公关上.

resolver ──(Correspondence[])──┐
                               ▼
        registry[source].resolve ──(DesignReference)──┐
                                                       ▼
   candidate render ──(CandidateRender)──►  diff + checks ──(Verdict)──┐
                                                                       ▼
            policy direction ───────────────►  ParityReport ──► markdown

这是什么(这个增量)

  • createAdapterRegistry() - 那个 source → ReferenceAdapter 地图( 图 / 缝合/ Claude-design). 它住在这里,因为它是一个进口的地方 所有三名司机; core 不得依赖适配器.
  • orchestrate() ——每个部分:通过适配器解决参考问题, 与众生同在一起, diff 他们,集合. 失败软件页:1 适配器/潜水器出错被捕获并浮出水面,永不抛出,永不升级 总体状况——只有真正的判决才是如此。 均等 方向 决定 是否为失败区块( e)design-led)或为咨询(code-led) (中文(简体) ).
  • resolveRunConfig() - 装入承诺 design-map.json 财务报告和审定财务报表 .design-parity.json (有决;无模型,无网络.
  • renderReport() ——单打分下注(有稳定的标注如此) gitHub 表面可以更新它自己的评论.
  • design-parity run CLI——当地竞选;候选人来自 --candidates <file> 目前(可复制离线).

消耗的部件 .design-parity/known-differences.json 宣布他们 对应的每个可视键上的精确目录定位符 design-map.json 输入。 范围有意包括: default/light 常见 横跨目录,永远不能选择其他组件的接受.

{
  "code": "ui/IconButton.kt#Tonal",
  "source": "figma",
  "ref": "figma:AbCd/1:42",
  "knownDifferences": {
    "default/light": {
      "system": "m3",
      "component": "IconButton/Tonal",
      "previewId": "iconbutton-tonal__ideal__default__light",
      "referenceId": "iconbutton-tonal-ideal-light",
      "variant": "ideal/default/light",
      "overrides": {}
    }
  }
}

目前的参考散列从被分解的参考字节中计算; 从未复制到配置中。 CLI、 PR 注释和基线模式 这些范围通过 resolveRunConfig()。 。 。 .

GitHub 动作

action.yml + 键 dist/cli/action.js 从触发中自动选择一个模式 事件 (叹为观止) compose-ai-tools apply 动作 :

  • 注释 a 包括: pull_request: 读取已修改的文件, 保留 design-map.json 其文件已更改的组件(不触及的 PR 是 作为非UI处理并跳过,运行管道 后/更新一个 判决评论 (通过报告标记提供). 仅在 方向块(design-led + 失败)。 如果还本付息 没有 承诺 design-map.json (没有建立平等),它发布一次性 通知指向交互式靴子(design-parity-bootstrap,第11号 而不是在运行时猜测设计qq代码映射.

  • 基线 a 包括: push 页:1 development_branch (默认) main: 执行 满 绘制地表,运行管道,以及 发布 可浏览文物 - 一个顶级的 README.md + 键 index.html 登陆页面 (将每个组件的报告与"生成,不编辑"的横幅相链接), 每个组件自成一体 report.html 三脚架,机器可读 findings.json (单位:千美元)compose-preview-parity-findings/v1 - 什么跑步吗 结 论,以预览 id 和代码控件键入,每个查找都锁定到 因此,一个预览服务器可以在自己的区域下绘制判断 比较,而不是连接到无法读取的一页),机器可读 verdict.json (一个版本) BaselineSummary - 携带 formatVersion + 键 $schema,对 schema/verdict.schema.json; 见 docs/report-format.md)和——当运行时 披露任何设计系统符号——总表作为稳定区DTCG tokens/design-system.tokens.json (与索引链接;已知位置) 以指向克洛德设计公司的GitHub导入 at —— 改为常设 artifact_branch (默认) design-parity/<dev-branch>) (中文(简体) ). 这给出了一个稳定,始终不变的观点 main============================================================= 执行生成的PNG/HTML main,而一个真正的基线 PR 可以 diff 其候选人反对。 要求数 contents: write。 。 。 .

    历史自动累积. publishBaseline 重建每个运行的树 (线性承诺链、快前推-否) 因此,文物分支 已经携带每跑一次。 着陆 每页链接屏幕 历史 改为每个 report.html承诺日志。 因为 report.html 是决定性的,运行 不改变屏幕触摸不 文件并添加不承诺的噪声 — 历史确切显示运行于 屏幕的代码或模拟实际上已经改变.

  • 跳过 ——无一适用(如:向非dev分支推.

mode: baseline|comment|skip 在需要时对选择器进行覆盖.

# .github/workflows/design-parity.yml
on:
  pull_request:
  push:
    branches: [main]
jobs:
  parity:
    runs-on: ubuntu-latest
    permissions:
      contents: write       # baseline mode force-updates the artifact branch
      pull-requests: write  # comment mode posts the verdict comment
    steps:
      - uses: actions/checkout@v4
      # ... a prior step renders candidates -> candidates.json (or bundles) ...
      - uses: yschimke/design-parity/packages/action@main
        with:
          candidates: candidates.json        # CandidateRender[] …
          # candidate_bundles: out/previews   # … and/or compose-preview bundles
          # development_branch: main          # push here → baseline mode
          # artifact_branch: design-parity/main

选择器 + 表面逻辑 (selectMode, (中文(简体) ), postReport, (中文(简体) ), componentsForChangedFiles, (中文(简体) ), checkConclusion和文物建造者 (单位:千美元)baselineSummary, (中文(简体) ), renderBaselineIndex)纯度和单位测试 管道(publishBaseline)使用可注射器 GitRunner 所以说 孤儿/再父母/强力推进序列在没有真正遥控器的情况下进行单位测试.

仍待出(问题8)

  • 现场直播 compose-preview 在候选供应商(现职候选人) 来自一个预算 CandidateRender[] / 预览捆绑).
  • 组合 + 执行 dist/ 因此动作可以直接消耗(例如通过 ncc(中文(简体) ) 并可以被钉入 yschimke/design-parity/packages/action@<tag>。 。 。 .
  • 对照已公布的基准( verdict.json 在文物分支)进行回归检测.

使用

import { createAdapterRegistry, orchestrate, renderReport } from "@design-parity/action";

const report = await orchestrate({
  repoRoot,
  registry: createAdapterRegistry(),
  correspondences,            // from @design-parity/resolver
  candidate: (id) => renders.get(id),
  direction,                  // from @design-parity/policy
});
console.log(renderReport(report));

硬化

src/shard.ts 拆分一个 横穿 N 工作, 将棋子放回: a 每个硬体独立产生 (单位:千美元)partitionComponents页:1 shard.json 每个硬的,和 verifyShardReports + 键 mergeShards 让他们加入到连环跑中 没错 是什么让一个 详尽无遗 比较适合工作超时而不是工作超时 缩小为手取子集.

上面的CLI们 design-parity shard (单位:千美元)cli/shard-cli.ts,阅读 使步, design-parity run --shard i/N (单位:千美元)cli/run.ts),以及 design-parity merge (单位:千美元)cli/merge.ts) (中文(简体) ). 硬汉两边都读 不变 分区执行-见 docs/PARALLEL_PARITY.md 以无常者和两道命令盟誓, 由它打开.

版本与发布记录

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

版本发布日期距今
1.18.0latest2026/11/074 天前
1.17.02026/10/2617 天前
1.16.12026/10/1824 天前
1.16.02026/10/1726 天前
1.15.02026/10/1528 天前
1.14.12026/10/1230 天前

关于 @design-parity/action 的常见问题

@design-parity/action 是什么?

集成层:电线解析器,适配器,候选,检查,diff,和策略进入等分运行,并浮出判断(CLI现在;GitHub Action surface to follow).

如何安装 @design-parity/action?

在项目目录运行 npm install @design-parity/action,或使用 pnpm add / yarn add / bun add。

@design-parity/action 支持 TypeScript 吗?

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

@design-parity/action 支持 ESM 还是 CommonJS?

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

@design-parity/action 可以商用吗?

@design-parity/action 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@design-parity/action 的下载量有多少?

根据 npm 官方下载统计,@design-parity/action 在 2026/10/12 – 2026/11/10 这 30 天内被下载 3,638 次,日均约 121 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@design-parity/action 还在维护吗?

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