From 687c168014a7cba20eaab66ac751cc039a7fc1f5 Mon Sep 17 00:00:00 2001 From: cflmy Date: Fri, 23 Oct 2026 19:33:58 +0800 Subject: [PATCH] feat(parse): use nested YAML import: maps instead of one-liner binds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Frontmatter imports are now valid YAML (`import:` / `导入:` with bind→target entries), removing spaced keys. Add `marqdo migrate imports`, hard-error the old one-liner form, and migrate lib/ext/examples/tests/docs accordingly. Co-authored-by: Cursor --- .cursor/skills/marqdo-dev/SKILL.md | 4 +- .cursor/skills/marqdo/SKILL.md | 10 +- .cursor/skills/marqdo/examples.md | 36 ++- .cursor/skills/marqdo/reference.md | 6 +- doc/design/binding.md | 3 +- doc/design/browser-marqdo-wasm.md | 3 +- doc/design/dependencies.md | 2 +- doc/design/executable-knowledge-system.md | 3 +- doc/design/ext-abi.md | 3 +- doc/design/ext-agent-plan.md | 11 +- doc/design/ext-agent.md | 9 +- doc/design/ext-linalg-formula-doc.md | 3 +- doc/design/ext-linalg.md | 5 +- doc/design/ext-llm.md | 3 +- doc/design/ext-quantum.md | 6 +- doc/design/ext-web-artifact.md | 8 +- doc/design/ext-web-drivers.md | 3 +- doc/design/ext-web.md | 30 +- doc/design/link-syntax.md | 3 +- doc/design/module-namespace.md | 67 ++-- doc/design/stdlib-i18n.md | 6 +- doc/design/stdlib-table.md | 3 +- doc/design/stdlib.md | 5 +- doc/tutorial/10-对象与方法.md | 3 +- doc/tutorial/11-模块与导入.md | 26 +- doc/tutorial/12-标准库.md | 15 +- doc/tutorial/14-网络与Web扩展.md | 17 +- doc/tutorial/15-常见陷阱.md | 6 +- examples/agent-okf-flywheel/index.mq.md | 13 +- examples/agent-pong/index.mq.md | 13 +- examples/agent-sandbox-okf/index.mq.md | 5 +- examples/anlian-mq/components/feed.mq.md | 5 +- examples/anlian-mq/components/fragments.mq.md | 7 +- examples/anlian-mq/components/home_body.mq.md | 9 +- examples/anlian-mq/components/page.mq.md | 5 +- examples/anlian-mq/db/index.mq.md | 7 +- examples/anlian-mq/index.mq.md | 19 +- examples/anlian-mq/offline-smoke.mq.md | 13 +- examples/anlian-mq/styles/shell.mq.md | 5 +- examples/browser-app/app.mq.md | 7 +- examples/browser-hello/counter.mq.md | 3 +- examples/browser-hello/fetch.mq.md | 3 +- examples/browser-hello/form.mq.md | 5 +- examples/browser-hello/marqdo-bridge.js | 182 +++++++---- examples/browser-media/media.mq.md | 5 +- .../capabilities/order-pricing.mq.md | 5 +- .../docs/invoice-answer.mq.md | 3 +- examples/knowledge-layers/libai.mq.md | 3 +- examples/knowledge-layers/main.compat.mq.md | 3 +- examples/linalg-least-squares/index.mq.md | 5 +- examples/linalg-svd/index.mq.md | 3 +- examples/linalg-transpose/index.mq.md | 3 +- examples/link-syntax/main.compat.mq.md | 3 +- examples/marqdo-blog/db/posts.mq.md | 3 +- examples/marqdo-blog/index.mq.md | 3 +- examples/marqdo-blog/serve.mq.md | 5 +- examples/marqdo-blog/styles/theme.mq.md | 5 +- examples/oa2026-showcase/bell.mq.md | 3 +- examples/oa2026-showcase/calculus.mq.md | 3 +- examples/oa2026-showcase/foreign-node.mq.md | 3 +- examples/quantum-bell/index.mq.md | 7 +- examples/quantum-entanglement/index.mq.md | 5 +- examples/quantum-ghz/index.mq.md | 3 +- examples/syntax-tour/index.mq.md | 3 +- examples/web-client-site/index.mq.md | 3 +- examples/web-client-site/serve.mq.md | 3 +- examples/web-client-site/static/client.mq.md | 5 +- examples/web-collab-doc/index.mq.md | 3 +- examples/web-collab-doc/static/client.mq.md | 7 +- examples/web-net-site-zh/db/index.mq.md | 5 +- examples/web-net-site-zh/index.mq.md | 19 +- examples/web-net-site/db/index.mq.md | 5 +- examples/web-net-site/index.mq.md | 19 +- examples/web-site-zh/db/index.mq.md | 5 +- examples/web-site-zh/index.mq.md | 17 +- examples/web-site-zh/styles/shell.mq.md | 5 +- examples/web-site/db/index.mq.md | 7 +- examples/web-site/index.mq.md | 17 +- examples/web-site/styles/shell.mq.md | 5 +- examples/web-spa-app/index.mq.md | 3 +- examples/web-spa-app/static/client.mq.md | 7 +- examples/web-tenant-saas/index.mq.md | 3 +- examples/web-ws-room/index.mq.md | 3 +- ext/ai/agent.mq.md | 25 +- ext/ai/llm.mq.md | 13 +- ext/ai/llm/ollama.mq.md | 5 +- ext/ai/llm/openai.mq.md | 11 +- ext/ai/sandbox.mq.md | 9 +- ext/ai/大模型.mq.md | 11 +- ext/ai/智能体.mq.md | 19 +- ext/ai/沙盒.mq.md | 3 +- ext/data/cache.mq.md | 7 +- ext/data/db.mq.md | 7 +- ext/data/form.mq.md | 7 +- ext/data/storage.mq.md | 7 +- ext/linalg/linalg.mq.md | 5 +- ext/linalg/线性代数.mq.md | 5 +- ext/net/http.mq.md | 5 +- ext/net/url.mq.md | 3 +- ext/net/websocket.mq.md | 7 +- ext/quantum/quantum.mq.md | 7 +- ext/quantum/量子.mq.md | 7 +- ext/security/auth.mq.md | 7 +- ext/security/oidc.mq.md | 5 +- ext/security/rbac.mq.md | 7 +- ext/web/_capability.mq.md | 5 +- ext/web/client.mq.md | 5 +- ext/web/component.mq.md | 3 +- ext/web/dom.mq.md | 5 +- ext/web/page.mq.md | 5 +- ext/web/route.mq.md | 5 +- ext/web/web.mq.md | 13 +- ext/web/网页.mq.md | 3 +- lib/browser.mq.md | 3 +- lib/foreign.mq.md | 3 +- lib/外联.mq.md | 3 +- lib/浏览器.mq.md | 3 +- man-test/ext/agent-plan.mq.md | 9 +- man-test/lib/math.mq.md | 3 +- man-test/lib/writeback.mq.md | 3 +- public/00-welcome.mq.md | 5 +- public/00-欢迎.mq.md | 5 +- public/features/06-quantum.mq.md | 3 +- public/features/06-量子.mq.md | 3 +- public/features/07-linalg.mq.md | 3 +- public/features/07-线性代数.mq.md | 3 +- public/features/08-re-encoding.mq.md | 5 +- public/features/08-正则编解码.mq.md | 5 +- public/features/09-path-fs.mq.md | 5 +- public/features/09-路径文件.mq.md | 5 +- public/features/10-hash-secrets.mq.md | 5 +- public/features/10-哈希机密.mq.md | 5 +- public/features/11-csv-text.mq.md | 5 +- public/features/11-逗号表文本.mq.md | 5 +- public/features/12-list-cli.mq.md | 7 +- public/features/12-列表命令行.mq.md | 7 +- public/features/13-log-uuid.mq.md | 5 +- public/features/13-日志标识.mq.md | 5 +- public/features/14-datetime-url.mq.md | 5 +- public/features/14-日期时间地址.mq.md | 5 +- public/features/15-toml-html-encoding.mq.md | 7 +- public/features/15-配置表超文本编码.mq.md | 7 +- public/features/16-fs-mid2.mq.md | 3 +- public/features/16-文件mid2.mq.md | 3 +- public/features/17-stats-log.mq.md | 5 +- public/features/17-统计日志.mq.md | 5 +- public/features/19-foreign-view-cells.mq.md | 3 +- public/features/19-外联视图单元.mq.md | 3 +- public/features/21-persistence.mq.md | 5 +- public/features/21-持久化.mq.md | 5 +- public/stdlib/foreign.mq.md | 3 +- public/stdlib/fs.mq.md | 3 +- public/stdlib/json.mq.md | 3 +- public/stdlib/math.mq.md | 3 +- public/stdlib/net.mq.md | 3 +- public/stdlib/plugin.mq.md | 3 +- public/stdlib/subtask.mq.md | 3 +- public/stdlib/sys.mq.md | 3 +- public/stdlib/table.mq.md | 3 +- public/stdlib/text.mq.md | 3 +- public/stdlib/time.mq.md | 3 +- public/stdlib/writeback.mq.md | 3 +- public/stdlib/外联.mq.md | 3 +- public/stdlib/子任务.mq.md | 3 +- public/stdlib/插件.mq.md | 3 +- public/stdlib/数学.mq.md | 3 +- public/stdlib/文件.mq.md | 3 +- public/stdlib/文本.mq.md | 3 +- public/stdlib/时间.mq.md | 3 +- public/stdlib/系统.mq.md | 3 +- public/stdlib/网络.mq.md | 3 +- public/stdlib/自写回.mq.md | 3 +- public/stdlib/表.mq.md | 3 +- public/structure/import/main.mq.md | 7 +- public/structure/import/主.mq.md | 3 +- skills/marqdo/SKILL.md | 22 +- skills/marqdo/examples.md | 18 +- skills/marqdo/reference.md | 6 +- src/ast.rs | 4 +- src/browser_session.rs | 3 +- src/catalog.rs | 26 +- src/host/foreign_doc.rs | 18 +- src/host/fs.rs | 7 +- src/knowledge/extract.rs | 26 +- src/label.rs | 11 +- src/main.rs | 79 +++++ src/migrate.rs | 188 ++++++++++- src/parse/mod.rs | 306 +++++++++++++----- src/view/render.rs | 2 +- tests/blind/docs-bundle.md | 10 +- tests/errors/legacy-oneliner-import.mq.md | 8 + tests/errors/ns-instance-method.mq.md | 3 +- tests/ext/agent-constitution-b0.mq.md | 11 +- tests/ext/agent-context-budget-a3.mq.md | 11 +- tests/ext/agent-dump-context.mq.md | 11 +- tests/ext/agent-inspect-fixture.mq.md | 7 +- tests/ext/agent-kb-alias.mq.md | 11 +- tests/ext/agent-kb-near.mq.md | 11 +- tests/ext/agent-kb-plan-hit.mq.md | 13 +- tests/ext/agent-kb-reuse.mq.md | 13 +- tests/ext/agent-lib-call.mq.md | 9 +- tests/ext/agent-llm-transport-soft.mq.md | 11 +- tests/ext/agent-mcp-client.mq.md | 9 +- tests/ext/agent-mcp-server-smoke.mq.md | 9 +- tests/ext/agent-p4-route.mq.md | 9 +- tests/ext/agent-plan-confirm.mq.md | 9 +- tests/ext/agent-plan-decision.mq.md | 9 +- tests/ext/agent-plan-live.mq.md | 9 +- tests/ext/agent-plan-observe.mq.md | 7 +- tests/ext/agent-plan-preserve.mq.md | 15 +- tests/ext/agent-plan-stream-offline.mq.md | 9 +- tests/ext/agent-resume.mq.md | 11 +- tests/ext/agent-run-cold-efi.mq.md | 13 +- tests/ext/agent-run-live.mq.md | 11 +- tests/ext/agent-sandbox-optin.mq.md | 7 +- tests/ext/agent-sandbox-promote.mq.md | 7 +- tests/ext/agent-sandbox-quarantine.mq.md | 7 +- tests/ext/agent-small-llm-route.mq.md | 7 +- tests/ext/agent-smoke.mq.md | 7 +- tests/ext/agent-soft-match.mq.md | 5 +- tests/ext/agent-step-route.mq.md | 3 +- tests/ext/agent-tools-rag-a4.mq.md | 11 +- tests/ext/agent-v2-learn.mq.md | 11 +- tests/ext/agent-workbook-patch-a0.mq.md | 11 +- tests/ext/agent-writeback-shadow.mq.md | 9 +- tests/ext/agent-zero-llm.mq.md | 13 +- tests/ext/eng-preflight.mq.md | 7 +- tests/ext/fs-text-patch.mq.md | 5 +- tests/ext/linalg-basic-smoke.mq.md | 5 +- tests/ext/linalg-block-kron.mq.md | 3 +- tests/ext/linalg-doc-smoke.mq.md | 3 +- tests/ext/linalg-factor-smoke.mq.md | 5 +- tests/ext/linalg-formula-smoke.mq.md | 3 +- tests/ext/linalg-infix-smoke.mq.md | 3 +- tests/ext/linalg-metrics-smoke.mq.md | 7 +- tests/ext/linalg-zh-smoke.mq.md | 3 +- tests/ext/llm-ask-offline.mq.md | 5 +- tests/ext/llm-complete.mq.md | 3 +- tests/ext/llm-ctor-offline.mq.md | 3 +- tests/ext/llm-entry-prompt-offline.mq.md | 5 +- tests/ext/llm-import.mq.md | 3 +- tests/ext/llm-meta-offline.mq.md | 3 +- tests/ext/llm-named-offline.mq.md | 5 +- tests/ext/llm-stream-live.mq.md | 5 +- tests/ext/llm-stream-offline.mq.md | 5 +- tests/ext/llm-tool-calls-offline.mq.md | 5 +- tests/ext/quantum-amp-damp-smoke.mq.md | 3 +- tests/ext/quantum-amp-damp-zh-smoke.mq.md | 3 +- tests/ext/quantum-author-api-smoke.mq.md | 3 +- tests/ext/quantum-author-api-zh-smoke.mq.md | 3 +- tests/ext/quantum-bell-smoke.mq.md | 5 +- tests/ext/quantum-custom-gate-smoke.mq.md | 5 +- tests/ext/quantum-custom-gate-zh-smoke.mq.md | 5 +- tests/ext/quantum-draw-smoke.mq.md | 3 +- tests/ext/quantum-gate-heatmap-smoke.mq.md | 3 +- tests/ext/quantum-gate-matrix-smoke.mq.md | 5 +- tests/ext/quantum-gates-smoke.mq.md | 5 +- tests/ext/quantum-linalg-smoke.mq.md | 5 +- tests/ext/quantum-noise-smoke.mq.md | 3 +- tests/ext/quantum-noise-zh-smoke.mq.md | 3 +- tests/ext/quantum-steps-smoke.mq.md | 5 +- tests/ext/quantum-viz-advanced-smoke.mq.md | 3 +- tests/ext/quantum-zh-smoke.mq.md | 5 +- tests/ext/sandbox-cow.mq.md | 5 +- tests/ext/sandbox-deny.mq.md | 3 +- tests/ext/sandbox-fixtures/guest-json.mq.md | 3 +- tests/ext/sandbox-fixtures/guest-plugin.mq.md | 3 +- tests/ext/sandbox-run-lib.mq.md | 3 +- tests/ext/web-artifact-render-smoke.mq.md | 5 +- tests/ext/web-artifact-site/serve.mq.md | 3 +- tests/ext/web-cache-artifact-smoke.mq.md | 3 +- tests/ext/web-data-db-smoke.mq.md | 5 +- tests/ext/web-rbac-artifact-smoke.mq.md | 3 +- tests/ext/web-static-artifact-smoke.mq.md | 3 +- tests/ext/web-use-smoke.mq.md | 3 +- tests/gold.rs | 13 +- tests/lib/cli-sort-smoke.mq.md | 7 +- tests/lib/csv-smoke.mq.md | 3 +- tests/lib/datetime-smoke.mq.md | 3 +- tests/lib/encoding-smoke.mq.md | 3 +- tests/lib/foreign-call.mq.md | 3 +- tests/lib/foreign-config.mq.md | 3 +- tests/lib/foreign-env-timeout.mq.md | 3 +- tests/lib/foreign-invoke.mq.md | 3 +- tests/lib/foreign-json.mq.md | 3 +- tests/lib/foreign-probe-register.mq.md | 3 +- tests/lib/foreign-python.mq.md | 3 +- tests/lib/foreign-run-lang.mq.md | 3 +- tests/lib/foreign-session-python.mq.md | 3 +- tests/lib/foreign-session-timeout.mq.md | 3 +- tests/lib/foreign-session.mq.md | 3 +- tests/lib/fs-copy-move.mq.md | 3 +- tests/lib/fs-mid2-smoke.mq.md | 3 +- tests/lib/fs-read.mq.md | 3 +- tests/lib/hash-smoke.mq.md | 3 +- tests/lib/json-quote.mq.md | 3 +- tests/lib/json-roundtrip.mq.md | 5 +- tests/lib/log-uuid-smoke.mq.md | 7 +- tests/lib/math-formula-chain.mq.md | 3 +- tests/lib/math-formula.mq.md | 3 +- tests/lib/math-plot.mq.md | 3 +- tests/lib/math-random.mq.md | 3 +- tests/lib/net-cookie.mq.md | 3 +- tests/lib/net-encode.mq.md | 3 +- tests/lib/net-markdown.mq.md | 3 +- tests/lib/net-multipart.mq.md | 3 +- tests/lib/net-openai-sse-reasoning.mq.md | 5 +- tests/lib/net-openai-sse.mq.md | 5 +- tests/lib/path-smoke.mq.md | 3 +- tests/lib/plugin-demo.mq.md | 5 +- tests/lib/re-smoke.mq.md | 3 +- tests/lib/secrets-smoke.mq.md | 3 +- tests/lib/stats-log-smoke.mq.md | 5 +- tests/lib/subtask-fn.mq.md | 5 +- tests/lib/subtask-foreign.mq.md | 3 +- tests/lib/subtask-quiet-io.mq.md | 5 +- tests/lib/subtask-spawn.mq.md | 5 +- tests/lib/sys-cwd.mq.md | 3 +- tests/lib/sys-dotenv.mq.md | 5 +- tests/lib/sys-exec-capture.mq.md | 5 +- tests/lib/table-collections.mq.md | 3 +- tests/lib/table-list-mid.mq.md | 3 +- tests/lib/text-mid-smoke.mq.md | 3 +- tests/lib/time-format.mq.md | 3 +- tests/lib/toml-html-encoding-smoke.mq.md | 7 +- tests/lib/url-smoke.mq.md | 3 +- tests/lib/writeback-async.mq.md | 7 +- tests/lib/writeback-get.mq.md | 3 +- tests/lib/哈希-烟测.mq.md | 3 +- tests/lib/地址-烟测.mq.md | 3 +- tests/lib/外联-python.mq.md | 3 +- tests/lib/数学-数值.mq.md | 3 +- tests/lib/文件-mid2-烟测.mq.md | 3 +- tests/lib/文件-复制.mq.md | 3 +- tests/lib/文件-读.mq.md | 3 +- tests/lib/文本-加厚-烟测.mq.md | 3 +- tests/lib/日志-标识-烟测.mq.md | 5 +- tests/lib/日期时间-烟测.mq.md | 3 +- tests/lib/机密-烟测.mq.md | 3 +- tests/lib/正则-烟测.mq.md | 3 +- tests/lib/统计-日志-烟测.mq.md | 5 +- tests/lib/编码-烟测.mq.md | 3 +- tests/lib/表-命令行-烟测.mq.md | 5 +- tests/lib/表-集合.mq.md | 3 +- tests/lib/路径-烟测.mq.md | 3 +- tests/lib/逗号表-烟测.mq.md | 3 +- tests/lib/配置表-超文本-编码-烟测.mq.md | 7 +- tests/markup-v03/formula-meta-var.mq.md | 3 +- tests/migrate.rs | 2 +- tests/notebook/no-foreign.mq.md | 3 +- tests/notebook/python-insights.mq.md | 3 +- tests/notebook/shared.mq.md | 3 +- tests/occlusion.rs | 2 +- tests/occlusion/access-and-loop.mq.md | 3 +- tests/occlusion/classic-index.mq.md | 3 +- tests/structure/gap-star-json-body.mq.md | 3 +- tests/structure/import-lib.mq.md | 5 +- tests/structure/import/main.mq.md | 3 +- tests/structure/inherit-explicit-super.mq.md | 3 +- tests/structure/inherit-parent-method.mq.md | 3 +- tests/structure/meta-binding.mq.md | 3 +- tests/structure/ns/path3.mq.md | 3 +- tests/structure/ns/use.mq.md | 5 +- tests/structure/object-handle.mq.md | 3 +- 364 files changed, 1870 insertions(+), 1004 deletions(-) create mode 100644 tests/errors/legacy-oneliner-import.mq.md diff --git a/.cursor/skills/marqdo-dev/SKILL.md b/.cursor/skills/marqdo-dev/SKILL.md index e71e07e..542cd43 100644 --- a/.cursor/skills/marqdo-dev/SKILL.md +++ b/.cursor/skills/marqdo-dev/SKILL.md @@ -144,7 +144,7 @@ Matching surrounding **legacy** `json.set` in `ext/ai/*.mq.md` is **not** compli 7. **Do not use `##` inside `# main` for document sectioning** — those become nested functions. Use paragraphs / `---` breaks instead. 8. **Index:** prefer `[键](集合)` / `` [`名`](集合) `` over footnote `` m[^k] ``. -Browser client programs: prefer `import browser:lib/browser.mq.md` (no native plugin). Server sites: Artifact Metadata (`type: web|endpoint`) + `ext/web` facade + `ext/data` / `ext/security` / `ext/net` — see [ext-web-artifact.md](../../doc/design/ext-web-artifact.md). **Never** restore `compose_*` / `app.configure`. +Browser client programs: prefer nested `import:` with `browser: lib/browser.mq.md` (no native plugin). Server sites: Artifact Metadata (`type: web|endpoint`) + `ext/web` facade + `ext/data` / `ext/security` / `ext/net` — see [ext-web-artifact.md](../../doc/design/ext-web-artifact.md). **Never** restore `compose_*` / `app.configure`. ## Developing libraries (`lib/*`, `ext/*`) @@ -186,7 +186,7 @@ When editing a file full of `json.set`: 1. Turn static structures into GFM tables. 2. Replace repeated effect shapes with `browser.*` / `web.text_patch` / `web.dom_patch`. 3. Leave at most sparse `table.put` for dynamic keys. -4. Drop `import json:…` if unused. +4. Drop unused `json:` (or other) entries under nested `import:`. ## Anti-patterns diff --git a/.cursor/skills/marqdo/SKILL.md b/.cursor/skills/marqdo/SKILL.md index 6eafb66..77843c8 100644 --- a/.cursor/skills/marqdo/SKILL.md +++ b/.cursor/skills/marqdo/SKILL.md @@ -49,8 +49,7 @@ Canonical design (repo): `doc/design/markdown-mapping.md`, `doc/design/keywords. | Line `N. *` | Else arm | | `> fn args` | Call (named `k=v` or positional) | | `` > `obj`.method args `` | Method call (`obj` must be a map with `_type`) | -| Frontmatter `import bind:path.mq.md` / `导入` | Import file (bind library name) | -| Frontmatter `import bind:lib.member` / `导入` | Short name for a library member (same keyword; no separate `use`) | +| Frontmatter nested `import:` / `导入:` map | Import file (`bind: path.mq.md`) or short name (`bind: lib.member`) | | `> lib.member …` / `> lib.Type.member …` | Call via bare dotted path (instance methods need `` `var`.m ``) | | `*…*` | Statement (bind / expr) — closing `*` touches last token, **no trailing space**; bare ids are variables | | `**…**` | Return value — closing `**` touches last token, **no trailing space**; bare ids are variables | @@ -136,13 +135,14 @@ Chinese builtins (same functions, no import): ## Frontmatter imports + stdlib -Imports use `import bind:target` (`导入` equivalent): file (`.mq.md`) or short name (`lib.member`). Members are **not** flattened into the caller. Call with a bare dotted path: +Imports use nested YAML `import:` (`导入:` equivalent): file (`.mq.md`) or short name (`lib.member`). Members are **not** flattened into the caller. Call with a bare dotted path: ```markdown --- title: example -import text:lib/text.mq.md -import clock:lib/time.mq.md +import: + text: lib/text.mq.md + clock: lib/time.mq.md --- # main diff --git a/.cursor/skills/marqdo/examples.md b/.cursor/skills/marqdo/examples.md index 880814a..4e7d753 100644 --- a/.cursor/skills/marqdo/examples.md +++ b/.cursor/skills/marqdo/examples.md @@ -141,7 +141,8 @@ Row-oriented records (SQL-like): first header `@` / `行` / `row` → list of ma ```markdown --- -import browser:lib/browser.mq.md +import: + browser: lib/browser.mq.md --- # main @@ -168,7 +169,8 @@ Return and soft-error packs are **tables**, not `json.set` pipelines. Full style ```markdown --- -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- ## step_ok @@ -217,7 +219,8 @@ Do **not** mirror legacy `ext/ai/agent.mq.md` `json.parse`+`json.set` chains whe ```markdown --- title: split demo -import text:lib/text.mq.md +import: + text: lib/text.mq.md --- # main @@ -230,8 +233,9 @@ import text:lib/text.mq.md ```markdown --- -import re:lib/re.mq.md -import enc:lib/encoding.mq.md +import: + re: lib/re.mq.md + enc: lib/encoding.mq.md --- # main @@ -246,8 +250,9 @@ import enc:lib/encoding.mq.md ```markdown --- -import log:lib/log.mq.md -import uuid:lib/uuid.mq.md +import: + log: lib/log.mq.md + uuid: lib/uuid.mq.md --- # main @@ -278,7 +283,8 @@ After a blank line, code runs: ```markdown --- description: loads math -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main @@ -326,7 +332,8 @@ See `tests/structure/object-handle.mq.md` and `ext/ai/llm.mq.md`: `# Type` const ```markdown --- -import agent:ext/agent.mq.md +import: + agent: ext/agent.mq.md --- # main @@ -378,8 +385,9 @@ if x > 0: ```markdown --- title: hello-site -import web:ext/web/web.mq.md -import db:db/index.mq.md +import: + web: ext/web/web.mq.md + db: db/index.mq.md --- # main @@ -416,7 +424,8 @@ import db:db/index.mq.md ```markdown --- -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main @@ -445,7 +454,8 @@ import quantum:ext/quantum/quantum.mq.md ```markdown --- -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # main diff --git a/.cursor/skills/marqdo/reference.md b/.cursor/skills/marqdo/reference.md index 74586cb..9a20a85 100644 --- a/.cursor/skills/marqdo/reference.md +++ b/.cursor/skills/marqdo/reference.md @@ -122,7 +122,8 @@ Examples: `examples/linalg-svd/`, `examples/linalg-least-squares/`. Design: `doc ```markdown --- -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main @@ -141,7 +142,8 @@ Empty RHS assignment + following `$$…$$` binds a formula value. Narrative-only ```markdown --- -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/doc/design/binding.md b/doc/design/binding.md index ae6680a..f21566d 100644 --- a/doc/design/binding.md +++ b/doc/design/binding.md @@ -36,7 +36,8 @@ type: llm model: ${env.OPENAI_MODEL ?? "gpt-4o-mini"} api_key: ${secret.OPENAI_API_KEY!} base_url: ${env.OPENAI_BASE_URL ?? "https://api.openai.com/v1"} -import sys:lib/sys.mq.md +import: + sys: lib/sys.mq.md --- ``` diff --git a/doc/design/browser-marqdo-wasm.md b/doc/design/browser-marqdo-wasm.md index fbbc54f..0f1c39e 100644 --- a/doc/design/browser-marqdo-wasm.md +++ b/doc/design/browser-marqdo-wasm.md @@ -156,7 +156,8 @@ source: &str (+ optional import map) ```markdown --- -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/doc/design/dependencies.md b/doc/design/dependencies.md index 79cdb9e..5330dc6 100644 --- a/doc/design/dependencies.md +++ b/doc/design/dependencies.md @@ -80,7 +80,7 @@ Marqdo 换 **Rust 或 C++** 都不改变「主前端不该是 Flex/Bison」这 | **pulldown-cmark** *或* **comrak** | GFM 事件/AST | 标题、列表、表格、emphasis/strong;Spike 已证明「库 + 行扫描」可行。二选一做 Spike 对比后钉死 | | **thiserror** / **anyhow** | 错误类型 | 诊断与 CLI 报错 | | **clap** | CLI | `marqdo run [path]` | -| **serde** + **serde_yaml** | 元信息 | 仅解析 frontmatter 中的 YAML **键值**;`import x:x.mq.md` 仍按**行**抽取(见 Spike) | +| **serde** + **serde_yaml** | 元信息 | 仅解析 frontmatter 中的 YAML **键值**;嵌套 `import:` 映射与其它 YAML 键一并解析 | | **ureq** (=2.9.7) | HTTP(S) | `lib/net`;为 Cargo 1.81 另钉 `idna_adapter`/`zeroize`(见根 `Cargo.toml`) | | **regex** (=1.13.1) | 正则 | Mid M1 `lib/re`;`default-features=false` + `std`/`unicode`;无回溯引用 | | **sha2** (=0.10.9) / **sha1** (=0.10.6) / **md-5** (=0.10.6) / **hmac** (=0.12.1) | 摘要 | Mid M3 `lib/hash` | diff --git a/doc/design/executable-knowledge-system.md b/doc/design/executable-knowledge-system.md index eb06bb7..6f4aad2 100644 --- a/doc/design/executable-knowledge-system.md +++ b/doc/design/executable-knowledge-system.md @@ -112,7 +112,8 @@ parse/check/catalog 保留整个 `Named`。所以循环不会被误判成“ ```markdown --- id: knowledge.people.li-bai -import li_bai:knowledge/people/li-bai.mq.md +import: + li_bai: knowledge/people/li-bai.mq.md --- # 回答 diff --git a/doc/design/ext-abi.md b/doc/design/ext-abi.md index 0b7c259..ab8c0b5 100644 --- a/doc/design/ext-abi.md +++ b/doc/design/ext-abi.md @@ -61,7 +61,8 @@ Unknown names fail. Queries are only valid during a plugin function call (host s ```markdown --- -import plugin:lib/plugin.mq.md +import: + plugin: lib/plugin.mq.md --- # main diff --git a/doc/design/ext-agent-plan.md b/doc/design/ext-agent-plan.md index e43dd31..db4b13f 100644 --- a/doc/design/ext-agent-plan.md +++ b/doc/design/ext-agent-plan.md @@ -159,11 +159,12 @@ REPLACE ```markdown --- title: agent-run-… -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import writeback:lib/writeback.mq.md -import subtask:lib/subtask.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + writeback: lib/writeback.mq.md + subtask: lib/subtask.mq.md --- # 总目标 diff --git a/doc/design/ext-agent.md b/doc/design/ext-agent.md index 5038246..d3da398 100644 --- a/doc/design/ext-agent.md +++ b/doc/design/ext-agent.md @@ -72,10 +72,11 @@ Marqdo 的宪法是 **代码即文档、文档即知识库**: ```markdown --- -导入 智能体:ext/ai/智能体.mq.md -导入 大模型:ext/ai/大模型.mq.md -导入 自写回:lib/自写回.mq.md -导入 时间:lib/时间.mq.md +导入: + 智能体: ext/ai/智能体.mq.md + 大模型: ext/ai/大模型.mq.md + 自写回: lib/自写回.mq.md + 时间: lib/时间.mq.md --- ## 获取时间 diff --git a/doc/design/ext-linalg-formula-doc.md b/doc/design/ext-linalg-formula-doc.md index 0624f51..61ff3fd 100644 --- a/doc/design/ext-linalg-formula-doc.md +++ b/doc/design/ext-linalg-formula-doc.md @@ -197,7 +197,8 @@ ````markdown --- -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # 转置反序 diff --git a/doc/design/ext-linalg.md b/doc/design/ext-linalg.md index 767e232..dcd557a 100644 --- a/doc/design/ext-linalg.md +++ b/doc/design/ext-linalg.md @@ -201,8 +201,9 @@ $$ ````markdown --- -import la:ext/linalg/linalg.mq.md -import table:lib/table.mq.md +import: + la: ext/linalg/linalg.mq.md + table: lib/table.mq.md --- # main diff --git a/doc/design/ext-llm.md b/doc/design/ext-llm.md index a9f786b..65800ba 100644 --- a/doc/design/ext-llm.md +++ b/doc/design/ext-llm.md @@ -20,7 +20,8 @@ Import: ```markdown --- -import llm:ext/ai/llm.mq.md +import: + llm: ext/ai/llm.mq.md --- ``` diff --git a/doc/design/ext-quantum.md b/doc/design/ext-quantum.md index d5195e6..aba6da1 100644 --- a/doc/design/ext-quantum.md +++ b/doc/design/ext-quantum.md @@ -101,7 +101,8 @@ marqdo ext add quantum ```markdown --- -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- ``` @@ -341,7 +342,8 @@ Q5 教学噪声 + barrier/measure/append/state — 见 [ext-quantum-q5.md](ext- ```markdown --- title: Bell state -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # Bell |Φ+⟩ diff --git a/doc/design/ext-web-artifact.md b/doc/design/ext-web-artifact.md index 6af1311..c4f733b 100644 --- a/doc/design/ext-web-artifact.md +++ b/doc/design/ext-web-artifact.md @@ -62,8 +62,9 @@ route: / method: GET data_source: posts data_order: -created_at -import web:ext/web/web.mq.md -import data:ext/data/db.mq.md +import: + web: ext/web/web.mq.md + data: ext/data/db.mq.md --- # Marqdo @@ -106,7 +107,8 @@ path: /api/posts request: json response: json auth: member -import data:ext/data/db.mq.md +import: + data: ext/data/db.mq.md --- **post = > data.db.insert …** diff --git a/doc/design/ext-web-drivers.md b/doc/design/ext-web-drivers.md index 598adcc..11977d1 100644 --- a/doc/design/ext-web-drivers.md +++ b/doc/design/ext-web-drivers.md @@ -49,7 +49,8 @@ 英文: ```markdown -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md # main diff --git a/doc/design/ext-web.md b/doc/design/ext-web.md index 3e5ae85..8fa70ce 100644 --- a/doc/design/ext-web.md +++ b/doc/design/ext-web.md @@ -128,13 +128,14 @@ myapp/ --- title: web-site description: Home = page table; main may be inline; class methods assemble. -import web:ext/web/web.mq.md -import shell:styles/shell.mq.md -import nav:components/nav.mq.md -import side:components/side.mq.md -import foot:components/foot.mq.md -import articles:db/articles.mq.md -import db:db/index.mq.md +import: + web: ext/web/web.mq.md + shell: styles/shell.mq.md + nav: components/nav.mq.md + side: components/side.mq.md + foot: components/foot.mq.md + articles: db/articles.mq.md + db: db/index.mq.md --- # main @@ -171,13 +172,14 @@ Main content is not a reusable component, so it is authored here. ```markdown --- title: 站点 -导入 网页:ext/web/网页.mq.md -import shell:styles/shell.mq.md -import nav:components/nav.mq.md -import side:components/side.mq.md -import foot:components/foot.mq.md -import articles:db/articles.mq.md -import db:db/index.mq.md +导入: + 网页: ext/web/网页.mq.md + shell: styles/shell.mq.md + nav: components/nav.mq.md + side: components/side.mq.md + foot: components/foot.mq.md + articles: db/articles.mq.md + db: db/index.mq.md --- # main diff --git a/doc/design/link-syntax.md b/doc/design/link-syntax.md index c86a51d..e9fb3dc 100644 --- a/doc/design/link-syntax.md +++ b/doc/design/link-syntax.md @@ -678,7 +678,8 @@ L1 完成后 AI 就能静态查链接;L2/L3 才是执行与呈现。 ```markdown --- markup: occlusion -import libai:libai.mq.md +import: + libai: libai.mq.md --- # main diff --git a/doc/design/module-namespace.md b/doc/design/module-namespace.md index ddb9bc8..ec74cb2 100644 --- a/doc/design/module-namespace.md +++ b/doc/design/module-namespace.md @@ -2,7 +2,7 @@ | | | |---|---| -| 状态 | **Accepted;统一 `import bind:target` 已锁定** | +| 状态 | **Accepted;嵌套 YAML `import:` / `导入:` 映射已锁定** | | 日期 | 2026-08-13 | | 相关 | [stdlib-modules.md](stdlib-modules.md) · [stdlib-i18n.md](stdlib-i18n.md) · [markdown-mapping.md](markdown-mapping.md) · [objects.md](objects.md) · [call-arguments.md](call-arguments.md) · [ext-agent.md](ext-agent.md) | @@ -16,9 +16,9 @@ - `lib/json` 的 `parse` 与 `lib/time` 的 `parse` 不能共存。 - 官方 ext / 多库编排无法按大型语言习惯书写 `time.parse` / `json.parse`。 -- 旧 frontmatter `import path:path.mq.md` 对 Markdown / 编辑器不友好,且与调用标记 `>` 抢外形。 +- 旧 frontmatter 一行式 `import bind:target` 在 YAML 里会变成带空格的键,与正规元信息不兼容。 -**结论**:模块命名空间 + 点号寻址;frontmatter 导入统一为可读的 `import bind:target`。 +**结论**:模块命名空间 + 点号寻址;frontmatter 导入统一为嵌套 YAML 映射 `import:\n bind: target`。 --- @@ -29,8 +29,8 @@ 1. **导入绑定库名**:导入一个 `.mq.md` 得到一个**库(模块)绑定**,成员不倒进全局。 2. **点号寻址调用**:`库.成员`、`库.对象.成员`;`.` 表示定义树寻址。 3. **库名不是变量**:路径段为**裸标识符**,不加反引号。 -4. **短名与文件导入同形**:`import fmt:time.format`,废除独立 `use` 关键字。 -5. **中英对等**:`import` / `导入`。 +4. **短名与文件导入同形**:同在 `import:` 映射下写 `fmt: time.format`,废除独立 `use` 关键字。 +5. **中英对等**:`import:` / `导入:`。 ### 2.2 非目标 @@ -54,27 +54,38 @@ ### 3.2 导入句法(frontmatter) -仍只出现在文件头成对 `---` 内。**调用**仍用 `> print`(不变)。 +仍只出现在文件头成对 `---` 内。**调用**仍用 `> print`(不变)。键为合法 YAML:`import:` / `导入:`,值为嵌套映射。 + +```yaml +--- +import: + utils: utils.mq.md + json: lib/json.mq.md + fmt: time.format +--- +``` | 含义 | 英文 | 中文 | |------|------|------| -| 导入文件 | `import utils:utils.mq.md` | `导入 utils:utils.mq.md` | -| 标准库 | `import json:lib/json.mq.md` | `导入 json:lib/json.mq.md` | -| 短名(成员) | `import fmt:time.format` | `导入 fmt:时间.格式化` | +| 导入文件 | `import:` → `utils: utils.mq.md` | `导入:` → `utils: utils.mq.md` | +| 标准库 | `json: lib/json.mq.md` | 同左(或中文库路径) | +| 短名(成员) | `fmt: time.format` | `fmt: 时间.格式化` | 规则: -- **绑定名必填**,在 `:` 左侧(裸名,无反引号)。 -- `:` 右侧 `target`: +- **绑定名必填**,为映射键(裸名,无反引号);冒号后须有空格(正规 YAML)。 +- 映射值 `target`: - 以 `.mq.md` 结尾 → **文件导入**; - 否则为 **点号路径**(≥2 段),把该成员绑为本地短名(须先有对应文件导入)。 - 同一文件内绑定名不得冲突(文件库名与短名共用命名空间)→ 硬错误。 -- 旧写法 `> ….mq.md`、`> … as …`、`> use …`、`> 使用 …` → **硬错误**,并提示新句法。 +- 同一文件不得同时出现 `import:` 与 `导入:`。 +- 旧写法一行式 `import bind:target`、`> ….mq.md`、`> use …` → **硬错误**;可用 `marqdo migrate imports --write` 迁移。 ### 3.3 废除的旧规则 不再支持: +- 一行式 `import bind:target` / `导入 bind:target`; - 省略绑定名时用文件名茎作库名; - 导入侧 `as` / `作为`; - 独立关键字 `use` / `使用`。 @@ -101,8 +112,9 @@ path_callee ::= ident ('.' ident)+ ```markdown --- -import time:lib/time.mq.md -import json:lib/json.mq.md +import: + time: lib/time.mq.md + json: lib/json.mq.md --- # main @@ -139,8 +151,9 @@ import json:lib/json.mq.md ```markdown --- -import time:lib/time.mq.md -import fmt:time.format +import: + time: lib/time.mq.md + fmt: time.format --- # main @@ -153,10 +166,11 @@ import fmt:time.format ```markdown --- -import time:lib/time.mq.md -import writeback:lib/writeback.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md +import: + time: lib/time.mq.md + writeback: lib/writeback.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md --- # main @@ -179,13 +193,12 @@ import json:lib/json.mq.md | 旧 | 新 | |----|----| -| `import time:lib/time.mq.md` | `import time:lib/time.mq.md` | -| `import t`:lib/time.mq.md | `import t:lib/time.mq.md` | -| `import fmt`:time.format +| `import time:lib/time.mq.md` | `import:` → `time: lib/time.mq.md` | +| `import fmt:time.format` | `import:` → `fmt: time.format` | | 茎名默认库名 | 绑定名始终显式 | | 扁平合并进全局 | 仅库绑定 + 可选短名 | -不提供旧 `>` 导入过渡开关。 +不提供旧一行式 / `>` 导入过渡开关;`marqdo migrate imports --write` 可机械迁移。 --- @@ -201,20 +214,20 @@ import json:lib/json.mq.md ## 8. 实现要点 -1. frontmatter 只解析 `import` / `导入` 行;右侧分流文件 / 成员。 +1. frontmatter 解析嵌套 `import:` / `导入:` 映射;子项分流文件 / 成员。 2. AST 仍用 `Import`(文件)与 `Use`(短名)存储,对外无 `use` 关键字。 3. 金样例:`tests/structure/import/`、`tests/structure/ns/`。 | 阶段 | 内容 | |------|------| | M1+M2 | 点号路径 + 短名 — 已落地 | -| **Import 句法** | 统一 `import bind:target` — **本波次** | +| **Import 句法** | 嵌套 YAML `import:` — **本波次** | --- ## 9. 决议摘要 -1. 导入 = `import bind:target`(`导入` 等价)。 +1. 导入 = 嵌套 `import:` / `导入:` 映射(`bind: target`)。 2. target = `.mq.md` 文件 **或** `库.成员` 点号路径。 3. 调用以裸名点号路径寻址;实例方法用反引号接收者(仅独立 `>` 调用;`*…*`/`**…**` 段内接收者不加反引号)。 4. 裸点号 `a.b`:`a` 为局部变量 → 方法调用,否则 → 库路径(Python 统一命名空间)。 diff --git a/doc/design/stdlib-i18n.md b/doc/design/stdlib-i18n.md index ede1e18..3c664ba 100644 --- a/doc/design/stdlib-i18n.md +++ b/doc/design/stdlib-i18n.md @@ -35,7 +35,8 @@ ```markdown --- -import text:lib/text.mq.md +import: + text: lib/text.mq.md --- # main @@ -44,7 +45,8 @@ import text:lib/text.mq.md ```markdown --- -导入 文本:lib/文本.mq.md +导入: + 文本: lib/文本.mq.md --- # main diff --git a/doc/design/stdlib-table.md b/doc/design/stdlib-table.md index 129ff18..d4be13e 100644 --- a/doc/design/stdlib-table.md +++ b/doc/design/stdlib-table.md @@ -17,7 +17,8 @@ ```markdown --- -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- # main diff --git a/doc/design/stdlib.md b/doc/design/stdlib.md index ba553de..b8157eb 100644 --- a/doc/design/stdlib.md +++ b/doc/design/stdlib.md @@ -51,8 +51,9 @@ Frontmatter 导入**绑定库名**(默认 = 文件名茎;`as` / `作为` 可 ```markdown --- -import text:lib/text.mq.md -import table:lib/table.mq.md +import: + text: lib/text.mq.md + table: lib/table.mq.md --- ``` diff --git a/doc/tutorial/10-对象与方法.md b/doc/tutorial/10-对象与方法.md index 161cd30..659ca91 100644 --- a/doc/tutorial/10-对象与方法.md +++ b/doc/tutorial/10-对象与方法.md @@ -79,7 +79,8 @@ Marqdo 用 `#` 标题定义**对象 / 类型**,用 `##` 定义其下的**方 ```markdown --- -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/doc/tutorial/11-模块与导入.md b/doc/tutorial/11-模块与导入.md index 1488f32..1fd8e84 100644 --- a/doc/tutorial/11-模块与导入.md +++ b/doc/tutorial/11-模块与导入.md @@ -17,8 +17,9 @@ description: 描述文字 ```markdown --- -import text:lib/text.mq.md -import time:lib/time.mq.md +import: + text: lib/text.mq.md + time: lib/time.mq.md --- ``` @@ -35,8 +36,9 @@ import time:lib/time.mq.md ```markdown --- -import time:lib/time.mq.md -import json:lib/json.mq.md +import: + time: lib/time.mq.md + json: lib/json.mq.md --- # main @@ -55,7 +57,8 @@ import json:lib/json.mq.md ```markdown --- -import agent:ext/ai/agent.mq.md +import: + agent: ext/ai/agent.mq.md --- # main @@ -71,8 +74,9 @@ import agent:ext/ai/agent.mq.md ```markdown --- -import time:lib/time.mq.md -import fmt:time.format +import: + time: lib/time.mq.md + fmt: time.format --- # main @@ -98,7 +102,8 @@ import fmt:time.format ```markdown --- -import agent:ext/ai/agent.mq.md +import: + agent: ext/ai/agent.mq.md --- # main @@ -143,8 +148,9 @@ project/ ```markdown --- -import 数学:lib/数学.mq.md -import 问候:lib/问候.mq.md +import: + 数学: lib/数学.mq.md + 问候: lib/问候.mq.md --- # main diff --git a/doc/tutorial/12-标准库.md b/doc/tutorial/12-标准库.md index 1b38bc3..e041d04 100644 --- a/doc/tutorial/12-标准库.md +++ b/doc/tutorial/12-标准库.md @@ -56,7 +56,8 @@ Marqdo 内置函数无需导入即可使用;更丰富的能力通过导入 `li ```markdown --- -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main @@ -85,7 +86,8 @@ import json:lib/json.mq.md ```markdown --- -import text:lib/text.mq.md +import: + text: lib/text.mq.md --- # main @@ -101,7 +103,8 @@ import text:lib/text.mq.md ```markdown --- -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main @@ -114,7 +117,8 @@ import math:lib/math.mq.md ```markdown --- -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main @@ -145,7 +149,8 @@ marqdo ext add quantum ```markdown --- -import llm:ext/llm.mq.md +import: + llm: ext/llm.mq.md --- # main diff --git a/doc/tutorial/14-网络与Web扩展.md b/doc/tutorial/14-网络与Web扩展.md index 9c8588c..c51e8e4 100644 --- a/doc/tutorial/14-网络与Web扩展.md +++ b/doc/tutorial/14-网络与Web扩展.md @@ -29,7 +29,8 @@ marqdo ext add web ```markdown --- -import net:lib/net.mq.md +import: + net: lib/net.mq.md --- # main @@ -84,7 +85,8 @@ route: / method: GET data_source: posts data_order: -created_at -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # 我的站点 @@ -118,8 +120,9 @@ response: json ```markdown --- -import web:ext/web/web.mq.md -import posts:db/posts.mq.md +import: + web: ext/web/web.mq.md + posts: db/posts.mq.md --- # main @@ -145,7 +148,8 @@ import posts:db/posts.mq.md ```markdown --- -import data:ext/data/db.mq.md +import: + data: ext/data/db.mq.md --- # main @@ -162,7 +166,8 @@ HTTP 门禁与登录走 `ext/security`(`auth` / `rbac` / `oidc`),再用 `w ```markdown --- -import rbac:ext/security/rbac.mq.md +import: + rbac: ext/security/rbac.mq.md --- # main diff --git a/doc/tutorial/15-常见陷阱.md b/doc/tutorial/15-常见陷阱.md index 9a11940..268bc8e 100644 --- a/doc/tutorial/15-常见陷阱.md +++ b/doc/tutorial/15-常见陷阱.md @@ -318,7 +318,8 @@ error: cannot resolve import `../execution/docgate.mq.md` from **跨目录**才用 `..`: ```markdown -import ctx:../knowledge/context.mq.md +import: + ctx: ../knowledge/context.mq.md ``` ### 5.2 库名必须导入,不能用裸名 @@ -328,7 +329,8 @@ error: unknown library `json` (import it in frontmatter) ``` ```markdown -import json:lib/json.mq.md +import: + json: lib/json.mq.md ``` 标准库函数要**带库名前缀**:`json.parse`、`txt.contains`、`table.put`。 diff --git a/examples/agent-okf-flywheel/index.mq.md b/examples/agent-okf-flywheel/index.mq.md index 702e241..1bfcce8 100644 --- a/examples/agent-okf-flywheel/index.mq.md +++ b/examples/agent-okf-flywheel/index.mq.md @@ -1,12 +1,13 @@ --- title: agent-okf-flywheel (Wave B0) description: Promote solidified workbook; second plan is cache=hit — document as knowledge base (OKF). -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/examples/agent-pong/index.mq.md b/examples/agent-pong/index.mq.md index 56c599c..1111fc7 100644 --- a/examples/agent-pong/index.mq.md +++ b/examples/agent-pong/index.mq.md @@ -3,12 +3,13 @@ title: agent-pong (Wave B0) description: >- Constitution demo — call_site + source in step context; optional live CALL via .env. Code is documentation; tools are ## in this same file. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import time:lib/time.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + time: lib/time.mq.md --- ## 获取时间 diff --git a/examples/agent-sandbox-okf/index.mq.md b/examples/agent-sandbox-okf/index.mq.md index ca36ccc..a96280e 100644 --- a/examples/agent-sandbox-okf/index.mq.md +++ b/examples/agent-sandbox-okf/index.mq.md @@ -2,8 +2,9 @@ title: agent-sandbox-okf — trial then commit description: > O1 example: opt-in sandbox trial with GFM-table returns and link-index reads. -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md --- # main diff --git a/examples/anlian-mq/components/feed.mq.md b/examples/anlian-mq/components/feed.mq.md index ef67be0..ef4c821 100644 --- a/examples/anlian-mq/components/feed.mq.md +++ b/examples/anlian-mq/components/feed.mq.md @@ -2,8 +2,9 @@ markup: occlusion title: components/feed description: 帖子列表 / 新闻时间线 / 板块栏 HTML 片段(对齐 Django feed 与 home 局部模板)。 -import table:lib/table.mq.md -import text:lib/text.mq.md +import: + table: lib/table.mq.md + text: lib/text.mq.md --- ## 帖子列表HTML diff --git a/examples/anlian-mq/components/fragments.mq.md b/examples/anlian-mq/components/fragments.mq.md index 95df665..be83076 100644 --- a/examples/anlian-mq/components/fragments.mq.md +++ b/examples/anlian-mq/components/fragments.mq.md @@ -1,9 +1,10 @@ --- title: components/fragments description: AJAX 片段 — /post/ten、/news/five。 -导入 网页:ext/web/网页.mq.md -import db:../db/index.mq.md -import feed:feed.mq.md +导入: + 网页: ext/web/网页.mq.md + db: ../db/index.mq.md + feed: feed.mq.md --- ## 帖子十 diff --git a/examples/anlian-mq/components/home_body.mq.md b/examples/anlian-mq/components/home_body.mq.md index 35ed2f9..e2e7611 100644 --- a/examples/anlian-mq/components/home_body.mq.md +++ b/examples/anlian-mq/components/home_body.mq.md @@ -1,10 +1,11 @@ --- title: components/home_body description: 首页主体 HTML — hero + 公告 + 新闻时间线 + 论坛帖子(对齐 Django home.html,无外层导航)。 -导入 网页:ext/web/网页.mq.md -import table:lib/table.mq.md -import text:lib/text.mq.md -import feed:feed.mq.md +导入: + 网页: ext/web/网页.mq.md + table: lib/table.mq.md + text: lib/text.mq.md + feed: feed.mq.md --- ## 装配 diff --git a/examples/anlian-mq/components/page.mq.md b/examples/anlian-mq/components/page.mq.md index 656b7c0..9e56855 100644 --- a/examples/anlian-mq/components/page.mq.md +++ b/examples/anlian-mq/components/page.mq.md @@ -1,8 +1,9 @@ --- title: components/page description: 用原站 chrome 包一层完整 HTML 引言(bare 布局)。 -import text:lib/text.mq.md -import chrome:chrome.mq.md +import: + text: lib/text.mq.md + chrome: chrome.mq.md --- ## 包装 diff --git a/examples/anlian-mq/db/index.mq.md b/examples/anlian-mq/db/index.mq.md index 8dff976..df47ea0 100644 --- a/examples/anlian-mq/db/index.mq.md +++ b/examples/anlian-mq/db/index.mq.md @@ -1,9 +1,10 @@ --- title: db/index description: 打开库、建全表、幂等种子、帖子全文索引。 -导入 网页:ext/web/网页.mq.md -import schema:schema.mq.md -import seed:seed.mq.md +导入: + 网页: ext/web/网页.mq.md + schema: schema.mq.md + seed: seed.mq.md --- ## 打开 diff --git a/examples/anlian-mq/index.mq.md b/examples/anlian-mq/index.mq.md index f4038fd..4da3277 100644 --- a/examples/anlian-mq/index.mq.md +++ b/examples/anlian-mq/index.mq.md @@ -1,15 +1,16 @@ --- title: 暗恋见君 · Marqdo description: 对齐 Django 暗恋见君:原站 CSS/DOM、首页四段、列表详情、发帖门禁、聊天室、专题、搜索、API 指南。 -导入 网页:ext/web/网页.mq.md -import table:lib/table.mq.md -import text:lib/text.mq.md -import chrome:components/chrome.mq.md -import page:components/page.mq.md -import home:components/home_body.mq.md -import feed:components/feed.mq.md -import fragments:components/fragments.mq.md -import db:db/index.mq.md +导入: + 网页: ext/web/网页.mq.md + table: lib/table.mq.md + text: lib/text.mq.md + chrome: components/chrome.mq.md + page: components/page.mq.md + home: components/home_body.mq.md + feed: components/feed.mq.md + fragments: components/fragments.mq.md + db: db/index.mq.md --- # main diff --git a/examples/anlian-mq/offline-smoke.mq.md b/examples/anlian-mq/offline-smoke.mq.md index a221851..def8026 100644 --- a/examples/anlian-mq/offline-smoke.mq.md +++ b/examples/anlian-mq/offline-smoke.mq.md @@ -1,12 +1,13 @@ --- title: anlian-mq offline smoke description: 不 listen:装配库表/页面/门禁/WS 路由袋,验证可读路径可构造。 -导入 网页:ext/web/网页.mq.md -import shell:styles/shell.mq.md -import nav:components/nav.mq.md -import foot:components/foot.mq.md -import db:db/index.mq.md -import sys:lib/sys.mq.md +导入: + 网页: ext/web/网页.mq.md + shell: styles/shell.mq.md + nav: components/nav.mq.md + foot: components/foot.mq.md + db: db/index.mq.md + sys: lib/sys.mq.md --- # main diff --git a/examples/anlian-mq/styles/shell.mq.md b/examples/anlian-mq/styles/shell.mq.md index af1b0d0..653857f 100644 --- a/examples/anlian-mq/styles/shell.mq.md +++ b/examples/anlian-mq/styles/shell.mq.md @@ -1,8 +1,9 @@ --- title: styles/shell description: 暗恋见君壳样式——对照 Django 原站粉玻璃 + 动效,用表格声明。 -导入 网页:ext/web/网页.mq.md -import text:lib/text.mq.md +导入: + 网页: ext/web/网页.mq.md + text: lib/text.mq.md --- 对照原站 `config/static/front/css/{base,feed_common,footer,index/hero}.css`: diff --git a/examples/browser-app/app.mq.md b/examples/browser-app/app.mq.md index ce7cd92..344b0bf 100644 --- a/examples/browser-app/app.mq.md +++ b/examples/browser-app/app.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: browser-app (route E+) description: list CRUD, storage, navigate, interval, fetch_all, ws — GFM + lib/browser -import browser:lib/browser.mq.md -import table:lib/table.mq.md -import text:lib/text.mq.md +import: + browser: lib/browser.mq.md + table: lib/table.mq.md + text: lib/text.mq.md --- # main diff --git a/examples/browser-hello/counter.mq.md b/examples/browser-hello/counter.mq.md index 294dec3..f3d63ed 100644 --- a/examples/browser-hello/counter.mq.md +++ b/examples/browser-hello/counter.mq.md @@ -1,7 +1,8 @@ --- title: browser counter (C3) description: wire table + browser.set_text — no json glue -import browser:lib/browser.mq.md +import: + browser: lib/browser.mq.md --- # main diff --git a/examples/browser-hello/fetch.mq.md b/examples/browser-hello/fetch.mq.md index 187f900..a053a6b 100644 --- a/examples/browser-hello/fetch.mq.md +++ b/examples/browser-hello/fetch.mq.md @@ -1,7 +1,8 @@ --- title: browser fetch (C4) description: fetch/after effects via lib/browser — no json glue -import browser:lib/browser.mq.md +import: + browser: lib/browser.mq.md --- # main diff --git a/examples/browser-hello/form.mq.md b/examples/browser-hello/form.mq.md index edc5c27..8d81b22 100644 --- a/examples/browser-hello/form.mq.md +++ b/examples/browser-hello/form.mq.md @@ -1,8 +1,9 @@ --- title: browser form (D3) description: input wire passes value; effects via lib/browser -import browser:lib/browser.mq.md -import table:lib/table.mq.md +import: + browser: lib/browser.mq.md + table: lib/table.mq.md --- # main diff --git a/examples/browser-hello/marqdo-bridge.js b/examples/browser-hello/marqdo-bridge.js index 631aa59..3a5784a 100644 --- a/examples/browser-hello/marqdo-bridge.js +++ b/examples/browser-hello/marqdo-bridge.js @@ -197,6 +197,20 @@ export function eventArgsFromDom(ev, valueFromSel) { args.fields = fields; } } + if (ev && (ev.type === "scroll" || ev.type === "resize")) { + try { + const doc = typeof document !== "undefined" ? document.documentElement : null; + const body = typeof document !== "undefined" ? document.body : null; + const scrollTop = (doc && (doc.scrollTop || 0)) || (body && body.scrollTop) || 0; + const height = doc ? (doc.scrollHeight - doc.clientHeight) || 1 : 1; + const ratio = Math.max(0, Math.min(1, scrollTop / height)); + args.scroll_top = scrollTop; + args.scroll_max = height; + args.scroll_ratio = ratio; + } catch (_) { + /* ignore */ + } + } return args; } @@ -721,75 +735,88 @@ function runObserveEffect(exports, spec, onError) { const kind = String(spec.kind || spec.type || "intersect").toLowerCase(); const sel = String(spec.sel || ""); const thenFn = spec.then; - const id = String(spec.id || `obs${++observeSeq}`); - const el = qsOne(sel); - if (!el || !thenFn) return; + const baseId = String(spec.id || `obs${++observeSeq}`); + const nodes = qsAll(sel); + if (!nodes.length || (!thenFn && !spec.add_class)) return; - const prev = observeHandles.get(id); - if (prev) { - try { - prev.disconnect(); - } catch (_) { - /* ignore */ - } - } - - const fire = (payload) => { - try { - const result = call(exports, thenFn, payload); - if (!result.ok) { - if (onError) onError(result.error); - return; + nodes.forEach((el, idx) => { + const id = nodes.length === 1 ? baseId : `${baseId}_${idx}`; + const prev = observeHandles.get(id); + if (prev) { + try { + prev.disconnect(); + } catch (_) { + /* ignore */ } - applyEffects(exports, result.value, { onError }); - } catch (e) { - if (onError) onError(String(e)); } - }; - if (kind === "resize" && typeof ResizeObserver !== "undefined") { - const ro = new ResizeObserver((entries) => { - const en = entries[0]; - const cr = en?.contentRect; - fire({ - ok: true, - kind: "resize", - id, - width: cr ? cr.width : 0, - height: cr ? cr.height : 0, - }); - }); - ro.observe(el); - observeHandles.set(id, ro); - return; - } + const fire = (payload) => { + try { + const result = call(exports, thenFn, payload); + if (!result.ok) { + if (onError) onError(result.error); + return; + } + applyEffects(exports, result.value, { onError }); + } catch (e) { + if (onError) onError(String(e)); + } + }; - if (typeof IntersectionObserver !== "undefined") { - const io = new IntersectionObserver( - (entries) => { + if (kind === "resize" && typeof ResizeObserver !== "undefined") { + const ro = new ResizeObserver((entries) => { const en = entries[0]; - if (!en) return; + const cr = en?.contentRect; fire({ ok: true, - kind: "intersect", + kind: "resize", id, - intersecting: !!en.isIntersecting, - ratio: en.intersectionRatio, + width: cr ? cr.width : 0, + height: cr ? cr.height : 0, }); - if (spec.once && en.isIntersecting) { - try { - io.disconnect(); - } catch (_) { - /* ignore */ + }); + ro.observe(el); + observeHandles.set(id, ro); + return; + } + + if (typeof IntersectionObserver !== "undefined") { + const opts = { threshold: spec.threshold != null ? Number(spec.threshold) : 0.1 }; + if (spec.rootMargin != null) opts.rootMargin = String(spec.rootMargin); + const io = new IntersectionObserver( + (entries) => { + const en = entries[0]; + if (!en) return; + if (en.isIntersecting && spec.add_class) { + for (const c of String(spec.add_class).split(/\s+/).filter(Boolean)) { + el.classList.add(c); + } } - observeHandles.delete(id); - } - }, - { threshold: spec.threshold != null ? Number(spec.threshold) : 0.1 }, - ); - io.observe(el); - observeHandles.set(id, io); - } + if (thenFn) { + fire({ + ok: true, + kind: "intersect", + id, + intersecting: !!en.isIntersecting, + ratio: en.intersectionRatio, + target_id: el.id || "", + }); + } + if (spec.once && en.isIntersecting) { + try { + io.disconnect(); + } catch (_) { + /* ignore */ + } + observeHandles.delete(id); + } + }, + opts, + ); + io.observe(el); + observeHandles.set(id, io); + } + }); } function buildFetchInit(spec) { @@ -921,8 +948,23 @@ function runIntervalEffect(exports, spec, onError) { intervalHandles.set(id, handle); } +const memoryKV = new Map(); + function storageStore(scope) { if (scope === "cookie") return null; + if (scope === "memory" || scope === "mem" || scope === "内存") { + return { + getItem(key) { + return memoryKV.has(key) ? memoryKV.get(key) : null; + }, + setItem(key, value) { + memoryKV.set(key, String(value)); + }, + removeItem(key) { + memoryKV.delete(key); + }, + }; + } if (typeof localStorage === "undefined") return null; return scope === "session" ? sessionStorage : localStorage; } @@ -1371,12 +1413,24 @@ export async function autoMount(doc) { const g = typeof globalThis !== "undefined" ? globalThis : undefined; if (g && g.document) { + // Defer WASM boot until after first paint / load so LCP images are not + // contending with a ~1.6MB wasm download on the critical path. const start = () => { - autoMount(g.document).catch((e) => console.error("marqdo autoMount:", e)); + const run = () => { + autoMount(g.document).catch((e) => console.error("marqdo autoMount:", e)); + }; + const schedule = () => { + if (typeof g.requestIdleCallback === "function") { + g.requestIdleCallback(() => run(), { timeout: 1500 }); + } else { + g.setTimeout(run, 0); + } + }; + if (g.document.readyState === "complete") { + schedule(); + } else { + g.addEventListener("load", schedule, { once: true }); + } }; - if (g.document.readyState === "loading") { - g.document.addEventListener("DOMContentLoaded", start); - } else { - queueMicrotask(start); - } + start(); } diff --git a/examples/browser-media/media.mq.md b/examples/browser-media/media.mq.md index 6f7c301..9aecf39 100644 --- a/examples/browser-media/media.mq.md +++ b/examples/browser-media/media.mq.md @@ -1,8 +1,9 @@ --- title: browser-media (route F) description: file / canvas / audio / observers / drag — GFM tables + lib/browser -import browser:lib/browser.mq.md -import table:lib/table.mq.md +import: + browser: lib/browser.mq.md + table: lib/table.mq.md --- # main diff --git a/examples/executable-knowledge/capabilities/order-pricing.mq.md b/examples/executable-knowledge/capabilities/order-pricing.mq.md index 9cf7a43..c5f7920 100644 --- a/examples/executable-knowledge/capabilities/order-pricing.mq.md +++ b/examples/executable-knowledge/capabilities/order-pricing.mq.md @@ -1,8 +1,9 @@ --- id: capability.order-pricing type: Capability -import tax:../knowledge/tax-2026.mq.md -import order:../schema/order.mq.md +import: + tax: ../knowledge/tax-2026.mq.md + order: ../schema/order.mq.md --- # 订单定价 diff --git a/examples/executable-knowledge/docs/invoice-answer.mq.md b/examples/executable-knowledge/docs/invoice-answer.mq.md index 1731efe..ded309e 100644 --- a/examples/executable-knowledge/docs/invoice-answer.mq.md +++ b/examples/executable-knowledge/docs/invoice-answer.mq.md @@ -1,7 +1,8 @@ --- id: document.invoice-answer type: Answer -import pricing:../capabilities/order-pricing.mq.md +import: + pricing: ../capabilities/order-pricing.mq.md --- # 发票回答 diff --git a/examples/knowledge-layers/libai.mq.md b/examples/knowledge-layers/libai.mq.md index f5c5cc8..aedb728 100644 --- a/examples/knowledge-layers/libai.mq.md +++ b/examples/knowledge-layers/libai.mq.md @@ -2,7 +2,8 @@ type: Fact id: libai title: 李白 -import poet:poet.mq.md +import: + poet: poet.mq.md --- # 李白 = > 诗人 diff --git a/examples/knowledge-layers/main.compat.mq.md b/examples/knowledge-layers/main.compat.mq.md index 2cc505d..818a55e 100644 --- a/examples/knowledge-layers/main.compat.mq.md +++ b/examples/knowledge-layers/main.compat.mq.md @@ -1,5 +1,6 @@ --- -import libai:libai.mq.md +import: + libai: libai.mq.md --- # main diff --git a/examples/linalg-least-squares/index.mq.md b/examples/linalg-least-squares/index.mq.md index 65659f4..339a3cc 100644 --- a/examples/linalg-least-squares/index.mq.md +++ b/examples/linalg-least-squares/index.mq.md @@ -1,8 +1,9 @@ --- title: Least squares via lstsq description: Overdetermined Ax≈b with ext/linalg lstsq + heatmap. -import la:ext/linalg/linalg.mq.md -import math:lib/math.mq.md +import: + la: ext/linalg/linalg.mq.md + math: lib/math.mq.md --- # Least squares from a runnable document diff --git a/examples/linalg-svd/index.mq.md b/examples/linalg-svd/index.mq.md index 42fd336..0051463 100644 --- a/examples/linalg-svd/index.mq.md +++ b/examples/linalg-svd/index.mq.md @@ -1,7 +1,8 @@ --- title: SVD structure demo description: Diagonal SVD + structure SVG via ext/linalg. -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # SVD from a runnable document diff --git a/examples/linalg-transpose/index.mq.md b/examples/linalg-transpose/index.mq.md index 35126ea..0864f25 100644 --- a/examples/linalg-transpose/index.mq.md +++ b/examples/linalg-transpose/index.mq.md @@ -1,7 +1,8 @@ --- title: Transpose identity (formula document) description: (AB)^T = B^T A^T as a runnable lecture fragment. -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # Transpose reverses products diff --git a/examples/link-syntax/main.compat.mq.md b/examples/link-syntax/main.compat.mq.md index 232e893..e7bec8b 100644 --- a/examples/link-syntax/main.compat.mq.md +++ b/examples/link-syntax/main.compat.mq.md @@ -1,6 +1,7 @@ --- markup: occlusion -import libai:libai.mq.md +import: + libai: libai.mq.md --- # main diff --git a/examples/marqdo-blog/db/posts.mq.md b/examples/marqdo-blog/db/posts.mq.md index 563a421..a5a3ba2 100644 --- a/examples/marqdo-blog/db/posts.mq.md +++ b/examples/marqdo-blog/db/posts.mq.md @@ -1,6 +1,7 @@ --- title: blog posts schema -import data:ext/data/db.mq.md +import: + data: ext/data/db.mq.md --- ## schema diff --git a/examples/marqdo-blog/index.mq.md b/examples/marqdo-blog/index.mq.md index 68f8770..c622fb1 100644 --- a/examples/marqdo-blog/index.mq.md +++ b/examples/marqdo-blog/index.mq.md @@ -7,7 +7,8 @@ data_source: posts data_order: -created_at description: >- Document Artifact 首页(ADR 0007):正文即文档,列表来自 data_source。 -导入 网页:ext/web/网页.mq.md +导入: + 网页: ext/web/网页.mq.md --- # Marqdo 博客 diff --git a/examples/marqdo-blog/serve.mq.md b/examples/marqdo-blog/serve.mq.md index 3071321..f7e6f64 100644 --- a/examples/marqdo-blog/serve.mq.md +++ b/examples/marqdo-blog/serve.mq.md @@ -1,8 +1,9 @@ --- title: marqdo-blog serve description: Scan Artifact documents/endpoints and listen (ADR 0007). -import web:ext/web/web.mq.md -import posts:db/posts.mq.md +import: + web: ext/web/web.mq.md + posts: db/posts.mq.md --- # main diff --git a/examples/marqdo-blog/styles/theme.mq.md b/examples/marqdo-blog/styles/theme.mq.md index 8969d04..863d746 100644 --- a/examples/marqdo-blog/styles/theme.mq.md +++ b/examples/marqdo-blog/styles/theme.mq.md @@ -1,8 +1,9 @@ --- title: styles/theme description: 博客主题:样式即数据表格,装配即函数。 -import 网页:ext/web/网页.mq.md -import text:lib/text.mq.md +import: + 网页: ext/web/网页.mq.md + text: lib/text.mq.md --- 博客主题的样式即数据表格:每个 `## 段` 导出一张 GFM 样式表(`|选择器|属性|值|`, diff --git a/examples/oa2026-showcase/bell.mq.md b/examples/oa2026-showcase/bell.mq.md index 0955362..278b9ad 100644 --- a/examples/oa2026-showcase/bell.mq.md +++ b/examples/oa2026-showcase/bell.mq.md @@ -1,7 +1,8 @@ --- title: 贝尔态:两个量子比特如何一起回答 description: 从一条假设开始,搭电路、看概率、画图,并用断言验收。 -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/examples/oa2026-showcase/calculus.mq.md b/examples/oa2026-showcase/calculus.mq.md index 1e458ee..9d6ea65 100644 --- a/examples/oa2026-showcase/calculus.mq.md +++ b/examples/oa2026-showcase/calculus.mq.md @@ -1,7 +1,8 @@ --- title: 一份可执行的求导讲义 description: 公式、求导、求根、求值与绘图,在同一条叙述里完成。 -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/examples/oa2026-showcase/foreign-node.mq.md b/examples/oa2026-showcase/foreign-node.mq.md index 54b5765..1b27458 100644 --- a/examples/oa2026-showcase/foreign-node.mq.md +++ b/examples/oa2026-showcase/foreign-node.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: 外联:把 Node 当作文档里的计算车间 description: 一次性执行、持久会话、显式传值,以及可读的结果。 -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/examples/quantum-bell/index.mq.md b/examples/quantum-bell/index.mq.md index 96b280e..e6c4b93 100644 --- a/examples/quantum-bell/index.mq.md +++ b/examples/quantum-bell/index.mq.md @@ -1,9 +1,10 @@ --- title: Bell state description: H then CX; probabilities ≈ 1/2; circuit SVG. -import quantum:ext/quantum/quantum.mq.md -import math:lib/math.mq.md -import json:lib/json.mq.md +import: + quantum: ext/quantum/quantum.mq.md + math: lib/math.mq.md + json: lib/json.mq.md --- # Bell |Φ+⟩ diff --git a/examples/quantum-entanglement/index.mq.md b/examples/quantum-entanglement/index.mq.md index 991a1a4..b1d6411 100644 --- a/examples/quantum-entanglement/index.mq.md +++ b/examples/quantum-entanglement/index.mq.md @@ -1,8 +1,9 @@ --- title: Entanglement lab description: Bell state — density, partial trace, Schmidt, themed SVG (Q7/Q8). -import quantum:ext/quantum/quantum.mq.md -import math:lib/math.mq.md +import: + quantum: ext/quantum/quantum.mq.md + math: lib/math.mq.md --- # Entanglement from a runnable document diff --git a/examples/quantum-ghz/index.mq.md b/examples/quantum-ghz/index.mq.md index bceb8be..4eb3c82 100644 --- a/examples/quantum-ghz/index.mq.md +++ b/examples/quantum-ghz/index.mq.md @@ -1,7 +1,8 @@ --- title: GHZ state description: 3-qubit GHZ; |000⟩/|111⟩ ≈ 1/2; probs + H matrix heatmap. -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # GHZ diff --git a/examples/syntax-tour/index.mq.md b/examples/syntax-tour/index.mq.md index 1bb9ac0..36c6869 100644 --- a/examples/syntax-tour/index.mq.md +++ b/examples/syntax-tour/index.mq.md @@ -1,6 +1,7 @@ --- markup: occlusion -import table:lib/table.mq.md +import: + table: lib/table.mq.md title: Marqdo 语法全景(v1.6 现状) description: 一页看完全部现行语法:遮蔽、调用、取值、循环、分支、表格、契约 --- diff --git a/examples/web-client-site/index.mq.md b/examples/web-client-site/index.mq.md index 342d69d..71a4d30 100644 --- a/examples/web-client-site/index.mq.md +++ b/examples/web-client-site/index.mq.md @@ -4,7 +4,8 @@ title: Marqdo client site route: / method: GET description: SSR Document + client_embed auto-mount; author zero JS (ADR 0007). -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # Marqdo client site diff --git a/examples/web-client-site/serve.mq.md b/examples/web-client-site/serve.mq.md index 8d1d933..b518a9f 100644 --- a/examples/web-client-site/serve.mq.md +++ b/examples/web-client-site/serve.mq.md @@ -1,6 +1,7 @@ --- title: web-client-site serve -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main diff --git a/examples/web-client-site/static/client.mq.md b/examples/web-client-site/static/client.mq.md index ba33c31..fe87215 100644 --- a/examples/web-client-site/static/client.mq.md +++ b/examples/web-client-site/static/client.mq.md @@ -1,8 +1,9 @@ --- title: client counter (route D) description: wired by client_embed auto-mount; GFM + lib/browser -import browser:lib/browser.mq.md -import table:lib/table.mq.md +import: + browser: lib/browser.mq.md + table: lib/table.mq.md --- # main diff --git a/examples/web-collab-doc/index.mq.md b/examples/web-collab-doc/index.mq.md index b377757..fb1a756 100644 --- a/examples/web-collab-doc/index.mq.md +++ b/examples/web-collab-doc/index.mq.md @@ -1,7 +1,8 @@ --- title: web-collab-doc description: Two-browser collaborative plain-text editor over WS room (LWW snapshot sync) -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main diff --git a/examples/web-collab-doc/static/client.mq.md b/examples/web-collab-doc/static/client.mq.md index b530b74..f2e4481 100644 --- a/examples/web-collab-doc/static/client.mq.md +++ b/examples/web-collab-doc/static/client.mq.md @@ -1,9 +1,10 @@ --- title: collab client description: LWW text sync over WS room + presence (DOC\\t protocol) -import browser:lib/browser.mq.md -import table:lib/table.mq.md -import text:lib/text.mq.md +import: + browser: lib/browser.mq.md + table: lib/table.mq.md + text: lib/text.mq.md --- # main diff --git a/examples/web-net-site-zh/db/index.mq.md b/examples/web-net-site-zh/db/index.mq.md index 098bd06..e1af68d 100644 --- a/examples/web-net-site-zh/db/index.mq.md +++ b/examples/web-net-site-zh/db/index.mq.md @@ -1,8 +1,9 @@ --- title: db/index description: 打开 sqlite、建表、幂等种子。 -导入 网页:ext/web/网页.mq.md -import articles:articles.mq.md +导入: + 网页: ext/web/网页.mq.md + articles: articles.mq.md --- ## 打开 diff --git a/examples/web-net-site-zh/index.mq.md b/examples/web-net-site-zh/index.mq.md index 62122d4..b7b56c4 100644 --- a/examples/web-net-site-zh/index.mq.md +++ b/examples/web-net-site-zh/index.mq.md @@ -1,15 +1,16 @@ --- title: 网络扩展站(中文) description: 首页 + /about + /new(表单)+ /tools(lib/net)+ /admin(登录鉴权)+ /live(WebSocket)。 -导入 网页:ext/web/网页.mq.md -import net:lib/网络.mq.md -import text:lib/text.mq.md -import shell:styles/shell.mq.md -import nav:components/nav.mq.md -import side:components/side.mq.md -import foot:components/foot.mq.md -import articles:db/articles.mq.md -import db:db/index.mq.md +导入: + 网页: ext/web/网页.mq.md + net: lib/网络.mq.md + text: lib/text.mq.md + shell: styles/shell.mq.md + nav: components/nav.mq.md + side: components/side.mq.md + foot: components/foot.mq.md + articles: db/articles.mq.md + db: db/index.mq.md --- # main diff --git a/examples/web-net-site/db/index.mq.md b/examples/web-net-site/db/index.mq.md index bd7d34f..80b4209 100644 --- a/examples/web-net-site/db/index.mq.md +++ b/examples/web-net-site/db/index.mq.md @@ -1,8 +1,9 @@ --- title: db/index description: Open sqlite, init articles, seed once. -import web:ext/web/web.mq.md -import articles:articles.mq.md +import: + web: ext/web/web.mq.md + articles: articles.mq.md --- ## open diff --git a/examples/web-net-site/index.mq.md b/examples/web-net-site/index.mq.md index 35ae13d..7eceec5 100644 --- a/examples/web-net-site/index.mq.md +++ b/examples/web-net-site/index.mq.md @@ -1,15 +1,16 @@ --- title: web-net-site description: Home + /about + /new (form) + /tools (net lib) + /admin (auth) + /live (WebSocket). -import web:ext/web/web.mq.md -import net:lib/net.mq.md -import text:lib/text.mq.md -import shell:styles/shell.mq.md -import nav:components/nav.mq.md -import side:components/side.mq.md -import foot:components/foot.mq.md -import articles:db/articles.mq.md -import db:db/index.mq.md +import: + web: ext/web/web.mq.md + net: lib/net.mq.md + text: lib/text.mq.md + shell: styles/shell.mq.md + nav: components/nav.mq.md + side: components/side.mq.md + foot: components/foot.mq.md + articles: db/articles.mq.md + db: db/index.mq.md --- # main diff --git a/examples/web-site-zh/db/index.mq.md b/examples/web-site-zh/db/index.mq.md index 02c194d..e8a0121 100644 --- a/examples/web-site-zh/db/index.mq.md +++ b/examples/web-site-zh/db/index.mq.md @@ -1,8 +1,9 @@ --- title: db/index description: 打开 sqlite、建表、幂等种子。 -导入 网页:ext/web/网页.mq.md -import articles:articles.mq.md +导入: + 网页: ext/web/网页.mq.md + articles: articles.mq.md --- ## open diff --git a/examples/web-site-zh/index.mq.md b/examples/web-site-zh/index.mq.md index 80bd6b9..5d3dee4 100644 --- a/examples/web-site-zh/index.mq.md +++ b/examples/web-site-zh/index.mq.md @@ -2,14 +2,15 @@ title: 中文站点示例 description: >- 与 examples/web-site 对等的 WWW Demo 样站:表驱动全站;作者业务 JS=0;作者 .css=0。 -导入 网页:ext/web/网页.mq.md -import shell:styles/shell.mq.md -import nav:components/nav.mq.md -import side:components/side.mq.md -import foot:components/foot.mq.md -import desk:components/desk.mq.md -import articles:db/articles.mq.md -import db:db/index.mq.md +导入: + 网页: ext/web/网页.mq.md + shell: styles/shell.mq.md + nav: components/nav.mq.md + side: components/side.mq.md + foot: components/foot.mq.md + desk: components/desk.mq.md + articles: db/articles.mq.md + db: db/index.mq.md --- # main diff --git a/examples/web-site-zh/styles/shell.mq.md b/examples/web-site-zh/styles/shell.mq.md index 6854683..b9512e5 100644 --- a/examples/web-site-zh/styles/shell.mq.md +++ b/examples/web-site-zh/styles/shell.mq.md @@ -3,8 +3,9 @@ title: styles/shell description: >- Literary dark theme for examples/web-site — ink / wine / gold after the anlian.cyou Zhang Ailing topic. GFM tables only; no author .css. -import web:ext/web/web.mq.md -import text:lib/text.mq.md +import: + web: ext/web/web.mq.md + text: lib/text.mq.md --- Authors style the site with **GFM tables** only. App pages use `shell_css=off` diff --git a/examples/web-site/db/index.mq.md b/examples/web-site/db/index.mq.md index 7b4ee71..d56deb8 100644 --- a/examples/web-site/db/index.mq.md +++ b/examples/web-site/db/index.mq.md @@ -1,9 +1,10 @@ --- title: db/index description: Open sqlite, init articles, seed once. -import web:ext/web/web.mq.md -import articles:articles.mq.md -import fs:lib/fs.mq.md +import: + web: ext/web/web.mq.md + articles: articles.mq.md + fs: lib/fs.mq.md --- ## open diff --git a/examples/web-site/index.mq.md b/examples/web-site/index.mq.md index 12f7525..2045b01 100644 --- a/examples/web-site/index.mq.md +++ b/examples/web-site/index.mq.md @@ -3,14 +3,15 @@ title: web-site description: >- WWW Demo sample — GFM tables for shell, schema, forms, styles, and admin. Author business JavaScript: none. Author hand-written .css: none. -import web:ext/web/web.mq.md -import shell:styles/shell.mq.md -import nav:components/nav.mq.md -import side:components/side.mq.md -import foot:components/foot.mq.md -import desk:components/desk.mq.md -import articles:db/articles.mq.md -import db:db/index.mq.md +import: + web: ext/web/web.mq.md + shell: styles/shell.mq.md + nav: components/nav.mq.md + side: components/side.mq.md + foot: components/foot.mq.md + desk: components/desk.mq.md + articles: db/articles.mq.md + db: db/index.mq.md --- # main diff --git a/examples/web-site/styles/shell.mq.md b/examples/web-site/styles/shell.mq.md index 780e880..2ecbec7 100644 --- a/examples/web-site/styles/shell.mq.md +++ b/examples/web-site/styles/shell.mq.md @@ -3,8 +3,9 @@ title: styles/shell description: >- Literary dark theme for examples/web-site — ink / wine / gold after the anlian.cyou Zhang Ailing topic. GFM tables only; no author .css. -import web:ext/web/web.mq.md -import text:lib/text.mq.md +import: + web: ext/web/web.mq.md + text: lib/text.mq.md --- Authors style the site with **GFM tables** only. App pages use `shell_css=off` diff --git a/examples/web-spa-app/index.mq.md b/examples/web-spa-app/index.mq.md index 443f74f..bc60a68 100644 --- a/examples/web-spa-app/index.mq.md +++ b/examples/web-spa-app/index.mq.md @@ -1,7 +1,8 @@ --- title: web-spa-app description: Native Marqdo SPA — list/detail/edit via WASM client routes + memory store -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main diff --git a/examples/web-spa-app/static/client.mq.md b/examples/web-spa-app/static/client.mq.md index 9b82ccd..4ef7020 100644 --- a/examples/web-spa-app/static/client.mq.md +++ b/examples/web-spa-app/static/client.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: spa client description: routes table + memory store; list / detail / edit -import browser:lib/browser.mq.md -import table:lib/table.mq.md -import text:lib/text.mq.md +import: + browser: lib/browser.mq.md + table: lib/table.mq.md + text: lib/text.mq.md --- # main diff --git a/examples/web-tenant-saas/index.mq.md b/examples/web-tenant-saas/index.mq.md index d578716..b846c8e 100644 --- a/examples/web-tenant-saas/index.mq.md +++ b/examples/web-tenant-saas/index.mq.md @@ -1,7 +1,8 @@ --- title: web-tenant-saas demo description: Dual-tenant isolation via ?t= query + tenant_scope JSON API. -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main diff --git a/examples/web-ws-room/index.mq.md b/examples/web-ws-room/index.mq.md index 81bb64c..0449f41 100644 --- a/examples/web-ws-room/index.mq.md +++ b/examples/web-ws-room/index.mq.md @@ -1,7 +1,8 @@ --- title: web-ws-room demo description: Dynamic room WS with presence (G-WS1/2 bag). Open / and connect via bridge or wscat. -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main diff --git a/ext/ai/agent.mq.md b/ext/ai/agent.mq.md index faf5d0f..0973755 100644 --- a/ext/ai/agent.mq.md +++ b/ext/ai/agent.mq.md @@ -1,16 +1,17 @@ --- title: ext/ai/agent description: Document-driven agent v2 — step / plan / run; Skill Compilation via ABI plugin (episodes → learn → llm_free). -import llm:ext/ai/llm.mq.md -import json:lib/json.mq.md -import sys:lib/sys.mq.md -import fs:lib/fs.mq.md -import time:lib/time.mq.md -import wb:lib/writeback.mq.md -import subtask:lib/subtask.mq.md -import plugin:lib/plugin.mq.md -import sandbox:ext/ai/sandbox.mq.md -import table:lib/table.mq.md +import: + llm: ext/ai/llm.mq.md + json: lib/json.mq.md + sys: lib/sys.mq.md + fs: lib/fs.mq.md + time: lib/time.mq.md + wb: lib/writeback.mq.md + subtask: lib/subtask.mq.md + plugin: lib/plugin.mq.md + sandbox: ext/ai/sandbox.mq.md + table: lib/table.mq.md --- ## build_step_context @@ -181,7 +182,7 @@ Allowlist check, then invoke the runbook `##` via `lib/subtask` (`spawn fn=` → Build a runnable workbook. `skeleton=single` (default): one worker `step`. `skeleton=dual`: research then write agents. On success the parent chooses DONE; runtime `agent_workbook_solidify` freezes the answer. **q = > json.quote text=`goal`** -**esc = > json.parse text={"h":"---\ntitle: agent workbook\nimport llm:ext/ai/llm.mq.md\nimport agent:ext/ai/agent.mq.md\nimport json:lib/json.mq.md\nimport sys:lib/sys.mq.md\nimport wb:lib/writeback.mq.md\nimport subtask:lib/subtask.mq.md\n---\n\n# Goal\n\nParent goal is embedded as JSON in # main.\n\n## Solidify\n\nWhen the child returns a good value, parent DECISION: DONE — runtime agent_workbook_solidify freezes the answer as **return** (do not invent long FIND/REPLACE).\n\n# main\n\n> llm.load_env\n\n","s1":"\u002a\u002a\u0060model\u0060 = > llm.llm\u002a\u002a\n","s2":"\u002a\u002a\u0060tools\u0060 = > table.empty_list\u002a\u002a\n","s3":"\u002a\u002a\u0060worker\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You are a workbook worker. tools=[] means never CALL. Finish the task with a direct final answer; do not invent tools.\u002a\u002a\n","s4":"\u002a\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","s5":"}\u002a\u002a\n","s6":"\u002a\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task\u002a\u002a\n","s7":"\u002a\u002a\u0060out\u0060 = > \u0060worker\u0060.step task=\u0060task\u0060 stream=False\u002a\u002a\n","s7b":"\u002a\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result\u002a\u002a\n","s8":"\u002a\u002a\u0060text\u0060\u002a\u002a\n","d3":"\u002a\u002a\u0060research\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You gather facts for the goal. Be concise. Do not invent tools.\u002a\u002a\n","d3b":"\u002a\u002a\u0060writer\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You write the final answer from research notes. Do not invent tools.\u002a\u002a\n","d4":"\u002a\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","d5":"}\u002a\u002a\n","d6":"\u002a\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task\u002a\u002a\n","d7":"\u002a\u002a\u0060notes\u0060 = > \u0060research\u0060.step task=\u0060task\u0060 stream=False\u002a\u002a\n","d8":"\u002a\u002a\u0060ns\u0060 = > json.stringify value=\u0060notes\u0060\u002a\u002a\n","d9":"\u002a\u002a\u0060wt\u0060 = Write the final answer. Research notes:\u002a\u002a\n","d10":"\u002a\u002a\u0060wt\u0060 = \u0060wt\u0060 + \u0060ns\u0060\u002a\u002a\n","d11":"\u002a\u002a\u0060out\u0060 = > \u0060writer\u0060.step task=\u0060wt\u0060 stream=False\u002a\u002a\n","d11b":"\u002a\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result\u002a\u002a\n","d12":"\u002a\u002a\u0060text\u0060\u002a\u002a\n"}** +**esc = > json.parse text={"h":"---\ntitle: agent workbook\nimport:\n llm: ext/ai/llm.mq.md\n agent: ext/ai/agent.mq.md\n json: lib/json.mq.md\n sys: lib/sys.mq.md\n wb: lib/writeback.mq.md\n subtask: lib/subtask.mq.md\n---\n\n# Goal\n\nParent goal is embedded as JSON in # main.\n\n## Solidify\n\nWhen the child returns a good value, parent DECISION: DONE — runtime agent_workbook_solidify freezes the answer as **return** (do not invent long FIND/REPLACE).\n\n# main\n\n> llm.load_env\n\n","s1":"\u002a\u002a\u0060model\u0060 = > llm.llm\u002a\u002a\n","s2":"\u002a\u002a\u0060tools\u0060 = > table.empty_list\u002a\u002a\n","s3":"\u002a\u002a\u0060worker\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You are a workbook worker. tools=[] means never CALL. Finish the task with a direct final answer; do not invent tools.\u002a\u002a\n","s4":"\u002a\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","s5":"}\u002a\u002a\n","s6":"\u002a\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task\u002a\u002a\n","s7":"\u002a\u002a\u0060out\u0060 = > \u0060worker\u0060.step task=\u0060task\u0060 stream=False\u002a\u002a\n","s7b":"\u002a\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result\u002a\u002a\n","s8":"\u002a\u002a\u0060text\u0060\u002a\u002a\n","d3":"\u002a\u002a\u0060research\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You gather facts for the goal. Be concise. Do not invent tools.\u002a\u002a\n","d3b":"\u002a\u002a\u0060writer\u0060 = > agent.agent model=\u0060model\u0060 tools=\u0060tools\u0060 standing=You write the final answer from research notes. Do not invent tools.\u002a\u002a\n","d4":"\u002a\u002a\u0060wrap\u0060 = > json.parse text={\"task\":","d5":"}\u002a\u002a\n","d6":"\u002a\u002a\u0060task\u0060 = > json.get value=\u0060wrap\u0060 key=task\u002a\u002a\n","d7":"\u002a\u002a\u0060notes\u0060 = > \u0060research\u0060.step task=\u0060task\u0060 stream=False\u002a\u002a\n","d8":"\u002a\u002a\u0060ns\u0060 = > json.stringify value=\u0060notes\u0060\u002a\u002a\n","d9":"\u002a\u002a\u0060wt\u0060 = Write the final answer. Research notes:\u002a\u002a\n","d10":"\u002a\u002a\u0060wt\u0060 = \u0060wt\u0060 + \u0060ns\u0060\u002a\u002a\n","d11":"\u002a\u002a\u0060out\u0060 = > \u0060writer\u0060.step task=\u0060wt\u0060 stream=False\u002a\u002a\n","d11b":"\u002a\u002a\u0060text\u0060 = > json.get value=\u0060out\u0060 key=result\u002a\u002a\n","d12":"\u002a\u002a\u0060text\u0060\u002a\u002a\n"}** **h = > json.get value=`esc` key="h"** **s1 = > json.get value=`esc` key="s1"** **s2 = > json.get value=`esc` key="s2"** @@ -1531,7 +1532,7 @@ Parent Plan-and-Move prompt. Short protocol only — no long monologues. **compact = > compact_plan_observation observation=`observation`** **obs_s = > json.stringify value=`compact`** **goal_s = > json.stringify value=`goal`** -**esc = > json.parse text={"a":"\n\n--- standing ---\n","b":"\n\n--- goal ---\n","c":"\n\n--- observation ---\n","d":"\n\n--- skill brief ---\n","tools":"\n\n--- parent tools ---\nCALL:workbook_read | workbook_excerpt | lib_catalog | scratch_tool_write\nCALL:corpus_search | mcp_list_tools | mcp_call (ARGS:{…}; evidence only — workbook authority)\nCALL:lib.fs.read_text|exists|list_dir | lib.json.parse|stringify | lib.sys.cwd (+ ARGS:{json})\nREAD:source | stderr | stdout | slots | skill\nCreate tools: CONTINUE PATCH add ##, or CALL:scratch_tool_write with NAME line and fenced body.\n","e_rev":"\n\n--- how to act ---\nPlan-and-Move parent. Reply with ONE protocol only (no long reasoning). Exactly one DECISION line.\n1) exit_code=0 and has_value → DECISION: DONE + one-line SUMMARY. solidify_on_done. Do not CONTINUE just because has_worker_step.\n2) Need more evidence → READ:kind or CALL:tool (then you will be re-prompted).\n3) Failure / wrong value → DECISION: CONTINUE + short PATCH (<20 lines). Never paste user prose into REPLACE.\n4) Do NOT CONTINUE only to rewrite frontmatter imports; skeleton already uses import llm:/agent:/json:….\nPATCH must use triple-angle blocks only:\n<<<\nFIND\n\n===\nREPLACE\n\n>>>\nDo not use \u0060\u0060\u0060find, \u0060\u0060\u0060replace, or *** Begin Patch ***.\nProtocols:\nCALL:name\nREAD:kind\nDECISION: DONE\nSUMMARY: one line\nDECISION: CONTINUE\n","e_dec":"\n\n--- how to act ---\nPRE-RUN decompose. Reply with ONE protocol only (no long reasoning). Exactly one DECISION line.\n1) Skeleton OK → DECISION: RUN (preferred). Do not rewrite imports; they are already import llm:/agent:/….\n2) Need evidence → READ:source or READ:skill or CALL:workbook_read / lib_catalog / corpus_search / mcp_call.\n3) Reshape body/logic only → DECISION: CONTINUE + short PATCH (<20 lines).\n4) Fixed answer without LLM → PATCH to return, then RUN or DONE.\nPATCH must use <<< FIND === REPLACE >>> only (no \u0060\u0060\u0060find / Begin Patch).\nProtocols:\nCALL:name\nREAD:kind\nDECISION: RUN\nDECISION: DONE\nSUMMARY: one line\nDECISION: CONTINUE\n","f":"\n\n--- explore ---\n"}** +**esc = > json.parse text={"a":"\n\n--- standing ---\n","b":"\n\n--- goal ---\n","c":"\n\n--- observation ---\n","d":"\n\n--- skill brief ---\n","tools":"\n\n--- parent tools ---\nCALL:workbook_read | workbook_excerpt | lib_catalog | scratch_tool_write\nCALL:corpus_search | mcp_list_tools | mcp_call (ARGS:{…}; evidence only — workbook authority)\nCALL:lib.fs.read_text|exists|list_dir | lib.json.parse|stringify | lib.sys.cwd (+ ARGS:{json})\nREAD:source | stderr | stdout | slots | skill\nCreate tools: CONTINUE PATCH add ##, or CALL:scratch_tool_write with NAME line and fenced body.\n","e_rev":"\n\n--- how to act ---\nPlan-and-Move parent. Reply with ONE protocol only (no long reasoning). Exactly one DECISION line.\n1) exit_code=0 and has_value → DECISION: DONE + one-line SUMMARY. solidify_on_done. Do not CONTINUE just because has_worker_step.\n2) Need more evidence → READ:kind or CALL:tool (then you will be re-prompted).\n3) Failure / wrong value → DECISION: CONTINUE + short PATCH (<20 lines). Never paste user prose into REPLACE.\n4) Do NOT CONTINUE only to rewrite frontmatter imports; skeleton already uses nested import: map (llm/agent/json…).\nPATCH must use triple-angle blocks only:\n<<<\nFIND\n\n===\nREPLACE\n\n>>>\nDo not use \u0060\u0060\u0060find, \u0060\u0060\u0060replace, or *** Begin Patch ***.\nProtocols:\nCALL:name\nREAD:kind\nDECISION: DONE\nSUMMARY: one line\nDECISION: CONTINUE\n","e_dec":"\n\n--- how to act ---\nPRE-RUN decompose. Reply with ONE protocol only (no long reasoning). Exactly one DECISION line.\n1) Skeleton OK → DECISION: RUN (preferred). Do not rewrite imports; they are already nested import: (llm/agent/…).\n2) Need evidence → READ:source or READ:skill or CALL:workbook_read / lib_catalog / corpus_search / mcp_call.\n3) Reshape body/logic only → DECISION: CONTINUE + short PATCH (<20 lines).\n4) Fixed answer without LLM → PATCH to return, then RUN or DONE.\nPATCH must use <<< FIND === REPLACE >>> only (no \u0060\u0060\u0060find / Begin Patch).\nProtocols:\nCALL:name\nREAD:kind\nDECISION: RUN\nDECISION: DONE\nSUMMARY: one line\nDECISION: CONTINUE\n","f":"\n\n--- explore ---\n"}** **a = > json.get value=`esc` key="a"** **b = > json.get value=`esc` key="b"** **c = > json.get value=`esc` key="c"** diff --git a/ext/ai/llm.mq.md b/ext/ai/llm.mq.md index 8fca3cc..392d5a8 100644 --- a/ext/ai/llm.mq.md +++ b/ext/ai/llm.mq.md @@ -3,12 +3,13 @@ title: ext/ai/llm description: >- Marqdo LLM intelligence primitive — ask / stream / collect / named handles. OpenAI-compatible and Ollama HTTP stay behind the semantic surface. -import sys:lib/sys.mq.md -import json:lib/json.mq.md -import table:lib/table.mq.md -import fs:lib/fs.mq.md -import text:lib/text.mq.md -import openai:ext/ai/llm/openai.mq.md +import: + sys: lib/sys.mq.md + json: lib/json.mq.md + table: lib/table.mq.md + fs: lib/fs.mq.md + text: lib/text.mq.md + openai: ext/ai/llm/openai.mq.md --- ## load_env diff --git a/ext/ai/llm/ollama.mq.md b/ext/ai/llm/ollama.mq.md index 2866bf9..18cf1f3 100644 --- a/ext/ai/llm/ollama.mq.md +++ b/ext/ai/llm/ollama.mq.md @@ -2,8 +2,9 @@ title: ext/ai/llm/ollama description: >- Ollama backend defaults. Transport reuses openai-compatible /v1 chat completions. -import openai:ext/ai/llm/openai.mq.md -import sys:lib/sys.mq.md +import: + openai: ext/ai/llm/openai.mq.md + sys: lib/sys.mq.md --- ## resolve diff --git a/ext/ai/llm/openai.mq.md b/ext/ai/llm/openai.mq.md index 2b9ca98..7b3d811 100644 --- a/ext/ai/llm/openai.mq.md +++ b/ext/ai/llm/openai.mq.md @@ -6,11 +6,12 @@ description: >- Prefers optional plugins/llm ABI when present; falls back to lib/net. Used by ext/ai/llm; authors should prefer llm.ask / llm.stream. Result packs are GFM tables / table.put (code-as-documentation). -import net:lib/net.mq.md -import json:lib/json.mq.md -import table:lib/table.mq.md -import sys:lib/sys.mq.md -import plugin:lib/plugin.mq.md +import: + net: lib/net.mq.md + json: lib/json.mq.md + table: lib/table.mq.md + sys: lib/sys.mq.md + plugin: lib/plugin.mq.md --- ## usage_from diff --git a/ext/ai/sandbox.mq.md b/ext/ai/sandbox.mq.md index 310f9e8..3520603 100644 --- a/ext/ai/sandbox.mq.md +++ b/ext/ai/sandbox.mq.md @@ -4,10 +4,11 @@ title: ext/ai/sandbox description: >- CoW trial workspace for AI-generated Marqdo: open / run / diff / commit. Native work lives in plugins/agent (`sandbox_*` → host_query). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import table:lib/table.mq.md -import fs:lib/fs.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + table: lib/table.mq.md + fs: lib/fs.mq.md --- Load the agent plugin once per call (same pattern as other `ext/ai` helpers). diff --git a/ext/ai/大模型.mq.md b/ext/ai/大模型.mq.md index 0ef0cdb..86cca78 100644 --- a/ext/ai/大模型.mq.md +++ b/ext/ai/大模型.mq.md @@ -3,11 +3,12 @@ title: ext/ai/大模型 description: >- Marqdo 大模型智能原语 — 提问 / 流式 / 收集 / 命名句柄。 OpenAI 兼容与 Ollama HTTP 藏在语义面之后。 -导入 系统:lib/系统.mq.md -import json:lib/json.mq.md -导入 文件:lib/文件.mq.md -导入 文本:lib/文本.mq.md -import openai:ext/ai/llm/openai.mq.md +导入: + 系统: lib/系统.mq.md + json: lib/json.mq.md + 文件: lib/文件.mq.md + 文本: lib/文本.mq.md + openai: ext/ai/llm/openai.mq.md --- ## 加载环境 diff --git a/ext/ai/智能体.mq.md b/ext/ai/智能体.mq.md index 399929f..1a856f7 100644 --- a/ext/ai/智能体.mq.md +++ b/ext/ai/智能体.mq.md @@ -1,15 +1,16 @@ --- title: ext/ai/智能体 description: 文档驱动智能体 v2 — 单步 / 多步 / 运行;技能编译经 ABI v2 agent 插件(情景 → 学习 → llm_free)。 -导入 大模型:ext/ai/大模型.mq.md -import agent:ext/ai/agent.mq.md -import sandbox:ext/ai/sandbox.mq.md -import table:lib/table.mq.md -import json:lib/json.mq.md -导入 系统:lib/系统.mq.md -导入 自写回:lib/自写回.mq.md -导入 子任务:lib/子任务.mq.md -导入 插件:lib/插件.mq.md +导入: + 大模型: ext/ai/大模型.mq.md + agent: ext/ai/agent.mq.md + sandbox: ext/ai/sandbox.mq.md + table: lib/table.mq.md + json: lib/json.mq.md + 系统: lib/系统.mq.md + 自写回: lib/自写回.mq.md + 子任务: lib/子任务.mq.md + 插件: lib/插件.mq.md --- ## 构建单步上下文 diff --git a/ext/ai/沙盒.mq.md b/ext/ai/沙盒.mq.md index 8e7afa2..5f434c8 100644 --- a/ext/ai/沙盒.mq.md +++ b/ext/ai/沙盒.mq.md @@ -2,7 +2,8 @@ title: ext/ai/沙盒 description: >- AI 试跑 CoW 工作区:打开 / 运行 / 差异 / 提交(中文面,委托英文 sandbox 模块)。 -import sandbox:ext/ai/sandbox.mq.md +import: + sandbox: ext/ai/sandbox.mq.md --- ## 打开 diff --git a/ext/data/cache.mq.md b/ext/data/cache.mq.md index 07418f0..66b8ab1 100644 --- a/ext/data/cache.mq.md +++ b/ext/data/cache.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: ext/data/cache description: Cache Resource (ADR 0007). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import table:lib/table.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + table: lib/table.mq.md --- ## _load diff --git a/ext/data/db.mq.md b/ext/data/db.mq.md index 5b31cb3..9bcd0f8 100644 --- a/ext/data/db.mq.md +++ b/ext/data/db.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: ext/data/db description: Database Resource — CRUD, txn, migrate, FTS (ADR 0007). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import table:lib/table.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + table: lib/table.mq.md --- ## _load diff --git a/ext/data/form.mq.md b/ext/data/form.mq.md index ade3f52..b62b513 100644 --- a/ext/data/form.mq.md +++ b/ext/data/form.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: ext/data/form description: Form Resource — fields, validate, submit (ADR 0007). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import table:lib/table.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + table: lib/table.mq.md --- ## _load diff --git a/ext/data/storage.mq.md b/ext/data/storage.mq.md index 97bddc3..c6cb610 100644 --- a/ext/data/storage.mq.md +++ b/ext/data/storage.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: ext/data/storage description: Object storage Resource (ADR 0007). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import table:lib/table.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + table: lib/table.mq.md --- ## _load diff --git a/ext/linalg/linalg.mq.md b/ext/linalg/linalg.mq.md index 230b5ff..1aa3a0e 100644 --- a/ext/linalg/linalg.mq.md +++ b/ext/linalg/linalg.mq.md @@ -1,8 +1,9 @@ --- title: ext/linalg/linalg description: Formula-first linear algebra (English). MatExpr simplify + display; ABI plugin. -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- Formula-first linear algebra (English). MatExpr simplify + display; ABI plugin. diff --git a/ext/linalg/线性代数.mq.md b/ext/linalg/线性代数.mq.md index eab4c11..d8747d4 100644 --- a/ext/linalg/线性代数.mq.md +++ b/ext/linalg/线性代数.mq.md @@ -1,8 +1,9 @@ --- title: ext/linalg/线性代数 description: 公式优先的线性代数(中文)。矩阵表达式化简与展示;ABI 插件。 -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- 公式优先的线性代数(中文)。矩阵表达式化简与展示;ABI 插件。 diff --git a/ext/net/http.mq.md b/ext/net/http.mq.md index 68052f2..2500e61 100644 --- a/ext/net/http.mq.md +++ b/ext/net/http.mq.md @@ -1,8 +1,9 @@ --- title: ext/net/http description: HTTP primitives surface for Web Runtime (ADR 0007). Prefer Document/Endpoint Artifacts over raw calls. -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- ## _load diff --git a/ext/net/url.mq.md b/ext/net/url.mq.md index fdf31e8..8e555f9 100644 --- a/ext/net/url.mq.md +++ b/ext/net/url.mq.md @@ -1,7 +1,8 @@ --- title: ext/net/url description: URL helpers (stdlib wrappers). ADR 0007. -import net:lib/net.mq.md +import: + net: lib/net.mq.md --- ## encode diff --git a/ext/net/websocket.mq.md b/ext/net/websocket.mq.md index cdd2d64..0bb25f8 100644 --- a/ext/net/websocket.mq.md +++ b/ext/net/websocket.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: ext/net/websocket description: WebSocket client Resource (ADR 0007). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import table:lib/table.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + table: lib/table.mq.md --- ## _load diff --git a/ext/quantum/quantum.mq.md b/ext/quantum/quantum.mq.md index 10d2b1c..d3c8232 100644 --- a/ext/quantum/quantum.mq.md +++ b/ext/quantum/quantum.mq.md @@ -1,9 +1,10 @@ --- title: ext/quantum/quantum description: Official quantum circuit simulator (English). Gates + circuits; ABI plugin. -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import json:lib/json.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + json: lib/json.mq.md --- Official quantum circuit simulator (English). Gates + circuits; ABI plugin. diff --git a/ext/quantum/量子.mq.md b/ext/quantum/量子.mq.md index bdb9b56..f471ce6 100644 --- a/ext/quantum/量子.mq.md +++ b/ext/quantum/量子.mq.md @@ -1,9 +1,10 @@ --- title: ext/quantum/量子 description: 官方量子电路模拟(中文)。门 + 电路;ABI 插件。 -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import json:lib/json.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + json: lib/json.mq.md --- 官方量子电路模拟(中文)。门 + 电路;ABI 插件。 diff --git a/ext/security/auth.mq.md b/ext/security/auth.mq.md index 4bd2db4..1d4d200 100644 --- a/ext/security/auth.mq.md +++ b/ext/security/auth.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: ext/security/auth description: Auth Resource (ADR 0007). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import table:lib/table.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + table: lib/table.mq.md --- ## _load diff --git a/ext/security/oidc.mq.md b/ext/security/oidc.mq.md index 095ef0b..f06a15c 100644 --- a/ext/security/oidc.mq.md +++ b/ext/security/oidc.mq.md @@ -1,8 +1,9 @@ --- title: ext/security/oidc description: OIDC attach helper for app handles (ADR 0007). Prefer declared auth metadata on Endpoints. -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- ## _load diff --git a/ext/security/rbac.mq.md b/ext/security/rbac.mq.md index 6cfe05f..a9ed2f3 100644 --- a/ext/security/rbac.mq.md +++ b/ext/security/rbac.mq.md @@ -1,9 +1,10 @@ --- title: ext/security/rbac description: RBAC Resource (ADR 0007). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import table:lib/table.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + table: lib/table.mq.md --- ## _load diff --git a/ext/web/_capability.mq.md b/ext/web/_capability.mq.md index 31ccb88..5a99d13 100644 --- a/ext/web/_capability.mq.md +++ b/ext/web/_capability.mq.md @@ -1,8 +1,9 @@ --- title: ext/web/_capability description: Internal — load native web plugin once. Authors must not call this; import web = capability (ADR 0007). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- ## load diff --git a/ext/web/client.mq.md b/ext/web/client.mq.md index 6b84380..d0da3bd 100644 --- a/ext/web/client.mq.md +++ b/ext/web/client.mq.md @@ -1,8 +1,9 @@ --- title: ext/web/client description: Browser Runtime helpers (WASM bridge). Prefer lib/browser for effect tables (ADR 0007). -import cap:ext/web/_capability.mq.md -import table:lib/table.mq.md +import: + cap: ext/web/_capability.mq.md + table: lib/table.mq.md --- ## embed diff --git a/ext/web/component.mq.md b/ext/web/component.mq.md index f3bd393..1e78926 100644 --- a/ext/web/component.mq.md +++ b/ext/web/component.mq.md @@ -1,7 +1,8 @@ --- title: ext/web/component description: Reusable Document fragments as View node tables (ADR 0007). -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- ## nodes diff --git a/ext/web/dom.mq.md b/ext/web/dom.mq.md index 1d5b76a..e39c65e 100644 --- a/ext/web/dom.mq.md +++ b/ext/web/dom.mq.md @@ -1,8 +1,9 @@ --- title: ext/web/dom description: DOM Artifact — Markdown/body to structure; raw HTML is escape hatch only (ADR 0007). -import cap:ext/web/_capability.mq.md -import table:lib/table.mq.md +import: + cap: ext/web/_capability.mq.md + table: lib/table.mq.md --- ## from_markdown diff --git a/ext/web/page.mq.md b/ext/web/page.mq.md index 4f65fca..7954ef7 100644 --- a/ext/web/page.mq.md +++ b/ext/web/page.mq.md @@ -1,8 +1,9 @@ --- title: ext/web/page description: Document → View. Sole compose path is render(nodes=) with unified View schema (ADR 0007). -import cap:ext/web/_capability.mq.md -import table:lib/table.mq.md +import: + cap: ext/web/_capability.mq.md + table: lib/table.mq.md --- # page diff --git a/ext/web/route.mq.md b/ext/web/route.mq.md index 1b4885d..6215d48 100644 --- a/ext/web/route.mq.md +++ b/ext/web/route.mq.md @@ -1,8 +1,9 @@ --- title: ext/web/route description: Declared Endpoint / Document route registration (ADR 0007). -import cap:ext/web/_capability.mq.md -import table:lib/table.mq.md +import: + cap: ext/web/_capability.mq.md + table: lib/table.mq.md --- # route diff --git a/ext/web/web.mq.md b/ext/web/web.mq.md index c6c334e..b3eef6d 100644 --- a/ext/web/web.mq.md +++ b/ext/web/web.mq.md @@ -3,12 +3,13 @@ title: ext/web/web description: >- Web Artifact facade (ADR 0007) — page · route · serve · render · inspect · use. Document/Endpoint first-class. No compose_* / configure / author ensure_plugin. -import cap:ext/web/_capability.mq.md -import page_mod:ext/web/page.mq.md -import route_mod:ext/web/route.mq.md -import dom_mod:ext/web/dom.mq.md -import client_mod:ext/web/client.mq.md -import table:lib/table.mq.md +import: + cap: ext/web/_capability.mq.md + page_mod: ext/web/page.mq.md + route_mod: ext/web/route.mq.md + dom_mod: ext/web/dom.mq.md + client_mod: ext/web/client.mq.md + table: lib/table.mq.md --- Importing this module is the web **capability** (native plugin loads on first facade call). diff --git a/ext/web/网页.mq.md b/ext/web/网页.mq.md index 232850d..624ff8d 100644 --- a/ext/web/网页.mq.md +++ b/ext/web/网页.mq.md @@ -3,7 +3,8 @@ title: ext/web/网页 description: >- Web Artifact 中文 facade(ADR 0007)— 页面 · 路由 · 服务 · 渲染 · 检视 · 使用。 禁止 compose_* / configure / 作者侧确保插件。 -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- ## 页面 diff --git a/lib/browser.mq.md b/lib/browser.mq.md index fcf6738..3512742 100644 --- a/lib/browser.mq.md +++ b/lib/browser.mq.md @@ -3,7 +3,8 @@ title: lib/browser description: >- Readable browser effect helpers for WASM clients. Prefer GFM tables + these helpers; do not build effects with json.set chains. -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- Readable browser effect helpers for WASM clients. Prefer GFM tables + these helpers; do not build effects with json.set chains. diff --git a/lib/foreign.mq.md b/lib/foreign.mq.md index bb0d757..09010a5 100644 --- a/lib/foreign.mq.md +++ b/lib/foreign.mq.md @@ -1,7 +1,8 @@ --- title: lib/foreign description: Run bound code fences and inline sources via local interpreters -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- Run bound code fences and inline sources via local interpreters. diff --git a/lib/外联.mq.md b/lib/外联.mq.md index 1235535..02777a2 100644 --- a/lib/外联.mq.md +++ b/lib/外联.mq.md @@ -1,7 +1,8 @@ --- title: lib/外联 description: 通过本机解释器运行绑定的代码围栏与内联源码 -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- 通过本机解释器运行绑定的代码围栏与内联源码。 diff --git a/lib/浏览器.mq.md b/lib/浏览器.mq.md index b25691f..da1c378 100644 --- a/lib/浏览器.mq.md +++ b/lib/浏览器.mq.md @@ -2,7 +2,8 @@ title: lib/浏览器 description: >- 浏览器效应助手(WASM 客户端)。优先 GFM 表格 + 本库;勿用 json.set 链拼效应。 -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- 浏览器效应助手(WASM 客户端)。优先 GFM 表格 + 本库;勿用 json.set 链拼效应。 diff --git a/man-test/ext/agent-plan.mq.md b/man-test/ext/agent-plan.mq.md index 8e6e1df..27d974c 100644 --- a/man-test/ext/agent-plan.mq.md +++ b/man-test/ext/agent-plan.mq.md @@ -1,10 +1,11 @@ --- title: ext/agent plan live (DeepSeek) description: Full plan loop — spawn workbook, inspect; simple pong goal. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md --- # main diff --git a/man-test/lib/math.mq.md b/man-test/lib/math.mq.md index f791e07..3e47fdc 100644 --- a/man-test/lib/math.mq.md +++ b/man-test/lib/math.mq.md @@ -1,7 +1,8 @@ --- title: 手工构造的测试样例 description: AI禁止更改 -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/man-test/lib/writeback.mq.md b/man-test/lib/writeback.mq.md index 0f6c4e5..6e5da26 100644 --- a/man-test/lib/writeback.mq.md +++ b/man-test/lib/writeback.mq.md @@ -1,7 +1,8 @@ --- title: 手工构造的测试样例 description: AI禁止更改 -import writeback:lib/writeback.mq.md +import: + writeback: lib/writeback.mq.md --- # main diff --git a/public/00-welcome.mq.md b/public/00-welcome.mq.md index 10164d4..7f5f738 100644 --- a/public/00-welcome.mq.md +++ b/public/00-welcome.mq.md @@ -2,8 +2,9 @@ markup: occlusion title: Welcome to Marqdo description: User-docs home — code as documentation (English) -import math:lib/math.mq.md -import foreign:lib/foreign.mq.md +import: + math: lib/math.mq.md + foreign: lib/foreign.mq.md --- # main diff --git a/public/00-欢迎.mq.md b/public/00-欢迎.mq.md index aaf3795..0a32c77 100644 --- a/public/00-欢迎.mq.md +++ b/public/00-欢迎.mq.md @@ -2,8 +2,9 @@ markup: occlusion title: 欢迎使用 Marqdo description: 用户文档首页 — 代码即文档(中文版) -导入 数学:lib/数学.mq.md -导入 外联:lib/外联.mq.md +导入: + 数学: lib/数学.mq.md + 外联: lib/外联.mq.md --- # main diff --git a/public/features/06-quantum.mq.md b/public/features/06-quantum.mq.md index 1bc50de..1143a31 100644 --- a/public/features/06-quantum.mq.md +++ b/public/features/06-quantum.mq.md @@ -1,7 +1,8 @@ --- title: Quantum circuits (ext/quantum) description: Official quantum simulator — tables, gates, Q7 density, Q8 themed SVG -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/public/features/06-量子.mq.md b/public/features/06-量子.mq.md index 909861a..2e1215c 100644 --- a/public/features/06-量子.mq.md +++ b/public/features/06-量子.mq.md @@ -1,7 +1,8 @@ --- title: 量子电路(ext/quantum) description: 官方量子模拟 — 表、门、Q7 密度与高级图、Q8 主题 SVG -导入 量子:ext/quantum/量子.mq.md +导入: + 量子: ext/quantum/量子.mq.md --- # main diff --git a/public/features/07-linalg.mq.md b/public/features/07-linalg.mq.md index cbae15e..598376e 100644 --- a/public/features/07-linalg.mq.md +++ b/public/features/07-linalg.mq.md @@ -1,7 +1,8 @@ --- title: How to write a linear-algebra formula document description: ext/linalg formula-doc — declare, infix, run-implies-correct -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # Formula documents with ext/linalg diff --git a/public/features/07-线性代数.mq.md b/public/features/07-线性代数.mq.md index 5fd51a5..9cbba72 100644 --- a/public/features/07-线性代数.mq.md +++ b/public/features/07-线性代数.mq.md @@ -1,7 +1,8 @@ --- title: 如何写线性代数公式文档 description: ext/linalg 公式文档面 — 声明、中缀、跑通即正确 -导入 la:ext/linalg/线性代数.mq.md +导入: + la: ext/linalg/线性代数.mq.md --- # 用 ext/linalg 写公式文档 diff --git a/public/features/08-re-encoding.mq.md b/public/features/08-re-encoding.mq.md index fc34afa..1ead15b 100644 --- a/public/features/08-re-encoding.mq.md +++ b/public/features/08-re-encoding.mq.md @@ -1,8 +1,9 @@ --- title: Mid stdlib — regex and encoding description: lib/re + lib/encoding without plugins (Mid M1) -import re:lib/re.mq.md -import enc:lib/encoding.mq.md +import: + re: lib/re.mq.md + enc: lib/encoding.mq.md --- # Regex and encoding in lib/ diff --git a/public/features/08-正则编解码.mq.md b/public/features/08-正则编解码.mq.md index 4696862..304b415 100644 --- a/public/features/08-正则编解码.mq.md +++ b/public/features/08-正则编解码.mq.md @@ -1,8 +1,9 @@ --- title: 中层标准库 — 正则与编解码 description: lib/正则 + lib/编码,无需插件(中层 M1) -导入 正则:lib/正则.mq.md -导入 编码:lib/编码.mq.md +导入: + 正则: lib/正则.mq.md + 编码: lib/编码.mq.md --- # 标准库中的正则与编解码 diff --git a/public/features/09-path-fs.mq.md b/public/features/09-path-fs.mq.md index 7d53b97..0fe6bf6 100644 --- a/public/features/09-path-fs.mq.md +++ b/public/features/09-path-fs.mq.md @@ -1,8 +1,9 @@ --- title: Mid stdlib — path and fs description: lib/path + fs copy/move/temp (Mid M2) -import path:lib/path.mq.md -import fs:lib/fs.mq.md +import: + path: lib/path.mq.md + fs: lib/fs.mq.md --- # Path algebra and file mid-layer diff --git a/public/features/09-路径文件.mq.md b/public/features/09-路径文件.mq.md index 36a9c57..c9684ca 100644 --- a/public/features/09-路径文件.mq.md +++ b/public/features/09-路径文件.mq.md @@ -1,8 +1,9 @@ --- title: 中层标准库 — 路径与文件 description: lib/路径 + 文件复制/移动/临时(中层 M2) -导入 路径:lib/路径.mq.md -导入 文件:lib/文件.mq.md +导入: + 路径: lib/路径.mq.md + 文件: lib/文件.mq.md --- # 路径代数与文件中层 diff --git a/public/features/10-hash-secrets.mq.md b/public/features/10-hash-secrets.mq.md index 154bc1c..99c5b75 100644 --- a/public/features/10-hash-secrets.mq.md +++ b/public/features/10-hash-secrets.mq.md @@ -1,8 +1,9 @@ --- title: Mid stdlib — hash and secrets description: lib/hash + lib/secrets without plugins (Mid M3) -import hash:lib/hash.mq.md -import sec:lib/secrets.mq.md +import: + hash: lib/hash.mq.md + sec: lib/secrets.mq.md --- # Digests and secure tokens diff --git a/public/features/10-哈希机密.mq.md b/public/features/10-哈希机密.mq.md index 1afbbb2..8184e9e 100644 --- a/public/features/10-哈希机密.mq.md +++ b/public/features/10-哈希机密.mq.md @@ -1,8 +1,9 @@ --- title: 中层标准库 — 哈希与机密 description: lib/哈希 + lib/机密,无需插件(中层 M3) -导入 哈希:lib/哈希.mq.md -导入 机密:lib/机密.mq.md +导入: + 哈希: lib/哈希.mq.md + 机密: lib/机密.mq.md --- # 摘要与安全令牌 diff --git a/public/features/11-csv-text.mq.md b/public/features/11-csv-text.mq.md index b76a3b8..dc4ed43 100644 --- a/public/features/11-csv-text.mq.md +++ b/public/features/11-csv-text.mq.md @@ -2,8 +2,9 @@ markup: occlusion title: Mid stdlib — csv and text description: lib/csv + thickened lib/text (Mid M4) -import csv:lib/csv.mq.md -import text:lib/text.mq.md +import: + csv: lib/csv.mq.md + text: lib/text.mq.md --- # CSV cleaning with text helpers diff --git a/public/features/11-逗号表文本.mq.md b/public/features/11-逗号表文本.mq.md index c7b9e86..9e46b40 100644 --- a/public/features/11-逗号表文本.mq.md +++ b/public/features/11-逗号表文本.mq.md @@ -2,8 +2,9 @@ markup: occlusion title: 中层标准库 — 逗号表与文本 description: lib/逗号表 + 加厚 lib/文本(中层 M4) -导入 逗号表:lib/逗号表.mq.md -导入 文本:lib/文本.mq.md +导入: + 逗号表: lib/逗号表.mq.md + 文本: lib/文本.mq.md --- # 用文本助手清洗 CSV diff --git a/public/features/12-list-cli.mq.md b/public/features/12-list-cli.mq.md index 9273199..ea1a859 100644 --- a/public/features/12-list-cli.mq.md +++ b/public/features/12-list-cli.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: Mid stdlib — lists and cli description: table sort/unique/zip + cli.parse (Mid M5) -import table:lib/table.mq.md -import csv:lib/csv.mq.md -import cli:lib/cli.mq.md +import: + table: lib/table.mq.md + csv: lib/csv.mq.md + cli: lib/cli.mq.md --- # Sort CSV rows and parse flags diff --git a/public/features/12-列表命令行.mq.md b/public/features/12-列表命令行.mq.md index 7793f5a..fa1173d 100644 --- a/public/features/12-列表命令行.mq.md +++ b/public/features/12-列表命令行.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: 中层标准库 — 列表与命令行 description: 表排序/去重 + 命令行解析(中层 M5) -导入 表:lib/表.mq.md -导入 逗号表:lib/逗号表.mq.md -导入 命令行:lib/命令行.mq.md +导入: + 表: lib/表.mq.md + 逗号表: lib/逗号表.mq.md + 命令行: lib/命令行.mq.md --- # 排序 CSV 并解析参数 diff --git a/public/features/13-log-uuid.mq.md b/public/features/13-log-uuid.mq.md index 1c3bf0a..8fadc88 100644 --- a/public/features/13-log-uuid.mq.md +++ b/public/features/13-log-uuid.mq.md @@ -1,8 +1,9 @@ --- title: Mid stdlib — log and uuid description: Level-filtered logs + UUID v4 (Mid M6) -import log:lib/log.mq.md -import uuid:lib/uuid.mq.md +import: + log: lib/log.mq.md + uuid: lib/uuid.mq.md --- # Observable scripts without plugins diff --git a/public/features/13-日志标识.mq.md b/public/features/13-日志标识.mq.md index 10555e3..b870379 100644 --- a/public/features/13-日志标识.mq.md +++ b/public/features/13-日志标识.mq.md @@ -1,8 +1,9 @@ --- title: 中层标准库 — 日志与标识 description: 按级别过滤的日志 + UUID 版本4(中层 M6) -导入 日志:lib/日志.mq.md -导入 标识:lib/标识.mq.md +导入: + 日志: lib/日志.mq.md + 标识: lib/标识.mq.md --- # 无插件的可观测脚本 diff --git a/public/features/14-datetime-url.mq.md b/public/features/14-datetime-url.mq.md index 3d9fee0..2199e61 100644 --- a/public/features/14-datetime-url.mq.md +++ b/public/features/14-datetime-url.mq.md @@ -2,8 +2,9 @@ markup: occlusion title: Mid stdlib — datetime and url description: Calendar moments + URL/query parse (Mid2 M7) -import dt:lib/datetime.mq.md -import url:lib/url.mq.md +import: + dt: lib/datetime.mq.md + url: lib/url.mq.md --- # Time and addresses without plugins diff --git a/public/features/14-日期时间地址.mq.md b/public/features/14-日期时间地址.mq.md index 3b221c1..1df041a 100644 --- a/public/features/14-日期时间地址.mq.md +++ b/public/features/14-日期时间地址.mq.md @@ -2,8 +2,9 @@ markup: occlusion title: 中层标准库 — 日期时间与地址 description: 日历时刻 + URL/查询串(Mid2 M7) -导入 日时:lib/日期时间.mq.md -导入 址:lib/地址.mq.md +导入: + 日时: lib/日期时间.mq.md + 址: lib/地址.mq.md --- # 无需插件的时间与地址 diff --git a/public/features/15-toml-html-encoding.mq.md b/public/features/15-toml-html-encoding.mq.md index bbc331e..9bf1f60 100644 --- a/public/features/15-toml-html-encoding.mq.md +++ b/public/features/15-toml-html-encoding.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: Mid stdlib — toml, html, base32 description: Config TOML + HTML escape + base32 (Mid2 M8) -import toml:lib/toml.mq.md -import html:lib/html.mq.md -import enc:lib/encoding.mq.md +import: + toml: lib/toml.mq.md + html: lib/html.mq.md + enc: lib/encoding.mq.md --- # Config and safe text without plugins diff --git a/public/features/15-配置表超文本编码.mq.md b/public/features/15-配置表超文本编码.mq.md index 8460d37..27b70f6 100644 --- a/public/features/15-配置表超文本编码.mq.md +++ b/public/features/15-配置表超文本编码.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: 中层标准库 — 配置表、超文本、基32 description: TOML 配置 + HTML 转义 + base32(Mid2 M8) -导入 配置:lib/配置表.mq.md -导入 超:lib/超文本.mq.md -导入 编:lib/编码.mq.md +导入: + 配置: lib/配置表.mq.md + 超: lib/超文本.mq.md + 编: lib/编码.mq.md --- # 无需插件的配置与安全字面 diff --git a/public/features/16-fs-mid2.mq.md b/public/features/16-fs-mid2.mq.md index 01bec4f..a780fe5 100644 --- a/public/features/16-fs-mid2.mq.md +++ b/public/features/16-fs-mid2.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: Mid stdlib — fs make_dirs, walk, stat description: Recursive dirs, walk, and file metadata (Mid2 M9) -import fs:lib/fs.mq.md +import: + fs: lib/fs.mq.md --- # Practical filesystem without plugins diff --git a/public/features/16-文件mid2.mq.md b/public/features/16-文件mid2.mq.md index 63f637e..40d2658 100644 --- a/public/features/16-文件mid2.mq.md +++ b/public/features/16-文件mid2.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: 中层标准库 — 文件目录树与状态 description: 递归目录、遍历与元数据(Mid2 M9) -导入 文件:lib/文件.mq.md +导入: + 文件: lib/文件.mq.md --- # 无需插件的实用文件系统 diff --git a/public/features/17-stats-log.mq.md b/public/features/17-stats-log.mq.md index 9083373..21b7c4e 100644 --- a/public/features/17-stats-log.mq.md +++ b/public/features/17-stats-log.mq.md @@ -1,8 +1,9 @@ --- title: Mid stdlib — stats and log fields description: Thin mean/median/stdev + structured log fields (Mid2 M10) -import stats:lib/stats.mq.md -import log:lib/log.mq.md +import: + stats: lib/stats.mq.md + log: lib/log.mq.md --- # Closing Mid2 sugar diff --git a/public/features/17-统计日志.mq.md b/public/features/17-统计日志.mq.md index bda51e3..15824f6 100644 --- a/public/features/17-统计日志.mq.md +++ b/public/features/17-统计日志.mq.md @@ -1,8 +1,9 @@ --- title: 中层标准库 — 统计与日志字段 description: 薄均值/中位数/标准差 + 日志 fields(Mid2 M10) -导入 统计:lib/统计.mq.md -导入 日志:lib/日志.mq.md +导入: + 统计: lib/统计.mq.md + 日志: lib/日志.mq.md --- # Mid2 收口糖 diff --git a/public/features/19-foreign-view-cells.mq.md b/public/features/19-foreign-view-cells.mq.md index 349a974..4aa27c6 100644 --- a/public/features/19-foreign-view-cells.mq.md +++ b/public/features/19-foreign-view-cells.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: Foreign kernels v2 — Python analysis in view description: Kernel state, Marqdo-to-kernel values and view cells — without a stdin-only demo -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/public/features/19-外联视图单元.mq.md b/public/features/19-外联视图单元.mq.md index 75dcdce..ad489f2 100644 --- a/public/features/19-外联视图单元.mq.md +++ b/public/features/19-外联视图单元.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: 外联内核 v2 — Python 分析(view 单元) description: 内核态、Marqdo 值传入与 view 单元 —— 不依赖 stdin 的完整示例 -导入 外联:lib/外联.mq.md +导入: + 外联: lib/外联.mq.md --- # main diff --git a/public/features/21-persistence.mq.md b/public/features/21-persistence.mq.md index af85d59..de61de1 100644 --- a/public/features/21-persistence.mq.md +++ b/public/features/21-persistence.mq.md @@ -1,8 +1,9 @@ --- title: Persisting foreign execution results description: Static snapshots and writeback — how foreign results survive after the process exits -import foreign:lib/foreign.mq.md -import writeback:lib/writeback.mq.md +import: + foreign: lib/foreign.mq.md + writeback: lib/writeback.mq.md --- # main diff --git a/public/features/21-持久化.mq.md b/public/features/21-持久化.mq.md index 8036fd4..c58f0ad 100644 --- a/public/features/21-持久化.mq.md +++ b/public/features/21-持久化.mq.md @@ -1,8 +1,9 @@ --- title: 外联执行结果的持久化 description: 静态快照与自写回 —— 外联结果在进程退出后如何保留 -导入 外联:lib/外联.mq.md -import writeback:lib/writeback.mq.md +导入: + 外联: lib/外联.mq.md + writeback: lib/writeback.mq.md --- # main diff --git a/public/stdlib/foreign.mq.md b/public/stdlib/foreign.mq.md index 45b20c4..26439ef 100644 --- a/public/stdlib/foreign.mq.md +++ b/public/stdlib/foreign.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: lib/foreign — foreign kernels v2 description: Structured execution, JSON calls, parallel fan-out, persistent kernels and an explicit state bridge -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md stdin: 21 --- diff --git a/public/stdlib/fs.mq.md b/public/stdlib/fs.mq.md index c8266a6..65f8e51 100644 --- a/public/stdlib/fs.mq.md +++ b/public/stdlib/fs.mq.md @@ -1,7 +1,8 @@ --- title: lib/fs — files description: Read and write text under the sandbox -import fs:lib/fs.mq.md +import: + fs: lib/fs.mq.md --- # main diff --git a/public/stdlib/json.mq.md b/public/stdlib/json.mq.md index 7519317..bc8f234 100644 --- a/public/stdlib/json.mq.md +++ b/public/stdlib/json.mq.md @@ -1,7 +1,8 @@ --- title: lib/json — JSON description: Shared EN/ZH path; parse and stringify (code-as-docs pilot) -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/public/stdlib/math.mq.md b/public/stdlib/math.mq.md index a922977..41ee668 100644 --- a/public/stdlib/math.mq.md +++ b/public/stdlib/math.mq.md @@ -1,7 +1,8 @@ --- title: lib/math — numbers, formulas, plots description: High-school math stdlib (English) -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/public/stdlib/net.mq.md b/public/stdlib/net.mq.md index 7bfcb03..ab03842 100644 --- a/public/stdlib/net.mq.md +++ b/public/stdlib/net.mq.md @@ -1,7 +1,8 @@ --- title: lib/net — HTTP(S) description: Minimal HTTP(S) client and URL encode -import net:lib/net.mq.md +import: + net: lib/net.mq.md --- # main diff --git a/public/stdlib/plugin.mq.md b/public/stdlib/plugin.mq.md index 40e814c..510d586 100644 --- a/public/stdlib/plugin.mq.md +++ b/public/stdlib/plugin.mq.md @@ -1,7 +1,8 @@ --- title: lib/plugin — native ABI description: Load optional shared libraries (.dll / .so / .dylib) -import plugin:lib/plugin.mq.md +import: + plugin: lib/plugin.mq.md --- # main diff --git a/public/stdlib/subtask.mq.md b/public/stdlib/subtask.mq.md index fccc4a7..0d64b8e 100644 --- a/public/stdlib/subtask.mq.md +++ b/public/stdlib/subtask.mq.md @@ -1,7 +1,8 @@ --- title: lib/subtask — concurrent tasks description: Spawn file, function, or foreign code in parallel -import subtask:lib/subtask.mq.md +import: + subtask: lib/subtask.mq.md --- # main diff --git a/public/stdlib/sys.mq.md b/public/stdlib/sys.mq.md index e3cfe3e..4e8ef79 100644 --- a/public/stdlib/sys.mq.md +++ b/public/stdlib/sys.mq.md @@ -1,7 +1,8 @@ --- title: lib/sys — process description: Env, dotenv, cwd, args, exit, exec -import sys:lib/sys.mq.md +import: + sys: lib/sys.mq.md --- # main diff --git a/public/stdlib/table.mq.md b/public/stdlib/table.mq.md index 778a67b..bd8f2d5 100644 --- a/public/stdlib/table.mq.md +++ b/public/stdlib/table.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: lib/table — collections description: put, append, and map helpers (code-as-docs pilot) -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- # main diff --git a/public/stdlib/text.mq.md b/public/stdlib/text.mq.md index 2509e44..f95680d 100644 --- a/public/stdlib/text.mq.md +++ b/public/stdlib/text.mq.md @@ -1,7 +1,8 @@ --- title: lib/text — strings description: Trim, split, join (code-as-docs pilot) -import text:lib/text.mq.md +import: + text: lib/text.mq.md --- # main diff --git a/public/stdlib/time.mq.md b/public/stdlib/time.mq.md index aa0825b..8df2ba0 100644 --- a/public/stdlib/time.mq.md +++ b/public/stdlib/time.mq.md @@ -1,7 +1,8 @@ --- title: lib/time — clock description: Unix time, format, parse, sleep -import time:lib/time.mq.md +import: + time: lib/time.mq.md --- # main diff --git a/public/stdlib/writeback.mq.md b/public/stdlib/writeback.mq.md index 9f1581c..169d1e2 100644 --- a/public/stdlib/writeback.mq.md +++ b/public/stdlib/writeback.mq.md @@ -1,7 +1,8 @@ --- title: lib/writeback — Jupyter-style writeback description: Persist run output in the entry .mq.md file -import writeback:lib/writeback.mq.md +import: + writeback: lib/writeback.mq.md --- # main diff --git a/public/stdlib/外联.mq.md b/public/stdlib/外联.mq.md index 77b41b9..0b08dd8 100644 --- a/public/stdlib/外联.mq.md +++ b/public/stdlib/外联.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: lib/外联 — 外联内核 v2 description: 结构化执行、JSON 调用、并行扇出、持久内核与显式状态桥 -导入 外联:lib/外联.mq.md +导入: + 外联: lib/外联.mq.md stdin: 21 --- diff --git a/public/stdlib/子任务.mq.md b/public/stdlib/子任务.mq.md index 6bdfa14..c741c52 100644 --- a/public/stdlib/子任务.mq.md +++ b/public/stdlib/子任务.mq.md @@ -1,7 +1,8 @@ --- title: lib/子任务 — 并发子任务 description: 文件、函数或外联代码并行执行 -导入 子任务:lib/子任务.mq.md +导入: + 子任务: lib/子任务.mq.md --- # main diff --git a/public/stdlib/插件.mq.md b/public/stdlib/插件.mq.md index 5407246..395afcf 100644 --- a/public/stdlib/插件.mq.md +++ b/public/stdlib/插件.mq.md @@ -1,7 +1,8 @@ --- title: lib/插件 — 原生 ABI description: 加载可选共享库(.dll / .so / .dylib) -导入 插件:lib/插件.mq.md +导入: + 插件: lib/插件.mq.md --- # main diff --git a/public/stdlib/数学.mq.md b/public/stdlib/数学.mq.md index c6e5140..22a03dc 100644 --- a/public/stdlib/数学.mq.md +++ b/public/stdlib/数学.mq.md @@ -1,7 +1,8 @@ --- title: lib/数学 — 数值、公式、作图 description: 高中数学标准库(中文) -导入 数学:lib/数学.mq.md +导入: + 数学: lib/数学.mq.md --- # main diff --git a/public/stdlib/文件.mq.md b/public/stdlib/文件.mq.md index 81208b8..911cba4 100644 --- a/public/stdlib/文件.mq.md +++ b/public/stdlib/文件.mq.md @@ -1,7 +1,8 @@ --- title: lib/文件 — 文件系统 description: 沙箱内读写文本 -导入 文件:lib/文件.mq.md +导入: + 文件: lib/文件.mq.md --- # main diff --git a/public/stdlib/文本.mq.md b/public/stdlib/文本.mq.md index cc8eecb..916b830 100644 --- a/public/stdlib/文本.mq.md +++ b/public/stdlib/文本.mq.md @@ -1,7 +1,8 @@ --- title: lib/文本 — 字符串 description: 去空白、拆分、拼接(代码即文档试点) -导入 文本:lib/文本.mq.md +导入: + 文本: lib/文本.mq.md --- # main diff --git a/public/stdlib/时间.mq.md b/public/stdlib/时间.mq.md index bc02a6c..ffb2ceb 100644 --- a/public/stdlib/时间.mq.md +++ b/public/stdlib/时间.mq.md @@ -1,7 +1,8 @@ --- title: lib/时间 — 时钟 description: Unix 时间、格式化、解析、睡眠 -导入 时间:lib/时间.mq.md +导入: + 时间: lib/时间.mq.md --- # main diff --git a/public/stdlib/系统.mq.md b/public/stdlib/系统.mq.md index 9175ee4..7cd994a 100644 --- a/public/stdlib/系统.mq.md +++ b/public/stdlib/系统.mq.md @@ -1,7 +1,8 @@ --- title: lib/系统 — 进程 description: 环境变量、dotenv、工作目录、参数、退出、执行 -导入 系统:lib/系统.mq.md +导入: + 系统: lib/系统.mq.md --- # main diff --git a/public/stdlib/网络.mq.md b/public/stdlib/网络.mq.md index 78f80bf..daad6a1 100644 --- a/public/stdlib/网络.mq.md +++ b/public/stdlib/网络.mq.md @@ -1,7 +1,8 @@ --- title: lib/网络 — HTTP description: HTTP(S) 与地址编码 -导入 网络:lib/网络.mq.md +导入: + 网络: lib/网络.mq.md --- # main diff --git a/public/stdlib/自写回.mq.md b/public/stdlib/自写回.mq.md index d69ece0..1371327 100644 --- a/public/stdlib/自写回.mq.md +++ b/public/stdlib/自写回.mq.md @@ -1,7 +1,8 @@ --- title: lib/自写回 — Jupyter 式写回 description: 把运行结果写回入口 .mq.md -导入 自写回:lib/自写回.mq.md +导入: + 自写回: lib/自写回.mq.md --- # main diff --git a/public/stdlib/表.mq.md b/public/stdlib/表.mq.md index d503ae1..0707d56 100644 --- a/public/stdlib/表.mq.md +++ b/public/stdlib/表.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: lib/表 — 列表与字典 description: 改 / 行数 / 取行(代码即文档试点) -导入 表:lib/表.mq.md +导入: + 表: lib/表.mq.md --- # main diff --git a/public/structure/import/main.mq.md b/public/structure/import/main.mq.md index 7c14f0c..e498804 100644 --- a/public/structure/import/main.mq.md +++ b/public/structure/import/main.mq.md @@ -1,12 +1,13 @@ --- title: Cross-file import -description: Frontmatter import bind:path.mq.md -import utils:utils.mq.md +description: Frontmatter nested import: map +import: + utils: utils.mq.md --- # main -In the YAML header, `import utils:utils.mq.md` imports a sibling module and binds the library name `utils`. +In the YAML header, nested `import:` with `utils: utils.mq.md` imports a sibling module and binds the library name `utils`. Bind a return value, print it, then call greet: diff --git a/public/structure/import/主.mq.md b/public/structure/import/主.mq.md index fb700cc..6ae18e2 100644 --- a/public/structure/import/主.mq.md +++ b/public/structure/import/主.mq.md @@ -1,7 +1,8 @@ --- title: 跨文件导入 description: frontmatter 导入 bind:路径.mq.md -导入 工具:工具.mq.md +导入: + 工具: 工具.mq.md --- # main diff --git a/skills/marqdo/SKILL.md b/skills/marqdo/SKILL.md index d6ff4bf..e3e655d 100644 --- a/skills/marqdo/SKILL.md +++ b/skills/marqdo/SKILL.md @@ -32,7 +32,7 @@ Canonical design (repo): `doc/design/markdown-mapping.md`, `doc/design/keywords. 8. Prefer ending side-effect-only function bodies with `*None*` / `*无*` / whole-line `**` / `****` when later lines must belong to an outer function. Lone `---` / `***` are Markdown thematic breaks (skipped), not function end. 9. **`ext/**` never calls `host_*`.** Agent/OKF helpers are plugin names (`agent_kb_*`, …) after `plugin.load`. Do **not** add agent/OKF domain code to `src/host/` (core bloat). See `doc/design/ext-agent.md` §4. 10. **Browser (route C/D/E/F):** client logic is Marqdo on WASM; official bridge is host glue and **may** implement lists, routing, storage, WebSocket, canvas, file read, observers — authors **must not hand-write business JS**. Use `web.client_embed` / `data-mq-source-url` auto-mount. Client effects: prefer **GFM tables + `lib/browser`** ([marqdo-dev](../marqdo-dev/SKILL.md)). -11. **Code-as-documentation / no bag glue:** Prefer **GFM tables** for maps, lists, wire, commands. Prefer **`table.put` / named helpers** over `json.set` / `json.append` chains. `lib/json` is for parse/stringify/quote only — not a dict builder. Unreadable json pipelines are a style bug. Read collections with **`[key](map)`**, not footnote indexes for new code. In `markup: occlusion` files read with **`access(map, key)`** — there `[x](y)` is occlusion, not index. +11. **Code-as-documentation / no bag glue:** Prefer **GFM tables** for maps, lists, wire, commands. Prefer **`table.put` / named helpers** over `json.set` / `json.append` chains. `lib/json` is for parse/stringify/quote only — not a dict builder. Unreadable json pipelines are a style bug. Read collections with **`[key](map)`**, not footnote indexes for new code. In `markup: occlusion` files read with **`access(map, key)`** — there `[x](y)` is occlusion, not index. **Positive copy-paste shapes** (result map, soft-error pack, sparse `table.put`): [marqdo-dev](../marqdo-dev/SKILL.md) §2 · [examples.md](examples.md) §6e. Do **not** extend legacy `json.set` in `ext/ai` — refactor to tables. 12. **One language per file:** Do not mix EN and ZH API names in the same `.mq.md` (imports, calls, params). Pick English *or* Chinese mirrors for the whole program. 13. **Sandbox trial habit (Agent / generated `.mq.md`):** Prefer `agent.trial` / `run sandbox=True` / `sandbox.open`→`run`→`diff`→`commit` before promoting to the host tree. Host files must stay unchanged until a successful commit. Caps live in `sandbox.profile` GFM tables — do not invent a second dialect. @@ -49,8 +49,7 @@ Canonical design (repo): `doc/design/markdown-mapping.md`, `doc/design/keywords. | Line `N. *` | Else arm | | `> fn args` | Call (named `k=v` or positional) | | `` > `obj`.method args `` | Method call (`obj` must be a map with `_type`) | -| Frontmatter `import bind:path.mq.md` / `导入` | Import file (bind library name) | -| Frontmatter `import bind:lib.member` / `导入` | Short name for a library member (same keyword; no separate `use`) | +| Frontmatter nested `import:` / `导入:` map | Import file (`bind: path.mq.md`) or short name (`bind: lib.member`) | | `> lib.member …` / `> lib.Type.member …` | Call via bare dotted path (instance methods need `` `var`.m ``) | | `*…*` | Statement (bind / expr) — closing `*` touches last token, **no trailing space**; bare ids are variables | | `**…**` | Return value — closing `**` touches last token, **no trailing space**; bare ids are variables | @@ -136,13 +135,14 @@ Chinese builtins (same functions, no import): ## Frontmatter imports + stdlib -Imports use `import bind:target` (`导入` equivalent): file (`.mq.md`) or short name (`lib.member`). Members are **not** flattened into the caller. Call with a bare dotted path: +Imports use nested YAML `import:` (`导入` equivalent): file (`.mq.md`) or short name (`lib.member`). Members are **not** flattened into the caller. Call with a bare dotted path: ```markdown --- title: example -import text:lib/text.mq.md -import clock:lib/time.mq.md +import: + text: lib/text.mq.md + clock: lib/time.mq.md --- # main @@ -214,6 +214,16 @@ Install: `marqdo ext add quantum` (ZH id: `量子`). Build: `cargo build --relea Design: [ext-quantum.md](../../doc/design/ext-quantum.md) · Q7: [ext-quantum-q7.md](../../doc/design/ext-quantum-q7.md) · Q8 viz: [ext-quantum-viz-style.md](../../doc/design/ext-quantum-viz-style.md) · examples: [quantum-bell](../../examples/quantum-bell/) · [quantum-entanglement](../../examples/quantum-entanglement/). +## Foreign kernels (v1.5.0) + +`lib/foreign` is now a full foreign-kernel surface, not only `run`: + +- `invoke` returns a record (`ok`, `code`, `stdout`, `stderr`, `ms`, `timed_out`, `truncated`, `result`); pass `input` for JSON stdin and `output="json"` for a parsed result. +- `call` is JSON-in / JSON-out; `call_many` fans out one program over a list with ordered results. +- `session_open` starts a persistent Python/Node kernel; `session_eval` evaluates source; `session_set` / `session_get` bridge values explicitly as JSON. Close it with `session_close`. +- A view document opts into kernel state with `会话 = > foreign.session kernels=... cells=...`; the table names are free. `view` consumes only the `会话` handle and never scans source lines or reserved table names. Without `会话`, cells are stateless one-shot runs; no kernel is created. Clearing outputs calls `/api/session/clear` and keeps persistent kernel state. There is no separate notebook CLI mode or command, and no new Markdown marker exists. +- The same source remains the authority; state crossing kernels is explicit, never implicitly mirrored. + ## AI authoring workflow 1. Decide language surface (English builtins + `lib/text.mq.md`, or Chinese + `lib/文本.mq.md`). diff --git a/skills/marqdo/examples.md b/skills/marqdo/examples.md index efbfc6d..7c3f37d 100644 --- a/skills/marqdo/examples.md +++ b/skills/marqdo/examples.md @@ -114,7 +114,8 @@ Row-oriented records (SQL-like): first header `@` / `行` / `row` → list of ma ```markdown --- -import browser:lib/browser.mq.md +import: + browser: lib/browser.mq.md --- # main @@ -140,7 +141,8 @@ Do **not** build effect maps with `json.set` chains. See [marqdo-dev](../marqdo- ```markdown --- title: split demo -import text:lib/text.mq.md +import: + text: lib/text.mq.md --- # main @@ -168,7 +170,8 @@ After a blank line, code runs: ```markdown --- description: loads math -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main @@ -216,7 +219,8 @@ See `tests/structure/object-handle.mq.md` and `ext/llm.mq.md`: `# Type` construc ```markdown --- -import agent:ext/agent.mq.md +import: + agent: ext/agent.mq.md --- # main @@ -280,7 +284,8 @@ Executable document as a page. ```markdown --- -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main @@ -296,7 +301,8 @@ import web:ext/web/web.mq.md ```markdown --- -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/skills/marqdo/reference.md b/skills/marqdo/reference.md index 65074ce..7d09c50 100644 --- a/skills/marqdo/reference.md +++ b/skills/marqdo/reference.md @@ -102,7 +102,8 @@ Examples: `examples/quantum-bell/`, `examples/quantum-entanglement/`. Design: `d ```markdown --- -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main @@ -121,7 +122,8 @@ Empty RHS assignment + following `$$…$$` binds a formula value. Narrative-only ```markdown --- -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/src/ast.rs b/src/ast.rs index 47dbbc2..307b202 100644 --- a/src/ast.rs +++ b/src/ast.rs @@ -6,14 +6,14 @@ use crate::diagnostics::Span; use crate::formula::Expr as FormulaExpr; use crate::value::CodeBlock; -/// Frontmatter file import: `import bind:path.mq.md` (see `doc/design/module-namespace.md`). +/// Frontmatter file import under nested `import:\n bind: path.mq.md` (see `doc/design/module-namespace.md`). #[derive(Debug, Clone)] pub struct Import { pub path: String, pub bind: String, } -/// Frontmatter short-name bind: `import bind:lib.member` (same keyword as file import). +/// Frontmatter short-name bind under nested `import:\n bind: lib.member` (same map as file import). #[derive(Debug, Clone)] pub struct Use { pub path: Vec, diff --git a/src/browser_session.rs b/src/browser_session.rs index 656a247..a163860 100644 --- a/src/browser_session.rs +++ b/src/browser_session.rs @@ -92,7 +92,8 @@ mod tests { #[test] fn boot_and_call_share_count() { let src = r##"--- -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/src/catalog.rs b/src/catalog.rs index 5c2cc26..49e0914 100644 --- a/src/catalog.rs +++ b/src/catalog.rs @@ -293,28 +293,10 @@ fn inspect_file(abs: &Path, rel: &str) -> Result { } fn extract_frontmatter_imports(source: &str) -> Vec { - let source = source.strip_prefix('\u{feff}').unwrap_or(source); - let mut imports = Vec::new(); - let lines: Vec<&str> = source.lines().collect(); - if lines.first().map(|l| l.trim()) != Some("---") { - return imports; - } - for line in lines.iter().skip(1) { - let t = line.trim(); - if t == "---" { - break; - } - if let Ok(Some(crate::parse::ImportLine::File(imp))) = - crate::parse::parse_import_line(t) - { - imports.push(format!("import {}:{}", imp.bind, imp.path)); - } else if let Ok(Some(crate::parse::ImportLine::Member(u))) = - crate::parse::parse_import_line(t) - { - imports.push(format!("import {}:{}", u.bind, u.path.join("."))); - } - } - imports + crate::parse::scan_frontmatter_imports(source) + .iter() + .map(crate::parse::format_import_display) + .collect() } fn extract_frontmatter_title(source: &str) -> Option { diff --git a/src/host/foreign_doc.rs b/src/host/foreign_doc.rs index 927dd7f..755209b 100644 --- a/src/host/foreign_doc.rs +++ b/src/host/foreign_doc.rs @@ -1436,7 +1436,8 @@ mod tests { )); let source = r#"--- title: evaluated plan test -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main @@ -1521,7 +1522,8 @@ print(1) )); let source = r#"--- title: shared state test -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main @@ -1651,7 +1653,8 @@ console.log("stateless"); )); let source = r#"--- title: clear outputs -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main @@ -1801,7 +1804,8 @@ print(950) )); let source = r#"--- title: plan inputs test -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main @@ -1861,7 +1865,8 @@ print(sys.stdin.read().strip()) )); let source = r#"--- title: persistent node stdin test -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main @@ -1915,7 +1920,8 @@ import foreign:lib/foreign.mq.md )); let source = r#"--- title: persistent stdin test -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/src/host/fs.rs b/src/host/fs.rs index c7138b3..fce5dd7 100644 --- a/src/host/fs.rs +++ b/src/host/fs.rs @@ -659,8 +659,9 @@ PATCH: @@ -> ext/ai/llm.mq.md -> lib/json.mq.md -+import llm:ext/ai/llm.mq.md -+import json:lib/json.mq.md ++import: ++ llm: ext/ai/llm.mq.md ++ json: lib/json.mq.md *** End Patch ``` "#; @@ -674,7 +675,7 @@ PATCH: assert_eq!(n, Value::Int(1)); assert_eq!( fs::read_to_string(&path).unwrap(), - "import llm:ext/ai/llm.mq.md\nimport json:lib/json.mq.md\n" + "import:\n llm: ext/ai/llm.mq.md\n json: lib/json.mq.md\n" ); let _ = fs::remove_dir_all(&dir); } diff --git a/src/knowledge/extract.rs b/src/knowledge/extract.rs index 093a4b2..4887776 100644 --- a/src/knowledge/extract.rs +++ b/src/knowledge/extract.rs @@ -498,27 +498,9 @@ fn prose_field(source: &str, label: &str) -> Option { } fn extract_frontmatter_imports(source: &str) -> Vec { - let source = source.strip_prefix('\u{feff}').unwrap_or(source); - let mut imports = Vec::new(); - let lines: Vec<&str> = source.lines().collect(); - if lines.first().map(|l| l.trim()) != Some("---") { - return imports; - } - for line in lines.iter().skip(1) { - let t = line.trim(); - if t == "---" { - break; - } - if let Ok(Some(crate::parse::ImportLine::File(imp))) = - crate::parse::parse_import_line(t) - { - imports.push(format!("import {}:{}", imp.bind, imp.path)); - } else if let Ok(Some(crate::parse::ImportLine::Member(u))) = - crate::parse::parse_import_line(t) - { - imports.push(format!("import {}:{}", u.bind, u.path.join("."))); - } - } - imports + crate::parse::scan_frontmatter_imports(source) + .iter() + .map(crate::parse::format_import_display) + .collect() } diff --git a/src/label.rs b/src/label.rs index ef084c7..06078cb 100644 --- a/src/label.rs +++ b/src/label.rs @@ -471,7 +471,16 @@ fn payload_fingerprint(payload: &Option>) -> String { fn render_payload(payload: &Option>) -> String { match payload { - Some(e) => crate::view::expr_display(e), + Some(e) => { + #[cfg(feature = "view")] + { + crate::view::expr_display(e) + } + #[cfg(not(feature = "view"))] + { + format!("{e:?}") + } + } None => String::new(), } } diff --git a/src/main.rs b/src/main.rs index 432156b..50df2da 100644 --- a/src/main.rs +++ b/src/main.rs @@ -54,6 +54,17 @@ enum MigrateAction { #[arg(long)] json: bool, }, + /// One-liner `import bind:target` → nested YAML `import:\n bind: target` + Imports { + #[arg(value_name = "PATH", default_value = ".")] + paths: Vec, + /// Actually rewrite files (default: dry run) + #[arg(long)] + write: bool, + /// One JSON array on stdout + #[arg(long)] + json: bool, + }, } @@ -795,6 +806,74 @@ fn try_main(cli: Cli) -> Result { } Ok(0) } + MigrateAction::Imports { paths, write, json } => { + let mut reports = Vec::new(); + for p in &paths { + reports.extend(marqdo::migrate::migrate_imports_path(p, write)?); + } + let (mut bindings, mut applied, mut problems) = (0usize, 0usize, 0usize); + for r in &reports { + bindings += r.bindings; + applied += usize::from(r.applied); + if r.note.as_ref().is_some_and(|n| { + n != "no legacy import one-liners" + }) && r.bindings == 0 + { + problems += 1; + } + } + if json { + let arr: Vec = reports + .iter() + .filter(|r| r.bindings > 0 || r.note.as_ref().is_some_and(|n| n != "no legacy import one-liners")) + .map(|r| { + serde_json::json!({ + "file": r.file.display().to_string(), + "bindings": r.bindings, + "applied": r.applied, + "note": r.note, + }) + }) + .collect(); + println!("{}", serde_json::Value::Array(arr)); + } else { + for r in &reports { + if r.bindings == 0 && r.note.as_ref().is_some_and(|n| n == "no legacy import one-liners") { + continue; + } + if r.bindings == 0 { + println!( + "{} skipped ({})", + r.file.display(), + r.note.as_deref().unwrap_or("?") + ); + continue; + } + let state = if r.applied { + "written" + } else if r.note.is_some() { + "skipped" + } else { + "would change" + }; + println!( + "{} bindings={} {}{}", + r.file.display(), + r.bindings, + state, + r.note + .as_ref() + .map(|n| format!(" ({n})")) + .unwrap_or_default() + ); + } + println!( + "migrate imports: {bindings} binding(s), {applied} file written, {problems} problem(s){}", + if write { "" } else { " (dry run; pass --write)" } + ); + } + Ok(0) + } }, Commands::Mlsp => { use std::io::{BufRead, Write}; diff --git a/src/migrate.rs b/src/migrate.rs index 519cd50..7f34c30 100644 --- a/src/migrate.rs +++ b/src/migrate.rs @@ -2,7 +2,9 @@ //! purity forms (`access(集合, 键)` and `- [描述](遍历 集合 为 项)`), then mark //! the file `markup: occlusion`. //! -//! Safety model: **transform, re-parse, prove equivalence, then write.** +//! Also: nested YAML `import:` migration (`marqdo migrate imports`). +//! +//! Safety model (labels): **transform, re-parse, prove equivalence, then write.** //! The transformed file is parsed in occlusion mode and *denormalized* back to //! the legacy AST shape; if the denormalized AST is not byte-identical (Debug) //! to the original, the file is left untouched and reported. @@ -10,8 +12,9 @@ use std::path::{Path, PathBuf}; use crate::ast::{Arg, BranchArm, Expr, Function, IndexKey, Module, Stmt}; +use crate::parse::{is_legacy_import_oneliner, parse_import_binding}; -/// Outcome of migrating one file. +/// Outcome of migrating one file (labels). #[derive(Debug, Clone)] pub struct FileReport { pub file: PathBuf, @@ -21,6 +24,15 @@ pub struct FileReport { pub note: Option, } +/// Outcome of migrating one-liner imports → nested `import:` / `导入:`. +#[derive(Debug, Clone)] +pub struct ImportFileReport { + pub file: PathBuf, + pub bindings: usize, + pub applied: bool, + pub note: Option, +} + fn has_marker(source: &str) -> bool { let mut lines = source.lines(); if lines.next().map(|l| l.trim_end()) != Some("---") { @@ -540,6 +552,167 @@ pub fn migrate_path(path: &Path, write: bool) -> anyhow::Result> Ok(out) } +/// Rewrite frontmatter one-liner `import bind:target` / `导入 bind:target` into a +/// nested YAML map. Returns `(new_source, binding_count)` or `None` if unchanged. +pub fn rewrite_import_frontmatter(source: &str) -> Result, String> { + let source = source.strip_prefix('\u{feff}').unwrap_or(source); + let lines: Vec<&str> = source.lines().collect(); + if lines.first().map(|l| l.trim()) != Some("---") { + return Ok(None); + } + let mut fm_end = None; + for (i, line) in lines.iter().enumerate().skip(1) { + if line.trim() == "---" { + fm_end = Some(i); + break; + } + } + let Some(fm_end) = fm_end else { + return Ok(None); + }; + + let mut keyword: Option<&'static str> = None; + let mut entries: Vec<(String, String)> = Vec::new(); + let mut legacy_idxs: Vec = Vec::new(); + let mut has_nested = false; + let mut nested_kw: Option<&'static str> = None; + + for i in 1..fm_end { + let t = lines[i].trim(); + // Nested header with empty RHS only (`import:` / `导入:`) + if let Some(rest) = t.strip_prefix("import:") { + if rest.trim().is_empty() { + has_nested = true; + nested_kw = Some("import"); + continue; + } + } + if let Some(rest) = t.strip_prefix("导入:") { + if rest.trim().is_empty() { + has_nested = true; + nested_kw = Some("导入"); + continue; + } + } + if !is_legacy_import_oneliner(t) { + continue; + } + let (kw, after) = if t.starts_with("import") { + ("import", t[6..].trim()) + } else if let Some(a) = t.strip_prefix("导入") { + ("导入", a.trim()) + } else { + return Err(format!("internal: not a legacy import: {t}")); + }; + // Pre-existing EN/ZH one-liner mixes: fold under the first keyword seen. + if keyword.is_none() { + keyword = Some(kw); + } + let _ = kw; + let Some((bind_raw, target_raw)) = after.split_once(':') else { + return Err(format!("expected bind:target in `{t}`")); + }; + let bind = bind_raw.trim().to_string(); + let target = target_raw.trim().to_string(); + parse_import_binding(&bind, &target).map_err(|e| e.to_string())?; + if entries.iter().any(|(b, _)| b == &bind) { + return Err(format!("duplicate import bind `{bind}`")); + } + entries.push((bind, target)); + legacy_idxs.push(i); + } + + if entries.is_empty() { + return Ok(None); + } + if has_nested { + return Err(format!( + "file already has `{}:` block and legacy one-liners — resolve manually", + nested_kw.unwrap_or("import") + )); + } + + let kw = keyword.unwrap_or("import"); + let insert_at = legacy_idxs[0]; + let skip: std::collections::HashSet = legacy_idxs.into_iter().collect(); + + let mut out: Vec = Vec::new(); + for (i, line) in lines.iter().enumerate() { + if i == insert_at { + out.push(format!("{kw}:")); + for (bind, target) in &entries { + out.push(format!(" {bind}: {target}")); + } + } + if skip.contains(&i) { + continue; + } + out.push((*line).to_string()); + } + + let mut body = out.join("\n"); + if source.ends_with('\n') { + body.push('\n'); + } + Ok(Some((body, entries.len()))) +} + +/// Migrate one file's import frontmatter. `write=false` is dry-run. +pub fn migrate_imports_file(path: &Path, write: bool) -> anyhow::Result { + let source = std::fs::read_to_string(path)?; + let mut report = ImportFileReport { + file: path.to_path_buf(), + bindings: 0, + applied: false, + note: None, + }; + match rewrite_import_frontmatter(&source) { + Ok(None) => { + report.note = Some("no legacy import one-liners".into()); + Ok(report) + } + Err(e) => { + report.note = Some(e); + Ok(report) + } + Ok(Some((new_src, n))) => { + report.bindings = n; + // Soft smoke: nested map must extract the same binding count. + let scanned = crate::parse::scan_frontmatter_imports(&new_src); + if scanned.len() != n { + report.note = Some(format!( + "scan mismatch after rewrite: got {} expected {n}", + scanned.len() + )); + return Ok(report); + } + if write { + std::fs::write(path, &new_src)?; + report.applied = true; + } + Ok(report) + } + } +} + +/// Recursively migrate import one-liners under `path`. +pub fn migrate_imports_path(path: &Path, write: bool) -> anyhow::Result> { + let files = collect_files(path); + let mut out = Vec::new(); + for f in files { + match migrate_imports_file(&f, write) { + Ok(r) => out.push(r), + Err(e) => out.push(ImportFileReport { + file: f, + bindings: 0, + applied: false, + note: Some(format!("read failed: {e:#}")), + }), + } + } + Ok(out) +} + /// Collect `*.mq.md` under `path` (file → itself). pub fn collect_files(path: &Path) -> Vec { fn walk(dir: &Path, out: &mut Vec) { @@ -568,7 +741,16 @@ pub fn collect_files(path: &Path) -> Vec { #[cfg(test)] mod tests { - use super::{rewrite_indexes, rewrite_loop}; + use super::{rewrite_import_frontmatter, rewrite_indexes, rewrite_loop}; + + #[test] + fn rewrites_import_oneliners_to_nested() { + let src = "---\ntitle: t\nimport json:lib/json.mq.md\nimport fmt:time.format\n---\n\n# main\n"; + let (out, n) = rewrite_import_frontmatter(src).unwrap().unwrap(); + assert_eq!(n, 2); + assert!(out.contains("import:\n json: lib/json.mq.md\n fmt: time.format\n")); + assert!(!out.contains("import json:")); + } #[test] fn rewrites_static_key() { diff --git a/src/parse/mod.rs b/src/parse/mod.rs index 38af91b..6f6ce0d 100644 --- a/src/parse/mod.rs +++ b/src/parse/mod.rs @@ -146,6 +146,7 @@ impl<'a> Cursor<'a> { let mut imports = Vec::new(); let mut uses = Vec::new(); let mut metadata_raw = Vec::new(); + let mut import_keyword: Option<&'static str> = None; if !self.skip_noise() { return Ok((imports, uses, metadata_raw)); } @@ -166,40 +167,41 @@ impl<'a> Cursor<'a> { if let Some(msg) = legacy_frontmatter_import_hint(t) { return Err(bail_at(None, span, msg)); } - match parse_import_line(t) { - Ok(Some(ImportLine::File(imp))) => { - if imports.iter().any(|i| i.bind == imp.bind) - || uses.iter().any(|u| u.bind == imp.bind) - { - return Err(bail_at( - None, - span, - format!("duplicate import bind `{}`", imp.bind), - )); - } - imports.push(imp); - self.bump(); - continue; - } - Ok(Some(ImportLine::Member(u))) => { - if imports.iter().any(|i| i.bind == u.bind) - || uses.iter().any(|x| x.bind == u.bind) - { - return Err(bail_at( - None, - span, - format!("duplicate import bind `{}`", u.bind), - )); - } - uses.push(u); - self.bump(); - continue; - } - Ok(None) => {} - Err(e) => return Err(bail_at(None, span, e.to_string())), - } - // Artifact metadata key: value (flat Phase 1) + // Artifact metadata key: value (flat Phase 1); `import:` / `导入:` are nested maps if let Some((key, rest)) = split_frontmatter_key(t) { + if key == "import" || key == "导入" { + let kw = if key == "import" { "import" } else { "导入" }; + if let Some(prev) = import_keyword { + if prev != kw { + return Err(bail_at( + None, + span, + format!( + "cannot mix `{prev}:` and `{kw}:` in one frontmatter (one language per file)" + ), + )); + } + return Err(bail_at( + None, + span, + format!("duplicate `{kw}:` block in frontmatter"), + )); + } + if !rest.is_empty() { + return Err(bail_at( + None, + span, + format!( + "`{kw}:` must be a nested YAML map (not `{kw}: …` on one line); \ + use indented `bind: target` under `{kw}:`" + ), + )); + } + import_keyword = Some(kw); + self.bump(); + self.collect_import_map(span, &mut imports, &mut uses)?; + continue; + } self.bump(); let value_raw = if rest.is_empty() || rest == "|" @@ -231,6 +233,47 @@ impl<'a> Cursor<'a> { Ok((imports, uses, metadata_raw)) } + /// Consume indented `bind: target` lines under `import:` / `导入:`. + fn collect_import_map( + &mut self, + header_span: Span, + imports: &mut Vec, + uses: &mut Vec, + ) -> Result<()> { + let _ = header_span; + while let Some(line) = self.peek() { + let raw = line.text.trim_end_matches(['\r', '\n']); + let bt = raw.trim(); + if bt == "---" { + break; + } + if bt.is_empty() { + self.bump(); + continue; + } + // Next top-level key ends the import map + if !raw.starts_with(' ') && !raw.starts_with('\t') { + break; + } + let span = Span::new(line.line_no, 1); + self.bump(); + let content = strip_yaml_indent(raw); + let Some((bind_raw, target_raw)) = content.split_once(':') else { + return Err(bail_at( + None, + span, + format!("expected `bind: target` under import map, got `{content}`"), + )); + }; + let bind = bind_raw.trim(); + let target = target_raw.trim(); + let entry = parse_import_binding(bind, target) + .map_err(|e| bail_at(None, span, e.to_string()))?; + push_import_line(imports, uses, entry, span)?; + } + Ok(()) + } + fn parse_function(&mut self, min_level: u8) -> Result { let line = self.bump().unwrap(); let (level, raw_name) = parse_heading(line.text.trim()) @@ -1541,19 +1584,22 @@ fn is_simple_type_name(s: &str) -> bool { chars.all(|c| c.is_alphanumeric() || c == '_' || !c.is_ascii()) } -/// Result of parsing one frontmatter `import` / `导入` line. +/// Result of one import map entry (`bind: target` under `import:` / `导入:`). #[derive(Debug, Clone)] pub enum ImportLine { File(Import), Member(Use), } +/// Hint shown when legacy one-line or `>` imports are rejected. +pub const NESTED_IMPORT_HINT: &str = "legacy frontmatter import removed; use nested YAML \ +`import:\\n bind: target` (Chinese: `导入:`) — or run `marqdo migrate imports --write`"; + fn split_frontmatter_key(trimmed: &str) -> Option<(&str, &str)> { let t = trimmed.trim(); if t.is_empty() || t.starts_with('#') { return None; } - // import lines are handled earlier let Some((key, rest)) = t.split_once(':') else { return None; }; @@ -1576,10 +1622,9 @@ fn collect_block_scalar(cur: &mut Cursor<'_>, indicator: &str) -> Result if bt == "---" { break; } - // Next top-level key or import ends the block + // Next top-level key ends the block if !raw.starts_with(' ') && !raw.starts_with('\t') && !bt.is_empty() { - if split_frontmatter_key(bt).is_some() || parse_import_line(bt).ok().flatten().is_some() - { + if split_frontmatter_key(bt).is_some() { break; } if indicator.is_empty() { @@ -1622,8 +1667,32 @@ fn strip_yaml_indent(line: &str) -> String { } } +/// True for removed one-liner `import bind:target` / `导入 bind:target`. +pub fn is_legacy_import_oneliner(trimmed: &str) -> bool { + let t = trimmed.trim(); + if t.starts_with("import") + && t.get(6..) + .is_some_and(|s| s.starts_with(|c: char| c.is_whitespace())) + { + let after = t[6..].trim(); + return after.contains(':') && !after.is_empty(); + } + if let Some(a) = t.strip_prefix("导入") { + let a = a.trim_start(); + // `导入:` is the new nested header, not a one-liner + if a.is_empty() || a.starts_with(':') { + return false; + } + return a.contains(':'); + } + false +} + fn legacy_frontmatter_import_hint(trimmed: &str) -> Option { let t = trimmed.trim(); + if is_legacy_import_oneliner(t) { + return Some(NESTED_IMPORT_HINT.into()); + } if !t.starts_with('>') { return None; } @@ -1634,39 +1703,13 @@ fn legacy_frontmatter_import_hint(trimmed: &str) -> Option { || rest.starts_with("use ") || rest.starts_with("使用 "); if looks_file || looks_use { - return Some( - "legacy frontmatter import `> …` is removed; use `import bind:path.mq.md` \ - or `import bind:lib.member` (Chinese: `导入`)" - .into(), - ); + return Some(NESTED_IMPORT_HINT.into()); } None } -/// Parse `import json:lib/json.mq.md` / `导入 fmt:time.format`. -/// Returns `Ok(None)` for non-import frontmatter lines (e.g. `title:`). -pub fn parse_import_line(trimmed: &str) -> Result> { - let t = trimmed.trim(); - let after = if t.starts_with("import") - && t.get(6..) - .is_some_and(|s| s.starts_with(|c: char| c.is_whitespace())) - { - t[6..].trim() - } else if let Some(a) = t.strip_prefix("导入") { - let a = a.trim(); - if a.is_empty() { - bail!("expected `导入 bind:target`"); - } - a - } else { - return Ok(None); - }; - - let Some((bind_raw, target_raw)) = after.split_once(':') else { - bail!("expected `import bind:target` (file `.mq.md` or `lib.member`)"); - }; - let bind = bind_raw.trim(); - let target = target_raw.trim(); +/// Parse one `bind` / `target` pair from a nested import map entry. +pub fn parse_import_binding(bind: &str, target: &str) -> Result { if bind.is_empty() || !is_simple_bind_name(bind) { bail!("invalid import bind `{bind}`"); } @@ -1675,10 +1718,10 @@ pub fn parse_import_line(trimmed: &str) -> Result> { } if target.ends_with(".mq.md") { - return Ok(Some(ImportLine::File(Import { + return Ok(ImportLine::File(Import { path: target.to_string(), bind: bind.to_string(), - }))); + })); } let path: Vec = target @@ -1690,25 +1733,136 @@ pub fn parse_import_line(trimmed: &str) -> Result> { "import target `{target}` must be a `.mq.md` path or dotted member path (e.g. `time.format`)" ); } - Ok(Some(ImportLine::Member(Use { + Ok(ImportLine::Member(Use { path, bind: bind.to_string(), - }))) + })) +} + +fn push_import_line( + imports: &mut Vec, + uses: &mut Vec, + entry: ImportLine, + span: Span, +) -> Result<()> { + match entry { + ImportLine::File(imp) => { + if imports.iter().any(|i| i.bind == imp.bind) || uses.iter().any(|u| u.bind == imp.bind) + { + return Err(bail_at( + None, + span, + format!("duplicate import bind `{}`", imp.bind), + )); + } + imports.push(imp); + } + ImportLine::Member(u) => { + if imports.iter().any(|i| i.bind == u.bind) || uses.iter().any(|x| x.bind == u.bind) { + return Err(bail_at( + None, + span, + format!("duplicate import bind `{}`", u.bind), + )); + } + uses.push(u); + } + } + Ok(()) +} + +/// Format an import entry as the catalog display string `import bind:target`. +pub fn format_import_display(line: &ImportLine) -> String { + match line { + ImportLine::File(imp) => format!("import {}:{}", imp.bind, imp.path), + ImportLine::Member(u) => format!("import {}:{}", u.bind, u.path.join(".")), + } +} + +/// Scan frontmatter for nested `import:` / `导入:` entries (soft; skips legacy / errors). +pub fn scan_frontmatter_imports(source: &str) -> Vec { + let source = source.strip_prefix('\u{feff}').unwrap_or(source); + let lines: Vec<&str> = source.lines().collect(); + if lines.first().map(|l| l.trim()) != Some("---") { + return Vec::new(); + } + let mut out = Vec::new(); + let mut i = 1usize; + while i < lines.len() { + let t = lines[i].trim(); + if t == "---" { + break; + } + if let Some((key, rest)) = split_frontmatter_key(t) { + if (key == "import" || key == "导入") && rest.is_empty() { + i += 1; + while i < lines.len() { + let raw = lines[i].trim_end_matches(['\r', '\n']); + let bt = raw.trim(); + if bt == "---" { + break; + } + if bt.is_empty() { + i += 1; + continue; + } + if !raw.starts_with(' ') && !raw.starts_with('\t') { + break; + } + let content = strip_yaml_indent(raw); + if let Some((bind_raw, target_raw)) = content.split_once(':') { + if let Ok(entry) = + parse_import_binding(bind_raw.trim(), target_raw.trim()) + { + out.push(entry); + } + } + i += 1; + } + continue; + } + } + i += 1; + } + out } fn is_simple_bind_name(s: &str) -> bool { is_simple_type_name(s) } -/// Parse a file import line body for catalog / tooling (`bind:path.mq.md` after keyword stripped), -/// or the full `import bind:path` / legacy-free form via [`parse_import_line`]. +/// Parse a catalog-style `import bind:path` display string, or bare `bind:path`. pub fn parse_import_spec(line: &str) -> Option { - match parse_import_line(line).ok()? { - Some(ImportLine::File(imp)) => Some(imp), - _ => None, + let t = line.trim(); + let body = if t.starts_with("import") + && t.get(6..) + .is_some_and(|s| s.starts_with(|c: char| c.is_whitespace())) + { + t[6..].trim() + } else if let Some(a) = t.strip_prefix("导入") { + let a = a.trim(); + if a.is_empty() || a.starts_with(':') { + return None; + } + a + } else { + t + }; + let (bind, target) = body.split_once(':')?; + match parse_import_binding(bind.trim(), target.trim()).ok()? { + ImportLine::File(imp) => Some(imp), + ImportLine::Member(_) => None, } } +/// Rejected API: old one-liner always errors (kept for callers that still probe lines). +pub fn parse_import_line(trimmed: &str) -> Result> { + if is_legacy_import_oneliner(trimmed) { + bail!("{NESTED_IMPORT_HINT}"); + } + Ok(None) +} + fn is_heading(trimmed: &str) -> bool { parse_heading(trimmed).is_some() } diff --git a/src/view/render.rs b/src/view/render.rs index 01b7cfd..222f9bf 100644 --- a/src/view/render.rs +++ b/src/view/render.rs @@ -1766,7 +1766,7 @@ mod tests { #[test] fn structure_omits_imported_lib_bodies() { - let src = "---\ntitle: t\nimport text:lib/text.mq.md\n---\n\n# main\n\n> print text=hi\n"; + let src = "---\ntitle: t\nimport:\n text: lib/text.mq.md\n---\n\n# main\n\n> print text=hi\n"; let local = crate::parse::parse_source(src).unwrap(); let html = render_module_structure(&local, src); assert!(html.contains("doc-imports") || html.contains("lib/text.mq.md"), "{html}"); diff --git a/tests/blind/docs-bundle.md b/tests/blind/docs-bundle.md index 1cc9706..46887e5 100644 --- a/tests/blind/docs-bundle.md +++ b/tests/blind/docs-bundle.md @@ -18,8 +18,7 @@ P4 实验 (b) 材料 · D 臂(全文档背诵组)上下文包。 | `> fn args` | Call (named `k=v` or positional) | | `修饰 [fn] args` | Bracket-marked call; leading words → `名=True` | | `` > `obj`.method args `` | Method call (`obj` must be a map with `_type`) | -| Frontmatter `import bind:path.mq.md` / `导入` | Import file (bind library name) | -| Frontmatter `import bind:lib.member` / `导入` | Short name for a library member (same keyword; no separate `use`) | +| Frontmatter nested `import:` / `导入:` map | Import file (`bind: path.mq.md`) or short name (`bind: lib.member`) | | `> lib.member …` / `> lib.Type.member …` | Call via bare dotted path (instance methods need `` `var`.m ``) | | `**…**` | **Code** (assign / call) — closing `**` touches last token; bare ids are variables; quote text literals | | `*…*` | **Return value** — closing `*` touches last token; bare ids are variables | @@ -94,13 +93,14 @@ Chinese builtins (same functions, no import): ## Frontmatter imports + stdlib -Imports use `import bind:target` (`导入` equivalent): file (`.mq.md`) or short name (`lib.member`). Members are **not** flattened into the caller. Call with a bare dotted path: +Imports use nested YAML `import:` (`导入` equivalent): file (`.mq.md`) or short name (`lib.member`). Members are **not** flattened into the caller. Call with a bare dotted path: ```markdown --- title: example -import text:lib/text.mq.md -import clock:lib/time.mq.md +import: + text: lib/text.mq.md + clock: lib/time.mq.md --- # main diff --git a/tests/errors/legacy-oneliner-import.mq.md b/tests/errors/legacy-oneliner-import.mq.md new file mode 100644 index 0000000..45574f5 --- /dev/null +++ b/tests/errors/legacy-oneliner-import.mq.md @@ -0,0 +1,8 @@ +--- +title: legacy one-liner import must fail +import json:lib/json.mq.md +--- + +# main + +> print text=should-not-run diff --git a/tests/errors/ns-instance-method.mq.md b/tests/errors/ns-instance-method.mq.md index 304b578..3d837ef 100644 --- a/tests/errors/ns-instance-method.mq.md +++ b/tests/errors/ns-instance-method.mq.md @@ -1,6 +1,7 @@ --- title: path to instance method needs receiver -import helpers:../structure/ns/helpers.mq.md +import: + helpers: ../structure/ns/helpers.mq.md --- # main diff --git a/tests/ext/agent-constitution-b0.mq.md b/tests/ext/agent-constitution-b0.mq.md index 42996be..6658569 100644 --- a/tests/ext/agent-constitution-b0.mq.md +++ b/tests/ext/agent-constitution-b0.mq.md @@ -1,11 +1,12 @@ --- title: agent constitution markers (Wave B1 offline) description: Assert call_site / source / protocol order in build_step_context. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- ## probe_tool diff --git a/tests/ext/agent-context-budget-a3.mq.md b/tests/ext/agent-context-budget-a3.mq.md index 15311ca..2a9904b 100644 --- a/tests/ext/agent-context-budget-a3.mq.md +++ b/tests/ext/agent-context-budget-a3.mq.md @@ -1,11 +1,12 @@ --- title: agent context budget + progressive disclose (A3 offline) description: source/skill briefs truncate with markers; READ:skill deepen; step protocol mentions READ. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- A3 padding block so this module source exceeds the default 4KiB budget when injected into step context. Keep as plain prose (not HTML comments) so strip_html_comments leaves it in place. diff --git a/tests/ext/agent-dump-context.mq.md b/tests/ext/agent-dump-context.mq.md index 9f10146..968a3b1 100644 --- a/tests/ext/agent-dump-context.mq.md +++ b/tests/ext/agent-dump-context.mq.md @@ -1,11 +1,12 @@ --- title: dump_step_context (Wave B1 offline) description: Assert dump_step_context exposes call_site + prompt without LLM. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- ## probe_tool diff --git a/tests/ext/agent-inspect-fixture.mq.md b/tests/ext/agent-inspect-fixture.mq.md index 15b7e25..6170d02 100644 --- a/tests/ext/agent-inspect-fixture.mq.md +++ b/tests/ext/agent-inspect-fixture.mq.md @@ -1,9 +1,10 @@ --- title: agent inspect_workbook (offline) description: Parse named writeback slots from a fixture workbook path. -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md +import: + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/agent-kb-alias.mq.md b/tests/ext/agent-kb-alias.mq.md index 7e1f712..ba74f6c 100644 --- a/tests/ext/agent-kb-alias.mq.md +++ b/tests/ext/agent-kb-alias.mq.md @@ -1,11 +1,12 @@ --- title: OKF agent-kb alias lookup (offline) description: Promote resource; patch Task aliases; variant goal hits same resource. -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-kb-near.mq.md b/tests/ext/agent-kb-near.mq.md index 8efda1b..6335f28 100644 --- a/tests/ext/agent-kb-near.mq.md +++ b/tests/ext/agent-kb-near.mq.md @@ -1,11 +1,12 @@ --- title: OKF agent-kb near_match (offline) description: Promote trip resource; near-dupe goals hit match=near; unrelated misses. -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-kb-plan-hit.mq.md b/tests/ext/agent-kb-plan-hit.mq.md index edb4617..be7f9ab 100644 --- a/tests/ext/agent-kb-plan-hit.mq.md +++ b/tests/ext/agent-kb-plan-hit.mq.md @@ -1,12 +1,13 @@ --- title: OKF plan llm_free hit + list_tasks curation (A1 offline) description: Promote solidified workbook; plan same goal takes cache=hit; near→soft-hit; list_tasks exposes status/llm_free. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-kb-reuse.mq.md b/tests/ext/agent-kb-reuse.mq.md index df9cd84..644a281 100644 --- a/tests/ext/agent-kb-reuse.mq.md +++ b/tests/ext/agent-kb-reuse.mq.md @@ -1,12 +1,13 @@ --- title: OKF agent-kb promote + lookup + spawn (offline) description: Promote a solidified workbook, lookup by goal, spawn without parent LLM. -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import subtask:lib/subtask.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + subtask: lib/subtask.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-lib-call.mq.md b/tests/ext/agent-lib-call.mq.md index a2bd1aa..dc5458c 100644 --- a/tests/ext/agent-lib-call.mq.md +++ b/tests/ext/agent-lib-call.mq.md @@ -1,10 +1,11 @@ --- title: Parent CALL:lib whitelist (offline) description: lib.fs.exists + ARGS; reject lib.net; catalog callable. -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-llm-transport-soft.mq.md b/tests/ext/agent-llm-transport-soft.mq.md index 436ed13..d1f6c06 100644 --- a/tests/ext/agent-llm-transport-soft.mq.md +++ b/tests/ext/agent-llm-transport-soft.mq.md @@ -3,11 +3,12 @@ title: agent / llm soft transport errors description: >- Regression (2026-10): unreachable OpenAI upstream must not abort the VM. `llm.ask` / `agent.step` / `agent.run` return structured status=error. -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import llm:ext/ai/llm.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + llm: ext/ai/llm.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-mcp-client.mq.md b/tests/ext/agent-mcp-client.mq.md index 2c26a5d..543e454 100644 --- a/tests/ext/agent-mcp-client.mq.md +++ b/tests/ext/agent-mcp-client.mq.md @@ -1,10 +1,11 @@ --- title: agent MCP stdio client (offline) description: Oneshoot list+call against python mock MCP server. -import agent:ext/ai/agent.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import json:lib/json.mq.md +import: + agent: ext/ai/agent.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/ext/agent-mcp-server-smoke.mq.md b/tests/ext/agent-mcp-server-smoke.mq.md index d85e94c..d895859 100644 --- a/tests/ext/agent-mcp-server-smoke.mq.md +++ b/tests/ext/agent-mcp-server-smoke.mq.md @@ -1,10 +1,11 @@ --- title: agent mcp server smoke description: Offline assemble mcp_server + one tool (no serve). -import agent:ext/ai/agent.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import demo:agent-mcp-server-helpers.mq.md +import: + agent: ext/ai/agent.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + demo: agent-mcp-server-helpers.mq.md --- # main diff --git a/tests/ext/agent-p4-route.mq.md b/tests/ext/agent-p4-route.mq.md index a185a42..64c1887 100644 --- a/tests/ext/agent-p4-route.mq.md +++ b/tests/ext/agent-p4-route.mq.md @@ -1,10 +1,11 @@ --- title: Agent Framework P4 — Adaptive Routing + Policy Compilation (offline) description: Learn skill, compile policy from skill-tagged episodes, route via marqdo backend without Jev/LLM. -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + fs: lib/fs.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-plan-confirm.mq.md b/tests/ext/agent-plan-confirm.mq.md index c978ee1..a548d6f 100644 --- a/tests/ext/agent-plan-confirm.mq.md +++ b/tests/ext/agent-plan-confirm.mq.md @@ -1,10 +1,11 @@ --- title: agent plan confirm (offline) description: Create workbook skeleton with confirm=True; no LLM spawn loop. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/agent-plan-decision.mq.md b/tests/ext/agent-plan-decision.mq.md index 8ddef19..2e4a915 100644 --- a/tests/ext/agent-plan-decision.mq.md +++ b/tests/ext/agent-plan-decision.mq.md @@ -1,9 +1,10 @@ --- title: agent plan decision + dual skeleton (offline) description: extract_plan_decision/summary; dual skeleton contains research+writer; patch apply on fixture. -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md +import: + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md --- # main @@ -77,7 +78,7 @@ import fs:lib/fs.mq.md 2. * > print text=solidify-missing -**has_imp = > split value=`dual` sep="import llm:ext/ai/llm.mq.md"** +**has_imp = > split value=`dual` sep="llm: ext/ai/llm.mq.md"** **n_imp = > len value=`has_imp`** 1. `n_imp` > 1 > print text=import-ok diff --git a/tests/ext/agent-plan-live.mq.md b/tests/ext/agent-plan-live.mq.md index 978bd2f..92d565d 100644 --- a/tests/ext/agent-plan-live.mq.md +++ b/tests/ext/agent-plan-live.mq.md @@ -1,10 +1,11 @@ --- title: ext/agent plan live (DeepSeek) description: Full plan loop — spawn workbook, inspect, secondary plan; simple pong goal. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/agent-plan-observe.mq.md b/tests/ext/agent-plan-observe.mq.md index 2bba5e3..8f4c946 100644 --- a/tests/ext/agent-plan-observe.mq.md +++ b/tests/ext/agent-plan-observe.mq.md @@ -1,8 +1,9 @@ --- title: parent observation excerpt + deepen (offline) -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md +import: + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/agent-plan-preserve.mq.md b/tests/ext/agent-plan-preserve.mq.md index 14e671d..c7a72c7 100644 --- a/tests/ext/agent-plan-preserve.mq.md +++ b/tests/ext/agent-plan-preserve.mq.md @@ -1,13 +1,14 @@ --- title: plan must not overwrite existing llm_free resources description: force+confirm plan keeps a pre-seeded compiled skill workbook intact (offline). -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import llm:ext/ai/llm.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import text:lib/text.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + llm: ext/ai/llm.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + text: lib/text.mq.md --- # main diff --git a/tests/ext/agent-plan-stream-offline.mq.md b/tests/ext/agent-plan-stream-offline.mq.md index b2454ca..316afc9 100644 --- a/tests/ext/agent-plan-stream-offline.mq.md +++ b/tests/ext/agent-plan-stream-offline.mq.md @@ -1,10 +1,11 @@ --- title: agent plan stream helpers + confirm (offline) description: plan_append_*/plan_finish_stream; confirm=True with stream attaches done event. -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md +import: + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/agent-resume.mq.md b/tests/ext/agent-resume.mq.md index 27b805d..04c5ac0 100644 --- a/tests/ext/agent-resume.mq.md +++ b/tests/ext/agent-resume.mq.md @@ -1,11 +1,12 @@ --- title: agent resume checkpoint (offline) description: save / load / list / clear under .marqdo/agent-resume-test -import agent:ext/ai/agent.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md +import: + agent: ext/ai/agent.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/agent-run-cold-efi.mq.md b/tests/ext/agent-run-cold-efi.mq.md index 9891a2a..18d65d5 100644 --- a/tests/ext/agent-run-cold-efi.mq.md +++ b/tests/ext/agent-run-cold-efi.mq.md @@ -5,12 +5,13 @@ description: >- (A) miss resolve must expose llm_free=false; (B) `self`.preflight must resolve when agent is imported by a consumer. Offline — dummy API key; no live network required for assertions A/B. -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import llm:ext/ai/llm.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + llm: ext/ai/llm.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-run-live.mq.md b/tests/ext/agent-run-live.mq.md index 909c628..317f51a 100644 --- a/tests/ext/agent-run-live.mq.md +++ b/tests/ext/agent-run-live.mq.md @@ -1,11 +1,12 @@ --- title: ext/agent step (DeepSeek) description: Real agent.step with tool via lib/subtask; default writeback to ok/error slots. -import time:lib/time.mq.md -import writeback:lib/writeback.mq.md -import json:lib/json.mq.md -import llm:ext/ai/llm.mq.md -import agent:ext/ai/agent.mq.md +import: + time: lib/time.mq.md + writeback: lib/writeback.mq.md + json: lib/json.mq.md + llm: ext/ai/llm.mq.md + agent: ext/ai/agent.mq.md --- ## 获取时间 diff --git a/tests/ext/agent-sandbox-optin.mq.md b/tests/ext/agent-sandbox-optin.mq.md index a247137..79c9b9e 100644 --- a/tests/ext/agent-sandbox-optin.mq.md +++ b/tests/ext/agent-sandbox-optin.mq.md @@ -3,9 +3,10 @@ title: agent trial sandbox opt-in — host unchanged until commit description: > O1: agent.trial write stays upper until commit=True. Prefer link index over json.get. -import agent:ext/ai/agent.mq.md -import sandbox:ext/ai/sandbox.mq.md -import fs:lib/fs.mq.md +import: + agent: ext/ai/agent.mq.md + sandbox: ext/ai/sandbox.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/agent-sandbox-promote.mq.md b/tests/ext/agent-sandbox-promote.mq.md index f5f4522..8f871f5 100644 --- a/tests/ext/agent-sandbox-promote.mq.md +++ b/tests/ext/agent-sandbox-promote.mq.md @@ -4,9 +4,10 @@ title: promote requires sandbox proof (O2) description: > Good workbook promotes; broken workbook is rejected (sandbox_proof_failed). Link-index reads; no json glue. -import plugin:lib/plugin.mq.md -import fs:lib/fs.mq.md -import sys:lib/sys.mq.md +import: + plugin: lib/plugin.mq.md + fs: lib/fs.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-sandbox-quarantine.mq.md b/tests/ext/agent-sandbox-quarantine.mq.md index 88bab1c..2e5466b 100644 --- a/tests/ext/agent-sandbox-quarantine.mq.md +++ b/tests/ext/agent-sandbox-quarantine.mq.md @@ -2,9 +2,10 @@ markup: occlusion title: O5 quarantine skill status description: Promote good skill then quarantine — status becomes quarantine. -import plugin:lib/plugin.mq.md -import fs:lib/fs.mq.md -import sys:lib/sys.mq.md +import: + plugin: lib/plugin.mq.md + fs: lib/fs.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-small-llm-route.mq.md b/tests/ext/agent-small-llm-route.mq.md index b0b5110..a75cde4 100644 --- a/tests/ext/agent-small-llm-route.mq.md +++ b/tests/ext/agent-small-llm-route.mq.md @@ -1,9 +1,10 @@ --- title: agent small-llm route request (offline) description: router=small-llm returns needs_llm + prompt; jev alias same shape. -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md -import json:lib/json.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/ext/agent-smoke.mq.md b/tests/ext/agent-smoke.mq.md index 5405f9d..993709c 100644 --- a/tests/ext/agent-smoke.mq.md +++ b/tests/ext/agent-smoke.mq.md @@ -1,9 +1,10 @@ --- title: ext/agent framework smoke description: Real llm handle from tests/ext/.env; context, extract_tool_name, run_tool via subtask. -import llm:ext/ai/llm.mq.md -import json:lib/json.mq.md -import agent:ext/ai/agent.mq.md +import: + llm: ext/ai/llm.mq.md + json: lib/json.mq.md + agent: ext/ai/agent.mq.md --- ## 获取时间 diff --git a/tests/ext/agent-soft-match.mq.md b/tests/ext/agent-soft-match.mq.md index bf274fb..96d288f 100644 --- a/tests/ext/agent-soft-match.mq.md +++ b/tests/ext/agent-soft-match.mq.md @@ -1,8 +1,9 @@ --- title: OKF soft_match protocol parse (offline) description: REUSE/NEW + SLUG extractors; no network. -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md +import: + agent: ext/ai/agent.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/ext/agent-step-route.mq.md b/tests/ext/agent-step-route.mq.md index 6981db8..867f747 100644 --- a/tests/ext/agent-step-route.mq.md +++ b/tests/ext/agent-step-route.mq.md @@ -1,7 +1,8 @@ --- title: O3 step_route table backends description: lookup → marqdo; net → llm; default → auto. -import agent:ext/ai/agent.mq.md +import: + agent: ext/ai/agent.mq.md --- # main diff --git a/tests/ext/agent-tools-rag-a4.mq.md b/tests/ext/agent-tools-rag-a4.mq.md index ff2977f..dc4d796 100644 --- a/tests/ext/agent-tools-rag-a4.mq.md +++ b/tests/ext/agent-tools-rag-a4.mq.md @@ -1,11 +1,12 @@ --- title: agent corpus_search + mcp fixture tools (A4 offline) description: Local RAG-lite corpus search and MCP fixture call; authority stays workbook. -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-v2-learn.mq.md b/tests/ext/agent-v2-learn.mq.md index 580c133..67e32ed 100644 --- a/tests/ext/agent-v2-learn.mq.md +++ b/tests/ext/agent-v2-learn.mq.md @@ -1,11 +1,12 @@ --- title: Agent Framework v2 — episode → learn → compile (offline) description: Record three identical successes, maybe_learn compiles llm_free skill, resolve hits compiled path. -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-workbook-patch-a0.mq.md b/tests/ext/agent-workbook-patch-a0.mq.md index 83e78e4..7b11789 100644 --- a/tests/ext/agent-workbook-patch-a0.mq.md +++ b/tests/ext/agent-workbook-patch-a0.mq.md @@ -1,11 +1,12 @@ --- title: agent workbook multi-CONTINUE patch + solidify (A0 offline) description: Two precise CONTINUE patches then agent_workbook_solidify freezes step workbook. -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md -import fs:lib/fs.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + json: lib/json.mq.md + fs: lib/fs.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/agent-writeback-shadow.mq.md b/tests/ext/agent-writeback-shadow.mq.md index 717392c..67bf1f3 100644 --- a/tests/ext/agent-writeback-shadow.mq.md +++ b/tests/ext/agent-writeback-shadow.mq.md @@ -1,10 +1,11 @@ --- title: writeback param must not shadow writeback module description: Regression — step/plan param writeback=True used to break > writeback.record (bool is not a map). Use a non-colliding import alias. -import wb:lib/writeback.mq.md -import writeback:lib/writeback.mq.md -import json:lib/json.mq.md -import sys:lib/sys.mq.md +import: + wb: lib/writeback.mq.md + writeback: lib/writeback.mq.md + json: lib/json.mq.md + sys: lib/sys.mq.md --- # box diff --git a/tests/ext/agent-zero-llm.mq.md b/tests/ext/agent-zero-llm.mq.md index 233807e..260ca4d 100644 --- a/tests/ext/agent-zero-llm.mq.md +++ b/tests/ext/agent-zero-llm.mq.md @@ -1,12 +1,13 @@ --- title: Agent zero-LLM execution after policy/skill compile description: After Skill+Policy compilation, run with router=marqdo records llm_calls=0. -import agent:ext/ai/agent.mq.md -import fs:lib/fs.mq.md -import json:lib/json.mq.md -import llm:ext/ai/llm.mq.md -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + agent: ext/ai/agent.mq.md + fs: lib/fs.mq.md + json: lib/json.mq.md + llm: ext/ai/llm.mq.md + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/ext/eng-preflight.mq.md b/tests/ext/eng-preflight.mq.md index c17afca..ae7ef92 100644 --- a/tests/ext/eng-preflight.mq.md +++ b/tests/ext/eng-preflight.mq.md @@ -1,8 +1,9 @@ --- title: eng preflight offline -import plugin:lib/plugin.mq.md -import agent:ext/ai/agent.mq.md -import json:lib/json.mq.md +import: + plugin: lib/plugin.mq.md + agent: ext/ai/agent.mq.md + json: lib/json.mq.md --- Offline Engineering Knowledge gate against `tests/engineering/.marqdo` diff --git a/tests/ext/fs-text-patch.mq.md b/tests/ext/fs-text-patch.mq.md index 3e85241..e0abe01 100644 --- a/tests/ext/fs-text-patch.mq.md +++ b/tests/ext/fs-text-patch.mq.md @@ -1,7 +1,8 @@ --- title: fs text_patch / apply_patch_blocks (offline) -import fs:lib/fs.mq.md -import json:lib/json.mq.md +import: + fs: lib/fs.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/ext/linalg-basic-smoke.mq.md b/tests/ext/linalg-basic-smoke.mq.md index 112ebdb..d4f25c2 100644 --- a/tests/ext/linalg-basic-smoke.mq.md +++ b/tests/ext/linalg-basic-smoke.mq.md @@ -1,8 +1,9 @@ --- title: linalg basic smoke (L2) description: from_formula, det, solve 2×2, explicit mul. -import la:ext/linalg/linalg.mq.md -import math:lib/math.mq.md +import: + la: ext/linalg/linalg.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/linalg-block-kron.mq.md b/tests/ext/linalg-block-kron.mq.md index 4c503d6..2310fdf 100644 --- a/tests/ext/linalg-block-kron.mq.md +++ b/tests/ext/linalg-block-kron.mq.md @@ -1,7 +1,8 @@ --- title: linalg block/kron smoke (L3) description: Lazy kron ascii; block*block collapse. -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # main diff --git a/tests/ext/linalg-doc-smoke.mq.md b/tests/ext/linalg-doc-smoke.mq.md index 3433961..b88c4e2 100644 --- a/tests/ext/linalg-doc-smoke.mq.md +++ b/tests/ext/linalg-doc-smoke.mq.md @@ -1,7 +1,8 @@ --- title: linalg formula-doc smoke (F1) description: Run-implies-correct — (AB)^T ascii without explicit simplify. -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # Transpose reverses products diff --git a/tests/ext/linalg-factor-smoke.mq.md b/tests/ext/linalg-factor-smoke.mq.md index 73b7768..16a36a5 100644 --- a/tests/ext/linalg-factor-smoke.mq.md +++ b/tests/ext/linalg-factor-smoke.mq.md @@ -1,8 +1,9 @@ --- title: linalg factor smoke (L4) description: eig factorize, structure SVG, LU reuse solve. -import la:ext/linalg/linalg.mq.md -import math:lib/math.mq.md +import: + la: ext/linalg/linalg.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/linalg-formula-smoke.mq.md b/tests/ext/linalg-formula-smoke.mq.md index 0038776..576b6b3 100644 --- a/tests/ext/linalg-formula-smoke.mq.md +++ b/tests/ext/linalg-formula-smoke.mq.md @@ -1,7 +1,8 @@ --- title: linalg formula smoke description: (AB)^T simplifies to B^T*A^T; ping ok. -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # main diff --git a/tests/ext/linalg-infix-smoke.mq.md b/tests/ext/linalg-infix-smoke.mq.md index 3e099d4..3965855 100644 --- a/tests/ext/linalg-infix-smoke.mq.md +++ b/tests/ext/linalg-infix-smoke.mq.md @@ -1,7 +1,8 @@ --- title: linalg infix and matrix methods description: A+B / A*B dispatch; `A`.T method chain; display auto-simplify. -import la:ext/linalg/linalg.mq.md +import: + la: ext/linalg/linalg.mq.md --- # main diff --git a/tests/ext/linalg-metrics-smoke.mq.md b/tests/ext/linalg-metrics-smoke.mq.md index 1b3e9bb..167c038 100644 --- a/tests/ext/linalg-metrics-smoke.mq.md +++ b/tests/ext/linalg-metrics-smoke.mq.md @@ -1,9 +1,10 @@ --- title: linalg metrics smoke (L6) description: lstsq, norm, cond, rank, complex fro, themed draw. -import la:ext/linalg/linalg.mq.md -import math:lib/math.mq.md -import json:lib/json.mq.md +import: + la: ext/linalg/linalg.mq.md + math: lib/math.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/ext/linalg-zh-smoke.mq.md b/tests/ext/linalg-zh-smoke.mq.md index f132685..e3e112f 100644 --- a/tests/ext/linalg-zh-smoke.mq.md +++ b/tests/ext/linalg-zh-smoke.mq.md @@ -1,7 +1,8 @@ --- title: 线性代数公式冒烟 description: (AB)^T 化简为 B^T*A^T;探测 ok。 -import la:ext/linalg/线性代数.mq.md +import: + la: ext/linalg/线性代数.mq.md --- # main diff --git a/tests/ext/llm-ask-offline.mq.md b/tests/ext/llm-ask-offline.mq.md index 1128031..69ea736 100644 --- a/tests/ext/llm-ask-offline.mq.md +++ b/tests/ext/llm-ask-offline.mq.md @@ -1,8 +1,9 @@ --- title: llm create + collect offline description: Factory create + collect alias; no network. -import llm:ext/ai/llm.mq.md -import net:lib/net.mq.md +import: + llm: ext/ai/llm.mq.md + net: lib/net.mq.md --- # main diff --git a/tests/ext/llm-complete.mq.md b/tests/ext/llm-complete.mq.md index ad1394d..6c5a9e6 100644 --- a/tests/ext/llm-complete.mq.md +++ b/tests/ext/llm-complete.mq.md @@ -1,7 +1,8 @@ --- title: ext llm DeepSeek complete description: OpenAI-compatible chat via DeepSeek. Credentials from tests/ext/.env. -import llm:ext/ai/llm.mq.md +import: + llm: ext/ai/llm.mq.md --- # main diff --git a/tests/ext/llm-ctor-offline.mq.md b/tests/ext/llm-ctor-offline.mq.md index 5c1df6a..ea7fa2f 100644 --- a/tests/ext/llm-ctor-offline.mq.md +++ b/tests/ext/llm-ctor-offline.mq.md @@ -1,7 +1,8 @@ --- title: llm constructor offline description: Build llm handle from env + defaults; no network. -import llm:ext/ai/llm.mq.md +import: + llm: ext/ai/llm.mq.md --- # main diff --git a/tests/ext/llm-entry-prompt-offline.mq.md b/tests/ext/llm-entry-prompt-offline.mq.md index a97d05d..99b5377 100644 --- a/tests/ext/llm-entry-prompt-offline.mq.md +++ b/tests/ext/llm-entry-prompt-offline.mq.md @@ -1,8 +1,9 @@ --- type: prompt title: entry prompt offline -import llm:ext/ai/llm.mq.md -import sys:lib/sys.mq.md +import: + llm: ext/ai/llm.mq.md + sys: lib/sys.mq.md --- Say hello to Marqdo. diff --git a/tests/ext/llm-import.mq.md b/tests/ext/llm-import.mq.md index 4bacfa8..3522c36 100644 --- a/tests/ext/llm-import.mq.md +++ b/tests/ext/llm-import.mq.md @@ -1,6 +1,7 @@ --- title: ext llm import -import llm:ext/ai/llm.mq.md +import: + llm: ext/ai/llm.mq.md --- # main diff --git a/tests/ext/llm-meta-offline.mq.md b/tests/ext/llm-meta-offline.mq.md index 6c1e39d..84c065f 100644 --- a/tests/ext/llm-meta-offline.mq.md +++ b/tests/ext/llm-meta-offline.mq.md @@ -4,7 +4,8 @@ description: Create handle from Artifact Metadata (model / api_key); no network. type: llm model: ${env.MARQDO_LLM_META_MODEL ?? "meta-model"} api_key: ${secret.OPENAI_API_KEY ?? "sk-test"} -import llm:ext/ai/llm.mq.md +import: + llm: ext/ai/llm.mq.md --- # main diff --git a/tests/ext/llm-named-offline.mq.md b/tests/ext/llm-named-offline.mq.md index b600639..7076d6c 100644 --- a/tests/ext/llm-named-offline.mq.md +++ b/tests/ext/llm-named-offline.mq.md @@ -1,8 +1,9 @@ --- title: llm named handles + prompt_load offline description: fast/reasoning names, ollama backend tag, and type:prompt body load; no network. -import llm:ext/ai/llm.mq.md -import text:lib/text.mq.md +import: + llm: ext/ai/llm.mq.md + text: lib/text.mq.md --- # main diff --git a/tests/ext/llm-stream-live.mq.md b/tests/ext/llm-stream-live.mq.md index 7c9c955..e8a44f6 100644 --- a/tests/ext/llm-stream-live.mq.md +++ b/tests/ext/llm-stream-live.mq.md @@ -1,8 +1,9 @@ --- title: ext llm DeepSeek stream live description: Live SSE complete with echo; credentials from tests/ext/.env. -import llm:ext/ai/llm.mq.md -import json:lib/json.mq.md +import: + llm: ext/ai/llm.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/ext/llm-stream-offline.mq.md b/tests/ext/llm-stream-offline.mq.md index ed5a758..b3badad 100644 --- a/tests/ext/llm-stream-offline.mq.md +++ b/tests/ext/llm-stream-offline.mq.md @@ -1,8 +1,9 @@ --- title: llm stream_result offline description: No network — SSE fixture via net.openai_sse_parse + llm.stream_result -import llm:ext/ai/llm.mq.md -import net:lib/net.mq.md +import: + llm: ext/ai/llm.mq.md + net: lib/net.mq.md --- # main diff --git a/tests/ext/llm-tool-calls-offline.mq.md b/tests/ext/llm-tool-calls-offline.mq.md index 0b2cf46..a5f8308 100644 --- a/tests/ext/llm-tool-calls-offline.mq.md +++ b/tests/ext/llm-tool-calls-offline.mq.md @@ -1,8 +1,9 @@ --- title: llm tool_calls offline description: Parse OpenAI-shaped tool_calls into a list; no network. -import openai:ext/ai/llm/openai.mq.md -import json:lib/json.mq.md +import: + openai: ext/ai/llm/openai.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/ext/quantum-amp-damp-smoke.mq.md b/tests/ext/quantum-amp-damp-smoke.mq.md index 29acc56..810128c 100644 --- a/tests/ext/quantum-amp-damp-smoke.mq.md +++ b/tests/ext/quantum-amp-damp-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum amplitude damping smoke description: X then amplitude_damping p=1 returns all shots to |0>. -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/tests/ext/quantum-amp-damp-zh-smoke.mq.md b/tests/ext/quantum-amp-damp-zh-smoke.mq.md index 8f577f9..1e6e376 100644 --- a/tests/ext/quantum-amp-damp-zh-smoke.mq.md +++ b/tests/ext/quantum-amp-damp-zh-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum amplitude damping zh smoke description: 泡利X 后 振幅阻尼 p=1 全部落回 |0⟩. -导入 量子:ext/quantum/量子.mq.md +导入: + 量子: ext/quantum/量子.mq.md --- # main diff --git a/tests/ext/quantum-author-api-smoke.mq.md b/tests/ext/quantum-author-api-smoke.mq.md index 8424c57..f0238e5 100644 --- a/tests/ext/quantum-author-api-smoke.mq.md +++ b/tests/ext/quantum-author-api-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum author API smoke description: barrier, measure, append, state, draw meters. -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/tests/ext/quantum-author-api-zh-smoke.mq.md b/tests/ext/quantum-author-api-zh-smoke.mq.md index 1b7057e..9e34ac0 100644 --- a/tests/ext/quantum-author-api-zh-smoke.mq.md +++ b/tests/ext/quantum-author-api-zh-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum author API zh smoke description: 屏障 / 测量 / 追加 / 态 / 绘图. -导入 量子:ext/quantum/量子.mq.md +导入: + 量子: ext/quantum/量子.mq.md --- # main diff --git a/tests/ext/quantum-bell-smoke.mq.md b/tests/ext/quantum-bell-smoke.mq.md index 50ad492..751509b 100644 --- a/tests/ext/quantum-bell-smoke.mq.md +++ b/tests/ext/quantum-bell-smoke.mq.md @@ -1,8 +1,9 @@ --- title: quantum bell smoke description: H+CX Bell state probabilities ≈ 1/2 each. -import quantum:ext/quantum/quantum.mq.md -import math:lib/math.mq.md +import: + quantum: ext/quantum/quantum.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/quantum-custom-gate-smoke.mq.md b/tests/ext/quantum-custom-gate-smoke.mq.md index 78f03be..e6862eb 100644 --- a/tests/ext/quantum-custom-gate-smoke.mq.md +++ b/tests/ext/quantum-custom-gate-smoke.mq.md @@ -1,8 +1,9 @@ --- title: quantum custom gate from formula matrix description: $$ H matrix $$ → gate matrix= → apply → probs match built-in H. -import quantum:ext/quantum/quantum.mq.md -import math:lib/math.mq.md +import: + quantum: ext/quantum/quantum.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/quantum-custom-gate-zh-smoke.mq.md b/tests/ext/quantum-custom-gate-zh-smoke.mq.md index 552b2b8..33d56c8 100644 --- a/tests/ext/quantum-custom-gate-zh-smoke.mq.md +++ b/tests/ext/quantum-custom-gate-zh-smoke.mq.md @@ -1,8 +1,9 @@ --- title: quantum custom gate zh from formula description: $$ 矩阵 $$ → 门 矩阵= → 施加. -导入 量子:ext/quantum/量子.mq.md -import math:lib/math.mq.md +导入: + 量子: ext/quantum/量子.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/quantum-draw-smoke.mq.md b/tests/ext/quantum-draw-smoke.mq.md index 591707d..efd2cfa 100644 --- a/tests/ext/quantum-draw-smoke.mq.md +++ b/tests/ext/quantum-draw-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum draw probs/bloch smoke description: draw kind=probs and kind=bloch return matching kind tags. -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/tests/ext/quantum-gate-heatmap-smoke.mq.md b/tests/ext/quantum-gate-heatmap-smoke.mq.md index e5aa3c4..efbfcf9 100644 --- a/tests/ext/quantum-gate-heatmap-smoke.mq.md +++ b/tests/ext/quantum-gate-heatmap-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum gate matrix heatmap smoke description: gate.draw kind=matrix writes SVG heatmap. -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/tests/ext/quantum-gate-matrix-smoke.mq.md b/tests/ext/quantum-gate-matrix-smoke.mq.md index 2c17fe7..1724356 100644 --- a/tests/ext/quantum-gate-matrix-smoke.mq.md +++ b/tests/ext/quantum-gate-matrix-smoke.mq.md @@ -1,8 +1,9 @@ --- title: quantum gate matches_matrix smoke description: Named H matches an explicit 2x2 nested list. -import quantum:ext/quantum/quantum.mq.md -import json:lib/json.mq.md +import: + quantum: ext/quantum/quantum.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/ext/quantum-gates-smoke.mq.md b/tests/ext/quantum-gates-smoke.mq.md index b3ea95e..e89e04f 100644 --- a/tests/ext/quantum-gates-smoke.mq.md +++ b/tests/ext/quantum-gates-smoke.mq.md @@ -1,8 +1,9 @@ --- title: quantum gates + run smoke description: Z sandwich, Ry(pi), seeded Bell run counts. -import quantum:ext/quantum/quantum.mq.md -import math:lib/math.mq.md +import: + quantum: ext/quantum/quantum.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/quantum-linalg-smoke.mq.md b/tests/ext/quantum-linalg-smoke.mq.md index b6c5860..696afcd 100644 --- a/tests/ext/quantum-linalg-smoke.mq.md +++ b/tests/ext/quantum-linalg-smoke.mq.md @@ -1,8 +1,9 @@ --- title: quantum linalg smoke description: Q7a density / partial_trace / expect / schmidt / purity -import quantum:ext/quantum/quantum.mq.md -import math:lib/math.mq.md +import: + quantum: ext/quantum/quantum.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/quantum-noise-smoke.mq.md b/tests/ext/quantum-noise-smoke.mq.md index a9c1981..675e107 100644 --- a/tests/ext/quantum-noise-smoke.mq.md +++ b/tests/ext/quantum-noise-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum noise smoke description: bitflip p=1 after I flips |0> to |1| for all shots. -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/tests/ext/quantum-noise-zh-smoke.mq.md b/tests/ext/quantum-noise-zh-smoke.mq.md index 0b7f001..5bc399c 100644 --- a/tests/ext/quantum-noise-zh-smoke.mq.md +++ b/tests/ext/quantum-noise-zh-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum noise zh smoke description: 噪声 bitflip p=1 后 I 使全部射中 |1⟩. -导入 量子:ext/quantum/量子.mq.md +导入: + 量子: ext/quantum/量子.mq.md --- # main diff --git a/tests/ext/quantum-steps-smoke.mq.md b/tests/ext/quantum-steps-smoke.mq.md index ddc66db..69d1b93 100644 --- a/tests/ext/quantum-steps-smoke.mq.md +++ b/tests/ext/quantum-steps-smoke.mq.md @@ -1,8 +1,9 @@ --- title: quantum steps + draw smoke description: steps= Bell table + draw SVG via record_plot. -import quantum:ext/quantum/quantum.mq.md -import math:lib/math.mq.md +import: + quantum: ext/quantum/quantum.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/quantum-viz-advanced-smoke.mq.md b/tests/ext/quantum-viz-advanced-smoke.mq.md index abda265..37b0d39 100644 --- a/tests/ext/quantum-viz-advanced-smoke.mq.md +++ b/tests/ext/quantum-viz-advanced-smoke.mq.md @@ -1,7 +1,8 @@ --- title: quantum viz advanced smoke description: Q7b hinton / qsphere / multibloch SVG markers -import quantum:ext/quantum/quantum.mq.md +import: + quantum: ext/quantum/quantum.mq.md --- # main diff --git a/tests/ext/quantum-zh-smoke.mq.md b/tests/ext/quantum-zh-smoke.mq.md index c2cc7e8..6a93036 100644 --- a/tests/ext/quantum-zh-smoke.mq.md +++ b/tests/ext/quantum-zh-smoke.mq.md @@ -1,8 +1,9 @@ --- title: quantum zh API smoke description: Chinese 量子.电路 泡利Z sandwich. -导入 量子:ext/quantum/量子.mq.md -import math:lib/math.mq.md +导入: + 量子: ext/quantum/量子.mq.md + math: lib/math.mq.md --- # main diff --git a/tests/ext/sandbox-cow.mq.md b/tests/ext/sandbox-cow.mq.md index 1987093..bc71421 100644 --- a/tests/ext/sandbox-cow.mq.md +++ b/tests/ext/sandbox-cow.mq.md @@ -3,8 +3,9 @@ title: sandbox CoW — write stays upper until commit description: > Readable trial: seed on disk, mutate in session, host tree unchanged, then commit / discard. Prefer link index over json.get. -import sandbox:ext/ai/sandbox.mq.md -import fs:lib/fs.mq.md +import: + sandbox: ext/ai/sandbox.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/sandbox-deny.mq.md b/tests/ext/sandbox-deny.mq.md index df1e9e3..60004b1 100644 --- a/tests/ext/sandbox-deny.mq.md +++ b/tests/ext/sandbox-deny.mq.md @@ -3,7 +3,8 @@ title: sandbox.run — plugin.load denied; inspect lists notes description: > Guest that loads a native plugin must fail with unavailable in sandbox. No json.get chains — link index + a small expect table. -import sandbox:ext/ai/sandbox.mq.md +import: + sandbox: ext/ai/sandbox.mq.md --- # main diff --git a/tests/ext/sandbox-fixtures/guest-json.mq.md b/tests/ext/sandbox-fixtures/guest-json.mq.md index 7919bd1..4a7de3f 100644 --- a/tests/ext/sandbox-fixtures/guest-json.mq.md +++ b/tests/ext/sandbox-fixtures/guest-json.mq.md @@ -1,5 +1,6 @@ --- -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/tests/ext/sandbox-fixtures/guest-plugin.mq.md b/tests/ext/sandbox-fixtures/guest-plugin.mq.md index 26db62d..d5fc25d 100644 --- a/tests/ext/sandbox-fixtures/guest-plugin.mq.md +++ b/tests/ext/sandbox-fixtures/guest-plugin.mq.md @@ -1,5 +1,6 @@ --- -import plugin:lib/plugin.mq.md +import: + plugin: lib/plugin.mq.md --- # main diff --git a/tests/ext/sandbox-run-lib.mq.md b/tests/ext/sandbox-run-lib.mq.md index 50ab1d8..a8496cc 100644 --- a/tests/ext/sandbox-run-lib.mq.md +++ b/tests/ext/sandbox-run-lib.mq.md @@ -1,7 +1,8 @@ --- title: sandbox.run — core lib/json inside the trial description: Guest fixture imports lib/json; print ok and guest stdout via link index. -import sandbox:ext/ai/sandbox.mq.md +import: + sandbox: ext/ai/sandbox.mq.md --- # main diff --git a/tests/ext/web-artifact-render-smoke.mq.md b/tests/ext/web-artifact-render-smoke.mq.md index 9302ce0..1f25ffc 100644 --- a/tests/ext/web-artifact-render-smoke.mq.md +++ b/tests/ext/web-artifact-render-smoke.mq.md @@ -1,8 +1,9 @@ --- title: web artifact render smoke description: Unified View nodes + document render (ADR 0007); offline, no listen. -import web:ext/web/web.mq.md -import text:lib/text.mq.md +import: + web: ext/web/web.mq.md + text: lib/text.mq.md --- # main diff --git a/tests/ext/web-artifact-site/serve.mq.md b/tests/ext/web-artifact-site/serve.mq.md index 37b3fa3..59b59ef 100644 --- a/tests/ext/web-artifact-site/serve.mq.md +++ b/tests/ext/web-artifact-site/serve.mq.md @@ -1,6 +1,7 @@ --- title: artifact site serve -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main diff --git a/tests/ext/web-cache-artifact-smoke.mq.md b/tests/ext/web-cache-artifact-smoke.mq.md index 3b2221b..9339498 100644 --- a/tests/ext/web-cache-artifact-smoke.mq.md +++ b/tests/ext/web-cache-artifact-smoke.mq.md @@ -1,6 +1,7 @@ --- title: ext/data cache smoke -import cache:ext/data/cache.mq.md +import: + cache: ext/data/cache.mq.md --- # main diff --git a/tests/ext/web-data-db-smoke.mq.md b/tests/ext/web-data-db-smoke.mq.md index 2575d3a..25e9f30 100644 --- a/tests/ext/web-data-db-smoke.mq.md +++ b/tests/ext/web-data-db-smoke.mq.md @@ -1,8 +1,9 @@ --- title: ext/data db smoke description: DB Resource lives in ext/data (ADR 0007). -import data:ext/data/db.mq.md -import fs:lib/fs.mq.md +import: + data: ext/data/db.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/ext/web-rbac-artifact-smoke.mq.md b/tests/ext/web-rbac-artifact-smoke.mq.md index 0328e59..0078517 100644 --- a/tests/ext/web-rbac-artifact-smoke.mq.md +++ b/tests/ext/web-rbac-artifact-smoke.mq.md @@ -1,6 +1,7 @@ --- title: ext/security rbac smoke -import rbac:ext/security/rbac.mq.md +import: + rbac: ext/security/rbac.mq.md --- # main diff --git a/tests/ext/web-static-artifact-smoke.mq.md b/tests/ext/web-static-artifact-smoke.mq.md index 36e70bf..843156b 100644 --- a/tests/ext/web-static-artifact-smoke.mq.md +++ b/tests/ext/web-static-artifact-smoke.mq.md @@ -1,6 +1,7 @@ --- title: web static artifact smoke -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main diff --git a/tests/ext/web-use-smoke.mq.md b/tests/ext/web-use-smoke.mq.md index d012850..7a9271d 100644 --- a/tests/ext/web-use-smoke.mq.md +++ b/tests/ext/web-use-smoke.mq.md @@ -1,7 +1,8 @@ --- title: web.use middleware smoke description: First-class middleware via web.use (replaces configure junk drawer). -import web:ext/web/web.mq.md +import: + web: ext/web/web.mq.md --- # main diff --git a/tests/gold.rs b/tests/gold.rs index dcb2d66..3265b8e 100644 --- a/tests/gold.rs +++ b/tests/gold.rs @@ -494,7 +494,7 @@ fn bytecode_ns_use() { fn error_ns_instance_method() { assert_err( "tests/errors/ns-instance-method.mq.md", - "8:1", + "9:1", "instance method", ); } @@ -508,6 +508,15 @@ fn error_legacy_gt_import() { ); } +#[test] +fn error_legacy_oneliner_import() { + assert_err( + "tests/errors/legacy-oneliner-import.mq.md", + "3:1", + "legacy frontmatter import", + ); +} + #[test] fn structure_fn_end_hr() { @@ -1872,7 +1881,7 @@ fn ext_cli_add_list_remove_llm() { let mq = tmp.join("smoke.mq.md"); std::fs::write( &mq, - "---\nimport llm:ext/ai/llm.mq.md\n---\n\n# main\n\n> print text=ext-cli-ok\n", + "---\nimport:\n llm: ext/ai/llm.mq.md\n---\n\n# main\n\n> print text=ext-cli-ok\n", ) .unwrap(); let run = Command::new(bin) diff --git a/tests/lib/cli-sort-smoke.mq.md b/tests/lib/cli-sort-smoke.mq.md index f2169aa..246a5ce 100644 --- a/tests/lib/cli-sort-smoke.mq.md +++ b/tests/lib/cli-sort-smoke.mq.md @@ -1,9 +1,10 @@ --- markup: occlusion title: table sort_by + cli -import table:lib/table.mq.md -import csv:lib/csv.mq.md -import cli:lib/cli.mq.md +import: + table: lib/table.mq.md + csv: lib/csv.mq.md + cli: lib/cli.mq.md --- # main diff --git a/tests/lib/csv-smoke.mq.md b/tests/lib/csv-smoke.mq.md index 6a825b2..e0378be 100644 --- a/tests/lib/csv-smoke.mq.md +++ b/tests/lib/csv-smoke.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: lib/csv smoke -import csv:lib/csv.mq.md +import: + csv: lib/csv.mq.md --- # main diff --git a/tests/lib/datetime-smoke.mq.md b/tests/lib/datetime-smoke.mq.md index 5f0ded9..7475911 100644 --- a/tests/lib/datetime-smoke.mq.md +++ b/tests/lib/datetime-smoke.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: lib/datetime smoke -import dt:lib/datetime.mq.md +import: + dt: lib/datetime.mq.md --- # main diff --git a/tests/lib/encoding-smoke.mq.md b/tests/lib/encoding-smoke.mq.md index de921f0..6258183 100644 --- a/tests/lib/encoding-smoke.mq.md +++ b/tests/lib/encoding-smoke.mq.md @@ -1,6 +1,7 @@ --- title: lib/encoding smoke -import enc:lib/encoding.mq.md +import: + enc: lib/encoding.mq.md --- # main diff --git a/tests/lib/foreign-call.mq.md b/tests/lib/foreign-call.mq.md index 0d23559..6068ed3 100644 --- a/tests/lib/foreign-call.mq.md +++ b/tests/lib/foreign-call.mq.md @@ -1,6 +1,7 @@ --- title: foreign call and call_many -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-config.mq.md b/tests/lib/foreign-config.mq.md index e3e3a11..38bb1ec 100644 --- a/tests/lib/foreign-config.mq.md +++ b/tests/lib/foreign-config.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: foreign config load -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-env-timeout.mq.md b/tests/lib/foreign-env-timeout.mq.md index b3bd45e..fc82e33 100644 --- a/tests/lib/foreign-env-timeout.mq.md +++ b/tests/lib/foreign-env-timeout.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: foreign env cwd timeout -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-invoke.mq.md b/tests/lib/foreign-invoke.mq.md index 9926019..091ebe7 100644 --- a/tests/lib/foreign-invoke.mq.md +++ b/tests/lib/foreign-invoke.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: foreign invoke record -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-json.mq.md b/tests/lib/foreign-json.mq.md index 461702b..60173cd 100644 --- a/tests/lib/foreign-json.mq.md +++ b/tests/lib/foreign-json.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: foreign invoke JSON input -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-probe-register.mq.md b/tests/lib/foreign-probe-register.mq.md index d14c789..9e16e66 100644 --- a/tests/lib/foreign-probe-register.mq.md +++ b/tests/lib/foreign-probe-register.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: foreign probe and register -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-python.mq.md b/tests/lib/foreign-python.mq.md index 8a37dc9..709c7c1 100644 --- a/tests/lib/foreign-python.mq.md +++ b/tests/lib/foreign-python.mq.md @@ -1,6 +1,7 @@ --- title: foreign python hello -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-run-lang.mq.md b/tests/lib/foreign-run-lang.mq.md index 80d9fc7..b305c51 100644 --- a/tests/lib/foreign-run-lang.mq.md +++ b/tests/lib/foreign-run-lang.mq.md @@ -1,6 +1,7 @@ --- title: foreign run_lang -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-session-python.mq.md b/tests/lib/foreign-session-python.mq.md index 92892bb..7856901 100644 --- a/tests/lib/foreign-session-python.mq.md +++ b/tests/lib/foreign-session-python.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: foreign python session -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-session-timeout.mq.md b/tests/lib/foreign-session-timeout.mq.md index e8a84d4..12791c9 100644 --- a/tests/lib/foreign-session-timeout.mq.md +++ b/tests/lib/foreign-session-timeout.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: foreign session timeout -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/foreign-session.mq.md b/tests/lib/foreign-session.mq.md index d9392ff..bfee26a 100644 --- a/tests/lib/foreign-session.mq.md +++ b/tests/lib/foreign-session.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: foreign persistent session -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/lib/fs-copy-move.mq.md b/tests/lib/fs-copy-move.mq.md index db62910..7ea0654 100644 --- a/tests/lib/fs-copy-move.mq.md +++ b/tests/lib/fs-copy-move.mq.md @@ -1,6 +1,7 @@ --- title: fs copy/move/temp -import fs:lib/fs.mq.md +import: + fs: lib/fs.mq.md --- # main diff --git a/tests/lib/fs-mid2-smoke.mq.md b/tests/lib/fs-mid2-smoke.mq.md index 5323ef3..20a3596 100644 --- a/tests/lib/fs-mid2-smoke.mq.md +++ b/tests/lib/fs-mid2-smoke.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: fs mid2 M9 smoke -import fs:lib/fs.mq.md +import: + fs: lib/fs.mq.md --- # main diff --git a/tests/lib/fs-read.mq.md b/tests/lib/fs-read.mq.md index 780227f..6aa5e2e 100644 --- a/tests/lib/fs-read.mq.md +++ b/tests/lib/fs-read.mq.md @@ -1,6 +1,7 @@ --- title: fs read/exists -import fs:lib/fs.mq.md +import: + fs: lib/fs.mq.md --- # main diff --git a/tests/lib/hash-smoke.mq.md b/tests/lib/hash-smoke.mq.md index 6f0930c..34a8b11 100644 --- a/tests/lib/hash-smoke.mq.md +++ b/tests/lib/hash-smoke.mq.md @@ -1,6 +1,7 @@ --- title: lib/hash smoke -import hash:lib/hash.mq.md +import: + hash: lib/hash.mq.md --- # main diff --git a/tests/lib/json-quote.mq.md b/tests/lib/json-quote.mq.md index bb7088f..24e8755 100644 --- a/tests/lib/json-quote.mq.md +++ b/tests/lib/json-quote.mq.md @@ -1,6 +1,7 @@ --- title: json quote -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/tests/lib/json-roundtrip.mq.md b/tests/lib/json-roundtrip.mq.md index 33246f7..4559893 100644 --- a/tests/lib/json-roundtrip.mq.md +++ b/tests/lib/json-roundtrip.mq.md @@ -1,7 +1,8 @@ --- title: json roundtrip -import fs:lib/fs.mq.md -import json:lib/json.mq.md +import: + fs: lib/fs.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/lib/log-uuid-smoke.mq.md b/tests/lib/log-uuid-smoke.mq.md index 92ee815..c9bb4cc 100644 --- a/tests/lib/log-uuid-smoke.mq.md +++ b/tests/lib/log-uuid-smoke.mq.md @@ -1,8 +1,9 @@ --- title: lib/log + uuid smoke -import log:lib/log.mq.md -import uuid:lib/uuid.mq.md -import re:lib/re.mq.md +import: + log: lib/log.mq.md + uuid: lib/uuid.mq.md + re: lib/re.mq.md --- # main diff --git a/tests/lib/math-formula-chain.mq.md b/tests/lib/math-formula-chain.mq.md index 878033d..c9b2fe8 100644 --- a/tests/lib/math-formula-chain.mq.md +++ b/tests/lib/math-formula-chain.mq.md @@ -1,6 +1,7 @@ --- title: math formula chain -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/tests/lib/math-formula.mq.md b/tests/lib/math-formula.mq.md index 2441240..ec46942 100644 --- a/tests/lib/math-formula.mq.md +++ b/tests/lib/math-formula.mq.md @@ -1,6 +1,7 @@ --- title: math formula pipeline -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/tests/lib/math-plot.mq.md b/tests/lib/math-plot.mq.md index 0f0dffb..97d99a2 100644 --- a/tests/lib/math-plot.mq.md +++ b/tests/lib/math-plot.mq.md @@ -1,6 +1,7 @@ --- title: math plot svg -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/tests/lib/math-random.mq.md b/tests/lib/math-random.mq.md index a333948..0b1060e 100644 --- a/tests/lib/math-random.mq.md +++ b/tests/lib/math-random.mq.md @@ -1,6 +1,7 @@ --- title: math random seed -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/tests/lib/net-cookie.mq.md b/tests/lib/net-cookie.mq.md index 6164c45..33b3252 100644 --- a/tests/lib/net-cookie.mq.md +++ b/tests/lib/net-cookie.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: net cookie_parse -import net:lib/net.mq.md +import: + net: lib/net.mq.md --- # main diff --git a/tests/lib/net-encode.mq.md b/tests/lib/net-encode.mq.md index a9dffc5..6fb32d7 100644 --- a/tests/lib/net-encode.mq.md +++ b/tests/lib/net-encode.mq.md @@ -1,6 +1,7 @@ --- title: net url_encode -import net:lib/net.mq.md +import: + net: lib/net.mq.md --- # main diff --git a/tests/lib/net-markdown.mq.md b/tests/lib/net-markdown.mq.md index 1eefb8f..721deef 100644 --- a/tests/lib/net-markdown.mq.md +++ b/tests/lib/net-markdown.mq.md @@ -1,6 +1,7 @@ --- title: lib/net markdown_parse smoke -import net:lib/net.mq.md +import: + net: lib/net.mq.md --- # main diff --git a/tests/lib/net-multipart.mq.md b/tests/lib/net-multipart.mq.md index ec636b5..eede525 100644 --- a/tests/lib/net-multipart.mq.md +++ b/tests/lib/net-multipart.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: net multipart_parse -import net:lib/net.mq.md +import: + net: lib/net.mq.md --- # main diff --git a/tests/lib/net-openai-sse-reasoning.mq.md b/tests/lib/net-openai-sse-reasoning.mq.md index 7d25626..c2a9e30 100644 --- a/tests/lib/net-openai-sse-reasoning.mq.md +++ b/tests/lib/net-openai-sse-reasoning.mq.md @@ -1,8 +1,9 @@ --- title: openai SSE reasoning_content offline description: DeepSeek-style thinking streams as type=reasoning; answer stays delta/done.result. -import net:lib/net.mq.md -import json:lib/json.mq.md +import: + net: lib/net.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/lib/net-openai-sse.mq.md b/tests/lib/net-openai-sse.mq.md index 89d7fd7..8681e71 100644 --- a/tests/lib/net-openai-sse.mq.md +++ b/tests/lib/net-openai-sse.mq.md @@ -1,8 +1,9 @@ --- markup: occlusion title: openai SSE parse offline -import net:lib/net.mq.md -import json:lib/json.mq.md +import: + net: lib/net.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/lib/path-smoke.mq.md b/tests/lib/path-smoke.mq.md index b52dae5..3429f7d 100644 --- a/tests/lib/path-smoke.mq.md +++ b/tests/lib/path-smoke.mq.md @@ -1,6 +1,7 @@ --- title: lib/path smoke -import path:lib/path.mq.md +import: + path: lib/path.mq.md --- # main diff --git a/tests/lib/plugin-demo.mq.md b/tests/lib/plugin-demo.mq.md index 51db151..59a965c 100644 --- a/tests/lib/plugin-demo.mq.md +++ b/tests/lib/plugin-demo.mq.md @@ -1,8 +1,9 @@ --- title: plugin demo ABI description: Loads demo cdylib; path from MARQDO_TEST_PLUGIN (set by gold harness). -import plugin:lib/plugin.mq.md -import sys:lib/sys.mq.md +import: + plugin: lib/plugin.mq.md + sys: lib/sys.mq.md --- # main diff --git a/tests/lib/re-smoke.mq.md b/tests/lib/re-smoke.mq.md index 42e0df8..dc3659c 100644 --- a/tests/lib/re-smoke.mq.md +++ b/tests/lib/re-smoke.mq.md @@ -1,6 +1,7 @@ --- title: lib/re smoke -import re:lib/re.mq.md +import: + re: lib/re.mq.md --- # main diff --git a/tests/lib/secrets-smoke.mq.md b/tests/lib/secrets-smoke.mq.md index 9f61299..4216b35 100644 --- a/tests/lib/secrets-smoke.mq.md +++ b/tests/lib/secrets-smoke.mq.md @@ -1,6 +1,7 @@ --- title: lib/secrets smoke -import sec:lib/secrets.mq.md +import: + sec: lib/secrets.mq.md --- # main diff --git a/tests/lib/stats-log-smoke.mq.md b/tests/lib/stats-log-smoke.mq.md index a9432af..7e5e91e 100644 --- a/tests/lib/stats-log-smoke.mq.md +++ b/tests/lib/stats-log-smoke.mq.md @@ -1,7 +1,8 @@ --- title: lib/stats + log fields M10 smoke -import stats:lib/stats.mq.md -import log:lib/log.mq.md +import: + stats: lib/stats.mq.md + log: lib/log.mq.md --- # main diff --git a/tests/lib/subtask-fn.mq.md b/tests/lib/subtask-fn.mq.md index e8f07d2..ff25ec3 100644 --- a/tests/lib/subtask-fn.mq.md +++ b/tests/lib/subtask-fn.mq.md @@ -1,7 +1,8 @@ --- title: subtask spawn fn -import subtask:lib/subtask.mq.md -import json:lib/json.mq.md +import: + subtask: lib/subtask.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/lib/subtask-foreign.mq.md b/tests/lib/subtask-foreign.mq.md index aa6e21d..c85c84b 100644 --- a/tests/lib/subtask-foreign.mq.md +++ b/tests/lib/subtask-foreign.mq.md @@ -1,6 +1,7 @@ --- title: subtask foreign spawn -import subtask:lib/subtask.mq.md +import: + subtask: lib/subtask.mq.md --- # main diff --git a/tests/lib/subtask-quiet-io.mq.md b/tests/lib/subtask-quiet-io.mq.md index ec49670..83bf199 100644 --- a/tests/lib/subtask-quiet-io.mq.md +++ b/tests/lib/subtask-quiet-io.mq.md @@ -1,7 +1,8 @@ --- title: quiet file subtask captures stdout/stderr -import subtask:lib/subtask.mq.md -import json:lib/json.mq.md +import: + subtask: lib/subtask.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/lib/subtask-spawn.mq.md b/tests/lib/subtask-spawn.mq.md index 88e8973..e89a593 100644 --- a/tests/lib/subtask-spawn.mq.md +++ b/tests/lib/subtask-spawn.mq.md @@ -1,7 +1,8 @@ --- title: subtask spawn join -import subtask:lib/subtask.mq.md -import json:lib/json.mq.md +import: + subtask: lib/subtask.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/lib/sys-cwd.mq.md b/tests/lib/sys-cwd.mq.md index 0ab752e..691a7ac 100644 --- a/tests/lib/sys-cwd.mq.md +++ b/tests/lib/sys-cwd.mq.md @@ -1,6 +1,7 @@ --- title: sys cwd -import sys:lib/sys.mq.md +import: + sys: lib/sys.mq.md --- # main diff --git a/tests/lib/sys-dotenv.mq.md b/tests/lib/sys-dotenv.mq.md index 478cfd6..e659eb6 100644 --- a/tests/lib/sys-dotenv.mq.md +++ b/tests/lib/sys-dotenv.mq.md @@ -1,7 +1,8 @@ --- title: sys dotenv -import sys:lib/sys.mq.md -import fs:lib/fs.mq.md +import: + sys: lib/sys.mq.md + fs: lib/fs.mq.md --- # main diff --git a/tests/lib/sys-exec-capture.mq.md b/tests/lib/sys-exec-capture.mq.md index d774ddc..65d3414 100644 --- a/tests/lib/sys-exec-capture.mq.md +++ b/tests/lib/sys-exec-capture.mq.md @@ -2,8 +2,9 @@ markup: occlusion title: sys.exec capture=True returns stdout map description: GAP-09 optional capture. -import sys:lib/sys.mq.md -import json:lib/json.mq.md +import: + sys: lib/sys.mq.md + json: lib/json.mq.md --- # main diff --git a/tests/lib/table-collections.mq.md b/tests/lib/table-collections.mq.md index 3791fd3..9b297e7 100644 --- a/tests/lib/table-collections.mq.md +++ b/tests/lib/table-collections.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: table collections description: put + list/map helpers -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- # main diff --git a/tests/lib/table-list-mid.mq.md b/tests/lib/table-list-mid.mq.md index 96da6da..46cd29c 100644 --- a/tests/lib/table-list-mid.mq.md +++ b/tests/lib/table-list-mid.mq.md @@ -1,6 +1,7 @@ --- title: table list mid smoke -import table:lib/table.mq.md +import: + table: lib/table.mq.md --- # main diff --git a/tests/lib/text-mid-smoke.mq.md b/tests/lib/text-mid-smoke.mq.md index 569c452..cc60561 100644 --- a/tests/lib/text-mid-smoke.mq.md +++ b/tests/lib/text-mid-smoke.mq.md @@ -1,6 +1,7 @@ --- title: lib/text mid smoke -import text:lib/text.mq.md +import: + text: lib/text.mq.md --- # main diff --git a/tests/lib/time-format.mq.md b/tests/lib/time-format.mq.md index 7e0bda1..edd86e5 100644 --- a/tests/lib/time-format.mq.md +++ b/tests/lib/time-format.mq.md @@ -1,6 +1,7 @@ --- title: time format/parse -import time:lib/time.mq.md +import: + time: lib/time.mq.md --- # main diff --git a/tests/lib/toml-html-encoding-smoke.mq.md b/tests/lib/toml-html-encoding-smoke.mq.md index 0b8c4cc..52496e5 100644 --- a/tests/lib/toml-html-encoding-smoke.mq.md +++ b/tests/lib/toml-html-encoding-smoke.mq.md @@ -1,9 +1,10 @@ --- markup: occlusion title: lib/toml html encoding M8 smoke -import toml:lib/toml.mq.md -import html:lib/html.mq.md -import enc:lib/encoding.mq.md +import: + toml: lib/toml.mq.md + html: lib/html.mq.md + enc: lib/encoding.mq.md --- # main diff --git a/tests/lib/url-smoke.mq.md b/tests/lib/url-smoke.mq.md index 66683c6..91a8362 100644 --- a/tests/lib/url-smoke.mq.md +++ b/tests/lib/url-smoke.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: lib/url smoke -import url:lib/url.mq.md +import: + url: lib/url.mq.md --- # main diff --git a/tests/lib/writeback-async.mq.md b/tests/lib/writeback-async.mq.md index caf76ff..ed773e7 100644 --- a/tests/lib/writeback-async.mq.md +++ b/tests/lib/writeback-async.mq.md @@ -1,9 +1,10 @@ --- title: async writeback via subtask description: Fire-and-forget persist_slot with explicit line=; join on exit. -import writeback:lib/writeback.mq.md -import subtask:lib/subtask.mq.md -import json:lib/json.mq.md +import: + writeback: lib/writeback.mq.md + subtask: lib/subtask.mq.md + json: lib/json.mq.md --- ## persist_slot diff --git a/tests/lib/writeback-get.mq.md b/tests/lib/writeback-get.mq.md index 0dba4cb..db772a6 100644 --- a/tests/lib/writeback-get.mq.md +++ b/tests/lib/writeback-get.mq.md @@ -1,6 +1,7 @@ --- title: writeback get -import writeback:lib/writeback.mq.md +import: + writeback: lib/writeback.mq.md --- # main diff --git a/tests/lib/哈希-烟测.mq.md b/tests/lib/哈希-烟测.mq.md index b0c9e11..785541b 100644 --- a/tests/lib/哈希-烟测.mq.md +++ b/tests/lib/哈希-烟测.mq.md @@ -1,6 +1,7 @@ --- title: lib/哈希 烟测 -导入 哈希:lib/哈希.mq.md +导入: + 哈希: lib/哈希.mq.md --- # main diff --git a/tests/lib/地址-烟测.mq.md b/tests/lib/地址-烟测.mq.md index c9b2c38..6c95ef4 100644 --- a/tests/lib/地址-烟测.mq.md +++ b/tests/lib/地址-烟测.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: lib/地址 烟测 -导入 址:lib/地址.mq.md +导入: + 址: lib/地址.mq.md --- # main diff --git a/tests/lib/外联-python.mq.md b/tests/lib/外联-python.mq.md index 522d552..f7653f6 100644 --- a/tests/lib/外联-python.mq.md +++ b/tests/lib/外联-python.mq.md @@ -1,6 +1,7 @@ --- title: foreign zh -导入 外联:lib/外联.mq.md +导入: + 外联: lib/外联.mq.md --- # main diff --git a/tests/lib/数学-数值.mq.md b/tests/lib/数学-数值.mq.md index 5c3e8ff..e040b8c 100644 --- a/tests/lib/数学-数值.mq.md +++ b/tests/lib/数学-数值.mq.md @@ -1,6 +1,7 @@ --- title: math num + zh -导入 数学:lib/数学.mq.md +导入: + 数学: lib/数学.mq.md --- # main diff --git a/tests/lib/文件-mid2-烟测.mq.md b/tests/lib/文件-mid2-烟测.mq.md index 68af42a..28073f7 100644 --- a/tests/lib/文件-mid2-烟测.mq.md +++ b/tests/lib/文件-mid2-烟测.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: 文件 Mid2 M9 烟测 -导入 文件:lib/文件.mq.md +导入: + 文件: lib/文件.mq.md --- # main diff --git a/tests/lib/文件-复制.mq.md b/tests/lib/文件-复制.mq.md index ba65855..c2f505e 100644 --- a/tests/lib/文件-复制.mq.md +++ b/tests/lib/文件-复制.mq.md @@ -1,6 +1,7 @@ --- title: 文件 复制移动 -导入 文件:lib/文件.mq.md +导入: + 文件: lib/文件.mq.md --- # main diff --git a/tests/lib/文件-读.mq.md b/tests/lib/文件-读.mq.md index 5f4388e..de2aeb8 100644 --- a/tests/lib/文件-读.mq.md +++ b/tests/lib/文件-读.mq.md @@ -1,6 +1,7 @@ --- title: 中文文件库 -导入 文件:lib/文件.mq.md +导入: + 文件: lib/文件.mq.md --- # main diff --git a/tests/lib/文本-加厚-烟测.mq.md b/tests/lib/文本-加厚-烟测.mq.md index 5d51485..55ad3ef 100644 --- a/tests/lib/文本-加厚-烟测.mq.md +++ b/tests/lib/文本-加厚-烟测.mq.md @@ -1,6 +1,7 @@ --- title: lib/文本 加厚烟测 -导入 文本:lib/文本.mq.md +导入: + 文本: lib/文本.mq.md --- # main diff --git a/tests/lib/日志-标识-烟测.mq.md b/tests/lib/日志-标识-烟测.mq.md index 80865c6..413caf4 100644 --- a/tests/lib/日志-标识-烟测.mq.md +++ b/tests/lib/日志-标识-烟测.mq.md @@ -1,7 +1,8 @@ --- title: lib/日志与标识 烟测 -导入 日志:lib/日志.mq.md -导入 标识:lib/标识.mq.md +导入: + 日志: lib/日志.mq.md + 标识: lib/标识.mq.md --- # main diff --git a/tests/lib/日期时间-烟测.mq.md b/tests/lib/日期时间-烟测.mq.md index dff06db..a0d16f5 100644 --- a/tests/lib/日期时间-烟测.mq.md +++ b/tests/lib/日期时间-烟测.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: lib/日期时间 烟测 -导入 日时:lib/日期时间.mq.md +导入: + 日时: lib/日期时间.mq.md --- # main diff --git a/tests/lib/机密-烟测.mq.md b/tests/lib/机密-烟测.mq.md index 2dd1981..294be8d 100644 --- a/tests/lib/机密-烟测.mq.md +++ b/tests/lib/机密-烟测.mq.md @@ -1,6 +1,7 @@ --- title: lib/机密 烟测 -导入 机密:lib/机密.mq.md +导入: + 机密: lib/机密.mq.md --- # main diff --git a/tests/lib/正则-烟测.mq.md b/tests/lib/正则-烟测.mq.md index 4241ee4..278e7db 100644 --- a/tests/lib/正则-烟测.mq.md +++ b/tests/lib/正则-烟测.mq.md @@ -1,6 +1,7 @@ --- title: lib/正则 烟测 -导入 正则:lib/正则.mq.md +导入: + 正则: lib/正则.mq.md --- # main diff --git a/tests/lib/统计-日志-烟测.mq.md b/tests/lib/统计-日志-烟测.mq.md index 498ee45..4fdc9cc 100644 --- a/tests/lib/统计-日志-烟测.mq.md +++ b/tests/lib/统计-日志-烟测.mq.md @@ -1,7 +1,8 @@ --- title: lib/统计 日志 M10 烟测 -导入 统计:lib/统计.mq.md -导入 日志:lib/日志.mq.md +导入: + 统计: lib/统计.mq.md + 日志: lib/日志.mq.md --- # main diff --git a/tests/lib/编码-烟测.mq.md b/tests/lib/编码-烟测.mq.md index 70d6011..275a484 100644 --- a/tests/lib/编码-烟测.mq.md +++ b/tests/lib/编码-烟测.mq.md @@ -1,6 +1,7 @@ --- title: lib/编码 烟测 -导入 编码:lib/编码.mq.md +导入: + 编码: lib/编码.mq.md --- # main diff --git a/tests/lib/表-命令行-烟测.mq.md b/tests/lib/表-命令行-烟测.mq.md index 238d26b..9f35e0f 100644 --- a/tests/lib/表-命令行-烟测.mq.md +++ b/tests/lib/表-命令行-烟测.mq.md @@ -1,8 +1,9 @@ --- markup: occlusion title: 表与命令行 烟测 -导入 表:lib/表.mq.md -导入 命令行:lib/命令行.mq.md +导入: + 表: lib/表.mq.md + 命令行: lib/命令行.mq.md --- # main diff --git a/tests/lib/表-集合.mq.md b/tests/lib/表-集合.mq.md index f733506..bfff881 100644 --- a/tests/lib/表-集合.mq.md +++ b/tests/lib/表-集合.mq.md @@ -2,7 +2,8 @@ markup: occlusion title: 表集合 description: 改 + 列表字典 -导入 表:lib/表.mq.md +导入: + 表: lib/表.mq.md --- # main diff --git a/tests/lib/路径-烟测.mq.md b/tests/lib/路径-烟测.mq.md index d85db28..772d5d8 100644 --- a/tests/lib/路径-烟测.mq.md +++ b/tests/lib/路径-烟测.mq.md @@ -1,6 +1,7 @@ --- title: lib/路径 烟测 -导入 路径:lib/路径.mq.md +导入: + 路径: lib/路径.mq.md --- # main diff --git a/tests/lib/逗号表-烟测.mq.md b/tests/lib/逗号表-烟测.mq.md index 518c56a..0b07a28 100644 --- a/tests/lib/逗号表-烟测.mq.md +++ b/tests/lib/逗号表-烟测.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: lib/逗号表 烟测 -导入 逗号表:lib/逗号表.mq.md +导入: + 逗号表: lib/逗号表.mq.md --- # main diff --git a/tests/lib/配置表-超文本-编码-烟测.mq.md b/tests/lib/配置表-超文本-编码-烟测.mq.md index 7714f49..39dd904 100644 --- a/tests/lib/配置表-超文本-编码-烟测.mq.md +++ b/tests/lib/配置表-超文本-编码-烟测.mq.md @@ -1,9 +1,10 @@ --- markup: occlusion title: lib/配置表 超文本 编码 烟测 -导入 配置:lib/配置表.mq.md -导入 超:lib/超文本.mq.md -导入 编:lib/编码.mq.md +导入: + 配置: lib/配置表.mq.md + 超: lib/超文本.mq.md + 编: lib/编码.mq.md --- # main diff --git a/tests/markup-v03/formula-meta-var.mq.md b/tests/markup-v03/formula-meta-var.mq.md index 5fec865..6586d9f 100644 --- a/tests/markup-v03/formula-meta-var.mq.md +++ b/tests/markup-v03/formula-meta-var.mq.md @@ -1,7 +1,8 @@ --- title: v0.3 块公式 % marqdo: var= description: 无空 RHS;块内 TeX 注释绑定 formula -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/tests/migrate.rs b/tests/migrate.rs index c04a272..34663c7 100644 --- a/tests/migrate.rs +++ b/tests/migrate.rs @@ -21,7 +21,7 @@ fn fixture() -> (std::path::PathBuf, String) { let dir = std::env::temp_dir().join(format!("marqdo-migrate-{}", std::process::id())); std::fs::create_dir_all(&dir).unwrap(); let path = dir.join("demo.mq.md"); - let src = "---\nimport json:lib/json.mq.md\n---\n\n# main\n\n`表` = > json.parse text={\"键\":\"值\"}\n**a = [键](`表`)**\n> print text=\"a=\" + `a`\n"; + let src = "---\nimport:\n json: lib/json.mq.md\n---\n\n# main\n\n`表` = > json.parse text={\"键\":\"值\"}\n**a = [键](`表`)**\n> print text=\"a=\" + `a`\n"; std::fs::write(&path, src).unwrap(); (path, src.to_string()) } diff --git a/tests/notebook/no-foreign.mq.md b/tests/notebook/no-foreign.mq.md index 367a89e..18e31e2 100644 --- a/tests/notebook/no-foreign.mq.md +++ b/tests/notebook/no-foreign.mq.md @@ -1,7 +1,8 @@ --- title: View without foreign description: A pure Marqdo document — formula, table, plot and prose, no external kernel -import math:lib/math.mq.md +import: + math: lib/math.mq.md --- # main diff --git a/tests/notebook/python-insights.mq.md b/tests/notebook/python-insights.mq.md index 0718fef..7ee95a8 100644 --- a/tests/notebook/python-insights.mq.md +++ b/tests/notebook/python-insights.mq.md @@ -1,7 +1,8 @@ --- title: Python 经营洞察 · View Cells description: 多 cell 共享 Python 内核,做订单生成、区域/产品指标、异常检测、报告输出与独立复核。 -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/notebook/shared.mq.md b/tests/notebook/shared.mq.md index fb69bf3..999a3ae 100644 --- a/tests/notebook/shared.mq.md +++ b/tests/notebook/shared.mq.md @@ -1,6 +1,7 @@ --- title: notebook shared state -import foreign:lib/foreign.mq.md +import: + foreign: lib/foreign.mq.md --- # main diff --git a/tests/occlusion.rs b/tests/occlusion.rs index 33362c0..559cbf6 100644 --- a/tests/occlusion.rs +++ b/tests/occlusion.rs @@ -295,7 +295,7 @@ fn access_errors_on_missing_key_like_legacy() { let path = dir.join("missing.mq.md"); std::fs::write( &path, - "---\nimport json:lib/json.mq.md\n---\n\n# main\n\n`表` = > json.parse text={\"键\":\"值\"}\n**x = [取不存在的键](access(`表`, \"无\"))**\n> print text=`x`\n", + "---\nimport:\n json: lib/json.mq.md\n---\n\n# main\n\n`表` = > json.parse text={\"键\":\"值\"}\n**x = [取不存在的键](access(`表`, \"无\"))**\n> print text=`x`\n", ) .unwrap(); let out = Command::new(env!("CARGO_BIN_EXE_marqdo")) diff --git a/tests/occlusion/access-and-loop.mq.md b/tests/occlusion/access-and-loop.mq.md index 39b5cfd..03a8d54 100644 --- a/tests/occlusion/access-and-loop.mq.md +++ b/tests/occlusion/access-and-loop.mq.md @@ -1,7 +1,8 @@ --- markup: occlusion title: access + occlusion loop -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/tests/occlusion/classic-index.mq.md b/tests/occlusion/classic-index.mq.md index b790e35..c1c83f9 100644 --- a/tests/occlusion/classic-index.mq.md +++ b/tests/occlusion/classic-index.mq.md @@ -1,6 +1,7 @@ --- title: classic index still works -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/tests/structure/gap-star-json-body.mq.md b/tests/structure/gap-star-json-body.mq.md index 798bb2c..600bb77 100644 --- a/tests/structure/gap-star-json-body.mq.md +++ b/tests/structure/gap-star-json-body.mq.md @@ -1,7 +1,8 @@ --- title: GAP-06/07 star + JSON array body keep following stmts description: Nested args=`args` and text=["…"] must not truncate the ## body. -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # main diff --git a/tests/structure/import-lib.mq.md b/tests/structure/import-lib.mq.md index f933301..8d19616 100644 --- a/tests/structure/import-lib.mq.md +++ b/tests/structure/import-lib.mq.md @@ -1,7 +1,8 @@ --- title: import official lib (Chinese) -导入 文本:lib/文本.mq.md -导入 表:lib/表.mq.md +导入: + 文本: lib/文本.mq.md + 表: lib/表.mq.md --- # main diff --git a/tests/structure/import/main.mq.md b/tests/structure/import/main.mq.md index d8b92db..b9f63a7 100644 --- a/tests/structure/import/main.mq.md +++ b/tests/structure/import/main.mq.md @@ -1,6 +1,7 @@ --- title: 跨文件导入示例 -import utils:utils.mq.md +import: + utils: utils.mq.md --- # main diff --git a/tests/structure/inherit-explicit-super.mq.md b/tests/structure/inherit-explicit-super.mq.md index 8270fc2..b51a6f5 100644 --- a/tests/structure/inherit-explicit-super.mq.md +++ b/tests/structure/inherit-explicit-super.mq.md @@ -1,6 +1,7 @@ --- title: inherit explicit parent constructor -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # Parent diff --git a/tests/structure/inherit-parent-method.mq.md b/tests/structure/inherit-parent-method.mq.md index ede704d..3c34349 100644 --- a/tests/structure/inherit-parent-method.mq.md +++ b/tests/structure/inherit-parent-method.mq.md @@ -1,6 +1,7 @@ --- title: inherit parent method -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # Greeter diff --git a/tests/structure/meta-binding.mq.md b/tests/structure/meta-binding.mq.md index 26005a0..ef3803e 100644 --- a/tests/structure/meta-binding.mq.md +++ b/tests/structure/meta-binding.mq.md @@ -4,7 +4,8 @@ model: ${env.MARQDO_META_MODEL ?? "default-model"} greeting: "Hello ${env.MARQDO_META_USER ?? "World"}" tokens: ${int(env.MARQDO_META_TOKENS ?? "16")} api_key: ${secret.MARQDO_META_SECRET ?? "sk-test"} -import sys:lib/sys.mq.md +import: + sys: lib/sys.mq.md --- # main diff --git a/tests/structure/ns/path3.mq.md b/tests/structure/ns/path3.mq.md index 29ad30f..66cf0dd 100644 --- a/tests/structure/ns/path3.mq.md +++ b/tests/structure/ns/path3.mq.md @@ -1,6 +1,7 @@ --- title: three-segment library path -import helpers:helpers.mq.md +import: + helpers: helpers.mq.md --- # main diff --git a/tests/structure/ns/use.mq.md b/tests/structure/ns/use.mq.md index ccaa0ff..c3b319d 100644 --- a/tests/structure/ns/use.mq.md +++ b/tests/structure/ns/use.mq.md @@ -1,7 +1,8 @@ --- title: frontmatter use short name -import text:lib/text.mq.md -import trim_text:text.str_trim +import: + text: lib/text.mq.md + trim_text: text.str_trim --- # main diff --git a/tests/structure/object-handle.mq.md b/tests/structure/object-handle.mq.md index aaef7d6..1928b76 100644 --- a/tests/structure/object-handle.mq.md +++ b/tests/structure/object-handle.mq.md @@ -1,6 +1,7 @@ --- title: object handle smoke -import json:lib/json.mq.md +import: + json: lib/json.mq.md --- # counter