prosefix 0.2.0__tar.gz → 0.3.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.
Files changed (28) hide show
  1. {prosefix-0.2.0 → prosefix-0.3.1}/PKG-INFO +51 -9
  2. {prosefix-0.2.0 → prosefix-0.3.1}/README.md +47 -5
  3. {prosefix-0.2.0 → prosefix-0.3.1}/man/prosefix.1 +399 -21
  4. {prosefix-0.2.0 → prosefix-0.3.1}/prosefix/__init__.py +1 -1
  5. {prosefix-0.2.0 → prosefix-0.3.1}/prosefix/cli.py +157 -21
  6. prosefix-0.3.1/prosefix/config.py +176 -0
  7. prosefix-0.3.1/prosefix/engine.py +540 -0
  8. prosefix-0.3.1/prosefix/jsonout.py +105 -0
  9. {prosefix-0.2.0 → prosefix-0.3.1}/prosefix/settings.py +19 -16
  10. prosefix-0.3.1/prosefix/tools.py +58 -0
  11. {prosefix-0.2.0 → prosefix-0.3.1}/pyproject.toml +2 -2
  12. {prosefix-0.2.0 → prosefix-0.3.1}/tests/test_cli.py +266 -2
  13. prosefix-0.3.1/tests/test_config.py +357 -0
  14. prosefix-0.3.1/tests/test_decide.py +334 -0
  15. {prosefix-0.2.0 → prosefix-0.3.1}/tests/test_engine.py +101 -0
  16. prosefix-0.2.0/prosefix/engine.py +0 -284
  17. prosefix-0.2.0/prosefix/jsonout.py +0 -45
  18. prosefix-0.2.0/prosefix/tools.py +0 -26
  19. {prosefix-0.2.0 → prosefix-0.3.1}/.gitignore +0 -0
  20. {prosefix-0.2.0 → prosefix-0.3.1}/LICENSE +0 -0
  21. {prosefix-0.2.0 → prosefix-0.3.1}/tests/conftest.py +0 -0
  22. {prosefix-0.2.0 → prosefix-0.3.1}/tests/data/walkthrough.md +0 -0
  23. {prosefix-0.2.0 → prosefix-0.3.1}/tests/test_docs.py +0 -0
  24. {prosefix-0.2.0 → prosefix-0.3.1}/tests/test_settings.py +0 -0
  25. {prosefix-0.2.0 → prosefix-0.3.1}/tests/test_walkthrough.py +0 -0
  26. {prosefix-0.2.0 → prosefix-0.3.1}/tests/vault/obsidian.md +0 -0
  27. {prosefix-0.2.0 → prosefix-0.3.1}/tests/vault/off.md +0 -0
  28. {prosefix-0.2.0 → prosefix-0.3.1}/tests/vault/plain.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: prosefix
3
- Version: 0.2.0
3
+ Version: 0.3.1
4
4
  Summary: Fix spelling, style, typos and punctuation in Markdown files, in place.
5
5
  Project-URL: Homepage, https://github.com/AndrewBroz/prosefix
6
6
  Project-URL: Issues, https://github.com/AndrewBroz/prosefix/issues
@@ -14,10 +14,10 @@ Classifier: Programming Language :: Python :: 3
14
14
  Classifier: Programming Language :: Python :: 3.11
15
15
  Classifier: Topic :: Text Processing :: Markup :: Markdown
16
16
  Requires-Python: >=3.11
17
- Requires-Dist: adjudicate<0.4,>=0.3.2
18
- Requires-Dist: proofix<0.8,>=0.7
17
+ Requires-Dist: adjudicate<0.4,>=0.3.7
18
+ Requires-Dist: proofix<0.9,>=0.8.2
19
19
  Requires-Dist: pyyaml>=6
20
- Requires-Dist: stylefix<0.9,>=0.8.1
20
+ Requires-Dist: stylefix<0.11,>=0.10.2
21
21
  Description-Content-Type: text/markdown
22
22
 
23
23
  # prosefix
@@ -39,7 +39,7 @@ Before: We recieved the the new colour scheme -- the teams programme , which co
39
39
  After: We received the new colour scheme – the teams programme, which covers analysis, design and testing.
40
40
  ```
41
41
 
42
- (A British draft, kept British, with the tools installed and no model. Words that depend on meaning, such as licence and license, are listed for review until a model decides them.)
42
+ (A British draft, kept British, with the tools installed and no model. Words that depend on meaning, such as licence and license, are listed for review until a model decides them; see [Questions without a model](#first-run).)
43
43
 
44
44
  ## Install
45
45
 
@@ -55,7 +55,7 @@ Without Homebrew, install the tools you want. prosefix runs every tier whose req
55
55
  | [Vale](https://vale.sh) (`brew install vale`) | `variety`, `guide`, `ambiguous`, `numbers` | `serial-comma`, `abbreviations`, `punctuation`, and all of the proof pass |
56
56
  | [LanguageTool](https://languagetool.org) (`brew install languagetool`) | `mechanical`, `adjudicated` | `hygiene`, `basics`, `compounds`, `commas` |
57
57
  | [typos](https://github.com/crate-ci/typos) (`brew install typos-cli`) | `typos` | everything else |
58
- | a model | decisions that need judgement, `commas` | rule-based tiers; undecided items are listed for review |
58
+ | a model | decisions that need judgement, `commas` | rule-based tiers; undecided items are listed for review (see [Questions without a model](#first-run)) |
59
59
 
60
60
  ## First run
61
61
 
@@ -79,11 +79,15 @@ prosefix --setup # choose and test a model endpoint
79
79
  prosefix --doctor # tools found or missing, the endpoint, the settings file for this directory
80
80
  ```
81
81
 
82
- 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.
82
+ 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, all rule-based tiers still run.
83
+
84
+ **Questions without a model.** Some items need judgement but have a likely answer: a capitalised swap (`Color` to `Colour`), a serial comma, a number the guide may spell out, an abbreviation that may end a sentence, and a comma or full stop at a closing quote. Without a model, prosefix asks about each one whenever it can store your answer, that is, whenever it uses a decision cache. The question is listed for review, and the text is left as written. `--no-cache` reads and stores nothing, so it does not ask: it applies the capitalised swap and lists the others as plain review items. Before 0.3.0, only `--llm cached` asked.
85
+
86
+ **`--llm none`** contacts no model and reads only your own answers from the cache, never the model's. It applies them and asks the same questions as `--llm cached`, so the two write the same text when the cache holds only your answers. Before 0.3.1 it read no cache at all.
83
87
 
84
88
  ### Which English
85
89
 
86
- When nothing sets the variety (no `--target`, no project `target`, no front matter `prosefix: {target: …}` or `lang:`), prosefix reads the note and keeps the variety it is already written in. It counts the distinct words that only one variety spells that way (`colour`, `programme`, `finalise` against `color`, `program`, `finalize`), outside code and quotations; names, words in your accept lists and words both varieties accept do not count. Two or more British words, and at least twice as many as American ones, mean UK; the same the other way means US. A note with words of both varieties but no clear majority keeps its spellings as written (no variety conversion; everything else follows the US default), and a note with no such words at all uses US. The per-file line says which:
90
+ When nothing sets the variety (no `--target`, no project `target`, no front matter `prosefix: {target: …}` or `lang:`), prosefix reads the note and keeps the variety it is already written in. It counts the distinct words that only one variety spells that way (`colour`, `programme`, `finalise` against `color`, `program`, `finalize`), outside code and quotations; names, words in your accept lists and words both varieties accept do not count. Two or more British words, and at least twice as many as American ones, mean UK; the same the other way means US. A note with such words but no clear majority keeps its spellings, its outer quote marks and the order of its dates as written (no variety conversion; everything else follows the US default), and a note with no such words at all uses US. The per-file line says which:
87
91
 
88
92
  ```text
89
93
  prosefix: draft.md: en-GB (detected) · 6 change(s), 4 for review
@@ -173,7 +177,45 @@ The tiers are `variety`, `guide`, `ambiguous`, `numbers`, `serial-comma`, `abbre
173
177
 
174
178
  ## JSON
175
179
 
176
- `prosefix --json` prints one document, `"schema": 1`, for editors and plugins: the endpoint, the capabilities skipped, and for each file its status, settings (with `target_source`, one of `flag`, `front matter`, `lang`, `project`, `detected` or `default`, and `detected` word counts when detection ran, and `"variety_conversion": false` when no clear variety meant the variety spellings were left alone), 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).
180
+ `prosefix --json` prints one document, `"schema": 1`, for editors and plugins. It holds the endpoint, the capabilities skipped and an entry for each file. Each entry has the file's status, settings, `input_sha256`, a list of changes (`id`, `pass`, `check`, `start`, `end`, `line`, `before`, `after`, `reason`, `decided_by`, `confidence`, `depends_on`), review items and the full output. The settings include `target_source`, one of `flag`, `front matter`, `lang`, `project`, `detected` or `default`. They include `detected` word counts when detection ran, and `"variety_conversion": false` when no clear variety meant the variety spellings were left alone. `input_sha256` is the SHA-256 of the input as UTF-8, so a plugin can tell whether the note changed after the run. Change offsets are UTF-16 code units into the whole input file; `line` is 1-based. A change that lists `depends_on` supersedes the changes it names. `decided_by` is `rule`, `model`, `cache` or `user`; `user` marks a change made from your answer. A file with `"status": "error"` has only `path`, `status`, `reason` and `settings`.
181
+
182
+ **Settled output.** prosefix runs again on its own output until a run changes nothing. So `output` is settled: a run on it reports `unchanged`, with the same questions and keys. The review items come from that last run. This happens in every mode, so an in-place write gives the same text as `output`.
183
+
184
+ **Questions.** A review item with `options` is a question. Only a question has these fields:
185
+
186
+ - `start` and `end`: UTF-16 offsets into `output`, not into the input, left out when they cannot be placed there;
187
+ - `options`: the replacements on offer (keeping the text as written is always possible, and never listed);
188
+ - `suggestion`: the model's pick even when it was too unsure to apply it, or null;
189
+ - `message`: the question in plain words, such as `Keep 'monday', or change it to 'Monday' or 'today'?`;
190
+ - `confidence` and `reason`: the model's reason, or why no model answered (`no model configured` or `model error`);
191
+ - `explain`: a sentence or two on the rule, for the person answering, when the question has one;
192
+ - `key`: what `--decide` takes.
193
+
194
+ **One line per file.** `prosefix --json-lines` writes nothing to the notes either. It prints one line per file, `"type": "file"` followed by the file's entry, as each file finishes, in any order. Then it prints one `"type": "summary"` line with `schema`, `prosefix`, `endpoint` and `skipped`. `endpoint` is null when no model is used. Otherwise it has `url`, `model`, `source` and `error`: null, or the run's first model failure, given once rather than in every question. Each line is compact JSON in ASCII. A file that fails, including a path that does not exist, gets a line with `"status": "error"`, and the exit status stays 0. A `--report` file that cannot be written makes it 2.
195
+
196
+ **Answers.** `prosefix --decide` reads answers as JSON on stdin and stores each in the cache that its note's path uses:
197
+
198
+ ```json
199
+ {"decisions":[
200
+ {"path":"/v/essay.md","key":"3b9e0c1d2a4f5e6a7b8c9d0e","choice":"licence",
201
+ "word":"license","options":["licence","license"],"start":118,"end":125},
202
+ {"path":"/v/essay.md","key":"…","choice":"KEEP"},
203
+ {"path":"/v/notes.md","key":"…","choice":{"text":"licensed"}}]}
204
+ ```
205
+
206
+ `choice` is one of the options, `"KEEP"` to keep the text as written, or `{"text": …}` for your own words. It prints `{"written": 3, "caches": [...]}`. Malformed input prints `{"error": "…"}`, stores nothing and exits 2. The next run with the cache applies the answers, for example `prosefix --json-lines --llm cached /v/essay.md`.
207
+
208
+ One answer can change the sentence of another question in the same note, and so that question's key. `word` is the text at the question's `start`:`end` in `output`. With `word` and `options`, prosefix carries such an answer over: an answer the run did not use moves to the one open question in the same note with the same word and options, and the note runs again, up to three times. An answer gets one chance to move: the next run of its note, normally the cached run right after `--decide`. An answer also settles any other question on the same place, from either pass: once you choose `licence` over `license`, or keep `license`, prosefix doesn't ask whether that word should be the other one. It answers such a question `KEEP`. `start` and `end`, the question's UTF-16 offsets in `output`, give the place. Without them, only a question on the word an answer put in, with the same options, is settled.
209
+
210
+ Known limits: an answer to a proofix compound question applies to every occurrence of that form. An answer whose edit overlaps a stylefix edit loses to it and is dropped without notice. An answer without `word` and `options` is not carried over.
211
+
212
+ **Setup.** Three commands print one JSON object each, for a plugin's setup screen:
213
+
214
+ - `prosefix --doctor --json`: `schema`, the `prosefix` and `python` versions, each tool (`name`, `found`, `version`, `path`, `adds`, `fix`), the endpoint (`found`, `url`, `model`, `source`, `error`), `config_file` and `settings_file` (null when there is none). `fix` is a Homebrew command, with Homebrew's full path when it is found.
215
+ - `prosefix --check-endpoint --json [--url URL] [--model NAME]`: tests the endpoint and gives `ok`, `url`, `model`, `models`, `model_info`, `latency_ms` and `error`. `model_info` lists each model's `id` and `created` (Unix seconds, or null) in the server's order. It exits 1 when the test fails.
216
+ - `prosefix --setup --url URL [--model NAME] [--thinking-switch] --json`: tests the endpoint and, only if the test passes, writes `~/.config/prosefix/config.toml` with mode 0600. It gives `ok`, `written`, `url`, `model` and `error`, and exits 1 when nothing was written.
217
+
218
+ `--key-stdin` reads the API key from the first line of stdin; prosefix never prints it. It works only with `--check-endpoint --json` and `--setup --url … --json`, and `--thinking-switch` only with `--setup --url`; prosefix refuses them elsewhere, with exit status 2. Without `--key-stdin`, a `--url` equal to the configured endpoint's uses its key, timeout and thinking switch, so a change of model keeps them. The configured endpoint is the one a plain run uses: from prosefix's config file, adjudicate's (`~/.config/adjudicate/config.toml`) or the `PROSEFIX_LLM_*` and `ADJUDICATE_LLM_*` variables. `--setup` writes a key that came from a variable as `api_key_env` naming it, never as its value. Another URL gets no key. The details are in the man page (`man prosefix`, or `man/prosefix.1` in the source).
177
219
 
178
220
  ## License
179
221
 
@@ -17,7 +17,7 @@ Before: We recieved the the new colour scheme -- the teams programme , which co
17
17
  After: We received the new colour scheme – the teams programme, which covers analysis, design and testing.
18
18
  ```
19
19
 
20
- (A British draft, kept British, with the tools installed and no model. Words that depend on meaning, such as licence and license, are listed for review until a model decides them.)
20
+ (A British draft, kept British, with the tools installed and no model. Words that depend on meaning, such as licence and license, are listed for review until a model decides them; see [Questions without a model](#first-run).)
21
21
 
22
22
  ## Install
23
23
 
@@ -33,7 +33,7 @@ Without Homebrew, install the tools you want. prosefix runs every tier whose req
33
33
  | [Vale](https://vale.sh) (`brew install vale`) | `variety`, `guide`, `ambiguous`, `numbers` | `serial-comma`, `abbreviations`, `punctuation`, and all of the proof pass |
34
34
  | [LanguageTool](https://languagetool.org) (`brew install languagetool`) | `mechanical`, `adjudicated` | `hygiene`, `basics`, `compounds`, `commas` |
35
35
  | [typos](https://github.com/crate-ci/typos) (`brew install typos-cli`) | `typos` | everything else |
36
- | a model | decisions that need judgement, `commas` | rule-based tiers; undecided items are listed for review |
36
+ | a model | decisions that need judgement, `commas` | rule-based tiers; undecided items are listed for review (see [Questions without a model](#first-run)) |
37
37
 
38
38
  ## First run
39
39
 
@@ -57,11 +57,15 @@ prosefix --setup # choose and test a model endpoint
57
57
  prosefix --doctor # tools found or missing, the endpoint, the settings file for this directory
58
58
  ```
59
59
 
60
- 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
+ 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, all rule-based tiers still run.
61
+
62
+ **Questions without a model.** Some items need judgement but have a likely answer: a capitalised swap (`Color` to `Colour`), a serial comma, a number the guide may spell out, an abbreviation that may end a sentence, and a comma or full stop at a closing quote. Without a model, prosefix asks about each one whenever it can store your answer, that is, whenever it uses a decision cache. The question is listed for review, and the text is left as written. `--no-cache` reads and stores nothing, so it does not ask: it applies the capitalised swap and lists the others as plain review items. Before 0.3.0, only `--llm cached` asked.
63
+
64
+ **`--llm none`** contacts no model and reads only your own answers from the cache, never the model's. It applies them and asks the same questions as `--llm cached`, so the two write the same text when the cache holds only your answers. Before 0.3.1 it read no cache at all.
61
65
 
62
66
  ### Which English
63
67
 
64
- When nothing sets the variety (no `--target`, no project `target`, no front matter `prosefix: {target: …}` or `lang:`), prosefix reads the note and keeps the variety it is already written in. It counts the distinct words that only one variety spells that way (`colour`, `programme`, `finalise` against `color`, `program`, `finalize`), outside code and quotations; names, words in your accept lists and words both varieties accept do not count. Two or more British words, and at least twice as many as American ones, mean UK; the same the other way means US. A note with words of both varieties but no clear majority keeps its spellings as written (no variety conversion; everything else follows the US default), and a note with no such words at all uses US. The per-file line says which:
68
+ When nothing sets the variety (no `--target`, no project `target`, no front matter `prosefix: {target: …}` or `lang:`), prosefix reads the note and keeps the variety it is already written in. It counts the distinct words that only one variety spells that way (`colour`, `programme`, `finalise` against `color`, `program`, `finalize`), outside code and quotations; names, words in your accept lists and words both varieties accept do not count. Two or more British words, and at least twice as many as American ones, mean UK; the same the other way means US. A note with such words but no clear majority keeps its spellings, its outer quote marks and the order of its dates as written (no variety conversion; everything else follows the US default), and a note with no such words at all uses US. The per-file line says which:
65
69
 
66
70
  ```text
67
71
  prosefix: draft.md: en-GB (detected) · 6 change(s), 4 for review
@@ -151,7 +155,45 @@ The tiers are `variety`, `guide`, `ambiguous`, `numbers`, `serial-comma`, `abbre
151
155
 
152
156
  ## JSON
153
157
 
154
- `prosefix --json` prints one document, `"schema": 1`, for editors and plugins: the endpoint, the capabilities skipped, and for each file its status, settings (with `target_source`, one of `flag`, `front matter`, `lang`, `project`, `detected` or `default`, and `detected` word counts when detection ran, and `"variety_conversion": false` when no clear variety meant the variety spellings were left alone), 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).
158
+ `prosefix --json` prints one document, `"schema": 1`, for editors and plugins. It holds the endpoint, the capabilities skipped and an entry for each file. Each entry has the file's status, settings, `input_sha256`, a list of changes (`id`, `pass`, `check`, `start`, `end`, `line`, `before`, `after`, `reason`, `decided_by`, `confidence`, `depends_on`), review items and the full output. The settings include `target_source`, one of `flag`, `front matter`, `lang`, `project`, `detected` or `default`. They include `detected` word counts when detection ran, and `"variety_conversion": false` when no clear variety meant the variety spellings were left alone. `input_sha256` is the SHA-256 of the input as UTF-8, so a plugin can tell whether the note changed after the run. Change offsets are UTF-16 code units into the whole input file; `line` is 1-based. A change that lists `depends_on` supersedes the changes it names. `decided_by` is `rule`, `model`, `cache` or `user`; `user` marks a change made from your answer. A file with `"status": "error"` has only `path`, `status`, `reason` and `settings`.
159
+
160
+ **Settled output.** prosefix runs again on its own output until a run changes nothing. So `output` is settled: a run on it reports `unchanged`, with the same questions and keys. The review items come from that last run. This happens in every mode, so an in-place write gives the same text as `output`.
161
+
162
+ **Questions.** A review item with `options` is a question. Only a question has these fields:
163
+
164
+ - `start` and `end`: UTF-16 offsets into `output`, not into the input, left out when they cannot be placed there;
165
+ - `options`: the replacements on offer (keeping the text as written is always possible, and never listed);
166
+ - `suggestion`: the model's pick even when it was too unsure to apply it, or null;
167
+ - `message`: the question in plain words, such as `Keep 'monday', or change it to 'Monday' or 'today'?`;
168
+ - `confidence` and `reason`: the model's reason, or why no model answered (`no model configured` or `model error`);
169
+ - `explain`: a sentence or two on the rule, for the person answering, when the question has one;
170
+ - `key`: what `--decide` takes.
171
+
172
+ **One line per file.** `prosefix --json-lines` writes nothing to the notes either. It prints one line per file, `"type": "file"` followed by the file's entry, as each file finishes, in any order. Then it prints one `"type": "summary"` line with `schema`, `prosefix`, `endpoint` and `skipped`. `endpoint` is null when no model is used. Otherwise it has `url`, `model`, `source` and `error`: null, or the run's first model failure, given once rather than in every question. Each line is compact JSON in ASCII. A file that fails, including a path that does not exist, gets a line with `"status": "error"`, and the exit status stays 0. A `--report` file that cannot be written makes it 2.
173
+
174
+ **Answers.** `prosefix --decide` reads answers as JSON on stdin and stores each in the cache that its note's path uses:
175
+
176
+ ```json
177
+ {"decisions":[
178
+ {"path":"/v/essay.md","key":"3b9e0c1d2a4f5e6a7b8c9d0e","choice":"licence",
179
+ "word":"license","options":["licence","license"],"start":118,"end":125},
180
+ {"path":"/v/essay.md","key":"…","choice":"KEEP"},
181
+ {"path":"/v/notes.md","key":"…","choice":{"text":"licensed"}}]}
182
+ ```
183
+
184
+ `choice` is one of the options, `"KEEP"` to keep the text as written, or `{"text": …}` for your own words. It prints `{"written": 3, "caches": [...]}`. Malformed input prints `{"error": "…"}`, stores nothing and exits 2. The next run with the cache applies the answers, for example `prosefix --json-lines --llm cached /v/essay.md`.
185
+
186
+ One answer can change the sentence of another question in the same note, and so that question's key. `word` is the text at the question's `start`:`end` in `output`. With `word` and `options`, prosefix carries such an answer over: an answer the run did not use moves to the one open question in the same note with the same word and options, and the note runs again, up to three times. An answer gets one chance to move: the next run of its note, normally the cached run right after `--decide`. An answer also settles any other question on the same place, from either pass: once you choose `licence` over `license`, or keep `license`, prosefix doesn't ask whether that word should be the other one. It answers such a question `KEEP`. `start` and `end`, the question's UTF-16 offsets in `output`, give the place. Without them, only a question on the word an answer put in, with the same options, is settled.
187
+
188
+ Known limits: an answer to a proofix compound question applies to every occurrence of that form. An answer whose edit overlaps a stylefix edit loses to it and is dropped without notice. An answer without `word` and `options` is not carried over.
189
+
190
+ **Setup.** Three commands print one JSON object each, for a plugin's setup screen:
191
+
192
+ - `prosefix --doctor --json`: `schema`, the `prosefix` and `python` versions, each tool (`name`, `found`, `version`, `path`, `adds`, `fix`), the endpoint (`found`, `url`, `model`, `source`, `error`), `config_file` and `settings_file` (null when there is none). `fix` is a Homebrew command, with Homebrew's full path when it is found.
193
+ - `prosefix --check-endpoint --json [--url URL] [--model NAME]`: tests the endpoint and gives `ok`, `url`, `model`, `models`, `model_info`, `latency_ms` and `error`. `model_info` lists each model's `id` and `created` (Unix seconds, or null) in the server's order. It exits 1 when the test fails.
194
+ - `prosefix --setup --url URL [--model NAME] [--thinking-switch] --json`: tests the endpoint and, only if the test passes, writes `~/.config/prosefix/config.toml` with mode 0600. It gives `ok`, `written`, `url`, `model` and `error`, and exits 1 when nothing was written.
195
+
196
+ `--key-stdin` reads the API key from the first line of stdin; prosefix never prints it. It works only with `--check-endpoint --json` and `--setup --url … --json`, and `--thinking-switch` only with `--setup --url`; prosefix refuses them elsewhere, with exit status 2. Without `--key-stdin`, a `--url` equal to the configured endpoint's uses its key, timeout and thinking switch, so a change of model keeps them. The configured endpoint is the one a plain run uses: from prosefix's config file, adjudicate's (`~/.config/adjudicate/config.toml`) or the `PROSEFIX_LLM_*` and `ADJUDICATE_LLM_*` variables. `--setup` writes a key that came from a variable as `api_key_env` naming it, never as its value. Another URL gets no key. The details are in the man page (`man prosefix`, or `man/prosefix.1` in the source).
155
197
 
156
198
  ## License
157
199