mirror of
https://github.com/warpdotdev/warp.git
synced 2026-05-07 07:38:59 +08:00
### Description The channel-gated skills README and the runtime error message in \`script/copy_conditional_skills\` both pointed contributors at \`resources/skills/\` for stable-ready skills, but that directory doesn't exist in the repo — \`script/prepare_bundled_resources\` copies the always-bundled skills from \`resources/bundled/\`, so the right destination is \`resources/bundled/skills/\`. The result: if anyone bumped into the existing \`stable/\` guard (\`copy_conditional_skills\` line 39), the printed remediation pointed them at a path that doesn't exist. Three updates: - \`resources/channel-gated-skills/README.md\` — \"place them in the always-bundled \`resources/skills/\`\" → \`resources/bundled/skills/\` (in the prose blockquote and in the gating table). - \`script/copy_conditional_skills\` — header comment + the user-facing error \`echo\`. No behavior change in the script itself; only the comment and the error string contents. ### Testing Doc/script-comment only — nothing to run. The actual copy logic is unchanged. ### Server API No server changes. ### Agent Mode Not applicable. ### Changelog Entries None. Co-authored-by: anshul-garg27 <anshul-garg27@users.noreply.github.com>
109 lines
3.0 KiB
Bash
Executable File
109 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# Copy channel-gated bundled skills into the app bundle.
|
|
#
|
|
# Usage:
|
|
# copy_conditional_skills <channel> <gated_skills_src> <dest_skills_dir>
|
|
#
|
|
# Arguments:
|
|
# channel: Release channel (local, dev, preview, stable).
|
|
# gated_skills_src: Path to resources/channel-gated-skills/.
|
|
# dest_skills_dir: Destination skills directory (e.g. .../bundled/skills/).
|
|
#
|
|
# Gating is progressive: earlier gates include all skills from later gates.
|
|
# For example, a dogfood build includes skills from both dogfood/ and
|
|
# preview/. The stable channel has no gate — stable-ready skills belong
|
|
# in resources/bundled/skills/ (the always-bundled directory).
|
|
|
|
set -e
|
|
|
|
if [ $# -ne 3 ]; then
|
|
echo "Usage: $0 <channel> <gated_skills_src> <dest_skills_dir>" >&2
|
|
exit 1
|
|
fi
|
|
|
|
CHANNEL="$1"
|
|
GATED_SKILLS_SRC="$2"
|
|
DEST_SKILLS_DIR="$3"
|
|
|
|
# Gate labels ordered from most-inclusive to least-inclusive.
|
|
# A channel's gate includes all gates at or after its position.
|
|
GATE_ORDER=("dogfood" "preview")
|
|
|
|
if [ ! -d "$GATED_SKILLS_SRC" ]; then
|
|
exit 0
|
|
fi
|
|
|
|
# Error out if a stable/ gate directory exists — stable skills should live
|
|
# in the always-bundled resources/bundled/skills/ directory instead.
|
|
if [ -d "$GATED_SKILLS_SRC/stable" ]; then
|
|
echo "Error: found a 'stable/' directory in $GATED_SKILLS_SRC." >&2
|
|
echo "The stable channel does not use gated skills. Move stable-ready skills to resources/bundled/skills/ (the always-bundled directory) instead." >&2
|
|
exit 1
|
|
fi
|
|
|
|
# Map the release channel to its gate label.
|
|
case "$CHANNEL" in
|
|
local|dev) GATE="dogfood" ;;
|
|
preview) GATE="preview" ;;
|
|
*)
|
|
echo " Channel '$CHANNEL' has no gated skills, skipping"
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
# Build the set of included gates (progressive: this gate and all after it).
|
|
INCLUDED_GATES=()
|
|
FOUND=false
|
|
for g in "${GATE_ORDER[@]}"; do
|
|
if [ "$g" = "$GATE" ]; then
|
|
FOUND=true
|
|
fi
|
|
if [ "$FOUND" = true ]; then
|
|
INCLUDED_GATES+=("$g")
|
|
fi
|
|
done
|
|
|
|
# Helper: check if a value is in the included gates list.
|
|
is_included() {
|
|
local needle="$1"
|
|
for g in "${INCLUDED_GATES[@]}"; do
|
|
if [ "$g" = "$needle" ]; then
|
|
return 0
|
|
fi
|
|
done
|
|
return 1
|
|
}
|
|
|
|
# Iterate over gate directories and copy matching skills.
|
|
for gate_dir in "$GATED_SKILLS_SRC"/*/; do
|
|
# Skip if the glob didn't match anything.
|
|
[ -d "$gate_dir" ] || continue
|
|
|
|
gate_name="$(basename "$gate_dir")"
|
|
|
|
if ! is_included "$gate_name"; then
|
|
# List the skills that would have been included for the skip message.
|
|
skills=""
|
|
for skill_dir in "$gate_dir"/*/; do
|
|
[ -d "$skill_dir" ] || continue
|
|
if [ -n "$skills" ]; then
|
|
skills="$skills, "
|
|
fi
|
|
skills="$skills$(basename "$skill_dir")"
|
|
done
|
|
echo " Skipping gate '$gate_name' (channel '$CHANNEL') — would include: $skills"
|
|
continue
|
|
fi
|
|
|
|
for skill_dir in "$gate_dir"/*/; do
|
|
[ -d "$skill_dir" ] || continue
|
|
|
|
skill_name="$(basename "$skill_dir")"
|
|
dest="$DEST_SKILLS_DIR/$skill_name"
|
|
echo " Copying gated skill: $skill_name (gate: $gate_name)"
|
|
mkdir -p "$dest"
|
|
cp -R "$skill_dir"/. "$dest"/
|
|
done
|
|
done
|