agent-readable 0.2.1__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 (31) hide show
  1. {agent_readable-0.2.1 → agent_readable-0.3.1}/.github/workflows/ci.yml +3 -0
  2. {agent_readable-0.2.1 → agent_readable-0.3.1}/.gitignore +3 -0
  3. {agent_readable-0.2.1 → agent_readable-0.3.1}/CHANGELOG.md +60 -1
  4. {agent_readable-0.2.1 → agent_readable-0.3.1}/PKG-INFO +5 -4
  5. {agent_readable-0.2.1 → agent_readable-0.3.1}/README.md +3 -2
  6. {agent_readable-0.2.1 → agent_readable-0.3.1}/docs/authoring.md +6 -6
  7. agent_readable-0.3.1/docs/benchmark.md +79 -0
  8. {agent_readable-0.2.1 → agent_readable-0.3.1}/docs/examples.md +2 -2
  9. {agent_readable-0.2.1 → agent_readable-0.3.1}/docs/getting-started.md +46 -19
  10. {agent_readable-0.2.1 → agent_readable-0.3.1}/pyproject.toml +12 -1
  11. agent_readable-0.3.1/scripts/benchmark.py +243 -0
  12. agent_readable-0.3.1/src/agent_readable/__main__.py +77 -0
  13. {agent_readable-0.2.1 → agent_readable-0.3.1}/src/agent_readable/_model.py +130 -17
  14. {agent_readable-0.2.1 → agent_readable-0.3.1}/src/agent_readable/_protocol.py +37 -47
  15. {agent_readable-0.2.1 → agent_readable-0.3.1}/src/agent_readable/_render.py +12 -2
  16. {agent_readable-0.2.1 → agent_readable-0.3.1}/tests/test_cli.py +31 -23
  17. {agent_readable-0.2.1 → agent_readable-0.3.1}/tests/test_protocol.py +251 -27
  18. agent_readable-0.2.1/src/agent_readable/__main__.py +0 -59
  19. {agent_readable-0.2.1 → agent_readable-0.3.1}/.github/workflows/publish.yml +0 -0
  20. {agent_readable-0.2.1 → agent_readable-0.3.1}/LICENSE +0 -0
  21. {agent_readable-0.2.1 → agent_readable-0.3.1}/docs/agent_help_vs_help.gif +0 -0
  22. {agent_readable-0.2.1 → agent_readable-0.3.1}/docs/faq.md +0 -0
  23. {agent_readable-0.2.1 → agent_readable-0.3.1}/docs/why.md +0 -0
  24. {agent_readable-0.2.1 → agent_readable-0.3.1}/examples/any_class.py +0 -0
  25. {agent_readable-0.2.1 → agent_readable-0.3.1}/examples/duck_type.py +0 -0
  26. {agent_readable-0.2.1 → agent_readable-0.3.1}/examples/modules_and_functions.py +0 -0
  27. {agent_readable-0.2.1 → agent_readable-0.3.1}/examples/sqlite_connection.py +0 -0
  28. {agent_readable-0.2.1 → agent_readable-0.3.1}/examples/temperature.py +0 -0
  29. {agent_readable-0.2.1 → agent_readable-0.3.1}/src/agent_readable/__init__.py +0 -0
  30. {agent_readable-0.2.1 → agent_readable-0.3.1}/src/agent_readable/py.typed +0 -0
  31. {agent_readable-0.2.1 → agent_readable-0.3.1}/tests/__init__.py +0 -0
@@ -24,6 +24,9 @@ jobs:
24
24
  - name: Ruff format check
25
25
  run: uv run ruff format --check
26
26
 
27
+ - name: Mypy
28
+ run: uv run mypy
29
+
27
30
  test:
28
31
  runs-on: ubuntu-latest
29
32
  strategy:
@@ -43,3 +43,6 @@ hatch.toml
43
43
 
44
44
  # No external dependencies for this project, and uv.lock is only needed for local dev.
45
45
  uv.lock
46
+
47
+ # Local scratch files (audits, drafts, planning docs)
48
+ .localonly/
@@ -7,6 +7,63 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.1] - 2026-08-23
11
+
12
+ ### Documentation
13
+
14
+ - Restructured the getting-started one-off CLI section into two parallel
15
+ series, uv and pip, each with a one-off command and a repeated-use install,
16
+ and added a "Your own project" section for documenting project-local
17
+ targets.
18
+
19
+ ## [0.3.0] - 2026-08-23
20
+
21
+ ### Added
22
+
23
+ - Console script `agent-readable`, so one-off use is
24
+ `uvx agent-readable sqlite3:Connection` instead of
25
+ `uvx --from agent-readable python -m agent_readable sqlite3:Connection`.
26
+ `python -m agent_readable` keeps working.
27
+ - `--version` flag for the CLI.
28
+ - Public class attributes and module constants are now listed in the Public API
29
+ section with their current value: `repr` for exact primitive types (never
30
+ executing a custom `__repr__`), the type name otherwise.
31
+ - Enum members are listed (e.g. ``- `RED` member: 1``), and the misleading
32
+ `EnumMeta.__call__` constructor signature is no longer shown for enum
33
+ classes.
34
+ - Module docs now include C builtins (`inspect.isroutine` instead of
35
+ `inspect.isfunction`), so `agent_help(math)` lists `sin` alongside
36
+ pure-Python functions, and module-level constants such as `math.pi` are no
37
+ longer dropped by the origin heuristic.
38
+ - A constructor that introspection renders as the placeholder `(*args,
39
+ **kwargs)` — e.g. masked by a metaclass `__call__` — now falls back to the
40
+ class's `__init__`/`__new__` signature.
41
+ - Mypy type-checking job in CI.
42
+ - Benchmark harness (`scripts/benchmark.py`) and methodology
43
+ (`docs/benchmark.md`) for measuring whether `agent_help()` context reduces
44
+ hallucinated-API failures versus a baseline prompt. Status: not yet run;
45
+ no numbers are claimed until a real run is recorded.
46
+
47
+ ### Changed
48
+
49
+ - **Breaking:** `__agent_notes__()` sections are now always appended, including
50
+ after a custom `__agent_help__()`'s output. Previously the notes were
51
+ silently dropped when a custom `__agent_help__` was defined and a
52
+ `UserWarning` was emitted; defining both is now a supported combination and
53
+ the warning is gone. For full verbatim control of the entire output, do not
54
+ define `__agent_notes__()` anywhere in the MRO.
55
+ - The CLI prints a one-line `error: ...` message to stderr and exits with
56
+ status 2 for targets that cannot be imported or resolved, instead of raising
57
+ a traceback.
58
+
59
+ ### Fixed
60
+
61
+ - A raising `__agent_notes__()` no longer breaks `agent_help()` for the class
62
+ and all of its subclasses; the broken notes are skipped, mirroring the
63
+ existing `__agent_help__()` fallback.
64
+ - `functools.cached_property` members are no longer silently dropped from the
65
+ Public API; they render as properties with the wrapped function's docstring.
66
+
10
67
  ## [0.2.1] - 2026-07-04
11
68
 
12
69
  ### Documentation
@@ -86,7 +143,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
86
143
  `AgentReadableMixin`, `__agent_notes__` accumulation across the MRO, module
87
144
  support, and the `python -m agent_readable` CLI.
88
145
 
89
- [Unreleased]: https://github.com/zydo/agent-readable/compare/v0.2.1...HEAD
146
+ [Unreleased]: https://github.com/zydo/agent-readable/compare/v0.3.1...HEAD
147
+ [0.3.1]: https://github.com/zydo/agent-readable/compare/v0.3.0...v0.3.1
148
+ [0.3.0]: https://github.com/zydo/agent-readable/compare/v0.2.1...v0.3.0
90
149
  [0.2.1]: https://github.com/zydo/agent-readable/compare/v0.2.0...v0.2.1
91
150
  [0.1.2]: https://github.com/zydo/agent-readable/compare/v0.1.1...v0.1.2
92
151
  [0.1.1]: https://github.com/zydo/agent-readable/compare/v0.1.0...v0.1.1
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: agent-readable
3
- Version: 0.2.1
3
+ Version: 0.3.1
4
4
  Summary: A lightweight Python protocol for agent-oriented documentation
5
5
  Project-URL: Repository, https://github.com/zydo/agent-readable
6
6
  Project-URL: Issues, https://github.com/zydo/agent-readable/issues
@@ -40,13 +40,13 @@ npx skills add zydo/skills --skill agent-readable
40
40
  <!-- markdownlint-disable MD033 -->
41
41
  <p align="center">
42
42
  <strong><code>logging.Logger</code> compared with <code>agent_help()</code> and <code>help()</code></strong><br>
43
- <img src="docs/agent_help_vs_help.gif" alt="agent_help vs help">
43
+ <img src="https://raw.githubusercontent.com/zydo/agent-readable/main/docs/agent_help_vs_help.gif" alt="agent_help vs help">
44
44
  </p>
45
45
  <!-- markdownlint-enable MD033 -->
46
46
 
47
47
  ## Quickstart
48
48
 
49
- See [Getting started](docs/getting-started.md) for installation, one-off CLI usage with `uvx`, `uv tool run`, or `pipx`, and full CLI examples.
49
+ See [Getting started](docs/getting-started.md) for installation and one-off CLI usage in two parallel series — uv and pip.
50
50
 
51
51
  ```python
52
52
  from agent_readable import agent_help
@@ -86,6 +86,7 @@ class Sensor:
86
86
  - [Examples](docs/examples.md): wrapping existing classes, inherited notes, duck typing, plain classes, modules, functions, and methods.
87
87
  - [Authoring guide](docs/authoring.md): `__agent_help__`, `__agent_notes__`, class docstring hints, freshness guidance, and API reference.
88
88
  - [FAQ](docs/faq.md): common questions about agent skills, docstrings, `AGENTS.md`, third-party libraries, and constrained decoding.
89
+ - [Benchmark](docs/benchmark.md): methodology and harness measuring whether `agent_help()` context reduces hallucinated-API failures.
89
90
 
90
91
  ## Other Languages
91
92
 
@@ -13,13 +13,13 @@ npx skills add zydo/skills --skill agent-readable
13
13
  <!-- markdownlint-disable MD033 -->
14
14
  <p align="center">
15
15
  <strong><code>logging.Logger</code> compared with <code>agent_help()</code> and <code>help()</code></strong><br>
16
- <img src="docs/agent_help_vs_help.gif" alt="agent_help vs help">
16
+ <img src="https://raw.githubusercontent.com/zydo/agent-readable/main/docs/agent_help_vs_help.gif" alt="agent_help vs help">
17
17
  </p>
18
18
  <!-- markdownlint-enable MD033 -->
19
19
 
20
20
  ## Quickstart
21
21
 
22
- See [Getting started](docs/getting-started.md) for installation, one-off CLI usage with `uvx`, `uv tool run`, or `pipx`, and full CLI examples.
22
+ See [Getting started](docs/getting-started.md) for installation and one-off CLI usage in two parallel series — uv and pip.
23
23
 
24
24
  ```python
25
25
  from agent_readable import agent_help
@@ -59,6 +59,7 @@ class Sensor:
59
59
  - [Examples](docs/examples.md): wrapping existing classes, inherited notes, duck typing, plain classes, modules, functions, and methods.
60
60
  - [Authoring guide](docs/authoring.md): `__agent_help__`, `__agent_notes__`, class docstring hints, freshness guidance, and API reference.
61
61
  - [FAQ](docs/faq.md): common questions about agent skills, docstrings, `AGENTS.md`, third-party libraries, and constrained decoding.
62
+ - [Benchmark](docs/benchmark.md): methodology and harness measuring whether `agent_help()` context reduces hallucinated-API failures.
62
63
 
63
64
  ## Other Languages
64
65
 
@@ -28,13 +28,13 @@ The two dunders intentionally encode different composition rules:
28
28
 
29
29
  | Aspect | `__agent_help__()` | `__agent_notes__()` |
30
30
  | --------------- | ------------------------------------------ | ----------------------------------------------------------------------------- |
31
- | Semantics | Replacement: returned string is the output | Additive: appended to auto-generated docs |
31
+ | Semantics | Replaces the auto-generated base document | Additive: appended after the auto-doc or custom `__agent_help__()` output |
32
32
  | Composition | Single class wins, closest in MRO | Accumulated across the MRO; leaf class wins on conflict |
33
- | When to use | Total control over rendered text | Auto-doc plus extra do/don't rules |
34
- | Skipped when | Always called if defined | Silently dropped, with `UserWarning`, when custom `__agent_help__` is present |
33
+ | When to use | Custom control over the base document | Extra do/don't rules on top of any base |
34
+ | Skipped when | Always called if defined | Never skipped when defined; a notes method that raises is skipped |
35
35
  | Mixin required? | No | No |
36
36
 
37
- When a class defines both `__agent_help__()` and `__agent_notes__()`, the notes are silently dropped because `__agent_help__()` owns the output and the auto-doc plus notes path never runs. A `UserWarning` is emitted, but warnings are easy to miss in agent shells, CI logs, and notebooks. Treat "both defined" as a review error. Fix it by folding the notes into `__agent_help__()`, or by dropping custom `__agent_help__()` and letting the auto-doc plus notes path run.
37
+ When a class defines both `__agent_help__()` and `__agent_notes__()`, the custom help replaces the auto-generated base document and the notes are appended after it — the same additive behavior as the auto-doc path, so no combination of the two dunders silently drops notes. If you need full verbatim control of the entire output, do not define `__agent_notes__()` anywhere in the class hierarchy.
38
38
 
39
39
  ## Class docstring hints
40
40
 
@@ -58,9 +58,9 @@ This way, even agents that only see the source or call `help()` are reminded to
58
58
 
59
59
  Render agent-oriented Markdown for a class, module, function, or method.
60
60
 
61
- For classes, the output includes purpose, constructor, public API, default usage rules, and accumulated `__agent_notes__()` sections when present. For modules, it includes purpose, public functions, and public classes. For functions and methods, it includes signature, docstring, and default usage rules.
61
+ For classes, the output includes purpose, constructor, public API (methods, properties, cached properties, constants, and enum members), default usage rules, and accumulated `__agent_notes__()` sections when present. For modules, it includes purpose, public functions (including C builtins), public classes, and constants. For functions and methods, it includes signature, docstring, and default usage rules.
62
62
 
63
- For classes and instances, if `__agent_help__()` is defined through the mixin or duck typing, it is called and its return value is used verbatim. Duck-typed implementations are responsible for their own formatting, and notes are not auto-appended. If such a class also defines `__agent_notes__()`, a `UserWarning` is emitted because those notes are silently dropped. Fold them into `__agent_help__()`, or drop the custom `__agent_help__()` to use the auto-doc path. If `__agent_help__()` raises, `agent_help()` falls back to the auto-generated path, which does include notes.
63
+ For classes and instances, if `__agent_help__()` is defined through the mixin or duck typing, it is called and its return value is used as the base document. Duck-typed implementations replace the auto-generated base; `__agent_notes__()` sections from the MRO are still appended after it (the mixin default already embeds notes, so its output is used as-is). If `__agent_help__()` raises, `agent_help()` falls back to the auto-generated path, which does include notes. A `__agent_notes__()` that raises is skipped rather than fatal, so one broken notes method cannot take down help for a class and its subclasses.
64
64
 
65
65
  For modules, if the module defines a `__agent_help__` attribute, either callable or string, it is used. Otherwise, auto-generated docs are produced from the module docstring and its public functions and classes. When the module defines `__all__`, that list is the authoritative public API, so re-exported symbols are included. Otherwise public members are discovered by introspection, skipping private names and anything defined outside the module.
66
66
 
@@ -0,0 +1,79 @@
1
+ # Benchmark: does `agent_help()` context reduce API hallucination?
2
+
3
+ **Status: not yet run.** This page documents the methodology and the harness
4
+ (`scripts/benchmark.py`). No numbers are published until a real run has been
5
+ executed and recorded here — claims in the README about hallucination and
6
+ token efficiency remain unevidenced until then.
7
+
8
+ ## The question
9
+
10
+ When a coding agent writes Python against an API it has not seen (a new
11
+ library, a recent release, a project-private module), does injecting
12
+ `agent_help(target)` output into the prompt reduce failures compared with the
13
+ same prompt without it?
14
+
15
+ The failure modes scored are the two documented in [Why it matters](why.md):
16
+
17
+ - **What exists** — hallucinated attributes and methods, measured as
18
+ `AttributeError` at runtime.
19
+ - **How to use it** — wrong signatures or call shapes, measured as `TypeError`
20
+ at runtime.
21
+
22
+ ## Method
23
+
24
+ For each task (one target library plus a natural-language coding prompt) and
25
+ each condition, the harness asks the model for a single runnable script and
26
+ executes it against the installed library:
27
+
28
+ | Condition | Prompt |
29
+ | --- | --- |
30
+ | `baseline` | The task prompt only. |
31
+ | `agent_help` | The task prompt plus `agent_help(target)` output labeled as reference documentation for the installed version. |
32
+
33
+ Every generated script runs in a fresh subprocess against the same
34
+ environment. Outcomes:
35
+
36
+ | Outcome | Meaning |
37
+ | --- | --- |
38
+ | `ok` | Script exits 0. |
39
+ | `attributeerror` | Runtime `AttributeError` — most directly indicates a hallucinated API. |
40
+ | `typeerror` | Runtime `TypeError` — wrong signature or call shape. |
41
+ | `nameerror`, `importerror` | Reference or import failures. |
42
+ | `other_error`, `timeout`, `no_code`, `api_error` | Everything else; reported but not counted as API hallucination. |
43
+
44
+ Headline metric: the `ok` rate per condition, plus the split between
45
+ `attributeerror` and `typeerror`. Results are recorded below with the date,
46
+ model, sample count, and library versions.
47
+
48
+ ## Running it
49
+
50
+ The harness calls the Anthropic API (needs `ANTHROPIC_API_KEY` or an
51
+ `ant auth login` profile) and requires the target libraries to be installed.
52
+ It is deliberately not part of CI.
53
+
54
+ ```bash
55
+ uv run --with anthropic --with icalendar --with feedparser \
56
+ python scripts/benchmark.py --samples 5 --out .localonly/benchmark-results.json
57
+ ```
58
+
59
+ Custom task sets are JSON files of `{module, target, task}` entries passed via
60
+ `--tasks`. Choose targets the model plausibly has weak training coverage of:
61
+ small libraries, recent releases, or project-private code — for well-known
62
+ stable APIs the model may succeed in both conditions and the benchmark
63
+ measures nothing.
64
+
65
+ ## Threats to validity
66
+
67
+ - **Target familiarity.** A model that already knows a library reduces the
68
+ gap; a model that misremembers a *changed* API may fail both conditions.
69
+ Unfamiliar targets are the population of interest.
70
+ - **Task wording.** The injected documentation is the only intended
71
+ difference; prompts are otherwise identical.
72
+ - **Execution-only scoring.** A script can exit 0 and still be semantically
73
+ wrong; `ok` is an upper bound on correctness, not a proof of it.
74
+ - **Sample size.** Per-task differences at small sample counts are noise;
75
+ read the aggregate.
76
+
77
+ ## Results
78
+
79
+ _None yet._
@@ -154,11 +154,11 @@ class RateLimiter:
154
154
  print(agent_help(RateLimiter))
155
155
  ```
156
156
 
157
- Use `__agent_help__()` when you need total control over the rendered output. Use `__agent_notes__()` when you want auto-generated API docs plus your extra rules.
157
+ Use `__agent_help__()` when the auto-generated base document is not what you want and you prefer to write the base by hand. Use `__agent_notes__()` when the auto-generated API docs are fine and you just want extra rules on top. `__agent_notes__()` sections defined anywhere in the MRO are appended after custom `__agent_help__()` output too, so mixed setups do not lose notes.
158
158
 
159
159
  ## Example 4: Any class, no setup required
160
160
 
161
- Even without the mixin or duck typing, `agent_help()` generates structured Markdown from introspection: a curated public API list with current signatures, free of inherited dunders and MRO clutter. Full example: [`examples/any_class.py`](../examples/any_class.py).
161
+ Even without the mixin or duck typing, `agent_help()` generates structured Markdown from introspection: a curated public API list with current signatures, free of inherited dunders and MRO clutter. Methods, properties, cached properties, public constants (with their values), and enum members are all listed. Full example: [`examples/any_class.py`](../examples/any_class.py).
162
162
 
163
163
  ```python
164
164
  import logging
@@ -16,34 +16,56 @@ Requires Python 3.10+. No runtime dependencies.
16
16
 
17
17
  ## One-off CLI use
18
18
 
19
- If you only want to print readable documentation for a Python target and do not want to add `agent-readable` to the current environment, run it in a temporary tool environment:
19
+ Two parallel series — pick whichever matches your tooling. Each one-off command creates an isolated tool environment on first use, caches it for instant repeat runs, and never touches the current environment. Replace `sqlite3:Connection` with any importable class, module, function, or method.
20
20
 
21
- The examples below use `sqlite3:Connection` as the target; replace it with any importable class, module, function, or method.
22
-
23
- With `uvx`:
21
+ ### uv series
24
22
 
25
23
  ```bash
26
- uvx --from agent-readable python -m agent_readable sqlite3:Connection
24
+ # One-off — isolated tool environment, cached by uv
25
+ uvx agent-readable sqlite3:Connection
26
+
27
+ # One-off for a third-party package — --with adds it to the environment
28
+ uvx --with requests agent-readable requests:Session
29
+
30
+ # Repeated use — install once, then run the bare command
31
+ uv tool install agent-readable
32
+ agent-readable sqlite3:Connection
27
33
  ```
28
34
 
29
- With `uv tool run`:
35
+ ### pip series
30
36
 
31
37
  ```bash
32
- uv tool run --from agent-readable python -m agent_readable sqlite3:Connection
38
+ # One-off — pipx builds and caches an isolated environment
39
+ pipx run --spec agent-readable agent-readable sqlite3:Connection
40
+
41
+ # Repeated use — install once with pipx (isolated, on PATH)
42
+ pipx install agent-readable
43
+ agent-readable sqlite3:Connection
44
+
45
+ # Plain pip — persistent install into any environment you choose
46
+ pip install agent-readable
33
47
  ```
34
48
 
35
- With `pipx`:
49
+ To let your coding agent automatically call `agent_help()` before using an unfamiliar API, install the companion skill:
36
50
 
37
51
  ```bash
38
- pipx run --spec agent-readable python -m agent_readable sqlite3:Connection
52
+ npx skills add zydo/skills --skill agent-readable
39
53
  ```
40
54
 
41
- `uvx` is shorthand for `uv tool run`. These commands are useful for standard-library targets and packages available inside the temporary environment. For your own project classes, run from an environment where that project is importable.
55
+ ## Your own project
42
56
 
43
- To let your coding agent automatically call `agent_help()` before using an unfamiliar API, install the companion skill:
57
+ The one-off environments above cannot import your own project's code. Run the CLI from an environment where the project is importable:
44
58
 
45
59
  ```bash
46
- npx skills add zydo/skills --skill agent-readable
60
+ uv add --dev agent-readable
61
+ uv run agent-readable my_package.temperature:CalibratedSensor
62
+ ```
63
+
64
+ Or with pip, install into the project's environment and run the bare command:
65
+
66
+ ```bash
67
+ pip install agent-readable
68
+ agent-readable my_package.temperature:CalibratedSensor
47
69
  ```
48
70
 
49
71
  ## Quickstart
@@ -123,25 +145,30 @@ print(agent_help(Sensor))
123
145
 
124
146
  ## CLI
125
147
 
148
+ Wherever the package is installed, both `agent-readable` and `python -m agent_readable` work:
149
+
126
150
  ```bash
127
151
  # Any stdlib class
128
- python -m agent_readable sqlite3:Connection
152
+ agent-readable sqlite3:Connection
129
153
 
130
154
  # A class in your own package
131
- python -m agent_readable my_package.temperature:CalibratedSensor
155
+ agent-readable my_package.temperature:CalibratedSensor
132
156
 
133
157
  # The library itself
134
- python -m agent_readable agent_readable:AgentReadableMixin
158
+ agent-readable agent_readable:AgentReadableMixin
135
159
 
136
160
  # Any module
137
- python -m agent_readable pathlib
161
+ agent-readable pathlib
138
162
 
139
163
  # A function or method
140
- python -m agent_readable json:dumps
141
- python -m agent_readable pathlib:Path.read_text
164
+ agent-readable json:dumps
165
+ agent-readable pathlib:Path.read_text
166
+
167
+ # Installed version
168
+ agent-readable --version
142
169
  ```
143
170
 
144
- The CLI writes agent-oriented documentation for the target to stdout.
171
+ The CLI writes agent-oriented documentation for the target to stdout. A target that cannot be imported or resolved prints a one-line error to stderr and exits with status 2.
145
172
 
146
173
  ## Other Languages
147
174
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "agent-readable"
7
- version = "0.2.1"
7
+ version = "0.3.1"
8
8
  description = "A lightweight Python protocol for agent-oriented documentation"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -47,6 +47,9 @@ Repository = "https://github.com/zydo/agent-readable"
47
47
  Issues = "https://github.com/zydo/agent-readable/issues"
48
48
  Changelog = "https://github.com/zydo/agent-readable/blob/main/CHANGELOG.md"
49
49
 
50
+ [project.scripts]
51
+ agent-readable = "agent_readable.__main__:main"
52
+
50
53
  [tool.hatch.build.targets.wheel]
51
54
  packages = ["src/agent_readable"]
52
55
 
@@ -61,9 +64,17 @@ target-version = "py310"
61
64
  select = ["E", "F", "I", "UP", "B", "RUF"]
62
65
  external = ["S"]
63
66
 
67
+ [tool.mypy]
68
+ files = ["src", "tests"]
69
+ python_version = "3.10"
70
+ check_untyped_defs = true
71
+ warn_redundant_casts = true
72
+ no_implicit_optional = true
73
+
64
74
  [dependency-groups]
65
75
  dev = [
66
76
  "pytest>=8.0",
67
77
  "pytest-cov>=7.1.0",
68
78
  "ruff>=0.15.15",
79
+ "mypy>=1.19.0",
69
80
  ]