master
Drew Owens Publish 1.0.0 c95d26a 2mo ago
#!/bin/bash
# install hook for adom/wiki-light-mode: expose the CLI, deploy the skill,
# and best-effort pre-warm the node dependency (runtime self-heals if this
# step fails, so nothing here is fatal except a missing node).
set -e
HERE="$(cd "$(dirname "$0")" && pwd)"

if ! command -v node >/dev/null 2>&1; then
  echo "ERROR: node is required (18+) and was not found on PATH"
  exit 1
fi
NODE_MAJOR="$(node -e 'console.log(process.versions.node.split(".")[0])')"
if [ "$NODE_MAJOR" -lt 18 ]; then
  echo "ERROR: node >= 18 required, found $(node --version)"
  exit 1
fi

# CLI onto PATH (symlink back into the module dir so pkg updates propagate)
mkdir -p "$HOME/.local/bin"
chmod +x "$HERE/bin/wiki-light-shot.mjs"
ln -sfn "$HERE/bin/wiki-light-shot.mjs" "$HOME/.local/bin/wiki-light-shot"
echo "OK: wiki-light-shot on PATH (~/.local/bin/wiki-light-shot)"

# Skill for the agent (symlinked so pkg updates propagate without reinstall)
mkdir -p "$HOME/.claude/skills/wiki-light-mode"
ln -sfn "$HERE/SKILL.md" "$HOME/.claude/skills/wiki-light-mode/SKILL.md"
echo "OK: skill installed at ~/.claude/skills/wiki-light-mode"

# Pre-warm puppeteer-core so the first run is fast. --no-save is load-bearing:
# this package.json's "dependencies" holds WIKI refs, npm must not write to it.
if command -v npm >/dev/null 2>&1; then
  (cd "$HERE" && npm install puppeteer-core@^22 --no-save --no-package-lock --no-audit --no-fund --silent) \
    && echo "OK: puppeteer-core ready" \
    || echo "NOTE: puppeteer-core pre-install failed; the CLI installs it on first run"
else
  echo "NOTE: npm not found; the CLI installs puppeteer-core on first run"
fi

echo "OK: wiki-light-mode installed. Try: wiki-light-shot adom/core"