@webpieces/pr-gate 0.4.976 → 0.4.978
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 +6 -6
- package/src/scripts/commands/cleanup-command.js +12 -12
- package/src/scripts/commands/cleanup-command.js.map +1 -1
- package/src/scripts/commands/human-post-pr-command.js +1 -1
- package/src/scripts/commands/human-post-pr-command.js.map +1 -1
- package/src/scripts/commands/land-pr-command.js +1 -1
- package/src/scripts/commands/land-pr-command.js.map +1 -1
- package/src/scripts/commands/reap-worktree-command.js +4 -5
- package/src/scripts/commands/reap-worktree-command.js.map +1 -1
- package/src/scripts/commands/review-upsert-pr-command.js +1 -1
- package/src/scripts/commands/review-upsert-pr-command.js.map +1 -1
- package/src/scripts/commands/start-upsert-pr-command.js +1 -1
- package/src/scripts/commands/start-upsert-pr-command.js.map +1 -1
- package/src/scripts/commands/sync-main-command.js +4 -4
- package/src/scripts/commands/sync-main-command.js.map +1 -1
- package/src/scripts/commands/worktree-cleanup.d.ts +4 -4
- package/src/scripts/commands/worktree-cleanup.js +4 -4
- package/src/scripts/commands/worktree-cleanup.js.map +1 -1
- package/src/scripts/workflow/checklist-detector.d.ts +2 -2
- package/src/scripts/workflow/checklist-detector.js +4 -4
- package/src/scripts/workflow/checklist-detector.js.map +1 -1
- package/src/scripts/workflow/checklist-scanner.js +3 -3
- package/src/scripts/workflow/checklist-scanner.js.map +1 -1
- package/src/scripts/workflow/merge-end.d.ts +3 -2
- package/src/scripts/workflow/merge-end.js +6 -3
- package/src/scripts/workflow/merge-end.js.map +1 -1
- package/src/scripts/workflow/pr-context-writer.d.ts +1 -1
- package/src/scripts/workflow/pr-context-writer.js +3 -3
- package/src/scripts/workflow/pr-context-writer.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"land-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/land-pr-command.ts"],"names":[],"mappings":";;;;A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AS;IAEpB,yDAAyD;IACzD,YACI,MAAc,EAAE,KAAa,EAAE,GAAW,EAAE,IAAY,EAAE,UAAkB,EAAE,WAAmB;QAEjG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AAED;;;;;;GAMG;AACH,MAAa,aAAa;IACtB;;;;OAIG;IACH,aAAa,CAAU;IACvB,mGAAmG;IACnG,QAAQ,CAAS;IAEjB,YAAY,aAAsB,EAAE,QAAgB;QAChD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAdD,sCAcC","sourcesContent":["import { GitProcessApi, InformAiError, NativeProcessApi } from '@webpieces/tooling-common';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { RepoRootFinder, MERGE_MODE_AUTO, loadAndValidate } from '@webpieces/rules-config';\nimport { BranchArchiver, BRANCH_RETENTION_ARCHIVE_TAG, BRANCH_RETENTION_KEEP } from '@webpieces/repo-workflow-core';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { BranchNaming } from '../workflow/branch-naming';\nimport { LandedTree, LandedTreeResolver, LANDED_TREE_ABSENT } from '../workflow/landed-tree-resolver';\nimport { LandedWorktreeReaper, WorktreeReapHandoff } from '../workflow/landed-worktree-reaper';\nimport { MergeBodyTempFile } from '../workflow/merge-body-temp-file';\nimport { ArchiveRecord, MergeInfoIndex } from '../workflow/merge-info-index';\nimport { MergeIntent, PrMerger } from '../workflow/pr-merger';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * `wp-land-pr`: squash-merge THIS branch's already-posted PR into main with the compact commit body.\n *\n * It exists because a merge clicked in the GitHub UI cannot set the squash SUBJECT to `<title> (#N)`\n * and cannot archive the pre-squash tip. So when a merge has to happen outside `wp-finish-upsert-pr`\n * (a mergeMode=NONE repo, or a PR whose checks were still running when finish ran), this is the command\n * that keeps main's history consistent and finishes the branch's bookkeeping.\n *\n * ─── Where the bytes come from: THE PR ITSELF ──────────────────────────────────────────────────────\n * `wp-finish-upsert-pr` renders ONE string and publishes it as the PR DESCRIPTION, and the full\n * dashboard lives in the PR's comments (see `pr-body-is-merge-body.spec.ts`, which pins that the\n * description and the merge body are one renderer's output). So the description IS the gated squash\n * body, held by GitHub, and landing reads it back with `gh pr view --json body`.\n *\n * THE BYTES THAT LAND ARE THE BYTES FINISH PRODUCED — that invariant is unchanged; what changed is that\n * GitHub, not this machine, is the thing holding them. That removes the whole machine-global receipt\n * store: a cache of a fact the remote already owns, which could only ever be missing, stale, or on the\n * wrong computer. Landing from a second clone, a fresh clone, or another machine entirely now just\n * works. See `decisions/0005-the-pr-description-is-the-merge-body.md`.\n *\n * It still deliberately does NOT re-render the body: re-deriving it at land time would be a second\n * authoritative gate whose result nobody reads, and it could silently disagree with what was reviewed.\n *\n * ─── Two scopes, and only one of them is the tree's ────────────────────────────────────────────────\n * 1. THE MERGE, which belongs to the PR — and is therefore reachable from anywhere.\n * 2. THE BOOKKEEPING — archiving the pre-squash tip as `archive/<date>/<branch>`, promoting merge-info,\n * and reaping the landed worktree. That half belongs to the tree whose `<branch>` really is the\n * commit being squashed, and it must NOT be attempted from anywhere else: another clone's\n * `<branch>` is a different commit, so archiving it there would tag the wrong objects under the\n * right name.\n *\n * ─── WHICH tree that is, is a FACT — it is not \"the one I am standing in\" ──────────────────────────\n * That distinction used to be resolved from `process.cwd()`, and it was wrong twice over.\n *\n * It was wrong MECHANICALLY: `pnpm` hoists a bin's cwd to the workspace root, and a Claude Code agent\n * worktree lives at `<primary>/.claude/worktrees/agent-<id>` — INSIDE the primary clone — so pnpm walked\n * straight past it and `git branch --show-current` answered `main`. Landing a worktree PR, i.e. every\n * `/full-cycle` run, reported \"No open PR found for this branch\" for a PR that was open, and the #512\n * worktree reap was unreachable dead code. The invocation directory is now read from `INIT_CWD` (pnpm\n * exports the directory the human actually typed in) and given to BOTH the repo-root resolution and the\n * `git` call, so neither can be answered by the hoisted directory.\n *\n * And it was wrong in PRINCIPLE, which is the larger half: most of the time the `/full-cycle` subagent\n * lands its own PR, but many times it does not — CI was still running when it finished, it errored, or a\n * coordinator picks the work up an hour later, by which point that agent is gone and its worktree is a\n * directory nobody is standing in. So `--pr <n>` names the PR, and {@link LandedTreeResolver} finds its\n * tree by the pair `(headRefName, headRefOid)` — never by branch name alone. The reap target is the\n * worktree whose HEAD is the exact commit GitHub squashed, whichever directory the operator is in, and\n * when nothing local holds that commit the merge still happens and the bookkeeping is SKIPPED OUT LOUD.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class LandPrCommand {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly branchNaming: BranchNaming,\n private readonly prMerger: PrMerger,\n private readonly archiver: BranchArchiver,\n private readonly mergeInfoIndex: MergeInfoIndex,\n private readonly landedWorktree: LandedWorktreeReaper,\n private readonly bodyFile: MergeBodyTempFile,\n private readonly landedTree: LandedTreeResolver,\n private readonly git: GitProcessApi,\n private readonly processes: NativeProcessApi,\n ) {}\n\n /**\n * THE INVOCATION DIRECTORY, which is not `process.cwd()`.\n *\n * `pnpm` runs a workspace bin with its cwd hoisted to the workspace root and exports the directory\n * the operator was actually in as `INIT_CWD`. Every agent worktree is NESTED inside the primary\n * clone, so the hoist silently relocated this command into a different tree holding a different\n * branch — see the class doc. `process.cwd()` remains the answer when nothing set `INIT_CWD` (a\n * direct `node` invocation, or a spec), which is the case where the two are the same anyway.\n */\n private invocationCwd(): string {\n const init = process.env['INIT_CWD'] ?? '';\n return init !== '' ? init : process.cwd();\n }\n\n async run(request: LandPrRequest): Promise<void> {\n if (request.prFlagPresent && !/^\\d+$/.test(request.prNumber)) throw this.badPrNumber(request);\n const cwd = this.invocationCwd();\n const repoRoot = this.repoRootFinder.resolveRepoRoot(cwd);\n // `--pr <n>` selects the PR outright; with no flag it is this branch's, read from the tree the\n // operator is really standing in.\n const selector = request.prNumber !== ''\n ? request.prNumber\n : this.branchNaming.baseBranchName(await this.currentBranch(cwd));\n\n const ref = await this.readPr(selector);\n if (ref === null) throw this.noSuchPr(request, selector);\n // The PR's OWN head branch, never the selector: with `--pr <n>` the operator named a number and\n // has said nothing about branches, and even in the zero-arg case GitHub is the authority on which\n // branch that PR is merging.\n const base = ref.headRefName !== '' ? ref.headRefName : selector;\n if (ref.body === '') throw this.emptyDescription(ref);\n const unfit = this.notFitForGitLog(ref.body);\n if (unfit !== '') throw this.descriptionUnfitForGitLog(ref, unfit);\n\n process.stdout.write('\\n' + SEP + `🚀 Landing PR #${ref.number}\\n` + SEP + '\\n');\n const mergeBodyFile = this.bodyFile.write(ref.body);\n\n const config = loadAndValidate(repoRoot).prGate;\n const policy = config.mergeMode;\n // Reuse the SAME merge logic wp-finish-upsert-pr uses, so a PR lands identically whichever\n // command lands it — including the auto-merge fallback when the checks are still running.\n //\n // `commanded: true` — running THIS command IS the intent to merge, so it is not gated on\n // pr-gate.mergeMode (a NONE repo runs this precisely to land one PR by hand). The real `policy`\n // travels alongside it rather than being replaced by a literal AUTO, so PrMerger's diagnostics\n // never assert a config value nobody set — that is exactly what used to print a CONFIG MISMATCH\n // about `mergeMode: AUTO` two lines above this command printing `mergeMode is NONE`.\n const outcome = await this.prMerger.merge(\n base, `${ref.title} (#${ref.number})`, mergeBodyFile, new MergeIntent(policy ?? '', true),\n );\n\n const bookkeeping = outcome.merged\n ? await this.bookkeeping(repoRoot, base, ref, config.landPr.branchRetention, cwd)\n : '';\n process.stdout.write(\n '\\n' + SEP + (outcome.merged ? '✅ Landed\\n' : 'ℹ️ Not landed yet\\n') + SEP + '\\n' +\n ` ${outcome.message}\\n` +\n bookkeeping +\n (policy === MERGE_MODE_AUTO\n ? ''\n : ` (pr-gate.mergeMode is ${policy} — wp-finish-upsert-pr publishes PRs without attempting a merge.)\\n`) +\n '\\n',\n );\n }\n\n /**\n * `--pr` without a usable number. It REFUSES rather than falling back to the branch, because the\n * fallback would land a different PR from the one the operator was reaching for, and a squash into\n * main is not a place to guess. `--pr` bare and `--pr HEAD` land here alike.\n */\n private badPrNumber(request: LandPrRequest): InformAiError {\n const got = request.prNumber === '' ? 'nothing' : `\"${request.prNumber}\"`;\n return new InformAiError(\n '\\n' + SEP + '❌ --pr needs a PR NUMBER\\n' + SEP + '\\n' +\n `\\`--pr\\` was given ${got}. It takes the digits of one pull request:\\n` +\n ' pnpm wp-land-pr --pr 1087\\n\\n' +\n 'To land the PR of the branch you are standing on, pass no flag at all:\\n' +\n ' pnpm wp-land-pr\\n' + SEP);\n }\n\n /**\n * The refusal when `gh` has no open PR for what we asked about — and it must say WHICH question was\n * asked, because the two have different cures.\n *\n * The branch form used to be the only one, and it was the face of the cwd bug: run from an agent\n * worktree, pnpm's hoist made the branch read `main`, and an operator with an open PR in front of\n * them was told there was none. So the branch form now says what it looked up and where it read that\n * branch FROM, which is the one fact that makes a wrong answer recognisable as a wrong answer, and it\n * names the `--pr <n>` form that does not depend on the tree at all.\n */\n private noSuchPr(request: LandPrRequest, selector: string): InformAiError {\n if (request.prNumber !== '') {\n return new InformAiError(\n '\\n' + SEP + `❌ No open PR #${request.prNumber}\\n` + SEP + '\\n' +\n `\\`gh pr view ${request.prNumber}\\` found no OPEN pull request with that number.\\n` +\n 'If it is already merged, run `pnpm wp-cleanup` from the primary clone to finish the\\n' +\n 'branch and worktree bookkeeping. Otherwise check the number with `gh pr list`.\\n' + SEP);\n }\n return new InformAiError(\n '\\n' + SEP + '❌ No open PR found for this branch\\n' + SEP + '\\n' +\n `No open PR has head branch \"${selector}\", read from ${this.invocationCwd()}. Nothing to land.\\n` +\n 'If that is not the branch you expected, land it by number instead — it does not depend on\\n' +\n 'which directory you are standing in:\\n' +\n ' pnpm wp-land-pr --pr <n>\\n' +\n 'If the PR is already merged, run `pnpm wp-cleanup`.\\n' +\n 'If it was never posted, run the gated flow — it posts the PR AND writes the description\\n' +\n 'that becomes this commit body:\\n' +\n ' pnpm wp-start-upsert-pr && pnpm wp-review-upsert-pr && pnpm wp-finish-upsert-pr\\n' + SEP);\n }\n\n /**\n * The refusal when the PR exists but its description is empty.\n *\n * This is the ONE remaining \"no gated body\" case, and it is now a property of the PR rather than of\n * this machine — which is why the cure is a single command with no human judgement call attached.\n * There is deliberately no `--fallback-title-only` escape any more: that flag existed because the\n * bytes could be on a DIFFERENT COMPUTER from the one landing, which cannot happen when GitHub holds\n * them. Re-running finish is always available, always correct, and lands the reviewed bytes.\n */\n private emptyDescription(ref: PrIdentity): InformAiError {\n return new InformAiError(\n '\\n' + SEP + `❌ PR #${ref.number} has an EMPTY description\\n` + SEP + '\\n' +\n 'The PR description IS the squash-commit body — `pnpm wp-finish-upsert-pr` renders one string\\n' +\n 'and publishes it as the description, and landing reads it straight back with\\n' +\n '`gh pr view --json body`. An empty description means the gated flow never published one\\n' +\n '(or a human cleared it), so there is nothing reviewed to land.\\n\\n' +\n 'Re-run the gated flow — it re-renders the description and re-posts it to this same PR:\\n' +\n ' pnpm wp-start-upsert-pr # update from main (3-point merge). No push, no build gate.\\n' +\n ' pnpm wp-review-upsert-pr # validate the merge, build gate, extract the diff, brief reviewers\\n' +\n ' # write summary.json at the path wp-review-upsert-pr prints\\n' +\n ' pnpm wp-finish-upsert-pr # build gate, dashboard, create/update the PR\\n' +\n 'Then re-run `pnpm wp-land-pr`.\\n' + SEP,\n );\n }\n\n /**\n * '' when the description is a compact gated body; otherwise the marker that proves it is not.\n *\n * This reads the SAME invariant `pr-body-is-merge-body.spec.ts` asserts from the other end: the\n * compact body \"contains nothing a plain-text git log cannot carry\" — no markdown heading, no table\n * pipe. It is therefore not a heuristic about what a dashboard looks like; it is the renderer's own\n * pinned property, checked against bytes that arrived from outside this process.\n *\n * WHY IT IS NEEDED, and why it is not a compatibility fallback: a PR posted by a release OLDER than\n * the surface swap still has the FULL DASHBOARD as its description. Measured on this repo,\n * 2026-08-07 — PR #613 (posted after the swap) has a description byte-identical to its squash body,\n * while PR #614 (still open, posted minutes before) begins `## 🚦 PR Gate Dashboard`. Landing that\n * one would dump a risk table into main, which is precisely the defect\n * `decisions/0004` § 4.1 warned about. So this REFUSES and names the one command that fixes it. It\n * never falls back, never rewrites, and never reaches for a second source of bytes.\n *\n * It keeps earning its place after the transition: nothing stops a human editing a PR description\n * in GitHub's textarea, and this is the only point between that edit and main's history.\n *\n * What it must NOT be read as is proof that the bytes did not come from `renderPrBody`. They can:\n * the compact body interpolates author text, and a `|` reaches that text from a TypeScript union, a\n * regex alternation or a quoted shell pipeline. `Dashboard.gitLogSafe` substitutes both markers at\n * the render exit so a freshly-rendered body no longer trips this — which is where that invariant\n * belongs, since the renderer is the only thing that can fix it without an extra CI cycle.\n */\n private notFitForGitLog(body: string): string {\n if (body.includes('##')) return '## (a markdown heading)';\n if (body.includes('|')) return '| (a markdown table)';\n return '';\n }\n\n /**\n * The refusal when the description is not the compact gated body.\n *\n * It names BOTH ways bytes get here, because naming only one sent readers down a path that did not\n * exist. It used to assert an old release as \"the usual cause\" and prescribe re-running finish — and\n * when the marker had come from AUTHOR TEXT instead (a `|` in a summary, from a TypeScript union or a\n * regex alternation), finish re-rendered the identical character from the unchanged `summary.json` and\n * landing refused again: a loop costing a CI cycle per turn, escapable only by guessing that one\n * character in your prose was the problem. `Dashboard.gitLogSafe` now substitutes both markers at the\n * render exit, so a freshly-rendered body cannot reach here at all — which leaves a HAND-EDITED\n * description and a genuinely old PR as the two remaining causes, and this says so.\n */\n private descriptionUnfitForGitLog(ref: PrIdentity, marker: string): InformAiError {\n return new InformAiError(\n '\\n' + SEP + `❌ PR #${ref.number}'s description is not a git-log commit body\\n` + SEP + '\\n' +\n `It contains ${marker}, which the compact body rendered by \\`pnpm wp-finish-upsert-pr\\` never\\n` +\n 'does — it substitutes both markers as it renders — so these bytes are not the gated summary,\\n' +\n 'and landing them would put a PR Gate Dashboard (or hand-written markdown) into main\\'s\\n' +\n 'history permanently.\\n\\n' +\n 'There are two causes, and they need different fixes:\\n\\n' +\n ' 1. The description was EDITED BY HAND on GitHub after finish posted it. Re-running finish\\n' +\n ' overwrites that edit with the compact body, so landing works.\\n' +\n ' 2. The PR was posted by a webpieces release OLDER than the one that made the description\\n' +\n ' the commit body, so it is still the full dashboard. The dashboard now lives in the PR\\'s\\n' +\n ' 1st comment instead, and re-running finish moves it there.\\n\\n' +\n `Either way the cure is the same, and it does NOT require removing ${marker.trim()} from your PR\\n` +\n 'summary text — a pipe or a heading in a summary is rendered safe, not rejected:\\n' +\n ' pnpm wp-start-upsert-pr && pnpm wp-review-upsert-pr && pnpm wp-finish-upsert-pr\\n' + SEP,\n );\n }\n\n /**\n * The landed branch's post-merge bookkeeping — but ONLY when this tree's `<branch>` IS the commit\n * that was squashed.\n *\n * The fact being tested is \"does this working tree hold the objects the PR merged\", and the PR\n * answers it authoritatively: `headRefOid` is the tip GitHub squashed. A second clone's `<branch>`\n * is a different commit, so `archive/<date>/<branch>` there would tag the wrong tip under the right\n * name; `merge-info/staged/<feature>` lives in the posting tree's state, not ours; and the worktree\n * to reap is not this one. So the merge stands and the bookkeeping is declined ALOUD.\n *\n * This used to be read out of an `origin.json` sidecar recording which tree posted the PR. Comparing\n * SHAs is strictly better: it is a fact rather than a recorded claim, it needs no stored state, and\n * it is more precise in both directions — a second clone sitting on the SAME commit can safely\n * archive it, and a tree that has committed further work since finish ran correctly declines.\n */\n private async bookkeeping(\n repoRoot: string, base: string, ref: PrIdentity, retention: string, cwd: string,\n ): Promise<string> {\n const tree = await this.landedTree.resolve(repoRoot, base, ref.headRefOid);\n if (!tree.bookkeepingAllowed) return this.notTheLandedTipNotice(base, tree, ref);\n return await this.archiveAndPromote(repoRoot, base, ref, retention)\n + await this.nextStep(repoRoot, tree, cwd);\n }\n\n /**\n * What was skipped, why, and what the two SHAs are — so the reader can tell WHICH cause it was.\n *\n * Two causes, one message, because the cure is the same for both: the objects the PR squashed are not\n * in this repo under that name, so nothing here may archive them or reap a tree for them.\n */\n private notTheLandedTipNotice(base: string, tree: LandedTree, ref: PrIdentity): string {\n const found = tree.kind === LANDED_TREE_ABSENT\n ? ` ${base} is not in this repo at all\\n`\n : ` ${base} here → ${tree.localSha}\\n`;\n return '\\n ⚠️ Archive + worktree cleanup SKIPPED — nothing here holds the commit that landed:\\n' +\n found +\n ` PR #${ref.number} squashed → ${ref.headRefOid}\\n` +\n ' Archiving from here would tag the wrong objects under the right name, and the\\n' +\n ` merge-info record and (if any) the worktree holding ${base} live with the other tip.\\n` +\n ' Either this is a second clone of the repo — finish the bookkeeping in the clone that\\n' +\n ' posted the PR with `pnpm wp-cleanup` — or that tree has commits made after\\n' +\n ' `pnpm wp-finish-upsert-pr` ran, which the PR does not contain.\\n';\n }\n\n /**\n * What happens next — which is NOT the same act when you landed from a worktree.\n *\n * Landing from a linked worktree always used to leave a corpse: the merged branch is checked out\n * here, so `git branch -D` refuses, `wp-cleanup`'s branch pass spares it as in-use, and nothing\n * removed the worktree — so the pair sat there until branch-creation-guard hit its cap. #512 made\n * worktrees reapable and printed `cd <primary> && pnpm wp-cleanup`; that instruction was correct\n * and it was the most-skipped step in the flow, because the PR is already landed and the work\n * feels done.\n *\n * So the reap is no longer an instruction. This command still refuses to remove the directory it\n * is standing in — that rail is untouched — and instead HANDS THE REAP to a child process rooted\n * in the primary clone, which is a tree nobody is deleting. See LandedWorktreeReaper. When that\n * hand-off is not safely achievable the #512 notice is printed unchanged, because an honest\n * limitation beats a command that deletes its own working directory mid-run.\n */\n private async nextStep(repoRoot: string, tree: LandedTree, cwd: string): Promise<string> {\n const handoff: WorktreeReapHandoff | null\n = this.landedWorktree.plan(repoRoot, tree.worktree, cwd);\n if (handoff === null) return ' Next: `pnpm wp-cleanup` to delete the merged branch.\\n';\n if (!handoff.canReap) return this.landedWorktree.manualNotice(handoff);\n return this.landedWorktree.handOff(handoff);\n }\n\n /**\n * The landed branch's post-merge bookkeeping, in one place:\n * 1. ARCHIVE the pre-squash tip as `archive/<date>/<branch>` — the tag makes the original history\n * permanently restorable (`git checkout -b <branch> <tag>` gives back the exact objects) while\n * costing one ref, so the branch itself no longer has to survive as a `*PreMerge` husk that\n * counts toward the branch cap. See BranchArchiver for why a tag beats a patch or the reflog.\n * 2. PROMOTE `merge-info/staged/<feature>/` to `merge-info/merged/<feature>/` and rebuild\n * `index.json`, so `staged/` holds only branches that are still in flight.\n *\n * Never throws: the PR is already merged by the time we get here, and failing the command after a\n * successful merge would report a landed PR as a failure. Problems are reported in the recap.\n */\n private async archiveAndPromote(repoRoot: string, base: string, ref: PrIdentity, retention: string): Promise<string> {\n if (retention === BRANCH_RETENTION_KEEP) return ' Branch retention is \"keep\" — nothing archived.\\n';\n\n let line = '';\n let tag = '';\n if (retention === BRANCH_RETENTION_ARCHIVE_TAG) {\n const archive = this.archiver.archive(repoRoot, base);\n tag = archive.tag;\n line = archive.ok\n ? ` Archived ${base} → ${archive.tag} (restore: ${this.archiver.restoreCommand(base, archive.tag)})\\n`\n : ` ⚠️ Could not archive ${base}: ${archive.error} — the branch was left alone.\\n`;\n }\n\n const feature = await this.aiBranchName.getFeatureName();\n const record = new ArchiveRecord(\n tag, await this.revParse(repoRoot, base), await this.revParse(repoRoot, 'origin/main'),\n Number(ref.number), new Date().toISOString(),\n );\n if (this.mergeInfoIndex.promoteToMerged(repoRoot, feature, record)) {\n line += ` merge-info: staged/${feature} → merged/${feature} (index.json rebuilt)\\n`;\n }\n return line;\n }\n\n // Best-effort sha of a ref — '' when it cannot resolve. Recorded in archive.json for provenance.\n private async revParse(repoRoot: string, ref: string): Promise<string> {\n const result = await this.git.run(['rev-parse', ref], repoRoot);\n return result.ok ? result.stdout.trim() : '';\n }\n\n // `git branch --show-current` in the invocation directory. Must succeed: a branch we cannot read is\n // not a selector to guess at.\n private async currentBranch(cwd: string): Promise<string> {\n const result = await this.git.run(['branch', '--show-current'], cwd);\n if (!result.ok) {\n throw new InformAiError(`Could not read the current branch in ${cwd} (git branch --show-current): ${result.stderr.trim()}`);\n }\n return result.stdout.trim();\n }\n\n /**\n * Everything landing needs about the PR, in ONE `gh` read: number, title, URL, DESCRIPTION and the\n * head sha GitHub is squashing. `null` when there is no open PR for this head branch.\n *\n * The TITLE comes from the PR itself, not summary.json, so the squash subject matches what a reviewer\n * approved even if summary.json was edited afterwards. The BODY is the gated commit body (see the\n * class doc). `headRefOid` is read BEFORE the merge, because it is what the bookkeeping check\n * compares against and the merge is what makes the branch's fate uninteresting to GitHub.\n */\n private async readPr(selector: string): Promise<PrIdentity | null> {\n const result = await this.processes.run(\n 'gh', ['pr', 'view', selector, '--json', 'number,title,url,body,headRefOid,headRefName'],\n );\n if (!result.ok) return null;\n return this.parsePr(result.stdout);\n }\n\n // `gh --json` output → PrIdentity. Malformed/absent JSON reads as \"no PR\", which the caller turns\n // into the same refusal a missing PR gets: both mean nothing here can be landed.\n private parsePr(stdout: string): PrIdentity | null {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: unparseable gh output means \"no PR\", never a crash\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- gh's JSON is opaque until narrowed field-by-field below\n const raw = JSON.parse(stdout) as Record<string, unknown>;\n const number = typeof raw['number'] === 'number' ? String(raw['number']) : this.str(raw['number']);\n if (number === '') return null;\n // GitHub stores descriptions with CRLF. A commit body must not carry them, and the bytes are\n // otherwise identical to what finish rendered, so the line endings are normalized back here.\n const body = this.str(raw['body']).replace(/\\r\\n/g, '\\n').trim();\n return new PrIdentity(\n number, this.str(raw['title']), this.str(raw['url']), body === '' ? '' : body + '\\n',\n this.str(raw['headRefOid']), this.str(raw['headRefName']),\n );\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n return null;\n }\n }\n\n // webpieces-disable no-any-unknown -- one opaque JSON field, narrowed to string\n private str(value: unknown): string {\n return typeof value === 'string' ? value : '';\n }\n}\n\n// The open PR as GitHub holds it: its number, title, web URL, DESCRIPTION (= the gated commit body) and\n// the PAIR that identifies its tree locally — the head branch's name and the commit being squashed.\nclass PrIdentity {\n number: string;\n title: string;\n url: string;\n body: string;\n headRefOid: string;\n /**\n * The PR's head BRANCH. Required alongside `headRefOid` because neither half identifies a tree on its\n * own: the name is what a worktree list can be searched by, the sha is what makes a hit the right\n * one. It also frees `--pr <n>` from needing the operator to be standing anywhere in particular.\n */\n headRefName: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n number: string, title: string, url: string, body: string, headRefOid: string, headRefName: string,\n ) {\n this.number = number;\n this.title = title;\n this.url = url;\n this.body = body;\n this.headRefOid = headRefOid;\n this.headRefName = headRefName;\n }\n}\n\n/**\n * Data-only (per CLAUDE.md, classes for data): what the operator asked `wp-land-pr` to land.\n *\n * `prNumber` is '' for the zero-arg form — \"this branch's PR\" — which stays the shorthand the worker\n * uses. It is NOT an optional constructor parameter with a default at the call site: `wp-land-pr.ts`\n * builds exactly one of these from the parsed argv, so there is one spelling of the decision.\n */\nexport class LandPrRequest {\n /**\n * Was `--pr` on the command line at all? Kept SEPARATE from the value because `--pr` with no number\n * is a mistake, not a request to guess: collapsing the two would silently land whatever PR the\n * current directory's branch happens to have, which is the opposite of what the operator typed.\n */\n prFlagPresent: boolean;\n /** The `--pr <n>` value verbatim, or '' to infer the PR from the invocation directory's branch. */\n prNumber: string;\n\n constructor(prFlagPresent: boolean, prNumber: string) {\n this.prFlagPresent = prFlagPresent;\n this.prNumber = prNumber;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"land-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/land-pr-command.ts"],"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;;;;OAIG;IACH,WAAW,CAAS;IAEpB,yDAAyD;IACzD,YACI,MAAc,EAAE,KAAa,EAAE,GAAW,EAAE,IAAY,EAAE,UAAkB,EAAE,WAAmB;QAEjG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACnC,CAAC;CACJ;AAED;;;;;;GAMG;AACH,MAAa,aAAa;IACtB;;;;OAIG;IACH,aAAa,CAAU;IACvB,mGAAmG;IACnG,QAAQ,CAAS;IAEjB,YAAY,aAAsB,EAAE,QAAgB;QAChD,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC7B,CAAC;CACJ;AAdD,sCAcC","sourcesContent":["import { GitProcessApi, InformAiError, NativeProcessApi } from '@webpieces/tooling-common';\nimport { toError } from '@webpieces/tooling-common/to-error';\nimport { RepoRootFinder, MERGE_MODE_AUTO, loadAndValidate } from '@webpieces/rules-config';\nimport { BranchArchiver, BRANCH_RETENTION_ARCHIVE_TAG, BRANCH_RETENTION_KEEP } from '@webpieces/repo-workflow-core';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { BranchNaming } from '../workflow/branch-naming';\nimport { LandedTree, LandedTreeResolver, LANDED_TREE_ABSENT } from '../workflow/landed-tree-resolver';\nimport { LandedWorktreeReaper, WorktreeReapHandoff } from '../workflow/landed-worktree-reaper';\nimport { MergeBodyTempFile } from '../workflow/merge-body-temp-file';\nimport { ArchiveRecord, MergeInfoIndex } from '../workflow/merge-info-index';\nimport { MergeIntent, PrMerger } from '../workflow/pr-merger';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * `wp-land-pr`: squash-merge THIS branch's already-posted PR into main with the compact commit body.\n *\n * It exists because a merge clicked in the GitHub UI cannot set the squash SUBJECT to `<title> (#N)`\n * and cannot archive the pre-squash tip. So when a merge has to happen outside `wp-finish-upsert-pr`\n * (a mergeMode=NONE repo, or a PR whose checks were still running when finish ran), this is the command\n * that keeps main's history consistent and finishes the branch's bookkeeping.\n *\n * ─── Where the bytes come from: THE PR ITSELF ──────────────────────────────────────────────────────\n * `wp-finish-upsert-pr` renders ONE string and publishes it as the PR DESCRIPTION, and the full\n * dashboard lives in the PR's comments (see `pr-body-is-merge-body.spec.ts`, which pins that the\n * description and the merge body are one renderer's output). So the description IS the gated squash\n * body, held by GitHub, and landing reads it back with `gh pr view --json body`.\n *\n * THE BYTES THAT LAND ARE THE BYTES FINISH PRODUCED — that invariant is unchanged; what changed is that\n * GitHub, not this machine, is the thing holding them. That removes the whole machine-global receipt\n * store: a cache of a fact the remote already owns, which could only ever be missing, stale, or on the\n * wrong computer. Landing from a second clone, a fresh clone, or another machine entirely now just\n * works. See `decisions/0005-the-pr-description-is-the-merge-body.md`.\n *\n * It still deliberately does NOT re-render the body: re-deriving it at land time would be a second\n * authoritative gate whose result nobody reads, and it could silently disagree with what was reviewed.\n *\n * ─── Two scopes, and only one of them is the tree's ────────────────────────────────────────────────\n * 1. THE MERGE, which belongs to the PR — and is therefore reachable from anywhere.\n * 2. THE BOOKKEEPING — archiving the pre-squash tip as `archive/<date>/<branch>`, promoting merge-info,\n * and reaping the landed worktree. That half belongs to the tree whose `<branch>` really is the\n * commit being squashed, and it must NOT be attempted from anywhere else: another clone's\n * `<branch>` is a different commit, so archiving it there would tag the wrong objects under the\n * right name.\n *\n * ─── WHICH tree that is, is a FACT — it is not \"the one I am standing in\" ──────────────────────────\n * That distinction used to be resolved from `process.cwd()`, and it was wrong twice over.\n *\n * It was wrong MECHANICALLY: `pnpm` hoists a bin's cwd to the workspace root, and a Claude Code agent\n * worktree lives at `<primary>/.claude/worktrees/agent-<id>` — INSIDE the primary clone — so pnpm walked\n * straight past it and `git branch --show-current` answered `main`. Landing a worktree PR, i.e. every\n * `/full-cycle` run, reported \"No open PR found for this branch\" for a PR that was open, and the #512\n * worktree reap was unreachable dead code. The invocation directory is now read from `INIT_CWD` (pnpm\n * exports the directory the human actually typed in) and given to BOTH the repo-root resolution and the\n * `git` call, so neither can be answered by the hoisted directory.\n *\n * And it was wrong in PRINCIPLE, which is the larger half: most of the time the `/full-cycle` subagent\n * lands its own PR, but many times it does not — CI was still running when it finished, it errored, or a\n * coordinator picks the work up an hour later, by which point that agent is gone and its worktree is a\n * directory nobody is standing in. So `--pr <n>` names the PR, and {@link LandedTreeResolver} finds its\n * tree by the pair `(headRefName, headRefOid)` — never by branch name alone. The reap target is the\n * worktree whose HEAD is the exact commit GitHub squashed, whichever directory the operator is in, and\n * when nothing local holds that commit the merge still happens and the bookkeeping is SKIPPED OUT LOUD.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class LandPrCommand {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly branchNaming: BranchNaming,\n private readonly prMerger: PrMerger,\n private readonly archiver: BranchArchiver,\n private readonly mergeInfoIndex: MergeInfoIndex,\n private readonly landedWorktree: LandedWorktreeReaper,\n private readonly bodyFile: MergeBodyTempFile,\n private readonly landedTree: LandedTreeResolver,\n private readonly git: GitProcessApi,\n private readonly processes: NativeProcessApi,\n ) {}\n\n /**\n * THE INVOCATION DIRECTORY, which is not `process.cwd()`.\n *\n * `pnpm` runs a workspace bin with its cwd hoisted to the workspace root and exports the directory\n * the operator was actually in as `INIT_CWD`. Every agent worktree is NESTED inside the primary\n * clone, so the hoist silently relocated this command into a different tree holding a different\n * branch — see the class doc. `process.cwd()` remains the answer when nothing set `INIT_CWD` (a\n * direct `node` invocation, or a spec), which is the case where the two are the same anyway.\n */\n private invocationCwd(): string {\n const init = process.env['INIT_CWD'] ?? '';\n return init !== '' ? init : process.cwd();\n }\n\n async run(request: LandPrRequest): Promise<void> {\n if (request.prFlagPresent && !/^\\d+$/.test(request.prNumber)) throw this.badPrNumber(request);\n const cwd = this.invocationCwd();\n const repoRoot = this.repoRootFinder.resolveRepoRoot(cwd);\n // `--pr <n>` selects the PR outright; with no flag it is this branch's, read from the tree the\n // operator is really standing in.\n const selector = request.prNumber !== ''\n ? request.prNumber\n : this.branchNaming.baseBranchName(await this.currentBranch(cwd));\n\n const ref = await this.readPr(selector);\n if (ref === null) throw this.noSuchPr(request, selector);\n // The PR's OWN head branch, never the selector: with `--pr <n>` the operator named a number and\n // has said nothing about branches, and even in the zero-arg case GitHub is the authority on which\n // branch that PR is merging.\n const base = ref.headRefName !== '' ? ref.headRefName : selector;\n if (ref.body === '') throw this.emptyDescription(ref);\n const unfit = this.notFitForGitLog(ref.body);\n if (unfit !== '') throw this.descriptionUnfitForGitLog(ref, unfit);\n\n process.stdout.write('\\n' + SEP + `🚀 Landing PR #${ref.number}\\n` + SEP + '\\n');\n const mergeBodyFile = this.bodyFile.write(ref.body);\n\n const config = loadAndValidate(repoRoot).prGate;\n const policy = config.mergeMode;\n // Reuse the SAME merge logic wp-finish-upsert-pr uses, so a PR lands identically whichever\n // command lands it — including the auto-merge fallback when the checks are still running.\n //\n // `commanded: true` — running THIS command IS the intent to merge, so it is not gated on\n // pr-gate.mergeMode (a NONE repo runs this precisely to land one PR by hand). The real `policy`\n // travels alongside it rather than being replaced by a literal AUTO, so PrMerger's diagnostics\n // never assert a config value nobody set — that is exactly what used to print a CONFIG MISMATCH\n // about `mergeMode: AUTO` two lines above this command printing `mergeMode is NONE`.\n const outcome = await this.prMerger.merge(\n base, `${ref.title} (#${ref.number})`, mergeBodyFile, new MergeIntent(policy ?? '', true),\n );\n\n const bookkeeping = outcome.merged\n ? await this.bookkeeping(repoRoot, base, ref, config.landPr.branchRetention, cwd)\n : '';\n process.stdout.write(\n '\\n' + SEP + (outcome.merged ? '✅ Landed\\n' : 'ℹ️ Not landed yet\\n') + SEP + '\\n' +\n ` ${outcome.message}\\n` +\n bookkeeping +\n (policy === MERGE_MODE_AUTO\n ? ''\n : ` (pr-gate.mergeMode is ${policy} — wp-finish-upsert-pr publishes PRs without attempting a merge.)\\n`) +\n '\\n',\n );\n }\n\n /**\n * `--pr` without a usable number. It REFUSES rather than falling back to the branch, because the\n * fallback would land a different PR from the one the operator was reaching for, and a squash into\n * main is not a place to guess. `--pr` bare and `--pr HEAD` land here alike.\n */\n private badPrNumber(request: LandPrRequest): InformAiError {\n const got = request.prNumber === '' ? 'nothing' : `\"${request.prNumber}\"`;\n return new InformAiError(\n '\\n' + SEP + '❌ --pr needs a PR NUMBER\\n' + SEP + '\\n' +\n `\\`--pr\\` was given ${got}. It takes the digits of one pull request:\\n` +\n ' pnpm wp-land-pr --pr 1087\\n\\n' +\n 'To land the PR of the branch you are standing on, pass no flag at all:\\n' +\n ' pnpm wp-land-pr\\n' + SEP);\n }\n\n /**\n * The refusal when `gh` has no open PR for what we asked about — and it must say WHICH question was\n * asked, because the two have different cures.\n *\n * The branch form used to be the only one, and it was the face of the cwd bug: run from an agent\n * worktree, pnpm's hoist made the branch read `main`, and an operator with an open PR in front of\n * them was told there was none. So the branch form now says what it looked up and where it read that\n * branch FROM, which is the one fact that makes a wrong answer recognisable as a wrong answer, and it\n * names the `--pr <n>` form that does not depend on the tree at all.\n */\n private noSuchPr(request: LandPrRequest, selector: string): InformAiError {\n if (request.prNumber !== '') {\n return new InformAiError(\n '\\n' + SEP + `❌ No open PR #${request.prNumber}\\n` + SEP + '\\n' +\n `\\`gh pr view ${request.prNumber}\\` found no OPEN pull request with that number.\\n` +\n 'If it is already merged, run `pnpm wp-cleanup` from the primary clone to finish the\\n' +\n 'branch and worktree bookkeeping. Otherwise check the number with `gh pr list`.\\n' + SEP);\n }\n return new InformAiError(\n '\\n' + SEP + '❌ No open PR found for this branch\\n' + SEP + '\\n' +\n `No open PR has head branch \"${selector}\", read from ${this.invocationCwd()}. Nothing to land.\\n` +\n 'If that is not the branch you expected, land it by number instead — it does not depend on\\n' +\n 'which directory you are standing in:\\n' +\n ' pnpm wp-land-pr --pr <n>\\n' +\n 'If the PR is already merged, run `pnpm wp-cleanup`.\\n' +\n 'If it was never posted, run the gated flow — it posts the PR AND writes the description\\n' +\n 'that becomes this commit body:\\n' +\n ' pnpm wp-start-upsert-pr && pnpm wp-review-upsert-pr && pnpm wp-finish-upsert-pr\\n' + SEP);\n }\n\n /**\n * The refusal when the PR exists but its description is empty.\n *\n * This is the ONE remaining \"no gated body\" case, and it is now a property of the PR rather than of\n * this machine — which is why the cure is a single command with no human judgement call attached.\n * There is deliberately no `--fallback-title-only` escape any more: that flag existed because the\n * bytes could be on a DIFFERENT COMPUTER from the one landing, which cannot happen when GitHub holds\n * them. Re-running finish is always available, always correct, and lands the reviewed bytes.\n */\n private emptyDescription(ref: PrIdentity): InformAiError {\n return new InformAiError(\n '\\n' + SEP + `❌ PR #${ref.number} has an EMPTY description\\n` + SEP + '\\n' +\n 'The PR description IS the squash-commit body — `pnpm wp-finish-upsert-pr` renders one string\\n' +\n 'and publishes it as the description, and landing reads it straight back with\\n' +\n '`gh pr view --json body`. An empty description means the gated flow never published one\\n' +\n '(or a human cleared it), so there is nothing reviewed to land.\\n\\n' +\n 'Re-run the gated flow — it re-renders the description and re-posts it to this same PR:\\n' +\n ' pnpm wp-start-upsert-pr # update from main (3-point merge). No push, no build gate.\\n' +\n ' pnpm wp-review-upsert-pr # validate the merge, build gate, extract the diff, brief reviewers\\n' +\n ' # write summary.json at the path wp-review-upsert-pr prints\\n' +\n ' pnpm wp-finish-upsert-pr # build gate, dashboard, create/update the PR\\n' +\n 'Then re-run `pnpm wp-land-pr`.\\n' + SEP,\n );\n }\n\n /**\n * '' when the description is a compact gated body; otherwise the marker that proves it is not.\n *\n * This reads the SAME invariant `pr-body-is-merge-body.spec.ts` asserts from the other end: the\n * compact body \"contains nothing a plain-text git log cannot carry\" — no markdown heading, no table\n * pipe. It is therefore not a heuristic about what a dashboard looks like; it is the renderer's own\n * pinned property, checked against bytes that arrived from outside this process.\n *\n * WHY IT IS NEEDED, and why it is not a compatibility fallback: a PR posted by a release OLDER than\n * the surface swap still has the FULL DASHBOARD as its description. Measured on this repo,\n * 2026-08-07 — PR #613 (posted after the swap) has a description byte-identical to its squash body,\n * while PR #614 (still open, posted minutes before) begins `## 🚦 PR Gate Dashboard`. Landing that\n * one would dump a risk table into main, which is precisely the defect\n * `decisions/0004` § 4.1 warned about. So this REFUSES and names the one command that fixes it. It\n * never falls back, never rewrites, and never reaches for a second source of bytes.\n *\n * It keeps earning its place after the transition: nothing stops a human editing a PR description\n * in GitHub's textarea, and this is the only point between that edit and main's history.\n *\n * What it must NOT be read as is proof that the bytes did not come from `renderPrBody`. They can:\n * the compact body interpolates author text, and a `|` reaches that text from a TypeScript union, a\n * regex alternation or a quoted shell pipeline. `Dashboard.gitLogSafe` substitutes both markers at\n * the render exit so a freshly-rendered body no longer trips this — which is where that invariant\n * belongs, since the renderer is the only thing that can fix it without an extra CI cycle.\n */\n private notFitForGitLog(body: string): string {\n if (body.includes('##')) return '## (a markdown heading)';\n if (body.includes('|')) return '| (a markdown table)';\n return '';\n }\n\n /**\n * The refusal when the description is not the compact gated body.\n *\n * It names BOTH ways bytes get here, because naming only one sent readers down a path that did not\n * exist. It used to assert an old release as \"the usual cause\" and prescribe re-running finish — and\n * when the marker had come from AUTHOR TEXT instead (a `|` in a summary, from a TypeScript union or a\n * regex alternation), finish re-rendered the identical character from the unchanged `summary.json` and\n * landing refused again: a loop costing a CI cycle per turn, escapable only by guessing that one\n * character in your prose was the problem. `Dashboard.gitLogSafe` now substitutes both markers at the\n * render exit, so a freshly-rendered body cannot reach here at all — which leaves a HAND-EDITED\n * description and a genuinely old PR as the two remaining causes, and this says so.\n */\n private descriptionUnfitForGitLog(ref: PrIdentity, marker: string): InformAiError {\n return new InformAiError(\n '\\n' + SEP + `❌ PR #${ref.number}'s description is not a git-log commit body\\n` + SEP + '\\n' +\n `It contains ${marker}, which the compact body rendered by \\`pnpm wp-finish-upsert-pr\\` never\\n` +\n 'does — it substitutes both markers as it renders — so these bytes are not the gated summary,\\n' +\n 'and landing them would put a PR Gate Dashboard (or hand-written markdown) into main\\'s\\n' +\n 'history permanently.\\n\\n' +\n 'There are two causes, and they need different fixes:\\n\\n' +\n ' 1. The description was EDITED BY HAND on GitHub after finish posted it. Re-running finish\\n' +\n ' overwrites that edit with the compact body, so landing works.\\n' +\n ' 2. The PR was posted by a webpieces release OLDER than the one that made the description\\n' +\n ' the commit body, so it is still the full dashboard. The dashboard now lives in the PR\\'s\\n' +\n ' 1st comment instead, and re-running finish moves it there.\\n\\n' +\n `Either way the cure is the same, and it does NOT require removing ${marker.trim()} from your PR\\n` +\n 'summary text — a pipe or a heading in a summary is rendered safe, not rejected:\\n' +\n ' pnpm wp-start-upsert-pr && pnpm wp-review-upsert-pr && pnpm wp-finish-upsert-pr\\n' + SEP,\n );\n }\n\n /**\n * The landed branch's post-merge bookkeeping — but ONLY when this tree's `<branch>` IS the commit\n * that was squashed.\n *\n * The fact being tested is \"does this working tree hold the objects the PR merged\", and the PR\n * answers it authoritatively: `headRefOid` is the tip GitHub squashed. A second clone's `<branch>`\n * is a different commit, so `archive/<date>/<branch>` there would tag the wrong tip under the right\n * name; `merge-info/staged/<feature>` lives in the posting tree's state, not ours; and the worktree\n * to reap is not this one. So the merge stands and the bookkeeping is declined ALOUD.\n *\n * This used to be read out of an `origin.json` sidecar recording which tree posted the PR. Comparing\n * SHAs is strictly better: it is a fact rather than a recorded claim, it needs no stored state, and\n * it is more precise in both directions — a second clone sitting on the SAME commit can safely\n * archive it, and a tree that has committed further work since finish ran correctly declines.\n */\n private async bookkeeping(\n repoRoot: string, base: string, ref: PrIdentity, retention: string, cwd: string,\n ): Promise<string> {\n const tree = await this.landedTree.resolve(repoRoot, base, ref.headRefOid);\n if (!tree.bookkeepingAllowed) return this.notTheLandedTipNotice(base, tree, ref);\n return await this.archiveAndPromote(repoRoot, base, ref, retention)\n + await this.nextStep(repoRoot, tree, cwd);\n }\n\n /**\n * What was skipped, why, and what the two SHAs are — so the reader can tell WHICH cause it was.\n *\n * Two causes, one message, because the cure is the same for both: the objects the PR squashed are not\n * in this repo under that name, so nothing here may archive them or reap a tree for them.\n */\n private notTheLandedTipNotice(base: string, tree: LandedTree, ref: PrIdentity): string {\n const found = tree.kind === LANDED_TREE_ABSENT\n ? ` ${base} is not in this repo at all\\n`\n : ` ${base} here → ${tree.localSha}\\n`;\n return '\\n ⚠️ Archive + worktree cleanup SKIPPED — nothing here holds the commit that landed:\\n' +\n found +\n ` PR #${ref.number} squashed → ${ref.headRefOid}\\n` +\n ' Archiving from here would tag the wrong objects under the right name, and the\\n' +\n ` merge-info record and (if any) the worktree holding ${base} live with the other tip.\\n` +\n ' Either this is a second clone of the repo — finish the bookkeeping in the clone that\\n' +\n ' posted the PR with `pnpm wp-cleanup` — or that tree has commits made after\\n' +\n ' `pnpm wp-finish-upsert-pr` ran, which the PR does not contain.\\n';\n }\n\n /**\n * What happens next — which is NOT the same act when you landed from a worktree.\n *\n * Landing from a linked worktree always used to leave a corpse: the merged branch is checked out\n * here, so `git branch -D` refuses, `wp-cleanup`'s branch pass spares it as in-use, and nothing\n * removed the worktree — so the pair sat there until branch-creation-guard hit its cap. #512 made\n * worktrees reapable and printed `cd <primary> && pnpm wp-cleanup`; that instruction was correct\n * and it was the most-skipped step in the flow, because the PR is already landed and the work\n * feels done.\n *\n * So the reap is no longer an instruction. This command still refuses to remove the directory it\n * is standing in — that rail is untouched — and instead HANDS THE REAP to a child process rooted\n * in the primary clone, which is a tree nobody is deleting. See LandedWorktreeReaper. When that\n * hand-off is not safely achievable the #512 notice is printed unchanged, because an honest\n * limitation beats a command that deletes its own working directory mid-run.\n */\n private async nextStep(repoRoot: string, tree: LandedTree, cwd: string): Promise<string> {\n const handoff: WorktreeReapHandoff | null\n = this.landedWorktree.plan(repoRoot, tree.worktree, cwd);\n if (handoff === null) return ' Next: `pnpm wp-cleanup` to delete the merged branch.\\n';\n if (!handoff.canReap) return this.landedWorktree.manualNotice(handoff);\n return this.landedWorktree.handOff(handoff);\n }\n\n /**\n * The landed branch's post-merge bookkeeping, in one place:\n * 1. ARCHIVE the pre-squash tip as `archive/<date>/<branch>` — the tag makes the original history\n * permanently restorable (`git checkout -b <branch> <tag>` gives back the exact objects) while\n * costing one ref, so the branch itself no longer has to survive as a `*PreMerge` husk that\n * counts toward the branch cap. See BranchArchiver for why a tag beats a patch or the reflog.\n * 2. PROMOTE `merge-info/staged/<feature>/` to `merge-info/merged/<feature>/` and rebuild\n * `index.json`, so `staged/` holds only branches that are still in flight.\n *\n * Never throws: the PR is already merged by the time we get here, and failing the command after a\n * successful merge would report a landed PR as a failure. Problems are reported in the recap.\n */\n private async archiveAndPromote(repoRoot: string, base: string, ref: PrIdentity, retention: string): Promise<string> {\n if (retention === BRANCH_RETENTION_KEEP) return ' Branch retention is \"keep\" — nothing archived.\\n';\n\n let line = '';\n let tag = '';\n if (retention === BRANCH_RETENTION_ARCHIVE_TAG) {\n const archive = await this.archiver.archive(repoRoot, base);\n tag = archive.tag;\n line = archive.ok\n ? ` Archived ${base} → ${archive.tag} (restore: ${this.archiver.restoreCommand(base, archive.tag)})\\n`\n : ` ⚠️ Could not archive ${base}: ${archive.error} — the branch was left alone.\\n`;\n }\n\n const feature = await this.aiBranchName.getFeatureName();\n const record = new ArchiveRecord(\n tag, await this.revParse(repoRoot, base), await this.revParse(repoRoot, 'origin/main'),\n Number(ref.number), new Date().toISOString(),\n );\n if (this.mergeInfoIndex.promoteToMerged(repoRoot, feature, record)) {\n line += ` merge-info: staged/${feature} → merged/${feature} (index.json rebuilt)\\n`;\n }\n return line;\n }\n\n // Best-effort sha of a ref — '' when it cannot resolve. Recorded in archive.json for provenance.\n private async revParse(repoRoot: string, ref: string): Promise<string> {\n const result = await this.git.run(['rev-parse', ref], repoRoot);\n return result.ok ? result.stdout.trim() : '';\n }\n\n // `git branch --show-current` in the invocation directory. Must succeed: a branch we cannot read is\n // not a selector to guess at.\n private async currentBranch(cwd: string): Promise<string> {\n const result = await this.git.run(['branch', '--show-current'], cwd);\n if (!result.ok) {\n throw new InformAiError(`Could not read the current branch in ${cwd} (git branch --show-current): ${result.stderr.trim()}`);\n }\n return result.stdout.trim();\n }\n\n /**\n * Everything landing needs about the PR, in ONE `gh` read: number, title, URL, DESCRIPTION and the\n * head sha GitHub is squashing. `null` when there is no open PR for this head branch.\n *\n * The TITLE comes from the PR itself, not summary.json, so the squash subject matches what a reviewer\n * approved even if summary.json was edited afterwards. The BODY is the gated commit body (see the\n * class doc). `headRefOid` is read BEFORE the merge, because it is what the bookkeeping check\n * compares against and the merge is what makes the branch's fate uninteresting to GitHub.\n */\n private async readPr(selector: string): Promise<PrIdentity | null> {\n const result = await this.processes.run(\n 'gh', ['pr', 'view', selector, '--json', 'number,title,url,body,headRefOid,headRefName'],\n );\n if (!result.ok) return null;\n return this.parsePr(result.stdout);\n }\n\n // `gh --json` output → PrIdentity. Malformed/absent JSON reads as \"no PR\", which the caller turns\n // into the same refusal a missing PR gets: both mean nothing here can be landed.\n private parsePr(stdout: string): PrIdentity | null {\n // webpieces-disable no-unmanaged-exceptions -- chokepoint: unparseable gh output means \"no PR\", never a crash\n // eslint-disable-next-line @webpieces/no-unmanaged-exceptions\n try {\n // webpieces-disable no-any-unknown -- gh's JSON is opaque until narrowed field-by-field below\n const raw = JSON.parse(stdout) as Record<string, unknown>;\n const number = typeof raw['number'] === 'number' ? String(raw['number']) : this.str(raw['number']);\n if (number === '') return null;\n // GitHub stores descriptions with CRLF. A commit body must not carry them, and the bytes are\n // otherwise identical to what finish rendered, so the line endings are normalized back here.\n const body = this.str(raw['body']).replace(/\\r\\n/g, '\\n').trim();\n return new PrIdentity(\n number, this.str(raw['title']), this.str(raw['url']), body === '' ? '' : body + '\\n',\n this.str(raw['headRefOid']), this.str(raw['headRefName']),\n );\n } catch (err: unknown) {\n const error = toError(err);\n void error;\n return null;\n }\n }\n\n // webpieces-disable no-any-unknown -- one opaque JSON field, narrowed to string\n private str(value: unknown): string {\n return typeof value === 'string' ? value : '';\n }\n}\n\n// The open PR as GitHub holds it: its number, title, web URL, DESCRIPTION (= the gated commit body) and\n// the PAIR that identifies its tree locally — the head branch's name and the commit being squashed.\nclass PrIdentity {\n number: string;\n title: string;\n url: string;\n body: string;\n headRefOid: string;\n /**\n * The PR's head BRANCH. Required alongside `headRefOid` because neither half identifies a tree on its\n * own: the name is what a worktree list can be searched by, the sha is what makes a hit the right\n * one. It also frees `--pr <n>` from needing the operator to be standing anywhere in particular.\n */\n headRefName: string;\n\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n number: string, title: string, url: string, body: string, headRefOid: string, headRefName: string,\n ) {\n this.number = number;\n this.title = title;\n this.url = url;\n this.body = body;\n this.headRefOid = headRefOid;\n this.headRefName = headRefName;\n }\n}\n\n/**\n * Data-only (per CLAUDE.md, classes for data): what the operator asked `wp-land-pr` to land.\n *\n * `prNumber` is '' for the zero-arg form — \"this branch's PR\" — which stays the shorthand the worker\n * uses. It is NOT an optional constructor parameter with a default at the call site: `wp-land-pr.ts`\n * builds exactly one of these from the parsed argv, so there is one spelling of the decision.\n */\nexport class LandPrRequest {\n /**\n * Was `--pr` on the command line at all? Kept SEPARATE from the value because `--pr` with no number\n * is a mistake, not a request to guess: collapsing the two would silently land whatever PR the\n * current directory's branch happens to have, which is the opposite of what the operator typed.\n */\n prFlagPresent: boolean;\n /** The `--pr <n>` value verbatim, or '' to infer the PR from the invocation directory's branch. */\n prNumber: string;\n\n constructor(prFlagPresent: boolean, prNumber: string) {\n this.prFlagPresent = prFlagPresent;\n this.prNumber = prNumber;\n }\n}\n"]}
|
|
@@ -48,16 +48,15 @@ let ReapWorktreeCommand = class ReapWorktreeCommand {
|
|
|
48
48
|
* remove". The token is the last thing written, and LandedWorktreeReaper strips it before printing.
|
|
49
49
|
*/
|
|
50
50
|
async run(args) {
|
|
51
|
-
await Promise.resolve();
|
|
52
51
|
const request = this.parse(args);
|
|
53
52
|
const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());
|
|
54
|
-
const target = this.resolveTarget(repoRoot, request);
|
|
53
|
+
const target = await this.resolveTarget(repoRoot, request);
|
|
55
54
|
if (target === null) {
|
|
56
55
|
process.stdout.write(this.signal.line(reap_outcome_1.REAP_OUTCOME_REFUSED));
|
|
57
56
|
return;
|
|
58
57
|
}
|
|
59
58
|
const retention = (0, rules_config_1.loadAndValidate)(repoRoot).prGate.landPr.branchRetention;
|
|
60
|
-
const result = this.worktreeSection.reap(repoRoot, 'wp-land-pr', [target], retention);
|
|
59
|
+
const result = await this.worktreeSection.reap(repoRoot, 'wp-land-pr', [target], retention);
|
|
61
60
|
process.stdout.write(this.render(repoRoot, result));
|
|
62
61
|
process.stdout.write(this.signal.line(this.outcomeOf(result)));
|
|
63
62
|
}
|
|
@@ -77,11 +76,11 @@ let ReapWorktreeCommand = class ReapWorktreeCommand {
|
|
|
77
76
|
* successful landing would report a landed PR as a failed command. That is exactly why `run` also
|
|
78
77
|
* emits a ReapOutcomeSignal — the caller must be able to tell this exit 0 from a successful one.
|
|
79
78
|
*/
|
|
80
|
-
resolveTarget(repoRoot, request) {
|
|
79
|
+
async resolveTarget(repoRoot, request) {
|
|
81
80
|
const wanted = path.resolve(request.worktreePath);
|
|
82
81
|
// `false`: this reaps ONE named worktree after its PR landed, and it is not the place to
|
|
83
82
|
// override anybody's lock — a lock still standing here is exactly the refusal this prints.
|
|
84
|
-
const target = this.worktreeSection.verdicts(repoRoot, false)
|
|
83
|
+
const target = (await this.worktreeSection.verdicts(repoRoot, false))
|
|
85
84
|
.find((tree) => path.resolve(tree.path) === wanted);
|
|
86
85
|
if (target === undefined) {
|
|
87
86
|
process.stdout.write(`\n ℹ️ ${request.worktreePath} is not a removable worktree of this repo (it may be the\n`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reap-worktree-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/reap-worktree-command.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAC7B,sEAAiH;AACjH,8DAA0D;AAC1D,0DAA0E;AAC1E,yCAA2D;AAE3D,2DAKkC;AAElC,yDAA4D;AAE5D,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;GAoBG;AAEI,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAEP;IACA;IACA;IACA;IAJrB,YACqB,cAA8B,EAC9B,eAAuC,EACvC,MAAyB,EACzB,SAA0B;QAH1B,mBAAc,GAAd,cAAc,CAAgB;QAC9B,oBAAe,GAAf,eAAe,CAAwB;QACvC,WAAM,GAAN,MAAM,CAAmB;QACzB,cAAS,GAAT,SAAS,CAAiB;IAC5C,CAAC;IAEJ;;;;OAIG;IACH,KAAK,CAAC,GAAG,CAAC,IAAc;QACpB,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAEpE,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACrD,IAAI,MAAM,KAAK,IAAI,EAAE,CAAC;YAClB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAoB,CAAC,CAAC,CAAC;YAC7D,OAAO;QACX,CAAC;QAED,MAAM,SAAS,GAAG,IAAA,8BAAe,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC;QAC1E,MAAM,MAAM,G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tC,mBAAmB,CAkI/B;AAED,uFAAuF;AACvF,MAAM,WAAW;IACb,YAAY,CAAS;IACrB,MAAM,CAAS;IACf,2FAA2F;IAC3F,IAAI,CAAS;IAEb,YAAY,YAAoB,EAAE,MAAc,EAAE,IAAY;QAC1D,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import * as path from 'path';\nimport { DeletableWorktree, Worktree, WorktreeReapResult, WorktreeService } from '@webpieces/repo-workflow-core';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { RepoRootFinder, loadAndValidate } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport {\n ReapOutcomeSignal,\n REAP_OUTCOME_FAILED,\n REAP_OUTCOME_REFUSED,\n REAP_OUTCOME_REMOVED,\n} from '../workflow/reap-outcome';\n\nimport { WorktreeCleanupSection } from './worktree-cleanup';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * The CHILD side of `wp-land-pr`'s re-exec: reap ONE named worktree, from a process whose cwd is the\n * primary clone.\n *\n * It is not a published `bin`. Nothing about it is a verb a human should reach for — `pnpm wp-cleanup`\n * is that verb, and it does strictly more. This exists so the parent can hand off a SINGLE, already\n * identified corpse without also reaping every other agent's worktree as a side effect of landing one\n * PR. LandedWorktreeReaper spawns it by absolute path; see that class for why a child rather than a\n * `process.chdir`.\n *\n * WHAT IT WILL NOT TAKE ON TRUST. The parent tells it a path, a branch and the HEAD sha it selected the\n * tree by; it believes none of the three.\n * The verdict is recomputed here, from scratch, by the same MergedBranchesService that backs\n * `wp-cleanup` — so a worktree is removed only when it is PROVABLY dead (its PR is merged), and never\n * because a caller said so. That is what keeps \"never remove a tree still holding unmerged work\" true\n * even if the parent is wrong, out of date, or someone runs this by hand.\n *\n * The primary clone can never be a target: `classifyWorktrees` drops the main worktree from the\n * verdicts outright, so a path pointing at it simply does not resolve to a target — and WorktreeReaper\n * refuses it a second time by name. Neither rail is load-bearing alone.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReapWorktreeCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly worktreeSection: WorktreeCleanupSection,\n private readonly signal: ReapOutcomeSignal,\n private readonly worktrees: WorktreeService,\n ) {}\n\n /**\n * Every exit from here states an OUTCOME, because the exit code cannot: refusals exit 0 (see\n * `resolveTarget`), so a parent with only a status has no way to tell \"removed\" from \"declined to\n * remove\". The token is the last thing written, and LandedWorktreeReaper strips it before printing.\n */\n async run(args: string[]): Promise<void> {\n await Promise.resolve();\n const request = this.parse(args);\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n\n const target = this.resolveTarget(repoRoot, request);\n if (target === null) {\n process.stdout.write(this.signal.line(REAP_OUTCOME_REFUSED));\n return;\n }\n\n const retention = loadAndValidate(repoRoot).prGate.landPr.branchRetention;\n const result = this.worktreeSection.reap(repoRoot, 'wp-land-pr', [target], retention);\n process.stdout.write(this.render(repoRoot, result));\n process.stdout.write(this.signal.line(this.outcomeOf(result)));\n }\n\n /**\n * `reaped` is the only entry that means the DIRECTORY is gone. A tree that reached the reaper and\n * came back in neither list was spared by one of WorktreeReaper's own rails (it is the cwd, it is\n * the primary clone) — nothing was attempted, which is a refusal, not a failure.\n */\n private outcomeOf(result: WorktreeReapResult): string {\n if (result.reaped.length > 0) return REAP_OUTCOME_REMOVED;\n return result.failed.length > 0 ? REAP_OUTCOME_FAILED : REAP_OUTCOME_REFUSED;\n }\n\n /**\n * The verdict for the requested path, or null after printing WHY it is not reapable. Refusals are\n * printed rather than thrown: the PR they follow is already merged, and exiting non-zero after a\n * successful landing would report a landed PR as a failed command. That is exactly why `run` also\n * emits a ReapOutcomeSignal — the caller must be able to tell this exit 0 from a successful one.\n */\n private resolveTarget(repoRoot: string, request: ReapRequest): DeletableWorktree | null {\n const wanted = path.resolve(request.worktreePath);\n // `false`: this reaps ONE named worktree after its PR landed, and it is not the place to\n // override anybody's lock — a lock still standing here is exactly the refusal this prints.\n const target = this.worktreeSection.verdicts(repoRoot, false)\n .find((tree: DeletableWorktree): boolean => path.resolve(tree.path) === wanted);\n\n if (target === undefined) {\n process.stdout.write(\n `\\n ℹ️ ${request.worktreePath} is not a removable worktree of this repo (it may be the\\n`\n + ' primary clone, or already gone). Nothing removed.\\n');\n return null;\n }\n // The branch moved under us between landing and reaping — somebody checked something else out\n // there. Whatever that is, it is not the corpse we were asked to bury.\n if (target.branch !== request.branch) {\n process.stdout.write(\n `\\n ⚠️ ${request.worktreePath} now holds '${target.branch}', not '${request.branch}'.\\n`\n + ' Refusing to remove a worktree whose branch changed since the PR landed.\\n');\n return null;\n }\n // …and the NAME is not the identity. The parent selected this directory because its HEAD was the\n // exact commit GitHub squashed; that selection is recomputed here from git rather than taken on\n // trust, so a commit made in that tree between landing and reaping — work the archive tag of the\n // squashed tip does not contain — stops the removal instead of being buried with it.\n const here = this.headOf(repoRoot, wanted);\n if (here !== request.head) {\n process.stdout.write(\n `\\n ⚠️ ${request.worktreePath} is at ${here === '' ? '(unknown)' : here}, not the landed\\n`\n + ` commit ${request.head}.\\n`\n + ' Refusing to remove a worktree whose HEAD moved since the PR landed.\\n');\n return null;\n }\n if (!target.deletable) {\n process.stdout.write(\n `\\n ⚠️ ${request.worktreePath} is not provably dead: ${target.reason}\\n`\n + ' Refusing to remove a worktree that may still hold unmerged work.\\n');\n return null;\n }\n return target;\n }\n\n /**\n * That worktree's HEAD as git reports it right now, '' when git cannot place the path at all.\n * '' can never equal a real sha, so \"git would not answer\" fails SAFE — it declines the removal.\n */\n private headOf(repoRoot: string, resolvedPath: string): string {\n const tree = this.worktrees.listWorktrees(repoRoot)\n .find((candidate: Worktree): boolean => path.resolve(candidate.path) === resolvedPath);\n return tree?.head ?? '';\n }\n\n // The reap report, plus the spared case — which report() renders as '' because from wp-cleanup's\n // point of view \"nothing happened\" is a whole answer. Here it never is: we asked for exactly one.\n private render(repoRoot: string, result: WorktreeReapResult): string {\n if (result.reaped.length === 0 && result.failed.length === 0) {\n let out = '\\n' + SEP + '🛑 Nothing removed\\n' + SEP + '\\n';\n for (const tree of result.spared) out += ` · ${tree.path} — ${tree.reason}\\n`;\n return out;\n }\n return this.worktreeSection.report(repoRoot, result);\n }\n\n /**\n * `<worktree-path> <branch> <head-sha>`, all three required. The sha is not optional and has no\n * default: a defaulted '' would mean \"do not check\", i.e. exactly the name-only removal both\n * processes exist to refuse, so a caller that omits it must fail to run rather than run wider.\n *\n * Thrown rather than printed: bad argv means the caller is broken, and there is no landed PR in this\n * process whose success a non-zero exit could misreport.\n */\n private parse(args: string[]): ReapRequest {\n const worktreePath = args[0] ?? '';\n const branch = args[1] ?? '';\n const head = args[2] ?? '';\n if (worktreePath === '' || branch === '' || head === '') {\n throw new InformAiError(\n '\\n' + SEP + '❌ wp-reap-worktree: missing arguments\\n' + SEP + '\\n'\n + 'Usage: node wp-reap-worktree.js <worktree-path> <branch> <head-sha>\\n\\n'\n + 'This is an INTERNAL entry point, spawned by `pnpm wp-land-pr` with cwd set to the\\n'\n + 'primary clone. To clean up by hand, run `pnpm wp-cleanup` from the primary clone.\\n' + SEP);\n }\n return new ReapRequest(worktreePath, branch, head);\n }\n}\n\n// Data-only (per CLAUDE.md, classes for data): the argv values this entry point takes.\nclass ReapRequest {\n worktreePath: string;\n branch: string;\n /** The commit the parent proved this worktree was at — re-verified here, never trusted. */\n head: string;\n\n constructor(worktreePath: string, branch: string, head: string) {\n this.worktreePath = worktreePath;\n this.branch = branch;\n this.head = head;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reap-worktree-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/reap-worktree-command.ts"],"names":[],"mappings":";;;;AAAA,mDAA6B;AAC7B,sEAAiH;AACjH,8DAA0D;AAC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CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ","sourcesContent":["import * as path from 'path';\nimport { DeletableWorktree, Worktree, WorktreeReapResult, WorktreeService } from '@webpieces/repo-workflow-core';\nimport { InformAiError } from '@webpieces/tooling-common';\nimport { RepoRootFinder, loadAndValidate } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\n\nimport {\n ReapOutcomeSignal,\n REAP_OUTCOME_FAILED,\n REAP_OUTCOME_REFUSED,\n REAP_OUTCOME_REMOVED,\n} from '../workflow/reap-outcome';\n\nimport { WorktreeCleanupSection } from './worktree-cleanup';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * The CHILD side of `wp-land-pr`'s re-exec: reap ONE named worktree, from a process whose cwd is the\n * primary clone.\n *\n * It is not a published `bin`. Nothing about it is a verb a human should reach for — `pnpm wp-cleanup`\n * is that verb, and it does strictly more. This exists so the parent can hand off a SINGLE, already\n * identified corpse without also reaping every other agent's worktree as a side effect of landing one\n * PR. LandedWorktreeReaper spawns it by absolute path; see that class for why a child rather than a\n * `process.chdir`.\n *\n * WHAT IT WILL NOT TAKE ON TRUST. The parent tells it a path, a branch and the HEAD sha it selected the\n * tree by; it believes none of the three.\n * The verdict is recomputed here, from scratch, by the same MergedBranchesService that backs\n * `wp-cleanup` — so a worktree is removed only when it is PROVABLY dead (its PR is merged), and never\n * because a caller said so. That is what keeps \"never remove a tree still holding unmerged work\" true\n * even if the parent is wrong, out of date, or someone runs this by hand.\n *\n * The primary clone can never be a target: `classifyWorktrees` drops the main worktree from the\n * verdicts outright, so a path pointing at it simply does not resolve to a target — and WorktreeReaper\n * refuses it a second time by name. Neither rail is load-bearing alone.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReapWorktreeCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly worktreeSection: WorktreeCleanupSection,\n private readonly signal: ReapOutcomeSignal,\n private readonly worktrees: WorktreeService,\n ) {}\n\n /**\n * Every exit from here states an OUTCOME, because the exit code cannot: refusals exit 0 (see\n * `resolveTarget`), so a parent with only a status has no way to tell \"removed\" from \"declined to\n * remove\". The token is the last thing written, and LandedWorktreeReaper strips it before printing.\n */\n async run(args: string[]): Promise<void> {\n const request = this.parse(args);\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n\n const target = await this.resolveTarget(repoRoot, request);\n if (target === null) {\n process.stdout.write(this.signal.line(REAP_OUTCOME_REFUSED));\n return;\n }\n\n const retention = loadAndValidate(repoRoot).prGate.landPr.branchRetention;\n const result = await this.worktreeSection.reap(repoRoot, 'wp-land-pr', [target], retention);\n process.stdout.write(this.render(repoRoot, result));\n process.stdout.write(this.signal.line(this.outcomeOf(result)));\n }\n\n /**\n * `reaped` is the only entry that means the DIRECTORY is gone. A tree that reached the reaper and\n * came back in neither list was spared by one of WorktreeReaper's own rails (it is the cwd, it is\n * the primary clone) — nothing was attempted, which is a refusal, not a failure.\n */\n private outcomeOf(result: WorktreeReapResult): string {\n if (result.reaped.length > 0) return REAP_OUTCOME_REMOVED;\n return result.failed.length > 0 ? REAP_OUTCOME_FAILED : REAP_OUTCOME_REFUSED;\n }\n\n /**\n * The verdict for the requested path, or null after printing WHY it is not reapable. Refusals are\n * printed rather than thrown: the PR they follow is already merged, and exiting non-zero after a\n * successful landing would report a landed PR as a failed command. That is exactly why `run` also\n * emits a ReapOutcomeSignal — the caller must be able to tell this exit 0 from a successful one.\n */\n private async resolveTarget(repoRoot: string, request: ReapRequest): Promise<DeletableWorktree | null> {\n const wanted = path.resolve(request.worktreePath);\n // `false`: this reaps ONE named worktree after its PR landed, and it is not the place to\n // override anybody's lock — a lock still standing here is exactly the refusal this prints.\n const target = (await this.worktreeSection.verdicts(repoRoot, false))\n .find((tree: DeletableWorktree): boolean => path.resolve(tree.path) === wanted);\n\n if (target === undefined) {\n process.stdout.write(\n `\\n ℹ️ ${request.worktreePath} is not a removable worktree of this repo (it may be the\\n`\n + ' primary clone, or already gone). Nothing removed.\\n');\n return null;\n }\n // The branch moved under us between landing and reaping — somebody checked something else out\n // there. Whatever that is, it is not the corpse we were asked to bury.\n if (target.branch !== request.branch) {\n process.stdout.write(\n `\\n ⚠️ ${request.worktreePath} now holds '${target.branch}', not '${request.branch}'.\\n`\n + ' Refusing to remove a worktree whose branch changed since the PR landed.\\n');\n return null;\n }\n // …and the NAME is not the identity. The parent selected this directory because its HEAD was the\n // exact commit GitHub squashed; that selection is recomputed here from git rather than taken on\n // trust, so a commit made in that tree between landing and reaping — work the archive tag of the\n // squashed tip does not contain — stops the removal instead of being buried with it.\n const here = this.headOf(repoRoot, wanted);\n if (here !== request.head) {\n process.stdout.write(\n `\\n ⚠️ ${request.worktreePath} is at ${here === '' ? '(unknown)' : here}, not the landed\\n`\n + ` commit ${request.head}.\\n`\n + ' Refusing to remove a worktree whose HEAD moved since the PR landed.\\n');\n return null;\n }\n if (!target.deletable) {\n process.stdout.write(\n `\\n ⚠️ ${request.worktreePath} is not provably dead: ${target.reason}\\n`\n + ' Refusing to remove a worktree that may still hold unmerged work.\\n');\n return null;\n }\n return target;\n }\n\n /**\n * That worktree's HEAD as git reports it right now, '' when git cannot place the path at all.\n * '' can never equal a real sha, so \"git would not answer\" fails SAFE — it declines the removal.\n */\n private headOf(repoRoot: string, resolvedPath: string): string {\n const tree = this.worktrees.listWorktrees(repoRoot)\n .find((candidate: Worktree): boolean => path.resolve(candidate.path) === resolvedPath);\n return tree?.head ?? '';\n }\n\n // The reap report, plus the spared case — which report() renders as '' because from wp-cleanup's\n // point of view \"nothing happened\" is a whole answer. Here it never is: we asked for exactly one.\n private render(repoRoot: string, result: WorktreeReapResult): string {\n if (result.reaped.length === 0 && result.failed.length === 0) {\n let out = '\\n' + SEP + '🛑 Nothing removed\\n' + SEP + '\\n';\n for (const tree of result.spared) out += ` · ${tree.path} — ${tree.reason}\\n`;\n return out;\n }\n return this.worktreeSection.report(repoRoot, result);\n }\n\n /**\n * `<worktree-path> <branch> <head-sha>`, all three required. The sha is not optional and has no\n * default: a defaulted '' would mean \"do not check\", i.e. exactly the name-only removal both\n * processes exist to refuse, so a caller that omits it must fail to run rather than run wider.\n *\n * Thrown rather than printed: bad argv means the caller is broken, and there is no landed PR in this\n * process whose success a non-zero exit could misreport.\n */\n private parse(args: string[]): ReapRequest {\n const worktreePath = args[0] ?? '';\n const branch = args[1] ?? '';\n const head = args[2] ?? '';\n if (worktreePath === '' || branch === '' || head === '') {\n throw new InformAiError(\n '\\n' + SEP + '❌ wp-reap-worktree: missing arguments\\n' + SEP + '\\n'\n + 'Usage: node wp-reap-worktree.js <worktree-path> <branch> <head-sha>\\n\\n'\n + 'This is an INTERNAL entry point, spawned by `pnpm wp-land-pr` with cwd set to the\\n'\n + 'primary clone. To clean up by hand, run `pnpm wp-cleanup` from the primary clone.\\n' + SEP);\n }\n return new ReapRequest(worktreePath, branch, head);\n }\n}\n\n// Data-only (per CLAUDE.md, classes for data): the argv values this entry point takes.\nclass ReapRequest {\n worktreePath: string;\n branch: string;\n /** The commit the parent proved this worktree was at — re-verified here, never trusted. */\n head: string;\n\n constructor(worktreePath: string, branch: string, head: string) {\n this.worktreePath = worktreePath;\n this.branch = branch;\n this.head = head;\n }\n}\n"]}
|
|
@@ -243,7 +243,7 @@ let ReviewUpsertPrCommand = class ReviewUpsertPrCommand {
|
|
|
243
243
|
// write. The scan deliberately did not write it (ChecklistScanOptions.contextStage === ''); it used
|
|
244
244
|
// to, which meant this command wrote the same file twice, the first time with an empty diffDir.
|
|
245
245
|
// `scan.changedFiles` is passed through so the context is not recomputed from a second git call.
|
|
246
|
-
scan.context = this.prContextWriter.ensure(repoRoot, featureName, plan.basis, 'stage2-review', changedFiles, diffDir);
|
|
246
|
+
scan.context = await this.prContextWriter.ensure(repoRoot, featureName, plan.basis, 'stage2-review', changedFiles, diffDir);
|
|
247
247
|
// ONLY the checklists still owed a verdict (issue #863). A green or yellow CARRIES whatever changed
|
|
248
248
|
// since (issue #1053) — the scan left it in `reviewed` — so briefing it again would pay a reviewer to
|
|
249
249
|
// re-read code it already judged. A later round re-briefs exactly the previous round's REDS.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review-upsert-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/review-upsert-pr-command.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,0DAAmN;AACnN,yCAA2D;AAC3D,+DAA4E;AAC5E,2EAAgE;AAChE,+DAA6E;AAC7E,+DAA0D;AAC1D,yEAAoE;AACpE,qEAAsG;AACtG,qEAAiE;AACjE,mDAA+C;AAC/C,yDAAuD;AACvD,qDAAkE;AAClE,yDAAqD;AACrD,qEAAgE;AAChE,qFAAgF;AAChF,6DAA6F;AAC7F,2EAAiG;AACjG,mEAAkF;AAClF,iEAA6D;AAC7D,uEAEwC;AAExC,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAGT;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IAEA;IACA;IACA;IACA;IArBrB,yDAAyD;IACzD,YACqB,cAA8B,EAC9B,YAA0B,EAC1B,OAAgB,EAChB,aAA4B,EAC5B,iBAAoC,EACpC,UAAsB,EACtB,QAAkB,EAClB,gBAAkC,EAClC,YAA0B,EAC1B,YAA8B,EAC9B,eAAgC,EAChC,eAAwC,EACxC,oBAAiD,EACjD,QAAmC,EACnC,iBAAoC;IACrD,gGAAgG;IAC/E,iBAAoC,EACpC,YAA4B,EAC5B,cAA8B,EAC9B,MAA+B;QAnB/B,mBAAc,GAAd,cAAc,CAAgB;QAC9B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,YAAO,GAA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,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,CAAC;IAED;;;;;;;;;;;;OAYG;IACK,QAAQ,CAAC,IAAmB;QAChC,MAAM,OAAO,GAAG,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QACxF,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,GAAsB,EAAmB,EAAE,CAAC,IAAI,+BAAe,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACvN,CAAC;CACJ,CAAA;AAnRY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAIA,6BAAc;QAChB,mCAAY;QACjB,kBAAO;QACD,8BAAa;QACT,uCAAiB;QACxB,wBAAU;QACZ,oBAAQ;QACA,oCAAgB;QACpB,4BAAY;QACZ,oCAAgB;QACb,mCAAe;QACf,mDAAuB;QAClB,0CAA2B;QACvC,gDAAyB;QAChB,kCAAiB;QAEjB,gCAAiB;QACtB,iCAAc;QACZ,gCAAc;QACtB,4CAAuB;GAtB3C,qBAAqB,CAmRjC","sourcesContent":["import * as fs from 'fs';\nimport { loadAndValidate, writeTemplate, PrGateConfig, RepoRootFinder, RequiredChecklist, ReviewerBriefing, ReviewerInstructionsService, ReviewJsonService, summaryJsonSchemaHint } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ActiveHatch, ActiveHatchReport } from '../workflow/active-hatches';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { BuildAffected, BuildGateOptions } from '../workflow/build-affected';\nimport { REVIEW_STAGE } from '../workflow/build-gate-log';\nimport { BuildArtifactGate } from '../workflow/build-artifact-gate';\nimport { ChecklistScan, ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { DiffMaterializer } from '../workflow/diff-materializer';\nimport { GitExec } from '../workflow/git-exec';\nimport { MergeContext } from '../workflow/merge-start';\nimport { MergeEnd, MergeEndOptions } from '../workflow/merge-end';\nimport { MergeState } from '../workflow/merge-state';\nimport { PrContextWriter } from '../workflow/pr-context-writer';\nimport { ReviewerBriefingBuilder } from '../workflow/reviewer-briefing-builder';\nimport { RefusedReviewer, ReviewReport, ReviewReportInput } from '../workflow/review-report';\nimport { ReviewStageReceipt, ReviewStageReceiptService } from '../workflow/review-stage-receipt';\nimport { StageOutputLog, REVIEW_CONSOLE_LOG } from '../workflow/stage-output-log';\nimport { HotfixRedirect } from '../workflow/hotfix-redirect';\nimport {\n ReviewRoundPlan, ReviewRoundStateService, ROUND_ACTION_REVIEW, ROUND_ACTION_RESUME,\n} from '../workflow/review-round-state';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * `wp-review-upsert-pr` — STAGE ② of the three-stage PR flow, between `wp-start-upsert-pr` (sync from main)\n * and `wp-finish-upsert-pr` (post the PR).\n *\n * It exists because reviewing came before verifying. Under the old two-command flow the 3-point merge was\n * finalized and the build gate ran inside `wp-finish-upsert-pr` — i.e. AFTER the reviewers had already run.\n * A reviewer could therefore spend a full review on an unresolved merge, or on code that does not compile,\n * and only afterwards would the branch be checked. This command puts the verification first:\n *\n * 1. finalize + VALIDATE any in-progress 3-point merge (moved here from finish)\n * 2. assert a clean tree (meaningful now — step 1 committed the resolution)\n * 3. run the build gate (on the merged, committed tree)\n * 4. scan the checklists, EXTRACT the diff, BRIEF the reviewers\n * 5. write the stage receipt, then print what to spawn + the summary.json schema\n *\n * Unlike the report-only command it replaces — which always exited 0, because reporting is not gating — this\n * command CAN FAIL, at steps 1, 2 and 3. That is the point: it fails BEFORE any reviewer is spawned, so a\n * branch with an unresolved merge or a broken build costs zero reviewer tokens.\n *\n * The ordering of 1 → 2 → 3 is load-bearing. MergeEnd stages and commits the conflict resolution, so the\n * tree is clean by the time the build runs; building first would either build a dirty tree (proving nothing\n * about what ships) or refuse a tree that is legitimately mid-resolution.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewUpsertPrCommand {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly gitExec: GitExec,\n private readonly buildAffected: BuildAffected,\n private readonly buildArtifactGate: BuildArtifactGate,\n private readonly mergeState: MergeState,\n private readonly mergeEnd: MergeEnd,\n private readonly checklistScanner: ChecklistScanner,\n private readonly reviewReport: ReviewReport,\n private readonly materializer: DiffMaterializer,\n private readonly prContextWriter: PrContextWriter,\n private readonly briefingBuilder: ReviewerBriefingBuilder,\n private readonly reviewerInstructions: ReviewerInstructionsService,\n private readonly receipts: ReviewStageReceiptService,\n private readonly activeHatchReport: ActiveHatchReport,\n // Injected to RESOLVE + RENDER refusals (see refusals()) and to name each round's verdict file.\n private readonly reviewJsonService: ReviewJsonService,\n private readonly stageConsole: StageOutputLog,\n private readonly hotfixRedirect: HotfixRedirect,\n private readonly rounds: ReviewRoundStateService,\n ) {}\n\n /**\n * Everything below runs with this stage's console CAPTURED to a file (see StageOutputLog). Only the\n * lines an agent must act on before it can do anything else reach the terminal — the build heartbeat\n * and result, and the closing instruction block. The merge validation, the hatch report, the checklist\n * scan and the diff extraction are all in the file, one `grep` away.\n *\n * This is the FIRST half of the fix for the piped-command watchdog kill: an agent pipes a command it\n * expects to flood, a pipe withholds every byte until exit, and the harness kills a command that has\n * printed nothing for 600 seconds — after a full build. Guarding the pipe without first shrinking the\n * output would only have traded that kill for a flooded context.\n */\n async run(): Promise<void> {\n // A /hotfix/ branch has no review stage — it publishes with wp-upsert-hotfix-pr (issue #1057).\n this.hotfixRedirect.assertNotHotfix('wp-review-upsert-pr');\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n await this.stageConsole.withCapture(repoRoot, REVIEW_CONSOLE_LOG, (): Promise<void> => this.runStage(repoRoot));\n }\n\n private async runStage(repoRoot: string): Promise<void> {\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n writeTemplate(repoRoot, 'webpieces.review-checklists.md');\n const featureName = await this.aiBranchName.getFeatureName();\n const config = loadAndValidate(repoRoot).prGate;\n\n const mergeValidated = await this.finalizeAnyInProgressMerge(repoRoot);\n await this.gitExec.assertCleanTree(repoRoot);\n const buildPassedAt = await this.runBuildGate(repoRoot);\n\n const scan = await this.checklistScanner.scan(repoRoot, config.checklists, new ChecklistScanOptions(config.maxReviewerRounds, false, '')); // '' — THIS command writes the context itself, after materializing\n const previousReceipt = this.receipts.read(repoRoot, featureName);\n const plan = await this.rounds.plan(repoRoot, scan.summaryPath, previousReceipt, config.maxReviewerRounds, scan.basis);\n if (plan.action === ROUND_ACTION_RESUME && previousReceipt !== null) {\n this.resumeRound(repoRoot, featureName, scan, previousReceipt, mergeValidated, buildPassedAt);\n this.reportActiveHatches(repoRoot);\n if (scan.reviewersDisabled) this.report(repoRoot, featureName, scan, [], plan, config);\n return;\n }\n const shouldBrief = plan.action === ROUND_ACTION_REVIEW;\n const briefings = shouldBrief\n ? await this.briefReviewers(repoRoot, featureName, scan, config, plan)\n : [];\n const recordedReviewers = briefings.map((b: ReviewerBriefing): string => b.checklistId);\n if (shouldBrief) {\n const receipt = new ReviewStageReceipt(scan.basis.headSha, mergeValidated, this.buildAffected.resolveBuildCommand(repoRoot), buildPassedAt, recordedReviewers);\n receipt.scopeHashes = scan.scopeHashes;\n // Which briefed checklists are OPTIONAL: a round is complete once every REQUIRED one has a\n // verdict, and an optional one joins the round only if it actually submitted (issue #1062).\n receipt.optionalBriefed = briefings.filter((b: ReviewerBriefing): boolean => !b.required).map((b: ReviewerBriefing): string => b.checklistId);\n // A global round begins only when a non-empty fixed roster is actually briefed.\n receipt.round = recordedReviewers.length === 0 ? 0 : plan.round;\n receipt.maxReviewerRounds = plan.maxRounds;\n this.receipts.write(repoRoot, featureName, receipt);\n } else if (previousReceipt !== null) {\n previousReceipt.buildHeadSha = scan.basis.headSha;\n previousReceipt.mergeValidated = mergeValidated;\n previousReceipt.buildCommand = this.buildAffected.resolveBuildCommand(repoRoot);\n previousReceipt.buildPassedAt = buildPassedAt;\n this.receipts.write(repoRoot, featureName, previousReceipt);\n }\n this.reportActiveHatches(repoRoot);\n this.report(repoRoot, featureName, scan, briefings, plan, config);\n }\n\n /** Keep the original briefing, diff, roster and provenance intact while refreshing build evidence. */\n // eslint-disable-next-line @typescript-eslint/max-params\n private resumeRound(\n repoRoot: string,\n featureName: string,\n scan: ChecklistScan,\n receipt: ReviewStageReceipt,\n mergeValidated: boolean,\n buildPassedAt: string,\n ): void {\n receipt.buildHeadSha = scan.basis.headSha;\n receipt.mergeValidated = mergeValidated;\n receipt.buildCommand = this.buildAffected.resolveBuildCommand(repoRoot);\n receipt.buildPassedAt = buildPassedAt;\n this.receipts.write(repoRoot, featureName, receipt);\n // The scanner owns reviewer suppression. Keep the historical roster for later recovery, but\n // never instruct it to run while the existing opt-out is active.\n if (scan.reviewersDisabled) return;\n const pending = receipt.reviewersBriefed.filter(\n (id: string): boolean =>\n !receipt.optionalBriefed.includes(id) &&\n !this.rounds.hasVerdict(scan.summaryPath, id, receipt.round),\n );\n this.stageConsole.say(\n `\\nResume the existing reviewer roster: round ${receipt.round} of ${receipt.maxReviewerRounds}.\\n` +\n `Build passed at ${receipt.buildHeadSha}; reviewers retain their briefing at ${receipt.headSha}.\\n` +\n 'Continue the existing reviewer agents; do not respawn them for a SHA or fork-point change.\\n' +\n pending\n .map(\n (id: string): string =>\n ` REQUIRED ${id}: ${this.reviewerInstructions.pathFor(repoRoot, featureName, id)}\\n` +\n ` Submit with: pnpm wp-write-review --checklist ${id} --file '<verdict JSON file>'\\n`,\n )\n .join('') +\n `\\nBefore reviewers read it, write ${scan.summaryPath}, or keep its unchanged same-PR metadata.\\n` +\n 'Explicitly refresh it when intent, issue, title or risk changes.\\n' +\n `${summaryJsonSchemaHint(scan.summaryPath)}\\n` +\n 'Then run: pnpm wp-review-upsert-pr (to plan any RED follow-up), followed by pnpm wp-finish-upsert-pr.\\n',\n );\n }\n\n /**\n * List every rule that is currently switched off in webpieces.config.json. NON-BLOCKING and printed\n * before the instruction block, because it is context for the review rather than a step in it.\n *\n * A hatch is the one config change that makes the build QUIETER, so no gate, reviewer or red check\n * will ever mention it — which is how a repo ends up with rules off for weeks that nobody chose to\n * leave off. This is the only place in the flow that says so out loud.\n */\n private reportActiveHatches(repoRoot: string): void {\n const hatches: ActiveHatch[] = this.activeHatchReport.scan(repoRoot);\n process.stdout.write(this.activeHatchReport.render(hatches));\n }\n\n /**\n * Validate + commit + finalize a conflict resolution, if one is in flight. MOVED here from\n * `wp-finish-upsert-pr` so that exactly one command owns merge finalization — two owners is the drift\n * failure `PrContextWriter`'s own docstring records having already happened once in this codebase.\n *\n * MergeEnd's three checks are what \"did the AI do the 3-point merge right?\" means concretely: no\n * conflict markers left in the scoped files, `git diff --diff-filter=U` empty, and a non-empty\n * merge-explanation.md beside every conflicted file.\n *\n * Returns true when a merge was finalized OR there was none to finalize; it throws rather than returning\n * false when validation fails, so the receipt can never record an unvalidated merge as validated.\n */\n private async finalizeAnyInProgressMerge(repoRoot: string): Promise<boolean> {\n const home = this.mergeState.mergeDirFor(repoRoot, await this.aiBranchName.getFeatureName());\n const activeDir = this.mergeState.findActiveMergeRunDir(home);\n const marker = activeDir ? this.mergeState.readMergeMarker(activeDir) : null;\n if (!activeDir || !marker || marker.validated) return true;\n process.stdout.write('\\n' + SEP + '① Validating your 3-point merge\\n' + SEP + '\\n');\n // pushRemote:false — finish still owns the single push.\n await this.mergeEnd.mergeEnd(repoRoot, 'wp-review-upsert-pr', activeDir, new MergeContext(marker.currentBranch, marker.squashBranch, marker.backupBranch, marker.prNumber), new MergeEndOptions(marker.conflictedFiles, false));\n return true;\n }\n\n /**\n * The build gate, run BEFORE any reviewer is briefed. Returns the ISO time it passed, for the receipt —\n * which is what lets `wp-finish-upsert-pr` skip its own gate when HEAD has not moved, so moving the gate\n * earlier did not turn one build into two.\n */\n private async runBuildGate(repoRoot: string): Promise<string> {\n await this.buildAffected.runBuildGate(repoRoot, new BuildGateOptions('🛠️ Build gate', 'pnpm wp-review-upsert-pr', 'Build failed — NO reviewer was briefed and no diff was extracted. Fix it, then re-run.', REVIEW_STAGE));\n // Repo-wide: the build must not have left anything uncommitted AND unstaged. Runs HERE, not in\n // finish, because this is the stage that ran buildCommand and is therefore holding the dirty\n // tree at the exact moment the question is answerable. Replaces the per-project\n // validate-di-graph-unchanged nx target — see BuildArtifactGate for why that one had to go.\n await this.buildArtifactGate.assertBuildLeftNothingUncommitted(repoRoot);\n return new Date().toISOString();\n }\n\n /**\n * Extract the diff once, then write one instructions file per reviewer.\n *\n * The changed-file set and the basis both come off the SCAN rather than being recomputed, so the diff a\n * reviewer reads covers exactly the files its checklist matched against.\n */\n private async briefReviewers(repoRoot: string, featureName: string, scan: ChecklistScan, config: PrGateConfig, plan: ReviewRoundPlan): Promise<ReviewerBriefing[]> {\n if (plan.basis.unresolved) return [];\n const changedFiles = plan.round > 1 ? plan.changedFiles : scan.changedFiles;\n const manifest = await this.materializer.materialize(repoRoot, featureName, plan.basis, changedFiles, config.reviewDiffExclude);\n const diffDir = this.materializer.diffDirFor(repoRoot, featureName);\n // Write pr-context.json ONCE, here — after materializing, so `diffDir` is populated on the first\n // write. The scan deliberately did not write it (ChecklistScanOptions.contextStage === ''); it used\n // to, which meant this command wrote the same file twice, the first time with an empty diffDir.\n // `scan.changedFiles` is passed through so the context is not recomputed from a second git call.\n scan.context = this.prContextWriter.ensure(repoRoot, featureName, plan.basis, 'stage2-review', changedFiles, diffDir);\n // ONLY the checklists still owed a verdict (issue #863). A green or yellow CARRIES whatever changed\n // since (issue #1053) — the scan left it in `reviewed` — so briefing it again would pay a reviewer to\n // re-read code it already judged. A later round re-briefs exactly the previous round's REDS.\n const reviewedIds = new Set(scan.reviewed.map((r: RequiredChecklist): string => r.id));\n const owed = scan.applicable.filter((r: RequiredChecklist): boolean => plan.round > 1\n ? plan.redChecklistIds.includes(r.id)\n : !reviewedIds.has(r.id));\n const briefings = this.briefingBuilder.build(repoRoot, scan, owed, manifest, diffDir, config);\n const dir = this.reviewerInstructions.instructionsDirFor(repoRoot, featureName);\n fs.rmSync(dir, { recursive: true, force: true }); // stale instructions read as current are worse than none\n fs.mkdirSync(dir, { recursive: true });\n for (const b of briefings) {\n b.round = plan.round;\n b.maxRounds = plan.maxRounds;\n b.verdictPath = this.reviewJsonService.checklistResultPath(scan.summaryPath, b.checklistId, plan.round);\n b.remediationOnly = plan.round > 1;\n if (b.remediationOnly) {\n b.previousVerdictPath = this.reviewJsonService.checklistResultPath(scan.summaryPath, b.checklistId, plan.round - 1);\n b.remediationPath = this.rounds.fixesPath(scan.summaryPath, plan.round - 1);\n }\n fs.writeFileSync(this.reviewerInstructions.pathFor(repoRoot, featureName, b.checklistId), this.reviewerInstructions.render(b));\n }\n return briefings;\n }\n\n /**\n * What the AI must do next — rendered by `ReviewReport`, which owns the ordering.\n *\n * The rendering moved OUT of this command so the ordering could be asserted on as a string. It had a\n * real bug: the zero-checklist notice signed off with \"Carry on and run: pnpm wp-finish-upsert-pr\"\n * while the block right beneath it said to write summary.json first. An agent that reads top to bottom\n * obeyed the first line and posted a PR with no review at all.\n */\n // eslint-disable-next-line @typescript-eslint/max-params\n private report(repoRoot: string, featureName: string, scan: ChecklistScan, briefings: readonly ReviewerBriefing[], plan: ReviewRoundPlan, config: PrGateConfig): void {\n const input = new ReviewReportInput(repoRoot, featureName, scan.summaryPath);\n input.definedCount = scan.defined.length;\n input.applicableCount = scan.applicable.length;\n input.reviewed = scan.reviewed.slice();\n input.formatErrors = scan.formatErrors.slice();\n input.briefings = briefings.slice();\n input.refused = this.refusals(scan);\n input.reviewer = config.reviewer;\n // Straight off the SCAN — the one place `experimental.turnOffAllReviewers` is read. This command\n // deliberately does NOT consult the home config itself: a second read is a second answer, and the\n // command that lists and the command that blocks would be free to disagree about whether a branch\n // was reviewed. See ChecklistScanner.\n input.reviewersSuppressed = scan.reviewersDisabled;\n input.suppressed = scan.suppressed.slice();\n input.round = plan.round;\n input.maxReviewerRounds = plan.maxRounds;\n input.roundAction = plan.action;\n input.redChecklistIds = plan.redChecklistIds.slice();\n input.orangeChecklistIds = plan.orangeChecklistIds.slice();\n input.notBriefed = scan.notBriefed.slice();\n input.standings = scan.standings.slice();\n // `say`: this block IS the next action — which reviewers to spawn, where summary.json goes, and\n // the command after that. Capturing it into the log would leave the terminal with a pointer and\n // no instruction, which is the one thing this stage may never do.\n this.stageConsole.say(this.reviewReport.render(input));\n }\n\n /**\n * The applicable checklists that ALREADY ANSWERED and refused, each with its refusal rendered by the ONE\n * renderer `wp-finish-upsert-pr` also uses.\n *\n * Stage ② had the identical defect finish did: a refused checklist has no passing verdict, so it is not\n * in `scan.reviewed`, so it was printed as an ordinary owed reviewer and re-instructed word for word —\n * and an agent that obeys spawns it against unchanged code, gets the same refusal, and loops one stage\n * earlier than the loop that was reported.\n *\n * Nothing is moved: a red verdict stays on disk as its round's record, and the next round's verdict is a\n * new file (issue #1053). The review path IS passed, because the ship-anyway route the refusal prints is a\n * command that writes `override-<id>.json` beside it.\n */\n private refusals(scan: ChecklistScan): RefusedReviewer[] {\n const refused = this.reviewJsonService.refusedChecklists(scan.applicable, scan.results);\n return refused.map((req: RequiredChecklist): RefusedReviewer => new RefusedReviewer(req.id, this.reviewJsonService.refusalError(req, this.reviewJsonService.resolveVerdict(req, scan.results), scan.summaryPath)));\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"review-upsert-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/review-upsert-pr-command.ts"],"names":[],"mappings":";;;;AAAA,+CAAyB;AACzB,0DAAmN;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AC,iBAAiB,CAAC,YAAY,CAAC,GAAG,EAAE,IAAI,CAAC,iBAAiB,CAAC,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IACvN,CAAC;CACJ,CAAA;AAnRY,sDAAqB;gCAArB,qBAAqB;IADjC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAIA,6BAAc;QAChB,mCAAY;QACjB,kBAAO;QACD,8BAAa;QACT,uCAAiB;QACxB,wBAAU;QACZ,oBAAQ;QACA,oCAAgB;QACpB,4BAAY;QACZ,oCAAgB;QACb,mCAAe;QACf,mDAAuB;QAClB,0CAA2B;QACvC,gDAAyB;QAChB,kCAAiB;QAEjB,gCAAiB;QACtB,iCAAc;QACZ,gCAAc;QACtB,4CAAuB;GAtB3C,qBAAqB,CAmRjC","sourcesContent":["import * as fs from 'fs';\nimport { loadAndValidate, writeTemplate, PrGateConfig, RepoRootFinder, RequiredChecklist, ReviewerBriefing, ReviewerInstructionsService, ReviewJsonService, summaryJsonSchemaHint } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { ActiveHatch, ActiveHatchReport } from '../workflow/active-hatches';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { BuildAffected, BuildGateOptions } from '../workflow/build-affected';\nimport { REVIEW_STAGE } from '../workflow/build-gate-log';\nimport { BuildArtifactGate } from '../workflow/build-artifact-gate';\nimport { ChecklistScan, ChecklistScanOptions, ChecklistScanner } from '../workflow/checklist-scanner';\nimport { DiffMaterializer } from '../workflow/diff-materializer';\nimport { GitExec } from '../workflow/git-exec';\nimport { MergeContext } from '../workflow/merge-start';\nimport { MergeEnd, MergeEndOptions } from '../workflow/merge-end';\nimport { MergeState } from '../workflow/merge-state';\nimport { PrContextWriter } from '../workflow/pr-context-writer';\nimport { ReviewerBriefingBuilder } from '../workflow/reviewer-briefing-builder';\nimport { RefusedReviewer, ReviewReport, ReviewReportInput } from '../workflow/review-report';\nimport { ReviewStageReceipt, ReviewStageReceiptService } from '../workflow/review-stage-receipt';\nimport { StageOutputLog, REVIEW_CONSOLE_LOG } from '../workflow/stage-output-log';\nimport { HotfixRedirect } from '../workflow/hotfix-redirect';\nimport {\n ReviewRoundPlan, ReviewRoundStateService, ROUND_ACTION_REVIEW, ROUND_ACTION_RESUME,\n} from '../workflow/review-round-state';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/**\n * `wp-review-upsert-pr` — STAGE ② of the three-stage PR flow, between `wp-start-upsert-pr` (sync from main)\n * and `wp-finish-upsert-pr` (post the PR).\n *\n * It exists because reviewing came before verifying. Under the old two-command flow the 3-point merge was\n * finalized and the build gate ran inside `wp-finish-upsert-pr` — i.e. AFTER the reviewers had already run.\n * A reviewer could therefore spend a full review on an unresolved merge, or on code that does not compile,\n * and only afterwards would the branch be checked. This command puts the verification first:\n *\n * 1. finalize + VALIDATE any in-progress 3-point merge (moved here from finish)\n * 2. assert a clean tree (meaningful now — step 1 committed the resolution)\n * 3. run the build gate (on the merged, committed tree)\n * 4. scan the checklists, EXTRACT the diff, BRIEF the reviewers\n * 5. write the stage receipt, then print what to spawn + the summary.json schema\n *\n * Unlike the report-only command it replaces — which always exited 0, because reporting is not gating — this\n * command CAN FAIL, at steps 1, 2 and 3. That is the point: it fails BEFORE any reviewer is spawned, so a\n * branch with an unresolved merge or a broken build costs zero reviewer tokens.\n *\n * The ordering of 1 → 2 → 3 is load-bearing. MergeEnd stages and commits the conflict resolution, so the\n * tree is clean by the time the build runs; building first would either build a dirty tree (proving nothing\n * about what ships) or refuse a tree that is legitimately mid-resolution.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class ReviewUpsertPrCommand {\n // eslint-disable-next-line @typescript-eslint/max-params\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly gitExec: GitExec,\n private readonly buildAffected: BuildAffected,\n private readonly buildArtifactGate: BuildArtifactGate,\n private readonly mergeState: MergeState,\n private readonly mergeEnd: MergeEnd,\n private readonly checklistScanner: ChecklistScanner,\n private readonly reviewReport: ReviewReport,\n private readonly materializer: DiffMaterializer,\n private readonly prContextWriter: PrContextWriter,\n private readonly briefingBuilder: ReviewerBriefingBuilder,\n private readonly reviewerInstructions: ReviewerInstructionsService,\n private readonly receipts: ReviewStageReceiptService,\n private readonly activeHatchReport: ActiveHatchReport,\n // Injected to RESOLVE + RENDER refusals (see refusals()) and to name each round's verdict file.\n private readonly reviewJsonService: ReviewJsonService,\n private readonly stageConsole: StageOutputLog,\n private readonly hotfixRedirect: HotfixRedirect,\n private readonly rounds: ReviewRoundStateService,\n ) {}\n\n /**\n * Everything below runs with this stage's console CAPTURED to a file (see StageOutputLog). Only the\n * lines an agent must act on before it can do anything else reach the terminal — the build heartbeat\n * and result, and the closing instruction block. The merge validation, the hatch report, the checklist\n * scan and the diff extraction are all in the file, one `grep` away.\n *\n * This is the FIRST half of the fix for the piped-command watchdog kill: an agent pipes a command it\n * expects to flood, a pipe withholds every byte until exit, and the harness kills a command that has\n * printed nothing for 600 seconds — after a full build. Guarding the pipe without first shrinking the\n * output would only have traded that kill for a flooded context.\n */\n async run(): Promise<void> {\n // A /hotfix/ branch has no review stage — it publishes with wp-upsert-hotfix-pr (issue #1057).\n this.hotfixRedirect.assertNotHotfix('wp-review-upsert-pr');\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n await this.stageConsole.withCapture(repoRoot, REVIEW_CONSOLE_LOG, (): Promise<void> => this.runStage(repoRoot));\n }\n\n private async runStage(repoRoot: string): Promise<void> {\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n writeTemplate(repoRoot, 'webpieces.review-checklists.md');\n const featureName = await this.aiBranchName.getFeatureName();\n const config = loadAndValidate(repoRoot).prGate;\n\n const mergeValidated = await this.finalizeAnyInProgressMerge(repoRoot);\n await this.gitExec.assertCleanTree(repoRoot);\n const buildPassedAt = await this.runBuildGate(repoRoot);\n\n const scan = await this.checklistScanner.scan(repoRoot, config.checklists, new ChecklistScanOptions(config.maxReviewerRounds, false, '')); // '' — THIS command writes the context itself, after materializing\n const previousReceipt = this.receipts.read(repoRoot, featureName);\n const plan = await this.rounds.plan(repoRoot, scan.summaryPath, previousReceipt, config.maxReviewerRounds, scan.basis);\n if (plan.action === ROUND_ACTION_RESUME && previousReceipt !== null) {\n this.resumeRound(repoRoot, featureName, scan, previousReceipt, mergeValidated, buildPassedAt);\n this.reportActiveHatches(repoRoot);\n if (scan.reviewersDisabled) this.report(repoRoot, featureName, scan, [], plan, config);\n return;\n }\n const shouldBrief = plan.action === ROUND_ACTION_REVIEW;\n const briefings = shouldBrief\n ? await this.briefReviewers(repoRoot, featureName, scan, config, plan)\n : [];\n const recordedReviewers = briefings.map((b: ReviewerBriefing): string => b.checklistId);\n if (shouldBrief) {\n const receipt = new ReviewStageReceipt(scan.basis.headSha, mergeValidated, this.buildAffected.resolveBuildCommand(repoRoot), buildPassedAt, recordedReviewers);\n receipt.scopeHashes = scan.scopeHashes;\n // Which briefed checklists are OPTIONAL: a round is complete once every REQUIRED one has a\n // verdict, and an optional one joins the round only if it actually submitted (issue #1062).\n receipt.optionalBriefed = briefings.filter((b: ReviewerBriefing): boolean => !b.required).map((b: ReviewerBriefing): string => b.checklistId);\n // A global round begins only when a non-empty fixed roster is actually briefed.\n receipt.round = recordedReviewers.length === 0 ? 0 : plan.round;\n receipt.maxReviewerRounds = plan.maxRounds;\n this.receipts.write(repoRoot, featureName, receipt);\n } else if (previousReceipt !== null) {\n previousReceipt.buildHeadSha = scan.basis.headSha;\n previousReceipt.mergeValidated = mergeValidated;\n previousReceipt.buildCommand = this.buildAffected.resolveBuildCommand(repoRoot);\n previousReceipt.buildPassedAt = buildPassedAt;\n this.receipts.write(repoRoot, featureName, previousReceipt);\n }\n this.reportActiveHatches(repoRoot);\n this.report(repoRoot, featureName, scan, briefings, plan, config);\n }\n\n /** Keep the original briefing, diff, roster and provenance intact while refreshing build evidence. */\n // eslint-disable-next-line @typescript-eslint/max-params\n private resumeRound(\n repoRoot: string,\n featureName: string,\n scan: ChecklistScan,\n receipt: ReviewStageReceipt,\n mergeValidated: boolean,\n buildPassedAt: string,\n ): void {\n receipt.buildHeadSha = scan.basis.headSha;\n receipt.mergeValidated = mergeValidated;\n receipt.buildCommand = this.buildAffected.resolveBuildCommand(repoRoot);\n receipt.buildPassedAt = buildPassedAt;\n this.receipts.write(repoRoot, featureName, receipt);\n // The scanner owns reviewer suppression. Keep the historical roster for later recovery, but\n // never instruct it to run while the existing opt-out is active.\n if (scan.reviewersDisabled) return;\n const pending = receipt.reviewersBriefed.filter(\n (id: string): boolean =>\n !receipt.optionalBriefed.includes(id) &&\n !this.rounds.hasVerdict(scan.summaryPath, id, receipt.round),\n );\n this.stageConsole.say(\n `\\nResume the existing reviewer roster: round ${receipt.round} of ${receipt.maxReviewerRounds}.\\n` +\n `Build passed at ${receipt.buildHeadSha}; reviewers retain their briefing at ${receipt.headSha}.\\n` +\n 'Continue the existing reviewer agents; do not respawn them for a SHA or fork-point change.\\n' +\n pending\n .map(\n (id: string): string =>\n ` REQUIRED ${id}: ${this.reviewerInstructions.pathFor(repoRoot, featureName, id)}\\n` +\n ` Submit with: pnpm wp-write-review --checklist ${id} --file '<verdict JSON file>'\\n`,\n )\n .join('') +\n `\\nBefore reviewers read it, write ${scan.summaryPath}, or keep its unchanged same-PR metadata.\\n` +\n 'Explicitly refresh it when intent, issue, title or risk changes.\\n' +\n `${summaryJsonSchemaHint(scan.summaryPath)}\\n` +\n 'Then run: pnpm wp-review-upsert-pr (to plan any RED follow-up), followed by pnpm wp-finish-upsert-pr.\\n',\n );\n }\n\n /**\n * List every rule that is currently switched off in webpieces.config.json. NON-BLOCKING and printed\n * before the instruction block, because it is context for the review rather than a step in it.\n *\n * A hatch is the one config change that makes the build QUIETER, so no gate, reviewer or red check\n * will ever mention it — which is how a repo ends up with rules off for weeks that nobody chose to\n * leave off. This is the only place in the flow that says so out loud.\n */\n private reportActiveHatches(repoRoot: string): void {\n const hatches: ActiveHatch[] = this.activeHatchReport.scan(repoRoot);\n process.stdout.write(this.activeHatchReport.render(hatches));\n }\n\n /**\n * Validate + commit + finalize a conflict resolution, if one is in flight. MOVED here from\n * `wp-finish-upsert-pr` so that exactly one command owns merge finalization — two owners is the drift\n * failure `PrContextWriter`'s own docstring records having already happened once in this codebase.\n *\n * MergeEnd's three checks are what \"did the AI do the 3-point merge right?\" means concretely: no\n * conflict markers left in the scoped files, `git diff --diff-filter=U` empty, and a non-empty\n * merge-explanation.md beside every conflicted file.\n *\n * Returns true when a merge was finalized OR there was none to finalize; it throws rather than returning\n * false when validation fails, so the receipt can never record an unvalidated merge as validated.\n */\n private async finalizeAnyInProgressMerge(repoRoot: string): Promise<boolean> {\n const home = this.mergeState.mergeDirFor(repoRoot, await this.aiBranchName.getFeatureName());\n const activeDir = this.mergeState.findActiveMergeRunDir(home);\n const marker = activeDir ? this.mergeState.readMergeMarker(activeDir) : null;\n if (!activeDir || !marker || marker.validated) return true;\n process.stdout.write('\\n' + SEP + '① Validating your 3-point merge\\n' + SEP + '\\n');\n // pushRemote:false — finish still owns the single push.\n await this.mergeEnd.mergeEnd(repoRoot, 'wp-review-upsert-pr', activeDir, new MergeContext(marker.currentBranch, marker.squashBranch, marker.backupBranch, marker.prNumber), new MergeEndOptions(marker.conflictedFiles, false));\n return true;\n }\n\n /**\n * The build gate, run BEFORE any reviewer is briefed. Returns the ISO time it passed, for the receipt —\n * which is what lets `wp-finish-upsert-pr` skip its own gate when HEAD has not moved, so moving the gate\n * earlier did not turn one build into two.\n */\n private async runBuildGate(repoRoot: string): Promise<string> {\n await this.buildAffected.runBuildGate(repoRoot, new BuildGateOptions('🛠️ Build gate', 'pnpm wp-review-upsert-pr', 'Build failed — NO reviewer was briefed and no diff was extracted. Fix it, then re-run.', REVIEW_STAGE));\n // Repo-wide: the build must not have left anything uncommitted AND unstaged. Runs HERE, not in\n // finish, because this is the stage that ran buildCommand and is therefore holding the dirty\n // tree at the exact moment the question is answerable. Replaces the per-project\n // validate-di-graph-unchanged nx target — see BuildArtifactGate for why that one had to go.\n await this.buildArtifactGate.assertBuildLeftNothingUncommitted(repoRoot);\n return new Date().toISOString();\n }\n\n /**\n * Extract the diff once, then write one instructions file per reviewer.\n *\n * The changed-file set and the basis both come off the SCAN rather than being recomputed, so the diff a\n * reviewer reads covers exactly the files its checklist matched against.\n */\n private async briefReviewers(repoRoot: string, featureName: string, scan: ChecklistScan, config: PrGateConfig, plan: ReviewRoundPlan): Promise<ReviewerBriefing[]> {\n if (plan.basis.unresolved) return [];\n const changedFiles = plan.round > 1 ? plan.changedFiles : scan.changedFiles;\n const manifest = await this.materializer.materialize(repoRoot, featureName, plan.basis, changedFiles, config.reviewDiffExclude);\n const diffDir = this.materializer.diffDirFor(repoRoot, featureName);\n // Write pr-context.json ONCE, here — after materializing, so `diffDir` is populated on the first\n // write. The scan deliberately did not write it (ChecklistScanOptions.contextStage === ''); it used\n // to, which meant this command wrote the same file twice, the first time with an empty diffDir.\n // `scan.changedFiles` is passed through so the context is not recomputed from a second git call.\n scan.context = await this.prContextWriter.ensure(repoRoot, featureName, plan.basis, 'stage2-review', changedFiles, diffDir);\n // ONLY the checklists still owed a verdict (issue #863). A green or yellow CARRIES whatever changed\n // since (issue #1053) — the scan left it in `reviewed` — so briefing it again would pay a reviewer to\n // re-read code it already judged. A later round re-briefs exactly the previous round's REDS.\n const reviewedIds = new Set(scan.reviewed.map((r: RequiredChecklist): string => r.id));\n const owed = scan.applicable.filter((r: RequiredChecklist): boolean => plan.round > 1\n ? plan.redChecklistIds.includes(r.id)\n : !reviewedIds.has(r.id));\n const briefings = this.briefingBuilder.build(repoRoot, scan, owed, manifest, diffDir, config);\n const dir = this.reviewerInstructions.instructionsDirFor(repoRoot, featureName);\n fs.rmSync(dir, { recursive: true, force: true }); // stale instructions read as current are worse than none\n fs.mkdirSync(dir, { recursive: true });\n for (const b of briefings) {\n b.round = plan.round;\n b.maxRounds = plan.maxRounds;\n b.verdictPath = this.reviewJsonService.checklistResultPath(scan.summaryPath, b.checklistId, plan.round);\n b.remediationOnly = plan.round > 1;\n if (b.remediationOnly) {\n b.previousVerdictPath = this.reviewJsonService.checklistResultPath(scan.summaryPath, b.checklistId, plan.round - 1);\n b.remediationPath = this.rounds.fixesPath(scan.summaryPath, plan.round - 1);\n }\n fs.writeFileSync(this.reviewerInstructions.pathFor(repoRoot, featureName, b.checklistId), this.reviewerInstructions.render(b));\n }\n return briefings;\n }\n\n /**\n * What the AI must do next — rendered by `ReviewReport`, which owns the ordering.\n *\n * The rendering moved OUT of this command so the ordering could be asserted on as a string. It had a\n * real bug: the zero-checklist notice signed off with \"Carry on and run: pnpm wp-finish-upsert-pr\"\n * while the block right beneath it said to write summary.json first. An agent that reads top to bottom\n * obeyed the first line and posted a PR with no review at all.\n */\n // eslint-disable-next-line @typescript-eslint/max-params\n private report(repoRoot: string, featureName: string, scan: ChecklistScan, briefings: readonly ReviewerBriefing[], plan: ReviewRoundPlan, config: PrGateConfig): void {\n const input = new ReviewReportInput(repoRoot, featureName, scan.summaryPath);\n input.definedCount = scan.defined.length;\n input.applicableCount = scan.applicable.length;\n input.reviewed = scan.reviewed.slice();\n input.formatErrors = scan.formatErrors.slice();\n input.briefings = briefings.slice();\n input.refused = this.refusals(scan);\n input.reviewer = config.reviewer;\n // Straight off the SCAN — the one place `experimental.turnOffAllReviewers` is read. This command\n // deliberately does NOT consult the home config itself: a second read is a second answer, and the\n // command that lists and the command that blocks would be free to disagree about whether a branch\n // was reviewed. See ChecklistScanner.\n input.reviewersSuppressed = scan.reviewersDisabled;\n input.suppressed = scan.suppressed.slice();\n input.round = plan.round;\n input.maxReviewerRounds = plan.maxRounds;\n input.roundAction = plan.action;\n input.redChecklistIds = plan.redChecklistIds.slice();\n input.orangeChecklistIds = plan.orangeChecklistIds.slice();\n input.notBriefed = scan.notBriefed.slice();\n input.standings = scan.standings.slice();\n // `say`: this block IS the next action — which reviewers to spawn, where summary.json goes, and\n // the command after that. Capturing it into the log would leave the terminal with a pointer and\n // no instruction, which is the one thing this stage may never do.\n this.stageConsole.say(this.reviewReport.render(input));\n }\n\n /**\n * The applicable checklists that ALREADY ANSWERED and refused, each with its refusal rendered by the ONE\n * renderer `wp-finish-upsert-pr` also uses.\n *\n * Stage ② had the identical defect finish did: a refused checklist has no passing verdict, so it is not\n * in `scan.reviewed`, so it was printed as an ordinary owed reviewer and re-instructed word for word —\n * and an agent that obeys spawns it against unchanged code, gets the same refusal, and loops one stage\n * earlier than the loop that was reported.\n *\n * Nothing is moved: a red verdict stays on disk as its round's record, and the next round's verdict is a\n * new file (issue #1053). The review path IS passed, because the ship-anyway route the refusal prints is a\n * command that writes `override-<id>.json` beside it.\n */\n private refusals(scan: ChecklistScan): RefusedReviewer[] {\n const refused = this.reviewJsonService.refusedChecklists(scan.applicable, scan.results);\n return refused.map((req: RequiredChecklist): RefusedReviewer => new RefusedReviewer(req.id, this.reviewJsonService.refusalError(req, this.reviewJsonService.resolveVerdict(req, scan.results), scan.summaryPath)));\n }\n}\n"]}
|
|
@@ -79,7 +79,7 @@ let StartUpsertPrCommand = class StartUpsertPrCommand {
|
|
|
79
79
|
(0, rules_config_1.writeTemplate)(repoRoot, 'webpieces.review-checklists.md');
|
|
80
80
|
// Persist the PR diff context (base sha + the full changed-file set) so it exists even if the AI
|
|
81
81
|
// stops here. Stage ② rewrites it with the materialized-diff dir once it has one.
|
|
82
|
-
const context = this.prContextWriter.ensure(repoRoot, await this.aiBranchName.getFeatureName(), await this.diffBasisResolver.resolve(repoRoot), 'stage1-start');
|
|
82
|
+
const context = await this.prContextWriter.ensure(repoRoot, await this.aiBranchName.getFeatureName(), await this.diffBasisResolver.resolve(repoRoot), 'stage1-start');
|
|
83
83
|
process.stdout.write('\n' + SEP + '② Brief the reviewers and write the PR summary, then finish\n' + SEP + '\n');
|
|
84
84
|
process.stdout.write(`Branch is updated (nothing pushed yet — finish does the one push, behind the build gate).\n` +
|
|
85
85
|
`${this.contextLines(context)}\n` +
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-upsert-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/start-upsert-pr-command.ts"],"names":[],"mappings":";;;;AAAA,0DAA8G;AAC9G,yCAA2D;AAC3D,2EAAgE;AAChE,6DAAyD;AACzD,uDAA2D;AAC3D,mDAA+C;AAC/C,qEAAgE;AAChE,uDAAmD;AACnD,iEAA6D;AAE7D,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,0GAA0G;AAC1G,4DAA4D;AAC5D,EAAE;AACF,4GAA4G;AAC5G,2GAA2G;AAC3G,0GAA0G;AAC1G,0GAA0G;AAC1G,2GAA2G;AAC3G,EAAE;AACF,sGAAsG;AACtG,iEAAiE;AAE1D,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAER;IACA;IACA;IACA;IACA;IACA;IACA;IACA;IARrB,YACqB,cAA8B,EAC9B,YAA0B,EAC1B,YAA0B,EAC1B,OAAgB,EAChB,SAAoB,EACpB,iBAAoC,EACpC,eAAgC,EAChC,cAA8B;QAP9B,mBAAc,GAAd,cAAc,CAAgB;QAC9B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,iBAAY,GAAZ,YAAY,CAAc;QAC1B,YAAO,GAAP,OAAO,CAAS;QAChB,cAAS,GAAT,SAAS,CAAW;QACpB,sBAAiB,GAAjB,iBAAiB,CAAmB;QACpC,oBAAe,GAAf,eAAe,CAAiB;QAChC,mBAAc,GAAd,cAAc,CAAgB;IAChD,CAAC;IAEJ,KAAK,CAAC,GAAG;QACL,qGAAqG;QACrG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,oBAAoB,CAAC,CAAC;QAC1D,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,eAAe,CAAC,OAAO,CAAC,GAAG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AAK,EAAE;YAAE,OAAO,EAAE,CAAC;QAC7C,MAAM,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAC9D,OAAO,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,GAAG,IAAI,EAAE,GAAG,2CAA2C,OAAO,CAAC,aAAa,IAAI,CAAC;IAChI,CAAC;IAED,oGAAoG;IACpG,sGAAsG;IACtG,mGAAmG;IAC3F,KAAK,CAAC,oBAAoB,CAAC,QAAgB;QAC/C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,GAAG,GAAG,+BAA+B,GAAG,GAAG,GAAG,IAAI,CAAC,CAAC;QAChF,wEAAwE;QACxE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,QAAQ,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;QACrH,IAAI,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,mBAAmB,EAAE,CAAC;YAC5D,MAAM,IAAI,2BAAY,CAAC,CAAC,EAAE,4IAA4I,CAAC,CAAC;QAC5K,CAAC;IACL,CAAC;CACJ,CAAA;AApFY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGA,6BAAc;QAChB,mCAAY;QACZ,4BAAY;QACjB,kBAAO;QACL,sBAAS;QACD,8BAAiB;QACnB,mCAAe;QAChB,gCAAc;GAT1C,oBAAoB,CAoFhC","sourcesContent":["import { writeTemplate, CliExitError, RepoRootFinder, ChecklistReviewContext } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { BranchNaming } from '../workflow/branch-naming';\nimport { DiffBasisResolver } from '../workflow/diff-basis';\nimport { GitExec } from '../workflow/git-exec';\nimport { PrContextWriter } from '../workflow/pr-context-writer';\nimport { RunUpdate } from '../workflow/run-update';\nimport { HotfixRedirect } from '../workflow/hotfix-redirect';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n// STAGE ① of the AI-first PR flow: the deterministic setup — update from main / drive the 3-point merge —\n// then hand the AI ONE next command, `wp-review-upsert-pr`.\n//\n// It runs NO build gate, and that is still deliberate, but the reason has changed. It is not that the build\n// belongs only at the end: it is that at THIS point a conflicted 3-point merge may still be unresolved, so\n// there is nothing worth building yet. The gate moved FORWARD, not away — stage ② finalizes the merge and\n// then builds, so reviewers never judge a branch that does not compile, and wp-finish-upsert-pr skips the\n// rebuild when HEAD has not moved since. `pr-gate.buildCommand` is therefore no longer a finish-only knob.\n//\n// This command NEVER creates/updates a PR and NEVER pushes: all `gh` posting and the ONE push live in\n// finish, behind summary.json + the checklists + the build gate.\n@injectable(bindingScopeValues.Singleton)\nexport class StartUpsertPrCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly branchNaming: BranchNaming,\n private readonly gitExec: GitExec,\n private readonly runUpdate: RunUpdate,\n private readonly diffBasisResolver: DiffBasisResolver,\n private readonly prContextWriter: PrContextWriter,\n private readonly hotfixRedirect: HotfixRedirect,\n ) {}\n\n async run(): Promise<void> {\n // FIRST, before anything is written or merged: a /hotfix/ branch must never take main (issue #1057).\n this.hotfixRedirect.assertNotHotfix('wp-start-upsert-pr');\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n // Refresh the AI-facing workflow doc so it's present + current for any failure message to cite.\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n // NOTE: the server-side CI gate is NOT scaffolded here any more — `wp-install-ai-hooks` owns it.\n // This printed copy-to-.github + branch-protection instructions on EVERY run, at an agent doing\n // feature work that could not act on them: marking a check required needs a repo admin. Setup\n // belongs in the setup command; see templates/webpieces.ci-gate-setup.md.\n\n // Precondition: a fully-committed tree. This flow squash-updates the branch and builds it — the\n // tooling must not commit your work for you, and building a dirty working tree would let an\n // uncommitted change build green over a different commit than the one that ships. Fail if dirty.\n await this.gitExec.assertCleanTree(repoRoot);\n\n // Nothing here pushes. This command reviews; wp-finish-upsert-pr pushes ONCE, after summary.json,\n // every BLOCK checklist, and the authoritative build gate — so no unreviewed commit reaches the\n // remote, and there is no early `synchronize` firing against a PR body with a stale gate token.\n await this.updateBranchFromMain(repoRoot);\n\n // No build gate here — a conflicted merge may still be unresolved, so there is nothing worth\n // building. Stage ② finalizes the merge FIRST, then builds; see the class comment.\n await this.handOffToReview(repoRoot);\n }\n\n /**\n * Hand the AI its ONE next step: `wp-review-upsert-pr`.\n *\n * This prints exactly one command on purpose. It used to print three (run the checklist, write\n * summary.json, then finish), and a three-item list is a list with a step to skip. Stage ② now owns all\n * of it — it validates the 3-point merge, builds, materializes the diff, briefs the reviewers, AND\n * prints the summary.json schema — so there is nothing here to enumerate. Notably summary.json is NOT\n * requested here any more: asking for a written PR summary before the branch is known to compile invites\n * one that describes code that does not build.\n */\n private async handOffToReview(repoRoot: string): Promise<void> {\n // Persist the review-format + process instructions where any failure message can cite them.\n writeTemplate(repoRoot, 'webpieces.review-checklists.md');\n // Persist the PR diff context (base sha + the full changed-file set) so it exists even if the AI\n // stops here. Stage ② rewrites it with the materialized-diff dir once it has one.\n const context = this.prContextWriter.ensure(repoRoot, await this.aiBranchName.getFeatureName(), await this.diffBasisResolver.resolve(repoRoot), 'stage1-start');\n process.stdout.write('\\n' + SEP + '② Brief the reviewers and write the PR summary, then finish\\n' + SEP + '\\n');\n process.stdout.write(\n `Branch is updated (nothing pushed yet — finish does the one push, behind the build gate).\\n` +\n `${this.contextLines(context)}\\n` +\n `▶ NEXT run: pnpm wp-review-upsert-pr\\n` +\n ` It validates the 3-point merge, runs the build gate, extracts this branch's diff for the\\n` +\n ` reviewers, and prints what to spawn plus the summary.json schema. Everything else waits on it —\\n` +\n ` wp-finish-upsert-pr refuses to open a PR until it has run.\\n\\n`,\n );\n }\n\n // The diff facts, stated where the instruction to use them is — not in a separate block above it. The\n // command comes from the resolved basis; hand-writing `<base> HEAD` here is empty on a dirty tree.\n private contextLines(context: ChecklistReviewContext): string {\n if (context.baseSha.trim() === '') return '';\n const cmd = context.fileDiffCommand.replace(' -- <file>', '');\n return `${cmd === '' ? '' : `Your diff: ${cmd}\\n`}` + `Full changed-file set + base/head sha: ${context.prContextPath}\\n`;\n }\n\n // Bring the branch up to date with main via the shared 3-point engine (in-process). On conflict the\n // merge process doc it writes names `wp-review-upsert-pr` as the finish command — that is the command\n // that now validates and commits a conflict resolution, so it is what the doc must send the AI to.\n private async updateBranchFromMain(repoRoot: string): Promise<void> {\n process.stdout.write('\\n' + SEP + '① Updating branch from main\\n' + SEP + '\\n');\n // pushRemote=false — finish owns the single push (see MergeEndOptions).\n const outcome = await this.runUpdate.runUpdateFromMain(repoRoot, 'wp-start-upsert-pr', 'wp-review-upsert-pr', false);\n if (outcome === 'conflict' || outcome === 'unvalidatedResume') {\n throw new CliExitError(2, '\\n⏸️ Conflicts — resolve them, then run pnpm wp-review-upsert-pr (it validates the merge, builds it, and only then briefs the reviewers).');\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"start-upsert-pr-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands/start-upsert-pr-command.ts"],"names":[],"mappings":";;;;AAAA,0DAA8G;AAC9G,yCAA2D;AAC3D,2EAAgE;AAChE,6DAAyD;AACzD,uDAA2D;AAC3D,mDAA+C;AAC/C,qEAAgE;AAChE,uDAAmD;AACnD,iEAA6D;AAE7D,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,0GAA0G;AAC1G,4DAA4D;AAC5D,EAAE;AACF,4GAA4G;AAC5G,2GAA2G;AAC3G,0GAA0G;AAC1G,0GAA0G;AAC1G,2GAA2G;AAC3G,EAAE;AACF,sGAAsG;AACtG,iEA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AAQ,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,KAAK,CAAC,CAAC;QACrH,IAAI,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,mBAAmB,EAAE,CAAC;YAC5D,MAAM,IAAI,2BAAY,CAAC,CAAC,EAAE,4IAA4I,CAAC,CAAC;QAC5K,CAAC;IACL,CAAC;CACJ,CAAA;AApFY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,EAAC,8BAAkB,CAAC,SAAS,CAAC;6CAGA,6BAAc;QAChB,mCAAY;QACZ,4BAAY;QACjB,kBAAO;QACL,sBAAS;QACD,8BAAiB;QACnB,mCAAe;QAChB,gCAAc;GAT1C,oBAAoB,CAoFhC","sourcesContent":["import { writeTemplate, CliExitError, RepoRootFinder, ChecklistReviewContext } from '@webpieces/rules-config';\nimport { injectable, bindingScopeValues } from 'inversify';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { BranchNaming } from '../workflow/branch-naming';\nimport { DiffBasisResolver } from '../workflow/diff-basis';\nimport { GitExec } from '../workflow/git-exec';\nimport { PrContextWriter } from '../workflow/pr-context-writer';\nimport { RunUpdate } from '../workflow/run-update';\nimport { HotfixRedirect } from '../workflow/hotfix-redirect';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n// STAGE ① of the AI-first PR flow: the deterministic setup — update from main / drive the 3-point merge —\n// then hand the AI ONE next command, `wp-review-upsert-pr`.\n//\n// It runs NO build gate, and that is still deliberate, but the reason has changed. It is not that the build\n// belongs only at the end: it is that at THIS point a conflicted 3-point merge may still be unresolved, so\n// there is nothing worth building yet. The gate moved FORWARD, not away — stage ② finalizes the merge and\n// then builds, so reviewers never judge a branch that does not compile, and wp-finish-upsert-pr skips the\n// rebuild when HEAD has not moved since. `pr-gate.buildCommand` is therefore no longer a finish-only knob.\n//\n// This command NEVER creates/updates a PR and NEVER pushes: all `gh` posting and the ONE push live in\n// finish, behind summary.json + the checklists + the build gate.\n@injectable(bindingScopeValues.Singleton)\nexport class StartUpsertPrCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly aiBranchName: AiBranchName,\n private readonly branchNaming: BranchNaming,\n private readonly gitExec: GitExec,\n private readonly runUpdate: RunUpdate,\n private readonly diffBasisResolver: DiffBasisResolver,\n private readonly prContextWriter: PrContextWriter,\n private readonly hotfixRedirect: HotfixRedirect,\n ) {}\n\n async run(): Promise<void> {\n // FIRST, before anything is written or merged: a /hotfix/ branch must never take main (issue #1057).\n this.hotfixRedirect.assertNotHotfix('wp-start-upsert-pr');\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n // Refresh the AI-facing workflow doc so it's present + current for any failure message to cite.\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n // NOTE: the server-side CI gate is NOT scaffolded here any more — `wp-install-ai-hooks` owns it.\n // This printed copy-to-.github + branch-protection instructions on EVERY run, at an agent doing\n // feature work that could not act on them: marking a check required needs a repo admin. Setup\n // belongs in the setup command; see templates/webpieces.ci-gate-setup.md.\n\n // Precondition: a fully-committed tree. This flow squash-updates the branch and builds it — the\n // tooling must not commit your work for you, and building a dirty working tree would let an\n // uncommitted change build green over a different commit than the one that ships. Fail if dirty.\n await this.gitExec.assertCleanTree(repoRoot);\n\n // Nothing here pushes. This command reviews; wp-finish-upsert-pr pushes ONCE, after summary.json,\n // every BLOCK checklist, and the authoritative build gate — so no unreviewed commit reaches the\n // remote, and there is no early `synchronize` firing against a PR body with a stale gate token.\n await this.updateBranchFromMain(repoRoot);\n\n // No build gate here — a conflicted merge may still be unresolved, so there is nothing worth\n // building. Stage ② finalizes the merge FIRST, then builds; see the class comment.\n await this.handOffToReview(repoRoot);\n }\n\n /**\n * Hand the AI its ONE next step: `wp-review-upsert-pr`.\n *\n * This prints exactly one command on purpose. It used to print three (run the checklist, write\n * summary.json, then finish), and a three-item list is a list with a step to skip. Stage ② now owns all\n * of it — it validates the 3-point merge, builds, materializes the diff, briefs the reviewers, AND\n * prints the summary.json schema — so there is nothing here to enumerate. Notably summary.json is NOT\n * requested here any more: asking for a written PR summary before the branch is known to compile invites\n * one that describes code that does not build.\n */\n private async handOffToReview(repoRoot: string): Promise<void> {\n // Persist the review-format + process instructions where any failure message can cite them.\n writeTemplate(repoRoot, 'webpieces.review-checklists.md');\n // Persist the PR diff context (base sha + the full changed-file set) so it exists even if the AI\n // stops here. Stage ② rewrites it with the materialized-diff dir once it has one.\n const context = await this.prContextWriter.ensure(repoRoot, await this.aiBranchName.getFeatureName(), await this.diffBasisResolver.resolve(repoRoot), 'stage1-start');\n process.stdout.write('\\n' + SEP + '② Brief the reviewers and write the PR summary, then finish\\n' + SEP + '\\n');\n process.stdout.write(\n `Branch is updated (nothing pushed yet — finish does the one push, behind the build gate).\\n` +\n `${this.contextLines(context)}\\n` +\n `▶ NEXT run: pnpm wp-review-upsert-pr\\n` +\n ` It validates the 3-point merge, runs the build gate, extracts this branch's diff for the\\n` +\n ` reviewers, and prints what to spawn plus the summary.json schema. Everything else waits on it —\\n` +\n ` wp-finish-upsert-pr refuses to open a PR until it has run.\\n\\n`,\n );\n }\n\n // The diff facts, stated where the instruction to use them is — not in a separate block above it. The\n // command comes from the resolved basis; hand-writing `<base> HEAD` here is empty on a dirty tree.\n private contextLines(context: ChecklistReviewContext): string {\n if (context.baseSha.trim() === '') return '';\n const cmd = context.fileDiffCommand.replace(' -- <file>', '');\n return `${cmd === '' ? '' : `Your diff: ${cmd}\\n`}` + `Full changed-file set + base/head sha: ${context.prContextPath}\\n`;\n }\n\n // Bring the branch up to date with main via the shared 3-point engine (in-process). On conflict the\n // merge process doc it writes names `wp-review-upsert-pr` as the finish command — that is the command\n // that now validates and commits a conflict resolution, so it is what the doc must send the AI to.\n private async updateBranchFromMain(repoRoot: string): Promise<void> {\n process.stdout.write('\\n' + SEP + '① Updating branch from main\\n' + SEP + '\\n');\n // pushRemote=false — finish owns the single push (see MergeEndOptions).\n const outcome = await this.runUpdate.runUpdateFromMain(repoRoot, 'wp-start-upsert-pr', 'wp-review-upsert-pr', false);\n if (outcome === 'conflict' || outcome === 'unvalidatedResume') {\n throw new CliExitError(2, '\\n⏸️ Conflicts — resolve them, then run pnpm wp-review-upsert-pr (it validates the merge, builds it, and only then briefs the reviewers).');\n }\n }\n}\n"]}
|
|
@@ -78,7 +78,7 @@ let SyncMainCommand = class SyncMainCommand {
|
|
|
78
78
|
// (or report) about the rest. Spelled out rather than defaulted so that if CleanupOptions ever
|
|
79
79
|
// grows a field, this call site is a compile error instead of a silent old behaviour.
|
|
80
80
|
await this.cleanupCommand.run(new cleanup_options_1.CleanupOptions(new cleanup_options_1.DeleteSelection(cleanup_options_1.FLAG_DELETE_BRANCHES, false, ''), new cleanup_options_1.DeleteSelection(cleanup_options_1.FLAG_DELETE_WORKTREES, false, ''), false, false, false));
|
|
81
|
-
this.sweep(repoRoot);
|
|
81
|
+
await this.sweep(repoRoot);
|
|
82
82
|
this.reportStashed(stashed);
|
|
83
83
|
}
|
|
84
84
|
/**
|
|
@@ -94,7 +94,7 @@ let SyncMainCommand = class SyncMainCommand {
|
|
|
94
94
|
+ 'Most worktrees never need this: `wp-cleanup` removes the whole directory once its branch\n'
|
|
95
95
|
+ 'lands, which takes any orphan directories inside it along. Run this command again from the\n'
|
|
96
96
|
+ 'primary clone to go to main there.\n\n');
|
|
97
|
-
this.sweep(repoRoot);
|
|
97
|
+
await this.sweep(repoRoot);
|
|
98
98
|
return Promise.resolve();
|
|
99
99
|
}
|
|
100
100
|
isLinkedWorktree(repoRoot) {
|
|
@@ -132,8 +132,8 @@ let SyncMainCommand = class SyncMainCommand {
|
|
|
132
132
|
* Sweep, then print. Never throws: the checkout and pull above already succeeded, and a tidier is not
|
|
133
133
|
* permitted to turn somebody's completed sync into a failed command.
|
|
134
134
|
*/
|
|
135
|
-
sweep(repoRoot) {
|
|
136
|
-
const report = this.orphanDirSweeper.sweep(repoRoot, new Date());
|
|
135
|
+
async sweep(repoRoot) {
|
|
136
|
+
const report = await this.orphanDirSweeper.sweep(repoRoot, new Date());
|
|
137
137
|
const rendered = report.render();
|
|
138
138
|
if (rendered === '')
|
|
139
139
|
return;
|