Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7a2c9280c0 | ||
|
|
df4324f3e3 |
No files matched your search
@@ -10,8 +10,9 @@ Marqdo **Web 领域聚合仓库**(状态:`planned`)。本仓固定 Web 作
|
|||||||
| --- | --- |
|
| --- | --- |
|
||||||
| [docs/WEB-DESIGN.md](docs/WEB-DESIGN.md) | **唯一现行 Web 作者合同**:作者写什么、如何被确定性解释、什么被拒绝、命令/退出码/安全/handoff/诊断/变更流程 |
|
| [docs/WEB-DESIGN.md](docs/WEB-DESIGN.md) | **唯一现行 Web 作者合同**:作者写什么、如何被确定性解释、什么被拒绝、命令/退出码/安全/handoff/诊断/变更流程 |
|
||||||
| [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) | 领域治理与开发流程:组件关系、依赖规则、激活门禁、组件→领域→根候选晋升、三层验收、工单路由 |
|
| [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md) | 领域治理与开发流程:组件关系、依赖规则、激活门禁、组件→领域→根候选晋升、三层验收、工单路由 |
|
||||||
| [examples/research-workspace/](examples/research-workspace/) | 根规范 §8 科研工作台示例(六个 `.mq.md` 原样收录);状态 `UNVERIFIED` |
|
| [examples/research-workspace/](examples/research-workspace/) | 根规范 §8 科研工作台示例(六个 `.mq.md` 原样收录);入口 Analysis 已由 WEB-00 实测,Design/Preview 解释前整体仍 `UNVERIFIED` |
|
||||||
| [tests/README.md](tests/README.md) | 领域/跨组件验收的目录、证据与当前状态 |
|
| [tests/README.md](tests/README.md) | 领域/跨组件验收的目录、证据与当前状态 |
|
||||||
|
| [docs/evidence/WEB-00-analysis-probe.md](docs/evidence/WEB-00-analysis-probe.md) | WEB-00:真实 CLI Analysis 3 对合同依赖的探测证据(入口/链接/目标/负例,PASS) |
|
||||||
| [components.toml](components.toml) | 直接子组件的治理记录(均为 planned,无 entry) |
|
| [components.toml](components.toml) | 直接子组件的治理记录(均为 planned,无 entry) |
|
||||||
|
|
||||||
## 领域边界
|
## 领域边界
|
||||||
@@ -37,6 +38,14 @@ Marqdo **Web 领域聚合仓库**(状态:`planned`)。本仓固定 Web 作
|
|||||||
- Design 和 Preview 在各自的独立仓库开发。 [marqdo-web-design](https://git.cflmy.cn/cflmy/marqdo-web-design) · [marqdo-web-preview](https://git.cflmy.cn/cflmy/marqdo-web-preview)
|
- Design 和 Preview 在各自的独立仓库开发。 [marqdo-web-design](https://git.cflmy.cn/cflmy/marqdo-web-design) · [marqdo-web-preview](https://git.cflmy.cn/cflmy/marqdo-web-preview)
|
||||||
- 本仓库不提供运行时入口,也不需要另一份 `tool.json`;唯一工具入口属于 Preview 的 `web` 命令。
|
- 本仓库不提供运行时入口,也不需要另一份 `tool.json`;唯一工具入口属于 Preview 的 `web` 命令。
|
||||||
|
|
||||||
|
## 独立验收入口(WEB-00 起)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
MARQDO_BIN=<verified marqdo> MARQDO_CLI_SHA256=<digest> scripts/ci.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
`scripts/risk-probe.py` 只消费真实 CLI 的公开 Analysis 3(`check --emit`),检查 WEB-DESIGN 依赖的表 AST、anchor、references `candidate_path`、目标 anchor 与负例事实;输出机器证据,缺事实即失败。它不解析 Markdown、不模拟 CLI。
|
||||||
|
|
||||||
## 仓库结构
|
## 仓库结构
|
||||||
|
|
||||||
```text
|
```text
|
||||||
@@ -60,3 +69,17 @@ marqdo-ext-web/
|
|||||||
|
|
||||||
- 根仓库:[架构](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/ARCHITECTURE.md) · [开发流程](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/DEVELOPMENT.md) · [迁移台账](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/MIGRATION.md) · [各仓库任务](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/REPOSITORY-TASKS.md)
|
- 根仓库:[架构](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/ARCHITECTURE.md) · [开发流程](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/DEVELOPMENT.md) · [迁移台账](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/MIGRATION.md) · [各仓库任务](https://git.cflmy.cn/cflmy/marqdo/src/branch/main/docs/REPOSITORY-TASKS.md)
|
||||||
- 协作约定见 [AGENTS.md](AGENTS.md)。
|
- 协作约定见 [AGENTS.md](AGENTS.md)。
|
||||||
|
|
||||||
|
## WEB-04 组合案例与生产交付试验
|
||||||
|
|
||||||
|
| 路径 | 内容 |
|
||||||
|
| --- | --- |
|
||||||
|
| `examples/doc-site/` | 文档型网站设计案例 |
|
||||||
|
| `examples/research-workspace/` | §8 科研任务台原型(Design/Preview 通用能力) |
|
||||||
|
| `examples/quantum-editor/` | 量子电路编辑器设计案例(有限场景/交互) |
|
||||||
|
| `examples/research-workbench-app/` | 科研任务台真实生产实现试验(Express + 持久化 + API/浏览器 E2E) |
|
||||||
|
| `scripts/domain-acceptance.sh` | 领域验收:三案例 check/preview/handoff + 生产应用测试,显式 CLI/Tool 输入 |
|
||||||
|
| `docs/WEB-04-delivery.md` | 设计源到生产实现的映射、有意未实现项与任务拆分 |
|
||||||
|
| `docs/evidence/WEB-04-domain-delivery.md` | WEB-04 三案例 + 生产 API/浏览器 E2E 实测证据 |
|
||||||
|
|
||||||
|
生产应用不是 `web` Tool 的运行依赖;原型 PASS 不冒充生产 PASS。
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
# 本仓只登记直接子组件(规范 §4.1)。Gitlink 是提交身份唯一权威,
|
# 本仓只登记直接子组件(规范 §4.1)。Gitlink 是提交身份唯一权威,
|
||||||
# .gitmodules 是权威远端唯一记录;此处不重复 SHA、远端和语言包锁。
|
# .gitmodules 是权威远端唯一记录;此处不重复 SHA、远端和语言包锁。
|
||||||
# 当前三条均为 planned。Design 和 Preview 固定已发布的开发提交,激活后计入完成率。
|
# 当前三条均为 planned。Design/Preview 固定已推送的 WEB-01..03 候选提交;激活见 WEB-05。
|
||||||
# 激活时同时更新 state/entry 并锁定已推送的精确 SHA(见 docs/DEVELOPMENT.md §3)。
|
# 激活时同时更新 state/entry 并锁定已推送的精确 SHA(见 docs/DEVELOPMENT.md §3)。
|
||||||
|
|
||||||
[[component]]
|
[[component]]
|
||||||
|
|||||||
+1
-1
Submodule design updated: 39c99e59d2...1b6607fd3c.
@@ -0,0 +1,54 @@
|
|||||||
|
# WEB-04 领域组合案例与生产交付试验
|
||||||
|
|
||||||
|
日期:2026-11-27。责任仓:`marqdo-ext-web`(领域组合与验收);工单:[marqdo-ext-web#2](https://git.cflmy.cn/cflmy/marqdo-ext-web/issues/2);父工单:[marqdo#6](https://git.cflmy.cn/cflmy/marqdo/issues/6)。
|
||||||
|
|
||||||
|
本文件描述 WEB-04 的三个组合案例、一个真实生产交付试验及其设计源映射。生产实现是独立应用,不是 `web` Tool 的运行依赖;原型 PASS 不等于生产 PASS。
|
||||||
|
|
||||||
|
## 三个组合案例(同一通用 renderer/Tool)
|
||||||
|
|
||||||
|
| 案例 | 设计根 | 设计单元 | 验证 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 文档型网站 | `examples/doc-site/` | `首页` | `marqdo web check/preview/handoff` |
|
||||||
|
| §8 科研任务台(原型) | `examples/research-workspace/` | `工作台` | 同上 |
|
||||||
|
| 量子电路编辑器设计 | `examples/quantum-editor/` | `编辑器` | 同上(含有限场景/交互) |
|
||||||
|
|
||||||
|
三例均由同一 `marqdo web` Tool(Design + Preview 固定 revision)驱动,没有按案例分叉的 renderer、HTML 注入或 CLI 语法。
|
||||||
|
|
||||||
|
## 生产交付试验:科研任务台
|
||||||
|
|
||||||
|
- 位置:`examples/research-workbench-app/`(Express 应用 + 真实 JSON 持久化 + 静态前端)。
|
||||||
|
- 设计源映射:
|
||||||
|
|
||||||
|
| 设计源 | 生产实现 |
|
||||||
|
| --- | --- |
|
||||||
|
| `examples/research-workspace/index.mq.md#工作台` | 页面布局与统计/任务/工作区三块 |
|
||||||
|
| `components/statistics.mq.md#统计` | `/api/stats` 与顶部统计条 |
|
||||||
|
| `components/tasks.mq.md#任务` | `/api/tasks`(列表/搜索/创建/状态流转)与任务列表 UI |
|
||||||
|
| `components/workspace.mq.md#科研工作区` | 工作区容器与错误提示区域 |
|
||||||
|
| `components/navigation.mq.md#导航` | 顶栏导航(占位,首版无多页面路由) |
|
||||||
|
|
||||||
|
- 真实能力:创建任务(校验标题/优先级)、按标题搜索、状态 open→doing→done、统计随数据联动、真实文件持久化、HTTP 错误 JSON 与 UI 错误提示。
|
||||||
|
- 有意未实现(明确记录,不冒充):认证/多用户、真实数据库、网络同步、导入导出、任务编辑/删除、真实实验设备接入。后续按 `docs/WEB-DESIGN.md` 边界在目标应用仓实现。
|
||||||
|
- 漂移追踪:重新生成 `marqdo web handoff examples/research-workspace/index.mq.md --unit 工作台`,比较 `design id` 与源摘要;本文件记录的设计源路径即映射锚点,源变更需按任务拆分更新本应用并记录差异。
|
||||||
|
- 任务拆分建议:认证与账户、数据库与迁移、任务编辑与删除、统计导出、多页面路由;各自独立应用工单,不改 Web Tool 运行时。
|
||||||
|
- 测试映射:
|
||||||
|
- 原型:`marqdo web preview` 的离线 HTML/场景(W31–W34 组合案例证据)。
|
||||||
|
- 生产 API:`npm test`(真实 HTTP + 临时文件持久化 + 错误/统计断言)。
|
||||||
|
- 生产 E2E:`npx playwright test`(真实浏览器:统计、搜索、创建校验联动)。
|
||||||
|
|
||||||
|
## 验证入口
|
||||||
|
|
||||||
|
```sh
|
||||||
|
MARQDO_BIN=<verified marqdo> \
|
||||||
|
MARQDO_WEB_TOOL_JSON=<built marqdo-web-preview tool.json> \
|
||||||
|
MARQDO_NPM_CACHE=<optional npm cache dir> \
|
||||||
|
scripts/domain-acceptance.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
脚本以同一 Tool 跑三个案例的 check/preview/handoff,再安装并测试生产应用(API + 浏览器 E2E),最后卸载 Tool;任何原型测试都不会代替生产 E2E。
|
||||||
|
|
||||||
|
## 证据与未验证
|
||||||
|
|
||||||
|
- 本文件与领域 CI 脚本构成 WEB-04 候选;实际命令输出/退出码记录在父工单与根候选评论。
|
||||||
|
- 浏览器 E2E 需要可用的 Chromium;无浏览器环境必须标 UNVERIFIED,不得用静态断言冒充。
|
||||||
|
- 领域 gitlink 固定 Design/Preview 候选与根接入属于 WEB-04/WEB-05 同候选工作;根 `--checkouts` 与冷安装证据在 WEB-05 完成。
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
# WEB-00 真实 Analysis 风险探测(W-M0)证据
|
||||||
|
|
||||||
|
日期:2026-11-27。责任仓:`marqdo-ext-web`;父工单:[marqdo#6](https://git.cflmy.cn/cflmy/marqdo/issues/6);本仓工单:[marqdo-ext-web#1](https://git.cflmy.cn/cflmy/marqdo-ext-web/issues/1)。
|
||||||
|
|
||||||
|
本文件记录 `docs/WEB-DESIGN.md` 对公开 Analysis 3 的依赖是否被真实 CLI 满足,是**候选证据**,不声称 Design/Preview 已实现或 Web 领域已激活。
|
||||||
|
|
||||||
|
## 输入身份
|
||||||
|
|
||||||
|
| 对象 | 身份 |
|
||||||
|
| --- | --- |
|
||||||
|
| 根生态组合 | `cflmy/marqdo@d4ccb7700392e87b240d20f84539921f46540dda`(六个 stdlib active、CLI Phase B) |
|
||||||
|
| CLI | 由根固定的 `cli/` 提交 `deadf6e` 构建的 `marqdo 3.0.0-rc.4`,SHA-256 `sha256:6ede3b9e8bcfad3942573e68b5f54b2c5bc2866b37d102f63acd49a55cb212db` |
|
||||||
|
| 平台 | Linux x86_64(本机验证) |
|
||||||
|
| 示例根 | `examples/research-workspace/`(`--root` 显式) |
|
||||||
|
| 入口 | `index.mq.md`,设计单元 anchor `工作台` |
|
||||||
|
|
||||||
|
## 执行
|
||||||
|
|
||||||
|
```sh
|
||||||
|
MARQDO_BIN=<verified marqdo> MARQDO_CLI_SHA256=<digest> \
|
||||||
|
scripts/ci.sh
|
||||||
|
# out/web00-analysis-probe.json 为机器证据
|
||||||
|
```
|
||||||
|
|
||||||
|
`scripts/risk-probe.py` 只消费真实 `check --emit` 的 Analysis 3,不解析 Markdown;它对入口、两个设计链接目标与两个负例 fixture 分别生成 Analysis 并检查合同所需事实。
|
||||||
|
|
||||||
|
## 结果:PASS(gaps 为空)
|
||||||
|
|
||||||
|
均已由真实 Analysis 提供:
|
||||||
|
|
||||||
|
- Knowledge H2 `工作台` 的精确 anchor、`unit_id`、`heading_span`/`span`;`anchors` 把 anchor 映射到 Unit。
|
||||||
|
- `组件` 直接 H3 节内的单张 GFM 表:AST `table` 节点、`table_row`(首行 header)、四个 `table_cell`,表头文本精确为 `行 | 槽 | 组件 | 宽度`,整表 span 与节 span 一致。
|
||||||
|
- 每个组件单元格恰好包含一个 Link;Link 的 AST span 与单元格 span 可精确比较,正文链接不会被误当作组件边。
|
||||||
|
- 设计链接对应 Analysis `references`:`source_unit` 指向所在 H3、`url`/`span` 与原链接一致、`state = not_loaded`、`candidate_path`/`fragment` 精确且相对路径;无需按 label/文件名猜测。
|
||||||
|
- 目标解析:对 `components/navigation.mq.md#导航` 与 `components/workspace.mq.md#科研工作区` 分别 `check --emit`,其 `anchors` 均能映射到 Knowledge H2,并记录 `source_digest` 作为源身份;目标均在显式 `--root` 内。
|
||||||
|
- 负例事实:普通段落链接只形成普通 reference(无保留表格);缺失 anchor 仍暴露 `candidate_path`/`fragment`,Design 可确定性拒绝。
|
||||||
|
|
||||||
|
## 合同结论与修正
|
||||||
|
|
||||||
|
- `docs/WEB-DESIGN.md` 对 Analysis 3 的依赖(GFM 表 AST、精确 anchor、references `candidate_path`、source_digest、显式 root)**与实测一致,无需修改**;未发现公开 Analysis 合同缺口,因此不向 CLI 提交新的语法/私有字段需求。
|
||||||
|
- `--unit` 的“精确 anchor”在 Analysis 中由 `anchors[].anchor` 给出,并映射到 Knowledge H2 `unit_id`;Design 必须使用该映射而不是猜路径。
|
||||||
|
|
||||||
|
## 未验证 / 后续
|
||||||
|
|
||||||
|
- 本探测只覆盖合同示例入口与两个组件目标及负例 fixture;Design(WEB-01)对递归布局/场景/诊断的实现与 Preview(WEB-02)渲染仍待开发,示例整体仍为 `UNVERIFIED`。
|
||||||
|
- `marqdo-web-design`/`marqdo-web-preview` 不在本仓;本证据不替代组件 CI。
|
||||||
|
- 领域激活与根接入(WEB-05)仍未开始。
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
# WEB-04 领域组合案例与生产交付试验证据
|
||||||
|
|
||||||
|
日期:2026-11-27。责任仓:`marqdo-ext-web`;工单:[marqdo-ext-web#2](https://git.cflmy.cn/cflmy/marqdo-ext-web/issues/2)(WEB-04);父工单:根 [marqdo#6](https://git.cflmy.cn/cflmy/marqdo/issues/6)。
|
||||||
|
|
||||||
|
## 输入身份
|
||||||
|
|
||||||
|
| 对象 | 身份 |
|
||||||
|
| --- | --- |
|
||||||
|
| CLI | 由根固定 `cli/deadf6e` 构建的 `marqdo 3.0.0-rc.4`,`sha256:6ede3b9e8bcfad3942573e68b5f54b2c5bc2866b37d102f63acd49a55cb212db` |
|
||||||
|
| Design | `marqdo-web-design@1b6607fd3cc09801b4f6eacd2fba547caa0ec637`(WEB-03 handoff/图/切片) |
|
||||||
|
| Preview / web Tool | `marqdo-web-preview@eff273f7f2f3919bab62eacded781c61d5f03f91`(WEB-02 + WEB-03 消费) |
|
||||||
|
| 平台 | Linux x86_64,Node v24.22.3,Chromium(Playwright headless shell 1255) |
|
||||||
|
|
||||||
|
## 执行与结果(本地真实运行)
|
||||||
|
|
||||||
|
```sh
|
||||||
|
MARQDO_BIN=<verified marqdo> \
|
||||||
|
MARQDO_WEB_TOOL_JSON=<marqdo-web-preview/dist/marqdo-web-preview/tool.json> \
|
||||||
|
scripts/domain-acceptance.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
结果 **PASS**:
|
||||||
|
|
||||||
|
- 同一 `marqdo web` Tool 对三个案例执行 `check/preview/handoff`:
|
||||||
|
- 文档型网站 `examples/doc-site`(单元 `首页`):PASS;
|
||||||
|
- §8 科研任务台原型 `examples/research-workspace`(单元 `工作台`):PASS;
|
||||||
|
- 量子电路编辑器设计 `examples/quantum-editor`(单元 `编辑器`):PASS(含有限场景/交互)。
|
||||||
|
- 每个 preview 均含 CSP、通用组件/场景标记;handoff 均非空并含 Design handoff;无按案例分叉的 renderer 或 CLI 语法。
|
||||||
|
- 生产交付试验 `examples/research-workbench-app`(Express):
|
||||||
|
- API 测试(真实 HTTP、真实临时文件持久化、错误/统计联动):`node --test` PASS;
|
||||||
|
- 真实浏览器 E2E(Playwright/Chromium):统计、搜索、创建、错误提示联动 PASS。
|
||||||
|
- Tool 生命周期:真实 CLI `tool install` → 三案例 + 生产应用 → `tool remove web`;CLI 二进制未改变(脚本断言)。
|
||||||
|
- 设计源→生产映射、有意未实现项与任务拆分记录在 `docs/WEB-04-delivery.md`。
|
||||||
|
|
||||||
|
## 边界与未验证
|
||||||
|
|
||||||
|
- 生产应用不依赖 `web` Tool 运行;原型 PASS 不冒充生产 PASS,二者证据分开。
|
||||||
|
- 认证、真实数据库、网络同步、任务编辑/删除、真实设备接入等有意未实现,已在交付文档标注。
|
||||||
|
- 浏览器 E2E 需要 Chromium;无浏览器环境须标 UNVERIFIED,本证据对应实际 Chromium 运行。
|
||||||
|
- 领域 gitlink 固定 Design/Preview 候选;根 gitlink、领域激活、`web` Tool 冷安装与根组合验收属 WEB-05,不在本证据内完成。
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# 正文组件
|
||||||
|
|
||||||
|
## @knowledge 正文
|
||||||
|
|
||||||
|
### 内容
|
||||||
|
|
||||||
|
文章正文支持标题、段落、列表、代码块与表格。
|
||||||
|
|
||||||
|
### 验收
|
||||||
|
|
||||||
|
- 代码块可横向滚动而不撑破页面。
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# 顶栏组件
|
||||||
|
|
||||||
|
## @knowledge 顶栏
|
||||||
|
|
||||||
|
### 内容
|
||||||
|
|
||||||
|
站点名称、版本选择与搜索入口。
|
||||||
|
|
||||||
|
### 验收
|
||||||
|
|
||||||
|
- 窄屏只保留站点名称与搜索按钮。
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# 目录组件
|
||||||
|
|
||||||
|
## @knowledge 目录
|
||||||
|
|
||||||
|
### 内容
|
||||||
|
|
||||||
|
- 快速开始
|
||||||
|
- 语言指南
|
||||||
|
- 参考手册
|
||||||
|
|
||||||
|
### 验收
|
||||||
|
|
||||||
|
- 当前文章在目录中高亮。
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# 文档型网站
|
||||||
|
|
||||||
|
## @knowledge 首页
|
||||||
|
|
||||||
|
文档站主页面:顶部导航、左侧目录、右侧正文。
|
||||||
|
|
||||||
|
### 组件
|
||||||
|
|
||||||
|
| 行 | 槽 | 组件 | 宽度 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | header | [顶栏](components/header.mq.md#顶栏) | auto |
|
||||||
|
| 2 | sidebar | [目录](components/sidebar.mq.md#目录) | 240px |
|
||||||
|
| 2 | article | [正文](components/article.mq.md#正文) | 1fr |
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# 电路画布组件
|
||||||
|
|
||||||
|
## @knowledge 电路画布
|
||||||
|
|
||||||
|
### 场景
|
||||||
|
|
||||||
|
| 状态 | 内容 | 初始 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| empty | [空电路](../shared/states.mq.md#空电路) | true |
|
||||||
|
| selected | [已选门](../shared/states.mq.md#已选门) | false |
|
||||||
|
|
||||||
|
### 交互
|
||||||
|
|
||||||
|
| 当前 | 事件 | 下一状态 |
|
||||||
|
| --- | --- | --- |
|
||||||
|
| empty | 模拟放置 H 门 | selected |
|
||||||
|
| selected | 模拟清空 | empty |
|
||||||
|
|
||||||
|
### 验收
|
||||||
|
|
||||||
|
- 空电路提示放置第一个门;选择门时右侧检查器同步。
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# 检查器组件
|
||||||
|
|
||||||
|
## @knowledge 检查器
|
||||||
|
|
||||||
|
### 内容
|
||||||
|
|
||||||
|
显示所选门的参数、目标比特与错误提示占位。
|
||||||
|
|
||||||
|
### 验收
|
||||||
|
|
||||||
|
- 无选择时显示空状态,不伪造成已保存。
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
# 门面板组件
|
||||||
|
|
||||||
|
## @knowledge 门面板
|
||||||
|
|
||||||
|
### 内容
|
||||||
|
|
||||||
|
按类别列出单比特门、双比特门与测量操作。
|
||||||
|
|
||||||
|
### 验收
|
||||||
|
|
||||||
|
- 点击门不会立即加入电路,需拖拽或选择目标比特。
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
# 量子电路编辑器设计
|
||||||
|
|
||||||
|
## @knowledge 编辑器
|
||||||
|
|
||||||
|
电路编辑器的三段式布局:门面板、电路画布、属性检查器。
|
||||||
|
|
||||||
|
### 组件
|
||||||
|
|
||||||
|
| 行 | 槽 | 组件 | 宽度 |
|
||||||
|
| --- | --- | --- | --- |
|
||||||
|
| 1 | palette | [门面板](components/palette.mq.md#门面板) | 220px |
|
||||||
|
| 1 | canvas | [电路画布](components/canvas.mq.md#电路画布) | 6fr |
|
||||||
|
| 1 | inspector | [检查器](components/inspector.mq.md#检查器) | 2fr |
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
# 状态
|
||||||
|
|
||||||
|
## @knowledge 空电路
|
||||||
|
|
||||||
|
画布为空,提示放置门。
|
||||||
|
|
||||||
|
## @knowledge 已选门
|
||||||
|
|
||||||
|
已选择一个 H 门,参数等待填写。
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules/
|
||||||
|
workbench-data.json
|
||||||
|
test-results/
|
||||||
|
playwright-report/
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
// Production E2E for the research workbench (run where a browser is available).
|
||||||
|
import { test, expect } from "@playwright/test";
|
||||||
|
|
||||||
|
test("list, search, create and statistics stay linked", async ({ page }) => {
|
||||||
|
await page.route("**/api/**", async (route) => {
|
||||||
|
const url = new URL(route.request().url());
|
||||||
|
if (url.pathname === "/api/tasks" && route.request().method() === "GET") {
|
||||||
|
const query = url.searchParams.get("q") ?? "";
|
||||||
|
const tasks = [
|
||||||
|
{ id: 1, title: "测量超导比特", priority: "high", status: "open" },
|
||||||
|
{ id: 2, title: "整理实验记录", priority: "normal", status: "done" },
|
||||||
|
].filter((task) => task.title.includes(query));
|
||||||
|
return route.fulfill({ json: { tasks } });
|
||||||
|
}
|
||||||
|
if (url.pathname === "/api/stats") {
|
||||||
|
return route.fulfill({ json: { total: 2, byStatus: { open: 1, doing: 0, done: 1 }, byPriority: { low: 0, normal: 1, high: 1 } } });
|
||||||
|
}
|
||||||
|
if (url.pathname === "/api/tasks" && route.request().method() === "POST") {
|
||||||
|
const body = route.request().postDataJSON();
|
||||||
|
if (!String(body.title ?? "").trim()) {
|
||||||
|
return route.fulfill({ status: 400, json: { error: { code: "task.title_required", message: "任务标题不能为空" } } });
|
||||||
|
}
|
||||||
|
return route.fulfill({ status: 201, json: { task: { id: 3, title: body.title, priority: "normal", status: "open" } } });
|
||||||
|
}
|
||||||
|
return route.continue();
|
||||||
|
});
|
||||||
|
|
||||||
|
await page.goto("/");
|
||||||
|
await expect(page.getByTestId("stats")).toContainText("总数 2");
|
||||||
|
await expect(page.getByTestId("tasks")).toContainText("测量超导比特");
|
||||||
|
|
||||||
|
await page.getByLabel("搜索任务").fill("实验");
|
||||||
|
await expect(page.getByTestId("tasks")).toContainText("整理实验记录");
|
||||||
|
await expect(page.getByTestId("tasks")).not.toContainText("测量超导比特");
|
||||||
|
|
||||||
|
await page.getByLabel("搜索任务").fill("");
|
||||||
|
await page.getByLabel("标题").fill("新建任务");
|
||||||
|
await page.getByRole("button", { name: "创建" }).click();
|
||||||
|
await expect(page.getByTestId("error")).toBeHidden();
|
||||||
|
|
||||||
|
await page.getByLabel("标题").fill(" ");
|
||||||
|
await page.getByRole("button", { name: "创建" }).click();
|
||||||
|
await expect(page.getByTestId("error")).toContainText("任务标题不能为空");
|
||||||
|
});
|
||||||
+888
@@ -0,0 +1,888 @@
|
|||||||
|
{
|
||||||
|
"name": "research-workbench-app",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"lockfileVersion": 3,
|
||||||
|
"requires": true,
|
||||||
|
"packages": {
|
||||||
|
"": {
|
||||||
|
"name": "research-workbench-app",
|
||||||
|
"version": "0.1.0",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.21.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@playwright/test": "^1.49.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@playwright/test": {
|
||||||
|
"version": "1.65.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.65.1.tgz",
|
||||||
|
"integrity": "sha512-y+NCIRm2LvY4slUVWvGh1nujJ8RF/hEisIsq2mtUPgdQC4L701bq5hZGMhrpeXjACvwvO9tj5dJqhvM6TP9lbw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"playwright": "1.65.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/accepts": {
|
||||||
|
"version": "1.3.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
|
||||||
|
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-types": "~2.1.34",
|
||||||
|
"negotiator": "0.6.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/array-flatten": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-PCVAQswWemu6UdxsDFFX/+gVeYqKAod3D3UVm91jHwynguOwAvYPhx8nNlM++NqRcK6CxxpUafjmhIdKiHibqg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/body-parser": {
|
||||||
|
"version": "1.20.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.9.tgz",
|
||||||
|
"integrity": "sha512-FISIQxV5u91Y9gvuFq3q/tA/qTqLJn3AhRcEvyozyhJTh5OBFFtv827AdHU7Rbyct4r+Ba1/99oFa1Y3yuFsdw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"bytes": "~3.1.2",
|
||||||
|
"content-type": "~1.0.5",
|
||||||
|
"debug": "2.6.9",
|
||||||
|
"depd": "2.0.0",
|
||||||
|
"destroy": "~1.2.0",
|
||||||
|
"http-errors": "~2.0.1",
|
||||||
|
"iconv-lite": "~0.4.24",
|
||||||
|
"on-finished": "~2.4.1",
|
||||||
|
"qs": "~6.16.0",
|
||||||
|
"raw-body": "~2.5.3",
|
||||||
|
"type-is": "~1.6.18",
|
||||||
|
"unpipe": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8",
|
||||||
|
"npm": "1.2.8000 || >= 1.4.16"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/bytes": {
|
||||||
|
"version": "3.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz",
|
||||||
|
"integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/call-bind-apply-helpers": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"function-bind": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/call-bound": {
|
||||||
|
"version": "1.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz",
|
||||||
|
"integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind-apply-helpers": "^1.0.2",
|
||||||
|
"get-intrinsic": "^1.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/content-disposition": {
|
||||||
|
"version": "0.5.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
|
||||||
|
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safe-buffer": "5.2.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/content-type": {
|
||||||
|
"version": "1.0.5",
|
||||||
|
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz",
|
||||||
|
"integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/cookie": {
|
||||||
|
"version": "0.7.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz",
|
||||||
|
"integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/cookie-signature": {
|
||||||
|
"version": "1.0.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.7.tgz",
|
||||||
|
"integrity": "sha512-NXdYc3dLr47pBkpUCHtKSwIOQXLVn8dZEuywboCOJY/osA0wFSLlSawr3KN8qXJEyX66FcONTH8EIlVuK0yyFA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/debug": {
|
||||||
|
"version": "2.6.9",
|
||||||
|
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
|
||||||
|
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ms": "2.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/depd": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/destroy": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8",
|
||||||
|
"npm": "1.2.8000 || >= 1.4.16"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/dunder-proto": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind-apply-helpers": "^1.0.1",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"gopd": "^1.2.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ee-first": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/encodeurl": {
|
||||||
|
"version": "2.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.3.tgz",
|
||||||
|
"integrity": "sha512-mIteYONiEfc4xWf2F1WXovh1c8npzS00vNeiUPdwFF+QlVJni+gNvpQltLMQhob8rew/bWWc/bGTuUr0EUGt0w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/es-define-property": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/es-errors": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/es-object-atoms": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-HWcBoN6NileqtSydK2FqHbS/LoDd2pqrnQHLyJzBj4kOp/ky2MWMN694xOfkK8/SnUsW2DH7EfyVlydKCsm1Zw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/escape-html": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/etag": {
|
||||||
|
"version": "1.8.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
|
||||||
|
"integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/express": {
|
||||||
|
"version": "4.22.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/express/-/express-4.22.3.tgz",
|
||||||
|
"integrity": "sha512-Bdcs4+3qlpVlx2NRn6fgX2Ue2/gGRaPeawebgclM0ERSCqDpA+owF1fdPwjJUTAJWMTuAaxjDf+hzb0/4eKvvw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"accepts": "~1.3.8",
|
||||||
|
"array-flatten": "1.1.1",
|
||||||
|
"body-parser": "~1.20.5",
|
||||||
|
"content-disposition": "~0.5.4",
|
||||||
|
"content-type": "~1.0.4",
|
||||||
|
"cookie": "~0.7.1",
|
||||||
|
"cookie-signature": "~1.0.6",
|
||||||
|
"debug": "2.6.9",
|
||||||
|
"depd": "2.0.0",
|
||||||
|
"encodeurl": "~2.0.0",
|
||||||
|
"escape-html": "~1.0.3",
|
||||||
|
"etag": "~1.8.1",
|
||||||
|
"finalhandler": "~1.3.1",
|
||||||
|
"fresh": "~0.5.2",
|
||||||
|
"http-errors": "~2.0.0",
|
||||||
|
"merge-descriptors": "1.0.3",
|
||||||
|
"methods": "~1.1.2",
|
||||||
|
"on-finished": "~2.4.1",
|
||||||
|
"parseurl": "~1.3.3",
|
||||||
|
"path-to-regexp": "~0.1.13",
|
||||||
|
"proxy-addr": "~2.0.7",
|
||||||
|
"qs": "~6.16.0",
|
||||||
|
"range-parser": "~1.2.1",
|
||||||
|
"safe-buffer": "5.2.1",
|
||||||
|
"send": "~0.19.0",
|
||||||
|
"serve-static": "~1.16.2",
|
||||||
|
"setprototypeof": "1.2.0",
|
||||||
|
"statuses": "~2.0.1",
|
||||||
|
"type-is": "~1.6.18",
|
||||||
|
"utils-merge": "1.0.1",
|
||||||
|
"vary": "~1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.10.0"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/finalhandler": {
|
||||||
|
"version": "1.3.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.3.2.tgz",
|
||||||
|
"integrity": "sha512-aA4RyPcd3badbdABGDuTXCMTtOneUCAYH/gxoYRTZlIJdF0YPWuGqiAsIrhNnnqdXGswYk6dGujem4w80UJFhg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "2.6.9",
|
||||||
|
"encodeurl": "~2.0.0",
|
||||||
|
"escape-html": "~1.0.3",
|
||||||
|
"on-finished": "~2.4.1",
|
||||||
|
"parseurl": "~1.3.3",
|
||||||
|
"statuses": "~2.0.2",
|
||||||
|
"unpipe": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/forwarded": {
|
||||||
|
"version": "0.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||||
|
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/fresh": {
|
||||||
|
"version": "0.5.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
|
||||||
|
"integrity": "sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/function-bind": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-intrinsic": {
|
||||||
|
"version": "1.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz",
|
||||||
|
"integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bind-apply-helpers": "^1.0.2",
|
||||||
|
"es-define-property": "^1.0.1",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"es-object-atoms": "^1.1.1",
|
||||||
|
"function-bind": "^1.1.2",
|
||||||
|
"get-proto": "^1.0.1",
|
||||||
|
"gopd": "^1.2.0",
|
||||||
|
"has-symbols": "^1.1.0",
|
||||||
|
"hasown": "^2.0.2",
|
||||||
|
"math-intrinsics": "^1.1.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/get-proto": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"dunder-proto": "^1.0.1",
|
||||||
|
"es-object-atoms": "^1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/gopd": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/has-symbols": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/hasown": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"function-bind": "^1.1.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/http-errors": {
|
||||||
|
"version": "2.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz",
|
||||||
|
"integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"depd": "~2.0.0",
|
||||||
|
"inherits": "~2.0.4",
|
||||||
|
"setprototypeof": "~1.2.0",
|
||||||
|
"statuses": "~2.0.2",
|
||||||
|
"toidentifier": "~1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/iconv-lite": {
|
||||||
|
"version": "0.4.24",
|
||||||
|
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
|
||||||
|
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"safer-buffer": ">= 2.1.2 < 3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.10.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/inherits": {
|
||||||
|
"version": "2.0.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
|
||||||
|
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/ipaddr.js": {
|
||||||
|
"version": "1.9.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
|
||||||
|
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.10"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/math-intrinsics": {
|
||||||
|
"version": "1.1.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz",
|
||||||
|
"integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/media-typer": {
|
||||||
|
"version": "0.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
|
||||||
|
"integrity": "sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/merge-descriptors": {
|
||||||
|
"version": "1.0.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.3.tgz",
|
||||||
|
"integrity": "sha512-gaNvAS7TZ897/rVaZ0nMtAyxNyi/pdbjbAwUpFQpN70GqnVfOiXpeUUMKRBmzXaSQ8DdTX4/0ms62r2K+hE6mQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/sindresorhus"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/methods": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-iclAHeNqNm68zFtnZ0e+1L2yUIdvzNoauKU4WBA3VvH/vPFieF7qfRlwUZU+DA9P9bPXIS90ulxoUoCH23sV2w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime": {
|
||||||
|
"version": "1.6.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
|
||||||
|
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"bin": {
|
||||||
|
"mime": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=4"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-db": {
|
||||||
|
"version": "1.52.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz",
|
||||||
|
"integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/mime-types": {
|
||||||
|
"version": "2.1.35",
|
||||||
|
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz",
|
||||||
|
"integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"mime-db": "1.52.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/ms": {
|
||||||
|
"version": "2.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
|
||||||
|
"integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/negotiator": {
|
||||||
|
"version": "0.6.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
|
||||||
|
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/object-inspect": {
|
||||||
|
"version": "1.14.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.14.0.tgz",
|
||||||
|
"integrity": "sha512-IVgHNlp/jwQX271+Xzoq9LZNTWXxZK+cEOrGBOBxXNbn7fapnZ+Ts6TVMgNOuAezwG2wdtnMX97tTPK6VEnuOQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/on-finished": {
|
||||||
|
"version": "2.4.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.2.tgz",
|
||||||
|
"integrity": "sha512-ATWUv387i+nLD49EiDoOft5scf32Vsdz3ktrQJG9bi7jRFmaXTssvyvj1EmeKVVgvesbqUtvQQvaS2TpTukAZQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"ee-first": "1.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/parseurl": {
|
||||||
|
"version": "1.3.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
|
||||||
|
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/path-to-regexp": {
|
||||||
|
"version": "0.1.13",
|
||||||
|
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.13.tgz",
|
||||||
|
"integrity": "sha512-A/AGNMFN3c8bOlvV9RreMdrv7jsmF9XIfDeCd87+I8RNg6s78BhJxMu69NEMHBSJFxKidViTEdruRwEk/WIKqA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/playwright": {
|
||||||
|
"version": "1.65.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright/-/playwright-1.65.1.tgz",
|
||||||
|
"integrity": "sha512-vJ1FuoOrNwOKHUIVEvSt3jT1L+wjjDpwhwIstKtfvTh8XIG4FG4bIFuvNdMxi81LGfAhUgUZleVFaOLY4RIUUw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"dependencies": {
|
||||||
|
"playwright-core": "1.65.1"
|
||||||
|
},
|
||||||
|
"bin": {
|
||||||
|
"playwright": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/playwright-core": {
|
||||||
|
"version": "1.65.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.65.1.tgz",
|
||||||
|
"integrity": "sha512-hqPpz7blSMPxWVdoeE1yiBSzXsKiVOd2k+kjCvmUywD2GPO2Dd9HfcWnq9NN0GHbNZDFgZ9JfBFr+X5/BLo0qw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"playwright-core": "cli.js"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/proxy-addr": {
|
||||||
|
"version": "2.0.8",
|
||||||
|
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.8.tgz",
|
||||||
|
"integrity": "sha512-5nnx0yGyVUcY6t9RnWcARWtwT9F1D8O9rt08htPvnd49W1IgZtmLkhu9WfMzQj1cFxjHIO6connUNVW5k7AVyQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"forwarded": "0.2.0",
|
||||||
|
"ipaddr.js": "1.9.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.10"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"type": "opencollective",
|
||||||
|
"url": "https://opencollective.com/express"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/qs": {
|
||||||
|
"version": "6.16.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/qs/-/qs-6.16.2.tgz",
|
||||||
|
"integrity": "sha512-VYdnB5S7/0IeXzBacUtwNAaM6d7Y/PgYnNC7bJCI6meqA/OgnsQbZMtVW8Dt2D1PHgbHGtYmhSoEIgvt7xZ2ZA==",
|
||||||
|
"license": "BSD-3-Clause",
|
||||||
|
"dependencies": {
|
||||||
|
"es-define-property": "^1.0.1",
|
||||||
|
"side-channel": "^1.1.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/range-parser": {
|
||||||
|
"version": "1.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
|
||||||
|
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/raw-body": {
|
||||||
|
"version": "2.5.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.5.3.tgz",
|
||||||
|
"integrity": "sha512-s4VSOf6yN0rvbRZGxs8Om5CWj6seneMwK3oDb4lWDH0UPhWcxwOWw5+qk24bxq87szX1ydrwylIOp2uG1ojUpA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"bytes": "~3.1.2",
|
||||||
|
"http-errors": "~2.0.1",
|
||||||
|
"iconv-lite": "~0.4.24",
|
||||||
|
"unpipe": "~1.0.0"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/safe-buffer": {
|
||||||
|
"version": "5.2.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
|
||||||
|
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
|
||||||
|
"funding": [
|
||||||
|
{
|
||||||
|
"type": "github",
|
||||||
|
"url": "https://github.com/sponsors/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "patreon",
|
||||||
|
"url": "https://www.patreon.com/feross"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "consulting",
|
||||||
|
"url": "https://feross.org/support"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/safer-buffer": {
|
||||||
|
"version": "2.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
|
||||||
|
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/send": {
|
||||||
|
"version": "0.19.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/send/-/send-0.19.2.tgz",
|
||||||
|
"integrity": "sha512-VMbMxbDeehAxpOtWJXlcUS5E8iXh6QmN+BkRX1GARS3wRaXEEgzCcB10gTQazO42tpNIya8xIyNx8fll1OFPrg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"debug": "2.6.9",
|
||||||
|
"depd": "2.0.0",
|
||||||
|
"destroy": "1.2.0",
|
||||||
|
"encodeurl": "~2.0.0",
|
||||||
|
"escape-html": "~1.0.3",
|
||||||
|
"etag": "~1.8.1",
|
||||||
|
"fresh": "~0.5.2",
|
||||||
|
"http-errors": "~2.0.1",
|
||||||
|
"mime": "1.6.0",
|
||||||
|
"ms": "2.1.3",
|
||||||
|
"on-finished": "~2.4.1",
|
||||||
|
"range-parser": "~1.2.1",
|
||||||
|
"statuses": "~2.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/send/node_modules/ms": {
|
||||||
|
"version": "2.1.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
|
||||||
|
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/serve-static": {
|
||||||
|
"version": "1.16.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.3.tgz",
|
||||||
|
"integrity": "sha512-x0RTqQel6g5SY7Lg6ZreMmsOzncHFU7nhnRWkKgWuMTu5NN0DR5oruckMqRvacAN9d5w6ARnRBXl9xhDCgfMeA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"encodeurl": "~2.0.0",
|
||||||
|
"escape-html": "~1.0.3",
|
||||||
|
"parseurl": "~1.3.3",
|
||||||
|
"send": "~0.19.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/setprototypeof": {
|
||||||
|
"version": "1.2.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||||
|
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==",
|
||||||
|
"license": "ISC"
|
||||||
|
},
|
||||||
|
"node_modules/side-channel": {
|
||||||
|
"version": "1.1.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.1.tgz",
|
||||||
|
"integrity": "sha512-6x6dK6zJdpTzF4sQeNYxwtvBzf6Eg4GtlesS94HOvTudUeyK2WXAaIfmDgsyslYrRBeFIlsi54AYsFGUuhmvrQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"object-inspect": "^1.13.4",
|
||||||
|
"side-channel-list": "^1.0.1",
|
||||||
|
"side-channel-map": "^1.0.1",
|
||||||
|
"side-channel-weakmap": "^1.0.2"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/side-channel-list": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-mjn/0bi/oUURjc5Xl7IaWi/OJJJumuoJFQJfDDyO46+hBWsfaVM65TBHq2eoZBhzl9EchxOijpkbRC8SVBQU0w==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"object-inspect": "^1.13.4"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/side-channel-map": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bound": "^1.0.2",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"get-intrinsic": "^1.2.5",
|
||||||
|
"object-inspect": "^1.13.3"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/side-channel-weakmap": {
|
||||||
|
"version": "1.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz",
|
||||||
|
"integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"call-bound": "^1.0.2",
|
||||||
|
"es-errors": "^1.3.0",
|
||||||
|
"get-intrinsic": "^1.2.5",
|
||||||
|
"object-inspect": "^1.13.3",
|
||||||
|
"side-channel-map": "^1.0.1"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4"
|
||||||
|
},
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ljharb"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/statuses": {
|
||||||
|
"version": "2.0.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz",
|
||||||
|
"integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/toidentifier": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">=0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/type-is": {
|
||||||
|
"version": "1.6.18",
|
||||||
|
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
|
||||||
|
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"media-typer": "0.3.0",
|
||||||
|
"mime-types": "~2.1.24"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.6"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/unpipe": {
|
||||||
|
"version": "1.0.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||||
|
"integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/utils-merge": {
|
||||||
|
"version": "1.0.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
|
||||||
|
"integrity": "sha512-pMZTvIkT1d+TFGvDOqodOclx0QWkkgi6Tdoa8gC8ffGAAqz9pzPTZWAybbsHHoED/ztMtkv/VoYTYyShUn81hA==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.4.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/vary": {
|
||||||
|
"version": "1.1.2",
|
||||||
|
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
|
||||||
|
"integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==",
|
||||||
|
"license": "MIT",
|
||||||
|
"engines": {
|
||||||
|
"node": ">= 0.8"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "research-workbench-app",
|
||||||
|
"private": true,
|
||||||
|
"version": "0.1.0",
|
||||||
|
"type": "module",
|
||||||
|
"description": "Production delivery trial of the Marqdo research workbench design (WEB-04)",
|
||||||
|
"scripts": {
|
||||||
|
"start": "node server.js",
|
||||||
|
"test": "node --test test/api.test.js",
|
||||||
|
"e2e": "playwright test"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.21.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@playwright/test": "^1.49.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { defineConfig } from "@playwright/test";
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
testDir: "./e2e",
|
||||||
|
timeout: 30_000,
|
||||||
|
use: { baseURL: "http://127.0.0.1:4173" },
|
||||||
|
webServer: {
|
||||||
|
command: "node server.js",
|
||||||
|
url: "http://127.0.0.1:4173",
|
||||||
|
reuseExistingServer: false,
|
||||||
|
env: {
|
||||||
|
PORT: "4173",
|
||||||
|
WORKBENCH_DATA: process.env.WORKBENCH_DATA ?? "workbench-e2e-data.json",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
const statsNode = document.querySelector("#stats");
|
||||||
|
const tasksNode = document.querySelector("#tasks");
|
||||||
|
const errorNode = document.querySelector("#error");
|
||||||
|
const searchNode = document.querySelector("#search");
|
||||||
|
const form = document.querySelector("#create-form");
|
||||||
|
const titleNode = document.querySelector("#title");
|
||||||
|
const priorityNode = document.querySelector("#priority");
|
||||||
|
|
||||||
|
const showError = (message) => {
|
||||||
|
errorNode.textContent = message;
|
||||||
|
errorNode.classList.toggle("hidden", !message);
|
||||||
|
};
|
||||||
|
|
||||||
|
async function request(path, options) {
|
||||||
|
const response = await fetch(path, options);
|
||||||
|
const body = await response.json().catch(() => ({}));
|
||||||
|
if (!response.ok) throw new Error(body?.error?.message ?? `HTTP ${response.status}`);
|
||||||
|
return body;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function refresh() {
|
||||||
|
try {
|
||||||
|
const query = encodeURIComponent(searchNode.value.trim());
|
||||||
|
const [tasks, stats] = await Promise.all([
|
||||||
|
request(`/api/tasks?q=${query}`),
|
||||||
|
request("/api/stats"),
|
||||||
|
]);
|
||||||
|
statsNode.textContent = `总数 ${stats.total} · 待办 ${stats.byStatus.open} · 进行中 ${stats.byStatus.doing} · 完成 ${stats.byStatus.done}`;
|
||||||
|
tasksNode.replaceChildren(
|
||||||
|
...tasks.tasks.map((task) => {
|
||||||
|
const item = document.createElement("li");
|
||||||
|
const label = document.createElement("span");
|
||||||
|
label.textContent = `${task.title} · ${task.priority} · ${task.status}`;
|
||||||
|
item.append(label);
|
||||||
|
if (task.status !== "done") {
|
||||||
|
const button = document.createElement("button");
|
||||||
|
button.type = "button";
|
||||||
|
button.textContent = task.status === "open" ? "开始" : "完成";
|
||||||
|
button.addEventListener("click", async () => {
|
||||||
|
try {
|
||||||
|
await request(`/api/tasks/${task.id}/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ status: task.status === "open" ? "doing" : "done" }),
|
||||||
|
});
|
||||||
|
showError("");
|
||||||
|
await refresh();
|
||||||
|
} catch (error) {
|
||||||
|
showError(error.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
item.append(button);
|
||||||
|
}
|
||||||
|
return item;
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
showError(error.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
form.addEventListener("submit", async (event) => {
|
||||||
|
event.preventDefault();
|
||||||
|
try {
|
||||||
|
await request("/api/tasks", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ title: titleNode.value, priority: priorityNode.value }),
|
||||||
|
});
|
||||||
|
titleNode.value = "";
|
||||||
|
showError("");
|
||||||
|
await refresh();
|
||||||
|
} catch (error) {
|
||||||
|
showError(error.message);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
searchNode.addEventListener("input", refresh);
|
||||||
|
refresh();
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="zh-CN">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<title>科研工作台(生产实现试验)</title>
|
||||||
|
<link rel="stylesheet" href="/styles.css">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<header>
|
||||||
|
<strong>科研工作台</strong>
|
||||||
|
<span class="badge">生产实现试验:真实持久化与错误处理</span>
|
||||||
|
</header>
|
||||||
|
<main>
|
||||||
|
<section class="panel" aria-label="统计">
|
||||||
|
<h2>统计</h2>
|
||||||
|
<p id="stats" data-testid="stats">加载中…</p>
|
||||||
|
</section>
|
||||||
|
<section class="panel" aria-label="创建任务">
|
||||||
|
<h2>创建任务</h2>
|
||||||
|
<form id="create-form">
|
||||||
|
<label>标题 <input name="title" id="title" required maxlength="120"></label>
|
||||||
|
<label>优先级
|
||||||
|
<select name="priority" id="priority">
|
||||||
|
<option value="normal">normal</option>
|
||||||
|
<option value="high">high</option>
|
||||||
|
<option value="low">low</option>
|
||||||
|
</select>
|
||||||
|
</label>
|
||||||
|
<button type="submit">创建</button>
|
||||||
|
</form>
|
||||||
|
<p class="error hidden" id="error" role="alert" data-testid="error"></p>
|
||||||
|
</section>
|
||||||
|
<section class="panel" aria-label="任务列表">
|
||||||
|
<h2>任务列表</h2>
|
||||||
|
<input id="search" placeholder="搜索任务标题" aria-label="搜索任务">
|
||||||
|
<ul id="tasks" data-testid="tasks"></ul>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
<script type="module" src="/app.js"></script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
:root { color-scheme: light; }
|
||||||
|
* { box-sizing: border-box; }
|
||||||
|
body { margin: 0; font-family: system-ui, "Noto Sans CJK SC", sans-serif; background: #f5f6f8; color: #1d1d1f; }
|
||||||
|
header { display: flex; gap: .75rem; align-items: center; padding: .8rem 1.2rem; background: #1f2937; color: #fff; }
|
||||||
|
.badge { font-size: .75rem; background: #f59e0b; color: #1f2937; padding: .1rem .45rem; border-radius: 999px; }
|
||||||
|
main { max-width: 900px; margin: 0 auto; padding: 1rem; display: grid; gap: 1rem; }
|
||||||
|
.panel { background: #fff; border: 1px solid #d7d9de; border-radius: 8px; padding: .9rem; }
|
||||||
|
h2 { margin: .1rem 0 .6rem; font-size: 1rem; }
|
||||||
|
input, select, button { font: inherit; }
|
||||||
|
input, select { padding: .35rem .45rem; border: 1px solid #b9bdc5; border-radius: 6px; margin-right: .4rem; }
|
||||||
|
button { padding: .35rem .7rem; border: 1px solid #374151; background: #374151; color: #fff; border-radius: 6px; cursor: pointer; }
|
||||||
|
ul { list-style: none; padding: 0; margin: .6rem 0 0; display: grid; gap: .4rem; }
|
||||||
|
li { display: flex; gap: .6rem; align-items: center; justify-content: space-between; border: 1px solid #e4e6ea; border-radius: 6px; padding: .45rem .6rem; }
|
||||||
|
.hidden { display: none; }
|
||||||
|
.error { color: #b91c1c; font-weight: 600; }
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
// Production delivery trial for the Marqdo research workbench design.
|
||||||
|
// This is a real application (Express + JSON persistence), NOT the web Tool:
|
||||||
|
// the design/Preview prototype never runs as a dependency of this server.
|
||||||
|
import express from "express";
|
||||||
|
import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
||||||
|
import { dirname, join } from "node:path";
|
||||||
|
import { fileURLToPath } from "node:url";
|
||||||
|
|
||||||
|
const here = dirname(fileURLToPath(import.meta.url));
|
||||||
|
|
||||||
|
export function createApp({ dataFile }) {
|
||||||
|
const app = express();
|
||||||
|
app.use(express.json({ limit: "64kb" }));
|
||||||
|
app.use(express.static(join(here, "public")));
|
||||||
|
|
||||||
|
const load = () => {
|
||||||
|
if (!existsSync(dataFile)) return { nextId: 1, tasks: [] };
|
||||||
|
return JSON.parse(readFileSync(dataFile, "utf8"));
|
||||||
|
};
|
||||||
|
const save = (state) => writeFileSync(dataFile, JSON.stringify(state, null, 2));
|
||||||
|
|
||||||
|
const fail = (response, status, code, message) =>
|
||||||
|
response.status(status).json({ error: { code, message } });
|
||||||
|
|
||||||
|
app.get("/api/tasks", (request, response) => {
|
||||||
|
const state = load();
|
||||||
|
const query = String(request.query.q ?? "").trim().toLowerCase();
|
||||||
|
const status = String(request.query.status ?? "").trim();
|
||||||
|
const tasks = state.tasks.filter((task) => {
|
||||||
|
const matchesQuery = !query || task.title.toLowerCase().includes(query);
|
||||||
|
const matchesStatus = !status || task.status === status;
|
||||||
|
return matchesQuery && matchesStatus;
|
||||||
|
});
|
||||||
|
response.json({ tasks });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.post("/api/tasks", (request, response) => {
|
||||||
|
const title = typeof request.body?.title === "string" ? request.body.title.trim() : "";
|
||||||
|
const priority = request.body?.priority ?? "normal";
|
||||||
|
if (!title) return fail(response, 400, "task.title_required", "任务标题不能为空");
|
||||||
|
if (title.length > 120) return fail(response, 400, "task.title_too_long", "任务标题不能超过 120 字符");
|
||||||
|
if (!["low", "normal", "high"].includes(priority)) {
|
||||||
|
return fail(response, 400, "task.priority_invalid", "优先级必须是 low/normal/high");
|
||||||
|
}
|
||||||
|
const state = load();
|
||||||
|
const task = {
|
||||||
|
id: state.nextId++,
|
||||||
|
title,
|
||||||
|
priority,
|
||||||
|
status: "open",
|
||||||
|
createdAt: new Date().toISOString(),
|
||||||
|
};
|
||||||
|
state.tasks.push(task);
|
||||||
|
save(state);
|
||||||
|
response.status(201).json({ task });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.patch("/api/tasks/:id/status", (request, response) => {
|
||||||
|
const id = Number(request.params.id);
|
||||||
|
const status = request.body?.status;
|
||||||
|
if (!Number.isInteger(id) || id < 1) return fail(response, 400, "task.id_invalid", "任务 id 非法");
|
||||||
|
if (!["open", "doing", "done"].includes(status)) {
|
||||||
|
return fail(response, 400, "task.status_invalid", "状态必须是 open/doing/done");
|
||||||
|
}
|
||||||
|
const state = load();
|
||||||
|
const task = state.tasks.find((item) => item.id === id);
|
||||||
|
if (!task) return fail(response, 404, "task.not_found", "任务不存在");
|
||||||
|
task.status = status;
|
||||||
|
save(state);
|
||||||
|
response.json({ task });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.get("/api/stats", (request, response) => {
|
||||||
|
const state = load();
|
||||||
|
const total = state.tasks.length;
|
||||||
|
const byStatus = { open: 0, doing: 0, done: 0 };
|
||||||
|
const byPriority = { low: 0, normal: 0, high: 0 };
|
||||||
|
for (const task of state.tasks) {
|
||||||
|
byStatus[task.status] += 1;
|
||||||
|
byPriority[task.priority] += 1;
|
||||||
|
}
|
||||||
|
response.json({ total, byStatus, byPriority });
|
||||||
|
});
|
||||||
|
|
||||||
|
app.use((request, response) =>
|
||||||
|
fail(response, 404, "app.not_found", `unknown route ${request.method} ${request.path}`),
|
||||||
|
);
|
||||||
|
|
||||||
|
return app;
|
||||||
|
}
|
||||||
|
|
||||||
|
const isMain = process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1];
|
||||||
|
if (isMain) {
|
||||||
|
const port = Number(process.env.PORT ?? 4173);
|
||||||
|
const dataFile = process.env.WORKBENCH_DATA ?? join(here, "workbench-data.json");
|
||||||
|
createApp({ dataFile }).listen(port, "127.0.0.1", () => {
|
||||||
|
console.log(`research-workbench listening on http://127.0.0.1:${port} (data: ${dataFile})`);
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
// Production API acceptance: real server, real file persistence, real HTTP.
|
||||||
|
import test from "node:test";
|
||||||
|
import assert from "node:assert/strict";
|
||||||
|
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
||||||
|
import { tmpdir } from "node:os";
|
||||||
|
import { join } from "node:path";
|
||||||
|
import { createApp } from "../server.js";
|
||||||
|
|
||||||
|
async function withServer(run) {
|
||||||
|
const dir = mkdtempSync(join(tmpdir(), "workbench-"));
|
||||||
|
const dataFile = join(dir, "data.json");
|
||||||
|
const app = createApp({ dataFile });
|
||||||
|
const server = app.listen(0, "127.0.0.1");
|
||||||
|
await new Promise((resolve) => server.once("listening", resolve));
|
||||||
|
const base = `http://127.0.0.1:${server.address().port}`;
|
||||||
|
try {
|
||||||
|
await run({ base, dataFile });
|
||||||
|
} finally {
|
||||||
|
await new Promise((resolve) => server.close(resolve));
|
||||||
|
rmSync(dir, { recursive: true, force: true });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("creates, searches, updates and reports linked statistics with persistence", async () => {
|
||||||
|
await withServer(async ({ base, dataFile }) => {
|
||||||
|
const created = await fetch(`${base}/api/tasks`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ title: "测量超导比特", priority: "high" }),
|
||||||
|
});
|
||||||
|
assert.equal(created.status, 201);
|
||||||
|
const { task } = await created.json();
|
||||||
|
assert.equal(task.title, "测量超导比特");
|
||||||
|
assert.equal(task.status, "open");
|
||||||
|
|
||||||
|
const second = await fetch(`${base}/api/tasks`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ title: "整理实验记录" }),
|
||||||
|
});
|
||||||
|
assert.equal(second.status, 201);
|
||||||
|
|
||||||
|
const list = await (await fetch(`${base}/api/tasks?q=超导`)).json();
|
||||||
|
assert.equal(list.tasks.length, 1);
|
||||||
|
assert.equal(list.tasks[0].id, task.id);
|
||||||
|
|
||||||
|
const invalid = await fetch(`${base}/api/tasks`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ title: " " }),
|
||||||
|
});
|
||||||
|
assert.equal(invalid.status, 400);
|
||||||
|
assert.equal((await invalid.json()).error.code, "task.title_required");
|
||||||
|
|
||||||
|
const badPriority = await fetch(`${base}/api/tasks`, {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ title: "x", priority: "urgent" }),
|
||||||
|
});
|
||||||
|
assert.equal(badPriority.status, 400);
|
||||||
|
|
||||||
|
const update = await fetch(`${base}/api/tasks/${task.id}/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ status: "done" }),
|
||||||
|
});
|
||||||
|
assert.equal(update.status, 200);
|
||||||
|
|
||||||
|
const missing = await fetch(`${base}/api/tasks/999/status`, {
|
||||||
|
method: "PATCH",
|
||||||
|
headers: { "content-type": "application/json" },
|
||||||
|
body: JSON.stringify({ status: "done" }),
|
||||||
|
});
|
||||||
|
assert.equal(missing.status, 404);
|
||||||
|
assert.equal((await missing.json()).error.code, "task.not_found");
|
||||||
|
|
||||||
|
const stats = await (await fetch(`${base}/api/stats`)).json();
|
||||||
|
assert.equal(stats.total, 2);
|
||||||
|
assert.equal(stats.byStatus.done, 1);
|
||||||
|
assert.equal(stats.byStatus.open, 1);
|
||||||
|
assert.equal(stats.byPriority.high, 1);
|
||||||
|
|
||||||
|
// Persistence is a real file: a new app instance reads the same state.
|
||||||
|
const reloaded = JSON.parse(readFileSync(dataFile, "utf8"));
|
||||||
|
assert.equal(reloaded.tasks.length, 2);
|
||||||
|
assert.equal(reloaded.nextId, 3);
|
||||||
|
});
|
||||||
|
});
|
||||||
+1
-1
Submodule preview updated: 8b3281bac0...eff273f7f2.
Executable
+12
@@ -0,0 +1,12 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# WEB-00 independent component entry: explicit verified CLI in, evidence out.
|
||||||
|
set -eu
|
||||||
|
: "${MARQDO_BIN:?set MARQDO_BIN to the verified marqdo executable}"
|
||||||
|
out_dir="${MARQDO_WEB_EVIDENCE_DIR:-$PWD/out}"
|
||||||
|
mkdir -p "$out_dir"
|
||||||
|
args=(--cli "$MARQDO_BIN" --out "$out_dir/web00-analysis-probe.json")
|
||||||
|
if [[ -n "${MARQDO_CLI_SHA256:-}" ]]; then
|
||||||
|
args+=(--expected-cli-sha256 "$MARQDO_CLI_SHA256")
|
||||||
|
fi
|
||||||
|
python3 scripts/risk-probe.py "${args[@]}"
|
||||||
|
git rev-parse HEAD > "$out_dir/component-sha.txt" 2>/dev/null || true
|
||||||
Executable
+43
@@ -0,0 +1,43 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
# WEB-04 domain acceptance: three composition cases through the unique web Tool
|
||||||
|
# plus the real production delivery trial (Express app with API and E2E).
|
||||||
|
set -eu
|
||||||
|
: "${MARQDO_BIN:?set MARQDO_BIN to the verified marqdo executable}"
|
||||||
|
: "${MARQDO_WEB_TOOL_JSON:?set MARQDO_WEB_TOOL_JSON to the built preview tool.json}"
|
||||||
|
cd "$(dirname "$0")/.."
|
||||||
|
work="$(mktemp -d)"
|
||||||
|
trap 'rm -rf "$work"' EXIT
|
||||||
|
export MARQDO_TOOL_HOME="$work/tool-home"
|
||||||
|
"$MARQDO_BIN" tool install "$MARQDO_WEB_TOOL_JSON"
|
||||||
|
|
||||||
|
run_case() {
|
||||||
|
case_name="$1"
|
||||||
|
unit="$2"
|
||||||
|
root="examples/$case_name"
|
||||||
|
entry="$root/index.mq.md"
|
||||||
|
"$MARQDO_BIN" web check "$entry" --unit "$unit" --root "$root"
|
||||||
|
preview="$work/$case_name-preview"
|
||||||
|
"$MARQDO_BIN" web preview "$entry" --unit "$unit" --root "$root" --out "$preview"
|
||||||
|
test -f "$preview/index.html"
|
||||||
|
grep -q "Content-Security-Policy" "$preview/index.html"
|
||||||
|
grep -q "data-scenario\|data-instance" "$preview/index.html"
|
||||||
|
handoff="$work/$case_name-handoff.md"
|
||||||
|
"$MARQDO_BIN" web handoff "$entry" --unit "$unit" --root "$root" --out "$handoff"
|
||||||
|
test -s "$handoff"
|
||||||
|
grep -q "Design handoff" "$handoff"
|
||||||
|
echo "case $case_name: PASS"
|
||||||
|
}
|
||||||
|
|
||||||
|
run_case research-workspace 工作台
|
||||||
|
run_case doc-site 首页
|
||||||
|
run_case quantum-editor 编辑器
|
||||||
|
|
||||||
|
# Production delivery trial: a real framework application, not the prototype.
|
||||||
|
(
|
||||||
|
cd examples/research-workbench-app
|
||||||
|
npm install --no-audit --no-fund ${MARQDO_NPM_CACHE:+--cache "$MARQDO_NPM_CACHE"}
|
||||||
|
npm test
|
||||||
|
WORKBENCH_DATA="$work/e2e-data.json" npx playwright test
|
||||||
|
)
|
||||||
|
"$MARQDO_BIN" tool remove web
|
||||||
|
echo "PASS: WEB-04 domain composition + production delivery trial"
|
||||||
Executable
+388
@@ -0,0 +1,388 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""WEB-00 W-M0: prove the public Analysis contract can bind the Web design model.
|
||||||
|
|
||||||
|
This probe consumes only the real CLI's public Analysis 3 (`check --emit`) and
|
||||||
|
never parses Markdown itself. It checks the facts `docs/WEB-DESIGN.md` depends
|
||||||
|
on:
|
||||||
|
|
||||||
|
* a design component is an exact Knowledge H2 with an anchor and spans;
|
||||||
|
* the `组件` retention table is a real GFM table in the AST, with the exact
|
||||||
|
header and one link per component cell;
|
||||||
|
* design links appear as Analysis references with `candidate_path` and
|
||||||
|
`fragment`, so Design never has to guess by label or filename;
|
||||||
|
* each candidate target resolves to a Knowledge H2 anchor in its own module
|
||||||
|
Analysis, with a source digest for identity;
|
||||||
|
* ordinary paragraph links and missing anchors stay distinguishable facts
|
||||||
|
(negative fixtures), so the contract's rejections are implementable.
|
||||||
|
|
||||||
|
Inputs are explicit: `--cli` names the verified CLI binary. The CLI digest and
|
||||||
|
platform are recorded in the evidence. The probe fails when a required fact is
|
||||||
|
missing; it does not claim a PASS from a substring or a mock.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import argparse
|
||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
import os
|
||||||
|
import platform
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
import tempfile
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
REPO = Path(__file__).resolve().parents[1]
|
||||||
|
DEFAULT_ROOT = REPO / "examples" / "research-workspace"
|
||||||
|
ENTRY = "index.mq.md"
|
||||||
|
DESIGN_H2_ANCHOR = "工作台"
|
||||||
|
COMPONENTS_SECTION = "组件"
|
||||||
|
COMPONENTS_HEADER = ["行", "槽", "组件", "宽度"]
|
||||||
|
|
||||||
|
|
||||||
|
class ProbeError(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Probe:
|
||||||
|
def __init__(self, cli: Path, root: Path, work: Path):
|
||||||
|
self.cli = cli
|
||||||
|
self.root = root
|
||||||
|
self.work = work
|
||||||
|
self.checks: list[dict] = []
|
||||||
|
self.facts: dict = {}
|
||||||
|
self.inputs: dict[str, dict] = {}
|
||||||
|
|
||||||
|
# -- helpers -----------------------------------------------------------
|
||||||
|
def record(self, check_id: str, ok: bool, detail: str) -> bool:
|
||||||
|
self.checks.append({"id": check_id, "status": "PASS" if ok else "FAIL", "detail": detail})
|
||||||
|
return ok
|
||||||
|
|
||||||
|
def require(self, check_id: str, ok: bool, detail: str) -> None:
|
||||||
|
if not self.record(check_id, ok, detail):
|
||||||
|
raise ProbeError(f"{check_id}: {detail}")
|
||||||
|
|
||||||
|
def analyze(self, document: Path) -> dict:
|
||||||
|
out = self.work / (hashlib.sha256(str(document).encode()).hexdigest()[:16] + ".analysis.json")
|
||||||
|
result = subprocess.run(
|
||||||
|
[str(self.cli), "check", str(document), "--emit", str(out)],
|
||||||
|
cwd=str(REPO),
|
||||||
|
capture_output=True,
|
||||||
|
)
|
||||||
|
if result.returncode != 0:
|
||||||
|
raise ProbeError(
|
||||||
|
f"CLI check failed for {document} ({result.returncode}): "
|
||||||
|
f"{result.stderr.decode(errors='replace')}"
|
||||||
|
)
|
||||||
|
analysis = json.loads(out.read_text())
|
||||||
|
if analysis.get("schema") != "marqdo.analysis" or analysis.get("schema_version") != 3:
|
||||||
|
raise ProbeError(f"{document}: not public Analysis 3")
|
||||||
|
if len(analysis.get("modules", [])) != 1:
|
||||||
|
raise ProbeError(f"{document}: expected one analyzed module")
|
||||||
|
module = analysis["modules"][0]
|
||||||
|
try:
|
||||||
|
label = document.relative_to(self.root).as_posix()
|
||||||
|
except ValueError:
|
||||||
|
label = "fixture/" + document.name
|
||||||
|
self.inputs[label] = {
|
||||||
|
"source_digest": module["source_digest"],
|
||||||
|
"module_id": module["id"],
|
||||||
|
}
|
||||||
|
return module
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def text(module: dict, span: dict) -> str:
|
||||||
|
raw = module["source"].encode()
|
||||||
|
return raw[span["start"] : span["end"]].decode(errors="replace")
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def children(node: dict, kind: str):
|
||||||
|
for child in node.get("children") or []:
|
||||||
|
if child.get("kind") == kind:
|
||||||
|
yield child
|
||||||
|
yield from Probe.children(child, kind)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def unit_by_anchor(module: dict, anchor: str) -> dict | None:
|
||||||
|
for entry in module.get("anchors", []):
|
||||||
|
if entry.get("anchor") == anchor:
|
||||||
|
return next(
|
||||||
|
(unit for unit in module["units"] if unit["id"] == entry["unit_id"]),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
return None
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def reference_for(module: dict, url: str, span: dict) -> dict | None:
|
||||||
|
for reference in module.get("references", []):
|
||||||
|
if reference.get("url") == url and reference.get("span") == span:
|
||||||
|
return reference
|
||||||
|
return None
|
||||||
|
|
||||||
|
# -- checks ------------------------------------------------------------
|
||||||
|
def check_cli_identity(self, expected_sha256: str | None) -> None:
|
||||||
|
version = subprocess.run([str(self.cli), "--version"], capture_output=True, text=True)
|
||||||
|
self.require("cli-version", version.returncode == 0 and bool(version.stdout.strip()), version.stdout.strip())
|
||||||
|
digest = "sha256:" + hashlib.sha256(self.cli.read_bytes()).hexdigest()
|
||||||
|
self.facts["cli"] = {
|
||||||
|
"path": str(self.cli),
|
||||||
|
"version": version.stdout.strip(),
|
||||||
|
"sha256": digest,
|
||||||
|
"platform": {"system": platform.system(), "machine": platform.machine()},
|
||||||
|
}
|
||||||
|
if expected_sha256:
|
||||||
|
self.require(
|
||||||
|
"cli-pinned-digest",
|
||||||
|
digest == expected_sha256,
|
||||||
|
f"CLI digest {digest} vs expected {expected_sha256}",
|
||||||
|
)
|
||||||
|
|
||||||
|
def check_entry(self) -> dict:
|
||||||
|
module = self.analyze(self.root / ENTRY)
|
||||||
|
self.require(
|
||||||
|
"entry-source-identity",
|
||||||
|
len(module.get("source_digest", "")) == 64,
|
||||||
|
f"source_digest={module.get('source_digest')}",
|
||||||
|
)
|
||||||
|
unit = self.unit_by_anchor(module, DESIGN_H2_ANCHOR)
|
||||||
|
self.require("design-unit-anchor", unit is not None, f"anchor {DESIGN_H2_ANCHOR!r}")
|
||||||
|
assert unit is not None
|
||||||
|
self.require(
|
||||||
|
"design-unit-shape",
|
||||||
|
unit.get("kind") == "knowledge"
|
||||||
|
and unit.get("level") == 2
|
||||||
|
and unit.get("heading_span")
|
||||||
|
and unit.get("span"),
|
||||||
|
f"unit kind/level/spans: {unit.get('kind')}/{unit.get('level')}/{bool(unit.get('heading_span'))}",
|
||||||
|
)
|
||||||
|
return module
|
||||||
|
|
||||||
|
def check_components_table(self, module: dict) -> tuple[dict, dict]:
|
||||||
|
section = next(
|
||||||
|
(
|
||||||
|
unit
|
||||||
|
for unit in module["units"]
|
||||||
|
if unit.get("name") == COMPONENTS_SECTION and unit.get("level") == 3
|
||||||
|
),
|
||||||
|
None,
|
||||||
|
)
|
||||||
|
self.require("components-section", section is not None, f"H3 {COMPONENTS_SECTION!r}")
|
||||||
|
assert section is not None
|
||||||
|
tables = [
|
||||||
|
node
|
||||||
|
for node in self.children(module["document"], "table")
|
||||||
|
if node["span"]["start"] >= section["span"]["start"]
|
||||||
|
and node["span"]["end"] <= section["span"]["end"]
|
||||||
|
]
|
||||||
|
self.require("components-table-is-ast", len(tables) == 1, f"{len(tables)} GFM table(s) in section")
|
||||||
|
table = tables[0]
|
||||||
|
rows = list(self.children(table, "table_row"))
|
||||||
|
self.require("components-table-rows", len(rows) >= 2, f"{len(rows)} rows")
|
||||||
|
header = rows[0]
|
||||||
|
self.require("components-table-header-row", header.get("header") is True, "first row is header")
|
||||||
|
header_cells = list(self.children(header, "table_cell"))
|
||||||
|
texts = [self.text(module, cell["span"]).strip() for cell in header_cells]
|
||||||
|
self.require(
|
||||||
|
"components-table-header",
|
||||||
|
texts == COMPONENTS_HEADER,
|
||||||
|
f"header cells {texts!r}",
|
||||||
|
)
|
||||||
|
self.facts["components_table"] = {
|
||||||
|
"span": table["span"],
|
||||||
|
"rows": len(rows),
|
||||||
|
"header": texts,
|
||||||
|
"alignments": table.get("alignments"),
|
||||||
|
}
|
||||||
|
return table, section
|
||||||
|
|
||||||
|
def check_component_links(self, module: dict, table: dict, section: dict) -> list[dict]:
|
||||||
|
rows = list(self.children(table, "table_row"))[1:]
|
||||||
|
self.require("component-rows-present", bool(rows), "no component rows")
|
||||||
|
links = []
|
||||||
|
for index, row in enumerate(rows, start=1):
|
||||||
|
cells = list(self.children(row, "table_cell"))
|
||||||
|
self.require("component-row-cells", len(cells) == 4, f"row {index}: {len(cells)} cells")
|
||||||
|
component_cell = cells[2]
|
||||||
|
cell_links = list(self.children(component_cell, "link"))
|
||||||
|
self.require("component-cell-one-link", len(cell_links) == 1, f"row {index}: {len(cell_links)} links")
|
||||||
|
link = cell_links[0]
|
||||||
|
cell_text = self.text(module, component_cell["span"])
|
||||||
|
link_text = self.text(module, link["span"])
|
||||||
|
self.require(
|
||||||
|
"component-cell-link-only",
|
||||||
|
cell_text.strip() == link_text.strip(),
|
||||||
|
f"row {index} cell content {cell_text!r}",
|
||||||
|
)
|
||||||
|
reference = self.reference_for(module, link["url"], link["span"])
|
||||||
|
self.require(
|
||||||
|
"component-link-has-reference",
|
||||||
|
reference is not None,
|
||||||
|
f"row {index}: reference for {link['url']}: {reference is not None}",
|
||||||
|
)
|
||||||
|
assert reference is not None
|
||||||
|
candidate = reference.get("candidate_path")
|
||||||
|
fragment = reference.get("fragment")
|
||||||
|
self.require(
|
||||||
|
"component-link-candidate",
|
||||||
|
bool(candidate) and bool(fragment) and not Path(candidate).is_absolute()
|
||||||
|
and ".." not in Path(candidate).parts,
|
||||||
|
f"row {index}: candidate_path={candidate!r} fragment={fragment!r}",
|
||||||
|
)
|
||||||
|
self.require(
|
||||||
|
"component-link-state",
|
||||||
|
reference.get("state") in ("not_loaded", "resolved"),
|
||||||
|
f"row {index}: state={reference.get('state')!r}",
|
||||||
|
)
|
||||||
|
links.append(
|
||||||
|
{
|
||||||
|
"row": index,
|
||||||
|
"url": link["url"],
|
||||||
|
"span": link["span"],
|
||||||
|
"cell_span": component_cell["span"],
|
||||||
|
"reference_state": reference.get("state"),
|
||||||
|
"candidate_path": candidate,
|
||||||
|
"fragment": fragment,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.facts["design_links"] = links
|
||||||
|
return links
|
||||||
|
|
||||||
|
def check_target_anchors(self, links: list[dict]) -> None:
|
||||||
|
resolved = []
|
||||||
|
for link in links:
|
||||||
|
target = (self.root / link["candidate_path"]).resolve()
|
||||||
|
self.require(
|
||||||
|
"target-inside-root",
|
||||||
|
target.is_file() and str(target).startswith(str(self.root.resolve())),
|
||||||
|
f"{link['candidate_path']} exists inside --root: "
|
||||||
|
f"{target.is_file() and str(target).startswith(str(self.root.resolve()))}",
|
||||||
|
)
|
||||||
|
module = self.analyze(target)
|
||||||
|
unit = self.unit_by_anchor(module, link["fragment"])
|
||||||
|
self.require(
|
||||||
|
"target-anchor-resolves",
|
||||||
|
unit is not None and unit.get("kind") == "knowledge",
|
||||||
|
f"{link['candidate_path']}#{link['fragment']} did not resolve to a Knowledge H2",
|
||||||
|
)
|
||||||
|
resolved.append(
|
||||||
|
{
|
||||||
|
"candidate_path": link["candidate_path"],
|
||||||
|
"fragment": link["fragment"],
|
||||||
|
"target_module_id": module["id"],
|
||||||
|
"target_source_digest": module["source_digest"],
|
||||||
|
"target_unit_id": unit["id"],
|
||||||
|
}
|
||||||
|
)
|
||||||
|
self.facts["resolved_targets"] = resolved
|
||||||
|
|
||||||
|
def check_negative_fixtures(self) -> None:
|
||||||
|
fixtures = self.work / "negative"
|
||||||
|
fixtures.mkdir(parents=True, exist_ok=True)
|
||||||
|
(fixtures / "target.mq.md").write_text("# 目标页\n\n## @knowledge 目标组件\n\n正文。\n")
|
||||||
|
(fixtures / "plain-link.mq.md").write_text(
|
||||||
|
"# 普通文档\n\n## 正文\n\n见 [目标](target.mq.md#目标组件)。\n"
|
||||||
|
)
|
||||||
|
(fixtures / "missing-anchor.mq.md").write_text(
|
||||||
|
"## @knowledge 页面\n\n### 组件\n\n| 行 | 槽 | 组件 | 宽度 |\n| --- | --- | --- | --- |\n"
|
||||||
|
"| 1 | a | [缺失](target.mq.md#不存在) | 1fr |\n"
|
||||||
|
)
|
||||||
|
plain = self.analyze(fixtures / "plain-link.mq.md")
|
||||||
|
plain_tables = list(self.children(plain["document"], "table"))
|
||||||
|
plain_refs = plain.get("references", [])
|
||||||
|
self.require(
|
||||||
|
"negative-plain-link-not-a-table",
|
||||||
|
not plain_tables and any(r.get("candidate_path") == "target.mq.md" for r in plain_refs),
|
||||||
|
"ordinary paragraph link must stay a normal reference, not a component table row",
|
||||||
|
)
|
||||||
|
missing = self.analyze(fixtures / "missing-anchor.mq.md")
|
||||||
|
missing_ref = next(
|
||||||
|
(r for r in missing.get("references", []) if r.get("fragment") == "不存在"), None
|
||||||
|
)
|
||||||
|
self.require(
|
||||||
|
"negative-missing-anchor-has-candidate",
|
||||||
|
missing_ref is not None and missing_ref.get("state") == "not_loaded",
|
||||||
|
"missing anchor must still expose candidate_path/fragment for a deterministic rejection",
|
||||||
|
)
|
||||||
|
self.facts["negative_fixtures"] = {
|
||||||
|
"plain_link": {"tables": len(plain_tables), "references": len(plain_refs)},
|
||||||
|
"missing_anchor": {
|
||||||
|
"state": missing_ref.get("state") if missing_ref else None,
|
||||||
|
"candidate_path": missing_ref.get("candidate_path") if missing_ref else None,
|
||||||
|
"fragment": missing_ref.get("fragment") if missing_ref else None,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
def run(self, expected_sha256: str | None) -> dict:
|
||||||
|
self.check_cli_identity(expected_sha256)
|
||||||
|
module = self.check_entry()
|
||||||
|
table, section = self.check_components_table(module)
|
||||||
|
links = self.check_component_links(module, table, section)
|
||||||
|
self.check_target_anchors(links)
|
||||||
|
self.check_negative_fixtures()
|
||||||
|
gaps = []
|
||||||
|
facts = self.facts
|
||||||
|
if "components_table" not in facts:
|
||||||
|
gaps.append("Analysis does not expose the GFM table AST needed by the contract")
|
||||||
|
if "design_links" not in facts:
|
||||||
|
gaps.append("Analysis does not expose design link references with candidate_path/fragment")
|
||||||
|
if "resolved_targets" not in facts:
|
||||||
|
gaps.append("Analysis cannot resolve target Knowledge H2 anchors")
|
||||||
|
failures = [check for check in self.checks if check["status"] == "FAIL"]
|
||||||
|
repo_sha = None
|
||||||
|
if (REPO / ".git").exists():
|
||||||
|
repo_sha = subprocess.run(
|
||||||
|
["git", "-C", str(REPO), "rev-parse", "HEAD"], capture_output=True, text=True
|
||||||
|
).stdout.strip()
|
||||||
|
return {
|
||||||
|
"schema": "marqdo.web-analysis-probe",
|
||||||
|
"schema_version": 1,
|
||||||
|
"status": "PASS" if not failures and not gaps else "FAIL",
|
||||||
|
"repository": {"sha": repo_sha},
|
||||||
|
"inputs": self.inputs,
|
||||||
|
"facts": facts,
|
||||||
|
"checks": self.checks,
|
||||||
|
"gaps": gaps,
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def main(argv: list[str]) -> int:
|
||||||
|
parser = argparse.ArgumentParser(description=__doc__)
|
||||||
|
parser.add_argument("--cli", required=True)
|
||||||
|
parser.add_argument("--root", default=str(DEFAULT_ROOT))
|
||||||
|
parser.add_argument("--out", default=None)
|
||||||
|
parser.add_argument("--expected-cli-sha256", default=None)
|
||||||
|
parser.add_argument("--json", action="store_true")
|
||||||
|
args = parser.parse_args(argv)
|
||||||
|
cli = Path(args.cli).resolve()
|
||||||
|
if not cli.is_file():
|
||||||
|
print(f"risk-probe: error: no CLI executable at {cli}", file=sys.stderr)
|
||||||
|
return 2
|
||||||
|
work = Path(tempfile.mkdtemp(prefix="marqdo-web00-"))
|
||||||
|
try:
|
||||||
|
report = Probe(cli, Path(args.root).resolve(), work).run(
|
||||||
|
args.expected_cli_sha256
|
||||||
|
)
|
||||||
|
except ProbeError as error:
|
||||||
|
print(f"risk-probe: FAIL: {error}", file=sys.stderr)
|
||||||
|
return 1
|
||||||
|
finally:
|
||||||
|
shutil.rmtree(work, ignore_errors=True)
|
||||||
|
text = json.dumps(report, ensure_ascii=False, indent=2) + "\n"
|
||||||
|
if args.out:
|
||||||
|
out = Path(args.out)
|
||||||
|
out.parent.mkdir(parents=True, exist_ok=True)
|
||||||
|
out.write_text(text)
|
||||||
|
if args.json:
|
||||||
|
print(text, end="")
|
||||||
|
else:
|
||||||
|
print(f"WEB-00 Analysis probe: {report['status']}")
|
||||||
|
for check in report["checks"]:
|
||||||
|
print(f" {check['status']} {check['id']}: {check['detail']}")
|
||||||
|
for gap in report["gaps"]:
|
||||||
|
print(f" GAP {gap}")
|
||||||
|
return 0 if report["status"] == "PASS" else 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
raise SystemExit(main(sys.argv[1:]))
|
||||||
Reference in new issue
Block a user