@gate-forge/cli 0.15.1 → 0.17.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 +133 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +20 -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 +15 -0
- package/dist/commands/disposition.d.ts.map +1 -0
- package/dist/commands/disposition.js +425 -0
- package/dist/commands/disposition.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/evaluate.d.ts +30 -3
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +72 -6
- package/dist/evaluate.js.map +1 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +29 -4
- 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 +63 -5
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,138 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.17.0
|
|
4
|
+
|
|
5
|
+
- **Changed: an active disposition excuses matching rule obligations.**
|
|
6
|
+
An active `behavior.yml` `out-of-scope` disposition withholds every
|
|
7
|
+
policies.yml obligation for that endpoint. An active `coveragePolicy`
|
|
8
|
+
disposition withholds `persistence:*` obligations for that table.
|
|
9
|
+
Expired dispositions excuse nothing (`DISPOSITION_EXPIRED` still
|
|
10
|
+
blocks). `operational-only` is unchanged (transport case only).
|
|
11
|
+
Excused obligations are listed in the check report and by
|
|
12
|
+
`disposition list` with the owner reason; they are not silently
|
|
13
|
+
dropped. `policies.yml` and its schema are unchanged.
|
|
14
|
+
- **Added: `gateforge behavior draft [--json]`.** Read-only paste-ready
|
|
15
|
+
`behavior.yml` body: one entry per discovered `http.endpoint`, sorted,
|
|
16
|
+
each with `cases` commented out and a TODO. Header: owner review
|
|
17
|
+
required; pasting it is the owner act; repin afterwards. Never writes.
|
|
18
|
+
An undeclared endpoint stays `ENDPOINT_BEHAVIOR_MISSING`.
|
|
19
|
+
- **Added: one disposition shape and `gateforge disposition list [--json]`.**
|
|
20
|
+
Behavior and coverage dispositions share `{ kind, reason, expiresAt? }`
|
|
21
|
+
with per-surface kind subsets. Coverage `note` still loads for one
|
|
22
|
+
release (mapped onto `reason`) and `gateforge check` warns. A non-`other`
|
|
23
|
+
coverage disposition that recorded no reason still loads and warns on
|
|
24
|
+
that same channel that `reason` will be required. `disposition list` is
|
|
25
|
+
read-only: surface, id, kind, reason, expiresAt, state.
|
|
26
|
+
- **Changed: `operational-only` is legal on real health/ops routes.** A
|
|
27
|
+
route positively marked health/ops (a `health-operations` capability, or
|
|
28
|
+
a path `/health/*`, `/ops/*`, `/metrics`, the same roots under `/api`,
|
|
29
|
+
a depth-capped probe path, or `/`) may carry `operational-only` even with
|
|
30
|
+
a transport capability
|
|
31
|
+
(`crud-create`, `file-transfer`, `workflow-command`), as long as it has
|
|
32
|
+
no business-resource link. A business link, or any unmarked route, stays
|
|
33
|
+
illegal.
|
|
34
|
+
|
|
35
|
+
- **Added: strict E2E refuses a missing coverage policy, and `gateforge
|
|
36
|
+
coverage draft` prints the owner's starting point.** With
|
|
37
|
+
`enforcement.strictE2E: true`, an absent or empty owner
|
|
38
|
+
`coveragePolicy` section adds exactly ONE setup-wide blocking
|
|
39
|
+
`COVERAGE_POLICY_ABSENT` entry (never diff-narrowed, like the strict
|
|
40
|
+
preflight) naming how many user-facing tables the current inventory
|
|
41
|
+
would have to declare, with the next action `gateforge coverage draft`.
|
|
42
|
+
The owner-written policy is the one gate input derived from the owner's
|
|
43
|
+
list instead of the code, so a strict setup without it could previously
|
|
44
|
+
go green by deleting the guarded code ("delete the feature to pass").
|
|
45
|
+
The new read-only command `gateforge coverage draft [--json]` prints a
|
|
46
|
+
paste-ready `coveragePolicy:` block — one entry per user-facing table,
|
|
47
|
+
`requiredOperations` = that table's lifecycle-enabled operations,
|
|
48
|
+
sorted by name — that always parses through `CoveragePolicySchema`; it
|
|
49
|
+
never writes any file, because pasting the policy is the owner's act.
|
|
50
|
+
With strict E2E off the section stays opt-in and its absence stays
|
|
51
|
+
silent (byte-identical behaviour). `init`'s scan output now says the
|
|
52
|
+
section is required under strictE2E and names the draft command.
|
|
53
|
+
|
|
54
|
+
## 0.16.0
|
|
55
|
+
|
|
56
|
+
- **Added: expiring owner dispositions and `gateforge disposition
|
|
57
|
+
extend`.** Both owner dispositions — the `coveragePolicy` table
|
|
58
|
+
dispositions and the `behaviorPolicy` endpoint dispositions
|
|
59
|
+
(`out-of-scope`, `operational-only`) — accept an optional `expiresAt`
|
|
60
|
+
(ISO-8601), judged against the run's injected clock: before the instant
|
|
61
|
+
the disposition works exactly as an untimed one; at and after it the
|
|
62
|
+
disposition is void — the endpoint/table grades as undispositioned AND
|
|
63
|
+
a blocking `DISPOSITION_EXPIRED` finding names the target, the expiry
|
|
64
|
+
and the extend command. An expiry further out than the configured
|
|
65
|
+
maximum (default 30 days, `disposition.maxDays`) is a config error
|
|
66
|
+
(`DISPOSITION_MAX_DURATION`). `gateforge disposition extend
|
|
67
|
+
<endpoint-id|table> --expires <ISO-date> --owner <name> --reason "<why>"`
|
|
68
|
+
rewrites `expiresAt` in the owning document (comment- and
|
|
69
|
+
format-preserving), refuses a date in the past or beyond the maximum,
|
|
70
|
+
and appends `{at, by, reason, previousExpiresAt}` to the disposition's
|
|
71
|
+
`extensions` audit list. The command only EDITS trusted policy — it
|
|
72
|
+
never pins and never approves a digest; the existing digest/pin flow
|
|
73
|
+
applies to the edited revision.
|
|
74
|
+
- **Fixed: client scan resolves wrapper verbs forwarded through an
|
|
75
|
+
options spread.** A declared wrapper whose request-options parameter
|
|
76
|
+
is spread into the fetch options it issues —
|
|
77
|
+
`fetch(url, { ...options, headers })` — now takes each call site's
|
|
78
|
+
verb from the argument bound to that parameter: an explicit `method`
|
|
79
|
+
wins, a spread provably free of `method` never overwrites an earlier
|
|
80
|
+
explicit verb, and a call site whose options cannot be proven stays
|
|
81
|
+
unresolved (never an invented GET). Wrapper call sites now bind every
|
|
82
|
+
identifier parameter positionally (previously only the endpoint
|
|
83
|
+
parameter was bound). A declared fixed-method wrapper resolves when
|
|
84
|
+
its spread body proves the declared verb, stays unresolved when the
|
|
85
|
+
body proves a different verb, and keeps its declared verb when the
|
|
86
|
+
body proves nothing.
|
|
87
|
+
- **Fixed: client scan resolves runtime base-URL hosts in template
|
|
88
|
+
URLs.** A template URL whose leading hole is a module constant the
|
|
89
|
+
scan can trace to a runtime config read — `import.meta.env` /
|
|
90
|
+
`process.env` directly, or through a scanned `getEnv(key)`-style
|
|
91
|
+
helper — resolves to the static path that follows
|
|
92
|
+
(`` `${BACKEND_URL}/api/v1/x/${token}` `` becomes `/api/v1/x/${}`).
|
|
93
|
+
A hole the scan cannot trace to a config read, and a host with no
|
|
94
|
+
static path after it, keep the call unresolved.
|
|
95
|
+
- **Fixed: client-scan spread order and verb-named call bodies.**
|
|
96
|
+
Options-spread verbs now follow JavaScript's last-writer-wins fully:
|
|
97
|
+
a literal `method` written after an unproven spread wins
|
|
98
|
+
(`fetch(url, { ...opts, method: 'POST' })` proves POST), while an
|
|
99
|
+
unproven spread written after the literal still keeps the verb
|
|
100
|
+
unproven. A verb-named call (`apiClient.post(url, body)`,
|
|
101
|
+
`axios.patch(url, body)`) takes its verb from the member name and
|
|
102
|
+
never reads `arguments[1]` as request options — a spread in the
|
|
103
|
+
request body (`apiClient.patch(url, { polygon_json, ...extra })`) no
|
|
104
|
+
longer un-proves the member's verb.
|
|
105
|
+
- **Fixed: a base-`endsWith('/')` path-join ternary resolves to one
|
|
106
|
+
URL.** A conditional whose test is `base.endsWith('/')` and whose
|
|
107
|
+
arms are `` `${base}${value}/` `` and `` `${base}/${value}/` `` now
|
|
108
|
+
renders the single joined template `` `${base}/${value}/` `` — both
|
|
109
|
+
arms are the same URL — instead of also emitting the ghost target
|
|
110
|
+
`` `${base}${value}/` `` for callers whose base already ends in a
|
|
111
|
+
slash. A conditional on any other test keeps today's both-arms
|
|
112
|
+
union.
|
|
113
|
+
- **Fixed: the exhaustive exposure-coverage check now scopes to the
|
|
114
|
+
requested paths a code detector could parse, not every requested
|
|
115
|
+
path.** The internality certificate's exposure-negative proof demanded
|
|
116
|
+
that EVERY file in `scan.requestedPaths` be covered by an exhaustive
|
|
117
|
+
`exposure.*` coverage rule and reported by that rule's detector. With
|
|
118
|
+
broad scan roots (`**/*`) the requested set includes README, package
|
|
119
|
+
manifests, and docs that no code detector parses, so the certificate
|
|
120
|
+
was unreachable for any repository with wide scanRoots whatever rules
|
|
121
|
+
were configured — every internal-intent resource stayed conservatively
|
|
122
|
+
user-facing (`INCOMPLETE_PROOF_SCOPE`). The check stays run-wide — a
|
|
123
|
+
table is exposed, if at all, from other files (route handlers, API
|
|
124
|
+
modules), so scoping the negative proof to a resource's own source
|
|
125
|
+
would certify `internal` while those files went unchecked — and it now
|
|
126
|
+
derives its scope generically as the requested paths inside the
|
|
127
|
+
pipeline-reported detector input set (the `project.paths.include`
|
|
128
|
+
discovery scope, carried as `scan.eligiblePaths`), excluding only
|
|
129
|
+
non-code files no detector consumes. Fail-closed is unchanged: a host
|
|
130
|
+
that does not report its detector input set keeps every requested path
|
|
131
|
+
in scope, an eligible path that no exhaustive rule claims, or that the
|
|
132
|
+
granting rule's detector did not report scanning, still blocks, and
|
|
133
|
+
repositories without an exhaustive exposure rule keep the conservative
|
|
134
|
+
default.
|
|
135
|
+
|
|
3
136
|
## 0.15.1
|
|
4
137
|
|
|
5
138
|
- **Fixed: client scan flags JSX-omitted props with destructuring
|
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 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';
|
|
@@ -24,6 +26,7 @@ import { preCommitCommand } from './commands/pre-commit.js';
|
|
|
24
26
|
import { baselineCommand } from './commands/baseline.js';
|
|
25
27
|
import { waiveCommand } from './commands/waive.js';
|
|
26
28
|
import { quarantineCommand } from './commands/quarantine.js';
|
|
29
|
+
import { dispositionCommand } from './commands/disposition.js';
|
|
27
30
|
import { classifyCommand } from './commands/classify.js';
|
|
28
31
|
import { explainCommand } from './commands/explain.js';
|
|
29
32
|
import { testsCommand } from './commands/tests.js';
|
|
@@ -70,6 +73,11 @@ commands:
|
|
|
70
73
|
[--probe --base-url URL] with the app running: one read-only GET per adapter
|
|
71
74
|
[--probe-id ID]
|
|
72
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)
|
|
73
81
|
history [--test TEXT] [--failed] [--since ISO] query retained supervised run history
|
|
74
82
|
check [--changed] [--staged] [--candidate-commit SHA] run the gate against all files, the exact frozen
|
|
75
83
|
index, or the selected immutable commit tree; --changed narrows the selected candidate's diff;
|
|
@@ -99,6 +107,12 @@ commands:
|
|
|
99
107
|
quarantine <testKey> write an expiring, owner-approved flaky-test quarantine
|
|
100
108
|
--owner N --approver N (never proof, never blocking; at most 14 days; no --force;
|
|
101
109
|
--reason "T" --expires D an expired quarantine BLOCKS until renewed or deleted)
|
|
110
|
+
disposition extend <endpoint-id|table> rewrite one owner disposition's expiresAt and record the
|
|
111
|
+
--owner N --reason "T" extension in its extensions audit list (never pins; the
|
|
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
|
|
102
116
|
run [--] [test-gates flags] the whole local proof in order: doctor preflight (strict), the optional
|
|
103
117
|
.gateforge/runtime.yml recipe (reset/seed/up/health), the supervised
|
|
104
118
|
test-gates, check --require-e2e, and the recipe's teardown — one line
|
|
@@ -155,6 +169,10 @@ export async function main(argv, io = processIo()) {
|
|
|
155
169
|
return runWithExitCodes(io, () => adaptersCommand(io, rest));
|
|
156
170
|
case 'obligations':
|
|
157
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));
|
|
158
176
|
case 'check':
|
|
159
177
|
return runWithExitCodes(io, () => checkCommand(io, rest));
|
|
160
178
|
case 'next':
|
|
@@ -183,6 +201,8 @@ export async function main(argv, io = processIo()) {
|
|
|
183
201
|
return runWithExitCodes(io, () => Promise.resolve(migrateCommand(io, rest)));
|
|
184
202
|
case 'quarantine':
|
|
185
203
|
return runWithExitCodes(io, () => quarantineCommand(io, rest));
|
|
204
|
+
case 'disposition':
|
|
205
|
+
return runWithExitCodes(io, () => dispositionCommand(io, rest));
|
|
186
206
|
default:
|
|
187
207
|
return runWithExitCodes(io, async () => {
|
|
188
208
|
// parseArgs validates flag syntax; unknown commands are usage errors.
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE3D,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC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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,KAAK,aAAa;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 @@
|
|
|
1
|
+
{"version":3,"file":"behavior.js","sourceRoot":"","sources":["../../src/commands/behavior.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,aAAa,EAAE,2BAA2B,EAAkB,MAAM,kBAAkB,CAAC;AAC9F,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,CAAC,MAAM,cAAc,GAAG,0CAA0C,CAAC;AAEzE,yDAAyD;AACzD,MAAM,YAAY,GAChB,yFAAyF,CAAC;AAE5F,6EAA6E;AAC7E,MAAM,UAAU,GACZ,oFAAoF;IACpF,6EAA6E,CAAC;AAElF;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAAC,EAAM;IACnD,MAAM,MAAM,GAAG,YAAY,CAAC,EAAE,CAAC,GAAG,C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CAAC,qDAAqD,cAAc,GAAG,CAAC,CAAC;IAC/F,CAAC;IACD,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,KAAK,IAAI,CAAC;IAExC,MAAM,WAAW,GAAG,MAAM,wBAAwB,CAAC,EAAE,CAAC,CAAC;IAEvD,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,KAAK,GAAG;YACZ,aAAa,EAAE,CAAU;YACzB,SAAS,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,CAAC;YACpF,SAAS,EAAE,EAAE;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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nG;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAMhE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,aAAa,GAAG,IAAI,GAAG,OAAO,CAE9E;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,MAAM,EACtB,QAAQ,EAAE,MAAM,GACf,MAAM,CAeR;AAsCD;;;;;;;;;;;GAWG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,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,
|