feat: WEB-01 core Design interpreter over public Analysis 3
Implement the first real Design capability in the unique owner repository: - src/analysis.rs runs the verified CLI check --emit with direct argv, validates Analysis 3 schema/source_digest, and snapshots one module without any implicit discovery or Markdown parser. - src/document.rs selects the exact Knowledge H2 by anchor, direct retained H3 sections, and the single GFM 组件 table from the analysis AST; cell text is read from the analysis-provided source by UTF-8 byte span. - src/lib.rs binds design links by exact candidate_path + anchor (never label or filename guessing), validates rows/slots/widths, recursion, containment cycles and module/depth/byte limits, and builds deterministic component definitions, separate instances, source identities and a provisional handoff. - Stable diagnostics separate Engine failures (exit 2) from author-contract errors (exit 1); no partial model on failure. - tests/design_contract.rs exercises the real CLI for recursive layout, definition reuse, width forms and the main negative cases; scripts/ci.sh is the explicit entry (fmt/clippy/test) with a verified CLI. Scenarios/input/event/dependency contracts and the full WEB-03 handoff remain open and are recorded as unverified in the evidence document. Refs cflmy/marqdo-web-design#1, cflmy/marqdo#6
This commit was merged in pull request #3.
This commit is contained in:
1 parent
39c99e59d2
commit
75cd26ef89
13 files changed
+1649
-15
No files matched your search
@@ -34,3 +34,9 @@ pub fn handoff(design: &Design) -> String;
|
||||
|
||||
- `load`/`handoff` 与数据模型在 WEB-01 前为 provisional,可破坏式调整;WEB-01 后进入 SemVer。
|
||||
- 需要破坏性变更时,Design 与 Preview 在同一领域候选组合中一起升级,`Cargo.lock` 固定实际消费身份;不维护旧协议 fallback。
|
||||
|
||||
## 实现状态(WEB-01 核心候选)
|
||||
|
||||
`load` 已实现:真实 CLI Analysis 3 摄入、精确 anchor 选 Knowledge H2、`组件` 表递归布局、宽度/行/槽校验、包含环与资源上限、稳定诊断与源身份;`handoff` 目前输出确定性的组件树与来源摘要。
|
||||
|
||||
未导出/未实现:`输入`/`事件`/`依赖`/`验收` 合同模型、`Scenario`/`Interaction`、`DesignGraph` 的完整依赖图与 WEB-03 handoff。按 provisional 约定,这些可在 WEB-01 完成前破坏式调整;Preview 不得自行实现上述解释。
|
||||
+10
-11
@@ -27,22 +27,21 @@ RC.4 Analysis 只包含已静态加载模块,`not_loaded` 不等于缺失。
|
||||
- `missing/ambiguous/outside_scope/invalid/external` 对设计依赖是错误;普通内容链接不追踪。无法从公开字段确认物理映射时报告“不支持”,不得调用私有 loader 或搜索文件名。
|
||||
- 并发编辑一致性:以实际输入 bytes 与 digest 校验;同一文件在一轮中两次 Analysis 内容不同即失败重试;输出前复核所有参与设计的源码/资产摘要。交付只列真正使用的输入,不打包全部已加载依赖。
|
||||
|
||||
## 计划代码结构(尚未创建)
|
||||
## 代码结构(WEB-01 核心已创建)
|
||||
|
||||
```text
|
||||
Cargo.toml / Cargo.lock
|
||||
src/lib.rs # 公开 API 与结果类型
|
||||
src/analysis.rs # CLI 调用、公开协议校验、静态输入快照
|
||||
src/document.rs # 确定的章节/表格选择、单元引用
|
||||
src/model.rs # 定义、实例、布局、场景、来源
|
||||
src/graph.rs # 递归链接、循环、依赖与限制
|
||||
src/handoff.rs # Markdown 交付
|
||||
src/diagnostic.rs # 稳定错误码与来源位置
|
||||
tests/ # 单元、负例、真实 CLI contract
|
||||
scripts/ci.sh # 激活时提供的独立验收入口
|
||||
docs/
|
||||
src/lib.rs # 公开 API、递归布局/实例/上限/handoff(WEB-01 核心)
|
||||
src/analysis.rs # CLI check --emit 调用、Analysis 3 校验、模块快照
|
||||
src/document.rs # 精确 anchor/H3/GFM 表/Link 选择
|
||||
src/diagnostic.rs # 稳定错误码、span、Engine/Design 区分
|
||||
tests/design_contract.rs # 真实 CLI 正例 + 负例
|
||||
scripts/ci.sh # 显式独立验收入口(fmt/clippy/test)
|
||||
docs/ # API、开发指南与证据
|
||||
```
|
||||
|
||||
尚未拆分 `model.rs`/`graph.rs`/`handoff.rs` 是当前规模下的有意选择;场景/输入事件合同与完整 handoff 落地时再按真实边界拆分,不做预先空壳。
|
||||
|
||||
不为每个表格新建 crate;Design 与 Preview 各一个主要 crate。`docs/WEB-DESIGN.md` 在领域仓库,本仓库不得复制。
|
||||
|
||||
## 公开 API 原则
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
# WEB-01 Design 核心候选证据(布局 / 源身份 / 诊断)
|
||||
|
||||
日期:2026-11-27。责任仓:`marqdo-web-design`;工单:[marqdo-web-design#1](https://git.cflmy.cn/cflmy/marqdo-web-design/issues/1)(WEB-01);父工单:根 [marqdo#6](https://git.cflmy.cn/cflmy/marqdo/issues/6)。
|
||||
|
||||
本文件记录 WEB-01 的**核心候选**:Analysis 3 摄入、精确组件引用、递归布局、稳定诊断与源身份。场景/输入/事件/依赖与更完整 handoff 仍属 WEB-01/WEB-03 后续,未在本证据中声明完成。
|
||||
|
||||
## 输入身份
|
||||
|
||||
| 对象 | 身份 |
|
||||
| --- | --- |
|
||||
| CLI | 由根固定 `cli/deadf6e` 构建的 `marqdo 3.0.0-rc.4`,SHA-256 `sha256:6ede3b9e8bcfad3942573e68b5f54b2c5bc2866b37d102f63acd49a55cb212db` |
|
||||
| 根组合 | `cflmy/marqdo@d4ccb77` |
|
||||
| 合同 | `marqdo-ext-web` 的 `docs/WEB-DESIGN.md`(只读引用,不复制) |
|
||||
| 平台 | Linux x86_64(本机验证) |
|
||||
|
||||
## 执行
|
||||
|
||||
```sh
|
||||
MARQDO_BIN=<verified marqdo> scripts/ci.sh
|
||||
# = cargo fmt --check; cargo clippy --all-targets --locked -D warnings; cargo test --locked
|
||||
```
|
||||
|
||||
测试直接启动真实 CLI `check --emit` 生成 Analysis 3(无 mock),临时工程由测试写入。
|
||||
|
||||
## 已验证(8 个真实 CLI 契约测试)
|
||||
|
||||
- 正例:递归 `组件` 布局(index → nav → leaf、workspace 内容组件)、定义复用但实例独立(`root`/`root/left`/`root/right`)、内容-only 组件、宽度 `auto`/`1fr..12fr`/`120px..1200px`。
|
||||
- 源身份:每个参与模块的 root-relative path、module id、`source_digest`、Unit path/anchor/UTF-8 span;两次加载的 handoff 逐字节一致。
|
||||
- 负例(稳定诊断码):缺失/歧义 anchor、H2 非 Knowledge(Exec)、带 `#` 的 unit、表头/列数/非 Link 单元格/非法宽度/重复 slot/行号不连续、目标越界(Analysis 无可用 candidate)、目标 anchor 缺失、包含环、模块/深度/源字节上限、CLI 缺失、ENTRY 越出 root、ENTRY 不存在。
|
||||
- 引擎失败与作者合同错误区分(`LoadError::Engine`/`Design`),宿主据此映射退出码 2/1;失败不产生部分模型。
|
||||
- 不使用 `../design` 路径依赖,不复制 Markdown/语言解析器;只消费 Analysis 公开字段。
|
||||
|
||||
## 未实现 / 未验证(不隐藏)
|
||||
|
||||
- 保留 H3 的 `输入`/`事件`/`依赖`/`验收` 合同模型、`场景`/`交互`(有限状态)解释与校验尚未实现;
|
||||
- handoff 当前为确定性组件树/来源摘要,WEB-03 的组件图、单组件切片与漂移标识未完成;
|
||||
- 并发编辑/陈旧 Analysis 的二次一致性复核、资源上限的完整矩阵、symlink/双重编码等安全负例仅覆盖部分;
|
||||
- 未配置组件 CI 服务(`scripts/ci.sh` 为显式入口,需 CI 传入固定 CLI 制品);领域/根接入(WEB-05)未开始。
|
||||
|
||||
因此 WEB-01 不关闭;后续在同一仓库按上述范围继续,不把本候选当作完整验收。
|
||||
Reference in new issue
Block a user