@gate-forge/cli 0.7.0 → 0.8.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 +511 -51
- package/dist/adapter-audit.d.ts +154 -0
- package/dist/adapter-audit.d.ts.map +1 -0
- package/dist/adapter-audit.js +531 -0
- package/dist/adapter-audit.js.map +1 -0
- package/dist/adapter-scaffold.d.ts +66 -0
- package/dist/adapter-scaffold.d.ts.map +1 -0
- package/dist/adapter-scaffold.js +353 -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 +59 -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 +738 -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 +284 -0
- package/dist/commands/adapters.js.map +1 -0
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +9 -1
- 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 +81 -2
- package/dist/commands/blocking.d.ts.map +1 -1
- package/dist/commands/blocking.js +336 -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 +1008 -62
- 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 +143 -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 +800 -30
- package/dist/commands/enforcement.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 +148 -0
- package/dist/commands/init-presets.d.ts.map +1 -0
- package/dist/commands/init-presets.js +194 -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 +610 -69
- 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 +744 -15
- 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 +3619 -186
- 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 +225 -22
- package/dist/commands/tests.js.map +1 -1
- package/dist/endpoint-compiler.d.ts.map +1 -1
- package/dist/endpoint-compiler.js +29 -8
- 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 +89 -0
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +137 -16
- 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/git-hooks.d.ts +17 -0
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +119 -0
- package/dist/git-hooks.js.map +1 -1
- 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/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/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 +36 -0
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +21 -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 +52 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +141 -3
- package/dist/pipeline.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 +8 -1
- package/dist/repo-scan.d.ts.map +1 -1
- package/dist/repo-scan.js +221 -27
- 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/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/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 +73 -0
- package/dist/singleton-guidance.d.ts.map +1 -0
- package/dist/singleton-guidance.js +118 -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/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 +367 -0
- package/guides/QUICKSTART.md +404 -0
- package/guides/RUNNER-NEUTRAL-EVIDENCE.md +199 -0
- package/guides/TEST-ENVIRONMENT.md +1226 -0
- package/guides/UPGRADE-0.6-to-0.7.md +65 -0
- package/guides/UPGRADE-0.7-to-0.8.md +114 -0
- package/package.json +12 -10
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The WITNESSED CI job template (managed-run plan, Part C, feedback E59).
|
|
3
|
+
*
|
|
4
|
+
* `gateforge enforce --ci gitlab|github --witnessed` writes this file
|
|
5
|
+
* NEXT TO the static one. A consumer used to hand-write the whole
|
|
6
|
+
* witnessed lane — job-scoped stack/image names, a private workspace,
|
|
7
|
+
* merge-request base-sha forwarding, verdict extraction, artifacts —
|
|
8
|
+
* and the second consumer would have written it again. The generated job
|
|
9
|
+
* is plain reviewable YAML; nothing runs at generation time.
|
|
10
|
+
*
|
|
11
|
+
* The app owns its own lifecycle: `.gateforge/runtime.yml` resets,
|
|
12
|
+
* seeds and starts the services, and `gateforge run` sequences recipe
|
|
13
|
+
* -> supervised suite -> strict check. The consumer fills the recipe and
|
|
14
|
+
* the secret variables, and nothing else.
|
|
15
|
+
*/
|
|
16
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import { dirname, join } from 'node:path';
|
|
18
|
+
import { recordInitPath, writeLine } from './io.js';
|
|
19
|
+
import { CI_INSTALL_SCRIPT, ciScriptBlock } from './commands/blocking.js';
|
|
20
|
+
import { VERSION } from './commands/common.js';
|
|
21
|
+
/** Job name of the generated GitLab witnessed job. */
|
|
22
|
+
export const GITLAB_WITNESSED_JOB = 'gateforge:witnessed';
|
|
23
|
+
/** Job id of the generated GitHub Actions witnessed job. */
|
|
24
|
+
export const GITHUB_WITNESSED_JOB = 'witnessed';
|
|
25
|
+
/** Repo-relative path of the generated GitLab witnessed job. */
|
|
26
|
+
export const GITLAB_WITNESSED_PATH = '.gateforge/ci/gitlab-witnessed.yml';
|
|
27
|
+
/** Repo-relative path of the generated GitHub Actions witnessed job. */
|
|
28
|
+
export const GITHUB_WITNESSED_PATH = '.github/workflows/gateforge-witnessed.yml';
|
|
29
|
+
/**
|
|
30
|
+
* The job-scoped shell block: private workspace, base-sha forwarding
|
|
31
|
+
* into BOTH supervised commands, and the managed run. The run prints
|
|
32
|
+
* straight into the job log, so the progress stream (on by default
|
|
33
|
+
* under CI=true) is visible while the suite runs. Nothing captures that
|
|
34
|
+
* output into a file: the suite's own output passes through it and may
|
|
35
|
+
* carry the app's secrets, so it must never become an artifact.
|
|
36
|
+
* Unindented, so each provider indents it into its own YAML.
|
|
37
|
+
*/
|
|
38
|
+
const WITNESSED_RUN_SCRIPT = [
|
|
39
|
+
'set -eu',
|
|
40
|
+
'# The job owns a private, job-scoped workspace and names. Nothing two',
|
|
41
|
+
'# concurrent jobs of one project share, and nothing a later job can',
|
|
42
|
+
'# find by accident. The app recipe may use them (stack, volumes).',
|
|
43
|
+
'mkdir -p "$GATEFORGE_CI_WORKSPACE" .gateforge/test-gates',
|
|
44
|
+
'# Forward the merge-request base sha to the scope provider of BOTH',
|
|
45
|
+
'# supervised commands: `gateforge run` executes test-gates and',
|
|
46
|
+
'# `check --require-e2e` in this environment. Without it the provider',
|
|
47
|
+
'# falls back to a local diff that can select zero changed files.',
|
|
48
|
+
'if [ -n "${CI_MERGE_REQUEST_DIFF_BASE_SHA:-}" ]; then',
|
|
49
|
+
' export CI_MERGE_REQUEST_DIFF_BASE_SHA',
|
|
50
|
+
' export GATEFORGE_CI_BASE_SHA="$CI_MERGE_REQUEST_DIFF_BASE_SHA"',
|
|
51
|
+
'fi',
|
|
52
|
+
"# The app lifecycle lives in .gateforge/runtime.yml (reset, seed,",
|
|
53
|
+
'# services, teardown). Full scope is the default: narrowing the run',
|
|
54
|
+
"# is the owner's edit, not the template's.",
|
|
55
|
+
'if run_gateforge run -- --changed --scope full; then',
|
|
56
|
+
' run_status=0',
|
|
57
|
+
'else',
|
|
58
|
+
' run_status=$?',
|
|
59
|
+
'fi',
|
|
60
|
+
];
|
|
61
|
+
/**
|
|
62
|
+
* The verdict block: the counts come from the report json, never from a
|
|
63
|
+
* parsed log line, and no secret variable is ever printed.
|
|
64
|
+
*/
|
|
65
|
+
const WITNESSED_VERDICT_SCRIPT = [
|
|
66
|
+
'if [ -f .gateforge/test-gates/report.json ]; then',
|
|
67
|
+
' node -e \'const fs=require("node:fs");const report=JSON.parse(fs.readFileSync(".gateforge/test-gates/report.json","utf8"));const summary=report.summary||{};console.log("Gateforge CI: verdict "+String(summary.satisfied)+" satisfied, "+String(summary.waived)+" waived, "+String(summary.blocking)+" blocking of "+String(summary.obligations)+" obligations (scope "+String((report.scope||{}).mode)+")");for(const entry of (report.blocking||[]).slice(0,20)){console.log("Gateforge CI: blocking "+entry.kind+": "+(entry.detail||""))}\'',
|
|
68
|
+
'else',
|
|
69
|
+
' echo "Gateforge CI: no report.json — the run failed before it wrote one" >&2',
|
|
70
|
+
' run_status=1',
|
|
71
|
+
'fi',
|
|
72
|
+
'exit "$run_status"',
|
|
73
|
+
];
|
|
74
|
+
/**
|
|
75
|
+
* Renders the witnessed GitLab CI job.
|
|
76
|
+
*
|
|
77
|
+
* Args:
|
|
78
|
+
* none.
|
|
79
|
+
*
|
|
80
|
+
* Returns:
|
|
81
|
+
* string: the include-able job definition.
|
|
82
|
+
*/
|
|
83
|
+
export function renderGitlabWitnessedTemplate() {
|
|
84
|
+
return `# Generated by Gateforge ${VERSION}; the witnessed lane. Review before enabling it.
|
|
85
|
+
# One job, one proof: \`gateforge run\` sequences the app's own recipe
|
|
86
|
+
# (.gateforge/runtime.yml), the supervised suite and the strict check, and
|
|
87
|
+
# the engine seals the receipt this job uploads. Nothing here interprets
|
|
88
|
+
# the app's stack — that is the recipe's job.
|
|
89
|
+
#
|
|
90
|
+
# Secret variables come from protected, masked CI variables; this job
|
|
91
|
+
# never prints one. Neither the recipe log (.gateforge/test-gates/run-recipe/)
|
|
92
|
+
# nor the suite's raw output is an artifact: both may contain the app's own
|
|
93
|
+
# secrets. failures.json is the secret-screened failure diagnosis.
|
|
94
|
+
#
|
|
95
|
+
# GATEFORGE_WITNESS_VERIFIER_KEY and GATEFORGE_APPROVED_POLICY_DIGEST are
|
|
96
|
+
# required; \`gateforge run\` fails preflight and names the missing one.
|
|
97
|
+
${GITLAB_WITNESSED_JOB}:
|
|
98
|
+
stage: test
|
|
99
|
+
image: node:22
|
|
100
|
+
variables:
|
|
101
|
+
GATEFORGE_VERSION: "${VERSION}"
|
|
102
|
+
GATEFORGE_CI_NESTED_PACKAGE_DIRS: ""
|
|
103
|
+
GATEFORGE_CI_JOB_SCOPE: "\${CI_PROJECT_PATH_SLUG}-\${CI_JOB_ID}"
|
|
104
|
+
GATEFORGE_CI_STACK_NAME: "\${CI_PROJECT_PATH_SLUG}-witnessed-\${CI_JOB_ID}"
|
|
105
|
+
GATEFORGE_CI_IMAGE_NAME: "\${CI_PROJECT_PATH_SLUG}-witnessed-\${CI_JOB_ID}:\${CI_COMMIT_SHORT_SHA}"
|
|
106
|
+
GATEFORGE_CI_WORKSPACE: "\${CI_PROJECT_DIR}/.gateforge/ci-witnessed/\${CI_JOB_ID}"
|
|
107
|
+
script:
|
|
108
|
+
- |
|
|
109
|
+
${ciScriptBlock(CI_INSTALL_SCRIPT)}
|
|
110
|
+
- |
|
|
111
|
+
${ciScriptBlock(WITNESSED_RUN_SCRIPT)}
|
|
112
|
+
- |
|
|
113
|
+
${ciScriptBlock(WITNESSED_VERDICT_SCRIPT)}
|
|
114
|
+
artifacts:
|
|
115
|
+
when: always
|
|
116
|
+
paths:
|
|
117
|
+
- .gateforge/test-gates/report.json
|
|
118
|
+
- .gateforge/test-gates/receipt.json
|
|
119
|
+
- .gateforge/test-gates/execution-result.json
|
|
120
|
+
- .gateforge/test-gates/failures.json
|
|
121
|
+
expire_in: 90 days
|
|
122
|
+
rules:
|
|
123
|
+
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
124
|
+
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
|
125
|
+
`;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Renders the witnessed GitHub Actions workflow. Secrets arrive as
|
|
129
|
+
* environment values on the run step and are never echoed.
|
|
130
|
+
*
|
|
131
|
+
* Args:
|
|
132
|
+
* none.
|
|
133
|
+
*
|
|
134
|
+
* Returns:
|
|
135
|
+
* string: the workflow source.
|
|
136
|
+
*/
|
|
137
|
+
export function renderGithubWitnessedTemplate() {
|
|
138
|
+
return `# Generated by Gateforge ${VERSION}; the witnessed lane. Review before enabling it.
|
|
139
|
+
name: Gateforge witnessed
|
|
140
|
+
on:
|
|
141
|
+
pull_request:
|
|
142
|
+
push:
|
|
143
|
+
workflow_dispatch:
|
|
144
|
+
permissions:
|
|
145
|
+
contents: read
|
|
146
|
+
jobs:
|
|
147
|
+
${GITHUB_WITNESSED_JOB}:
|
|
148
|
+
runs-on: ubuntu-latest
|
|
149
|
+
steps:
|
|
150
|
+
- uses: actions/checkout@v4
|
|
151
|
+
with:
|
|
152
|
+
fetch-depth: 0
|
|
153
|
+
- uses: actions/setup-node@v4
|
|
154
|
+
with:
|
|
155
|
+
node-version: 22
|
|
156
|
+
- name: Install Gateforge
|
|
157
|
+
run: npm install --no-save --package-lock=false @gate-forge/cli@${VERSION}
|
|
158
|
+
- name: Job-scoped names and workspace
|
|
159
|
+
run: |
|
|
160
|
+
set -eu
|
|
161
|
+
echo "GATEFORGE_CI_JOB_SCOPE=\${{ github.repository }}-\${{ github.run_id }}-\${{ github.run_attempt }}" >> "\$GITHUB_ENV"
|
|
162
|
+
echo "GATEFORGE_CI_WORKSPACE=\${{ github.workspace }}/.gateforge/ci-witnessed/\${{ github.run_id }}-\${{ github.run_attempt }}" >> "\$GITHUB_ENV"
|
|
163
|
+
mkdir -p "\$GITHUB_WORKSPACE/.gateforge/test-gates"
|
|
164
|
+
- name: Forward the pull-request base ref
|
|
165
|
+
if: github.event_name == 'pull_request'
|
|
166
|
+
run: |
|
|
167
|
+
set -eu
|
|
168
|
+
# The scope provider diffs against the merge base of the base
|
|
169
|
+
# branch, and it must be a real local ref: export the remote
|
|
170
|
+
# tracking ref plus the merge-base sha for the run.
|
|
171
|
+
git fetch --no-tags --quiet origin "\${{ github.base_ref }}:refs/remotes/origin/\${{ github.base_ref }}"
|
|
172
|
+
echo "GITHUB_BASE_REF=refs/remotes/origin/\${{ github.base_ref }}" >> "\$GITHUB_ENV"
|
|
173
|
+
echo "GATEFORGE_CI_BASE_SHA=\$(git merge-base HEAD "refs/remotes/origin/\${{ github.base_ref }}")" >> "\$GITHUB_ENV"
|
|
174
|
+
- name: Witnessed run
|
|
175
|
+
env:
|
|
176
|
+
GATEFORGE_WITNESS_VERIFIER_KEY: \${{ secrets.GATEFORGE_WITNESS_VERIFIER_KEY }}
|
|
177
|
+
GATEFORGE_APPROVED_POLICY_DIGEST: \${{ secrets.GATEFORGE_APPROVED_POLICY_DIGEST }}
|
|
178
|
+
run: |
|
|
179
|
+
set -eu
|
|
180
|
+
# \`gateforge run\` sequences the app's own recipe
|
|
181
|
+
# (.gateforge/runtime.yml), the supervised suite and the strict
|
|
182
|
+
# check. Full scope is the default: narrowing the run is the
|
|
183
|
+
# owner's edit, not the template's.
|
|
184
|
+
run_status=0
|
|
185
|
+
./node_modules/.bin/gateforge run -- --changed --scope full || run_status=$?
|
|
186
|
+
if [ -f .gateforge/test-gates/report.json ]; then
|
|
187
|
+
node -e 'const fs=require("node:fs");const report=JSON.parse(fs.readFileSync(".gateforge/test-gates/report.json","utf8"));const summary=report.summary||{};console.log("Gateforge CI: verdict "+String(summary.satisfied)+" satisfied, "+String(summary.waived)+" waived, "+String(summary.blocking)+" blocking of "+String(summary.obligations)+" obligations (scope "+String((report.scope||{}).mode)+")");for(const entry of (report.blocking||[]).slice(0,20)){console.log("::error::"+entry.kind+": "+(entry.detail||""))}'
|
|
188
|
+
else
|
|
189
|
+
echo "Gateforge CI: no report.json — the run failed before it wrote one" >&2
|
|
190
|
+
run_status=1
|
|
191
|
+
fi
|
|
192
|
+
exit "$run_status"
|
|
193
|
+
- name: Upload the witnessed evidence
|
|
194
|
+
if: always()
|
|
195
|
+
uses: actions/upload-artifact@v4
|
|
196
|
+
with:
|
|
197
|
+
name: gateforge-witnessed
|
|
198
|
+
# Neither the recipe log (.gateforge/test-gates/run-recipe/) nor
|
|
199
|
+
# the suite's raw output is uploaded: both may contain the app's
|
|
200
|
+
# own secrets. failures.json is the secret-screened diagnosis.
|
|
201
|
+
path: |
|
|
202
|
+
.gateforge/test-gates/report.json
|
|
203
|
+
.gateforge/test-gates/receipt.json
|
|
204
|
+
.gateforge/test-gates/execution-result.json
|
|
205
|
+
.gateforge/test-gates/failures.json
|
|
206
|
+
if-no-files-found: warn
|
|
207
|
+
retention-days: 90
|
|
208
|
+
`;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Writes one generated file only when it is absent — the same
|
|
212
|
+
* no-overwrite rule the static generator follows.
|
|
213
|
+
*
|
|
214
|
+
* Args:
|
|
215
|
+
* io: process context.
|
|
216
|
+
* path: absolute target path.
|
|
217
|
+
* content: the file to write when absent.
|
|
218
|
+
*
|
|
219
|
+
* Returns:
|
|
220
|
+
* void.
|
|
221
|
+
*/
|
|
222
|
+
function writeGenerated(io, path, content) {
|
|
223
|
+
if (existsSync(path)) {
|
|
224
|
+
recordInitPath(io, io.cwd, path, 'preserved');
|
|
225
|
+
writeLine(io.stdout, `exists, leaving untouched: ${path}`);
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
mkdirSync(dirname(path), { recursive: true });
|
|
229
|
+
writeFileSync(path, content, 'utf8');
|
|
230
|
+
recordInitPath(io, io.cwd, path, 'created');
|
|
231
|
+
writeLine(io.stdout, `created: ${path}`);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Adds the local include of the witnessed job to `.gitlab-ci.yml`,
|
|
235
|
+
* never rewriting an include the owner already wrote.
|
|
236
|
+
*
|
|
237
|
+
* Args:
|
|
238
|
+
* io: process context.
|
|
239
|
+
*
|
|
240
|
+
* Returns:
|
|
241
|
+
* void.
|
|
242
|
+
*/
|
|
243
|
+
function ensureGitlabInclude(io) {
|
|
244
|
+
const path = join(io.cwd, '.gitlab-ci.yml');
|
|
245
|
+
const local = ` - local: '${GITLAB_WITNESSED_PATH}'`;
|
|
246
|
+
if (!existsSync(path)) {
|
|
247
|
+
writeFileSync(path, `include:\n${local}\n`);
|
|
248
|
+
recordInitPath(io, io.cwd, path, 'created');
|
|
249
|
+
writeLine(io.stdout, `created: ${path} (includes the gateforge witnessed job)`);
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const current = readFileSync(path, 'utf8');
|
|
253
|
+
if (current.includes(GITLAB_WITNESSED_PATH)) {
|
|
254
|
+
recordInitPath(io, io.cwd, path, 'preserved');
|
|
255
|
+
writeLine(io.stdout, `exists, leaving untouched: ${path} (witnessed include present)`);
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const updated = /^include:/m.test(current)
|
|
259
|
+
? current.replace(/^include:[^\n]*/m, (match) => `${match}\n${local}`)
|
|
260
|
+
: `${current.endsWith('\n') ? current : `${current}\n`}include:\n${local}\n`;
|
|
261
|
+
writeFileSync(path, updated, 'utf8');
|
|
262
|
+
writeLine(io.stdout, `updated: ${path} (witnessed include added)`);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Writes the witnessed job template for the selected provider, plus the
|
|
266
|
+
* provider's include wiring. Plain files: the owner reviews them.
|
|
267
|
+
*
|
|
268
|
+
* Args:
|
|
269
|
+
* io: process context.
|
|
270
|
+
* provider: GitHub Actions or GitLab CI.
|
|
271
|
+
*
|
|
272
|
+
* Returns:
|
|
273
|
+
* void.
|
|
274
|
+
*/
|
|
275
|
+
export function writeWitnessedCiTemplate(io, provider) {
|
|
276
|
+
if (provider === 'github') {
|
|
277
|
+
writeGenerated(io, join(io.cwd, GITHUB_WITNESSED_PATH), renderGithubWitnessedTemplate());
|
|
278
|
+
return;
|
|
279
|
+
}
|
|
280
|
+
writeGenerated(io, join(io.cwd, GITLAB_WITNESSED_PATH), renderGitlabWitnessedTemplate());
|
|
281
|
+
ensureGitlabInclude(io);
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=ci-witnessed-template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ci-witnessed-template.js","sourceRoot":"","sources":["../src/ci-witnessed-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,sDAAsD;AACtD,MAAM,CAAC,MAAM,oBAAoB,GAAG,qBAAqB,CAAC;AAC1D,4DAA4D;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,WAAW,CAAC;AAChD,gEAAgE;AAChE,MAAM,CAAC,MAAM,qBAAqB,GAAG,oCAAoC,CAAC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O;IACT,CAAC;IACD,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC;QACxC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,KAAK,EAAE,CAAC;QACtE,CAAC,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,aAAa,KAAK,IAAI,CAAC;IAC/E,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,YAAY,IAAI,4BAA4B,CAAC,CAAC;AACrE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CAAC,EAAM,EAAE,QAA6B;IAC5E,IAAI,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAC1B,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,qBAAqB,CAAC,EAAE,6BAA6B,EAAE,CAAC,CAAC;QACzF,OAAO;IACT,CAAC;IACD,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,qBAAqB,CAAC,EAAE,6BAA6B,EAAE,CAAC,CAAC;IACzF,mBAAmB,CAAC,EAAE,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Io } from './io.js';
|
|
2
2
|
/** The top-level usage text (also printed for `--help`). */
|
|
3
|
-
export declare const USAGE = "usage: gateforge <command> [options]\n\ncommands:\n init [--languages <comma,list>] [--plugins <comma,list>] [--accept-recommended] [--no-scan]\n [--proof overlay|observe] [--blocking] [--strict-e2e] [--witnessed staged|full]\n scan the repo, print the recommended install, and write\n .gateforge.yml + skeleton + GATEFORGE.md + overlay README\n (idempotent; --blocking installs AND verifies an active\n pre-commit hook + CI wiring)\n enforce
|
|
3
|
+
export declare const USAGE = "usage: gateforge <command> [options]\n\ncommands:\n init [--languages <comma,list>] [--plugins <comma,list>] [--accept-recommended] [--no-scan]\n [--proof overlay|observe] [--blocking] [--strict-e2e] [--witnessed staged|full]\n scan the repo, print the recommended install, and write\n .gateforge.yml + skeleton + GATEFORGE.md + overlay README\n (idempotent; --blocking installs AND verifies an active\n pre-commit hook + CI wiring)\n enforce [--ci github|gitlab] [--witnessed] wire the blocking pre-commit + CI gate into an initialized repo (idempotent);\n --witnessed also writes the witnessed 'gateforge run' job template\n adopt adopt enforcement: seed the baseline from current debt (the one bulk-add) + wire the gate\n discover [--json] run detectors and dump the resource graph\n classify [--json] [--write-snapshot P] inspect effective classifications + typed blocks\n explain <resourceId> [--json] full signal/rule/obligation trace for one resource\n tests discover [--json] [--pytest] inventory existing tests into the run-state catalog\n tests suggest [--changed] [--json] suggest existing tests for uncovered obligations (inspection, never a gate)\n tests mark --test K --kind K [--category C]...\n --obligation ID... --reason \"T\" declare an existing test in .gateforge/test-map.yml (atomic, idempotent)\n tests explain --test K [--json] requirements/mapping/next action for one existing test\n tests diagnose [--suite N] [--json] run the configured pytest diagnostic suites (advisory; exit 0/1/2)\n adapters scaffold [--dry-run] write a starting-point evidence adapter per business resource\n [--dry-run] that has none (never overwrites; every guess is marked)\n adapters check [--json] load and validate every adapter; report the resources with none\n [--probe --base-url URL] with the app running: one read-only GET per adapter\n [--probe-id ID]\n obligations [--json] evaluate policies and dump obligations\n history [--test TEXT] [--failed] [--since ISO] query retained supervised run history\n check [--changed] [--staged] [--candidate-commit SHA] run the gate against all files, the exact frozen\n index, or the selected immutable commit tree; --changed narrows the selected candidate's diff;\n [--require-e2e] [--format F] require a valid receipt and select text|json|sarif output\n next [--changed] [--json] print the ONE blocking next action (navigation, not the gate)\n test-gates [--changed] [--suite CMD] supervised E2E run over the obligations (--changed) or the\n [--out DIR] [--format F] legacy suite escape hatch; seals a gate receipt on complete success\n [--witness-url URL]\n pre-commit --scope staged|full freeze the Git index, run the witnessed gate against those exact\n bytes, validate the new receipt, and recheck the index before success\n broker commit --workspace DIR commit broker (MECHANISM, not deployment): verifies a gate\n --message MSG [--receipt P] receipt for the exact workspace bytes, then commits via compare-and-swap\n [--ref REF] ref update. Guaranteed only when the broker runs outside the agent's\n write/process boundary (ADR 0005 D1)\n key create|import-env|rotate|retire owner-only verifier-key ceremony; stores keys outside the repo\n --file PATH --confirm key IDs are safe to log; key material is never printed\n enforcement doctor [--json] honest enforcement diagnostics: hook activation, runner/observer readiness,\n trusted binary/policy ownership, snapshot mode, standard/managed boundary\n baseline update <fp...> shrink the baseline to a strict subset (invariant 4)\n baseline diff <before> <after> compare adopted obligations by ID without printing fingerprints\n waive <resourceId:contract> write an expiring, owner-approved waiver for one obligation\n --owner N --approver N (GF-15: all fields mandatory; justification URL required;\n --justification-url U --expires D no --force \u2014 renewal is a hand-edit of the written file)\n quarantine <testKey> write an expiring, owner-approved flaky-test quarantine\n --owner N --approver N (never proof, never blocking; at most 14 days; no --force;\n --reason \"T\" --expires D an expired quarantine BLOCKS until renewed or deleted)\n run [--] [test-gates flags] the whole local proof in order: doctor preflight (strict), the optional\n .gateforge/runtime.yml recipe (reset/seed/up/health), the supervised\n test-gates, check --require-e2e, and the recipe's teardown \u2014 one line\n per step, exit code = the first failing step's own code\n --version print the version\n --help show this help\n\nexit codes: 0 clean/waived, 1 unresolved obligations, 2 config/usage error";
|
|
4
4
|
/**
|
|
5
5
|
* Runs the gateforge CLI.
|
|
6
6
|
*
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAyBlC,4DAA4D;AAC5D,eAAO,MAAM,KAAK,k8KA6DyD,CAAC;AAE5E;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,GAAE,EAAgB,GACnB,OAAO,CAAC,MAAM,CAAC,CAoEjB"}
|
package/dist/cli.js
CHANGED
|
@@ -22,12 +22,16 @@ import { testGatesCommand } from './commands/test-gates.js';
|
|
|
22
22
|
import { preCommitCommand } from './commands/pre-commit.js';
|
|
23
23
|
import { baselineCommand } from './commands/baseline.js';
|
|
24
24
|
import { waiveCommand } from './commands/waive.js';
|
|
25
|
+
import { quarantineCommand } from './commands/quarantine.js';
|
|
25
26
|
import { classifyCommand } from './commands/classify.js';
|
|
26
27
|
import { explainCommand } from './commands/explain.js';
|
|
27
28
|
import { testsCommand } from './commands/tests.js';
|
|
29
|
+
import { adaptersCommand } from './commands/adapters.js';
|
|
30
|
+
import { runCommand } from './commands/run.js';
|
|
28
31
|
import { enforcementCommand } from './commands/enforcement.js';
|
|
29
32
|
import { brokerCommand } from './broker.js';
|
|
30
33
|
import { keysCommand } from './commands/keys.js';
|
|
34
|
+
import { historyCommand } from './commands/history.js';
|
|
31
35
|
/** The top-level usage text (also printed for `--help`). */
|
|
32
36
|
export const USAGE = `\
|
|
33
37
|
usage: gateforge <command> [options]
|
|
@@ -39,7 +43,8 @@ commands:
|
|
|
39
43
|
.gateforge.yml + skeleton + GATEFORGE.md + overlay README
|
|
40
44
|
(idempotent; --blocking installs AND verifies an active
|
|
41
45
|
pre-commit hook + CI wiring)
|
|
42
|
-
enforce
|
|
46
|
+
enforce [--ci github|gitlab] [--witnessed] wire the blocking pre-commit + CI gate into an initialized repo (idempotent);
|
|
47
|
+
--witnessed also writes the witnessed 'gateforge run' job template
|
|
43
48
|
adopt adopt enforcement: seed the baseline from current debt (the one bulk-add) + wire the gate
|
|
44
49
|
discover [--json] run detectors and dump the resource graph
|
|
45
50
|
classify [--json] [--write-snapshot P] inspect effective classifications + typed blocks
|
|
@@ -50,10 +55,16 @@ commands:
|
|
|
50
55
|
--obligation ID... --reason "T" declare an existing test in .gateforge/test-map.yml (atomic, idempotent)
|
|
51
56
|
tests explain --test K [--json] requirements/mapping/next action for one existing test
|
|
52
57
|
tests diagnose [--suite N] [--json] run the configured pytest diagnostic suites (advisory; exit 0/1/2)
|
|
58
|
+
adapters scaffold [--dry-run] write a starting-point evidence adapter per business resource
|
|
59
|
+
[--dry-run] that has none (never overwrites; every guess is marked)
|
|
60
|
+
adapters check [--json] load and validate every adapter; report the resources with none
|
|
61
|
+
[--probe --base-url URL] with the app running: one read-only GET per adapter
|
|
62
|
+
[--probe-id ID]
|
|
53
63
|
obligations [--json] evaluate policies and dump obligations
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
history [--test TEXT] [--failed] [--since ISO] query retained supervised run history
|
|
65
|
+
check [--changed] [--staged] [--candidate-commit SHA] run the gate against all files, the exact frozen
|
|
66
|
+
index, or the selected immutable commit tree; --changed narrows the selected candidate's diff;
|
|
67
|
+
[--require-e2e] [--format F] require a valid receipt and select text|json|sarif output
|
|
57
68
|
next [--changed] [--json] print the ONE blocking next action (navigation, not the gate)
|
|
58
69
|
test-gates [--changed] [--suite CMD] supervised E2E run over the obligations (--changed) or the
|
|
59
70
|
[--out DIR] [--format F] legacy suite escape hatch; seals a gate receipt on complete success
|
|
@@ -69,9 +80,17 @@ commands:
|
|
|
69
80
|
enforcement doctor [--json] honest enforcement diagnostics: hook activation, runner/observer readiness,
|
|
70
81
|
trusted binary/policy ownership, snapshot mode, standard/managed boundary
|
|
71
82
|
baseline update <fp...> shrink the baseline to a strict subset (invariant 4)
|
|
83
|
+
baseline diff <before> <after> compare adopted obligations by ID without printing fingerprints
|
|
72
84
|
waive <resourceId:contract> write an expiring, owner-approved waiver for one obligation
|
|
73
85
|
--owner N --approver N (GF-15: all fields mandatory; justification URL required;
|
|
74
86
|
--justification-url U --expires D no --force — renewal is a hand-edit of the written file)
|
|
87
|
+
quarantine <testKey> write an expiring, owner-approved flaky-test quarantine
|
|
88
|
+
--owner N --approver N (never proof, never blocking; at most 14 days; no --force;
|
|
89
|
+
--reason "T" --expires D an expired quarantine BLOCKS until renewed or deleted)
|
|
90
|
+
run [--] [test-gates flags] the whole local proof in order: doctor preflight (strict), the optional
|
|
91
|
+
.gateforge/runtime.yml recipe (reset/seed/up/health), the supervised
|
|
92
|
+
test-gates, check --require-e2e, and the recipe's teardown — one line
|
|
93
|
+
per step, exit code = the first failing step's own code
|
|
75
94
|
--version print the version
|
|
76
95
|
--help show this help
|
|
77
96
|
|
|
@@ -118,6 +137,8 @@ export async function main(argv, io = processIo()) {
|
|
|
118
137
|
return runWithExitCodes(io, () => explainCommand(io, rest));
|
|
119
138
|
case 'tests':
|
|
120
139
|
return runWithExitCodes(io, () => testsCommand(io, rest));
|
|
140
|
+
case 'adapters':
|
|
141
|
+
return runWithExitCodes(io, () => adaptersCommand(io, rest));
|
|
121
142
|
case 'obligations':
|
|
122
143
|
return runWithExitCodes(io, () => obligationsCommand(io, rest));
|
|
123
144
|
case 'check':
|
|
@@ -126,6 +147,10 @@ export async function main(argv, io = processIo()) {
|
|
|
126
147
|
return runWithExitCodes(io, () => nextCommand(io, rest));
|
|
127
148
|
case 'test-gates':
|
|
128
149
|
return runWithExitCodes(io, () => testGatesCommand(io, rest));
|
|
150
|
+
case 'run':
|
|
151
|
+
return runWithExitCodes(io, () => Promise.resolve(runCommand(io, rest)));
|
|
152
|
+
case 'history':
|
|
153
|
+
return runWithExitCodes(io, () => Promise.resolve(historyCommand(io, rest)));
|
|
129
154
|
case 'pre-commit':
|
|
130
155
|
return runWithExitCodes(io, () => preCommitCommand(io, rest));
|
|
131
156
|
case 'enforcement':
|
|
@@ -138,6 +163,8 @@ export async function main(argv, io = processIo()) {
|
|
|
138
163
|
return runWithExitCodes(io, () => Promise.resolve(baselineCommand(io, rest)));
|
|
139
164
|
case 'waive':
|
|
140
165
|
return runWithExitCodes(io, () => waiveCommand(io, rest));
|
|
166
|
+
case 'quarantine':
|
|
167
|
+
return runWithExitCodes(io, () => quarantineCommand(io, rest));
|
|
141
168
|
default:
|
|
142
169
|
return runWithExitCodes(io, async () => {
|
|
143
170
|
// parseArgs validates flag syntax; unknown commands are usage errors.
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EA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EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC5E,KAAK,UAAU;YACb,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAChF,KAAK,OAAO;YACV,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QAC5D,KAAK,YAAY;YACf,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QACjE;YACE,OAAO,gBAAgB,CAAC,EAAE,EAAE,KAAK,IAAI,EAAE;gBACrC,sEAAsE;gBACtE,SAAS,CAAC,IAAI,CAAC,CAAC;gBAChB,MAAM,IAAI,UAAU,CAAC,oBAAoB,OAAO,GAAG,CAAC,CAAC;YACvD,CAAC,CAAC,CAAC;IACP,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Io } from '../io.js';
|
|
2
|
+
export declare const ADAPTERS_USAGE = "usage: gateforge adapters scaffold [--dry-run] | gateforge adapters check [--probe --base-url URL] [--probe-id ID]";
|
|
3
|
+
/**
|
|
4
|
+
* Runs the `adapters` command.
|
|
5
|
+
*
|
|
6
|
+
* Args:
|
|
7
|
+
* io: process context.
|
|
8
|
+
* argv: arguments after `adapters`.
|
|
9
|
+
*
|
|
10
|
+
* Returns:
|
|
11
|
+
* number: the process exit code.
|
|
12
|
+
* @throws UsageError for an unknown subcommand or flag.
|
|
13
|
+
*/
|
|
14
|
+
export declare function adaptersCommand(io: Io, argv: readonly string[]): Promise<number>;
|
|
15
|
+
//# sourceMappingURL=adapters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapters.d.ts","sourceRoot":"","sources":["../../src/commands/adapters.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAQnC,eAAO,MAAM,cAAc,uHAC2F,CAAC;AA+OvH;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAmBtF"}
|