prosefix 0.1.0__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.
- prosefix-0.1.0/.gitignore +5 -0
- prosefix-0.1.0/LICENSE +21 -0
- prosefix-0.1.0/PKG-INFO +132 -0
- prosefix-0.1.0/README.md +110 -0
- prosefix-0.1.0/man/prosefix.1 +513 -0
- prosefix-0.1.0/prosefix/__init__.py +3 -0
- prosefix-0.1.0/prosefix/cli.py +428 -0
- prosefix-0.1.0/prosefix/engine.py +192 -0
- prosefix-0.1.0/prosefix/jsonout.py +41 -0
- prosefix-0.1.0/prosefix/settings.py +188 -0
- prosefix-0.1.0/prosefix/tools.py +26 -0
- prosefix-0.1.0/pyproject.toml +46 -0
- prosefix-0.1.0/tests/conftest.py +17 -0
- prosefix-0.1.0/tests/test_cli.py +310 -0
- prosefix-0.1.0/tests/test_docs.py +48 -0
- prosefix-0.1.0/tests/test_engine.py +171 -0
- prosefix-0.1.0/tests/test_settings.py +148 -0
- prosefix-0.1.0/tests/vault/obsidian.md +23 -0
- prosefix-0.1.0/tests/vault/off.md +4 -0
- prosefix-0.1.0/tests/vault/plain.md +1 -0
prosefix-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrew Brož
|
|
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.
|
prosefix-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: prosefix
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Clean, consistent prose in Markdown: stylefix's spelling and style guide plus proofix's typos, punctuation and commas, in one command.
|
|
5
|
+
Project-URL: Homepage, https://github.com/AndrewBroz/prosefix
|
|
6
|
+
Project-URL: Issues, https://github.com/AndrewBroz/prosefix/issues
|
|
7
|
+
Author: Andrew Brož
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Topic :: Text Processing :: Markup :: Markdown
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Requires-Dist: adjudicate<0.4,>=0.3.1
|
|
18
|
+
Requires-Dist: proofix<0.7,>=0.6
|
|
19
|
+
Requires-Dist: pyyaml>=6
|
|
20
|
+
Requires-Dist: stylefix<0.9,>=0.8
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# prosefix
|
|
24
|
+
|
|
25
|
+
Clean, consistent prose in Markdown: stylefix's spelling and style guide plus proofix's typos, punctuation and commas, in one command.
|
|
26
|
+
|
|
27
|
+
prosefix runs two passes over each file with one model endpoint, one decision cache and one change list. The style pass (stylefix) settles one English variety and one style guide; the proof pass (proofix) fixes typos, punctuation, compounds and commas. Front matter, code, links, HTML and Obsidian syntax are never changed. Files are rewritten in place.
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Before: The colour of the "new" programme was fine, and we honour it -- really.
|
|
31
|
+
After: The color of the “new” program was fine, and we honor it—really.
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
(US target, rules only. With a model, words that depend on meaning, such as licence and license, are decided too.)
|
|
35
|
+
|
|
36
|
+
## Install
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
brew install andrewbroz/tap/prosefix # also installs Vale, LanguageTool and typos
|
|
40
|
+
uv tool install prosefix # or: pipx install prosefix
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Without Homebrew, install the tools you want. prosefix runs every tier whose requirements are met and says once, on stderr, what it skipped:
|
|
44
|
+
|
|
45
|
+
| missing | skipped | still runs |
|
|
46
|
+
|---|---|---|
|
|
47
|
+
| [Vale](https://vale.sh) (`brew install vale`) | `variety`, `guide`, `ambiguous`, `numbers` | `serial-comma`, `abbreviations`, `punctuation`, and all of the proof pass |
|
|
48
|
+
| [LanguageTool](https://languagetool.org) (`brew install languagetool`) | `mechanical`, `adjudicated` | `hygiene`, `compounds`, `commas` |
|
|
49
|
+
| [typos](https://github.com/crate-ci/typos) (`brew install typos-cli`) | `typos` | everything else |
|
|
50
|
+
| a model | decisions that need judgement, `commas` | rule-based tiers; undecided items are reported |
|
|
51
|
+
|
|
52
|
+
## First run
|
|
53
|
+
|
|
54
|
+
```sh
|
|
55
|
+
prosefix --setup # choose and test a model endpoint
|
|
56
|
+
prosefix --doctor # tools found or missing, the endpoint, the settings file for this directory
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
The endpoint comes from flags, `PROSEFIX_LLM_*` / `ADJUDICATE_LLM_*` environment variables, `~/.config/prosefix/config.toml` and `~/.config/adjudicate/config.toml`, never from a project file. Without a model, `--llm none` (or no configured endpoint) still applies all rule-based tiers.
|
|
60
|
+
|
|
61
|
+
## Use
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
prosefix note.md # rewrite one note in place
|
|
65
|
+
prosefix vault/ --diff # show what would change in a vault
|
|
66
|
+
prosefix content/ --check --llm cached # CI: fail if anything would change
|
|
67
|
+
prosefix - < in.md > out.md # filter
|
|
68
|
+
prosefix note.md --target uk --skip commas
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Directory walks take `*.md` and `*.markdown`, skipping `.git`, `.obsidian`, `node_modules`, other dot-directories and your `exclude` globs. Exit status: 0 success; 1 from `--check` (or `--strict`) when something would change; 2 for usage, configuration, input or write errors, a file that changed on disk during the run (it is left alone), or a failed `--require`. Any per-file error is reported on stderr and gives 2, but the other files are still processed.
|
|
72
|
+
|
|
73
|
+
Writes are atomic, keep the file's mode, and follow symlinks to their target; read-only files are reported and left alone.
|
|
74
|
+
|
|
75
|
+
## Obsidian
|
|
76
|
+
|
|
77
|
+
Run prosefix in place on a vault. Wikilinks and their aliases, embeds, `#tags`, `%%comments%%`, `^block-ids`, the `> [!note]` marker of a callout, maths, and Markdown code, links and HTML are never edited; quotes beside them are curled sensibly. Prose that only looks like syntax ("issue #42", "C#", "costs $5 and $10") is edited as prose.
|
|
78
|
+
|
|
79
|
+
Until the prosefix plugin exists, use the Shell Commands community plugin with:
|
|
80
|
+
|
|
81
|
+
```text
|
|
82
|
+
prosefix {{file_path:absolute}}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Publishing
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
- run: pipx install prosefix
|
|
89
|
+
- run: prosefix content/ --check --llm cached
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Commit `.prosefix/` so CI replays your decisions: `--llm cached` applies decisions already in the cache and never contacts a model. With no settings file, decisions are cached under `$XDG_CACHE_HOME/prosefix/` (default `~/.cache/prosefix/`) instead.
|
|
93
|
+
|
|
94
|
+
## Settings
|
|
95
|
+
|
|
96
|
+
prosefix looks upward from each file for `prosefix.toml`, `.prosefix.toml`, or `[tool.prosefix]` in `pyproject.toml`:
|
|
97
|
+
|
|
98
|
+
```toml
|
|
99
|
+
target = "uk" # "us" or "uk"
|
|
100
|
+
style = "oxford" # style guide
|
|
101
|
+
only = ["style", "proof"] # passes to run
|
|
102
|
+
skip = ["commas"] # tiers to skip
|
|
103
|
+
exclude = ["drafts/**", "templates/**"]
|
|
104
|
+
accept = ["Obsidian", "Zettelkasten"]
|
|
105
|
+
accept_file = ".prosefix/accept.txt"
|
|
106
|
+
cache = ".prosefix/cache.json" # comma decisions go to commas.json beside it
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
`exclude` globs are relative to the settings file; `**` crosses directories, `*` and `?` do not, and a bare directory name does not exclude its contents (write `templates/**`). `cache` and `accept_file` must stay inside the project directory.
|
|
110
|
+
|
|
111
|
+
A note can override the project in its front matter:
|
|
112
|
+
|
|
113
|
+
```yaml
|
|
114
|
+
---
|
|
115
|
+
lang: en-GB # sets the target when prosefix.target is absent
|
|
116
|
+
prosefix:
|
|
117
|
+
target: uk
|
|
118
|
+
skip: [commas]
|
|
119
|
+
---
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
or opt out with `prosefix: off`. Only `target`, `style`, `only` and `skip` are allowed there. Flags beat front matter, which beats the project file.
|
|
123
|
+
|
|
124
|
+
The tiers are `variety`, `guide`, `ambiguous`, `numbers`, `serial-comma`, `abbreviations`, `punctuation` (style) and `hygiene`, `mechanical`, `typos`, `adjudicated`, `compounds`, `commas` (proof).
|
|
125
|
+
|
|
126
|
+
## JSON
|
|
127
|
+
|
|
128
|
+
`prosefix --json` prints one document, `"schema": 1`, for editors and plugins: the endpoint, the capabilities skipped, and for each file its status, settings, a list of changes (`id`, `pass`, `check`, `start`, `end`, `line`, `before`, `after`, `reason`, `decided_by`, `confidence`, `depends_on`), review items and the full output. Offsets are UTF-16 code units into the whole original file; `line` is 1-based. A change that lists `depends_on` supersedes the changes it names. The details are in the man page (`man prosefix`, or `man/prosefix.1` in the source).
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT
|
prosefix-0.1.0/README.md
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# prosefix
|
|
2
|
+
|
|
3
|
+
Clean, consistent prose in Markdown: stylefix's spelling and style guide plus proofix's typos, punctuation and commas, in one command.
|
|
4
|
+
|
|
5
|
+
prosefix runs two passes over each file with one model endpoint, one decision cache and one change list. The style pass (stylefix) settles one English variety and one style guide; the proof pass (proofix) fixes typos, punctuation, compounds and commas. Front matter, code, links, HTML and Obsidian syntax are never changed. Files are rewritten in place.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
Before: The colour of the "new" programme was fine, and we honour it -- really.
|
|
9
|
+
After: The color of the “new” program was fine, and we honor it—really.
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
(US target, rules only. With a model, words that depend on meaning, such as licence and license, are decided too.)
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
brew install andrewbroz/tap/prosefix # also installs Vale, LanguageTool and typos
|
|
18
|
+
uv tool install prosefix # or: pipx install prosefix
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Without Homebrew, install the tools you want. prosefix runs every tier whose requirements are met and says once, on stderr, what it skipped:
|
|
22
|
+
|
|
23
|
+
| missing | skipped | still runs |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| [Vale](https://vale.sh) (`brew install vale`) | `variety`, `guide`, `ambiguous`, `numbers` | `serial-comma`, `abbreviations`, `punctuation`, and all of the proof pass |
|
|
26
|
+
| [LanguageTool](https://languagetool.org) (`brew install languagetool`) | `mechanical`, `adjudicated` | `hygiene`, `compounds`, `commas` |
|
|
27
|
+
| [typos](https://github.com/crate-ci/typos) (`brew install typos-cli`) | `typos` | everything else |
|
|
28
|
+
| a model | decisions that need judgement, `commas` | rule-based tiers; undecided items are reported |
|
|
29
|
+
|
|
30
|
+
## First run
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
prosefix --setup # choose and test a model endpoint
|
|
34
|
+
prosefix --doctor # tools found or missing, the endpoint, the settings file for this directory
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The endpoint comes from flags, `PROSEFIX_LLM_*` / `ADJUDICATE_LLM_*` environment variables, `~/.config/prosefix/config.toml` and `~/.config/adjudicate/config.toml`, never from a project file. Without a model, `--llm none` (or no configured endpoint) still applies all rule-based tiers.
|
|
38
|
+
|
|
39
|
+
## Use
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
prosefix note.md # rewrite one note in place
|
|
43
|
+
prosefix vault/ --diff # show what would change in a vault
|
|
44
|
+
prosefix content/ --check --llm cached # CI: fail if anything would change
|
|
45
|
+
prosefix - < in.md > out.md # filter
|
|
46
|
+
prosefix note.md --target uk --skip commas
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Directory walks take `*.md` and `*.markdown`, skipping `.git`, `.obsidian`, `node_modules`, other dot-directories and your `exclude` globs. Exit status: 0 success; 1 from `--check` (or `--strict`) when something would change; 2 for usage, configuration, input or write errors, a file that changed on disk during the run (it is left alone), or a failed `--require`. Any per-file error is reported on stderr and gives 2, but the other files are still processed.
|
|
50
|
+
|
|
51
|
+
Writes are atomic, keep the file's mode, and follow symlinks to their target; read-only files are reported and left alone.
|
|
52
|
+
|
|
53
|
+
## Obsidian
|
|
54
|
+
|
|
55
|
+
Run prosefix in place on a vault. Wikilinks and their aliases, embeds, `#tags`, `%%comments%%`, `^block-ids`, the `> [!note]` marker of a callout, maths, and Markdown code, links and HTML are never edited; quotes beside them are curled sensibly. Prose that only looks like syntax ("issue #42", "C#", "costs $5 and $10") is edited as prose.
|
|
56
|
+
|
|
57
|
+
Until the prosefix plugin exists, use the Shell Commands community plugin with:
|
|
58
|
+
|
|
59
|
+
```text
|
|
60
|
+
prosefix {{file_path:absolute}}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Publishing
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
- run: pipx install prosefix
|
|
67
|
+
- run: prosefix content/ --check --llm cached
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Commit `.prosefix/` so CI replays your decisions: `--llm cached` applies decisions already in the cache and never contacts a model. With no settings file, decisions are cached under `$XDG_CACHE_HOME/prosefix/` (default `~/.cache/prosefix/`) instead.
|
|
71
|
+
|
|
72
|
+
## Settings
|
|
73
|
+
|
|
74
|
+
prosefix looks upward from each file for `prosefix.toml`, `.prosefix.toml`, or `[tool.prosefix]` in `pyproject.toml`:
|
|
75
|
+
|
|
76
|
+
```toml
|
|
77
|
+
target = "uk" # "us" or "uk"
|
|
78
|
+
style = "oxford" # style guide
|
|
79
|
+
only = ["style", "proof"] # passes to run
|
|
80
|
+
skip = ["commas"] # tiers to skip
|
|
81
|
+
exclude = ["drafts/**", "templates/**"]
|
|
82
|
+
accept = ["Obsidian", "Zettelkasten"]
|
|
83
|
+
accept_file = ".prosefix/accept.txt"
|
|
84
|
+
cache = ".prosefix/cache.json" # comma decisions go to commas.json beside it
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
`exclude` globs are relative to the settings file; `**` crosses directories, `*` and `?` do not, and a bare directory name does not exclude its contents (write `templates/**`). `cache` and `accept_file` must stay inside the project directory.
|
|
88
|
+
|
|
89
|
+
A note can override the project in its front matter:
|
|
90
|
+
|
|
91
|
+
```yaml
|
|
92
|
+
---
|
|
93
|
+
lang: en-GB # sets the target when prosefix.target is absent
|
|
94
|
+
prosefix:
|
|
95
|
+
target: uk
|
|
96
|
+
skip: [commas]
|
|
97
|
+
---
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
or opt out with `prosefix: off`. Only `target`, `style`, `only` and `skip` are allowed there. Flags beat front matter, which beats the project file.
|
|
101
|
+
|
|
102
|
+
The tiers are `variety`, `guide`, `ambiguous`, `numbers`, `serial-comma`, `abbreviations`, `punctuation` (style) and `hygiene`, `mechanical`, `typos`, `adjudicated`, `compounds`, `commas` (proof).
|
|
103
|
+
|
|
104
|
+
## JSON
|
|
105
|
+
|
|
106
|
+
`prosefix --json` prints one document, `"schema": 1`, for editors and plugins: the endpoint, the capabilities skipped, and for each file its status, settings, a list of changes (`id`, `pass`, `check`, `start`, `end`, `line`, `before`, `after`, `reason`, `decided_by`, `confidence`, `depends_on`), review items and the full output. Offsets are UTF-16 code units into the whole original file; `line` is 1-based. A change that lists `depends_on` supersedes the changes it names. The details are in the man page (`man prosefix`, or `man/prosefix.1` in the source).
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
MIT
|