Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions tests/test-upskill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ trap cleanup EXIT
pushd "$TMP" >/dev/null

echo "Running upskill (first run) ..."
"$ROOT_DIR/upskill" adobe/helix-website -b agent-skills
"$ROOT_DIR/upskill" adobe/helix-website

test -d .claude/skills || { echo "FAIL: .claude/skills missing"; exit 1; }
count_skills=$(find .claude/skills -name 'SKILL.md' -type f | wc -l | tr -d ' ')
Expand All @@ -39,7 +39,7 @@ count_markers=$(grep -cF "$marker_start" AGENTS.md)
[[ "$count_markers" == "1" ]] || { echo "FAIL: duplicate start markers on first run"; exit 1; }

echo "Running upskill (second run) ..."
"$ROOT_DIR/upskill" adobe/helix-website -b agent-skills
"$ROOT_DIR/upskill" adobe/helix-website

count_markers2=$(grep -cF "$marker_start" AGENTS.md)
[[ "$count_markers2" == "1" ]] || { echo "FAIL: duplicate start markers after second run"; exit 1; }
Expand All @@ -51,7 +51,7 @@ echo "$out" | grep -q -- "---" || { echo "FAIL: discover-skills separator missin

# Test gitignore insertion with -i
echo "Running upskill with -i ..."
"$ROOT_DIR/upskill" -i adobe/helix-website -b agent-skills
"$ROOT_DIR/upskill" -i adobe/helix-website

test -f .gitignore || { echo "FAIL: .gitignore not created"; exit 1; }
grep -qF ".claude/skills/" .gitignore || { echo "FAIL: .gitignore missing skills entry"; exit 1; }
Expand All @@ -60,7 +60,7 @@ grep -qF ".agents/discover-skills" .gitignore || { echo "FAIL: .gitignore missin
# Ensure idempotent block
start_marker="# upskill:gitignore:start"
[[ $(grep -cF "$start_marker" .gitignore) == "1" ]] || { echo "FAIL: duplicate gitignore block after first -i"; exit 1; }
"$ROOT_DIR/upskill" -i adobe/helix-website -b agent-skills
"$ROOT_DIR/upskill" -i adobe/helix-website
[[ $(grep -cF "$start_marker" .gitignore) == "1" ]] || { echo "FAIL: duplicate gitignore block after second -i"; exit 1; }

echo "OK"
Expand Down
8 changes: 4 additions & 4 deletions upskill
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ process_skills_directory() {
local count=0
# Count skills first
while IFS= read -r -d '' skill_file; do
((count++))
count=$((count + 1))
done < <(find "$skills_dir" -type f -name 'SKILL.md' -print0)

if [[ $count -eq 0 ]]; then
Expand Down Expand Up @@ -244,7 +244,7 @@ list_skills() {
local count=0
local -a skill_names=()
while IFS='|' read -r name path description; do
((count++))
count=$((count + 1))
skill_names+=("$name")

# Make path relative to search_dir
Expand Down Expand Up @@ -414,7 +414,7 @@ main() {
log "Installing all $total_count skills..."
while IFS='|' read -r name path description; do
copy_skill "$path" "$dest_skills_dir"
((skill_count++))
skill_count=$((skill_count + 1))
done <"$tmpfile"
elif [[ ${#selected_skills[@]} -gt 0 ]]; then
log "Installing ${#selected_skills[@]} selected skill(s)..."
Expand All @@ -423,7 +423,7 @@ main() {
while IFS='|' read -r name path description; do
if [[ "$name" == "$skill_name" ]]; then
copy_skill "$path" "$dest_skills_dir"
((skill_count++))
skill_count=$((skill_count + 1))
found=1
break
fi
Expand Down