- skills/active-platform/SKILL.md: default = Windows/PowerShell; trigger phrases in RU+EN switch the active platform for the session; per-platform conventions (chaining, paths, env vars, install scripts) documented - dist/active-platform.skill: built archive - .wiki/source/active-platform-decision.md: rationale (skill chosen over global CLAUDE.md / project memory; user wanted a discoverable, iterable artifact) - scripts/build.sh: fix PS arg-passing — single-quotes were leaking into -Names value, so multi-arg builds on Windows were rejected with "not found in skills/" Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
52 lines
1.7 KiB
Bash
52 lines
1.7 KiB
Bash
#!/usr/bin/env bash
|
|
# Build .skill archives from skills/<name>/ into dist/<name>.skill
|
|
# Usage: build.sh [name...] (no args = all)
|
|
#
|
|
# Uses `zip` if available; otherwise delegates to scripts/build.ps1
|
|
# (so the script works on Linux, macOS, and Windows-with-git-bash without
|
|
# requiring `zip` on Windows).
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
|
|
SRC="$ROOT/skills"
|
|
DIST="$ROOT/dist"
|
|
|
|
if command -v zip >/dev/null 2>&1; then
|
|
mkdir -p "$DIST"
|
|
if [ "$#" -eq 0 ]; then
|
|
mapfile -t names < <(find "$SRC" -mindepth 1 -maxdepth 1 -type d -printf '%f\n' | sort)
|
|
else
|
|
names=("$@")
|
|
fi
|
|
for name in "${names[@]}"; do
|
|
src_dir="$SRC/$name"
|
|
if [ ! -d "$src_dir" ]; then
|
|
echo "skip: $name (not found in skills/)" >&2
|
|
continue
|
|
fi
|
|
if [ ! -f "$src_dir/SKILL.md" ]; then
|
|
echo "skip: $name (missing SKILL.md)" >&2
|
|
continue
|
|
fi
|
|
out="$DIST/$name.skill"
|
|
rm -f "$out"
|
|
( cd "$SRC" && zip -qr "$out" "$name" )
|
|
echo "built: dist/$name.skill"
|
|
done
|
|
elif command -v powershell.exe >/dev/null 2>&1; then
|
|
# Windows fallback: delegate to build.ps1 (proper ZIP via .NET API).
|
|
ps1="$SCRIPT_DIR/build.ps1"
|
|
if [ "$#" -eq 0 ]; then
|
|
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(cygpath -w "$ps1" 2>/dev/null || echo "$ps1")"
|
|
else
|
|
# PS array via -File: comma-separated, no extra quoting (bash arg becomes one PS token).
|
|
joined=$(printf ",%s" "$@")
|
|
joined="${joined:1}"
|
|
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$(cygpath -w "$ps1" 2>/dev/null || echo "$ps1")" -Names "$joined"
|
|
fi
|
|
else
|
|
echo "error: need either 'zip' (Linux/macOS) or PowerShell (Windows) to build .skill archives" >&2
|
|
exit 1
|
|
fi
|