@nodeve/checks 2.1.0 → 3.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/.vale.ini +22 -23
- package/README.md +29 -79
- package/dist/bin/prose.d.ts +3 -0
- package/dist/bin/prose.d.ts.map +1 -0
- package/dist/bin/prose.js +27 -0
- package/dist/bin/prose.js.map +1 -0
- package/dist/checks/catalog.d.ts.map +1 -1
- package/dist/checks/catalog.js +0 -2
- package/dist/checks/catalog.js.map +1 -1
- package/dist/checks/clones.d.ts.map +1 -1
- package/dist/checks/clones.js +1 -2
- package/dist/checks/clones.js.map +1 -1
- package/dist/checks/doc-tokens.d.ts +4 -3
- package/dist/checks/doc-tokens.d.ts.map +1 -1
- package/dist/checks/doc-tokens.js +12 -9
- package/dist/checks/doc-tokens.js.map +1 -1
- package/dist/checks/file-size.d.ts.map +1 -1
- package/dist/checks/file-size.js +2 -3
- package/dist/checks/file-size.js.map +1 -1
- package/dist/checks/helper-collisions.js +4 -4
- package/dist/checks/helper-collisions.js.map +1 -1
- package/dist/checks/inline-dupes.d.ts.map +1 -1
- package/dist/checks/inline-dupes.js +30 -17
- package/dist/checks/inline-dupes.js.map +1 -1
- package/dist/checks/page-size.js +1 -1
- package/dist/checks/page-size.js.map +1 -1
- package/dist/checks/plural-arrays.d.ts.map +1 -1
- package/dist/checks/plural-arrays.js +29 -24
- package/dist/checks/plural-arrays.js.map +1 -1
- package/dist/checks/require-deps.d.ts.map +1 -1
- package/dist/checks/require-deps.js +1 -3
- package/dist/checks/require-deps.js.map +1 -1
- package/dist/checks/reshape.js +3 -3
- package/dist/checks/reshape.js.map +1 -1
- package/dist/lib/config.d.ts +4 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/defaults.d.ts +10 -1
- package/dist/lib/defaults.d.ts.map +1 -1
- package/dist/lib/defaults.js +44 -7
- package/dist/lib/defaults.js.map +1 -1
- package/dist/lib/length.d.ts.map +1 -1
- package/dist/lib/length.js +10 -2
- package/dist/lib/length.js.map +1 -1
- package/dist/lib/repo.d.ts +5 -0
- package/dist/lib/repo.d.ts.map +1 -1
- package/dist/lib/repo.js +9 -2
- package/dist/lib/repo.js.map +1 -1
- package/lefthook.checks.yml +63 -13
- package/nodeve.checks.defaults.js +44 -7
- package/package.json +6 -3
- package/styles/nodeve/Filler.yml +26 -0
- package/styles/nodeve/SentenceLength.yml +18 -2
- package/styles/proselint/Airlinese.yml +8 -0
- package/styles/proselint/AnimalLabels.yml +48 -0
- package/styles/proselint/Annotations.yml +9 -0
- package/styles/proselint/Apologizing.yml +8 -0
- package/styles/proselint/Archaisms.yml +52 -0
- package/styles/proselint/But.yml +8 -0
- package/styles/proselint/Cliches.yml +782 -0
- package/styles/proselint/CorporateSpeak.yml +30 -0
- package/styles/proselint/Currency.yml +5 -0
- package/styles/proselint/Cursing.yml +15 -0
- package/styles/proselint/DateCase.yml +7 -0
- package/styles/proselint/DateMidnight.yml +7 -0
- package/styles/proselint/DateRedundancy.yml +10 -0
- package/styles/proselint/DateSpacing.yml +7 -0
- package/styles/proselint/DenizenLabels.yml +52 -0
- package/styles/proselint/Diacritical.yml +95 -0
- package/styles/proselint/GenderBias.yml +45 -0
- package/styles/proselint/GroupTerms.yml +39 -0
- package/styles/proselint/Hedging.yml +8 -0
- package/styles/proselint/Hyperbole.yml +6 -0
- package/styles/proselint/Jargon.yml +11 -0
- package/styles/proselint/LGBTOffensive.yml +13 -0
- package/styles/proselint/LGBTTerms.yml +15 -0
- package/styles/proselint/Malapropisms.yml +8 -0
- package/styles/proselint/Needless.yml +358 -0
- package/styles/proselint/Nonwords.yml +38 -0
- package/styles/proselint/Oxymorons.yml +22 -0
- package/styles/proselint/P-Value.yml +6 -0
- package/styles/proselint/RASSyndrome.yml +30 -0
- package/styles/proselint/Skunked.yml +13 -0
- package/styles/proselint/Spelling.yml +17 -0
- package/styles/proselint/Typography.yml +11 -0
- package/styles/proselint/Uncomparables.yml +50 -0
- package/styles/proselint/Very.yml +6 -0
- package/styles/proselint/meta.json +15 -0
- package/styles/write-good/Cliches.yml +702 -0
- package/styles/write-good/E-Prime.yml +32 -0
- package/styles/write-good/Illusions.yml +11 -0
- package/styles/write-good/Passive.yml +183 -0
- package/styles/write-good/So.yml +5 -0
- package/styles/write-good/ThereIs.yml +6 -0
- package/styles/write-good/TooWordy.yml +221 -0
- package/styles/write-good/Weasel.yml +29 -0
- package/styles/write-good/meta.json +4 -0
package/.vale.ini
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
|
-
# @nodeve/checks — the org's Vale house rules (the prose engine of the gate)
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
# half.
|
|
1
|
+
# @nodeve/checks — the org's Vale house rules (the prose engine of the gate). The
|
|
2
|
+
# TS checks run through `nodeve-check`; prose runs through the `vale` binary. Both
|
|
3
|
+
# are the commit gate; this file is the Vale half.
|
|
5
4
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
12
|
-
#
|
|
13
|
-
# consumer restates `BasedOnStyles` + the severities below. This file is the
|
|
14
|
-
# block to copy — the shape a repo drops at its root, kept in sync here.
|
|
5
|
+
# THIS file IS the config every repo runs — the shared lefthook `vale` job invokes
|
|
6
|
+
# `vale --config=node_modules/@nodeve/checks/.vale.ini`, so NO repo authors its own
|
|
7
|
+
# `.vale.ini`. Turning on = extending `lefthook.checks.yml`; there is no per-repo
|
|
8
|
+
# opt-in step to forget. `StylesPath` resolves relative to THIS file, so it points
|
|
9
|
+
# at the styles vendored beside it — `nodeve/` (versioned here) plus `write-good/`
|
|
10
|
+
# and `proselint/` (committed, not `vale sync`-ed at consume time). Offline, self-
|
|
11
|
+
# contained: bump @nodeve/checks to change a rule everywhere.
|
|
15
12
|
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
# Packages = write-good, proselint, node_modules/@nodeve/checks
|
|
19
|
-
# [*.md]
|
|
20
|
-
# BasedOnStyles = nodeve, write-good, proselint
|
|
21
|
-
# ...the severity lines below...
|
|
13
|
+
# `Packages` is here only so a maintainer can re-run `vale sync` to refresh the
|
|
14
|
+
# vendored third-party styles; consumers never sync.
|
|
22
15
|
|
|
23
16
|
StylesPath = styles
|
|
24
17
|
Packages = write-good, proselint
|
|
@@ -35,6 +28,10 @@ write-good.Passive = error
|
|
|
35
28
|
write-good.ThereIs = error
|
|
36
29
|
proselint.Very = error
|
|
37
30
|
|
|
31
|
+
# Filler: low-value phrases that survive TooWordy/Weasel — "in order to", "note
|
|
32
|
+
# that", "make sure to" (instruction narration). Cut, meaning survives.
|
|
33
|
+
nodeve.Filler = error
|
|
34
|
+
|
|
38
35
|
# Hedging: proselint's vague-language weasels + nodeve's deferred-decision hedges
|
|
39
36
|
# ("if wanted") — punting a call the doc should make.
|
|
40
37
|
proselint.Hedging = error
|
|
@@ -48,10 +45,12 @@ nodeve.Ephemeral = error
|
|
|
48
45
|
# "correction:"). A doc is read fresh — history the reader never saw.
|
|
49
46
|
nodeve.Narration = error
|
|
50
47
|
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
48
|
+
# Every rule BLOCKS. A warning is a rule nobody obeys — if it's worth flagging it's
|
|
49
|
+
# worth failing, else cut it. Long sentences, clichés, and leftover TODO/FIXME
|
|
50
|
+
# markers all fail the gate like the rest.
|
|
51
|
+
nodeve.SentenceLength = error
|
|
52
|
+
proselint.Cliches = error
|
|
53
|
+
proselint.Annotations = error
|
|
55
54
|
|
|
56
55
|
# OFF — false positives on technical docs: E-Prime flags every "to be" verb; So
|
|
57
56
|
# bans sentence-initial "So"; Typography rewrites hex like 0x1510 to the × symbol.
|
package/README.md
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
# @nodeve/checks
|
|
2
2
|
|
|
3
|
-
Org-wide commit-gate checks and helper-index generators, shared across nodeve repos. Each check reads an optional per-repo `nodeve.checks.js` and derives the repo root from git
|
|
3
|
+
Org-wide commit-gate checks and helper-index generators, shared across nodeve repos. Each check reads an optional per-repo `nodeve.checks.js` and derives the repo root from git, so it behaves the same from any directory the hook runner uses. Wiring goes through lefthook.
|
|
4
4
|
|
|
5
5
|
All checks run through one dispatcher, **`nodeve-check`**:
|
|
6
6
|
|
|
7
7
|
```sh
|
|
8
|
-
nodeve-check
|
|
9
|
-
nodeve-check file-size
|
|
10
|
-
nodeve-check file-size --explain #
|
|
11
|
-
nodeve-check list
|
|
8
|
+
nodeve-check # whole pre-commit suite, summary-first
|
|
9
|
+
nodeve-check file-size # one check (paths/flags after the name)
|
|
10
|
+
nodeve-check file-size --explain # its full remediation prose
|
|
11
|
+
nodeve-check list # the check names
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
Every check renders the **same uniform block
|
|
14
|
+
Every check renders the **same uniform block**: `<glyph> <name> — <summary>`, indented detail rows, remediation guidance. So the parallel gate's failures scan cleanly, not a wall of per-check formats.
|
|
15
|
+
|
|
16
|
+
Flags on every blocking check: `--warn` (report-only, exit 0) and `--explain` (remediation prose plus bulky per-finding detail). `doc-tokens` adds `--report`, the whole backlog without failing. Explicit paths scope a run; lefthook passes `{staged_files}`.
|
|
17
|
+
|
|
18
|
+
It's a **bin**, not a package script, so `pnpm run` won't find it — reach it through `pnpm exec nodeve-check …` (Bun repos: `bunx`). Quote globs so your shell leaves them for the check. Day to day lefthook runs the suite on commit.
|
|
15
19
|
|
|
16
20
|
## Install
|
|
17
21
|
|
|
@@ -26,109 +30,55 @@ extends:
|
|
|
26
30
|
- node_modules/@nodeve/checks/lefthook.checks.yml
|
|
27
31
|
```
|
|
28
32
|
|
|
29
|
-
|
|
33
|
+
Activate hooks once per clone with `lefthook install` (familiar/nodeve do this from `prepare`).
|
|
30
34
|
|
|
31
35
|
## Configure
|
|
32
36
|
|
|
33
|
-
Copy `node_modules/@nodeve/checks/nodeve.checks.defaults.js` to your repo root as `nodeve.checks.js` and keep ONLY the keys you change. That file is the org defaults verbatim — a valid
|
|
37
|
+
Copy `node_modules/@nodeve/checks/nodeve.checks.defaults.js` to your repo root as `nodeve.checks.js` and keep ONLY the keys you change. That file is the org defaults verbatim — a valid config in the exact shape yours takes — so it doubles as the reference for every section. Omitted keys fall back (deep-merged; arrays replace wholesale). Importable too: `import DEFAULTS from '@nodeve/checks/defaults'`.
|
|
34
38
|
|
|
35
39
|
## Checks
|
|
36
40
|
|
|
37
41
|
| Check | What it gates | Default |
|
|
38
|
-
|
|
|
39
|
-
| `doc-tokens` | markdown over a line/token budget | on (
|
|
42
|
+
| - | - | - |
|
|
43
|
+
| `doc-tokens` | markdown over a line/token budget | on (every tracked `.md`; an index gets half the tokens) |
|
|
40
44
|
| `reshape` | callbacks that reproduce their input shape (no-op / pick / clone) | on (`apps/`, `packages/`) |
|
|
41
45
|
| `plural-arrays` | count-plural names bound to a map/object instead of an array | on (`apps/`, `packages/`) |
|
|
42
46
|
| `inline-dupes` | non-exported top-level names declared in 2+ files | on (`apps/`, `packages/`) |
|
|
43
47
|
| `helper-collisions` | local helpers that fuzzily match a dependency export | on (needs lib-names index) |
|
|
44
|
-
| `clones` | structural copy-paste (duplicated code blocks) via jscpd v5 | on (`apps/`, `packages/`; no-op
|
|
45
|
-
| `page-size` | files over a per-glob line budget | on (`*+page.svelte` >280; no-op where
|
|
48
|
+
| `clones` | structural copy-paste (duplicated code blocks) via jscpd v5 | on (`apps/`, `packages/`; no-op without the jscpd binary) |
|
|
49
|
+
| `page-size` | files over a per-glob line budget | on (`*+page.svelte` >280; no-op where nothing matches) |
|
|
46
50
|
| `file-size` | TS sources over a line budget (warn >225, fail >300) | on (`apps/`, `packages/`) |
|
|
47
51
|
| `catalog` | dependency versions not single-sourced from a workspace catalog | on (a workspace must declare a catalog) |
|
|
48
52
|
| `require-deps` | org-required deps missing from the workspace catalog | on (`remeda`; set `deps: []` to opt out) |
|
|
49
|
-
| `require-eslint` | repo ships no root eslint flat config (eslint is org-mandatory) | on (
|
|
50
|
-
| `commit-msg` | commit message off Conventional Commits, or a sizeable change
|
|
51
|
-
|
|
52
|
-
Run any of them as `nodeve-check <name>`. Each also has a standalone `nodeve-check-<name>` bin (identical behavior) for direct invocation.
|
|
53
|
-
|
|
54
|
-
`commit-msg` is the one gate that runs on the `commit-msg` hook rather than `pre-commit`: lefthook hands it the message file (`{1}`). It validates the header against Conventional Commits — `<type>(<scope>)!: <subject>`, where `type` must be one of `commitMsg.types` (the standard set) and the subject stays under `maxSubjectLength`. Past `commitMsg.bodyRequiredOverLines` changed lines — measured from the **staged** diff, not the commit type — a body becomes mandatory, because at that size the subject alone can't carry the "why". Merge, revert, and `fixup!`/`squash!`/`amend!` messages are skipped (git or rebase owns those). Set `commitMsg: { enforce: false }` to opt out, or `requireScope: true` to also mandate a scope.
|
|
55
|
-
|
|
56
|
-
`doc-tokens`, `page-size` and `file-size` are one engine (`lib/length.ts`) over one config shape — scope `globs`, a default `warn` and/or `fail` tier, and per-glob `overrides`. A tier bounds `maxLines` and/or `maxTokens` (omit an axis to leave it unbounded); `fail` blocks the commit, `warn` only nudges. An override merges its tiers per-axis over the default for files matching its glob (later overrides win), or drops them with `tiers: 'exempt'` — that one mechanism covers a one-off bigger budget, a soft pre-warn, and a full exemption alike:
|
|
57
|
-
|
|
58
|
-
```js
|
|
59
|
-
export default {
|
|
60
|
-
fileSize: {
|
|
61
|
-
// long-but-cohesive CLIs get 400 lines; everything else stays at the 225/300 default
|
|
62
|
-
overrides: [{ glob: 'packages/scripts/*.ts', tiers: { fail: { maxLines: 400 } } }],
|
|
63
|
-
},
|
|
64
|
-
docTokens: {
|
|
65
|
-
overrides: [{ glob: 'packages/content/README.md', tiers: { fail: { maxLines: 200 } } }],
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
```
|
|
53
|
+
| `require-eslint` | repo ships no root eslint flat config (eslint is org-mandatory) | on (`requireEslint: { enforce: false }` opts out) |
|
|
54
|
+
| `commit-msg` | commit message off Conventional Commits, or a sizeable change lacking a body | on (`commit-msg` hook; body required past 50 changed lines) |
|
|
69
55
|
|
|
70
|
-
|
|
56
|
+
Per-check semantics, tuning, and examples: **[docs/checks.md](docs/checks.md)**. Run any as `nodeve-check <name>`; each also has a standalone `nodeve-check-<name>` bin (identical behavior) for direct invocation.
|
|
71
57
|
|
|
72
|
-
|
|
58
|
+
## Prose gate (Vale)
|
|
73
59
|
|
|
74
|
-
|
|
60
|
+
A second engine gates markdown _wording_ — [Vale](https://vale.sh) against the org house rules in `styles/nodeve/` (`Narration`, `Ephemeral`, `Hedging`, `Filler`, `SentenceLength`), an unguarded `vale` job in `lefthook.checks.yml`. ALWAYS ON: it runs the package's own `.vale.ini` with vendored styles — extending the shared config is the whole opt-in, no per-repo `.vale.ini`, no `vale sync`. Fails the commit if `vale` isn't installed. Rules: **[PROSE.md](PROSE.md)**.
|
|
75
61
|
|
|
76
|
-
|
|
77
|
-
export default {
|
|
78
|
-
pluralArrays: {
|
|
79
|
-
plural: ['props', 'attrs'], // force-count these even if pluralize disagrees
|
|
80
|
-
singular: ['data', 'series'], // never count these
|
|
81
|
-
allowlist: ['src/store.ts::sessions'], // a confirmed intentional map, as relPath::name
|
|
82
|
-
},
|
|
83
|
-
};
|
|
84
|
-
```
|
|
62
|
+
It covers every staged `.md` — the scope `doc-tokens` budgets. One contract: stage a doc, it answers to both.
|
|
85
63
|
|
|
86
|
-
|
|
64
|
+
Run the rules ad hoc with **`nodeve-prose`** — one jumpable error per line, no `--config`:
|
|
87
65
|
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
helperCollisions: {
|
|
91
|
-
libs: ['remeda', 'date-fns'],
|
|
92
|
-
libKeywords: { 'date-fns': ['Date'] },
|
|
93
|
-
},
|
|
94
|
-
};
|
|
66
|
+
```sh
|
|
67
|
+
pnpm exec nodeve-prose docs/levels.md # Bun: bunx nodeve-prose …
|
|
95
68
|
```
|
|
96
69
|
|
|
97
|
-
With that config, `formatDate` reports as a collision with `date-fns.format`, while the recommended function remains the real dependency export.
|
|
98
|
-
|
|
99
|
-
A reinvention often borrows a _different_ library's name, which shares no tokens with the blessed export — lodash's `upperFirst` is remeda's `capitalize`. `helperCollisions.aliases` maps each real export to the other names it's known by, so those still match; the defaults seed the common lodash→remeda renames (`capitalize: ['upperFirst']`, `fromEntries: ['fromPairs']`, …).
|
|
100
|
-
|
|
101
|
-
`clones` is the structural counterpart to the name-based gates: it shells [jscpd v5](https://jscpd.dev) (a fast Rust copy-paste detector) over `clones.paths` and fails on any duplicated block past `clones.minTokens`/`minLines`. It catches reuse hiding in function _bodies_ that `inline-dupes`/`helper-collisions` can't see by name. Tune `minTokens`/`threshold`, narrow with `clones.ignore` globs, or `--warn` to downgrade. jscpd's native binary is an optional dependency, so the gate cleanly no-ops where it isn't installed rather than blocking a commit.
|
|
102
|
-
|
|
103
|
-
All blocking checks accept `--warn` (report-only, exit 0) and `--explain` (expand the remediation prose under the result); `doc-tokens` accepts `--report` to list the whole backlog without failing. Pass explicit paths to scope a run (lefthook passes `{staged_files}`).
|
|
104
|
-
|
|
105
|
-
## Prose gate (Vale)
|
|
106
|
-
|
|
107
|
-
A second engine gates markdown _wording_ — [Vale](https://vale.sh) against the org house rules this package ships in `styles/nodeve/` (`Narration`, `Ephemeral`, `Hedging`, `SentenceLength`), wired through a guarded `vale` job in `lefthook.checks.yml`. Setup, the consumer `.vale.ini` block, and rule authoring: **[PROSE.md](PROSE.md)**.
|
|
108
|
-
|
|
109
70
|
## Fixers
|
|
110
71
|
|
|
111
72
|
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.
|
|
112
73
|
|
|
113
|
-
- `nodeve-format` — prettier-formats staged
|
|
114
|
-
|
|
115
|
-
### Running ad hoc
|
|
116
|
-
|
|
117
|
-
`nodeve-check` is a **bin**, not a package script, so `pnpm run` / `bun run` won't find it — those run `package.json#scripts`. Invoke it through `exec` instead, which resolves `node_modules/.bin` for you (no hardcoded path needed):
|
|
118
|
-
|
|
119
|
-
```sh
|
|
120
|
-
pnpm exec nodeve-check doc-tokens 'README.md' # or: pnpm nodeve-check doc-tokens ...
|
|
121
|
-
bunx nodeve-check doc-tokens 'README.md' # Bun repos
|
|
122
|
-
pnpm exec nodeve-check # whole suite, summary-first
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Quote globs so your shell doesn't expand them before the check sees them. Day to day you shouldn't need this — the checks run through lefthook on commit.
|
|
74
|
+
- `nodeve-format` — prettier-formats staged code and config in place. Bundles its own prettier (nothing on PATH) yet honors the repo's prettier config, `.prettierignore`, and plugins. Skips symlinks. Exclude machine output and vendored code with `.prettierignore` — the lefthook glob stays wide.
|
|
75
|
+
- `md-fmt` — formats staged markdown; `md-lint` in `checks` fails on broken links. Both from nodeve's flake `packages.md-tools`, on PATH.
|
|
126
76
|
|
|
127
77
|
## Generators
|
|
128
78
|
|
|
129
|
-
- `nodeve-build-lib-names` — writes the committed lib-names index
|
|
79
|
+
- `nodeve-build-lib-names` — writes the committed lib-names index `helper-collisions` matches against (regenerate after dependency bumps). The committed index lets the gate skip installing the libs.
|
|
130
80
|
- `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.
|
|
131
81
|
|
|
132
82
|
## Notes for Bun repos
|
|
133
83
|
|
|
134
|
-
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
|
|
84
|
+
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 needed.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.d.ts","sourceRoot":"","sources":["../../src/bin/prose.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// nodeve-prose — the ad-hoc half of the prose gate. The commit hook runs `vale`
|
|
3
|
+
// on staged docs and groups the failures; this bin runs the SAME house rules on
|
|
4
|
+
// whatever paths you pass, from any CWD, with no `--config` to remember and one
|
|
5
|
+
// error per line (`file:line:col:rule:message`) so an editor can jump to each.
|
|
6
|
+
//
|
|
7
|
+
// The config lives beside this package (`.vale.ini`, StylesPath resolves next to
|
|
8
|
+
// it), so a consumer never authors or syncs a Vale config. `vale` itself must be
|
|
9
|
+
// on PATH — it ships in the nix devShell.
|
|
10
|
+
import { spawnSync } from 'node:child_process';
|
|
11
|
+
import { dirname, join } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
const config = join(dirname(fileURLToPath(import.meta.url)), '../../.vale.ini');
|
|
14
|
+
const targets = process.argv.slice(2);
|
|
15
|
+
if (!targets.length) {
|
|
16
|
+
console.error('usage: nodeve-prose <file.md | dir> … — org prose rules, one error per line');
|
|
17
|
+
process.exit(2);
|
|
18
|
+
}
|
|
19
|
+
const r = spawnSync('vale', [`--config=${config}`, '--output=line', ...targets], {
|
|
20
|
+
stdio: 'inherit',
|
|
21
|
+
});
|
|
22
|
+
if (r.error) {
|
|
23
|
+
console.error('✖ vale not on PATH — the org prose gate needs it (nix devShell: `nix develop`).');
|
|
24
|
+
process.exit(1);
|
|
25
|
+
}
|
|
26
|
+
process.exit(r.status ?? 0);
|
|
27
|
+
//# sourceMappingURL=prose.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prose.js","sourceRoot":"","sources":["../../src/bin/prose.ts"],"names":[],"mappings":";AACA,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAChF,+EAA+E;AAC/E,EAAE;AACF,iFAAiF;AACjF,iFAAiF;AACjF,0CAA0C;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAChF,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEtC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;IACrB,OAAO,CAAC,KAAK,CAAC,8EAA8E,CAAC,CAAC;IAC9F,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC;AAED,MAAM,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,YAAY,MAAM,EAAE,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC,EAAE;IAChF,KAAK,EAAE,SAAS;CAChB,CAAC,CAAC;AACH,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC;IACb,OAAO,CAAC,KAAK,CAAC,iFAAiF,CAAC,CAAC;IACjG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACjB,CAAC;AACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/checks/catalog.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../src/checks/catalog.ts"],"names":[],"mappings":"AAwBA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAiE9C,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,SAAS,CA+BpC,CAAC"}
|
package/dist/checks/catalog.js
CHANGED
|
@@ -39,8 +39,6 @@ function missingCatalogFailure() {
|
|
|
39
39
|
'catalog. Add a `catalog:` block to pnpm-workspace.yaml (or',
|
|
40
40
|
'`workspaces.catalog` in package.json for Bun), move your versions into',
|
|
41
41
|
'it, and reference them with "catalog:".',
|
|
42
|
-
'',
|
|
43
|
-
'To deliberately opt out, set `catalog: { enforce: false }` in nodeve.checks.js.',
|
|
44
42
|
],
|
|
45
43
|
};
|
|
46
44
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/checks/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../src/checks/catalog.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAgB,aAAa,EAAkB,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEjG,MAAM,UAAU,GAAG;IAClB,cAAc;IACd,iBAAiB;IACjB,kBAAkB;IAClB,sBAAsB;CACb,CAAC;AAEX,SAAS,qBAAqB;IAC7B,OAAO;QACN,MAAM,EAAE,MAAe;QACvB,OAAO,EAAE,oCAAoC;QAC7C,IAAI,EAAE;YACL,sEAAsE;YACtE,4DAA4D;YAC5D,wEAAwE;YACxE,yCAAyC;SACzC;KACD,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,EAC1B,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,EAAE,GAMF;IACA,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,CAAC;QAClC,OAAO,GAAG,QAAQ,MAAM,IAAI,OAA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O,EAAE,0EAA0E;gBACnF,IAAI,EAAE,MAAM;aACZ,CAAC;QAEH,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;IAC7C,CAAC;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clones.d.ts","sourceRoot":"","sources":["../../src/checks/clones.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA8F9C,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,QAAQ,
|
|
1
|
+
{"version":3,"file":"clones.d.ts","sourceRoot":"","sources":["../../src/checks/clones.ts"],"names":[],"mappings":"AAoBA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA8F9C,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,QAAQ,CAmDlC,CAAC"}
|
package/dist/checks/clones.js
CHANGED
|
@@ -88,8 +88,7 @@ export const clones = {
|
|
|
88
88
|
name: 'clones',
|
|
89
89
|
section: 'clones',
|
|
90
90
|
explain: `Structural copy-paste (jscpd) flags duplicated blocks the name-based gates
|
|
91
|
-
can't see. Extract the shared logic
|
|
92
|
-
--warn downgrades the gate to report-only.`,
|
|
91
|
+
can't see. Extract the shared logic.`,
|
|
93
92
|
run({ root, cfg, explain }) {
|
|
94
93
|
const launcher = jscpdLauncher();
|
|
95
94
|
if (!launcher)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clones.js","sourceRoot":"","sources":["../../src/checks/clones.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM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C,CAAC,CAAC;QAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,GAAG,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QAEtE,oEAAoE;QACpE,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC3B,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;YACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,qCAAqC,EAAE,CAAC;QAC3E,CAAC;QAED,IAAI,CAAC;YACJ,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC;YAC1C,IAAI,CAAC,UAAU;gBACd,uEAAuE;gBACvE,yDAAyD;gBACzD,OAAO;oBACN,MAAM,EAAE,MAAM;oBACd,OAAO,EAAE,+BAA+B;oBACxC,IAAI,EAAE,aAAa,CAAC,QAAQ,CAAC;iBAC7B,CAAC;YACH,OAAO;gBACN,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,GAAG,UAAU,CAAC,MAAM,iDAAiD;gBAC9E,IAAI,EAAE,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC;aAC9C,CAAC;QACH,CAAC;gBAAS,CAAC;YACV,MAAM,CAAC,MAAM,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QAClD,CAAC;IACF,CAAC;CACD,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Commit gate: guarded markdown over its line or token budget.
|
|
3
3
|
*
|
|
4
|
-
* WHY:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* WHY: docs cost tokens and attention, so both dimensions are bounded — over the
|
|
5
|
+
* SAME scope as the prose gate (every tracked `.md`), so staging a doc means it
|
|
6
|
+
* conforms. Tokenizer is js-tiktoken `o200k_base` — Claude's is unpublished and
|
|
7
|
+
* differs, so this is a stable *proxy* for budgeting, not an
|
|
7
8
|
* exact count: good enough to catch bloat, consistent run-to-run. Measure and
|
|
8
9
|
* classify are shared with file-size and page-size in `lib/length.ts`; this check
|
|
9
10
|
* owns the markdown scope, the two-axis default, and `--report` backlog mode.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-tokens.d.ts","sourceRoot":"","sources":["../../src/checks/doc-tokens.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"doc-tokens.d.ts","sourceRoot":"","sources":["../../src/checks/doc-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG9C,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,WAAW,CA8BxC,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Commit gate: guarded markdown over its line or token budget.
|
|
3
3
|
*
|
|
4
|
-
* WHY:
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* WHY: docs cost tokens and attention, so both dimensions are bounded — over the
|
|
5
|
+
* SAME scope as the prose gate (every tracked `.md`), so staging a doc means it
|
|
6
|
+
* conforms. Tokenizer is js-tiktoken `o200k_base` — Claude's is unpublished and
|
|
7
|
+
* differs, so this is a stable *proxy* for budgeting, not an
|
|
7
8
|
* exact count: good enough to catch bloat, consistent run-to-run. Measure and
|
|
8
9
|
* classify are shared with file-size and page-size in `lib/length.ts`; this check
|
|
9
10
|
* owns the markdown scope, the two-axis default, and `--report` backlog mode.
|
|
@@ -13,11 +14,13 @@ import { gradeOffenders, lengthRow, measureBudgets } from '../lib/length.js';
|
|
|
13
14
|
export const docTokens = {
|
|
14
15
|
name: 'doc-tokens',
|
|
15
16
|
section: 'docTokens',
|
|
16
|
-
explain: `
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
explain: `Every tracked markdown file has line and token budgets, so a doc stays
|
|
18
|
+
terse whatever it's named or wherever it sits. CUT FIRST: delete what isn't
|
|
19
|
+
load-bearing, then compress what survives. The goal is fewer tokens overall, and
|
|
20
|
+
splitting adds them — a new file, a link table, and re-stated context — so it
|
|
21
|
+
only pays for an INDEX that grew: move each section out to the page that owns it
|
|
22
|
+
and leave one line per link. Trading a fat doc for a fat doc plus an index is a
|
|
23
|
+
loss. --report lists the whole backlog without failing.`,
|
|
21
24
|
run({ root, cfg, paths, report }) {
|
|
22
25
|
const offenders = measureBudgets(root, cfg, paths);
|
|
23
26
|
// `--report`: backlog mode — list every over-budget file, never fail.
|
|
@@ -31,7 +34,7 @@ without failing, so you can work it down over time rather than at commit time.`,
|
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
36
|
return gradeOffenders(offenders, {
|
|
34
|
-
fail: (n) => `${n} markdown file(s) over budget — split
|
|
37
|
+
fail: (n) => `${n} markdown file(s) over budget — cut words (split only a grown index)`,
|
|
35
38
|
warn: (n) => `${n} markdown file(s) approaching budget`,
|
|
36
39
|
pass: 'all docs within budget',
|
|
37
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doc-tokens.js","sourceRoot":"","sources":["../../src/checks/doc-tokens.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"doc-tokens.js","sourceRoot":"","sources":["../../src/checks/doc-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAE7E,MAAM,CAAC,MAAM,SAAS,GAAuB;IAC5C,IAAI,EAAE,YAAY;IAClB,OAAO,EAAE,WAAW;IACpB,OAAO,EAAE;;;;;;wDAM8C;IAEvD,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE;QAC/B,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QAEnD,sEAAsE;QACtE,IAAI,MAAM,EAAE,CAAC;YACZ,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC;gBAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC;YACtF,OAAO;gBACN,MAAM,EAAE,MAAM;gBACd,OAAO,EAAE,aAAa,SAAS,CAAC,MAAM,cAAc;gBACpD,IAAI,EAAE,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC;aAC9B,CAAC;QACH,CAAC;QAED,OAAO,cAAc,CAAC,SAAS,EAAE;YAChC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,sEAAsE;YACvF,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,sCAAsC;YACvD,IAAI,EAAE,wBAAwB;SAC9B,CAAC,CAAC;IACJ,CAAC;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-size.d.ts","sourceRoot":"","sources":["../../src/checks/file-size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG9C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,UAAU,
|
|
1
|
+
{"version":3,"file":"file-size.d.ts","sourceRoot":"","sources":["../../src/checks/file-size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG9C,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,UAAU,CAqBtC,CAAC"}
|
package/dist/checks/file-size.js
CHANGED
|
@@ -21,9 +21,8 @@ export const fileSize = {
|
|
|
21
21
|
• Group the related files in a directory, but only if the split doesn't add
|
|
22
22
|
friction at the call sites.
|
|
23
23
|
If it's genuinely one responsibility that just runs long (a schema, a lookup
|
|
24
|
-
table, a table-driven test),
|
|
25
|
-
|
|
26
|
-
this to report-only.`,
|
|
24
|
+
table, a table-driven test), stop and say so: a bigger budget is the user's
|
|
25
|
+
call, never a config edit that makes the failure go away.`,
|
|
27
26
|
run({ root, cfg, paths }) {
|
|
28
27
|
const offenders = measureBudgets(root, cfg, paths);
|
|
29
28
|
return gradeOffenders(offenders, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-size.js","sourceRoot":"","sources":["../../src/checks/file-size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,CAAC,MAAM,QAAQ,GAAsB;IAC1C,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"file-size.js","sourceRoot":"","sources":["../../src/checks/file-size.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElE,MAAM,CAAC,MAAM,QAAQ,GAAsB;IAC1C,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,UAAU;IACnB,OAAO,EAAE;;;;;;;;0DAQgD;IAEzD,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,EAAE;QACvB,MAAM,SAAS,GAAG,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QACnD,OAAO,cAAc,CAAC,SAAS,EAAE;YAChC,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,+BAA+B;YAChD,IAAI,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,8CAA8C;YAC/D,IAAI,EAAE,yBAAyB;SAC/B,CAAC,CAAC;IACJ,CAAC;CACD,CAAC"}
|
|
@@ -89,10 +89,11 @@ export is a likely reinvention of a lib function. Routing a hit is a JUDGEMENT
|
|
|
89
89
|
call — resolve per case:
|
|
90
90
|
• delete the local and import the dependency export;
|
|
91
91
|
• wrap the lib (keep a project-specific name, delegate the body);
|
|
92
|
-
• rename the local for specificity if it genuinely does something different
|
|
93
|
-
|
|
92
|
+
• or rename the local for specificity if it genuinely does something different.
|
|
93
|
+
If the check is wrong here, stop and say so: an exemption is the user's call,
|
|
94
|
+
never a config edit that makes the failure go away.
|
|
94
95
|
Matching is against the committed lib-names index (helperCollisions.libNamesPath);
|
|
95
|
-
regen with \`nodeve-build-lib-names
|
|
96
|
+
regen with \`nodeve-build-lib-names\`.`,
|
|
96
97
|
run(gate) {
|
|
97
98
|
const { root, cfg } = gate;
|
|
98
99
|
// A repo opts into this gate by listing `libs`. Once opted in, a missing
|
|
@@ -105,7 +106,6 @@ regen with \`nodeve-build-lib-names\`. --warn downgrades this to report-only.`,
|
|
|
105
106
|
rows: [
|
|
106
107
|
`libs configured: ${cfg.libs.join(', ')}`,
|
|
107
108
|
`regenerate and commit it: nodeve-build-lib-names`,
|
|
108
|
-
`or opt out by setting helperCollisions.libs: [] in nodeve.checks.js`,
|
|
109
109
|
],
|
|
110
110
|
};
|
|
111
111
|
const libIndex = loadLibIndex(root, cfg);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helper-collisions.js","sourceRoot":"","sources":["../../src/checks/helper-collisions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAA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AC;IACH,CAAC;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-dupes.d.ts","sourceRoot":"","sources":["../../src/checks/inline-dupes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"inline-dupes.d.ts","sourceRoot":"","sources":["../../src/checks/inline-dupes.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAuC9C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,aAAa,CAoD5C,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Commit gate: flag a top-level name (
|
|
3
|
-
* appears in 2+ tracked source files — a sign it should live in
|
|
4
|
-
*
|
|
2
|
+
* Commit gate: flag a top-level definition name (const, function, type, or
|
|
3
|
+
* interface) that appears in 2+ tracked source files — a sign it should live in
|
|
4
|
+
* one shared module and be imported instead. Exported names count only when
|
|
5
|
+
* `includeExported` is set (a library-only repo); otherwise private decls only.
|
|
5
6
|
*
|
|
6
7
|
* Scope: `inlineDupes.globs` (default `apps/`, `packages/`). Note this always
|
|
7
8
|
* scans the full configured scope, not just staged files — a dupe is a
|
|
@@ -13,22 +14,33 @@ import {} from '../lib/runner.js';
|
|
|
13
14
|
import { parseSource } from '../lib/ast.js';
|
|
14
15
|
import { scopedTsSources } from '../lib/bin.js';
|
|
15
16
|
/**
|
|
16
|
-
*
|
|
17
|
-
* `
|
|
18
|
-
*
|
|
17
|
+
* Top-level definition names in a source file: `const`/`function` VALUE decls
|
|
18
|
+
* and `type`/`interface` TYPE decls (a re-declared type — `Obj = Record<…>` in
|
|
19
|
+
* three files — is a second source of truth exactly like a re-declared helper).
|
|
20
|
+
* Exported names are skipped unless `includeExported` — an app repo legitimately
|
|
21
|
+
* repeats exported route handlers (`load`, `actions`, `GET`) per route; a
|
|
22
|
+
* library-only repo turns the flag on to catch exported dupes too. Re-exports
|
|
23
|
+
* (`export { X } from './y'`) are ExportDeclarations, not declarations, so a
|
|
24
|
+
* barrel re-exporting a name never counts as a second definition.
|
|
19
25
|
*/
|
|
20
|
-
function topLevelNames(absPath) {
|
|
26
|
+
function topLevelNames(absPath, includeExported) {
|
|
21
27
|
const src = parseSource(absPath);
|
|
22
28
|
const out = [];
|
|
23
29
|
for (const stmt of src.statements) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
30
|
+
if (!includeExported) {
|
|
31
|
+
const isExported = ts.canHaveModifiers(stmt) &&
|
|
32
|
+
(ts.getModifiers(stmt)?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) ?? false);
|
|
33
|
+
if (isExported)
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
28
36
|
if (ts.isFunctionDeclaration(stmt) && stmt.name)
|
|
29
37
|
out.push(stmt.name.text);
|
|
30
38
|
else if (ts.isVariableStatement(stmt))
|
|
31
39
|
out.push(...variableNames(stmt));
|
|
40
|
+
else if (ts.isTypeAliasDeclaration(stmt))
|
|
41
|
+
out.push(stmt.name.text);
|
|
42
|
+
else if (ts.isInterfaceDeclaration(stmt))
|
|
43
|
+
out.push(stmt.name.text);
|
|
32
44
|
}
|
|
33
45
|
return out;
|
|
34
46
|
}
|
|
@@ -43,17 +55,18 @@ and be imported instead. Clear it by:
|
|
|
43
55
|
• a uniform SET of names recurring together (a shared prologue, the same
|
|
44
56
|
handful of locals) → extract them into one shared module and give the
|
|
45
57
|
bundle a TS type/interface, then import it (see lib/bin.ts#Gate);
|
|
46
|
-
• a single helper duplicated → move it to a shared package and import
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
58
|
+
• a single helper duplicated → move it to a shared package and import.
|
|
59
|
+
Renaming one copy only hides the duplicate. If the check is wrong here, stop
|
|
60
|
+
and say so: an exemption is the user's call, never a config edit that makes
|
|
61
|
+
the failure go away.`,
|
|
50
62
|
run(gate) {
|
|
51
|
-
const { root, allowlist, explain } = gate;
|
|
63
|
+
const { root, allowlist, explain, cfg } = gate;
|
|
64
|
+
const includeExported = cfg.includeExported ?? false;
|
|
52
65
|
const nameToFiles = new Map();
|
|
53
66
|
// staged omitted → full scope (see header): a dupe needs both files, even if one isn't staged.
|
|
54
67
|
for (const rel of scopedTsSources(gate)) {
|
|
55
68
|
const abs = join(root, rel);
|
|
56
|
-
for (const name of topLevelNames(abs)) {
|
|
69
|
+
for (const name of topLevelNames(abs, includeExported)) {
|
|
57
70
|
if (allowlist.has(name))
|
|
58
71
|
continue;
|
|
59
72
|
const files = nameToFiles.get(name) ?? new Set();
|