promocrypt-cli 1.1.2

Command-line tool for promotional code generation
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Fixed
- **self-update command** - Fixed missing `CliError` import that prevented compilation with `--features self-update`
- **self-update command** - Fixed unused parameter warning

### Planned
- Homebrew formula
- Windows builds (x86_64-pc-windows-msvc)
- Linux ARM64 builds
- MySQL native support
- Redis support for distributed counters
- Parquet export format
- Code redemption tracking
- Webhook notifications
- Rate limiting per campaign
- Expiration date support

## [1.0.0] - 2026-01-06

### Added

#### Core Commands
- **create** - Create new .bin files with configurable options
  - Custom alphabet support
  - Configurable code length
  - Index-based check digit position (0, -1, N, -N)
  - Counter modes: file, inbin, manual
  - Code formatting: prefix, suffix, separators
  - Storage encryption option for SQLite

- **info** - Display .bin file information
  - Show audit trail details
  - Show history (rotations, masterings, changes)
  - Show generation log
  - Show machine ID
  - JSON output format

- **generate** - Generate promotional codes
  - Single or batch generation
  - Chunked processing for large batches
  - Rate limiting support
  - Dry-run mode for preview
  - Override code formatting at generation time

- **validate** - Validate promotional codes
  - Single code validation
  - Batch validation from file or stdin
  - Database validation with --from-db
  - Quiet mode (only show invalid)
  - Summary output

- **lookup** - *(Merged into `validate --show-row`)* Look up code status in database
  - Display all column values
  - Support for PostgreSQL and SQLite

- **stats** - *(Merged into `info --stats`)* Show statistics
  - .bin file information
  - Database code counts (total, used, unused)
  - Generation statistics

- **export** - Export codes from database
  - CSV, JSON, SQL formats
  - WHERE clause filtering
  - Row limit support

- **master** - Master .bin for different machines
  - Machine ID display
  - Target machine specification

- **config** - View and modify .bin configuration
  - Set/remove prefix and suffix
  - Configure separator and positions
  - Toggle storage encryption
  - Change check position

- **rotate-secret** - Rotate secret password
  - Safe password rotation
  - Automatic history logging

- **history** - Manage history
  - View history entries
  - Export to JSON
  - Clear with retention

- **generation-log** - Manage generation log
  - View generation entries
  - Summary mode
  - Export to JSON
  - Clear with retention

- **pg-import** - Import .bin into PostgreSQL
  - Full .bin synchronization
  - Custom naming support

- **pg-export** - Export .bin from PostgreSQL
  - Reconstruct .bin from PostgreSQL
  - Secret verification

- **completions** - Generate shell completions
  - Bash, Zsh, Fish, PowerShell, Elvish

#### Database Integration
- PostgreSQL support via sqlx
  - Batch insertion with UNNEST
  - Connection pooling
  - Transaction support

- SQLite support via sqlx
  - Local database storage
  - Storage encryption (AES-256-SIV)

- External command support (--exec)
  - Plain text format (one code per line)
  - JSON lines format with extra data
  - Pipe to any script or program

#### Typed Column Values
- `--set` for string values
- `--set-int` for integer values
- `--set-float` for float values
- `--set-bool` for boolean values
- `--set-now` for current timestamp
- `--set-json` for JSON/JSONB values
- `--set-null` for NULL values
- `--extra` for JSON object with multiple values

#### Output Formats
- Plain text output
- JSON output
- CSV output

#### Code Formatting
- Prefix support
- Suffix support
- Separator character
- Configurable separator positions

#### Security Features
- Machine binding for .bin files
- Secret password protection
- Configurable check digit position
- Storage encryption for codes at rest
- Secret rotation capability
- Audit trail

#### Environment Support
- `PROMOCRYPT_PASSWORD` environment variable
- `PROMOCRYPT_PROJECT` environment variable
- `DATABASE_URL` environment variable
- Environment file loading (--env-file)

### Performance
- Target: Generate 10K codes in < 2 seconds
- Target: Generate 1M codes in < 3 minutes
- Target: Validate 10K codes in < 1 second
- Target: Database insert 10K batch in < 5 seconds

---

[1.0.0]: https://github.com/professor93/promocrypt-cli/releases/tag/v1.0.0
[Unreleased]: https://github.com/professor93/promocrypt-cli/compare/v1.0.0...HEAD