@gate-forge/cli 0.9.0 → 0.10.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/README.md +12 -5
- package/dist/cache-exclusions.d.ts +20 -13
- package/dist/cache-exclusions.d.ts.map +1 -1
- package/dist/cache-exclusions.js +47 -33
- package/dist/cache-exclusions.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +11 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/adopt.d.ts +3 -2
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +38 -5
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/blocking.d.ts +20 -1
- package/dist/commands/blocking.d.ts.map +1 -1
- package/dist/commands/blocking.js +105 -10
- package/dist/commands/blocking.js.map +1 -1
- package/dist/commands/check.d.ts +34 -0
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +93 -7
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/classify.d.ts +1 -0
- package/dist/commands/classify.d.ts.map +1 -1
- package/dist/commands/classify.js +230 -14
- package/dist/commands/classify.js.map +1 -1
- package/dist/commands/common.d.ts +6 -1
- package/dist/commands/common.d.ts.map +1 -1
- package/dist/commands/common.js +8 -1
- package/dist/commands/common.js.map +1 -1
- package/dist/commands/enforcement.d.ts +9 -1
- package/dist/commands/enforcement.d.ts.map +1 -1
- package/dist/commands/enforcement.js +448 -13
- package/dist/commands/enforcement.js.map +1 -1
- package/dist/commands/init.d.ts +20 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +296 -93
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/migrate.d.ts +14 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +177 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +7 -2
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/pre-commit.d.ts.map +1 -1
- package/dist/commands/pre-commit.js +62 -19
- package/dist/commands/pre-commit.js.map +1 -1
- package/dist/commands/tests.d.ts.map +1 -1
- package/dist/commands/tests.js +54 -24
- package/dist/commands/tests.js.map +1 -1
- package/dist/docs-exclusions.d.ts +32 -5
- package/dist/docs-exclusions.d.ts.map +1 -1
- package/dist/docs-exclusions.js +60 -26
- package/dist/docs-exclusions.js.map +1 -1
- package/dist/evidence-config-text.d.ts +57 -0
- package/dist/evidence-config-text.d.ts.map +1 -0
- package/dist/evidence-config-text.js +263 -0
- package/dist/evidence-config-text.js.map +1 -0
- package/dist/execution.d.ts +51 -8
- package/dist/execution.d.ts.map +1 -1
- package/dist/execution.js +61 -29
- package/dist/execution.js.map +1 -1
- package/dist/gateforge-owned.d.ts +30 -5
- package/dist/gateforge-owned.d.ts.map +1 -1
- package/dist/gateforge-owned.js +136 -18
- package/dist/gateforge-owned.js.map +1 -1
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +15 -0
- package/dist/git-hooks.js.map +1 -1
- package/dist/input-snapshot.d.ts.map +1 -1
- package/dist/input-snapshot.js +2 -6
- package/dist/input-snapshot.js.map +1 -1
- package/dist/legacy-exclusion-paths.d.ts +28 -0
- package/dist/legacy-exclusion-paths.d.ts.map +1 -0
- package/dist/legacy-exclusion-paths.js +48 -0
- package/dist/legacy-exclusion-paths.js.map +1 -0
- package/dist/providers.d.ts +54 -0
- package/dist/providers.d.ts.map +1 -1
- package/dist/providers.js +101 -0
- package/dist/providers.js.map +1 -1
- package/dist/staged-candidate.d.ts.map +1 -1
- package/dist/staged-candidate.js +2 -1
- package/dist/staged-candidate.js.map +1 -1
- package/dist/trusted-policy.d.ts.map +1 -1
- package/dist/trusted-policy.js +3 -2
- package/dist/trusted-policy.js.map +1 -1
- package/guides/CONNECT-YOUR-PROJECT.md +64 -0
- package/guides/QUICKSTART.md +68 -15
- package/guides/REFERENCE.md +229 -33
- package/guides/TEST-ENVIRONMENT.md +36 -0
- package/guides/UPGRADE-0.8-to-0.9.md +9 -1
- package/guides/UPGRADE-0.9-to-0.10.md +137 -0
- package/package.json +10 -10
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-level writing of `evidence.exclude` into `.gateforge.yml`.
|
|
3
|
+
*
|
|
4
|
+
* The owner's YAML is never re-serialized: an insertion splices lines
|
|
5
|
+
* into the existing text, so every comment, key order, quoting style and
|
|
6
|
+
* hand-written edit survives byte for byte. Only the inserted block is
|
|
7
|
+
* new. This is the same discipline 0.9.2 applies to `classify delete`'s
|
|
8
|
+
* `deleteRules` writer (re-implemented here so this branch carries no
|
|
9
|
+
* dependency on that line).
|
|
10
|
+
*
|
|
11
|
+
* Everything this writes is re-parsed against the pinned schema before
|
|
12
|
+
* it is returned: a text edit that would produce a document this
|
|
13
|
+
* release cannot read back is refused, never written.
|
|
14
|
+
*/
|
|
15
|
+
import { parse as parseYaml } from 'yaml';
|
|
16
|
+
import { parseConfig } from '@gate-forge/core';
|
|
17
|
+
import { UsageError } from './errors.js';
|
|
18
|
+
/** The two lists this writer owns, in the order the schema declares them. */
|
|
19
|
+
const KEYS = ['docs', 'cache'];
|
|
20
|
+
/**
|
|
21
|
+
* Reports whether the document already declares one evidence list, so a
|
|
22
|
+
* caller can tell "never declared" from "declared empty" — the
|
|
23
|
+
* difference between "no owner review needed" and "the owner is changing
|
|
24
|
+
* an approved list".
|
|
25
|
+
*
|
|
26
|
+
* Args:
|
|
27
|
+
* text: the owner's `.gateforge.yml` content.
|
|
28
|
+
* key: `docs` or `cache`.
|
|
29
|
+
*
|
|
30
|
+
* Returns:
|
|
31
|
+
* boolean: true when `evidence.exclude.<key>` is present.
|
|
32
|
+
*/
|
|
33
|
+
export function declaresEvidenceExclude(text, key) {
|
|
34
|
+
const lines = text.replace(/\r\n/g, '\n').split('\n');
|
|
35
|
+
return findKeyBlock(lines, 'evidence', '') !== null && findKeyBlock(lines, 'exclude', ' ') !== null &&
|
|
36
|
+
findKeyBlock(lines, key, ' ') !== null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Locates `key:` at exactly `indent` columns.
|
|
40
|
+
*
|
|
41
|
+
* A blank line, a deeper line and a shallower line all end the search:
|
|
42
|
+
* YAML gives the key's block to the following lines, so the first line
|
|
43
|
+
* that is not part of it starts the next key.
|
|
44
|
+
*
|
|
45
|
+
* Args:
|
|
46
|
+
* lines: document split on newlines.
|
|
47
|
+
* key: the mapping key to find.
|
|
48
|
+
* indent: exact leading-whitespace string the key is nested under.
|
|
49
|
+
*
|
|
50
|
+
* Returns:
|
|
51
|
+
* KeyBlock | null: the located key, or null when absent.
|
|
52
|
+
*/
|
|
53
|
+
function findKeyBlock(lines, key, indent) {
|
|
54
|
+
const prefix = `${indent}${key}:`;
|
|
55
|
+
for (let index = 0; index < lines.length; index += 1) {
|
|
56
|
+
const line = lines[index] ?? '';
|
|
57
|
+
if (!line.startsWith(prefix))
|
|
58
|
+
continue;
|
|
59
|
+
const rest = line.slice(prefix.length);
|
|
60
|
+
// `docs:` owns the rest of the line only when nothing but whitespace
|
|
61
|
+
// or a comment follows; anything else is a key named `docs: x`.
|
|
62
|
+
if (rest.length > 0 && !rest.startsWith(' ') && !rest.startsWith('\t'))
|
|
63
|
+
continue;
|
|
64
|
+
let end = index + 1;
|
|
65
|
+
while (end < lines.length) {
|
|
66
|
+
const candidate = lines[end] ?? '';
|
|
67
|
+
if (candidate.trim() === '') {
|
|
68
|
+
end += 1;
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (candidate.length - candidate.trimStart().length <= indent.length)
|
|
72
|
+
break;
|
|
73
|
+
end += 1;
|
|
74
|
+
}
|
|
75
|
+
// Trailing blank lines belong to whatever comes next, not to this key.
|
|
76
|
+
let blockEnd = end;
|
|
77
|
+
while (blockEnd > index + 1 && (lines[blockEnd - 1] ?? '').trim() === '')
|
|
78
|
+
blockEnd -= 1;
|
|
79
|
+
return { at: index, value: rest.replace(/\s+#.*$/, '').trim(), end: blockEnd };
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
/** Renders a list key and its items at the given indent. */
|
|
84
|
+
function renderList(key, indent, values) {
|
|
85
|
+
if (values.length === 0)
|
|
86
|
+
return [`${indent}${key}: []`];
|
|
87
|
+
return [`${indent}${key}:`, ...values.map((value) => `${indent} - ${JSON.stringify(value)}`)];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Replaces (or inserts) one list inside a located parent block.
|
|
91
|
+
*
|
|
92
|
+
* An existing list is REPLACED, which is what an owner-confirmed change
|
|
93
|
+
* means; an inline value the writer cannot read as a plain list is
|
|
94
|
+
* refused by name instead of being overwritten.
|
|
95
|
+
*
|
|
96
|
+
* Args:
|
|
97
|
+
* lines: document split on newlines (the caller joins it back).
|
|
98
|
+
* parent: the block that owns `key`.
|
|
99
|
+
* parentIndent: the parent's indent string.
|
|
100
|
+
* key: the list key to set.
|
|
101
|
+
* values: the exact list to declare.
|
|
102
|
+
* path: repo-relative document path, named in refusals.
|
|
103
|
+
*
|
|
104
|
+
* Returns:
|
|
105
|
+
* string[]: the spliced lines.
|
|
106
|
+
*/
|
|
107
|
+
function setListWithin(lines, parent, parentIndent, key, values, path) {
|
|
108
|
+
const childIndent = `${parentIndent} `;
|
|
109
|
+
const existing = findKeyBlock(lines, key, childIndent);
|
|
110
|
+
if (existing === null) {
|
|
111
|
+
return [...lines.slice(0, parent.end), ...renderList(key, childIndent, values), ...lines.slice(parent.end)];
|
|
112
|
+
}
|
|
113
|
+
if (existing.value !== '' && existing.value !== '[]') {
|
|
114
|
+
throw new UsageError(`${path} declares ${key} inline as \`${key}: ${existing.value}\`; this command only writes ` +
|
|
115
|
+
`${key} as a list — edit the file by hand`);
|
|
116
|
+
}
|
|
117
|
+
const nonBlank = lines.slice(existing.at + 1, existing.end).filter((line) => line.trim() !== '');
|
|
118
|
+
if (!nonBlank.every((line) => /^\s*-\s/.test(line))) {
|
|
119
|
+
throw new UsageError(`${path} has a ${key} value that is not a list of entries; edit it by hand — ` +
|
|
120
|
+
'this command only writes `- ` items');
|
|
121
|
+
}
|
|
122
|
+
// An inline `[]` and a block list are both a list; both are replaced by
|
|
123
|
+
// the requested one. A trailing comment on the key line survives.
|
|
124
|
+
const keyLine = lines[existing.at] ?? '';
|
|
125
|
+
const rendered = renderList(key, childIndent, values);
|
|
126
|
+
const comment = keyLine.indexOf('#');
|
|
127
|
+
if (comment !== -1)
|
|
128
|
+
rendered[0] = `${rendered[0] ?? ''} ${keyLine.slice(comment)}`;
|
|
129
|
+
return [...lines.slice(0, existing.at), ...rendered, ...lines.slice(existing.end)];
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Sets `evidence.exclude.docs` / `.cache` in `.gateforge.yml` text.
|
|
133
|
+
*
|
|
134
|
+
* Absent lists are inserted; present lists are replaced exactly; an
|
|
135
|
+
* `evidence:` or `exclude:` block this writer cannot extend safely (an
|
|
136
|
+
* inline mapping, a non-list value, an unknown nesting) is refused by
|
|
137
|
+
* name. The result is re-parsed against the pinned schema and its
|
|
138
|
+
* `evidence.exclude` must equal what was asked for, so a hand-rolled
|
|
139
|
+
* text edit that would parse into something else never leaves here.
|
|
140
|
+
*
|
|
141
|
+
* Args:
|
|
142
|
+
* text: the owner's `.gateforge.yml` content.
|
|
143
|
+
* lists: the lists to set; an absent key is left untouched.
|
|
144
|
+
* path: repo-relative document path, named in refusals.
|
|
145
|
+
*
|
|
146
|
+
* Returns:
|
|
147
|
+
* string: the new document text (byte-identical outside the edit).
|
|
148
|
+
*
|
|
149
|
+
* Throws:
|
|
150
|
+
* UsageError: an unextendable document, or a result that does not
|
|
151
|
+
* read back as the requested declarations.
|
|
152
|
+
*/
|
|
153
|
+
export function setEvidenceExclude(text, lists, path) {
|
|
154
|
+
const requested = KEYS.filter((key) => lists[key] !== undefined);
|
|
155
|
+
let lines = text.length === 0 ? [] : text.replace(/\r\n/g, '\n').split('\n');
|
|
156
|
+
if (lines[lines.length - 1] === '')
|
|
157
|
+
lines.pop();
|
|
158
|
+
const evidence = findKeyBlock(lines, 'evidence', '');
|
|
159
|
+
if (evidence !== null && evidence.value !== '') {
|
|
160
|
+
throw new UsageError(`${path} declares evidence inline; this command only appends to an \`evidence:\` block — edit the file by hand`);
|
|
161
|
+
}
|
|
162
|
+
if (evidence === null) {
|
|
163
|
+
// Absent key: append a new top-level block. A document that ends
|
|
164
|
+
// inside an indented block gets one blank line first, so the new key
|
|
165
|
+
// cannot be read as part of that block.
|
|
166
|
+
const last = lines[lines.length - 1] ?? '';
|
|
167
|
+
const separator = last !== '' && /^\s/.test(last) ? [''] : [];
|
|
168
|
+
lines = [...lines, ...separator, 'evidence:', ' exclude:'];
|
|
169
|
+
}
|
|
170
|
+
const evidenceBlock = findKeyBlock(lines, 'evidence', '');
|
|
171
|
+
if (evidenceBlock === null)
|
|
172
|
+
throw new UsageError(`${path} has no \`evidence:\` block after insertion`);
|
|
173
|
+
const excludeBlock = findKeyBlock(lines, 'exclude', ' ');
|
|
174
|
+
if (excludeBlock !== null && excludeBlock.value !== '') {
|
|
175
|
+
throw new UsageError(`${path} declares evidence.exclude inline as \`exclude: ${excludeBlock.value}\`; this command only ` +
|
|
176
|
+
'appends to an `exclude:` block — edit the file by hand');
|
|
177
|
+
}
|
|
178
|
+
if (excludeBlock === null) {
|
|
179
|
+
lines = [...lines.slice(0, evidenceBlock.end), ' exclude:', ...lines.slice(evidenceBlock.end)];
|
|
180
|
+
}
|
|
181
|
+
for (const key of requested) {
|
|
182
|
+
// The block is re-located per key: the previous insertion moved the
|
|
183
|
+
// lines an earlier `end` index pointed at, and the second list must
|
|
184
|
+
// land after the first one, in the order the schema declares them.
|
|
185
|
+
const exclude = findKeyBlock(lines, 'exclude', ' ');
|
|
186
|
+
if (exclude === null)
|
|
187
|
+
throw new UsageError(`${path} has no \`evidence.exclude:\` block after insertion`);
|
|
188
|
+
lines = setListWithin(lines, exclude, ' ', key, lists[key] ?? [], path);
|
|
189
|
+
}
|
|
190
|
+
const after = `${lines.join('\n')}\n`;
|
|
191
|
+
// Schema self-check: this release must be able to read back exactly
|
|
192
|
+
// what it wrote, before anything writes it.
|
|
193
|
+
let parsed;
|
|
194
|
+
try {
|
|
195
|
+
parsed = parseConfig(parseYaml(after), { file: path });
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
throw new UsageError(`refusing to write a '${path}' this release cannot read back: ` +
|
|
199
|
+
`${error instanceof Error ? error.message : String(error)}`);
|
|
200
|
+
}
|
|
201
|
+
for (const key of requested) {
|
|
202
|
+
const written = parsed.evidence?.exclude?.[key] ?? [];
|
|
203
|
+
const expected = [...(lists[key] ?? [])];
|
|
204
|
+
if (JSON.stringify(written) !== JSON.stringify(expected)) {
|
|
205
|
+
throw new UsageError(`refusing to write a '${path}' whose evidence.exclude.${key} would read back as ` +
|
|
206
|
+
`${JSON.stringify(written)} instead of ${JSON.stringify(expected)}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return after;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Splits config text into comparable lines without a synthetic tail.
|
|
213
|
+
*
|
|
214
|
+
* Args:
|
|
215
|
+
* text: reviewed config content.
|
|
216
|
+
*
|
|
217
|
+
* Returns:
|
|
218
|
+
* string[]: config lines with line endings removed.
|
|
219
|
+
*/
|
|
220
|
+
function configLines(text) {
|
|
221
|
+
if (text.length === 0)
|
|
222
|
+
return [];
|
|
223
|
+
const result = text.replace(/\r\n/g, '\n').split('\n');
|
|
224
|
+
if (result[result.length - 1] === '')
|
|
225
|
+
result.pop();
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Formats an exact line-level diff between two config texts.
|
|
230
|
+
*
|
|
231
|
+
* Args:
|
|
232
|
+
* path: repo-relative config path.
|
|
233
|
+
* before: existing config contents, or an empty string if absent.
|
|
234
|
+
* after: proposed config contents.
|
|
235
|
+
*
|
|
236
|
+
* Returns:
|
|
237
|
+
* string: a unified diff showing every changed line.
|
|
238
|
+
*/
|
|
239
|
+
export function configTextDiff(path, before, after) {
|
|
240
|
+
const oldLines = configLines(before);
|
|
241
|
+
const newLines = configLines(after);
|
|
242
|
+
let prefix = 0;
|
|
243
|
+
while (prefix < oldLines.length && prefix < newLines.length && oldLines[prefix] === newLines[prefix])
|
|
244
|
+
prefix += 1;
|
|
245
|
+
let suffix = 0;
|
|
246
|
+
while (suffix < oldLines.length - prefix &&
|
|
247
|
+
suffix < newLines.length - prefix &&
|
|
248
|
+
oldLines[oldLines.length - 1 - suffix] === newLines[newLines.length - 1 - suffix]) {
|
|
249
|
+
suffix += 1;
|
|
250
|
+
}
|
|
251
|
+
const removed = oldLines.slice(prefix, oldLines.length - suffix);
|
|
252
|
+
const added = newLines.slice(prefix, newLines.length - suffix);
|
|
253
|
+
const oldStart = removed.length === 0 ? prefix : prefix + 1;
|
|
254
|
+
const newStart = added.length === 0 ? prefix : prefix + 1;
|
|
255
|
+
return [
|
|
256
|
+
`--- a/${path}`,
|
|
257
|
+
`+++ b/${path}`,
|
|
258
|
+
`@@ -${oldStart},${removed.length} +${newStart},${added.length} @@`,
|
|
259
|
+
...removed.map((line) => `-${line}`),
|
|
260
|
+
...added.map((line) => `+${line}`),
|
|
261
|
+
].join('\n');
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=evidence-config-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence-config-text.js","sourceRoot":"","sources":["../src/evidence-config-text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,6EAA6E;AAC7E,MAAM,IAAI,GAAG,CAAC,MA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AM,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACjE,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IAC/D,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC5D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IAC1D,OAAO;QACL,SAAS,IAAI,EAAE;QACf,SAAS,IAAI,EAAE;QACf,OAAO,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK;QACnE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;QACpC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;KACnC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
|
package/dist/execution.d.ts
CHANGED
|
@@ -3,8 +3,21 @@ import type { GateforgeConfig } from '@gate-forge/core';
|
|
|
3
3
|
import type { ProjectScope, RunnerOutcomesDocument } from '@gate-forge/pack-playwright';
|
|
4
4
|
/** The normalized invocation stamped into supervised receipts. */
|
|
5
5
|
export declare const SUPERVISED_INVOCATION = "test-gates --changed";
|
|
6
|
+
/** One named input of the trusted policy digest. */
|
|
7
|
+
export interface TrustedPolicyEntry {
|
|
8
|
+
/** Stable digest entry name (a marker label for a synthetic absence/empty directory). */
|
|
9
|
+
name: string;
|
|
10
|
+
/**
|
|
11
|
+
* The repo-relative document the bytes came from, or null for a
|
|
12
|
+
* synthetic marker entry (an absent optional document or an empty/
|
|
13
|
+
* missing adapters directory contributes a marker, not a file).
|
|
14
|
+
*/
|
|
15
|
+
path: string | null;
|
|
16
|
+
/** The exact effective bytes hashed for this entry (empty for markers). */
|
|
17
|
+
bytes: string;
|
|
18
|
+
}
|
|
6
19
|
/**
|
|
7
|
-
*
|
|
20
|
+
* Builds the NAMED trusted policy/config digest inputs (ADR 0005 D6) of
|
|
8
21
|
* the trusted-revision-owned documents of the repository: `.gateforge.yml`,
|
|
9
22
|
* the policies and classification-policy documents, the mapping
|
|
10
23
|
* sidecar when present, the EXECUTABLE evidence adapters (`.mjs` modules
|
|
@@ -23,14 +36,15 @@ export declare const SUPERVISED_INVOCATION = "test-gates --changed";
|
|
|
23
36
|
* dir, waivers dir, and the repo-relative plugin module specifiers.
|
|
24
37
|
*
|
|
25
38
|
* Returns:
|
|
26
|
-
*
|
|
39
|
+
* TrustedPolicyEntry[]: the entries in digest order — name, source
|
|
40
|
+
* path (null for a synthetic marker), and the hashed bytes.
|
|
27
41
|
*
|
|
28
42
|
* Throws:
|
|
29
43
|
* UsageError: when a REQUIRED trusted document exists but cannot be
|
|
30
44
|
* read (fail closed — an unreadable trusted revision is never
|
|
31
45
|
* hashed as empty).
|
|
32
46
|
*/
|
|
33
|
-
export declare function
|
|
47
|
+
export declare function trustedPolicyDigestEntries(cwd: string, configPaths: {
|
|
34
48
|
config: string;
|
|
35
49
|
policies: string;
|
|
36
50
|
classificationPolicy: string;
|
|
@@ -41,13 +55,42 @@ export declare function computeTrustedPolicyDigest(cwd: string, configPaths: {
|
|
|
41
55
|
waiverFiles: readonly string[];
|
|
42
56
|
quarantineFiles?: readonly string[];
|
|
43
57
|
pluginModules: readonly string[];
|
|
44
|
-
}):
|
|
58
|
+
}): TrustedPolicyEntry[];
|
|
59
|
+
/**
|
|
60
|
+
* Computes the trusted policy/config revision digest over the entry list
|
|
61
|
+
* {@link trustedPolicyDigestEntries} yields. ONE function yields the named
|
|
62
|
+
* entries; the digest is computed FROM them, so a surface that has to name
|
|
63
|
+
* the inputs (the enforcement doctor's `policy-inputs-vs-HEAD` row) reads the
|
|
64
|
+
* very list this digest hashes — there is no second list to drift.
|
|
65
|
+
*
|
|
66
|
+
* Args:
|
|
67
|
+
* cwd: absolute repo root.
|
|
68
|
+
* configPaths: the resolved repo-relative config paths (see
|
|
69
|
+
* {@link trustedPolicyDigestEntries}).
|
|
70
|
+
*
|
|
71
|
+
* Returns:
|
|
72
|
+
* string: 64-char lowercase hex trusted policy digest.
|
|
73
|
+
*/
|
|
74
|
+
export declare function computeTrustedPolicyDigest(cwd: string, configPaths: Parameters<typeof trustedPolicyDigestEntries>[1]): string;
|
|
75
|
+
/**
|
|
76
|
+
* Builds the NAMED trusted policy digest inputs directly from a loaded
|
|
77
|
+
* config (the common CLI shape): resolves the executable-input paths
|
|
78
|
+
* (adapters dir, waiver files, local in-process plugin modules) and
|
|
79
|
+
* delegates to {@link trustedPolicyDigestEntries}.
|
|
80
|
+
*
|
|
81
|
+
* Args:
|
|
82
|
+
* cwd: absolute repo root.
|
|
83
|
+
* config: the loaded gateforge config (paths + plugin declarations).
|
|
84
|
+
*
|
|
85
|
+
* Returns:
|
|
86
|
+
* TrustedPolicyEntry[]: the entries in digest order.
|
|
87
|
+
*/
|
|
88
|
+
export declare function trustedPolicyDigestEntriesForConfig(cwd: string, config: GateforgeConfig): TrustedPolicyEntry[];
|
|
45
89
|
/**
|
|
46
90
|
* Builds the trusted-policy digest directly from a loaded config (the
|
|
47
|
-
* common CLI shape)
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* digest is identical everywhere (check, broker, test-gates, doctor).
|
|
91
|
+
* common CLI shape). All gate surfaces call this so the digest is
|
|
92
|
+
* identical everywhere (check, broker, test-gates, doctor) and so the
|
|
93
|
+
* digest is always computed FROM the entry list this module yields.
|
|
51
94
|
*
|
|
52
95
|
* Args:
|
|
53
96
|
* cwd: absolute repo root.
|
package/dist/execution.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAqBA,OAAO,EAgBL,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"execution.d.ts","sourceRoot":"","sources":["../src/execution.ts"],"names":[],"mappings":"AAqBA,OAAO,EAgBL,KAAK,SAAS,EACd,KAAK,aAAa,EAElB,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,WAAW,EAChB,KAAK,eAAe,EACpB,KAAK,UAAU,EACf,KAAK,eAAe,EACpB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,uBAAuB,EAC5B,KAAK,qBAAqB,EAC1B,KAAK,kBAAkB,EACvB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,kBAAkB,CAAC;AAM1B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAIxF,kEAAkE;AAClE,eAAO,MAAM,qBAAqB,yBAAyB,CAAC;AAK5D,oDAAoD;AACpD,MAAM,WAAW,kBAAkB;IACjC,yFAAyF;IACzF,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;CACf;AAOD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2B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AA6C;IAC7C,mBAAmB,EAAE,MAAM,CAAC;IAC5B,4DAA4D;IAC5D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,eAAe,EAAE,MAAM,CAAC;IACxB,uEAAuE;IACvE,aAAa,EAAE,MAAM,CAAC;IACtB,6CAA6C;IAC7C,qBAAqB,EAAE,MAAM,CAAC;IAC9B,+CAA+C;IAC/C,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kDAAkD;IAClD,YAAY,EAAE,MAAM,CAAC;IACrB,mDAAmD;IACnD,WAAW,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,2EAA2E;IAC3E,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gEAAgE;IAChE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,qEAAqE;IACrE,uBAAuB,EAAE,MAAM,CAAC;IAChC,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,SAAS,CAoCpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAKpD;AAED;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,GAAG,aAAa,EAAE,CAa5F;AAED,8EAA8E;AAC9E,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAE7D"}
|
package/dist/execution.js
CHANGED
|
@@ -25,16 +25,18 @@ import { obligationFingerprint } from './evaluate.js';
|
|
|
25
25
|
import { TEST_MAP_RELATIVE } from './mapping.js';
|
|
26
26
|
import { sourcesByResourceId } from './pipeline.js';
|
|
27
27
|
import { normalizeRepoModule } from './input-snapshot.js';
|
|
28
|
-
import { DOCS_EXCLUSIONS_PATH } from './docs-exclusions.js';
|
|
29
|
-
import { CACHE_EXCLUSIONS_PATH } from './cache-exclusions.js';
|
|
30
28
|
import { UsageError } from './errors.js';
|
|
31
29
|
import { environmentIdentity } from './input-snapshot.js';
|
|
32
30
|
/** The normalized invocation stamped into supervised receipts. */
|
|
33
31
|
export const SUPERVISED_INVOCATION = 'test-gates --changed';
|
|
34
32
|
/** Schema-valid placeholder mac used only to validate the draft body before signing. */
|
|
35
33
|
const RECEIPT_MAC_PLACEHOLDER = '0'.repeat(64);
|
|
34
|
+
/** A synthetic digest entry: no document, fixed empty bytes. */
|
|
35
|
+
function marker(name) {
|
|
36
|
+
return { name, path: null, bytes: '' };
|
|
37
|
+
}
|
|
36
38
|
/**
|
|
37
|
-
*
|
|
39
|
+
* Builds the NAMED trusted policy/config digest inputs (ADR 0005 D6) of
|
|
38
40
|
* the trusted-revision-owned documents of the repository: `.gateforge.yml`,
|
|
39
41
|
* the policies and classification-policy documents, the mapping
|
|
40
42
|
* sidecar when present, the EXECUTABLE evidence adapters (`.mjs` modules
|
|
@@ -53,24 +55,25 @@ const RECEIPT_MAC_PLACEHOLDER = '0'.repeat(64);
|
|
|
53
55
|
* dir, waivers dir, and the repo-relative plugin module specifiers.
|
|
54
56
|
*
|
|
55
57
|
* Returns:
|
|
56
|
-
*
|
|
58
|
+
* TrustedPolicyEntry[]: the entries in digest order — name, source
|
|
59
|
+
* path (null for a synthetic marker), and the hashed bytes.
|
|
57
60
|
*
|
|
58
61
|
* Throws:
|
|
59
62
|
* UsageError: when a REQUIRED trusted document exists but cannot be
|
|
60
63
|
* read (fail closed — an unreadable trusted revision is never
|
|
61
64
|
* hashed as empty).
|
|
62
65
|
*/
|
|
63
|
-
export function
|
|
66
|
+
export function trustedPolicyDigestEntries(cwd, configPaths) {
|
|
64
67
|
const entry = (name, path, required) => {
|
|
65
68
|
const absolute = join(cwd, ...path.split('/'));
|
|
66
69
|
if (!existsSync(absolute)) {
|
|
67
70
|
if (required) {
|
|
68
71
|
throw new UsageError(`trusted policy document '${path}' vanished mid-run — refusing to seal (fail closed)`);
|
|
69
72
|
}
|
|
70
|
-
return { name, bytes: '' };
|
|
73
|
+
return { name, path, bytes: '' };
|
|
71
74
|
}
|
|
72
75
|
try {
|
|
73
|
-
return { name, bytes: readFileSync(absolute, 'utf8') };
|
|
76
|
+
return { name, path, bytes: readFileSync(absolute, 'utf8') };
|
|
74
77
|
}
|
|
75
78
|
catch (error) {
|
|
76
79
|
throw new UsageError(`cannot read trusted policy document '${path}': ${error.message}`);
|
|
@@ -91,7 +94,7 @@ export function computeTrustedPolicyDigest(cwd, configPaths) {
|
|
|
91
94
|
.filter((name) => name.endsWith('.mjs'))
|
|
92
95
|
.sort();
|
|
93
96
|
if (names.length === 0) {
|
|
94
|
-
adapterEntries.push(
|
|
97
|
+
adapterEntries.push(marker(`${configPaths.adaptersDir}/(no .mjs adapters)`));
|
|
95
98
|
}
|
|
96
99
|
for (const name of names) {
|
|
97
100
|
const relative = `${configPaths.adaptersDir}/${name}`;
|
|
@@ -102,7 +105,7 @@ export function computeTrustedPolicyDigest(cwd, configPaths) {
|
|
|
102
105
|
if (error.code !== 'ENOENT') {
|
|
103
106
|
throw new UsageError(`trusted policy digest cannot read the adapters dir '${configPaths.adaptersDir}': ${error.message}`);
|
|
104
107
|
}
|
|
105
|
-
adapterEntries.push(
|
|
108
|
+
adapterEntries.push(marker(`${configPaths.adaptersDir}/(missing adapters dir)`));
|
|
106
109
|
}
|
|
107
110
|
const waiverEntries = configPaths.waiverFiles
|
|
108
111
|
.map((path) => entry(path, path, true))
|
|
@@ -118,51 +121,64 @@ export function computeTrustedPolicyDigest(cwd, configPaths) {
|
|
|
118
121
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
119
122
|
const pluginEntries = configPaths.pluginModules.map((module) => entry(module, module, true));
|
|
120
123
|
const behaviorEntry = configPaths.behaviorPolicy === undefined || configPaths.behaviorPolicy === null
|
|
121
|
-
?
|
|
124
|
+
? marker('.gateforge/behavior.yml (absent)')
|
|
122
125
|
: entry(configPaths.behaviorPolicy, configPaths.behaviorPolicy, true);
|
|
123
126
|
// The staged-runtime document is security-sensitive (plan 2026-09-21):
|
|
124
127
|
// its commands start processes and its reuse list sanctions the only
|
|
125
128
|
// dependency bridge into the candidate — a candidate that edits its
|
|
126
129
|
// own runtime commands is a policy-revision change.
|
|
127
130
|
const runtimeEntry = configPaths.runtimePolicy === undefined || configPaths.runtimePolicy === null
|
|
128
|
-
?
|
|
131
|
+
? marker('.gateforge/runtime.yml (absent)')
|
|
129
132
|
: entry(configPaths.runtimePolicy, configPaths.runtimePolicy, true);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
: [];
|
|
136
|
-
return trustedPolicyDigest([
|
|
133
|
+
// Evidence exclusions contribute NO entry of their own since 0.10:
|
|
134
|
+
// they live in `.gateforge.yml`, which is already hashed below. The
|
|
135
|
+
// bytes an approval pins are the same bytes; the trust property is
|
|
136
|
+
// unchanged, only the entry list is shorter.
|
|
137
|
+
return [
|
|
137
138
|
entry('.gateforge.yml', configPaths.config, true),
|
|
138
139
|
entry(configPaths.policies, configPaths.policies, true),
|
|
139
140
|
entry(configPaths.classificationPolicy, configPaths.classificationPolicy, true),
|
|
140
141
|
behaviorEntry,
|
|
141
142
|
runtimeEntry,
|
|
142
|
-
...docsExclusionsEntry,
|
|
143
|
-
...cacheExclusionsEntry,
|
|
144
143
|
entry('.gateforge/test-map.yml', configPaths.sidecar, false),
|
|
145
144
|
...adapterEntries,
|
|
146
145
|
...waiverEntries,
|
|
147
146
|
...quarantineEntries,
|
|
148
147
|
...pluginEntries,
|
|
149
|
-
]
|
|
148
|
+
];
|
|
150
149
|
}
|
|
151
150
|
/**
|
|
152
|
-
*
|
|
153
|
-
*
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
* digest is
|
|
151
|
+
* Computes the trusted policy/config revision digest over the entry list
|
|
152
|
+
* {@link trustedPolicyDigestEntries} yields. ONE function yields the named
|
|
153
|
+
* entries; the digest is computed FROM them, so a surface that has to name
|
|
154
|
+
* the inputs (the enforcement doctor's `policy-inputs-vs-HEAD` row) reads the
|
|
155
|
+
* very list this digest hashes — there is no second list to drift.
|
|
157
156
|
*
|
|
158
157
|
* Args:
|
|
159
158
|
* cwd: absolute repo root.
|
|
160
|
-
*
|
|
159
|
+
* configPaths: the resolved repo-relative config paths (see
|
|
160
|
+
* {@link trustedPolicyDigestEntries}).
|
|
161
161
|
*
|
|
162
162
|
* Returns:
|
|
163
163
|
* string: 64-char lowercase hex trusted policy digest.
|
|
164
164
|
*/
|
|
165
|
-
export function
|
|
165
|
+
export function computeTrustedPolicyDigest(cwd, configPaths) {
|
|
166
|
+
return trustedPolicyDigest(trustedPolicyDigestEntries(cwd, configPaths));
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Builds the NAMED trusted policy digest inputs directly from a loaded
|
|
170
|
+
* config (the common CLI shape): resolves the executable-input paths
|
|
171
|
+
* (adapters dir, waiver files, local in-process plugin modules) and
|
|
172
|
+
* delegates to {@link trustedPolicyDigestEntries}.
|
|
173
|
+
*
|
|
174
|
+
* Args:
|
|
175
|
+
* cwd: absolute repo root.
|
|
176
|
+
* config: the loaded gateforge config (paths + plugin declarations).
|
|
177
|
+
*
|
|
178
|
+
* Returns:
|
|
179
|
+
* TrustedPolicyEntry[]: the entries in digest order.
|
|
180
|
+
*/
|
|
181
|
+
export function trustedPolicyDigestEntriesForConfig(cwd, config) {
|
|
166
182
|
const waiverFiles = [];
|
|
167
183
|
const waiversDir = join(cwd, ...config.waivers.split('/'));
|
|
168
184
|
try {
|
|
@@ -204,7 +220,7 @@ export function trustedPolicyDigestForConfig(cwd, config) {
|
|
|
204
220
|
if (normalized !== null)
|
|
205
221
|
pluginModules.push(normalized);
|
|
206
222
|
}
|
|
207
|
-
return
|
|
223
|
+
return trustedPolicyDigestEntries(cwd, {
|
|
208
224
|
config: '.gateforge.yml',
|
|
209
225
|
policies: config.policies,
|
|
210
226
|
classificationPolicy: config.classificationPolicy,
|
|
@@ -217,6 +233,22 @@ export function trustedPolicyDigestForConfig(cwd, config) {
|
|
|
217
233
|
pluginModules: [...new Set(pluginModules)].sort(),
|
|
218
234
|
});
|
|
219
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Builds the trusted-policy digest directly from a loaded config (the
|
|
238
|
+
* common CLI shape). All gate surfaces call this so the digest is
|
|
239
|
+
* identical everywhere (check, broker, test-gates, doctor) and so the
|
|
240
|
+
* digest is always computed FROM the entry list this module yields.
|
|
241
|
+
*
|
|
242
|
+
* Args:
|
|
243
|
+
* cwd: absolute repo root.
|
|
244
|
+
* config: the loaded gateforge config (paths + plugin declarations).
|
|
245
|
+
*
|
|
246
|
+
* Returns:
|
|
247
|
+
* string: 64-char lowercase hex trusted policy digest.
|
|
248
|
+
*/
|
|
249
|
+
export function trustedPolicyDigestForConfig(cwd, config) {
|
|
250
|
+
return trustedPolicyDigest(trustedPolicyDigestEntriesForConfig(cwd, config));
|
|
251
|
+
}
|
|
220
252
|
/**
|
|
221
253
|
* The mapped obligation claims per reconciliation key (plan Phase 4
|
|
222
254
|
* claim injection): SIDECAR bindings join the catalog so a mapped test's
|