@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.
- package/LICENSE +1 -10
- package/README.md +141 -39
- package/bin/index.js +30122 -27575
- package/bin/mcp.js +22112 -18593
- package/dist/cli/cli.test-utils.d.ts +15 -0
- package/dist/cli/commands/auth.d.ts +2 -0
- package/dist/cli/commands/install.d.ts +1 -1
- package/dist/cli/commands/runtime-mcp.d.ts +4 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +11607 -597
- package/dist/lib/auth-store.d.ts +13 -0
- package/dist/lib/installer.d.ts +58 -55
- package/dist/lib/mcp-contracts.d.ts +86 -0
- package/dist/lib/project-state.d.ts +43 -0
- package/dist/lib/registry-data/business-marketing.d.ts +2 -0
- package/dist/lib/registry-data/communication.d.ts +2 -0
- package/dist/lib/registry-data/content-generation.d.ts +2 -0
- package/dist/lib/registry-data/data-analysis.d.ts +2 -0
- package/dist/lib/registry-data/design-branding.d.ts +2 -0
- package/dist/lib/registry-data/development-tools.d.ts +2 -0
- package/dist/lib/registry-data/education-learning.d.ts +2 -0
- package/dist/lib/registry-data/event-management.d.ts +2 -0
- package/dist/lib/registry-data/finance-compliance.d.ts +2 -0
- package/dist/lib/registry-data/health-wellness.d.ts +2 -0
- package/dist/lib/registry-data/index.d.ts +2 -0
- package/dist/lib/registry-data/media-processing.d.ts +2 -0
- package/dist/lib/registry-data/productivity-organization.d.ts +2 -0
- package/dist/lib/registry-data/project-management.d.ts +2 -0
- package/dist/lib/registry-data/research-writing.d.ts +2 -0
- package/dist/lib/registry-data/science-academic.d.ts +2 -0
- package/dist/lib/registry-data/travel-lifestyle.d.ts +2 -0
- package/dist/lib/registry-data/web-browser.d.ts +2 -0
- package/dist/lib/registry-types.d.ts +27 -0
- package/dist/lib/registry.d.ts +6 -18
- package/dist/lib/remote-registry.d.ts +3 -0
- package/dist/lib/run-state.d.ts +60 -0
- package/dist/lib/skill-aliases.d.ts +17 -0
- package/dist/lib/skillinfo.d.ts +5 -1
- package/dist/mcp/discovery-tools.d.ts +2 -0
- package/dist/mcp/helpers.d.ts +26 -0
- package/dist/mcp/http.d.ts +10 -0
- package/dist/mcp/index.d.ts +3 -2
- package/dist/mcp/operation-tools.d.ts +2 -0
- package/dist/mcp/resource-meta-tools.d.ts +2 -0
- package/dist/mcp/schedule-tools.d.ts +2 -0
- package/dist/mcp/server.d.ts +4 -0
- package/dist/types/api.d.ts +7 -4
- package/package.json +23 -10
- package/skills/_common/http-client.ts +1 -1
- package/skills/_common/index.ts +2 -3
- package/skills/_common/install.sh +5 -110
- package/skills/_common/installer.ts +31 -282
- package/skills/_common/skill-install.ts +14 -181
- package/skills/ad-creative-pack/SKILL.md +45 -0
- package/skills/ad-creative-pack/package.json +14 -0
- package/skills/advanced-math/package.json +3 -1
- package/skills/advanced-math/src/calculators.ts +118 -0
- package/skills/advanced-math/src/cli.ts +130 -0
- package/skills/advanced-math/src/conversion.ts +90 -0
- package/skills/advanced-math/src/finance.ts +75 -0
- package/skills/advanced-math/src/formatting.ts +95 -0
- package/skills/advanced-math/src/index.ts +24 -702
- package/skills/advanced-math/src/runtime.ts +49 -0
- package/skills/advanced-math/src/symbolic.ts +110 -0
- package/skills/advanced-math/src/types.ts +36 -0
- package/skills/analyze-data/SKILL.md +2 -2
- package/skills/analyze-data/src/analysis.ts +401 -0
- package/skills/analyze-data/src/cli.ts +66 -0
- package/skills/analyze-data/src/formatters.ts +235 -0
- package/skills/analyze-data/src/index.ts +6 -1027
- package/skills/analyze-data/src/logger.ts +36 -0
- package/skills/analyze-data/src/parsers.ts +57 -0
- package/skills/analyze-data/src/stats.ts +151 -0
- package/skills/analyze-data/src/types.ts +85 -0
- package/skills/api-docs-portal/SKILL.md +46 -0
- package/skills/api-docs-portal/package.json +9 -0
- package/skills/api-test-suite/src/index.ts +13 -0
- package/skills/apidocs/package.json +1 -1
- package/skills/apidocs/src/index.ts +3 -0
- package/skills/audio/package.json +2 -3
- package/skills/audio-cleanup-lab/SKILL.md +2 -2
- package/skills/audio-extract/CLAUDE.md +1 -1
- package/skills/audio-transcript-pack/SKILL.md +43 -0
- package/skills/audio-transcript-pack/package.json +10 -0
- package/skills/blog-article/CLAUDE.md +12 -0
- package/skills/blog-article/SKILL.md +45 -0
- package/skills/{create-blog-article → blog-article}/package.json +3 -3
- package/skills/brand-kit/SKILL.md +45 -0
- package/skills/brand-kit/package.json +14 -0
- package/skills/brand-photo-shoot/SKILL.md +28 -0
- package/skills/brand-photo-shoot/package.json +10 -0
- package/skills/brand-style-guide/SKILL.md +2 -2
- package/skills/brand-style-guide/src/index.ts +0 -0
- package/skills/budget-variance-analyzer/SKILL.md +2 -2
- package/skills/businessactivity/package.json +1 -1
- package/skills/businessactivity/src/index.ts +3 -0
- package/skills/calendar-events/src/ai-parser.ts +103 -0
- package/skills/calendar-events/src/api.ts +157 -0
- package/skills/calendar-events/src/auth.ts +22 -0
- package/skills/calendar-events/src/config.ts +6 -0
- package/skills/calendar-events/src/format.ts +96 -0
- package/skills/calendar-events/src/help.ts +54 -0
- package/skills/calendar-events/src/index.ts +21 -524
- package/skills/calendar-events/src/logger.ts +34 -0
- package/skills/calendar-events/src/types.ts +67 -0
- package/skills/compress-video/SKILL.md +2 -2
- package/skills/consolelog/package.json +1 -1
- package/skills/consolelog/src/index.ts +3 -0
- package/skills/contract-review-report/SKILL.md +43 -0
- package/skills/contract-review-report/package.json +10 -0
- package/skills/convert/SKILL.md +2 -3
- package/skills/customer-feedback-report/SKILL.md +44 -0
- package/skills/customer-feedback-report/package.json +10 -0
- package/skills/dashboard-builder/package.json +3 -1
- package/skills/database-explorer/package.json +3 -1
- package/skills/deepresearch/README.md +4 -13
- package/skills/deploy/src/http-client.ts +1 -1
- package/skills/diff-viewer/package.json +4 -1
- package/skills/doc-generate/package.json +0 -1
- package/skills/doc-generate/src/ai.ts +50 -0
- package/skills/doc-generate/src/cli.ts +203 -0
- package/skills/doc-generate/src/dependencies.ts +44 -0
- package/skills/doc-generate/src/document-builder.ts +299 -0
- package/skills/doc-generate/src/index.ts +40 -764
- package/skills/doc-generate/src/markdown-parser.ts +125 -0
- package/skills/doc-generate/src/types.ts +68 -0
- package/skills/domainpurchase/SKILL.md +1 -1
- package/skills/domainpurchase/package.json +1 -1
- package/skills/domainpurchase/src/index.ts +3 -0
- package/skills/domainsearch/SKILL.md +1 -1
- package/skills/domainsearch/package.json +1 -1
- package/skills/domainsearch/src/index.ts +3 -0
- package/skills/email-sequence/SKILL.md +44 -0
- package/skills/email-sequence/package.json +14 -0
- package/skills/excel/CLAUDE.md +2 -2
- package/skills/experiment-power-calculator/package.json +3 -1
- package/skills/extract-invoice/src/cli.ts +97 -0
- package/skills/extract-invoice/src/extractor.ts +170 -0
- package/skills/extract-invoice/src/file-utils.ts +46 -0
- package/skills/extract-invoice/src/formatters.ts +144 -0
- package/skills/extract-invoice/src/index.ts +44 -629
- package/skills/extract-invoice/src/runtime.ts +46 -0
- package/skills/extract-invoice/src/types.ts +88 -0
- package/skills/folder-tree/package.json +3 -1
- package/skills/form-filler/package.json +3 -1
- package/skills/generate-api-client/package.json +3 -1
- package/skills/generate-api-client/src/generator.ts +47 -0
- package/skills/generate-api-client/src/index.ts +3 -777
- package/skills/generate-api-client/src/logger.ts +34 -0
- package/skills/generate-api-client/src/python-generator.ts +245 -0
- package/skills/generate-api-client/src/spec-loader.ts +48 -0
- package/skills/generate-api-client/src/type-mappers.ts +79 -0
- package/skills/generate-api-client/src/types.ts +76 -0
- package/skills/generate-api-client/src/typescript-generator.ts +247 -0
- package/skills/generate-book-cover/package.json +3 -1
- package/skills/generate-dockerfile/src/cli.ts +78 -0
- package/skills/generate-dockerfile/src/dockerfile-templates.ts +392 -0
- package/skills/generate-dockerfile/src/index.ts +12 -790
- package/skills/generate-dockerfile/src/logger.ts +30 -0
- package/skills/generate-dockerfile/src/project-detection.ts +68 -0
- package/skills/generate-dockerfile/src/support-files.ts +171 -0
- package/skills/generate-dockerfile/src/types.ts +29 -0
- package/skills/generate-documentation/src/ai.ts +131 -0
- package/skills/generate-documentation/src/cli.ts +71 -0
- package/skills/generate-documentation/src/code-parser.ts +300 -0
- package/skills/generate-documentation/src/file-processing.ts +182 -0
- package/skills/generate-documentation/src/index.ts +13 -753
- package/skills/generate-documentation/src/runtime.ts +35 -0
- package/skills/generate-documentation/src/types.ts +30 -0
- package/skills/generate-env/package.json +3 -1
- package/skills/generate-env/src/cli.ts +85 -0
- package/skills/generate-env/src/detection.ts +161 -0
- package/skills/generate-env/src/env-data.ts +66 -0
- package/skills/generate-env/src/generators.ts +240 -0
- package/skills/generate-env/src/index.ts +76 -676
- package/skills/generate-env/src/runtime.ts +30 -0
- package/skills/generate-env/src/types.ts +32 -0
- package/skills/generate-favicon/package.json +3 -1
- package/skills/generate-mock-data/package.json +3 -1
- package/skills/generate-mock-data/src/ai.ts +102 -0
- package/skills/generate-mock-data/src/formatters.ts +84 -0
- package/skills/generate-mock-data/src/generator.ts +377 -0
- package/skills/generate-mock-data/src/index.ts +15 -716
- package/skills/generate-mock-data/src/logger.ts +37 -0
- package/skills/generate-mock-data/src/presets.ts +110 -0
- package/skills/generate-mock-data/src/types.ts +21 -0
- package/skills/generate-pr-description/src/ai.ts +144 -0
- package/skills/generate-pr-description/src/cli.ts +80 -0
- package/skills/generate-pr-description/src/clipboard.ts +30 -0
- package/skills/generate-pr-description/src/formatters.ts +231 -0
- package/skills/generate-pr-description/src/git.ts +153 -0
- package/skills/generate-pr-description/src/index.ts +21 -714
- package/skills/generate-pr-description/src/types.ts +49 -0
- package/skills/generate-presentation/src/ai-clients.ts +61 -0
- package/skills/generate-presentation/src/cli.ts +126 -0
- package/skills/generate-presentation/src/index.ts +3 -751
- package/skills/generate-presentation/src/logger.ts +67 -0
- package/skills/generate-presentation/src/presentation-generator.ts +425 -0
- package/skills/generate-presentation/src/runtime.ts +6 -0
- package/skills/generate-presentation/src/security.ts +12 -0
- package/skills/generate-presentation/src/types.ts +28 -0
- package/skills/generate-qrcode/package.json +4 -1
- package/skills/generate-regex/package.json +3 -1
- package/skills/generate-resume/src/cli.ts +157 -0
- package/skills/generate-resume/src/index.ts +13 -917
- package/skills/generate-resume/src/parsers.ts +95 -0
- package/skills/generate-resume/src/renderers.ts +538 -0
- package/skills/generate-resume/src/security.ts +39 -0
- package/skills/generate-resume/src/types.ts +86 -0
- package/skills/generate-social-posts/src/ai.ts +88 -0
- package/skills/generate-social-posts/src/cli.ts +118 -0
- package/skills/generate-social-posts/src/exporters.ts +126 -0
- package/skills/generate-social-posts/src/generator.ts +130 -0
- package/skills/generate-social-posts/src/index.ts +19 -709
- package/skills/generate-social-posts/src/platforms.ts +39 -0
- package/skills/generate-social-posts/src/runtime.ts +34 -0
- package/skills/generate-social-posts/src/source.ts +116 -0
- package/skills/generate-social-posts/src/types.ts +58 -0
- package/skills/gif-maker/package.json +4 -1
- package/skills/github-manager/package.json +3 -1
- package/skills/gmail/CLAUDE.md +1 -1
- package/skills/highlight-reel-generator/src/index.ts +19 -0
- package/skills/hook/src/commands/create.ts +20 -845
- package/skills/hook/src/templates/root.ts +196 -0
- package/skills/hook/src/templates/source.ts +647 -0
- package/skills/http-server/package.json +3 -1
- package/skills/icon-pack/README.md +28 -0
- package/skills/icon-pack/SKILL.md +23 -0
- package/skills/icon-pack/package.json +29 -0
- package/skills/{audio → icon-pack}/tsconfig.json +10 -12
- package/skills/image/package.json +1 -2
- package/skills/implementation-agent/package.json +3 -1
- package/skills/implementation-agent/src/ai-generation.ts +225 -0
- package/skills/implementation-agent/src/index.ts +3 -960
- package/skills/implementation-agent/src/minimist.d.ts +15 -0
- package/skills/implementation-agent/src/templates.ts +686 -0
- package/skills/implementation-agent/src/types.ts +53 -0
- package/skills/implementation-plan/package.json +3 -1
- package/skills/implementation-todo/package.json +3 -1
- package/skills/invoice/package.json +1 -1
- package/skills/invoice/src/index.ts +3 -0
- package/skills/invoice-reconciliation/SKILL.md +42 -0
- package/skills/invoice-reconciliation/package.json +10 -0
- package/skills/landing-page-pack/SKILL.md +47 -0
- package/skills/landing-page-pack/package.json +14 -0
- package/skills/latex-table-generator/package.json +3 -1
- package/skills/logo-design/SKILL.md +25 -44
- package/skills/logo-design/package.json +3 -15
- package/skills/lorem-generator/package.json +3 -1
- package/skills/lorem-generator/src/index.ts +13 -0
- package/skills/managehook/package.json +1 -1
- package/skills/managehook/src/index.ts +3 -0
- package/skills/managemcp/package.json +1 -1
- package/skills/managemcp/src/index.ts +3 -0
- package/skills/manageskill/package.json +1 -1
- package/skills/manageskill/src/index.ts +3 -0
- package/skills/markdown-validator/package.json +3 -1
- package/skills/markdown-validator/src/index.ts +1 -4
- package/skills/market-research-report/SKILL.md +41 -0
- package/skills/market-research-report/package.json +10 -0
- package/skills/mcp-builder/package.json +4 -1
- package/skills/mcp-builder/src/ai-descriptions.ts +37 -0
- package/skills/mcp-builder/src/generators.ts +513 -0
- package/skills/mcp-builder/src/index.ts +7 -908
- package/skills/mcp-builder/src/minimist.d.ts +15 -0
- package/skills/mcp-builder/src/naming.ts +12 -0
- package/skills/mcp-builder/src/options.ts +170 -0
- package/skills/mcp-builder/src/templates.ts +149 -0
- package/skills/mcp-builder/src/types.ts +42 -0
- package/skills/meeting-pack/SKILL.md +43 -0
- package/skills/meeting-pack/package.json +10 -0
- package/skills/merge-pdfs/package.json +5 -1
- package/skills/migration-plan-pack/SKILL.md +45 -0
- package/skills/migration-plan-pack/package.json +10 -0
- package/skills/music/package.json +2 -3
- package/skills/music-album/SKILL.md +37 -0
- package/skills/music-album/package.json +10 -0
- package/skills/notion-manager/package.json +3 -1
- package/skills/npmpublish/CLAUDE.md +5 -8
- package/skills/npmpublish/README.md +5 -26
- package/skills/npmpublish/src/index.ts +9 -147
- package/skills/one-page-website/SKILL.md +46 -0
- package/skills/one-page-website/package.json +10 -0
- package/skills/one-page-website/tsconfig.json +8 -0
- package/skills/pdf-generate/src/cli.ts +162 -0
- package/skills/pdf-generate/src/html.ts +84 -0
- package/skills/pdf-generate/src/index.ts +11 -800
- package/skills/pdf-generate/src/markdown.ts +27 -0
- package/skills/pdf-generate/src/pdf-writer.ts +78 -0
- package/skills/pdf-generate/src/runtime.ts +34 -0
- package/skills/pdf-generate/src/security.ts +37 -0
- package/skills/pdf-generate/src/templates.ts +311 -0
- package/skills/pdf-generate/src/types.ts +28 -0
- package/skills/pdf-read/SKILL.md +10 -10
- package/skills/pdf-to-dataset/SKILL.md +45 -0
- package/skills/pdf-to-dataset/package.json +10 -0
- package/skills/pdf-to-markdown/SKILL.md +49 -0
- package/skills/pdf-to-markdown/package.json +10 -0
- package/skills/pdf-to-markdown/tsconfig.json +10 -0
- package/skills/performance-audit-report/SKILL.md +42 -0
- package/skills/performance-audit-report/package.json +10 -0
- package/skills/persona-based-adwriter/src/index.ts +19 -0
- package/skills/photo-album/SKILL.md +29 -0
- package/skills/photo-album/package.json +9 -0
- package/skills/photo-album/tsconfig.json +4 -0
- package/skills/pitch-deck/SKILL.md +43 -0
- package/skills/pitch-deck/package.json +9 -0
- package/skills/playlist-maker/SKILL.md +33 -0
- package/skills/playlist-maker/package.json +9 -0
- package/skills/playlist-maker/tsconfig.json +4 -0
- package/skills/product-mockup/SKILL.md +45 -0
- package/skills/product-mockup/package.json +3 -20
- package/skills/product-mockup/tsconfig.json +3 -5
- package/skills/project-retro-companion/src/index.ts +19 -0
- package/skills/proposal-pack/SKILL.md +45 -0
- package/skills/proposal-pack/package.json +10 -0
- package/skills/read-pdf/SKILL.md +5 -4
- package/skills/repo-onboarding-report/SKILL.md +42 -0
- package/skills/repo-onboarding-report/package.json +10 -0
- package/skills/sales-call-recapper/src/index.ts +20 -0
- package/skills/salescopy/package.json +1 -1
- package/skills/salescopy/src/index.ts +3 -0
- package/skills/scaffold-project/src/ai-detect.ts +136 -0
- package/skills/scaffold-project/src/file-generators.ts +292 -0
- package/skills/scaffold-project/src/index.ts +8 -991
- package/skills/scaffold-project/src/project-config.ts +338 -0
- package/skills/scaffold-project/src/templates.ts +173 -0
- package/skills/scaffold-project/src/types.ts +58 -0
- package/skills/scientific-figure-check/package.json +3 -1
- package/skills/sdk-generator/SKILL.md +45 -0
- package/skills/sdk-generator/package.json +10 -0
- package/skills/sdk-generator/tsconfig.json +8 -0
- package/skills/security-audit/src/index.ts +25 -6
- package/skills/security-audit-report/SKILL.md +40 -0
- package/skills/security-audit-report/package.json +10 -0
- package/skills/seo-content-pack/SKILL.md +44 -0
- package/skills/seo-content-pack/package.json +9 -0
- package/skills/short-video-pack/SKILL.md +30 -0
- package/skills/short-video-pack/package.json +10 -0
- package/skills/slack-assistant/package.json +3 -1
- package/skills/slide-deck-generator/SKILL.md +44 -0
- package/skills/slide-deck-generator/package.json +10 -0
- package/skills/sms/package.json +1 -1
- package/skills/sms/src/index.ts +15 -0
- package/skills/social-content-calendar/SKILL.md +45 -0
- package/skills/social-content-calendar/package.json +14 -0
- package/skills/split-pdf/package.json +4 -1
- package/skills/subtitle/package.json +2 -1
- package/skills/subtitle/src/index.ts +3 -0
- package/skills/terraform-generator/package.json +3 -1
- package/skills/test-suite-generator/SKILL.md +41 -0
- package/skills/test-suite-generator/package.json +10 -0
- package/skills/timesheet/package.json +1 -1
- package/skills/timesheet/src/index.ts +3 -0
- package/skills/transcript/SKILL.md +1 -8
- package/skills/validate-config/package.json +3 -1
- package/skills/video/package.json +6 -4
- package/skills/video-downloader/package.json +3 -1
- package/skills/video-highlight-pack/SKILL.md +44 -0
- package/skills/video-highlight-pack/package.json +10 -0
- package/skills/voiceover-jingle-pack/SKILL.md +28 -0
- package/skills/voiceover-jingle-pack/package.json +10 -0
- package/skills/watermark/package.json +6 -1
- package/skills/webcrawling/package.json +2 -1
- package/skills/write/SKILL.md +6 -6
- package/dist/server/serve.d.ts +0 -11
- package/skills/apidocs/.claude/settings.json +0 -5
- package/skills/audio/.env.example +0 -14
- package/skills/audio/QUICKSTART.md +0 -158
- package/skills/audio/README.md +0 -256
- package/skills/audio/src/index-local.ts +0 -206
- package/skills/audio/src/index.ts +0 -95
- package/skills/audio/src/providers/elevenlabs.ts +0 -115
- package/skills/audio/src/providers/google.ts +0 -116
- package/skills/audio/src/providers/minimax.ts +0 -83
- package/skills/audio/src/providers/openai.ts +0 -115
- package/skills/audio/src/types.ts +0 -79
- package/skills/audiobook-chapter-proofer/CLAUDE.md +0 -19
- package/skills/audiobook-chapter-proofer/package.json +0 -27
- package/skills/audiobook-chapter-proofer/src/index.ts +0 -285
- package/skills/browse/src/client.ts +0 -373
- package/skills/browse/src/index-local.ts +0 -430
- package/skills/browse/src/index.ts +0 -110
- package/skills/browse/src/sse-server.ts +0 -919
- package/skills/browse/src/types.ts +0 -104
- package/skills/consolelog/src/server/index.ts +0 -508
- package/skills/create-blog-article/CLAUDE.md +0 -19
- package/skills/create-blog-article/src/index.ts +0 -745
- package/skills/create-blog-article/tsconfig.json +0 -10
- package/skills/deepresearch/src/agents/query-generator.ts +0 -91
- package/skills/deepresearch/src/agents/synthesizer.ts +0 -111
- package/skills/deepresearch/src/index.ts +0 -224
- package/skills/deepresearch/src/research.ts +0 -166
- package/skills/deepresearch/src/services/anthropic.ts +0 -69
- package/skills/deepresearch/src/services/exa.ts +0 -108
- package/skills/deepresearch/src/services/firecrawl.ts +0 -88
- package/skills/deepresearch/src/services/openai.ts +0 -81
- package/skills/deepresearch/src/types.ts +0 -76
- package/skills/deepresearch/src/utils/file.ts +0 -111
- package/skills/deepresearch/src/utils/logger.ts +0 -84
- package/skills/domainpurchase/src/server/index.ts +0 -332
- package/skills/domainsearch/src/server/index.ts +0 -229
- package/skills/e2bswarm/README.md +0 -135
- package/skills/e2bswarm/SKILL.md +0 -118
- package/skills/e2bswarm/examples/tasks-example.json +0 -38
- package/skills/e2bswarm/package.json +0 -59
- package/skills/e2bswarm/src/commands/collect.ts +0 -135
- package/skills/e2bswarm/src/commands/install.ts +0 -164
- package/skills/e2bswarm/src/commands/kill.ts +0 -62
- package/skills/e2bswarm/src/commands/spawn.ts +0 -134
- package/skills/e2bswarm/src/commands/status.ts +0 -90
- package/skills/e2bswarm/src/commands/sync.ts +0 -208
- package/skills/e2bswarm/src/index.ts +0 -121
- package/skills/e2bswarm/src/lib/config.ts +0 -75
- package/skills/e2bswarm/src/lib/e2b.ts +0 -490
- package/skills/e2bswarm/src/lib/github.ts +0 -253
- package/skills/e2bswarm/src/lib/logger.ts +0 -41
- package/skills/e2bswarm/src/lib/paths.ts +0 -75
- package/skills/e2bswarm/src/lib/tasks.ts +0 -320
- package/skills/e2bswarm/src/types/index.ts +0 -107
- package/skills/e2bswarm/templates/codebox/e2b.Dockerfile +0 -38
- package/skills/e2bswarm/templates/codebox/e2b.toml +0 -3
- package/skills/e2bswarm/templates/setup.sh +0 -21
- package/skills/e2bswarm/tsconfig.json +0 -19
- package/skills/generate-book-cover/src/index.ts +0 -694
- package/skills/image/src/index-local.ts +0 -206
- package/skills/image/src/index.ts +0 -96
- package/skills/image/src/providers/google.ts +0 -79
- package/skills/image/src/providers/minimax.ts +0 -94
- package/skills/image/src/providers/openai.ts +0 -80
- package/skills/image/src/providers/xai.ts +0 -73
- package/skills/image/src/types.ts +0 -37
- package/skills/logo-design/CLAUDE.md +0 -30
- package/skills/logo-design/src/index.ts +0 -322
- package/skills/managehook/src/server/index.ts +0 -108
- package/skills/managemcp/src/server/index.ts +0 -108
- package/skills/manageskill/src/server/index.ts +0 -108
- package/skills/music/CLAUDE.md +0 -9
- package/skills/music/src/index.ts +0 -94
- package/skills/music/tsconfig.json +0 -10
- package/skills/pdf-read/src/index.ts +0 -320
- package/skills/product-mockup/CLAUDE.md +0 -19
- package/skills/product-mockup/src/index.ts +0 -290
- package/skills/read-pdf/src/index.ts +0 -388
- package/skills/remove-background/src/index.ts +0 -405
- package/skills/scaffold-project/my-app/.env.example +0 -2
- package/skills/scaffold-project/my-app/README.md +0 -72
- package/skills/scaffold-project/my-app/package.json +0 -29
- package/skills/scaffold-project/my-app/src/index.ts +0 -23
- package/skills/scaffold-project/my-app/tsconfig.json +0 -33
- package/skills/sound-effects/SKILL.md +0 -34
- package/skills/sound-effects/package.json +0 -21
- package/skills/sound-effects/src/index.ts +0 -172
- package/skills/sound-effects/tsconfig.json +0 -8
- package/skills/transcript/src/chunker.ts +0 -215
- package/skills/transcript/src/formatter.ts +0 -134
- package/skills/transcript/src/index-local.ts +0 -226
- package/skills/transcript/src/index.ts +0 -110
- package/skills/transcript/src/providers/elevenlabs.ts +0 -133
- package/skills/transcript/src/providers/gemini.ts +0 -192
- package/skills/transcript/src/providers/index.ts +0 -54
- package/skills/transcript/src/providers/openai.ts +0 -203
- package/skills/transcript/src/types.ts +0 -106
- package/skills/video/.env.example +0 -14
- package/skills/video/EXAMPLES.md +0 -266
- package/skills/video/LICENSE +0 -192
- package/skills/video/README.md +0 -174
- package/skills/video/src/cli.ts +0 -155
- package/skills/video/src/index-local.ts +0 -148
- package/skills/video/src/index.ts +0 -96
- package/skills/video/src/providers/google-veo.ts +0 -126
- package/skills/video/src/providers/index.ts +0 -22
- package/skills/video/src/providers/minimax.ts +0 -100
- package/skills/video/src/providers/openai-sora.ts +0 -164
- package/skills/video/src/providers/runway.ts +0 -159
- package/skills/video/src/types.ts +0 -35
- package/skills/video/tsconfig.json +0 -22
- package/skills/voiceover-casting-assistant/CLAUDE.md +0 -19
- package/skills/voiceover-casting-assistant/package.json +0 -27
- package/skills/voiceover-casting-assistant/src/index.ts +0 -255
- package/skills/voiceover-casting-assistant/tsconfig.json +0 -10
- package/skills/webcrawling/src/commands/config.ts +0 -34
- package/skills/webcrawling/src/commands/crawl.ts +0 -33
- package/skills/webcrawling/src/commands/scrape.ts +0 -32
- package/skills/webcrawling/src/commands/sessions.ts +0 -42
- package/skills/webcrawling/src/lib/crawler.ts +0 -174
- package/skills/webcrawling/src/lib/storage.ts +0 -130
- package/skills/webcrawling/src/types/index.ts +0 -45
- package/skills/webcrawling/src/utils/logger.ts +0 -30
- package/skills/webcrawling/src/utils/paths.ts +0 -28
- /package/skills/{audiobook-chapter-proofer → blog-article}/tsconfig.json +0 -0
|
@@ -2,809 +2,85 @@
|
|
|
2
2
|
|
|
3
3
|
import * as fs from "fs";
|
|
4
4
|
import * as path from "path";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
let BorderStyle: any;
|
|
17
|
-
let PageNumber: any;
|
|
18
|
-
let NumberFormat: any;
|
|
19
|
-
let Header: any;
|
|
20
|
-
let Footer: any;
|
|
21
|
-
let TableOfContents: any;
|
|
22
|
-
let PageBreak: any;
|
|
23
|
-
let marked: any;
|
|
24
|
-
|
|
25
|
-
function printHelpAndExit(): never {
|
|
26
|
-
console.log(`
|
|
27
|
-
Generate DOCX - Create Word documents from markdown or AI
|
|
28
|
-
|
|
29
|
-
Usage:
|
|
30
|
-
doc-generate <markdown-file> [options]
|
|
31
|
-
doc-generate --topic "Topic" [options]
|
|
32
|
-
doc-generate --prompt "Prompt" [options]
|
|
33
|
-
|
|
34
|
-
Input Options:
|
|
35
|
-
<file> Input markdown file
|
|
36
|
-
--topic <text> Topic for AI to write about
|
|
37
|
-
--prompt <text> Direct prompt for AI generation
|
|
38
|
-
--text <text> Plain text content
|
|
39
|
-
|
|
40
|
-
Output Options:
|
|
41
|
-
-o, --output <path> Output file path
|
|
42
|
-
--dir <path> Output directory (default: .skills/exports)
|
|
43
|
-
--template <name> Template: default, report, letter, memo, resume, article
|
|
44
|
-
--help, -h Show this help
|
|
45
|
-
`);
|
|
46
|
-
process.exit(0);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
if (process.argv.includes("--help") || process.argv.includes("-h")) {
|
|
50
|
-
printHelpAndExit();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
async function loadDocumentDeps(): Promise<void> {
|
|
54
|
-
if (Document && marked) return;
|
|
55
|
-
try {
|
|
56
|
-
const docx = await import("docx");
|
|
57
|
-
Document = docx.Document;
|
|
58
|
-
Packer = docx.Packer;
|
|
59
|
-
Paragraph = docx.Paragraph;
|
|
60
|
-
TextRun = docx.TextRun;
|
|
61
|
-
HeadingLevel = docx.HeadingLevel;
|
|
62
|
-
Table = docx.Table;
|
|
63
|
-
TableRow = docx.TableRow;
|
|
64
|
-
TableCell = docx.TableCell;
|
|
65
|
-
WidthType = docx.WidthType;
|
|
66
|
-
AlignmentType = docx.AlignmentType;
|
|
67
|
-
BorderStyle = docx.BorderStyle;
|
|
68
|
-
PageNumber = docx.PageNumber;
|
|
69
|
-
NumberFormat = docx.NumberFormat;
|
|
70
|
-
Header = docx.Header;
|
|
71
|
-
Footer = docx.Footer;
|
|
72
|
-
TableOfContents = docx.TableOfContents;
|
|
73
|
-
PageBreak = docx.PageBreak;
|
|
74
|
-
({ marked } = await import("marked"));
|
|
75
|
-
} catch {
|
|
76
|
-
throw new Error("Missing document generation dependencies. Run bun install in this skill directory.");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
async function createOpenAIClient(apiKey: string) {
|
|
81
|
-
try {
|
|
82
|
-
const { default: OpenAI } = await import("openai");
|
|
83
|
-
return new OpenAI({ apiKey });
|
|
84
|
-
} catch {
|
|
85
|
-
throw new Error("Missing dependency 'openai'. Run bun install in this skill directory.");
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
const minimist = (await import("minimist")).default;
|
|
90
|
-
|
|
91
|
-
// Types
|
|
92
|
-
interface DocOptions {
|
|
93
|
-
output: string;
|
|
94
|
-
dir: string;
|
|
95
|
-
template: "default" | "report" | "letter" | "memo" | "resume" | "article";
|
|
96
|
-
title: string;
|
|
97
|
-
author: string;
|
|
98
|
-
company: string;
|
|
99
|
-
date: string;
|
|
100
|
-
font: string;
|
|
101
|
-
fontSize: number;
|
|
102
|
-
headingFont: string;
|
|
103
|
-
lineSpacing: number;
|
|
104
|
-
margins: number;
|
|
105
|
-
pageSize: "letter" | "a4" | "legal";
|
|
106
|
-
toc: boolean;
|
|
107
|
-
pageNumbers: boolean;
|
|
108
|
-
header: string;
|
|
109
|
-
footer: string;
|
|
110
|
-
// AI options
|
|
111
|
-
topic: string | null;
|
|
112
|
-
prompt: string | null;
|
|
113
|
-
text: string | null;
|
|
114
|
-
sections: number;
|
|
115
|
-
style: "professional" | "casual" | "formal" | "academic";
|
|
116
|
-
tone: "neutral" | "friendly" | "authoritative";
|
|
117
|
-
length: "short" | "medium" | "long" | "comprehensive";
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
interface ParsedContent {
|
|
121
|
-
title: string;
|
|
122
|
-
sections: ContentSection[];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
interface ContentSection {
|
|
126
|
-
type: "heading" | "paragraph" | "list" | "table" | "quote" | "code" | "image" | "hr";
|
|
127
|
-
level?: number;
|
|
128
|
-
text?: string;
|
|
129
|
-
items?: string[];
|
|
130
|
-
rows?: string[][];
|
|
131
|
-
language?: string;
|
|
132
|
-
src?: string;
|
|
133
|
-
ordered?: boolean;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
// Parse arguments
|
|
137
|
-
const args = minimist(process.argv.slice(2), {
|
|
138
|
-
string: ["output", "dir", "template", "title", "author", "company", "date", "font", "heading-font", "header", "footer", "topic", "prompt", "text", "style", "tone", "length", "page-size"],
|
|
139
|
-
boolean: ["toc", "page-numbers", "help"],
|
|
140
|
-
default: {
|
|
141
|
-
dir: ".skills/exports",
|
|
142
|
-
template: "default",
|
|
143
|
-
font: "Calibri",
|
|
144
|
-
"font-size": 11,
|
|
145
|
-
"heading-font": "Calibri Light",
|
|
146
|
-
"line-spacing": 1.15,
|
|
147
|
-
margins: 1,
|
|
148
|
-
"page-size": "letter",
|
|
149
|
-
"page-numbers": true,
|
|
150
|
-
sections: 5,
|
|
151
|
-
style: "professional",
|
|
152
|
-
tone: "neutral",
|
|
153
|
-
length: "medium",
|
|
154
|
-
},
|
|
155
|
-
alias: {
|
|
156
|
-
o: "output",
|
|
157
|
-
h: "help",
|
|
158
|
-
},
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
// Show help
|
|
162
|
-
if (args.help) {
|
|
163
|
-
console.log(`
|
|
164
|
-
Generate DOCX - Create Word documents from markdown or AI
|
|
165
|
-
|
|
166
|
-
Usage:
|
|
167
|
-
skills run generate-docx -- <markdown-file> [options]
|
|
168
|
-
skills run generate-docx -- --topic "Topic" [options]
|
|
169
|
-
skills run generate-docx -- --prompt "Prompt" [options]
|
|
170
|
-
|
|
171
|
-
Input Options:
|
|
172
|
-
<file> Input markdown file
|
|
173
|
-
--topic <text> Topic for AI to write about
|
|
174
|
-
--prompt <text> Direct prompt for AI generation
|
|
175
|
-
--text <text> Plain text content
|
|
176
|
-
|
|
177
|
-
AI Options:
|
|
178
|
-
--sections <n> Number of sections (default: 5)
|
|
179
|
-
--style <type> Style: professional, casual, formal, academic
|
|
180
|
-
--tone <type> Tone: neutral, friendly, authoritative
|
|
181
|
-
--length <type> Length: short, medium, long, comprehensive
|
|
182
|
-
|
|
183
|
-
Output Options:
|
|
184
|
-
-o, --output <path> Output file path
|
|
185
|
-
--dir <path> Output directory (default: .skills/exports)
|
|
186
|
-
|
|
187
|
-
Template Options:
|
|
188
|
-
--template <name> Template: default, report, letter, memo, resume, article
|
|
189
|
-
--title <text> Document title
|
|
190
|
-
--author <text> Author name
|
|
191
|
-
--company <text> Company name
|
|
192
|
-
--date <text> Document date
|
|
193
|
-
|
|
194
|
-
Styling Options:
|
|
195
|
-
--font <name> Font family (default: Calibri)
|
|
196
|
-
--font-size <pt> Base font size (default: 11)
|
|
197
|
-
--heading-font Heading font (default: Calibri Light)
|
|
198
|
-
--line-spacing <n> Line spacing (default: 1.15)
|
|
199
|
-
--margins <inches> Page margins (default: 1)
|
|
200
|
-
--page-size <size> Page size: letter, a4, legal
|
|
201
|
-
|
|
202
|
-
Content Options:
|
|
203
|
-
--toc Include table of contents
|
|
204
|
-
--page-numbers Include page numbers (default: true)
|
|
205
|
-
--header <text> Header text
|
|
206
|
-
--footer <text> Footer text
|
|
207
|
-
|
|
208
|
-
Examples:
|
|
209
|
-
skills run generate-docx -- document.md -o output.docx
|
|
210
|
-
skills run generate-docx -- --topic "Business Plan" --template report -o plan.docx
|
|
211
|
-
skills run generate-docx -- --prompt "Write a cover letter" --template letter
|
|
212
|
-
`);
|
|
213
|
-
process.exit(0);
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// Build options
|
|
217
|
-
const options: DocOptions = {
|
|
218
|
-
output: args.output || "",
|
|
219
|
-
dir: args.dir,
|
|
220
|
-
template: args.template as DocOptions["template"],
|
|
221
|
-
title: args.title || "",
|
|
222
|
-
author: args.author || "",
|
|
223
|
-
company: args.company || "",
|
|
224
|
-
date: args.date || new Date().toLocaleDateString(),
|
|
225
|
-
font: args.font,
|
|
226
|
-
fontSize: parseInt(args["font-size"]) || 11,
|
|
227
|
-
headingFont: args["heading-font"],
|
|
228
|
-
lineSpacing: parseFloat(args["line-spacing"]) || 1.15,
|
|
229
|
-
margins: parseFloat(args.margins) || 1,
|
|
230
|
-
pageSize: args["page-size"] as DocOptions["pageSize"],
|
|
231
|
-
toc: args.toc,
|
|
232
|
-
pageNumbers: args["page-numbers"],
|
|
233
|
-
header: args.header || "",
|
|
234
|
-
footer: args.footer || "",
|
|
235
|
-
topic: args.topic || null,
|
|
236
|
-
prompt: args.prompt || null,
|
|
237
|
-
text: args.text || null,
|
|
238
|
-
sections: parseInt(args.sections) || 5,
|
|
239
|
-
style: args.style as DocOptions["style"],
|
|
240
|
-
tone: args.tone as DocOptions["tone"],
|
|
241
|
-
length: args.length as DocOptions["length"],
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
// Get input file
|
|
245
|
-
const inputFile = args._[0] as string | undefined;
|
|
246
|
-
|
|
247
|
-
// Generate content with AI
|
|
248
|
-
async function generateWithAI(topic: string, isPrompt: boolean = false): Promise<string> {
|
|
249
|
-
const apiKey = process.env.OPENAI_API_KEY;
|
|
250
|
-
if (!apiKey) {
|
|
251
|
-
throw new Error("OPENAI_API_KEY environment variable is required for AI generation");
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
const openai = await createOpenAIClient(apiKey);
|
|
255
|
-
|
|
256
|
-
const lengthGuide = {
|
|
257
|
-
short: "Keep it concise, around 500 words total.",
|
|
258
|
-
medium: "Write a moderate length document, around 1000-1500 words.",
|
|
259
|
-
long: "Write a comprehensive document, around 2000-3000 words.",
|
|
260
|
-
comprehensive: "Write a very detailed document, around 4000+ words with thorough coverage.",
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
const styleGuide = {
|
|
264
|
-
professional: "Use professional business language.",
|
|
265
|
-
casual: "Use a casual, conversational tone.",
|
|
266
|
-
formal: "Use formal, academic language.",
|
|
267
|
-
academic: "Use scholarly, well-researched language with citations where appropriate.",
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
let systemPrompt: string;
|
|
271
|
-
let userPrompt: string;
|
|
272
|
-
|
|
273
|
-
if (isPrompt) {
|
|
274
|
-
systemPrompt = `You are a professional document writer. Write in markdown format with proper headings, paragraphs, lists, and formatting. ${styleGuide[options.style]} ${lengthGuide[options.length]}`;
|
|
275
|
-
userPrompt = topic;
|
|
276
|
-
} else {
|
|
277
|
-
systemPrompt = `You are a professional document writer creating a ${options.template} document. Write in markdown format with:
|
|
278
|
-
- A clear title (# Title)
|
|
279
|
-
- ${options.sections} main sections (## Section headings)
|
|
280
|
-
- Proper paragraphs, bullet points, and formatting as needed
|
|
281
|
-
- ${styleGuide[options.style]}
|
|
282
|
-
- ${lengthGuide[options.length]}
|
|
283
|
-
|
|
284
|
-
Output ONLY the markdown content, no explanations.`;
|
|
285
|
-
userPrompt = `Write a document about: ${topic}`;
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
console.log("Generating content with AI...");
|
|
289
|
-
|
|
290
|
-
const response = await openai.chat.completions.create({
|
|
291
|
-
model: "gpt-4o",
|
|
292
|
-
messages: [
|
|
293
|
-
{ role: "system", content: systemPrompt },
|
|
294
|
-
{ role: "user", content: userPrompt },
|
|
295
|
-
],
|
|
296
|
-
temperature: 0.7,
|
|
297
|
-
});
|
|
298
|
-
|
|
299
|
-
return response.choices[0]?.message?.content || "";
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
// Parse markdown to structured content
|
|
303
|
-
function parseMarkdown(markdown: string): ParsedContent {
|
|
304
|
-
const sections: ContentSection[] = [];
|
|
305
|
-
let title = options.title || "Document";
|
|
306
|
-
|
|
307
|
-
// Simple markdown parser
|
|
308
|
-
const lines = markdown.split("\n");
|
|
309
|
-
let i = 0;
|
|
310
|
-
let currentList: { items: string[]; ordered: boolean } | null = null;
|
|
311
|
-
let currentTable: string[][] | null = null;
|
|
312
|
-
let inCodeBlock = false;
|
|
313
|
-
let codeContent = "";
|
|
314
|
-
let codeLanguage = "";
|
|
315
|
-
|
|
316
|
-
while (i < lines.length) {
|
|
317
|
-
const line = lines[i];
|
|
318
|
-
|
|
319
|
-
// Code blocks
|
|
320
|
-
if (line.startsWith("```")) {
|
|
321
|
-
if (!inCodeBlock) {
|
|
322
|
-
inCodeBlock = true;
|
|
323
|
-
codeLanguage = line.slice(3).trim();
|
|
324
|
-
codeContent = "";
|
|
325
|
-
} else {
|
|
326
|
-
inCodeBlock = false;
|
|
327
|
-
sections.push({ type: "code", text: codeContent.trim(), language: codeLanguage });
|
|
328
|
-
}
|
|
329
|
-
i++;
|
|
330
|
-
continue;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
if (inCodeBlock) {
|
|
334
|
-
codeContent += line + "\n";
|
|
335
|
-
i++;
|
|
336
|
-
continue;
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// Flush current list if we're not on a list line
|
|
340
|
-
if (currentList && !line.match(/^[\s]*[-*+]\s/) && !line.match(/^[\s]*\d+\.\s/) && line.trim() !== "") {
|
|
341
|
-
sections.push({ type: "list", items: currentList.items, ordered: currentList.ordered });
|
|
342
|
-
currentList = null;
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
// Flush current table if we're not on a table line
|
|
346
|
-
if (currentTable && !line.startsWith("|") && line.trim() !== "") {
|
|
347
|
-
sections.push({ type: "table", rows: currentTable });
|
|
348
|
-
currentTable = null;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
// Headings
|
|
352
|
-
const headingMatch = line.match(/^(#{1,6})\s+(.+)$/);
|
|
353
|
-
if (headingMatch) {
|
|
354
|
-
const level = headingMatch[1].length;
|
|
355
|
-
const text = headingMatch[2];
|
|
356
|
-
if (level === 1 && !options.title) {
|
|
357
|
-
title = text;
|
|
358
|
-
}
|
|
359
|
-
sections.push({ type: "heading", level, text });
|
|
360
|
-
i++;
|
|
361
|
-
continue;
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
// Horizontal rule
|
|
365
|
-
if (line.match(/^[-*_]{3,}$/)) {
|
|
366
|
-
sections.push({ type: "hr" });
|
|
367
|
-
i++;
|
|
368
|
-
continue;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// Blockquote
|
|
372
|
-
if (line.startsWith(">")) {
|
|
373
|
-
const quoteText = line.replace(/^>\s*/, "");
|
|
374
|
-
sections.push({ type: "quote", text: quoteText });
|
|
375
|
-
i++;
|
|
376
|
-
continue;
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// Unordered list
|
|
380
|
-
const ulMatch = line.match(/^[\s]*[-*+]\s+(.+)$/);
|
|
381
|
-
if (ulMatch) {
|
|
382
|
-
if (!currentList || currentList.ordered) {
|
|
383
|
-
if (currentList) {
|
|
384
|
-
sections.push({ type: "list", items: currentList.items, ordered: currentList.ordered });
|
|
385
|
-
}
|
|
386
|
-
currentList = { items: [], ordered: false };
|
|
387
|
-
}
|
|
388
|
-
currentList.items.push(ulMatch[1]);
|
|
389
|
-
i++;
|
|
390
|
-
continue;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
// Ordered list
|
|
394
|
-
const olMatch = line.match(/^[\s]*\d+\.\s+(.+)$/);
|
|
395
|
-
if (olMatch) {
|
|
396
|
-
if (!currentList || !currentList.ordered) {
|
|
397
|
-
if (currentList) {
|
|
398
|
-
sections.push({ type: "list", items: currentList.items, ordered: currentList.ordered });
|
|
399
|
-
}
|
|
400
|
-
currentList = { items: [], ordered: true };
|
|
401
|
-
}
|
|
402
|
-
currentList.items.push(olMatch[1]);
|
|
403
|
-
i++;
|
|
404
|
-
continue;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// Table
|
|
408
|
-
if (line.startsWith("|")) {
|
|
409
|
-
const cells = line.split("|").slice(1, -1).map(c => c.trim());
|
|
410
|
-
if (!currentTable) {
|
|
411
|
-
currentTable = [];
|
|
412
|
-
}
|
|
413
|
-
// Skip separator row
|
|
414
|
-
if (!cells.every(c => c.match(/^[-:]+$/))) {
|
|
415
|
-
currentTable.push(cells);
|
|
416
|
-
}
|
|
417
|
-
i++;
|
|
418
|
-
continue;
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
// Regular paragraph
|
|
422
|
-
if (line.trim()) {
|
|
423
|
-
sections.push({ type: "paragraph", text: line });
|
|
5
|
+
import { generateWithAI } from "./ai";
|
|
6
|
+
import { parseCli } from "./cli";
|
|
7
|
+
import { loadDocumentDeps } from "./dependencies";
|
|
8
|
+
import { buildDocument } from "./document-builder";
|
|
9
|
+
import { parseMarkdown } from "./markdown-parser";
|
|
10
|
+
|
|
11
|
+
async function resolveMarkdown(inputFile: string | undefined, options: ReturnType<typeof parseCli>["options"]) {
|
|
12
|
+
if (inputFile) {
|
|
13
|
+
if (!fs.existsSync(inputFile)) {
|
|
14
|
+
console.error(`Error: File not found: ${inputFile}`);
|
|
15
|
+
process.exit(1);
|
|
424
16
|
}
|
|
425
|
-
|
|
426
|
-
|
|
17
|
+
console.log(`Reading from: ${inputFile}`);
|
|
18
|
+
return fs.readFileSync(inputFile, "utf-8");
|
|
427
19
|
}
|
|
428
20
|
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
sections.push({ type: "list", items: currentList.items, ordered: currentList.ordered });
|
|
21
|
+
if (options.topic) {
|
|
22
|
+
return generateWithAI(options, options.topic);
|
|
432
23
|
}
|
|
433
|
-
if (currentTable) {
|
|
434
|
-
sections.push({ type: "table", rows: currentTable });
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
return { title, sections };
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
// Parse inline formatting
|
|
441
|
-
function parseInlineFormatting(text: string): any[] {
|
|
442
|
-
const runs: any[] = [];
|
|
443
|
-
let remaining = text;
|
|
444
24
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
let lastIndex = 0;
|
|
448
|
-
let match;
|
|
449
|
-
|
|
450
|
-
while ((match = regex.exec(text)) !== null) {
|
|
451
|
-
// Add text before match
|
|
452
|
-
if (match.index > lastIndex) {
|
|
453
|
-
runs.push(new TextRun({ text: text.slice(lastIndex, match.index), font: options.font, size: options.fontSize * 2 }));
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (match[1]) {
|
|
457
|
-
// Bold
|
|
458
|
-
runs.push(new TextRun({ text: match[2], bold: true, font: options.font, size: options.fontSize * 2 }));
|
|
459
|
-
} else if (match[3]) {
|
|
460
|
-
// Italic
|
|
461
|
-
runs.push(new TextRun({ text: match[4], italics: true, font: options.font, size: options.fontSize * 2 }));
|
|
462
|
-
} else if (match[5]) {
|
|
463
|
-
// Code
|
|
464
|
-
runs.push(new TextRun({ text: match[5], font: "Courier New", size: options.fontSize * 2 }));
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
lastIndex = match.index + match[0].length;
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// Add remaining text
|
|
471
|
-
if (lastIndex < text.length) {
|
|
472
|
-
runs.push(new TextRun({ text: text.slice(lastIndex), font: options.font, size: options.fontSize * 2 }));
|
|
25
|
+
if (options.prompt) {
|
|
26
|
+
return generateWithAI(options, options.prompt, true);
|
|
473
27
|
}
|
|
474
28
|
|
|
475
|
-
if (
|
|
476
|
-
|
|
29
|
+
if (options.text) {
|
|
30
|
+
return options.text;
|
|
477
31
|
}
|
|
478
32
|
|
|
479
|
-
|
|
33
|
+
console.error("Error: No input specified. Provide a markdown file, --topic, --prompt, or --text");
|
|
34
|
+
process.exit(1);
|
|
480
35
|
}
|
|
481
36
|
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
function buildDocument(content: ParsedContent): any {
|
|
494
|
-
const pageSize = getPageSize(options.pageSize);
|
|
495
|
-
const marginTwips = options.margins * 1440; // Convert inches to twips
|
|
496
|
-
|
|
497
|
-
const children: any[] = [];
|
|
498
|
-
|
|
499
|
-
// Add title page for report template
|
|
500
|
-
if (options.template === "report") {
|
|
501
|
-
children.push(
|
|
502
|
-
new Paragraph({ text: "", spacing: { after: 4000 } }),
|
|
503
|
-
new Paragraph({
|
|
504
|
-
children: [new TextRun({ text: content.title, font: options.headingFont, size: 72, bold: true })],
|
|
505
|
-
alignment: AlignmentType.CENTER,
|
|
506
|
-
}),
|
|
507
|
-
new Paragraph({ text: "", spacing: { after: 1000 } })
|
|
508
|
-
);
|
|
509
|
-
|
|
510
|
-
if (options.author) {
|
|
511
|
-
children.push(
|
|
512
|
-
new Paragraph({
|
|
513
|
-
children: [new TextRun({ text: `By ${options.author}`, font: options.font, size: 28 })],
|
|
514
|
-
alignment: AlignmentType.CENTER,
|
|
515
|
-
})
|
|
516
|
-
);
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
if (options.company) {
|
|
520
|
-
children.push(
|
|
521
|
-
new Paragraph({
|
|
522
|
-
children: [new TextRun({ text: options.company, font: options.font, size: 24 })],
|
|
523
|
-
alignment: AlignmentType.CENTER,
|
|
524
|
-
})
|
|
525
|
-
);
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
children.push(
|
|
529
|
-
new Paragraph({
|
|
530
|
-
children: [new TextRun({ text: options.date, font: options.font, size: 24 })],
|
|
531
|
-
alignment: AlignmentType.CENTER,
|
|
532
|
-
spacing: { before: 400 },
|
|
533
|
-
}),
|
|
534
|
-
new Paragraph({ children: [new PageBreak()] })
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
// Add letter/memo header
|
|
539
|
-
if (options.template === "letter" || options.template === "memo") {
|
|
540
|
-
if (options.company) {
|
|
541
|
-
children.push(
|
|
542
|
-
new Paragraph({
|
|
543
|
-
children: [new TextRun({ text: options.company, font: options.font, size: options.fontSize * 2, bold: true })],
|
|
544
|
-
})
|
|
545
|
-
);
|
|
546
|
-
}
|
|
547
|
-
children.push(
|
|
548
|
-
new Paragraph({
|
|
549
|
-
children: [new TextRun({ text: options.date, font: options.font, size: options.fontSize * 2 })],
|
|
550
|
-
spacing: { after: 400 },
|
|
551
|
-
}),
|
|
552
|
-
new Paragraph({ text: "", spacing: { after: 400 } })
|
|
553
|
-
);
|
|
554
|
-
}
|
|
555
|
-
|
|
556
|
-
// Add TOC if requested
|
|
557
|
-
if (options.toc) {
|
|
558
|
-
children.push(
|
|
559
|
-
new Paragraph({
|
|
560
|
-
children: [new TextRun({ text: "Table of Contents", font: options.headingFont, size: 32, bold: true })],
|
|
561
|
-
spacing: { after: 400 },
|
|
562
|
-
}),
|
|
563
|
-
new TableOfContents("Table of Contents", {
|
|
564
|
-
hyperlink: true,
|
|
565
|
-
headingStyleRange: "1-3",
|
|
566
|
-
}),
|
|
567
|
-
new Paragraph({ children: [new PageBreak()] })
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
|
|
571
|
-
// Process sections
|
|
572
|
-
for (const section of content.sections) {
|
|
573
|
-
switch (section.type) {
|
|
574
|
-
case "heading":
|
|
575
|
-
const headingLevel = section.level === 1 ? HeadingLevel.HEADING_1 :
|
|
576
|
-
section.level === 2 ? HeadingLevel.HEADING_2 :
|
|
577
|
-
section.level === 3 ? HeadingLevel.HEADING_3 :
|
|
578
|
-
section.level === 4 ? HeadingLevel.HEADING_4 :
|
|
579
|
-
HeadingLevel.HEADING_5;
|
|
580
|
-
const headingSize = section.level === 1 ? 32 : section.level === 2 ? 26 : section.level === 3 ? 22 : 20;
|
|
581
|
-
children.push(
|
|
582
|
-
new Paragraph({
|
|
583
|
-
children: [new TextRun({ text: section.text || "", font: options.headingFont, size: headingSize, bold: true })],
|
|
584
|
-
heading: headingLevel,
|
|
585
|
-
spacing: { before: 400, after: 200 },
|
|
586
|
-
})
|
|
587
|
-
);
|
|
588
|
-
break;
|
|
589
|
-
|
|
590
|
-
case "paragraph":
|
|
591
|
-
children.push(
|
|
592
|
-
new Paragraph({
|
|
593
|
-
children: parseInlineFormatting(section.text || ""),
|
|
594
|
-
spacing: { after: 200, line: options.lineSpacing * 240 },
|
|
595
|
-
})
|
|
596
|
-
);
|
|
597
|
-
break;
|
|
598
|
-
|
|
599
|
-
case "list":
|
|
600
|
-
for (let i = 0; i < (section.items?.length || 0); i++) {
|
|
601
|
-
children.push(
|
|
602
|
-
new Paragraph({
|
|
603
|
-
children: parseInlineFormatting(section.items![i]),
|
|
604
|
-
bullet: section.ordered ? undefined : { level: 0 },
|
|
605
|
-
numbering: section.ordered ? { reference: "default-numbering", level: 0 } : undefined,
|
|
606
|
-
spacing: { after: 100 },
|
|
607
|
-
})
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
break;
|
|
611
|
-
|
|
612
|
-
case "quote":
|
|
613
|
-
children.push(
|
|
614
|
-
new Paragraph({
|
|
615
|
-
children: [new TextRun({ text: section.text || "", font: options.font, size: options.fontSize * 2, italics: true })],
|
|
616
|
-
indent: { left: 720 },
|
|
617
|
-
spacing: { before: 200, after: 200 },
|
|
618
|
-
border: { left: { style: BorderStyle.SINGLE, size: 12, color: "888888" } },
|
|
619
|
-
})
|
|
620
|
-
);
|
|
621
|
-
break;
|
|
622
|
-
|
|
623
|
-
case "code":
|
|
624
|
-
children.push(
|
|
625
|
-
new Paragraph({
|
|
626
|
-
children: [new TextRun({ text: section.text || "", font: "Courier New", size: 20 })],
|
|
627
|
-
shading: { fill: "f5f5f5" },
|
|
628
|
-
spacing: { before: 200, after: 200 },
|
|
629
|
-
})
|
|
630
|
-
);
|
|
631
|
-
break;
|
|
632
|
-
|
|
633
|
-
case "table":
|
|
634
|
-
if (section.rows && section.rows.length > 0) {
|
|
635
|
-
const tableRows = section.rows.map((row, rowIndex) =>
|
|
636
|
-
new TableRow({
|
|
637
|
-
children: row.map(cell =>
|
|
638
|
-
new TableCell({
|
|
639
|
-
children: [new Paragraph({
|
|
640
|
-
children: [new TextRun({
|
|
641
|
-
text: cell,
|
|
642
|
-
font: options.font,
|
|
643
|
-
size: options.fontSize * 2,
|
|
644
|
-
bold: rowIndex === 0,
|
|
645
|
-
})],
|
|
646
|
-
})],
|
|
647
|
-
shading: rowIndex === 0 ? { fill: "e0e0e0" } : undefined,
|
|
648
|
-
})
|
|
649
|
-
),
|
|
650
|
-
})
|
|
651
|
-
);
|
|
652
|
-
children.push(
|
|
653
|
-
new Table({
|
|
654
|
-
rows: tableRows,
|
|
655
|
-
width: { size: 100, type: WidthType.PERCENTAGE },
|
|
656
|
-
})
|
|
657
|
-
);
|
|
658
|
-
children.push(new Paragraph({ text: "", spacing: { after: 200 } }));
|
|
659
|
-
}
|
|
660
|
-
break;
|
|
661
|
-
|
|
662
|
-
case "hr":
|
|
663
|
-
children.push(
|
|
664
|
-
new Paragraph({
|
|
665
|
-
border: { bottom: { style: BorderStyle.SINGLE, size: 6, color: "cccccc" } },
|
|
666
|
-
spacing: { before: 200, after: 200 },
|
|
667
|
-
})
|
|
668
|
-
);
|
|
669
|
-
break;
|
|
670
|
-
}
|
|
671
|
-
}
|
|
672
|
-
|
|
673
|
-
// Build document
|
|
674
|
-
const doc = new Document({
|
|
675
|
-
creator: options.author || "skills.md",
|
|
676
|
-
title: content.title,
|
|
677
|
-
description: `Generated by generate-docx skill`,
|
|
678
|
-
styles: {
|
|
679
|
-
default: {
|
|
680
|
-
document: {
|
|
681
|
-
run: { font: options.font, size: options.fontSize * 2 },
|
|
682
|
-
},
|
|
683
|
-
},
|
|
684
|
-
},
|
|
685
|
-
numbering: {
|
|
686
|
-
config: [{
|
|
687
|
-
reference: "default-numbering",
|
|
688
|
-
levels: [{
|
|
689
|
-
level: 0,
|
|
690
|
-
format: NumberFormat.DECIMAL,
|
|
691
|
-
text: "%1.",
|
|
692
|
-
alignment: AlignmentType.LEFT,
|
|
693
|
-
}],
|
|
694
|
-
}],
|
|
695
|
-
},
|
|
696
|
-
sections: [{
|
|
697
|
-
properties: {
|
|
698
|
-
page: {
|
|
699
|
-
size: pageSize,
|
|
700
|
-
margin: {
|
|
701
|
-
top: marginTwips,
|
|
702
|
-
right: marginTwips,
|
|
703
|
-
bottom: marginTwips,
|
|
704
|
-
left: marginTwips,
|
|
705
|
-
},
|
|
706
|
-
},
|
|
707
|
-
},
|
|
708
|
-
headers: options.header ? {
|
|
709
|
-
default: new Header({
|
|
710
|
-
children: [new Paragraph({
|
|
711
|
-
children: [new TextRun({ text: options.header, font: options.font, size: 18 })],
|
|
712
|
-
alignment: AlignmentType.RIGHT,
|
|
713
|
-
})],
|
|
714
|
-
}),
|
|
715
|
-
} : undefined,
|
|
716
|
-
footers: options.pageNumbers || options.footer ? {
|
|
717
|
-
default: new Footer({
|
|
718
|
-
children: [new Paragraph({
|
|
719
|
-
children: [
|
|
720
|
-
...(options.footer ? [new TextRun({ text: options.footer + " ", font: options.font, size: 18 })] : []),
|
|
721
|
-
...(options.pageNumbers ? [
|
|
722
|
-
new TextRun({ children: [PageNumber.CURRENT], font: options.font, size: 18 }),
|
|
723
|
-
new TextRun({ text: " / ", font: options.font, size: 18 }),
|
|
724
|
-
new TextRun({ children: [PageNumber.TOTAL_PAGES], font: options.font, size: 18 }),
|
|
725
|
-
] : []),
|
|
726
|
-
],
|
|
727
|
-
alignment: AlignmentType.CENTER,
|
|
728
|
-
})],
|
|
729
|
-
}),
|
|
730
|
-
} : undefined,
|
|
731
|
-
children,
|
|
732
|
-
}],
|
|
733
|
-
});
|
|
734
|
-
|
|
735
|
-
return doc;
|
|
37
|
+
function outputPathFor(
|
|
38
|
+
requestedPath: string,
|
|
39
|
+
outputDir: string,
|
|
40
|
+
inputFile: string | undefined,
|
|
41
|
+
title: string
|
|
42
|
+
) {
|
|
43
|
+
if (requestedPath) return requestedPath;
|
|
44
|
+
const baseName = inputFile
|
|
45
|
+
? path.basename(inputFile, path.extname(inputFile))
|
|
46
|
+
: title.toLowerCase().replace(/[^a-z0-9]+/g, "-").slice(0, 50);
|
|
47
|
+
return path.join(outputDir, `${baseName}.docx`);
|
|
736
48
|
}
|
|
737
49
|
|
|
738
|
-
// Main execution
|
|
739
50
|
async function main(): Promise<void> {
|
|
740
51
|
try {
|
|
741
|
-
|
|
52
|
+
const { options, inputFile } = parseCli();
|
|
53
|
+
const markdown = await resolveMarkdown(inputFile, options);
|
|
54
|
+
const deps = await loadDocumentDeps();
|
|
742
55
|
|
|
743
|
-
// Determine input source
|
|
744
|
-
if (inputFile) {
|
|
745
|
-
if (!fs.existsSync(inputFile)) {
|
|
746
|
-
console.error(`Error: File not found: ${inputFile}`);
|
|
747
|
-
process.exit(1);
|
|
748
|
-
}
|
|
749
|
-
markdown = fs.readFileSync(inputFile, "utf-8");
|
|
750
|
-
console.log(`Reading from: ${inputFile}`);
|
|
751
|
-
} else if (options.topic) {
|
|
752
|
-
markdown = await generateWithAI(options.topic);
|
|
753
|
-
} else if (options.prompt) {
|
|
754
|
-
markdown = await generateWithAI(options.prompt, true);
|
|
755
|
-
} else if (options.text) {
|
|
756
|
-
markdown = options.text;
|
|
757
|
-
} else {
|
|
758
|
-
console.error("Error: No input specified. Provide a markdown file, --topic, --prompt, or --text");
|
|
759
|
-
process.exit(1);
|
|
760
|
-
}
|
|
761
|
-
|
|
762
|
-
await loadDocumentDeps();
|
|
763
|
-
|
|
764
|
-
// Parse content
|
|
765
56
|
console.log("Parsing content...");
|
|
766
|
-
const content = parseMarkdown(markdown);
|
|
767
|
-
|
|
768
|
-
// Update title if provided
|
|
57
|
+
const content = parseMarkdown(markdown, options);
|
|
769
58
|
if (options.title) {
|
|
770
59
|
content.title = options.title;
|
|
771
60
|
}
|
|
772
61
|
|
|
773
|
-
// Build document
|
|
774
62
|
console.log("Building document...");
|
|
775
|
-
const doc = buildDocument(content);
|
|
63
|
+
const doc = buildDocument(content, options, deps);
|
|
64
|
+
const outputPath = outputPathFor(options.output, options.dir, inputFile, content.title);
|
|
776
65
|
|
|
777
|
-
// Generate output path
|
|
778
|
-
let outputPath = options.output;
|
|
779
|
-
if (!outputPath) {
|
|
780
|
-
const baseName = inputFile
|
|
781
|
-
? path.basename(inputFile, path.extname(inputFile))
|
|
782
|
-
: content.title.toLowerCase().replace(/[^a-z0-9]+/g, "-").slice(0, 50);
|
|
783
|
-
outputPath = path.join(options.dir, `${baseName}.docx`);
|
|
784
|
-
}
|
|
785
|
-
|
|
786
|
-
// Ensure directory exists
|
|
787
66
|
const outputDir = path.dirname(outputPath);
|
|
788
67
|
if (!fs.existsSync(outputDir)) {
|
|
789
68
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
790
69
|
}
|
|
791
70
|
|
|
792
|
-
// Write file
|
|
793
71
|
console.log("Writing document...");
|
|
794
|
-
const buffer = await Packer.toBuffer(doc);
|
|
72
|
+
const buffer = await deps.Packer.toBuffer(doc);
|
|
795
73
|
fs.writeFileSync(outputPath, buffer);
|
|
796
74
|
|
|
797
|
-
// Summary
|
|
798
75
|
console.log(`\n${"=".repeat(50)}`);
|
|
799
76
|
console.log("Document Generated");
|
|
800
77
|
console.log("=".repeat(50));
|
|
801
78
|
console.log(` Title: ${content.title}`);
|
|
802
79
|
console.log(` Template: ${options.template}`);
|
|
803
|
-
console.log(` Sections: ${content.sections.filter(
|
|
80
|
+
console.log(` Sections: ${content.sections.filter((section) => section.type === "heading").length}`);
|
|
804
81
|
console.log(` Output: ${outputPath}`);
|
|
805
82
|
console.log(` Size: ${(buffer.length / 1024).toFixed(1)} KB`);
|
|
806
83
|
console.log("");
|
|
807
|
-
|
|
808
84
|
} catch (error: any) {
|
|
809
85
|
console.error(`Error: ${error.message}`);
|
|
810
86
|
process.exit(1);
|