diff --git a/public/features/18-AI原生闭环.mq.md b/public/features/18-AI原生闭环.mq.md new file mode 100644 index 0000000..ec8e707 --- /dev/null +++ b/public/features/18-AI原生闭环.mq.md @@ -0,0 +1,38 @@ +--- +title: AI 原生闭环(契约 + MLSP) +description: 渐进式契约、结构化诊断与面向 AI 的 Marqdo 语言服务 +--- + +# main + +里程碑(v1.1.0):AI 原生闭环——让 AI 不仅能写 Marqdo,还能验证 Marqdo。 + +三件套。核心表面守卫(`doc/design/core-surface.md`)钉住 19 个核心构造,任一侧(清单 / 文档 / 金样)单边改动,CI 必红。渐进式契约是可选的 `参数` / `返回` / `字段` 表,直接嵌在叙述里,四边界校验:调用实参、返回值、表绑定、键访问。MLSP for AI(`marqdo mlsp`)是行分隔 JSON 的语言服务,AI 按需查询语法,而不是背诵整部语法。 + +静态契约检查: + +```bash +marqdo check tests/contracts/ok_contract.mq.md +``` + +结构化诊断——错误即数据: + +```bash +marqdo run tests/structure/hello.mq.md --json +``` + +按需查询语法(MLSP): + +```bash +printf '%s\n' '{"id":1,"method":"syntax","params":{"query":"返回"}}' | marqdo mlsp +``` + +MLSP 方法:`locate`(查符号 / 构造卡片)、`syntax`(戒律原文 + 样例 + 文档锚点)、`validate`(结构化诊断)、`repair_targets`(有界靶点)、`repair_apply`(有界行编辑,越界必拒)、`schema`(单元契约)。 + +> print text=契约是可选的:不写契约表,文件保持全动态。 + +> print text=诊断自带 code / severity / suggestion / doc_anchor / doc_quote。 + +> print text=MLSP 语法卡片内嵌戒律原文与样例,AI 无需预学语法。 + +验证结果见:`doc/roadmap/perf-validation-report-2026-09-23.md`。 diff --git a/public/features/18-ai-native-loop.mq.md b/public/features/18-ai-native-loop.mq.md new file mode 100644 index 0000000..c44b80f --- /dev/null +++ b/public/features/18-ai-native-loop.mq.md @@ -0,0 +1,38 @@ +--- +title: AI-native loop (contracts + MLSP) +description: Progressive contracts, structured diagnostics, and the Marqdo Language Server for AI +--- + +# main + +Milestone (v1.1.0): the AI-native loop — so an AI can verify Marqdo, not just write it. + +Three pieces. A core surface guard (`doc/design/core-surface.md`) pins the 19 core constructs, so a single-sided change (list / doc / golden sample) turns CI red. Progressive contracts are optional `参数` / `返回` / `字段` tables embedded in the narrative, checked at four boundaries: call argument, return, table bind, key access. MLSP for AI (`marqdo mlsp`) is a line-delimited JSON language service; the AI queries syntax on demand instead of memorizing the whole grammar. + +Static contract check: + +```bash +marqdo check tests/contracts/ok_contract.mq.md +``` + +Structured diagnostics — errors as data: + +```bash +marqdo run tests/structure/hello.mq.md --json +``` + +Query syntax on demand (MLSP): + +```bash +printf '%s\n' '{"id":1,"method":"syntax","params":{"query":"返回"}}' | marqdo mlsp +``` + +MLSP methods: `locate` (find a symbol / construct card), `syntax` (rule text + sample + doc anchor), `validate` (structured diagnostics), `repair_targets` (bounded span), `repair_apply` (bounded line edits, out-of-scope refused), `schema` (contract of one unit). + +> print text=Contracts are optional: with no contract table, a file stays fully dynamic. + +> print text=Diagnostics carry code, severity, suggestion, doc_anchor and doc_quote. + +> print text=MLSP syntax cards embed the rule text and a sample, so AI need not pre-learn the grammar. + +See validation results: `doc/roadmap/perf-validation-report-2026-09-23.md`.