@gate-forge/cli 0.7.1 → 0.9.0
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/README.md +91 -704
- package/dist/adapter-audit.d.ts +208 -0
- package/dist/adapter-audit.d.ts.map +1 -0
- package/dist/adapter-audit.js +579 -0
- package/dist/adapter-audit.js.map +1 -0
- package/dist/adapter-scaffold.d.ts +91 -0
- package/dist/adapter-scaffold.d.ts.map +1 -0
- package/dist/adapter-scaffold.js +474 -0
- package/dist/adapter-scaffold.js.map +1 -0
- package/dist/adopted-baseline.d.ts +10 -0
- package/dist/adopted-baseline.d.ts.map +1 -1
- package/dist/adopted-baseline.js +18 -1
- package/dist/adopted-baseline.js.map +1 -1
- package/dist/args.d.ts +15 -0
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +61 -2
- package/dist/args.js.map +1 -1
- package/dist/behavior-setup.d.ts +239 -0
- package/dist/behavior-setup.d.ts.map +1 -0
- package/dist/behavior-setup.js +751 -0
- package/dist/behavior-setup.js.map +1 -0
- package/dist/broker.d.ts.map +1 -1
- package/dist/broker.js +28 -2
- package/dist/broker.js.map +1 -1
- package/dist/cache-exclusions.d.ts +45 -0
- package/dist/cache-exclusions.d.ts.map +1 -0
- package/dist/cache-exclusions.js +205 -0
- package/dist/cache-exclusions.js.map +1 -0
- package/dist/candidate-tree.d.ts +86 -14
- package/dist/candidate-tree.d.ts.map +1 -1
- package/dist/candidate-tree.js +236 -62
- package/dist/candidate-tree.js.map +1 -1
- package/dist/ci-witnessed-template.d.ts +43 -0
- package/dist/ci-witnessed-template.d.ts.map +1 -0
- package/dist/ci-witnessed-template.js +283 -0
- package/dist/ci-witnessed-template.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +31 -4
- package/dist/cli.js.map +1 -1
- package/dist/commands/adapters.d.ts +15 -0
- package/dist/commands/adapters.d.ts.map +1 -0
- package/dist/commands/adapters.js +355 -0
- package/dist/commands/adapters.js.map +1 -0
- package/dist/commands/adopt.d.ts +7 -0
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +44 -2
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/baseline.js +42 -1
- package/dist/commands/baseline.js.map +1 -1
- package/dist/commands/blocking.d.ts +105 -2
- package/dist/commands/blocking.d.ts.map +1 -1
- package/dist/commands/blocking.js +395 -53
- package/dist/commands/blocking.js.map +1 -1
- package/dist/commands/check.d.ts +36 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +1068 -64
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/classify.d.ts +2 -1
- package/dist/commands/classify.d.ts.map +1 -1
- package/dist/commands/classify.js +188 -5
- package/dist/commands/classify.js.map +1 -1
- package/dist/commands/enforce.d.ts +4 -4
- package/dist/commands/enforce.d.ts.map +1 -1
- package/dist/commands/enforce.js +41 -9
- package/dist/commands/enforce.js.map +1 -1
- package/dist/commands/enforcement.d.ts +13 -1
- package/dist/commands/enforcement.d.ts.map +1 -1
- package/dist/commands/enforcement.js +880 -33
- package/dist/commands/enforcement.js.map +1 -1
- package/dist/commands/explain.d.ts +1 -1
- package/dist/commands/explain.d.ts.map +1 -1
- package/dist/commands/explain.js +162 -3
- package/dist/commands/explain.js.map +1 -1
- package/dist/commands/history.d.ts +12 -0
- package/dist/commands/history.d.ts.map +1 -0
- package/dist/commands/history.js +45 -0
- package/dist/commands/history.js.map +1 -0
- package/dist/commands/init-presets.d.ts +155 -0
- package/dist/commands/init-presets.d.ts.map +1 -0
- package/dist/commands/init-presets.js +203 -0
- package/dist/commands/init-presets.js.map +1 -0
- package/dist/commands/init.d.ts +7 -12
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +987 -99
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/keys.d.ts.map +1 -1
- package/dist/commands/keys.js +29 -13
- package/dist/commands/keys.js.map +1 -1
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +846 -19
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/pre-commit.d.ts +25 -0
- package/dist/commands/pre-commit.d.ts.map +1 -1
- package/dist/commands/pre-commit.js +91 -6
- package/dist/commands/pre-commit.js.map +1 -1
- package/dist/commands/quarantine.d.ts +16 -0
- package/dist/commands/quarantine.d.ts.map +1 -0
- package/dist/commands/quarantine.js +213 -0
- package/dist/commands/quarantine.js.map +1 -0
- package/dist/commands/run.d.ts +39 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +196 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/test-gates.d.ts +284 -2
- package/dist/commands/test-gates.d.ts.map +1 -1
- package/dist/commands/test-gates.js +3620 -187
- package/dist/commands/test-gates.js.map +1 -1
- package/dist/commands/tests.d.ts +1 -1
- package/dist/commands/tests.d.ts.map +1 -1
- package/dist/commands/tests.js +264 -29
- package/dist/commands/tests.js.map +1 -1
- package/dist/docs-exclusions.d.ts.map +1 -1
- package/dist/docs-exclusions.js +18 -3
- package/dist/docs-exclusions.js.map +1 -1
- package/dist/endpoint-compiler.d.ts.map +1 -1
- package/dist/endpoint-compiler.js +78 -9
- package/dist/endpoint-compiler.js.map +1 -1
- package/dist/engine-browser.d.ts +183 -0
- package/dist/engine-browser.d.ts.map +1 -0
- package/dist/engine-browser.js +381 -0
- package/dist/engine-browser.js.map +1 -0
- package/dist/engine-identity.d.ts +100 -0
- package/dist/engine-identity.d.ts.map +1 -0
- package/dist/engine-identity.js +182 -0
- package/dist/engine-identity.js.map +1 -0
- package/dist/evaluate.d.ts +105 -1
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +149 -18
- package/dist/evaluate.js.map +1 -1
- package/dist/execution.d.ts +253 -9
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +309 -12
- package/dist/execution.js.map +1 -1
- package/dist/gateforge-owned.d.ts +78 -0
- package/dist/gateforge-owned.d.ts.map +1 -0
- package/dist/gateforge-owned.js +254 -0
- package/dist/gateforge-owned.js.map +1 -0
- package/dist/git-hooks.d.ts +35 -0
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +140 -1
- package/dist/git-hooks.js.map +1 -1
- package/dist/git-ignored.d.ts +27 -0
- package/dist/git-ignored.d.ts.map +1 -0
- package/dist/git-ignored.js +102 -0
- package/dist/git-ignored.js.map +1 -0
- package/dist/git-objects.d.ts +60 -0
- package/dist/git-objects.d.ts.map +1 -0
- package/dist/git-objects.js +152 -0
- package/dist/git-objects.js.map +1 -0
- package/dist/glob.d.ts +33 -14
- package/dist/glob.d.ts.map +1 -1
- package/dist/glob.js +96 -5
- package/dist/glob.js.map +1 -1
- package/dist/history.d.ts +52 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +116 -0
- package/dist/history.js.map +1 -0
- package/dist/host-load.d.ts +49 -0
- package/dist/host-load.d.ts.map +1 -0
- package/dist/host-load.js +78 -0
- package/dist/host-load.js.map +1 -0
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/input-snapshot.d.ts +63 -9
- package/dist/input-snapshot.d.ts.map +1 -1
- package/dist/input-snapshot.js +195 -17
- package/dist/input-snapshot.js.map +1 -1
- package/dist/io.d.ts +49 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +22 -0
- package/dist/io.js.map +1 -1
- package/dist/mapping.d.ts +84 -1
- package/dist/mapping.d.ts.map +1 -1
- package/dist/mapping.js +276 -5
- package/dist/mapping.js.map +1 -1
- package/dist/native-freeze.d.ts +217 -0
- package/dist/native-freeze.d.ts.map +1 -0
- package/dist/native-freeze.js +332 -0
- package/dist/native-freeze.js.map +1 -0
- package/dist/pipeline.d.ts +67 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +164 -6
- package/dist/pipeline.js.map +1 -1
- package/dist/planes-inference.d.ts +12 -5
- package/dist/planes-inference.d.ts.map +1 -1
- package/dist/planes-inference.js +13 -15
- package/dist/planes-inference.js.map +1 -1
- package/dist/playwright-browsers.d.ts +210 -0
- package/dist/playwright-browsers.d.ts.map +1 -0
- package/dist/playwright-browsers.js +364 -0
- package/dist/playwright-browsers.js.map +1 -0
- package/dist/plugins.d.ts +15 -5
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +59 -9
- package/dist/plugins.js.map +1 -1
- package/dist/progress.d.ts +148 -0
- package/dist/progress.d.ts.map +1 -0
- package/dist/progress.js +263 -0
- package/dist/progress.js.map +1 -0
- package/dist/providers.d.ts +26 -1
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +39 -0
- package/dist/providers.js.map +1 -1
- package/dist/receipts.d.ts +1 -0
- package/dist/receipts.d.ts.map +1 -1
- package/dist/receipts.js +35 -7
- package/dist/receipts.js.map +1 -1
- package/dist/repo-scan.d.ts +15 -1
- package/dist/repo-scan.d.ts.map +1 -1
- package/dist/repo-scan.js +329 -34
- package/dist/repo-scan.js.map +1 -1
- package/dist/reseal-chain.d.ts +184 -0
- package/dist/reseal-chain.d.ts.map +1 -0
- package/dist/reseal-chain.js +735 -0
- package/dist/reseal-chain.js.map +1 -0
- package/dist/reseal-evidence.d.ts +241 -0
- package/dist/reseal-evidence.d.ts.map +1 -0
- package/dist/reseal-evidence.js +319 -0
- package/dist/reseal-evidence.js.map +1 -0
- package/dist/reseal.d.ts +181 -0
- package/dist/reseal.d.ts.map +1 -0
- package/dist/reseal.js +1620 -0
- package/dist/reseal.js.map +1 -0
- package/dist/response-field-guidance.d.ts +82 -0
- package/dist/response-field-guidance.d.ts.map +1 -0
- package/dist/response-field-guidance.js +184 -0
- package/dist/response-field-guidance.js.map +1 -0
- package/dist/route-plane-proposals.d.ts +100 -0
- package/dist/route-plane-proposals.d.ts.map +1 -0
- package/dist/route-plane-proposals.js +213 -0
- package/dist/route-plane-proposals.js.map +1 -0
- package/dist/run-cache.d.ts +260 -0
- package/dist/run-cache.d.ts.map +1 -0
- package/dist/run-cache.js +771 -0
- package/dist/run-cache.js.map +1 -0
- package/dist/run-preflight.d.ts +77 -0
- package/dist/run-preflight.d.ts.map +1 -0
- package/dist/run-preflight.js +774 -0
- package/dist/run-preflight.js.map +1 -0
- package/dist/run-recipe.d.ts +107 -0
- package/dist/run-recipe.d.ts.map +1 -0
- package/dist/run-recipe.js +295 -0
- package/dist/run-recipe.js.map +1 -0
- package/dist/run-reliability.d.ts +126 -0
- package/dist/run-reliability.d.ts.map +1 -0
- package/dist/run-reliability.js +221 -0
- package/dist/run-reliability.js.map +1 -0
- package/dist/runtime.d.ts +15 -0
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +11 -1
- package/dist/runtime.js.map +1 -1
- package/dist/scope.d.ts +20 -0
- package/dist/scope.d.ts.map +1 -1
- package/dist/scope.js +26 -5
- package/dist/scope.js.map +1 -1
- package/dist/secret-guard.d.ts +36 -0
- package/dist/secret-guard.d.ts.map +1 -0
- package/dist/secret-guard.js +63 -0
- package/dist/secret-guard.js.map +1 -0
- package/dist/singleton-guidance.d.ts +82 -0
- package/dist/singleton-guidance.d.ts.map +1 -0
- package/dist/singleton-guidance.js +138 -0
- package/dist/singleton-guidance.js.map +1 -0
- package/dist/staged-candidate.d.ts +17 -0
- package/dist/staged-candidate.d.ts.map +1 -1
- package/dist/staged-candidate.js +50 -0
- package/dist/staged-candidate.js.map +1 -1
- package/dist/state-artifacts.d.ts +70 -0
- package/dist/state-artifacts.d.ts.map +1 -0
- package/dist/state-artifacts.js +215 -0
- package/dist/state-artifacts.js.map +1 -0
- package/dist/state.d.ts +170 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +248 -8
- package/dist/state.js.map +1 -1
- package/dist/unmatched-routes.d.ts +60 -0
- package/dist/unmatched-routes.d.ts.map +1 -0
- package/dist/unmatched-routes.js +131 -0
- package/dist/unmatched-routes.js.map +1 -0
- package/dist/verifier-keys.d.ts +33 -2
- package/dist/verifier-keys.d.ts.map +1 -1
- package/dist/verifier-keys.js +95 -9
- package/dist/verifier-keys.js.map +1 -1
- package/guides/CONNECT-YOUR-PROJECT.md +425 -0
- package/guides/QUICKSTART.md +306 -26
- package/guides/REFERENCE.md +1710 -0
- package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
- package/guides/TEST-ENVIRONMENT.md +1044 -6
- package/guides/UPGRADE-0.6-to-0.7.md +3 -3
- package/guides/UPGRADE-0.7-to-0.8.md +114 -0
- package/guides/UPGRADE-0.8-to-0.9.md +104 -0
- package/package.json +10 -9
|
@@ -8,9 +8,11 @@
|
|
|
8
8
|
* Engine resolution order: developer override, repository-pinned CLI,
|
|
9
9
|
* recorded engine checkout, explicit engine path, then PATH fallback.
|
|
10
10
|
*/
|
|
11
|
+
import { spawnSync } from 'node:child_process';
|
|
11
12
|
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
13
|
+
import { UsageError } from '../errors.js';
|
|
12
14
|
import { join } from 'node:path';
|
|
13
|
-
import { writeLine } from '../io.js';
|
|
15
|
+
import { recordInitPath, writeLine } from '../io.js';
|
|
14
16
|
import { VERSION } from './common.js';
|
|
15
17
|
/** Marker boundaries for the Gateforge-owned generated wrapper script. */
|
|
16
18
|
export const GENERATED_HOOK_MARKER_BEGIN = '// >>> gateforge generated hook v1 >>>';
|
|
@@ -112,15 +114,93 @@ const PRE_COMMIT_BLOCK = `# --- gateforge (generated): blocking static gate ----
|
|
|
112
114
|
language: system
|
|
113
115
|
pass_filenames: false
|
|
114
116
|
`;
|
|
117
|
+
/**
|
|
118
|
+
* The install block every generated Gateforge CI job runs first: it
|
|
119
|
+
* installs the declared Node packages from their lockfiles, resolves
|
|
120
|
+
* the pinned Gateforge, and refuses to continue on any other version.
|
|
121
|
+
* Unindented, so each job indents it into its own YAML block scalar.
|
|
122
|
+
*/
|
|
123
|
+
export const CI_INSTALL_SCRIPT = [
|
|
124
|
+
'set -eu',
|
|
125
|
+
'set -f',
|
|
126
|
+
'install_node_package() {',
|
|
127
|
+
' package_dir="$1"',
|
|
128
|
+
' if [ ! -f "$package_dir/package.json" ]; then',
|
|
129
|
+
' echo "Gateforge CI: package.json not found in $package_dir" >&2',
|
|
130
|
+
' return 1',
|
|
131
|
+
' fi',
|
|
132
|
+
' if [ -f "$package_dir/pnpm-lock.yaml" ]; then',
|
|
133
|
+
' corepack pnpm --dir "$package_dir" install --frozen-lockfile',
|
|
134
|
+
' elif [ -f "$package_dir/yarn.lock" ]; then',
|
|
135
|
+
' corepack yarn --cwd "$package_dir" install --frozen-lockfile',
|
|
136
|
+
' elif [ -f "$package_dir/package-lock.json" ] || [ -f "$package_dir/npm-shrinkwrap.json" ]; then',
|
|
137
|
+
' npm ci --prefix "$package_dir"',
|
|
138
|
+
' else',
|
|
139
|
+
' npm install --prefix "$package_dir"',
|
|
140
|
+
' fi',
|
|
141
|
+
'}',
|
|
142
|
+
'install_node_package .',
|
|
143
|
+
'for package_dir in $GATEFORGE_CI_NESTED_PACKAGE_DIRS; do',
|
|
144
|
+
' case "$package_dir" in',
|
|
145
|
+
' /*|..|../*|*/..|*/../*) echo "Gateforge CI: nested package path must stay inside the repository: $package_dir" >&2; exit 1 ;;',
|
|
146
|
+
' esac',
|
|
147
|
+
' install_node_package "$package_dir"',
|
|
148
|
+
'done',
|
|
149
|
+
'run_gateforge() {',
|
|
150
|
+
' if [ -f pnpm-lock.yaml ]; then',
|
|
151
|
+
' corepack pnpm exec gateforge "$@"',
|
|
152
|
+
' elif [ -f yarn.lock ]; then',
|
|
153
|
+
' corepack yarn run gateforge "$@"',
|
|
154
|
+
' else',
|
|
155
|
+
' if [ ! -x node_modules/.bin/gateforge ]; then',
|
|
156
|
+
' echo "Gateforge CI: install @gate-forge/cli as an exact root devDependency" >&2',
|
|
157
|
+
' return 1',
|
|
158
|
+
' fi',
|
|
159
|
+
' node_modules/.bin/gateforge "$@"',
|
|
160
|
+
' fi',
|
|
161
|
+
'}',
|
|
162
|
+
'actual_version=$(run_gateforge --version)',
|
|
163
|
+
'if [ "$actual_version" != "$GATEFORGE_VERSION" ]; then',
|
|
164
|
+
' echo "Gateforge CI: expected $GATEFORGE_VERSION but installed $actual_version" >&2',
|
|
165
|
+
' exit 1',
|
|
166
|
+
'fi',
|
|
167
|
+
'echo "Gateforge CI: using pinned Gateforge $actual_version"',
|
|
168
|
+
];
|
|
169
|
+
/** Indents a script block into a YAML block scalar body (6 spaces). */
|
|
170
|
+
export function ciScriptBlock(lines) {
|
|
171
|
+
return lines.map((line) => (line.length === 0 ? '' : ` ${line}`)).join('\n');
|
|
172
|
+
}
|
|
115
173
|
/** Renders one CI template with the gate command chosen by the wiring command. */
|
|
116
174
|
export function renderGitlabCiTemplate(mode = 'check') {
|
|
117
175
|
const jobName = mode === 'strict' ? 'gateforge:e2e-gate' : 'gateforge:check';
|
|
118
176
|
const gateSteps = mode === 'strict'
|
|
119
177
|
? [
|
|
120
|
-
' -
|
|
121
|
-
'
|
|
178
|
+
' - |',
|
|
179
|
+
' if [ "$CI_PIPELINE_SOURCE" = "merge_request_event" ]; then',
|
|
180
|
+
' base_pipelines=$(curl --silent --show-error --fail --header "JOB-TOKEN: $CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines?sha=$CI_MERGE_REQUEST_DIFF_BASE_SHA&status=success&per_page=100" 2>/dev/null || true)',
|
|
181
|
+
` base_pipeline_id=$(printf '%s' "$base_pipelines" | node -e 'let data="";process.stdin.on("data",chunk=>data+=chunk).on("end",()=>{try{const rows=JSON.parse(data);const row=rows.find(item=>item.sha===process.env.CI_MERGE_REQUEST_DIFF_BASE_SHA&&item.source==="push"&&item.ref===process.env.CI_DEFAULT_BRANCH);process.stdout.write(row?String(row.id):"")}catch{}})')`,
|
|
182
|
+
' if [ -n "$base_pipeline_id" ]; then',
|
|
183
|
+
' base_jobs=$(curl --silent --show-error --fail --header "JOB-TOKEN: $CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/pipelines/$base_pipeline_id/jobs?per_page=100" 2>/dev/null || true)',
|
|
184
|
+
` base_job_id=$(printf '%s' "$base_jobs" | node -e 'let data="";process.stdin.on("data",chunk=>data+=chunk).on("end",()=>{try{const rows=JSON.parse(data);const row=rows.find(item=>item.name==="gateforge:e2e-gate"&&item.status==="success");process.stdout.write(row?String(row.id):"")}catch{}})')`,
|
|
185
|
+
' if [ -n "$base_job_id" ]; then',
|
|
186
|
+
' mkdir -p .gateforge/test-gates',
|
|
187
|
+
' if curl --silent --show-error --fail --location --header "JOB-TOKEN: $CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/$base_job_id/artifacts/.gateforge/test-gates/receipt.json" --output .gateforge/test-gates/receipt.json && curl --silent --show-error --fail --location --header "JOB-TOKEN: $CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/jobs/$base_job_id/artifacts/.gateforge/test-gates/execution-result.json" --output .gateforge/test-gates/execution-result.json; then',
|
|
188
|
+
' echo "Gateforge CI: downloaded exact merge-base receipt artifact"',
|
|
189
|
+
' else',
|
|
190
|
+
' echo "Gateforge CI: merge-base receipt artifact unavailable; carry-forward disabled"',
|
|
191
|
+
' fi',
|
|
192
|
+
' fi',
|
|
193
|
+
' fi',
|
|
194
|
+
' fi',
|
|
195
|
+
' - |',
|
|
196
|
+
' if [ "$CI_PIPELINE_SOURCE" = "merge_request_event" ]; then',
|
|
197
|
+
' run_gateforge test-gates --changed --scope changed',
|
|
198
|
+
' else',
|
|
199
|
+
' run_gateforge test-gates --changed',
|
|
200
|
+
' fi',
|
|
201
|
+
' - run_gateforge check --changed --candidate-commit "$CI_COMMIT_SHA" --require-e2e',
|
|
122
202
|
].join('\n')
|
|
123
|
-
: ' - run_gateforge check --changed';
|
|
203
|
+
: ' - run_gateforge check --changed --candidate-commit "$CI_COMMIT_SHA"';
|
|
124
204
|
const artifacts = mode === 'strict'
|
|
125
205
|
? [
|
|
126
206
|
' artifacts:',
|
|
@@ -128,7 +208,8 @@ export function renderGitlabCiTemplate(mode = 'check') {
|
|
|
128
208
|
' paths:',
|
|
129
209
|
' - .gateforge/test-gates/report.json',
|
|
130
210
|
' - .gateforge/test-gates/receipt.json',
|
|
131
|
-
'
|
|
211
|
+
' - .gateforge/test-gates/execution-result.json',
|
|
212
|
+
' expire_in: 90 days',
|
|
132
213
|
].join('\n')
|
|
133
214
|
: '';
|
|
134
215
|
return `# Generated by Gateforge ${VERSION}. Add @gate-forge/cli at exactly ${VERSION} to the root package.
|
|
@@ -149,56 +230,182 @@ ${jobName}:
|
|
|
149
230
|
GATEFORGE_CI_NESTED_PACKAGE_DIRS: ""
|
|
150
231
|
script:
|
|
151
232
|
- |
|
|
152
|
-
|
|
153
|
-
set -f
|
|
154
|
-
install_node_package() {
|
|
155
|
-
package_dir="$1"
|
|
156
|
-
if [ ! -f "$package_dir/package.json" ]; then
|
|
157
|
-
echo "Gateforge CI: package.json not found in $package_dir" >&2
|
|
158
|
-
return 1
|
|
159
|
-
fi
|
|
160
|
-
if [ -f "$package_dir/pnpm-lock.yaml" ]; then
|
|
161
|
-
corepack pnpm --dir "$package_dir" install --frozen-lockfile
|
|
162
|
-
elif [ -f "$package_dir/yarn.lock" ]; then
|
|
163
|
-
corepack yarn --cwd "$package_dir" install --frozen-lockfile
|
|
164
|
-
elif [ -f "$package_dir/package-lock.json" ] || [ -f "$package_dir/npm-shrinkwrap.json" ]; then
|
|
165
|
-
npm ci --prefix "$package_dir"
|
|
166
|
-
else
|
|
167
|
-
npm install --prefix "$package_dir"
|
|
168
|
-
fi
|
|
169
|
-
}
|
|
170
|
-
install_node_package .
|
|
171
|
-
for package_dir in $GATEFORGE_CI_NESTED_PACKAGE_DIRS; do
|
|
172
|
-
case "$package_dir" in
|
|
173
|
-
/*|..|../*|*/..|*/../*) echo "Gateforge CI: nested package path must stay inside the repository: $package_dir" >&2; exit 1 ;;
|
|
174
|
-
esac
|
|
175
|
-
install_node_package "$package_dir"
|
|
176
|
-
done
|
|
177
|
-
run_gateforge() {
|
|
178
|
-
if [ -f pnpm-lock.yaml ]; then
|
|
179
|
-
corepack pnpm exec gateforge "$@"
|
|
180
|
-
elif [ -f yarn.lock ]; then
|
|
181
|
-
corepack yarn run gateforge "$@"
|
|
182
|
-
else
|
|
183
|
-
if [ ! -x node_modules/.bin/gateforge ]; then
|
|
184
|
-
echo "Gateforge CI: install @gate-forge/cli as an exact root devDependency" >&2
|
|
185
|
-
return 1
|
|
186
|
-
fi
|
|
187
|
-
node_modules/.bin/gateforge "$@"
|
|
188
|
-
fi
|
|
189
|
-
}
|
|
190
|
-
actual_version=$(run_gateforge --version)
|
|
191
|
-
if [ "$actual_version" != "$GATEFORGE_VERSION" ]; then
|
|
192
|
-
echo "Gateforge CI: expected $GATEFORGE_VERSION but installed $actual_version" >&2
|
|
193
|
-
exit 1
|
|
194
|
-
fi
|
|
195
|
-
echo "Gateforge CI: using pinned Gateforge $actual_version"
|
|
233
|
+
${ciScriptBlock(CI_INSTALL_SCRIPT)}
|
|
196
234
|
${gateSteps}
|
|
197
235
|
rules:
|
|
198
236
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
237
|
+
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
199
238
|
${artifacts}
|
|
200
239
|
`;
|
|
201
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Renders the install step of the generated GitHub Actions workflow.
|
|
243
|
+
*
|
|
244
|
+
* With no engine source declared (the default) this is exactly the
|
|
245
|
+
* historical registry install, byte for byte. With a source declared
|
|
246
|
+
* it is the same install of THAT source — a tarball or directory of an
|
|
247
|
+
* engine that is not (or not yet) on the registry — and the value is
|
|
248
|
+
* passed through the step environment, never interpolated into the
|
|
249
|
+
* command line, so it cannot become a shell fragment.
|
|
250
|
+
*
|
|
251
|
+
* Args:
|
|
252
|
+
* engineSource: the declared `@gate-forge/cli` source (npm
|
|
253
|
+
* tarball path, directory, or any npm specifier), or null.
|
|
254
|
+
*
|
|
255
|
+
* Returns:
|
|
256
|
+
* string: the workflow's install step source.
|
|
257
|
+
*/
|
|
258
|
+
function githubInstallStep(engineSource) {
|
|
259
|
+
if (engineSource === null) {
|
|
260
|
+
return ` - name: Install Gateforge
|
|
261
|
+
run: npm install --no-save --package-lock=false @gate-forge/cli@${VERSION}
|
|
262
|
+
`;
|
|
263
|
+
}
|
|
264
|
+
return ` - name: Install Gateforge
|
|
265
|
+
env:
|
|
266
|
+
GATEFORGE_CI_ENGINE_SOURCE: ${JSON.stringify(engineSource)}
|
|
267
|
+
run: npm install --no-save --package-lock=false "$GATEFORGE_CI_ENGINE_SOURCE"
|
|
268
|
+
`;
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* Renders the strict GitHub Actions workflow and keeps secrets in the
|
|
272
|
+
* protected workflow environment.
|
|
273
|
+
*
|
|
274
|
+
* `engineSource` selects where CI installs the engine from: null (the
|
|
275
|
+
* default) renders today's registry-only workflow unchanged, while a
|
|
276
|
+
* tarball/directory source renders the same workflow installing that
|
|
277
|
+
* source. The variable is read from the owner's environment when
|
|
278
|
+
* `gateforge init --blocking`/`enforce` runs — see
|
|
279
|
+
* {@link engineSourceFromEnv}.
|
|
280
|
+
*
|
|
281
|
+
* Args:
|
|
282
|
+
* engineSource: the declared engine source, or null for the registry.
|
|
283
|
+
*
|
|
284
|
+
* Returns:
|
|
285
|
+
* string: workflow source.
|
|
286
|
+
*/
|
|
287
|
+
export function renderGithubActionsTemplate(engineSource = null) {
|
|
288
|
+
const installStep = githubInstallStep(engineSource);
|
|
289
|
+
const sourceNote = engineSource === null
|
|
290
|
+
? ''
|
|
291
|
+
: `#
|
|
292
|
+
# Engine source: GATEFORGE_CI_ENGINE_SOURCE was set when this file was
|
|
293
|
+
# generated, so CI installs "${engineSource}" instead of the registry
|
|
294
|
+
# release. Unset it and re-run the generator for a registry install.`;
|
|
295
|
+
return `# Generated by Gateforge ${VERSION}; review before enabling required checks.${sourceNote}
|
|
296
|
+
name: Gateforge
|
|
297
|
+
on:
|
|
298
|
+
pull_request:
|
|
299
|
+
push:
|
|
300
|
+
workflow_dispatch:
|
|
301
|
+
permissions:
|
|
302
|
+
contents: read
|
|
303
|
+
actions: read
|
|
304
|
+
jobs:
|
|
305
|
+
gateforge:
|
|
306
|
+
runs-on: ubuntu-latest
|
|
307
|
+
steps:
|
|
308
|
+
- uses: actions/checkout@v4
|
|
309
|
+
with:
|
|
310
|
+
fetch-depth: 0
|
|
311
|
+
- uses: actions/setup-node@v4
|
|
312
|
+
with:
|
|
313
|
+
node-version: 22
|
|
314
|
+
${installStep} - name: Locate exact merge-base receipt
|
|
315
|
+
if: github.event_name == 'pull_request'
|
|
316
|
+
id: base
|
|
317
|
+
env:
|
|
318
|
+
GH_TOKEN: \${{ github.token }}
|
|
319
|
+
run: |
|
|
320
|
+
base_sha=$(git merge-base "$GITHUB_SHA" "origin/$GITHUB_BASE_REF")
|
|
321
|
+
run_id=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/gateforge.yml/runs?head_sha=$base_sha&status=success&per_page=100" --jq '[.workflow_runs[] | select(.event == "push")][0].id // empty')
|
|
322
|
+
printf 'run_id=%s\\n' "$run_id" >> "$GITHUB_OUTPUT"
|
|
323
|
+
- uses: actions/download-artifact@v4
|
|
324
|
+
continue-on-error: true
|
|
325
|
+
with:
|
|
326
|
+
name: gateforge-test-gates
|
|
327
|
+
run-id: \${{ steps.base.outputs.run_id }}
|
|
328
|
+
github-token: \${{ github.token }}
|
|
329
|
+
repository: \${{ github.repository }}
|
|
330
|
+
path: .gateforge/test-gates
|
|
331
|
+
- name: Verify witnessed receipt
|
|
332
|
+
env:
|
|
333
|
+
GATEFORGE_WITNESS_VERIFIER_KEY: \${{ secrets.GATEFORGE_WITNESS_VERIFIER_KEY }}
|
|
334
|
+
GATEFORGE_APPROVED_POLICY_DIGEST: \${{ secrets.GATEFORGE_APPROVED_POLICY_DIGEST }}
|
|
335
|
+
run: |
|
|
336
|
+
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then
|
|
337
|
+
./node_modules/.bin/gateforge test-gates --changed --scope changed
|
|
338
|
+
else
|
|
339
|
+
./node_modules/.bin/gateforge test-gates --changed
|
|
340
|
+
fi
|
|
341
|
+
./node_modules/.bin/gateforge check --changed --candidate-commit "$GITHUB_SHA" --require-e2e
|
|
342
|
+
- uses: actions/upload-artifact@v4
|
|
343
|
+
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch && success()
|
|
344
|
+
with:
|
|
345
|
+
name: gateforge-test-gates
|
|
346
|
+
path: |
|
|
347
|
+
.gateforge/test-gates/receipt.json
|
|
348
|
+
.gateforge/test-gates/execution-result.json
|
|
349
|
+
if-no-files-found: error
|
|
350
|
+
retention-days: 90
|
|
351
|
+
`;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* Reads the declared CI engine source from the owner's environment.
|
|
355
|
+
*
|
|
356
|
+
* `GATEFORGE_CI_ENGINE_SOURCE` lets a release that is not (yet) on the
|
|
357
|
+
* registry wire CI against its own tarball or directory instead. An
|
|
358
|
+
* empty or absent variable is the historical registry install, so the
|
|
359
|
+
* generated workflow is unchanged for every existing repo. A value that
|
|
360
|
+
* npm would read as a flag is refused rather than silently installed.
|
|
361
|
+
*
|
|
362
|
+
* Args:
|
|
363
|
+
* env: the process environment.
|
|
364
|
+
*
|
|
365
|
+
* Returns:
|
|
366
|
+
* string | null: the declared source, or null for the registry.
|
|
367
|
+
*
|
|
368
|
+
* Throws:
|
|
369
|
+
* UsageError: when the declared source is not a single non-empty
|
|
370
|
+
* specifier or would read as an npm flag.
|
|
371
|
+
*/
|
|
372
|
+
export function engineSourceFromEnv(env) {
|
|
373
|
+
const declared = (env['GATEFORGE_CI_ENGINE_SOURCE'] ?? '').trim();
|
|
374
|
+
if (declared === '')
|
|
375
|
+
return null;
|
|
376
|
+
if (declared.startsWith('-') || /[\s"'`$]/.test(declared)) {
|
|
377
|
+
throw new UsageError('GATEFORGE_CI_ENGINE_SOURCE must be one npm specifier for @gate-forge/cli ' +
|
|
378
|
+
'(a tarball path, a directory, or a package@version) — no flags, quotes, or spaces. ' +
|
|
379
|
+
'Unset it to install the published release from the registry.');
|
|
380
|
+
}
|
|
381
|
+
return declared;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Writes the generated GitHub Actions workflow only when absent.
|
|
385
|
+
*
|
|
386
|
+
* Args:
|
|
387
|
+
* io: process context.
|
|
388
|
+
*
|
|
389
|
+
* Returns:
|
|
390
|
+
* void.
|
|
391
|
+
*/
|
|
392
|
+
export function writeGithubActionsTemplate(io) {
|
|
393
|
+
const engineSource = engineSourceFromEnv(io.env);
|
|
394
|
+
const dir = join(io.cwd, '.github', 'workflows');
|
|
395
|
+
mkdirSync(dir, { recursive: true });
|
|
396
|
+
const path = join(dir, 'gateforge.yml');
|
|
397
|
+
if (!existsSync(path)) {
|
|
398
|
+
writeFileSync(path, renderGithubActionsTemplate(engineSource));
|
|
399
|
+
recordInitPath(io, io.cwd, path, 'created');
|
|
400
|
+
writeLine(io.stdout, engineSource === null
|
|
401
|
+
? `created: ${path}`
|
|
402
|
+
: `created: ${path} (engine installed from ${engineSource}, not the registry)`);
|
|
403
|
+
}
|
|
404
|
+
else {
|
|
405
|
+
recordInitPath(io, io.cwd, path, 'preserved');
|
|
406
|
+
writeLine(io.stdout, `exists, leaving untouched: ${path}`);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
202
409
|
/**
|
|
203
410
|
* Records the engine checkout root in `.gateforge/engine` — the ONE
|
|
204
411
|
* machine-specific reference the generated hook reads. Empty/absent when
|
|
@@ -213,9 +420,11 @@ export function writeEngineReference(io, engineRoot) {
|
|
|
213
420
|
}
|
|
214
421
|
if (!existsSync(path)) {
|
|
215
422
|
writeFileSync(path, `${engineRoot}\n`);
|
|
423
|
+
recordInitPath(io, io.cwd, path, 'created');
|
|
216
424
|
writeLine(io.stdout, `created: ${path} (engine checkout root)`);
|
|
217
425
|
}
|
|
218
426
|
else {
|
|
427
|
+
recordInitPath(io, io.cwd, path, 'preserved');
|
|
219
428
|
writeLine(io.stdout, `exists, leaving untouched: ${path}`);
|
|
220
429
|
}
|
|
221
430
|
}
|
|
@@ -236,6 +445,7 @@ export function ensureHookScript(io, engineRoot, gateArgs = ['check', '--changed
|
|
|
236
445
|
if (!existsSync(hookScript)) {
|
|
237
446
|
writeFileSync(hookScript, hookScriptTemplate(gateArgs));
|
|
238
447
|
chmodSync(hookScript, 0o755);
|
|
448
|
+
recordInitPath(io, io.cwd, hookScript, 'created');
|
|
239
449
|
writeLine(io.stdout, `created: ${hookScript}`);
|
|
240
450
|
}
|
|
241
451
|
else {
|
|
@@ -245,32 +455,72 @@ export function ensureHookScript(io, engineRoot, gateArgs = ['check', '--changed
|
|
|
245
455
|
if (updated !== current) {
|
|
246
456
|
writeFileSync(hookScript, updated, 'utf8');
|
|
247
457
|
chmodSync(hookScript, 0o755);
|
|
458
|
+
// The generated block was rewritten in place: the undo is a
|
|
459
|
+
// restore, not a delete (the file may hold the owner's own
|
|
460
|
+
// additions around our markers).
|
|
461
|
+
recordInitPath(io, io.cwd, hookScript, 'modified');
|
|
248
462
|
writeLine(io.stdout, `updated: ${hookScript} (${gateArgs.join(' ')})`);
|
|
249
463
|
}
|
|
250
464
|
else {
|
|
465
|
+
recordInitPath(io, io.cwd, hookScript, 'preserved');
|
|
251
466
|
writeLine(io.stdout, `verified: ${hookScript} (${gateArgs.join(' ')})`);
|
|
252
467
|
}
|
|
253
468
|
}
|
|
254
469
|
else {
|
|
470
|
+
recordInitPath(io, io.cwd, hookScript, 'preserved');
|
|
255
471
|
writeLine(io.stdout, `exists, leaving untouched: ${hookScript} (foreign file)`);
|
|
256
472
|
}
|
|
257
473
|
}
|
|
258
474
|
return hookScript;
|
|
259
475
|
}
|
|
476
|
+
/**
|
|
477
|
+
* Reports whether a repository-relative path is tracked in the index.
|
|
478
|
+
*
|
|
479
|
+
* The undo line has to name a command that really works, and
|
|
480
|
+
* `git restore` only restores a tracked path. An unreadable index, a
|
|
481
|
+
* missing git, or an untracked file all answer `false`: then the undo
|
|
482
|
+
* is "delete the appended entry", never a command that would fail.
|
|
483
|
+
*
|
|
484
|
+
* Args:
|
|
485
|
+
* cwd: absolute repository root.
|
|
486
|
+
* relativePath: repository-relative posix path.
|
|
487
|
+
*
|
|
488
|
+
* Returns:
|
|
489
|
+
* boolean: true when git has the path in its index.
|
|
490
|
+
*/
|
|
491
|
+
function isTracked(cwd, relativePath) {
|
|
492
|
+
return spawnSync('git', ['ls-files', '--error-unmatch', '--', relativePath], {
|
|
493
|
+
cwd,
|
|
494
|
+
stdio: 'ignore',
|
|
495
|
+
}).status === 0;
|
|
496
|
+
}
|
|
260
497
|
/** Appends the gateforge-check hook to .pre-commit-config.yaml (idempotent). */
|
|
261
498
|
export function appendPreCommitHook(io) {
|
|
262
499
|
const path = join(io.cwd, '.pre-commit-config.yaml');
|
|
263
500
|
if (existsSync(path)) {
|
|
264
501
|
const current = readFileSync(path, 'utf8');
|
|
265
502
|
if (current.includes('gateforge-check')) {
|
|
503
|
+
recordInitPath(io, io.cwd, path, 'preserved');
|
|
266
504
|
writeLine(io.stdout, `exists, leaving untouched: ${path} (gateforge-check)`);
|
|
267
505
|
return;
|
|
268
506
|
}
|
|
269
507
|
writeFileSync(path, `${current.endsWith('\n') ? current : current + '\n'}${PRE_COMMIT_BLOCK}`);
|
|
270
|
-
|
|
508
|
+
// The file belongs to the OWNER and this run appended one block to
|
|
509
|
+
// it, so the ledger records it as MODIFIED: `rm -rf` would throw
|
|
510
|
+
// their hooks away, `git restore` puts the file back exactly.
|
|
511
|
+
recordInitPath(io, io.cwd, path, 'modified');
|
|
512
|
+
// One line, one action: the file belongs to the OWNER, so the line
|
|
513
|
+
// says so and carries the exact way back. The command is printed
|
|
514
|
+
// only where it really works — `git restore` needs a tracked file,
|
|
515
|
+
// and an untracked config has nothing to restore.
|
|
516
|
+
const undo = isTracked(io.cwd, '.pre-commit-config.yaml')
|
|
517
|
+
? 'undo: git restore -- .pre-commit-config.yaml'
|
|
518
|
+
: 'undo: delete the appended gateforge-check entry from .pre-commit-config.yaml (the file is not tracked by git, so there is nothing to restore)';
|
|
519
|
+
writeLine(io.stdout, `updated: ${path} (gateforge-check hook appended) — your repo's own hook file: ${undo}`);
|
|
271
520
|
return;
|
|
272
521
|
}
|
|
273
522
|
writeFileSync(path, `repos:\n${PRE_COMMIT_BLOCK}`);
|
|
523
|
+
recordInitPath(io, io.cwd, path, 'created');
|
|
274
524
|
writeLine(io.stdout, `created: ${path} (with gateforge-check hook)`);
|
|
275
525
|
}
|
|
276
526
|
/** Writes the GitLab CI job template + include wiring (idempotent). */
|
|
@@ -280,22 +530,29 @@ export function writeGitlabCiTemplate(io, mode = 'check') {
|
|
|
280
530
|
const path = join(dir, 'gitlab-gateforge.yml');
|
|
281
531
|
if (!existsSync(path)) {
|
|
282
532
|
writeFileSync(path, renderGitlabCiTemplate(mode));
|
|
533
|
+
recordInitPath(io, io.cwd, path, 'created');
|
|
283
534
|
writeLine(io.stdout, `created: ${path}`);
|
|
284
535
|
}
|
|
285
536
|
else {
|
|
537
|
+
recordInitPath(io, io.cwd, path, 'preserved');
|
|
286
538
|
writeLine(io.stdout, `exists, leaving untouched: ${path}`);
|
|
287
539
|
}
|
|
288
540
|
const gitlabCi = join(io.cwd, '.gitlab-ci.yml');
|
|
289
541
|
if (!existsSync(gitlabCi)) {
|
|
290
542
|
writeFileSync(gitlabCi, `include:\n - local: '.gateforge/ci/gitlab-gateforge.yml'\n`);
|
|
543
|
+
recordInitPath(io, io.cwd, gitlabCi, 'created');
|
|
291
544
|
writeLine(io.stdout, `created: ${gitlabCi} (includes the gateforge jobs)`);
|
|
292
545
|
return;
|
|
293
546
|
}
|
|
294
547
|
const current = readFileSync(gitlabCi, 'utf8');
|
|
295
548
|
if (current.includes('gitlab-gateforge.yml')) {
|
|
549
|
+
recordInitPath(io, io.cwd, gitlabCi, 'preserved');
|
|
296
550
|
writeLine(io.stdout, `exists, leaving untouched: ${gitlabCi} (gateforge include present)`);
|
|
297
551
|
return;
|
|
298
552
|
}
|
|
553
|
+
// The owner's CI file stays theirs: this run only ADDED the include,
|
|
554
|
+
// so the ledger records it as modified and the undo is a restore.
|
|
555
|
+
recordInitPath(io, io.cwd, gitlabCi, 'modified');
|
|
299
556
|
const local = " - local: '.gateforge/ci/gitlab-gateforge.yml'";
|
|
300
557
|
if (/^include:/m.test(current)) {
|
|
301
558
|
writeFileSync(gitlabCi, current.replace(/^include:[^\n]*/m, (match) => `${match}\n${local}`));
|
|
@@ -305,11 +562,96 @@ export function writeGitlabCiTemplate(io, mode = 'check') {
|
|
|
305
562
|
writeFileSync(gitlabCi, `${current.endsWith('\n') ? current : `${current}\n`}include:\n${local}\n`);
|
|
306
563
|
writeLine(io.stdout, `updated: ${gitlabCi} (include appended)`);
|
|
307
564
|
}
|
|
308
|
-
/**
|
|
309
|
-
|
|
565
|
+
/**
|
|
566
|
+
* Writes the selected CI provider's template.
|
|
567
|
+
*
|
|
568
|
+
* Args:
|
|
569
|
+
* io: process context.
|
|
570
|
+
* provider: GitHub Actions or GitLab CI.
|
|
571
|
+
* mode: strict or static-check job mode.
|
|
572
|
+
*
|
|
573
|
+
* Returns:
|
|
574
|
+
* void.
|
|
575
|
+
*/
|
|
576
|
+
export function writeCiTemplate(io, provider, mode = 'check') {
|
|
577
|
+
if (provider === 'github') {
|
|
578
|
+
writeGithubActionsTemplate(io);
|
|
579
|
+
}
|
|
580
|
+
else {
|
|
581
|
+
writeGitlabCiTemplate(io, mode);
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Detects which CI provider this repository already uses, from the
|
|
586
|
+
* files it already has. `null` when neither is present, so the caller
|
|
587
|
+
* can say so instead of guessing.
|
|
588
|
+
*
|
|
589
|
+
* The rule is the one `enforce` already uses for `--ci` (GitLab when a
|
|
590
|
+
* `.gitlab-ci.yml` exists, GitHub when only `.github` does), so the
|
|
591
|
+
* instructions and the generated wiring always agree.
|
|
592
|
+
*
|
|
593
|
+
* Args:
|
|
594
|
+
* cwd: repository root.
|
|
595
|
+
*
|
|
596
|
+
* Returns:
|
|
597
|
+
* 'github' | 'gitlab' | null: the detected provider, or null.
|
|
598
|
+
*/
|
|
599
|
+
export function detectCiProvider(cwd) {
|
|
600
|
+
if (existsSync(join(cwd, '.gitlab-ci.yml')))
|
|
601
|
+
return 'gitlab';
|
|
602
|
+
if (existsSync(join(cwd, '.github')))
|
|
603
|
+
return 'github';
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* Prints owner-run steps for making the generated CI job mandatory.
|
|
608
|
+
*
|
|
609
|
+
* Only the DETECTED provider's commands are printed: a GitLab-only
|
|
610
|
+
* repository was told GitHub branch-protection commands it can never
|
|
611
|
+
* run, and the reader had to work out which half applied. When the
|
|
612
|
+
* repository shows no provider at all, both are printed and the block
|
|
613
|
+
* says why.
|
|
614
|
+
*
|
|
615
|
+
* Args:
|
|
616
|
+
* io: process context.
|
|
617
|
+
* provider: the provider the wiring used, when the caller already
|
|
618
|
+
* resolved one; otherwise the repository is probed.
|
|
619
|
+
*
|
|
620
|
+
* Returns:
|
|
621
|
+
* void.
|
|
622
|
+
*/
|
|
623
|
+
export function writeServerProtectionInstructions(io, provider = detectCiProvider(io.cwd)) {
|
|
624
|
+
const github = [
|
|
625
|
+
'GitHub: gh api --method PUT "repos/OWNER/REPO/branches/BRANCH/protection" --input - <<\'JSON\'',
|
|
626
|
+
'{"required_status_checks":{"strict":true,"contexts":["gateforge"]},"enforce_admins":true,"required_pull_request_reviews":null,"restrictions":null}',
|
|
627
|
+
'JSON',
|
|
628
|
+
];
|
|
629
|
+
const gitlab = [
|
|
630
|
+
'GitLab: glab api --method PUT "projects/PROJECT_ID" -f only_allow_merge_if_pipeline_succeeds=true',
|
|
631
|
+
'GitLab: glab api --method POST "projects/PROJECT_ID/protected_branches" -f name=BRANCH -f push_access_level=0 -f merge_access_level=30 -f allow_force_push=false',
|
|
632
|
+
];
|
|
633
|
+
const lines = provider === 'github'
|
|
634
|
+
? [...github]
|
|
635
|
+
: provider === 'gitlab'
|
|
636
|
+
? [...gitlab]
|
|
637
|
+
: [
|
|
638
|
+
'note: no .gitlab-ci.yml and no .github/ — both providers are shown because neither was detected',
|
|
639
|
+
...github,
|
|
640
|
+
...gitlab,
|
|
641
|
+
];
|
|
642
|
+
writeLine(io.stdout, [
|
|
643
|
+
'Server setup (review and run explicitly; Gateforge does not change branch settings):',
|
|
644
|
+
provider === null
|
|
645
|
+
? 'no CI provider was detected (no .gitlab-ci.yml and no .github/) — both providers are shown:'
|
|
646
|
+
: `detected CI provider: ${provider}`,
|
|
647
|
+
...lines,
|
|
648
|
+
].join('\n'));
|
|
649
|
+
}
|
|
650
|
+
/** Wires engine, local hooks, and the selected CI provider. */
|
|
651
|
+
export function ensureBlockingWiring(io, engineRoot, gateArgs = ['check', '--changed'], ciMode = 'check', provider = 'gitlab') {
|
|
310
652
|
writeEngineReference(io, engineRoot);
|
|
311
653
|
ensureHookScript(io, engineRoot, gateArgs);
|
|
312
654
|
appendPreCommitHook(io);
|
|
313
|
-
|
|
655
|
+
writeCiTemplate(io, provider, ciMode);
|
|
314
656
|
}
|
|
315
657
|
//# sourceMappingURL=blocking.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"blocking.js","sourceRoot":"","sources":["../../src/commands/blocking.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxF,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,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ACV,SAAS,CACP,EAAE,CAAC,MAAM,EACT;QACE,sFAAsF;QACtF,QAAQ,KAAK,IAAI;YACf,CAAC,CAAC,6FAA6F;YAC/F,CAAC,CAAC,yBAAyB,QAAQ,EAAE;QACvC,GAAG,KAAK;KACT,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;AACJ,CAAC;AAED,+DAA+D;AAC/D,MAAM,UAAU,oBAAoB,CAClC,EAAM,EACN,UAAyB,EACzB,WAA8B,CAAC,OAAO,EAAE,WAAW,CAAC,EACpD,SAAyB,OAAO,EAChC,WAAgC,QAAQ;IAExC,oBAAoB,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;IACrC,gBAAgB,CAAC,EAAE,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IAC3C,mBAAmB,CAAC,EAAE,CAAC,CAAC;IACxB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC"}
|
package/dist/commands/check.d.ts
CHANGED
|
@@ -36,6 +36,21 @@ export interface CheckGateOptions {
|
|
|
36
36
|
runtimeReuseMounts?: readonly RuntimeReuseMount[];
|
|
37
37
|
/** Recomputes mounted dependency bytes after discovery. */
|
|
38
38
|
runtimeReuseCheck?: () => string | null;
|
|
39
|
+
/** Emit per-step wall-clock timings in the report (additive only). */
|
|
40
|
+
timing?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Force a full scan: no detector or pytest
|
|
43
|
+
* collection cache reads or writes. Also forced by
|
|
44
|
+
* `GATEFORGE_NO_CACHE=1` and CI environments.
|
|
45
|
+
*/
|
|
46
|
+
noCache?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Persistent state directory for the run cache. Staged-candidate runs
|
|
49
|
+
* pass the USER's run-state dir so cached results survive the thrown
|
|
50
|
+
* away scratch checkout; the cache key covers every input, so sharing
|
|
51
|
+
* across materializations of the same repo is sound.
|
|
52
|
+
*/
|
|
53
|
+
cacheStateDir?: string;
|
|
39
54
|
}
|
|
40
55
|
/**
|
|
41
56
|
* Runs the check subcommand.
|
|
@@ -50,6 +65,27 @@ export interface CheckGateOptions {
|
|
|
50
65
|
* @throws fail-closed errors (exit 2) from config/plugin/pipeline layers.
|
|
51
66
|
*/
|
|
52
67
|
export declare function checkCommand(io: Io, argv: readonly string[]): Promise<number>;
|
|
68
|
+
/**
|
|
69
|
+
* Names the report's exit-code line for what it is when a non-blocking
|
|
70
|
+
* mode softened the run's exit code.
|
|
71
|
+
*
|
|
72
|
+
* The text report always carries the STRICT result's exit code. In
|
|
73
|
+
* `strict` mode that is the code the process exits with, so the line is
|
|
74
|
+
* left byte-identical. When a mode softens it, the same bare
|
|
75
|
+
* `exit code: 1` would contradict `EXIT=0` in a CI log and to an agent
|
|
76
|
+
* reading the report, so it is relabelled as the value a blocking mode
|
|
77
|
+
* would have produced. Nothing is invented: a report without that line
|
|
78
|
+
* is returned untouched.
|
|
79
|
+
*
|
|
80
|
+
* Args:
|
|
81
|
+
* report: the rendered text report.
|
|
82
|
+
* strictExitCode: the exit code the strict result maps to.
|
|
83
|
+
* exitCode: the exit code this run actually exits with.
|
|
84
|
+
*
|
|
85
|
+
* Returns:
|
|
86
|
+
* string: the report with its exit-code line relabelled when softened.
|
|
87
|
+
*/
|
|
88
|
+
export declare function labelSoftenedExitCode(report: string, strictExitCode: number, exitCode: number): string;
|
|
53
89
|
/**
|
|
54
90
|
* The gate body shared by `check`, `check --changed`, and the Phase 5
|
|
55
91
|
* `check --staged` candidate run (via a scratch checkout cwd).
|