diff --git a/.gitignore b/.gitignore index e367f05..82ca0e9 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ htmlcov/ # Root vendor/ is accidental - real vendored client lives at scripts/lib/vendor/bird-search/ /vendor/ + +# build artifact from scripts/build-skill.sh +/dist/ diff --git a/scripts/build-skill.sh b/scripts/build-skill.sh new file mode 100755 index 0000000..fadf72a --- /dev/null +++ b/scripts/build-skill.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# build-skill.sh - package this repo as a claude.ai-upload-ready .skill file +# Usage: bash scripts/build-skill.sh (run from repo root) +# +# Produces dist/last30days.skill, a zip with a single top-level `last30days/` +# directory containing SKILL.md and the scripts/ runtime. See +# docs/plans/2026-04-14-001-fix-skill-upload-200-file-limit-plan.md. +set -euo pipefail + +REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)" +cd "$REPO_ROOT" + +if ! git diff --quiet || ! git diff --cached --quiet; then + echo "error: working tree is dirty; commit or stash before building" >&2 + exit 1 +fi + +mkdir -p dist +OUT="dist/last30days.skill" +git archive --format=zip --prefix=last30days/ --output="$OUT" HEAD + +COUNT=$(unzip -l "$OUT" | tail -1 | awk '{print $2}') +SIZE=$(du -h "$OUT" | cut -f1) + +if [ "$COUNT" -gt 200 ]; then + echo "error: $COUNT files in zip, claude.ai's cap is 200" >&2 + echo " check .gitattributes export-ignore entries" >&2 + exit 1 +fi + +SKILL_MD_COUNT=$(unzip -l "$OUT" | grep -c "SKILL.md" || true) +if [ "$SKILL_MD_COUNT" -ne 1 ]; then + echo "error: expected exactly one SKILL.md, found $SKILL_MD_COUNT" >&2 + exit 1 +fi + +echo "built $OUT ($COUNT files, $SIZE)" +echo "upload via the claude.ai skill UI"