@webpieces/rules-config 0.4.494 → 0.4.496

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/src/index.d.ts CHANGED
@@ -34,7 +34,7 @@ export { NoClientCreationOutsideServerOrClientConfig, CLIENT_CREATION_SEVERITIES
34
34
  export type { ClientCreationSeverity } from './no-client-creation-config';
35
35
  export type { MethodLimitMode, FileLimitMode, ReturnTypeMode, InlineTypeMode, ModifiedCodeMode, ProjectMode, PrismaValidateDtosMode, PrismaConverterMode, DirectApiResolverMode, ThrowCauseMode, OnOffMode, StructuralMode, ValidateTsMode, } from './rule-configs';
36
36
  export { FeatureBranchGuardConfig, ReadStaleGuardConfig, MergedBranchBashGuardConfig, StaleMainBashGuardConfig, } from './main-sync-guard-configs';
37
- export { GateDefinition, PrGateConfig, defaultGates, defaultPrGateConfig, buildPrGateConfig, MERGE_MODE_AUTO, MERGE_MODE_NONE, MERGE_MODES, } from './pr-gate-config';
37
+ export { GateDefinition, PrGateConfig, LandPrConfig, defaultGates, defaultPrGateConfig, defaultLandPrConfig, buildPrGateConfig, buildLandPrConfig, MERGE_MODE_AUTO, MERGE_MODE_NONE, MERGE_MODES, } from './pr-gate-config';
38
38
  export { ChecklistDefinition, toChecklist, normalizeChecklistDoc, formatFileList, } from './checklist-config';
39
39
  export type { RawChecklistItem } from './checklist-config';
40
40
  export { ChecklistValidator } from './checklist-validator';
@@ -43,7 +43,8 @@ export { GateTokenService, computeGateToken, gateTokenMarker, extractGateToken,
43
43
  export { SubagentProvenanceService, ProvenanceResult, PROVENANCE_OK, PROVENANCE_MISSING, PROVENANCE_SKIPPED, } from './subagent-provenance';
44
44
  export { ReviewJson, PrContext, ChecklistResult, ChecklistVerdict, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, VERDICT_GREEN, VERDICT_YELLOW, VERDICT_RED, VERDICT_STATUSES, RequiredChecklist, ChecklistReviewContext, ReviewJsonService, loadReviewJson, prDirFor, reviewJsonPath, reviewJsonSchemaHint, } from './review-json';
45
45
  export { MainSyncStatus, MainSyncLock, MainSyncStatusService, DEFAULT_HANG_TIMEOUT_MINUTES, mainSyncStatusPath, mainSyncLockPath, readMainSyncStatus, writeMainSyncStatus, readMainSyncLock, writeMainSyncLock, isLockStale, isRefreshInProgress, tryAcquireMainSyncLock, inProcessLock, finishedLock, computeMainSyncStatus, stampCleanMainSyncStatus, squashRecoverySteps, } from './main-sync-status';
46
- export { MergedBranch, DeletableBranch, DeletableWorktree, MergedBranchesCache, MergedBranchesService, } from './merged-branches';
46
+ export { MergedBranch, DeletableBranch, DeletableWorktree, MergedBranchesCache, MergedBranchesService, CLASSIFICATION_MERGED_PR, CLASSIFICATION_BACKUP_OF_MERGED, CLASSIFICATION_NO_COMMITS, CLASSIFICATION_SUPERSEDED, CLASSIFICATION_CONTENT_IN_MAIN, CLASSIFICATION_NEVER_PROPOSED, CLASSIFICATION_IN_USE, PROMPTABLE_CLASSIFICATIONS, } from './merged-branches';
47
+ export { BranchArchiver, ArchiveResult, ARCHIVE_TAG_PREFIX, BRANCH_RETENTIONS, BRANCH_RETENTION_DELETE, BRANCH_RETENTION_ARCHIVE_TAG, BRANCH_RETENTION_KEEP, } from './branch-archiver';
47
48
  export { Worktree, WorktreeService, } from './worktrees';
48
49
  export { ReapedBranch, ReapResult, BranchReaper, } from './branch-reaper';
49
50
  export type { MutationVerb, MutationPhase } from './branch-mutation-log';
package/src/index.js CHANGED
@@ -2,9 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sectionForRule = exports.isHookGuard = exports.HOOK_GUARD_NAMES = exports.DEFAULT_MATCH_RULES = exports.renderMatchRuleMessage = exports.compileMatchRulePatterns = exports.isMatchRuleAllowedPath = exports.findMatchRuleViolations = exports.MatchRuleViolation = exports.MatchRuleConfig = exports.validateChecklistDocs = exports.allRuleNames = exports.validateMatchRulesSection = exports.validateExcludePaths = exports.validateCommandsSection = exports.validateSectionPlacement = exports.validateChecklistsSection = exports.validatePrGateSection = exports.validateWebpiecesConfig = exports.TemplateWriter = exports.writeTemplate = exports.writeTemplateIfMissing = exports.loadTemplate = exports.defaultRulesDir = exports.defaultRules = exports.matchesAnyGlob = exports.isPathExcluded = exports.ExcludePaths = exports.DESIGN_METADATA_KEYS = exports.isDocumentDesign = exports.DocumentDesign = exports.RulesConfigDesign = exports.INSTRUCT_AI_DIR = exports.RepoRootFinder = exports.ConfigFile = exports.CONFIG_FILENAME = exports.findConfigFile = exports.ConfigLoader = exports.LoadedConfig = exports.loadAndValidate = exports.toError = exports.runMain = exports.CliArgs = exports.CliArgsCheck = exports.CliUsage = exports.CliExitError = exports.RuleFailError = exports.InformAiError = exports.ResolvedRuleConfig = exports.ResolvedConfig = void 0;
4
4
  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_UPSERT_PR = exports.WP_START_UPSERT_PR = exports.WP_FINISH_UPDATE = exports.WP_START_UPDATE = exports.SyncFlowGuidance = exports.WebpiecesRulesConfig = 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 = exports.ChangedFilesOptions = exports.DiffRange = exports.DiffScope = exports.isNewOrModified = exports.hasChangesInRange = exports.findNewMethodSignaturesInDiff = exports.getChangedLineNumbers = exports.getFileDiff = exports.getChangedFiles = exports.resolveBase = exports.detectBase = exports.getCurrentBranch = exports.shouldSkipRule = exports.FieldDef = void 0;
5
- exports.GateTokenService = exports.ChecklistInstructionsService = exports.ChecklistValidator = exports.formatFileList = exports.normalizeChecklistDoc = exports.toChecklist = exports.ChecklistDefinition = exports.MERGE_MODES = exports.MERGE_MODE_NONE = exports.MERGE_MODE_AUTO = exports.buildPrGateConfig = exports.defaultPrGateConfig = exports.defaultGates = exports.PrGateConfig = exports.GateDefinition = exports.StaleMainBashGuardConfig = exports.MergedBranchBashGuardConfig = exports.ReadStaleGuardConfig = exports.FeatureBranchGuardConfig = 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 = exports.ValidatePackageJsonConfig = exports.ValidateNoArchitectureCyclesConfig = exports.ValidateArchitectureUnchangedConfig = exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.DiGraphConfig = exports.NxWiringConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.RedirectHowToMergeMainConfig = exports.PrMergeGuardConfig = exports.MergeInProgressGuardConfig = exports.PrCreationOrPushGuardConfig = void 0;
6
- 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.writeMainSyncStatus = exports.readMainSyncStatus = exports.mainSyncLockPath = exports.mainSyncStatusPath = exports.DEFAULT_HANG_TIMEOUT_MINUTES = exports.MainSyncStatusService = exports.MainSyncLock = 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.PROVENANCE_SKIPPED = exports.PROVENANCE_MISSING = exports.PROVENANCE_OK = exports.ProvenanceResult = exports.SubagentProvenanceService = exports.verifyGateToken = exports.extractGateToken = exports.gateTokenMarker = exports.computeGateToken = void 0;
7
- exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.logBranchMutation = exports.branchMutationLogPath = exports.BranchMutationLog = exports.BranchMutationEvent = exports.BranchReaper = exports.ReapResult = exports.ReapedBranch = exports.WorktreeService = exports.Worktree = exports.MergedBranchesService = exports.MergedBranchesCache = exports.DeletableWorktree = void 0;
5
+ exports.formatFileList = exports.normalizeChecklistDoc = exports.toChecklist = exports.ChecklistDefinition = exports.MERGE_MODES = exports.MERGE_MODE_NONE = exports.MERGE_MODE_AUTO = exports.buildLandPrConfig = exports.buildPrGateConfig = exports.defaultLandPrConfig = exports.defaultPrGateConfig = exports.defaultGates = exports.LandPrConfig = exports.PrGateConfig = exports.GateDefinition = exports.StaleMainBashGuardConfig = exports.MergedBranchBashGuardConfig = exports.ReadStaleGuardConfig = exports.FeatureBranchGuardConfig = 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 = exports.ValidatePackageJsonConfig = exports.ValidateNoArchitectureCyclesConfig = exports.ValidateArchitectureUnchangedConfig = exports.ValidateTsInSrcConfig = exports.NoJsFilesConfig = exports.DiGraphConfig = exports.NxWiringConfig = exports.RuntimeArchitectureConfig = exports.NoFileImportCyclesConfig = exports.RedirectHowToMergeMainConfig = exports.PrMergeGuardConfig = exports.MergeInProgressGuardConfig = exports.PrCreationOrPushGuardConfig = void 0;
6
+ exports.stampCleanMainSyncStatus = exports.computeMainSyncStatus = exports.finishedLock = exports.inProcessLock = exports.tryAcquireMainSyncLock = exports.isRefreshInProgress = exports.isLockStale = exports.writeMainSyncLock = exports.readMainSyncLock = exports.writeMainSyncStatus = exports.readMainSyncStatus = exports.mainSyncLockPath = exports.mainSyncStatusPath = exports.DEFAULT_HANG_TIMEOUT_MINUTES = exports.MainSyncStatusService = exports.MainSyncLock = 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.PROVENANCE_SKIPPED = exports.PROVENANCE_MISSING = exports.PROVENANCE_OK = exports.ProvenanceResult = exports.SubagentProvenanceService = exports.verifyGateToken = exports.extractGateToken = exports.gateTokenMarker = exports.computeGateToken = exports.GateTokenService = exports.ChecklistInstructionsService = exports.ChecklistValidator = void 0;
7
+ exports.DEFAULT_MERGE_COMPLETE_COMMAND = exports.DEFAULT_UPSERT_PR_COMMAND = exports.buildCommandsConfig = exports.CommandsConfig = exports.logBranchMutation = exports.branchMutationLogPath = exports.BranchMutationLog = exports.BranchMutationEvent = 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_IN_USE = exports.CLASSIFICATION_NEVER_PROPOSED = exports.CLASSIFICATION_CONTENT_IN_MAIN = exports.CLASSIFICATION_SUPERSEDED = exports.CLASSIFICATION_NO_COMMITS = exports.CLASSIFICATION_BACKUP_OF_MERGED = exports.CLASSIFICATION_MERGED_PR = exports.MergedBranchesService = exports.MergedBranchesCache = exports.DeletableWorktree = exports.DeletableBranch = exports.MergedBranch = exports.squashRecoverySteps = void 0;
8
8
  var types_1 = require("./types");
9
9
  Object.defineProperty(exports, "ResolvedConfig", { enumerable: true, get: function () { return types_1.ResolvedConfig; } });
10
10
  Object.defineProperty(exports, "ResolvedRuleConfig", { enumerable: true, get: function () { return types_1.ResolvedRuleConfig; } });
@@ -175,9 +175,12 @@ Object.defineProperty(exports, "StaleMainBashGuardConfig", { enumerable: true, g
175
175
  var pr_gate_config_1 = require("./pr-gate-config");
176
176
  Object.defineProperty(exports, "GateDefinition", { enumerable: true, get: function () { return pr_gate_config_1.GateDefinition; } });
177
177
  Object.defineProperty(exports, "PrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.PrGateConfig; } });
178
+ Object.defineProperty(exports, "LandPrConfig", { enumerable: true, get: function () { return pr_gate_config_1.LandPrConfig; } });
178
179
  Object.defineProperty(exports, "defaultGates", { enumerable: true, get: function () { return pr_gate_config_1.defaultGates; } });
179
180
  Object.defineProperty(exports, "defaultPrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.defaultPrGateConfig; } });
181
+ Object.defineProperty(exports, "defaultLandPrConfig", { enumerable: true, get: function () { return pr_gate_config_1.defaultLandPrConfig; } });
180
182
  Object.defineProperty(exports, "buildPrGateConfig", { enumerable: true, get: function () { return pr_gate_config_1.buildPrGateConfig; } });
183
+ Object.defineProperty(exports, "buildLandPrConfig", { enumerable: true, get: function () { return pr_gate_config_1.buildLandPrConfig; } });
181
184
  Object.defineProperty(exports, "MERGE_MODE_AUTO", { enumerable: true, get: function () { return pr_gate_config_1.MERGE_MODE_AUTO; } });
182
185
  Object.defineProperty(exports, "MERGE_MODE_NONE", { enumerable: true, get: function () { return pr_gate_config_1.MERGE_MODE_NONE; } });
183
186
  Object.defineProperty(exports, "MERGE_MODES", { enumerable: true, get: function () { return pr_gate_config_1.MERGE_MODES; } });
@@ -249,6 +252,22 @@ Object.defineProperty(exports, "DeletableBranch", { enumerable: true, get: funct
249
252
  Object.defineProperty(exports, "DeletableWorktree", { enumerable: true, get: function () { return merged_branches_1.DeletableWorktree; } });
250
253
  Object.defineProperty(exports, "MergedBranchesCache", { enumerable: true, get: function () { return merged_branches_1.MergedBranchesCache; } });
251
254
  Object.defineProperty(exports, "MergedBranchesService", { enumerable: true, get: function () { return merged_branches_1.MergedBranchesService; } });
255
+ Object.defineProperty(exports, "CLASSIFICATION_MERGED_PR", { enumerable: true, get: function () { return merged_branches_1.CLASSIFICATION_MERGED_PR; } });
256
+ Object.defineProperty(exports, "CLASSIFICATION_BACKUP_OF_MERGED", { enumerable: true, get: function () { return merged_branches_1.CLASSIFICATION_BACKUP_OF_MERGED; } });
257
+ Object.defineProperty(exports, "CLASSIFICATION_NO_COMMITS", { enumerable: true, get: function () { return merged_branches_1.CLASSIFICATION_NO_COMMITS; } });
258
+ Object.defineProperty(exports, "CLASSIFICATION_SUPERSEDED", { enumerable: true, get: function () { return merged_branches_1.CLASSIFICATION_SUPERSEDED; } });
259
+ Object.defineProperty(exports, "CLASSIFICATION_CONTENT_IN_MAIN", { enumerable: true, get: function () { return merged_branches_1.CLASSIFICATION_CONTENT_IN_MAIN; } });
260
+ Object.defineProperty(exports, "CLASSIFICATION_NEVER_PROPOSED", { enumerable: true, get: function () { return merged_branches_1.CLASSIFICATION_NEVER_PROPOSED; } });
261
+ Object.defineProperty(exports, "CLASSIFICATION_IN_USE", { enumerable: true, get: function () { return merged_branches_1.CLASSIFICATION_IN_USE; } });
262
+ Object.defineProperty(exports, "PROMPTABLE_CLASSIFICATIONS", { enumerable: true, get: function () { return merged_branches_1.PROMPTABLE_CLASSIFICATIONS; } });
263
+ var branch_archiver_1 = require("./branch-archiver");
264
+ Object.defineProperty(exports, "BranchArchiver", { enumerable: true, get: function () { return branch_archiver_1.BranchArchiver; } });
265
+ Object.defineProperty(exports, "ArchiveResult", { enumerable: true, get: function () { return branch_archiver_1.ArchiveResult; } });
266
+ Object.defineProperty(exports, "ARCHIVE_TAG_PREFIX", { enumerable: true, get: function () { return branch_archiver_1.ARCHIVE_TAG_PREFIX; } });
267
+ Object.defineProperty(exports, "BRANCH_RETENTIONS", { enumerable: true, get: function () { return branch_archiver_1.BRANCH_RETENTIONS; } });
268
+ Object.defineProperty(exports, "BRANCH_RETENTION_DELETE", { enumerable: true, get: function () { return branch_archiver_1.BRANCH_RETENTION_DELETE; } });
269
+ Object.defineProperty(exports, "BRANCH_RETENTION_ARCHIVE_TAG", { enumerable: true, get: function () { return branch_archiver_1.BRANCH_RETENTION_ARCHIVE_TAG; } });
270
+ Object.defineProperty(exports, "BRANCH_RETENTION_KEEP", { enumerable: true, get: function () { return branch_archiver_1.BRANCH_RETENTION_KEEP; } });
252
271
  var worktrees_1 = require("./worktrees");
253
272
  Object.defineProperty(exports, "Worktree", { enumerable: true, get: function () { return worktrees_1.Worktree; } });
254
273
  Object.defineProperty(exports, "WorktreeService", { enumerable: true, get: function () { return worktrees_1.WorktreeService; } });
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,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,uCAA6D;AAApD,oGAAA,QAAQ,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mGAAA,OAAO,OAAA;AACxC,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,6CAA4E;AAAnE,6GAAA,cAAc,OAAA;AAAE,8GAAA,eAAe,OAAA;AAAE,yGAAA,UAAU,OAAA;AACpD,yCAA8D;AAArD,2GAAA,cAAc,OAAA;AAAE,4GAAA,eAAe,OAAA;AACxC,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,2BAA8E;AAArE,oGAAA,cAAc,OAAA;AAAE,sGAAA,gBAAgB,OAAA;AAAE,0GAAA,oBAAoB,OAAA;AAC/D,2DAAoD;AAA3C,kHAAA,YAAY,OAAA;AACrB,iDAAiE;AAAxD,+GAAA,cAAc,OAAA;AAAE,+GAAA,cAAc,OAAA;AACvC,iDAAgE;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OAAA;AACZ,yHAAA,qBAAqB,OAAA;AACrB,4HAAA,wBAAwB,OAAA;AACxB,uHAAA,mBAAmB,OAAA;AAEvB,qDAM2B;AALvB,+GAAA,YAAY,OAAA;AACZ,kHAAA,eAAe,OAAA;AACf,oHAAA,iBAAiB,OAAA;AACjB,sHAAA,mBAAmB,OAAA;AACnB,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;AAGhB,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 } from './rule-fail-error';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\nexport { toError } from './to-error';\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\nexport { findConfigFile, CONFIG_FILENAME, ConfigFile } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR } from './repo-root';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\nexport { defaultRules, defaultRulesDir } from './default-rules';\nexport { loadTemplate, writeTemplateIfMissing, writeTemplate, TemplateWriter } from './load-template';\nexport { validateWebpiecesConfig, validatePrGateSection, validateChecklistsSection, validateSectionPlacement, validateCommandsSection, validateExcludePaths, validateMatchRulesSection, allRuleNames } from './validate-config';\nexport { validateChecklistDocs } from './checklist-docs-validator';\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 { HOOK_GUARD_NAMES, isHookGuard, sectionForRule } from './sections';\nexport { FieldDef } from './field-def';\nexport type { SchemaShape } from './field-def';\nexport { shouldSkipRule, getCurrentBranch } from './skip-rule';\nexport type { 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} 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} 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 PrCreationOrPushGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeGuardConfig,\n RedirectHowToMergeMainConfig,\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 FeatureBranchGuardConfig,\n ReadStaleGuardConfig,\n MergedBranchBashGuardConfig,\n StaleMainBashGuardConfig,\n} from './main-sync-guard-configs';\nexport {\n GateDefinition,\n PrGateConfig,\n defaultGates,\n defaultPrGateConfig,\n buildPrGateConfig,\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 GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-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 MainSyncLock,\n MainSyncStatusService,\n DEFAULT_HANG_TIMEOUT_MINUTES,\n mainSyncStatusPath,\n mainSyncLockPath,\n readMainSyncStatus,\n writeMainSyncStatus,\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} from './merged-branches';\nexport {\n Worktree,\n WorktreeService,\n} from './worktrees';\nexport {\n ReapedBranch,\n ReapResult,\n BranchReaper,\n} from './branch-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,qDAAkD;AAAzC,gHAAA,aAAa,OAAA;AACtB,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,uCAA6D;AAApD,oGAAA,QAAQ,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mGAAA,OAAO,OAAA;AACxC,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,6CAA4E;AAAnE,6GAAA,cAAc,OAAA;AAAE,8GAAA,eAAe,OAAA;AAAE,yGAAA,UAAU,OAAA;AACpD,yCAA8D;AAArD,2GAAA,cAAc,OAAA;AAAE,4GAAA,eAAe,OAAA;AACxC,6DAA0D;AAAjD,wHAAA,iBAAiB,OAAA;AAC1B,2BAA8E;AAArE,oGAAA,cAAc,OAAA;AAAE,sGAAA,gBAAgB,OAAA;AAAE,0GAAA,oBAAoB,OAAA;AAC/D,2DAAoD;AAA3C,kHAAA,YAAY,OAAA;AACrB,iDAAiE;AAAxD,+GAAA,cAAc,OAAA;AAAE,+GAAA,cAAc,OAAA;AACvC,iDAAgE;AAAvD,6GAAA,YAAY,OAAA;AAAE,gHAAA,eAAe,OAAA;AACtC,iDAAsG;AAA7F,6GAAA,YAAY,OAAA;AAAE,uHAAA,sBAA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AAA;AACrB,4HAAA,wBAAwB,OAAA;AACxB,uHAAA,mBAAmB,OAAA;AAEvB,qDAc2B;AAbvB,+GAAA,YAAY,OAAA;AACZ,kHAAA,eAAe,OAAA;AACf,oHAAA,iBAAiB,OAAA;AACjB,sHAAA,mBAAmB,OAAA;AACnB,wHAAA,qBAAqB,OAAA;AACrB,2HAAA,wBAAwB,OAAA;AACxB,kIAAA,+BAA+B,OAAA;AAC/B,4HAAA,yBAAyB,OAAA;AACzB,4HAAA,yBAAyB,OAAA;AACzB,iIAAA,8BAA8B,OAAA;AAC9B,gIAAA,6BAA6B,OAAA;AAC7B,wHAAA,qBAAqB,OAAA;AACrB,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;AAGhB,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 } from './rule-fail-error';\nexport { CliExitError } from './cli-exit-error';\nexport { CliUsage, CliArgsCheck, CliArgs } from './cli-args';\nexport { runMain } from './run-main';\nexport { toError } from './to-error';\nexport { loadAndValidate, LoadedConfig, ConfigLoader } from './load-config';\nexport { findConfigFile, CONFIG_FILENAME, ConfigFile } from './config-file';\nexport { RepoRootFinder, INSTRUCT_AI_DIR } from './repo-root';\nexport { RulesConfigDesign } from './rules-config-design';\nexport { DocumentDesign, isDocumentDesign, DESIGN_METADATA_KEYS } from './di';\nexport { ExcludePaths } from './exclude-hook-paths';\nexport { isPathExcluded, matchesAnyGlob } from './exclude-paths';\nexport { defaultRules, defaultRulesDir } from './default-rules';\nexport { loadTemplate, writeTemplateIfMissing, writeTemplate, TemplateWriter } from './load-template';\nexport { validateWebpiecesConfig, validatePrGateSection, validateChecklistsSection, validateSectionPlacement, validateCommandsSection, validateExcludePaths, validateMatchRulesSection, allRuleNames } from './validate-config';\nexport { validateChecklistDocs } from './checklist-docs-validator';\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 { HOOK_GUARD_NAMES, isHookGuard, sectionForRule } from './sections';\nexport { FieldDef } from './field-def';\nexport type { SchemaShape } from './field-def';\nexport { shouldSkipRule, getCurrentBranch } from './skip-rule';\nexport type { 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} 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} 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 PrCreationOrPushGuardConfig,\n MergeInProgressGuardConfig,\n PrMergeGuardConfig,\n RedirectHowToMergeMainConfig,\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 FeatureBranchGuardConfig,\n ReadStaleGuardConfig,\n MergedBranchBashGuardConfig,\n StaleMainBashGuardConfig,\n} from './main-sync-guard-configs';\nexport {\n GateDefinition,\n PrGateConfig,\n LandPrConfig,\n defaultGates,\n defaultPrGateConfig,\n defaultLandPrConfig,\n buildPrGateConfig,\n buildLandPrConfig,\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 GateTokenService,\n computeGateToken,\n gateTokenMarker,\n extractGateToken,\n verifyGateToken,\n} from './gate-token';\nexport {\n SubagentProvenanceService,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-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 MainSyncLock,\n MainSyncStatusService,\n DEFAULT_HANG_TIMEOUT_MINUTES,\n mainSyncStatusPath,\n mainSyncLockPath,\n readMainSyncStatus,\n writeMainSyncStatus,\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 CLASSIFICATION_MERGED_PR,\n CLASSIFICATION_BACKUP_OF_MERGED,\n CLASSIFICATION_NO_COMMITS,\n CLASSIFICATION_SUPERSEDED,\n CLASSIFICATION_CONTENT_IN_MAIN,\n CLASSIFICATION_NEVER_PROPOSED,\n CLASSIFICATION_IN_USE,\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 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"]}
@@ -4,11 +4,56 @@ export declare class MergedBranch {
4
4
  pr: number;
5
5
  constructor(branch: string, pr: number);
6
6
  }
7
+ /**
8
+ * WHY a branch is dead, or why it was spared — as a STABLE token, alongside the English prose.
9
+ *
10
+ * `sha`/`commits`/`prState` (below) let a human SEE a spared branch. This adds the other half: a token
11
+ * saying WHICH KIND of spared it is. Every spared branch used to report the identical string
12
+ * `no merged PR found — a human must decide`, and in one observed repo that one string covered three
13
+ * genuinely different situations — a PR CLOSED UNMERGED whose work landed under a later number, a
14
+ * branch that NEVER had a PR and holds the only copy of its commits, and content already in main.
15
+ * Reporting all three identically is why nobody ever decided, and why the pile grew to 6 branches
16
+ * against a cap of 5. A token lets wp-cleanup GROUP them and ask a question that can be answered.
17
+ */
18
+ export declare const CLASSIFICATION_MERGED_PR = "merged-pr";
19
+ export declare const CLASSIFICATION_BACKUP_OF_MERGED = "backup-of-merged";
20
+ export declare const CLASSIFICATION_NO_COMMITS = "no-commits";
21
+ export declare const CLASSIFICATION_SUPERSEDED = "superseded";
22
+ export declare const CLASSIFICATION_CONTENT_IN_MAIN = "content-already-in-main";
23
+ export declare const CLASSIFICATION_NEVER_PROPOSED = "never-proposed";
24
+ export declare const CLASSIFICATION_IN_USE = "in-use";
25
+ export declare const PROMPTABLE_CLASSIFICATIONS: readonly string[];
26
+ /**
27
+ * A local branch and the verdict on it. `pr` is 0 when no merged PR backs the verdict (a `keep`).
28
+ *
29
+ * `sha`, `commits` and `prState` exist for the SPARED branches specifically. When nothing is
30
+ * auto-reapable the branch cap has nothing safe to offer, and its only remaining advice was "raise
31
+ * maxLocalBranches" / "set turnOffRuleUntilEpoch" — both of which loosen the rule. An agent with no
32
+ * human present took the config edit, which is the exact failure the cap exists to prevent. To ask a
33
+ * human "may I delete these?" instead, the guard has to be able to SHOW what it would delete: tip SHA
34
+ * (so the delete is recoverable), PR state (closed? never opened?) and how much unique work is on it.
35
+ *
36
+ * All three are computed in the DETACHED refresher and read straight off merged-branches.json — the
37
+ * blocking hook path never recomputes them. Defaulted so a cache written by an older release (and
38
+ * every existing call site) revives without them.
39
+ */
7
40
  export declare class DeletableBranch {
8
41
  branch: string;
9
42
  reason: string;
10
43
  pr: number;
11
- constructor(branch: string, reason: string, pr: number);
44
+ /** Short tip SHA — what makes the delete undoable (`git branch <name> <sha>`). '' when unknown. */
45
+ sha: string;
46
+ /** Commits on this branch that are not on origin/main. -1 when it could not be established. */
47
+ commits: number;
48
+ /** GitHub's state for the PR whose head is this branch: MERGED / CLOSED / OPEN, or '' for none. */
49
+ prState: string;
50
+ /**
51
+ * One of the CLASSIFICATION_* tokens. Defaulted like the fields above so every pre-existing call
52
+ * site — and every cache written by an older release — still constructs; an unclassified revived
53
+ * entry reads as 'never-proposed', the most conservative of the spared verdicts.
54
+ */
55
+ classification: string;
56
+ constructor(branch: string, reason: string, pr: number, sha?: string, commits?: number, prState?: string, classification?: string);
12
57
  }
13
58
  /**
14
59
  * A worktree and the verdict on it. Carries `path` (what `git worktree remove` takes) AND `branch`
@@ -66,7 +111,33 @@ export declare class MergedBranchesService {
66
111
  * its branch still holds unmerged work.
67
112
  */
68
113
  private classifyWorktrees;
114
+ /**
115
+ * Verdict for one branch: its own merged PR, else the base it was backed up from, else empty.
116
+ *
117
+ * The verdict itself is unchanged. What is new is that EVERY entry now carries its tip SHA, its
118
+ * unique-commit count and its PR state, so a `keep` can be shown to a human as a delete candidate
119
+ * rather than just counted. This runs only in the detached refresher, so the two extra local git
120
+ * calls per branch cost the blocking hook path nothing.
121
+ */
69
122
  private classify;
123
+ /**
124
+ * The three genuinely different reasons a branch survives the deletable proofs, ordered by how
125
+ * confidently a human can say yes to deleting it.
126
+ *
127
+ * The safety posture is UNCHANGED: all three are still SPARED, never auto-deleted. The only thing
128
+ * that changed is that wp-cleanup can now ask a question whose answer is knowable.
129
+ */
130
+ private classifySpared;
131
+ /**
132
+ * True when EVERY commit on the branch has a patch-equivalent already in origin/main.
133
+ *
134
+ * `git cherry origin/main <branch>` prints one line per commit: `+ <sha>` = not upstream,
135
+ * `- <sha>` = an equivalent change IS upstream. All-minus means the content landed (typically by
136
+ * cherry-pick or rebase-merge) even though the SHAs differ. Any failure returns false — "cannot
137
+ * prove the content is in main" must never read as "safe".
138
+ */
139
+ private contentAlreadyInMain;
140
+ private tipSha;
70
141
  /**
71
142
  * Commits on `branch` that are not on origin/main. Returns -1 ("assume it has work") whenever the
72
143
  * count cannot be established — an unresolvable origin/main must never read as "empty branch".
@@ -78,6 +149,14 @@ export declare class MergedBranchesService {
78
149
  * every branch a `keep`. The guard then deletes nothing rather than guessing.
79
150
  */
80
151
  private fetchMergedPrs;
152
+ /**
153
+ * The DISPLAY-only second lookup: every PR (any state) keyed by head branch, so a spared branch can
154
+ * be shown to a human as "PR #12 CLOSED (not merged)" or "no PR" instead of an opaque name. Kept
155
+ * SEPARATE from fetchMergedPrs on purpose — folding both into one `--state all` call would let a
156
+ * flood of open/closed PRs push older MERGED ones out of the limit and silently stop reaping real
157
+ * dead branches. Fails soft to an empty map: the verdicts do not depend on it.
158
+ */
159
+ private fetchPrStates;
81
160
  private reviveList;
82
161
  private reviveWorktrees;
83
162
  private capture;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MergedBranchesService = exports.MergedBranchesCache = exports.DeletableWorktree = exports.DeletableBranch = exports.MergedBranch = void 0;
3
+ exports.MergedBranchesService = exports.MergedBranchesCache = exports.DeletableWorktree = exports.DeletableBranch = exports.PROMPTABLE_CLASSIFICATIONS = exports.CLASSIFICATION_IN_USE = exports.CLASSIFICATION_NEVER_PROPOSED = exports.CLASSIFICATION_CONTENT_IN_MAIN = exports.CLASSIFICATION_SUPERSEDED = exports.CLASSIFICATION_NO_COMMITS = exports.CLASSIFICATION_BACKUP_OF_MERGED = exports.CLASSIFICATION_MERGED_PR = exports.MergedBranch = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const child_process_1 = require("child_process");
6
6
  const fs = tslib_1.__importStar(require("fs"));
@@ -41,15 +41,73 @@ class MergedBranch {
41
41
  }
42
42
  }
43
43
  exports.MergedBranch = MergedBranch;
44
- // A local branch and the verdict on it. `pr` is 0 when no merged PR backs the verdict (a `keep`).
44
+ /**
45
+ * WHY a branch is dead, or why it was spared — as a STABLE token, alongside the English prose.
46
+ *
47
+ * `sha`/`commits`/`prState` (below) let a human SEE a spared branch. This adds the other half: a token
48
+ * saying WHICH KIND of spared it is. Every spared branch used to report the identical string
49
+ * `no merged PR found — a human must decide`, and in one observed repo that one string covered three
50
+ * genuinely different situations — a PR CLOSED UNMERGED whose work landed under a later number, a
51
+ * branch that NEVER had a PR and holds the only copy of its commits, and content already in main.
52
+ * Reporting all three identically is why nobody ever decided, and why the pile grew to 6 branches
53
+ * against a cap of 5. A token lets wp-cleanup GROUP them and ask a question that can be answered.
54
+ */
55
+ // Dead by proof — these are auto-deletable.
56
+ exports.CLASSIFICATION_MERGED_PR = 'merged-pr';
57
+ exports.CLASSIFICATION_BACKUP_OF_MERGED = 'backup-of-merged';
58
+ exports.CLASSIFICATION_NO_COMMITS = 'no-commits';
59
+ // Spared, but a human should be ASKED — in descending order of "obviously fine to delete".
60
+ exports.CLASSIFICATION_SUPERSEDED = 'superseded';
61
+ exports.CLASSIFICATION_CONTENT_IN_MAIN = 'content-already-in-main';
62
+ exports.CLASSIFICATION_NEVER_PROPOSED = 'never-proposed';
63
+ // Spared for a mechanical reason, not a judgement call (checked out somewhere).
64
+ exports.CLASSIFICATION_IN_USE = 'in-use';
65
+ // Spared classifications a human can meaningfully rule on, most-safe first. wp-cleanup prompts in
66
+ // exactly this order so the easy yeses come before the ones that need thought.
67
+ exports.PROMPTABLE_CLASSIFICATIONS = [
68
+ exports.CLASSIFICATION_SUPERSEDED,
69
+ exports.CLASSIFICATION_CONTENT_IN_MAIN,
70
+ exports.CLASSIFICATION_NEVER_PROPOSED,
71
+ ];
72
+ /**
73
+ * A local branch and the verdict on it. `pr` is 0 when no merged PR backs the verdict (a `keep`).
74
+ *
75
+ * `sha`, `commits` and `prState` exist for the SPARED branches specifically. When nothing is
76
+ * auto-reapable the branch cap has nothing safe to offer, and its only remaining advice was "raise
77
+ * maxLocalBranches" / "set turnOffRuleUntilEpoch" — both of which loosen the rule. An agent with no
78
+ * human present took the config edit, which is the exact failure the cap exists to prevent. To ask a
79
+ * human "may I delete these?" instead, the guard has to be able to SHOW what it would delete: tip SHA
80
+ * (so the delete is recoverable), PR state (closed? never opened?) and how much unique work is on it.
81
+ *
82
+ * All three are computed in the DETACHED refresher and read straight off merged-branches.json — the
83
+ * blocking hook path never recomputes them. Defaulted so a cache written by an older release (and
84
+ * every existing call site) revives without them.
85
+ */
45
86
  class DeletableBranch {
46
87
  branch;
47
88
  reason;
48
89
  pr;
49
- constructor(branch, reason, pr) {
90
+ /** Short tip SHA — what makes the delete undoable (`git branch <name> <sha>`). '' when unknown. */
91
+ sha;
92
+ /** Commits on this branch that are not on origin/main. -1 when it could not be established. */
93
+ commits;
94
+ /** GitHub's state for the PR whose head is this branch: MERGED / CLOSED / OPEN, or '' for none. */
95
+ prState;
96
+ /**
97
+ * One of the CLASSIFICATION_* tokens. Defaulted like the fields above so every pre-existing call
98
+ * site — and every cache written by an older release — still constructs; an unclassified revived
99
+ * entry reads as 'never-proposed', the most conservative of the spared verdicts.
100
+ */
101
+ classification;
102
+ // eslint-disable-next-line @typescript-eslint/max-params
103
+ constructor(branch, reason, pr, sha = '', commits = -1, prState = '', classification = exports.CLASSIFICATION_NEVER_PROPOSED) {
50
104
  this.branch = branch;
51
105
  this.reason = reason;
52
106
  this.pr = pr;
107
+ this.sha = sha;
108
+ this.commits = commits;
109
+ this.prState = prState;
110
+ this.classification = classification;
53
111
  }
54
112
  }
55
113
  exports.DeletableBranch = DeletableBranch;
@@ -94,6 +152,37 @@ class MergedBranchesCache {
94
152
  }
95
153
  }
96
154
  exports.MergedBranchesCache = MergedBranchesCache;
155
+ /**
156
+ * Internal: the bulk PR lookup, indexed.
157
+ *
158
+ * `merged` drives the DELETE verdicts and comes from the `--state merged` call, unchanged — the
159
+ * reaping logic must not get looser or tighter here. `state` is display-only, from a second
160
+ * `--state all` call, and answers the question a human needs in order to say "yes, delete it":
161
+ * was there a PR at all, and did it close without merging? It fails soft to an empty map.
162
+ */
163
+ class PrRef {
164
+ number;
165
+ state;
166
+ constructor(prNumber, state) {
167
+ this.number = prNumber;
168
+ this.state = state;
169
+ }
170
+ }
171
+ class PrLookup {
172
+ merged;
173
+ state;
174
+ /**
175
+ * Highest merged PR number seen. A branch whose own PR CLOSED UNMERGED below this number means work
176
+ * kept landing after it was abandoned — the "superseded by a later PR" signal, obtained without
177
+ * having to guess WHICH PR superseded it.
178
+ */
179
+ latestMergedPr;
180
+ constructor(merged, state, latestMergedPr = 0) {
181
+ this.merged = merged;
182
+ this.state = state;
183
+ this.latestMergedPr = latestMergedPr;
184
+ }
185
+ }
97
186
  // Internal: a classification result. `deletable` is the decision; `entry` carries the branch + reason
98
187
  // either way (a spared branch still needs its reason recorded, and it has no PR to key off).
99
188
  class Verdict {
@@ -158,6 +247,12 @@ let MergedBranchesService = class MergedBranchesService {
158
247
  const byBranch = new Map();
159
248
  for (const entry of merged)
160
249
  byBranch.set(entry.branch, entry.pr);
250
+ let latestMergedPr = 0;
251
+ for (const entry of merged) {
252
+ if (entry.pr > latestMergedPr)
253
+ latestMergedPr = entry.pr;
254
+ }
255
+ const prs = new PrLookup(byBranch, this.fetchPrStates(repoRoot), latestMergedPr);
161
256
  const trees = this.worktrees.listWorktrees(repoRoot);
162
257
  const holder = new Map();
163
258
  for (const tree of trees) {
@@ -167,7 +262,7 @@ let MergedBranchesService = class MergedBranchesService {
167
262
  const deletable = [];
168
263
  const keep = [];
169
264
  for (const branch of this.localBranches(repoRoot)) {
170
- const verdict = this.classify(repoRoot, branch, byBranch);
265
+ const verdict = this.classify(repoRoot, branch, prs);
171
266
  // A branch checked out in ANY worktree (including the branch we are standing on right here)
172
267
  // cannot be deleted — git refuses, and since the reap is ONE `git branch -D a b c`, a single
173
268
  // such branch would fail the entire command and strand the branches that would have deleted
@@ -175,7 +270,7 @@ let MergedBranchesService = class MergedBranchesService {
175
270
  // worktree list below is what actually reaps it, and a human should see the connection.
176
271
  const heldAt = holder.get(branch);
177
272
  if (heldAt !== undefined) {
178
- keep.push(new DeletableBranch(branch, `checked out in worktree '${heldAt}' — remove that worktree before deleting the branch`, verdict.entry.pr));
273
+ keep.push(new DeletableBranch(branch, `checked out in worktree '${heldAt}' — remove that worktree before deleting the branch`, verdict.entry.pr, verdict.entry.sha, verdict.entry.commits, verdict.entry.prState, exports.CLASSIFICATION_IN_USE));
179
274
  continue;
180
275
  }
181
276
  if (verdict.deletable)
@@ -183,7 +278,7 @@ let MergedBranchesService = class MergedBranchesService {
183
278
  else
184
279
  keep.push(verdict.entry);
185
280
  }
186
- const worktrees = this.classifyWorktrees(repoRoot, trees, byBranch);
281
+ const worktrees = this.classifyWorktrees(repoRoot, trees, prs);
187
282
  return new MergedBranchesCache(new Date().toISOString(), deletable, keep, worktrees);
188
283
  }
189
284
  /**
@@ -196,7 +291,7 @@ let MergedBranchesService = class MergedBranchesService {
196
291
  * are standing in right now (removing your own cwd is not a thing to suggest to an agent), or when
197
292
  * its branch still holds unmerged work.
198
293
  */
199
- classifyWorktrees(repoRoot, trees, byBranch) {
294
+ classifyWorktrees(repoRoot, trees, prs) {
200
295
  const out = [];
201
296
  for (const tree of trees) {
202
297
  if (tree.isMain)
@@ -217,32 +312,95 @@ let MergedBranchesService = class MergedBranchesService {
217
312
  out.push(new DeletableWorktree(tree.path, '', 'detached HEAD — no branch to check, so a human must decide', 0, false));
218
313
  continue;
219
314
  }
220
- const verdict = this.classify(repoRoot, tree.branch, byBranch);
315
+ const verdict = this.classify(repoRoot, tree.branch, prs);
221
316
  out.push(new DeletableWorktree(tree.path, tree.branch, verdict.entry.reason, verdict.entry.pr, verdict.deletable));
222
317
  }
223
318
  return out;
224
319
  }
225
- // Verdict for one branch: its own merged PR, else the base it was backed up from, else empty.
226
- classify(repoRoot, branch, byBranch) {
227
- const own = byBranch.get(branch);
320
+ /**
321
+ * Verdict for one branch: its own merged PR, else the base it was backed up from, else empty.
322
+ *
323
+ * The verdict itself is unchanged. What is new is that EVERY entry now carries its tip SHA, its
324
+ * unique-commit count and its PR state, so a `keep` can be shown to a human as a delete candidate
325
+ * rather than just counted. This runs only in the detached refresher, so the two extra local git
326
+ * calls per branch cost the blocking hook path nothing.
327
+ */
328
+ classify(repoRoot, branch, prs) {
329
+ const sha = this.tipSha(repoRoot, branch);
330
+ const commits = this.commitsAheadOfMain(repoRoot, branch);
331
+ const known = prs.state.get(branch);
332
+ const prState = known ? known.state : '';
333
+ const own = prs.merged.get(branch);
228
334
  if (own !== undefined) {
229
- return new Verdict(true, new DeletableBranch(branch, `PR #${String(own)} merged`, own));
335
+ return new Verdict(true, new DeletableBranch(branch, `PR #${String(own)} merged`, own, sha, commits, prState || 'MERGED', exports.CLASSIFICATION_MERGED_PR));
230
336
  }
231
337
  const base = branch.replace(BACKUP_SUFFIX, '');
232
338
  if (base !== branch && base.length > 0) {
233
- const basePr = byBranch.get(base);
339
+ const basePr = prs.merged.get(base);
234
340
  if (basePr !== undefined) {
235
- return new Verdict(true, new DeletableBranch(branch, `squash-merge backup of '${base}' (PR #${String(basePr)} merged) — its job is done`, basePr));
341
+ return new Verdict(true, new DeletableBranch(branch, `squash-merge backup of '${base}' (PR #${String(basePr)} merged) — its job is done`, basePr, sha, commits, prState, exports.CLASSIFICATION_BACKUP_OF_MERGED));
236
342
  }
237
343
  }
238
344
  // The one git-local signal that squash-merge CANNOT corrupt: a branch with zero commits of its
239
345
  // own holds no work, so deleting it can lose nothing. (Squash breaks patch-id and ancestry, so
240
346
  // "are these commits in main?" is unanswerable from git — but "are there any commits at all?"
241
347
  // is exact.) These are the husks left behind by branching and then never committing.
242
- if (this.commitsAheadOfMain(repoRoot, branch) === 0) {
243
- return new Verdict(true, new DeletableBranch(branch, 'no commits of its own — identical to origin/main', 0));
348
+ if (commits === 0) {
349
+ return new Verdict(true, new DeletableBranch(branch, 'no commits of its own — identical to origin/main', 0, sha, 0, prState, exports.CLASSIFICATION_NO_COMMITS));
244
350
  }
245
- return new Verdict(false, new DeletableBranch(branch, 'no merged PR found — a human must decide', 0));
351
+ return new Verdict(false, this.classifySpared(repoRoot, branch, prs, sha, commits, prState));
352
+ }
353
+ /**
354
+ * The three genuinely different reasons a branch survives the deletable proofs, ordered by how
355
+ * confidently a human can say yes to deleting it.
356
+ *
357
+ * The safety posture is UNCHANGED: all three are still SPARED, never auto-deleted. The only thing
358
+ * that changed is that wp-cleanup can now ask a question whose answer is knowable.
359
+ */
360
+ // eslint-disable-next-line @typescript-eslint/max-params
361
+ classifySpared(repoRoot, branch, prs, sha, commits, prState) {
362
+ const known = prs.state.get(branch);
363
+ // A PR that CLOSED without merging, in a repo that has merged later PRs, is near-certainly the
364
+ // abandoned first attempt at work that landed under a different number.
365
+ if (known !== undefined && known.state === 'CLOSED' && prs.latestMergedPr > known.number) {
366
+ return new DeletableBranch(branch, `PR #${String(known.number)} was CLOSED UNMERGED and later PRs (through ` +
367
+ `#${String(prs.latestMergedPr)}) have merged — near-certainly superseded`, known.number, sha, commits, prState, exports.CLASSIFICATION_SUPERSEDED);
368
+ }
369
+ // `git cherry` compares by PATCH-ID, so it survives cherry-picks and rebases. It does NOT
370
+ // survive a squash — which is exactly why this is a spared verdict and not a deletable proof.
371
+ if (this.contentAlreadyInMain(repoRoot, branch)) {
372
+ return new DeletableBranch(branch, `all ${String(commits)} commit(s) already have an equivalent in origin/main ` +
373
+ `(git cherry) — content is not unique`, known ? known.number : 0, sha, commits, prState, exports.CLASSIFICATION_CONTENT_IN_MAIN);
374
+ }
375
+ const why = known
376
+ ? `PR #${String(known.number)} is ${known.state} (not merged); holds ` +
377
+ `${String(commits)} unique commit(s) — a human must decide`
378
+ : `never had a PR; holds ${String(commits)} unique commit(s) that may be the only copy in existence`;
379
+ return new DeletableBranch(branch, why, 0, sha, commits, prState, exports.CLASSIFICATION_NEVER_PROPOSED);
380
+ }
381
+ /**
382
+ * True when EVERY commit on the branch has a patch-equivalent already in origin/main.
383
+ *
384
+ * `git cherry origin/main <branch>` prints one line per commit: `+ <sha>` = not upstream,
385
+ * `- <sha>` = an equivalent change IS upstream. All-minus means the content landed (typically by
386
+ * cherry-pick or rebase-merge) even though the SHAs differ. Any failure returns false — "cannot
387
+ * prove the content is in main" must never read as "safe".
388
+ */
389
+ contentAlreadyInMain(repoRoot, branch) {
390
+ const result = this.capture(repoRoot, 'git', ['cherry', 'origin/main', branch]);
391
+ if (!result.ok || result.out === '')
392
+ return false;
393
+ const lines = result.out.split('\n')
394
+ .map((line) => line.trim())
395
+ .filter((line) => line !== '');
396
+ if (lines.length === 0)
397
+ return false;
398
+ return lines.every((line) => line.startsWith('-'));
399
+ }
400
+ // Short tip SHA — the value that makes any delete of this branch reversible.
401
+ tipSha(repoRoot, branch) {
402
+ const result = this.capture(repoRoot, 'git', ['rev-parse', '--short', branch]);
403
+ return result.ok ? result.out : '';
246
404
  }
247
405
  /**
248
406
  * Commits on `branch` that are not on origin/main. Returns -1 ("assume it has work") whenever the
@@ -287,10 +445,46 @@ let MergedBranchesService = class MergedBranchesService {
287
445
  return [];
288
446
  }
289
447
  }
448
+ /**
449
+ * The DISPLAY-only second lookup: every PR (any state) keyed by head branch, so a spared branch can
450
+ * be shown to a human as "PR #12 CLOSED (not merged)" or "no PR" instead of an opaque name. Kept
451
+ * SEPARATE from fetchMergedPrs on purpose — folding both into one `--state all` call would let a
452
+ * flood of open/closed PRs push older MERGED ones out of the limit and silently stop reaping real
453
+ * dead branches. Fails soft to an empty map: the verdicts do not depend on it.
454
+ */
455
+ fetchPrStates(repoRoot) {
456
+ const out = new Map();
457
+ const result = this.capture(repoRoot, 'gh', [
458
+ 'pr', 'list',
459
+ '--state', 'all',
460
+ '--limit', String(MERGED_PR_LOOKUP_LIMIT),
461
+ '--json', 'number,headRefName,state',
462
+ ]);
463
+ if (!result.ok || result.out === '')
464
+ return out;
465
+ // eslint-disable-next-line @webpieces/no-unmanaged-exceptions
466
+ try {
467
+ const raw = JSON.parse(result.out);
468
+ for (const entry of raw) {
469
+ const branch = entry.headRefName ?? '';
470
+ const pr = entry.number ?? 0;
471
+ // `gh` lists newest-first, so the FIRST entry for a branch is its latest PR — keep it.
472
+ if (branch !== '' && pr > 0 && !out.has(branch)) {
473
+ out.set(branch, new PrRef(pr, entry.state ?? ''));
474
+ }
475
+ }
476
+ return out;
477
+ }
478
+ catch (err) {
479
+ const error = (0, to_error_1.toError)(err);
480
+ void error;
481
+ return out;
482
+ }
483
+ }
290
484
  reviveList(raw) {
291
485
  if (!raw)
292
486
  return [];
293
- return raw.map((entry) => new DeletableBranch(entry.branch ?? '', entry.reason ?? '', entry.pr ?? 0));
487
+ return raw.map((entry) => new DeletableBranch(entry.branch ?? '', entry.reason ?? '', entry.pr ?? 0, entry.sha ?? '', entry.commits ?? -1, entry.prState ?? '', entry.classification ?? exports.CLASSIFICATION_NEVER_PROPOSED));
294
488
  }
295
489
  reviveWorktrees(raw) {
296
490
  if (!raw)