From 1acb5c6fffbe4553daa7b8383e0f1673abee0024 Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Sun, 15 Feb 2026 00:31:50 -0800 Subject: [PATCH] fix: remove eager import from __init__.py and add sync.sh The `from . import bird_x` in __init__.py caused ImportError for all other module imports (youtube_yt, render, etc.) when bird_x had issues, crashing the entire script in Codex. Making it a bare package marker lets Python resolve `from lib import X` normally. Added scripts/sync.sh to deploy to all three skill locations (~/.claude, ~/.agents, ~/.codex) with import verification. Co-Authored-By: Claude Opus 4.6 --- scripts/lib/__init__.py | 1 - scripts/sync.sh | 53 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100755 scripts/sync.sh diff --git a/scripts/lib/__init__.py b/scripts/lib/__init__.py index a76eebb..2297618 100644 --- a/scripts/lib/__init__.py +++ b/scripts/lib/__init__.py @@ -1,2 +1 @@ # last30days library modules -from . import bird_x diff --git a/scripts/sync.sh b/scripts/sync.sh new file mode 100755 index 0000000..0c4014b --- /dev/null +++ b/scripts/sync.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash +# sync.sh - Deploy last30days skill to all host locations +# Usage: bash scripts/sync.sh (run from repo root) +set -euo pipefail + +SRC="$(cd "$(dirname "$0")/.." && pwd)" +echo "Source: $SRC" + +TARGETS=( + "$HOME/.claude/skills/last30days" + "$HOME/.agents/skills/last30days" + "$HOME/.codex/skills/last30days" +) + +for t in "${TARGETS[@]}"; do + echo "" + echo "--- Syncing to $t ---" + mkdir -p "$t/scripts/lib" + + # SKILL.md + cp "$SRC/SKILL.md" "$t/" + + # Main script + cp "$SRC/scripts/last30days.py" "$t/scripts/" + + # All lib modules + cp "$SRC/scripts/lib/"*.py "$t/scripts/lib/" + + # Vendor directory (bird-search CLI) + if [ -d "$SRC/scripts/lib/vendor" ]; then + cp -r "$SRC/scripts/lib/vendor" "$t/scripts/lib/" + fi + + # Fixtures + if [ -d "$SRC/fixtures" ]; then + mkdir -p "$t/fixtures" + cp -r "$SRC/fixtures/"* "$t/fixtures/" 2>/dev/null || true + fi + + # Count and report + mod_count=$(ls "$t/scripts/lib/"*.py 2>/dev/null | wc -l | tr -d ' ') + echo " Copied $mod_count modules" + + # Verify imports + if (cd "$t/scripts" && python3 -c "from lib import youtube_yt, bird_x, render, ui; print(' Import check: OK')" 2>&1); then + true + else + echo " Import check FAILED" + fi +done + +echo "" +echo "Sync complete."