version: "3"
internal: true

tasks:
  update:
    desc: "Update R dependencies within major versions (devtools::update_packages(check.built = TRUE))"
    silent: false
    cmds:
      - cmd: |
          cd packages/r && Rscript -e "devtools::update_packages(check.built = TRUE)"
        ignore_error: false

  upgrade:
    desc: "Upgrade R dependencies to latest including breaking changes (update.packages())"
    silent: false
    cmds:
      - cmd: |
          command -v Rscript >/dev/null 2>&1 || { echo "R not found, skipping R upgrade"; exit 0; }
          cd packages/r && Rscript -e 'options(repos = c(CRAN = "https://cloud.r-project.org")); update.packages(ask = FALSE)'
        ignore_error: false
