readability-cli 0.6.0__tar.gz → 0.7.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.
Files changed (29) hide show
  1. {readability_cli-0.6.0 → readability_cli-0.7.0}/PKG-INFO +69 -9
  2. {readability_cli-0.6.0 → readability_cli-0.7.0}/README.md +68 -8
  3. {readability_cli-0.6.0 → readability_cli-0.7.0}/pyproject.toml +1 -1
  4. {readability_cli-0.6.0 → readability_cli-0.7.0}/readability.py +518 -45
  5. readability_cli-0.7.0/test_readability.py +1341 -0
  6. readability_cli-0.6.0/test_readability.py +0 -711
  7. {readability_cli-0.6.0 → readability_cli-0.7.0}/.github/workflows/ci.yml +0 -0
  8. {readability_cli-0.6.0 → readability_cli-0.7.0}/.github/workflows/publish.yml +0 -0
  9. {readability_cli-0.6.0 → readability_cli-0.7.0}/.github/workflows/update-guides.yml +0 -0
  10. {readability_cli-0.6.0 → readability_cli-0.7.0}/.gitignore +0 -0
  11. {readability_cli-0.6.0 → readability_cli-0.7.0}/.python-version +0 -0
  12. {readability_cli-0.6.0 → readability_cli-0.7.0}/LICENSE +0 -0
  13. {readability_cli-0.6.0 → readability_cli-0.7.0}/configs/pyrefly.toml +0 -0
  14. {readability_cli-0.6.0 → readability_cli-0.7.0}/configs/ruff.toml +0 -0
  15. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/Rguide.md +0 -0
  16. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/cppguide.md +0 -0
  17. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/csharp-style.md +0 -0
  18. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/docguide-style.md +0 -0
  19. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/go-guide.md +0 -0
  20. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/htmlcssguide.md +0 -0
  21. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/javaguide.md +0 -0
  22. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/jsguide.md +0 -0
  23. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/jsoncstyleguide.md +0 -0
  24. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/objcguide.md +0 -0
  25. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/pyguide.md +0 -0
  26. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/shellguide.md +0 -0
  27. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/tsguide.md +0 -0
  28. {readability_cli-0.6.0 → readability_cli-0.7.0}/guides/vimscriptguide.md +0 -0
  29. {readability_cli-0.6.0 → readability_cli-0.7.0}/uv.lock +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: readability-cli
3
- Version: 0.6.0
3
+ Version: 0.7.0
4
4
  Summary: A CLI to lint, format, and type-check code with Google-style defaults, and pull Google style guides in markdown format.
5
5
  Project-URL: Homepage, https://github.com/owahltinez/readability
6
6
  Project-URL: Repository, https://github.com/owahltinez/readability
@@ -27,7 +27,8 @@ and quick access to style conventions without browsing HTML pages.
27
27
  - **Sensible Defaults**: Bundled Google-style configurations for Ruff and
28
28
  Pyrefly are used automatically when a project does not define its own.
29
29
  - **Style Guides**: A `guide` command that fetches the latest Google style
30
- guides (Python, Shell, C++, Java, JS/TS, Go, etc.) converted to Markdown.
30
+ guides (Python, Shell, C++, Java, JS/TS, Go, etc.) converted to Markdown,
31
+ navigable by outline and by section rather than read whole.
31
32
  - **Offline Mode**: Local caching of style guides for fast, offline access,
32
33
  kept fresh with a single `sync` command.
33
34
 
@@ -128,18 +129,77 @@ readability guide python --remote
128
129
  # Save a style guide to a file
129
130
  readability guide cpp --output cpp-style.md
130
131
 
131
- # Print where the guide already lives, to search it without copying it
132
- readability guide python --path
133
- grep -n "Naming" "$(readability guide python --path)"
132
+ # Search a guide without printing it: the pipe carries it, you see matches
133
+ readability guide python | grep -n "f-string"
134
134
 
135
135
  # Synchronize all supported style guides to the local cache
136
136
  readability sync
137
137
  ```
138
138
 
139
- A guide can exceed 100 KB, so `--path` is the cheap way to consult one: the
140
- file is already on disk, and searching it beats reading it whole or writing
141
- out a second copy. It is also what a coding agent should use, rather than
142
- redirecting the guide into a repository.
139
+ A guide can exceed 100 KB, so printing one whole is rarely what you want.
140
+ `--outline` and `--section` below cover navigating to a rule; piping to
141
+ `grep` covers finding wording that no heading names. Neither leaves a copy
142
+ behind, which is what a coding agent should do rather than redirecting a
143
+ guide into the repository it is working on.
144
+
145
+ ### Navigating a Guide
146
+
147
+ `--outline` lists a guide's headings and `--section` prints just one of them,
148
+ which turns "read 200 KB" into "list the sections, fetch the one you need":
149
+
150
+ ```bash
151
+ # List every heading, with the index to pass to --section
152
+ readability guide cpp --outline
153
+
154
+ # Only the top two levels, for a bird's eye view of a large guide
155
+ readability guide cpp --outline --depth 2
156
+
157
+ # Print one section: its heading and everything nested under it
158
+ readability guide shell --section "Function Comments"
159
+ readability guide cpp --section 10.4
160
+
161
+ # Sections can be saved like whole guides can
162
+ readability guide python --section "Imports" --output imports.md
163
+ ```
164
+
165
+ A section reference can be any of the following:
166
+
167
+ | Reference | Example |
168
+ |-----------|---------|
169
+ | Section index, as shown by `--outline` | `--section 2.2.4` |
170
+ | Heading text, case-insensitive, or its slug | `--section "function comments"` |
171
+ | A parent-scoped path, spaces around the `>` | `--section "Imports > Decision"` |
172
+
173
+ Whole matches are preferred; a reference that matches nothing in full is
174
+ retried as a substring of the heading text.
175
+
176
+ Three of the shipped guides — Python, JavaScript, and Java — number their own
177
+ sections, and those numbers are the index. A rule cited from the outline then
178
+ matches the published guide exactly, including where the guide skips a
179
+ number: the Python guide has no 2.15 at all, so its 2.16 is listed as 2.16
180
+ rather than renumbered. The other eleven guides number nothing, so their
181
+ index comes from each heading's position in the tree.
182
+
183
+ Either way the index is unique, which is what makes a repeated heading
184
+ addressable — `Definition`, `Pros`, `Cons`, and `Decision` appear under every
185
+ rule in the Python guide. For a reference stored and used later, prefer a
186
+ printed section number or the heading text over a positional index, since
187
+ positional indices shift when an unnumbered guide is re-synced.
188
+
189
+ A reference that matches several headings is reported rather than guessed at,
190
+ listing the index and path of every candidate on stderr:
191
+
192
+ ```bash
193
+ $ readability guide python --section Decision
194
+ Error: 'Decision' matches 19 headings in the 'python' guide. Repeat with one of:
195
+ --section 2.1.4 (Python Language Rules > Lint > Decision)
196
+ --section 2.2.4 (Python Language Rules > Imports > Decision)
197
+ ...
198
+ ```
199
+
200
+ Content goes to stdout and diagnostics to stderr, so both flags are safe to
201
+ pipe. Headings inside fenced code blocks are ignored, which matters for the
202
+ Shell and Python guides where `#` starts a comment.
143
203
 
144
204
  ### Supported Languages
145
205
 
@@ -13,7 +13,8 @@ and quick access to style conventions without browsing HTML pages.
13
13
  - **Sensible Defaults**: Bundled Google-style configurations for Ruff and
14
14
  Pyrefly are used automatically when a project does not define its own.
15
15
  - **Style Guides**: A `guide` command that fetches the latest Google style
16
- guides (Python, Shell, C++, Java, JS/TS, Go, etc.) converted to Markdown.
16
+ guides (Python, Shell, C++, Java, JS/TS, Go, etc.) converted to Markdown,
17
+ navigable by outline and by section rather than read whole.
17
18
  - **Offline Mode**: Local caching of style guides for fast, offline access,
18
19
  kept fresh with a single `sync` command.
19
20
 
@@ -114,18 +115,77 @@ readability guide python --remote
114
115
  # Save a style guide to a file
115
116
  readability guide cpp --output cpp-style.md
116
117
 
117
- # Print where the guide already lives, to search it without copying it
118
- readability guide python --path
119
- grep -n "Naming" "$(readability guide python --path)"
118
+ # Search a guide without printing it: the pipe carries it, you see matches
119
+ readability guide python | grep -n "f-string"
120
120
 
121
121
  # Synchronize all supported style guides to the local cache
122
122
  readability sync
123
123
  ```
124
124
 
125
- A guide can exceed 100 KB, so `--path` is the cheap way to consult one: the
126
- file is already on disk, and searching it beats reading it whole or writing
127
- out a second copy. It is also what a coding agent should use, rather than
128
- redirecting the guide into a repository.
125
+ A guide can exceed 100 KB, so printing one whole is rarely what you want.
126
+ `--outline` and `--section` below cover navigating to a rule; piping to
127
+ `grep` covers finding wording that no heading names. Neither leaves a copy
128
+ behind, which is what a coding agent should do rather than redirecting a
129
+ guide into the repository it is working on.
130
+
131
+ ### Navigating a Guide
132
+
133
+ `--outline` lists a guide's headings and `--section` prints just one of them,
134
+ which turns "read 200 KB" into "list the sections, fetch the one you need":
135
+
136
+ ```bash
137
+ # List every heading, with the index to pass to --section
138
+ readability guide cpp --outline
139
+
140
+ # Only the top two levels, for a bird's eye view of a large guide
141
+ readability guide cpp --outline --depth 2
142
+
143
+ # Print one section: its heading and everything nested under it
144
+ readability guide shell --section "Function Comments"
145
+ readability guide cpp --section 10.4
146
+
147
+ # Sections can be saved like whole guides can
148
+ readability guide python --section "Imports" --output imports.md
149
+ ```
150
+
151
+ A section reference can be any of the following:
152
+
153
+ | Reference | Example |
154
+ |-----------|---------|
155
+ | Section index, as shown by `--outline` | `--section 2.2.4` |
156
+ | Heading text, case-insensitive, or its slug | `--section "function comments"` |
157
+ | A parent-scoped path, spaces around the `>` | `--section "Imports > Decision"` |
158
+
159
+ Whole matches are preferred; a reference that matches nothing in full is
160
+ retried as a substring of the heading text.
161
+
162
+ Three of the shipped guides — Python, JavaScript, and Java — number their own
163
+ sections, and those numbers are the index. A rule cited from the outline then
164
+ matches the published guide exactly, including where the guide skips a
165
+ number: the Python guide has no 2.15 at all, so its 2.16 is listed as 2.16
166
+ rather than renumbered. The other eleven guides number nothing, so their
167
+ index comes from each heading's position in the tree.
168
+
169
+ Either way the index is unique, which is what makes a repeated heading
170
+ addressable — `Definition`, `Pros`, `Cons`, and `Decision` appear under every
171
+ rule in the Python guide. For a reference stored and used later, prefer a
172
+ printed section number or the heading text over a positional index, since
173
+ positional indices shift when an unnumbered guide is re-synced.
174
+
175
+ A reference that matches several headings is reported rather than guessed at,
176
+ listing the index and path of every candidate on stderr:
177
+
178
+ ```bash
179
+ $ readability guide python --section Decision
180
+ Error: 'Decision' matches 19 headings in the 'python' guide. Repeat with one of:
181
+ --section 2.1.4 (Python Language Rules > Lint > Decision)
182
+ --section 2.2.4 (Python Language Rules > Imports > Decision)
183
+ ...
184
+ ```
185
+
186
+ Content goes to stdout and diagnostics to stderr, so both flags are safe to
187
+ pipe. Headings inside fenced code blocks are ignored, which matters for the
188
+ Shell and Python guides where `#` starts a comment.
129
189
 
130
190
  ### Supported Languages
131
191
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "readability-cli"
3
- version = "0.6.0"
3
+ version = "0.7.0"
4
4
  description = "A CLI to lint, format, and type-check code with Google-style defaults, and pull Google style guides in markdown format."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"