specialist-agent 2.13.0 → 3.2.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 (323) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +33 -207
  3. package/dist/catalog.json +15529 -0
  4. package/dist/hw-worker.mjs +254 -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-BIyqZkro.css +1 -0
  16. package/dist/interface/assets/index-zAegy908.js +13 -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 +63 -0
  35. package/dist/specialist-agent.mjs +6919 -0
  36. package/dist/usage-worker.mjs +174 -0
  37. package/package.json +32 -57
  38. package/.claude-plugin/marketplace.json +0 -52
  39. package/.claude-plugin/plugin.json +0 -37
  40. package/.codex/INSTALL.md +0 -145
  41. package/.cursor-plugin/marketplace.json +0 -52
  42. package/.cursor-plugin/plugin.json +0 -37
  43. package/.opencode/INSTALL.md +0 -127
  44. package/.opencode/opencode.json +0 -186
  45. package/agents/analyst-lite.md +0 -48
  46. package/agents/analyst.md +0 -396
  47. package/agents/api-lite.md +0 -43
  48. package/agents/api.md +0 -427
  49. package/agents/architect-lite.md +0 -104
  50. package/agents/architect.md +0 -571
  51. package/agents/autopilot-lite.md +0 -46
  52. package/agents/autopilot.md +0 -196
  53. package/agents/cloud-lite.md +0 -75
  54. package/agents/cloud.md +0 -213
  55. package/agents/data-lite.md +0 -67
  56. package/agents/data.md +0 -306
  57. package/agents/debugger-lite.md +0 -46
  58. package/agents/debugger.md +0 -410
  59. package/agents/deps-lite.md +0 -41
  60. package/agents/deps.md +0 -363
  61. package/agents/designer-lite.md +0 -67
  62. package/agents/designer.md +0 -195
  63. package/agents/devops-lite.md +0 -67
  64. package/agents/devops.md +0 -205
  65. package/agents/docs-lite.md +0 -42
  66. package/agents/docs.md +0 -454
  67. package/agents/executor-lite.md +0 -61
  68. package/agents/executor.md +0 -695
  69. package/agents/explorer-lite.md +0 -55
  70. package/agents/explorer.md +0 -152
  71. package/agents/finance-lite.md +0 -66
  72. package/agents/finance.md +0 -255
  73. package/agents/i18n-lite.md +0 -44
  74. package/agents/i18n.md +0 -594
  75. package/agents/legal-lite.md +0 -113
  76. package/agents/legal.md +0 -302
  77. package/agents/marketing-lite.md +0 -25
  78. package/agents/marketing.md +0 -188
  79. package/agents/memory.md +0 -166
  80. package/agents/orchestrator-lite.md +0 -40
  81. package/agents/orchestrator.md +0 -512
  82. package/agents/pair-lite.md +0 -38
  83. package/agents/pair.md +0 -310
  84. package/agents/perf-lite.md +0 -42
  85. package/agents/perf.md +0 -320
  86. package/agents/planner-lite.md +0 -59
  87. package/agents/planner.md +0 -272
  88. package/agents/product-lite.md +0 -25
  89. package/agents/product.md +0 -195
  90. package/agents/refactor-lite.md +0 -42
  91. package/agents/refactor.md +0 -467
  92. package/agents/ripple-lite.md +0 -106
  93. package/agents/ripple.md +0 -166
  94. package/agents/scout-lite.md +0 -37
  95. package/agents/scout.md +0 -224
  96. package/agents/security-lite.md +0 -66
  97. package/agents/security.md +0 -252
  98. package/agents/sentry-triage-lite.md +0 -54
  99. package/agents/sentry-triage.md +0 -217
  100. package/agents/starter-lite.md +0 -80
  101. package/agents/starter.md +0 -300
  102. package/agents/support-lite.md +0 -24
  103. package/agents/support.md +0 -191
  104. package/agents/tdd-lite.md +0 -43
  105. package/agents/tdd.md +0 -329
  106. package/agents/tester-lite.md +0 -71
  107. package/agents/tester.md +0 -237
  108. package/cli/architectures.mjs +0 -713
  109. package/cli/detect-architecture.mjs +0 -752
  110. package/cli/generate-architecture.mjs +0 -1096
  111. package/cli/index.mjs +0 -1217
  112. package/cli/recommend-architecture.mjs +0 -870
  113. package/hooks/after-review.mjs +0 -130
  114. package/hooks/after-task.mjs +0 -117
  115. package/hooks/before-plan.mjs +0 -155
  116. package/hooks/before-review.mjs +0 -139
  117. package/hooks/hooks.json +0 -66
  118. package/hooks/lifecycle.json +0 -91
  119. package/hooks/native/auto-dispatch.mjs +0 -207
  120. package/hooks/native/auto-format.mjs +0 -176
  121. package/hooks/native/mcp-discovery.mjs +0 -168
  122. package/hooks/native/security-config.json +0 -38
  123. package/hooks/native/security-guard.mjs +0 -323
  124. package/hooks/native/session-context.mjs +0 -179
  125. package/hooks/native/session-end.mjs +0 -42
  126. package/hooks/native/utils.mjs +0 -62
  127. package/hooks/on-error.mjs +0 -129
  128. package/hooks/session-end.mjs +0 -185
  129. package/hooks/session-start.mjs +0 -154
  130. package/packs/angular/ARCHITECTURE.md +0 -814
  131. package/packs/angular/CLAUDE.md +0 -105
  132. package/packs/angular/agents/builder.md +0 -113
  133. package/packs/angular/agents/doctor.md +0 -187
  134. package/packs/angular/agents/migrator.md +0 -101
  135. package/packs/angular/agents/reviewer.md +0 -252
  136. package/packs/angular/agents-lite/builder.md +0 -65
  137. package/packs/angular/agents-lite/doctor.md +0 -64
  138. package/packs/angular/agents-lite/migrator.md +0 -75
  139. package/packs/angular/agents-lite/reviewer.md +0 -69
  140. package/packs/angular/skills/dev-create-component/SKILL.md +0 -56
  141. package/packs/angular/skills/dev-create-injectable/SKILL.md +0 -60
  142. package/packs/angular/skills/dev-create-module/SKILL.md +0 -49
  143. package/packs/angular/skills/dev-create-service/SKILL.md +0 -34
  144. package/packs/angular/skills/dev-create-test/SKILL.md +0 -78
  145. package/packs/angular/skills/dev-generate-types/SKILL.md +0 -37
  146. package/packs/angular/skills/docs-onboard/SKILL.md +0 -42
  147. package/packs/angular/skills/migration-migrate-component/SKILL.md +0 -42
  148. package/packs/angular/skills/migration-migrate-module/SKILL.md +0 -25
  149. package/packs/angular/skills/review-check-architecture/SKILL.md +0 -67
  150. package/packs/angular/skills/review-fix-violations/SKILL.md +0 -43
  151. package/packs/angular/skills/review-review/SKILL.md +0 -43
  152. package/packs/astro/ARCHITECTURE.md +0 -718
  153. package/packs/astro/CLAUDE.md +0 -106
  154. package/packs/astro/agents/builder.md +0 -123
  155. package/packs/astro/agents/doctor.md +0 -200
  156. package/packs/astro/agents/migrator.md +0 -105
  157. package/packs/astro/agents/reviewer.md +0 -253
  158. package/packs/astro/agents-lite/builder.md +0 -71
  159. package/packs/astro/agents-lite/doctor.md +0 -66
  160. package/packs/astro/agents-lite/migrator.md +0 -71
  161. package/packs/astro/agents-lite/reviewer.md +0 -70
  162. package/packs/astro/skills/dev-create-component/SKILL.md +0 -50
  163. package/packs/astro/skills/dev-create-island/SKILL.md +0 -63
  164. package/packs/astro/skills/dev-create-module/SKILL.md +0 -49
  165. package/packs/astro/skills/dev-create-service/SKILL.md +0 -34
  166. package/packs/astro/skills/dev-create-test/SKILL.md +0 -76
  167. package/packs/astro/skills/dev-generate-types/SKILL.md +0 -37
  168. package/packs/astro/skills/docs-onboard/SKILL.md +0 -51
  169. package/packs/astro/skills/migration-migrate-component/SKILL.md +0 -48
  170. package/packs/astro/skills/migration-migrate-module/SKILL.md +0 -25
  171. package/packs/astro/skills/review-check-architecture/SKILL.md +0 -72
  172. package/packs/astro/skills/review-fix-violations/SKILL.md +0 -43
  173. package/packs/astro/skills/review-review/SKILL.md +0 -45
  174. package/packs/nextjs/ARCHITECTURE.md +0 -1033
  175. package/packs/nextjs/CLAUDE.md +0 -106
  176. package/packs/nextjs/agents/builder.md +0 -132
  177. package/packs/nextjs/agents/doctor.md +0 -226
  178. package/packs/nextjs/agents/migrator.md +0 -101
  179. package/packs/nextjs/agents/reviewer.md +0 -243
  180. package/packs/nextjs/agents-lite/builder.md +0 -74
  181. package/packs/nextjs/agents-lite/doctor.md +0 -74
  182. package/packs/nextjs/agents-lite/migrator.md +0 -75
  183. package/packs/nextjs/agents-lite/reviewer.md +0 -73
  184. package/packs/nextjs/skills/dev-create-component/SKILL.md +0 -82
  185. package/packs/nextjs/skills/dev-create-hook/SKILL.md +0 -90
  186. package/packs/nextjs/skills/dev-create-module/SKILL.md +0 -63
  187. package/packs/nextjs/skills/dev-create-service/SKILL.md +0 -35
  188. package/packs/nextjs/skills/dev-create-test/SKILL.md +0 -106
  189. package/packs/nextjs/skills/dev-generate-types/SKILL.md +0 -37
  190. package/packs/nextjs/skills/docs-onboard/SKILL.md +0 -55
  191. package/packs/nextjs/skills/migration-migrate-component/SKILL.md +0 -58
  192. package/packs/nextjs/skills/migration-migrate-module/SKILL.md +0 -25
  193. package/packs/nextjs/skills/review-check-architecture/SKILL.md +0 -101
  194. package/packs/nextjs/skills/review-fix-violations/SKILL.md +0 -48
  195. package/packs/nextjs/skills/review-review/SKILL.md +0 -47
  196. package/packs/nuxt/ARCHITECTURE.md +0 -831
  197. package/packs/nuxt/CLAUDE.md +0 -111
  198. package/packs/nuxt/agents/builder.md +0 -120
  199. package/packs/nuxt/agents/doctor.md +0 -198
  200. package/packs/nuxt/agents/migrator.md +0 -101
  201. package/packs/nuxt/agents/reviewer.md +0 -255
  202. package/packs/nuxt/agents-lite/builder.md +0 -67
  203. package/packs/nuxt/agents-lite/doctor.md +0 -67
  204. package/packs/nuxt/agents-lite/migrator.md +0 -80
  205. package/packs/nuxt/agents-lite/reviewer.md +0 -71
  206. package/packs/nuxt/skills/dev-create-component/SKILL.md +0 -60
  207. package/packs/nuxt/skills/dev-create-composable/SKILL.md +0 -33
  208. package/packs/nuxt/skills/dev-create-module/SKILL.md +0 -49
  209. package/packs/nuxt/skills/dev-create-service/SKILL.md +0 -34
  210. package/packs/nuxt/skills/dev-create-test/SKILL.md +0 -61
  211. package/packs/nuxt/skills/dev-generate-types/SKILL.md +0 -37
  212. package/packs/nuxt/skills/docs-onboard/SKILL.md +0 -49
  213. package/packs/nuxt/skills/migration-migrate-component/SKILL.md +0 -48
  214. package/packs/nuxt/skills/migration-migrate-module/SKILL.md +0 -25
  215. package/packs/nuxt/skills/review-check-architecture/SKILL.md +0 -71
  216. package/packs/nuxt/skills/review-fix-violations/SKILL.md +0 -43
  217. package/packs/nuxt/skills/review-review/SKILL.md +0 -45
  218. package/packs/react/ARCHITECTURE.md +0 -991
  219. package/packs/react/CLAUDE.md +0 -102
  220. package/packs/react/agents/builder.md +0 -113
  221. package/packs/react/agents/doctor.md +0 -203
  222. package/packs/react/agents/migrator.md +0 -101
  223. package/packs/react/agents/reviewer.md +0 -252
  224. package/packs/react/agents-lite/builder.md +0 -65
  225. package/packs/react/agents-lite/doctor.md +0 -64
  226. package/packs/react/agents-lite/migrator.md +0 -74
  227. package/packs/react/agents-lite/reviewer.md +0 -69
  228. package/packs/react/skills/dev-create-component/SKILL.md +0 -53
  229. package/packs/react/skills/dev-create-hook/SKILL.md +0 -78
  230. package/packs/react/skills/dev-create-module/SKILL.md +0 -51
  231. package/packs/react/skills/dev-create-service/SKILL.md +0 -34
  232. package/packs/react/skills/dev-create-test/SKILL.md +0 -92
  233. package/packs/react/skills/dev-generate-types/SKILL.md +0 -37
  234. package/packs/react/skills/docs-onboard/SKILL.md +0 -42
  235. package/packs/react/skills/migration-migrate-component/SKILL.md +0 -44
  236. package/packs/react/skills/migration-migrate-module/SKILL.md +0 -25
  237. package/packs/react/skills/review-check-architecture/SKILL.md +0 -73
  238. package/packs/react/skills/review-fix-violations/SKILL.md +0 -45
  239. package/packs/react/skills/review-review/SKILL.md +0 -44
  240. package/packs/svelte/ARCHITECTURE.md +0 -975
  241. package/packs/svelte/CLAUDE.md +0 -102
  242. package/packs/svelte/agents/builder.md +0 -114
  243. package/packs/svelte/agents/doctor.md +0 -174
  244. package/packs/svelte/agents/migrator.md +0 -101
  245. package/packs/svelte/agents/reviewer.md +0 -238
  246. package/packs/svelte/agents-lite/builder.md +0 -66
  247. package/packs/svelte/agents-lite/doctor.md +0 -67
  248. package/packs/svelte/agents-lite/migrator.md +0 -82
  249. package/packs/svelte/agents-lite/reviewer.md +0 -70
  250. package/packs/svelte/skills/dev-create-component/SKILL.md +0 -77
  251. package/packs/svelte/skills/dev-create-module/SKILL.md +0 -59
  252. package/packs/svelte/skills/dev-create-service/SKILL.md +0 -35
  253. package/packs/svelte/skills/dev-create-store/SKILL.md +0 -94
  254. package/packs/svelte/skills/dev-create-test/SKILL.md +0 -98
  255. package/packs/svelte/skills/dev-generate-types/SKILL.md +0 -37
  256. package/packs/svelte/skills/docs-onboard/SKILL.md +0 -47
  257. package/packs/svelte/skills/migration-migrate-component/SKILL.md +0 -51
  258. package/packs/svelte/skills/migration-migrate-module/SKILL.md +0 -25
  259. package/packs/svelte/skills/review-check-architecture/SKILL.md +0 -79
  260. package/packs/svelte/skills/review-fix-violations/SKILL.md +0 -47
  261. package/packs/svelte/skills/review-review/SKILL.md +0 -45
  262. package/packs/vue/ARCHITECTURE.md +0 -798
  263. package/packs/vue/CLAUDE.md +0 -102
  264. package/packs/vue/agents/builder.md +0 -112
  265. package/packs/vue/agents/doctor.md +0 -185
  266. package/packs/vue/agents/migrator.md +0 -101
  267. package/packs/vue/agents/reviewer.md +0 -249
  268. package/packs/vue/agents-lite/builder.md +0 -65
  269. package/packs/vue/agents-lite/doctor.md +0 -63
  270. package/packs/vue/agents-lite/migrator.md +0 -73
  271. package/packs/vue/agents-lite/reviewer.md +0 -68
  272. package/packs/vue/skills/dev-create-component/SKILL.md +0 -58
  273. package/packs/vue/skills/dev-create-composable/SKILL.md +0 -31
  274. package/packs/vue/skills/dev-create-module/SKILL.md +0 -50
  275. package/packs/vue/skills/dev-create-service/SKILL.md +0 -34
  276. package/packs/vue/skills/dev-create-test/SKILL.md +0 -62
  277. package/packs/vue/skills/dev-generate-types/SKILL.md +0 -37
  278. package/packs/vue/skills/docs-onboard/SKILL.md +0 -42
  279. package/packs/vue/skills/migration-migrate-component/SKILL.md +0 -41
  280. package/packs/vue/skills/migration-migrate-module/SKILL.md +0 -25
  281. package/packs/vue/skills/review-check-architecture/SKILL.md +0 -73
  282. package/packs/vue/skills/review-fix-violations/SKILL.md +0 -42
  283. package/packs/vue/skills/review-review/SKILL.md +0 -43
  284. package/skills/audit/SKILL.md +0 -231
  285. package/skills/autofix/SKILL.md +0 -166
  286. package/skills/autopilot/SKILL.md +0 -286
  287. package/skills/brainstorm/SKILL.md +0 -298
  288. package/skills/checkpoint/SKILL.md +0 -217
  289. package/skills/codereview/SKILL.md +0 -268
  290. package/skills/commit/SKILL.md +0 -150
  291. package/skills/copywriting/SKILL.md +0 -218
  292. package/skills/cro/SKILL.md +0 -234
  293. package/skills/debug/SKILL.md +0 -210
  294. package/skills/design-review/SKILL.md +0 -217
  295. package/skills/discovery/SKILL.md +0 -218
  296. package/skills/estimate/SKILL.md +0 -154
  297. package/skills/finish/SKILL.md +0 -220
  298. package/skills/grill/SKILL.md +0 -270
  299. package/skills/health/SKILL.md +0 -251
  300. package/skills/improve-architecture/SKILL.md +0 -205
  301. package/skills/learn/SKILL.md +0 -260
  302. package/skills/lint/SKILL.md +0 -126
  303. package/skills/migrate-architecture/SKILL.md +0 -242
  304. package/skills/migrate-framework/SKILL.md +0 -172
  305. package/skills/onboard/SKILL.md +0 -168
  306. package/skills/plan/SKILL.md +0 -141
  307. package/skills/prd/SKILL.md +0 -241
  308. package/skills/recall/SKILL.md +0 -112
  309. package/skills/remember/SKILL.md +0 -108
  310. package/skills/seo-audit/SKILL.md +0 -240
  311. package/skills/tdd/SKILL.md +0 -201
  312. package/skills/tutorial/SKILL.md +0 -346
  313. package/skills/verify/SKILL.md +0 -168
  314. package/skills/worktree/SKILL.md +0 -168
  315. package/skills/write-skill/SKILL.md +0 -225
  316. package/templates/autopilot/PROMPT.md +0 -39
  317. package/templates/autopilot/README.md +0 -122
  318. package/templates/autopilot/devcontainer.json +0 -21
  319. package/templates/industry/ecommerce.md +0 -127
  320. package/templates/industry/fintech.md +0 -161
  321. package/templates/industry/saas.md +0 -134
  322. package/templates/session-memory.json +0 -48
  323. 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
- }