From 5c405ff5faf5d033c4c2a9e624b900683a095c1b Mon Sep 17 00:00:00 2001 From: lyn Date: Mon, 13 Apr 2026 14:05:08 +0000 Subject: [PATCH] Add learn.sh: install skills from .skill-list to workspace/skills --- learn.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 learn.sh diff --git a/learn.sh b/learn.sh new file mode 100755 index 0000000..6b5eeec --- /dev/null +++ b/learn.sh @@ -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." \ No newline at end of file