mirror of
https://github.com/alirezarezvani/claude-skills.git
synced 2026-08-28 04:24:58 +00:00
A sixth review pass found sleep.sh and run-sleep.sh still described and partially resolved against upstream's <repo>/plugins/claude-code/ and <repo>/plugins/run-sleep.sh layout, not this vendored copy's actual layout (scripts/ and skillopt_sleep/ as siblings directly under the plugin root, engineering/skillopt-sleep/). The primary co-located and repo-relative resolution branches happen to still succeed regardless (so this was unreachable in normal operation), but the documented SKILLOPT_SLEEP_REPO and CLAUDE_PLUGIN_ROOT escape hatches would have silently failed for anyone actually relying on them -- e.g. after a future re-vendor that missed copying run-sleep.sh into scripts/. Fixed: sleep.sh's SKILLOPT_SLEEP_REPO branch now checks $SKILLOPT_SLEEP_REPO/scripts/run-sleep.sh; run-sleep.sh's CLAUDE_PLUGIN_ROOT branch now checks $CLAUDE_PLUGIN_ROOT/skillopt_sleep (this repo's actual layout) ahead of the upstream two-levels-up check (kept for portability if this script is ever reused in that shape again). Header comments in both files corrected to describe the real layout instead of upstream's. Verified both previously-broken fallback branches resolve correctly when isolated from the co-located script (copied each launcher to a scratch dir and ran it standalone with only the relevant env var set). Added as README deviation #18 (cosmetic/hardening) and reconciled the count across all three documents to 18 (5 cosmetic, 13 safety/ hardening) across six review rounds -- cross-checked with grep. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TX374i2YGrjNV4Yi3AmaKS
37 lines
1.8 KiB
Bash
Executable file
37 lines
1.8 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
# Claude Code plugin runner — thin wrapper over the shared runner so all
|
|
# platform plugins share one engine launcher.
|
|
#
|
|
# In this vendored copy, sleep.sh/run-sleep.sh/install-cron.sh live together
|
|
# in <plugin-root>/scripts/, and the engine package lives at
|
|
# <plugin-root>/skillopt_sleep/ (i.e. engineering/skillopt-sleep/ in
|
|
# alirezarezvani/claude-skills). After marketplace install the plugin is
|
|
# isolated in a cache directory, but that same relative layout is preserved,
|
|
# so the repo-relative path still resolves. We try four locations:
|
|
# 1. Co-located run-sleep.sh (bundled copy — works in marketplace cache)
|
|
# 2. Repo-relative ../../run-sleep.sh (dev checkout; harmless no-op here
|
|
# since (1) always resolves first for this vendored layout)
|
|
# 3. CLAUDE_PLUGIN_ROOT/../run-sleep.sh (plugin env variable; also a no-op
|
|
# here for the same reason)
|
|
# 4. SKILLOPT_SLEEP_REPO/scripts/run-sleep.sh (explicit env, pointed at
|
|
# this plugin's root — the escape hatch if (1)-(3) somehow all miss)
|
|
set -euo pipefail
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
SHARED=""
|
|
if [ -f "$HERE/run-sleep.sh" ]; then
|
|
SHARED="$HERE/run-sleep.sh"
|
|
elif [ -f "$(cd "$HERE/../.." 2>/dev/null && pwd)/run-sleep.sh" ]; then
|
|
SHARED="$(cd "$HERE/../.." && pwd)/run-sleep.sh"
|
|
elif [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "$(cd "$CLAUDE_PLUGIN_ROOT/.." 2>/dev/null && pwd)/run-sleep.sh" ]; then
|
|
SHARED="$(cd "$CLAUDE_PLUGIN_ROOT/.." && pwd)/run-sleep.sh"
|
|
elif [ -n "${SKILLOPT_SLEEP_REPO:-}" ] && [ -f "$SKILLOPT_SLEEP_REPO/scripts/run-sleep.sh" ]; then
|
|
SHARED="$SKILLOPT_SLEEP_REPO/scripts/run-sleep.sh"
|
|
fi
|
|
|
|
if [ -z "$SHARED" ]; then
|
|
echo "[sleep] ERROR: cannot locate run-sleep.sh." >&2
|
|
echo "[sleep] Set SKILLOPT_SLEEP_REPO to the SkillOpt repo root, or pip install skillopt." >&2
|
|
exit 1
|
|
fi
|
|
exec bash "$SHARED" "$@"
|