Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
111849d92a | ||
|
|
235384fb85 | ||
|
|
a9b59b361e | ||
|
|
c4501a17f2 | ||
|
|
5f00572e24 |
No files matched your search
@@ -1,2 +0,0 @@
|
||||
* text=auto
|
||||
*.sh text eol=lf
|
||||
@@ -1,20 +0,0 @@
|
||||
---
|
||||
name: 功能、缺陷或迁移
|
||||
about: 记录唯一负责仓库、可复现输入与验收
|
||||
---
|
||||
|
||||
## 责任与范围
|
||||
|
||||
负责仓库、所有者、影响公共契约和关联工单。
|
||||
|
||||
## 环境与复现
|
||||
|
||||
平台、组件或制品 SHA、最小输入、命令、实际与预期行为。
|
||||
|
||||
## 验收
|
||||
|
||||
真实正例、负例、授权边界和失败条件。跨仓库问题请列出消费者回归。
|
||||
|
||||
## 交付
|
||||
|
||||
责任 PR、精确提交、CI 链接及集成 PR。
|
||||
@@ -1,11 +0,0 @@
|
||||
## 工单与范围
|
||||
|
||||
链接责任工单,列出本次提交变更的 gitlink、治理或集成路径。
|
||||
|
||||
## 组合与证据
|
||||
|
||||
记录组件提交、C1/C2/C3 链接、可复现命令及支持平台。列出失败和未验证项。
|
||||
|
||||
## 发行与回滚
|
||||
|
||||
说明公共协议切换、制品影响、旧基线或回滚方式。
|
||||
Executable → Regular
+1
-6
@@ -1,6 +1 @@
|
||||
.env
|
||||
.env.*
|
||||
/.migration-work/
|
||||
/.integration-work/
|
||||
/__pycache__/
|
||||
**/__pycache__/
|
||||
/target
|
||||
-18
@@ -1,18 +0,0 @@
|
||||
[submodule "cli"]
|
||||
path = cli
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-cli.git
|
||||
[submodule "tests/conformance"]
|
||||
path = tests/conformance
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-extension-conformance.git
|
||||
[submodule "tools/view"]
|
||||
path = tools/view
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-view.git
|
||||
[submodule "tools/knowledge"]
|
||||
path = tools/knowledge
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-knowledge.git
|
||||
[submodule "tools/prove"]
|
||||
path = tools/prove
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-prove.git
|
||||
[submodule "tools/lint"]
|
||||
path = tools/lint
|
||||
url = https://git.cflmy.cn/cflmy/marqdo-lint.git
|
||||
@@ -1,25 +0,0 @@
|
||||
when:
|
||||
event: [push, pull_request, manual]
|
||||
|
||||
steps:
|
||||
layout:
|
||||
image: rust:1.100-bookworm
|
||||
commands:
|
||||
- apt-get update && apt-get install -y --no-install-recommends ca-certificates git python3
|
||||
- python3 scripts/check-layout.py
|
||||
- python3 -m unittest discover -s tests/integration
|
||||
- git submodule update --init
|
||||
- python3 scripts/check-layout.py --checkouts
|
||||
|
||||
candidate:
|
||||
# Match the Linux/glibc environment already used by View for the RC.4 artifact.
|
||||
image: mcr.microsoft.com/playwright:v1.49.0-noble
|
||||
depends_on: [layout]
|
||||
commands:
|
||||
- apt-get update && apt-get install -y --no-install-recommends ca-certificates curl git python3 python3-jsonschema build-essential
|
||||
- |
|
||||
set -eu
|
||||
curl -fsSL --retry 3 https://sh.rustup.rs -o /tmp/marqdo-rustup.sh
|
||||
sh /tmp/marqdo-rustup.sh -y --profile minimal --default-toolchain 1.100.0 --no-modify-path
|
||||
export PATH="$HOME/.cargo/bin:$PATH"
|
||||
bash scripts/integration.sh
|
||||
@@ -1,8 +0,0 @@
|
||||
# Marqdo 维护指引
|
||||
|
||||
1. 从 [组件目录](components.toml) 和 [架构边界](docs/ARCHITECTURE.md) 确定唯一责任仓库。主仓库处理 gitlink、集成测试、发行组合与治理。
|
||||
2. 找到或建立责任仓库的工单,记录目标、当前提交、最小复现、公共契约和验收命令。跨仓库阻塞在上游开关联工单,并在消费者记录回归条件。
|
||||
3. 在责任仓库独立修改、构建和测试。需要调整语义或公共协议时,通过 CLI ADR 评审,与实际消费者同候选验证。
|
||||
4. 推送子仓库提交后,再在主仓库提交精确 gitlink。区分组件 CI、公共契约 CI 和生态 CI 的证据。以 [开发流程](docs/DEVELOPMENT.md) 为准。
|
||||
5. 新接入组件先核对公开 API、直接依赖、独立入口和实际测试。空仓在 [迁移台账](docs/MIGRATION.md) 中保持 planned。
|
||||
6. 记录 FAIL 和 UNVERIFIED 的具体环境、命令和日志。只有实际通过且匹配候选 SHA 的证据才可用于集成与发行。
|
||||
Generated
+7
@@ -0,0 +1,7 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "marqdo"
|
||||
version = "0.1.0"
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "marqdo"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
[[bin]]
|
||||
name = "marqdo"
|
||||
path = "src/marqdo.rs"
|
||||
@@ -1,201 +0,0 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -1,29 +0,0 @@
|
||||
# Marqdo 生态集成
|
||||
|
||||
Marqdo 以 Markdown 编写可执行程序与可验证知识。这个仓库固定一组组件提交,维护组件责任、跨仓库验收和发行组合。
|
||||
|
||||
## 使用与开发
|
||||
|
||||
- 安装语言、CLI 和默认标准库,请使用 [Marqdo CLI 的官方发行](https://git.cflmy.cn/cflmy/marqdo-cli/releases)。各工具和扩展在各自仓库提供安装说明。
|
||||
- 修改语言、标准库、领域扩展或工具,请先在 [组件目录](components.toml) 找到唯一责任仓库。开发和发布在该组件内独立进行。
|
||||
- 验证生态组合,请初始化此仓库的子模块。Git tree 的 gitlink 固定参与验收的源码提交。
|
||||
|
||||
```sh
|
||||
git clone https://git.cflmy.cn/cflmy/marqdo.git
|
||||
cd marqdo
|
||||
git submodule update --init
|
||||
python3 scripts/check-layout.py --checkouts
|
||||
```
|
||||
|
||||
## 组件与维护入口
|
||||
|
||||
| 目录 | 内容 |
|
||||
| --- | --- |
|
||||
| [cli](cli) | 语言实现、宿主原语和公共协议 |
|
||||
| [tools](tools) | Knowledge、Prove、View、Lint,各自独立仓库 |
|
||||
| [tests/conformance](tests/conformance) | 独立公共契约测试 |
|
||||
| 标准库与扩展 | 九个 `marqdo-std-*`、十九个 `marqdo-ext-*` 已预建空仓,接入状态见迁移台账 |
|
||||
|
||||
[架构和归属](docs/ARCHITECTURE.md) · [开发、验收和发布](docs/DEVELOPMENT.md) · [迁移台账](docs/MIGRATION.md) · [贡献者和 Agent 指引](AGENTS.md)
|
||||
|
||||
v2 实现、历史文档和示例可从 Git 历史查阅。[v2.9.1 历史树](https://git.cflmy.cn/cflmy/marqdo/src/tag/v2.9.1)
|
||||
@@ -0,0 +1,91 @@
|
||||
---
|
||||
title: Marqdo主分支开发记录
|
||||
date: 2026-08-11
|
||||
author: pingan
|
||||
---
|
||||
|
||||
## 前言
|
||||
在经过一周多的ai疯狂开发之后,尽管marqdo已经做出了并拥有了许多非常良好的特性,作者确逐渐感到非常的不安,
|
||||
这种不安来自于崩塌感,作者不知道什么时候,ai就会更改关键的定义,导致突然的崩塌,在开发智能体拓展库的时候作者还尚未有这种感觉,但是在网络拓展库,这种不安定感几乎席卷了作者的全部身心。
|
||||
|
||||
必须承认,ai在没有经过大量训练就撰写一门崭新的语法,定义一些它完全没有接触过的东西对于ai还是太困难了,ai并不能通过我的监督,真正的理解marqdo代码即文档的设计思路,所以,尽管非常的遗憾,作者还是决定回归古法编程,还是手搓代码吧,尽管这意味着marqdo很难赶上ai的浪潮了。
|
||||
|
||||
marqdo的设计初衷很是简单,这就不是一门设计给程序员的语言,哪个程序员会用markdown表格来表示集合呢?不会的,这太过繁复了,但是ai可以,这就使得过去编程语言的范式变得不是那么重要了。
|
||||
|
||||
自然如果只是为了易读性,marqdo并没有完全的开发必要,重点在于对md的支持,作者必须承认谷歌提出的OKF规范,把markdown这种文件格式放到了一个极高的位置,这意味着,可执行的知识体系,如果能做到,为什么不试试?
|
||||
|
||||
此外,jupyter notebook笔记本体积太大不利于管理的问题也是存在的,作者就在想,markdown支持代码块的插入,这个代码如果可以直接执行并放回,这不就是最好的jupyter替代品吗?事实上,在main分支的marqdo已经实现了这个功能,但是还不够好,作者要把marqdo真正做成一门科学计算的顶级语言。
|
||||
|
||||
最后是数学公式的支持,公式库需要能够自动的渲染,高可读,还要能够自动的画图,自动的完成诸多内容,让可执行=正确,让ai支持数学推理不再困难。
|
||||
|
||||
最后,2026年8月11日,我预祝未来的自己,开发成功。
|
||||
|
||||
## 开发
|
||||
|
||||
### Marqdo上下文无关文法
|
||||
|
||||
file -> "---" metadata "---" content ;
|
||||
|
||||
metadata -> file_information |
|
||||
import_lib_name ;
|
||||
|
||||
content -> comment |
|
||||
code_body ;
|
||||
|
||||
comment -> comment_content ;
|
||||
|
||||
code_body -> class |
|
||||
function|
|
||||
code|
|
||||
$formula$|$$formula$$|\[formula\]|
|
||||
```code_block_type
|
||||
code_block
|
||||
```;
|
||||
|
||||
class -> # class_name code_body |
|
||||
# class_name => parent_class_name code_body ;
|
||||
|
||||
function -> function_header param_list body return_stmt ;
|
||||
|
||||
function_header -> ## identifier |
|
||||
### identifier |
|
||||
#### identifier ;
|
||||
|
||||
param_list -> + identifier ;
|
||||
|
||||
body -> statement |
|
||||
branch |
|
||||
loop ;
|
||||
|
||||
return_stmt -> ** statement ** ;
|
||||
|
||||
<!--the number of # stand for the level of function -->
|
||||
|
||||
code -> 1. branch |
|
||||
- loop |
|
||||
statement ;
|
||||
|
||||
<!--Ordered lists represent branch, unordered lists represent loop-->
|
||||
|
||||
branch -> statement ;
|
||||
|
||||
loop -> statement ;
|
||||
|
||||
statement -> > call |
|
||||
literal|
|
||||
`var_value_name`|
|
||||
list and dict|
|
||||
"str"|
|
||||
*statement_without_any_marker*;
|
||||
|
||||
<!--here we use markdown table to stand for list and dict-->
|
||||
|
||||
call -> function_name args;
|
||||
|
||||
literal -> literal_code as other code;
|
||||
|
||||
formula -> latex math code;
|
||||
|
||||
code_block_type -> code_block's code type;
|
||||
|
||||
code_block -> code of a code_block;
|
||||
-1
Submodule cli deleted from 452e9a32bd.
-382
@@ -1,382 +0,0 @@
|
||||
# 生态组件职责与构建关系。精确提交由 Git tree 的 gitlink 锁定。
|
||||
# planned 的 requires 是设计输入,接入前须核对实际 imports 和发布依赖。
|
||||
|
||||
[[component]]
|
||||
id = "cli"
|
||||
path = "cli"
|
||||
kind = "core"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "语言语义、运行时、受控宿主和公共协议"
|
||||
requires = []
|
||||
checks_with = ["conformance"]
|
||||
release = "base"
|
||||
entry = "tools/release/smoke.py"
|
||||
|
||||
[[component]]
|
||||
id = "conformance"
|
||||
path = "tests/conformance"
|
||||
kind = "test"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "可执行的独立公共协议测试"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "none"
|
||||
entry = "scripts/build_all.sh"
|
||||
|
||||
[[component]]
|
||||
id = "view"
|
||||
path = "tools/view"
|
||||
kind = "tool"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "阅读、运行观察与静态导出"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
entry = "scripts/acceptance.sh"
|
||||
|
||||
[[component]]
|
||||
id = "knowledge"
|
||||
path = "tools/knowledge"
|
||||
kind = "tool"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "静态知识编译与检索"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
entry = "scripts/ci.sh"
|
||||
|
||||
[[component]]
|
||||
id = "prove"
|
||||
path = "tools/prove"
|
||||
kind = "tool"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "证明依赖、证书及 Lean 后端"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
entry = "scripts/package-tool.sh"
|
||||
|
||||
[[component]]
|
||||
id = "lint"
|
||||
path = "tools/lint"
|
||||
kind = "tool"
|
||||
state = "active"
|
||||
owner = "cflmy"
|
||||
scope = "静态规则、诊断及显式修复"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
entry = "scripts/package-tool.sh"
|
||||
|
||||
[[component]]
|
||||
id = "std-core"
|
||||
path = "stdlib/core"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "Result 与基础数值"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "std-collections"
|
||||
path = "stdlib/collections"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "List、Map 和 Table 值操作"
|
||||
requires = ["cli", "std-core"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "std-text"
|
||||
path = "stdlib/text"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "Unicode 文本、字节值与 UTF-8"
|
||||
requires = ["cli", "std-core", "std-collections"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "std-encoding"
|
||||
path = "stdlib/encoding"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "Base64、Base32 和 Hex"
|
||||
requires = ["cli", "std-core", "std-text"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "std-data"
|
||||
path = "stdlib/data"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "JSON、CSV、TOML 与 GFM 数据转换"
|
||||
requires = ["cli", "std-collections", "std-text", "std-encoding"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "std-io"
|
||||
path = "stdlib/io"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "Console、Stream、格式化和官方 print 别名"
|
||||
requires = ["cli", "std-core", "std-text"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "std-fs"
|
||||
path = "stdlib/fs"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "文件、目录与路径"
|
||||
requires = ["cli", "std-io", "std-text"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "std-system"
|
||||
path = "stdlib/system"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "时钟、UTC、环境、进程与随机"
|
||||
requires = ["cli", "std-text", "std-io"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "std-net"
|
||||
path = "stdlib/net"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "TCP、UDP、TLS 和网络字节流"
|
||||
requires = ["cli", "std-io", "std-system"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
|
||||
[[component]]
|
||||
id = "math"
|
||||
path = "extensions/math"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "数值算法、统计、符号数学及绘图"
|
||||
requires = ["cli", "std-core", "std-collections", "std-text"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "linalg"
|
||||
path = "extensions/linalg"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "复数、矩阵、分解及数值线性代数"
|
||||
requires = ["cli", "math"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "quantum"
|
||||
path = "extensions/quantum"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "量子电路、态向量、采样与模拟"
|
||||
requires = ["cli", "linalg"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "http"
|
||||
path = "extensions/http"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "HTTP、URL、SSE 与报文生命周期"
|
||||
requires = ["cli", "std-net", "std-text", "std-encoding"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "websocket"
|
||||
path = "extensions/websocket"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "WebSocket 握手、帧与连接语义"
|
||||
requires = ["cli", "http"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "ai"
|
||||
path = "extensions/ai"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "模型协议、流式输出与工具调用数据"
|
||||
requires = ["cli", "http", "std-data"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "mcp"
|
||||
path = "extensions/mcp"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "MCP 协议、传输、发现和调用"
|
||||
requires = ["cli", "http", "std-system"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "crypto"
|
||||
path = "extensions/crypto"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "成熟密码学实现的封装"
|
||||
requires = ["cli", "std-encoding"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "database"
|
||||
path = "extensions/database"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "SQL 参数绑定、事务和驱动连接"
|
||||
requires = ["cli", "std-data"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "storage"
|
||||
path = "extensions/storage"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "本地和对象存储接口"
|
||||
requires = ["cli", "std-fs"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "cache"
|
||||
path = "extensions/cache"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "TTL、缓存和失效"
|
||||
requires = ["cli", "std-system"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "security"
|
||||
path = "extensions/security"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "应用身份、会话及权限模型"
|
||||
requires = ["cli", "crypto", "http"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "web"
|
||||
path = "extensions/web"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "Markdown/GFM 渲染、页面、路由和组件"
|
||||
requires = ["cli", "http"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "browser"
|
||||
path = "extensions/browser"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "浏览器宿主、WASM 适配、DOM 和事件"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "document"
|
||||
path = "extensions/document"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "Markdown 结构与显式文档编辑"
|
||||
requires = ["cli", "std-fs", "std-text"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "archive"
|
||||
path = "extensions/archive"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "压缩、安全归档和解包"
|
||||
requires = ["cli", "std-text", "std-fs"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "engineering"
|
||||
path = "extensions/engineering"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "工程操作、文件补丁与产物"
|
||||
requires = ["cli", "document", "archive"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "regex"
|
||||
path = "extensions/regex"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "正则匹配、捕获、扫描和替换"
|
||||
requires = ["cli", "std-text"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
|
||||
[[component]]
|
||||
id = "datetime"
|
||||
path = "extensions/datetime"
|
||||
kind = "extension"
|
||||
state = "planned"
|
||||
owner = "cflmy"
|
||||
scope = "IANA 时区、DST 和高级日历"
|
||||
requires = ["cli", "std-system"]
|
||||
checks_with = []
|
||||
release = "optional"
|
||||
@@ -1,24 +0,0 @@
|
||||
# 架构与所有权
|
||||
|
||||
自建 Git `git.cflmy.cn/cflmy` 是代码、工单和合并的权威,`ci.cflmy.cn` 是 CI 权威。GitHub 作为镜像或分发渠道。生态主仓库以直接 Git submodule 固定组件提交,`stdlib/`、`extensions/`、`tools/` 是分类目录。
|
||||
|
||||
| 层 | 所有权 |
|
||||
| --- | --- |
|
||||
| CLI | Markdown 映射、AST/IR、Runtime、Value、权限/隔离/预算及 Package、Plugin、Provider、Foreign、Tool、Analysis、Observation 公共契约 |
|
||||
| 标准库 | 基础安装默认提供的通用低层函数,以及对受控宿主原语的薄封装 |
|
||||
| 扩展 | 可选算法、领域协议与独立后端。`marqdo-ext-<领域>` 按独立依赖、安全或发行边界命名 |
|
||||
| Tool | 通过公共 CLI 接口处理文档及制品的独立工具,例如静态知识、证明、观察和质量诊断 |
|
||||
| 应用 | 具体用户任务和业务流程,例如 qdagent |
|
||||
| 生态主仓库 | 组件关系、精确组合、跨组件验收、发行与责任治理 |
|
||||
|
||||
CLI 编译只需其自身实现。完整基础发行由 CLI、必需 Worker 和统一标准库 Bundle 构成。标准库组件只依赖 CLI 公共语义和更低层标准库,扩展可以依赖标准库与明确声明的其他扩展。Tools 使用公开协议与自身依赖,各工具的数据格式互操作须由产生者明确发布契约。组件依据各自发版制品独立构建,不依赖主仓库源码。
|
||||
|
||||
组件的职责、阶段和依赖只在 [components.toml](../components.toml) 维护。子模块远端在 `.gitmodules`,提交在 Git tree,程序依赖仍在现行包清单及锁。`requires` 描述直接构建与制品依赖,`checks_with` 描述协同验收。计划中的依赖在真实接入前以 imports、构建输入和制品核实。依赖图必须无环。
|
||||
|
||||
## 新增能力与公共边界
|
||||
|
||||
先复用职责匹配的组件。需要独立维护、依赖、安全或发行边界时,为新仓库发起评审。加入标准库须证明基础发行默认需要、至少三个领域真实复用、依赖闭包受控,并说明错误、授权和预算语义。
|
||||
|
||||
需要新增 builtin、HostOp、值类型、语法或公共协议字段时,在 CLI 提交 ADR,写明现有机制为何不足、最小复现、三个领域用例、替换及正负例。公开接口破坏性更新按同一候选组合切换产生者和消费者,保留单套现行协议。历史行为通过固定版本的历史发行复现。
|
||||
|
||||
跨组件测试以真实 CLI/Worker、独立消费者和现行权限配置验证。Native 后端与外部工具按 CLI 安全边界执行,权限、隔离和预算声明以可验证的实际行为为准。
|
||||
@@ -1,47 +0,0 @@
|
||||
# 开发、验收与发行
|
||||
|
||||
## 从工单到集成
|
||||
|
||||
1. 在会修改代码的责任仓库寻找或创建工单。记录复现输入、组件 SHA、平台、公共契约、预期/实际结果,以及可执行正负例。涉及其他仓库时,各仓库保留自己负责的工单,在消费者工单标明依赖和回归条件。例:HTTP 的 SSE 分块错误归 HTTP;模型事件拼接错误归 AI;握手或字节流原语错误先由标准库或 CLI 的所有者定位。
|
||||
2. 在组件仓库提交 PR,运行独立 CI。公共协议改动同时验证真实产生者和消费者,附测试命令、制品摘要、平台、CI URL。组件源码审核通过后推送可由 CI 获取的精确提交。
|
||||
3. 在主仓库提交集成 PR。先初始化相关组件,再以 detached HEAD 锁定审核过的 SHA 并暂存 gitlink。同一份工具契约或 Stdlib 切换需要同时更新多个组件时,在一个候选中提交整组 gitlink。
|
||||
4. 基线移动时重验候选组合。留下真实失败证据并路由责任工单。通过同 SHA 的必需门禁后合并,随后关闭集成追踪及已解决的关联工单。
|
||||
|
||||
```sh
|
||||
git submodule update --init
|
||||
git -C tools/view fetch origin
|
||||
git -C tools/view checkout --detach <审核通过的提交>
|
||||
git add tools/view
|
||||
git diff --cached --submodule=log
|
||||
```
|
||||
|
||||
## 验收
|
||||
|
||||
| 层 | 责任与证据 |
|
||||
| --- | --- |
|
||||
| C1 组件 CI | 独立构建与测试、授权负例、固定依赖、打包 smoke,由组件仓库维护 |
|
||||
| C2 公共契约 | 真实 CLI 和 Worker、独立 Conformance 与消费者,覆盖当前协议、失败和正确身份 |
|
||||
| C3 生态集成 | 结构、公开冷克隆、精确 gitlink、官方基础发行、CLI Tool 和契约消费回归 |
|
||||
|
||||
本候选先对全部 active 组件运行集成。Woodpecker 的 `layout` 校验 Git tree,随后初始化公开直连子模块。`candidate` 用官方冻结归档验证冷安装、Conformance、View、Knowledge、Prove 和 Lint。View 的集成测试包含安装、静态核验、显式执行、Observation 和移除。C1 的完整构建、View 的全浏览器矩阵、Prove 的 Lean 后端以及 CLI 的 strict VM 和性能门禁沿用各组件独立流程。
|
||||
|
||||
本地运行需要 Linux x86_64/glibc ≥ 2.39、Python 3.11+、jsonschema、Git、Rust、C 编译器和 curl。
|
||||
|
||||
```sh
|
||||
git submodule update --init
|
||||
python3 scripts/check-layout.py --checkouts
|
||||
python3 -m unittest discover -s tests/integration
|
||||
bash scripts/integration.sh
|
||||
```
|
||||
|
||||
集成日志记录候选提交、每个 gitlink、二进制摘要及各检查退出码。对产物默认要求 digest 与来源提交一致。当前候选的冻结制品适配器以正式 RC.4 为基线。更新 CLI 基线时须同步修改其可验证制品入口及相关消费者,并同时审查源提交、锁定摘要和发布平台。
|
||||
|
||||
组件更多后才缩小日常影响范围。算法必须用新旧依赖图并集计算反向闭包,再加测试配对与受影响场景。CLI、Stdlib、未知边或集成策略变更保守全量测试。发布全量验证并绑定精确提交、运行环境、依赖与制品摘要。任何必需 FAIL 或 UNVERIFIED 都阻止对应阶段验收。
|
||||
|
||||
跨仓候选目前由维护者手动提交。自动化接入时,事件只用于唤醒,记录仓库、完整 SHA、CI URL。服务验证签名、仓库允许列表、真实 CI 结果和提交可达性,按仓库和 SHA 去重。机器人只写候选分支与 PR,维护者负责合并;凭据仅放服务端或平台 Secret,测试任务使用非特权身份。
|
||||
|
||||
## 发行与回滚
|
||||
|
||||
先验证完整候选组合,再由组件各自发布不可变制品。基础发行包含同源 CLI、Worker 与单一标准库 Bundle;工具和扩展使用各自权威制品与 CLI 的现行安装机制。主仓库发布记录应从 gitlink 和真实制品生成,包含主仓库 SHA、组件 SHA、各自版本、归档摘要、构建环境、平台和测试记录。
|
||||
|
||||
发布前在空 HOME、无 checkout 和禁网环境验证基础安装。每个声称支持的平台都要实机证据。失败候选保留日志;发布失败使用新的候选,已有标签和资产保持不可变。回滚用新集成提交恢复上一组通过的 gitlink,安全修复场景先审查回退风险。
|
||||
@@ -1,122 +0,0 @@
|
||||
# 迁移台账
|
||||
|
||||
## 权威盘点
|
||||
|
||||
历史主分支最后提交为 `1c55baabd570e18b9da8f9057cef2f848e176690`,v2.9.1 的发布提交为 `ffe06d7afab7acaed87be5ff16edddc37da536a2`。自建 Git 已核验旧标签和主分支。旧实现、文档、示例、测试与工作流以历史提交为迁移资料。[历史主分支末尾](https://git.cflmy.cn/cflmy/marqdo/src/commit/1c55baabd570e18b9da8f9057cef2f848e176690)
|
||||
|
||||
| 已有仓库 | 审计时默认分支 | 发行或证据 |
|
||||
| --- | --- | --- |
|
||||
| [marqdo-cli](https://git.cflmy.cn/cflmy/marqdo-cli) | `master` | v3.0.0-rc.4 |
|
||||
| [marqdo-extension-conformance](https://git.cflmy.cn/cflmy/marqdo-extension-conformance) | `main` | 有独立固定 fixture |
|
||||
| [marqdo-knowledge](https://git.cflmy.cn/cflmy/marqdo-knowledge) | `master` | v0.1.0-beta.3 |
|
||||
| [marqdo-lint](https://git.cflmy.cn/cflmy/marqdo-lint) | `main` | v0.2.0 |
|
||||
| [marqdo-prove](https://git.cflmy.cn/cflmy/marqdo-prove) | `master` | v0.1.0-beta.1 |
|
||||
| [marqdo-view](https://git.cflmy.cn/cflmy/marqdo-view) | `master` | v0.3.0 |
|
||||
|
||||
CLI gitlink 采用 RC.4 正式发布源码,以匹配冻结归档和现有 View/Lint 契约。
|
||||
其文档后续提交曾用于 Knowledge 的独立 CI;生态候选以自身测试判定实际组合。
|
||||
Conformance 使用 CLI 已固定的真实 fixture 提交。
|
||||
|
||||
## 已创建空仓
|
||||
|
||||
以下仓库已通过自建 Git API 确认存在且为空。责任、预期依赖与状态见 [组件目录](../components.toml)。
|
||||
|
||||
**标准库** · [core](https://git.cflmy.cn/cflmy/marqdo-std-core) · [collections](https://git.cflmy.cn/cflmy/marqdo-std-collections) · [text](https://git.cflmy.cn/cflmy/marqdo-std-text) · [encoding](https://git.cflmy.cn/cflmy/marqdo-std-encoding) · [data](https://git.cflmy.cn/cflmy/marqdo-std-data) · [io](https://git.cflmy.cn/cflmy/marqdo-std-io) · [fs](https://git.cflmy.cn/cflmy/marqdo-std-fs) · [system](https://git.cflmy.cn/cflmy/marqdo-std-system) · [net](https://git.cflmy.cn/cflmy/marqdo-std-net)
|
||||
|
||||
**扩展** · [math](https://git.cflmy.cn/cflmy/marqdo-ext-math) · [linalg](https://git.cflmy.cn/cflmy/marqdo-ext-linalg) · [quantum](https://git.cflmy.cn/cflmy/marqdo-ext-quantum) · [http](https://git.cflmy.cn/cflmy/marqdo-ext-http) · [websocket](https://git.cflmy.cn/cflmy/marqdo-ext-websocket) · [ai](https://git.cflmy.cn/cflmy/marqdo-ext-ai) · [mcp](https://git.cflmy.cn/cflmy/marqdo-ext-mcp) · [crypto](https://git.cflmy.cn/cflmy/marqdo-ext-crypto) · [database](https://git.cflmy.cn/cflmy/marqdo-ext-database) · [storage](https://git.cflmy.cn/cflmy/marqdo-ext-storage) · [cache](https://git.cflmy.cn/cflmy/marqdo-ext-cache) · [security](https://git.cflmy.cn/cflmy/marqdo-ext-security) · [web](https://git.cflmy.cn/cflmy/marqdo-ext-web) · [browser](https://git.cflmy.cn/cflmy/marqdo-ext-browser) · [document](https://git.cflmy.cn/cflmy/marqdo-ext-document) · [archive](https://git.cflmy.cn/cflmy/marqdo-ext-archive) · [engineering](https://git.cflmy.cn/cflmy/marqdo-ext-engineering) · [regex](https://git.cflmy.cn/cflmy/marqdo-ext-regex) · [datetime](https://git.cflmy.cn/cflmy/marqdo-ext-datetime)
|
||||
|
||||
## 阶段与阻塞
|
||||
|
||||
| 阶段 | 当前范围 | 后续验收 |
|
||||
| --- | --- | --- |
|
||||
| M0 盘点 | 自建 Git、历史标签、已有六组件和新仓位 | 通过真实远端候选持续维护台账 |
|
||||
| M1 集成骨架 | 六个 gitlink、布局门禁和 RC.4 组合 | 查看候选 Woodpecker 运行及各组件独立 CI |
|
||||
| M2 标准库切换 | planned,CLI RC.4 提供官方完整 Bundle | [CLI 外部 Bundle](https://git.cflmy.cn/cflmy/marqdo-cli/issues/11) 和 [九组件切换](https://git.cflmy.cn/cflmy/marqdo/issues/2),包括 HTTP、Regex、Archive 迁出与同步删除旧路径 |
|
||||
| M3 跨仓闭环 | 工单、人工候选、同 SHA 门禁 | [跨仓库 CI](https://git.cflmy.cn/cflmy/marqdo/issues/3) 跟踪真实缺陷闭环、候选通知鉴权、去重和影响分析 |
|
||||
| 后续领域 | 空仓和预期职责 | 逐组件开展最小真实功能、独立 CI、制品与接入 |
|
||||
|
||||
### 标准库切换顺序
|
||||
|
||||
1. CLI 打包器与产品测试接受单一显式外部 Bundle 输入。内核独立编译;制品仍附带一个校验过的标准库。
|
||||
2. 标准库在各组件维护唯一生产源码和自测。组装拒绝冲突、符号链接或测试污染,调用 CLI 权威打包器。std-io 维护 print/打印 的别名元数据。
|
||||
3. HTTP、Regex、Archive 的真实替代和授权回归先行。候选同时移除 CLI 中旧领域宿主服务和旧导入。
|
||||
4. 验证同输入两次组装结果、摘要及路径负例、C1/C2/C3、独立冷安装和真实工具集成后,再切换基础发行。当前状态为 UNVERIFIED。
|
||||
|
||||
## 现行 CLI 标准库迁移归属
|
||||
|
||||
| CLI 当前路径 | 唯一目标组件 | 新 Bundle 路径 / 处理 |
|
||||
|---|---|---|
|
||||
| `clock.mq.md` | std-system | `system/clock.mq.md` |
|
||||
| `compress.mq.md` | archive 扩展 | 不入最终标准库;先建立等价扩展与替代后端再删除宿主 convenience service |
|
||||
| `data/csv.mq.md` | std-data | `data/csv.mq.md` |
|
||||
| `data/json.mq.md` | std-data | `data/json.mq.md` |
|
||||
| `data/table.mq.md` | std-collections + std-data(函数级切分) | 集合算法 `collections/table.mq.md`;GFM 序列化 `data/gfm.mq.md`;不复制函数 |
|
||||
| `datetime.mq.md` | std-system | `system/datetime.mq.md`(UTC/基础日历) |
|
||||
| `demo.mq.md` | std-io 的 examples 或主仓库综合示例(择一) | 不作为公开安装模块;若只是 IO 自测,归 std-io |
|
||||
| `env.mq.md` | std-system | `system/env.mq.md` |
|
||||
| `format.mq.md` | std-io | `io/format.mq.md` |
|
||||
| `fs/file.mq.md` | std-fs | `fs/file.mq.md` |
|
||||
| `io.mq.md` | std-io | `io/index.mq.md`;官方 print alias 指向唯一权威 `写值`(迁移时同步生成元数据) |
|
||||
| `io/console.mq.md` | std-io | `io/console.mq.md` |
|
||||
| `io/stream.mq.md` | std-io | `io/stream.mq.md` |
|
||||
| `net/http.mq.md` | http 扩展 | 转为普通 Package 的 HTTP 实现,依赖 std-net;保持报文算法及真实 TCP 对照测试 |
|
||||
| `path.mq.md` | std-fs | `fs/path.mq.md` |
|
||||
| `process.mq.md` | std-system | `system/process.mq.md` |
|
||||
| `random.mq.md` | std-system | `system/random.mq.md` |
|
||||
| `regex.mq.md` | regex 扩展 | 单一正则模块,迁移纯子集及外部引擎;替换后删除核心宿主服务 |
|
||||
| `text.mq.md` | std-text | 重复 UTF-8 实现合并入 `text/utf8.mq.md`;新增通用 `text/text.mq.md` 不复制 encoder |
|
||||
| `text/utf8.mq.md` | std-text | `text/utf8.mq.md`(唯一权威 encoder/decoder) |
|
||||
|
||||
## v2 功能历史索引
|
||||
|
||||
按表中的归属逐项拆分工单,记录来源路径、目标接口、正负例、状态和真实测试提交。
|
||||
|
||||
| 旧版 lib 模块 | 目标 | 迁移决策 / 主要缺口 |
|
||||
|---|---|---|
|
||||
| archive | archive | ZIP/TAR 等安全归档;现有 gzip 迁移,测试路径穿越 |
|
||||
| browser | browser | 31 个 H2 所涉 DOM、存储、事件、fetch、WS、下载;不复制旧 WASM runtime |
|
||||
| bytes | std-text / std-encoding | 字节值、slice、UTF-8 归 Text,base64 归 Encoding,单一 byte 表示 |
|
||||
| cli | std-system | 应用参数 parse,非 CLI 自身 flag parser |
|
||||
| csv | std-data | 已有 parse/format;补非法输入与多行测试 |
|
||||
| datetime | std-system / datetime | UTC 基础已有;时区、DST 和高级日历明确拆分 |
|
||||
| document | document | sections、tables、links、code blocks、replace;通过受支持静态事实与显式文件编辑 |
|
||||
| encoding | std-encoding | Base64/Base32/Hex 编解码缺失 |
|
||||
| foreign | CLI 现有 Foreign / 独立可选会话扩展(待 ADR) | one-shot run/call 已有;不恢复 set_cmd/register 等隐式动态机制;session/replay 需真实设计 |
|
||||
| fs | std-fs / document / engineering | 40 个 H2 涵盖文件操作;新版14个 H2;二进制、递归、原子、临时、读写组合;文本 patch/工程 sync 归相应扩展 |
|
||||
| hash | crypto | SHA/HMAC 等,密码学不进入内核 |
|
||||
| html | web | escape/unescape 作为纯 Web 辅助模块 |
|
||||
| json | std-data | parse/stringify 已有;get/keys/set 等可复用 collections;严格 Result |
|
||||
| log | std-system | 结构化、level、输出门面,不引入服务框架 |
|
||||
| math | std-core / math | abs/min/max/clamp 基础归 Core;数值、超越、公式、CAS、绘图归 Math;随机归 System |
|
||||
| net | std-net / http / ai / document | TCP/TLS 基础归 Net;HTTP/SSE/cookie/multipart/download 归 HTTP;OpenAI 特定 SSE 归 AI;Markdown 解析归 Document 或公开静态事实 |
|
||||
| path | std-fs | join/normalize 等已有;relative/with_extension 等补齐 |
|
||||
| plugin | CLI 现行扩展选择机制 | 不迁移 load/unload 自动加载;使用显式 descriptors、lock、grant |
|
||||
| re | regex | 查找/替换/分割/捕获和现有纯子集、成熟后端,取消宿主 convenience 重复 |
|
||||
| result | std-core | ok/error/value_or,统一现行可恢复错误约定 |
|
||||
| secrets | std-system / crypto | token 生成归 System,密钥/密码学安全操作归 Crypto;不泄漏 secret |
|
||||
| stats | math | mean/median/stdev;定义样本与总体、空集合、精度 |
|
||||
| subtask | CLI Structured Tasks(待开发) / std-system | spawn/join/cancel 等先验证通用语义;库只薄封装,不移植旧 scheduler |
|
||||
| sys | std-system / CLI 公共事实 | env/args/process/clock;旧 stream_publish 和 meta 由现行 Observation/Analysis 或真正应用输出处理;不恢复隐式环境写入 |
|
||||
| table | std-collections / std-data | 60 个 H2 入口(List/Map/Table 混合);值操作归 Collections,GFM/数据格式归 Data |
|
||||
| text | std-text | trim/split/join、contains/replace、大小写、repeat/pad 等缺口 |
|
||||
| time | std-system | now/UTC parse 已部分有;sleep 仅在受控原语可用后实现 |
|
||||
| toml | std-data | parse/stringify/try_parse,实际支持标准及错误边界 |
|
||||
| url | http | URL parse/query/percent 与同协议归属,std-net 不重复 |
|
||||
| uuid | std-system | v4 使用 OS entropy;检查版本/variant |
|
||||
| writeback | document / engineering | 显式有界编辑、来源摘要及冲突检查;不恢复隐式自修改/自动 oracle writeback |
|
||||
| lint/narrative | lint Tool | 静态诊断与显式修复,不进 CLI runtime |
|
||||
|
||||
### 领域与插件
|
||||
|
||||
| 旧目录 | 目标及处理 |
|
||||
|---|---|
|
||||
| `ext/ai` + `plugins/llm` / `plugins/agent` | AI 模型协议、MCP 独立迁移;agent 97 个 H2 涉及 workflow/memory/工具/恢复等,按真实通用能力拆分,不整体复制。qdagent 应用管理其自己的最小工作流、记忆、意图和 SKILL,不作为通用标准库。知识检索、证明分别由对应 Tool;sandbox 用 CLI 的实际保证,不伪造 OS 隔离。 |
|
||||
| `ext/linalg` + `plugins/linalg` | Linalg;迁移数值算法、复数及矩阵符号知识;重新适配 ABI,减少重复。 |
|
||||
| `ext/quantum` + `plugins/quantum` | Quantum;gate/state/circuit/simulate/density/viz,移除与 Linalg 重复的实现或建立经测试的后端共享边界。 |
|
||||
| `ext/net` | HTTP、WebSocket、URL,低层 TCP/TLS 归 Std Net。 |
|
||||
| `ext/data` | Database/Cache/Storage;form/admin/api/view 的 Web 部分归 Web,数据验证及查询归唯一相应库。旧 Web Go plugin 的 DB、storage、cache 子模块分别迁移。 |
|
||||
| `ext/security` | Security + Crypto;旧 Go plugin auth/OIDC/RBAC/tenant/password 按归属拆分,不混入 Host capability。 |
|
||||
| `ext/web` + `plugins/web` | Web、HTTP、WebSocket、Browser、Database、Security 等拆分;保留原生 GFM 组件与布局表达,删除 monolithic Go plugin 调度与重复模块,重新适配公开协议。 |
|
||||
| `ext/engineering` + `plugins/engineering` | Engineering;Git 操作、文件、archive 分配给已有权威库,避免重复平台操作。 |
|
||||
| `crates/marqdo-wasm`、旧 browser examples | Browser 组件参考;语言核心可移植性需要 CLI 工单,而非复制旧执行器。 |
|
||||
| 旧 `src/knowledge`/proof/view/lint/对应历史 CI 与 examples | 独立 Tool,只迁移所需知识、算法和 fixture;当前公共 Analysis/Observation 优先;新旧协议不并存。 |
|
||||
@@ -1,138 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import argparse
|
||||
import graphlib
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import tomllib
|
||||
from pathlib import Path
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
NAME = r"[a-z][a-z0-9]*(?:-[a-z0-9]+)*"
|
||||
FIELDS = {"id", "path", "kind", "state", "owner", "scope", "requires", "checks_with", "release"}
|
||||
ROOT_FILES = {".gitattributes", ".gitignore", ".gitmodules", "AGENTS.md", "LICENSE", "README.md", "components.toml"}
|
||||
ROOT_DIRS = {".gitea", ".woodpecker", "docs", "examples", "scripts"}
|
||||
RELEASE_ROLES = {"core": "base", "stdlib": "base", "extension": "optional", "tool": "optional", "test": "none"}
|
||||
|
||||
|
||||
def git(*args, cwd=ROOT):
|
||||
return subprocess.check_output(["git", "-C", cwd, *args]).decode()
|
||||
|
||||
|
||||
def require(condition, message):
|
||||
if not condition:
|
||||
raise ValueError(message)
|
||||
|
||||
|
||||
def catalog(revision):
|
||||
components = tomllib.loads(git("show", f"{revision}:components.toml"))
|
||||
require(set(components) == {"component"} and isinstance(components["component"], list), "invalid catalog")
|
||||
by_id = {}
|
||||
paths = set()
|
||||
for component in components["component"]:
|
||||
state = component.get("state")
|
||||
fields = FIELDS | ({"entry"} if state == "active" else set())
|
||||
require(set(component) == fields and state in {"active", "planned"}, f"invalid fields: {component}")
|
||||
id = component["id"]
|
||||
kind = component["kind"]
|
||||
require(isinstance(id, str) and re.fullmatch(NAME, id) and id not in by_id, f"invalid or duplicate id: {id}")
|
||||
require(kind in RELEASE_ROLES and component["release"] == RELEASE_ROLES[kind], f"invalid release role: {id}")
|
||||
path = component["path"]
|
||||
expected = {
|
||||
"core": "cli" if id == "cli" else None,
|
||||
"test": "tests/conformance" if id == "conformance" else None,
|
||||
"stdlib": f"stdlib/{id.removeprefix('std-')}" if id.startswith("std-") else None,
|
||||
"extension": f"extensions/{id}",
|
||||
"tool": f"tools/{id}",
|
||||
}[kind]
|
||||
require(path == expected and path not in paths, f"invalid or duplicate path: {path}")
|
||||
for key in ("owner", "scope"):
|
||||
require(isinstance(component[key], str) and component[key].strip(), f"missing {key}: {id}")
|
||||
for key in ("requires", "checks_with"):
|
||||
items = component[key]
|
||||
require(isinstance(items, list) and all(isinstance(item, str) for item in items), f"invalid {key}: {id}")
|
||||
require(id not in items and len(set(items)) == len(items), f"invalid {key}: {id}")
|
||||
if state == "active":
|
||||
require(re.fullmatch(r"(?:[a-zA-Z0-9_-]+/)*[a-zA-Z0-9_-][a-zA-Z0-9_.-]*", component["entry"]), f"unsafe entry: {id}")
|
||||
paths.add(path)
|
||||
by_id[id] = component
|
||||
|
||||
for id, component in by_id.items():
|
||||
for field in ("requires", "checks_with"):
|
||||
for dependency in component[field]:
|
||||
require(dependency in by_id, f"unknown dependency: {id} -> {dependency}")
|
||||
target = by_id[dependency]
|
||||
require(component["state"] != "active" or target["state"] == "active", f"active depends on planned: {id} -> {dependency}")
|
||||
if field == "requires":
|
||||
require(component["kind"] != "stdlib" or target["kind"] in {"core", "stdlib"}, f"stdlib dependency violation: {id} -> {dependency}")
|
||||
require(component["kind"] != "tool" or target["kind"] == "core", f"tool dependency violation: {id} -> {dependency}")
|
||||
tuple(graphlib.TopologicalSorter({id: item["requires"] for id, item in by_id.items()}).static_order())
|
||||
return by_id
|
||||
|
||||
|
||||
def tree(revision):
|
||||
entries = {}
|
||||
for record in git("ls-tree", "-rz", "--full-tree", revision).split("\0"):
|
||||
if record:
|
||||
metadata, path = record.split("\t", 1)
|
||||
mode, _, sha = metadata.split()
|
||||
entries[path] = (mode, sha)
|
||||
return entries
|
||||
|
||||
|
||||
def validate(revision, checkouts):
|
||||
components = catalog(revision)
|
||||
active = {item["path"]: item for item in components.values() if item["state"] == "active"}
|
||||
entries = tree(revision)
|
||||
gitlinks = {path: sha for path, (mode, sha) in entries.items() if mode == "160000"}
|
||||
require(gitlinks.keys() == active.keys(), f"gitlink/catalog mismatch: {sorted(gitlinks.keys() ^ active.keys())}")
|
||||
for path, (mode, _) in entries.items():
|
||||
root = path.split("/", 1)[0]
|
||||
require(
|
||||
path in active or (mode in {"100644", "100755"} and (
|
||||
path in ROOT_FILES or root in ROOT_DIRS and "/" in path or path.startswith("tests/integration/")
|
||||
)),
|
||||
f"unexpected tracked path or mode: {path} ({mode})",
|
||||
)
|
||||
|
||||
config = {}
|
||||
for record in git("config", "--null", "--blob", f"{revision}:.gitmodules", "--list").split("\0"):
|
||||
if record:
|
||||
key, value = record.split("\n", 1)
|
||||
require(key not in config, f"duplicate submodule setting: {key}")
|
||||
config[key] = value
|
||||
for path, item in active.items():
|
||||
prefix = f"submodule.{path}."
|
||||
require(config.pop(prefix + "path", None) == path, f"missing or invalid submodule path: {path}")
|
||||
name = item["id"]
|
||||
if item["kind"] == "extension":
|
||||
name = f"ext-{name}"
|
||||
elif item["kind"] == "test":
|
||||
name = "extension-conformance"
|
||||
url = config.pop(prefix + "url", "")
|
||||
require(url == f"https://git.cflmy.cn/cflmy/marqdo-{name}.git", f"invalid submodule URL: {path}")
|
||||
if checkouts:
|
||||
checkout = ROOT / path
|
||||
sha = gitlinks[path]
|
||||
require(checkout.resolve() == checkout and (checkout / ".git").exists(), f"missing submodule checkout: {path}")
|
||||
require(git("rev-parse", "HEAD", cwd=checkout).strip() == sha, f"wrong checked-out commit: {path}")
|
||||
require(not git("status", "--porcelain", cwd=checkout), f"dirty submodule: {path}")
|
||||
entry = checkout / item["entry"]
|
||||
require(entry.is_file() and entry.resolve() == entry, f"missing or symbolic entry: {path}/{item['entry']}")
|
||||
print(f"{item['id']} {path} {gitlinks[path]}")
|
||||
require(not config, f"unexpected submodule settings: {sorted(config)}")
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Validate a Marqdo ecosystem Git tree")
|
||||
parser.add_argument("revision", nargs="?", default="HEAD")
|
||||
parser.add_argument("--checkouts", action="store_true")
|
||||
args = parser.parse_args()
|
||||
try:
|
||||
validate(git("rev-parse", "--verify", args.revision + "^{commit}").strip(), args.checkouts)
|
||||
except (AttributeError, KeyError, OSError, subprocess.CalledProcessError, TypeError, ValueError) as error:
|
||||
sys.exit(f"layout: {error}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
@@ -1,109 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
root="$PWD"
|
||||
python3 scripts/check-layout.py --checkouts
|
||||
active="$(git ls-tree -r HEAD | awk '$1 == "160000" { print $4 }')"
|
||||
expected=$'cli\ntests/conformance\ntools/knowledge\ntools/lint\ntools/prove\ntools/view'
|
||||
if [[ "$active" != "$expected" ]]; then
|
||||
echo "UNVERIFIED: update the integration plan for the changed active component set" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p .integration-work
|
||||
work="$(mktemp -d "$root/.integration-work/run.XXXXXX")"
|
||||
echo "integration evidence: $work"
|
||||
exec > >(tee "$work/run.log") 2>&1
|
||||
set -x
|
||||
git rev-parse HEAD
|
||||
git submodule status
|
||||
uname -m
|
||||
ldd --version
|
||||
cargo --version
|
||||
python3 --version
|
||||
python3 -c 'import jsonschema'
|
||||
|
||||
unset MARQDO_STDLIB_DIR
|
||||
export CARGO_HOME="${CARGO_HOME:-$HOME/.cargo}"
|
||||
mkdir "$work/frozen"
|
||||
frozen="$root/tools/view/scripts/frozen-beta.sh"
|
||||
metadata="$("$frozen" metadata)"
|
||||
artifact="$(sed -n 's/^artifact=//p' <<<"$metadata")"
|
||||
if [[ -n "${MARQDO_INTEGRATION_ARCHIVE:-}" ]]; then
|
||||
archive="$(realpath "$MARQDO_INTEGRATION_ARCHIVE")"
|
||||
archive_sha="$(sed -n 's/^archive_sha=//p' <<<"$metadata")"
|
||||
printf '%s %s\n' "$archive_sha" "$archive" | sha256sum -c -
|
||||
tar -xzf "$archive" -C "$work/frozen"
|
||||
MARQDO_BIN="$work/frozen/$artifact/marqdo"
|
||||
"$frozen" verify "$MARQDO_BIN"
|
||||
else
|
||||
MARQDO_BIN="$("$frozen" fetch "$work/frozen")"
|
||||
archive="$work/frozen/$artifact.tar.gz"
|
||||
fi
|
||||
export MARQDO_BIN
|
||||
source_sha="$(git -C cli rev-parse HEAD)"
|
||||
test "$(cat "$(dirname "$MARQDO_BIN")/SOURCE_SHA")" = "$source_sha"
|
||||
sha256sum "$archive" "$MARQDO_BIN" "$(dirname "$MARQDO_BIN")/marqdo-provider-worker"
|
||||
|
||||
python3 cli/tools/release/smoke.py --archive "$archive"
|
||||
python3 cli/tools/ci/verify_extension_contracts.py \
|
||||
--source-repo cli --tested-sha "$source_sha" --cli "$MARQDO_BIN" \
|
||||
--release-info "$(dirname "$MARQDO_BIN")/RELEASE_INFO.json" \
|
||||
--fixtures tests/conformance --out "$work/conformance.json"
|
||||
|
||||
(
|
||||
cd tools/view
|
||||
export MARQDO_TOOL_HOME="$work/view-registry"
|
||||
scripts/package.sh
|
||||
"$MARQDO_BIN" tool install dist/marqdo-view/tool.json
|
||||
"$MARQDO_BIN" view verify examples/mixed-modes/index.mq.md
|
||||
"$MARQDO_BIN" view export examples/tables-math --out "$work/view-export"
|
||||
setsid "$MARQDO_BIN" view examples/control-flow --port 0 --no-open >"$work/view-server.log" 2>&1 &
|
||||
view_pid=$!
|
||||
stop_view() {
|
||||
kill -- "-$view_pid" 2>/dev/null || true
|
||||
wait "$view_pid" 2>/dev/null || true
|
||||
}
|
||||
trap stop_view EXIT
|
||||
view_url=""
|
||||
for attempt in {1..100}; do
|
||||
view_url="$(grep -m1 -o 'http://127\.0\.0\.1:[0-9]\+/' "$work/view-server.log" || true)"
|
||||
if [[ -n "$view_url" ]] || ! kill -0 "$view_pid" 2>/dev/null; then
|
||||
break
|
||||
fi
|
||||
sleep 0.1
|
||||
done
|
||||
if [[ -z "$view_url" ]]; then
|
||||
cat "$work/view-server.log" >&2
|
||||
exit 1
|
||||
fi
|
||||
python3 scripts/acceptance-run.py "$view_url"
|
||||
stop_view
|
||||
trap - EXIT
|
||||
python3 scripts/check-observation.py stream-snapshot
|
||||
"$MARQDO_BIN" tool remove view
|
||||
if "$MARQDO_BIN" view --version; then
|
||||
echo "view still dispatches after removal" >&2
|
||||
exit 1
|
||||
fi
|
||||
)
|
||||
|
||||
(
|
||||
cd tools/knowledge
|
||||
MARQDO_TEST_BIN="$MARQDO_BIN" cargo test --locked --test core_cli --test compile
|
||||
)
|
||||
(
|
||||
cd tools/prove
|
||||
cargo test --locked --test analysis_document --test document_contract
|
||||
)
|
||||
(
|
||||
cd tools/lint
|
||||
export MARQDO_TOOL_HOME="$work/lint-registry"
|
||||
scripts/package-tool.sh "$work/lint"
|
||||
"$MARQDO_BIN" tool install "$work/lint/tool.json"
|
||||
"$MARQDO_BIN" lint examples/nested/inventory.mq.md --format json
|
||||
"$MARQDO_BIN" tool remove lint
|
||||
)
|
||||
|
||||
echo "PASS: ecosystem RC.4 candidate checks"
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: 解释器源码的放置位置
|
||||
date: 2026-08-11
|
||||
---
|
||||
|
||||
## 这里放置解释器源码
|
||||
@@ -0,0 +1,40 @@
|
||||
//解释器检测到错误的处理模块
|
||||
|
||||
//! 错误报告模块,集中管理解释器所有语法错误输出
|
||||
// use std::io;
|
||||
// use std::io::Write;
|
||||
|
||||
//建立独立抽象ErrorReport结构体
|
||||
//错误报告器,保存错误状态并提供错误报告接口
|
||||
#[derive(Debug, Default)]
|
||||
pub struct ErrorReport {
|
||||
had_error: bool,
|
||||
}
|
||||
|
||||
impl ErrorReport {
|
||||
//创建新的错误报告器
|
||||
pub fn new() -> Self {
|
||||
Self { had_error: false }
|
||||
}
|
||||
|
||||
//对外公开的错误接口,指定行号和错误信息
|
||||
pub fn error(&mut self, line: usize, message: &str) {
|
||||
self.report(line, "", message);
|
||||
}
|
||||
|
||||
//内部私有函数,输出错误信息,标记错误状态为true
|
||||
fn report(&mut self, line: usize, location: &str, message: &str) {
|
||||
eprintln!("[line {}] Error{}: {}", line, location, message);
|
||||
self.had_error = true;
|
||||
}
|
||||
|
||||
//获取错误状态
|
||||
pub fn has_error(&self) -> bool {
|
||||
self.had_error
|
||||
}
|
||||
|
||||
//重置错误状态
|
||||
pub fn clear(&mut self) {
|
||||
self.had_error = false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
//使用rust开发marqdo语言的解释器
|
||||
|
||||
//导入库
|
||||
use std::env; //用于获取命令行参数
|
||||
use std::fs; //用于读取文件
|
||||
// use std::io; //用于读取标准输入和输出
|
||||
// use std::io::BufReader; //用于读取缓冲区
|
||||
|
||||
//导入错误报告模块
|
||||
mod error;
|
||||
use error::ErrorReport;
|
||||
|
||||
fn main() {
|
||||
//创建新的错误报告器
|
||||
let mut error_report = ErrorReport::new();
|
||||
//获取命令行参数
|
||||
let args: Vec<String> = env::args().collect();
|
||||
|
||||
//解析命令行参数
|
||||
if args.len() > 3 {
|
||||
eprintln!("Usage: marqdo <use_mode> <file>");
|
||||
std::process::exit(1);
|
||||
}
|
||||
else if args.len() == 3 {
|
||||
let use_mode = &args[1];
|
||||
let file_path = &args[2];
|
||||
//传入模式选择函数,根据不同的模式选择不同的函数执行
|
||||
mode_selector(use_mode, file_path, &mut error_report);
|
||||
}
|
||||
else if args.len() == 2 {
|
||||
let file_path = &args[1];
|
||||
//默认为run模式,自动进行文件执行
|
||||
run_file(file_path, &mut error_report);
|
||||
}
|
||||
else {
|
||||
//无参数输入,默认进入交互模式
|
||||
run_prompt(&mut error_report);
|
||||
}
|
||||
}
|
||||
|
||||
//模式选择函数
|
||||
fn mode_selector(use_mode: &str, file_path: &str, error_report: &mut ErrorReport) {
|
||||
//根据不同的模式选择不同的函数执行
|
||||
match use_mode {
|
||||
"run" => run_file(file_path, error_report),
|
||||
_ => {eprintln!("Invalid use mode: {}", use_mode);
|
||||
std::process::exit(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//读取marqdo文件并运行marqdo脚本文件
|
||||
fn run_file(file_path: &str, error_report: &mut ErrorReport) {
|
||||
match fs::read_to_string(file_path) {
|
||||
Ok(source) => {
|
||||
run(&source, error_report);
|
||||
}
|
||||
Err(e) => {
|
||||
eprintln!("Error reading file: {}", e);
|
||||
std::process::exit(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//交互式模式
|
||||
fn run_prompt(error_report: &mut ErrorReport) {
|
||||
//提示交互式模式正在开发中
|
||||
println!("Interactive mode is not available yet.");
|
||||
error_report.error(0, "Interactive mode is not available yet.");
|
||||
//清除错误报告
|
||||
error_report.clear();
|
||||
std::process::exit(4);
|
||||
}
|
||||
|
||||
//运行marqdo脚本
|
||||
fn run(source: &str, error_report: &mut ErrorReport) {
|
||||
//提示正在开发中
|
||||
println!("Running script is not available yet.");
|
||||
//输出source
|
||||
println!("Source: {}", source);
|
||||
//输出错误报告
|
||||
println!("Error report: {}", error_report.has_error());
|
||||
//退出程序
|
||||
std::process::exit(5);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: marqdo语言测试用例的放置位置
|
||||
date: 2026-08-11
|
||||
---
|
||||
|
||||
## 这里用于放置marqdo语言的测试用例
|
||||
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: hello marqdo!
|
||||
---
|
||||
|
||||
> print "hello marqdo!"
|
||||
Submodule tests/conformance deleted from 015ff8ac15.
@@ -1,95 +0,0 @@
|
||||
import importlib.util
|
||||
import subprocess
|
||||
import tempfile
|
||||
import unittest
|
||||
from pathlib import Path
|
||||
from unittest.mock import patch
|
||||
|
||||
SCRIPT = Path(__file__).resolve().parents[2] / "scripts/check-layout.py"
|
||||
SPEC = importlib.util.spec_from_file_location("check_layout", SCRIPT)
|
||||
layout = importlib.util.module_from_spec(SPEC)
|
||||
SPEC.loader.exec_module(layout)
|
||||
|
||||
CLI = '''
|
||||
[[component]]
|
||||
id = "cli"
|
||||
path = "cli"
|
||||
kind = "core"
|
||||
state = "active"
|
||||
owner = "maintainer"
|
||||
scope = "core implementation"
|
||||
requires = []
|
||||
checks_with = []
|
||||
release = "base"
|
||||
entry = "scripts/test.sh"
|
||||
'''
|
||||
|
||||
PLANNED = '''
|
||||
[[component]]
|
||||
id = "std-core"
|
||||
path = "stdlib/core"
|
||||
kind = "stdlib"
|
||||
state = "planned"
|
||||
owner = "maintainer"
|
||||
scope = "primitive utilities"
|
||||
requires = ["cli"]
|
||||
checks_with = []
|
||||
release = "base"
|
||||
'''
|
||||
|
||||
|
||||
class LayoutTests(unittest.TestCase):
|
||||
def setUp(self):
|
||||
temporary = tempfile.TemporaryDirectory()
|
||||
self.addCleanup(temporary.cleanup)
|
||||
self.root = Path(temporary.name)
|
||||
self.enterContext(patch.object(layout, "ROOT", self.root))
|
||||
self.enterContext(patch.object(layout, "git", side_effect=self.git))
|
||||
self.git("init", "-q")
|
||||
self.git("-c", "user.name=Test", "-c", "user.email=test@example.invalid", "commit", "--allow-empty", "-qm", "fixture")
|
||||
self.sha = self.git("rev-parse", "HEAD").strip()
|
||||
|
||||
def git(self, *args, cwd=None):
|
||||
return subprocess.check_output(["git", "-C", cwd or self.root, *args]).decode()
|
||||
|
||||
def candidate(self, metadata=CLI, url="https://git.cflmy.cn/cflmy/marqdo-cli.git", extra=None):
|
||||
(self.root / "components.toml").write_text(metadata)
|
||||
(self.root / ".gitmodules").write_text(f'[submodule "cli"]\npath = cli\nurl = {url}\n')
|
||||
self.git("add", ".gitmodules", "components.toml")
|
||||
self.git("update-index", "--add", "--cacheinfo", f"160000,{self.sha},cli")
|
||||
if extra:
|
||||
self.git("update-index", "--add", "--cacheinfo", f"160000,{self.sha},{extra}")
|
||||
self.git("-c", "user.name=Test", "-c", "user.email=test@example.invalid", "commit", "-qm", "candidate")
|
||||
|
||||
def test_accepts_active_gitlink_and_planned_component(self):
|
||||
self.candidate(CLI + PLANNED)
|
||||
layout.validate("HEAD", False)
|
||||
|
||||
def test_rejects_planned_gitlink(self):
|
||||
self.candidate(CLI + PLANNED, extra="stdlib/core")
|
||||
with self.assertRaisesRegex(ValueError, "gitlink/catalog mismatch"):
|
||||
layout.validate("HEAD", False)
|
||||
|
||||
def test_rejects_active_dependency_on_planned(self):
|
||||
self.candidate(CLI.replace("requires = []", 'requires = ["std-core"]') + PLANNED)
|
||||
with self.assertRaisesRegex(ValueError, "active depends on planned"):
|
||||
layout.validate("HEAD", False)
|
||||
|
||||
def test_rejects_other_host(self):
|
||||
self.candidate(url="https://example.invalid/cflmy/marqdo-cli.git")
|
||||
with self.assertRaisesRegex(ValueError, "invalid submodule URL"):
|
||||
layout.validate("HEAD", False)
|
||||
|
||||
def test_rejects_wrong_repository_at_authority(self):
|
||||
self.candidate(url="https://git.cflmy.cn/cflmy/marqdo-view.git")
|
||||
with self.assertRaisesRegex(ValueError, "invalid submodule URL"):
|
||||
layout.validate("HEAD", False)
|
||||
|
||||
def test_rejects_unstaged_checkout(self):
|
||||
self.candidate()
|
||||
with self.assertRaisesRegex(ValueError, "missing submodule checkout"):
|
||||
layout.validate("HEAD", True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
Submodule tools/knowledge deleted from d8fa201b28.
-1
Submodule tools/lint deleted from 111e085f24.
-1
Submodule tools/prove deleted from d8c340b6e2.
-1
Submodule tools/view deleted from 04f3a0e9e5.
Reference in new issue
Block a user