Files
marqdo/skills/marqdo/reference.md
T
cflmyandCursor ff252fd469 feat(web): land Artifact serve/endpoint path and retire compose golds
Wire data_source into Document render, register Endpoint handlers via
run_artifact, restore marqdo-blog as an Artifact site, and replace old
compose_* web golds with ADR 0007 fixtures and docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-28 11:36:45 +08:00

8.0 KiB
Raw Blame History

Marqdo reference (AI)

Load this when you need stdlib names, CLI, or edge cases. Core rules stay in SKILL.md.

CLI

marqdo --version
marqdo run FILE.mq.md
marqdo run FILE.mq.md --backend bytecode
marqdo view PATH          # docs browser, default port 7429
marqdo debug PATH         # debugger UI, default port 7430
marqdo catalog PATH -o .marqdo
marqdo ext list
marqdo ext add llm|agent|web|quantum
marqdo ext remove llm|agent|web|quantum

Diagnostics look like path:line:col: message (1-based line/col).

v0.2 surface: parameters + `name`; branches 1. `cond` / 2. * (same-indent restart at 1. = new branch statement); loops - [item](coll) or - [`item`](`coll`); identifiers in backticks (foreach header may omit ticks). See doc/design/markdown-mapping.md.

Stdlib search order for lib/… imports: MARQDO_LIB, ./lib, directory of the marqdo executable (and a few parents). Prefer the bundle zip (marqdo.exe + lib/) over a bare exe.

官方扩展(ext/…,非 stdlib):marqdo ext add 装到 MARQDO_EXT 或 ~/.marqdo/ext;导入仍写 import llm:ext/llm.mq.md。解析还含 cwd ext/、二进制旁 ext/。对象:doc/design/objects.md。Agent:doc/design/ext-agent.md · 安装器:doc/design/ext-cli.md。

Builtins (no import)

EN ZH Role
print 打印 stdout; arg text / 内容
input 输入 one line; arg prompt / 提示
len 长度 length; arg value / 值
str 文本 to text; arg value / 值
int 整数 to int; arg value / 值

Keywords (not variable names): True/真, False/假, None/空, and/且, or/或, not/非.

Standard library files

Import one file; use that file’s function names.

EN import ZH import Typical APIs (EN / ZH)
lib/text.mq.md lib/文本.mq.md text helpers / 去空白·拆分·拼接…
lib/table.mq.md lib/表.mq.md put/改 + list/map(见 doc/design/stdlib-table.md)
lib/browser.mq.md lib/浏览器.mq.md WASM client effect helpers(GFM + set_text/canvas/…;见 marqdo-dev)
lib/fs.mq.md lib/文件.mq.md filesystem
lib/sys.mq.md lib/系统.mq.md process / cwd / load_dotenv
lib/plugin.mq.md lib/插件.mq.md load native ABI plugins (doc/design/ext-abi.md)
lib/time.mq.md lib/时间.mq.md time/format
lib/net.mq.md lib/网络.mq.md HTTP(S) helpers (+ optional headers)
lib/json.mq.md (see design) parse / stringify / quote only — not a dict builder
lib/math.mq.md lib/数学.mq.md num, trig, random, formula, plot
lib/foreign.mq.md lib/外联.mq.md run foreign fenced blocks
ext/llm.mq.md ext/大模型.mq.md # llm / # 大模型 object + chat methods
ext/agent.mq.md ext/智能体.mq.md document-driven step / plan + OKF;示例 examples/agent-pong · agent-okf-flywheel;Wave B:agent-framework-2026-09.md
ext/web/web.mq.md ext/web/网页.mq.md dynamic sites — see ext/web section below
ext/quantum/quantum.mq.md ext/quantum/量子.mq.md circuits + Q7 density/viz + Q8 themes — see ext/quantum below

Open the imported .mq.md under lib/ or ext/ to see exact ## / # names and parameters. Gold tests: tests/lib/, tests/structure/, tests/ext/.

ext/web (Artifact sites · ADR 0007)

Install: marqdo ext add web (网页). Native: bash scripts/build-web-plugin.sh.

EN import ZH import Surface
ext/web/web.mq.md ext/web/网页.mq.md facade: page · route · serve · render · inspect · use
Kind Metadata Notes
Document type: web / 类型: 网页 route · data_source · data_order · data_where
Endpoint type: endpoint / 类型: 端点 path · method · # main handler · request/response
View ` type
Resource ext/data · ext/security · ext/net db/cache/storage · auth/rbac/oidc · websocket

Do not use compose_* / app.configure / author ensure_plugin.

Example: examples/marqdo-blog/. Design: doc/design/ext-web-artifact.md. Historical matrix: doc/design/web-net-capabilities.md.

ext/quantum (circuits + Q7/Q8)

Install: marqdo ext add quantum (量子). Native: cargo build --release -p marqdo_plugin_quantum, then re-run ext add so view picks up the new .so.

EN import ZH import Core types
ext/quantum/quantum.mq.md ext/quantum/量子.mq.md # circuit # gate # density
Area EN APIs Notes
Circuit h/cx/…, simulate, probabilities, run, draw, noise steps= GFM table; ≤12 qubits
Gate matrix, matches_matrix, draw named or matrix= custom unitary
Density (Q7) purity, partial_trace, eig, expect, draw ≤6 qubits for dense ρ
Free (Q7) kron, schmidt, fidelity top-level on import bind
Draw kinds circuit|probs|bloch|hinton|city|density|paulivec|qsphere|multibloch quote kind="…"
Themes (Q8) theme="dark"|"light"|"bw" (ZH 主题=) default dark; circuit/probs/bloch themed; SVG data-theme

Examples: examples/quantum-bell/, examples/quantum-entanglement/. Design: doc/design/ext-quantum.md · Q7: doc/design/ext-quantum-q7.md · Q8: doc/design/ext-quantum-viz-style.md.

Formula + plot (math)

---
import math:lib/math.mq.md
---

# main

`f` =
$$
x^2 - 2
$$

*_svg = > plot formula=`f` var=x min=-3 max=3*

Empty RHS assignment + following $$…$$ binds a formula value. Narrative-only $$ without binding is display, not assignment.

Foreign (Python example)

---
import foreign:lib/foreign.mq.md
---

# main

`hi` =
```python
print("hello-from-python")

Lines starting with `` ` `` can be code (binding). Keep a blank line before/after fences per comment rules.

## Function-end details

| Form | Effect |
|------|--------|
| Lone `---` or `***` (≥3 same chars) at function body top level | End function; no return value |
| `****` or empty bold | Return `None` and end body |
| `**expr**` | Return `expr`; does **not** by itself cut off later sibling statements — still use HR or shallower heading |

File-leading paired `---` is frontmatter only; body `---` is not frontmatter.

## Call arguments

- Named: `> greet who=World`
- Positional: `> greet World`
- Spaces in values: allowed in named forms as in docs (`who=marqdo user`)
- Inline call in statement: `` *`n` = > len value=`s`* ``

See `doc/design/call-arguments.md`.

## Identifiers

- Variables: `` `name` ``
- Comparisons: `==` `>` `<` `>=` `<=`
- Do not use keyword tokens as names

## Design docs (repo)

| Doc | Topic |
|-----|--------|
| `doc/design/markdown-mapping.md` | Syntax constitution |
| `doc/design/objects.md` | `#` objects / `##` methods |
| `doc/design/keywords.md` | Builtins / keywords |
| `doc/design/return-hr-and-code-surface.md` | Function end / surfaces |
| `doc/design/stdlib-i18n.md` | EN/ZH lib files |
| `doc/design/stdlib-modules.md` | L1 modules including plugin |
| `doc/design/ext-abi.md` | Native C ABI v1 |
| `doc/design/ext-llm.md` | `ext/llm` |
| `doc/design/ext-agent.md` | `ext/agent` agent **framework** (layout shipped; LLM orchestration roadmap) |
| `doc/design/ext-cli.md` | `marqdo ext list/add/remove` |
| `doc/design/ext-web.md` | `ext/web` dynamic sites (author API) |
| `doc/design/web-net-capabilities.md` | ext/web capability matrix (W0–W7 + P3) |
| `doc/design/ext-quantum.md` | `ext/quantum` circuits |
| `doc/design/ext-quantum-q7.md` | Q7 density linear algebra + advanced SVG |
| `doc/design/ext-quantum-viz-style.md` | Q8 themed SVG (`dark`/`light`/`bw`; circuit/probs/bloch) |
| `doc/design/view-debug.md` | view / debug hosts |