version: '3'

tasks:
  generate:
    desc: Generate provider configurations
    aliases: [gen]
    cmds:
      - go run cmd/openrouter/main.go
      - go run cmd/synthetic/main.go

  lint:
    desc: Run linters
    cmds:
      - golangci-lint run ./...

  lint:fix:
    desc: Run linters and fix issues
    cmds:
      - golangci-lint run --fix ./...

  fmt:
    desc: Format code
    cmds:
      - go fmt ./...

  modernize:
    desc: Modernize code
    cmds:
      - modernize ./...

  install:
    desc: Install catwalk locally
    cmds:
      - go install -v .

  run:
    desc: Run catwalk
    aliases: [default]
    cmds:
      - go run .
  release:
    desc: Create and push a new tag following semver
    vars:
      NEXT:
        sh: svu next --always || go run github.com/caarlos0/svu/v3@latest next --always
    prompt: "This will release {{.NEXT}}. Continue?"
    preconditions:
      - sh: '[ $(git symbolic-ref --short HEAD) = "main" ]'
        msg: Not on main branch
      - sh: "[ $(git status --porcelain=2 | wc -l) = 0 ]"
        msg: "Git is dirty"
    cmds:
      - git commit --allow-empty -m "{{.NEXT}}"
      - git tag --annotate --sign -m "{{.NEXT}}" {{.NEXT}} {{.CLI_ARGS}}
      - echo "Pushing {{.NEXT}}..."
      - git push origin main --follow-tags
