@webpieces/pr-gate 0.3.353 → 0.3.355
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 +7 -2
- package/src/dashboard/dashboard.d.ts +12 -3
- package/src/dashboard/dashboard.js +136 -129
- package/src/dashboard/dashboard.js.map +1 -1
- package/src/index.d.ts +2 -1
- package/src/index.js +4 -4
- package/src/index.js.map +1 -1
- package/src/scripts/commands/finish-update-command.d.ts +10 -0
- package/src/scripts/commands/finish-update-command.js +51 -0
- package/src/scripts/commands/finish-update-command.js.map +1 -0
- package/src/scripts/commands/finish-upsert-pr-command.d.ts +22 -0
- package/src/scripts/commands/finish-upsert-pr-command.js +131 -0
- package/src/scripts/commands/finish-upsert-pr-command.js.map +1 -0
- package/src/scripts/commands/start-update-command.d.ts +9 -0
- package/src/scripts/commands/start-update-command.js +67 -0
- package/src/scripts/commands/start-update-command.js.map +1 -0
- package/src/scripts/commands/start-upsert-pr-command.d.ts +15 -0
- package/src/scripts/commands/start-upsert-pr-command.js +73 -0
- package/src/scripts/commands/start-upsert-pr-command.js.map +1 -0
- package/src/scripts/git-finishUpsertPr.d.ts +1 -1
- package/src/scripts/git-finishUpsertPr.js +11 -109
- package/src/scripts/git-finishUpsertPr.js.map +1 -1
- package/src/scripts/git-gatherInfo.d.ts +15 -1
- package/src/scripts/git-gatherInfo.js +79 -61
- package/src/scripts/git-gatherInfo.js.map +1 -1
- package/src/scripts/pr-gate-app.d.ts +25 -0
- package/src/scripts/pr-gate-app.js +56 -0
- package/src/scripts/pr-gate-app.js.map +1 -0
- package/src/scripts/workflow/branch-naming.d.ts +11 -8
- package/src/scripts/workflow/branch-naming.js +30 -21
- package/src/scripts/workflow/branch-naming.js.map +1 -1
- package/src/scripts/workflow/build-affected.d.ts +21 -30
- package/src/scripts/workflow/build-affected.js +57 -63
- package/src/scripts/workflow/build-affected.js.map +1 -1
- package/src/scripts/workflow/cleanTmp.d.ts +6 -1
- package/src/scripts/workflow/cleanTmp.js +83 -78
- package/src/scripts/workflow/cleanTmp.js.map +1 -1
- package/src/scripts/workflow/git-exec.d.ts +32 -28
- package/src/scripts/workflow/git-exec.js +92 -85
- package/src/scripts/workflow/git-exec.js.map +1 -1
- package/src/scripts/workflow/git-findForkPoint.d.ts +12 -3
- package/src/scripts/workflow/git-findForkPoint.js +116 -107
- package/src/scripts/workflow/git-findForkPoint.js.map +1 -1
- package/src/scripts/workflow/git-readAiBranchName.d.ts +7 -2
- package/src/scripts/workflow/git-readAiBranchName.js +24 -15
- package/src/scripts/workflow/git-readAiBranchName.js.map +1 -1
- package/src/scripts/workflow/merge-end.d.ts +21 -6
- package/src/scripts/workflow/merge-end.js +147 -133
- package/src/scripts/workflow/merge-end.js.map +1 -1
- package/src/scripts/workflow/merge-start.d.ts +22 -1
- package/src/scripts/workflow/merge-start.js +180 -186
- package/src/scripts/workflow/merge-start.js.map +1 -1
- package/src/scripts/workflow/merge-state.d.ts +26 -23
- package/src/scripts/workflow/merge-state.js +131 -137
- package/src/scripts/workflow/merge-state.js.map +1 -1
- package/src/scripts/workflow/open-pr-check.d.ts +7 -1
- package/src/scripts/workflow/open-pr-check.js +34 -23
- package/src/scripts/workflow/open-pr-check.js.map +1 -1
- package/src/scripts/workflow/run-update.d.ts +13 -1
- package/src/scripts/workflow/run-update.js +59 -28
- package/src/scripts/workflow/run-update.js.map +1 -1
- package/src/scripts/wp-finish-update.d.ts +1 -1
- package/src/scripts/wp-finish-update.js +11 -30
- package/src/scripts/wp-finish-update.js.map +1 -1
- package/src/scripts/wp-start-update.d.ts +1 -2
- package/src/scripts/wp-start-update.js +11 -51
- package/src/scripts/wp-start-update.js.map +1 -1
- package/src/scripts/wp-start-upsert-pr.d.ts +1 -1
- package/src/scripts/wp-start-upsert-pr.js +11 -47
- package/src/scripts/wp-start-upsert-pr.js.map +1 -1
|
@@ -1,38 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.RunUpdate = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const rules_config_1 = require("@webpieces/rules-config");
|
|
6
|
+
const core_context_1 = require("@webpieces/core-context");
|
|
7
|
+
const inversify_1 = require("inversify");
|
|
5
8
|
const git_readAiBranchName_1 = require("./git-readAiBranchName");
|
|
6
9
|
const merge_state_1 = require("./merge-state");
|
|
7
10
|
const merge_start_1 = require("./merge-start");
|
|
8
11
|
const merge_end_1 = require("./merge-end");
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
12
|
+
// The shared "sync this feature branch from main" engine — a thin composition of the two lifecycle
|
|
13
|
+
// primitives (merge-START brings main in, merge-END finalizes). INTERNAL, not a bin: `wp-start-update`
|
|
14
|
+
// (standalone) and `wp-start-upsert-pr` (PR flow) both call it. It NEVER creates a PR and NEVER
|
|
15
|
+
// process.exits; it RETURNS an outcome so each caller prints the handoff that fits its context.
|
|
16
|
+
let RunUpdate = class RunUpdate {
|
|
17
|
+
aiBranchName;
|
|
18
|
+
mergeState;
|
|
19
|
+
mergeStart;
|
|
20
|
+
mergeEnd;
|
|
21
|
+
constructor(aiBranchName, mergeState, mergeStart, mergeEnd) {
|
|
22
|
+
this.aiBranchName = aiBranchName;
|
|
23
|
+
this.mergeState = mergeState;
|
|
24
|
+
this.mergeStart = mergeStart;
|
|
25
|
+
this.mergeEnd = mergeEnd;
|
|
26
|
+
}
|
|
27
|
+
// `finishCommand` is the command the AI is told to run after resolving conflicts (standalone passes
|
|
28
|
+
// `wp-finish-update`, PR flow passes `wp-finish-upsert-pr`). `verb` is the invoking bin, threaded so
|
|
29
|
+
// every branch mutation is recorded in `.webpieces/hooks/branch-mutations.log`.
|
|
30
|
+
async runUpdateFromMain(repoRoot, verb, finishCommand) {
|
|
31
|
+
(0, rules_config_1.logBranchMutation)(repoRoot, new rules_config_1.BranchMutationEvent(verb, 'START'));
|
|
32
|
+
const outcome = await this.runUpdate(repoRoot, verb, finishCommand);
|
|
33
|
+
const end = new rules_config_1.BranchMutationEvent(verb, 'END');
|
|
34
|
+
end.outcome = outcome;
|
|
35
|
+
(0, rules_config_1.logBranchMutation)(repoRoot, end);
|
|
36
|
+
return outcome;
|
|
28
37
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
38
|
+
async runUpdate(repoRoot, verb, finishCommand) {
|
|
39
|
+
const home = this.mergeState.mergeDirFor(repoRoot, this.aiBranchName.getFeatureName());
|
|
40
|
+
// Resume path: an in-progress merge is the `merge-<n>/` run dir that holds a marker.
|
|
41
|
+
const activeDir = this.mergeState.findActiveMergeRunDir(home);
|
|
42
|
+
if (activeDir) {
|
|
43
|
+
const existing = this.mergeState.readMergeMarker(activeDir);
|
|
44
|
+
if (existing === null || !existing.validated)
|
|
45
|
+
return 'unvalidatedResume';
|
|
46
|
+
// Already validated → just finalize the branch swap (reads THIS run dir's marker).
|
|
47
|
+
await this.mergeEnd.mergeEnd(repoRoot, verb, activeDir, new merge_start_1.MergeContext(existing.currentBranch, existing.squashBranch, existing.backupBranch, existing.prNumber), null);
|
|
48
|
+
return 'finalized';
|
|
49
|
+
}
|
|
50
|
+
// Fresh update: mergeStart picks the slot number, creates its own `merge-<n>/` run dir, and
|
|
51
|
+
// returns that path for merge-END to finalize against.
|
|
52
|
+
const result = await this.mergeStart.mergeStart(repoRoot, verb, home, finishCommand);
|
|
53
|
+
if (result.status === 'conflict' || result.context === null) {
|
|
54
|
+
return 'conflict';
|
|
55
|
+
}
|
|
56
|
+
await this.mergeEnd.mergeEnd(repoRoot, verb, result.runDir, result.context, null);
|
|
57
|
+
return 'finalized';
|
|
34
58
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
59
|
+
};
|
|
60
|
+
exports.RunUpdate = RunUpdate;
|
|
61
|
+
exports.RunUpdate = RunUpdate = tslib_1.__decorate([
|
|
62
|
+
(0, core_context_1.provideSingleton)(),
|
|
63
|
+
(0, inversify_1.injectable)(),
|
|
64
|
+
tslib_1.__metadata("design:paramtypes", [git_readAiBranchName_1.AiBranchName,
|
|
65
|
+
merge_state_1.MergeState,
|
|
66
|
+
merge_start_1.MergeStart,
|
|
67
|
+
merge_end_1.MergeEnd])
|
|
68
|
+
], RunUpdate);
|
|
38
69
|
//# sourceMappingURL=run-update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-update.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/run-update.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run-update.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/run-update.ts"],"names":[],"mappings":";;;;AAAA,0DAA+F;AAC/F,0DAA2D;AAC3D,yCAAuC;AACvC,iEAAsD;AACtD,+CAA2C;AAC3C,+CAAyD;AACzD,2CAAuC;AAIvC,mGAAmG;AACnG,uGAAuG;AACvG,gGAAgG;AAChG,gGAAgG;AAGzF,IAAM,SAAS,GAAf,MAAM,SAAS;IAEG;IACA;IACA;IACA;IAJrB,YACqB,YAA0B,EAC1B,UAAsB,EACtB,UAAsB,EACtB,QAAkB;QAHlB,iBAAY,GAAZ,YAAY,CAAc;QAC1B,eAAU,GAAV,UAAU,CAAY;QACtB,eAAU,GAAV,UAAU,CAAY;QACtB,aAAQ,GAAR,QAAQ,CAAU;IACpC,CAAC;IAEJ,oGAAoG;IACpG,qGAAqG;IACrG,gFAAgF;IAChF,KAAK,CAAC,iBAAiB,CAAC,QAAgB,EAAE,IAAkB,EAAE,aAAqB;QAC/E,IAAA,gCAAiB,EAAC,QAAQ,EAAE,IAAI,kCAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC;QACpE,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACpE,MAAM,GAAG,GAAG,IAAI,kCAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACjD,GAAG,CAAC,OAAO,GAAG,OAAO,CAAC;QACtB,IAAA,gCAAiB,EAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACjC,OAAO,OAAO,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,SAAS,CAAC,QAAgB,EAAE,IAAkB,EAAE,aAAqB;QAC/E,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,QAAQ,EAAE,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,CAAC,CAAC;QAEvF,qFAAqF;QACrF,MAAM,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC9D,IAAI,SAAS,EAAE,CAAC;YACZ,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC;YAC5D,IAAI,QAAQ,KAAK,IAAI,IAAI,CAAC,QAAQ,CAAC,SAAS;gBAAE,OAAO,mBAAmB,CAAC;YACzE,mFAAmF;YACnF,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CACxB,QAAQ,EAAE,IAAI,EAAE,SAAS,EACzB,IAAI,0BAAY,CAAC,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,QAAQ,CAAC,EACzG,IAAI,CACP,CAAC;YACF,OAAO,WAAW,CAAC;QACvB,CAAC;QAED,4FAA4F;QAC5F,uDAAuD;QACvD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC;QACrF,IAAI,MAAM,CAAC,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;YAC1D,OAAO,UAAU,CAAC;QACtB,CAAC;QACD,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAClF,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ,CAAA;AA9CY,8BAAS;oBAAT,SAAS;IAFrB,IAAA,+BAAgB,GAAE;IAClB,IAAA,sBAAU,GAAE;6CAG0B,mCAAY;QACd,wBAAU;QACV,wBAAU;QACZ,oBAAQ;GAL9B,SAAS,CA8CrB","sourcesContent":["import { MutationVerb, BranchMutationEvent, logBranchMutation } from '@webpieces/rules-config';\nimport { provideSingleton } from '@webpieces/core-context';\nimport { injectable } from 'inversify';\nimport { AiBranchName } from './git-readAiBranchName';\nimport { MergeState } from './merge-state';\nimport { MergeStart, MergeContext } from './merge-start';\nimport { MergeEnd } from './merge-end';\n\nexport type UpdateOutcome = 'finalized' | 'conflict' | 'unvalidatedResume';\n\n// The shared \"sync this feature branch from main\" engine — a thin composition of the two lifecycle\n// primitives (merge-START brings main in, merge-END finalizes). INTERNAL, not a bin: `wp-start-update`\n// (standalone) and `wp-start-upsert-pr` (PR flow) both call it. It NEVER creates a PR and NEVER\n// process.exits; it RETURNS an outcome so each caller prints the handoff that fits its context.\n@provideSingleton()\n@injectable()\nexport class RunUpdate {\n constructor(\n private readonly aiBranchName: AiBranchName,\n private readonly mergeState: MergeState,\n private readonly mergeStart: MergeStart,\n private readonly mergeEnd: MergeEnd,\n ) {}\n\n // `finishCommand` is the command the AI is told to run after resolving conflicts (standalone passes\n // `wp-finish-update`, PR flow passes `wp-finish-upsert-pr`). `verb` is the invoking bin, threaded so\n // every branch mutation is recorded in `.webpieces/hooks/branch-mutations.log`.\n async runUpdateFromMain(repoRoot: string, verb: MutationVerb, finishCommand: string): Promise<UpdateOutcome> {\n logBranchMutation(repoRoot, new BranchMutationEvent(verb, 'START'));\n const outcome = await this.runUpdate(repoRoot, verb, finishCommand);\n const end = new BranchMutationEvent(verb, 'END');\n end.outcome = outcome;\n logBranchMutation(repoRoot, end);\n return outcome;\n }\n\n private async runUpdate(repoRoot: string, verb: MutationVerb, finishCommand: string): Promise<UpdateOutcome> {\n const home = this.mergeState.mergeDirFor(repoRoot, this.aiBranchName.getFeatureName());\n\n // Resume path: an in-progress merge is the `merge-<n>/` run dir that holds a marker.\n const activeDir = this.mergeState.findActiveMergeRunDir(home);\n if (activeDir) {\n const existing = this.mergeState.readMergeMarker(activeDir);\n if (existing === null || !existing.validated) return 'unvalidatedResume';\n // Already validated → just finalize the branch swap (reads THIS run dir's marker).\n await this.mergeEnd.mergeEnd(\n repoRoot, verb, activeDir,\n new MergeContext(existing.currentBranch, existing.squashBranch, existing.backupBranch, existing.prNumber),\n null,\n );\n return 'finalized';\n }\n\n // Fresh update: mergeStart picks the slot number, creates its own `merge-<n>/` run dir, and\n // returns that path for merge-END to finalize against.\n const result = await this.mergeStart.mergeStart(repoRoot, verb, home, finishCommand);\n if (result.status === 'conflict' || result.context === null) {\n return 'conflict';\n }\n await this.mergeEnd.mergeEnd(repoRoot, verb, result.runDir, result.context, null);\n return 'finalized';\n }\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import 'reflect-metadata';
|
|
@@ -1,35 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
const
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const binding_decorators_1 = require("@inversifyjs/binding-decorators");
|
|
6
7
|
const rules_config_1 = require("@webpieces/rules-config");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// / PR — that is wp-finish-upsert-pr (the PR flow's finish). Refuses to run when there is no merge in
|
|
16
|
-
// progress (a clean `wp-start-update` finalizes on its own — there is nothing left for this to do).
|
|
17
|
-
async function main() {
|
|
18
|
-
const repoRoot = (0, child_process_1.execSync)('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();
|
|
19
|
-
const home = (0, merge_state_1.mergeDirFor)(repoRoot, (0, git_readAiBranchName_1.getFeatureName)());
|
|
20
|
-
// The in-progress merge is the `merge-<n>/` run dir holding a marker.
|
|
21
|
-
const activeDir = (0, merge_state_1.findActiveMergeRunDir)(home);
|
|
22
|
-
const marker = activeDir ? (0, merge_state_1.readMergeMarker)(activeDir) : null;
|
|
23
|
-
if (!activeDir || !marker) {
|
|
24
|
-
throw new rules_config_1.CliExitError(1, '❌ No merge in progress (no marker) — nothing to finalize.\n' +
|
|
25
|
-
'Start one with: pnpm wp-start-update (a clean update finalizes itself).');
|
|
26
|
-
}
|
|
27
|
-
// Not yet validated => a conflict resolution the AI owns, so validate + commit it first; already
|
|
28
|
-
// validated => clean merge (or previously validated) => finalize only.
|
|
29
|
-
const conflictedFiles = marker.validated ? null : marker.conflictedFiles;
|
|
30
|
-
await (0, merge_end_1.mergeEnd)(repoRoot, 'wp-finish-update', activeDir, new merge_start_1.MergeContext(marker.currentBranch, marker.squashBranch, marker.backupBranch, marker.prNumber), conflictedFiles);
|
|
31
|
-
process.stdout.write('\n✅ Merge finalized on ' + marker.currentBranch + '.\n');
|
|
32
|
-
}
|
|
33
|
-
if (require.main === module)
|
|
34
|
-
(0, rules_config_1.runMain)(main);
|
|
8
|
+
const pr_gate_app_1 = require("./pr-gate-app");
|
|
9
|
+
// Composition root: build the container and resolve the app so inversify constructs the whole DAG.
|
|
10
|
+
(0, rules_config_1.runMain)(async () => {
|
|
11
|
+
const container = new inversify_1.Container();
|
|
12
|
+
container.bind(rules_config_1.RepoRootFinder).toConstantValue(new rules_config_1.RepoRootFinder());
|
|
13
|
+
await container.load((0, binding_decorators_1.buildProviderModule)());
|
|
14
|
+
await container.get(pr_gate_app_1.PrGateApp).finishUpdate();
|
|
15
|
+
});
|
|
35
16
|
//# sourceMappingURL=wp-finish-update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wp-finish-update.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-finish-update.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"wp-finish-update.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-finish-update.ts"],"names":[],"mappings":";;;AACA,4BAA0B;AAC1B,yCAAsC;AACtC,wEAAsE;AACtE,0DAAkE;AAClE,+CAA0C;AAE1C,mGAAmG;AACnG,IAAA,sBAAO,EAAC,KAAK,IAAmB,EAAE;IAC9B,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;IAClC,SAAS,CAAC,IAAI,CAAC,6BAAc,CAAC,CAAC,eAAe,CAAC,IAAI,6BAAc,EAAE,CAAC,CAAC;IACrE,MAAM,SAAS,CAAC,IAAI,CAAC,IAAA,wCAAmB,GAAE,CAAC,CAAC;IAC5C,MAAM,SAAS,CAAC,GAAG,CAAC,uBAAS,CAAC,CAAC,YAAY,EAAE,CAAC;AAClD,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport 'reflect-metadata';\nimport { Container } from 'inversify';\nimport { buildProviderModule } from '@inversifyjs/binding-decorators';\nimport { runMain, RepoRootFinder } from '@webpieces/rules-config';\nimport { PrGateApp } from './pr-gate-app';\n\n// Composition root: build the container and resolve the app so inversify constructs the whole DAG.\nrunMain(async (): Promise<void> => {\n const container = new Container();\n container.bind(RepoRootFinder).toConstantValue(new RepoRootFinder());\n await container.load(buildProviderModule());\n await container.get(PrGateApp).finishUpdate();\n});\n"]}
|
|
@@ -1,56 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const binding_decorators_1 = require("@inversifyjs/binding-decorators");
|
|
7
7
|
const rules_config_1 = require("@webpieces/rules-config");
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
// If a PR is already OPEN for this branch, wp-start-update 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
|
-
function assertNoOpenPr(repoRoot) {
|
|
23
|
-
const branch = (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { cwd: repoRoot, encoding: 'utf8' }).trim();
|
|
24
|
-
const openPr = (0, open_pr_check_1.openPrForBranch)(repoRoot, branch);
|
|
25
|
-
if (openPr === '')
|
|
26
|
-
return;
|
|
27
|
-
throw new rules_config_1.CliExitError(2, '\n' + SEP + `⛔ An open PR (#${openPr}) already tracks this branch\n` + SEP + '\n' +
|
|
28
|
-
'wp-start-update 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
|
-
' 1. pnpm wp-start-upsert-pr\n' +
|
|
32
|
-
' 2. /wp-merge (only if conflicts)\n' +
|
|
33
|
-
' 3. pnpm wp-finish-upsert-pr\n');
|
|
34
|
-
}
|
|
35
|
-
async function main() {
|
|
36
|
-
const repoRoot = (0, child_process_1.execSync)('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();
|
|
37
|
-
// Refresh the AI-facing workflow doc so it's present + current for any failure message to cite.
|
|
38
|
-
(0, rules_config_1.writeTemplate)(repoRoot, 'webpieces.git-workflow.md');
|
|
39
|
-
// An open PR means the PR flow must be used — a 3-point update would strand the PR on the old
|
|
40
|
-
// branch generation. Fails fast if GitHub can't be reached (never guesses "no PR").
|
|
41
|
-
assertNoOpenPr(repoRoot);
|
|
42
|
-
const outcome = await (0, run_update_1.runUpdateFromMain)(repoRoot, 'wp-start-update', 'wp-finish-update');
|
|
43
|
-
if (outcome === 'conflict') {
|
|
44
|
-
// Context + marker + merge process doc already written by merge-start; hand back to the AI.
|
|
45
|
-
throw new rules_config_1.CliExitError(2, '');
|
|
46
|
-
}
|
|
47
|
-
if (outcome === 'unvalidatedResume') {
|
|
48
|
-
throw new rules_config_1.CliExitError(1, '\n' + SEP + '⏸️ Merge in progress — not yet validated\n' + SEP + '\n' +
|
|
49
|
-
'Resolve the remaining conflicts in the working tree, then run:\n' +
|
|
50
|
-
' pnpm wp-finish-update\n');
|
|
51
|
-
}
|
|
52
|
-
process.stdout.write('\n✅ Updated from main — clean. No need to call wp-finish-update.\n');
|
|
53
|
-
}
|
|
54
|
-
if (require.main === module)
|
|
55
|
-
(0, rules_config_1.runMain)(main);
|
|
8
|
+
const pr_gate_app_1 = require("./pr-gate-app");
|
|
9
|
+
// Composition root: build the container and resolve the app so inversify constructs the whole DAG.
|
|
10
|
+
(0, rules_config_1.runMain)(async () => {
|
|
11
|
+
const container = new inversify_1.Container();
|
|
12
|
+
container.bind(rules_config_1.RepoRootFinder).toConstantValue(new rules_config_1.RepoRootFinder());
|
|
13
|
+
await container.load((0, binding_decorators_1.buildProviderModule)());
|
|
14
|
+
await container.get(pr_gate_app_1.PrGateApp).startUpdate();
|
|
15
|
+
});
|
|
56
16
|
//# sourceMappingURL=wp-start-update.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wp-start-update.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-start-update.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"wp-start-update.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-start-update.ts"],"names":[],"mappings":";;;AACA,4BAA0B;AAC1B,yCAAsC;AACtC,wEAAsE;AACtE,0DAAkE;AAClE,+CAA0C;AAE1C,mGAAmG;AACnG,IAAA,sBAAO,EAAC,KAAK,IAAmB,EAAE;IAC9B,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;IAClC,SAAS,CAAC,IAAI,CAAC,6BAAc,CAAC,CAAC,eAAe,CAAC,IAAI,6BAAc,EAAE,CAAC,CAAC;IACrE,MAAM,SAAS,CAAC,IAAI,CAAC,IAAA,wCAAmB,GAAE,CAAC,CAAC;IAC5C,MAAM,SAAS,CAAC,GAAG,CAAC,uBAAS,CAAC,CAAC,WAAW,EAAE,CAAC;AACjD,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport 'reflect-metadata';\nimport { Container } from 'inversify';\nimport { buildProviderModule } from '@inversifyjs/binding-decorators';\nimport { runMain, RepoRootFinder } from '@webpieces/rules-config';\nimport { PrGateApp } from './pr-gate-app';\n\n// Composition root: build the container and resolve the app so inversify constructs the whole DAG.\nrunMain(async (): Promise<void> => {\n const container = new Container();\n container.bind(RepoRootFinder).toConstantValue(new RepoRootFinder());\n await container.load(buildProviderModule());\n await container.get(PrGateApp).startUpdate();\n});\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
2
|
+
import 'reflect-metadata';
|
|
@@ -1,52 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
|
|
5
|
-
const
|
|
4
|
+
require("reflect-metadata");
|
|
5
|
+
const inversify_1 = require("inversify");
|
|
6
|
+
const binding_decorators_1 = require("@inversifyjs/binding-decorators");
|
|
6
7
|
const rules_config_1 = require("@webpieces/rules-config");
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// posts the PR). This command NEVER creates/updates a PR; all `gh` posting lives in finish.
|
|
16
|
-
const SEP = '━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n';
|
|
17
|
-
// Step A — bring the branch up to date with main via the shared 3-point engine (in-process). On
|
|
18
|
-
// conflict the merge process doc it writes names `wp-finish-upsert-pr` as the finish command (this
|
|
19
|
-
// PR flow's finish, which validates + finalizes + builds + posts the PR).
|
|
20
|
-
async function updateBranchFromMain(repoRoot) {
|
|
21
|
-
process.stdout.write('\n' + SEP + '① Updating branch from main\n' + SEP + '\n');
|
|
22
|
-
const outcome = await (0, run_update_1.runUpdateFromMain)(repoRoot, 'wp-start-upsert-pr', 'wp-finish-upsert-pr');
|
|
23
|
-
if (outcome === 'conflict' || outcome === 'unvalidatedResume') {
|
|
24
|
-
throw new rules_config_1.CliExitError(2, '\n⏸️ Conflicts — resolve them, then run pnpm wp-finish-upsert-pr (it validates the merge AND finishes the PR).');
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
async function main() {
|
|
28
|
-
const repoRoot = (0, child_process_1.execSync)('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();
|
|
29
|
-
// Refresh the AI-facing workflow doc so it's present + current for any failure message to cite.
|
|
30
|
-
(0, rules_config_1.writeTemplate)(repoRoot, 'webpieces.git-workflow.md');
|
|
31
|
-
// Precondition: a fully-committed tree. This flow updates, pushes HEAD, and builds — the tooling
|
|
32
|
-
// must not commit your work for you, and pushing HEAD while building the working tree would let an
|
|
33
|
-
// uncommitted change build green yet push a stale commit. Fail early with instructions if dirty.
|
|
34
|
-
(0, git_exec_1.assertCleanTree)(repoRoot);
|
|
35
|
-
await updateBranchFromMain(repoRoot);
|
|
36
|
-
// Local branch, remote branch, and PR share the one stable feature name (baseBranchName also
|
|
37
|
-
// tolerates a leftover `…wpN` from the old scheme).
|
|
38
|
-
(0, git_exec_1.ensurePushed)((0, branch_naming_1.baseBranchName)((0, child_process_1.execSync)('git branch --show-current', { encoding: 'utf8' }).trim()));
|
|
39
|
-
// Advisory build gate — early feedback before the AI writes review.json. wp-finish-upsert-pr runs
|
|
40
|
-
// the authoritative one. Both go through the same shared runBuildGate (only the framing differs).
|
|
41
|
-
(0, build_affected_1.runBuildGate)(repoRoot, new build_affected_1.BuildGateOptions('② Build gate (nx affected)', 'pnpm wp-start-upsert-pr', 'Build failed — fix it before reviewing.'));
|
|
42
|
-
// Hand the AI its next step: write review.json, then run finish (which posts the PR).
|
|
43
|
-
const reviewPath = (0, rules_config_1.reviewJsonPath)(repoRoot, (0, git_readAiBranchName_1.getFeatureName)());
|
|
44
|
-
process.stdout.write('\n' + SEP + '③ Review the PR, then finish\n' + SEP + '\n');
|
|
45
|
-
process.stdout.write(`Branch is updated, pushed, and the build gate passed. Now review your own changes and\n` +
|
|
46
|
-
`${(0, rules_config_1.reviewJsonSchemaHint)(reviewPath)}\n\n` +
|
|
47
|
-
`Then run: pnpm wp-finish-upsert-pr\n` +
|
|
48
|
-
`(It re-validates the build, renders the dashboard with your risk/violations, and creates/updates the PR.)\n\n`);
|
|
49
|
-
}
|
|
50
|
-
if (require.main === module)
|
|
51
|
-
(0, rules_config_1.runMain)(main);
|
|
8
|
+
const pr_gate_app_1 = require("./pr-gate-app");
|
|
9
|
+
// Composition root: build the container and resolve the app so inversify constructs the whole DAG.
|
|
10
|
+
(0, rules_config_1.runMain)(async () => {
|
|
11
|
+
const container = new inversify_1.Container();
|
|
12
|
+
container.bind(rules_config_1.RepoRootFinder).toConstantValue(new rules_config_1.RepoRootFinder());
|
|
13
|
+
await container.load((0, binding_decorators_1.buildProviderModule)());
|
|
14
|
+
await container.get(pr_gate_app_1.PrGateApp).startUpsertPr();
|
|
15
|
+
});
|
|
52
16
|
//# sourceMappingURL=wp-start-upsert-pr.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wp-start-upsert-pr.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-start-upsert-pr.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"wp-start-upsert-pr.js","sourceRoot":"","sources":["../../../../../../packages/tooling/pr-gate/src/scripts/wp-start-upsert-pr.ts"],"names":[],"mappings":";;;AACA,4BAA0B;AAC1B,yCAAsC;AACtC,wEAAsE;AACtE,0DAAkE;AAClE,+CAA0C;AAE1C,mGAAmG;AACnG,IAAA,sBAAO,EAAC,KAAK,IAAmB,EAAE;IAC9B,MAAM,SAAS,GAAG,IAAI,qBAAS,EAAE,CAAC;IAClC,SAAS,CAAC,IAAI,CAAC,6BAAc,CAAC,CAAC,eAAe,CAAC,IAAI,6BAAc,EAAE,CAAC,CAAC;IACrE,MAAM,SAAS,CAAC,IAAI,CAAC,IAAA,wCAAmB,GAAE,CAAC,CAAC;IAC5C,MAAM,SAAS,CAAC,GAAG,CAAC,uBAAS,CAAC,CAAC,aAAa,EAAE,CAAC;AACnD,CAAC,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport 'reflect-metadata';\nimport { Container } from 'inversify';\nimport { buildProviderModule } from '@inversifyjs/binding-decorators';\nimport { runMain, RepoRootFinder } from '@webpieces/rules-config';\nimport { PrGateApp } from './pr-gate-app';\n\n// Composition root: build the container and resolve the app so inversify constructs the whole DAG.\nrunMain(async (): Promise<void> => {\n const container = new Container();\n container.bind(RepoRootFinder).toConstantValue(new RepoRootFinder());\n await container.load(buildProviderModule());\n await container.get(PrGateApp).startUpsertPr();\n});\n"]}
|