@jpeakai/prose-gates 0.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/LICENSE +21 -0
- package/README.md +62 -0
- package/dist/bin.js +11008 -0
- package/dist/index.js +11015 -0
- package/package.json +59 -0
- package/src/bin.ts +10 -0
- package/src/check.ts +24 -0
- package/src/cli.ts +82 -0
- package/src/fix/engine.ts +84 -0
- package/src/fix/promote.ts +107 -0
- package/src/fix/spans.ts +75 -0
- package/src/fix/verify.ts +134 -0
- package/src/index.ts +10 -0
- package/src/model.ts +165 -0
- package/src/rules/index.ts +21 -0
- package/src/rules/interpunct.ts +19 -0
- package/src/rules/pg001-wrap.ts +79 -0
- package/src/rules/pg002-length.ts +44 -0
- package/src/rules/pg003-semicolon-list.ts +68 -0
- package/src/rules/pg004-em-dash.ts +117 -0
- package/src/rules/pg005-interpunct.ts +43 -0
- package/src/rules/pg006-interpunct-run.ts +84 -0
- package/src/rules/pg007-inline-enum.ts +119 -0
- package/src/rules/pg008-labelled-run.ts +94 -0
- package/src/rules/pg009-stacked-runs.ts +79 -0
- package/src/rules/types.ts +77 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Josh Peak
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# jpai-prose-gates
|
|
2
|
+
|
|
3
|
+
Deterministic prose gates for markdown documentation.
|
|
4
|
+
Extracted from the `gooddocs` agent skill so the same rules run in CI, not only when an agent is asked.
|
|
5
|
+
Incubated in the [`jpai-library`](https://github.com/jpeakai/jpai-library) domain.
|
|
6
|
+
|
|
7
|
+
## Usage
|
|
8
|
+
|
|
9
|
+
It runs under Bun or Node 20 and later, from the npm registry.
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
bunx @jpeakai/prose-gates README.md docs/*.md # report findings, exit 1 if any
|
|
13
|
+
npx -y @jpeakai/prose-gates --fix README.md # apply every fix proven safe, report the rest
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Installed as a dev dependency, the command is `prose-gates`, and `--json` gives machine-readable output.
|
|
17
|
+
|
|
18
|
+
`--max-words N` changes the sentence budget, which defaults to 25.
|
|
19
|
+
Exit codes are 0 for clean, 1 for findings, and 2 for a usage error.
|
|
20
|
+
|
|
21
|
+
## The rules
|
|
22
|
+
|
|
23
|
+
Nine rules in three categories.
|
|
24
|
+
[RULES.md](RULES.md) shows a failing example and the fix for each one.
|
|
25
|
+
|
|
26
|
+
| Category | Rules | What it guards |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Sentence | PG001, PG002 | How a sentence is laid out and how long it runs |
|
|
29
|
+
| List | PG003, PG006, PG007, PG008, PG009 | A list hidden in running prose, promoted to a real markdown list |
|
|
30
|
+
| Punctuation | PG004, PG005 | A glyph that reads as generated text |
|
|
31
|
+
|
|
32
|
+
Every fix is verified before it is written.
|
|
33
|
+
A fix that would change a word, url or code value is a bug and fails the run.
|
|
34
|
+
A case the fixer cannot read unambiguously is refused, so the finding stays for a human.
|
|
35
|
+
The reasoning behind each choice is recorded in [`adrs/`](adrs/index.md).
|
|
36
|
+
|
|
37
|
+
Code blocks are exempt.
|
|
38
|
+
Fences tagged `markdown` or `md` are the exception, since they hold templates whose body is audited recursively.
|
|
39
|
+
|
|
40
|
+
## Consuming it
|
|
41
|
+
|
|
42
|
+
Each meta repo declares this package and runs it through a `docs-ci` target.
|
|
43
|
+
|
|
44
|
+
```sh
|
|
45
|
+
bun add --dev @jpeakai/prose-gates
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
npm works the same way, with `npm install --save-dev @jpeakai/prose-gates`.
|
|
49
|
+
The library exports `checkMarkdown` and `fixMarkdown`.
|
|
50
|
+
Bun imports the TypeScript source, and Node imports the bundle in `dist/`.
|
|
51
|
+
|
|
52
|
+
Generated markdown is gated too.
|
|
53
|
+
A finding there is traced back to the source that rendered it, either the record or the template, and never fixed in the output.
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for setup, the make targets and how a change is accepted.
|
|
58
|
+
Releases are covered in [docs/PUBLISHING.md](docs/PUBLISHING.md).
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT, see [LICENSE](LICENSE).
|