@webpieces/rules-config 0.4.925 → 0.4.926

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.
Files changed (40) hide show
  1. package/package.json +5 -6
  2. package/src/config-file.js +4 -2
  3. package/src/config-file.js.map +1 -1
  4. package/src/config-key-rules.js +1 -1
  5. package/src/config-key-rules.js.map +1 -1
  6. package/src/config-repair-bootstrap-source.d.ts +1 -1
  7. package/src/config-repair-bootstrap-source.js +1 -1
  8. package/src/config-repair-bootstrap-source.js.map +1 -1
  9. package/src/config-repair-error.d.ts +46 -0
  10. package/src/config-repair-error.js +83 -0
  11. package/src/config-repair-error.js.map +1 -0
  12. package/src/config-repair-probe.d.ts +7 -1
  13. package/src/config-repair-probe.js +19 -29
  14. package/src/config-repair-probe.js.map +1 -1
  15. package/src/index.d.ts +2 -2
  16. package/src/index.js +7 -7
  17. package/src/index.js.map +1 -1
  18. package/src/legacy-config-upgrade.d.ts +1 -1
  19. package/src/legacy-config-upgrade.js +6 -6
  20. package/src/legacy-config-upgrade.js.map +1 -1
  21. package/src/load-config.d.ts +1 -3
  22. package/src/load-config.js +10 -10
  23. package/src/load-config.js.map +1 -1
  24. package/src/migrate-dirs-cli.js +1 -3
  25. package/src/migrate-dirs-cli.js.map +1 -1
  26. package/src/pack-policy-files.d.ts +10 -1
  27. package/src/pack-policy-files.js +97 -38
  28. package/src/pack-policy-files.js.map +1 -1
  29. package/src/policy-tracking.js +8 -8
  30. package/src/policy-tracking.js.map +1 -1
  31. package/src/rule-pack-sync.d.ts +8 -15
  32. package/src/rule-pack-sync.js +17 -137
  33. package/src/rule-pack-sync.js.map +1 -1
  34. package/templates/webpieces.guard-matrix.md +4 -5
  35. package/src/rule-pack-artifacts.d.ts +0 -23
  36. package/src/rule-pack-artifacts.js +0 -180
  37. package/src/rule-pack-artifacts.js.map +0 -1
  38. package/src/rules-sync-cli.d.ts +0 -7
  39. package/src/rules-sync-cli.js +0 -48
  40. package/src/rules-sync-cli.js.map +0 -1
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;AAE3C,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;AAEhB,6CAA4E;AAAnE,8GAAA,eAAe,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,2GAAA,YAAY,OAAA;AACpD,iGAAiG;AACjG,sCAAsC;AACtC,6DAK+B;AAJ3B,+HAAA,wBAAwB,OAAA;AACxB,wHAAA,iBAAiB,OAAA;AACjB,yHAAA,kBAAkB,OAAA;AAClB,+HAAA,wBAAwB,OAAA;AAE5B,6CAOuB;AANnB,6GAAA,cAAc,OAAA;AACd,8GAAA,eAAe,OAAA;AACf,yGAAA,UAAU,OAAA;AACV,iHAAA,kBAAkB,OAAA;AAClB,oHAAA,qBAAqB,OAAA;AACrB,wHAAA,yBAAyB,OAAA;AAE7B,sGAAsG;AACtG,yGAAyG;AACzG,6CAA8C;AAArC,4GAAA,aAAa,OAAA;AACtB,yCAAgF;AAAvE,2GAAA,cAAc,OAAA;AAAE,4GAAA,eAAe,OAAA;AAAE,6GAAA,gBAAgB,OAAA;AAC1D,wGAAwG;AAC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AAHzB,sHAAA,iBAAiB,OAAA;AACjB,+HAAA,0BAA0B,OAAA;AAC1B,uHAAA,kBAAkB,OAAA;AAGtB,6DAAmC;AACnC,oEAA0C;AAC1C,2DAK8B;AAJ1B,sHAAA,gBAAgB,OAAA;AAChB,8HAAA,wBAAwB,OAAA;AACxB,uHAAA,iBAAiB,OAAA;AACjB,0HAAA,oBAAoB,OAAA;AAGxB,iEAIiC;AAH7B,6HAAA,oBAAoB,OAAA;AACpB,6HAAA,oBAAoB,OAAA;AACpB,4HAAA,mBAAmB,OAAA;AAEvB,yDAK6B;AAJzB,0HAAA,qBAAqB,OAAA;AACrB,uHAAA,kBAAkB,OAAA;AAClB,0HAAA,qBAAqB,OAAA;AACrB,oHAAA,eAAe,OAAA;AAEnB,mDAAqE;AAA5D,8GAAA,YAAY,OAAA;AAAE,qHAAA,mBAAmB,OAAA;AAC1C,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,6DAK+B;AAJ3B,wHAAA,iBAAiB,OAAA;AACjB,2HAAA,oBAAoB,OAAA;AACpB,qHAAA,cAAc,OAAA;AACd,wHAAA,iBAAiB,OAAA;AAErB,+DAKgC;AAJ5B,0HAAA,kBAAkB,OAAA;AAClB,+HAAA,uBAAuB,OAAA;AACvB,mIAAA,2BAA2B,OAAA;AAC3B,gIAAA,wBAAwB,OAAA;AAG5B,uDAA8F;AAArF,kHAAA,cAAc,OAAA;AAAE,wHAAA,oBAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\n\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';\n\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} from './config-error-banner';\nexport {\n findConfigFile,\n CONFIG_FILENAME,\n ConfigFile,\n ConfigParseAttempt,\n CONFIG_PARSE_ATTEMPTS,\n CONFIG_PARSE_RETRY_MILLIS,\n} 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 { 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.\n\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 {\n ClaudeEnv,\n claudeEnv,\n CLAUDE_PROJECT_DIR_ENV,\n CLAUDE_PROJECT_DIR_UNSET,\n} from './claude-env';\n\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 machine-generated trees a line-count rule never fires on. A FLOOR, not a default value:\n// `max-file-lines.allowedPaths` adds to it, so configuring your own tree cannot lose it.\nexport { GENERATED_CODE_PATHS } from './generated-code-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, PathScopeConfig } from './no-custom-css-scope';\nexport {\n loadTemplate,\n writeTemplateIfMissing,\n writeTemplate,\n TemplateWriter,\n} 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 {\n GIT_WORKFLOW_DOC,\n GitWorkflowDoc,\n InstructAiDoc,\n InstructAiDocSet,\n MergeProcessDoc,\n} from './instruct-ai-docs';\nexport {\n MERGE_PROCESS_DOC,\n MergeProcessText,\n MergeRun,\n ReferenceMergeRun,\n} from './merge-process-doc';\nexport { BUILD_LOG_DOC } from './build-log-doc';\nexport {\n validateWebpiecesConfig,\n validatePrGateSection,\n validateChecklistsSection,\n validateExcludePaths,\n validateMatchRulesSection,\n allRuleNames,\n recommendedSeedMode,\n recommendedSeedModeFor,\n seedEntryForRule,\n} from './validate-config';\nexport { validateCommandsSection } from './commands-section-validators';\nexport {\n unknownKeyErrors,\n isCommentKey,\n validateTopLevelKeys,\n COMMENT_KEY_SUFFIX,\n} 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 {\n RETIRED_CONFIG_KEYS,\n RETIRED_SCOPE_KEY,\n RETIRED_SCOPE_RULE,\n isRetiredKey,\n retiredEntry,\n retiredKeyError,\n retiredKeyErrorsIn,\n retiredRuleFor,\n} 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,\n HomeConfigService,\n RetiredHomeConfigKey,\n RETIRED_HOME_CONFIG_KEYS,\n HOME_CONFIG_DIR,\n HOME_CONFIG_FILE,\n HOME_EXPERIMENTAL_SECTION,\n HOME_KEY_ORPHAN_DIR_SWEEP,\n HOME_KEY_WHOLE_REPO_BUILD_GUARD,\n HOME_KEY_MAX_CONCURRENT_BUILDS,\n HOME_KEY_TURN_OFF_ALL_REVIEWERS,\n DEFAULT_MAX_CONCURRENT_BUILDS,\n HOME_KEY_DOC,\n HOME_KEY_AI_DOC,\n DOCUMENTATION_KEYS,\n} from './home-config';\n// The MACHINE-WIDE build ledger, `~/.webpieces/builds.log`. THE one carve-out from\n// `no-machine-global-state.spec.ts`'s rule that webpieces writes only under `{repo}/.webpieces` — the\n// argument is in `decisions/0006-the-build-ledger-is-machine-global.md`, and the short form is that \"how\n// many builds are burning this box's CPU\" is a fact about the MACHINE, is not a cache of anything a\n// remote owns, and cannot be answered from a per-repo file because every linked worktree has its own\n// `.webpieces/` and would be blind to the sibling it is contending with. See builds-log.ts.\nexport {\n BuildsLog,\n BuildTicket,\n BuildTermination,\n RunningBuild,\n BUILDS_LOG_FILE,\n BUILDS_LOCK_FILE,\n BUILD_START,\n BUILD_DONE_SUCCESS,\n BUILD_DONE_FAIL,\n MAX_BUILDS_LOG_BYTES,\n BUILDS_LOG_GENERATIONS,\n MAX_ROW_BYTES,\n} from './builds-log';\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,\n ArchivedOrphan,\n FailedOrphan,\n OrphanSweepResult,\n OrphanSweepManifest,\n TRASH_STATE_DIR,\n TRASH_MANIFEST_FILE,\n 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 { isHookGuard, sectionForRule } from './sections';\nexport { shouldSkipRule, HOTFIX_BUILD_COMMAND, HOTFIX_AUDIT_BANNER } 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 hasDisable,\n MERGE_INFO_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n PUSH_DEV_STATE_FILE,\n PRUNE_UNKNOWN_COMMAND,\n UPGRADE_SHIM_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';\n\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\n\n// The `no-state-paths-in-templates` config, in its own module for the same reason no-client-creation is:\n// rule-configs.ts is at its file-size cap and a rule that carries real defaults belongs beside them.\n\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 ReviewerAgentPolicy,\n REVIEWER_AGENTS_PLACEHOLDER,\n DEFAULT_REVIEWER_AGENT_NAME,\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 ExpectedReviewer,\n TranscriptScan,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\n\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n PrSummary,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n ChecklistOverride,\n ChecklistOverrideService,\n checklistOverrideService,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n prDirFor,\n summaryJsonPath,\n summaryJsonSchemaHint,\n} from './review-json';\n\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\nexport { StaleBinRemoval, StaleBinSweeper, staleBinSweeper } from './stale-bin-sweep';\nexport { RepoScratchDirs, SCRATCH_DIR_NAME } from './repo-scratch-dirs';\nexport {\n TmpScratchSweeper,\n TMP_SCRATCH_RETENTION_DAYS,\n TMP_SCRATCH_PREFIX,\n} from './tmp-scratch-sweep';\n\nexport * from './hook-fault-codes';\nexport * from './hook-config-diagnostics';\nexport {\n RulePackRegistry,\n NodeRulePackModuleLoader,\n RulePackDiscovery,\n RulePackModuleLoader,\n} from './rule-pack-registry';\n\nexport {\n prepareLegacyUpgrade,\n LegacyConfigDocument,\n LegacyUpgradeResult,\n} from './legacy-config-upgrade';\nexport {\n PackPolicyDeclaration,\n SelectedPolicyPack,\n PackPolicyFilesResult,\n PackPolicyFiles,\n} from './pack-policy-files';\nexport { RulePackSync, RulePackSyncOptions } from './rule-pack-sync';\nexport { ConfigRepairAccess } from './config-repair-access';\nexport { ConfigRepairBootstrap } from './config-repair-probe';\nexport {\n RulePackArtifacts,\n RuleArtifactContents,\n RULE_LOCK_FILE,\n RULE_CATALOG_FILE,\n} from './rule-pack-artifacts';\nexport {\n RuleRuntimeModules,\n RuleRuntimeModuleLoader,\n NodeRuleRuntimeModuleLoader,\n RuntimeContributionGroup,\n} from './rule-runtime-modules';\n\nexport { FirstPathMatch, FirstPathMatchResult, PathMatchCandidate } from './first-path-match';\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;AAE3C,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;AAEhB,6CAA4E;AAAnE,8GAAA,eAAe,OAAA;AAAE,2GAAA,YAAY,OAAA;AAAE,2GAAA,YAAY,OAAA;AACpD,iGAAiG;AACjG,sCAAsC;AACtC,6DAK+B;AAJ3B,+HAAA,wBAAwB,OAAA;AACxB,wHAAA,iBAAiB,OAAA;AACjB,yHAAA,kBAAkB,OAAA;AAClB,+HAAA,wBAAwB,OAAA;AAE5B,6CAOuB;AANnB,6GAAA,cAAc,OAAA;AACd,8GAAA,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BAAoB,OAAA;AAAE,sHAAA,kBAAkB,OAAA","sourcesContent":["export { ResolvedConfig, ResolvedRuleConfig, RuleOptions } from './types';\n\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';\n\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} from './config-error-banner';\nexport {\n findConfigFile,\n CONFIG_FILENAME,\n ConfigFile,\n ConfigParseAttempt,\n CONFIG_PARSE_ATTEMPTS,\n CONFIG_PARSE_RETRY_MILLIS,\n} 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 { 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.\n\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 {\n ClaudeEnv,\n claudeEnv,\n CLAUDE_PROJECT_DIR_ENV,\n CLAUDE_PROJECT_DIR_UNSET,\n} from './claude-env';\n\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 machine-generated trees a line-count rule never fires on. A FLOOR, not a default value:\n// `max-file-lines.allowedPaths` adds to it, so configuring your own tree cannot lose it.\nexport { GENERATED_CODE_PATHS } from './generated-code-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, PathScopeConfig } from './no-custom-css-scope';\nexport {\n loadTemplate,\n writeTemplateIfMissing,\n writeTemplate,\n TemplateWriter,\n} 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 {\n GIT_WORKFLOW_DOC,\n GitWorkflowDoc,\n InstructAiDoc,\n InstructAiDocSet,\n MergeProcessDoc,\n} from './instruct-ai-docs';\nexport {\n MERGE_PROCESS_DOC,\n MergeProcessText,\n MergeRun,\n ReferenceMergeRun,\n} from './merge-process-doc';\nexport { BUILD_LOG_DOC } from './build-log-doc';\nexport {\n validateWebpiecesConfig,\n validatePrGateSection,\n validateChecklistsSection,\n validateExcludePaths,\n validateMatchRulesSection,\n allRuleNames,\n recommendedSeedMode,\n recommendedSeedModeFor,\n seedEntryForRule,\n} from './validate-config';\nexport { validateCommandsSection } from './commands-section-validators';\nexport {\n unknownKeyErrors,\n isCommentKey,\n validateTopLevelKeys,\n COMMENT_KEY_SUFFIX,\n} 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 {\n RETIRED_CONFIG_KEYS,\n RETIRED_SCOPE_KEY,\n RETIRED_SCOPE_RULE,\n isRetiredKey,\n retiredEntry,\n retiredKeyError,\n retiredKeyErrorsIn,\n retiredRuleFor,\n} 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,\n HomeConfigService,\n RetiredHomeConfigKey,\n RETIRED_HOME_CONFIG_KEYS,\n HOME_CONFIG_DIR,\n HOME_CONFIG_FILE,\n HOME_EXPERIMENTAL_SECTION,\n HOME_KEY_ORPHAN_DIR_SWEEP,\n HOME_KEY_WHOLE_REPO_BUILD_GUARD,\n HOME_KEY_MAX_CONCURRENT_BUILDS,\n HOME_KEY_TURN_OFF_ALL_REVIEWERS,\n DEFAULT_MAX_CONCURRENT_BUILDS,\n HOME_KEY_DOC,\n HOME_KEY_AI_DOC,\n DOCUMENTATION_KEYS,\n} from './home-config';\n// The MACHINE-WIDE build ledger, `~/.webpieces/builds.log`. THE one carve-out from\n// `no-machine-global-state.spec.ts`'s rule that webpieces writes only under `{repo}/.webpieces` — the\n// argument is in `decisions/0006-the-build-ledger-is-machine-global.md`, and the short form is that \"how\n// many builds are burning this box's CPU\" is a fact about the MACHINE, is not a cache of anything a\n// remote owns, and cannot be answered from a per-repo file because every linked worktree has its own\n// `.webpieces/` and would be blind to the sibling it is contending with. See builds-log.ts.\nexport {\n BuildsLog,\n BuildTicket,\n BuildTermination,\n RunningBuild,\n BUILDS_LOG_FILE,\n BUILDS_LOCK_FILE,\n BUILD_START,\n BUILD_DONE_SUCCESS,\n BUILD_DONE_FAIL,\n MAX_BUILDS_LOG_BYTES,\n BUILDS_LOG_GENERATIONS,\n MAX_ROW_BYTES,\n} from './builds-log';\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,\n ArchivedOrphan,\n FailedOrphan,\n OrphanSweepResult,\n OrphanSweepManifest,\n TRASH_STATE_DIR,\n TRASH_MANIFEST_FILE,\n 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 { isHookGuard, sectionForRule } from './sections';\nexport { shouldSkipRule, HOTFIX_BUILD_COMMAND, HOTFIX_AUDIT_BANNER } 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 hasDisable,\n MERGE_INFO_DIR,\n MERGE_IN_PROGRESS_FILE,\n MERGE_EXPLANATION_FILE,\n PUSH_DEV_STATE_FILE,\n PRUNE_UNKNOWN_COMMAND,\n UPGRADE_SHIM_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';\n\n// Mode unions + their value arrays — the single source of truth shared with code-rules.\n\n// The `no-state-paths-in-templates` config, in its own module for the same reason no-client-creation is:\n// rule-configs.ts is at its file-size cap and a rule that carries real defaults belongs beside them.\n\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 ReviewerAgentPolicy,\n REVIEWER_AGENTS_PLACEHOLDER,\n DEFAULT_REVIEWER_AGENT_NAME,\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 ExpectedReviewer,\n TranscriptScan,\n ProvenanceResult,\n PROVENANCE_OK,\n PROVENANCE_MISSING,\n PROVENANCE_SKIPPED,\n} from './subagent-provenance';\n\nexport {\n ReviewProvenanceService,\n ReviewProvenance,\n ReviewerTranscript,\n ReviewerPaths,\n OfferedContext,\n ProvenanceWriteRequest,\n DEFAULT_RETENTION_DAYS,\n} from './review-provenance';\nexport {\n PrSummary,\n PrContext,\n ChecklistResult,\n ChecklistVerdict,\n ChecklistOverride,\n ChecklistOverrideService,\n checklistOverrideService,\n CK_PASS,\n CK_WARN,\n CK_OVERRIDDEN,\n CK_ORANGE_FIXED,\n CK_ORANGE,\n CK_FAIL,\n CK_MISSING,\n CK_BAD_FORMAT,\n VERDICT_GREEN,\n VERDICT_YELLOW,\n VERDICT_ORANGE,\n VERDICT_RED,\n VERDICT_STATUSES,\n RequiredChecklist,\n ChecklistReviewContext,\n ReviewJsonService,\n prDirFor,\n summaryJsonPath,\n summaryJsonSchemaHint,\n} from './review-json';\n\nexport {\n CommandsConfig,\n buildCommandsConfig,\n DEFAULT_UPSERT_PR_COMMAND,\n DEFAULT_MERGE_COMPLETE_COMMAND,\n} from './commands-config';\nexport { StaleBinRemoval, StaleBinSweeper, staleBinSweeper } from './stale-bin-sweep';\nexport { RepoScratchDirs, SCRATCH_DIR_NAME } from './repo-scratch-dirs';\nexport {\n TmpScratchSweeper,\n TMP_SCRATCH_RETENTION_DAYS,\n TMP_SCRATCH_PREFIX,\n} from './tmp-scratch-sweep';\n\nexport * from './hook-fault-codes';\nexport * from './hook-config-diagnostics';\nexport {\n RulePackRegistry,\n NodeRulePackModuleLoader,\n RulePackDiscovery,\n RulePackModuleLoader,\n} from './rule-pack-registry';\n\nexport {\n prepareLegacyUpgrade,\n LegacyConfigDocument,\n LegacyUpgradeResult,\n} from './legacy-config-upgrade';\nexport {\n PackPolicyDeclaration,\n SelectedPolicyPack,\n PackPolicyFilesResult,\n PackPolicyFiles,\n} from './pack-policy-files';\nexport { RulePackSync } from './rule-pack-sync';\nexport { ConfigRepairAccess } from './config-repair-access';\nexport { ConfigRepairBootstrap } from './config-repair-probe';\nexport {\n ConfigRepairCure,\n ConfigRepairError,\n EditFileCure,\n RunCommandCure,\n RepositoryLayoutRepair,\n} from './config-repair-error';\nexport {\n RuleRuntimeModules,\n RuleRuntimeModuleLoader,\n NodeRuleRuntimeModuleLoader,\n RuntimeContributionGroup,\n} from './rule-runtime-modules';\n\nexport { FirstPathMatch, FirstPathMatchResult, PathMatchCandidate } from './first-path-match';\n"]}
@@ -1,4 +1,4 @@
1
- /** Previous-root conversion is reachable only through an explicit upgrade command; normal loading never calls it. */
1
+ /** Builds a complete flat config from a registry — a test-fixture builder. No production command runs it, and normal loading never calls it (#1273). */
2
2
  import { RulePackRegistry } from './rule-pack-registry';
3
3
  type Json = Record<string, unknown>;
4
4
  type RuleEntry = Json;
@@ -67,7 +67,7 @@ function seedRule(ruleName, registry) {
67
67
  // invites a consumer to delete it and believe the exemption went with it.
68
68
  // Bring an existing `excludePaths` forward to the single-list shape. Already a list → untouched.
69
69
  // Legacy `{ rules, guards }` → unioned (order preserved, duplicates dropped) and recorded as a change
70
- // so `pnpm wp-rules-sync --upgrade` is the migration path rather than a hand-edit. Anything else → seeded [].
70
+ // so the conversion reports it rather than rewriting it silently. Anything else → seeded [].
71
71
  // webpieces-disable no-any-unknown -- opaque legacy JSON is narrowed before use
72
72
  // webpieces-disable no-function-outside-class -- pure legacy config conversion helper
73
73
  function migrateExcludePaths(raw, changes) {
@@ -169,8 +169,8 @@ function migrateRetiredRuleNames(section, changes, registry) {
169
169
  * the first key it met and then, finding the destination already present, DELETED each of the other
170
170
  * three outright — so which guard's settings survived depended on RETIRED_CONFIG_KEYS declaration
171
171
  * order rather than on the consumer's file, and the survivor carried only that one guard's fields, so
172
- * it was missing required fields of the merged schema. `pnpm wp-rules-sync --upgrade` is the command advertised
173
- * as the migration path; half-migrating every consumer into an invalid config is not an option.
172
+ * it was missing required fields of the merged schema. A conversion that half-merges
173
+ * would hand every fixture an invalid config, which is not an option.
174
174
  *
175
175
  * UNION, first writer wins per field. Earlier-declared keys are the more specific ones (only
176
176
  * feature-branch-guard carries `branchNamingConvention`), and a field already present on the
@@ -235,11 +235,11 @@ function fillRequiredFields(section, changes, registry) {
235
235
  }
236
236
  // Deep-copy the framework's default match-rules (the no-fetch guard) into plain JSON for the config
237
237
  // file. Round-tripping through JSON turns the MatchRuleConfig instances into plain objects.
238
- // webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: `pnpm wp-rules-sync --upgrade` must run on a half-written node_modules (see install-entry.ts), so it cannot build a container to hold a method
238
+ // webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: plain functions keep the fixture builder free of any container
239
239
  function seedMatchRules() {
240
240
  return JSON.parse(JSON.stringify(match_rules_config_1.DEFAULT_MATCH_RULES));
241
241
  }
242
- // webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: `pnpm wp-rules-sync --upgrade` must run on a half-written node_modules (see install-entry.ts), so it cannot build a container to hold a method
242
+ // webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: plain functions keep the fixture builder free of any container
243
243
  function asSection(value) {
244
244
  return typeof value === 'object' && value !== null && !Array.isArray(value)
245
245
  ? value
@@ -247,7 +247,7 @@ function asSection(value) {
247
247
  }
248
248
  // Migrate an existing config to the rules / hookGuards / commands layout and add any missing rules.
249
249
  // Returns a human-readable list of what changed (empty = already up to date).
250
- // webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: `pnpm wp-rules-sync --upgrade` must run on a half-written node_modules (see install-entry.ts), so it cannot build a container to hold a method
250
+ // webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: plain functions keep the fixture builder free of any container
251
251
  function prepareLegacyUpgrade(existing, registry) {
252
252
  const changes = [];
253
253
  const rules = asSection(existing['rules']);
@@ -1 +1 @@
1
- {"version":3,"file":"legacy-config-upgrade.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/legacy-config-upgrade.ts"],"names":[],"mappings":";;;AA+QA,oDAiEC;AA9UD,uDAAmE;AACnE,iDAAkD;AAClD,yCAAyD;AACzD,6DAA2D;AAC3D,qDAAyD;AACzD,+DAA2D;AAE3D,oFAAoF;AACpF,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AACpD,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAS1D,MAAa,oBAAoB;IAKhB;IACA;IACA;IACA;IAEA;IATJ,aAAa,CAAS;IACtB,OAAO,CAAqB;IACrC,yDAAyD;IACzD,YACa,KAAc,EACd,UAAmB,EACnB,QAAc,EACd,YAAsB,EAC/B,OAAe,EACN,QAAkB,EAC3B,aAAiC;QANxB,UAAK,GAAL,KAAK,CAAS;QACd,eAAU,GAAV,UAAU,CAAS;QACnB,aAAQ,GAAR,QAAQ,CAAM;QACd,iBAAY,GAAZ,YAAY,CAAU;QAEtB,aAAQ,GAAR,QAAQ,CAAU;QAG3B,IAAI,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC;QAC9B,IAAI,CAAC,OAAO,GAAG,aAAa,CAAC;IACjC,CAAC;CACJ;AAhBD,oDAgBC;AAED,MAAa,mBAAmB;IAEf;IACA;IAFb,YACa,MAA4B,EAC5B,OAAiB;QADjB,WAAM,GAAN,MAAM,CAAsB;QAC5B,YAAO,GAAP,OAAO,CAAU;IAC3B,CAAC;CACP;AALD,kDAKC;AAED,oIAAoI;AACpI,SAAS,QAAQ,CAAC,QAAgB,EAAE,QAA0B;IAC1D,4FAA4F;IAC5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nG,2EAA2E;IAC3E,IAAI,UAAkB,CAAC;IACvB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QACzC,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAW,CAAC;IACnD,CAAC;SAAM,CAAC;QACJ,UAAU,GAAG,cAAc,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["/** Previous-root conversion is reachable only through an explicit upgrade command; normal loading never calls it. */\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { allRuleNames, seedEntryForRule } from './validate-config';\nimport { schemaFieldNames } from './rule-schemas';\nimport { sectionForRule, isHookGuard } from './sections';\nimport { DEFAULT_MATCH_RULES } from './match-rules-config';\nimport { DEFAULT_BUILD_COMMAND } from './pr-gate-config';\nimport { RETIRED_SCOPE_RULE } from './retired-config-keys';\n\n// Explicit upgrade applies owner-declared retirements and writes reviewed settings.\nconst DEFAULT_UPSERT_PR = 'pnpm wp-start-upsert-pr';\nconst DEFAULT_MERGE_COMPLETE = 'pnpm wp-finish-upsert-pr';\n// ---------------------------------------------------------------------------\n// webpieces.config.json seeding + migration to the rules / hookGuards / commands layout.\n// ---------------------------------------------------------------------------\n// webpieces-disable no-any-unknown -- webpieces.config.json / settings.json are opaque consumer JSON\ntype Json = Record<string, unknown>;\ntype RuleEntry = Json;\ntype Section = Record<string, RuleEntry>;\n\nexport class LegacyConfigDocument {\n readonly 'match-rules': Json[];\n readonly extends: string | undefined;\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n readonly rules: Section,\n readonly hookGuards: Section,\n readonly commands: Json,\n readonly excludePaths: string[],\n matches: Json[],\n readonly rulesDir: string[],\n inheritedFrom: string | undefined,\n ) {\n this['match-rules'] = matches;\n this.extends = inheritedFrom;\n }\n}\n\nexport class LegacyUpgradeResult {\n constructor(\n readonly config: LegacyConfigDocument,\n readonly changes: string[],\n ) {}\n}\n\n// webpieces-disable no-function-outside-class -- sibling of the other seed* helpers; this module is config-shape builders by design\nfunction seedRule(ruleName: string, registry: RulePackRegistry): RuleEntry {\n // Both escape hatches are seeded (and REQUIRED) so every rule block shows them: 0 = active,\n // null = no branch scoping. A human/AI edits these to time-box or branch-scope a rule off.\n //\n // The ENTIRE entry comes from rules-config's seedEntryForRule() — the same module that owns the\n // schema the loader validates against, so the installer can never emit an entry the loader\n // rejects. It supplies: the recommended mode (the SAME recommendation the validator prints in its\n // copy-paste snippet, so seed and advice cannot disagree), both hatches, and a default for every\n // other schema-REQUIRED field. Seeding used to be a flat 'OFF' plus the two hatches, which was\n // wrong twice over: adopters got nothing enforced, AND the entry was missing required fields\n // (e.g. branch-creation-guard.autoReapMergedBranches), so the config failed to load on first run.\n return seedEntryForRule(ruleName, registry);\n}\n\n// The guard-hint command strings live under `guardHints`. The flat `upsertPr`/`mergeComplete` keys this\n// used to seed are RETIRED and now fail validation — seeding them meant every freshly installed repo was\n// born on a shape the validator rejects.\n\n// Required excludePaths block: ONE glob list suppressing hook enforcement per file path. Seeded empty\n// (enforce everywhere) — a client adds paths (e.g. \"repositories/**\") to exempt vendored trees.\n//\n// Deliberately NOT seeded with webpieces' own `.webpieces/` state dir. That exemption lives in CODE\n// (`isWebpiecesStateDir`, consulted by `filterByExcludedPaths` ahead of this list and regardless of it),\n// and a glob here would be a second, weaker spelling of it — weaker because `.webpieces/**` compiles to\n// an anchored regex that misses the bare directory the predicate matches, and because a config entry\n// invites a consumer to delete it and believe the exemption went with it.\n\n// Bring an existing `excludePaths` forward to the single-list shape. Already a list → untouched.\n// Legacy `{ rules, guards }` → unioned (order preserved, duplicates dropped) and recorded as a change\n// so `pnpm wp-rules-sync --upgrade` is the migration path rather than a hand-edit. Anything else → seeded [].\n// webpieces-disable no-any-unknown -- opaque legacy JSON is narrowed before use\n// webpieces-disable no-function-outside-class -- pure legacy config conversion helper\nfunction migrateExcludePaths(raw: unknown, changes: string[]): string[] {\n if (Array.isArray(raw)) return (raw as string[]).filter((p: string) => typeof p === 'string');\n if (typeof raw === 'object' && raw !== null) {\n // webpieces-disable no-any-unknown -- narrowing the opaque legacy block from consumer JSON\n const legacy = raw as Record<string, unknown>;\n const rules = Array.isArray(legacy['rules']) ? (legacy['rules'] as string[]) : [];\n const guards = Array.isArray(legacy['guards']) ? (legacy['guards'] as string[]) : [];\n const merged = [\n ...new Set([...rules, ...guards].filter((p: string) => typeof p === 'string')),\n ];\n changes.push(`migrated excludePaths {rules,guards} -> one list (${merged.length} path(s))`);\n return merged;\n }\n changes.push('added excludePaths ([])');\n return [];\n}\n\n/** One retired flat command string and the guardHints field it becomes. Data-only (per CLAUDE.md). */\nclass GuardHintMove {\n retiredKey: string;\n hintKey: string;\n fallback: string;\n\n constructor(retiredKey: string, hintKey: string, fallback: string) {\n this.retiredKey = retiredKey;\n this.hintKey = hintKey;\n this.fallback = fallback;\n }\n}\n\n/**\n * Bring `commands` forward to the `guardHints` shape, moving the RETIRED flat `upsertPr`/`mergeComplete`\n * strings and DELETING them. Deleting is the point: the validator now rejects them, so leaving them behind\n * would keep the config failing after a \"successful\" sync.\n *\n * The consumer's own value wins over the default — a repo that renamed its gated command keeps that name.\n */\n// webpieces-disable no-function-outside-class -- sibling of the other seed*/migrate* helpers; this module is config-shape builders by design\nfunction migrateGuardHints(commands: Json, changes: string[]): void {\n const hints: Json =\n typeof commands['guardHints'] === 'object' && commands['guardHints'] !== null\n ? (commands['guardHints'] as Json)\n : {};\n const moves: readonly GuardHintMove[] = [\n new GuardHintMove('upsertPr', 'prCreationOrPush', DEFAULT_UPSERT_PR),\n new GuardHintMove('mergeComplete', 'mergeInProgress', DEFAULT_MERGE_COMPLETE),\n ];\n for (const move of moves) {\n const retiredKey = move.retiredKey;\n const hintKey = move.hintKey;\n const fallback = move.fallback;\n const carried = commands[retiredKey];\n if (carried !== undefined) {\n delete commands[retiredKey];\n if (hints[hintKey] === undefined) hints[hintKey] = carried;\n changes.push(`moved retired commands.${retiredKey} -> commands.guardHints.${hintKey}`);\n }\n if (hints[hintKey] === undefined) {\n hints[hintKey] = fallback;\n changes.push(`added commands.guardHints.${hintKey}`);\n }\n }\n commands['guardHints'] = hints;\n}\n\n/**\n * Apply the RETIRED rule/guard retirements in place. These used to be rewritten silently at load time, so\n * a consumer's file kept the dead name forever; the loader now rejects it, which makes this the one\n * command that can fix the file. Skips a rename when the new name is already configured, so an explicit\n * entry is never clobbered by a stale one.\n *\n * NOT EVERY RETIREMENT IS A RENAME, and treating them all as one produced garbage. `whole-repo-build-guard`\n * moved OUT of webpieces.config.json entirely — its `movedTo` is the PROSE destination\n * `~/.webpieces/config.json → experimental.whole-repo-build-guard`, not a sibling key — so the rename\n * branch below would have created a hookGuards entry literally named that whole sentence, which no\n * validator knows and which the next run reports as another unknown rule. `prunable` is the discriminator:\n * when the entry says deleting is the whole fix, DELETE it, exactly as `ConfigPruner` does.\n */\n// webpieces-disable no-function-outside-class -- sibling of the other seed*/migrate* helpers; this module is config-shape builders by design\nfunction migrateRetiredRuleNames(\n section: Section,\n changes: string[],\n registry: RulePackRegistry,\n): void {\n for (const entry of registry.migrations()) {\n if (entry.scope !== RETIRED_SCOPE_RULE) continue;\n if (!(entry.key in section)) continue;\n if (entry.prunable) {\n delete section[entry.key];\n changes.push(`deleted retired \"${entry.key}\" (it moved to ${entry.movedTo})`);\n continue;\n }\n mergeIntoDestination(section, entry.key, entry.movedTo, changes, registry);\n }\n fillRequiredFields(section, changes, registry);\n}\n\n/**\n * Fold one retired key's entry into its destination, whether the destination exists yet or not.\n *\n * THIS IS N→1, NOT 1:1, and the difference is the whole reason this helper exists. Four retired keys\n * now point at ONE destination (`branch-state-guard`, `pr-lifecycle-guard`). The previous code renamed\n * the first key it met and then, finding the destination already present, DELETED each of the other\n * three outright — so which guard's settings survived depended on RETIRED_CONFIG_KEYS declaration\n * order rather than on the consumer's file, and the survivor carried only that one guard's fields, so\n * it was missing required fields of the merged schema. `pnpm wp-rules-sync --upgrade` is the command advertised\n * as the migration path; half-migrating every consumer into an invalid config is not an option.\n *\n * UNION, first writer wins per field. Earlier-declared keys are the more specific ones (only\n * feature-branch-guard carries `branchNamingConvention`), and a field already present on the\n * destination — because the consumer wrote it, or an earlier key contributed it — is never overwritten.\n * Fields the merged schema does not know are dropped by the same pass, since carrying a deleted field\n * across (`upsertPrCommand`) would produce a config the validator immediately rejects.\n */\n// webpieces-disable no-function-outside-class -- sibling of the other seed*/migrate* helpers; this module is config-shape builders by design\nfunction mergeIntoDestination(\n section: Section,\n key: string,\n destination: string,\n changes: string[],\n registry: RulePackRegistry,\n): void {\n const source = asSection(section[key]);\n delete section[key];\n const fields = schemaFieldNames(destination, registry);\n const target = asSection(section[destination]);\n const existed = destination in section;\n const carried: string[] = [];\n const dropped: string[] = [];\n for (const field of Object.keys(source)) {\n if (fields !== null && !fields.includes(field)) {\n dropped.push(field);\n continue;\n }\n if (field in target) continue;\n target[field] = source[field];\n carried.push(field);\n }\n section[destination] = target;\n const verb = existed ? 'merged' : 'renamed';\n const droppedNote =\n dropped.length > 0 ? `; dropped deleted field(s) ${dropped.join(', ')}` : '';\n changes.push(\n `${verb} retired \"${key}\" -> \"${destination}\" (carried ${carried.join(', ') || 'nothing new'}${droppedNote})`,\n );\n}\n\n/**\n * Fill any schema-REQUIRED field a migrated entry ended up without.\n *\n * A union of four partial entries is not guaranteed to satisfy the destination's schema — the merged\n * `branch-state-guard` needs `mode` and both escape hatches, and a consumer whose four old entries\n * predate one of them would land short. Seeding the gap from the SAME source the installer and the\n * validator use (seedEntryForRule) is what makes the install command a complete instruction\n * rather than a first step. Only ever ADDS; a value the consumer stated is never touched.\n */\n// webpieces-disable no-function-outside-class -- sibling of the other seed*/migrate* helpers; this module is config-shape builders by design\nfunction fillRequiredFields(section: Section, changes: string[], registry: RulePackRegistry): void {\n for (const name of Object.keys(section)) {\n if (schemaFieldNames(name, registry) === null) continue;\n // A rule ENTRY is a flat bag of scalars, so it is read as Json here rather than through\n // asSection (whose values are whole entries). Same object either way; only the view differs.\n const entry: Json = asSection(section[name]);\n const seed = seedEntryForRule(name, registry);\n const added: string[] = [];\n for (const field of Object.keys(seed)) {\n if (field in entry) continue;\n entry[field] = seed[field];\n added.push(field);\n }\n if (added.length === 0) continue;\n section[name] = entry;\n changes.push(`filled required field(s) on \"${name}\": ${added.join(', ')}`);\n }\n}\n\n// Deep-copy the framework's default match-rules (the no-fetch guard) into plain JSON for the config\n// file. Round-tripping through JSON turns the MatchRuleConfig instances into plain objects.\n// webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: `pnpm wp-rules-sync --upgrade` must run on a half-written node_modules (see install-entry.ts), so it cannot build a container to hold a method\nfunction seedMatchRules(): Json[] {\n return JSON.parse(JSON.stringify(DEFAULT_MATCH_RULES)) as Json[];\n}\n\n// webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: `pnpm wp-rules-sync --upgrade` must run on a half-written node_modules (see install-entry.ts), so it cannot build a container to hold a method\nfunction asSection(value: Json[string]): Section {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Section)\n : {};\n}\n\n// Migrate an existing config to the rules / hookGuards / commands layout and add any missing rules.\n// Returns a human-readable list of what changed (empty = already up to date).\n// webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: `pnpm wp-rules-sync --upgrade` must run on a half-written node_modules (see install-entry.ts), so it cannot build a container to hold a method\nexport function prepareLegacyUpgrade(\n existing: Json,\n registry: RulePackRegistry,\n): LegacyUpgradeResult {\n const changes: string[] = [];\n const rules: Section = asSection(existing['rules']);\n const hookGuards: Section = asSection(existing['hookGuards']);\n const commands: Json =\n typeof existing['commands'] === 'object' && existing['commands'] !== null\n ? (existing['commands'] as Json)\n : {};\n\n // Move a deprecated top-level pr-gate block under commands.\n if (existing['pr-gate'] !== undefined && commands['pr-gate'] === undefined) {\n commands['pr-gate'] = existing['pr-gate'];\n changes.push('moved top-level \"pr-gate\" → commands[\"pr-gate\"]');\n }\n // Apply retired RENAMES first, so a renamed guard is placed and presence-checked under its new name\n // rather than being treated as unknown and re-added alongside its own stale entry.\n migrateRetiredRuleNames(rules, changes, registry);\n migrateRetiredRuleNames(hookGuards, changes, registry);\n\n migratePolicySections(rules, hookGuards, changes, registry);\n // Add any missing built-in into its correct section, ENFORCING at its recommended mode (not OFF).\n for (const name of allRuleNames(registry)) {\n const target = sectionForRule(name, registry) === 'hookGuards' ? hookGuards : rules;\n if (!(name in target)) {\n const entry = seedRule(name, registry);\n target[name] = entry;\n changes.push(\n `added \"${name}\" (${String(entry['mode'])}) to ${sectionForRule(name, registry)}`,\n );\n }\n }\n // Fill command defaults.\n if (commands['pr-gate'] === undefined) {\n commands['pr-gate'] = { mode: 'OFF', buildCommand: DEFAULT_BUILD_COMMAND, gates: [] };\n changes.push('added commands[\"pr-gate\"] (OFF)');\n }\n migrateGuardHints(commands, changes);\n\n // Seed the now-required excludePaths list (empty = enforce everywhere) if the config predates it,\n // and MIGRATE the legacy `{ rules: [], guards: [] }` object to the single list by unioning them.\n // The union is behaviour-preserving for every config we have seen (both lists set identically), and\n // widening is the safe direction anyway: a path either side excluded stays excluded.\n const excludePaths: string[] = migrateExcludePaths(existing['excludePaths'], changes);\n\n const matchRules = upgradeMatchRules(existing, changes);\n\n const rulesDir: string[] = Array.isArray(existing['rulesDir'])\n ? (existing['rulesDir'] as string[])\n : [];\n const inherited = typeof existing['extends'] === 'string' ? existing['extends'] : undefined;\n return new LegacyUpgradeResult(\n new LegacyConfigDocument(\n rules,\n hookGuards,\n commands,\n excludePaths,\n matchRules,\n rulesDir,\n inherited,\n ),\n changes,\n );\n}\n\n// webpieces-disable no-function-outside-class -- explicit upgrade conversion remains independent of DI\nfunction migratePolicySections(rules: Section, hookGuards: Section, changes: string[], registry: RulePackRegistry): void {\n // Move guards mistakenly left in rules into hookGuards.\n for (const name of Object.keys(rules)) {\n if (isHookGuard(name, registry)) {\n hookGuards[name] = rules[name];\n delete rules[name];\n changes.push(`moved \"${name}\" from rules → hookGuards`);\n }\n }\n // Move code rules mistakenly placed in hookGuards back into rules.\n for (const name of Object.keys(hookGuards)) {\n if (!isHookGuard(name, registry) && allRuleNames(registry).includes(name)) {\n rules[name] = hookGuards[name];\n delete hookGuards[name];\n changes.push(`moved \"${name}\" from hookGuards → rules`);\n }\n }\n}\n\n// webpieces-disable no-function-outside-class -- pure explicit-upgrade conversion\nfunction upgradeMatchRules(existing: Json, changes: string[]): Json[] {\n // Seed the now-required match-rules array (with the default no-fetch guard) if the config predates\n // it. A client that has already customized it keeps their array untouched.\n let matchRules: Json[];\n if (Array.isArray(existing['match-rules'])) {\n matchRules = existing['match-rules'] as Json[];\n } else {\n matchRules = seedMatchRules();\n changes.push('added \"match-rules\" (seeded with the no-fetch guard)');\n }\n\n return matchRules;\n}\n"]}
1
+ {"version":3,"file":"legacy-config-upgrade.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/legacy-config-upgrade.ts"],"names":[],"mappings":";;;AA+QA,oDAiEC;AA9UD,uDAAmE;AACnE,iDAAkD;AAClD,yCAAyD;AACzD,6DAA2D;AAC3D,qDAAyD;AACzD,+DAA2D;AAE3D,oFAAoF;AACpF,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AACpD,MAAM,sBAAsB,GAAG,0BAA0B,CAAC;AAS1D,MAAa,oBAAoB;IAKhB;IACA;IACA;IACA;IAEA;IATJ,aAAa,CAAS;IACtB,OAAO,CAAqB;IACrC,yDAAyD;IACzD,YACa,KAAc,EACd,UAAmB,EACnB,QAAc,EACd,YAAsB,EAC/B,OAAe,EACN,QAAkB,EAC3B,aAAiC;QANxB,UAAK,GAAL,KAAK,CAAS;QACd,eAAU,GAAV,UAAU,CAAS;QACnB,aAAQ,GAAR,QAAQ,CAAM;QACd,iBAAY,GAAZ,YAAY,CAAU;QAEtB,aAAQ,GAAR,QAAQ,CAAU;QAG3B,IAAI,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC;QAC9B,IAAI,CAA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,CAAC,EAAE,CAAC;YACxE,KAAK,CAAC,IAAI,CAAC,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC;YAC/B,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;YACxB,OAAO,CAAC,IAAI,CAAC,UAAU,IAAI,2BAA2B,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC;AACL,CAAC;AAED,kFAAkF;AAClF,SAAS,iBAAiB,CAAC,QAAc,EAAE,OAAiB;IACxD,mGAAmG;IACnG,2EAA2E;IAC3E,IAAI,UAAkB,CAAC;IACvB,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;QACzC,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAW,CAAC;IACnD,CAAC;SAAM,CAAC;QACJ,UAAU,GAAG,cAAc,EAAE,CAAC;QAC9B,OAAO,CAAC,IAAI,CAAC,sDAAsD,CAAC,CAAC;IACzE,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC","sourcesContent":["/** Builds a complete flat config from a registry — a test-fixture builder. No production command runs it, and normal loading never calls it (#1273). */\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { allRuleNames, seedEntryForRule } from './validate-config';\nimport { schemaFieldNames } from './rule-schemas';\nimport { sectionForRule, isHookGuard } from './sections';\nimport { DEFAULT_MATCH_RULES } from './match-rules-config';\nimport { DEFAULT_BUILD_COMMAND } from './pr-gate-config';\nimport { RETIRED_SCOPE_RULE } from './retired-config-keys';\n\n// Explicit upgrade applies owner-declared retirements and writes reviewed settings.\nconst DEFAULT_UPSERT_PR = 'pnpm wp-start-upsert-pr';\nconst DEFAULT_MERGE_COMPLETE = 'pnpm wp-finish-upsert-pr';\n// ---------------------------------------------------------------------------\n// webpieces.config.json seeding + migration to the rules / hookGuards / commands layout.\n// ---------------------------------------------------------------------------\n// webpieces-disable no-any-unknown -- webpieces.config.json / settings.json are opaque consumer JSON\ntype Json = Record<string, unknown>;\ntype RuleEntry = Json;\ntype Section = Record<string, RuleEntry>;\n\nexport class LegacyConfigDocument {\n readonly 'match-rules': Json[];\n readonly extends: string | undefined;\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n readonly rules: Section,\n readonly hookGuards: Section,\n readonly commands: Json,\n readonly excludePaths: string[],\n matches: Json[],\n readonly rulesDir: string[],\n inheritedFrom: string | undefined,\n ) {\n this['match-rules'] = matches;\n this.extends = inheritedFrom;\n }\n}\n\nexport class LegacyUpgradeResult {\n constructor(\n readonly config: LegacyConfigDocument,\n readonly changes: string[],\n ) {}\n}\n\n// webpieces-disable no-function-outside-class -- sibling of the other seed* helpers; this module is config-shape builders by design\nfunction seedRule(ruleName: string, registry: RulePackRegistry): RuleEntry {\n // Both escape hatches are seeded (and REQUIRED) so every rule block shows them: 0 = active,\n // null = no branch scoping. A human/AI edits these to time-box or branch-scope a rule off.\n //\n // The ENTIRE entry comes from rules-config's seedEntryForRule() — the same module that owns the\n // schema the loader validates against, so the installer can never emit an entry the loader\n // rejects. It supplies: the recommended mode (the SAME recommendation the validator prints in its\n // copy-paste snippet, so seed and advice cannot disagree), both hatches, and a default for every\n // other schema-REQUIRED field. Seeding used to be a flat 'OFF' plus the two hatches, which was\n // wrong twice over: adopters got nothing enforced, AND the entry was missing required fields\n // (e.g. branch-creation-guard.autoReapMergedBranches), so the config failed to load on first run.\n return seedEntryForRule(ruleName, registry);\n}\n\n// The guard-hint command strings live under `guardHints`. The flat `upsertPr`/`mergeComplete` keys this\n// used to seed are RETIRED and now fail validation — seeding them meant every freshly installed repo was\n// born on a shape the validator rejects.\n\n// Required excludePaths block: ONE glob list suppressing hook enforcement per file path. Seeded empty\n// (enforce everywhere) — a client adds paths (e.g. \"repositories/**\") to exempt vendored trees.\n//\n// Deliberately NOT seeded with webpieces' own `.webpieces/` state dir. That exemption lives in CODE\n// (`isWebpiecesStateDir`, consulted by `filterByExcludedPaths` ahead of this list and regardless of it),\n// and a glob here would be a second, weaker spelling of it — weaker because `.webpieces/**` compiles to\n// an anchored regex that misses the bare directory the predicate matches, and because a config entry\n// invites a consumer to delete it and believe the exemption went with it.\n\n// Bring an existing `excludePaths` forward to the single-list shape. Already a list → untouched.\n// Legacy `{ rules, guards }` → unioned (order preserved, duplicates dropped) and recorded as a change\n// so the conversion reports it rather than rewriting it silently. Anything else → seeded [].\n// webpieces-disable no-any-unknown -- opaque legacy JSON is narrowed before use\n// webpieces-disable no-function-outside-class -- pure legacy config conversion helper\nfunction migrateExcludePaths(raw: unknown, changes: string[]): string[] {\n if (Array.isArray(raw)) return (raw as string[]).filter((p: string) => typeof p === 'string');\n if (typeof raw === 'object' && raw !== null) {\n // webpieces-disable no-any-unknown -- narrowing the opaque legacy block from consumer JSON\n const legacy = raw as Record<string, unknown>;\n const rules = Array.isArray(legacy['rules']) ? (legacy['rules'] as string[]) : [];\n const guards = Array.isArray(legacy['guards']) ? (legacy['guards'] as string[]) : [];\n const merged = [\n ...new Set([...rules, ...guards].filter((p: string) => typeof p === 'string')),\n ];\n changes.push(`migrated excludePaths {rules,guards} -> one list (${merged.length} path(s))`);\n return merged;\n }\n changes.push('added excludePaths ([])');\n return [];\n}\n\n/** One retired flat command string and the guardHints field it becomes. Data-only (per CLAUDE.md). */\nclass GuardHintMove {\n retiredKey: string;\n hintKey: string;\n fallback: string;\n\n constructor(retiredKey: string, hintKey: string, fallback: string) {\n this.retiredKey = retiredKey;\n this.hintKey = hintKey;\n this.fallback = fallback;\n }\n}\n\n/**\n * Bring `commands` forward to the `guardHints` shape, moving the RETIRED flat `upsertPr`/`mergeComplete`\n * strings and DELETING them. Deleting is the point: the validator now rejects them, so leaving them behind\n * would keep the config failing after a \"successful\" sync.\n *\n * The consumer's own value wins over the default — a repo that renamed its gated command keeps that name.\n */\n// webpieces-disable no-function-outside-class -- sibling of the other seed*/migrate* helpers; this module is config-shape builders by design\nfunction migrateGuardHints(commands: Json, changes: string[]): void {\n const hints: Json =\n typeof commands['guardHints'] === 'object' && commands['guardHints'] !== null\n ? (commands['guardHints'] as Json)\n : {};\n const moves: readonly GuardHintMove[] = [\n new GuardHintMove('upsertPr', 'prCreationOrPush', DEFAULT_UPSERT_PR),\n new GuardHintMove('mergeComplete', 'mergeInProgress', DEFAULT_MERGE_COMPLETE),\n ];\n for (const move of moves) {\n const retiredKey = move.retiredKey;\n const hintKey = move.hintKey;\n const fallback = move.fallback;\n const carried = commands[retiredKey];\n if (carried !== undefined) {\n delete commands[retiredKey];\n if (hints[hintKey] === undefined) hints[hintKey] = carried;\n changes.push(`moved retired commands.${retiredKey} -> commands.guardHints.${hintKey}`);\n }\n if (hints[hintKey] === undefined) {\n hints[hintKey] = fallback;\n changes.push(`added commands.guardHints.${hintKey}`);\n }\n }\n commands['guardHints'] = hints;\n}\n\n/**\n * Apply the RETIRED rule/guard retirements in place. These used to be rewritten silently at load time, so\n * a consumer's file kept the dead name forever; the loader now rejects it, which makes this the one\n * command that can fix the file. Skips a rename when the new name is already configured, so an explicit\n * entry is never clobbered by a stale one.\n *\n * NOT EVERY RETIREMENT IS A RENAME, and treating them all as one produced garbage. `whole-repo-build-guard`\n * moved OUT of webpieces.config.json entirely — its `movedTo` is the PROSE destination\n * `~/.webpieces/config.json → experimental.whole-repo-build-guard`, not a sibling key — so the rename\n * branch below would have created a hookGuards entry literally named that whole sentence, which no\n * validator knows and which the next run reports as another unknown rule. `prunable` is the discriminator:\n * when the entry says deleting is the whole fix, DELETE it, exactly as `ConfigPruner` does.\n */\n// webpieces-disable no-function-outside-class -- sibling of the other seed*/migrate* helpers; this module is config-shape builders by design\nfunction migrateRetiredRuleNames(\n section: Section,\n changes: string[],\n registry: RulePackRegistry,\n): void {\n for (const entry of registry.migrations()) {\n if (entry.scope !== RETIRED_SCOPE_RULE) continue;\n if (!(entry.key in section)) continue;\n if (entry.prunable) {\n delete section[entry.key];\n changes.push(`deleted retired \"${entry.key}\" (it moved to ${entry.movedTo})`);\n continue;\n }\n mergeIntoDestination(section, entry.key, entry.movedTo, changes, registry);\n }\n fillRequiredFields(section, changes, registry);\n}\n\n/**\n * Fold one retired key's entry into its destination, whether the destination exists yet or not.\n *\n * THIS IS N→1, NOT 1:1, and the difference is the whole reason this helper exists. Four retired keys\n * now point at ONE destination (`branch-state-guard`, `pr-lifecycle-guard`). The previous code renamed\n * the first key it met and then, finding the destination already present, DELETED each of the other\n * three outright — so which guard's settings survived depended on RETIRED_CONFIG_KEYS declaration\n * order rather than on the consumer's file, and the survivor carried only that one guard's fields, so\n * it was missing required fields of the merged schema. A conversion that half-merges\n * would hand every fixture an invalid config, which is not an option.\n *\n * UNION, first writer wins per field. Earlier-declared keys are the more specific ones (only\n * feature-branch-guard carries `branchNamingConvention`), and a field already present on the\n * destination — because the consumer wrote it, or an earlier key contributed it — is never overwritten.\n * Fields the merged schema does not know are dropped by the same pass, since carrying a deleted field\n * across (`upsertPrCommand`) would produce a config the validator immediately rejects.\n */\n// webpieces-disable no-function-outside-class -- sibling of the other seed*/migrate* helpers; this module is config-shape builders by design\nfunction mergeIntoDestination(\n section: Section,\n key: string,\n destination: string,\n changes: string[],\n registry: RulePackRegistry,\n): void {\n const source = asSection(section[key]);\n delete section[key];\n const fields = schemaFieldNames(destination, registry);\n const target = asSection(section[destination]);\n const existed = destination in section;\n const carried: string[] = [];\n const dropped: string[] = [];\n for (const field of Object.keys(source)) {\n if (fields !== null && !fields.includes(field)) {\n dropped.push(field);\n continue;\n }\n if (field in target) continue;\n target[field] = source[field];\n carried.push(field);\n }\n section[destination] = target;\n const verb = existed ? 'merged' : 'renamed';\n const droppedNote =\n dropped.length > 0 ? `; dropped deleted field(s) ${dropped.join(', ')}` : '';\n changes.push(\n `${verb} retired \"${key}\" -> \"${destination}\" (carried ${carried.join(', ') || 'nothing new'}${droppedNote})`,\n );\n}\n\n/**\n * Fill any schema-REQUIRED field a migrated entry ended up without.\n *\n * A union of four partial entries is not guaranteed to satisfy the destination's schema — the merged\n * `branch-state-guard` needs `mode` and both escape hatches, and a consumer whose four old entries\n * predate one of them would land short. Seeding the gap from the SAME source the installer and the\n * validator use (seedEntryForRule) is what makes the install command a complete instruction\n * rather than a first step. Only ever ADDS; a value the consumer stated is never touched.\n */\n// webpieces-disable no-function-outside-class -- sibling of the other seed*/migrate* helpers; this module is config-shape builders by design\nfunction fillRequiredFields(section: Section, changes: string[], registry: RulePackRegistry): void {\n for (const name of Object.keys(section)) {\n if (schemaFieldNames(name, registry) === null) continue;\n // A rule ENTRY is a flat bag of scalars, so it is read as Json here rather than through\n // asSection (whose values are whole entries). Same object either way; only the view differs.\n const entry: Json = asSection(section[name]);\n const seed = seedEntryForRule(name, registry);\n const added: string[] = [];\n for (const field of Object.keys(seed)) {\n if (field in entry) continue;\n entry[field] = seed[field];\n added.push(field);\n }\n if (added.length === 0) continue;\n section[name] = entry;\n changes.push(`filled required field(s) on \"${name}\": ${added.join(', ')}`);\n }\n}\n\n// Deep-copy the framework's default match-rules (the no-fetch guard) into plain JSON for the config\n// file. Round-tripping through JSON turns the MatchRuleConfig instances into plain objects.\n// webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: plain functions keep the fixture builder free of any container\nfunction seedMatchRules(): Json[] {\n return JSON.parse(JSON.stringify(DEFAULT_MATCH_RULES)) as Json[];\n}\n\n// webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: plain functions keep the fixture builder free of any container\nfunction asSection(value: Json[string]): Section {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Section)\n : {};\n}\n\n// Migrate an existing config to the rules / hookGuards / commands layout and add any missing rules.\n// Returns a human-readable list of what changed (empty = already up to date).\n// webpieces-disable no-function-outside-class -- this module is deliberately DI-FREE: plain functions keep the fixture builder free of any container\nexport function prepareLegacyUpgrade(\n existing: Json,\n registry: RulePackRegistry,\n): LegacyUpgradeResult {\n const changes: string[] = [];\n const rules: Section = asSection(existing['rules']);\n const hookGuards: Section = asSection(existing['hookGuards']);\n const commands: Json =\n typeof existing['commands'] === 'object' && existing['commands'] !== null\n ? (existing['commands'] as Json)\n : {};\n\n // Move a deprecated top-level pr-gate block under commands.\n if (existing['pr-gate'] !== undefined && commands['pr-gate'] === undefined) {\n commands['pr-gate'] = existing['pr-gate'];\n changes.push('moved top-level \"pr-gate\" → commands[\"pr-gate\"]');\n }\n // Apply retired RENAMES first, so a renamed guard is placed and presence-checked under its new name\n // rather than being treated as unknown and re-added alongside its own stale entry.\n migrateRetiredRuleNames(rules, changes, registry);\n migrateRetiredRuleNames(hookGuards, changes, registry);\n\n migratePolicySections(rules, hookGuards, changes, registry);\n // Add any missing built-in into its correct section, ENFORCING at its recommended mode (not OFF).\n for (const name of allRuleNames(registry)) {\n const target = sectionForRule(name, registry) === 'hookGuards' ? hookGuards : rules;\n if (!(name in target)) {\n const entry = seedRule(name, registry);\n target[name] = entry;\n changes.push(\n `added \"${name}\" (${String(entry['mode'])}) to ${sectionForRule(name, registry)}`,\n );\n }\n }\n // Fill command defaults.\n if (commands['pr-gate'] === undefined) {\n commands['pr-gate'] = { mode: 'OFF', buildCommand: DEFAULT_BUILD_COMMAND, gates: [] };\n changes.push('added commands[\"pr-gate\"] (OFF)');\n }\n migrateGuardHints(commands, changes);\n\n // Seed the now-required excludePaths list (empty = enforce everywhere) if the config predates it,\n // and MIGRATE the legacy `{ rules: [], guards: [] }` object to the single list by unioning them.\n // The union is behaviour-preserving for every config we have seen (both lists set identically), and\n // widening is the safe direction anyway: a path either side excluded stays excluded.\n const excludePaths: string[] = migrateExcludePaths(existing['excludePaths'], changes);\n\n const matchRules = upgradeMatchRules(existing, changes);\n\n const rulesDir: string[] = Array.isArray(existing['rulesDir'])\n ? (existing['rulesDir'] as string[])\n : [];\n const inherited = typeof existing['extends'] === 'string' ? existing['extends'] : undefined;\n return new LegacyUpgradeResult(\n new LegacyConfigDocument(\n rules,\n hookGuards,\n commands,\n excludePaths,\n matchRules,\n rulesDir,\n inherited,\n ),\n changes,\n );\n}\n\n// webpieces-disable no-function-outside-class -- explicit upgrade conversion remains independent of DI\nfunction migratePolicySections(rules: Section, hookGuards: Section, changes: string[], registry: RulePackRegistry): void {\n // Move guards mistakenly left in rules into hookGuards.\n for (const name of Object.keys(rules)) {\n if (isHookGuard(name, registry)) {\n hookGuards[name] = rules[name];\n delete rules[name];\n changes.push(`moved \"${name}\" from rules → hookGuards`);\n }\n }\n // Move code rules mistakenly placed in hookGuards back into rules.\n for (const name of Object.keys(hookGuards)) {\n if (!isHookGuard(name, registry) && allRuleNames(registry).includes(name)) {\n rules[name] = hookGuards[name];\n delete hookGuards[name];\n changes.push(`moved \"${name}\" from hookGuards → rules`);\n }\n }\n}\n\n// webpieces-disable no-function-outside-class -- pure explicit-upgrade conversion\nfunction upgradeMatchRules(existing: Json, changes: string[]): Json[] {\n // Seed the now-required match-rules array (with the default no-fetch guard) if the config predates\n // it. A client that has already customized it keeps their array untouched.\n let matchRules: Json[];\n if (Array.isArray(existing['match-rules'])) {\n matchRules = existing['match-rules'] as Json[];\n } else {\n matchRules = seedMatchRules();\n changes.push('added \"match-rules\" (seeded with the no-fetch guard)');\n }\n\n return matchRules;\n}\n"]}
@@ -2,7 +2,6 @@ import { CommandsConfig } from './commands-config';
2
2
  import { ConfigFile } from './config-file';
3
3
  import { RulePackRegistry } from './rule-pack-registry';
4
4
  import { PackPolicyFiles, PackPolicyFilesResult } from './pack-policy-files';
5
- import { RulePackArtifacts } from './rule-pack-artifacts';
6
5
  import { ExcludePaths } from './exclude-hook-paths';
7
6
  import { PrGateConfig } from './pr-gate-config';
8
7
  import { ResolvedConfig } from './types';
@@ -24,8 +23,7 @@ export declare class LoadedConfig {
24
23
  export declare class ConfigLoader {
25
24
  private readonly configFile;
26
25
  private readonly files;
27
- private readonly artifacts;
28
- constructor(configFile: ConfigFile, files: PackPolicyFiles, artifacts: RulePackArtifacts);
26
+ constructor(configFile: ConfigFile, files: PackPolicyFiles);
29
27
  loadAndValidate(cwd: string): LoadedConfig;
30
28
  private loaded;
31
29
  private empty;
@@ -11,7 +11,6 @@ const commands_config_1 = require("./commands-config");
11
11
  const config_file_1 = require("./config-file");
12
12
  const rule_pack_registry_1 = require("./rule-pack-registry");
13
13
  const pack_policy_files_1 = require("./pack-policy-files");
14
- const rule_pack_artifacts_1 = require("./rule-pack-artifacts");
15
14
  const exclude_hook_paths_1 = require("./exclude-hook-paths");
16
15
  const types_1 = require("./types");
17
16
  const commands_section_validators_1 = require("./commands-section-validators");
@@ -20,6 +19,8 @@ const validate_config_1 = require("./validate-config");
20
19
  const WebpiecesRulesConfig_1 = require("./WebpiecesRulesConfig");
21
20
  const policy_tracking_1 = require("./policy-tracking");
22
21
  const config_error_banner_1 = require("./config-error-banner");
22
+ const config_repair_error_1 = require("./config-repair-error");
23
+ const constants_1 = require("./constants");
23
24
  /** One root parse and one owner-resolution pass supply all consumers with the same registry and settings. */
24
25
  class LoadedConfig {
25
26
  resolved;
@@ -48,11 +49,9 @@ exports.LoadedConfig = LoadedConfig;
48
49
  let ConfigLoader = class ConfigLoader {
49
50
  configFile;
50
51
  files;
51
- artifacts;
52
- constructor(configFile, files, artifacts) {
52
+ constructor(configFile, files) {
53
53
  this.configFile = configFile;
54
54
  this.files = files;
55
- this.artifacts = artifacts;
56
55
  }
57
56
  loadAndValidate(cwd) {
58
57
  const configPath = this.configFile.findConfigFile(cwd);
@@ -68,11 +67,13 @@ let ConfigLoader = class ConfigLoader {
68
67
  ...(0, validate_config_1.validateMatchRulesSection)(raw['match-rules']),
69
68
  ];
70
69
  if (errors.length)
71
- throw new tooling_common_1.InformAiError((0, config_error_banner_1.formatConfigErrorsBanner)(errors));
72
- new tooling_common_1.RepositoryLayout().assertCurrent(root);
70
+ throw new config_repair_error_1.ConfigRepairError((0, config_error_banner_1.formatConfigErrorsBanner)(errors), [
71
+ new config_repair_error_1.EditFileCure(configPath, `Edit ${configPath} and apply every bullet above.`),
72
+ new config_repair_error_1.RunCommandCure(constants_1.PRUNE_UNKNOWN_COMMAND, `${constants_1.PRUNE_UNKNOWN_COMMAND} — deletes every key no validator has a schema for.`),
73
+ ]);
74
+ new config_repair_error_1.RepositoryLayoutRepair().run(() => new tooling_common_1.RepositoryLayout().assertCurrent(root));
73
75
  const declarations = this.files.declarations(raw.rulePacks, root);
74
76
  const policy = this.files.resolve(root, this.files.select(root, declarations));
75
- this.artifacts.check(root, policy);
76
77
  new policy_tracking_1.PolicyTracking().check(root, declarations);
77
78
  return this.loaded(configPath, raw.commands, raw.excludePaths, raw['match-rules'], policy);
78
79
  }
@@ -98,10 +99,9 @@ exports.ConfigLoader = ConfigLoader;
98
99
  exports.ConfigLoader = ConfigLoader = tslib_1.__decorate([
99
100
  (0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
100
101
  tslib_1.__metadata("design:paramtypes", [config_file_1.ConfigFile,
101
- pack_policy_files_1.PackPolicyFiles,
102
- rule_pack_artifacts_1.RulePackArtifacts])
102
+ pack_policy_files_1.PackPolicyFiles])
103
103
  ], ConfigLoader);
104
- const configLoaderSvc = new ConfigLoader(new config_file_1.ConfigFile(), new pack_policy_files_1.PackPolicyFiles(), new rule_pack_artifacts_1.RulePackArtifacts(new tooling_common_1.AtomicFile()));
104
+ const configLoaderSvc = new ConfigLoader(new config_file_1.ConfigFile(), new pack_policy_files_1.PackPolicyFiles());
105
105
  /** Public function entry point and injected service use the same implementation. */
106
106
  // webpieces-disable no-function-outside-class -- canonical public loader function for CLI and executor entry points
107
107
  function loadAndValidate(cwd) {
@@ -1 +1 @@
1
- {"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/load-config.ts"],"names":[],"mappings":";;;AAkIA,0CAEC;;AApID,wDAAkC;AAClC,yCAA2D;AAC3D,oDAAoD;AACpD,8DAAwF;AACxF,uDAAwE;AACxE,+CAA2C;AAC3C,6DAAwD;AACxD,2DAA6E;AAC7E,+DAA0D;AAC1D,6DAAoD;AAEpD,mCAA6D;AAC7D,+EAAwE;AACxE,yDAA0D;AAC1D,uDAAoF;AAEpF,iEAA8D;AAC9D,uDAAmD;AACnD,+DAAiE;AAEjE,6GAA6G;AAC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Y,CACpC,IAAI,wBAAU,EAAE,EAChB,IAAI,mCAAe,EAAE,EACrB,IAAI,uCAAiB,CAAC,IAAI,2BAAU,EAAE,CAAC,CAC1C,CAAC;AAEF,oFAAoF;AACpF,oHAAoH;AACpH,SAAgB,eAAe,CAAC,GAAW;IACvC,OAAO,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ConfigObject } from '@webpieces/rules-sdk';\nimport { InformAiError, AtomicFile, RepositoryLayout } from '@webpieces/tooling-common';\nimport { buildCommandsConfig, CommandsConfig } from './commands-config';\nimport { ConfigFile } from './config-file';\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { PackPolicyFiles, PackPolicyFilesResult } from './pack-policy-files';\nimport { RulePackArtifacts } from './rule-pack-artifacts';\nimport { ExcludePaths } from './exclude-hook-paths';\nimport { PrGateConfig } from './pr-gate-config';\nimport { ResolvedConfig, ResolvedRuleConfig } from './types';\nimport { validateCommandsSection } from './commands-section-validators';\nimport { validateTopLevelKeys } from './config-key-rules';\nimport { validateExcludePaths, validateMatchRulesSection } from './validate-config';\nimport { MatchRuleConfig } from './match-rules-config';\nimport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nimport { PolicyTracking } from './policy-tracking';\nimport { formatConfigErrorsBanner } from './config-error-banner';\n\n/** One root parse and one owner-resolution pass supply all consumers with the same registry and settings. */\nexport class LoadedConfig {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n readonly resolved: ResolvedConfig,\n readonly rulesConfig: WebpiecesRulesConfig,\n readonly commands: CommandsConfig,\n readonly prGate: PrGateConfig,\n readonly excludePaths: ExcludePaths,\n readonly matchRules: readonly MatchRuleConfig[],\n readonly configPath: string | null,\n readonly ruleRegistry: RulePackRegistry,\n readonly policyFiles: PackPolicyFilesResult | null,\n ) {}\n}\n\n@injectable(bindingScopeValues.Singleton)\nexport class ConfigLoader {\n constructor(\n private readonly configFile: ConfigFile,\n private readonly files: PackPolicyFiles,\n private readonly artifacts: RulePackArtifacts,\n ) {}\n\n loadAndValidate(cwd: string): LoadedConfig {\n const configPath = this.configFile.findConfigFile(cwd);\n if (!configPath) return this.empty();\n const raw = this.configFile.readRawConfig(configPath),\n root = path.dirname(configPath);\n // webpieces-disable no-any-unknown -- the root parser returns opaque client JSON; these validators narrow every accepted field\n const document = raw as Record<string, unknown>;\n const errors = [\n ...validateTopLevelKeys(document),\n ...validateCommandsSection(raw.commands, document['pr-gate'], root),\n ...validateExcludePaths(raw.excludePaths),\n ...validateMatchRulesSection(raw['match-rules']),\n ];\n if (errors.length) throw new InformAiError(formatConfigErrorsBanner(errors));\n new RepositoryLayout().assertCurrent(root);\n const declarations = this.files.declarations(raw.rulePacks, root);\n const policy = this.files.resolve(root, this.files.select(root, declarations));\n this.artifacts.check(root, policy);\n new PolicyTracking().check(root, declarations);\n return this.loaded(\n configPath,\n raw.commands,\n raw.excludePaths as string[],\n raw['match-rules'] as MatchRuleConfig[],\n policy,\n );\n }\n\n private loaded(\n configPath: string,\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n commandsRaw: unknown,\n excluded: readonly string[],\n matches: readonly MatchRuleConfig[],\n policy: PackPolicyFilesResult,\n ): LoadedConfig {\n const commands = buildCommandsConfig(commandsRaw),\n values = new WebpiecesRulesConfig();\n const resolved = new Map<string, ResolvedRuleConfig>();\n for (const id of policy.registry.ruleIds()) {\n const explicit = policy.values[id];\n values[id] = explicit;\n const options = Object.assign(\n new ConfigObject(),\n policy.registry.optionalTuningFor(id),\n explicit,\n );\n resolved.set(id, new ResolvedRuleConfig(options));\n }\n return new LoadedConfig(\n new ResolvedConfig(resolved, new Set(policy.registry.ruleIds()), configPath),\n values,\n commands,\n commands.prGate,\n new ExcludePaths([...excluded]),\n matches,\n configPath,\n policy.registry,\n policy,\n );\n }\n\n private empty(): LoadedConfig {\n const commands = buildCommandsConfig(undefined);\n return new LoadedConfig(\n new ResolvedConfig(new Map(), new Set(), null),\n new WebpiecesRulesConfig(),\n commands,\n commands.prGate,\n new ExcludePaths([]),\n [],\n null,\n new RulePackRegistry([]),\n null,\n );\n }\n}\n\nconst configLoaderSvc = new ConfigLoader(\n new ConfigFile(),\n new PackPolicyFiles(),\n new RulePackArtifacts(new AtomicFile()),\n);\n\n/** Public function entry point and injected service use the same implementation. */\n// webpieces-disable no-function-outside-class -- canonical public loader function for CLI and executor entry points\nexport function loadAndValidate(cwd: string): LoadedConfig {\n return configLoaderSvc.loadAndValidate(cwd);\n}\n"]}
1
+ {"version":3,"file":"load-config.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/load-config.ts"],"names":[],"mappings":";;;AAoIA,0CAEC;;AAtID,wDAAkC;AAClC,yCAA2D;AAC3D,oDAAoD;AACpD,8DAA6D;AAC7D,uDAAwE;AACxE,+CAA2C;AAC3C,6DAAwD;AACxD,2DAA6E;AAC7E,6DAAoD;AAEpD,mCAA6D;AAC7D,+EAAwE;AACxE,yDAA0D;AAC1D,uDAAoF;AAEpF,iEAA8D;AAC9D,uDAAmD;AACnD,+DAAiE;AACjE,+DAAgH;AAChH,2CAAoD;AAEpD,6GAA6G;AAC7G,MAAa,YAAY;IAGR;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAVb,yDAAyD;IACzD,YACa,QAAwB,EACxB,WAAiC,EACjC,QAAwB,EACxB,MAAoB,EACpB,YAA0B,EAC1B,UAAsC,EACtC,UAAyB,EACzB,YAA8B,EAC9B,WAAyC;QARzC,aAAQ,GAAR,QAAQ,CAAgB;QACxB,gBAAW,GAAX,WAAW,CAAsB;QACjC,aAAQ,GAAR,QAAQ,CAAgB;QACxB,WAAM,GAAN,MAAM,CAAc;QACpB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAA4B;QACtC,eAAU,GAAV,UAAU,CAAe;QACzB,iBAAY,GAAZ,YAAY,CAAkB;QAC9B,gBAAW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,EAAE,IAAI,GAAG,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,UAAU,CAAC,EAC5E,MAAM,EACN,QAAQ,EACR,QAAQ,CAAC,MAAM,EACf,IAAI,iCAAY,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,EAC/B,OAAO,EACP,UAAU,EACV,MAAM,CAAC,QAAQ,EACf,MAAM,CACT,CAAC;IACN,CAAC;IAEO,KAAK;QACT,MAAM,QAAQ,GAAG,IAAA,qCAAmB,EAAC,SAAS,CAAC,CAAC;QAChD,OAAO,IAAI,YAAY,CACnB,IAAI,sBAAc,CAAC,IAAI,GAAG,EAAE,EAAE,IAAI,GAAG,EAAE,EAAE,IAAI,CAAC,EAC9C,IAAI,2CAAoB,EAAE,EAC1B,QAAQ,EACR,QAAQ,CAAC,MAAM,EACf,IAAI,iCAAY,CAAC,EAAE,CAAC,EACpB,EAAE,EACF,IAAI,EACJ,IAAI,qCAAgB,CAAC,EAAE,CAAC,EACxB,IAAI,CACP,CAAC;IACN,CAAC;CACJ,CAAA;AAxFY,oCAAY;uBAAZ,YAAY;IADxB,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGJ,wBAAU;QACf,mCAAe;GAHlC,YAAY,CAwFxB;AAED,MAAM,eAAe,GAAG,IAAI,YAAY,CAAC,IAAI,wBAAU,EAAE,EAAE,IAAI,mCAAe,EAAE,CAAC,CAAC;AAElF,oFAAoF;AACpF,oHAAoH;AACpH,SAAgB,eAAe,CAAC,GAAW;IACvC,OAAO,eAAe,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC;AAChD,CAAC","sourcesContent":["import * as path from 'node:path';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ConfigObject } from '@webpieces/rules-sdk';\nimport { RepositoryLayout } from '@webpieces/tooling-common';\nimport { buildCommandsConfig, CommandsConfig } from './commands-config';\nimport { ConfigFile } from './config-file';\nimport { RulePackRegistry } from './rule-pack-registry';\nimport { PackPolicyFiles, PackPolicyFilesResult } from './pack-policy-files';\nimport { ExcludePaths } from './exclude-hook-paths';\nimport { PrGateConfig } from './pr-gate-config';\nimport { ResolvedConfig, ResolvedRuleConfig } from './types';\nimport { validateCommandsSection } from './commands-section-validators';\nimport { validateTopLevelKeys } from './config-key-rules';\nimport { validateExcludePaths, validateMatchRulesSection } from './validate-config';\nimport { MatchRuleConfig } from './match-rules-config';\nimport { WebpiecesRulesConfig } from './WebpiecesRulesConfig';\nimport { PolicyTracking } from './policy-tracking';\nimport { formatConfigErrorsBanner } from './config-error-banner';\nimport { ConfigRepairError, EditFileCure, RepositoryLayoutRepair, RunCommandCure } from './config-repair-error';\nimport { PRUNE_UNKNOWN_COMMAND } from './constants';\n\n/** One root parse and one owner-resolution pass supply all consumers with the same registry and settings. */\nexport class LoadedConfig {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n readonly resolved: ResolvedConfig,\n readonly rulesConfig: WebpiecesRulesConfig,\n readonly commands: CommandsConfig,\n readonly prGate: PrGateConfig,\n readonly excludePaths: ExcludePaths,\n readonly matchRules: readonly MatchRuleConfig[],\n readonly configPath: string | null,\n readonly ruleRegistry: RulePackRegistry,\n readonly policyFiles: PackPolicyFilesResult | null,\n ) {}\n}\n\n@injectable(bindingScopeValues.Singleton)\nexport class ConfigLoader {\n constructor(\n private readonly configFile: ConfigFile,\n private readonly files: PackPolicyFiles,\n ) {}\n\n loadAndValidate(cwd: string): LoadedConfig {\n const configPath = this.configFile.findConfigFile(cwd);\n if (!configPath) return this.empty();\n const raw = this.configFile.readRawConfig(configPath),\n root = path.dirname(configPath);\n // webpieces-disable no-any-unknown -- the root parser returns opaque client JSON; these validators narrow every accepted field\n const document = raw as Record<string, unknown>;\n const errors = [\n ...validateTopLevelKeys(document),\n ...validateCommandsSection(raw.commands, document['pr-gate'], root),\n ...validateExcludePaths(raw.excludePaths),\n ...validateMatchRulesSection(raw['match-rules']),\n ];\n if (errors.length)\n throw new ConfigRepairError(formatConfigErrorsBanner(errors), [\n new EditFileCure(configPath, `Edit ${configPath} and apply every bullet above.`),\n new RunCommandCure(\n PRUNE_UNKNOWN_COMMAND,\n `${PRUNE_UNKNOWN_COMMAND} — deletes every key no validator has a schema for.`,\n ),\n ]);\n new RepositoryLayoutRepair().run(() => new RepositoryLayout().assertCurrent(root));\n const declarations = this.files.declarations(raw.rulePacks, root);\n const policy = this.files.resolve(root, this.files.select(root, declarations));\n new PolicyTracking().check(root, declarations);\n return this.loaded(\n configPath,\n raw.commands,\n raw.excludePaths as string[],\n raw['match-rules'] as MatchRuleConfig[],\n policy,\n );\n }\n\n private loaded(\n configPath: string,\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n commandsRaw: unknown,\n excluded: readonly string[],\n matches: readonly MatchRuleConfig[],\n policy: PackPolicyFilesResult,\n ): LoadedConfig {\n const commands = buildCommandsConfig(commandsRaw),\n values = new WebpiecesRulesConfig();\n const resolved = new Map<string, ResolvedRuleConfig>();\n for (const id of policy.registry.ruleIds()) {\n const explicit = policy.values[id];\n values[id] = explicit;\n const options = Object.assign(\n new ConfigObject(),\n policy.registry.optionalTuningFor(id),\n explicit,\n );\n resolved.set(id, new ResolvedRuleConfig(options));\n }\n return new LoadedConfig(\n new ResolvedConfig(resolved, new Set(policy.registry.ruleIds()), configPath),\n values,\n commands,\n commands.prGate,\n new ExcludePaths([...excluded]),\n matches,\n configPath,\n policy.registry,\n policy,\n );\n }\n\n private empty(): LoadedConfig {\n const commands = buildCommandsConfig(undefined);\n return new LoadedConfig(\n new ResolvedConfig(new Map(), new Set(), null),\n new WebpiecesRulesConfig(),\n commands,\n commands.prGate,\n new ExcludePaths([]),\n [],\n null,\n new RulePackRegistry([]),\n null,\n );\n }\n}\n\nconst configLoaderSvc = new ConfigLoader(new ConfigFile(), new PackPolicyFiles());\n\n/** Public function entry point and injected service use the same implementation. */\n// webpieces-disable no-function-outside-class -- canonical public loader function for CLI and executor entry points\nexport function loadAndValidate(cwd: string): LoadedConfig {\n return configLoaderSvc.loadAndValidate(cwd);\n}\n"]}
@@ -5,7 +5,6 @@ exports.MigrateDirsCli = void 0;
5
5
  const tooling_common_1 = require("@webpieces/tooling-common");
6
6
  const config_file_1 = require("./config-file");
7
7
  const pack_policy_files_1 = require("./pack-policy-files");
8
- const rule_pack_artifacts_1 = require("./rule-pack-artifacts");
9
8
  const rule_pack_sync_1 = require("./rule-pack-sync");
10
9
  const policy_tracking_1 = require("./policy-tracking");
11
10
  const repo_root_1 = require("./repo-root");
@@ -17,8 +16,7 @@ class MigrateDirsCli {
17
16
  throw new tooling_common_1.InformAiError('Usage: pnpm wp-migrate-dirs [--stage]. --stage explicitly stages the migrated policy for commit.');
18
17
  const root = new repo_root_1.RepoRootFinder().resolveRepoRoot(process.cwd());
19
18
  const changed = new tooling_common_1.RepositoryLayout().migrate(root);
20
- const atomic = new tooling_common_1.AtomicFile();
21
- new rule_pack_sync_1.RulePackSync(new config_file_1.ConfigFile(), new pack_policy_files_1.PackPolicyFiles(), new rule_pack_artifacts_1.RulePackArtifacts(atomic), atomic).run(root, new rule_pack_sync_1.RulePackSyncOptions('sync', null));
19
+ new rule_pack_sync_1.RulePackSync(new config_file_1.ConfigFile(), new pack_policy_files_1.PackPolicyFiles(), new tooling_common_1.AtomicFile()).run(root);
22
20
  if (args.includes('--stage')) {
23
21
  const raw = new config_file_1.ConfigFile().readRawConfig(`${root}/webpieces.config.json`);
24
22
  new policy_tracking_1.PolicyTracking().stage(root, new pack_policy_files_1.PackPolicyFiles().declarations(raw.rulePacks, root));
@@ -1 +1 @@
1
- {"version":3,"file":"migrate-dirs-cli.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/migrate-dirs-cli.ts"],"names":[],"mappings":";;;;AACA,8DAAwF;AACxF,+CAA2C;AAC3C,2DAAsD;AACtD,+DAA0D;AAC1D,qDAAqE;AACrE,uDAAmD;AACnD,2CAA6C;AAC7C,yCAAqC;AAErC,MAAa,cAAc;IACvB,KAAK,CA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CAAC","sourcesContent":["#!/usr/bin/env node\nimport { RepositoryLayout, AtomicFile, InformAiError } from '@webpieces/tooling-common';\nimport { ConfigFile } from './config-file';\nimport { PackPolicyFiles } from './pack-policy-files';\nimport { RulePackArtifacts } from './rule-pack-artifacts';\nimport { RulePackSync, RulePackSyncOptions } from './rule-pack-sync';\nimport { PolicyTracking } from './policy-tracking';\nimport { RepoRootFinder } from './repo-root';\nimport { runMain } from './run-main';\n\nexport class MigrateDirsCli {\n async main(): Promise<void> {\n const args = process.argv.slice(2);\n if (args.some((argument) => argument !== '--stage'))\n throw new InformAiError(\n 'Usage: pnpm wp-migrate-dirs [--stage]. --stage explicitly stages the migrated policy for commit.',\n );\n const root = new RepoRootFinder().resolveRepoRoot(process.cwd());\n const changed = new RepositoryLayout().migrate(root);\n const atomic = new AtomicFile();\n new RulePackSync(\n new ConfigFile(),\n new PackPolicyFiles(),\n new RulePackArtifacts(atomic),\n atomic,\n ).run(root, new RulePackSyncOptions('sync', null));\n if (args.includes('--stage')) {\n const raw = new ConfigFile().readRawConfig(`${root}/webpieces.config.json`);\n new PolicyTracking().stage(\n root,\n new PackPolicyFiles().declarations(raw.rulePacks, root),\n );\n }\n console.log(\n `Webpieces directories migrated. Review and commit .webpieces-config/ and webpieces.config.json; ignore only .webpieces/.\\n${changed.join('\\n')}`,\n );\n }\n}\n\nif (require.main === module) runMain(() => new MigrateDirsCli().main());\n"]}
1
+ {"version":3,"file":"migrate-dirs-cli.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/migrate-dirs-cli.ts"],"names":[],"mappings":";;;;AACA,8DAAwF;AACxF,+CAA2C;AAC3C,2DAAsD;AACtD,qDAAgD;AAChD,uDAAmD;AACnD,2CAA6C;AAC7C,yCAAqC;AAErC,MAAa,cAAc;IACvB,KAAK,CAAC,IAAI;QACN,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACnC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,KAAK,SAAS,CAAC;YAC/C,MAAM,IAAI,8BAAa,CACnB,kGAAkG,CACrG,CAAC;QACN,MAAM,IAAI,GAAG,IAAI,0BAAc,EAAE,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QACjE,MAAM,OAAO,GAAG,IAAI,iCAAgB,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrD,IAAI,6BAAY,CAAC,IAAI,wBAAU,EAAE,EAAE,IAAI,mCAAe,EAAE,EAAE,IAAI,2BAAU,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACtF,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,MAAM,GAAG,GAAG,IAAI,wBAAU,EAAE,CAAC,aAAa,CAAC,GAAG,IAAI,wBAAwB,CAAC,CAAC;YAC5E,IAAI,gCAAc,EAAE,CAAC,KAAK,CACtB,IAAI,EACJ,IAAI,mCAAe,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,CAC1D,CAAC;QACN,CAAC;QACD,OAAO,CAAC,GAAG,CACP,6HAA6H,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACpJ,CAAC;IACN,CAAC;CACJ;AArBD,wCAqBC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;IAAE,IAAA,kBAAO,EAAC,GAAG,EAAE,CAAC,IAAI,cAAc,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { RepositoryLayout, AtomicFile, InformAiError } from '@webpieces/tooling-common';\nimport { ConfigFile } from './config-file';\nimport { PackPolicyFiles } from './pack-policy-files';\nimport { RulePackSync } from './rule-pack-sync';\nimport { PolicyTracking } from './policy-tracking';\nimport { RepoRootFinder } from './repo-root';\nimport { runMain } from './run-main';\n\nexport class MigrateDirsCli {\n async main(): Promise<void> {\n const args = process.argv.slice(2);\n if (args.some((argument) => argument !== '--stage'))\n throw new InformAiError(\n 'Usage: pnpm wp-migrate-dirs [--stage]. --stage explicitly stages the migrated policy for commit.',\n );\n const root = new RepoRootFinder().resolveRepoRoot(process.cwd());\n const changed = new RepositoryLayout().migrate(root);\n new RulePackSync(new ConfigFile(), new PackPolicyFiles(), new AtomicFile()).run(root);\n if (args.includes('--stage')) {\n const raw = new ConfigFile().readRawConfig(`${root}/webpieces.config.json`);\n new PolicyTracking().stage(\n root,\n new PackPolicyFiles().declarations(raw.rulePacks, root),\n );\n }\n console.log(\n `Webpieces directories migrated. Review and commit .webpieces-config/ and webpieces.config.json; ignore only .webpieces/.\\n${changed.join('\\n')}`,\n );\n }\n}\n\nif (require.main === module) runMain(() => new MigrateDirsCli().main());\n"]}
@@ -19,11 +19,20 @@ export declare class PackPolicyFilesResult {
19
19
  readonly targetFiles: ReadonlyMap<string, string>;
20
20
  constructor(registry: RulePackRegistry, selected: readonly SelectedPolicyPack[], values: Record<string, ConfigObject>, targetFiles: ReadonlyMap<string, string>);
21
21
  }
22
- /** Configuration belongs to explicitly selected owners; loading never supplies recommended seeds. */
22
+ /**
23
+ * Configuration belongs to explicitly selected owners; loading never supplies recommended seeds.
24
+ *
25
+ * Every problem this class finds is a ConfigRepairError naming the file to edit and the exact entry to
26
+ * paste or delete (#1273). The hooks permit those edits while the config is invalid, so an upgrade that
27
+ * adds a required rule costs the agent one edit of one named file, and no command.
28
+ */
23
29
  export declare class PackPolicyFiles {
24
30
  declarations(raw: unknown, root: string): PackPolicyDeclaration[];
25
31
  select(root: string, declarations: readonly PackPolicyDeclaration[]): SelectedPolicyPack[];
26
32
  resolve(root: string, selected: readonly SelectedPolicyPack[]): PackPolicyFilesResult;
27
33
  configPath(root: string, relative: string): string;
28
34
  read(filename: string): Record<string, ConfigObject>;
35
+ private foreignEntries;
36
+ private registry;
37
+ private seeds;
29
38
  }