fraim-framework 2.0.67 → 2.0.69

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 (280) hide show
  1. package/bin/fraim.js +1 -1
  2. package/dist/src/cli/commands/doctor.js +1 -1
  3. package/dist/src/cli/commands/init-project.js +6 -12
  4. package/dist/src/cli/commands/list.js +1 -1
  5. package/dist/src/cli/commands/setup.js +15 -29
  6. package/dist/src/cli/commands/sync.js +36 -143
  7. package/dist/src/cli/fraim.js +0 -4
  8. package/dist/src/cli/setup/first-run.js +4 -4
  9. package/dist/src/cli/setup/ide-detector.js +15 -5
  10. package/dist/src/fraim/template-processor.js +7 -35
  11. package/dist/src/local-mcp-server/stdio-server.js +170 -181
  12. package/dist/src/utils/git-utils.js +2 -2
  13. package/dist/src/utils/object-utils.js +11 -0
  14. package/dist/src/utils/provider-utils.js +14 -0
  15. package/dist/src/utils/request-utils.js +23 -0
  16. package/dist/src/utils/workflow-parser.js +7 -7
  17. package/package.json +7 -5
  18. package/dist/registry/ai-manager-rules/customer-development-phases/phase1-customer-profiling.md +0 -101
  19. package/dist/registry/ai-manager-rules/customer-development-phases/phase2-platform-discovery.md +0 -235
  20. package/dist/registry/ai-manager-rules/customer-development-phases/phase3-prospect-qualification.md +0 -243
  21. package/dist/registry/ai-manager-rules/customer-development-phases/phase4-inventory-compilation.md +0 -206
  22. package/dist/registry/ai-manager-rules/design-phases/design-completeness-review.md +0 -73
  23. package/dist/registry/ai-manager-rules/design-phases/design-design.md +0 -145
  24. package/dist/registry/ai-manager-rules/design-phases/design.md +0 -108
  25. package/dist/registry/ai-manager-rules/design-phases/finalize.md +0 -60
  26. package/dist/registry/ai-manager-rules/design-phases/validate.md +0 -125
  27. package/dist/registry/ai-manager-rules/design.json +0 -97
  28. package/dist/registry/ai-manager-rules/implement-phases/code.md +0 -323
  29. package/dist/registry/ai-manager-rules/implement-phases/completeness-review.md +0 -94
  30. package/dist/registry/ai-manager-rules/implement-phases/finalize.md +0 -177
  31. package/dist/registry/ai-manager-rules/implement-phases/implement-code.md +0 -283
  32. package/dist/registry/ai-manager-rules/implement-phases/implement-completeness-review.md +0 -120
  33. package/dist/registry/ai-manager-rules/implement-phases/implement-regression.md +0 -173
  34. package/dist/registry/ai-manager-rules/implement-phases/implement-repro.md +0 -104
  35. package/dist/registry/ai-manager-rules/implement-phases/implement-scoping.md +0 -100
  36. package/dist/registry/ai-manager-rules/implement-phases/implement-smoke.md +0 -237
  37. package/dist/registry/ai-manager-rules/implement-phases/implement-spike.md +0 -121
  38. package/dist/registry/ai-manager-rules/implement-phases/implement-validate.md +0 -375
  39. package/dist/registry/ai-manager-rules/implement-phases/quality-review.md +0 -304
  40. package/dist/registry/ai-manager-rules/implement-phases/regression.md +0 -159
  41. package/dist/registry/ai-manager-rules/implement-phases/repro.md +0 -101
  42. package/dist/registry/ai-manager-rules/implement-phases/scoping.md +0 -93
  43. package/dist/registry/ai-manager-rules/implement-phases/smoke.md +0 -225
  44. package/dist/registry/ai-manager-rules/implement-phases/spike.md +0 -118
  45. package/dist/registry/ai-manager-rules/implement-phases/validate.md +0 -347
  46. package/dist/registry/ai-manager-rules/implement.json +0 -153
  47. package/dist/registry/ai-manager-rules/retrospective.md +0 -116
  48. package/dist/registry/ai-manager-rules/shared-phases/address-pr-feedback.md +0 -188
  49. package/dist/registry/ai-manager-rules/shared-phases/finalize.md +0 -169
  50. package/dist/registry/ai-manager-rules/shared-phases/submit-pr.md +0 -202
  51. package/dist/registry/ai-manager-rules/shared-phases/wait-for-pr-review.md +0 -170
  52. package/dist/registry/ai-manager-rules/spec-phases/finalize.md +0 -60
  53. package/dist/registry/ai-manager-rules/spec-phases/spec-competitor-analysis.md +0 -105
  54. package/dist/registry/ai-manager-rules/spec-phases/spec-completeness-review.md +0 -66
  55. package/dist/registry/ai-manager-rules/spec-phases/spec-spec.md +0 -139
  56. package/dist/registry/ai-manager-rules/spec-phases/spec.md +0 -102
  57. package/dist/registry/ai-manager-rules/spec-phases/validate.md +0 -118
  58. package/dist/registry/ai-manager-rules/spec.json +0 -112
  59. package/dist/registry/ai-manager-rules/test.json +0 -98
  60. package/dist/registry/ai-manager-rules/user-survey-phases/phase1-survey-scoping.md +0 -60
  61. package/dist/registry/ai-manager-rules/user-survey-phases/phase2-survey-build-linkedin.md +0 -23
  62. package/dist/registry/ai-manager-rules/user-survey-phases/phase3-survey-build-reddit.md +0 -22
  63. package/dist/registry/ai-manager-rules/user-survey-phases/phase4-survey-build-x.md +0 -21
  64. package/dist/registry/ai-manager-rules/user-survey-phases/phase5-survey-build-facebook.md +0 -19
  65. package/dist/registry/ai-manager-rules/user-survey-phases/phase6-survey-build-custom.md +0 -15
  66. package/dist/registry/ai-manager-rules/user-survey-phases/phase7-survey-dispatch.md +0 -45
  67. package/dist/registry/delivery/address-feedback.md +0 -83
  68. package/dist/registry/delivery/retrospective.md +0 -78
  69. package/dist/registry/delivery/submit.md +0 -79
  70. package/dist/registry/providers/ado.json +0 -19
  71. package/dist/registry/providers/delivery-conversation.json +0 -9
  72. package/dist/registry/providers/delivery-pr.json +0 -9
  73. package/dist/registry/providers/github.json +0 -19
  74. package/dist/registry/rules/agent-success-criteria.md +0 -101
  75. package/dist/registry/rules/agent-testing-guidelines.md +0 -502
  76. package/dist/registry/rules/architecture.md +0 -126
  77. package/dist/registry/rules/communication.md +0 -122
  78. package/dist/registry/rules/continuous-learning.md +0 -55
  79. package/dist/registry/rules/debugging-multitenancy-issues.md +0 -85
  80. package/dist/registry/rules/ephemeral-execution.md +0 -54
  81. package/dist/registry/rules/git-safe-commands.md +0 -34
  82. package/dist/registry/rules/hitl-ppe-record-analysis.md +0 -302
  83. package/dist/registry/rules/integrity-and-test-ethics.md +0 -275
  84. package/dist/registry/rules/local-development.md +0 -275
  85. package/dist/registry/rules/mandatory-pre-completion-reflection.md +0 -193
  86. package/dist/registry/rules/merge-requirements.md +0 -238
  87. package/dist/registry/rules/simplicity.md +0 -118
  88. package/dist/registry/rules/software-development-lifecycle.md +0 -105
  89. package/dist/registry/rules/spike-first-development.md +0 -205
  90. package/dist/registry/rules/successful-debugging-patterns.md +0 -488
  91. package/dist/registry/scripts/build-scripts-generator.js +0 -205
  92. package/dist/registry/scripts/cleanup-branch.js +0 -287
  93. package/dist/registry/scripts/evaluate-code-quality.js +0 -66
  94. package/dist/registry/scripts/exec-with-timeout.js +0 -142
  95. package/dist/registry/scripts/fraim-config.js +0 -61
  96. package/dist/registry/scripts/generate-engagement-emails.js +0 -705
  97. package/dist/registry/scripts/generic-issues-api.js +0 -100
  98. package/dist/registry/scripts/newsletter-helpers.js +0 -671
  99. package/dist/registry/scripts/openapi-generator.js +0 -664
  100. package/dist/registry/scripts/performance/profile-server.js +0 -390
  101. package/dist/registry/scripts/profile-server.js +0 -389
  102. package/dist/registry/scripts/run-thank-you-workflow.js +0 -92
  103. package/dist/registry/scripts/send-newsletter-simple.js +0 -85
  104. package/dist/registry/scripts/send-thank-you-emails.js +0 -54
  105. package/dist/registry/scripts/validate-openapi-limits.js +0 -311
  106. package/dist/registry/scripts/validate-test-coverage.js +0 -262
  107. package/dist/registry/scripts/verify-test-coverage.js +0 -66
  108. package/dist/registry/stubs/workflows/azure/cost-optimization.md +0 -11
  109. package/dist/registry/stubs/workflows/bootstrap/create-architecture.md +0 -11
  110. package/dist/registry/stubs/workflows/bootstrap/detect-broken-windows.md +0 -11
  111. package/dist/registry/stubs/workflows/bootstrap/evaluate-code-quality.md +0 -11
  112. package/dist/registry/stubs/workflows/bootstrap/verify-test-coverage.md +0 -11
  113. package/dist/registry/stubs/workflows/brainstorming/blue-sky-brainstorming.md +0 -11
  114. package/dist/registry/stubs/workflows/brainstorming/codebase-brainstorming.md +0 -11
  115. package/dist/registry/stubs/workflows/business-development/create-business-plan.md +0 -11
  116. package/dist/registry/stubs/workflows/business-development/ideate-business-opportunity.md +0 -11
  117. package/dist/registry/stubs/workflows/business-development/price-product.md +0 -18
  118. package/dist/registry/stubs/workflows/compliance/detect-compliance-requirements.md +0 -11
  119. package/dist/registry/stubs/workflows/compliance/generate-audit-evidence.md +0 -11
  120. package/dist/registry/stubs/workflows/compliance/soc2-evidence-generator.md +0 -11
  121. package/dist/registry/stubs/workflows/customer-development/insight-analysis.md +0 -11
  122. package/dist/registry/stubs/workflows/customer-development/insight-triage.md +0 -11
  123. package/dist/registry/stubs/workflows/customer-development/interview-preparation.md +0 -11
  124. package/dist/registry/stubs/workflows/customer-development/linkedin-outreach.md +0 -11
  125. package/dist/registry/stubs/workflows/customer-development/strategic-brainstorming.md +0 -11
  126. package/dist/registry/stubs/workflows/customer-development/thank-customers.md +0 -11
  127. package/dist/registry/stubs/workflows/customer-development/user-survey-dispatch.md +0 -11
  128. package/dist/registry/stubs/workflows/customer-development/users-to-target.md +0 -11
  129. package/dist/registry/stubs/workflows/customer-development/weekly-newsletter.md +0 -11
  130. package/dist/registry/stubs/workflows/deploy/cloud-deployment.md +0 -11
  131. package/dist/registry/stubs/workflows/improve-fraim/contribute.md +0 -11
  132. package/dist/registry/stubs/workflows/improve-fraim/file-issue.md +0 -11
  133. package/dist/registry/stubs/workflows/learning/build-skillset.md +0 -11
  134. package/dist/registry/stubs/workflows/learning/synthesize-learnings.md +0 -11
  135. package/dist/registry/stubs/workflows/legal/contract-review-analysis.md +0 -11
  136. package/dist/registry/stubs/workflows/legal/nda.md +0 -11
  137. package/dist/registry/stubs/workflows/legal/patent-filing.md +0 -11
  138. package/dist/registry/stubs/workflows/legal/saas-contract-development.md +0 -11
  139. package/dist/registry/stubs/workflows/legal/trademark-filing.md +0 -11
  140. package/dist/registry/stubs/workflows/marketing/content-creation.md +0 -11
  141. package/dist/registry/stubs/workflows/marketing/convert-to-pdf.md +0 -11
  142. package/dist/registry/stubs/workflows/marketing/create-modern-website.md +0 -11
  143. package/dist/registry/stubs/workflows/marketing/domain-registration.md +0 -11
  144. package/dist/registry/stubs/workflows/marketing/evangelize.md +0 -11
  145. package/dist/registry/stubs/workflows/marketing/hbr-article.md +0 -11
  146. package/dist/registry/stubs/workflows/marketing/launch-checklist.md +0 -11
  147. package/dist/registry/stubs/workflows/marketing/marketing-strategy.md +0 -11
  148. package/dist/registry/stubs/workflows/marketing/storytelling.md +0 -11
  149. package/dist/registry/stubs/workflows/performance/analyze-performance.md +0 -11
  150. package/dist/registry/stubs/workflows/product-building/design.md +0 -11
  151. package/dist/registry/stubs/workflows/product-building/implement.md +0 -11
  152. package/dist/registry/stubs/workflows/product-building/iterate-on-pr-comments.md +0 -11
  153. package/dist/registry/stubs/workflows/product-building/prep-issue.md +0 -11
  154. package/dist/registry/stubs/workflows/product-building/prototype.md +0 -11
  155. package/dist/registry/stubs/workflows/product-building/resolve.md +0 -11
  156. package/dist/registry/stubs/workflows/product-building/retrospect.md +0 -11
  157. package/dist/registry/stubs/workflows/product-building/spec.md +0 -11
  158. package/dist/registry/stubs/workflows/product-building/test.md +0 -11
  159. package/dist/registry/stubs/workflows/productivity-report/productivity-report.md +0 -11
  160. package/dist/registry/stubs/workflows/quality-assurance/browser-validation.md +0 -11
  161. package/dist/registry/stubs/workflows/quality-assurance/iterative-improvement-cycle.md +0 -11
  162. package/dist/registry/stubs/workflows/replicate/replicate-discovery.md +0 -11
  163. package/dist/registry/stubs/workflows/replicate/replicate-to-issues.md +0 -11
  164. package/dist/registry/stubs/workflows/reviewer/review-implementation-vs-design-spec.md +0 -11
  165. package/dist/registry/stubs/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -11
  166. package/dist/registry/stubs/workflows/startup-credits/aws-activate-application.md +0 -11
  167. package/dist/registry/stubs/workflows/startup-credits/google-cloud-application.md +0 -11
  168. package/dist/registry/stubs/workflows/startup-credits/microsoft-azure-application.md +0 -11
  169. package/dist/registry/templates/bootstrap/ARCHITECTURE-TEMPLATE.md +0 -53
  170. package/dist/registry/templates/bootstrap/CODE-QUALITY-REPORT-TEMPLATE.md +0 -37
  171. package/dist/registry/templates/bootstrap/TEST-COVERAGE-REPORT-TEMPLATE.md +0 -35
  172. package/dist/registry/templates/business-development/IDEATION-REPORT-TEMPLATE.md +0 -29
  173. package/dist/registry/templates/business-development/PRICING-STRATEGY-TEMPLATE.md +0 -126
  174. package/dist/registry/templates/customer-development/customer-interview-template.md +0 -99
  175. package/dist/registry/templates/customer-development/customer-persona-template.md +0 -69
  176. package/dist/registry/templates/customer-development/follow-up-email-templates.md +0 -132
  177. package/dist/registry/templates/customer-development/insight-analysis-template.md +0 -74
  178. package/dist/registry/templates/customer-development/prospect-inventory-template.csv +0 -3
  179. package/dist/registry/templates/customer-development/search-strategy-template.md +0 -123
  180. package/dist/registry/templates/customer-development/strategic-recommendations-template.md +0 -53
  181. package/dist/registry/templates/customer-development/thank-you-email-template.html +0 -124
  182. package/dist/registry/templates/customer-development/thank-you-note-template.md +0 -16
  183. package/dist/registry/templates/customer-development/triage-log-template.md +0 -278
  184. package/dist/registry/templates/customer-development/weekly-newsletter-template.html +0 -204
  185. package/dist/registry/templates/evidence/Design-Evidence.md +0 -30
  186. package/dist/registry/templates/evidence/Implementation-BugEvidence.md +0 -122
  187. package/dist/registry/templates/evidence/Implementation-FeatureEvidence.md +0 -160
  188. package/dist/registry/templates/evidence/Spec-Evidence.md +0 -19
  189. package/dist/registry/templates/help/HelpNeeded.md +0 -14
  190. package/dist/registry/templates/legal/NDA-TEMPLATE.md +0 -170
  191. package/dist/registry/templates/legal/PATENT-TEMPLATE.md +0 -372
  192. package/dist/registry/templates/legal/TRADEMARK-TEMPLATE.md +0 -339
  193. package/dist/registry/templates/legal/contract-review-checklist.md +0 -193
  194. package/dist/registry/templates/legal/review-report-template.md +0 -198
  195. package/dist/registry/templates/legal/saas-terms-template.md +0 -174
  196. package/dist/registry/templates/legal/sow-template.md +0 -117
  197. package/dist/registry/templates/legal/template-variables.md +0 -131
  198. package/dist/registry/templates/marketing/DOMAIN-REGISTRATION-TEMPLATE.md +0 -194
  199. package/dist/registry/templates/marketing/EVANGELIZE-TEMPLATE.md +0 -102
  200. package/dist/registry/templates/marketing/HBR-ARTICLE-TEMPLATE.md +0 -66
  201. package/dist/registry/templates/marketing/STORYTELLING-TEMPLATE.md +0 -130
  202. package/dist/registry/templates/marketing/WEBSITE-TEMPLATE.md +0 -262
  203. package/dist/registry/templates/marketing/github-pages-workflow.yml +0 -64
  204. package/dist/registry/templates/replicate/implementation-checklist.md +0 -39
  205. package/dist/registry/templates/replicate/use-cases-template.md +0 -88
  206. package/dist/registry/templates/retrospective/RETROSPECTIVE-TEMPLATE.md +0 -55
  207. package/dist/registry/templates/specs/BUGSPEC-TEMPLATE.md +0 -37
  208. package/dist/registry/templates/specs/FEATURESPEC-TEMPLATE.md +0 -66
  209. package/dist/registry/templates/specs/TECHSPEC-TEMPLATE.md +0 -39
  210. package/dist/registry/workflows/azure/cost-optimization.md +0 -772
  211. package/dist/registry/workflows/bootstrap/create-architecture.md +0 -37
  212. package/dist/registry/workflows/bootstrap/detect-broken-windows.md +0 -300
  213. package/dist/registry/workflows/bootstrap/evaluate-code-quality.md +0 -35
  214. package/dist/registry/workflows/bootstrap/verify-test-coverage.md +0 -36
  215. package/dist/registry/workflows/brainstorming/blue-sky-brainstorming.md +0 -211
  216. package/dist/registry/workflows/brainstorming/codebase-brainstorming.md +0 -159
  217. package/dist/registry/workflows/business-development/create-business-plan.md +0 -737
  218. package/dist/registry/workflows/business-development/ideate-business-opportunity.md +0 -55
  219. package/dist/registry/workflows/business-development/price-product.md +0 -325
  220. package/dist/registry/workflows/compliance/detect-compliance-requirements.md +0 -80
  221. package/dist/registry/workflows/compliance/generate-audit-evidence.md +0 -80
  222. package/dist/registry/workflows/compliance/soc2-evidence-generator.md +0 -332
  223. package/dist/registry/workflows/customer-development/insight-analysis.md +0 -156
  224. package/dist/registry/workflows/customer-development/insight-triage.md +0 -933
  225. package/dist/registry/workflows/customer-development/interview-preparation.md +0 -452
  226. package/dist/registry/workflows/customer-development/linkedin-outreach.md +0 -599
  227. package/dist/registry/workflows/customer-development/strategic-brainstorming.md +0 -146
  228. package/dist/registry/workflows/customer-development/thank-customers.md +0 -203
  229. package/dist/registry/workflows/customer-development/user-survey-dispatch.md +0 -312
  230. package/dist/registry/workflows/customer-development/users-to-target.md +0 -427
  231. package/dist/registry/workflows/customer-development/weekly-newsletter.md +0 -366
  232. package/dist/registry/workflows/deploy/cloud-deployment.md +0 -310
  233. package/dist/registry/workflows/improve-fraim/contribute.md +0 -32
  234. package/dist/registry/workflows/improve-fraim/file-issue.md +0 -32
  235. package/dist/registry/workflows/learning/build-skillset.md +0 -212
  236. package/dist/registry/workflows/learning/synthesize-learnings.md +0 -369
  237. package/dist/registry/workflows/legal/contract-review-analysis.md +0 -382
  238. package/dist/registry/workflows/legal/nda.md +0 -69
  239. package/dist/registry/workflows/legal/patent-filing.md +0 -76
  240. package/dist/registry/workflows/legal/saas-contract-development.md +0 -204
  241. package/dist/registry/workflows/legal/trademark-filing.md +0 -77
  242. package/dist/registry/workflows/marketing/content-creation.md +0 -40
  243. package/dist/registry/workflows/marketing/convert-to-pdf.md +0 -265
  244. package/dist/registry/workflows/marketing/create-modern-website.md +0 -456
  245. package/dist/registry/workflows/marketing/domain-registration.md +0 -323
  246. package/dist/registry/workflows/marketing/evangelize.md +0 -426
  247. package/dist/registry/workflows/marketing/hbr-article.md +0 -73
  248. package/dist/registry/workflows/marketing/launch-checklist.md +0 -37
  249. package/dist/registry/workflows/marketing/marketing-strategy.md +0 -45
  250. package/dist/registry/workflows/marketing/storytelling.md +0 -65
  251. package/dist/registry/workflows/performance/analyze-performance.md +0 -65
  252. package/dist/registry/workflows/product-building/design.md +0 -263
  253. package/dist/registry/workflows/product-building/implement.md +0 -771
  254. package/dist/registry/workflows/product-building/iterate-on-pr-comments.md +0 -70
  255. package/dist/registry/workflows/product-building/prep-issue.md +0 -41
  256. package/dist/registry/workflows/product-building/prototype.md +0 -60
  257. package/dist/registry/workflows/product-building/resolve.md +0 -175
  258. package/dist/registry/workflows/product-building/retrospect.md +0 -86
  259. package/dist/registry/workflows/product-building/spec.md +0 -303
  260. package/dist/registry/workflows/product-building/test.md +0 -125
  261. package/dist/registry/workflows/productivity-report/productivity-report.md +0 -263
  262. package/dist/registry/workflows/quality-assurance/browser-validation.md +0 -221
  263. package/dist/registry/workflows/quality-assurance/iterative-improvement-cycle.md +0 -562
  264. package/dist/registry/workflows/replicate/replicate-discovery.md +0 -336
  265. package/dist/registry/workflows/replicate/replicate-to-issues.md +0 -319
  266. package/dist/registry/workflows/reviewer/review-implementation-vs-design-spec.md +0 -694
  267. package/dist/registry/workflows/reviewer/review-implementation-vs-feature-spec.md +0 -734
  268. package/dist/registry/workflows/startup-credits/aws-activate-application.md +0 -535
  269. package/dist/registry/workflows/startup-credits/google-cloud-application.md +0 -647
  270. package/dist/registry/workflows/startup-credits/microsoft-azure-application.md +0 -538
  271. package/dist/src/cli/commands/init.js +0 -148
  272. package/dist/src/cli/commands/mcp.js +0 -65
  273. package/dist/src/cli/commands/wizard.js +0 -35
  274. package/dist/src/fraim/issue-tracking/ado-provider.js +0 -304
  275. package/dist/src/fraim/issue-tracking/factory.js +0 -63
  276. package/dist/src/fraim/issue-tracking/github-provider.js +0 -200
  277. package/dist/src/fraim/issue-tracking/types.js +0 -7
  278. package/dist/src/fraim/issue-tracking-config.js +0 -83
  279. package/dist/src/fraim/retrospective-learner.js +0 -301
  280. package/dist/src/fraim/setup-wizard.js +0 -99
@@ -1,664 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /**
4
- * FRAIM OpenAPI Generator
5
- *
6
- * Auto-generates OpenAPI specification, instructions.txt, KB files, and MCP server structure
7
- * for any project using FRAIM.
8
- *
9
- * Usage:
10
- * npx tsx scripts/openapi-generator.ts
11
- *
12
- * This will:
13
- * 1. Generate openapi.json based on project routes
14
- * 2. Generate instructions.txt for ChatGPT
15
- * 3. Create KB-*.txt files for detailed documentation
16
- * 4. Generate MCP server structure
17
- * 5. Set up build-time validation
18
- */
19
- Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.generateOpenAPI = generateOpenAPI;
21
- exports.generateInstructions = generateInstructions;
22
- exports.generateKBFiles = generateKBFiles;
23
- exports.generateMCPServer = generateMCPServer;
24
- exports.generateAll = generateAll;
25
- const fs_1 = require("fs");
26
- const path_1 = require("path");
27
- const config_loader_js_1 = require("../../src/fraim/config-loader.js");
28
- const INSTRUCTIONS_LIMIT = 8000;
29
- const OPENAPI_ENDPOINT_LIMIT = 35;
30
- const OPENAPI_DESC_LIMIT = 300;
31
- /**
32
- * Generate OpenAPI specification from project routes
33
- */
34
- function generateOpenAPI(config) {
35
- const projectName = config.project.name || 'My Project';
36
- const projectDescription = config.project.description || 'API for ' + projectName;
37
- const baseUrl = config.api?.baseUrl || 'https://api.example.com';
38
- // Start with base OpenAPI structure
39
- const openapi = {
40
- openapi: '3.1.1',
41
- info: {
42
- title: `${projectName} API`,
43
- description: projectDescription,
44
- version: config.project.version || '1.0.0',
45
- contact: {
46
- name: projectName,
47
- email: config.project.contactEmail || 'support@example.com'
48
- }
49
- },
50
- servers: [
51
- {
52
- url: baseUrl,
53
- description: projectName
54
- }
55
- ],
56
- security: [
57
- {
58
- BearerAuth: []
59
- }
60
- ],
61
- components: {
62
- securitySchemes: {
63
- BearerAuth: {
64
- type: 'http',
65
- scheme: 'bearer',
66
- bearerFormat: 'JWT',
67
- description: 'JWT token obtained from OAuth authentication'
68
- }
69
- },
70
- schemas: {
71
- Error: {
72
- type: 'object',
73
- properties: {
74
- success: {
75
- type: 'boolean',
76
- example: false
77
- },
78
- error: {
79
- type: 'string',
80
- description: 'Error message'
81
- },
82
- message: {
83
- type: 'string',
84
- description: 'Human-readable error message'
85
- }
86
- },
87
- required: ['success', 'error']
88
- },
89
- Success: {
90
- type: 'object',
91
- properties: {
92
- success: {
93
- type: 'boolean',
94
- example: true
95
- },
96
- message: {
97
- type: 'string',
98
- description: 'Success message'
99
- },
100
- data: {
101
- type: 'object',
102
- description: 'Response data'
103
- }
104
- },
105
- required: ['success']
106
- }
107
- }
108
- },
109
- paths: {}
110
- };
111
- // Add issue filing endpoint (generic, always included)
112
- openapi.paths['/issues/create'] = {
113
- post: {
114
- operationId: 'createIssue',
115
- summary: 'Create a GitHub issue',
116
- description: 'Create a new issue in the project repository. Can be invoked through ChatGPT OpenAPI or MCP.',
117
- 'x-openai-isConsequential': false,
118
- tags: ['Issues'],
119
- security: [{ BearerAuth: [] }],
120
- requestBody: {
121
- required: true,
122
- content: {
123
- 'application/json': {
124
- schema: {
125
- type: 'object',
126
- properties: {
127
- title: {
128
- type: 'string',
129
- description: 'Issue title',
130
- example: 'Bug: Feature not working'
131
- },
132
- body: {
133
- type: 'string',
134
- description: 'Issue description',
135
- example: 'Detailed description of the issue'
136
- },
137
- labels: {
138
- type: 'array',
139
- items: { type: 'string' },
140
- description: 'Optional labels for the issue',
141
- example: ['bug', 'high-priority']
142
- }
143
- },
144
- required: ['title', 'body']
145
- }
146
- }
147
- }
148
- },
149
- responses: {
150
- '200': {
151
- description: 'Issue created successfully',
152
- content: {
153
- 'application/json': {
154
- schema: {
155
- allOf: [
156
- { $ref: '#/components/schemas/Success' },
157
- {
158
- type: 'object',
159
- properties: {
160
- issueNumber: {
161
- type: 'integer',
162
- description: 'GitHub issue number'
163
- },
164
- issueUrl: {
165
- type: 'string',
166
- format: 'uri',
167
- description: 'URL to the created issue'
168
- }
169
- }
170
- }
171
- ]
172
- }
173
- }
174
- }
175
- },
176
- '400': {
177
- description: 'Bad request',
178
- content: {
179
- 'application/json': {
180
- schema: { $ref: '#/components/schemas/Error' }
181
- }
182
- }
183
- },
184
- '401': {
185
- description: 'Unauthorized',
186
- content: {
187
- 'application/json': {
188
- schema: { $ref: '#/components/schemas/Error' }
189
- }
190
- }
191
- },
192
- '500': {
193
- description: 'Internal server error',
194
- content: {
195
- 'application/json': {
196
- schema: { $ref: '#/components/schemas/Error' }
197
- }
198
- }
199
- }
200
- }
201
- }
202
- };
203
- return openapi;
204
- }
205
- /**
206
- * Generate instructions.txt for ChatGPT
207
- */
208
- function generateInstructions(config) {
209
- const projectName = config.project.name || 'My Project';
210
- const projectDescription = config.project.description || 'API for ' + projectName;
211
- let instructions = `# Intent
212
- You are an AI assistant for ${projectName} - ${projectDescription}
213
-
214
- # Personality
215
- Helpful, friendly, professional. Put the user first and manage their time efficiently.
216
-
217
- # Communication
218
- Use plain ASCII only. No en dashes, em dashes, curly quotes, or ellipses. Use hyphens, straight quotes, and three dots instead.
219
-
220
- # Key Rules
221
- - Never claim to complete actions without verified tool/API use
222
- - Always get confirmation before performing destructive actions
223
- - See KB files for details on various aspects of operation
224
-
225
- ## Authentication
226
- Most endpoints require Bearer token authentication. Exception: Public endpoints (if any).
227
-
228
- **When User Asks to Log In/Sign In/Authenticate:**
229
- - Call authentication endpoint. If it returns 401 Unauthorized, ChatGPT's OAuth system will automatically present the login button/redirect.
230
- - NO explanations about OAuth, NO lists of steps, NO instructions. Just call the endpoint - ChatGPT's OAuth handles the rest automatically.
231
-
232
- ## Core Commands
233
-
234
- ### 1. POST /issues/create - Create GitHub Issue
235
- **MUST be available for all FRAIM projects.** Create a new issue in the project repository. Can be invoked through ChatGPT OpenAPI or MCP.
236
-
237
- **Request Body:**
238
- - \`title\` (string, required): Issue title
239
- - \`body\` (string, required): Issue description
240
- - \`labels\` (array of strings, optional): Labels for the issue
241
-
242
- **Response:**
243
- - \`success\` (boolean): Whether the issue was created
244
- - \`issueNumber\` (integer): GitHub issue number
245
- - \`issueUrl\` (string): URL to the created issue
246
-
247
- **Usage:** When user reports a bug, requests a feature, or needs to file an issue, use this endpoint.
248
-
249
- ## Response Format
250
- All responses: \`{"success": true/false, "message": "Description", "data": {}}\`
251
-
252
- ## KB Files
253
- See KB-*.txt files for detailed information on:
254
- - KB-issues.txt: Issue filing and management
255
- - KB-authentication.txt: Authentication and authorization
256
- - KB-api-overview.txt: API overview and common patterns
257
-
258
- ## Next Steps
259
- 1. Read KB files for detailed workflows
260
- 2. Use endpoints as described
261
- 3. Always confirm with user before destructive actions
262
- `;
263
- // Ensure instructions are within limit
264
- if (instructions.length > INSTRUCTIONS_LIMIT) {
265
- console.warn(`āš ļø Instructions exceed ${INSTRUCTIONS_LIMIT} character limit (${instructions.length} chars)`);
266
- console.warn(' Consider moving detailed content to KB files');
267
- }
268
- return instructions;
269
- }
270
- /**
271
- * Generate KB files
272
- */
273
- function generateKBFiles(config, outputDir) {
274
- if (!(0, fs_1.existsSync)(outputDir)) {
275
- (0, fs_1.mkdirSync)(outputDir, { recursive: true });
276
- }
277
- // KB-issues.txt - Issue filing
278
- const kbIssues = `# Issue Filing and Management
279
-
280
- ## Overview
281
- This project includes a generic issue filing endpoint that can be invoked through ChatGPT OpenAPI or MCP.
282
-
283
- ## Endpoint: POST /issues/create
284
-
285
- ### Purpose
286
- Create a new GitHub issue in the project repository.
287
-
288
- ### Authentication
289
- Requires Bearer token authentication.
290
-
291
- ### Request Format
292
- \`\`\`json
293
- {
294
- "title": "Issue title",
295
- "body": "Detailed description",
296
- "labels": ["bug", "high-priority"]
297
- }
298
- \`\`\`
299
-
300
- ### Response Format
301
- \`\`\`json
302
- {
303
- "success": true,
304
- "message": "Issue created successfully",
305
- "issueNumber": 123,
306
- "issueUrl": "https://github.com/owner/repo/issues/123"
307
- }
308
- \`\`\`
309
-
310
- ### Usage Examples
311
-
312
- **From ChatGPT:**
313
- - User: "I found a bug where the login doesn't work"
314
- - Assistant: Calls POST /issues/create with title and description
315
-
316
- **From MCP:**
317
- - Tool: create_issue
318
- - Parameters: title, body, labels
319
-
320
- ### Configuration
321
- The endpoint uses GitHub token from environment variables:
322
- - GITHUB_TOKEN (preferred)
323
- - GIT_TOKEN
324
- - GITHUB_PAT
325
-
326
- Repository owner and name are configured in project settings.
327
-
328
- ### Labels
329
- Common labels:
330
- - bug: Something isn't working
331
- - feature: New feature request
332
- - enhancement: Improvement to existing feature
333
- - question: Further information is requested
334
- - help wanted: Extra attention is needed
335
- `;
336
- // KB-authentication.txt
337
- const kbAuth = `# Authentication and Authorization
338
-
339
- ## Overview
340
- Most endpoints require Bearer token authentication.
341
-
342
- ## Getting a Token
343
- 1. User logs in through OAuth
344
- 2. ChatGPT automatically handles OAuth flow
345
- 3. Token is included in Authorization header
346
-
347
- ## Token Format
348
- \`Authorization: Bearer <token>\`
349
-
350
- ## Public Endpoints
351
- Some endpoints may be public (no authentication required). Check endpoint documentation.
352
-
353
- ## Error Responses
354
- - 401 Unauthorized: Token missing or invalid
355
- - 403 Forbidden: Token valid but insufficient permissions
356
- `;
357
- // KB-api-overview.txt
358
- const kbApi = `# API Overview
359
-
360
- ## Base URL
361
- ${config.api?.baseUrl || 'https://api.example.com'}
362
-
363
- ## Common Patterns
364
-
365
- ### Success Response
366
- \`\`\`json
367
- {
368
- "success": true,
369
- "message": "Operation completed",
370
- "data": {}
371
- }
372
- \`\`\`
373
-
374
- ### Error Response
375
- \`\`\`json
376
- {
377
- "success": false,
378
- "error": "Error code",
379
- "message": "Human-readable error message"
380
- }
381
- \`\`\`
382
-
383
- ## Rate Limiting
384
- Check response headers for rate limit information.
385
-
386
- ## Pagination
387
- List endpoints may support pagination:
388
- - \`limit\`: Number of items per page
389
- - \`offset\`: Number of items to skip
390
- `;
391
- (0, fs_1.writeFileSync)((0, path_1.join)(outputDir, 'KB-issues.txt'), kbIssues);
392
- (0, fs_1.writeFileSync)((0, path_1.join)(outputDir, 'KB-authentication.txt'), kbAuth);
393
- (0, fs_1.writeFileSync)((0, path_1.join)(outputDir, 'KB-api-overview.txt'), kbApi);
394
- console.log(`āœ… Generated KB files in ${outputDir}`);
395
- }
396
- /**
397
- * Generate MCP server structure
398
- */
399
- function generateMCPServer(config, outputDir) {
400
- const mcpServerDir = (0, path_1.join)(outputDir, '..', 'src', 'mcp-server.ts');
401
- const mcpServerContent = `#!/usr/bin/env node
402
-
403
- import express from 'express';
404
- import cors from 'cors';
405
-
406
- /**
407
- * ${config.project.name} MCP Server
408
- *
409
- * MCP server that exposes project API endpoints as MCP tools.
410
- * Auto-generated by FRAIM.
411
- */
412
-
413
- class ProjectMCPServer {
414
- private app: express.Application;
415
- private apiBaseUrl: string;
416
-
417
- constructor(apiBaseUrl?: string) {
418
- this.app = express();
419
- this.app.use(cors());
420
- this.app.use(express.json());
421
-
422
- this.apiBaseUrl = apiBaseUrl || '${config.api?.baseUrl || 'http://localhost:3000'}';
423
- this.setupRoutes();
424
- }
425
-
426
- private setupRoutes() {
427
- // Health check
428
- this.app.get('/health', (req, res) => {
429
- res.json({
430
- status: 'healthy',
431
- server: 'project-mcp-server',
432
- api_url: this.apiBaseUrl
433
- });
434
- });
435
-
436
- // MCP endpoint
437
- this.app.post('/mcp', async (req, res): Promise<void> => {
438
- return this.handleMCPRequest(req, res);
439
- });
440
- }
441
-
442
- private async handleMCPRequest(req: any, res: any): Promise<void> {
443
- try {
444
- const { jsonrpc, method, params, id } = req.body;
445
-
446
- if (jsonrpc !== '2.0') {
447
- res.status(400).json({
448
- jsonrpc: '2.0',
449
- id: id || null,
450
- error: {
451
- code: -32600,
452
- message: 'Invalid Request - jsonrpc must be "2.0"'
453
- }
454
- });
455
- return;
456
- }
457
-
458
- let result;
459
-
460
- switch (method) {
461
- case 'initialize':
462
- result = this.handleInitialize(params);
463
- break;
464
-
465
- case 'tools/list':
466
- result = this.getToolsList();
467
- break;
468
-
469
- case 'tools/call':
470
- result = await this.handleToolCall(params);
471
- break;
472
-
473
- default:
474
- throw new Error(\`Unknown method: \${method}\`);
475
- }
476
-
477
- if (id !== undefined) {
478
- res.json({
479
- jsonrpc: '2.0',
480
- id,
481
- result
482
- });
483
- return;
484
- } else {
485
- res.status(202).send();
486
- return;
487
- }
488
-
489
- } catch (error) {
490
- res.json({
491
- jsonrpc: '2.0',
492
- id: req.body?.id || null,
493
- error: {
494
- code: -32603,
495
- message: error instanceof Error ? error.message : 'Internal error'
496
- }
497
- });
498
- return;
499
- }
500
- }
501
-
502
- public handleInitialize(params: any) {
503
- return {
504
- protocolVersion: '2024-11-05',
505
- capabilities: {
506
- tools: {
507
- listChanged: false
508
- },
509
- logging: {}
510
- },
511
- serverInfo: {
512
- name: 'project-mcp-server',
513
- version: '1.0.0'
514
- }
515
- };
516
- }
517
-
518
- public getToolsList() {
519
- return {
520
- tools: [
521
- {
522
- name: 'create_issue',
523
- description: 'Create a new GitHub issue in the project repository',
524
- inputSchema: {
525
- type: 'object',
526
- properties: {
527
- title: {
528
- type: 'string',
529
- description: 'Issue title'
530
- },
531
- body: {
532
- type: 'string',
533
- description: 'Issue description'
534
- },
535
- labels: {
536
- type: 'array',
537
- items: { type: 'string' },
538
- description: 'Optional labels for the issue'
539
- }
540
- },
541
- required: ['title', 'body']
542
- }
543
- }
544
- ]
545
- };
546
- }
547
-
548
- public async handleToolCall(params: any): Promise<any> {
549
- const { name: toolName, arguments: toolArgs } = params;
550
-
551
- switch (toolName) {
552
- case 'create_issue':
553
- return await this.createIssue(toolArgs);
554
-
555
- default:
556
- throw new Error(\`Unknown tool: \${toolName}\`);
557
- }
558
- }
559
-
560
- private async createIssue(args: any): Promise<any> {
561
- try {
562
- const response = await fetch(\`\${this.apiBaseUrl}/issues/create\`, {
563
- method: 'POST',
564
- headers: {
565
- 'Content-Type': 'application/json',
566
- 'Authorization': \`Bearer \${args.token || ''}\`
567
- },
568
- body: JSON.stringify({
569
- title: args.title,
570
- body: args.body,
571
- labels: args.labels || []
572
- })
573
- });
574
-
575
- const data = await response.json();
576
-
577
- if (!response.ok) {
578
- throw new Error(data.error || 'Failed to create issue');
579
- }
580
-
581
- return {
582
- content: [
583
- {
584
- type: 'text',
585
- text: \`Issue created successfully: #\${data.issueNumber}\\nURL: \${data.issueUrl}\`
586
- }
587
- ]
588
- };
589
- } catch (error) {
590
- throw new Error(\`Failed to create issue: \${error instanceof Error ? error.message : 'Unknown error'}\`);
591
- }
592
- }
593
-
594
- async start(port: number = 3001) {
595
- // Basic express app setup usually goes here or is passed in
596
- // For this generator script, we'll just log
597
- console.log(\`šŸš€ MCP Server running on port \${port}\`);
598
- console.log(\`šŸ“” MCP endpoint: http://localhost:\${port}/mcp\`);
599
- }
600
- }
601
-
602
- // Start server if run directly
603
- if (import.meta.url === \`file://\${process.argv[1]}\`) {
604
- const server = new ProjectMCPServer();
605
- server.start().catch((error) => {
606
- console.error('Failed to start MCP Server:', error);
607
- process.exit(1);
608
- });
609
- }
610
-
611
- export { ProjectMCPServer };
612
- `;
613
- // Ensure directory exists
614
- const mcpDir = (0, path_1.dirname)(mcpServerDir);
615
- if (!(0, fs_1.existsSync)(mcpDir)) {
616
- (0, fs_1.mkdirSync)(mcpDir, { recursive: true });
617
- }
618
- (0, fs_1.writeFileSync)(mcpServerDir, mcpServerContent);
619
- console.log(`āœ… Generated MCP server at ${mcpServerDir} `);
620
- }
621
- /**
622
- * Main generator function
623
- */
624
- function generateAll(config, outputDir = 'src/openapi') {
625
- console.log('šŸš€ FRAIM OpenAPI Generator\n');
626
- console.log(`šŸ“ Output directory: ${outputDir} \n`);
627
- // Ensure output directory exists
628
- if (!(0, fs_1.existsSync)(outputDir)) {
629
- (0, fs_1.mkdirSync)(outputDir, { recursive: true });
630
- }
631
- // Generate OpenAPI spec
632
- console.log('šŸ“ Generating OpenAPI specification...');
633
- const openapi = generateOpenAPI(config);
634
- const openapiPath = (0, path_1.join)(outputDir, 'openapi.json');
635
- (0, fs_1.writeFileSync)(openapiPath, JSON.stringify(openapi, null, 2));
636
- console.log(`āœ… Generated OpenAPI spec at ${openapiPath} `);
637
- // Generate instructions.txt
638
- console.log('\nšŸ“ Generating instructions.txt...');
639
- const instructions = generateInstructions(config);
640
- const instructionsPath = (0, path_1.join)(outputDir, 'instructions.txt');
641
- (0, fs_1.writeFileSync)(instructionsPath, instructions);
642
- console.log(`āœ… Generated instructions.txt at ${instructionsPath} `);
643
- console.log(` Length: ${instructions.length} characters(limit: ${INSTRUCTIONS_LIMIT})`);
644
- // Generate KB files
645
- console.log('\nšŸ“ Generating KB files...');
646
- generateKBFiles(config, outputDir);
647
- // Generate MCP server
648
- console.log('\nšŸ“ Generating MCP server...');
649
- generateMCPServer(config, outputDir);
650
- console.log('\nāœ… FRAIM generation complete!');
651
- console.log('\nšŸ“‹ Next steps:');
652
- console.log('1. Review and customize generated files');
653
- console.log('2. Add project-specific endpoints to openapi.json');
654
- console.log('3. Update instructions.txt with project-specific details');
655
- console.log('4. Add more KB files as needed');
656
- console.log('5. Run build-time validation: npm run validate:openapi');
657
- }
658
- // Run if executed directly
659
- // Run if executed directly
660
- // @ts-ignore
661
- if (import.meta.url === `file://${process.argv[1]}`) {
662
- const config = (0, config_loader_js_1.loadFraimConfig)();
663
- generateAll(config);
664
- }