@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
|
@@ -0,0 +1,425 @@
|
|
|
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, canonicalJson, 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.\n' +
|
|
35
|
+
'usage: gateforge disposition list [--json]\n' +
|
|
36
|
+
' Every disposition the two policy documents declare (behaviorPolicy endpoints\n' +
|
|
37
|
+
" and coveragePolicy tables) with surface, id, kind, reason, expiresAt and the\n" +
|
|
38
|
+
' judged state (active/expired/no-expiry) and what an active disposition excuses\n' +
|
|
39
|
+
' (`rule-obligations`, `persistence`, or none). Read-only: reads the documents, runs\n' +
|
|
40
|
+
' nothing, writes nothing.';
|
|
41
|
+
/** Flags the command accepts (plus the implicit `help`). */
|
|
42
|
+
const DISPOSITION_FLAGS = ['owner', 'reason', 'expires', 'help'];
|
|
43
|
+
/** A bare `--expires` date means UTC midnight of that day (waiver convention). */
|
|
44
|
+
const DATE_ONLY = /^\d{4}-\d{2}-\d{2}$/;
|
|
45
|
+
/** First zod issue of a document validation, as one readable line. */
|
|
46
|
+
function firstIssue(error) {
|
|
47
|
+
const issue = error.issues[0];
|
|
48
|
+
return issue === undefined ? 'unknown' : `${issue.path.join('.') || '<document>'}: ${issue.message}`;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Refuses the two unusable states of a FOUND disposition: absent (the
|
|
52
|
+
* target has no disposition at all) and timer-less (the audit entry's
|
|
53
|
+
* `previousExpiresAt` must honestly name the replaced expiry, so a
|
|
54
|
+
* disposition without an `expiresAt` has nothing to extend).
|
|
55
|
+
*/
|
|
56
|
+
function requireExpiringDisposition(disposition, targetLabel) {
|
|
57
|
+
if (disposition === undefined) {
|
|
58
|
+
throw new UsageError(`disposition extend: ${targetLabel} has no owner disposition to extend — record one in the policy first`);
|
|
59
|
+
}
|
|
60
|
+
if (disposition.expiresAt === undefined) {
|
|
61
|
+
throw new UsageError(`disposition extend: ${targetLabel} has no disposition \`expiresAt\` to extend — ` +
|
|
62
|
+
'a disposition without a timer stands as written; record an expiresAt by editing the policy');
|
|
63
|
+
}
|
|
64
|
+
// Both unusable states threw above, so the narrowed shape is proven at
|
|
65
|
+
// runtime; TS cannot express that narrowing on an unresolved generic.
|
|
66
|
+
return disposition;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The disposition mapping node of the endpoint/table at `index`, read
|
|
70
|
+
* off the comment-preserving parse of the SAME text the typed view was
|
|
71
|
+
* validated from.
|
|
72
|
+
*/
|
|
73
|
+
function dispositionNodeAt(document, indexPath, index, targetLabel) {
|
|
74
|
+
let node = document.contents;
|
|
75
|
+
for (const key of indexPath) {
|
|
76
|
+
node = isMap(node) ? node.get(key, true) : null;
|
|
77
|
+
}
|
|
78
|
+
const item = isSeq(node) ? node.items[index] : null;
|
|
79
|
+
const disposition = isMap(item) ? item.get('disposition', true) : null;
|
|
80
|
+
if (!isMap(disposition)) {
|
|
81
|
+
throw new UsageError(`disposition extend: ${targetLabel} disposition is not a YAML mapping — fix the document by hand`);
|
|
82
|
+
}
|
|
83
|
+
return disposition;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Locates the named endpoint in the behaviorPolicy document. Returns
|
|
87
|
+
* null when the id names no endpoint there; throws when the endpoint is
|
|
88
|
+
* found but its disposition cannot be extended.
|
|
89
|
+
*
|
|
90
|
+
* Args:
|
|
91
|
+
* io: process context (cwd resolves the repo-relative document path).
|
|
92
|
+
* config: validated `.gateforge.yml`.
|
|
93
|
+
* target: the endpoint id to find (`resourceId`).
|
|
94
|
+
*
|
|
95
|
+
* Returns:
|
|
96
|
+
* LocatedDisposition | null.
|
|
97
|
+
*/
|
|
98
|
+
function locateBehaviorDisposition(io, config, target) {
|
|
99
|
+
if (config.behaviorPolicy === undefined)
|
|
100
|
+
return null;
|
|
101
|
+
const documentPath = resolveRepoPath(io.cwd, config.behaviorPolicy);
|
|
102
|
+
let raw;
|
|
103
|
+
try {
|
|
104
|
+
raw = readFileSync(documentPath, 'utf8');
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
const code = error.code ?? 'UNKNOWN';
|
|
108
|
+
throw new UsageError(`disposition extend: cannot read behavior policy file '${documentPath}' (${code})`);
|
|
109
|
+
}
|
|
110
|
+
// The typed lookup runs against the PRODUCTION schema, so the edit
|
|
111
|
+
// never reasons about an unvalidated document.
|
|
112
|
+
const parsed = BehaviorPolicySchema.safeParse(parseYaml(raw));
|
|
113
|
+
if (!parsed.success) {
|
|
114
|
+
throw new UsageError(`disposition extend: behavior policy '${config.behaviorPolicy}' is invalid: ${firstIssue(parsed.error)}`);
|
|
115
|
+
}
|
|
116
|
+
const index = parsed.data.endpoints.findIndex((endpoint) => endpoint.resourceId === target);
|
|
117
|
+
const endpoint = parsed.data.endpoints[index];
|
|
118
|
+
if (index === -1 || endpoint === undefined)
|
|
119
|
+
return null;
|
|
120
|
+
const previous = requireExpiringDisposition(endpoint.disposition, `endpoint '${target}'`);
|
|
121
|
+
const document = parseDocument(raw);
|
|
122
|
+
return {
|
|
123
|
+
isBehavior: true,
|
|
124
|
+
previous,
|
|
125
|
+
previousExpiresAt: previous.expiresAt,
|
|
126
|
+
documentPath,
|
|
127
|
+
documentLabel: `behavior policy '${config.behaviorPolicy}'`,
|
|
128
|
+
targetLabel: `endpoint '${target}'`,
|
|
129
|
+
document,
|
|
130
|
+
dispositionNode: dispositionNodeAt(document, ['endpoints'], index, `endpoint '${target}'`),
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Locates the named table in the `coveragePolicy` section of
|
|
135
|
+
* `.gateforge.yml` (the config the command already loaded, validated).
|
|
136
|
+
* Returns null when the name names no table there; throws when the
|
|
137
|
+
* table is found but its disposition cannot be extended.
|
|
138
|
+
*
|
|
139
|
+
* Args:
|
|
140
|
+
* io: process context.
|
|
141
|
+
* config: validated `.gateforge.yml`.
|
|
142
|
+
* target: the table name to find.
|
|
143
|
+
*
|
|
144
|
+
* Returns:
|
|
145
|
+
* LocatedDisposition | null.
|
|
146
|
+
*/
|
|
147
|
+
function locateCoverageDisposition(io, config, target) {
|
|
148
|
+
if (config.coveragePolicy === undefined)
|
|
149
|
+
return null;
|
|
150
|
+
const documentPath = join(io.cwd, '.gateforge.yml');
|
|
151
|
+
const raw = readFileSync(documentPath, 'utf8');
|
|
152
|
+
const index = config.coveragePolicy.tables.findIndex((table) => table.name === target);
|
|
153
|
+
const table = config.coveragePolicy.tables[index];
|
|
154
|
+
if (index === -1 || table === undefined)
|
|
155
|
+
return null;
|
|
156
|
+
const previous = requireExpiringDisposition(table.disposition, `table '${target}'`);
|
|
157
|
+
const document = parseDocument(raw);
|
|
158
|
+
return {
|
|
159
|
+
isBehavior: false,
|
|
160
|
+
previous,
|
|
161
|
+
previousExpiresAt: previous.expiresAt,
|
|
162
|
+
documentPath,
|
|
163
|
+
documentLabel: `config '.gateforge.yml' coveragePolicy`,
|
|
164
|
+
targetLabel: `table '${target}'`,
|
|
165
|
+
document,
|
|
166
|
+
dispositionNode: dispositionNodeAt(document, ['coveragePolicy', 'tables'], index, `table '${target}'`),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Every disposition-bearing id the two documents declare, for the
|
|
171
|
+
* unknown-target diagnostic.
|
|
172
|
+
*/
|
|
173
|
+
function knownDispositionTargets(io, config) {
|
|
174
|
+
const endpoints = [];
|
|
175
|
+
const tables = [];
|
|
176
|
+
if (config.behaviorPolicy !== undefined) {
|
|
177
|
+
try {
|
|
178
|
+
const parsed = BehaviorPolicySchema.safeParse(parseYaml(readFileSync(resolveRepoPath(io.cwd, config.behaviorPolicy), 'utf8')));
|
|
179
|
+
if (parsed.success) {
|
|
180
|
+
for (const endpoint of parsed.data.endpoints)
|
|
181
|
+
endpoints.push(endpoint.resourceId);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
// The location error above already named the unreadable document.
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (config.coveragePolicy !== undefined) {
|
|
189
|
+
for (const table of config.coveragePolicy.tables)
|
|
190
|
+
tables.push(table.name);
|
|
191
|
+
}
|
|
192
|
+
return { endpoints, tables };
|
|
193
|
+
}
|
|
194
|
+
/** Cheap close-match suggestions for an unresolvable target id. */
|
|
195
|
+
function closeMatches(known, target) {
|
|
196
|
+
const needle = target.toLowerCase();
|
|
197
|
+
return known
|
|
198
|
+
.filter((candidate) => {
|
|
199
|
+
const haystack = candidate.toLowerCase();
|
|
200
|
+
return haystack.includes(needle) || needle.includes(haystack);
|
|
201
|
+
})
|
|
202
|
+
.slice(0, 5);
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Reads every disposition the two policy documents declare and lists
|
|
206
|
+
* them with the judged expiry state. Strictly READ-ONLY: the documents
|
|
207
|
+
* are parsed and validated, nothing is written and no pipeline runs.
|
|
208
|
+
*
|
|
209
|
+
* Args:
|
|
210
|
+
* io: process context.
|
|
211
|
+
* asJson: print canonical JSON instead of text lines.
|
|
212
|
+
*
|
|
213
|
+
* Returns:
|
|
214
|
+
* number: exit code (0 on success).
|
|
215
|
+
* @throws UsageError (exit 2) when a declared document cannot be read
|
|
216
|
+
* or is invalid — a disposition list of unvalidated policy would lie.
|
|
217
|
+
*/
|
|
218
|
+
async function dispositionList(io, asJson) {
|
|
219
|
+
const config = loadConfigAt(io.cwd);
|
|
220
|
+
// `clockFromConfig` is the same injected run clock every evaluator
|
|
221
|
+
// uses — `clock.mode: fixed` repos get deterministic state output.
|
|
222
|
+
const now = clockFromConfig(config).now();
|
|
223
|
+
const maxDurationMs = (config.disposition?.maxDays ?? DISPOSITION_MAX_DAYS) * 86_400_000;
|
|
224
|
+
const entries = [];
|
|
225
|
+
if (config.behaviorPolicy !== undefined) {
|
|
226
|
+
const documentPath = resolveRepoPath(io.cwd, config.behaviorPolicy);
|
|
227
|
+
let raw;
|
|
228
|
+
try {
|
|
229
|
+
raw = readFileSync(documentPath, 'utf8');
|
|
230
|
+
}
|
|
231
|
+
catch (error) {
|
|
232
|
+
const code = error.code ?? 'UNKNOWN';
|
|
233
|
+
throw new UsageError(`disposition list: cannot read behavior policy file '${documentPath}' (${code})`);
|
|
234
|
+
}
|
|
235
|
+
const parsed = BehaviorPolicySchema.safeParse(parseYaml(raw));
|
|
236
|
+
if (!parsed.success) {
|
|
237
|
+
throw new UsageError(`disposition list: behavior policy '${config.behaviorPolicy}' is invalid: ${firstIssue(parsed.error)}`);
|
|
238
|
+
}
|
|
239
|
+
for (const endpoint of parsed.data.endpoints) {
|
|
240
|
+
const disposition = endpoint.disposition;
|
|
241
|
+
if (disposition === undefined)
|
|
242
|
+
continue;
|
|
243
|
+
entries.push({
|
|
244
|
+
surface: 'endpoint',
|
|
245
|
+
id: endpoint.resourceId,
|
|
246
|
+
kind: disposition.kind,
|
|
247
|
+
reason: disposition.reason,
|
|
248
|
+
expiresAt: disposition.expiresAt ?? null,
|
|
249
|
+
state: dispositionExpiry(disposition, { now, maxDurationMs }).state,
|
|
250
|
+
excuses: dispositionExcuse('endpoint', disposition.kind, dispositionExpiry(disposition, { now, maxDurationMs }).state),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (config.coveragePolicy !== undefined) {
|
|
255
|
+
for (const table of config.coveragePolicy.tables) {
|
|
256
|
+
const disposition = table.disposition;
|
|
257
|
+
if (disposition === undefined)
|
|
258
|
+
continue;
|
|
259
|
+
entries.push({
|
|
260
|
+
surface: 'table',
|
|
261
|
+
id: table.name,
|
|
262
|
+
kind: disposition.kind,
|
|
263
|
+
reason: disposition.reason ?? '',
|
|
264
|
+
expiresAt: disposition.expiresAt ?? null,
|
|
265
|
+
state: dispositionExpiry(disposition, { now, maxDurationMs }).state,
|
|
266
|
+
excuses: dispositionExcuse('table', disposition.kind, dispositionExpiry(disposition, { now, maxDurationMs }).state),
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
entries.sort((a, b) => compareListSurface(a.surface, b.surface) ||
|
|
271
|
+
(a.id < b.id ? -1 : a.id > b.id ? 1 : 0));
|
|
272
|
+
if (asJson) {
|
|
273
|
+
writeLine(io.stdout, canonicalJson(entries));
|
|
274
|
+
return 0;
|
|
275
|
+
}
|
|
276
|
+
writeLine(io.stdout, `dispositions (${String(entries.length)}):`);
|
|
277
|
+
for (const entry of entries) {
|
|
278
|
+
writeLine(io.stdout, ` ${entry.surface} ${entry.id} kind=${entry.kind} state=${entry.state}` +
|
|
279
|
+
` expires=${entry.expiresAt ?? 'none'} excused=${entry.excuses ?? 'none'}`);
|
|
280
|
+
writeLine(io.stdout, ` reason: ${entry.reason}`);
|
|
281
|
+
}
|
|
282
|
+
return 0;
|
|
283
|
+
}
|
|
284
|
+
/** Stable surface order: endpoints before tables. */
|
|
285
|
+
function compareListSurface(a, b) {
|
|
286
|
+
if (a === b)
|
|
287
|
+
return 0;
|
|
288
|
+
return a === 'endpoint' ? -1 : 1;
|
|
289
|
+
}
|
|
290
|
+
/** What an active disposition excuses. Expired and operational-only excuse nothing. */
|
|
291
|
+
function dispositionExcuse(surface, kind, state) {
|
|
292
|
+
if (state !== 'active' && state !== 'no-expiry')
|
|
293
|
+
return null;
|
|
294
|
+
if (surface === 'endpoint' && kind === 'out-of-scope')
|
|
295
|
+
return 'rule-obligations';
|
|
296
|
+
if (surface === 'table')
|
|
297
|
+
return 'persistence';
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Runs the `disposition` subcommand (`extend`, `list`).
|
|
302
|
+
*
|
|
303
|
+
* Args:
|
|
304
|
+
* io: process context.
|
|
305
|
+
* argv: flags after the subcommand.
|
|
306
|
+
*
|
|
307
|
+
* Returns:
|
|
308
|
+
* number: exit code — 0 disposition extended/listed, 2 usage/validation.
|
|
309
|
+
* @throws UsageError (exit 2) on any usage or fail-closed problem.
|
|
310
|
+
*/
|
|
311
|
+
export async function dispositionCommand(io, argv) {
|
|
312
|
+
const { options, positionals } = parseArgs(argv);
|
|
313
|
+
if (options['help'] === true) {
|
|
314
|
+
writeLine(io.stdout, DISPOSITION_USAGE);
|
|
315
|
+
return 0;
|
|
316
|
+
}
|
|
317
|
+
const subcommand = positionals[0];
|
|
318
|
+
if (subcommand === 'list') {
|
|
319
|
+
if (positionals.length !== 1) {
|
|
320
|
+
throw new UsageError(`disposition list takes no target (${DISPOSITION_USAGE})`);
|
|
321
|
+
}
|
|
322
|
+
rejectUnknownFlags(options, ['json', 'help'], DISPOSITION_USAGE);
|
|
323
|
+
return dispositionList(io, options['json'] === true);
|
|
324
|
+
}
|
|
325
|
+
if (subcommand !== 'extend') {
|
|
326
|
+
throw new UsageError(`disposition requires the subcommand 'extend' or 'list' as its first argument (${DISPOSITION_USAGE})`);
|
|
327
|
+
}
|
|
328
|
+
const target = positionals[1];
|
|
329
|
+
if (target === undefined || positionals.length > 2) {
|
|
330
|
+
throw new UsageError(`disposition extend requires exactly one <endpoint-id|table> target (${DISPOSITION_USAGE})`);
|
|
331
|
+
}
|
|
332
|
+
rejectUnknownFlags(options, DISPOSITION_FLAGS, DISPOSITION_USAGE);
|
|
333
|
+
const owner = stringFlag(options, 'owner');
|
|
334
|
+
const reason = stringFlag(options, 'reason');
|
|
335
|
+
const rawExpires = stringFlag(options, 'expires');
|
|
336
|
+
const missing = [
|
|
337
|
+
['owner', owner],
|
|
338
|
+
['reason', reason],
|
|
339
|
+
['expires', rawExpires],
|
|
340
|
+
]
|
|
341
|
+
.filter(([, value]) => value === undefined)
|
|
342
|
+
.map(([name]) => `'--${name}'`);
|
|
343
|
+
if (missing.length > 0) {
|
|
344
|
+
throw new UsageError(`disposition extend requires ${missing.join(', ')} (${DISPOSITION_USAGE})`);
|
|
345
|
+
}
|
|
346
|
+
const config = loadConfigAt(io.cwd);
|
|
347
|
+
// `clockFromConfig` is the same injected run clock every evaluator
|
|
348
|
+
// uses — the wall clock never joins, and `clock.mode: fixed` repos get
|
|
349
|
+
// deterministic audit entries.
|
|
350
|
+
const now = clockFromConfig(config).now();
|
|
351
|
+
const maxDurationMs = (config.disposition?.maxDays ?? DISPOSITION_MAX_DAYS) * 86_400_000;
|
|
352
|
+
const located = locateBehaviorDisposition(io, config, target) ?? locateCoverageDisposition(io, config, target);
|
|
353
|
+
if (located === null) {
|
|
354
|
+
// The target must name something the policy actually declares: an
|
|
355
|
+
// extend against a typo would silently never apply.
|
|
356
|
+
const known = knownDispositionTargets(io, config);
|
|
357
|
+
const candidates = [...known.endpoints, ...known.tables];
|
|
358
|
+
if (candidates.length === 0) {
|
|
359
|
+
throw new UsageError(`disposition extend: no endpoint or table named '${target}' — the behaviorPolicy and ` +
|
|
360
|
+
'coveragePolicy documents declare no disposition targets at all');
|
|
361
|
+
}
|
|
362
|
+
const suggestions = closeMatches(candidates, target);
|
|
363
|
+
throw new UsageError(`disposition extend: no endpoint or table named '${target}'` +
|
|
364
|
+
(suggestions.length > 0
|
|
365
|
+
? ` — policy targets: ${suggestions.join(', ')}`
|
|
366
|
+
: ` — policy targets: ${candidates.slice(0, 5).join(', ')}`));
|
|
367
|
+
}
|
|
368
|
+
// A bare date means UTC midnight of that day (waiver convention), and
|
|
369
|
+
// the normalization is printed verbatim, never silent.
|
|
370
|
+
const expiresAt = rawExpires !== undefined && DATE_ONLY.test(rawExpires)
|
|
371
|
+
? `${rawExpires}T00:00:00.000Z`
|
|
372
|
+
: rawExpires;
|
|
373
|
+
const judgment = dispositionExpiry({ expiresAt }, { now, maxDurationMs });
|
|
374
|
+
if (judgment.state === 'expired') {
|
|
375
|
+
throw new UsageError(`disposition extend: --expires '${expiresAt}' is not in the future (injected run clock: ${now}) — ` +
|
|
376
|
+
'an extension that is expired at creation would block, not extend');
|
|
377
|
+
}
|
|
378
|
+
if (judgment.state === 'over-max') {
|
|
379
|
+
throw new UsageError(`disposition extend: --expires '${expiresAt}' ${judgment.detail} — ` +
|
|
380
|
+
'shorten it or raise `disposition.maxDays` in .gateforge.yml (a trusted-policy edit the owner re-approves)');
|
|
381
|
+
}
|
|
382
|
+
// The updated disposition (previous fields + new expiry + the audit
|
|
383
|
+
// entry) is validated through the production schema, and the edited
|
|
384
|
+
// document through the production document schema, BEFORE anything is
|
|
385
|
+
// written — a fail-closed edit, never a half-written policy.
|
|
386
|
+
const extension = {
|
|
387
|
+
at: now,
|
|
388
|
+
by: owner,
|
|
389
|
+
reason: reason,
|
|
390
|
+
previousExpiresAt: located.previousExpiresAt,
|
|
391
|
+
};
|
|
392
|
+
const updatedDisposition = {
|
|
393
|
+
...located.previous,
|
|
394
|
+
expiresAt,
|
|
395
|
+
extensions: [...(located.previous.extensions ?? []), extension],
|
|
396
|
+
};
|
|
397
|
+
const parsed = located.isBehavior
|
|
398
|
+
? BehaviorDispositionSchema.safeParse(updatedDisposition)
|
|
399
|
+
: CoverageDispositionSchema.safeParse(updatedDisposition);
|
|
400
|
+
if (!parsed.success) {
|
|
401
|
+
throw new UsageError(`disposition extend: updated disposition is invalid: ${firstIssue(parsed.error)}`);
|
|
402
|
+
}
|
|
403
|
+
located.dispositionNode.set('expiresAt', expiresAt);
|
|
404
|
+
located.dispositionNode.set('extensions', updatedDisposition.extensions);
|
|
405
|
+
const updatedText = stringifyYaml(located.document);
|
|
406
|
+
const edited = parseYaml(updatedText);
|
|
407
|
+
const documentValid = located.isBehavior
|
|
408
|
+
? BehaviorPolicySchema.safeParse(edited)
|
|
409
|
+
: GateforgeConfigSchema.safeParse(edited);
|
|
410
|
+
if (!documentValid.success) {
|
|
411
|
+
throw new UsageError(`disposition extend: the edited ${located.documentLabel} would not load: ${firstIssue(documentValid.error)}`);
|
|
412
|
+
}
|
|
413
|
+
writeFileSync(located.documentPath, updatedText, 'utf8');
|
|
414
|
+
const remainingDays = Math.max(0, Math.ceil((Date.parse(expiresAt) - Date.parse(now)) / 86_400_000));
|
|
415
|
+
writeLine(io.stdout, `disposition extended: ${located.targetLabel} in ${located.documentLabel}`);
|
|
416
|
+
writeLine(io.stdout, ` expires: ${located.previousExpiresAt} -> ${expiresAt} (in ${String(remainingDays)} day${remainingDays === 1 ? '' : 's'})`);
|
|
417
|
+
writeLine(io.stdout, ` recorded: at=${extension.at} by=${extension.by}`);
|
|
418
|
+
writeLine(io.stdout, ` reason: ${extension.reason}`);
|
|
419
|
+
writeLine(io.stdout, 'note: the policy changed — this edit participates in the trusted policy digest, so the pinned digest no\n' +
|
|
420
|
+
' longer matches and the gate refuses the revision until the owner re-approves it through the existing\n' +
|
|
421
|
+
' digest/pin flow (`gateforge enforcement pin --pin-file PATH --confirm`, outside the repo). This command\n' +
|
|
422
|
+
' never pins and never approves a digest.');
|
|
423
|
+
return 0;
|
|
424
|
+
}
|
|
425
|
+
//# 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,aAAa,EACb,iBAAiB,GAKlB,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;IAC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
|
|
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,QAOQ,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
|
@@ -73,6 +73,7 @@ resources: []
|
|
|
73
73
|
export const BEHAVIOR_CHECKLIST = [
|
|
74
74
|
'behavior setup is NOT complete: this scaffold only enables the profile',
|
|
75
75
|
'next: run `gateforge check` — every discovered endpoint is listed as ENDPOINT_BEHAVIOR_MISSING',
|
|
76
|
+
'next: run `gateforge behavior draft` — it prints the paste-ready endpoint skeleton (read-only; it never writes)',
|
|
76
77
|
'next: for each endpoint, declare cases (or an owner disposition) in .gateforge/behavior.yml',
|
|
77
78
|
'next: map each case to a test with `tests mark --case`, then prove it through the witness',
|
|
78
79
|
'note: strong HTTP contracts stay blocking until witness-produced case evidence exists',
|
|
@@ -647,6 +648,10 @@ You are gated by Gateforge. Work one blocking item at a time.
|
|
|
647
648
|
baselines, or plugin lists to make the gate pass. Those are
|
|
648
649
|
owner-controlled; an agent edit never authorizes weaker checks.
|
|
649
650
|
- Coverage dispositions are owner acts. Strict-E2E waivers are not proof.
|
|
651
|
+
- Dispositions may carry an \`expiresAt\` timer: once it passes the
|
|
652
|
+
disposition is void and the gate blocks with \`DISPOSITION_EXPIRED\`
|
|
653
|
+
until the owner renews it with \`gateforge disposition extend\`.
|
|
654
|
+
Extending is an owner act, like every other policy edit.
|
|
650
655
|
|
|
651
656
|
## Capability gaps
|
|
652
657
|
|