skills/bin/deploy-skill.sh
dan 5fea49b7c0 feat(tufte-press): evolve skill to complete workflow with JSON generation and build automation
- Transform tufte-press from reference guide to conversation-aware generator
- Add JSON generation from conversation context following strict schema
- Create build automation scripts with Nix environment handling
- Integrate CUPS printing with duplex support
- Add comprehensive workflow documentation

Scripts added:
- skills/tufte-press/scripts/generate-and-build.sh (242 lines)
- skills/tufte-press/scripts/build-card.sh (23 lines)

Documentation:
- Updated SKILL.md with complete workflow instructions (370 lines)
- Updated README.md with usage examples (340 lines)
- Created SKILL-DEVELOPMENT-STRATEGY-tufte-press.md (450 lines)
- Added worklog: 2025-11-10-tufte-press-skill-evolution.org

Features:
- Agent generates valid JSON from conversation
- Schema validation before build (catches errors early)
- Automatic Nix shell entry for dependencies
- PDF build via tufte-press toolchain
- Optional print with duplex support
- Self-contained margin notes enforced
- Complete end-to-end testing

Workflow: Conversation → JSON → Validate → Build → Print

Related: niri-window-capture, screenshot-latest, worklog skills
2025-11-10 15:03:44 -08:00

141 lines
3.3 KiB
Bash
Executable file

#!/usr/bin/env bash
# Deploy a skill from this repo to dotfiles for system-wide availability
set -euo pipefail
SKILLS_REPO="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
DOTFILES_REPO="$HOME/proj/dotfiles"
SKILL_NAME="${1:-}"
usage() {
cat <<EOF
Usage: $0 <skill-name>
Deploy a skill from ~/proj/skills to ~/proj/dotfiles for system-wide deployment.
Arguments:
skill-name Name of skill directory in skills/
Examples:
$0 screenshot-latest
$0 niri-window-capture
This script:
1. Copies skill to dotfiles/claude/skills/
2. Shows you the Nix config to add
3. Reminds you to rebuild
You must manually:
- Edit home/claude.nix
- Edit home/opencode.nix
- Run: sudo nixos-rebuild switch --flake .#delpad
- Restart AI agents
Available skills:
EOF
ls -1 "$SKILLS_REPO/skills" | grep -v template | sed 's/^/ /'
exit 1
}
if [[ -z "$SKILL_NAME" ]]; then
usage
fi
SKILL_SOURCE="$SKILLS_REPO/skills/$SKILL_NAME"
SKILL_DEST="$DOTFILES_REPO/claude/skills/$SKILL_NAME"
# Validate skill exists
if [[ ! -d "$SKILL_SOURCE" ]]; then
echo "Error: Skill not found: $SKILL_SOURCE" >&2
echo "" >&2
usage
fi
# Validate dotfiles repo exists
if [[ ! -d "$DOTFILES_REPO" ]]; then
echo "Error: Dotfiles repo not found: $DOTFILES_REPO" >&2
exit 1
fi
# Check if skill has SKILL.md
if [[ ! -f "$SKILL_SOURCE/SKILL.md" ]]; then
echo "Error: $SKILL_NAME missing SKILL.md" >&2
exit 1
fi
# Check if already deployed
if [[ -d "$SKILL_DEST" ]]; then
echo "⚠️ Skill already deployed: $SKILL_DEST"
read -p "Overwrite? [y/N] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Cancelled"
exit 1
fi
rm -rf "$SKILL_DEST"
fi
# Check for security docs
SECURITY_WARNING=""
if [[ -f "$SKILL_SOURCE/SECURITY.md" ]]; then
SECURITY_WARNING="
⚠️ ⚠️ ⚠️ SECURITY WARNING ⚠️ ⚠️ ⚠️
This skill has security documentation.
READ BEFORE DEPLOYING: $SKILL_DEST/SECURITY.md
Security-sensitive skills should only be deployed after:
1. Reviewing security documentation
2. Understanding risks and mitigations
3. Configuring protection mechanisms
"
fi
echo "Deploying skill: $SKILL_NAME"
echo ""
echo "Source: $SKILL_SOURCE"
echo "Dest: $SKILL_DEST"
echo ""
# Copy skill
mkdir -p "$(dirname "$SKILL_DEST")"
cp -r "$SKILL_SOURCE" "$SKILL_DEST"
echo "✓ Skill copied to dotfiles"
echo ""
if [[ -n "$SECURITY_WARNING" ]]; then
echo "$SECURITY_WARNING"
fi
echo "Next steps:"
echo ""
echo "1. Add to Claude Code (edit $DOTFILES_REPO/home/claude.nix):"
echo ""
echo " home.file.\".claude/skills/$SKILL_NAME\" = {"
echo " source = ../claude/skills/$SKILL_NAME;"
echo " recursive = true;"
echo " };"
echo ""
echo "2. Add to OpenCode (edit $DOTFILES_REPO/home/opencode.nix):"
echo ""
echo " home.file.\".config/opencode/skills/$SKILL_NAME\" = {"
echo " source = ../claude/skills/$SKILL_NAME;"
echo " recursive = true;"
echo " };"
echo ""
echo "3. Rebuild system:"
echo ""
echo " cd $DOTFILES_REPO"
echo " sudo nixos-rebuild switch --flake .#delpad"
echo ""
echo "4. Restart AI agents (OpenCode and Claude Code)"
echo ""
if [[ -n "$SECURITY_WARNING" ]]; then
echo "⚠️ REMEMBER: Review SECURITY.md before rebuilding!"
echo ""
fi
echo "Skill deployment prepared. Complete steps 1-4 to activate."