feat(clone-app): add resolve-re-scripts.sh sibling-plugin locator with tests
This commit is contained in:
parent
bc3066a890
commit
d2d74d02d3
|
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
# Determine this plugin's root. Prefer the env var Claude Code sets; fall back
|
||||||
|
# to deriving from this script's own location (…/clone-app/skills/clone-app/scripts).
|
||||||
|
if [[ -n "${CLAUDE_PLUGIN_ROOT:-}" ]]; then
|
||||||
|
plugin_root="$CLAUDE_PLUGIN_ROOT"
|
||||||
|
else
|
||||||
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
# scripts -> clone-app -> skills -> clone-app(plugin root)
|
||||||
|
plugin_root="$(cd "$script_dir/../../.." && pwd)"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Sibling RE plugin lives next to clone-app under plugins/
|
||||||
|
re_scripts="$(cd "$plugin_root/.." 2>/dev/null && pwd)/android-reverse-engineering/skills/android-reverse-engineering/scripts"
|
||||||
|
|
||||||
|
if [[ ! -d "$re_scripts" ]]; then
|
||||||
|
echo "ERROR: android-reverse-engineering scripts not found at: $re_scripts" >&2
|
||||||
|
echo "Install it: /plugin install android-reverse-engineering@android-reverse-engineering-skill" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$re_scripts"
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
set -uo pipefail
|
||||||
|
SCRIPT="$(dirname "$0")/../skills/clone-app/scripts/resolve-re-scripts.sh"
|
||||||
|
fail=0
|
||||||
|
check() { [[ "$2" == "$3" ]] && echo "PASS: $1" || { echo "FAIL: $1 — expected '$2' got '$3'"; fail=1; }; }
|
||||||
|
|
||||||
|
# In the real repo layout, the RE scripts dir exists as a sibling plugin.
|
||||||
|
out="$(bash "$SCRIPT" 2>/dev/null)"; rc=$?
|
||||||
|
check "exit 0 when RE present" "0" "$rc"
|
||||||
|
check "ends with scripts dir" "android-reverse-engineering/skills/android-reverse-engineering/scripts" \
|
||||||
|
"$(basename "$(dirname "$(dirname "$(dirname "$out")")")")/$(basename "$(dirname "$(dirname "$out")")")/$(basename "$(dirname "$out")")/$(basename "$out")"
|
||||||
|
check "decompile.sh exists under resolved dir" "yes" \
|
||||||
|
"$([[ -f "$out/decompile.sh" ]] && echo yes || echo no)"
|
||||||
|
|
||||||
|
# When CLAUDE_PLUGIN_ROOT points somewhere with no sibling RE plugin → exit 1
|
||||||
|
tmp="$(mktemp -d)"
|
||||||
|
out2="$(CLAUDE_PLUGIN_ROOT="$tmp/clone-app" bash "$SCRIPT" 2>/dev/null)"; rc2=$?
|
||||||
|
check "exit 1 when RE missing" "1" "$rc2"
|
||||||
|
rm -rf "$tmp"
|
||||||
|
|
||||||
|
exit $fail
|
||||||
Loading…
Reference in New Issue