@webpieces/pr-gate 0.4.984 → 0.4.986

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/package.json +8 -8
  2. package/src/scripts/commands/build-push-dev-command.d.ts +79 -0
  3. package/src/scripts/commands/build-push-dev-command.js +184 -0
  4. package/src/scripts/commands/build-push-dev-command.js.map +1 -0
  5. package/src/scripts/commands/finish-push-dev-command.d.ts +73 -17
  6. package/src/scripts/commands/finish-push-dev-command.js +187 -31
  7. package/src/scripts/commands/finish-push-dev-command.js.map +1 -1
  8. package/src/scripts/commands/start-push-dev-command.d.ts +43 -0
  9. package/src/scripts/commands/start-push-dev-command.js +111 -0
  10. package/src/scripts/commands/start-push-dev-command.js.map +1 -0
  11. package/src/scripts/pr-gate-app.d.ts +18 -18
  12. package/src/scripts/pr-gate-app.js +27 -26
  13. package/src/scripts/pr-gate-app.js.map +1 -1
  14. package/src/scripts/pr-gate-cli-app.d.ts +2 -2
  15. package/src/scripts/pr-gate-cli-app.js +20 -29
  16. package/src/scripts/pr-gate-cli-app.js.map +1 -1
  17. package/src/scripts/workflow/build-gate-log.d.ts +1 -0
  18. package/src/scripts/workflow/build-gate-log.js +7 -3
  19. package/src/scripts/workflow/build-gate-log.js.map +1 -1
  20. package/src/scripts/workflow/dev-build.d.ts +8 -5
  21. package/src/scripts/workflow/dev-build.js +13 -9
  22. package/src/scripts/workflow/dev-build.js.map +1 -1
  23. package/src/scripts/workflow/dev-copy-on-main.d.ts +6 -4
  24. package/src/scripts/workflow/dev-copy-on-main.js +8 -6
  25. package/src/scripts/workflow/dev-copy-on-main.js.map +1 -1
  26. package/src/scripts/workflow/dev-deploy-refs.d.ts +4 -17
  27. package/src/scripts/workflow/dev-deploy-refs.js +5 -21
  28. package/src/scripts/workflow/dev-deploy-refs.js.map +1 -1
  29. package/src/scripts/workflow/dev-resolve-runner.d.ts +56 -71
  30. package/src/scripts/workflow/dev-resolve-runner.js +156 -182
  31. package/src/scripts/workflow/dev-resolve-runner.js.map +1 -1
  32. package/src/scripts/workflow/landed-copy-resolver.d.ts +56 -0
  33. package/src/scripts/workflow/landed-copy-resolver.js +141 -0
  34. package/src/scripts/workflow/landed-copy-resolver.js.map +1 -0
  35. package/src/scripts/workflow/main-freshness.d.ts +16 -0
  36. package/src/scripts/workflow/main-freshness.js +33 -0
  37. package/src/scripts/workflow/main-freshness.js.map +1 -0
  38. package/src/scripts/workflow/push-dev-state.d.ts +12 -35
  39. package/src/scripts/workflow/push-dev-state.js +31 -62
  40. package/src/scripts/workflow/push-dev-state.js.map +1 -1
  41. package/src/scripts/workflow/verified-dev-copy.d.ts +46 -0
  42. package/src/scripts/workflow/verified-dev-copy.js +89 -0
  43. package/src/scripts/workflow/verified-dev-copy.js.map +1 -0
  44. package/src/scripts/{wp-build-dev.js → wp-build-push-dev.js} +2 -2
  45. package/src/scripts/wp-build-push-dev.js.map +1 -0
  46. package/src/scripts/{wp-push-dev.js → wp-start-push-dev.js} +2 -2
  47. package/src/scripts/wp-start-push-dev.js.map +1 -0
  48. package/src/scripts/commands/build-dev-command.d.ts +0 -27
  49. package/src/scripts/commands/build-dev-command.js +0 -99
  50. package/src/scripts/commands/build-dev-command.js.map +0 -1
  51. package/src/scripts/commands/push-dev-command.d.ts +0 -140
  52. package/src/scripts/commands/push-dev-command.js +0 -356
  53. package/src/scripts/commands/push-dev-command.js.map +0 -1
  54. package/src/scripts/wp-build-dev.js.map +0 -1
  55. package/src/scripts/wp-push-dev.js.map +0 -1
  56. /package/src/scripts/{wp-build-dev.d.ts → wp-build-push-dev.d.ts} +0 -0
  57. /package/src/scripts/{wp-push-dev.d.ts → wp-start-push-dev.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/pr-gate",
3
- "version": "0.4.984",
3
+ "version": "0.4.986",
4
4
  "description": "Gated PR system: 3-point squash-merge, merge validation gate, and red/yellow/green PR dashboard. Standalone scripts, no Nx dependency required.",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -16,23 +16,22 @@
16
16
  },
17
17
  "dependencies": {
18
18
  "@inversifyjs/binding-decorators": "1.1.5",
19
- "@webpieces/hook-runtime": "0.4.984",
20
- "@webpieces/rules-config": "0.4.984",
19
+ "@webpieces/hook-runtime": "0.4.986",
20
+ "@webpieces/rules-config": "0.4.986",
21
21
  "inversify": "7.10.4",
22
22
  "reflect-metadata": "0.2.2",
23
- "@webpieces/tooling-common": "0.4.984",
24
- "@webpieces/repo-workflow-core": "0.4.984"
23
+ "@webpieces/tooling-common": "0.4.986",
24
+ "@webpieces/repo-workflow-core": "0.4.986"
25
25
  },
26
26
  "publishConfig": {
27
27
  "access": "public"
28
28
  },
29
29
  "devDependencies": {
30
- "@webpieces/tooling-testkit": "0.4.984"
30
+ "@webpieces/tooling-testkit": "0.4.986"
31
31
  },
32
32
  "types": "./src/index.d.ts",
33
33
  "bin": {
34
34
  "wp-build": "./src/scripts/wp-build.js",
35
- "wp-build-dev": "./src/scripts/wp-build-dev.js",
36
35
  "wp-finish-upsert-pr": "./src/scripts/git-finishUpsertPr.js",
37
36
  "wp-human-post-pr": "./src/scripts/wp-human-post-pr.js",
38
37
  "wp-upsert-hotfix-pr": "./src/scripts/wp-upsert-hotfix-pr.js",
@@ -44,7 +43,8 @@
44
43
  "wp-land-pr": "./src/scripts/wp-land-pr.js",
45
44
  "wp-check-pr": "./src/scripts/wp-check-pr.js",
46
45
  "wp-review-upsert-pr": "./src/scripts/wp-review-upsert-pr.js",
47
- "wp-push-dev": "./src/scripts/wp-push-dev.js",
46
+ "wp-start-push-dev": "./src/scripts/wp-start-push-dev.js",
47
+ "wp-build-push-dev": "./src/scripts/wp-build-push-dev.js",
48
48
  "wp-finish-push-dev": "./src/scripts/wp-finish-push-dev.js",
49
49
  "wp-await-reviews": "./src/scripts/wp-await-reviews.js",
50
50
  "wp-write-review": "./src/scripts/wp-write-review.js",
@@ -0,0 +1,79 @@
1
+ import { RepoRootFinder } from '@webpieces/rules-config';
2
+ import { GitExec } from '../workflow/git-exec';
3
+ import { DevDeployRefs } from '../workflow/dev-deploy-refs';
4
+ import { PushDevStateStore } from '../workflow/push-dev-state';
5
+ import { DevResolveRunner } from '../workflow/dev-resolve-runner';
6
+ import { DevBuild } from '../workflow/dev-build';
7
+ import { MainFreshness } from '../workflow/main-freshness';
8
+ import { VerifiedDevCopyStore } from '../workflow/verified-dev-copy';
9
+ import { AiBranchName } from '../workflow/git-readAiBranchName';
10
+ import { MergeState } from '../workflow/merge-state';
11
+ import { MergeEnd } from '../workflow/merge-end';
12
+ import { BuildAffected } from '../workflow/build-affected';
13
+ /** What `wp-build-push-dev` was asked to do. Data-only (per CLAUDE.md). */
14
+ export declare class BuildPushDevOptions {
15
+ /** Throw a conflict resolution in progress away and restore the original checkout. */
16
+ abort: boolean;
17
+ constructor(abort?: boolean);
18
+ }
19
+ /**
20
+ * `wp-build-push-dev` — stage ② of the dev-deploy flow, the gate (#1403). The twin of
21
+ * `wp-review-upsert-pr`: it validates any 3-point merge stage ① left for `/wp-merge`, refuses a branch that
22
+ * is behind `origin/main`, and then builds TWO trees, each answering one question (#1405):
23
+ *
24
+ * 1. the feature branch ALONE (it already contains the latest main) with `commands.pr-gate.buildCommand` —
25
+ * the code rules ON, affected vs main. Exactly what the PR gate will judge, so the developer learns early
26
+ * what would block landing, and the rules only ever judge what will actually land on main.
27
+ * 2. a THROWAWAY merge with `origin/<devBranch>`: `pnpm install`, then `commands.push-dev.buildCommand` —
28
+ * compile + tests only, affected vs dev. It answers only "does everyone's code still compile and pass
29
+ * together?". The rules must NOT run here: that tree holds every other developer's copy, and diffed
30
+ * against main their code would be judged as the publisher's change — one copy's 385-line method failed
31
+ * every other developer's publish (#1405).
32
+ *
33
+ * Green ⇒ it records the copy for `wp-finish-push-dev` (stage ③) and goes back to the feature branch. It
34
+ * publishes NOTHING.
35
+ *
36
+ * A conflict with dev stops on the throwaway, and RE-RUNNING this command is how the check continues once
37
+ * the files are resolved and `git add`-ed (`--abort` throws it away) — one command per stage, the same way
38
+ * stage ② of the PR flow is re-run after a fix.
39
+ *
40
+ * WHY THE CHECK AGAINST `dev` (#1397): 61 of 73 failed dev publishes on one consumer failed on a git
41
+ * conflict, which the developer only learned about after the server-side composition failed. A build
42
+ * against `main` alone proves the wrong thing; a build of only what differs from `dev` proves the right one,
43
+ * quickly.
44
+ */
45
+ export declare class BuildPushDevCommand {
46
+ private readonly repoRootFinder;
47
+ private readonly gitExec;
48
+ private readonly refs;
49
+ private readonly store;
50
+ private readonly runner;
51
+ private readonly devBuild;
52
+ private readonly mainFreshness;
53
+ private readonly verified;
54
+ private readonly aiBranchName;
55
+ private readonly mergeState;
56
+ private readonly mergeEnd;
57
+ private readonly buildAffected;
58
+ constructor(repoRootFinder: RepoRootFinder, gitExec: GitExec, refs: DevDeployRefs, store: PushDevStateStore, runner: DevResolveRunner, devBuild: DevBuild, mainFreshness: MainFreshness, verified: VerifiedDevCopyStore, aiBranchName: AiBranchName, mergeState: MergeState, mergeEnd: MergeEnd, buildAffected: BuildAffected);
59
+ run(opts: BuildPushDevOptions): Promise<void>;
60
+ /**
61
+ * Build 1 of 2: the PR gate's own build on the feature branch, before dev is fetched or merged. Red stops
62
+ * here with the `FullLog :` pointer — nothing merged with dev, nothing recorded.
63
+ */
64
+ private buildAgainstMain;
65
+ /**
66
+ * Validate + finalize a 3-point merge with main that stage ① stopped on. The push mirrors stage ①'s:
67
+ * with no PR the rewrite reaches `origin/<feature>` (as `wp-finish-update` does); with a PR open it
68
+ * stays local, for the PR flow's one reviewed push.
69
+ */
70
+ private finalizeAnyInProgressMainMerge;
71
+ private refuseBehindMain;
72
+ /**
73
+ * `origin/<devBranch>` does not exist yet — the very first publish in a repo whose CI has never
74
+ * composed. There is nothing to conflict with and no base for a dev-scoped build, so the branch is
75
+ * recorded as it is (the build against main above has still run); refusing here would make the first
76
+ * dev composition impossible to start.
77
+ */
78
+ private verifyWithoutDev;
79
+ }
@@ -0,0 +1,184 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BuildPushDevCommand = exports.BuildPushDevOptions = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const rules_config_1 = require("@webpieces/rules-config");
6
+ const inversify_1 = require("inversify");
7
+ const git_exec_1 = require("../workflow/git-exec");
8
+ const dev_deploy_refs_1 = require("../workflow/dev-deploy-refs");
9
+ const push_dev_state_1 = require("../workflow/push-dev-state");
10
+ const dev_resolve_runner_1 = require("../workflow/dev-resolve-runner");
11
+ const dev_build_1 = require("../workflow/dev-build");
12
+ const main_freshness_1 = require("../workflow/main-freshness");
13
+ const verified_dev_copy_1 = require("../workflow/verified-dev-copy");
14
+ const git_readAiBranchName_1 = require("../workflow/git-readAiBranchName");
15
+ const merge_state_1 = require("../workflow/merge-state");
16
+ const merge_end_1 = require("../workflow/merge-end");
17
+ const merge_start_1 = require("../workflow/merge-start");
18
+ const build_affected_1 = require("../workflow/build-affected");
19
+ const build_gate_log_1 = require("../workflow/build-gate-log");
20
+ const SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n';
21
+ /** What `wp-build-push-dev` was asked to do. Data-only (per CLAUDE.md). */
22
+ class BuildPushDevOptions {
23
+ /** Throw a conflict resolution in progress away and restore the original checkout. */
24
+ abort = false;
25
+ constructor(abort = false) {
26
+ this.abort = abort;
27
+ }
28
+ }
29
+ exports.BuildPushDevOptions = BuildPushDevOptions;
30
+ /**
31
+ * `wp-build-push-dev` — stage ② of the dev-deploy flow, the gate (#1403). The twin of
32
+ * `wp-review-upsert-pr`: it validates any 3-point merge stage ① left for `/wp-merge`, refuses a branch that
33
+ * is behind `origin/main`, and then builds TWO trees, each answering one question (#1405):
34
+ *
35
+ * 1. the feature branch ALONE (it already contains the latest main) with `commands.pr-gate.buildCommand` —
36
+ * the code rules ON, affected vs main. Exactly what the PR gate will judge, so the developer learns early
37
+ * what would block landing, and the rules only ever judge what will actually land on main.
38
+ * 2. a THROWAWAY merge with `origin/<devBranch>`: `pnpm install`, then `commands.push-dev.buildCommand` —
39
+ * compile + tests only, affected vs dev. It answers only "does everyone's code still compile and pass
40
+ * together?". The rules must NOT run here: that tree holds every other developer's copy, and diffed
41
+ * against main their code would be judged as the publisher's change — one copy's 385-line method failed
42
+ * every other developer's publish (#1405).
43
+ *
44
+ * Green ⇒ it records the copy for `wp-finish-push-dev` (stage ③) and goes back to the feature branch. It
45
+ * publishes NOTHING.
46
+ *
47
+ * A conflict with dev stops on the throwaway, and RE-RUNNING this command is how the check continues once
48
+ * the files are resolved and `git add`-ed (`--abort` throws it away) — one command per stage, the same way
49
+ * stage ② of the PR flow is re-run after a fix.
50
+ *
51
+ * WHY THE CHECK AGAINST `dev` (#1397): 61 of 73 failed dev publishes on one consumer failed on a git
52
+ * conflict, which the developer only learned about after the server-side composition failed. A build
53
+ * against `main` alone proves the wrong thing; a build of only what differs from `dev` proves the right one,
54
+ * quickly.
55
+ */
56
+ let BuildPushDevCommand = class BuildPushDevCommand {
57
+ repoRootFinder;
58
+ gitExec;
59
+ refs;
60
+ store;
61
+ runner;
62
+ devBuild;
63
+ mainFreshness;
64
+ verified;
65
+ aiBranchName;
66
+ mergeState;
67
+ mergeEnd;
68
+ buildAffected;
69
+ constructor(repoRootFinder, gitExec, refs, store, runner, devBuild, mainFreshness, verified, aiBranchName, mergeState, mergeEnd, buildAffected) {
70
+ this.repoRootFinder = repoRootFinder;
71
+ this.gitExec = gitExec;
72
+ this.refs = refs;
73
+ this.store = store;
74
+ this.runner = runner;
75
+ this.devBuild = devBuild;
76
+ this.mainFreshness = mainFreshness;
77
+ this.verified = verified;
78
+ this.aiBranchName = aiBranchName;
79
+ this.mergeState = mergeState;
80
+ this.mergeEnd = mergeEnd;
81
+ this.buildAffected = buildAffected;
82
+ }
83
+ async run(opts) {
84
+ const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());
85
+ // Refresh the AI-facing workflow doc so it is present + current for any failure message to cite.
86
+ (0, rules_config_1.writeTemplate)(repoRoot, 'webpieces.git-workflow.md');
87
+ if (opts.abort) {
88
+ await this.runner.abort(repoRoot, this.store.require(repoRoot));
89
+ return;
90
+ }
91
+ const inFlight = this.store.read(repoRoot);
92
+ if (inFlight !== null) {
93
+ // A conflict with dev was resolved: commit it and carry on with install + build + record.
94
+ await this.runner.resume(repoRoot, inFlight);
95
+ return;
96
+ }
97
+ // Stage ① may have handed a conflicted 3-point merge with main to /wp-merge; it is validated and
98
+ // finalized HERE, before anything else, exactly as wp-review-upsert-pr does for the PR flow.
99
+ await this.finalizeAnyInProgressMainMerge(repoRoot);
100
+ const cfg = this.refs.config(repoRoot);
101
+ const branch = this.refs.currentBranch(repoRoot);
102
+ this.refs.assertPushable(cfg, branch);
103
+ // Before any git write: an unconfigured dev build refuses here, with nothing merged.
104
+ this.devBuild.command(repoRoot);
105
+ // The merge below must be of committed work only, and must not sweep uncommitted edits along.
106
+ await this.gitExec.assertCleanTree(repoRoot);
107
+ if (!await this.mainFreshness.containsLatestMain(repoRoot))
108
+ this.refuseBehindMain(branch);
109
+ // A previous verification is stale the moment a new check starts.
110
+ this.verified.clear(repoRoot);
111
+ await this.buildAgainstMain(repoRoot);
112
+ const targetRef = cfg.copyRefFor(branch);
113
+ const leaseSha = await this.refs.remoteSha(repoRoot, targetRef);
114
+ if (await this.refs.remoteSha(repoRoot, cfg.devBranch) === '') {
115
+ await this.verifyWithoutDev(repoRoot, cfg, branch, targetRef, leaseSha);
116
+ return;
117
+ }
118
+ const state = new push_dev_state_1.PushDevState(branch, this.runner.tmpBranchFor(branch), targetRef, cfg.devBranch);
119
+ state.leaseSha = leaseSha;
120
+ process.stdout.write(this.runner.announce(cfg, state));
121
+ await this.runner.start(repoRoot, cfg, state);
122
+ }
123
+ /**
124
+ * Build 1 of 2: the PR gate's own build on the feature branch, before dev is fetched or merged. Red stops
125
+ * here with the `FullLog :` pointer — nothing merged with dev, nothing recorded.
126
+ */
127
+ async buildAgainstMain(repoRoot) {
128
+ process.stdout.write('\n' + SEP + '② Building your branch against main — the code rules judge what will land\n' + SEP + '\n');
129
+ await this.buildAffected.runBuildGate(repoRoot, new build_affected_1.BuildGateOptions('🛠️ build against main (commands.pr-gate.buildCommand)', rules_config_1.WP_BUILD_PUSH_DEV, 'Build against main failed — nothing was merged with dev, recorded or published.', build_gate_log_1.PUSH_DEV_MAIN_BUILD_STAGE));
130
+ }
131
+ /**
132
+ * Validate + finalize a 3-point merge with main that stage ① stopped on. The push mirrors stage ①'s:
133
+ * with no PR the rewrite reaches `origin/<feature>` (as `wp-finish-update` does); with a PR open it
134
+ * stays local, for the PR flow's one reviewed push.
135
+ */
136
+ async finalizeAnyInProgressMainMerge(repoRoot) {
137
+ const home = this.mergeState.mergeDirFor(repoRoot, await this.aiBranchName.getFeatureName());
138
+ const activeDir = this.mergeState.findActiveMergeRunDir(home);
139
+ const marker = activeDir ? this.mergeState.readMergeMarker(activeDir) : null;
140
+ if (!activeDir || !marker)
141
+ return;
142
+ process.stdout.write('\n' + SEP + '① Validating your 3-point merge with main\n' + SEP + '\n');
143
+ await this.mergeEnd.mergeEnd(repoRoot, 'wp-build-push-dev', activeDir, new merge_start_1.MergeContext(marker.currentBranch, marker.squashBranch, marker.backupBranch, marker.prNumber), new merge_end_1.MergeEndOptions(marker.validated ? null : marker.conflictedFiles, marker.prNumber === ''));
144
+ }
145
+ refuseBehindMain(branch) {
146
+ throw new rules_config_1.CliExitError(2, '\n' + SEP + `⛔ \`${branch}\` is behind origin/main\n` + SEP + '\n'
147
+ + 'A dev copy must be built from the latest main: a branch forked from an older main builds against a\n'
148
+ + 'node_modules missing whatever main added since, while dev already contains it. Nothing was merged,\n'
149
+ + 'built or recorded. Bring the branch up to date first (it runs the 3-point merge), then re-run this:\n'
150
+ + ` ${rules_config_1.WP_START_PUSH_DEV}\n`);
151
+ }
152
+ /**
153
+ * `origin/<devBranch>` does not exist yet — the very first publish in a repo whose CI has never
154
+ * composed. There is nothing to conflict with and no base for a dev-scoped build, so the branch is
155
+ * recorded as it is (the build against main above has still run); refusing here would make the first
156
+ * dev composition impossible to start.
157
+ */
158
+ async verifyWithoutDev(repoRoot, cfg, branch, targetRef, leaseSha) {
159
+ const head = await this.refs.headSha(repoRoot, 'HEAD');
160
+ await this.gitExec.runGitChecked(['-C', repoRoot, 'update-ref', this.verified.keepRef(branch), head], `Failed to keep the verified copy ${head.slice(0, 8)} reachable`);
161
+ this.verified.write(repoRoot, new verified_dev_copy_1.VerifiedDevCopy(branch, head, head, targetRef, leaseSha, ''));
162
+ process.stdout.write('\n' + SEP + `✅ ${targetRef} is ready to publish — unchecked\n` + SEP + '\n'
163
+ + `\`origin/${cfg.devBranch}\` does not exist yet, so there was nothing to check the copy against and no\n`
164
+ + 'dev build ran (the build against main did). The copy is your branch exactly as it is.\n\n'
165
+ + `▶ NEXT run: ${rules_config_1.WP_FINISH_PUSH_DEV}\n`);
166
+ }
167
+ };
168
+ exports.BuildPushDevCommand = BuildPushDevCommand;
169
+ exports.BuildPushDevCommand = BuildPushDevCommand = tslib_1.__decorate([
170
+ (0, inversify_1.injectable)(inversify_1.bindingScopeValues.Singleton),
171
+ tslib_1.__metadata("design:paramtypes", [rules_config_1.RepoRootFinder,
172
+ git_exec_1.GitExec,
173
+ dev_deploy_refs_1.DevDeployRefs,
174
+ push_dev_state_1.PushDevStateStore,
175
+ dev_resolve_runner_1.DevResolveRunner,
176
+ dev_build_1.DevBuild,
177
+ main_freshness_1.MainFreshness,
178
+ verified_dev_copy_1.VerifiedDevCopyStore,
179
+ git_readAiBranchName_1.AiBranchName,
180
+ merge_state_1.MergeState,
181
+ merge_end_1.MergeEnd,
182
+ build_affected_1.BuildAffected])
183
+ ], BuildPushDevCommand);
184
+ //# sourceMappingURL=build-push-dev-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-push-dev-command.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/commands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able, bindingScopeValues } from 'inversify';\n\nimport { GitExec } from '../workflow/git-exec';\nimport { DevDeployRefs } from '../workflow/dev-deploy-refs';\nimport { PushDevState, PushDevStateStore } from '../workflow/push-dev-state';\nimport { DevResolveRunner } from '../workflow/dev-resolve-runner';\nimport { DevBuild } from '../workflow/dev-build';\nimport { MainFreshness } from '../workflow/main-freshness';\nimport { VerifiedDevCopy, VerifiedDevCopyStore } from '../workflow/verified-dev-copy';\nimport { AiBranchName } from '../workflow/git-readAiBranchName';\nimport { MergeState } from '../workflow/merge-state';\nimport { MergeEnd, MergeEndOptions } from '../workflow/merge-end';\nimport { MergeContext } from '../workflow/merge-start';\nimport { BuildAffected, BuildGateOptions } from '../workflow/build-affected';\nimport { PUSH_DEV_MAIN_BUILD_STAGE } from '../workflow/build-gate-log';\n\nconst SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\\n';\n\n/** What `wp-build-push-dev` was asked to do. Data-only (per CLAUDE.md). */\nexport class BuildPushDevOptions {\n /** Throw a conflict resolution in progress away and restore the original checkout. */\n abort = false;\n\n constructor(abort = false) {\n this.abort = abort;\n }\n}\n\n/**\n * `wp-build-push-dev` — stage ② of the dev-deploy flow, the gate (#1403). The twin of\n * `wp-review-upsert-pr`: it validates any 3-point merge stage ① left for `/wp-merge`, refuses a branch that\n * is behind `origin/main`, and then builds TWO trees, each answering one question (#1405):\n *\n * 1. the feature branch ALONE (it already contains the latest main) with `commands.pr-gate.buildCommand` —\n * the code rules ON, affected vs main. Exactly what the PR gate will judge, so the developer learns early\n * what would block landing, and the rules only ever judge what will actually land on main.\n * 2. a THROWAWAY merge with `origin/<devBranch>`: `pnpm install`, then `commands.push-dev.buildCommand` —\n * compile + tests only, affected vs dev. It answers only \"does everyone's code still compile and pass\n * together?\". The rules must NOT run here: that tree holds every other developer's copy, and diffed\n * against main their code would be judged as the publisher's change — one copy's 385-line method failed\n * every other developer's publish (#1405).\n *\n * Green ⇒ it records the copy for `wp-finish-push-dev` (stage ③) and goes back to the feature branch. It\n * publishes NOTHING.\n *\n * A conflict with dev stops on the throwaway, and RE-RUNNING this command is how the check continues once\n * the files are resolved and `git add`-ed (`--abort` throws it away) — one command per stage, the same way\n * stage ② of the PR flow is re-run after a fix.\n *\n * WHY THE CHECK AGAINST `dev` (#1397): 61 of 73 failed dev publishes on one consumer failed on a git\n * conflict, which the developer only learned about after the server-side composition failed. A build\n * against `main` alone proves the wrong thing; a build of only what differs from `dev` proves the right one,\n * quickly.\n */\n@injectable(bindingScopeValues.Singleton)\nexport class BuildPushDevCommand {\n constructor(\n private readonly repoRootFinder: RepoRootFinder,\n private readonly gitExec: GitExec,\n private readonly refs: DevDeployRefs,\n private readonly store: PushDevStateStore,\n private readonly runner: DevResolveRunner,\n private readonly devBuild: DevBuild,\n private readonly mainFreshness: MainFreshness,\n private readonly verified: VerifiedDevCopyStore,\n private readonly aiBranchName: AiBranchName,\n private readonly mergeState: MergeState,\n private readonly mergeEnd: MergeEnd,\n private readonly buildAffected: BuildAffected,\n ) {}\n\n async run(opts: BuildPushDevOptions): Promise<void> {\n const repoRoot = this.repoRootFinder.resolveRepoRoot(process.cwd());\n // Refresh the AI-facing workflow doc so it is present + current for any failure message to cite.\n writeTemplate(repoRoot, 'webpieces.git-workflow.md');\n\n if (opts.abort) {\n await this.runner.abort(repoRoot, this.store.require(repoRoot));\n return;\n }\n const inFlight = this.store.read(repoRoot);\n if (inFlight !== null) {\n // A conflict with dev was resolved: commit it and carry on with install + build + record.\n await this.runner.resume(repoRoot, inFlight);\n return;\n }\n\n // Stage ① may have handed a conflicted 3-point merge with main to /wp-merge; it is validated and\n // finalized HERE, before anything else, exactly as wp-review-upsert-pr does for the PR flow.\n await this.finalizeAnyInProgressMainMerge(repoRoot);\n\n const cfg = this.refs.config(repoRoot);\n const branch = this.refs.currentBranch(repoRoot);\n this.refs.assertPushable(cfg, branch);\n // Before any git write: an unconfigured dev build refuses here, with nothing merged.\n this.devBuild.command(repoRoot);\n // The merge below must be of committed work only, and must not sweep uncommitted edits along.\n await this.gitExec.assertCleanTree(repoRoot);\n if (!await this.mainFreshness.containsLatestMain(repoRoot)) this.refuseBehindMain(branch);\n\n // A previous verification is stale the moment a new check starts.\n this.verified.clear(repoRoot);\n await this.buildAgainstMain(repoRoot);\n const targetRef = cfg.copyRefFor(branch);\n const leaseSha = await this.refs.remoteSha(repoRoot, targetRef);\n if (await this.refs.remoteSha(repoRoot, cfg.devBranch) === '') {\n await this.verifyWithoutDev(repoRoot, cfg, branch, targetRef, leaseSha);\n return;\n }\n const state = new PushDevState(branch, this.runner.tmpBranchFor(branch), targetRef, cfg.devBranch);\n state.leaseSha = leaseSha;\n process.stdout.write(this.runner.announce(cfg, state));\n await this.runner.start(repoRoot, cfg, state);\n }\n\n /**\n * Build 1 of 2: the PR gate's own build on the feature branch, before dev is fetched or merged. Red stops\n * here with the `FullLog :` pointer — nothing merged with dev, nothing recorded.\n */\n private async buildAgainstMain(repoRoot: string): Promise<void> {\n process.stdout.write('\\n' + SEP + '② Building your branch against main — the code rules judge what will land\\n' + SEP + '\\n');\n await this.buildAffected.runBuildGate(repoRoot, new BuildGateOptions(\n '🛠️ build against main (commands.pr-gate.buildCommand)',\n WP_BUILD_PUSH_DEV,\n 'Build against main failed — nothing was merged with dev, recorded or published.',\n PUSH_DEV_MAIN_BUILD_STAGE,\n ));\n }\n\n /**\n * Validate + finalize a 3-point merge with main that stage ① stopped on. The push mirrors stage ①'s:\n * with no PR the rewrite reaches `origin/<feature>` (as `wp-finish-update` does); with a PR open it\n * stays local, for the PR flow's one reviewed push.\n */\n private async finalizeAnyInProgressMainMerge(repoRoot: string): Promise<void> {\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) return;\n process.stdout.write('\\n' + SEP + '① Validating your 3-point merge with main\\n' + SEP + '\\n');\n await this.mergeEnd.mergeEnd(\n repoRoot, 'wp-build-push-dev', activeDir,\n new MergeContext(marker.currentBranch, marker.squashBranch, marker.backupBranch, marker.prNumber),\n new MergeEndOptions(marker.validated ? null : marker.conflictedFiles, marker.prNumber === ''),\n );\n }\n\n private refuseBehindMain(branch: string): never {\n throw new CliExitError(2,\n '\\n' + SEP + `⛔ \\`${branch}\\` is behind origin/main\\n` + SEP + '\\n'\n + 'A dev copy must be built from the latest main: a branch forked from an older main builds against a\\n'\n + 'node_modules missing whatever main added since, while dev already contains it. Nothing was merged,\\n'\n + 'built or recorded. Bring the branch up to date first (it runs the 3-point merge), then re-run this:\\n'\n + ` ${WP_START_PUSH_DEV}\\n`);\n }\n\n /**\n * `origin/<devBranch>` does not exist yet — the very first publish in a repo whose CI has never\n * composed. There is nothing to conflict with and no base for a dev-scoped build, so the branch is\n * recorded as it is (the build against main above has still run); refusing here would make the first\n * dev composition impossible to start.\n */\n private async verifyWithoutDev(\n repoRoot: string, cfg: DevDeployConfig, branch: string, targetRef: string, leaseSha: string,\n ): Promise<void> {\n const head = await this.refs.headSha(repoRoot, 'HEAD');\n await this.gitExec.runGitChecked(['-C', repoRoot, 'update-ref', this.verified.keepRef(branch), head],\n `Failed to keep the verified copy ${head.slice(0, 8)} reachable`);\n this.verified.write(repoRoot, new VerifiedDevCopy(branch, head, head, targetRef, leaseSha, ''));\n process.stdout.write(\n '\\n' + SEP + `✅ ${targetRef} is ready to publish — unchecked\\n` + SEP + '\\n'\n + `\\`origin/${cfg.devBranch}\\` does not exist yet, so there was nothing to check the copy against and no\\n`\n + 'dev build ran (the build against main did). The copy is your branch exactly as it is.\\n\\n'\n + `▶ NEXT run: ${WP_FINISH_PUSH_DEV}\\n`);\n }\n}\n"]}
@@ -1,28 +1,84 @@
1
1
  import { RepoRootFinder } from '@webpieces/rules-config';
2
- import { PushDevStateStore } from '../workflow/push-dev-state';
3
- import { DevResolveRunner } from '../workflow/dev-resolve-runner';
4
- /** What `wp-finish-push-dev` was asked to do. Data-only (per CLAUDE.md). */
2
+ import { GitExec } from '../workflow/git-exec';
3
+ import { DevDeployRefs } from '../workflow/dev-deploy-refs';
4
+ import { DevDeployWatchHints } from '../workflow/dev-deploy-watch-hints';
5
+ import { DevCopyOnMain } from '../workflow/dev-copy-on-main';
6
+ import { VerifiedDevCopyStore } from '../workflow/verified-dev-copy';
7
+ /**
8
+ * Which of `wp-finish-push-dev`'s modes was asked for. Data-only (per CLAUDE.md) with plain assigned
9
+ * fields — the bin sets what argv carried and nothing else.
10
+ */
5
11
  export declare class FinishPushDevOptions {
6
- /** Throw the whole resolve away and restore the original checkout. */
7
- abort: boolean;
8
- constructor(abort?: boolean);
12
+ /** Delete the remote copy and push the rebuild marker — the rollback. */
13
+ remove: boolean;
14
+ /** List the live copies and stop. */
15
+ list: boolean;
9
16
  }
10
17
  /**
11
- * `wp-finish-push-dev` — stage ② of the dev-deploy flow, needed ONLY when a merge stopped.
18
+ * `wp-finish-push-dev` — stage ③ of the dev-deploy flow (#1403): publish the copy `wp-build-push-dev`
19
+ * verified as `<namespace>/<branch>`, so a shared dev environment can build it, without landing anything
20
+ * on `main` and without opening a PR. Also `--list` (the pool) and `--remove` (the rollback).
21
+ *
22
+ * WHY THIS COMMAND HAS TO EXIST AT ALL: `pr-creation-or-push-guard` blocks every `git push`, no
23
+ * exceptions, by design. Without a gated command there is no legal way for an AI to get a branch onto a
24
+ * dev server.
12
25
  *
13
- * It mirrors `wp-start-update` → `wp-finish-update` on purpose: the repo already has a two-phase
14
- * start/finish idiom for exactly this shape ("the tool merges, you resolve, the tool commits"), and a
15
- * `--continue` idiom invented here would be a second vocabulary for one concept. A clean `wp-push-dev
16
- * --resolve` finalizes itself and this command is never needed.
26
+ * IT PUBLISHES ONLY WHAT WAS VERIFIED: stage ② records the feature head it built and the copy it made; this
27
+ * refuses when HEAD has moved since (a new commit nobody built), exactly as `wp-finish-upsert-pr` trusts
28
+ * only the sha stage ② of the PR flow verified.
17
29
  *
18
- * The command owns the commit because the AI cannot make it: `redirect-how-to-merge-main` blocks
19
- * `git merge --continue` and `merge-in-progress-guard` blocks `git commit`. Editing the conflicted files
20
- * and `git add`-ing them is the AI's whole job, and neither is blocked.
30
+ * IT FORCE-PUSHES, leased against the copy sha stage ② saw. Stage ① rewrites the branch on almost every
31
+ * publish, so the new copy is rarely a fast-forward of the old one, and the push event's `before` is then
32
+ * the previous copy — which is what a consumer's dev CI needs to apply only the difference (#1403).
21
33
  */
22
34
  export declare class FinishPushDevCommand {
23
35
  private readonly repoRootFinder;
24
- private readonly store;
25
- private readonly runner;
26
- constructor(repoRootFinder: RepoRootFinder, store: PushDevStateStore, runner: DevResolveRunner);
36
+ private readonly gitExec;
37
+ private readonly refs;
38
+ private readonly verified;
39
+ private readonly watchHints;
40
+ private readonly copyOnMain;
41
+ constructor(repoRootFinder: RepoRootFinder, gitExec: GitExec, refs: DevDeployRefs, verified: VerifiedDevCopyStore, watchHints: DevDeployWatchHints, copyOnMain: DevCopyOnMain);
27
42
  run(opts: FinishPushDevOptions): Promise<void>;
43
+ /** The publish: the verified copy, force-pushed with a lease, then the watch hints. */
44
+ private publish;
45
+ private refuseUnverified;
46
+ private refuseMoved;
47
+ /** `--list`: exactly the live copies, straight from the remote — never a cached local view. */
48
+ private list;
49
+ /**
50
+ * `--remove`: delete the remote copy, then push the `<removeNamespace>/<branch>` marker (#1395). This
51
+ * IS the rollback — nothing else has to be undone.
52
+ *
53
+ * WHY A MARKER AS WELL AS THE DELETION: a deletion can only be heard by a workflow's `on: delete:`,
54
+ * which GitHub cannot filter by branch, so every branch deletion in the repo started a dev-deploy run.
55
+ * A PUSH to `<removeNamespace>/**` is filterable. The deletion stays, unchanged, so a consumer whose
56
+ * workflow still listens on `delete:` keeps working through the rollout window; the marker is purely
57
+ * additive at the transport level.
58
+ *
59
+ * ALREADY ON MAIN (#1401): before anything is deleted, the copy is compared with `origin/main`. When
60
+ * every file it changes already has the copy's content on main, removing it takes nothing off dev —
61
+ * main keeps the change there — and would only force a pointless full recompose, so it is REFUSED
62
+ * ({@link refuseLanded}). When only some files are, the rest is still a real rollback: it warns, naming
63
+ * the landed files, and removes.
64
+ *
65
+ * ORDER: `origin/main` and the copy are fetched BEFORE anything is deleted, so a network failure there
66
+ * leaves the pool exactly as it was. The marker push is the last step, and the only one that can fail with the
67
+ * copy already gone — that is the state {@link markerPushFailed} names.
68
+ */
69
+ private remove;
70
+ /**
71
+ * `--remove` of a copy whose every change is already on `origin/main`. Nothing was deleted and no marker
72
+ * was pushed. There is deliberately no override: a remove cannot take back what main already holds, so
73
+ * refusing never blocks a real rollback — that is a revert PR.
74
+ */
75
+ private refuseLanded;
76
+ /** Some of the copy's files are already on main: the remove proceeds, and says what it does NOT take off. */
77
+ private partlyLandedWarning;
78
+ /**
79
+ * The one half-done state `--remove` can leave: the copy is deleted, the rebuild signal is not sent.
80
+ * Said out loud because it is invisible otherwise — `--list` already looks right, while the deployed
81
+ * `dev` still runs the removed branch until something else triggers a composition.
82
+ */
83
+ private markerPushFailed;
28
84
  }