@gate-forge/cli 0.11.1 → 0.13.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/CHANGELOG.md +198 -0
- package/README.md +10 -1
- package/dist/adopted-baseline.d.ts.map +1 -1
- package/dist/adopted-baseline.js +13 -0
- package/dist/adopted-baseline.js.map +1 -1
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +1 -0
- package/dist/args.js.map +1 -1
- package/dist/business-rules.d.ts +223 -0
- package/dist/business-rules.d.ts.map +1 -0
- package/dist/business-rules.js +383 -0
- package/dist/business-rules.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +5 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/adopt.d.ts +5 -3
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +338 -5
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/baseline.d.ts.map +1 -1
- package/dist/commands/baseline.js +60 -24
- package/dist/commands/baseline.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +96 -18
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/enforcement.d.ts.map +1 -1
- package/dist/commands/enforcement.js +5 -11
- package/dist/commands/enforcement.js.map +1 -1
- package/dist/commands/explain.d.ts.map +1 -1
- package/dist/commands/explain.js +67 -2
- package/dist/commands/explain.js.map +1 -1
- package/dist/commands/init.d.ts +3 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +96 -4
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +96 -5
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/pre-commit.d.ts.map +1 -1
- package/dist/commands/pre-commit.js +5 -8
- package/dist/commands/pre-commit.js.map +1 -1
- package/dist/commands/test-gates.d.ts.map +1 -1
- package/dist/commands/test-gates.js +245 -12
- 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 +101 -11
- package/dist/commands/tests.js.map +1 -1
- package/dist/detector-trust.d.ts.map +1 -1
- package/dist/detector-trust.js +2 -0
- package/dist/detector-trust.js.map +1 -1
- package/dist/evaluate.d.ts +16 -0
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +26 -2
- package/dist/evaluate.js.map +1 -1
- package/dist/execution.d.ts +6 -5
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +26 -2
- package/dist/execution.js.map +1 -1
- package/dist/input-snapshot.d.ts.map +1 -1
- package/dist/input-snapshot.js +17 -7
- package/dist/input-snapshot.js.map +1 -1
- package/dist/mapping.d.ts +10 -1
- package/dist/mapping.d.ts.map +1 -1
- package/dist/mapping.js +5 -0
- package/dist/mapping.js.map +1 -1
- package/dist/page-obligations.d.ts +21 -0
- package/dist/page-obligations.d.ts.map +1 -0
- package/dist/page-obligations.js +123 -0
- package/dist/page-obligations.js.map +1 -0
- package/dist/pipeline.d.ts +9 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +10 -0
- package/dist/pipeline.js.map +1 -1
- package/dist/route-plane-proposals.d.ts.map +1 -1
- package/dist/route-plane-proposals.js +1 -0
- package/dist/route-plane-proposals.js.map +1 -1
- package/dist/staged-candidate.d.ts +1 -36
- package/dist/staged-candidate.d.ts.map +1 -1
- package/dist/staged-candidate.js +0 -47
- package/dist/staged-candidate.js.map +1 -1
- package/guides/CONNECT-YOUR-PROJECT.md +38 -0
- package/guides/QUICKSTART.md +46 -7
- package/guides/REFERENCE.md +244 -3
- package/package.json +11 -10
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI seam for owner-declared BUSINESS RULES
|
|
3
|
+
* (plan 2026-10-05 §5 D3/D4/D5, WP4).
|
|
4
|
+
*
|
|
5
|
+
* One module owns every fact a rule needs, because the three consumers
|
|
6
|
+
* — `check`, `next` and `tests mark`/`explain` — must never disagree
|
|
7
|
+
* about what a case is worth:
|
|
8
|
+
*
|
|
9
|
+
* - the OWNER rules come from the owner-answers document, which the
|
|
10
|
+
* pipeline already read (never a second read of the same file);
|
|
11
|
+
* - the CLAIM IDS come from the cases those rules declare, and are what
|
|
12
|
+
* the one mapping resolver validates a `business-rule:` claim against;
|
|
13
|
+
* - the RUN FACTS come from a SEALED execution result plus the sealed
|
|
14
|
+
* records and the owner's WITNESSED suite declarations. A run with no
|
|
15
|
+
* sealed execution result passes `null`, and `null` grades everything
|
|
16
|
+
* mapped as `unproven` — a declaration is never proof.
|
|
17
|
+
*
|
|
18
|
+
* Two invariants this module exists to hold:
|
|
19
|
+
* - **run-wide.** Rule grading reads the FULL rule list and the FULL
|
|
20
|
+
* rule bindings, never the changed-file selection, so a `--scope
|
|
21
|
+
* changed` run cannot scope a rule away. A case whose test sits
|
|
22
|
+
* outside that run's graded slice is reported as `unproven (outside
|
|
23
|
+
* this run's graded slice)` — visible, not absent, and never
|
|
24
|
+
* satisfied by a receipt that never covered it.
|
|
25
|
+
* - **advisory never hides.** `enforcement: advisory` routes a case's
|
|
26
|
+
* finding into the report's existing `advisories` channel; only
|
|
27
|
+
* `enforcement: block` findings reach `blocking` and the exit code.
|
|
28
|
+
* Both channels carry the same typed cause, and the channel is decided
|
|
29
|
+
* by the OWNER's declaration on the rule, never by a new severity.
|
|
30
|
+
*/
|
|
31
|
+
import { BUSINESS_RULE_TYPE_TABLE, businessRuleClaimId, EvidenceRecordSchema, casesOf, evaluateBusinessRules, } from '@gate-forge/core';
|
|
32
|
+
import { UsageError } from './errors.js';
|
|
33
|
+
/** Every rule-case claim id this rule list declares, sorted. */
|
|
34
|
+
export function businessRuleClaimIds(rules) {
|
|
35
|
+
const ids = rules.flatMap((rule) => casesOf(rule).map((entry) => businessRuleClaimId(rule.id, entry.id)));
|
|
36
|
+
return [...new Set(ids)].sort();
|
|
37
|
+
}
|
|
38
|
+
/** The runner each catalog row executes under, keyed by logical key. */
|
|
39
|
+
export function catalogRunnerIndex(catalog) {
|
|
40
|
+
return new Map(catalog.entries.map((entry) => [entry.logicalKey, entry.runner]));
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* The logical test keys whose FILE the catalog observed intercepting the
|
|
44
|
+
* system under test. A mocked spec can never satisfy a rule: it proves
|
|
45
|
+
* the mock, not the rule (plan invariant 6).
|
|
46
|
+
*/
|
|
47
|
+
export function mockedTestKeys(catalog) {
|
|
48
|
+
return new Set(catalog.entries
|
|
49
|
+
.filter((entry) => entry.suppressionSignals.some((signal) => signal.kind === 'mock'))
|
|
50
|
+
.map((entry) => entry.logicalKey));
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The resolver's rule bindings projected onto the evaluator's binding
|
|
54
|
+
* shape. Pure; the resolver has already dropped quarantined, stale and
|
|
55
|
+
* wildcard-rejected declarations, and the evaluator independently
|
|
56
|
+
* refuses anything but `native`/`sidecar` origins.
|
|
57
|
+
*
|
|
58
|
+
* A binding whose selector bound no catalog instance contributes no
|
|
59
|
+
* runner, which the evaluator reads as "not an accepted kind" rather
|
|
60
|
+
* than guessing one: a declaration with no resolvable instance is not
|
|
61
|
+
* proof of anything.
|
|
62
|
+
*/
|
|
63
|
+
export function businessRuleBindingsOf(ruleBindings, runners, mockedKeys) {
|
|
64
|
+
const bindings = new Map();
|
|
65
|
+
for (const claim of ruleBindings) {
|
|
66
|
+
bindings.set(claim.claimId, claim.bindings.map((binding) => ({
|
|
67
|
+
logicalKey: binding.logicalKey,
|
|
68
|
+
origin: binding.origin,
|
|
69
|
+
declaredKind: binding.declaredKind,
|
|
70
|
+
runner: runners.get(binding.logicalKey) ?? '',
|
|
71
|
+
mocked: mockedKeys.has(binding.logicalKey),
|
|
72
|
+
reason: binding.reason,
|
|
73
|
+
file: binding.instances[0]?.file ?? binding.logicalKey,
|
|
74
|
+
})));
|
|
75
|
+
}
|
|
76
|
+
return bindings;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Reads the OWNER's declared `witnessed` diagnostic suites as the set of
|
|
80
|
+
* runner names whose proof this repository can produce. A suite the
|
|
81
|
+
* owner did not mark witnessed contributes nothing: the pytest row of
|
|
82
|
+
* the type table requires one, and an unwitnessed suite is not proof
|
|
83
|
+
* (owner decision, 2026-10-04).
|
|
84
|
+
*/
|
|
85
|
+
export function witnessedRunnersOf(config) {
|
|
86
|
+
const runners = new Set();
|
|
87
|
+
for (const suite of config.diagnostics?.suites ?? []) {
|
|
88
|
+
if (suite.witnessed === true)
|
|
89
|
+
runners.add('pytest');
|
|
90
|
+
}
|
|
91
|
+
return runners;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* One test's sealed facts.
|
|
95
|
+
*
|
|
96
|
+
* The GRADED SLICE is the selection the supervisor fixed BEFORE the run:
|
|
97
|
+
* a test the selection did not name is outside the slice even when the
|
|
98
|
+
* runner happened to execute it, which is exactly the `--scope changed`
|
|
99
|
+
* case the plan calls out. Status is the supervisor's own normalized
|
|
100
|
+
* outcome, never a reporter summary.
|
|
101
|
+
*/
|
|
102
|
+
function testFactOf(result, logicalKey, executionKey, runners) {
|
|
103
|
+
const planned = result.planned.find((instance) => instance.logicalKey === executionKey);
|
|
104
|
+
const outcome = result.outcomes.find((row) => row.logicalKey === executionKey);
|
|
105
|
+
// The session trace joins on the INSTANCE identity (project, file,
|
|
106
|
+
// title path). Runner adapters may use a reconciliation key in the
|
|
107
|
+
// sealed result while the catalog and sidecar use the catalog key.
|
|
108
|
+
const trace = (result.sessionTrace ?? []).find((test) => planned !== undefined &&
|
|
109
|
+
test.file === planned.file &&
|
|
110
|
+
test.project === planned.project &&
|
|
111
|
+
test.titlePath.join('>') === planned.titlePath.join('>'));
|
|
112
|
+
return {
|
|
113
|
+
logicalKey,
|
|
114
|
+
runner: runners.get(logicalKey) ?? '',
|
|
115
|
+
status: outcome?.status ?? 'not-run',
|
|
116
|
+
inGradedSlice: result.selection.logicalKeys.includes(executionKey),
|
|
117
|
+
sessionIds: (trace?.sessions ?? []).map((session) => session.sessionId),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/** Stable join key shared by catalog, planned, and executed test instances. */
|
|
121
|
+
function instanceKey(project, file, titlePath) {
|
|
122
|
+
return `${project ?? ''}\u0000${file}\u0000${titlePath.join('>')}`;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Builds the evaluator's run facts from a SEALED execution result.
|
|
126
|
+
*
|
|
127
|
+
* Args:
|
|
128
|
+
* input: the sealed execution result (null when none exists), the
|
|
129
|
+
* sealed records, the witnessed runners, the receipt's scope, and the
|
|
130
|
+
* run's catalog.
|
|
131
|
+
*
|
|
132
|
+
* Returns:
|
|
133
|
+
* BusinessRuleRunFacts | null: the facts, or null for no sealed run —
|
|
134
|
+
* which is what makes a static `check` grade everything mapped as
|
|
135
|
+
* `unproven` instead of quietly satisfied.
|
|
136
|
+
*/
|
|
137
|
+
export function businessRuleRunFacts(input) {
|
|
138
|
+
if (input.result === null)
|
|
139
|
+
return null;
|
|
140
|
+
const runners = catalogRunnerIndex(input.catalog);
|
|
141
|
+
const logicalKeyByInstance = new Map(input.catalog.entries.map((entry) => [
|
|
142
|
+
instanceKey(entry.project, entry.file, entry.titlePath),
|
|
143
|
+
entry.logicalKey,
|
|
144
|
+
]));
|
|
145
|
+
const logicalKeyOf = (project, file, titlePath, fallback) => logicalKeyByInstance.get(instanceKey(project, file, titlePath)) ?? fallback;
|
|
146
|
+
const tests = new Map();
|
|
147
|
+
// Planned instances first (the expected set), then any outcome for a
|
|
148
|
+
// key the plan never listed: the plan is pre-run, the outcome is what
|
|
149
|
+
// actually ran, and an executed-but-unplanned key is still a fact.
|
|
150
|
+
for (const planned of input.result.planned) {
|
|
151
|
+
const logicalKey = logicalKeyOf(planned.project, planned.file, planned.titlePath, planned.logicalKey);
|
|
152
|
+
tests.set(logicalKey, testFactOf(input.result, logicalKey, planned.logicalKey, runners));
|
|
153
|
+
}
|
|
154
|
+
for (const outcome of input.result.outcomes) {
|
|
155
|
+
const logicalKey = logicalKeyOf(outcome.project, outcome.file, outcome.titlePath, outcome.logicalKey);
|
|
156
|
+
if (tests.has(logicalKey))
|
|
157
|
+
continue;
|
|
158
|
+
tests.set(logicalKey, testFactOf(input.result, logicalKey, outcome.logicalKey, runners));
|
|
159
|
+
}
|
|
160
|
+
// Runner adapters use their reconciliation identity (`file#title`)
|
|
161
|
+
// in execution results, while catalog/sidecar mappings use the
|
|
162
|
+
// declared logical key (`pytest:suite:file:title`). Bridge only rows
|
|
163
|
+
// from the runner whose execution this result records, and only when
|
|
164
|
+
// the planned instance identifies one unambiguous catalog row.
|
|
165
|
+
for (const entry of input.catalog.entries) {
|
|
166
|
+
if (entry.runner !== input.result.selection.runner || tests.has(entry.logicalKey))
|
|
167
|
+
continue;
|
|
168
|
+
const matchingInstances = input.result.planned.filter((planned) => planned.file === entry.file &&
|
|
169
|
+
planned.titlePath.join('>') === entry.titlePath.join('>'));
|
|
170
|
+
const instance = matchingInstances[0];
|
|
171
|
+
if (matchingInstances.length !== 1 || instance === undefined)
|
|
172
|
+
continue;
|
|
173
|
+
tests.set(entry.logicalKey, testFactOf(input.result, entry.logicalKey, instance.logicalKey, runners));
|
|
174
|
+
}
|
|
175
|
+
return {
|
|
176
|
+
scope: input.scope,
|
|
177
|
+
docsOnly: input.docsOnly,
|
|
178
|
+
tests,
|
|
179
|
+
records: authorizedRecords(input.records),
|
|
180
|
+
witnessedRunners: input.witnessedRunners,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Validates the run's AUTHORIZED records into the typed shape the
|
|
185
|
+
* evaluator reads.
|
|
186
|
+
*
|
|
187
|
+
* `evaluateRun` returns them as `unknown[]` because all that has been
|
|
188
|
+
* established at that point is AUTHORIZATION, not shape. This is where
|
|
189
|
+
* the shape is established: a record that does not parse contributes no
|
|
190
|
+
* proof, which is the fail-closed direction. Parsing here rather than
|
|
191
|
+
* asserting a type keeps a malformed or tampered ledger from being
|
|
192
|
+
* attributed to a rule case.
|
|
193
|
+
*
|
|
194
|
+
* Args:
|
|
195
|
+
* records: the authorized, quarantine-filtered records.
|
|
196
|
+
*
|
|
197
|
+
* Returns:
|
|
198
|
+
* EvidenceRecord[]: the records that satisfy the schema, in input order.
|
|
199
|
+
*/
|
|
200
|
+
function authorizedRecords(records) {
|
|
201
|
+
const valid = [];
|
|
202
|
+
for (const record of records) {
|
|
203
|
+
const parsed = EvidenceRecordSchema.safeParse(record);
|
|
204
|
+
if (parsed.success)
|
|
205
|
+
valid.push(parsed.data);
|
|
206
|
+
}
|
|
207
|
+
return valid;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Grades every declared rule case for one run.
|
|
211
|
+
*
|
|
212
|
+
* Args:
|
|
213
|
+
* input: rules, rule bindings, the inventory, the sealed facts and the
|
|
214
|
+
* catalog.
|
|
215
|
+
*
|
|
216
|
+
* Returns:
|
|
217
|
+
* BusinessRuleEvaluation: config errors plus every case result, sorted
|
|
218
|
+
* by rule id then case id.
|
|
219
|
+
*
|
|
220
|
+
* Throws:
|
|
221
|
+
* UsageError: when a rule names a `subject` the inventory cannot see
|
|
222
|
+
* (exit 2 — a silently uncheckable name is a configuration error, the
|
|
223
|
+
* same posture as an unknown coverage table).
|
|
224
|
+
*/
|
|
225
|
+
export function gradeBusinessRules(input) {
|
|
226
|
+
const evaluation = evaluateBusinessRules({
|
|
227
|
+
rules: input.rules,
|
|
228
|
+
bindings: businessRuleBindingsOf(input.ruleBindings, catalogRunnerIndex(input.catalog), mockedTestKeys(input.catalog)),
|
|
229
|
+
inventory: input.inventory,
|
|
230
|
+
runFacts: input.runFacts,
|
|
231
|
+
});
|
|
232
|
+
if (evaluation.configErrors.length > 0) {
|
|
233
|
+
const first = evaluation.configErrors[0];
|
|
234
|
+
throw new UsageError(`${first?.detail ?? 'a business rule names an unknown subject'}${evaluation.configErrors.length > 1
|
|
235
|
+
? ` (and ${String(evaluation.configErrors.length - 1)} more business-rule configuration error(s))`
|
|
236
|
+
: ''}`);
|
|
237
|
+
}
|
|
238
|
+
return evaluation;
|
|
239
|
+
}
|
|
240
|
+
/** One case result projected onto the report's blocking-entry shape. */
|
|
241
|
+
function blockingEntryOf(result) {
|
|
242
|
+
const finding = result.finding;
|
|
243
|
+
return {
|
|
244
|
+
kind: 'finding',
|
|
245
|
+
resourceId: null,
|
|
246
|
+
name: result.ruleId,
|
|
247
|
+
detail: finding?.detail ?? '',
|
|
248
|
+
location: null,
|
|
249
|
+
cause: finding?.cause ?? 'BUSINESS_RULE_TEST_MISSING',
|
|
250
|
+
nextAction: finding?.nextAction ?? '',
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Splits a graded evaluation into the report's TWO channels.
|
|
255
|
+
*
|
|
256
|
+
* `enforcement: advisory` is decided by the OWNER's declaration on the
|
|
257
|
+
* rule, not by how bad the case looks: an advisory rule's findings are
|
|
258
|
+
* printed and serialized every run and only stay out of `blocking` and
|
|
259
|
+
* the exit code (plan invariant 7). The codes are identical in both
|
|
260
|
+
* channels, so a reader tells an advisory finding from a blocking one by
|
|
261
|
+
* where it is, never by a new severity.
|
|
262
|
+
*/
|
|
263
|
+
export function partitionBusinessRuleEntries(rules, cases) {
|
|
264
|
+
const enforcement = new Map(rules.map((rule) => [rule.id, rule.enforcement]));
|
|
265
|
+
const blocking = [];
|
|
266
|
+
const advisories = [];
|
|
267
|
+
for (const result of cases) {
|
|
268
|
+
if (result.finding === null)
|
|
269
|
+
continue;
|
|
270
|
+
const entry = blockingEntryOf(result);
|
|
271
|
+
if (enforcement.get(result.ruleId) === 'advisory')
|
|
272
|
+
advisories.push(entry);
|
|
273
|
+
else
|
|
274
|
+
blocking.push(entry);
|
|
275
|
+
}
|
|
276
|
+
return { blocking, advisories };
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* The resource names one run's inventory offers as a rule `subject`.
|
|
280
|
+
* Ranking and display only — a subject is never proof, and a rule
|
|
281
|
+
* without one is graded regardless of this list.
|
|
282
|
+
*/
|
|
283
|
+
export function businessRuleInventory(graph) {
|
|
284
|
+
return [
|
|
285
|
+
...new Set(graph.resources.flatMap((resource) => (resource.name === null ? [] : [resource.name]))),
|
|
286
|
+
].sort();
|
|
287
|
+
}
|
|
288
|
+
/**
|
|
289
|
+
* Serializes every graded rule case for the report's `businessRules`
|
|
290
|
+
* section (plan §7.5, invariant 6): a SATISFIED case must be visible
|
|
291
|
+
* naming the channel that proved it — "satisfied" read as "the rule
|
|
292
|
+
* holds" is exactly the overclaim the channel naming exists to prevent —
|
|
293
|
+
* and a demoted (advisory) case appears here beside its advisory-channel
|
|
294
|
+
* entry, so the section is the one place that lists EVERY case with its
|
|
295
|
+
* status. The section rides the json document only when rules are
|
|
296
|
+
* declared, so a repository without the feature keeps its exact report.
|
|
297
|
+
*
|
|
298
|
+
* Args:
|
|
299
|
+
* rules: the owner's declared rules (status and channel context).
|
|
300
|
+
* cases: the graded case results, sorted by rule id then case id.
|
|
301
|
+
*
|
|
302
|
+
* Returns:
|
|
303
|
+
* BusinessRuleReportEntry[]: the serialized cases, input order.
|
|
304
|
+
*/
|
|
305
|
+
export function businessRuleReportEntries(rules, cases) {
|
|
306
|
+
const typeOf = new Map(rules.map((rule) => [rule.id, rule.test]));
|
|
307
|
+
const enforcementOf = new Map(rules.map((rule) => [rule.id, rule.enforcement]));
|
|
308
|
+
return cases.map((result) => ({
|
|
309
|
+
ruleId: result.ruleId,
|
|
310
|
+
caseId: result.caseId,
|
|
311
|
+
test: typeOf.get(result.ruleId) ?? 'e2e',
|
|
312
|
+
enforcement: enforcementOf.get(result.ruleId) ?? 'block',
|
|
313
|
+
status: result.status,
|
|
314
|
+
channel: result.channel,
|
|
315
|
+
mappedTests: result.mappedTests,
|
|
316
|
+
finding: result.finding === null
|
|
317
|
+
? null
|
|
318
|
+
: {
|
|
319
|
+
cause: result.finding.cause,
|
|
320
|
+
detail: result.finding.detail,
|
|
321
|
+
nextAction: result.finding.nextAction,
|
|
322
|
+
tests: result.finding.tests,
|
|
323
|
+
},
|
|
324
|
+
}));
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* The `next` guidance for the run's rule findings (plan D6, §7.2): one
|
|
328
|
+
* block per graded case that carries a finding — the rule title, the
|
|
329
|
+
* case describe, the declared proof type — and, for a case with NO
|
|
330
|
+
* mapped test, the printed starter test (the type table's `starter`
|
|
331
|
+
* field picks the template: a Playwright test on the Gateforge fixture
|
|
332
|
+
* for `e2e`, a pytest function for `pytest`) plus the exact
|
|
333
|
+
* `tests mark --rule` line that maps it once written. A case that IS
|
|
334
|
+
* mapped gets the finding statement only: its gap is proof, not a
|
|
335
|
+
* missing declaration, and inventing a second mark line would steer the
|
|
336
|
+
* owner to map a duplicate instead of running the gate.
|
|
337
|
+
*
|
|
338
|
+
* Pure text; `next` prints these lines for EVERY finding case (§7.2:
|
|
339
|
+
* two starter tests and two mark lines for a two-case rule), not only
|
|
340
|
+
* for the top-ranked candidate.
|
|
341
|
+
*/
|
|
342
|
+
export function businessRuleGuidanceLines(rules, cases) {
|
|
343
|
+
const lines = [];
|
|
344
|
+
for (const result of cases) {
|
|
345
|
+
if (result.finding === null)
|
|
346
|
+
continue;
|
|
347
|
+
const rule = rules.find((entry) => entry.id === result.ruleId);
|
|
348
|
+
if (rule === undefined)
|
|
349
|
+
continue;
|
|
350
|
+
const businessCase = casesOf(rule).find((entry) => entry.id === result.caseId);
|
|
351
|
+
const describe = businessCase?.describe ?? result.caseId;
|
|
352
|
+
const row = BUSINESS_RULE_TYPE_TABLE[rule.test];
|
|
353
|
+
lines.push(`business rule '${rule.id}' case '${result.caseId}' needs a '${row.label}' test ` +
|
|
354
|
+
`(${row.acceptedKinds.join(' or ')} under runner '${row.runner}') — ${rule.title}`);
|
|
355
|
+
if (result.status !== 'unmapped')
|
|
356
|
+
continue;
|
|
357
|
+
if (row.starter === 'playwright') {
|
|
358
|
+
const title = `business rule ${rule.id}: ${describe}`;
|
|
359
|
+
const file = `e2e/${rule.id}.spec.mjs`;
|
|
360
|
+
lines.push(` starter (the fixture's page is what routes the journey through the witness):`);
|
|
361
|
+
lines.push(` import { test, expect } from '@gate-forge/pack-playwright/fixture';`);
|
|
362
|
+
lines.push(` test('${title}', async ({ page }) => {`);
|
|
363
|
+
lines.push(` // Prove "${rule.title}" — ${describe}`);
|
|
364
|
+
lines.push(` });`);
|
|
365
|
+
lines.push(` then map it: gateforge tests mark --rule ${rule.id}/${result.caseId}` +
|
|
366
|
+
` --test '${file}#${title}' --kind ${row.acceptedKinds[0] ?? 'browser-e2e'}` +
|
|
367
|
+
` --reason 'asserts ${rule.id}/${result.caseId} in the real app'`);
|
|
368
|
+
}
|
|
369
|
+
else {
|
|
370
|
+
const slug = (value) => value.replace(/[^a-z0-9]+/g, '_');
|
|
371
|
+
const pytestName = `test_business_rule_${slug(rule.id)}_${slug(result.caseId)}`;
|
|
372
|
+
const file = `tests/test_${slug(rule.id)}.py`;
|
|
373
|
+
lines.push(` starter (inside the WITNESSED pytest suite the run supervises):`);
|
|
374
|
+
lines.push(` def ${pytestName}():`);
|
|
375
|
+
lines.push(` """Prove "${rule.title}" — ${describe}."""`);
|
|
376
|
+
lines.push(` then map it: gateforge tests mark --rule ${rule.id}/${result.caseId}` +
|
|
377
|
+
` --test '${file}#${pytestName}' --kind ${row.acceptedKinds[0] ?? 'unit'}` +
|
|
378
|
+
` --reason 'asserts ${rule.id}/${result.caseId} in the witnessed suite'`);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return lines;
|
|
382
|
+
}
|
|
383
|
+
//# sourceMappingURL=business-rules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"business-rules.js","sourceRoot":"","sources":["../src/business-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,OAAO,EACL,wBAAwB,EACxB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AAI,MAAM,EAAE;gBAC1E,sBAAsB,IAAI,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,0BAA0B,CAC3E,CAAC;QACJ,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC;AACf,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 [--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
|
|
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 [--family pages [--confirm]] adopt enforcement: seed the baseline from current debt (the one bulk-add) + wire the gate;\n --family pages previews the pages-family migration of an ALREADY-adopted repo,\n --confirm records it (one atomic receipt write)\n discover [--json] run detectors and dump the resource graph\n classify [--json] [--write-snapshot P] inspect effective classifications + typed blocks\n classify plane <src> <plane> --reason T [--confirm]\n declare the data plane for a file, folder, or glob (preview without --confirm)\n classify delete <src> <hard|archive> [--archive-field k=v]... --reason T [--confirm]\n declare how removal manifests for a file, folder, or glob\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 enforcement pin --pin-file PATH [--confirm] write the STAGED revision's approved policy digest into an env file\n OUTSIDE the repo (mode 0600); preview by default (NOT --env-file: node owns it)\n baseline update <fp...> shrink the baseline to a strict subset (invariant 4);\n [--classification-blocked <id>]... / [--family-pages <fp>]... shrink the receipt's adopted layers\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 migrate [--confirm] move owner declarations into .gateforge.yml (evidence.exclude.docs|cache);\n preview by default, idempotent, re-pin reminder on write\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;AA0BlC,4DAA4D;AAC5D,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AA0BlC,4DAA4D;AAC5D,eAAO,MAAM,KAAK,2lNAwEyD,CAAC;AAE5E;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,GAAE,EAAgB,GACnB,OAAO,CAAC,MAAM,CAAC,CAsEjB"}
|
package/dist/cli.js
CHANGED
|
@@ -46,7 +46,9 @@ commands:
|
|
|
46
46
|
pre-commit hook + CI wiring)
|
|
47
47
|
enforce [--ci github|gitlab] [--witnessed] wire the blocking pre-commit + CI gate into an initialized repo (idempotent);
|
|
48
48
|
--witnessed also writes the witnessed 'gateforge run' job template
|
|
49
|
-
adopt
|
|
49
|
+
adopt [--family pages [--confirm]] adopt enforcement: seed the baseline from current debt (the one bulk-add) + wire the gate;
|
|
50
|
+
--family pages previews the pages-family migration of an ALREADY-adopted repo,
|
|
51
|
+
--confirm records it (one atomic receipt write)
|
|
50
52
|
discover [--json] run detectors and dump the resource graph
|
|
51
53
|
classify [--json] [--write-snapshot P] inspect effective classifications + typed blocks
|
|
52
54
|
classify plane <src> <plane> --reason T [--confirm]
|
|
@@ -86,7 +88,8 @@ commands:
|
|
|
86
88
|
trusted binary/policy ownership, snapshot mode, standard/managed boundary
|
|
87
89
|
enforcement pin --pin-file PATH [--confirm] write the STAGED revision's approved policy digest into an env file
|
|
88
90
|
OUTSIDE the repo (mode 0600); preview by default (NOT --env-file: node owns it)
|
|
89
|
-
baseline update <fp...> shrink the baseline to a strict subset (invariant 4)
|
|
91
|
+
baseline update <fp...> shrink the baseline to a strict subset (invariant 4);
|
|
92
|
+
[--classification-blocked <id>]... / [--family-pages <fp>]... shrink the receipt's adopted layers
|
|
90
93
|
baseline diff <before> <after> compare adopted obligations by ID without printing fingerprints
|
|
91
94
|
waive <resourceId:contract> write an expiring, owner-approved waiver for one obligation
|
|
92
95
|
--owner N --approver N (GF-15: all fields mandatory; justification URL required;
|
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,EA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ACR,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,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,SAAS;YACZ,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;QAC/E,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"}
|
package/dist/commands/adopt.d.ts
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import type { Io } from '../io.js';
|
|
2
|
-
export declare const ADOPT_USAGE = "usage: gateforge adopt";
|
|
2
|
+
export declare const ADOPT_USAGE = "usage: gateforge adopt [--family pages [--confirm]]";
|
|
3
3
|
/**
|
|
4
4
|
* What `gateforge adopt --help` prints. The command used to print only
|
|
5
5
|
* its usage line, so its whole contract — what it forgives, for how
|
|
6
6
|
* long, and the one case where an adopted obligation still blocks —
|
|
7
7
|
* existed only in the source file.
|
|
8
8
|
*/
|
|
9
|
-
export declare const ADOPT_HELP = "usage: gateforge adopt\n\nAdopts an EXISTING repository: run it once, after `gateforge init`, on a\nproject that already has code and therefore already has findings.\n\n what it records \u2014 the currently-blocking findings: unsatisfied\n obligation fingerprints (pin #2) plus every blocking entry, and, as a\n second layer, the classification-blocked resource identities. They go\n into .gateforge/baselines/obligations.json, sanctioned by a dated,\n count-annotated receipt (.gateforge/baselines/adoption.json). Without\n that receipt a baseline forgives nothing.\n\n shrink-only \u2014 the recorded set never grows on its own. It is the one\n sanctioned bulk-add this engine performs, and only once per repository:\n a second `adopt` is a no-op success. Resolve debt and shrink it with\n `gateforge baseline update`; new (never-adopted) work is never\n baselined and keeps blocking (`check` exits 1).\n\n strictE2E \u2014 with `enforcement.strictE2E: true` a baselined E2E\n obligation is NOT proof. It blocks with ENFORCEMENT_UNTRUSTED again\n as soon as a change touches what it proves. A change set that carries\n no product behaviour at all \u2014 tests, the mapping sidecar, runner\n configuration \u2014 keeps the adopted debt forgiven under the default\n `enforcement.adoptedDebt: lenient`; declare `strict` to re-grade it\n on every commit after this one.\n\n wiring \u2014 after recording, it applies the blocking wiring (pre-commit\n hook block + CI template) through the same idempotent path as\n `gateforge init --blocking`.\n\n plane-ordered \u2014 adoption refuses (exit 2, nothing written) while\n any blocking entry is plane-unresolved: a plane answer changes\n the resource's identity, so debt adopted before the answer\n would not match after it. Answer the planes first\n (`gateforge classify plane <folder> <tenant|master|global> --confirm`).\n\nExit codes: 0 adopted (or an idempotent no-op), 2 config/usage or a plane-unresolved resource (R1-9).";
|
|
9
|
+
export declare const ADOPT_HELP = "usage: gateforge adopt [--family pages [--confirm]]\n\nAdopts an EXISTING repository: run it once, after `gateforge init`, on a\nproject that already has code and therefore already has findings.\n\n what it records \u2014 the currently-blocking findings: unsatisfied\n obligation fingerprints (pin #2) plus every blocking entry, and, as a\n second layer, the classification-blocked resource identities. They go\n into .gateforge/baselines/obligations.json, sanctioned by a dated,\n count-annotated receipt (.gateforge/baselines/adoption.json). Without\n that receipt a baseline forgives nothing.\n\n shrink-only \u2014 the recorded set never grows on its own. It is the one\n sanctioned bulk-add this engine performs, and only once per repository:\n a second `adopt` is a no-op success. Resolve debt and shrink it with\n `gateforge baseline update`; new (never-adopted) work is never\n baselined and keeps blocking (`check` exits 1).\n\n strictE2E \u2014 with `enforcement.strictE2E: true` a baselined E2E\n obligation is NOT proof. It blocks with ENFORCEMENT_UNTRUSTED again\n as soon as a change touches what it proves. A change set that carries\n no product behaviour at all \u2014 tests, the mapping sidecar, runner\n configuration \u2014 keeps the adopted debt forgiven under the default\n `enforcement.adoptedDebt: lenient`; declare `strict` to re-grade it\n on every commit after this one.\n\n wiring \u2014 after recording, it applies the blocking wiring (pre-commit\n hook block + CI template) through the same idempotent path as\n `gateforge init --blocking`.\n\n plane-ordered \u2014 adoption refuses (exit 2, nothing written) while\n any blocking entry is plane-unresolved: a plane answer changes\n the resource's identity, so debt adopted before the answer\n would not match after it. Answer the planes first\n (`gateforge classify plane <folder> <tenant|master|global> --confirm`).\n\n families \u2014 `gateforge adopt --family pages` revises an ALREADY-adopted\n repository (an unadopted one is told to run plain `adopt` first; the\n family path never seeds a receipt). Preview by default \u2014 it prints what\n WOULD be recorded and writes nothing. `--confirm` performs ONE atomic\n write to .gateforge/baselines/adoption.json: a dated, commit-referenced\n `families.pages` marker recording EVERY page obligation discovered at\n that moment (proven pages included), with only the then-missing/unproven\n page fingerprints marked forgiven. The baseline document is never\n touched, so a crash cannot expose unrecorded forgiveness; the evaluator\n forgives the family's `forgiven` set from the receipt alone. The marker\n is permanent: a repeat records nothing (new pages are new work to\n prove), and the family debt shrinks through `gateforge baseline update\n --family-pages <fingerprint>...` (`--family-pages=` keeps none) while\n the marker is retained. Page routes with an unresolved audience or data\n plane refuse the migration (exit 2, nothing written) \u2014 declare each\n audience in .gateforge.yml pages.audiences with an explicit plane\n (`plane: tenant|master|global`; an audience name is a role, not a\n plane). Because the receipt is part of the approved policy revision,\n a confirmed migration changes the trusted-policy digest: strict gates\n stay untrusted until the owner repins the revision OUTSIDE the\n candidate (`gateforge enforcement pin`, the approved-digest env var,\n or the trusted config). A plain `adopt` on a repo with `pages:`\n configured records the family marker in the receipt it already writes,\n so the family is then already adopted.\n\nExit codes: 0 adopted (or an idempotent no-op), 2 config/usage or a plane-unresolved resource (R1-9).";
|
|
10
10
|
/**
|
|
11
11
|
* Runs the adopt subcommand.
|
|
12
12
|
*
|
|
13
13
|
* Args:
|
|
14
14
|
* io: process context.
|
|
15
|
-
* argv: flags after the subcommand (
|
|
15
|
+
* argv: flags after the subcommand: bare (the one bulk-add),
|
|
16
|
+
* `--family pages` (family migration preview), or `--family pages
|
|
17
|
+
* --confirm` (the migration itself). `--help` prints the contract.
|
|
16
18
|
*
|
|
17
19
|
* Returns:
|
|
18
20
|
* number: exit code — 0 adopted (or idempotent no-op), 2 config/usage
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"adopt.d.ts","sourceRoot":"","sources":["../../src/commands/adopt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"adopt.d.ts","sourceRoot":"","sources":["../../src/commands/adopt.ts"],"names":[],"mappings":"AA8EA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAanC,eAAO,MAAM,WAAW,wDAAwD,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MAAM,UAAU,uqHA6D+E,CAAC;AAWvG;;;;;;;;;;;;;GAaG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA6BnF"}
|