@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
@@ -1,826 +1,40 @@
1
1
  #!/usr/bin/env bun
2
2
 
3
- import { existsSync, mkdirSync, appendFileSync, writeFileSync, readFileSync } from "node:fs";
3
+ import { writeFileSync } from "node:fs";
4
4
  import { join } from "node:path";
5
+ import { parseArgs } from "./cli";
6
+ import { generateHtml } from "./html";
7
+ import { writePdfDocument } from "./pdf-writer";
8
+ import { EXPORTS_DIR, SESSION_ID, SKILL_NAME, log } from "./runtime";
5
9
 
6
- type PdfLibModule = typeof import("pdf-lib");
7
-
8
- // Skill configuration
9
- const SKILL_NAME = "generate-pdf";
10
- const SESSION_ID = `${Date.now()}_${Math.random().toString(36).slice(2, 9)}`;
11
-
12
- // Environment paths from the run API
13
- const EXPORTS_DIR = process.env.SKILLS_EXPORTS_DIR || join(process.cwd(), "exports");
14
- const LOGS_DIR = process.env.SKILLS_LOGS_DIR || join(process.cwd(), "logs");
15
- const SKILLS_INPUT = process.env.SKILLS_INPUT || "";
16
- const LOG_FILE = join(LOGS_DIR, `${SESSION_ID}.log`);
17
-
18
- // Ensure output directories exist
19
- [EXPORTS_DIR, LOGS_DIR].forEach((dir) => {
20
- if (!existsSync(dir)) {
21
- mkdirSync(dir, { recursive: true });
22
- }
23
- });
24
-
25
- // Logging utility
26
- function log(message: string, level: "info" | "error" | "warn" = "info") {
27
- const timestamp = new Date().toISOString();
28
- const logMessage = `[${timestamp}] [${level.toUpperCase()}] ${message}\n`;
29
- appendFileSync(LOG_FILE, logMessage);
30
- if (level === "error") {
31
- console.error(message);
32
- }
33
- }
34
-
35
- async function loadPdfLib(): Promise<PdfLibModule> {
36
- try {
37
- return await import("pdf-lib");
38
- } catch {
39
- throw new Error("Missing dependency 'pdf-lib'. Run bun install in this skill directory.");
40
- }
41
- }
42
-
43
- // =============================================================================
44
- // Security: HTML Escaping to prevent XSS
45
- // =============================================================================
46
-
47
- /**
48
- * Escape HTML special characters to prevent XSS attacks
49
- */
50
- function escapeHtml(str: string | undefined | null): string {
51
- if (str === undefined || str === null) return "";
52
- return String(str)
53
- .replace(/&/g, "&amp;")
54
- .replace(/</g, "&lt;")
55
- .replace(/>/g, "&gt;")
56
- .replace(/"/g, "&quot;")
57
- .replace(/'/g, "&#x27;");
58
- }
59
-
60
- /**
61
- * Sanitize a URL for safe href attribute usage
62
- */
63
- function sanitizeUrl(url: string | undefined | null): string {
64
- if (!url) return "";
65
- const trimmed = url.trim();
66
- const lowerUrl = trimmed.toLowerCase();
67
- if (lowerUrl.startsWith("javascript:") || lowerUrl.startsWith("data:") || lowerUrl.startsWith("vbscript:")) {
68
- return "";
69
- }
70
- return escapeHtml(trimmed);
71
- }
72
-
73
- /**
74
- * Sanitize all string values in a template data object
75
- * This prevents XSS when user-provided data is interpolated into HTML
76
- */
77
- function sanitizeTemplateData(data: Record<string, string>): Record<string, string> {
78
- const sanitized: Record<string, string> = {};
79
- for (const [key, value] of Object.entries(data)) {
80
- // URL fields need URL sanitization, not just HTML escaping
81
- if (key.toLowerCase().includes("linkedin") || key.toLowerCase().includes("website") ||
82
- key.toLowerCase().includes("url") || key.toLowerCase().includes("href")) {
83
- sanitized[key] = sanitizeUrl(value);
84
- } else {
85
- sanitized[key] = escapeHtml(value);
86
- }
87
- }
88
- return sanitized;
89
- }
90
-
91
- // Simple markdown to HTML converter
92
- function markdownToHtml(markdown: string): string {
93
- let html = markdown
94
- // Headers
95
- .replace(/^### (.*$)/gim, '<h3>$1</h3>')
96
- .replace(/^## (.*$)/gim, '<h2>$1</h2>')
97
- .replace(/^# (.*$)/gim, '<h1>$1</h1>')
98
- // Bold
99
- .replace(/\*\*(.+?)\*\*/g, '<strong>$1</strong>')
100
- .replace(/__(.+?)__/g, '<strong>$1</strong>')
101
- // Italic
102
- .replace(/\*(.+?)\*/g, '<em>$1</em>')
103
- .replace(/_(.+?)_/g, '<em>$1</em>')
104
- // Code blocks
105
- .replace(/```(\w*)\n([\s\S]*?)```/g, '<pre><code class="language-$1">$2</code></pre>')
106
- // Inline code
107
- .replace(/`(.+?)`/g, '<code>$1</code>')
108
- // Links - sanitize URL and escape link text
109
- .replace(/\[([^\]]+)\]\(([^)]+)\)/g, (_, text, url) => {
110
- const safeUrl = sanitizeUrl(url);
111
- const safeText = escapeHtml(text);
112
- return safeUrl ? `<a href="${safeUrl}">${safeText}</a>` : safeText;
113
- })
114
- // Lists
115
- .replace(/^\s*[-*]\s+(.*)$/gim, '<li>$1</li>')
116
- // Numbered lists
117
- .replace(/^\s*\d+\.\s+(.*)$/gim, '<li>$1</li>')
118
- // Horizontal rule
119
- .replace(/^---$/gim, '<hr>')
120
- // Paragraphs (handle newlines)
121
- .replace(/\n\n/g, '</p><p>')
122
- // Line breaks
123
- .replace(/\n/g, '<br>');
124
-
125
- // Wrap list items in ul
126
- html = html.replace(/(<li>.*?<\/li>)+/gs, '<ul>$&</ul>');
127
-
128
- return `<p>${html}</p>`;
129
- }
130
-
131
- // Invoice template
132
- const templates: Record<string, (data: Record<string, string>) => string> = {
133
- invoice: (data) => `
134
- <!DOCTYPE html>
135
- <html>
136
- <head>
137
- <meta charset="UTF-8">
138
- <style>
139
- body { font-family: Arial, sans-serif; margin: 40px; color: #333; }
140
- .header { display: flex; justify-content: space-between; margin-bottom: 40px; }
141
- .company-info { font-size: 14px; }
142
- .invoice-info { text-align: right; }
143
- .invoice-title { font-size: 28px; color: #2c3e50; margin-bottom: 10px; }
144
- .invoice-number { font-size: 14px; color: #7f8c8d; }
145
- .addresses { display: flex; justify-content: space-between; margin-bottom: 40px; }
146
- .address-block { width: 45%; }
147
- .address-label { font-weight: bold; color: #2c3e50; margin-bottom: 10px; }
148
- table { width: 100%; border-collapse: collapse; margin-bottom: 30px; }
149
- th { background: #2c3e50; color: white; padding: 12px; text-align: left; }
150
- td { padding: 12px; border-bottom: 1px solid #ddd; }
151
- .totals { text-align: right; }
152
- .totals table { width: 300px; margin-left: auto; }
153
- .totals td { border: none; padding: 8px; }
154
- .total-row { font-weight: bold; font-size: 18px; background: #f8f9fa; }
155
- .notes { margin-top: 40px; padding: 20px; background: #f8f9fa; border-radius: 4px; }
156
- .footer { margin-top: 40px; text-align: center; font-size: 12px; color: #7f8c8d; }
157
- </style>
158
- </head>
159
- <body>
160
- <div class="header">
161
- <div class="company-info">
162
- <h2>${data.companyName || 'Company Name'}</h2>
163
- <p>${data.companyAddress || ''}<br>
164
- ${data.companyCity || ''}, ${data.companyState || ''} ${data.companyZip || ''}<br>
165
- ${data.companyPhone || ''}</p>
166
- </div>
167
- <div class="invoice-info">
168
- <div class="invoice-title">INVOICE</div>
169
- <div class="invoice-number">#${data.invoiceNumber || 'INV-001'}</div>
170
- <p>Date: ${data.invoiceDate || new Date().toLocaleDateString()}<br>
171
- Due: ${data.dueDate || ''}</p>
172
- </div>
173
- </div>
174
-
175
- <div class="addresses">
176
- <div class="address-block">
177
- <div class="address-label">Bill To:</div>
178
- <p>${data.clientName || 'Client Name'}<br>
179
- ${data.clientAddress || ''}<br>
180
- ${data.clientCity || ''}, ${data.clientState || ''} ${data.clientZip || ''}</p>
181
- </div>
182
- <div class="address-block">
183
- <div class="address-label">Payment Details:</div>
184
- <p>Terms: ${data.paymentTerms || 'Net 30'}<br>
185
- Method: ${data.paymentMethod || 'Bank Transfer'}</p>
186
- </div>
187
- </div>
188
-
189
- <table>
190
- <thead>
191
- <tr>
192
- <th>Description</th>
193
- <th>Qty</th>
194
- <th>Rate</th>
195
- <th>Amount</th>
196
- </tr>
197
- </thead>
198
- <tbody>
199
- ${data.items || '<tr><td>Service</td><td>1</td><td>$0</td><td>$0</td></tr>'}
200
- </tbody>
201
- </table>
202
-
203
- <div class="totals">
204
- <table>
205
- <tr><td>Subtotal:</td><td>${data.subtotal || '$0'}</td></tr>
206
- <tr><td>Tax (${data.taxRate || '0'}%):</td><td>${data.tax || '$0'}</td></tr>
207
- <tr class="total-row"><td>Total:</td><td>${data.total || '$0'}</td></tr>
208
- </table>
209
- </div>
210
-
211
- ${data.notes ? `<div class="notes"><strong>Notes:</strong><br>${data.notes}</div>` : ''}
212
-
213
- <div class="footer">Thank you for your business!</div>
214
- </body>
215
- </html>`,
216
-
217
- report: (data) => `
218
- <!DOCTYPE html>
219
- <html>
220
- <head>
221
- <meta charset="UTF-8">
222
- <style>
223
- body { font-family: Georgia, serif; margin: 40px; color: #333; line-height: 1.6; }
224
- .title-page { text-align: center; margin-bottom: 60px; padding-top: 100px; }
225
- .title { font-size: 36px; color: #2c3e50; margin-bottom: 10px; }
226
- .subtitle { font-size: 20px; color: #7f8c8d; margin-bottom: 40px; }
227
- .meta { font-size: 14px; color: #95a5a6; }
228
- h2 { color: #2c3e50; border-bottom: 2px solid #3498db; padding-bottom: 10px; margin-top: 40px; }
229
- .executive-summary { background: #f8f9fa; padding: 20px; border-left: 4px solid #3498db; margin: 30px 0; }
230
- .section { margin-bottom: 30px; }
231
- .conclusion { background: #e8f4f8; padding: 20px; border-radius: 4px; margin-top: 40px; }
232
- .footer { margin-top: 60px; text-align: center; font-size: 12px; color: #7f8c8d; border-top: 1px solid #ddd; padding-top: 20px; }
233
- </style>
234
- </head>
235
- <body>
236
- <div class="title-page">
237
- <div class="title">${data.title || 'Report Title'}</div>
238
- <div class="subtitle">${data.subtitle || ''}</div>
239
- <div class="meta">
240
- <p>Date: ${data.reportDate || new Date().toLocaleDateString()}</p>
241
- <p>Author: ${data.author || ''}</p>
242
- </div>
243
- </div>
244
-
245
- <div class="executive-summary">
246
- <h2>Executive Summary</h2>
247
- <p>${data.executiveSummary || ''}</p>
248
- </div>
249
-
250
- <div class="section">
251
- <h2>${data.section1Title || 'Introduction'}</h2>
252
- <p>${data.section1Content || ''}</p>
253
- </div>
254
-
255
- <div class="section">
256
- <h2>${data.section2Title || 'Analysis'}</h2>
257
- <p>${data.section2Content || ''}</p>
258
- </div>
259
-
260
- <div class="conclusion">
261
- <h2>Conclusion</h2>
262
- <p>${data.conclusion || ''}</p>
263
- </div>
264
-
265
- <div class="footer">
266
- <p>${data.companyName || ''} | ${data.companyContact || ''}</p>
267
- </div>
268
- </body>
269
- </html>`,
270
-
271
- resume: (data) => `
272
- <!DOCTYPE html>
273
- <html>
274
- <head>
275
- <meta charset="UTF-8">
276
- <style>
277
- body { font-family: 'Helvetica Neue', Arial, sans-serif; margin: 40px; color: #333; line-height: 1.5; }
278
- .header { text-align: center; margin-bottom: 30px; border-bottom: 2px solid #2c3e50; padding-bottom: 20px; }
279
- .name { font-size: 32px; color: #2c3e50; margin-bottom: 10px; }
280
- .contact { font-size: 14px; color: #7f8c8d; }
281
- .contact a { color: #3498db; text-decoration: none; }
282
- h2 { color: #2c3e50; font-size: 16px; text-transform: uppercase; letter-spacing: 1px; margin-top: 25px; border-bottom: 1px solid #ddd; padding-bottom: 5px; }
283
- .summary { font-style: italic; color: #555; margin-bottom: 20px; }
284
- .experience-item, .education-item { margin-bottom: 20px; }
285
- .job-title { font-weight: bold; }
286
- .company { color: #3498db; }
287
- .date { font-size: 12px; color: #7f8c8d; float: right; }
288
- .skills { display: flex; flex-wrap: wrap; gap: 8px; }
289
- .skill-tag { background: #e8f4f8; color: #2c3e50; padding: 4px 12px; border-radius: 15px; font-size: 12px; }
290
- </style>
291
- </head>
292
- <body>
293
- <div class="header">
294
- <div class="name">${data.name || 'Your Name'}</div>
295
- <div class="contact">
296
- ${data.email || ''} | ${data.phone || ''} | ${data.location || ''}<br>
297
- ${data.linkedin ? `<a href="${data.linkedin}">${data.linkedin}</a>` : ''}
298
- ${data.website ? `| <a href="${data.website}">${data.website}</a>` : ''}
299
- </div>
300
- </div>
301
-
302
- <h2>Professional Summary</h2>
303
- <p class="summary">${data.summary || ''}</p>
304
-
305
- <h2>Experience</h2>
306
- ${data.experience || '<div class="experience-item"><span class="job-title">Position</span> at <span class="company">Company</span></div>'}
307
-
308
- <h2>Education</h2>
309
- ${data.education || '<div class="education-item">Degree - Institution</div>'}
310
-
311
- <h2>Skills</h2>
312
- <div class="skills">
313
- ${data.skills || '<span class="skill-tag">Skill</span>'}
314
- </div>
315
- </body>
316
- </html>`,
317
-
318
- letter: (data) => `
319
- <!DOCTYPE html>
320
- <html>
321
- <head>
322
- <meta charset="UTF-8">
323
- <style>
324
- body { font-family: 'Times New Roman', serif; margin: 60px; color: #333; line-height: 1.8; font-size: 14px; }
325
- .sender-info { margin-bottom: 40px; }
326
- .date { margin-bottom: 40px; }
327
- .recipient-info { margin-bottom: 40px; }
328
- .body { margin-bottom: 40px; text-align: justify; }
329
- .closing { margin-top: 40px; }
330
- .signature { margin-top: 60px; }
331
- </style>
332
- </head>
333
- <body>
334
- <div class="sender-info">
335
- <strong>${data.senderName || ''}</strong><br>
336
- ${data.senderAddress || ''}<br>
337
- ${data.senderCity || ''}, ${data.senderState || ''} ${data.senderZip || ''}
338
- </div>
339
-
340
- <div class="date">${data.date || new Date().toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' })}</div>
341
-
342
- <div class="recipient-info">
343
- ${data.recipientName || ''}<br>
344
- ${data.recipientTitle ? data.recipientTitle + '<br>' : ''}
345
- ${data.recipientCompany ? data.recipientCompany + '<br>' : ''}
346
- ${data.recipientAddress || ''}<br>
347
- ${data.recipientCity || ''}, ${data.recipientState || ''} ${data.recipientZip || ''}
348
- </div>
349
-
350
- <div class="body">
351
- <p>Dear ${data.recipientName || 'Sir/Madam'},</p>
352
- <p>${data.body || ''}</p>
353
- </div>
354
-
355
- <div class="closing">
356
- ${data.closing || 'Sincerely'},
357
- </div>
358
-
359
- <div class="signature">
360
- ${data.senderName || ''}
361
- </div>
362
- </body>
363
- </html>`,
364
-
365
- contract: (data) => `
366
- <!DOCTYPE html>
367
- <html>
368
- <head>
369
- <meta charset="UTF-8">
370
- <style>
371
- body { font-family: 'Times New Roman', serif; margin: 50px; color: #333; line-height: 1.6; font-size: 12px; }
372
- .title { text-align: center; font-size: 24px; font-weight: bold; margin-bottom: 30px; text-transform: uppercase; }
373
- .date { text-align: center; margin-bottom: 30px; }
374
- h2 { font-size: 14px; margin-top: 25px; }
375
- .parties { margin-bottom: 30px; }
376
- .section { margin-bottom: 20px; text-align: justify; }
377
- .signatures { margin-top: 60px; display: flex; justify-content: space-between; }
378
- .signature-block { width: 45%; }
379
- .signature-line { border-top: 1px solid #333; margin-top: 60px; padding-top: 10px; }
380
- </style>
381
- </head>
382
- <body>
383
- <div class="title">${data.contractTitle || 'SERVICE AGREEMENT'}</div>
384
- <div class="date">Effective Date: ${data.effectiveDate || new Date().toLocaleDateString()}</div>
385
-
386
- <div class="parties">
387
- <p>This Agreement is entered into by and between:</p>
388
- <p><strong>${data.party1Name || 'Party 1'}</strong> ("${data.party1Label || 'Provider'}")<br>
389
- Address: ${data.party1Address || ''}</p>
390
- <p>AND</p>
391
- <p><strong>${data.party2Name || 'Party 2'}</strong> ("${data.party2Label || 'Client'}")<br>
392
- Address: ${data.party2Address || ''}</p>
393
- </div>
394
-
395
- <div class="section">
396
- <h2>1. PURPOSE</h2>
397
- <p>${data.purpose || ''}</p>
398
- </div>
399
-
400
- <div class="section">
401
- <h2>2. TERM</h2>
402
- <p>This Agreement shall be effective for a period of ${data.term || '12 months'} from the Effective Date.</p>
403
- </div>
404
-
405
- <div class="section">
406
- <h2>3. OBLIGATIONS</h2>
407
- <p>${data.obligations || ''}</p>
408
- </div>
409
-
410
- <div class="section">
411
- <h2>4. COMPENSATION</h2>
412
- <p>${data.compensation || ''}</p>
413
- </div>
414
-
415
- <div class="section">
416
- <h2>5. TERMINATION</h2>
417
- <p>${data.termination || ''}</p>
418
- </div>
419
-
420
- <div class="section">
421
- <h2>6. GOVERNING LAW</h2>
422
- <p>This Agreement shall be governed by the laws of ${data.governingLaw || 'the applicable jurisdiction'}.</p>
423
- </div>
424
-
425
- <div class="signatures">
426
- <div class="signature-block">
427
- <div class="signature-line">
428
- ${data.party1Name || 'Party 1'}<br>
429
- ${data.party1Label || 'Provider'}
430
- </div>
431
- </div>
432
- <div class="signature-block">
433
- <div class="signature-line">
434
- ${data.party2Name || 'Party 2'}<br>
435
- ${data.party2Label || 'Client'}
436
- </div>
437
- </div>
438
- </div>
439
- </body>
440
- </html>`
441
- };
442
-
443
- // Page format dimensions
444
- const PAGE_FORMATS: Record<string, { width: number; height: number }> = {
445
- A4: { width: 210, height: 297 },
446
- Letter: { width: 216, height: 279 },
447
- Legal: { width: 216, height: 356 },
448
- A3: { width: 297, height: 420 },
449
- A5: { width: 148, height: 210 },
450
- Tabloid: { width: 279, height: 432 },
451
- };
452
-
453
- interface GenerateOptions {
454
- content?: string;
455
- contentType: "markdown" | "html" | "text";
456
- format: string;
457
- orientation: "portrait" | "landscape";
458
- margin: { top: string; right: string; bottom: string; left: string };
459
- header?: string;
460
- footer?: string;
461
- displayHeaderFooter: boolean;
462
- printBackground: boolean;
463
- css?: string;
464
- title?: string;
465
- author?: string;
466
- subject?: string;
467
- filename?: string;
468
- template?: string;
469
- data?: Record<string, string>;
470
- url?: string;
471
- }
472
-
473
- // Parse command line arguments
474
- function parseArgs(args: string[]): GenerateOptions {
475
- const options: GenerateOptions = {
476
- contentType: "markdown",
477
- format: "A4",
478
- orientation: "portrait",
479
- margin: { top: "1cm", right: "1cm", bottom: "1cm", left: "1cm" },
480
- displayHeaderFooter: false,
481
- printBackground: true,
482
- };
483
-
484
- for (let i = 0; i < args.length; i++) {
485
- const arg = args[i];
486
- const nextArg = args[i + 1];
487
-
488
- switch (arg) {
489
- case "-h":
490
- case "--help":
491
- console.log(`
492
- pdf-generate - Generate high-quality PDF documents
493
-
494
- Usage:
495
- skills run generate-pdf -- [options]
496
-
497
- Options:
498
- -h, --help Show this help message
499
- --content <text> Content to convert (markdown, HTML, or text)
500
- --content-type <type> Content type: markdown | html | text (default: markdown)
501
- --file <path> Read content from file
502
- --template <name> Use built-in template: invoice | report | resume | letter | contract
503
- --data <json> JSON data for template variables
504
- --url <url> Generate PDF from URL
505
- --format <size> Page format: A4 | Letter | Legal | A3 | A5 | Tabloid (default: A4)
506
- --orientation <type> Page orientation: portrait | landscape (default: portrait)
507
- --title <text> Document title
508
- --author <text> Document author
509
- --filename <name> Output filename (without extension)
510
- --css <styles> Custom CSS styles
511
- --header <html> Header HTML
512
- --footer <html> Footer HTML
513
-
514
- Templates:
515
- invoice Professional invoice template
516
- report Business report template
517
- resume Resume/CV template
518
- letter Formal letter template
519
- contract Contract/agreement template
520
-
521
- Examples:
522
- # Generate PDF from markdown
523
- skills run generate-pdf -- --content "# Hello World" --filename report
524
-
525
- # Use a template with data
526
- skills run generate-pdf -- --template invoice --data '{"clientName":"Acme Corp","total":"$1000"}'
527
-
528
- # Convert a file
529
- skills run generate-pdf -- --file ./README.md --format Letter
530
- `);
531
- process.exit(0);
532
- case "--content":
533
- if (nextArg) {
534
- options.content = nextArg;
535
- i++;
536
- }
537
- break;
538
- case "--content-type":
539
- if (nextArg && ["markdown", "html", "text"].includes(nextArg)) {
540
- options.contentType = nextArg as "markdown" | "html" | "text";
541
- i++;
542
- }
543
- break;
544
- case "--format":
545
- if (nextArg && PAGE_FORMATS[nextArg]) {
546
- options.format = nextArg;
547
- i++;
548
- }
549
- break;
550
- case "--orientation":
551
- if (nextArg && ["portrait", "landscape"].includes(nextArg)) {
552
- options.orientation = nextArg as "portrait" | "landscape";
553
- i++;
554
- }
555
- break;
556
- case "--title":
557
- if (nextArg) {
558
- options.title = nextArg;
559
- i++;
560
- }
561
- break;
562
- case "--author":
563
- if (nextArg) {
564
- options.author = nextArg;
565
- i++;
566
- }
567
- break;
568
- case "--filename":
569
- if (nextArg) {
570
- options.filename = nextArg;
571
- i++;
572
- }
573
- break;
574
- case "--template":
575
- if (nextArg && templates[nextArg]) {
576
- options.template = nextArg;
577
- i++;
578
- }
579
- break;
580
- case "--data":
581
- if (nextArg) {
582
- try {
583
- options.data = JSON.parse(nextArg);
584
- } catch {
585
- log(`Invalid JSON data: ${nextArg}`, "warn");
586
- }
587
- i++;
588
- }
589
- break;
590
- case "--url":
591
- if (nextArg) {
592
- options.url = nextArg;
593
- i++;
594
- }
595
- break;
596
- case "--file":
597
- if (nextArg && existsSync(nextArg)) {
598
- options.content = readFileSync(nextArg, "utf-8");
599
- i++;
600
- }
601
- break;
602
- case "--css":
603
- if (nextArg) {
604
- options.css = nextArg;
605
- i++;
606
- }
607
- break;
608
- case "--header":
609
- if (nextArg) {
610
- options.header = nextArg;
611
- options.displayHeaderFooter = true;
612
- i++;
613
- }
614
- break;
615
- case "--footer":
616
- if (nextArg) {
617
- options.footer = nextArg;
618
- options.displayHeaderFooter = true;
619
- i++;
620
- }
621
- break;
622
- }
623
- }
624
-
625
- // Use SKILLS_INPUT as content if no content provided
626
- if (!options.content && !options.template && !options.url && SKILLS_INPUT) {
627
- options.content = SKILLS_INPUT;
628
- }
629
-
630
- return options;
631
- }
632
-
633
- // Generate HTML from content
634
- function generateHtml(options: GenerateOptions): string {
635
- let bodyContent = "";
636
-
637
- if (options.template && options.data) {
638
- // Use template with sanitized data to prevent XSS
639
- const templateFn = templates[options.template];
640
- if (templateFn) {
641
- const sanitizedData = sanitizeTemplateData(options.data);
642
- return templateFn(sanitizedData);
643
- }
644
- }
645
-
646
- // Convert content to HTML
647
- if (options.content) {
648
- switch (options.contentType) {
649
- case "markdown":
650
- bodyContent = markdownToHtml(options.content);
651
- break;
652
- case "html":
653
- bodyContent = options.content;
654
- break;
655
- case "text":
656
- bodyContent = `<pre style="white-space: pre-wrap; font-family: monospace;">${escapeHtml(options.content)}</pre>`;
657
- break;
658
- }
659
- }
660
-
661
- // Build full HTML document
662
- return `
663
- <!DOCTYPE html>
664
- <html>
665
- <head>
666
- <meta charset="UTF-8">
667
- <title>${escapeHtml(options.title) || 'Document'}</title>
668
- <style>
669
- body {
670
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
671
- line-height: 1.6;
672
- color: #333;
673
- max-width: 100%;
674
- padding: 20px;
675
- }
676
- h1, h2, h3 { color: #2c3e50; margin-top: 1.5em; }
677
- h1 { font-size: 2em; border-bottom: 2px solid #3498db; padding-bottom: 0.3em; }
678
- h2 { font-size: 1.5em; border-bottom: 1px solid #ddd; padding-bottom: 0.2em; }
679
- code { background: #f4f4f4; padding: 2px 6px; border-radius: 3px; font-size: 0.9em; }
680
- pre { background: #f8f8f8; padding: 15px; border-radius: 5px; overflow-x: auto; }
681
- pre code { background: none; padding: 0; }
682
- a { color: #3498db; }
683
- table { border-collapse: collapse; width: 100%; margin: 1em 0; }
684
- th, td { border: 1px solid #ddd; padding: 8px; text-align: left; }
685
- th { background: #f4f4f4; }
686
- blockquote { border-left: 4px solid #3498db; margin: 1em 0; padding-left: 1em; color: #666; }
687
- ul, ol { padding-left: 2em; }
688
- hr { border: none; border-top: 1px solid #ddd; margin: 2em 0; }
689
- ${options.css || ''}
690
- </style>
691
- </head>
692
- <body>
693
- ${bodyContent}
694
- </body>
695
- </html>`;
696
- }
697
-
698
- function htmlToPlainText(html: string): string {
699
- return html
700
- .replace(/<style[\s\S]*?<\/style>/gi, "")
701
- .replace(/<script[\s\S]*?<\/script>/gi, "")
702
- .replace(/<\/(h1|h2|h3|p|div|li|tr)>/gi, "\n")
703
- .replace(/<br\s*\/?>/gi, "\n")
704
- .replace(/<[^>]+>/g, "")
705
- .replace(/&nbsp;/g, " ")
706
- .replace(/&amp;/g, "&")
707
- .replace(/&lt;/g, "<")
708
- .replace(/&gt;/g, ">")
709
- .replace(/&quot;/g, '"')
710
- .replace(/&#x27;/g, "'")
711
- .split("\n")
712
- .map((line) => line.trim())
713
- .filter(Boolean)
714
- .join("\n");
715
- }
716
-
717
- function pageSizeToPoints(format: string, orientation: "portrait" | "landscape"): [number, number] {
718
- const size = PAGE_FORMATS[format] ?? PAGE_FORMATS.A4;
719
- const width = (size.width / 25.4) * 72;
720
- const height = (size.height / 25.4) * 72;
721
- return orientation === "landscape" ? [height, width] : [width, height];
722
- }
723
-
724
- function wrapText(text: string, maxCharacters: number): string[] {
725
- const lines: string[] = [];
726
- for (const paragraph of text.split("\n")) {
727
- let current = "";
728
- for (const word of paragraph.split(/\s+/).filter(Boolean)) {
729
- const candidate = current ? `${current} ${word}` : word;
730
- if (candidate.length > maxCharacters && current) {
731
- lines.push(current);
732
- current = word;
733
- } else {
734
- current = candidate;
735
- }
736
- }
737
- if (current) lines.push(current);
738
- lines.push("");
739
- }
740
- return lines;
741
- }
742
-
743
- async function writePdfDocument(html: string, options: GenerateOptions, outputPath: string): Promise<void> {
744
- const { PDFDocument, StandardFonts, rgb } = await loadPdfLib();
745
- const pdfDoc = await PDFDocument.create();
746
- const font = await pdfDoc.embedFont(StandardFonts.Helvetica);
747
- const boldFont = await pdfDoc.embedFont(StandardFonts.HelveticaBold);
748
- const [width, height] = pageSizeToPoints(options.format, options.orientation);
749
- const margin = 54;
750
- const fontSize = 11;
751
- const lineHeight = 16;
752
- const maxCharacters = Math.max(40, Math.floor((width - margin * 2) / (fontSize * 0.52)));
753
- const lines = wrapText(htmlToPlainText(html), maxCharacters);
754
-
755
- let page = pdfDoc.addPage([width, height]);
756
- let y = height - margin;
757
-
758
- if (options.title) {
759
- page.drawText(options.title, {
760
- x: margin,
761
- y,
762
- size: 18,
763
- font: boldFont,
764
- color: rgb(0.12, 0.18, 0.26),
765
- });
766
- y -= lineHeight * 2;
767
- }
768
-
769
- for (const line of lines) {
770
- if (y < margin) {
771
- page = pdfDoc.addPage([width, height]);
772
- y = height - margin;
773
- }
774
-
775
- if (line) {
776
- page.drawText(line, {
777
- x: margin,
778
- y,
779
- size: fontSize,
780
- font,
781
- color: rgb(0.1, 0.1, 0.1),
782
- });
783
- }
784
- y -= lineHeight;
785
- }
786
-
787
- const bytes = await pdfDoc.save();
788
- writeFileSync(outputPath, bytes);
789
- }
790
-
791
- // Main execution
792
10
  async function main() {
793
11
  try {
794
12
  log(`Starting ${SKILL_NAME} skill (Session: ${SESSION_ID})`);
795
13
  log(`Arguments: ${Bun.argv.slice(2).join(" ")}`);
796
14
 
797
- const args = Bun.argv.slice(2);
798
- const options = parseArgs(args);
15
+ const options = parseArgs(Bun.argv.slice(2));
799
16
 
800
- // Validate input
801
17
  if (!options.content && !options.template && !options.url) {
802
18
  console.error("Error: No content provided. Use --content, --file, --template, or --url");
803
19
  process.exit(1);
804
20
  }
805
21
 
806
- // Generate HTML
807
22
  const html = generateHtml(options);
808
23
  log(`Generated HTML (${html.length} characters)`);
809
24
 
810
- // Generate filename
811
25
  const filename = options.filename
812
26
  ? `${options.filename}.pdf`
813
27
  : `document_${SESSION_ID}.pdf`;
814
28
 
815
- const htmlFile = join(EXPORTS_DIR, filename.replace('.pdf', '.html'));
29
+ const htmlFile = join(EXPORTS_DIR, filename.replace(".pdf", ".html"));
816
30
  writeFileSync(htmlFile, html);
817
31
  log(`Saved HTML to: ${htmlFile}`);
32
+
818
33
  const pdfFile = join(EXPORTS_DIR, filename);
819
34
  await writePdfDocument(html, options, pdfFile);
820
35
  log(`Saved PDF to: ${pdfFile}`);
821
36
 
822
- // Output result
823
- const result = {
37
+ console.log(JSON.stringify({
824
38
  success: true,
825
39
  message: "PDF document generated successfully",
826
40
  data: {
@@ -832,17 +46,14 @@ async function main() {
832
46
  contentLength: html.length,
833
47
  template: options.template || null,
834
48
  },
835
- };
836
-
837
- console.log(JSON.stringify(result, null, 2));
49
+ }, null, 2));
838
50
  log(`Successfully generated document: ${filename}`);
839
-
840
51
  } catch (error) {
841
52
  const errorMessage = error instanceof Error ? error.message : String(error);
842
53
  log(`Error: ${errorMessage}`, "error");
843
54
  console.error(JSON.stringify({
844
55
  success: false,
845
- error: `Error generating PDF: ${errorMessage}`
56
+ error: `Error generating PDF: ${errorMessage}`,
846
57
  }));
847
58
  process.exit(1);
848
59
  }