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.
This commit is contained in:
lezi-fun committed 2026-08-24 11:47:28 +08:00
commit 9e47ab339e
180 files changed
+15130 -1209

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
#!/usr/bin/env node
/**
* Windows 兼容的 pre-commit 钩子安装器(不使用 .sh 业务脚本)。
* 钩子内部用仓库相对路径调用 Node 脚本,避免绝对路径中的空格/中文目录问题。
*/
"use strict";
const fs = require("node:fs");
const path = require("node:path");
const root = path.resolve(__dirname, "..");
const gitDir = path.join(root, ".git");
const hooksDir = path.join(gitDir, "hooks");
const hookPath = path.join(hooksDir, "pre-commit");
if (!fs.existsSync(gitDir)) {
console.warn("[install-husky] 未找到 .git 目录(例如在 CI 中),跳过 pre-commit 钩子安装。");
process.exit(0);
}
fs.mkdirSync(hooksDir, { recursive: true });
// git hooks 以仓库根为工作目录,相对路径在 Windows 与 POSIX 下都可靠。
const hookScript = ["#!/bin/sh", "node scripts/husky-pre-commit.cjs"].join("\n");
fs.writeFileSync(hookPath, `${hookScript}\n`, { mode: 0o755 });
console.log(`[install-husky] 已写入 git pre-commit 钩子: ${hookPath}`);