感谢你对 CompressKit 项目的关注!本指南将帮助你快速参与项目开发。
- C++ 编译器: g++ 9+ 或 clang++ 10+ (支持 C++17)
- CMake: 3.16 或更高版本
- Python: 3.8 或更高版本(用于测试脚本)
- clang-format: 代码格式化
- Make: 简化构建命令
Ubuntu/Debian:
sudo apt update && sudo apt install g++ cmake clang-format python3 makemacOS (Homebrew):
brew install cmake clang-format python3 make# 克隆仓库
git clone https://github.com/LessUp/compress-kit.git
cd compress-kit
# 构建所有实现
make build
# 运行测试套件
make testgit checkout -b feature/your-feature-name# 开发过程中持续运行测试
make test
# 代码格式检查
make lint使用规范的 commit 信息格式:
feat:新功能fix:Bug 修复docs:文档更新refactor:代码重构test:测试相关chore:维护性工作
git commit -m "feat: add XXX feature"推送分支后,在 GitHub 上创建 PR。确保:
- ✅ 所有测试通过
- ✅ 代码格式符合规范
- ✅ 二进制格式兼容性未被破坏
- ✅ 相关文档已更新
- 遵循 Google C++ Style Guide
- 使用 clang-format 格式化
- 函数和变量使用
snake_case - 类和结构体使用
PascalCase
# 格式化
make format
# 格式检查
make lint最重要: 维护二进制格式兼容性是项目的核心约束。
- Magic Numbers 不可更改
- Frequency Table 格式必须统一
- 编码/解码 round-trip 必须正确
- 输入大小上限:4 GiB
- 解码输出上限:1 GiB
- 这些限制用于防止解压缩炸弹攻击
algorithms/ # 四种算法的 C++ 实现
├── huffman/
├── arithmetic/
├── range/
├── rle/
└── shared/ # 共享工具(频率表、Buffer 层、CLI)
tests/ # 测试套件和 CLI smoke 测试
docs/ # VitePress 文档站点
许可:MIT License · 版权所有 © 2025-2026 LessUp