@webpieces/pr-gate 0.3.291 → 0.3.293
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 +2 -2
- package/src/scripts/git-finishUpsertPr.js +36 -20
- package/src/scripts/git-finishUpsertPr.js.map +1 -1
- package/src/scripts/workflow/branch-naming.d.ts +9 -5
- package/src/scripts/workflow/branch-naming.js +33 -22
- package/src/scripts/workflow/branch-naming.js.map +1 -1
- package/src/scripts/workflow/git-readAiBranchName.js +2 -2
- package/src/scripts/workflow/git-readAiBranchName.js.map +1 -1
- package/src/scripts/workflow/merge-end.js +55 -15
- package/src/scripts/workflow/merge-end.js.map +1 -1
- package/src/scripts/workflow/merge-start.d.ts +3 -2
- package/src/scripts/workflow/merge-start.js +56 -22
- package/src/scripts/workflow/merge-start.js.map +1 -1
- package/src/scripts/workflow/merge-state.d.ts +2 -0
- package/src/scripts/workflow/merge-state.js +32 -0
- package/src/scripts/workflow/merge-state.js.map +1 -1
- package/src/scripts/workflow/open-pr-check.js +1 -1
- package/src/scripts/workflow/open-pr-check.js.map +1 -1
- package/src/scripts/workflow/run-update.js +12 -13
- package/src/scripts/workflow/run-update.js.map +1 -1
- package/src/scripts/wp-start-upsert-pr.js +2 -1
- package/src/scripts/wp-start-upsert-pr.js.map +1 -1
- package/src/scripts/wp-update-end.js +6 -4
- package/src/scripts/wp-update-end.js.map +1 -1
- package/src/scripts/wp-update-start.js +9 -9
- package/src/scripts/wp-update-start.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wp-update-end.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-update-end.ts"],"names":[],"mappings":";;;AAeA,
|
|
1
|
+
{"version":3,"file":"wp-update-end.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-update-end.ts"],"names":[],"mappings":";;;AAeA,oBAuBC;AArCD,iDAAyC;AACzC,0DAAgE;AAChE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IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { execSync } from 'child_process';\nimport { CliExitError, runMain } from '@webpieces/rules-config';\nimport { getFeatureName } from './workflow/git-readAiBranchName';\nimport { mergeDirFor, readMergeMarker, findActiveMergeRunDir } from './workflow/merge-state';\nimport { mergeEnd } from './workflow/merge-end';\nimport { MergeContext } from './workflow/merge-start';\n\n// wp-update-end — finalize half of the 3-point squash-merge lifecycle. Run it AFTER `wp-update-start`\n// handed back conflicts and you resolved them. Given an in-progress merge marker it validates +\n// commits the AI's resolution (when the marker is not yet validated) and ALWAYS finalizes the branch\n// swap (squash→feature, push, stamp clean, clear marker). It does NOT run the build gate / dashboard\n// / PR — that is wp-finish-upsert-pr (the PR flow's finish). Refuses to run when there is no merge in\n// progress (a clean `wp-update-start` finalizes on its own — there is nothing left for this to do).\n\nexport async function main(): Promise<void> {\n const repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();\n const home = mergeDirFor(repoRoot, getFeatureName());\n\n // The in-progress merge is the `merge-<n>/` run dir holding a marker.\n const activeDir = findActiveMergeRunDir(home);\n const marker = activeDir ? readMergeMarker(activeDir) : null;\n if (!activeDir || !marker) {\n throw new CliExitError(1,\n '❌ No merge in progress (no marker) — nothing to finalize.\\n' +\n 'Start one with: pnpm wp-update-start (a clean update finalizes itself).',\n );\n }\n\n // Not yet validated => a conflict resolution the AI owns, so validate + commit it first; already\n // validated => clean merge (or previously validated) => finalize only.\n const conflictedFiles = marker.validated ? null : marker.conflictedFiles;\n await mergeEnd(\n repoRoot, 'wp-update-end', activeDir,\n new MergeContext(marker.currentBranch, marker.squashBranch, marker.backupBranch, marker.prNumber),\n conflictedFiles,\n );\n process.stdout.write('\\n✅ Merge finalized on ' + marker.currentBranch + '.\\n');\n}\n\nif (require.main === module) runMain(main);\n"]}
|
|
@@ -13,21 +13,21 @@ const run_update_1 = require("./workflow/run-update");
|
|
|
13
13
|
// on CONFLICT it writes the 3-point context + merge process doc and hands back — you resolve, then
|
|
14
14
|
// run `wp-update-end` to finalize. It NEVER creates a PR (that is the wp-*-upsert-pr flow).
|
|
15
15
|
const SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n';
|
|
16
|
-
// If a PR is already OPEN for this branch, wp-update-start must refuse. The 3-point update
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
// PR flow (wp-start-upsert-pr → wp-finish-upsert-pr) is the ONLY correct
|
|
20
|
-
// re-merges main AND updates the PR. Fail fast and steer there. (openPrForBranch
|
|
21
|
-
// GitHub can't be reached — we never assume "no PR" when we simply couldn't ask.)
|
|
16
|
+
// If a PR is already OPEN for this branch, wp-update-start must refuse. The 3-point update re-squashes
|
|
17
|
+
// your branch onto main and force-pushes it to origin/<feature> — the PR head — but it does NOT refresh
|
|
18
|
+
// the PR body/review or run the authoritative build gate. So it would push new code onto an open PR
|
|
19
|
+
// without an updated review. The PR flow (wp-start-upsert-pr → wp-finish-upsert-pr) is the ONLY correct
|
|
20
|
+
// path once a PR exists: it re-merges main AND updates the PR. Fail fast and steer there. (openPrForBranch
|
|
21
|
+
// itself fails fast if GitHub can't be reached — we never assume "no PR" when we simply couldn't ask.)
|
|
22
22
|
function assertNoOpenPr(repoRoot) {
|
|
23
23
|
const branch = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { cwd: repoRoot, encoding: 'utf8' }).trim();
|
|
24
24
|
const openPr = (0, open_pr_check_1.openPrForBranch)(repoRoot, branch);
|
|
25
25
|
if (openPr === '')
|
|
26
26
|
return;
|
|
27
27
|
throw new rules_config_1.CliExitError(2, '\n' + SEP + `⛔ An open PR (#${openPr}) already tracks this branch\n` + SEP + '\n' +
|
|
28
|
-
'wp-update-start
|
|
29
|
-
`
|
|
30
|
-
'
|
|
28
|
+
'wp-update-start re-squashes your branch onto main and force-pushes it, but it does NOT refresh\n' +
|
|
29
|
+
`the PR body/review — so PR #${openPr} would get new code without an updated review. Use the PR\n` +
|
|
30
|
+
'flow instead — it re-merges main AND updates the PR:\n' +
|
|
31
31
|
' 1. pnpm wp-start-upsert-pr\n' +
|
|
32
32
|
' 2. /wp-merge (only if conflicts)\n' +
|
|
33
33
|
' 3. pnpm wp-finish-upsert-pr\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wp-update-start.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-update-start.ts"],"names":[],"mappings":";;;AAoBA,wCAaC;AAED,oBAsBC;AAxDD,iDAAyC;AACzC,0DAA+E;AAC/E,4DAA2D;AAC3D,sDAA0D;AAE1D,oGAAoG;AACpG,2FAA2F;AAC3F,sGAAsG;AACtG,mGAAmG;AACnG,4FAA4F;AAE5F,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,
|
|
1
|
+
{"version":3,"file":"wp-update-start.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-update-start.ts"],"names":[],"mappings":";;;AAoBA,wCAaC;AAED,oBAsBC;AAxDD,iDAAyC;AACzC,0DAA+E;AAC/E,4DAA2D;AAC3D,sDAA0D;AAE1D,oGAAoG;AACpG,2FAA2F;AAC3F,sGAAsG;AACtG,mGAAmG;AACnG,4FAA4F;AAE5F,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,uGAAuG;AACvG,wGAAwG;AACxG,oGAAoG;AACpG,wGAAwG;AACxG,2GAA2G;AAC3G,uGAAuG;AACvG,SAAgB,cAAc,CAAC,QAAgB;IAC3C,MAAM,MAAM,GAAG,IAAA,wBAAQ,EAAC,iCAAiC,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACvG,MAAM,MAAM,GAAG,IAAA,+BAAe,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACjD,IAAI,MAAM,KAAK,EAAE;QAAE,OAAO;IAC1B,MAAM,IAAI,2BAAY,CAAC,CAAC,EACpB,IAAI,GAAG,GAAG,GAAG,kBAAkB,MAAM,gCAAgC,GAAG,GAAG,GAAG,IAAI;QAClF,kGAAkG;QAClG,+BAA+B,MAAM,6DAA6D;QAClG,wDAAwD;QACxD,gCAAgC;QAChC,wCAAwC;QACxC,iCAAiC,CACpC,CAAC;AACN,CAAC;AAEM,KAAK,UAAU,IAAI;IACtB,MAAM,QAAQ,GAAG,IAAA,wBAAQ,EAAC,+BAA+B,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACxF,gGAAgG;IAChG,IAAA,4BAAa,EAAC,QAAQ,EAAE,2BAA2B,CAAC,CAAC;IAErD,8FAA8F;IAC9F,oFAAoF;IACpF,cAAc,CAAC,QAAQ,CAAC,CAAC;IAEzB,MAAM,OAAO,GAAG,MAAM,IAAA,8BAAiB,EAAC,QAAQ,EAAE,iBAAiB,EAAE,eAAe,CAAC,CAAC;IACtF,IAAI,OAAO,KAAK,UAAU,EAAE,CAAC;QACzB,4FAA4F;QAC5F,MAAM,IAAI,2BAAY,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;IACD,IAAI,OAAO,KAAK,mBAAmB,EAAE,CAAC;QAClC,MAAM,IAAI,2BAAY,CAAC,CAAC,EACpB,IAAI,GAAG,GAAG,GAAG,6CAA6C,GAAG,GAAG,GAAG,IAAI;YACvE,kEAAkE;YAClE,wBAAwB,CAC3B,CAAC;IACN,CAAC;IACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iEAAiE,CAAC,CAAC;AAC5F,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;IAAE,IAAA,sBAAO,EAAC,IAAI,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { execSync } from 'child_process';\nimport { writeTemplate, CliExitError, runMain } from '@webpieces/rules-config';\nimport { openPrForBranch } from './workflow/open-pr-check';\nimport { runUpdateFromMain } from './workflow/run-update';\n\n// wp-update-start: the \"sync this feature branch from main\" entry point (the redirect target of the\n// redirect-how-to-merge-main guard). It runs the FULL 3-point squash-update via the shared\n// runUpdateFromMain engine: on a CLEAN merge it finalizes everything (no need to call wp-update-end);\n// on CONFLICT it writes the 3-point context + merge process doc and hands back — you resolve, then\n// run `wp-update-end` to finalize. It NEVER creates a PR (that is the wp-*-upsert-pr flow).\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n// If a PR is already OPEN for this branch, wp-update-start must refuse. The 3-point update re-squashes\n// your branch onto main and force-pushes it to origin/<feature> — the PR head — but it does NOT refresh\n// the PR body/review or run the authoritative build gate. So it would push new code onto an open PR\n// without an updated review. The PR flow (wp-start-upsert-pr → wp-finish-upsert-pr) is the ONLY correct\n// path once a PR exists: it re-merges main AND updates the PR. Fail fast and steer there. (openPrForBranch\n// itself fails fast if GitHub can't be reached — we never assume \"no PR\" when we simply couldn't ask.)\nexport function assertNoOpenPr(repoRoot: string): void {\n const branch = execSync('git rev-parse --abbrev-ref HEAD', { cwd: repoRoot, encoding: 'utf8' }).trim();\n const openPr = openPrForBranch(repoRoot, branch);\n if (openPr === '') return;\n throw new CliExitError(2,\n '\\n' + SEP + `⛔ An open PR (#${openPr}) already tracks this branch\\n` + SEP + '\\n' +\n 'wp-update-start re-squashes your branch onto main and force-pushes it, but it does NOT refresh\\n' +\n `the PR body/review — so PR #${openPr} would get new code without an updated review. Use the PR\\n` +\n 'flow instead — it re-merges main AND updates the PR:\\n' +\n ' 1. pnpm wp-start-upsert-pr\\n' +\n ' 2. /wp-merge (only if conflicts)\\n' +\n ' 3. pnpm wp-finish-upsert-pr\\n',\n );\n}\n\nexport async function main(): Promise<void> {\n const repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();\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\n // An open PR means the PR flow must be used — a 3-point update would strand the PR on the old\n // branch generation. Fails fast if GitHub can't be reached (never guesses \"no PR\").\n assertNoOpenPr(repoRoot);\n\n const outcome = await runUpdateFromMain(repoRoot, 'wp-update-start', 'wp-update-end');\n if (outcome === 'conflict') {\n // Context + marker + merge process doc already written by merge-start; hand back to the AI.\n throw new CliExitError(2, '');\n }\n if (outcome === 'unvalidatedResume') {\n throw new CliExitError(1,\n '\\n' + SEP + '⏸️ Merge in progress — not yet validated\\n' + SEP + '\\n' +\n 'Resolve the remaining conflicts in the working tree, then run:\\n' +\n ' pnpm wp-update-end\\n',\n );\n }\n process.stdout.write('\\n✅ Updated from main — clean. No need to call wp-update-end.\\n');\n}\n\nif (require.main === module) runMain(main);\n"]}
|