{
  "$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.13.7/.schema/devbox.schema.json",
  "packages": [
    "git@latest",
    "curl@latest",
    "wget@latest",
    "jq@latest",
    "yq@latest",
    "gnumake@latest",
    "direnv@latest",
    "lefthook@latest",
    "uv@latest",
    "nodejs_22@latest",
    "gh@latest",
    "process-compose@latest",
    "docker@latest",
    "docker-compose@latest",
    "ripgrep@latest",
    "fd@latest",
    "bat@latest",
    "eza@latest",
    "zsh@latest",
    "pulumi-bin@latest",
    "google-cloud-sdk@latest",
    "caddy@latest",
    "netcat-openbsd@latest",
    "iputils@latest",
    "dnsutils@latest",
    "traceroute@latest",
    "openssl@latest",
    "unzip@latest",
    "htop@latest",
    "tree@latest",
    "file@latest",
    "vim@latest"
  ],
  "env": {
    "SUPABASE_URL": "http://localhost:54321",
    "API_URL": "http://localhost:8000",
    "INNGEST_DEV_SERVER_URL": "http://localhost:8288",
    "DEVBOX_COREPACK_ENABLED": "true"
  },
  "shell": {
    "init_hook": [
      "# Activate direnv integration only for bash shells.",
      "# devbox run invokes init_hook via /usr/bin/sh, and direnv has no 'sh' hook target.",
      "[ -n \"${BASH_VERSION:-}\" ] && command -v direnv >/dev/null 2>&1 && eval \"$(direnv hook bash)\" 2>/dev/null || true",
      "",
      "# Source NVM so that node/pnpm from nvm is available in devbox shells",
      "# || true is required: under set -e (prepended by devbox to hooks.sh), a",
      "# failing [ -s ] && . exits the script if NVM isn't installed yet.",
      "export NVM_DIR=\"${HOME}/.nvm\"",
      "[ -s \"${NVM_DIR}/nvm.sh\" ] && . \"${NVM_DIR}/nvm.sh\" --no-use || true",
      "",
      "# Install act (local GitHub Actions runner) via the official installer if not present.",
      "# act is not in nixpkgs because the Nix build sandbox conflicts with Docker-in-Docker;",
      "# the curl installer places the binary at /usr/local/bin/act which survives devbox shell restarts.",
      "if ! command -v act >/dev/null 2>&1; then",
      "  echo '==> Installing act (local GitHub Actions runner)...'",
      "  curl -fsSL https://raw.githubusercontent.com/nektos/act/master/install.sh | bash -s -- -b /usr/local/bin >/dev/null 2>&1 && echo '  → act installed.' || echo '  → Warning: act install failed.'",
      "fi"
    ],
    "scripts": {
      "setup": [
        "#!/usr/bin/env bash",
        "set -eu",
        "",
        "# ── Project dependencies & first-time setup ──────────────────────────────",
        "echo '==> Running project setup (deps, env files, git hooks)...'",
        "bash scripts/setup.sh",
        "",
        "# ── Oh My Zsh ────────────────────────────────────────────────────────────",
        "echo '==> Configuring Oh My Zsh...'",
        "",
        "if [ ! -d \"${HOME}/.oh-my-zsh\" ]; then",
        "  echo '  → Installing Oh My Zsh...'",
        "  if ! RUNZSH=no CHSH=no sh -c \"$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)\"; then",
        "    echo '  → Warning: Oh My Zsh install failed; continuing setup'",
        "  fi",
        "fi",
        "",
        "ZSH_CUSTOM=\"${ZSH_CUSTOM:-${HOME}/.oh-my-zsh/custom}\"",
        "",
        "if [ ! -d \"${ZSH_CUSTOM}/plugins/zsh-autosuggestions\" ]; then",
        "  echo '  → Installing zsh-autosuggestions...'",
        "  git clone --depth=1 https://github.com/zsh-users/zsh-autosuggestions \"${ZSH_CUSTOM}/plugins/zsh-autosuggestions\"",
        "fi",
        "",
        "if [ ! -d \"${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting\" ]; then",
        "  echo '  → Installing zsh-syntax-highlighting...'",
        "  git clone --depth=1 https://github.com/zsh-users/zsh-syntax-highlighting \"${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting\"",
        "fi",
        "",
        "if [ ! -d \"${ZSH_CUSTOM}/plugins/pnpm\" ]; then",
        "  echo '  → Installing oh-my-zsh pnpm plugin...'",
        "  git clone --depth=1 https://github.com/ntnyq/omz-plugin-pnpm \"${ZSH_CUSTOM}/plugins/pnpm\"",
        "fi",
        "",
        "# ── Configure .zshrc ─────────────────────────────────────────────────────",
        "ZSHRC=\"${HOME}/.zshrc\"",
        "",
        "if [ ! -f \"${ZSHRC}\" ]; then",
        "  touch \"${ZSHRC}\"",
        "fi",
        "",
        "if grep -q '^ZSH_THEME=' \"${ZSHRC}\" 2>/dev/null; then",
        "  sed -i 's/^ZSH_THEME=.*/ZSH_THEME=\"agnoster\"/' \"${ZSHRC}\"",
        "else",
        "  printf 'ZSH_THEME=\"agnoster\"\\n' >> \"${ZSHRC}\"",
        "fi",
        "",
        "if grep -q '^plugins=' \"${ZSHRC}\" 2>/dev/null; then",
        "  sed -i 's/^plugins=.*/plugins=(git docker python node pnpm history direnv zsh-autosuggestions zsh-syntax-highlighting)/' \"${ZSHRC}\"",
        "else",
        "  printf 'plugins=(git docker python node pnpm history direnv zsh-autosuggestions zsh-syntax-highlighting)\\n' >> \"${ZSHRC}\"",
        "fi",
        "",
        "if ! grep -q '# foundation-devbox-zsh' \"${ZSHRC}\" 2>/dev/null; then",
        "  printf '\\n# foundation-devbox-zsh\\n' >> \"${ZSHRC}\"",
        "  printf 'export NVM_DIR=\"$HOME/.nvm\"\\n' >> \"${ZSHRC}\"",
        "  printf '[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"\\n' >> \"${ZSHRC}\"",
        "  printf 'ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE=\"fg=60\"\\n' >> \"${ZSHRC}\"",
        "  printf 'ZSH_AUTOSUGGEST_STRATEGY=(history completion)\\n' >> \"${ZSHRC}\"",
        "fi",
        "",
        "if ! grep -q '# foundation-direnv-zsh-hook' \"${ZSHRC}\" 2>/dev/null; then",
        "  printf '\\n# foundation-direnv-zsh-hook\\n' >> \"${ZSHRC}\"",
        "  printf 'command -v direnv >/dev/null 2>&1 && eval \"$(direnv hook zsh)\"\\n' >> \"${ZSHRC}\"",
        "fi",
        "",
        "if ! grep -q '# foundation-tmux' \"${ZSHRC}\" 2>/dev/null; then",
        "  printf '\\n# foundation-tmux\\n' >> \"${ZSHRC}\"",
        "  printf '# Use repo .tmux.conf when TMUX_CONF is set (populated by .envrc).\\n' >> \"${ZSHRC}\"",
        "  printf 'if [ -n \"${TMUX_CONF:-}\" ]; then\\n' >> \"${ZSHRC}\"",
        "  printf \"  alias tmux='tmux -f \\\"\\$TMUX_CONF\\\"'\\n\" >> \"${ZSHRC}\"",
        "  printf 'fi\\n' >> \"${ZSHRC}\"",
        "fi",
        "",
        "echo '==> Zsh configuration complete!'"
      ],
      "hooks:install": "lefthook install",
      "dev": "process-compose up",
      "dev:ui": "cd ui/web && pnpm dev",
      "dev:api": "cd backend/api && uv run uvicorn --app-dir src main:app --reload --port 8000",
      "dev:supabase": "supabase start",
      "dev:inngest": "npx --yes inngest-cli@0.4.8 dev -u http://localhost:8000/api/inngest",
      "supabase:status": "supabase status",
      "supabase:reset": "supabase db reset",
      "test:api": "cd backend/api && uv run pytest",
      "test:ui": "cd ui/web && pnpm test",
      "lint:ui": "cd ui/web && pnpm dlx @biomejs/biome check ./src",
      "format:ui": "cd ui/web && pnpm dlx @biomejs/biome format --write ./src",
      "lint:api": "cd backend/api && uv run ruff check src/",
      "ci:local": "act pull_request --container-architecture linux/amd64 -W .github/workflows/ci.yml"
    }
  }
}
