Files
md-preview/agent/README.md
Richard Wu 0b97bcb6dc test: add a CDP-based pre-release UI smoke harness
The DSH sandbox blocks named pipes, so Chromium/WebView2 cannot start inside
it (window renders white, msedgewebview2 exits immediately; Edge headless
fails with a Mojo platform-channel access-denied fatal). UI verification
therefore moves to a script the user runs from a normal desktop shell.

- agent/tests/ui-smoke.ps1: launches the built exe with an isolated config
  and --remote-debugging-port, waits for the port, runs the driver, closes.
- agent/tests/ui-smoke.mjs: connects over CDP, snapshots the page (preview
  content, headings, fold toggles, highlighted code, window.ipc bridge),
  saves a screenshot and a JSON report for the agent to read.
- The driver was validated against a mock CDP server; the real end-to-end run
  needs a desktop shell (sandbox cannot host WebView2).
2026-11-04 15:15:24 +08:00

56 lines
2.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# agent/ — MD Preview 维护者工作区
这里是本项目的“Agent 附属区”:文档、构建/冒烟/发布脚本、测试夹具与验证记录。应用代码仍在 `src/`。
## 规则
维护本仓库前先读 [`AGENTS.md`](AGENTS.md):**最高优先级是仓库边界——任何仓库外的文件修改都必须先停下询问用户。**
## 目录
| 路径 | 用途 |
|---|---|
| `AGENTS.md` | Agent 运行规则(仓库边界、改动流程) |
| `docs/HANDOFF.md` | 主交接文档(工具链、构建、完整性级别、验收) |
| `docs/migration-2026-11-02.md` | Low 工作区迁移与目录移动步骤 |
| `docs/scan-2026-10-21.md` | 代码扫描:残留、bug、修复建议 |
| `docs/roadmap.md` | 功能路线图与验收标准 |
| `scripts/build.ps1` | 开发构建(cargo test + build --release + 校验) |
| `scripts/publish.ps1` | 用户手动发布到 Nutstore(Medium) |
| `tests/smoke.ps1` | cargo test + 关联检查 + 可选隔离启动 |
| `tests/ui-smoke.ps1` + `ui-smoke.mjs` | 发布前 UI 冒烟:CDP 断言页面渲染、截图、JSON 报告(需普通桌面 PowerShell + Node 21+) |
| `tests/fixtures/` | 手工/冒烟用 Markdown 样例 |
| `reports/` | 验证记录(文本;截图放 `agent/tmp/`,不入库) |
| `notes/` | 草稿 |
## 不变量
1. **仓库根**:`D:\Scripts\md-preview\AgentLowWorking`。默认 `.md` 打开方式指向 `C:\Users\wucl1\Nutstore\1\Scripts\MD-Preview-windows-x64.exe`。
2. **离线**:不引入联网、自动更新、遥测;外部链接交给系统浏览器。
3. **轻量**:不为小功能引入新库;优先原生 JS/CSS 与已有依赖。
4. **测试**:`cargo test` 必须保持全绿;UI 行为用 `tests/fixtures` 做手工/冒烟回归。
## 常用命令
~~~powershell
# 开发构建(DSH workspace-write 可运行)
.\agent\scripts\build.ps1
# 只跑测试
cargo test
# 冒烟(发布后;含注册表与可选启动)
.\agent\tests\smoke.ps1 -Launch
# 发布(必须由用户在自己的普通 PowerShell 运行)
.\agent\scripts\publish.ps1
~~~
## 环境注意
仓库整棵树是 **Low** 完整性级别,DSH 以 `workspace-write` 运行即可改代码/编译。构建产物 `target\release\md-preview.exe` 也是 Low,不能直接双击;开发冒烟用 `MD_PREVIEW_CONFIG_DIR` 指到仓库内目录。发布由用户手动运行 `publish.ps1` 升到 Medium 并复制到 Nutstore。详见 `docs/migration-2026-11-02.md`。
## Git
仓库由用户自行初始化(私有)。`backup/`、成品 exe、`test/` 不入库;`agent/` 全量入库(`agent/tmp/` 与日志/截图除外)。