import "just.just"

# Run a command via uv
[group("project")]
python-run *args:
    @uv run {{ args }}

# Format sources
[group("lint")]
fmt: format-justfiles
    just python-run ruff format src tests
    just python-run ruff check --fix src tests

# Run linter
[group("lint")]
lint: fmt

# Run tests
[group("test")]
test *args:
    just python-run pytest {{ args }}

# Show certificate in human-readable format
[group("project")]
show-cert file:
    nebula-cert print -path {{ file }}

# Format, lint, and test
[group("lint")]
check: lint test

# Print venv activation command
[group("project")]
shell:
    uv venv --allow-existing 2>&1 | tail -n 1 | sed "s/Activate with: //"

# Bump dev version
[group("project")]
bump-dev:
    uv version --bump dev

# Bump patch version
[group("project")]
bump-patch:
    uv version --bump patch

# Bump minor version
[group("project")]
bump-minor:
    uv version --bump minor

# Build package
[group("project")]
build:
    uv build

# Publish package to PyPI
[group("project")]
publish:
    just python-run dotenv --file pypi.env run uv publish dist/nebula_cert_manager-*
