Repository navigation
0.4.0
四条攒着的改进。 它们不是临时起意,而是 0.3.0 之后主动记在「已知空缺」里、等一个真改动一起发的 ——
其中第一条既是新能力,也是一个一致性修复。
新增功能
lanhu_list_designs收url:以前入参只有projectId(必填),而它的兄弟lanhu_list_product_documents收链接 ——
于是"列出这个项目的设计稿"反而要调用方先手拆 pid,与插件对外的承诺(「链接里的 tid/pid/image_id 不用手拆」)打架。
现在项目页链接(没有image_id的那种)也能直接列出(实测某项目 252 张)。
projectId改为非必填,但两者都不给会明确报错(不许静默返回空列表);显式projectId优先。- 清单加
order:它正好解释"界面只看到 3 个、接口给 9 个"这个疑问 —— 蓝湖「文档」面板按order倒序
显示且是滚动区。实测该项目order是 10→2 连续,与界面面板顺序完全一致。 withPages(默认关):附上每份原型的页面节点数 / 可读页数。同一个项目里从 3 页到 219 页(差 20 倍),
有了它 AI 能一眼选对文档,不必逐份读一遍才发现拿错。代价 N 份 = N 次额外请求(已写进描述与文档)。- 标题标明「路径」:嵌套原型页的标题会拼成
A / B / C,看起来像"把多页合并了"(实测我自己就据此误报过一次)。
现在输出路径:A / B / C。
体验优化
- CLI 与工具两条链对齐:
designs --url、product-docs --with-pages——
这个项目有过"CLI 是对的、只有工具链断了"的前例,反过来同样得防。 - 判定放在源头:传
name时同时给nameIsPath: true,下游 4 个标题打印点统一走titleName()——
比"每处自己拼字符串"更不容易漏(第 5 个站点不会又忘)。机器读的 JSON 也带nameIsPath,
而name保持原值(展示格式不污染程序消费)。 - 单份失败不炸整张表:
withPages拉不到的文档只把该行标?并给原因。
问题修复
parseLanhuUrl不能拿来列设计稿:它面向"某一张稿",没有image_id就抛错,
而项目页链接本来就没有它(第一版真机直接撞上)。→ 新增parseProjectTarget(面向"某个项目"),
并加反向断言守住parseLanhuUrl必须继续要求image_id,不许为迁就新用法被改宽容。- 同一个 bug 出现两次:列表渲染"多一个空列"(单元格带了前导
|而行模板已收尾),
工具与 CLI 各栽一次(因为各写了一遍渲染)→ 抽成共用纯函数,并断言表头/分隔/行列数一致。 - 一条断言是瞎的:
路径:在标题行与每页标题两处都有,最初只断言了标题行 ——
把「每页标题」去掉的变异注入成功却 0 条红。拆成两条后两处各自能红。
其他变更
- 自检 530 → 564 项;变异测试 7 处全部变红,其中一条盯的是源头标记 ——
只测打印点的话,"源头忘了打标记"会让四个站点同时失灵却可能一条都不报。 - 「已知空缺」里这四条标记为 0.4.0 已做(保留记录,不删)。
docs/原型样式.md新增「标题里的『路径:』是什么意思」;docs/产品文档.md补order与withPages。
Full Changelog: v0.3.0...v0.4.0
New Features
lanhu_list_designsacceptsurl: its parameters wereprojectId(required) only, while its sibling
lanhu_list_product_documentsaccepted a link — so "list this project's artboards" forced the caller to
split out the pid by hand, contradicting the plugin's own promise thattid/pid/image_idnever need manual
splitting. A project page link (the kind withoutimage_id) now works directly — measured 252 artboards on
one project.projectIdis no longer required, but giving neither now fails loudly instead of returning an
empty list; an explicitprojectIdwins.orderin the document list: it explains the old puzzle of "the UI shows 3, the API returns 9" — Lanhu's
「文档」 panel sorts byorderdescending and is a scroll region. On the project testedorderruns 10→2 and
matches the panel exactly.withPages(off by default): adds each prototype's page node count / readable page count. Within one
project this ranges from 3 to 219 pages (a 20× spread), so an AI can pick the right document at a glance
instead of opening each one. The cost — N documents = N extra requests — is stated in the description and docs.- Headings now say 「路径」: a nested prototype page's title used to read
A / B / C, which looks like several
pages merged into one (that is exactly how the maintainer misread it once). It now reads路径:A / B / C.
Improvements
- CLI and tools are aligned again:
designs --urlandproduct-docs --with-pages. This project has been bitten
before by "the CLI was right and only the tool path was broken"; the reverse deserves the same care. - The decision lives at the source:
nameIsPath: trueis attached wherenameis produced, and all four
heading print sites go through onetitleName()helper — less likely to be missed than assembling strings in
each place. Machine-readable JSON carriesnameIsPathtoo, whilenamekeeps its raw value so display
formatting does not leak into program consumption. - One failure does not take down the table: a document whose page data cannot be fetched is marked
?with a
reason.
Bug Fixes
parseLanhuUrlcannot be used to list artboards: it targets a single artboard and throws when there is no
image_id, which project page links do not have (hit on the very first real-machine run). → added
parseProjectTargetfor "a project", plus a reverse assertion thatparseLanhuUrlkeeps requiring
image_idso it is never quietly loosened to accommodate the new use.- The same bug twice: list rendering produced one extra empty column (a cell carried a leading
|while the
row template already closed the row) — hit once in the tool and once in the CLI, because each had its own
renderer → extracted into a shared pure function with assertions on header/separator/column counts. - One assertion was blind:
路径:appears both in the title line and in each page heading, but initially only the
title line was asserted — removing it from the page heading was successfully injected yet turned 0 assertions
red. Split into two, both mutations now fail.
Chores
- Self-check 530 → 564 assertions; all 7 mutations turn red, one of them guarding the source-level flag —
testing only the print sites would let a missing source flag break all four sites without a single red. - The four items in the "known gaps" list are now marked done in 0.4.0 (the record is kept, not deleted).
docs/原型样式.mdgained a section on what 「路径:」 means;docs/产品文档.mddocumentsorderandwithPages.
Full Changelog: v0.3.0...v0.4.0