rhachet-roles-ehmpathy 1.15.11 → 1.15.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,13 +8,15 @@
8
8
  #
9
9
  # .how = reads settings.local.json, finds hooks referencing files
10
10
  # in claude.hooks/, checks if those files exist, and removes
11
- # any hooks whose scripts no longer exist.
11
+ # any hooks whose scripts no longer exist or match deprecated
12
+ # command patterns.
12
13
  #
13
14
  # usage:
14
15
  # init.claude.hooks.cleanup.sh
15
16
  #
16
17
  # guarantee:
17
- # ✔ only removes hooks referencing missing claude.hooks/ files
18
+ # ✔ removes hooks referencing missing claude.hooks/ files
19
+ # ✔ removes hooks matching deprecated command patterns
18
20
  # ✔ preserves all other hooks and settings
19
21
  # ✔ idempotent: safe to rerun
20
22
  # ✔ no-op if no stale hooks found
@@ -31,33 +33,62 @@ HOOKS_DIR="$SKILLS_DIR/claude.hooks"
31
33
  PROJECT_ROOT="$PWD"
32
34
  SETTINGS_FILE="$PROJECT_ROOT/.claude/settings.local.json"
33
35
 
36
+ # deprecated command patterns to remove (regex)
37
+ DEPRECATED_PATTERNS=(
38
+ "^npx rhachet roles boot"
39
+ )
40
+
34
41
  # Exit if no settings file
35
42
  if [[ ! -f "$SETTINGS_FILE" ]]; then
36
43
  exit 0
37
44
  fi
38
45
 
39
- # Extract all hook commands that reference claude.hooks/
40
- # and check which ones point to missing files
41
- STALE_COMMANDS=$(jq -r '
46
+ # collect stale commands
47
+ STALE_COMMANDS=""
48
+
49
+ # find hooks referencing missing claude.hooks/ files
50
+ MISSING_FILES=$(jq -r '
42
51
  .hooks // {} | to_entries[] |
43
52
  .value[] | .hooks[] | .command // empty
44
53
  ' "$SETTINGS_FILE" | { grep -E "claude\.hooks/" || true; } | while read -r cmd; do
45
- # Extract the path - it might be absolute or relative
46
- # Look for the claude.hooks/ part and check if the file exists
47
54
  if [[ "$cmd" == /* ]]; then
48
- # Absolute path
55
+ # absolute path
49
56
  if [[ ! -f "$cmd" ]]; then
50
57
  echo "$cmd"
51
58
  fi
52
59
  else
53
- # Relative path or command - check if it contains claude.hooks/
54
- # and if the file exists relative to PWD
60
+ # relative path
55
61
  if [[ ! -f "$PROJECT_ROOT/$cmd" ]]; then
56
62
  echo "$cmd"
57
63
  fi
58
64
  fi
59
65
  done)
60
66
 
67
+ if [[ -n "$MISSING_FILES" ]]; then
68
+ STALE_COMMANDS="$MISSING_FILES"
69
+ fi
70
+
71
+ # find hooks matching deprecated patterns
72
+ DEPRECATED_COMMANDS=$(jq -r '
73
+ .hooks // {} | to_entries[] |
74
+ .value[] | .hooks[] | .command // empty
75
+ ' "$SETTINGS_FILE" | while read -r cmd; do
76
+ for pattern in "${DEPRECATED_PATTERNS[@]}"; do
77
+ if [[ "$cmd" =~ $pattern ]]; then
78
+ echo "$cmd"
79
+ break
80
+ fi
81
+ done
82
+ done)
83
+
84
+ if [[ -n "$DEPRECATED_COMMANDS" ]]; then
85
+ if [[ -n "$STALE_COMMANDS" ]]; then
86
+ STALE_COMMANDS="$STALE_COMMANDS"$'\n'"$DEPRECATED_COMMANDS"
87
+ else
88
+ STALE_COMMANDS="$DEPRECATED_COMMANDS"
89
+ fi
90
+ fi
91
+
61
92
  # Exit if no stale commands found
62
93
  if [[ -z "$STALE_COMMANDS" ]]; then
63
94
  echo "👌 no stale hooks found"
@@ -37,6 +37,7 @@ HOOK_COMMAND=""
37
37
  HOOK_NAME=""
38
38
  TIMEOUT=5
39
39
  POSITION="append"
40
+ AUTHOR="repo=ehmpathy/role=mechanic"
40
41
 
41
42
  # Parse arguments
42
43
  while [[ $# -gt 0 ]]; do
@@ -65,6 +66,10 @@ while [[ $# -gt 0 ]]; do
65
66
  POSITION="$2"
66
67
  shift 2
67
68
  ;;
69
+ --author)
70
+ AUTHOR="$2"
71
+ shift 2
72
+ ;;
68
73
  *)
69
74
  echo "Unknown argument: $1" >&2
70
75
  exit 1
@@ -74,7 +79,7 @@ done
74
79
 
75
80
  # Validate required arguments
76
81
  if [[ -z "$HOOK_TYPE" || -z "$MATCHER" || -z "$HOOK_COMMAND" || -z "$HOOK_NAME" ]]; then
77
- echo "Usage: $0 --hook-type TYPE --matcher MATCHER --command CMD --name NAME [--timeout SECS] [--position append|prepend]" >&2
82
+ echo "Usage: $0 --hook-type TYPE --matcher MATCHER --command CMD --name NAME [--timeout SECS] [--position append|prepend] [--author AUTHOR]" >&2
78
83
  exit 1
79
84
  fi
80
85
 
@@ -95,6 +100,7 @@ HOOK_CONFIG=$(jq -n \
95
100
  --arg matcher "$MATCHER" \
96
101
  --arg command "$HOOK_COMMAND" \
97
102
  --argjson timeout "$TIMEOUT" \
103
+ --arg author "$AUTHOR" \
98
104
  '{
99
105
  hooks: {
100
106
  ($hookType): [
@@ -104,7 +110,8 @@ HOOK_CONFIG=$(jq -n \
104
110
  {
105
111
  type: "command",
106
112
  command: $command,
107
- timeout: $timeout
113
+ timeout: $timeout,
114
+ author: $author
108
115
  }
109
116
  ]
110
117
  }
@@ -33,28 +33,28 @@ HOOKS_DIR="$SKILLS_DIR/claude.hooks"
33
33
  # First, cleanup any stale hooks (referencing removed scripts)
34
34
  "$CLEANUP"
35
35
 
36
- # SessionStart hooks (order matters - boot first, then notify permissions)
36
+ # SessionStart hooks (order matters - notify permissions first, then boot roles)
37
37
 
38
38
  "$FINDSERT" \
39
39
  --hook-type SessionStart \
40
40
  --matcher "*" \
41
- --command "./node_modules/.bin/rhachet roles boot --repo .this --role any --if-present" \
42
- --name "sessionstart.boot" \
43
- --timeout 60
41
+ --command "$HOOKS_DIR/sessionstart.notify-permissions.sh" \
42
+ --name "sessionstart.notify-permissions" \
43
+ --timeout 5
44
44
 
45
45
  "$FINDSERT" \
46
46
  --hook-type SessionStart \
47
47
  --matcher "*" \
48
- --command "./node_modules/.bin/rhachet roles boot --repo ehmpathy --role mechanic" \
49
- --name "sessionstart.boot" \
48
+ --command "./node_modules/.bin/rhachet roles boot --repo .this --role any --if-present" \
49
+ --name "sessionstart.boot.this" \
50
50
  --timeout 60
51
51
 
52
52
  "$FINDSERT" \
53
53
  --hook-type SessionStart \
54
54
  --matcher "*" \
55
- --command "$HOOKS_DIR/sessionstart.notify-permissions.sh" \
56
- --name "sessionstart.notify-permissions" \
57
- --timeout 5
55
+ --command "./node_modules/.bin/rhachet roles boot --repo ehmpathy --role mechanic" \
56
+ --name "sessionstart.boot.mechanic" \
57
+ --timeout 60
58
58
 
59
59
  # PreToolUse hooks (order matters - forbid-stderr-redirect first via prepend)
60
60
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "rhachet-roles-ehmpathy",
3
3
  "author": "ehmpathy",
4
4
  "description": "empathetic software construction roles and skills, via rhachet",
5
- "version": "1.15.11",
5
+ "version": "1.15.12",
6
6
  "repository": "ehmpathy/rhachet-roles-ehmpathy",
7
7
  "homepage": "https://github.com/ehmpathy/rhachet-roles-ehmpathy",
8
8
  "keywords": [