Skip to content

majiayu000/spellbook / skills/xray

Investigate how a concept, code path, application, network flow, system, incident, document, or local artifact actually works, then deliver a two-depth visual HTML explainer with a dead-simple big-picture first layer and source-backed technical depth behind it. Use when the user invokes $xray, asks how something works under the hood, wants a module or app behavior traced across boundaries, requests web, code, network, or safe static artifact research before explanation, or asks for an evidence-backed explainer. Do not use for answer-only definitions, general web design, full codebase audits, or invasive binary reverse engineering without explicit authorization.

scripts/render-check.sh

View on GitHub
#!/bin/sh
# Render an X-Ray explainer at desktop and mobile widths with Playwright.
# Usage: scripts/render-check.sh <page.html> [new-output-directory]
set -eu

if [ $# -lt 1 ] || [ $# -gt 2 ]; then
  echo "usage: render-check.sh <page.html> [new-output-directory]" >&2
  exit 64
fi

PAGE=$(cd "$(dirname -- "$1")" && pwd)/$(basename -- "$1")
if [ ! -f "$PAGE" ]; then
  echo "not a file: $PAGE" >&2
  exit 66
fi

if [ $# -eq 2 ] && { [ -e "$2" ] || [ -L "$2" ]; }; then
  echo "output directory already exists: $2" >&2
  exit 73
fi

PLAYWRIGHT_MODE=
if command -v playwright >/dev/null 2>&1 && playwright --version >/dev/null 2>&1; then
  PLAYWRIGHT_MODE=direct
elif command -v npm >/dev/null 2>&1 && npm exec --offline --no -- playwright --version >/dev/null 2>&1; then
  PLAYWRIGHT_MODE=npm
else
  echo "Playwright CLI is unavailable; install Playwright before rendering" >&2
  exit 69
fi

run_playwright() {
  if [ "$PLAYWRIGHT_MODE" = direct ]; then
    playwright "$@"
  else
    npm exec --offline --no -- playwright "$@"
  fi
}

CREATED_OUT=
cleanup_failed_render() {
  status=$?
  trap - 0
  if [ "$status" -ne 0 ] && [ -n "$CREATED_OUT" ] && [ -d "$CREATED_OUT" ]; then
    if ! rm -r -- "$CREATED_OUT"; then
      echo "failed to remove incomplete output directory: $CREATED_OUT" >&2
    fi
  fi
  exit "$status"
}
trap cleanup_failed_render 0

if [ $# -eq 2 ]; then
  OUT=$2
  mkdir "$OUT"
else
  OUT=$(mktemp -d "${TMPDIR:-/tmp}/xray-render.XXXXXX")
fi
CREATED_OUT=$OUT
OUT=$(cd "$OUT" && pwd)
CREATED_OUT=$OUT

PAGE_URL=$(python3 - "$PAGE" <<'PY'
from pathlib import Path
import sys

print(Path(sys.argv[1]).as_uri())
PY
)

run_playwright screenshot --browser chromium --full-page \
  --viewport-size "1280, 720" "$PAGE_URL" "$OUT/render-wide.png"
run_playwright screenshot --browser chromium --full-page \
  --viewport-size "390, 844" "$PAGE_URL" "$OUT/render-narrow.png"

CREATED_OUT=
echo "wrote $OUT"
rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall