@gate-forge/cli 0.8.0 → 0.9.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 +78 -1143
- package/dist/adapter-audit.d.ts +54 -0
- package/dist/adapter-audit.d.ts.map +1 -1
- package/dist/adapter-audit.js +48 -0
- package/dist/adapter-audit.js.map +1 -1
- package/dist/adapter-scaffold.d.ts +28 -3
- package/dist/adapter-scaffold.d.ts.map +1 -1
- package/dist/adapter-scaffold.js +145 -24
- package/dist/adapter-scaffold.js.map +1 -1
- package/dist/args.d.ts.map +1 -1
- package/dist/args.js +2 -0
- package/dist/args.js.map +1 -1
- package/dist/behavior-setup.d.ts.map +1 -1
- package/dist/behavior-setup.js +18 -5
- package/dist/behavior-setup.js.map +1 -1
- package/dist/commands/adapters.d.ts.map +1 -1
- package/dist/commands/adapters.js +73 -2
- package/dist/commands/adapters.js.map +1 -1
- package/dist/commands/adopt.d.ts +7 -0
- package/dist/commands/adopt.d.ts.map +1 -1
- package/dist/commands/adopt.js +35 -1
- package/dist/commands/adopt.js.map +1 -1
- package/dist/commands/blocking.d.ts +25 -1
- package/dist/commands/blocking.d.ts.map +1 -1
- package/dist/commands/blocking.js +64 -5
- package/dist/commands/blocking.js.map +1 -1
- package/dist/commands/check.d.ts.map +1 -1
- package/dist/commands/check.js +60 -2
- package/dist/commands/check.js.map +1 -1
- package/dist/commands/classify.d.ts +1 -1
- package/dist/commands/classify.d.ts.map +1 -1
- package/dist/commands/classify.js +63 -18
- package/dist/commands/classify.js.map +1 -1
- package/dist/commands/enforcement.d.ts.map +1 -1
- package/dist/commands/enforcement.js +81 -4
- package/dist/commands/enforcement.js.map +1 -1
- package/dist/commands/explain.d.ts +1 -1
- package/dist/commands/explain.d.ts.map +1 -1
- package/dist/commands/explain.js +162 -3
- package/dist/commands/explain.js.map +1 -1
- package/dist/commands/init-presets.d.ts +7 -0
- package/dist/commands/init-presets.d.ts.map +1 -1
- package/dist/commands/init-presets.js +10 -1
- package/dist/commands/init-presets.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +386 -39
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/next.d.ts.map +1 -1
- package/dist/commands/next.js +103 -5
- package/dist/commands/next.js.map +1 -1
- package/dist/commands/test-gates.js +1 -1
- package/dist/commands/tests.d.ts.map +1 -1
- package/dist/commands/tests.js +39 -7
- package/dist/commands/tests.js.map +1 -1
- package/dist/docs-exclusions.d.ts.map +1 -1
- package/dist/docs-exclusions.js +18 -3
- package/dist/docs-exclusions.js.map +1 -1
- package/dist/endpoint-compiler.d.ts.map +1 -1
- package/dist/endpoint-compiler.js +49 -1
- package/dist/endpoint-compiler.js.map +1 -1
- package/dist/evaluate.d.ts +16 -1
- package/dist/evaluate.d.ts.map +1 -1
- package/dist/evaluate.js +12 -2
- package/dist/evaluate.js.map +1 -1
- package/dist/gateforge-owned.d.ts +78 -0
- package/dist/gateforge-owned.d.ts.map +1 -0
- package/dist/gateforge-owned.js +254 -0
- package/dist/gateforge-owned.js.map +1 -0
- package/dist/git-hooks.d.ts +18 -0
- package/dist/git-hooks.d.ts.map +1 -1
- package/dist/git-hooks.js +21 -1
- package/dist/git-hooks.js.map +1 -1
- package/dist/git-ignored.d.ts +27 -0
- package/dist/git-ignored.d.ts.map +1 -0
- package/dist/git-ignored.js +102 -0
- package/dist/git-ignored.js.map +1 -0
- package/dist/glob.d.ts +33 -14
- package/dist/glob.d.ts.map +1 -1
- package/dist/glob.js +96 -5
- package/dist/glob.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/io.d.ts +18 -5
- package/dist/io.d.ts.map +1 -1
- package/dist/io.js +5 -4
- package/dist/io.js.map +1 -1
- package/dist/pipeline.d.ts +16 -1
- package/dist/pipeline.d.ts.map +1 -1
- package/dist/pipeline.js +23 -3
- package/dist/pipeline.js.map +1 -1
- package/dist/planes-inference.d.ts +12 -5
- package/dist/planes-inference.d.ts.map +1 -1
- package/dist/planes-inference.js +13 -15
- package/dist/planes-inference.js.map +1 -1
- package/dist/repo-scan.d.ts +7 -0
- package/dist/repo-scan.d.ts.map +1 -1
- package/dist/repo-scan.js +109 -8
- package/dist/repo-scan.js.map +1 -1
- package/dist/route-plane-proposals.d.ts +100 -0
- package/dist/route-plane-proposals.d.ts.map +1 -0
- package/dist/route-plane-proposals.js +213 -0
- package/dist/route-plane-proposals.js.map +1 -0
- package/dist/scope.d.ts +20 -0
- package/dist/scope.d.ts.map +1 -1
- package/dist/scope.js +26 -5
- package/dist/scope.js.map +1 -1
- package/dist/singleton-guidance.d.ts +15 -6
- package/dist/singleton-guidance.d.ts.map +1 -1
- package/dist/singleton-guidance.js +30 -10
- package/dist/singleton-guidance.js.map +1 -1
- package/dist/unmatched-routes.d.ts +60 -0
- package/dist/unmatched-routes.d.ts.map +1 -0
- package/dist/unmatched-routes.js +131 -0
- package/dist/unmatched-routes.js.map +1 -0
- package/guides/CONNECT-YOUR-PROJECT.md +78 -20
- package/guides/QUICKSTART.md +55 -10
- package/guides/REFERENCE.md +1710 -0
- package/guides/TEST-ENVIRONMENT.md +8 -5
- package/guides/UPGRADE-0.8-to-0.9.md +104 -0
- package/package.json +10 -10
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateforge-owned policy inputs (0.9.0 D2).
|
|
3
|
+
*
|
|
4
|
+
* These are the files Gateforge itself writes and reads when it configures
|
|
5
|
+
* and wires itself: the config document, the policy / classification /
|
|
6
|
+
* behavior / runtime documents, the pack configs, the adapter, waiver,
|
|
7
|
+
* baseline and quarantine records, the generated gate wiring (hook script,
|
|
8
|
+
* CI job templates, agent skill file, engine reference) and the owner's own
|
|
9
|
+
* CI / pre-commit files while they still carry Gateforge's managed block.
|
|
10
|
+
*
|
|
11
|
+
* A change to one of them is a POLICY INPUT, never a product change:
|
|
12
|
+
*
|
|
13
|
+
* - it is never reported as an unmapped (`CHANGE_UNMAPPED`) product change,
|
|
14
|
+
* because nothing about product behavior is unaccounted for;
|
|
15
|
+
* - its integrity stays governed by the owner-approved policy digest exactly
|
|
16
|
+
* as it is today — `computeTrustedPolicyDigest` hashes the config, policy,
|
|
17
|
+
* classification, behavior, runtime, exclusion-declaration, mapping-sidecar,
|
|
18
|
+
* adapter, waiver, quarantine and repo-local plugin bytes, so a candidate
|
|
19
|
+
* that changes any of them changes the approved revision and a pin mismatch
|
|
20
|
+
* still blocks;
|
|
21
|
+
* - a change set whose ENTIRE content is these paths cannot change product
|
|
22
|
+
* behavior, so it does not drag the adopted E2E obligations into a strict
|
|
23
|
+
* re-grade (the adoption forgiveness survives; an owner waiver does not).
|
|
24
|
+
*
|
|
25
|
+
* Security boundary — the set is EXACT, never a directory wildcard:
|
|
26
|
+
*
|
|
27
|
+
* - `.gateforge/` is NOT exempt as a tree. Only the engine documents at its
|
|
28
|
+
* top level and the engine-owned subdirectories are, so an agent cannot
|
|
29
|
+
* park a product change somewhere under `.gateforge/` and have it excused.
|
|
30
|
+
* Engine run state (`.gateforge/test-gates/`, `.gateforge/ci-witnessed/`)
|
|
31
|
+
* stays outside the set on purpose: staged engine state is not a policy
|
|
32
|
+
* input and stays visible.
|
|
33
|
+
* - The owner's CI config and pre-commit config count ONLY while Gateforge's
|
|
34
|
+
* managed block is still in them. Deleting the gate job from
|
|
35
|
+
* `.gitlab-ci.yml` therefore keeps its historical, blocking
|
|
36
|
+
* `CHANGE_UNMAPPED` treatment.
|
|
37
|
+
*/
|
|
38
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
39
|
+
import { join } from 'node:path';
|
|
40
|
+
import { CACHE_EXCLUSIONS_PATH } from './cache-exclusions.js';
|
|
41
|
+
import { DOCS_EXCLUSIONS_PATH } from './docs-exclusions.js';
|
|
42
|
+
import { PACK_CONFIGS, normalizeRepoModule } from './input-snapshot.js';
|
|
43
|
+
/** Repo-relative path of the tracked mapping sidecar. */
|
|
44
|
+
export const GATEFORGE_TEST_MAP_PATH = '.gateforge/test-map.yml';
|
|
45
|
+
/** Repo-relative path of the machine-specific engine checkout reference. */
|
|
46
|
+
export const GATEFORGE_ENGINE_REFERENCE_PATH = '.gateforge/engine';
|
|
47
|
+
/** Repo-relative path of the agent skill file `init` writes. */
|
|
48
|
+
export const GATEFORGE_SKILL_FILE = 'GATEFORGE.md';
|
|
49
|
+
/**
|
|
50
|
+
* Repo-relative path of the overlay-proof directory README `init` writes.
|
|
51
|
+
* EXACT path on purpose: the overlay TESTS an owner or agent writes beside
|
|
52
|
+
* it in `tests/e2e/gateforge/` are product work and stay mappable and
|
|
53
|
+
* gradeable.
|
|
54
|
+
*/
|
|
55
|
+
export const GATEFORGE_OVERLAY_README_PATH = 'tests/e2e/gateforge/README.md';
|
|
56
|
+
/**
|
|
57
|
+
* Engine-owned subdirectories of `.gateforge/`: the generated gate wiring and
|
|
58
|
+
* the record directories every gate decision reads. Segment-aware matching
|
|
59
|
+
* only — `.gateforge/hooksy/x` is not inside `.gateforge/hooks`.
|
|
60
|
+
*/
|
|
61
|
+
export const GATEFORGE_OWNED_DIRS = [
|
|
62
|
+
'.gateforge/adapters',
|
|
63
|
+
'.gateforge/baselines',
|
|
64
|
+
'.gateforge/ci',
|
|
65
|
+
'.gateforge/hooks',
|
|
66
|
+
'.gateforge/quarantine',
|
|
67
|
+
'.gateforge/waivers',
|
|
68
|
+
];
|
|
69
|
+
/**
|
|
70
|
+
* Extensions accepted for an engine document directly under `.gateforge/`
|
|
71
|
+
* (`.gateforge/policies.yml`, `.gateforge/planes.json`, …). Source and
|
|
72
|
+
* executable code never qualifies: only documents the engine itself reads.
|
|
73
|
+
*/
|
|
74
|
+
const ENGINE_DOCUMENT_EXTENSIONS = new Set([
|
|
75
|
+
'.yml',
|
|
76
|
+
'.yaml',
|
|
77
|
+
'.json',
|
|
78
|
+
'.md',
|
|
79
|
+
'.txt',
|
|
80
|
+
]);
|
|
81
|
+
/**
|
|
82
|
+
* Owner-owned files that carry a Gateforge-managed block, with the markers
|
|
83
|
+
* that prove the block is still wired. A file whose marker is gone is not a
|
|
84
|
+
* policy input anymore — that is exactly the E17 self-authorization case.
|
|
85
|
+
*/
|
|
86
|
+
const MANAGED_OWNER_FILES = {
|
|
87
|
+
'.gitlab-ci.yml': { kind: 'ci-wiring', markers: ['.gateforge/ci/'] },
|
|
88
|
+
'.pre-commit-config.yaml': { kind: 'pre-commit-wiring', markers: ['gateforge-check'] },
|
|
89
|
+
'.github/workflows/gateforge.yml': { kind: 'ci-wiring', markers: ['# Generated by Gateforge'] },
|
|
90
|
+
'.github/workflows/gateforge-witnessed.yml': { kind: 'ci-wiring', markers: ['# Generated by Gateforge'] },
|
|
91
|
+
};
|
|
92
|
+
/** Normalizes a configured repo path to the posix form used for comparison. */
|
|
93
|
+
function normalizeRepoPath(path) {
|
|
94
|
+
const posix = path.split('\\').join('/');
|
|
95
|
+
return posix.startsWith('./') ? posix.slice(2) : posix;
|
|
96
|
+
}
|
|
97
|
+
/** Segment-aware directory membership (`a/b` is inside `a`, `a2` is not). */
|
|
98
|
+
function underDir(file, dir) {
|
|
99
|
+
return file === dir || file.startsWith(`${dir}/`);
|
|
100
|
+
}
|
|
101
|
+
/** The lowercase extension of a basename, or `''` when it has none. */
|
|
102
|
+
function extensionOf(basename) {
|
|
103
|
+
const lower = basename.toLowerCase();
|
|
104
|
+
return lower.includes('.') ? lower.slice(lower.lastIndexOf('.')) : '';
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Classifies a repo-relative path as a Gateforge-owned policy input.
|
|
108
|
+
*
|
|
109
|
+
* Args:
|
|
110
|
+
* file: normalized repo-relative changed path.
|
|
111
|
+
* config: the loaded gateforge config (its document paths are honored).
|
|
112
|
+
*
|
|
113
|
+
* Returns:
|
|
114
|
+
* GateforgeOwnedInput | null: the matched input, or null when the path is
|
|
115
|
+
* not a Gateforge-owned policy input (a product file, or engine run state).
|
|
116
|
+
*/
|
|
117
|
+
export function gateforgeOwnedInput(file, config) {
|
|
118
|
+
const posix = normalizeRepoPath(file);
|
|
119
|
+
if (posix === '.gateforge.yml')
|
|
120
|
+
return { path: '.gateforge.yml', kind: 'config' };
|
|
121
|
+
if (posix === GATEFORGE_SKILL_FILE)
|
|
122
|
+
return { path: GATEFORGE_SKILL_FILE, kind: 'agent-skill' };
|
|
123
|
+
if (posix === GATEFORGE_OVERLAY_README_PATH) {
|
|
124
|
+
return { path: GATEFORGE_OVERLAY_README_PATH, kind: 'agent-skill' };
|
|
125
|
+
}
|
|
126
|
+
if (posix === GATEFORGE_ENGINE_REFERENCE_PATH) {
|
|
127
|
+
return { path: GATEFORGE_ENGINE_REFERENCE_PATH, kind: 'engine-reference' };
|
|
128
|
+
}
|
|
129
|
+
if (posix === GATEFORGE_TEST_MAP_PATH)
|
|
130
|
+
return { path: GATEFORGE_TEST_MAP_PATH, kind: 'mapping-sidecar' };
|
|
131
|
+
if (posix === DOCS_EXCLUSIONS_PATH || posix === CACHE_EXCLUSIONS_PATH) {
|
|
132
|
+
return { path: posix, kind: 'exclusion-declaration' };
|
|
133
|
+
}
|
|
134
|
+
for (const packConfig of PACK_CONFIGS) {
|
|
135
|
+
if (posix === packConfig)
|
|
136
|
+
return { path: packConfig, kind: 'pack-config' };
|
|
137
|
+
}
|
|
138
|
+
// Configured documents: the config may point anywhere in the repository.
|
|
139
|
+
if (posix === normalizeRepoPath(config.policies))
|
|
140
|
+
return { path: posix, kind: 'policy' };
|
|
141
|
+
if (posix === normalizeRepoPath(config.classificationPolicy)) {
|
|
142
|
+
return { path: posix, kind: 'classification-policy' };
|
|
143
|
+
}
|
|
144
|
+
if (config.behaviorPolicy !== undefined && posix === normalizeRepoPath(config.behaviorPolicy)) {
|
|
145
|
+
return { path: posix, kind: 'behavior-policy' };
|
|
146
|
+
}
|
|
147
|
+
if (config.runtime !== undefined && posix === normalizeRepoPath(config.runtime)) {
|
|
148
|
+
return { path: posix, kind: 'runtime-policy' };
|
|
149
|
+
}
|
|
150
|
+
const baselines = normalizeRepoPath(config.baselines);
|
|
151
|
+
if (posix === baselines)
|
|
152
|
+
return { path: posix, kind: 'baseline' };
|
|
153
|
+
const adapters = normalizeRepoPath(config.adapters);
|
|
154
|
+
if (underDir(posix, adapters))
|
|
155
|
+
return { path: adapters, kind: 'adapter' };
|
|
156
|
+
const waivers = normalizeRepoPath(config.waivers);
|
|
157
|
+
if (underDir(posix, waivers))
|
|
158
|
+
return { path: waivers, kind: 'waiver' };
|
|
159
|
+
for (const plugin of config.plugins) {
|
|
160
|
+
const module = plugin.module;
|
|
161
|
+
if (typeof module !== 'string')
|
|
162
|
+
continue;
|
|
163
|
+
const normalized = normalizeRepoModule(module);
|
|
164
|
+
if (normalized !== null && (posix === normalized || underDir(posix, normalized))) {
|
|
165
|
+
return { path: normalized, kind: 'plugin-module' };
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// The baseline record directory: the adoption receipt is the sibling of the
|
|
169
|
+
// configured baseline document and Gateforge writes both.
|
|
170
|
+
const baselineDir = baselines.slice(0, baselines.lastIndexOf('/'));
|
|
171
|
+
if (baselineDir.includes('/') && underDir(posix, baselineDir))
|
|
172
|
+
return { path: baselineDir, kind: 'baseline' };
|
|
173
|
+
for (const dir of GATEFORGE_OWNED_DIRS) {
|
|
174
|
+
if (underDir(posix, dir))
|
|
175
|
+
return { path: dir, kind: dir === '.gateforge/quarantine' ? 'quarantine' : 'wiring' };
|
|
176
|
+
}
|
|
177
|
+
// Engine documents directly under `.gateforge/` (`docs-exclusions.yml`,
|
|
178
|
+
// `runtime.yml`, a custom policies document, …). Depth one only, and only
|
|
179
|
+
// document types — `.gateforge/<anything>.py` is not a policy input.
|
|
180
|
+
const segments = posix.split('/');
|
|
181
|
+
if (segments.length === 2 &&
|
|
182
|
+
segments[0] === '.gateforge' &&
|
|
183
|
+
ENGINE_DOCUMENT_EXTENSIONS.has(extensionOf(segments[1] ?? ''))) {
|
|
184
|
+
return { path: posix, kind: 'policy' };
|
|
185
|
+
}
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Whether an owner-owned file still carries Gateforge's managed block.
|
|
190
|
+
*
|
|
191
|
+
* Args:
|
|
192
|
+
* cwd: absolute repo root (the candidate's own checkout).
|
|
193
|
+
* file: repo-relative path.
|
|
194
|
+
*
|
|
195
|
+
* Returns:
|
|
196
|
+
* boolean: true for a managed owner file whose marker is still present.
|
|
197
|
+
*/
|
|
198
|
+
export function managedOwnerBlockPresent(cwd, file) {
|
|
199
|
+
const entry = MANAGED_OWNER_FILES[file];
|
|
200
|
+
if (entry === undefined)
|
|
201
|
+
return false;
|
|
202
|
+
const absolute = join(cwd, ...file.split('/'));
|
|
203
|
+
if (!existsSync(absolute))
|
|
204
|
+
return false;
|
|
205
|
+
try {
|
|
206
|
+
const body = readFileSync(absolute, 'utf8');
|
|
207
|
+
return entry.markers.some((marker) => body.includes(marker));
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Classifies a path including the owner files that carry a managed block.
|
|
215
|
+
*
|
|
216
|
+
* Args:
|
|
217
|
+
* cwd: absolute repo root (the candidate's own checkout).
|
|
218
|
+
* file: repo-relative path.
|
|
219
|
+
* config: the loaded gateforge config.
|
|
220
|
+
*
|
|
221
|
+
* Returns:
|
|
222
|
+
* GateforgeOwnedInput | null: the matched input, or null.
|
|
223
|
+
*/
|
|
224
|
+
export function classifyGateforgeOwnedInput(cwd, file, config) {
|
|
225
|
+
const direct = gateforgeOwnedInput(file, config);
|
|
226
|
+
if (direct !== null)
|
|
227
|
+
return direct;
|
|
228
|
+
const managed = MANAGED_OWNER_FILES[normalizeRepoPath(file)];
|
|
229
|
+
return managed !== undefined && managedOwnerBlockPresent(cwd, normalizeRepoPath(file))
|
|
230
|
+
? { path: normalizeRepoPath(file), kind: managed.kind }
|
|
231
|
+
: null;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Classifies a whole changed set in one pass (one config walk, no re-reads
|
|
235
|
+
* per file beyond the managed-block check).
|
|
236
|
+
*
|
|
237
|
+
* Args:
|
|
238
|
+
* cwd: absolute repo root.
|
|
239
|
+
* files: repo-relative changed paths.
|
|
240
|
+
* config: the loaded gateforge config.
|
|
241
|
+
*
|
|
242
|
+
* Returns:
|
|
243
|
+
* Map<string, GateforgeOwnedInput>: the subset that is Gateforge-owned.
|
|
244
|
+
*/
|
|
245
|
+
export function gateforgeOwnedInputs(cwd, files, config) {
|
|
246
|
+
const owned = new Map();
|
|
247
|
+
for (const file of files) {
|
|
248
|
+
const match = classifyGateforgeOwnedInput(cwd, file, config);
|
|
249
|
+
if (match !== null)
|
|
250
|
+
owned.set(file, match);
|
|
251
|
+
}
|
|
252
|
+
return owned;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=gateforge-owned.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gateforge-owned.js","sourceRoot":"","sources":["../src/gateforge-owned.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAExE,yDAAyD;AACzD,MAAM,CAAC,MAAM,uBAAuB,GAAG,yBAAyB,CAAC;AAEjE,4EAA4E;AAC5E,MAAM,CAAC,MAAM,+BAA+B,GAAG,mBAAmB,CAAC;AAEnE,gEAAgE;AAChE,MAAM,CAAC,MAAM,oBAAoB,GAAG,cAAc,CAAC;AAE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IAAI,wBAAwB,CAAC,GAAG,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACpF,CAAC,CAAC,EAAE,IAAI,EAAE,iBAAiB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;QACvD,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAClC,GAAW,EACX,KAAwB,EACxB,MAAuB;IAEvB,MAAM,KAAK,GAAG,IAAI,GAAG,EAA+B,CAAC;IACrD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,KAAK,GAAG,2BAA2B,CAAC,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7D,IAAI,KAAK,KAAK,IAAI;YAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/git-hooks.d.ts
CHANGED
|
@@ -50,6 +50,24 @@ export type HookInstallOutcome = {
|
|
|
50
50
|
detail: string;
|
|
51
51
|
action: string;
|
|
52
52
|
};
|
|
53
|
+
/**
|
|
54
|
+
* Whether a `.git/hooks/pre-commit` body was generated by a pre-commit
|
|
55
|
+
* FRAMEWORK rather than hand-written. Such a file carries no Gateforge
|
|
56
|
+
* marker by construction — the framework rewrites it from
|
|
57
|
+
* `.pre-commit-config.yaml` on every install — so every surface that
|
|
58
|
+
* asks "is the gate wired here?" has to ask this question instead of
|
|
59
|
+
* reading for our marker, or it reports a working setup as untouched.
|
|
60
|
+
*
|
|
61
|
+
* Exported so `enforcement doctor` and the installer answer with the
|
|
62
|
+
* same rule instead of two drifting marker lists.
|
|
63
|
+
*
|
|
64
|
+
* Args:
|
|
65
|
+
* body: the hook file's contents.
|
|
66
|
+
*
|
|
67
|
+
* Returns:
|
|
68
|
+
* boolean: true when the file is framework-managed.
|
|
69
|
+
*/
|
|
70
|
+
export declare function isFrameworkManagedHookBody(body: string): boolean;
|
|
53
71
|
/**
|
|
54
72
|
* Installs (or verifies) the active pre-commit hook (plan Phase 5 item
|
|
55
73
|
* 1). Writing the hook is not enough: after writing or finding a
|
package/dist/git-hooks.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-hooks.d.ts","sourceRoot":"","sources":["../src/git-hooks.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE5K,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC;AAE/I,4DAA4D;AAC5D,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,+DAA+D;AAC/D,eAAO,MAAM,kBAAkB,aAAa,CAAC;AAC7C,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,oCAAoC,CAAC;AACvE,kDAAkD;AAClD,eAAO,MAAM,mBAAmB,oCAAoC,CAAC;AAErE;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B,wBAAwB,CAAC;AAEjE,oEAAoE;AACpE,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACzE;IAAE,MAAM,EAAE,UAAU,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MA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AAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,MAAM,EAAE,OAAO,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAqCA;AAYD;;;;;;;;;;;GAWG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAMpF"}
|
package/dist/git-hooks.js
CHANGED
|
@@ -43,6 +43,26 @@ export const STAGED_GATE_SCRIPT_BASENAME = 'gateforge-staged.sh';
|
|
|
43
43
|
* regenerates this file from .pre-commit-config.yaml on every run, so any
|
|
44
44
|
* direct edit to it — including gateforge's — would be silently wiped). */
|
|
45
45
|
const FRAMEWORK_HOOK_MARKERS = ['File generated by pre-commit', '-mpre_commit'];
|
|
46
|
+
/**
|
|
47
|
+
* Whether a `.git/hooks/pre-commit` body was generated by a pre-commit
|
|
48
|
+
* FRAMEWORK rather than hand-written. Such a file carries no Gateforge
|
|
49
|
+
* marker by construction — the framework rewrites it from
|
|
50
|
+
* `.pre-commit-config.yaml` on every install — so every surface that
|
|
51
|
+
* asks "is the gate wired here?" has to ask this question instead of
|
|
52
|
+
* reading for our marker, or it reports a working setup as untouched.
|
|
53
|
+
*
|
|
54
|
+
* Exported so `enforcement doctor` and the installer answer with the
|
|
55
|
+
* same rule instead of two drifting marker lists.
|
|
56
|
+
*
|
|
57
|
+
* Args:
|
|
58
|
+
* body: the hook file's contents.
|
|
59
|
+
*
|
|
60
|
+
* Returns:
|
|
61
|
+
* boolean: true when the file is framework-managed.
|
|
62
|
+
*/
|
|
63
|
+
export function isFrameworkManagedHookBody(body) {
|
|
64
|
+
return FRAMEWORK_HOOK_MARKERS.some((marker) => body.includes(marker));
|
|
65
|
+
}
|
|
46
66
|
/**
|
|
47
67
|
* Installs (or verifies) the active pre-commit hook (plan Phase 5 item
|
|
48
68
|
* 1). Writing the hook is not enough: after writing or finding a
|
|
@@ -118,7 +138,7 @@ export function installCommitHook(cwd, env, gateArgs = ['check', '--staged', '--
|
|
|
118
138
|
// wiped on the next `pre-commit install`. Gateforge integrates through
|
|
119
139
|
// the framework config instead (the caller appends the gateforge hook
|
|
120
140
|
// block there); activation = the framework config carries the hook.
|
|
121
|
-
if (
|
|
141
|
+
if (isFrameworkManagedHookBody(body)) {
|
|
122
142
|
return {
|
|
123
143
|
status: 'framework',
|
|
124
144
|
hookPath,
|
package/dist/git-hooks.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-hooks.js","sourceRoot":"","sources":["../src/git-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAClG,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAE5K,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,eAAe,EAAE,oBAAoB,EAAE,CAAC;AAE/I,4DAA4D;AAC5D,MAAM,CAAC,MAAM,oBAAoB,GAAG,YAAY,CAAC;AACjD,+DAA+D;AAC/D,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC;AAC7C,yDAAyD;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,iCAAiC,CAAC;AACvE,kDAAkD;AAClD,MAAM,CAAC,MAA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,SAAS,CAAC,QAAQ,EAAE,CAAC,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IAC1F,IAAI,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,8BAA8B,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,GAAG,EAAE,CAAC;IAClF,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One run's answer to "which paths does Git ignore here". The two
|
|
3
|
+
* predicates are the contract callers use, so no caller can ask the
|
|
4
|
+
* file set a directory question or read past the `known: false` answer.
|
|
5
|
+
*/
|
|
6
|
+
export interface GitIgnoredScope {
|
|
7
|
+
/** False when Git could not answer; then both predicates are false. */
|
|
8
|
+
readonly known: boolean;
|
|
9
|
+
/** Whether the walk must not descend into this repo-relative directory. */
|
|
10
|
+
skipsDirectory(relativeDirectory: string): boolean;
|
|
11
|
+
/** Whether this repo-relative file is skipped by the walk. */
|
|
12
|
+
skipsFile(relativeFile: string): boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Asks Git which UNTRACKED paths this repository ignores. Callers
|
|
16
|
+
* compute this ONCE per run and hand it to every enumeration that must
|
|
17
|
+
* agree on the scan scope.
|
|
18
|
+
*
|
|
19
|
+
* Args:
|
|
20
|
+
* root: absolute repository root (the directory the walk starts at).
|
|
21
|
+
*
|
|
22
|
+
* Returns:
|
|
23
|
+
* GitIgnoredScope: the skip rules when Git answered; a `known: false`
|
|
24
|
+
* scope that skips nothing when there was no usable work tree.
|
|
25
|
+
*/
|
|
26
|
+
export declare function gitIgnoredPaths(root: string): GitIgnoredScope;
|
|
27
|
+
//# sourceMappingURL=git-ignored.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-ignored.d.ts","sourceRoot":"","sources":["../src/git-ignored.ts"],"names":[],"mappings":"AAyCA;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;IACxB,2EAA2E;IAC3E,cAAc,CAAC,iBAAiB,EAAE,MAAM,GAAG,OAAO,CAAC;IACnD,8DAA8D;IAC9D,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1C;AAQD;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CA8C7D"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git-ignore awareness for the DETECTOR-INPUT walk (owner decision D5,
|
|
3
|
+
* release 0.9.0).
|
|
4
|
+
*
|
|
5
|
+
* A consumer working copy holds whole gitignored trees the repository
|
|
6
|
+
* never owns as source: the minified trace-viewer bundles a Playwright
|
|
7
|
+
* run writes into `playwright-report/`, build output, local caches. The
|
|
8
|
+
* scan walked them exactly like committed code, so every minified call
|
|
9
|
+
* in them became detector evidence — hundreds of
|
|
10
|
+
* `FRONTEND_CALL_TARGET_UNRESOLVED` entries the owner then had to
|
|
11
|
+
* `adopt` away. A clean clone of the same commit scanned none of it.
|
|
12
|
+
* The set Git already knows is the one honest answer to "what is source
|
|
13
|
+
* here", so the scan asks Git once and skips exactly that.
|
|
14
|
+
*
|
|
15
|
+
* Properties this module guarantees:
|
|
16
|
+
*
|
|
17
|
+
* - **Deterministic across machines.** `core.excludesFile` is
|
|
18
|
+
* overridden to empty on the command line, so the user's global
|
|
19
|
+
* excludes file cannot change which files one repository's scan sees.
|
|
20
|
+
* `.gitignore` at any depth and `.git/info/exclude` still count —
|
|
21
|
+
* they are repository state, not machine state.
|
|
22
|
+
* - **Tracked files are never skipped.** `ls-files --others` reports
|
|
23
|
+
* UNTRACKED paths only, so a committed file that matches an ignore
|
|
24
|
+
* pattern stays in the scan (git's own semantics, and the same rule
|
|
25
|
+
* the static test scanner in `@gate-forge/pack-playwright` follows).
|
|
26
|
+
* - **Absence of an answer is not an answer.** Outside a work tree, or
|
|
27
|
+
* when git is missing, unreadable, or too slow, the scope reports
|
|
28
|
+
* `known: false` and both predicates are false — the caller keeps
|
|
29
|
+
* exactly today's behaviour and skips nothing. Nothing is printed: a
|
|
30
|
+
* repository without usable Git inventory is already surfaced by the
|
|
31
|
+
* input snapshot's `snapshot-unavailable` diagnostic, and the scan
|
|
32
|
+
* must not invent a second warning channel for it.
|
|
33
|
+
* - **Whole ignored directories arrive collapsed.** `--directory` makes
|
|
34
|
+
* Git report an entirely-ignored directory as one `dir/` entry, so the
|
|
35
|
+
* walk skips the subtree without descending into it. A directory
|
|
36
|
+
* holding a TRACKED file is never collapsed — Git reports the ignored
|
|
37
|
+
* files inside it individually — so collapsing can never hide a
|
|
38
|
+
* committed byte.
|
|
39
|
+
*/
|
|
40
|
+
import { spawnSync } from 'node:child_process';
|
|
41
|
+
/** Hard cap on the ignore query's output buffer. */
|
|
42
|
+
const MAX_IGNORE_OUTPUT_BYTES = 64 * 1024 * 1024;
|
|
43
|
+
/** The ignore query's deadline; a slower git answers nothing (today's behaviour). */
|
|
44
|
+
const IGNORE_QUERY_TIMEOUT_MS = 20_000;
|
|
45
|
+
/**
|
|
46
|
+
* Asks Git which UNTRACKED paths this repository ignores. Callers
|
|
47
|
+
* compute this ONCE per run and hand it to every enumeration that must
|
|
48
|
+
* agree on the scan scope.
|
|
49
|
+
*
|
|
50
|
+
* Args:
|
|
51
|
+
* root: absolute repository root (the directory the walk starts at).
|
|
52
|
+
*
|
|
53
|
+
* Returns:
|
|
54
|
+
* GitIgnoredScope: the skip rules when Git answered; a `known: false`
|
|
55
|
+
* scope that skips nothing when there was no usable work tree.
|
|
56
|
+
*/
|
|
57
|
+
export function gitIgnoredPaths(root) {
|
|
58
|
+
const result = spawnSync('git', [
|
|
59
|
+
'-c',
|
|
60
|
+
'core.excludesFile=',
|
|
61
|
+
'ls-files',
|
|
62
|
+
'--others',
|
|
63
|
+
'--ignored',
|
|
64
|
+
'--exclude-standard',
|
|
65
|
+
'--directory',
|
|
66
|
+
'-z',
|
|
67
|
+
], {
|
|
68
|
+
cwd: root,
|
|
69
|
+
encoding: 'utf8',
|
|
70
|
+
maxBuffer: MAX_IGNORE_OUTPUT_BYTES,
|
|
71
|
+
timeout: IGNORE_QUERY_TIMEOUT_MS,
|
|
72
|
+
});
|
|
73
|
+
if (result.error !== undefined) {
|
|
74
|
+
return { known: false, skipsDirectory: () => false, skipsFile: () => false };
|
|
75
|
+
}
|
|
76
|
+
// Non-zero is "not a repository" (128) or an unreadable work tree —
|
|
77
|
+
// both mean no answer, and an unanswered query skips nothing.
|
|
78
|
+
if (result.status !== 0) {
|
|
79
|
+
return { known: false, skipsDirectory: () => false, skipsFile: () => false };
|
|
80
|
+
}
|
|
81
|
+
const files = new Set();
|
|
82
|
+
const directories = new Set();
|
|
83
|
+
for (const entry of (result.stdout ?? '').split('\0')) {
|
|
84
|
+
if (entry.length === 0)
|
|
85
|
+
continue;
|
|
86
|
+
if (entry.endsWith('/')) {
|
|
87
|
+
directories.add(entry.slice(0, -1));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
files.add(entry);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
if (files.size === 0 && directories.size === 0) {
|
|
94
|
+
return { known: true, skipsDirectory: () => false, skipsFile: () => false };
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
known: true,
|
|
98
|
+
skipsDirectory: (relativeDirectory) => directories.has(relativeDirectory),
|
|
99
|
+
skipsFile: (relativeFile) => files.has(relativeFile),
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=git-ignored.js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AC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;QACtD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,SAAS;QACjC,IAAI,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACnB,CAAC;IACH,CAAC;IACD,IAAI,KAAK,CAAC,IAAI,KAAK,CAAC,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;QAC/C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC;IAC9E,CAAC;IACD,OAAO;QACL,KAAK,EAAE,IAAI;QACX,cAAc,EAAE,CAAC,iBAAiB,EAAE,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,iBAAiB,CAAC;QACzE,SAAS,EAAE,CAAC,YAAY,EAAE,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC;KACrD,CAAC;AACJ,CAAC"}
|
package/dist/glob.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { GitIgnoredScope } from './git-ignored.js';
|
|
1
2
|
/** One filesystem failure encountered while expanding the scan. */
|
|
2
3
|
export interface ExpandError {
|
|
3
4
|
/** The repo-root-relative path that could not be read. */
|
|
@@ -6,22 +7,40 @@ export interface ExpandError {
|
|
|
6
7
|
detail: string;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
|
-
* Expands
|
|
10
|
-
*
|
|
10
|
+
* Expands the configured include/exclude globs into the DETECTOR-INPUT
|
|
11
|
+
* scope: every match minus the paths this run's Git-ignore scope
|
|
12
|
+
* excludes. This is the list handed to every plugin's `discover`
|
|
13
|
+
* request, and the classifier's coverage check compares its requested
|
|
14
|
+
* paths against what detectors actually scanned — so an ignored tree
|
|
15
|
+
* must leave BOTH sides, or the closed-world check would compare sets
|
|
16
|
+
* the walk never intended to describe.
|
|
17
|
+
*
|
|
18
|
+
* The caller computes the scope ONCE per run (`gitIgnoredPaths` in
|
|
19
|
+
* `./git-ignored.ts`) and passes the same object here every time, so
|
|
20
|
+
* every enumeration of the scan scope agrees on one answer.
|
|
21
|
+
*
|
|
22
|
+
* Args:
|
|
23
|
+
* include: include globs (at least one, schema-enforced).
|
|
24
|
+
* exclude: exclude globs (possibly empty).
|
|
25
|
+
* root: absolute repo root to walk.
|
|
26
|
+
* gitIgnored: the run's Git-ignore scope; a `known: false` scope skips
|
|
27
|
+
* nothing, which is exactly today's behaviour outside a work tree.
|
|
28
|
+
* errors: out-array collecting every unreadable path.
|
|
11
29
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
30
|
+
* Returns:
|
|
31
|
+
* string[]: deduplicated, codepoint-sorted posix paths.
|
|
32
|
+
*/
|
|
33
|
+
export declare function expandScanPaths(include: readonly string[], exclude: readonly string[], root: string, gitIgnored: GitIgnoredScope, errors?: ExpandError[]): string[];
|
|
34
|
+
/**
|
|
35
|
+
* Expands include globs minus exclude globs into concrete repo-root-
|
|
36
|
+
* relative file paths, consulting no ignore rules: the IDENTITY scope.
|
|
37
|
+
* Every glob match is returned, gitignored or not.
|
|
17
38
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* Unlike unreadable directories, a skipped symlink can never conceal a
|
|
24
|
-
* repository file — so no error is reported and none is needed.
|
|
39
|
+
* `collectDeclaredInputs` (input snapshot) calls this and must keep
|
|
40
|
+
* hashing a superset of the scan — a gitignored configured input still
|
|
41
|
+
* moves the receipt digest, which is the conservative direction and the
|
|
42
|
+
* behaviour `assertOutputDisjoint` relies on when it refuses an `--out`
|
|
43
|
+
* that would hide a declared input.
|
|
25
44
|
*
|
|
26
45
|
* Args:
|
|
27
46
|
* include: include globs (at least one, schema-enforced).
|
package/dist/glob.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../src/glob.ts"],"names":[],"mappings":"AAwCA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAiBxD,mEAAmE;AACnE,MAAM,WAAW,WAAW;IAC1B,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,MAAM,EAAE,MAAM,CAAC;CAChB;AA4GD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,eAAe,EAC3B,MAAM,CAAC,EAAE,WAAW,EAAE,GACrB,MAAM,EAAE,CAEV;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,IAAI,EAAE,MAAM,EACZ,MAAM,CAAC,EAAE,WAAW,EAAE,GACrB,MAAM,EAAE,CAEV"}
|