@wipcomputer/wip-ai-devops-toolbox 1.9.57 → 1.9.59

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 (195) hide show
  1. package/.worktrees/toolbox--guard-plan/.license-guard.json +7 -0
  2. package/.worktrees/toolbox--guard-plan/.publish-skill.json +4 -0
  3. package/.worktrees/toolbox--guard-plan/CHANGELOG.md +1965 -0
  4. package/.worktrees/toolbox--guard-plan/CLA.md +19 -0
  5. package/.worktrees/toolbox--guard-plan/DEV-GUIDE-GENERAL-PUBLIC.md +949 -0
  6. package/.worktrees/toolbox--guard-plan/LICENSE +52 -0
  7. package/.worktrees/toolbox--guard-plan/README.md +238 -0
  8. package/.worktrees/toolbox--guard-plan/RELEASE-NOTES-v1-9-59.md +28 -0
  9. package/.worktrees/toolbox--guard-plan/SKILL.md +821 -0
  10. package/.worktrees/toolbox--guard-plan/TECHNICAL.md +416 -0
  11. package/.worktrees/toolbox--guard-plan/UNIVERSAL-INTERFACE.md +180 -0
  12. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-8-0.md +29 -0
  13. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-8-1.md +7 -0
  14. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-8-2.md +7 -0
  15. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-0.md +37 -0
  16. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-1.md +38 -0
  17. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-10.md +40 -0
  18. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-2.md +40 -0
  19. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-31.md +26 -0
  20. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-32.md +18 -0
  21. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-41.md +28 -0
  22. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-45.md +25 -0
  23. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-46.md +38 -0
  24. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-47.md +42 -0
  25. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-48.md +22 -0
  26. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-49.md +31 -0
  27. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-50.md +24 -0
  28. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-51.md +11 -0
  29. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-52.md +25 -0
  30. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-53.md +22 -0
  31. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-54.md +13 -0
  32. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-55.md +11 -0
  33. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-56.md +42 -0
  34. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-57.md +18 -0
  35. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-58.md +21 -0
  36. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-6.md +72 -0
  37. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-7.md +23 -0
  38. package/.worktrees/toolbox--guard-plan/_trash/RELEASE-NOTES-v1-9-9.md +75 -0
  39. package/.worktrees/toolbox--guard-plan/_trash/guide 2/DEV-GUIDE.md +487 -0
  40. package/.worktrees/toolbox--guard-plan/_trash/guide 2/scripts/deploy-public.sh +152 -0
  41. package/.worktrees/toolbox--guard-plan/package.json +27 -0
  42. package/.worktrees/toolbox--guard-plan/scripts/SKILL-deploy-public.md +61 -0
  43. package/.worktrees/toolbox--guard-plan/scripts/SKILL-post-merge-rename.md +47 -0
  44. package/.worktrees/toolbox--guard-plan/scripts/deploy-public.sh +350 -0
  45. package/.worktrees/toolbox--guard-plan/scripts/post-merge-rename.sh +210 -0
  46. package/.worktrees/toolbox--guard-plan/scripts/publish-skill.sh +134 -0
  47. package/.worktrees/toolbox--guard-plan/templates/global-claude-md.md +73 -0
  48. package/.worktrees/toolbox--guard-plan/templates/repo-claude-md.template +24 -0
  49. package/.worktrees/toolbox--guard-plan/tools/deploy-public/LICENSE +52 -0
  50. package/.worktrees/toolbox--guard-plan/tools/deploy-public/README.md +31 -0
  51. package/.worktrees/toolbox--guard-plan/tools/deploy-public/SKILL.md +71 -0
  52. package/.worktrees/toolbox--guard-plan/tools/deploy-public/deploy-public.sh +264 -0
  53. package/.worktrees/toolbox--guard-plan/tools/deploy-public/package.json +9 -0
  54. package/.worktrees/toolbox--guard-plan/tools/ldm-jobs/LICENSE +52 -0
  55. package/.worktrees/toolbox--guard-plan/tools/ldm-jobs/README.md +46 -0
  56. package/.worktrees/toolbox--guard-plan/tools/ldm-jobs/backup.sh +16 -0
  57. package/.worktrees/toolbox--guard-plan/tools/ldm-jobs/branch-protect.sh +39 -0
  58. package/.worktrees/toolbox--guard-plan/tools/ldm-jobs/crystal-capture.sh +19 -0
  59. package/.worktrees/toolbox--guard-plan/tools/ldm-jobs/setup-shell.sh +27 -0
  60. package/.worktrees/toolbox--guard-plan/tools/ldm-jobs/visibility-audit.sh +27 -0
  61. package/.worktrees/toolbox--guard-plan/tools/post-merge-rename/LICENSE +52 -0
  62. package/.worktrees/toolbox--guard-plan/tools/post-merge-rename/README.md +29 -0
  63. package/.worktrees/toolbox--guard-plan/tools/post-merge-rename/SKILL.md +57 -0
  64. package/.worktrees/toolbox--guard-plan/tools/post-merge-rename/package.json +9 -0
  65. package/.worktrees/toolbox--guard-plan/tools/post-merge-rename/post-merge-rename.sh +122 -0
  66. package/.worktrees/toolbox--guard-plan/tools/wip-branch-guard/INSTALL.md +41 -0
  67. package/.worktrees/toolbox--guard-plan/tools/wip-branch-guard/guard.mjs +477 -0
  68. package/.worktrees/toolbox--guard-plan/tools/wip-branch-guard/package.json +18 -0
  69. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/CHANGELOG.md +6 -0
  70. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/LICENSE +52 -0
  71. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/README.md +113 -0
  72. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/REFERENCE.md +86 -0
  73. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/SKILL.md +105 -0
  74. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/guard.mjs +161 -0
  75. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/openclaw.plugin.json +8 -0
  76. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/package.json +27 -0
  77. package/.worktrees/toolbox--guard-plan/tools/wip-file-guard/test.sh +119 -0
  78. package/.worktrees/toolbox--guard-plan/tools/wip-license-guard/LICENSE +52 -0
  79. package/.worktrees/toolbox--guard-plan/tools/wip-license-guard/README.md +69 -0
  80. package/.worktrees/toolbox--guard-plan/tools/wip-license-guard/SKILL.md +65 -0
  81. package/.worktrees/toolbox--guard-plan/tools/wip-license-guard/cli.mjs +472 -0
  82. package/.worktrees/toolbox--guard-plan/tools/wip-license-guard/core.mjs +310 -0
  83. package/.worktrees/toolbox--guard-plan/tools/wip-license-guard/guard.mjs +146 -0
  84. package/.worktrees/toolbox--guard-plan/tools/wip-license-guard/package.json +22 -0
  85. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/CHANGELOG.md +17 -0
  86. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/LICENSE +52 -0
  87. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/README.md +200 -0
  88. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/SKILL.md +111 -0
  89. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/cli/index.d.ts +15 -0
  90. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/cli/index.js +170 -0
  91. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/cli/index.js.map +1 -0
  92. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/detector.d.ts +12 -0
  93. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/detector.js +104 -0
  94. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/detector.js.map +1 -0
  95. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/index.d.ts +4 -0
  96. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/index.js +5 -0
  97. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/index.js.map +1 -0
  98. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/ledger.d.ts +49 -0
  99. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/ledger.js +72 -0
  100. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/ledger.js.map +1 -0
  101. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/reporter.d.ts +14 -0
  102. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/reporter.js +227 -0
  103. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/reporter.js.map +1 -0
  104. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/scanner.d.ts +39 -0
  105. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/scanner.js +325 -0
  106. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/dist/core/scanner.js.map +1 -0
  107. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/hooks/pre-pull.sh +55 -0
  108. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/hooks/pre-push.sh +51 -0
  109. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/mcp-server.mjs +119 -0
  110. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/package-lock.json +54 -0
  111. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/package.json +43 -0
  112. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/src/cli/index.ts +189 -0
  113. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/src/core/detector.ts +130 -0
  114. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/src/core/index.ts +4 -0
  115. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/src/core/ledger.ts +116 -0
  116. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/src/core/reporter.ts +255 -0
  117. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/src/core/scanner.ts +367 -0
  118. package/.worktrees/toolbox--guard-plan/tools/wip-license-hook/tsconfig.json +16 -0
  119. package/.worktrees/toolbox--guard-plan/tools/wip-readme-format/README.md +49 -0
  120. package/.worktrees/toolbox--guard-plan/tools/wip-readme-format/SKILL.md +84 -0
  121. package/.worktrees/toolbox--guard-plan/tools/wip-readme-format/format.mjs +597 -0
  122. package/.worktrees/toolbox--guard-plan/tools/wip-readme-format/package.json +15 -0
  123. package/.worktrees/toolbox--guard-plan/tools/wip-release/CHANGELOG.md +42 -0
  124. package/.worktrees/toolbox--guard-plan/tools/wip-release/LICENSE +52 -0
  125. package/.worktrees/toolbox--guard-plan/tools/wip-release/README.md +45 -0
  126. package/.worktrees/toolbox--guard-plan/tools/wip-release/REFERENCE.md +100 -0
  127. package/.worktrees/toolbox--guard-plan/tools/wip-release/SKILL.md +139 -0
  128. package/.worktrees/toolbox--guard-plan/tools/wip-release/cli.js +175 -0
  129. package/.worktrees/toolbox--guard-plan/tools/wip-release/core.mjs +1664 -0
  130. package/.worktrees/toolbox--guard-plan/tools/wip-release/mcp-server.mjs +113 -0
  131. package/.worktrees/toolbox--guard-plan/tools/wip-release/package.json +36 -0
  132. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/README.md +38 -0
  133. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/SKILL.md +77 -0
  134. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/init.mjs +148 -0
  135. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/package.json +11 -0
  136. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/_sort/README.md +15 -0
  137. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/_trash/README.md +16 -0
  138. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/dev-updates/README.md +50 -0
  139. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/product/notes/README.md +26 -0
  140. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/product/plans-prds/roadmap.md +77 -0
  141. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/product/plans-prds/todos/README.md +63 -0
  142. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/product/product-ideas/README.md +24 -0
  143. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/product/readme-first-product.md +128 -0
  144. package/.worktrees/toolbox--guard-plan/tools/wip-repo-init/templates/read-me-first.md +80 -0
  145. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/LICENSE +52 -0
  146. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/README.md +86 -0
  147. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/SKILL.md +73 -0
  148. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/cli.js +93 -0
  149. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/core.mjs +122 -0
  150. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/guard.mjs +64 -0
  151. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/mcp-server.mjs +92 -0
  152. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/openclaw.plugin.json +8 -0
  153. package/.worktrees/toolbox--guard-plan/tools/wip-repo-permissions-hook/package.json +31 -0
  154. package/.worktrees/toolbox--guard-plan/tools/wip-repos/LICENSE +52 -0
  155. package/.worktrees/toolbox--guard-plan/tools/wip-repos/README.md +77 -0
  156. package/.worktrees/toolbox--guard-plan/tools/wip-repos/SKILL.md +80 -0
  157. package/.worktrees/toolbox--guard-plan/tools/wip-repos/claude.mjs +248 -0
  158. package/.worktrees/toolbox--guard-plan/tools/wip-repos/cli.mjs +191 -0
  159. package/.worktrees/toolbox--guard-plan/tools/wip-repos/core.mjs +290 -0
  160. package/.worktrees/toolbox--guard-plan/tools/wip-repos/mcp-server.mjs +157 -0
  161. package/.worktrees/toolbox--guard-plan/tools/wip-repos/package.json +34 -0
  162. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/CHANGELOG.md +57 -0
  163. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/LICENSE +52 -0
  164. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/README.md +81 -0
  165. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/REFERENCE.md +122 -0
  166. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/SKILL.md +87 -0
  167. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/SPEC.md +206 -0
  168. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/detect.mjs +130 -0
  169. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/examples/minimal/README.md +20 -0
  170. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/examples/minimal/SKILL.md +28 -0
  171. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/examples/minimal/cli.mjs +4 -0
  172. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/examples/minimal/core.mjs +8 -0
  173. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/examples/minimal/mcp-server.mjs +27 -0
  174. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/examples/minimal/package.json +12 -0
  175. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/install.js +930 -0
  176. package/.worktrees/toolbox--guard-plan/tools/wip-universal-installer/package.json +32 -0
  177. package/CHANGELOG.md +55 -0
  178. package/SKILL.md +1 -1
  179. package/_trash/RELEASE-NOTES-v1-9-58.md +21 -0
  180. package/_trash/RELEASE-NOTES-v1-9-59.md +28 -0
  181. package/package.json +1 -1
  182. package/scripts/deploy-public.sh +3 -0
  183. package/tools/deploy-public/package.json +1 -1
  184. package/tools/post-merge-rename/package.json +1 -1
  185. package/tools/wip-branch-guard/guard.mjs +57 -39
  186. package/tools/wip-branch-guard/package.json +1 -1
  187. package/tools/wip-file-guard/package.json +1 -1
  188. package/tools/wip-license-guard/package.json +1 -1
  189. package/tools/wip-license-hook/package.json +1 -1
  190. package/tools/wip-readme-format/package.json +1 -1
  191. package/tools/wip-release/package.json +1 -1
  192. package/tools/wip-repo-init/package.json +1 -1
  193. package/tools/wip-repo-permissions-hook/package.json +1 -1
  194. package/tools/wip-repos/package.json +1 -1
  195. package/tools/wip-universal-installer/package.json +1 -1
@@ -0,0 +1,122 @@
1
+ #!/usr/bin/env bash
2
+ #
3
+ # post-merge-rename.sh
4
+ # Scans for branches merged into main and renames them with --merged-YYYY-MM-DD.
5
+ # Branches already renamed (containing --merged-) are skipped.
6
+ # Never deletes branches. Only renames.
7
+ #
8
+ # Usage:
9
+ # bash post-merge-rename.sh # scan + rename all
10
+ # bash post-merge-rename.sh <branch> # rename a specific branch
11
+ # bash post-merge-rename.sh --dry-run # preview only
12
+ # bash post-merge-rename.sh <branch> --dry-run # preview specific branch
13
+ #
14
+ # Run this after merging a PR, or periodically to catch missed renames.
15
+ #
16
+ # Author: CC-mini (Opus 4.6)
17
+ # Date: 2026-03-08
18
+
19
+ set -euo pipefail
20
+
21
+ DRY_RUN=false
22
+ SPECIFIC_BRANCH=""
23
+
24
+ for arg in "$@"; do
25
+ case "$arg" in
26
+ --dry-run) DRY_RUN=true ;;
27
+ --help|-h)
28
+ echo "Usage: post-merge-rename.sh [<branch>] [--dry-run]"
29
+ echo ""
30
+ echo "Scans for branches merged into main and renames them"
31
+ echo "with --merged-YYYY-MM-DD suffix. Never deletes branches."
32
+ exit 0
33
+ ;;
34
+ *) SPECIFIC_BRANCH="$arg" ;;
35
+ esac
36
+ done
37
+
38
+ # Must be in a git repo
39
+ if ! git rev-parse --is-inside-work-tree &>/dev/null; then
40
+ echo "Error: not inside a git repo."
41
+ exit 1
42
+ fi
43
+
44
+ # Fetch latest remote state
45
+ git fetch origin --prune 2>/dev/null || true
46
+
47
+ rename_branch() {
48
+ local branch="$1"
49
+ local trimmed
50
+ trimmed=$(echo "$branch" | sed 's/^[[:space:]]*//' | sed 's/[[:space:]]*$//')
51
+
52
+ # Skip main
53
+ [[ "$trimmed" == "main" || "$trimmed" == "master" ]] && return
54
+
55
+ # Skip already renamed
56
+ [[ "$trimmed" == *"--merged-"* ]] && return
57
+
58
+ # Skip current branch (can't rename the checked-out branch)
59
+ local current
60
+ current=$(git branch --show-current)
61
+ if [[ "$trimmed" == "$current" ]]; then
62
+ echo " SKIP $trimmed (currently checked out)"
63
+ return
64
+ fi
65
+
66
+ # Find merge date: when this branch's tip became reachable from main
67
+ local merge_date
68
+ merge_date=$(git log main --format="%ai" --ancestry-path "$(git merge-base main "$trimmed" 2>/dev/null)..main" 2>/dev/null | tail -1 | cut -d' ' -f1)
69
+
70
+ # Fallback: use the branch tip's own date
71
+ if [[ -z "$merge_date" ]]; then
72
+ merge_date=$(git log "$trimmed" -1 --format="%ai" 2>/dev/null | cut -d' ' -f1)
73
+ fi
74
+
75
+ if [[ -z "$merge_date" ]]; then
76
+ echo " SKIP $trimmed (could not determine merge date)"
77
+ return
78
+ fi
79
+
80
+ local new_name="${trimmed}--merged-${merge_date}"
81
+
82
+ if $DRY_RUN; then
83
+ echo " [dry-run] $trimmed -> $new_name"
84
+ else
85
+ echo " Renaming: $trimmed -> $new_name"
86
+
87
+ # Rename local
88
+ git branch -m "$trimmed" "$new_name" 2>/dev/null || true
89
+
90
+ # Push new name to remote
91
+ git push origin "$new_name" 2>/dev/null || true
92
+
93
+ # Remove old name from remote
94
+ git push origin --delete "$trimmed" 2>/dev/null || true
95
+ fi
96
+ }
97
+
98
+ if [[ -n "$SPECIFIC_BRANCH" && "$SPECIFIC_BRANCH" != "--dry-run" ]]; then
99
+ # Rename a specific branch
100
+ echo "Checking branch: $SPECIFIC_BRANCH"
101
+ if git merge-base --is-ancestor "$SPECIFIC_BRANCH" main 2>/dev/null; then
102
+ rename_branch "$SPECIFIC_BRANCH"
103
+ else
104
+ echo " $SPECIFIC_BRANCH is NOT merged into main. Leaving as-is."
105
+ fi
106
+ else
107
+ # Scan all local branches merged into main
108
+ echo "Scanning for merged branches..."
109
+ merged=$(git branch --merged main | grep -v "^\*" | grep -v "main$" | grep -v "master$" | grep -v "\-\-merged\-" || true)
110
+
111
+ if [[ -z "$merged" ]]; then
112
+ echo " No unrenamed merged branches found. All clean."
113
+ exit 0
114
+ fi
115
+
116
+ while IFS= read -r branch; do
117
+ rename_branch "$branch"
118
+ done <<< "$merged"
119
+ fi
120
+
121
+ echo ""
122
+ echo "Done."
@@ -0,0 +1,41 @@
1
+ # wip-branch-guard Installation
2
+
3
+ Add this hook to `~/.claude/settings.json` under `hooks.PreToolUse`:
4
+
5
+ ```json
6
+ {
7
+ "matcher": "Write|Edit|NotebookEdit|Bash",
8
+ "hooks": [
9
+ {
10
+ "type": "command",
11
+ "command": "node /Users/lesa/.ldm/extensions/wip-branch-guard/guard.mjs",
12
+ "timeout": 5
13
+ }
14
+ ]
15
+ }
16
+ ```
17
+
18
+ Then copy the guard to the extensions directory:
19
+
20
+ ```bash
21
+ mkdir -p ~/.ldm/extensions/wip-branch-guard
22
+ cp guard.mjs package.json ~/.ldm/extensions/wip-branch-guard/
23
+ ```
24
+
25
+ ## What it does
26
+
27
+ Blocks ALL file writes and git commits when Claude Code is on main branch.
28
+ Agents must create a branch or use a worktree before editing anything.
29
+
30
+ ## What it allows on main
31
+
32
+ - Read, Glob, Grep (read-only tools)
33
+ - git status, git log, git diff, git branch, git checkout, git pull, git merge, git push
34
+ - gh commands (issues, PRs, releases)
35
+ - Opening files in browser/mdview
36
+
37
+ ## Test
38
+
39
+ ```bash
40
+ node ~/.ldm/extensions/wip-branch-guard/guard.mjs --check
41
+ ```
@@ -0,0 +1,477 @@
1
+ #!/usr/bin/env node
2
+ // wip-branch-guard/guard.mjs
3
+ // PreToolUse hook for Claude Code.
4
+ // Blocks ALL file writes and git commits when on main branch.
5
+ // Agents must work on branches or worktrees. Never on main.
6
+ // Also blocks dangerous flags (--no-verify, --force) on ANY branch.
7
+
8
+ import { execSync } from 'node:child_process';
9
+ import { dirname, join } from 'node:path';
10
+ import { statSync, readFileSync, existsSync } from 'node:fs';
11
+ import { fileURLToPath } from 'node:url';
12
+
13
+ if (process.argv.includes('--version') || process.argv.includes('-v')) {
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ const pkg = JSON.parse(readFileSync(join(__dirname, 'package.json'), 'utf8'));
16
+ console.log(pkg.version);
17
+ process.exit(0);
18
+ }
19
+
20
+ // Tools that modify files or git state
21
+ const WRITE_TOOLS = new Set(['Write', 'Edit', 'NotebookEdit']);
22
+ const BASH_TOOL = 'Bash';
23
+
24
+ // Git commands that should be blocked on main
25
+ const BLOCKED_GIT_PATTERNS = [
26
+ /\bgit\s+commit\b/,
27
+ /\bgit\s+add\b/,
28
+ /\bgit\s+stash\b/,
29
+ /\bgit\s+reset\b/,
30
+ /\bgit\s+revert\b/,
31
+ /\bgit\s+clean\b/,
32
+ /\bgit\s+restore\b/,
33
+ ];
34
+
35
+ // Destructive git commands blocked on ANY branch, not just main.
36
+ // These destroy work that may belong to other agents or the user.
37
+ // Checked against STRIPPED command (quoted content removed) to avoid false positives (#232).
38
+ const DESTRUCTIVE_PATTERNS = [
39
+ /\bgit\s+clean\s+-[a-zA-Z]*f/, // git clean -f, -fd, -fdx (deletes untracked files)
40
+ /\bgit\s+checkout\s+--\s/, // git checkout -- <path> (reverts files)
41
+ /\bgit\s+checkout\s+\.\s*$/, // git checkout . (reverts everything)
42
+ /\bgit\s+stash\s+drop\b/, // git stash drop (permanently deletes stashed work)
43
+ /\bgit\s+stash\s+pop\b/, // git stash pop (overwrites working tree, drops on success)
44
+ /\bgit\s+stash\s+clear\b/, // git stash clear (drops all stashes)
45
+ /\bgit\s+reset\s+--hard\b/, // git reset --hard (nukes all uncommitted changes)
46
+ /\bgit\s+restore\s+(?!--staged)/, // git restore <path> (reverts files, but --staged is safe)
47
+ ];
48
+
49
+ // Code execution bypass patterns. Checked against ORIGINAL command because
50
+ // the attack IS inside quotes (e.g. python -c "open('f').write('x')").
51
+ const DESTRUCTIVE_CODE_PATTERNS = [
52
+ /\bpython3?\s+-c\s+.*\bopen\s*\(/, // python -c "open().write()" bypass (#241)
53
+ /\bnode\s+-e\s+.*\bfs\.\w*[Ww]rite/, // node -e "fs.writeFile()" bypass
54
+ ];
55
+
56
+ // Strip quoted string contents to prevent regex matching inside data.
57
+ // "gh issue create --body 'use git checkout -- to fix'" becomes
58
+ // "gh issue create --body ''" so git checkout -- doesn't false-positive.
59
+ function stripQuotedContent(cmd) {
60
+ return cmd.replace(/"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'/g, '""');
61
+ }
62
+
63
+ // Check each segment of a compound command independently.
64
+ // "rm -f file ; echo done" splits into ["rm -f file", "echo done"].
65
+ // Each segment checked against blocked, then allowed. An allowed match
66
+ // on one segment can't excuse a blocked match on a different segment (#232).
67
+ function isBlockedCompoundCommand(cmd, blockedPatterns, allowedPatterns) {
68
+ const stripped = stripQuotedContent(cmd);
69
+ const segments = stripped.split(/\s*(?:&&|\|\||[;|])\s*/).filter(Boolean);
70
+ for (const segment of segments) {
71
+ if (blockedPatterns.some(p => p.test(segment))) {
72
+ if (!allowedPatterns.some(p => p.test(segment))) return true;
73
+ }
74
+ }
75
+ return false;
76
+ }
77
+
78
+ // Git commands that are ALLOWED on main (read-only or safe operations)
79
+ const ALLOWED_GIT_PATTERNS = [
80
+ /\bgit\s+merge\b/,
81
+ /\bgit\s+pull\b/,
82
+ /\bgit\s+fetch\b/,
83
+ /\bgit\s+push\b/,
84
+ /\bgit\s+status\b/,
85
+ /\bgit\s+log\b/,
86
+ /\bgit\s+diff\b/,
87
+ /\bgit\s+branch\b/,
88
+ /\bgit\s+checkout\s+(?!--)[\w\-\/]+/, // git checkout <branch> only, NOT git checkout -- <path>
89
+ /\bgit\s+worktree\b/,
90
+ /\bgit\s+stash\s+list\b/, // read-only, just lists stashes
91
+ /\bgit\s+stash\s+show\b/, // read-only, just shows stash contents
92
+ /\bgit\s+remote\b/,
93
+ /\bgit\s+describe\b/,
94
+ /\bgit\s+tag\b/,
95
+ /\bgit\s+rev-parse\b/,
96
+ /\bgit\s+show\b/,
97
+ /\bgit\s+restore\s+--staged\b/, // unstaging is safe (doesn't change working tree)
98
+ ];
99
+
100
+ // Non-git bash commands that write files (common patterns)
101
+ const BLOCKED_BASH_PATTERNS = [
102
+ /\bcp\s+/,
103
+ /\bmv\s+/,
104
+ /\brm\s+/,
105
+ /\bmkdir\s+/,
106
+ /\btouch\s+/,
107
+ />\s/, // redirects
108
+ /\btee\s+/,
109
+ /\bsed\s+-i/,
110
+ ];
111
+
112
+ // Allowed bash patterns (read-only operations, even though they match blocked patterns)
113
+ const ALLOWED_BASH_PATTERNS = [
114
+ /\bls\b/,
115
+ /\bcat\b/,
116
+ /\bhead\b/,
117
+ /\btail\b/,
118
+ /\bgrep\b/,
119
+ /\brg\b/,
120
+ /\bfind\b/,
121
+ /\bwc\b/,
122
+ /\becho\b/,
123
+ /\bcurl\b/,
124
+ /\bgh\s+(issue|pr|release|api)\b/,
125
+ /\bgh\s+pr\s+merge\b/,
126
+ /\blsof\b/,
127
+ /\bopen\s+-a\b/,
128
+ /\bpwd\b/,
129
+ /--dry-run/,
130
+ /--help/,
131
+ /\bwip-release\b.*--dry-run/,
132
+ /\bnpm\s+install\s+-g\b/, // global installs modify /opt/homebrew/, not the repo
133
+ /\bnpm\s+link\b/, // global operation, not repo-local
134
+ /\bldm\s+(install|init|doctor|stack|updates)\b/, // LDM OS commands modify ~/.ldm/, not the repo
135
+ /\brm\s+.*\.ldm\/state\//, // cleaning LDM state files only, not repo files
136
+ /\bclaude\s+mcp\b/, // MCP registration, not repo files
137
+ /\bmkdir\s+.*\.worktrees\b/, // creating .worktrees/ directory is part of the process
138
+ ];
139
+
140
+ // Workflow steps for error messages (#213)
141
+ const WORKFLOW_ON_MAIN = `
142
+ The process: worktree -> branch -> commit -> push -> PR -> merge -> wip-release -> deploy-public.
143
+
144
+ Step 1: git worktree add .worktrees/<repo>--<branch> -b cc-mini/your-feature
145
+ Step 2: Edit files in the worktree
146
+ Step 3: git add + git commit (with co-authors)
147
+ Step 4: git push -u origin cc-mini/your-feature
148
+ Step 5: gh pr create, then gh pr merge --merge --delete-branch
149
+ Step 6: Back in main repo: git pull
150
+ Step 7: wip-release patch (with RELEASE-NOTES on the branch, not after)
151
+ Step 8: deploy-public.sh to sync public repo
152
+
153
+ Release notes go ON the feature branch, committed with the code. Not as a separate PR.`.trim();
154
+
155
+ const WORKFLOW_NOT_WORKTREE = `
156
+ You're on a branch but not in a worktree. Use a worktree so the main working tree stays clean.
157
+
158
+ Step 1: git checkout main (go back to main first)
159
+ Step 2: git worktree add ../my-worktree -b your-branch-name
160
+ Step 3: Edit files in the worktree directory`.trim();
161
+
162
+ function deny(reason) {
163
+ const output = {
164
+ hookSpecificOutput: {
165
+ hookEventName: 'PreToolUse',
166
+ permissionDecision: 'deny',
167
+ permissionDecisionReason: reason,
168
+ },
169
+ };
170
+ process.stdout.write(JSON.stringify(output));
171
+ }
172
+
173
+ function findRepoRoot(filePath) {
174
+ // Walk up from a file path to find the git repo root
175
+ try {
176
+ let dir = filePath;
177
+ // If it's a file, start from its directory
178
+ try {
179
+ if (statSync(dir).isFile()) dir = dirname(dir);
180
+ } catch {
181
+ dir = dirname(dir); // File might not exist yet
182
+ }
183
+
184
+ // Walk up until we find an existing directory (handles mkdir for new paths)
185
+ while (dir && dir !== '/') {
186
+ try {
187
+ const s = statSync(dir);
188
+ if (s.isDirectory()) break;
189
+ dir = dirname(dir);
190
+ } catch {
191
+ dir = dirname(dir);
192
+ }
193
+ }
194
+
195
+ // Use git rev-parse from the directory
196
+ const result = execSync('git rev-parse --show-toplevel 2>/dev/null', {
197
+ cwd: dir,
198
+ encoding: 'utf8',
199
+ timeout: 3000,
200
+ }).trim();
201
+ return result;
202
+ } catch {}
203
+ return null;
204
+ }
205
+
206
+ function extractPathsFromCommand(command) {
207
+ // Extract absolute paths from a bash command
208
+ // Matches paths like /Users/foo/bar, /tmp/something, etc.
209
+ const paths = [];
210
+ const regex = /(\/(?:Users|home|tmp|var|opt|etc|private)[^\s"'|;&>)]+)/g;
211
+ let match;
212
+ while ((match = regex.exec(command)) !== null) {
213
+ paths.push(match[1]);
214
+ }
215
+ return paths;
216
+ }
217
+
218
+ function getCurrentBranch(cwd) {
219
+ try {
220
+ return execSync('git branch --show-current 2>/dev/null', {
221
+ cwd: cwd || process.cwd(),
222
+ encoding: 'utf8',
223
+ timeout: 3000,
224
+ }).trim();
225
+ } catch {
226
+ return null; // Not in a git repo
227
+ }
228
+ }
229
+
230
+ function isInWorktree(cwd) {
231
+ try {
232
+ const gitDir = execSync('git rev-parse --git-dir 2>/dev/null', {
233
+ cwd: cwd || process.cwd(),
234
+ encoding: 'utf8',
235
+ timeout: 3000,
236
+ }).trim();
237
+ return gitDir.includes('/worktrees/');
238
+ } catch {
239
+ return false;
240
+ }
241
+ }
242
+
243
+ // CLI mode
244
+ if (process.argv.includes('--check')) {
245
+ const branch = getCurrentBranch();
246
+ const worktree = isInWorktree();
247
+ console.log(`Branch: ${branch || '(not in git repo)'}`);
248
+ console.log(`Worktree: ${worktree ? 'yes' : 'no'}`);
249
+ console.log(`Status: ${branch === 'main' || branch === 'master' ? 'BLOCKED (on main)' : 'OK'}`);
250
+ process.exit(branch === 'main' || branch === 'master' ? 1 : 0);
251
+ }
252
+
253
+ async function main() {
254
+ let raw = '';
255
+ for await (const chunk of process.stdin) {
256
+ raw += chunk;
257
+ }
258
+
259
+ let input;
260
+ try {
261
+ input = JSON.parse(raw);
262
+ } catch {
263
+ process.exit(0);
264
+ }
265
+
266
+ const toolName = input.tool_name || '';
267
+ const toolInput = input.tool_input || {};
268
+
269
+ // Block destructive commands on ANY branch.
270
+ // These destroy work that may belong to other agents or the user.
271
+ if (toolName === BASH_TOOL) {
272
+ const cmd = (toolInput.command || '');
273
+ const strippedCmd = stripQuotedContent(cmd);
274
+
275
+ // Git destructive patterns: check against stripped command (no quoted content)
276
+ for (const pattern of DESTRUCTIVE_PATTERNS) {
277
+ if (pattern.test(strippedCmd)) {
278
+ deny(`BLOCKED: Destructive command detected.
279
+
280
+ "${cmd.substring(0, 80)}" can permanently destroy uncommitted work (yours, the user's, or another agent's).
281
+
282
+ DO NOT retry. DO NOT work around this. Instead:
283
+ 1. STOP. Think about what you actually need to accomplish.
284
+ 2. If you need a clean working tree, use a WORKTREE instead of destroying files on main.
285
+ 3. If something is stuck (merge conflict, dirty state), create a safety checkpoint first:
286
+ git stash create (saves all uncommitted work without modifying the tree)
287
+ git stash store <sha> -m "checkpoint before cleanup"
288
+ 4. THEN proceed carefully with the minimum necessary operation.
289
+
290
+ These commands have destroyed work belonging to the user and other agents multiple times.`);
291
+ process.exit(0);
292
+ }
293
+ }
294
+ // Code execution bypasses: check against original command (the attack IS inside quotes)
295
+ for (const pattern of DESTRUCTIVE_CODE_PATTERNS) {
296
+ if (pattern.test(cmd)) {
297
+ deny(`BLOCKED: Code execution bypass detected.
298
+
299
+ "${cmd.substring(0, 80)}" writes files through a scripting language, bypassing git protections.
300
+
301
+ Use the proper workflow: edit files in a worktree, commit, push, PR.`);
302
+ process.exit(0);
303
+ }
304
+ }
305
+ }
306
+
307
+ // Block dangerous flags on ANY branch (these bypass safety checks)
308
+ if (toolName === BASH_TOOL) {
309
+ const cmd = (toolInput.command || '');
310
+ if (/--no-verify\b/.test(cmd)) {
311
+ deny('BLOCKED: --no-verify bypasses git hooks. Remove it and let the hooks run.');
312
+ process.exit(0);
313
+ }
314
+ if (/\bgit\s+push\b.*--force\b/.test(cmd) && !/--force-with-lease\b/.test(cmd)) {
315
+ deny('BLOCKED: git push --force can destroy remote history. Use --force-with-lease or ask Parker.');
316
+ process.exit(0);
317
+ }
318
+
319
+ // Block npm install -g right after a release (#73)
320
+ // wip-release writes ~/.ldm/state/.last-release on completion.
321
+ // If a release happened < 5 minutes ago, block install unless user explicitly said "install".
322
+ if (/\bnpm\s+install\s+-g\b/.test(cmd)) {
323
+ try {
324
+ const releasePath = join(process.env.HOME || '', '.ldm', 'state', '.last-release');
325
+ if (existsSync(releasePath)) {
326
+ const data = JSON.parse(readFileSync(releasePath, 'utf8'));
327
+ const age = Date.now() - new Date(data.timestamp).getTime();
328
+ if (age < 5 * 60 * 1000) { // 5 minutes
329
+ deny(`BLOCKED: Release completed ${Math.round(age / 1000)}s ago. Dogfood first. Remove ~/.ldm/state/.last-release when ready to install.`);
330
+ process.exit(0);
331
+ }
332
+ }
333
+ } catch {}
334
+ }
335
+
336
+ // Warn when creating worktrees outside .worktrees/ (#212)
337
+ const wtMatch = cmd.match(/\bgit\s+worktree\s+add\s+["']?([^\s"']+)/);
338
+ if (wtMatch) {
339
+ const wtPath = wtMatch[1];
340
+ if (!wtPath.includes('.worktrees')) {
341
+ deny(`WARNING: Creating worktree outside .worktrees/. Use: ldm worktree add <branch>
342
+
343
+ The convention is .worktrees/<repo>--<branch>/ so worktrees are hidden and don't mix with real repos.
344
+ Manual equivalent: git worktree add .worktrees/<repo>--<branch> -b <branch>
345
+
346
+ This is a warning, not a block. If you need to create it here, retry.`);
347
+ process.exit(0);
348
+ }
349
+ }
350
+ }
351
+
352
+ // Determine which repo to check.
353
+ // Claude Code always opens in .openclaw, but edits files in other repos.
354
+ // We need to check the branch of THE REPO THE FILE LIVES IN, not the CWD.
355
+ const filePath = toolInput.file_path || toolInput.filePath || '';
356
+ const command = toolInput.command || '';
357
+
358
+ // For Write/Edit: derive repo from the file path
359
+ // For Bash: try to extract repo path from the command (cd, or file paths in args)
360
+ let repoDir = null;
361
+
362
+ if (filePath) {
363
+ // Walk up from file path to find .git directory
364
+ repoDir = findRepoRoot(filePath);
365
+ if (!repoDir) {
366
+ // File is outside any git repo (e.g. ~/.claude/plans/, /tmp/).
367
+ // The guard only protects git repos. Allow it.
368
+ process.exit(0);
369
+ }
370
+ }
371
+
372
+ if (!repoDir && command) {
373
+ // Try to extract a path from the bash command
374
+ // Common patterns: cd "/path/to/repo" && ..., or paths in arguments
375
+ const cdMatch = command.match(/cd\s+["']?([^"'&|;]+?)["']?\s*(?:&&|;|$)/);
376
+ if (cdMatch) {
377
+ repoDir = findRepoRoot(cdMatch[1].trim());
378
+ }
379
+ // Also check for git -C /path/to/repo
380
+ const gitCMatch = command.match(/git\s+-C\s+["']?([^"'&|;]+?)["']?\s/);
381
+ if (!repoDir && gitCMatch) {
382
+ repoDir = findRepoRoot(gitCMatch[1].trim());
383
+ }
384
+ // Extract absolute paths from the command itself (handles mkdir, cp, mv, etc.)
385
+ if (!repoDir) {
386
+ const paths = extractPathsFromCommand(command);
387
+ for (const p of paths) {
388
+ const resolved = findRepoRoot(p);
389
+ if (resolved) {
390
+ repoDir = resolved;
391
+ break;
392
+ }
393
+ }
394
+ }
395
+ }
396
+
397
+ // Fall back to CWD
398
+ if (!repoDir) {
399
+ repoDir = process.env.CWD || process.cwd();
400
+ }
401
+
402
+ // Check if the target repo is on main AND if we're in a worktree
403
+ const branch = getCurrentBranch(repoDir);
404
+ const worktree = isInWorktree(repoDir);
405
+
406
+ if (!branch) {
407
+ // Not in a git repo, allow
408
+ process.exit(0);
409
+ }
410
+
411
+ if (branch !== 'main' && branch !== 'master' && worktree) {
412
+ // On a branch AND in a worktree. Correct workflow. Allow.
413
+ process.exit(0);
414
+ }
415
+
416
+ if (branch !== 'main' && branch !== 'master' && !worktree) {
417
+ // On a branch but NOT in a worktree. Block writes.
418
+ const isWriteOp = WRITE_TOOLS.has(toolName) ||
419
+ (toolName === BASH_TOOL && command &&
420
+ isBlockedCompoundCommand(command, BLOCKED_BASH_PATTERNS, ALLOWED_BASH_PATTERNS));
421
+ if (isWriteOp) {
422
+ deny(`BLOCKED: On branch "${branch}" but not in a worktree.\n\n${WORKFLOW_NOT_WORKTREE}`);
423
+ process.exit(0);
424
+ }
425
+ process.exit(0);
426
+ }
427
+
428
+ // We're on main. Check if this is a shared state file (always writable).
429
+ // These are not code. They're shared context between agents.
430
+ const SHARED_STATE_PATTERNS = [
431
+ /CLAUDE\.md$/,
432
+ /workspace\/SHARED-CONTEXT\.md$/,
433
+ /workspace\/TOOLS\.md$/,
434
+ /workspace\/MEMORY\.md$/,
435
+ /workspace\/IDENTITY\.md$/,
436
+ /workspace\/SOUL\.md$/,
437
+ /workspace\/WHERE-TO-WRITE\.md$/,
438
+ /workspace\/HEARTBEAT\.md$/,
439
+ /workspace\/memory\/.*\.md$/,
440
+ /\.ldm\/agents\/.*\/memory\/daily\/.*\.md$/,
441
+ /\.ldm\/memory\/shared-log\.jsonl$/,
442
+ /\.ldm\/memory\/daily\/.*\.md$/,
443
+ /\.ldm\/logs\//,
444
+ /\.claude\/plans\//, // Claude Code plan files (plan mode)
445
+ ];
446
+
447
+ if (filePath && SHARED_STATE_PATTERNS.some(p => p.test(filePath))) {
448
+ process.exit(0); // Shared state, always allow
449
+ }
450
+
451
+ // Block Write/Edit tools entirely on main
452
+ if (WRITE_TOOLS.has(toolName)) {
453
+ deny(`BLOCKED: Cannot ${toolName} while on main branch.\n\n${WORKFLOW_ON_MAIN}`);
454
+ process.exit(0);
455
+ }
456
+
457
+ // For Bash, check each command segment independently (#232).
458
+ // No fast-path: an allowed pattern on one segment can't excuse a blocked pattern on another.
459
+ if (toolName === BASH_TOOL && command) {
460
+ // Check for blocked git commands (per-segment, quote-stripped)
461
+ if (isBlockedCompoundCommand(command, BLOCKED_GIT_PATTERNS, ALLOWED_GIT_PATTERNS)) {
462
+ deny(`BLOCKED: Cannot run "${command.substring(0, 60)}..." on main branch.\n\n${WORKFLOW_ON_MAIN}`);
463
+ process.exit(0);
464
+ }
465
+
466
+ // Check for file-writing bash commands (per-segment, quote-stripped)
467
+ if (isBlockedCompoundCommand(command, BLOCKED_BASH_PATTERNS, ALLOWED_BASH_PATTERNS)) {
468
+ deny(`BLOCKED: Cannot run file-modifying command on main branch.\n\n${WORKFLOW_ON_MAIN}`);
469
+ process.exit(0);
470
+ }
471
+ }
472
+
473
+ // Allow everything else (Read, Glob, Grep, Agent, etc.)
474
+ process.exit(0);
475
+ }
476
+
477
+ main().catch(() => process.exit(0));
@@ -0,0 +1,18 @@
1
+ {
2
+ "name": "@wipcomputer/wip-branch-guard",
3
+ "version": "1.9.26",
4
+ "description": "PreToolUse hook that blocks all writes on main branch. Forces agents to work on branches or worktrees.",
5
+ "type": "module",
6
+ "main": "guard.mjs",
7
+ "bin": {
8
+ "wip-branch-guard": "guard.mjs"
9
+ },
10
+ "claudeCode": {
11
+ "hook": {
12
+ "event": "PreToolUse",
13
+ "matcher": "Write|Edit|NotebookEdit|Bash",
14
+ "timeout": 5
15
+ }
16
+ },
17
+ "license": "MIT"
18
+ }
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## 1.0.1 (2026-02-21)
4
+
5
+ Align description, add SKILL.md, add badges, agent-driven install, REFERENCE.md
6
+