Files
warp/script/bootstrap
Zach Lloyd a529cdbf03 Move common skills management to common-skills scripts (#10617)
## Description
Move common-skills install/remove/verify responsibilities out of the
Warp checkout and into `warpdotdev/common-skills/scripts`, then have
Warp delegate to those scripts.

This keeps the common skill management logic with the common skills repo
while preserving the existing Warp developer flows:
- `script/bootstrap` and `script/run` resolve the common-skills scripts
from `WARP_COMMON_SKILLS_SCRIPTS_DIR`, a sibling `../common-skills`
checkout, or a common-skills worktree.
- Both entrypoints pass `--repo-root` so the external scripts operate on
the current Warp checkout.
- Bootstrap and run now verify installed common skills against
`skills-lock.json` after install/update.
- Documentation and Oz environment guidance now point at the external
common-skills scripts.

This PR depends on the companion `warpdotdev/common-skills` branch
`zach/move-common-skill-scripts`, which adds the scripts used here.

script/bootstrap

<img width="839" height="182" alt="Screenshot 2026-05-10 at 3 32 42 PM"
src="https://github.com/user-attachments/assets/347e469f-ac4c-4e18-980f-87d6a9a1a469"
/>

<img width="1044" height="102" alt="Screenshot 2026-05-10 at 5 37 22 PM"
src="https://github.com/user-attachments/assets/09f6d4ff-43a5-40c8-88c7-8df82c73b74c"
/>


## Linked Issue
N/A
- [ ] The linked issue is labeled `ready-to-spec` or
`ready-to-implement`.
- [ ] Where appropriate, screenshots or a short video of the
implementation are included below (especially for user-visible or UI
changes).

## Testing
- `bash -n script/run script/bootstrap`
- `bash -n
/Users/zach/.warp-dev/worktrees/common-skills/move-common-skill-scripts/scripts/install_common_skills
/Users/zach/.warp-dev/worktrees/common-skills/move-common-skill-scripts/scripts/remove_common_skills
/Users/zach/.warp-dev/worktrees/common-skills/move-common-skill-scripts/scripts/verify_common_skills`
- `pwsh -NoProfile -Command '$null = [scriptblock]::Create((Get-Content
-Raw "script/windows/bootstrap.ps1"))'`
- `git diff --check`
- Smoke-tested bootstrap/run common-skills paths using temporary copies
that no-op platform setup/app launch.

- [ ] I have manually tested my changes locally with `./script/run`

### Screenshots / Videos
N/A — script and documentation changes only.

## Agent Mode
- [x] Warp Agent Mode - This PR was created via Warp's AI Agent Mode

Conversation:
https://staging.warp.dev/conversation/d6752e7c-9dfc-4929-a524-002bd7d2ecaa

Co-Authored-By: Oz <oz-agent@warp.dev>

---------

Co-authored-by: Oz <oz-agent@warp.dev>
2026-05-13 16:13:22 -06:00

173 lines
6.2 KiB
Bash
Executable File

#!/usr/bin/env bash
set -eo pipefail
# Bootstrap dispatches to the platform-specific install scripts. Each step
# that needs root sources `script/warp_sudo` and asks for confirmation
# before running. Pass -y / --yes (or set WARP_SKIP_SUDO_PROMPT=1) to skip
# the prompts in unattended environments.
OS_TYPE="$(uname -s)"
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
INSTALL_COMMON_SKILLS=1
COMMON_SKILLS_TARGET="${WARP_COMMON_SKILLS_INSTALL_TARGET:-}"
PLATFORM_ARGS=()
cd "${REPO_ROOT}"
usage() {
cat <<EOF
Usage: ./script/bootstrap [options]
Prepare this checkout for Warp development by running the platform-specific bootstrap steps.
Options:
-h, --help Show this help message.
--install-common-skills Install or update common agent skills from skills-lock.json (default).
--install-common-skills-in-repo
Install or update common agent skills in this checkout's .agents/skills.
--install-common-skills-globally
Install or update common agent skills in ~/.agents/skills.
--skip-common-skills Skip installing common agent skills.
Environment:
WARP_SKIP_COMMON_SKILLS_INSTALL=1
Skip installing common agent skills, even when --install-common-skills is provided.
WARP_COMMON_SKILLS_INSTALL_TARGET=project|global
Choose the install target when no explicit prompt answer is provided.
Target prompting and duplicate checks are delegated to
warpdotdev/common-skills/scripts/install_common_skills.
WARP_COMMON_SKILLS_SCRIPTS_DIR=/path/to/common-skills/scripts
Override where common-skills management scripts are loaded from.
If unset, ./script/resolve_common_skills executes the raw script from
warpdotdev/common-skills.
WARP_COMMON_SKILLS_REF=<git-ref>
Override the remote warpdotdev/common-skills ref for raw script fallback.
EOF
}
print_bootstrap_preview() {
local platform="$1"
echo "Warp bootstrap is starting for ${platform}."
echo "It will:"
if [[ "${platform}" = "macOS" ]]; then
echo " - Configure Xcode as the active developer directory."
echo " - Install or update Cargo, Homebrew, PowerShell, Docker, gcloud, and related development tools."
echo " - Add the aarch64-apple-darwin Rust target."
elif [[ "${platform}" = "Linux" ]]; then
echo " - Update apt package metadata."
echo " - Install dependencies needed to build, run, and test Warp."
echo " - Install linuxdeploy and check gcloud authentication."
fi
if [[ "${INSTALL_COMMON_SKILLS}" -eq 0 ]]; then
echo " - Skip common agent skills because --skip-common-skills was provided."
elif [[ "${WARP_SKIP_COMMON_SKILLS_INSTALL:-}" = "1" ]]; then
echo " - Skip common agent skills because WARP_SKIP_COMMON_SKILLS_INSTALL=1."
elif [[ "${COMMON_SKILLS_TARGET}" = "global" ]]; then
echo " - Install or update common agent skills in ~/.agents/skills if needed."
elif [[ "${COMMON_SKILLS_TARGET}" = "project" ]]; then
echo " - Install or update common agent skills in this checkout's .agents/skills if needed."
else
echo " - Prompt for where common agent skills should be installed before installing or updating them."
fi
if [[ "${INSTALL_COMMON_SKILLS}" -eq 1 && "${WARP_SKIP_COMMON_SKILLS_INSTALL:-}" != "1" ]]; then
echo " - Verify installed common skills match skills-lock.json."
fi
echo "Run ./script/bootstrap --help to see options and environment overrides."
echo
}
for arg in "$@"; do
case "${arg}" in
-h|--help)
usage
exit 0
;;
-y|--yes)
export WARP_SKIP_SUDO_PROMPT=1
if [[ ! "$OS_TYPE" =~ ^(MINGW64_NT|MSYS_NT) ]]; then
PLATFORM_ARGS+=("${arg}")
fi
;;
--install-common-skills)
INSTALL_COMMON_SKILLS=1
;;
--install-common-skills-in-repo)
INSTALL_COMMON_SKILLS=1
COMMON_SKILLS_TARGET="project"
;;
--install-common-skills-globally)
INSTALL_COMMON_SKILLS=1
COMMON_SKILLS_TARGET="global"
;;
--skip-common-skills)
INSTALL_COMMON_SKILLS=0
;;
*)
PLATFORM_ARGS+=("${arg}")
;;
esac
done
maybe_install_common_skills() {
if [[ "${INSTALL_COMMON_SKILLS}" -eq 1 ]]; then
local target_args=()
if [[ "${WARP_SKIP_COMMON_SKILLS_INSTALL:-}" = "1" ]]; then
return
fi
if [[ "${COMMON_SKILLS_TARGET}" = "project" || "${COMMON_SKILLS_TARGET}" = "global" ]]; then
target_args=("--${COMMON_SKILLS_TARGET}")
./script/resolve_common_skills install_common_skills -- --repo-root "${REPO_ROOT}" "${target_args[@]}" --if-needed
else
./script/resolve_common_skills install_common_skills -- --repo-root "${REPO_ROOT}" --if-needed --prompt-for-target
fi
fi
}
# This repository requires Git LFS; ensure it is installed and initialized
# for this checkout.
ensure_git_lfs() {
if ! command -v git-lfs >/dev/null 2>&1; then
echo
echo "warning: git-lfs is not installed. Install it before continuing:"
case "${OS_TYPE}" in
Darwin) echo " brew install git-lfs" ;;
Linux) echo " sudo apt-get install -y git-lfs # or your distro's package manager" ;;
MINGW64_NT*|MSYS_NT*) echo " choco install git-lfs # or: winget install GitHub.GitLFS" ;;
*) echo " See https://git-lfs.com for install instructions." ;;
esac
echo "After installing, re-run ./script/bootstrap."
return 1
fi
git lfs install --local >/dev/null
git lfs pull
}
ensure_git_lfs
if [[ "$OS_TYPE" = "Darwin" ]]; then
print_bootstrap_preview "macOS"
./script/macos/bootstrap "${PLATFORM_ARGS[@]}"
maybe_install_common_skills
elif [[ "$OS_TYPE" = "Linux" ]]; then
print_bootstrap_preview "Linux"
./script/linux/bootstrap "${PLATFORM_ARGS[@]}"
maybe_install_common_skills
elif [[ "$OS_TYPE" =~ ^(MINGW64_NT|MSYS_NT) ]]; then
if [[ "${INSTALL_COMMON_SKILLS}" -eq 1 ]]; then
if [[ -n "${COMMON_SKILLS_TARGET}" ]]; then
./script/windows/bootstrap.ps1 "${PLATFORM_ARGS[@]}" -InstallCommonSkills -CommonSkillsTarget "${COMMON_SKILLS_TARGET}"
else
./script/windows/bootstrap.ps1 "${PLATFORM_ARGS[@]}" -InstallCommonSkills
fi
else
./script/windows/bootstrap.ps1 "${PLATFORM_ARGS[@]}"
fi
else
echo "No bootstrap script defined for the current platform!"
exit 1
fi