wincounter 0.1.6

Binary win counter that supports ties
Documentation
# WASM Compatibility Implementation Summary

This document summarizes all changes made to add WebAssembly (WASM) compatibility to the `wincounter` crate.

## Date
February 16, 2026

## Overview
The `wincounter` crate is now fully compatible with WebAssembly (`wasm32-unknown-unknown` target), enabling it to be used in browser-based applications and other WASM environments.

## Changes Made

### 1. Source Code Changes

#### `src/util.rs`
- **Gated file I/O imports**: Moved `std::fs::File`, `std::io`, and `std::path::Path` imports behind `#[cfg(not(target_arch = "wasm32"))]`
- **Gated `read_lines()` function**: Added `#[cfg(not(target_arch = "wasm32"))]` to the `read_lines()` function since file system access is not available in WASM
- **Updated documentation**: Added note that `read_lines()` is not available when targeting WASM

All other utility functions remain available in WASM environments.

### 2. Documentation Updates

#### `src/lib.rs` (Crate-level documentation)
- Added WASM compatibility to the Features section
- Added a dedicated "WASM Compatibility" subsection under Technical Notes
- Explicitly noted that `util::Util::read_lines()` is excluded in WASM builds
- Referenced `WASM.md` for more details

#### `README.md`
- Added WASM compatibility badge/feature to the Features section
- Updated the task list to include WASM compatibility check
- Fixed typo: "carg test" → "cargo test"
- Added reference to `WASM.md`

#### `WASM.md` (New file)
- Created comprehensive WASM compatibility guide
- Included testing instructions
- Documented limitations (file I/O functions)
- Provided usage examples
- Explained CI/CD integration

### 3. CI/CD Integration

#### `.github/workflows/basic.yaml`
- Added new `wasm` job that runs on every push and pull request
- Job checks compilation for `wasm32-unknown-unknown` target
- Uses `actions-rs/toolchain` and `actions-rs/cargo` actions
- Ensures WASM compatibility is continuously validated

### 4. Build System Integration

#### `Makefile`
- Added `wasm` target that runs `cargo check --target wasm32-unknown-unknown`
- Integrated `wasm` target into the default `ayce` (All You Can Eat) target
- Now `make` automatically checks WASM compatibility

### 5. Testing Scripts

#### `test-wasm.sh` (New file)
- Created standalone bash script for manual WASM testing
- Automatically installs `wasm32-unknown-unknown` target if missing
- Runs both check and release build
- Shows build artifacts size
- Made executable with proper permissions

## Validation

All changes have been validated:

✅ **Compilation**: `cargo check --target wasm32-unknown-unknown` - PASSED  
✅ **Unit Tests**: All 30 tests pass  
✅ **Doc Tests**: All 11 doc tests pass  
✅ **Clippy**: No warnings  
✅ **Documentation**: Builds successfully  
✅ **WASM Build**: Successfully builds for `wasm32-unknown-unknown` target  

## Dependencies Analysis

All dependencies are WASM-compatible:
- `percent-encoding = "2.3"`- `serde = { version = "1.0.228", features = ["derive"] }`
No additional dependencies or features needed for WASM support.

## Limitations

When targeting WASM, the following function is **not available**:
- `util::Util::read_lines()` - Requires file system access

All other functionality works normally:
- `HeadsUp` struct and methods
-`Wins` collection and accumulation
-`Results` percentage calculations
- ✅ Bit flag operations
- ✅ Serde serialization/deserialization
- ✅ All other utility functions

## Usage in WASM Projects

Users can now add `wincounter` to their WASM projects without any special configuration:

```toml
[dependencies]
wincounter = "0.1"
```

The crate automatically excludes incompatible features when compiled for WASM.

## Testing WASM Compatibility

Three ways to test WASM compatibility:

1. **Cargo directly**: `cargo check --target wasm32-unknown-unknown`
2. **Make**: `make wasm`
3. **Test script**: `./test-wasm.sh`

## CI/CD Integration

The GitHub Actions workflow now includes WASM compatibility checks that run automatically on:
- Every push
- Every pull request

This ensures WASM compatibility is maintained as the crate evolves.

## Future Considerations

- Consider adding `wasm-bindgen` support for easier JavaScript interop (optional)
- Consider adding WASM-specific examples
- Monitor dependency updates for WASM compatibility

## Breaking Changes

**None**. All changes are backwards compatible. The crate continues to work normally on all existing platforms while gaining WASM support.