rhachet-roles-ehmpathy 1.9.1 → 1.11.0

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.
Files changed (20) hide show
  1. package/dist/logic/roles/coach/.briefs/claude.context-caching.md +76 -0
  2. package/dist/logic/roles/mechanic/.briefs/lessons/code.prod.typescript.types/bivariance_vs_contravariance.[lesson].md +95 -0
  3. package/dist/logic/roles/mechanic/.briefs/patterns/code.prod.errors.failfast/bad-practices/forbid.failhide.md +19 -0
  4. package/dist/logic/roles/mechanic/.briefs/patterns/code.prod.errors.failfast/best-practice/prefer.HelpfulError.wrap.md +54 -0
  5. package/dist/logic/roles/mechanic/.briefs/patterns/code.prod.narrative/bad-practices/forbid.else.md +54 -0
  6. package/dist/logic/roles/mechanic/.briefs/patterns/code.prod.narrative/best-practice/early-returns.named-checks.[demo].md +181 -0
  7. package/dist/logic/roles/mechanic/.briefs/patterns/code.prod.repo.structure/bad-practices/forbid.index.ts.md +3 -0
  8. package/dist/logic/roles/mechanic/.briefs/patterns/code.test.howto/best-practice/howto.diagnose.[lesson].md +14 -0
  9. package/dist/logic/roles/mechanic/.briefs/patterns/lang.terms/best-practice/require.order.noun_adj.md +39 -0
  10. package/dist/logic/roles/mechanic/.skills/git.worktree.common.sh +58 -0
  11. package/dist/logic/roles/mechanic/.skills/git.worktree.del.sh +51 -0
  12. package/dist/logic/roles/mechanic/.skills/git.worktree.get.sh +51 -0
  13. package/dist/logic/roles/mechanic/.skills/git.worktree.set.sh +108 -0
  14. package/dist/logic/roles/mechanic/.skills/git.worktree.sh +46 -0
  15. package/dist/logic/roles/mechanic/.skills/git.worktree.test.sh +229 -0
  16. package/dist/logic/roles/mechanic/.skills/init.bhuild.sh +260 -0
  17. package/dist/logic/roles/mechanic/.skills/init.claude.permissions.sh +109 -0
  18. package/dist/logic/roles/mechanic/.skills/init.claude.sh +35 -0
  19. package/dist/logic/roles/mechanic/.skills/run.test.sh +8 -2
  20. package/package.json +2 -2
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env bash
2
+ ######################################################################
3
+ # .what = bind mechanic permissions to Claude settings
4
+ #
5
+ # .why = the mechanic role needs conservative permissions to operate
6
+ # safely while still being productive.
7
+ #
8
+ # this script manages permissions in .claude/settings.local.json:
9
+ # • replaces existing allows entirely (conservative)
10
+ # • extends denies by appending new entries (conservative)
11
+ # • extends asks by appending new entries (conservative)
12
+ # • idempotent: safe to rerun
13
+ #
14
+ # .how = uses jq to merge the permissions configuration
15
+ # into the existing settings structure, creating it if absent.
16
+ #
17
+ # guarantee:
18
+ # ✔ creates .claude/settings.local.json if missing
19
+ # ✔ preserves existing settings (hooks, other configs)
20
+ # ✔ replaces allow list entirely
21
+ # ✔ appends to deny list (no duplicates)
22
+ # ✔ appends to ask list (no duplicates)
23
+ # ✔ idempotent: safe to rerun
24
+ # ✔ fail-fast on errors
25
+ ######################################################################
26
+
27
+ set -euo pipefail
28
+
29
+ PROJECT_ROOT="$PWD"
30
+ SETTINGS_FILE="$PROJECT_ROOT/.claude/settings.local.json"
31
+
32
+ # define the permissions configuration to apply
33
+ PERMISSIONS_CONFIG=$(cat <<'EOF'
34
+ {
35
+ "permissions": {
36
+ "deny": [
37
+ "Bash(git commit:*)"
38
+ ],
39
+ "ask": [
40
+ "Bash(chmod:*)",
41
+ "Bash(pnpm install:*)",
42
+ "Bash(pnpm add:*)"
43
+ ],
44
+ "allow": [
45
+ "WebSearch",
46
+ "WebFetch(domain:github.com)",
47
+ "WebFetch(domain:www.npmjs.com)",
48
+ "WebFetch(domain:hub.docker.com)",
49
+ "WebFetch(domain:raw.githubusercontent.com)",
50
+ "Bash(THOROUGH=true npm run test:*)",
51
+ "Bash(AWS_PROFILE=ahbode.dev npm run test:integration:*)",
52
+ "Bash(npm run fix:*)",
53
+ "Bash(AWS_PROFILE=ahbode.dev npx jest:*)",
54
+ "Bash(AWS_PROFILE=ahbode.dev npm run deploy:dev:*)",
55
+ "Bash(AWS_PROFILE=ahbode.dev STAGE=dev npm run test:acceptance:*)",
56
+ "Bash(npm run start:testdb:*)",
57
+ "Bash(cat:*)",
58
+ "Bash(unzip:*)",
59
+ "Bash(npm view:*)"
60
+ ]
61
+ }
62
+ }
63
+ EOF
64
+ )
65
+
66
+ # ensure .claude directory exists
67
+ mkdir -p "$(dirname "$SETTINGS_FILE")"
68
+
69
+ # initialize settings file if it doesn't exist
70
+ if [[ ! -f "$SETTINGS_FILE" ]]; then
71
+ echo "{}" > "$SETTINGS_FILE"
72
+ fi
73
+
74
+ # apply permissions:
75
+ # - replace allow entirely
76
+ # - append to deny (unique)
77
+ # - append to ask (unique)
78
+ jq --argjson perms "$PERMISSIONS_CONFIG" '
79
+ # ensure .permissions exists
80
+ .permissions //= {} |
81
+
82
+ # replace allow entirely with our config
83
+ .permissions.allow = $perms.permissions.allow |
84
+
85
+ # append to deny (unique entries only)
86
+ .permissions.deny = ((.permissions.deny // []) + $perms.permissions.deny | unique) |
87
+
88
+ # append to ask (unique entries only)
89
+ .permissions.ask = ((.permissions.ask // []) + $perms.permissions.ask | unique)
90
+ ' "$SETTINGS_FILE" > "$SETTINGS_FILE.tmp"
91
+
92
+ # check if any changes were made
93
+ if diff -q "$SETTINGS_FILE" "$SETTINGS_FILE.tmp" >/dev/null 2>&1; then
94
+ rm "$SETTINGS_FILE.tmp"
95
+ echo "👌 mechanic permissions already configured"
96
+ echo " $SETTINGS_FILE"
97
+ exit 0
98
+ fi
99
+
100
+ # atomic replace
101
+ mv "$SETTINGS_FILE.tmp" "$SETTINGS_FILE"
102
+
103
+ echo "🔐 mechanic permissions configured successfully!"
104
+ echo " $SETTINGS_FILE"
105
+ echo ""
106
+ echo "✨ permissions applied:"
107
+ echo " • allow: replaced entirely"
108
+ echo " • deny: extended (no duplicates)"
109
+ echo " • ask: extended (no duplicates)"
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env bash
2
+ ######################################################################
3
+ # .what = initialize Claude settings for mechanic role
4
+ #
5
+ # .why = mechanic needs both hooks and permissions configured to
6
+ # operate effectively. this script dispatches to both:
7
+ # • init.claude.hooks.sh - binds SessionStart hook
8
+ # • init.claude.permissions.sh - configures permissions
9
+ #
10
+ # single entry point for full Claude configuration.
11
+ #
12
+ # .how = runs both init scripts in sequence from the same directory.
13
+ #
14
+ # guarantee:
15
+ # ✔ runs both hooks and permissions initialization
16
+ # ✔ fail-fast on any error
17
+ # ✔ idempotent: safe to rerun
18
+ ######################################################################
19
+
20
+ set -euo pipefail
21
+
22
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23
+
24
+ echo "🔧 init claude config for mechanic role..."
25
+ echo ""
26
+
27
+ # initialize hooks
28
+ "$SCRIPT_DIR/init.claude.hooks.sh"
29
+ echo ""
30
+
31
+ # initialize permissions
32
+ "$SCRIPT_DIR/init.claude.permissions.sh"
33
+ echo ""
34
+
35
+ echo "👌 claude config ready"
@@ -226,8 +226,14 @@ fi
226
226
  echo "> $TEST_COMMAND" | tee -a "$LOG_FILE"
227
227
  echo "" | tee -a "$LOG_FILE"
228
228
 
229
- eval "$TEST_COMMAND" 2>&1 | tee -a "$LOG_FILE"
230
- TEST_EXIT_CODE=${PIPESTATUS[0]}
229
+ # For unit tests, strip color codes from log file while preserving them in terminal output
230
+ if [[ "$TEST_TYPE" == "unit" ]]; then
231
+ eval "$TEST_COMMAND" 2>&1 | tee >(sed 's/\x1B\[[0-9;]*[JKmsu]//g' >> "$LOG_FILE")
232
+ TEST_EXIT_CODE=${PIPESTATUS[0]}
233
+ else
234
+ eval "$TEST_COMMAND" 2>&1 | tee -a "$LOG_FILE"
235
+ TEST_EXIT_CODE=${PIPESTATUS[0]}
236
+ fi
231
237
 
232
238
  echo "" | tee -a "$LOG_FILE"
233
239
 
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.9.1",
5
+ "version": "1.11.0",
6
6
  "repository": "ehmpathy/rhachet-roles-ehmpathy",
7
7
  "homepage": "https://github.com/ehmpathy/rhachet-roles-ehmpathy",
8
8
  "keywords": [
@@ -26,7 +26,7 @@
26
26
  "fix:lint": "eslint -c ./.eslintrc.js src/**/*.ts --fix",
27
27
  "build:clean": "rm dist/ -rf",
28
28
  "build:compile": "tsc -p ./tsconfig.build.json",
29
- "build:complete": "rsync -a --prune-empty-dirs --include='*/' --exclude='**/.route/**' --exclude='**/.scratch/**' --include='**/*.template.md' --include='**/.briefs/**/*.md' --include='**/.briefs/*.md' --include='**/.skills/**/*.sh' --include='**/.skills/*.sh' --exclude='*' src/ dist/",
29
+ "build:complete": "rsync -a --prune-empty-dirs --include='*/' --exclude='**/.route/**' --exclude='**/.scratch/**' --exclude='**/.behavior/**' --include='**/*.template.md' --include='**/.briefs/**/*.md' --include='**/.briefs/*.md' --include='**/.skills/**/*.sh' --include='**/.skills/*.sh' --exclude='*' src/ dist/",
30
30
  "build": "npm run build:clean && npm run build:compile && npm run build:complete",
31
31
  "test:commits": "LAST_TAG=$(git describe --tags --abbrev=0 @^ 2> /dev/null || git rev-list --max-parents=0 HEAD) && npx commitlint --from $LAST_TAG --to HEAD --verbose",
32
32
  "test:types": "tsc -p ./tsconfig.build.json --noEmit",