@friggframework/devtools 2.0.0-next.60 → 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,1029 +0,0 @@
1
- import express from 'express'
2
- <<<<<<< HEAD
3
- <<<<<<< HEAD
4
- =======
5
- <<<<<<< HEAD
6
- <<<<<<< HEAD
7
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
8
- =======
9
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
10
- import { spawn, exec } from 'child_process'
11
- import { promisify } from 'util'
12
- import path from 'path'
13
- import fs from 'fs/promises'
14
- import { fileURLToPath } from 'url'
15
- import { createStandardResponse, createErrorResponse, ERROR_CODES, asyncHandler } from '../utils/response.js'
16
- import { analyzeIntegrations } from '../../../frigg-cli/utils/integration-analyzer.js'
17
-
18
- const __filename = fileURLToPath(import.meta.url)
19
- const __dirname = path.dirname(__filename)
20
- const execAsync = promisify(exec)
21
- <<<<<<< HEAD
22
- <<<<<<< HEAD
23
- =======
24
- =======
25
- import { spawn } from 'child_process'
26
- =======
27
- import { spawn, exec } from 'child_process'
28
- import { promisify } from 'util'
29
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
30
- import path from 'path'
31
- import fs from 'fs/promises'
32
- import { fileURLToPath } from 'url'
33
- import { createStandardResponse, createErrorResponse, ERROR_CODES, asyncHandler } from '../utils/response.js'
34
-
35
- <<<<<<< HEAD
36
- >>>>>>> 652520a5 (Claude Flow RFC related development)
37
- =======
38
- const __filename = fileURLToPath(import.meta.url)
39
- const __dirname = path.dirname(__filename)
40
- const execAsync = promisify(exec)
41
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
42
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
43
- =======
44
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
45
- const router = express.Router()
46
-
47
- // Track project process state
48
- let projectProcess = null
49
- let projectStatus = 'stopped'
50
- let projectLogs = []
51
- let projectStartTime = null
52
- const MAX_LOGS = 1000
53
-
54
- /**
55
- * Get current project status and configuration
56
- */
57
- router.get('/status', asyncHandler(async (req, res) => {
58
- const cwd = process.cwd()
59
- let projectInfo = {
60
- name: 'unknown',
61
- version: '0.0.0',
62
- friggVersion: 'unknown'
63
- }
64
-
65
- try {
66
- // Try to read package.json for project info
67
- const packageJsonPath = path.join(cwd, 'package.json')
68
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'))
69
- <<<<<<< HEAD
70
- <<<<<<< HEAD
71
-
72
- =======
73
- <<<<<<< HEAD
74
-
75
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
76
- =======
77
-
78
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
79
- projectInfo = {
80
- name: packageJson.name || 'frigg-project',
81
- version: packageJson.version || '0.0.0',
82
- friggVersion: packageJson.dependencies?.['@friggframework/core'] ||
83
- packageJson.devDependencies?.['@friggframework/core'] || 'unknown'
84
- <<<<<<< HEAD
85
- <<<<<<< HEAD
86
- =======
87
- =======
88
-
89
- projectInfo = {
90
- name: packageJson.name || 'frigg-project',
91
- version: packageJson.version || '0.0.0',
92
- friggVersion: packageJson.dependencies?.['@friggframework/core'] ||
93
- packageJson.devDependencies?.['@friggframework/core'] || 'unknown'
94
- >>>>>>> 652520a5 (Claude Flow RFC related development)
95
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
96
- =======
97
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
98
- }
99
- } catch (error) {
100
- console.warn('Could not read package.json:', error.message)
101
- }
102
-
103
- const statusData = {
104
- ...projectInfo,
105
- status: projectStatus,
106
- pid: projectProcess?.pid || null,
107
- uptime: projectStartTime ? Math.floor((Date.now() - projectStartTime) / 1000) : 0,
108
- port: process.env.PORT || 3000,
109
- environment: process.env.NODE_ENV || 'development',
110
- lastStarted: projectStartTime ? new Date(projectStartTime).toISOString() : null
111
- }
112
-
113
- res.json(createStandardResponse(statusData))
114
- }))
115
-
116
- /**
117
- * Start the Frigg project
118
- */
119
- router.post('/start', asyncHandler(async (req, res) => {
120
- if (projectProcess && projectStatus === 'running') {
121
- return res.status(400).json(
122
- createErrorResponse(ERROR_CODES.PROJECT_ALREADY_RUNNING, 'Project is already running')
123
- )
124
- }
125
-
126
- const { stage = 'dev', verbose = false, port = 3000 } = req.body
127
-
128
- try {
129
- projectStatus = 'starting'
130
- projectLogs = []
131
- <<<<<<< HEAD
132
- <<<<<<< HEAD
133
-
134
- =======
135
- <<<<<<< HEAD
136
-
137
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
138
- // Broadcast status update via WebSocket
139
- const io = req.app.get('io')
140
- if (io) {
141
- io.emit('project:status', {
142
- <<<<<<< HEAD
143
- =======
144
- =======
145
- =======
146
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
147
-
148
- // Broadcast status update via WebSocket
149
- const io = req.app.get('io')
150
- if (io) {
151
- <<<<<<< HEAD
152
- io.emit('project:status', {
153
- >>>>>>> 652520a5 (Claude Flow RFC related development)
154
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
155
- =======
156
- io.emit('project:status', {
157
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
158
- status: 'starting',
159
- message: 'Starting Frigg project...'
160
- })
161
- }
162
-
163
- // Find the project directory (current working directory)
164
- const projectPath = process.cwd()
165
- <<<<<<< HEAD
166
- <<<<<<< HEAD
167
-
168
- =======
169
- <<<<<<< HEAD
170
-
171
- =======
172
-
173
- >>>>>>> 652520a5 (Claude Flow RFC related development)
174
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
175
- =======
176
-
177
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
178
- // Build command arguments
179
- const args = ['run', 'start']
180
- if (stage !== 'dev') {
181
- args.push('--', '--stage', stage)
182
- }
183
- if (verbose) {
184
- args.push('--', '--verbose')
185
- }
186
-
187
- // Set environment variables
188
- const env = {
189
- ...process.env,
190
- NODE_ENV: stage === 'production' ? 'production' : 'development',
191
- PORT: port.toString()
192
- }
193
-
194
- // Start the project process
195
- projectProcess = spawn('npm', args, {
196
- cwd: projectPath,
197
- env,
198
- shell: true,
199
- detached: false
200
- })
201
-
202
- projectStartTime = Date.now()
203
-
204
- // Handle stdout
205
- projectProcess.stdout?.on('data', (data) => {
206
- const log = {
207
- type: 'stdout',
208
- message: data.toString(),
209
- timestamp: new Date().toISOString()
210
- }
211
- projectLogs.push(log)
212
- if (projectLogs.length > MAX_LOGS) {
213
- projectLogs.shift()
214
- }
215
- <<<<<<< HEAD
216
- <<<<<<< HEAD
217
-
218
- =======
219
- <<<<<<< HEAD
220
-
221
- =======
222
-
223
- >>>>>>> 652520a5 (Claude Flow RFC related development)
224
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
225
- =======
226
-
227
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
228
- // Broadcast log via WebSocket
229
- if (io) {
230
- io.emit('project:logs', log)
231
- }
232
- })
233
-
234
- // Handle stderr
235
- projectProcess.stderr?.on('data', (data) => {
236
- const log = {
237
- type: 'stderr',
238
- message: data.toString(),
239
- timestamp: new Date().toISOString()
240
- }
241
- projectLogs.push(log)
242
- if (projectLogs.length > MAX_LOGS) {
243
- projectLogs.shift()
244
- }
245
- <<<<<<< HEAD
246
- <<<<<<< HEAD
247
-
248
- =======
249
- <<<<<<< HEAD
250
-
251
- =======
252
-
253
- >>>>>>> 652520a5 (Claude Flow RFC related development)
254
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
255
- =======
256
-
257
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
258
- // Broadcast log via WebSocket
259
- if (io) {
260
- io.emit('project:logs', log)
261
- }
262
- })
263
-
264
- // Handle process exit
265
- projectProcess.on('exit', (code, signal) => {
266
- const wasRunning = projectStatus === 'running'
267
- projectStatus = 'stopped'
268
- projectProcess = null
269
- projectStartTime = null
270
- <<<<<<< HEAD
271
- <<<<<<< HEAD
272
-
273
- =======
274
- <<<<<<< HEAD
275
-
276
- =======
277
-
278
- >>>>>>> 652520a5 (Claude Flow RFC related development)
279
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
280
- =======
281
-
282
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
283
- const statusUpdate = {
284
- status: 'stopped',
285
- code,
286
- signal,
287
- message: `Project process exited with code ${code}`
288
- }
289
- <<<<<<< HEAD
290
- <<<<<<< HEAD
291
-
292
- =======
293
- <<<<<<< HEAD
294
-
295
- =======
296
-
297
- >>>>>>> 652520a5 (Claude Flow RFC related development)
298
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
299
- =======
300
-
301
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
302
- if (io) {
303
- io.emit('project:status', statusUpdate)
304
- if (wasRunning) {
305
- io.emit('project:error', {
306
- message: 'Project stopped unexpectedly',
307
- code,
308
- signal
309
- })
310
- }
311
- }
312
- })
313
-
314
- // Handle process errors
315
- projectProcess.on('error', (error) => {
316
- projectStatus = 'stopped'
317
- projectProcess = null
318
- projectStartTime = null
319
- <<<<<<< HEAD
320
- <<<<<<< HEAD
321
-
322
- =======
323
- <<<<<<< HEAD
324
-
325
- =======
326
-
327
- >>>>>>> 652520a5 (Claude Flow RFC related development)
328
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
329
- =======
330
-
331
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
332
- if (io) {
333
- io.emit('project:error', {
334
- message: 'Failed to start project',
335
- error: error.message
336
- })
337
- }
338
- })
339
-
340
- // Wait for process to stabilize
341
- await new Promise(resolve => setTimeout(resolve, 2000))
342
-
343
- if (projectProcess && !projectProcess.killed) {
344
- projectStatus = 'running'
345
- <<<<<<< HEAD
346
- <<<<<<< HEAD
347
-
348
- =======
349
- <<<<<<< HEAD
350
-
351
- =======
352
-
353
- >>>>>>> 652520a5 (Claude Flow RFC related development)
354
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
355
- =======
356
-
357
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
358
- if (io) {
359
- io.emit('project:status', {
360
- status: 'running',
361
- message: 'Project started successfully',
362
- pid: projectProcess.pid
363
- })
364
- }
365
-
366
- res.json(createStandardResponse({
367
- message: 'Project started successfully',
368
- pid: projectProcess.pid,
369
- status: 'running'
370
- }))
371
- } else {
372
- throw new Error('Failed to start project process')
373
- }
374
-
375
- } catch (error) {
376
- projectStatus = 'stopped'
377
- projectProcess = null
378
- projectStartTime = null
379
- <<<<<<< HEAD
380
- <<<<<<< HEAD
381
-
382
- =======
383
- <<<<<<< HEAD
384
-
385
- =======
386
-
387
- >>>>>>> 652520a5 (Claude Flow RFC related development)
388
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
389
- =======
390
-
391
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
392
- const io = req.app.get('io')
393
- if (io) {
394
- io.emit('project:status', { status: 'stopped' })
395
- io.emit('project:error', { message: error.message })
396
- }
397
- <<<<<<< HEAD
398
- <<<<<<< HEAD
399
-
400
- =======
401
- <<<<<<< HEAD
402
-
403
- =======
404
-
405
- >>>>>>> 652520a5 (Claude Flow RFC related development)
406
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
407
- =======
408
-
409
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
410
- return res.status(500).json(
411
- createErrorResponse(ERROR_CODES.PROJECT_START_FAILED, error.message)
412
- )
413
- }
414
- }))
415
-
416
- /**
417
- * Stop the Frigg project
418
- */
419
- router.post('/stop', asyncHandler(async (req, res) => {
420
- if (!projectProcess || projectStatus !== 'running') {
421
- return res.status(400).json(
422
- createErrorResponse(ERROR_CODES.PROJECT_NOT_RUNNING, 'Project is not running')
423
- )
424
- }
425
-
426
- try {
427
- projectStatus = 'stopping'
428
- <<<<<<< HEAD
429
- <<<<<<< HEAD
430
-
431
- =======
432
- <<<<<<< HEAD
433
-
434
- =======
435
-
436
- >>>>>>> 652520a5 (Claude Flow RFC related development)
437
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
438
- =======
439
-
440
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
441
- const io = req.app.get('io')
442
- if (io) {
443
- io.emit('project:status', {
444
- status: 'stopping',
445
- message: 'Stopping project...'
446
- })
447
- }
448
-
449
- // Gracefully terminate the process
450
- projectProcess.kill('SIGTERM')
451
-
452
- // Force kill after 5 seconds if still running
453
- setTimeout(() => {
454
- if (projectProcess && !projectProcess.killed) {
455
- projectProcess.kill('SIGKILL')
456
- }
457
- }, 5000)
458
-
459
- res.json(createStandardResponse({
460
- message: 'Project is stopping',
461
- status: 'stopping'
462
- }))
463
-
464
- } catch (error) {
465
- return res.status(500).json(
466
- createErrorResponse(ERROR_CODES.PROJECT_STOP_FAILED, error.message)
467
- )
468
- }
469
- }))
470
-
471
- /**
472
- * Restart the Frigg project
473
- */
474
- router.post('/restart', asyncHandler(async (req, res) => {
475
- try {
476
- // Stop if running
477
- if (projectProcess && projectStatus === 'running') {
478
- projectProcess.kill('SIGTERM')
479
- <<<<<<< HEAD
480
- <<<<<<< HEAD
481
-
482
- =======
483
- <<<<<<< HEAD
484
-
485
- =======
486
-
487
- >>>>>>> 652520a5 (Claude Flow RFC related development)
488
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
489
- =======
490
-
491
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
492
- // Wait for process to exit
493
- await new Promise((resolve) => {
494
- if (projectProcess) {
495
- projectProcess.on('exit', resolve)
496
- } else {
497
- resolve()
498
- }
499
- })
500
- }
501
-
502
- // Wait a moment
503
- await new Promise(resolve => setTimeout(resolve, 1000))
504
-
505
- // Start again - we'll simulate calling the start endpoint
506
- const startResponse = await fetch(`http://localhost:${process.env.PORT || 3001}/api/project/start`, {
507
- method: 'POST',
508
- headers: { 'Content-Type': 'application/json' },
509
- body: JSON.stringify(req.body)
510
- })
511
-
512
- const result = await startResponse.json()
513
- res.json(result)
514
-
515
- } catch (error) {
516
- return res.status(500).json(
517
- createErrorResponse(ERROR_CODES.PROJECT_START_FAILED, error.message)
518
- )
519
- }
520
- }))
521
-
522
- /**
523
- * Get project logs
524
- */
525
- router.get('/logs', asyncHandler(async (req, res) => {
526
- const { limit = 100, type } = req.query
527
- <<<<<<< HEAD
528
- <<<<<<< HEAD
529
- =======
530
- <<<<<<< HEAD
531
-
532
- let logs = projectLogs
533
-
534
- if (type && ['stdout', 'stderr'].includes(type)) {
535
- logs = logs.filter(log => log.type === type)
536
- }
537
-
538
- =======
539
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
540
- =======
541
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
542
-
543
- let logs = projectLogs
544
-
545
- if (type && ['stdout', 'stderr'].includes(type)) {
546
- logs = logs.filter(log => log.type === type)
547
- }
548
-
549
- <<<<<<< HEAD
550
- <<<<<<< HEAD
551
- =======
552
- >>>>>>> 652520a5 (Claude Flow RFC related development)
553
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
554
- =======
555
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
556
- res.json(createStandardResponse({
557
- logs: logs.slice(-parseInt(limit)),
558
- total: logs.length
559
- }))
560
- }))
561
-
562
- /**
563
- * Clear project logs
564
- */
565
- router.delete('/logs', asyncHandler(async (req, res) => {
566
- projectLogs = []
567
- res.json(createStandardResponse({ message: 'Logs cleared' }))
568
- }))
569
-
570
- <<<<<<< HEAD
571
- <<<<<<< HEAD
572
- =======
573
- <<<<<<< HEAD
574
- <<<<<<< HEAD
575
- =======
576
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
577
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
578
- =======
579
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
580
- /**
581
- * Get project metrics
582
- */
583
- router.get('/metrics', asyncHandler(async (req, res) => {
584
- const metrics = {
585
- status: projectStatus,
586
- uptime: projectStartTime ? Math.floor((Date.now() - projectStartTime) / 1000) : 0,
587
- memory: process.memoryUsage(),
588
- cpu: process.cpuUsage(),
589
- logs: {
590
- total: projectLogs.length,
591
- errors: projectLogs.filter(log => log.type === 'stderr').length,
592
- warnings: projectLogs.filter(log => log.message.toLowerCase().includes('warning')).length
593
- }
594
- }
595
- <<<<<<< HEAD
596
- <<<<<<< HEAD
597
-
598
- =======
599
- <<<<<<< HEAD
600
-
601
- =======
602
-
603
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
604
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
605
- =======
606
-
607
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
608
- res.json(createStandardResponse(metrics))
609
- }))
610
-
611
- /**
612
- * Get available Frigg repositories
613
- */
614
- router.get('/repositories', asyncHandler(async (req, res) => {
615
- try {
616
- <<<<<<< HEAD
617
- <<<<<<< HEAD
618
- =======
619
- <<<<<<< HEAD
620
- // Execute the frigg CLI command directly
621
- const friggPath = path.join(__dirname, '../../../frigg-cli/index.js')
622
- const command = `node "${friggPath}" repos list --json`
623
- console.log('Executing command:', command)
624
- console.log('From directory:', process.cwd())
625
- <<<<<<< HEAD
626
-
627
- =======
628
-
629
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
630
- const { stdout, stderr } = await execAsync(command, {
631
- cwd: process.cwd(),
632
- env: process.env,
633
- maxBuffer: 1024 * 1024 * 10 // 10MB buffer for large repo lists
634
- })
635
- <<<<<<< HEAD
636
-
637
- console.log('Command stdout length:', stdout.length)
638
- console.log('Command stderr:', stderr)
639
-
640
- if (stderr && !stderr.includes('DeprecationWarning') && !stderr.includes('NOTE: The AWS SDK')) {
641
- console.error('Repository discovery stderr:', stderr)
642
- }
643
-
644
- =======
645
-
646
- console.log('Command stdout length:', stdout.length)
647
- console.log('Command stderr:', stderr)
648
-
649
- if (stderr && !stderr.includes('DeprecationWarning') && !stderr.includes('NOTE: The AWS SDK')) {
650
- console.error('Repository discovery stderr:', stderr)
651
- }
652
-
653
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
654
- // Parse the JSON output
655
- let repositories = []
656
- try {
657
- // With the --json flag, we should get clean JSON output
658
- repositories = JSON.parse(stdout)
659
- console.log(`Found ${repositories.length} repositories`)
660
- } catch (parseError) {
661
- console.error('Failed to parse repository JSON:', parseError)
662
- console.log('Raw output (first 500 chars):', stdout.substring(0, 500))
663
- =======
664
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
665
- =======
666
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
667
- let repositories = []
668
-
669
- // First, check if we have available repositories from the CLI
670
- if (process.env.AVAILABLE_REPOSITORIES) {
671
- try {
672
- repositories = JSON.parse(process.env.AVAILABLE_REPOSITORIES)
673
- console.log(`Using ${repositories.length} repositories from CLI discovery`)
674
- } catch (parseError) {
675
- console.error('Failed to parse AVAILABLE_REPOSITORIES:', parseError)
676
- }
677
- }
678
-
679
- // If no repositories from CLI, fall back to direct discovery
680
- if (repositories.length === 0) {
681
- console.log('No repositories from CLI, executing discovery command...')
682
- // Execute the frigg CLI command directly
683
- const friggPath = path.join(__dirname, '../../../frigg-cli/index.js')
684
- const command = `node "${friggPath}" repos list --json`
685
- console.log('Executing command:', command)
686
- console.log('From directory:', process.cwd())
687
-
688
- const { stdout, stderr } = await execAsync(command, {
689
- cwd: process.cwd(),
690
- env: process.env,
691
- maxBuffer: 1024 * 1024 * 10 // 10MB buffer for large repo lists
692
- })
693
-
694
- console.log('Command stdout length:', stdout.length)
695
- console.log('Command stderr:', stderr)
696
-
697
- if (stderr && !stderr.includes('DeprecationWarning') && !stderr.includes('NOTE: The AWS SDK')) {
698
- console.error('Repository discovery stderr:', stderr)
699
- }
700
-
701
- // Parse the JSON output
702
- try {
703
- // With the --json flag, we should get clean JSON output
704
- repositories = JSON.parse(stdout)
705
- console.log(`Found ${repositories.length} repositories via command`)
706
- } catch (parseError) {
707
- console.error('Failed to parse repository JSON:', parseError)
708
- console.log('Raw output (first 500 chars):', stdout.substring(0, 500))
709
- }
710
- <<<<<<< HEAD
711
- <<<<<<< HEAD
712
- }
713
-
714
- =======
715
- >>>>>>> 82b75ea9 (feat: major UI package reorganization and cleanup)
716
- }
717
- <<<<<<< HEAD
718
-
719
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
720
- =======
721
- }
722
-
723
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
724
- // Get current repository info
725
- const currentRepo = process.env.REPOSITORY_INFO ?
726
- JSON.parse(process.env.REPOSITORY_INFO) :
727
- await getCurrentRepositoryInfo()
728
- <<<<<<< HEAD
729
- <<<<<<< HEAD
730
-
731
- =======
732
-
733
- =======
734
-
735
- // Get current repository info
736
- const currentRepo = process.env.REPOSITORY_INFO ?
737
- JSON.parse(process.env.REPOSITORY_INFO) :
738
- await getCurrentRepositoryInfo()
739
-
740
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
741
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
742
- =======
743
-
744
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
745
- res.json(createStandardResponse({
746
- repositories,
747
- currentRepository: currentRepo,
748
- isMultiRepo: currentRepo?.isMultiRepo || false
749
- }))
750
- } catch (error) {
751
- console.error('Failed to get repositories:', error)
752
- res.json(createStandardResponse({
753
- repositories: [],
754
- currentRepository: null,
755
- isMultiRepo: false,
756
- error: 'Failed to discover repositories: ' + error.message
757
- }))
758
- }
759
- }))
760
-
761
- /**
762
- * Switch to a different repository
763
- */
764
- router.post('/switch-repository', asyncHandler(async (req, res) => {
765
- const { repositoryPath } = req.body
766
- <<<<<<< HEAD
767
- <<<<<<< HEAD
768
-
769
- =======
770
- <<<<<<< HEAD
771
-
772
- =======
773
-
774
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
775
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
776
- =======
777
-
778
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
779
- if (!repositoryPath) {
780
- return res.status(400).json(
781
- createErrorResponse(ERROR_CODES.VALIDATION_ERROR, 'Repository path is required')
782
- )
783
- }
784
- <<<<<<< HEAD
785
- <<<<<<< HEAD
786
-
787
- =======
788
- <<<<<<< HEAD
789
-
790
- =======
791
-
792
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
793
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
794
- =======
795
-
796
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
797
- try {
798
- // Verify the repository exists and is valid
799
- const stats = await fs.stat(repositoryPath)
800
- if (!stats.isDirectory()) {
801
- throw new Error('Invalid repository path')
802
- }
803
- <<<<<<< HEAD
804
- <<<<<<< HEAD
805
- =======
806
- <<<<<<< HEAD
807
-
808
- // Check if it's a valid Frigg repository
809
- const packageJsonPath = path.join(repositoryPath, 'package.json')
810
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'))
811
-
812
- =======
813
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
814
- =======
815
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
816
-
817
- // Check if it's a valid Frigg repository
818
- const packageJsonPath = path.join(repositoryPath, 'package.json')
819
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'))
820
-
821
- <<<<<<< HEAD
822
- <<<<<<< HEAD
823
- =======
824
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
825
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
826
- =======
827
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
828
- // Update environment variable
829
- process.env.PROJECT_ROOT = repositoryPath
830
- process.env.REPOSITORY_INFO = JSON.stringify({
831
- name: packageJson.name || path.basename(repositoryPath),
832
- path: repositoryPath,
833
- version: packageJson.version
834
- })
835
- <<<<<<< HEAD
836
- <<<<<<< HEAD
837
-
838
- =======
839
- <<<<<<< HEAD
840
-
841
- =======
842
-
843
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
844
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
845
- =======
846
-
847
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
848
- // Stop any running processes
849
- if (projectProcess && projectStatus === 'running') {
850
- projectProcess.kill('SIGTERM')
851
- projectStatus = 'stopped'
852
- projectProcess = null
853
- }
854
- <<<<<<< HEAD
855
- <<<<<<< HEAD
856
-
857
- =======
858
- <<<<<<< HEAD
859
-
860
- =======
861
-
862
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
863
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
864
- =======
865
-
866
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
867
- // Notify via WebSocket
868
- const io = req.app.get('io')
869
- if (io) {
870
- io.emit('repository:switched', {
871
- repository: {
872
- name: packageJson.name,
873
- path: repositoryPath,
874
- version: packageJson.version
875
- }
876
- })
877
- }
878
- <<<<<<< HEAD
879
- <<<<<<< HEAD
880
-
881
- =======
882
- <<<<<<< HEAD
883
-
884
- =======
885
-
886
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
887
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
888
- =======
889
-
890
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
891
- res.json(createStandardResponse({
892
- message: 'Repository switched successfully',
893
- repository: {
894
- name: packageJson.name,
895
- path: repositoryPath,
896
- version: packageJson.version
897
- }
898
- }))
899
- } catch (error) {
900
- return res.status(500).json(
901
- createErrorResponse(ERROR_CODES.INTERNAL_ERROR, 'Failed to switch repository: ' + error.message)
902
- )
903
- }
904
- }))
905
-
906
- /**
907
- * Get current repository information
908
- */
909
- async function getCurrentRepositoryInfo() {
910
- try {
911
- const cwd = process.env.PROJECT_ROOT || process.cwd()
912
- const packageJsonPath = path.join(cwd, 'package.json')
913
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf8'))
914
- <<<<<<< HEAD
915
- <<<<<<< HEAD
916
-
917
- =======
918
- <<<<<<< HEAD
919
-
920
- =======
921
-
922
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
923
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
924
- =======
925
-
926
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
927
- return {
928
- name: packageJson.name || path.basename(cwd),
929
- path: cwd,
930
- version: packageJson.version,
931
- framework: detectFramework(packageJson),
932
- hasBackend: await fs.access(path.join(cwd, 'backend')).then(() => true).catch(() => false)
933
- }
934
- } catch (error) {
935
- return null
936
- }
937
- }
938
-
939
- /**
940
- * Detect framework from package.json
941
- */
942
- function detectFramework(packageJson) {
943
- <<<<<<< HEAD
944
- <<<<<<< HEAD
945
- =======
946
- <<<<<<< HEAD
947
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
948
- =======
949
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
950
- const deps = {
951
- ...packageJson.dependencies,
952
- ...packageJson.devDependencies
953
- }
954
- <<<<<<< HEAD
955
- <<<<<<< HEAD
956
-
957
- =======
958
-
959
- =======
960
- const deps = {
961
- ...packageJson.dependencies,
962
- ...packageJson.devDependencies
963
- }
964
-
965
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
966
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
967
- =======
968
-
969
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
970
- if (deps.react) return 'React'
971
- if (deps.vue) return 'Vue'
972
- if (deps.svelte) return 'Svelte'
973
- if (deps['@angular/core']) return 'Angular'
974
- <<<<<<< HEAD
975
- <<<<<<< HEAD
976
- =======
977
- <<<<<<< HEAD
978
-
979
- return 'Unknown'
980
- }
981
-
982
- =======
983
- >>>>>>> 652520a5 (Claude Flow RFC related development)
984
- =======
985
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
986
- =======
987
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
988
-
989
- return 'Unknown'
990
- }
991
-
992
- <<<<<<< HEAD
993
- <<<<<<< HEAD
994
- =======
995
- <<<<<<< HEAD
996
- >>>>>>> f153939e (refactor: clean up CLI help display and remove unused dependencies)
997
- =======
998
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
999
- =======
1000
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
1001
- /**
1002
- * Analyze project integrations
1003
- */
1004
- router.get('/analyze-integrations', asyncHandler(async (req, res) => {
1005
- try {
1006
- const projectPath = process.env.PROJECT_ROOT || process.cwd()
1007
- const analysis = await analyzeIntegrations(projectPath)
1008
-
1009
- res.json(createStandardResponse({
1010
- analysis,
1011
- projectPath,
1012
- timestamp: new Date().toISOString()
1013
- }))
1014
- } catch (error) {
1015
- console.error('Integration analysis failed:', error)
1016
- return res.status(500).json(
1017
- createErrorResponse(ERROR_CODES.INTERNAL_ERROR, 'Failed to analyze integrations: ' + error.message)
1018
- )
1019
- }
1020
- }))
1021
-
1022
- <<<<<<< HEAD
1023
- <<<<<<< HEAD
1024
- =======
1025
- >>>>>>> 82b75ea9 (feat: major UI package reorganization and cleanup)
1026
- >>>>>>> 860052b4 (feat: integrate complete management-ui and additional features)
1027
- =======
1028
- >>>>>>> 7e97f01c (fix: resolve ui-command merge conflicts and update package.json)
1029
- export default router