CtrlK
BlogDocsLog inGet started
Tessl Logo
PluginPublic

jbaruch/coding-policy

General-purpose coding policy for Baruch's AI agents

74

Quality

93%

Does it follow best practices?

Run evals on this skill

Adds up to 20 points to the overall score

View guide
SecuritybySnyk

Low

Low-risk findings worth noting

Overview
Quality
Evals
Security
Files

native-hook.shskills/release/

#!/usr/bin/env bash
# Run a generic policy hook from a Tessl skill or an ACR native hook copy.
# argv: session-start|stop-handoff. stdin/stdout and status belong to the owner.
# Exit 2 on invalid event, 1 with a stderr diagnostic on installation failure.
set -euo pipefail

main() {
  local event="${1:-}" owner src here skill hooks host
  case "$event" in
    session-start) owner=session-start.sh ;;
    stop-handoff) owner=stop-handoff-hygiene.sh ;;
    *) echo 'usage: native-hook.sh session-start|stop-handoff' >&2; return 2 ;;
  esac
  case "${BASH_SOURCE[0]}" in
    */*) src="${BASH_SOURCE[0]%/*}" ;;
    *) src=. ;;
  esac
  if ! here="$(CDPATH='' cd -- "$src" && pwd -P && printf x)"; then
    echo 'coding-policy hook: restore read/search access to the installed skill' >&2
    return 1
  fi
  here="${here%x}"
  here="${here%$'\n'}"
  case "${here##*/}" in
    release|acr__jbaruch__coding-policy__release) skill="$here" ;;
    *)
      # ACR copies hook assets unchanged; select the sibling native skill.
      hooks="${here%/*}"
      host="${hooks%/*}"
      if [[ "${hooks##*/}" != hooks ]]; then
        echo 'coding-policy hook: restore the managed hook under its native host' >&2
        return 1
      fi
      case "${host##*/}" in
        .codex|.claude|.cursor) skill="$host/skills/acr__jbaruch__coding-policy__release" ;;
        *) echo 'coding-policy hook: restore the supported native host layout' >&2; return 1 ;;
      esac ;;
  esac
  if [[ ! -f "$skill/hooks/$owner" || ! -r "$skill/hooks/$owner" ]]; then
    echo 'coding-policy hook: repair the complete release skill before retrying' >&2
    return 1
  fi
  bash "$skill/hooks/$owner"
}

if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then
  main "$@"
fi

README.md

tile.json