Release 2.7.0: executable handbooks and native user-site workflows

This commit is contained in:
cflmy committed 2026-11-10 17:03:06 +08:00
1 parent aa0c4d0f55
commit d9aef957f7
562 files changed
+21064 -20387

No files matched your search

+1 -1
View File
@@ -80,7 +80,7 @@
| [design/ext-cdn.md](design/ext-cdn.md) | **扩展 CDN(R2 / ext.marqdo.com)与分开发版** |
| [design/ubuntu-ppa.md](design/ubuntu-ppa.md) | **Ubuntu PPA 打包与上传** |
| [design/ext-web.md](design/ext-web.md) | **官方扩展 `ext/web`(页面/库表/绑定/后台;ABI + CLI;设计锁定)** |
| [design/ext-web-go-rewrite.md](design/ext-web-go-rewrite.md) | **`plugins/web` Go 全量重写**(多语言 ABI · 网页制备完备 · anlian 验收) |
| [design/ext-web-go-rewrite.md](design/ext-web-go-rewrite.md) | **`plugins/web` Go 全量重写**(多语言 ABI · 网页制备完备 · 独立工作流验收) |
| [adr/0004-web-plugin-go.md](adr/0004-web-plugin-go.md) | **Accepted:web 原生插件实现语言为 Go** |
| [research/ext-web-customization-limits.md](research/ext-web-customization-limits.md) | **`ext/web` 定制限制踩坑盘点**(路由/壳 CSS/鉴权/样式/部署) |
| [design/ext-web-customization/](design/ext-web-customization/) | **对应解决设计**(C0–C4:前缀可让出、shell_css、gate、布局…) |
+2
View File
@@ -1,5 +1,7 @@
# ADR 0004:网络拓展库原生实现改为 Go
历史说明(2026-11-10):下文业务站点仅记录当时决策背景,相关工程已移出本仓库;当前验收使用维护中的完整站点、网络站点及隔离测试,见 [当前工作流](../design/ext-web-go-rewrite.md#8-独立工作流与隔离验收)。
| | |
|---|---|
| Status | **Accepted** |
+7 -4
View File
@@ -1,5 +1,8 @@
# 浏览器 Marqdo(WASM 解释器)设计
> 2.7.0 维护说明:独立的 browser-hello 与 browser-media 演示已删除。下文保留既有能力设计与宿主边界,当前可运行工程使用 browser-app;底层计数器冒烟夹具位于 tests/wasm/counter.mq.md。Canvas、音频等仍是 lib/browser 的宿主能力,不宣称当前 browser-app 演示包含这些交互。
| | |
|---|---|
| 状态 | **Accepted(设计锁定)** · 实现见路线图 C0–C5 |
@@ -124,7 +127,7 @@ source: &str (+ optional import map)
| `marqdo`(根) | 核心;feature-gate |
| `crates/marqdo-wasm` | `cdylib`:`mq_*` ABI + `js/marqdo-bridge.js` |
| `ext/web` 或 `web/browser` | L1:`浏览器.运行` / `交互装配`(C3+) |
| `examples/browser-hello/` | 静态页 + wasm 冒烟 |
| `examples/browser-app/` | 静态页 + wasm 冒烟 |
| `tests/browser/` 或金样脚本 | Node/wasmtime 跑 `run_source` 对齐 |
发行:`marqdo wasm build`(C2 CLI 糖)或 `wasm-pack build crates/marqdo-wasm`。
@@ -210,7 +213,7 @@ L1 `浏览器.交互装配`(ext)可后置;C3 以 bridge + 返回 wire 表
Bridge:`applyEffects(exports, value)` — 先 DOM,再调度异步;**不**在 WASM 内阻塞。
示例见 `examples/browser-hello/fetch.mq.md`。
示例见 `examples/browser-app/static/app.mq.md`。
---
@@ -251,7 +254,7 @@ marqdo wasm build -o static # marqdo_wasm.wasm + marqdo-bridge.js
# app.static dir=static
```
业务页再 `boot` 自己的 `.mq.md`(见 `examples/browser-hello/`)。
业务页再 `boot` 自己的 `.mq.md`(见 `examples/browser-app/`)。
---
@@ -261,7 +264,7 @@ marqdo wasm build -o static # marqdo_wasm.wasm + marqdo-bridge.js
|----|------|
| 单元 | `run_source("…# main\n> print…")` native 与 wasm 同测 |
| 金样子集 | `tests/structure/hello.mq.md` 等无 fs/net/plugin 的样例 |
| 浏览器冒烟 | `examples/browser-hello`:按钮点击 → Marqdo 函数 → 改 DOM 文本 |
| 浏览器冒烟 | `examples/browser-app`:按钮点击 → Marqdo 函数 → 改 DOM 文本 |
| 回归 | CI:`cargo test` native;另 job `wasm-pack build` / `cargo check --target wasm32-unknown-unknown --no-default-features --features wasm-core` |
---
+29 -54
View File
@@ -1,66 +1,41 @@
# Extension CDN (Cloudflare R2 → https://ext.marqdo.com)
# Extension CDN: native publication and byte parity
| | |
This page describes storage. The executable tasks are in [the release entry](../../skills/marqdo-release/index.mq.md), [assets.mq.md](../../skills/marqdo-release/assets.mq.md) and [asset_io.mq.md](../../skills/marqdo-release/asset_io.mq.md). Read the source contracts before calling them. Version, mode and publication authorization come from the user; inspecting an existing release grants no new remote write.
## Versioned packs
Extension versions come from ext/VERSION and can advance independently of the interpreter. An extension release uses its own ext-vX.Y.Z tag and three packs. A full release also includes the CLI, source, WASM and editor deliverables listed in model.mq.md.
| Object | Meaning |
|---|---|
| Status | **Accepted** — download prefer CDN; upload via `scripts/upload-ext-r2.py` |
| Date | 2026-09-17 |
| Related | [ext-cli.md](ext-cli.md) · [marqdo-release](../../.cursor/skills/marqdo-release/SKILL.md) |
| vX.Y.Z/marqdo-X.Y.Z-ext.zip | Readable extension sources |
| vX.Y.Z/marqdo-X.Y.Z-native-x86_64-pc-windows-msvc.zip | Windows plugins |
| vX.Y.Z/marqdo-X.Y.Z-native-x86_64-unknown-linux-gnu.zip | Linux plugins |
| vX.Y.Z/VERSION | Version echo for this pack set |
| latest/marqdo-X.Y.Z-*.zip | Identical current pack bytes |
| latest/VERSION | Recommended current extension version |
## Why
Public reads use https://ext.marqdo.com. [src/ext_cli.rs](../../src/ext_cli.rs) is authoritative for client override variables, version resolution and download fallback order. Ordinary installation does not need storage credentials.
CLI (语法解释器) and official **extension packs** (`ext/` L1 + native plugins) update on different cadences. Users behind unstable GitHub links should get packs from a stable object store first.
## Callable publication
## Public URL layout
After GitHub contains every required asset, download to dist/release-X.Y.Z. Validation checks names, GitHub size/SHA256, archive CRCs, versions and native capabilities. Source-declared plugins require matching libraries on both native platforms. Independently valid ZIPs cannot hide a missing DLL or shared library.
Bucket: `marqdo` · Custom domain: **https://ext.marqdo.com**
Run from the checkout root with the version already chosen by the user; use the actual full or ext mode:
```sh
marqdo call skills/marqdo-release/assets.mq.md download 'version="X.Y.Z"' 'mode="ext"' --require-ok --effects plugin,net,fs.write --fs-root . --json
marqdo call skills/marqdo-release/assets.mq.md publish 'version="X.Y.Z"' 'mode="ext"' --require-ok --effects plugin,net,fs.write --fs-root . --json
marqdo call skills/marqdo-release/index.mq.md finish 'version="X.Y.Z"' 'mode="ext"' --require-ok --effects plugin,net,fs.write --fs-root . --json
```
| Key | Meaning |
|-----|---------|
| `v{VER}/marqdo-{VER}-ext.zip` | L1 sources |
| `v{VER}/marqdo-{VER}-native-{triple}.zip` | Prebuilt plugins |
| `v{VER}/VERSION` | Pack SemVer echo |
| `latest/VERSION` | Recommended pack SemVer (plain text) |
| `latest/marqdo-…zip` | Same assets mirrored for convenience |
Publication rechecks all three packs and their combined capability matrix before the first PUT. All three versioned ZIPs and three latest ZIPs are written before either VERSION pointer. A failed ZIP stops the sequence. Historical versions are retained.
`{VER}` is the **extension pack** version (`ext/VERSION`), which **may differ** from CLI `Cargo.toml` version.
Finish reads both public pointers and compares downloaded versioned/latest bytes with GitHub SHA256 values. HTTP 200 or one sample URL is insufficient. Edge propagation may leave verification incomplete; repeat observation rather than rebuilding unrelated archives or claiming completion from an upload response.
## Client download order (`marqdo ext add`)
## Explicit boundaries
1. `MARQDO_EXT_DOWNLOAD_BASE` (optional override)
2. **CDN** `https://ext.marqdo.com/v{VER}/…` (override host with `MARQDO_EXT_CDN`)
3. GitHub Releases
4. `https://proxy.cflmy.top/github.com/…`
Filesystem operations, hashing, public HTTP downloads, release decisions and upload order are Marqdo code. The engineering extension supplies bounded ZIP inspection and private R2 Signature V4 transport. No Python uploader is part of this path; older standalone scripts remain compatibility utilities.
Pack SemVer resolution (`release_version()`):
The native boundary resolves credentials privately from existing stores or environment. Missing credentials fail explicitly. Never put access keys or secrets in tool parameters, source or reports. A plugin grant has normal OS authority; --fs-root does not sandbox native plugins or child processes.
1. `MARQDO_EXT_VERSION`
2. CDN `GET …/latest/VERSION` (short timeout)
3. Embedded `ext/VERSION` at build time
4. CLI `CARGO_PKG_VERSION`
## Separate ext release (no CLI bump)
1. Bump `ext/VERSION` (e.g. `1.0.3`) — leave root `Cargo.toml` alone if CLI unchanged.
2. Build native zips (CI Linux/Windows jobs or local `scripts/build-web-plugin.sh` + cargo plugins).
3. Package `marqdo-{VER}-ext.zip` and `marqdo-{VER}-native-*.zip`.
4. Upload **both**:
- R2: `python3 scripts/upload-ext-r2.py --version VER --from-dir dist/`
- GitHub: attach to a GitHub Release (tag `ext-vVER` **or** reuse latest CLI release assets)
5. Confirm `https://ext.marqdo.com/latest/VERSION` and a sample zip URL return 200.
## Full product release (CLI + ext)
Keep `ext/VERSION` equal to (or compatible with) CLI SemVer unless documenting a deliberate skew. CI still publishes GitHub assets; **after** CI green, run `upload-ext-r2.py` so CDN is populated (or add a CI step with R2 secrets).
## Credentials
| Where | What |
|-------|------|
| Local | `~/.marqdo/r2.env` (`chmod 600`) — see `.env.r2.example` |
| CI (optional) | GitHub Actions secrets: `R2_ACCESS_KEY_ID`, `R2_SECRET_ACCESS_KEY`, `R2_ENDPOINT`, `R2_BUCKET` |
**Never** commit Account API tokens or S3 secret keys. If a token was pasted into chat, **rotate** it in the Cloudflare dashboard.
## Object ACL
Custom domain public reads require the bucket/objects to be publicly readable (R2 public bucket / r2.dev / custom domain). Uploads use S3 API credentials; downloads by `ext add` are anonymous HTTPS GETs.
Isolated loopback tests use fake credentials to verify ZIP-before-VERSION ordering and failure stops. Read-only verification of the published 2.6.0 release has also exercised the actual GitHub/CDN parity path without republishing its assets.
+3 -1
View File
@@ -98,7 +98,9 @@ Welcome to the executable web.
| title | title | Marqdo | | title |
```
2026-11-08:View 已支持 row/column 容器与 markdown 叶子,容器值保持子表;显式 `view: main` Document 通过普通函数装配。完整工程见[布局实践](ext-web-layout-paradigm.md),实现边界见[优化说明](ext-web-handbook.md)。
2026-11-08:View 已支持 row/column 容器与 markdown 叶子,容器值保持子表;显式 `view: main` Document 通过普通函数装配。
2026-11-10:同一五列 View 可放置具型 Resource 节点;结构仍只在启动时装配,数据查询、已挂载表单与会话导航在请求期间解析。无新增 frontmatter 或核心标记;见 [请求资源](web-view-resources.md)。普通离线渲染缺少请求上下文时明确报错,不伪造动态内容。完整工程见[布局实践](ext-web-layout-paradigm.md),实现边界见[优化说明](ext-web-handbook.md)。
`page.render nodes=` 是**唯一**主装配路径。禁止 `compose_main` / `compose_intro` 等碎片 DSL。
+23 -26
View File
@@ -7,13 +7,15 @@
| 相关 | [ext-web.md](ext-web.md) · [ext-web-net.md](ext-web-net.md) · [web-net-capabilities.md](web-net-capabilities.md) · [ext-web-drivers.md](ext-web-drivers.md) · [web-assets-and-images.md](web-assets-and-images.md) · [ext-hosting-fill.md](ext-hosting-fill.md) · [ext-abi.md](ext-abi.md) · [ext-cli.md](ext-cli.md) · [web-asgi-servers-and-marqdo.md](web-asgi-servers-and-marqdo.md) |
| 实现目录 | `plugins/web/`(**Go module**;产物仍为 `libweb.so` / `web.dll` / `libweb.dylib`) |
| 作者面 | `ext/web/web.mq.md` · `ext/web/网页.mq.md`(**ABI 名与方法面保持兼容**;非另起一套 API) |
| 验收应用 | 工作区 `anlian`(暗恋见君):用 Marqdo 前后端脚本完整重写;**PostgreSQL + Redis 外接** |
| 当前验收 | 仓库内独立示例与临时夹具;完整站点、网络站点、浏览器与数据资源分别验证 |
本文件记录 Go 原生层重写时期的 ABI 与实施背景。2026-11-10 起不再以外部业务工程作为仓库交付项;当前作者规范与可调用入口以 [Web Artifact 设计](ext-web-artifact.md)、[网页手册](../../ext/web/index.mq.md)和[编程规范](../library-development.mq.md)为准。下方旧 compose/类链清单是历史对照,不能当作当前推荐 API。
---
## 0. 一句话
用 **Go** 重写官方网络拓展库原生层(`plugins/web`),在 **C ABI v2 全量兼容** 前提下提供「网页制备」所需的全部服务端能力;`ext/web` 继续用 GFM 表 + `#` 类做作者面;应用(含暗恋见君)的前后端脚本全部用 Marqdo 书写。此举同时验证 **多语言 ABI 插件生态**(首个非 Rust 官方插件)。
用 **Go** 重写官方网络拓展库原生层(`plugins/web`),在 **C ABI v2 全量兼容** 前提下提供「网页制备」所需的全部服务端能力;`ext/web` 继续用 GFM 表 + `#` 类做作者面;应用的前后端脚本全部用 Marqdo 书写。此举同时验证 **多语言 ABI 插件生态**(首个非 Rust 官方插件)。
**不是**最小 hello 插件;**不是**在旧 Rust 代码上打补丁(对齐 [ext-web.md](ext-web.md) **C5**)。
@@ -36,7 +38,7 @@
2. **作者面可用**:现有 `ext/web` 示例与 `tests/ext/web-*`(含 live-server)在换 Go `.so` 后通过;无需作者改业务脚本(除非文档标明的 **G 增强**)。
3. **网页制备完备**:单站点可完成页面装配、样式/头/图、库表、表单、路由、中间件、鉴权/RBAC、上传下载、SEO/RSS/sitemap、WS、缓存、对象存储、反代、invoke——即 W0–W8 + P3 + C0–C4 + H1/H2 能力面。
4. **驱动外接**:`postgres://`、`redis://`、`s3://` 为正式一等能力(与 [ext-web-drivers.md](ext-web-drivers.md) 一致);SQLite / memory / file 仍支持本地与测试。
5. **暗恋见君可写完**:用 Marqdo 后端脚本 + 浏览器 WASM 前端脚本重写 anlian 核心模块(见 §8);运行时仅依赖 `marqdo` + `libweb` + **外接 PostgreSQL + Redis**(可选 S3/RustFS)。
5. **通用工作流可验证**:使用仓库内独立站点和临时夹具覆盖数据、鉴权、表单与实时能力(见 §8);SQLite 提供本地验收,PostgreSQL、Redis 和对象存储按各自可用环境另行验证。
6. **安装路径不变**:`marqdo ext add web`、`plugin.native_path name=web`、`MARQDO_WEB_PLUGIN`、产物文件名 `libweb.so` 等与 [ext-cli.md](ext-cli.md) 兼容。
### 1.3 非目标
@@ -56,7 +58,7 @@
```text
┌──────────────────────────────────────────────────────────────────┐
│ 应用(anlian / 任意站点) │
│ 应用(独立业务站点) │
│ · 后端 .mq.md:路由、业务、装配、invoke 处理函数 │
│ · 前端 .mq.md:WASM + lib/browser(作者零业务 JS) │
└────────────────────────────┬─────────────────────────────────────┘
@@ -284,41 +286,36 @@ Where 语义:等值 map、filter 表、OR / IN / BETWEEN、分页 offset/limit
---
## 7. G 增强(完备网页制备 + anlian;兼容之上增量)
## 7. G 增强(完备网页制备;兼容之上增量)
> 以下为 **新增能力**,不替代 §5。作者面用新方法/新 configure 键;旧脚本不受影响。
| ID | 能力 | 动机 | 作者面草案 |
|----|------|------|------------|
| **G-WS1** | **命名房间** WS:`join`/`leave`/`publish`;组名 ASCII(如 `chat.room.{id}`) | anlian 公聊/私聊 | `app.route_ws` 增 `mode=room` + `room_key`;或 `ws.room_*` ABI |
| **G-WS1** | **命名房间** WS:`join`/`leave`/`publish`;组名 ASCII(如 `chat.room.{id}`) | 独立聊天室 | `app.route_ws` 增 `mode=room` + `room_key`;或 `ws.room_*` ABI |
| **G-WS2** | 房间消息钩子:先 `invoke`/落库再广播 | 「先写 PG 再推送」 | configure 或 route 表 `on_message=lib.member` |
| **G-SESS1** | Session 后端可选 `redis://` | 多进程/多实例 | `web_session_new` url 或 auth 配置 `session=redis://` |
| **G-CACHE1** | Redis pub/sub 可选作 WS 扇出后端 | 多进程 WS | `configure ws_backend=redis` |
| **G-API1** | Bearer API Key 校验原语(hash+pepper+scopes) | anlian `apikeys` | `web_api_key_check` + `# auth` 或独立小类;**业务 scopes 仍在 .mq.md** |
| **G-MAIL0** | (可选后续)SMTP 发送原语 | 邮箱验证码 | 不阻塞首版对等;列入 anlian 二期 |
| **G-API1** | Bearer API Key 校验原语(hash+pepper+scopes) | API 密钥资源 | `web_api_key_check` + `# auth` 或独立小类;**业务 scopes 仍在 .mq.md** |
| **G-MAIL0** | (可选后续)SMTP 发送原语 | 邮箱验证码 | 不阻塞首版对等;另列后续能力 |
**明确仍属应用层(不进插件)**:反垃圾策略、草稿定时发布约定、好友关系、专题 `topic_bundles` 静态交互内容(静态挂载 + 前端 Marqdo/既有 JS 资产)。
---
## 8. 暗恋见君验收矩阵(检测「能不能写完」)
## 8. 独立工作流与隔离验收
外部依赖(允许):**PostgreSQL**、**Redis**;可选对象存储。
仓库交付不依赖某个外部业务工程的源码或个人数据库。各能力保留在原生实现与领域资源中,通过维护中的独立示例验证;移出业务工程不构成删除通用功能的理由。
| 模块 | Marqdo 后端 | Marqdo 前端 | 插件依赖 | 验收 |
|------|-------------|-------------|----------|------|
| 站点壳 / 首页 | `# page` + db | 局部刷新可选 WASM | listen、static、cache | 首页可开 |
| posts 帖子/评论/板块 | route + form + db | 发帖表单 WASM 可选 | CRUD、CSRF、upload | CRUD+列表详情 |
| news | 同上 | 同上 | 同上 | 列表详情 |
| accounts | auth + session +(二期 mail) | 登录表单 | argon2、session、gate | 注册登录 |
| profiles | db + storage | 头像上传 | storage/upload | 资料页 |
| search | db.search 或 PG 查询 + cache | — | db/cache | 关键词搜索 |
| chat | route_ws + G-WS1/2 + db | WS 客户端脚本 | Redis + WS rooms | 公聊+私聊实时 |
| apikeys | G-API1 + db | 管理页 | — | Bearer 调 API |
| webmaster | sitemap/robots | — | 已有 ABI | `/sitemap.xml` |
| topics | `app.static` → bundles | 既有静态交互 | static | 专题可访问 |
| 工作流 | 当前来源 | 实际核对 |
|---|---|---|
| 完整动态站点 | examples/web-site、examples/web-site-zh | 原主题规则、摘要与详情、当前记录、表单重试、会话导航及后台门禁 |
| 网络资源 | examples/web-net-site、examples/web-net-site-zh | Cookie/multipart、WebSocket 回显、真实表单与后台 |
| 客户端状态 | examples/web-spa-app、examples/web-collab-doc | 当前 WASM、历史记录、编辑、多标签实时协作 |
| 数据与租户 | tests/example_databases.rs、tests/web_handbook.rs | 独占临时数据库、已有记录保留、租户条件 |
| 原生插件 | plugins/web 内部测试 | 独立夹具下验证数据库、会话、运输、资源及渲染边界 |
**「写完」定义**:上述模块在 Marqdo 仓库或 `anlian` 旁路目录有可运行 `.mq.md` 站点;gold/手工脚本能走通主路径;不依赖 Django/Channels/Daphne/gunicorn。
开发与验收由 skills/marqdo-dev/index.mq.md 编排,使用 marqdo call。完整示例的浏览器用例和 HTTP 用例不能替代 Postgres、Redis、OIDC 或外部服务的真实环境证据;未运行的边界仍需明确保留为未验证。
---
@@ -400,7 +397,7 @@ scripts/build-web-plugin.sh # go build -buildmode=c-shared -o …/libweb.so
| **W-G11** | 定制 C2–C4 shell/layout/style/nav | ✅ `web-c2`–`c4` |
| **W-G12** | G 增强 WS rooms + Redis session/pubsub + API key 原语 | ✅ 单测 + `web-g12-api-key-smoke` |
| **W-G13** | 默认切换 Go `libweb`;归档 Rust;更新发版与 ext CLI | ✅ 离线+live gold(7 个 `*_live`)对 Go 全绿;`ext add`/`gold`/`release` 走 `scripts/build-web-plugin.sh`;Rust 移出 workspace;gold 强制 `MARQDO_WEB_PLUGIN` 避免 `~/.marqdo` 旧 so |
| **W-G14** | anlian Marqdo 重写主路径(可分仓或 `examples/anlian-mq/`) | ✅ `examples/anlian-mq/`(本地 SQLite + 粉玻璃主题 + 主路由/登录/片段;外接 PG/Redis 仍为增强路径) |
| **W-G14** | 历史业务站点主路径演示 | 历史演示工程已移出仓库;当前独立验收见 §8 |
每波次:**先补 Go 实现 → 跑对应 gold → 再进入下一波**。禁止跨波次留下「注册了但返回 stub 错误」的 ABI(除 W-G0 明确的未实现探测)。
@@ -414,7 +411,7 @@ scripts/build-web-plugin.sh # go build -buildmode=c-shared -o …/libweb.so
| 金样例 | 现有 `tests/ext/web-*.mq.md`;构建脚本产出 `libweb.so` 后跑 |
| Live | 现有 `*-live-server.mq.md` + curl |
| 回归门禁 | CI:安装 Go → `scripts/build-web-plugin.sh` → `cargo test` 相关 web 项 |
| anlian | 独立 smoke:登录、发帖、WS 发言、API key |
| 独立站点 | 登录、表单、WebSocket 与 API 使用可控夹具分别验收 |
---
@@ -450,6 +447,6 @@ scripts/build-web-plugin.sh # go build -buildmode=c-shared -o …/libweb.so
1. **全量重写** `plugins/web` 为 Go,**不是**最小闭环。
2. **既有网络拓展能力(§5)重写后必须仍可用**;作者面默认兼容。
3. **PostgreSQL / Redis 外接** 为一等公民;Marqdo 承担应用前后端脚本。
4. **暗恋见君** 为完备性验收,不是缩小插件范围的借口。
4. 完备性通过独立工作流和原生测试验证,不以外部业务工程缩小插件能力范围。
5. **多语言 ABI 生态** 以本插件为样板(G7)。
6. 开发严格按 **§10 波次** 推进;本文件为唯一施工图。
+1 -1
View File
@@ -66,6 +66,6 @@ node tests/web/layout.browser.cjs /absolute/path/to/preview.html
它测量 1440px 下的外层与内层双栏、390px 下的两层纵向折叠,并检查无横向溢出。无需外部资源或业务 JavaScript。Go 单元测试覆盖递归 Markdown、顺序、带类型列式表、错误形状与 Document 显式执行边界。
既有 Anlian 渲染测试已从硬编码个人数据库改为临时目录建表并注入已知数据,使完整 Go 套件无需个人站点状态。
通用数据文档渲染测试已从硬编码个人数据库改为临时目录建表并注入已知数据,使完整 Go 套件无需个人站点状态。
Web 提交时,全库 Rust 为 436 通过、25 项既有策略/回放失败,基线失败集合相同。后续已单独修复 Rust→Lean 命令缺字段的问题:所有操作发送完整的 op、steps、value,进程错误保留退出码与 stderr。原 25 项失败全部消除,新增诊断回归后库级测试为 462 通过、0 失败。策略判定仍由 Lean 执行。
+35 -71
View File
@@ -1,85 +1,49 @@
# Ubuntu PPA packaging (Marqdo)
# Ubuntu PPA: executable packaging and publication
| | |
The maintained entry is [the release handbook](../../skills/marqdo-release/index.mq.md). [ubuntu.mq.md](../../skills/marqdo-release/ubuntu.mq.md) provides publication and observation tasks; [package.mq.md](../../skills/marqdo-release/package.mq.md) owns native metadata and staged file preparation. Their source contracts replace a separate command playbook.
The PPA is ppa:cflmy/marqdo. Apt installs the interpreter; extensions remain independently installed by marqdo ext add. Upload acceptance alone is incomplete: the exact source must be published, its amd64 build must succeed and apt must expose the same Debian version.
## Exact version and artifact
| Value | Meaning |
|---|---|
| Status | **Active** — `ppa:cflmy/marqdo`; noble builds need bundled Rust (Cargo.lock v4) |
| Maintainer | cflmy \<pingan@cflmy.cn\> |
| GPG | `505943294D04C803` (fingerprint `52A1…C803`) |
| PPA | `ppa:cflmy/marqdo` |
| X.Y.Z | Cargo package.version and the authorized upstream |
| 1ppaN | Reviewed debian/changelog packaging revision |
| ~SERIES | Explicit Ubuntu target, normally noble |
| marqdo_X.Y.Z-1ppaN~SERIES_source.changes | Exact signed source artifact |
| ext/VERSION | Independent extension-pack version |
## Goal
Native upstream and debian_version tasks parse the actual files. The latter retains the reviewed revision, removes its old series suffix and selects the current upstream/target series. A packaging-only reupload needs an explicit changelog revision edit. Upload selects the exact computed filename, never the newest unrelated package from a previous release or another series.
Users install with:
## Callable workflow
```bash
sudo add-apt-repository ppa:cflmy/marqdo
sudo apt update
sudo apt install marqdo
Run from the checkout root after the user has authorized this CLI/full release. Replace X.Y.Z with that version:
```sh
marqdo call skills/marqdo-release/ubuntu.mq.md ship 'version="X.Y.Z"' 'series="noble"' --require-ok --effects plugin,fs.read --fs-root . --json
marqdo call skills/marqdo-release/ubuntu.mq.md status 'version="X.Y.Z"' 'series="noble"' --require-ok --effects plugin,net --fs-root . --json
marqdo call skills/marqdo-release/index.mq.md finish 'version="X.Y.Z"' 'mode="full"' --require-ok --effects plugin,net,fs.write --fs-root . --json
```
CLI and extension packs stay independent: the `.deb` ships the **interpreter**; `marqdo ext add …` still pulls from **https://ext.marqdo.com** (then GitHub / proxy).
Status is observational: inspect complete as well as Result.ok. Finish turns incomplete publication into a failed Result, allowing --require-ok to stop automation while keeping evidence. A green GitHub run does not establish Launchpad completion or apt availability.
## Why bundled Rust?
## Native files and existing tools
Ubuntu **noble** ships cargo/rustc **1.75**, which cannot parse **Cargo.lock version 4** (`lock file version 4 requires -Znext-lockfile-bump`). Launchpad builders also have **no network**, so `ppa-build-source.sh` vendors crates **and** installs a modern toolchain into `third_party/rust` inside the `.orig.tar.xz`. `debian/rules` prefers that toolchain over distro cargo.
Marqdo reads version metadata and writes the staged Cargo configuration, Debian changelog and vendor-checksum repairs. Native filesystem, TOML and JSON functions carry the data. No generated Python reader or writer is used. Vendor repair removes backup entries that Debian cleaning would delete while retaining package digests and ordinary source hashes.
## One-time Launchpad setup
The existing Debian boundary uses Cargo vendor, tar/xz, the configured Rust installation, debuild, GPG and dput. The source archive includes vendored crates and the selected Rust toolchain for an offline build. Its script chooses a fixed default toolchain and exposes the existing override; it does not assume the build host compiler is sufficient.
1. Create PPA: https://launchpad.net/~cflmy/+activate-ppa → name e.g. `marqdo`
2. OpenPGP key already on Launchpad (done)
3. Sign Ubuntu Code of Conduct if Launchpad asks
4. Enable the Ubuntu **series** you upload for (e.g. noble) under PPA → Change details
5. On the build machine:
A new upstream may create an orig archive. Once Launchpad accepts that upstream, reuse the identical bytes and upload only the Debian revision. Never rebuild an accepted orig archive to work around a checksum rejection. A failed stage remains available for inspection.
```bash
sudo apt install build-essential debhelper devscripts dput lintian \
dpkg-dev quilt cargo rustc pkg-config curl xz-utils
```
## Recovery evidence
## Package layout
| Failure | Required action |
|---|---|
| sudo/GPG interaction unavailable | Complete the same concrete Debian boundary in the user's terminal, keeping version and series |
| Complete package version already used | Review and increment the Debian revision before another authorized upload |
| orig bytes differ | Retrieve and reuse the previously accepted archive |
| Offline vendor checksum failure | Inspect sanitize_vendor evidence and the retained staged tree |
| Source accepted, build pending/failed | Inspect the actual Launchpad build |
| Build green, apt metadata stale | Repeat apt observation for the exact version |
| File | Role |
|------|------|
| `debian/control` | Metadata (amd64; no distro cargo BD) |
| `debian/changelog` | Upload revisions (`1ppaN`) |
| `debian/rules` | `dh` + bundled/system cargo build |
| `scripts/ppa-build-source.sh` | Vendor + bundle Rust + `debuild -S` |
| `scripts/ppa-ship.sh` | apt deps + build + `dput` |
## Versioning
- Upstream SemVer: `Cargo.toml` / git tag `vX.Y.Z`
- Debian revision: `X.Y.Z-1ppaN~SERIES` (SERIES = `noble`, …) — bump `1ppaN` on packaging-only reuploads
- **Ext pack** SemVer (`ext/VERSION`) is **not** the deb version
## One-shot (recommended)
```bash
cd ~/work/marqdo
./scripts/ppa-ship.sh noble # tools → debuild -S → dput
./scripts/ppa-ship.sh noble -n # build only
```
If automation cannot enter sudo/GPG, tell the user these commands (do not invent alternatives):
```bash
./scripts/ppa-build-source.sh noble
dput ppa:cflmy/marqdo ../build-area/marqdo_*~noble_source.changes
```
Watch: https://launchpad.net/~cflmy/+archive/ubuntu/marqdo/+builds
## Failure notes
| Symptom | Fix |
|---------|-----|
| `lock file version 4 requires -Znext-lockfile-bump` | Rebuild with current `ppa-build-source.sh` (bundles Rust); bump `1ppaN` |
| `failed to calculate checksum of: …/vendor/…/Cargo.toml.orig` | `dh_clean` purged `*.orig`; fixed via `dh_clean -Xvendor/` (+ strip `.orig` only when **creating a new** orig); bump `1ppaN` with **`-sd`** |
| `orig.tar.xz already exists … different contents` | Never rewrite an uploaded upstream `.orig`; reuse PPA file (`ppa-build-source.sh` downloads it) and `debuild -S -sd` |
| Same version rejected by Launchpad | Bump `debian/changelog` (`1ppa2`, …) |
| Wrong series | Enable series on PPA; rebuild with that series name |
## Out of scope (v1 deb)
- Shipping `ext/native/*.so` inside the deb (use CDN `ext add`)
- WASM / VSIX / non-amd64
Public apt observation reads Packages.gz with native HTTP bytes and the bounded gzip boundary, then inspects actual package records. Isolated fixtures cover metadata selection, configuration writing and vendor-checksum preservation without uploading to a PPA.
+25
View File
@@ -0,0 +1,25 @@
# View 中的请求资源
状态:请求资源已实现,后续旧站点迁移继续进行。遵循 ADR 0007;沿用五列 View、普通表值与 Resource,不增加 Markdown 标记或 frontmatter 方言。
view: main 仍只在启动时执行一次。它返回的结构保留为 View 节点,服务器在每次请求准备会话、路由参数和 CSRF 后渲染。普通 Markdown、控件和布局没有额外业务执行;只有 type=resource 的节点把 value 中的已声明 Resource 交给对应原生处理器。
Resource 的职责明确分开:data_query 查询当前应用数据库;form_ref 引用显式挂载的表单;view_navigation 根据当前会话筛选导航。document_head 是纯文档资源,只贡献 SEO 与原生资源链接,不需要请求上下文。它们不接受任意页面属性,不恢复 compose_*、页面变异链或 app.configure。结构和文字继续递归拆成组件及 Markdown 叶子。
启动阶段检查节点和资源契约,不查询数据库、不提交表单。请求渲染失败保留真实诊断。离线纯渲染遇到查询、表单与会话导航时明确要求上下文,不伪造空列表、登录状态或表单提交成功。纯页头资源与普通内容可以直接预览。
数据查询使用原有数据库资源与条件格式,路由参数来自实际请求。表单通过原有系统路由处理,字段、规则和提交资源保持一致,并传递真实 CSRF 与返回地址。导航的可见性不能替代服务端鉴权。资源绑定和监听仍是独立步骤。
验收覆盖启动无数据查询、请求间新增数据可见、完整正文与摘要区分、动态路由条件、登录前后导航、表单校验与提交、CSRF、未知资源失败,以及原有静态布局和浏览器用例。
已完成的实际证据:web-net-site 与 web-net-site-zh 使用这些资源完整迁移;web_handbook 在两个启动后端中验证请求期间的数据更新、表单错误重试、工具页与后台鉴权。原生 Go 测试验证结构装配不查询缺失数据库、未知资源失败、路径条件不污染保留定义、CSRF 拒绝与错误重试。browser_handbook.mjs 使用当前 WASM 验证连续回显、Enter 与空输入、实际提交与管理后台、窄屏布局。
入口与边界:component.resource(中文组件为“请求资源”,保留原“资源”作为脚本/样式引用)、data/view.query、form.reference 与 form.mount、component.navigation。表单挂载可显式保护实际系统提交路径,不能只保护展示页面。服务器回调继承授予的文件根,所选站点根只能收窄该范围;嵌套页面按统一站点根读取共享叶子,Endpoint 同样保留该上下文。
片段沿用 /_part/{slot}:递归选择唯一具名区域,在当前请求上下文中解析其资源;不会把源码当作片段返回。未声明 main 槽时保留整组节点作为 main 的兼容回退,其他未知槽返回 404,重复槽保留歧义诊断。容器遍历与完整渲染共享同一类型表,不进入资源私有数据。
检视的 registered 范围复用真实监听的注册过程,捕获处理器路径但不执行处理器;不会初始化数据库、重置会话或调用页面。metadata 范围仅扫描文件声明与运行时模板。两者明确区分,不能把目录扫描当成资源绑定已经完成的证据。监听前使用同一注册校验,冲突以诊断返回。系统和声明清单均去重并稳定排序。
页头资源保留现有五列 View:组件只安放 `_type=document_head` 的具型值,原生渲染在离线和真实页面中收集到 head,不在正文或片段中渲染占位。它只有 meta 与 links 两个领域字段,不接受任意页面属性、HTML 壳或应用配置。元数据沿用 key/value 表与原生 SEO 行为,链接复用普通 Document 的资源表及双语字段。相同链接按完整定义去重,同名元数据冲突在启动前报错。元数据按键稳定输出,保证同一结构的预览与服务一致。URL 只允许站内绝对路径与 http(s),不读取或下载地址。charset、viewport、csrf-token 属于运行时,作者不能重声明。对应手册为 ext/web/head.mq.md 与 ext/web/页头.mq.md。
+22 -4
View File
@@ -1,6 +1,6 @@
---
markup: occlusion
title: 库开发指南:源码即手册,手册即 SKILL,函数即工具
title: Marqdo 编程规范:源码即手册,手册即 SKILL,函数即工具
description: 标准库与拓展库的叙述式开发规范,包含可以直接调用的真实示例。
import:
文件: lib/文件.mq.md
@@ -8,7 +8,7 @@ import:
库开发指南:让说明、调用和实现长在同一份源码里。
本文件供人和 AI 开发标准库、拓展库时直接阅读。目标是把库文件交给一个没有读过
本文件供人和 AI 编写 Marqdo 程序、标准库、拓展库以及可执行 SKILL 时直接阅读。目标是把库文件交给一个没有读过
完整语法手册的模型,它仍能判断何时使用、提供哪些输入、如何调用、如何消费结果,
以及遇到失败时怎么办。完成这些任务所需的信息必须在库文件中,不依赖聊天历史、
隐藏提示词、另一份签名清单或模型猜测。修改实现所需的最少标记也在本文就地示范。
@@ -65,6 +65,10 @@ ext/sample/
二、标题下面立即交代参数与返回。
普通网页正文、内容叶子与静态文档可以继续使用内容标题;它们没有调用契约,不能为了
满足函数格式而插入虚假的参数或返回值表。需要执行任务的 SKILL 应把操作写入 mq.md,
SKILL.md 只保留发现入口、适用范围和必要约束,避免两份独立维护的长命令清单。
每个真正可调用的函数使用函数标题。紧接标题先写参数表,再写返回表;没有参数时直接
放返回表。表格必须位于第一条执行语句之前。正文中的普通小节使用说明段和分隔线,
不要把“安装说明”“注意事项”等叙述标题误做成空函数。
@@ -142,6 +146,13 @@ ext/sample/
调用产生的值先计算并命名,再在单元格中引用,不能假定表格里任意一段函数文本会执行。
普通值用列表和记录传递;读取集合使用 access,不能把描述标签误当作集合键。
命令参数也作为数据写入表格:`"-p"`、`"--offline"` 等文本必须带引号;
裸写 `-p` 会被当成表达式而不是命令选项。已计算的路径使用反引号引用变量,
不要再拼接整段 shell 源码。需要同时被 call 与 View 使用的过程用普通函数标题,
例如 `## main`;`# main` 是对象入口,不能假定两者具有相同的调用语义。
整数除法会保留整数语义;计算平均值优先使用统计库的 mean,或明确采用浮点输入,
并在非整除样例中验证结果,避免演示数据恰好整除掩盖精度问题。
不可变更新要保存返回的新值。少量动态键用表库的具名助手;解析与序列化才使用 JSON。
不要用长串 json.set/json.append 来拼原本一张表就能读懂的数据,也不要为每个数字或
单个字段创建层层转发的空壳函数。只有当一段逻辑需要解释、复用或独立验证时才提取职责。
@@ -159,6 +170,13 @@ ext/sample/
六、把运行边界和工程验收写在开发者找得到的位置。
实际开发也使用这些能力:读取、搜索、撰写和原子修订通过固有文件库完成;JSON、表格、
散列和网络读取优先组合标准库。不要为已有能力再生成 Python 或 shell 程序。缺少能力时,
把可复用的边界补成拓展插件,或者通过明确参数数组外联已有工具;决策、条件和重试仍在
mq.md 中表达。开发与发版入口分别位于 skills/marqdo-dev 和 skills/marqdo-release,操作用
marqdo call 执行。大段源码通过 --args-json 文件或标准输入传输,保留换行、引号和字面数据。
外部自动化可以加 --require-ok,让失败 Result 产生非零退出码,避免继续执行依赖步骤。
有副作用的能力写明授权、根目录、平台、超时、资源上限以及重试与清理责任。
返回可恢复结果时先检查其中的 ok,再读取 value 或 error;CLI 外层的 ok 只说明调用
是否完成,不替代函数结果、HTTP 状态或子进程退出码的判断。未知副作用不能声称为纯函数。
@@ -177,8 +195,8 @@ ext/sample/
默认参数、结构化返回以及可恢复读取;修改库时还应运行该库本身相关的回归。
```sh
marqdo check doc/library-development.mq.md --narrative-ratio
cargo test --test stdlib_tasks library_development_guide_examples_match_their_contracts
marqdo call skills/marqdo-dev/index.mq.md check 'path="doc/library-development.mq.md"' --require-ok --effects plugin --fs-root . --json
marqdo call skills/marqdo-dev/index.mq.md test 'targets=["stdlib_tasks"]' 'filter="library_development_guide_examples_match_their_contracts"' --require-ok --effects plugin --fs-root . --json
```
现有能力可直接参考 [文件库](../lib/文件.mq.md)、[表库](../lib/表.mq.md)、
+48
View File
@@ -0,0 +1,48 @@
# Marqdo 2.7.0
本次 full 发布把源码手册落到实际开发与用户站点:文件操作、开发检查、构建与发版阶段可通过 marqdo call 执行;站点以递归组件、普通 Markdown 和明确的原生资源表达页面与行为。
This full release makes executable source handbooks practical for development and user sites. Native file tools and callable development/release tasks replace generated orchestration programs. Recursive View components preserve ordinary Markdown content and explicit runtime resources.
## 亮点 / Highlights
- 开发与发版 SKILL 路由到可执行 .mq.md 手册;文件读取、审阅、摘要校验和写入使用固有标准库。工程插件承担有界进程、私密认证、压缩格式和实际编译器检查边界,流程不依赖 Python 编排。
- Literal JSON file/stdin CLI arguments preserve quotes, newlines and dollar-prefixed text. --require-ok makes a failed Result stop external automation; saved call sessions retain literal argument semantics.
- 中英文网络站点与完整用户站点改为递归 View 布局、Markdown 内容、当前数据查询、表单、真实会话导航与鉴权资源。原有配色、字体、布局、文章详情和管理功能保留。
- Pure document_head resources carry SEO and resource links into the actual head. Request-time query/form/navigation resources preserve the existing five-column View schema, source context and explicit effect boundaries. Prepared-app inspection follows the real registrar without executing handlers.
- 原生 SQLite 初始化按实际站点授权根定位,保留已有业务记录;嵌套 Document 与 Endpoint 使用一致的站点根。修复表单校验重试中的 CSRF、成功跳转以及嵌套片段选择与路由检查。
- The browser bridge supports typed nested list/control records. The maintained browser-app demonstrates duplicate-safe identities, literal text, truthful storage/network feedback, real history and local WebSocket echo with no authored business JavaScript.
- 移除与语言仓库无关的暗恋工程及过时的独立浏览器演示;底层 WASM 冒烟夹具与公共回归保留。维护入口收敛到实际可运行的工程。
## 核心表面与兼容边界 / Core surface and boundaries
核心构造仍为 19 个,没有新增 Markdown 标记。改动集中在已有标记解析、CLI 参数传送、Runtime / Document 资源及工程工具;原生插件仍具有调用用户的操作系统权限,--fs-root 不把外部进程变成沙箱。显式 raw HTML 兼容出口不等同于不可信内容清理。编译检查与叙述比例检查不能单独证明运行或视觉正确。
The core surface remains 19 constructs. Native-only filesystem, process and authenticated service capabilities do not become browser WASM capabilities. Atomic file replacement is not a multi-file transaction, and digest preflight is not a kernel compare-and-swap. Deployment credentials remain in private stores.
## 下载 / Downloads
| 产物 / Asset | 内容 / Contents |
|---|---|
| marqdo-2.7.0-x86_64-pc-windows-msvc.exe | Windows CLI,内嵌标准库 / CLI with embedded standard library |
| marqdo-2.7.0-x86_64-pc-windows-msvc.zip | Windows CLI、标准库、拓展源码与原生插件 / complete Windows bundle |
| marqdo-2.7.0-x86_64-unknown-linux-gnu.zip | Linux CLI、标准库、拓展源码与原生插件 / complete Linux bundle |
| marqdo-2.7.0-stdlib.zip | 可读标准库源码 / readable standard-library sources |
| marqdo-2.7.0-ext.zip | 官方拓展库源码 / official extension sources |
| marqdo-2.7.0-native-x86_64-pc-windows-msvc.zip | Windows web、agent、quantum、linalg、llm、engineering 插件 |
| marqdo-2.7.0-native-x86_64-unknown-linux-gnu.zip | Linux web、agent、quantum、linalg、llm、engineering 插件 |
| marqdo-2.7.0-source.zip | 本标签的源码快照 / tagged source snapshot |
| marqdo-2.7.0.vsix | VS Code / Cursor 扩展,源码独立分支 / separate editor-source branch |
| marqdo-2.7.0-public.zip | 由实际 .mq.md 导出的静态用户站点 / exported public documentation |
## 安装与使用 / Installation and use
下载对应平台的完整 ZIP,解压后使用其中的 CLI 与 lib/ext。已有 CLI 可通过 marqdo ext add 安装官方拓展;具体调用从标准库单文件或拓展库 index.mq.md 的参数与返回表开始。Linux 用户也可使用项目现有 Ubuntu noble PPA 安装路径;实际 apt 可用性以发布验证结果为准。
Download and unpack the matching platform bundle. Start from each standard-library source or extension index.mq.md. Development tools live in skills/marqdo-dev/index.mq.md; release tasks live in skills/marqdo-release/index.mq.md. A callable task preserves actual failures and grants only its declared effects. See README for the maintained install routes.
## 验证 / Validation
本地全量 Rust 验收为 1031 通过、0 失败、2 个原有模型实验忽略项;Go 网络插件完整测试通过。清理后重跑的 21 项 CLI/发版/WASM 测试以及 7 项真实浏览器用例通过,实际用户文档成功导出 102 页。源码审查单独检查标题下契约与超过一半的叙述;普通测试、人工夹具和历史兼容样例保留既有用途。
Windows and Linux release builds run in CI for this exact source tag. Final release verification separately checks those jobs, all artifact contents and hashes, GitHub/R2 byte parity and VERSION ordering, and Ubuntu source/build/apt publication. A local Linux test is not evidence of Windows execution or completed package publication. Public documentation export is packaged here; gh-pages deployment is separate.
+4 -1
View File
@@ -1,5 +1,8 @@
# 路线图:浏览器 Marqdo 路线 F(进阶宿主能力)
> 2.7.0 维护说明:独立的 browser-hello 与 browser-media 演示已删除。下文保留既有能力设计与宿主边界,当前可运行工程使用 browser-app;底层计数器冒烟夹具位于 tests/wasm/counter.mq.md。Canvas、音频等仍是 lib/browser 的宿主能力,不宣称当前 browser-app 演示包含这些交互。
| | |
|---|---|
| 状态 | **Completed**(F1–F5;F6 Service Worker 可选未做) |
@@ -23,4 +26,4 @@
| **F5** | drag/drop wire + `data-drag` / `drop_text` | **done** |
| **F6** | Service Worker / 离线缓存 | optional / skipped |
示例:[examples/browser-media/](../../examples/browser-media/) · 助手:`lib/browser.mq.md`。
示例:[examples/browser-app/](../../examples/browser-app/) · 助手:`lib/browser.mq.md`。
+4 -1
View File
@@ -1,5 +1,8 @@
# 路线图:浏览器 Marqdo(WASM)
> 2.7.0 维护说明:独立的 browser-hello 与 browser-media 演示已删除。下文保留既有能力设计与宿主边界,当前可运行工程使用 browser-app;底层计数器冒烟夹具位于 tests/wasm/counter.mq.md。Canvas、音频等仍是 lib/browser 的宿主能力,不宣称当前 browser-app 演示包含这些交互。
| | |
|---|---|
| 状态 | **Completed**(路线 C 首版功能完备;续作见 [browser-wasm-d.md](browser-wasm-d.md)) |
@@ -23,7 +26,7 @@
| ABI crate | `crates/marqdo-wasm` |
| 官方 bridge | `crates/marqdo-wasm/js/marqdo-bridge.js` |
| CLI | `marqdo wasm build -o DIR` |
| 示例 | `examples/browser-hello/` |
| 示例 | `examples/browser-app/` |
| 冒烟 | `tests/wasm/smoke.mjs` · `tests/wasm_smoke.rs` |
| L1 | `web.client_embed` / `网页.客户端挂载` |