@ploaness/governance 1.0.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/LICENSE +21 -0
- package/README.md +13 -0
- package/dist/access-boundary.d.ts +41 -0
- package/dist/access-boundary.d.ts.map +1 -0
- package/dist/access-boundary.js +26 -0
- package/dist/access-boundary.js.map +1 -0
- package/dist/agent-references.d.ts +12 -0
- package/dist/agent-references.d.ts.map +1 -0
- package/dist/agent-references.js +53 -0
- package/dist/agent-references.js.map +1 -0
- package/dist/architecture-layers.d.ts +11 -0
- package/dist/architecture-layers.d.ts.map +1 -0
- package/dist/architecture-layers.js +47 -0
- package/dist/architecture-layers.js.map +1 -0
- package/dist/asset-policy.d.ts +138 -0
- package/dist/asset-policy.d.ts.map +1 -0
- package/dist/asset-policy.js +312 -0
- package/dist/asset-policy.js.map +1 -0
- package/dist/banned-typography.d.ts +13 -0
- package/dist/banned-typography.d.ts.map +1 -0
- package/dist/banned-typography.js +78 -0
- package/dist/banned-typography.js.map +1 -0
- package/dist/bundle-budget.d.ts +16 -0
- package/dist/bundle-budget.d.ts.map +1 -0
- package/dist/bundle-budget.js +37 -0
- package/dist/bundle-budget.js.map +1 -0
- package/dist/commit-message.d.ts +37 -0
- package/dist/commit-message.d.ts.map +1 -0
- package/dist/commit-message.js +144 -0
- package/dist/commit-message.js.map +1 -0
- package/dist/config-references.d.ts +17 -0
- package/dist/config-references.d.ts.map +1 -0
- package/dist/config-references.js +54 -0
- package/dist/config-references.js.map +1 -0
- package/dist/container-failure.d.ts +40 -0
- package/dist/container-failure.d.ts.map +1 -0
- package/dist/container-failure.js +154 -0
- package/dist/container-failure.js.map +1 -0
- package/dist/container-files.d.ts +36 -0
- package/dist/container-files.d.ts.map +1 -0
- package/dist/container-files.js +74 -0
- package/dist/container-files.js.map +1 -0
- package/dist/container-freshness.d.ts +102 -0
- package/dist/container-freshness.d.ts.map +1 -0
- package/dist/container-freshness.js +129 -0
- package/dist/container-freshness.js.map +1 -0
- package/dist/dependency-freshness.d.ts +129 -0
- package/dist/dependency-freshness.d.ts.map +1 -0
- package/dist/dependency-freshness.js +161 -0
- package/dist/dependency-freshness.js.map +1 -0
- package/dist/doc-blocks.d.ts +13 -0
- package/dist/doc-blocks.d.ts.map +1 -0
- package/dist/doc-blocks.js +75 -0
- package/dist/doc-blocks.js.map +1 -0
- package/dist/document-references.d.ts +44 -0
- package/dist/document-references.d.ts.map +1 -0
- package/dist/document-references.js +94 -0
- package/dist/document-references.js.map +1 -0
- package/dist/editorconfig-policy.d.ts +24 -0
- package/dist/editorconfig-policy.d.ts.map +1 -0
- package/dist/editorconfig-policy.js +106 -0
- package/dist/editorconfig-policy.js.map +1 -0
- package/dist/environment-files.d.ts +42 -0
- package/dist/environment-files.d.ts.map +1 -0
- package/dist/environment-files.js +76 -0
- package/dist/environment-files.js.map +1 -0
- package/dist/file-roles.d.ts +39 -0
- package/dist/file-roles.d.ts.map +1 -0
- package/dist/file-roles.js +82 -0
- package/dist/file-roles.js.map +1 -0
- package/dist/generated-denial.d.ts +42 -0
- package/dist/generated-denial.d.ts.map +1 -0
- package/dist/generated-denial.js +87 -0
- package/dist/generated-denial.js.map +1 -0
- package/dist/history-policy.d.ts +32 -0
- package/dist/history-policy.d.ts.map +1 -0
- package/dist/history-policy.js +50 -0
- package/dist/history-policy.js.map +1 -0
- package/dist/image-assets.d.ts +14 -0
- package/dist/image-assets.d.ts.map +1 -0
- package/dist/image-assets.js +205 -0
- package/dist/image-assets.js.map +1 -0
- package/dist/index.d.ts +49 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +53 -0
- package/dist/index.js.map +1 -0
- package/dist/install-policy.d.ts +35 -0
- package/dist/install-policy.d.ts.map +1 -0
- package/dist/install-policy.js +61 -0
- package/dist/install-policy.js.map +1 -0
- package/dist/json-shapes.d.ts +86 -0
- package/dist/json-shapes.d.ts.map +1 -0
- package/dist/json-shapes.js +124 -0
- package/dist/json-shapes.js.map +1 -0
- package/dist/license-allowlist.d.ts +15 -0
- package/dist/license-allowlist.d.ts.map +1 -0
- package/dist/license-allowlist.js +157 -0
- package/dist/license-allowlist.js.map +1 -0
- package/dist/network-policy.d.ts +69 -0
- package/dist/network-policy.d.ts.map +1 -0
- package/dist/network-policy.js +173 -0
- package/dist/network-policy.js.map +1 -0
- package/dist/paired-assets.d.ts +34 -0
- package/dist/paired-assets.d.ts.map +1 -0
- package/dist/paired-assets.js +63 -0
- package/dist/paired-assets.js.map +1 -0
- package/dist/payload-access.d.ts +9 -0
- package/dist/payload-access.d.ts.map +1 -0
- package/dist/payload-access.js +168 -0
- package/dist/payload-access.js.map +1 -0
- package/dist/payload-policy.d.ts +18 -0
- package/dist/payload-policy.d.ts.map +1 -0
- package/dist/payload-policy.js +124 -0
- package/dist/payload-policy.js.map +1 -0
- package/dist/payload-source.d.ts +29 -0
- package/dist/payload-source.d.ts.map +1 -0
- package/dist/payload-source.js +84 -0
- package/dist/payload-source.js.map +1 -0
- package/dist/release-age.d.ts +23 -0
- package/dist/release-age.d.ts.map +1 -0
- package/dist/release-age.js +38 -0
- package/dist/release-age.js.map +1 -0
- package/dist/request-limits.d.ts +39 -0
- package/dist/request-limits.d.ts.map +1 -0
- package/dist/request-limits.js +57 -0
- package/dist/request-limits.js.map +1 -0
- package/dist/run-plan.d.ts +32 -0
- package/dist/run-plan.d.ts.map +1 -0
- package/dist/run-plan.js +43 -0
- package/dist/run-plan.js.map +1 -0
- package/dist/run-policy.d.ts +32 -0
- package/dist/run-policy.d.ts.map +1 -0
- package/dist/run-policy.js +37 -0
- package/dist/run-policy.js.map +1 -0
- package/dist/secret-policy.d.ts +13 -0
- package/dist/secret-policy.d.ts.map +1 -0
- package/dist/secret-policy.js +69 -0
- package/dist/secret-policy.js.map +1 -0
- package/dist/settings-layering.d.ts +45 -0
- package/dist/settings-layering.d.ts.map +1 -0
- package/dist/settings-layering.js +134 -0
- package/dist/settings-layering.js.map +1 -0
- package/dist/settings.d.ts +238 -0
- package/dist/settings.d.ts.map +1 -0
- package/dist/settings.js +378 -0
- package/dist/settings.js.map +1 -0
- package/dist/skill-manifest.d.ts +18 -0
- package/dist/skill-manifest.d.ts.map +1 -0
- package/dist/skill-manifest.js +125 -0
- package/dist/skill-manifest.js.map +1 -0
- package/dist/source-text.d.ts +83 -0
- package/dist/source-text.d.ts.map +1 -0
- package/dist/source-text.js +310 -0
- package/dist/source-text.js.map +1 -0
- package/dist/suppression-ceiling.d.ts +48 -0
- package/dist/suppression-ceiling.d.ts.map +1 -0
- package/dist/suppression-ceiling.js +115 -0
- package/dist/suppression-ceiling.js.map +1 -0
- package/dist/tailwind-tokens.d.ts +16 -0
- package/dist/tailwind-tokens.d.ts.map +1 -0
- package/dist/tailwind-tokens.js +70 -0
- package/dist/tailwind-tokens.js.map +1 -0
- package/dist/text-escapes.d.ts +7 -0
- package/dist/text-escapes.d.ts.map +1 -0
- package/dist/text-escapes.js +14 -0
- package/dist/text-escapes.js.map +1 -0
- package/dist/toolchain-pins.d.ts +42 -0
- package/dist/toolchain-pins.d.ts.map +1 -0
- package/dist/toolchain-pins.js +99 -0
- package/dist/toolchain-pins.js.map +1 -0
- package/dist/url-safety.d.ts +12 -0
- package/dist/url-safety.d.ts.map +1 -0
- package/dist/url-safety.js +58 -0
- package/dist/url-safety.js.map +1 -0
- package/dist/version-policy.d.ts +99 -0
- package/dist/version-policy.d.ts.map +1 -0
- package/dist/version-policy.js +306 -0
- package/dist/version-policy.js.map +1 -0
- package/dist/vulnerability-policy.d.ts +66 -0
- package/dist/vulnerability-policy.d.ts.map +1 -0
- package/dist/vulnerability-policy.js +106 -0
- package/dist/vulnerability-policy.js.map +1 -0
- package/dist/wiring-policy.d.ts +226 -0
- package/dist/wiring-policy.d.ts.map +1 -0
- package/dist/wiring-policy.js +458 -0
- package/dist/wiring-policy.js.map +1 -0
- package/dist/wiring-violation.d.ts +6 -0
- package/dist/wiring-violation.d.ts.map +1 -0
- package/dist/wiring-violation.js +8 -0
- package/dist/wiring-violation.js.map +1 -0
- package/dist/workspace-policy.d.ts +177 -0
- package/dist/workspace-policy.d.ts.map +1 -0
- package/dist/workspace-policy.js +228 -0
- package/dist/workspace-policy.js.map +1 -0
- package/dist/yaml-blocks.d.ts +43 -0
- package/dist/yaml-blocks.d.ts.map +1 -0
- package/dist/yaml-blocks.js +87 -0
- package/dist/yaml-blocks.js.map +1 -0
- package/package.json +41 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-policy.js","sourceRoot":"","sources":["../src/payload-policy.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,mGAAmG;AACnG,EAAE;AACF,wGAAwG;AACxG,qGAAqG;AACrG,uGAAuG;AACvG,wGAAwG;AACxG,sGAAsG;AACtG,EAAE;AACF,mGAAmG;AACnG,uGAAuG;AACvG,oGAAoG;AACpG,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,GACxB,MAAM,qBAAqB,CAAA;AAE5B,OAAO,EACL,iBAAiB,EACjB,MAAM,EACN,WAAW,EACX,aAAa,EACb,aAAa,GACd,MAAM,kBAAkB,CAAA;AASzB,yGAAyG;AACzG,gGAAgG;AAChG,MAAM,aAAa,GAA+B;IAChD;QACE,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC;QAC5B,IAAI,EAAE,mBAAmB;QACzB,MAAM,EACJ,uGAAuG;KAC1G;IACD;QACE,IAAI,EAAE,YAAY;QAClB,QAAQ,EAAE,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,uBAAuB;QAC7B,MAAM,EAAE,gFAAgF;KACzF;IACD;QACE,IAAI,EAAE,cAAc;QACpB,QAAQ,EAAE,CAAC,OAAO,CAAC;QACnB,IAAI,EAAE,yBAAyB;QAC/B,MAAM,EAAE,kFAAkF;KAC3F;CACF,CAAA;AAED,oGAAoG;AACpG,sGAAsG;AACtG,uGAAuG;AACvG,mGAAmG;AACnG,0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EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC;gBACjC,IAAI,EAAE,0BAA0B;gBAChC,MAAM,EAAE,kEAAkE,SAAS,GAAG;aACvF;SACF,CAAA;AACP,CAAC,CACF,CAAA;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,MAAc,EAA+B,EAAE,CAClF,uBAAuB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;AAEhD;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,MAAc,EAA+B,EAAE;IACnF,mGAAmG;IACnG,kFAAkF;IAClF,MAAM,IAAI,GAAW,aAAa,CAAC,MAAM,CAAC,CAAA;IAC1C,OAAO;QACL,GAAG,kBAAkB,CAAC,IAAI,CAAC;QAC3B,GAAG,kBAAkB,CAAC,IAAI,CAAC;QAC3B,GAAG,oBAAoB,CAAC,IAAI,CAAC;QAC7B,GAAG,kBAAkB,CAAC,IAAI,CAAC;QAC3B,GAAG,uBAAuB,CAAC,IAAI,CAAC;QAChC,GAAG,uBAAuB,CAAC,IAAI,CAAC;KACjC,CAAA;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/** A Payload usage defect found in project source. */
|
|
2
|
+
export interface PayloadViolation {
|
|
3
|
+
readonly line: number;
|
|
4
|
+
readonly rule: string;
|
|
5
|
+
readonly reason: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* The raw text of a depth-one key's value, from its colon to the end of the enclosing literal.
|
|
9
|
+
* @param wrapped the config body, brace-delimited.
|
|
10
|
+
* @param key the key to read.
|
|
11
|
+
* @returns the text after the key's colon, or undefined when the key is not declared at depth one.
|
|
12
|
+
*/
|
|
13
|
+
export declare const depthOneValue: (wrapped: string, key: string) => string | undefined;
|
|
14
|
+
/**
|
|
15
|
+
* The keys declared inside a depth-one key's own object literal.
|
|
16
|
+
* @param wrapped the config body, brace-delimited.
|
|
17
|
+
* @param key the key whose block to read.
|
|
18
|
+
* @returns the block's depth-one keys, or an empty list when the key is absent.
|
|
19
|
+
*/
|
|
20
|
+
export declare const depthOneBlockKeys: (wrapped: string, key: string) => readonly string[];
|
|
21
|
+
/**
|
|
22
|
+
* The brace-delimited body of the config a marker names, in either declaration order.
|
|
23
|
+
* @param source the file contents.
|
|
24
|
+
* @param marker the offset of the type reference.
|
|
25
|
+
* @param isTrailing true when the type follows the value, as `satisfies` does.
|
|
26
|
+
* @returns the body wrapped in its own braces, or undefined when no literal belongs to the marker.
|
|
27
|
+
*/
|
|
28
|
+
export declare const configBody: (source: string, marker: number, isTrailing: boolean) => string | undefined;
|
|
29
|
+
//# sourceMappingURL=payload-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-source.d.ts","sourceRoot":"","sources":["../src/payload-source.ts"],"names":[],"mappings":"AAgBA,sDAAsD;AACtD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAwBD;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GAAI,SAAS,MAAM,EAAE,KAAK,MAAM,KAAG,MAAM,GAAG,SAOrE,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,EAAE,KAAK,MAAM,KAAG,SAAS,MAAM,EAG/E,CAAA;AAkCD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,QAAQ,MAAM,EACd,QAAQ,MAAM,EACd,YAAY,OAAO,KAClB,MAAM,GAAG,SAWX,CAAA"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// The Payload half of the source reader: which object literal in a file IS a collection or a global,
|
|
2
|
+
// and what its own keys say.
|
|
3
|
+
//
|
|
4
|
+
// The generic scanning it stands on is in `source-text.ts`. What is here is everything that needs to
|
|
5
|
+
// know Payload's shape - the three ways a config is declared, and the difference between a key the
|
|
6
|
+
// config declares and one a field beneath it does.
|
|
7
|
+
import { balancedArguments, LAST_CHARACTER, NOT_FOUND, scanDelimited, topLevelKeys, } from './source-text.js';
|
|
8
|
+
// Where a key sits directly inside the outermost object literal, rather than inside something nested in
|
|
9
|
+
// it. Searching the text instead would find a field-level `access` block and read it as the collection's
|
|
10
|
+
// own, which is exactly the omission the access rules exist to catch.
|
|
11
|
+
//
|
|
12
|
+
// The boundary requirement is the same one `TOP_LEVEL_KEY` carries, and for the same reason: the scan
|
|
13
|
+
// visits every offset, so a pattern anchored only at the start of the remaining text matched mid-word.
|
|
14
|
+
// `oauth:` was read as `auth:` and reported a collection with no auth as one with unhardened auth. The
|
|
15
|
+
// delimiter is required rather than merely allowed, so the returned offset is the brace or comma that
|
|
16
|
+
// opens the key rather than the key itself; every reader below looks forward from it either way.
|
|
17
|
+
const depthOneKeyIndex = (text, key) => {
|
|
18
|
+
const pattern = new RegExp(String.raw `^[{,]\s*${key}\s*:`);
|
|
19
|
+
return scanDelimited(text, 0, (found, step) => step.depth === 1 && pattern.test(text.slice(step.index))
|
|
20
|
+
? { state: step.index, stop: true }
|
|
21
|
+
: { state: found, stop: false }, NOT_FOUND);
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* The raw text of a depth-one key's value, from its colon to the end of the enclosing literal.
|
|
25
|
+
* @param wrapped the config body, brace-delimited.
|
|
26
|
+
* @param key the key to read.
|
|
27
|
+
* @returns the text after the key's colon, or undefined when the key is not declared at depth one.
|
|
28
|
+
*/
|
|
29
|
+
export const depthOneValue = (wrapped, key) => {
|
|
30
|
+
const at = depthOneKeyIndex(wrapped, key);
|
|
31
|
+
if (at === NOT_FOUND) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
const colon = wrapped.indexOf(':', at);
|
|
35
|
+
return colon === NOT_FOUND ? undefined : wrapped.slice(colon + 1);
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* The keys declared inside a depth-one key's own object literal.
|
|
39
|
+
* @param wrapped the config body, brace-delimited.
|
|
40
|
+
* @param key the key whose block to read.
|
|
41
|
+
* @returns the block's depth-one keys, or an empty list when the key is absent.
|
|
42
|
+
*/
|
|
43
|
+
export const depthOneBlockKeys = (wrapped, key) => {
|
|
44
|
+
const at = depthOneKeyIndex(wrapped, key);
|
|
45
|
+
return at === NOT_FOUND ? [] : topLevelKeys(wrapped, at);
|
|
46
|
+
};
|
|
47
|
+
const withClose = (spans, close) => {
|
|
48
|
+
const last = spans.at(LAST_CHARACTER);
|
|
49
|
+
return last?.close === NOT_FOUND
|
|
50
|
+
? [...spans.slice(0, LAST_CHARACTER), { open: last.open, close }]
|
|
51
|
+
: spans;
|
|
52
|
+
};
|
|
53
|
+
// Every module-level `{ ... }` in the file, collected in one pass. The `satisfies` form writes the type
|
|
54
|
+
// AFTER the value, so its body cannot be found by scanning forward from the marker the way an
|
|
55
|
+
// annotation's can - it is the literal that closes just before the marker instead, and finding that by
|
|
56
|
+
// walking backwards would mean a second scanner that cannot skip string literals.
|
|
57
|
+
const moduleLiterals = (source) => scanDelimited(source, 0, (spans, step) => {
|
|
58
|
+
if (step.character === '{' && step.depth === 1) {
|
|
59
|
+
return { state: [...spans, { open: step.index, close: NOT_FOUND }], stop: false };
|
|
60
|
+
}
|
|
61
|
+
return step.character === '}' && step.depth === 0
|
|
62
|
+
? { state: withClose(spans, step.index), stop: false }
|
|
63
|
+
: { state: spans, stop: false };
|
|
64
|
+
}, []);
|
|
65
|
+
/**
|
|
66
|
+
* The brace-delimited body of the config a marker names, in either declaration order.
|
|
67
|
+
* @param source the file contents.
|
|
68
|
+
* @param marker the offset of the type reference.
|
|
69
|
+
* @param isTrailing true when the type follows the value, as `satisfies` does.
|
|
70
|
+
* @returns the body wrapped in its own braces, or undefined when no literal belongs to the marker.
|
|
71
|
+
*/
|
|
72
|
+
export const configBody = (source, marker, isTrailing) => {
|
|
73
|
+
const open = isTrailing
|
|
74
|
+
? (moduleLiterals(source)
|
|
75
|
+
.filter((span) => span.close !== NOT_FOUND && span.close < marker)
|
|
76
|
+
.at(LAST_CHARACTER)?.open ?? NOT_FOUND)
|
|
77
|
+
: source.indexOf('{', marker);
|
|
78
|
+
if (open === NOT_FOUND) {
|
|
79
|
+
return undefined;
|
|
80
|
+
}
|
|
81
|
+
const body = balancedArguments(source, open);
|
|
82
|
+
return body === undefined ? undefined : `{${body}}`;
|
|
83
|
+
};
|
|
84
|
+
//# sourceMappingURL=payload-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payload-source.js","sourceRoot":"","sources":["../src/payload-source.ts"],"names":[],"mappings":"AAAA,qGAAqG;AACrG,6BAA6B;AAC7B,EAAE;AACF,qGAAqG;AACrG,mGAAmG;AACnG,mDAAmD;AACnD,OAAO,EACL,iBAAiB,EAEjB,cAAc,EACd,SAAS,EAET,aAAa,EACb,YAAY,GACb,MAAM,kBAAkB,CAAA;AASzB,wGAAwG;AACxG,yGAAyG;AACzG,sEAAsE;AACtE,EAAE;AACF,sGAAsG;AACtG,uGAAuG;AACvG,uGAAuG;AACvG,sGAAsG;AACtG,iGAAiG;AACjG,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,GAAW,EAAU,EAAE;IAC7D,MAAM,OAAO,GAAW,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAA,WAAW,GAAG,MAAM,CAAC,CAAA;IAClE,OAAO,aAAa,CAClB,IAAI,EACJ,CAAC,EACD,CAAC,KAAa,EAAE,IAAc,EAAkB,EAAE,CAChD,IAAI,CAAC,KAAK,KAAK,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACtD,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE;QACnC,CA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AS,CAAA;IAClB,CAAC;IACD,MAAM,IAAI,GAAuB,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAA;IAChE,OAAO,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,IAAI,GAAG,CAAA;AACrD,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Hours a published release must have existed before pnpm will install it. */
|
|
2
|
+
export declare const RELEASE_AGE_FLOOR_HOURS: number;
|
|
3
|
+
/** A release's publication instant measured against now, both as epoch milliseconds. */
|
|
4
|
+
export interface ReleaseAge {
|
|
5
|
+
/** When the release was published, or undefined when the registry did not say. */
|
|
6
|
+
readonly publishedAt: number | undefined;
|
|
7
|
+
/** The instant to measure the publication against. */
|
|
8
|
+
readonly now: number;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Whole hours a release has existed, so a report can say how much of the wait is left.
|
|
12
|
+
* @param age the publication instant and the instant to measure it against.
|
|
13
|
+
* @returns the floored hours, or `undefined` when the publication instant is unknown.
|
|
14
|
+
*/
|
|
15
|
+
export declare const hoursPublished: (age: ReleaseAge) => number | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* Whether pnpm would refuse this release for being younger than the floor.
|
|
18
|
+
* @param age the publication instant and the instant to measure it against.
|
|
19
|
+
* @returns true only when the age is KNOWN and below the floor. An unknown date is never held, because
|
|
20
|
+
* a report that guessed would withhold an update the project can take today.
|
|
21
|
+
*/
|
|
22
|
+
export declare const isHeldByReleaseAge: (age: ReleaseAge) => boolean;
|
|
23
|
+
//# sourceMappingURL=release-age.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-age.d.ts","sourceRoot":"","sources":["../src/release-age.ts"],"names":[],"mappings":"AAmBA,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,EAAE,MAAW,CAAA;AAEjD,wFAAwF;AACxF,MAAM,WAAW,UAAU;IACzB,kFAAkF;IAClF,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAA;IACxC,sDAAsD;IACtD,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CACrB;AAED;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,KAAK,UAAU,KAAG,MAAM,GAAG,SAGW,CAAA;AAErE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,KAAK,UAAU,KAAG,OAGpD,CAAA"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Whether a published release is old enough to be installed at all.
|
|
2
|
+
//
|
|
3
|
+
// pnpm refuses a release younger than a minimum age. That guards against a compromised publish: a
|
|
4
|
+
// malicious version is usually pulled within hours of being noticed, so the wait costs a day and buys
|
|
5
|
+
// the window in which the registry corrects itself. The freshness report has to know about it, because
|
|
6
|
+
// an update named without it sends a reader to an install pnpm will refuse, and the reader then either
|
|
7
|
+
// waits without knowing why or spends the guard on an exclusion to get past it.
|
|
8
|
+
//
|
|
9
|
+
// The floor is pnpm's rather than ploaness's, and pnpm neither documents the default nor answers
|
|
10
|
+
// `pnpm config get minimumReleaseAge` for it. The value below was established by observation - refused
|
|
11
|
+
// at 13h and again at 23h58m, taken at 33h and at six days - so it is stated as a named constant a
|
|
12
|
+
// reader can check and a maintainer can correct, rather than buried inside a comparison.
|
|
13
|
+
//
|
|
14
|
+
// Held is a third thing the report can say, not a fourth verdict the gate can reach. Nothing here
|
|
15
|
+
// fails a build: a release too young to install is a fact about the registry, never a defect in the
|
|
16
|
+
// project reading it.
|
|
17
|
+
const MILLISECONDS_PER_HOUR = 3_600_000;
|
|
18
|
+
/** Hours a published release must have existed before pnpm will install it. */
|
|
19
|
+
export const RELEASE_AGE_FLOOR_HOURS = 24;
|
|
20
|
+
/**
|
|
21
|
+
* Whole hours a release has existed, so a report can say how much of the wait is left.
|
|
22
|
+
* @param age the publication instant and the instant to measure it against.
|
|
23
|
+
* @returns the floored hours, or `undefined` when the publication instant is unknown.
|
|
24
|
+
*/
|
|
25
|
+
export const hoursPublished = (age) => age.publishedAt === undefined
|
|
26
|
+
? undefined
|
|
27
|
+
: Math.floor((age.now - age.publishedAt) / MILLISECONDS_PER_HOUR);
|
|
28
|
+
/**
|
|
29
|
+
* Whether pnpm would refuse this release for being younger than the floor.
|
|
30
|
+
* @param age the publication instant and the instant to measure it against.
|
|
31
|
+
* @returns true only when the age is KNOWN and below the floor. An unknown date is never held, because
|
|
32
|
+
* a report that guessed would withhold an update the project can take today.
|
|
33
|
+
*/
|
|
34
|
+
export const isHeldByReleaseAge = (age) => {
|
|
35
|
+
const hours = hoursPublished(age);
|
|
36
|
+
return hours !== undefined && hours < RELEASE_AGE_FLOOR_HOURS;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=release-age.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"release-age.js","sourceRoot":"","sources":["../src/release-age.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,EAAE;AACF,kGAAkG;AAClG,sGAAsG;AACtG,uGAAuG;AACvG,uGAAuG;AACvG,gFAAgF;AAChF,EAAE;AACF,iGAAiG;AACjG,uGAAuG;AACvG,mGAAmG;AACnG,yFAAyF;AACzF,EAAE;AACF,kGAAkG;AAClG,oGAAoG;AACpG,sBAAsB;AAEtB,MAAM,qBAAqB,GAAW,SAAS,CAAA;AAE/C,+EAA+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAW,EAAE,CAAA;AAUjD;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAe,EAAsB,EAAE,CACpE,GAAG,CAAC,WAAW,KAAK,SAAS;IAC3B,CAAC,CAAC,SAAS;IACX,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,WAAW,CAAC,GAAG,qBAAqB,CAAC,CAAA;AAErE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAe,EAAW,EAAE;IAC7D,MAAM,KAAK,GAAuB,cAAc,CAAC,GAAG,CAAC,CAAA;IACrD,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,GAAG,uBAAuB,CAAA;AAC/D,CAAC,CAAA"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* How long any single request to a package or image registry may take.
|
|
3
|
+
*
|
|
4
|
+
* Shared by both registry readers rather than stated twice. They ask different hosts different
|
|
5
|
+
* questions, but "how long will the harness wait for an answer" is one decision, and two literals that
|
|
6
|
+
* must stay equal will not stay equal.
|
|
7
|
+
*/
|
|
8
|
+
export declare const REQUEST_TIMEOUT_MS: number;
|
|
9
|
+
/**
|
|
10
|
+
* How long a networked tool the harness shells out to may run before it is killed.
|
|
11
|
+
*
|
|
12
|
+
* Far longer than a single request, because the tool resolves a whole lockfile before it asks anything.
|
|
13
|
+
* This is a bound on a hang rather than a performance budget: a healthy run never approaches it, and a
|
|
14
|
+
* run that does has stopped making progress.
|
|
15
|
+
*/
|
|
16
|
+
export declare const NETWORKED_TOOL_TIMEOUT_MS: number;
|
|
17
|
+
/**
|
|
18
|
+
* How many registry requests the harness holds open at once.
|
|
19
|
+
*
|
|
20
|
+
* A workspace declares hundreds of distinct coordinates, and asking for all of them at once opens a
|
|
21
|
+
* socket per dependency - which the registry answers by rate-limiting, and which a corporate proxy
|
|
22
|
+
* answers by dropping. Neither failure names its cause, so both arrive as "the registry was
|
|
23
|
+
* unreachable" for a network that was reachable all along.
|
|
24
|
+
*/
|
|
25
|
+
export declare const REGISTRY_CONCURRENCY: number;
|
|
26
|
+
/**
|
|
27
|
+
* Map over items with at most `limit` in flight, preserving input order.
|
|
28
|
+
*
|
|
29
|
+
* Windowed rather than a sliding pool, because a pool needs a shared cursor and this repository bans
|
|
30
|
+
* the mutation that would take. A window costs the tail of each batch waiting on its slowest member,
|
|
31
|
+
* which for short registry reads is a smaller price than the rule it would break.
|
|
32
|
+
* @param items what to work through, in the order the results must come back in.
|
|
33
|
+
* @param limit the most that may be in flight at once; a limit below one is read as one, since a
|
|
34
|
+
* limit of zero would otherwise consume nothing and never finish.
|
|
35
|
+
* @param work what to do with one item.
|
|
36
|
+
* @returns every result, in the order of `items`.
|
|
37
|
+
*/
|
|
38
|
+
export declare const mapWithConcurrency: <Item, Result>(items: readonly Item[], limit: number, work: (item: Item) => Promise<Result>) => Promise<readonly Result[]>;
|
|
39
|
+
//# sourceMappingURL=request-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-limits.d.ts","sourceRoot":"","sources":["../src/request-limits.ts"],"names":[],"mappings":"AAYA;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,EAAE,MAAe,CAAA;AAEhD;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAgB,CAAA;AAExD;;;;;;;GAOG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAU,CAAA;AAE7C;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,GAAU,IAAI,EAAE,MAAM,EACnD,OAAO,SAAS,IAAI,EAAE,EACtB,OAAO,MAAM,EACb,MAAM,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,KACpC,OAAO,CAAC,SAAS,MAAM,EAAE,CAS3B,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// The bounds the harness places on its OWN outbound work, and the one combinator that applies them.
|
|
2
|
+
//
|
|
3
|
+
// This is the first async module among the rules, and it is here rather than in the CLI for the reason
|
|
4
|
+
// the split states: what it decides is a policy - how long the harness waits, and how many sockets it
|
|
5
|
+
// will hold open at once - and a policy expressed as a pure function can be asserted against, while the
|
|
6
|
+
// same policy expressed inline in a fetch call can only be observed by hanging. Nothing here performs
|
|
7
|
+
// I/O; the work is supplied by the caller, which is where the I/O stays.
|
|
8
|
+
//
|
|
9
|
+
// The bound that was missing cost more than the bound that was wrong. An unbounded fetch produces no
|
|
10
|
+
// output and no verdict, so on a team's CI a stuck gate is indistinguishable from a stuck build - and
|
|
11
|
+
// unlike a gate failure, nothing says which it is, because nothing ends.
|
|
12
|
+
/**
|
|
13
|
+
* How long any single request to a package or image registry may take.
|
|
14
|
+
*
|
|
15
|
+
* Shared by both registry readers rather than stated twice. They ask different hosts different
|
|
16
|
+
* questions, but "how long will the harness wait for an answer" is one decision, and two literals that
|
|
17
|
+
* must stay equal will not stay equal.
|
|
18
|
+
*/
|
|
19
|
+
export const REQUEST_TIMEOUT_MS = 30_000;
|
|
20
|
+
/**
|
|
21
|
+
* How long a networked tool the harness shells out to may run before it is killed.
|
|
22
|
+
*
|
|
23
|
+
* Far longer than a single request, because the tool resolves a whole lockfile before it asks anything.
|
|
24
|
+
* This is a bound on a hang rather than a performance budget: a healthy run never approaches it, and a
|
|
25
|
+
* run that does has stopped making progress.
|
|
26
|
+
*/
|
|
27
|
+
export const NETWORKED_TOOL_TIMEOUT_MS = 300_000;
|
|
28
|
+
/**
|
|
29
|
+
* How many registry requests the harness holds open at once.
|
|
30
|
+
*
|
|
31
|
+
* A workspace declares hundreds of distinct coordinates, and asking for all of them at once opens a
|
|
32
|
+
* socket per dependency - which the registry answers by rate-limiting, and which a corporate proxy
|
|
33
|
+
* answers by dropping. Neither failure names its cause, so both arrive as "the registry was
|
|
34
|
+
* unreachable" for a network that was reachable all along.
|
|
35
|
+
*/
|
|
36
|
+
export const REGISTRY_CONCURRENCY = 8;
|
|
37
|
+
/**
|
|
38
|
+
* Map over items with at most `limit` in flight, preserving input order.
|
|
39
|
+
*
|
|
40
|
+
* Windowed rather than a sliding pool, because a pool needs a shared cursor and this repository bans
|
|
41
|
+
* the mutation that would take. A window costs the tail of each batch waiting on its slowest member,
|
|
42
|
+
* which for short registry reads is a smaller price than the rule it would break.
|
|
43
|
+
* @param items what to work through, in the order the results must come back in.
|
|
44
|
+
* @param limit the most that may be in flight at once; a limit below one is read as one, since a
|
|
45
|
+
* limit of zero would otherwise consume nothing and never finish.
|
|
46
|
+
* @param work what to do with one item.
|
|
47
|
+
* @returns every result, in the order of `items`.
|
|
48
|
+
*/
|
|
49
|
+
export const mapWithConcurrency = async (items, limit, work) => {
|
|
50
|
+
if (items.length === 0) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const width = Math.max(1, limit);
|
|
54
|
+
const inFlight = await Promise.all(items.slice(0, width).map(async (item) => await work(item)));
|
|
55
|
+
return [...inFlight, ...(await mapWithConcurrency(items.slice(width), limit, work))];
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=request-limits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request-limits.js","sourceRoot":"","sources":["../src/request-limits.ts"],"names":[],"mappings":"AAAA,oGAAoG;AACpG,EAAE;AACF,uGAAuG;AACvG,sGAAsG;AACtG,wGAAwG;AACxG,sGAAsG;AACtG,yEAAyE;AACzE,EAAE;AACF,qGAAqG;AACrG,sGAAsG;AACtG,yEAAyE;AAEzE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAW,MAAM,CAAA;AAEhD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAW,OAAO,CAAA;AAExD;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAW,CAAC,CAAA;AAE7C;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,KAAsB,EACtB,KAAa,EACb,IAAqC,EACT,EAAE;IAC9B,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,EAAE,CAAA;IACX,CAAC;IACD,MAAM,KAAK,GAAW,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC,CAAA;IACxC,MAAM,QAAQ,GAAsB,MAAM,OAAO,CAAC,GAAG,CACnD,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,IAAU,EAAmB,EAAE,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CACnF,CAAA;IACD,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,CAAC,MAAM,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAA;AACtF,CAAC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** Which of the three scopes a gate judges. */
|
|
2
|
+
export type GateScope = 'repository' | 'package' | 'payload';
|
|
3
|
+
/** One gate, reduced to what deciding the order needs. */
|
|
4
|
+
export interface GateDescriptor {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly scope: GateScope;
|
|
7
|
+
readonly isExtended: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** One governed member, reduced to what deciding the order needs. */
|
|
10
|
+
export interface MemberDescriptor {
|
|
11
|
+
readonly path: string;
|
|
12
|
+
readonly isPayload: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** One gate invocation: a gate, and the member it is asked about when it has one. */
|
|
15
|
+
export interface PlanStep {
|
|
16
|
+
readonly gateId: string;
|
|
17
|
+
/** The member's path, or undefined for a repository-scope gate. */
|
|
18
|
+
readonly member: string | undefined;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Expand the gate registry into the ordered invocations one run performs.
|
|
22
|
+
*
|
|
23
|
+
* For a repository with a single member this yields exactly the sequence ploaness ran before it knew
|
|
24
|
+
* about members, which is the property that makes workspace support invisible to a single-package
|
|
25
|
+
* project rather than merely compatible with it.
|
|
26
|
+
* @param gates every gate ploaness knows, in registry order.
|
|
27
|
+
* @param members the governed members, in discovery order.
|
|
28
|
+
* @param isExtended whether extended verification's gates are included.
|
|
29
|
+
* @returns one step per gate invocation, in run order.
|
|
30
|
+
*/
|
|
31
|
+
export declare const planSteps: (gates: readonly GateDescriptor[], members: readonly MemberDescriptor[], isExtended: boolean) => readonly PlanStep[];
|
|
32
|
+
//# sourceMappingURL=run-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-plan.d.ts","sourceRoot":"","sources":["../src/run-plan.ts"],"names":[],"mappings":"AAoBA,+CAA+C;AAC/C,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,SAAS,CAAA;AAE5D,0DAA0D;AAC1D,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;IACzB,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAC7B;AAED,qEAAqE;AACrE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;CAC5B;AAED,qFAAqF;AACrF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;CACpC;AAuBD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GACpB,OAAO,SAAS,cAAc,EAAE,EAChC,SAAS,SAAS,gBAAgB,EAAE,EACpC,YAAY,OAAO,KAClB,SAAS,QAAQ,EAGgE,CAAA"}
|
package/dist/run-plan.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
// The order a verification run visits its gates, and which member each gate is asked about.
|
|
2
|
+
//
|
|
3
|
+
// The order is a rule, not an implementation detail: it decides which finding a project sees first, and
|
|
4
|
+
// the reasoning behind it is stated in the guide - the structural gates that catch a mis-wired project
|
|
5
|
+
// run before the analyzers whose output is harder to read, the tracked-tree fingerprint brackets
|
|
6
|
+
// everything that could rewrite a file, and the two preconditions lead because a survey of findings
|
|
7
|
+
// below either would be a list of verdicts about nothing.
|
|
8
|
+
//
|
|
9
|
+
// Registry order IS run order, and this module deliberately adds no second ordering rule on top of it.
|
|
10
|
+
// Grouping the run by member instead - every gate for one member, then the next - reads better in a
|
|
11
|
+
// multi-member report, and it was the first design here. It was dropped because it also reorders a
|
|
12
|
+
// SINGLE-member run, which is every consumer that exists today: `conventions` would overtake `eslint`,
|
|
13
|
+
// the container gates would move to the end, and a project's first finding could change without one
|
|
14
|
+
// rule changing. Making workspaces work is not a licence to renumber the run for projects that have no
|
|
15
|
+
// workspace. A repository with one member therefore produces exactly the sequence that shipped before
|
|
16
|
+
// members existed, and that equality is pinned by a spec rather than argued.
|
|
17
|
+
//
|
|
18
|
+
// The cost is that a multi-member run interleaves members gate by gate. The report layer answers that by
|
|
19
|
+
// labelling each step with its member, which costs a single-member run nothing because it has none.
|
|
20
|
+
// A package-scope gate asks about every member; a payload-scope gate asks only about the members that
|
|
21
|
+
// are Payload applications. Derived from what the member declares rather than from anything it opts
|
|
22
|
+
// into, so a project cannot silence the Payload rules by describing itself differently.
|
|
23
|
+
const membersFor = (gate, members) => gate.scope === 'payload'
|
|
24
|
+
? members.filter((member) => member.isPayload)
|
|
25
|
+
: members;
|
|
26
|
+
const stepsFor = (gate, members) => gate.scope === 'repository'
|
|
27
|
+
? [{ gateId: gate.id, member: undefined }]
|
|
28
|
+
: membersFor(gate, members).map((member) => ({ gateId: gate.id, member: member.path }));
|
|
29
|
+
/**
|
|
30
|
+
* Expand the gate registry into the ordered invocations one run performs.
|
|
31
|
+
*
|
|
32
|
+
* For a repository with a single member this yields exactly the sequence ploaness ran before it knew
|
|
33
|
+
* about members, which is the property that makes workspace support invisible to a single-package
|
|
34
|
+
* project rather than merely compatible with it.
|
|
35
|
+
* @param gates every gate ploaness knows, in registry order.
|
|
36
|
+
* @param members the governed members, in discovery order.
|
|
37
|
+
* @param isExtended whether extended verification's gates are included.
|
|
38
|
+
* @returns one step per gate invocation, in run order.
|
|
39
|
+
*/
|
|
40
|
+
export const planSteps = (gates, members, isExtended) => gates
|
|
41
|
+
.filter((gate) => isExtended || !gate.isExtended)
|
|
42
|
+
.flatMap((gate) => stepsFor(gate, members));
|
|
43
|
+
//# sourceMappingURL=run-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-plan.js","sourceRoot":"","sources":["../src/run-plan.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,EAAE;AACF,wGAAwG;AACxG,uGAAuG;AACvG,iGAAiG;AACjG,oGAAoG;AACpG,0DAA0D;AAC1D,EAAE;AACF,uGAAuG;AACvG,oGAAoG;AACpG,mGAAmG;AACnG,uGAAuG;AACvG,oGAAoG;AACpG,uGAAuG;AACvG,sGAAsG;AACtG,6EAA6E;AAC7E,EAAE;AACF,yGAAyG;AACzG,oGAAoG;AAyBpG,sGAAsG;AACtG,oGAAoG;AACpG,wFAAwF;AACxF,MAAM,UAAU,GAAG,CACjB,IAAoB,EACpB,OAAoC,EACP,EAAE,CAC/B,IAAI,CAAC,KAAK,KAAK,SAAS;IACtB,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAwB,EAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC;IACzE,CAAC,CAAC,OAAO,CAAA;AAEb,MAAM,QAAQ,GAAG,CACf,IAAoB,EACpB,OAAoC,EACf,EAAE,CACvB,IAAI,CAAC,KAAK,KAAK,YAAY;IACzB,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAC1C,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,GAAG,CAC3B,CAAC,MAAwB,EAAY,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC,CACnF,CAAA;AAEP;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAgC,EAChC,OAAoC,EACpC,UAAmB,EACE,EAAE,CACvB,KAAK;KACF,MAAM,CAAC,CAAC,IAAoB,EAAW,EAAE,CAAC,UAAU,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC;KACzE,OAAO,CAAC,CAAC,IAAoB,EAAuB,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** What decides whether a run carries on after a gate. */
|
|
2
|
+
export interface RunPoint {
|
|
3
|
+
/** Whether the gate that just ran failed. */
|
|
4
|
+
readonly isFailure: boolean;
|
|
5
|
+
/** Whether a failure here makes every later gate meaningless rather than merely unreported. */
|
|
6
|
+
readonly isPrecondition: boolean;
|
|
7
|
+
/** False in report-only mode, where findings print but the run still exits 0. */
|
|
8
|
+
readonly isEnforced: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Whether this gate ends the run rather than the next one following it.
|
|
12
|
+
* @param point the gate's outcome and the mode the run is in.
|
|
13
|
+
* @returns true when no later gate should run.
|
|
14
|
+
*/
|
|
15
|
+
export declare const endsRun: (point: RunPoint) => boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether a member holds source code its suite could be about.
|
|
18
|
+
*
|
|
19
|
+
* A workspace root is a member - it has to be, to own the scripts a run is invoked through - and it may
|
|
20
|
+
* hold nothing but a manifest. Running a test runner there fails on an empty include, which would report
|
|
21
|
+
* a package with nothing to test as a package that failed to test it.
|
|
22
|
+
*
|
|
23
|
+
* The condition is derived rather than declared, and deliberately narrow: a member holding code and no
|
|
24
|
+
* suite still fails. `--passWithNoTests` would have been the easy answer and the wrong one - it lets an
|
|
25
|
+
* application delete its specs and stay green.
|
|
26
|
+
* @param trackedPaths every tracked path inside the member, member-relative.
|
|
27
|
+
* @param sourceRoots the directories the member declared as holding first-party source.
|
|
28
|
+
* @param isCode whether a path is a code file.
|
|
29
|
+
* @returns true when at least one code file sits under a declared source root.
|
|
30
|
+
*/
|
|
31
|
+
export declare const carriesSourceCode: (trackedPaths: readonly string[], sourceRoots: readonly string[], isCode: (filePath: string) => boolean) => boolean;
|
|
32
|
+
//# sourceMappingURL=run-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-policy.d.ts","sourceRoot":"","sources":["../src/run-policy.ts"],"names":[],"mappings":"AAcA,0DAA0D;AAC1D,MAAM,WAAW,QAAQ;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,+FAA+F;IAC/F,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAA;IAChC,iFAAiF;IACjF,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAA;CAC7B;AAED;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAI,OAAO,QAAQ,KAAG,OACqB,CAAA;AAE/D;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,iBAAiB,GAC5B,cAAc,SAAS,MAAM,EAAE,EAC/B,aAAa,SAAS,MAAM,EAAE,EAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,KACpC,OAKA,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// When a verification run stops.
|
|
2
|
+
//
|
|
3
|
+
// The two modes want opposite things from a failure. An enforcing run stops at the first one: nothing
|
|
4
|
+
// below a failing gate has been verified, and a gate is free to leave the tree in a shape the next one
|
|
5
|
+
// misreads, so a column of passes beneath a failure describes a state nobody established.
|
|
6
|
+
//
|
|
7
|
+
// A report-only run wants the opposite, because it exists to survey a repository that has not adopted
|
|
8
|
+
// the harness yet. Stopping there would report one finding out of the many such a project has, and the
|
|
9
|
+
// project would learn its size one run at a time.
|
|
10
|
+
//
|
|
11
|
+
// One failure stops both. A gate whose failure makes every later gate meaningless is not reporting a
|
|
12
|
+
// finding among others - it is saying that ploaness cannot judge this project, or cannot tell whether
|
|
13
|
+
// what it is judging is what it thinks. Carrying on produces a list of verdicts about nothing.
|
|
14
|
+
/**
|
|
15
|
+
* Whether this gate ends the run rather than the next one following it.
|
|
16
|
+
* @param point the gate's outcome and the mode the run is in.
|
|
17
|
+
* @returns true when no later gate should run.
|
|
18
|
+
*/
|
|
19
|
+
export const endsRun = (point) => point.isFailure && (point.isEnforced || point.isPrecondition);
|
|
20
|
+
/**
|
|
21
|
+
* Whether a member holds source code its suite could be about.
|
|
22
|
+
*
|
|
23
|
+
* A workspace root is a member - it has to be, to own the scripts a run is invoked through - and it may
|
|
24
|
+
* hold nothing but a manifest. Running a test runner there fails on an empty include, which would report
|
|
25
|
+
* a package with nothing to test as a package that failed to test it.
|
|
26
|
+
*
|
|
27
|
+
* The condition is derived rather than declared, and deliberately narrow: a member holding code and no
|
|
28
|
+
* suite still fails. `--passWithNoTests` would have been the easy answer and the wrong one - it lets an
|
|
29
|
+
* application delete its specs and stay green.
|
|
30
|
+
* @param trackedPaths every tracked path inside the member, member-relative.
|
|
31
|
+
* @param sourceRoots the directories the member declared as holding first-party source.
|
|
32
|
+
* @param isCode whether a path is a code file.
|
|
33
|
+
* @returns true when at least one code file sits under a declared source root.
|
|
34
|
+
*/
|
|
35
|
+
export const carriesSourceCode = (trackedPaths, sourceRoots, isCode) => trackedPaths.some((filePath) => isCode(filePath) &&
|
|
36
|
+
sourceRoots.some((root) => filePath.startsWith(`${root}/`)));
|
|
37
|
+
//# sourceMappingURL=run-policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-policy.js","sourceRoot":"","sources":["../src/run-policy.ts"],"names":[],"mappings":"AAAA,iCAAiC;AACjC,EAAE;AACF,sGAAsG;AACtG,uGAAuG;AACvG,0FAA0F;AAC1F,EAAE;AACF,sGAAsG;AACtG,uGAAuG;AACvG,kDAAkD;AAClD,EAAE;AACF,qGAAqG;AACrG,sGAAsG;AACtG,+FAA+F;AAY/F;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,KAAe,EAAW,EAAE,CAClD,KAAK,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,cAAc,CAAC,CAAA;AAE/D;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,YAA+B,EAC/B,WAA8B,EAC9B,MAAqC,EAC5B,EAAE,CACX,YAAY,CAAC,IAAI,CACf,CAAC,QAAgB,EAAW,EAAE,CAC5B,MAAM,CAAC,QAAQ,CAAC;IAChB,WAAW,CAAC,IAAI,CAAC,CAAC,IAAY,EAAW,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,CAC/E,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** One committed fake credential, and the reason it is committed. */
|
|
2
|
+
export interface SecretException {
|
|
3
|
+
/** A repo-relative path whose findings are excused. */
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly reason: string;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Render a scanner configuration from the declared exceptions.
|
|
9
|
+
* @param exceptions the recorded exceptions.
|
|
10
|
+
* @returns TOML that extends the scanner's default rules and adds one allowlist per exception.
|
|
11
|
+
*/
|
|
12
|
+
export declare const renderGitleaksConfig: (exceptions: readonly SecretException[]) => string;
|
|
13
|
+
//# sourceMappingURL=secret-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-policy.d.ts","sourceRoot":"","sources":["../src/secret-policy.ts"],"names":[],"mappings":"AAaA,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B,uDAAuD;IACvD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AA2CD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,YAAY,SAAS,eAAe,EAAE,KAAG,MAiB7E,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// The secret allowlist.
|
|
2
|
+
//
|
|
3
|
+
// The standard requires a repository to list every fake credential it commits as a test fixture, and
|
|
4
|
+
// requires the secret scan to fail on anything outside that list. Until now there was no way to satisfy
|
|
5
|
+
// both: `.gitleaks.toml` is a forbidden managed path, precisely so a project cannot weaken the scanner's
|
|
6
|
+
// own rules, and no setting replaced it. A project with a fixture credential could not pass at all.
|
|
7
|
+
//
|
|
8
|
+
// The resolution keeps the file forbidden and makes the allowlist data instead. ploaness renders the
|
|
9
|
+
// scanner's configuration itself, outside the working tree, from entries the project declares. The
|
|
10
|
+
// rendered config always extends the tool's default rules, so a declared entry can only add a named
|
|
11
|
+
// exception and can never replace or disable what the scanner already looks for.
|
|
12
|
+
import { escapeForRegex } from './text-escapes.js';
|
|
13
|
+
// The characters a TOML basic string cannot carry literally: its two delimiters, and every control
|
|
14
|
+
// character. Named by code point rather than written out, for the reason `banned-typography.ts` gives:
|
|
15
|
+
// a source file that spells an invisible character invites a tool to normalise it away.
|
|
16
|
+
const FIRST_PRINTABLE = 0x20;
|
|
17
|
+
const HEX_RADIX = 16;
|
|
18
|
+
const UNICODE_ESCAPE_DIGITS = 4;
|
|
19
|
+
const asHex = (codePoint) => codePoint.toString(HEX_RADIX).padStart(UNICODE_ESCAPE_DIGITS, '0');
|
|
20
|
+
const NAMED_ESCAPES = new Map([
|
|
21
|
+
['\\', '\\\\'],
|
|
22
|
+
['"', String.raw `\"`],
|
|
23
|
+
['\n', String.raw `\n`],
|
|
24
|
+
['\r', String.raw `\r`],
|
|
25
|
+
['\t', String.raw `\t`],
|
|
26
|
+
]);
|
|
27
|
+
// `Number(...)` rather than a fallback: `codePointAt` is typed as possibly undefined, an empty string
|
|
28
|
+
// yields NaN, and `NaN < FIRST_PRINTABLE` is false - so the character passes through as itself without
|
|
29
|
+
// a branch no input can reach.
|
|
30
|
+
const escapeCharacter = (character) => {
|
|
31
|
+
const named = NAMED_ESCAPES.get(character);
|
|
32
|
+
if (named !== undefined) {
|
|
33
|
+
return named;
|
|
34
|
+
}
|
|
35
|
+
const codePoint = Number(character.codePointAt(0));
|
|
36
|
+
return codePoint < FIRST_PRINTABLE ? String.raw `\u${asHex(codePoint)}` : character;
|
|
37
|
+
};
|
|
38
|
+
// A basic TOML string, which is the only string form that escapes anything. Both fields go through it.
|
|
39
|
+
//
|
|
40
|
+
// The path used to be rendered into a multi-line LITERAL string, which escapes nothing at all, so a
|
|
41
|
+
// path containing the `'''` delimiter would have closed the string early and left the remainder as
|
|
42
|
+
// syntax. The regex escaping the path already carries is no help there: it protects the scanner's
|
|
43
|
+
// pattern, not TOML's quoting. A doubled backslash reaches the scanner as the single one it wants.
|
|
44
|
+
const escapeForToml = (value) =>
|
|
45
|
+
// An escape is decided per code point, and a decomposed emoji is re-joined unchanged either way.
|
|
46
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-spread -- see the note above
|
|
47
|
+
[...value].map((character) => escapeCharacter(character)).join('');
|
|
48
|
+
/**
|
|
49
|
+
* Render a scanner configuration from the declared exceptions.
|
|
50
|
+
* @param exceptions the recorded exceptions.
|
|
51
|
+
* @returns TOML that extends the scanner's default rules and adds one allowlist per exception.
|
|
52
|
+
*/
|
|
53
|
+
export const renderGitleaksConfig = (exceptions) => {
|
|
54
|
+
const header = [
|
|
55
|
+
'# Generated by ploaness. Do not commit this file: a copy in the working tree could only shadow or',
|
|
56
|
+
'# weaken the rules ploaness supplies, which is why the path is forbidden.',
|
|
57
|
+
'[extend]',
|
|
58
|
+
'useDefault = true',
|
|
59
|
+
'',
|
|
60
|
+
].join('\n');
|
|
61
|
+
const blocks = exceptions.map((exception) => [
|
|
62
|
+
'[[allowlists]]',
|
|
63
|
+
`description = "${escapeForToml(exception.reason)}"`,
|
|
64
|
+
`paths = ["^${escapeForToml(escapeForRegex(exception.path))}$"]`,
|
|
65
|
+
'',
|
|
66
|
+
].join('\n'));
|
|
67
|
+
return [header, ...blocks].join('\n');
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=secret-policy.js.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,WAAW,CAAC,CAAC,CAAC,CAAC,CAAA;IAC1D,OAAO,SAAS,GAAG,eAAe,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAA,KAAK,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;AACpF,CAAC,CAAA;AAED,uGAAuG;AACvG,EAAE;AACF,oGAAoG;AACpG,mGAAmG;AACnG,kGAAkG;AAClG,mGAAmG;AACnG,MAAM,aAAa,GAAG,CAAC,KAAa,EAAU,EAAE;AAC9C,iGAAiG;AACjG,sFAAsF;AACtF,CAAC,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,SAAiB,EAAU,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;AAEpF;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,UAAsC,EAAU,EAAE;IACrF,MAAM,MAAM,GAAW;QACrB,mGAAmG;QACnG,2EAA2E;QAC3E,UAAU;QACV,mBAAmB;QACnB,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACZ,MAAM,MAAM,GAAsB,UAAU,CAAC,GAAG,CAAC,CAAC,SAA0B,EAAU,EAAE,CACtF;QACE,gBAAgB;QAChB,kBAAkB,aAAa,CAAC,SAAS,CAAC,MAAM,CAAC,GAAG;QACpD,cAAc,aAAa,CAAC,cAAc,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,KAAK;QAChE,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAA;IACD,OAAO,CAAC,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACvC,CAAC,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type DeclaredExclusion, type Settings } from './settings.js';
|
|
2
|
+
/**
|
|
3
|
+
* Fold a member's raw settings block onto the repository's.
|
|
4
|
+
* @param base the repository's raw block.
|
|
5
|
+
* @param overlay the member's raw block.
|
|
6
|
+
* @returns one raw block, still undefaulted.
|
|
7
|
+
*/
|
|
8
|
+
export declare const layerSettingBlocks: (base: Record<string, unknown>, overlay: Record<string, unknown>) => Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Move a member's exclusion into the repository's path space.
|
|
11
|
+
*
|
|
12
|
+
* The gates that walk the tracked tree run once, at the repository root, while a member declares its
|
|
13
|
+
* exclusions relative to itself. `^src/generated/` written inside `apps/web` therefore matches nothing
|
|
14
|
+
* when the repository-scope gate walks past `apps/web/src/generated/`, and a generated directory a
|
|
15
|
+
* project correctly excused starts failing the typography ban.
|
|
16
|
+
*
|
|
17
|
+
* An UNANCHORED pattern is left alone, deliberately. `importMap\.js$` already matches at any depth, and
|
|
18
|
+
* prefixing it would narrow it to one member - so the rule errs toward a pattern that matches too much
|
|
19
|
+
* at repository scope rather than one that silently stops matching. Too wide is the safe direction here:
|
|
20
|
+
* a repository-scope gate that skips one extra path reports one fewer finding, while a narrowed pattern
|
|
21
|
+
* reports a project for a file it had already accounted for.
|
|
22
|
+
* @param memberPath the member's repo-relative path, `.` for the member at the root.
|
|
23
|
+
* @param entry the exclusion as the member declared it.
|
|
24
|
+
* @returns the exclusion as the repository-scope gates must read it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const rebaseExclusion: (memberPath: string, entry: DeclaredExclusion) => DeclaredExclusion;
|
|
27
|
+
/**
|
|
28
|
+
* The settings one member runs under.
|
|
29
|
+
*
|
|
30
|
+
* Effective VALUES are layered - a member inherits the repository's source roots, its typography
|
|
31
|
+
* exclusions, its floor. `declaredExclusions` is not, and that asymmetry is the point: it is the list of
|
|
32
|
+
* decisions THIS package made, and every consumer of it judges the declarer. Layering it made a member
|
|
33
|
+
* answer for the repository's declarations, so a workspace root that correctly excused its Vale detector
|
|
34
|
+
* definitions - whose content IS the character the ban detects - had every member report that exclusion
|
|
35
|
+
* as reaching nothing, because no member contains the file. One correct declaration, two gates failed,
|
|
36
|
+
* and nothing a member could edit would have fixed it.
|
|
37
|
+
*
|
|
38
|
+
* The mirror direction was already handled: `rebaseExclusion` moves a member's exclusion up into the
|
|
39
|
+
* repository's path space. This is the same seam read downward.
|
|
40
|
+
* @param repositoryBlock the raw `ploaness` block of the repository root.
|
|
41
|
+
* @param ownBlock the raw `ploaness` block of the member itself.
|
|
42
|
+
* @returns the member's settings, inheriting values and owning declarations.
|
|
43
|
+
*/
|
|
44
|
+
export declare const readMemberSettings: (repositoryBlock: Record<string, unknown>, ownBlock: Record<string, unknown>) => Settings;
|
|
45
|
+
//# sourceMappingURL=settings-layering.d.ts.map
|