bigpowers 2.87.3 → 2.87.5

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 (259) hide show
  1. package/.cursor/rules/align-grid.mdc +109 -0
  2. package/.cursor/rules/assess-impact.mdc +90 -0
  3. package/.cursor/rules/audit-code.mdc +183 -0
  4. package/.cursor/rules/audit-plan.mdc +88 -0
  5. package/.cursor/rules/build-epic.mdc +104 -0
  6. package/.cursor/rules/change-request.mdc +120 -0
  7. package/.cursor/rules/commit-message.mdc +139 -0
  8. package/.cursor/rules/compose-workflow.mdc +81 -0
  9. package/.cursor/rules/context7-mcp.mdc +54 -0
  10. package/.cursor/rules/craft-skill.mdc +195 -0
  11. package/.cursor/rules/deepen-architecture.mdc +259 -0
  12. package/.cursor/rules/define-language.mdc +79 -0
  13. package/.cursor/rules/define-success.mdc +11 -0
  14. package/.cursor/rules/delegate-task.mdc +90 -0
  15. package/.cursor/rules/deploy.mdc +197 -0
  16. package/.cursor/rules/design-interface.mdc +96 -0
  17. package/.cursor/rules/develop-tdd.mdc +415 -0
  18. package/.cursor/rules/diagnose-root.mdc +23 -0
  19. package/.cursor/rules/diagnose-stall.mdc +53 -0
  20. package/.cursor/rules/dispatch-agents.mdc +117 -0
  21. package/.cursor/rules/edit-document.mdc +22 -0
  22. package/.cursor/rules/elaborate-spec.mdc +100 -0
  23. package/.cursor/rules/enforce-first.mdc +44 -0
  24. package/.cursor/rules/evolve-skill.mdc +54 -0
  25. package/.cursor/rules/execute-plan.mdc +60 -0
  26. package/.cursor/rules/extract-design.mdc +131 -0
  27. package/.cursor/rules/find-way.mdc +190 -0
  28. package/.cursor/rules/fix-bug.mdc +66 -0
  29. package/.cursor/rules/gate-trace.mdc +91 -0
  30. package/.cursor/rules/generate-allure-report.mdc +284 -0
  31. package/.cursor/rules/grill-me.mdc +107 -0
  32. package/.cursor/rules/grill-with-docs.mdc +52 -0
  33. package/.cursor/rules/guard-git.mdc +230 -0
  34. package/.cursor/rules/harden-vps.mdc +290 -0
  35. package/.cursor/rules/hook-commits.mdc +93 -0
  36. package/.cursor/rules/inspect-quality.mdc +105 -0
  37. package/.cursor/rules/investigate-bug.mdc +126 -0
  38. package/.cursor/rules/kickoff-branch.mdc +142 -0
  39. package/.cursor/rules/maintain-wiki.mdc +63 -0
  40. package/.cursor/rules/map-codebase.mdc +70 -0
  41. package/.cursor/rules/migrate-spec.mdc +907 -0
  42. package/.cursor/rules/model-domain.mdc +231 -0
  43. package/.cursor/rules/orchestrate-project.mdc +173 -0
  44. package/.cursor/rules/organize-workspace.mdc +163 -0
  45. package/.cursor/rules/plan-refactor.mdc +86 -0
  46. package/.cursor/rules/plan-release.mdc +144 -0
  47. package/.cursor/rules/plan-tests.mdc +74 -0
  48. package/.cursor/rules/plan-work.mdc +271 -0
  49. package/.cursor/rules/publish-package.mdc +337 -0
  50. package/.cursor/rules/quick-fix.mdc +113 -0
  51. package/.cursor/rules/release-branch.mdc +301 -0
  52. package/.cursor/rules/request-review.mdc +112 -0
  53. package/.cursor/rules/research-first.mdc +86 -0
  54. package/.cursor/rules/reset-baseline.mdc +20 -0
  55. package/.cursor/rules/respond-review.mdc +70 -0
  56. package/.cursor/rules/run-benchmark.mdc +84 -0
  57. package/.cursor/rules/run-evals.mdc +79 -0
  58. package/.cursor/rules/run-planning.mdc +100 -0
  59. package/.cursor/rules/scope-work.mdc +62 -0
  60. package/.cursor/rules/search-skills.mdc +72 -0
  61. package/.cursor/rules/security-review.mdc +383 -0
  62. package/.cursor/rules/seed-conventions.mdc +311 -0
  63. package/.cursor/rules/session-state.mdc +145 -0
  64. package/.cursor/rules/setup-environment.mdc +38 -0
  65. package/.cursor/rules/simple-english.mdc +345 -0
  66. package/.cursor/rules/simulate-agents.mdc +25 -0
  67. package/.cursor/rules/slice-tasks.mdc +67 -0
  68. package/.cursor/rules/smoke-test.mdc +260 -0
  69. package/.cursor/rules/spike-prototype.mdc +94 -0
  70. package/.cursor/rules/stocktake-skills.mdc +73 -0
  71. package/.cursor/rules/survey-context.mdc +134 -0
  72. package/.cursor/rules/terse-mode.mdc +41 -0
  73. package/.cursor/rules/trace-requirement.mdc +68 -0
  74. package/.cursor/rules/using-bigpowers.mdc +110 -0
  75. package/.cursor/rules/validate-contracts.mdc +285 -0
  76. package/.cursor/rules/validate-fix.mdc +146 -0
  77. package/.cursor/rules/verify-work.mdc +190 -0
  78. package/.cursor/rules/visual-dashboard.mdc +49 -0
  79. package/.cursor/rules/wire-ci.mdc +380 -0
  80. package/.cursor/rules/wire-observability.mdc +96 -0
  81. package/.cursor/rules/write-document.mdc +280 -0
  82. package/.gemini/extensions/bigpowers/commands/prompts/align-grid.md +109 -0
  83. package/.gemini/extensions/bigpowers/commands/prompts/assess-impact.md +90 -0
  84. package/.gemini/extensions/bigpowers/commands/prompts/audit-code.md +183 -0
  85. package/.gemini/extensions/bigpowers/commands/prompts/audit-plan.md +88 -0
  86. package/.gemini/extensions/bigpowers/commands/prompts/build-epic.md +104 -0
  87. package/.gemini/extensions/bigpowers/commands/prompts/change-request.md +120 -0
  88. package/.gemini/extensions/bigpowers/commands/prompts/commit-message.md +139 -0
  89. package/.gemini/extensions/bigpowers/commands/prompts/compose-workflow.md +81 -0
  90. package/.gemini/extensions/bigpowers/commands/prompts/context7-mcp.md +54 -0
  91. package/.gemini/extensions/bigpowers/commands/prompts/craft-skill.md +195 -0
  92. package/.gemini/extensions/bigpowers/commands/prompts/deepen-architecture.md +259 -0
  93. package/.gemini/extensions/bigpowers/commands/prompts/define-language.md +79 -0
  94. package/.gemini/extensions/bigpowers/commands/prompts/define-success.md +11 -0
  95. package/.gemini/extensions/bigpowers/commands/prompts/delegate-task.md +90 -0
  96. package/.gemini/extensions/bigpowers/commands/prompts/deploy.md +197 -0
  97. package/.gemini/extensions/bigpowers/commands/prompts/design-interface.md +96 -0
  98. package/.gemini/extensions/bigpowers/commands/prompts/develop-tdd.md +415 -0
  99. package/.gemini/extensions/bigpowers/commands/prompts/diagnose-root.md +23 -0
  100. package/.gemini/extensions/bigpowers/commands/prompts/diagnose-stall.md +53 -0
  101. package/.gemini/extensions/bigpowers/commands/prompts/dispatch-agents.md +117 -0
  102. package/.gemini/extensions/bigpowers/commands/prompts/edit-document.md +22 -0
  103. package/.gemini/extensions/bigpowers/commands/prompts/elaborate-spec.md +100 -0
  104. package/.gemini/extensions/bigpowers/commands/prompts/enforce-first.md +44 -0
  105. package/.gemini/extensions/bigpowers/commands/prompts/evolve-skill.md +54 -0
  106. package/.gemini/extensions/bigpowers/commands/prompts/execute-plan.md +60 -0
  107. package/.gemini/extensions/bigpowers/commands/prompts/extract-design.md +131 -0
  108. package/.gemini/extensions/bigpowers/commands/prompts/find-way.md +190 -0
  109. package/.gemini/extensions/bigpowers/commands/prompts/fix-bug.md +66 -0
  110. package/.gemini/extensions/bigpowers/commands/prompts/gate-trace.md +91 -0
  111. package/.gemini/extensions/bigpowers/commands/prompts/generate-allure-report.md +284 -0
  112. package/.gemini/extensions/bigpowers/commands/prompts/grill-me.md +107 -0
  113. package/.gemini/extensions/bigpowers/commands/prompts/grill-with-docs.md +52 -0
  114. package/.gemini/extensions/bigpowers/commands/prompts/guard-git.md +230 -0
  115. package/.gemini/extensions/bigpowers/commands/prompts/harden-vps.md +290 -0
  116. package/.gemini/extensions/bigpowers/commands/prompts/hook-commits.md +93 -0
  117. package/.gemini/extensions/bigpowers/commands/prompts/inspect-quality.md +105 -0
  118. package/.gemini/extensions/bigpowers/commands/prompts/investigate-bug.md +126 -0
  119. package/.gemini/extensions/bigpowers/commands/prompts/kickoff-branch.md +142 -0
  120. package/.gemini/extensions/bigpowers/commands/prompts/maintain-wiki.md +63 -0
  121. package/.gemini/extensions/bigpowers/commands/prompts/map-codebase.md +70 -0
  122. package/.gemini/extensions/bigpowers/commands/prompts/migrate-spec.md +907 -0
  123. package/.gemini/extensions/bigpowers/commands/prompts/model-domain.md +231 -0
  124. package/.gemini/extensions/bigpowers/commands/prompts/orchestrate-project.md +173 -0
  125. package/.gemini/extensions/bigpowers/commands/prompts/organize-workspace.md +163 -0
  126. package/.gemini/extensions/bigpowers/commands/prompts/plan-refactor.md +86 -0
  127. package/.gemini/extensions/bigpowers/commands/prompts/plan-release.md +144 -0
  128. package/.gemini/extensions/bigpowers/commands/prompts/plan-tests.md +74 -0
  129. package/.gemini/extensions/bigpowers/commands/prompts/plan-work.md +271 -0
  130. package/.gemini/extensions/bigpowers/commands/prompts/publish-package.md +337 -0
  131. package/.gemini/extensions/bigpowers/commands/prompts/quick-fix.md +113 -0
  132. package/.gemini/extensions/bigpowers/commands/prompts/release-branch.md +301 -0
  133. package/.gemini/extensions/bigpowers/commands/prompts/request-review.md +112 -0
  134. package/.gemini/extensions/bigpowers/commands/prompts/research-first.md +86 -0
  135. package/.gemini/extensions/bigpowers/commands/prompts/reset-baseline.md +20 -0
  136. package/.gemini/extensions/bigpowers/commands/prompts/respond-review.md +70 -0
  137. package/.gemini/extensions/bigpowers/commands/prompts/run-benchmark.md +84 -0
  138. package/.gemini/extensions/bigpowers/commands/prompts/run-evals.md +79 -0
  139. package/.gemini/extensions/bigpowers/commands/prompts/run-planning.md +100 -0
  140. package/.gemini/extensions/bigpowers/commands/prompts/scope-work.md +62 -0
  141. package/.gemini/extensions/bigpowers/commands/prompts/search-skills.md +72 -0
  142. package/.gemini/extensions/bigpowers/commands/prompts/security-review.md +383 -0
  143. package/.gemini/extensions/bigpowers/commands/prompts/seed-conventions.md +311 -0
  144. package/.gemini/extensions/bigpowers/commands/prompts/session-state.md +145 -0
  145. package/.gemini/extensions/bigpowers/commands/prompts/setup-environment.md +38 -0
  146. package/.gemini/extensions/bigpowers/commands/prompts/simple-english.md +345 -0
  147. package/.gemini/extensions/bigpowers/commands/prompts/simulate-agents.md +25 -0
  148. package/.gemini/extensions/bigpowers/commands/prompts/slice-tasks.md +67 -0
  149. package/.gemini/extensions/bigpowers/commands/prompts/smoke-test.md +260 -0
  150. package/.gemini/extensions/bigpowers/commands/prompts/spike-prototype.md +94 -0
  151. package/.gemini/extensions/bigpowers/commands/prompts/stocktake-skills.md +73 -0
  152. package/.gemini/extensions/bigpowers/commands/prompts/survey-context.md +134 -0
  153. package/.gemini/extensions/bigpowers/commands/prompts/terse-mode.md +41 -0
  154. package/.gemini/extensions/bigpowers/commands/prompts/trace-requirement.md +68 -0
  155. package/.gemini/extensions/bigpowers/commands/prompts/using-bigpowers.md +110 -0
  156. package/.gemini/extensions/bigpowers/commands/prompts/validate-contracts.md +285 -0
  157. package/.gemini/extensions/bigpowers/commands/prompts/validate-fix.md +146 -0
  158. package/.gemini/extensions/bigpowers/commands/prompts/verify-work.md +190 -0
  159. package/.gemini/extensions/bigpowers/commands/prompts/visual-dashboard.md +49 -0
  160. package/.gemini/extensions/bigpowers/commands/prompts/wire-ci.md +380 -0
  161. package/.gemini/extensions/bigpowers/commands/prompts/wire-observability.md +96 -0
  162. package/.gemini/extensions/bigpowers/commands/prompts/write-document.md +280 -0
  163. package/.gemini/extensions/bigpowers/gemini-extension.json +16 -0
  164. package/.gemini/extensions/bigpowers/hooks/HOOKS.md +43 -0
  165. package/.gemini/extensions/bigpowers/hooks/before-tool-git-guard.sh +26 -0
  166. package/.gemini/extensions/bigpowers/hooks/before-tool-rtk.sh +14 -0
  167. package/.gemini/extensions/bigpowers/hooks/before-tool-token-mgmt.sh +19 -0
  168. package/.gemini/extensions/bigpowers/hooks/hooks-manifest.json +36 -0
  169. package/.gemini/extensions/bigpowers/hooks/run-hook.cmd +29 -0
  170. package/.gemini/extensions/bigpowers/hooks/session-start +48 -0
  171. package/.gemini/extensions/bigpowers/hooks/settings.json.example +41 -0
  172. package/.gemini/extensions/bigpowers/skills/align-grid/SKILL.md +111 -0
  173. package/.gemini/extensions/bigpowers/skills/assess-impact/SKILL.md +92 -0
  174. package/.gemini/extensions/bigpowers/skills/audit-code/SKILL.md +185 -0
  175. package/.gemini/extensions/bigpowers/skills/audit-plan/SKILL.md +90 -0
  176. package/.gemini/extensions/bigpowers/skills/build-epic/SKILL.md +106 -0
  177. package/.gemini/extensions/bigpowers/skills/change-request/SKILL.md +122 -0
  178. package/.gemini/extensions/bigpowers/skills/commit-message/SKILL.md +141 -0
  179. package/.gemini/extensions/bigpowers/skills/compose-workflow/SKILL.md +83 -0
  180. package/.gemini/extensions/bigpowers/skills/context7-mcp/SKILL.md +56 -0
  181. package/.gemini/extensions/bigpowers/skills/craft-skill/SKILL.md +197 -0
  182. package/.gemini/extensions/bigpowers/skills/deepen-architecture/SKILL.md +261 -0
  183. package/.gemini/extensions/bigpowers/skills/define-language/SKILL.md +81 -0
  184. package/.gemini/extensions/bigpowers/skills/define-success/SKILL.md +13 -0
  185. package/.gemini/extensions/bigpowers/skills/delegate-task/SKILL.md +92 -0
  186. package/.gemini/extensions/bigpowers/skills/deploy/SKILL.md +199 -0
  187. package/.gemini/extensions/bigpowers/skills/design-interface/SKILL.md +98 -0
  188. package/.gemini/extensions/bigpowers/skills/develop-tdd/SKILL.md +417 -0
  189. package/.gemini/extensions/bigpowers/skills/diagnose-root/SKILL.md +25 -0
  190. package/.gemini/extensions/bigpowers/skills/diagnose-stall/SKILL.md +55 -0
  191. package/.gemini/extensions/bigpowers/skills/dispatch-agents/SKILL.md +119 -0
  192. package/.gemini/extensions/bigpowers/skills/edit-document/SKILL.md +24 -0
  193. package/.gemini/extensions/bigpowers/skills/elaborate-spec/SKILL.md +102 -0
  194. package/.gemini/extensions/bigpowers/skills/enforce-first/SKILL.md +46 -0
  195. package/.gemini/extensions/bigpowers/skills/evolve-skill/SKILL.md +56 -0
  196. package/.gemini/extensions/bigpowers/skills/execute-plan/SKILL.md +62 -0
  197. package/.gemini/extensions/bigpowers/skills/extract-design/SKILL.md +133 -0
  198. package/.gemini/extensions/bigpowers/skills/find-way/SKILL.md +192 -0
  199. package/.gemini/extensions/bigpowers/skills/fix-bug/SKILL.md +68 -0
  200. package/.gemini/extensions/bigpowers/skills/gate-trace/SKILL.md +93 -0
  201. package/.gemini/extensions/bigpowers/skills/generate-allure-report/SKILL.md +286 -0
  202. package/.gemini/extensions/bigpowers/skills/grill-me/SKILL.md +109 -0
  203. package/.gemini/extensions/bigpowers/skills/grill-with-docs/SKILL.md +54 -0
  204. package/.gemini/extensions/bigpowers/skills/guard-git/SKILL.md +232 -0
  205. package/.gemini/extensions/bigpowers/skills/harden-vps/SKILL.md +292 -0
  206. package/.gemini/extensions/bigpowers/skills/hook-commits/SKILL.md +95 -0
  207. package/.gemini/extensions/bigpowers/skills/inspect-quality/SKILL.md +107 -0
  208. package/.gemini/extensions/bigpowers/skills/investigate-bug/SKILL.md +128 -0
  209. package/.gemini/extensions/bigpowers/skills/kickoff-branch/SKILL.md +144 -0
  210. package/.gemini/extensions/bigpowers/skills/maintain-wiki/SKILL.md +65 -0
  211. package/.gemini/extensions/bigpowers/skills/map-codebase/SKILL.md +72 -0
  212. package/.gemini/extensions/bigpowers/skills/migrate-spec/SKILL.md +909 -0
  213. package/.gemini/extensions/bigpowers/skills/model-domain/SKILL.md +233 -0
  214. package/.gemini/extensions/bigpowers/skills/orchestrate-project/SKILL.md +175 -0
  215. package/.gemini/extensions/bigpowers/skills/organize-workspace/SKILL.md +165 -0
  216. package/.gemini/extensions/bigpowers/skills/plan-refactor/SKILL.md +88 -0
  217. package/.gemini/extensions/bigpowers/skills/plan-release/SKILL.md +146 -0
  218. package/.gemini/extensions/bigpowers/skills/plan-tests/SKILL.md +76 -0
  219. package/.gemini/extensions/bigpowers/skills/plan-work/SKILL.md +273 -0
  220. package/.gemini/extensions/bigpowers/skills/publish-package/SKILL.md +339 -0
  221. package/.gemini/extensions/bigpowers/skills/quick-fix/SKILL.md +115 -0
  222. package/.gemini/extensions/bigpowers/skills/release-branch/SKILL.md +303 -0
  223. package/.gemini/extensions/bigpowers/skills/request-review/SKILL.md +114 -0
  224. package/.gemini/extensions/bigpowers/skills/research-first/SKILL.md +88 -0
  225. package/.gemini/extensions/bigpowers/skills/reset-baseline/SKILL.md +22 -0
  226. package/.gemini/extensions/bigpowers/skills/respond-review/SKILL.md +72 -0
  227. package/.gemini/extensions/bigpowers/skills/run-benchmark/SKILL.md +86 -0
  228. package/.gemini/extensions/bigpowers/skills/run-evals/SKILL.md +81 -0
  229. package/.gemini/extensions/bigpowers/skills/run-planning/SKILL.md +102 -0
  230. package/.gemini/extensions/bigpowers/skills/scope-work/SKILL.md +64 -0
  231. package/.gemini/extensions/bigpowers/skills/search-skills/SKILL.md +74 -0
  232. package/.gemini/extensions/bigpowers/skills/security-review/SKILL.md +385 -0
  233. package/.gemini/extensions/bigpowers/skills/seed-conventions/SKILL.md +313 -0
  234. package/.gemini/extensions/bigpowers/skills/session-state/SKILL.md +147 -0
  235. package/.gemini/extensions/bigpowers/skills/setup-environment/SKILL.md +40 -0
  236. package/.gemini/extensions/bigpowers/skills/simple-english/SKILL.md +347 -0
  237. package/.gemini/extensions/bigpowers/skills/simulate-agents/SKILL.md +27 -0
  238. package/.gemini/extensions/bigpowers/skills/slice-tasks/SKILL.md +69 -0
  239. package/.gemini/extensions/bigpowers/skills/smoke-test/SKILL.md +262 -0
  240. package/.gemini/extensions/bigpowers/skills/spike-prototype/SKILL.md +96 -0
  241. package/.gemini/extensions/bigpowers/skills/stocktake-skills/SKILL.md +75 -0
  242. package/.gemini/extensions/bigpowers/skills/survey-context/SKILL.md +136 -0
  243. package/.gemini/extensions/bigpowers/skills/terse-mode/SKILL.md +43 -0
  244. package/.gemini/extensions/bigpowers/skills/trace-requirement/SKILL.md +70 -0
  245. package/.gemini/extensions/bigpowers/skills/using-bigpowers/SKILL.md +112 -0
  246. package/.gemini/extensions/bigpowers/skills/validate-contracts/SKILL.md +287 -0
  247. package/.gemini/extensions/bigpowers/skills/validate-fix/SKILL.md +148 -0
  248. package/.gemini/extensions/bigpowers/skills/verify-work/SKILL.md +192 -0
  249. package/.gemini/extensions/bigpowers/skills/visual-dashboard/SKILL.md +51 -0
  250. package/.gemini/extensions/bigpowers/skills/wire-ci/SKILL.md +382 -0
  251. package/.gemini/extensions/bigpowers/skills/wire-observability/SKILL.md +98 -0
  252. package/.gemini/extensions/bigpowers/skills/write-document/SKILL.md +282 -0
  253. package/.pi/package.json +1 -1
  254. package/CHANGELOG.md +14 -0
  255. package/package.json +1 -1
  256. package/scripts/lib/__pycache__/link_utils.cpython-312.pyc +0 -0
  257. package/scripts/lib/__pycache__/srp_engine_links.cpython-312.pyc +0 -0
  258. package/scripts/lib/install-helpers.js +147 -20
  259. package/scripts/test-install-helpers.js +141 -0
@@ -0,0 +1,230 @@
1
+ ---
2
+ name: guard-git
3
+ description: "Block dangerous git commands (push, force push, reset --hard, clean, branch -D, checkout/restore .) and enforce Conventional Commits & Branch Protection before an AI agent runs them. Installs hook scripts for Claude Code, Cursor, Cursor CLI, and Gemini CLI; documents Google Antigravity Terminal deny lists. Use when the user wants git safety hooks, to block git push or destructive git in agents, or to mirror the same policy across AI coding tools."
4
+ ---
5
+
6
+ # Guard Git
7
+ > **HARD GATE** — **HARD GATE** — Before committing, verify: branch is not main/master, author is correct, git user is configured. Bad commits are hard to fix.
8
+
9
+
10
+ Installs a shared hook that blocks destructive git operations and enforces workflow discipline. **Requires `jq` on the agent's PATH** when the hook runs.
11
+
12
+ ## What gets blocked/enforced
13
+
14
+ - **Safety**: `git push --force`, `git reset --hard`, `git clean -f`, `git branch -D`, `git checkout .`, `git restore .`.
15
+ - **Discipline**: Blocks direct commits or pushes to protected branches (`main`, `master`) unless `GIT_BIGPOWERS_LAND=1` (set only by `scripts/land-branch.sh`).
16
+ - **Allows**: `git push origin <feature-branch>` for backup/CI; solo land push to `main` only inside `land-branch.sh`.
17
+ - **Standardization**: Enforces [Conventional Commits](https://www.conventionalcommits.org/) for all `git commit` commands.
18
+ - **Secrets**: Blocks commits containing common secret patterns (`sk-`, `ghp_`, `AKIA`, `xoxb-`, `-----BEGIN` private keys) — see [REFERENCE.md](REFERENCE.md).
19
+
20
+ ## Quick start
21
+
22
+ 1. **Scope**: ask project-only vs global (paths differ per product).
23
+ 2. **Write the hook bundle** from [REFERENCE.md](REFERENCE.md) into the client's hooks directory.
24
+ 3. **Run `chmod +x`** on `pre-tool-use.sh`.
25
+ 4. **Merge** the hook snippet from [REFERENCE.md](REFERENCE.md) into the right settings file — do not wipe unrelated keys.
26
+ 5. **Verify** with the tests in [REFERENCE.md](REFERENCE.md).
27
+
28
+ | Client | Mechanism | Config |
29
+ |--------|-----------|--------|
30
+ | Claude Code | `PreToolUse` (Bash) | `.claude/settings.json` or `~/.claude/settings.json` |
31
+ | Cursor / Cursor CLI | `beforeShellExecution` | `.cursor/hooks.json` or `~/.cursor/hooks.json` |
32
+ | Gemini CLI | `BeforeTool` + `run_shell_command` | `.gemini/settings.json` or `~/.gemini/settings.json` |
33
+ | Google Antigravity | Built-in Terminal **Deny list** | Settings UI (no shell hook) |
34
+
35
+ **Modes (env on the hook command):** `GIT_GUARDRAILS_MODE` is `claude` (default) or `cursor` → stderr + exit `2` on block. Set `gemini` for Gemini CLI → JSON `decision` on stdout.
36
+
37
+ ## Customization
38
+
39
+ To add or remove patterns or protected branches, edit `pre-tool-use.sh`.
40
+
41
+ ## Advanced
42
+
43
+ Full JSON examples, merge rules, Antigravity deny-list entries, and test commands: [REFERENCE.md](REFERENCE.md).
44
+
45
+
46
+
47
+ <!-- story: e01s03 -->
48
+
49
+ ---
50
+
51
+ # Git guardrails — reference
52
+
53
+ ## Navigation
54
+
55
+ | Lines | Section |
56
+ |-------|---------|
57
+ | 1 | Title |
58
+ | 3–16 | Navigation |
59
+ | 17–28 | Secret patterns (audit + pre-commit) |
60
+ | 29–46 | Copy layout |
61
+ | 47–72 | Claude Code |
62
+ | 73–94 | Cursor and Cursor CLI |
63
+ | 95–122 | Gemini CLI |
64
+ | 123–137 | Google Antigravity |
65
+ | 138–180 | Verify (local tests) |
66
+
67
+ ## Secret patterns (audit + pre-commit)
68
+
69
+ Agents must not commit files containing:
70
+
71
+ - `sk-` (OpenAI API keys)
72
+ - `ghp_` / `gho_` (GitHub tokens)
73
+ - `AKIA` (AWS access key id)
74
+ - `xoxb-` (Slack bot tokens)
75
+ - `-----BEGIN` private keys
76
+
77
+ Use `audit-code` supply-chain checklist before commit. Consider `git-secrets` or custom pre-commit hook in target projects.
78
+
79
+ ## Copy layout
80
+
81
+ The main script is `pre-tool-use.sh`.
82
+
83
+ ```text
84
+ <hooks-dir>/pre-tool-use.sh
85
+ ```
86
+
87
+ Example project locations:
88
+
89
+ - Claude: `.claude/hooks/`
90
+ - Cursor: `.cursor/hooks/`
91
+ - Gemini: `.gemini/hooks/`
92
+
93
+ Use the same layout for user-level hooks (`~/.claude/hooks`, `~/.cursor/hooks`, `~/.gemini/hooks`).
94
+
95
+ ---
96
+
97
+ ## Claude Code
98
+
99
+ Hook command does **not** need `GIT_GUARDRAILS_MODE` (defaults to `claude`).
100
+
101
+ **Project** (`.claude/settings.json`):
102
+
103
+ ```json
104
+ {
105
+ "hooks": {
106
+ "PreToolUse": [
107
+ {
108
+ "matcher": "Bash",
109
+ "hooks": [
110
+ {
111
+ "type": "command",
112
+ "command": "\"$CLAUDE_PROJECT_DIR\"/.claude/hooks/pre-tool-use.sh"
113
+ }
114
+ ]
115
+ }
116
+ ]
117
+ }
118
+ }
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Cursor and Cursor CLI
124
+
125
+ Use `beforeShellExecution`. Set `GIT_GUARDRAILS_MODE=cursor`.
126
+
127
+ **Project** (`.cursor/hooks.json`):
128
+
129
+ ```json
130
+ {
131
+ "version": 1,
132
+ "hooks": {
133
+ "beforeShellExecution": [
134
+ {
135
+ "command": "GIT_GUARDRAILS_MODE=cursor .cursor/hooks/pre-tool-use.sh",
136
+ "matcher": "git"
137
+ }
138
+ ]
139
+ }
140
+ }
141
+ ```
142
+
143
+ ---
144
+
145
+ ## Gemini CLI
146
+
147
+ Use `BeforeTool` with matcher `run_shell_command`. Set **`GIT_GUARDRAILS_MODE=gemini`**.
148
+
149
+ **Project** (`.gemini/settings.json`):
150
+
151
+ ```json
152
+ {
153
+ "hooks": {
154
+ "BeforeTool": [
155
+ {
156
+ "matcher": "run_shell_command",
157
+ "hooks": [
158
+ {
159
+ "name": "git-guardrails",
160
+ "type": "command",
161
+ "command": "GIT_GUARDRAILS_MODE=gemini \"$GEMINI_PROJECT_DIR\"/.gemini/hooks/pre-tool-use.sh",
162
+ "timeout": 5000
163
+ }
164
+ ]
165
+ }
166
+ ]
167
+ }
168
+ }
169
+ ```
170
+
171
+ ---
172
+
173
+ ## Google Antigravity
174
+
175
+ Add **Deny list** entries in **Antigravity → Settings → Terminal**:
176
+
177
+ - `git push --force`
178
+ - `git push origin main`
179
+ - `git push origin master`
180
+ - `git reset --hard`
181
+ - `git clean`
182
+ - `git branch -D`
183
+ - `git checkout .`
184
+ - `git restore .`
185
+
186
+ ---
187
+
188
+ ## Verify (local tests)
189
+
190
+ **1. Block push to main without land mode (Claude mode):**
191
+ ```bash
192
+ echo '{"tool_input":{"command":"git push origin main"}}' | ./pre-tool-use.sh
193
+ # Expected: exit 2, protected branch message
194
+ ```
195
+
196
+ **2. Allow push to main with GIT_BIGPOWERS_LAND=1:**
197
+ ```bash
198
+ GIT_BIGPOWERS_LAND=1 echo '{"tool_input":{"command":"git push origin main"}}' | ./pre-tool-use.sh
199
+ # Expected: exit 0 (when on main)
200
+ ```
201
+
202
+ **3. Allow push to feature branch:**
203
+ ```bash
204
+ echo '{"tool_input":{"command":"git push -u origin feat/my-task"}}' | ./pre-tool-use.sh
205
+ # Expected: exit 0
206
+ ```
207
+
208
+ **4. Conventional Commits (Gemini mode):**
209
+ ```bash
210
+ echo '{"tool_input":{"command":"git commit -m \"bad message\""}}' | GIT_GUARDRAILS_MODE=gemini ./pre-tool-use.sh
211
+ # Expected: exit 0, {"decision":"deny", "reason":"..."}
212
+ ```
213
+
214
+ **5. Protected Branch commit (Cursor mode):**
215
+ ```bash
216
+ # Run on 'main' branch
217
+ echo '{"command":"git commit -m \"feat: valid message\""}' | GIT_GUARDRAILS_MODE=cursor ./pre-tool-use.sh
218
+ # Expected: exit 2, "Direct commits to protected branch 'main' are forbidden"
219
+ ```
220
+
221
+ **6. Land script exists:**
222
+ ```bash
223
+ test -x scripts/land-branch.sh && echo OK
224
+ ```
225
+
226
+ **7. Allow (Gemini mode):**
227
+ ```bash
228
+ echo '{"tool_input":{"command":"git status"}}' | GIT_GUARDRAILS_MODE=gemini ./pre-tool-use.sh
229
+ # Expected: exit 0, {"decision":"allow"}
230
+ ```
@@ -0,0 +1,290 @@
1
+ ---
2
+ name: harden-vps
3
+ description: "Harden a production Linux VPS for your application across three layers — application (systemd hardening, monitoring alerts, backup automation), Ubuntu OS (UFW firewall, fail2ban SSH, unattended-upgrades, SSH hardening), and VPS provider (health checks, daily backups, monthly snapshots). Use when the user wants to secure a production server, harden a VPS, audit server security, or mentions production hardening, VPS security, or harden the server."
4
+ ---
5
+
6
+ # Harden VPS
7
+
8
+ Three-layer production hardening for a self-hosted app on any VPS. Each layer independently verifiable. Apply OS first (firewall blocks attacks immediately), then your application (alerts + backups), then your VPS provider (snapshots). See [REFERENCE.md](REFERENCE.md) for full script bodies, systemd unit template, and gotchas.
9
+
10
+ ## Quick start
11
+
12
+ SSH as root into the VPS. Find credentials in the your VPS provider Customer Control Panel.
13
+
14
+ > **HARD GATE** — Run `ufw status` first. No firewall = layer 1 takes priority over everything.
15
+
16
+ ## Layer 1 — Ubuntu OS
17
+
18
+ ```bash
19
+ # UFW
20
+ ufw default deny incoming && ufw default allow outgoing
21
+ ufw allow 22/tcp && ufw allow 80/tcp && ufw allow 443/tcp && ufw enable
22
+ # → verify: ufw status | grep -q active
23
+
24
+ # fail2ban
25
+ apt install -y fail2ban
26
+ # Configure /etc/fail2ban/jail.local: sshd, maxretry=3, bantime=3600, findtime=600
27
+ systemctl restart fail2ban
28
+ # → verify: fail2ban-client status sshd
29
+
30
+ # unattended-upgrades
31
+ apt install -y unattended-upgrades && dpkg-reconfigure -plow unattended-upgrades
32
+ # → verify: systemctl is-active unattended-upgrades | grep -q active
33
+
34
+ # SSH: PermitRootLogin no, PasswordAuthentication no, PubkeyAuthentication yes
35
+ # → verify: sshd -T | grep -E 'permitrootlogin no|passwordauthentication no'
36
+
37
+ # Deploy healthcheck.sh → /opt/your-app/scripts/healthcheck.sh
38
+ # Crontab: */5 * * * * /opt/your-app/scripts/healthcheck.sh
39
+ ```
40
+
41
+ ## Layer 2 — applicationlication
42
+
43
+ ```bash
44
+ # systemd: User=your-app, NoNewPrivileges=yes, ProtectSystem=full,
45
+ # ProtectKernelTunables=yes, ProtectKernelModules=yes,
46
+ # ProtectControlGroups=yes, RestrictAddressFamilies=AF_INET AF_INET6,
47
+ # RestrictRealtime=yes, PrivateTmp=yes, LimitNOFILE=65536
48
+ # → verify: systemctl show your-app -p NoNewPrivileges -p ProtectSystem -p User
49
+
50
+ # Alerts (your application requires auth; insert via SQLite)
51
+ sqlite3 /opt/your-app/data/your-app.db "
52
+ INSERT INTO monitoring_alerts (id,name,metric,threshold,operator,enabled,duration_seconds)
53
+ VALUES ('a1','Disk >80%','disk_used_percent',80,'gt',1,300);
54
+ INSERT INTO monitoring_alerts (id,name,metric,threshold,operator,enabled,duration_seconds)
55
+ VALUES ('a2','CPU >90%','cpu_percent',90,'gt',1,60);
56
+ INSERT INTO monitoring_alerts (id,name,metric,threshold,operator,enabled,duration_seconds)
57
+ VALUES ('a3','RAM >85%','mem_used_percent',85,'gt',1,120);
58
+ "
59
+ systemctl restart your-app
60
+
61
+ # Backup crontab (root):
62
+ # 0 2 * * * cp /opt/your-app/data/your-app.db /backup/your-app-$(date +\%Y\%m\%d).db
63
+ # 0 3 * * * find /backup/ -name "your-app-*.db" -mtime +90 -delete
64
+ ```
65
+
66
+ ## Layer 3 — VPS provider
67
+
68
+ ```bash
69
+ # cntb CLI
70
+ curl -sL "$(curl -sL https://api.github.com/repos/contabo/cntb/releases/latest \
71
+ | grep browser_download_url.*linux_amd64.tar.gz | head -1 | cut -d'"' -f4)" \
72
+ | tar xz -C /usr/local/bin
73
+
74
+ # Snapshot script → /opt/your-app/scripts/contabo-snapshot.sh (reads from /opt/your-app/.env)
75
+ # Credentials as env vars in /opt/your-app/.env (deployed by GitHub Actions):
76
+ # CONTABO_CLIENT_ID, CONTABO_CLIENT_SECRET, CONTABO_API_USER, CONTABO_API_PASSWORD
77
+ # Crontab: 0 4 1 * * /opt/your-app/scripts/contabo-snapshot.sh
78
+
79
+ # > HARD GATE — Snapshot cron silently fails until env vars are set in .env.
80
+ # Credentials source: your VPS provider Customer Panel → API Details.
81
+ # Local dev: add to .envrc. Production: GitHub Secrets → deploy → /opt/your-app/.env
82
+ ```
83
+
84
+ ## CRITICAL GOTCHAS
85
+
86
+ 1. **Shell escaping in Orca terminals:** `$VAR`, `$(…)`, and `%` get eaten by the local shell. Always use base64: `echo '<base64>' | base64 -d > script.sh`
87
+ 2. **Crontab `%`:** cron interprets `%` as newline. Escape as `\%` in `$(date +\%Y\%m\%d)`
88
+ 3. **fail2ban exit 255:** means a jail references a missing log file. Remove the broken jail, restart.
89
+ 4. **your application alerts need auth:** POST to `/api/monitoring/alerts` requires Bearer token. Workaround: insert directly into SQLite, then restart your application.
90
+
91
+ ## Verify all 8 gates
92
+
93
+ ```bash
94
+ ufw status|grep -q active||echo FAIL:ufw
95
+ fail2ban-client status sshd>/dev/null 2>&1||echo FAIL:fail2ban
96
+ systemctl is-active unattended-upgrades|grep -q active||echo FAIL:unattended
97
+ sshd -T|grep -q 'permitrootlogin no'||echo FAIL:sshd
98
+ systemctl show your-app -p NoNewPrivileges|grep -q yes||echo FAIL:systemd
99
+ systemctl is-active your-app|grep -q active||echo FAIL:your-app
100
+ sqlite3 /opt/your-app/data/your-app.db "SELECT count(*) FROM monitoring_alerts"|grep -q 3||echo FAIL:alerts
101
+ crontab -l|grep -q healthcheck&&crontab -l|grep -q your-app.db&&crontab -l|grep -q contabo-snapshot||echo FAIL:crontab
102
+ echo ALL 8 GATES PASSED
103
+ ```
104
+
105
+ → verify: # requires VPS SSH — run the 8-gate one-liner on the VPS manually
106
+
107
+ ---
108
+
109
+ # Harden VPS — Reference
110
+
111
+ ## Health check script
112
+
113
+ Deploy to `/opt/your-app/scripts/healthcheck.sh`:
114
+
115
+ ```bash
116
+ #!/bin/bash
117
+ LOG=/var/log/your-app/health.log
118
+ mkdir -p /var/log/your-app
119
+ DISK=$(df / | awk 'NR==2 {print $5}' | tr -d '%')
120
+ RAM=$(free | awk '/Mem:/ {printf "%.0f", $3/$2*100}')
121
+ NOW=$(date -Iseconds)
122
+ [ "$DISK" -gt 85 ] && echo "$NOW ALERT: Disk ${DISK}%" >> "$LOG"
123
+ [ "$RAM" -gt 90 ] && echo "$NOW ALERT: RAM ${RAM}%" >> "$LOG"
124
+ systemctl is-active --quiet your-app || { echo "$NOW ALERT: your application DOWN" >> "$LOG"; systemctl restart your-app; }
125
+ [ -f /var/run/reboot-required ] && echo "$NOW WARN: kernel reboot pending" >> "$LOG"
126
+ ```
127
+
128
+ Make executable: `chmod +x /opt/your-app/scripts/healthcheck.sh`
129
+
130
+ ## your application systemd unit
131
+
132
+ Full hardened unit at `/etc/systemd/system/your-app.service`:
133
+
134
+ ```ini
135
+ [Unit]
136
+ Description=your application BaaS Platform
137
+ Documentation=https://github.com/example-org/example-app
138
+ After=network.target caddy.service
139
+ Wants=caddy.service
140
+
141
+ [Service]
142
+ Type=simple
143
+ User=your-app
144
+ Group=your-app
145
+ WorkingDirectory=/opt/your-app
146
+ ExecStart=/opt/your-app/bin/your-app serve \
147
+ --port 8080 \
148
+ --db /opt/your-app/data/your-app.db \
149
+ --sites-domain <your-domain.example.com>
150
+ EnvironmentFile=-/opt/your-app/.env
151
+ Environment=APP_HOME=/opt/your-app
152
+ Environment=HOME=/opt/your-app
153
+ Environment=NPM_CONFIG_CACHE=/opt/your-app/.npm
154
+ Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
155
+ Restart=always
156
+ RestartSec=5
157
+ StartLimitIntervalSec=60
158
+ StartLimitBurst=3
159
+ TimeoutStopSec=30
160
+ KillSignal=SIGTERM
161
+ NoNewPrivileges=yes
162
+ PrivateTmp=yes
163
+ ProtectSystem=full
164
+ ProtectHome=yes
165
+ ProtectKernelTunables=yes
166
+ ProtectKernelModules=yes
167
+ ProtectControlGroups=yes
168
+ RestrictAddressFamilies=AF_INET AF_INET6
169
+ RestrictRealtime=yes
170
+ ReadWritePaths=/opt/your-app/data
171
+ ReadWritePaths=/opt/your-app/backups
172
+ ReadWritePaths=/opt/your-app/secrets
173
+ ReadWritePaths=/opt/your-app/.npm
174
+ ReadWritePaths=/opt/your-app/logs
175
+ LimitNOFILE=65536
176
+
177
+ [Install]
178
+ WantedBy=multi-user.target
179
+ ```
180
+
181
+ ## fail2ban jail.local
182
+
183
+ ```ini
184
+ [sshd]
185
+ enabled = true
186
+ port = ssh
187
+ filter = sshd
188
+ logpath = /var/log/auth.log
189
+ maxretry = 3
190
+ bantime = 3600
191
+ findtime = 600
192
+ ```
193
+
194
+ Note: your application auth jail deferred — your application logs to journald, not a file. To enable, use `backend = systemd` with a journald filter.
195
+
196
+ ## provider-snapshot.sh — worked example (Contabo API)
197
+
198
+ > Snapshot APIs are provider-specific. This is one worked example, not a
199
+ > bigpowers default; swap the auth and endpoint calls for your own provider.
200
+
201
+ Deploy to `/opt/your-app/scripts/contabo-snapshot.sh`. Reads credentials from `/opt/your-app/.env` (same file used by your application systemd unit):
202
+
203
+ ```bash
204
+ #!/bin/bash
205
+ set -e
206
+ LOG=/var/log/your-app/snapshot.log
207
+ ENVFILE=/opt/your-app/.env
208
+ INSTANCE_ID=<your-contabo-instance-id>
209
+
210
+ [ -f "$ENVFILE" ] || { echo "$(date -Iseconds) ERROR: $ENVFILE missing" >> "$LOG"; exit 1; }
211
+ set -a; source "$ENVFILE"; set +a
212
+
213
+ [ -z "$CONTABO_CLIENT_ID" ] && { echo "$(date -Iseconds) ERROR: CONTABO_CLIENT_ID not set" >> "$LOG"; exit 1; }
214
+
215
+ TOKEN=$(curl -s -d "client_id=$CONTABO_CLIENT_ID" \
216
+ -d "client_secret=$CONTABO_CLIENT_SECRET" \
217
+ --data-urlencode "username=$CONTABO_API_USER" \
218
+ --data-urlencode "password=$CONTABO_API_PASSWORD" \
219
+ -d 'grant_type=password' \
220
+ 'https://auth.contabo.com/auth/realms/contabo/protocol/openid-connect/token' \
221
+ | jq -r '.access_token')
222
+
223
+ [ -z "$TOKEN" ] || [ "$TOKEN" = "null" ] && { echo "$(date -Iseconds) ERROR: auth failed" >> "$LOG"; exit 1; }
224
+
225
+ curl -s -X POST \
226
+ -H "Authorization: Bearer $TOKEN" \
227
+ -H "Content-Type: application/json" \
228
+ -H "x-request-id: $(uuidgen 2>/dev/null || echo $RANDOM)" \
229
+ "https://api.contabo.com/v1/compute/instances/${INSTANCE_ID}/snapshots" \
230
+ | tee -a "$LOG"
231
+
232
+ echo >> "$LOG"
233
+ echo "$(date -Iseconds) Snapshot requested for $INSTANCE_ID" >> "$LOG"
234
+ ```
235
+
236
+ ## your VPS provider credentials
237
+
238
+ Add to `/opt/your-app/.env` (same file used by your application systemd unit, deployed by GitHub Actions):
239
+
240
+ ```
241
+ CONTABO_CLIENT_ID=
242
+ CONTABO_CLIENT_SECRET=
243
+ CONTABO_API_USER=
244
+ CONTABO_API_PASSWORD=
245
+ ```
246
+
247
+ Source: your VPS provider Customer Control Panel → API Details. ClientId and ClientSecret are generated there. API User is your email. API Password is set separately in the panel.
248
+
249
+ **Pipeline:** GitHub Secrets → deploy workflow → `/opt/your-app/.env` on VPS. For local dev (`cntb get instances`), add to `.envrc`.
250
+
251
+ ## your VPS provider instance info template
252
+
253
+ Fill in your instance details from the your VPS provider Customer Control Panel:
254
+
255
+ ```
256
+ IP: <your-instance-ip>
257
+ IPv6: <your-instance-ipv6>
258
+ Region: <your-region>
259
+ OS: <your-os-version>
260
+ Disk: <your-disk-size>
261
+ Default user: root
262
+ Customer ID: <your-customer-id>
263
+ ```
264
+
265
+ ## your application monitoring alert SQL
266
+
267
+ ```sql
268
+ INSERT INTO monitoring_alerts (id, name, metric, threshold, operator, enabled, duration_seconds)
269
+ VALUES ('alert-001', 'VPS Disk above 80%', 'disk_used_percent', 80, 'gt', 1, 300);
270
+
271
+ INSERT INTO monitoring_alerts (id, name, metric, threshold, operator, enabled, duration_seconds)
272
+ VALUES ('alert-002', 'VPS CPU above 90%', 'cpu_percent', 90, 'gt', 1, 60);
273
+
274
+ INSERT INTO monitoring_alerts (id, name, metric, threshold, operator, enabled, duration_seconds)
275
+ VALUES ('alert-003', 'VPS RAM above 85%', 'mem_used_percent', 85, 'gt', 1, 120);
276
+ ```
277
+
278
+ Alerts are loaded at your application startup. Restart with `systemctl restart your-app` after inserting.
279
+
280
+ ## Base64 encoding workaround
281
+
282
+ When sending scripts through Orca terminal `--text`, the local bash shell interprets `$`, `(`, and `%`. Encode locally and decode remotely:
283
+
284
+ ```bash
285
+ # Local
286
+ cat script.sh | base64
287
+
288
+ # Remote terminal
289
+ echo '<base64-output>' | base64 -d > script.sh
290
+ ```
@@ -0,0 +1,93 @@
1
+ ---
2
+ name: hook-commits
3
+ description: "Set up pre-commit hooks with lint-staged (Prettier), type checking, and tests in the current repo. Use when user wants to add pre-commit hooks, set up Husky, configure lint-staged, or add commit-time formatting/typechecking/testing."
4
+ ---
5
+
6
+ # Hook Commits
7
+ > **HARD GATE** — **HARD GATE** — Pre-commit and commit-msg hooks must run before any commit lands. Skipping hooks (`--no-verify`) is forbidden unless explicitly authorized for a specific commit and documented.
8
+
9
+
10
+ ## What This Sets Up
11
+
12
+ - **Husky** pre-commit hook
13
+ - **lint-staged** running Prettier on all staged files
14
+ - **Prettier** config (if missing)
15
+ - **typecheck** and **test** scripts in the pre-commit hook
16
+
17
+ ## Steps
18
+
19
+ ### 1. Detect package manager
20
+
21
+ Check for `package-lock.json` (npm), `pnpm-lock.yaml` (pnpm), `yarn.lock` (yarn), `bun.lockb` (bun). Use whichever is present. Default to npm if unclear.
22
+
23
+ ### 2. Install dependencies
24
+
25
+ Install as devDependencies:
26
+
27
+ ```
28
+ husky lint-staged prettier
29
+ ```
30
+
31
+ ### 3. Initialize Husky
32
+
33
+ ```bash
34
+ npx husky init
35
+ ```
36
+
37
+ This creates `.husky/` dir and adds `prepare: "husky"` to package.json.
38
+
39
+ ### 4. Create `.husky/pre-commit`
40
+
41
+ Write this file (no shebang needed for Husky v9+):
42
+
43
+ ```
44
+ npx lint-staged
45
+ npm run typecheck
46
+ npm run test
47
+ ```
48
+
49
+ **Adapt**: Replace `npm` with detected package manager. If repo has no `typecheck` or `test` script in package.json, omit those lines and tell the user.
50
+
51
+ ### 5. Create `.lintstagedrc`
52
+
53
+ ```json
54
+ {
55
+ "*": "prettier --ignore-unknown --write"
56
+ }
57
+ ```
58
+
59
+ ### 6. Create `.prettierrc` (if missing)
60
+
61
+ Only create if no Prettier config exists. Use these defaults:
62
+
63
+ ```json
64
+ {
65
+ "useTabs": false,
66
+ "tabWidth": 2,
67
+ "printWidth": 80,
68
+ "singleQuote": false,
69
+ "trailingComma": "es5",
70
+ "semi": true,
71
+ "arrowParens": "always"
72
+ }
73
+ ```
74
+
75
+ ### 7. Verify
76
+
77
+ - [ ] `.husky/pre-commit` exists and is executable
78
+ - [ ] `.lintstagedrc` exists
79
+ - [ ] `prepare` script in package.json is `"husky"`
80
+ - [ ] `prettier` config exists
81
+ - [ ] Run `npx lint-staged` to verify it works
82
+
83
+ ### 8. Commit
84
+
85
+ Stage all changed/created files and commit with message: `chore: add pre-commit hooks (husky + lint-staged + prettier)`
86
+
87
+ This will run through the new pre-commit hooks — a good smoke test that everything works.
88
+
89
+ ## Notes
90
+
91
+ - Husky v9+ doesn't need shebangs in hook files
92
+ - `prettier --ignore-unknown` skips files Prettier can't parse (images, etc.)
93
+ - The pre-commit runs lint-staged first (fast, staged-only), then full typecheck and tests