返回 last30days-skill
build-skill.sh
根目录 / skills / last30days / scripts / build-skill.sh
1 #!/usr/bin/env bash
2 # build-skill.sh - package this repo as a claude.ai-upload-ready .skill file
3 # Usage: bash skills/last30days/scripts/build-skill.sh (run from repo root)
4 #
5 # Produces dist/last30days.skill, a zip with a single top-level `last30days/`
6 # directory containing SKILL.md and the scripts/ runtime from skills/last30days.
7 # See
8 # docs/plans/2026-04-14-001-fix-skill-upload-200-file-limit-plan.md.
9 set -euo pipefail
10
11 REPO_ROOT="$(cd "$(dirname "$0")/../../.." && pwd)"
12 cd "$REPO_ROOT"
13
14 if ! git diff --quiet || ! git diff --cached --quiet; then
15 echo "error: working tree is dirty; commit or stash before building" >&2
16 exit 1
17 fi
18
19 mkdir -p dist
20 OUT="dist/last30days.skill"
21 git archive --format=zip --prefix=last30days/ --output="$OUT" HEAD:skills/last30days
22
23 COUNT=$(unzip -l "$OUT" | tail -1 | awk '{print $2}')
24 SIZE=$(du -h "$OUT" | cut -f1)
25
26 if [ "$COUNT" -gt 200 ]; then
27 echo "error: $COUNT files in zip, claude.ai's cap is 200" >&2
28 echo " check .gitattributes export-ignore entries and this script's zip -d excludes" >&2
29 exit 1
30 fi
31
32 SKILL_MD_COUNT=$(unzip -l "$OUT" | grep -c "SKILL.md" || true)
33 if [ "$SKILL_MD_COUNT" -ne 1 ]; then
34 echo "error: expected exactly one SKILL.md, found $SKILL_MD_COUNT" >&2
35 exit 1
36 fi
37
38 echo "built $OUT ($COUNT files, $SIZE)"
39 echo "upload via the claude.ai skill UI"
40
40 lines BASH