cc-haha/CONTRIBUTING.md
程序员阿江(Relakkes) 12c67f7137 chore(git-hooks): make pre-push checks non-blocking
Replace the local pre-push quality gate with a reminder-only hook, keep manual quality commands documented, and update the contract test to prevent reintroducing a blocking push gate.

Tested: bash .git/hooks/pre-push </dev/null
Tested: bun test scripts/git-hooks/install.test.ts scripts/pr/quality-contract.test.ts
Tested: bun run check:policy
Tested: bun run check:docs
Tested: git diff --check
Confidence: high
Scope-risk: narrow
2026-06-03 19:22:14 +08:00

59 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 贡献指南
提交 PR 前需要完成以下三步。
## 1. 运行本地门禁
```bash
bun run verify
```
`bun run verify` 会一键检查 policy、desktop、server、adapters、native、docs、quarantine 和 coverage。非 0 退出就说明当前分支还不能提交 PR。
`git push` 不再自动运行本地质量门禁。需要质量检查时请手动运行 `bun run quality:push``bun run verify`;完整覆盖率仍以 `bun run verify` 为准。
只改了某个模块时可以用窄命令快速迭代:
| 改动范围 | 快速验证 |
| --- | --- |
| CLI / Server / 工具 | `bun run check:server` |
| 桌面端 | `bun run check:desktop` |
| IM Adapter | `bun run check:adapters` |
| 桌面 Electron / 原生打包 | `bun run check:native` |
| 文档 | `bun run check:docs` |
门禁失败时,查看最新质量报告和对应 lane 日志定位问题:
```
artifacts/quality-runs/<timestamp>/report.md
artifacts/quality-runs/<timestamp>/logs/<lane>.log
```
## 2. 桌面端功能必须手工测试
改动涉及 `desktop/` 的 UI、store、API、Electron host 或 native/packaging 层时,除了自动门禁外,还必须在真机上做手工测试:
- 起本地服务 `SERVER_PORT=3456 bun run src/server/index.ts`
- 起桌面端 `cd desktop && bun run dev`
- 验证改动涉及的交互流程:页面渲染、按钮/表单行为、弹窗、快捷键、多窗口等
- 必要时打本地 macOS 包 `desktop/scripts/build-macos-arm64.sh` 做完整验证
## 3. PR 必须附上影响范围和测试说明
每个 PR 的描述里必须包含:
- **影响范围**改了哪些模块desktop / server / adapter / native / docs / provider / agent-loop
- **测试说明**:跑了哪些测试、覆盖率情况、手工测试了哪些流程(桌面端改动必须有真机测试记录)
- **剩余风险**:已知未覆盖的边界或需要后续跟进的点
如果改动了 provider/runtime、agent-loop、文件编辑、权限、session 等核心路径,还需要跑真实模型验证:
```bash
bun run quality:providers
bun run quality:smoke --provider-model <provider:model>
```
## 更多
完整质量门禁和覆盖率说明见 [AGENTS.md](AGENTS.md)。