| name | mcpp-contributing |
|---|---|
| description | Use when contributing to the mcpp project — submitting bug fixes, new features, code optimizations, documentation improvements, or any PR. Covers issue creation, branch conventions, build verification, CI requirements, and PR workflow using gh and git. |
mcpp 项目的贡献流程:先创建 Issue → 实现改动 → 提交 PR → CI 通过 → Review 合入。
- 仓库:https://github.com/mcpp-community/mcpp
- 构建:
mcpp build(C++23 模块自举) - 测试:
tests/e2e/下的 bash 脚本 - CI:GitHub Actions,base 为
main的 PR 自动触发
所有贡献先创建 Issue,特别是新功能。避免重复工作,留下讨论记录。
Bug 修复
gh issue create \
--title "fix: 简短描述" \
--body "## 复现步骤
1. ...
## 期望行为
...
## 实际行为
...
## 环境
- mcpp 版本:\`mcpp --version\`
- OS:"新功能
gh issue create \
--title "feat: 简短描述" \
--body "## 动机
...
## 设计思路
...
## 涉及模块
..."代码优化
gh issue create \
--title "refactor: 简短描述" \
--body "## 当前问题
...
## 优化方案
..."分支
git checkout main && git pull origin main
git checkout -b <type>/<short-description>
# type: feat / fix / refactor / test / docs开发要求
- 遵循现有代码风格(查看相邻代码)
- 模块导入用
import std;和import mcpp.xxx; - 只改需要改的,不顺手重构不相关代码
构建验证
# 找到 mcpp 二进制
ls target/x86_64-linux-gnu/*/bin/mcpp
# 构建
<mcpp-binary> build测试
bash tests/e2e/01_help_and_version.sh # 基础测试
bash tests/e2e/<relevant-test>.sh # 相关测试
# 新功能应创建对应 E2E 测试提交信息:feat: / fix: / refactor: / test: / docs: 前缀
git push -u origin <branch>
gh pr create \
--title "<type>: 简短描述" \
--body "## Summary
- 改动点
Closes #<issue>
## Test plan
- [ ] mcpp build 通过
- [ ] E2E 测试通过"CI 不通过的 PR 不会被合入。
gh pr checks <pr-number> # 查看状态
gh run view <run-id> --log-failed # 查看失败日志CI 内容:mcpp 自举构建 + E2E 测试。只有 base 为 main 的 PR 触发。
维护者 review → 反馈修改 → CI 重跑 → Squash merge。
src/
├── cli.cppm ← 命令行入口
├── config.cppm ← 全局配置
├── manifest.cppm ← mcpp.toml 解析
├── build/ ← 构建系统(ninja 后端)
├── pm/ ← 包管理子系统
├── toolchain/ ← 编译器检测管理
├── modgraph/ ← 模块图扫描验证
├── pack/ ← 打包发布
└── xlings.cppm ← xlings 抽象层
tests/e2e/ ← E2E 测试脚本
docs/ ← 用户文档
.agents/docs/ ← 设计文档
.agents/skills/ ← Agent 技能文档
- C++23 模块项目,修改模块时注意 import 依赖顺序
- E2E 测试应独立运行,不依赖网络
- 不确定方向时先在 Issue 讨论再动手