Files
apress/deploy/uno-q/push-skill.sh
T
Omar SobhandClaude Opus 4.8 62c435c648 feat(uno-q): bundle the granular skill set alongside arduino-uno-q on every node
Vendors the fork's 11 granular UNO Q skills (bridge, flashing, led-matrix,
uno-q-hardware, sketch-patterns, modulino, linux-led, audio, vision, wireless,
arduino-app-lab) next to the comprehensive arduino-uno-q skill, and installs the
whole set into every agent's workspace on each board.

Why both: the comprehensive skill is the rich cloud reference (read_skill →
references); the granular skills are keyword-triggered and match the fork's eager
skill-inliner rules, so the on-board Qwen auto-inlines them (no read_skill
round-trip). flashing + led-matrix carry the exact uno_q_flash + frame-API /
ArduinoGraphics-not-installed detail that makes flashing reliable.

- push-skill.sh generalized: a single skill dir (has SKILL.md) OR a parent dir
  installs every skill under it; provision-fleet now ships all of skills/.
- Verified on board 65301572: cloud/Sonnet-5 lists all 12 skills.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-16 09:32:11 -07:00

68 lines
2.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Install Anthropic-style skills (each a directory with SKILL.md, optionally a
# references/ subfolder) into EVERY agent's workspace on a board.
#
# Why per-agent workspace and not a shared bundle: ZeroClaw's `read_skill`
# returns only SKILL.md; a skill's `references/*.md` are read via the general
# `file_read` tool, which is workspace-sandboxed. So references are only
# reachable when the skill lives under an agent's own workspace
# (`~/.zeroclaw/agents/<alias>/workspace/skills/<name>/`). A shared/skills bundle
# surfaces the skill but its references get blocked by the file_read sandbox.
#
# The skill NAME is the directory name (not the frontmatter `name`).
#
# ./push-skill.sh <adb-serial> [path]
# path with a SKILL.md → install that one skill
# path that CONTAINS skill dirs → install every skill under it
# (default: this script's skills/ directory — all bundled skills)
set -uo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
SERIAL="${1:?usage: push-skill.sh <adb-serial> [skill-dir | skills-parent-dir]}"
SRC="${2:-$HERE/skills}"
ZC="/home/arduino/.zeroclaw"
# Resolve the list of skill dirs to install: either SRC itself (single skill) or
# each immediate child of SRC that has a SKILL.md.
skills=()
if [ -r "$SRC/SKILL.md" ]; then
skills=("$SRC")
else
for d in "$SRC"/*/; do
[ -r "${d}SKILL.md" ] && skills+=("${d%/}")
done
fi
[ "${#skills[@]}" -gt 0 ] || { echo "no skills found under $SRC" >&2; exit 1; }
# Discover agent aliases from the board's config-created workspaces; fall back to
# the standard set if the listing is empty.
agents="$(adb -s "$SERIAL" shell "ls $ZC/agents 2>/dev/null" 2>/dev/null | tr -d '\r' | tr '\n' ' ')"
[ -n "${agents// /}" ] || agents="default cloud local"
install_one() { # skill_dir alias -> 0 ok / 1 fail
local sdir="$1" alias="$2" name dest
name="$(basename "$sdir")"
dest="$ZC/agents/$alias/workspace/skills/$name"
adb -s "$SERIAL" shell "mkdir -p '$dest'" >/dev/null 2>&1 || return 1
adb -s "$SERIAL" push "$sdir/SKILL.md" "$dest/" >/dev/null 2>&1 || return 1
# ship a references/ subfolder if the skill has one
if [ -d "$sdir/references" ]; then
adb -s "$SERIAL" shell "mkdir -p '$dest/references'" >/dev/null 2>&1
adb -s "$SERIAL" push "$sdir/references/." "$dest/references/" >/dev/null 2>&1 || return 1
fi
return 0
}
total_ok=0
for a in $agents; do
a="$(printf '%s' "$a" | tr -d ' \r')"; [ -z "$a" ] && continue
n=0
for sdir in "${skills[@]}"; do
install_one "$sdir" "$a" && n=$((n + 1))
done
echo " ok — $a ($n/${#skills[@]} skills)"
total_ok=$((total_ok + n))
done
echo "installed ${#skills[@]} skill(s) across the board's agent workspaces ($total_ok pushes) on $SERIAL"
[ "$total_ok" -gt 0 ]