---
description: posprint development conventions
globs: **/*
alwaysApply: true
---

# posprint development rules

## Language and dependencies

- Single language: **Rust** with **egui** (eframe) for the UI.
- Prefer std library and in-house code. Add a crate only when reimplementing would be unreasonable (e.g. `serialport`, `serde`, `image`, UI framework).
- ESC/POS encoding lives in `src/escpos.rs` — do not add the `escpos` crates.io package.
- Printing: **USB-serial only** in v0.1.x. No Bluetooth or USB printer-class until explicitly requested.

## Testing

- **Every module must have unit tests** in `#[cfg(test)] mod tests` (or `tests/` for integration).
- New behaviour requires new tests in the same commit.
- Run `cargo test` before merging; all tests must pass.
- Use `MockTransport` for printer I/O in tests; never require hardware in CI.

## Branches and commits

- Default branch: `master`.
- Use `feature/` or `fix/` branches for changes.
- Commit frequently with focused messages; avoid one large commit at the end.
- Merge to `master` only after `cargo test` is green.

## Documentation

- See `.cursor/rules/documentation.mdc` for full doc-sync rules.
- Keep `docs/HELP.md` in sync with supported DSL and UI features.
- The in-app Help tab must mirror `docs/HELP.md` (via `include_str!` in `src/lib.rs`).
- Update `docs/ARCHITECTURE.md`, `docs/PRINTING.md`, etc. when implementation diverges from design.

## Releases

- GitLab CI (`.gitlab-ci.yml`) runs tests on push.
- Tagged releases produce Linux `.deb` (apt) and Windows `posprint.exe`.
- Linux release uses `cargo-deb` and `[package.metadata.deb]` in `Cargo.toml`.
