feat: WEB-04 domain composition cases and production delivery trial

Add three composition cases driven by the same generic web Tool:
- examples/doc-site (documentation site),
- examples/research-workspace (existing section 8 workbench prototype),
- examples/quantum-editor (finite scenario/interaction design).

Add a real production delivery trial in examples/research-workbench-app
(Express + JSON persistence + static UI): validation, search, status
transitions, linked statistics, JSON errors, real file persistence; node:test
API acceptance and a Playwright browser E2E. The production app is not a runtime
dependency of the web Tool; prototype PASS is kept separate from production
PASS. docs/WEB-04-delivery.md records the design-source to implementation
mapping, intentional non-goals and task splits.

scripts/domain-acceptance.sh is the explicit domain entry: installs the built
Tool, runs check/preview/handoff for the three cases, then installs/tests the
production app incl. browser E2E, and removes the Tool. Evidence records the
real CLI/Design/Preview identities and local PASS results.

Pin the domain submodules to the merged Design (WEB-01/03) and Preview (WEB-02)
candidates; activation and root gitlink belong to WEB-05.

Refs cflmy/marqdo-ext-web#2, cflmy/marqdo#6
This commit was merged in pull request #4.
This commit is contained in:
cflmy committed 2026-11-27 09:02:27 +08:00
1 parent df4324f3e3
commit 7a2c9280c0
26 files changed
+1559 -3

No files matched your search

@@ -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; }