Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion .agents/skills/mcpp-usage/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,31 @@ license = "Apache-2.0"

## mcpp.toml 配置

### 传统头文件库的模块化封装

`mcpplibs.mwrap.<库名>` 为传统 C/C++ 库提供模块入口;API namespace 保留上游,例如
`import mcpplibs.mwrap.opencv.core;` 后仍使用 `cv::Mat`。包版本对齐上游,封装修订最多追加一个数字尾号。
具体已发布的版本/feature 先查索引,不把文档中的候选库当已发布包。

每个新建或重构的 -m 库提供包自带快捷模板:

```bash
mcpp new vision --template mcpplibs.mwrap.opencv@5.0.0.1
mcpp new --list-templates mcpplibs.mwrap.opencv@5.0.0.1
```

模板语法为 `[namespace.]name[@version][:template]`,只有一个默认模板时可以省略模板名。
包模板中的 `{{self.name}}` 是完整包选择器,应用 `"{{self.name}}"` 作为单个依赖 key,
不要放到另一层 namespace 表下。模板必须实际创建、构建、运行,而不只做字符串检查。

feature 是加法并集;消费者可在依赖声明中使用 `default-features = false` 关闭该边的默认集合,
显式 features 仍会启用,其他依赖边的请求不会被取消。根项目没有 `--no-default-features` 命令行选项。
可选大依赖由包作者显式门控。模块可导入不等于实际后端已启用,窗口/推理/设备能力需分别验证。
宏不能经 import 传递;`.macros` 只提供可保持语义的常量/函数映射,原始宏仍需兼容头。

维护规范与包装流程见 [mcpp-index mwrap 规范](https://github.com/mcpplibs/mcpp-index/blob/main/docs/mwrap.md)。
修改普通消费者项目时按现有包契约使用,不自动替用户迁移其他依赖。

```toml
[package]
name = "myapp"
Expand All @@ -88,7 +113,7 @@ gtest = "1.15.2" # 仅测试使用;SemVer: ^, ~, 范围, 精确
default = "gcc@16.1.0"
```

更多配置:https://github.com/mcpp-community/mcpp/blob/main/docs/05-mcpp-toml.md
更多配置:https://github.com/mcpp-community/mcpp/blob/main/docs/04-mcpp-toml.md

## 工具链

Expand Down
7 changes: 7 additions & 0 deletions docs/01-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,13 @@ automatically uses the package's only template when none is explicitly marked.
Multiple templates without one default are an error that points to
`--list-templates`. There is no separate `--variant` vocabulary.

A package template can use a module wrapper for a traditional header library.
The module name and the C++ API namespace are independent: importing a wrapper
does not rename the upstream types or functions. Use the package's published
identity and version when selecting its template. The
[wrapper specification](https://github.com/mcpplibs/mcpp-index/blob/main/docs/mwrap.md)
documents the `mcpplibs.mwrap` naming and interface contract.

The package identity, version, and template are fully resolved before the
destination is committed. A failed download, render, hook, or validation leaves
no half-created project directory.
Expand Down
17 changes: 13 additions & 4 deletions docs/06-features-and-capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -556,10 +556,19 @@ statement: private keeps the headers off a consumer's search path, and

## Current limitations

**A default feature is turned off in the manifest, not on the command line.**
There is no `--no-default-features`. `mcpp build --features metrics` activates
`default ∪ {metrics}`; building without a member of `default` means editing
`[features] default`. Measured on 2026.9.8.1.
**The root's default features are changed in its manifest.** There is no
`--no-default-features` command-line option. `mcpp build --features metrics`
activates the root's `default ∪ {metrics}`.

A consumer can suppress a dependency's own default set:

```toml
[dependencies]
widget = { version = "1.2.3", default-features = false, features = ["metrics"] }
```

Explicit features still activate. Requests unify across dependency edges: an
edge opting out does not cancel defaults or features another edge requests.

**A dependency cannot be conditioned on the accelerator.** `accelerator` is
resolved from the dependency graph, so a dependency chosen by it would decide
Expand Down
5 changes: 5 additions & 0 deletions docs/zh/01-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ mcpp new --list-templates ocornut.imgui@1.92.8
那个唯一的模板。存在多个模板却没有默认值是一个错误,会指向
`--list-templates`。没有另一套 `--variant` 词汇。

包模板可以使用传统头文件库的模块化封装。模块名与 C++ API namespace 相互独立:
import 封装模块不会重命名上游类型和函数。选择模板时使用该包已发布的身份与版本。
[封装规范](https://github.com/mcpplibs/mcpp-index/blob/main/docs/mwrap.md)
记录了 `mcpplibs.mwrap` 的命名和接口约定。

包身份、版本与模板会在提交目标目录之前全部解析完成。下载、渲染、hook 或
校验失败时,不会留下一个半成品的工程目录。

Expand Down
16 changes: 12 additions & 4 deletions docs/zh/06-features-and-capabilities.md
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,18 @@ provides = ["platform-sdk"]

## 当前边界

**默认 feature 在 manifest 里关掉,不在命令行上关掉。** 没有
`--no-default-features`。`mcpp build --features metrics` 激活的是
`default ∪ {metrics}`;要在不带 `default` 中某个成员的情况下构建,得改
`[features] default`。实测于 2026.9.8.1。
**根项目的默认 feature 在 manifest 中修改。** 没有 `--no-default-features`
命令行选项。`mcpp build --features metrics` 激活根项目的 `default ∪ {metrics}`。

消费者可以关闭依赖包自身的默认集合:

```toml
[dependencies]
widget = { version = "1.2.3", default-features = false, features = ["metrics"] }
```

显式指定的 feature 仍会激活。不同依赖边的请求取并集:某条边关闭默认项,不会取消
另一条边要求的默认项或 feature。

**依赖不能以加速器为条件。** `accelerator` 是从依赖图中解析出来的,因此由它
选择的依赖会决定它自己所问的那个答案。mcpp 会报告该谓词并忽略它。包要么无
Expand Down
Loading