Contributing¶
Development Setup¶
git clone https://github.com/wu-hongjun/InstantLink.git
cd InstantLink
cargo build --workspace
cargo test --workspace
Code Standards¶
Before Every Commit¶
All three must pass cleanly. Clippy warnings are treated as errors.
Commit Messages¶
Use conventional commits:
feat:— New featurefix:— Bug fixrefactor:— Code restructuring without behavior changedocs:— Documentation onlytest:— Test additions/changeschore:— Build, CI, tooling changes
Error Handling¶
- Core crate: Use
thiserrorwithPrinterErrorenum andResult<T>alias - CLI crate: Use
anyhowwith.context()for user-facing errors
Naming¶
- Snake case for functions and variables
- Pascal case for types and enums
SCREAMING_SNAKEfor constants
Project Structure¶
InstantLink/
├── Cargo.toml # Workspace root
├── CLAUDE.md # Dev instructions
├── mkdocs.yml # Documentation config
├── docs/ # MkDocs documentation
├── crates/
│ ├── instantlink-core/ # BLE protocol, image processing, device comms
│ ├── instantlink-cli/ # CLI binary
│ └── instantlink-ffi/ # C FFI bindings
├── macos/
│ └── InstantLink/ # SwiftUI app
├── scripts/
│ └── build-app.sh # App bundle build script
└── references/ # Cloned reference repos (gitignored)
Testing¶
Unit Tests (No Hardware)¶
Protocol, command encoding/decoding, and image processing are fully tested without hardware:
Currently 68 unit tests covering:
- Packet checksum, build, parse, fragmentation, reassembly (18 tests)
- Command encoding and response decoding (16 tests)
- Image resize, JPEG encoding, chunking (12 tests)
- Device layer: model detection, status queries, print flow, LED, error paths (22 tests)
Hardware Tests¶
BLE transport and end-to-end printing require a real Instax Link printer:
instantlink scan # Verify printer discovery
instantlink status # Verify full communication
instantlink print test.jpg # Verify print pipeline
Documentation¶
Documentation is built with MkDocs Material: