specialist-agent 2.13.0 → 3.3.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 (329) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +36 -206
  3. package/dist/catalog.json +16677 -0
  4. package/dist/hw-worker.mjs +288 -0
  5. package/dist/icones/icone.ico +0 -0
  6. package/dist/icones/icone.png +0 -0
  7. package/dist/interface/assets/figtree-latin-400-normal-g7Dtegnw.woff2 +0 -0
  8. package/dist/interface/assets/figtree-latin-500-normal-BWnGEVsr.woff2 +0 -0
  9. package/dist/interface/assets/figtree-latin-600-normal-Cv_xCTDl.woff2 +0 -0
  10. package/dist/interface/assets/figtree-latin-700-normal-th6qEP7c.woff2 +0 -0
  11. package/dist/interface/assets/figtree-latin-ext-400-normal-CXAzuTZb.woff2 +0 -0
  12. package/dist/interface/assets/figtree-latin-ext-500-normal-Du0rIuHj.woff2 +0 -0
  13. package/dist/interface/assets/figtree-latin-ext-600-normal-DJlfifZj.woff2 +0 -0
  14. package/dist/interface/assets/figtree-latin-ext-700-normal-CS4sQkGV.woff2 +0 -0
  15. package/dist/interface/assets/index-BltVv7tb.js +24 -0
  16. package/dist/interface/assets/index-Cpa6kApK.css +1 -0
  17. package/dist/interface/assets/jetbrains-mono-latin-400-normal-V6pRDFza.woff2 +0 -0
  18. package/dist/interface/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
  19. package/dist/interface/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
  20. package/dist/interface/assets/jetbrains-mono-latin-ext-400-normal-Bc8Ftmh3.woff2 +0 -0
  21. package/dist/interface/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
  22. package/dist/interface/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
  23. package/dist/interface/assets/unbounded-latin-500-normal-4slEIF53.woff2 +0 -0
  24. package/dist/interface/assets/unbounded-latin-700-normal-CaoNriVp.woff2 +0 -0
  25. package/dist/interface/assets/unbounded-latin-ext-500-normal-BTIpesyw.woff2 +0 -0
  26. package/dist/interface/assets/unbounded-latin-ext-700-normal-BLzWLLjG.woff2 +0 -0
  27. package/dist/interface/icones/apple-touch-icon.png +0 -0
  28. package/dist/interface/icones/favicon-32.png +0 -0
  29. package/dist/interface/icones/icone-192.png +0 -0
  30. package/dist/interface/icones/icone-512.png +0 -0
  31. package/dist/interface/icones/icone-mascara-512.png +0 -0
  32. package/dist/interface/index.html +19 -0
  33. package/dist/interface/manifest.webmanifest +19 -0
  34. package/dist/interface/sw.js +64 -0
  35. package/dist/licencas/BRAND.md +22 -0
  36. package/dist/licencas/LICENSE-CONTENT.md +44 -0
  37. package/dist/licencas/OFL-Figtree.txt +93 -0
  38. package/dist/licencas/OFL-JetBrainsMono.txt +93 -0
  39. package/dist/licencas/OFL-Unbounded.txt +93 -0
  40. package/dist/licencas/TERCEIROS.txt +104 -0
  41. package/dist/specialist-agent.mjs +14515 -0
  42. package/dist/usage-worker.mjs +1077 -0
  43. package/package.json +34 -58
  44. package/.claude-plugin/marketplace.json +0 -52
  45. package/.claude-plugin/plugin.json +0 -37
  46. package/.codex/INSTALL.md +0 -145
  47. package/.cursor-plugin/marketplace.json +0 -52
  48. package/.cursor-plugin/plugin.json +0 -37
  49. package/.opencode/INSTALL.md +0 -127
  50. package/.opencode/opencode.json +0 -186
  51. package/agents/analyst-lite.md +0 -48
  52. package/agents/analyst.md +0 -396
  53. package/agents/api-lite.md +0 -43
  54. package/agents/api.md +0 -427
  55. package/agents/architect-lite.md +0 -104
  56. package/agents/architect.md +0 -571
  57. package/agents/autopilot-lite.md +0 -46
  58. package/agents/autopilot.md +0 -196
  59. package/agents/cloud-lite.md +0 -75
  60. package/agents/cloud.md +0 -213
  61. package/agents/data-lite.md +0 -67
  62. package/agents/data.md +0 -306
  63. package/agents/debugger-lite.md +0 -46
  64. package/agents/debugger.md +0 -410
  65. package/agents/deps-lite.md +0 -41
  66. package/agents/deps.md +0 -363
  67. package/agents/designer-lite.md +0 -67
  68. package/agents/designer.md +0 -195
  69. package/agents/devops-lite.md +0 -67
  70. package/agents/devops.md +0 -205
  71. package/agents/docs-lite.md +0 -42
  72. package/agents/docs.md +0 -454
  73. package/agents/executor-lite.md +0 -61
  74. package/agents/executor.md +0 -695
  75. package/agents/explorer-lite.md +0 -55
  76. package/agents/explorer.md +0 -152
  77. package/agents/finance-lite.md +0 -66
  78. package/agents/finance.md +0 -255
  79. package/agents/i18n-lite.md +0 -44
  80. package/agents/i18n.md +0 -594
  81. package/agents/legal-lite.md +0 -113
  82. package/agents/legal.md +0 -302
  83. package/agents/marketing-lite.md +0 -25
  84. package/agents/marketing.md +0 -188
  85. package/agents/memory.md +0 -166
  86. package/agents/orchestrator-lite.md +0 -40
  87. package/agents/orchestrator.md +0 -512
  88. package/agents/pair-lite.md +0 -38
  89. package/agents/pair.md +0 -310
  90. package/agents/perf-lite.md +0 -42
  91. package/agents/perf.md +0 -320
  92. package/agents/planner-lite.md +0 -59
  93. package/agents/planner.md +0 -272
  94. package/agents/product-lite.md +0 -25
  95. package/agents/product.md +0 -195
  96. package/agents/refactor-lite.md +0 -42
  97. package/agents/refactor.md +0 -467
  98. package/agents/ripple-lite.md +0 -106
  99. package/agents/ripple.md +0 -166
  100. package/agents/scout-lite.md +0 -37
  101. package/agents/scout.md +0 -224
  102. package/agents/security-lite.md +0 -66
  103. package/agents/security.md +0 -252
  104. package/agents/sentry-triage-lite.md +0 -54
  105. package/agents/sentry-triage.md +0 -217
  106. package/agents/starter-lite.md +0 -80
  107. package/agents/starter.md +0 -300
  108. package/agents/support-lite.md +0 -24
  109. package/agents/support.md +0 -191
  110. package/agents/tdd-lite.md +0 -43
  111. package/agents/tdd.md +0 -329
  112. package/agents/tester-lite.md +0 -71
  113. package/agents/tester.md +0 -237
  114. package/cli/architectures.mjs +0 -713
  115. package/cli/detect-architecture.mjs +0 -752
  116. package/cli/generate-architecture.mjs +0 -1096
  117. package/cli/index.mjs +0 -1217
  118. package/cli/recommend-architecture.mjs +0 -870
  119. package/hooks/after-review.mjs +0 -130
  120. package/hooks/after-task.mjs +0 -117
  121. package/hooks/before-plan.mjs +0 -155
  122. package/hooks/before-review.mjs +0 -139
  123. package/hooks/hooks.json +0 -66
  124. package/hooks/lifecycle.json +0 -91
  125. package/hooks/native/auto-dispatch.mjs +0 -207
  126. package/hooks/native/auto-format.mjs +0 -176
  127. package/hooks/native/mcp-discovery.mjs +0 -168
  128. package/hooks/native/security-config.json +0 -38
  129. package/hooks/native/security-guard.mjs +0 -323
  130. package/hooks/native/session-context.mjs +0 -179
  131. package/hooks/native/session-end.mjs +0 -42
  132. package/hooks/native/utils.mjs +0 -62
  133. package/hooks/on-error.mjs +0 -129
  134. package/hooks/session-end.mjs +0 -185
  135. package/hooks/session-start.mjs +0 -154
  136. package/packs/angular/ARCHITECTURE.md +0 -814
  137. package/packs/angular/CLAUDE.md +0 -105
  138. package/packs/angular/agents/builder.md +0 -113
  139. package/packs/angular/agents/doctor.md +0 -187
  140. package/packs/angular/agents/migrator.md +0 -101
  141. package/packs/angular/agents/reviewer.md +0 -252
  142. package/packs/angular/agents-lite/builder.md +0 -65
  143. package/packs/angular/agents-lite/doctor.md +0 -64
  144. package/packs/angular/agents-lite/migrator.md +0 -75
  145. package/packs/angular/agents-lite/reviewer.md +0 -69
  146. package/packs/angular/skills/dev-create-component/SKILL.md +0 -56
  147. package/packs/angular/skills/dev-create-injectable/SKILL.md +0 -60
  148. package/packs/angular/skills/dev-create-module/SKILL.md +0 -49
  149. package/packs/angular/skills/dev-create-service/SKILL.md +0 -34
  150. package/packs/angular/skills/dev-create-test/SKILL.md +0 -78
  151. package/packs/angular/skills/dev-generate-types/SKILL.md +0 -37
  152. package/packs/angular/skills/docs-onboard/SKILL.md +0 -42
  153. package/packs/angular/skills/migration-migrate-component/SKILL.md +0 -42
  154. package/packs/angular/skills/migration-migrate-module/SKILL.md +0 -25
  155. package/packs/angular/skills/review-check-architecture/SKILL.md +0 -67
  156. package/packs/angular/skills/review-fix-violations/SKILL.md +0 -43
  157. package/packs/angular/skills/review-review/SKILL.md +0 -43
  158. package/packs/astro/ARCHITECTURE.md +0 -718
  159. package/packs/astro/CLAUDE.md +0 -106
  160. package/packs/astro/agents/builder.md +0 -123
  161. package/packs/astro/agents/doctor.md +0 -200
  162. package/packs/astro/agents/migrator.md +0 -105
  163. package/packs/astro/agents/reviewer.md +0 -253
  164. package/packs/astro/agents-lite/builder.md +0 -71
  165. package/packs/astro/agents-lite/doctor.md +0 -66
  166. package/packs/astro/agents-lite/migrator.md +0 -71
  167. package/packs/astro/agents-lite/reviewer.md +0 -70
  168. package/packs/astro/skills/dev-create-component/SKILL.md +0 -50
  169. package/packs/astro/skills/dev-create-island/SKILL.md +0 -63
  170. package/packs/astro/skills/dev-create-module/SKILL.md +0 -49
  171. package/packs/astro/skills/dev-create-service/SKILL.md +0 -34
  172. package/packs/astro/skills/dev-create-test/SKILL.md +0 -76
  173. package/packs/astro/skills/dev-generate-types/SKILL.md +0 -37
  174. package/packs/astro/skills/docs-onboard/SKILL.md +0 -51
  175. package/packs/astro/skills/migration-migrate-component/SKILL.md +0 -48
  176. package/packs/astro/skills/migration-migrate-module/SKILL.md +0 -25
  177. package/packs/astro/skills/review-check-architecture/SKILL.md +0 -72
  178. package/packs/astro/skills/review-fix-violations/SKILL.md +0 -43
  179. package/packs/astro/skills/review-review/SKILL.md +0 -45
  180. package/packs/nextjs/ARCHITECTURE.md +0 -1033
  181. package/packs/nextjs/CLAUDE.md +0 -106
  182. package/packs/nextjs/agents/builder.md +0 -132
  183. package/packs/nextjs/agents/doctor.md +0 -226
  184. package/packs/nextjs/agents/migrator.md +0 -101
  185. package/packs/nextjs/agents/reviewer.md +0 -243
  186. package/packs/nextjs/agents-lite/builder.md +0 -74
  187. package/packs/nextjs/agents-lite/doctor.md +0 -74
  188. package/packs/nextjs/agents-lite/migrator.md +0 -75
  189. package/packs/nextjs/agents-lite/reviewer.md +0 -73
  190. package/packs/nextjs/skills/dev-create-component/SKILL.md +0 -82
  191. package/packs/nextjs/skills/dev-create-hook/SKILL.md +0 -90
  192. package/packs/nextjs/skills/dev-create-module/SKILL.md +0 -63
  193. package/packs/nextjs/skills/dev-create-service/SKILL.md +0 -35
  194. package/packs/nextjs/skills/dev-create-test/SKILL.md +0 -106
  195. package/packs/nextjs/skills/dev-generate-types/SKILL.md +0 -37
  196. package/packs/nextjs/skills/docs-onboard/SKILL.md +0 -55
  197. package/packs/nextjs/skills/migration-migrate-component/SKILL.md +0 -58
  198. package/packs/nextjs/skills/migration-migrate-module/SKILL.md +0 -25
  199. package/packs/nextjs/skills/review-check-architecture/SKILL.md +0 -101
  200. package/packs/nextjs/skills/review-fix-violations/SKILL.md +0 -48
  201. package/packs/nextjs/skills/review-review/SKILL.md +0 -47
  202. package/packs/nuxt/ARCHITECTURE.md +0 -831
  203. package/packs/nuxt/CLAUDE.md +0 -111
  204. package/packs/nuxt/agents/builder.md +0 -120
  205. package/packs/nuxt/agents/doctor.md +0 -198
  206. package/packs/nuxt/agents/migrator.md +0 -101
  207. package/packs/nuxt/agents/reviewer.md +0 -255
  208. package/packs/nuxt/agents-lite/builder.md +0 -67
  209. package/packs/nuxt/agents-lite/doctor.md +0 -67
  210. package/packs/nuxt/agents-lite/migrator.md +0 -80
  211. package/packs/nuxt/agents-lite/reviewer.md +0 -71
  212. package/packs/nuxt/skills/dev-create-component/SKILL.md +0 -60
  213. package/packs/nuxt/skills/dev-create-composable/SKILL.md +0 -33
  214. package/packs/nuxt/skills/dev-create-module/SKILL.md +0 -49
  215. package/packs/nuxt/skills/dev-create-service/SKILL.md +0 -34
  216. package/packs/nuxt/skills/dev-create-test/SKILL.md +0 -61
  217. package/packs/nuxt/skills/dev-generate-types/SKILL.md +0 -37
  218. package/packs/nuxt/skills/docs-onboard/SKILL.md +0 -49
  219. package/packs/nuxt/skills/migration-migrate-component/SKILL.md +0 -48
  220. package/packs/nuxt/skills/migration-migrate-module/SKILL.md +0 -25
  221. package/packs/nuxt/skills/review-check-architecture/SKILL.md +0 -71
  222. package/packs/nuxt/skills/review-fix-violations/SKILL.md +0 -43
  223. package/packs/nuxt/skills/review-review/SKILL.md +0 -45
  224. package/packs/react/ARCHITECTURE.md +0 -991
  225. package/packs/react/CLAUDE.md +0 -102
  226. package/packs/react/agents/builder.md +0 -113
  227. package/packs/react/agents/doctor.md +0 -203
  228. package/packs/react/agents/migrator.md +0 -101
  229. package/packs/react/agents/reviewer.md +0 -252
  230. package/packs/react/agents-lite/builder.md +0 -65
  231. package/packs/react/agents-lite/doctor.md +0 -64
  232. package/packs/react/agents-lite/migrator.md +0 -74
  233. package/packs/react/agents-lite/reviewer.md +0 -69
  234. package/packs/react/skills/dev-create-component/SKILL.md +0 -53
  235. package/packs/react/skills/dev-create-hook/SKILL.md +0 -78
  236. package/packs/react/skills/dev-create-module/SKILL.md +0 -51
  237. package/packs/react/skills/dev-create-service/SKILL.md +0 -34
  238. package/packs/react/skills/dev-create-test/SKILL.md +0 -92
  239. package/packs/react/skills/dev-generate-types/SKILL.md +0 -37
  240. package/packs/react/skills/docs-onboard/SKILL.md +0 -42
  241. package/packs/react/skills/migration-migrate-component/SKILL.md +0 -44
  242. package/packs/react/skills/migration-migrate-module/SKILL.md +0 -25
  243. package/packs/react/skills/review-check-architecture/SKILL.md +0 -73
  244. package/packs/react/skills/review-fix-violations/SKILL.md +0 -45
  245. package/packs/react/skills/review-review/SKILL.md +0 -44
  246. package/packs/svelte/ARCHITECTURE.md +0 -975
  247. package/packs/svelte/CLAUDE.md +0 -102
  248. package/packs/svelte/agents/builder.md +0 -114
  249. package/packs/svelte/agents/doctor.md +0 -174
  250. package/packs/svelte/agents/migrator.md +0 -101
  251. package/packs/svelte/agents/reviewer.md +0 -238
  252. package/packs/svelte/agents-lite/builder.md +0 -66
  253. package/packs/svelte/agents-lite/doctor.md +0 -67
  254. package/packs/svelte/agents-lite/migrator.md +0 -82
  255. package/packs/svelte/agents-lite/reviewer.md +0 -70
  256. package/packs/svelte/skills/dev-create-component/SKILL.md +0 -77
  257. package/packs/svelte/skills/dev-create-module/SKILL.md +0 -59
  258. package/packs/svelte/skills/dev-create-service/SKILL.md +0 -35
  259. package/packs/svelte/skills/dev-create-store/SKILL.md +0 -94
  260. package/packs/svelte/skills/dev-create-test/SKILL.md +0 -98
  261. package/packs/svelte/skills/dev-generate-types/SKILL.md +0 -37
  262. package/packs/svelte/skills/docs-onboard/SKILL.md +0 -47
  263. package/packs/svelte/skills/migration-migrate-component/SKILL.md +0 -51
  264. package/packs/svelte/skills/migration-migrate-module/SKILL.md +0 -25
  265. package/packs/svelte/skills/review-check-architecture/SKILL.md +0 -79
  266. package/packs/svelte/skills/review-fix-violations/SKILL.md +0 -47
  267. package/packs/svelte/skills/review-review/SKILL.md +0 -45
  268. package/packs/vue/ARCHITECTURE.md +0 -798
  269. package/packs/vue/CLAUDE.md +0 -102
  270. package/packs/vue/agents/builder.md +0 -112
  271. package/packs/vue/agents/doctor.md +0 -185
  272. package/packs/vue/agents/migrator.md +0 -101
  273. package/packs/vue/agents/reviewer.md +0 -249
  274. package/packs/vue/agents-lite/builder.md +0 -65
  275. package/packs/vue/agents-lite/doctor.md +0 -63
  276. package/packs/vue/agents-lite/migrator.md +0 -73
  277. package/packs/vue/agents-lite/reviewer.md +0 -68
  278. package/packs/vue/skills/dev-create-component/SKILL.md +0 -58
  279. package/packs/vue/skills/dev-create-composable/SKILL.md +0 -31
  280. package/packs/vue/skills/dev-create-module/SKILL.md +0 -50
  281. package/packs/vue/skills/dev-create-service/SKILL.md +0 -34
  282. package/packs/vue/skills/dev-create-test/SKILL.md +0 -62
  283. package/packs/vue/skills/dev-generate-types/SKILL.md +0 -37
  284. package/packs/vue/skills/docs-onboard/SKILL.md +0 -42
  285. package/packs/vue/skills/migration-migrate-component/SKILL.md +0 -41
  286. package/packs/vue/skills/migration-migrate-module/SKILL.md +0 -25
  287. package/packs/vue/skills/review-check-architecture/SKILL.md +0 -73
  288. package/packs/vue/skills/review-fix-violations/SKILL.md +0 -42
  289. package/packs/vue/skills/review-review/SKILL.md +0 -43
  290. package/skills/audit/SKILL.md +0 -231
  291. package/skills/autofix/SKILL.md +0 -166
  292. package/skills/autopilot/SKILL.md +0 -286
  293. package/skills/brainstorm/SKILL.md +0 -298
  294. package/skills/checkpoint/SKILL.md +0 -217
  295. package/skills/codereview/SKILL.md +0 -268
  296. package/skills/commit/SKILL.md +0 -150
  297. package/skills/copywriting/SKILL.md +0 -218
  298. package/skills/cro/SKILL.md +0 -234
  299. package/skills/debug/SKILL.md +0 -210
  300. package/skills/design-review/SKILL.md +0 -217
  301. package/skills/discovery/SKILL.md +0 -218
  302. package/skills/estimate/SKILL.md +0 -154
  303. package/skills/finish/SKILL.md +0 -220
  304. package/skills/grill/SKILL.md +0 -270
  305. package/skills/health/SKILL.md +0 -251
  306. package/skills/improve-architecture/SKILL.md +0 -205
  307. package/skills/learn/SKILL.md +0 -260
  308. package/skills/lint/SKILL.md +0 -126
  309. package/skills/migrate-architecture/SKILL.md +0 -242
  310. package/skills/migrate-framework/SKILL.md +0 -172
  311. package/skills/onboard/SKILL.md +0 -168
  312. package/skills/plan/SKILL.md +0 -141
  313. package/skills/prd/SKILL.md +0 -241
  314. package/skills/recall/SKILL.md +0 -112
  315. package/skills/remember/SKILL.md +0 -108
  316. package/skills/seo-audit/SKILL.md +0 -240
  317. package/skills/tdd/SKILL.md +0 -201
  318. package/skills/tutorial/SKILL.md +0 -346
  319. package/skills/verify/SKILL.md +0 -168
  320. package/skills/worktree/SKILL.md +0 -168
  321. package/skills/write-skill/SKILL.md +0 -225
  322. package/templates/autopilot/PROMPT.md +0 -39
  323. package/templates/autopilot/README.md +0 -122
  324. package/templates/autopilot/devcontainer.json +0 -21
  325. package/templates/industry/ecommerce.md +0 -127
  326. package/templates/industry/fintech.md +0 -161
  327. package/templates/industry/saas.md +0 -134
  328. package/templates/session-memory.json +0 -48
  329. package/templates/skill-template/SKILL.md +0 -90
@@ -1,323 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Security Guard - PreToolUse Hook (Bash)
5
- *
6
- * Blocks dangerous shell commands BEFORE they execute.
7
- * Design: fail-closed (if this script crashes, exit 2 = block).
8
- *
9
- * Claude Code event: PreToolUse (matcher: "Bash")
10
- * Stdin: { tool_input: { command: "..." } }
11
- * Block: exit 2 + stderr reason
12
- * Allow: exit 0 (silent)
13
- */
14
-
15
- import { dirname, resolve } from 'path';
16
- import { fileURLToPath } from 'url';
17
- import { readStdin, readJsonFile } from './utils.mjs';
18
-
19
- const __filename = fileURLToPath(import.meta.url);
20
- const __dirname = dirname(__filename);
21
-
22
- // ── Security Rules ──────────────────────────────────────────
23
-
24
- const RULES = [
25
- // CRITICAL - always block, no exceptions
26
- {
27
- id: 'catastrophic-rm',
28
- severity: 'CRITICAL',
29
- test: (cmd) => {
30
- const normalized = cmd.replace(/\s+/g, ' ').trim();
31
- // Match rm with -r and -f flags targeting / or ~ or bare .
32
- if (!/\brm\b/.test(normalized)) return false;
33
- if (!/-[a-zA-Z]*r/.test(normalized) && !/-[a-zA-Z]*R/.test(normalized)) return false;
34
- // Check target paths
35
- const dangerousTargets = [
36
- /\s\/\s*$/, /\s\/[^a-zA-Z]/, // rm -rf /
37
- /\s~\s*$/, /\s~\//, // rm -rf ~ or ~/...
38
- /\s\.\s*$/, /\s\.\//, // rm -rf . or ./...
39
- /\s\.\.\s*$/, /\s\.\.\//, // rm -rf .. or ../...
40
- ];
41
- for (const pattern of dangerousTargets) {
42
- if (pattern.test(' ' + normalized)) {
43
- // Check allowlist - safe directories are OK
44
- const safeTargets = [
45
- /node_modules/, /dist[\/\\]?/, /build[\/\\]?/, /\.next[\/\\]?/,
46
- /\.nuxt[\/\\]?/, /\.svelte-kit[\/\\]?/, /coverage[\/\\]?/,
47
- /\.turbo[\/\\]?/, /\.cache[\/\\]?/, /__pycache__[\/\\]?/,
48
- ];
49
- if (safeTargets.some(safe => safe.test(normalized))) return false;
50
- return true;
51
- }
52
- }
53
- return false;
54
- },
55
- message: 'BLOCKED [CRITICAL]: Recursive delete of system/home/project root detected.\nThis command could destroy your entire filesystem.\nIf you need to clean a specific directory, target it explicitly (e.g., rm -rf dist/).'
56
- },
57
- {
58
- id: 'fork-bomb',
59
- severity: 'CRITICAL',
60
- test: (cmd) => /:\(\)\s*\{.*\|.*&\s*\}\s*;?\s*:/.test(cmd) || /\.\/bomb/.test(cmd),
61
- message: 'BLOCKED [CRITICAL]: Fork bomb detected. This would crash the system by spawning infinite processes.'
62
- },
63
- {
64
- id: 'disk-wipe',
65
- severity: 'CRITICAL',
66
- test: (cmd) => {
67
- return /\bmkfs\b/.test(cmd) ||
68
- /\bdd\b.*\bif=.*\/dev\//.test(cmd) && /\bof=.*\/dev\//.test(cmd) ||
69
- />\s*\/dev\/[hs]d[a-z]/.test(cmd);
70
- },
71
- message: 'BLOCKED [CRITICAL]: Disk wipe command detected. This would destroy disk data irreversibly.'
72
- },
73
-
74
- // HIGH - block with descriptive message
75
- {
76
- id: 'force-push-protected',
77
- severity: 'HIGH',
78
- test: (cmd, config) => {
79
- if (!/\bgit\s+push\b/.test(cmd)) return false;
80
- if (!/(-f\b|--force\b)/.test(cmd)) return false;
81
- // force-with-lease is safer, allow it
82
- if (/--force-with-lease/.test(cmd)) return false;
83
- // Check if targeting a protected branch
84
- const branches = config?.protectedBranches || ['main', 'master', 'production', 'release'];
85
- return branches.some(branch => new RegExp(`\\b${branch}\\b`).test(cmd));
86
- },
87
- message: 'BLOCKED [HIGH]: Force push to protected branch.\nUse a feature branch and create a PR instead.\nIf you need to force push, use --force-with-lease for safety, or target a feature branch.'
88
- },
89
- {
90
- id: 'hard-reset',
91
- severity: 'HIGH',
92
- test: (cmd) => {
93
- if (!/\bgit\s+reset\b/.test(cmd)) return false;
94
- if (/--hard/.test(cmd)) return true;
95
- return false;
96
- },
97
- message: 'BLOCKED [HIGH]: git reset --hard discards all uncommitted changes permanently.\nConsider using: git stash (to save changes), git reset --soft (to unstage), or git checkout -- <file> (for specific files).'
98
- },
99
- {
100
- id: 'sql-destructive',
101
- severity: 'HIGH',
102
- test: (cmd) => {
103
- const upper = cmd.toUpperCase();
104
- return /\bDROP\s+(TABLE|DATABASE|SCHEMA)\b/.test(upper) ||
105
- /\bTRUNCATE\s+TABLE\b/.test(upper) ||
106
- /\bDELETE\s+FROM\s+\w+\s*;?\s*$/.test(upper); // DELETE without WHERE
107
- },
108
- message: 'BLOCKED [HIGH]: Destructive SQL command detected.\nDROP/TRUNCATE/DELETE-without-WHERE can cause irreversible data loss.\nUse a transaction, add a WHERE clause, or test on a staging database first.'
109
- },
110
- {
111
- id: 'pipe-to-shell',
112
- severity: 'HIGH',
113
- test: (cmd) => {
114
- return /\bcurl\b.*\|\s*(bash|sh|zsh)\b/.test(cmd) ||
115
- /\bwget\b.*\|\s*(bash|sh|zsh)\b/.test(cmd) ||
116
- /\bcurl\b.*-[a-zA-Z]*o\s*-\s*\|/.test(cmd);
117
- },
118
- message: 'BLOCKED [HIGH]: Pipe-to-shell pattern detected (curl/wget | bash).\nThis downloads and executes remote code without inspection.\nDownload the script first, review it, then execute: curl -o script.sh <url> && cat script.sh && bash script.sh'
119
- },
120
- {
121
- id: 'chmod-777',
122
- severity: 'HIGH',
123
- test: (cmd) => /\bchmod\b.*\b777\b/.test(cmd),
124
- message: 'BLOCKED [HIGH]: chmod 777 makes files world-readable/writable/executable.\nUse specific permissions instead: chmod 755 (directories), chmod 644 (files), chmod 600 (secrets).'
125
- },
126
- {
127
- id: 'git-branch-force-delete',
128
- severity: 'HIGH',
129
- test: (cmd) => {
130
- if (!/\bgit\s+branch\b/.test(cmd)) return false;
131
- return /-D\b/.test(cmd);
132
- },
133
- message: 'BLOCKED [HIGH]: git branch -D force-deletes a branch even if not fully merged.\nUse git branch -d (lowercase) for safe deletion — it warns if the branch has unmerged changes.'
134
- },
135
- {
136
- id: 'npm-publish-no-dry-run',
137
- severity: 'HIGH',
138
- test: (cmd) => {
139
- if (!/\bnpm\s+publish\b/.test(cmd)) return false;
140
- if (/--dry-run/.test(cmd)) return false;
141
- return true;
142
- },
143
- message: 'BLOCKED [HIGH]: npm publish without --dry-run detected.\nPublishing to npm is irreversible (versions cannot be overwritten).\nRun with --dry-run first to verify, then publish manually in your terminal.'
144
- },
145
- {
146
- id: 'docker-system-prune',
147
- severity: 'HIGH',
148
- test: (cmd) => /\bdocker\s+system\s+prune\b/.test(cmd) && /-a\b/.test(cmd),
149
- message: 'BLOCKED [HIGH]: docker system prune -a removes ALL unused images, containers, networks, and volumes.\nUse targeted cleanup: docker image prune, docker container prune, or docker volume prune.'
150
- },
151
- {
152
- id: 'kubectl-delete-namespace',
153
- severity: 'HIGH',
154
- test: (cmd) => /\bkubectl\s+delete\s+(namespace|ns)\b/.test(cmd),
155
- message: 'BLOCKED [HIGH]: kubectl delete namespace destroys ALL resources within the namespace.\nThis is a cascading delete that removes deployments, services, pods, secrets, and more.\nVerify the namespace and run this command manually in your terminal.'
156
- },
157
-
158
- // MEDIUM - block access to sensitive files
159
- {
160
- id: 'env-file-read',
161
- severity: 'MEDIUM',
162
- test: (cmd) => {
163
- const readCmds = /\b(cat|less|more|head|tail|sed|awk|grep|bat|type)\b/;
164
- // Block reading .env files (but allow .env.example, .env.sample, .env.template)
165
- if (readCmds.test(cmd) && /\.env\b/.test(cmd)) {
166
- if (/\.env\.(example|sample|template|test|development)/.test(cmd)) return false;
167
- return true;
168
- }
169
- // Block reading private keys
170
- if (readCmds.test(cmd) && /\.(pem|key|p12|pfx)\b/.test(cmd)) return true;
171
- return false;
172
- },
173
- message: 'BLOCKED [MEDIUM]: Reading sensitive file (.env or private key) via shell.\nUse the Read tool instead, which provides better access control.\nAllowed: .env.example, .env.sample, .env.template'
174
- },
175
- {
176
- id: 'ssh-key-access',
177
- severity: 'MEDIUM',
178
- test: (cmd) => {
179
- const readCmds = /\b(cat|less|more|head|tail|sed|awk|grep|bat|type|cp|scp)\b/;
180
- if (!readCmds.test(cmd)) return false;
181
- return /[~\/]\.ssh\/(id_|authorized_keys|known_hosts|config)/.test(cmd);
182
- },
183
- message: 'BLOCKED [MEDIUM]: Accessing SSH keys or config via shell.\nSSH keys are sensitive credentials that should never be read or copied by AI agents.\nIf you need to configure SSH, do it manually in your terminal.'
184
- },
185
- {
186
- id: 'aws-credentials',
187
- severity: 'MEDIUM',
188
- test: (cmd) => {
189
- const readCmds = /\b(cat|less|more|head|tail|sed|awk|grep|bat|type|cp)\b/;
190
- if (!readCmds.test(cmd)) return false;
191
- return /[~\/]\.aws\/(credentials|config)/.test(cmd);
192
- },
193
- message: 'BLOCKED [MEDIUM]: Accessing AWS credentials via shell.\nAWS credentials contain secret access keys. Use environment variables ($AWS_ACCESS_KEY_ID, $AWS_SECRET_ACCESS_KEY) or IAM roles instead.'
194
- },
195
- {
196
- id: 'cloud-credentials',
197
- severity: 'MEDIUM',
198
- test: (cmd) => {
199
- const readCmds = /\b(cat|less|more|head|tail|sed|awk|grep|bat|type|cp)\b/;
200
- if (!readCmds.test(cmd)) return false;
201
- return /application_default_credentials\.json/.test(cmd) ||
202
- /service[_-]account[_-]?key.*\.json/.test(cmd) ||
203
- /[~\/]\.azure\/(credentials|config|accessTokens)/.test(cmd) ||
204
- /[~\/]\.kube\/config/.test(cmd) ||
205
- /[~\/]\.docker\/config\.json/.test(cmd) ||
206
- /[~\/]\.npmrc/.test(cmd) ||
207
- /[~\/]\.netrc/.test(cmd) ||
208
- /[~\/]\.pgpass/.test(cmd);
209
- },
210
- message: 'BLOCKED [MEDIUM]: Accessing cloud/service credentials via shell.\nThese files contain sensitive tokens and secrets. Use environment variables or secret managers instead.'
211
- },
212
- {
213
- id: 'env-file-write',
214
- severity: 'MEDIUM',
215
- test: (cmd) => {
216
- // Block writing to .env files
217
- return />\s*\.env\b/.test(cmd) && !/\.env\.(example|sample|template)/.test(cmd);
218
- },
219
- message: 'BLOCKED [MEDIUM]: Writing to .env file via shell.\nManage secrets through environment variables or a secrets manager, not by writing them to files via commands.'
220
- },
221
- {
222
- id: 'inline-secrets',
223
- severity: 'MEDIUM',
224
- test: (cmd) => {
225
- // Block patterns like: export SECRET_KEY=actual_value, TOKEN=xxx command
226
- const secretPatterns = [
227
- /\b\w*(API_KEY|SECRET|TOKEN|PASSWORD|CREDENTIALS|PRIVATE_KEY)\w*\s*=\s*['"][^'"]{8,256}['"]/i,
228
- /\bexport\s+\w*(API_KEY|SECRET|TOKEN|PASSWORD|CREDENTIALS|PRIVATE_KEY)\w*\s*=\s*\S{8,256}/i,
229
- ];
230
- return secretPatterns.some(p => p.test(cmd));
231
- },
232
- message: 'BLOCKED [MEDIUM]: Inline secret detected in command.\nNever put secrets directly in shell commands. Use environment variables already set in the system:\n export MY_SECRET=... (in your shell profile)\n Then reference as $MY_SECRET in commands.'
233
- },
234
- ];
235
-
236
- // ── Core Evaluation Function (exported for testing) ─────────
237
-
238
- /**
239
- * Evaluate a command against security rules.
240
- * @param {string} command - The shell command to evaluate
241
- * @param {object} config - Security config (from security-config.json)
242
- * @returns {{ blocked: boolean, rule?: string, severity?: string, message?: string }}
243
- */
244
- export function evaluateCommand(command, config = {}) {
245
- if (!command || typeof command !== 'string') {
246
- return { blocked: false };
247
- }
248
-
249
- const enabledRules = config?.rules || {};
250
-
251
- for (const rule of RULES) {
252
- // Check if rule is disabled in config
253
- if (enabledRules[rule.id]?.enabled === false) continue;
254
-
255
- // Check allowlist — normalize whitespace and compare the full command
256
- // to prevent bypass via chaining (e.g. "rm -rf dist; malicious")
257
- const allowlist = config?.allowlist || [];
258
- const normalizedCmd = command.replace(/\s+/g, ' ').trim();
259
- const isAllowed = allowlist.some(pattern => {
260
- const normalizedPattern = pattern.replace(/\s+/g, ' ').trim();
261
- return normalizedCmd === normalizedPattern;
262
- });
263
- if (isAllowed) continue;
264
-
265
- // Test the rule
266
- if (rule.test(command, config)) {
267
- return {
268
- blocked: true,
269
- rule: rule.id,
270
- severity: rule.severity,
271
- message: rule.message,
272
- };
273
- }
274
- }
275
-
276
- return { blocked: false };
277
- }
278
-
279
- // ── Main Execution ──────────────────────────────────────────
280
-
281
- async function main() {
282
- const input = await readStdin();
283
-
284
- if (!input) {
285
- // Fail-closed: if we can't parse input, block
286
- process.stderr.write('Security Guard: Failed to parse input. Blocking as precaution.');
287
- process.exit(2);
288
- }
289
-
290
- if (!input?.tool_input?.command) {
291
- // No command to evaluate - allow
292
- process.exit(0);
293
- }
294
-
295
- const command = input.tool_input.command;
296
-
297
- // Load config
298
- const configPath = resolve(__dirname, 'security-config.json');
299
- const config = readJsonFile(configPath) || {};
300
-
301
- if (config.enabled === false) {
302
- process.exit(0);
303
- }
304
-
305
- const result = evaluateCommand(command, config);
306
-
307
- if (result.blocked) {
308
- process.stderr.write(`\n🛡️ Security Guard\n${result.message}\n\nRule: ${result.rule} (${result.severity})\nTo customize: edit .claude/hooks/security-config.json\n`);
309
- process.exit(2);
310
- }
311
-
312
- // Allow - silent exit
313
- process.exit(0);
314
- }
315
-
316
- // Only run main when executed directly
317
- if (process.argv[1] && resolve(process.argv[1]) === resolve(__filename)) {
318
- main().catch(() => {
319
- // Fail-closed: any unhandled error = block
320
- process.stderr.write('Security Guard: Unexpected error. Blocking as precaution.');
321
- process.exit(2);
322
- });
323
- }
@@ -1,179 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Session Context - SessionStart Hook
5
- *
6
- * Injects project state as context when a Claude Code session begins.
7
- * All operations are read-only. Errors are silently ignored.
8
- *
9
- * Claude Code event: SessionStart
10
- * Output: { "additionalContext": "Project state summary..." }
11
- */
12
-
13
- import { execSync } from 'child_process';
14
- import { readdirSync, existsSync } from 'fs';
15
- import { join, resolve } from 'path';
16
- import { fileURLToPath } from 'url';
17
- import { outputJson, readJsonFile } from './utils.mjs';
18
-
19
- const __filename = fileURLToPath(import.meta.url);
20
-
21
- // ── Data Collectors ─────────────────────────────────────────
22
-
23
- function getGitInfo() {
24
- try {
25
- const branch = execSync('git branch --show-current', { encoding: 'utf-8', timeout: 5000 }).trim();
26
- const statusOutput = execSync('git status --porcelain', { encoding: 'utf-8', timeout: 5000 });
27
- const dirtyCount = statusOutput ? statusOutput.trim().split('\n').filter(Boolean).length : 0;
28
- const lastCommit = execSync('git log -1 --oneline', { encoding: 'utf-8', timeout: 5000 }).trim();
29
- return { branch, dirtyCount, lastCommit };
30
- } catch {
31
- return null;
32
- }
33
- }
34
-
35
- function getAgentCount(cwd) {
36
- try {
37
- const agentsDir = join(cwd, '.claude', 'agents');
38
- if (!existsSync(agentsDir)) return 0;
39
- return readdirSync(agentsDir).filter(f => f.endsWith('.md')).length;
40
- } catch {
41
- return 0;
42
- }
43
- }
44
-
45
- function getSkillCount(cwd) {
46
- try {
47
- const skillsDir = join(cwd, '.claude', 'skills');
48
- if (!existsSync(skillsDir)) return 0;
49
- return readdirSync(skillsDir, { withFileTypes: true }).filter(d => d.isDirectory()).length;
50
- } catch {
51
- return 0;
52
- }
53
- }
54
-
55
- function getMemoryDecisions(cwd) {
56
- const memoryPath = join(cwd, '.claude', 'session-memory.json');
57
- const memory = readJsonFile(memoryPath);
58
- if (!memory) return 0;
59
- return Array.isArray(memory.decisions) ? memory.decisions.length : 0;
60
- }
61
-
62
- function getActiveProfile(cwd) {
63
- const configPath = join(cwd, '.claude', 'config.json');
64
- const config = readJsonFile(configPath);
65
- return config?.profile || null;
66
- }
67
-
68
- function detectFramework(cwd) {
69
- const pkg = readJsonFile(join(cwd, 'package.json'));
70
- if (!pkg) return null;
71
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
72
- if (deps['nuxt']) return 'Nuxt';
73
- if (deps['next']) return 'Next.js';
74
- if (deps['@sveltejs/kit']) return 'SvelteKit';
75
- if (deps['@angular/core']) return 'Angular';
76
- if (deps['astro']) return 'Astro';
77
- if (deps['vue']) return 'Vue';
78
- if (deps['react']) return 'React';
79
- return null;
80
- }
81
-
82
- function detectProjectFeatures(cwd) {
83
- const features = [];
84
- const pkg = readJsonFile(join(cwd, 'package.json'));
85
- const deps = { ...pkg?.dependencies, ...pkg?.devDependencies };
86
-
87
- if (existsSync(join(cwd, 'tsconfig.json'))) features.push('TypeScript');
88
- if (deps?.['vitest'] || deps?.['jest'] || deps?.['mocha']) features.push('Tests');
89
- if (existsSync(join(cwd, 'docs', 'ARCHITECTURE.md')) || existsSync(join(cwd, 'ARCHITECTURE.md'))) features.push('ARCHITECTURE.md');
90
- if (existsSync(join(cwd, '.mcp.json'))) features.push('MCP configured');
91
-
92
- return features;
93
- }
94
-
95
- function getAvailableMCPs(cwd) {
96
- const mcpConfig = readJsonFile(join(cwd, '.mcp.json'));
97
- if (!mcpConfig?.mcpServers) return [];
98
- return Object.keys(mcpConfig.mcpServers);
99
- }
100
-
101
- // ── Context Builder (exported for testing) ──────────────────
102
-
103
- /**
104
- * Build project context string from current state.
105
- * @param {string} cwd - Project root directory
106
- * @returns {string} Context summary or empty string
107
- */
108
- export function buildContext(cwd) {
109
- const parts = [];
110
-
111
- // Git info
112
- const git = getGitInfo();
113
- if (git) {
114
- parts.push(`Branch: ${git.branch}`);
115
- if (git.dirtyCount > 0) {
116
- parts.push(`Uncommitted files: ${git.dirtyCount}`);
117
- }
118
- parts.push(`Last commit: ${git.lastCommit}`);
119
- }
120
-
121
- // Framework
122
- const framework = detectFramework(cwd);
123
- if (framework) {
124
- parts.push(`Framework: ${framework}`);
125
- }
126
-
127
- // Project features
128
- const features = detectProjectFeatures(cwd);
129
- if (features.length > 0) {
130
- parts.push(`Features: ${features.join(', ')}`);
131
- }
132
-
133
- // Agents & skills
134
- const agents = getAgentCount(cwd);
135
- const skills = getSkillCount(cwd);
136
- if (agents > 0 || skills > 0) {
137
- parts.push(`Installed: ${agents} agents, ${skills} skills`);
138
- }
139
-
140
- // MCPs
141
- const mcps = getAvailableMCPs(cwd);
142
- if (mcps.length > 0) {
143
- parts.push(`MCPs: ${mcps.join(', ')}`);
144
- }
145
-
146
- // Memory
147
- const decisions = getMemoryDecisions(cwd);
148
- if (decisions > 0) {
149
- parts.push(`Session memory: ${decisions} saved decisions (use /recall to query)`);
150
- }
151
-
152
- // Profile
153
- const profile = getActiveProfile(cwd);
154
- if (profile) {
155
- parts.push(`Active profile: ${profile}`);
156
- }
157
-
158
- return parts.length > 0 ? `[Specialist Agent] ${parts.join(' | ')}` : '';
159
- }
160
-
161
- // ── Main Execution ──────────────────────────────────────────
162
-
163
- async function main() {
164
- const cwd = process.cwd();
165
- const context = buildContext(cwd);
166
-
167
- if (context) {
168
- outputJson({ additionalContext: context });
169
- }
170
-
171
- process.exit(0);
172
- }
173
-
174
- if (process.argv[1] && resolve(process.argv[1]) === resolve(__filename)) {
175
- main().catch(() => {
176
- // Advisory hook - never block on error
177
- process.exit(0);
178
- });
179
- }
@@ -1,42 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Session End - Stop Hook
5
- *
6
- * Fires when Claude Code finishes responding. Can be used to
7
- * trigger lifecycle hooks (session-end) or log session metrics.
8
- * All operations are best-effort. Errors are silently ignored.
9
- *
10
- * Claude Code event: Stop
11
- * Output: { "additionalContext": "..." } or empty
12
- */
13
-
14
- import { readFileSync, existsSync } from 'fs';
15
- import { join } from 'path';
16
-
17
- const lifecyclePath = join(process.cwd(), 'hooks', 'lifecycle.json');
18
-
19
- function main() {
20
- try {
21
- if (!existsSync(lifecyclePath)) {
22
- process.stdout.write(JSON.stringify({}));
23
- return;
24
- }
25
-
26
- const lifecycle = JSON.parse(readFileSync(lifecyclePath, 'utf-8'));
27
- const sessionEnd = lifecycle?.hooks?.['session-end'];
28
-
29
- if (!sessionEnd?.enabled) {
30
- process.stdout.write(JSON.stringify({}));
31
- return;
32
- }
33
-
34
- // Log session end for metrics/notifications if configured
35
- // The lifecycle.json may define webhook URLs or log destinations
36
- process.stdout.write(JSON.stringify({}));
37
- } catch {
38
- process.stdout.write(JSON.stringify({}));
39
- }
40
- }
41
-
42
- main();
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Native Hooks - Shared Utilities
5
- * Common functions for all Claude Code native hooks.
6
- */
7
-
8
- import { readFileSync } from 'fs';
9
-
10
- /**
11
- * Read JSON from stdin (Claude Code passes event data this way).
12
- * Returns parsed object or null on failure.
13
- */
14
- export async function readStdin() {
15
- return new Promise((resolve) => {
16
- let data = '';
17
- const timeout = setTimeout(() => resolve(null), 5000);
18
-
19
- process.stdin.setEncoding('utf-8');
20
- process.stdin.on('data', (chunk) => { data += chunk; });
21
- process.stdin.on('end', () => {
22
- clearTimeout(timeout);
23
- try {
24
- resolve(JSON.parse(data));
25
- } catch {
26
- resolve(null);
27
- }
28
- });
29
- process.stdin.on('error', () => {
30
- clearTimeout(timeout);
31
- resolve(null);
32
- });
33
-
34
- process.stdin.resume();
35
- });
36
- }
37
-
38
- /**
39
- * Output JSON to stdout for Claude Code to consume.
40
- */
41
- export function outputJson(obj) {
42
- process.stdout.write(JSON.stringify(obj));
43
- }
44
-
45
- /**
46
- * Output error to stderr and exit with code 2 (block action).
47
- */
48
- export function blockWithReason(reason) {
49
- process.stderr.write(reason);
50
- process.exit(2);
51
- }
52
-
53
- /**
54
- * Safe JSON file reader. Returns null on any error.
55
- */
56
- export function readJsonFile(filePath) {
57
- try {
58
- return JSON.parse(readFileSync(filePath, 'utf-8'));
59
- } catch {
60
- return null;
61
- }
62
- }