@webpieces/rules-config 0.4.682 → 0.4.684

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/rules-config",
3
- "version": "0.4.682",
3
+ "version": "0.4.684",
4
4
  "description": "Shared webpieces.config.json loader. Single source of truth for validation rule configuration consumed by @webpieces/ai-hook-rules, @webpieces/code-rules, and @webpieces/nx-webpieces-rules.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -0,0 +1,33 @@
1
+ export declare class AgentWorktreeLock {
2
+ /** The harness's own name for the agent, e.g. `agent-a017f6be7c518c68c`. */
3
+ agent: string;
4
+ /** The pid the harness recorded for that agent's process. */
5
+ pid: number;
6
+ /** The `start <date>` text verbatim, or '' when the reason carried none. Printed, never parsed. */
7
+ startedAt: string;
8
+ constructor(agent: string, pid: number, startedAt: string);
9
+ }
10
+ export declare class AgentWorktreeLockReader {
11
+ /**
12
+ * The parsed agent lock, or null when this reason was written by anything other than the Claude
13
+ * Code harness — including the empty reason `git worktree lock` writes with no `--reason`. Null
14
+ * means "spare it, and say only what the reason says" — somebody locked this and the evidence does
15
+ * not identify who.
16
+ */
17
+ parse(lockReason: string): AgentWorktreeLock | null;
18
+ /**
19
+ * Is the agent that took this lock still running?
20
+ *
21
+ * `process.kill(pid, 0)` sends no signal — it only asks the kernel whether the pid is addressable.
22
+ * ESRCH is the ONE answer that proves death. EPERM proves the opposite (the process exists, it just
23
+ * belongs to somebody else), and any other outcome is a question we could not ask, which under the
24
+ * asymmetry above is answered ALIVE.
25
+ *
26
+ * PID REUSE is a known and ACCEPTED imprecision: an unrelated process may inherit a long-dead
27
+ * agent's pid, and this will then report the worktree as live and spare it forever. That is the
28
+ * safe direction — one directory survives to a cleanup run after the recycled process exits — and
29
+ * the alternative (dating the lock, sniffing the process table for a claude binary) is a pile of
30
+ * platform-specific guessing on the side where being wrong destroys work.
31
+ */
32
+ isRunning(lock: AgentWorktreeLock): boolean;
33
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AgentWorktreeLockReader = exports.AgentWorktreeLock = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const inversify_1 = require("inversify");
6
+ const to_error_1 = require("./to-error");
7
+ /**
8
+ * Reading the LOCK REASON off a worktree, and deciding whether the thing that wrote it still exists.
9
+ *
10
+ * WHY this exists: `git worktree lock` used to mean one thing — a human said "do not touch" — and
11
+ * wp-cleanup spared every locked worktree on that basis. In the agent era that assumption is simply
12
+ * wrong. The Claude Code harness locks EVERY worktree it opens for a subagent, and it writes a
13
+ * machine-readable reason while doing so:
14
+ *
15
+ * locked claude agent agent-a017f6be7c518c68c (pid 64914 start Thu Aug 20 05:12:29 2026)
16
+ *
17
+ * So every `/full-cycle` run left its worktree behind forever, reported as "locked by a human — do not
18
+ * touch" about a human who has never locked a worktree in his life. That is the exact accumulation
19
+ * wp-cleanup exists to prevent, and the message was a lie on top of it.
20
+ *
21
+ * The reason string carries a PID, which is the whole fix: an agent lock whose process is gone is a
22
+ * lock nobody is behind, and the worktree underneath it can be judged on its branch like any other.
23
+ *
24
+ * THE ASYMMETRY IS DELIBERATE AND RUNS ONE WAY. Sparing a dead agent's worktree costs a leftover
25
+ * directory that the next cleanup collects. Reaping a LIVE agent's worktree destroys work in flight.
26
+ * So every uncertainty — an unparseable reason, a pid we cannot interrogate, a permission error —
27
+ * resolves to ALIVE, and alive means spared. Nothing here ever reaps on a guess.
28
+ */
29
+ /**
30
+ * The Claude Code harness's lock reason. Anchored at the start so a reason that merely MENTIONS an
31
+ * agent (a human writing "leave this, the claude agent is mid-run") is not mistaken for the harness's
32
+ * own machine-written string; unanchored at the end so a future harness may append to it without this
33
+ * silently reverting to "human lock". `start` is optional for the same reason.
34
+ */
35
+ const AGENT_LOCK_REASON = /^claude agent (\S+) \(pid (\d+)(?:\s+start\s+([^)]*))?\)/;
36
+ // The one errno that PROVES a pid is gone. Everything else means alive, or means we could not ask.
37
+ const NO_SUCH_PROCESS = 'ESRCH';
38
+ // Data-only (per CLAUDE.md, classes for data). One parsed agent lock.
39
+ class AgentWorktreeLock {
40
+ /** The harness's own name for the agent, e.g. `agent-a017f6be7c518c68c`. */
41
+ agent;
42
+ /** The pid the harness recorded for that agent's process. */
43
+ pid;
44
+ /** The `start <date>` text verbatim, or '' when the reason carried none. Printed, never parsed. */
45
+ startedAt;
46
+ constructor(agent, pid, startedAt) {
47
+ this.agent = agent;
48
+ this.pid = pid;
49
+ this.startedAt = startedAt;
50
+ }
51
+ }
52
+ exports.AgentWorktreeLock = AgentWorktreeLock;
53
+ let AgentWorktreeLockReader = class AgentWorktreeLockReader {
54
+ /**
55
+ * The parsed agent lock, or null when this reason was written by anything other than the Claude
56
+ * Code harness — including the empty reason `git worktree lock` writes with no `--reason`. Null
57
+ * means "spare it, and say only what the reason says" — somebody locked this and the evidence does
58
+ * not identify who.
59
+ */
60
+ parse(lockReason) {
61
+ const match = AGENT_LOCK_REASON.exec(lockReason.trim());
62
+ if (match === null)
63
+ return null;
64
+ const pid = Number.parseInt(match[2], 10);
65
+ if (!Number.isInteger(pid) || pid <= 0)
66
+ return null;
67
+ return new AgentWorktreeLock(match[1], pid, (match[3] ?? '').trim());
68
+ }
69
+ /**
70
+ * Is the agent that took this lock still running?
71
+ *
72
+ * `process.kill(pid, 0)` sends no signal — it only asks the kernel whether the pid is addressable.
73
+ * ESRCH is the ONE answer that proves death. EPERM proves the opposite (the process exists, it just
74
+ * belongs to somebody else), and any other outcome is a question we could not ask, which under the
75
+ * asymmetry above is answered ALIVE.
76
+ *
77
+ * PID REUSE is a known and ACCEPTED imprecision: an unrelated process may inherit a long-dead
78
+ * agent's pid, and this will then report the worktree as live and spare it forever. That is the
79
+ * safe direction — one directory survives to a cleanup run after the recycled process exits — and
80
+ * the alternative (dating the lock, sniffing the process table for a claude binary) is a pile of
81
+ * platform-specific guessing on the side where being wrong destroys work.
82
+ */
83
+ isRunning(lock) {
84
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
85
+ try {
86
+ process.kill(lock.pid, 0);
87
+ return true;
88
+ }
89
+ catch (err) {
90
+ const error = (0, to_error_1.toError)(err);
91
+ return error.code !== NO_SUCH_PROCESS;
92
+ }
93
+ }
94
+ };
95
+ exports.AgentWorktreeLockReader = AgentWorktreeLockReader;
96
+ exports.AgentWorktreeLockReader = AgentWorktreeLockReader = tslib_1.__decorate([
97
+ (0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton)
98
+ ], AgentWorktreeLockReader);
99
+ //# sourceMappingURL=agent-worktree-lock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-worktree-lock.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/agent-worktree-lock.ts"],"names":[],"mappings":";;;;AAAA,yCAA2D;AAE3D,yCAAqC;AAErC;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,0DAA0D,CAAC;AAErF,mGAAmG;AACnG,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,sEAAsE;AACtE,MAAa,iBAAiB;IAC1B,4EAA4E;IAC5E,KAAK,CAAS;IACd,6DAA6D;IAC7D,GAAG,CAAS;IACZ,mGAAmG;IACnG,SAAS,CAAS;IAElB,YAAY,KAAa,EAAE,GAAW,EAAE,SAAiB;QACrD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ;AAbD,8CAaC;AAGM,IAAM,uBAAuB,GAA7B,MAAM,uBAAuB;IAChC;;;;;OAKG;IACH,KAAK,CAAC,UAAkB;QACpB,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC;QACxD,IAAI,KAAK,KAAK,IAAI;YAAE,OAAO,IAAI,CAAC;QAChC,MAAM,GAAG,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACpD,OAAO,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,IAAuB;QAC7B,8DAA8D;QAC9D,IAAI,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAC1B,OAAO,IAAI,CAAC;QAChB,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,OAAQ,KAA+B,CAAC,IAAI,KAAK,eAAe,CAAC;QACrE,CAAC;IACL,CAAC;CACJ,CAAA;AAvCY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;GAC5B,uBAAuB,CAuCnC","sourcesContent":["import { injectable, bindingScopeValues } from 'inversify';\n\nimport { toError } from './to-error';\n\n/**\n * Reading the LOCK REASON off a worktree, and deciding whether the thing that wrote it still exists.\n *\n * WHY this exists: `git worktree lock` used to mean one thing — a human said \"do not touch\" — and\n * wp-cleanup spared every locked worktree on that basis. In the agent era that assumption is simply\n * wrong. The Claude Code harness locks EVERY worktree it opens for a subagent, and it writes a\n * machine-readable reason while doing so:\n *\n * locked claude agent agent-a017f6be7c518c68c (pid 64914 start Thu Aug 20 05:12:29 2026)\n *\n * So every `/full-cycle` run left its worktree behind forever, reported as \"locked by a human — do not\n * touch\" about a human who has never locked a worktree in his life. That is the exact accumulation\n * wp-cleanup exists to prevent, and the message was a lie on top of it.\n *\n * The reason string carries a PID, which is the whole fix: an agent lock whose process is gone is a\n * lock nobody is behind, and the worktree underneath it can be judged on its branch like any other.\n *\n * THE ASYMMETRY IS DELIBERATE AND RUNS ONE WAY. Sparing a dead agent's worktree costs a leftover\n * directory that the next cleanup collects. Reaping a LIVE agent's worktree destroys work in flight.\n * So every uncertainty — an unparseable reason, a pid we cannot interrogate, a permission error —\n * resolves to ALIVE, and alive means spared. Nothing here ever reaps on a guess.\n */\n\n/**\n * The Claude Code harness's lock reason. Anchored at the start so a reason that merely MENTIONS an\n * agent (a human writing \"leave this, the claude agent is mid-run\") is not mistaken for the harness's\n * own machine-written string; unanchored at the end so a future harness may append to it without this\n * silently reverting to \"human lock\". `start` is optional for the same reason.\n */\nconst AGENT_LOCK_REASON = /^claude agent (\\S+) \\(pid (\\d+)(?:\\s+start\\s+([^)]*))?\\)/;\n\n// The one errno that PROVES a pid is gone. Everything else means alive, or means we could not ask.\nconst NO_SUCH_PROCESS = 'ESRCH';\n\n// Data-only (per CLAUDE.md, classes for data). One parsed agent lock.\nexport class AgentWorktreeLock {\n /** The harness's own name for the agent, e.g. `agent-a017f6be7c518c68c`. */\n agent: string;\n /** The pid the harness recorded for that agent's process. */\n pid: number;\n /** The `start <date>` text verbatim, or '' when the reason carried none. Printed, never parsed. */\n startedAt: string;\n\n constructor(agent: string, pid: number, startedAt: string) {\n this.agent = agent;\n this.pid = pid;\n this.startedAt = startedAt;\n }\n}\n\n@injectable(bindingScopeValues.Singleton)\nexport class AgentWorktreeLockReader {\n /**\n * The parsed agent lock, or null when this reason was written by anything other than the Claude\n * Code harness — including the empty reason `git worktree lock` writes with no `--reason`. Null\n * means \"spare it, and say only what the reason says\" — somebody locked this and the evidence does\n * not identify who.\n */\n parse(lockReason: string): AgentWorktreeLock | null {\n const match = AGENT_LOCK_REASON.exec(lockReason.trim());\n if (match === null) return null;\n const pid = Number.parseInt(match[2], 10);\n if (!Number.isInteger(pid) || pid <= 0) return null;\n return new AgentWorktreeLock(match[1], pid, (match[3] ?? '').trim());\n }\n\n /**\n * Is the agent that took this lock still running?\n *\n * `process.kill(pid, 0)` sends no signal — it only asks the kernel whether the pid is addressable.\n * ESRCH is the ONE answer that proves death. EPERM proves the opposite (the process exists, it just\n * belongs to somebody else), and any other outcome is a question we could not ask, which under the\n * asymmetry above is answered ALIVE.\n *\n * PID REUSE is a known and ACCEPTED imprecision: an unrelated process may inherit a long-dead\n * agent's pid, and this will then report the worktree as live and spare it forever. That is the\n * safe direction — one directory survives to a cleanup run after the recycled process exits — and\n * the alternative (dating the lock, sniffing the process table for a claude binary) is a pile of\n * platform-specific guessing on the side where being wrong destroys work.\n */\n isRunning(lock: AgentWorktreeLock): boolean {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n process.kill(lock.pid, 0);\n return true;\n } catch (err: unknown) {\n const error = toError(err);\n return (error as NodeJS.ErrnoException).code !== NO_SUCH_PROCESS;\n }\n }\n}\n"]}
@@ -135,10 +135,13 @@ let BranchMutationLog = class BranchMutationLog {
135
135
  parts.push('conflict=true');
136
136
  if (event.conflictFiles.length > 0)
137
137
  parts.push(`conflictFiles=${event.conflictFiles.length}(${event.conflictFiles.join(',')})`);
138
- if (event.outcome !== '')
139
- parts.push(`outcome=${event.outcome}`);
140
138
  // Emitted as one unit so the hash is never separated from the command that undoes the delete.
141
139
  // Prefer the archive TAG as the recover ref when there is one — it does not expire.
140
+ //
141
+ // AHEAD OF `outcome=` DELIBERATELY. The line is capped at MAX_DETAIL_LEN, and the two absolute
142
+ // worktree paths a REAP_WORKTREE carries already put a real reap within a few characters of
143
+ // that cap — so whichever token comes last is the one that silently loses its tail. Prose
144
+ // describing what happened is the affordable loss; the command that undoes it is not.
142
145
  if (event.worktreePath !== '') {
143
146
  parts.push(this.worktreeDetail(event));
144
147
  }
@@ -149,6 +152,8 @@ let BranchMutationLog = class BranchMutationLog {
149
152
  else if (event.sha !== '') {
150
153
  parts.push(`sha=${event.sha} recover=git branch ${event.fromBranch || '?'} ${event.sha}`);
151
154
  }
155
+ if (event.outcome !== '')
156
+ parts.push(`outcome=${event.outcome}`);
152
157
  for (const artifact of event.artifacts)
153
158
  parts.push(`artifact=${artifact}`);
154
159
  return parts.join(' ');
@@ -1 +1 @@
1
- {"version":3,"file":"branch-mutation-log.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/branch-mutation-log.ts"],"names":[],"mappings":";;;AAuNA,sDAEC;AAGD,8CAEC;;AA9ND,+CAAyB;AACzB,mDAA6B;AAC7B,yCAA2D;AAE3D,2CAAyD;AACzD,yCAAqC;AAErC,mGAAmG;AACnG,4FAA4F;AAC5F,qGAAqG;AACrG,iGAAiG;AACjG,wFAAwF;AACxF,iGAAiG;AAEjG,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AACxC,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAC/C,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,mEAAmE;AACrG,MAAM,cAAc,GAAG,GAAG,CAAC;AAqB3B,0GAA0G;AAC1G,MAAa,mBAAmB;IAC5B,IAAI,CAAe;IACnB,KAAK,CAAgB;IACrB,UAAU,GAAW,EAAE,CAAC;IACxB,QAAQ,GAAW,EAAE,CAAC;IACtB,OAAO,GAAW,EAAE,CAAC;IACrB,OAAO,GAAW,EAAE,CAAC;IACrB,QAAQ,GAAY,KAAK,CAAC;IAC1B,aAAa,GAAa,EAAE,CAAC;IAC7B,OAAO,GAAW,EAAE,CAAC;IACrB,SAAS,GAAa,EAAE,CAAC;IACzB,+FAA+F;IAC/F,gGAAgG;IAChG,8FAA8F;IAC9F,yFAAyF;IACzF,GAAG,GAAW,EAAE,CAAC;IACjB,oGAAoG;IACpG,oGAAoG;IACpG,kGAAkG;IAClG,iGAAiG;IACjG,UAAU,GAAW,EA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E,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACrC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,KAAK,KAAK,CAAC;QACf,CAAC;IACL,CAAC;CACJ,CAAA;AAvIY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEA,wBAAY;GADxC,iBAAiB,CAuI7B;AAED,0FAA0F;AAC1F,MAAM,oBAAoB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAErD,wIAAwI;AACxI,SAAgB,qBAAqB,CAAC,IAAY;IAC9C,OAAO,oBAAoB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC;AAED,wIAAwI;AACxI,SAAgB,iBAAiB,CAAC,IAAY,EAAE,KAA0B;IACtE,oBAAoB,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { DotWebpieces, dotWebpieces } from './state-dir';\nimport { toError } from './to-error';\n\n// The BRANCH-MUTATION log — an audit trail for every workflow verb that RENAMES or MOVES branches.\n// Records START / each phase boundary / END-with-outcome so the next agent (or a human) can\n// reconstruct what the tooling did to the branches. Writes to `.webpieces/logs/branch-mutations.log`\n// (in a linked worktree: `.webpieces/worktrees/<name>/logs/`) — see LOGS_STATE_DIR for why every\n// webpieces log lives under `logs/` and no longer beside the non-log state in `hooks/`.\n// Lives in rules-config (the shared dep of pr-gate) so the pr-gate scripts can call it directly.\n\nconst LOG_FILE = 'branch-mutations.log';\nconst LOG_FILE_PREV = 'branch-mutations.1.log';\nconst MAX_LOG_BYTES = 512 * 1024; // 512 KB — rotate when exceeded (mirrors the other webpieces logs)\nconst MAX_DETAIL_LEN = 400;\n\n// The workflow verb whose branch mutation is being logged (the bin the AI/human invoked).\n// `auto-reap` is the odd one out: no human invoked it — it is the detached background refresher\n// (sync-main.ts) deleting dead branches on its own. It gets a verb precisely BECAUSE it is\n// unattended: a deletion nobody watched happen is the one that most needs an audit line.\nexport type MutationVerb =\n | 'wp-start-update' | 'wp-finish-update' | 'wp-start-upsert-pr' | 'wp-review-upsert-pr'\n | 'wp-finish-upsert-pr' | 'wp-cleanup' | 'wp-land-pr' | 'auto-reap';\n\n// A boundary within a verb's execution. START/END bracket the whole run; the middle phases mark each\n// irreversible git step so an interrupt leaves a breadcrumb at the last phase reached.\n// REAP is a whole mutation in one line (a branch delete has no phases) — see BranchReaper.\n// REAP_WORKTREE is its worktree twin: archive → `git worktree remove` → `git branch -D`, all three of\n// which succeed or fail as one act. It is a SEPARATE phase, not just a REAP with a path, so that\n// `grep REAP_WORKTREE` answers \"what directories did the tooling delete?\" — a strictly scarier\n// question than \"what refs did it delete?\", since a worktree removal takes real files with it.\nexport type MutationPhase =\n | 'START' | 'BACKUP' | 'CHECKOUT_MAIN' | 'PULL' | 'SQUASH' | 'RENAME'\n | 'FINALIZE' | 'CONFLICT' | 'INTERRUPTED' | 'END' | 'REAP' | 'REAP_WORKTREE';\n\n// Data-only record of one branch-mutation event (per CLAUDE.md: classes for data, explicit construction).\nexport class BranchMutationEvent {\n verb: MutationVerb;\n phase: MutationPhase;\n fromBranch: string = '';\n toBranch: string = '';\n oldMain: string = '';\n newMain: string = '';\n conflict: boolean = false;\n conflictFiles: string[] = [];\n outcome: string = '';\n artifacts: string[] = [];\n // The commit a DELETED branch pointed at, captured immediately before the delete. This is what\n // makes a reap auditable AND reversible: the work is already in main, and the pre-delete tip is\n // still addressable by hash (the reflog holds it ~90 days), so formatDetail renders a literal\n // `recover=git branch <name> <sha>` next to it. Empty for mutations that delete nothing.\n sha: string = '';\n // The `archive/<date>/<branch>` tag written immediately BEFORE a REAP deleted the branch. When set,\n // formatDetail renders `recover=` against the TAG instead of the sha: a tag is a permanent ref that\n // survives `gc` and reflog expiry and can be pushed, whereas a bare sha is only recoverable while\n // this clone's reflog still holds it. Empty when nothing was tagged (retention policy 'delete').\n archiveTag: string = '';\n // The directory a REAP_WORKTREE removed. When set, `recover=` becomes the WORKTREE form\n // (`git worktree add -b <branch> <path> <ref>`) rather than the bare `git branch` form: putting the\n // ref back does not put the directory back, and a recover line that restores half of what was\n // destroyed is worse than none — it reads as done. Empty for every mutation that removes no directory.\n worktreePath: string = '';\n\n constructor(verb: MutationVerb, phase: MutationPhase) {\n this.verb = verb;\n this.phase = phase;\n }\n}\n\n/** Appends branch-mutation audit lines. `@injectable(bindingScopeValues.Singleton)` so it's injectable + drawn in the design. */\n@injectable(bindingScopeValues.Singleton)\nexport class BranchMutationLog {\n constructor(private readonly dotDir: DotWebpieces = dotWebpieces) {}\n\n /**\n * LOCAL scope, deliberately — one log per worktree, not one per repo.\n *\n * A SHARED append-only log would genuinely corrupt. `O_APPEND` makes a write indivisible only up to\n * PIPE_BUF, which is 512 bytes on macOS, and a REAP_WORKTREE line carrying\n * `recover=git worktree add -b <branch> <absolute-path> <tag>` exceeds that — concurrent appenders\n * from seven worktrees would interleave into an unrecoverable audit trail, which is the one thing\n * this file exists not to be. Per-worktree, THIS log has one writer and cannot tear.\n *\n * That last claim is narrower than it looks, so do not generalise it (2026-08-06). It holds here\n * because the wp-* bins write this file one command at a time. It does NOT hold for the ai-hook\n * logs in the same directory: Claude Code runs every matching PreToolUse hook IN PARALLEL, and\n * several agents and sessions can share one tree, so a per-worktree name there had several\n * concurrent writers. Those names now carry a `<sessionId>-<agentId|coordinator>-<hook>-` prefix\n * (ai-hook-rules' LogStream), and the rejection DETAIL files sit in a directory of that same name.\n *\n * This file keeps a bare name deliberately, for TWO independent reasons, and neither has gone away\n * (re-checked 2026-08-07). First, LogStream lives in ai-hook-rules, which DEPENDS on rules-config,\n * so the import direction forbids reusing it here. Second — and this is the one that would still\n * bite after moving the class down — the `wp-*` bins that write this file have NO session or agent\n * identity to prefix with: those ids reach a PreToolUse hook on its JSON payload and a plain Bash\n * tool call never sees them. Routing this through LogStream today would therefore produce\n * `unknown-coordinator-hook-branch-mutations.log`: one shared file, exactly as now, under a longer\n * name, plus a rename of a log people already grep. If this log ever gains a second concurrent\n * writer, it needs a real stream identity FIRST — the prefix is only worth having when it\n * discriminates.\n *\n * Nothing is lost by keeping it local: under the `worktrees/<name>/` layout the log lives in the\n * PRIMARY clone, so it survives `git worktree remove`, and the whole history is one glob —\n * `<primary>/.webpieces/worktrees/*/logs/branch-mutations.log`.\n */\n branchMutationLogPath(root: string): string {\n return this.dotDir.logsFile(root, LOG_FILE);\n }\n\n /**\n * Append one tab-separated line per branch-mutation event to\n * `.webpieces/logs/branch-mutations.log`. Swallows all errors — logging must NEVER block or fail\n * the workflow it is observing.\n */\n logBranchMutation(root: string, event: BranchMutationEvent): void {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const timestamp = new Date().toISOString();\n const logsDir = this.dotDir.logs(root);\n fs.mkdirSync(logsDir, { recursive: true });\n\n const logPath = path.join(logsDir, LOG_FILE);\n this.rotateLogFile(logPath, path.join(logsDir, LOG_FILE_PREV));\n\n const line = [\n `[${timestamp}]`,\n event.verb,\n event.phase,\n this.oneLine(this.formatDetail(event)),\n ].join('\\t') + '\\n';\n fs.appendFileSync(logPath, line);\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n }\n }\n\n // Render only the fields this event actually set, as `key=value` tokens — greppable on one line.\n private formatDetail(event: BranchMutationEvent): string {\n const parts: string[] = [];\n // A rename/move has both ends; a REAP has only the branch it destroyed. Printing `to=?` for\n // the latter reads like a lost destination rather than \"there was never one\".\n if (event.fromBranch !== '' && event.toBranch !== '') parts.push(`from=${event.fromBranch} to=${event.toBranch}`);\n else if (event.fromBranch !== '') parts.push(`branch=${event.fromBranch}`);\n else if (event.toBranch !== '') parts.push(`from=? to=${event.toBranch}`);\n if (event.oldMain !== '' || event.newMain !== '') parts.push(`oldMain=${event.oldMain || '?'} newMain=${event.newMain || '?'}`);\n if (event.conflict) parts.push('conflict=true');\n if (event.conflictFiles.length > 0) parts.push(`conflictFiles=${event.conflictFiles.length}(${event.conflictFiles.join(',')})`);\n if (event.outcome !== '') parts.push(`outcome=${event.outcome}`);\n // Emitted as one unit so the hash is never separated from the command that undoes the delete.\n // Prefer the archive TAG as the recover ref when there is one — it does not expire.\n if (event.worktreePath !== '') {\n parts.push(this.worktreeDetail(event));\n } else if (event.sha !== '' && event.archiveTag !== '') {\n parts.push(\n `sha=${event.sha} archiveTag=${event.archiveTag} ` +\n `recover=git checkout -b ${event.fromBranch || '?'} ${event.archiveTag}`,\n );\n } else if (event.sha !== '') {\n parts.push(`sha=${event.sha} recover=git branch ${event.fromBranch || '?'} ${event.sha}`);\n }\n for (const artifact of event.artifacts) parts.push(`artifact=${artifact}`);\n return parts.join(' ');\n }\n\n /**\n * The worktree flavour of the sha/recover token: path, tip, archive tag and the ONE command that\n * puts the directory AND the branch back together.\n *\n * `git worktree add -b <branch> <path> <ref>` is verified by hand and in worktree-reaper.spec.ts —\n * plain `git worktree add <path> <tag>` would restore the files at a DETACHED HEAD, silently losing\n * the branch name the reap destroyed. Falls back to the sha when nothing was archived (retention\n * 'delete'), and to a bare `git worktree add <path>` when there was no branch at all (detached).\n */\n private worktreeDetail(event: BranchMutationEvent): string {\n const ref = event.archiveTag !== '' ? event.archiveTag : event.sha;\n const tokens = [`worktree=${event.worktreePath}`];\n if (event.sha !== '') tokens.push(`sha=${event.sha}`);\n if (event.archiveTag !== '') tokens.push(`archiveTag=${event.archiveTag}`);\n if (ref === '') return tokens.join(' ');\n const recover = event.fromBranch !== ''\n ? `git worktree add -b ${event.fromBranch} ${event.worktreePath} ${ref}`\n : `git worktree add ${event.worktreePath} ${ref}`;\n tokens.push(`recover=${recover}`);\n return tokens.join(' ');\n }\n\n // Collapse newlines/tabs and cap length so one event is always exactly one log line.\n private oneLine(value: string): string {\n const flat = value.replace(/[\\t\\r\\n]+/g, ' ').trim();\n return flat.length <= MAX_DETAIL_LEN ? flat : flat.slice(0, MAX_DETAIL_LEN) + '…';\n }\n\n private rotateLogFile(logPath: string, prevPath: string): void {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const stat = fs.statSync(logPath);\n if (stat.size > MAX_LOG_BYTES) {\n if (fs.existsSync(prevPath)) fs.unlinkSync(prevPath);\n fs.renameSync(logPath, prevPath);\n }\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n }\n }\n}\n\n// Temporary migration delegators to BranchMutationLog — removed once consumers inject it.\nconst branchMutationLogSvc = new BranchMutationLog();\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to BranchMutationLog; removed once consumers inject it\nexport function branchMutationLogPath(root: string): string {\n return branchMutationLogSvc.branchMutationLogPath(root);\n}\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to BranchMutationLog; removed once consumers inject it\nexport function logBranchMutation(root: string, event: BranchMutationEvent): void {\n branchMutationLogSvc.logBranchMutation(root, event);\n}\n"]}
1
+ {"version":3,"file":"branch-mutation-log.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/branch-mutation-log.ts"],"names":[],"mappings":";;;AA4NA,sDAEC;AAGD,8CAEC;;AAnOD,+CAAyB;AACzB,mDAA6B;AAC7B,yCAA2D;AAE3D,2CAAyD;AACzD,yCAAqC;AAErC,mGAAmG;AACnG,4FAA4F;AAC5F,qGAAqG;AACrG,iGAAiG;AACjG,wFAAwF;AACxF,iGAAiG;AAEjG,MAAM,QAAQ,GAAG,sBAAsB,CAAC;AACxC,MAAM,aAAa,GAAG,wBAAwB,CAAC;AAC/C,MAAM,aAAa,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC,mEAAmE;AACrG,MAAM,cAAc,GAAG,GAAG,CAAC;AAqB3B,0GAA0G;AAC1G,MAAa,mBAAmB;IAC5B,IAAI,CAAe;IACnB,KAAK,CAAgB;IACrB,UAAU,GAAW,EAA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rD,OAAO,IAAI,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,GAAG,CAAC;IACtF,CAAC;IAEO,aAAa,CAAC,OAAe,EAAE,QAAgB;QACnD,8DAA8D;QAC9D,IAAI,CAAC;YACD,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YAClC,IAAI,IAAI,CAAC,IAAI,GAAG,aAAa,EAAE,CAAC;gBAC5B,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC;oBAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;gBACrD,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YACrC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACpB,MAAM,KAAK,GAAG,IAAA,kBAAO,EAAC,GAAG,CAAC,CAAC;YAC3B,KAAK,KAAK,CAAC;QACf,CAAC;IACL,CAAC;CACJ,CAAA;AA5IY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEA,wBAAY;GADxC,iBAAiB,CA4I7B;AAED,0FAA0F;AAC1F,MAAM,oBAAoB,GAAG,IAAI,iBAAiB,EAAE,CAAC;AAErD,wIAAwI;AACxI,SAAgB,qBAAqB,CAAC,IAAY;IAC9C,OAAO,oBAAoB,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC;AAED,wIAAwI;AACxI,SAAgB,iBAAiB,CAAC,IAAY,EAAE,KAA0B;IACtE,oBAAoB,CAAC,iBAAiB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport { DotWebpieces, dotWebpieces } from './state-dir';\nimport { toError } from './to-error';\n\n// The BRANCH-MUTATION log — an audit trail for every workflow verb that RENAMES or MOVES branches.\n// Records START / each phase boundary / END-with-outcome so the next agent (or a human) can\n// reconstruct what the tooling did to the branches. Writes to `.webpieces/logs/branch-mutations.log`\n// (in a linked worktree: `.webpieces/worktrees/<name>/logs/`) — see LOGS_STATE_DIR for why every\n// webpieces log lives under `logs/` and no longer beside the non-log state in `hooks/`.\n// Lives in rules-config (the shared dep of pr-gate) so the pr-gate scripts can call it directly.\n\nconst LOG_FILE = 'branch-mutations.log';\nconst LOG_FILE_PREV = 'branch-mutations.1.log';\nconst MAX_LOG_BYTES = 512 * 1024; // 512 KB — rotate when exceeded (mirrors the other webpieces logs)\nconst MAX_DETAIL_LEN = 400;\n\n// The workflow verb whose branch mutation is being logged (the bin the AI/human invoked).\n// `auto-reap` is the odd one out: no human invoked it — it is the detached background refresher\n// (sync-main.ts) deleting dead branches on its own. It gets a verb precisely BECAUSE it is\n// unattended: a deletion nobody watched happen is the one that most needs an audit line.\nexport type MutationVerb =\n | 'wp-start-update' | 'wp-finish-update' | 'wp-start-upsert-pr' | 'wp-review-upsert-pr'\n | 'wp-finish-upsert-pr' | 'wp-cleanup' | 'wp-land-pr' | 'auto-reap';\n\n// A boundary within a verb's execution. START/END bracket the whole run; the middle phases mark each\n// irreversible git step so an interrupt leaves a breadcrumb at the last phase reached.\n// REAP is a whole mutation in one line (a branch delete has no phases) — see BranchReaper.\n// REAP_WORKTREE is its worktree twin: archive → `git worktree remove` → `git branch -D`, all three of\n// which succeed or fail as one act. It is a SEPARATE phase, not just a REAP with a path, so that\n// `grep REAP_WORKTREE` answers \"what directories did the tooling delete?\" — a strictly scarier\n// question than \"what refs did it delete?\", since a worktree removal takes real files with it.\nexport type MutationPhase =\n | 'START' | 'BACKUP' | 'CHECKOUT_MAIN' | 'PULL' | 'SQUASH' | 'RENAME'\n | 'FINALIZE' | 'CONFLICT' | 'INTERRUPTED' | 'END' | 'REAP' | 'REAP_WORKTREE';\n\n// Data-only record of one branch-mutation event (per CLAUDE.md: classes for data, explicit construction).\nexport class BranchMutationEvent {\n verb: MutationVerb;\n phase: MutationPhase;\n fromBranch: string = '';\n toBranch: string = '';\n oldMain: string = '';\n newMain: string = '';\n conflict: boolean = false;\n conflictFiles: string[] = [];\n outcome: string = '';\n artifacts: string[] = [];\n // The commit a DELETED branch pointed at, captured immediately before the delete. This is what\n // makes a reap auditable AND reversible: the work is already in main, and the pre-delete tip is\n // still addressable by hash (the reflog holds it ~90 days), so formatDetail renders a literal\n // `recover=git branch <name> <sha>` next to it. Empty for mutations that delete nothing.\n sha: string = '';\n // The `archive/<date>/<branch>` tag written immediately BEFORE a REAP deleted the branch. When set,\n // formatDetail renders `recover=` against the TAG instead of the sha: a tag is a permanent ref that\n // survives `gc` and reflog expiry and can be pushed, whereas a bare sha is only recoverable while\n // this clone's reflog still holds it. Empty when nothing was tagged (retention policy 'delete').\n archiveTag: string = '';\n // The directory a REAP_WORKTREE removed. When set, `recover=` becomes the WORKTREE form\n // (`git worktree add -b <branch> <path> <ref>`) rather than the bare `git branch` form: putting the\n // ref back does not put the directory back, and a recover line that restores half of what was\n // destroyed is worse than none — it reads as done. Empty for every mutation that removes no directory.\n worktreePath: string = '';\n\n constructor(verb: MutationVerb, phase: MutationPhase) {\n this.verb = verb;\n this.phase = phase;\n }\n}\n\n/** Appends branch-mutation audit lines. `@injectable(bindingScopeValues.Singleton)` so it's injectable + drawn in the design. */\n@injectable(bindingScopeValues.Singleton)\nexport class BranchMutationLog {\n constructor(private readonly dotDir: DotWebpieces = dotWebpieces) {}\n\n /**\n * LOCAL scope, deliberately — one log per worktree, not one per repo.\n *\n * A SHARED append-only log would genuinely corrupt. `O_APPEND` makes a write indivisible only up to\n * PIPE_BUF, which is 512 bytes on macOS, and a REAP_WORKTREE line carrying\n * `recover=git worktree add -b <branch> <absolute-path> <tag>` exceeds that — concurrent appenders\n * from seven worktrees would interleave into an unrecoverable audit trail, which is the one thing\n * this file exists not to be. Per-worktree, THIS log has one writer and cannot tear.\n *\n * That last claim is narrower than it looks, so do not generalise it (2026-08-06). It holds here\n * because the wp-* bins write this file one command at a time. It does NOT hold for the ai-hook\n * logs in the same directory: Claude Code runs every matching PreToolUse hook IN PARALLEL, and\n * several agents and sessions can share one tree, so a per-worktree name there had several\n * concurrent writers. Those names now carry a `<sessionId>-<agentId|coordinator>-<hook>-` prefix\n * (ai-hook-rules' LogStream), and the rejection DETAIL files sit in a directory of that same name.\n *\n * This file keeps a bare name deliberately, for TWO independent reasons, and neither has gone away\n * (re-checked 2026-08-07). First, LogStream lives in ai-hook-rules, which DEPENDS on rules-config,\n * so the import direction forbids reusing it here. Second — and this is the one that would still\n * bite after moving the class down — the `wp-*` bins that write this file have NO session or agent\n * identity to prefix with: those ids reach a PreToolUse hook on its JSON payload and a plain Bash\n * tool call never sees them. Routing this through LogStream today would therefore produce\n * `unknown-coordinator-hook-branch-mutations.log`: one shared file, exactly as now, under a longer\n * name, plus a rename of a log people already grep. If this log ever gains a second concurrent\n * writer, it needs a real stream identity FIRST — the prefix is only worth having when it\n * discriminates.\n *\n * Nothing is lost by keeping it local: under the `worktrees/<name>/` layout the log lives in the\n * PRIMARY clone, so it survives `git worktree remove`, and the whole history is one glob —\n * `<primary>/.webpieces/worktrees/*/logs/branch-mutations.log`.\n */\n branchMutationLogPath(root: string): string {\n return this.dotDir.logsFile(root, LOG_FILE);\n }\n\n /**\n * Append one tab-separated line per branch-mutation event to\n * `.webpieces/logs/branch-mutations.log`. Swallows all errors — logging must NEVER block or fail\n * the workflow it is observing.\n */\n logBranchMutation(root: string, event: BranchMutationEvent): void {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const timestamp = new Date().toISOString();\n const logsDir = this.dotDir.logs(root);\n fs.mkdirSync(logsDir, { recursive: true });\n\n const logPath = path.join(logsDir, LOG_FILE);\n this.rotateLogFile(logPath, path.join(logsDir, LOG_FILE_PREV));\n\n const line = [\n `[${timestamp}]`,\n event.verb,\n event.phase,\n this.oneLine(this.formatDetail(event)),\n ].join('\\t') + '\\n';\n fs.appendFileSync(logPath, line);\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n }\n }\n\n // Render only the fields this event actually set, as `key=value` tokens — greppable on one line.\n private formatDetail(event: BranchMutationEvent): string {\n const parts: string[] = [];\n // A rename/move has both ends; a REAP has only the branch it destroyed. Printing `to=?` for\n // the latter reads like a lost destination rather than \"there was never one\".\n if (event.fromBranch !== '' && event.toBranch !== '') parts.push(`from=${event.fromBranch} to=${event.toBranch}`);\n else if (event.fromBranch !== '') parts.push(`branch=${event.fromBranch}`);\n else if (event.toBranch !== '') parts.push(`from=? to=${event.toBranch}`);\n if (event.oldMain !== '' || event.newMain !== '') parts.push(`oldMain=${event.oldMain || '?'} newMain=${event.newMain || '?'}`);\n if (event.conflict) parts.push('conflict=true');\n if (event.conflictFiles.length > 0) parts.push(`conflictFiles=${event.conflictFiles.length}(${event.conflictFiles.join(',')})`);\n // Emitted as one unit so the hash is never separated from the command that undoes the delete.\n // Prefer the archive TAG as the recover ref when there is one — it does not expire.\n //\n // AHEAD OF `outcome=` DELIBERATELY. The line is capped at MAX_DETAIL_LEN, and the two absolute\n // worktree paths a REAP_WORKTREE carries already put a real reap within a few characters of\n // that cap — so whichever token comes last is the one that silently loses its tail. Prose\n // describing what happened is the affordable loss; the command that undoes it is not.\n if (event.worktreePath !== '') {\n parts.push(this.worktreeDetail(event));\n } else if (event.sha !== '' && event.archiveTag !== '') {\n parts.push(\n `sha=${event.sha} archiveTag=${event.archiveTag} ` +\n `recover=git checkout -b ${event.fromBranch || '?'} ${event.archiveTag}`,\n );\n } else if (event.sha !== '') {\n parts.push(`sha=${event.sha} recover=git branch ${event.fromBranch || '?'} ${event.sha}`);\n }\n if (event.outcome !== '') parts.push(`outcome=${event.outcome}`);\n for (const artifact of event.artifacts) parts.push(`artifact=${artifact}`);\n return parts.join(' ');\n }\n\n /**\n * The worktree flavour of the sha/recover token: path, tip, archive tag and the ONE command that\n * puts the directory AND the branch back together.\n *\n * `git worktree add -b <branch> <path> <ref>` is verified by hand and in worktree-reaper.spec.ts —\n * plain `git worktree add <path> <tag>` would restore the files at a DETACHED HEAD, silently losing\n * the branch name the reap destroyed. Falls back to the sha when nothing was archived (retention\n * 'delete'), and to a bare `git worktree add <path>` when there was no branch at all (detached).\n */\n private worktreeDetail(event: BranchMutationEvent): string {\n const ref = event.archiveTag !== '' ? event.archiveTag : event.sha;\n const tokens = [`worktree=${event.worktreePath}`];\n if (event.sha !== '') tokens.push(`sha=${event.sha}`);\n if (event.archiveTag !== '') tokens.push(`archiveTag=${event.archiveTag}`);\n if (ref === '') return tokens.join(' ');\n const recover = event.fromBranch !== ''\n ? `git worktree add -b ${event.fromBranch} ${event.worktreePath} ${ref}`\n : `git worktree add ${event.worktreePath} ${ref}`;\n tokens.push(`recover=${recover}`);\n return tokens.join(' ');\n }\n\n // Collapse newlines/tabs and cap length so one event is always exactly one log line.\n private oneLine(value: string): string {\n const flat = value.replace(/[\\t\\r\\n]+/g, ' ').trim();\n return flat.length <= MAX_DETAIL_LEN ? flat : flat.slice(0, MAX_DETAIL_LEN) + '…';\n }\n\n private rotateLogFile(logPath: string, prevPath: string): void {\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n const stat = fs.statSync(logPath);\n if (stat.size > MAX_LOG_BYTES) {\n if (fs.existsSync(prevPath)) fs.unlinkSync(prevPath);\n fs.renameSync(logPath, prevPath);\n }\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n }\n }\n}\n\n// Temporary migration delegators to BranchMutationLog — removed once consumers inject it.\nconst branchMutationLogSvc = new BranchMutationLog();\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to BranchMutationLog; removed once consumers inject it\nexport function branchMutationLogPath(root: string): string {\n return branchMutationLogSvc.branchMutationLogPath(root);\n}\n\n// webpieces-disable no-function-outside-class -- temporary back-compat delegator to BranchMutationLog; removed once consumers inject it\nexport function logBranchMutation(root: string, event: BranchMutationEvent): void {\n branchMutationLogSvc.logBranchMutation(root, event);\n}\n"]}
package/src/index.d.ts CHANGED
@@ -71,6 +71,8 @@ export { MainSyncLock, MainSyncStatusService, DEFAULT_HANG_TIMEOUT_MINUTES, main
71
71
  export { MergedBranch, DeletableBranch, DeletableWorktree, MergedBranchesCache, MergedBranchesService, CacheFreshness, CACHE_STALE_AFTER_MS, CLASSIFICATION_MERGED_PR, CLASSIFICATION_BACKUP_OF_MERGED, CLASSIFICATION_BACKUP_OF_LIVE, CLASSIFICATION_NO_COMMITS, CLASSIFICATION_SUPERSEDED, CLASSIFICATION_CONTENT_IN_MAIN, CLASSIFICATION_NEVER_PROPOSED, CLASSIFICATION_IN_USE, CLASSIFICATION_PRUNABLE, CLASSIFICATION_LOCKED, CLASSIFICATION_CURRENT, CLASSIFICATION_DETACHED, PROMPTABLE_CLASSIFICATIONS, } from './merged-branches';
72
72
  export { BranchArchiver, ArchiveResult, ARCHIVE_TAG_PREFIX, BRANCH_RETENTIONS, BRANCH_RETENTION_DELETE, BRANCH_RETENTION_ARCHIVE_TAG, BRANCH_RETENTION_KEEP, } from './branch-archiver';
73
73
  export { Worktree, WorktreeService, } from './worktrees';
74
+ export { AgentWorktreeLock, AgentWorktreeLockReader, } from './agent-worktree-lock';
75
+ export { WorktreeLockVerdicts } from './worktree-lock-verdicts';
74
76
  export { ReapedBranch, ReapResult, BranchReaper, } from './branch-reaper';
75
77
  export { ReapedWorktree, WorktreeReapResult, WorktreeReaper, } from './worktree-reaper';
76
78
  export type { MutationVerb, MutationPhase } from './branch-mutation-log';
package/src/index.js CHANGED
@@ -6,8 +6,8 @@ exports.ChangedFilesOptions = exports.DiffRange = exports.DiffScope = exports.is
6
6
  exports.ValidatePackageJsonConfig = exports.ValidateNoArchitectureCyclesConfig = exports.ValidateArchitectureUnchangedConfig = exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.DiGraphConfig = exports.NxWiringConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.PrLifecycleGuardConfig = exports.BranchCreationGuardConfig = exports.RoleTagConfig = exports.FrameworkTagConfig = exports.InjectAnnotationNotNeededForConcreteClassConfig = exports.NoFunctionOutsideClassConfig = exports.NoProcessExitOutsideMainConfig = exports.NoCustomCssConfig = exports.NoSymbolDiTokensConfig = exports.AngularNoDirectApiInResolverConfig = exports.ThrowCauseRequiredConfig = exports.CatchErrorPatternConfig = exports.NoUnmanagedExceptionsConfig = exports.NoDestructureConfig = exports.PrismaConverterConfig = exports.PrismaValidateDtosConfig = exports.NoImplicitAnyConfig = exports.NoAnyUnknownConfig = exports.NoInlineTypeLiteralsConfig = exports.RequireReturnTypeConfig = exports.MaxFileLinesConfig = exports.MaxMethodLinesConfig = exports.WP_FINISH_PUSH_DEV = exports.WP_PUSH_DEV = exports.WP_FINISH_UPSERT_PR = exports.WP_START_UPSERT_PR = exports.WP_FINISH_UPDATE = exports.WP_START_UPDATE = exports.SyncFlowGuidance = exports.WebpiecesRulesConfig = exports.PRUNE_UNKNOWN_COMMAND = exports.PUSH_DEV_STATE_FILE = exports.MERGE_EXPLANATION_FILE = exports.MERGE_IN_PROGRESS_FILE = exports.PR_REVIEW_DIR = exports.MERGE_INFO_DIR = exports.WEBPIECES_TMP_DIR = exports.hasDisable = exports.RULE_NAMES = exports.WEBPIECES_DISABLE = exports.AbstractRule = void 0;
7
7
  exports.GateTokenService = exports.ALL_DIFF_ONE_READ_LINES = exports.READ_TRUNCATION_LINES = exports.ContextEntry = exports.BriefedFile = exports.ReviewerBriefing = exports.ReviewerInstructionsService = exports.ChecklistInstructionsService = exports.ChecklistValidator = exports.formatFileList = exports.normalizeChecklistDoc = exports.toChecklist = exports.ChecklistDefinition = exports.MERGE_MODES = exports.MERGE_MODE_NONE = exports.MERGE_MODE_AUTO = exports.buildDevDeployConfig = exports.buildLandPrConfig = exports.buildPrGateConfig = exports.defaultDevDeployConfig = exports.defaultLandPrConfig = exports.defaultPrGateConfig = exports.defaultGates = exports.ReviewContextEntry = exports.DEFAULT_DEV_BRANCH = exports.DEFAULT_DEV_BRANCH_NAMESPACE = exports.DevDeployConfig = exports.LandPrConfig = exports.DEFAULT_BUILD_COMMAND = exports.PrGateConfig = exports.GateDefinition = exports.BranchStateGuardConfig = exports.CLIENT_CREATION_SEVERITIES = exports.NoClientCreationOutsideServerOrClientConfig = exports.VALIDATE_TS_MODES = exports.STRUCTURAL_MODES = exports.ON_OFF_MODES = exports.THROW_CAUSE_MODES = exports.DIRECT_API_RESOLVER_MODES = exports.PRISMA_CONVERTER_MODES = exports.PRISMA_DTOS_MODES = exports.PROJECT_MODES = exports.MODIFIED_CODE_MODES = exports.INLINE_TYPE_MODES = exports.RETURN_TYPE_MODES = exports.FILE_LIMIT_MODES = exports.METHOD_LIMIT_MODES = exports.BaseRuleConfig = exports.ValidateEslintSyncConfig = exports.ValidateVersionsLockedConfig = void 0;
8
8
  exports.mainSyncLockPath = exports.mainSyncStatusPath = exports.DEFAULT_HANG_TIMEOUT_MINUTES = exports.MainSyncStatusService = exports.MainSyncLock = exports.MAIN_SYNC_STATUS_VERSION = exports.PullRequestIndex = exports.MainSyncFileStore = exports.MainSyncStatusFile = exports.MainSyncStatus = exports.reviewJsonSchemaHint = exports.reviewJsonPath = exports.prDirFor = exports.loadReviewJson = exports.ReviewJsonService = exports.ChecklistReviewContext = exports.RequiredChecklist = exports.VERDICT_STATUSES = exports.VERDICT_RED = exports.VERDICT_YELLOW = exports.VERDICT_GREEN = exports.CK_BAD_FORMAT = exports.CK_MISSING = exports.CK_FAIL = exports.CK_OVERRIDDEN = exports.CK_WARN = exports.CK_PASS = exports.ChecklistVerdict = exports.ChecklistResult = exports.PrContext = exports.ReviewJson = exports.DEFAULT_RETENTION_DAYS = exports.ProvenanceWriteRequest = exports.OfferedContext = exports.ReviewerPaths = exports.ReviewerTranscript = exports.ReviewProvenance = exports.ReviewProvenanceService = exports.PROVENANCE_SKIPPED = exports.PROVENANCE_MISSING = exports.PROVENANCE_OK = exports.ProvenanceResult = exports.TranscriptScan = exports.ReviewerContext = exports.ReviewerEvidence = exports.SubagentProvenanceService = exports.verifyGateToken = exports.extractGateToken = exports.gateTokenMarker = exports.computeGateToken = void 0;
9
- exports.WorktreeReaper = exports.WorktreeReapResult = exports.ReapedWorktree = exports.BranchReaper = exports.ReapResult = exports.ReapedBranch = exports.WorktreeService = exports.Worktree = exports.BRANCH_RETENTION_KEEP = exports.BRANCH_RETENTION_ARCHIVE_TAG = exports.BRANCH_RETENTION_DELETE = exports.BRANCH_RETENTIONS = exports.ARCHIVE_TAG_PREFIX = exports.ArchiveResult = exports.BranchArchiver = exports.PROMPTABLE_CLASSIFICATIONS = exports.CLASSIFICATION_DETACHED = exports.CLASSIFICATION_CURRENT = exports.CLASSIFICATION_LOCKED = exports.CLASSIFICATION_PRUNABLE = exports.CLASSIFICATION_IN_USE = exports.CLASSIFICATION_NEVER_PROPOSED = exports.CLASSIFICATION_CONTENT_IN_MAIN = exports.CLASSIFICATION_SUPERSEDED = exports.CLASSIFICATION_NO_COMMITS = exports.CLASSIFICATION_BACKUP_OF_LIVE = exports.CLASSIFICATION_BACKUP_OF_MERGED = exports.CLASSIFICATION_MERGED_PR = exports.CACHE_STALE_AFTER_MS = exports.CacheFreshness = exports.MergedBranchesService = exports.MergedBranchesCache = exports.DeletableWorktree = exports.DeletableBranch = exports.MergedBranch = exports.squashRecoverySteps = exports.stampCleanMainSyncStatus = exports.computeMainSyncStatus = exports.finishedLock = exports.inProcessLock = exports.tryAcquireMainSyncLock = exports.isRefreshInProgress = exports.isLockStale = exports.writeMainSyncLock = exports.readMainSyncLock = exports.computeAllMainSyncStatuses = exports.writeMainSyncStatusFile = exports.writeMainSyncStatus = exports.readMainSyncStatusFile = exports.readMainSyncStatus = void 0;
10
- exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.logBranchMutation = exports.branchMutationLogPath = exports.BranchMutationLog = exports.BranchMutationEvent = void 0;
9
+ exports.BranchReaper = exports.ReapResult = exports.ReapedBranch = exports.WorktreeLockVerdicts = exports.AgentWorktreeLockReader = exports.AgentWorktreeLock = exports.WorktreeService = exports.Worktree = exports.BRANCH_RETENTION_KEEP = exports.BRANCH_RETENTION_ARCHIVE_TAG = exports.BRANCH_RETENTION_DELETE = exports.BRANCH_RETENTIONS = exports.ARCHIVE_TAG_PREFIX = exports.ArchiveResult = exports.BranchArchiver = exports.PROMPTABLE_CLASSIFICATIONS = exports.CLASSIFICATION_DETACHED = exports.CLASSIFICATION_CURRENT = exports.CLASSIFICATION_LOCKED = exports.CLASSIFICATION_PRUNABLE = exports.CLASSIFICATION_IN_USE = exports.CLASSIFICATION_NEVER_PROPOSED = exports.CLASSIFICATION_CONTENT_IN_MAIN = exports.CLASSIFICATION_SUPERSEDED = exports.CLASSIFICATION_NO_COMMITS = exports.CLASSIFICATION_BACKUP_OF_LIVE = exports.CLASSIFICATION_BACKUP_OF_MERGED = exports.CLASSIFICATION_MERGED_PR = exports.CACHE_STALE_AFTER_MS = exports.CacheFreshness = exports.MergedBranchesService = exports.MergedBranchesCache = exports.DeletableWorktree = exports.DeletableBranch = exports.MergedBranch = exports.squashRecoverySteps = exports.stampCleanMainSyncStatus = exports.computeMainSyncStatus = exports.finishedLock = exports.inProcessLock = exports.tryAcquireMainSyncLock = exports.isRefreshInProgress = exports.isLockStale = exports.writeMainSyncLock = exports.readMainSyncLock = exports.computeAllMainSyncStatuses = exports.writeMainSyncStatusFile = exports.writeMainSyncStatus = exports.readMainSyncStatusFile = exports.readMainSyncStatus = void 0;
10
+ exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.logBranchMutation = exports.branchMutationLogPath = exports.BranchMutationLog = exports.BranchMutationEvent = exports.WorktreeReaper = exports.WorktreeReapResult = exports.ReapedWorktree = void 0;
11
11
  var types_1 = require("./types");
12
12
  Object.defineProperty(exports, "ResolvedConfig", { enumerable: true, get: function () { return types_1.ResolvedConfig; } });
13
13
  Object.defineProperty(exports, "ResolvedRuleConfig", { enumerable: true, get: function () { return types_1.ResolvedRuleConfig; } });
@@ -454,6 +454,11 @@ Object.defineProperty(exports, "BRANCH_RETENTION_KEEP", { enumerable: true, get:
454
454
  var worktrees_1 = require("./worktrees");
455
455
  Object.defineProperty(exports, "Worktree", { enumerable: true, get: function () { return worktrees_1.Worktree; } });
456
456
  Object.defineProperty(exports, "WorktreeService", { enumerable: true, get: function () { return worktrees_1.WorktreeService; } });
457
+ var agent_worktree_lock_1 = require("./agent-worktree-lock");
458
+ Object.defineProperty(exports, "AgentWorktreeLock", { enumerable: true, get: function () { return agent_worktree_lock_1.AgentWorktreeLock; } });
459
+ Object.defineProperty(exports, "AgentWorktreeLockReader", { enumerable: true, get: function () { return agent_worktree_lock_1.AgentWorktreeLockReader; } });
460
+ var worktree_lock_verdicts_1 = require("./worktree-lock-verdicts");
461
+ Object.defineProperty(exports, "WorktreeLockVerdicts", { enumerable: true, get: function () { return worktree_lock_verdicts_1.WorktreeLockVerdicts; } });
457
462
  var branch_reaper_1 = require("./branch-reaper");
458
463
  Object.defineProperty(exports, "ReapedBranch", { enumerable: true, get: function () { return branch_reaper_1.ReapedBranch; } });
459
464
  Object.defineProperty(exports, "ReapResult", { enumerable: true, get: function () { return branch_reaper_1.ReapResult; } });
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAC3C,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,qDAA+F;AAAtF,gHAAA,aAAa,OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AACnE,uGAAu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AAA,qBAAqB,OAAA;AACrB,iHAAA,cAAc,OAAA;AACd,uHAAA,oBAAoB,OAAA;AACpB,2HAAA,wBAAwB,OAAA;AACxB,kIAAA,+BAA+B,OAAA;AAC/B,gIAAA,6BAA6B,OAAA;AAC7B,4HAAA,yBAAyB,OAAA;AACzB,4HAAA,yBAAyB,OAAA;AACzB,iIAAA,8BAA8B,OAAA;AAC9B,gIAAA,6BAA6B,OAAA;AAC7B,wHAAA,qBAAqB,OAAA;AACrB,0HAAA,uBAAuB,OAAA;AACvB,wHAAA,qBAAqB,OAAA;AACrB,yHAAA,sBAAsB,OAAA;AACtB,0HAAA,uBAAuB,OAAA;AACvB,6HAAA,0BAA0B,OAAA;AAE9B,qDAQ2B;AAPvB,iHAAA,cAAc,OAAA;AACd,gHAAA,aAAa,OAAA;AACb,qHAAA,kBAAkB,OAAA;AAClB,oHAAA,iBAAiB,OAAA;AACjB,0HAAA,uBAAuB,OAAA;AACvB,+HAAA,4BAA4B,OAAA;AAC5B,wHAAA,qBAAqB,OAAA;AAEzB,yCAGqB;AAFjB,qGAAA,QAAQ,OAAA;AACR,4GAAA,eAAe,OAAA;AAEnB,iDAIyB;AAHrB,6GAAA,YAAY,OAAA;AACZ,2GAAA,UAAU,OAAA;AACV,6GAAA,YAAY,OAAA;AAEhB,qDAI2B;AAHvB,iHAAA,cAAc,OAAA;AACd,qHAAA,kBAAkB,OAAA;AAClB,iHAAA,cAAc,OAAA;AAGlB,6DAK+B;AAJ3B,0HAAA,mBAAmB,OAAA;AACnB,wHAAA,iBAAiB,OAAA;AACjB,4HAAA,qBAAqB,OAAA;AACrB,wHAAA,iBAAiB,OAAA;AAErB,qDAK2B;AAJvB,iHAAA,cAAc,OAAA;AACd,sHAAA,mBAAmB,OAAA;AACnB,4HAAA,yBAAyB,OAAA;AACzB,iIAAA,8BAA8B,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\nexport { InformAiError } from './inform-ai-error';\nexport { RuleFailError, renderRuleFailForAi, renderRuleFailForHuman } from './rule-fail-error';\n// THE one representation of a cure, shared by RuleFailError (build-time) and FixHint (edit-time), plus\n// the one renderer that owns the \"Fix Option N:\" numbering and the \"(preferred)\" tag.\nexport { Option, formatFixOptions } from './fix-option';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliFlag, CliArgSet, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\nexport { toError } from './to-error';\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\n// The validation-failure banner: ONE cure (edit the file), plus the marker phrases the validator\n// messages embed rather than re-type.\nexport {\n formatConfigErrorsBanner,\n CONFIG_POLICY_DOC,\n RETIRED_KEY_MARKER,\n RETIRED_TOP_LEVEL_MARKER,\n SECTION_PLACEMENT_MARKER,\n} from './config-error-banner';\nexport { findConfigFile, CONFIG_FILENAME, ConfigFile, ConfigParseAttempt, CONFIG_PARSE_ATTEMPTS, CONFIG_PARSE_RETRY_MILLIS } from './config-file';\n// The PARSED-BUT-UNVALIDATED config shape. Exported for readers that walk the file generically rather\n// than through the typed config (the pr-gate active-hatch dashboard section reads every rule's hatches).\nexport type { RawConfigFile } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';\n// The scoped `.webpieces` resolver. EVERY reader/writer of `.webpieces/...` goes through one of its two\n// named methods so the call site declares whether the state is repo-wide or worktree-private.\nexport { DotWebpieces, dotWebpieces, GitDirs, WORKTREE_STATE_DIR, LOGS_STATE_DIR } from './state-dir';\nexport { StateDirMigrator, StateMigrationReport } from './state-dir-migration';\n// There is NO machine-global state root. `MachineStateHome`/`StateHome`/`WEBPIECES_STATE_HOME` and the\n// `PrBodyStore` that used them are DELETED: the one artifact that needed a scope above the clone was the\n// gated squash body, and GitHub holds it now (it IS the PR description). Every `.webpieces` path a\n// webpieces tool writes is `{repo}/.webpieces`, resolved through `DotWebpieces` above. See\n// `decisions/0005-the-pr-description-is-the-merge-body.md`.\nexport { AgedTreeSweeper, SweepCount, RETENTION_DAYS } from './aged-tree-sweep';\nexport { ClaudeEnv, claudeEnv, CLAUDE_PROJECT_DIR_ENV, CLAUDE_PROJECT_DIR_UNSET } from './claude-env';\nexport { AtomicFile } from './atomic-file';\n// The ONE formatter for a remedy that must run in a named directory: `cd '<root>' && <command>`.\n// Single-quoted so a repo path containing a space is still runnable (and still un-smuggleable).\nexport { atRoot } from './at-root';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths, isWebpiecesStateDir } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\n// THE one `no-custom-css` path exemption. Both engines that enforce the rule (the edit-time hook and the\n// CI validator) consult this class, so `allowGlobs` cannot be honoured by one half and ignored by the other.\nexport { NoCustomCssScope } from './no-custom-css-scope';\nexport { defaultRules, defaultRulesDir } from './default-rules';\nexport { loadTemplate, writeTemplateIfMissing, writeTemplate, TemplateWriter } from './load-template';\n// The instruct-ai docs are delivered as a SET: writing one writes the transitive closure of the docs it\n// links to, so a doc and everything it points at always land together. See instruct-ai-docs.ts.\nexport { InstructAiDoc, InstructAiDocSet, MergeProcessDoc } from './instruct-ai-docs';\nexport { MERGE_PROCESS_DOC, MergeProcessText, MergeRun, ReferenceMergeRun } from './merge-process-doc';\nexport { BUILD_LOG_DOC } from './build-log-doc';\nexport { validateWebpiecesConfig, validatePrGateSection, validateChecklistsSection, validateSectionPlacement, validateExcludePaths, validateMatchRulesSection, allRuleNames, recommendedSeedMode, recommendedSeedModeFor, seedEntryForRule } from './validate-config';\nexport { validateCommandsSection } from './commands-section-validators';\nexport { unknownKeyErrors, isCommentKey, validateTopLevelKeys, COMMENT_KEY_SUFFIX } from './config-key-rules';\n// The retired-key table + the no-back-compat policy it enforces. Exported so the installer can migrate\n// what the errors instruct, and so consumers can enumerate retirements.\nexport { RETIRED_CONFIG_KEYS, RETIRED_SCOPE_KEY, RETIRED_SCOPE_RULE, RetiredConfigKey, isRetiredKey, retiredEntry, retiredKeyError, retiredKeyErrorsIn, retiredRuleFor } from './retired-config-keys';\n// The MECHANICAL cure the unknown-rule error and the banner both name: strip every key no validator has a\n// schema for, so cleanliness is one command rather than a judgement call made while every Bash call is\n// blocked. `PRUNE_UNKNOWN_COMMAND` (constants.ts) is the single spelling of that command.\nexport { ConfigPruner, PruneResult, PrunedKey } from './config-pruner';\nexport { validateChecklistDocs } from './checklist-docs-validator';\n// The OPTIONAL machine-local `~/.webpieces/config.json`: absent (the normal state for every consumer) means\n// each key's declared default, silently; present means STRICT about what it understands and FORWARD-COMPATIBLE\n// about what it does not. A retired key (its own retirement table), a known key of the wrong TYPE and an\n// unparseable document all REJECT; a key this release simply does not recognise is IGNORED with a warning,\n// because the file is machine-global and the repos reading it pin different releases — rejecting a newer\n// release's key would hard-block every repo on the machine that is not yet on it. See home-config.ts.\n// `isHomeConfigPath` is what grants the file its unconditional Write/Edit PASS in the hook guards, which is\n// what keeps a rejection repairable. Every `experimental.*` key is an OPT-IN that defaults OFF, including\n// `whole-repo-build-guard`: ON requires an explicit `true`, and there is no per-key default to export.\nexport {\n HomeConfig, HomeConfigService, RetiredHomeConfigKey, RETIRED_HOME_CONFIG_KEYS,\n HOME_CONFIG_DIR, HOME_CONFIG_FILE, HOME_EXPERIMENTAL_SECTION, HOME_KEY_BUILD_GATE_LOG_CAPTURE,\n HOME_KEY_ORPHAN_DIR_SWEEP, HOME_KEY_WHOLE_REPO_BUILD_GUARD,\n} from './home-config';\n// The orphan-directory sweep: the corpse an `nx g move` leaves on every clone, which git cannot remove\n// because an ignored dist/ or node_modules/ outlives every tracked file under it. See orphan-dir-scan.ts\n// for why the predicate is git's own `clean -Xdn` answer rather than a hand-rolled ignore walk.\nexport { OrphanDirScanner, OrphanCandidate } from './orphan-dir-scan';\nexport {\n OrphanDirArchiver, ArchivedOrphan, FailedOrphan, OrphanSweepResult, OrphanSweepManifest,\n TRASH_STATE_DIR, TRASH_MANIFEST_FILE, TRASH_RETENTION_DAYS,\n} from './orphan-dir-archive';\nexport { OrphanDirSweeper, OrphanSweepReport } from './orphan-dir-sweep';\nexport {\n MatchRuleConfig,\n MatchRuleViolation,\n findMatchRuleViolations,\n isMatchRuleAllowedPath,\n compileMatchRulePatterns,\n renderMatchRuleMessage,\n DEFAULT_MATCH_RULES,\n} from './match-rules-config';\nexport type { ConfigSection } from './sections';\nexport { schemaFieldNames } from './rule-schemas';\nexport { HOOK_GUARD_NAMES, BRANCH_STATE_GUARD_KEY, PR_LIFECYCLE_GUARD_KEY, isHookGuard, sectionForRule } from './sections';\nexport { FieldDef } from './field-def';\nexport type { SchemaShape } from './field-def';\nexport { shouldSkipRule, getCurrentBranch } from './skip-rule';\nexport { SkipRuleResult } from './skip-rule';\nexport {\n detectBase,\n resolveBase,\n getChangedFiles,\n getFileDiff,\n getChangedLineNumbers,\n findNewMethodSignaturesInDiff,\n hasChangesInRange,\n isNewOrModified,\n DiffScope,\n DiffRange,\n ChangedFilesOptions,\n} from './diff-scope';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n RULE_NAMES,\n hasDisable,\n WEBPIECES_TMP_DIR,\n MERGE_INFO_DIR,\n PR_REVIEW_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n PUSH_DEV_STATE_FILE,\n PRUNE_UNKNOWN_COMMAND,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n SyncFlowGuidance,\n WP_START_UPDATE,\n WP_FINISH_UPDATE,\n WP_START_UPSERT_PR,\n WP_FINISH_UPSERT_PR,\n WP_PUSH_DEV,\n WP_FINISH_PUSH_DEV,\n} from './sync-flow-guidance';\nexport {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoCustomCssConfig,\n NoProcessExitOutsideMainConfig,\n NoFunctionOutsideClassConfig,\n InjectAnnotationNotNeededForConcreteClassConfig,\n FrameworkTagConfig,\n RoleTagConfig,\n BranchCreationGuardConfig,\n PrLifecycleGuardConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NxWiringConfig,\n DiGraphConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n ValidateArchitectureUnchangedConfig,\n ValidateNoArchitectureCyclesConfig,\n ValidatePackageJsonConfig,\n ValidateVersionsLockedConfig,\n ValidateEslintSyncConfig,\n BaseRuleConfig,\n} from './rule-configs';\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\nexport {\n METHOD_LIMIT_MODES,\n FILE_LIMIT_MODES,\n RETURN_TYPE_MODES,\n INLINE_TYPE_MODES,\n MODIFIED_CODE_MODES,\n PROJECT_MODES,\n PRISMA_DTOS_MODES,\n PRISMA_CONVERTER_MODES,\n DIRECT_API_RESOLVER_MODES,\n THROW_CAUSE_MODES,\n ON_OFF_MODES,\n STRUCTURAL_MODES,\n VALIDATE_TS_MODES,\n} from './rule-configs';\nexport {\n NoClientCreationOutsideServerOrClientConfig,\n CLIENT_CREATION_SEVERITIES,\n} from './no-client-creation-config';\nexport type { ClientCreationSeverity } from './no-client-creation-config';\nexport type {\n MethodLimitMode,\n FileLimitMode,\n ReturnTypeMode,\n InlineTypeMode,\n ModifiedCodeMode,\n ProjectMode,\n PrismaValidateDtosMode,\n PrismaConverterMode,\n DirectApiResolverMode,\n ThrowCauseMode,\n OnOffMode,\n StructuralMode,\n ValidateTsMode,\n} from './rule-configs';\nexport {\n BranchStateGuardConfig,\n} from './main-sync-guard-configs';\nexport {\n GateDefinition,\n PrGateConfig,\n DEFAULT_BUILD_COMMAND,\n LandPrConfig,\n DevDeployConfig,\n DEFAULT_DEV_BRANCH_NAMESPACE,\n DEFAULT_DEV_BRANCH,\n ReviewContextEntry,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n defaultDevDeployConfig,\n buildPrGateConfig,\n buildLandPrConfig,\n buildDevDeployConfig,\n MERGE_MODE_AUTO,\n MERGE_MODE_NONE,\n MERGE_MODES,\n} from './pr-gate-config';\nexport {\n ChecklistDefinition,\n toChecklist,\n normalizeChecklistDoc,\n formatFileList,\n} from './checklist-config';\nexport type { RawChecklistItem } from './checklist-config';\nexport { ChecklistValidator } from './checklist-validator';\nexport { ChecklistInstructionsService } from './checklist-instructions';\nexport {\n ReviewerInstructionsService,\n ReviewerBriefing,\n BriefedFile,\n ContextEntry,\n READ_TRUNCATION_LINES,\n ALL_DIFF_ONE_READ_LINES,\n} from './reviewer-instructions';\nexport {\n GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ReviewerEvidence,\n ReviewerContext,\n TranscriptScan,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n ReviewJson,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n loadReviewJson,\n prDirFor,\n reviewJsonPath,\n reviewJsonSchemaHint,\n} from './review-json';\nexport {\n MainSyncStatus,\n MainSyncStatusFile,\n MainSyncFileStore,\n PullRequestIndex,\n MAIN_SYNC_STATUS_VERSION,\n} from './main-sync-file';\nexport {\n MainSyncLock,\n MainSyncStatusService,\n DEFAULT_HANG_TIMEOUT_MINUTES,\n mainSyncStatusPath,\n mainSyncLockPath,\n readMainSyncStatus,\n readMainSyncStatusFile,\n writeMainSyncStatus,\n writeMainSyncStatusFile,\n computeAllMainSyncStatuses,\n readMainSyncLock,\n writeMainSyncLock,\n isLockStale,\n isRefreshInProgress,\n tryAcquireMainSyncLock,\n inProcessLock,\n finishedLock,\n computeMainSyncStatus,\n stampCleanMainSyncStatus,\n squashRecoverySteps,\n} from './main-sync-status';\nexport {\n MergedBranch,\n DeletableBranch,\n DeletableWorktree,\n MergedBranchesCache,\n MergedBranchesService,\n CacheFreshness,\n CACHE_STALE_AFTER_MS,\n CLASSIFICATION_MERGED_PR,\n CLASSIFICATION_BACKUP_OF_MERGED,\n CLASSIFICATION_BACKUP_OF_LIVE,\n CLASSIFICATION_NO_COMMITS,\n CLASSIFICATION_SUPERSEDED,\n CLASSIFICATION_CONTENT_IN_MAIN,\n CLASSIFICATION_NEVER_PROPOSED,\n CLASSIFICATION_IN_USE,\n CLASSIFICATION_PRUNABLE,\n CLASSIFICATION_LOCKED,\n CLASSIFICATION_CURRENT,\n CLASSIFICATION_DETACHED,\n PROMPTABLE_CLASSIFICATIONS,\n} from './merged-branches';\nexport {\n BranchArchiver,\n ArchiveResult,\n ARCHIVE_TAG_PREFIX,\n BRANCH_RETENTIONS,\n BRANCH_RETENTION_DELETE,\n BRANCH_RETENTION_ARCHIVE_TAG,\n BRANCH_RETENTION_KEEP,\n} from './branch-archiver';\nexport {\n Worktree,\n WorktreeService,\n} from './worktrees';\nexport {\n ReapedBranch,\n ReapResult,\n BranchReaper,\n} from './branch-reaper';\nexport {\n ReapedWorktree,\n WorktreeReapResult,\n WorktreeReaper,\n} from './worktree-reaper';\nexport type { MutationVerb, MutationPhase } from './branch-mutation-log';\nexport {\n BranchMutationEvent,\n BranchMutationLog,\n branchMutationLogPath,\n logBranchMutation,\n} from './branch-mutation-log';\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/index.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,iCAA0E;AAAjE,uGAAA,cAAc,OAAA;AAAE,2GAAA,kBAAkB,OAAA;AAC3C,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,qDAA+F;AAAtF,gHAAA,aAAa,OAAA;AAAE,sHAAA,mBAAmB,OAAA;AAAE,yHAAA,sBAAsB,OAAA;AACnE,uGAAuG;AACvG,sFAAsF;AACtF,2CAAwD;AAA/C,oGAAA,MAAM,OAAA;AAAE,8GAAA,gBAAgB,OAAA;AACjC,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,uCAAiF;AAAxE,oGAAA,QAAQ,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mGAAA,OAAO,OAAA;AAC5D,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAChB,uCAAqC;AAA5B,mGAAA,OAAO,OAAA;AAChB,6CAA4E;AAAnE,8GAAA,eAAe,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,2GAAA,YAAY,OAAA;AACpD,iGAAiG;AACjG,sCAAsC;AACtC,6DAM+B;AAL3B,+HAAA,wBAAwB,OAAA;AACxB,wHAAA,iBAAiB,OAAA;AACjB,yHAAA,kBAAkB,OAAA;AAClB,+HAAA,wBAAwB,OAAA;AACxB,+HAAA,wBAAwB,OAAA;AAE5B,6CAAkJ;AAAzI,6GAAA,cAAc,OAAA;AAAE,8GAAA,eAAe,OAAA;AAAE,yGAAA,UAAU,OAAA;AAAE,iHAAA,kBAAk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BAAiB,OAAA;AACjB,8HAAA,uBAAuB,OAAA;AAE3B,mEAAgE;AAAvD,8HAAA,oBAAoB,OAAA;AAC7B,iDAIyB;AAHrB,6GAAA,YAAY,OAAA;AACZ,2GAAA,UAAU,OAAA;AACV,6GAAA,YAAY,OAAA;AAEhB,qDAI2B;AAHvB,iHAAA,cAAc,OAAA;AACd,qHAAA,kBAAkB,OAAA;AAClB,iHAAA,cAAc,OAAA;AAGlB,6DAK+B;AAJ3B,0HAAA,mBAAmB,OAAA;AACnB,wHAAA,iBAAiB,OAAA;AACjB,4HAAA,qBAAqB,OAAA;AACrB,wHAAA,iBAAiB,OAAA;AAErB,qDAK2B;AAJvB,iHAAA,cAAc,OAAA;AACd,sHAAA,mBAAmB,OAAA;AACnB,4HAAA,yBAAyB,OAAA;AACzB,iIAAA,8BAA8B,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\nexport { InformAiError } from './inform-ai-error';\nexport { RuleFailError, renderRuleFailForAi, renderRuleFailForHuman } from './rule-fail-error';\n// THE one representation of a cure, shared by RuleFailError (build-time) and FixHint (edit-time), plus\n// the one renderer that owns the \"Fix Option N:\" numbering and the \"(preferred)\" tag.\nexport { Option, formatFixOptions } from './fix-option';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliFlag, CliArgSet, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\nexport { toError } from './to-error';\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\n// The validation-failure banner: ONE cure (edit the file), plus the marker phrases the validator\n// messages embed rather than re-type.\nexport {\n formatConfigErrorsBanner,\n CONFIG_POLICY_DOC,\n RETIRED_KEY_MARKER,\n RETIRED_TOP_LEVEL_MARKER,\n SECTION_PLACEMENT_MARKER,\n} from './config-error-banner';\nexport { findConfigFile, CONFIG_FILENAME, ConfigFile, ConfigParseAttempt, CONFIG_PARSE_ATTEMPTS, CONFIG_PARSE_RETRY_MILLIS } from './config-file';\n// The PARSED-BUT-UNVALIDATED config shape. Exported for readers that walk the file generically rather\n// than through the typed config (the pr-gate active-hatch dashboard section reads every rule's hatches).\nexport type { RawConfigFile } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR, INSTRUCT_AI_LEAF } from './repo-root';\n// The scoped `.webpieces` resolver. EVERY reader/writer of `.webpieces/...` goes through one of its two\n// named methods so the call site declares whether the state is repo-wide or worktree-private.\nexport { DotWebpieces, dotWebpieces, GitDirs, WORKTREE_STATE_DIR, LOGS_STATE_DIR } from './state-dir';\nexport { StateDirMigrator, StateMigrationReport } from './state-dir-migration';\n// There is NO machine-global state root. `MachineStateHome`/`StateHome`/`WEBPIECES_STATE_HOME` and the\n// `PrBodyStore` that used them are DELETED: the one artifact that needed a scope above the clone was the\n// gated squash body, and GitHub holds it now (it IS the PR description). Every `.webpieces` path a\n// webpieces tool writes is `{repo}/.webpieces`, resolved through `DotWebpieces` above. See\n// `decisions/0005-the-pr-description-is-the-merge-body.md`.\nexport { AgedTreeSweeper, SweepCount, RETENTION_DAYS } from './aged-tree-sweep';\nexport { ClaudeEnv, claudeEnv, CLAUDE_PROJECT_DIR_ENV, CLAUDE_PROJECT_DIR_UNSET } from './claude-env';\nexport { AtomicFile } from './atomic-file';\n// The ONE formatter for a remedy that must run in a named directory: `cd '<root>' && <command>`.\n// Single-quoted so a repo path containing a space is still runnable (and still un-smuggleable).\nexport { atRoot } from './at-root';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths, isWebpiecesStateDir } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\n// THE one `no-custom-css` path exemption. Both engines that enforce the rule (the edit-time hook and the\n// CI validator) consult this class, so `allowGlobs` cannot be honoured by one half and ignored by the other.\nexport { NoCustomCssScope } from './no-custom-css-scope';\nexport { defaultRules, defaultRulesDir } from './default-rules';\nexport { loadTemplate, writeTemplateIfMissing, writeTemplate, TemplateWriter } from './load-template';\n// The instruct-ai docs are delivered as a SET: writing one writes the transitive closure of the docs it\n// links to, so a doc and everything it points at always land together. See instruct-ai-docs.ts.\nexport { InstructAiDoc, InstructAiDocSet, MergeProcessDoc } from './instruct-ai-docs';\nexport { MERGE_PROCESS_DOC, MergeProcessText, MergeRun, ReferenceMergeRun } from './merge-process-doc';\nexport { BUILD_LOG_DOC } from './build-log-doc';\nexport { validateWebpiecesConfig, validatePrGateSection, validateChecklistsSection, validateSectionPlacement, validateExcludePaths, validateMatchRulesSection, allRuleNames, recommendedSeedMode, recommendedSeedModeFor, seedEntryForRule } from './validate-config';\nexport { validateCommandsSection } from './commands-section-validators';\nexport { unknownKeyErrors, isCommentKey, validateTopLevelKeys, COMMENT_KEY_SUFFIX } from './config-key-rules';\n// The retired-key table + the no-back-compat policy it enforces. Exported so the installer can migrate\n// what the errors instruct, and so consumers can enumerate retirements.\nexport { RETIRED_CONFIG_KEYS, RETIRED_SCOPE_KEY, RETIRED_SCOPE_RULE, RetiredConfigKey, isRetiredKey, retiredEntry, retiredKeyError, retiredKeyErrorsIn, retiredRuleFor } from './retired-config-keys';\n// The MECHANICAL cure the unknown-rule error and the banner both name: strip every key no validator has a\n// schema for, so cleanliness is one command rather than a judgement call made while every Bash call is\n// blocked. `PRUNE_UNKNOWN_COMMAND` (constants.ts) is the single spelling of that command.\nexport { ConfigPruner, PruneResult, PrunedKey } from './config-pruner';\nexport { validateChecklistDocs } from './checklist-docs-validator';\n// The OPTIONAL machine-local `~/.webpieces/config.json`: absent (the normal state for every consumer) means\n// each key's declared default, silently; present means STRICT about what it understands and FORWARD-COMPATIBLE\n// about what it does not. A retired key (its own retirement table), a known key of the wrong TYPE and an\n// unparseable document all REJECT; a key this release simply does not recognise is IGNORED with a warning,\n// because the file is machine-global and the repos reading it pin different releases — rejecting a newer\n// release's key would hard-block every repo on the machine that is not yet on it. See home-config.ts.\n// `isHomeConfigPath` is what grants the file its unconditional Write/Edit PASS in the hook guards, which is\n// what keeps a rejection repairable. Every `experimental.*` key is an OPT-IN that defaults OFF, including\n// `whole-repo-build-guard`: ON requires an explicit `true`, and there is no per-key default to export.\nexport {\n HomeConfig, HomeConfigService, RetiredHomeConfigKey, RETIRED_HOME_CONFIG_KEYS,\n HOME_CONFIG_DIR, HOME_CONFIG_FILE, HOME_EXPERIMENTAL_SECTION, HOME_KEY_BUILD_GATE_LOG_CAPTURE,\n HOME_KEY_ORPHAN_DIR_SWEEP, HOME_KEY_WHOLE_REPO_BUILD_GUARD,\n} from './home-config';\n// The orphan-directory sweep: the corpse an `nx g move` leaves on every clone, which git cannot remove\n// because an ignored dist/ or node_modules/ outlives every tracked file under it. See orphan-dir-scan.ts\n// for why the predicate is git's own `clean -Xdn` answer rather than a hand-rolled ignore walk.\nexport { OrphanDirScanner, OrphanCandidate } from './orphan-dir-scan';\nexport {\n OrphanDirArchiver, ArchivedOrphan, FailedOrphan, OrphanSweepResult, OrphanSweepManifest,\n TRASH_STATE_DIR, TRASH_MANIFEST_FILE, TRASH_RETENTION_DAYS,\n} from './orphan-dir-archive';\nexport { OrphanDirSweeper, OrphanSweepReport } from './orphan-dir-sweep';\nexport {\n MatchRuleConfig,\n MatchRuleViolation,\n findMatchRuleViolations,\n isMatchRuleAllowedPath,\n compileMatchRulePatterns,\n renderMatchRuleMessage,\n DEFAULT_MATCH_RULES,\n} from './match-rules-config';\nexport type { ConfigSection } from './sections';\nexport { schemaFieldNames } from './rule-schemas';\nexport { HOOK_GUARD_NAMES, BRANCH_STATE_GUARD_KEY, PR_LIFECYCLE_GUARD_KEY, isHookGuard, sectionForRule } from './sections';\nexport { FieldDef } from './field-def';\nexport type { SchemaShape } from './field-def';\nexport { shouldSkipRule, getCurrentBranch } from './skip-rule';\nexport { SkipRuleResult } from './skip-rule';\nexport {\n detectBase,\n resolveBase,\n getChangedFiles,\n getFileDiff,\n getChangedLineNumbers,\n findNewMethodSignaturesInDiff,\n hasChangesInRange,\n isNewOrModified,\n DiffScope,\n DiffRange,\n ChangedFilesOptions,\n} from './diff-scope';\nexport { AbstractRule } from './abstract-rule';\nexport {\n WEBPIECES_DISABLE,\n RULE_NAMES,\n hasDisable,\n WEBPIECES_TMP_DIR,\n MERGE_INFO_DIR,\n PR_REVIEW_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n PUSH_DEV_STATE_FILE,\n PRUNE_UNKNOWN_COMMAND,\n} from './constants';\nexport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nexport {\n SyncFlowGuidance,\n WP_START_UPDATE,\n WP_FINISH_UPDATE,\n WP_START_UPSERT_PR,\n WP_FINISH_UPSERT_PR,\n WP_PUSH_DEV,\n WP_FINISH_PUSH_DEV,\n} from './sync-flow-guidance';\nexport {\n MaxMethodLinesConfig,\n MaxFileLinesConfig,\n RequireReturnTypeConfig,\n NoInlineTypeLiteralsConfig,\n NoAnyUnknownConfig,\n NoImplicitAnyConfig,\n PrismaValidateDtosConfig,\n PrismaConverterConfig,\n NoDestructureConfig,\n NoUnmanagedExceptionsConfig,\n CatchErrorPatternConfig,\n ThrowCauseRequiredConfig,\n AngularNoDirectApiInResolverConfig,\n NoSymbolDiTokensConfig,\n NoCustomCssConfig,\n NoProcessExitOutsideMainConfig,\n NoFunctionOutsideClassConfig,\n InjectAnnotationNotNeededForConcreteClassConfig,\n FrameworkTagConfig,\n RoleTagConfig,\n BranchCreationGuardConfig,\n PrLifecycleGuardConfig,\n NoFileImportCyclesConfig,\n RuntimeArchitectureConfig,\n NxWiringConfig,\n DiGraphConfig,\n NoJsFilesConfig,\n ValidateTsInSrcConfig,\n ValidateArchitectureUnchangedConfig,\n ValidateNoArchitectureCyclesConfig,\n ValidatePackageJsonConfig,\n ValidateVersionsLockedConfig,\n ValidateEslintSyncConfig,\n BaseRuleConfig,\n} from './rule-configs';\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\nexport {\n METHOD_LIMIT_MODES,\n FILE_LIMIT_MODES,\n RETURN_TYPE_MODES,\n INLINE_TYPE_MODES,\n MODIFIED_CODE_MODES,\n PROJECT_MODES,\n PRISMA_DTOS_MODES,\n PRISMA_CONVERTER_MODES,\n DIRECT_API_RESOLVER_MODES,\n THROW_CAUSE_MODES,\n ON_OFF_MODES,\n STRUCTURAL_MODES,\n VALIDATE_TS_MODES,\n} from './rule-configs';\nexport {\n NoClientCreationOutsideServerOrClientConfig,\n CLIENT_CREATION_SEVERITIES,\n} from './no-client-creation-config';\nexport type { ClientCreationSeverity } from './no-client-creation-config';\nexport type {\n MethodLimitMode,\n FileLimitMode,\n ReturnTypeMode,\n InlineTypeMode,\n ModifiedCodeMode,\n ProjectMode,\n PrismaValidateDtosMode,\n PrismaConverterMode,\n DirectApiResolverMode,\n ThrowCauseMode,\n OnOffMode,\n StructuralMode,\n ValidateTsMode,\n} from './rule-configs';\nexport {\n BranchStateGuardConfig,\n} from './main-sync-guard-configs';\nexport {\n GateDefinition,\n PrGateConfig,\n DEFAULT_BUILD_COMMAND,\n LandPrConfig,\n DevDeployConfig,\n DEFAULT_DEV_BRANCH_NAMESPACE,\n DEFAULT_DEV_BRANCH,\n ReviewContextEntry,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n defaultDevDeployConfig,\n buildPrGateConfig,\n buildLandPrConfig,\n buildDevDeployConfig,\n MERGE_MODE_AUTO,\n MERGE_MODE_NONE,\n MERGE_MODES,\n} from './pr-gate-config';\nexport {\n ChecklistDefinition,\n toChecklist,\n normalizeChecklistDoc,\n formatFileList,\n} from './checklist-config';\nexport type { RawChecklistItem } from './checklist-config';\nexport { ChecklistValidator } from './checklist-validator';\nexport { ChecklistInstructionsService } from './checklist-instructions';\nexport {\n ReviewerInstructionsService,\n ReviewerBriefing,\n BriefedFile,\n ContextEntry,\n READ_TRUNCATION_LINES,\n ALL_DIFF_ONE_READ_LINES,\n} from './reviewer-instructions';\nexport {\n GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ReviewerEvidence,\n ReviewerContext,\n TranscriptScan,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n ReviewJson,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n loadReviewJson,\n prDirFor,\n reviewJsonPath,\n reviewJsonSchemaHint,\n} from './review-json';\nexport {\n MainSyncStatus,\n MainSyncStatusFile,\n MainSyncFileStore,\n PullRequestIndex,\n MAIN_SYNC_STATUS_VERSION,\n} from './main-sync-file';\nexport {\n MainSyncLock,\n MainSyncStatusService,\n DEFAULT_HANG_TIMEOUT_MINUTES,\n mainSyncStatusPath,\n mainSyncLockPath,\n readMainSyncStatus,\n readMainSyncStatusFile,\n writeMainSyncStatus,\n writeMainSyncStatusFile,\n computeAllMainSyncStatuses,\n readMainSyncLock,\n writeMainSyncLock,\n isLockStale,\n isRefreshInProgress,\n tryAcquireMainSyncLock,\n inProcessLock,\n finishedLock,\n computeMainSyncStatus,\n stampCleanMainSyncStatus,\n squashRecoverySteps,\n} from './main-sync-status';\nexport {\n MergedBranch,\n DeletableBranch,\n DeletableWorktree,\n MergedBranchesCache,\n MergedBranchesService,\n CacheFreshness,\n CACHE_STALE_AFTER_MS,\n CLASSIFICATION_MERGED_PR,\n CLASSIFICATION_BACKUP_OF_MERGED,\n CLASSIFICATION_BACKUP_OF_LIVE,\n CLASSIFICATION_NO_COMMITS,\n CLASSIFICATION_SUPERSEDED,\n CLASSIFICATION_CONTENT_IN_MAIN,\n CLASSIFICATION_NEVER_PROPOSED,\n CLASSIFICATION_IN_USE,\n CLASSIFICATION_PRUNABLE,\n CLASSIFICATION_LOCKED,\n CLASSIFICATION_CURRENT,\n CLASSIFICATION_DETACHED,\n PROMPTABLE_CLASSIFICATIONS,\n} from './merged-branches';\nexport {\n BranchArchiver,\n ArchiveResult,\n ARCHIVE_TAG_PREFIX,\n BRANCH_RETENTIONS,\n BRANCH_RETENTION_DELETE,\n BRANCH_RETENTION_ARCHIVE_TAG,\n BRANCH_RETENTION_KEEP,\n} from './branch-archiver';\nexport {\n Worktree,\n WorktreeService,\n} from './worktrees';\nexport {\n AgentWorktreeLock,\n AgentWorktreeLockReader,\n} from './agent-worktree-lock';\nexport { WorktreeLockVerdicts } from './worktree-lock-verdicts';\nexport {\n ReapedBranch,\n ReapResult,\n BranchReaper,\n} from './branch-reaper';\nexport {\n ReapedWorktree,\n WorktreeReapResult,\n WorktreeReaper,\n} from './worktree-reaper';\nexport type { MutationVerb, MutationPhase } from './branch-mutation-log';\nexport {\n BranchMutationEvent,\n BranchMutationLog,\n branchMutationLogPath,\n logBranchMutation,\n} from './branch-mutation-log';\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\n"]}
@@ -61,7 +61,10 @@ export declare const CLASSIFICATION_IN_USE = "in-use";
61
61
  * `in-use` would tell wp-cleanup to shut up about exactly the ones a human might want to act on.
62
62
  *
63
63
  * - PRUNABLE — the directory is already gone; `git worktree prune` is the reap, not `remove`.
64
- * - LOCKED — a human ran `git worktree lock`. Explicitly "do not touch"; never promptable.
64
+ * - LOCKED — a `git worktree lock` is standing and whatever took it still is: a running Claude
65
+ * agent, or a reason we cannot attribute to anybody. Never promptable. A lock whose
66
+ * Claude agent is provably DEAD is not this — it is judged on its branch like any
67
+ * unlocked tree, and cleared on the way out (see agent-worktree-lock.ts).
65
68
  * - CURRENT — the worktree the command is running IN. Removing your own cwd is a self-destruct.
66
69
  * - DETACHED — detached HEAD, so there is no branch to judge and no branch to archive.
67
70
  */
@@ -122,6 +125,16 @@ export declare class DeletableWorktree {
122
125
  pr: number;
123
126
  deletable: boolean;
124
127
  classification: string;
128
+ /**
129
+ * This worktree still carries a `git worktree lock` that the reap must CLEAR before it can remove
130
+ * the directory — set only for a lock whose Claude agent is provably gone (see
131
+ * agent-worktree-lock.ts). Never set for a human lock or a live agent's: those are spared outright
132
+ * and never reach the reaper at all.
133
+ *
134
+ * A field rather than a constructor parameter for the same reason ReapedWorktree.archiveTag is:
135
+ * it is an annotation on an already-computed verdict, not one of the things the verdict IS.
136
+ */
137
+ unlockBeforeRemove: boolean;
125
138
  constructor(path: string, branch: string, reason: string, pr: number, deletable: boolean, classification?: string);
126
139
  }
127
140
  /**
@@ -73,7 +73,10 @@ exports.CLASSIFICATION_IN_USE = 'in-use';
73
73
  * `in-use` would tell wp-cleanup to shut up about exactly the ones a human might want to act on.
74
74
  *
75
75
  * - PRUNABLE — the directory is already gone; `git worktree prune` is the reap, not `remove`.
76
- * - LOCKED — a human ran `git worktree lock`. Explicitly "do not touch"; never promptable.
76
+ * - LOCKED — a `git worktree lock` is standing and whatever took it still is: a running Claude
77
+ * agent, or a reason we cannot attribute to anybody. Never promptable. A lock whose
78
+ * Claude agent is provably DEAD is not this — it is judged on its branch like any
79
+ * unlocked tree, and cleared on the way out (see agent-worktree-lock.ts).
77
80
  * - CURRENT — the worktree the command is running IN. Removing your own cwd is a self-destruct.
78
81
  * - DETACHED — detached HEAD, so there is no branch to judge and no branch to archive.
79
82
  */
@@ -158,6 +161,16 @@ class DeletableWorktree {
158
161
  pr;
159
162
  deletable;
160
163
  classification;
164
+ /**
165
+ * This worktree still carries a `git worktree lock` that the reap must CLEAR before it can remove
166
+ * the directory — set only for a lock whose Claude agent is provably gone (see
167
+ * agent-worktree-lock.ts). Never set for a human lock or a live agent's: those are spared outright
168
+ * and never reach the reaper at all.
169
+ *
170
+ * A field rather than a constructor parameter for the same reason ReapedWorktree.archiveTag is:
171
+ * it is an annotation on an already-computed verdict, not one of the things the verdict IS.
172
+ */
173
+ unlockBeforeRemove = false;
161
174
  // eslint-disable-next-line @typescript-eslint/max-params
162
175
  constructor(path, branch, reason, pr, deletable, classification = exports.CLASSIFICATION_NEVER_PROPOSED) {
163
176
  this.path = path;
@@ -1 +1 @@
1
- {"version":3,"file":"merged-branch-verdicts.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/merged-branch-verdicts.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAA+C;AAC/C,MAAa,YAAY;IACrB,MAAM,CAAS;IACf,EAAE,CAAS;IAEX,YAAY,MAAc,EAAE,EAAU;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,CAAC;CACJ;AARD,oCAQC;AAED;;;;;;;;;;GAUG;AACH,mGAAmG;AACnG,yEAAyE;AAC5D,QAAA,wBAAwB,GAAG,WAAW,CAAC;AACvC,QAAA,+BAA+B,GAAG,kBAAkB,CAAC;AAClE;;;;;;;;;;;GAWG;AACU,QAAA,6BAA6B,GAAG,gBAAgB,CAAC;AAC9D;;;;;;;;;;;;;GAaG;AACU,QAAA,yBAAyB,GAAG,YAAY,CAAC;AACtD,2FAA2F;AAC9E,QAAA,yBAAyB,GAAG,YAAY,CAAC;AACzC,QAAA,8BAA8B,GAAG,yBAAyB,CAAC;AAC3D,QAAA,6BAA6B,GAAG,gBAAgB,CAAC;AAC9D,gFAAgF;AACnE,QAAA,qBAAqB,GAAG,QAAQ,CAAC;AAE9C;;;;;;;;;GASG;AACU,QAAA,uBAAuB,GAAG,mBAAmB,CAAC;AAC9C,QAAA,qBAAqB,GAAG,iBAAiB,CAAC;AAC1C,QAAA,sBAAsB,GAAG,kBAAkB,CA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I,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACzC,CAAC;CACJ;AAxBD,8CAwBC;AAED;;;;;;;GAOG;AACH,MAAa,mBAAmB;IAC5B,SAAS,CAAS;IAClB,SAAS,CAAoB;IAC7B,IAAI,CAAoB;IACxB,SAAS,CAAsB;IAE/B,YACI,SAAiB,EACjB,SAA4B,EAC5B,IAAuB,EACvB,YAAiC,EAAE;QAEnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ;AAjBD,kDAiBC;AAED;;;;;;;;;;;GAWG;AACU,QAAA,oBAAoB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AAElD;;;GAGG;AACH,MAAa,cAAc;IACvB,sGAAsG;IACtG,KAAK,CAAU;IACf,qFAAqF;IACrF,UAAU,CAAS;IACnB,2FAA2F;IAC3F,SAAS,CAAS;IAElB,YAAY,KAAc,EAAE,UAAkB,EAAE,SAAiB;QAC7D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ;AAbD,wCAaC","sourcesContent":["/**\n * The VERDICT vocabulary — every data class and stable classification token the branch/worktree\n * cleanup story is written in. Split out of merged-branches.ts, which holds the SERVICE that produces\n * these values; this file holds only what they mean.\n *\n * Re-exported from merged-branches.ts, so every existing import path keeps working.\n */\n\n// Data-only (per CLAUDE.md, classes for data).\nexport class MergedBranch {\n branch: string;\n pr: number;\n\n constructor(branch: string, pr: number) {\n this.branch = branch;\n this.pr = pr;\n }\n}\n\n/**\n * WHY a branch is dead, or why it was spared — as a STABLE token, alongside the English prose.\n *\n * `sha`/`commits`/`prState` (below) let a human SEE a spared branch. This adds the other half: a token\n * saying WHICH KIND of spared it is. Every spared branch used to report the identical string\n * `no merged PR found — a human must decide`, and in one observed repo that one string covered three\n * genuinely different situations — a PR CLOSED UNMERGED whose work landed under a later number, a\n * branch that NEVER had a PR and holds the only copy of its commits, and content already in main.\n * Reporting all three identically is why nobody ever decided, and why the pile grew to 6 branches\n * against a cap of 5. A token lets wp-cleanup GROUP them and ask a question that can be answered.\n */\n// Dead by proof — these are auto-deletable. Two proofs qualify: a MERGED PR, or a LIVE SIBLING REF\n// that provably holds the same work (see CLASSIFICATION_BACKUP_OF_LIVE).\nexport const CLASSIFICATION_MERGED_PR = 'merged-pr';\nexport const CLASSIFICATION_BACKUP_OF_MERGED = 'backup-of-merged';\n/**\n * A `<feature>PreMerge<N>` / `<feature>Squash` snapshot whose BASE branch is still alive — its PR is\n * open, or it simply has not been proposed yet.\n *\n * AUTO-DELETABLE. A snapshot is a copy of its base BY CONSTRUCTION, so while the base exists this\n * branch cannot be \"the only copy in existence\" — that is a proof, not a judgement call, and it is\n * why this is reaped rather than asked about. It used to be the FIRST promptable group (\"the easiest\n * yes in the list\"), which is precisely the tell: a question whose only honest answer is yes should\n * never have been a question. `wp-start-upsert-pr` mints one of these on every run, so leaving them\n * to a human meant the branch cap filled with copies and the cap's own remedy became \"ask the human\n * to adjudicate six branches\" — the toil this whole story exists to remove.\n */\nexport const CLASSIFICATION_BACKUP_OF_LIVE = 'backup-of-live';\n/**\n * NOT a proof of death — a SPARED verdict, and the reason this whole liveness model exists.\n *\n * \"Zero commits of its own\" used to be auto-deletable, on the reasoning that a branch holding no\n * commits can lose no work. That reasoning is true of a REF and false of a WORKING TREE: every\n * worktree created with `git worktree add -b … origin/main` has zero commits from the moment it is\n * created until its first commit — i.e. for exactly the window in which an agent is doing its work\n * in it. Observed 2026-07-30: three worktrees with live agents in them were listed as dead, under\n * the sentence \"so no work can be lost\".\n *\n * Liveness is now the same single rule branches already use: reapable == a MERGED PR. Anything not\n * provably merged is LIVE, and live means it is never deleted without an explicit human answer. A\n * genuine husk still gets cleaned up — it is PROMPTABLE (see below), so wp-cleanup asks.\n */\nexport const CLASSIFICATION_NO_COMMITS = 'no-commits';\n// Spared, but a human should be ASKED — in descending order of \"obviously fine to delete\".\nexport const CLASSIFICATION_SUPERSEDED = 'superseded';\nexport const CLASSIFICATION_CONTENT_IN_MAIN = 'content-already-in-main';\nexport const CLASSIFICATION_NEVER_PROPOSED = 'never-proposed';\n// Spared for a mechanical reason, not a judgement call (checked out somewhere).\nexport const CLASSIFICATION_IN_USE = 'in-use';\n\n/**\n * WORKTREE-only classifications. A worktree verdict borrows every token above (its branch is what is\n * being judged), but three of its outcomes have no branch analogue at all, and lumping them under\n * `in-use` would tell wp-cleanup to shut up about exactly the ones a human might want to act on.\n *\n * - PRUNABLE — the directory is already gone; `git worktree prune` is the reap, not `remove`.\n * - LOCKED — a human ran `git worktree lock`. Explicitly \"do not touch\"; never promptable.\n * - CURRENT — the worktree the command is running IN. Removing your own cwd is a self-destruct.\n * - DETACHED — detached HEAD, so there is no branch to judge and no branch to archive.\n */\nexport const CLASSIFICATION_PRUNABLE = 'prunable-worktree';\nexport const CLASSIFICATION_LOCKED = 'locked-worktree';\nexport const CLASSIFICATION_CURRENT = 'current-worktree';\nexport const CLASSIFICATION_DETACHED = 'detached-worktree';\n\n// Spared classifications a human can meaningfully rule on, most-safe first. wp-cleanup prompts in\n// exactly this order so the easy yeses come before the ones that need thought.\nexport const PROMPTABLE_CLASSIFICATIONS: readonly string[] = [\n // CLASSIFICATION_BACKUP_OF_LIVE is deliberately NOT here — it is auto-reaped now. Anything that\n // reaches this list is a real judgement call; if a group's answer is always yes, it belongs in\n // the deletable set instead of on a human's plate.\n CLASSIFICATION_SUPERSEDED,\n CLASSIFICATION_CONTENT_IN_MAIN,\n CLASSIFICATION_NEVER_PROPOSED,\n // LAST deliberately. For a parked branch this is the most obvious yes in the whole list, but the\n // identical verdict on a WORKTREE means \"an agent may be working in here right now\", and the\n // prompt cannot tell the human which one they are looking at any better than by ordering it dead\n // last, after the groups whose evidence is about the PAST rather than about work in flight.\n CLASSIFICATION_NO_COMMITS,\n];\n\n/**\n * A local branch and the verdict on it. `pr` is 0 when no merged PR backs the verdict (a `keep`).\n *\n * `sha`, `commits` and `prState` exist for the SPARED branches specifically. When nothing is\n * auto-reapable the branch cap has nothing safe to offer, and its only remaining advice was \"raise\n * maxLocalBranches\" / \"set turnOffRuleUntilEpoch\" — both of which loosen the rule. An agent with no\n * human present took the config edit, which is the exact failure the cap exists to prevent. To ask a\n * human \"may I delete these?\" instead, the guard has to be able to SHOW what it would delete: tip SHA\n * (so the delete is recoverable), PR state (closed? never opened?) and how much unique work is on it.\n *\n * All three are computed in the DETACHED refresher and read straight off merged-branches.json — the\n * blocking hook path never recomputes them. Defaulted so a cache written by an older release (and\n * every existing call site) revives without them.\n */\nexport class DeletableBranch {\n branch: string;\n reason: string;\n pr: number;\n /** Short tip SHA — what makes the delete undoable (`git branch <name> <sha>`). '' when unknown. */\n sha: string;\n /** Commits on this branch that are not on origin/main. -1 when it could not be established. */\n commits: number;\n /** GitHub's state for the PR whose head is this branch: MERGED / CLOSED / OPEN, or '' for none. */\n prState: string;\n /**\n * One of the CLASSIFICATION_* tokens. Defaulted like the fields above so every pre-existing call\n * site — and every cache written by an older release — still constructs; an unclassified revived\n * entry reads as 'never-proposed', the most conservative of the spared verdicts.\n */\n classification: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n branch: string,\n reason: string,\n pr: number,\n sha: string = '',\n commits: number = -1,\n prState: string = '',\n classification: string = CLASSIFICATION_NEVER_PROPOSED,\n ) {\n this.branch = branch;\n this.reason = reason;\n this.pr = pr;\n this.sha = sha;\n this.commits = commits;\n this.prState = prState;\n this.classification = classification;\n }\n}\n\n/**\n * A worktree and the verdict on it. Carries `path` (what `git worktree remove` takes) AND `branch`\n * (what `git branch -D` takes afterwards) because reaping a worktree is always those two steps, in\n * that order — git refuses to delete a branch that is still checked out somewhere.\n *\n * `classification` is the same STABLE token the branch verdicts carry, plus the four worktree-only\n * ones above. It exists for the same reason it does on DeletableBranch: `deletable` answers \"may the\n * tooling reap this unattended?\", and everything false used to collapse into one undifferentiated\n * \"spared\" that a human could not rule on. With a token, WorktreeReaper knows whether the reap is a\n * `prune` or a `remove`, and wp-cleanup knows which spared worktrees are worth ASKING about.\n * Defaulted so every pre-existing call site and every cache written by an older release still builds;\n * an unclassified revived entry reads as 'never-proposed', the most conservative spared verdict.\n */\nexport class DeletableWorktree {\n path: string;\n branch: string;\n reason: string;\n pr: number;\n deletable: boolean;\n classification: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n path: string,\n branch: string,\n reason: string,\n pr: number,\n deletable: boolean,\n classification: string = CLASSIFICATION_NEVER_PROPOSED,\n ) {\n this.path = path;\n this.branch = branch;\n this.reason = reason;\n this.pr = pr;\n this.deletable = deletable;\n this.classification = classification;\n }\n}\n\n/**\n * `deletable` is PRECOMPUTED so the consumer just deletes the list — no re-deriving, no judgement\n * call at block time. `keep` carries the branches we refuse to touch (no merged PR found), each with\n * its reason, so a human can see what was spared and why.\n *\n * `worktrees` is the parallel verdict list for the SECOND budget (see worktrees.ts): every linked\n * worktree, each flagged deletable or not. Both budgets are reaped from this one cache file.\n */\nexport class MergedBranchesCache {\n timestamp: string;\n deletable: DeletableBranch[];\n keep: DeletableBranch[];\n worktrees: DeletableWorktree[];\n\n constructor(\n timestamp: string,\n deletable: DeletableBranch[],\n keep: DeletableBranch[],\n worktrees: DeletableWorktree[] = [],\n ) {\n this.timestamp = timestamp;\n this.deletable = deletable;\n this.keep = keep;\n this.worktrees = worktrees;\n }\n}\n\n/**\n * How old the cache may get before a reader must stop asserting figures from it.\n *\n * The cache is ALLOWED to be stale — that is the whole design (see the file header): the slow lookup\n * runs detached, and a branch that merged 30 seconds ago simply survives to the next refresh. What is\n * NOT allowed is quoting a stale file as present-tense fact. Observed 2026-07-30: the guard announced\n * \"8 parked local branches … none of them are dead\" when there was ONE, having counted branches that\n * had been deleted minutes earlier, and then blocked a legitimate command on that figure.\n *\n * Five minutes, because the refresher is kicked off by the hooks themselves and normally rewrites the\n * file within one tool call; anything older means the refresher did not run or could not finish.\n */\nexport const CACHE_STALE_AFTER_MS = 5 * 60 * 1000;\n\n/**\n * Whether a cache read off disk may be quoted as fact, and how old it is — so a message can SAY\n * \"the cached verdicts are stale\" instead of asserting a count it cannot stand behind.\n */\nexport class CacheFreshness {\n /** True when the file is older than CACHE_STALE_AFTER_MS, or its timestamp is missing/unparseable. */\n stale: boolean;\n /** Whole minutes since the cache was written. -1 when that cannot be established. */\n ageMinutes: number;\n /** The raw ISO timestamp as recorded, or '' — printed verbatim so a human can check it. */\n timestamp: string;\n\n constructor(stale: boolean, ageMinutes: number, timestamp: string) {\n this.stale = stale;\n this.ageMinutes = ageMinutes;\n this.timestamp = timestamp;\n }\n}\n"]}
1
+ {"version":3,"file":"merged-branch-verdicts.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/merged-branch-verdicts.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,+CAA+C;AAC/C,MAAa,YAAY;IACrB,MAAM,CAAS;IACf,EAAE,CAAS;IAEX,YAAY,MAAc,EAAE,EAAU;QAClC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;IACjB,CAAC;CACJ;AARD,oCAQC;AAED;;;;;;;;;;GAUG;AACH,mGAAmG;AACnG,yEAAyE;AAC5D,QAAA,wBAAwB,GAAG,WAAW,CAAC;AACvC,QAAA,+BAA+B,GAAG,kBAAkB,CAAC;AAClE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C,GAAG,EAAE,GAAG,IAAI,CAAC;AAElD;;;GAGG;AACH,MAAa,cAAc;IACvB,sGAAsG;IACtG,KAAK,CAAU;IACf,qFAAqF;IACrF,UAAU,CAAS;IACnB,2FAA2F;IAC3F,SAAS,CAAS;IAElB,YAAY,KAAc,EAAE,UAAkB,EAAE,SAAiB;QAC7D,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC/B,CAAC;CACJ;AAbD,wCAaC","sourcesContent":["/**\n * The VERDICT vocabulary — every data class and stable classification token the branch/worktree\n * cleanup story is written in. Split out of merged-branches.ts, which holds the SERVICE that produces\n * these values; this file holds only what they mean.\n *\n * Re-exported from merged-branches.ts, so every existing import path keeps working.\n */\n\n// Data-only (per CLAUDE.md, classes for data).\nexport class MergedBranch {\n branch: string;\n pr: number;\n\n constructor(branch: string, pr: number) {\n this.branch = branch;\n this.pr = pr;\n }\n}\n\n/**\n * WHY a branch is dead, or why it was spared — as a STABLE token, alongside the English prose.\n *\n * `sha`/`commits`/`prState` (below) let a human SEE a spared branch. This adds the other half: a token\n * saying WHICH KIND of spared it is. Every spared branch used to report the identical string\n * `no merged PR found — a human must decide`, and in one observed repo that one string covered three\n * genuinely different situations — a PR CLOSED UNMERGED whose work landed under a later number, a\n * branch that NEVER had a PR and holds the only copy of its commits, and content already in main.\n * Reporting all three identically is why nobody ever decided, and why the pile grew to 6 branches\n * against a cap of 5. A token lets wp-cleanup GROUP them and ask a question that can be answered.\n */\n// Dead by proof — these are auto-deletable. Two proofs qualify: a MERGED PR, or a LIVE SIBLING REF\n// that provably holds the same work (see CLASSIFICATION_BACKUP_OF_LIVE).\nexport const CLASSIFICATION_MERGED_PR = 'merged-pr';\nexport const CLASSIFICATION_BACKUP_OF_MERGED = 'backup-of-merged';\n/**\n * A `<feature>PreMerge<N>` / `<feature>Squash` snapshot whose BASE branch is still alive — its PR is\n * open, or it simply has not been proposed yet.\n *\n * AUTO-DELETABLE. A snapshot is a copy of its base BY CONSTRUCTION, so while the base exists this\n * branch cannot be \"the only copy in existence\" — that is a proof, not a judgement call, and it is\n * why this is reaped rather than asked about. It used to be the FIRST promptable group (\"the easiest\n * yes in the list\"), which is precisely the tell: a question whose only honest answer is yes should\n * never have been a question. `wp-start-upsert-pr` mints one of these on every run, so leaving them\n * to a human meant the branch cap filled with copies and the cap's own remedy became \"ask the human\n * to adjudicate six branches\" — the toil this whole story exists to remove.\n */\nexport const CLASSIFICATION_BACKUP_OF_LIVE = 'backup-of-live';\n/**\n * NOT a proof of death — a SPARED verdict, and the reason this whole liveness model exists.\n *\n * \"Zero commits of its own\" used to be auto-deletable, on the reasoning that a branch holding no\n * commits can lose no work. That reasoning is true of a REF and false of a WORKING TREE: every\n * worktree created with `git worktree add -b … origin/main` has zero commits from the moment it is\n * created until its first commit — i.e. for exactly the window in which an agent is doing its work\n * in it. Observed 2026-07-30: three worktrees with live agents in them were listed as dead, under\n * the sentence \"so no work can be lost\".\n *\n * Liveness is now the same single rule branches already use: reapable == a MERGED PR. Anything not\n * provably merged is LIVE, and live means it is never deleted without an explicit human answer. A\n * genuine husk still gets cleaned up — it is PROMPTABLE (see below), so wp-cleanup asks.\n */\nexport const CLASSIFICATION_NO_COMMITS = 'no-commits';\n// Spared, but a human should be ASKED — in descending order of \"obviously fine to delete\".\nexport const CLASSIFICATION_SUPERSEDED = 'superseded';\nexport const CLASSIFICATION_CONTENT_IN_MAIN = 'content-already-in-main';\nexport const CLASSIFICATION_NEVER_PROPOSED = 'never-proposed';\n// Spared for a mechanical reason, not a judgement call (checked out somewhere).\nexport const CLASSIFICATION_IN_USE = 'in-use';\n\n/**\n * WORKTREE-only classifications. A worktree verdict borrows every token above (its branch is what is\n * being judged), but three of its outcomes have no branch analogue at all, and lumping them under\n * `in-use` would tell wp-cleanup to shut up about exactly the ones a human might want to act on.\n *\n * - PRUNABLE — the directory is already gone; `git worktree prune` is the reap, not `remove`.\n * - LOCKED — a `git worktree lock` is standing and whatever took it still is: a running Claude\n * agent, or a reason we cannot attribute to anybody. Never promptable. A lock whose\n * Claude agent is provably DEAD is not this — it is judged on its branch like any\n * unlocked tree, and cleared on the way out (see agent-worktree-lock.ts).\n * - CURRENT — the worktree the command is running IN. Removing your own cwd is a self-destruct.\n * - DETACHED — detached HEAD, so there is no branch to judge and no branch to archive.\n */\nexport const CLASSIFICATION_PRUNABLE = 'prunable-worktree';\nexport const CLASSIFICATION_LOCKED = 'locked-worktree';\nexport const CLASSIFICATION_CURRENT = 'current-worktree';\nexport const CLASSIFICATION_DETACHED = 'detached-worktree';\n\n// Spared classifications a human can meaningfully rule on, most-safe first. wp-cleanup prompts in\n// exactly this order so the easy yeses come before the ones that need thought.\nexport const PROMPTABLE_CLASSIFICATIONS: readonly string[] = [\n // CLASSIFICATION_BACKUP_OF_LIVE is deliberately NOT here — it is auto-reaped now. Anything that\n // reaches this list is a real judgement call; if a group's answer is always yes, it belongs in\n // the deletable set instead of on a human's plate.\n CLASSIFICATION_SUPERSEDED,\n CLASSIFICATION_CONTENT_IN_MAIN,\n CLASSIFICATION_NEVER_PROPOSED,\n // LAST deliberately. For a parked branch this is the most obvious yes in the whole list, but the\n // identical verdict on a WORKTREE means \"an agent may be working in here right now\", and the\n // prompt cannot tell the human which one they are looking at any better than by ordering it dead\n // last, after the groups whose evidence is about the PAST rather than about work in flight.\n CLASSIFICATION_NO_COMMITS,\n];\n\n/**\n * A local branch and the verdict on it. `pr` is 0 when no merged PR backs the verdict (a `keep`).\n *\n * `sha`, `commits` and `prState` exist for the SPARED branches specifically. When nothing is\n * auto-reapable the branch cap has nothing safe to offer, and its only remaining advice was \"raise\n * maxLocalBranches\" / \"set turnOffRuleUntilEpoch\" — both of which loosen the rule. An agent with no\n * human present took the config edit, which is the exact failure the cap exists to prevent. To ask a\n * human \"may I delete these?\" instead, the guard has to be able to SHOW what it would delete: tip SHA\n * (so the delete is recoverable), PR state (closed? never opened?) and how much unique work is on it.\n *\n * All three are computed in the DETACHED refresher and read straight off merged-branches.json — the\n * blocking hook path never recomputes them. Defaulted so a cache written by an older release (and\n * every existing call site) revives without them.\n */\nexport class DeletableBranch {\n branch: string;\n reason: string;\n pr: number;\n /** Short tip SHA — what makes the delete undoable (`git branch <name> <sha>`). '' when unknown. */\n sha: string;\n /** Commits on this branch that are not on origin/main. -1 when it could not be established. */\n commits: number;\n /** GitHub's state for the PR whose head is this branch: MERGED / CLOSED / OPEN, or '' for none. */\n prState: string;\n /**\n * One of the CLASSIFICATION_* tokens. Defaulted like the fields above so every pre-existing call\n * site — and every cache written by an older release — still constructs; an unclassified revived\n * entry reads as 'never-proposed', the most conservative of the spared verdicts.\n */\n classification: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n branch: string,\n reason: string,\n pr: number,\n sha: string = '',\n commits: number = -1,\n prState: string = '',\n classification: string = CLASSIFICATION_NEVER_PROPOSED,\n ) {\n this.branch = branch;\n this.reason = reason;\n this.pr = pr;\n this.sha = sha;\n this.commits = commits;\n this.prState = prState;\n this.classification = classification;\n }\n}\n\n/**\n * A worktree and the verdict on it. Carries `path` (what `git worktree remove` takes) AND `branch`\n * (what `git branch -D` takes afterwards) because reaping a worktree is always those two steps, in\n * that order — git refuses to delete a branch that is still checked out somewhere.\n *\n * `classification` is the same STABLE token the branch verdicts carry, plus the four worktree-only\n * ones above. It exists for the same reason it does on DeletableBranch: `deletable` answers \"may the\n * tooling reap this unattended?\", and everything false used to collapse into one undifferentiated\n * \"spared\" that a human could not rule on. With a token, WorktreeReaper knows whether the reap is a\n * `prune` or a `remove`, and wp-cleanup knows which spared worktrees are worth ASKING about.\n * Defaulted so every pre-existing call site and every cache written by an older release still builds;\n * an unclassified revived entry reads as 'never-proposed', the most conservative spared verdict.\n */\nexport class DeletableWorktree {\n path: string;\n branch: string;\n reason: string;\n pr: number;\n deletable: boolean;\n classification: string;\n /**\n * This worktree still carries a `git worktree lock` that the reap must CLEAR before it can remove\n * the directory — set only for a lock whose Claude agent is provably gone (see\n * agent-worktree-lock.ts). Never set for a human lock or a live agent's: those are spared outright\n * and never reach the reaper at all.\n *\n * A field rather than a constructor parameter for the same reason ReapedWorktree.archiveTag is:\n * it is an annotation on an already-computed verdict, not one of the things the verdict IS.\n */\n unlockBeforeRemove: boolean = false;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n path: string,\n branch: string,\n reason: string,\n pr: number,\n deletable: boolean,\n classification: string = CLASSIFICATION_NEVER_PROPOSED,\n ) {\n this.path = path;\n this.branch = branch;\n this.reason = reason;\n this.pr = pr;\n this.deletable = deletable;\n this.classification = classification;\n }\n}\n\n/**\n * `deletable` is PRECOMPUTED so the consumer just deletes the list — no re-deriving, no judgement\n * call at block time. `keep` carries the branches we refuse to touch (no merged PR found), each with\n * its reason, so a human can see what was spared and why.\n *\n * `worktrees` is the parallel verdict list for the SECOND budget (see worktrees.ts): every linked\n * worktree, each flagged deletable or not. Both budgets are reaped from this one cache file.\n */\nexport class MergedBranchesCache {\n timestamp: string;\n deletable: DeletableBranch[];\n keep: DeletableBranch[];\n worktrees: DeletableWorktree[];\n\n constructor(\n timestamp: string,\n deletable: DeletableBranch[],\n keep: DeletableBranch[],\n worktrees: DeletableWorktree[] = [],\n ) {\n this.timestamp = timestamp;\n this.deletable = deletable;\n this.keep = keep;\n this.worktrees = worktrees;\n }\n}\n\n/**\n * How old the cache may get before a reader must stop asserting figures from it.\n *\n * The cache is ALLOWED to be stale — that is the whole design (see the file header): the slow lookup\n * runs detached, and a branch that merged 30 seconds ago simply survives to the next refresh. What is\n * NOT allowed is quoting a stale file as present-tense fact. Observed 2026-07-30: the guard announced\n * \"8 parked local branches … none of them are dead\" when there was ONE, having counted branches that\n * had been deleted minutes earlier, and then blocked a legitimate command on that figure.\n *\n * Five minutes, because the refresher is kicked off by the hooks themselves and normally rewrites the\n * file within one tool call; anything older means the refresher did not run or could not finish.\n */\nexport const CACHE_STALE_AFTER_MS = 5 * 60 * 1000;\n\n/**\n * Whether a cache read off disk may be quoted as fact, and how old it is — so a message can SAY\n * \"the cached verdicts are stale\" instead of asserting a count it cannot stand behind.\n */\nexport class CacheFreshness {\n /** True when the file is older than CACHE_STALE_AFTER_MS, or its timestamp is missing/unparseable. */\n stale: boolean;\n /** Whole minutes since the cache was written. -1 when that cannot be established. */\n ageMinutes: number;\n /** The raw ISO timestamp as recorded, or '' — printed verbatim so a human can check it. */\n timestamp: string;\n\n constructor(stale: boolean, ageMinutes: number, timestamp: string) {\n this.stale = stale;\n this.ageMinutes = ageMinutes;\n this.timestamp = timestamp;\n }\n}\n"]}