@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
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/** The three goals `gateforge init` offers, in the order it asks them. */
|
|
2
|
+
export const INIT_PRESET_NAMES = ['light', 'normal', 'strict'];
|
|
3
|
+
/**
|
|
4
|
+
* The mapping: goal -> settings. Single source of truth for
|
|
5
|
+
* `--preset`, the interactive question, and `--explain-presets`.
|
|
6
|
+
*/
|
|
7
|
+
export const INIT_PRESETS = Object.freeze({
|
|
8
|
+
light: {
|
|
9
|
+
strictnessMode: 'warn',
|
|
10
|
+
strictE2E: false,
|
|
11
|
+
wiring: 'none',
|
|
12
|
+
mode: 'changed',
|
|
13
|
+
ci: false,
|
|
14
|
+
explanation: 'light: show me code nothing has proven yet, block nothing. Example: you add GET /orders with no test — the report lists it, and your commit still goes through.',
|
|
15
|
+
},
|
|
16
|
+
normal: {
|
|
17
|
+
strictnessMode: 'changed',
|
|
18
|
+
strictE2E: false,
|
|
19
|
+
wiring: 'pre-commit',
|
|
20
|
+
mode: 'changed',
|
|
21
|
+
ci: true,
|
|
22
|
+
explanation: 'normal: block a commit that adds untested endpoints or models, in about a second (a static check, no test run). Example: you add a model with no test — that commit is refused; old untested code stays visible in the report.',
|
|
23
|
+
},
|
|
24
|
+
strict: {
|
|
25
|
+
strictnessMode: 'strict',
|
|
26
|
+
strictE2E: true,
|
|
27
|
+
wiring: 'blocking',
|
|
28
|
+
mode: 'staged',
|
|
29
|
+
ci: true,
|
|
30
|
+
explanation: 'strict: every push needs a real test run that Gateforge watches (the WITNESS) plus a RECEIPT — the signed record of that run. Example: `gateforge test-gates` runs your suite under the witness and stores the receipt; a push without a fresh receipt is refused.',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Type guard for a `--preset` value.
|
|
35
|
+
*
|
|
36
|
+
* Args:
|
|
37
|
+
* value (unknown): the raw flag value.
|
|
38
|
+
*
|
|
39
|
+
* Returns:
|
|
40
|
+
* boolean: true when the value names one of the three presets.
|
|
41
|
+
*/
|
|
42
|
+
export function isInitPresetName(value) {
|
|
43
|
+
return typeof value === 'string' && INIT_PRESET_NAMES.includes(value);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* The lines `init --explain-presets` prints: every goal, what it writes,
|
|
47
|
+
* and what it means. Pure so the printed table is unit-testable.
|
|
48
|
+
*
|
|
49
|
+
* Args:
|
|
50
|
+
* none.
|
|
51
|
+
*
|
|
52
|
+
* Returns:
|
|
53
|
+
* string: the multi-line preset table.
|
|
54
|
+
*/
|
|
55
|
+
export function renderPresetTable() {
|
|
56
|
+
const lines = [
|
|
57
|
+
'What each init preset does (the same table the goal question uses):',
|
|
58
|
+
'',
|
|
59
|
+
];
|
|
60
|
+
for (const name of INIT_PRESET_NAMES) {
|
|
61
|
+
const preset = INIT_PRESETS[name];
|
|
62
|
+
lines.push(` ${name} — ${preset.explanation}`);
|
|
63
|
+
const writes = [`mode: ${preset.strictnessMode}`];
|
|
64
|
+
if (preset.strictE2E)
|
|
65
|
+
writes.push('enforcement.strictE2E: true');
|
|
66
|
+
if (preset.wiring !== 'none')
|
|
67
|
+
writes.push(`pre-commit hook (gateforge check --${preset.mode})`);
|
|
68
|
+
if (preset.wiring === 'blocking')
|
|
69
|
+
writes.push('pre-push receipt check');
|
|
70
|
+
if (preset.ci)
|
|
71
|
+
writes.push('.gitlab-ci.yml job');
|
|
72
|
+
lines.push(` writes: ${writes.join(' + ')}`);
|
|
73
|
+
}
|
|
74
|
+
lines.push('');
|
|
75
|
+
lines.push('An OBLIGATION is one thing your policies say must be proven (e.g. "this endpoint really stores what it receives").');
|
|
76
|
+
lines.push('A preset only chooses how hard the gate blocks; it never waives an obligation and never hides code from the scan.');
|
|
77
|
+
lines.push('Change it later by editing the `mode:` key in .gateforge.yml, then re-running `gateforge init --explain-presets`.');
|
|
78
|
+
return lines.join('\n');
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The goal question itself: one question, three choices, one line of
|
|
82
|
+
* meaning each. Returned as a string so the wording is testable without
|
|
83
|
+
* a terminal.
|
|
84
|
+
*
|
|
85
|
+
* Args:
|
|
86
|
+
* none.
|
|
87
|
+
*
|
|
88
|
+
* Returns:
|
|
89
|
+
* string: the block init prints before reading the answer.
|
|
90
|
+
*/
|
|
91
|
+
export function renderGoalQuestion() {
|
|
92
|
+
return [
|
|
93
|
+
'',
|
|
94
|
+
'What should Gateforge do for you?',
|
|
95
|
+
' 1) light - show me code nothing has proven yet, block nothing',
|
|
96
|
+
' 2) normal - block a commit that adds untested endpoints or models (about a second)',
|
|
97
|
+
' 3) strict - every push needs a real test run Gateforge watches, plus a receipt',
|
|
98
|
+
'Your choice [2]:',
|
|
99
|
+
].join('\n');
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Parses the answer to the goal question.
|
|
103
|
+
*
|
|
104
|
+
* Args:
|
|
105
|
+
* answer (string): what the owner typed.
|
|
106
|
+
*
|
|
107
|
+
* Returns:
|
|
108
|
+
* InitPresetName: the chosen goal; an empty answer takes `normal`.
|
|
109
|
+
*
|
|
110
|
+
* Throws:
|
|
111
|
+
* Error: when the answer names no goal.
|
|
112
|
+
*/
|
|
113
|
+
export function parseGoalAnswer(answer) {
|
|
114
|
+
const value = answer.trim().toLowerCase();
|
|
115
|
+
if (value === '' || value === '2')
|
|
116
|
+
return 'normal';
|
|
117
|
+
if (value === '1')
|
|
118
|
+
return 'light';
|
|
119
|
+
if (value === '3')
|
|
120
|
+
return 'strict';
|
|
121
|
+
if (isInitPresetName(value))
|
|
122
|
+
return value;
|
|
123
|
+
throw new Error(`init: '${answer.trim()}' is not a goal — answer 1 (light), 2 (normal) or 3 (strict)`);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* How a headless owner changes the goal this run could not ask for.
|
|
127
|
+
* Printed as part of the ONE line that names the written preset, so
|
|
128
|
+
* the choice is stated once and the flag that changes it travels with
|
|
129
|
+
* it.
|
|
130
|
+
*/
|
|
131
|
+
export const CHOOSE_ANOTHER_GOAL_ADVICE = 'a human must choose the goal: re-run with --preset <light|normal|strict> (in a terminal, `gateforge init` asks)';
|
|
132
|
+
/** Repo-relative predicate: the commit-hook files a preset would wire. */
|
|
133
|
+
function isHookPath(path) {
|
|
134
|
+
return path.startsWith('.git/hooks/') || path === '.pre-commit-config.yaml';
|
|
135
|
+
}
|
|
136
|
+
/** One hook claim: what this run did, never what the preset would do. */
|
|
137
|
+
function hookLine(preset, outcome) {
|
|
138
|
+
const wroteHook = outcome.created.some(isHookPath);
|
|
139
|
+
if (preset.wiring === 'none') {
|
|
140
|
+
// "Nothing blocks your commits" is a claim about the REPO. When the
|
|
141
|
+
// repo already has a commit hook or a CI job, something does, and
|
|
142
|
+
// this run changed neither.
|
|
143
|
+
return outcome.repoHasCommitHook || outcome.repoHasCi
|
|
144
|
+
? 'wrote no hooks: your existing commit hook and/or CI job (left untouched) still decide ' +
|
|
145
|
+
'what blocks your commits — this run changed neither'
|
|
146
|
+
: 'wrote no hooks: nothing blocks your commits — read the report instead';
|
|
147
|
+
}
|
|
148
|
+
if (!wroteHook) {
|
|
149
|
+
return `kept the commit hook already in place (this run created none) — it still runs gateforge check --${preset.mode}`;
|
|
150
|
+
}
|
|
151
|
+
return preset.wiring === 'pre-commit'
|
|
152
|
+
? `wrote a pre-commit hook: gateforge check --${preset.mode} (fast, static — no test run)`
|
|
153
|
+
: `wrote the staged gate (gateforge check --${preset.mode}) plus a pre-push receipt check`;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The summary init prints after a preset is applied: what THIS run
|
|
157
|
+
* wrote, what it deliberately kept, and the command that undoes only
|
|
158
|
+
* what it created. Pure so the wording is unit-testable.
|
|
159
|
+
*
|
|
160
|
+
* The `undo:` line is the dangerous one: it names files, so on an
|
|
161
|
+
* existing repo it must name only the paths this run brought into
|
|
162
|
+
* existence. When it created nothing the line is omitted entirely —
|
|
163
|
+
* there is nothing to undo, and a fixed list would delete the owner's
|
|
164
|
+
* own config, baselines, waivers, hooks and CI file.
|
|
165
|
+
*
|
|
166
|
+
* Args:
|
|
167
|
+
* name (InitPresetName): the goal that was applied.
|
|
168
|
+
* outcome (PresetRunOutcome): what this run created and what it kept.
|
|
169
|
+
*
|
|
170
|
+
* Returns:
|
|
171
|
+
* string[]: the summary lines, in print order.
|
|
172
|
+
*/
|
|
173
|
+
export function renderPresetSummary(name, outcome) {
|
|
174
|
+
const preset = INIT_PRESETS[name];
|
|
175
|
+
const lines = outcome.autoChosen ? [] : [`preset ${name}: ${preset.explanation}`];
|
|
176
|
+
if (outcome.configExisted) {
|
|
177
|
+
lines.push('existing .gateforge.yml left untouched — its `mode:` key still decides how hard the gate blocks; ' +
|
|
178
|
+
'edit it by hand to switch goals');
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
lines.push(`wrote mode: ${preset.strictnessMode} (strict — block everything / changed — block only what this change touches / warn — block nothing)`);
|
|
182
|
+
}
|
|
183
|
+
lines.push(hookLine(preset, outcome));
|
|
184
|
+
if (preset.ci) {
|
|
185
|
+
// One truth per run: a file this run WROTE, one it appended to, and
|
|
186
|
+
// one it left alone are three different facts, and printing
|
|
187
|
+
// "updated …" followed by "kept … this run created none" read as a
|
|
188
|
+
// contradiction about the same file.
|
|
189
|
+
lines.push(outcome.created.includes('.gitlab-ci.yml')
|
|
190
|
+
? 'wrote the .gitlab-ci.yml include + job'
|
|
191
|
+
: outcome.modified.includes('.gitlab-ci.yml')
|
|
192
|
+
? 'added the gateforge include to your existing .gitlab-ci.yml (undo: git restore -- .gitlab-ci.yml)'
|
|
193
|
+
: 'kept the .gitlab-ci.yml already in place (this run created none)');
|
|
194
|
+
}
|
|
195
|
+
if (outcome.created.length > 0) {
|
|
196
|
+
lines.push(`undo: rm -rf ${outcome.created.join(' ')}`);
|
|
197
|
+
}
|
|
198
|
+
if (outcome.modified.length > 0) {
|
|
199
|
+
lines.push(`undo: git restore -- ${outcome.modified.join(' ')}`);
|
|
200
|
+
}
|
|
201
|
+
return lines;
|
|
202
|
+
}
|
|
203
|
+
//# sourceMappingURL=init-presets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-presets.js","sourceRoot":"","sources":["../../src/commands/init-presets.ts"],"names":[],"mappings":"AAqBA,0EAA0E;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAU,CAAC;AA2BxE;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAyD,MAAM,CAAC,MAAM,CAAC;IAC9F,KAAK,EAAE;QACL,cAAc,EAAE,MAAM;QACtB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,KAAK;QACT,WAAW,EACT,iKAAiK;KACpK;IACD,MAAM,EAAE;QACN,cAAc,EAAE,SAAS;QACzB,SAAS,EAAE,KAAK;QAChB,MAAM,EAAE,YAAY;QACpB,IAAI,EAAE,SAAS;QACf,EAAE,EAAE,IAAI;QACR,WAAW,EACT,gOAAgO;KACnO;IACD,MAAM,EAAE;QACN,cAAc,EAAE,QAAQ;QACxB,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,UAAU;QAClB,IAAI,EAAE,QAAQ;QACd,EAAE,EAAE,IAAI;QACR,WAAW,EACT,oQAAoQ;KACvQ;CACF,CAAC,CAAC;AAEH;;;;;;;;GAQ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C;IACJ,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CAAC,gBAAgB,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1D,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,wBAAwB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import type { Io } from '../io.js';
|
|
2
2
|
export declare const INIT_USAGE: string;
|
|
3
3
|
/** Template for the complete-behavior owner document (plan §4.1). */
|
|
4
|
-
export declare const BEHAVIOR_TEMPLATE = "# Complete-behavior owner document
|
|
4
|
+
export declare const BEHAVIOR_TEMPLATE = "# Complete-behavior owner document.\n# Presence of this file enables the complete-behavior profile: every\n# discovered endpoint must have an approved declaration (cases or an\n# owner disposition). There is no warnOnly or silent fallback.\n#\n# This scaffold is NOT approval: fill in real cases per endpoint, then\n# run 'gateforge check' \u2014 missing declarations block with\n# ENDPOINT_BEHAVIOR_MISSING until you define them.\nschemaVersion: 1\nendpoints: []\nresources: []\n";
|
|
5
5
|
/** The behavior-setup checklist: the work no scaffold can do. */
|
|
6
6
|
export declare const BEHAVIOR_CHECKLIST: string;
|
|
7
7
|
/**
|
|
8
|
-
* The starter policies
|
|
9
|
-
*
|
|
10
|
-
* UI-semantic `crud:*` stays opt-in and visibly fail-closed until a
|
|
11
|
-
* trusted UI observer exists (ADR 0003 §3).
|
|
8
|
+
* The starter policies preserve available persistence evidence and use
|
|
9
|
+
* only transport-level proof for consumed HTTP endpoints.
|
|
12
10
|
*/
|
|
13
11
|
/**
|
|
14
|
-
*
|
|
12
|
+
* Transport-only endpoint policy example (plan §8 / D1): proves only that
|
|
15
13
|
* the witness observed a matching HTTP exchange in the bound run. Test
|
|
16
14
|
* attribution is suite-claimed — it does not prove which browser, UI
|
|
17
|
-
* action, or test produced the exchange.
|
|
18
|
-
* changes the guarantee: it is a SEPARATE opt-in policy, never an
|
|
19
|
-
* automatic migration of the default frontend requirement, baselines,
|
|
20
|
-
* or waivers.
|
|
15
|
+
* action, or test produced the exchange.
|
|
21
16
|
*/
|
|
22
|
-
export declare const TRANSPORT_ONLY_POLICY_EXAMPLE = "# Transport-only endpoint policy
|
|
23
|
-
export declare const POLICIES_TEMPLATE = "# Declarative policies: when a resource matches, the required contracts\n# become obligations. Lifecycle-gated persistence:* contracts are emitted\n# only for the lifecycle operations the automatic classification enables,\n# and are graded on the witness's own engine-side observation.\n# UI-semantic crud:* contracts intentionally fail closed (no\n# witness-controlled UI observation channel exists yet) \u2014 add them only\n# deliberately.
|
|
17
|
+
export declare const TRANSPORT_ONLY_POLICY_EXAMPLE = "# Transport-only endpoint policy.\n# Each obligation proves only that the witness observed a matching HTTP\n# exchange in the bound run (\"witness observed an HTTP exchange\");\n# test attribution is suite-claimed (\"suite-claimed\"), never proven\n# browser-issued by an independent channel.\nschemaVersion: 1\npolicies:\n - id: frontend-consumed-endpoints-transport-only\n when:\n kind: http.endpoint\n consumed: true\n require:\n - http:request-observed\n - http:response-status-ok\n";
|
|
18
|
+
export declare const POLICIES_TEMPLATE = "# Declarative policies: when a resource matches, the required contracts\n# become obligations. Lifecycle-gated persistence:* contracts are emitted\n# only for the lifecycle operations the automatic classification enables,\n# and are graded on the witness's own engine-side observation.\n# UI-semantic crud:* contracts intentionally fail closed (no\n# witness-controlled UI observation channel exists yet) \u2014 add them only\n# deliberately. Consumed HTTP endpoints use transport-only proof;\n# 'http:frontend-request-observed' has no independent browser/test channel\n# and is never included in a new-install starter.\n#\n# A route no UI calls owes nothing below, so a NEW endpoint with no test is\n# invisible until it is consumed. To make every discovered route owe the\n# observation contracts (only NEW debt blocks; run 'gateforge adopt' to\n# forgive what already exists), uncomment the options section below:\n#\n# options:\n# 'http.endpoint.requireObservation': all\nschemaVersion: 1\npolicies:\n # Capability-scoped endpoint policies (workflow/validation/...) may be added\n # ONLY when the owning pack ships an engine-owned state-observing producer;\n # until then those contracts cannot be honestly evidenced and stay blocking.\n - id: user-facing-persistence\n when:\n exposure: user-facing\n require:\n - persistence:create\n - persistence:read\n - persistence:update\n - persistence:delete\n - id: frontend-consumed-endpoints-transport-only\n when:\n kind: http.endpoint\n consumed: true\n require:\n - http:request-observed\n - http:response-status-ok\n";
|
|
24
19
|
/**
|
|
25
20
|
* Runs `gateforge init` in the io cwd.
|
|
26
21
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAqDnC,eAAO,MAAM,UAAU,QAMuE,CAAC;AAE/F,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,qeAY7B,CAAC;AAGF,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,QAMQ,CAAC;AA2IxC;;;GAGG;AACH;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,sgBAezC,CAAC;AAEF,eAAO,MAAM,iBAAiB,smDAsC7B,CAAC;AAijCF;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAkuBlF"}
|