@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,458 @@
|
|
|
1
|
+
import { GENERATED_ARTEFACTS } from './generated-denial.js';
|
|
2
|
+
import { findSilencedAdvisories } from './install-policy.js';
|
|
3
|
+
import { asRecord, asStringRecord, declaredDependencies, isArray, parseJsonc, } from './json-shapes.js';
|
|
4
|
+
import { findConvenienceExclusions } from './settings.js';
|
|
5
|
+
import { escapeForRegex } from './text-escapes.js';
|
|
6
|
+
import { describeFound, findPackageVersionViolations, findRepositoryVersionViolations, } from './version-policy.js';
|
|
7
|
+
/** The exact script bodies ploaness owns. The consumer declares the name; ploaness dictates the command. */
|
|
8
|
+
export const REQUIRED_SCRIPTS = {
|
|
9
|
+
verify: 'ploaness verify',
|
|
10
|
+
'verify:full': 'ploaness verify --extended',
|
|
11
|
+
format: 'ploaness format',
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* The specifier a consumer biome.json must extend. Declared once here rather than written as a literal
|
|
15
|
+
* in both the rule and the scaffolder that writes the file the rule judges, so the two cannot drift.
|
|
16
|
+
*/
|
|
17
|
+
export const REQUIRED_BIOME_EXTENDS = 'ploaness/biome';
|
|
18
|
+
/**
|
|
19
|
+
* The specifier a consumer tsconfig.json must extend: the literal file path, not the bare
|
|
20
|
+
* `ploaness/tsconfig` package specifier. TypeScript honours both, but a Payload project is also parsed
|
|
21
|
+
* by Next.js, which does not read a package exports map and fails on the bare form. Requiring the path
|
|
22
|
+
* that works everywhere is the difference between `tsc` passing and `next build` dying on a config it
|
|
23
|
+
* cannot resolve.
|
|
24
|
+
*/
|
|
25
|
+
export const REQUIRED_TSCONFIG_EXTENDS = 'ploaness/tsconfig.json';
|
|
26
|
+
/**
|
|
27
|
+
* The setup file a project writes for itself.
|
|
28
|
+
*
|
|
29
|
+
* Named here because four things have to agree about it and none of them can see the others: the Biome
|
|
30
|
+
* block below includes it, the shipped Vitest config loads it, the fast-check message tells a project to
|
|
31
|
+
* put a seed in it, and the ESLint config exempts it from a rule aimed at code rather than at process
|
|
32
|
+
* configuration. A name written four times is a name that eventually differs in one of them.
|
|
33
|
+
*/
|
|
34
|
+
export const PROJECT_SETUP_FILE = 'vitest.setup.ts';
|
|
35
|
+
/**
|
|
36
|
+
* The `files` block a consumer's biome.json must carry verbatim.
|
|
37
|
+
*
|
|
38
|
+
* File selection cannot live in the shared config the way rule configuration does. Biome resolves a
|
|
39
|
+
* relative glob against the directory of the config that declares it, and the shared config sits inside
|
|
40
|
+
* node_modules, where `src/**` matches nothing; Biome then falls back to checking the entire tree. So
|
|
41
|
+
* ploaness dictates the block and the wiring gate enforces it byte for byte, which keeps ownership with
|
|
42
|
+
* the harness even though the text has to sit at the project root.
|
|
43
|
+
* @param sourceRoots the directories the project declared as holding first-party source.
|
|
44
|
+
* @returns the exact block a conforming biome.json declares.
|
|
45
|
+
*/
|
|
46
|
+
export const requiredBiomeFiles = (sourceRoots, kind = 'payload', generatedArtefacts = GENERATED_ARTEFACTS) => ({
|
|
47
|
+
ignoreUnknown: false,
|
|
48
|
+
includes: [
|
|
49
|
+
...sourceRoots.map((root) => `${root}/**/*`),
|
|
50
|
+
'package.json',
|
|
51
|
+
'biome.json',
|
|
52
|
+
'tsconfig.json',
|
|
53
|
+
'*.config.ts',
|
|
54
|
+
'*.config.mts',
|
|
55
|
+
PROJECT_SETUP_FILE,
|
|
56
|
+
// Derived from the artefact list rather than written out. The two lists had to name the same paths
|
|
57
|
+
// and did not: `src/payload-generated-schema.ts` was denied to an agent and still handed to the
|
|
58
|
+
// formatter, so a generator and a formatter took turns rewriting one file.
|
|
59
|
+
// Only a Payload member has these. Negating them elsewhere would name paths that cannot exist,
|
|
60
|
+
// which `config-refs` reports as a carve-out reaching nothing.
|
|
61
|
+
...(kind === 'payload'
|
|
62
|
+
? generatedArtefacts.map((artefact) => `!${artefact}`)
|
|
63
|
+
: []),
|
|
64
|
+
'!**/.next',
|
|
65
|
+
'!**/node_modules',
|
|
66
|
+
],
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* The `include` and `exclude` a consumer's tsconfig.json must carry verbatim.
|
|
70
|
+
*
|
|
71
|
+
* The same constraint as {@link requiredBiomeFiles}, for the same reason: TypeScript resolves these globs
|
|
72
|
+
* against the directory of the config that declares them. Left in the shared config they would walk the
|
|
73
|
+
* ploaness package itself rather than the project, so they must sit at the project root while ploaness
|
|
74
|
+
* keeps ownership of their contents.
|
|
75
|
+
*/
|
|
76
|
+
export const REQUIRED_TSCONFIG_PATHS = {
|
|
77
|
+
include: [
|
|
78
|
+
'next-env.d.ts',
|
|
79
|
+
'**/*.ts',
|
|
80
|
+
'**/*.tsx',
|
|
81
|
+
'**/*.mts',
|
|
82
|
+
'.next/types/**/*.ts',
|
|
83
|
+
'.next/dev/types/**/*.ts',
|
|
84
|
+
],
|
|
85
|
+
exclude: ['node_modules'],
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* The `include` and `exclude` a member with no Next application must carry.
|
|
89
|
+
*
|
|
90
|
+
* The Payload globs name `next-env.d.ts` and two `.next` type directories. In a package that never runs
|
|
91
|
+
* Next those are carve-outs reaching nothing, which is itself a finding - so the kind that cannot have
|
|
92
|
+
* them does not claim them.
|
|
93
|
+
*/
|
|
94
|
+
export const LIBRARY_TSCONFIG_PATHS = {
|
|
95
|
+
include: ['**/*.ts', '**/*.tsx', '**/*.mts'],
|
|
96
|
+
exclude: ['node_modules', 'dist'],
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* The `include` and `exclude` one member must carry, given the members nested inside it.
|
|
100
|
+
*
|
|
101
|
+
* The required `include` is a recursive TypeScript glob, which at a WORKSPACE ROOT sweeps every
|
|
102
|
+
* member's sources into the root's own project - under the ROOT's `paths`, where a member's `@/*`
|
|
103
|
+
* resolves to the wrong directory. eoc's root read the CMS scripts that way and failed `types` on
|
|
104
|
+
* imports that resolve perfectly well inside the CMS. Excluding them is not a relaxation: a member's
|
|
105
|
+
* analysis stops at its own boundary, which is the rule `knipConfig` already applies for the same
|
|
106
|
+
* reason, and each nested member is compiled by its own run.
|
|
107
|
+
*
|
|
108
|
+
* Derived rather than declared, so a member cannot exclude a sibling it does not contain and cannot
|
|
109
|
+
* forget one it does - and `ploaness init` writes exactly what the rule then asks for.
|
|
110
|
+
* @param base the paths for this member's kind.
|
|
111
|
+
* @param nestedMembers the repo-relative paths of the governed members inside this one.
|
|
112
|
+
* @returns the same paths, with every nested member excluded.
|
|
113
|
+
*/
|
|
114
|
+
export const tsconfigPathsFor = (base, nestedMembers) => nestedMembers.length === 0
|
|
115
|
+
? base
|
|
116
|
+
: { ...base, exclude: [...(base['exclude'] ?? []), ...nestedMembers] };
|
|
117
|
+
const LIBRARY_TARGETS = {
|
|
118
|
+
biomeExtends: 'ploaness/biome-core',
|
|
119
|
+
tsconfigExtends: 'ploaness/tsconfig-core.json',
|
|
120
|
+
tsconfigPaths: LIBRARY_TSCONFIG_PATHS,
|
|
121
|
+
eslintSpecifier: 'ploaness/eslint-library',
|
|
122
|
+
vitestSpecifier: 'ploaness/vitest-library',
|
|
123
|
+
playwrightSpecifier: undefined,
|
|
124
|
+
};
|
|
125
|
+
const APPLICATION_TARGETS = {
|
|
126
|
+
biomeExtends: REQUIRED_BIOME_EXTENDS,
|
|
127
|
+
tsconfigExtends: REQUIRED_TSCONFIG_EXTENDS,
|
|
128
|
+
tsconfigPaths: REQUIRED_TSCONFIG_PATHS,
|
|
129
|
+
eslintSpecifier: 'ploaness/eslint',
|
|
130
|
+
vitestSpecifier: 'ploaness/vitest',
|
|
131
|
+
playwrightSpecifier: 'ploaness/playwright',
|
|
132
|
+
};
|
|
133
|
+
/**
|
|
134
|
+
* The wiring one kind of member must declare.
|
|
135
|
+
*
|
|
136
|
+
* A Next application receives the same configurations as a Payload one: it renders React, it builds
|
|
137
|
+
* through Next, and it serves pages a browser sweep can drive. What separates the two is the generated
|
|
138
|
+
* files only Payload has, which {@link requiredBiomeFiles} handles by kind rather than by a second
|
|
139
|
+
* configuration.
|
|
140
|
+
* @param kind the member's derived kind.
|
|
141
|
+
* @returns the specifiers and globs that kind is held to.
|
|
142
|
+
*/
|
|
143
|
+
export const wiringTargetsFor = (kind) => kind === 'library' ? LIBRARY_TARGETS : APPLICATION_TARGETS;
|
|
144
|
+
// tsconfig keys a project may legitimately set for itself. Everything else is a compiler strictness
|
|
145
|
+
// decision ploaness owns, so a local override is how a project would quietly weaken type checking.
|
|
146
|
+
const ALLOWED_TSCONFIG_COMPILER_OPTIONS = new Set([
|
|
147
|
+
'paths',
|
|
148
|
+
'baseUrl',
|
|
149
|
+
'plugins',
|
|
150
|
+
'types',
|
|
151
|
+
'rootDir',
|
|
152
|
+
'outDir',
|
|
153
|
+
]);
|
|
154
|
+
// Biome sections ploaness owns outright. A consumer redeclaring one of them replaces the harness rules
|
|
155
|
+
// for that section wholesale, which is a silent downgrade rather than an addition.
|
|
156
|
+
// `plugins` is here rather than as a forbidden PATH. Forbidding a top-level directory called `plugins`
|
|
157
|
+
// caught the thing it meant to - a project's own GritQL rules shadowing the shipped ones - and also any
|
|
158
|
+
// unrelated directory that happened to share the name. What actually shadows is the key that loads
|
|
159
|
+
// them, and a project declaring it is replacing ploaness's rules for that section like any other.
|
|
160
|
+
const OWNED_BIOME_SECTIONS = [
|
|
161
|
+
'linter',
|
|
162
|
+
'formatter',
|
|
163
|
+
'javascript',
|
|
164
|
+
'assist',
|
|
165
|
+
'plugins',
|
|
166
|
+
];
|
|
167
|
+
const checkDependency = (packageJson) => Object.hasOwn(declaredDependencies(packageJson), 'ploaness')
|
|
168
|
+
? []
|
|
169
|
+
: [
|
|
170
|
+
{
|
|
171
|
+
location: 'package.json',
|
|
172
|
+
reason: 'ploaness must be a declared dependency of the project',
|
|
173
|
+
},
|
|
174
|
+
];
|
|
175
|
+
const checkExactEntries = (actual, required, locationPrefix) => Object.entries(required).flatMap(([name, body]) => {
|
|
176
|
+
const found = actual[name];
|
|
177
|
+
if (found === body) {
|
|
178
|
+
return [];
|
|
179
|
+
}
|
|
180
|
+
return [
|
|
181
|
+
{
|
|
182
|
+
location: `${locationPrefix}.${name}`,
|
|
183
|
+
reason: `is ${describeFound(found)} but ploaness requires "${body}"`,
|
|
184
|
+
},
|
|
185
|
+
];
|
|
186
|
+
});
|
|
187
|
+
// A flat ESLint config is an array, so a consumer can append a block that switches rules back off after
|
|
188
|
+
// the harness config has been spread in. Requiring the file to be a bare re-export makes any addition
|
|
189
|
+
// surface as a wiring violation instead of a silent downgrade.
|
|
190
|
+
//
|
|
191
|
+
// Comments and blank lines are dropped first, so the pattern below describes only the two statements
|
|
192
|
+
// the file may contain. Expressing the preamble inside the pattern made it backtrack on a long file.
|
|
193
|
+
// A block comment counts as a comment: the filter read `//` alone, so a file opening with the `/* */`
|
|
194
|
+
// header a generator writes failed as though it carried a local override.
|
|
195
|
+
const BLOCK_COMMENT = /\/\*[\s\S]*?\*\//g;
|
|
196
|
+
const COMMENT_OR_BLANK = /^\s*(?:\/\/.*)?$/;
|
|
197
|
+
// A config file the harness owns may contain nothing but an import of the shipped value and its
|
|
198
|
+
// default re-export. Anything more is a local block that overrides what ploaness supplies.
|
|
199
|
+
const reexportPattern = (specifier) => new RegExp(String.raw `^import\s+(\w+)\s+from\s+['"]${escapeForRegex(specifier)}['"];?\s*export\s+default\s+\1;?$`);
|
|
200
|
+
// Line endings are normalised before anything reads a line. `.` does not cross a `\r`, so on a CRLF
|
|
201
|
+
// checkout every comment line survived the filter and every re-export check failed on a file that was
|
|
202
|
+
// correct - a whole platform's worth of false findings from one character nobody prints.
|
|
203
|
+
const withoutPreamble = (config) => config
|
|
204
|
+
.replaceAll('\r\n', '\n')
|
|
205
|
+
.replaceAll(BLOCK_COMMENT, '')
|
|
206
|
+
.split('\n')
|
|
207
|
+
.filter((line) => !COMMENT_OR_BLANK.test(line))
|
|
208
|
+
.join('\n')
|
|
209
|
+
.trim();
|
|
210
|
+
// `vitest.config.mts` was seeded by `init` and then checked by nothing, while the tests gate runs the
|
|
211
|
+
// project's vitest with the project's config - so rewriting that file dropped the coverage thresholds,
|
|
212
|
+
// the include globs, and the environment without a single finding.
|
|
213
|
+
/**
|
|
214
|
+
* The files that must contain nothing but an import of a ploaness config and its default re-export.
|
|
215
|
+
*
|
|
216
|
+
* Exported because the ESLint configuration has to name them too: `unicorn/prefer-export-from` rewrites
|
|
217
|
+
* exactly this shape into `export { default } from '...'`, and it AUTOFIXES - so `ploaness format`
|
|
218
|
+
* turned a correctly wired project into one `wiring` then rejected, every time it ran. Two rules the
|
|
219
|
+
* harness owns, contradicting each other, with the formatter casting the deciding vote.
|
|
220
|
+
*
|
|
221
|
+
* The list is declared here, beside the rule that requires the shape, so the config that has to exempt
|
|
222
|
+
* them cannot fall out of step with it.
|
|
223
|
+
*/
|
|
224
|
+
export const REEXPORT_CONFIG_FILES = [
|
|
225
|
+
'eslint.config.mjs',
|
|
226
|
+
'vitest.config.mts',
|
|
227
|
+
'playwright.config.ts',
|
|
228
|
+
];
|
|
229
|
+
const checkReexport = (config, file, specifier) => {
|
|
230
|
+
if (config === undefined) {
|
|
231
|
+
return [{ location: file, reason: `missing; must re-export ${specifier}` }];
|
|
232
|
+
}
|
|
233
|
+
return reexportPattern(specifier).test(withoutPreamble(config))
|
|
234
|
+
? []
|
|
235
|
+
: [
|
|
236
|
+
{
|
|
237
|
+
location: file,
|
|
238
|
+
reason: `must contain nothing but an import of ${specifier} and its default re-export; ` +
|
|
239
|
+
'a local block would override the harness rules',
|
|
240
|
+
},
|
|
241
|
+
];
|
|
242
|
+
};
|
|
243
|
+
// What a consumer has to change, named entry by entry.
|
|
244
|
+
//
|
|
245
|
+
// The finding used to say the block "must match" and stop there. Both blocks are right here, so the
|
|
246
|
+
// reader was being asked to diff two fifteen-entry lists by eye to find the one carve-out a newer
|
|
247
|
+
// ploaness added - and the advice it offered instead, `ploaness init`, cannot repair a file that
|
|
248
|
+
// already exists, which is the only state this finding is reachable in.
|
|
249
|
+
const listOf = (value) => isArray(value) ? value.map((entry) => JSON.stringify(entry)) : [];
|
|
250
|
+
const describeBiomeDrift = (declared, required) => {
|
|
251
|
+
const declaredIncludes = listOf(asRecord(declared)['includes']);
|
|
252
|
+
const requiredIncludes = listOf(required['includes']);
|
|
253
|
+
const missing = requiredIncludes.filter((entry) => !declaredIncludes.includes(entry));
|
|
254
|
+
const unexpected = declaredIncludes.filter((entry) => !requiredIncludes.includes(entry));
|
|
255
|
+
const parts = [
|
|
256
|
+
...(missing.length > 0 ? [`add ${missing.join(', ')}`] : []),
|
|
257
|
+
...(unexpected.length > 0 ? [`remove ${unexpected.join(', ')}`] : []),
|
|
258
|
+
];
|
|
259
|
+
// Same entries, different block: the order, or `ignoreUnknown`. Naming no entry would leave the
|
|
260
|
+
// reader exactly where the old wording did, so say which of the two it is.
|
|
261
|
+
return parts.length === 0
|
|
262
|
+
? 'declares the ploaness includes entries in another order, or another "ignoreUnknown"; the ' +
|
|
263
|
+
'block is required verbatim'
|
|
264
|
+
: `${parts.join(' and ')} in the includes block, which ploaness requires verbatim`;
|
|
265
|
+
};
|
|
266
|
+
// A nested Biome configuration must declare itself not to be a root, or Biome refuses the whole tree
|
|
267
|
+
// with "found a nested root configuration". The member cannot inherit the answer: `root` describes the
|
|
268
|
+
// file that declares it, so the shipped config saying `root: false` says nothing about a consumer's.
|
|
269
|
+
const checkBiomeRoot = (parsed, isNestedMember) => !isNestedMember || parsed['root'] === false
|
|
270
|
+
? []
|
|
271
|
+
: [
|
|
272
|
+
{
|
|
273
|
+
location: 'biome.json root',
|
|
274
|
+
reason: 'must declare "root": false; Biome refuses a second root configuration in one tree, ' +
|
|
275
|
+
'and rejects every file in the repository rather than only this package',
|
|
276
|
+
},
|
|
277
|
+
];
|
|
278
|
+
const checkBiome = (config, requiredFiles, biomeExtends, isNestedMember = false) => {
|
|
279
|
+
if (config === undefined) {
|
|
280
|
+
return [{ location: 'biome.json', reason: `missing; must extend ${biomeExtends}` }];
|
|
281
|
+
}
|
|
282
|
+
const read = parseJsonc(config);
|
|
283
|
+
if (read.problem !== undefined) {
|
|
284
|
+
return [{ location: 'biome.json', reason: `is not valid JSON: ${read.problem}` }];
|
|
285
|
+
}
|
|
286
|
+
const parsed = asRecord(read.value);
|
|
287
|
+
const extendsValue = parsed['extends'];
|
|
288
|
+
const missingExtends = isArray(extendsValue) && extendsValue.includes(biomeExtends)
|
|
289
|
+
? []
|
|
290
|
+
: [
|
|
291
|
+
{
|
|
292
|
+
location: 'biome.json',
|
|
293
|
+
reason: `must declare "extends": ["${biomeExtends}"]`,
|
|
294
|
+
},
|
|
295
|
+
];
|
|
296
|
+
const overriddenSections = OWNED_BIOME_SECTIONS.filter((section) => Object.hasOwn(parsed, section)).map((section) => ({
|
|
297
|
+
location: `biome.json ${section}`,
|
|
298
|
+
reason: 'ploaness owns this section; remove the local override',
|
|
299
|
+
}));
|
|
300
|
+
const wrongFiles = JSON.stringify(parsed['files']) === JSON.stringify(requiredFiles)
|
|
301
|
+
? []
|
|
302
|
+
: [
|
|
303
|
+
{
|
|
304
|
+
location: 'biome.json files',
|
|
305
|
+
reason: describeBiomeDrift(parsed['files'], requiredFiles),
|
|
306
|
+
},
|
|
307
|
+
];
|
|
308
|
+
return [
|
|
309
|
+
...missingExtends,
|
|
310
|
+
...checkBiomeRoot(parsed, isNestedMember),
|
|
311
|
+
...overriddenSections,
|
|
312
|
+
...wrongFiles,
|
|
313
|
+
];
|
|
314
|
+
};
|
|
315
|
+
const checkTsconfig = (config, targets, nestedMembers) => {
|
|
316
|
+
if (config === undefined) {
|
|
317
|
+
return [
|
|
318
|
+
{ location: 'tsconfig.json', reason: `missing; must extend ${targets.tsconfigExtends}` },
|
|
319
|
+
];
|
|
320
|
+
}
|
|
321
|
+
const read = parseJsonc(config);
|
|
322
|
+
if (read.problem !== undefined) {
|
|
323
|
+
return [{ location: 'tsconfig.json', reason: `is not valid JSON: ${read.problem}` }];
|
|
324
|
+
}
|
|
325
|
+
const parsed = asRecord(read.value);
|
|
326
|
+
const wrongExtends = parsed['extends'] === targets.tsconfigExtends
|
|
327
|
+
? []
|
|
328
|
+
: [
|
|
329
|
+
{
|
|
330
|
+
location: 'tsconfig.json',
|
|
331
|
+
reason: `must declare "extends": "${targets.tsconfigExtends}"`,
|
|
332
|
+
},
|
|
333
|
+
];
|
|
334
|
+
const overriddenOptions = Object.keys(asRecord(parsed['compilerOptions']))
|
|
335
|
+
.filter((key) => !ALLOWED_TSCONFIG_COMPILER_OPTIONS.has(key))
|
|
336
|
+
.map((key) => ({
|
|
337
|
+
location: `tsconfig.json compilerOptions.${key}`,
|
|
338
|
+
reason: 'ploaness owns this compiler option; remove the local override',
|
|
339
|
+
}));
|
|
340
|
+
const wrongPaths = Object.entries(tsconfigPathsFor(targets.tsconfigPaths, nestedMembers))
|
|
341
|
+
.filter(([key, value]) => JSON.stringify(parsed[key]) !== JSON.stringify(value))
|
|
342
|
+
.map(([key, value]) => ({
|
|
343
|
+
location: `tsconfig.json ${key}`,
|
|
344
|
+
// Printed rather than described, for the reason the biome block above is: this is reachable
|
|
345
|
+
// only once tsconfig.json exists, so the reader is editing a value and needs to see it.
|
|
346
|
+
reason: `must declare the ploaness value verbatim: ${JSON.stringify(value)}`,
|
|
347
|
+
}));
|
|
348
|
+
return [...wrongExtends, ...overriddenOptions, ...wrongPaths];
|
|
349
|
+
};
|
|
350
|
+
// These libraries cannot move into the harness. Under the strict pnpm layout a consumer spec could not
|
|
351
|
+
// resolve `import { describe } from "vitest"` if vitest were only a dependency of ploaness, so the
|
|
352
|
+
// project must declare them itself and ploaness pins the version instead of owning the package.
|
|
353
|
+
// A pinned version is only a pin while nothing else can change it. An `overrides` entry installs a
|
|
354
|
+
// different version and leaves the declaration in package.json untouched, so the version check passes
|
|
355
|
+
// while the code runs against something ploaness never saw. The ploaness packages themselves are not
|
|
356
|
+
// pinned this way, so a pre-publication consumer may still point them at a local tarball.
|
|
357
|
+
// The sanctioned route for an advisory a project cannot reach is `ploaness.vulnerabilityAllowlist`,
|
|
358
|
+
// which records a reason and a date and fails once the entry stops suppressing anything.
|
|
359
|
+
const checkSilencedAdvisories = (packageJson) => findSilencedAdvisories(packageJson).map((key) => ({
|
|
360
|
+
location: `package.json pnpm.auditConfig.${key}`,
|
|
361
|
+
reason: 'silences the vulnerability gate; record the advisory in ' +
|
|
362
|
+
'ploaness.vulnerabilityAllowlist instead, with a reason and a date',
|
|
363
|
+
}));
|
|
364
|
+
/**
|
|
365
|
+
* Return every way the repository has weakened or dropped its ploaness wiring.
|
|
366
|
+
*
|
|
367
|
+
* These are the declarations that exist once per repository however many packages it holds: the package
|
|
368
|
+
* manager that resolves the whole tree, the engines an installer reads, the scripts a run is invoked
|
|
369
|
+
* through, and the overrides pnpm honours only at the root.
|
|
370
|
+
* @param inputs the repository-level files to judge.
|
|
371
|
+
* @returns one violation per defect, in a stable order.
|
|
372
|
+
*/
|
|
373
|
+
export const findRepositoryWiringViolations = (inputs) => {
|
|
374
|
+
const packageJson = asRecord(inputs.packageJson);
|
|
375
|
+
return [
|
|
376
|
+
...checkDependency(packageJson),
|
|
377
|
+
...checkExactEntries(asStringRecord(packageJson['scripts']), REQUIRED_SCRIPTS, 'package.json scripts'),
|
|
378
|
+
...findRepositoryVersionViolations(packageJson, {
|
|
379
|
+
expected: inputs.expectedTestLibraries,
|
|
380
|
+
requiredPackageManager: inputs.requiredPackageManager,
|
|
381
|
+
requiredEngines: inputs.requiredEngines,
|
|
382
|
+
workspaceFile: inputs.workspaceFile,
|
|
383
|
+
declaredAcrossMembers: inputs.declaredAcrossMembers,
|
|
384
|
+
}),
|
|
385
|
+
...checkSilencedAdvisories(inputs.packageJson),
|
|
386
|
+
...findConvenienceExclusions(inputs.declaredExclusions).map((reason) => ({ location: 'package.json ploaness', reason })),
|
|
387
|
+
...inputs.repositoryFindings,
|
|
388
|
+
];
|
|
389
|
+
};
|
|
390
|
+
/**
|
|
391
|
+
* Return every way one member has weakened or dropped its ploaness wiring.
|
|
392
|
+
*
|
|
393
|
+
* A library member is not asked for a Playwright configuration: it has no application to drive, and
|
|
394
|
+
* requiring the file would make a package fail for not having a browser it was never going to open.
|
|
395
|
+
* @param inputs the member's files to judge.
|
|
396
|
+
* @returns one violation per defect, in a stable order.
|
|
397
|
+
*/
|
|
398
|
+
export const findPackageWiringViolations = (inputs) => {
|
|
399
|
+
const packageJson = asRecord(inputs.packageJson);
|
|
400
|
+
const targets = wiringTargetsFor(inputs.kind);
|
|
401
|
+
return [
|
|
402
|
+
...checkDependency(packageJson),
|
|
403
|
+
...findPackageVersionViolations(packageJson, {
|
|
404
|
+
expected: inputs.expectedTestLibraries,
|
|
405
|
+
required: inputs.requiredTestLibraries,
|
|
406
|
+
payloadVersion: inputs.payloadVersion,
|
|
407
|
+
}),
|
|
408
|
+
...findConvenienceExclusions(inputs.declaredExclusions).map((reason) => ({ location: 'package.json ploaness', reason })),
|
|
409
|
+
...checkReexport(inputs.eslintConfig, 'eslint.config.mjs', targets.eslintSpecifier),
|
|
410
|
+
...checkReexport(inputs.vitestConfig, 'vitest.config.mts', targets.vitestSpecifier),
|
|
411
|
+
...(targets.playwrightSpecifier === undefined
|
|
412
|
+
? []
|
|
413
|
+
: checkReexport(inputs.playwrightConfig, 'playwright.config.ts', targets.playwrightSpecifier)),
|
|
414
|
+
...checkBiome(inputs.biomeConfig, inputs.requiredBiomeFiles, targets.biomeExtends, inputs.isNestedMember),
|
|
415
|
+
...checkTsconfig(inputs.tsconfig, targets, inputs.nestedMembers),
|
|
416
|
+
];
|
|
417
|
+
};
|
|
418
|
+
/**
|
|
419
|
+
* The whole wiring contract for a repository holding exactly one package.
|
|
420
|
+
*
|
|
421
|
+
* Not a shim over the split: a single-package repository IS both scopes over one manifest, so composing
|
|
422
|
+
* the halves is what that case means. It is kept as an entry point because the behaviour it describes is
|
|
423
|
+
* pinned by a large spec written before the scopes existed - and that spec passing unchanged is the
|
|
424
|
+
* evidence the split dropped nothing.
|
|
425
|
+
* @param inputs the consumer files and expectations to judge.
|
|
426
|
+
* @returns one violation per defect, in a stable order.
|
|
427
|
+
*/
|
|
428
|
+
export const findWiringViolations = (inputs) => [
|
|
429
|
+
...findRepositoryWiringViolations({
|
|
430
|
+
packageJson: inputs.packageJson,
|
|
431
|
+
workspaceFile: inputs.workspaceFile,
|
|
432
|
+
declaredExclusions: inputs.declaredExclusions,
|
|
433
|
+
expectedTestLibraries: inputs.expectedTestLibraries,
|
|
434
|
+
requiredPackageManager: inputs.requiredPackageManager,
|
|
435
|
+
requiredEngines: inputs.requiredEngines,
|
|
436
|
+
declaredAcrossMembers: declaredDependencies(inputs.packageJson),
|
|
437
|
+
repositoryFindings: [],
|
|
438
|
+
}),
|
|
439
|
+
...findPackageWiringViolations({
|
|
440
|
+
packageJson: inputs.packageJson,
|
|
441
|
+
kind: 'payload',
|
|
442
|
+
isNestedMember: false,
|
|
443
|
+
// A single-package project has no members inside it, which is what makes this composition equal to
|
|
444
|
+
// what shipped before the workspace split.
|
|
445
|
+
nestedMembers: [],
|
|
446
|
+
requiredBiomeFiles: inputs.requiredBiomeFiles,
|
|
447
|
+
eslintConfig: inputs.eslintConfig,
|
|
448
|
+
vitestConfig: inputs.vitestConfig,
|
|
449
|
+
playwrightConfig: inputs.playwrightConfig,
|
|
450
|
+
declaredExclusions: inputs.declaredExclusions,
|
|
451
|
+
biomeConfig: inputs.biomeConfig,
|
|
452
|
+
tsconfig: inputs.tsconfig,
|
|
453
|
+
expectedTestLibraries: inputs.expectedTestLibraries,
|
|
454
|
+
requiredTestLibraries: inputs.requiredTestLibraries,
|
|
455
|
+
payloadVersion: inputs.payloadVersion,
|
|
456
|
+
}),
|
|
457
|
+
];
|
|
458
|
+
//# sourceMappingURL=wiring-policy.js.map
|
|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tC,CAAC;CACH,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiring-violation.d.ts","sourceRoot":"","sources":["../src/wiring-violation.ts"],"names":[],"mappings":"AAOA,4EAA4E;AAC5E,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// The one type the wiring rules and the version rules both speak.
|
|
2
|
+
//
|
|
3
|
+
// It lived in `wiring-policy.ts`, which imports `version-policy.ts` for the version rules, while
|
|
4
|
+
// `version-policy.ts` imported the type back. That is a cycle, and the governing standard says a cycle
|
|
5
|
+
// is broken by moving the shared concept into a unit both sides depend on rather than by declaring it
|
|
6
|
+
// acceptable. This module is that unit: it declares a type and imports nothing.
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=wiring-violation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wiring-violation.js","sourceRoot":"","sources":["../src/wiring-violation.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,iGAAiG;AACjG,uGAAuG;AACvG,sGAAsG;AACtG,gFAAgF"}
|