Shared guidance for AI agents and contributors working in this repository.
Use this order when you need project context:
README.mdfor product and user-facing contextCONSTITUTION.mdfor principles and compatibility postureARCHITECTURE.mdfor source layout and extension seamsGUIDE.mdfor concrete implementation workflowsCONFIGURATION.mdfor tooling and shell detailsRELEASE.mdonly for versioning and publication work
This repository publishes the txtplot Rust crate, a terminal plotting library built around Unicode Braille rendering.
| Path | Purpose |
|---|---|
src/lib.rs |
Stable crate-root facade |
src/canvas.rs |
Braille raster engine, pixel operations, render pipeline |
src/charts.rs |
Axis scaling, range math, chart composition, labels, ticks |
src/prelude.rs |
Ergonomic re-exports for downstream users |
examples/ |
Runnable usage and showcase programs |
benches/ |
Benchmark entrypoints |
scripts/ |
Small repo maintenance helpers |
justfile |
Local workflow commands |
flake.nix |
Nix development environment |
- Start from the smallest relevant surface. Do not read the whole repository by default.
- Keep the public API coherent:
src/lib.rsis the canonical crate-root contract.src/prelude.rsshould track user-facing ergonomic exports.
- Put logic in the right layer:
- Pixel-space drawing, compositing, and rendering belong in
src/canvas.rs. - Data-space transforms, axes, ticks, and chart helpers belong in
src/charts.rs.
- Pixel-space drawing, compositing, and rendering belong in
- When adding a new public capability, update documentation in the same change slice.
- Prefer examples as proof surfaces for new behavior that is easier to understand visually than through unit tests alone.
- Add it to
BrailleCanvaswhen the operation fundamentally acts on pixels or cell buffers. - Preserve coordinate intent. If the primitive matters in both spaces, expose the cartesian and screen variants explicitly instead of hiding a conversion.
- Keep hot-path allocations out of per-point or per-frame loops.
- Add it to
ChartContextwhen the behavior needs ranges, axes, labels, or scale transforms. - Reuse the central scale and range helpers rather than inventing parallel mapping code.
- Respect the background/foreground layering model instead of bypassing it.
- Wire it through
src/lib.rs. - Add it to
src/prelude.rsonly if it improves common downstream ergonomics. - Document the new surface in
README.mdorGUIDE.mdwhen users should discover it directly.
- Add toolchain dependencies to
flake.nix. - Document the purpose and usage in
CONFIGURATION.md. - Prefer
justfilerecipes only when they simplify a repeated local workflow.
Use the existing just recipes as the default workflow surface:
| Command | Purpose |
|---|---|
just fmt |
Format the crate |
just fmt-check |
Check formatting |
just cargo-check |
Type-check all targets and features |
just clippy |
Run clippy with warnings denied |
just test |
Run tests via cargo nextest run |
just check |
Run fmt-check, cargo-check, clippy, and tests |
just flake-check |
Run nix flake check |
The Nix development shell includes two extra tools intended to make extension work easier:
cargo-nextestfor faster Rust test executionkeelfor structured planning and workflow management if the repository adopts board-driven planning latersiftfor fast local search across docs and code
Neither tool is required to build or use the crate. They exist to improve contributor and agent ergonomics.
This repository follows a hard-cutover posture by default:
- Keep one canonical API path for each feature.
- Do not add compatibility shims or alias layers unless the change explicitly calls for them.
- Prefer replacing outdated internals in one change slice over supporting two rendering paths indefinitely.
Use this order when interpreting constraints:
CONSTITUTION.md -> ARCHITECTURE.md -> CONFIGURATION.md / GUIDE.md / RELEASE.md -> code and examples