Generate a book-inventory report (SKU/title/author/ISBN/summary) from inventory_ai and email it via mm as an ASCII table in the body plus a prose summary. Repeatable (Rule 14): the daily cron runs this, never an ad-hoc script. PDF attachment is a later iteration (mm attachment sprint).
| Tier | tools |
| Role | unclassified (baselined) |
| Path | crates/tools/book-report |
| Edition | 2021 |
| Targets | tools-book-report, tools_book_report |
| Public items | 4 across 0 modules |
| Tests | 7 |
What it is for
Pure rendering for the book-inventory report: an ASCII table and a prose summary that go in the email body. No I/O here — the binary queries inventory_ai and calls mm send; this module is what the tests pin.
Capabilities
ReportRow
Pure rendering for the book-inventory report: an ASCII table and a prose
| Item |
|---|
pub struct ReportRow |
fn ascii_table(rows : & ReportRow) -> String |
fn prose_summary(category : & str, rows : & ReportRow, generated : & str) -> String |
fn email_body(category : & str, rows : & ReportRow, generated : & str) -> String |
How to use it
No examples/ target and no doctest in this crate's rustdoc. The tests listed under Verification are the closest executable usage.
Module structure
No public modules: the crate root is its whole surface.
Public surface
`crate root`
| Item | What it is |
|---|---|
pub struct ReportRow | One report line |
fn ascii_table(rows : & ReportRow) -> String | Render the rows as a bordered fixed-width ASCII table (header + rule + one line per row) |
fn prose_summary(category : & str, rows : & ReportRow, generated : & str) -> String | A prose paragraph for the top of the email body: how many, on what, and where it came from |
fn email_body(category : & str, rows : & ReportRow, generated : & str) -> String | The full email body: prose, then the ASCII table. |
No pub use re-exports: every item above is declared in this crate.
Boundary
Reaches into foundation.
Shares tier tools with 84 other crates: tools-advisory-reach, tools-archive-guard, tools-artifact-scaffold, tools-ask-ai-core, tools-ask-ais, tools-ask-gemini, tools-book, tools-boundary-scan, … (84 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | tools |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/tools/book-report |
| Vocabulary in force (lexicon) | current |
Tier flow. Which tiers this crate's own edges cross.
flowchart LR n_tools["tools"] --> n_foundation["foundation"]
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-bounded-io` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
anyhow | ^1 | — | no | always |
chrono | ^0.4 | clock | no | always |
clap | ^4 | derive | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, uuid | no | always |
tokio | ^1 | rt-multi-thread, macros | no | always |
uuid | ^1 | v4 | no | always |
Development, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `tools-cli-conformance` | tools | no | always |
Build. None.
Depended on by. Nothing in this workspace.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR SELF["tools-book-report"] SELF -->|development| n_tools_cli_conformance["tools-cli-conformance"] SELF -->|runtime| n_foundation_bounded_io["foundation-bounded-io"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.
Targets
| Kind | Name | Source |
|---|---|---|
| bin | tools-book-report | `src/main.rs` |
| lib | tools_book_report | `src/lib.rs` |
Error model
No public error type was detected: no public item declares a type named *Error, and no public signature returns one.
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | none detected |
| async runtime | yes |
| database access | yes |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
INVENTORY_DB | src/main.rs |
Related capabilities
No workspace crate depends on this one.
Verification
| Kind | Count |
|---|---|
| Unit tests | 7 |
| Integration tests | 0 |
| Examples | 0 |
| Doctests | 0 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
crate root | 4 | 0 | 0 |
What the tests establish, by name:
body_is_prose_then_table—src/lib.rsevery_line_is_the_same_width_so_borders_align—src/lib.rsoverlong_cell_is_truncated_with_ellipsis_not_dropped—src/lib.rsprose_states_count_and_category—src/lib.rstable_has_headers_borders_and_each_row—src/lib.rscli_conforms—src/main.rspropagates_subprocess_failure_instead_of_silently_succeeding—src/main.rs
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 4 | 4 |
Public modules with a //! block | 0 | 0 |
pie showData
title Public items with rustdoc
"Documented" : 4
"No rustdoc detected" : 0
Metrics
| Metric | Value |
|---|---|
| Rust source files | 2 |
| Source lines | 356 |
| Code lines | 297 |
| Public API items | 4 |
| Public modules | 0 |
| Tests | 7 |
| Examples | 0 |
| Cargo features | 0 |
| Direct runtime dependencies | 7 |
| Workspace reverse dependencies | 0 |
pie showData
title Public API by kind
"function" : 3
"struct" : 1
pie showData
title Rust source composition
"Code" : 297
"Blank or comment" : 59
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.