Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

Apply review

Jonathan ARNAULTc58b140e69bf
diff --git a/.claude/hooks/block-migration-writes.mjs b/.claude/hooks/block-migration-writes.mjs
index 7a754ca8..1a028046 100755
--- a/.claude/hooks/block-migration-writes.mjs
+++ b/.claude/hooks/block-migration-writes.mjs
@@ -22,13 +22,13 @@ const RULES = [
blocked: isPendingMigration(filePath),
tag: "pending-folder",
reason:
- "supabase/migrations-pending/ was removed by the deferred-migration design (spec 2026-05-27). Migrations live in supabase/migrations/ and are written only by simple-developer in MIGRATION MODE.",
+ "Writing to supabase/migrations-pending/ is not allowed. Migrations live in supabase/migrations/ and are written only by simple-developer in MIGRATION MODE.",
},
{
blocked: baseAgent === "developer" && isMigration(filePath),
tag: "developer-migration",
reason:
- "developer agent is forbidden from writing SQL migrations (see agents/developer.md, deferred-migration design). Migrations are generated at deploy time by the PD-MIG round (simple-developer in MIGRATION MODE) from the session-branch diff.",
+ "The developer agent is not allowed to write SQL migrations. Only simple-developer in MIGRATION MODE may do so.",
},
];
diff --git a/.claude/hooks/block-orchestrator-merge.mjs b/.claude/hooks/block-orchestrator-merge.mjs
new file mode 100755
index 00000000..9ae172ec
--- /dev/null
+++ b/.claude/hooks/block-orchestrator-merge.mjs
@@ -0,0 +1,52 @@
+#!/usr/bin/env node
+// PreToolUse(Bash) — block the main orchestrator session from running merge-class
+// git commands. Only the dispatched `merger` agent may merge; if the orchestrator
+// falls back to merging itself, the team workflow looks healthy but is silently
+// broken (the dev↔merger path is dead). The behavioral rule lives in
+// chat-orchestrator.md ("NEVER act as merger yourself"); this is the runtime guard.
+//
+// OPT-IN: inert unless ATOMIC_CRM_ENFORCE_MERGE_GUARD=1. In a plain Claude Code
+// checkout the main session is a general assistant, and blocking its git
+// merge/pull/checkout would break normal use — so it stays off until the
+// orchestrator explicitly enables it before a team wave.
+
+import { readFileSync } from "node:fs";
+import { createHookContext } from "./lib/context.mjs";
+
+if (process.env.ATOMIC_CRM_ENFORCE_MERGE_GUARD !== "1") process.exit(0);
+
+const input = JSON.parse(readFileSync(0, "utf8"));
+const ctx = createHookContext(input, "block-orchestrator-merge");
+
+// Only block the main orchestrator session (agent_type empty). Dispatched
+// subagents (merger, developer, …) are allowed.
+const agent = input.agent_type || "";
+if (agent) process.exit(0);
+
+const cmd = input.tool_input?.command || "";
+if (!cmd) process.exit(0);
+
+let blocked = "";
+if (/(^|[;&|\s])git\s+merge(\s|$)/.test(cmd)) blocked = "git merge";
+else if (/(^|[;&|\s])git\s+checkout\s+(master|main)(\s|$)/.test(cmd))
+ blocked = "git checkout master/main";
+else if (/(^|[;&|\s])git\s+pull(\s|$)/.test(cmd)) blocked = "git pull";
+else if (/(^|[;&|\s])git\s+worktree\s+remove(\s|$)/.test(cmd))
+ blocked = "git worktree remove";
+else if (/apply-app-variant\.sh/.test(cmd))
+ blocked = "apply-app-variant.sh (merger-only command)";
+
+if (blocked) {
+ ctx.fail(
+ `Blocked: orchestrator attempted to run "${blocked}".\n\n` +
+ "Rule: chat-orchestrator must NEVER act as merger. Only the dispatched `merger`\n" +
+ 'agent runs merge-class git commands. See chat-orchestrator.md "NEVER act as merger yourself".\n\n' +
+ "If you got here because the merger didn't report back, the team communication broke —\n" +
+ "the dev's \"ready\" message never reached the merger. Don't salvage by merging yourself;\n" +
+ "report the failure to the user and stop. Salvaging hides the bug.\n\n" +
+ `Blocked command:\n ${cmd}`,
+ { log: `BLOCK ${blocked}` },
+ );
+}
+
+process.exit(0);
diff --git a/.claude/hooks/circuit-breaker.mjs b/.claude/hooks/circuit-breaker.mjs
new file mode 100755
index 00000000..50ba6cdc
--- /dev/null
+++ b/.claude/hooks/circuit-breaker.mjs
@@ -0,0 +1,76 @@
+#!/usr/bin/env node
+// PreToolUse(Bash) — per-subagent circuit breaker. Counts Bash calls per subagent
+// (keyed on agent_id, present only for subagents) and blocks once a subagent
+// exceeds the loop limit, so a stuck agent can't spin forever. The main session
+// (no agent_id) is never throttled — interactive sessions legitimately make many
+// Bash calls.
+
+import {
+ existsSync,
+ mkdirSync,
+ readFileSync,
+ writeFileSync,
+ statSync,
+ unlinkSync,
+} from "node:fs";
+import { join } from "node:path";
+import { createHash } from "node:crypto";
+import { createHookContext } from "./lib/context.mjs";
+import { TMP_ROOT } from "./lib/paths.mjs";
+
+// Per-subagent Bash budget. A developer's legitimate Bash usage is worktree setup
+// + git add/commit/status + exploration + fix retries (~15-20 calls). 45 is
+// comfortable for that workload and catches infinite loops (which hit 100+ fast).
+const ITERATION_LIMIT = 45;
+
+const input = JSON.parse(readFileSync(0, "utf8"));
+const ctx = createHookContext(input, "circuit-breaker");
+
+// Per-subagent breaker only. The main session (no agent_id) is never throttled.
+if (!ctx.agentId) process.exit(0);
+
+const key = `sub-${ctx.agentId}`;
+const keyHash = createHash("sha1").update(key).digest("hex").slice(0, 16);
+
+let counterDir = join(ctx.sessionDir, "breaker");
+try {
+ mkdirSync(counterDir, { recursive: true });
+} catch {
+ counterDir = TMP_ROOT;
+}
+const counterFile = join(counterDir, `bash-count-${keyHash}`);
+
+// Auto-reset if the counter file is older than 1 hour (stale subagent).
+if (existsSync(counterFile)) {
+ try {
+ const ageMs = Date.now() - statSync(counterFile).mtimeMs;
+ if (ageMs > 60 * 60 * 1000) unlinkSync(counterFile);
+ } catch {
+ // ignore
+ }
+}
+
+let count = 0;
+try {
+ count = parseInt(readFileSync(counterFile, "utf8"), 10) || 0;
+} catch {
+ count = 0;
+}
+count += 1;
+try {
+ writeFileSync(counterFile, String(count));
+} catch {
+ // ignore
+}
+
+// Observability: record the keyed count so per-agent budgets can be audited.
+ctx.log(`key=${key} hash=${keyHash} count=${count}`);
+
+if (count > ITERATION_LIMIT) {
+ ctx.block({
+ reason: `Circuit breaker: this subagent has made ${count} Bash calls — likely stuck in a loop. Stop, and report where you are blocked so the orchestrator can re-dispatch with a fresh context.`,
+ log: `BLOCK count=${count}`,
+ });
+}
+
+process.exit(0);
diff --git a/.claude/hooks/member-idle-gate.mjs b/.claude/hooks/member-idle-gate.mjs
new file mode 100755
index 00000000..e20a75a1
--- /dev/null
+++ b/.claude/hooks/member-idle-gate.mjs
@@ -0,0 +1,147 @@
+#!/usr/bin/env node
+// PreToolUse(Bash|Read|Grep|Glob|SendMessage) — prevent quality-reviewer-*,
+// test-validator-* and merger-* from using any tool before the developer has sent
+// them a "ready for review" message.
+//
+// Rationale: reviewers are dispatched simultaneously with the developer. Without
+// this gate they read an empty worktree and send unsolicited "nothing to review"
+// messages, confusing the developer and breaking the review loop.
+//
+// Signal: a flag file written by validate-before-review.mjs when the developer
+// validates and messages the reviewer/merger. Flags live under <sessionDir>/flags
+// (session-scoped, so a stale flag from a prior session never unblocks a reviewer):
+// notified-qr-TASK-XXX (quality-reviewer-TASK-XXX)
+// notified-tv-TASK-XXX (test-validator-TASK-XXX)
+// notified-merger-TASK-XXX / notified-merger-simple (merger)
+
+import {
+ existsSync,
+ mkdirSync,
+ readdirSync,
+ readFileSync,
+ writeFileSync,
+} from "node:fs";
+import { join } from "node:path";
+import { createHookContext } from "./lib/context.mjs";
+import {
+ getFirstTaskId,
+ isMerger,
+ isQualityReviewer,
+ isTestValidator,
+} from "./lib/teams.mjs";
+import { simpleWorktreePath } from "./lib/topology.mjs";
+
+const input = JSON.parse(readFileSync(0, "utf8"));
+const ctx = createHookContext(input, "member-idle-gate");
+
+// The runtime carries the agent's (possibly TASK-suffixed) identity in either
+// agentName or agentType depending on context — check both.
+const names = [ctx.agentName, ctx.agentType].filter(Boolean);
+const isRole = (pred) => names.some(pred);
+
+let gateType;
+if (isRole(isQualityReviewer)) gateType = "qr";
+else if (isRole(isTestValidator)) gateType = "tv";
+else if (isRole(isMerger)) gateType = "merger";
+else process.exit(0);
+
+const flagsDir = join(ctx.sessionDir, "flags");
+const toolInput = input.tool_input || {};
+const toolInputStr = JSON.stringify(toolInput);
+const simpleWt = simpleWorktreePath(ctx);
+
+// Extract TASK_ID from the agent name first, then from tool_input fields.
+let taskId = "";
+for (const n of names) {
+ const m = getFirstTaskId(n);
+ if (m) {
+ taskId = m;
+ break;
+ }
+}
+if (!taskId) {
+ const candidates = [
+ toolInput.file_path,
+ toolInput.command,
+ toolInput.path,
+ toolInput.to,
+ toolInput.message,
+ toolInputStr,
+ ];
+ for (const s of candidates) {
+ const m = getFirstTaskId(s);
+ if (m) {
+ taskId = m;
+ break;
+ }
+ }
+}
+
+const touch = (path) => {
+ try {
+ mkdirSync(flagsDir, { recursive: true });
+ writeFileSync(path, "");
+ } catch {
+ // best-effort
+ }
+};
+
+if (!taskId) {
+ // Merger special cases.
+ if (gateType === "merger") {
+ let mergerFlag = "";
+ try {
+ mergerFlag =
+ readdirSync(flagsDir).find((f) => f.startsWith("notified-merger-")) ||
+ "";
+ } catch {
+ mergerFlag = "";
+ }
+ if (mergerFlag) {
+ ctx.log(
+ `PASS agent=${names.join("/")} task=any (session merger flag: ${mergerFlag})`,
+ );
+ process.exit(0);
+ }
+ // SIMPLE flow: orchestrator dispatches merger directly (no SendMessage, no
+ // validate-before-review) so no merger flag is ever written. Detect by the
+ // SIMPLE worktree path in tool_input.
+ if (toolInputStr.includes(simpleWt)) {
+ touch(join(flagsDir, "notified-merger-simple"));
+ ctx.log(`PASS agent=${names.join("/")} task=simple (SIMPLE flow)`);
+ process.exit(0);
+ }
+ }
+ // Migration-round reviewer bypass: a quality-reviewer on the migration worktree
+ // is dispatched sequentially AFTER the SQL is written — no empty-worktree race.
+ if (gateType === "qr" && toolInputStr.includes(simpleWt)) {
+ ctx.log(
+ `PASS agent=${names.join("/")} task=migration (migration-review bypass)`,
+ );
+ process.exit(0);
+ }
+ // No TASK_ID anywhere — block conservatively.
+ ctx.fail(
+ `Cannot determine TASK_ID for agent '${names.join("/")}'.\n` +
+ 'Do NOT call any tool until you receive the developer\'s "ready for review" SendMessage.',
+ { log: `BLOCK-NOTASK gate=${gateType}` },
+ );
+}
+
+const flag = {
+ qr: join(flagsDir, `notified-qr-${taskId}`),
+ tv: join(flagsDir, `notified-tv-${taskId}`),
+ merger: join(flagsDir, `notified-merger-${taskId}`),
+}[gateType];
+
+if (!existsSync(flag)) {
+ ctx.fail(
+ `Your flag (${flag}) does not exist yet.\n` +
+ 'The developer has not sent you a "ready for review" message.\n' +
+ "Do NOT call any tool (Read, Bash, Grep, SendMessage…). Idle until the developer's first SendMessage.",
+ { log: `BLOCK task=${taskId} flag=${flag} not found` },
+ );
+}
+
+ctx.log(`PASS agent=${names.join("/")} task=${taskId}`);
+process.exit(0);
diff --git a/.claude/hooks/teamdelete-cleanup.mjs b/.claude/hooks/teamdelete-cleanup.mjs
new file mode 100755
index 00000000..22af8cd3
--- /dev/null
+++ b/.claude/hooks/teamdelete-cleanup.mjs
@@ -0,0 +1,56 @@
+#!/usr/bin/env node
+// PostToolUse(TeamDelete) — remove residual team disk artifacts after a successful
+// TeamDelete, so stale ~/.claude/teams/<team>/ directories don't accumulate.
+//
+// Disk-cleanup only. The old STATE-DONE anti-loop flag is intentionally gone: its
+// only reader was teamdelete-gate.mjs, removed in the native-Teams model (TeamDelete
+// errors when members are still busy, so the orchestrator no longer loops here).
+//
+// Always exits 0 — this hook is informational and never blocks.
+// Safety: the team_name is validated (alphanumeric/dash/underscore) and the target
+// path is asserted to live strictly under TEAMS_DIR, blocking path traversal.
+
+import { existsSync, readFileSync, rmSync } from "node:fs";
+import { join } from "node:path";
+import { createHookContext } from "./lib/context.mjs";
+import { TEAMS_DIR } from "./lib/paths.mjs";
+import { isValidTeamName } from "./lib/teams.mjs";
+
+const stdin = readFileSync(0, "utf8");
+if (!stdin) process.exit(0);
+const input = JSON.parse(stdin);
+const ctx = createHookContext(input, "teamdelete-cleanup");
+
+if (input.tool_response?.success !== true) {
+ ctx.log("SKIP non-success");
+ process.exit(0);
+}
+
+const teamName =
+ input.tool_response?.team_name || input.tool_input?.team_name || "";
+if (!teamName) {
+ ctx.log("SKIP no team_name");
+ process.exit(0);
+}
+
+if (!isValidTeamName(teamName)) {
+ ctx.log(`REFUSE invalid team_name=${teamName}`);
+ process.exit(0);
+}
+
+const target = join(TEAMS_DIR, teamName);
+
+// Defensive: only delete if the path is exactly under TEAMS_DIR.
+if (!target.startsWith(TEAMS_DIR + "/")) {
+ ctx.log(`REFUSE path outside teams dir: ${target}`);
+ process.exit(0);
+}
+
+if (existsSync(target)) {
+ rmSync(target, { recursive: true, force: true });
+ ctx.log(`REMOVED ${target}`);
+} else {
+ ctx.log(`NOOP ${target} (not present)`);
+}
+
+process.exit(0);
diff --git a/.claude/hooks/test/circuit-breaker.test.mjs b/.claude/hooks/test/circuit-breaker.test.mjs
new file mode 100644
index 00000000..c537142e
--- /dev/null
+++ b/.claude/hooks/test/circuit-breaker.test.mjs
@@ -0,0 +1,64 @@
+// Tests for circuit-breaker.mjs — per-subagent Bash counter. Blocks are decision
+// JSON on stdout with exit 0; the main session (no agent_id) is never throttled.
+
+import { mkdtempSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { spawnSync } from "node:child_process";
+import { afterAll, describe, test, expect } from "vitest";
+
+const HERE = dirname(fileURLToPath(import.meta.url));
+const HOOK = join(HERE, "..", "circuit-breaker.mjs");
+
+const tmpRoot = mkdtempSync(join(tmpdir(), "circuit-breaker-tmp-"));
+const appDir = mkdtempSync(join(tmpdir(), "circuit-breaker-app-"));
+
+afterAll(() => {
+ rmSync(tmpRoot, { recursive: true, force: true });
+ rmSync(appDir, { recursive: true, force: true });
+});
+
+// agentId controls the per-subagent counter file; vary it per test for isolation.
+const runHook = (agentId, sessionId = "cb-1234") => {
+ const env = { ...process.env, CRM_TMP_ROOT: tmpRoot, APP_DIR: appDir };
+ delete env.CLAUDE_AGENT_NAME;
+ const payload = {
+ tool_name: "Bash",
+ session_id: sessionId,
+ tool_input: { command: "ls" },
+ };
+ if (agentId) payload.agent_id = agentId;
+ return spawnSync("node", [HOOK], {
+ input: JSON.stringify(payload),
+ env,
+ encoding: "utf8",
+ });
+};
+
+const isBlocked = (r) => r.stdout.includes('"decision":"block"');
+
+describe("circuit-breaker hook", () => {
+ test("main session (no agent_id) is never throttled", () => {
+ let last;
+ for (let i = 0; i < 60; i++) last = runHook("");
+ expect(last.status).toBe(0);
+ expect(isBlocked(last)).toBe(false);
+ });
+
+ test("subagent is blocked once it exceeds the iteration limit", () => {
+ let r;
+ for (let i = 1; i <= 45; i++) r = runHook("agent-loop");
+ expect(isBlocked(r)).toBe(false); // 45th call still allowed
+ const blocked = runHook("agent-loop"); // 46th
+ expect(blocked.status).toBe(0);
+ expect(isBlocked(blocked)).toBe(true);
+ expect(blocked.stdout).toContain("stuck in a loop");
+ });
+
+ test("each subagent has an independent budget", () => {
+ for (let i = 1; i <= 46; i++) runHook("agent-busy");
+ const otherAgent = runHook("agent-fresh");
+ expect(isBlocked(otherAgent)).toBe(false);
+ });
+});
diff --git a/.claude/hooks/test/member-idle-gate.test.mjs b/.claude/hooks/test/member-idle-gate.test.mjs
new file mode 100644
index 00000000..96718892
--- /dev/null
+++ b/.claude/hooks/test/member-idle-gate.test.mjs
@@ -0,0 +1,102 @@
+// Tests for member-idle-gate.mjs — gates quality-reviewer-*, test-validator-* and
+// merger-* until the developer's "ready" flag exists. Blocks are exit 2 + stderr
+// (ctx.fail); passes are exit 0. Flags live under <sessionDir>/flags, where
+// sessionDir = <CRM_TMP_ROOT>/<sanitized APP_DIR>/<session_id>.
+
+import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { spawnSync } from "node:child_process";
+import { afterAll, beforeEach, describe, test, expect } from "vitest";
+
+const HERE = dirname(fileURLToPath(import.meta.url));
+const HOOK = join(HERE, "..", "member-idle-gate.mjs");
+
+const tmpRoot = mkdtempSync(join(tmpdir(), "idle-gate-tmp-"));
+const appDir = mkdtempSync(join(tmpdir(), "idle-gate-app-"));
+const SESSION = "idle-1234";
+
+const sanitize = (p) => p.replace(/\//g, "_");
+const flagsDir = join(tmpRoot, sanitize(appDir), SESSION, "flags");
+
+afterAll(() => {
+ rmSync(tmpRoot, { recursive: true, force: true });
+ rmSync(appDir, { recursive: true, force: true });
+});
+
+beforeEach(() => {
+ rmSync(flagsDir, { recursive: true, force: true });
+});
+
+const writeFlag = (name) => {
+ mkdirSync(flagsDir, { recursive: true });
+ writeFileSync(join(flagsDir, name), "");
+};
+
+const runHook = (
+ agentType,
+ toolName = "Read",
+ toolInput = { file_path: "/x" },
+) => {
+ const env = { ...process.env, CRM_TMP_ROOT: tmpRoot, APP_DIR: appDir };
+ delete env.CLAUDE_AGENT_NAME;
+ const payload = {
+ tool_name: toolName,
+ agent_type: agentType,
+ session_id: SESSION,
+ tool_input: toolInput,
+ };
+ return spawnSync("node", [HOOK], {
+ input: JSON.stringify(payload),
+ env,
+ encoding: "utf8",
+ });
+};
+
+describe("member-idle-gate hook", () => {
+ test("quality-reviewer without its flag is blocked", () => {
+ const r = runHook("quality-reviewer-TASK-007");
+ expect(r.status).toBe(2);
+ expect(r.stderr).toContain("notified-qr-TASK-007");
+ });
+
+ test("quality-reviewer with its flag is allowed", () => {
+ writeFlag("notified-qr-TASK-007");
+ const r = runHook("quality-reviewer-TASK-007");
+ expect(r.status).toBe(0);
+ });
+
+ test("test-validator without its flag is blocked", () => {
+ const r = runHook("test-validator-TASK-008");
+ expect(r.status).toBe(2);
+ });
+
+ test("test-validator with its flag is allowed", () => {
+ writeFlag("notified-tv-TASK-008");
+ const r = runHook("test-validator-TASK-008");
+ expect(r.status).toBe(0);
+ });
+
+ test("merger with its task flag is allowed", () => {
+ writeFlag("notified-merger-TASK-009");
+ const r = runHook("merger-TASK-009", "Bash", { command: "git merge" });
+ expect(r.status).toBe(0);
+ });
+
+ test("non-reviewer agent (developer) passes through immediately", () => {
+ const r = runHook("developer-TASK-007", "Bash", { command: "ls" });
+ expect(r.status).toBe(0);
+ });
+
+ test("main session (no agent_type) passes through", () => {
+ const r = runHook("", "Bash", { command: "ls" });
+ expect(r.status).toBe(0);
+ });
+
+ test("reviewer with no resolvable TASK_ID is blocked conservatively", () => {
+ const r = runHook("quality-reviewer", "Bash", { command: "ls" });
+ expect(r.status).toBe(2);
+ expect(r.stderr).toContain("TASK_ID");
+ });
+});
diff --git a/.claude/hooks/test/teamdelete-cleanup.test.mjs b/.claude/hooks/test/teamdelete-cleanup.test.mjs
new file mode 100644
index 00000000..018cd5bb
--- /dev/null
+++ b/.claude/hooks/test/teamdelete-cleanup.test.mjs
@@ -0,0 +1,98 @@
+// Tests for teamdelete-cleanup.mjs — PostToolUse(TeamDelete) disk cleanup. Removes
+// <TEAMS_DIR>/<team_name> on success; always exits 0. TEAMS_DIR is derived from
+// CLAUDE_CONFIG_DIR (<config>/teams), which the test points at a sandbox.
+
+import {
+ existsSync,
+ mkdirSync,
+ mkdtempSync,
+ rmSync,
+ writeFileSync,
+} from "node:fs";
+import { tmpdir } from "node:os";
+import { dirname, join } from "node:path";
+import { fileURLToPath } from "node:url";
+import { spawnSync } from "node:child_process";
+import { afterEach, beforeEach, describe, test, expect } from "vitest";
+
+const HERE = dirname(fileURLToPath(import.meta.url));
+const HOOK = join(HERE, "..", "teamdelete-cleanup.mjs");
+
+let configDir;
+let teamsDir;
+
+beforeEach(() => {
+ configDir = mkdtempSync(join(tmpdir(), "td-cleanup-cfg-"));
+ teamsDir = join(configDir, "teams");
+ mkdirSync(teamsDir, { recursive: true });
+});
+
+afterEach(() => {
+ rmSync(configDir, { recursive: true, force: true });
+});
+
+const makeTeamDir = (name) => {
+ const dir = join(teamsDir, name);
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(join(dir, "config.json"), "{}");
+ return dir;
+};
+
+const runHook = (payload) => {
+ const env = { ...process.env, CLAUDE_CONFIG_DIR: configDir };
+ delete env.CLAUDE_AGENT_NAME;
+ return spawnSync("node", [HOOK], {
+ input: JSON.stringify(payload),
+ env,
+ encoding: "utf8",
+ });
+};
+
+describe("teamdelete-cleanup hook", () => {
+ test("removes the team directory on a successful delete", () => {
+ const dir = makeTeamDir("tickets-abc123");
+ const r = runHook({
+ tool_name: "TeamDelete",
+ session_id: "td-1",
+ tool_input: { team_name: "tickets-abc123" },
+ tool_response: { success: true, team_name: "tickets-abc123" },
+ });
+ expect(r.status).toBe(0);
+ expect(existsSync(dir)).toBe(false);
+ });
+
+ test("keeps the directory when the delete was not successful", () => {
+ const dir = makeTeamDir("tickets-keep");
+ const r = runHook({
+ tool_name: "TeamDelete",
+ session_id: "td-2",
+ tool_input: { team_name: "tickets-keep" },
+ tool_response: { success: false },
+ });
+ expect(r.status).toBe(0);
+ expect(existsSync(dir)).toBe(true);
+ });
+
+ test("refuses path-traversal team names and removes nothing", () => {
+ const sibling = join(configDir, "secret");
+ mkdirSync(sibling, { recursive: true });
+ const r = runHook({
+ tool_name: "TeamDelete",
+ session_id: "td-3",
+ tool_input: { team_name: "../secret" },
+ tool_response: { success: true, team_name: "../secret" },
+ });
+ expect(r.status).toBe(0);
+ expect(existsSync(sibling)).toBe(true);
+ });
+
+ test("no-op (still exit 0) when the team directory is already gone", () => {
+ const r = runHook({
+ tool_name: "TeamDelete",
+ session_id: "td-4",
+ tool_input: { team_name: "tickets-absent" },
+ tool_response: { success: true, team_name: "tickets-absent" },
+ });
+ expect(r.status).toBe(0);
+ });
+});
diff --git a/.claude/hooks/validate-before-review.mjs b/.claude/hooks/validate-before-review.mjs
index 110b13ea..1ba49fb4 100755
--- a/.claude/hooks/validate-before-review.mjs
+++ b/.claude/hooks/validate-before-review.mjs
@@ -1,7 +1,7 @@
#!/usr/bin/env node
// PreToolUse(SendMessage) — when a developer messages a reviewer/merger, run the validation chain (prettier auto-fix, typecheck, unit-app, unit-functions, e2e) on the caller's worktree; exit 2 blocks the SendMessage on failure. A per-worktree SHA cache short-circuits repeats. VALIDATE_DRY_RUN=1 skips the chain; =fail simulates a failure.
-import { readFileSync, unlinkSync, writeFileSync } from "node:fs";
+import { mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
import { join } from "node:path";
import { createHookContext } from "./lib/context.mjs";
import { stringifyMessage } from "./lib/io.mjs";
@@ -62,9 +62,7 @@ if (!stdin) finish(0);
const { agentName, agentType } = ctx;
const to = input.tool_input?.to || "";
-ctx.log(
- `INVOKE agent_env='${agentName}' agent_type='${agentType}' to='${to}'`,
-);
+ctx.log(`INVOKE agent_env='${agentName}' agent_type='${agentType}' to='${to}'`);
const callerIsDeveloper = isDeveloper(agentName) || isDeveloper(agentType);
if (!callerIsDeveloper) finish(0);
@@ -78,12 +76,34 @@ const taskId = getFirstTaskId(to) || getFirstTaskId(msgBody);
const validateWorktree = taskId ? taskWorktreePath(ctx, taskId) : "";
logWt = validateWorktree;
+// Open the member-idle-gate for the recipient: the developer has validated and is
+// messaging them, so they may start working. Flag read by member-idle-gate.mjs.
+const openGate = () => {
+ const role = isQualityReviewer(to)
+ ? "qr"
+ : isTestValidator(to)
+ ? "tv"
+ : isMerger(to)
+ ? "merger"
+ : "";
+ if (!role || !taskId) return;
+ const flagsDir = join(ctx.sessionDir, "flags");
+ try {
+ mkdirSync(flagsDir, { recursive: true });
+ writeFileSync(join(flagsDir, `notified-${role}-${taskId}`), "");
+ ctx.log(`NOTIFY ${role} task=${taskId}`);
+ } catch {
+ // best-effort
+ }
+};
+
// Same scope as the validation chain: the task worktree when the task id is
// known, otherwise all session worktrees.
const cacheWorktrees = getActiveWorktrees(ctx, validateWorktree);
if (allAtCachedSha(cacheWorktrees, ".sha")) {
ctx.log(`CACHE HIT to=${to} (worktree at last-validated SHA)`);
+ openGate();
finish(0);
}
@@ -126,4 +146,5 @@ if (!result.skipReason) {
}
}
+openGate();
finish(0);
diff --git a/.claude/settings.json b/.claude/settings.json
index 5999b24c..cc9dbb34 100644
--- a/.claude/settings.json
+++ b/.claude/settings.json
@@ -25,6 +25,15 @@
},
"hooks": {
"PreToolUse": [
+ {
+ "matcher": "Bash|Read|Grep|Glob|SendMessage",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/member-idle-gate.mjs"
+ }
+ ]
+ },
{
"matcher": "Bash",
"hooks": [
@@ -32,6 +41,14 @@
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/bash-guard.mjs"
},
+ {
+ "type": "command",
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/circuit-breaker.mjs"
+ },
+ {
+ "type": "command",
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/block-orchestrator-merge.mjs"
+ },
{
"type": "command",
"command": "$CLAUDE_PROJECT_DIR/.claude/hooks/restrict-documentator-bash.mjs"
@@ -67,6 +84,17 @@
]
}
],
+ "PostToolUse": [
+ {
+ "matcher": "TeamDelete",
+ "hooks": [
+ {
+ "type": "command",
+ "command": "$CLAUDE_PROJECT_DIR/.claude/hooks/teamdelete-cleanup.mjs"
+ }
+ ]
+ }
+ ],
"SubagentStart": [
{
"matcher": "simple-developer|developer",
diff --git a/.husky/pre-commit b/.husky/pre-commit
index 1303a4af..989c3d0b 100644
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1 +1,3 @@
-make registry-gen
\ No newline at end of file
+make registry-gen
+npx lint-staged
+git update-index --again
diff --git a/.lintstagedrc b/.lintstagedrc
index 50208c8d..27b15a08 100644
--- a/.lintstagedrc
+++ b/.lintstagedrc
@@ -1,10 +1,8 @@
{
- "*.{js,jsx,ts,tsx}": [
- "eslint --fix",
- "git add"
- ],
- "*.{json,css,md}": [
- "prettier",
- "git add"
- ]
-}
\ No newline at end of file
+ "*.{mjs,ts,tsx}": [
+ "eslint --fix"
+ ],
+ "*.{mjs,js,json,ts,tsx,css,md,html}": [
+ "prettier --config ./.prettierrc.json --write --list-different"
+ ]
+}
diff --git a/package-lock.json b/package-lock.json
index 87463ad2..0b935419 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -102,6 +102,7 @@
"glob": "^11.1.0",
"globals": "^16.3.0",
"husky": "^9.1.7",
+ "lint-staged": "^17.0.7",
"pgsql-ast-parser": "^12.0.2",
"playwright": "^1.60.0",
"prettier": "^3.6.2",
@@ -8711,6 +8712,22 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/ansi-escapes": {
+ "version": "7.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-7.3.0.tgz",
+ "integrity": "sha512-BvU8nYgGQBxcmMuEeUEmNTvrMVjJNSH7RgW24vXexN4Ven6qCvy4TntnvlnwnMLTVlcRQQdbRY8NKnaIoeWDNg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "environment": "^1.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/ansi-regex": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz",
@@ -9240,6 +9257,69 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/cli-truncate": {
+ "version": "5.2.0",
+ "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-5.2.0.tgz",
+ "integrity": "sha512-xRwvIOMGrfOAnM1JYtqQImuaNtDEv9v6oIYAs4LIHwTiKee8uwvIi363igssOC0O5U04i4AlENs79LQLu9tEMw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "slice-ansi": "^8.0.0",
+ "string-width": "^8.2.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/cli-truncate/node_modules/ansi-regex": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
+ }
+ },
+ "node_modules/cli-truncate/node_modules/string-width": {
+ "version": "8.2.1",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.1.tgz",
+ "integrity": "sha512-IIaP0g3iy9Cyy18w3M9YcaDudujEAVHKt3a3QJg1+sr/oX96TbaGUubG0hJyCjCBThFH+tFpcIyoUHUn1ogaLA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "get-east-asian-width": "^1.5.0",
+ "strip-ansi": "^7.1.2"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/cli-truncate/node_modules/strip-ansi": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
+ "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.2.2"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
"node_modules/cli-width": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz",
@@ -10040,6 +10120,19 @@
"node": ">=6"
}
},
+ "node_modules/environment": {
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/environment/-/environment-1.1.0.tgz",
+ "integrity": "sha512-xUtoPkMggbz0MPyPiIWr1Kp4aeWJjDZ6SMvURhimjdZgsRuDplF5/s9hcgGhyXMhs+6vpnuoiZ2kFiu3FMnS8Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/error-ex": {
"version": "1.3.4",
"resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.4.tgz",
@@ -10517,9 +10610,9 @@
}
},
"node_modules/eventemitter3": {
- "version": "5.0.1",
- "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.1.tgz",
- "integrity": "sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==",
+ "version": "5.0.4",
+ "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-5.0.4.tgz",
+ "integrity": "sha512-mlsTRyGaPBjPedk6Bvw+aqbsXDtoAyAzm5MO7JgU+yVRyMQ5O8bD4Kcci7BS85f93veegeCPkL8R4GLClnjLFw==",
"license": "MIT"
},
"node_modules/eventsource": {
@@ -11180,9 +11273,9 @@
}
},
"node_modules/get-east-asian-width": {
- "version": "1.4.0",
- "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.4.0.tgz",
- "integrity": "sha512-QZjmEOC+IT1uk6Rx0sX22V6uHWVwbdbxf1faPqJ1QhLdGgsRGCZoyaQBm/piRdJy/D2um6hM1UP7ZEeQ4EkP+Q==",
+ "version": "1.6.0",
+ "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.6.0.tgz",
+ "integrity": "sha512-QRbvDIbx6YklUe6RxeTeleMR0yv3cYH6PsPZHcnVn7xv7zO1BHN8r0XETu8n6Ye3Q+ahtSarc3WgtNWmehIBfA==",
"dev": true,
"license": "MIT",
"engines": {
@@ -12836,6 +12929,138 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/lint-staged": {
+ "version": "17.0.7",
+ "resolved": "https://registry.npmjs.org/lint-staged/-/lint-staged-17.0.7.tgz",
+ "integrity": "sha512-JrSobt+tW3rH8IOMi8tDZd3foorM5yPEkLD/V2NxobgHrFfHWGee4MOLVuZeScgxftEwbHrPHIFA/ZL+nUJeuA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "listr2": "^10.2.1",
+ "picomatch": "^4.0.4",
+ "string-argv": "^0.3.2",
+ "tinyexec": "^1.2.4"
+ },
+ "bin": {
+ "lint-staged": "bin/lint-staged.js"
+ },
+ "engines": {
+ "node": ">=22.22.1"
+ },
+ "funding": {
+ "url": "https://opencollective.com/lint-staged"
+ },
+ "optionalDependencies": {
+ "yaml": "^2.9.0"
+ }
+ },
+ "node_modules/lint-staged/node_modules/picomatch": {
+ "version": "4.0.4",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.4.tgz",
+ "integrity": "sha512-QP88BAKvMam/3NxH6vj2o21R6MjxZUAd6nlwAS/pnGvN9IVLocLHxGYIzFhg6fUQ+5th6P4dv4eW9jX3DSIj7A==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/listr2": {
+ "version": "10.2.1",
+ "resolved": "https://registry.npmjs.org/listr2/-/listr2-10.2.1.tgz",
+ "integrity": "sha512-7I5knELsJKTUjXG+A6BkKAiGkW1i25fNa/xlUl9hFtk15WbE9jndA89xu5FzQKrY5llajE1hfZZFMILXkDHk/Q==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "cli-truncate": "^5.2.0",
+ "eventemitter3": "^5.0.4",
+ "log-update": "^6.1.0",
+ "rfdc": "^1.4.1",
+ "wrap-ansi": "^10.0.0"
+ },
+ "engines": {
+ "node": ">=22.13.0"
+ }
+ },
+ "node_modules/listr2/node_modules/ansi-regex": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
+ }
+ },
+ "node_modules/listr2/node_modules/ansi-styles": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/listr2/node_modules/string-width": {
+ "version": "8.2.1",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-8.2.1.tgz",
+ "integrity": "sha512-IIaP0g3iy9Cyy18w3M9YcaDudujEAVHKt3a3QJg1+sr/oX96TbaGUubG0hJyCjCBThFH+tFpcIyoUHUn1ogaLA==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "get-east-asian-width": "^1.5.0",
+ "strip-ansi": "^7.1.2"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/listr2/node_modules/strip-ansi": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
+ "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.2.2"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
+ "node_modules/listr2/node_modules/wrap-ansi": {
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-10.0.0.tgz",
+ "integrity": "sha512-SGcvg80f0wUy2/fXES19feHMz8E0JoXv2uNgHOu4Dgi2OrCy1lqwFYEJz1BLbDI0exjPMe/ZdzZ/YpGECBG/aQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.2.3",
+ "string-width": "^8.2.0",
+ "strip-ansi": "^7.1.2"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
"node_modules/locate-path": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz",
@@ -12922,6 +13147,144 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
+ "node_modules/log-update": {
+ "version": "6.1.0",
+ "resolved": "https://registry.npmjs.org/log-update/-/log-update-6.1.0.tgz",
+ "integrity": "sha512-9ie8ItPR6tjY5uYJh8K/Zrv/RMZ5VOlOWvtZdEHYSTFKZfIBPQa9tOAEeAWhd+AnIneLJ22w5fjOYtoutpWq5w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-escapes": "^7.0.0",
+ "cli-cursor": "^5.0.0",
+ "slice-ansi": "^7.1.0",
+ "strip-ansi": "^7.1.0",
+ "wrap-ansi": "^9.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/log-update/node_modules/ansi-regex": {
+ "version": "6.2.2",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz",
+ "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-regex?sponsor=1"
+ }
+ },
+ "node_modules/log-update/node_modules/ansi-styles": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/log-update/node_modules/emoji-regex": {
+ "version": "10.6.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.6.0.tgz",
+ "integrity": "sha512-toUI84YS5YmxW219erniWD0CIVOo46xGKColeNQRgOzDorgBi1v4D71/OFzgD9GO2UGKIv1C3Sp8DAn0+j5w7A==",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/log-update/node_modules/is-fullwidth-code-point": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz",
+ "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "get-east-asian-width": "^1.3.1"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/log-update/node_modules/slice-ansi": {
+ "version": "7.1.2",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-7.1.2.tgz",
+ "integrity": "sha512-iOBWFgUX7caIZiuutICxVgX1SdxwAVFFKwt1EvMYYec/NWO5meOJ6K5uQxhrYBdQJne4KxiqZc+KptFOWFSI9w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.2.1",
+ "is-fullwidth-code-point": "^5.0.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/slice-ansi?sponsor=1"
+ }
+ },
+ "node_modules/log-update/node_modules/string-width": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz",
+ "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "emoji-regex": "^10.3.0",
+ "get-east-asian-width": "^1.0.0",
+ "strip-ansi": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
+ "node_modules/log-update/node_modules/strip-ansi": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.2.0.tgz",
+ "integrity": "sha512-yDPMNjp4WyfYBkHnjIRLfca1i6KMyGCtsVgoKe/z1+6vukgaENdgGBZt+ZmKPc4gavvEZ5OgHfHdrazhgNyG7w==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^6.2.2"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/strip-ansi?sponsor=1"
+ }
+ },
+ "node_modules/log-update/node_modules/wrap-ansi": {
+ "version": "9.0.2",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-9.0.2.tgz",
+ "integrity": "sha512-42AtmgqjV+X1VpdOfyTGOYRi0/zsoLqtXQckTmqTeybT+BDIbM/Guxo7x3pE2vtpr1ok6xRqM9OpBe+Jyoqyww==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.2.1",
+ "string-width": "^7.0.0",
+ "strip-ansi": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/wrap-ansi?sponsor=1"
+ }
+ },
"node_modules/loose-envify": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz",
@@ -15086,6 +15449,13 @@
"node": ">=0.10.0"
}
},
+ "node_modules/rfdc": {
+ "version": "1.4.1",
+ "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz",
+ "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/rollup": {
"version": "4.61.1",
"resolved": "https://registry.npmjs.org/rollup/-/rollup-4.61.1.tgz",
@@ -15628,6 +15998,52 @@
"node": ">=8"
}
},
+ "node_modules/slice-ansi": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-8.0.0.tgz",
+ "integrity": "sha512-stxByr12oeeOyY2BlviTNQlYV5xOj47GirPr4yA1hE9JCtxfQN0+tVbkxwCtYDQWhEKWFHsEK48ORg5jrouCAg==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^6.2.3",
+ "is-fullwidth-code-point": "^5.1.0"
+ },
+ "engines": {
+ "node": ">=20"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/slice-ansi?sponsor=1"
+ }
+ },
+ "node_modules/slice-ansi/node_modules/ansi-styles": {
+ "version": "6.2.3",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz",
+ "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/slice-ansi/node_modules/is-fullwidth-code-point": {
+ "version": "5.1.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-5.1.0.tgz",
+ "integrity": "sha512-5XHYaSyiqADb4RnZ1Bdad6cPp8Toise4TzEjcOYDHZkTCbKgiUl7WTUCpNWHuxmDt91wnsZBc9xinNzopv3JMQ==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "get-east-asian-width": "^1.3.1"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/sindresorhus"
+ }
+ },
"node_modules/smob": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/smob/-/smob-1.6.2.tgz",
@@ -15803,6 +16219,16 @@
"node": ">=4"
}
},
+ "node_modules/string-argv": {
+ "version": "0.3.2",
+ "resolved": "https://registry.npmjs.org/string-argv/-/string-argv-0.3.2.tgz",
+ "integrity": "sha512-aqD2Q0144Z+/RqG52NeHEkZauTAUWJO8c6yTftGJKO3Tja5tUgIfmIl6kExvhtxSDP7fXB6DvzkfMpCd/F3G+Q==",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=0.6.19"
+ }
+ },
"node_modules/string-width": {
"version": "4.2.3",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz",
@@ -16197,9 +16623,9 @@
"license": "MIT"
},
"node_modules/tinyexec": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz",
- "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==",
+ "version": "1.2.4",
+ "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.2.4.tgz",
+ "integrity": "sha512-SHf/r48b7vOrjve9PxJo3MN5v5yuyjHvdUcrQffT3WXMUfnGmHDVbC4k3sHJaJTgZCwpUplIaAo5ANtMyp3YHg==",
"dev": true,
"license": "MIT",
"engines": {
@@ -18278,6 +18704,22 @@
"dev": true,
"license": "ISC"
},
+ "node_modules/yaml": {
+ "version": "2.9.0",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.9.0.tgz",
+ "integrity": "sha512-2AvhNX3mb8zd6Zy7INTtSpl1F15HW6Wnqj0srWlkKLcpYl/gMIMJiyuGq2KeI2YFxUPjdlB+3Lc10seMLtL4cA==",
+ "license": "ISC",
+ "optional": true,
+ "bin": {
+ "yaml": "bin.mjs"
+ },
+ "engines": {
+ "node": ">= 14.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/eemeli"
+ }
+ },
"node_modules/yargs": {
"version": "17.7.2",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
diff --git a/package.json b/package.json
index 5c93d5d4..765b92d9 100644
--- a/package.json
+++ b/package.json
@@ -121,6 +121,7 @@
"glob": "^11.1.0",
"globals": "^16.3.0",
"husky": "^9.1.7",
+ "lint-staged": "^17.0.7",
"pgsql-ast-parser": "^12.0.2",
"playwright": "^1.60.0",
"prettier": "^3.6.2",