feat: ship the unique offline marqdo web Tool (WEB-02 candidate)
Implement the first Preview candidate in its unique owner repository: - marqdo web check/preview/handoff with explicit ENTRY/--unit/--root/--out/ --theme; independent executable packaged with tool.json (command web, api_revision/analysis requirements). - Consume only the public marqdo-web-design crate at a fixed git revision (Cargo.lock pinned; no ../design path dependency, no Markdown re-parsing). - preview renders one offline index.html: strict hashed CSP (default-src 'none', no network), visible prototype banner and build summary, escaped Design ContentBlocks (raw HTML stays inert), finite-state scenario panels with hashed inline script and reset, no server/timer/eval business logic. - Publication refuses existing outputs and symlink targets, builds in a private sibling staging dir and renames atomically; 0/1/2 exit codes with stderr diagnostics. - scripts/ci.sh installs the Tool through the real CLI, runs all three commands on a fixture project, asserts the offline/safety facts, verifies the CLI binary digest is unchanged and removes the Tool. - Evidence records we do NOT yet claim real-browser/responsive acceptance, image assets, the full negative matrix, budgets/timeouts or WEB-05 cold install. Refs cflmy/marqdo-web-preview#1, cflmy/marqdo#6
This commit was merged in pull request #2.
This commit is contained in:
1 parent
8b3281bac0
commit
e739f4504a
12 files changed
+928
-26
No files matched your search
@@ -0,0 +1,39 @@
|
||||
# WEB-02 Preview 候选证据(离线制品 / 唯一 web Tool / 有限场景)
|
||||
|
||||
日期:2026-11-27。责任仓:`marqdo-web-preview`;工单:[marqdo-web-preview#1](https://git.cflmy.cn/cflmy/marqdo-web-preview/issues/1)(WEB-02);父工单:根 [marqdo#6](https://git.cflmy.cn/cflmy/marqdo/issues/6)。
|
||||
|
||||
本文件记录 WEB-02 的**首个候选**:唯一 `marqdo web` Tool 的 check/preview/handoff 入口、离线静态预览、有限场景、CSP 与原子发布。真实浏览器行为验收、资产复制与完整安全矩阵尚未完成,未在此声明。
|
||||
|
||||
## 输入身份
|
||||
|
||||
| 对象 | 身份 |
|
||||
| --- | --- |
|
||||
| CLI | 由根固定 `cli/deadf6e` 构建的 `marqdo 3.0.0-rc.4`,SHA-256 `sha256:6ede3b9e...` |
|
||||
| Design 依赖 | `marqdo-web-design@2f18dede8540c82611819e2c24a19db138d5ac14`(`Cargo.lock` 固定 git rev;不是 `../design` 路径依赖) |
|
||||
| 平台 | Linux x86_64(本机验证) |
|
||||
|
||||
## 执行
|
||||
|
||||
```sh
|
||||
MARQDO_BIN=<verified marqdo> scripts/ci.sh
|
||||
```
|
||||
|
||||
脚本真实执行:fmt/clippy → 构建 release → 生成 `tool.json` bundle → `marqdo tool install` → `marqdo web check/preview/handoff`(fixture 工程)→ 覆盖拒绝 → CLI 二进制 SHA 不变 → `tool remove web`。
|
||||
|
||||
## 已验证(PASS)
|
||||
|
||||
- **唯一入口**:`tool.json`(`command: web`)+ 独立 executable;`marqdo web check|preview|handoff ENTRY --unit ANCHOR [--root] [--out] [--theme]`。
|
||||
- **离线制品**:`preview` 生成单个 `index.html`(不启动服务、无网络请求),`file://` 可打开;CSP `default-src 'none'; style-src/script-src sha256; img-src 'self'; connect-src 'none'; form-action 'none'; base-uri 'none'`。
|
||||
- **有限场景**:Design 模型中的场景面板与交互按钮渲染为内联固定脚本(CSP hash 放行);点击仅切换预渲染面板,无定时器/网络/eval;含“重置原型”。
|
||||
- **原型标识与摘要**:页首与摘要可见“原型 / 模拟”,列 root 与参与源 `sha256`;不显示完整 Analysis 或绝对路径。
|
||||
- **安全渲染**:Design 的 `ContentBlock` 文本全部 HTML 转义;raw HTML 显示为 inert 文本;不输出 `href="javascript:`、无外部 script。
|
||||
- **发布安全**:输出目录/文件必须不存在;staging 私有目录校验后原子 rename;失败清理;拒绝符号链接目标。
|
||||
- **退出码**:设计错误 1、参数/环境/IO 错误 2、成功 0;诊断写 stderr。
|
||||
- **Tool 生命周期**:真实 CLI `tool install` / 运行 / `tool remove web`;CLI 二进制 SHA 前后不变。
|
||||
|
||||
## 未验证 / 后续(不隐藏)
|
||||
|
||||
- 真实浏览器(Playwright/file://)行为、responsive 390px 无横向溢出、按钮实际状态切换的 DOM 断言未执行;当前只有静态制品断言。
|
||||
- 图片/本地 raster 资产复制、魔数/大小校验、远端图片文本占位尚未实现(当前不渲染图片)。
|
||||
- 完整安全负例矩阵(`</script>`/Unicode/双引号 fixture、输出预算边界、超时/进程限制)未系统性覆盖。
|
||||
- 冷安装(root 生态 `web` Tool 与 WEB-05)未开始;WEB-04 生产交付试验未开始。
|
||||
Reference in new issue
Block a user