claude-code-templates 1.21.6 → 1.21.7

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 (490) hide show
  1. package/package.json +2 -2
  2. package/components/agents/ai-specialists/ai-ethics-advisor.md +0 -195
  3. package/components/agents/ai-specialists/hackathon-ai-strategist.md +0 -46
  4. package/components/agents/ai-specialists/llms-maintainer.md +0 -94
  5. package/components/agents/ai-specialists/model-evaluator.md +0 -150
  6. package/components/agents/ai-specialists/prompt-engineer.md +0 -112
  7. package/components/agents/ai-specialists/search-specialist.md +0 -59
  8. package/components/agents/ai-specialists/task-decomposition-expert.md +0 -97
  9. package/components/agents/api-graphql/graphql-architect.md +0 -208
  10. package/components/agents/api-graphql/graphql-performance-optimizer.md +0 -357
  11. package/components/agents/api-graphql/graphql-security-specialist.md +0 -519
  12. package/components/agents/blockchain-web3/smart-contract-auditor.md +0 -32
  13. package/components/agents/blockchain-web3/smart-contract-specialist.md +0 -32
  14. package/components/agents/blockchain-web3/web3-integration-specialist.md +0 -32
  15. package/components/agents/business-marketing/business-analyst.md +0 -194
  16. package/components/agents/business-marketing/content-marketer.md +0 -36
  17. package/components/agents/business-marketing/customer-support.md +0 -36
  18. package/components/agents/business-marketing/legal-advisor.md +0 -50
  19. package/components/agents/business-marketing/marketing-attribution-analyst.md +0 -352
  20. package/components/agents/business-marketing/payment-integration.md +0 -33
  21. package/components/agents/business-marketing/product-strategist.md +0 -212
  22. package/components/agents/business-marketing/risk-manager.md +0 -42
  23. package/components/agents/business-marketing/sales-automator.md +0 -36
  24. package/components/agents/data-ai/ai-engineer.md +0 -33
  25. package/components/agents/data-ai/computer-vision-engineer.md +0 -562
  26. package/components/agents/data-ai/data-engineer.md +0 -33
  27. package/components/agents/data-ai/data-scientist.md +0 -337
  28. package/components/agents/data-ai/ml-engineer.md +0 -33
  29. package/components/agents/data-ai/mlops-engineer.md +0 -58
  30. package/components/agents/data-ai/nlp-engineer.md +0 -680
  31. package/components/agents/data-ai/quant-analyst.md +0 -33
  32. package/components/agents/database/database-admin.md +0 -33
  33. package/components/agents/database/database-architect.md +0 -590
  34. package/components/agents/database/database-optimization.md +0 -33
  35. package/components/agents/database/database-optimizer.md +0 -33
  36. package/components/agents/database/nosql-specialist.md +0 -708
  37. package/components/agents/database/supabase-schema-architect.md +0 -138
  38. package/components/agents/deep-research-team/academic-researcher.md +0 -33
  39. package/components/agents/deep-research-team/agent-overview.md +0 -235
  40. package/components/agents/deep-research-team/competitive-intelligence-analyst.md +0 -530
  41. package/components/agents/deep-research-team/data-analyst.md +0 -112
  42. package/components/agents/deep-research-team/fact-checker.md +0 -553
  43. package/components/agents/deep-research-team/query-clarifier.md +0 -73
  44. package/components/agents/deep-research-team/report-generator.md +0 -108
  45. package/components/agents/deep-research-team/research-brief-generator.md +0 -108
  46. package/components/agents/deep-research-team/research-coordinator.md +0 -94
  47. package/components/agents/deep-research-team/research-orchestrator.md +0 -119
  48. package/components/agents/deep-research-team/research-synthesizer.md +0 -109
  49. package/components/agents/deep-research-team/technical-researcher.md +0 -95
  50. package/components/agents/development-team/backend-architect.md +0 -31
  51. package/components/agents/development-team/cli-ui-designer.md +0 -405
  52. package/components/agents/development-team/devops-engineer.md +0 -886
  53. package/components/agents/development-team/frontend-developer.md +0 -32
  54. package/components/agents/development-team/fullstack-developer.md +0 -1205
  55. package/components/agents/development-team/ios-developer.md +0 -36
  56. package/components/agents/development-team/mobile-developer.md +0 -33
  57. package/components/agents/development-team/ui-ux-designer.md +0 -36
  58. package/components/agents/development-tools/code-reviewer.md +0 -30
  59. package/components/agents/development-tools/command-expert.md +0 -422
  60. package/components/agents/development-tools/context-manager.md +0 -65
  61. package/components/agents/development-tools/debugger.md +0 -31
  62. package/components/agents/development-tools/dx-optimizer.md +0 -64
  63. package/components/agents/development-tools/error-detective.md +0 -33
  64. package/components/agents/development-tools/mcp-expert.md +0 -259
  65. package/components/agents/development-tools/performance-profiler.md +0 -799
  66. package/components/agents/development-tools/test-engineer.md +0 -936
  67. package/components/agents/devops-infrastructure/cloud-architect.md +0 -33
  68. package/components/agents/devops-infrastructure/deployment-engineer.md +0 -33
  69. package/components/agents/devops-infrastructure/devops-troubleshooter.md +0 -33
  70. package/components/agents/devops-infrastructure/monitoring-specialist.md +0 -36
  71. package/components/agents/devops-infrastructure/network-engineer.md +0 -33
  72. package/components/agents/devops-infrastructure/security-engineer.md +0 -971
  73. package/components/agents/devops-infrastructure/terraform-specialist.md +0 -36
  74. package/components/agents/devops-infrastructure/vercel-deployment-specialist.md +0 -357
  75. package/components/agents/documentation/api-documenter.md +0 -33
  76. package/components/agents/documentation/changelog-generator.md +0 -37
  77. package/components/agents/documentation/docusaurus-expert.md +0 -52
  78. package/components/agents/documentation/technical-writer.md +0 -37
  79. package/components/agents/expert-advisors/agent-expert.md +0 -477
  80. package/components/agents/expert-advisors/architect-review.md +0 -50
  81. package/components/agents/expert-advisors/dependency-manager.md +0 -45
  82. package/components/agents/expert-advisors/documentation-expert.md +0 -47
  83. package/components/agents/ffmpeg-clip-team/audio-mixer.md +0 -37
  84. package/components/agents/ffmpeg-clip-team/audio-quality-controller.md +0 -100
  85. package/components/agents/ffmpeg-clip-team/podcast-content-analyzer.md +0 -60
  86. package/components/agents/ffmpeg-clip-team/podcast-metadata-specialist.md +0 -46
  87. package/components/agents/ffmpeg-clip-team/podcast-transcriber.md +0 -68
  88. package/components/agents/ffmpeg-clip-team/social-media-clip-creator.md +0 -69
  89. package/components/agents/ffmpeg-clip-team/timestamp-precision-specialist.md +0 -98
  90. package/components/agents/ffmpeg-clip-team/video-editor.md +0 -37
  91. package/components/agents/game-development/3d-artist.md +0 -37
  92. package/components/agents/game-development/game-designer.md +0 -37
  93. package/components/agents/game-development/unity-game-developer.md +0 -110
  94. package/components/agents/game-development/unreal-engine-developer.md +0 -128
  95. package/components/agents/mcp-dev-team/mcp-deployment-orchestrator.md +0 -101
  96. package/components/agents/mcp-dev-team/mcp-integration-engineer.md +0 -37
  97. package/components/agents/mcp-dev-team/mcp-protocol-specialist.md +0 -37
  98. package/components/agents/mcp-dev-team/mcp-registry-navigator.md +0 -112
  99. package/components/agents/mcp-dev-team/mcp-security-auditor.md +0 -70
  100. package/components/agents/mcp-dev-team/mcp-server-architect.md +0 -74
  101. package/components/agents/mcp-dev-team/mcp-testing-engineer.md +0 -106
  102. package/components/agents/modernization/architecture-modernizer.md +0 -37
  103. package/components/agents/modernization/cloud-migration-specialist.md +0 -37
  104. package/components/agents/modernization/legacy-modernizer.md +0 -33
  105. package/components/agents/obsidian-ops-team/Scripts/daily_notes_connector.py +0 -306
  106. package/components/agents/obsidian-ops-team/Scripts/enhance_tag_standardizer.py +0 -343
  107. package/components/agents/obsidian-ops-team/Scripts/find_keyword_connections.py +0 -216
  108. package/components/agents/obsidian-ops-team/Scripts/fix_quoted_tags.py +0 -82
  109. package/components/agents/obsidian-ops-team/Scripts/implement_entity_connections.py +0 -195
  110. package/components/agents/obsidian-ops-team/Scripts/link_suggester.py +0 -301
  111. package/components/agents/obsidian-ops-team/Scripts/metadata_adder.py +0 -197
  112. package/components/agents/obsidian-ops-team/Scripts/moc_generator.py +0 -296
  113. package/components/agents/obsidian-ops-team/Scripts/parse_keyword_connections.py +0 -122
  114. package/components/agents/obsidian-ops-team/Scripts/tag_standardizer.py +0 -387
  115. package/components/agents/obsidian-ops-team/connection-agent.md +0 -67
  116. package/components/agents/obsidian-ops-team/content-curator.md +0 -81
  117. package/components/agents/obsidian-ops-team/metadata-agent.md +0 -51
  118. package/components/agents/obsidian-ops-team/moc-agent.md +0 -112
  119. package/components/agents/obsidian-ops-team/review-agent.md +0 -94
  120. package/components/agents/obsidian-ops-team/tag-agent.md +0 -92
  121. package/components/agents/obsidian-ops-team/vault-optimizer.md +0 -76
  122. package/components/agents/ocr-extraction-team/document-structure-analyzer.md +0 -37
  123. package/components/agents/ocr-extraction-team/markdown-syntax-formatter.md +0 -58
  124. package/components/agents/ocr-extraction-team/ocr-grammar-fixer.md +0 -36
  125. package/components/agents/ocr-extraction-team/ocr-preprocessing-optimizer.md +0 -37
  126. package/components/agents/ocr-extraction-team/ocr-quality-assurance.md +0 -62
  127. package/components/agents/ocr-extraction-team/text-comparison-validator.md +0 -60
  128. package/components/agents/ocr-extraction-team/visual-analysis-ocr.md +0 -52
  129. package/components/agents/performance-testing/load-testing-specialist.md +0 -37
  130. package/components/agents/performance-testing/performance-engineer.md +0 -33
  131. package/components/agents/performance-testing/react-performance-optimization.md +0 -65
  132. package/components/agents/performance-testing/test-automator.md +0 -33
  133. package/components/agents/performance-testing/web-vitals-optimizer.md +0 -37
  134. package/components/agents/podcast-creator-team/academic-research-synthesizer.md +0 -61
  135. package/components/agents/podcast-creator-team/comprehensive-researcher.md +0 -49
  136. package/components/agents/podcast-creator-team/episode-orchestrator.md +0 -52
  137. package/components/agents/podcast-creator-team/guest-outreach-coordinator.md +0 -37
  138. package/components/agents/podcast-creator-team/market-research-analyst.md +0 -54
  139. package/components/agents/podcast-creator-team/podcast-editor.md +0 -37
  140. package/components/agents/podcast-creator-team/podcast-trend-scout.md +0 -60
  141. package/components/agents/podcast-creator-team/project-supervisor-orchestrator.md +0 -48
  142. package/components/agents/podcast-creator-team/seo-podcast-optimizer.md +0 -58
  143. package/components/agents/podcast-creator-team/social-media-copywriter.md +0 -57
  144. package/components/agents/podcast-creator-team/twitter-ai-influencer-manager.md +0 -62
  145. package/components/agents/programming-languages/c-pro.md +0 -36
  146. package/components/agents/programming-languages/c-sharp-pro.md +0 -40
  147. package/components/agents/programming-languages/cpp-pro.md +0 -39
  148. package/components/agents/programming-languages/golang-pro.md +0 -33
  149. package/components/agents/programming-languages/javascript-pro.md +0 -36
  150. package/components/agents/programming-languages/php-pro.md +0 -44
  151. package/components/agents/programming-languages/python-pro.md +0 -33
  152. package/components/agents/programming-languages/rust-pro.md +0 -36
  153. package/components/agents/programming-languages/shell-scripting-pro.md +0 -38
  154. package/components/agents/programming-languages/sql-pro.md +0 -36
  155. package/components/agents/programming-languages/typescript-pro.md +0 -38
  156. package/components/agents/realtime/supabase-realtime-optimizer.md +0 -193
  157. package/components/agents/security/api-security-audit.md +0 -93
  158. package/components/agents/security/compliance-specialist.md +0 -37
  159. package/components/agents/security/incident-responder.md +0 -75
  160. package/components/agents/security/penetration-tester.md +0 -37
  161. package/components/agents/security/security-auditor.md +0 -33
  162. package/components/agents/web-tools/nextjs-architecture-expert.md +0 -194
  163. package/components/agents/web-tools/react-performance-optimizer.md +0 -425
  164. package/components/agents/web-tools/seo-analyzer.md +0 -37
  165. package/components/agents/web-tools/url-context-validator.md +0 -61
  166. package/components/agents/web-tools/url-link-extractor.md +0 -59
  167. package/components/agents/web-tools/web-accessibility-checker.md +0 -37
  168. package/components/commands/automation/act.md +0 -57
  169. package/components/commands/automation/ci-pipeline.md +0 -378
  170. package/components/commands/automation/husky.md +0 -130
  171. package/components/commands/automation/workflow-orchestrator.md +0 -576
  172. package/components/commands/database/supabase-backup-manager.md +0 -37
  173. package/components/commands/database/supabase-data-explorer.md +0 -37
  174. package/components/commands/database/supabase-migration-assistant.md +0 -37
  175. package/components/commands/database/supabase-performance-optimizer.md +0 -37
  176. package/components/commands/database/supabase-realtime-monitor.md +0 -37
  177. package/components/commands/database/supabase-schema-sync.md +0 -37
  178. package/components/commands/database/supabase-security-audit.md +0 -37
  179. package/components/commands/database/supabase-type-generator.md +0 -37
  180. package/components/commands/deployment/add-changelog.md +0 -92
  181. package/components/commands/deployment/blue-green-deployment.md +0 -824
  182. package/components/commands/deployment/changelog-demo-command.md +0 -43
  183. package/components/commands/deployment/ci-setup.md +0 -323
  184. package/components/commands/deployment/containerize-application.md +0 -93
  185. package/components/commands/deployment/deployment-monitoring.md +0 -1228
  186. package/components/commands/deployment/hotfix-deploy.md +0 -283
  187. package/components/commands/deployment/prepare-release.md +0 -357
  188. package/components/commands/deployment/rollback-deploy.md +0 -145
  189. package/components/commands/deployment/setup-automated-releases.md +0 -143
  190. package/components/commands/deployment/setup-kubernetes-deployment.md +0 -93
  191. package/components/commands/documentation/create-architecture-documentation.md +0 -95
  192. package/components/commands/documentation/create-onboarding-guide.md +0 -93
  193. package/components/commands/documentation/doc-api.md +0 -242
  194. package/components/commands/documentation/docs-maintenance.md +0 -119
  195. package/components/commands/documentation/generate-api-documentation.md +0 -97
  196. package/components/commands/documentation/interactive-documentation.md +0 -133
  197. package/components/commands/documentation/load-llms-txt.md +0 -39
  198. package/components/commands/documentation/migration-guide.md +0 -250
  199. package/components/commands/documentation/troubleshooting-guide.md +0 -370
  200. package/components/commands/documentation/update-docs.md +0 -107
  201. package/components/commands/game-development/game-analytics-integration.md +0 -128
  202. package/components/commands/game-development/game-asset-pipeline.md +0 -108
  203. package/components/commands/game-development/game-performance-profiler.md +0 -78
  204. package/components/commands/game-development/game-testing-framework.md +0 -112
  205. package/components/commands/game-development/unity-project-setup.md +0 -190
  206. package/components/commands/git-workflow/branch-cleanup.md +0 -181
  207. package/components/commands/git-workflow/commit.md +0 -167
  208. package/components/commands/git-workflow/create-pr.md +0 -19
  209. package/components/commands/git-workflow/create-pull-request.md +0 -126
  210. package/components/commands/git-workflow/create-worktrees.md +0 -174
  211. package/components/commands/git-workflow/fix-github-issue.md +0 -13
  212. package/components/commands/git-workflow/git-bisect-helper.md +0 -261
  213. package/components/commands/git-workflow/pr-review.md +0 -76
  214. package/components/commands/git-workflow/update-branch-name.md +0 -9
  215. package/components/commands/nextjs-vercel/nextjs-api-tester.md +0 -480
  216. package/components/commands/nextjs-vercel/nextjs-bundle-analyzer.md +0 -406
  217. package/components/commands/nextjs-vercel/nextjs-component-generator.md +0 -489
  218. package/components/commands/nextjs-vercel/nextjs-middleware-creator.md +0 -712
  219. package/components/commands/nextjs-vercel/nextjs-migration-helper.md +0 -778
  220. package/components/commands/nextjs-vercel/nextjs-performance-audit.md +0 -653
  221. package/components/commands/nextjs-vercel/nextjs-scaffold.md +0 -237
  222. package/components/commands/nextjs-vercel/vercel-deploy-optimize.md +0 -341
  223. package/components/commands/nextjs-vercel/vercel-edge-function.md +0 -810
  224. package/components/commands/nextjs-vercel/vercel-env-sync.md +0 -666
  225. package/components/commands/orchestration/archive.md +0 -414
  226. package/components/commands/orchestration/commit.md +0 -305
  227. package/components/commands/orchestration/find.md +0 -272
  228. package/components/commands/orchestration/log.md +0 -355
  229. package/components/commands/orchestration/move.md +0 -220
  230. package/components/commands/orchestration/optimize.md +0 -375
  231. package/components/commands/orchestration/remove.md +0 -301
  232. package/components/commands/orchestration/report.md +0 -292
  233. package/components/commands/orchestration/resume.md +0 -256
  234. package/components/commands/orchestration/start.md +0 -169
  235. package/components/commands/orchestration/status.md +0 -219
  236. package/components/commands/orchestration/sync.md +0 -294
  237. package/components/commands/performance/add-performance-monitoring.md +0 -84
  238. package/components/commands/performance/implement-caching-strategy.md +0 -84
  239. package/components/commands/performance/optimize-api-performance.md +0 -119
  240. package/components/commands/performance/optimize-build.md +0 -139
  241. package/components/commands/performance/optimize-bundle-size.md +0 -84
  242. package/components/commands/performance/optimize-database-performance.md +0 -84
  243. package/components/commands/performance/optimize-memory-usage.md +0 -91
  244. package/components/commands/performance/performance-audit.md +0 -89
  245. package/components/commands/performance/setup-cdn-optimization.md +0 -84
  246. package/components/commands/performance/system-behavior-simulator.md +0 -415
  247. package/components/commands/project-management/add-package.md +0 -90
  248. package/components/commands/project-management/add-to-changelog.md +0 -37
  249. package/components/commands/project-management/create-feature.md +0 -130
  250. package/components/commands/project-management/create-jtbd.md +0 -37
  251. package/components/commands/project-management/create-prd.md +0 -36
  252. package/components/commands/project-management/create-prp.md +0 -37
  253. package/components/commands/project-management/init-project.md +0 -80
  254. package/components/commands/project-management/milestone-tracker.md +0 -44
  255. package/components/commands/project-management/pac-configure.md +0 -32
  256. package/components/commands/project-management/pac-create-epic.md +0 -41
  257. package/components/commands/project-management/pac-create-ticket.md +0 -42
  258. package/components/commands/project-management/pac-update-status.md +0 -39
  259. package/components/commands/project-management/pac-validate.md +0 -35
  260. package/components/commands/project-management/project-health-check.md +0 -58
  261. package/components/commands/project-management/project-timeline-simulator.md +0 -37
  262. package/components/commands/project-management/project-to-linear.md +0 -38
  263. package/components/commands/project-management/release.md +0 -31
  264. package/components/commands/project-management/todo.md +0 -62
  265. package/components/commands/security/add-authentication-system.md +0 -34
  266. package/components/commands/security/dependency-audit.md +0 -32
  267. package/components/commands/security/penetration-test.md +0 -40
  268. package/components/commands/security/secrets-scanner.md +0 -39
  269. package/components/commands/security/security-audit.md +0 -82
  270. package/components/commands/security/security-hardening.md +0 -33
  271. package/components/commands/setup/create-database-migrations.md +0 -35
  272. package/components/commands/setup/design-database-schema.md +0 -37
  273. package/components/commands/setup/design-rest-api.md +0 -37
  274. package/components/commands/setup/implement-graphql-api.md +0 -37
  275. package/components/commands/setup/migrate-to-typescript.md +0 -37
  276. package/components/commands/setup/setup-ci-cd-pipeline.md +0 -37
  277. package/components/commands/setup/setup-development-environment.md +0 -37
  278. package/components/commands/setup/setup-docker-containers.md +0 -37
  279. package/components/commands/setup/setup-formatting.md +0 -37
  280. package/components/commands/setup/setup-linting.md +0 -37
  281. package/components/commands/setup/setup-monitoring-observability.md +0 -37
  282. package/components/commands/setup/setup-monorepo.md +0 -37
  283. package/components/commands/setup/setup-rate-limiting.md +0 -37
  284. package/components/commands/setup/update-dependencies.md +0 -35
  285. package/components/commands/simulation/business-scenario-explorer.md +0 -37
  286. package/components/commands/simulation/constraint-modeler.md +0 -37
  287. package/components/commands/simulation/decision-tree-explorer.md +0 -37
  288. package/components/commands/simulation/digital-twin-creator.md +0 -37
  289. package/components/commands/simulation/future-scenario-generator.md +0 -37
  290. package/components/commands/simulation/market-response-modeler.md +0 -37
  291. package/components/commands/simulation/monte-carlo-simulator.md +0 -37
  292. package/components/commands/simulation/simulation-calibrator.md +0 -37
  293. package/components/commands/simulation/system-dynamics-modeler.md +0 -37
  294. package/components/commands/simulation/timeline-compressor.md +0 -37
  295. package/components/commands/svelte/svelte:a11y.md +0 -105
  296. package/components/commands/svelte/svelte:component.md +0 -81
  297. package/components/commands/svelte/svelte:debug.md +0 -48
  298. package/components/commands/svelte/svelte:migrate.md +0 -79
  299. package/components/commands/svelte/svelte:optimize.md +0 -99
  300. package/components/commands/svelte/svelte:scaffold.md +0 -89
  301. package/components/commands/svelte/svelte:storybook-migrate.md +0 -204
  302. package/components/commands/svelte/svelte:storybook-mock.md +0 -213
  303. package/components/commands/svelte/svelte:storybook-setup.md +0 -113
  304. package/components/commands/svelte/svelte:storybook-story.md +0 -145
  305. package/components/commands/svelte/svelte:storybook-troubleshoot.md +0 -191
  306. package/components/commands/svelte/svelte:storybook.md +0 -48
  307. package/components/commands/svelte/svelte:test-coverage.md +0 -77
  308. package/components/commands/svelte/svelte:test-fix.md +0 -74
  309. package/components/commands/svelte/svelte:test-setup.md +0 -85
  310. package/components/commands/svelte/svelte:test.md +0 -60
  311. package/components/commands/sync/bidirectional-sync.md +0 -37
  312. package/components/commands/sync/bulk-import-issues.md +0 -37
  313. package/components/commands/sync/cross-reference-manager.md +0 -37
  314. package/components/commands/sync/issue-to-linear-task.md +0 -37
  315. package/components/commands/sync/linear-task-to-issue.md +0 -37
  316. package/components/commands/sync/sync-automation-setup.md +0 -37
  317. package/components/commands/sync/sync-conflict-resolver.md +0 -37
  318. package/components/commands/sync/sync-health-monitor.md +0 -37
  319. package/components/commands/sync/sync-issues-to-linear.md +0 -37
  320. package/components/commands/sync/sync-linear-to-issues.md +0 -37
  321. package/components/commands/sync/sync-migration-assistant.md +0 -37
  322. package/components/commands/sync/sync-pr-to-task.md +0 -37
  323. package/components/commands/sync/sync-status.md +0 -391
  324. package/components/commands/sync/task-from-pr.md +0 -37
  325. package/components/commands/team/architecture-review.md +0 -37
  326. package/components/commands/team/decision-quality-analyzer.md +0 -37
  327. package/components/commands/team/dependency-mapper.md +0 -37
  328. package/components/commands/team/estimate-assistant.md +0 -37
  329. package/components/commands/team/issue-triage.md +0 -37
  330. package/components/commands/team/memory-spring-cleaning.md +0 -37
  331. package/components/commands/team/migration-assistant.md +0 -37
  332. package/components/commands/team/retrospective-analyzer.md +0 -37
  333. package/components/commands/team/session-learning-capture.md +0 -37
  334. package/components/commands/team/sprint-planning.md +0 -189
  335. package/components/commands/team/standup-report.md +0 -37
  336. package/components/commands/team/team-knowledge-mapper.md +0 -37
  337. package/components/commands/team/team-velocity-tracker.md +0 -37
  338. package/components/commands/team/team-workload-balancer.md +0 -37
  339. package/components/commands/testing/add-mutation-testing.md +0 -37
  340. package/components/commands/testing/add-property-based-testing.md +0 -37
  341. package/components/commands/testing/e2e-setup.md +0 -37
  342. package/components/commands/testing/generate-test-cases.md +0 -37
  343. package/components/commands/testing/generate-tests.md +0 -82
  344. package/components/commands/testing/setup-comprehensive-testing.md +0 -37
  345. package/components/commands/testing/setup-load-testing.md +0 -37
  346. package/components/commands/testing/setup-visual-testing.md +0 -37
  347. package/components/commands/testing/test-automation-orchestrator.md +0 -37
  348. package/components/commands/testing/test-changelog-automation.md +0 -37
  349. package/components/commands/testing/test-coverage.md +0 -37
  350. package/components/commands/testing/test-quality-analyzer.md +0 -37
  351. package/components/commands/testing/testing_plan_integration.md +0 -37
  352. package/components/commands/testing/write-tests.md +0 -37
  353. package/components/commands/utilities/all-tools.md +0 -31
  354. package/components/commands/utilities/architecture-scenario-explorer.md +0 -375
  355. package/components/commands/utilities/check-file.md +0 -53
  356. package/components/commands/utilities/clean-branches.md +0 -243
  357. package/components/commands/utilities/clean.md +0 -1
  358. package/components/commands/utilities/code-permutation-tester.md +0 -341
  359. package/components/commands/utilities/code-review.md +0 -70
  360. package/components/commands/utilities/code-to-task.md +0 -583
  361. package/components/commands/utilities/context-prime.md +0 -1
  362. package/components/commands/utilities/debug-error.md +0 -121
  363. package/components/commands/utilities/directory-deep-dive.md +0 -34
  364. package/components/commands/utilities/explain-code.md +0 -194
  365. package/components/commands/utilities/fix-issue.md +0 -85
  366. package/components/commands/utilities/generate-linear-worklog.md +0 -113
  367. package/components/commands/utilities/git-status.md +0 -39
  368. package/components/commands/utilities/initref.md +0 -3
  369. package/components/commands/utilities/prime.md +0 -41
  370. package/components/commands/utilities/refactor-code.md +0 -116
  371. package/components/commands/utilities/ultra-think.md +0 -153
  372. package/components/hooks/HOOK_PATTERNS_COMPRESSED.json +0 -1
  373. package/components/hooks/automation/build-on-change.json +0 -16
  374. package/components/hooks/automation/dependency-checker.json +0 -16
  375. package/components/hooks/automation/deployment-health-monitor.json +0 -29
  376. package/components/hooks/automation/discord-detailed-notifications.json +0 -26
  377. package/components/hooks/automation/discord-error-notifications.json +0 -37
  378. package/components/hooks/automation/discord-notifications.json +0 -25
  379. package/components/hooks/automation/simple-notifications.json +0 -16
  380. package/components/hooks/automation/slack-detailed-notifications.json +0 -26
  381. package/components/hooks/automation/slack-error-notifications.json +0 -37
  382. package/components/hooks/automation/slack-notifications.json +0 -25
  383. package/components/hooks/automation/telegram-detailed-notifications.json +0 -26
  384. package/components/hooks/automation/telegram-error-notifications.json +0 -37
  385. package/components/hooks/automation/telegram-notifications.json +0 -25
  386. package/components/hooks/automation/vercel-auto-deploy.json +0 -17
  387. package/components/hooks/automation/vercel-environment-sync.json +0 -29
  388. package/components/hooks/development-tools/change-tracker.json +0 -25
  389. package/components/hooks/development-tools/command-logger.json +0 -16
  390. package/components/hooks/development-tools/file-backup.json +0 -16
  391. package/components/hooks/development-tools/lint-on-save.json +0 -16
  392. package/components/hooks/development-tools/nextjs-code-quality-enforcer.json +0 -17
  393. package/components/hooks/development-tools/smart-formatting.json +0 -16
  394. package/components/hooks/git-workflow/auto-git-add.json +0 -16
  395. package/components/hooks/git-workflow/smart-commit.json +0 -25
  396. package/components/hooks/performance/performance-budget-guard.json +0 -27
  397. package/components/hooks/performance/performance-monitor.json +0 -27
  398. package/components/hooks/post-tool/format-javascript-files.json +0 -16
  399. package/components/hooks/post-tool/format-python-files.json +0 -16
  400. package/components/hooks/post-tool/git-add-changes.json +0 -25
  401. package/components/hooks/post-tool/run-tests-after-changes.json +0 -16
  402. package/components/hooks/pre-tool/backup-before-edit.json +0 -16
  403. package/components/hooks/pre-tool/notify-before-bash.json +0 -16
  404. package/components/hooks/security/file-protection.json +0 -16
  405. package/components/hooks/security/security-scanner.json +0 -16
  406. package/components/hooks/testing/test-runner.json +0 -16
  407. package/components/mcps/browser_automation/browser-use-mcp-server.json +0 -20
  408. package/components/mcps/browser_automation/browsermcp.json +0 -9
  409. package/components/mcps/browser_automation/mcp-server-browserbase.json +0 -14
  410. package/components/mcps/browser_automation/mcp-server-playwright.json +0 -9
  411. package/components/mcps/browser_automation/playwright-mcp-server.json +0 -9
  412. package/components/mcps/browser_automation/playwright-mcp.json +0 -11
  413. package/components/mcps/database/mysql-integration.json +0 -12
  414. package/components/mcps/database/postgresql-integration.json +0 -12
  415. package/components/mcps/database/supabase.json +0 -17
  416. package/components/mcps/deepgraph/deepgraph-nextjs.json +0 -13
  417. package/components/mcps/deepgraph/deepgraph-react.json +0 -13
  418. package/components/mcps/deepgraph/deepgraph-typescript.json +0 -13
  419. package/components/mcps/deepgraph/deepgraph-vue.json +0 -13
  420. package/components/mcps/devtools/circleci.json +0 -13
  421. package/components/mcps/devtools/context7.json +0 -9
  422. package/components/mcps/devtools/firefly-mcp.json +0 -13
  423. package/components/mcps/devtools/ios-simulator-mcp.json +0 -9
  424. package/components/mcps/devtools/just-mcp.json +0 -9
  425. package/components/mcps/devtools/leetcode.json +0 -8
  426. package/components/mcps/devtools/mcp-server-atlassian-bitbucket.json +0 -9
  427. package/components/mcps/devtools/mcp-server-trello.json +0 -12
  428. package/components/mcps/filesystem/filesystem-access.json +0 -13
  429. package/components/mcps/integration/github-integration.json +0 -12
  430. package/components/mcps/integration/memory-integration.json +0 -9
  431. package/components/mcps/marketing/facebook-ads-mcp-server.json +0 -13
  432. package/components/mcps/marketing/google-ads-mcp-server.json +0 -11
  433. package/components/mcps/web/web-fetch.json +0 -9
  434. package/components/settings/api/bedrock-configuration.json +0 -7
  435. package/components/settings/api/corporate-proxy.json +0 -7
  436. package/components/settings/api/custom-headers.json +0 -6
  437. package/components/settings/api/vertex-configuration.json +0 -8
  438. package/components/settings/authentication/api-key-helper.json +0 -7
  439. package/components/settings/authentication/force-claudeai-login.json +0 -4
  440. package/components/settings/authentication/force-console-login.json +0 -4
  441. package/components/settings/cleanup/retention-7-days.json +0 -4
  442. package/components/settings/cleanup/retention-90-days.json +0 -4
  443. package/components/settings/environment/bash-timeouts.json +0 -8
  444. package/components/settings/environment/development-utils.json +0 -8
  445. package/components/settings/environment/performance-optimization.json +0 -8
  446. package/components/settings/environment/privacy-focused.json +0 -10
  447. package/components/settings/global/aws-credentials.json +0 -5
  448. package/components/settings/global/custom-model.json +0 -7
  449. package/components/settings/global/git-commit-settings.json +0 -4
  450. package/components/settings/mcp/disable-risky-servers.json +0 -8
  451. package/components/settings/mcp/enable-all-project-servers.json +0 -4
  452. package/components/settings/mcp/enable-specific-servers.json +0 -8
  453. package/components/settings/mcp/mcp-timeouts.json +0 -8
  454. package/components/settings/model/use-haiku.json +0 -4
  455. package/components/settings/model/use-sonnet.json +0 -4
  456. package/components/settings/permissions/additional-directories.json +0 -11
  457. package/components/settings/permissions/allow-git-operations.json +0 -14
  458. package/components/settings/permissions/allow-npm-commands.json +0 -11
  459. package/components/settings/permissions/deny-sensitive-files.json +0 -11
  460. package/components/settings/permissions/development-mode.json +0 -31
  461. package/components/settings/permissions/read-only-mode.json +0 -18
  462. package/components/settings/statusline/asset-pipeline-controller-statusline.json +0 -7
  463. package/components/settings/statusline/bug-circus-statusline.json +0 -7
  464. package/components/settings/statusline/code-casino-statusline.json +0 -7
  465. package/components/settings/statusline/code-spaceship-statusline.json +0 -7
  466. package/components/settings/statusline/colorful-statusline.json +0 -7
  467. package/components/settings/statusline/command-statusline.json +0 -8
  468. package/components/settings/statusline/context-monitor.json +0 -7
  469. package/components/settings/statusline/context-monitor.py +0 -236
  470. package/components/settings/statusline/data-ocean-statusline.json +0 -7
  471. package/components/settings/statusline/emotion-theater-statusline.json +0 -7
  472. package/components/settings/statusline/game-performance-monitor-statusline.json +0 -7
  473. package/components/settings/statusline/git-branch-statusline.json +0 -7
  474. package/components/settings/statusline/minimal-statusline.json +0 -7
  475. package/components/settings/statusline/multiplatform-build-status-statusline.json +0 -7
  476. package/components/settings/statusline/productivity-rainbow-statusline.json +0 -7
  477. package/components/settings/statusline/programmer-tamagotchi-statusline.json +0 -7
  478. package/components/settings/statusline/programming-fitness-tracker-statusline.json +0 -7
  479. package/components/settings/statusline/project-info-statusline.json +0 -7
  480. package/components/settings/statusline/rpg-status-bar-statusline.json +0 -7
  481. package/components/settings/statusline/time-statusline.json +0 -7
  482. package/components/settings/statusline/unity-project-dashboard-statusline.json +0 -7
  483. package/components/settings/statusline/vercel-deployment-monitor.json +0 -7
  484. package/components/settings/statusline/vercel-error-alert-system.json +0 -7
  485. package/components/settings/statusline/vercel-multi-env-status.json +0 -7
  486. package/components/settings/statusline/virtual-code-garden-statusline.json +0 -7
  487. package/components/settings/statusline/zero-config-deployment-monitor.json +0 -7
  488. package/components/settings/telemetry/custom-telemetry.json +0 -7
  489. package/components/settings/telemetry/disable-telemetry.json +0 -6
  490. package/components/settings/telemetry/enable-telemetry.json +0 -6
@@ -1,810 +0,0 @@
1
- ---
2
- allowed-tools: Read, Write, Edit
3
- argument-hint: [function-name] [--auth] [--geo] [--transform] [--proxy]
4
- description: Generate optimized Vercel Edge Functions with geolocation, authentication, and data transformation
5
- model: sonnet
6
- ---
7
-
8
- ## Vercel Edge Function Generator
9
-
10
- **Function Name**: $ARGUMENTS
11
-
12
- ## Current Project Analysis
13
-
14
- ### Project Structure
15
- - Vercel config: @vercel.json (if exists)
16
- - Next.js config: @next.config.js
17
- - API routes: @app/api/ or @pages/api/
18
- - Middleware: @middleware.ts (if exists)
19
-
20
- ### Framework Detection
21
- - Package.json: @package.json
22
- - TypeScript config: @tsconfig.json (if exists)
23
- - Environment variables: @.env.local (if exists)
24
-
25
- ## Edge Function Implementation Strategy
26
-
27
- ### 1. File Structure Creation
28
- Generate comprehensive edge function structure:
29
- ```
30
- api/edge/[function-name]/
31
- ├── index.ts # Main edge function
32
- ├── types.ts # TypeScript types
33
- ├── utils.ts # Utility functions
34
- ├── config.ts # Configuration
35
- └── __tests__/
36
- └── [function-name].test.ts # Unit tests
37
- ```
38
-
39
- ### 2. Base Edge Function Template
40
- ```typescript
41
- // api/edge/[function-name]/index.ts
42
- import { NextRequest, NextResponse } from 'next/server';
43
-
44
- export const runtime = 'edge';
45
-
46
- export async function GET(request: NextRequest) {
47
- try {
48
- // Get geolocation data
49
- const country = request.geo?.country || 'Unknown';
50
- const city = request.geo?.city || 'Unknown';
51
- const region = request.geo?.region || 'Unknown';
52
-
53
- // Get request metadata
54
- const ip = request.headers.get('x-forwarded-for') || 'Unknown';
55
- const userAgent = request.headers.get('user-agent') || 'Unknown';
56
- const referer = request.headers.get('referer') || 'Unknown';
57
-
58
- // Process request
59
- const result = await processRequest({
60
- geo: { country, city, region },
61
- ip,
62
- userAgent,
63
- referer,
64
- url: request.url,
65
- });
66
-
67
- return NextResponse.json(result, {
68
- status: 200,
69
- headers: {
70
- 'Cache-Control': 'public, s-maxage=60, stale-while-revalidate=300',
71
- 'Content-Type': 'application/json',
72
- 'X-Edge-Location': region,
73
- },
74
- });
75
-
76
- } catch (error) {
77
- console.error('Edge function error:', error);
78
-
79
- return NextResponse.json(
80
- { error: 'Internal server error' },
81
- { status: 500 }
82
- );
83
- }
84
- }
85
-
86
- export async function POST(request: NextRequest) {
87
- try {
88
- const body = await request.json();
89
-
90
- // Validate request body
91
- const validationResult = validateRequestBody(body);
92
- if (!validationResult.valid) {
93
- return NextResponse.json(
94
- { error: 'Invalid request body', details: validationResult.errors },
95
- { status: 400 }
96
- );
97
- }
98
-
99
- // Process POST request
100
- const result = await processPostRequest(body, request);
101
-
102
- return NextResponse.json(result, {
103
- status: 201,
104
- headers: {
105
- 'Content-Type': 'application/json',
106
- },
107
- });
108
-
109
- } catch (error) {
110
- console.error('Edge function POST error:', error);
111
-
112
- return NextResponse.json(
113
- { error: 'Internal server error' },
114
- { status: 500 }
115
- );
116
- }
117
- }
118
-
119
- async function processRequest(metadata: RequestMetadata): Promise<any> {
120
- // Implement your edge function logic here
121
- return {
122
- message: 'Edge function executed successfully',
123
- metadata,
124
- timestamp: new Date().toISOString(),
125
- };
126
- }
127
-
128
- async function processPostRequest(body: any, request: NextRequest): Promise<any> {
129
- // Implement POST logic here
130
- return {
131
- message: 'POST processed successfully',
132
- data: body,
133
- timestamp: new Date().toISOString(),
134
- };
135
- }
136
-
137
- function validateRequestBody(body: any): ValidationResult {
138
- // Implement validation logic
139
- return { valid: true, errors: [] };
140
- }
141
-
142
- interface RequestMetadata {
143
- geo: {
144
- country: string;
145
- city: string;
146
- region: string;
147
- };
148
- ip: string;
149
- userAgent: string;
150
- referer: string;
151
- url: string;
152
- }
153
-
154
- interface ValidationResult {
155
- valid: boolean;
156
- errors: string[];
157
- }
158
- ```
159
-
160
- ## Specialized Edge Function Types
161
-
162
- ### 1. Geolocation-Based Content Delivery
163
- ```typescript
164
- // api/edge/geo-content/index.ts
165
- import { NextRequest, NextResponse } from 'next/server';
166
-
167
- export const runtime = 'edge';
168
-
169
- interface ContentConfig {
170
- [country: string]: {
171
- currency: string;
172
- language: string;
173
- content: string;
174
- pricing: number;
175
- };
176
- }
177
-
178
- const contentConfig: ContentConfig = {
179
- 'US': {
180
- currency: 'USD',
181
- language: 'en-US',
182
- content: 'Welcome to our US store!',
183
- pricing: 99.99,
184
- },
185
- 'GB': {
186
- currency: 'GBP',
187
- language: 'en-GB',
188
- content: 'Welcome to our UK store!',
189
- pricing: 79.99,
190
- },
191
- 'DE': {
192
- currency: 'EUR',
193
- language: 'de-DE',
194
- content: 'Willkommen in unserem deutschen Shop!',
195
- pricing: 89.99,
196
- },
197
- };
198
-
199
- export async function GET(request: NextRequest) {
200
- const country = request.geo?.country || 'US';
201
- const config = contentConfig[country] || contentConfig['US'];
202
-
203
- // Add region-specific headers
204
- const response = NextResponse.json({
205
- country,
206
- ...config,
207
- edgeLocation: request.geo?.region,
208
- timestamp: new Date().toISOString(),
209
- });
210
-
211
- response.headers.set('Cache-Control', 'public, s-maxage=3600, stale-while-revalidate=86400');
212
- response.headers.set('Vary', 'Accept-Language, CloudFront-Viewer-Country');
213
- response.headers.set('Content-Language', config.language);
214
-
215
- return response;
216
- }
217
- ```
218
-
219
- ### 2. Authentication Edge Function
220
- ```typescript
221
- // api/edge/auth-check/index.ts
222
- import { NextRequest, NextResponse } from 'next/server';
223
- import { jwtVerify } from 'jose';
224
-
225
- export const runtime = 'edge';
226
-
227
- const JWT_SECRET = new TextEncoder().encode(
228
- process.env.JWT_SECRET || 'your-secret-key'
229
- );
230
-
231
- export async function GET(request: NextRequest) {
232
- try {
233
- // Extract token from header or cookie
234
- const authHeader = request.headers.get('authorization');
235
- const cookieToken = request.cookies.get('auth-token')?.value;
236
-
237
- const token = authHeader?.replace('Bearer ', '') || cookieToken;
238
-
239
- if (!token) {
240
- return NextResponse.json(
241
- { error: 'No token provided', authenticated: false },
242
- { status: 401 }
243
- );
244
- }
245
-
246
- // Verify JWT token
247
- const { payload } = await jwtVerify(token, JWT_SECRET);
248
-
249
- // Return user info
250
- return NextResponse.json({
251
- authenticated: true,
252
- user: {
253
- id: payload.sub,
254
- email: payload.email,
255
- role: payload.role,
256
- exp: payload.exp,
257
- },
258
- location: {
259
- country: request.geo?.country,
260
- city: request.geo?.city,
261
- },
262
- });
263
-
264
- } catch (error) {
265
- console.error('Auth verification failed:', error);
266
-
267
- return NextResponse.json(
268
- { error: 'Invalid token', authenticated: false },
269
- { status: 401 }
270
- );
271
- }
272
- }
273
-
274
- export async function POST(request: NextRequest) {
275
- try {
276
- const { username, password } = await request.json();
277
-
278
- // Validate credentials (implement your logic)
279
- const user = await validateCredentials(username, password);
280
-
281
- if (!user) {
282
- return NextResponse.json(
283
- { error: 'Invalid credentials' },
284
- { status: 401 }
285
- );
286
- }
287
-
288
- // Generate JWT token
289
- const token = await generateJWT(user);
290
-
291
- const response = NextResponse.json({
292
- success: true,
293
- user: {
294
- id: user.id,
295
- email: user.email,
296
- role: user.role,
297
- },
298
- });
299
-
300
- // Set secure cookie
301
- response.cookies.set('auth-token', token, {
302
- httpOnly: true,
303
- secure: process.env.NODE_ENV === 'production',
304
- sameSite: 'strict',
305
- maxAge: 24 * 60 * 60, // 24 hours
306
- });
307
-
308
- return response;
309
-
310
- } catch (error) {
311
- console.error('Authentication error:', error);
312
-
313
- return NextResponse.json(
314
- { error: 'Authentication failed' },
315
- { status: 500 }
316
- );
317
- }
318
- }
319
-
320
- async function validateCredentials(username: string, password: string) {
321
- // Implement credential validation
322
- // This would typically involve database lookup
323
- return null; // Placeholder
324
- }
325
-
326
- async function generateJWT(user: any): Promise<string> {
327
- // Implement JWT generation
328
- // This would use a proper JWT library
329
- return 'jwt-token'; // Placeholder
330
- }
331
- ```
332
-
333
- ### 3. Data Transformation Edge Function
334
- ```typescript
335
- // api/edge/transform/index.ts
336
- import { NextRequest, NextResponse } from 'next/server';
337
-
338
- export const runtime = 'edge';
339
-
340
- interface TransformConfig {
341
- format: 'json' | 'xml' | 'csv';
342
- fields?: string[];
343
- transforms?: Record<string, (value: any) => any>;
344
- }
345
-
346
- const transformers = {
347
- // Currency conversion
348
- currency: (value: number, targetCurrency: string = 'USD') => {
349
- const rates = { USD: 1, EUR: 0.85, GBP: 0.73 };
350
- return value * (rates[targetCurrency as keyof typeof rates] || 1);
351
- },
352
-
353
- // Date formatting
354
- date: (value: string, format: string = 'ISO') => {
355
- const date = new Date(value);
356
- if (format === 'ISO') return date.toISOString();
357
- if (format === 'US') return date.toLocaleDateString('en-US');
358
- return date.toString();
359
- },
360
-
361
- // Text formatting
362
- text: (value: string, caseType: string = 'lower') => {
363
- if (caseType === 'upper') return value.toUpperCase();
364
- if (caseType === 'title') return value.replace(/\w\S*/g, txt =>
365
- txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
366
- );
367
- return value.toLowerCase();
368
- },
369
- };
370
-
371
- export async function POST(request: NextRequest) {
372
- try {
373
- const { data, config }: { data: any; config: TransformConfig } = await request.json();
374
-
375
- if (!data || !config) {
376
- return NextResponse.json(
377
- { error: 'Missing data or config' },
378
- { status: 400 }
379
- );
380
- }
381
-
382
- // Apply transformations
383
- const transformedData = await transformData(data, config, request);
384
-
385
- // Format output based on requested format
386
- const output = await formatOutput(transformedData, config.format);
387
-
388
- const response = new NextResponse(output, {
389
- status: 200,
390
- headers: {
391
- 'Content-Type': getContentType(config.format),
392
- 'Cache-Control': 'public, s-maxage=300',
393
- },
394
- });
395
-
396
- return response;
397
-
398
- } catch (error) {
399
- console.error('Transform error:', error);
400
-
401
- return NextResponse.json(
402
- { error: 'Transformation failed' },
403
- { status: 500 }
404
- );
405
- }
406
- }
407
-
408
- async function transformData(data: any, config: TransformConfig, request: NextRequest) {
409
- const country = request.geo?.country || 'US';
410
-
411
- // Apply field filtering if specified
412
- if (config.fields && Array.isArray(data)) {
413
- data = data.map(item => {
414
- const filtered: any = {};
415
- config.fields!.forEach(field => {
416
- if (item.hasOwnProperty(field)) {
417
- filtered[field] = item[field];
418
- }
419
- });
420
- return filtered;
421
- });
422
- }
423
-
424
- // Apply custom transforms
425
- if (config.transforms) {
426
- Object.entries(config.transforms).forEach(([field, transformFunc]) => {
427
- if (Array.isArray(data)) {
428
- data = data.map(item => ({
429
- ...item,
430
- [field]: transformFunc(item[field]),
431
- }));
432
- } else if (data.hasOwnProperty(field)) {
433
- data[field] = transformFunc(data[field]);
434
- }
435
- });
436
- }
437
-
438
- // Add geo context
439
- return {
440
- ...data,
441
- _meta: {
442
- transformedAt: new Date().toISOString(),
443
- location: country,
444
- edgeRegion: request.geo?.region,
445
- },
446
- };
447
- }
448
-
449
- async function formatOutput(data: any, format: string): Promise<string> {
450
- switch (format) {
451
- case 'xml':
452
- return jsonToXml(data);
453
- case 'csv':
454
- return jsonToCsv(data);
455
- case 'json':
456
- default:
457
- return JSON.stringify(data, null, 2);
458
- }
459
- }
460
-
461
- function getContentType(format: string): string {
462
- switch (format) {
463
- case 'xml': return 'application/xml';
464
- case 'csv': return 'text/csv';
465
- case 'json':
466
- default: return 'application/json';
467
- }
468
- }
469
-
470
- function jsonToXml(data: any): string {
471
- // Simple XML conversion (implement proper XML library for production)
472
- return `<?xml version="1.0" encoding="UTF-8"?><root>${JSON.stringify(data)}</root>`;
473
- }
474
-
475
- function jsonToCsv(data: any): string {
476
- // Simple CSV conversion (implement proper CSV library for production)
477
- if (Array.isArray(data) && data.length > 0) {
478
- const headers = Object.keys(data[0]);
479
- const rows = data.map(row => headers.map(header => row[header] || '').join(','));
480
- return [headers.join(','), ...rows].join('\n');
481
- }
482
- return '';
483
- }
484
- ```
485
-
486
- ### 4. Proxy and Cache Edge Function
487
- ```typescript
488
- // api/edge/proxy/index.ts
489
- import { NextRequest, NextResponse } from 'next/server';
490
-
491
- export const runtime = 'edge';
492
-
493
- interface ProxyConfig {
494
- targetUrl: string;
495
- cacheTime: number;
496
- headers?: Record<string, string>;
497
- transformResponse?: boolean;
498
- }
499
-
500
- const proxyConfigs: Record<string, ProxyConfig> = {
501
- 'api': {
502
- targetUrl: 'https://jsonplaceholder.typicode.com',
503
- cacheTime: 300, // 5 minutes
504
- headers: {
505
- 'User-Agent': 'Vercel-Edge-Proxy/1.0',
506
- },
507
- },
508
- 'cdn': {
509
- targetUrl: 'https://cdn.example.com',
510
- cacheTime: 3600, // 1 hour
511
- transformResponse: false,
512
- },
513
- };
514
-
515
- export async function GET(request: NextRequest) {
516
- try {
517
- const url = new URL(request.url);
518
- const proxyType = url.searchParams.get('type') || 'api';
519
- const targetPath = url.searchParams.get('path') || '';
520
-
521
- const config = proxyConfigs[proxyType];
522
- if (!config) {
523
- return NextResponse.json(
524
- { error: 'Invalid proxy type' },
525
- { status: 400 }
526
- );
527
- }
528
-
529
- // Build target URL
530
- const targetUrl = `${config.targetUrl}${targetPath}`;
531
-
532
- // Check cache first (simplified - use proper cache in production)
533
- const cacheKey = `proxy:${targetUrl}`;
534
-
535
- // Make request to target
536
- const response = await fetch(targetUrl, {
537
- headers: {
538
- ...config.headers,
539
- 'X-Forwarded-For': request.headers.get('x-forwarded-for') || '',
540
- 'X-Real-IP': request.headers.get('x-real-ip') || '',
541
- },
542
- });
543
-
544
- if (!response.ok) {
545
- return NextResponse.json(
546
- { error: 'Upstream server error' },
547
- { status: response.status }
548
- );
549
- }
550
-
551
- let data;
552
- const contentType = response.headers.get('content-type') || '';
553
-
554
- if (contentType.includes('application/json')) {
555
- data = await response.json();
556
-
557
- // Transform response if configured
558
- if (config.transformResponse) {
559
- data = await transformProxyResponse(data, request);
560
- }
561
-
562
- return NextResponse.json(data, {
563
- status: 200,
564
- headers: {
565
- 'Cache-Control': `public, s-maxage=${config.cacheTime}, stale-while-revalidate=${config.cacheTime * 2}`,
566
- 'X-Proxy-Cache': 'MISS',
567
- 'X-Edge-Location': request.geo?.region || 'unknown',
568
- },
569
- });
570
- } else {
571
- // For non-JSON responses, pass through
572
- const blob = await response.blob();
573
-
574
- return new NextResponse(blob, {
575
- status: 200,
576
- headers: {
577
- 'Content-Type': contentType,
578
- 'Cache-Control': `public, s-maxage=${config.cacheTime}`,
579
- },
580
- });
581
- }
582
-
583
- } catch (error) {
584
- console.error('Proxy error:', error);
585
-
586
- return NextResponse.json(
587
- { error: 'Proxy request failed' },
588
- { status: 502 }
589
- );
590
- }
591
- }
592
-
593
- async function transformProxyResponse(data: any, request: NextRequest) {
594
- // Add geo context to proxied data
595
- return {
596
- ...data,
597
- _proxy: {
598
- timestamp: new Date().toISOString(),
599
- location: request.geo?.country,
600
- region: request.geo?.region,
601
- },
602
- };
603
- }
604
- ```
605
-
606
- ## Edge Function Utilities
607
-
608
- ### 1. Configuration Management
609
- ```typescript
610
- // api/edge/[function-name]/config.ts
611
- export interface EdgeFunctionConfig {
612
- cacheTime: number;
613
- rateLimit: {
614
- requests: number;
615
- windowMs: number;
616
- };
617
- geo: {
618
- enabled: boolean;
619
- restrictedCountries?: string[];
620
- };
621
- security: {
622
- corsOrigins: string[];
623
- requireAuth: boolean;
624
- };
625
- }
626
-
627
- export const defaultConfig: EdgeFunctionConfig = {
628
- cacheTime: 300, // 5 minutes
629
- rateLimit: {
630
- requests: 100,
631
- windowMs: 60000, // 1 minute
632
- },
633
- geo: {
634
- enabled: true,
635
- },
636
- security: {
637
- corsOrigins: ['*'],
638
- requireAuth: false,
639
- },
640
- };
641
- ```
642
-
643
- ### 2. Utility Functions
644
- ```typescript
645
- // api/edge/[function-name]/utils.ts
646
- export function getClientIP(request: NextRequest): string {
647
- return request.headers.get('x-forwarded-for') ||
648
- request.headers.get('x-real-ip') ||
649
- request.ip ||
650
- 'unknown';
651
- }
652
-
653
- export function generateCacheKey(request: NextRequest, suffix?: string): string {
654
- const url = new URL(request.url);
655
- const baseKey = `${url.pathname}${url.search}`;
656
- return suffix ? `${baseKey}:${suffix}` : baseKey;
657
- }
658
-
659
- export function createCorsResponse(
660
- data: any,
661
- origins: string[] = ['*']
662
- ): NextResponse {
663
- const response = NextResponse.json(data);
664
-
665
- response.headers.set('Access-Control-Allow-Origin', origins.join(', '));
666
- response.headers.set('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
667
- response.headers.set('Access-Control-Allow-Headers', 'Content-Type, Authorization');
668
-
669
- return response;
670
- }
671
-
672
- export function validateGeoRestrictions(
673
- request: NextRequest,
674
- restrictedCountries: string[] = []
675
- ): boolean {
676
- const country = request.geo?.country;
677
- return !country || !restrictedCountries.includes(country);
678
- }
679
- ```
680
-
681
- ### 3. Testing Framework
682
- ```typescript
683
- // api/edge/[function-name]/__tests__/[function-name].test.ts
684
- import { NextRequest } from 'next/server';
685
- import { GET, POST } from '../index';
686
-
687
- // Mock geo data
688
- const createMockRequest = (url: string, options: any = {}) => {
689
- const request = new NextRequest(url, options);
690
-
691
- // Mock geo property
692
- Object.defineProperty(request, 'geo', {
693
- value: {
694
- country: 'US',
695
- city: 'New York',
696
- region: 'us-east-1',
697
- },
698
- });
699
-
700
- return request;
701
- };
702
-
703
- describe('Edge Function', () => {
704
- describe('GET requests', () => {
705
- it('should return geo-based content', async () => {
706
- const request = createMockRequest('http://localhost:3000/api/edge/test');
707
- const response = await GET(request);
708
- const data = await response.json();
709
-
710
- expect(response.status).toBe(200);
711
- expect(data.metadata.geo.country).toBe('US');
712
- });
713
-
714
- it('should handle missing geo data', async () => {
715
- const request = new NextRequest('http://localhost:3000/api/edge/test');
716
- const response = await GET(request);
717
- const data = await response.json();
718
-
719
- expect(response.status).toBe(200);
720
- expect(data.metadata.geo.country).toBe('Unknown');
721
- });
722
- });
723
-
724
- describe('POST requests', () => {
725
- it('should validate request body', async () => {
726
- const request = createMockRequest('http://localhost:3000/api/edge/test', {
727
- method: 'POST',
728
- body: JSON.stringify({ invalid: 'data' }),
729
- headers: { 'Content-Type': 'application/json' },
730
- });
731
-
732
- const response = await POST(request);
733
- const data = await response.json();
734
-
735
- expect(response.status).toBe(400);
736
- expect(data.error).toBe('Invalid request body');
737
- });
738
- });
739
- });
740
- ```
741
-
742
- ## Performance and Optimization
743
-
744
- ### 1. Response Optimization
745
- ```typescript
746
- // Optimize responses for edge performance
747
- export function optimizeResponse(data: any, request: NextRequest): NextResponse {
748
- const response = NextResponse.json(data);
749
-
750
- // Set appropriate cache headers
751
- const cacheTime = getCacheTime(request.url);
752
- response.headers.set(
753
- 'Cache-Control',
754
- `public, s-maxage=${cacheTime}, stale-while-revalidate=${cacheTime * 2}`
755
- );
756
-
757
- // Add compression hints
758
- response.headers.set('Content-Encoding', 'gzip');
759
-
760
- // Add performance headers
761
- response.headers.set('X-Edge-Location', request.geo?.region || 'unknown');
762
-
763
- return response;
764
- }
765
-
766
- function getCacheTime(url: string): number {
767
- // Dynamic cache time based on URL patterns
768
- if (url.includes('/static/')) return 3600; // 1 hour
769
- if (url.includes('/api/')) return 60; // 1 minute
770
- return 300; // 5 minutes default
771
- }
772
- ```
773
-
774
- ### 2. Error Handling
775
- ```typescript
776
- export function createErrorResponse(
777
- error: unknown,
778
- request: NextRequest
779
- ): NextResponse {
780
- console.error('Edge function error:', error);
781
-
782
- // Log error with context
783
- const errorContext = {
784
- url: request.url,
785
- method: request.method,
786
- country: request.geo?.country,
787
- timestamp: new Date().toISOString(),
788
- };
789
-
790
- // Return appropriate error response
791
- return NextResponse.json(
792
- {
793
- error: 'Internal server error',
794
- requestId: generateRequestId(),
795
- },
796
- {
797
- status: 500,
798
- headers: {
799
- 'X-Error-Context': JSON.stringify(errorContext),
800
- },
801
- }
802
- );
803
- }
804
-
805
- function generateRequestId(): string {
806
- return Math.random().toString(36).substr(2, 9);
807
- }
808
- ```
809
-
810
- Generate comprehensive edge function implementation with the requested features, proper TypeScript types, error handling, and optimization patterns.