@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,705 +1,26 @@
1
1
  #!/usr/bin/env bun
2
2
  /**
3
3
  * Advanced Math Skill
4
- * Performs advanced mathematical calculations, symbolic math, and numerical analysis
5
- *
6
- * Features:
7
- * - Basic arithmetic with arbitrary precision
8
- * - Scientific calculations (trig, log, exp, etc.)
9
- * - Statistics (mean, median, mode, std dev, variance, percentiles)
10
- * - Linear algebra (matrix operations, determinant, inverse, eigenvalues)
11
- * - Calculus (derivatives, integrals - symbolic using AI)
12
- * - Unit conversions (length, weight, temperature, time, data)
13
- * - Financial calculations (compound interest, NPV, IRR, loan payments)
14
- * - Number theory (prime check, factorization, GCD, LCM)
4
+ * Performs advanced mathematical calculations, symbolic math, and numerical analysis.
15
5
  */
16
6
 
17
- import { parseArgs } from "util";
18
- import { mkdirSync, writeFileSync, appendFileSync, existsSync } from "fs";
7
+ import { writeFileSync } from "fs";
19
8
  import { join } from "path";
20
- import { randomUUID } from "crypto";
21
- import * as math from "mathjs";
9
+ import {
10
+ calculateStatistics,
11
+ evaluateExpression,
12
+ performMatrixOperation,
13
+ } from "./calculators";
14
+ import { parseMathCli } from "./cli";
15
+ import { convertUnit } from "./conversion";
16
+ import { calculateFinance } from "./finance";
17
+ import { formatNumber, formatResult } from "./formatting";
18
+ import { EXPORTS_DIR, SESSION_ID, ensureDir, log, mathConfig } from "./runtime";
19
+ import { performSymbolicMath } from "./symbolic";
20
+ import type { Result } from "./types";
22
21
 
23
- // Types
24
- type Mode = "calc" | "stats" | "matrix" | "convert" | "finance" | "symbolic";
25
- type OutputFormat = "text" | "json" | "latex";
26
- type NumberFormat = "number" | "scientific" | "fraction" | "percentage";
27
- type MatrixOperation = "add" | "multiply" | "transpose" | "determinant" | "inverse" | "eigenvalues" | "rank" | "trace";
28
- type FinanceType = "compound" | "simple" | "npv" | "irr" | "pmt" | "fv" | "pv";
29
- type SymbolicOperation = "derivative" | "integral" | "simplify" | "factor" | "expand" | "solve";
30
-
31
- interface MathOptions {
32
- mode: Mode;
33
- precision: number;
34
- format: NumberFormat;
35
- output: OutputFormat;
36
- showSteps: boolean;
37
- stats?: string;
38
- matrix?: MatrixOperation;
39
- from?: string;
40
- to?: string;
41
- finance?: FinanceType;
42
- principal?: number;
43
- rate?: number;
44
- years?: number;
45
- periods?: number;
46
- payment?: number;
47
- cashflows?: string;
48
- operation?: SymbolicOperation;
49
- var?: string;
50
- }
51
-
52
- interface Result {
53
- input: string | string[];
54
- mode: Mode;
55
- output: any;
56
- steps?: string[];
57
- formatted?: string;
58
- latex?: string;
59
- }
60
-
61
- // Constants
62
- const SKILL_NAME = "advanced-math";
63
- const SESSION_ID = randomUUID().slice(0, 8);
64
-
65
- // Use SKILLS_OUTPUT_DIR from CLI if available
66
- const SKILLS_OUTPUT_DIR = process.env.SKILLS_OUTPUT_DIR || join(process.cwd(), ".skills");
67
- const EXPORTS_DIR = join(SKILLS_OUTPUT_DIR, "exports", SKILL_NAME);
68
- const LOGS_DIR = join(SKILLS_OUTPUT_DIR, "logs", SKILL_NAME);
69
-
70
- // Session timestamp for log filename
71
- const SESSION_TIMESTAMP = new Date().toISOString().replace(/[:.]/g, "_").replace(/-/g, "_").slice(0, 19).toLowerCase();
72
-
73
- // Configure mathjs
74
- const mathConfig = math.create(math.all, {
75
- number: "BigNumber",
76
- precision: 64,
77
- });
78
-
79
- // Ensure directories exist
80
- function ensureDir(dir: string) {
81
- if (!existsSync(dir)) {
82
- mkdirSync(dir, { recursive: true });
83
- }
84
- }
85
-
86
- // Logger
87
- function log(message: string, level: "info" | "error" | "success" = "info") {
88
- const timestamp = new Date().toISOString();
89
- const logFile = join(LOGS_DIR, `log_${SESSION_TIMESTAMP}_${SESSION_ID}.log`);
90
-
91
- ensureDir(LOGS_DIR);
92
-
93
- const logEntry = `[${timestamp}] [${level.toUpperCase()}] ${message}\n`;
94
- appendFileSync(logFile, logEntry);
95
-
96
- const prefixes = {
97
- info: "ℹ️ ",
98
- error: "❌ ",
99
- success: "✅ "
100
- };
101
-
102
- if (level === "error") {
103
- console.error(`${prefixes[level]} ${message}`);
104
- } else {
105
- console.log(`${prefixes[level]} ${message}`);
106
- }
107
- }
108
-
109
- // ============================================================================
110
- // Calculator Mode
111
- // ============================================================================
112
- function evaluateExpression(expr: string, precision: number): any {
113
- try {
114
- // Configure precision
115
- mathConfig.config({ precision });
116
-
117
- const result = mathConfig.evaluate(expr);
118
- return result;
119
- } catch (error) {
120
- throw new Error(`Failed to evaluate expression: ${error instanceof Error ? error.message : "Unknown error"}`);
121
- }
122
- }
123
-
124
- // ============================================================================
125
- // Statistics Mode
126
- // ============================================================================
127
- function calculateStatistics(data: number[], metrics?: string): any {
128
- const requestedMetrics = metrics?.split(",").map(m => m.trim()) || ["all"];
129
- const stats: any = {};
130
-
131
- if (requestedMetrics.includes("all") || requestedMetrics.includes("mean")) {
132
- stats.mean = mathConfig.mean(data);
133
- }
134
-
135
- if (requestedMetrics.includes("all") || requestedMetrics.includes("median")) {
136
- stats.median = mathConfig.median(data);
137
- }
138
-
139
- if (requestedMetrics.includes("all") || requestedMetrics.includes("mode")) {
140
- stats.mode = mathConfig.mode(data);
141
- }
142
-
143
- if (requestedMetrics.includes("all") || requestedMetrics.includes("std")) {
144
- stats.std = mathConfig.std(data);
145
- }
146
-
147
- if (requestedMetrics.includes("all") || requestedMetrics.includes("variance")) {
148
- stats.variance = mathConfig.variance(data);
149
- }
150
-
151
- if (requestedMetrics.includes("all") || requestedMetrics.includes("min")) {
152
- stats.min = mathConfig.min(data);
153
- }
154
-
155
- if (requestedMetrics.includes("all") || requestedMetrics.includes("max")) {
156
- stats.max = mathConfig.max(data);
157
- }
158
-
159
- if (requestedMetrics.includes("all") || requestedMetrics.includes("range")) {
160
- stats.range = mathConfig.max(data) - mathConfig.min(data);
161
- }
162
-
163
- if (requestedMetrics.includes("all") || requestedMetrics.includes("sum")) {
164
- stats.sum = mathConfig.sum(data);
165
- }
166
-
167
- if (requestedMetrics.includes("all") || requestedMetrics.includes("count")) {
168
- stats.count = data.length;
169
- }
170
-
171
- if (requestedMetrics.includes("all") || requestedMetrics.includes("quartiles")) {
172
- const sorted = [...data].sort((a, b) => a - b);
173
- stats.quartiles = {
174
- q1: mathConfig.quantileSeq(sorted, 0.25),
175
- q2: mathConfig.quantileSeq(sorted, 0.5),
176
- q3: mathConfig.quantileSeq(sorted, 0.75),
177
- };
178
- stats.iqr = stats.quartiles.q3 - stats.quartiles.q1;
179
- }
180
-
181
- return stats;
182
- }
183
-
184
- // ============================================================================
185
- // Matrix Mode
186
- // ============================================================================
187
- function performMatrixOperation(matrices: any[], operation: MatrixOperation): any {
188
- const matrix1 = mathConfig.matrix(matrices[0]);
189
-
190
- switch (operation) {
191
- case "add":
192
- if (matrices.length < 2) throw new Error("Addition requires two matrices");
193
- return mathConfig.add(matrix1, mathConfig.matrix(matrices[1]));
194
-
195
- case "multiply":
196
- if (matrices.length < 2) throw new Error("Multiplication requires two matrices");
197
- return mathConfig.multiply(matrix1, mathConfig.matrix(matrices[1]));
198
-
199
- case "transpose":
200
- return mathConfig.transpose(matrix1);
201
-
202
- case "determinant":
203
- return mathConfig.det(matrix1);
204
-
205
- case "inverse":
206
- return mathConfig.inv(matrix1);
207
-
208
- case "eigenvalues":
209
- return mathConfig.eigs(matrix1).values;
210
-
211
- case "rank":
212
- // mathjs doesn't have rank, approximate with determinant check
213
- const det = mathConfig.det(matrix1);
214
- return det !== 0 ? mathConfig.size(matrix1)[0] : "< " + mathConfig.size(matrix1)[0];
215
-
216
- case "trace":
217
- return mathConfig.trace(matrix1);
218
-
219
- default:
220
- throw new Error(`Unknown matrix operation: ${operation}`);
221
- }
222
- }
223
-
224
- // ============================================================================
225
- // Unit Conversion Mode
226
- // ============================================================================
227
- const unitMappings: Record<string, string> = {
228
- // Length
229
- "meter": "m", "meters": "m", "m": "m",
230
- "kilometer": "km", "kilometers": "km", "km": "km",
231
- "centimeter": "cm", "centimeters": "cm", "cm": "cm",
232
- "millimeter": "mm", "millimeters": "mm", "mm": "mm",
233
- "mile": "mile", "miles": "mile",
234
- "yard": "yard", "yards": "yard",
235
- "foot": "ft", "feet": "ft", "ft": "ft",
236
- "inch": "inch", "inches": "inch", "in": "inch",
237
-
238
- // Mass
239
- "kilogram": "kg", "kilograms": "kg", "kg": "kg",
240
- "gram": "g", "grams": "g", "g": "g",
241
- "milligram": "mg", "milligrams": "mg", "mg": "mg",
242
- "pound": "lb", "pounds": "lb", "lb": "lb", "lbs": "lb",
243
- "ounce": "oz", "ounces": "oz", "oz": "oz",
244
- "ton": "ton", "tons": "ton",
245
-
246
- // Time
247
- "second": "s", "seconds": "s", "s": "s", "sec": "s",
248
- "minute": "min", "minutes": "min", "min": "min",
249
- "hour": "hour", "hours": "hour", "hr": "hour", "h": "hour",
250
- "day": "day", "days": "day",
251
- "week": "week", "weeks": "week",
252
- "month": "month", "months": "month",
253
- "year": "year", "years": "year", "yr": "year",
254
- };
255
-
256
- function convertUnit(value: number, from: string, to: string): number {
257
- const fromUnit = unitMappings[from.toLowerCase()] || from;
258
- const toUnit = unitMappings[to.toLowerCase()] || to;
259
-
260
- // Handle temperature separately (not supported by mathjs unit system)
261
- if (["celsius", "fahrenheit", "kelvin"].includes(from.toLowerCase())) {
262
- return convertTemperature(value, from.toLowerCase(), to.toLowerCase());
263
- }
264
-
265
- // Handle data sizes separately
266
- if (["bit", "byte", "kilobyte", "megabyte", "gigabyte", "terabyte", "petabyte"].includes(from.toLowerCase())) {
267
- return convertDataSize(value, from.toLowerCase(), to.toLowerCase());
268
- }
269
-
270
- try {
271
- const result = mathConfig.evaluate(`${value} ${fromUnit} to ${toUnit}`);
272
- return Number(result.toNumeric(toUnit));
273
- } catch (error) {
274
- throw new Error(`Failed to convert ${from} to ${to}: ${error instanceof Error ? error.message : "Unknown error"}`);
275
- }
276
- }
277
-
278
- function convertTemperature(value: number, from: string, to: string): number {
279
- let celsius: number;
280
-
281
- // Convert to Celsius first
282
- switch (from) {
283
- case "celsius": celsius = value; break;
284
- case "fahrenheit": celsius = (value - 32) * 5 / 9; break;
285
- case "kelvin": celsius = value - 273.15; break;
286
- default: throw new Error(`Unknown temperature unit: ${from}`);
287
- }
288
-
289
- // Convert from Celsius to target
290
- switch (to) {
291
- case "celsius": return celsius;
292
- case "fahrenheit": return celsius * 9 / 5 + 32;
293
- case "kelvin": return celsius + 273.15;
294
- default: throw new Error(`Unknown temperature unit: ${to}`);
295
- }
296
- }
297
-
298
- function convertDataSize(value: number, from: string, to: string): number {
299
- const bytes: Record<string, number> = {
300
- "bit": 0.125,
301
- "byte": 1,
302
- "kilobyte": 1024,
303
- "megabyte": 1024 ** 2,
304
- "gigabyte": 1024 ** 3,
305
- "terabyte": 1024 ** 4,
306
- "petabyte": 1024 ** 5,
307
- };
308
-
309
- const valueInBytes = value * bytes[from];
310
- return valueInBytes / bytes[to];
311
- }
312
-
313
- // ============================================================================
314
- // Finance Mode
315
- // ============================================================================
316
- function calculateFinance(type: FinanceType, options: MathOptions): number {
317
- const { principal = 0, rate = 0, years = 0, periods, payment = 0, cashflows } = options;
318
- const r = rate / 100; // Convert percentage to decimal
319
-
320
- switch (type) {
321
- case "compound":
322
- // FV = PV * (1 + r)^n
323
- const n = periods || years;
324
- return principal * Math.pow(1 + r, n);
325
-
326
- case "simple":
327
- // FV = PV * (1 + r*n)
328
- return principal * (1 + r * years);
329
-
330
- case "npv":
331
- // NPV = sum(CF_t / (1+r)^t)
332
- if (!cashflows) throw new Error("Cash flows required for NPV");
333
- const flows = cashflows.split(",").map(Number);
334
- return flows.reduce((npv, cf, t) => npv + cf / Math.pow(1 + r, t), 0);
335
-
336
- case "irr":
337
- // IRR calculation using Newton-Raphson method
338
- if (!cashflows) throw new Error("Cash flows required for IRR");
339
- return calculateIRR(cashflows.split(",").map(Number));
340
-
341
- case "pmt":
342
- // PMT = PV * (r * (1+r)^n) / ((1+r)^n - 1)
343
- const monthlyRate = r / 12;
344
- const numPayments = years * 12;
345
- return principal * (monthlyRate * Math.pow(1 + monthlyRate, numPayments)) /
346
- (Math.pow(1 + monthlyRate, numPayments) - 1);
347
-
348
- case "fv":
349
- // Future Value = PV * (1 + r)^n
350
- return principal * Math.pow(1 + r, years);
351
-
352
- case "pv":
353
- // Present Value = FV / (1 + r)^n
354
- return payment / Math.pow(1 + r, years);
355
-
356
- default:
357
- throw new Error(`Unknown finance type: ${type}`);
358
- }
359
- }
360
-
361
- function calculateIRR(cashflows: number[], guess: number = 0.1): number {
362
- const maxIterations = 100;
363
- const tolerance = 0.0001;
364
- let rate = guess;
365
-
366
- for (let i = 0; i < maxIterations; i++) {
367
- let npv = 0;
368
- let dnpv = 0;
369
-
370
- for (let t = 0; t < cashflows.length; t++) {
371
- npv += cashflows[t] / Math.pow(1 + rate, t);
372
- dnpv -= t * cashflows[t] / Math.pow(1 + rate, t + 1);
373
- }
374
-
375
- const newRate = rate - npv / dnpv;
376
-
377
- if (Math.abs(newRate - rate) < tolerance) {
378
- return newRate * 100; // Return as percentage
379
- }
380
-
381
- rate = newRate;
382
- }
383
-
384
- throw new Error("IRR did not converge");
385
- }
386
-
387
- // ============================================================================
388
- // Symbolic Math Mode (Using AI)
389
- // ============================================================================
390
- async function performSymbolicMath(
391
- expression: string,
392
- operation: SymbolicOperation,
393
- variable: string = "x",
394
- showSteps: boolean = false
395
- ): Promise<{ result: string; steps?: string[]; latex?: string }> {
396
- const apiKey = process.env.OPENAI_API_KEY;
397
-
398
- if (!apiKey) {
399
- throw new Error("OPENAI_API_KEY environment variable is required for symbolic math");
400
- }
401
-
402
- const prompt = buildSymbolicPrompt(expression, operation, variable, showSteps);
403
-
404
- log(`Performing symbolic ${operation} on: ${expression}`);
405
-
406
- const response = await fetch("https://api.openai.com/v1/chat/completions", {
407
- method: "POST",
408
- headers: {
409
- "Content-Type": "application/json",
410
- "Authorization": `Bearer ${apiKey}`,
411
- },
412
- body: JSON.stringify({
413
- model: "gpt-4o-mini",
414
- messages: [
415
- {
416
- role: "system",
417
- content: "You are a mathematics expert. Provide accurate symbolic mathematics solutions. Always show your work clearly and provide LaTeX formatting when requested.",
418
- },
419
- {
420
- role: "user",
421
- content: prompt,
422
- },
423
- ],
424
- temperature: 0.1,
425
- }),
426
- });
427
-
428
- if (!response.ok) {
429
- const error = await response.json();
430
- throw new Error(`OpenAI API error: ${error.error?.message || response.statusText}`);
431
- }
432
-
433
- const data = await response.json();
434
- const content = data.choices[0].message.content;
435
-
436
- return parseSymbolicResponse(content, showSteps);
437
- }
438
-
439
- function buildSymbolicPrompt(expr: string, operation: SymbolicOperation, variable: string, showSteps: boolean): string {
440
- const basePrompts: Record<SymbolicOperation, string> = {
441
- derivative: `Calculate the derivative of the expression "${expr}" with respect to ${variable}.`,
442
- integral: `Calculate the indefinite integral of the expression "${expr}" with respect to ${variable}.`,
443
- simplify: `Simplify the expression "${expr}".`,
444
- factor: `Factor the expression "${expr}".`,
445
- expand: `Expand the expression "${expr}".`,
446
- solve: `Solve the equation "${expr}" for ${variable}.`,
447
- };
448
-
449
- let prompt = basePrompts[operation];
450
-
451
- if (showSteps) {
452
- prompt += "\n\nPlease show step-by-step solution with explanations.";
453
- }
454
-
455
- prompt += "\n\nFormat your response as follows:";
456
- prompt += "\nRESULT: [final answer]";
457
-
458
- if (showSteps) {
459
- prompt += "\nSTEPS:";
460
- prompt += "\n1. [step 1]";
461
- prompt += "\n2. [step 2]";
462
- prompt += "\n...";
463
- }
464
-
465
- prompt += "\nLATEX: [result in LaTeX format]";
466
-
467
- return prompt;
468
- }
469
-
470
- function parseSymbolicResponse(content: string, showSteps: boolean): { result: string; steps?: string[]; latex?: string } {
471
- const resultMatch = content.match(/RESULT:\s*(.+?)(?=\n|$)/i);
472
- const latexMatch = content.match(/LATEX:\s*(.+?)(?=\n|$)/i);
473
-
474
- const result: any = {
475
- result: resultMatch ? resultMatch[1].trim() : content,
476
- };
477
-
478
- if (showSteps) {
479
- const stepsMatch = content.match(/STEPS:([\s\S]+?)(?=LATEX:|$)/i);
480
- if (stepsMatch) {
481
- result.steps = stepsMatch[1]
482
- .split("\n")
483
- .map(s => s.trim())
484
- .filter(s => s && /^\d+\./.test(s));
485
- }
486
- }
487
-
488
- if (latexMatch) {
489
- result.latex = latexMatch[1].trim();
490
- }
491
-
492
- return result;
493
- }
494
-
495
- // ============================================================================
496
- // Formatting Functions
497
- // ============================================================================
498
- function formatNumber(value: any, format: NumberFormat, precision: number): string {
499
- // Convert mathjs BigNumber to regular number
500
- let num: number;
501
- if (value && typeof value === "object" && "toNumber" in value) {
502
- num = value.toNumber();
503
- } else if (typeof value === "number") {
504
- num = value;
505
- } else {
506
- num = Number(value);
507
- }
508
-
509
- switch (format) {
510
- case "scientific":
511
- return num.toExponential(precision);
512
-
513
- case "fraction":
514
- return mathConfig.format(mathConfig.fraction(num), { precision });
515
-
516
- case "percentage":
517
- return (num * 100).toFixed(precision) + "%";
518
-
519
- case "number":
520
- default:
521
- return num.toFixed(precision);
522
- }
523
- }
524
-
525
- function formatResult(result: Result, options: MathOptions): string {
526
- // Helper to convert BigNumber to string
527
- const toString = (val: any): string => {
528
- if (val && typeof val === "object" && "toString" in val) {
529
- return val.toString();
530
- }
531
- return String(val);
532
- };
533
-
534
- if (options.output === "json") {
535
- // Convert BigNumbers to strings for JSON
536
- const jsonResult = JSON.parse(JSON.stringify(result, (key, value) => {
537
- if (value && typeof value === "object" && "toString" in value) {
538
- return value.toString();
539
- }
540
- return value;
541
- }));
542
- return JSON.stringify(jsonResult, null, 2);
543
- }
544
-
545
- if (options.output === "latex" && result.latex) {
546
- return result.latex;
547
- }
548
-
549
- // Text format
550
- let output = `\n${"=".repeat(80)}\n`;
551
- output += ` Advanced Math - ${result.mode.toUpperCase()} Mode\n`;
552
- output += `${"=".repeat(80)}\n\n`;
553
-
554
- output += `Input: ${Array.isArray(result.input) ? result.input.join(", ") : result.input}\n\n`;
555
-
556
- if (typeof result.output === "object" && !Array.isArray(result.output) && result.output !== null && !("toNumber" in result.output)) {
557
- output += "Results:\n";
558
- for (const [key, value] of Object.entries(result.output)) {
559
- if (typeof value === "object" && value !== null && !("toNumber" in value)) {
560
- output += ` ${key}:\n`;
561
- for (const [k, v] of Object.entries(value as any)) {
562
- output += ` ${k}: ${toString(v)}\n`;
563
- }
564
- } else {
565
- output += ` ${key}: ${toString(value)}\n`;
566
- }
567
- }
568
- } else {
569
- output += `Result: ${result.formatted || toString(result.output)}\n`;
570
- }
571
-
572
- if (result.steps && result.steps.length > 0) {
573
- output += "\nSteps:\n";
574
- result.steps.forEach((step, i) => {
575
- output += ` ${i + 1}. ${step}\n`;
576
- });
577
- }
578
-
579
- if (result.latex) {
580
- output += `\nLaTeX: ${result.latex}\n`;
581
- }
582
-
583
- output += `\n${"=".repeat(80)}\n`;
584
-
585
- return output;
586
- }
587
-
588
- // ============================================================================
589
- // Main Handler
590
- // ============================================================================
591
22
  async function main() {
592
- const { values, positionals } = parseArgs({
593
- args: process.argv.slice(2),
594
- options: {
595
- mode: { type: "string", default: "calc" },
596
- precision: { type: "string", default: "10" },
597
- format: { type: "string", default: "number" },
598
- output: { type: "string", default: "text" },
599
- "show-steps": { type: "boolean", default: false },
600
- stats: { type: "string" },
601
- matrix: { type: "string" },
602
- from: { type: "string" },
603
- to: { type: "string" },
604
- finance: { type: "string" },
605
- principal: { type: "string" },
606
- rate: { type: "string" },
607
- years: { type: "string" },
608
- periods: { type: "string" },
609
- payment: { type: "string" },
610
- cashflows: { type: "string" },
611
- operation: { type: "string" },
612
- var: { type: "string", default: "x" },
613
- help: { type: "boolean", short: "h" },
614
- },
615
- allowPositionals: true,
616
- });
617
-
618
- // Show help
619
- if (values.help) {
620
- console.log(`
621
- ╔═══════════════════════════════════════════════════════════════════════════════╗
622
- ║ ADVANCED MATH - Calculation Engine ║
623
- ║ Perform complex mathematical operations, statistics, and symbolic math ║
624
- ╚═══════════════════════════════════════════════════════════════════════════════╝
625
-
626
- USAGE:
627
- skills run advanced-math -- "<expression or data>" [options]
628
-
629
- MODES:
630
- calc Basic expression evaluation and scientific calculations
631
- stats Statistical analysis (mean, median, std dev, etc.)
632
- matrix Matrix operations (determinant, inverse, eigenvalues)
633
- convert Unit conversions (length, weight, temperature, etc.)
634
- finance Financial calculations (compound interest, NPV, IRR)
635
- symbolic AI-powered symbolic math (derivatives, integrals)
636
-
637
- OPTIONS:
638
- --mode <mode> Calculation mode [default: calc]
639
- --precision <n> Decimal places [default: 10]
640
- --format <format> Output format: number, scientific, fraction, percentage
641
- --output <format> Result format: text, json, latex [default: text]
642
- --show-steps Show calculation steps
643
-
644
- CALC MODE:
645
- skills run advanced-math -- "2 + 2 * 3"
646
- skills run advanced-math -- "sin(pi/4) + cos(pi/4)"
647
- skills run advanced-math -- "sqrt(16) + log10(100)"
648
-
649
- STATS MODE:
650
- skills run advanced-math -- "1,2,3,4,5" --mode stats
651
- skills run advanced-math -- "10,20,30" --mode stats --stats mean,median
652
-
653
- MATRIX MODE:
654
- skills run advanced-math -- "[[1,2],[3,4]]" --mode matrix --matrix determinant
655
- skills run advanced-math -- "[[4,7],[2,6]]" --mode matrix --matrix inverse
656
-
657
- CONVERT MODE:
658
- skills run advanced-math -- "100" --mode convert --from celsius --to fahrenheit
659
- skills run advanced-math -- "1" --mode convert --from kilometer --to mile
660
-
661
- FINANCE MODE:
662
- skills run advanced-math -- --mode finance --finance compound --principal 1000 --rate 5 --years 10
663
- skills run advanced-math -- --mode finance --finance pmt --principal 200000 --rate 4.5 --years 30
664
-
665
- SYMBOLIC MODE (requires OPENAI_API_KEY):
666
- skills run advanced-math -- "x^2 + 3*x" --mode symbolic --operation derivative --var x
667
- skills run advanced-math -- "2*x + 3" --mode symbolic --operation integral --show-steps
668
-
669
- For full documentation, see SKILL.md
670
- `);
671
- process.exit(0);
672
- }
673
-
674
- const input = positionals.join(" ");
675
- const mode = values.mode as Mode;
676
- const precision = parseInt(values.precision as string);
677
-
678
- if (isNaN(precision) || precision < 0 || precision > 100) {
679
- log("Error: Precision must be a number between 0 and 100", "error");
680
- process.exit(1);
681
- }
682
-
683
- const options: MathOptions = {
684
- mode,
685
- precision,
686
- format: values.format as NumberFormat,
687
- output: values.output as OutputFormat,
688
- showSteps: values["show-steps"] as boolean,
689
- stats: values.stats as string,
690
- matrix: values.matrix as MatrixOperation,
691
- from: values.from as string,
692
- to: values.to as string,
693
- finance: values.finance as FinanceType,
694
- principal: values.principal ? parseFloat(values.principal as string) : undefined,
695
- rate: values.rate ? parseFloat(values.rate as string) : undefined,
696
- years: values.years ? parseFloat(values.years as string) : undefined,
697
- periods: values.periods ? parseFloat(values.periods as string) : undefined,
698
- payment: values.payment ? parseFloat(values.payment as string) : undefined,
699
- cashflows: values.cashflows as string,
700
- operation: values.operation as SymbolicOperation,
701
- var: values.var as string,
702
- };
23
+ const { input, mode, precision, options, positionals } = parseMathCli();
703
24
 
704
25
  try {
705
26
  log(`Session ID: ${SESSION_ID}`);
@@ -718,7 +39,7 @@ For full documentation, see SKILL.md
718
39
 
719
40
  case "stats": {
720
41
  if (!input) throw new Error("Data required for stats mode");
721
- const data = input.split(",").map(v => parseFloat(v.trim()));
42
+ const data = input.split(",").map((value) => parseFloat(value.trim()));
722
43
  if (data.some(isNaN)) throw new Error("Invalid data: must be comma-separated numbers");
723
44
  const output = calculateStatistics(data, options.stats);
724
45
  result = { input, mode, output };
@@ -729,11 +50,10 @@ For full documentation, see SKILL.md
729
50
  if (!input) throw new Error("Matrix required for matrix mode");
730
51
  if (!options.matrix) throw new Error("Matrix operation required (--matrix)");
731
52
 
732
- // Parse matrix/matrices from input
733
53
  let matrices;
734
54
  try {
735
- matrices = positionals.map(p => JSON.parse(p));
736
- } catch (e) {
55
+ matrices = positionals.map((positional) => JSON.parse(positional));
56
+ } catch {
737
57
  throw new Error("Invalid matrix format. Use JSON arrays e.g. [[1,2],[3,4]]");
738
58
  }
739
59
  const output = performMatrixOperation(matrices, options.matrix);
@@ -750,7 +70,12 @@ For full documentation, see SKILL.md
750
70
  if (isNaN(value)) throw new Error("Invalid value for conversion");
751
71
  const output = convertUnit(value, options.from, options.to);
752
72
  const formatted = formatNumber(output, options.format, precision);
753
- result = { input: `${input} ${options.from}`, mode, output, formatted: `${formatted} ${options.to}` };
73
+ result = {
74
+ input: `${input} ${options.from}`,
75
+ mode,
76
+ output,
77
+ formatted: `${formatted} ${options.to}`,
78
+ };
754
79
  break;
755
80
  }
756
81
 
@@ -787,11 +112,9 @@ For full documentation, see SKILL.md
787
112
  throw new Error(`Unknown mode: ${mode}`);
788
113
  }
789
114
 
790
- // Format and display result
791
115
  const outputText = formatResult(result, options);
792
116
  console.log(outputText);
793
117
 
794
- // Save to file if JSON or complex result
795
118
  if (options.output === "json" || mode === "stats") {
796
119
  const timestamp = new Date().toISOString().replace(/[:.]/g, "_").slice(0, 19);
797
120
  const outputFile = join(EXPORTS_DIR, `export_${timestamp}_${mode}.json`);
@@ -801,7 +124,6 @@ For full documentation, see SKILL.md
801
124
  }
802
125
 
803
126
  log("Calculation completed successfully", "success");
804
-
805
127
  } catch (error) {
806
128
  log(`Error: ${error instanceof Error ? error.message : "Unknown error"}`, "error");
807
129
  process.exit(1);