@webpieces/pr-gate 0.3.354 โ 0.3.356
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,55 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BuildGateOptions = exports.DEFAULT_BUILD_COMMAND = void 0;
|
|
4
|
-
|
|
5
|
-
exports.runBuildAffected = runBuildAffected;
|
|
6
|
-
exports.runConfiguredBuildGate = runConfiguredBuildGate;
|
|
7
|
-
exports.runBuildGate = runBuildGate;
|
|
3
|
+
exports.BuildAffected = exports.BuildGateOptions = exports.DEFAULT_BUILD_COMMAND = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
8
5
|
const child_process_1 = require("child_process");
|
|
9
6
|
const rules_config_1 = require("@webpieces/rules-config");
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// branch's changes. The `$(...)` resolves
|
|
7
|
+
const core_context_1 = require("@webpieces/core-context");
|
|
8
|
+
const inversify_1 = require("inversify");
|
|
9
|
+
// Single source of truth for the build gate. The PR flow's advisory gate (`wp-start-upsert-pr`) and
|
|
10
|
+
// authoritative merge gate (`wp-finish-upsert-pr`) both run THIS, so the two can never drift. nx
|
|
11
|
+
// `affected` only rebuilds changed projects. `--base=$(git merge-base origin/main HEAD)` (the fork
|
|
12
|
+
// point) instead of `--base=origin/main`: origin/main rebuilds projects touched by OTHER people's
|
|
13
|
+
// merged PRs. The fork point scopes affected to only YOUR branch's changes. The `$(...)` resolves
|
|
14
|
+
// because runBuildAffected runs with shell: true.
|
|
17
15
|
exports.DEFAULT_BUILD_COMMAND = 'pnpm nx affected --target=ci --base=$(git merge-base origin/main HEAD)';
|
|
18
|
-
/**
|
|
19
|
-
* Resolve the exact build command this gate will run for a repo: the project's configured
|
|
20
|
-
* PrGateConfig.buildCommand, or the default affected-ci command when none is set. Callers
|
|
21
|
-
* print this so the AI knows precisely which command to run locally to get the gate passing.
|
|
22
|
-
*/
|
|
23
|
-
function resolveBuildCommand(repoRoot) {
|
|
24
|
-
const configured = (0, rules_config_1.loadAndValidate)(repoRoot).prGate.buildCommand;
|
|
25
|
-
return configured !== undefined && configured.trim() !== '' ? configured : exports.DEFAULT_BUILD_COMMAND;
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* Run the build gate. Returns the process exit code (0 = pass). `buildCommand` overrides
|
|
29
|
-
* the default (sourced from PrGateConfig.buildCommand by callers); empty/undefined uses the
|
|
30
|
-
* default affected-ci command.
|
|
31
|
-
*/
|
|
32
|
-
function runBuildAffected(repoRoot, buildCommand) {
|
|
33
|
-
const cmd = buildCommand !== undefined && buildCommand.trim() !== '' ? buildCommand : exports.DEFAULT_BUILD_COMMAND;
|
|
34
|
-
process.stdout.write(`\nโถ Build gate: ${cmd}\n\n`);
|
|
35
|
-
const result = (0, child_process_1.spawnSync)(cmd, { stdio: 'inherit', cwd: repoRoot, shell: true });
|
|
36
|
-
return result.status ?? 1;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Run the build gate using the project's configured command (PrGateConfig.buildCommand). The
|
|
40
|
-
* finish-upsert-pr gate and wp-start-upsert-pr both call THIS so they provably build with the same
|
|
41
|
-
* command โ the resolution the AI validates is built exactly as the PR command builds it.
|
|
42
|
-
* Returns the exit code; callers print their own re-run hint.
|
|
43
|
-
*/
|
|
44
|
-
function runConfiguredBuildGate(repoRoot) {
|
|
45
|
-
return runBuildAffected(repoRoot, (0, rules_config_1.loadAndValidate)(repoRoot).prGate.buildCommand);
|
|
46
|
-
}
|
|
47
16
|
const SEP = 'โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n';
|
|
48
17
|
/**
|
|
49
|
-
* The two facts that differ between the wp-start (advisory) and wp-finish (authoritative) build
|
|
50
|
-
*
|
|
51
|
-
*
|
|
52
|
-
* an object literal) per the codebase's data-structure convention.
|
|
18
|
+
* The two facts that differ between the wp-start (advisory) and wp-finish (authoritative) build gates.
|
|
19
|
+
* Everything else is identical, so it lives once in runBuildGate and the difference is passed in here.
|
|
20
|
+
* A class (not an object literal) per the codebase's data-structure convention.
|
|
53
21
|
*/
|
|
54
22
|
class BuildGateOptions {
|
|
55
23
|
label; // section header shown above the gate
|
|
@@ -62,23 +30,49 @@ class BuildGateOptions {
|
|
|
62
30
|
}
|
|
63
31
|
}
|
|
64
32
|
exports.BuildGateOptions = BuildGateOptions;
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
process.stdout.write(`Running the build gate. To get it passing, run the SAME command yourself and fix everything it reports:\n\n` +
|
|
75
|
-
` ${buildCommand}\n\n`);
|
|
76
|
-
const buildCode = runConfiguredBuildGate(repoRoot);
|
|
77
|
-
if (buildCode !== 0) {
|
|
78
|
-
throw new rules_config_1.CliExitError(buildCode, `\nโ ${opts.failureHeadline}\n\n` +
|
|
79
|
-
`Run THIS exact command to reproduce and fix all errors, then re-run ${opts.rerunCommand}:\n\n` +
|
|
80
|
-
` ${buildCommand}\n`);
|
|
33
|
+
/** Runs the nx-affected build gate the same way for the advisory and authoritative PR gates. */
|
|
34
|
+
let BuildAffected = class BuildAffected {
|
|
35
|
+
/**
|
|
36
|
+
* Resolve the exact build command this gate will run: the project's configured
|
|
37
|
+
* PrGateConfig.buildCommand, or the default affected-ci command when none is set.
|
|
38
|
+
*/
|
|
39
|
+
resolveBuildCommand(repoRoot) {
|
|
40
|
+
const configured = (0, rules_config_1.loadAndValidate)(repoRoot).prGate.buildCommand;
|
|
41
|
+
return configured !== undefined && configured.trim() !== '' ? configured : exports.DEFAULT_BUILD_COMMAND;
|
|
81
42
|
}
|
|
82
|
-
process
|
|
83
|
-
|
|
43
|
+
/** Run the build gate. Returns the process exit code (0 = pass). */
|
|
44
|
+
runBuildAffected(repoRoot, buildCommand) {
|
|
45
|
+
const cmd = buildCommand !== undefined && buildCommand.trim() !== '' ? buildCommand : exports.DEFAULT_BUILD_COMMAND;
|
|
46
|
+
process.stdout.write(`\nโถ Build gate: ${cmd}\n\n`);
|
|
47
|
+
const result = (0, child_process_1.spawnSync)(cmd, { stdio: 'inherit', cwd: repoRoot, shell: true });
|
|
48
|
+
return result.status ?? 1;
|
|
49
|
+
}
|
|
50
|
+
/** Run the build gate using the project's configured command (PrGateConfig.buildCommand). */
|
|
51
|
+
runConfiguredBuildGate(repoRoot) {
|
|
52
|
+
return this.runBuildAffected(repoRoot, (0, rules_config_1.loadAndValidate)(repoRoot).prGate.buildCommand);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Run the configured build gate with consistent framing, throwing CliExitError(buildCode) on
|
|
56
|
+
* failure so the bin's main()/runMain owns the exit. Single source of truth: wp-start-upsert-pr and
|
|
57
|
+
* wp-finish-upsert-pr both call THIS (only the BuildGateOptions differ).
|
|
58
|
+
*/
|
|
59
|
+
runBuildGate(repoRoot, opts) {
|
|
60
|
+
const buildCommand = this.resolveBuildCommand(repoRoot);
|
|
61
|
+
process.stdout.write('\n' + SEP + opts.label + '\n' + SEP + '\n');
|
|
62
|
+
process.stdout.write(`Running the build gate. To get it passing, run the SAME command yourself and fix everything it reports:\n\n` +
|
|
63
|
+
` ${buildCommand}\n\n`);
|
|
64
|
+
const buildCode = this.runConfiguredBuildGate(repoRoot);
|
|
65
|
+
if (buildCode !== 0) {
|
|
66
|
+
throw new rules_config_1.CliExitError(buildCode, `\nโ ${opts.failureHeadline}\n\n` +
|
|
67
|
+
`Run THIS exact command to reproduce and fix all errors, then re-run ${opts.rerunCommand}:\n\n` +
|
|
68
|
+
` ${buildCommand}\n`);
|
|
69
|
+
}
|
|
70
|
+
process.stdout.write('\nโ
Build passed.\n');
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.BuildAffected = BuildAffected;
|
|
74
|
+
exports.BuildAffected = BuildAffected = tslib_1.__decorate([
|
|
75
|
+
(0, core_context_1.provideSingleton)(),
|
|
76
|
+
(0, inversify_1.injectable)()
|
|
77
|
+
], BuildAffected);
|
|
84
78
|
//# sourceMappingURL=build-affected.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-affected.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/build-affected.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-affected.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/build-affected.ts"],"names":[],"mappings":";;;;AAAA,iDAA0C;AAC1C,0DAAwE;AACxE,0DAA2D;AAC3D,yCAAuC;AAEvC,oGAAoG;AACpG,iGAAiG;AACjG,mGAAmG;AACnG,kGAAkG;AAClG,kGAAkG;AAClG,kDAAkD;AACrC,QAAA,qBAAqB,GAAG,wEAAwE,CAAC;AAE9G,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE;;;;GAIG;AACH,MAAa,gBAAgB;IACzB,KAAK,CAAS,CAAY,sCAAsC;IAChE,YAAY,CAAS,CAAK,gDAAgD;IAC1E,eAAe,CAAS,CAAE,gCAAgC;IAE1D,YAAY,KAAa,EAAE,YAAoB,EAAE,eAAuB;QACpE,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IAC3C,CAAC;CACJ;AAVD,4CAUC;AAED,gGAAgG;AAGzF,IAAM,aAAa,GAAnB,MAAM,aAAa;IACtB;;;OAGG;IACH,mBAAmB,CAAC,QAAgB;QAChC,MAAM,UAAU,GAAG,IAAA,8BAAe,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC;QACjE,OAAO,UAAU,KAAK,SAAS,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,6BAAqB,CAAC;IACrG,CAAC;IAED,oEAAoE;IACpE,gBAAgB,CAAC,QAAgB,EAAE,YAAqB;QACpD,MAAM,GAAG,GAAG,YAAY,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AAqB,CAAC,CAAC;IAChD,CAAC;CACJ,CAAA;AA7CY,sCAAa;wBAAb,aAAa;IAFzB,IAAA,+BAAgB,GAAE;IAClB,IAAA,sBAAU,GAAE;GACA,aAAa,CA6CzB","sourcesContent":["import { spawnSync } from 'child_process';\nimport { loadAndValidate, CliExitError } from '@webpieces/rules-config';\nimport { provideSingleton } from '@webpieces/core-context';\nimport { injectable } from 'inversify';\n\n// Single source of truth for the build gate. The PR flow's advisory gate (`wp-start-upsert-pr`) and\n// authoritative merge gate (`wp-finish-upsert-pr`) both run THIS, so the two can never drift. nx\n// `affected` only rebuilds changed projects. `--base=$(git merge-base origin/main HEAD)` (the fork\n// point) instead of `--base=origin/main`: origin/main rebuilds projects touched by OTHER people's\n// merged PRs. The fork point scopes affected to only YOUR branch's changes. The `$(...)` resolves\n// because runBuildAffected runs with shell: true.\nexport const DEFAULT_BUILD_COMMAND = 'pnpm nx affected --target=ci --base=$(git merge-base origin/main HEAD)';\n\nconst SEP = 'โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\\n';\n\n/**\n * The two facts that differ between the wp-start (advisory) and wp-finish (authoritative) build gates.\n * Everything else is identical, so it lives once in runBuildGate and the difference is passed in here.\n * A class (not an object literal) per the codebase's data-structure convention.\n */\nexport class BuildGateOptions {\n label: string; // section header shown above the gate\n rerunCommand: string; // command the AI re-runs after fixing the build\n failureHeadline: string; // first line printed on failure\n\n constructor(label: string, rerunCommand: string, failureHeadline: string) {\n this.label = label;\n this.rerunCommand = rerunCommand;\n this.failureHeadline = failureHeadline;\n }\n}\n\n/** Runs the nx-affected build gate the same way for the advisory and authoritative PR gates. */\n@provideSingleton()\n@injectable()\nexport class BuildAffected {\n /**\n * Resolve the exact build command this gate will run: the project's configured\n * PrGateConfig.buildCommand, or the default affected-ci command when none is set.\n */\n resolveBuildCommand(repoRoot: string): string {\n const configured = loadAndValidate(repoRoot).prGate.buildCommand;\n return configured !== undefined && configured.trim() !== '' ? configured : DEFAULT_BUILD_COMMAND;\n }\n\n /** Run the build gate. Returns the process exit code (0 = pass). */\n runBuildAffected(repoRoot: string, buildCommand?: string): number {\n const cmd = buildCommand !== undefined && buildCommand.trim() !== '' ? buildCommand : DEFAULT_BUILD_COMMAND;\n process.stdout.write(`\\nโถ Build gate: ${cmd}\\n\\n`);\n const result = spawnSync(cmd, { stdio: 'inherit', cwd: repoRoot, shell: true });\n return result.status ?? 1;\n }\n\n /** Run the build gate using the project's configured command (PrGateConfig.buildCommand). */\n runConfiguredBuildGate(repoRoot: string): number {\n return this.runBuildAffected(repoRoot, loadAndValidate(repoRoot).prGate.buildCommand);\n }\n\n /**\n * Run the configured build gate with consistent framing, throwing CliExitError(buildCode) on\n * failure so the bin's main()/runMain owns the exit. Single source of truth: wp-start-upsert-pr and\n * wp-finish-upsert-pr both call THIS (only the BuildGateOptions differ).\n */\n runBuildGate(repoRoot: string, opts: BuildGateOptions): void {\n const buildCommand = this.resolveBuildCommand(repoRoot);\n process.stdout.write('\\n' + SEP + opts.label + '\\n' + SEP + '\\n');\n process.stdout.write(\n `Running the build gate. To get it passing, run the SAME command yourself and fix everything it reports:\\n\\n` +\n ` ${buildCommand}\\n\\n`,\n );\n const buildCode = this.runConfiguredBuildGate(repoRoot);\n if (buildCode !== 0) {\n throw new CliExitError(buildCode,\n `\\nโ ${opts.failureHeadline}\\n\\n` +\n `Run THIS exact command to reproduce and fix all errors, then re-run ${opts.rerunCommand}:\\n\\n` +\n ` ${buildCommand}\\n`,\n );\n }\n process.stdout.write('\\nโ
Build passed.\\n');\n }\n}\n"]}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/** 30-day cleanup of stale per-feature merge/pr-review dirs (and the legacy flat layout). */
|
|
2
|
+
export declare class CleanTmp {
|
|
3
|
+
cleanTmp(): Promise<void>;
|
|
4
|
+
private cleanStaleSubdirs;
|
|
5
|
+
private cleanLegacyTopLevel;
|
|
6
|
+
}
|
|
@@ -1,93 +1,98 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.CleanTmp = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const child_process_1 = require("child_process");
|
|
6
6
|
const fs = tslib_1.__importStar(require("fs"));
|
|
7
7
|
const path = tslib_1.__importStar(require("path"));
|
|
8
8
|
const rules_config_1 = require("@webpieces/rules-config");
|
|
9
|
+
const core_context_1 = require("@webpieces/core-context");
|
|
10
|
+
const inversify_1 = require("inversify");
|
|
9
11
|
const CUTOFF_DAYS = 30;
|
|
10
12
|
const SEP = 'โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\n';
|
|
11
|
-
// Per-feature workflow dirs
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// reaps the retired `pr-info/` home (it matches the `pr-` prefix and is no longer the active PR home).
|
|
13
|
+
// Per-feature workflow dirs live under `.webpieces/merge-info/<feature>` and `.webpieces/pr-review/
|
|
14
|
+
// <feature>`; those two homes are permanent (like hooks/ and instruct-ai/) and only their stale
|
|
15
|
+
// subdirs are cleaned. `LEGACY_PREFIXES` sweeps the old flat top-level layout so it self-clears โ which
|
|
16
|
+
// also reaps the retired `pr-info/` home (it matches `pr-` and is no longer the active PR home).
|
|
16
17
|
const LEGACY_PREFIXES = ['merge-', 'review-', 'pr-'];
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
18
|
+
/** 30-day cleanup of stale per-feature merge/pr-review dirs (and the legacy flat layout). */
|
|
19
|
+
let CleanTmp = class CleanTmp {
|
|
20
|
+
async cleanTmp() {
|
|
21
|
+
const repoRoot = (0, child_process_1.execSync)('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();
|
|
22
|
+
const tmpBase = path.join(repoRoot, rules_config_1.WEBPIECES_TMP_DIR);
|
|
23
|
+
if (!fs.existsSync(tmpBase)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
process.stdout.write('\n');
|
|
27
|
+
process.stdout.write(SEP);
|
|
28
|
+
process.stdout.write('๐งน Cleaning Old Temporary Directories\n');
|
|
29
|
+
process.stdout.write(SEP);
|
|
30
|
+
process.stdout.write('\n');
|
|
31
|
+
process.stdout.write(`Location: ${tmpBase}\n`);
|
|
32
|
+
process.stdout.write(`Retention: ${CUTOFF_DAYS} days\n`);
|
|
33
|
+
process.stdout.write('\n');
|
|
34
|
+
const cutoffMs = CUTOFF_DAYS * 24 * 60 * 60 * 1000;
|
|
35
|
+
const now = Date.now();
|
|
36
|
+
let deletedCount = 0;
|
|
37
|
+
// Stale per-feature subdirs under each permanent home.
|
|
38
|
+
deletedCount += this.cleanStaleSubdirs(path.join(tmpBase, rules_config_1.MERGE_INFO_DIR), rules_config_1.MERGE_INFO_DIR, now, cutoffMs);
|
|
39
|
+
deletedCount += this.cleanStaleSubdirs(path.join(tmpBase, rules_config_1.PR_REVIEW_DIR), rules_config_1.PR_REVIEW_DIR, now, cutoffMs);
|
|
40
|
+
// Legacy flat top-level dirs from before the merge-info/pr-review nesting (also reaps old pr-info/).
|
|
41
|
+
deletedCount += this.cleanLegacyTopLevel(tmpBase, now, cutoffMs);
|
|
42
|
+
if (deletedCount === 0) {
|
|
43
|
+
process.stdout.write(` โ
No directories older than ${CUTOFF_DAYS} days found\n`);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
process.stdout.write('\n');
|
|
47
|
+
process.stdout.write(` โ
Deleted ${deletedCount} old director${deletedCount === 1 ? 'y' : 'ies'}\n`);
|
|
48
|
+
}
|
|
49
|
+
process.stdout.write('\n');
|
|
50
|
+
process.stdout.write(SEP);
|
|
43
51
|
process.stdout.write('\n');
|
|
44
|
-
process.stdout.write(` โ
Deleted ${deletedCount} old director${deletedCount === 1 ? 'y' : 'ies'}\n`);
|
|
45
52
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
process.stdout.write(` ๐๏ธ Deleting: ${label}/${entry}\n`);
|
|
64
|
-
fs.rmSync(fullPath, { recursive: true, force: true });
|
|
65
|
-
count += 1;
|
|
53
|
+
// Delete immediate subdirs of `parentDir` whose mtime is older than the cutoff. No-op if absent.
|
|
54
|
+
cleanStaleSubdirs(parentDir, label, now, cutoffMs) {
|
|
55
|
+
if (!fs.existsSync(parentDir))
|
|
56
|
+
return 0;
|
|
57
|
+
let count = 0;
|
|
58
|
+
for (const entry of fs.readdirSync(parentDir)) {
|
|
59
|
+
const fullPath = path.join(parentDir, entry);
|
|
60
|
+
const stat = fs.statSync(fullPath);
|
|
61
|
+
if (!stat.isDirectory())
|
|
62
|
+
continue;
|
|
63
|
+
if (now - stat.mtimeMs < cutoffMs)
|
|
64
|
+
continue;
|
|
65
|
+
process.stdout.write(` ๐๏ธ Deleting: ${label}/${entry}\n`);
|
|
66
|
+
fs.rmSync(fullPath, { recursive: true, force: true });
|
|
67
|
+
count += 1;
|
|
68
|
+
}
|
|
69
|
+
return count;
|
|
66
70
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
count += 1;
|
|
71
|
+
// Sweep the pre-nesting flat layout (`merge-<feature>` etc.), skipping the current homes so this
|
|
72
|
+
// never deletes merge-info/ or pr-review/ themselves. Retired `pr-info/` IS swept (matches `pr-`).
|
|
73
|
+
cleanLegacyTopLevel(tmpBase, now, cutoffMs) {
|
|
74
|
+
let count = 0;
|
|
75
|
+
for (const entry of fs.readdirSync(tmpBase)) {
|
|
76
|
+
if (entry === rules_config_1.MERGE_INFO_DIR || entry === rules_config_1.PR_REVIEW_DIR)
|
|
77
|
+
continue;
|
|
78
|
+
if (!LEGACY_PREFIXES.some((prefix) => entry.startsWith(prefix)))
|
|
79
|
+
continue;
|
|
80
|
+
const fullPath = path.join(tmpBase, entry);
|
|
81
|
+
const stat = fs.statSync(fullPath);
|
|
82
|
+
if (!stat.isDirectory())
|
|
83
|
+
continue;
|
|
84
|
+
if (now - stat.mtimeMs < cutoffMs)
|
|
85
|
+
continue;
|
|
86
|
+
process.stdout.write(` ๐๏ธ Deleting: ${entry}\n`);
|
|
87
|
+
fs.rmSync(fullPath, { recursive: true, force: true });
|
|
88
|
+
count += 1;
|
|
89
|
+
}
|
|
90
|
+
return count;
|
|
88
91
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
(0,
|
|
92
|
+
};
|
|
93
|
+
exports.CleanTmp = CleanTmp;
|
|
94
|
+
exports.CleanTmp = CleanTmp = tslib_1.__decorate([
|
|
95
|
+
(0, core_context_1.provideSingleton)(),
|
|
96
|
+
(0, inversify_1.injectable)()
|
|
97
|
+
], CleanTmp);
|
|
93
98
|
//# sourceMappingURL=cleanTmp.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cleanTmp.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/cleanTmp.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cleanTmp.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/pr-gate/src/scripts/workflow/cleanTmp.ts"],"names":[],"mappings":";;;;AAAA,iDAAyC;AACzC,+CAAyB;AACzB,mDAA6B;AAC7B,0DAA2F;AAC3F,0DAA2D;AAC3D,yCAAuC;AAEvC,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,GAAG,GAAG,0DAA0D,CAAC;AAEvE,oGAAoG;AACpG,gGAAgG;AAChG,wGAAwG;AACxG,iGAAiG;AACjG,MAAM,eAAe,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;AAErD,6FAA6F;AAGtF,IAAM,QAAQ,GAAd,MAAM,QAAQ;IACjB,KAAK,CAAC,QAAQ;QACV,MAAM,QAAQ,GAAG,IAAA,wBAAQ,EAAC,+BAA+B,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;QACxF,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,gCAAiB,CAAC,CAAC;QAEvD,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QAED,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,yCAAyC,CAAC,CAAC;QAChE,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,aAAa,OAAO,IAAI,CAAC,CAAC;QAC/C,OAAO,CAAC,M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;YAC3F,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAC3C,MAAM,IAAI,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;gBAAE,SAAS;YAClC,IAAI,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ;gBAAE,SAAS;YAC5C,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,KAAK,IAAI,CAAC,CAAC;YACpD,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACtD,KAAK,IAAI,CAAC,CAAC;QACf,CAAC;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AAzEY,4BAAQ;mBAAR,QAAQ;IAFpB,IAAA,+BAAgB,GAAE;IAClB,IAAA,sBAAU,GAAE;GACA,QAAQ,CAyEpB","sourcesContent":["import { execSync } from 'child_process';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { WEBPIECES_TMP_DIR, MERGE_INFO_DIR, PR_REVIEW_DIR } from '@webpieces/rules-config';\nimport { provideSingleton } from '@webpieces/core-context';\nimport { injectable } from 'inversify';\n\nconst CUTOFF_DAYS = 30;\nconst SEP = 'โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ\\n';\n\n// Per-feature workflow dirs live under `.webpieces/merge-info/<feature>` and `.webpieces/pr-review/\n// <feature>`; those two homes are permanent (like hooks/ and instruct-ai/) and only their stale\n// subdirs are cleaned. `LEGACY_PREFIXES` sweeps the old flat top-level layout so it self-clears โ which\n// also reaps the retired `pr-info/` home (it matches `pr-` and is no longer the active PR home).\nconst LEGACY_PREFIXES = ['merge-', 'review-', 'pr-'];\n\n/** 30-day cleanup of stale per-feature merge/pr-review dirs (and the legacy flat layout). */\n@provideSingleton()\n@injectable()\nexport class CleanTmp {\n async cleanTmp(): Promise<void> {\n const repoRoot = execSync('git rev-parse --show-toplevel', { encoding: 'utf8' }).trim();\n const tmpBase = path.join(repoRoot, WEBPIECES_TMP_DIR);\n\n if (!fs.existsSync(tmpBase)) {\n return;\n }\n\n process.stdout.write('\\n');\n process.stdout.write(SEP);\n process.stdout.write('๐งน Cleaning Old Temporary Directories\\n');\n process.stdout.write(SEP);\n process.stdout.write('\\n');\n process.stdout.write(`Location: ${tmpBase}\\n`);\n process.stdout.write(`Retention: ${CUTOFF_DAYS} days\\n`);\n process.stdout.write('\\n');\n\n const cutoffMs = CUTOFF_DAYS * 24 * 60 * 60 * 1000;\n const now = Date.now();\n let deletedCount = 0;\n\n // Stale per-feature subdirs under each permanent home.\n deletedCount += this.cleanStaleSubdirs(path.join(tmpBase, MERGE_INFO_DIR), MERGE_INFO_DIR, now, cutoffMs);\n deletedCount += this.cleanStaleSubdirs(path.join(tmpBase, PR_REVIEW_DIR), PR_REVIEW_DIR, now, cutoffMs);\n // Legacy flat top-level dirs from before the merge-info/pr-review nesting (also reaps old pr-info/).\n deletedCount += this.cleanLegacyTopLevel(tmpBase, now, cutoffMs);\n\n if (deletedCount === 0) {\n process.stdout.write(` โ
No directories older than ${CUTOFF_DAYS} days found\\n`);\n } else {\n process.stdout.write('\\n');\n process.stdout.write(` โ
Deleted ${deletedCount} old director${deletedCount === 1 ? 'y' : 'ies'}\\n`);\n }\n\n process.stdout.write('\\n');\n process.stdout.write(SEP);\n process.stdout.write('\\n');\n }\n\n // Delete immediate subdirs of `parentDir` whose mtime is older than the cutoff. No-op if absent.\n private cleanStaleSubdirs(parentDir: string, label: string, now: number, cutoffMs: number): number {\n if (!fs.existsSync(parentDir)) return 0;\n let count = 0;\n for (const entry of fs.readdirSync(parentDir)) {\n const fullPath = path.join(parentDir, entry);\n const stat = fs.statSync(fullPath);\n if (!stat.isDirectory()) continue;\n if (now - stat.mtimeMs < cutoffMs) continue;\n process.stdout.write(` ๐๏ธ Deleting: ${label}/${entry}\\n`);\n fs.rmSync(fullPath, { recursive: true, force: true });\n count += 1;\n }\n return count;\n }\n\n // Sweep the pre-nesting flat layout (`merge-<feature>` etc.), skipping the current homes so this\n // never deletes merge-info/ or pr-review/ themselves. Retired `pr-info/` IS swept (matches `pr-`).\n private cleanLegacyTopLevel(tmpBase: string, now: number, cutoffMs: number): number {\n let count = 0;\n for (const entry of fs.readdirSync(tmpBase)) {\n if (entry === MERGE_INFO_DIR || entry === PR_REVIEW_DIR) continue;\n if (!LEGACY_PREFIXES.some((prefix: string): boolean => entry.startsWith(prefix))) continue;\n const fullPath = path.join(tmpBase, entry);\n const stat = fs.statSync(fullPath);\n if (!stat.isDirectory()) continue;\n if (now - stat.mtimeMs < cutoffMs) continue;\n process.stdout.write(` ๐๏ธ Deleting: ${entry}\\n`);\n fs.rmSync(fullPath, { recursive: true, force: true });\n count += 1;\n }\n return count;\n }\n}\n"]}
|
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { RepoRootFinder } from '@webpieces/rules-config';
|
|
2
|
+
/** Shared git precondition checks + push logic for the PR/merge workflow. */
|
|
3
|
+
export declare class GitExec {
|
|
4
|
+
private readonly repoRootFinder;
|
|
5
|
+
constructor(repoRootFinder: RepoRootFinder);
|
|
6
|
+
uncommittedFiles(cwd: string): string;
|
|
7
|
+
untrackedFiles(cwd: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Precondition for every PR/merge entry point: the working tree must be fully committed. The
|
|
10
|
+
* webpieces tooling deliberately does NOT `git add`/`commit` the developer's work for them. Aborts
|
|
11
|
+
* with instructions if anything is uncommitted (tracked or untracked, excluding gitignored).
|
|
12
|
+
*/
|
|
13
|
+
assertCleanTree(cwd: string): void;
|
|
14
|
+
/**
|
|
15
|
+
* Narrower guard for the merge-resolve commit point, where tracked resolutions are legitimately in
|
|
16
|
+
* the tree but untracked files must NOT be swept into the squash commit. Lists any untracked files
|
|
17
|
+
* and aborts so the AI commits or deletes them explicitly.
|
|
18
|
+
*/
|
|
19
|
+
assertNoUntracked(cwd: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Run a git command that is expected to succeed; abort the process with a clear message if it
|
|
22
|
+
* fails. Used for fetch/pull/checkout/commit where silently continuing on failure would operate on
|
|
23
|
+
* stale or wrong state.
|
|
24
|
+
*/
|
|
25
|
+
runGitChecked(args: string[], errMsg: string): void;
|
|
26
|
+
/**
|
|
27
|
+
* Push HEAD to origin/<currentBranch>. Uses --force-with-lease for an existing remote branch (the
|
|
28
|
+
* 3-point squash rewrites history) and -u for a brand-new branch.
|
|
29
|
+
*/
|
|
30
|
+
ensurePushed(currentBranch: string): void;
|
|
31
|
+
private gitQuery;
|
|
32
|
+
}
|