tersely 0.0.1__tar.gz
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.
- tersely-0.0.1/.gitignore +4 -0
- tersely-0.0.1/LICENSE +21 -0
- tersely-0.0.1/LICENSES/MIT.txt +21 -0
- tersely-0.0.1/NOTICE +32 -0
- tersely-0.0.1/PKG-INFO +345 -0
- tersely-0.0.1/README.md +319 -0
- tersely-0.0.1/REUSE.toml +32 -0
- tersely-0.0.1/ai/agents/comment-reviewer.md +20 -0
- tersely-0.0.1/ai/skills/tersely/SKILL.md +181 -0
- tersely-0.0.1/pyproject.toml +67 -0
- tersely-0.0.1/ruff.toml +8 -0
- tersely-0.0.1/scripts/sync-agents.py +131 -0
- tersely-0.0.1/src/tersely/__init__.py +2 -0
- tersely-0.0.1/src/tersely/cli.py +644 -0
- tersely-0.0.1/src/tersely/lint_comments.py +820 -0
- tersely-0.0.1/tersely.toml +14 -0
- tersely-0.0.1/tests/cases.json +247 -0
- tersely-0.0.1/tests/run_tests.py +98 -0
- tersely-0.0.1/tests/test_tersely.py +730 -0
- tersely-0.0.1/vale/Tersely/Ambiguity.yml +16 -0
- tersely-0.0.1/vale/Tersely/Anthropomorphism.yml +21 -0
- tersely-0.0.1/vale/Tersely/Assistant.yml +21 -0
- tersely-0.0.1/vale/Tersely/British.yml +11 -0
- tersely-0.0.1/vale/Tersely/Ceremony.yml +32 -0
- tersely-0.0.1/vale/Tersely/Contractions.yml +14 -0
- tersely-0.0.1/vale/Tersely/EmDash.yml +8 -0
- tersely-0.0.1/vale/Tersely/EmptyQualifiers.yml +21 -0
- tersely-0.0.1/vale/Tersely/Headers.yml +22 -0
- tersely-0.0.1/vale/Tersely/Hedging.yml +24 -0
- tersely-0.0.1/vale/Tersely/Metaphor.yml +48 -0
- tersely-0.0.1/vale/Tersely/Modals.yml +14 -0
- tersely-0.0.1/vale/Tersely/NegativeParallelism.yml +22 -0
- tersely-0.0.1/vale/Tersely/Overused.yml +47 -0
- tersely-0.0.1/vale/Tersely/PassiveVoice.yml +14 -0
- tersely-0.0.1/vale/Tersely/PhrasalVerbs.yml +113 -0
- tersely-0.0.1/vale/Tersely/RestatesCode.yml +24 -0
- tersely-0.0.1/vale/Tersely/SelfPraise.yml +24 -0
- tersely-0.0.1/vale/Tersely/Semicolon.yml +9 -0
- tersely-0.0.1/vale/Tersely/SentenceLength.yml +8 -0
- tersely-0.0.1/vale/Tersely/Transitions.yml +13 -0
- tersely-0.0.1/vale/Tersely/Tricolon.yml +13 -0
- tersely-0.0.1/vale/Tersely/VagueReasons.yml +19 -0
- tersely-0.0.1/vale/Tersely/Vocabulary.yml +48 -0
tersely-0.0.1/.gitignore
ADDED
tersely-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lynth-KR
|
|
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.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lynth-KR
|
|
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.
|
tersely-0.0.1/NOTICE
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Third-Party Notices
|
|
2
|
+
|
|
3
|
+
This project includes and derives rules from:
|
|
4
|
+
|
|
5
|
+
- vale-llm-slop (https://github.com/Syntaf/vale-llm-slop)
|
|
6
|
+
Copyright (c) 2026 Grant Mercer
|
|
7
|
+
License: MIT License
|
|
8
|
+
|
|
9
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
10
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
11
|
+
in the Software without restriction, including without limitation the rights
|
|
12
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
13
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
14
|
+
furnished to do so, subject to the following conditions:
|
|
15
|
+
|
|
16
|
+
The above copyright notice and this permission notice shall be included in all
|
|
17
|
+
copies or substantial portions of the Software.
|
|
18
|
+
|
|
19
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
20
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
21
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
23
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
24
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
25
|
+
SOFTWARE.
|
|
26
|
+
|
|
27
|
+
The artwork in assets/ and .claude-plugin/icon.png uses glyph outlines of:
|
|
28
|
+
|
|
29
|
+
- Imbue (https://github.com/Etcetera-Type-Co/Imbue)
|
|
30
|
+
Copyright 2020 The Imbue Project Authors
|
|
31
|
+
License: SIL Open Font License, Version 1.1
|
|
32
|
+
The artwork holds no font file.
|
tersely-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: tersely
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Terse, unambiguous English for technical docs and code comments: Vale rules, tree-sitter comment linter, and agent skills.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Lynth-KR/tersely
|
|
6
|
+
Project-URL: Repository, https://github.com/Lynth-KR/tersely
|
|
7
|
+
Project-URL: Issues, https://github.com/Lynth-KR/tersely/issues
|
|
8
|
+
Author-email: Lynth-KR <70673809+Lynth-KR@users.noreply.github.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
License-File: LICENSES/MIT.txt
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
22
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Requires-Dist: tree-sitter-language-pack>=0.7.0
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
|
|
27
|
+
<h1>
|
|
28
|
+
<picture>
|
|
29
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/Lynth-KR/tersely/main/assets/banner-dark.svg">
|
|
30
|
+
<img alt="Tersely." src="https://raw.githubusercontent.com/Lynth-KR/tersely/main/assets/banner-light.svg">
|
|
31
|
+
</picture>
|
|
32
|
+
</h1>
|
|
33
|
+
|
|
34
|
+
Tersely checks technical English for terse, unambiguous text in documents, code comments and commit messages.
|
|
35
|
+
It has five parts:
|
|
36
|
+
|
|
37
|
+
- **Vale rules** (`vale/Tersely/`): 24 rules for modal verbs, phrasal verbs, passive voice, contractions, ambiguity, American spelling, and the habits of generated text.
|
|
38
|
+
- **Structural comment linter** (`src/tersely/lint_comments.py`): checks the comments of source files for the rules that a program can check.
|
|
39
|
+
Its rules:
|
|
40
|
+
- One sentence per line, 120 columns, and 25 words per sentence at most.
|
|
41
|
+
- ASCII, American spelling, no semicolons, and no modal verb but `can`, `will` and `must`.
|
|
42
|
+
- No banner, no commented-out code, and a reason for each linter exception.
|
|
43
|
+
- A C++ comment on lines of its own uses `//`.
|
|
44
|
+
The rule covers the C++ file types, and a `.h` file counts as C.
|
|
45
|
+
- **Skill and reviewer** (`ai/`): the skill tells an agent to audit the comments that it writes.
|
|
46
|
+
The reviewer subagent `comment-reviewer` checks the form of a batch of comments.
|
|
47
|
+
- **Stop hook**: when a Claude Code turn ends, it runs the structural linter.
|
|
48
|
+
- **`tersely check-msg`**: checks a commit message with the Vale rules.
|
|
49
|
+
|
|
50
|
+
## Requirements
|
|
51
|
+
|
|
52
|
+
- Python 3.11 or later.
|
|
53
|
+
- `uv`, for `uvx tersely` and for the Stop hook, which runs `uvx`.
|
|
54
|
+
- git.
|
|
55
|
+
The structural linter works only in a git repository.
|
|
56
|
+
`check-msg` also uses `git interpret-trailers` to find trailers.
|
|
57
|
+
- Vale, on `PATH` or in the cache of Tersely.
|
|
58
|
+
`tersely vale sync` downloads Vale 3.29.0 into `~/.cache/tersely/vale/3.29.0` and checks its SHA-256.
|
|
59
|
+
If `vale` is on `PATH`, it does nothing.
|
|
60
|
+
|
|
61
|
+
## Which setup to use
|
|
62
|
+
|
|
63
|
+
| You want | Use |
|
|
64
|
+
|---|---|
|
|
65
|
+
| The skill, the reviewer and the Stop hook in Claude Code, with no file in your project | [Claude Code plugin](#claude-code-plugin) |
|
|
66
|
+
| The same files copied into your project, or the skill and the reviewer for Codex or Antigravity | [`tersely init`](#tersely-init) |
|
|
67
|
+
| A check on each commit | [pre-commit](#pre-commit) |
|
|
68
|
+
| A check on each pull request | [GitHub Action](#github-action) |
|
|
69
|
+
| The Vale rules in your own Vale setup | [Vale only](#vale-only) |
|
|
70
|
+
| A check that you run by hand | [CLI](#cli) |
|
|
71
|
+
|
|
72
|
+
## Setups
|
|
73
|
+
|
|
74
|
+
### Claude Code plugin
|
|
75
|
+
|
|
76
|
+
Install the plugin from the marketplace in this repository:
|
|
77
|
+
|
|
78
|
+
```text
|
|
79
|
+
/plugin marketplace add Lynth-KR/tersely
|
|
80
|
+
/plugin install tersely@tersely
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Claude Code 2.1.275 and later also install in one step:
|
|
84
|
+
|
|
85
|
+
```text
|
|
86
|
+
/plugin install tersely --marketplace Lynth-KR/tersely
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The plugin provides the skill `tersely:tersely`, the reviewer subagent `tersely:comment-reviewer`, and the Stop hook.
|
|
90
|
+
After `tersely init`, the reviewer is `comment-reviewer`, with no prefix.
|
|
91
|
+
The Stop hook comes from the plugin or from `tersely init`.
|
|
92
|
+
Use one of them, because both run the same hook.
|
|
93
|
+
|
|
94
|
+
### tersely init
|
|
95
|
+
|
|
96
|
+
`tersely init` copies the skill, the reviewer and `.vale.ini` into the current project:
|
|
97
|
+
|
|
98
|
+
```sh
|
|
99
|
+
uvx tersely init --agent claude
|
|
100
|
+
uvx tersely init --agent codex
|
|
101
|
+
uvx tersely init --agent antigravity
|
|
102
|
+
uvx tersely init --agent all
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
- `--agent claude` writes `.claude/skills/tersely/SKILL.md` and `.claude/agents/comment-reviewer.md`, and adds the Stop hook to `.claude/settings.json`.
|
|
106
|
+
- `--agent codex` writes `.agents/skills/tersely/SKILL.md` and `.codex/agents/comment-reviewer.toml`.
|
|
107
|
+
Codex reads skills from `.agents/skills/` and custom subagents from `.codex/agents/`.
|
|
108
|
+
Codex reads `.codex/agents/` only in a project that you trust.
|
|
109
|
+
The file of a Codex subagent cannot make the agent read-only, so the instructions of the reviewer forbid edits.
|
|
110
|
+
- `--agent antigravity` writes `.agents/skills/tersely/SKILL.md` and `.agents/agents/comment-reviewer.md`.
|
|
111
|
+
Antigravity reads both from `.agents/`.
|
|
112
|
+
The reviewer uses the model of the main session (`model: inherit`).
|
|
113
|
+
- `--agent all` writes all of these files.
|
|
114
|
+
Codex and Antigravity share the skill file, so `init` writes it once.
|
|
115
|
+
- `--reviewer-model` sets the model of the reviewer.
|
|
116
|
+
The defaults are `haiku` for `claude`, `gpt-6-luna` for `codex` and `inherit` for `antigravity`.
|
|
117
|
+
The reviewer of `codex` also has the reasoning effort `low`.
|
|
118
|
+
`--reviewer-model` does not work with `--agent all`.
|
|
119
|
+
- `--no-hook` does not touch `.claude/settings.json`, and `--no-vale-ini` does not write `.vale.ini`.
|
|
120
|
+
- `init` does not overwrite a file that exists, unless you pass `--force`.
|
|
121
|
+
- `--dir` sets the project folder.
|
|
122
|
+
|
|
123
|
+
The `.vale.ini` that `init` writes loads the rules from the release package.
|
|
124
|
+
Run `uvx tersely vale sync` after `init` to download Vale and the rules.
|
|
125
|
+
|
|
126
|
+
### pre-commit
|
|
127
|
+
|
|
128
|
+
```yaml
|
|
129
|
+
repos:
|
|
130
|
+
- repo: https://github.com/Lynth-KR/tersely
|
|
131
|
+
rev: v0.0.1
|
|
132
|
+
hooks:
|
|
133
|
+
- id: lint-comments
|
|
134
|
+
- id: check-msg
|
|
135
|
+
stages: [commit-msg]
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Install both hook types:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
pre-commit install
|
|
142
|
+
pre-commit install --hook-type commit-msg
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
`lint-comments` checks every comment of the files that pre-commit passes to it.
|
|
146
|
+
`check-msg` needs Vale.
|
|
147
|
+
|
|
148
|
+
### GitHub Action
|
|
149
|
+
|
|
150
|
+
```yaml
|
|
151
|
+
- uses: Lynth-KR/tersely@v0.0.1
|
|
152
|
+
with:
|
|
153
|
+
min-alert-level: error
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The action runs `tersely lint all --all`.
|
|
157
|
+
If `vale` is not on `PATH`, it installs Vale.
|
|
158
|
+
It needs no `.vale.ini`.
|
|
159
|
+
The inputs are `min-alert-level` (default `error`), `paths` (default: the repository), `no-vale` (default `false`) and `vale-version`.
|
|
160
|
+
|
|
161
|
+
### Vale only
|
|
162
|
+
|
|
163
|
+
Add the release package to `.vale.ini` and run `vale sync`:
|
|
164
|
+
|
|
165
|
+
```ini
|
|
166
|
+
StylesPath = styles
|
|
167
|
+
MinAlertLevel = warning
|
|
168
|
+
Packages = https://github.com/Lynth-KR/tersely/releases/latest/download/Tersely.zip
|
|
169
|
+
|
|
170
|
+
[*.md]
|
|
171
|
+
BasedOnStyles = Tersely
|
|
172
|
+
|
|
173
|
+
[*.{py,rs,c,h,cpp,hpp,cc,cxx,hh,hxx,go,ts,tsx,mts,cts,js,jsx,mjs,cjs,java,kt,kts,cs,swift,scala,rb,lua}]
|
|
174
|
+
BasedOnStyles = Tersely
|
|
175
|
+
Tersely.SentenceLength = NO
|
|
176
|
+
Tersely.Semicolon = NO
|
|
177
|
+
Tersely.British = NO
|
|
178
|
+
Tersely.Modals = NO
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
The section for code files disables `SentenceLength`, `Semicolon`, `British` and `Modals`.
|
|
182
|
+
The structural comment linter checks the same four rules in comments.
|
|
183
|
+
|
|
184
|
+
### CLI
|
|
185
|
+
|
|
186
|
+
```sh
|
|
187
|
+
uvx tersely vale sync
|
|
188
|
+
uvx tersely lint comments --all
|
|
189
|
+
uvx tersely lint vale
|
|
190
|
+
uvx tersely lint all --all
|
|
191
|
+
uvx tersely check-msg .git/COMMIT_EDITMSG
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
- `lint comments` checks the lines that the change adds between `HEAD` and the working tree.
|
|
195
|
+
`--all` checks every comment of the tracked and new files, or of the paths that you name.
|
|
196
|
+
`--base REF` checks the change since the merge base with `REF`.
|
|
197
|
+
`--exclude GLOB` excludes files.
|
|
198
|
+
If it finds a problem, it prints one finding per line to stderr and exits 1.
|
|
199
|
+
Outside a git repository, it exits 2.
|
|
200
|
+
- `lint vale` runs Vale on the paths that you name, or on the current folder.
|
|
201
|
+
If `.vale.ini` in the current folder names `Tersely`, Vale uses it.
|
|
202
|
+
Otherwise, Tersely uses its own rules with the level `error`.
|
|
203
|
+
`--min-alert-level suggestion|warning|error` sets the level.
|
|
204
|
+
- `lint all` runs both.
|
|
205
|
+
`--no-vale` skips Vale.
|
|
206
|
+
If no Vale is available, `lint all` prints a note and runs only the comment linter.
|
|
207
|
+
`check` is another name for `lint all`.
|
|
208
|
+
- `vale sync` finds or downloads Vale.
|
|
209
|
+
If `.vale.ini` exists in the current folder, it also runs `vale sync` to download the packages.
|
|
210
|
+
`--force` downloads Vale again.
|
|
211
|
+
- `check-msg` checks a commit message file with the Vale rules.
|
|
212
|
+
It ignores lines that start with `#`, the text after a scissors line, and a type prefix such as `fix:` on the first line.
|
|
213
|
+
In the last paragraph, it skips a line if git reports the line as a trailer and the key is in the list below.
|
|
214
|
+
The rules check a line such as `Reason: this should never happen.`, because `Reason` is not in the list.
|
|
215
|
+
|
|
216
|
+
The list of trailer keys has these entries:
|
|
217
|
+
|
|
218
|
+
- Each key that ends in `-by`, such as `Signed-off-by` or `Co-authored-by`.
|
|
219
|
+
- These keys: `Change-Id`, `Fixes`, `Closes`, `Resolves`, `Refs`, `See-also`, `Cc`, `Bug`, `Link`, `Issue` and `Ticket`.
|
|
220
|
+
- The keys in `[tool.tersely] trailers` (see [Configuration](#configuration)).
|
|
221
|
+
|
|
222
|
+
Outside a repository, or without `pyproject.toml`, only the first two entries apply.
|
|
223
|
+
|
|
224
|
+
## Configuration
|
|
225
|
+
|
|
226
|
+
Write the settings in `pyproject.toml` at the root of the repository:
|
|
227
|
+
|
|
228
|
+
```toml
|
|
229
|
+
[tool.tersely]
|
|
230
|
+
exclude = ["vendor/*", "*.generated.py"]
|
|
231
|
+
trailers = ["Jira", "Reviewed-on"]
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
- `exclude` is a list of globs for the structural comment linter.
|
|
235
|
+
A glob matches the path from the repository root, and `*` also matches `/`.
|
|
236
|
+
These globs add to each `--exclude` glob.
|
|
237
|
+
- `trailers` is a list of trailer keys that `check-msg` does not check.
|
|
238
|
+
The comparison ignores case.
|
|
239
|
+
- A missing file, table or key adds nothing.
|
|
240
|
+
A value that is not a list of strings is an error.
|
|
241
|
+
|
|
242
|
+
To disable one Vale rule, set it to `NO` in `.vale.ini`:
|
|
243
|
+
|
|
244
|
+
```ini
|
|
245
|
+
[*.md]
|
|
246
|
+
BasedOnStyles = Tersely
|
|
247
|
+
Tersely.Hedging = NO
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## Vale rules
|
|
251
|
+
|
|
252
|
+
Vale shows a finding only at the level `MinAlertLevel` or above.
|
|
253
|
+
|
|
254
|
+
| Rule | Level | Flags |
|
|
255
|
+
|---|---|---|
|
|
256
|
+
| `Ambiguity` | error | `and/or`, `etc.`, `e.g.`, `i.e.`, `and so on`, and `if necessary` |
|
|
257
|
+
| `Anthropomorphism` | suggestion | Code with intentions, such as `wants to` and `knows about` |
|
|
258
|
+
| `Assistant` | error | Chat-assistant voice, such as `I hope this helps` |
|
|
259
|
+
| `British` | error | British spelling, such as `colour`, `centre` and `analyse` |
|
|
260
|
+
| `Ceremony` | suggestion | Frames before the point, such as `Note that` and `Under the hood` |
|
|
261
|
+
| `Contractions` | error | Contractions, such as `don't`, `it's` and `we're`. A possessive `'s` is not a contraction |
|
|
262
|
+
| `EmDash` | error | The em dash |
|
|
263
|
+
| `EmptyQualifiers` | error | Adjectives that narrow nothing, such as `the appropriate handler` and `as needed` |
|
|
264
|
+
| `Headers` | suggestion | Headings of a template, such as `Understanding ...` and `Key Takeaways` |
|
|
265
|
+
| `Hedging` | suggestion | Hedges, such as `arguably` and `in most cases` |
|
|
266
|
+
| `Metaphor` | error | Analogy in place of mechanism, such as `acts as a`, `think of this as` and `akin to` |
|
|
267
|
+
| `Modals` | error | `should`, `would`, `may`, `might`, `could` and `shall` |
|
|
268
|
+
| `NegativeParallelism` | error | The pattern `It is not just X, it is Y` |
|
|
269
|
+
| `Overused` | suggestion | Words that generated text overuses, such as `robust`, `seamless` and `comprehensive` |
|
|
270
|
+
| `PassiveVoice` | warning | A be-verb followed by a past participle |
|
|
271
|
+
| `PhrasalVerbs` | error | Idiomatic phrasal verbs, such as `leave out` and `set up`. The rule file names the verb to use |
|
|
272
|
+
| `RestatesCode` | error | Comments that repeat the code, such as `This function returns` and `Loop through the` |
|
|
273
|
+
| `SelfPraise` | error | Comments that rate the code, such as `for readability` and `gracefully` |
|
|
274
|
+
| `Semicolon` | error | The semicolon |
|
|
275
|
+
| `SentenceLength` | error | A sentence of more than 25 words |
|
|
276
|
+
| `Transitions` | suggestion | Stock connectives, such as `Moreover,` and `Ultimately,` |
|
|
277
|
+
| `Tricolon` | suggestion | Three adverbs or three comparatives in a row |
|
|
278
|
+
| `VagueReasons` | error | A reason without the reason, such as `for various reasons` and `this is by design` |
|
|
279
|
+
| `Vocabulary` | error | Phrases that mark generated text, such as `delve`, `tapestry` and `in conclusion` |
|
|
280
|
+
|
|
281
|
+
## What a finding looks like
|
|
282
|
+
|
|
283
|
+
The structural linter prints `path:line: message` for each finding:
|
|
284
|
+
|
|
285
|
+
```text
|
|
286
|
+
demo.py:2: a semicolon: write two sentences
|
|
287
|
+
demo.py:2: the British spelling "colour"
|
|
288
|
+
demo.py:2: the modal verb "may": use can, will or must
|
|
289
|
+
demo.py:2: two sentences on one line: start the second on a line of its own
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Vale prints the position, the level, the message and the rule:
|
|
293
|
+
|
|
294
|
+
```text
|
|
295
|
+
demo.md
|
|
296
|
+
1:3 suggestion Templated header: 'Understanding the cache'. Say what the section actually covers. Tersely.Headers
|
|
297
|
+
3:14 suggestion Overused in generated prose: 'robust'. Is it earning its place? Tersely.Overused
|
|
298
|
+
3:25 error The modal verb 'might': use can, will or must. Tersely.Modals
|
|
299
|
+
3:31 warning STE: passive voice. Name the agent and use the active voice. Tersely.PassiveVoice
|
|
300
|
+
3:57 warning STE: passive voice. Name the agent and use the active voice. Tersely.PassiveVoice
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## The Stop hook and the reviewer
|
|
304
|
+
|
|
305
|
+
When a turn ends, the Stop hook runs `uvx tersely@<version> lint comments --hook claude`.
|
|
306
|
+
It needs `uv` on `PATH`.
|
|
307
|
+
|
|
308
|
+
- The hook checks the comments that the change adds.
|
|
309
|
+
If a comment breaks a rule, the hook prints the findings and exits 2, and Claude Code asks Claude to fix them.
|
|
310
|
+
- A loop guard stops a fix loop that a false finding causes.
|
|
311
|
+
If Claude Code reports that the hook already ran in this turn, and the findings equal those of the last run, the hook exits 0.
|
|
312
|
+
The hook keeps the last findings in the file `tersely-comments-hook` in the git directory.
|
|
313
|
+
- Outside a git repository, the hook exits 0 and prints nothing.
|
|
314
|
+
- `tersely init` merges the hook into `.claude/settings.json`.
|
|
315
|
+
If the file is missing, `init` creates it.
|
|
316
|
+
`init` keeps every other key and hook, and the indent of the file.
|
|
317
|
+
If the same command is already there, `init` adds no hook.
|
|
318
|
+
If the file holds a Tersely hook of another version, `init` replaces its command with the current one.
|
|
319
|
+
If the file is not valid JSON, `init` does not change it and exits with an error.
|
|
320
|
+
|
|
321
|
+
The skill has the agent write comments freely, then audit each comment that it touched, and then call the reviewer.
|
|
322
|
+
If no `comment-reviewer` subagent exists, the skill tells the agent to do a second full pass itself.
|
|
323
|
+
The reviewer checks the form of the comments that the prompt gives it.
|
|
324
|
+
If the prompt lacks the code that it needs, it reads a file.
|
|
325
|
+
It never edits a file.
|
|
326
|
+
It does not find a comment that only repeats its code, so the main model judges that.
|
|
327
|
+
|
|
328
|
+
## Local development
|
|
329
|
+
|
|
330
|
+
Edit `ai/` for the skill and the reviewer, and `tersely.toml` to choose the platforms and the reviewer models.
|
|
331
|
+
Then generate the copies, `hooks/hooks.json` and the version in `.claude-plugin/plugin.json`:
|
|
332
|
+
|
|
333
|
+
```sh
|
|
334
|
+
python3 scripts/sync-agents.py
|
|
335
|
+
python3 scripts/sync-agents.py --check
|
|
336
|
+
python3 -m unittest discover -s tests -v
|
|
337
|
+
python3 tests/run_tests.py
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Check Tersely with its own rules:
|
|
341
|
+
|
|
342
|
+
```sh
|
|
343
|
+
tersely lint comments --all src scripts tests vale
|
|
344
|
+
tersely lint vale README.md
|
|
345
|
+
```
|