@nodeve/checks 2.0.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,6 +102,10 @@ 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.
@@ -57,6 +57,22 @@ pre-commit:
57
57
  glob: '*.md'
58
58
  run: node_modules/.bin/nodeve-check doc-tokens {staged_files}
59
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
+
60
76
  - name: reshape
61
77
  glob: '*.ts'
62
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": "2.0.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",
@@ -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.5.0"
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