Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .agents/skills/create-pr/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ This guide covers best practices for creating pull requests in the warp reposito
## Related Skills

- `fix-errors` - Fix presubmit failures (formatting, linting, tests) before opening PR
- `rust-unit-tests` - Write unit tests for your changes, if applicable (see "Testing Requirements" below)
- `warp-integration-test` - Add or update integration coverage for user-visible flows, regressions, and P0 use cases
- `add-feature-flag` - Gate changes behind feature flags

Expand Down Expand Up @@ -156,7 +155,7 @@ Code with non-trivial logic should have unit tests to validate functionality:
- Sufficiently-simple functions
- Trivial getters/setters

See the `rust-unit-tests` skill for guidance on writing unit tests.
Follow the repository's local testing conventions for guidance on writing unit tests.

### UI components need layout validation tests

Expand Down
3 changes: 1 addition & 2 deletions .agents/skills/implement-specs/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Before considering the work complete, verify that the code matches the current s

Prefer:

- `rust-unit-tests` for unit tests and regression coverage
- unit tests and regression coverage that follow the repository's local testing conventions
- integration or end-to-end tests for important user flows

## Best Practices
Expand All @@ -88,4 +88,3 @@ Prefer:
- `spec-driven-implementation`
- `write-product-spec`
- `write-tech-spec`
- `rust-unit-tests`
2 changes: 1 addition & 1 deletion .agents/skills/spec-driven-implementation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ The checked-in specs should describe the feature that actually ships, not just t

Before considering the work complete, make sure verification maps back to the specs. Prefer tests and artifacts that validate the product behavior directly:

- use the `rust-unit-tests` skill for crate-level unit tests and regression coverage
- unit tests and regression coverage that follow the repository's local testing conventions
- integration tests for critical user flows
- loom walkthroughs or equivalent feature demonstrations when appropriate
- screenshots or videos when useful for UI-heavy work
Expand Down
3 changes: 1 addition & 2 deletions .agents/skills/update-skill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Use this skill when the user needs to work with PDF files...
Every SKILL.md must start with YAML frontmatter containing:

- **name**: Kebab-case identifier (lowercase letters, numbers, hyphens only)
- Example: `add-feature-flag`, `rust-unit-tests`, `update-skill`
- Example: `add-feature-flag`, `pdf-processing`, `update-skill`
- **description**: Specific description of what the skill does and when to use it
- Must be non-empty
- Should include key terms for skill discovery
Expand Down Expand Up @@ -101,7 +101,6 @@ Keep only essential workflow and procedural instructions in SKILL.md. Move detai
For reference on structure and style:

- `.agents/skills/add-feature-flag/SKILL.md` - Multi-step workflow with clear sequential steps
- `.agents/skills/rust-unit-tests/SKILL.md` - Comprehensive guide with code examples and helper utilities
- `.agents/skills/remove-feature-flag/SKILL.md` - Cleanup workflow with search commands

## Best Practices
Expand Down
4 changes: 4 additions & 0 deletions WARP.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,13 @@ Environment variables:

### Platform Setup
- `./script/bootstrap` - Platform-specific setup (calls platform-specific bootstrap scripts)
- `./script/bootstrap --install-common-skills` - Platform setup plus common agent skill installation from `skills-lock.json`.
- `./script/install_common_skills --if-needed` - Install or refresh shared agent skills from the standard `npx skills` project lock.
- `./script/install_cargo_build_deps` - Install Cargo build dependencies
- `./script/install_cargo_test_deps` - Install Cargo test dependencies

`skills-lock.json` is the standard project lock file managed by `npx skills`. `script/run` checks this lock before building and restores the checked-in project skills with the pinned `skills@1.5.6` CLI when the local install stamp is stale. To update the locked common skills, run `npx --yes skills@1.5.6 update -p -y` and commit the resulting `skills-lock.json` and `.agents/skills` changes.

## Architecture Overview

This is a Rust-based terminal emulator with a custom UI framework called **WarpUI**.
Expand Down
89 changes: 82 additions & 7 deletions script/bootstrap
Original file line number Diff line number Diff line change
@@ -1,24 +1,99 @@
#!/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)"
INSTALL_COMMON_SKILLS=0
PLATFORM_ARGS=()

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.

Environment:
WARP_SKIP_COMMON_SKILLS_INSTALL=1
Skip installing common agent skills, even when --install-common-skills is provided.
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 unless --install-common-skills is provided."
elif [[ "${WARP_SKIP_COMMON_SKILLS_INSTALL:-}" = "1" ]]; then
echo " - Skip common agent skills because WARP_SKIP_COMMON_SKILLS_INSTALL=1."
else
echo " - Install or update common agent skills from skills-lock.json if needed."
fi
echo "Run ./script/bootstrap --help to see options and environment overrides."
echo
}

for arg in "$@"; do
case "$arg" in
-y|--yes) export WARP_SKIP_SUDO_PROMPT=1 ;;
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
;;
*)
PLATFORM_ARGS+=("${arg}")
;;
esac
done

OS_TYPE="$(uname -s)"
maybe_install_common_skills() {
if [[ "${INSTALL_COMMON_SKILLS}" -eq 1 ]]; then
./script/install_common_skills --if-needed
fi
}

if [[ "$OS_TYPE" = "Darwin" ]]; then
./script/macos/bootstrap "$@"
print_bootstrap_preview "macOS"
./script/macos/bootstrap "${PLATFORM_ARGS[@]}"
maybe_install_common_skills
elif [[ "$OS_TYPE" = "Linux" ]]; then
./script/linux/bootstrap "$@"
elif [[ "$OS_TYPE" =~ ^[MINGW64_NT|MSYS_NT] ]]; then
./script/windows/bootstrap.ps1 "$@"
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
./script/windows/bootstrap.ps1 "${PLATFORM_ARGS[@]}" -InstallCommonSkills
else
./script/windows/bootstrap.ps1 "${PLATFORM_ARGS[@]}"
fi
else
echo "No bootstrap script defined for the current platform!"
exit 1
Expand Down
127 changes: 127 additions & 0 deletions script/install_common_skills
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
#!/usr/bin/env bash

set -eo pipefail

REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")"/.. && pwd)"
LOCK_FILE="${REPO_ROOT}/skills-lock.json"
STAMP_RELATIVE_PATH="warp/common-skills-lock.hash"
SKILLS_CLI_VERSION="1.5.6"

IF_NEEDED=0
FORCE=0
QUIET=0

usage() {
cat <<EOF
Usage: ./script/install_common_skills [options]

Install or update common agent skills from the standard project skills-lock.json.

Options:
--if-needed Skip installation when the local stamp matches skills-lock.json.
--non-interactive Accepted for compatibility; installation is non-interactive.
--force Install even if the local stamp is already up to date.
--quiet Suppress "already up to date" informational output.
-h, --help Show this help message.

Environment:
WARP_SKIP_COMMON_SKILLS_INSTALL=1
Skip installing common agent skills.
EOF
}

log() {
if [[ "${QUIET}" -ne 1 ]]; then
echo "$@"
fi
}

lock_hash() {
git -C "${REPO_ROOT}" hash-object "${LOCK_FILE}"
}

stamp_file() {
local git_path=""

if git_path="$(git -C "${REPO_ROOT}" rev-parse --git-path "${STAMP_RELATIVE_PATH}" 2>/dev/null)"; then
case "${git_path}" in
/*)
echo "${git_path}"
;;
*)
echo "${REPO_ROOT}/${git_path}"
;;
esac
return
fi

echo "${REPO_ROOT}/.agents/skills/.common-skills-lock.hash"
}

stamp_hash() {
local file="$1"

if [[ -f "${file}" ]]; then
cat "${file}"
fi
}

install_from_lock() {
(
cd "${REPO_ROOT}"
npx --yes "skills@${SKILLS_CLI_VERSION}" experimental_install
)
}

while [[ $# -gt 0 ]]; do
case "$1" in
--if-needed)
IF_NEEDED=1
shift
;;
--non-interactive)
shift
;;
--force)
FORCE=1
shift
;;
--quiet)
QUIET=1
shift
;;
-h|--help)
usage
exit 0
;;
*)
echo "error: unknown argument: $1" >&2
usage >&2
exit 1
;;
esac
done

if [[ "${WARP_SKIP_COMMON_SKILLS_INSTALL:-}" = "1" ]]; then
log "Skipping common-skills install because WARP_SKIP_COMMON_SKILLS_INSTALL=1."
exit 0
fi

if [[ ! -f "${LOCK_FILE}" ]]; then
echo "error: missing skills lock file: ${LOCK_FILE}" >&2
exit 1
fi

LOCK_HASH="$(lock_hash)"
STAMP_FILE="$(stamp_file)"
STAMP_HASH="$(stamp_hash "${STAMP_FILE}")"

if [[ "${FORCE}" -ne 1 && "${IF_NEEDED}" -eq 1 && "${STAMP_HASH}" = "${LOCK_HASH}" ]]; then
log "Common skills are already up to date."
exit 0
fi

echo "Installing common agent skills from skills-lock.json."
install_from_lock
mkdir -p "$(dirname "${STAMP_FILE}")"
printf "%s\n" "${LOCK_HASH}" > "${STAMP_FILE}"
1 change: 1 addition & 0 deletions script/macos/bootstrap
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ if [ -z "$DEVELOPER_DIR" ] || [ ! -x "$DEVELOPER_DIR/usr/bin/xcodebuild" ] || [
exit 1
fi
echo "Selected Xcode at $XCODE_APP"
echo "You may be prompted for your password so bootstrap can set Xcode as the active developer directory."
warp_sudo xcode-select --switch "$XCODE_APP/Contents/Developer"
fi
# Mimic actually launching XCode, which performs some necessary set-up of the
Expand Down
14 changes: 14 additions & 0 deletions script/run
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ cd "${REPO_ROOT}"
OS_TYPE="$(uname -s)"

FEATURES="gui"
INSTALL_COMMON_SKILLS=1
FORCE_COMMON_SKILLS=0

./script/install_channel_config || echo "Skipping internal channel config installation (no repo access)."

Expand Down Expand Up @@ -63,6 +65,10 @@ while (( "$#" )); do
exit 1
fi
;;
--install-common-skills)
FORCE_COMMON_SKILLS=1
shift
;;
--release)
CARGO_PARAMS+=("$1")
MAC_ARGS+=("$1")
Expand All @@ -87,6 +93,14 @@ while (( "$#" )); do
esac
done

if [[ "$INSTALL_COMMON_SKILLS" -eq 1 ]]; then
if [[ "$FORCE_COMMON_SKILLS" -eq 1 ]]; then
./script/install_common_skills --force --non-interactive || echo "Skipping common-skills update."
else
./script/install_common_skills --if-needed --non-interactive --quiet || echo "Skipping common-skills update."
fi
fi

# These cargo features were removed and replaced by environment variables read
# by warp-channel-config. Intercept them here so that existing --features
# invocations keep working.
Expand Down
Loading
Loading