@gate-forge/cli 0.16.0 → 0.18.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 +99 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/behavior.d.ts +26 -0
- package/dist/commands/behavior.d.ts.map +1 -0
- package/dist/commands/behavior.js +102 -0
- package/dist/commands/behavior.js.map +1 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +17 -1
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/coverage.d.ts +17 -0
- package/dist/commands/coverage.d.ts.map +1 -0
- package/dist/commands/coverage.js +78 -0
- package/dist/commands/coverage.js.map +1 -0
- package/dist/commands/disposition.d.ts +2 -2
- package/dist/commands/disposition.d.ts.map +1 -1
- package/dist/commands/disposition.js +114 -5
- package/dist/commands/disposition.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +1 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/endpoint-compiler.d.ts.map +1 -1
- package/dist/endpoint-compiler.js +100 -15
- package/dist/endpoint-compiler.js.map +1 -1
- package/dist/endpoint-config.d.ts +53 -5
- package/dist/endpoint-config.d.ts.map +1 -1
- package/dist/endpoint-config.js +63 -10
- package/dist/endpoint-config.js.map +1 -1
- package/dist/evaluate.d.ts +24 -0
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +59 -0
- package/dist/evaluate.js.map +1 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +24 -6
- package/dist/pipeline.js.map +1 -1
- package/dist/repo-scan.js +1 -1
- package/dist/repo-scan.js.map +1 -1
- package/guides/QUICKSTART.md +5 -5
- package/guides/REFERENCE.md +72 -8
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,104 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.18.0
|
|
4
|
+
|
|
5
|
+
- **Fixed: the run-wide complete-scan check counts only files a detector
|
|
6
|
+
can read.** With no detector selected, the run-wide branch scoped
|
|
7
|
+
coverage to every requested file, so unruled non-code files inside the
|
|
8
|
+
scan roots (README, lock files, images) were "coverage gaps" and the
|
|
9
|
+
run could never attest a complete scan. The run-wide branch now scopes
|
|
10
|
+
to the pipeline-reported detector input set (`eligiblePaths`), exactly
|
|
11
|
+
the scoping `exposureCoverageHolds` already applied, and stays
|
|
12
|
+
fail-closed when that set is absent: every requested path stays in
|
|
13
|
+
scope, and a detector-eligible file no rule claims is still a hole.
|
|
14
|
+
- **Added: declared route→resource links — a `resource:` key on the
|
|
15
|
+
`endpoints.rules` entries of `.gateforge/classification-policy.yml`.**
|
|
16
|
+
The reference documentation told owners to "declare the missing
|
|
17
|
+
mapping", but no such key parsed. A matching rule's `resource` must
|
|
18
|
+
equal a discovered business resource EXACTLY and links the endpoint
|
|
19
|
+
INSTEAD of the path-derived name guess, clearing
|
|
20
|
+
`ENDPOINT_RESOURCE_CANDIDATE_UNMATCHED` and
|
|
21
|
+
`ENDPOINT_RESOURCE_LINK_UNRESOLVED` for the declared route so it stops
|
|
22
|
+
failing the run-wide complete-scan proof. An unknown name is a blocking
|
|
23
|
+
`ENDPOINT_RESOURCE_DECLARATION_UNMATCHED` entry naming the rule and the
|
|
24
|
+
closest discovered names; matching rules naming different resources are
|
|
25
|
+
a blocking `ENDPOINT_RESOURCE_DECLARATION_CONTRADICTION` that links
|
|
26
|
+
nothing — never first-rule-wins. `capability` is optional exactly when
|
|
27
|
+
`resource` is present (every rule carries at least one of the two, plus
|
|
28
|
+
a `reason`); the unmatched entry's detail text names the new channel;
|
|
29
|
+
with no `resource` anywhere the compiled output is unchanged.
|
|
30
|
+
- **Fixed: the exact-value echo check treats two timestamps naming the
|
|
31
|
+
same instant as equal.** Echo comparisons compared canonical JSON
|
|
32
|
+
strings, so a record sent as `"2026-01-01T09:33:00.000Z"` and read back
|
|
33
|
+
as `"2026-01-01T09:33:00Z"` graded `EVIDENCE_VALUE_MISMATCH`. When BOTH
|
|
34
|
+
values are full RFC 3339 date-times with an explicit offset, their
|
|
35
|
+
instants are compared; everything else (date-only strings, offset-less
|
|
36
|
+
date-times, values a real time amount apart, non-timestamp strings)
|
|
37
|
+
keeps the existing string equality. No tolerance window.
|
|
38
|
+
- **Fixed: the exact-value echo compares a JSON number and a decimal
|
|
39
|
+
string as exact decimals.** A journey that entered `deduction_amount`
|
|
40
|
+
as the number `0` failed the echo because the persisted read carried
|
|
41
|
+
the string `"0.00"` — the same value in two spellings. When one side
|
|
42
|
+
is a JSON number and the other a plain decimal string, both are
|
|
43
|
+
normalised to sign + integer digits + fraction digits with trailing
|
|
44
|
+
zeros stripped and compared exactly: no float conversion of the
|
|
45
|
+
string, no tolerance window. `0.1` vs `"0.10000001"`, exponent forms
|
|
46
|
+
(`"1e2"` on the string, a number whose shortest string is `1e-7`),
|
|
47
|
+
`"NaN"`/`"Infinity"`, the empty string and a leading `+` stay
|
|
48
|
+
mismatches, and number-vs-number / string-vs-string keep the exact
|
|
49
|
+
rule.
|
|
50
|
+
|
|
51
|
+
## 0.17.0
|
|
52
|
+
|
|
53
|
+
- **Changed: an active disposition excuses matching rule obligations.**
|
|
54
|
+
An active `behavior.yml` `out-of-scope` disposition withholds every
|
|
55
|
+
policies.yml obligation for that endpoint. An active `coveragePolicy`
|
|
56
|
+
disposition withholds `persistence:*` obligations for that table.
|
|
57
|
+
Expired dispositions excuse nothing (`DISPOSITION_EXPIRED` still
|
|
58
|
+
blocks). `operational-only` is unchanged (transport case only).
|
|
59
|
+
Excused obligations are listed in the check report and by
|
|
60
|
+
`disposition list` with the owner reason; they are not silently
|
|
61
|
+
dropped. `policies.yml` and its schema are unchanged.
|
|
62
|
+
- **Added: `gateforge behavior draft [--json]`.** Read-only paste-ready
|
|
63
|
+
`behavior.yml` body: one entry per discovered `http.endpoint`, sorted,
|
|
64
|
+
each with `cases` commented out and a TODO. Header: owner review
|
|
65
|
+
required; pasting it is the owner act; repin afterwards. Never writes.
|
|
66
|
+
An undeclared endpoint stays `ENDPOINT_BEHAVIOR_MISSING`.
|
|
67
|
+
- **Added: one disposition shape and `gateforge disposition list [--json]`.**
|
|
68
|
+
Behavior and coverage dispositions share `{ kind, reason, expiresAt? }`
|
|
69
|
+
with per-surface kind subsets. Coverage `note` still loads for one
|
|
70
|
+
release (mapped onto `reason`) and `gateforge check` warns. A non-`other`
|
|
71
|
+
coverage disposition that recorded no reason still loads and warns on
|
|
72
|
+
that same channel that `reason` will be required. `disposition list` is
|
|
73
|
+
read-only: surface, id, kind, reason, expiresAt, state.
|
|
74
|
+
- **Changed: `operational-only` is legal on real health/ops routes.** A
|
|
75
|
+
route positively marked health/ops (a `health-operations` capability, or
|
|
76
|
+
a path `/health/*`, `/ops/*`, `/metrics`, the same roots under `/api`,
|
|
77
|
+
a depth-capped probe path, or `/`) may carry `operational-only` even with
|
|
78
|
+
a transport capability
|
|
79
|
+
(`crud-create`, `file-transfer`, `workflow-command`), as long as it has
|
|
80
|
+
no business-resource link. A business link, or any unmarked route, stays
|
|
81
|
+
illegal.
|
|
82
|
+
|
|
83
|
+
- **Added: strict E2E refuses a missing coverage policy, and `gateforge
|
|
84
|
+
coverage draft` prints the owner's starting point.** With
|
|
85
|
+
`enforcement.strictE2E: true`, an absent or empty owner
|
|
86
|
+
`coveragePolicy` section adds exactly ONE setup-wide blocking
|
|
87
|
+
`COVERAGE_POLICY_ABSENT` entry (never diff-narrowed, like the strict
|
|
88
|
+
preflight) naming how many user-facing tables the current inventory
|
|
89
|
+
would have to declare, with the next action `gateforge coverage draft`.
|
|
90
|
+
The owner-written policy is the one gate input derived from the owner's
|
|
91
|
+
list instead of the code, so a strict setup without it could previously
|
|
92
|
+
go green by deleting the guarded code ("delete the feature to pass").
|
|
93
|
+
The new read-only command `gateforge coverage draft [--json]` prints a
|
|
94
|
+
paste-ready `coveragePolicy:` block — one entry per user-facing table,
|
|
95
|
+
`requiredOperations` = that table's lifecycle-enabled operations,
|
|
96
|
+
sorted by name — that always parses through `CoveragePolicySchema`; it
|
|
97
|
+
never writes any file, because pasting the policy is the owner's act.
|
|
98
|
+
With strict E2E off the section stays opt-in and its absence stays
|
|
99
|
+
silent (byte-identical behaviour). `init`'s scan output now says the
|
|
100
|
+
section is required under strictE2E and names the draft command.
|
|
101
|
+
|
|
3
102
|
## 0.16.0
|
|
4
103
|
|
|
5
104
|
- **Added: expiring owner dispositions and `gateforge disposition
|
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 [--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|obligationId> [--json]\n full signal/rule/obligation trace for one resource or obligation\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] [--hook-mutation] 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 disposition extend <endpoint-id|table> rewrite one owner disposition's expiresAt and record the\n --owner N --reason \"T\" extension in its extensions audit list (never pins; the\n --expires D digest/pin flow applies to the edited policy)\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";
|
|
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|obligationId> [--json]\n full signal/rule/obligation trace for one resource or obligation\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 coverage draft [--json] print the owner coveragePolicy draft from the current inventory\n (never writes; the owner reviews, pastes, repins)\n behavior draft [--json] print the owner behavior.yml draft from the discovered endpoints,\n each entry's cases commented out with a TODO (never writes;\n the owner reviews, fills the real cases in, pastes, repins)\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] [--hook-mutation] 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 disposition extend <endpoint-id|table> rewrite one owner disposition's expiresAt and record the\n --owner N --reason \"T\" extension in its extensions audit list (never pins; the\n --expires D digest/pin flow applies to the edited policy)\n disposition list [--json] every disposition the behaviorPolicy and coveragePolicy\n documents declare, with surface, id, kind, reason,\n expiresAt and the judged state \u2014 read-only\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;
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AA8BlC,4DAA4D;AAC5D,eAAO,MAAM,KAAK,utPAoFyD,CAAC;AAE5E;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,GAAE,EAAgB,GACnB,OAAO,CAAC,MAAM,CAAC,CA8EjB"}
|
package/dist/cli.js
CHANGED
|
@@ -16,6 +16,8 @@ import { enforceCommand } from './commands/enforce.js';
|
|
|
16
16
|
import { adoptCommand } from './commands/adopt.js';
|
|
17
17
|
import { discoverCommand } from './commands/discover.js';
|
|
18
18
|
import { obligationsCommand } from './commands/obligations.js';
|
|
19
|
+
import { coverageCommand } from './commands/coverage.js';
|
|
20
|
+
import { behaviorCommand } from './commands/behavior.js';
|
|
19
21
|
import { checkCommand } from './commands/check.js';
|
|
20
22
|
import { nextCommand } from './commands/next.js';
|
|
21
23
|
import { configCommand } from './commands/config.js';
|
|
@@ -71,6 +73,11 @@ commands:
|
|
|
71
73
|
[--probe --base-url URL] with the app running: one read-only GET per adapter
|
|
72
74
|
[--probe-id ID]
|
|
73
75
|
obligations [--json] evaluate policies and dump obligations
|
|
76
|
+
coverage draft [--json] print the owner coveragePolicy draft from the current inventory
|
|
77
|
+
(never writes; the owner reviews, pastes, repins)
|
|
78
|
+
behavior draft [--json] print the owner behavior.yml draft from the discovered endpoints,
|
|
79
|
+
each entry's cases commented out with a TODO (never writes;
|
|
80
|
+
the owner reviews, fills the real cases in, pastes, repins)
|
|
74
81
|
history [--test TEXT] [--failed] [--since ISO] query retained supervised run history
|
|
75
82
|
check [--changed] [--staged] [--candidate-commit SHA] run the gate against all files, the exact frozen
|
|
76
83
|
index, or the selected immutable commit tree; --changed narrows the selected candidate's diff;
|
|
@@ -103,6 +110,9 @@ commands:
|
|
|
103
110
|
disposition extend <endpoint-id|table> rewrite one owner disposition's expiresAt and record the
|
|
104
111
|
--owner N --reason "T" extension in its extensions audit list (never pins; the
|
|
105
112
|
--expires D digest/pin flow applies to the edited policy)
|
|
113
|
+
disposition list [--json] every disposition the behaviorPolicy and coveragePolicy
|
|
114
|
+
documents declare, with surface, id, kind, reason,
|
|
115
|
+
expiresAt and the judged state — read-only
|
|
106
116
|
run [--] [test-gates flags] the whole local proof in order: doctor preflight (strict), the optional
|
|
107
117
|
.gateforge/runtime.yml recipe (reset/seed/up/health), the supervised
|
|
108
118
|
test-gates, check --require-e2e, and the recipe's teardown — one line
|
|
@@ -159,6 +169,10 @@ export async function main(argv, io = processIo()) {
|
|
|
159
169
|
return runWithExitCodes(io, () => adaptersCommand(io, rest));
|
|
160
170
|
case 'obligations':
|
|
161
171
|
return runWithExitCodes(io, () => obligationsCommand(io, rest));
|
|
172
|
+
case 'coverage':
|
|
173
|
+
return runWithExitCodes(io, () => coverageCommand(io, rest));
|
|
174
|
+
case 'behavior':
|
|
175
|
+
return runWithExitCodes(io, () => behaviorCommand(io, rest));
|
|
162
176
|
case 'check':
|
|
163
177
|
return runWithExitCodes(io, () => checkCommand(io, rest));
|
|
164
178
|
case 'next':
|
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,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Aa;YAChB,OAAO,gBAAgB,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC,CAAC;QAClE;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,26 @@
|
|
|
1
|
+
import type { Io } from '../io.js';
|
|
2
|
+
export declare const BEHAVIOR_USAGE = "usage: gateforge behavior draft [--json]";
|
|
3
|
+
/**
|
|
4
|
+
* Runs the pipeline read-only and returns the discovered endpoint ids,
|
|
5
|
+
* sorted (deterministic draft order).
|
|
6
|
+
*
|
|
7
|
+
* Args:
|
|
8
|
+
* io: process context (cwd runs the pipeline, env feeds providers).
|
|
9
|
+
*
|
|
10
|
+
* Returns:
|
|
11
|
+
* string[]: every discovered `http.endpoint` resource id, sorted.
|
|
12
|
+
*/
|
|
13
|
+
export declare function behaviorDraftEndpointIds(io: Io): Promise<string[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Runs the behavior subcommand.
|
|
16
|
+
*
|
|
17
|
+
* Args:
|
|
18
|
+
* io: process context.
|
|
19
|
+
* argv: tokens after the subcommand (`draft` positionals + flags).
|
|
20
|
+
*
|
|
21
|
+
* Returns:
|
|
22
|
+
* number: exit code (0 on success).
|
|
23
|
+
* @throws UsageError (exit 2) for an unknown subcommand/flag.
|
|
24
|
+
*/
|
|
25
|
+
export declare function behaviorCommand(io: Io, argv: readonly string[]): Promise<number>;
|
|
26
|
+
//# sourceMappingURL=behavior.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"behavior.d.ts","sourceRoot":"","sources":["../../src/commands/behavior.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAOnC,eAAO,MAAM,cAAc,6CAA6C,CAAC;AAWzE;;;;;;;;;GASG;AACH,wBAAsB,wBAAwB,CAAC,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAaxE;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAmCtF"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `gateforge behavior draft`: print a paste-ready `behavior.yml` body
|
|
3
|
+
* derived from the current endpoint inventory (plan 2026-10-18) — one
|
|
4
|
+
* entry per discovered `http.endpoint`, sorted by resource id, each with
|
|
5
|
+
* its `cases` commented out and a TODO comment, because the cases are
|
|
6
|
+
* exactly the part no tool may invent.
|
|
7
|
+
*
|
|
8
|
+
* The command is strictly READ-ONLY: it never writes any file. Declaring
|
|
9
|
+
* behavior is the owner's act (GATEFORGE.md "Never self-approve") — an
|
|
10
|
+
* agent pasting the draft into `.gateforge/behavior.yml` would be
|
|
11
|
+
* self-approving the very guard meant to stop agent edits, so the draft
|
|
12
|
+
* only prints and the owner reviews, fills the real cases in, pastes,
|
|
13
|
+
* and repins. An undeclared endpoint keeps blocking with
|
|
14
|
+
* ENDPOINT_BEHAVIOR_MISSING until the owner declares it.
|
|
15
|
+
*
|
|
16
|
+
* `--json` prints the GF-canonical JSON of the draft document skeleton.
|
|
17
|
+
* Unlike the coverage draft, the skeleton is deliberately NOT parsed
|
|
18
|
+
* through `BehaviorPolicySchema` before printing: an entry with empty
|
|
19
|
+
* `cases` is invalid by design (in-scope endpoints require cases or an
|
|
20
|
+
* owner disposition), and the draft must show that honest, unfinished
|
|
21
|
+
* state instead of pretending it validates.
|
|
22
|
+
*/
|
|
23
|
+
import { canonicalJson, HTTP_ENDPOINT_RESOURCE_KIND } from '@gate-forge/core';
|
|
24
|
+
import { parseArgs } from '../args.js';
|
|
25
|
+
import { writeLine } from '../io.js';
|
|
26
|
+
import { UsageError } from '../errors.js';
|
|
27
|
+
import { runPipeline } from '../pipeline.js';
|
|
28
|
+
import { resolveStateDir } from '../state.js';
|
|
29
|
+
import { loadConfigAt, rejectUnknownFlags } from './common.js';
|
|
30
|
+
export const BEHAVIOR_USAGE = 'usage: gateforge behavior draft [--json]';
|
|
31
|
+
/** The header comment printed above every text draft. */
|
|
32
|
+
const DRAFT_HEADER = '# behavior draft — owner review required; pasting it is the owner act; repin afterwards';
|
|
33
|
+
/** The per-entry TODO the owner must answer before the document is valid. */
|
|
34
|
+
const ENTRY_TODO = '# TODO(owner): declare real behavior cases for this endpoint, or record an owner\n' +
|
|
35
|
+
'# disposition (kind: out-of-scope|operational-only — `reason` is required).';
|
|
36
|
+
/**
|
|
37
|
+
* Runs the pipeline read-only and returns the discovered endpoint ids,
|
|
38
|
+
* sorted (deterministic draft order).
|
|
39
|
+
*
|
|
40
|
+
* Args:
|
|
41
|
+
* io: process context (cwd runs the pipeline, env feeds providers).
|
|
42
|
+
*
|
|
43
|
+
* Returns:
|
|
44
|
+
* string[]: every discovered `http.endpoint` resource id, sorted.
|
|
45
|
+
*/
|
|
46
|
+
export async function behaviorDraftEndpointIds(io) {
|
|
47
|
+
const config = loadConfigAt(io.cwd);
|
|
48
|
+
const pipeline = await runPipeline({
|
|
49
|
+
cwd: io.cwd,
|
|
50
|
+
env: io.env,
|
|
51
|
+
config,
|
|
52
|
+
provider: 'all-files',
|
|
53
|
+
stateDir: resolveStateDir(io.cwd),
|
|
54
|
+
});
|
|
55
|
+
return pipeline.graph.resources
|
|
56
|
+
.filter((resource) => resource.kind === HTTP_ENDPOINT_RESOURCE_KIND && resource.id !== null)
|
|
57
|
+
.map((resource) => resource.id)
|
|
58
|
+
.sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Runs the behavior subcommand.
|
|
62
|
+
*
|
|
63
|
+
* Args:
|
|
64
|
+
* io: process context.
|
|
65
|
+
* argv: tokens after the subcommand (`draft` positionals + flags).
|
|
66
|
+
*
|
|
67
|
+
* Returns:
|
|
68
|
+
* number: exit code (0 on success).
|
|
69
|
+
* @throws UsageError (exit 2) for an unknown subcommand/flag.
|
|
70
|
+
*/
|
|
71
|
+
export async function behaviorCommand(io, argv) {
|
|
72
|
+
const { options, positionals } = parseArgs(argv);
|
|
73
|
+
if (options['help'] === true) {
|
|
74
|
+
writeLine(io.stdout, BEHAVIOR_USAGE);
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
rejectUnknownFlags(options, ['json', 'help'], BEHAVIOR_USAGE);
|
|
78
|
+
if (positionals[0] !== 'draft' || positionals.length !== 1) {
|
|
79
|
+
throw new UsageError(`behavior requires exactly one subcommand 'draft' (${BEHAVIOR_USAGE})`);
|
|
80
|
+
}
|
|
81
|
+
const asJson = options['json'] === true;
|
|
82
|
+
const endpointIds = await behaviorDraftEndpointIds(io);
|
|
83
|
+
if (asJson) {
|
|
84
|
+
const draft = {
|
|
85
|
+
schemaVersion: 1,
|
|
86
|
+
endpoints: endpointIds.map((resourceId) => ({ resourceId, effects: [], cases: [] })),
|
|
87
|
+
resources: [],
|
|
88
|
+
};
|
|
89
|
+
writeLine(io.stdout, canonicalJson(draft));
|
|
90
|
+
return 0;
|
|
91
|
+
}
|
|
92
|
+
const lines = [
|
|
93
|
+
DRAFT_HEADER,
|
|
94
|
+
'schemaVersion: 1',
|
|
95
|
+
'endpoints:',
|
|
96
|
+
...endpointIds.map((resourceId) => ` - resourceId: ${resourceId}\n effects: []\n${ENTRY_TODO}\n # cases: []`),
|
|
97
|
+
'resources: []',
|
|
98
|
+
];
|
|
99
|
+
writeLine(io.stdout, lines.join('\n'));
|
|
100
|
+
return 0;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=behavior.js.map
|
|
@@ -0,0 +1 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AAE;SACd,CAAC;QACF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,CAAC,KAA6B,CAAC,CAAC,CAAC;QACnE,OAAO,CAAC,CAAC;IACX,CAAC;IACD,MAAM,KAAK,GAAG;QACZ,YAAY;QACZ,kBAAkB;QAClB,YAAY;QACZ,GAAG,WAAW,CAAC,GAAG,CAChB,CAAC,UAAU,EAAE,EAAE,CACb,mBAAmB,UAAU,sBAAsB,UAAU,mBAAmB,CACnF;QACD,eAAe;KAChB,CAAC;IACF,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACvC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAwIA,OAAO,
|
|
1
|
+
{"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../../src/commands/check.ts"],"names":[],"mappings":"AAwIA,OAAO,EA2BL,KAAK,aAAa,EACnB,MAAM,kBAAkB,CAAC;AAc1B,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAyCnC,OAAO,EAA4B,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAqCvF,OAAO,EAA0B,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA0UnF,eAAO,MAAM,WAAW,QAM2F,CAAC;AAEpH,8EAA8E;AAC9E,MAAM,WAAW,gBAAgB;IAC/B,qDAAqD;IACrD,UAAU,EAAE,OAAO,CAAC;IACpB,yEAAyE;IACzE,UAAU,EAAE,OAAO,CAAC;IACpB,qBAAqB;IACrB,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;IAClC;;;;;;OAMG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kEAAkE;IAClE,eAAe,CAAC,EAAE,eAAe,GAAG,IAAI,CA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AM,CAAC,CAi3CrF"}
|
package/dist/commands/check.js
CHANGED
|
@@ -134,7 +134,7 @@ import { spawnSync } from 'node:child_process';
|
|
|
134
134
|
import { createHash } from 'node:crypto';
|
|
135
135
|
import { join } from 'node:path';
|
|
136
136
|
import { performance } from 'node:perf_hooks';
|
|
137
|
-
import { BLOCKING_VERDICTS, decideStrictness, loadQuarantines, QUARANTINE_DIR, resolveStrictnessMode, strictnessSummaryLine, CAUSE_NEXT_ACTIONS, canonicalJson, ENGINE_UPGRADE_REFUSAL_PREFIX, volatileEchoSkips, engineBundleDigestOf, executionBoundaryDigestOf, GateforgeConfigError, GateReceiptSchema, humanMessage, LOCAL_UNISOLATED_BOUNDARY, renderRun, runExitCode, } from '@gate-forge/core';
|
|
137
|
+
import { BLOCKING_VERDICTS, decideStrictness, loadQuarantines, QUARANTINE_DIR, resolveStrictnessMode, strictnessSummaryLine, CAUSE_NEXT_ACTIONS, canonicalJson, ENGINE_UPGRADE_REFUSAL_PREFIX, volatileEchoSkips, engineBundleDigestOf, executionBoundaryDigestOf, GateforgeConfigError, GateReceiptSchema, coverageDispositionDeprecations, humanMessage, LOCAL_UNISOLATED_BOUNDARY, renderRun, runExitCode, } from '@gate-forge/core';
|
|
138
138
|
import { discoverTestCatalog, findPlaywrightConfig, scanTestFiles, TestDiscoveryError, untrustedEnv, } from '@gate-forge/pack-playwright';
|
|
139
139
|
import { parseArgs, stringFlag } from '../args.js';
|
|
140
140
|
import { resolveAdoptedBaseline } from '../adopted-baseline.js';
|
|
@@ -1343,6 +1343,13 @@ export async function runCheckGate(io, options) {
|
|
|
1343
1343
|
excludeFile: engineGeneratedStateFileFilter(io.cwd, stateDir),
|
|
1344
1344
|
});
|
|
1345
1345
|
const tsScanMs = performance.now() - annotationScanStartedAtMs;
|
|
1346
|
+
// The coveragePolicy `note` alias (plan 2026-10-19): accepted this one
|
|
1347
|
+
// release, mapped onto `reason`; the stderr advisory is the only notice
|
|
1348
|
+
// the owner gets before support is removed. Warning-only — it never
|
|
1349
|
+
// alters the gate result.
|
|
1350
|
+
for (const deprecation of coverageDispositionDeprecations(config.coveragePolicy?.tables ?? [])) {
|
|
1351
|
+
writeLine(io.stderr, `check: deprecation warning: ${deprecation}`);
|
|
1352
|
+
}
|
|
1346
1353
|
for (const warning of annotationScan.registrationWarnings) {
|
|
1347
1354
|
writeLine(io.stderr, `check: registration warning ${warning.file}:${String(warning.location.line)}: ` +
|
|
1348
1355
|
`${warning.titlePath.join(' > ')} is conditional on ${warning.environmentVariable}; ` +
|
|
@@ -1856,6 +1863,15 @@ export async function runCheckGate(io, options) {
|
|
|
1856
1863
|
let report = renderRun(reportVerdicts, {
|
|
1857
1864
|
format,
|
|
1858
1865
|
blocking: evaluatedBlocking,
|
|
1866
|
+
excused: pipeline.policy.excused.map((entry) => ({
|
|
1867
|
+
obligationId: entry.obligation.id,
|
|
1868
|
+
resourceId: entry.obligation.resourceId,
|
|
1869
|
+
contract: entry.obligation.contract,
|
|
1870
|
+
policyId: entry.obligation.policyId,
|
|
1871
|
+
reason: entry.reason,
|
|
1872
|
+
kind: entry.kind,
|
|
1873
|
+
surface: entry.surface,
|
|
1874
|
+
})),
|
|
1859
1875
|
advisories: [
|
|
1860
1876
|
// HTTP call findings in report mode (0.14 WP3, `http.callFindings:
|
|
1861
1877
|
// report`): the run's unmatched / ambiguous / unresolved calls,
|