@hasna/skills 0.1.26 → 0.1.29

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 (491) hide show
  1. package/LICENSE +1 -10
  2. package/README.md +141 -39
  3. package/bin/index.js +30122 -27575
  4. package/bin/mcp.js +22112 -18593
  5. package/dist/cli/cli.test-utils.d.ts +15 -0
  6. package/dist/cli/commands/auth.d.ts +2 -0
  7. package/dist/cli/commands/install.d.ts +1 -1
  8. package/dist/cli/commands/runtime-mcp.d.ts +4 -0
  9. package/dist/index.d.ts +9 -4
  10. package/dist/index.js +11607 -597
  11. package/dist/lib/auth-store.d.ts +13 -0
  12. package/dist/lib/installer.d.ts +58 -55
  13. package/dist/lib/mcp-contracts.d.ts +86 -0
  14. package/dist/lib/project-state.d.ts +43 -0
  15. package/dist/lib/registry-data/business-marketing.d.ts +2 -0
  16. package/dist/lib/registry-data/communication.d.ts +2 -0
  17. package/dist/lib/registry-data/content-generation.d.ts +2 -0
  18. package/dist/lib/registry-data/data-analysis.d.ts +2 -0
  19. package/dist/lib/registry-data/design-branding.d.ts +2 -0
  20. package/dist/lib/registry-data/development-tools.d.ts +2 -0
  21. package/dist/lib/registry-data/education-learning.d.ts +2 -0
  22. package/dist/lib/registry-data/event-management.d.ts +2 -0
  23. package/dist/lib/registry-data/finance-compliance.d.ts +2 -0
  24. package/dist/lib/registry-data/health-wellness.d.ts +2 -0
  25. package/dist/lib/registry-data/index.d.ts +2 -0
  26. package/dist/lib/registry-data/media-processing.d.ts +2 -0
  27. package/dist/lib/registry-data/productivity-organization.d.ts +2 -0
  28. package/dist/lib/registry-data/project-management.d.ts +2 -0
  29. package/dist/lib/registry-data/research-writing.d.ts +2 -0
  30. package/dist/lib/registry-data/science-academic.d.ts +2 -0
  31. package/dist/lib/registry-data/travel-lifestyle.d.ts +2 -0
  32. package/dist/lib/registry-data/web-browser.d.ts +2 -0
  33. package/dist/lib/registry-types.d.ts +27 -0
  34. package/dist/lib/registry.d.ts +6 -18
  35. package/dist/lib/remote-registry.d.ts +3 -0
  36. package/dist/lib/run-state.d.ts +60 -0
  37. package/dist/lib/skill-aliases.d.ts +17 -0
  38. package/dist/lib/skillinfo.d.ts +5 -1
  39. package/dist/mcp/discovery-tools.d.ts +2 -0
  40. package/dist/mcp/helpers.d.ts +26 -0
  41. package/dist/mcp/http.d.ts +10 -0
  42. package/dist/mcp/index.d.ts +3 -2
  43. package/dist/mcp/operation-tools.d.ts +2 -0
  44. package/dist/mcp/resource-meta-tools.d.ts +2 -0
  45. package/dist/mcp/schedule-tools.d.ts +2 -0
  46. package/dist/mcp/server.d.ts +4 -0
  47. package/dist/types/api.d.ts +7 -4
  48. package/package.json +23 -10
  49. package/skills/_common/http-client.ts +1 -1
  50. package/skills/_common/index.ts +2 -3
  51. package/skills/_common/install.sh +5 -110
  52. package/skills/_common/installer.ts +31 -282
  53. package/skills/_common/skill-install.ts +14 -181
  54. package/skills/ad-creative-pack/SKILL.md +45 -0
  55. package/skills/ad-creative-pack/package.json +14 -0
  56. package/skills/advanced-math/package.json +3 -1
  57. package/skills/advanced-math/src/calculators.ts +118 -0
  58. package/skills/advanced-math/src/cli.ts +130 -0
  59. package/skills/advanced-math/src/conversion.ts +90 -0
  60. package/skills/advanced-math/src/finance.ts +75 -0
  61. package/skills/advanced-math/src/formatting.ts +95 -0
  62. package/skills/advanced-math/src/index.ts +24 -702
  63. package/skills/advanced-math/src/runtime.ts +49 -0
  64. package/skills/advanced-math/src/symbolic.ts +110 -0
  65. package/skills/advanced-math/src/types.ts +36 -0
  66. package/skills/analyze-data/SKILL.md +2 -2
  67. package/skills/analyze-data/src/analysis.ts +401 -0
  68. package/skills/analyze-data/src/cli.ts +66 -0
  69. package/skills/analyze-data/src/formatters.ts +235 -0
  70. package/skills/analyze-data/src/index.ts +6 -1027
  71. package/skills/analyze-data/src/logger.ts +36 -0
  72. package/skills/analyze-data/src/parsers.ts +57 -0
  73. package/skills/analyze-data/src/stats.ts +151 -0
  74. package/skills/analyze-data/src/types.ts +85 -0
  75. package/skills/api-docs-portal/SKILL.md +46 -0
  76. package/skills/api-docs-portal/package.json +9 -0
  77. package/skills/api-test-suite/src/index.ts +13 -0
  78. package/skills/apidocs/package.json +1 -1
  79. package/skills/apidocs/src/index.ts +3 -0
  80. package/skills/audio/package.json +2 -3
  81. package/skills/audio-cleanup-lab/SKILL.md +2 -2
  82. package/skills/audio-extract/CLAUDE.md +1 -1
  83. package/skills/audio-transcript-pack/SKILL.md +43 -0
  84. package/skills/audio-transcript-pack/package.json +10 -0
  85. package/skills/blog-article/CLAUDE.md +12 -0
  86. package/skills/blog-article/SKILL.md +45 -0
  87. package/skills/{create-blog-article → blog-article}/package.json +3 -3
  88. package/skills/brand-kit/SKILL.md +45 -0
  89. package/skills/brand-kit/package.json +14 -0
  90. package/skills/brand-photo-shoot/SKILL.md +28 -0
  91. package/skills/brand-photo-shoot/package.json +10 -0
  92. package/skills/brand-style-guide/SKILL.md +2 -2
  93. package/skills/brand-style-guide/src/index.ts +0 -0
  94. package/skills/budget-variance-analyzer/SKILL.md +2 -2
  95. package/skills/businessactivity/package.json +1 -1
  96. package/skills/businessactivity/src/index.ts +3 -0
  97. package/skills/calendar-events/src/ai-parser.ts +103 -0
  98. package/skills/calendar-events/src/api.ts +157 -0
  99. package/skills/calendar-events/src/auth.ts +22 -0
  100. package/skills/calendar-events/src/config.ts +6 -0
  101. package/skills/calendar-events/src/format.ts +96 -0
  102. package/skills/calendar-events/src/help.ts +54 -0
  103. package/skills/calendar-events/src/index.ts +21 -524
  104. package/skills/calendar-events/src/logger.ts +34 -0
  105. package/skills/calendar-events/src/types.ts +67 -0
  106. package/skills/compress-video/SKILL.md +2 -2
  107. package/skills/consolelog/package.json +1 -1
  108. package/skills/consolelog/src/index.ts +3 -0
  109. package/skills/contract-review-report/SKILL.md +43 -0
  110. package/skills/contract-review-report/package.json +10 -0
  111. package/skills/convert/SKILL.md +2 -3
  112. package/skills/customer-feedback-report/SKILL.md +44 -0
  113. package/skills/customer-feedback-report/package.json +10 -0
  114. package/skills/dashboard-builder/package.json +3 -1
  115. package/skills/database-explorer/package.json +3 -1
  116. package/skills/deepresearch/README.md +4 -13
  117. package/skills/deploy/src/http-client.ts +1 -1
  118. package/skills/diff-viewer/package.json +4 -1
  119. package/skills/doc-generate/package.json +0 -1
  120. package/skills/doc-generate/src/ai.ts +50 -0
  121. package/skills/doc-generate/src/cli.ts +203 -0
  122. package/skills/doc-generate/src/dependencies.ts +44 -0
  123. package/skills/doc-generate/src/document-builder.ts +299 -0
  124. package/skills/doc-generate/src/index.ts +40 -764
  125. package/skills/doc-generate/src/markdown-parser.ts +125 -0
  126. package/skills/doc-generate/src/types.ts +68 -0
  127. package/skills/domainpurchase/SKILL.md +1 -1
  128. package/skills/domainpurchase/package.json +1 -1
  129. package/skills/domainpurchase/src/index.ts +3 -0
  130. package/skills/domainsearch/SKILL.md +1 -1
  131. package/skills/domainsearch/package.json +1 -1
  132. package/skills/domainsearch/src/index.ts +3 -0
  133. package/skills/email-sequence/SKILL.md +44 -0
  134. package/skills/email-sequence/package.json +14 -0
  135. package/skills/excel/CLAUDE.md +2 -2
  136. package/skills/experiment-power-calculator/package.json +3 -1
  137. package/skills/extract-invoice/src/cli.ts +97 -0
  138. package/skills/extract-invoice/src/extractor.ts +170 -0
  139. package/skills/extract-invoice/src/file-utils.ts +46 -0
  140. package/skills/extract-invoice/src/formatters.ts +144 -0
  141. package/skills/extract-invoice/src/index.ts +44 -629
  142. package/skills/extract-invoice/src/runtime.ts +46 -0
  143. package/skills/extract-invoice/src/types.ts +88 -0
  144. package/skills/folder-tree/package.json +3 -1
  145. package/skills/form-filler/package.json +3 -1
  146. package/skills/generate-api-client/package.json +3 -1
  147. package/skills/generate-api-client/src/generator.ts +47 -0
  148. package/skills/generate-api-client/src/index.ts +3 -777
  149. package/skills/generate-api-client/src/logger.ts +34 -0
  150. package/skills/generate-api-client/src/python-generator.ts +245 -0
  151. package/skills/generate-api-client/src/spec-loader.ts +48 -0
  152. package/skills/generate-api-client/src/type-mappers.ts +79 -0
  153. package/skills/generate-api-client/src/types.ts +76 -0
  154. package/skills/generate-api-client/src/typescript-generator.ts +247 -0
  155. package/skills/generate-book-cover/package.json +3 -1
  156. package/skills/generate-dockerfile/src/cli.ts +78 -0
  157. package/skills/generate-dockerfile/src/dockerfile-templates.ts +392 -0
  158. package/skills/generate-dockerfile/src/index.ts +12 -790
  159. package/skills/generate-dockerfile/src/logger.ts +30 -0
  160. package/skills/generate-dockerfile/src/project-detection.ts +68 -0
  161. package/skills/generate-dockerfile/src/support-files.ts +171 -0
  162. package/skills/generate-dockerfile/src/types.ts +29 -0
  163. package/skills/generate-documentation/src/ai.ts +131 -0
  164. package/skills/generate-documentation/src/cli.ts +71 -0
  165. package/skills/generate-documentation/src/code-parser.ts +300 -0
  166. package/skills/generate-documentation/src/file-processing.ts +182 -0
  167. package/skills/generate-documentation/src/index.ts +13 -753
  168. package/skills/generate-documentation/src/runtime.ts +35 -0
  169. package/skills/generate-documentation/src/types.ts +30 -0
  170. package/skills/generate-env/package.json +3 -1
  171. package/skills/generate-env/src/cli.ts +85 -0
  172. package/skills/generate-env/src/detection.ts +161 -0
  173. package/skills/generate-env/src/env-data.ts +66 -0
  174. package/skills/generate-env/src/generators.ts +240 -0
  175. package/skills/generate-env/src/index.ts +76 -676
  176. package/skills/generate-env/src/runtime.ts +30 -0
  177. package/skills/generate-env/src/types.ts +32 -0
  178. package/skills/generate-favicon/package.json +3 -1
  179. package/skills/generate-mock-data/package.json +3 -1
  180. package/skills/generate-mock-data/src/ai.ts +102 -0
  181. package/skills/generate-mock-data/src/formatters.ts +84 -0
  182. package/skills/generate-mock-data/src/generator.ts +377 -0
  183. package/skills/generate-mock-data/src/index.ts +15 -716
  184. package/skills/generate-mock-data/src/logger.ts +37 -0
  185. package/skills/generate-mock-data/src/presets.ts +110 -0
  186. package/skills/generate-mock-data/src/types.ts +21 -0
  187. package/skills/generate-pr-description/src/ai.ts +144 -0
  188. package/skills/generate-pr-description/src/cli.ts +80 -0
  189. package/skills/generate-pr-description/src/clipboard.ts +30 -0
  190. package/skills/generate-pr-description/src/formatters.ts +231 -0
  191. package/skills/generate-pr-description/src/git.ts +153 -0
  192. package/skills/generate-pr-description/src/index.ts +21 -714
  193. package/skills/generate-pr-description/src/types.ts +49 -0
  194. package/skills/generate-presentation/src/ai-clients.ts +61 -0
  195. package/skills/generate-presentation/src/cli.ts +126 -0
  196. package/skills/generate-presentation/src/index.ts +3 -751
  197. package/skills/generate-presentation/src/logger.ts +67 -0
  198. package/skills/generate-presentation/src/presentation-generator.ts +425 -0
  199. package/skills/generate-presentation/src/runtime.ts +6 -0
  200. package/skills/generate-presentation/src/security.ts +12 -0
  201. package/skills/generate-presentation/src/types.ts +28 -0
  202. package/skills/generate-qrcode/package.json +4 -1
  203. package/skills/generate-regex/package.json +3 -1
  204. package/skills/generate-resume/src/cli.ts +157 -0
  205. package/skills/generate-resume/src/index.ts +13 -917
  206. package/skills/generate-resume/src/parsers.ts +95 -0
  207. package/skills/generate-resume/src/renderers.ts +538 -0
  208. package/skills/generate-resume/src/security.ts +39 -0
  209. package/skills/generate-resume/src/types.ts +86 -0
  210. package/skills/generate-social-posts/src/ai.ts +88 -0
  211. package/skills/generate-social-posts/src/cli.ts +118 -0
  212. package/skills/generate-social-posts/src/exporters.ts +126 -0
  213. package/skills/generate-social-posts/src/generator.ts +130 -0
  214. package/skills/generate-social-posts/src/index.ts +19 -709
  215. package/skills/generate-social-posts/src/platforms.ts +39 -0
  216. package/skills/generate-social-posts/src/runtime.ts +34 -0
  217. package/skills/generate-social-posts/src/source.ts +116 -0
  218. package/skills/generate-social-posts/src/types.ts +58 -0
  219. package/skills/gif-maker/package.json +4 -1
  220. package/skills/github-manager/package.json +3 -1
  221. package/skills/gmail/CLAUDE.md +1 -1
  222. package/skills/highlight-reel-generator/src/index.ts +19 -0
  223. package/skills/hook/src/commands/create.ts +20 -845
  224. package/skills/hook/src/templates/root.ts +196 -0
  225. package/skills/hook/src/templates/source.ts +647 -0
  226. package/skills/http-server/package.json +3 -1
  227. package/skills/icon-pack/README.md +28 -0
  228. package/skills/icon-pack/SKILL.md +23 -0
  229. package/skills/icon-pack/package.json +29 -0
  230. package/skills/{audio → icon-pack}/tsconfig.json +10 -12
  231. package/skills/image/package.json +1 -2
  232. package/skills/implementation-agent/package.json +3 -1
  233. package/skills/implementation-agent/src/ai-generation.ts +225 -0
  234. package/skills/implementation-agent/src/index.ts +3 -960
  235. package/skills/implementation-agent/src/minimist.d.ts +15 -0
  236. package/skills/implementation-agent/src/templates.ts +686 -0
  237. package/skills/implementation-agent/src/types.ts +53 -0
  238. package/skills/implementation-plan/package.json +3 -1
  239. package/skills/implementation-todo/package.json +3 -1
  240. package/skills/invoice/package.json +1 -1
  241. package/skills/invoice/src/index.ts +3 -0
  242. package/skills/invoice-reconciliation/SKILL.md +42 -0
  243. package/skills/invoice-reconciliation/package.json +10 -0
  244. package/skills/landing-page-pack/SKILL.md +47 -0
  245. package/skills/landing-page-pack/package.json +14 -0
  246. package/skills/latex-table-generator/package.json +3 -1
  247. package/skills/logo-design/SKILL.md +25 -44
  248. package/skills/logo-design/package.json +3 -15
  249. package/skills/lorem-generator/package.json +3 -1
  250. package/skills/lorem-generator/src/index.ts +13 -0
  251. package/skills/managehook/package.json +1 -1
  252. package/skills/managehook/src/index.ts +3 -0
  253. package/skills/managemcp/package.json +1 -1
  254. package/skills/managemcp/src/index.ts +3 -0
  255. package/skills/manageskill/package.json +1 -1
  256. package/skills/manageskill/src/index.ts +3 -0
  257. package/skills/markdown-validator/package.json +3 -1
  258. package/skills/markdown-validator/src/index.ts +1 -4
  259. package/skills/market-research-report/SKILL.md +41 -0
  260. package/skills/market-research-report/package.json +10 -0
  261. package/skills/mcp-builder/package.json +4 -1
  262. package/skills/mcp-builder/src/ai-descriptions.ts +37 -0
  263. package/skills/mcp-builder/src/generators.ts +513 -0
  264. package/skills/mcp-builder/src/index.ts +7 -908
  265. package/skills/mcp-builder/src/minimist.d.ts +15 -0
  266. package/skills/mcp-builder/src/naming.ts +12 -0
  267. package/skills/mcp-builder/src/options.ts +170 -0
  268. package/skills/mcp-builder/src/templates.ts +149 -0
  269. package/skills/mcp-builder/src/types.ts +42 -0
  270. package/skills/meeting-pack/SKILL.md +43 -0
  271. package/skills/meeting-pack/package.json +10 -0
  272. package/skills/merge-pdfs/package.json +5 -1
  273. package/skills/migration-plan-pack/SKILL.md +45 -0
  274. package/skills/migration-plan-pack/package.json +10 -0
  275. package/skills/music/package.json +2 -3
  276. package/skills/music-album/SKILL.md +37 -0
  277. package/skills/music-album/package.json +10 -0
  278. package/skills/notion-manager/package.json +3 -1
  279. package/skills/npmpublish/CLAUDE.md +5 -8
  280. package/skills/npmpublish/README.md +5 -26
  281. package/skills/npmpublish/src/index.ts +9 -147
  282. package/skills/one-page-website/SKILL.md +46 -0
  283. package/skills/one-page-website/package.json +10 -0
  284. package/skills/one-page-website/tsconfig.json +8 -0
  285. package/skills/pdf-generate/src/cli.ts +162 -0
  286. package/skills/pdf-generate/src/html.ts +84 -0
  287. package/skills/pdf-generate/src/index.ts +11 -800
  288. package/skills/pdf-generate/src/markdown.ts +27 -0
  289. package/skills/pdf-generate/src/pdf-writer.ts +78 -0
  290. package/skills/pdf-generate/src/runtime.ts +34 -0
  291. package/skills/pdf-generate/src/security.ts +37 -0
  292. package/skills/pdf-generate/src/templates.ts +311 -0
  293. package/skills/pdf-generate/src/types.ts +28 -0
  294. package/skills/pdf-read/SKILL.md +10 -10
  295. package/skills/pdf-to-dataset/SKILL.md +45 -0
  296. package/skills/pdf-to-dataset/package.json +10 -0
  297. package/skills/pdf-to-markdown/SKILL.md +49 -0
  298. package/skills/pdf-to-markdown/package.json +10 -0
  299. package/skills/pdf-to-markdown/tsconfig.json +10 -0
  300. package/skills/performance-audit-report/SKILL.md +42 -0
  301. package/skills/performance-audit-report/package.json +10 -0
  302. package/skills/persona-based-adwriter/src/index.ts +19 -0
  303. package/skills/photo-album/SKILL.md +29 -0
  304. package/skills/photo-album/package.json +9 -0
  305. package/skills/photo-album/tsconfig.json +4 -0
  306. package/skills/pitch-deck/SKILL.md +43 -0
  307. package/skills/pitch-deck/package.json +9 -0
  308. package/skills/playlist-maker/SKILL.md +33 -0
  309. package/skills/playlist-maker/package.json +9 -0
  310. package/skills/playlist-maker/tsconfig.json +4 -0
  311. package/skills/product-mockup/SKILL.md +45 -0
  312. package/skills/product-mockup/package.json +3 -20
  313. package/skills/product-mockup/tsconfig.json +3 -5
  314. package/skills/project-retro-companion/src/index.ts +19 -0
  315. package/skills/proposal-pack/SKILL.md +45 -0
  316. package/skills/proposal-pack/package.json +10 -0
  317. package/skills/read-pdf/SKILL.md +5 -4
  318. package/skills/repo-onboarding-report/SKILL.md +42 -0
  319. package/skills/repo-onboarding-report/package.json +10 -0
  320. package/skills/sales-call-recapper/src/index.ts +20 -0
  321. package/skills/salescopy/package.json +1 -1
  322. package/skills/salescopy/src/index.ts +3 -0
  323. package/skills/scaffold-project/src/ai-detect.ts +136 -0
  324. package/skills/scaffold-project/src/file-generators.ts +292 -0
  325. package/skills/scaffold-project/src/index.ts +8 -991
  326. package/skills/scaffold-project/src/project-config.ts +338 -0
  327. package/skills/scaffold-project/src/templates.ts +173 -0
  328. package/skills/scaffold-project/src/types.ts +58 -0
  329. package/skills/scientific-figure-check/package.json +3 -1
  330. package/skills/sdk-generator/SKILL.md +45 -0
  331. package/skills/sdk-generator/package.json +10 -0
  332. package/skills/sdk-generator/tsconfig.json +8 -0
  333. package/skills/security-audit/src/index.ts +25 -6
  334. package/skills/security-audit-report/SKILL.md +40 -0
  335. package/skills/security-audit-report/package.json +10 -0
  336. package/skills/seo-content-pack/SKILL.md +44 -0
  337. package/skills/seo-content-pack/package.json +9 -0
  338. package/skills/short-video-pack/SKILL.md +30 -0
  339. package/skills/short-video-pack/package.json +10 -0
  340. package/skills/slack-assistant/package.json +3 -1
  341. package/skills/slide-deck-generator/SKILL.md +44 -0
  342. package/skills/slide-deck-generator/package.json +10 -0
  343. package/skills/sms/package.json +1 -1
  344. package/skills/sms/src/index.ts +15 -0
  345. package/skills/social-content-calendar/SKILL.md +45 -0
  346. package/skills/social-content-calendar/package.json +14 -0
  347. package/skills/split-pdf/package.json +4 -1
  348. package/skills/subtitle/package.json +2 -1
  349. package/skills/subtitle/src/index.ts +3 -0
  350. package/skills/terraform-generator/package.json +3 -1
  351. package/skills/test-suite-generator/SKILL.md +41 -0
  352. package/skills/test-suite-generator/package.json +10 -0
  353. package/skills/timesheet/package.json +1 -1
  354. package/skills/timesheet/src/index.ts +3 -0
  355. package/skills/transcript/SKILL.md +1 -8
  356. package/skills/validate-config/package.json +3 -1
  357. package/skills/video/package.json +6 -4
  358. package/skills/video-downloader/package.json +3 -1
  359. package/skills/video-highlight-pack/SKILL.md +44 -0
  360. package/skills/video-highlight-pack/package.json +10 -0
  361. package/skills/voiceover-jingle-pack/SKILL.md +28 -0
  362. package/skills/voiceover-jingle-pack/package.json +10 -0
  363. package/skills/watermark/package.json +6 -1
  364. package/skills/webcrawling/package.json +2 -1
  365. package/skills/write/SKILL.md +6 -6
  366. package/dist/server/serve.d.ts +0 -11
  367. package/skills/apidocs/.claude/settings.json +0 -5
  368. package/skills/audio/.env.example +0 -14
  369. package/skills/audio/QUICKSTART.md +0 -158
  370. package/skills/audio/README.md +0 -256
  371. package/skills/audio/src/index-local.ts +0 -206
  372. package/skills/audio/src/index.ts +0 -95
  373. package/skills/audio/src/providers/elevenlabs.ts +0 -115
  374. package/skills/audio/src/providers/google.ts +0 -116
  375. package/skills/audio/src/providers/minimax.ts +0 -83
  376. package/skills/audio/src/providers/openai.ts +0 -115
  377. package/skills/audio/src/types.ts +0 -79
  378. package/skills/audiobook-chapter-proofer/CLAUDE.md +0 -19
  379. package/skills/audiobook-chapter-proofer/package.json +0 -27
  380. package/skills/audiobook-chapter-proofer/src/index.ts +0 -285
  381. package/skills/browse/src/client.ts +0 -373
  382. package/skills/browse/src/index-local.ts +0 -430
  383. package/skills/browse/src/index.ts +0 -110
  384. package/skills/browse/src/sse-server.ts +0 -919
  385. package/skills/browse/src/types.ts +0 -104
  386. package/skills/consolelog/src/server/index.ts +0 -508
  387. package/skills/create-blog-article/CLAUDE.md +0 -19
  388. package/skills/create-blog-article/src/index.ts +0 -745
  389. package/skills/create-blog-article/tsconfig.json +0 -10
  390. package/skills/deepresearch/src/agents/query-generator.ts +0 -91
  391. package/skills/deepresearch/src/agents/synthesizer.ts +0 -111
  392. package/skills/deepresearch/src/index.ts +0 -224
  393. package/skills/deepresearch/src/research.ts +0 -166
  394. package/skills/deepresearch/src/services/anthropic.ts +0 -69
  395. package/skills/deepresearch/src/services/exa.ts +0 -108
  396. package/skills/deepresearch/src/services/firecrawl.ts +0 -88
  397. package/skills/deepresearch/src/services/openai.ts +0 -81
  398. package/skills/deepresearch/src/types.ts +0 -76
  399. package/skills/deepresearch/src/utils/file.ts +0 -111
  400. package/skills/deepresearch/src/utils/logger.ts +0 -84
  401. package/skills/domainpurchase/src/server/index.ts +0 -332
  402. package/skills/domainsearch/src/server/index.ts +0 -229
  403. package/skills/e2bswarm/README.md +0 -135
  404. package/skills/e2bswarm/SKILL.md +0 -118
  405. package/skills/e2bswarm/examples/tasks-example.json +0 -38
  406. package/skills/e2bswarm/package.json +0 -59
  407. package/skills/e2bswarm/src/commands/collect.ts +0 -135
  408. package/skills/e2bswarm/src/commands/install.ts +0 -164
  409. package/skills/e2bswarm/src/commands/kill.ts +0 -62
  410. package/skills/e2bswarm/src/commands/spawn.ts +0 -134
  411. package/skills/e2bswarm/src/commands/status.ts +0 -90
  412. package/skills/e2bswarm/src/commands/sync.ts +0 -208
  413. package/skills/e2bswarm/src/index.ts +0 -121
  414. package/skills/e2bswarm/src/lib/config.ts +0 -75
  415. package/skills/e2bswarm/src/lib/e2b.ts +0 -490
  416. package/skills/e2bswarm/src/lib/github.ts +0 -253
  417. package/skills/e2bswarm/src/lib/logger.ts +0 -41
  418. package/skills/e2bswarm/src/lib/paths.ts +0 -75
  419. package/skills/e2bswarm/src/lib/tasks.ts +0 -320
  420. package/skills/e2bswarm/src/types/index.ts +0 -107
  421. package/skills/e2bswarm/templates/codebox/e2b.Dockerfile +0 -38
  422. package/skills/e2bswarm/templates/codebox/e2b.toml +0 -3
  423. package/skills/e2bswarm/templates/setup.sh +0 -21
  424. package/skills/e2bswarm/tsconfig.json +0 -19
  425. package/skills/generate-book-cover/src/index.ts +0 -694
  426. package/skills/image/src/index-local.ts +0 -206
  427. package/skills/image/src/index.ts +0 -96
  428. package/skills/image/src/providers/google.ts +0 -79
  429. package/skills/image/src/providers/minimax.ts +0 -94
  430. package/skills/image/src/providers/openai.ts +0 -80
  431. package/skills/image/src/providers/xai.ts +0 -73
  432. package/skills/image/src/types.ts +0 -37
  433. package/skills/logo-design/CLAUDE.md +0 -30
  434. package/skills/logo-design/src/index.ts +0 -322
  435. package/skills/managehook/src/server/index.ts +0 -108
  436. package/skills/managemcp/src/server/index.ts +0 -108
  437. package/skills/manageskill/src/server/index.ts +0 -108
  438. package/skills/music/CLAUDE.md +0 -9
  439. package/skills/music/src/index.ts +0 -94
  440. package/skills/music/tsconfig.json +0 -10
  441. package/skills/pdf-read/src/index.ts +0 -320
  442. package/skills/product-mockup/CLAUDE.md +0 -19
  443. package/skills/product-mockup/src/index.ts +0 -290
  444. package/skills/read-pdf/src/index.ts +0 -388
  445. package/skills/remove-background/src/index.ts +0 -405
  446. package/skills/scaffold-project/my-app/.env.example +0 -2
  447. package/skills/scaffold-project/my-app/README.md +0 -72
  448. package/skills/scaffold-project/my-app/package.json +0 -29
  449. package/skills/scaffold-project/my-app/src/index.ts +0 -23
  450. package/skills/scaffold-project/my-app/tsconfig.json +0 -33
  451. package/skills/sound-effects/SKILL.md +0 -34
  452. package/skills/sound-effects/package.json +0 -21
  453. package/skills/sound-effects/src/index.ts +0 -172
  454. package/skills/sound-effects/tsconfig.json +0 -8
  455. package/skills/transcript/src/chunker.ts +0 -215
  456. package/skills/transcript/src/formatter.ts +0 -134
  457. package/skills/transcript/src/index-local.ts +0 -226
  458. package/skills/transcript/src/index.ts +0 -110
  459. package/skills/transcript/src/providers/elevenlabs.ts +0 -133
  460. package/skills/transcript/src/providers/gemini.ts +0 -192
  461. package/skills/transcript/src/providers/index.ts +0 -54
  462. package/skills/transcript/src/providers/openai.ts +0 -203
  463. package/skills/transcript/src/types.ts +0 -106
  464. package/skills/video/.env.example +0 -14
  465. package/skills/video/EXAMPLES.md +0 -266
  466. package/skills/video/LICENSE +0 -192
  467. package/skills/video/README.md +0 -174
  468. package/skills/video/src/cli.ts +0 -155
  469. package/skills/video/src/index-local.ts +0 -148
  470. package/skills/video/src/index.ts +0 -96
  471. package/skills/video/src/providers/google-veo.ts +0 -126
  472. package/skills/video/src/providers/index.ts +0 -22
  473. package/skills/video/src/providers/minimax.ts +0 -100
  474. package/skills/video/src/providers/openai-sora.ts +0 -164
  475. package/skills/video/src/providers/runway.ts +0 -159
  476. package/skills/video/src/types.ts +0 -35
  477. package/skills/video/tsconfig.json +0 -22
  478. package/skills/voiceover-casting-assistant/CLAUDE.md +0 -19
  479. package/skills/voiceover-casting-assistant/package.json +0 -27
  480. package/skills/voiceover-casting-assistant/src/index.ts +0 -255
  481. package/skills/voiceover-casting-assistant/tsconfig.json +0 -10
  482. package/skills/webcrawling/src/commands/config.ts +0 -34
  483. package/skills/webcrawling/src/commands/crawl.ts +0 -33
  484. package/skills/webcrawling/src/commands/scrape.ts +0 -32
  485. package/skills/webcrawling/src/commands/sessions.ts +0 -42
  486. package/skills/webcrawling/src/lib/crawler.ts +0 -174
  487. package/skills/webcrawling/src/lib/storage.ts +0 -130
  488. package/skills/webcrawling/src/types/index.ts +0 -45
  489. package/skills/webcrawling/src/utils/logger.ts +0 -30
  490. package/skills/webcrawling/src/utils/paths.ts +0 -28
  491. /package/skills/{audiobook-chapter-proofer → blog-article}/tsconfig.json +0 -0
@@ -5,6 +5,26 @@
5
5
  import { mkdirSync, existsSync } from 'fs';
6
6
  import { join } from 'path';
7
7
 
8
+ import {
9
+ generateBunfig,
10
+ generateGitignore,
11
+ generateHookConfig,
12
+ generateHookMd,
13
+ generatePackageJson,
14
+ generateReadme,
15
+ generateTsConfig,
16
+ } from '../templates/root';
17
+ import {
18
+ generateClaudeTs,
19
+ generateConfigTs,
20
+ generateCoreTs,
21
+ generateIndexTs,
22
+ generateLoggerTs,
23
+ generateRunTs,
24
+ generateSetupTs,
25
+ generateTestTs,
26
+ } from '../templates/source';
27
+
8
28
  interface CreateOptions {
9
29
  event?: string;
10
30
  matcher?: string;
@@ -90,848 +110,3 @@ async function writeFile(path: string, content: string): Promise<void> {
90
110
  // ============================================================================
91
111
  // TEMPLATE GENERATORS
92
112
  // ============================================================================
93
-
94
- function generateHookConfig(hookName: string, shortName: string, event: string, matcher: string): string {
95
- return JSON.stringify(
96
- {
97
- name: hookName,
98
- description: `TODO: Describe what ${hookName} does`,
99
- version: '0.1.0',
100
- event,
101
- matcher,
102
- timeout: 5000,
103
- logFile: `${hookName}.log`,
104
- },
105
- null,
106
- 2
107
- );
108
- }
109
-
110
- function generatePackageJson(hookName: string, shortName: string): string {
111
- return JSON.stringify(
112
- {
113
- name: hookName,
114
- version: '0.1.0',
115
- description: `TODO: Describe ${hookName}`,
116
- type: 'module',
117
- main: 'src/index.ts',
118
- bin: {
119
- [hookName]: 'src/index.ts',
120
- },
121
- scripts: {
122
- start: 'bun run src/index.ts',
123
- dev: 'bun run --watch src/index.ts',
124
- test: 'bun test',
125
- },
126
- keywords: ['claude-code', 'hook', shortName],
127
- author: '',
128
- license: 'Apache-2.0',
129
- devDependencies: {
130
- '@types/bun': 'latest',
131
- },
132
- peerDependencies: {
133
- typescript: '^5.0.0',
134
- },
135
- repository: {
136
- type: 'git',
137
- url: `git+ssh://git@github.com/your-org/${hookName}.git`,
138
- },
139
- },
140
- null,
141
- 2
142
- );
143
- }
144
-
145
- function generateTsConfig(): string {
146
- return JSON.stringify(
147
- {
148
- compilerOptions: {
149
- target: 'ES2022',
150
- module: 'ESNext',
151
- moduleResolution: 'bundler',
152
- strict: true,
153
- esModuleInterop: true,
154
- skipLibCheck: true,
155
- forceConsistentCasingInFileNames: true,
156
- resolveJsonModule: true,
157
- declaration: true,
158
- declarationMap: true,
159
- outDir: './dist',
160
- rootDir: './src',
161
- },
162
- include: ['src/**/*'],
163
- exclude: ['node_modules', 'dist'],
164
- },
165
- null,
166
- 2
167
- );
168
- }
169
-
170
- function generateBunfig(): string {
171
- return `[install]
172
- peer = false
173
-
174
- [run]
175
- bun = true
176
- `;
177
- }
178
-
179
- function generateGitignore(): string {
180
- return `node_modules/
181
- dist/
182
- *.log
183
- .env
184
- .env.local
185
- .DS_Store
186
- `;
187
- }
188
-
189
- function generateReadme(hookName: string, shortName: string, event: string, matcher: string): string {
190
- return `# ${hookName}
191
-
192
- TODO: Describe what this hook does.
193
-
194
- ## Installation
195
-
196
- \`\`\`bash
197
- bun add -g git+ssh://git@github.com/your-org/${hookName}.git
198
- \`\`\`
199
-
200
- ## Setup
201
-
202
- \`\`\`bash
203
- ${hookName} setup
204
- \`\`\`
205
-
206
- This will:
207
- 1. Ask for scope (global or project)
208
- 2. Configure verbosity level
209
- 3. Create \`.claude/hooks/${hookName}.log\`
210
- 4. Update Claude Code settings
211
-
212
- ## Usage
213
-
214
- Once set up, the hook runs automatically on \`${event}\` events${matcher !== '*' ? ` for \`${matcher}\` tool` : ''}.
215
-
216
- ## Commands
217
-
218
- | Command | Description |
219
- |---------|-------------|
220
- | \`${hookName}\` | Run the hook (stdin/stdout) |
221
- | \`${hookName} setup\` | Configure Claude Code |
222
- | \`${hookName} test\` | Test the hook manually |
223
- | \`${hookName} config\` | Show configuration |
224
- | \`${hookName} logs\` | View recent logs |
225
-
226
- ## Configuration
227
-
228
- Edit \`~/.claude/hooks/${hookName}.config.json\` or \`.claude/hooks/${hookName}.config.json\`:
229
-
230
- \`\`\`json
231
- {
232
- "verbosity": "blocked",
233
- "enabled": true
234
- }
235
- \`\`\`
236
-
237
- ## License
238
-
239
- MIT
240
- `;
241
- }
242
-
243
- function generateHookMd(hookName: string, shortName: string, event: string, matcher: string): string {
244
- return `# ${hookName}
245
-
246
- ## Overview
247
-
248
- TODO: Describe what this hook does and why.
249
-
250
- ## Event
251
-
252
- - **Type**: ${event}
253
- - **Matcher**: ${matcher}
254
- - **Timeout**: 5000ms
255
-
256
- ## Behavior
257
-
258
- TODO: Describe the specific behavior of this hook.
259
-
260
- ## Examples
261
-
262
- ### Allowed
263
-
264
- TODO: Show examples of operations that are allowed.
265
-
266
- ### Blocked (if applicable)
267
-
268
- TODO: Show examples of operations that are blocked.
269
-
270
- ## Configuration Options
271
-
272
- | Option | Type | Default | Description |
273
- |--------|------|---------|-------------|
274
- | verbosity | string | "blocked" | Log level: none, blocked, all |
275
- | enabled | boolean | true | Enable/disable the hook |
276
-
277
- ## Troubleshooting
278
-
279
- ### Hook not triggering
280
-
281
- 1. Check Claude Code settings: \`cat ~/.claude/settings.json\`
282
- 2. Verify hook is installed: \`which ${hookName}\`
283
- 3. Check logs: \`${hookName} logs\`
284
-
285
- ### Performance issues
286
-
287
- Increase timeout in \`hook.config.json\` if needed.
288
- `;
289
- }
290
-
291
- function generateIndexTs(hookName: string, shortName: string): string {
292
- return `#!/usr/bin/env bun
293
-
294
- /**
295
- * ${hookName} - Claude Code hook
296
- */
297
-
298
- import { runHook } from './commands/run';
299
- import { setupHook } from './commands/setup';
300
- import { testHook } from './commands/test';
301
- import { showConfig, setConfig } from './commands/config';
302
- import { showLogs, clearLogs } from './utils/logger';
303
-
304
- // Read hook config
305
- const hookConfigPath = new URL('../hook.config.json', import.meta.url).pathname;
306
- const hookConfig = await Bun.file(hookConfigPath).json();
307
-
308
- function printHelp() {
309
- console.log(\`${hookName} v\${hookConfig.version}
310
-
311
- \${hookConfig.description}
312
-
313
- USAGE:
314
- ${hookName} [command] [options]
315
-
316
- COMMANDS:
317
- (no command) Run the hook (reads stdin, outputs JSON)
318
- setup Configure Claude Code to use this hook
319
- test [input] Test the hook with sample input
320
- config Show current configuration
321
- config set <k> <v> Update configuration
322
- logs View recent log entries
323
- logs clear Clear the log file
324
- help Show this help message
325
-
326
- OPTIONS:
327
- --global Use global scope (~/.claude)
328
- --project Use project scope (./.claude)
329
- --verbosity <lvl> Set log level: none, blocked, all
330
- --yes Skip confirmation prompts
331
- --version Show version
332
- --help Show help
333
- \`);
334
- }
335
-
336
- async function main() {
337
- const args = process.argv.slice(2);
338
- const command = args[0];
339
-
340
- // Version
341
- if (args.includes('--version') || args.includes('-v')) {
342
- console.log(hookConfig.version);
343
- process.exit(0);
344
- }
345
-
346
- // Help
347
- if (args.includes('--help') || args.includes('-h') || command === 'help') {
348
- printHelp();
349
- process.exit(0);
350
- }
351
-
352
- // Parse options
353
- const options: Record<string, string | boolean> = {};
354
- for (let i = 0; i < args.length; i++) {
355
- if (args[i] === '--global') options.global = true;
356
- else if (args[i] === '--project') options.project = true;
357
- else if (args[i] === '--yes' || args[i] === '-y') options.yes = true;
358
- else if (args[i] === '--verbosity' && args[i + 1]) {
359
- options.verbosity = args[++i];
360
- }
361
- }
362
-
363
- switch (command) {
364
- case 'setup':
365
- await setupHook(hookConfig, options);
366
- break;
367
-
368
- case 'test':
369
- await testHook(args.slice(1).filter(a => !a.startsWith('--')));
370
- break;
371
-
372
- case 'config':
373
- if (args[1] === 'set' && args[2] && args[3]) {
374
- await setConfig(hookConfig.name, args[2], args[3]);
375
- } else {
376
- await showConfig(hookConfig.name);
377
- }
378
- break;
379
-
380
- case 'logs':
381
- if (args[1] === 'clear') {
382
- await clearLogs(hookConfig.name);
383
- } else {
384
- await showLogs(hookConfig.name);
385
- }
386
- break;
387
-
388
- case undefined:
389
- // No command = run the hook (read from stdin)
390
- await runHook(hookConfig);
391
- break;
392
-
393
- default:
394
- console.error(\`Unknown command: \${command}\`);
395
- printHelp();
396
- process.exit(1);
397
- }
398
- }
399
-
400
- main().catch((error) => {
401
- console.error(JSON.stringify({ decision: 'error', message: error.message }));
402
- process.exit(1);
403
- });
404
- `;
405
- }
406
-
407
- function generateRunTs(shortName: string, event: string): string {
408
- const canBlock = event === 'PreToolUse';
409
-
410
- return `/**
411
- * Main hook execution logic
412
- */
413
-
414
- import { process${shortName.charAt(0).toUpperCase() + shortName.slice(1)} } from '../core/${shortName}';
415
- import { log } from '../utils/logger';
416
-
417
- interface HookInput {
418
- tool?: string;
419
- input?: any;
420
- output?: any;
421
- }
422
-
423
- interface HookOutput {
424
- decision: 'allow' | 'block' | 'error';
425
- reason?: string;
426
- message?: string;
427
- }
428
-
429
- export async function runHook(hookConfig: any): Promise<void> {
430
- let input: HookInput = {};
431
-
432
- // Read from stdin
433
- const chunks: Buffer[] = [];
434
- for await (const chunk of Bun.stdin.stream()) {
435
- chunks.push(Buffer.from(chunk));
436
- }
437
-
438
- const stdinData = Buffer.concat(chunks).toString('utf-8').trim();
439
-
440
- if (stdinData) {
441
- try {
442
- input = JSON.parse(stdinData);
443
- } catch {
444
- // Not JSON, might be raw command
445
- input = { input: stdinData };
446
- }
447
- }
448
-
449
- try {
450
- const result = await process${shortName.charAt(0).toUpperCase() + shortName.slice(1)}(input, hookConfig);
451
-
452
- // Log based on verbosity
453
- await log(hookConfig.name, {
454
- event: hookConfig.event,
455
- action: result.decision,
456
- input,
457
- reason: result.reason,
458
- });
459
-
460
- // Output result
461
- console.log(JSON.stringify(result));
462
- } catch (error) {
463
- const errorResult: HookOutput = {
464
- decision: 'error',
465
- message: (error as Error).message,
466
- };
467
-
468
- await log(hookConfig.name, {
469
- event: hookConfig.event,
470
- action: 'error',
471
- input,
472
- reason: errorResult.message,
473
- });
474
-
475
- console.log(JSON.stringify(errorResult));
476
- process.exit(1);
477
- }
478
- }
479
- `;
480
- }
481
-
482
- function generateSetupTs(hookName: string): string {
483
- return `/**
484
- * Setup command - configures Claude Code to use this hook
485
- */
486
-
487
- import { existsSync, mkdirSync } from 'fs';
488
- import { join } from 'path';
489
- import { homedir } from 'os';
490
- import { readClaudeSettings, writeClaudeSettings, mergeHookConfig } from '../utils/claude';
491
-
492
- interface SetupOptions {
493
- global?: boolean;
494
- project?: boolean;
495
- verbosity?: string;
496
- yes?: boolean;
497
- }
498
-
499
- export async function setupHook(hookConfig: any, options: SetupOptions): Promise<void> {
500
- console.log(\`Setting up \${hookConfig.name}...\\n\`);
501
-
502
- // Determine scope
503
- let scope: 'global' | 'project';
504
-
505
- if (options.global) {
506
- scope = 'global';
507
- } else if (options.project) {
508
- scope = 'project';
509
- } else {
510
- // Interactive prompt
511
- console.log('Where should the hook be configured?');
512
- console.log(' 1. Global (~/.claude) - applies to all projects');
513
- console.log(' 2. Project (./.claude) - applies to this project only');
514
- process.stdout.write('\\nChoice [1]: ');
515
-
516
- const choice = await readLine();
517
- scope = choice === '2' ? 'project' : 'global';
518
- }
519
-
520
- const baseDir = scope === 'global'
521
- ? join(homedir(), '.claude')
522
- : join(process.cwd(), '.claude');
523
-
524
- const hooksDir = join(baseDir, 'hooks');
525
-
526
- console.log(\`\\nScope: \${scope} (\${baseDir})\`);
527
-
528
- // Determine verbosity
529
- let verbosity = options.verbosity || 'blocked';
530
- if (!options.verbosity && !options.yes) {
531
- console.log('\\nLog verbosity:');
532
- console.log(' 1. blocked - Only log blocked operations');
533
- console.log(' 2. all - Log all operations');
534
- console.log(' 3. none - Disable logging');
535
- process.stdout.write('\\nChoice [1]: ');
536
-
537
- const choice = await readLine();
538
- verbosity = choice === '2' ? 'all' : choice === '3' ? 'none' : 'blocked';
539
- }
540
-
541
- console.log(\`Verbosity: \${verbosity}\`);
542
-
543
- // Create hooks directory
544
- if (!existsSync(hooksDir)) {
545
- mkdirSync(hooksDir, { recursive: true });
546
- console.log(\`\\nCreated: \${hooksDir}\`);
547
- }
548
-
549
- // Create log file
550
- const logFile = join(hooksDir, hookConfig.logFile);
551
- if (!existsSync(logFile)) {
552
- await Bun.write(logFile, '');
553
- console.log(\`Created: \${logFile}\`);
554
- }
555
-
556
- // Create hook config file
557
- const configFile = join(hooksDir, \`\${hookConfig.name}.config.json\`);
558
- await Bun.write(configFile, JSON.stringify({
559
- verbosity,
560
- enabled: true,
561
- }, null, 2));
562
- console.log(\`Created: \${configFile}\`);
563
-
564
- // Copy HOOK.md
565
- const hookMdSource = new URL('../../HOOK.md', import.meta.url).pathname;
566
- const hookMdDest = join(hooksDir, \`\${hookConfig.name}.md\`);
567
- if (existsSync(hookMdSource)) {
568
- const content = await Bun.file(hookMdSource).text();
569
- await Bun.write(hookMdDest, content);
570
- console.log(\`Created: \${hookMdDest}\`);
571
- }
572
-
573
- // Update Claude settings
574
- const settingsPath = join(baseDir, 'settings.json');
575
- const settings = await readClaudeSettings(settingsPath);
576
-
577
- const newSettings = mergeHookConfig(settings, {
578
- event: hookConfig.event,
579
- matcher: hookConfig.matcher,
580
- command: hookConfig.name,
581
- });
582
-
583
- await writeClaudeSettings(settingsPath, newSettings);
584
- console.log(\`Updated: \${settingsPath}\`);
585
-
586
- console.log(\`\\n\${hookConfig.name} setup complete!\`);
587
- console.log(\`\\nThe hook will now run on \${hookConfig.event} events.\`);
588
- }
589
-
590
- async function readLine(): Promise<string> {
591
- const buf = new Uint8Array(1024);
592
- const n = await Bun.stdin.stream().getReader().read();
593
- return new TextDecoder().decode(n.value).trim();
594
- }
595
- `;
596
- }
597
-
598
- function generateTestTs(shortName: string): string {
599
- return `/**
600
- * Test command - manually test the hook
601
- */
602
-
603
- import { process${shortName.charAt(0).toUpperCase() + shortName.slice(1)} } from '../core/${shortName}';
604
-
605
- export async function testHook(args: string[]): Promise<void> {
606
- const testInput = args.join(' ') || 'echo "test"';
607
-
608
- console.log('Testing hook with input:');
609
- console.log(\` \${testInput}\\n\`);
610
-
611
- // Load hook config
612
- const hookConfigPath = new URL('../../hook.config.json', import.meta.url).pathname;
613
- const hookConfig = await Bun.file(hookConfigPath).json();
614
-
615
- const input = {
616
- tool: 'Bash',
617
- input: { command: testInput },
618
- };
619
-
620
- try {
621
- const result = await process${shortName.charAt(0).toUpperCase() + shortName.slice(1)}(input, hookConfig);
622
-
623
- console.log('Result:');
624
- console.log(JSON.stringify(result, null, 2));
625
- } catch (error) {
626
- console.error('Error:', (error as Error).message);
627
- process.exit(1);
628
- }
629
- }
630
- `;
631
- }
632
-
633
- function generateConfigTs(hookName: string): string {
634
- return `/**
635
- * Config command - show/update hook configuration
636
- */
637
-
638
- import { existsSync } from 'fs';
639
- import { join } from 'path';
640
- import { homedir } from 'os';
641
-
642
- export async function showConfig(hookName: string): Promise<void> {
643
- const locations = [
644
- join(process.cwd(), '.claude', 'hooks', \`\${hookName}.config.json\`),
645
- join(homedir(), '.claude', 'hooks', \`\${hookName}.config.json\`),
646
- ];
647
-
648
- for (const path of locations) {
649
- if (existsSync(path)) {
650
- console.log(\`Config: \${path}\\n\`);
651
- const config = await Bun.file(path).json();
652
- console.log(JSON.stringify(config, null, 2));
653
- return;
654
- }
655
- }
656
-
657
- console.log('No configuration found. Run setup first:');
658
- console.log(\` \${hookName} setup\`);
659
- }
660
-
661
- export async function setConfig(hookName: string, key: string, value: string): Promise<void> {
662
- const locations = [
663
- join(process.cwd(), '.claude', 'hooks', \`\${hookName}.config.json\`),
664
- join(homedir(), '.claude', 'hooks', \`\${hookName}.config.json\`),
665
- ];
666
-
667
- for (const path of locations) {
668
- if (existsSync(path)) {
669
- const config = await Bun.file(path).json();
670
-
671
- // Parse value
672
- let parsedValue: any = value;
673
- if (value === 'true') parsedValue = true;
674
- else if (value === 'false') parsedValue = false;
675
- else if (!isNaN(Number(value))) parsedValue = Number(value);
676
-
677
- config[key] = parsedValue;
678
-
679
- await Bun.write(path, JSON.stringify(config, null, 2));
680
- console.log(\`Updated \${key} = \${parsedValue}\`);
681
- return;
682
- }
683
- }
684
-
685
- console.log('No configuration found. Run setup first:');
686
- console.log(\` \${hookName} setup\`);
687
- }
688
- `;
689
- }
690
-
691
- function generateCoreTs(shortName: string, event: string): string {
692
- const canBlock = event === 'PreToolUse';
693
- const className = shortName.charAt(0).toUpperCase() + shortName.slice(1);
694
-
695
- return `/**
696
- * Core ${shortName} logic
697
- *
698
- * TODO: Implement your hook logic here
699
- */
700
-
701
- interface HookInput {
702
- tool?: string;
703
- input?: any;
704
- output?: any;
705
- }
706
-
707
- interface HookOutput {
708
- decision: 'allow' | 'block' | 'error';
709
- reason?: string;
710
- }
711
-
712
- /**
713
- * Process the hook input and return a decision
714
- *
715
- * @param input - The tool input from Claude Code
716
- * @param config - The hook configuration
717
- * @returns Decision to allow${canBlock ? ', block,' : ' or'} error
718
- */
719
- export async function process${className}(
720
- input: HookInput,
721
- config: any
722
- ): Promise<HookOutput> {
723
- // TODO: Implement your hook logic here
724
-
725
- // Example: Extract command if Bash tool
726
- const command = input.input?.command || '';
727
-
728
- // TODO: Add your validation/processing logic
729
- // For PreToolUse hooks, you can return { decision: 'block', reason: '...' }
730
- // For PostToolUse/Stop hooks, typically just return { decision: 'allow' }
731
-
732
- ${canBlock ? `// Example blocking logic (uncomment and modify):
733
- // if (command.includes('rm -rf /')) {
734
- // return {
735
- // decision: 'block',
736
- // reason: 'Dangerous command detected: rm -rf /',
737
- // };
738
- // }` : '// This is a PostToolUse/Stop hook - cannot block, only observe'}
739
-
740
- return { decision: 'allow' };
741
- }
742
- `;
743
- }
744
-
745
- function generateLoggerTs(hookName: string): string {
746
- return `/**
747
- * Logging utilities
748
- */
749
-
750
- import { existsSync, appendFileSync, readFileSync, writeFileSync } from 'fs';
751
- import { join } from 'path';
752
- import { homedir } from 'os';
753
-
754
- interface LogEntry {
755
- timestamp: string;
756
- event: string;
757
- action: string;
758
- input?: any;
759
- reason?: string;
760
- }
761
-
762
- function getLogPath(hookName: string): string | null {
763
- const locations = [
764
- join(process.cwd(), '.claude', 'hooks', \`\${hookName}.log\`),
765
- join(homedir(), '.claude', 'hooks', \`\${hookName}.log\`),
766
- ];
767
-
768
- for (const path of locations) {
769
- if (existsSync(path)) {
770
- return path;
771
- }
772
- }
773
- return null;
774
- }
775
-
776
- function getConfigPath(hookName: string): string | null {
777
- const locations = [
778
- join(process.cwd(), '.claude', 'hooks', \`\${hookName}.config.json\`),
779
- join(homedir(), '.claude', 'hooks', \`\${hookName}.config.json\`),
780
- ];
781
-
782
- for (const path of locations) {
783
- if (existsSync(path)) {
784
- return path;
785
- }
786
- }
787
- return null;
788
- }
789
-
790
- export async function log(hookName: string, entry: Omit<LogEntry, 'timestamp'>): Promise<void> {
791
- // Check verbosity setting
792
- const configPath = getConfigPath(hookName);
793
- if (configPath) {
794
- try {
795
- const config = JSON.parse(readFileSync(configPath, 'utf-8'));
796
-
797
- if (config.verbosity === 'none') return;
798
- if (config.verbosity === 'blocked' && entry.action === 'allow') return;
799
- } catch {
800
- // Continue with logging if config read fails
801
- }
802
- }
803
-
804
- const logPath = getLogPath(hookName);
805
- if (!logPath) return;
806
-
807
- const logEntry: LogEntry = {
808
- timestamp: new Date().toISOString(),
809
- ...entry,
810
- };
811
-
812
- const line = JSON.stringify(logEntry) + '\\n';
813
- appendFileSync(logPath, line);
814
- }
815
-
816
- export async function showLogs(hookName: string, limit = 20): Promise<void> {
817
- const logPath = getLogPath(hookName);
818
-
819
- if (!logPath) {
820
- console.log('No log file found. Run setup first:');
821
- console.log(\` \${hookName} setup\`);
822
- return;
823
- }
824
-
825
- const content = readFileSync(logPath, 'utf-8').trim();
826
-
827
- if (!content) {
828
- console.log('Log file is empty.');
829
- return;
830
- }
831
-
832
- const lines = content.split('\\n').slice(-limit);
833
-
834
- console.log(\`Recent logs (\${logPath}):\\n\`);
835
-
836
- for (const line of lines) {
837
- try {
838
- const entry = JSON.parse(line) as LogEntry;
839
- const icon = entry.action === 'block' ? 'X' : entry.action === 'error' ? '!' : '-';
840
- console.log(\`[\${entry.timestamp}] \${icon} \${entry.event}: \${entry.action}\`);
841
- if (entry.reason) {
842
- console.log(\` Reason: \${entry.reason}\`);
843
- }
844
- } catch {
845
- console.log(line);
846
- }
847
- }
848
- }
849
-
850
- export async function clearLogs(hookName: string): Promise<void> {
851
- const logPath = getLogPath(hookName);
852
-
853
- if (!logPath) {
854
- console.log('No log file found.');
855
- return;
856
- }
857
-
858
- writeFileSync(logPath, '');
859
- console.log('Logs cleared.');
860
- }
861
- `;
862
- }
863
-
864
- function generateClaudeTs(): string {
865
- return `/**
866
- * Claude Code configuration utilities
867
- */
868
-
869
- import { existsSync } from 'fs';
870
-
871
- interface ClaudeSettings {
872
- hooks?: {
873
- [event: string]: Array<{
874
- matcher: string | string[];
875
- hooks: string[];
876
- }>;
877
- };
878
- [key: string]: any;
879
- }
880
-
881
- interface HookConfig {
882
- event: string;
883
- matcher: string | string[];
884
- command: string;
885
- }
886
-
887
- export async function readClaudeSettings(path: string): Promise<ClaudeSettings> {
888
- if (!existsSync(path)) {
889
- return {};
890
- }
891
-
892
- try {
893
- return await Bun.file(path).json();
894
- } catch {
895
- return {};
896
- }
897
- }
898
-
899
- export async function writeClaudeSettings(path: string, settings: ClaudeSettings): Promise<void> {
900
- await Bun.write(path, JSON.stringify(settings, null, 2));
901
- }
902
-
903
- export function mergeHookConfig(settings: ClaudeSettings, hookConfig: HookConfig): ClaudeSettings {
904
- const { event, matcher, command } = hookConfig;
905
-
906
- // Initialize hooks object if needed
907
- if (!settings.hooks) {
908
- settings.hooks = {};
909
- }
910
-
911
- // Initialize event array if needed
912
- if (!settings.hooks[event]) {
913
- settings.hooks[event] = [];
914
- }
915
-
916
- // Check if hook already exists for this matcher
917
- const existingIndex = settings.hooks[event].findIndex(
918
- (h) => JSON.stringify(h.matcher) === JSON.stringify(matcher)
919
- );
920
-
921
- if (existingIndex >= 0) {
922
- // Add command to existing matcher if not already present
923
- if (!settings.hooks[event][existingIndex].hooks.includes(command)) {
924
- settings.hooks[event][existingIndex].hooks.push(command);
925
- }
926
- } else {
927
- // Add new hook config
928
- settings.hooks[event].push({
929
- matcher,
930
- hooks: [command],
931
- });
932
- }
933
-
934
- return settings;
935
- }
936
- `;
937
- }