yuno-proofreader 0.1.0 → 0.1.2

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 (51) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +169 -58
  4. data/lib/yuno/proofreader/audit/attempt.rb +11 -4
  5. data/lib/yuno/proofreader/audit/batch.rb +5 -3
  6. data/lib/yuno/proofreader/audit/report.rb +6 -1
  7. data/lib/yuno/proofreader/audit/runner.rb +28 -14
  8. data/lib/yuno/proofreader/audit/schemas.rb +51 -0
  9. data/lib/yuno/proofreader/cli/audit_commands.rb +9 -5
  10. data/lib/yuno/proofreader/cli/command_log.rb +4 -0
  11. data/lib/yuno/proofreader/cli/generate_commands.rb +133 -0
  12. data/lib/yuno/proofreader/cli/init_command.rb +24 -10
  13. data/lib/yuno/proofreader/cli/model_commands.rb +10 -2
  14. data/lib/yuno/proofreader/cli/queue_commands.rb +11 -1
  15. data/lib/yuno/proofreader/cli/sheet_commands.rb +4 -1
  16. data/lib/yuno/proofreader/cli.rb +28 -11
  17. data/lib/yuno/proofreader/config.rb +3 -3
  18. data/lib/yuno/proofreader/generate/cache.rb +77 -0
  19. data/lib/yuno/proofreader/generate/collector.rb +115 -0
  20. data/lib/yuno/proofreader/generate/describe.rb +29 -0
  21. data/lib/yuno/proofreader/generate/llm/prompt.rb +62 -0
  22. data/lib/yuno/proofreader/generate/llm/reader.rb +114 -0
  23. data/lib/yuno/proofreader/generate/llm/rules.yml +14 -0
  24. data/lib/yuno/proofreader/generate/llm/wording.rb +20 -0
  25. data/lib/yuno/proofreader/generate/llms_builder.rb +50 -0
  26. data/lib/yuno/proofreader/generate/llms_report.rb +112 -0
  27. data/lib/yuno/proofreader/generate/llms_txt.rb +107 -0
  28. data/lib/yuno/proofreader/generate/llms_writer.rb +54 -0
  29. data/lib/yuno/proofreader/generate/outline.rb +91 -0
  30. data/lib/yuno/proofreader/generate/passage.rb +54 -0
  31. data/lib/yuno/proofreader/generate/saved_answer.rb +50 -0
  32. data/lib/yuno/proofreader/llm/client.rb +18 -11
  33. data/lib/yuno/proofreader/llm/defaults.yml +3 -0
  34. data/lib/yuno/proofreader/llm/errors.rb +2 -0
  35. data/lib/yuno/proofreader/llm/factory.rb +9 -6
  36. data/lib/yuno/proofreader/llm/handoff.rb +114 -0
  37. data/lib/yuno/proofreader/llm/provider.rb +5 -2
  38. data/lib/yuno/proofreader/llm/providers/gemini.rb +7 -5
  39. data/lib/yuno/proofreader/llm/providers/manual.rb +44 -0
  40. data/lib/yuno/proofreader/llm/providers.rb +4 -10
  41. data/lib/yuno/proofreader/site.rb +2 -1
  42. data/lib/yuno/proofreader/site_reader.rb +29 -3
  43. data/lib/yuno/proofreader/store/cells.rb +13 -3
  44. data/lib/yuno/proofreader/store/gateways/csv.rb +79 -0
  45. data/lib/yuno/proofreader/store/sheets.rb +8 -4
  46. data/lib/yuno/proofreader/version.rb +1 -1
  47. data/lib/yuno/proofreader.rb +18 -0
  48. data/proofreader.example.yml +39 -10
  49. metadata +42 -7
  50. data/lib/yuno/proofreader/llm/model_commands.rb +0 -34
  51. /data/lib/yuno/proofreader/store/{google_gateway.rb → gateways/google.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b9c1ba0d2da16cc90dd1280f5c90ed7174c16402def0aa09707495d0bccd0a2
4
- data.tar.gz: 3c174ff4a4cf13f8864a1b10ff09374d488b4b14dd818569b1926a091c77b56d
3
+ metadata.gz: 10d51101947e788caaabb5e519b8996fc7c7e0014724634addd60a70bf4166c1
4
+ data.tar.gz: ebcbd00eb54f2f283c0c528ddf046b67d628bae8de553fe1fe3c096dcb78302b
5
5
  SHA512:
6
- metadata.gz: cfa0b61cd10747628ce5dce680d3c2b1b01daaaeeb706ec936b80c71e576b7a581c5c43e0c86ed3254a8163b2efa9654806ff6877eca7e23b42b9b2bfdd8dd8c
7
- data.tar.gz: e99babee2e1dae3e11f808048647fb6bd6b972e16ffe7f922c6f8bcefc5d1054093bb047f87fa8f834bdb21af00dc934792934aca9e1aa040be1f8ddafd48ad6
6
+ metadata.gz: 3d5a551d0d762923d6172cb02bdfb2454d3aec75fb9178994f04f271592b32131263a594b14d44f25882fc30ddbbc2654d13b8fccd4896e77fa456f14ee07ed1
7
+ data.tar.gz: e27afb721465f2003686b9c1c81c57f4fe34c42e0b2daf6eb20d20c0e59c818097d1d2d9f5b2014f0a68212ff41d5c86014341f79eff761f52d7ab3bb67dd772
data/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.2
4
+ 2026/11/19
5
+
6
+ - A page whose model answers can't be parsed is now set aside and retried after the retry period, instead of stopping the whole batch.
7
+ - Model answers are now requested in a fixed JSON schema (used by Gemini), so replies here should be less likely to be unparsable.
8
+ - Pages audited before are no longer treated as never audited when a date cell in the sheet has no date format.
9
+
10
+ ## [0.1.1]
11
+ 2026/11/14
12
+
13
+ - New `manual` provider, now the default - no API key needed. The tool saves each prompt to a file, you paste it into any AI chat and save the reply back.
14
+ - Results are now kept in CSV files by default, in a `data` folder, so no Google account is needed to start.
15
+ - New `generate llms` command: writes an `llms.txt` for each language of your site, from your most important pages and the text they already have.
16
+ - The independent second review is now off by default
17
+
3
18
  ## [0.1.0]
4
19
  2026/10/26
5
20
 
@@ -11,3 +26,4 @@ First release. It is early, and details may still change before 1.0.
11
26
  - Checks that every suggestion quotes text that is really on the page, and closes suggestions whose text is gone from the live page.
12
27
 
13
28
  [0.1.0]: https://gitlab.com/alsen-ca/yuno-proofreader/-/tags/v0.1.0
29
+ [0.1.1]: https://gitlab.com/alsen-ca/yuno-proofreader/-/tags/v0.1.1
data/README.md CHANGED
@@ -1,25 +1,31 @@
1
1
  # yuno-proofreader
2
2
 
3
- AI-powered website proofreader that collects suggestions in Google Sheets.
3
+ AI-powered website proofreader that keeps its suggestions in CSV files or Google Sheets, and can write the `llms.txt` of your site.
4
4
 
5
- It reads your public web pages, asks an AI model (only Gemini so far) to look for typos, grammar problems, HTML structure issues, SEO basics and differences between language versions, and lists the suggested fixes in a Google Sheet for you to review.
6
- Only Makes suggestions and doesn't do any actual changes to the website.
5
+ It reads your public web pages, asks an AI model to look for typos, grammar problems, HTML structure issues, SEO basics and differences between language versions, and lists the suggested fixes for you to review, in CSV files by default or in a Google Sheet.
6
+ It can also write an `llms.txt` for each language of your site, using the text your pages already have (see "Generating llms.txt").
7
+ By default you ask the model yourself: the tool writes each prompt to a file, you paste it into a chat with the model of your choice, and save the reply. No account or API key is needed. AI integration is available as an automatic provider (only Gemini so far).
8
+ It only makes suggestions and files, and never changes your website.
9
+
10
+ Install it with `gem install yuno-proofreader` ([RubyGems](https://rubygems.org/gems/yuno-proofreader)).
7
11
 
8
12
  ## How it works
9
13
 
10
14
  1. Reads your sitemap and pairs each page with its language versions.
11
- 2. Audits one page per run in two independent passes: a step-by-step audit, then a second review by a different model that has not seen the first result. A page that has not changed since its last complete audit is skipped without calling a model.
12
- 3. Merges both answers, checks that every quoted text really appears on the page, and writes new suggestions to the sheet. Suggestions it already knows are not added again.
15
+ 2. Audits one page per run: a model goes through the page step by step. Optionally (`review: true`), a second model that has not seen the first result reviews the page independently. A page that has not changed since its last complete audit is skipped without calling a model.
16
+ 3. Checks that every quoted text really appears on the page, and writes new suggestions to the results. Suggestions it already knows are not added again.
13
17
  4. On later runs, closes suggestions whose text is no longer on the live page.
14
18
 
15
- You review the sheet and mark each suggestion as `open`, `on staging`, `done` or `rejected`.
19
+ You review the suggestions and mark each one as `open`, `on staging`, `done` or `rejected`.
20
+
21
+ Separately, `generate llms` turns your most important pages into an `llms.txt` per language.
16
22
 
17
23
  ## What you need
18
24
 
19
25
  - Ruby 4.0 or newer, or a container runtime such as Podman or Docker
20
- - An API key for a supported AI model provider (Gemini so far)
21
- - A Google Cloud service account with the Sheets API enabled, and a spreadsheet shared with that account
22
26
  - A sitemap on the site you want to check
27
+ - A way to ask a model: either a chat assistant you can paste into (the default, `manual`), or an API key for a supported provider (Gemini so far)
28
+ - Optional: a Google Cloud service account with the Sheets API enabled, and a spreadsheet shared with that account, only if you want a Google Sheet instead of CSV files
23
29
 
24
30
  ## Getting started
25
31
 
@@ -30,34 +36,45 @@ yuno-proofreader settings # what is still needed for an audit
30
36
  yuno-proofreader sitemap # check that your pages are found and paired by language
31
37
  ```
32
38
 
33
- The commands that only read your site (`init`, `settings`, `sitemap`, `fetch` and `prompt`) need nothing more. The ones that use your sheet and your model need access, which lives outside `proofreader.yml`. You can put it in a `.env` file in the folder where you run the tool (see "Configuration"):
39
+ The commands that only read your site (`init`, `settings`, `sitemap`, `fetch` and `prompt`) need nothing more. The rest keep their results in CSV files in a `data` folder, which needs no account (see "Where the results are kept").
40
+
41
+ The default way of asking a model, `manual`, needs no key either (see "Asking a model by hand"). To call a model automatically, set `provider: gemini` in `proofreader.yml` and add its key, for example in a `.env` file in the folder where you run the tool:
34
42
 
35
43
  ```
36
- SPREADSHEET_ID=...
37
44
  GEMINI_API_KEY=...
38
- GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
39
45
  ```
40
46
 
41
- `SPREADSHEET_ID` is the part of your sheet's address between `/d/` and `/edit`. `GEMINI_API_KEY` is the API key of your model provider. `GOOGLE_APPLICATION_CREDENTIALS` points to the credentials file of a Google account that may edit the sheet, so share the sheet with that account as an editor. On Google Cloud it should not be needed, because the service account the job runs as is used instead. See "Connecting to Google". `yuno-proofreader init` lists which of these are set, `yuno-proofreader models` tests your model key, and `prepare` is the first command that tests the access to the sheet.
42
-
43
47
  ```
44
- yuno-proofreader prepare # creates the Pages, Suggestions and Analysis tabs in your sheet
45
- yuno-proofreader pages import # adds your pages to the sheet
48
+ yuno-proofreader prepare # creates the Pages, Suggestions and Analysis tables
49
+ yuno-proofreader pages import # adds your pages
46
50
  yuno-proofreader analyze # ranks the pages by importance (optional, but it orders the audits)
47
51
  yuno-proofreader queue # shows which pages are due, and why
48
52
  yuno-proofreader audit --next # audits the page that is due first
53
+ yuno-proofreader generate llms # writes an llms.txt for each language to the data folder
49
54
  ```
50
55
 
51
- Start with `audit --next --dry-run` and a single page, and read what it would do: every audit makes two model calls, so cost depends on your pages and your models.
52
- Review the suggestions in the sheet, set each one's `status`, and call `audit --next` again whenever you like: it picks the next page that is due. A cron job, a Kubernetes CronJob or Cloud Scheduler can do that for you.
56
+ `yuno-proofreader init` lists which variables your settings still need, `yuno-proofreader doctor` checks them, and `yuno-proofreader models` tests your model key.
57
+
58
+ Start with `audit --next --dry-run` and a single page, and read what it would do. An audit makes one model call, or two with the independent review (`review: true`). With `manual` that is one paste or two per page, and with an API provider the cost depends on your pages and your models.
59
+ Review the suggestions in `data/suggestions.csv`, set each one's `status`, and call `audit --next` again whenever you like: it picks the next page that is due. With an API provider, a cron job, a Kubernetes CronJob or Cloud Scheduler can do that for you. With `manual` it can't, because someone has to be at the terminal.
60
+
61
+ To keep the results in a Google Sheet instead, set `store: sheets` in `proofreader.yml` and add:
62
+
63
+ ```
64
+ SPREADSHEET_ID=...
65
+ GOOGLE_APPLICATION_CREDENTIALS=/path/to/credentials.json
66
+ ```
67
+
68
+ `SPREADSHEET_ID` is the part of your sheet's address between `/d/` and `/edit`. `GOOGLE_APPLICATION_CREDENTIALS` points to the credentials file of a Google account that may edit the sheet, so share the sheet with that account as an editor. On Google Cloud it should not be needed, because the service account the job runs as is used instead. See "Connecting to Google". `prepare` is the first command that tests the access to the sheet.
53
69
 
54
70
  ## Privacy and responsible use
55
71
 
56
- - The content of your pages, and the text of the settings that describe your site, is sent to the model provider you configure. Providers' terms sometimes differ between free and paid use, including whether prompts may be used to improve their products, so read the current terms before you start.
72
+ - The content of your pages, and the text of the settings that describe your site, is sent to whoever you ask: the model provider you configure, or, with `manual`, the chat service you paste the prompt into. Their terms sometimes differ between free and paid use, including whether prompts may be used to improve their products, so read the current terms before you start.
57
73
  - Only check sites you own or have permission to fetch.
58
74
  - You pay for the model calls yourself. Cost depends on the model and on the size of your pages.
59
75
  - `yuno-proofreader prompt PAGE` shows exactly what is sent to the model for a page, so you can check it before any request is made.
60
- - `yuno-proofreader audit` sends the pages and the settings that describe your site to the model provider, and writes to your sheet. Try it on one small page first, and read `yuno-proofreader prompt PAGE` to see what is sent.
76
+ - `yuno-proofreader audit` sends the pages and the settings that describe your site to the model provider, and writes to your results. Try it on one small page first, and read `yuno-proofreader prompt PAGE` to see what is sent.
77
+ - `yuno-proofreader generate llms` sends the title, description and opening text of your pages, but not their HTML, to the model provider.
61
78
 
62
79
  ## Usage
63
80
 
@@ -69,19 +86,22 @@ yuno-proofreader <command>
69
86
  |---|---|
70
87
  | `help` | Shows the commands |
71
88
  | `version` | Prints the version |
72
- | `doctor` | Checks that `SPREADSHEET_ID` is set and prints the configuration |
89
+ | `doctor [FILE]` | Checks that the settings file can be read and that the variables it needs are set (`SPREADSHEET_ID` only with `store: sheets`), and prints the configuration and where the results are kept |
73
90
  | `sitemap [FILE] [--all]` | Reads the sitemap of the site described in `FILE` (default `./proofreader.yml`) and shows how its pages were paired by language. `--all` lists every page. Needs no API keys. |
74
91
  | `fetch PAGE [FILE] [--html=LANG]` | Downloads all language versions of one page and shows status, size and a content fingerprint of each. `PAGE` is a name from `sitemap --all`, or any address of the page. `--html=LANG` also prints the cleaned HTML that would be sent to the model. |
75
92
  | `settings [FILE]` | Shows which of the settings that describe your site are filled in, and whether an audit can start. Exits with 1 when it cannot. |
76
- | `models [FILE]` | Lists the models your API key can use for text generation, marks the ones in use, and shows whether the list comes from your settings or the built-in default. Needs the API key of your provider. |
77
93
  | `prompt PAGE [FILE] [--review] [--full]` | Shows exactly what would be sent to the model for one page, with a size estimate, without calling it. Needs no API key. Refuses to run while the settings that describe your site are unfinished. |
78
- | `audit PAGE [FILE] [--dry-run] [--force] [--verbose]` | Audits one page in all its language versions and updates the sheet. `--dry-run` writes nothing, but the model is still called and costs the same. `--force` audits a page that has not changed. `--verbose` lists everything that was decided. Needs a model API key, the sheet and the finished settings. |
79
- | `prepare [FILE]` | Creates the `Pages` and `Suggestions` tabs in your Google Sheet. Safe to run again. |
80
- | `pages import [FILE]` | Adds the pages of the sitemap to the `Pages` tab. Safe to run again. |
94
+ | `models [FILE]` | With an API provider: lists the models your key can use for text generation, marks the ones in use, and shows whether the list comes from your settings or the built-in default. Needs the key of your provider. With `manual`: says that there is no list, and shows the label that is printed with each prompt. |
95
+ | `audit PAGE [FILE] [--dry-run] [--force] [--verbose] [--review]` | Audits one page in all its language versions and updates the results. `--dry-run` writes nothing, but the model is still asked, so it costs the same. `--force` audits a page that has not changed. `--verbose` lists everything that was decided. `--review` adds the independent second review for this run (see `review`). Needs the tables from `prepare`, the finished settings, and a way to ask a model (the default `manual`, or an API key). |
96
+ | `audit --next [FILE] [--count=N] [--include-not-due] [--dry-run] [--force] [--verbose] [--review]` | Audits the pages that are due, the most important first (default 1 page). With `manual`, more than one page is refused. |
97
+ | `queue [FILE] [--count=N] [--all]` | Shows which pages are due for an audit and why. Calls no model and fetches no page. |
98
+ | `generate llms [FILE] [--count=N] [--all] [--language=CODE] [--no-ai] [--full-text] [--resume]` | Writes one `llms.txt` per language to the data folder, from your most important pages. See "Generating llms.txt". |
99
+ | `prepare [FILE]` | Creates the `Pages`, `Suggestions` and `Analysis` tables: CSV files in the data folder, or tabs in your Google Sheet. Safe to run again. |
100
+ | `pages import [FILE]` | Adds the pages of the sitemap to the `Pages` table. Safe to run again. |
81
101
  | `analyze [FILE] [--dry-run] [--no-ai] [--reuse-ai]` | Ranks every page by importance and writes `importance`, `tier` and `importance_notes` to the Pages tab, and the measurements to the Analysis tab. `--dry-run` writes nothing, `--no-ai` skips the AI models, `--reuse-ai` takes their judgement from the last run instead of asking again. |
82
102
  | `init [FILE] [OPTIONS]` | Asks about your site and writes a settings file (default `proofreader.yml`). With `--template` it shows the full commented template instead, or writes it to `FILE` when one is named. For scripts: `--website`, `--language CODE[:PREFIX]`, `--note CODE=TEXT`, `--business`, `--audience`, `--tone`, `--sitemap`, `--skip-path`, `--rule`, `--ignore-term` and `--difference`. `--yes` accepts what was detected, `--offline` makes no request. Does not overwrite a file. |
83
103
 
84
- Exit codes: `0` success, `1` an error such as missing configuration, `2` unknown command.
104
+ Exit codes: `0` success, `1` an error such as missing configuration, `2` a usage error such as an unknown command, `130` interrupted with Ctrl-C.
85
105
 
86
106
  How to run it:
87
107
 
@@ -94,9 +114,10 @@ Secrets and ids come from environment variables. The settings of the site you ch
94
114
 
95
115
  | Variable | Required | Meaning |
96
116
  |---|---|---|
97
- | `GEMINI_API_KEY` | for the Gemini models | The API key of your model provider. Each provider names its own variable, and only the one you use is needed. |
98
- | `SPREADSHEET_ID` | for the sheet commands and `doctor` | The id of the Google Sheet that receives the suggestions |
99
- | `GOOGLE_APPLICATION_CREDENTIALS` | locally | Path to a Google credentials file. Where the tool runs on Google Cloud, the attached service account is used instead. |
117
+ | `GEMINI_API_KEY` | only with `provider: gemini` | The API key of your model provider. Each provider names its own variable, and only the one you use is needed. `manual` needs none. |
118
+ | `PROOFREADER_HANDOFF_DIR` | no | The folder where `manual` writes `prompt.md` and reads `answer.md` (default `tmp/handoff`, relative to where you run the tool) |
119
+ | `SPREADSHEET_ID` | only with `store: sheets` | The id of the Google Sheet that receives the suggestions |
120
+ | `GOOGLE_APPLICATION_CREDENTIALS` | only with `store: sheets`, locally | Path to a Google credentials file. Where the tool runs on Google Cloud, the attached service account is used instead. |
100
121
  | `LOG_LEVEL` | no | `debug`, `info`, `warn` (default) or `error`. At `info`, every run, batch and audited page gets a line. At `debug`, each model call gets a line as well, with its model, seconds and tokens. At `warn`, only problems. At `error`, only failures. |
101
122
  | `LOG_FORMAT` | no | `text` (default, `key=value` pairs) or `json` (one JSON object per line, which Google Cloud Logging reads as a structured entry) |
102
123
 
@@ -118,13 +139,13 @@ For the site, run `yuno-proofreader init` (see "Setting up your site"). The comm
118
139
  yuno-proofreader init
119
140
  ```
120
141
 
121
- Asks about your site and writes `proofreader.yml` in the current folder, or the file you name. It does not overwrites a file that already exists. What it does:
142
+ Asks about your site and writes `proofreader.yml` in the current folder, or the file you name. It does not overwrite a file that already exists. What it does:
122
143
 
123
- 1. Asks for the address of the site, and reads the homepage once, honoring. If the address leads to another host, such as the `www` form, it offers to use that one.
144
+ 1. Asks for the address of the site, and reads the homepage once, honoring `robots.txt`. If the address leads to another host, such as the `www` form, it offers to use that one.
124
145
  2. Proposes the languages from the `hreflang` tags of the homepage, with the prefix of each and the default first. If the page announces none, or you decline, you type them: `de, es:/es, en:/en`, the default first.
125
146
  3. Asks for a note per language (variant and form of address), what the site offers (suggesting the meta description of the homepage), the audience and the tone, and then four lists with one entry per line: pages to skip, writing rules, words that must never be flagged, and intended differences between the languages. An empty answer skips what is optional.
126
147
  4. Looks for your sitemap. If none is found, asks for its address.
127
- 5. Writes a short file with your answers. Then it says what an audit still needs, which of `SPREADSHEET_ID` and the API key of your provider are set, and what to run next.
148
+ 5. Writes a short file with your answers. Then it says what an audit still needs, which variables your settings need (none, by default) and whether they are set, and what to run next.
128
149
 
129
150
  ### Without questions
130
151
 
@@ -154,7 +175,7 @@ Good to know:
154
175
  - Languages are told apart by the start of the address (`/en/...`). A version on another domain, or deeper than one path segment, can't be described, and `init` says which versions it left out.
155
176
  - Language codes are written in lowercase (`de-DE` becomes `de-de`). Run `yuno-proofreader sitemap` afterwards to check that your pages are paired.
156
177
  - With `--yes`, the meta description of your homepage becomes the description of the business, unless you give `--business`. It is marketing copy, so read it. If the page has no description, or one longer than 300 characters, the business stays empty, and `yuno-proofreader settings` says that an audit still needs it.
157
- - The file holds only your answers. Settings you were not asked about, such as the models, `analysis` and `cadence`, are not in it and use their defaults. `yuno-proofreader init --template` shows every setting.
178
+ - The file holds only your answers. Settings you were not asked about, such as the models, store, analysis and cadence, are not in it and use their defaults. yuno-proofreader init --template shows every setting.
158
179
 
159
180
  ## Describing your site
160
181
 
@@ -177,21 +198,52 @@ Limits: 500 characters per text, 200 per list entry or language note, and 50 ent
177
198
 
178
199
  ## Choosing the models
179
200
 
180
- The tool calls an AI model through a small wrapper for each family of models. Only `gemini` is included so far. Which models it uses is up to you, in `proofreader.yml`:
201
+ The tool asks a model through a small wrapper for each way of reaching one. Two are included:
202
+
203
+ - `manual` (the default): the tool writes the prompt to a file and you ask any model yourself. No account or key.
204
+ - `gemini`: the tool calls Google's Gemini API with your key.
205
+
206
+ Set it in `proofreader.yml`:
181
207
 
182
208
  ```yaml
183
209
  provider: gemini
184
210
  models:
185
211
  - first-choice-model
186
212
  - second-choice-model
213
+ review: true
187
214
  review_models:
188
215
  - another-model
189
216
  ```
190
217
 
191
- - `models` is tried in order. A model that is overloaded, over its limit or not available to your key is skipped, and the next one is used.
192
- - `review_models` is optional. The independent second review prefers a model different from the first audit. Without this setting it uses `models`.
193
- - Without `models`, the tool falls back on a built-in list. Model names change often, so set your own. `yuno-proofreader models` shows which models your key can use.
194
- - Leave out `provider` while only one is installed.
218
+ - `provider` is `manual` or `gemini`. Without it, `manual` is used.
219
+ - With `gemini`, `models` is tried in order. A model that is overloaded, over its limit or not available to your key is skipped, and the next one is used. Without `models`, the tool falls back on a built-in list, but model names change often, so set your own. `yuno-proofreader models` shows which ones your key can use.
220
+ - With `manual`, `models` is only a label that is printed with each prompt, to remind you which model to pick in the chat. Write it without spaces, for example `fable-5.2`.
221
+ - `review` is `true` or `false` (the default). With `true`, every audit is followed by an independent second review by another model, which sends the page to a model a second time. `audit --review` turns it on for one run.
222
+ - `review_models` is optional and only matters when the review is on. The review prefers a model different from the first audit. Without this setting it uses `models`.
223
+ - `generate llms` uses `provider` and `models` too - not the review.
224
+
225
+ ## Asking a model by hand
226
+
227
+ With `provider: manual` (the default), the tool does not call any model. For every question it asks, you do the round trip:
228
+
229
+ 1. The tool writes the question to `tmp/handoff/prompt.md` and tells you which model the settings suggest.
230
+ 2. You paste the file into a chat with that model (or attach it), and the model replies.
231
+ 3. You save the reply as `tmp/handoff/answer.md` and press Enter in the terminal.
232
+
233
+ The tool empties `answer.md` before each question, so an old reply is never taken for a new one, and an earlier reply that was not used is first copied to `answer.previous.md`. If the file is still empty when you press Enter, the tool says so and waits again.
234
+
235
+ The chat should reply with only what the prompt asks for, in one code block. Copy it with the block's copy button: copying rendered text can turn quotes into curly ones, which breaks JSON. For an audit and for `generate llms` the reply is JSON, and a code fence around it is fine. If the reply is not valid JSON, the tool says what is wrong and waits again: fix the file or paste again, then press Enter. Ctrl-C stops.
236
+
237
+ Things to know:
238
+
239
+ - **One paste per page.** An audit asks once. With the independent review (`review: true`) it asks twice, and the review is best started in a new chat, so the model has not seen the first result.
240
+ - **One page at a time.** `audit --next --count=N` is refused for more than one page. Run `audit --next` once per page, or use `provider: gemini`.
241
+ - **A person must be at the terminal.** If nothing can be typed (a cron job, `docker exec -T`), the run fails with "No input to wait on". In a container, run it with `-it` or `docker compose run`, and keep `tmp/handoff` on a mounted folder so you can open the files on your own machine.
242
+ - **No tokens or cost.** The report shows 0 tokens for a manual answer, because the tool cannot see them. Your chat service has its own limits and prices.
243
+ - **Keep it out of version control.** The files hold your page content, so add `tmp/handoff/` to `.gitignore`.
244
+ - **Ctrl-C stops cleanly.** Pages that were already audited are saved, and the page you were on is simply asked again next time.
245
+
246
+ `yuno-proofreader prompt PAGE` shows the same text without any question being asked. To keep the files somewhere else, set `PROOFREADER_HANDOFF_DIR`.
195
247
 
196
248
  ## Previewing what is sent
197
249
 
@@ -214,17 +266,17 @@ The command refuses to run while the settings that describe your site are unfini
214
266
  ## Auditing a page
215
267
 
216
268
  ```
217
- yuno-proofreader audit PAGE [FILE] [--dry-run] [--force] [--verbose]
269
+ yuno-proofreader audit PAGE [FILE] [--dry-run] [--force] [--verbose] [--review]
218
270
  ```
219
271
 
220
- Audits one page, in all its language versions, and updates the sheet. It needs the tabs from `prepare`, the pages from `pages import`, a model API key and the finished settings that describe your site. `PAGE` is a page name from the first column of the `Pages` tab, or any address of the page.
272
+ Audits one page, in all its language versions, and updates the sheet. It needs the tables from prepare, the pages from pages import, a way to ask a model and the finished settings that describe your site. `PAGE` is a page name from the first column of the `Pages` tab, or any address of the page.
221
273
 
222
274
  What happens:
223
275
 
224
276
  1. The page is fetched in every language. If its content has not changed since its last complete audit, it is skipped and no model is called.
225
- 2. A model audits it step by step. A second model, different from the first when your `models` list has another, reviews it independently without seeing the first result.
226
- 3. Both lists are merged. Each new suggestion records who found it in `found_by`: `both`, `audit`, `review`, or `audit (unreviewed)` when the review failed.
227
- 4. The findings are compared with the suggestions already in the sheet for that page:
277
+ 2. A model audits it step by step. With the independent review on, a second model, different from the first when your models list has another, reviews it without seeing the first result.
278
+ 3. Each new suggestion records who found it in found_by: audit (unreviewed) when there was no review or it failed, otherwise both, audit or review.
279
+ 4. The findings are compared with the suggestions already in the results for that page:
228
280
  - A suggestion that is already `open` or `on staging` is counted as seen again (`last_seen`, `amount_seen`), not added twice.
229
281
  - One you marked `rejected` is not added again. One you marked `done` whose text comes back is added as a new row, with "[Reappeared after being marked done]" in the reason.
230
282
  - An `open` or `on staging` suggestion whose quoted text is no longer on the live page is closed and set to `done`. It only closes when the page loaded completely and the suggestion's text had been found on the page when it was written.
@@ -232,15 +284,16 @@ What happens:
232
284
 
233
285
  Reading a suggestion: `verified` says whether the quoted text is on the page (`yes`), only matches when spaces are ignored (`loose`) or is not there at all (`no`, which usually means the model misquoted). `approximate_place` is the heading path of the text, worked out by the tool.
234
286
 
235
- An audit is complete when every language version was fetched and not cut at the size limit, every audit step was answered, and the review answered. Only then is the fingerprint stored. Anything less is written, but the page is audited again next time. `last_audited` means the last time the tool checked the page, and it is also set when an unchanged page is skipped.
287
+ An audit is complete when every language version was fetched and not cut at the size limit, every audit step was answered, and, when the review was asked for, the review answered. Only then is the fingerprint stored. Anything less is written, but the page is audited again next time. `last_audited` means the last time the tool checked the page, and it is also set when an unchanged page is skipped.
236
288
 
237
289
  Options:
238
290
 
239
291
  - `--dry-run` runs everything except the writing. The model is still called, so it costs the same as a real run.
240
292
  - `--force` audits the page even if it has not changed. Use it after you change your settings or the prompt files, which the fingerprint does not notice.
241
293
  - `--verbose` lists every decision, including suggestions that were seen again or suppressed, and the items in the model answers that could not be used.
294
+ - `--review` adds the independent second review for this run, whatever review says.
242
295
 
243
- Each audit makes two model calls with the whole HTML of every language version, so cost depends on your pages and models. The report shows the tokens of each call.
296
+ Each audit makes one model call with the whole HTML of every language version, or two with the review, so cost depends on your pages and models. The report shows the tokens of each call.
244
297
 
245
298
  ### What is in the output
246
299
 
@@ -300,6 +353,38 @@ What is written:
300
353
 
301
354
  The homepage always ranks first. Run it again after big changes to the site. To try other weights, `priority_paths` or boosts without asking the models again, use `--reuse-ai`, which takes their last judgement from the Analysis tab. The weights are in `lib/yuno/proofreader/analysis/weights.yml`, and the model's wording in `analysis/judge.yml`.
302
355
 
356
+ ## Generating llms.txt
357
+
358
+ ```
359
+ yuno-proofreader generate llms [FILE] [--count=N] [--all] [--language=CODE] [--no-ai] [--full-text] [--resume]
360
+ ```
361
+
362
+ Writes an [llms.txt](https://llmstxt.org) for each language of your site: a short guide, in Markdown, that tells AI assistants what the site offers and where to find it. The files go to `data/llms-de.txt`, `data/llms-en.txt` and so on, named after the language codes in your settings. It needs the `Pages` table from `pages import`, and works best after `analyze`.
363
+
364
+ What it does:
365
+
366
+ 1. Fetches the home page and your most important pages in every language, as politely as an audit does: the 50 with the highest `importance` by default, or `--count=N`, or every page with `--all`. Pages the analysis has not ranked come last.
367
+ 2. Groups them into sections by the start of their address. The first part of a path makes a section and the second a subsection, and a group needs at least two pages to get a heading of its own. This needs no model. Other pages end up in a final section (called "More pages" in English).
368
+ 3. Asks a model once per language for the wording: a heading and a summary for every section, and the text beside every link. It works only from the text of your pages, which means the title, the description and the opening paragraphs, whole and never as HTML. The more important a page is, the more it may write about it, and a section's summary is weighed by importance. A section that has an index page is linked from its heading, and the index page is not listed again.
369
+ 4. Checks the answer. A text that does not end in a whole sentence, or that has a number its page does not have, is left out. A link without a text of its own shows the description its page already has. The report lists what was left out.
370
+ 5. Ends each file with links to the `llms.txt` of the other languages.
371
+
372
+ The report prints the address each file is meant for (`/llms.txt` for the default language, and for the others `/en/llms.txt`, `/es/llms.txt` and so on) and the tokens the model used. Read each file before you upload it, because headings and summaries that a model wrote can be wrong. The tool does not publish anything.
373
+
374
+ Options:
375
+
376
+ - `--count=N` and `--all` choose how many pages are read. Grouping works best with all of them.
377
+ - `--language=CODE` writes only that language.
378
+ - `--full-text` hands the model each page's whole text. Without it, each page hands over as much text as its tier allows (about 4,000 characters for tier 1, 2,500 for tier 2, 1,500 for tier 3 and 800 for the rest), always in whole paragraphs.
379
+ - `--no-ai` skips the model: headings come from the addresses, a section's summary is the description of its index page, and the link texts are the descriptions of the pages.
380
+ - `--resume` continues the last run without fetching again. Every normal run saves what it read to `data/llms-pages.json`, so an interrupted run or a failed answer costs no new fetches. With `provider: manual` it uses the answer already in `answer.md` when `prompt.md` holds the prompt of that language, and otherwise writes the prompt of the next language and waits for the reply, so the languages can be done one after the other. It cannot be combined with `--count`, `--all` or `--full-text`, because the saved pages were chosen by the earlier run.
381
+
382
+ Cost: one model call per language, with the texts of every page that was read. With `manual` that is one paste per language. The exit code is 1 when a model could not word a file, and the file is then written without summaries.
383
+
384
+ Publishing: put each file at the address the report names and serve it as UTF-8 text. Without a `charset`, browsers and some tools show umlauts and accents wrongly. To point a page at the file that covers it, the llms.txt spec uses the `describedby` relation, as an HTTP `Link` header (for example `Link: </llms.txt>; rel="describedby"; type="text/markdown"`) or as a `<link>` element.
385
+
386
+ The instructions to the model are in `lib/yuno/proofreader/generate/llm/rules.yml`. Edit them in a checkout or a fork, as with the prompts of the audit.
387
+
303
388
  ## Logging
304
389
 
305
390
  The tool writes a log to stderr, next to the report it prints on stdout. It is meant for runs nobody watches: it says which page was audited, what came of it and what the models used. Set `LOG_LEVEL=info` for one line per run, batch and page, or `debug` to add a line per model call. The default, `warn`, shows only problems.
@@ -323,6 +408,9 @@ With `LOG_FORMAT=json` each line is one JSON object with `severity`, `message` a
323
408
  | `analysis finished` | info | What `analyze` ranked and wrote |
324
409
  | `model failed`, `model paused`, `model answer unusable` | warn | A model that errored, was set aside for a while, or answered without usable JSON |
325
410
  | `model answered` | debug | One model call: the model, seconds and tokens |
411
+ | `second review failed` | warn | The independent review could not be done, so the audit's findings are marked `audit (unreviewed)` |
412
+ | `llms wording failed` | warn | The model could not word an `llms.txt` file, so it was written without summaries |
413
+ | `run interrupted` | info | The run was stopped with Ctrl-C |
326
414
 
327
415
  Page content, prompts, model answers and keys are never logged.
328
416
 
@@ -345,10 +433,30 @@ The `sitemap` command shows what was found and any warnings.
345
433
 
346
434
  Pages that exist in one language only go under `default_language_only_paths`, and pages you don't want checked under `skip_paths`. If the lists don't match up, the tool says so and writes nothing, because a wrong pairing would produce wrong findings on every page.
347
435
 
348
- ## Working with the sheet
436
+ ## Where the results are kept
349
437
 
350
- The tool keeps its work in one Google Sheet: a queue of pages and a list of suggestions.
351
- Both commands below need `SPREADSHEET_ID` and working Google access (see "Connecting to Google"), and neither needs a Gemini key.
438
+ The tool keeps its work in three tables: `Pages` (the queue), `Suggestions` and `Analysis`. Where they live is up to you, in `proofreader.yml`:
439
+
440
+ ```yaml
441
+ store: csv
442
+ data_dir: data
443
+ ```
444
+
445
+ - `store` is `csv` (the default) or `sheets`. With `csv` the tables are three files in the data folder (`pages.csv`, `suggestions.csv` and `analysis.csv`), which you can open in any spreadsheet program or text editor. No account is needed. With `sheets` they are tabs in a Google Sheet, which needs `SPREADSHEET_ID` and Google credentials (see "Connecting to Google").
446
+ - `data_dir` is the folder for the CSV files, relative to where you run the tool, and `~` works. With `sheets` it holds no tables, but `generate` writes its files there with either store. The tool creates it when it needs it.
447
+
448
+ Good to know about the CSV files:
449
+
450
+ - **They are the tool's memory.** They hold the fingerprints that let it skip unchanged pages, and your `status` decisions. Delete them and every suggestion you rejected comes back. Back them up, and add `data/` to `.gitignore` unless you want quoted page text in version control.
451
+ - **In a container, keep the folder on a mounted volume.** A job that starts empty every time, such as a Cloud Run job or a Kubernetes CronJob without a volume, would forget everything. Use `store: sheets` there.
452
+ - **One person at a time.** There is no lock, so do not edit a file while an audit runs, and do not run two at once.
453
+ - **There is no dropdown for `status`.** Type it exactly: `open`, `on staging`, `done` or `rejected`.
454
+ - **Times are UTC**, written like `2026-11-12 04:50`, and the files are UTF-8.
455
+ - **Switching later copies nothing.** The other store starts empty. `pages import` fills it again, but earlier suggestions and fingerprints stay behind, so every page is audited again.
456
+
457
+ ## Working with the results
458
+
459
+ Both commands below create and fill the tables described in "Where the results are kept". They need `SPREADSHEET_ID` and working Google access only with `store: sheets` (see "Connecting to Google"), and neither needs a model key.
352
460
 
353
461
  ```
354
462
  yuno-proofreader prepare
@@ -359,26 +467,25 @@ Run them in this order, from the folder that contains your `proofreader.yml` (or
359
467
 
360
468
  ### prepare
361
469
 
362
- Creates two tabs in your spreadsheet:
363
-
364
- - **Pages**: one row per page of your site. Columns: `page_name`, one `<code>_url` column per language of your settings, `last_audited`, `fingerprint`, `note` and `sitemap_lastmod`.
365
- - **Suggestions**: one row per suggested fix. Columns: `timestamp`, `page`, `language`, `category`, `effort`, `approximate_place`, `original`, `suggested`, `reason`, `verified`, `status`, `found_by`, `last_seen` and `amount_seen`. `status` is a dropdown with `open`, `on staging`, `done` and `rejected`.
470
+ Creates three tables, as CSV files or as tabs of your spreadsheet:
366
471
 
367
- Both tabs get a frozen header row and date formats. An empty default tab (`Sheet1`) is removed.
472
+ - **Pages**: one row per page of your site. Columns: `page_name`, one `<code>_url` column per language of your settings, `last_audited`, `fingerprint`, `note`, `sitemap_lastmod`, and the columns the analysis fills in: `importance`, `tier`, `importance_notes`, `analyzed_at` and `boost`.
473
+ - **Suggestions**: one row per suggested fix. Columns: `timestamp`, `page`, `language`, `category`, `effort`, `approximate_place`, `original`, `suggested`, `reason`, `verified`, `status`, `found_by`, `last_seen` and `amount_seen`. In a Google Sheet, `status` is a dropdown with `open`, `on staging`, `done` and `rejected`.
474
+ - **Analysis**: one row per page with the measurements behind its importance. It is written by `analyze` and rewritten on every run.
368
475
 
369
- It is safe to run again. A tab that already has a header row is left as it is, and the tool only checks that its required columns exist.
370
- To apply the formatting again, delete the tab and run `prepare` once more.
476
+ It is safe to run again. A table that already has a header row is left as it is, and the tool only checks that its required columns exist.
477
+ With a Google Sheet, the tabs also get a frozen header row, date formats and the dropdown, and an empty default tab (`Sheet1`) is removed. To apply the formatting again, delete the tab and run `prepare` once more.
371
478
 
372
479
  ### pages import
373
480
 
374
- Reads your sitemap and adds each page to the `Pages` tab, with its address in every language. It needs the tabs from `prepare`.
481
+ Reads your sitemap and adds each page to the `Pages` table, with its address in every language. It needs the tables from `prepare`.
375
482
 
376
- - Pages that are already in the sheet are skipped (they are recognised by their address in the default language), so running it again only adds new pages.
377
- - Nothing is overwritten. Pages that have left the sitemap stay in the sheet, and the command tells you how many.
483
+ - Pages that are already there are skipped (they are recognised by their address in the default language), so running it again only adds new pages.
484
+ - Nothing is overwritten. Pages that have left the sitemap stay, and the command tells you how many.
378
485
  - If the pages cannot be paired by language, it writes nothing. The `sitemap` command shows why.
379
486
  - A row you delete comes back at the next import. To exclude a page for good, add it to `skip_paths` in your settings file.
380
487
 
381
- ### Editing the sheet
488
+ ### Editing the results
382
489
 
383
490
  Columns are found by their header names, so you can reorder them or add columns of your own. Don't rename the columns listed above. Times are stored in UTC.
384
491
 
@@ -407,6 +514,10 @@ To build the production image:
407
514
  podman build -t yuno-proofreader .
408
515
  ```
409
516
 
517
+ ```
518
+ bundle exec exe/yuno-proofreader help
519
+ ```
520
+
410
521
  ### Trying it on your own site
411
522
 
412
523
  ```
@@ -12,13 +12,17 @@ module Yuno
12
12
  # The second review: the call, or why there is none.
13
13
  Review = Data.define(:asked, :error)
14
14
 
15
- # The two model calls for one page and what was read from them. audit_read and review_read are
16
- # Answers::Result values. review_read is nil when the review failed or its answer could not be used.
15
+ # The model calls for one page and what was read from them. review is nil when no review was asked for
17
16
  Attempt = Data.define(:first, :review, :audit_read, :review_read) do
18
- def calls = [first.call, review.asked&.call].compact
17
+ def calls = [first.call, review&.asked&.call].compact
18
+
19
+ def review_asked? = !review.nil?
19
20
 
20
21
  def reviewed? = !review_read.nil?
21
22
 
23
+ # A review that was not asked for does not stop an audit from being complete.
24
+ def review_done? = !review_asked? || reviewed?
25
+
22
26
  def missing_steps = audit_read.missing_steps
23
27
 
24
28
  def discarded = [*audit_read.discarded, *Array(review_read&.discarded)]
@@ -31,9 +35,10 @@ module Yuno
31
35
  private
32
36
 
33
37
  def unusable_versions(fetched)
38
+ left_out = review_asked? ? "the review" : "the audit"
34
39
  fetched.snapshots.reject(&:ok?).map do |snapshot|
35
40
  "The #{snapshot.language} version could not be used (#{snapshot.problem}), " \
36
- "so it was left out of the review."
41
+ "so it was left out of #{left_out}."
37
42
  end
38
43
  end
39
44
 
@@ -44,6 +49,8 @@ module Yuno
44
49
  end
45
50
 
46
51
  def review_notes
52
+ return [] unless review_asked?
53
+
47
54
  if review.error
48
55
  ["The second review failed (#{review.error}). New findings are marked 'audit (unreviewed)'."]
49
56
  elsif review_read.nil?
@@ -4,16 +4,16 @@ module Yuno
4
4
  module Proofreader
5
5
  module Audit
6
6
  # One page of a batch: what was done and what came of it. status is :audited, :skipped (unchanged, so no model
7
- # was called) or :failed. result is the audit's result, and error says what went wrong with a failed page.
7
+ # was called) or :failed
8
8
  BatchEntry = Data.define(:pick, :status, :result, :error)
9
9
 
10
- # The pages of a batch in the order they were done. stopped says why the batch ended early, or is nil.
10
+ # The pages of a batch in the order they were done
11
11
  BatchOutcome = Data.define(:entries, :stopped)
12
12
 
13
13
  # Audits a list of pages one after another. A page that fails for a reason of its own is reported and set aside
14
14
  # (marked as audited without a fingerprint, so it comes due again after the retry period and does not hold up
15
15
  # the queue), and the batch goes on. A problem that would hit every page (no model available, the sheet not
16
- # reachable, bad settings) ends the batch. Each page, each failure and an early end are written to the log.
16
+ # reachable, bad settings) ends the batch
17
17
  class Batch
18
18
  FATAL = [LlmError, StoreError, ConfigError].freeze
19
19
 
@@ -45,6 +45,8 @@ module Yuno
45
45
  result = @runner.run(pick.record.name, dry_run:, force:)
46
46
  LogFields.record(@log, result, reason: pick.reason)
47
47
  BatchEntry.new(pick:, status: result.status, result:, error: nil)
48
+ rescue Llm::UnusableAnswersError => e
49
+ fail_page(pick, e, dry_run)
48
50
  rescue Error => e
49
51
  raise if FATAL.any? { |kind| e.is_a?(kind) }
50
52
 
@@ -45,8 +45,11 @@ module Yuno
45
45
 
46
46
  def call_lines
47
47
  audit = @result.calls.find { |call| call.role == :audit }
48
+ lines = [" #{call_line('Audit: ', audit)}"]
49
+ return lines unless @result.review_requested
50
+
48
51
  review = @result.calls.find { |call| call.role == :review }
49
- [" #{call_line('Audit: ', audit)}", " #{call_line('Review: ', review)}"]
52
+ [*lines, " #{call_line('Review: ', review)}"]
50
53
  end
51
54
 
52
55
  def call_line(label, call)
@@ -57,6 +60,8 @@ module Yuno
57
60
  end
58
61
 
59
62
  def findings_line
63
+ return "Findings: #{@result.audit_count} from the audit." unless @result.review_requested
64
+
60
65
  review = @result.review_count.nil? ? "no review" : "#{@result.review_count} from the review"
61
66
  "Findings: #{@result.audit_count} from the audit, #{review}."
62
67
  end