rhachet-roles-ehmpathy 1.15.1 → 1.15.3

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.
@@ -0,0 +1,33 @@
1
+ if your refactor produces a change in behavior that was not explicitly asked for, it should always be questioned and reviewed with the asker
2
+
3
+ if your refactor produces a change in behavior that was not explicitly asked for && requires the change of tests that covered the old behavior, this is an even bigger red flag, and should especially be questioned and reviewed with the asker
4
+
5
+ ---
6
+
7
+ for example
8
+
9
+ "ignore other files, only bootup briefs and skills"
10
+
11
+ IF
12
+ - the concept of "other files" is new since the last commit on main (i.e., its a staged or unstaged change, or committed on the branch but not main)
13
+ - the fulfillment of that ask requries you to remove assertions against "bootup readme.md"
14
+
15
+ THEN
16
+ - should you just blindly remove the "bootup readme.md" behavior assertions from the test files to comply?
17
+ - OR
18
+ - should you just blindly assume that the user only meant the new changes?
19
+ - OR
20
+ - should you ask the caller to review the two options, since their requset might cause a change to new behavior
21
+
22
+ ?
23
+
24
+ Ideally, ask the caller explicitly to clarify their request
25
+ - did they mean to revert the new behavior but keep the old?
26
+ - or
27
+ - did they mean to revert the new behavior AND change to old?
28
+
29
+ If you're unable to ask though, always assume they intended to preserve the old behavior when there is new behavior they could be asking about - unless they explicitly mentioned the old behavior with the same terms the test spoke about it with.
30
+
31
+ ---
32
+
33
+ but never blindly degrade prior behavior without explicit confirmation
@@ -0,0 +1,135 @@
1
+ #!/usr/bin/env bash
2
+ ######################################################################
3
+ # .what = safe find-and-replace across git-tracked files only
4
+ #
5
+ # .why = enables bulk text replacement without:
6
+ # - touching files outside the repo
7
+ # - modifying untracked files
8
+ # - accidental command chaining attacks
9
+ #
10
+ # this is a controlled alternative to raw sed, which is
11
+ # denied in permissions due to security risks.
12
+ #
13
+ # usage:
14
+ # sedreplace.sh --old "pattern" --new "replacement" # dry-run
15
+ # sedreplace.sh --old "pattern" --new "replacement" --execute # apply
16
+ # sedreplace.sh --old "pattern" --new "replacement" --glob "*.ts" # filter
17
+ #
18
+ # guarantee:
19
+ # - only operates on git-tracked files (git ls-files)
20
+ # - dry-run by default (shows diff, no changes)
21
+ # - requires --execute to apply changes
22
+ # - fail-fast on errors
23
+ ######################################################################
24
+ set -euo pipefail
25
+
26
+ # parse named arguments
27
+ OLD_PATTERN=""
28
+ NEW_PATTERN=""
29
+ GLOB_FILTER=""
30
+ EXECUTE=false
31
+
32
+ while [[ $# -gt 0 ]]; do
33
+ case $1 in
34
+ --old)
35
+ OLD_PATTERN="$2"
36
+ shift 2
37
+ ;;
38
+ --new)
39
+ NEW_PATTERN="$2"
40
+ shift 2
41
+ ;;
42
+ --glob)
43
+ GLOB_FILTER="$2"
44
+ shift 2
45
+ ;;
46
+ --execute)
47
+ EXECUTE=true
48
+ shift
49
+ ;;
50
+ *)
51
+ echo "unknown argument: $1"
52
+ echo "usage: sedreplace.sh --old 'pattern' --new 'replacement' [--glob '*.ts'] [--execute]"
53
+ exit 1
54
+ ;;
55
+ esac
56
+ done
57
+
58
+ # validate required args
59
+ if [[ -z "$OLD_PATTERN" ]]; then
60
+ echo "error: --old pattern is required"
61
+ exit 1
62
+ fi
63
+
64
+ if [[ -z "$NEW_PATTERN" ]]; then
65
+ echo "error: --new replacement is required"
66
+ exit 1
67
+ fi
68
+
69
+ # ensure we're in a git repo
70
+ if ! git rev-parse --git-dir > /dev/null 2>&1; then
71
+ echo "error: not in a git repository"
72
+ exit 1
73
+ fi
74
+
75
+ # get git-tracked files, optionally filtered by glob
76
+ if [[ -n "$GLOB_FILTER" ]]; then
77
+ FILES=$(git ls-files "$GLOB_FILTER")
78
+ else
79
+ FILES=$(git ls-files)
80
+ fi
81
+
82
+ if [[ -z "$FILES" ]]; then
83
+ echo "no files match the criteria"
84
+ exit 0
85
+ fi
86
+
87
+ # find files containing the pattern
88
+ MATCHING_FILES=$(echo "$FILES" | xargs grep -l "$OLD_PATTERN" 2>/dev/null || true)
89
+
90
+ if [[ -z "$MATCHING_FILES" ]]; then
91
+ echo "no files contain pattern: $OLD_PATTERN"
92
+ exit 0
93
+ fi
94
+
95
+ # count matches
96
+ MATCH_COUNT=$(echo "$MATCHING_FILES" | wc -l)
97
+ echo "found $MATCH_COUNT file(s) containing pattern"
98
+ echo ""
99
+
100
+ if [[ "$EXECUTE" == "false" ]]; then
101
+ # dry-run: show what would change
102
+ echo "=== DRY RUN (use --execute to apply) ==="
103
+ echo ""
104
+
105
+ for file in $MATCHING_FILES; do
106
+ echo "--- $file ---"
107
+ # show the diff that would result
108
+ sed "s|$OLD_PATTERN|$NEW_PATTERN|g" "$file" | diff -u "$file" - || true
109
+ echo ""
110
+ done
111
+
112
+ echo "=== END DRY RUN ==="
113
+ echo ""
114
+ echo "to apply changes, run with --execute flag"
115
+ else
116
+ # execute: apply changes
117
+ echo "=== APPLYING CHANGES ==="
118
+ echo ""
119
+
120
+ for file in $MATCHING_FILES; do
121
+ echo "updating: $file"
122
+ # use sed -i for in-place editing
123
+ # note: macOS sed requires -i '' but linux sed uses -i
124
+ if [[ "$(uname)" == "Darwin" ]]; then
125
+ sed -i '' "s|$OLD_PATTERN|$NEW_PATTERN|g" "$file"
126
+ else
127
+ sed -i "s|$OLD_PATTERN|$NEW_PATTERN|g" "$file"
128
+ fi
129
+ done
130
+
131
+ echo ""
132
+ echo "=== DONE: updated $MATCH_COUNT file(s) ==="
133
+ echo ""
134
+ echo "to undo: git checkout ."
135
+ fi
@@ -30,6 +30,9 @@
30
30
 
31
31
  set -euo pipefail
32
32
 
33
+ # fail loud: print what failed
34
+ trap 'echo "❌ init.bhuild.sh failed at line $LINENO" >&2' ERR
35
+
33
36
  # parse arguments
34
37
  BEHAVIOR_NAME=""
35
38
  TARGET_DIR="$PWD"
@@ -22,6 +22,9 @@
22
22
 
23
23
  set -euo pipefail
24
24
 
25
+ # fail loud: print what failed
26
+ trap 'echo "❌ init.claude.hooks.cleanup.sh failed at line $LINENO" >&2' ERR
27
+
25
28
  SKILLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
26
29
  HOOKS_DIR="$SKILLS_DIR/claude.hooks"
27
30
 
@@ -38,7 +41,7 @@ fi
38
41
  STALE_COMMANDS=$(jq -r '
39
42
  .hooks // {} | to_entries[] |
40
43
  .value[] | .hooks[] | .command // empty
41
- ' "$SETTINGS_FILE" 2>/dev/null | grep -E "claude\.hooks/" | while read -r cmd; do
44
+ ' "$SETTINGS_FILE" | { grep -E "claude\.hooks/" || true; } | while read -r cmd; do
42
45
  # Extract the path - it might be absolute or relative
43
46
  # Look for the claude.hooks/ part and check if the file exists
44
47
  if [[ "$cmd" == /* ]]; then
@@ -27,6 +27,9 @@
27
27
 
28
28
  set -euo pipefail
29
29
 
30
+ # fail loud: print what failed
31
+ trap 'echo "❌ init.claude.hooks.findsert.sh failed at line $LINENO" >&2' ERR
32
+
30
33
  # Defaults
31
34
  HOOK_TYPE=""
32
35
  MATCHER=""
@@ -20,6 +20,9 @@
20
20
 
21
21
  set -euo pipefail
22
22
 
23
+ # fail loud: print what failed
24
+ trap 'echo "❌ init.claude.hooks.sh failed at line $LINENO" >&2' ERR
25
+
23
26
  SKILLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24
27
  FINDSERT="$SKILLS_DIR/init.claude.hooks.findsert.sh"
25
28
  CLEANUP="$SKILLS_DIR/init.claude.hooks.cleanup.sh"
@@ -139,6 +139,9 @@
139
139
  "Bash(git mv:*)",
140
140
  "Bash(git rm:*)",
141
141
 
142
+ // sedreplace - safe bulk find-and-replace on git-tracked files only
143
+ "Bash(bash .agent/repo=ehmpathy/role=mechanic/skills/.skills/claude.tools/sedreplace.sh:*)",
144
+
142
145
  // npm read operations
143
146
  "Bash(npm view:*)",
144
147
  "Bash(npm list:*)",
@@ -26,6 +26,9 @@
26
26
 
27
27
  set -euo pipefail
28
28
 
29
+ # fail loud: print what failed
30
+ trap 'echo "❌ init.claude.permissions.sh failed at line $LINENO" >&2' ERR
31
+
29
32
  PROJECT_ROOT="$PWD"
30
33
  SETTINGS_FILE="$PROJECT_ROOT/.claude/settings.local.json"
31
34
 
@@ -20,6 +20,9 @@
20
20
 
21
21
  set -euo pipefail
22
22
 
23
+ # fail loud: print what failed
24
+ trap 'echo "❌ init.claude.sh failed at line $LINENO" >&2' ERR
25
+
23
26
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
24
27
  GITROOT="$(git rev-parse --show-toplevel)"
25
28
  SETTINGS_FILE="$GITROOT/.claude/settings.local.json"
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.1",
5
+ "version": "1.15.3",
6
6
  "repository": "ehmpathy/rhachet-roles-ehmpathy",
7
7
  "homepage": "https://github.com/ehmpathy/rhachet-roles-ehmpathy",
8
8
  "keywords": [