wasmhub 0.0.2

Download and manage WebAssembly runtimes for multiple languages
Documentation
# Contributing to WasmHub

Thank you for your interest in contributing! This project aims to be community-driven.

## ๐Ÿ“ Project Structure

```sh
wasmhub/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ lib.rs                       # ๐Ÿ“ฆ Library code
โ”‚   โ””โ”€โ”€ bin/
โ”‚       โ””โ”€โ”€ wasmhub.rs               # ๐Ÿ”ง CLI binary (feature-gated)
โ”‚
โ”œโ”€โ”€ runtimes/                        # ๐Ÿ“ WASM binaries (to be added)
โ”‚   โ”œโ”€โ”€ nodejs/
โ”‚   โ”œโ”€โ”€ python/
โ”‚   โ”œโ”€โ”€ ruby/
โ”‚   โ”œโ”€โ”€ php/
โ”‚   โ””โ”€โ”€ go/
โ”‚
โ”œโ”€โ”€ .github/workflows/
โ”‚   โ””โ”€โ”€ ci.yml                       # โœ… CI pipeline
โ”‚
โ”œโ”€โ”€ Cargo.toml                       # ๐Ÿ“ฆ Package manifest
โ”œโ”€โ”€ justfile                         # ๐Ÿ› ๏ธ Build commands
โ”œโ”€โ”€ README.md                        # ๐Ÿ“– User-facing docs
โ”œโ”€โ”€ CONTRIBUTING.md                  # ๐Ÿ‘ฅ This file
โ”œโ”€โ”€ LICENSE                          # โš–๏ธ MIT License
โ””โ”€โ”€ .gitignore                       # ๐Ÿšซ Git ignore rules
```

The project is a single Rust crate with:
- **Library API** (`src/lib.rs`) - Can be used programmatically
- **CLI tool** (`src/bin/wasmhub.rs`) - Enabled with `--features cli`

## ๐Ÿš€ Ways to Contribute

1. **Report Bugs** - Open an issue with reproduction steps
2. **Request Features** - Suggest new runtimes or improvements
3. **Submit PRs** - Fix bugs, add runtimes, improve docs
4. **Improve Documentation** - Help others understand the project
5. **Share** - Star the repo, tell others about it

## ๐Ÿ”ง Development Setup

### Prerequisites

- Rust 1.85+ (`rustup install stable`)
- Git
- Just (optional, for convenient build commands: `cargo install just`)

### Clone & Build

```sh
# Clone repository
git clone https://github.com/anistark/wasmhub.git
cd wasmhub

# Build library only
cargo build

# Build library + CLI
cargo build --features cli

# Run tests
cargo test

# Run CLI locally
cargo run --features cli -- --help

# Install CLI globally
cargo install --path . --features cli
```

## ๐Ÿ“ Code Style

```sh
# Format code
just format

# Lint code
just lint

# Auto-fix linting issues
just lint-fix
```

All PRs must pass formatting and linting checks.

## ๐Ÿงช Testing

Write tests for all new features:

```rust
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_language_from_str() {
        assert_eq!(Language::from_str("nodejs"), Some(Language::NodeJs));
        assert_eq!(Language::from_str("unknown"), None);
    }
}
```

Run tests:
```sh
cargo test
```

## ๐Ÿ“ฆ Adding a New Runtime

1. **Download the WASM binary** to `runtimes/<language>/`
2. **Create manifest.json** with version info
3. **Update global manifest.json**
4. **Add to `Language` enum** in `src/runtime.rs`
5. **Write tests**
6. **Update README.md**
7. **Submit PR**

Example:
```sh
# Add Java runtime
mkdir -p runtimes/java
# Download java-21.0.0.wasm
# Create runtimes/java/manifest.json
# Update Language enum
git commit -am "Add Java runtime support"
```

## ๐Ÿ› Reporting Bugs

Open an issue with:
- **Description** - What went wrong?
- **Steps to reproduce**
- **Expected behavior**
- **Actual behavior**
- **Environment** - OS, Rust version, etc.

## ๐Ÿ’ก Feature Requests

Open an issue with:
- **Use case** - Why is this needed?
- **Proposed solution**
- **Alternatives considered**

## ๐Ÿ”€ Pull Request Process

1. **Fork** the repository
2. **Create a branch** - `git checkout -b feature/my-feature`
3. **Make changes** - Follow code style
4. **Write tests** - Ensure coverage
5. **Update docs** - If needed
6. **Commit** - Use clear commit messages
7. **Push** - `git push origin feature/my-feature`
8. **Open PR** - Fill out the template

### PR Checklist

- [ ] Code follows Rust style guide (`cargo fmt`)
- [ ] No clippy warnings (`cargo clippy`)
- [ ] Tests added and passing (`cargo test`)
- [ ] Documentation updated
- [ ] CHANGELOG.md updated (if applicable)

## ๐Ÿ“œ Commit Messages

Use conventional commits:

```
feat: add Java runtime support
fix: correct cache path on Windows
docs: update CLI usage examples
test: add integration tests for loader
chore: update dependencies
```

## ๐Ÿท๏ธ Issue Labels

- `good-first-issue` - Great for newcomers
- `help-wanted` - Need community help
- `bug` - Something isn't working
- `enhancement` - New feature request
- `documentation` - Docs improvements

## โš–๏ธ Code of Conduct

Be respectful, inclusive, and collaborative. We're building this together.

## ๐Ÿ“ž Questions?

- Open a [Discussion]https://github.com/anistark/wasmhub/discussions
- Ask on Discord (coming soon)
- Email: ani@anistark.com

## ๐Ÿ’ก Quick Reference

### Common Commands

Using justfile (recommended):

```sh
# Show all available commands
just --list

# Format code
just format

# Lint code
just lint

# Auto-fix lint issues
just lint-fix

# Check compilation
just check

# Build library
just build

# Build with all features
just build-all

# Run tests
just test

# Run all CI checks locally
just ci

# Install CLI globally
just install
```

Or using cargo directly:

```sh
# Build everything (library + CLI)
cargo build --all-features

# Run all tests
cargo test

# Format code
cargo fmt --all

# Lint code
cargo clippy --all-features

# Run CLI locally
cargo run --features cli -- list

# Check documentation
cargo doc --open

# Build release binary
cargo build --release --features cli
```

### Project Layout

- **src/lib.rs** - Public API for the library
- **src/bin/wasmhub.rs** - CLI application code
- **runtimes/** - Downloaded WASM runtime binaries
- **Cargo.toml** - Package manifest with `cli` feature flag

### Feature Flags

- **default** - Library only, no CLI
- **cli** - Includes CLI binary with `clap` argument parsing

Thank you for contributing! ๐ŸŽ‰