# 参与贡献 [English](#contributing) 欢迎提 Issue 和 PR。 ## 先开 Issue 改动较大时(新功能、接入新的 Agent 或聊天平台、改协议),先开一个 Issue 说明想做什么,对齐做法后再动手,免得白做。小的修复可以直接提 PR。 ## 认领 Issue 所有未被认领的 Issue 都可以认领:在 Issue 下评论 `/take`,机器人会把它指派给你。 - 同时最多认领 2 个。 - 认领后 7 天内提 PR(草稿 PR 也行),在 PR 描述里写 `Fixes #<编号>` 关联。到期还没有关联的 PR 会自动释放;还在做的话再评论一次 `/take`,重新计 7 天。 - 不做了评论 `/release`。 ## 设计原则 动手前请对照这几条,审查 PR 时也按它们来。 1. **不破坏用户原有的东西。** 不能直接或间接让用户原来的软件不可用。不写入其他软件的数据目录、数据库和配置,需要时只读。非写不可的,必须用户主动开启,关掉后能清理干净,卸载 Antumi 也不留东西。 2. **少数人用的功能做成插件。** 插件做不到时,core 只开一个窄的、只读的扩展点(比如「会话一轮结束」事件和会话文件的位置),其余放进插件。还没有扩展点的,先做成默认关闭的设置项。 3. **不阻塞 Antumi 的进程。** core 主线程上不做重的同步操作:`node:sqlite` 的调用全是同步的,算大文件哈希、遍历整个库都算重操作,放到子进程或延后做。启动的耗时不能随历史数据增长。 4. **尽量少消耗资源。** 开销只跟这次变化的量成正比,不跟历史总量成正比。不轮询。默认关闭的功能,关着时开销为零。 5. **改动规模和问题的价值相称。** 一个 PR 只做一件事,顺手的改动拆出去。需要几千行去防各种边界情况,说明方案选错了,应该退回去换个简单的做法,而不是继续堆防护。 6. **不改写外部的私有格式。** 外部软件的内部格式(逆向出来的 protobuf、别人的 SQLite 表结构)最多只读,不写也不合成。依赖第三方实现细节的代码,失败时安静地退回原样,不影响主流程。宁可少统计,也不写推算出来的数据。 ## 常见的贡献 - **接入新的 Agent**:按 [接入新的 Agent](docs/ADDING-AN-AGENT.md) 一步步来。 - **任务来源**(GitHub、Jira 之外的系统):写一个插件,不用改 Antumi 源码,见 [任务来源插件](docs/PLUGINS.md)。 - **修 bug、改进功能**:先读 [技术架构](docs/ARCHITECTURE.md) 里相关的一节。进程边界、协议和安全规则写在 [AGENTS.md](AGENTS.md),界面上的颜色、字号和间距按 [DESIGN.md](DESIGN.md)。 ## 从源码运行 需要 Node ≥ 22.13 和 pnpm 12。 ```bash pnpm install ANTUMI_HOME=~/.antumi-dev pnpm dev # 独立实例,不碰 ~/.antumi 里的真实数据 ``` ## 提交前检查 ```bash pnpm typecheck && pnpm test # 改了桌面端再加 pnpm build ``` 新的行为要带测试。改动用户能注意到时,在 `CHANGELOG.md` 的 `## 未发布` 下加一句话(`### 新功能`、`### 改进` 或 `### 修复`),写用户现在能看到或做到什么,规则见 [AGENTS.md](AGENTS.md#changelog)。 ## 提交信息 用精简版的 Angular 格式: ``` (): ``` - **type**:`feat`、`fix`、`refactor`、`perf`、`test`、`docs`、`build` 或 `chore`。 - **scope**:改动所在的包,`protocol`、`core`、`daemon` 或 `desktop`;跨多个包时省略。 - **summary**:英文祈使句,首字母小写,不加句号,72 个字符以内。 - **body**:为什么要改、行为和之前有什么不同。`docs` 和 `chore` 可以省略。 一个提交只做一件事,测试和代码放在同一个提交里。完整规则见 [AGENTS.md](AGENTS.md#commits)。 ## PR 写清楚改了什么、为什么改、怎么验证的。涉及界面的附截图,只在部分平台上测过的注明平台。 --- # Contributing Issues and pull requests are welcome. ## Open an issue first For larger changes (a new feature, a new Agent or chat platform, a protocol change), open an issue describing what you want to do and agree on the approach before you start. Small fixes can go straight to a PR. ## Claiming an issue Any unclaimed issue can be claimed: comment `/take` on it and the bot assigns it to you. - You can hold up to 2 at a time. - Open a PR (a draft is fine) within 7 days and link it with `Fixes #` in its description. A claim with no linked PR by then is released; if you're still on it, comment `/take` again to restart the 7 days. - Comment `/release` to give it back. ## Design principles Check your plan against these before you start; PRs are reviewed against them too. 1. **Never break what the user already has.** Nothing may, directly or indirectly, leave the user's other software unusable. Don't write to another program's data directory, database or config; read it if you must. Where writing is unavoidable, the user turns it on, turning it off cleans up fully, and uninstalling Antumi leaves nothing behind. 2. **Features few people use belong in plugins.** Where a plugin can't do it yet, core opens one narrow, read-only extension point (say, a "turn ended" event with the session file's location) and the rest lives in the plugin. Until that point exists, ship it as a setting that is off by default. 3. **Never block Antumi's processes.** No heavy synchronous work on core's main thread: every `node:sqlite` call is synchronous, and hashing large files or walking a whole database counts as heavy, so move it to a child process or defer it. Startup time must not grow with history. 4. **Use as few resources as possible.** Cost scales with what changed, not with everything there is. No polling. A feature that is off costs nothing. 5. **Keep the change in proportion to the problem.** One PR does one thing; split off anything done in passing. If guarding the edge cases takes thousands of lines, the approach is wrong: step back to a simpler one instead of adding more guards. 6. **Never rewrite another program's private formats.** Another program's internal formats (reverse-engineered protobuf, someone else's SQLite schema) are read-only at most, never written or synthesized. Code relying on a third party's internals fails quietly back to how things were, without touching the main flow. Better to count less than to write estimated data. ## Common contributions - **Adding a new Agent**: follow [Adding a new Agent](docs/ADDING-AN-AGENT.en.md) step by step. - **Task sources** (systems beyond GitHub and Jira): write a plugin, no changes to Antumi's source needed, see [Task source plugins](docs/PLUGINS.md). - **Bug fixes and improvements**: read the relevant section of [Architecture](docs/ARCHITECTURE.md) (Chinese). Process boundaries, protocol and safety rules are in [AGENTS.md](AGENTS.md); colours, type and spacing follow [DESIGN.md](DESIGN.md). ## Running from source You need Node ≥ 22.13 and pnpm 12. ```bash pnpm install ANTUMI_HOME=~/.antumi-dev pnpm dev # a separate instance that leaves ~/.antumi alone ``` ## Before you submit ```bash pnpm typecheck && pnpm test # plus pnpm build for desktop changes ``` New behaviour comes with tests. When users can notice a change, add one sentence under `## 未发布` in `CHANGELOG.md` (`### 新功能` for new features, `### 改进` for improvements, `### 修复` for fixes) on what they can now see or do. Chinese is preferred there, since it becomes the release notes; the maintainers can translate. See [AGENTS.md](AGENTS.md#changelog). ## Commit messages A trimmed version of Angular's format: ``` (): ``` - **type**: `feat`, `fix`, `refactor`, `perf`, `test`, `docs`, `build` or `chore`. - **scope**: the package, `protocol`, `core`, `daemon` or `desktop`; leave it out when the change spans packages. - **summary**: imperative, lowercase first letter, no trailing period, under 72 characters. - **body**: why the change is needed and how behaviour differs from before. Optional for `docs` and `chore`. One self-contained change per commit, with its tests. The full rules are in [AGENTS.md](AGENTS.md#commits). ## Pull requests Say what changed, why, and how you verified it. Add screenshots for interface changes, and name the platforms you tested if not all.