ai-fob 1.3.2 → 1.3.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,40 @@
1
+ #!/bin/bash
2
+
3
+ # ai-fob PreToolUse hook — branch protection warning
4
+ # Warns (never blocks) when working on main or master branches.
5
+ # Stateless — no temp files, warns on every matching tool call.
6
+ # Exit 0 always — stdout message becomes context for Claude.
7
+
8
+ input=$(cat)
9
+
10
+ # --- Determine working directory ---
11
+ cwd=$(echo "$input" | jq -r '.cwd // empty')
12
+ if [ -z "$cwd" ]; then
13
+ exit 0
14
+ fi
15
+
16
+ # --- Check if inside a git repo ---
17
+ if ! git -C "$cwd" rev-parse --git-dir > /dev/null 2>&1; then
18
+ exit 0
19
+ fi
20
+
21
+ # --- Get current branch ---
22
+ branch=$(git -C "$cwd" --no-optional-locks branch --show-current 2>/dev/null)
23
+ if [ -z "$branch" ]; then
24
+ exit 0
25
+ fi
26
+
27
+ # --- Check against protected branch names ---
28
+ case "$branch" in
29
+ main|master) ;;
30
+ *) exit 0 ;;
31
+ esac
32
+
33
+ # --- Emit warning to Claude (stdout becomes context) ---
34
+ tool_name=$(echo "$input" | jq -r '.tool_name // empty')
35
+
36
+ cat <<EOF
37
+ BRANCH PROTECTION WARNING: You are currently on the '${branch}' branch. This is a protected branch. Please confirm with the user that they intend to make changes directly on '${branch}' before proceeding with this ${tool_name} call. If they haven't explicitly confirmed, ask them whether they'd like to create a feature branch first.
38
+ EOF
39
+
40
+ exit 0
@@ -19,6 +19,17 @@
19
19
  }
20
20
  ]
21
21
  }
22
+ ],
23
+ "PreToolUse": [
24
+ {
25
+ "matcher": "Write|Edit|MultiEdit|Bash",
26
+ "hooks": [
27
+ {
28
+ "type": "command",
29
+ "command": "bash __CLAUDE_DIR__/hooks/branch-protect-warn.sh"
30
+ }
31
+ ]
32
+ }
22
33
  ]
23
34
  }
24
35
  }
package/bin/install.js CHANGED
@@ -594,7 +594,8 @@ async function install(presetName, isGlobal, dryRun, force) {
594
594
  for (const entry of plan) {
595
595
  const placeholder = manifest.pathRewrite[entry.file.dest];
596
596
  if (placeholder && entry.srcContent) {
597
- entry.srcContent = entry.srcContent.replaceAll(placeholder, targetRoot);
597
+ const replacement = isGlobal ? targetRoot : '\\"$CLAUDE_PROJECT_DIR\\"/.claude';
598
+ entry.srcContent = entry.srcContent.replaceAll(placeholder, replacement);
598
599
  entry.srcHash = sha256(entry.srcContent);
599
600
  }
600
601
  }
package/manifest.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.3.2",
2
+ "version": "1.3.3",
3
3
  "presets": {
4
4
  "coding": {
5
5
  "description": "Research-driven coding workflow",
@@ -78,7 +78,8 @@
78
78
  "README.md",
79
79
  "claude-scripts/build-phase.sh",
80
80
  "statusline.sh",
81
- "hooks/session-start-model.sh"
81
+ "hooks/session-start-model.sh",
82
+ "hooks/branch-protect-warn.sh"
82
83
  ],
83
84
  "mergeFiles": {
84
85
  "settings.json": "json-deep-merge"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-fob",
3
- "version": "1.3.2",
3
+ "version": "1.3.3",
4
4
  "description": "Deploy research-driven AI coding assistant assets (skills, agents, commands) into your projects",
5
5
  "bin": {
6
6
  "ai-fob": "bin/install.js"