create-fluxstack 1.0.5 → 1.0.6

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 (406) hide show
  1. package/.claude/settings.local.json +2 -1
  2. package/create-fluxstack.ts +1 -0
  3. package/package.json +1 -1
  4. package/ENV_TESTING_REPORT.md +0 -292
  5. package/FRAMEWORK_ROADMAP.md +0 -183
  6. package/FRONTEND_TESTS_README.md +0 -287
  7. package/TEST_RESULTS.md +0 -130
  8. package/docs/dynamic-environment-variables.md +0 -380
  9. package/examples/dynamic-env-usage.ts +0 -283
  10. package/examples/hybrid-env-strategy.ts +0 -212
  11. package/examples/simplified-env-usage.ts +0 -251
  12. package/meu-app-teste/README.md +0 -44
  13. package/meu-app-teste/app/client/README.md +0 -69
  14. package/meu-app-teste/app/client/frontend-only.ts +0 -12
  15. package/meu-app-teste/app/client/index.html +0 -13
  16. package/meu-app-teste/app/client/public/vite.svg +0 -1
  17. package/meu-app-teste/app/client/src/App.css +0 -883
  18. package/meu-app-teste/app/client/src/App.tsx +0 -669
  19. package/meu-app-teste/app/client/src/assets/react.svg +0 -1
  20. package/meu-app-teste/app/client/src/components/TestPage.tsx +0 -453
  21. package/meu-app-teste/app/client/src/index.css +0 -51
  22. package/meu-app-teste/app/client/src/lib/eden-api.ts +0 -110
  23. package/meu-app-teste/app/client/src/main.tsx +0 -10
  24. package/meu-app-teste/app/client/src/vite-env.d.ts +0 -1
  25. package/meu-app-teste/app/client/tsconfig.app.json +0 -43
  26. package/meu-app-teste/app/client/tsconfig.json +0 -7
  27. package/meu-app-teste/app/client/tsconfig.node.json +0 -25
  28. package/meu-app-teste/app/server/app.ts +0 -10
  29. package/meu-app-teste/app/server/backend-only.ts +0 -15
  30. package/meu-app-teste/app/server/controllers/users.controller.ts +0 -69
  31. package/meu-app-teste/app/server/index.ts +0 -104
  32. package/meu-app-teste/app/server/routes/index.ts +0 -25
  33. package/meu-app-teste/app/server/routes/users.routes.ts +0 -121
  34. package/meu-app-teste/app/server/types/index.ts +0 -1
  35. package/meu-app-teste/app/shared/types/index.ts +0 -18
  36. package/meu-app-teste/bun.lock +0 -1053
  37. package/meu-app-teste/core/__tests__/integration.test.ts +0 -227
  38. package/meu-app-teste/core/build/index.ts +0 -186
  39. package/meu-app-teste/core/cli/command-registry.ts +0 -334
  40. package/meu-app-teste/core/cli/index.ts +0 -394
  41. package/meu-app-teste/core/cli/plugin-discovery.ts +0 -200
  42. package/meu-app-teste/core/client/standalone.ts +0 -57
  43. package/meu-app-teste/core/config/__tests__/config-loader.test.ts +0 -591
  44. package/meu-app-teste/core/config/__tests__/config-merger.test.ts +0 -657
  45. package/meu-app-teste/core/config/__tests__/env-converter.test.ts +0 -372
  46. package/meu-app-teste/core/config/__tests__/env-processor.test.ts +0 -431
  47. package/meu-app-teste/core/config/__tests__/env.test.ts +0 -452
  48. package/meu-app-teste/core/config/__tests__/integration.test.ts +0 -418
  49. package/meu-app-teste/core/config/__tests__/loader.test.ts +0 -331
  50. package/meu-app-teste/core/config/__tests__/schema.test.ts +0 -129
  51. package/meu-app-teste/core/config/__tests__/validator.test.ts +0 -318
  52. package/meu-app-teste/core/config/env-dynamic.ts +0 -326
  53. package/meu-app-teste/core/config/env.ts +0 -597
  54. package/meu-app-teste/core/config/index.ts +0 -317
  55. package/meu-app-teste/core/config/loader.ts +0 -546
  56. package/meu-app-teste/core/config/runtime-config.ts +0 -322
  57. package/meu-app-teste/core/config/schema.ts +0 -694
  58. package/meu-app-teste/core/config/validator.ts +0 -540
  59. package/meu-app-teste/core/framework/__tests__/server.test.ts +0 -233
  60. package/meu-app-teste/core/framework/client.ts +0 -132
  61. package/meu-app-teste/core/framework/index.ts +0 -8
  62. package/meu-app-teste/core/framework/server.ts +0 -501
  63. package/meu-app-teste/core/framework/types.ts +0 -63
  64. package/meu-app-teste/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  65. package/meu-app-teste/core/plugins/__tests__/manager.test.ts +0 -398
  66. package/meu-app-teste/core/plugins/__tests__/monitoring.test.ts +0 -401
  67. package/meu-app-teste/core/plugins/__tests__/registry.test.ts +0 -335
  68. package/meu-app-teste/core/plugins/built-in/index.ts +0 -142
  69. package/meu-app-teste/core/plugins/built-in/logger/index.ts +0 -180
  70. package/meu-app-teste/core/plugins/built-in/monitoring/README.md +0 -193
  71. package/meu-app-teste/core/plugins/built-in/monitoring/index.ts +0 -912
  72. package/meu-app-teste/core/plugins/built-in/static/index.ts +0 -289
  73. package/meu-app-teste/core/plugins/built-in/swagger/index.ts +0 -229
  74. package/meu-app-teste/core/plugins/built-in/vite/index.ts +0 -316
  75. package/meu-app-teste/core/plugins/config.ts +0 -348
  76. package/meu-app-teste/core/plugins/discovery.ts +0 -350
  77. package/meu-app-teste/core/plugins/executor.ts +0 -351
  78. package/meu-app-teste/core/plugins/index.ts +0 -195
  79. package/meu-app-teste/core/plugins/manager.ts +0 -583
  80. package/meu-app-teste/core/plugins/registry.ts +0 -424
  81. package/meu-app-teste/core/plugins/types.ts +0 -254
  82. package/meu-app-teste/core/server/framework.ts +0 -123
  83. package/meu-app-teste/core/server/index.ts +0 -8
  84. package/meu-app-teste/core/server/plugins/database.ts +0 -182
  85. package/meu-app-teste/core/server/plugins/logger.ts +0 -47
  86. package/meu-app-teste/core/server/plugins/swagger.ts +0 -34
  87. package/meu-app-teste/core/server/standalone.ts +0 -91
  88. package/meu-app-teste/core/templates/create-project.ts +0 -455
  89. package/meu-app-teste/core/types/api.ts +0 -169
  90. package/meu-app-teste/core/types/build.ts +0 -174
  91. package/meu-app-teste/core/types/config.ts +0 -68
  92. package/meu-app-teste/core/types/index.ts +0 -127
  93. package/meu-app-teste/core/types/plugin.ts +0 -94
  94. package/meu-app-teste/core/utils/__tests__/errors.test.ts +0 -139
  95. package/meu-app-teste/core/utils/__tests__/helpers.test.ts +0 -297
  96. package/meu-app-teste/core/utils/__tests__/logger.test.ts +0 -141
  97. package/meu-app-teste/core/utils/env-runtime-v2.ts +0 -232
  98. package/meu-app-teste/core/utils/env-runtime.ts +0 -252
  99. package/meu-app-teste/core/utils/errors/codes.ts +0 -115
  100. package/meu-app-teste/core/utils/errors/handlers.ts +0 -63
  101. package/meu-app-teste/core/utils/errors/index.ts +0 -81
  102. package/meu-app-teste/core/utils/helpers.ts +0 -180
  103. package/meu-app-teste/core/utils/index.ts +0 -18
  104. package/meu-app-teste/core/utils/logger/index.ts +0 -161
  105. package/meu-app-teste/core/utils/logger.ts +0 -106
  106. package/meu-app-teste/core/utils/monitoring/index.ts +0 -212
  107. package/meu-app-teste/package.json +0 -92
  108. package/meu-app-teste/tsconfig.json +0 -51
  109. package/meu-app-teste/vite.config.ts +0 -42
  110. package/my-final-test/README.md +0 -44
  111. package/my-final-test/app/client/README.md +0 -69
  112. package/my-final-test/app/client/frontend-only.ts +0 -12
  113. package/my-final-test/app/client/index.html +0 -13
  114. package/my-final-test/app/client/public/vite.svg +0 -1
  115. package/my-final-test/app/client/src/App.css +0 -883
  116. package/my-final-test/app/client/src/App.tsx +0 -669
  117. package/my-final-test/app/client/src/assets/react.svg +0 -1
  118. package/my-final-test/app/client/src/components/TestPage.tsx +0 -453
  119. package/my-final-test/app/client/src/index.css +0 -51
  120. package/my-final-test/app/client/src/lib/eden-api.ts +0 -110
  121. package/my-final-test/app/client/src/main.tsx +0 -10
  122. package/my-final-test/app/client/src/vite-env.d.ts +0 -1
  123. package/my-final-test/app/client/tsconfig.app.json +0 -43
  124. package/my-final-test/app/client/tsconfig.json +0 -7
  125. package/my-final-test/app/client/tsconfig.node.json +0 -25
  126. package/my-final-test/app/server/app.ts +0 -10
  127. package/my-final-test/app/server/backend-only.ts +0 -15
  128. package/my-final-test/app/server/controllers/users.controller.ts +0 -69
  129. package/my-final-test/app/server/index.ts +0 -104
  130. package/my-final-test/app/server/routes/index.ts +0 -25
  131. package/my-final-test/app/server/routes/users.routes.ts +0 -121
  132. package/my-final-test/app/server/types/index.ts +0 -1
  133. package/my-final-test/app/shared/types/index.ts +0 -18
  134. package/my-final-test/bun.lock +0 -993
  135. package/my-final-test/core/__tests__/integration.test.ts +0 -227
  136. package/my-final-test/core/build/index.ts +0 -186
  137. package/my-final-test/core/cli/command-registry.ts +0 -334
  138. package/my-final-test/core/cli/index.ts +0 -394
  139. package/my-final-test/core/cli/plugin-discovery.ts +0 -200
  140. package/my-final-test/core/client/standalone.ts +0 -57
  141. package/my-final-test/core/config/__tests__/config-loader.test.ts +0 -591
  142. package/my-final-test/core/config/__tests__/config-merger.test.ts +0 -657
  143. package/my-final-test/core/config/__tests__/env-converter.test.ts +0 -372
  144. package/my-final-test/core/config/__tests__/env-processor.test.ts +0 -431
  145. package/my-final-test/core/config/__tests__/env.test.ts +0 -452
  146. package/my-final-test/core/config/__tests__/integration.test.ts +0 -418
  147. package/my-final-test/core/config/__tests__/loader.test.ts +0 -331
  148. package/my-final-test/core/config/__tests__/schema.test.ts +0 -129
  149. package/my-final-test/core/config/__tests__/validator.test.ts +0 -318
  150. package/my-final-test/core/config/env-dynamic.ts +0 -326
  151. package/my-final-test/core/config/env.ts +0 -597
  152. package/my-final-test/core/config/index.ts +0 -317
  153. package/my-final-test/core/config/loader.ts +0 -546
  154. package/my-final-test/core/config/runtime-config.ts +0 -322
  155. package/my-final-test/core/config/schema.ts +0 -694
  156. package/my-final-test/core/config/validator.ts +0 -540
  157. package/my-final-test/core/framework/__tests__/server.test.ts +0 -233
  158. package/my-final-test/core/framework/client.ts +0 -132
  159. package/my-final-test/core/framework/index.ts +0 -8
  160. package/my-final-test/core/framework/server.ts +0 -501
  161. package/my-final-test/core/framework/types.ts +0 -63
  162. package/my-final-test/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  163. package/my-final-test/core/plugins/__tests__/manager.test.ts +0 -398
  164. package/my-final-test/core/plugins/__tests__/monitoring.test.ts +0 -401
  165. package/my-final-test/core/plugins/__tests__/registry.test.ts +0 -335
  166. package/my-final-test/core/plugins/built-in/index.ts +0 -142
  167. package/my-final-test/core/plugins/built-in/logger/index.ts +0 -180
  168. package/my-final-test/core/plugins/built-in/monitoring/README.md +0 -193
  169. package/my-final-test/core/plugins/built-in/monitoring/index.ts +0 -912
  170. package/my-final-test/core/plugins/built-in/static/index.ts +0 -289
  171. package/my-final-test/core/plugins/built-in/swagger/index.ts +0 -229
  172. package/my-final-test/core/plugins/built-in/vite/index.ts +0 -316
  173. package/my-final-test/core/plugins/config.ts +0 -348
  174. package/my-final-test/core/plugins/discovery.ts +0 -350
  175. package/my-final-test/core/plugins/executor.ts +0 -351
  176. package/my-final-test/core/plugins/index.ts +0 -195
  177. package/my-final-test/core/plugins/manager.ts +0 -583
  178. package/my-final-test/core/plugins/registry.ts +0 -424
  179. package/my-final-test/core/plugins/types.ts +0 -254
  180. package/my-final-test/core/server/framework.ts +0 -123
  181. package/my-final-test/core/server/index.ts +0 -8
  182. package/my-final-test/core/server/plugins/database.ts +0 -182
  183. package/my-final-test/core/server/plugins/logger.ts +0 -47
  184. package/my-final-test/core/server/plugins/swagger.ts +0 -34
  185. package/my-final-test/core/server/standalone.ts +0 -91
  186. package/my-final-test/core/templates/create-project.ts +0 -455
  187. package/my-final-test/core/types/api.ts +0 -169
  188. package/my-final-test/core/types/build.ts +0 -174
  189. package/my-final-test/core/types/config.ts +0 -68
  190. package/my-final-test/core/types/index.ts +0 -127
  191. package/my-final-test/core/types/plugin.ts +0 -94
  192. package/my-final-test/core/utils/__tests__/errors.test.ts +0 -139
  193. package/my-final-test/core/utils/__tests__/helpers.test.ts +0 -297
  194. package/my-final-test/core/utils/__tests__/logger.test.ts +0 -141
  195. package/my-final-test/core/utils/env-runtime-v2.ts +0 -232
  196. package/my-final-test/core/utils/env-runtime.ts +0 -252
  197. package/my-final-test/core/utils/errors/codes.ts +0 -115
  198. package/my-final-test/core/utils/errors/handlers.ts +0 -63
  199. package/my-final-test/core/utils/errors/index.ts +0 -81
  200. package/my-final-test/core/utils/helpers.ts +0 -180
  201. package/my-final-test/core/utils/index.ts +0 -18
  202. package/my-final-test/core/utils/logger/index.ts +0 -161
  203. package/my-final-test/core/utils/logger.ts +0 -106
  204. package/my-final-test/core/utils/monitoring/index.ts +0 -212
  205. package/my-final-test/package.json +0 -68
  206. package/my-final-test/tsconfig.json +0 -51
  207. package/my-final-test/vite.config.ts +0 -42
  208. package/publish-setup.md +0 -111
  209. package/teste-corrigido/README.md +0 -44
  210. package/teste-corrigido/app/client/README.md +0 -69
  211. package/teste-corrigido/app/client/frontend-only.ts +0 -12
  212. package/teste-corrigido/app/client/index.html +0 -13
  213. package/teste-corrigido/app/client/public/vite.svg +0 -1
  214. package/teste-corrigido/app/client/src/App.css +0 -883
  215. package/teste-corrigido/app/client/src/App.tsx +0 -669
  216. package/teste-corrigido/app/client/src/assets/react.svg +0 -1
  217. package/teste-corrigido/app/client/src/components/TestPage.tsx +0 -453
  218. package/teste-corrigido/app/client/src/index.css +0 -51
  219. package/teste-corrigido/app/client/src/lib/eden-api.ts +0 -110
  220. package/teste-corrigido/app/client/src/main.tsx +0 -10
  221. package/teste-corrigido/app/client/src/vite-env.d.ts +0 -1
  222. package/teste-corrigido/app/client/tsconfig.app.json +0 -43
  223. package/teste-corrigido/app/client/tsconfig.json +0 -7
  224. package/teste-corrigido/app/client/tsconfig.node.json +0 -25
  225. package/teste-corrigido/app/server/app.ts +0 -10
  226. package/teste-corrigido/app/server/backend-only.ts +0 -15
  227. package/teste-corrigido/app/server/controllers/users.controller.ts +0 -69
  228. package/teste-corrigido/app/server/index.ts +0 -104
  229. package/teste-corrigido/app/server/routes/index.ts +0 -25
  230. package/teste-corrigido/app/server/routes/users.routes.ts +0 -121
  231. package/teste-corrigido/app/server/types/index.ts +0 -1
  232. package/teste-corrigido/app/shared/types/index.ts +0 -18
  233. package/teste-corrigido/bun.lock +0 -1053
  234. package/teste-corrigido/core/__tests__/integration.test.ts +0 -227
  235. package/teste-corrigido/core/build/index.ts +0 -186
  236. package/teste-corrigido/core/cli/command-registry.ts +0 -334
  237. package/teste-corrigido/core/cli/index.ts +0 -394
  238. package/teste-corrigido/core/cli/plugin-discovery.ts +0 -200
  239. package/teste-corrigido/core/client/standalone.ts +0 -57
  240. package/teste-corrigido/core/config/__tests__/config-loader.test.ts +0 -591
  241. package/teste-corrigido/core/config/__tests__/config-merger.test.ts +0 -657
  242. package/teste-corrigido/core/config/__tests__/env-converter.test.ts +0 -372
  243. package/teste-corrigido/core/config/__tests__/env-processor.test.ts +0 -431
  244. package/teste-corrigido/core/config/__tests__/env.test.ts +0 -452
  245. package/teste-corrigido/core/config/__tests__/integration.test.ts +0 -418
  246. package/teste-corrigido/core/config/__tests__/loader.test.ts +0 -331
  247. package/teste-corrigido/core/config/__tests__/schema.test.ts +0 -129
  248. package/teste-corrigido/core/config/__tests__/validator.test.ts +0 -318
  249. package/teste-corrigido/core/config/env-dynamic.ts +0 -326
  250. package/teste-corrigido/core/config/env.ts +0 -597
  251. package/teste-corrigido/core/config/index.ts +0 -317
  252. package/teste-corrigido/core/config/loader.ts +0 -546
  253. package/teste-corrigido/core/config/runtime-config.ts +0 -322
  254. package/teste-corrigido/core/config/schema.ts +0 -694
  255. package/teste-corrigido/core/config/validator.ts +0 -540
  256. package/teste-corrigido/core/framework/__tests__/server.test.ts +0 -233
  257. package/teste-corrigido/core/framework/client.ts +0 -132
  258. package/teste-corrigido/core/framework/index.ts +0 -8
  259. package/teste-corrigido/core/framework/server.ts +0 -501
  260. package/teste-corrigido/core/framework/types.ts +0 -63
  261. package/teste-corrigido/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  262. package/teste-corrigido/core/plugins/__tests__/manager.test.ts +0 -398
  263. package/teste-corrigido/core/plugins/__tests__/monitoring.test.ts +0 -401
  264. package/teste-corrigido/core/plugins/__tests__/registry.test.ts +0 -335
  265. package/teste-corrigido/core/plugins/built-in/index.ts +0 -142
  266. package/teste-corrigido/core/plugins/built-in/logger/index.ts +0 -180
  267. package/teste-corrigido/core/plugins/built-in/monitoring/README.md +0 -193
  268. package/teste-corrigido/core/plugins/built-in/monitoring/index.ts +0 -912
  269. package/teste-corrigido/core/plugins/built-in/static/index.ts +0 -289
  270. package/teste-corrigido/core/plugins/built-in/swagger/index.ts +0 -229
  271. package/teste-corrigido/core/plugins/built-in/vite/index.ts +0 -316
  272. package/teste-corrigido/core/plugins/config.ts +0 -348
  273. package/teste-corrigido/core/plugins/discovery.ts +0 -350
  274. package/teste-corrigido/core/plugins/executor.ts +0 -351
  275. package/teste-corrigido/core/plugins/index.ts +0 -195
  276. package/teste-corrigido/core/plugins/manager.ts +0 -583
  277. package/teste-corrigido/core/plugins/registry.ts +0 -424
  278. package/teste-corrigido/core/plugins/types.ts +0 -254
  279. package/teste-corrigido/core/server/framework.ts +0 -123
  280. package/teste-corrigido/core/server/index.ts +0 -8
  281. package/teste-corrigido/core/server/plugins/database.ts +0 -182
  282. package/teste-corrigido/core/server/plugins/logger.ts +0 -47
  283. package/teste-corrigido/core/server/plugins/swagger.ts +0 -34
  284. package/teste-corrigido/core/server/standalone.ts +0 -91
  285. package/teste-corrigido/core/templates/create-project.ts +0 -455
  286. package/teste-corrigido/core/types/api.ts +0 -169
  287. package/teste-corrigido/core/types/build.ts +0 -174
  288. package/teste-corrigido/core/types/config.ts +0 -68
  289. package/teste-corrigido/core/types/index.ts +0 -127
  290. package/teste-corrigido/core/types/plugin.ts +0 -94
  291. package/teste-corrigido/core/utils/__tests__/errors.test.ts +0 -139
  292. package/teste-corrigido/core/utils/__tests__/helpers.test.ts +0 -297
  293. package/teste-corrigido/core/utils/__tests__/logger.test.ts +0 -141
  294. package/teste-corrigido/core/utils/env-runtime-v2.ts +0 -232
  295. package/teste-corrigido/core/utils/env-runtime.ts +0 -252
  296. package/teste-corrigido/core/utils/errors/codes.ts +0 -115
  297. package/teste-corrigido/core/utils/errors/handlers.ts +0 -63
  298. package/teste-corrigido/core/utils/errors/index.ts +0 -81
  299. package/teste-corrigido/core/utils/helpers.ts +0 -180
  300. package/teste-corrigido/core/utils/index.ts +0 -18
  301. package/teste-corrigido/core/utils/logger/index.ts +0 -161
  302. package/teste-corrigido/core/utils/logger.ts +0 -106
  303. package/teste-corrigido/core/utils/monitoring/index.ts +0 -212
  304. package/teste-corrigido/package-template.json +0 -51
  305. package/teste-corrigido/package.json +0 -51
  306. package/teste-corrigido/tsconfig.json +0 -51
  307. package/teste-corrigido/vite.config.ts +0 -42
  308. package/teste-final-npm/README.md +0 -44
  309. package/teste-final-npm/app/client/README.md +0 -69
  310. package/teste-final-npm/app/client/frontend-only.ts +0 -12
  311. package/teste-final-npm/app/client/index.html +0 -13
  312. package/teste-final-npm/app/client/public/vite.svg +0 -1
  313. package/teste-final-npm/app/client/src/App.css +0 -883
  314. package/teste-final-npm/app/client/src/App.tsx +0 -669
  315. package/teste-final-npm/app/client/src/assets/react.svg +0 -1
  316. package/teste-final-npm/app/client/src/components/TestPage.tsx +0 -453
  317. package/teste-final-npm/app/client/src/index.css +0 -51
  318. package/teste-final-npm/app/client/src/lib/eden-api.ts +0 -110
  319. package/teste-final-npm/app/client/src/main.tsx +0 -10
  320. package/teste-final-npm/app/client/src/vite-env.d.ts +0 -1
  321. package/teste-final-npm/app/client/tsconfig.app.json +0 -43
  322. package/teste-final-npm/app/client/tsconfig.json +0 -7
  323. package/teste-final-npm/app/client/tsconfig.node.json +0 -25
  324. package/teste-final-npm/app/server/app.ts +0 -10
  325. package/teste-final-npm/app/server/backend-only.ts +0 -15
  326. package/teste-final-npm/app/server/controllers/users.controller.ts +0 -69
  327. package/teste-final-npm/app/server/index.ts +0 -104
  328. package/teste-final-npm/app/server/routes/index.ts +0 -25
  329. package/teste-final-npm/app/server/routes/users.routes.ts +0 -121
  330. package/teste-final-npm/app/server/types/index.ts +0 -1
  331. package/teste-final-npm/app/shared/types/index.ts +0 -18
  332. package/teste-final-npm/bun.lock +0 -1053
  333. package/teste-final-npm/core/__tests__/integration.test.ts +0 -227
  334. package/teste-final-npm/core/build/index.ts +0 -186
  335. package/teste-final-npm/core/cli/command-registry.ts +0 -334
  336. package/teste-final-npm/core/cli/index.ts +0 -394
  337. package/teste-final-npm/core/cli/plugin-discovery.ts +0 -200
  338. package/teste-final-npm/core/client/standalone.ts +0 -57
  339. package/teste-final-npm/core/config/__tests__/config-loader.test.ts +0 -591
  340. package/teste-final-npm/core/config/__tests__/config-merger.test.ts +0 -657
  341. package/teste-final-npm/core/config/__tests__/env-converter.test.ts +0 -372
  342. package/teste-final-npm/core/config/__tests__/env-processor.test.ts +0 -431
  343. package/teste-final-npm/core/config/__tests__/env.test.ts +0 -452
  344. package/teste-final-npm/core/config/__tests__/integration.test.ts +0 -418
  345. package/teste-final-npm/core/config/__tests__/loader.test.ts +0 -331
  346. package/teste-final-npm/core/config/__tests__/schema.test.ts +0 -129
  347. package/teste-final-npm/core/config/__tests__/validator.test.ts +0 -318
  348. package/teste-final-npm/core/config/env-dynamic.ts +0 -326
  349. package/teste-final-npm/core/config/env.ts +0 -597
  350. package/teste-final-npm/core/config/index.ts +0 -317
  351. package/teste-final-npm/core/config/loader.ts +0 -546
  352. package/teste-final-npm/core/config/runtime-config.ts +0 -322
  353. package/teste-final-npm/core/config/schema.ts +0 -694
  354. package/teste-final-npm/core/config/validator.ts +0 -540
  355. package/teste-final-npm/core/framework/__tests__/server.test.ts +0 -233
  356. package/teste-final-npm/core/framework/client.ts +0 -132
  357. package/teste-final-npm/core/framework/index.ts +0 -8
  358. package/teste-final-npm/core/framework/server.ts +0 -501
  359. package/teste-final-npm/core/framework/types.ts +0 -63
  360. package/teste-final-npm/core/plugins/__tests__/built-in.test.ts.disabled +0 -366
  361. package/teste-final-npm/core/plugins/__tests__/manager.test.ts +0 -398
  362. package/teste-final-npm/core/plugins/__tests__/monitoring.test.ts +0 -401
  363. package/teste-final-npm/core/plugins/__tests__/registry.test.ts +0 -335
  364. package/teste-final-npm/core/plugins/built-in/index.ts +0 -142
  365. package/teste-final-npm/core/plugins/built-in/logger/index.ts +0 -180
  366. package/teste-final-npm/core/plugins/built-in/monitoring/README.md +0 -193
  367. package/teste-final-npm/core/plugins/built-in/monitoring/index.ts +0 -912
  368. package/teste-final-npm/core/plugins/built-in/static/index.ts +0 -289
  369. package/teste-final-npm/core/plugins/built-in/swagger/index.ts +0 -229
  370. package/teste-final-npm/core/plugins/built-in/vite/index.ts +0 -316
  371. package/teste-final-npm/core/plugins/config.ts +0 -348
  372. package/teste-final-npm/core/plugins/discovery.ts +0 -350
  373. package/teste-final-npm/core/plugins/executor.ts +0 -351
  374. package/teste-final-npm/core/plugins/index.ts +0 -195
  375. package/teste-final-npm/core/plugins/manager.ts +0 -583
  376. package/teste-final-npm/core/plugins/registry.ts +0 -424
  377. package/teste-final-npm/core/plugins/types.ts +0 -254
  378. package/teste-final-npm/core/server/framework.ts +0 -123
  379. package/teste-final-npm/core/server/index.ts +0 -8
  380. package/teste-final-npm/core/server/plugins/database.ts +0 -182
  381. package/teste-final-npm/core/server/plugins/logger.ts +0 -47
  382. package/teste-final-npm/core/server/plugins/swagger.ts +0 -34
  383. package/teste-final-npm/core/server/standalone.ts +0 -91
  384. package/teste-final-npm/core/templates/create-project.ts +0 -455
  385. package/teste-final-npm/core/types/api.ts +0 -169
  386. package/teste-final-npm/core/types/build.ts +0 -174
  387. package/teste-final-npm/core/types/config.ts +0 -68
  388. package/teste-final-npm/core/types/index.ts +0 -127
  389. package/teste-final-npm/core/types/plugin.ts +0 -94
  390. package/teste-final-npm/core/utils/__tests__/errors.test.ts +0 -139
  391. package/teste-final-npm/core/utils/__tests__/helpers.test.ts +0 -297
  392. package/teste-final-npm/core/utils/__tests__/logger.test.ts +0 -141
  393. package/teste-final-npm/core/utils/env-runtime-v2.ts +0 -232
  394. package/teste-final-npm/core/utils/env-runtime.ts +0 -252
  395. package/teste-final-npm/core/utils/errors/codes.ts +0 -115
  396. package/teste-final-npm/core/utils/errors/handlers.ts +0 -63
  397. package/teste-final-npm/core/utils/errors/index.ts +0 -81
  398. package/teste-final-npm/core/utils/helpers.ts +0 -180
  399. package/teste-final-npm/core/utils/index.ts +0 -18
  400. package/teste-final-npm/core/utils/logger/index.ts +0 -161
  401. package/teste-final-npm/core/utils/logger.ts +0 -106
  402. package/teste-final-npm/core/utils/monitoring/index.ts +0 -212
  403. package/teste-final-npm/package-template.json +0 -51
  404. package/teste-final-npm/package.json +0 -51
  405. package/teste-final-npm/tsconfig.json +0 -51
  406. package/teste-final-npm/vite.config.ts +0 -42
@@ -1,350 +0,0 @@
1
- /**
2
- * Plugin Discovery System
3
- * Handles automatic discovery and loading of plugins from various sources
4
- */
5
-
6
- import type { Plugin, PluginManifest, PluginLoadResult, PluginDiscoveryOptions } from "./types"
7
- import type { Logger } from "../utils/logger/index"
8
- import { readdir, readFile } from "fs/promises"
9
- import { join, resolve } from "path"
10
- import { existsSync } from "fs"
11
-
12
- export interface PluginDiscoveryConfig {
13
- logger?: Logger
14
- baseDir?: string
15
- builtInDir?: string
16
- externalDir?: string
17
- nodeModulesDir?: string
18
- }
19
-
20
- export class PluginDiscovery {
21
- private logger?: Logger
22
- private baseDir: string
23
- private builtInDir: string
24
- private externalDir: string
25
- private nodeModulesDir: string
26
-
27
- constructor(config: PluginDiscoveryConfig = {}) {
28
- this.logger = config.logger
29
- this.baseDir = config.baseDir || process.cwd()
30
- this.builtInDir = config.builtInDir || join(this.baseDir, 'core/plugins/built-in')
31
- this.externalDir = config.externalDir || join(this.baseDir, 'plugins')
32
- this.nodeModulesDir = config.nodeModulesDir || join(this.baseDir, 'node_modules')
33
- }
34
-
35
- /**
36
- * Discover all available plugins
37
- */
38
- async discoverAll(options: PluginDiscoveryOptions = {}): Promise<PluginLoadResult[]> {
39
- const results: PluginLoadResult[] = []
40
- const {
41
- includeBuiltIn = true,
42
- includeExternal = true
43
- } = options
44
-
45
- // Discover built-in plugins
46
- if (includeBuiltIn) {
47
- const builtInResults = await this.discoverBuiltInPlugins()
48
- results.push(...builtInResults)
49
- }
50
-
51
- // Discover external plugins
52
- if (includeExternal) {
53
- const externalResults = await this.discoverExternalPlugins()
54
- results.push(...externalResults)
55
-
56
- const npmResults = await this.discoverNpmPlugins()
57
- results.push(...npmResults)
58
- }
59
-
60
- return results
61
- }
62
-
63
- /**
64
- * Discover built-in plugins
65
- */
66
- async discoverBuiltInPlugins(): Promise<PluginLoadResult[]> {
67
- if (!existsSync(this.builtInDir)) {
68
- this.logger?.debug('Built-in plugins directory not found', { dir: this.builtInDir })
69
- return []
70
- }
71
-
72
- return this.discoverPluginsInDirectory(this.builtInDir, 'built-in')
73
- }
74
-
75
- /**
76
- * Discover external plugins in the plugins directory
77
- */
78
- async discoverExternalPlugins(): Promise<PluginLoadResult[]> {
79
- if (!existsSync(this.externalDir)) {
80
- this.logger?.debug('External plugins directory not found', { dir: this.externalDir })
81
- return []
82
- }
83
-
84
- return this.discoverPluginsInDirectory(this.externalDir, 'external')
85
- }
86
-
87
- /**
88
- * Discover npm-installed plugins
89
- */
90
- async discoverNpmPlugins(): Promise<PluginLoadResult[]> {
91
- if (!existsSync(this.nodeModulesDir)) {
92
- this.logger?.debug('Node modules directory not found', { dir: this.nodeModulesDir })
93
- return []
94
- }
95
-
96
- const results: PluginLoadResult[] = []
97
-
98
- try {
99
- const entries = await readdir(this.nodeModulesDir, { withFileTypes: true })
100
-
101
- for (const entry of entries) {
102
- if (entry.isDirectory() && entry.name.startsWith('fluxstack-plugin-')) {
103
- const pluginDir = join(this.nodeModulesDir, entry.name)
104
- const result = await this.loadPluginFromDirectory(pluginDir, 'npm')
105
- results.push(result)
106
- }
107
- }
108
- } catch (error) {
109
- this.logger?.error('Failed to discover npm plugins', { error })
110
- }
111
-
112
- return results
113
- }
114
-
115
- /**
116
- * Load a specific plugin by name
117
- */
118
- async loadPlugin(name: string): Promise<PluginLoadResult> {
119
- // Try built-in first
120
- const builtInPath = join(this.builtInDir, name)
121
- if (existsSync(builtInPath)) {
122
- return this.loadPluginFromDirectory(builtInPath, 'built-in')
123
- }
124
-
125
- // Try external plugins
126
- const externalPath = join(this.externalDir, name)
127
- if (existsSync(externalPath)) {
128
- return this.loadPluginFromDirectory(externalPath, 'external')
129
- }
130
-
131
- // Try npm plugins
132
- const npmPath = join(this.nodeModulesDir, `fluxstack-plugin-${name}`)
133
- if (existsSync(npmPath)) {
134
- return this.loadPluginFromDirectory(npmPath, 'npm')
135
- }
136
-
137
- return {
138
- success: false,
139
- error: `Plugin '${name}' not found in any plugin directory`
140
- }
141
- }
142
-
143
- /**
144
- * Discover plugins in a specific directory
145
- */
146
- private async discoverPluginsInDirectory(
147
- directory: string,
148
- source: 'built-in' | 'external' | 'npm'
149
- ): Promise<PluginLoadResult[]> {
150
- const results: PluginLoadResult[] = []
151
-
152
- try {
153
- const entries = await readdir(directory, { withFileTypes: true })
154
-
155
- for (const entry of entries) {
156
- if (entry.isDirectory()) {
157
- const pluginDir = join(directory, entry.name)
158
- const result = await this.loadPluginFromDirectory(pluginDir, source)
159
- results.push(result)
160
- }
161
- }
162
- } catch (error) {
163
- this.logger?.error(`Failed to discover plugins in directory '${directory}'`, { error })
164
- results.push({
165
- success: false,
166
- error: `Failed to scan directory: ${error instanceof Error ? error.message : String(error)}`
167
- })
168
- }
169
-
170
- return results
171
- }
172
-
173
- /**
174
- * Load a plugin from a specific directory
175
- */
176
- private async loadPluginFromDirectory(
177
- pluginDir: string,
178
- source: 'built-in' | 'external' | 'npm'
179
- ): Promise<PluginLoadResult> {
180
- try {
181
- // Load manifest if it exists
182
- const manifest = await this.loadPluginManifest(pluginDir)
183
-
184
- // Find the main plugin file
185
- const pluginFile = await this.findPluginFile(pluginDir)
186
- if (!pluginFile) {
187
- return {
188
- success: false,
189
- error: 'No plugin entry point found (index.ts, index.js, plugin.ts, or plugin.js)'
190
- }
191
- }
192
-
193
- // Import the plugin
194
- const pluginModule = await import(resolve(pluginFile))
195
- const plugin: Plugin = pluginModule.default || pluginModule
196
-
197
- if (!this.isValidPlugin(plugin)) {
198
- return {
199
- success: false,
200
- error: 'Invalid plugin: must export a plugin object with a name property'
201
- }
202
- }
203
-
204
- // Validate manifest compatibility
205
- const warnings: string[] = []
206
- if (manifest) {
207
- const manifestWarnings = this.validateManifestCompatibility(plugin, manifest)
208
- warnings.push(...manifestWarnings)
209
- } else {
210
- warnings.push('No plugin manifest found')
211
- }
212
-
213
- this.logger?.debug(`Loaded plugin '${plugin.name}' from ${source}`, {
214
- plugin: plugin.name,
215
- version: plugin.version,
216
- source,
217
- path: pluginDir
218
- })
219
-
220
- return {
221
- success: true,
222
- plugin,
223
- warnings
224
- }
225
- } catch (error) {
226
- this.logger?.error(`Failed to load plugin from '${pluginDir}'`, { error })
227
- return {
228
- success: false,
229
- error: error instanceof Error ? error.message : String(error)
230
- }
231
- }
232
- }
233
-
234
- /**
235
- * Load plugin manifest from directory
236
- */
237
- private async loadPluginManifest(pluginDir: string): Promise<PluginManifest | undefined> {
238
- const manifestPath = join(pluginDir, 'plugin.json')
239
-
240
- if (!existsSync(manifestPath)) {
241
- // Try package.json for npm plugins
242
- const packagePath = join(pluginDir, 'package.json')
243
- if (existsSync(packagePath)) {
244
- try {
245
- const packageContent = await readFile(packagePath, 'utf-8')
246
- const packageJson = JSON.parse(packageContent)
247
-
248
- if (packageJson.fluxstack) {
249
- return {
250
- name: packageJson.name,
251
- version: packageJson.version,
252
- description: packageJson.description || '',
253
- author: packageJson.author || '',
254
- license: packageJson.license || '',
255
- homepage: packageJson.homepage,
256
- repository: packageJson.repository,
257
- keywords: packageJson.keywords || [],
258
- dependencies: packageJson.dependencies || {},
259
- peerDependencies: packageJson.peerDependencies,
260
- fluxstack: packageJson.fluxstack
261
- }
262
- }
263
- } catch (error) {
264
- this.logger?.warn(`Failed to parse package.json in '${pluginDir}'`, { error })
265
- }
266
- }
267
- return undefined
268
- }
269
-
270
- try {
271
- const manifestContent = await readFile(manifestPath, 'utf-8')
272
- return JSON.parse(manifestContent)
273
- } catch (error) {
274
- this.logger?.warn(`Failed to parse plugin manifest in '${pluginDir}'`, { error })
275
- return undefined
276
- }
277
- }
278
-
279
- /**
280
- * Find the main plugin file in a directory
281
- */
282
- private async findPluginFile(pluginDir: string): Promise<string | null> {
283
- const possibleFiles = [
284
- 'index.ts',
285
- 'index.js',
286
- 'plugin.ts',
287
- 'plugin.js',
288
- 'src/index.ts',
289
- 'src/index.js',
290
- 'dist/index.js'
291
- ]
292
-
293
- for (const file of possibleFiles) {
294
- const filePath = join(pluginDir, file)
295
- if (existsSync(filePath)) {
296
- return filePath
297
- }
298
- }
299
-
300
- return null
301
- }
302
-
303
- /**
304
- * Validate if an object is a valid plugin
305
- */
306
- private isValidPlugin(plugin: any): plugin is Plugin {
307
- return (
308
- plugin &&
309
- typeof plugin === 'object' &&
310
- typeof plugin.name === 'string' &&
311
- plugin.name.length > 0
312
- )
313
- }
314
-
315
- /**
316
- * Validate manifest compatibility with plugin
317
- */
318
- private validateManifestCompatibility(plugin: Plugin, manifest: PluginManifest): string[] {
319
- const warnings: string[] = []
320
-
321
- if (plugin.name !== manifest.name) {
322
- warnings.push(`Plugin name mismatch: plugin exports '${plugin.name}' but manifest declares '${manifest.name}'`)
323
- }
324
-
325
- if (plugin.version && plugin.version !== manifest.version) {
326
- warnings.push(`Plugin version mismatch: plugin exports '${plugin.version}' but manifest declares '${manifest.version}'`)
327
- }
328
-
329
- if (plugin.dependencies && manifest.fluxstack.hooks) {
330
- // Check if plugin implements the hooks declared in manifest
331
- const declaredHooks = manifest.fluxstack.hooks
332
- const implementedHooks = Object.keys(plugin).filter(key =>
333
- key.startsWith('on') || key === 'setup'
334
- )
335
-
336
- for (const hook of declaredHooks) {
337
- if (!implementedHooks.includes(hook)) {
338
- warnings.push(`Plugin declares hook '${hook}' in manifest but doesn't implement it`)
339
- }
340
- }
341
- }
342
-
343
- return warnings
344
- }
345
- }
346
-
347
- /**
348
- * Default plugin discovery instance
349
- */
350
- export const pluginDiscovery = new PluginDiscovery()
@@ -1,351 +0,0 @@
1
- /**
2
- * Plugin Executor
3
- * Handles plugin execution with priority and dependency resolution
4
- */
5
-
6
- import type {
7
- Plugin,
8
- PluginHook,
9
- PluginHookResult,
10
- PluginPriority,
11
- HookExecutionOptions
12
- } from "./types"
13
- import type { Logger } from "../utils/logger/index"
14
- import { FluxStackError } from "../utils/errors"
15
-
16
- export interface PluginExecutionPlan {
17
- hook: PluginHook
18
- plugins: PluginExecutionStep[]
19
- parallel: boolean
20
- totalPlugins: number
21
- }
22
-
23
- export interface PluginExecutionStep {
24
- plugin: Plugin
25
- priority: number
26
- dependencies: string[]
27
- dependents: string[]
28
- canExecuteInParallel: boolean
29
- }
30
-
31
- export class PluginExecutor {
32
- private logger: Logger
33
-
34
- constructor(logger: Logger) {
35
- this.logger = logger
36
- }
37
-
38
- /**
39
- * Create execution plan for a hook
40
- */
41
- createExecutionPlan(
42
- plugins: Plugin[],
43
- hook: PluginHook,
44
- options: HookExecutionOptions = {}
45
- ): PluginExecutionPlan {
46
- const { parallel = false } = options
47
-
48
- // Filter plugins that implement this hook
49
- const applicablePlugins = plugins.filter(plugin => {
50
- const hookFunction = plugin[hook]
51
- return hookFunction && typeof hookFunction === 'function'
52
- })
53
-
54
- // Create execution steps
55
- const steps = applicablePlugins.map(plugin => this.createExecutionStep(plugin, plugins))
56
-
57
- // Sort by priority and dependencies
58
- const sortedSteps = this.sortExecutionSteps(steps, hook)
59
-
60
- return {
61
- hook,
62
- plugins: sortedSteps,
63
- parallel,
64
- totalPlugins: applicablePlugins.length
65
- }
66
- }
67
-
68
- /**
69
- * Execute plugins according to plan
70
- */
71
- async executePlan(
72
- plan: PluginExecutionPlan,
73
- context: any,
74
- executor: (plugin: Plugin, hook: PluginHook, context: any) => Promise<PluginHookResult>
75
- ): Promise<PluginHookResult[]> {
76
- const results: PluginHookResult[] = []
77
-
78
- this.logger.debug(`Executing plan for hook '${plan.hook}'`, {
79
- hook: plan.hook,
80
- totalPlugins: plan.totalPlugins,
81
- parallel: plan.parallel
82
- })
83
-
84
- if (plan.parallel) {
85
- // Execute in parallel groups based on dependencies
86
- const groups = this.createParallelGroups(plan.plugins)
87
-
88
- for (const group of groups) {
89
- const groupPromises = group.map(step =>
90
- executor(step.plugin, plan.hook, context)
91
- )
92
-
93
- const groupResults = await Promise.allSettled(groupPromises)
94
-
95
- for (let i = 0; i < groupResults.length; i++) {
96
- const result = groupResults[i]
97
- if (result.status === 'fulfilled') {
98
- results.push(result.value)
99
- } else {
100
- results.push({
101
- success: false,
102
- error: result.reason,
103
- duration: 0,
104
- plugin: group[i].plugin.name,
105
- hook: plan.hook
106
- })
107
- }
108
- }
109
- }
110
- } else {
111
- // Execute sequentially
112
- for (const step of plan.plugins) {
113
- const result = await executor(step.plugin, plan.hook, context)
114
- results.push(result)
115
- }
116
- }
117
-
118
- return results
119
- }
120
-
121
- /**
122
- * Validate execution plan
123
- */
124
- validateExecutionPlan(plan: PluginExecutionPlan): { valid: boolean; errors: string[] } {
125
- const errors: string[] = []
126
-
127
- // Check for circular dependencies
128
- const visited = new Set<string>()
129
- const visiting = new Set<string>()
130
-
131
- const checkCircular = (step: PluginExecutionStep) => {
132
- if (visiting.has(step.plugin.name)) {
133
- errors.push(`Circular dependency detected involving plugin '${step.plugin.name}'`)
134
- return
135
- }
136
-
137
- if (visited.has(step.plugin.name)) {
138
- return
139
- }
140
-
141
- visiting.add(step.plugin.name)
142
-
143
- for (const depName of step.dependencies) {
144
- const depStep = plan.plugins.find(s => s.plugin.name === depName)
145
- if (depStep) {
146
- checkCircular(depStep)
147
- }
148
- }
149
-
150
- visiting.delete(step.plugin.name)
151
- visited.add(step.plugin.name)
152
- }
153
-
154
- for (const step of plan.plugins) {
155
- checkCircular(step)
156
- }
157
-
158
- // Check for missing dependencies
159
- for (const step of plan.plugins) {
160
- for (const depName of step.dependencies) {
161
- const depExists = plan.plugins.some(s => s.plugin.name === depName)
162
- if (!depExists) {
163
- errors.push(`Plugin '${step.plugin.name}' depends on '${depName}' which is not available`)
164
- }
165
- }
166
- }
167
-
168
- return {
169
- valid: errors.length === 0,
170
- errors
171
- }
172
- }
173
-
174
- /**
175
- * Create execution step for a plugin
176
- */
177
- private createExecutionStep(plugin: Plugin, allPlugins: Plugin[]): PluginExecutionStep {
178
- const priority = this.normalizePriority(plugin.priority)
179
- const dependencies = plugin.dependencies || []
180
-
181
- // Find dependents
182
- const dependents = allPlugins
183
- .filter(p => p.dependencies?.includes(plugin.name))
184
- .map(p => p.name)
185
-
186
- // Determine if can execute in parallel
187
- const canExecuteInParallel = dependencies.length === 0
188
-
189
- return {
190
- plugin,
191
- priority,
192
- dependencies,
193
- dependents,
194
- canExecuteInParallel
195
- }
196
- }
197
-
198
- /**
199
- * Sort execution steps by priority and dependencies
200
- */
201
- private sortExecutionSteps(steps: PluginExecutionStep[], hook: PluginHook): PluginExecutionStep[] {
202
- // Topological sort with priority consideration
203
- const sorted: PluginExecutionStep[] = []
204
- const visited = new Set<string>()
205
- const visiting = new Set<string>()
206
-
207
- const visit = (step: PluginExecutionStep) => {
208
- if (visiting.has(step.plugin.name)) {
209
- throw new FluxStackError(
210
- `Circular dependency detected involving plugin '${step.plugin.name}' for hook '${hook}'`,
211
- 'CIRCULAR_DEPENDENCY',
212
- 400
213
- )
214
- }
215
-
216
- if (visited.has(step.plugin.name)) {
217
- return
218
- }
219
-
220
- visiting.add(step.plugin.name)
221
-
222
- // Visit dependencies first
223
- for (const depName of step.dependencies) {
224
- const depStep = steps.find(s => s.plugin.name === depName)
225
- if (depStep) {
226
- visit(depStep)
227
- }
228
- }
229
-
230
- visiting.delete(step.plugin.name)
231
- visited.add(step.plugin.name)
232
- sorted.push(step)
233
- }
234
-
235
- // Sort by priority first, then visit
236
- const prioritySorted = [...steps].sort((a, b) => b.priority - a.priority)
237
-
238
- for (const step of prioritySorted) {
239
- visit(step)
240
- }
241
-
242
- return sorted
243
- }
244
-
245
- /**
246
- * Create parallel execution groups
247
- */
248
- private createParallelGroups(steps: PluginExecutionStep[]): PluginExecutionStep[][] {
249
- const groups: PluginExecutionStep[][] = []
250
- const processed = new Set<string>()
251
-
252
- while (processed.size < steps.length) {
253
- const currentGroup: PluginExecutionStep[] = []
254
-
255
- for (const step of steps) {
256
- if (processed.has(step.plugin.name)) {
257
- continue
258
- }
259
-
260
- // Check if all dependencies are already processed
261
- const canExecute = step.dependencies.every(dep => processed.has(dep))
262
-
263
- if (canExecute) {
264
- currentGroup.push(step)
265
- processed.add(step.plugin.name)
266
- }
267
- }
268
-
269
- if (currentGroup.length === 0) {
270
- // This shouldn't happen if dependencies are valid
271
- const remaining = steps.filter(s => !processed.has(s.plugin.name))
272
- throw new FluxStackError(
273
- `Unable to resolve dependencies for plugins: ${remaining.map(s => s.plugin.name).join(', ')}`,
274
- 'DEPENDENCY_RESOLUTION_ERROR',
275
- 400
276
- )
277
- }
278
-
279
- // Sort group by priority
280
- currentGroup.sort((a, b) => b.priority - a.priority)
281
- groups.push(currentGroup)
282
- }
283
-
284
- return groups
285
- }
286
-
287
- /**
288
- * Normalize plugin priority to numeric value
289
- */
290
- private normalizePriority(priority?: number | PluginPriority): number {
291
- if (typeof priority === 'number') {
292
- return priority
293
- }
294
-
295
- switch (priority) {
296
- case 'highest': return 1000
297
- case 'high': return 750
298
- case 'normal': return 500
299
- case 'low': return 250
300
- case 'lowest': return 0
301
- default: return 500 // default to normal
302
- }
303
- }
304
- }
305
-
306
- /**
307
- * Plugin execution statistics
308
- */
309
- export interface PluginExecutionStats {
310
- totalPlugins: number
311
- successfulPlugins: number
312
- failedPlugins: number
313
- totalDuration: number
314
- averageDuration: number
315
- slowestPlugin: { name: string; duration: number } | null
316
- fastestPlugin: { name: string; duration: number } | null
317
- }
318
-
319
- /**
320
- * Calculate execution statistics
321
- */
322
- export function calculateExecutionStats(results: PluginHookResult[]): PluginExecutionStats {
323
- const totalPlugins = results.length
324
- const successfulPlugins = results.filter(r => r.success).length
325
- const failedPlugins = totalPlugins - successfulPlugins
326
- const totalDuration = results.reduce((sum, r) => sum + r.duration, 0)
327
- const averageDuration = totalPlugins > 0 ? totalDuration / totalPlugins : 0
328
-
329
- let slowestPlugin: { name: string; duration: number } | null = null
330
- let fastestPlugin: { name: string; duration: number } | null = null
331
-
332
- for (const result of results) {
333
- if (!slowestPlugin || result.duration > slowestPlugin.duration) {
334
- slowestPlugin = { name: result.plugin, duration: result.duration }
335
- }
336
-
337
- if (!fastestPlugin || result.duration < fastestPlugin.duration) {
338
- fastestPlugin = { name: result.plugin, duration: result.duration }
339
- }
340
- }
341
-
342
- return {
343
- totalPlugins,
344
- successfulPlugins,
345
- failedPlugins,
346
- totalDuration,
347
- averageDuration,
348
- slowestPlugin,
349
- fastestPlugin
350
- }
351
- }