@webpieces/rules-config 0.4.927 → 0.4.929
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -5
- package/src/abstract-rule.d.ts +13 -1
- package/src/abstract-rule.js +17 -1
- package/src/abstract-rule.js.map +1 -1
- package/src/diff-scope.d.ts +8 -0
- package/src/diff-scope.js +15 -1
- package/src/diff-scope.js.map +1 -1
- package/src/exclude-hook-paths.js +4 -3
- package/src/exclude-hook-paths.js.map +1 -1
- package/src/generated-code-paths.js +2 -2
- package/src/generated-code-paths.js.map +1 -1
- package/src/glob-matches.d.ts +8 -0
- package/src/glob-matches.js +49 -0
- package/src/glob-matches.js.map +1 -0
- package/src/index.d.ts +2 -0
- package/src/index.js +14 -7
- package/src/index.js.map +1 -1
- package/src/rule-file-scope.d.ts +33 -0
- package/src/rule-file-scope.js +67 -0
- package/src/rule-file-scope.js.map +1 -0
- package/src/rule-pack-registry.d.ts +25 -0
- package/src/rule-pack-registry.js +62 -5
- package/src/rule-pack-registry.js.map +1 -1
- package/src/rule-pack-sync.js +6 -4
- package/src/rule-pack-sync.js.map +1 -1
- package/src/rule-runtime-modules.d.ts +1 -1
- package/src/rule-runtime-modules.js +4 -2
- package/src/rule-runtime-modules.js.map +1 -1
- package/src/validate-config.d.ts +3 -2
- package/src/validate-config.js +3 -2
- package/src/validate-config.js.map +1 -1
- package/templates/webpieces.filesize.md +5 -4
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;AAC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OAAA;AAEvB,yDAK6B;AAJzB,0HAAA,qBAAqB,OAAA;AACrB,uHAAA,kBAAkB,OAAA;AAClB,0HAAA,qBAAqB,OAAA;AACrB,oHAAA,eAAe,OAAA;AAEnB,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,6DAM+B;AAL3B,uHAAA,gBAAgB,OAAA;AAChB,wHAAA,iBAAiB,OAAA;AACjB,mHAAA,YAAY,OAAA;AACZ,qHAAA,cAAc,OAAA;AACd,6HAAA,sBAAsB,OAAA;AAE1B,+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 } 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
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AA;AAC1D,yDAAwE;AAA/D,oHAAA,eAAe,OAAA;AAAE,qHAAA,gBAAgB,OAAA;AAC1C,yDAI6B;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,mDAAgD;AAAvC,8GAAA,YAAY,OAAA;AACrB,+DAA4D;AAAnD,0HAAA,kBAAkB,OAAA;AAC3B,6DAA8D;AAArD,4HAAA,qBAAqB,OAAA;AAC9B,6DAM+B;AAL3B,uHAAA,gBAAgB,OAAA;AAChB,wHAAA,iBAAiB,OAAA;AACjB,mHAAA,YAAY,OAAA;AACZ,qHAAA,cAAc,OAAA;AACd,6HAAA,sBAAsB,OAAA;AAE1B,+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';\nexport { globMatches } from './glob-matches';\n// Framework-applied path exclusions for a rule run (#1253): the dispatcher enters the scope, DiffScope's\n// file listings honour it, so no rule filters its own files.\nexport { RuleFileScope, RuleFileExclusions } from './rule-file-scope';\n// The machine-generated trees a line-count rule never fires on. A FLOOR, not a default value:\n// `max-file-lines.excludePaths` 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"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two path exclusions one rule run honours (#1253), as data: the repo's top-level `excludePaths`
|
|
3
|
+
* (no rule judges these) and the rule's OWN `excludePaths` (this rule does not). Both are globs over the
|
|
4
|
+
* workspace-relative path, matched by {@link globMatches} — the same matcher the hooks use, so a list
|
|
5
|
+
* means one thing in the build and in a hook.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RuleFileExclusions {
|
|
8
|
+
readonly ruleName: string;
|
|
9
|
+
readonly globalPaths: readonly string[];
|
|
10
|
+
readonly rulePaths: readonly string[];
|
|
11
|
+
constructor(ruleName: string, globalPaths: readonly string[], rulePaths: readonly string[]);
|
|
12
|
+
excludes(relativePath: string): boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Where the framework APPLIES path exclusions to a code rule (#1253) — at DISPATCH, not in the rule.
|
|
16
|
+
*
|
|
17
|
+
* The code-rules runtime runs every rule inside {@link runWithin}; every file listing a rule asks for
|
|
18
|
+
* (`DiffScope.getChangedFiles` / `getAllFiles`, and so `ScanScope.files`) passes through {@link filter}.
|
|
19
|
+
* A rule added later is therefore covered with no code of its own. The one exception is a rule that
|
|
20
|
+
* walks the filesystem itself instead of asking git — it must ask {@link isExcluded} per file.
|
|
21
|
+
*
|
|
22
|
+
* Outside a rule run (the PR gate's checklist matching, the project catalog) there is no store, and
|
|
23
|
+
* nothing is filtered.
|
|
24
|
+
*/
|
|
25
|
+
export declare class RuleFileScope {
|
|
26
|
+
runWithin<T>(exclusions: RuleFileExclusions, run: () => Promise<T>): Promise<T>;
|
|
27
|
+
/** Run `work` with NO exclusions in force — for a listing that is not a rule judging files. */
|
|
28
|
+
outside<T>(work: () => T): T;
|
|
29
|
+
/** The exclusions of the rule running on this call chain, or undefined outside a rule run. */
|
|
30
|
+
current(): RuleFileExclusions | undefined;
|
|
31
|
+
isExcluded(relativePath: string): boolean;
|
|
32
|
+
filter(relativePaths: readonly string[]): string[];
|
|
33
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RuleFileScope = exports.RuleFileExclusions = void 0;
|
|
4
|
+
const node_async_hooks_1 = require("node:async_hooks");
|
|
5
|
+
const glob_matches_1 = require("./glob-matches");
|
|
6
|
+
/**
|
|
7
|
+
* The two path exclusions one rule run honours (#1253), as data: the repo's top-level `excludePaths`
|
|
8
|
+
* (no rule judges these) and the rule's OWN `excludePaths` (this rule does not). Both are globs over the
|
|
9
|
+
* workspace-relative path, matched by {@link globMatches} — the same matcher the hooks use, so a list
|
|
10
|
+
* means one thing in the build and in a hook.
|
|
11
|
+
*/
|
|
12
|
+
class RuleFileExclusions {
|
|
13
|
+
ruleName;
|
|
14
|
+
globalPaths;
|
|
15
|
+
rulePaths;
|
|
16
|
+
constructor(ruleName, globalPaths, rulePaths) {
|
|
17
|
+
this.ruleName = ruleName;
|
|
18
|
+
this.globalPaths = globalPaths;
|
|
19
|
+
this.rulePaths = rulePaths;
|
|
20
|
+
}
|
|
21
|
+
excludes(relativePath) {
|
|
22
|
+
const norm = relativePath.replace(/\\/g, '/');
|
|
23
|
+
return (this.globalPaths.some((glob) => (0, glob_matches_1.globMatches)(glob, norm)) ||
|
|
24
|
+
this.rulePaths.some((glob) => (0, glob_matches_1.globMatches)(glob, norm)));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.RuleFileExclusions = RuleFileExclusions;
|
|
28
|
+
// The ONE store of the exclusions in force for the rule run on this async call chain. Module-scoped on
|
|
29
|
+
// purpose: the dispatcher enters it and the file listing (DiffScope) reads it, and the rule in between
|
|
30
|
+
// carries no code for it — which is the whole point. AsyncLocalStorage, not a mutable field, so two
|
|
31
|
+
// rules run concurrently can never see each other's exclusions.
|
|
32
|
+
const activeExclusions = new node_async_hooks_1.AsyncLocalStorage();
|
|
33
|
+
/**
|
|
34
|
+
* Where the framework APPLIES path exclusions to a code rule (#1253) — at DISPATCH, not in the rule.
|
|
35
|
+
*
|
|
36
|
+
* The code-rules runtime runs every rule inside {@link runWithin}; every file listing a rule asks for
|
|
37
|
+
* (`DiffScope.getChangedFiles` / `getAllFiles`, and so `ScanScope.files`) passes through {@link filter}.
|
|
38
|
+
* A rule added later is therefore covered with no code of its own. The one exception is a rule that
|
|
39
|
+
* walks the filesystem itself instead of asking git — it must ask {@link isExcluded} per file.
|
|
40
|
+
*
|
|
41
|
+
* Outside a rule run (the PR gate's checklist matching, the project catalog) there is no store, and
|
|
42
|
+
* nothing is filtered.
|
|
43
|
+
*/
|
|
44
|
+
class RuleFileScope {
|
|
45
|
+
async runWithin(exclusions, run) {
|
|
46
|
+
return activeExclusions.run(exclusions, run);
|
|
47
|
+
}
|
|
48
|
+
/** Run `work` with NO exclusions in force — for a listing that is not a rule judging files. */
|
|
49
|
+
outside(work) {
|
|
50
|
+
return activeExclusions.exit(work);
|
|
51
|
+
}
|
|
52
|
+
/** The exclusions of the rule running on this call chain, or undefined outside a rule run. */
|
|
53
|
+
current() {
|
|
54
|
+
return activeExclusions.getStore();
|
|
55
|
+
}
|
|
56
|
+
isExcluded(relativePath) {
|
|
57
|
+
return this.current()?.excludes(relativePath) ?? false;
|
|
58
|
+
}
|
|
59
|
+
filter(relativePaths) {
|
|
60
|
+
const exclusions = this.current();
|
|
61
|
+
if (exclusions === undefined)
|
|
62
|
+
return [...relativePaths];
|
|
63
|
+
return relativePaths.filter((file) => !exclusions.excludes(file));
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.RuleFileScope = RuleFileScope;
|
|
67
|
+
//# sourceMappingURL=rule-file-scope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-file-scope.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-file-scope.ts"],"names":[],"mappings":";;;AAAA,uDAAqD;AAErD,iDAA6C;AAE7C;;;;;GAKG;AACH,MAAa,kBAAkB;IAEd;IACA;IACA;IAHb,YACa,QAAgB,EAChB,WAA8B,EAC9B,SAA4B;QAF5B,aAAQ,GAAR,QAAQ,CAAQ;QAChB,gBAAW,GAAX,WAAW,CAAmB;QAC9B,cAAS,GAAT,SAAS,CAAmB;IACtC,CAAC;IAEJ,QAAQ,CAAC,YAAoB;QACzB,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QAC9C,OAAO,CACH,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAA,0BAAW,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAChE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAA,0BAAW,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CACjE,CAAC;IACN,CAAC;CACJ;AAdD,gDAcC;AAED,uGAAuG;AACvG,uGAAuG;AACvG,oGAAoG;AACpG,gEAAgE;AAChE,MAAM,gBAAgB,GAAG,IAAI,oCAAiB,EAAsB,CAAC;AAErE;;;;;;;;;;GAUG;AACH,MAAa,aAAa;IACtB,KAAK,CAAC,SAAS,CAAI,UAA8B,EAAE,GAAqB;QACpE,OAAO,gBAAgB,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;IAED,+FAA+F;IAC/F,OAAO,CAAI,IAAa;QACpB,OAAO,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,8FAA8F;IAC9F,OAAO;QACH,OAAO,gBAAgB,CAAC,QAAQ,EAAE,CAAC;IACvC,CAAC;IAED,UAAU,CAAC,YAAoB;QAC3B,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC;IAC3D,CAAC;IAED,MAAM,CAAC,aAAgC;QACnC,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAClC,IAAI,UAAU,KAAK,SAAS;YAAE,OAAO,CAAC,GAAG,aAAa,CAAC,CAAC;QACxD,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9E,CAAC;CACJ;AAxBD,sCAwBC","sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks';\n\nimport { globMatches } from './glob-matches';\n\n/**\n * The two path exclusions one rule run honours (#1253), as data: the repo's top-level `excludePaths`\n * (no rule judges these) and the rule's OWN `excludePaths` (this rule does not). Both are globs over the\n * workspace-relative path, matched by {@link globMatches} — the same matcher the hooks use, so a list\n * means one thing in the build and in a hook.\n */\nexport class RuleFileExclusions {\n constructor(\n readonly ruleName: string,\n readonly globalPaths: readonly string[],\n readonly rulePaths: readonly string[],\n ) {}\n\n excludes(relativePath: string): boolean {\n const norm = relativePath.replace(/\\\\/g, '/');\n return (\n this.globalPaths.some((glob: string) => globMatches(glob, norm)) ||\n this.rulePaths.some((glob: string) => globMatches(glob, norm))\n );\n }\n}\n\n// The ONE store of the exclusions in force for the rule run on this async call chain. Module-scoped on\n// purpose: the dispatcher enters it and the file listing (DiffScope) reads it, and the rule in between\n// carries no code for it — which is the whole point. AsyncLocalStorage, not a mutable field, so two\n// rules run concurrently can never see each other's exclusions.\nconst activeExclusions = new AsyncLocalStorage<RuleFileExclusions>();\n\n/**\n * Where the framework APPLIES path exclusions to a code rule (#1253) — at DISPATCH, not in the rule.\n *\n * The code-rules runtime runs every rule inside {@link runWithin}; every file listing a rule asks for\n * (`DiffScope.getChangedFiles` / `getAllFiles`, and so `ScanScope.files`) passes through {@link filter}.\n * A rule added later is therefore covered with no code of its own. The one exception is a rule that\n * walks the filesystem itself instead of asking git — it must ask {@link isExcluded} per file.\n *\n * Outside a rule run (the PR gate's checklist matching, the project catalog) there is no store, and\n * nothing is filtered.\n */\nexport class RuleFileScope {\n async runWithin<T>(exclusions: RuleFileExclusions, run: () => Promise<T>): Promise<T> {\n return activeExclusions.run(exclusions, run);\n }\n\n /** Run `work` with NO exclusions in force — for a listing that is not a rule judging files. */\n outside<T>(work: () => T): T {\n return activeExclusions.exit(work);\n }\n\n /** The exclusions of the rule running on this call chain, or undefined outside a rule run. */\n current(): RuleFileExclusions | undefined {\n return activeExclusions.getStore();\n }\n\n isExcluded(relativePath: string): boolean {\n return this.current()?.excludes(relativePath) ?? false;\n }\n\n filter(relativePaths: readonly string[]): string[] {\n const exclusions = this.current();\n if (exclusions === undefined) return [...relativePaths];\n return relativePaths.filter((file: string) => !exclusions.excludes(file));\n }\n}\n"]}
|
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
import { FieldDef, RulePackManifest, RulePackDeclaration, ConfigObject, RetiredConfigKey, SafeguardDefinition, RuleConfigSection } from '@webpieces/rules-sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The framework-owned fields every owned rule's schema carries (#1253), merged in HERE so no pack
|
|
4
|
+
* declares them and no rule can lose them by forgetting a spread.
|
|
5
|
+
*
|
|
6
|
+
* A `lint` rule gets the hatches and `reason` but not `excludePaths`: ESLint decides which files it
|
|
7
|
+
* lints (its own `ignores`), and webpieces' activation of a lint rule is on/off only — an accepted
|
|
8
|
+
* `excludePaths` there would change nothing, so the field is refused rather than silently ignored.
|
|
9
|
+
*/
|
|
10
|
+
export declare class UniversalRuleSchema {
|
|
11
|
+
fieldsFor(section: RuleConfigSection): Readonly<Record<string, FieldDef>>;
|
|
12
|
+
isUniversal(key: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The owner schema plus the framework's fields. A pack schema that names a universal field is
|
|
15
|
+
* REFUSED — one spelling: the registry supplies them, a pack never declares them.
|
|
16
|
+
*
|
|
17
|
+
* The ONE exception is a `lint` rule carrying the framework's own definition: eslint-rules'
|
|
18
|
+
* LintRuleConfig still spreads BASE_RULE_SCHEMA, and decision 6 of #1253 keeps eslint-rules
|
|
19
|
+
* untouched in that change. Its follow-up (#1278) deletes that spread and this exception with it.
|
|
20
|
+
* Any other section, and any differing definition, fails here.
|
|
21
|
+
*/
|
|
22
|
+
merge(ruleId: string, section: RuleConfigSection, schema: Readonly<Record<string, FieldDef>>): Readonly<Record<string, FieldDef>>;
|
|
23
|
+
private sameField;
|
|
24
|
+
}
|
|
2
25
|
/** Loading is the only impure boundary; callers may supply an alternative module transport. */
|
|
3
26
|
export declare abstract class RulePackModuleLoader {
|
|
4
27
|
abstract load(moduleName: string): RulePackManifest;
|
|
@@ -16,6 +39,8 @@ export declare class RulePackRegistry {
|
|
|
16
39
|
private readonly owners;
|
|
17
40
|
private readonly definitions;
|
|
18
41
|
private readonly safeguards;
|
|
42
|
+
private readonly schemas;
|
|
43
|
+
private readonly universal;
|
|
19
44
|
constructor(manifests: readonly RulePackManifest[]);
|
|
20
45
|
private registerContributions;
|
|
21
46
|
ownerOf(ruleId: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RulePackDiscovery = exports.RulePackRegistry = exports.NodeRulePackModuleLoader = exports.RulePackModuleLoader = void 0;
|
|
3
|
+
exports.RulePackDiscovery = exports.RulePackRegistry = exports.NodeRulePackModuleLoader = exports.RulePackModuleLoader = exports.UniversalRuleSchema = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const policy_field_constraints_1 = require("./policy-field-constraints");
|
|
6
6
|
const inversify_1 = require("inversify");
|
|
@@ -9,6 +9,58 @@ const tooling_common_1 = require("@webpieces/tooling-common");
|
|
|
9
9
|
const path = tslib_1.__importStar(require("node:path"));
|
|
10
10
|
const client_module_resolution_1 = require("./client-module-resolution");
|
|
11
11
|
const rules_sdk_1 = require("@webpieces/rules-sdk");
|
|
12
|
+
/**
|
|
13
|
+
* The framework-owned fields every owned rule's schema carries (#1253), merged in HERE so no pack
|
|
14
|
+
* declares them and no rule can lose them by forgetting a spread.
|
|
15
|
+
*
|
|
16
|
+
* A `lint` rule gets the hatches and `reason` but not `excludePaths`: ESLint decides which files it
|
|
17
|
+
* lints (its own `ignores`), and webpieces' activation of a lint rule is on/off only — an accepted
|
|
18
|
+
* `excludePaths` there would change nothing, so the field is refused rather than silently ignored.
|
|
19
|
+
*/
|
|
20
|
+
class UniversalRuleSchema {
|
|
21
|
+
fieldsFor(section) {
|
|
22
|
+
if (section !== 'lint')
|
|
23
|
+
return rules_sdk_1.BASE_RULE_SCHEMA;
|
|
24
|
+
const lint = { ...rules_sdk_1.BASE_RULE_SCHEMA };
|
|
25
|
+
delete lint['excludePaths'];
|
|
26
|
+
return lint;
|
|
27
|
+
}
|
|
28
|
+
isUniversal(key) {
|
|
29
|
+
return Object.hasOwn(rules_sdk_1.BASE_RULE_SCHEMA, key);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* The owner schema plus the framework's fields. A pack schema that names a universal field is
|
|
33
|
+
* REFUSED — one spelling: the registry supplies them, a pack never declares them.
|
|
34
|
+
*
|
|
35
|
+
* The ONE exception is a `lint` rule carrying the framework's own definition: eslint-rules'
|
|
36
|
+
* LintRuleConfig still spreads BASE_RULE_SCHEMA, and decision 6 of #1253 keeps eslint-rules
|
|
37
|
+
* untouched in that change. Its follow-up (#1278) deletes that spread and this exception with it.
|
|
38
|
+
* Any other section, and any differing definition, fails here.
|
|
39
|
+
*/
|
|
40
|
+
merge(ruleId, section, schema) {
|
|
41
|
+
const merged = {};
|
|
42
|
+
for (const [key, field] of Object.entries(schema)) {
|
|
43
|
+
if (!this.isUniversal(key)) {
|
|
44
|
+
merged[key] = field;
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
const owned = rules_sdk_1.BASE_RULE_SCHEMA[key];
|
|
48
|
+
if (section === 'lint' && this.sameField(field, owned))
|
|
49
|
+
continue;
|
|
50
|
+
throw new tooling_common_1.InformAiError(`Policy ${ruleId} declares the framework-owned field "${key}". Delete it from the owner schema (and any ...BASE_RULE_SCHEMA spread); the registry supplies ${Object.keys(rules_sdk_1.BASE_RULE_SCHEMA).join(', ')} to every rule.`);
|
|
51
|
+
}
|
|
52
|
+
return { ...merged, ...this.fieldsFor(section) };
|
|
53
|
+
}
|
|
54
|
+
sameField(a, b) {
|
|
55
|
+
return (a.type === b.type &&
|
|
56
|
+
Boolean(a.optional) === Boolean(b.optional) &&
|
|
57
|
+
Boolean(a.nullable) === Boolean(b.nullable) &&
|
|
58
|
+
Boolean(a.nonEmpty) === Boolean(b.nonEmpty) &&
|
|
59
|
+
a.enumValues === undefined &&
|
|
60
|
+
b.enumValues === undefined);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.UniversalRuleSchema = UniversalRuleSchema;
|
|
12
64
|
/** Loading is the only impure boundary; callers may supply an alternative module transport. */
|
|
13
65
|
class RulePackModuleLoader {
|
|
14
66
|
}
|
|
@@ -38,6 +90,9 @@ class RulePackRegistry {
|
|
|
38
90
|
owners = new Map();
|
|
39
91
|
definitions = new Map();
|
|
40
92
|
safeguards = new Map();
|
|
93
|
+
// Owner schema + the framework-owned universal fields (UniversalRuleSchema) — what config is validated against.
|
|
94
|
+
schemas = new Map();
|
|
95
|
+
universal = new UniversalRuleSchema();
|
|
41
96
|
constructor(manifests) {
|
|
42
97
|
this.manifests = manifests;
|
|
43
98
|
for (const manifest of manifests)
|
|
@@ -107,7 +162,7 @@ class RulePackRegistry {
|
|
|
107
162
|
}
|
|
108
163
|
schemaFor(ruleId) {
|
|
109
164
|
this.ownerOf(ruleId);
|
|
110
|
-
return this.
|
|
165
|
+
return this.schemas.get(ruleId);
|
|
111
166
|
}
|
|
112
167
|
/** The transport records the exact client declaration, including local manifest modules. */
|
|
113
168
|
recordModuleLocation(packName, moduleName) {
|
|
@@ -203,6 +258,7 @@ class RulePackRegistry {
|
|
|
203
258
|
!definition.help.remediation.trim()) {
|
|
204
259
|
throw new tooling_common_1.InformAiError(`Missing catalog help for ${definition.id}. Its owner must supply description and remediation.`);
|
|
205
260
|
}
|
|
261
|
+
this.schemas.set(definition.id, this.universal.merge(definition.id, definition.section, definition.schema));
|
|
206
262
|
this.validateOwnerSettings(definition);
|
|
207
263
|
const mode = definition.schema['mode'];
|
|
208
264
|
if (!mode ||
|
|
@@ -223,17 +279,18 @@ class RulePackRegistry {
|
|
|
223
279
|
throw new tooling_common_1.InformAiError(`Missing optional tuning for ${definition.id}. Supply an explicit object, including {} when empty.`);
|
|
224
280
|
}
|
|
225
281
|
for (const key of Object.keys(tuning)) {
|
|
226
|
-
const field = definition.
|
|
282
|
+
const field = this.schemas.get(definition.id)[key];
|
|
227
283
|
if (!field ||
|
|
228
284
|
!field.optional ||
|
|
229
|
-
|
|
285
|
+
key === 'mode' ||
|
|
286
|
+
this.universal.isUniversal(key)) {
|
|
230
287
|
throw new tooling_common_1.InformAiError(`${definition.id}.${key} cannot have a default. Keep required behaviour in explicit repository config.`);
|
|
231
288
|
}
|
|
232
289
|
const errors = this.validateObject(definition.id, { [key]: field }, { [key]: tuning[key] });
|
|
233
290
|
if (errors.length)
|
|
234
291
|
throw new tooling_common_1.InformAiError(errors.join('\n'));
|
|
235
292
|
}
|
|
236
|
-
const errors = this.validateObject(definition.id, definition.
|
|
293
|
+
const errors = this.validateObject(definition.id, this.schemas.get(definition.id), definition.recommendedSeed);
|
|
237
294
|
if (errors.length)
|
|
238
295
|
throw new tooling_common_1.InformAiError(`Invalid recommended seed: ${errors.join('\n')}. Fix the owner's seed; the loader never applies it.`);
|
|
239
296
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-pack-registry.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-pack-registry.ts"],"names":[],"mappings":";;;;AAAA,yEAAoE;AACpE,yCAA2D;AAC3D,6CAA4C;AAC5C,8DAA0D;AAC1D,wDAAkC;AAClC,yEAAoE;AACpE,oDAY8B;AAE9B,+FAA+F;AAC/F,MAAsB,oBAAoB;CAEzC;AAFD,oDAEC;AAED,MAAa,wBAAyB,SAAQ,oBAAoB;IAC7C,aAAa,CAAc;IAC3B,UAAU,CAAyB;IAEpD,YAAY,UAAkB;QAC1B,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,aAAa,GAAG,IAAA,2BAAa,EAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,cAAc,CAAC,CAAC,CAAC;QAC1E,IAAI,CAAC,UAAU,GAAG,IAAI,iDAAsB,CAAC,UAAU,CAAC,CAAC;IAC7D,CAAC;IAEQ,IAAI,CAAC,UAAkB;QAC5B,gHAAgH;QAChH,MAAM,OAAO,GAAY,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QACjF,IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,CAAC,CAAC,kBAAkB,IAAI,OAAO,CAAC,EAAE,CAAC;YACtF,MAAM,IAAI,8BAAa,CACnB,aAAa,UAAU,gEAAgE,CAC1F,CAAC;QACN,CAAC;QACD,O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vB,MAAM,iBAAiB;IACG;IAA7B,YAA6B,MAA4B;QAA5B,WAAM,GAAN,MAAM,CAAsB;IAAG,CAAC;IAE7D,QAAQ,CAAC,YAA4C;QACjD,MAAM,SAAS,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,WAAgC,EAAE,EAAE,CACpE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CACvC,CAAC;QACF,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,SAAS,CAAC,CAAC;QACjD,SAAS,CAAC,OAAO,CAAC,CAAC,QAA0B,EAAE,KAAa,EAAE,EAAE,CAC5D,QAAQ,CAAC,oBAAoB,CAAC,QAAQ,CAAC,WAAW,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,CAClF,CAAC;QACF,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ,CAAA;AAbY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEA,oBAAoB;GADhD,iBAAiB,CAa7B","sourcesContent":["import { PolicyFieldConstraints } from './policy-field-constraints';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { createRequire } from 'node:module';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport * as path from 'node:path';\nimport { ClientModuleResolution } from './client-module-resolution';\nimport {\n FieldDef,\n RulePackManifest,\n RulePackDeclaration,\n OwnedRuleDefinition,\n RULE_PACK_API_VERSION,\n RULE_SCHEMA_API_VERSION,\n ConfigObject,\n RetiredConfigKey,\n SafeguardDefinition,\n RuleConfigSection,\n ConfigValue,\n} from '@webpieces/rules-sdk';\n\n/** Loading is the only impure boundary; callers may supply an alternative module transport. */\nexport abstract class RulePackModuleLoader {\n abstract load(moduleName: string): RulePackManifest;\n}\n\nexport class NodeRulePackModuleLoader extends RulePackModuleLoader {\n private readonly requireModule: NodeRequire;\n private readonly resolution: ClientModuleResolution;\n\n constructor(clientRoot: string) {\n super();\n this.requireModule = createRequire(path.join(clientRoot, 'package.json'));\n this.resolution = new ClientModuleResolution(clientRoot);\n }\n\n override load(moduleName: string): RulePackManifest {\n // webpieces-disable no-any-unknown -- external module boundary; registry validates its exported data before use\n const exports: unknown = this.requireModule(this.resolution.resolve(moduleName));\n if (typeof exports !== 'object' || exports === null || !('rulePackManifest' in exports)) {\n throw new InformAiError(\n `Rule pack ${moduleName} must export rulePackManifest. Add the public manifest export.`,\n );\n }\n return exports.rulePackManifest as RulePackManifest;\n }\n}\n\n/** A registry depends only on declarations and the SDK, never on concrete execution packages. */\nexport class RulePackRegistry {\n private readonly modules = new Map<string, string>();\n private readonly owners = new Map<string, string>();\n private readonly definitions = new Map<string, OwnedRuleDefinition>();\n private readonly safeguards = new Map<string, SafeguardDefinition>();\n\n constructor(readonly manifests: readonly RulePackManifest[]) {\n for (const manifest of manifests) this.validateManifestHeader(manifest);\n const packs = new Set<string>();\n for (const manifest of manifests) {\n this.validateManifest(manifest);\n if (packs.has(manifest.packageName))\n throw new InformAiError(`Duplicate pack ${manifest.packageName}. Declare it once.`);\n packs.add(manifest.packageName);\n for (const definition of manifest.ownedRules) {\n if (this.owners.has(definition.id))\n throw new InformAiError(\n `Rule ${definition.id} has multiple owners. Keep exactly one owner.`,\n );\n this.owners.set(definition.id, manifest.packageName);\n this.definitions.set(definition.id, definition);\n }\n }\n for (const manifest of manifests) {\n for (const safeguard of manifest.safeguards) {\n if (\n !safeguard ||\n typeof safeguard.id !== 'string' ||\n !safeguard.id ||\n !['fixed', 'experimental'].includes(safeguard.activation) ||\n typeof safeguard.description !== 'string' ||\n !safeguard.description\n ) {\n throw new InformAiError(\n 'Invalid safeguard catalog. Supply id, activation, and description.',\n );\n }\n if (this.owners.has(safeguard.id) || this.safeguards.has(safeguard.id)) {\n throw new InformAiError(\n `Safeguard ${safeguard.id} cannot be configured or owned twice. Keep it outside configurable policies.`,\n );\n }\n this.safeguards.set(safeguard.id, safeguard);\n }\n }\n const executions = new Set<string>();\n for (const manifest of manifests) this.registerContributions(manifest, executions);\n }\n\n private registerContributions(manifest: RulePackManifest, executions: Set<string>): void {\n for (const contribution of manifest.contributions) {\n if (\n !contribution ||\n typeof contribution.ruleId !== 'string' ||\n typeof contribution.ownerPack !== 'string'\n ) {\n throw new InformAiError(\n `Invalid contribution in ${manifest.packageName}. Supply ruleId and ownerPack.`,\n );\n }\n if (\n typeof contribution.implementationModule !== 'string' ||\n !contribution.implementationModule.trim()\n ) {\n throw new InformAiError(\n `Missing implementation module for ${contribution.ruleId} in ${manifest.packageName}. Declare its public runtime module.`,\n );\n }\n const owner = this.owners.get(contribution.ruleId);\n if (!owner || owner !== contribution.ownerPack) {\n throw new InformAiError(\n `Unknown owner ${contribution.ownerPack} for ${contribution.ruleId}. Declare the owning pack and use its exact name.`,\n );\n }\n if (\n !['build', 'source-hook', 'workflow-guard', 'lint'].includes(\n contribution.executionKind,\n )\n ) {\n throw new InformAiError(\n `Invalid execution kind for ${contribution.ruleId}. Use build, source-hook, workflow-guard, or lint.`,\n );\n }\n const execution = `${contribution.ruleId}:${contribution.executionKind}`;\n if (executions.has(execution))\n throw new InformAiError(\n `Duplicate execution-kind contribution ${execution}. Keep one implementation per execution kind.`,\n );\n executions.add(execution);\n }\n }\n\n ownerOf(ruleId: string): string {\n const owner = this.owners.get(ruleId);\n if (!owner) throw new InformAiError(`Unknown rule ${ruleId}. Declare its owning pack.`);\n return owner;\n }\n\n schemaFor(ruleId: string): Readonly<Record<string, FieldDef>> {\n this.ownerOf(ruleId);\n return this.definitions.get(ruleId)!.schema;\n }\n\n /** The transport records the exact client declaration, including local manifest modules. */\n recordModuleLocation(packName: string, moduleName: string): void {\n if (\n !this.manifests.some(\n (manifest: RulePackManifest) => manifest.packageName === packName,\n ) ||\n this.modules.has(packName)\n ) {\n throw new InformAiError(\n `Invalid or duplicate module location for ${packName}. Declare each selected pack once.`,\n );\n }\n this.modules.set(packName, moduleName);\n }\n\n get manifestModules(): ReadonlyMap<string, string> {\n return this.modules;\n }\n\n ruleIds(): readonly string[] {\n return [...this.definitions.keys()];\n }\n\n hasRule(ruleId: string): boolean {\n return this.definitions.has(ruleId);\n }\n\n isSafeguard(ruleId: string): boolean {\n return this.safeguards.has(ruleId);\n }\n\n sectionFor(ruleId: string): RuleConfigSection {\n return this.definitionFor(ruleId).section;\n }\n\n optionalTuningFor(ruleId: string): ConfigObject {\n return this.definitionFor(ruleId).optionalTuning;\n }\n\n seedFor(ruleId: string): ConfigObject {\n return structuredClone(this.definitionFor(ruleId).recommendedSeed);\n }\n\n migrations(): readonly RetiredConfigKey[] {\n return this.manifests.flatMap((manifest: RulePackManifest) => [...manifest.migrations]);\n }\n\n safeguardCatalog(): readonly SafeguardDefinition[] {\n return [...this.safeguards.values()];\n }\n\n private definitionFor(ruleId: string): OwnedRuleDefinition {\n this.ownerOf(ruleId);\n return this.definitions.get(ruleId)!;\n }\n\n /** Validates explicit config values with the owner's schema; supplies no rule defaults. */\n validateRuleConfig(ruleId: string, value: ConfigObject): readonly string[] {\n const errors = this.validateObject(ruleId, this.schemaFor(ruleId), value);\n if (value && typeof value['turnOffRuleUntilEpoch'] === 'number') {\n const epoch = new PolicyFieldConstraints().epochError(\n `[${ruleId}]`,\n value['turnOffRuleUntilEpoch'],\n );\n if (epoch) errors.push(epoch);\n }\n return errors;\n }\n\n private validateManifestHeader(manifest: RulePackManifest): void {\n if (\n !manifest ||\n typeof manifest.packageName !== 'string' ||\n manifest.packageName.length === 0 ||\n typeof manifest.packageVersion !== 'string' ||\n manifest.packageVersion.length === 0 ||\n !Array.isArray(manifest.ownedRules) ||\n !Array.isArray(manifest.contributions) ||\n !Array.isArray(manifest.migrations) ||\n !Array.isArray(manifest.safeguards)\n ) {\n throw new InformAiError(\n 'Invalid rule pack manifest. Supply packageName, packageVersion, ownedRules, contributions, migrations, and safeguards.',\n );\n }\n if (manifest.apiVersion !== RULE_PACK_API_VERSION) {\n throw new InformAiError(\n `Unsupported manifest API ${manifest.apiVersion} for ${manifest.packageName}. Use API ${RULE_PACK_API_VERSION}.`,\n );\n }\n for (const migration of manifest.migrations) {\n if (\n !migration ||\n !['rule', 'key', 'field'].includes(migration.scope) ||\n typeof migration.key !== 'string' ||\n !migration.key ||\n typeof migration.movedTo !== 'string' ||\n typeof migration.instruction !== 'string' ||\n !migration.instruction ||\n typeof migration.label !== 'string' ||\n typeof migration.prunable !== 'boolean'\n ) {\n throw new InformAiError(\n `Invalid migration in ${manifest.packageName}. Supply the retired key and exact edit.`,\n );\n }\n }\n }\n\n private validateManifest(manifest: RulePackManifest): void {\n for (const definition of manifest.ownedRules) {\n if (!definition || typeof definition.id !== 'string' || definition.id.length === 0) {\n throw new InformAiError(\n `Invalid owned rule in ${manifest.packageName}. Supply a nonempty id.`,\n );\n }\n if (definition.schemaApiVersion !== RULE_SCHEMA_API_VERSION) {\n throw new InformAiError(\n `Unsupported schema API for ${definition.id}. Use API ${RULE_SCHEMA_API_VERSION}.`,\n );\n }\n this.validateSchema(definition.id, definition.schema);\n if (\n !definition.help ||\n typeof definition.help.description !== 'string' ||\n !definition.help.description.trim() ||\n typeof definition.help.remediation !== 'string' ||\n !definition.help.remediation.trim()\n ) {\n throw new InformAiError(\n `Missing catalog help for ${definition.id}. Its owner must supply description and remediation.`,\n );\n }\n this.validateOwnerSettings(definition);\n const mode = definition.schema['mode'];\n if (\n !mode ||\n mode.type !== 'string' ||\n mode.optional ||\n mode.nullable ||\n !mode.enumValues?.includes('OFF')\n ) {\n throw new InformAiError(\n `Policy ${definition.id} must declare a required string mode with explicit OFF opt-out. Fix its owner schema.`,\n );\n }\n }\n }\n\n private validateOwnerSettings(definition: OwnedRuleDefinition): void {\n if (!['rules', 'hookGuards', 'lint'].includes(definition.section)) {\n throw new InformAiError(\n `Invalid config section for ${definition.id}. Use rules, hookGuards, or lint.`,\n );\n }\n const tuning = definition.optionalTuning;\n if (!tuning || typeof tuning !== 'object' || Array.isArray(tuning)) {\n throw new InformAiError(\n `Missing optional tuning for ${definition.id}. Supply an explicit object, including {} when empty.`,\n );\n }\n for (const key of Object.keys(tuning)) {\n const field = definition.schema[key];\n if (\n !field ||\n !field.optional ||\n ['mode', 'turnOffRuleUntilEpoch', 'turnOffRuleWhileOnBranch'].includes(key)\n ) {\n throw new InformAiError(\n `${definition.id}.${key} cannot have a default. Keep required behaviour in explicit repository config.`,\n );\n }\n const errors = this.validateObject(\n definition.id,\n { [key]: field },\n { [key]: tuning[key] },\n );\n if (errors.length) throw new InformAiError(errors.join('\\n'));\n }\n const errors = this.validateObject(\n definition.id,\n definition.schema,\n definition.recommendedSeed,\n );\n if (errors.length)\n throw new InformAiError(\n `Invalid recommended seed: ${errors.join('\\n')}. Fix the owner's seed; the loader never applies it.`,\n );\n }\n\n private validateSchema(location: string, schema: Readonly<Record<string, FieldDef>>): void {\n if (!schema || typeof schema !== 'object' || Array.isArray(schema))\n throw new InformAiError(`Invalid schema for ${location}. Supply a field map.`);\n for (const [key, field] of Object.entries(schema)) {\n if (\n !field ||\n !['string', 'number', 'boolean', 'string[]', 'object[]'].includes(field.type)\n ) {\n throw new InformAiError(\n `Invalid field ${location}.${key}. Supply a supported FieldDef type.`,\n );\n }\n for (const flag of ['optional', 'nullable', 'nonEmpty'] as const) {\n if (field[flag] !== undefined && typeof field[flag] !== 'boolean')\n throw new InformAiError(\n `Invalid ${flag} for ${location}.${key}. Supply a boolean.`,\n );\n }\n if (field.emptyInstruction !== undefined && typeof field.emptyInstruction !== 'string') {\n throw new InformAiError(`Invalid emptyInstruction for ${location}.${key}. Supply owner-authored cure text.`);\n }\n if (\n field.enumValues !== undefined &&\n (!Array.isArray(field.enumValues) ||\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n field.enumValues.some((item: unknown) => typeof item !== 'string'))\n ) {\n throw new InformAiError(\n `Invalid enum for ${location}.${key}. Supply string values.`,\n );\n }\n if (field.type === 'object[]')\n this.validateSchema(`${location}.${key}[]`, field.elementSchema!);\n }\n }\n\n private validateObject(\n location: string,\n schema: Readonly<Record<string, FieldDef>>,\n value: ConfigObject,\n ): string[] {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n return [`${location} must be an explicitly configured object.`];\n const errors: string[] = [];\n for (const key of Object.keys(value)) {\n if (Object.hasOwn(schema, key)) continue;\n const fields = new PolicyFieldConstraints();\n const renamed = fields.renamedField(key);\n const retired = this.migrations().find(\n (entry: RetiredConfigKey) =>\n entry.scope === 'field' && entry.key === `${location}.${key}`,\n );\n if (renamed)\n errors.push(\n `${location}.${key} was renamed to ${renamed}. Rename the field; the old spelling is rejected.`,\n );\n else if (retired) errors.push(`${location}.${key}: ${retired.instruction}`);\n else if (fields.isRationale(key)) {\n if (typeof value[key] !== 'string')\n errors.push(`${location}.${key} must be a string rationale note.`);\n } else errors.push(`${location}.${key} is unknown. Use a field declared by its owner.`);\n }\n for (const [key, field] of Object.entries(schema)) {\n const entry = Object.hasOwn(value, key) ? value[key] : undefined,\n label = `${location}.${key}`;\n if (entry === undefined) {\n if (!field.optional)\n errors.push(`${label} is required. Add an explicit ${field.type} value.`);\n continue;\n }\n if (entry === null && field.nullable) continue;\n const valid = field.type.endsWith('[]')\n ? Array.isArray(entry)\n : typeof entry === field.type;\n if (!valid || entry === null) {\n errors.push(`${label} must be ${field.type}.`);\n continue;\n }\n if (field.enumValues && !field.enumValues.includes(String(entry)))\n errors.push(`${label} must be one of ${field.enumValues.join(', ')}.`);\n if (Array.isArray(entry)) {\n if (field.nonEmpty && entry.length === 0)\n errors.push(`${label} must contain at least one entry.` +\n (field.emptyInstruction === undefined ? '' : ` ${field.emptyInstruction}`));\n if (\n field.type === 'string[]' &&\n entry.some((item: ConfigValue) => typeof item !== 'string')\n )\n errors.push(`${label} must contain only strings.`);\n if (field.type === 'object[]')\n entry.forEach((item: ConfigValue, index: number) =>\n errors.push(\n ...this.validateObject(\n `${label}[${index}]`,\n field.elementSchema!,\n item as ConfigObject,\n ),\n ),\n );\n }\n }\n return errors;\n }\n}\n\n/** Inject the selected module transport; discovery never names a built-in owner package. */\n@injectable(bindingScopeValues.Singleton)\nexport class RulePackDiscovery {\n constructor(private readonly loader: RulePackModuleLoader) {}\n\n discover(declarations: readonly RulePackDeclaration[]): RulePackRegistry {\n const manifests = declarations.map((declaration: RulePackDeclaration) =>\n this.loader.load(declaration.module),\n );\n const registry = new RulePackRegistry(manifests);\n manifests.forEach((manifest: RulePackManifest, index: number) =>\n registry.recordModuleLocation(manifest.packageName, declarations[index].module),\n );\n return registry;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"rule-pack-registry.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/rule-pack-registry.ts"],"names":[],"mappings":";;;;AAAA,yEAAoE;AACpE,yCAA2D;AAC3D,6CAA4C;AAC5C,8DAA0D;AAC1D,wDAAkC;AAClC,yEAAoE;AACpE,oDAa8B;AAE9B;;;;;;;GAOG;AACH,MAAa,mBAAmB;IAC5B,SAAS,CAAC,OAA0B;QAChC,IAAI,OAAO,KAAK,MAAM;YAAE,OAAO,4BAAgB,CAAC;QAChD,MAAM,IAAI,GAA6B,EAAE,GAAG,4BAAgB,EAAE,CAAC;QAC/D,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,WAAW,CAAC,GAAW;QACnB,OAAO,MAAM,CAAC,MAAM,CAAC,4BAAgB,EAAE,GAAG,CAAC,CAAC;IAChD,CAAC;IAED;;;;;;;;OAQG;IACH,KAAK,CAAC,MAAc,EAAE,OAA0B,EAAE,MAA0C;QACxF,MAAM,MAAM,GAA6B,EAAE,CAAC;QAC5C,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAChD,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBACzB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;gBACpB,SAAS;YACb,CA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AM,CAAC,CAClF,CAAC;QACF,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ,CAAA;AAbY,8CAAiB;4BAAjB,iBAAiB;IAD7B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEA,oBAAoB;GADhD,iBAAiB,CAa7B","sourcesContent":["import { PolicyFieldConstraints } from './policy-field-constraints';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { createRequire } from 'node:module';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport * as path from 'node:path';\nimport { ClientModuleResolution } from './client-module-resolution';\nimport {\n FieldDef,\n RulePackManifest,\n RulePackDeclaration,\n OwnedRuleDefinition,\n RULE_PACK_API_VERSION,\n RULE_SCHEMA_API_VERSION,\n ConfigObject,\n RetiredConfigKey,\n SafeguardDefinition,\n RuleConfigSection,\n ConfigValue,\n BASE_RULE_SCHEMA,\n} from '@webpieces/rules-sdk';\n\n/**\n * The framework-owned fields every owned rule's schema carries (#1253), merged in HERE so no pack\n * declares them and no rule can lose them by forgetting a spread.\n *\n * A `lint` rule gets the hatches and `reason` but not `excludePaths`: ESLint decides which files it\n * lints (its own `ignores`), and webpieces' activation of a lint rule is on/off only — an accepted\n * `excludePaths` there would change nothing, so the field is refused rather than silently ignored.\n */\nexport class UniversalRuleSchema {\n fieldsFor(section: RuleConfigSection): Readonly<Record<string, FieldDef>> {\n if (section !== 'lint') return BASE_RULE_SCHEMA;\n const lint: Record<string, FieldDef> = { ...BASE_RULE_SCHEMA };\n delete lint['excludePaths'];\n return lint;\n }\n\n isUniversal(key: string): boolean {\n return Object.hasOwn(BASE_RULE_SCHEMA, key);\n }\n\n /**\n * The owner schema plus the framework's fields. A pack schema that names a universal field is\n * REFUSED — one spelling: the registry supplies them, a pack never declares them.\n *\n * The ONE exception is a `lint` rule carrying the framework's own definition: eslint-rules'\n * LintRuleConfig still spreads BASE_RULE_SCHEMA, and decision 6 of #1253 keeps eslint-rules\n * untouched in that change. Its follow-up (#1278) deletes that spread and this exception with it.\n * Any other section, and any differing definition, fails here.\n */\n merge(ruleId: string, section: RuleConfigSection, schema: Readonly<Record<string, FieldDef>>): Readonly<Record<string, FieldDef>> {\n const merged: Record<string, FieldDef> = {};\n for (const [key, field] of Object.entries(schema)) {\n if (!this.isUniversal(key)) {\n merged[key] = field;\n continue;\n }\n const owned = BASE_RULE_SCHEMA[key as keyof typeof BASE_RULE_SCHEMA];\n if (section === 'lint' && this.sameField(field, owned)) continue;\n throw new InformAiError(\n `Policy ${ruleId} declares the framework-owned field \"${key}\". Delete it from the owner schema (and any ...BASE_RULE_SCHEMA spread); the registry supplies ${Object.keys(BASE_RULE_SCHEMA).join(', ')} to every rule.`,\n );\n }\n return { ...merged, ...this.fieldsFor(section) };\n }\n\n private sameField(a: FieldDef, b: FieldDef): boolean {\n return (\n a.type === b.type &&\n Boolean(a.optional) === Boolean(b.optional) &&\n Boolean(a.nullable) === Boolean(b.nullable) &&\n Boolean(a.nonEmpty) === Boolean(b.nonEmpty) &&\n a.enumValues === undefined &&\n b.enumValues === undefined\n );\n }\n}\n\n/** Loading is the only impure boundary; callers may supply an alternative module transport. */\nexport abstract class RulePackModuleLoader {\n abstract load(moduleName: string): RulePackManifest;\n}\n\nexport class NodeRulePackModuleLoader extends RulePackModuleLoader {\n private readonly requireModule: NodeRequire;\n private readonly resolution: ClientModuleResolution;\n\n constructor(clientRoot: string) {\n super();\n this.requireModule = createRequire(path.join(clientRoot, 'package.json'));\n this.resolution = new ClientModuleResolution(clientRoot);\n }\n\n override load(moduleName: string): RulePackManifest {\n // webpieces-disable no-any-unknown -- external module boundary; registry validates its exported data before use\n const exports: unknown = this.requireModule(this.resolution.resolve(moduleName));\n if (typeof exports !== 'object' || exports === null || !('rulePackManifest' in exports)) {\n throw new InformAiError(\n `Rule pack ${moduleName} must export rulePackManifest. Add the public manifest export.`,\n );\n }\n return exports.rulePackManifest as RulePackManifest;\n }\n}\n\n/** A registry depends only on declarations and the SDK, never on concrete execution packages. */\nexport class RulePackRegistry {\n private readonly modules = new Map<string, string>();\n private readonly owners = new Map<string, string>();\n private readonly definitions = new Map<string, OwnedRuleDefinition>();\n private readonly safeguards = new Map<string, SafeguardDefinition>();\n // Owner schema + the framework-owned universal fields (UniversalRuleSchema) — what config is validated against.\n private readonly schemas = new Map<string, Readonly<Record<string, FieldDef>>>();\n private readonly universal = new UniversalRuleSchema();\n\n constructor(readonly manifests: readonly RulePackManifest[]) {\n for (const manifest of manifests) this.validateManifestHeader(manifest);\n const packs = new Set<string>();\n for (const manifest of manifests) {\n this.validateManifest(manifest);\n if (packs.has(manifest.packageName))\n throw new InformAiError(`Duplicate pack ${manifest.packageName}. Declare it once.`);\n packs.add(manifest.packageName);\n for (const definition of manifest.ownedRules) {\n if (this.owners.has(definition.id))\n throw new InformAiError(\n `Rule ${definition.id} has multiple owners. Keep exactly one owner.`,\n );\n this.owners.set(definition.id, manifest.packageName);\n this.definitions.set(definition.id, definition);\n }\n }\n for (const manifest of manifests) {\n for (const safeguard of manifest.safeguards) {\n if (\n !safeguard ||\n typeof safeguard.id !== 'string' ||\n !safeguard.id ||\n !['fixed', 'experimental'].includes(safeguard.activation) ||\n typeof safeguard.description !== 'string' ||\n !safeguard.description\n ) {\n throw new InformAiError(\n 'Invalid safeguard catalog. Supply id, activation, and description.',\n );\n }\n if (this.owners.has(safeguard.id) || this.safeguards.has(safeguard.id)) {\n throw new InformAiError(\n `Safeguard ${safeguard.id} cannot be configured or owned twice. Keep it outside configurable policies.`,\n );\n }\n this.safeguards.set(safeguard.id, safeguard);\n }\n }\n const executions = new Set<string>();\n for (const manifest of manifests) this.registerContributions(manifest, executions);\n }\n\n private registerContributions(manifest: RulePackManifest, executions: Set<string>): void {\n for (const contribution of manifest.contributions) {\n if (\n !contribution ||\n typeof contribution.ruleId !== 'string' ||\n typeof contribution.ownerPack !== 'string'\n ) {\n throw new InformAiError(\n `Invalid contribution in ${manifest.packageName}. Supply ruleId and ownerPack.`,\n );\n }\n if (\n typeof contribution.implementationModule !== 'string' ||\n !contribution.implementationModule.trim()\n ) {\n throw new InformAiError(\n `Missing implementation module for ${contribution.ruleId} in ${manifest.packageName}. Declare its public runtime module.`,\n );\n }\n const owner = this.owners.get(contribution.ruleId);\n if (!owner || owner !== contribution.ownerPack) {\n throw new InformAiError(\n `Unknown owner ${contribution.ownerPack} for ${contribution.ruleId}. Declare the owning pack and use its exact name.`,\n );\n }\n if (\n !['build', 'source-hook', 'workflow-guard', 'lint'].includes(\n contribution.executionKind,\n )\n ) {\n throw new InformAiError(\n `Invalid execution kind for ${contribution.ruleId}. Use build, source-hook, workflow-guard, or lint.`,\n );\n }\n const execution = `${contribution.ruleId}:${contribution.executionKind}`;\n if (executions.has(execution))\n throw new InformAiError(\n `Duplicate execution-kind contribution ${execution}. Keep one implementation per execution kind.`,\n );\n executions.add(execution);\n }\n }\n\n ownerOf(ruleId: string): string {\n const owner = this.owners.get(ruleId);\n if (!owner) throw new InformAiError(`Unknown rule ${ruleId}. Declare its owning pack.`);\n return owner;\n }\n\n schemaFor(ruleId: string): Readonly<Record<string, FieldDef>> {\n this.ownerOf(ruleId);\n return this.schemas.get(ruleId)!;\n }\n\n /** The transport records the exact client declaration, including local manifest modules. */\n recordModuleLocation(packName: string, moduleName: string): void {\n if (\n !this.manifests.some(\n (manifest: RulePackManifest) => manifest.packageName === packName,\n ) ||\n this.modules.has(packName)\n ) {\n throw new InformAiError(\n `Invalid or duplicate module location for ${packName}. Declare each selected pack once.`,\n );\n }\n this.modules.set(packName, moduleName);\n }\n\n get manifestModules(): ReadonlyMap<string, string> {\n return this.modules;\n }\n\n ruleIds(): readonly string[] {\n return [...this.definitions.keys()];\n }\n\n hasRule(ruleId: string): boolean {\n return this.definitions.has(ruleId);\n }\n\n isSafeguard(ruleId: string): boolean {\n return this.safeguards.has(ruleId);\n }\n\n sectionFor(ruleId: string): RuleConfigSection {\n return this.definitionFor(ruleId).section;\n }\n\n optionalTuningFor(ruleId: string): ConfigObject {\n return this.definitionFor(ruleId).optionalTuning;\n }\n\n seedFor(ruleId: string): ConfigObject {\n return structuredClone(this.definitionFor(ruleId).recommendedSeed);\n }\n\n migrations(): readonly RetiredConfigKey[] {\n return this.manifests.flatMap((manifest: RulePackManifest) => [...manifest.migrations]);\n }\n\n safeguardCatalog(): readonly SafeguardDefinition[] {\n return [...this.safeguards.values()];\n }\n\n private definitionFor(ruleId: string): OwnedRuleDefinition {\n this.ownerOf(ruleId);\n return this.definitions.get(ruleId)!;\n }\n\n /** Validates explicit config values with the owner's schema; supplies no rule defaults. */\n validateRuleConfig(ruleId: string, value: ConfigObject): readonly string[] {\n const errors = this.validateObject(ruleId, this.schemaFor(ruleId), value);\n if (value && typeof value['turnOffRuleUntilEpoch'] === 'number') {\n const epoch = new PolicyFieldConstraints().epochError(\n `[${ruleId}]`,\n value['turnOffRuleUntilEpoch'],\n );\n if (epoch) errors.push(epoch);\n }\n return errors;\n }\n\n private validateManifestHeader(manifest: RulePackManifest): void {\n if (\n !manifest ||\n typeof manifest.packageName !== 'string' ||\n manifest.packageName.length === 0 ||\n typeof manifest.packageVersion !== 'string' ||\n manifest.packageVersion.length === 0 ||\n !Array.isArray(manifest.ownedRules) ||\n !Array.isArray(manifest.contributions) ||\n !Array.isArray(manifest.migrations) ||\n !Array.isArray(manifest.safeguards)\n ) {\n throw new InformAiError(\n 'Invalid rule pack manifest. Supply packageName, packageVersion, ownedRules, contributions, migrations, and safeguards.',\n );\n }\n if (manifest.apiVersion !== RULE_PACK_API_VERSION) {\n throw new InformAiError(\n `Unsupported manifest API ${manifest.apiVersion} for ${manifest.packageName}. Use API ${RULE_PACK_API_VERSION}.`,\n );\n }\n for (const migration of manifest.migrations) {\n if (\n !migration ||\n !['rule', 'key', 'field'].includes(migration.scope) ||\n typeof migration.key !== 'string' ||\n !migration.key ||\n typeof migration.movedTo !== 'string' ||\n typeof migration.instruction !== 'string' ||\n !migration.instruction ||\n typeof migration.label !== 'string' ||\n typeof migration.prunable !== 'boolean'\n ) {\n throw new InformAiError(\n `Invalid migration in ${manifest.packageName}. Supply the retired key and exact edit.`,\n );\n }\n }\n }\n\n private validateManifest(manifest: RulePackManifest): void {\n for (const definition of manifest.ownedRules) {\n if (!definition || typeof definition.id !== 'string' || definition.id.length === 0) {\n throw new InformAiError(\n `Invalid owned rule in ${manifest.packageName}. Supply a nonempty id.`,\n );\n }\n if (definition.schemaApiVersion !== RULE_SCHEMA_API_VERSION) {\n throw new InformAiError(\n `Unsupported schema API for ${definition.id}. Use API ${RULE_SCHEMA_API_VERSION}.`,\n );\n }\n this.validateSchema(definition.id, definition.schema);\n if (\n !definition.help ||\n typeof definition.help.description !== 'string' ||\n !definition.help.description.trim() ||\n typeof definition.help.remediation !== 'string' ||\n !definition.help.remediation.trim()\n ) {\n throw new InformAiError(\n `Missing catalog help for ${definition.id}. Its owner must supply description and remediation.`,\n );\n }\n this.schemas.set(\n definition.id,\n this.universal.merge(definition.id, definition.section, definition.schema),\n );\n this.validateOwnerSettings(definition);\n const mode = definition.schema['mode'];\n if (\n !mode ||\n mode.type !== 'string' ||\n mode.optional ||\n mode.nullable ||\n !mode.enumValues?.includes('OFF')\n ) {\n throw new InformAiError(\n `Policy ${definition.id} must declare a required string mode with explicit OFF opt-out. Fix its owner schema.`,\n );\n }\n }\n }\n\n private validateOwnerSettings(definition: OwnedRuleDefinition): void {\n if (!['rules', 'hookGuards', 'lint'].includes(definition.section)) {\n throw new InformAiError(\n `Invalid config section for ${definition.id}. Use rules, hookGuards, or lint.`,\n );\n }\n const tuning = definition.optionalTuning;\n if (!tuning || typeof tuning !== 'object' || Array.isArray(tuning)) {\n throw new InformAiError(\n `Missing optional tuning for ${definition.id}. Supply an explicit object, including {} when empty.`,\n );\n }\n for (const key of Object.keys(tuning)) {\n const field = this.schemas.get(definition.id)![key];\n if (\n !field ||\n !field.optional ||\n key === 'mode' ||\n this.universal.isUniversal(key)\n ) {\n throw new InformAiError(\n `${definition.id}.${key} cannot have a default. Keep required behaviour in explicit repository config.`,\n );\n }\n const errors = this.validateObject(\n definition.id,\n { [key]: field },\n { [key]: tuning[key] },\n );\n if (errors.length) throw new InformAiError(errors.join('\\n'));\n }\n const errors = this.validateObject(\n definition.id,\n this.schemas.get(definition.id)!,\n definition.recommendedSeed,\n );\n if (errors.length)\n throw new InformAiError(\n `Invalid recommended seed: ${errors.join('\\n')}. Fix the owner's seed; the loader never applies it.`,\n );\n }\n\n private validateSchema(location: string, schema: Readonly<Record<string, FieldDef>>): void {\n if (!schema || typeof schema !== 'object' || Array.isArray(schema))\n throw new InformAiError(`Invalid schema for ${location}. Supply a field map.`);\n for (const [key, field] of Object.entries(schema)) {\n if (\n !field ||\n !['string', 'number', 'boolean', 'string[]', 'object[]'].includes(field.type)\n ) {\n throw new InformAiError(\n `Invalid field ${location}.${key}. Supply a supported FieldDef type.`,\n );\n }\n for (const flag of ['optional', 'nullable', 'nonEmpty'] as const) {\n if (field[flag] !== undefined && typeof field[flag] !== 'boolean')\n throw new InformAiError(\n `Invalid ${flag} for ${location}.${key}. Supply a boolean.`,\n );\n }\n if (field.emptyInstruction !== undefined && typeof field.emptyInstruction !== 'string') {\n throw new InformAiError(`Invalid emptyInstruction for ${location}.${key}. Supply owner-authored cure text.`);\n }\n if (\n field.enumValues !== undefined &&\n (!Array.isArray(field.enumValues) ||\n // webpieces-disable no-any-unknown -- external JSON or runtime exports are validated before policy execution\n field.enumValues.some((item: unknown) => typeof item !== 'string'))\n ) {\n throw new InformAiError(\n `Invalid enum for ${location}.${key}. Supply string values.`,\n );\n }\n if (field.type === 'object[]')\n this.validateSchema(`${location}.${key}[]`, field.elementSchema!);\n }\n }\n\n private validateObject(\n location: string,\n schema: Readonly<Record<string, FieldDef>>,\n value: ConfigObject,\n ): string[] {\n if (!value || typeof value !== 'object' || Array.isArray(value))\n return [`${location} must be an explicitly configured object.`];\n const errors: string[] = [];\n for (const key of Object.keys(value)) {\n if (Object.hasOwn(schema, key)) continue;\n const fields = new PolicyFieldConstraints();\n const renamed = fields.renamedField(key);\n const retired = this.migrations().find(\n (entry: RetiredConfigKey) =>\n entry.scope === 'field' && entry.key === `${location}.${key}`,\n );\n if (renamed)\n errors.push(\n `${location}.${key} was renamed to ${renamed}. Rename the field; the old spelling is rejected.`,\n );\n else if (retired) errors.push(`${location}.${key}: ${retired.instruction}`);\n else if (fields.isRationale(key)) {\n if (typeof value[key] !== 'string')\n errors.push(`${location}.${key} must be a string rationale note.`);\n } else errors.push(`${location}.${key} is unknown. Use a field declared by its owner.`);\n }\n for (const [key, field] of Object.entries(schema)) {\n const entry = Object.hasOwn(value, key) ? value[key] : undefined,\n label = `${location}.${key}`;\n if (entry === undefined) {\n if (!field.optional)\n errors.push(`${label} is required. Add an explicit ${field.type} value.`);\n continue;\n }\n if (entry === null && field.nullable) continue;\n const valid = field.type.endsWith('[]')\n ? Array.isArray(entry)\n : typeof entry === field.type;\n if (!valid || entry === null) {\n errors.push(`${label} must be ${field.type}.`);\n continue;\n }\n if (field.enumValues && !field.enumValues.includes(String(entry)))\n errors.push(`${label} must be one of ${field.enumValues.join(', ')}.`);\n if (Array.isArray(entry)) {\n if (field.nonEmpty && entry.length === 0)\n errors.push(`${label} must contain at least one entry.` +\n (field.emptyInstruction === undefined ? '' : ` ${field.emptyInstruction}`));\n if (\n field.type === 'string[]' &&\n entry.some((item: ConfigValue) => typeof item !== 'string')\n )\n errors.push(`${label} must contain only strings.`);\n if (field.type === 'object[]')\n entry.forEach((item: ConfigValue, index: number) =>\n errors.push(\n ...this.validateObject(\n `${label}[${index}]`,\n field.elementSchema!,\n item as ConfigObject,\n ),\n ),\n );\n }\n }\n return errors;\n }\n}\n\n/** Inject the selected module transport; discovery never names a built-in owner package. */\n@injectable(bindingScopeValues.Singleton)\nexport class RulePackDiscovery {\n constructor(private readonly loader: RulePackModuleLoader) {}\n\n discover(declarations: readonly RulePackDeclaration[]): RulePackRegistry {\n const manifests = declarations.map((declaration: RulePackDeclaration) =>\n this.loader.load(declaration.module),\n );\n const registry = new RulePackRegistry(manifests);\n manifests.forEach((manifest: RulePackManifest, index: number) =>\n registry.recordModuleLocation(manifest.packageName, declarations[index].module),\n );\n return registry;\n }\n}\n"]}
|
package/src/rule-pack-sync.js
CHANGED
|
@@ -65,7 +65,7 @@ let RulePackSync = class RulePackSync {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
for (const definition of pack.manifest.ownedRules) {
|
|
68
|
-
const value = this.seedMissing(entries[definition.id], definition);
|
|
68
|
+
const value = this.seedMissing(entries[definition.id], definition, registry.schemaFor(definition.id));
|
|
69
69
|
errors.push(...registry
|
|
70
70
|
.validateRuleConfig(definition.id, value)
|
|
71
71
|
.map((error) => `${filename}: ${error}`));
|
|
@@ -77,12 +77,14 @@ let RulePackSync = class RulePackSync {
|
|
|
77
77
|
throw new tooling_common_1.InformAiError(`Sync made no changes:\n${errors.join('\n')}`);
|
|
78
78
|
return plans;
|
|
79
79
|
}
|
|
80
|
-
seedMissing(previous, definition
|
|
80
|
+
seedMissing(previous, definition,
|
|
81
|
+
// The registry's MERGED schema (owner fields + framework-owned universal fields).
|
|
82
|
+
schema) {
|
|
81
83
|
const value = previous === undefined
|
|
82
84
|
? structuredClone(definition.recommendedSeed)
|
|
83
85
|
: Object.assign(new rules_sdk_1.ConfigObject(), this.object(previous, definition.id));
|
|
84
|
-
for (const field of Object.keys(
|
|
85
|
-
if (!
|
|
86
|
+
for (const field of Object.keys(schema)) {
|
|
87
|
+
if (!schema[field].optional && !Object.hasOwn(value, field)) {
|
|
86
88
|
value[field] = structuredClone(definition.recommendedSeed[field]);
|
|
87
89
|
}
|
|
88
90
|
}
|