@nodeve/checks 0.4.1 → 0.5.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 +18 -38
- package/dist/bin/format-markdown.d.ts +3 -0
- package/dist/bin/format-markdown.d.ts.map +1 -0
- package/dist/bin/format-markdown.js +38 -0
- package/dist/bin/format-markdown.js.map +1 -0
- package/dist/bin/page-size.js +7 -5
- package/dist/bin/page-size.js.map +1 -1
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +4 -2
- package/dist/lib/config.js.map +1 -1
- package/lefthook.checks.yml +11 -0
- package/nodeve.checks.example.js +7 -2
- package/package.json +10 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kai Curry
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# @nodeve/checks
|
|
2
2
|
|
|
3
|
-
Org-wide commit-gate checks and helper-index generators, shared across nodeve
|
|
4
|
-
repos. Each check ships as a published bin that reads an optional per-repo
|
|
5
|
-
`nodeve.checks.js` and derives the repo root from git — so it behaves the same
|
|
6
|
-
whatever directory the hook runner invokes it from. Wiring is via lefthook.
|
|
3
|
+
Org-wide commit-gate checks and helper-index generators, shared across nodeve repos. Each check ships as a published bin that reads an optional per-repo `nodeve.checks.js` and derives the repo root from git — so it behaves the same whatever directory the hook runner invokes it from. Wiring is via lefthook.
|
|
7
4
|
|
|
8
5
|
## Install
|
|
9
6
|
|
|
@@ -18,14 +15,11 @@ extends:
|
|
|
18
15
|
- node_modules/@nodeve/checks/lefthook.checks.yml
|
|
19
16
|
```
|
|
20
17
|
|
|
21
|
-
Then activate hooks once per clone with `lefthook install` (familiar/nodeve do
|
|
22
|
-
this from their `prepare` script).
|
|
18
|
+
Then activate hooks once per clone with `lefthook install` (familiar/nodeve do this from their `prepare` script).
|
|
23
19
|
|
|
24
20
|
## Configure
|
|
25
21
|
|
|
26
|
-
Copy `node_modules/@nodeve/checks/nodeve.checks.example.js` to your repo root as
|
|
27
|
-
`nodeve.checks.js` and trim to taste. Every section is optional; omitted keys
|
|
28
|
-
fall back to org defaults. See the example for the full shape.
|
|
22
|
+
Copy `node_modules/@nodeve/checks/nodeve.checks.example.js` to your repo root as `nodeve.checks.js` and trim to taste. Every section is optional; omitted keys fall back to org defaults. See the example for the full shape.
|
|
29
23
|
|
|
30
24
|
## Checks
|
|
31
25
|
|
|
@@ -35,53 +29,39 @@ fall back to org defaults. See the example for the full shape.
|
|
|
35
29
|
| `nodeve-check-reshape` | callbacks that reproduce their input shape (no-op / pick / clone) | on (`apps/`, `packages/`) |
|
|
36
30
|
| `nodeve-check-inline-dupes` | non-exported top-level names declared in 2+ files | on (`apps/`, `packages/`) |
|
|
37
31
|
| `nodeve-check-helper-collisions` | local helpers that fuzzily match a dependency export | on (needs lib-names index) |
|
|
38
|
-
| `nodeve-check-page-size` | files over a per-glob line budget |
|
|
32
|
+
| `nodeve-check-page-size` | files over a per-glob line budget | on (`*+page.svelte` >280; no-op where the glob matches nothing) |
|
|
39
33
|
| `nodeve-check-file-size` | TS sources over a line budget (warn >225, fail >300) | on (`apps/`, `packages/`) |
|
|
40
34
|
| `nodeve-check-catalog` | dependency versions not single-sourced from a workspace catalog | on (a workspace must declare a catalog) |
|
|
41
35
|
| `nodeve-check-require-deps` | org-required deps missing from the workspace catalog | on (`remeda`; set `deps: []` to opt out) |
|
|
42
36
|
|
|
43
|
-
`require-deps` keeps the org's blessed libraries single-sourced and visibly
|
|
44
|
-
expected: it fails when the workspace catalog (default or a named group) doesn't
|
|
45
|
-
define a required name. It checks the catalog, not each package's deps — so it
|
|
46
|
-
doesn't force the dep on packages that don't use it, it just guarantees the
|
|
47
|
-
version is there to adopt with `catalog:`. Defaults to requiring `remeda`; set
|
|
48
|
-
`requireDeps: { deps: [] }` to opt out.
|
|
37
|
+
`require-deps` keeps the org's blessed libraries single-sourced and visibly expected: it fails when the workspace catalog (default or a named group) doesn't define a required name. It checks the catalog, not each package's deps — so it doesn't force the dep on packages that don't use it, it just guarantees the version is there to adopt with `catalog:`. Defaults to requiring `remeda`; set `requireDeps: { deps: [] }` to opt out.
|
|
49
38
|
|
|
50
|
-
`catalog` works with both pnpm (catalog in `pnpm-workspace.yaml`) and Bun
|
|
51
|
-
(catalog in `package.json#workspaces`) — it auto-detects whichever the repo uses.
|
|
52
|
-
A workspace is **required** to declare a catalog: a repo with none fails the gate,
|
|
53
|
-
since the point is keeping versions aligned. Every dependency (deps, devDeps, and
|
|
54
|
-
peers alike) must reference `catalog:` rather than a literal pin. Opt a repo out
|
|
55
|
-
deliberately with `catalog: { enforce: false }`.
|
|
39
|
+
`catalog` works with both pnpm (catalog in `pnpm-workspace.yaml`) and Bun (catalog in `package.json#workspaces`) — it auto-detects whichever the repo uses. A workspace is **required** to declare a catalog: a repo with none fails the gate, since the point is keeping versions aligned. Every dependency (deps, devDeps, and peers alike) must reference `catalog:` rather than a literal pin. Opt a repo out deliberately with `catalog: { enforce: false }`.
|
|
56
40
|
|
|
57
|
-
All blocking checks accept `--warn` (report-only, exit 0); `doc-tokens` accepts
|
|
58
|
-
|
|
59
|
-
|
|
41
|
+
All blocking checks accept `--warn` (report-only, exit 0); `doc-tokens` accepts `--report` to list the whole backlog without failing. Pass explicit paths to scope a run (lefthook passes `{staged_files}`).
|
|
42
|
+
|
|
43
|
+
## Fixers
|
|
44
|
+
|
|
45
|
+
Unlike the gates above, fixers mutate staged files and let lefthook re-stage them (`stage_fixed: true`). They run before the `checks` group so the gates see the fixed content.
|
|
46
|
+
|
|
47
|
+
- `nodeve-format-markdown` — prettier-formats staged `*.md` in place, so docs land formatted without a manual `prettier --write`. Bundles its own prettier (nothing needed on PATH, portable across pnpm and bun) yet honors the repo's prettier config, `.prettierignore`, and plugins, which prettier resolves per file. Skips symlinked docs (e.g. `CLAUDE.md` → `README.md`), which prettier can't format and which get formatted via their real target's own staged entry.
|
|
60
48
|
|
|
61
49
|
### Running ad hoc
|
|
62
50
|
|
|
63
|
-
These are **bins**, not package scripts, so `pnpm run` / `bun run` won't find
|
|
64
|
-
them — those run `package.json#scripts`. Invoke a bin through `exec` instead,
|
|
65
|
-
which resolves `node_modules/.bin` for you (no hardcoded path needed):
|
|
51
|
+
These are **bins**, not package scripts, so `pnpm run` / `bun run` won't find them — those run `package.json#scripts`. Invoke a bin through `exec` instead, which resolves `node_modules/.bin` for you (no hardcoded path needed):
|
|
66
52
|
|
|
67
53
|
```sh
|
|
68
54
|
pnpm exec nodeve-check-doc-tokens 'README.md' # or: pnpm nodeve-check-doc-tokens ...
|
|
69
55
|
bunx nodeve-check-doc-tokens 'README.md' # Bun repos
|
|
70
56
|
```
|
|
71
57
|
|
|
72
|
-
Quote globs so your shell doesn't expand them before the bin sees them. Day to
|
|
73
|
-
day you shouldn't need this — the bins run through lefthook on commit.
|
|
58
|
+
Quote globs so your shell doesn't expand them before the bin sees them. Day to day you shouldn't need this — the bins run through lefthook on commit.
|
|
74
59
|
|
|
75
60
|
## Generators
|
|
76
61
|
|
|
77
|
-
- `nodeve-build-lib-names` — writes the committed lib-names index that
|
|
78
|
-
|
|
79
|
-
index is committed so the gate never needs the libs installed at check time.
|
|
80
|
-
- `nodeve-build-helper-manifest` — **opt-in**; writes a greppable index of the
|
|
81
|
-
public export surface of the configured packages. Grep it before adding a
|
|
82
|
-
generic helper.
|
|
62
|
+
- `nodeve-build-lib-names` — writes the committed lib-names index that `helper-collisions` matches against (regenerate after dependency bumps). The index is committed so the gate never needs the libs installed at check time.
|
|
63
|
+
- `nodeve-build-helper-manifest` — **opt-in**; writes a greppable index of the public export surface of the configured packages. Grep it before adding a generic helper.
|
|
83
64
|
|
|
84
65
|
## Notes for Bun repos
|
|
85
66
|
|
|
86
|
-
The bins are plain Node ESM and run under Node from `node_modules/.bin`. lefthook
|
|
87
|
-
in a Bun workspace still finds them on PATH; no `bunx` prefix is needed.
|
|
67
|
+
The bins are plain Node ESM and run under Node from `node_modules/.bin`. lefthook in a Bun workspace still finds them on PATH; no `bunx` prefix is needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-markdown.d.ts","sourceRoot":"","sources":["../../src/bin/format-markdown.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Commit fixer: prettier-format staged markdown in place, so docs land formatted
|
|
4
|
+
* without a manual `prettier --write`. Wired in the shared lefthook config with
|
|
5
|
+
* `stage_fixed: true`, which re-stages whatever this touches.
|
|
6
|
+
*
|
|
7
|
+
* WHY a bin instead of `bunx prettier --write` in the hook: the rest of the
|
|
8
|
+
* shared config shells `node_modules/.bin/nodeve-*` so it's portable across pnpm
|
|
9
|
+
* and bun and needs nothing on PATH. `bunx` needs Bun, and under pnpm's strict
|
|
10
|
+
* layout a transitive prettier isn't at the consumer's `node_modules/.bin`. So we
|
|
11
|
+
* bundle prettier as a dependency and resolve ITS cli here — available in every
|
|
12
|
+
* consumer regardless of their own deps.
|
|
13
|
+
*
|
|
14
|
+
* The bundled prettier still honors the consumer's `.prettierrc`/`.prettierignore`
|
|
15
|
+
* and plugins: prettier resolves both relative to each file, not to this bin.
|
|
16
|
+
*
|
|
17
|
+
* Skips symlinked docs (e.g. CLAUDE.md → README.md): prettier errors on a symlink
|
|
18
|
+
* path, and the real target is formatted via its own staged entry anyway.
|
|
19
|
+
*/
|
|
20
|
+
import { spawnSync } from 'node:child_process';
|
|
21
|
+
import { createRequire } from 'node:module';
|
|
22
|
+
import { lstatSync } from 'node:fs';
|
|
23
|
+
const argPaths = process.argv.slice(2).filter((a) => !a.startsWith('--'));
|
|
24
|
+
const mdFiles = argPaths.filter((p) => {
|
|
25
|
+
try {
|
|
26
|
+
return !lstatSync(p).isSymbolicLink();
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Deleted/renamed out from under us — let prettier's own scope skip it.
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
if (mdFiles.length === 0)
|
|
34
|
+
process.exit(0);
|
|
35
|
+
const prettierCli = createRequire(import.meta.url).resolve('prettier/bin/prettier.cjs');
|
|
36
|
+
const res = spawnSync(process.execPath, [prettierCli, '--write', ...mdFiles], { stdio: 'inherit' });
|
|
37
|
+
process.exit(res.status ?? 1);
|
|
38
|
+
//# sourceMappingURL=format-markdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-markdown.js","sourceRoot":"","sources":["../../src/bin/format-markdown.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;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*
|
|
6
6
|
* WHY: an oversized template/module is a signal the unit is doing work that
|
|
7
|
-
* belongs in dedicated files
|
|
8
|
-
*
|
|
7
|
+
* belongs in dedicated files — most often a SvelteKit `+page.svelte` with
|
|
8
|
+
* components defined inline that should be ripped out into their own files.
|
|
9
|
+
* Defaults to `{ glob: '*+page.svelte', maxLines: 280 }`; any glob → line
|
|
10
|
+
* budget works.
|
|
9
11
|
*
|
|
10
|
-
* No-op
|
|
12
|
+
* No-op when a repo's rules list is empty. Pass explicit paths (lefthook
|
|
11
13
|
* `{staged_files}`) to scope; a path is checked under every rule whose glob it
|
|
12
14
|
* would match via `git ls-files`.
|
|
13
15
|
*/
|
|
@@ -35,7 +37,7 @@ for (const rule of cfg.rules) {
|
|
|
35
37
|
}
|
|
36
38
|
if (offenders.length === 0)
|
|
37
39
|
process.exit(0);
|
|
38
|
-
console.error('\n✖ file(s) over line budget —
|
|
40
|
+
console.error('\n✖ file(s) over line budget — rip inline components out into their own files:\n');
|
|
39
41
|
for (const o of offenders.sort((a, b) => b.lines - a.lines))
|
|
40
42
|
console.error(` ${String(o.lines).padStart(5)}/${o.max}L ${o.path}`);
|
|
41
43
|
console.error('');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"page-size.js","sourceRoot":"","sources":["../../src/bin/page-size.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"page-size.js","sourceRoot":"","sources":["../../src/bin/page-size.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAErD,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC;AAExD,IAAI,GAAG,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;IAAE,OAAO,CAAC,IAAI,CAAC,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old: 0.8,
|
|
37
37
|
allowlist: [],
|
|
38
38
|
},
|
|
39
|
-
//
|
|
40
|
-
|
|
39
|
+
// On by default: SvelteKit pages over 280 lines should rip inline components
|
|
40
|
+
// out into their own files. The `*+page.svelte` glob is a no-op in repos with
|
|
41
|
+
// no SvelteKit pages, so this stays harmless org-wide. Override per repo.
|
|
42
|
+
pageSize: { rules: [{ glob: '*+page.svelte', maxLines: 280 }] },
|
|
41
43
|
// On by default: warn past 225 lines, block past 300 (override per repo).
|
|
42
44
|
fileSize: {
|
|
43
45
|
globs: ['apps/*.ts', 'packages/*.ts'],
|
package/dist/lib/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAwGnC,MAAM,CAAC,MAAM,QAAQ,GAAW;IAC/B,SAAS,EAAE;QACV,QAAQ,EAAE,GAAG;QACb,SAAS,EAAE,IAAI;QACf,OAAO,EAAE,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,CAAC;QAC7E,SAAS,EAAE,EAAE;KACb;IACD,OAAO,EAAE;QACR,KAAK,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;QACrC,SAAS,EAAE,EAAE;KACb;IACD,WAAW,EAAE;QACZ,KAAK,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;QACrC,SAAS,EAAE,EAAE;KACb;IACD,gBAAgB,EAAE;QACjB,KAAK,EAAE,CAAC,WAAW,EAAE,eAAe,CAAC;QACrC,IAAI,EAAE,CAAC,QAAQ,CAAC;QAChB,YAAY,EA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;KACnC,CAAC;AACH,CAAC"}
|
package/lefthook.checks.yml
CHANGED
|
@@ -26,6 +26,17 @@
|
|
|
26
26
|
# `node_modules/.bin/nodeve-check-doc-tokens --report`.
|
|
27
27
|
pre-commit:
|
|
28
28
|
jobs:
|
|
29
|
+
# Fixer, runs before the `checks` group so the gates see formatted, re-staged
|
|
30
|
+
# content. Prettier-formats staged markdown in place; `stage_fixed` re-adds
|
|
31
|
+
# whatever it touched. The bin bundles its own prettier (portable across pnpm
|
|
32
|
+
# and bun, needs nothing on PATH) and honors the repo's prettier config and
|
|
33
|
+
# `.prettierignore`. It skips symlinked docs itself, so no `file_types` filter
|
|
34
|
+
# is needed here.
|
|
35
|
+
- name: format-markdown
|
|
36
|
+
glob: "*.md"
|
|
37
|
+
run: node_modules/.bin/nodeve-format-markdown {staged_files}
|
|
38
|
+
stage_fixed: true
|
|
39
|
+
|
|
29
40
|
- name: checks
|
|
30
41
|
group:
|
|
31
42
|
parallel: true
|
package/nodeve.checks.example.js
CHANGED
|
@@ -19,9 +19,14 @@ export default {
|
|
|
19
19
|
},
|
|
20
20
|
},
|
|
21
21
|
|
|
22
|
-
//
|
|
22
|
+
// Per-glob page-size budget (default ON: `*+page.svelte` >280 lines → rip
|
|
23
|
+
// inline components out into their own files). This array REPLACES the
|
|
24
|
+
// default, so restate the SvelteKit rule if you only mean to add others:
|
|
23
25
|
pageSize: {
|
|
24
|
-
rules: [
|
|
26
|
+
rules: [
|
|
27
|
+
{ glob: '*+page.svelte', maxLines: 280 },
|
|
28
|
+
{ glob: '*+layout.svelte', maxLines: 200 },
|
|
29
|
+
],
|
|
25
30
|
},
|
|
26
31
|
|
|
27
32
|
// TS line budget (default ON: warn >225, fail >300 across apps/ + packages/).
|
package/package.json
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nodeve/checks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Org-wide commit-gate checks (doc budgets, reshape/dup/helper smells, page size) and helper-index generators, driven by a per-repo config file and wired through lefthook.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/nodeve-com/nodeve.git",
|
|
9
|
+
"directory": "packages/checks"
|
|
10
|
+
},
|
|
5
11
|
"type": "module",
|
|
6
12
|
"publishConfig": {
|
|
7
13
|
"access": "public"
|
|
@@ -27,15 +33,17 @@
|
|
|
27
33
|
"nodeve-check-file-size": "./dist/bin/file-size.js",
|
|
28
34
|
"nodeve-check-catalog": "./dist/bin/catalog.js",
|
|
29
35
|
"nodeve-check-require-deps": "./dist/bin/require-deps.js",
|
|
36
|
+
"nodeve-format-markdown": "./dist/bin/format-markdown.js",
|
|
30
37
|
"nodeve-build-lib-names": "./dist/bin/build-lib-names.js",
|
|
31
38
|
"nodeve-build-helper-manifest": "./dist/bin/build-helper-manifest.js"
|
|
32
39
|
},
|
|
33
40
|
"dependencies": {
|
|
34
41
|
"js-tiktoken": "^1.0.0",
|
|
42
|
+
"prettier": "^3.0.0",
|
|
35
43
|
"remeda": "^2.0.0",
|
|
36
44
|
"typescript": "^5.5.0",
|
|
37
45
|
"yaml": "^2.5.0",
|
|
38
|
-
"@nodeve/text": "
|
|
46
|
+
"@nodeve/text": "2.0.0"
|
|
39
47
|
},
|
|
40
48
|
"devDependencies": {
|
|
41
49
|
"@types/node": "^22.0.0",
|