@webpieces/rules-config 0.4.837 → 0.4.839
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 +4 -2
- package/src/builds-log.d.ts +1 -1
- package/src/builds-log.js +3 -3
- package/src/builds-log.js.map +1 -1
- package/src/checklist-docs-validator.js +1 -1
- package/src/checklist-docs-validator.js.map +1 -1
- package/src/checklist-override.js +1 -1
- package/src/checklist-override.js.map +1 -1
- package/src/config-file.js +3 -3
- package/src/config-file.js.map +1 -1
- package/src/config-pruner.d.ts +1 -1
- package/src/config-pruner.js +2 -2
- package/src/config-pruner.js.map +1 -1
- package/src/constants.d.ts +0 -2
- package/src/constants.js +1 -3
- package/src/constants.js.map +1 -1
- package/src/diff-scope.js +1 -1
- package/src/diff-scope.js.map +1 -1
- package/src/exclude-hook-paths.js +2 -2
- package/src/exclude-hook-paths.js.map +1 -1
- package/src/home-config-doc-keys.js +2 -2
- package/src/home-config-doc-keys.js.map +1 -1
- package/src/home-config.js +9 -9
- package/src/home-config.js.map +1 -1
- package/src/index.d.ts +2 -21
- package/src/index.js +7 -129
- package/src/index.js.map +1 -1
- package/src/instruct-ai-docs.d.ts +1 -1
- package/src/instruct-ai-docs.js +3 -3
- package/src/instruct-ai-docs.js.map +1 -1
- package/src/load-config.js +2 -2
- package/src/load-config.js.map +1 -1
- package/src/load-template.d.ts +2 -2
- package/src/load-template.js +5 -5
- package/src/load-template.js.map +1 -1
- package/src/orphan-dir-archive.js +3 -3
- package/src/orphan-dir-archive.js.map +1 -1
- package/src/pr-gate-config.js +4 -4
- package/src/pr-gate-config.js.map +1 -1
- package/src/pr-gate-section-validators.js +7 -7
- package/src/pr-gate-section-validators.js.map +1 -1
- package/src/repo-root.d.ts +1 -1
- package/src/repo-root.js +5 -5
- package/src/repo-root.js.map +1 -1
- package/src/repo-scratch-dirs.d.ts +1 -1
- package/src/repo-scratch-dirs.js +3 -3
- package/src/repo-scratch-dirs.js.map +1 -1
- package/src/review-json.d.ts +1 -1
- package/src/review-json.js +11 -11
- package/src/review-json.js.map +1 -1
- package/src/review-provenance.js +4 -4
- package/src/review-provenance.js.map +1 -1
- package/src/reviewer-instructions.js +2 -2
- package/src/reviewer-instructions.js.map +1 -1
- package/src/rules-config-design.d.ts +2 -2
- package/src/rules-config-design.js +4 -4
- package/src/rules-config-design.js.map +1 -1
- package/src/skip-rule.d.ts +2 -8
- package/src/skip-rule.js +24 -61
- package/src/skip-rule.js.map +1 -1
- package/src/spec-temp-dirs.js +2 -1
- package/src/spec-temp-dirs.js.map +1 -1
- package/src/stale-bin-sweep.js +1 -1
- package/src/stale-bin-sweep.js.map +1 -1
- package/src/subagent-provenance.js +7 -7
- package/src/subagent-provenance.js.map +1 -1
- package/src/tmp-scratch-sweep.js +1 -1
- package/src/tmp-scratch-sweep.js.map +1 -1
- package/src/validate-config.js +1 -1
- package/src/validate-config.js.map +1 -1
- package/src/verdict-schema-renderer.js +2 -2
- package/src/verdict-schema-renderer.js.map +1 -1
- package/src/agent-worktree-lock.d.ts +0 -21
- package/src/agent-worktree-lock.js +0 -77
- package/src/agent-worktree-lock.js.map +0 -1
- package/src/atomic-file.d.ts +0 -46
- package/src/atomic-file.js +0 -114
- package/src/atomic-file.js.map +0 -1
- package/src/branch-archiver.d.ts +0 -70
- package/src/branch-archiver.js +0 -157
- package/src/branch-archiver.js.map +0 -1
- package/src/branch-mutation-log.d.ts +0 -77
- package/src/branch-mutation-log.js +0 -221
- package/src/branch-mutation-log.js.map +0 -1
- package/src/branch-reaper.d.ts +0 -121
- package/src/branch-reaper.js +0 -260
- package/src/branch-reaper.js.map +0 -1
- package/src/claude-config-dir.d.ts +0 -62
- package/src/claude-config-dir.js +0 -87
- package/src/claude-config-dir.js.map +0 -1
- package/src/harness-agent-activity.d.ts +0 -154
- package/src/harness-agent-activity.js +0 -346
- package/src/harness-agent-activity.js.map +0 -1
- package/src/inform-ai-error.d.ts +0 -6
- package/src/inform-ai-error.js +0 -13
- package/src/inform-ai-error.js.map +0 -1
- package/src/main-sync-file.d.ts +0 -121
- package/src/main-sync-file.js +0 -281
- package/src/main-sync-file.js.map +0 -1
- package/src/main-sync-status.d.ts +0 -197
- package/src/main-sync-status.js +0 -555
- package/src/main-sync-status.js.map +0 -1
- package/src/merged-branch-verdicts.d.ts +0 -189
- package/src/merged-branch-verdicts.js +0 -251
- package/src/merged-branch-verdicts.js.map +0 -1
- package/src/merged-branches.d.ts +0 -140
- package/src/merged-branches.js +0 -521
- package/src/merged-branches.js.map +0 -1
- package/src/review-identity-stamp.d.ts +0 -82
- package/src/review-identity-stamp.js +0 -172
- package/src/review-identity-stamp.js.map +0 -1
- package/src/state-dir-migration.d.ts +0 -79
- package/src/state-dir-migration.js +0 -185
- package/src/state-dir-migration.js.map +0 -1
- package/src/state-dir.d.ts +0 -209
- package/src/state-dir.js +0 -349
- package/src/state-dir.js.map +0 -1
- package/src/to-error.d.ts +0 -1
- package/src/to-error.js +0 -10
- package/src/to-error.js.map +0 -1
- package/src/worktree-lock-verdicts.d.ts +0 -149
- package/src/worktree-lock-verdicts.js +0 -225
- package/src/worktree-lock-verdicts.js.map +0 -1
- package/src/worktree-reaper.d.ts +0 -116
- package/src/worktree-reaper.js +0 -318
- package/src/worktree-reaper.js.map +0 -1
- package/src/worktrees.d.ts +0 -113
- package/src/worktrees.js +0 -260
- package/src/worktrees.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pr-gate-section-validators.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/pr-gate-section-validators.ts"],"names":[],"mappings":";;;AAkCA,kEASC;AAoCD,8DAIC;AAqID,8DAoCC;AA8DD,sDAkBC;AAmBD,4DA0BC;AAzXD,uDAK2B;AAC3B,+DAA2D;AAC3D,yDAG4B;AAC5B,2CAAmD;AACnD,+DAA2D;AAE3D,yGAAyG;AACzG,sGAAsG;AACtG,oEAAoE;AAEpE,2GAA2G;AAC3G,wGAAwG;AACxG,MAAM,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ourcesContent":["import {\n BRANCH_RETENTIONS,\n BRANCH_RETENTION_ARCHIVE_TAG,\n BRANCH_RETENTION_DELETE,\n BRANCH_RETENTION_KEEP,\n} from './branch-archiver';\nimport { ChecklistValidator } from './checklist-validator';\nimport {\n ChecklistDefinition, DEFAULT_REVIEWER_AGENT_NAME, RawChecklistItem, REVIEWER_AGENTS_PLACEHOLDER,\n ReviewerAgentPolicy, toChecklist,\n} from './checklist-config';\nimport { UPGRADE_SHIM_COMMAND } from './constants';\nimport { retiredKeyErrorsIn } from './retired-config-keys';\n\n// The two `pr-gate` sub-sections whose validation is bulky enough to own a file: the review `checklists`\n// and the one rationale key that is rejected outright. Split out of validate-config.ts only for size;\n// loadAndValidate still reaches both through validatePrGateSection.\n\n// The `*Why` convention (buildCommandWhy, mergeModeWhy, gatesWhy…) is free-form rationale a consumer keeps\n// beside a field, and pr-gate tolerates any of them — EXCEPT this one. See validateNoGateSaltRationale.\nconst GATE_SALT_WHY = 'gateSaltWhy';\n\n/**\n * Reject `gateSaltWhy` outright, and say why, so the next validate on upgrade FORCES its removal.\n *\n * webpieces.config.json is one of the first files a coding agent reads. A rationale note next to `gateSalt`\n * necessarily explains what the token protects, that the salt is committed, and therefore how to forge it —\n * i.e. it is a bypass how-to, sitting in the most-read file in the repo, defeating the only thing an\n * obscurity-grade mechanism has going for it. The rationale belongs in the webpieces source (pr-gate-config.ts\n * documents it in full for humans reading the tooling), never in consumer config. Every other `*Why` key\n * stays allowed; this is not a general ban on documenting your config.\n */\n// webpieces-disable no-any-unknown -- the already-narrowed opaque pr-gate section; only key PRESENCE is read\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateNoGateSaltRationale(s: Record<string, unknown>): string[] {\n if (!(GATE_SALT_WHY in s)) return [];\n return [\n `[pr-gate] DELETE the \"${GATE_SALT_WHY}\" key from webpieces.config.json. It is a rationale note next to ` +\n `\"gateSalt\", which means it spells out what the gate token protects and that the salt is committed — a ` +\n `bypass how-to in the file a coding agent reads first. The mechanism is obscurity-grade; documenting it ` +\n `here removes the obscurity. Nothing else needs changing: the reasoning is already documented in the ` +\n `webpieces source (PrGateConfig.gateSalt) for humans reading the tooling.`,\n ];\n}\n\nconst CHECKLIST_EXAMPLE = (\n 'Example:\\n' +\n ' \"checklists\": [\\n' +\n ' { \"id\": \"db-migrations\",\\n' +\n ' \"doc\": \".claude/review/db-migrations.md\",\\n' +\n ' \"patterns\": [\"**/migrations/**\", \"**/*.sql\"],\\n' +\n ' \"required\": true }\\n' +\n ' ]\\n' +\n ' \"id\" names the checklist and keys its review-round<N>-<id>.json. Every checklist is reviewed by the\\n' +\n ' webpieces-reviewer agent (or your own: \"overrideReviewerAgent\": true + \"reviewerAgentName\"), against\\n' +\n ' its own \"doc\" (REQUIRED, REPO-relative). Omit \"patterns\" (or use []) to run on every PR.\\n' +\n ' \"required\" is MANDATORY on every entry: true blocks the PR until the reviewer passes; false makes\\n' +\n ' it an OPTIONAL review the human is offered and may decline (but if they DO run it, a red verdict\\n' +\n ' still blocks).'\n);\n\n// The label every RETIRED checklist-entry key is filed under in RETIRED_CONFIG_KEYS.\nexport const CHECKLIST_ENTRY_LABEL = '[pr-gate.checklists]';\n\n/**\n * The `checklists` section of a pr-gate config: an ARRAY of { id, doc, patterns?, required }, and nothing else.\n *\n * The previous `{ \"doc\": \"...\" }` shape — which hid the same array in a `<!-- webpieces:checklists -->` HTML\n * comment inside a markdown doc — is REMOVED, not deprecated. It is rejected with the exact edit to make.\n * There is deliberately no back-compat branch: two accepted shapes means two code paths, two doc-resolution\n * rules and two sets of error messages to keep honest forever, while the migration itself is a mechanical\n * config edit that the coding agent reading this error applies in one pass. A hard failure naming the fix is\n * cheaper than permanent duality.\n *\n * Exported so the isolated validate-checklist-docs target reuses it. `repoRoot` (when known) lets the doc\n * existence checks run.\n */\n// webpieces-disable no-any-unknown -- `value` is opaque consumer JSON until narrowed below\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateChecklistsSection(value: unknown, repoRoot?: string): string[] {\n if (Array.isArray(value)) return validateChecklistArray(value, repoRoot);\n if (typeof value === 'object' && value !== null && 'doc' in value) return [legacyManifestError(value)];\n return [`[pr-gate] \"checklists\" must be an ARRAY of { \"id\", \"doc\", \"patterns\"?, \"required\" }. ${CHECKLIST_EXAMPLE}`];\n}\n\n/**\n * The migration message for the removed `{ doc }` manifest shape. It names the doc the consumer pointed at,\n * because that is the file holding the array they must move, and spells out the one non-obvious part of the\n * move: entry `doc` paths used to resolve relative to that manifest doc and are now REPO-relative.\n */\n// webpieces-disable no-any-unknown -- narrowing the opaque checklists section to read the old `doc` key\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction legacyManifestError(value: object): string {\n const doc = (value as Record<string, unknown>)['doc'];\n const docRel = typeof doc === 'string' && doc.trim() !== '' ? doc : '<your review index doc>';\n return (\n `[pr-gate] \"checklists\" is the REMOVED { \"doc\": \"${docRel}\" } shape. The checklist array no longer lives in\\n` +\n ` an HTML comment inside a markdown doc — put it directly in webpieces.config.json:\\n` +\n ` 1. Open \"${docRel}\" and copy the JSON array out of its <!-- webpieces:checklists [...] --> comment.\\n` +\n ` 2. Replace \"checklists\": { \"doc\": \"${docRel}\" } with \"checklists\": <that array>.\\n` +\n ` 3. Rewrite each entry's \"doc\" to be REPO-relative — they used to resolve relative to\\n` +\n ` \"${docRel}\", so a bare \"db-migrations.md\" becomes e.g. \".claude/review/db-migrations.md\".\\n` +\n ` 4. Delete the <!-- webpieces:checklists ... --> comment from \"${docRel}\"; keep the prose.\\n` +\n ` ${CHECKLIST_EXAMPLE}`\n );\n}\n\n/**\n * `required` is MANDATORY on every checklist entry — omitting it is an error, never a default.\n *\n * The error names the entry's own id, because that is what the consumer recognizes in a twelve-entry\n * array; `checklists[7]` alone means counting braces. It also states BOTH edits, because the whole point of\n * the key is that the answer differs per checklist and only the consumer knows which.\n *\n * Why a hard rejection instead of `?? true`: an accepted shape is never migrated. Defaulting to true\n * silently keeps the all-blocking behavior this key exists to relieve, and every consumer that would have\n * benefited stays on the old behavior forever without ever being told the dial exists. Defaulting to false\n * is worse — it would silently DOWNGRADE a live review gate on upgrade. Per CLAUDE.md the reader of this\n * message is a coding agent, so the migration is one mechanical pass.\n */\n// webpieces-disable no-any-unknown -- one opaque checklist entry, narrowed by the typeof guards here\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction requiredKeyErrors(e: Record<string, unknown>, i: number): string[] {\n const name = typeof e['id'] === 'string' && e['id'].trim() !== '' ? ` (\"${e['id']}\")` : '';\n if (e['required'] === undefined) {\n return [\n `[pr-gate] checklists[${i}]${name} is missing \"required\". Every checklist must state one — there is\\n` +\n ` no default, in either direction.\\n` +\n ` \"required\": true → BLOCKING. wp-finish-upsert-pr refuses the PR until this reviewer passes.\\n` +\n ` This is what every checklist did before this key existed.\\n` +\n ` \"required\": false → OPTIONAL. When it matches the diff, wp-review-upsert-pr offers it and the\\n` +\n ` human may decline it. If they DO run it, a red verdict still blocks.\\n` +\n ` ${CHECKLIST_EXAMPLE}`,\n ];\n }\n if (typeof e['required'] !== 'boolean') {\n return [`[pr-gate] checklists[${i}]${name}.required must be a boolean (true = blocking, false = optional) — not a string or number.`];\n }\n return [];\n}\n\n// Structurally check ONE entry — a bad `patterns` or a non-string `doc` is a config-file typo and deserves a\n// `checklists[i]` message. A RETIRED key (the per-entry `subagent`) is reported with its migration edit.\n// webpieces-disable no-any-unknown -- one opaque checklist entry, narrowed per-field below\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction checklistEntryErrors(e: Record<string, unknown>, i: number): string[] {\n const errors = retiredKeyErrorsIn(e, CHECKLIST_ENTRY_LABEL).map((m: string): string => `checklists[${i}] ${m}`);\n if (e['id'] !== undefined && typeof e['id'] !== 'string') {\n errors.push(`[pr-gate] checklists[${i}].id must be a string — the checklist's name; it keys review-round<N>-<id>.json.`);\n }\n if (e['doc'] !== undefined && typeof e['doc'] !== 'string') {\n errors.push(`[pr-gate] checklists[${i}].doc must be a string — the REPO-relative path to the checklist's guidance doc.`);\n }\n // webpieces-disable no-any-unknown -- opaque array element, narrowed by the typeof guard\n if (e['patterns'] !== undefined && !(Array.isArray(e['patterns']) && e['patterns'].every((p: unknown): boolean => typeof p === 'string'))) {\n errors.push(`[pr-gate] checklists[${i}].patterns must be a string[] of path globs (omit or [] to run on every PR).`);\n }\n errors.push(...requiredKeyErrors(e, i));\n return errors;\n}\n\n// Structurally check each entry, then hand the narrowed defs to ChecklistValidator for the id rules and the\n// checks only the filesystem can answer (the guidance doc exists). The reviewer agent itself is repo-wide\n// and is validated once, beside `overrideReviewerAgent` / `reviewerAgentName`, by validateReviewerAgentKeys.\n// webpieces-disable no-any-unknown -- opaque consumer JSON entries, narrowed per-field below\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction validateChecklistArray(value: readonly unknown[], repoRoot?: string): string[] {\n const errors: string[] = [];\n const items: RawChecklistItem[] = [];\n // webpieces-disable no-any-unknown -- each array entry is opaque consumer JSON, narrowed field-by-field below\n value.forEach((entry: unknown, i: number): void => {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {\n errors.push(`[pr-gate] checklists[${i}] must be an object { \"id\", \"doc\", \"patterns\"?, \"required\" }.`);\n return;\n }\n // webpieces-disable no-any-unknown -- narrowing one opaque checklist entry\n const e = entry as Record<string, unknown>;\n errors.push(...checklistEntryErrors(e, i));\n // Only the fields that passed their type check reach toChecklist — the wrong-typed ones already\n // have their own error above, and must not crash the id/doc checks below.\n items.push({\n id: typeof e['id'] === 'string' ? e['id'] : undefined,\n doc: typeof e['doc'] === 'string' ? e['doc'] : undefined,\n required: e['required'] === true,\n });\n });\n // The reviewer policy plays no part in these checks (ids and docs), so a placeholder is bound here.\n const placeholder = new ReviewerAgentPolicy('', REVIEWER_AGENTS_PLACEHOLDER);\n const defs = items.map((item: RawChecklistItem): ChecklistDefinition => toChecklist(item, placeholder));\n return [...errors, ...new ChecklistValidator().validate(repoRoot, defs)];\n}\n\nexport const REVIEWER_AGENT_NAME_KEY = 'reviewerAgentName';\nexport const OVERRIDE_REVIEWER_AGENT_KEY = 'overrideReviewerAgent';\nexport const REVIEWER_AGENTS_KEY = 'reviewerAgents';\nexport const MAX_REVIEWER_ROUNDS_KEY = 'maxReviewerRounds';\n\n/**\n * `overrideReviewerAgent` (optional boolean, absent == false), `reviewerAgentName` (only with the override)\n * and `reviewerAgents` (required nonnegative integer; zero disables reviewer-agent reviews).\n *\n * The reviewer agent defaults to {@link DEFAULT_REVIEWER_AGENT_NAME} — the generic reviewer webpieces ships\n * and manages — so a new repo writes NOTHING here (issue #947). Replacing it changes how every PR is\n * reviewed, so it must be said out loud with `\"overrideReviewerAgent\": true` (greppable) AND a\n * `reviewerAgentName`. A name WITHOUT the override is rejected rather than silently ignored: a key that looks\n * meaningful but controls nothing is a second spelling of a decision (.claude/rules/no-backwards-compat.md).\n *\n * `reviewerAgents` is REQUIRED while the gate is active, for the same reason `required` and `mergeMode` have\n * no default: it sets the PRICE of every review round, and a price nobody chose is the one that stops the\n * gate being run. It used to be optional, and absent meant one SEPARATE subagent per checklist — so a repo\n * with four required checklists charged a one-line typo fix four full reviewer spawns re-reading the same\n * diff, silently, having never been asked. The absent branch is GONE rather than kept as a fallback: an\n * accepted shape is never migrated, and the number is the whole decision the key exists to record.\n */\n// webpieces-disable no-any-unknown -- the already-narrowed opaque pr-gate section; three keys are read\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateReviewerAgentKeys(s: Record<string, unknown>, repoRoot?: string): string[] {\n const errors: string[] = [];\n const override = s[OVERRIDE_REVIEWER_AGENT_KEY];\n const hasName = REVIEWER_AGENT_NAME_KEY in s;\n const name = s[REVIEWER_AGENT_NAME_KEY];\n const named = typeof name === 'string' && name.trim() !== '';\n if (OVERRIDE_REVIEWER_AGENT_KEY in s && typeof override !== 'boolean') {\n errors.push(\n `[pr-gate] \"${OVERRIDE_REVIEWER_AGENT_KEY}\" = ${JSON.stringify(override)} is not valid — it must be true or ` +\n `false. Delete the key to use the webpieces reviewer (${DEFAULT_REVIEWER_AGENT_NAME}); set it to true, together ` +\n `with \"${REVIEWER_AGENT_NAME_KEY}\", to use an agent of your own.`);\n } else if (override === true && !named) {\n errors.push(\n `[pr-gate] \"${OVERRIDE_REVIEWER_AGENT_KEY}\": true needs \"${REVIEWER_AGENT_NAME_KEY}\" — add the agent type every ` +\n `reviewer subagent is spawned as (its .claude/agents/<name>.md must exist) to commands.pr-gate in ` +\n `webpieces.config.json:\\n` +\n ` \"${REVIEWER_AGENT_NAME_KEY}\": \"my-reviewer\",\\n` +\n ` Or delete \"${OVERRIDE_REVIEWER_AGENT_KEY}\" to use the webpieces reviewer (${DEFAULT_REVIEWER_AGENT_NAME}).`);\n } else if (override !== true && hasName) {\n errors.push(\n `[pr-gate] \"${REVIEWER_AGENT_NAME_KEY}\" is set but \"${OVERRIDE_REVIEWER_AGENT_KEY}\" is not true, so it would be ` +\n `ignored. The reviewer agent defaults to ${DEFAULT_REVIEWER_AGENT_NAME} (.claude/agents/${DEFAULT_REVIEWER_AGENT_NAME}.md, ` +\n `written by \\`${UPGRADE_SHIM_COMMAND}\\`). Either:\\n` +\n ` • remove \"${REVIEWER_AGENT_NAME_KEY}\" from commands.pr-gate in webpieces.config.json to use that default, or\\n` +\n ` • set \"${OVERRIDE_REVIEWER_AGENT_KEY}\": true beside it to review with your own agent.`);\n }\n const agentKeysValid = errors.length === 0;\n errors.push(...reviewerAgentsErrors(s));\n errors.push(...maxReviewerRoundsErrors(s));\n // A disabled project never spawns this agent, so requiring its file would make `0` an incomplete opt-out.\n if (repoRoot !== undefined && agentKeysValid && s[REVIEWER_AGENTS_KEY] !== 0) {\n const agentName = override === true ? (name as string).trim() : DEFAULT_REVIEWER_AGENT_NAME;\n errors.push(...new ChecklistValidator().validateReviewerAgent(\n repoRoot, new ReviewerAgentPolicy(agentName, REVIEWER_AGENTS_PLACEHOLDER)));\n }\n return errors;\n}\n\n/** `maxReviewerRounds`: required positive integer. Zero cannot describe an enabled or disabled policy. */\n// webpieces-disable no-any-unknown -- the already-narrowed opaque pr-gate section; one key is read\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction maxReviewerRoundsErrors(s: Record<string, unknown>): string[] {\n const max = s[MAX_REVIEWER_ROUNDS_KEY];\n if (!(MAX_REVIEWER_ROUNDS_KEY in s)) {\n return [\n `[pr-gate] Missing required field \"${MAX_REVIEWER_ROUNDS_KEY}\" — the maximum number of complete ` +\n `reviewer cycles one PR review state may start. Add this line beside \"${REVIEWER_AGENTS_KEY}\":\\n` +\n ` \"${MAX_REVIEWER_ROUNDS_KEY}\": 2,\\n` +\n ' 1 = one full review followed by author remediation with no re-review. 2 = one full review plus ' +\n 'one remediation-only re-review. There is deliberately no default: this repository owns the review budget.',\n ];\n }\n if (!(typeof max === 'number' && Number.isInteger(max) && max > 0)) {\n return [\n `[pr-gate] \"${MAX_REVIEWER_ROUNDS_KEY}\" = ${JSON.stringify(max)} is not valid — it must be a positive integer.`,\n ];\n }\n return [];\n}\n\n/**\n * `reviewerAgents`: present, and a nonnegative integer. Missing and wrong-typed get DIFFERENT messages — the\n * missing one has to teach a reader what the number means and what to weigh when picking it, because they\n * have never seen the key; the wrong-typed one only has to name the constraint they just broke.\n */\n// webpieces-disable no-any-unknown -- the already-narrowed opaque pr-gate section; one key is read\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction reviewerAgentsErrors(s: Record<string, unknown>): string[] {\n const max = s[REVIEWER_AGENTS_KEY];\n if (!(REVIEWER_AGENTS_KEY in s)) {\n return [\n `[pr-gate] Missing required field \"${REVIEWER_AGENTS_KEY}\" — the MOST reviewer subagents one review ` +\n `round may use. Add this line to commands.pr-gate in webpieces.config.json:\\n` +\n ` \"${REVIEWER_AGENTS_KEY}\": 1,\\n` +\n ` 0 = reviewer-agent reviews are disabled for this project while the build and PR gate stay active. ` +\n `1 = ONE subagent reviews every owed checklist (cheapest enabled setting; it is handed each checklist's ` +\n `instructions file and still writes one verdict file per checklist). A HIGHER number buys independent readers — ` +\n `set it to your checklist count for one subagent each — at that many times the tokens per PR. There is ` +\n `deliberately no default: this sets the price of every review round, and an unchosen price is what ` +\n `makes a gate expensive enough that people stop running it.`,\n ];\n }\n if (!(typeof max === 'number' && Number.isInteger(max) && max >= 0)) {\n return [\n `[pr-gate] \"${REVIEWER_AGENTS_KEY}\" = ${JSON.stringify(max)} is not valid — it must be a nonnegative integer: ` +\n `0 disables reviewer-agent reviews for this project while leaving the build and PR gate active; a positive ` +\n `value is the MOST reviewer subagents one review round may use, with owed checklists grouped across them.`,\n ];\n }\n return [];\n}\n\n// The `landPr` block: what happens to the LOCAL branch once its PR is in main. Optional — omitted\n// means \"archive-tag\", which is deliberately the DEFAULT so a consumer gets the branch-accumulation\n// fix without editing config at all. `branchRetentionWhy` (and any other `*Why` sibling) is free-form\n// rationale prose and is tolerated, per the repo's convention for documenting comment-less JSON.\n// webpieces-disable no-any-unknown -- `value` is the opaque consumer `landPr` value until narrowed here\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateLandPrSection(value: unknown): string[] {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return [`[pr-gate] \"landPr\" must be an object, e.g. { \"branchRetention\": \"${BRANCH_RETENTION_ARCHIVE_TAG}\" }.`];\n }\n // webpieces-disable no-any-unknown -- narrowing the opaque landPr object from consumer JSON\n const s = value as Record<string, unknown>;\n if (!('branchRetention' in s)) return [];\n const retention = s['branchRetention'];\n if (typeof retention === 'string' && BRANCH_RETENTIONS.includes(retention)) return [];\n return [\n `[pr-gate] \"landPr.branchRetention\" = \"${String(retention)}\" is not valid. ` +\n `Must be one of: ${BRANCH_RETENTIONS.join(', ')}.\\n` +\n ` \"${BRANCH_RETENTION_ARCHIVE_TAG}\" — (default) tag the branch tip as archive/<date>/<branch>, THEN delete it. The\\n` +\n ` history stays byte-identical and restorable, but the branch stops counting\\n` +\n ` toward the branch cap and cannot be committed onto by accident.\\n` +\n ` \"${BRANCH_RETENTION_DELETE}\" — delete outright; recoverable only from the reflog, which expires.\\n` +\n ` \"${BRANCH_RETENTION_KEEP}\" — do not delete. Branches then accumulate until branch-creation-guard trips.`,\n ];\n}\n\n// A git ref COMPONENT this flow is willing to build a ref name out of. Deliberately much narrower than\n// git's own check-ref-format: these two values are concatenated into a ref that a command then\n// force-pushes, so anything that could be read as a flag, a path escape, or a glob is rejected outright\n// rather than trusted to `git push` argument order.\nconst REF_COMPONENT = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/;\n\n/**\n * Validate the optional `pr-gate.devDeploy` block — where `wp-push-dev` publishes the disposable copy of\n * a feature branch, and which ref is the shared dev branch itself. Absent ⇒ `dev-include` / `dev`.\n *\n * `devBranch` must NOT contain a slash and must not sit inside `branchNamespace`: the whole point of the\n * namespace is that the composed dev branch is written by CI and the copies are written by developers, so\n * a config where one contains the other makes `--list` enumerate the deploy branch and makes the\n * \"refused as a source branch\" check ambiguous.\n */\n// webpieces-disable no-any-unknown -- `value` is the opaque consumer devDeploy value until narrowed here\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateDevDeploySection(value: unknown): string[] {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return ['[pr-gate] \"devDeploy\" must be an object, e.g. { \"branchNamespace\": \"dev-include\", \"devBranch\": \"dev\" }.'];\n }\n // webpieces-disable no-any-unknown -- narrowing the opaque devDeploy object from consumer JSON\n const s = value as Record<string, unknown>;\n const errors: string[] = [];\n errors.push(...validateRefComponent(s, 'branchNamespace', 'dev-include'));\n errors.push(...validateRefComponent(s, 'devBranch', 'dev'));\n if (errors.length > 0) return errors;\n\n const namespace = typeof s['branchNamespace'] === 'string' ? s['branchNamespace'].trim() : 'dev-include';\n const devBranch = typeof s['devBranch'] === 'string' ? s['devBranch'].trim() : 'dev';\n if (devBranch.includes('/')) {\n errors.push(\n `[pr-gate] \"devDeploy.devBranch\" = \"${devBranch}\" must be a single ref name with no \"/\" — it is the ` +\n `branch your CI composes and deploys, not a namespace.`);\n }\n if (devBranch === namespace || devBranch.startsWith(`${namespace}/`) || namespace.startsWith(`${devBranch}/`)) {\n errors.push(\n `[pr-gate] \"devDeploy.devBranch\" (\"${devBranch}\") and \"devDeploy.branchNamespace\" (\"${namespace}\") must not ` +\n `contain one another. The namespace holds the DISPOSABLE per-developer copies (written by wp-push-dev); ` +\n `devBranch is the COMPOSED branch your CI rebuilds from origin/main. Overlapping them makes wp-push-dev ` +\n `--list enumerate the deploy branch and makes \"refused as a source branch\" ambiguous.`);\n }\n return errors;\n}\n\n// One `devDeploy` string field: present ⇒ must be a non-empty, ref-safe string. Absent ⇒ the default.\n// webpieces-disable no-any-unknown -- the already-narrowed opaque devDeploy object\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction validateRefComponent(s: Record<string, unknown>, key: string, example: string): string[] {\n if (!(key in s)) return [];\n const raw = s[key];\n if (typeof raw !== 'string' || raw.trim() === '') {\n return [`[pr-gate] \"devDeploy.${key}\" must be a non-empty string, e.g. \"${example}\". Omit the key for the \"${example}\" default.`];\n }\n if (!REF_COMPONENT.test(raw.trim())) {\n return [\n `[pr-gate] \"devDeploy.${key}\" = \"${raw}\" is not a usable git ref name. Use letters, digits, \".\", \"_\", ` +\n `\"-\" and \"/\" only, starting with a letter or digit (e.g. \"${example}\").`,\n ];\n }\n return [];\n}\n"]}
|
|
1
|
+
{"version":3,"file":"pr-gate-section-validators.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/pr-gate-section-validators.ts"],"names":[],"mappings":";;;AA6BA,kEASC;AAoCD,8DAIC;AAqID,8DAoCC;AA8DD,sDAkBC;AAmBD,4DA0BC;AApXD,sEAAgJ;AAChJ,+DAA2D;AAC3D,yDAG4B;AAC5B,2CAAmD;AACnD,+DAA2D;AAE3D,yGAAyG;AACzG,sGAAsG;AACtG,oEAAoE;AAEpE,2GAA2G;AAC3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AAE,CAAC;AACd,CAAC","sourcesContent":["import { BRANCH_RETENTIONS, BRANCH_RETENTION_ARCHIVE_TAG, BRANCH_RETENTION_DELETE, BRANCH_RETENTION_KEEP } from '@webpieces/repo-workflow-core';\nimport { ChecklistValidator } from './checklist-validator';\nimport {\n ChecklistDefinition, DEFAULT_REVIEWER_AGENT_NAME, RawChecklistItem, REVIEWER_AGENTS_PLACEHOLDER,\n ReviewerAgentPolicy, toChecklist,\n} from './checklist-config';\nimport { UPGRADE_SHIM_COMMAND } from './constants';\nimport { retiredKeyErrorsIn } from './retired-config-keys';\n\n// The two `pr-gate` sub-sections whose validation is bulky enough to own a file: the review `checklists`\n// and the one rationale key that is rejected outright. Split out of validate-config.ts only for size;\n// loadAndValidate still reaches both through validatePrGateSection.\n\n// The `*Why` convention (buildCommandWhy, mergeModeWhy, gatesWhy…) is free-form rationale a consumer keeps\n// beside a field, and pr-gate tolerates any of them — EXCEPT this one. See validateNoGateSaltRationale.\nconst GATE_SALT_WHY = 'gateSaltWhy';\n\n/**\n * Reject `gateSaltWhy` outright, and say why, so the next validate on upgrade FORCES its removal.\n *\n * webpieces.config.json is one of the first files a coding agent reads. A rationale note next to `gateSalt`\n * necessarily explains what the token protects, that the salt is committed, and therefore how to forge it —\n * i.e. it is a bypass how-to, sitting in the most-read file in the repo, defeating the only thing an\n * obscurity-grade mechanism has going for it. The rationale belongs in the webpieces source (pr-gate-config.ts\n * documents it in full for humans reading the tooling), never in consumer config. Every other `*Why` key\n * stays allowed; this is not a general ban on documenting your config.\n */\n// webpieces-disable no-any-unknown -- the already-narrowed opaque pr-gate section; only key PRESENCE is read\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateNoGateSaltRationale(s: Record<string, unknown>): string[] {\n if (!(GATE_SALT_WHY in s)) return [];\n return [\n `[pr-gate] DELETE the \"${GATE_SALT_WHY}\" key from webpieces.config.json. It is a rationale note next to ` +\n `\"gateSalt\", which means it spells out what the gate token protects and that the salt is committed — a ` +\n `bypass how-to in the file a coding agent reads first. The mechanism is obscurity-grade; documenting it ` +\n `here removes the obscurity. Nothing else needs changing: the reasoning is already documented in the ` +\n `webpieces source (PrGateConfig.gateSalt) for humans reading the tooling.`,\n ];\n}\n\nconst CHECKLIST_EXAMPLE = (\n 'Example:\\n' +\n ' \"checklists\": [\\n' +\n ' { \"id\": \"db-migrations\",\\n' +\n ' \"doc\": \".claude/review/db-migrations.md\",\\n' +\n ' \"patterns\": [\"**/migrations/**\", \"**/*.sql\"],\\n' +\n ' \"required\": true }\\n' +\n ' ]\\n' +\n ' \"id\" names the checklist and keys its review-round<N>-<id>.json. Every checklist is reviewed by the\\n' +\n ' webpieces-reviewer agent (or your own: \"overrideReviewerAgent\": true + \"reviewerAgentName\"), against\\n' +\n ' its own \"doc\" (REQUIRED, REPO-relative). Omit \"patterns\" (or use []) to run on every PR.\\n' +\n ' \"required\" is MANDATORY on every entry: true blocks the PR until the reviewer passes; false makes\\n' +\n ' it an OPTIONAL review the human is offered and may decline (but if they DO run it, a red verdict\\n' +\n ' still blocks).'\n);\n\n// The label every RETIRED checklist-entry key is filed under in RETIRED_CONFIG_KEYS.\nexport const CHECKLIST_ENTRY_LABEL = '[pr-gate.checklists]';\n\n/**\n * The `checklists` section of a pr-gate config: an ARRAY of { id, doc, patterns?, required }, and nothing else.\n *\n * The previous `{ \"doc\": \"...\" }` shape — which hid the same array in a `<!-- webpieces:checklists -->` HTML\n * comment inside a markdown doc — is REMOVED, not deprecated. It is rejected with the exact edit to make.\n * There is deliberately no back-compat branch: two accepted shapes means two code paths, two doc-resolution\n * rules and two sets of error messages to keep honest forever, while the migration itself is a mechanical\n * config edit that the coding agent reading this error applies in one pass. A hard failure naming the fix is\n * cheaper than permanent duality.\n *\n * Exported so the isolated validate-checklist-docs target reuses it. `repoRoot` (when known) lets the doc\n * existence checks run.\n */\n// webpieces-disable no-any-unknown -- `value` is opaque consumer JSON until narrowed below\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateChecklistsSection(value: unknown, repoRoot?: string): string[] {\n if (Array.isArray(value)) return validateChecklistArray(value, repoRoot);\n if (typeof value === 'object' && value !== null && 'doc' in value) return [legacyManifestError(value)];\n return [`[pr-gate] \"checklists\" must be an ARRAY of { \"id\", \"doc\", \"patterns\"?, \"required\" }. ${CHECKLIST_EXAMPLE}`];\n}\n\n/**\n * The migration message for the removed `{ doc }` manifest shape. It names the doc the consumer pointed at,\n * because that is the file holding the array they must move, and spells out the one non-obvious part of the\n * move: entry `doc` paths used to resolve relative to that manifest doc and are now REPO-relative.\n */\n// webpieces-disable no-any-unknown -- narrowing the opaque checklists section to read the old `doc` key\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction legacyManifestError(value: object): string {\n const doc = (value as Record<string, unknown>)['doc'];\n const docRel = typeof doc === 'string' && doc.trim() !== '' ? doc : '<your review index doc>';\n return (\n `[pr-gate] \"checklists\" is the REMOVED { \"doc\": \"${docRel}\" } shape. The checklist array no longer lives in\\n` +\n ` an HTML comment inside a markdown doc — put it directly in webpieces.config.json:\\n` +\n ` 1. Open \"${docRel}\" and copy the JSON array out of its <!-- webpieces:checklists [...] --> comment.\\n` +\n ` 2. Replace \"checklists\": { \"doc\": \"${docRel}\" } with \"checklists\": <that array>.\\n` +\n ` 3. Rewrite each entry's \"doc\" to be REPO-relative — they used to resolve relative to\\n` +\n ` \"${docRel}\", so a bare \"db-migrations.md\" becomes e.g. \".claude/review/db-migrations.md\".\\n` +\n ` 4. Delete the <!-- webpieces:checklists ... --> comment from \"${docRel}\"; keep the prose.\\n` +\n ` ${CHECKLIST_EXAMPLE}`\n );\n}\n\n/**\n * `required` is MANDATORY on every checklist entry — omitting it is an error, never a default.\n *\n * The error names the entry's own id, because that is what the consumer recognizes in a twelve-entry\n * array; `checklists[7]` alone means counting braces. It also states BOTH edits, because the whole point of\n * the key is that the answer differs per checklist and only the consumer knows which.\n *\n * Why a hard rejection instead of `?? true`: an accepted shape is never migrated. Defaulting to true\n * silently keeps the all-blocking behavior this key exists to relieve, and every consumer that would have\n * benefited stays on the old behavior forever without ever being told the dial exists. Defaulting to false\n * is worse — it would silently DOWNGRADE a live review gate on upgrade. Per CLAUDE.md the reader of this\n * message is a coding agent, so the migration is one mechanical pass.\n */\n// webpieces-disable no-any-unknown -- one opaque checklist entry, narrowed by the typeof guards here\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction requiredKeyErrors(e: Record<string, unknown>, i: number): string[] {\n const name = typeof e['id'] === 'string' && e['id'].trim() !== '' ? ` (\"${e['id']}\")` : '';\n if (e['required'] === undefined) {\n return [\n `[pr-gate] checklists[${i}]${name} is missing \"required\". Every checklist must state one — there is\\n` +\n ` no default, in either direction.\\n` +\n ` \"required\": true → BLOCKING. wp-finish-upsert-pr refuses the PR until this reviewer passes.\\n` +\n ` This is what every checklist did before this key existed.\\n` +\n ` \"required\": false → OPTIONAL. When it matches the diff, wp-review-upsert-pr offers it and the\\n` +\n ` human may decline it. If they DO run it, a red verdict still blocks.\\n` +\n ` ${CHECKLIST_EXAMPLE}`,\n ];\n }\n if (typeof e['required'] !== 'boolean') {\n return [`[pr-gate] checklists[${i}]${name}.required must be a boolean (true = blocking, false = optional) — not a string or number.`];\n }\n return [];\n}\n\n// Structurally check ONE entry — a bad `patterns` or a non-string `doc` is a config-file typo and deserves a\n// `checklists[i]` message. A RETIRED key (the per-entry `subagent`) is reported with its migration edit.\n// webpieces-disable no-any-unknown -- one opaque checklist entry, narrowed per-field below\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction checklistEntryErrors(e: Record<string, unknown>, i: number): string[] {\n const errors = retiredKeyErrorsIn(e, CHECKLIST_ENTRY_LABEL).map((m: string): string => `checklists[${i}] ${m}`);\n if (e['id'] !== undefined && typeof e['id'] !== 'string') {\n errors.push(`[pr-gate] checklists[${i}].id must be a string — the checklist's name; it keys review-round<N>-<id>.json.`);\n }\n if (e['doc'] !== undefined && typeof e['doc'] !== 'string') {\n errors.push(`[pr-gate] checklists[${i}].doc must be a string — the REPO-relative path to the checklist's guidance doc.`);\n }\n // webpieces-disable no-any-unknown -- opaque array element, narrowed by the typeof guard\n if (e['patterns'] !== undefined && !(Array.isArray(e['patterns']) && e['patterns'].every((p: unknown): boolean => typeof p === 'string'))) {\n errors.push(`[pr-gate] checklists[${i}].patterns must be a string[] of path globs (omit or [] to run on every PR).`);\n }\n errors.push(...requiredKeyErrors(e, i));\n return errors;\n}\n\n// Structurally check each entry, then hand the narrowed defs to ChecklistValidator for the id rules and the\n// checks only the filesystem can answer (the guidance doc exists). The reviewer agent itself is repo-wide\n// and is validated once, beside `overrideReviewerAgent` / `reviewerAgentName`, by validateReviewerAgentKeys.\n// webpieces-disable no-any-unknown -- opaque consumer JSON entries, narrowed per-field below\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction validateChecklistArray(value: readonly unknown[], repoRoot?: string): string[] {\n const errors: string[] = [];\n const items: RawChecklistItem[] = [];\n // webpieces-disable no-any-unknown -- each array entry is opaque consumer JSON, narrowed field-by-field below\n value.forEach((entry: unknown, i: number): void => {\n if (typeof entry !== 'object' || entry === null || Array.isArray(entry)) {\n errors.push(`[pr-gate] checklists[${i}] must be an object { \"id\", \"doc\", \"patterns\"?, \"required\" }.`);\n return;\n }\n // webpieces-disable no-any-unknown -- narrowing one opaque checklist entry\n const e = entry as Record<string, unknown>;\n errors.push(...checklistEntryErrors(e, i));\n // Only the fields that passed their type check reach toChecklist — the wrong-typed ones already\n // have their own error above, and must not crash the id/doc checks below.\n items.push({\n id: typeof e['id'] === 'string' ? e['id'] : undefined,\n doc: typeof e['doc'] === 'string' ? e['doc'] : undefined,\n required: e['required'] === true,\n });\n });\n // The reviewer policy plays no part in these checks (ids and docs), so a placeholder is bound here.\n const placeholder = new ReviewerAgentPolicy('', REVIEWER_AGENTS_PLACEHOLDER);\n const defs = items.map((item: RawChecklistItem): ChecklistDefinition => toChecklist(item, placeholder));\n return [...errors, ...new ChecklistValidator().validate(repoRoot, defs)];\n}\n\nexport const REVIEWER_AGENT_NAME_KEY = 'reviewerAgentName';\nexport const OVERRIDE_REVIEWER_AGENT_KEY = 'overrideReviewerAgent';\nexport const REVIEWER_AGENTS_KEY = 'reviewerAgents';\nexport const MAX_REVIEWER_ROUNDS_KEY = 'maxReviewerRounds';\n\n/**\n * `overrideReviewerAgent` (optional boolean, absent == false), `reviewerAgentName` (only with the override)\n * and `reviewerAgents` (required nonnegative integer; zero disables reviewer-agent reviews).\n *\n * The reviewer agent defaults to {@link DEFAULT_REVIEWER_AGENT_NAME} — the generic reviewer webpieces ships\n * and manages — so a new repo writes NOTHING here (issue #947). Replacing it changes how every PR is\n * reviewed, so it must be said out loud with `\"overrideReviewerAgent\": true` (greppable) AND a\n * `reviewerAgentName`. A name WITHOUT the override is rejected rather than silently ignored: a key that looks\n * meaningful but controls nothing is a second spelling of a decision (.claude/rules/no-backwards-compat.md).\n *\n * `reviewerAgents` is REQUIRED while the gate is active, for the same reason `required` and `mergeMode` have\n * no default: it sets the PRICE of every review round, and a price nobody chose is the one that stops the\n * gate being run. It used to be optional, and absent meant one SEPARATE subagent per checklist — so a repo\n * with four required checklists charged a one-line typo fix four full reviewer spawns re-reading the same\n * diff, silently, having never been asked. The absent branch is GONE rather than kept as a fallback: an\n * accepted shape is never migrated, and the number is the whole decision the key exists to record.\n */\n// webpieces-disable no-any-unknown -- the already-narrowed opaque pr-gate section; three keys are read\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateReviewerAgentKeys(s: Record<string, unknown>, repoRoot?: string): string[] {\n const errors: string[] = [];\n const override = s[OVERRIDE_REVIEWER_AGENT_KEY];\n const hasName = REVIEWER_AGENT_NAME_KEY in s;\n const name = s[REVIEWER_AGENT_NAME_KEY];\n const named = typeof name === 'string' && name.trim() !== '';\n if (OVERRIDE_REVIEWER_AGENT_KEY in s && typeof override !== 'boolean') {\n errors.push(\n `[pr-gate] \"${OVERRIDE_REVIEWER_AGENT_KEY}\" = ${JSON.stringify(override)} is not valid — it must be true or ` +\n `false. Delete the key to use the webpieces reviewer (${DEFAULT_REVIEWER_AGENT_NAME}); set it to true, together ` +\n `with \"${REVIEWER_AGENT_NAME_KEY}\", to use an agent of your own.`);\n } else if (override === true && !named) {\n errors.push(\n `[pr-gate] \"${OVERRIDE_REVIEWER_AGENT_KEY}\": true needs \"${REVIEWER_AGENT_NAME_KEY}\" — add the agent type every ` +\n `reviewer subagent is spawned as (its .claude/agents/<name>.md must exist) to commands.pr-gate in ` +\n `webpieces.config.json:\\n` +\n ` \"${REVIEWER_AGENT_NAME_KEY}\": \"my-reviewer\",\\n` +\n ` Or delete \"${OVERRIDE_REVIEWER_AGENT_KEY}\" to use the webpieces reviewer (${DEFAULT_REVIEWER_AGENT_NAME}).`);\n } else if (override !== true && hasName) {\n errors.push(\n `[pr-gate] \"${REVIEWER_AGENT_NAME_KEY}\" is set but \"${OVERRIDE_REVIEWER_AGENT_KEY}\" is not true, so it would be ` +\n `ignored. The reviewer agent defaults to ${DEFAULT_REVIEWER_AGENT_NAME} (.claude/agents/${DEFAULT_REVIEWER_AGENT_NAME}.md, ` +\n `written by \\`${UPGRADE_SHIM_COMMAND}\\`). Either:\\n` +\n ` • remove \"${REVIEWER_AGENT_NAME_KEY}\" from commands.pr-gate in webpieces.config.json to use that default, or\\n` +\n ` • set \"${OVERRIDE_REVIEWER_AGENT_KEY}\": true beside it to review with your own agent.`);\n }\n const agentKeysValid = errors.length === 0;\n errors.push(...reviewerAgentsErrors(s));\n errors.push(...maxReviewerRoundsErrors(s));\n // A disabled project never spawns this agent, so requiring its file would make `0` an incomplete opt-out.\n if (repoRoot !== undefined && agentKeysValid && s[REVIEWER_AGENTS_KEY] !== 0) {\n const agentName = override === true ? (name as string).trim() : DEFAULT_REVIEWER_AGENT_NAME;\n errors.push(...new ChecklistValidator().validateReviewerAgent(\n repoRoot, new ReviewerAgentPolicy(agentName, REVIEWER_AGENTS_PLACEHOLDER)));\n }\n return errors;\n}\n\n/** `maxReviewerRounds`: required positive integer. Zero cannot describe an enabled or disabled policy. */\n// webpieces-disable no-any-unknown -- the already-narrowed opaque pr-gate section; one key is read\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction maxReviewerRoundsErrors(s: Record<string, unknown>): string[] {\n const max = s[MAX_REVIEWER_ROUNDS_KEY];\n if (!(MAX_REVIEWER_ROUNDS_KEY in s)) {\n return [\n `[pr-gate] Missing required field \"${MAX_REVIEWER_ROUNDS_KEY}\" — the maximum number of complete ` +\n `reviewer cycles one PR review state may start. Add this line beside \"${REVIEWER_AGENTS_KEY}\":\\n` +\n ` \"${MAX_REVIEWER_ROUNDS_KEY}\": 2,\\n` +\n ' 1 = one full review followed by author remediation with no re-review. 2 = one full review plus ' +\n 'one remediation-only re-review. There is deliberately no default: this repository owns the review budget.',\n ];\n }\n if (!(typeof max === 'number' && Number.isInteger(max) && max > 0)) {\n return [\n `[pr-gate] \"${MAX_REVIEWER_ROUNDS_KEY}\" = ${JSON.stringify(max)} is not valid — it must be a positive integer.`,\n ];\n }\n return [];\n}\n\n/**\n * `reviewerAgents`: present, and a nonnegative integer. Missing and wrong-typed get DIFFERENT messages — the\n * missing one has to teach a reader what the number means and what to weigh when picking it, because they\n * have never seen the key; the wrong-typed one only has to name the constraint they just broke.\n */\n// webpieces-disable no-any-unknown -- the already-narrowed opaque pr-gate section; one key is read\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction reviewerAgentsErrors(s: Record<string, unknown>): string[] {\n const max = s[REVIEWER_AGENTS_KEY];\n if (!(REVIEWER_AGENTS_KEY in s)) {\n return [\n `[pr-gate] Missing required field \"${REVIEWER_AGENTS_KEY}\" — the MOST reviewer subagents one review ` +\n `round may use. Add this line to commands.pr-gate in webpieces.config.json:\\n` +\n ` \"${REVIEWER_AGENTS_KEY}\": 1,\\n` +\n ` 0 = reviewer-agent reviews are disabled for this project while the build and PR gate stay active. ` +\n `1 = ONE subagent reviews every owed checklist (cheapest enabled setting; it is handed each checklist's ` +\n `instructions file and still writes one verdict file per checklist). A HIGHER number buys independent readers — ` +\n `set it to your checklist count for one subagent each — at that many times the tokens per PR. There is ` +\n `deliberately no default: this sets the price of every review round, and an unchosen price is what ` +\n `makes a gate expensive enough that people stop running it.`,\n ];\n }\n if (!(typeof max === 'number' && Number.isInteger(max) && max >= 0)) {\n return [\n `[pr-gate] \"${REVIEWER_AGENTS_KEY}\" = ${JSON.stringify(max)} is not valid — it must be a nonnegative integer: ` +\n `0 disables reviewer-agent reviews for this project while leaving the build and PR gate active; a positive ` +\n `value is the MOST reviewer subagents one review round may use, with owed checklists grouped across them.`,\n ];\n }\n return [];\n}\n\n// The `landPr` block: what happens to the LOCAL branch once its PR is in main. Optional — omitted\n// means \"archive-tag\", which is deliberately the DEFAULT so a consumer gets the branch-accumulation\n// fix without editing config at all. `branchRetentionWhy` (and any other `*Why` sibling) is free-form\n// rationale prose and is tolerated, per the repo's convention for documenting comment-less JSON.\n// webpieces-disable no-any-unknown -- `value` is the opaque consumer `landPr` value until narrowed here\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateLandPrSection(value: unknown): string[] {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return [`[pr-gate] \"landPr\" must be an object, e.g. { \"branchRetention\": \"${BRANCH_RETENTION_ARCHIVE_TAG}\" }.`];\n }\n // webpieces-disable no-any-unknown -- narrowing the opaque landPr object from consumer JSON\n const s = value as Record<string, unknown>;\n if (!('branchRetention' in s)) return [];\n const retention = s['branchRetention'];\n if (typeof retention === 'string' && BRANCH_RETENTIONS.includes(retention)) return [];\n return [\n `[pr-gate] \"landPr.branchRetention\" = \"${String(retention)}\" is not valid. ` +\n `Must be one of: ${BRANCH_RETENTIONS.join(', ')}.\\n` +\n ` \"${BRANCH_RETENTION_ARCHIVE_TAG}\" — (default) tag the branch tip as archive/<date>/<branch>, THEN delete it. The\\n` +\n ` history stays byte-identical and restorable, but the branch stops counting\\n` +\n ` toward the branch cap and cannot be committed onto by accident.\\n` +\n ` \"${BRANCH_RETENTION_DELETE}\" — delete outright; recoverable only from the reflog, which expires.\\n` +\n ` \"${BRANCH_RETENTION_KEEP}\" — do not delete. Branches then accumulate until branch-creation-guard trips.`,\n ];\n}\n\n// A git ref COMPONENT this flow is willing to build a ref name out of. Deliberately much narrower than\n// git's own check-ref-format: these two values are concatenated into a ref that a command then\n// force-pushes, so anything that could be read as a flag, a path escape, or a glob is rejected outright\n// rather than trusted to `git push` argument order.\nconst REF_COMPONENT = /^[A-Za-z0-9][A-Za-z0-9._/-]*$/;\n\n/**\n * Validate the optional `pr-gate.devDeploy` block — where `wp-push-dev` publishes the disposable copy of\n * a feature branch, and which ref is the shared dev branch itself. Absent ⇒ `dev-include` / `dev`.\n *\n * `devBranch` must NOT contain a slash and must not sit inside `branchNamespace`: the whole point of the\n * namespace is that the composed dev branch is written by CI and the copies are written by developers, so\n * a config where one contains the other makes `--list` enumerate the deploy branch and makes the\n * \"refused as a source branch\" check ambiguous.\n */\n// webpieces-disable no-any-unknown -- `value` is the opaque consumer devDeploy value until narrowed here\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nexport function validateDevDeploySection(value: unknown): string[] {\n if (typeof value !== 'object' || value === null || Array.isArray(value)) {\n return ['[pr-gate] \"devDeploy\" must be an object, e.g. { \"branchNamespace\": \"dev-include\", \"devBranch\": \"dev\" }.'];\n }\n // webpieces-disable no-any-unknown -- narrowing the opaque devDeploy object from consumer JSON\n const s = value as Record<string, unknown>;\n const errors: string[] = [];\n errors.push(...validateRefComponent(s, 'branchNamespace', 'dev-include'));\n errors.push(...validateRefComponent(s, 'devBranch', 'dev'));\n if (errors.length > 0) return errors;\n\n const namespace = typeof s['branchNamespace'] === 'string' ? s['branchNamespace'].trim() : 'dev-include';\n const devBranch = typeof s['devBranch'] === 'string' ? s['devBranch'].trim() : 'dev';\n if (devBranch.includes('/')) {\n errors.push(\n `[pr-gate] \"devDeploy.devBranch\" = \"${devBranch}\" must be a single ref name with no \"/\" — it is the ` +\n `branch your CI composes and deploys, not a namespace.`);\n }\n if (devBranch === namespace || devBranch.startsWith(`${namespace}/`) || namespace.startsWith(`${devBranch}/`)) {\n errors.push(\n `[pr-gate] \"devDeploy.devBranch\" (\"${devBranch}\") and \"devDeploy.branchNamespace\" (\"${namespace}\") must not ` +\n `contain one another. The namespace holds the DISPOSABLE per-developer copies (written by wp-push-dev); ` +\n `devBranch is the COMPOSED branch your CI rebuilds from origin/main. Overlapping them makes wp-push-dev ` +\n `--list enumerate the deploy branch and makes \"refused as a source branch\" ambiguous.`);\n }\n return errors;\n}\n\n// One `devDeploy` string field: present ⇒ must be a non-empty, ref-safe string. Absent ⇒ the default.\n// webpieces-disable no-any-unknown -- the already-narrowed opaque devDeploy object\n// webpieces-disable no-function-outside-class -- module-level config validator, matches the rest of this file\nfunction validateRefComponent(s: Record<string, unknown>, key: string, example: string): string[] {\n if (!(key in s)) return [];\n const raw = s[key];\n if (typeof raw !== 'string' || raw.trim() === '') {\n return [`[pr-gate] \"devDeploy.${key}\" must be a non-empty string, e.g. \"${example}\". Omit the key for the \"${example}\" default.`];\n }\n if (!REF_COMPONENT.test(raw.trim())) {\n return [\n `[pr-gate] \"devDeploy.${key}\" = \"${raw}\" is not a usable git ref name. Use letters, digits, \".\", \"_\", ` +\n `\"-\" and \"/\" only, starting with a letter or digit (e.g. \"${example}\").`,\n ];\n }\n return [];\n}\n"]}
|
package/src/repo-root.d.ts
CHANGED
package/src/repo-root.js
CHANGED
|
@@ -5,11 +5,11 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const path = tslib_1.__importStar(require("path"));
|
|
6
6
|
const inversify_1 = require("inversify");
|
|
7
7
|
const config_file_1 = require("./config-file");
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
9
|
+
const tooling_common_2 = require("@webpieces/tooling-common");
|
|
10
10
|
// The single instruct-ai home under `.webpieces/`. Kept here (not just in load-template) so callers
|
|
11
11
|
// building AI-facing messages can render the ABSOLUTE doc path from a resolved repo root.
|
|
12
|
-
exports.INSTRUCT_AI_DIR = `${
|
|
12
|
+
exports.INSTRUCT_AI_DIR = `${tooling_common_1.WEBPIECES_TMP_DIR}/instruct-ai`;
|
|
13
13
|
// The instruct-ai leaf under a resolved `.webpieces` dir. LOCAL scope — see instructAiDocPath.
|
|
14
14
|
exports.INSTRUCT_AI_LEAF = 'instruct-ai';
|
|
15
15
|
/**
|
|
@@ -24,7 +24,7 @@ exports.INSTRUCT_AI_LEAF = 'instruct-ai';
|
|
|
24
24
|
*/
|
|
25
25
|
let RepoRootFinder = class RepoRootFinder {
|
|
26
26
|
dotDir;
|
|
27
|
-
constructor(dotDir =
|
|
27
|
+
constructor(dotDir = tooling_common_2.dotWebpieces) {
|
|
28
28
|
this.dotDir = dotDir;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
@@ -77,6 +77,6 @@ let RepoRootFinder = class RepoRootFinder {
|
|
|
77
77
|
exports.RepoRootFinder = RepoRootFinder;
|
|
78
78
|
exports.RepoRootFinder = RepoRootFinder = tslib_1.__decorate([
|
|
79
79
|
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
80
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
80
|
+
tslib_1.__metadata("design:paramtypes", [tooling_common_2.DotWebpieces])
|
|
81
81
|
], RepoRootFinder);
|
|
82
82
|
//# sourceMappingURL=repo-root.js.map
|
package/src/repo-root.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-root.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/repo-root.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAC7B,yCAA2D;AAE3D,+CAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"repo-root.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/repo-root.ts"],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injectable, bindingScopeValues } from 'inversify';\n\nimport { findConfigFile } from './config-file';\nimport { WEBPIECES_TMP_DIR } from '@webpieces/tooling-common';\nimport { DotWebpieces, dotWebpieces } from '@webpieces/tooling-common';\n\n// The single instruct-ai home under `.webpieces/`. Kept here (not just in load-template) so callers\n// building AI-facing messages can render the ABSOLUTE doc path from a resolved repo root.\nexport const INSTRUCT_AI_DIR = `${WEBPIECES_TMP_DIR}/instruct-ai`;\n// The instruct-ai leaf under a resolved `.webpieces` dir. LOCAL scope — see instructAiDocPath.\nexport const INSTRUCT_AI_LEAF = 'instruct-ai';\n\n/**\n * Resolves the single repo root that owns the `.webpieces/` tree, and renders absolute paths beneath\n * it.\n *\n * `.webpieces/` MUST live at the repo root — never in a CWD-dependent subdirectory. A tool invoked\n * from a subdir (a nested package, a `services/*` app) that naively joined `.webpieces` onto its own\n * cwd would scatter stray `.webpieces` trees across the tree — the exact bug this prevents. Every\n * writer of `.webpieces/...` (logs, instruct-ai docs, sync cache, merge/pr state) MUST anchor its\n * path here rather than at `process.cwd()`.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class RepoRootFinder {\n constructor(private readonly dotDir: DotWebpieces = dotWebpieces) {}\n\n /**\n * The repo root for `startDir`. Resolution order (first hit wins):\n * 1. Directory holding webpieces.config.json — the webpieces workspace root, and the exact\n * anchor the hook runner already uses. Walks UP from startDir, so a subdir resolves to root.\n * 2. git toplevel — the repo root when no config is present yet (e.g. the installer runs before\n * webpieces.config.json exists). Asked via `DotWebpieces.treeRoot`, which is the ONE\n * `git rev-parse` tree-root resolver in this repo (memoized, fails closed). This class used to\n * carry its own byte-identical `spawnSync` copy, with a comment claiming to \"mirror\"\n * runner.ts's — a mirror that had already drifted, since runner.ts had moved the call to\n * effective-tree.ts. There is one implementation now, so a mirror cannot drift.\n * 3. `startDir` — last resort (git unavailable / not a repo / no config). Best-effort only.\n *\n * Step 1 is deliberately FIRST and deliberately not identity: config walk-up climbs PAST a nested\n * clone's `.git` to the outer webpieces root (repo-root.spec.ts pins that), and in a linked worktree\n * it answers with the WORKTREE, because `webpieces.config.json` is TRACKED IN GIT and therefore part\n * of the BRANCH — a branch may change its own rules. See state-dir.ts for that boundary, and\n * `EffectiveTreeResolver` for the different question (\"which tree is this, and is it ours\") that\n * must NOT be answered from the config file.\n */\n resolveRepoRoot(startDir: string): string {\n const configPath = findConfigFile(startDir);\n if (configPath !== null) return path.dirname(configPath);\n const gitRoot = this.dotDir.treeRoot(startDir);\n if (gitRoot !== null) return gitRoot;\n return startDir;\n }\n\n /**\n * Absolute path to an instruct-ai doc. Hand THIS to the AI in a violation/fix message — never a\n * bare `.webpieces/instruct-ai/...` relative path, which an AI whose cwd is a subdirectory would\n * resolve against the wrong directory and fail to open.\n *\n * LOCAL scope: these docs are regenerated by every `wp-*` command, so under a shared path seven\n * agents would rewrite one file concurrently for no benefit — the content is version-scoped and\n * identical, and a doc the AI is told to open must never be mid-truncation. Per-worktree it has one\n * writer. TemplateWriter additionally writes it atomically and skips the write entirely when the\n * bytes already match.\n */\n instructAiDocPath(repoRoot: string, docName: string): string {\n return this.dotDir.localFile(repoRoot, INSTRUCT_AI_LEAF, docName);\n }\n\n /** Absolute instruct-ai doc path resolved directly from `startDir` (resolveRepoRoot + join). */\n docPathFrom(startDir: string, docName: string): string {\n return this.instructAiDocPath(this.resolveRepoRoot(startDir), docName);\n }\n\n}\n"]}
|
package/src/repo-scratch-dirs.js
CHANGED
|
@@ -5,7 +5,7 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
6
|
const path = tslib_1.__importStar(require("path"));
|
|
7
7
|
const inversify_1 = require("inversify");
|
|
8
|
-
const
|
|
8
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
9
9
|
// ---------------------------------------------------------------------------
|
|
10
10
|
// SHORT-LIVED RUNTIME SCRATCH FILES BELONG IN `.webpieces/`, NOT IN `$TMPDIR`.
|
|
11
11
|
//
|
|
@@ -32,7 +32,7 @@ exports.SCRATCH_DIR_NAME = 'scratch';
|
|
|
32
32
|
*/
|
|
33
33
|
let RepoScratchDirs = class RepoScratchDirs {
|
|
34
34
|
dotDir;
|
|
35
|
-
constructor(dotDir =
|
|
35
|
+
constructor(dotDir = tooling_common_1.dotWebpieces) {
|
|
36
36
|
this.dotDir = dotDir;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -49,6 +49,6 @@ let RepoScratchDirs = class RepoScratchDirs {
|
|
|
49
49
|
exports.RepoScratchDirs = RepoScratchDirs;
|
|
50
50
|
exports.RepoScratchDirs = RepoScratchDirs = tslib_1.__decorate([
|
|
51
51
|
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
52
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
52
|
+
tslib_1.__metadata("design:paramtypes", [tooling_common_1.DotWebpieces])
|
|
53
53
|
], RepoScratchDirs);
|
|
54
54
|
//# sourceMappingURL=repo-scratch-dirs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"repo-scratch-dirs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/repo-scratch-dirs.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAC7B,yCAA2D;AAC3D,
|
|
1
|
+
{"version":3,"file":"repo-scratch-dirs.js","sourceRoot":"","sources":["../../../../../packages/tooling/rules-config/src/repo-scratch-dirs.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,mDAA6B;AAC7B,yCAA2D;AAC3D,8DAAuE;AAEvE,8EAA8E;AAC9E,+EAA+E;AAC/E,EAAE;AACF,0GAA0G;AAC1G,yGAAyG;AACzG,uGAAuG;AACvG,kGAAkG;AAClG,sFAAsF;AACtF,EAAE;AACF,iGAAiG;AACjG,oGAAoG;AACpG,oGAAoG;AACpG,oGAAoG;AACpG,WAAW;AACX,8EAA8E;AAE9E,kGAAkG;AACrF,QAAA,gBAAgB,GAAG,SAAS,CAAC;AAE1C;;;;;;GAMG;AAEI,IAAM,eAAe,GAArB,MAAM,eAAe;IACK;IAA7B,YAA6B,SAAuB,6BAAY;QAAnC,WAAM,GAAN,MAAM,CAA6B;IAAG,CAAC;IAEpE;;;;OAIG;IACH,IAAI,CAAC,QAAgB,EAAE,MAAc;QACjC,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,wBAAgB,CAAC,CAAC;QACtE,EAAE,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACxC,OAAO,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,CAAC;CACJ,CAAA;AAbY,0CAAe;0BAAf,eAAe;IAD3B,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAEA,6BAAY;GADxC,eAAe,CAa3B","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { DotWebpieces, dotWebpieces } from '@webpieces/tooling-common';\n\n// ---------------------------------------------------------------------------\n// SHORT-LIVED RUNTIME SCRATCH FILES BELONG IN `.webpieces/`, NOT IN `$TMPDIR`.\n//\n// Two `wp-*` code paths needed a path on disk for the length of one subprocess call — the squash body for\n// `gh pr merge --body-file`, and the nx graph dump — and both reached for `os.tmpdir()`. Neither has the\n// reason that justifies `$TMPDIR` for a SPEC fixture (see `spec-temp-dirs.ts`): they are not isolating\n// themselves from the developer's `$HOME`, and they do not `git init` inside themselves. They are\n// ordinary gate state, and every other piece of gate state lives under `.webpieces/`.\n//\n// Putting them there is not tidiness — it is what gives them an OWNER. `CleanTmp` already sweeps\n// `DotWebpieces.local()` on a 30-day retention at the end of every merge/PR flow, so a scratch file\n// written here is reaped by a mechanism that already exists and is already tested. The same file in\n// `$TMPDIR` had no owner at all, which is how 4,222 `wp-merge-body-` directories accumulated on one\n// machine.\n// ---------------------------------------------------------------------------\n\n/** The subdirectory of the per-worktree `.webpieces` scope that holds throwaway runtime files. */\nexport const SCRATCH_DIR_NAME = 'scratch';\n\n/**\n * Creates short-lived scratch directories under this worktree's `.webpieces/` scope.\n *\n * `local()` (not `aiWritable()`) is the right scope: these files are written by the TOOLING, never by an\n * agent, and `local()` keeps them under the primary clone so they outlive a reaped worktree exactly like\n * the gate logs beside them.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class RepoScratchDirs {\n constructor(private readonly dotDir: DotWebpieces = dotWebpieces) {}\n\n /**\n * `fs.mkdtempSync` under `<.webpieces scope>/scratch/`, creating the parent if this is the first call.\n *\n * `prefix` keeps the `wp-<area>-` convention, so a leftover names the code path that wrote it.\n */\n make(repoRoot: string, prefix: string): string {\n const base = path.join(this.dotDir.local(repoRoot), SCRATCH_DIR_NAME);\n fs.mkdirSync(base, { recursive: true });\n return fs.mkdtempSync(path.join(base, prefix));\n }\n}\n"]}
|
package/src/review-json.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DotWebpieces } from '
|
|
1
|
+
import { DotWebpieces } from '@webpieces/tooling-common';
|
|
2
2
|
import { ChecklistOverride, ChecklistOverrideService, checklistOverrideService } from './checklist-override';
|
|
3
3
|
import { VERDICT_GREEN, VERDICT_YELLOW, VERDICT_ORANGE, VERDICT_RED, VERDICT_STATUSES, ChecklistResult, RequiredChecklist, ChecklistReviewContext, PrSummary, CK_PASS, CK_WARN, CK_OVERRIDDEN, CK_ORANGE_FIXED, CK_ORANGE, CK_FAIL, CK_MISSING, CK_BAD_FORMAT, ChecklistVerdict, PrContext } from './review-json-data';
|
|
4
4
|
export { ChecklistOverride, ChecklistOverrideService, checklistOverrideService };
|
package/src/review-json.js
CHANGED
|
@@ -8,10 +8,10 @@ const tslib_1 = require("tslib");
|
|
|
8
8
|
const fs = tslib_1.__importStar(require("fs"));
|
|
9
9
|
const path = tslib_1.__importStar(require("path"));
|
|
10
10
|
const inversify_1 = require("inversify");
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
const to_error_1 = require("
|
|
11
|
+
const tooling_common_1 = require("@webpieces/tooling-common");
|
|
12
|
+
const tooling_common_2 = require("@webpieces/tooling-common");
|
|
13
|
+
const tooling_common_3 = require("@webpieces/tooling-common");
|
|
14
|
+
const to_error_1 = require("@webpieces/tooling-common/to-error");
|
|
15
15
|
const summary_json_schema_renderer_1 = require("./summary-json-schema-renderer");
|
|
16
16
|
const verdict_schema_renderer_1 = require("./verdict-schema-renderer");
|
|
17
17
|
const checklist_override_1 = require("./checklist-override");
|
|
@@ -58,7 +58,7 @@ const VERDICT_FILE_PREFIX = 'review-round';
|
|
|
58
58
|
let ReviewJsonService = class ReviewJsonService {
|
|
59
59
|
dotDir;
|
|
60
60
|
overrides;
|
|
61
|
-
constructor(dotDir =
|
|
61
|
+
constructor(dotDir = tooling_common_2.dotWebpieces, overrides = checklist_override_1.checklistOverrideService) {
|
|
62
62
|
this.dotDir = dotDir;
|
|
63
63
|
this.overrides = overrides;
|
|
64
64
|
}
|
|
@@ -68,7 +68,7 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
68
68
|
// shared checkout, which is where local() puts this, so local() made both files unwritable by the
|
|
69
69
|
// very agents the flow instructs to write them. See DotWebpieces.aiWritable() for the full account.
|
|
70
70
|
prDirFor(repoRoot, featureName) {
|
|
71
|
-
return this.dotDir.aiWritableFile(repoRoot,
|
|
71
|
+
return this.dotDir.aiWritableFile(repoRoot, tooling_common_1.PR_REVIEW_DIR, featureName);
|
|
72
72
|
}
|
|
73
73
|
// Absolute path of the summary.json for a feature — beside pr-body.md, keyed by branch name.
|
|
74
74
|
summaryJsonPath(repoRoot, featureName) {
|
|
@@ -300,17 +300,17 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
300
300
|
assertValidSummary(errors, filePath, expectedMainAgentInstructions, retryCommand) {
|
|
301
301
|
if (errors.length === 0)
|
|
302
302
|
return;
|
|
303
|
-
throw new
|
|
303
|
+
throw new tooling_common_3.InformAiError(`summary.json has ${errors.length} error(s) — fix ALL, then re-run ${retryCommand}:\n\n` + errors.map((e) => ` • ${e}`).join('\n') + `\n\n${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}`);
|
|
304
304
|
}
|
|
305
305
|
/** Load the raw object and render every parse/shape error for the command that called us. */
|
|
306
306
|
readSummaryObject(filePath, expectedMainAgentInstructions, retryCommand) {
|
|
307
307
|
if (!fs.existsSync(filePath)) {
|
|
308
|
-
throw new
|
|
308
|
+
throw new tooling_common_3.InformAiError(`Required summary.json not found.${this.renamedFileHint(filePath)}${this.archivedSummaryHint(filePath, retryCommand)}\n\n` + `${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}\n\n` + `Then re-run: ${retryCommand}`);
|
|
309
309
|
}
|
|
310
310
|
const raw = this.parseSummaryJson(fs.readFileSync(filePath, 'utf8'), filePath, expectedMainAgentInstructions, retryCommand);
|
|
311
311
|
if (typeof raw === 'object' && raw !== null && !Array.isArray(raw))
|
|
312
312
|
return raw;
|
|
313
|
-
throw new
|
|
313
|
+
throw new tooling_common_3.InformAiError(`summary.json must be a JSON object.\n\n${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}` + `\n\nThen re-run: ${retryCommand}`);
|
|
314
314
|
}
|
|
315
315
|
// webpieces-disable no-any-unknown -- AI-authored JSON boundary is validated before use
|
|
316
316
|
validateMainAgentInstructions(
|
|
@@ -615,14 +615,14 @@ let ReviewJsonService = class ReviewJsonService {
|
|
|
615
615
|
}
|
|
616
616
|
catch (err) {
|
|
617
617
|
const error = (0, to_error_1.toError)(err);
|
|
618
|
-
throw new
|
|
618
|
+
throw new tooling_common_3.InformAiError(`summary.json is not valid JSON (${error.message}).\n\n` + `${this.summaryJsonSchemaHint(filePath, expectedMainAgentInstructions)}\n\n` + `Then re-run: ${retryCommand}`);
|
|
619
619
|
}
|
|
620
620
|
}
|
|
621
621
|
};
|
|
622
622
|
exports.ReviewJsonService = ReviewJsonService;
|
|
623
623
|
exports.ReviewJsonService = ReviewJsonService = tslib_1.__decorate([
|
|
624
624
|
(0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
|
|
625
|
-
tslib_1.__metadata("design:paramtypes", [
|
|
625
|
+
tslib_1.__metadata("design:paramtypes", [tooling_common_2.DotWebpieces,
|
|
626
626
|
checklist_override_1.ChecklistOverrideService])
|
|
627
627
|
], ReviewJsonService);
|
|
628
628
|
// Temporary migration delegators to ReviewJsonService — removed once consumers inject it.
|