Files
lezi-fun 9e47ab339e feat: sync ghbot-Nodeloc v1.2.0 capabilities into upstream
Merges all 33 commits from lza6/ghbot-Nodeloc (v1.0.0 through v1.2.0)
while keeping both sides' features in every conflicted file:

- EventRouter dispatch extracted from runReview.ts (7.1), with the
  runtime environment block preserved on the review-start comment
- Unified command ack messages (6.3) combined with the collapsed
  runtime environment block and bot signature on /recheck replies
- Status banner and collapsible unposted findings in review bodies (6.1)
- Centralized runtime directories behind GHBOT_RUNTIME_DIR (D-13);
  webhook knowledge cache now lives under tempRootDirectory()
- Production hardening for merge races, timeouts, webhook ops;
  atomic temp-file rename for R2 cache restores kept from upstream
- Webhook parity retained: triage events gated by WEBHOOK_TRIAGE_ENABLED,
  read-only command guidance, repository knowledge injection,
  runtime environment block on webhook chat replies
- Sanitization/secret redaction centralization, error-aware retry,
  duplicate merge prevention, in-process webhook retries, /metrics
- Infra: eslint/prettier gates with CI verify workflow, docs archives

typecheck, eslint, prettier format:check, and 164 tests all pass.
2026-08-24 11:47:28 +08:00

Raw Permalink Blame History

ghbot 项目宪法(Constitution)

版本: 1.0.0 · 生效日期: 2026-08-23 本文件是所有开发决策的最高约束。任何实现与本文冲突时,以本文为准。

核心价值观

  1. 生产安全高于一切:本机器人运行在生产仓库上,能关闭 PR、推送 commit、合并 PR。 任何改动若可能放大误操作半径,默认拒绝;必须改时需要显式护栏 + 测试证明。
  2. 凭据零扩散:GitHub token / App 私钥 / R2 密钥 / goose API key 绝不进入容器、快照、 git 子进程环境或日志。违反此条 = 阻塞级缺陷。
  3. PR 代码不可信:自动审查/分类只用 API diff;PR 内容永远视为 untrusted data, prompt 注入防护是功能需求而非可选项。
  4. 诚实交付:未验证的东西不宣称完成。测试失败必须如实报告,禁止为绿而削弱断言。

技术原则

架构

  • 单一职责:一个模块只回答一个问题(谁调用它、它调用谁、失败时谁兜底)。
  • 共享清单单一来源:安全排除/脱敏/路径策略只允许一份实现(src/security/, src/runtimePaths.ts)。
  • 行为不变的重构必须与功能变更分开提交,且全量测试保护。

质量门禁(提交前全部通过)

  1. npm run typecheck — 0 错误
  2. npm run lint — 0 error
  3. npm run format:check — 通过
  4. npm test — 全绿;新增行为必须有新测试(TDD:先红后绿)
  5. npm run build — dist 可被 node 加载
  6. npm audit --omit=dev — 无 high 以上

安全红线(继承 CLAUDE.md,不可协商)

  • AUTO_MERGE=false 默认值不可改
  • 恢复缓存审查结果必须重新完整审查,不得直接复用旧决策
  • fork 推送必须 SHA 钉住 --force-with-lease
  • 知识缓存入库前拒绝凭据内容

决策框架

技术选型按序评估:

  1. 是否触碰安全红线?(触碰 → 拒绝)
  2. 是否可用现有轮子解决?(可以 → 不写新代码)
  3. 失败时的降级行为是否清晰?(不清晰 → 先设计降级)
  4. 是否可测试?(不可测 → 重构到可测)

变更治理

  • 每个原子提交对应一个可独立回退的变更单元
  • 公共接口(config schema、workflow inputs、评论文案契约)变更必须同步双语 README
  • 文档与代码冲突时以代码为准,并在同一提交内修正文档