📝 Add agent contribution guidelines#2549
Conversation
PR Review — Source: GLM-5.2Risk: LOW — Documentation-only change, 5 files, 0 deletions, no code/test/CI impact. Changes Summary
Fact-checking (verified against the actual repo)
Findings
No issues found
RecommendationAPPROVE (suggest addressing finding 1's version-number example before merge; findings 2/3 are optional). This review was generated by GLM-5.2. |
|
|
||
| 本文档定义了 AI agent(及操作它们的人)在本仓库工作时须遵守的规则——无论您是提交拉取请求,还是在本地协助维护者开发。本文档是对 [贡献指南](CONTRIBUTING-ZH.md) 和 [兼容性政策](COMPATIBILITY_POLICY.md) 的补充,且绝不凌驾于它们之上。 | ||
|
|
||
| dio 是 Dart/Flutter 生态中被依赖最多的包之一。一次草率的改动就可能破坏数以万计的下游项目。在这里贡献不是儿戏:每一个改动都必须有动机、有测试、保持兼容。 |
There was a problem hiding this comment.
中文内的 包 建议都改为 package,
以及建议也对文档进行格式化(断句换行等等)~
AGENTS.md 工作流约束审阅 — 来源:GLM-5.2本评论仅针对 一个 agent 完整工作流的阶段覆盖
缺失项(按重要性排序)1. Commit message 规范 [高] 2. 自审 diff 要求 [高] 3. 回应 review 的工作流 [高]
agent 在 review 迭代阶段的行为完全无约束。 4. 何时停下来问人 [中] 5. CI 失败处理 [中] 6. 性能与安全敏感区域 [中] 7. Draft PR 使用 [低] 8. 依赖变更规则 [低] 9. 调试残留禁止 [低] 10. 分支命名 [低] 冗余项1. §8 与 §1-§5 大面积重复 [主要冗余] §8 "Patterns that may lead to closure" 的 6 条几乎全部是前文的复述:
§8 的价值在于"快速对照表",但当前写法是完整重述而非引用。建议改为:列出模式名 + 一行引用(如 "see §1"),避免规则更新时两处不同步。 2. §1 内部轻微重复 3. §2 "Run the checks locally" 与 "Never state that tests pass without having run them" 结构性观察§4 "Understand before you change" 混了两个关注点:探索理解(read surrounding code, fix root causes, never guess API)和 diff 卫生(keep diffs minimal, no drive-by refactoring)。后者更适合放到 §7(PR hygiene)或独立为"diff discipline"小节,与缺失项 #2(自审 diff)合并。 缺少"执行顺序"指引:8 节内容是规则清单,但没有一条说"你拿到任务后应该按什么顺序做"。agent 需要的是:理解动机 → 探索代码 → 确认方案 → 实现 → 写测试 → 本地验证 → 自审 diff → 更新 changelog → 提交。加一段简短 workflow checklist 会让文档从"规则手册"变成"可执行流程"。 总结
如果要排优先级,最该补的三条:commit message 规范、提交前自审 diff、review 迭代工作流。最该精简的一处:§8 改为引用式速查表。 本审阅意见由 GLM-5.2 生成。 |
|
|
||
| ## 6. 仓库结构与工作流 | ||
|
|
||
| 本项目是使用 [Melos](https://melos.invertase.dev) 管理的单体仓库: |
There was a problem hiding this comment.
|
The #2556 was created by the AGENTS.md , by GLM5.2 and devin agent. |
…ths, expand workflow - Fix deprecation example version (7.0.0 → 6.0.0) to match repo reality - Soften §3 wording to acknowledge dio CHANGELOG's minor-version breaking-change note; require maintainer sign-off + migration entry regardless - Add Windows path and PUB_CACHE env var for pub-cache lookup - ZH: replace ambiguous 「包」 with `package`; switch Melos URL to GitHub docs - Add §6 "When to stop and ask" for ambiguous/out-of-scope work - Expand §8 into subsections: gitmoji + Conventional commit format with reference table, mandatory AI attribution (Co-Authored-By + PR disclosure), CHANGELOG rules, self-review diff before commit, review iteration workflow, truthful PR template - Collapse §9 (patterns that may lead to closure) into a cross-reference table pointing at §1–§8, removing full duplication of rule text - Tighten §1: `Closes #NNNN` alone does not equal prior discussion Co-Authored-By: Claude <noreply@anthropic.com>
… draft-PR guidance - §3: add "Extra scrutiny in security- and network-critical areas" listing SSL/TLS, redirects, cookies, headers, timeout, interceptors, body encoding — sensitive-area changes must call out the touched area and @ a maintainer - §3: add "Dependency changes" rules — no drive-by bumps, state motivation, verify against all supported SDKs, prefer narrowest constraint, disclose new transitives, use `⬆️ chore` - §8.1: new "Branch naming" subsection — enforce `category/ticket-id-or-short-description`, category matches Conventional types, one branch per PR - §8.6: rename to "Opening the PR" and merge in draft-PR guidance (open as draft for large/exploratory changes, convert on ready) - §8: renumber subsections; move Review iteration to §8.7 - §9: update cross-reference table for new numbering; add rows for sensitive-area, drive-by dep bump, and branch naming violations Co-Authored-By: Claude <noreply@anthropic.com>
…an checklist §8.6 (Opening the PR) now asks contributors to state what they actually verified in prose, rather than a "Test plan" ticklist that mixes mechanical prerequisites with behavioral tests. Anything that ought to be verified but could not be goes under an explicit "Unverified" paragraph — surfacing known risk instead of hiding it as an unchecked-with-disclaimer item. Co-Authored-By: Claude <noreply@anthropic.com>

Introduces
AGENTS.md(+ Simplified Chinese mirror) as this repo's rules for AI-agent-assisted contributions, along with pointers fromCONTRIBUTINGand a PR-template checklist item.AGENTS.mdis the de-facto standard filename that agent tools (Claude Code, Codex, Cursor, Devin, etc.) pick up automatically, so agents on external forks get these rules without extra setup.What the guidelines cover
Closes #NNNNalone does not count as prior discussion — the referenced issue must show maintainer buy-in. One PR = one concern.Use XXX instead. This will be removed in 6.0.0(next major); no SDK-lower-bound bumps outside the Compatibility Policy; watch behavioral breaks. Explicit sensitive-area list (SSL/TLS + cert pinning, redirects, cookies, headers, timeout/cancellation/connection pooling, interceptor pipeline, request-body encoding) and dependency-change rules (no drive-by bumps; state motivation; narrowest constraint; disclose new transitives).PUB_CACHEenv var.TODO/mock/simplified-and-called-done code.category/ticket-id-or-short-descriptionCo-Authored-By:trailer; the PR body discloses agent + stage (design / implementation / tests / review)git add ./-AforbiddenUnverifiedparagraphmay/might).Iteration notes
Five commits total. Follow-ups after the initial commit addressed:
PUB_CACHE,「包」 → packagein the Chinese version, mainland-accessible Melos URL, softened minor-version breaking-change wording per dio's own CHANGELOG preamble.@Deprecatedexample's target version (7.0.0→6.0.0to match repo reality); expanded the workflow gaps GLM flagged (commit format, self-review, review iteration, when-to-ask, sensitive areas); collapsed the "patterns that may lead to closure" section from a full restatement of §§1–8 into a cross-reference table.Files
AGENTS.md— English rulesAGENTS-ZH.md— Simplified Chinese mirrorCONTRIBUTING.md/CONTRIBUTING-ZH.md— link to the new guidelines.github/PULL_REQUEST_TEMPLATE.md— checklist item pointing toAGENTS.mdVerification
Documentation change; no code paths to exercise. All internal
§-references were grep-verified for consistency after each renumbering pass. The gitmoji reference table in §8.2 was cross-checked against the last 300 commits (git log --pretty=format:'%s' -300 | grep -oE '^[^A-Za-z0-9 (]+' | sort | uniq -c) to ensure the emojis it endorses match the repo's real usage frequency.New Pull Request Checklist
mainbranch to avoid conflictsCHANGELOG.mdin the corresponding package (not applicable — repository-level docs, no package touched)