set shell := ["bash", "-eu", "-o", "pipefail", "-c"]

default:
    @just --list

setup:
    uv sync --locked
    npm ci --prefix actions/release/tooling --legacy-peer-deps --ignore-scripts --no-audit --no-fund
    npm ci --install-links --prefix actions/release/publisher --ignore-scripts --no-audit --no-fund

hooks-install:
    uv run --locked lefthook install

format:
    uv run --locked ruff check --fix .
    uv run --locked ruff format .

quality:
    uv run --locked ruff check .
    uv run --locked ruff format --check .
    uv run --locked mypy src/skillkit

python-tests:
    uv run --locked python -m unittest discover -s tests -p 'test_*.py' -q
    uv run --locked python -m unittest discover -s authoring/tests/skillkit/create-skill -p 'test_*.py' -q
    uv run --locked python -m unittest discover -s authoring/tests/skillkit/evaluate-skill -p 'test_*.py' -q
    uv run --locked python -m unittest discover -s tests/actions -p 'test_*.py' -q

node-tests:
    uv run --locked node --test tests/marketplace-integration.test.mjs
    npm test --prefix actions/release/tooling
    node --test actions/release/publisher/publisher.test.mjs

coverage:
    uv run --locked coverage run --branch --source=skillkit -m unittest discover -s tests -p 'test_*.py' -q
    uv run --locked coverage report -m

package:
    bash scripts/check-package.sh

workflow-checks:
    uvx --from actionlint-py==1.7.12.25 actionlint .github/workflows/*.yml
    uvx --from zizmor==1.33.1 zizmor --offline .github/workflows

verify: quality python-tests node-tests package dependencies workflow-checks audit
    uv lock --check
    git diff --check

# Check runtime package imports; dynamic imports are documented in pyproject.toml.
dependencies:
    uv run --locked deptry src

audit:
    bash scripts/audit-dependencies.sh
