The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
fix(skill-stocktake): surface find errors instead of swallowing them
Deepu S Nathdfb5da59fb8f
diff --git a/skills/skill-stocktake/scripts/quick-diff.sh b/skills/skill-stocktake/scripts/quick-diff.shindex 75dbac273..a2177b39a 100755--- a/skills/skill-stocktake/scripts/quick-diff.sh+++ b/skills/skill-stocktake/scripts/quick-diff.sh@@ -51,6 +51,17 @@ i=0process_dir() {local dir="$1"+ local find_out="$tmpdir/.find-stdout"+ local find_err="$tmpdir/.find-stderr"+ # Capture find's exit status and stderr instead of discarding them: with -L,+ # a broken symlink or unreadable directory makes find skip that entry AND+ # exit non-zero, which would otherwise silently under-count skills.+ if ! find -L "$dir" -name "SKILL.md" -type f >"$find_out" 2>"$find_err"; then+ echo "Warning: find encountered errors while scanning $dir (broken symlinks or permission issues may cause skills to be missed):" >&2+ cat "$find_err" >&2+ fi+ sort -o "$find_out" "$find_out"+while IFS= read -r file; dolocal mtime dp is_newmtime=$(date -u -r "$file" +%Y-%m-%dT%H:%M:%SZ)@@ -74,7 +85,7 @@ process_dir() {'{path:$path,mtime:$mtime,is_new:$is_new}' \> "$tmpdir/$i.json"i=$((i+1))- done < <(find -L "$dir" -name "SKILL.md" -type f 2>/dev/null | sort)+ done < "$find_out"}[[ -d "$GLOBAL_DIR" ]] && process_dir "$GLOBAL_DIR"diff --git a/skills/skill-stocktake/scripts/scan.sh b/skills/skill-stocktake/scripts/scan.shindex 9a5aca497..4197fff96 100755--- a/skills/skill-stocktake/scripts/scan.sh+++ b/skills/skill-stocktake/scripts/scan.sh@@ -95,6 +95,17 @@ scan_dir_to_json() {filocal i=0+ local find_out="$tmpdir/.find-stdout"+ local find_err="$tmpdir/.find-stderr"+ # Capture find's exit status and stderr instead of discarding them: with -L,+ # a broken symlink or unreadable directory makes find skip that entry AND+ # exit non-zero, which would otherwise silently under-count skills.+ if ! find -L "$dir" -name "SKILL.md" -type f >"$find_out" 2>"$find_err"; then+ echo "Warning: find encountered errors while scanning $dir (broken symlinks or permission issues may cause skills to be missed):" >&2+ cat "$find_err" >&2+ fi+ sort -o "$find_out" "$find_out"+while IFS= read -r file; dolocal name desc mtime u7 u30 dpname=$(extract_field "$file" "name")@@ -118,7 +129,7 @@ scan_dir_to_json() {'{path:$path,name:$name,description:$description,use_7d:$use_7d,use_30d:$use_30d,mtime:$mtime}' \> "$tmpdir/$i.json"i=$((i+1))- done < <(find -L "$dir" -name "SKILL.md" -type f 2>/dev/null | sort)+ done < "$find_out"if [[ $i -eq 0 ]]; thenecho "[]"