Add learn.sh: install skills from .skill-list to workspace/skills

This commit is contained in:
lyn
2026-04-13 14:05:08 +00:00
parent d20e827a5c
commit 5c405ff5fa

32
learn.sh Executable file
View File

@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail
if [[ -z "${AGENT_WORKSPACE:-}" ]]; then
echo "Error: script must be executed by pcexec"
exit 1
fi
SKILL_LIST="${AGENT_WORKSPACE}/.skill-list"
TARGET_DIR="${AGENT_WORKSPACE}/skills"
CLAW_DIR="$(cd "$(dirname "$0")" && pwd)"
if [[ ! -f "$SKILL_LIST" ]]; then
echo "Error: .skill-list not found at $SKILL_LIST"
exit 1
fi
mkdir -p "$TARGET_DIR"
while IFS= read -r skill_name || [[ -n "$skill_name" ]]; do
[[ -z "$skill_name" || "$skill_name" == \#* ]] && continue
skill_dir="${CLAW_DIR}/${skill_name}"
if [[ -d "$skill_dir" ]]; then
echo "Installing: $skill_name"
cp -r "$skill_dir" "${TARGET_DIR}/"
else
echo "Skipping (not found): $skill_name"
fi
done < "$SKILL_LIST"
echo "Done."