chore(template): clean-slate template snapshot from bb4a0c7
Curated, product-agnostic snapshot of the post-story-04 tree: demo content deleted, auth-only reference feature, web-next shell, all gates green. Product-specific docs, ADRs 027-029, PRDs/epics/archive, editor library traces, and product naming are curated out; generic template repairs (coverage provider devDeps, root test:coverage script, live lint fixes, root-only release-please) are kept. See TEMPLATE.md for provenance, curation list, and usage. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016j8z4VHjedXDTjEDNg7qHK
This commit is contained in:
47
.claude/hooks/library-policy-nudge.sh
Executable file
47
.claude/hooks/library-policy-nudge.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env bash
|
||||
# Advisory — nudges the agent to run /evaluate-library before adding runtime
|
||||
# dependencies. Non-blocking (exit 0). Stdout is injected as system-reminder
|
||||
# context by the harness.
|
||||
#
|
||||
# Dispatches on payload shape:
|
||||
# .tool_input.command → PreToolUse / Bash (pnpm add / pnpm i <pkg>)
|
||||
# .tool_input.file_path → PostToolUse / Edit|Write (**/package.json edits)
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
input=$(cat)
|
||||
|
||||
# --- PreToolUse / Bash path ---
|
||||
cmd=$(printf '%s' "$input" | jq -r '.tool_input.command // ""')
|
||||
if [[ -n "$cmd" ]]; then
|
||||
# Match: pnpm add <...> or pnpm i <pkg> — must have a space after keyword
|
||||
if [[ "$cmd" =~ (^|[[:space:]])pnpm[[:space:]]+(add[[:space:]]|i[[:space:]]) ]]; then
|
||||
# Skip dev-dependency installs — no policy evaluation needed for devDeps
|
||||
if [[ ! "$cmd" =~ (^|[[:space:]])(-D|--save-dev)([[:space:]]|$) ]]; then
|
||||
cat <<'EOF'
|
||||
[library-policy-nudge] Runtime dependency detected — evaluate before adding.
|
||||
|
||||
Run the evaluate-library skill first:
|
||||
/evaluate-library <name> --tier <feature|core|app> --target <package-path>
|
||||
|
||||
This ensures the dependency is logged in docs/decisions/ before the pre-commit gate fires.
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# --- PostToolUse / Edit|Write path ---
|
||||
file_path=$(printf '%s' "$input" | jq -r '.tool_input.file_path // ""')
|
||||
if [[ "$file_path" == */package.json ]]; then
|
||||
cat <<'EOF'
|
||||
[library-policy-nudge] package.json edited — verify any new runtime dependencies are evaluated.
|
||||
|
||||
If you added a runtime dependency, run the evaluate-library skill:
|
||||
/evaluate-library <name> --tier <feature|core|app> --target <package-path>
|
||||
|
||||
This ensures the dependency is logged in docs/decisions/ before the pre-commit gate fires.
|
||||
EOF
|
||||
fi
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user