Add learn.sh: install skills from .skill-list to workspace/skills
This commit is contained in:
32
learn.sh
Executable file
32
learn.sh
Executable 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."
|
||||||
Reference in New Issue
Block a user