@nodeve/checks 1.9.0 → 2.1.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 ADDED
@@ -0,0 +1,60 @@
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.
5
+ #
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.
15
+ #
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...
22
+
23
+ StylesPath = styles
24
+ Packages = write-good, proselint
25
+
26
+ [*.md]
27
+ BasedOnStyles = nodeve, write-good, proselint
28
+
29
+ # BLOCK on fat. Vale fails a commit ONLY on `error`; warning/suggestion are
30
+ # advisory. Wordy phrases + weasel/filler words, plus the copula-padding the
31
+ # telegraphic house style strips: passive voice and existential "there is/are".
32
+ write-good.TooWordy = error
33
+ write-good.Weasel = error
34
+ write-good.Passive = error
35
+ write-good.ThereIs = error
36
+ proselint.Very = error
37
+
38
+ # Hedging: proselint's vague-language weasels + nodeve's deferred-decision hedges
39
+ # ("if wanted") — punting a call the doc should make.
40
+ proselint.Hedging = error
41
+ nodeve.Hedging = error
42
+
43
+ # Ephemeral state: words framing the doc's moment as transient ("uncommitted",
44
+ # "this session"). Docs persist past commit — these go stale on land.
45
+ nodeve.Ephemeral = error
46
+
47
+ # Narration: prose addressing a PRIOR version ("used to", "no longer", "RESOLVED",
48
+ # "correction:"). A doc is read fresh — history the reader never saw.
49
+ nodeve.Narration = error
50
+
51
+ # ADVISORY (shown, non-blocking).
52
+ nodeve.SentenceLength = warning
53
+ proselint.Cliches = warning
54
+ proselint.Annotations = warning
55
+
56
+ # OFF — false positives on technical docs: E-Prime flags every "to be" verb; So
57
+ # bans sentence-initial "So"; Typography rewrites hex like 0x1510 to the × symbol.
58
+ write-good.E-Prime = NO
59
+ write-good.So = NO
60
+ proselint.Typography = NO
package/README.md CHANGED
@@ -102,11 +102,15 @@ A reinvention often borrows a _different_ library's name, which shares no tokens
102
102
 
103
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
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
+
105
109
  ## Fixers
106
110
 
107
111
  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.
108
112
 
109
- - `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.
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.
110
114
 
111
115
  ### Running ad hoc
112
116
 
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/bin/format.ts"],"names":[],"mappings":""}
@@ -1,9 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Commit fixer: prettier-format staged markdown in place, so docs land formatted
3
+ * Commit fixer: prettier-format staged files in place, so they land formatted
4
4
  * without a manual `prettier --write`. Wired in the shared lefthook config with
5
5
  * `stage_fixed: true`, which re-stages whatever this touches.
6
6
  *
7
+ * Scope is the lefthook glob's call, not this bin's — it formats whatever paths
8
+ * it's handed. The glob must only name types prettier has a parser for: given a
9
+ * path it can't infer a parser for, prettier errors rather than skipping.
10
+ *
7
11
  * WHY a bin instead of `bunx prettier --write` in the hook: the rest of the
8
12
  * shared config shells `node_modules/.bin/nodeve-*` so it's portable across pnpm
9
13
  * and bun and needs nothing on PATH. `bunx` needs Bun, and under pnpm's strict
@@ -14,14 +18,14 @@
14
18
  * The bundled prettier still honors the consumer's `.prettierrc`/`.prettierignore`
15
19
  * and plugins: prettier resolves both relative to each file, not to this bin.
16
20
  *
17
- * Skips symlinked docs (e.g. CLAUDE.md → README.md): prettier errors on a symlink
21
+ * Skips symlinks (e.g. CLAUDE.md → README.md): prettier errors on a symlink
18
22
  * path, and the real target is formatted via its own staged entry anyway.
19
23
  */
20
24
  import { spawnSync } from 'node:child_process';
21
25
  import { createRequire } from 'node:module';
22
26
  import { lstatSync } from 'node:fs';
23
27
  const argPaths = process.argv.slice(2).filter((a) => !a.startsWith('--'));
24
- const mdFiles = argPaths.filter((p) => {
28
+ const files = argPaths.filter((p) => {
25
29
  try {
26
30
  return !lstatSync(p).isSymbolicLink();
27
31
  }
@@ -30,9 +34,9 @@ const mdFiles = argPaths.filter((p) => {
30
34
  return false;
31
35
  }
32
36
  });
33
- if (mdFiles.length === 0)
37
+ if (files.length === 0)
34
38
  process.exit(0);
35
39
  const prettierCli = createRequire(import.meta.url).resolve('prettier/bin/prettier.cjs');
36
- const res = spawnSync(process.execPath, [prettierCli, '--write', ...mdFiles], { stdio: 'inherit' });
40
+ const res = spawnSync(process.execPath, [prettierCli, '--write', ...files], { stdio: 'inherit' });
37
41
  process.exit(res.status ?? 1);
38
- //# sourceMappingURL=format-markdown.js.map
42
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/bin/format.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAE1E,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;IACnC,IAAI,CAAC;QACJ,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,wEAAwE;QACxE,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC,CAAC;AAEH,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;IAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAExC,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACxF,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAElG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
@@ -33,14 +33,20 @@
33
33
  pre-commit:
34
34
  jobs:
35
35
  # Fixer, runs before the `checks` group so the gates see formatted, re-staged
36
- # content. Prettier-formats staged markdown in place; `stage_fixed` re-adds
36
+ # content. Prettier-formats staged files in place; `stage_fixed` re-adds
37
37
  # whatever it touched. The bin bundles its own prettier (portable across pnpm
38
38
  # and bun, needs nothing on PATH) and honors the repo's prettier config and
39
- # `.prettierignore`. It skips symlinked docs itself, so no `file_types` filter
40
- # is needed here.
41
- - name: format-markdown
42
- glob: '*.md'
43
- run: node_modules/.bin/nodeve-format-markdown {staged_files}
39
+ # `.prettierignore`. It skips symlinks itself, so no `file_types` filter is
40
+ # needed here.
41
+ #
42
+ # The glob covers code as well as docs: `eslint-config-prettier` turns OFF every
43
+ # stylistic eslint rule, so with markdown-only formatting nothing in the gate
44
+ # judged code formatting at all. It must only name types prettier has a parser
45
+ # for — prettier errors on a path it can't infer one for. Repos exclude paths
46
+ # via `.prettierignore` (machine output, vendored code), not by narrowing this.
47
+ - name: format
48
+ glob: '*.{md,ts,tsx,js,jsx,mjs,cjs,mts,cts,svelte,json,jsonc,css,html,yml,yaml}'
49
+ run: node_modules/.bin/nodeve-format {staged_files}
44
50
  stage_fixed: true
45
51
 
46
52
  - name: checks
@@ -51,6 +57,22 @@ pre-commit:
51
57
  glob: '*.md'
52
58
  run: node_modules/.bin/nodeve-check doc-tokens {staged_files}
53
59
 
60
+ # Prose gate — the OTHER engine. Not a `nodeve-check` bin: it's the `vale`
61
+ # binary (from the repo's nix devShell, NOT node_modules) reading the
62
+ # repo's `.vale.ini`, which pulls the org house rules from
63
+ # `node_modules/@nodeve/checks` via `Packages` + `vale sync`. Guarded so
64
+ # the shared config is safe in a repo that hasn't opted into prose yet:
65
+ # runs only when `vale` is on PATH AND a `.vale.ini` exists, else skips.
66
+ # When it runs, vale exits nonzero on `error`-level alerts and blocks;
67
+ # warning/suggestion are advisory. Opt in: add a `.vale.ini` (copy the
68
+ # block in @nodeve/checks/.vale.ini) and run `vale sync` once per clone.
69
+ - name: vale
70
+ glob: '*.md'
71
+ run: |
72
+ if command -v vale >/dev/null 2>&1 && test -f .vale.ini; then
73
+ vale {staged_files} || { echo "↑ You touched these docs, so you own their prose errors — clear ALL of them (not just your edit). Tune severity in .vale.ini if a rule is wrong."; exit 1; }
74
+ fi
75
+
54
76
  - name: reshape
55
77
  glob: '*.ts'
56
78
  run: node_modules/.bin/nodeve-check reshape {staged_files}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nodeve/checks",
3
- "version": "1.9.0",
3
+ "version": "2.1.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
5
  "license": "MIT",
6
6
  "repository": {
@@ -15,7 +15,9 @@
15
15
  "files": [
16
16
  "dist",
17
17
  "lefthook.checks.yml",
18
- "nodeve.checks.defaults.js"
18
+ "nodeve.checks.defaults.js",
19
+ ".vale.ini",
20
+ "styles"
19
21
  ],
20
22
  "exports": {
21
23
  "./config": {
@@ -26,7 +28,8 @@
26
28
  "types": "./dist/lib/defaults.d.ts",
27
29
  "default": "./dist/lib/defaults.js"
28
30
  },
29
- "./lefthook": "./lefthook.checks.yml"
31
+ "./lefthook": "./lefthook.checks.yml",
32
+ "./vale": "./.vale.ini"
30
33
  },
31
34
  "bin": {
32
35
  "nodeve-check": "./dist/bin/check.js",
@@ -42,7 +45,7 @@
42
45
  "nodeve-check-catalog": "./dist/bin/catalog.js",
43
46
  "nodeve-check-require-deps": "./dist/bin/require-deps.js",
44
47
  "nodeve-check-require-eslint": "./dist/bin/require-eslint.js",
45
- "nodeve-format-markdown": "./dist/bin/format-markdown.js",
48
+ "nodeve-format": "./dist/bin/format.js",
46
49
  "nodeve-build-lib-names": "./dist/bin/build-lib-names.js",
47
50
  "nodeve-build-helper-manifest": "./dist/bin/build-helper-manifest.js"
48
51
  },
@@ -61,7 +64,7 @@
61
64
  "devDependencies": {
62
65
  "@types/node": "^24.0.0",
63
66
  "@types/pluralize": "^0.0.33",
64
- "@nodeve/config": "0.4.1"
67
+ "@nodeve/config": "0.5.1"
65
68
  },
66
69
  "scripts": {
67
70
  "build": "tsc -p tsconfig.json && cp dist/lib/defaults.js nodeve.checks.defaults.js",
@@ -0,0 +1,16 @@
1
+ # Flag ephemeral-state language in docs. Docs are written BEFORE a commit but
2
+ # PERSIST after it — so any word framing the doc's moment as transient goes stale
3
+ # the instant it lands. "Uncommitted" describes a git state that ends at commit;
4
+ # "this session" names a working context that's gone by the next reader. Neither
5
+ # has a referent in a saved doc. State the durable fact, not the moment you wrote it.
6
+ extends: existence
7
+ message: "'%s' is transient — docs persist; state durable facts."
8
+ ignorecase: true
9
+ level: error
10
+ nonword: true
11
+ tokens:
12
+ - '\buncommitted\b'
13
+ - '\bthis session\b'
14
+ - '\bHandoff \b'
15
+ - '\bunblocked\b'
16
+ - '\bnext step\b'
@@ -0,0 +1,39 @@
1
+ # Flag deferred-decision hedges — phrases that punt a call the doc should MAKE.
2
+ # "Rebuild the pipeline if wanted" leaves the reader to decide whether it's wanted;
3
+ # either commit ("Rebuild the pipeline") or drop it. This is distinct from
4
+ # proselint.Hedging (vague-language weasels like "so to speak") — this rule targets
5
+ # optionality that defers a design decision. ADD phrases below; keep them anchored
6
+ # so legitimate conditional prose ("if needed for X") still reads.
7
+ extends: existence
8
+ message: "'%s' defers a decision — make the call (commit or cut) before commit."
9
+ ignorecase: true
10
+ level: error
11
+ nonword: true
12
+ # Optionality of any form. "if you want per-group albums, do X" is still a deferred
13
+ # call — say who the feature is for and commit, don't offload the choice to the
14
+ # reader. Both dangling ("do X if wanted") and object ("if you want X") forms fire.
15
+ tokens:
16
+ - '\bif wanted\b'
17
+ - '\bif desired\b'
18
+ - '\bas (wanted|desired)\b'
19
+ - '\b(if|as|when) (you )?(want|like|prefer|wish)\b'
20
+ - '\bif (you )?feel like it\b'
21
+ - '\bif that(''s| is) (wanted|desired|preferred)\b'
22
+ # Epistemic / vagueness hedges — soften a claim the doc should state plainly.
23
+ # ("completely" is left to write-good.Weasel to avoid a double-flag.)
24
+ - '\bappears to be\b'
25
+ - '\bseems to\b'
26
+ - '\bprobably\b'
27
+ - '\bbasically\b'
28
+ - '\bessentially\b'
29
+ - '\btotally\b'
30
+ - '\bsomewhat\b'
31
+ - '\bmight possibly\b'
32
+ - '\barguably\b'
33
+ - '\blikely\b'
34
+ - '\bin general\b'
35
+ - '\bgenerally speaking\b'
36
+ # Minimizing "just get" — the diminutive "just" plus a limp "get" softens the
37
+ # statement ("changes just get a version bump" → "changes get a version bump").
38
+ # State the action plainly; drop the "just".
39
+ - '\bjust gets?\b'
@@ -0,0 +1,30 @@
1
+ # Flag narration of a PRIOR version — prose that talks to the doc's own edit
2
+ # history instead of stating the current fact. A doc is read fresh, current-
3
+ # version-only: the reader never saw the copy you're correcting, so "this used to
4
+ # …", "no longer …", "RESOLVED", "revised — …", "correction:" inform nobody, turn
5
+ # a spec into a changelog, and cost tokens for zero present-tense content. Git
6
+ # holds the history; the doc holds the state. Rewrite to the bare fact. Distinct
7
+ # from Familiar.Ephemeral (transient-MOMENT words) — this targets backward-looking
8
+ # CORRECTION. Keep tokens anchored so legitimate present-tense use survives (a DNS
9
+ # name that "resolved", a promise that "resolves").
10
+ extends: existence
11
+ message: "'%s' narrates a past version — state the current fact; git holds the history."
12
+ ignorecase: true
13
+ level: error
14
+ nonword: true
15
+ tokens:
16
+ # Backward-reference: the sentence points at an earlier state the reader can't see.
17
+ - '\bno longer\b'
18
+ - '\bused to\b'
19
+ - '\bpreviously\b'
20
+ - '\bwas previously\b'
21
+ - '\bformerly\b'
22
+ - '\bre-?named from\b'
23
+ - '\bwas re-?named\b'
24
+ - '\bas (noted|mentioned) (above|earlier|before)\b'
25
+ # Status / revision markers — meta-commentary on the doc's own resolution.
26
+ - '\bcorrection:'
27
+ - '\bnow resolved\b'
28
+ - '\bnot open\b'
29
+ - '\((revised|resolved|updated|corrected)\b'
30
+ - '\b(revised|resolved) —'
@@ -0,0 +1,10 @@
1
+ # Flag over-long sentences — a telegraphic style keeps them short. Fires when a
2
+ # sentence exceeds `max` words. RAISE `max` if this is too aggressive on design
3
+ # prose, or lower it to tighten. Set level to suggestion to make it advisory.
4
+ extends: occurrence
5
+ message: 'Sentence is long (over 30 words) — split it or cut fat.'
6
+ level: error
7
+ # Match a run of non-terminal chars ending in sentence punctuation.
8
+ scope: sentence
9
+ token: '\b(\w+)\b'
10
+ max: 30
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
3
- //# sourceMappingURL=format-markdown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-markdown.d.ts","sourceRoot":"","sources":["../../src/bin/format-markdown.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"format-markdown.js","sourceRoot":"","sources":["../../src/bin/format-markdown.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAE1E,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;IACrC,IAAI,CAAC;QACJ,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,cAAc,EAAE,CAAC;IACvC,CAAC;IAAC,MAAM,CAAC;QACR,wEAAwE;QACxE,OAAO,KAAK,CAAC;IACd,CAAC;AACF,CAAC,CAAC,CAAC;AAEH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;IAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,2BAA2B,CAAC,CAAC;AACxF,MAAM,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAEpG,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}