Skip to content

Commit e7f6f8d

Browse files
committed
Merge quality gate baseline work
Bring the detached quality-gate worktree into local main while preserving the existing main-only desktop diagnostics commits. This merge lands the PR/release quality gate, live model baselines, provider selector docs, AGENTS automation rules, and repository hygiene for generated artifacts. Constraint: Local main had commits not present in the detached worktree, so fast-forward merge was not possible. Rejected: Rebase the detached worktree | rewriting the already-verified local commits would discard the exact release-gate evidence SHA chain. Confidence: high Scope-risk: broad Directive: Keep quality reports and local Superpowers plans out of future commits; use report summaries as evidence, not tracked artifacts. Tested: bun run quality:gate --mode release --allow-live --provider-model codingplan:main:codingplan-main --provider-model minimax:main:minimax-main Not-tested: post-merge full rerun on main; merge had no content conflicts.
2 parents 0b87fd0 + 6f9f2c6 commit e7f6f8d

53 files changed

Lines changed: 2679 additions & 1387 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitignore‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ extracted-natives/
2222
# E2E screenshots
2323
e2e-*.png
2424

25+
# Quality gate reports
26+
artifacts/quality-runs/
27+
2528
# Desktop build output
2629
desktop/dist/
2730
desktop/build-artifacts/

‎AGENTS.md‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ Install root dependencies with `bun install`, then install desktop dependencies
1313
- `cd desktop && bun run build`: type-check and produce a production web build.
1414
- `cd desktop && bun run test`: run Vitest suites.
1515
- `cd desktop && bun run lint`: run TypeScript no-emit checks.
16+
- `bun run quality:providers`: list configured provider/model selectors for live agent baselines.
17+
- `bun run quality:pr`: run the local PR quality gate and write a report under `artifacts/quality-runs/`.
18+
- `bun run quality:gate --mode baseline --allow-live --provider-model <provider:model[:label]>`: run live Coding Agent baseline cases, including desktop agent-browser smoke.
19+
- `bun run quality:gate --mode release --allow-live --provider-model <provider:model[:label]>`: run the release gate with live baseline coverage.
1620

1721
## Desktop Release Workflow
1822
- Desktop releases are built remotely by GitHub Actions, not by uploading local build artifacts.
@@ -32,6 +36,23 @@ Use TypeScript with 2-space indentation, ESM imports, and no semicolons to match
3236
## Testing Guidelines
3337
Desktop tests use Vitest with Testing Library in a `jsdom` environment. Name tests `*.test.ts` or `*.test.tsx`; colocate focused tests near the file or place broader coverage in `desktop/src/__tests__/`. No coverage gate is configured, so add regression tests for any behavior you change and run the relevant suites before opening a PR.
3438

39+
## Quality Gate Automation
40+
Future Coding Agents should run the right local gate themselves before claiming a change is ready. Do not ask the user to manually run the commands unless credentials, local model access, or machine resources are missing.
41+
42+
- For normal code changes, run the narrow relevant check first, then `bun run quality:pr` before a PR-ready or merge-ready claim.
43+
- Use `bun run check:server` for `src/server`, `src/tools`, provider/runtime, MCP, OAuth, WebSocket, or API behavior changes.
44+
- Use `bun run check:desktop` for `desktop/src` UI, stores, API clients, and desktop web behavior changes.
45+
- Use `bun run check:native` for `desktop/src-tauri`, sidecars, native packaging, release, or platform startup behavior changes.
46+
- Use `bun run check:adapters` for `adapters/`; on a fresh checkout run `cd adapters && bun install` first if dependencies are missing.
47+
- Use `bun run check:docs` for docs, VitePress, README, or docs workflow changes.
48+
- For chat, agent loop, tool execution, provider routing, desktop chat UI, CLI task execution, or other core Coding Agent paths, also run a live baseline when local providers are available: first `bun run quality:providers`, then choose one or more copyable selectors and run `bun run quality:gate --mode baseline --allow-live --provider-model <provider:model[:label]>`.
49+
- For release readiness, run `bun run quality:gate --mode release --allow-live --provider-model <provider:model[:label]>` with at least one real provider/model selector. Prefer multiple providers when quota is available.
50+
- If no live provider is configured, or a provider quota/key is unavailable, run the non-live gate anyway and report the live-baseline blocker explicitly instead of claiming full release confidence.
51+
- `bun run check:docs` executes `npm ci`, which can rebuild root `node_modules`. Run docs checks sequentially, not in parallel with `quality:pr`, `check:native`, or other commands that depend on the same installed packages.
52+
- Quality reports are written to `artifacts/quality-runs/<timestamp>/`. Summarize the final report path and the pass/fail counts in handoffs and PR descriptions.
53+
- Do not commit generated `artifacts/quality-runs/`, local `.omx/` state, `node_modules/`, `desktop/node_modules/`, or adapter dependency folders.
54+
- Do not claim "complete", "ready to merge", or "ready to release" without either running the matching gate or naming the exact blocker that prevented it.
55+
3556
## Commit & Pull Request Guidelines
3657
Recent history follows Conventional Commit prefixes such as `feat:`, `fix:`, and `docs:`. Keep subjects imperative and scoped to one change. PRs should explain the user-visible impact, list verification steps, link related issues, and include screenshots for desktop or docs UI changes. Keep diffs reviewable and call out any follow-up work or known gaps.
3758
Branch names should use normal product prefixes such as `fix/xxx`, `feat/xxx`, or `docs/xxx`; do not create `codex/`-prefixed branches in this repository.

‎CONTRIBUTING.md‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Contributing
2+
3+
Thanks for helping improve Claude Code Haha.
4+
5+
For the full contributor guide, including local checks, live model baselines, quality-gate reports, and PR expectations, see:
6+
7+
- Chinese: [docs/guide/contributing.md](docs/guide/contributing.md)
8+
- English: [docs/en/guide/contributing.md](docs/en/guide/contributing.md)
9+
10+
Most contributors should run this before opening a PR:
11+
12+
```bash
13+
bun install
14+
bun run quality:pr
15+
```
16+
17+
If you run adapter or native checks on a fresh clone, install adapter dependencies too:
18+
19+
```bash
20+
cd adapters
21+
bun install
22+
```
23+
24+
If your change touches the desktop chat path, provider/runtime selection, CLI bridge, permissions, tools, file editing, or release packaging, also run a live baseline with your own local model provider:
25+
26+
```bash
27+
bun run quality:providers
28+
bun run quality:gate --mode baseline --allow-live --provider-model <selector>:main
29+
```
30+
31+
Quality reports are written under `artifacts/quality-runs/<timestamp>/`.

‎README.en.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ http://127.0.0.1:2024
195195
|------|------|
196196
| [Environment Variables](docs/en/guide/env-vars.md) | Full env var reference and configuration methods |
197197
| [Third-Party Models](docs/en/guide/third-party-models.md) | Using OpenAI / DeepSeek / Ollama and other non-Anthropic models |
198+
| [Contributing](docs/en/guide/contributing.md) | Local tests, live model baselines, PR gates, and release gates |
198199
| [Memory System](docs/memory/01-usage-guide.md) | Cross-session persistent memory usage and implementation |
199200
| [Multi-Agent System](docs/agent/01-usage-guide.md) | Agent orchestration, parallel tasks and Teams collaboration |
200201
| [Skills System](docs/skills/01-usage-guide.md) | Extensible capability plugins, custom workflows and conditional activation |

‎README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ http://127.0.0.1:2024
195195
|------|------|
196196
| [环境变量](docs/guide/env-vars.md) | 完整环境变量参考和配置方式 |
197197
| [第三方模型](docs/guide/third-party-models.md) | 接入 OpenAI / DeepSeek / Ollama 等非 Anthropic 模型 |
198+
| [贡献与质量门禁](docs/guide/contributing.md) | 本地测试、真实模型 baseline、PR 和 release 门禁 |
198199
| [记忆系统](docs/memory/01-usage-guide.md) | 跨会话持久化记忆的使用与实现 |
199200
| [多 Agent 系统](docs/agent/01-usage-guide.md) | 多代理编排、并行任务执行与 Teams 协作 |
200201
| [Skills 系统](docs/skills/01-usage-guide.md) | 可扩展能力插件、自定义工作流与条件激活 |

‎docs/.vitepress/config.mts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ const zhSidebar = [
2424
{ text: '第三方模型', link: '/guide/third-party-models' },
2525
{ text: '全局使用', link: '/guide/global-usage' },
2626
{ text: '常见问题', link: '/guide/faq' },
27+
{ text: '贡献与质量门禁', link: '/guide/contributing' },
2728
],
2829
},
2930
{
@@ -109,6 +110,7 @@ const enSidebar = [
109110
{ text: 'Third-Party Models', link: '/en/guide/third-party-models' },
110111
{ text: 'Global Usage', link: '/en/guide/global-usage' },
111112
{ text: 'FAQ', link: '/en/guide/faq' },
113+
{ text: 'Contributing', link: '/en/guide/contributing' },
112114
],
113115
},
114116
{

‎docs/en/guide/contributing.md‎

Lines changed: 164 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,164 @@
1+
# Contributing and Local Quality Gates
2+
3+
This guide explains how to install, develop, test, and run the local quality gates before opening a PR. The goal is to help maintainers and contributors answer one question before review: did this change break the core Coding Agent workflow?
4+
5+
## Setup
6+
7+
Install root dependencies with Bun:
8+
9+
```bash
10+
bun install
11+
```
12+
13+
If your change touches `desktop/`, also install desktop dependencies:
14+
15+
```bash
16+
cd desktop
17+
bun install
18+
```
19+
20+
If your change touches `adapters/`, or if you run `check:adapters` / `check:native`, install adapter dependencies:
21+
22+
```bash
23+
cd adapters
24+
bun install
25+
```
26+
27+
Do not commit local artifacts such as `artifacts/quality-runs/`, `node_modules/`, or `desktop/node_modules/`.
28+
29+
## Required PR Gate
30+
31+
Before opening a normal PR, run:
32+
33+
```bash
34+
bun run quality:pr
35+
```
36+
37+
This gate does not call real models, so every contributor can run it locally. It writes reports to:
38+
39+
```text
40+
artifacts/quality-runs/<timestamp>/report.md
41+
artifacts/quality-runs/<timestamp>/report.json
42+
```
43+
44+
Include the commands you ran and the report summary in your PR description.
45+
46+
## Area-Specific Checks
47+
48+
Run the checks that match the files you changed:
49+
50+
```bash
51+
bun run check:server # Server API, WebSocket, providers, sessions, and related tests
52+
bun run check:desktop # Desktop lint, Vitest, and production build
53+
bun run check:adapters # IM adapter tests
54+
bun run check:native # Desktop sidecars and Tauri native checks
55+
bun run check:docs # Docs build, using npm ci + docs:build
56+
```
57+
58+
Focused tests are fine while developing, but run `bun run quality:pr` before sending the PR.
59+
60+
## Live Model Baseline
61+
62+
`quality:baseline` runs real Coding Agent tasks: it starts the local server, creates isolated fixtures, asks a model through chat to fix code, runs tests, and saves transcripts, diffs, verification logs, and a report.
63+
64+
The default baseline command does not call real models:
65+
66+
```bash
67+
bun run quality:baseline
68+
```
69+
70+
To actually call models, pass `--allow-live` and choose a local provider.
71+
72+
First list your local providers and copyable selectors:
73+
74+
```bash
75+
bun run quality:providers
76+
```
77+
78+
Example output:
79+
80+
```text
81+
Saved providers:
82+
MiniMax
83+
selector: minimax
84+
main: MiniMax-M2.7-highspeed
85+
--provider-model minimax:main:minimax-main
86+
```
87+
88+
Copy one of the listed values:
89+
90+
```bash
91+
bun run quality:gate --mode baseline --allow-live --provider-model minimax:main:minimax-main
92+
```
93+
94+
You can run multiple models in one pass:
95+
96+
```bash
97+
bun run quality:gate --mode baseline --allow-live \
98+
--provider-model codingplan:main:codingplan-main \
99+
--provider-model minimax:main:minimax-main
100+
```
101+
102+
Provider selectors come from the providers saved in your local Desktop Settings > Providers page. Contributors do not need the maintainer's provider UUIDs or vendor accounts. They can add their own provider locally, run `bun run quality:providers`, and choose their own model.
103+
104+
## When To Run The Baseline
105+
106+
Run the live baseline for changes touching:
107+
108+
- Desktop chat, session resume, WebSocket, or the CLI bridge
109+
- Provider, model, or runtime selection
110+
- Permissions, tool calls, file edits, and task execution
111+
- agent-browser smoke, Computer Use, Skills, or MCP
112+
- Release preparation or broad cross-module refactors
113+
114+
If you do not have model access, still run `bun run quality:pr` and state in the PR why the live baseline was not run.
115+
116+
## Release Gate
117+
118+
Before a release, run release mode:
119+
120+
```bash
121+
bun run quality:gate --mode release --allow-live --provider-model <selector>:main
122+
```
123+
124+
Release mode composes PR checks, baseline catalog validation, live baseline cases, desktop smoke, and native checks. Reports are written to `artifacts/quality-runs/<timestamp>/`.
125+
126+
## PR Workflow
127+
128+
1. Create a product branch such as `fix/session-reconnect` or `feat/provider-quality-gate`.
129+
2. Install dependencies and make the change.
130+
3. Add tests for behavior changes.
131+
4. Run focused checks for the affected area.
132+
5. Run `bun run quality:pr`.
133+
6. Run the live baseline for high-risk changes.
134+
7. In the PR description, include user impact, verification commands, report summary, and known risks.
135+
136+
## FAQ
137+
138+
### Can I run checks without a provider?
139+
140+
Yes. Run the normal PR gate:
141+
142+
```bash
143+
bun run quality:pr
144+
```
145+
146+
Only the live baseline needs a real model. Add your provider in Desktop Settings > Providers, then run:
147+
148+
```bash
149+
bun run quality:providers
150+
```
151+
152+
### What if provider selectors conflict?
153+
154+
If two provider names produce the same selector, `quality:providers` falls back to the provider ID. Copy the `--provider-model ...` value it prints.
155+
156+
### What if a model ID contains a colon?
157+
158+
Prefer role selectors:
159+
160+
```bash
161+
--provider-model custom:haiku:custom-haiku
162+
```
163+
164+
The runner resolves `haiku` to the real model ID from your local provider configuration.

0 commit comments

Comments
 (0)