#!/usr/bin/env bash
set -euo pipefail

source "$(cd "$(dirname "$0")" && pwd)/_common.sh"
require_git

mkdir -p "${WORKSPACE_ROOT}/oss_llm"

if [[ -d "${NANOGPT_DIR}/.git" ]]; then
  echo "nanoGPT already cloned; updating…"
  cd "${NANOGPT_DIR}"
  git pull --ff-only
else
  echo "Cloning nanoGPT into ${NANOGPT_DIR}…"
  rm -rf "${NANOGPT_DIR}"
  git clone https://github.com/karpathy/nanoGPT.git "${NANOGPT_DIR}"
fi
