Skip to content

v0.6.0

Choose a tag to compare

@LoktLin LoktLin released this 09 Oct 04:58
· 13 commits to main since this release

中文 | English

更新说明 · v0.6.0

本版新增一个面板 Tab 「体检」、两个工具,以及一项读取能力修复(Sketch 插件格式的稿子以前读不出来)。

新增功能

  • 面板新增「体检」Tab —— 两个项目级功能,不用记命令:
    • 变更:选一张稿、选两个版本 → 显示"这次设计改了什么"(尺寸/圆角/颜色/布局/文字/增删)。
    • 一致性:扫一个项目的多张稿 → 报告设计系统漂移(同一组件多种规格、字号阶梯、色值近重复、间距、圆角)。
    • 两者都是耗时操作:运行时按钮禁用并显示进度,可取消。扫描张数默认 20、硬上限 200,界面会写明"本次约 N 次请求"。
  • 新工具 lanhu_diff_design —— 同一张稿两个版本的变更对比(蓝湖自身不提供版本对比)。
    报告的匹配可靠度是明确的:大面积对不上时会明说"逐块对比不可靠"并拒绝出明细,而不是给你一张看着精确的表。
  • 新工具 lanhu_audit_project —— 跨稿一致性审计。判据是"层名归一化后相同";
    工具默认名(如 Rectangle 12)一律不认并计入"未参与",命名覆盖率一并报出;命名不可靠或样本太少时拒绝出明细。
  • lanhu_read_blocks 新增「对比度」段落 —— 文字色与其有效背景的 WCAG 对比度。
    有效背景沿祖先链找最近的填充;半透明逐层合成;算不出时明说"未做对比度判断",不会假定白底。
    判据:正文 ≥4.5:1、大号文字 ≥3:1;不达标会给可直接抄的色值建议。
  • 面板标题栏显示当前版本,npm 上有新版时多一个小圆点。

升级注意

  • ⚠️ Sketch 插件格式(type: sketchPlugin)的稿子,输出会变 —— 以前它们返回
    「共 1 块:画板 1」+ 空表(一个块都没解析出来),现在能正常解析。某项目实测 11/20 是这种格式,
    例如那张稿从 1 块 → 37 块、画板尺寸从缩略图 480×270 → 真实 1920×1080。
    如果你的流程里对这类稿做过"空稿"处理,请重新检查。
  • lanhu_read_blocks 的返回新增字段:version / versionIsLatest / latestVersionAt / contrast;
    非 Figma 格式还会带 sourceFormat。普通稿的返回与文本输出逐字节不变。
  • 读不出图层时,返回带机器可读标志:unsupported: true + sourceFormat + code,且文本会说明
    **"本次输出是空的,但不代表这张稿是空的"**与下一步 —— 不再有"看着成功其实什么都没干"的情况。
  • 工具数 15 → 17。

问题修复

  • Sketch 插件格式静默失败:info[] 里的图层以前完全没被解析,却返回成功形态。
    现在按实测映射规则归一化后走同一条解析链(坐标/尺寸/圆角/颜色/渐变/边框/字体/切图),
    与 Figma 稿共用同一套块模型。

其他变更

  • 面板 Tab 名「登录态」与代码统一为「账号」。
  • 新增文档:docs/设计变更.md、docs/设计系统审计.md;docs/读稿.md 增加「支持与不支持的稿件格式」。

Full Changelog: v0.5.4...v0.6.0


New Features

  • New "Checkup" tab in the panel — two project-level features without memorising commands:
    • Changes: pick a design and two versions → see what the design update changed (size/radius/colour/layout/text/additions/removals).
    • Consistency: scan a project's designs → report design-system drift (one component with several specs, font-size ladder,
      near-duplicate colours, spacing, radii).
    • Both are long-running: buttons disable with a progress line, and they can be cancelled. Scans default to 20 designs
      with a hard cap of 200
      , and the UI states "about N requests this run".
  • New tool lanhu_diff_design — compare two versions of one design (Lanhu itself offers no version comparison).
    Match reliability is stated explicitly: when large parts fail to match it says "block-level comparison is unreliable"
    and refuses to print a detail table
    rather than producing a precise-looking one.
  • New tool lanhu_audit_project — cross-design consistency audit. The criterion is "layer name equal after
    normalisation"; tool-generated names (e.g. Rectangle 12) are never accepted and are counted as "not participating",
    with naming coverage reported. When naming is unreliable or the sample is too small, no details are printed.
  • lanhu_read_blocks gains a "Contrast" section — WCAG contrast between text colour and its effective background.
    The background is found by walking up the ancestor chain to the nearest fill; translucency is composited layer by layer;
    when it cannot be determined the output says "not judged" instead of assuming white.
    Thresholds: body ≥4.5:1, large text ≥3:1, with ready-to-copy colour suggestions.
  • The panel title bar shows the current version, with a dot when npm has a newer one.

Upgrade Notes

  • ⚠️ Output for Sketch-plugin designs (type: sketchPlugin) changes — they used to return
    "1 block: artboard 1" with an empty table (nothing was parsed at all). They now parse normally. In one project
    11 of 20 sampled designs were this format; a given design went from 1 block to 37, and the artboard size from the
    thumbnail's 480×270 to the real 1920×1080. If your pipeline treated these as empty designs, re-check it.
  • lanhu_read_blocks returns new fields: version / versionIsLatest / latestVersionAt / contrast, plus
    sourceFormat for non-Figma formats. Output for ordinary designs is byte-for-byte unchanged.
  • When layers cannot be read, the return carries machine-readable flags (unsupported: true, sourceFormat, code) and the
    text states "this output is empty, but that does not mean the design is empty" with a next step — no more
    "looks successful but did nothing".
  • Tool count 15 → 17.

Bug Fixes

  • Silent failure on Sketch-plugin designs: layers inside info[] were never parsed, yet the call reported success.
    They are now normalised and go through the same parsing chain (position/size/radius/colour/gradient/border/font/slices),
    sharing one block model with Figma designs.

Chores

  • The panel tab previously called "login state" is now "Accounts", matching the code.
  • New docs: docs/设计变更.md, docs/设计系统审计.md; docs/读稿.md gains a "supported and unsupported design formats" section.

Full Changelog: v0.5.4...v0.6.0