@gate-forge/cli 0.15.0 → 0.16.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 +6 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/disposition.d.ts +15 -0
- package/dist/commands/disposition.d.ts.map +1 -0
- package/dist/commands/disposition.js +316 -0
- package/dist/commands/disposition.js.map +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +4 -0
- package/dist/commands/init.js.map +1 -1
- package/dist/detector-trust.d.ts +35 -0
- package/dist/detector-trust.d.ts.map +1 -1
- package/dist/detector-trust.js +104 -17
- package/dist/detector-trust.js.map +1 -1
- package/dist/evaluate.d.ts +6 -3
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +13 -6
- package/dist/evaluate.js.map +1 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +8 -1
- package/dist/pipeline.js.map +1 -1
- package/dist/plugins.d.ts +34 -0
- package/dist/plugins.d.ts.map +1 -1
- package/dist/plugins.js +11 -5
- package/dist/plugins.js.map +1 -1
- package/dist/run-cache.d.ts +4 -1
- package/dist/run-cache.d.ts.map +1 -1
- package/dist/run-cache.js +32 -39
- package/dist/run-cache.js.map +1 -1
- package/guides/REFERENCE.md +65 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,138 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.16.0
|
|
4
|
+
|
|
5
|
+
- **Added: expiring owner dispositions and `gateforge disposition
|
|
6
|
+
extend`.** Both owner dispositions — the `coveragePolicy` table
|
|
7
|
+
dispositions and the `behaviorPolicy` endpoint dispositions
|
|
8
|
+
(`out-of-scope`, `operational-only`) — accept an optional `expiresAt`
|
|
9
|
+
(ISO-8601), judged against the run's injected clock: before the instant
|
|
10
|
+
the disposition works exactly as an untimed one; at and after it the
|
|
11
|
+
disposition is void — the endpoint/table grades as undispositioned AND
|
|
12
|
+
a blocking `DISPOSITION_EXPIRED` finding names the target, the expiry
|
|
13
|
+
and the extend command. An expiry further out than the configured
|
|
14
|
+
maximum (default 30 days, `disposition.maxDays`) is a config error
|
|
15
|
+
(`DISPOSITION_MAX_DURATION`). `gateforge disposition extend
|
|
16
|
+
<endpoint-id|table> --expires <ISO-date> --owner <name> --reason "<why>"`
|
|
17
|
+
rewrites `expiresAt` in the owning document (comment- and
|
|
18
|
+
format-preserving), refuses a date in the past or beyond the maximum,
|
|
19
|
+
and appends `{at, by, reason, previousExpiresAt}` to the disposition's
|
|
20
|
+
`extensions` audit list. The command only EDITS trusted policy — it
|
|
21
|
+
never pins and never approves a digest; the existing digest/pin flow
|
|
22
|
+
applies to the edited revision.
|
|
23
|
+
- **Fixed: client scan resolves wrapper verbs forwarded through an
|
|
24
|
+
options spread.** A declared wrapper whose request-options parameter
|
|
25
|
+
is spread into the fetch options it issues —
|
|
26
|
+
`fetch(url, { ...options, headers })` — now takes each call site's
|
|
27
|
+
verb from the argument bound to that parameter: an explicit `method`
|
|
28
|
+
wins, a spread provably free of `method` never overwrites an earlier
|
|
29
|
+
explicit verb, and a call site whose options cannot be proven stays
|
|
30
|
+
unresolved (never an invented GET). Wrapper call sites now bind every
|
|
31
|
+
identifier parameter positionally (previously only the endpoint
|
|
32
|
+
parameter was bound). A declared fixed-method wrapper resolves when
|
|
33
|
+
its spread body proves the declared verb, stays unresolved when the
|
|
34
|
+
body proves a different verb, and keeps its declared verb when the
|
|
35
|
+
body proves nothing.
|
|
36
|
+
- **Fixed: client scan resolves runtime base-URL hosts in template
|
|
37
|
+
URLs.** A template URL whose leading hole is a module constant the
|
|
38
|
+
scan can trace to a runtime config read — `import.meta.env` /
|
|
39
|
+
`process.env` directly, or through a scanned `getEnv(key)`-style
|
|
40
|
+
helper — resolves to the static path that follows
|
|
41
|
+
(`` `${BACKEND_URL}/api/v1/x/${token}` `` becomes `/api/v1/x/${}`).
|
|
42
|
+
A hole the scan cannot trace to a config read, and a host with no
|
|
43
|
+
static path after it, keep the call unresolved.
|
|
44
|
+
- **Fixed: client-scan spread order and verb-named call bodies.**
|
|
45
|
+
Options-spread verbs now follow JavaScript's last-writer-wins fully:
|
|
46
|
+
a literal `method` written after an unproven spread wins
|
|
47
|
+
(`fetch(url, { ...opts, method: 'POST' })` proves POST), while an
|
|
48
|
+
unproven spread written after the literal still keeps the verb
|
|
49
|
+
unproven. A verb-named call (`apiClient.post(url, body)`,
|
|
50
|
+
`axios.patch(url, body)`) takes its verb from the member name and
|
|
51
|
+
never reads `arguments[1]` as request options — a spread in the
|
|
52
|
+
request body (`apiClient.patch(url, { polygon_json, ...extra })`) no
|
|
53
|
+
longer un-proves the member's verb.
|
|
54
|
+
- **Fixed: a base-`endsWith('/')` path-join ternary resolves to one
|
|
55
|
+
URL.** A conditional whose test is `base.endsWith('/')` and whose
|
|
56
|
+
arms are `` `${base}${value}/` `` and `` `${base}/${value}/` `` now
|
|
57
|
+
renders the single joined template `` `${base}/${value}/` `` — both
|
|
58
|
+
arms are the same URL — instead of also emitting the ghost target
|
|
59
|
+
`` `${base}${value}/` `` for callers whose base already ends in a
|
|
60
|
+
slash. A conditional on any other test keeps today's both-arms
|
|
61
|
+
union.
|
|
62
|
+
- **Fixed: the exhaustive exposure-coverage check now scopes to the
|
|
63
|
+
requested paths a code detector could parse, not every requested
|
|
64
|
+
path.** The internality certificate's exposure-negative proof demanded
|
|
65
|
+
that EVERY file in `scan.requestedPaths` be covered by an exhaustive
|
|
66
|
+
`exposure.*` coverage rule and reported by that rule's detector. With
|
|
67
|
+
broad scan roots (`**/*`) the requested set includes README, package
|
|
68
|
+
manifests, and docs that no code detector parses, so the certificate
|
|
69
|
+
was unreachable for any repository with wide scanRoots whatever rules
|
|
70
|
+
were configured — every internal-intent resource stayed conservatively
|
|
71
|
+
user-facing (`INCOMPLETE_PROOF_SCOPE`). The check stays run-wide — a
|
|
72
|
+
table is exposed, if at all, from other files (route handlers, API
|
|
73
|
+
modules), so scoping the negative proof to a resource's own source
|
|
74
|
+
would certify `internal` while those files went unchecked — and it now
|
|
75
|
+
derives its scope generically as the requested paths inside the
|
|
76
|
+
pipeline-reported detector input set (the `project.paths.include`
|
|
77
|
+
discovery scope, carried as `scan.eligiblePaths`), excluding only
|
|
78
|
+
non-code files no detector consumes. Fail-closed is unchanged: a host
|
|
79
|
+
that does not report its detector input set keeps every requested path
|
|
80
|
+
in scope, an eligible path that no exhaustive rule claims, or that the
|
|
81
|
+
granting rule's detector did not report scanning, still blocks, and
|
|
82
|
+
repositories without an exhaustive exposure rule keep the conservative
|
|
83
|
+
default.
|
|
84
|
+
|
|
85
|
+
## 0.15.1
|
|
86
|
+
|
|
87
|
+
- **Fixed: client scan flags JSX-omitted props with destructuring
|
|
88
|
+
defaults.** When a declared wrapper's endpoint argument is guarded by
|
|
89
|
+
a component prop's literal destructuring default — `detail === null`
|
|
90
|
+
with `({ base, detail = null })` — a JSX usage that omits the
|
|
91
|
+
attribute now contributes the default value and the guard's matching
|
|
92
|
+
branch is proven, instead of failing closed; a usage that passes the
|
|
93
|
+
attribute keeps proving the other branch. The same resolution applies
|
|
94
|
+
when the props travel through a config object into a hook with a
|
|
95
|
+
destructured parameter, or as several positional arguments, and the
|
|
96
|
+
guard lives in the hook's body. A prop
|
|
97
|
+
with no default, a non-literal default (a call, an identifier), an
|
|
98
|
+
attribute present without a value, and spread usages (`{...props}`)
|
|
99
|
+
still block with `FRONTEND_CALL_TARGET_UNRESOLVED`. These per-usage
|
|
100
|
+
resolvers are additive precision only: when they cannot themselves
|
|
101
|
+
prove a call — a hook called from other hooks (no JSX usage sites),
|
|
102
|
+
a usage-supplied value that still leaves the endpoint unproven — the
|
|
103
|
+
call falls back to the plain configured-parameter model, which
|
|
104
|
+
resolves or fails closed exactly as before.
|
|
105
|
+
- **Fixed: client scan flags on interceptor replays.** Inside the error
|
|
106
|
+
handler of `client.interceptors.response.use`, re-sending the
|
|
107
|
+
intercepted error's own request config on the same client symbol —
|
|
108
|
+
`client(error.config)`, a `const` bound to it, or a destructured
|
|
109
|
+
`{ config }` handler parameter — is a replay of a request the scan has
|
|
110
|
+
already recorded: no call record, no `FRONTEND_CALL_TARGET_UNRESOLVED`.
|
|
111
|
+
A replay-shaped call on a different client symbol and a config-only
|
|
112
|
+
call outside any interceptor still block, and concrete calls inside
|
|
113
|
+
the handler are still recorded.
|
|
114
|
+
- **Fixed: wrapper call targets through JSX props.** A declared wrapper
|
|
115
|
+
whose endpoint argument is a function component's prop now resolves
|
|
116
|
+
through every JSX usage site of that component in the scanned set
|
|
117
|
+
(one unchanged-prop forwarding hop allowed) and emits one call per
|
|
118
|
+
distinct target. An unresolvable usage site, a member access on a
|
|
119
|
+
prop, or a component without usage sites keeps the unresolved
|
|
120
|
+
finding. JSX wrapper usages now bind the wrapper's first parameter
|
|
121
|
+
when no `parameter` is configured, matching the direct-call contract.
|
|
122
|
+
- **Fixed: run-cache key digested a different detector module than the one
|
|
123
|
+
that executes:** the plugin cache key resolved a bare package specifier
|
|
124
|
+
(e.g. `@gate-forge/pack-http`) against the target repository's
|
|
125
|
+
`node_modules`, while the in-process loader imported the specifier from
|
|
126
|
+
the CLI's own installation. When the two copies differed (an engine
|
|
127
|
+
rebuilt at the same version, or a repository with an older installed
|
|
128
|
+
pack), a changed engine could serve a stale cached scan. One shared
|
|
129
|
+
resolver (`resolveExecutedModule`) now decides the executed module for
|
|
130
|
+
both consumers with Node's own resolution from the CLI installation:
|
|
131
|
+
the loader imports exactly the resolver's entry URL, and the key
|
|
132
|
+
digests the same resolution's package tree — an unresolvable or
|
|
133
|
+
unreadable executed module leaves the plugin uncacheable (fail
|
|
134
|
+
closed), as before.
|
|
135
|
+
|
|
3
136
|
## 0.15.0
|
|
4
137
|
|
|
5
138
|
- **Fixed: github-pr base ref in detached PR checkouts:** the changed-file
|
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 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";
|
|
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;AA4BlC,4DAA4D;AAC5D,eAAO,MAAM,KAAK,g8NA4EyD,CAAC;AAE5E;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CACxB,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,EAAE,GAAE,EAAgB,GACnB,OAAO,CAAC,MAAM,CAAC,CA0EjB"}
|
package/dist/cli.js
CHANGED
|
@@ -24,6 +24,7 @@ import { preCommitCommand } from './commands/pre-commit.js';
|
|
|
24
24
|
import { baselineCommand } from './commands/baseline.js';
|
|
25
25
|
import { waiveCommand } from './commands/waive.js';
|
|
26
26
|
import { quarantineCommand } from './commands/quarantine.js';
|
|
27
|
+
import { dispositionCommand } from './commands/disposition.js';
|
|
27
28
|
import { classifyCommand } from './commands/classify.js';
|
|
28
29
|
import { explainCommand } from './commands/explain.js';
|
|
29
30
|
import { testsCommand } from './commands/tests.js';
|
|
@@ -99,6 +100,9 @@ commands:
|
|
|
99
100
|
quarantine <testKey> write an expiring, owner-approved flaky-test quarantine
|
|
100
101
|
--owner N --approver N (never proof, never blocking; at most 14 days; no --force;
|
|
101
102
|
--reason "T" --expires D an expired quarantine BLOCKS until renewed or deleted)
|
|
103
|
+
disposition extend <endpoint-id|table> rewrite one owner disposition's expiresAt and record the
|
|
104
|
+
--owner N --reason "T" extension in its extensions audit list (never pins; the
|
|
105
|
+
--expires D digest/pin flow applies to the edited policy)
|
|
102
106
|
run [--] [test-gates flags] the whole local proof in order: doctor preflight (strict), the optional
|
|
103
107
|
.gateforge/runtime.yml recipe (reset/seed/up/health), the supervised
|
|
104
108
|
test-gates, check --require-e2e, and the recipe's teardown — one line
|
|
@@ -183,6 +187,8 @@ export async function main(argv, io = processIo()) {
|
|
|
183
187
|
return runWithExitCodes(io, () => Promise.resolve(migrateCommand(io, rest)));
|
|
184
188
|
case 'quarantine':
|
|
185
189
|
return runWithExitCodes(io, () => quarantineCommand(io, rest));
|
|
190
|
+
case 'disposition':
|
|
191
|
+
return runWithExitCodes(io, () => dispositionCommand(io, rest));
|
|
186
192
|
default:
|
|
187
193
|
return runWithExitCodes(io, async () => {
|
|
188
194
|
// 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,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string;
|
|
3
|
+
/**
|
|
4
|
+
* Runs the `disposition` subcommand (today: `extend`).
|
|
5
|
+
*
|
|
6
|
+
* Args:
|
|
7
|
+
* io: process context.
|
|
8
|
+
* argv: flags after the subcommand.
|
|
9
|
+
*
|
|
10
|
+
* Returns:
|
|
11
|
+
* number: exit code — 0 disposition extended, 2 usage/validation.
|
|
12
|
+
* @throws UsageError (exit 2) on any usage or fail-closed problem.
|
|
13
|
+
*/
|
|
14
|
+
export declare function dispositionCommand(io: Io, argv: readonly string[]): Promise<number>;
|
|
15
|
+
//# sourceMappingURL=disposition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposition.d.ts","sourceRoot":"","sources":["../../src/commands/disposition.ts"],"names":[],"mappings":"AAuCA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAKnC,eAAO,MAAM,iBAAiB,QAUiD,CAAC;AAkNhF;;;;;;;;;;GAUG;AACH,wBAAsB,kBAAkB,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CA2IzF"}
|
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `gateforge disposition extend <endpoint-id|table>`: rewrite ONE owner
|
|
3
|
+
* disposition's `expiresAt` in the document that owns it — the
|
|
4
|
+
* `behaviorPolicy` document for endpoints, the `coveragePolicy` section
|
|
5
|
+
* of `.gateforge.yml` for tables — and append an audit entry to the
|
|
6
|
+
* disposition's `extensions` list.
|
|
7
|
+
*
|
|
8
|
+
* The command is a TEXT EDIT of trusted policy, nothing more: it never
|
|
9
|
+
* pins, never approves a digest, and never runs the gate. The edited
|
|
10
|
+
* revision participates in the trusted-policy digest like any other
|
|
11
|
+
* owner edit, so the printout names the existing digest/pin flow as the
|
|
12
|
+
* next step (the gate refuses the revision until the owner re-approves
|
|
13
|
+
* it — by design, the same as any hand edit).
|
|
14
|
+
*/
|
|
15
|
+
import { readFileSync, writeFileSync } from 'node:fs';
|
|
16
|
+
import { join } from 'node:path';
|
|
17
|
+
import { BehaviorDispositionSchema, BehaviorPolicySchema, CoverageDispositionSchema, DISPOSITION_MAX_DAYS, GateforgeConfigSchema, dispositionExpiry, } from '@gate-forge/core';
|
|
18
|
+
import { isMap, isSeq, parse as parseYaml, parseDocument, stringify as stringifyYaml, } from 'yaml';
|
|
19
|
+
import { parseArgs, stringFlag } from '../args.js';
|
|
20
|
+
import { clockFromConfig } from '../clock.js';
|
|
21
|
+
import { UsageError } from '../errors.js';
|
|
22
|
+
import { writeLine } from '../io.js';
|
|
23
|
+
import { resolveRepoPath } from '../repo-path.js';
|
|
24
|
+
import { loadConfigAt, rejectUnknownFlags } from './common.js';
|
|
25
|
+
export const DISPOSITION_USAGE = 'usage: gateforge disposition extend <endpoint-id|table> --expires <ISO-date|datetime>\n' +
|
|
26
|
+
' --owner <name> --reason "why"\n' +
|
|
27
|
+
' Rewrites `expiresAt` on ONE owner disposition and records an audit entry in its\n' +
|
|
28
|
+
' `extensions` list. The target is a behaviorPolicy endpoint id or a coveragePolicy\n' +
|
|
29
|
+
' table name. An expired disposition blocks its endpoint/table until extended or\n' +
|
|
30
|
+
` rewritten. --expires must be in the future and no further than the configured\n` +
|
|
31
|
+
` maximum (${String(DISPOSITION_MAX_DAYS)} days by default, \`disposition.maxDays\`) out. A disposition\n` +
|
|
32
|
+
' without an `expiresAt` has no timer to extend (record one by editing the policy).\n' +
|
|
33
|
+
' This command only EDITS trusted policy — it never pins and never approves a\n' +
|
|
34
|
+
' digest; the existing digest/pin flow applies to the edited revision.';
|
|
35
|
+
/** Flags the command accepts (plus the implicit `help`). */
|
|
36
|
+
const DISPOSITION_FLAGS = ['owner', 'reason', 'expires', 'help'];
|
|
37
|
+
/** A bare `--expires` date means UTC midnight of that day (waiver convention). */
|
|
38
|
+
const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
39
|
+
/** First zod issue of a document validation, as one readable line. */
|
|
40
|
+
function firstIssue(error) {
|
|
41
|
+
const issue = error.issues[0];
|
|
42
|
+
return issue === undefined ? 'unknown' : `${issue.path.join('.') || '<document>'}: ${issue.message}`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Refuses the two unusable states of a FOUND disposition: absent (the
|
|
46
|
+
* target has no disposition at all) and timer-less (the audit entry's
|
|
47
|
+
* `previousExpiresAt` must honestly name the replaced expiry, so a
|
|
48
|
+
* disposition without an `expiresAt` has nothing to extend).
|
|
49
|
+
*/
|
|
50
|
+
function requireExpiringDisposition(disposition, targetLabel) {
|
|
51
|
+
if (disposition === undefined) {
|
|
52
|
+
throw new UsageError(`disposition extend: ${targetLabel} has no owner disposition to extend — record one in the policy first`);
|
|
53
|
+
}
|
|
54
|
+
if (disposition.expiresAt === undefined) {
|
|
55
|
+
throw new UsageError(`disposition extend: ${targetLabel} has no disposition \`expiresAt\` to extend — ` +
|
|
56
|
+
'a disposition without a timer stands as written; record an expiresAt by editing the policy');
|
|
57
|
+
}
|
|
58
|
+
// Both unusable states threw above, so the narrowed shape is proven at
|
|
59
|
+
// runtime; TS cannot express that narrowing on an unresolved generic.
|
|
60
|
+
return disposition;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* The disposition mapping node of the endpoint/table at `index`, read
|
|
64
|
+
* off the comment-preserving parse of the SAME text the typed view was
|
|
65
|
+
* validated from.
|
|
66
|
+
*/
|
|
67
|
+
function dispositionNodeAt(document, indexPath, index, targetLabel) {
|
|
68
|
+
let node = document.contents;
|
|
69
|
+
for (const key of indexPath) {
|
|
70
|
+
node = isMap(node) ? node.get(key, true) : null;
|
|
71
|
+
}
|
|
72
|
+
const item = isSeq(node) ? node.items[index] : null;
|
|
73
|
+
const disposition = isMap(item) ? item.get('disposition', true) : null;
|
|
74
|
+
if (!isMap(disposition)) {
|
|
75
|
+
throw new UsageError(`disposition extend: ${targetLabel} disposition is not a YAML mapping — fix the document by hand`);
|
|
76
|
+
}
|
|
77
|
+
return disposition;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Locates the named endpoint in the behaviorPolicy document. Returns
|
|
81
|
+
* null when the id names no endpoint there; throws when the endpoint is
|
|
82
|
+
* found but its disposition cannot be extended.
|
|
83
|
+
*
|
|
84
|
+
* Args:
|
|
85
|
+
* io: process context (cwd resolves the repo-relative document path).
|
|
86
|
+
* config: validated `.gateforge.yml`.
|
|
87
|
+
* target: the endpoint id to find (`resourceId`).
|
|
88
|
+
*
|
|
89
|
+
* Returns:
|
|
90
|
+
* LocatedDisposition | null.
|
|
91
|
+
*/
|
|
92
|
+
function locateBehaviorDisposition(io, config, target) {
|
|
93
|
+
if (config.behaviorPolicy === undefined)
|
|
94
|
+
return null;
|
|
95
|
+
const documentPath = resolveRepoPath(io.cwd, config.behaviorPolicy);
|
|
96
|
+
let raw;
|
|
97
|
+
try {
|
|
98
|
+
raw = readFileSync(documentPath, 'utf8');
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
const code = error.code ?? 'UNKNOWN';
|
|
102
|
+
throw new UsageError(`disposition extend: cannot read behavior policy file '${documentPath}' (${code})`);
|
|
103
|
+
}
|
|
104
|
+
// The typed lookup runs against the PRODUCTION schema, so the edit
|
|
105
|
+
// never reasons about an unvalidated document.
|
|
106
|
+
const parsed = BehaviorPolicySchema.safeParse(parseYaml(raw));
|
|
107
|
+
if (!parsed.success) {
|
|
108
|
+
throw new UsageError(`disposition extend: behavior policy '${config.behaviorPolicy}' is invalid: ${firstIssue(parsed.error)}`);
|
|
109
|
+
}
|
|
110
|
+
const index = parsed.data.endpoints.findIndex((endpoint) => endpoint.resourceId === target);
|
|
111
|
+
const endpoint = parsed.data.endpoints[index];
|
|
112
|
+
if (index === -1 || endpoint === undefined)
|
|
113
|
+
return null;
|
|
114
|
+
const previous = requireExpiringDisposition(endpoint.disposition, `endpoint '${target}'`);
|
|
115
|
+
const document = parseDocument(raw);
|
|
116
|
+
return {
|
|
117
|
+
isBehavior: true,
|
|
118
|
+
previous,
|
|
119
|
+
previousExpiresAt: previous.expiresAt,
|
|
120
|
+
documentPath,
|
|
121
|
+
documentLabel: `behavior policy '${config.behaviorPolicy}'`,
|
|
122
|
+
targetLabel: `endpoint '${target}'`,
|
|
123
|
+
document,
|
|
124
|
+
dispositionNode: dispositionNodeAt(document, ['endpoints'], index, `endpoint '${target}'`),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Locates the named table in the `coveragePolicy` section of
|
|
129
|
+
* `.gateforge.yml` (the config the command already loaded, validated).
|
|
130
|
+
* Returns null when the name names no table there; throws when the
|
|
131
|
+
* table is found but its disposition cannot be extended.
|
|
132
|
+
*
|
|
133
|
+
* Args:
|
|
134
|
+
* io: process context.
|
|
135
|
+
* config: validated `.gateforge.yml`.
|
|
136
|
+
* target: the table name to find.
|
|
137
|
+
*
|
|
138
|
+
* Returns:
|
|
139
|
+
* LocatedDisposition | null.
|
|
140
|
+
*/
|
|
141
|
+
function locateCoverageDisposition(io, config, target) {
|
|
142
|
+
if (config.coveragePolicy === undefined)
|
|
143
|
+
return null;
|
|
144
|
+
const documentPath = join(io.cwd, '.gateforge.yml');
|
|
145
|
+
const raw = readFileSync(documentPath, 'utf8');
|
|
146
|
+
const index = config.coveragePolicy.tables.findIndex((table) => table.name === target);
|
|
147
|
+
const table = config.coveragePolicy.tables[index];
|
|
148
|
+
if (index === -1 || table === undefined)
|
|
149
|
+
return null;
|
|
150
|
+
const previous = requireExpiringDisposition(table.disposition, `table '${target}'`);
|
|
151
|
+
const document = parseDocument(raw);
|
|
152
|
+
return {
|
|
153
|
+
isBehavior: false,
|
|
154
|
+
previous,
|
|
155
|
+
previousExpiresAt: previous.expiresAt,
|
|
156
|
+
documentPath,
|
|
157
|
+
documentLabel: `config '.gateforge.yml' coveragePolicy`,
|
|
158
|
+
targetLabel: `table '${target}'`,
|
|
159
|
+
document,
|
|
160
|
+
dispositionNode: dispositionNodeAt(document, ['coveragePolicy', 'tables'], index, `table '${target}'`),
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Every disposition-bearing id the two documents declare, for the
|
|
165
|
+
* unknown-target diagnostic.
|
|
166
|
+
*/
|
|
167
|
+
function knownDispositionTargets(io, config) {
|
|
168
|
+
const endpoints = [];
|
|
169
|
+
const tables = [];
|
|
170
|
+
if (config.behaviorPolicy !== undefined) {
|
|
171
|
+
try {
|
|
172
|
+
const parsed = BehaviorPolicySchema.safeParse(parseYaml(readFileSync(resolveRepoPath(io.cwd, config.behaviorPolicy), 'utf8')));
|
|
173
|
+
if (parsed.success) {
|
|
174
|
+
for (const endpoint of parsed.data.endpoints)
|
|
175
|
+
endpoints.push(endpoint.resourceId);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
// The location error above already named the unreadable document.
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
if (config.coveragePolicy !== undefined) {
|
|
183
|
+
for (const table of config.coveragePolicy.tables)
|
|
184
|
+
tables.push(table.name);
|
|
185
|
+
}
|
|
186
|
+
return { endpoints, tables };
|
|
187
|
+
}
|
|
188
|
+
/** Cheap close-match suggestions for an unresolvable target id. */
|
|
189
|
+
function closeMatches(known, target) {
|
|
190
|
+
const needle = target.toLowerCase();
|
|
191
|
+
return known
|
|
192
|
+
.filter((candidate) => {
|
|
193
|
+
const haystack = candidate.toLowerCase();
|
|
194
|
+
return haystack.includes(needle) || needle.includes(haystack);
|
|
195
|
+
})
|
|
196
|
+
.slice(0, 5);
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Runs the `disposition` subcommand (today: `extend`).
|
|
200
|
+
*
|
|
201
|
+
* Args:
|
|
202
|
+
* io: process context.
|
|
203
|
+
* argv: flags after the subcommand.
|
|
204
|
+
*
|
|
205
|
+
* Returns:
|
|
206
|
+
* number: exit code — 0 disposition extended, 2 usage/validation.
|
|
207
|
+
* @throws UsageError (exit 2) on any usage or fail-closed problem.
|
|
208
|
+
*/
|
|
209
|
+
export async function dispositionCommand(io, argv) {
|
|
210
|
+
const { options, positionals } = parseArgs(argv);
|
|
211
|
+
if (options['help'] === true) {
|
|
212
|
+
writeLine(io.stdout, DISPOSITION_USAGE);
|
|
213
|
+
return 0;
|
|
214
|
+
}
|
|
215
|
+
const subcommand = positionals[0];
|
|
216
|
+
if (subcommand !== 'extend') {
|
|
217
|
+
throw new UsageError(`disposition requires the subcommand 'extend' as its first argument (${DISPOSITION_USAGE})`);
|
|
218
|
+
}
|
|
219
|
+
const target = positionals[1];
|
|
220
|
+
if (target === undefined || positionals.length > 2) {
|
|
221
|
+
throw new UsageError(`disposition extend requires exactly one <endpoint-id|table> target (${DISPOSITION_USAGE})`);
|
|
222
|
+
}
|
|
223
|
+
rejectUnknownFlags(options, DISPOSITION_FLAGS, DISPOSITION_USAGE);
|
|
224
|
+
const owner = stringFlag(options, 'owner');
|
|
225
|
+
const reason = stringFlag(options, 'reason');
|
|
226
|
+
const rawExpires = stringFlag(options, 'expires');
|
|
227
|
+
const missing = [
|
|
228
|
+
['owner', owner],
|
|
229
|
+
['reason', reason],
|
|
230
|
+
['expires', rawExpires],
|
|
231
|
+
]
|
|
232
|
+
.filter(([, value]) => value === undefined)
|
|
233
|
+
.map(([name]) => `'--${name}'`);
|
|
234
|
+
if (missing.length > 0) {
|
|
235
|
+
throw new UsageError(`disposition extend requires ${missing.join(', ')} (${DISPOSITION_USAGE})`);
|
|
236
|
+
}
|
|
237
|
+
const config = loadConfigAt(io.cwd);
|
|
238
|
+
// `clockFromConfig` is the same injected run clock every evaluator
|
|
239
|
+
// uses — the wall clock never joins, and `clock.mode: fixed` repos get
|
|
240
|
+
// deterministic audit entries.
|
|
241
|
+
const now = clockFromConfig(config).now();
|
|
242
|
+
const maxDurationMs = (config.disposition?.maxDays ?? DISPOSITION_MAX_DAYS) * 86_400_000;
|
|
243
|
+
const located = locateBehaviorDisposition(io, config, target) ?? locateCoverageDisposition(io, config, target);
|
|
244
|
+
if (located === null) {
|
|
245
|
+
// The target must name something the policy actually declares: an
|
|
246
|
+
// extend against a typo would silently never apply.
|
|
247
|
+
const known = knownDispositionTargets(io, config);
|
|
248
|
+
const candidates = [...known.endpoints, ...known.tables];
|
|
249
|
+
if (candidates.length === 0) {
|
|
250
|
+
throw new UsageError(`disposition extend: no endpoint or table named '${target}' — the behaviorPolicy and ` +
|
|
251
|
+
'coveragePolicy documents declare no disposition targets at all');
|
|
252
|
+
}
|
|
253
|
+
const suggestions = closeMatches(candidates, target);
|
|
254
|
+
throw new UsageError(`disposition extend: no endpoint or table named '${target}'` +
|
|
255
|
+
(suggestions.length > 0
|
|
256
|
+
? ` — policy targets: ${suggestions.join(', ')}`
|
|
257
|
+
: ` — policy targets: ${candidates.slice(0, 5).join(', ')}`));
|
|
258
|
+
}
|
|
259
|
+
// A bare date means UTC midnight of that day (waiver convention), and
|
|
260
|
+
// the normalization is printed verbatim, never silent.
|
|
261
|
+
const expiresAt = rawExpires !== undefined && DATE_ONLY.test(rawExpires)
|
|
262
|
+
? `${rawExpires}T00:00:00.000Z`
|
|
263
|
+
: rawExpires;
|
|
264
|
+
const judgment = dispositionExpiry({ expiresAt }, { now, maxDurationMs });
|
|
265
|
+
if (judgment.state === 'expired') {
|
|
266
|
+
throw new UsageError(`disposition extend: --expires '${expiresAt}' is not in the future (injected run clock: ${now}) — ` +
|
|
267
|
+
'an extension that is expired at creation would block, not extend');
|
|
268
|
+
}
|
|
269
|
+
if (judgment.state === 'over-max') {
|
|
270
|
+
throw new UsageError(`disposition extend: --expires '${expiresAt}' ${judgment.detail} — ` +
|
|
271
|
+
'shorten it or raise `disposition.maxDays` in .gateforge.yml (a trusted-policy edit the owner re-approves)');
|
|
272
|
+
}
|
|
273
|
+
// The updated disposition (previous fields + new expiry + the audit
|
|
274
|
+
// entry) is validated through the production schema, and the edited
|
|
275
|
+
// document through the production document schema, BEFORE anything is
|
|
276
|
+
// written — a fail-closed edit, never a half-written policy.
|
|
277
|
+
const extension = {
|
|
278
|
+
at: now,
|
|
279
|
+
by: owner,
|
|
280
|
+
reason: reason,
|
|
281
|
+
previousExpiresAt: located.previousExpiresAt,
|
|
282
|
+
};
|
|
283
|
+
const updatedDisposition = {
|
|
284
|
+
...located.previous,
|
|
285
|
+
expiresAt,
|
|
286
|
+
extensions: [...(located.previous.extensions ?? []), extension],
|
|
287
|
+
};
|
|
288
|
+
const parsed = located.isBehavior
|
|
289
|
+
? BehaviorDispositionSchema.safeParse(updatedDisposition)
|
|
290
|
+
: CoverageDispositionSchema.safeParse(updatedDisposition);
|
|
291
|
+
if (!parsed.success) {
|
|
292
|
+
throw new UsageError(`disposition extend: updated disposition is invalid: ${firstIssue(parsed.error)}`);
|
|
293
|
+
}
|
|
294
|
+
located.dispositionNode.set('expiresAt', expiresAt);
|
|
295
|
+
located.dispositionNode.set('extensions', updatedDisposition.extensions);
|
|
296
|
+
const updatedText = stringifyYaml(located.document);
|
|
297
|
+
const edited = parseYaml(updatedText);
|
|
298
|
+
const documentValid = located.isBehavior
|
|
299
|
+
? BehaviorPolicySchema.safeParse(edited)
|
|
300
|
+
: GateforgeConfigSchema.safeParse(edited);
|
|
301
|
+
if (!documentValid.success) {
|
|
302
|
+
throw new UsageError(`disposition extend: the edited ${located.documentLabel} would not load: ${firstIssue(documentValid.error)}`);
|
|
303
|
+
}
|
|
304
|
+
writeFileSync(located.documentPath, updatedText, 'utf8');
|
|
305
|
+
const remainingDays = Math.max(0, Math.ceil((Date.parse(expiresAt) - Date.parse(now)) / 86_400_000));
|
|
306
|
+
writeLine(io.stdout, `disposition extended: ${located.targetLabel} in ${located.documentLabel}`);
|
|
307
|
+
writeLine(io.stdout, ` expires: ${located.previousExpiresAt} -> ${expiresAt} (in ${String(remainingDays)} day${remainingDays === 1 ? '' : 's'})`);
|
|
308
|
+
writeLine(io.stdout, ` recorded: at=${extension.at} by=${extension.by}`);
|
|
309
|
+
writeLine(io.stdout, ` reason: ${extension.reason}`);
|
|
310
|
+
writeLine(io.stdout, 'note: the policy changed — this edit participates in the trusted policy digest, so the pinned digest no\n' +
|
|
311
|
+
' longer matches and the gate refuses the revision until the owner re-approves it through the existing\n' +
|
|
312
|
+
' digest/pin flow (`gateforge enforcement pin --pin-file PATH --confirm`, outside the repo). This command\n' +
|
|
313
|
+
' never pins and never approves a digest.');
|
|
314
|
+
return 0;
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=disposition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"disposition.js","sourceRoot":"","sources":["../../src/commands/disposition.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,iBAAiB,GAIlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,KAAK,EACL,KAAK,EACL,KAAK,IAAI,SAAS,EAClB,aAAa,EACb,SAAS,IAAI,aAAa,GAG3B,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE/D,MAAM,CAAC,MAAM,iBAAiB,GAC5B,yFAAyF;IACzF,wCAAwC;IACxC,0FAA0F;IAC1F,4FAA4F;IAC5F,yFAAyF;IACzF,wFAAwF;IACxF,mBAA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AM,EACT,2GAA2G;QACzG,0GAA0G;QAC1G,6GAA6G;QAC7G,2CAA2C,CAC9C,CAAC;IACF,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAyDnC,eAAO,MAAM,UAAU,QAOV,CAAC;AAEd,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,qeAY7B,CAAC;AAGF,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,QAMQ,CAAC;AAyLxC;;;GAGG;AACH;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,sgBAezC,CAAC;AAEF,eAAO,MAAM,iBAAiB,smDAsC7B,CAAC;AA8CF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,MAAM,CAyBR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,MAAM,CAoCR;
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAoDA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,UAAU,CAAC;AAyDnC,eAAO,MAAM,UAAU,QAOV,CAAC;AAEd,qEAAqE;AACrE,eAAO,MAAM,iBAAiB,qeAY7B,CAAC;AAGF,iEAAiE;AACjE,eAAO,MAAM,kBAAkB,QAMQ,CAAC;AAyLxC;;;GAGG;AACH;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,sgBAezC,CAAC;AAEF,eAAO,MAAM,iBAAiB,smDAsC7B,CAAC;AA8CF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,MAAM,CAyBR;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,MAAM,CAoCR;AAwtCD;;;;;;;;;GASG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAgwBlF"}
|
package/dist/commands/init.js
CHANGED
|
@@ -647,6 +647,10 @@ You are gated by Gateforge. Work one blocking item at a time.
|
|
|
647
647
|
baselines, or plugin lists to make the gate pass. Those are
|
|
648
648
|
owner-controlled; an agent edit never authorizes weaker checks.
|
|
649
649
|
- Coverage dispositions are owner acts. Strict-E2E waivers are not proof.
|
|
650
|
+
- Dispositions may carry an \`expiresAt\` timer: once it passes the
|
|
651
|
+
disposition is void and the gate blocks with \`DISPOSITION_EXPIRED\`
|
|
652
|
+
until the owner renews it with \`gateforge disposition extend\`.
|
|
653
|
+
Extending is an owner act, like every other policy edit.
|
|
650
654
|
|
|
651
655
|
## Capability gaps
|
|
652
656
|
|