diff --git a/scripts/check-naming-and-style.sh b/scripts/check-naming-and-style.sh index 7cadfba..bf0cf42 100755 --- a/scripts/check-naming-and-style.sh +++ b/scripts/check-naming-and-style.sh @@ -106,6 +106,23 @@ if [ -n "$SNAKE_FE" ]; then VIOLATIONS=$((VIOLATIONS + 1)) fi +# ADR-013 Phase 4: a plugin frontend (plugins//frontend/) may import core +# via the @/ alias or its own tree (./, ../ within the plugin), never another +# plugin's tree and never an escaping ../../ into src. Keeps plugin frontends +# self-contained so a per-site build can drop one cleanly. +echo "==> Checking for cross-plugin / escaping imports in plugin frontends..." +if [ -d plugins ]; then + PLUGIN_FE_IMPORTS=$(grep -rPn "(import|from)\s+['\"]([^'\"]*\.\./\.\./|[^'\"]*/plugins/)" \ + --include='*.vue' --include='*.js' plugins/*/frontend/ 2>/dev/null || true) + if [ -n "$PLUGIN_FE_IMPORTS" ]; then + echo "FAIL: plugin frontend imports must use the @/ alias for core, not" + echo " an escaping ../../ or another plugin's path:" + echo "$PLUGIN_FE_IMPORTS" + echo + VIOLATIONS=$((VIOLATIONS + 1)) + fi +fi + if [ "$VIOLATIONS" -gt 0 ]; then echo "==================================================" echo "$VIOLATIONS naming/style violation(s) found."