Skip to content

Commit 654d9df

Browse files
authored
feat: migrate to explicit namespace fields (mcpp 0.0.6) (#11)
All 10 package descriptors now carry an explicit `namespace` field per the namespace design doc (mcpp .agents/docs/2026-05-11): mcpplibs — modular C++23 libraries (cmdline, tinyhttps, llmapi, xpkg, templates) mcpplibs.capi — C API module wrappers (lua) compat — non-modular C/C++ libraries (gtest, mbedtls, lua upstream, ftxui) File naming convention: compat packages → compat.<name>.lua mcpplibs packages → <name>.lua mcpplibs.capi → capi.<name>.lua Directories reorganised by first letter of the file name. README updated to document namespaces + new mcpp.toml dependency syntax (`[dependencies.mcpplibs]`, `[dependencies.compat]`).
1 parent 4a53056 commit 654d9df

11 files changed

Lines changed: 55 additions & 26 deletions

README.md

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,43 @@
77
## 快速使用
88

99
```bash
10-
mcpp add ftxui@6.1.9 # 添加依赖到 mcpp.toml
11-
mcpp build # 自动拉取源码 + 构建
10+
mcpp add mcpplibs:cmdline@0.0.2 # 模块化库
11+
mcpp add compat:ftxui@6.1.9 # 非模块化兼容库
12+
mcpp build # 自动拉取源码 + 构建
1213
```
1314

15+
## 命名空间
16+
17+
mcpp 0.0.6+ 使用显式 `namespace` 字段区分包的类别:
18+
19+
| namespace | 含义 | 鼓励使用 |
20+
|---|---|---|
21+
| `mcpplibs` | 模块化 C++23 库(mcpplibs 生态) | ✅ 推荐 |
22+
| `mcpplibs.capi` | C API 的 C++23 模块封装 | ✅ 推荐 |
23+
| `compat` | 非模块化 C/C++ 库(兼容性支持) | ⚠️ 建议优先使用模块化替代 |
24+
1425
## 已收录的包
1526

16-
### mcpplibs 模块化库
27+
### `mcpplibs` — 模块化库
28+
29+
| 包名 | 版本 | 简介 | 仓库 |
30+
|------|------|------|------|
31+
| `cmdline` | 0.0.2 | 命令行解析框架 — `import mcpplibs.cmdline;` | [mcpplibs/cmdline](https://github.com/mcpplibs/cmdline) |
32+
| `tinyhttps` | 0.2.2 | 轻量 HTTP/HTTPS 客户端(SSE 流式) — `import mcpplibs.tinyhttps;` | [mcpplibs/tinyhttps](https://github.com/mcpplibs/tinyhttps) |
33+
| `llmapi` | 0.2.5 | 大语言模型 API 客户端(OpenAI/Anthropic 兼容) — `import mcpplibs.llmapi;` | [mcpplibs/llmapi](https://github.com/mcpplibs/llmapi) |
34+
| `xpkg` | 0.0.39 | xpkg V1 规范的 C++23 参考实现 — `import mcpplibs.xpkg;` | [openxlings/libxpkg](https://github.com/openxlings/libxpkg) |
35+
| `templates` | 0.0.1 | 最小化模块库模板 — `import mcpplibs.templates;` | [mcpplibs/templates](https://github.com/mcpplibs/templates) |
36+
37+
### `mcpplibs.capi` — C API 封装
1738

1839
| 包名 | 版本 | 简介 | 仓库 |
1940
|------|------|------|------|
20-
| `mcpplibs.cmdline` | 0.0.2 | 命令行解析框架 — `import mcpplibs.cmdline;` | [mcpplibs/cmdline](https://github.com/mcpplibs/cmdline) |
21-
| `mcpplibs.tinyhttps` | 0.2.2 | 轻量 HTTP/HTTPS 客户端(SSE 流式) — `import mcpplibs.tinyhttps;` | [mcpplibs/tinyhttps](https://github.com/mcpplibs/tinyhttps) |
22-
| `mcpplibs.llmapi` | 0.2.5 | 大语言模型 API 客户端(OpenAI/Anthropic 兼容) — `import mcpplibs.llmapi;` | [mcpplibs/llmapi](https://github.com/mcpplibs/llmapi) |
23-
| `mcpplibs.capi.lua` | 0.0.3 | Lua 5.4 C API 的 C++23 模块封装 — `import mcpplibs.capi.lua;` | [mcpplibs/lua](https://github.com/mcpplibs/lua) |
24-
| `mcpplibs.xpkg` | 0.0.39 | xpkg V1 规范的 C++23 参考实现 — `import mcpplibs.xpkg;` | [openxlings/libxpkg](https://github.com/openxlings/libxpkg) |
25-
| `mcpplibs.templates` | 0.0.1 | 最小化模块库模板 — `import mcpplibs.templates;` | [mcpplibs/templates](https://github.com/mcpplibs/templates) |
41+
| `lua` | 0.0.3 | Lua 5.4 C API 的 C++23 模块封装 — `import mcpplibs.capi.lua;` | [mcpplibs/lua](https://github.com/mcpplibs/lua) |
42+
43+
### `compat` — 非模块化兼容库
2644

27-
### 第三方 C/C++ 库
45+
> 这些库的上游没有 C++23 模块化支持,mcpp 通过 Form B 描述文件提供兼容性构建。
46+
> 建议优先使用对应的模块化封装(如 `mcpplibs.capi.lua` 替代 `compat.lua`)。
2847
2948
| 包名 | 版本 | 简介 |
3049
|------|------|------|
@@ -36,13 +55,13 @@ mcpp build # 自动拉取源码 + 构建
3655
### 依赖关系链
3756

3857
```
39-
mcpplibs.llmapi
40-
└── mcpplibs.tinyhttps
41-
└── mbedtls ← mcpp 自动传递,无需手动声明
58+
mcpplibs:llmapi
59+
└── mcpplibs:tinyhttps
60+
└── compat:mbedtls ← mcpp 自动传递,无需手动声明
4261
43-
mcpplibs.xpkg
44-
└── mcpplibs.capi.lua
45-
└── lua ← 同上
62+
mcpplibs:xpkg
63+
└── mcpplibs.capi:lua
64+
└── compat:lua ← 同上
4665
```
4766

4867
mcpp 0.0.3+ 的 transitive walker 自动沿链路传播头文件和依赖,消费者只需声明直接依赖。
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
-- finds <verdir>/lua-<tag>/mcpp.toml inside the GitHub tarball wrap.
44
package = {
55
spec = "1",
6-
name = "mcpplibs.capi.lua",
6+
namespace = "mcpplibs.capi",
7+
name = "lua",
78
description = "C++23 module wrapping the Lua 5.4 C API — `import mcpplibs.capi.lua;`",
89
licenses = {"Apache-2.0"},
910
repo = "https://github.com/mcpplibs/lua",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
-- `cmdline-<tag>/` wrap layer.
1111
package = {
1212
spec = "1",
13-
name = "mcpplibs.cmdline",
13+
namespace = "mcpplibs",
14+
name = "cmdline",
1415
description = "A simple command-line parsing library/framework for modern C++",
1516
licenses = {"Apache-2.0"},
1617
repo = "https://github.com/mcpplibs/cmdline",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010

1111
package = {
1212
spec = "1",
13-
name = "ftxui",
13+
namespace = "compat",
14+
name = "ftxui",
1415
description = "C++ Functional Terminal User Interface (screen + dom + component)",
1516
licenses = {"MIT"},
1617
repo = "https://github.com/ArthurSonzogni/FTXUI",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55

66
package = {
77
spec = "1",
8-
name = "gtest",
8+
namespace = "compat",
9+
name = "gtest",
910
description = "Google's C++ test framework",
1011
licenses = {"BSD-3-Clause"},
1112
repo = "https://github.com/google/googletest",

pkgs/l/lua.lua renamed to pkgs/c/compat.lua.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111

1212
package = {
1313
spec = "1",
14-
name = "lua",
14+
namespace = "compat",
15+
name = "lua",
1516
description = "A powerful, efficient, lightweight, embeddable scripting language",
1617
licenses = {"MIT"},
1718
repo = "https://www.lua.org",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88

99
package = {
1010
spec = "1",
11-
name = "mbedtls",
11+
namespace = "compat",
12+
name = "mbedtls",
1213
description = "An open source, portable, easy to use, readable and flexible TLS library, and reference implementation of the PSA Cryptography API",
1314
licenses = {"Apache-2.0"},
1415
repo = "https://github.com/Mbed-TLS/mbedtls",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
-- wrap (`llmapi-<tag>/mcpp.toml`) automatically.
44
package = {
55
spec = "1",
6-
name = "mcpplibs.llmapi",
6+
namespace = "mcpplibs",
7+
name = "llmapi",
78
description = "Modern C++ LLM API client with openai-compatible support",
89
licenses = {"Apache-2.0"},
910
repo = "https://github.com/mcpplibs/llmapi",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
-- default lookup is ambiguous or wrong for your tarball.
66
package = {
77
spec = "1",
8-
name = "mcpplibs.templates",
8+
namespace = "mcpplibs",
9+
name = "templates",
910
description = "Minimal C++23 modular hello library",
1011
licenses = {"Apache-2.0"},
1112
repo = "https://github.com/mcpp-community/templates",
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
-- finds <verdir>/<repo-tag>/mcpp.toml inside the GitHub tarball wrap.
44
package = {
55
spec = "1",
6-
name = "mcpplibs.tinyhttps",
6+
namespace = "mcpplibs",
7+
name = "tinyhttps",
78
description = "Minimal C++23 HTTP/HTTPS client with SSE streaming support",
89
licenses = {"Apache-2.0"},
910
repo = "https://github.com/mcpplibs/tinyhttps",

0 commit comments

Comments
 (0)