tui-checkbox 0.4.4

A customizable checkbox widget for Ratatui TUI applications
Documentation
# tui-checkbox - A customizable checkbox widget for Ratatui
# Install just:      cargo install just
# Install git-cliff: cargo install git-cliff
# Install nushell:   https://www.nushell.sh
# Usage: just <task>

# ── Default ───────────────────────────────────────────────────────────────────

# Show available commands
default:
    @just --list

# ── Tool checks ───────────────────────────────────────────────────────────────

_check-git-cliff:
    @command -v git-cliff >/dev/null 2>&1 || { \
        echo "❌ git-cliff not found. Install with: cargo install git-cliff"; exit 1; \
    }

# Check nu (nushell) is available
_check-nu:
    @command -v nu >/dev/null 2>&1 || { \
        echo "❌ nu (nushell) not found. Install: https://www.nushell.sh"; exit 1; \
    }

# Install all recommended development tools
install-tools:
    @echo "Installing development tools…"
    @command -v just >/dev/null 2>&1 && echo "✅ just found" || cargo install just
    @command -v git-cliff >/dev/null 2>&1 && echo "✅ git-cliff found" || cargo install git-cliff
    @command -v nu >/dev/null 2>&1 && echo "✅ nu found" || echo "⚠ nu (nushell) not found. Install: https://www.nushell.sh"
    @echo "✅ All tools installed!"

# ── Build ─────────────────────────────────────────────────────────────────────

# Build the project
build:
    cargo build

# Build release version
build-release:
    cargo build --release

# Run the example
run:
    cargo run --example checkbox

# ── Test ──────────────────────────────────────────────────────────────────────

# Run tests
test:
    cargo test

# Run tests with coverage
test-coverage:
    cargo tarpaulin --out Html --output-dir coverage

# ── Code quality ──────────────────────────────────────────────────────────────

# Check code without building
check:
    cargo check

# Format code
fmt:
    cargo fmt

# Check if code is formatted
fmt-check:
    cargo fmt --check

# Run clippy linter
clippy:
    cargo clippy -- -D warnings

# Run all checks (fmt, clippy, test)
check-all: fmt-check clippy test
    @echo "✅ All checks passed!"

# Clean build artifacts
clean:
    cargo clean

# ── Changelog ─────────────────────────────────────────────────────────────────

# Generate full changelog from all tags
changelog: _check-git-cliff
    @echo "Generating full changelog…"
    git-cliff -o CHANGELOG.md
    @echo "✅ Changelog generated!"

# Generate changelog for unreleased commits only
changelog-unreleased: _check-git-cliff
    @echo "Generating unreleased changelog…"
    git-cliff --unreleased --prepend CHANGELOG.md
    @echo "✅ Unreleased changelog generated!"

# Generate changelog for specific version tag
changelog-version version: _check-git-cliff
    @echo "Generating changelog for version {{version}}…"
    git-cliff --tag v{{version}} -o CHANGELOG.md
    @echo "✅ Changelog generated for version {{version}}!"

# Preview changelog without writing to file
changelog-preview: _check-git-cliff
    @git-cliff

# Preview unreleased changes
changelog-preview-unreleased: _check-git-cliff
    @git-cliff --unreleased

# Generate changelog for latest tag only
changelog-latest: _check-git-cliff
    @echo "Generating changelog for latest tag…"
    git-cliff --latest -o CHANGELOG.md
    @echo "✅ Latest changelog generated!"

# Regenerate complete changelog from all tags (force)
changelog-update: _check-git-cliff
    @echo "Regenerating complete changelog from all tags…"
    git-cliff --output CHANGELOG.md
    @echo "✅ Changelog updated from all git history!"

# ── Version bump ─────────────────────────────────────────────────────────────
# Usage: just bump 0.5.0
#
# Runs fmt → clippy → test → changelog → commit → tag, then shows push hints.

# Bump version, regenerate Cargo.lock + CHANGELOG.md, commit and tag.
bump version: check-all _check-git-cliff _check-nu
    nu scripts/bump_version.nu --yes {{version}}

# ── Publish (crates.io) ──────────────────────────────────────────────────────

# Run the full pre-publish readiness check (fmt, clippy, tests, docs, dry-run)
check-publish: _check-nu
    nu scripts/check_publish.nu

# Quick release: format, check, test, and build
release-check: fmt clippy test build-release
    @echo "✅ Ready for release!"

# Publish to crates.io (dry run)
publish-dry:
    cargo publish --dry-run

# Publish to crates.io
publish:
    cargo publish

# ── Dependencies ──────────────────────────────────────────────────────────────

# Update Cargo.lock (compatible versions only)
update:
    cargo update

# Update dependencies, run the full quality gate, then commit and push if all green.
# Aborts without committing if fmt, clippy, or tests fail.
update-deps:
    @echo "⬆️  Updating dependencies…"
    cargo update
    @echo "🔍 Running quality gate…"
    cargo fmt -- --check
    cargo clippy -- -D warnings
    cargo test --locked --all-features --all-targets
    @echo "✅ All checks passed — committing dependency updates…"
    git add Cargo.lock
    git diff --cached --quiet || git commit -m "chore: update dependencies"
    git push origin main
    @echo "✅ Dependency updates pushed to GitHub."

# Run the full nightly-style upgrade (rewrites pins + quality gate)
upgrade-deps: _check-nu
    nu scripts/upgrade_deps.nu --dry-run

# Show outdated dependencies (requires cargo-outdated)
outdated:
    cargo outdated

# ── Documentation ─────────────────────────────────────────────────────────────

# Generate and open documentation
doc:
    cargo doc --no-deps --open

# ── Git ───────────────────────────────────────────────────────────────────────

# Git: commit current changes
commit message:
    git add .
    git commit -m "{{message}}"

# Git: push to GitHub (origin)
push:
    git push origin main

# Git: pull from GitHub (origin)
pull:
    git pull origin main

# Git: push to Gitea
push-gitea:
    git push gitea main

# Git: pull from Gitea
pull-gitea:
    git pull gitea main

# Git: push to both GitHub and Gitea
push-all:
    git push origin main
    git push gitea main
    @echo "✅ Pushed to both GitHub and Gitea!"

# Git: pull from Gitea (fetch and merge)
pull-from-gitea:
    @echo "Pulling from Gitea…"
    git pull gitea main
    @echo "✅ Pulled from Gitea!"

# Git: push tags to GitHub
push-tags:
    git push origin --tags

# Git: push tags to both remotes
push-tags-all:
    git push origin --tags
    git push gitea --tags
    @echo "✅ Tags pushed to both GitHub and Gitea!"

# Full release workflow: run checks, bump version, and push to GitHub
release version: (bump version)
    @echo "Pushing to GitHub…"
    git push origin main
    git push origin v{{version}}
    @echo "✅ Release v{{version}} complete on GitHub!"

# Full release workflow: run checks, bump version, and push to Gitea
release-gitea version: (bump version)
    @echo "Pushing to Gitea…"
    git push gitea main
    git push gitea v{{version}}
    @echo "✅ Release v{{version}} complete on Gitea!"

# Full release workflow: run checks, bump version, and push to both GitHub and Gitea
release-all version: (bump version)
    @echo "Pushing to both GitHub and Gitea…"
    git push origin main
    git push gitea main
    git push origin v{{version}}
    git push gitea v{{version}}
    @echo "✅ Release v{{version}} complete on both remotes!"

# Push release to both GitHub and Gitea (without bumping)
push-release-all:
    @echo "Pushing release to both GitHub and Gitea…"
    git push origin main
    git push gitea main
    git push origin --tags
    git push gitea --tags
    @echo "✅ Release pushed to both remotes!"

# Sync Gitea with GitHub (force)
sync-gitea:
    @echo "Syncing Gitea with GitHub…"
    git push gitea main --force
    git push gitea --tags --force
    @echo "✅ Gitea synced!"

# Show configured remotes
remotes:
    @echo "Configured git remotes:"
    @git remote -v

# Setup Gitea remote (interactive, via nushell)
setup-gitea url: _check-nu
    nu scripts/setup_gitea.nu {{url}}

# ── Info ──────────────────────────────────────────────────────────────────────

# Show current version
version: _check-nu
    @nu scripts/version.nu

# Show git-cliff info
cliff-info:
    @echo "Git-cliff configuration:"
    @echo "  Config file: cliff.toml"
    @echo "  Installed: $(command -v git-cliff >/dev/null 2>&1 && echo '✅ Yes' || echo '❌ No (run: just install-tools)')"
    @command -v git-cliff >/dev/null 2>&1 && git-cliff --version || true

# Show project info
info: _check-nu
    @echo "Project: tui-checkbox"
    @echo "Version: $(nu scripts/version.nu)"
    @echo "Author: Sorin Albu-Irimies"
    @echo "License: MIT"

# View changelog
view-changelog:
    @cat CHANGELOG.md

# ── Misc ──────────────────────────────────────────────────────────────────────

# Watch and auto-run on file changes (requires cargo-watch)
watch:
    cargo watch -x "run --example checkbox"

# Run the VHS tape to generate demo GIF
vhs:
    @echo "Running VHS tape to generate demo…"
    vhs examples/checkbox.tape
    @echo "✅ Demo generated at examples/checkbox.gif"