Skip to content

Commit a91df5e

Browse files
committed
init for mcpp
1 parent 0b6b972 commit a91df5e

23 files changed

Lines changed: 346 additions & 616 deletions

File tree

.agents/skills/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# mcpp-style-ref Agent Skills
1+
# mcpplibs template Agent Skills
22

3-
用于指导 Agent 在编写或审查 Modern/Module C++ 代码时遵循 mcpp-style-ref 规范的技能
3+
用于指导 Agent 理解 mcpp/mcpplibs 模块库模板、查找外部资料,并在编写或审查 Modern/Module C++ 代码时遵循 mcpp-style-ref 规范
44

55
## 可用技能
66

77
| 技能 | 说明 |
88
|------|------|
9+
| [more-details](more-details/SKILL.md) | mcpp、mcpplibs、包索引、依赖案例、xlings 等资料入口和任务指引 |
910
| [mcpp-style-ref](mcpp-style-ref/SKILL.md) | 面向 mcpp 项目的 Modern/Module C++ (C++23) 命名、模块化与实践规则 |
1011

1112
## 使用方式
@@ -14,11 +15,13 @@
1415

1516
```bash
1617
mkdir -p .cursor/skills
18+
ln -s ../../skills/more-details .cursor/skills/more-details
1719
ln -s ../../skills/mcpp-style-ref .cursor/skills/mcpp-style-ref
1820
```
1921

2022
或安装为个人技能:
2123

2224
```bash
25+
ln -s /path/to/mcpp-template/.agents/skills/more-details ~/.cursor/skills/more-details
2326
ln -s /path/to/mcpp-style-ref/skills/mcpp-style-ref ~/.cursor/skills/mcpp-style-ref
2427
```

.agents/skills/mcpp-style-ref/SKILL.md

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ void Error::test() {
119119

120120
## 项目环境配置
121121

122-
安装 xlings 包管理器后,获取 GCC 15 工具链
122+
安装 xlings 包管理器后,安装本模板固定的 mcpp 工具
123123

124124
#### Linux/MacOS
125125

@@ -133,10 +133,12 @@ curl -fsSL https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tool
133133
irm https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.ps1 | iex
134134
```
135135

136-
然后安装工具链(仅linux, 其中windows默认用msvc)
136+
然后安装本模板固定的项目工具
137137

138138
```bash
139-
xlings install gcc@15 -y
139+
xlings install
140+
export PATH="$PWD/.xlings/subos/_/bin:$PATH"
141+
mcpp --version # mcpp 0.0.28
140142
```
141143

142144
> xlings详细信息可参考 [xlings](https://github.com/d2learn/xlings) 文档。
@@ -145,15 +147,18 @@ xlings install gcc@15 -y
145147

146148
参考本仓库 `src/` 目录结构:
147149

148-
- `xmake.lua`:配置 `set_languages("c++23")`、`set_policy("build.c++.modules", true)`
149-
- `add_files("main.cpp")`、`add_files("**.cppm")` 添加源文件
150-
- 可执行目标与静态库目标分离(如 `mcpp-style-ref` 主程序、`error` 静态库)
150+
- `.xlings.json`:固定项目工具环境,当前固定 `mcpp 0.0.28`
151+
- `mcpp.toml`:声明 `[package]` 与测试依赖;简单库目标可由 mcpp 从 `src/*.cppm` 自动推断
152+
- `src/mylib.cppm`:库主模块接口,默认 `export module mcpplibs.mylib;`
153+
- `tests/mylib_test.cpp`:`mcpp test` 自动发现的 gtest 测试;不要定义 `main()`
154+
- `examples/basic/`:独立 mcpp consumer 包,通过 path 依赖引用根库
151155
152156
构建:
153157
154158
```bash
155-
xmake build
156-
xmake run
159+
mcpp build
160+
mcpp test
161+
cd examples/basic && mcpp run
157162
```
158163
159164
## 适用场景
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: more-details
3+
description: 为 mcpp/mcpplibs 模块库开发提供资料导航。适用于 Agent 需要了解 mcpp 工具、mcpp.toml、包索引、mcpplibs 生态、依赖案例、xlings 工具环境、或寻找更多外部资料链接时。
4+
---
5+
6+
# more-details
7+
8+
这是 mcpp/mcpplibs 模块库开发的资料入口 skill。它只负责引导 Agent 去哪里查资料;具体实现仍以本仓库文件、mcpp 官方文档和实际命令输出为准。
9+
10+
## 使用原则
11+
12+
- 先看本仓库入口,再跳外部资料。
13+
- 只读取当前任务需要的文档,不要一次性展开所有链接。
14+
- 涉及工具行为、包版本、索引内容时,以当前仓库文件和外部源的最新内容为准。
15+
- 写 C++23 模块代码时,同时使用 `mcpp-style-ref`
16+
17+
## 本仓库入口
18+
19+
- `README.md`:模板使用入口、AI Agent 提示词、外部资源链接。
20+
- `docs/architecture.md`:项目结构、mcpp 约定、依赖添加方式。
21+
- `.xlings.json`:固定项目工具环境,当前固定 `mcpp 0.0.28`
22+
- `mcpp.toml`:包信息、依赖和测试依赖。
23+
- `src/mylib.cppm`:库模块接口示例。
24+
- `tests/mylib_test.cpp`:符合 mcpp 规范的 gtest 测试示例。
25+
- `examples/basic/`:独立使用方示例。
26+
27+
## 外部资源
28+
29+
### mcpp 工具
30+
31+
- mcpp 仓库:https://github.com/mcpp-community/mcpp
32+
- mcpp 文档:https://github.com/mcpp-community/mcpp/tree/main/docs
33+
- 快速开始:https://github.com/mcpp-community/mcpp/blob/main/docs/00-getting-started.md
34+
- 示例文档:https://github.com/mcpp-community/mcpp/blob/main/docs/01-examples.md
35+
- `mcpp.toml` 指南:https://github.com/mcpp-community/mcpp/blob/main/docs/05-mcpp-toml.md
36+
37+
优先用这些资料确认:
38+
39+
- `mcpp build``mcpp test``mcpp run` 的行为。
40+
- `src/*.cppm``src/main.cpp``tests/**/*.cpp` 的默认推断规则。
41+
- `[dependencies]``[dependencies.<namespace>]``[dev-dependencies]` 和目标覆盖配置。
42+
43+
### 包索引与生态
44+
45+
- mcpp 包索引:https://github.com/mcpp-community/mcpp-index
46+
- mcpplibs 组织:https://github.com/mcpplibs
47+
- 依赖库参考案例:https://github.com/mcpplibs/cmdline
48+
49+
添加依赖时优先检查包索引;需要看真实库写法时参考 `mcpplibs/cmdline`。默认直接 `import <module>;`,不要在主模块里默认 `export import` 依赖。
50+
51+
### 编码风格
52+
53+
- mcpp-style-ref 仓库:https://github.com/mcpp-community/mcpp-style-ref
54+
- 本仓库风格 skill:`.agents/skills/mcpp-style-ref/SKILL.md`
55+
56+
写或改 `.cppm` / `.cpp` 文件时,遵循 C++23 模块风格:`import std`、模块名稳定、公开 API 简洁、测试不写自定义 `main()`
57+
58+
### 工具环境
59+
60+
- xlings:https://github.com/d2learn/xlings
61+
62+
本模板通过 `.xlings.json` 固定 mcpp 版本。进入仓库后通常使用:
63+
64+
```bash
65+
xlings install
66+
export PATH="$PWD/.xlings/subos/_/bin:$PATH"
67+
mcpp --version
68+
```
69+
70+
## 常见任务指引
71+
72+
- **了解模板结构**:读 `README.md``docs/architecture.md`
73+
- **确认 mcpp 配置写法**:读 `mcpp.toml` 和 mcpp 的 `05-mcpp-toml.md`
74+
- **新增依赖**:查 `mcpp-index`,再参考 `mcpplibs/cmdline`
75+
- **新增模块 API**:读 `mcpp-style-ref`,再改 `src/*.cppm`
76+
- **新增测试**:参考 `tests/mylib_test.cpp`,用 `mcpp test` 验证。
77+
- **新增示例**:参考 `examples/basic/`,用独立 `mcpp.toml` 和 path 依赖。

.github/workflows/ci.yml

Lines changed: 16 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -15,82 +15,37 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
build-linux:
18+
mcpp:
1919
runs-on: ubuntu-latest
20-
timeout-minutes: 20
20+
timeout-minutes: 30
2121
steps:
2222
- name: Checkout
2323
uses: actions/checkout@v4
2424

25-
- name: Setup xmake
26-
uses: xmake-io/github-action-setup-xmake@v1
27-
with:
28-
xmake-version: latest
29-
package-cache: true
30-
31-
- name: Install dependencies
32-
run: |
33-
sudo apt-get update
34-
sudo apt-get install -y build-essential
35-
3625
- name: Install Xlings
3726
env:
3827
XLINGS_NON_INTERACTIVE: 1
3928
run: |
4029
curl -fsSL https://raw.githubusercontent.com/d2learn/xlings/refs/heads/main/tools/other/quick_install.sh | bash
41-
echo "PATH=$HOME/.xlings/subos/current/bin:$PATH" >> "$GITHUB_ENV"
30+
echo "$HOME/.xlings/subos/default/bin" >> "$GITHUB_PATH"
4231
43-
- name: Install GCC 15.1 with Xlings
32+
- name: Install project tools
4433
run: |
45-
xlings install gcc@15.1 -y
34+
xlings install -y
35+
echo "$GITHUB_WORKSPACE/.xlings/subos/_/bin" >> "$GITHUB_PATH"
4636
47-
- name: Build
37+
- name: Verify mcpp version
4838
run: |
49-
xmake f -m release -y -vv
50-
xmake -y -vv -j$(nproc)
39+
mcpp --version
40+
mcpp --version | grep -q "mcpp 0.0.28"
5141
52-
- name: Test
53-
run: xmake run templates_test
42+
- name: Build library
43+
run: mcpp build
5444

55-
- name: Run examples
56-
run: xmake run basic
45+
- name: Run tests
46+
run: mcpp test
5747

58-
build-macos:
59-
runs-on: macos-14
60-
timeout-minutes: 20
61-
steps:
62-
- name: Checkout
63-
uses: actions/checkout@v4
64-
65-
- name: Install dependencies
66-
run: brew install xmake llvm@20
67-
68-
- name: Build
48+
- name: Run example
6949
run: |
70-
export PATH=/opt/homebrew/opt/llvm@20/bin:$PATH
71-
xmake f --toolchain=llvm --sdk=/opt/homebrew/opt/llvm@20 -m release -y -vv
72-
xmake -y -vv -j$(sysctl -n hw.ncpu)
73-
74-
build-windows:
75-
runs-on: windows-latest
76-
timeout-minutes: 20
77-
steps:
78-
- name: Checkout
79-
uses: actions/checkout@v4
80-
81-
- name: Setup xmake
82-
uses: xmake-io/github-action-setup-xmake@v1
83-
with:
84-
xmake-version: latest
85-
package-cache: true
86-
87-
- name: Build
88-
run: |
89-
xmake f -m release -y -vv
90-
xmake -y -vv -j$env:NUMBER_OF_PROCESSORS
91-
92-
- name: Test
93-
run: xmake run templates_test
94-
95-
- name: Run examples
96-
run: xmake run basic
50+
cd examples/basic
51+
mcpp run

0 commit comments

Comments
 (0)