@syntopica/create-baseline 0.9.0 → 0.10.1
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 +1 -1
- package/README.md +4 -4
- package/baseline-versions.json +5 -5
- package/bin/conformance/checkActionPins.mjs +1 -1
- package/bin/conformance/checkGateCoverage.mjs +1 -1
- package/bin/conformance/checkTsconfigPresets.mjs +1 -1
- package/bin/conformance/checkTsconfigProjects.mjs +1 -1
- package/bin/conformance/ciEntrypoints.mjs +1 -1
- package/bin/conformance/loadContext.mjs +1 -1
- package/bin/create-baseline.mjs +2 -2
- package/bin/estate/findPythonConsumers.mjs +4 -4
- package/bin/python/checkGateWorkflow.mjs +5 -5
- package/bin/python/checkLockPin.mjs +2 -2
- package/bin/python/checkQualityGroup.mjs +5 -5
- package/bin/scaffold/checkPeers.mjs +1 -1
- package/bin/scaffold/ciWorkflow.mjs +3 -0
- package/bin/scaffold/writeMissing.mjs +1 -1
- package/package.json +20 -21
- package/python-versions.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @syntopica/create-baseline
|
|
2
2
|
|
|
3
3
|
Small CLI to print install commands and verify that your project lists the
|
|
4
|
-
`@
|
|
4
|
+
`@syntopica` baseline config packages (`eslint-config`, `prettier-config`,
|
|
5
5
|
`tsconfig`, `quality-config`) and optionally checks for a flat ESLint config
|
|
6
6
|
file and the quality-gate config files (`knip.config.ts`/`.js`, `lefthook.yml`,
|
|
7
7
|
`renovate.json`).
|
|
@@ -57,7 +57,7 @@ subpaths are read from your `eslint.config.*`, so a project that never composes
|
|
|
57
57
|
`@syntopica/eslint-config` ships TypeScript source rather than a build, so these
|
|
58
58
|
resolve from your project. pnpm reports a mismatch as one line among hundreds on
|
|
59
59
|
install; the consequence shows up much later as a crash from inside ESLint that
|
|
60
|
-
names neither the baseline nor the peer. Adopting
|
|
60
|
+
names neither the baseline nor the peer. Adopting consumer-u hit three of them
|
|
61
61
|
in a row - one absent, one on a prerelease whose config was still
|
|
62
62
|
eslintrc-format, one a major behind the schema the config emits - and each took
|
|
63
63
|
a separate diagnosis.
|
|
@@ -79,7 +79,7 @@ treated as authored, so an unreadable file never silently drops the requirement.
|
|
|
79
79
|
## Repository
|
|
80
80
|
|
|
81
81
|
Source and issues:
|
|
82
|
-
[github.com/
|
|
82
|
+
[github.com/syntopica/codeality](https://github.com/syntopica/codeality/tree/main/packages/create-baseline).
|
|
83
83
|
|
|
84
84
|
Adoption guides:
|
|
85
|
-
[engineering-baseline/docs/adoption](https://github.com/
|
|
85
|
+
[engineering-baseline/docs/adoption](https://github.com/syntopica/codeality/tree/main/docs/adoption).
|
package/baseline-versions.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"@syntopica/eslint-config": "^0.
|
|
3
|
-
"@syntopica/prettier-config": "^0.2.
|
|
4
|
-
"@syntopica/tsconfig": "^0.3.
|
|
5
|
-
"@syntopica/quality-config": "^0.
|
|
6
|
-
"eslint-plugin-code-policy": "^0.
|
|
2
|
+
"@syntopica/eslint-config": "^0.9.0",
|
|
3
|
+
"@syntopica/prettier-config": "^0.2.2",
|
|
4
|
+
"@syntopica/tsconfig": "^0.3.1",
|
|
5
|
+
"@syntopica/quality-config": "^0.12.1",
|
|
6
|
+
"eslint-plugin-code-policy": "^0.8.0",
|
|
7
7
|
"dependency-cruiser": "^18.1.1",
|
|
8
8
|
"jiti": "^2.7.0",
|
|
9
9
|
"jscpd": "^5.0.14",
|
|
@@ -11,7 +11,7 @@ const SHA_PINNED = /@[0-9a-f]{40}$/
|
|
|
11
11
|
* on the next push with no diff in this repository to review. This is the
|
|
12
12
|
* shape of the tj-actions/changed-files compromise, and it is not theoretical.
|
|
13
13
|
*
|
|
14
|
-
* One repository in the estate (
|
|
14
|
+
* One repository in the estate (consumer-g) pinned by SHA; the baseline repo
|
|
15
15
|
* itself did not. That asymmetry is what this check exists to remove.
|
|
16
16
|
*/
|
|
17
17
|
export function checkActionPins({ workflows }) {
|
|
@@ -42,7 +42,7 @@ const GATES = [
|
|
|
42
42
|
* Every gate must be reachable from what CI runs.
|
|
43
43
|
*
|
|
44
44
|
* Measured from the pipeline, not from a name. Asserting that a workflow says
|
|
45
|
-
* `check:ci` was the wrong question:
|
|
45
|
+
* `check:ci` was the wrong question: consumer-g runs every gate in CI as its
|
|
46
46
|
* own step and never uses that word, and it is the best-wired repository in
|
|
47
47
|
* the estate. So the entrypoints are whatever scripts the workflows invoke,
|
|
48
48
|
* and the assertion is that the union of everything reachable from them
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Every project tsconfig must extend an `@syntopica/tsconfig` preset.
|
|
3
3
|
*
|
|
4
4
|
* A repository can carry the dependency, pass every other column, and still
|
|
5
|
-
* not be on the baseline: in
|
|
5
|
+
* not be on the baseline: in consumer-g only `tsconfig.app.json` extended a
|
|
6
6
|
* preset, while `tsconfig.node.json` and `tsconfig.next.json` were
|
|
7
7
|
* hand-written and weaker than `base.json` - no `noUncheckedIndexedAccess`,
|
|
8
8
|
* no `exactOptionalPropertyTypes`, no `noImplicitOverride`, `allowJs` on the
|
|
@@ -12,7 +12,7 @@ const BARE_BUILD =
|
|
|
12
12
|
* `type-check`.
|
|
13
13
|
*
|
|
14
14
|
* The defect this catches is the expensive kind: a gate that exits 0 while
|
|
15
|
-
* reading almost nothing.
|
|
15
|
+
* reading almost nothing. consumer-g's root tsconfig.json referenced three
|
|
16
16
|
* projects and its `type-check` script named two of them, so `app/`,
|
|
17
17
|
* `proxy.ts` and `instrumentation.ts` - the largest surface in the repo -
|
|
18
18
|
* reached `check:ci` unchecked for months while the estate report called the
|
|
@@ -11,7 +11,7 @@ const TURBO_INVOCATION =
|
|
|
11
11
|
* The package scripts CI actually runs.
|
|
12
12
|
*
|
|
13
13
|
* Asserting that a workflow names `check:ci` would have been the wrong
|
|
14
|
-
* question.
|
|
14
|
+
* question. consumer-g runs every gate in CI as its own step - `pnpm run
|
|
15
15
|
* type-check`, `pnpm run lint`, `pnpm run dupes` - and never says `check:ci`
|
|
16
16
|
* anywhere; it is the best-wired repository in the estate and a name-matching
|
|
17
17
|
* check called it unwired. What matters is which gates the pipeline reaches,
|
|
@@ -34,7 +34,7 @@ export async function loadContext(root, versions) {
|
|
|
34
34
|
// Workspace manifests first so the root's own entry wins a version clash and
|
|
35
35
|
// the report names the version the repo installs at its top level. Without
|
|
36
36
|
// this, a monorepo that declares the baseline per workspace reads as having
|
|
37
|
-
// none of it - which is how
|
|
37
|
+
// none of it - which is how consumer-y, running the whole toolchain, was
|
|
38
38
|
// told it had nothing installed.
|
|
39
39
|
const deps = {}
|
|
40
40
|
for (const workspace of await workspaceRoots(root)) {
|
package/bin/create-baseline.mjs
CHANGED
|
@@ -49,7 +49,7 @@ function parseArgs(argv) {
|
|
|
49
49
|
// In a monorepo the per-workspace packages - eslint-config, tsconfig,
|
|
50
50
|
// code-policy - are declared by each workspace, not by the root. Reading the
|
|
51
51
|
// root manifest alone reports every one of them missing and tells the adopter
|
|
52
|
-
// to install packages it already has, which is how
|
|
52
|
+
// to install packages it already has, which is how consumer-y, a repo running
|
|
53
53
|
// the whole toolchain, was told it had none of it.
|
|
54
54
|
async function collectWorkspaceDeps(root) {
|
|
55
55
|
const deps = {}
|
|
@@ -330,7 +330,7 @@ async function main() {
|
|
|
330
330
|
}
|
|
331
331
|
if (!eslintOk) {
|
|
332
332
|
console.log(
|
|
333
|
-
'\nNo eslint.config.* found. Add a flat config that imports @syntopica/eslint-config (see https://github.com/
|
|
333
|
+
'\nNo eslint.config.* found. Add a flat config that imports @syntopica/eslint-config (see https://github.com/syntopica/codeality/tree/main/docs/adoption).',
|
|
334
334
|
)
|
|
335
335
|
}
|
|
336
336
|
if (missingQuality.length) {
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { readdir, readFile } from 'node:fs/promises'
|
|
2
2
|
import { relative, resolve } from 'node:path'
|
|
3
3
|
|
|
4
|
-
const TOOL = '
|
|
4
|
+
const TOOL = 'syntopica-codeality-py'
|
|
5
5
|
// The tool's own pyproject names it too; a package is not its own consumer.
|
|
6
|
-
const IS_THE_TOOL = /^name = "
|
|
6
|
+
const IS_THE_TOOL = /^name = "syntopica-codeality-py"/m
|
|
7
7
|
// Directories that never hold a project of ours, and would make the walk
|
|
8
8
|
// slow (node_modules), circular (.venv) or pointless (a build tree).
|
|
9
9
|
const SKIP = new Set(['node_modules', 'build', 'dist', 'target'])
|
|
10
10
|
const MAX_DEPTH = 3
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* Every project under `root` whose pyproject.toml depends on
|
|
13
|
+
* Every project under `root` whose pyproject.toml depends on codeality-py.
|
|
14
14
|
*
|
|
15
15
|
* Three levels deep, unlike `findConsumers`: the estate sweep proved that a
|
|
16
16
|
* Python project is often nested inside a repository that is about something
|
|
17
|
-
* else - `
|
|
17
|
+
* else - `parent-repo/tools/nested-tool`, `multi-project-repo/consumer-c` - and a scan
|
|
18
18
|
* of repository roots reported those as having no Python at all.
|
|
19
19
|
*
|
|
20
20
|
* Returns `[{ name, path }]` sorted by name; `name` is the path relative to
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const AUTOMATIC_TRIGGER = /^\s*(?:push|pull_request|pull_request_target)\s*:/m
|
|
2
|
-
const RUNS_GATE = /\
|
|
2
|
+
const RUNS_GATE = /\bcodeality-py\s+gate\b/
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Something has to run `
|
|
5
|
+
* Something has to run `codeality-py gate` on every push.
|
|
6
6
|
*
|
|
7
7
|
* The 2026-09-01 audit found every adopted repository green locally and not
|
|
8
8
|
* one of them running the gate anywhere else; one still ran its
|
|
@@ -16,9 +16,9 @@ export function checkGateWorkflow({ workflows }) {
|
|
|
16
16
|
return []
|
|
17
17
|
}
|
|
18
18
|
const message = gated.length
|
|
19
|
-
? 'the workflow running
|
|
19
|
+
? 'the workflow running codeality-py gate is manual or scheduled'
|
|
20
20
|
: workflows.length
|
|
21
|
-
? 'no workflow runs
|
|
21
|
+
? 'no workflow runs codeality-py gate'
|
|
22
22
|
: 'no GitHub Actions workflow'
|
|
23
23
|
return [
|
|
24
24
|
{
|
|
@@ -27,7 +27,7 @@ export function checkGateWorkflow({ workflows }) {
|
|
|
27
27
|
message,
|
|
28
28
|
detail:
|
|
29
29
|
'The gate is installed and unreachable: nothing runs it on push. ' +
|
|
30
|
-
'`
|
|
30
|
+
'`codeality-py init --ci --apply` writes .github/workflows/quality.yml.',
|
|
31
31
|
},
|
|
32
32
|
]
|
|
33
33
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const TOOL = '
|
|
2
|
-
const LOCKED = /^name = "
|
|
1
|
+
const TOOL = 'syntopica-codeality-py'
|
|
2
|
+
const LOCKED = /^name = "syntopica-codeality-py"\nversion = "([^"]+)"/m
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The lockfile must pin the current release of the tool.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
const TOOL = '
|
|
2
|
-
const GROUP = /^\s*quality\s*=\s*\[[^\]]*
|
|
1
|
+
const TOOL = 'syntopica-codeality-py'
|
|
2
|
+
const GROUP = /^\s*quality\s*=\s*\[[^\]]*syntopica-codeality-py/m
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The gate's tools must be declared as a `quality` dependency group.
|
|
6
6
|
*
|
|
7
|
-
* `
|
|
7
|
+
* `codeality-py gate` runs ruff, mypy, deptry, pip-audit and pytest from the
|
|
8
8
|
* environment it is invoked in; a project that lists only the tool cannot
|
|
9
9
|
* run its gate, and one whose floor is below 3.11 cannot list it at all.
|
|
10
10
|
*/
|
|
@@ -15,7 +15,7 @@ export function checkQualityGroup({ pyproject }) {
|
|
|
15
15
|
id: 'py-tool',
|
|
16
16
|
level: 'error',
|
|
17
17
|
message: `${TOOL} is not a dependency`,
|
|
18
|
-
detail: 'Add the quality group with `
|
|
18
|
+
detail: 'Add the quality group with `codeality-py init --apply`.',
|
|
19
19
|
},
|
|
20
20
|
]
|
|
21
21
|
}
|
|
@@ -27,7 +27,7 @@ export function checkQualityGroup({ pyproject }) {
|
|
|
27
27
|
message: `${TOOL} is declared outside the quality dependency group`,
|
|
28
28
|
detail:
|
|
29
29
|
'The gate needs ruff, mypy, deptry, pip-audit, pytest and pytest-cov ' +
|
|
30
|
-
'beside it; `
|
|
30
|
+
'beside it; `codeality-py init --apply` declares the group.',
|
|
31
31
|
},
|
|
32
32
|
]
|
|
33
33
|
}
|
|
@@ -12,7 +12,7 @@ const CONFIG_PACKAGE = '@syntopica/eslint-config'
|
|
|
12
12
|
// pnpm already prints "Issues with peer dependencies found" on install, but
|
|
13
13
|
// it is one line among hundreds and the consequence only shows up later, as a
|
|
14
14
|
// crash from inside ESLint that names neither the baseline nor the peer.
|
|
15
|
-
// Measured adopting
|
|
15
|
+
// Measured adopting consumer-u: three separate peers, three opaque failures,
|
|
16
16
|
// each diagnosed by hand.
|
|
17
17
|
export async function checkPeers(root) {
|
|
18
18
|
const config = await manifestOf(root, CONFIG_PACKAGE)
|
|
@@ -15,6 +15,8 @@ const GITLEAKS_VERSION = '8.30.1'
|
|
|
15
15
|
const setup = (
|
|
16
16
|
node,
|
|
17
17
|
) => ` - uses: ${ACTION_PINS.checkout.uses} # ${ACTION_PINS.checkout.tag}
|
|
18
|
+
with:
|
|
19
|
+
persist-credentials: false
|
|
18
20
|
|
|
19
21
|
- uses: ${ACTION_PINS.setupPnpm.uses} # ${ACTION_PINS.setupPnpm.tag}
|
|
20
22
|
|
|
@@ -105,6 +107,7 @@ ${setup(node)}
|
|
|
105
107
|
- uses: ${ACTION_PINS.checkout.uses} # ${ACTION_PINS.checkout.tag}
|
|
106
108
|
with:
|
|
107
109
|
fetch-depth: 0
|
|
110
|
+
persist-credentials: false
|
|
108
111
|
|
|
109
112
|
- uses: ${ACTION_PINS.setupPnpm.uses} # ${ACTION_PINS.setupPnpm.tag}
|
|
110
113
|
|
|
@@ -17,7 +17,7 @@ import { writeCiWorkflow } from './writeCiWorkflow.mjs'
|
|
|
17
17
|
// for scripts - only names the project does not define are added.
|
|
18
18
|
//
|
|
19
19
|
// `alternatives` is every other filename the tool itself would load, not a
|
|
20
|
-
// guess. Miss one and the write is worse than useless:
|
|
20
|
+
// guess. Miss one and the write is worse than useless: consumer-m
|
|
21
21
|
// carried a `knip.json` that set `project` to `["tsconfig.json"]`, so knip
|
|
22
22
|
// scanned almost nothing and called 34 live dependencies unused. This tool
|
|
23
23
|
// wrote `knip.config.ts` next to it, knip went on loading the json, and the
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syntopica/create-baseline",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"private": false,
|
|
5
|
-
"packageManager": "pnpm@11.25.0",
|
|
6
5
|
"license": "MIT",
|
|
7
6
|
"description": "CLI to verify and adopt @syntopica baseline config packages",
|
|
8
7
|
"repository": {
|
|
9
8
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
9
|
+
"url": "git+https://github.com/syntopica/codeality.git",
|
|
11
10
|
"directory": "packages/create-baseline"
|
|
12
11
|
},
|
|
13
|
-
"homepage": "https://github.com/
|
|
12
|
+
"homepage": "https://github.com/syntopica/codeality/tree/main/packages/create-baseline#readme",
|
|
14
13
|
"bugs": {
|
|
15
|
-
"url": "https://github.com/
|
|
14
|
+
"url": "https://github.com/syntopica/codeality/issues"
|
|
16
15
|
},
|
|
17
16
|
"publishConfig": {
|
|
18
17
|
"access": "public"
|
|
@@ -32,15 +31,6 @@
|
|
|
32
31
|
"python-versions.json",
|
|
33
32
|
"bin"
|
|
34
33
|
],
|
|
35
|
-
"scripts": {
|
|
36
|
-
"check:self": "node ./bin/create-baseline.mjs --check",
|
|
37
|
-
"lint": "eslint bin tests --max-warnings 0",
|
|
38
|
-
"lint:fix": "eslint bin tests --fix",
|
|
39
|
-
"lint:suppress": "eslint bin tests --suppress-all",
|
|
40
|
-
"lint:prune": "eslint bin tests --prune-suppressions",
|
|
41
|
-
"test": "vitest run --coverage",
|
|
42
|
-
"publish:check": "baseline-licenses && publint --strict && attw --pack . --profile node16"
|
|
43
|
-
},
|
|
44
34
|
"keywords": [
|
|
45
35
|
"eslint",
|
|
46
36
|
"prettier",
|
|
@@ -49,11 +39,20 @@
|
|
|
49
39
|
],
|
|
50
40
|
"devDependencies": {
|
|
51
41
|
"@arethetypeswrong/cli": "^0.18.5",
|
|
52
|
-
"@syntopica/eslint-config": "
|
|
53
|
-
"@vitest/coverage-v8": "^
|
|
54
|
-
"eslint": "^10.
|
|
55
|
-
"eslint-plugin-regexp": "^3.
|
|
56
|
-
"publint": "^0.3.
|
|
57
|
-
"vitest": "^
|
|
42
|
+
"@syntopica/eslint-config": "0.9.0",
|
|
43
|
+
"@vitest/coverage-v8": "^5.0.3",
|
|
44
|
+
"eslint": "^10.12.0",
|
|
45
|
+
"eslint-plugin-regexp": "^3.3.1",
|
|
46
|
+
"publint": "^0.3.25",
|
|
47
|
+
"vitest": "^5.0.3"
|
|
48
|
+
},
|
|
49
|
+
"scripts": {
|
|
50
|
+
"check:self": "node ./bin/create-baseline.mjs --check",
|
|
51
|
+
"lint": "eslint bin tests --max-warnings 0",
|
|
52
|
+
"lint:fix": "eslint bin tests --fix",
|
|
53
|
+
"lint:suppress": "eslint bin tests --suppress-all",
|
|
54
|
+
"lint:prune": "eslint bin tests --prune-suppressions",
|
|
55
|
+
"test": "vitest run --coverage",
|
|
56
|
+
"publish:check": "baseline-licenses && publint --strict && attw --pack . --profile node16"
|
|
58
57
|
}
|
|
59
|
-
}
|
|
58
|
+
}
|
package/python-versions.json
CHANGED