# Flowire Code Nodes development commands

# Default recipe - show available commands
default:
    @just --list

# Install dependencies (including dev)
install:
    uv sync --all-extras

# Install JavaScript sandbox dependencies (requires Node 22)
js-sandbox-install:
    cd js-sandbox && source ~/.nvm/nvm.sh && nvm use && npm install

# Run JavaScript sandbox in dev mode (requires Node 22)
js-sandbox:
    cd js-sandbox && source ~/.nvm/nvm.sh && nvm use && npm run dev

# Build JavaScript sandbox for production (requires Node 22)
js-sandbox-build:
    cd js-sandbox && source ~/.nvm/nvm.sh && nvm use && npm run build

# Install Python sandbox dependencies
py-sandbox-install:
    cd py-sandbox && uv sync

# Run Python sandbox in dev mode
py-sandbox:
    cd py-sandbox && uv run python -m py_sandbox.server

# Run linter
lint:
    uv run ruff check .

# Run linter and fix auto-fixable issues
lint-fix:
    uv run ruff check --fix .

# Format code
format:
    uv run ruff format .

# Check formatting without making changes
format-check:
    uv run ruff format --check .

# Run all checks (lint + format check)
check: lint format-check

# Run tests
test:
    uv run pytest

# Run tests with verbose output
test-verbose:
    uv run pytest -v

# Run tests with coverage
test-cov:
    uv run pytest --cov=fw_nodes_code --cov-report=term-missing

# Build the package
build:
    uv build

# Publish to PyPI (requires UV_PUBLISH_TOKEN env var)
publish: build
    uv publish

# Clean build artifacts
clean:
    rm -rf dist/ build/ *.egg-info/ .pytest_cache/ .ruff_cache/ .coverage htmlcov/
    find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
