@friggframework/devtools 2.0.0-next.61 → 2.0.0-next.62

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 (305) hide show
  1. package/package.json +14 -7
  2. package/.eslintrc.json +0 -3
  3. package/CHANGELOG.md +0 -132
  4. package/infrastructure/ARCHITECTURE.md +0 -487
  5. package/infrastructure/CLAUDE.md +0 -481
  6. package/infrastructure/HEALTH.md +0 -468
  7. package/infrastructure/README.md +0 -522
  8. package/infrastructure/__tests__/fixtures/mock-aws-resources.js +0 -391
  9. package/infrastructure/__tests__/helpers/test-utils.js +0 -277
  10. package/infrastructure/__tests__/postgres-config.test.js +0 -914
  11. package/infrastructure/__tests__/template-generation.test.js +0 -687
  12. package/infrastructure/create-frigg-infrastructure.js +0 -147
  13. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +0 -630
  14. package/infrastructure/docs/PRE-DEPLOYMENT-HEALTH-CHECK-SPEC.md +0 -1317
  15. package/infrastructure/docs/WEBSOCKET-CONFIGURATION.md +0 -105
  16. package/infrastructure/docs/deployment-instructions.md +0 -268
  17. package/infrastructure/docs/generate-iam-command.md +0 -278
  18. package/infrastructure/docs/iam-policy-templates.md +0 -193
  19. package/infrastructure/domains/database/aurora-builder.js +0 -809
  20. package/infrastructure/domains/database/aurora-builder.test.js +0 -950
  21. package/infrastructure/domains/database/aurora-discovery.js +0 -87
  22. package/infrastructure/domains/database/aurora-discovery.test.js +0 -188
  23. package/infrastructure/domains/database/aurora-resolver.js +0 -210
  24. package/infrastructure/domains/database/aurora-resolver.test.js +0 -347
  25. package/infrastructure/domains/database/migration-builder.js +0 -701
  26. package/infrastructure/domains/database/migration-builder.test.js +0 -321
  27. package/infrastructure/domains/database/migration-resolver.js +0 -163
  28. package/infrastructure/domains/database/migration-resolver.test.js +0 -337
  29. package/infrastructure/domains/health/application/ports/IPropertyReconciler.js +0 -164
  30. package/infrastructure/domains/health/application/ports/IResourceDetector.js +0 -129
  31. package/infrastructure/domains/health/application/ports/IResourceImporter.js +0 -142
  32. package/infrastructure/domains/health/application/ports/IStackRepository.js +0 -131
  33. package/infrastructure/domains/health/application/ports/index.js +0 -26
  34. package/infrastructure/domains/health/application/use-cases/__tests__/execute-resource-import-use-case.test.js +0 -679
  35. package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +0 -167
  36. package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +0 -1130
  37. package/infrastructure/domains/health/application/use-cases/execute-resource-import-use-case.js +0 -221
  38. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.js +0 -152
  39. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.test.js +0 -343
  40. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.js +0 -535
  41. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.test.js +0 -376
  42. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.js +0 -213
  43. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +0 -441
  44. package/infrastructure/domains/health/docs/ACME-DEV-DRIFT-ANALYSIS.md +0 -267
  45. package/infrastructure/domains/health/docs/BUILD-VS-DEPLOYED-TEMPLATE-ANALYSIS.md +0 -324
  46. package/infrastructure/domains/health/docs/ORPHAN-DETECTION-ANALYSIS.md +0 -386
  47. package/infrastructure/domains/health/docs/SPEC-CLEANUP-COMMAND.md +0 -1419
  48. package/infrastructure/domains/health/docs/TDD-IMPLEMENTATION-SUMMARY.md +0 -391
  49. package/infrastructure/domains/health/docs/TEMPLATE-COMPARISON-IMPLEMENTATION.md +0 -551
  50. package/infrastructure/domains/health/domain/entities/issue.js +0 -299
  51. package/infrastructure/domains/health/domain/entities/issue.test.js +0 -528
  52. package/infrastructure/domains/health/domain/entities/property-mismatch.js +0 -108
  53. package/infrastructure/domains/health/domain/entities/property-mismatch.test.js +0 -275
  54. package/infrastructure/domains/health/domain/entities/resource.js +0 -159
  55. package/infrastructure/domains/health/domain/entities/resource.test.js +0 -432
  56. package/infrastructure/domains/health/domain/entities/stack-health-report.js +0 -306
  57. package/infrastructure/domains/health/domain/entities/stack-health-report.test.js +0 -601
  58. package/infrastructure/domains/health/domain/services/__tests__/health-score-percentage-based.test.js +0 -380
  59. package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +0 -971
  60. package/infrastructure/domains/health/domain/services/__tests__/import-template-generator.test.js +0 -1150
  61. package/infrastructure/domains/health/domain/services/__tests__/logical-id-mapper.test.js +0 -672
  62. package/infrastructure/domains/health/domain/services/__tests__/template-parser.test.js +0 -496
  63. package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +0 -419
  64. package/infrastructure/domains/health/domain/services/health-score-calculator.js +0 -248
  65. package/infrastructure/domains/health/domain/services/health-score-calculator.test.js +0 -504
  66. package/infrastructure/domains/health/domain/services/import-progress-monitor.js +0 -195
  67. package/infrastructure/domains/health/domain/services/import-template-generator.js +0 -435
  68. package/infrastructure/domains/health/domain/services/logical-id-mapper.js +0 -345
  69. package/infrastructure/domains/health/domain/services/mismatch-analyzer.js +0 -234
  70. package/infrastructure/domains/health/domain/services/mismatch-analyzer.test.js +0 -431
  71. package/infrastructure/domains/health/domain/services/property-mutability-config.js +0 -382
  72. package/infrastructure/domains/health/domain/services/template-parser.js +0 -245
  73. package/infrastructure/domains/health/domain/services/update-progress-monitor.js +0 -192
  74. package/infrastructure/domains/health/domain/value-objects/health-score.js +0 -138
  75. package/infrastructure/domains/health/domain/value-objects/health-score.test.js +0 -267
  76. package/infrastructure/domains/health/domain/value-objects/property-mutability.js +0 -161
  77. package/infrastructure/domains/health/domain/value-objects/property-mutability.test.js +0 -198
  78. package/infrastructure/domains/health/domain/value-objects/resource-state.js +0 -167
  79. package/infrastructure/domains/health/domain/value-objects/resource-state.test.js +0 -196
  80. package/infrastructure/domains/health/domain/value-objects/stack-identifier.js +0 -192
  81. package/infrastructure/domains/health/domain/value-objects/stack-identifier.test.js +0 -262
  82. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-cfn-tagged.test.js +0 -312
  83. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-multi-stack.test.js +0 -367
  84. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +0 -432
  85. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.js +0 -784
  86. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +0 -1133
  87. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.js +0 -565
  88. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +0 -554
  89. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.js +0 -318
  90. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.test.js +0 -398
  91. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.js +0 -777
  92. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.test.js +0 -580
  93. package/infrastructure/domains/integration/integration-builder.js +0 -404
  94. package/infrastructure/domains/integration/integration-builder.test.js +0 -690
  95. package/infrastructure/domains/integration/integration-resolver.js +0 -170
  96. package/infrastructure/domains/integration/integration-resolver.test.js +0 -369
  97. package/infrastructure/domains/integration/websocket-builder.js +0 -69
  98. package/infrastructure/domains/integration/websocket-builder.test.js +0 -195
  99. package/infrastructure/domains/networking/vpc-builder.js +0 -2051
  100. package/infrastructure/domains/networking/vpc-builder.test.js +0 -1960
  101. package/infrastructure/domains/networking/vpc-discovery.js +0 -177
  102. package/infrastructure/domains/networking/vpc-discovery.test.js +0 -350
  103. package/infrastructure/domains/networking/vpc-resolver.js +0 -505
  104. package/infrastructure/domains/networking/vpc-resolver.test.js +0 -801
  105. package/infrastructure/domains/parameters/ssm-builder.js +0 -79
  106. package/infrastructure/domains/parameters/ssm-builder.test.js +0 -189
  107. package/infrastructure/domains/parameters/ssm-discovery.js +0 -84
  108. package/infrastructure/domains/parameters/ssm-discovery.test.js +0 -210
  109. package/infrastructure/domains/security/iam-generator.js +0 -816
  110. package/infrastructure/domains/security/iam-generator.test.js +0 -204
  111. package/infrastructure/domains/security/kms-builder.js +0 -415
  112. package/infrastructure/domains/security/kms-builder.test.js +0 -392
  113. package/infrastructure/domains/security/kms-discovery.js +0 -80
  114. package/infrastructure/domains/security/kms-discovery.test.js +0 -177
  115. package/infrastructure/domains/security/kms-resolver.js +0 -96
  116. package/infrastructure/domains/security/kms-resolver.test.js +0 -216
  117. package/infrastructure/domains/security/templates/frigg-deployment-iam-stack.yaml +0 -401
  118. package/infrastructure/domains/security/templates/iam-policy-basic.json +0 -218
  119. package/infrastructure/domains/security/templates/iam-policy-full.json +0 -288
  120. package/infrastructure/domains/shared/base-builder.js +0 -112
  121. package/infrastructure/domains/shared/base-resolver.js +0 -186
  122. package/infrastructure/domains/shared/base-resolver.test.js +0 -305
  123. package/infrastructure/domains/shared/builder-orchestrator.js +0 -212
  124. package/infrastructure/domains/shared/builder-orchestrator.test.js +0 -213
  125. package/infrastructure/domains/shared/cloudformation-discovery-v2.js +0 -334
  126. package/infrastructure/domains/shared/cloudformation-discovery.js +0 -672
  127. package/infrastructure/domains/shared/cloudformation-discovery.test.js +0 -985
  128. package/infrastructure/domains/shared/environment-builder.js +0 -119
  129. package/infrastructure/domains/shared/environment-builder.test.js +0 -247
  130. package/infrastructure/domains/shared/providers/aws-provider-adapter.js +0 -579
  131. package/infrastructure/domains/shared/providers/aws-provider-adapter.test.js +0 -416
  132. package/infrastructure/domains/shared/providers/azure-provider-adapter.stub.js +0 -93
  133. package/infrastructure/domains/shared/providers/cloud-provider-adapter.js +0 -136
  134. package/infrastructure/domains/shared/providers/gcp-provider-adapter.stub.js +0 -82
  135. package/infrastructure/domains/shared/providers/provider-factory.js +0 -108
  136. package/infrastructure/domains/shared/providers/provider-factory.test.js +0 -170
  137. package/infrastructure/domains/shared/resource-discovery.enhanced.test.js +0 -306
  138. package/infrastructure/domains/shared/resource-discovery.js +0 -233
  139. package/infrastructure/domains/shared/resource-discovery.test.js +0 -588
  140. package/infrastructure/domains/shared/types/app-definition.js +0 -205
  141. package/infrastructure/domains/shared/types/discovery-result.js +0 -106
  142. package/infrastructure/domains/shared/types/discovery-result.test.js +0 -258
  143. package/infrastructure/domains/shared/types/index.js +0 -46
  144. package/infrastructure/domains/shared/types/resource-ownership.js +0 -108
  145. package/infrastructure/domains/shared/types/resource-ownership.test.js +0 -101
  146. package/infrastructure/domains/shared/utilities/base-definition-factory.js +0 -394
  147. package/infrastructure/domains/shared/utilities/base-definition-factory.js.bak +0 -338
  148. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +0 -291
  149. package/infrastructure/domains/shared/utilities/handler-path-resolver.js +0 -134
  150. package/infrastructure/domains/shared/utilities/handler-path-resolver.test.js +0 -268
  151. package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +0 -159
  152. package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +0 -444
  153. package/infrastructure/domains/shared/validation/env-validator.js +0 -78
  154. package/infrastructure/domains/shared/validation/env-validator.test.js +0 -173
  155. package/infrastructure/domains/shared/validation/plugin-validator.js +0 -187
  156. package/infrastructure/domains/shared/validation/plugin-validator.test.js +0 -323
  157. package/infrastructure/esbuild.config.js +0 -53
  158. package/infrastructure/index.js +0 -4
  159. package/infrastructure/infrastructure-composer.js +0 -117
  160. package/infrastructure/infrastructure-composer.test.js +0 -1895
  161. package/infrastructure/integration.test.js +0 -383
  162. package/infrastructure/scripts/build-prisma-layer.js +0 -701
  163. package/infrastructure/scripts/build-prisma-layer.test.js +0 -170
  164. package/infrastructure/scripts/build-time-discovery.js +0 -238
  165. package/infrastructure/scripts/build-time-discovery.test.js +0 -379
  166. package/infrastructure/scripts/run-discovery.js +0 -110
  167. package/infrastructure/scripts/verify-prisma-layer.js +0 -72
  168. package/layers/prisma/.build-complete +0 -3
  169. package/layers/prisma/nodejs/package.json +0 -8
  170. package/management-ui/.eslintrc.js +0 -22
  171. package/management-ui/components.json +0 -21
  172. package/management-ui/docs/phase2-integration-guide.md +0 -320
  173. package/management-ui/index.html +0 -13
  174. package/management-ui/package.json +0 -76
  175. package/management-ui/packages/devtools/frigg-cli/ui-command/index.js +0 -302
  176. package/management-ui/postcss.config.js +0 -6
  177. package/management-ui/server/api/backend.js +0 -256
  178. package/management-ui/server/api/cli.js +0 -315
  179. package/management-ui/server/api/codegen.js +0 -663
  180. package/management-ui/server/api/connections.js +0 -857
  181. package/management-ui/server/api/discovery.js +0 -185
  182. package/management-ui/server/api/environment/index.js +0 -1
  183. package/management-ui/server/api/environment/router.js +0 -378
  184. package/management-ui/server/api/environment.js +0 -328
  185. package/management-ui/server/api/integrations.js +0 -876
  186. package/management-ui/server/api/logs.js +0 -248
  187. package/management-ui/server/api/monitoring.js +0 -282
  188. package/management-ui/server/api/open-ide.js +0 -31
  189. package/management-ui/server/api/project.js +0 -1029
  190. package/management-ui/server/api/users/sessions.js +0 -371
  191. package/management-ui/server/api/users/simulation.js +0 -254
  192. package/management-ui/server/api/users.js +0 -362
  193. package/management-ui/server/api-contract.md +0 -275
  194. package/management-ui/server/index.js +0 -873
  195. package/management-ui/server/middleware/errorHandler.js +0 -93
  196. package/management-ui/server/middleware/security.js +0 -32
  197. package/management-ui/server/processManager.js +0 -296
  198. package/management-ui/server/server.js +0 -346
  199. package/management-ui/server/services/aws-monitor.js +0 -413
  200. package/management-ui/server/services/npm-registry.js +0 -347
  201. package/management-ui/server/services/template-engine.js +0 -538
  202. package/management-ui/server/utils/cliIntegration.js +0 -220
  203. package/management-ui/server/utils/environment/auditLogger.js +0 -471
  204. package/management-ui/server/utils/environment/awsParameterStore.js +0 -275
  205. package/management-ui/server/utils/environment/encryption.js +0 -278
  206. package/management-ui/server/utils/environment/envFileManager.js +0 -286
  207. package/management-ui/server/utils/import-commonjs.js +0 -28
  208. package/management-ui/server/utils/response.js +0 -83
  209. package/management-ui/server/websocket/handler.js +0 -325
  210. package/management-ui/src/App.jsx +0 -25
  211. package/management-ui/src/assets/FriggLogo.svg +0 -1
  212. package/management-ui/src/components/AppRouter.jsx +0 -65
  213. package/management-ui/src/components/Button.jsx +0 -70
  214. package/management-ui/src/components/Card.jsx +0 -97
  215. package/management-ui/src/components/EnvironmentCompare.jsx +0 -400
  216. package/management-ui/src/components/EnvironmentEditor.jsx +0 -372
  217. package/management-ui/src/components/EnvironmentImportExport.jsx +0 -469
  218. package/management-ui/src/components/EnvironmentSchema.jsx +0 -491
  219. package/management-ui/src/components/EnvironmentSecurity.jsx +0 -463
  220. package/management-ui/src/components/ErrorBoundary.jsx +0 -73
  221. package/management-ui/src/components/IntegrationCard.jsx +0 -481
  222. package/management-ui/src/components/IntegrationCardEnhanced.jsx +0 -770
  223. package/management-ui/src/components/IntegrationExplorer.jsx +0 -379
  224. package/management-ui/src/components/IntegrationStatus.jsx +0 -336
  225. package/management-ui/src/components/Layout.jsx +0 -716
  226. package/management-ui/src/components/LoadingSpinner.jsx +0 -113
  227. package/management-ui/src/components/RepositoryPicker.jsx +0 -248
  228. package/management-ui/src/components/SessionMonitor.jsx +0 -350
  229. package/management-ui/src/components/StatusBadge.jsx +0 -208
  230. package/management-ui/src/components/UserContextSwitcher.jsx +0 -212
  231. package/management-ui/src/components/UserSimulation.jsx +0 -327
  232. package/management-ui/src/components/Welcome.jsx +0 -434
  233. package/management-ui/src/components/codegen/APIEndpointGenerator.jsx +0 -637
  234. package/management-ui/src/components/codegen/APIModuleSelector.jsx +0 -227
  235. package/management-ui/src/components/codegen/CodeGenerationWizard.jsx +0 -247
  236. package/management-ui/src/components/codegen/CodePreviewEditor.jsx +0 -316
  237. package/management-ui/src/components/codegen/DynamicModuleForm.jsx +0 -271
  238. package/management-ui/src/components/codegen/FormBuilder.jsx +0 -737
  239. package/management-ui/src/components/codegen/IntegrationGenerator.jsx +0 -855
  240. package/management-ui/src/components/codegen/ProjectScaffoldWizard.jsx +0 -797
  241. package/management-ui/src/components/codegen/SchemaBuilder.jsx +0 -303
  242. package/management-ui/src/components/codegen/TemplateSelector.jsx +0 -586
  243. package/management-ui/src/components/codegen/index.js +0 -10
  244. package/management-ui/src/components/connections/ConnectionConfigForm.jsx +0 -362
  245. package/management-ui/src/components/connections/ConnectionHealthMonitor.jsx +0 -182
  246. package/management-ui/src/components/connections/ConnectionTester.jsx +0 -200
  247. package/management-ui/src/components/connections/EntityRelationshipMapper.jsx +0 -292
  248. package/management-ui/src/components/connections/OAuthFlow.jsx +0 -204
  249. package/management-ui/src/components/connections/index.js +0 -5
  250. package/management-ui/src/components/index.js +0 -21
  251. package/management-ui/src/components/monitoring/APIGatewayMetrics.jsx +0 -222
  252. package/management-ui/src/components/monitoring/LambdaMetrics.jsx +0 -169
  253. package/management-ui/src/components/monitoring/MetricsChart.jsx +0 -197
  254. package/management-ui/src/components/monitoring/MonitoringDashboard.jsx +0 -393
  255. package/management-ui/src/components/monitoring/SQSMetrics.jsx +0 -246
  256. package/management-ui/src/components/monitoring/index.js +0 -6
  257. package/management-ui/src/components/monitoring/monitoring.css +0 -218
  258. package/management-ui/src/components/theme-provider.jsx +0 -52
  259. package/management-ui/src/components/theme-toggle.jsx +0 -39
  260. package/management-ui/src/components/ui/badge.tsx +0 -36
  261. package/management-ui/src/components/ui/button.test.jsx +0 -56
  262. package/management-ui/src/components/ui/button.tsx +0 -57
  263. package/management-ui/src/components/ui/card.tsx +0 -76
  264. package/management-ui/src/components/ui/dropdown-menu.tsx +0 -199
  265. package/management-ui/src/components/ui/select.tsx +0 -157
  266. package/management-ui/src/components/ui/skeleton.jsx +0 -15
  267. package/management-ui/src/hooks/useFrigg.jsx +0 -387
  268. package/management-ui/src/hooks/useSocket.jsx +0 -58
  269. package/management-ui/src/index.css +0 -193
  270. package/management-ui/src/lib/utils.ts +0 -6
  271. package/management-ui/src/main.jsx +0 -10
  272. package/management-ui/src/pages/CodeGeneration.jsx +0 -14
  273. package/management-ui/src/pages/Connections.jsx +0 -252
  274. package/management-ui/src/pages/ConnectionsEnhanced.jsx +0 -633
  275. package/management-ui/src/pages/Dashboard.jsx +0 -311
  276. package/management-ui/src/pages/Environment.jsx +0 -314
  277. package/management-ui/src/pages/IntegrationConfigure.jsx +0 -669
  278. package/management-ui/src/pages/IntegrationDiscovery.jsx +0 -567
  279. package/management-ui/src/pages/IntegrationTest.jsx +0 -742
  280. package/management-ui/src/pages/Integrations.jsx +0 -253
  281. package/management-ui/src/pages/Monitoring.jsx +0 -17
  282. package/management-ui/src/pages/Simulation.jsx +0 -155
  283. package/management-ui/src/pages/Users.jsx +0 -492
  284. package/management-ui/src/services/api.js +0 -41
  285. package/management-ui/src/services/apiModuleService.js +0 -193
  286. package/management-ui/src/services/websocket-handlers.js +0 -120
  287. package/management-ui/src/test/api/project.test.js +0 -273
  288. package/management-ui/src/test/components/Welcome.test.jsx +0 -378
  289. package/management-ui/src/test/mocks/server.js +0 -178
  290. package/management-ui/src/test/setup.js +0 -61
  291. package/management-ui/src/test/utils/test-utils.jsx +0 -134
  292. package/management-ui/src/utils/repository.js +0 -98
  293. package/management-ui/src/utils/repository.test.js +0 -118
  294. package/management-ui/src/workflows/phase2-integration-workflows.js +0 -884
  295. package/management-ui/tailwind.config.js +0 -63
  296. package/management-ui/tsconfig.json +0 -37
  297. package/management-ui/tsconfig.node.json +0 -10
  298. package/management-ui/vite.config.js +0 -26
  299. package/management-ui/vitest.config.js +0 -38
  300. package/test/auther-definition-method-tester.js +0 -45
  301. package/test/index.js +0 -9
  302. package/test/integration-validator.js +0 -2
  303. package/test/mock-api-readme.md +0 -102
  304. package/test/mock-api.js +0 -284
  305. package/test/mock-integration.js +0 -78
@@ -1,876 +0,0 @@
1
- import express from 'express'
2
- import { exec } from 'child_process'
3
- import { promisify } from 'util'
4
- import path from 'path'
5
- import fs from 'fs-extra'
6
- <<<<<<< HEAD
7
- <<<<<<< HEAD
8
- import fetch from 'node-fetch'
9
- =======
10
- <<<<<<< HEAD
11
- <<<<<<< HEAD
12
- import fetch from 'node-fetch'
13
- =======
14
- >>>>>>> 652520a5 (Claude Flow RFC related development)
15
- =======
16
- import fetch from 'node-fetch'
17
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
18
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
19
- =======
20
- import fetch from 'node-fetch'
21
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
22
- import { createStandardResponse, createErrorResponse, ERROR_CODES, asyncHandler } from '../utils/response.js'
23
- import { importCommonJS } from '../utils/import-commonjs.js'
24
- import { wsHandler } from '../websocket/handler.js'
25
-
26
- const router = express.Router();
27
- const execAsync = promisify(exec);
28
-
29
- <<<<<<< HEAD
30
- <<<<<<< HEAD
31
- =======
32
- <<<<<<< HEAD
33
- <<<<<<< HEAD
34
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
35
- =======
36
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
37
- // Helper to get available integrations from NPM
38
- async function getAvailableIntegrations() {
39
- try {
40
- // Search NPM registry for @friggframework/api-module-* packages
41
- const searchUrl = 'https://registry.npmjs.org/-/v1/search?text=@friggframework%20api-module&size=100';
42
- <<<<<<< HEAD
43
- <<<<<<< HEAD
44
- =======
45
-
46
- const response = await fetch(searchUrl);
47
- if (!response.ok) {
48
- throw new Error(`NPM search failed: ${response.statusText}`);
49
- }
50
-
51
- const data = await response.json();
52
-
53
- // Filter and format integration packages
54
- const integrations = data.objects
55
- .filter(pkg => pkg.package.name.includes('@friggframework/api-module-'))
56
- .map(pkg => ({
57
- name: pkg.package.name,
58
- version: pkg.package.version,
59
- description: pkg.package.description || 'No description available',
60
- category: detectCategory(pkg.package.name, pkg.package.description || '', pkg.package.keywords || []),
61
- installed: false,
62
- tags: pkg.package.keywords || [],
63
- npmUrl: `https://www.npmjs.com/package/${pkg.package.name}`
64
- }));
65
-
66
- console.log(`Found ${integrations.length} available integrations from NPM`);
67
- return integrations;
68
- } catch (error) {
69
- console.error('Error fetching integrations from NPM:', error);
70
- // Fallback to basic list if NPM search fails
71
- return [
72
- {
73
- name: '@friggframework/api-module-hubspot',
74
- version: 'latest',
75
- description: 'HubSpot CRM integration for Frigg',
76
- category: 'CRM',
77
- installed: false
78
- }
79
- ];
80
- }
81
- }
82
-
83
- // Helper to detect integration category
84
- function detectCategory(name, description, keywords) {
85
- const text = `${name} ${description} ${keywords.join(' ')}`.toLowerCase();
86
-
87
- const categoryPatterns = {
88
- 'CRM': ['crm', 'customer', 'salesforce', 'hubspot', 'pipedrive'],
89
- 'Communication': ['email', 'sms', 'chat', 'slack', 'discord', 'teams'],
90
- 'E-commerce': ['ecommerce', 'shop', 'store', 'payment', 'stripe', 'paypal'],
91
- 'Marketing': ['marketing', 'campaign', 'mailchimp', 'activecampaign'],
92
- 'Productivity': ['task', 'project', 'asana', 'trello', 'notion', 'jira'],
93
- 'Analytics': ['analytics', 'tracking', 'google', 'mixpanel', 'segment'],
94
- 'Support': ['support', 'helpdesk', 'ticket', 'zendesk', 'intercom'],
95
- 'Finance': ['accounting', 'invoice', 'quickbooks', 'xero', 'billing'],
96
- 'Developer Tools': ['github', 'gitlab', 'bitbucket', 'api', 'webhook'],
97
- 'Social Media': ['social', 'facebook', 'twitter', 'instagram', 'linkedin']
98
- };
99
-
100
- for (const [category, patterns] of Object.entries(categoryPatterns)) {
101
- for (const pattern of patterns) {
102
- if (text.includes(pattern)) {
103
- return category;
104
- }
105
- }
106
- }
107
-
108
- return 'Other';
109
- }
110
-
111
- // Helper to get actual integrations from backend.js appDefinition
112
- async function getInstalledIntegrations() {
113
- try {
114
- // Try multiple possible backend locations
115
- const possiblePaths = [
116
- path.join(process.cwd(), '../../../backend'),
117
- path.join(process.cwd(), '../../backend'),
118
- path.join(process.cwd(), '../backend'),
119
- path.join(process.cwd(), 'backend'),
120
- // Also check template backend
121
- path.join(process.cwd(), '../frigg-cli/templates/backend')
122
- ];
123
-
124
- for (const backendPath of possiblePaths) {
125
- const backendJsPath = path.join(backendPath, 'backend.js');
126
- const indexJsPath = path.join(backendPath, 'index.js');
127
-
128
- // Try both backend.js and index.js
129
- const targetFile = await fs.pathExists(backendJsPath) ? backendJsPath :
130
- await fs.pathExists(indexJsPath) ? indexJsPath : null;
131
-
132
- if (targetFile) {
133
- console.log(`Found backend file at: ${targetFile}`);
134
-
135
- try {
136
- // Dynamically import the backend file to get the actual appDefinition
137
- const backendModule = require(targetFile);
138
-
139
- // Extract appDefinition - could be default export, named export, or variable
140
- const appDefinition = backendModule.default?.appDefinition ||
141
- backendModule.appDefinition ||
142
- backendModule.default ||
143
- backendModule;
144
-
145
- if (appDefinition && appDefinition.integrations && Array.isArray(appDefinition.integrations)) {
146
- console.log(`Found ${appDefinition.integrations.length} integrations in appDefinition`);
147
-
148
- const integrations = appDefinition.integrations.map((IntegrationClass, index) => {
149
- try {
150
- // Get integration metadata from static properties
151
- const config = IntegrationClass.Config || {};
152
- const options = IntegrationClass.Options || {};
153
- const modules = IntegrationClass.modules || {};
154
- const display = options.display || {};
155
-
156
- // Extract service name from class name
157
- const className = IntegrationClass.name || `Integration${index}`;
158
- const serviceName = className.replace(/Integration$/, '');
159
-
160
- return {
161
- name: config.name || serviceName.toLowerCase(),
162
- displayName: display.name || serviceName,
163
- description: display.description || `${serviceName} integration`,
164
- category: display.category || detectCategory(serviceName.toLowerCase(), display.description || '', []),
165
- version: config.version || '1.0.0',
166
- installed: true,
167
- status: 'active',
168
- type: 'integration',
169
- className: className,
170
-
171
- // Integration configuration details
172
- events: config.events || [],
173
- supportedVersions: config.supportedVersions || [],
174
- hasUserConfig: options.hasUserConfig || false,
175
-
176
- // Display properties
177
- icon: display.icon,
178
- detailsUrl: display.detailsUrl,
179
-
180
- // API Modules information
181
- apiModules: Object.keys(modules).map(key => ({
182
- name: key,
183
- module: modules[key]?.name || key,
184
- description: `API module for ${key}`
185
- })),
186
-
187
- // Constructor details
188
- constructor: {
189
- name: className,
190
- hasConfig: !!config,
191
- hasOptions: !!options,
192
- hasModules: Object.keys(modules).length > 0
193
- }
194
- };
195
- } catch (classError) {
196
- console.error(`Error processing integration class ${IntegrationClass.name}:`, classError);
197
- return {
198
- name: `unknown-${index}`,
199
- displayName: `Unknown Integration ${index}`,
200
- description: 'Error processing integration',
201
- category: 'Other',
202
- installed: true,
203
- status: 'error',
204
- type: 'integration',
205
- error: classError.message
206
- };
207
- }
208
- });
209
-
210
- console.log(`Successfully processed ${integrations.length} integrations:`,
211
- integrations.map(i => `${i.displayName} (${i.name})`));
212
- return integrations;
213
- } else {
214
- console.log('No integrations array found in appDefinition');
215
- }
216
- } catch (importError) {
217
- console.error(`Error importing ${targetFile}:`, importError);
218
- // Fall back to file parsing if dynamic import fails
219
- return await parseBackendFile(targetFile);
220
- }
221
- }
222
- }
223
-
224
- console.log('No backend file found in any expected location');
225
- =======
226
- // Helper to get available integrations
227
- =======
228
- // Helper to get available integrations from NPM
229
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
230
- async function getAvailableIntegrations() {
231
- try {
232
- // Search NPM registry for @friggframework/api-module-* packages
233
- const searchUrl = 'https://registry.npmjs.org/-/v1/search?text=@friggframework%20api-module&size=100';
234
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
235
- =======
236
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
237
-
238
- const response = await fetch(searchUrl);
239
- if (!response.ok) {
240
- throw new Error(`NPM search failed: ${response.statusText}`);
241
- }
242
-
243
- const data = await response.json();
244
-
245
- // Filter and format integration packages
246
- const integrations = data.objects
247
- .filter(pkg => pkg.package.name.includes('@friggframework/api-module-'))
248
- .map(pkg => ({
249
- name: pkg.package.name,
250
- version: pkg.package.version,
251
- description: pkg.package.description || 'No description available',
252
- category: detectCategory(pkg.package.name, pkg.package.description || '', pkg.package.keywords || []),
253
- installed: false,
254
- tags: pkg.package.keywords || [],
255
- npmUrl: `https://www.npmjs.com/package/${pkg.package.name}`
256
- }));
257
-
258
- console.log(`Found ${integrations.length} available integrations from NPM`);
259
- return integrations;
260
- } catch (error) {
261
- console.error('Error fetching integrations from NPM:', error);
262
- // Fallback to basic list if NPM search fails
263
- return [
264
- {
265
- name: '@friggframework/api-module-hubspot',
266
- version: 'latest',
267
- description: 'HubSpot CRM integration for Frigg',
268
- category: 'CRM',
269
- installed: false
270
- }
271
- ];
272
- }
273
- }
274
-
275
- // Helper to detect integration category
276
- function detectCategory(name, description, keywords) {
277
- const text = `${name} ${description} ${keywords.join(' ')}`.toLowerCase();
278
-
279
- const categoryPatterns = {
280
- 'CRM': ['crm', 'customer', 'salesforce', 'hubspot', 'pipedrive'],
281
- 'Communication': ['email', 'sms', 'chat', 'slack', 'discord', 'teams'],
282
- 'E-commerce': ['ecommerce', 'shop', 'store', 'payment', 'stripe', 'paypal'],
283
- 'Marketing': ['marketing', 'campaign', 'mailchimp', 'activecampaign'],
284
- 'Productivity': ['task', 'project', 'asana', 'trello', 'notion', 'jira'],
285
- 'Analytics': ['analytics', 'tracking', 'google', 'mixpanel', 'segment'],
286
- 'Support': ['support', 'helpdesk', 'ticket', 'zendesk', 'intercom'],
287
- 'Finance': ['accounting', 'invoice', 'quickbooks', 'xero', 'billing'],
288
- 'Developer Tools': ['github', 'gitlab', 'bitbucket', 'api', 'webhook'],
289
- 'Social Media': ['social', 'facebook', 'twitter', 'instagram', 'linkedin']
290
- };
291
-
292
- for (const [category, patterns] of Object.entries(categoryPatterns)) {
293
- for (const pattern of patterns) {
294
- if (text.includes(pattern)) {
295
- return category;
296
- }
297
- }
298
- }
299
-
300
- return 'Other';
301
- }
302
-
303
- // Helper to get actual integrations from backend.js appDefinition
304
- async function getInstalledIntegrations() {
305
- try {
306
- // Try multiple possible backend locations
307
- const possiblePaths = [
308
- path.join(process.cwd(), '../../../backend'),
309
- path.join(process.cwd(), '../../backend'),
310
- path.join(process.cwd(), '../backend'),
311
- path.join(process.cwd(), 'backend'),
312
- // Also check template backend
313
- path.join(process.cwd(), '../frigg-cli/templates/backend')
314
- ];
315
-
316
- for (const backendPath of possiblePaths) {
317
- const backendJsPath = path.join(backendPath, 'backend.js');
318
- const indexJsPath = path.join(backendPath, 'index.js');
319
-
320
- // Try both backend.js and index.js
321
- const targetFile = await fs.pathExists(backendJsPath) ? backendJsPath :
322
- await fs.pathExists(indexJsPath) ? indexJsPath : null;
323
-
324
- if (targetFile) {
325
- console.log(`Found backend file at: ${targetFile}`);
326
-
327
- try {
328
- // Dynamically import the backend file to get the actual appDefinition
329
- // Use importCommonJS helper to handle both ESM and CommonJS modules
330
- const backendModule = await importCommonJS(targetFile);
331
-
332
- // Extract appDefinition - could be default export, named export, or variable
333
- const appDefinition = backendModule.default?.appDefinition ||
334
- backendModule.appDefinition ||
335
- backendModule.default ||
336
- backendModule;
337
-
338
- if (appDefinition && appDefinition.integrations && Array.isArray(appDefinition.integrations)) {
339
- console.log(`Found ${appDefinition.integrations.length} integrations in appDefinition`);
340
-
341
- const integrations = appDefinition.integrations.map((IntegrationClass, index) => {
342
- try {
343
- // Get integration metadata from static properties
344
- const config = IntegrationClass.Config || {};
345
- const options = IntegrationClass.Options || {};
346
- const modules = IntegrationClass.modules || {};
347
- const display = options.display || {};
348
-
349
- // Extract service name from class name
350
- const className = IntegrationClass.name || `Integration${index}`;
351
- const serviceName = className.replace(/Integration$/, '');
352
-
353
- return {
354
- name: config.name || serviceName.toLowerCase(),
355
- displayName: display.name || serviceName,
356
- description: display.description || `${serviceName} integration`,
357
- category: display.category || detectCategory(serviceName.toLowerCase(), display.description || '', []),
358
- version: config.version || '1.0.0',
359
- installed: true,
360
- status: 'active',
361
- type: 'integration',
362
- className: className,
363
-
364
- // Integration configuration details
365
- events: config.events || [],
366
- supportedVersions: config.supportedVersions || [],
367
- hasUserConfig: options.hasUserConfig || false,
368
-
369
- // Display properties
370
- icon: display.icon,
371
- detailsUrl: display.detailsUrl,
372
-
373
- // API Modules information
374
- apiModules: Object.keys(modules).map(key => ({
375
- name: key,
376
- module: modules[key]?.name || key,
377
- description: `API module for ${key}`
378
- })),
379
-
380
- // Constructor details
381
- constructor: {
382
- name: className,
383
- hasConfig: !!config,
384
- hasOptions: !!options,
385
- hasModules: Object.keys(modules).length > 0
386
- }
387
- };
388
- } catch (classError) {
389
- console.error(`Error processing integration class ${IntegrationClass.name}:`, classError);
390
- return {
391
- name: `unknown-${index}`,
392
- displayName: `Unknown Integration ${index}`,
393
- description: 'Error processing integration',
394
- category: 'Other',
395
- installed: true,
396
- status: 'error',
397
- type: 'integration',
398
- error: classError.message
399
- };
400
- }
401
- });
402
-
403
- console.log(`Successfully processed ${integrations.length} integrations:`,
404
- integrations.map(i => `${i.displayName} (${i.name})`));
405
- return integrations;
406
- } else {
407
- console.log('No integrations array found in appDefinition');
408
- }
409
- } catch (importError) {
410
- console.error(`Error importing ${targetFile}:`, importError);
411
- // Fall back to file parsing if dynamic import fails
412
- return await parseBackendFile(targetFile);
413
- }
414
- }
415
- }
416
-
417
- <<<<<<< HEAD
418
- <<<<<<< HEAD
419
- console.log('No backend file found in any expected location');
420
- =======
421
- <<<<<<< HEAD
422
- >>>>>>> 652520a5 (Claude Flow RFC related development)
423
- =======
424
- console.log('No backend file found in any expected location');
425
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
426
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
427
- =======
428
- console.log('No backend file found in any expected location');
429
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
430
- return [];
431
- } catch (error) {
432
- console.error('Error reading installed integrations:', error);
433
- return [];
434
- }
435
- }
436
-
437
- <<<<<<< HEAD
438
- <<<<<<< HEAD
439
- =======
440
- <<<<<<< HEAD
441
- <<<<<<< HEAD
442
- =======
443
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
444
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
445
- =======
446
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
447
- // Fallback function to parse backend file if dynamic import fails
448
- async function parseBackendFile(filePath) {
449
- try {
450
- const backendContent = await fs.readFile(filePath, 'utf8');
451
- const integrations = [];
452
- <<<<<<< HEAD
453
- <<<<<<< HEAD
454
- =======
455
- <<<<<<< HEAD
456
-
457
- // Extract integration imports
458
- const importMatches = backendContent.match(/(?:const|let|var)\s+(\w+Integration)\s*=\s*require\(['"]([^'"]+)['"]\)/g) || [];
459
-
460
- =======
461
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
462
- =======
463
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
464
-
465
- // Extract integration imports - handle both require and import statements
466
- const requireMatches = backendContent.match(/(?:const|let|var)\s+(\w+Integration)\s*=\s*require\(['"]([^'"]+)['"]\)/g) || [];
467
- const importMatches = backendContent.match(/import\s+(?:\*\s+as\s+)?(\w+Integration)\s+from\s+['"]([^'"]+)['"]/g) || [];
468
- const allMatches = [...requireMatches, ...importMatches];
469
-
470
- <<<<<<< HEAD
471
- <<<<<<< HEAD
472
- for (const match of allMatches) {
473
- =======
474
- <<<<<<< HEAD
475
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
476
- for (const match of importMatches) {
477
- =======
478
- for (const match of allMatches) {
479
- >>>>>>> d6114470 (feat: add comprehensive DDD/Hexagonal architecture RFC series)
480
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
481
- =======
482
- for (const match of allMatches) {
483
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
484
- const nameMatch = match.match(/(\w+Integration)/);
485
- if (nameMatch) {
486
- const integrationName = nameMatch[1];
487
- const serviceName = integrationName.replace('Integration', '');
488
- <<<<<<< HEAD
489
- <<<<<<< HEAD
490
-
491
- =======
492
- <<<<<<< HEAD
493
-
494
- =======
495
-
496
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
497
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
498
- =======
499
-
500
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
501
- // Check if this integration is in the integrations array
502
- if (backendContent.includes(integrationName)) {
503
- integrations.push({
504
- name: serviceName.toLowerCase(),
505
- displayName: serviceName,
506
- description: `${serviceName} integration`,
507
- category: detectCategory(serviceName.toLowerCase(), '', []),
508
- installed: true,
509
- status: 'active',
510
- type: 'integration',
511
- className: integrationName,
512
- constructor: {
513
- name: integrationName,
514
- hasConfig: true,
515
- hasOptions: true,
516
- hasModules: true
517
- },
518
- note: 'Parsed from file (dynamic loading failed)'
519
- });
520
- }
521
- }
522
- }
523
- <<<<<<< HEAD
524
- <<<<<<< HEAD
525
-
526
- =======
527
- <<<<<<< HEAD
528
-
529
- =======
530
-
531
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
532
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
533
- =======
534
-
535
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
536
- return integrations;
537
- } catch (error) {
538
- console.error('Error parsing backend file:', error);
539
- return [];
540
- }
541
- }
542
-
543
- <<<<<<< HEAD
544
- <<<<<<< HEAD
545
- =======
546
- <<<<<<< HEAD
547
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
548
- =======
549
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
550
- // List all integrations
551
- router.get('/', async (req, res) => {
552
- try {
553
- const [availableApiModules, installedIntegrations] = await Promise.all([
554
- <<<<<<< HEAD
555
- <<<<<<< HEAD
556
- =======
557
- =======
558
- // List all integrations
559
- router.get('/', async (req, res) => {
560
- try {
561
- const [available, installed] = await Promise.all([
562
- >>>>>>> 652520a5 (Claude Flow RFC related development)
563
- =======
564
- // List all integrations
565
- router.get('/', async (req, res) => {
566
- try {
567
- const [availableApiModules, installedIntegrations] = await Promise.all([
568
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
569
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
570
- =======
571
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
572
- getAvailableIntegrations(),
573
- getInstalledIntegrations()
574
- ]);
575
-
576
- <<<<<<< HEAD
577
- <<<<<<< HEAD
578
- =======
579
- <<<<<<< HEAD
580
- <<<<<<< HEAD
581
- =======
582
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
583
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
584
- =======
585
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
586
- // Format available API modules (not yet integrations)
587
- const formattedAvailable = availableApiModules.map(apiModule => ({
588
- ...apiModule,
589
- displayName: apiModule.name.replace('@friggframework/api-module-', '').replace(/-/g, ' '),
590
- installed: false,
591
- status: 'available',
592
- type: 'api-module' // These are just API modules, not full integrations
593
- }));
594
-
595
- // Actual integrations already properly formatted from appDefinition
596
- const formattedIntegrations = installedIntegrations.map(integration => ({
597
- ...integration,
598
- installed: true,
599
- status: integration.status || 'active'
600
- }));
601
- <<<<<<< HEAD
602
- <<<<<<< HEAD
603
- =======
604
- <<<<<<< HEAD
605
-
606
- res.json({
607
- // Main integrations array contains actual integrations from appDefinition
608
- integrations: formattedIntegrations,
609
-
610
- // Available API modules that could become integrations
611
- availableApiModules: formattedAvailable,
612
-
613
- // Summary counts
614
- total: formattedIntegrations.length + formattedAvailable.length,
615
- activeIntegrations: formattedIntegrations.length,
616
- availableModules: formattedAvailable.length,
617
-
618
- // Metadata about the response
619
- source: 'appDefinition',
620
- message: formattedIntegrations.length > 0
621
- ? `Found ${formattedIntegrations.length} active integrations from backend appDefinition`
622
- : 'No integrations found in backend appDefinition'
623
- =======
624
- // Merge lists
625
- const installedNames = installed.map(i => i.name);
626
- const allIntegrations = [
627
- ...installed,
628
- ...available.filter(a => !installedNames.includes(a.name))
629
- ];
630
-
631
- res.json({
632
- integrations: allIntegrations,
633
- total: allIntegrations.length
634
- >>>>>>> 652520a5 (Claude Flow RFC related development)
635
- =======
636
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
637
- =======
638
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
639
-
640
- res.json({
641
- // Main integrations array contains actual integrations from appDefinition
642
- integrations: formattedIntegrations,
643
-
644
- // Available API modules that could become integrations
645
- availableApiModules: formattedAvailable,
646
-
647
- // Summary counts
648
- total: formattedIntegrations.length + formattedAvailable.length,
649
- activeIntegrations: formattedIntegrations.length,
650
- availableModules: formattedAvailable.length,
651
-
652
- // Metadata about the response
653
- source: 'appDefinition',
654
- message: formattedIntegrations.length > 0
655
- ? `Found ${formattedIntegrations.length} active integrations from backend appDefinition`
656
- : 'No integrations found in backend appDefinition'
657
- <<<<<<< HEAD
658
- <<<<<<< HEAD
659
- =======
660
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
661
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
662
- =======
663
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
664
- });
665
- } catch (error) {
666
- res.status(500).json({
667
- error: error.message,
668
- details: 'Failed to fetch integrations'
669
- });
670
- }
671
- });
672
-
673
- // Install an integration
674
- router.post('/install', async (req, res) => {
675
- const { packageName } = req.body;
676
-
677
- if (!packageName) {
678
- return res.status(400).json({
679
- error: 'Package name is required'
680
- });
681
- }
682
-
683
- try {
684
- // Broadcast installation start
685
- wsHandler.broadcast('integration-install', {
686
- status: 'installing',
687
- packageName,
688
- message: `Installing ${packageName}...`
689
- });
690
-
691
- // Run frigg install command
692
- const { stdout, stderr } = await execAsync(
693
- `npx frigg install ${packageName}`,
694
- { cwd: path.join(process.cwd(), '../../../backend') }
695
- );
696
-
697
- // Broadcast success
698
- wsHandler.broadcast('integration-install', {
699
- status: 'installed',
700
- packageName,
701
- message: `Successfully installed ${packageName}`,
702
- output: stdout
703
- });
704
-
705
- res.json({
706
- status: 'success',
707
- message: `Integration ${packageName} installed successfully`,
708
- output: stdout
709
- });
710
-
711
- } catch (error) {
712
- // Broadcast error
713
- wsHandler.broadcast('integration-install', {
714
- status: 'error',
715
- packageName,
716
- message: `Failed to install ${packageName}`,
717
- error: error.message
718
- });
719
-
720
- res.status(500).json({
721
- error: error.message,
722
- details: 'Failed to install integration',
723
- stderr: error.stderr
724
- });
725
- }
726
- });
727
-
728
- // Configure an integration
729
- router.post('/:integrationName/configure', async (req, res) => {
730
- const { integrationName } = req.params;
731
- const { config } = req.body;
732
-
733
- try {
734
- // This would typically update the integration configuration
735
- // For now, we'll store it in a config file
736
- const configPath = path.join(
737
- process.cwd(),
738
- '../../../backend',
739
- 'config',
740
- 'integrations',
741
- `${integrationName}.json`
742
- );
743
-
744
- await fs.ensureDir(path.dirname(configPath));
745
- await fs.writeJson(configPath, config, { spaces: 2 });
746
-
747
- res.json({
748
- status: 'success',
749
- message: `Configuration saved for ${integrationName}`,
750
- config
751
- });
752
-
753
- } catch (error) {
754
- res.status(500).json({
755
- error: error.message,
756
- details: 'Failed to configure integration'
757
- });
758
- }
759
- });
760
-
761
- // Get integration configuration
762
- router.get('/:integrationName/config', async (req, res) => {
763
- const { integrationName } = req.params;
764
-
765
- try {
766
- const configPath = path.join(
767
- process.cwd(),
768
- '../../../backend',
769
- 'config',
770
- 'integrations',
771
- `${integrationName}.json`
772
- );
773
-
774
- if (await fs.pathExists(configPath)) {
775
- const config = await fs.readJson(configPath);
776
- res.json({ config });
777
- } else {
778
- res.json({ config: {} });
779
- }
780
-
781
- } catch (error) {
782
- res.status(500).json({
783
- error: error.message,
784
- details: 'Failed to read integration configuration'
785
- });
786
- }
787
- });
788
-
789
- // Remove an integration
790
- router.delete('/:integrationName', async (req, res) => {
791
- const { integrationName } = req.params;
792
-
793
- try {
794
- // Broadcast removal start
795
- wsHandler.broadcast('integration-remove', {
796
- status: 'removing',
797
- packageName: integrationName,
798
- message: `Removing ${integrationName}...`
799
- });
800
-
801
- // Remove the package
802
- const { stdout, stderr } = await execAsync(
803
- `npm uninstall ${integrationName}`,
804
- { cwd: path.join(process.cwd(), '../../../backend') }
805
- );
806
-
807
- // Remove config if exists
808
- const configPath = path.join(
809
- process.cwd(),
810
- '../../../backend',
811
- 'config',
812
- 'integrations',
813
- `${integrationName}.json`
814
- );
815
- <<<<<<< HEAD
816
- <<<<<<< HEAD
817
-
818
- =======
819
- <<<<<<< HEAD
820
-
821
- =======
822
-
823
- >>>>>>> 652520a5 (Claude Flow RFC related development)
824
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
825
- =======
826
-
827
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
828
- if (await fs.pathExists(configPath)) {
829
- await fs.remove(configPath);
830
- }
831
-
832
- // Broadcast success
833
- wsHandler.broadcast('integration-remove', {
834
- status: 'removed',
835
- packageName: integrationName,
836
- message: `Successfully removed ${integrationName}`
837
- });
838
-
839
- res.json({
840
- status: 'success',
841
- message: `Integration ${integrationName} removed successfully`
842
- });
843
-
844
- } catch (error) {
845
- // Broadcast error
846
- wsHandler.broadcast('integration-remove', {
847
- status: 'error',
848
- packageName: integrationName,
849
- message: `Failed to remove ${integrationName}`,
850
- error: error.message
851
- });
852
-
853
- res.status(500).json({
854
- error: error.message,
855
- details: 'Failed to remove integration'
856
- });
857
- }
858
- });
859
-
860
- <<<<<<< HEAD
861
- <<<<<<< HEAD
862
- export { getInstalledIntegrations }
863
- =======
864
- <<<<<<< HEAD
865
- <<<<<<< HEAD
866
- export { getInstalledIntegrations }
867
- =======
868
- >>>>>>> 652520a5 (Claude Flow RFC related development)
869
- =======
870
- export { getInstalledIntegrations }
871
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
872
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
873
- =======
874
- export { getInstalledIntegrations }
875
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
876
- export default router