@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.
Files changed (97) hide show
  1. package/.vale.ini +22 -23
  2. package/README.md +29 -79
  3. package/dist/bin/prose.d.ts +3 -0
  4. package/dist/bin/prose.d.ts.map +1 -0
  5. package/dist/bin/prose.js +27 -0
  6. package/dist/bin/prose.js.map +1 -0
  7. package/dist/checks/catalog.d.ts.map +1 -1
  8. package/dist/checks/catalog.js +0 -2
  9. package/dist/checks/catalog.js.map +1 -1
  10. package/dist/checks/clones.d.ts.map +1 -1
  11. package/dist/checks/clones.js +1 -2
  12. package/dist/checks/clones.js.map +1 -1
  13. package/dist/checks/doc-tokens.d.ts +4 -3
  14. package/dist/checks/doc-tokens.d.ts.map +1 -1
  15. package/dist/checks/doc-tokens.js +12 -9
  16. package/dist/checks/doc-tokens.js.map +1 -1
  17. package/dist/checks/file-size.d.ts.map +1 -1
  18. package/dist/checks/file-size.js +2 -3
  19. package/dist/checks/file-size.js.map +1 -1
  20. package/dist/checks/helper-collisions.js +4 -4
  21. package/dist/checks/helper-collisions.js.map +1 -1
  22. package/dist/checks/inline-dupes.d.ts.map +1 -1
  23. package/dist/checks/inline-dupes.js +30 -17
  24. package/dist/checks/inline-dupes.js.map +1 -1
  25. package/dist/checks/page-size.js +1 -1
  26. package/dist/checks/page-size.js.map +1 -1
  27. package/dist/checks/plural-arrays.d.ts.map +1 -1
  28. package/dist/checks/plural-arrays.js +29 -24
  29. package/dist/checks/plural-arrays.js.map +1 -1
  30. package/dist/checks/require-deps.d.ts.map +1 -1
  31. package/dist/checks/require-deps.js +1 -3
  32. package/dist/checks/require-deps.js.map +1 -1
  33. package/dist/checks/reshape.js +3 -3
  34. package/dist/checks/reshape.js.map +1 -1
  35. package/dist/lib/config.d.ts +4 -0
  36. package/dist/lib/config.d.ts.map +1 -1
  37. package/dist/lib/config.js.map +1 -1
  38. package/dist/lib/defaults.d.ts +10 -1
  39. package/dist/lib/defaults.d.ts.map +1 -1
  40. package/dist/lib/defaults.js +44 -7
  41. package/dist/lib/defaults.js.map +1 -1
  42. package/dist/lib/length.d.ts.map +1 -1
  43. package/dist/lib/length.js +10 -2
  44. package/dist/lib/length.js.map +1 -1
  45. package/dist/lib/repo.d.ts +5 -0
  46. package/dist/lib/repo.d.ts.map +1 -1
  47. package/dist/lib/repo.js +9 -2
  48. package/dist/lib/repo.js.map +1 -1
  49. package/lefthook.checks.yml +63 -13
  50. package/nodeve.checks.defaults.js +44 -7
  51. package/package.json +6 -3
  52. package/styles/nodeve/Filler.yml +26 -0
  53. package/styles/nodeve/SentenceLength.yml +18 -2
  54. package/styles/proselint/Airlinese.yml +8 -0
  55. package/styles/proselint/AnimalLabels.yml +48 -0
  56. package/styles/proselint/Annotations.yml +9 -0
  57. package/styles/proselint/Apologizing.yml +8 -0
  58. package/styles/proselint/Archaisms.yml +52 -0
  59. package/styles/proselint/But.yml +8 -0
  60. package/styles/proselint/Cliches.yml +782 -0
  61. package/styles/proselint/CorporateSpeak.yml +30 -0
  62. package/styles/proselint/Currency.yml +5 -0
  63. package/styles/proselint/Cursing.yml +15 -0
  64. package/styles/proselint/DateCase.yml +7 -0
  65. package/styles/proselint/DateMidnight.yml +7 -0
  66. package/styles/proselint/DateRedundancy.yml +10 -0
  67. package/styles/proselint/DateSpacing.yml +7 -0
  68. package/styles/proselint/DenizenLabels.yml +52 -0
  69. package/styles/proselint/Diacritical.yml +95 -0
  70. package/styles/proselint/GenderBias.yml +45 -0
  71. package/styles/proselint/GroupTerms.yml +39 -0
  72. package/styles/proselint/Hedging.yml +8 -0
  73. package/styles/proselint/Hyperbole.yml +6 -0
  74. package/styles/proselint/Jargon.yml +11 -0
  75. package/styles/proselint/LGBTOffensive.yml +13 -0
  76. package/styles/proselint/LGBTTerms.yml +15 -0
  77. package/styles/proselint/Malapropisms.yml +8 -0
  78. package/styles/proselint/Needless.yml +358 -0
  79. package/styles/proselint/Nonwords.yml +38 -0
  80. package/styles/proselint/Oxymorons.yml +22 -0
  81. package/styles/proselint/P-Value.yml +6 -0
  82. package/styles/proselint/RASSyndrome.yml +30 -0
  83. package/styles/proselint/Skunked.yml +13 -0
  84. package/styles/proselint/Spelling.yml +17 -0
  85. package/styles/proselint/Typography.yml +11 -0
  86. package/styles/proselint/Uncomparables.yml +50 -0
  87. package/styles/proselint/Very.yml +6 -0
  88. package/styles/proselint/meta.json +15 -0
  89. package/styles/write-good/Cliches.yml +702 -0
  90. package/styles/write-good/E-Prime.yml +32 -0
  91. package/styles/write-good/Illusions.yml +11 -0
  92. package/styles/write-good/Passive.yml +183 -0
  93. package/styles/write-good/So.yml +5 -0
  94. package/styles/write-good/ThereIs.yml +6 -0
  95. package/styles/write-good/TooWordy.yml +221 -0
  96. package/styles/write-good/Weasel.yml +29 -0
  97. 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), and
2
- # the canonical severity wiring. The TS checks run through `nodeve-check`; prose
3
- # runs through the `vale` binary. Both are the commit gate; this file is the Vale
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
- # TWO jobs:
7
- # 1. As a Vale PACKAGE: a consumer lists this dir in its own `Packages`, and
8
- # `vale sync` copies `styles/nodeve/` into the consumer's StylesPath. The
9
- # rule LOGIC (the `styles/nodeve/*.yml` files) is versioned here, one source
10
- # for every repo — bump @nodeve/checks to change a rule everywhere.
11
- # 2. As the REFERENCE config: Vale does not inherit a package's severity block
12
- # into the consumer's run (a `.vale.ini` `[*.md]` section is per-repo), so a
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
- # Consumer `.vale.ini` (see README "Prose gate"):
17
- # StylesPath = styles
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
- # ADVISORY (shown, non-blocking).
52
- nodeve.SentenceLength = warning
53
- proselint.Cliches = warning
54
- proselint.Annotations = warning
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 — so it behaves the same 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 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 # run the whole pre-commit suite, summary-first
9
- nodeve-check file-size # run one check (paths/flags after the name)
10
- nodeve-check file-size --explain # show its full remediation prose
11
- nodeve-check list # list the check names
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** — `<glyph> <name> — <summary>`, indented detail rows, and the check's remediation guidance — so the parallel gate's failure output is scannable rather than a wall of per-check formats. `--explain` expands each check's bulky per-finding detail inline (clones code fragments, inline-dupes file lists), which is otherwise summarized. A bare `nodeve-check` prints a status line per check, a tally, then a detail block for each that failed or warned.
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
- Then activate hooks once per clone with `lefthook install` (familiar/nodeve do this from their `prepare` script).
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 `nodeve.checks.js` in the exact shape your config takes — so it doubles as the reference for every section and its default value. Omitted keys fall back to those defaults (deep-merged; arrays replace wholesale). It's importable too: `import DEFAULTS from '@nodeve/checks/defaults'`.
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 (`CLAUDE.md`, `guide/`, `docs/`) |
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 if the jscpd binary isn't installed) |
45
- | `page-size` | files over a per-glob line budget | on (`*+page.svelte` >280; no-op where the glob matches nothing) |
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 (set `requireEslint: { enforce: false }` to opt out) |
50
- | `commit-msg` | commit message off Conventional Commits, or a sizeable change with no body | on (`commit-msg` hook; body required past 50 changed lines) |
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
- `page-size` is the opt-in member: its default `globs` is empty, so only files a configured override glob matches get a budget. `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.
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
- `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) across every installed manifest — each workspace package **and the root `package.json`** — must reference `catalog:` rather than a literal pin. Opt a repo out deliberately with `catalog: { enforce: false }`.
58
+ ## Prose gate (Vale)
73
59
 
74
- `plural-arrays` reads a count-plural variable name as a promise of a list, and fails when the binding provably isn't one — an object literal, `new Map()`, a `Record<…>`/index-signature type, or an `Object.fromEntries()`-style builder. A `Set` is left alone on purpose: it's array-like (ordered, iterable, spreads to an array with `[...set]`), so a plural name over it reads fine. It only flags what it can prove from the declaration's type or initializer; a plural bound to an array, a `.map()` chain, an opaque call, or nothing is left alone. [`pluralize`](https://www.npmjs.com/package/pluralize) decides what reads as plural (so `status`, irregulars like `children`/`people`, and `xById`/`xMap`/`xToY` names are handled), and two word lists correct its domain misses — `plural` forces a word to count (`plural: ['props']`), `singular` exempts an `-s` noun it over-counts (seeded with `data`, `metadata`, `series`, `news`):
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
- ```js
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
- `helper-collisions` compares local helper declarations to dependency function exports in `.nodeve/lib-names.json`. Some libraries expose generic function names whose domain is implied by the package name, such as `date-fns.format`; configure `helperCollisions.libKeywords` to also match each real export with those domain words appended/prepended:
64
+ Run the rules ad hoc with **`nodeve-prose`** — one jumpable error per line, no `--config`:
87
65
 
88
- ```js
89
- export default {
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 docs, code, and config in place, so they 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 symlinks (e.g. `CLAUDE.md` → `README.md`), which prettier can't format and which get formatted via their real target's own staged entry. Exclude machine output and vendored code with `.prettierignore` — the lefthook glob stays wide.
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 that `helper-collisions` matches against (regenerate after dependency bumps). The index is committed so the gate never needs the libs installed at check time.
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 is needed.
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,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=prose.d.ts.map
@@ -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;AAqE9C,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,SAAS,CA+BpC,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"}
@@ -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,EAAE,kBAAkB,EAAE,MAAM,gB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AG,aAAa,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;QAEjE,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC;YACpB,OAAO;gBACN,MAAM,EAAE,MAAM;gBACd,OAAO,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,CAoDlC,CAAC"}
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"}
@@ -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, or narrow scope with clones.ignore globs.
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,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
  * Commit gate: guarded markdown over its line or token budget.
3
3
  *
4
- * WHY: always-loaded / frequently-linked docs cost tokens and attention, so both
5
- * dimensions are bounded. Tokenizer is js-tiktoken `o200k_base` — Claude's is
6
- * unpublished and differs, so this is a stable *proxy* for budgeting, not an
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;;;;;;;;;GASG;AACH,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAG9C,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,WAAW,CA4BxC,CAAC"}
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: always-loaded / frequently-linked docs cost tokens and attention, so both
5
- * dimensions are bounded. Tokenizer is js-tiktoken `o200k_base` — Claude's is
6
- * unpublished and differs, so this is a stable *proxy* for budgeting, not an
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: `Guarded markdown (CLAUDE.md, READMEs, guide/, docs/) has line and token
17
- budgets so always-loaded docs stay terse. Past the budget, don't trim to the
18
- edge — split the doc into a directory with an index page plus detail pages, then
19
- repoint inbound links at the new locations. --report lists the whole backlog
20
- without failing, so you can work it down over time rather than at commit time.`,
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 into a dir with an index`,
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;;;;;;;;;GASG;AACH,OAAO,EAAc,MAAM,kBAAkB,CAAC;AAC9C,OA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;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,CAsBtC,CAAC"}
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"}
@@ -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), give it a bigger budget or 'exempt' via
25
- fileSize.overrides in nodeve.checks.js with a WHY comment. --warn downgrades
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;;;;;;;;;qBASW;IAEpB,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"}
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
- • or allowlist it as \`relPath::local→lib\`.
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\`. --warn downgrades this to report-only.`,
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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+1 @@
1
- {"version":3,"file":"inline-dupes.d.ts","sourceRoot":"","sources":["../../src/checks/inline-dupes.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,KAAK,KAAK,EAAE,MAAM,kBAAkB,CAAC;AA8B9C,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,aAAa,CAmD5C,CAAC"}
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 (non-exported const or function) that
3
- * appears in 2+ tracked source files — a sign it should live in a shared
4
- * package and be imported instead.
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
- * Non-exported top-level names in a source file: private `const` and
17
- * `function` declarations. Exported names (SvelteKit `load`, `actions`,
18
- * HTTP verbs, etc.) are skipped — they're legitimately repeated per route.
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
- const isExported = ts.canHaveModifiers(stmt) &&
25
- (ts.getModifiers(stmt)?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword) ?? false);
26
- if (isExported)
27
- continue;
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
- • a confirmed false positive → add the bare name to inlineDupes.allowlist
48
- with a WHY comment.
49
- --warn downgrades this to report-only.`,
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();