add .mandatory, update learn.sh and sync-skills.sh to use it
This commit is contained in:
2
.mandatory
Normal file
2
.mandatory
Normal file
@@ -0,0 +1,2 @@
|
||||
git-hangman-lab
|
||||
keycloak-hangman-lab
|
||||
49
learn.sh
49
learn.sh
@@ -9,24 +9,41 @@ fi
|
||||
SKILL_LIST="${AGENT_WORKSPACE}/.skill-list"
|
||||
TARGET_DIR="${AGENT_WORKSPACE}/skills"
|
||||
CLAW_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
MANDATORY_FILE="${CLAW_DIR}/.mandatory"
|
||||
|
||||
if [[ ! -f "$SKILL_LIST" ]]; then
|
||||
mkdir -p "$TARGET_DIR"
|
||||
|
||||
# First: install mandatory skills from .mandatory (one per line)
|
||||
if [[ -f "$MANDATORY_FILE" ]]; then
|
||||
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 (mandatory): $skill_name"
|
||||
cp -r "$skill_dir" "${TARGET_DIR}/"
|
||||
else
|
||||
echo "Skipping (not found): $skill_name"
|
||||
fi
|
||||
done < "$MANDATORY_FILE"
|
||||
fi
|
||||
|
||||
# Then: install skills from .skill-list
|
||||
if [[ -f "$SKILL_LIST" ]]; then
|
||||
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"
|
||||
else
|
||||
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."
|
||||
echo "Done."
|
||||
|
||||
@@ -1,19 +1,27 @@
|
||||
#!/bin/bash
|
||||
# Sync all skill folders from ClawSkills to ~/.openclaw/skills
|
||||
# Sync skills listed in .mandatory from ClawSkills to ~/.openclaw/skills
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SKILLS_DIR="$HOME/.openclaw/skills"
|
||||
MANDATORY_FILE="${SCRIPT_DIR}/.mandatory"
|
||||
|
||||
mkdir -p "$SKILLS_DIR"
|
||||
|
||||
for folder in "$SCRIPT_DIR"/*/; do
|
||||
folder_name=$(basename "$folder")
|
||||
# Skip this script itself
|
||||
if [[ "$folder_name" == "sync-skills.sh" ]]; then
|
||||
continue
|
||||
if [[ ! -f "$MANDATORY_FILE" ]]; then
|
||||
echo "Error: .mandatory not found at $MANDATORY_FILE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while IFS= read -r skill_name || [[ -n "$skill_name" ]]; do
|
||||
[[ -z "$skill_name" || "$skill_name" == \#* ]] && continue
|
||||
|
||||
skill_dir="${SCRIPT_DIR}/${skill_name}"
|
||||
if [[ -d "$skill_dir" ]]; then
|
||||
echo "Copying $skill_name to $SKILLS_DIR..."
|
||||
cp -rf "$skill_dir" "$SKILLS_DIR/"
|
||||
else
|
||||
echo "Skipping (not found): $skill_name"
|
||||
fi
|
||||
echo "Copying $folder_name to $SKILLS_DIR..."
|
||||
cp -rf "$folder" "$SKILLS_DIR/"
|
||||
done
|
||||
done < "$MANDATORY_FILE"
|
||||
|
||||
echo "Done!"
|
||||
|
||||
Reference in New Issue
Block a user