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:
commit
9e47ab339e
180 files changed
+15130
-1209
No files matched your search
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env node
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { pathToFileURL } = require("url");
|
||||
const { execFileSync } = require("child_process");
|
||||
const dir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
||||
const BAKED =
|
||||
"C:\\Users\\Administrator.DESKTOP-EGNE9ND\\AppData\\Roaming\\npm\\node_modules\\@nanonets\\graft\\dist\\claude";
|
||||
|
||||
// The dist/claude dir of @nanonets/graft resolved from a base whose node_modules is searched.
|
||||
function fromPkg(base) {
|
||||
try {
|
||||
const pkg = require.resolve("@nanonets/graft/package.json", { paths: [base] });
|
||||
return path.join(path.dirname(pkg), "dist", "claude");
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// The global node_modules dir per npm (handles Homebrew/Windows/volta). Queried on demand.
|
||||
function globalRoot() {
|
||||
try {
|
||||
const root = execFileSync("npm", ["root", "-g"], {
|
||||
encoding: "utf8",
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
shell: process.platform === "win32"
|
||||
}).trim();
|
||||
return root || null;
|
||||
} catch {
|
||||
return null; /* npm unavailable */
|
||||
}
|
||||
}
|
||||
|
||||
function candidates() {
|
||||
const out = [];
|
||||
if (BAKED) out.push(BAKED);
|
||||
const local = fromPkg(dir);
|
||||
if (local) out.push(local);
|
||||
const legacy = fromPkg(path.join(path.dirname(process.execPath), "..", "lib"));
|
||||
if (legacy) out.push(legacy);
|
||||
const gr = globalRoot();
|
||||
if (gr) out.push(path.join(gr, "@nanonets", "graft", "dist", "claude"));
|
||||
return out;
|
||||
}
|
||||
|
||||
function entry(name) {
|
||||
for (const d of candidates()) {
|
||||
const f = path.join(d, name);
|
||||
if (fs.existsSync(f)) return f;
|
||||
}
|
||||
return path.join(dir, "dist", "claude", name); // last-ditch; import will no-op if absent
|
||||
}
|
||||
|
||||
import(pathToFileURL(entry("hooks.js")).href)
|
||||
.then((m) => m.main(process.argv[2]))
|
||||
.catch(() => {
|
||||
/* graft unavailable — no-op */
|
||||
});
|
||||
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env node
|
||||
const path = require("path");
|
||||
const fs = require("fs");
|
||||
const { pathToFileURL } = require("url");
|
||||
const { execFileSync } = require("child_process");
|
||||
const dir = process.env.CLAUDE_PROJECT_DIR || process.cwd();
|
||||
const BAKED =
|
||||
"C:\\Users\\Administrator.DESKTOP-EGNE9ND\\AppData\\Roaming\\npm\\node_modules\\@nanonets\\graft\\dist\\claude";
|
||||
|
||||
// The dist/claude dir of @nanonets/graft resolved from a base whose node_modules is searched.
|
||||
function fromPkg(base) {
|
||||
try {
|
||||
const pkg = require.resolve("@nanonets/graft/package.json", { paths: [base] });
|
||||
return path.join(path.dirname(pkg), "dist", "claude");
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// The global node_modules dir per npm (handles Homebrew/Windows/volta). Queried on demand.
|
||||
function globalRoot() {
|
||||
try {
|
||||
const root = execFileSync("npm", ["root", "-g"], {
|
||||
encoding: "utf8",
|
||||
stdio: ["ignore", "pipe", "ignore"],
|
||||
shell: process.platform === "win32"
|
||||
}).trim();
|
||||
return root || null;
|
||||
} catch {
|
||||
return null; /* npm unavailable */
|
||||
}
|
||||
}
|
||||
|
||||
function candidates() {
|
||||
const out = [];
|
||||
if (BAKED) out.push(BAKED);
|
||||
const local = fromPkg(dir);
|
||||
if (local) out.push(local);
|
||||
const legacy = fromPkg(path.join(path.dirname(process.execPath), "..", "lib"));
|
||||
if (legacy) out.push(legacy);
|
||||
const gr = globalRoot();
|
||||
if (gr) out.push(path.join(gr, "@nanonets", "graft", "dist", "claude"));
|
||||
return out;
|
||||
}
|
||||
|
||||
function entry(name) {
|
||||
for (const d of candidates()) {
|
||||
const f = path.join(d, name);
|
||||
if (fs.existsSync(f)) return f;
|
||||
}
|
||||
return path.join(dir, "dist", "claude", name); // last-ditch; import will no-op if absent
|
||||
}
|
||||
|
||||
import(pathToFileURL(entry("statusline.js")).href)
|
||||
.then((m) => m.main())
|
||||
.catch(() => {
|
||||
/* graft unavailable — no-op */
|
||||
});
|
||||
@@ -0,0 +1,71 @@
|
||||
{
|
||||
"statusLine": {
|
||||
"type": "command",
|
||||
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-statusline.cjs\""
|
||||
},
|
||||
"subagentStatusLine": {
|
||||
"type": "command",
|
||||
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-statusline.cjs\""
|
||||
},
|
||||
"hooks": {
|
||||
"PostToolUse": [
|
||||
{
|
||||
"matcher": "Write|Edit|MultiEdit",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" post-edit",
|
||||
"timeout": 10000
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Bash|mcp__graft__",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" tool-savings",
|
||||
"timeout": 8000
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"UserPromptSubmit": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" prompt",
|
||||
"timeout": 15000
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"SessionStart": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" session-start",
|
||||
"timeout": 8000
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"Stop": [
|
||||
{
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "node \"${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/graft-hooks.cjs\" stop",
|
||||
"timeout": 8000
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"footerLinksRegexes": ["graft/[\\w./-]+\\.md"],
|
||||
"permissions": {
|
||||
"allow": ["Bash(graft:*)", "Bash(npx graft:*)", "Bash(graft-dev:*)", "Bash(node dist/cli.js:*)"]
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
name: ghbot-production-hardening
|
||||
description: Production close-out workflow for ghbot: spec, audit, fix P0/P1 guards, gates, webhook HTTP smoke, independent review, docs.
|
||||
metadata:
|
||||
last_verified: "2026-08-23"
|
||||
repo_baseline: "v1.1.0-hardening"
|
||||
---
|
||||
|
||||
# ghbot production hardening skill
|
||||
|
||||
## When to use
|
||||
|
||||
Closing a production iteration of this GitHub review bot. Not for adding unrelated SaaS features.
|
||||
|
||||
## Do not use
|
||||
|
||||
- Changing AUTO_MERGE default
|
||||
- Reusing old review cache as a new-head approval
|
||||
- Running paid LLM E2E without budget
|
||||
- Pushing to remotes without write permission
|
||||
|
||||
## Inputs
|
||||
|
||||
Current repo, CLAUDE.md red lines, `.specify/memory/constitution.md`.
|
||||
|
||||
## Steps
|
||||
|
||||
1. Read constitution, CLAUDE.md, workflow_status.md, last verification record.
|
||||
2. Rebuild facts: git status, typecheck, test.
|
||||
3. Audit contract/security/error/docs before coding.
|
||||
4. Fix P0 then P1 with tests. Skip 1700-line processor extraction unless an event-loop harness exists.
|
||||
5. Gates: typecheck, lint, format:check, test, build, npm audit --omit=dev.
|
||||
6. Webhook HTTP smoke on a spare port: /healthz, HMAC 202, bad sig 401, duplicate, /metrics.
|
||||
7. Independent critic. Repair only confirmed Blocking/Required.
|
||||
8. Sync README/.env.example/workflows. Write HTML report under docs/reports/.
|
||||
|
||||
## Stop
|
||||
|
||||
Missing credentials, origin 403, paid API, production deploy, no progress after two review loops.
|
||||
|
||||
## Verify
|
||||
|
||||
Never claim LLM review E2E or origin push without command evidence.
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../.agents/skills/nodejs-backend-patterns
|
||||
+1
@@ -0,0 +1 @@
|
||||
../../.agents/skills/nodejs-best-practices
|
||||
@@ -0,0 +1 @@
|
||||
../../.agents/skills/typescript-advanced-types
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
../../.agents/skills/zod
|
||||
Reference in new issue
Block a user