@walkeros/cli 0.4.2 → 0.5.1-next.0

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 (350) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/README.md +140 -9
  3. package/dist/examples/README.md +13 -1
  4. package/dist/examples/flow-order-complete.json +1 -2
  5. package/dist/examples/flow-simple.json +1 -2
  6. package/dist/examples/server-collect.json +4 -4
  7. package/dist/index.d.ts +1 -114
  8. package/dist/index.js +322 -387
  9. package/dist/index.js.map +1 -1
  10. package/examples/README.md +13 -1
  11. package/examples/flow-order-complete.json +1 -2
  12. package/examples/flow-simple.json +1 -2
  13. package/examples/server-collect.json +4 -4
  14. package/package.json +14 -16
  15. package/dist/__tests__/bundle/bundler-helpers.test.d.ts +0 -2
  16. package/dist/__tests__/bundle/bundler-helpers.test.d.ts.map +0 -1
  17. package/dist/__tests__/bundle/bundler-helpers.test.js +0 -285
  18. package/dist/__tests__/bundle/bundler-helpers.test.js.map +0 -1
  19. package/dist/__tests__/bundle/bundler.test.d.ts +0 -2
  20. package/dist/__tests__/bundle/bundler.test.d.ts.map +0 -1
  21. package/dist/__tests__/bundle/bundler.test.js +0 -293
  22. package/dist/__tests__/bundle/bundler.test.js.map +0 -1
  23. package/dist/__tests__/bundle/programmatic.test.d.ts +0 -2
  24. package/dist/__tests__/bundle/programmatic.test.d.ts.map +0 -1
  25. package/dist/__tests__/bundle/programmatic.test.js +0 -150
  26. package/dist/__tests__/bundle/programmatic.test.js.map +0 -1
  27. package/dist/__tests__/bundle/serializer.test.d.ts +0 -2
  28. package/dist/__tests__/bundle/serializer.test.d.ts.map +0 -1
  29. package/dist/__tests__/bundle/serializer.test.js +0 -173
  30. package/dist/__tests__/bundle/serializer.test.js.map +0 -1
  31. package/dist/__tests__/bundle/template-engine.test.d.ts +0 -2
  32. package/dist/__tests__/bundle/template-engine.test.d.ts.map +0 -1
  33. package/dist/__tests__/bundle/template-engine.test.js +0 -107
  34. package/dist/__tests__/bundle/template-engine.test.js.map +0 -1
  35. package/dist/__tests__/cli-e2e.test.d.ts +0 -8
  36. package/dist/__tests__/cli-e2e.test.d.ts.map +0 -1
  37. package/dist/__tests__/cli-e2e.test.js +0 -130
  38. package/dist/__tests__/cli-e2e.test.js.map +0 -1
  39. package/dist/__tests__/cli.test.d.ts +0 -2
  40. package/dist/__tests__/cli.test.d.ts.map +0 -1
  41. package/dist/__tests__/cli.test.js +0 -180
  42. package/dist/__tests__/cli.test.js.map +0 -1
  43. package/dist/__tests__/config-loader.test.d.ts +0 -7
  44. package/dist/__tests__/config-loader.test.d.ts.map +0 -1
  45. package/dist/__tests__/config-loader.test.js +0 -416
  46. package/dist/__tests__/config-loader.test.js.map +0 -1
  47. package/dist/__tests__/core/build-cache.test.d.ts +0 -2
  48. package/dist/__tests__/core/build-cache.test.d.ts.map +0 -1
  49. package/dist/__tests__/core/build-cache.test.js +0 -55
  50. package/dist/__tests__/core/build-cache.test.js.map +0 -1
  51. package/dist/__tests__/core/cache-utils.test.d.ts +0 -2
  52. package/dist/__tests__/core/cache-utils.test.d.ts.map +0 -1
  53. package/dist/__tests__/core/cache-utils.test.js +0 -70
  54. package/dist/__tests__/core/cache-utils.test.js.map +0 -1
  55. package/dist/__tests__/core/config.test.d.ts +0 -2
  56. package/dist/__tests__/core/config.test.d.ts.map +0 -1
  57. package/dist/__tests__/core/config.test.js +0 -72
  58. package/dist/__tests__/core/config.test.js.map +0 -1
  59. package/dist/__tests__/core/logger.test.d.ts +0 -2
  60. package/dist/__tests__/core/logger.test.d.ts.map +0 -1
  61. package/dist/__tests__/core/logger.test.js +0 -53
  62. package/dist/__tests__/core/logger.test.js.map +0 -1
  63. package/dist/__tests__/integration/bundle-run.integration.test.d.ts +0 -8
  64. package/dist/__tests__/integration/bundle-run.integration.test.d.ts.map +0 -1
  65. package/dist/__tests__/integration/bundle-run.integration.test.js +0 -54
  66. package/dist/__tests__/integration/bundle-run.integration.test.js.map +0 -1
  67. package/dist/__tests__/push/push.test.d.ts +0 -7
  68. package/dist/__tests__/push/push.test.d.ts.map +0 -1
  69. package/dist/__tests__/push/push.test.js +0 -197
  70. package/dist/__tests__/push/push.test.js.map +0 -1
  71. package/dist/__tests__/simulate/env-loader.test.d.ts +0 -2
  72. package/dist/__tests__/simulate/env-loader.test.d.ts.map +0 -1
  73. package/dist/__tests__/simulate/env-loader.test.js +0 -47
  74. package/dist/__tests__/simulate/env-loader.test.js.map +0 -1
  75. package/dist/__tests__/simulate/node-executor.test.d.ts +0 -5
  76. package/dist/__tests__/simulate/node-executor.test.d.ts.map +0 -1
  77. package/dist/__tests__/simulate/node-executor.test.js +0 -25
  78. package/dist/__tests__/simulate/node-executor.test.js.map +0 -1
  79. package/dist/__tests__/simulate/server-simulate.integration.test.d.ts +0 -5
  80. package/dist/__tests__/simulate/server-simulate.integration.test.d.ts.map +0 -1
  81. package/dist/__tests__/simulate/server-simulate.integration.test.js +0 -59
  82. package/dist/__tests__/simulate/server-simulate.integration.test.js.map +0 -1
  83. package/dist/__tests__/smoke/production.smoke.test.d.ts +0 -8
  84. package/dist/__tests__/smoke/production.smoke.test.d.ts.map +0 -1
  85. package/dist/__tests__/smoke/production.smoke.test.js +0 -65
  86. package/dist/__tests__/smoke/production.smoke.test.js.map +0 -1
  87. package/dist/commands/bundle/bundler.d.ts +0 -14
  88. package/dist/commands/bundle/bundler.d.ts.map +0 -1
  89. package/dist/commands/bundle/bundler.js +0 -467
  90. package/dist/commands/bundle/bundler.js.map +0 -1
  91. package/dist/commands/bundle/index.d.ts +0 -57
  92. package/dist/commands/bundle/index.d.ts.map +0 -1
  93. package/dist/commands/bundle/index.js +0 -200
  94. package/dist/commands/bundle/index.js.map +0 -1
  95. package/dist/commands/bundle/package-manager.d.ts +0 -8
  96. package/dist/commands/bundle/package-manager.d.ts.map +0 -1
  97. package/dist/commands/bundle/package-manager.js +0 -197
  98. package/dist/commands/bundle/package-manager.js.map +0 -1
  99. package/dist/commands/bundle/serializer.d.ts +0 -23
  100. package/dist/commands/bundle/serializer.d.ts.map +0 -1
  101. package/dist/commands/bundle/serializer.js +0 -127
  102. package/dist/commands/bundle/serializer.js.map +0 -1
  103. package/dist/commands/bundle/stats.d.ts +0 -23
  104. package/dist/commands/bundle/stats.d.ts.map +0 -1
  105. package/dist/commands/bundle/stats.js +0 -52
  106. package/dist/commands/bundle/stats.js.map +0 -1
  107. package/dist/commands/bundle/template-engine.d.ts +0 -20
  108. package/dist/commands/bundle/template-engine.d.ts.map +0 -1
  109. package/dist/commands/bundle/template-engine.js +0 -54
  110. package/dist/commands/bundle/template-engine.js.map +0 -1
  111. package/dist/commands/cache.d.ts +0 -3
  112. package/dist/commands/cache.d.ts.map +0 -1
  113. package/dist/commands/cache.js +0 -44
  114. package/dist/commands/cache.js.map +0 -1
  115. package/dist/commands/push/index.d.ts +0 -7
  116. package/dist/commands/push/index.d.ts.map +0 -1
  117. package/dist/commands/push/index.js +0 -257
  118. package/dist/commands/push/index.js.map +0 -1
  119. package/dist/commands/push/types.d.ts +0 -21
  120. package/dist/commands/push/types.d.ts.map +0 -1
  121. package/dist/commands/push/types.js +0 -2
  122. package/dist/commands/push/types.js.map +0 -1
  123. package/dist/commands/run/__tests__/run.integration.test.d.ts +0 -8
  124. package/dist/commands/run/__tests__/run.integration.test.d.ts.map +0 -1
  125. package/dist/commands/run/__tests__/run.integration.test.js +0 -52
  126. package/dist/commands/run/__tests__/run.integration.test.js.map +0 -1
  127. package/dist/commands/run/__tests__/validators.test.d.ts +0 -2
  128. package/dist/commands/run/__tests__/validators.test.d.ts.map +0 -1
  129. package/dist/commands/run/__tests__/validators.test.js +0 -80
  130. package/dist/commands/run/__tests__/validators.test.js.map +0 -1
  131. package/dist/commands/run/execution.d.ts +0 -14
  132. package/dist/commands/run/execution.d.ts.map +0 -1
  133. package/dist/commands/run/execution.js +0 -37
  134. package/dist/commands/run/execution.js.map +0 -1
  135. package/dist/commands/run/index.d.ts +0 -39
  136. package/dist/commands/run/index.d.ts.map +0 -1
  137. package/dist/commands/run/index.js +0 -191
  138. package/dist/commands/run/index.js.map +0 -1
  139. package/dist/commands/run/types.d.ts +0 -60
  140. package/dist/commands/run/types.d.ts.map +0 -1
  141. package/dist/commands/run/types.js +0 -7
  142. package/dist/commands/run/types.js.map +0 -1
  143. package/dist/commands/run/utils.d.ts +0 -29
  144. package/dist/commands/run/utils.d.ts.map +0 -1
  145. package/dist/commands/run/utils.js +0 -52
  146. package/dist/commands/run/utils.js.map +0 -1
  147. package/dist/commands/run/validators.d.ts +0 -33
  148. package/dist/commands/run/validators.d.ts.map +0 -1
  149. package/dist/commands/run/validators.js +0 -58
  150. package/dist/commands/run/validators.js.map +0 -1
  151. package/dist/commands/simulate/env-loader.d.ts +0 -19
  152. package/dist/commands/simulate/env-loader.d.ts.map +0 -1
  153. package/dist/commands/simulate/env-loader.js +0 -46
  154. package/dist/commands/simulate/env-loader.js.map +0 -1
  155. package/dist/commands/simulate/index.d.ts +0 -48
  156. package/dist/commands/simulate/index.d.ts.map +0 -1
  157. package/dist/commands/simulate/index.js +0 -116
  158. package/dist/commands/simulate/index.js.map +0 -1
  159. package/dist/commands/simulate/jsdom-executor.d.ts +0 -37
  160. package/dist/commands/simulate/jsdom-executor.d.ts.map +0 -1
  161. package/dist/commands/simulate/jsdom-executor.js +0 -137
  162. package/dist/commands/simulate/jsdom-executor.js.map +0 -1
  163. package/dist/commands/simulate/node-executor.d.ts +0 -28
  164. package/dist/commands/simulate/node-executor.d.ts.map +0 -1
  165. package/dist/commands/simulate/node-executor.js +0 -94
  166. package/dist/commands/simulate/node-executor.js.map +0 -1
  167. package/dist/commands/simulate/simulator.d.ts +0 -14
  168. package/dist/commands/simulate/simulator.d.ts.map +0 -1
  169. package/dist/commands/simulate/simulator.js +0 -162
  170. package/dist/commands/simulate/simulator.js.map +0 -1
  171. package/dist/commands/simulate/tracker.d.ts +0 -30
  172. package/dist/commands/simulate/tracker.d.ts.map +0 -1
  173. package/dist/commands/simulate/tracker.js +0 -96
  174. package/dist/commands/simulate/tracker.js.map +0 -1
  175. package/dist/commands/simulate/types.d.ts +0 -18
  176. package/dist/commands/simulate/types.d.ts.map +0 -1
  177. package/dist/commands/simulate/types.js +0 -2
  178. package/dist/commands/simulate/types.js.map +0 -1
  179. package/dist/config/build-defaults.d.ts +0 -49
  180. package/dist/config/build-defaults.d.ts.map +0 -1
  181. package/dist/config/build-defaults.js +0 -72
  182. package/dist/config/build-defaults.js.map +0 -1
  183. package/dist/config/index.d.ts +0 -13
  184. package/dist/config/index.d.ts.map +0 -1
  185. package/dist/config/index.js +0 -15
  186. package/dist/config/index.js.map +0 -1
  187. package/dist/config/loader.d.ts +0 -81
  188. package/dist/config/loader.d.ts.map +0 -1
  189. package/dist/config/loader.js +0 -155
  190. package/dist/config/loader.js.map +0 -1
  191. package/dist/config/utils.d.ts +0 -114
  192. package/dist/config/utils.d.ts.map +0 -1
  193. package/dist/config/utils.js +0 -257
  194. package/dist/config/utils.js.map +0 -1
  195. package/dist/config/validators.d.ts +0 -52
  196. package/dist/config/validators.d.ts.map +0 -1
  197. package/dist/config/validators.js +0 -85
  198. package/dist/config/validators.js.map +0 -1
  199. package/dist/core/asset-resolver.d.ts +0 -34
  200. package/dist/core/asset-resolver.d.ts.map +0 -1
  201. package/dist/core/asset-resolver.js +0 -69
  202. package/dist/core/asset-resolver.js.map +0 -1
  203. package/dist/core/build-cache.d.ts +0 -23
  204. package/dist/core/build-cache.d.ts.map +0 -1
  205. package/dist/core/build-cache.js +0 -43
  206. package/dist/core/build-cache.js.map +0 -1
  207. package/dist/core/cache-utils.d.ts +0 -27
  208. package/dist/core/cache-utils.d.ts.map +0 -1
  209. package/dist/core/cache-utils.js +0 -60
  210. package/dist/core/cache-utils.js.map +0 -1
  211. package/dist/core/docker.d.ts +0 -99
  212. package/dist/core/docker.d.ts.map +0 -1
  213. package/dist/core/docker.js +0 -249
  214. package/dist/core/docker.js.map +0 -1
  215. package/dist/core/execution.d.ts +0 -34
  216. package/dist/core/execution.d.ts.map +0 -1
  217. package/dist/core/execution.js +0 -64
  218. package/dist/core/execution.js.map +0 -1
  219. package/dist/core/index.d.ts +0 -10
  220. package/dist/core/index.d.ts.map +0 -1
  221. package/dist/core/index.js +0 -10
  222. package/dist/core/index.js.map +0 -1
  223. package/dist/core/local-packages.d.ts +0 -19
  224. package/dist/core/local-packages.d.ts.map +0 -1
  225. package/dist/core/local-packages.js +0 -60
  226. package/dist/core/local-packages.js.map +0 -1
  227. package/dist/core/logger.d.ts +0 -28
  228. package/dist/core/logger.d.ts.map +0 -1
  229. package/dist/core/logger.js +0 -88
  230. package/dist/core/logger.js.map +0 -1
  231. package/dist/core/output.d.ts +0 -30
  232. package/dist/core/output.d.ts.map +0 -1
  233. package/dist/core/output.js +0 -46
  234. package/dist/core/output.js.map +0 -1
  235. package/dist/core/temp-manager.d.ts +0 -51
  236. package/dist/core/temp-manager.d.ts.map +0 -1
  237. package/dist/core/temp-manager.js +0 -73
  238. package/dist/core/temp-manager.js.map +0 -1
  239. package/dist/core/timer.d.ts +0 -14
  240. package/dist/core/timer.d.ts.map +0 -1
  241. package/dist/core/timer.js +0 -29
  242. package/dist/core/timer.js.map +0 -1
  243. package/dist/core/utils.d.ts +0 -10
  244. package/dist/core/utils.d.ts.map +0 -1
  245. package/dist/core/utils.js +0 -12
  246. package/dist/core/utils.js.map +0 -1
  247. package/dist/examples/.npm-cache/content-v2/sha512/0d/2d/7581c288670eaf8538ddd9df145b78756ce3be0791c6e0b9cd33429b3bae894525b9bda287a3cedffbcdd2c7b3107bafc03f2b0367eea489eee1cc042abb +0 -1
  248. package/dist/examples/.npm-cache/content-v2/sha512/12/20/bc4f5acca143809f7e07da1fdafb38137d93243de4d5b403e6e10b92d0d3a6e51eab24fe9dbc9d3ed1cd72e8f7a406085e99c422bb2c7d1166cf9f1f564e +0 -0
  249. package/dist/examples/.npm-cache/content-v2/sha512/22/ee/fb2695b01871c1d36946bdcfb49f1b520a57200d0a0b221b1e7d5f047ab38a8b2ab0e5f0e25a00acde1f3f2f9d24430a18f1092d438bc1a9e9891cc45f75 +0 -0
  250. package/dist/examples/.npm-cache/content-v2/sha512/24/89/da1ce6a61bca6de7e132f241a675c01c83738bf6b78af25b5cce01d3030361332b3fe938571e2b721f1555da9ddf930fdcf8c02f0471556071590e68cc09 +0 -0
  251. package/dist/examples/.npm-cache/content-v2/sha512/47/fd/c6be997da99228c3e279b95d4a46d6913947078a178f54ac71795a159f3513b1483232f4c2d0a1f403178bf9f96bb19615de32a9e2133e949880c6bc15e2 +0 -0
  252. package/dist/examples/.npm-cache/content-v2/sha512/4b/1c/c1cb7f8b32102071a89fef97158daa32080ebaedfbbd596880d2213d84e305abc76d2a95a412ded55c1c3d487adcb1ceff87fc2c85d7e2856ebd9d3f16f3 +0 -0
  253. package/dist/examples/.npm-cache/content-v2/sha512/6e/53/ff864769671f44f39d8a3bf904cd646535b745cc4824a8bb3189193b474678049f43b5178ba15cad7f0289046105e70f1565afc84e907120b35a466690fd +0 -1
  254. package/dist/examples/.npm-cache/content-v2/sha512/70/4c/4c8837d446965c5551b4ea527e95fa011744fb727581d82cf35bb5599ea0b57d18baa490f7af93ef9a16e8e45e5c0802737da20575f4056a4a5c9a3cd288 +0 -0
  255. package/dist/examples/.npm-cache/content-v2/sha512/96/ad/05de3bbb12d7de8ea353f962bdaea7d2eb44f707f2973462a6635daf537c67b46cca7764fed7d464fe62152c3f783a07aba1ceb35e09ad446bff05a4b466 +0 -1
  256. package/dist/examples/.npm-cache/content-v2/sha512/b5/20/52dde94e6cef7170f6089c64a4843e57be18be450d956f4e455905aed047ae6a368451c93035e6ac3ee59576b600f03f815afba0836b3a16e10a9aaca4ba +0 -1
  257. package/dist/examples/.npm-cache/content-v2/sha512/c7/a9/d166a1c39f97df312c59261319ba1cf9aac178bda0a0cb697d5ddd78bd8dd38ef1bf40017bcc8633c2049896c2d70696d9bff9280851f270792ff38bb3a0 +0 -1
  258. package/dist/examples/.npm-cache/content-v2/sha512/e0/d0/8c14083b633e6adbd3c6a93da5fc0f6bbd456c5512ef276920bedd8d85d551052adff992de977aff326616a211aaa2d6ddcc801149e9b7f914f566359b6a +0 -1
  259. package/dist/examples/.npm-cache/content-v2/sha512/e7/c5/06ad3fd79ac4f1031fe0b16ea5e54e232ca397bbcd7592c679021cbfb027276099f8c848f3f7a7691f0102ad53aa64f9141e61d729b037a678bd60440d17 +0 -1
  260. package/dist/examples/.npm-cache/content-v2/sha512/f3/28/d5d32329604ed7d471a4949105daa2cc98858cf24f45b0b97c41d0eb0d5a9fe7bf1f69c792161cc6693e4fc1b52e886ac41875ebfb8fe47fafe417ca3e6e +0 -0
  261. package/dist/examples/.npm-cache/index-v5/04/5a/2b5d7a7c407d85d746baa0f5c9388a333e35a717a8a0a81943daa6cb1364 +0 -3
  262. package/dist/examples/.npm-cache/index-v5/12/9a/eba560cbace295d8ee04cf283015377bd77b379e70968fb6bc407c7fc410 +0 -15
  263. package/dist/examples/.npm-cache/index-v5/2f/a2/7b047564b0ee21ac835ec609e89153dd6549be554d098584d5bfd19fe043 +0 -15
  264. package/dist/examples/.npm-cache/index-v5/32/8e/322d58dd8d1e000be248ada51385bf96288e56039de9feec1a4c6a467653 +0 -3
  265. package/dist/examples/.npm-cache/index-v5/57/93/d1d7cd1402e3e26468db03f2870822bb2c9018a506cdfb3b405f38cd3e1c +0 -3
  266. package/dist/examples/.npm-cache/index-v5/5d/f8/0a1f4fa7149e4ff33e09eb6aea41ac8d1730c868a5d3ace91f762698acff +0 -3
  267. package/dist/examples/.npm-cache/index-v5/69/a4/a92c72d838259b051cdf8e0acfb2bc680b6d4cfc642314a7836c3f7b2c50 +0 -15
  268. package/dist/examples/.npm-cache/index-v5/71/31/6da3423bb203f3de5eb16c942431073f89be2cfcb40058ec91dcb5ce0abc +0 -15
  269. package/dist/examples/.npm-cache/index-v5/7b/94/72b6bffa050d9ef52a558dd220663695bc606f756be0dfa196ef4f3913ba +0 -3
  270. package/dist/examples/.npm-cache/index-v5/85/9e/99e97fdd562517e56285337db91d1a8f2f416b8d631cf4d7d754fa671299 +0 -15
  271. package/dist/examples/.npm-cache/index-v5/92/4c/9416ada81a9b3c679539fd1ab53f8de3d41ff268f35eba7a194389a85b06 +0 -3
  272. package/dist/examples/.npm-cache/index-v5/c1/5a/13df76b218deed8a6ef12961116af5183db98c53fad1b922fd9edc075247 +0 -3
  273. package/dist/examples/.npm-cache/index-v5/cb/11/253c55410a8ab7c4a9ea9d6e1bf8ef1450a581da64c478074dfd82c8bff6 +0 -3
  274. package/dist/examples/.npm-cache/index-v5/d5/ae/b57fad3a62b5ba2dbdf24b042a9e7b70820f3db00e5a630f02e1fea020dc +0 -3
  275. package/dist/examples/.npm-cache/index-v5/d6/32/2f620f83c7d14451de98de8298c2408e05a16cc0829bd16c891ac19d7a67 +0 -3
  276. package/dist/examples/.npm-cache/index-v5/dd/b5/01dc7a3cd8b6a03a69aee9af500d51ae19cb0aa12631a4aafd152148b8e5 +0 -15
  277. package/dist/examples/.npm-cache/index-v5/e0/cf/6b862c15d74630d3871cd813d305210ab741311deb10baf8813014e0bc30 +0 -3
  278. package/dist/examples/.npm-cache/index-v5/e2/be/e880ccd35950a814d3c1dded34d3938ac61b15a195321dc51357f801aad4 +0 -15
  279. package/dist/examples/.npm-cache/index-v5/e5/1f/f4affe0b392cd03288f23cc03abcb274ff11a2c8f8965299de681914abb2 +0 -3
  280. package/dist/examples/.npm-cache/index-v5/f3/5b/9ebe450958ff0d7cc44ab0a00080cb8a3ff1389744b5eab5f97b68a6a6af +0 -3
  281. package/dist/examples/.npm-cache/index-v5/fb/c1/0de405e902866d53e7c30cf36a97dc2578838622b261816f44dc377c9a80 +0 -3
  282. package/dist/index.d.ts.map +0 -1
  283. package/dist/schemas/index.d.ts +0 -9
  284. package/dist/schemas/index.d.ts.map +0 -1
  285. package/dist/schemas/index.js +0 -9
  286. package/dist/schemas/index.js.map +0 -1
  287. package/dist/schemas/primitives.d.ts +0 -37
  288. package/dist/schemas/primitives.d.ts.map +0 -1
  289. package/dist/schemas/primitives.js +0 -43
  290. package/dist/schemas/primitives.js.map +0 -1
  291. package/dist/schemas/run.d.ts +0 -23
  292. package/dist/schemas/run.d.ts.map +0 -1
  293. package/dist/schemas/run.js +0 -20
  294. package/dist/schemas/run.js.map +0 -1
  295. package/dist/templates/server.hbs +0 -29
  296. package/dist/templates/web.hbs +0 -45
  297. package/dist/types/bundle.d.ts +0 -146
  298. package/dist/types/bundle.d.ts.map +0 -1
  299. package/dist/types/bundle.js +0 -10
  300. package/dist/types/bundle.js.map +0 -1
  301. package/dist/types/global.d.ts +0 -51
  302. package/dist/types/global.d.ts.map +0 -1
  303. package/dist/types/global.js +0 -30
  304. package/dist/types/global.js.map +0 -1
  305. package/dist/types/index.d.ts +0 -8
  306. package/dist/types/index.d.ts.map +0 -1
  307. package/dist/types/index.js +0 -8
  308. package/dist/types/index.js.map +0 -1
  309. package/dist/types/template.d.ts +0 -108
  310. package/dist/types/template.d.ts.map +0 -1
  311. package/dist/types/template.js +0 -10
  312. package/dist/types/template.js.map +0 -1
  313. package/dist/walker.js +0 -1
  314. package/examples/.npm-cache/content-v2/sha512/0d/2d/7581c288670eaf8538ddd9df145b78756ce3be0791c6e0b9cd33429b3bae894525b9bda287a3cedffbcdd2c7b3107bafc03f2b0367eea489eee1cc042abb +0 -1
  315. package/examples/.npm-cache/content-v2/sha512/12/20/bc4f5acca143809f7e07da1fdafb38137d93243de4d5b403e6e10b92d0d3a6e51eab24fe9dbc9d3ed1cd72e8f7a406085e99c422bb2c7d1166cf9f1f564e +0 -0
  316. package/examples/.npm-cache/content-v2/sha512/22/ee/fb2695b01871c1d36946bdcfb49f1b520a57200d0a0b221b1e7d5f047ab38a8b2ab0e5f0e25a00acde1f3f2f9d24430a18f1092d438bc1a9e9891cc45f75 +0 -0
  317. package/examples/.npm-cache/content-v2/sha512/24/89/da1ce6a61bca6de7e132f241a675c01c83738bf6b78af25b5cce01d3030361332b3fe938571e2b721f1555da9ddf930fdcf8c02f0471556071590e68cc09 +0 -0
  318. package/examples/.npm-cache/content-v2/sha512/47/fd/c6be997da99228c3e279b95d4a46d6913947078a178f54ac71795a159f3513b1483232f4c2d0a1f403178bf9f96bb19615de32a9e2133e949880c6bc15e2 +0 -0
  319. package/examples/.npm-cache/content-v2/sha512/4b/1c/c1cb7f8b32102071a89fef97158daa32080ebaedfbbd596880d2213d84e305abc76d2a95a412ded55c1c3d487adcb1ceff87fc2c85d7e2856ebd9d3f16f3 +0 -0
  320. package/examples/.npm-cache/content-v2/sha512/6e/53/ff864769671f44f39d8a3bf904cd646535b745cc4824a8bb3189193b474678049f43b5178ba15cad7f0289046105e70f1565afc84e907120b35a466690fd +0 -1
  321. package/examples/.npm-cache/content-v2/sha512/70/4c/4c8837d446965c5551b4ea527e95fa011744fb727581d82cf35bb5599ea0b57d18baa490f7af93ef9a16e8e45e5c0802737da20575f4056a4a5c9a3cd288 +0 -0
  322. package/examples/.npm-cache/content-v2/sha512/96/ad/05de3bbb12d7de8ea353f962bdaea7d2eb44f707f2973462a6635daf537c67b46cca7764fed7d464fe62152c3f783a07aba1ceb35e09ad446bff05a4b466 +0 -1
  323. package/examples/.npm-cache/content-v2/sha512/b5/20/52dde94e6cef7170f6089c64a4843e57be18be450d956f4e455905aed047ae6a368451c93035e6ac3ee59576b600f03f815afba0836b3a16e10a9aaca4ba +0 -1
  324. package/examples/.npm-cache/content-v2/sha512/c7/a9/d166a1c39f97df312c59261319ba1cf9aac178bda0a0cb697d5ddd78bd8dd38ef1bf40017bcc8633c2049896c2d70696d9bff9280851f270792ff38bb3a0 +0 -1
  325. package/examples/.npm-cache/content-v2/sha512/e0/d0/8c14083b633e6adbd3c6a93da5fc0f6bbd456c5512ef276920bedd8d85d551052adff992de977aff326616a211aaa2d6ddcc801149e9b7f914f566359b6a +0 -1
  326. package/examples/.npm-cache/content-v2/sha512/e7/c5/06ad3fd79ac4f1031fe0b16ea5e54e232ca397bbcd7592c679021cbfb027276099f8c848f3f7a7691f0102ad53aa64f9141e61d729b037a678bd60440d17 +0 -1
  327. package/examples/.npm-cache/content-v2/sha512/f3/28/d5d32329604ed7d471a4949105daa2cc98858cf24f45b0b97c41d0eb0d5a9fe7bf1f69c792161cc6693e4fc1b52e886ac41875ebfb8fe47fafe417ca3e6e +0 -0
  328. package/examples/.npm-cache/index-v5/04/5a/2b5d7a7c407d85d746baa0f5c9388a333e35a717a8a0a81943daa6cb1364 +0 -3
  329. package/examples/.npm-cache/index-v5/12/9a/eba560cbace295d8ee04cf283015377bd77b379e70968fb6bc407c7fc410 +0 -15
  330. package/examples/.npm-cache/index-v5/2f/a2/7b047564b0ee21ac835ec609e89153dd6549be554d098584d5bfd19fe043 +0 -15
  331. package/examples/.npm-cache/index-v5/32/8e/322d58dd8d1e000be248ada51385bf96288e56039de9feec1a4c6a467653 +0 -3
  332. package/examples/.npm-cache/index-v5/57/93/d1d7cd1402e3e26468db03f2870822bb2c9018a506cdfb3b405f38cd3e1c +0 -3
  333. package/examples/.npm-cache/index-v5/5d/f8/0a1f4fa7149e4ff33e09eb6aea41ac8d1730c868a5d3ace91f762698acff +0 -3
  334. package/examples/.npm-cache/index-v5/69/a4/a92c72d838259b051cdf8e0acfb2bc680b6d4cfc642314a7836c3f7b2c50 +0 -15
  335. package/examples/.npm-cache/index-v5/71/31/6da3423bb203f3de5eb16c942431073f89be2cfcb40058ec91dcb5ce0abc +0 -15
  336. package/examples/.npm-cache/index-v5/7b/94/72b6bffa050d9ef52a558dd220663695bc606f756be0dfa196ef4f3913ba +0 -3
  337. package/examples/.npm-cache/index-v5/85/9e/99e97fdd562517e56285337db91d1a8f2f416b8d631cf4d7d754fa671299 +0 -15
  338. package/examples/.npm-cache/index-v5/92/4c/9416ada81a9b3c679539fd1ab53f8de3d41ff268f35eba7a194389a85b06 +0 -3
  339. package/examples/.npm-cache/index-v5/c1/5a/13df76b218deed8a6ef12961116af5183db98c53fad1b922fd9edc075247 +0 -3
  340. package/examples/.npm-cache/index-v5/cb/11/253c55410a8ab7c4a9ea9d6e1bf8ef1450a581da64c478074dfd82c8bff6 +0 -3
  341. package/examples/.npm-cache/index-v5/d5/ae/b57fad3a62b5ba2dbdf24b042a9e7b70820f3db00e5a630f02e1fea020dc +0 -3
  342. package/examples/.npm-cache/index-v5/d6/32/2f620f83c7d14451de98de8298c2408e05a16cc0829bd16c891ac19d7a67 +0 -3
  343. package/examples/.npm-cache/index-v5/dd/b5/01dc7a3cd8b6a03a69aee9af500d51ae19cb0aa12631a4aafd152148b8e5 +0 -15
  344. package/examples/.npm-cache/index-v5/e0/cf/6b862c15d74630d3871cd813d305210ab741311deb10baf8813014e0bc30 +0 -3
  345. package/examples/.npm-cache/index-v5/e2/be/e880ccd35950a814d3c1dded34d3938ac61b15a195321dc51357f801aad4 +0 -15
  346. package/examples/.npm-cache/index-v5/e5/1f/f4affe0b392cd03288f23cc03abcb274ff11a2c8f8965299de681914abb2 +0 -3
  347. package/examples/.npm-cache/index-v5/f3/5b/9ebe450958ff0d7cc44ab0a00080cb8a3ff1389744b5eab5f97b68a6a6af +0 -3
  348. package/examples/.npm-cache/index-v5/fb/c1/0de405e902866d53e7c30cf36a97dc2578838622b261816f44dc377c9a80 +0 -3
  349. package/templates/server.hbs +0 -29
  350. package/templates/web.hbs +0 -45
package/dist/index.js CHANGED
@@ -5,6 +5,7 @@ import { Command } from "commander";
5
5
  import { readFileSync } from "fs";
6
6
  import { fileURLToPath as fileURLToPath2 } from "url";
7
7
  import { dirname, join } from "path";
8
+ import { VERSION as DOCKER_VERSION2 } from "@walkeros/docker";
8
9
 
9
10
  // src/commands/bundle/index.ts
10
11
  import path9 from "path";
@@ -263,7 +264,7 @@ async function loadJsonFromSource(source, options) {
263
264
  }
264
265
 
265
266
  // src/core/docker.ts
266
- var CLI_VERSION = true ? "0.4.2" : "0.0.0";
267
+ var CLI_VERSION = true ? "0.5.0" : "0.0.0";
267
268
  var CLI_DOCKER_IMAGE = process.env.WALKEROS_CLI_DOCKER_IMAGE || `walkeros/cli:${CLI_VERSION}`;
268
269
  var RUNTIME_DOCKER_IMAGE = process.env.WALKEROS_RUNTIME_DOCKER_IMAGE || `walkeros/docker:${DOCKER_VERSION}`;
269
270
  function buildCommonDockerArgs(options) {
@@ -323,7 +324,7 @@ async function executeInDocker(command, args, options = {}, configFile) {
323
324
  if (code === 0) {
324
325
  resolve();
325
326
  } else {
326
- reject(new Error(`Docker command exited with code ${code}`));
327
+ process.exit(code || 1);
327
328
  }
328
329
  });
329
330
  });
@@ -392,7 +393,7 @@ async function executeRunInDocker(mode, flowPath, options = {}) {
392
393
  if (code === 0) {
393
394
  resolve();
394
395
  } else {
395
- reject(new Error(`Docker command exited with code ${code}`));
396
+ process.exit(code || 1);
396
397
  }
397
398
  });
398
399
  });
@@ -405,22 +406,22 @@ function getExecutionMode(options) {
405
406
  }
406
407
  return "docker";
407
408
  }
408
- async function executeCommand(localHandler, dockerCommand, dockerArgs, options, logger, configFile) {
409
+ async function executeCommand(localHandler, dockerCommand, dockerArgs, options, logger2, configFile) {
409
410
  const mode = getExecutionMode(options);
410
411
  if (options.dryRun) {
411
412
  if (mode === "docker") {
412
413
  const cmd = `docker run walkeros/cli:latest ${dockerCommand} ${dockerArgs.join(" ")}`;
413
- logger?.info(`[DRY-RUN] Would execute: ${cmd}`);
414
+ logger2?.info(`[DRY-RUN] Would execute: ${cmd}`);
414
415
  } else {
415
- logger?.info(
416
+ logger2?.info(
416
417
  `[DRY-RUN] Would execute locally: ${dockerCommand} ${dockerArgs.join(" ")}`
417
418
  );
418
419
  }
419
420
  return;
420
421
  }
421
422
  if (mode === "local") {
422
- if (logger && !options.silent) {
423
- logger.info("\u{1F5A5}\uFE0F Executing locally...");
423
+ if (logger2 && !options.silent) {
424
+ logger2.info("\u{1F5A5}\uFE0F Executing locally...");
424
425
  }
425
426
  await localHandler();
426
427
  } else {
@@ -430,8 +431,8 @@ async function executeCommand(localHandler, dockerCommand, dockerArgs, options,
430
431
  "Docker is not available. Please install Docker or use --local flag to execute locally."
431
432
  );
432
433
  }
433
- if (logger && !options.silent) {
434
- logger.info("\u{1F433} Executing in Docker container...");
434
+ if (logger2 && !options.silent) {
435
+ logger2.info("\u{1F433} Executing in Docker container...");
435
436
  }
436
437
  await executeInDocker(dockerCommand, dockerArgs, options, configFile);
437
438
  }
@@ -451,7 +452,7 @@ function getAssetDir() {
451
452
  const currentFile = fileURLToPath(import.meta.url);
452
453
  let dir = path3.dirname(currentFile);
453
454
  while (dir !== path3.dirname(dir)) {
454
- if (existsSync(path3.join(dir, "templates"))) {
455
+ if (existsSync(path3.join(dir, "examples"))) {
455
456
  cachedAssetDir = dir;
456
457
  return dir;
457
458
  }
@@ -463,9 +464,6 @@ function getAssetDir() {
463
464
  function resolveAsset(assetPath, assetType, baseDir) {
464
465
  if (!assetPath.includes("/") && !assetPath.includes("\\")) {
465
466
  const assetDir = getAssetDir();
466
- if (assetType === "template") {
467
- return path3.join(assetDir, "templates", assetPath);
468
- }
469
467
  return path3.join(assetDir, "examples", assetPath);
470
468
  }
471
469
  if (path3.isAbsolute(assetPath)) {
@@ -482,7 +480,7 @@ function getErrorMessage(error) {
482
480
  // src/core/local-packages.ts
483
481
  import path4 from "path";
484
482
  import fs3 from "fs-extra";
485
- async function resolveLocalPackage(packageName, localPath, configDir, logger) {
483
+ async function resolveLocalPackage(packageName, localPath, configDir, logger2) {
486
484
  const absolutePath = path4.isAbsolute(localPath) ? localPath : path4.resolve(configDir, localPath);
487
485
  if (!await fs3.pathExists(absolutePath)) {
488
486
  throw new Error(
@@ -498,7 +496,7 @@ async function resolveLocalPackage(packageName, localPath, configDir, logger) {
498
496
  const distPath = path4.join(absolutePath, "dist");
499
497
  const hasDistFolder = await fs3.pathExists(distPath);
500
498
  if (!hasDistFolder) {
501
- logger.warn(
499
+ logger2.warn(
502
500
  `\u26A0\uFE0F ${packageName}: No dist/ folder found. Using package root.`
503
501
  );
504
502
  }
@@ -509,7 +507,7 @@ async function resolveLocalPackage(packageName, localPath, configDir, logger) {
509
507
  hasDistFolder
510
508
  };
511
509
  }
512
- async function copyLocalPackage(localPkg, targetDir, logger) {
510
+ async function copyLocalPackage(localPkg, targetDir, logger2) {
513
511
  const packageDir = path4.join(targetDir, "node_modules", localPkg.name);
514
512
  await fs3.ensureDir(path4.dirname(packageDir));
515
513
  await fs3.copy(
@@ -529,7 +527,7 @@ async function copyLocalPackage(localPkg, targetDir, logger) {
529
527
  }
530
528
  }
531
529
  }
532
- logger.info(`\u{1F4E6} Using local: ${localPkg.name} from ${localPkg.absolutePath}`);
530
+ logger2.info(`\u{1F4E6} Using local: ${localPkg.name} from ${localPkg.absolutePath}`);
533
531
  return packageDir;
534
532
  }
535
533
 
@@ -560,7 +558,6 @@ var WEB_BUILD_DEFAULTS = {
560
558
  format: "iife",
561
559
  platform: "browser",
562
560
  target: "es2020",
563
- template: "web.hbs",
564
561
  minify: true,
565
562
  sourcemap: false,
566
563
  cache: true,
@@ -572,7 +569,6 @@ var SERVER_BUILD_DEFAULTS = {
572
569
  format: "esm",
573
570
  platform: "node",
574
571
  target: "node20",
575
- template: "server.hbs",
576
572
  minify: true,
577
573
  sourcemap: false,
578
574
  cache: true,
@@ -681,7 +677,8 @@ function loadAllFlows(rawConfig, options) {
681
677
  // src/commands/bundle/bundler.ts
682
678
  import esbuild from "esbuild";
683
679
  import path8 from "path";
684
- import fs8 from "fs-extra";
680
+ import fs7 from "fs-extra";
681
+ import { packageNameToVariable } from "@walkeros/core";
685
682
 
686
683
  // src/commands/bundle/package-manager.ts
687
684
  import pacote from "pacote";
@@ -755,7 +752,7 @@ Each package must use the same version across all declarations. Please update yo
755
752
  );
756
753
  }
757
754
  }
758
- async function resolveDependencies(pkg, packageDir, logger, visited = /* @__PURE__ */ new Set()) {
755
+ async function resolveDependencies(pkg, packageDir, logger2, visited = /* @__PURE__ */ new Set()) {
759
756
  const dependencies = [];
760
757
  const pkgKey = `${pkg.name}@${pkg.version}`;
761
758
  if (visited.has(pkgKey)) {
@@ -777,11 +774,11 @@ async function resolveDependencies(pkg, packageDir, logger, visited = /* @__PURE
777
774
  }
778
775
  }
779
776
  } catch (error) {
780
- logger.debug(`Failed to read dependencies for ${pkgKey}: ${error}`);
777
+ logger2.debug(`Failed to read dependencies for ${pkgKey}: ${error}`);
781
778
  }
782
779
  return dependencies;
783
780
  }
784
- async function downloadPackages(packages, targetDir, logger, useCache = true, configDir) {
781
+ async function downloadPackages(packages, targetDir, logger2, useCache = true, configDir) {
785
782
  const packagePaths = /* @__PURE__ */ new Map();
786
783
  const downloadQueue = [...packages];
787
784
  const processed = /* @__PURE__ */ new Set();
@@ -808,11 +805,11 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
808
805
  pkg.name,
809
806
  pkg.path,
810
807
  configDir || process.cwd(),
811
- logger
808
+ logger2
812
809
  );
813
- const installedPath = await copyLocalPackage(localPkg, targetDir, logger);
810
+ const installedPath = await copyLocalPackage(localPkg, targetDir, logger2);
814
811
  packagePaths.set(pkg.name, installedPath);
815
- const deps = await resolveDependencies(pkg, installedPath, logger);
812
+ const deps = await resolveDependencies(pkg, installedPath, logger2);
816
813
  for (const dep of deps) {
817
814
  const depKey = `${dep.name}@${dep.version}`;
818
815
  if (!processed.has(depKey)) {
@@ -825,12 +822,12 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
825
822
  const packageDir = getPackageDirectory(targetDir, pkg.name, pkg.version);
826
823
  const cachedPath = await getCachedPackagePath(pkg, targetDir);
827
824
  if (useCache && await isPackageCached(pkg, targetDir)) {
828
- logger.debug(`Using cached ${packageSpec}...`);
825
+ logger2.debug(`Using cached ${packageSpec}...`);
829
826
  try {
830
827
  await fs5.ensureDir(path6.dirname(packageDir));
831
828
  await fs5.copy(cachedPath, packageDir);
832
829
  packagePaths.set(pkg.name, packageDir);
833
- const deps = await resolveDependencies(pkg, packageDir, logger);
830
+ const deps = await resolveDependencies(pkg, packageDir, logger2);
834
831
  for (const dep of deps) {
835
832
  const depKey = `${dep.name}@${dep.version}`;
836
833
  if (!processed.has(depKey)) {
@@ -839,12 +836,12 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
839
836
  }
840
837
  continue;
841
838
  } catch (error) {
842
- logger.debug(
839
+ logger2.debug(
843
840
  `Failed to use cache for ${packageSpec}, downloading fresh: ${error}`
844
841
  );
845
842
  }
846
843
  }
847
- logger.debug(`Downloading ${packageSpec}...`);
844
+ logger2.debug(`Downloading ${packageSpec}...`);
848
845
  try {
849
846
  await fs5.ensureDir(path6.dirname(packageDir));
850
847
  const cacheDir = process.env.NPM_CACHE_DIR || path6.join(process.cwd(), ".npm-cache");
@@ -862,13 +859,13 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
862
859
  try {
863
860
  await fs5.ensureDir(path6.dirname(cachedPath));
864
861
  await fs5.copy(packageDir, cachedPath);
865
- logger.debug(`Cached ${packageSpec} for future use`);
862
+ logger2.debug(`Cached ${packageSpec} for future use`);
866
863
  } catch (cacheError) {
867
- logger.debug(`Failed to cache ${packageSpec}: ${cacheError}`);
864
+ logger2.debug(`Failed to cache ${packageSpec}: ${cacheError}`);
868
865
  }
869
866
  }
870
867
  packagePaths.set(pkg.name, packageDir);
871
- const deps = await resolveDependencies(pkg, packageDir, logger);
868
+ const deps = await resolveDependencies(pkg, packageDir, logger2);
872
869
  for (const dep of deps) {
873
870
  const depKey = `${dep.name}@${dep.version}`;
874
871
  if (!processed.has(depKey)) {
@@ -882,164 +879,8 @@ async function downloadPackages(packages, targetDir, logger, useCache = true, co
882
879
  return packagePaths;
883
880
  }
884
881
 
885
- // src/commands/bundle/template-engine.ts
886
- import fs6 from "fs-extra";
887
- import Handlebars from "handlebars";
888
-
889
- // src/commands/bundle/serializer.ts
890
- function serializeToJS(value, options = {}) {
891
- const { indent = 2, singleQuotes = false } = options;
892
- const quote = singleQuotes ? "'" : '"';
893
- function serialize(val, currentIndent = 0) {
894
- if (val === null) return "null";
895
- if (val === void 0) return "undefined";
896
- if (typeof val === "boolean" || typeof val === "number") {
897
- return String(val);
898
- }
899
- if (typeof val === "string") {
900
- if (val.includes("=>")) {
901
- const arrowPatterns = [
902
- /^\s*\([^)]*\)\s*=>/,
903
- // (param) => or () =>
904
- /^\s*\w+\s*=>/,
905
- // param =>
906
- /^\s*\([^)]*\)\s*=>\s*\{/,
907
- // (param) => {
908
- /^\s*\w+\s*=>\s*\{/
909
- // param => {
910
- ];
911
- if (arrowPatterns.some((pattern) => pattern.test(val))) {
912
- return val;
913
- }
914
- }
915
- return quote + val.replace(/\\/g, "\\\\").replace(/'/g, "\\'").replace(/"/g, '\\"') + quote;
916
- }
917
- if (Array.isArray(val)) {
918
- if (val.length === 0) return "[]";
919
- const nextIndent = currentIndent + indent;
920
- const spacing = " ".repeat(nextIndent);
921
- const items = val.map((item) => spacing + serialize(item, nextIndent)).join(",\n");
922
- return `[
923
- ${items}
924
- ${" ".repeat(currentIndent)}]`;
925
- }
926
- if (isObject(val)) {
927
- const entries = Object.entries(val);
928
- if (entries.length === 0) return "{}";
929
- const nextIndent = currentIndent + indent;
930
- const spacing = " ".repeat(nextIndent);
931
- const props = entries.map(([key, value2]) => {
932
- const needsQuotes = /[^a-zA-Z0-9_$]/.test(key) || /^[0-9]/.test(key);
933
- const keyStr = needsQuotes ? quote + key + quote : key;
934
- return spacing + keyStr + ": " + serialize(value2, nextIndent);
935
- }).join(",\n");
936
- return `{
937
- ${props}
938
- ${" ".repeat(currentIndent)}}`;
939
- }
940
- return String(val);
941
- }
942
- return serialize(value);
943
- }
944
- function serializeConfig(config) {
945
- if (!config || Object.keys(config).length === 0) {
946
- return "{}";
947
- }
948
- return serializeToJS(config, { indent: 2, singleQuotes: true });
949
- }
950
- function processTemplateVariables(variables) {
951
- const processed = { ...variables };
952
- if (isObject(processed.sources)) {
953
- const sourcesObj = processed.sources;
954
- const processedSources = {};
955
- for (const [name, source] of Object.entries(sourcesObj)) {
956
- const typedSource = source;
957
- const { env: _, ...sourceWithoutEnv } = typedSource;
958
- processedSources[name] = {
959
- ...sourceWithoutEnv,
960
- config: isObject(typedSource.config) ? serializeConfig(typedSource.config) : typedSource.config,
961
- // Pass through string configs unchanged
962
- ...typedSource.env !== void 0 && { env: typedSource.env }
963
- };
964
- }
965
- processed.sources = processedSources;
966
- }
967
- if (isObject(processed.destinations)) {
968
- const destinationsObj = processed.destinations;
969
- const processedDestinations = {};
970
- for (const [name, dest] of Object.entries(destinationsObj)) {
971
- const typedDest = dest;
972
- const { env: _, ...destWithoutEnv } = typedDest;
973
- processedDestinations[name] = {
974
- ...destWithoutEnv,
975
- config: isObject(typedDest.config) ? serializeConfig(typedDest.config) : typedDest.config,
976
- ...typedDest.env !== void 0 && { env: typedDest.env }
977
- };
978
- }
979
- processed.destinations = processedDestinations;
980
- }
981
- if (isObject(processed.collector)) {
982
- processed.collector = serializeConfig(
983
- processed.collector
984
- );
985
- }
986
- return processed;
987
- }
988
-
989
- // src/commands/bundle/template-engine.ts
990
- var TemplateEngine = class {
991
- handlebars;
992
- constructor() {
993
- this.handlebars = Handlebars.create();
994
- this.handlebars.registerHelper("eq", (a, b) => a === b);
995
- }
996
- /**
997
- * Load template content from file path
998
- *
999
- * @param templatePath - Template path (bare name, relative, or absolute)
1000
- */
1001
- async loadTemplate(templatePath) {
1002
- const resolvedPath = resolveAsset(templatePath, "template");
1003
- if (!await fs6.pathExists(resolvedPath)) {
1004
- throw new Error(`Template file not found: ${resolvedPath}`);
1005
- }
1006
- return await fs6.readFile(resolvedPath, "utf-8");
1007
- }
1008
- /**
1009
- * Apply template with user code and variable substitution
1010
- */
1011
- applyTemplate(template, userCode, sources, destinations, collector, build) {
1012
- const processedVariables = processTemplateVariables({
1013
- sources,
1014
- destinations,
1015
- collector
1016
- });
1017
- const templateData = {
1018
- CODE: userCode,
1019
- build: build || {},
1020
- ...processedVariables
1021
- };
1022
- const compiledTemplate = this.handlebars.compile(template);
1023
- return compiledTemplate(templateData);
1024
- }
1025
- /**
1026
- * Process template with user code
1027
- */
1028
- async process(templatePath, userCode, sources, destinations, collector, build) {
1029
- const template = await this.loadTemplate(templatePath);
1030
- return this.applyTemplate(
1031
- template,
1032
- userCode,
1033
- sources,
1034
- destinations,
1035
- collector,
1036
- build
1037
- );
1038
- }
1039
- };
1040
-
1041
882
  // src/core/build-cache.ts
1042
- import fs7 from "fs-extra";
883
+ import fs6 from "fs-extra";
1043
884
  import path7 from "path";
1044
885
  var BUILD_CACHE_DIR = path7.join(".tmp", "cache", "builds");
1045
886
  async function getBuildCachePath(configContent, cacheDir = BUILD_CACHE_DIR) {
@@ -1048,32 +889,32 @@ async function getBuildCachePath(configContent, cacheDir = BUILD_CACHE_DIR) {
1048
889
  }
1049
890
  async function isBuildCached(configContent, cacheDir = BUILD_CACHE_DIR) {
1050
891
  const cachePath = await getBuildCachePath(configContent, cacheDir);
1051
- return fs7.pathExists(cachePath);
892
+ return fs6.pathExists(cachePath);
1052
893
  }
1053
894
  async function cacheBuild(configContent, buildOutput, cacheDir = BUILD_CACHE_DIR) {
1054
895
  const cachePath = await getBuildCachePath(configContent, cacheDir);
1055
- await fs7.ensureDir(path7.dirname(cachePath));
1056
- await fs7.writeFile(cachePath, buildOutput, "utf-8");
896
+ await fs6.ensureDir(path7.dirname(cachePath));
897
+ await fs6.writeFile(cachePath, buildOutput, "utf-8");
1057
898
  }
1058
899
  async function getCachedBuild(configContent, cacheDir = BUILD_CACHE_DIR) {
1059
900
  const cachePath = await getBuildCachePath(configContent, cacheDir);
1060
- if (await fs7.pathExists(cachePath)) {
1061
- return await fs7.readFile(cachePath, "utf-8");
901
+ if (await fs6.pathExists(cachePath)) {
902
+ return await fs6.readFile(cachePath, "utf-8");
1062
903
  }
1063
904
  return null;
1064
905
  }
1065
906
 
1066
907
  // src/commands/bundle/bundler.ts
1067
- async function copyIncludes(includes, sourceDir, outputDir, logger) {
908
+ async function copyIncludes(includes, sourceDir, outputDir, logger2) {
1068
909
  for (const include of includes) {
1069
910
  const sourcePath = path8.resolve(sourceDir, include);
1070
911
  const folderName = path8.basename(include);
1071
912
  const destPath = path8.join(outputDir, folderName);
1072
- if (await fs8.pathExists(sourcePath)) {
1073
- await fs8.copy(sourcePath, destPath);
1074
- logger.debug(`Copied ${include} to output`);
913
+ if (await fs7.pathExists(sourcePath)) {
914
+ await fs7.copy(sourcePath, destPath);
915
+ logger2.debug(`Copied ${include} to output`);
1075
916
  } else {
1076
- logger.debug(`Include folder not found: ${include}`);
917
+ logger2.debug(`Include folder not found: ${include}`);
1077
918
  }
1078
919
  }
1079
920
  }
@@ -1089,7 +930,7 @@ function generateCacheKeyContent(flowConfig, buildOptions) {
1089
930
  };
1090
931
  return JSON.stringify(configForCache);
1091
932
  }
1092
- async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
933
+ async function bundleCore(flowConfig, buildOptions, logger2, showStats = false) {
1093
934
  const bundleStartTime = Date.now();
1094
935
  const TEMP_DIR = buildOptions.tempDir ? path8.isAbsolute(buildOptions.tempDir) ? buildOptions.tempDir : path8.resolve(buildOptions.tempDir) : getTempDir();
1095
936
  if (buildOptions.cache !== false) {
@@ -1098,14 +939,14 @@ async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
1098
939
  if (cached) {
1099
940
  const cachedBuild = await getCachedBuild(configContent);
1100
941
  if (cachedBuild) {
1101
- logger.info("\u2728 Using cached build");
942
+ logger2.info("\u2728 Using cached build");
1102
943
  const outputPath = path8.resolve(buildOptions.output);
1103
- await fs8.ensureDir(path8.dirname(outputPath));
1104
- await fs8.writeFile(outputPath, cachedBuild);
1105
- logger.gray(`Output: ${outputPath}`);
1106
- logger.success("\u2705 Build completed (from cache)");
944
+ await fs7.ensureDir(path8.dirname(outputPath));
945
+ await fs7.writeFile(outputPath, cachedBuild);
946
+ logger2.gray(`Output: ${outputPath}`);
947
+ logger2.success("\u2705 Build completed (from cache)");
1107
948
  if (showStats) {
1108
- const stats = await fs8.stat(outputPath);
949
+ const stats = await fs7.stat(outputPath);
1109
950
  const packageStats = Object.entries(buildOptions.packages).map(
1110
951
  ([name, pkg]) => ({
1111
952
  name: `${name}@${pkg.version || "latest"}`,
@@ -1126,10 +967,10 @@ async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
1126
967
  }
1127
968
  try {
1128
969
  if (!buildOptions.tempDir) {
1129
- await fs8.emptyDir(TEMP_DIR);
970
+ await fs7.emptyDir(TEMP_DIR);
1130
971
  }
1131
- logger.debug("Cleaned temporary directory");
1132
- logger.info("\u{1F4E5} Downloading packages...");
972
+ logger2.debug("Cleaned temporary directory");
973
+ logger2.info("\u{1F4E5} Downloading packages...");
1133
974
  const packagesArray = Object.entries(buildOptions.packages).map(
1134
975
  ([name, packageConfig]) => ({
1135
976
  name,
@@ -1141,7 +982,7 @@ async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
1141
982
  const packagePaths = await downloadPackages(
1142
983
  packagesArray,
1143
984
  TEMP_DIR,
1144
- logger,
985
+ logger2,
1145
986
  buildOptions.cache,
1146
987
  buildOptions.configDir
1147
988
  // For resolving relative local paths
@@ -1149,7 +990,7 @@ async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
1149
990
  for (const [pkgName, pkgPath] of packagePaths.entries()) {
1150
991
  if (pkgName.startsWith("@walkeros/")) {
1151
992
  const pkgJsonPath = path8.join(pkgPath, "package.json");
1152
- const pkgJson = await fs8.readJSON(pkgJsonPath);
993
+ const pkgJson = await fs7.readJSON(pkgJsonPath);
1153
994
  if (!pkgJson.exports && pkgJson.module) {
1154
995
  pkgJson.exports = {
1155
996
  ".": {
@@ -1157,33 +998,33 @@ async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
1157
998
  require: pkgJson.main
1158
999
  }
1159
1000
  };
1160
- await fs8.writeJSON(pkgJsonPath, pkgJson, { spaces: 2 });
1001
+ await fs7.writeJSON(pkgJsonPath, pkgJson, { spaces: 2 });
1161
1002
  }
1162
1003
  }
1163
1004
  }
1164
1005
  const packageJsonPath = path8.join(TEMP_DIR, "package.json");
1165
- await fs8.writeFile(
1006
+ await fs7.writeFile(
1166
1007
  packageJsonPath,
1167
1008
  JSON.stringify({ type: "module" }, null, 2)
1168
1009
  );
1169
- logger.info("\u{1F4DD} Creating entry point...");
1010
+ logger2.info("\u{1F4DD} Creating entry point...");
1170
1011
  const entryContent = await createEntryPoint(
1171
1012
  flowConfig,
1172
1013
  buildOptions,
1173
1014
  packagePaths
1174
1015
  );
1175
1016
  const entryPath = path8.join(TEMP_DIR, "entry.js");
1176
- await fs8.writeFile(entryPath, entryContent);
1177
- logger.info("\u26A1 Bundling with esbuild...");
1017
+ await fs7.writeFile(entryPath, entryContent);
1018
+ logger2.info("\u26A1 Bundling with esbuild...");
1178
1019
  const outputPath = path8.resolve(buildOptions.output);
1179
- await fs8.ensureDir(path8.dirname(outputPath));
1020
+ await fs7.ensureDir(path8.dirname(outputPath));
1180
1021
  const esbuildOptions = createEsbuildOptions(
1181
1022
  buildOptions,
1182
1023
  entryPath,
1183
1024
  outputPath,
1184
1025
  TEMP_DIR,
1185
1026
  packagePaths,
1186
- logger
1027
+ logger2
1187
1028
  );
1188
1029
  try {
1189
1030
  await esbuild.build(esbuildOptions);
@@ -1193,12 +1034,12 @@ async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
1193
1034
  buildOptions.code || ""
1194
1035
  );
1195
1036
  }
1196
- logger.gray(`Output: ${outputPath}`);
1037
+ logger2.gray(`Output: ${outputPath}`);
1197
1038
  if (buildOptions.cache !== false) {
1198
1039
  const configContent = generateCacheKeyContent(flowConfig, buildOptions);
1199
- const buildOutput = await fs8.readFile(outputPath, "utf-8");
1040
+ const buildOutput = await fs7.readFile(outputPath, "utf-8");
1200
1041
  await cacheBuild(configContent, buildOutput);
1201
- logger.debug("Build cached for future use");
1042
+ logger2.debug("Build cached for future use");
1202
1043
  }
1203
1044
  let stats;
1204
1045
  if (showStats) {
@@ -1215,24 +1056,24 @@ async function bundleCore(flowConfig, buildOptions, logger, showStats = false) {
1215
1056
  buildOptions.include,
1216
1057
  buildOptions.configDir || process.cwd(),
1217
1058
  outputDir,
1218
- logger
1059
+ logger2
1219
1060
  );
1220
1061
  }
1221
1062
  if (!buildOptions.tempDir) {
1222
- await fs8.remove(TEMP_DIR);
1223
- logger.debug("Cleaned up temporary files");
1063
+ await fs7.remove(TEMP_DIR);
1064
+ logger2.debug("Cleaned up temporary files");
1224
1065
  }
1225
1066
  return stats;
1226
1067
  } catch (error) {
1227
1068
  if (!buildOptions.tempDir) {
1228
- await fs8.remove(TEMP_DIR).catch(() => {
1069
+ await fs7.remove(TEMP_DIR).catch(() => {
1229
1070
  });
1230
1071
  }
1231
1072
  throw error;
1232
1073
  }
1233
1074
  }
1234
1075
  async function collectBundleStats(outputPath, packages, startTime, entryContent) {
1235
- const stats = await fs8.stat(outputPath);
1076
+ const stats = await fs7.stat(outputPath);
1236
1077
  const totalSize = stats.size;
1237
1078
  const buildTime = Date.now() - startTime;
1238
1079
  const packageStats = Object.entries(packages).map(([name, pkg]) => {
@@ -1258,7 +1099,7 @@ async function collectBundleStats(outputPath, packages, startTime, entryContent)
1258
1099
  treeshakingEffective
1259
1100
  };
1260
1101
  }
1261
- function createEsbuildOptions(buildOptions, entryPath, outputPath, tempDir, packagePaths, logger) {
1102
+ function createEsbuildOptions(buildOptions, entryPath, outputPath, tempDir, packagePaths, logger2) {
1262
1103
  const alias = {};
1263
1104
  const baseOptions = {
1264
1105
  entryPoints: [entryPath],
@@ -1326,11 +1167,6 @@ function createEsbuildOptions(buildOptions, entryPath, outputPath, tempDir, pack
1326
1167
  }
1327
1168
  return baseOptions;
1328
1169
  }
1329
- function packageNameToVariable(packageName) {
1330
- return packageName.replace("@", "_").replace(/[/-]/g, "_").split("_").map(
1331
- (part, i) => i === 0 ? part : part.charAt(0).toUpperCase() + part.slice(1)
1332
- ).join("");
1333
- }
1334
1170
  function detectDestinationPackages(flowConfig) {
1335
1171
  const destinationPackages = /* @__PURE__ */ new Set();
1336
1172
  const destinations = flowConfig.destinations;
@@ -1343,10 +1179,57 @@ function detectDestinationPackages(flowConfig) {
1343
1179
  }
1344
1180
  return destinationPackages;
1345
1181
  }
1346
- function generateImportStatements(packages, destinationPackages) {
1182
+ function detectSourcePackages(flowConfig) {
1183
+ const sourcePackages = /* @__PURE__ */ new Set();
1184
+ const sources = flowConfig.sources;
1185
+ if (sources) {
1186
+ for (const [sourceKey, sourceConfig] of Object.entries(sources)) {
1187
+ if (typeof sourceConfig === "object" && sourceConfig !== null && "package" in sourceConfig && typeof sourceConfig.package === "string") {
1188
+ sourcePackages.add(sourceConfig.package);
1189
+ }
1190
+ }
1191
+ }
1192
+ return sourcePackages;
1193
+ }
1194
+ function detectExplicitCodeImports(flowConfig) {
1195
+ const explicitCodeImports = /* @__PURE__ */ new Map();
1196
+ const destinations = flowConfig.destinations;
1197
+ if (destinations) {
1198
+ for (const [destKey, destConfig] of Object.entries(destinations)) {
1199
+ if (typeof destConfig === "object" && destConfig !== null && "package" in destConfig && typeof destConfig.package === "string" && "code" in destConfig && typeof destConfig.code === "string") {
1200
+ const isAutoGenerated = destConfig.code.startsWith("_");
1201
+ if (!isAutoGenerated) {
1202
+ if (!explicitCodeImports.has(destConfig.package)) {
1203
+ explicitCodeImports.set(destConfig.package, /* @__PURE__ */ new Set());
1204
+ }
1205
+ explicitCodeImports.get(destConfig.package).add(destConfig.code);
1206
+ }
1207
+ }
1208
+ }
1209
+ }
1210
+ const sources = flowConfig.sources;
1211
+ if (sources) {
1212
+ for (const [sourceKey, sourceConfig] of Object.entries(sources)) {
1213
+ if (typeof sourceConfig === "object" && sourceConfig !== null && "package" in sourceConfig && typeof sourceConfig.package === "string" && "code" in sourceConfig && typeof sourceConfig.code === "string") {
1214
+ const isAutoGenerated = sourceConfig.code.startsWith("_");
1215
+ if (!isAutoGenerated) {
1216
+ if (!explicitCodeImports.has(sourceConfig.package)) {
1217
+ explicitCodeImports.set(sourceConfig.package, /* @__PURE__ */ new Set());
1218
+ }
1219
+ explicitCodeImports.get(sourceConfig.package).add(sourceConfig.code);
1220
+ }
1221
+ }
1222
+ }
1223
+ }
1224
+ return explicitCodeImports;
1225
+ }
1226
+ function generateImportStatements(packages, destinationPackages, sourcePackages, explicitCodeImports) {
1347
1227
  const importStatements = [];
1348
1228
  const examplesMappings = [];
1229
+ const usedPackages = /* @__PURE__ */ new Set([...destinationPackages, ...sourcePackages]);
1349
1230
  for (const [packageName, packageConfig] of Object.entries(packages)) {
1231
+ const isUsedByDestOrSource = usedPackages.has(packageName);
1232
+ const hasExplicitCode = explicitCodeImports.has(packageName);
1350
1233
  if (packageConfig.imports && packageConfig.imports.length > 0) {
1351
1234
  const uniqueImports = [...new Set(packageConfig.imports)];
1352
1235
  const defaultImports = [];
@@ -1386,76 +1269,45 @@ function generateImportStatements(packages, destinationPackages) {
1386
1269
  );
1387
1270
  }
1388
1271
  }
1389
- } else {
1390
- const varName = packageNameToVariable(packageName);
1272
+ } else if (hasExplicitCode) {
1273
+ const codes = Array.from(explicitCodeImports.get(packageName));
1391
1274
  importStatements.push(
1392
- `import * as ${varName} from '${packageName}'; // Consider specifying explicit imports`
1275
+ `import { ${codes.join(", ")} } from '${packageName}';`
1393
1276
  );
1277
+ } else if (isUsedByDestOrSource) {
1278
+ const varName = packageNameToVariable(packageName);
1279
+ importStatements.push(`import ${varName} from '${packageName}';`);
1394
1280
  }
1395
1281
  }
1396
1282
  return { importStatements, examplesMappings };
1397
1283
  }
1398
- async function processTemplate(flowConfig, buildOptions) {
1399
- if (buildOptions.template) {
1400
- const templateEngine = new TemplateEngine();
1401
- const flowWithProps = flowConfig;
1402
- return await templateEngine.process(
1403
- buildOptions.template,
1404
- buildOptions.code || "",
1405
- // Pass user code as parameter (empty if undefined)
1406
- flowWithProps.sources || {},
1407
- flowWithProps.destinations || {},
1408
- flowWithProps.collector || {},
1409
- buildOptions
1410
- // Pass build config to template
1411
- );
1412
- } else {
1413
- return buildOptions.code || "";
1414
- }
1415
- }
1416
- function wrapCodeForFormat(code, format, hasTemplate) {
1417
- if (hasTemplate) {
1418
- return code;
1419
- }
1420
- if (format === "esm") {
1421
- const hasExport = /^\s*export\s/m.test(code);
1422
- if (!hasExport) {
1423
- return `export default ${code}`;
1424
- }
1425
- }
1426
- return code;
1427
- }
1428
- function assembleFinalCode(importStatements, examplesObject, wrappedCode, format) {
1429
- const importsCode = importStatements.join("\n");
1430
- let finalCode = importsCode ? `${importsCode}
1431
-
1432
- ${examplesObject}${wrappedCode}` : `${examplesObject}${wrappedCode}`;
1433
- if (examplesObject && format === "esm") {
1434
- finalCode += `
1435
-
1436
- export { examples };`;
1437
- }
1438
- return finalCode;
1439
- }
1440
1284
  async function createEntryPoint(flowConfig, buildOptions, packagePaths) {
1441
1285
  const destinationPackages = detectDestinationPackages(flowConfig);
1286
+ const sourcePackages = detectSourcePackages(flowConfig);
1287
+ const explicitCodeImports = detectExplicitCodeImports(flowConfig);
1442
1288
  const { importStatements } = generateImportStatements(
1443
1289
  buildOptions.packages,
1444
- destinationPackages
1445
- );
1446
- const examplesObject = "";
1447
- const templatedCode = await processTemplate(flowConfig, buildOptions);
1448
- const wrappedCode = wrapCodeForFormat(
1449
- templatedCode,
1450
- buildOptions.format,
1451
- !!buildOptions.template
1290
+ destinationPackages,
1291
+ sourcePackages,
1292
+ explicitCodeImports
1452
1293
  );
1453
- return assembleFinalCode(
1454
- importStatements,
1455
- examplesObject,
1456
- wrappedCode,
1457
- buildOptions.format
1294
+ const importsCode = importStatements.join("\n");
1295
+ const hasFlow = destinationPackages.size > 0 || sourcePackages.size > 0;
1296
+ if (!hasFlow) {
1297
+ const userCode = buildOptions.code || "";
1298
+ return importsCode ? `${importsCode}
1299
+
1300
+ ${userCode}` : userCode;
1301
+ }
1302
+ const configObject = buildConfigObject(flowConfig, explicitCodeImports);
1303
+ const wrappedCode = generatePlatformWrapper(
1304
+ configObject,
1305
+ buildOptions.code || "",
1306
+ buildOptions
1458
1307
  );
1308
+ return importsCode ? `${importsCode}
1309
+
1310
+ ${wrappedCode}` : wrappedCode;
1459
1311
  }
1460
1312
  function createBuildError(buildError, code) {
1461
1313
  if (!buildError.errors || buildError.errors.length === 0) {
@@ -1480,35 +1332,108 @@ ${firstError.text}`
1480
1332
  ` + (location ? ` at ${location.file}:${location.line}:${location.column}` : "")
1481
1333
  );
1482
1334
  }
1335
+ function buildConfigObject(flowConfig, explicitCodeImports) {
1336
+ const flowWithProps = flowConfig;
1337
+ const sources = flowWithProps.sources || {};
1338
+ const destinations = flowWithProps.destinations || {};
1339
+ const sourcesEntries = Object.entries(sources).map(([key, source]) => {
1340
+ const hasExplicitCode = source.code && explicitCodeImports.has(source.package);
1341
+ const codeVar = hasExplicitCode ? source.code : packageNameToVariable(source.package);
1342
+ const configStr = source.config ? processConfigValue(source.config) : "{}";
1343
+ const envStr = source.env ? `,
1344
+ env: ${processConfigValue(source.env)}` : "";
1345
+ return ` ${key}: {
1346
+ code: ${codeVar},
1347
+ config: ${configStr}${envStr}
1348
+ }`;
1349
+ });
1350
+ const destinationsEntries = Object.entries(destinations).map(
1351
+ ([key, dest]) => {
1352
+ const hasExplicitCode = dest.code && explicitCodeImports.has(dest.package);
1353
+ const codeVar = hasExplicitCode ? dest.code : packageNameToVariable(dest.package);
1354
+ const configStr = dest.config ? processConfigValue(dest.config) : "{}";
1355
+ const envStr = dest.env ? `,
1356
+ env: ${processConfigValue(dest.env)}` : "";
1357
+ return ` ${key}: {
1358
+ code: ${codeVar},
1359
+ config: ${configStr}${envStr}
1360
+ }`;
1361
+ }
1362
+ );
1363
+ const collectorStr = flowWithProps.collector ? `,
1364
+ ...${processConfigValue(flowWithProps.collector)}` : "";
1365
+ return `{
1366
+ sources: {
1367
+ ${sourcesEntries.join(",\n")}
1368
+ },
1369
+ destinations: {
1370
+ ${destinationsEntries.join(",\n")}
1371
+ }${collectorStr}
1372
+ }`;
1373
+ }
1374
+ function processConfigValue(value) {
1375
+ return JSON.stringify(value, null, 2);
1376
+ }
1377
+ function generatePlatformWrapper(configObject, userCode, buildOptions) {
1378
+ if (buildOptions.platform === "browser") {
1379
+ const windowAssignments = [];
1380
+ if (buildOptions.windowCollector) {
1381
+ windowAssignments.push(
1382
+ ` if (typeof window !== 'undefined') window['${buildOptions.windowCollector}'] = collector;`
1383
+ );
1384
+ }
1385
+ if (buildOptions.windowElb) {
1386
+ windowAssignments.push(
1387
+ ` if (typeof window !== 'undefined') window['${buildOptions.windowElb}'] = elb;`
1388
+ );
1389
+ }
1390
+ const assignments = windowAssignments.length > 0 ? "\n" + windowAssignments.join("\n") : "";
1391
+ return `(async () => {
1392
+ const config = ${configObject};
1393
+
1394
+ ${userCode}
1395
+
1396
+ const { collector, elb } = await startFlow(config);${assignments}
1397
+ })();`;
1398
+ } else {
1399
+ const codeSection = userCode ? `
1400
+ ${userCode}
1401
+ ` : "";
1402
+ return `export default async function(context = {}) {
1403
+ const config = ${configObject};${codeSection}
1404
+ return await startFlow(config);
1405
+ }`;
1406
+ }
1407
+ }
1483
1408
 
1484
1409
  // src/commands/bundle/stats.ts
1485
- function displayStats(stats, logger) {
1486
- logger.info("\n\u{1F4CA} Bundle Statistics");
1487
- logger.info("\u2500".repeat(50));
1410
+ function displayStats(stats, logger2) {
1411
+ logger2.info("\n\u{1F4CA} Bundle Statistics");
1412
+ logger2.info("\u2500".repeat(50));
1488
1413
  const sizeKB = formatBytes(stats.totalSize);
1489
- logger.info(`Total Size: ${sizeKB} KB`);
1414
+ logger2.info(`Total Size: ${sizeKB} KB`);
1490
1415
  const timeSeconds = (stats.buildTime / 1e3).toFixed(2);
1491
- logger.info(`Build Time: ${timeSeconds}s`);
1416
+ logger2.info(`Build Time: ${timeSeconds}s`);
1492
1417
  const treeshakingStatus = stats.treeshakingEffective ? "\u2705 Effective" : "\u26A0\uFE0F Not optimal (consider using named imports)";
1493
- logger.info(`Tree-shaking: ${treeshakingStatus}`);
1418
+ logger2.info(`Tree-shaking: ${treeshakingStatus}`);
1494
1419
  if (stats.packages.length > 0) {
1495
- logger.info(`
1420
+ logger2.info(`
1496
1421
  Package Breakdown:`);
1497
1422
  stats.packages.forEach((pkg) => {
1498
1423
  if (pkg.size > 0) {
1499
1424
  const pkgSizeKB = formatBytes(pkg.size);
1500
- logger.info(` \u2022 ${pkg.name}: ${pkgSizeKB} KB`);
1425
+ logger2.info(` \u2022 ${pkg.name}: ${pkgSizeKB} KB`);
1501
1426
  }
1502
1427
  });
1503
1428
  }
1504
- logger.info("\u2500".repeat(50));
1429
+ logger2.info("\u2500".repeat(50));
1505
1430
  }
1506
1431
 
1507
1432
  // src/commands/bundle/index.ts
1508
1433
  async function bundleCommand(options) {
1509
1434
  const timer = createTimer();
1510
1435
  timer.start();
1511
- const logger = createCommandLogger(options);
1436
+ const logger2 = createCommandLogger(options);
1512
1437
  const dockerArgs = buildCommonDockerArgs(options);
1513
1438
  if (options.flow) dockerArgs.push("--flow", options.flow);
1514
1439
  if (options.all) dockerArgs.push("--all");
@@ -1520,14 +1445,14 @@ async function bundleCommand(options) {
1520
1445
  if (options.flow && options.all) {
1521
1446
  throw new Error("Cannot use both --flow and --all flags together");
1522
1447
  }
1523
- logger.info("\u{1F4E6} Reading configuration...");
1448
+ logger2.info("\u{1F4E6} Reading configuration...");
1524
1449
  const configPath = resolveAsset(options.config, "config");
1525
1450
  const rawConfig = await loadJsonConfig(configPath);
1526
- const configsToBundle = options.all ? loadAllFlows(rawConfig, { configPath, logger }) : [
1451
+ const configsToBundle = options.all ? loadAllFlows(rawConfig, { configPath, logger: logger2 }) : [
1527
1452
  loadBundleConfig(rawConfig, {
1528
1453
  configPath,
1529
1454
  flowName: options.flow,
1530
- logger
1455
+ logger: logger2
1531
1456
  })
1532
1457
  ];
1533
1458
  const results = [];
@@ -1542,16 +1467,16 @@ async function bundleCommand(options) {
1542
1467
  buildOptions.cache = options.cache;
1543
1468
  }
1544
1469
  if (isMultiFlow || options.all) {
1545
- logger.info(`
1470
+ logger2.info(`
1546
1471
  \u{1F527} Building flow: ${flowName}`);
1547
1472
  } else {
1548
- logger.info("\u{1F527} Starting bundle process...");
1473
+ logger2.info("\u{1F527} Starting bundle process...");
1549
1474
  }
1550
1475
  const shouldCollectStats = options.stats || options.json;
1551
1476
  const stats = await bundleCore(
1552
1477
  flowConfig,
1553
1478
  buildOptions,
1554
- logger,
1479
+ logger2,
1555
1480
  shouldCollectStats
1556
1481
  );
1557
1482
  results.push({
@@ -1560,7 +1485,7 @@ async function bundleCommand(options) {
1560
1485
  stats
1561
1486
  });
1562
1487
  if (!options.json && !options.all && options.stats && stats) {
1563
- displayStats(stats, logger);
1488
+ displayStats(stats, logger2);
1564
1489
  }
1565
1490
  } catch (error) {
1566
1491
  const errorMessage = getErrorMessage(error);
@@ -1596,16 +1521,16 @@ async function bundleCommand(options) {
1596
1521
  outputLogger.log("white", JSON.stringify(output, null, 2));
1597
1522
  } else {
1598
1523
  if (options.all) {
1599
- logger.info(`
1524
+ logger2.info(`
1600
1525
  \u{1F4CA} Build Summary:`);
1601
- logger.info(` Total: ${results.length}`);
1602
- logger.success(` \u2705 Success: ${successCount}`);
1526
+ logger2.info(` Total: ${results.length}`);
1527
+ logger2.success(` \u2705 Success: ${successCount}`);
1603
1528
  if (failureCount > 0) {
1604
- logger.error(` \u274C Failed: ${failureCount}`);
1529
+ logger2.error(` \u274C Failed: ${failureCount}`);
1605
1530
  }
1606
1531
  }
1607
1532
  if (failureCount === 0) {
1608
- logger.success(
1533
+ logger2.success(
1609
1534
  `
1610
1535
  \u2705 Bundle created successfully in ${timer.format()}`
1611
1536
  );
@@ -1621,8 +1546,8 @@ async function bundleCommand(options) {
1621
1546
  const output = createErrorOutput(errorMessage, duration);
1622
1547
  outputLogger.log("white", JSON.stringify(output, null, 2));
1623
1548
  } else {
1624
- logger.error("\u274C Bundle failed:");
1625
- logger.error(errorMessage);
1549
+ logger2.error("\u274C Bundle failed:");
1550
+ logger2.error(errorMessage);
1626
1551
  }
1627
1552
  process.exit(1);
1628
1553
  }
@@ -1630,7 +1555,7 @@ async function bundleCommand(options) {
1630
1555
  "bundle",
1631
1556
  dockerArgs,
1632
1557
  options,
1633
- logger,
1558
+ logger2,
1634
1559
  options.config
1635
1560
  );
1636
1561
  }
@@ -1651,18 +1576,18 @@ async function bundle(configOrPath, options = {}) {
1651
1576
  if (options.cache !== void 0) {
1652
1577
  buildOptions.cache = options.cache;
1653
1578
  }
1654
- const logger = createCommandLogger(options);
1579
+ const logger2 = createCommandLogger(options);
1655
1580
  return await bundleCore(
1656
1581
  flowConfig,
1657
1582
  buildOptions,
1658
- logger,
1583
+ logger2,
1659
1584
  options.stats ?? false
1660
1585
  );
1661
1586
  }
1662
1587
 
1663
1588
  // src/commands/simulate/simulator.ts
1664
1589
  import path10 from "path";
1665
- import fs10 from "fs-extra";
1590
+ import fs9 from "fs-extra";
1666
1591
  import { getPlatform as getPlatform2 } from "@walkeros/core";
1667
1592
 
1668
1593
  // src/commands/simulate/tracker.ts
@@ -1745,7 +1670,7 @@ var CallTracker = class {
1745
1670
 
1746
1671
  // src/commands/simulate/jsdom-executor.ts
1747
1672
  import { JSDOM, VirtualConsole } from "jsdom";
1748
- import fs9 from "fs-extra";
1673
+ import fs8 from "fs-extra";
1749
1674
  function buildSandboxFromEnvs(envs, destinations, tracker) {
1750
1675
  const baseBrowserMocks = {
1751
1676
  Image: class MockImage {
@@ -1814,7 +1739,7 @@ async function executeInJSDOM(bundlePath, destinations, event, tracker, envs, ti
1814
1739
  const sandbox = buildSandboxFromEnvs(envs, destinations, tracker);
1815
1740
  Object.assign(window, sandbox.window);
1816
1741
  Object.assign(window.document, sandbox.document);
1817
- const bundleCode = await fs9.readFile(bundlePath, "utf8");
1742
+ const bundleCode = await fs8.readFile(bundlePath, "utf8");
1818
1743
  try {
1819
1744
  window.eval(bundleCode);
1820
1745
  } catch (error) {
@@ -1967,28 +1892,28 @@ function generateId() {
1967
1892
  return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;
1968
1893
  }
1969
1894
  async function simulateCore(configPath, event, options = {}) {
1970
- const logger = createLogger({
1895
+ const logger2 = createLogger({
1971
1896
  verbose: options.verbose || false,
1972
1897
  silent: options.silent || false,
1973
1898
  json: options.json || false
1974
1899
  });
1975
1900
  try {
1976
- logger.info("\u{1F3AF} Starting walkerOS simulation...");
1977
- logger.info("\u{1F4E6} Loading bundle configuration...");
1901
+ logger2.info("\u{1F3AF} Starting walkerOS simulation...");
1902
+ logger2.info("\u{1F4E6} Loading bundle configuration...");
1978
1903
  const fullConfigPath = path10.resolve(configPath);
1979
1904
  const rawConfig = await loadJsonConfig(fullConfigPath);
1980
1905
  loadBundleConfig(rawConfig, { configPath: fullConfigPath });
1981
- logger.info(`\u{1F680} Executing simulation with event: ${JSON.stringify(event)}`);
1906
+ logger2.info(`\u{1F680} Executing simulation with event: ${JSON.stringify(event)}`);
1982
1907
  const result = await executeSimulation(event, fullConfigPath);
1983
1908
  if (result.success) {
1984
- logger.info(`\u2705 Simulation completed successfully`);
1909
+ logger2.info(`\u2705 Simulation completed successfully`);
1985
1910
  } else {
1986
- logger.error(`\u274C Simulation failed: ${result.error}`);
1911
+ logger2.error(`\u274C Simulation failed: ${result.error}`);
1987
1912
  }
1988
1913
  return result;
1989
1914
  } catch (error) {
1990
1915
  const errorMessage = getErrorMessage(error);
1991
- logger.error(`\u{1F4A5} Simulation error: ${errorMessage}`);
1916
+ logger2.error(`\u{1F4A5} Simulation error: ${errorMessage}`);
1992
1917
  return {
1993
1918
  success: false,
1994
1919
  error: errorMessage
@@ -2021,7 +1946,7 @@ async function executeSimulation(event, configPath) {
2021
1946
  );
2022
1947
  }
2023
1948
  const typedEvent = event;
2024
- await fs10.ensureDir(tempDir);
1949
+ await fs9.ensureDir(tempDir);
2025
1950
  const rawConfig = await loadJsonConfig(configPath);
2026
1951
  const { flowConfig, buildOptions } = loadBundleConfig(rawConfig, {
2027
1952
  configPath
@@ -2095,7 +2020,7 @@ async function executeSimulation(event, configPath) {
2095
2020
  };
2096
2021
  } finally {
2097
2022
  if (tempDir) {
2098
- await fs10.remove(tempDir).catch(() => {
2023
+ await fs9.remove(tempDir).catch(() => {
2099
2024
  });
2100
2025
  }
2101
2026
  }
@@ -2103,7 +2028,7 @@ async function executeSimulation(event, configPath) {
2103
2028
 
2104
2029
  // src/commands/simulate/index.ts
2105
2030
  async function simulateCommand(options) {
2106
- const logger = createCommandLogger(options);
2031
+ const logger2 = createCommandLogger(options);
2107
2032
  const dockerArgs = buildCommonDockerArgs(options);
2108
2033
  if (options.event) dockerArgs.push("--event", options.event);
2109
2034
  await executeCommand(
@@ -2154,7 +2079,7 @@ async function simulateCommand(options) {
2154
2079
  "simulate",
2155
2080
  dockerArgs,
2156
2081
  options,
2157
- logger,
2082
+ logger2,
2158
2083
  options.config
2159
2084
  );
2160
2085
  }
@@ -2173,11 +2098,11 @@ async function simulate(configOrPath, event, options = {}) {
2173
2098
  // src/commands/push/index.ts
2174
2099
  import path11 from "path";
2175
2100
  import { JSDOM as JSDOM2, VirtualConsole as VirtualConsole2 } from "jsdom";
2176
- import fs11 from "fs-extra";
2101
+ import fs10 from "fs-extra";
2177
2102
  import { getPlatform as getPlatform3 } from "@walkeros/core";
2178
2103
  import { schemas as schemas2 } from "@walkeros/core/dev";
2179
2104
  async function pushCommand(options) {
2180
- const logger = createCommandLogger(options);
2105
+ const logger2 = createCommandLogger(options);
2181
2106
  const dockerArgs = buildCommonDockerArgs(options);
2182
2107
  dockerArgs.push("--event", options.event);
2183
2108
  if (options.flow) dockerArgs.push("--flow", options.flow);
@@ -2185,7 +2110,7 @@ async function pushCommand(options) {
2185
2110
  async () => {
2186
2111
  const startTime = Date.now();
2187
2112
  try {
2188
- logger.info("\u{1F4E5} Loading event...");
2113
+ logger2.info("\u{1F4E5} Loading event...");
2189
2114
  const event = await loadJsonFromSource(options.event, {
2190
2115
  name: "event"
2191
2116
  });
@@ -2203,27 +2128,27 @@ async function pushCommand(options) {
2203
2128
  data: parsedEvent.data || {}
2204
2129
  };
2205
2130
  if (!validatedEvent.name.includes(" ")) {
2206
- logger.warn(
2131
+ logger2.warn(
2207
2132
  `Event name "${validatedEvent.name}" should follow "ENTITY ACTION" format (e.g., "page view")`
2208
2133
  );
2209
2134
  }
2210
- logger.info("\u{1F4E6} Loading flow configuration...");
2135
+ logger2.info("\u{1F4E6} Loading flow configuration...");
2211
2136
  const configPath = path11.resolve(options.config);
2212
2137
  const rawConfig = await loadJsonConfig(configPath);
2213
2138
  const { flowConfig, buildOptions, flowName, isMultiFlow } = loadBundleConfig(rawConfig, {
2214
2139
  configPath: options.config,
2215
2140
  flowName: options.flow,
2216
- logger
2141
+ logger: logger2
2217
2142
  });
2218
2143
  const platform = getPlatform3(flowConfig);
2219
- logger.info("\u{1F528} Bundling flow configuration...");
2144
+ logger2.info("\u{1F528} Bundling flow configuration...");
2220
2145
  const configDir = path11.dirname(configPath);
2221
2146
  const tempDir = path11.join(
2222
2147
  configDir,
2223
2148
  ".tmp",
2224
2149
  `push-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
2225
2150
  );
2226
- await fs11.ensureDir(tempDir);
2151
+ await fs10.ensureDir(tempDir);
2227
2152
  const tempPath = path11.join(
2228
2153
  tempDir,
2229
2154
  `bundle.${platform === "web" ? "js" : "mjs"}`
@@ -2239,15 +2164,15 @@ async function pushCommand(options) {
2239
2164
  windowElb: "elb"
2240
2165
  }
2241
2166
  };
2242
- await bundleCore(flowConfig, pushBuildOptions, logger, false);
2243
- logger.debug(`Bundle created: ${tempPath}`);
2167
+ await bundleCore(flowConfig, pushBuildOptions, logger2, false);
2168
+ logger2.debug(`Bundle created: ${tempPath}`);
2244
2169
  let result;
2245
2170
  if (platform === "web") {
2246
- logger.info("\u{1F310} Executing in web environment (JSDOM)...");
2247
- result = await executeWebPush(tempPath, validatedEvent, logger);
2171
+ logger2.info("\u{1F310} Executing in web environment (JSDOM)...");
2172
+ result = await executeWebPush(tempPath, validatedEvent, logger2);
2248
2173
  } else if (platform === "server") {
2249
- logger.info("\u{1F5A5}\uFE0F Executing in server environment (Node.js)...");
2250
- result = await executeServerPush(tempPath, validatedEvent, logger);
2174
+ logger2.info("\u{1F5A5}\uFE0F Executing in server environment (Node.js)...");
2175
+ result = await executeServerPush(tempPath, validatedEvent, logger2);
2251
2176
  } else {
2252
2177
  throw new Error(`Unsupported platform: ${platform}`);
2253
2178
  }
@@ -2268,27 +2193,27 @@ async function pushCommand(options) {
2268
2193
  );
2269
2194
  } else {
2270
2195
  if (result.success) {
2271
- logger.success("\u2705 Event pushed successfully");
2196
+ logger2.success("\u2705 Event pushed successfully");
2272
2197
  if (result.elbResult && typeof result.elbResult === "object") {
2273
2198
  const pushResult = result.elbResult;
2274
2199
  if ("id" in pushResult && pushResult.id) {
2275
- logger.info(` Event ID: ${pushResult.id}`);
2200
+ logger2.info(` Event ID: ${pushResult.id}`);
2276
2201
  }
2277
2202
  if ("entity" in pushResult && pushResult.entity) {
2278
- logger.info(` Entity: ${pushResult.entity}`);
2203
+ logger2.info(` Entity: ${pushResult.entity}`);
2279
2204
  }
2280
2205
  if ("action" in pushResult && pushResult.action) {
2281
- logger.info(` Action: ${pushResult.action}`);
2206
+ logger2.info(` Action: ${pushResult.action}`);
2282
2207
  }
2283
2208
  }
2284
- logger.info(` Duration: ${duration}ms`);
2209
+ logger2.info(` Duration: ${duration}ms`);
2285
2210
  } else {
2286
- logger.error(`\u274C Push failed: ${result.error}`);
2211
+ logger2.error(`\u274C Push failed: ${result.error}`);
2287
2212
  process.exit(1);
2288
2213
  }
2289
2214
  }
2290
2215
  try {
2291
- await fs11.remove(tempDir);
2216
+ await fs10.remove(tempDir);
2292
2217
  } catch {
2293
2218
  }
2294
2219
  } catch (error) {
@@ -2309,7 +2234,7 @@ async function pushCommand(options) {
2309
2234
  )
2310
2235
  );
2311
2236
  } else {
2312
- logger.error(`\u274C Push command failed: ${errorMessage}`);
2237
+ logger2.error(`\u274C Push command failed: ${errorMessage}`);
2313
2238
  }
2314
2239
  process.exit(1);
2315
2240
  }
@@ -2317,11 +2242,11 @@ async function pushCommand(options) {
2317
2242
  "push",
2318
2243
  dockerArgs,
2319
2244
  options,
2320
- logger,
2245
+ logger2,
2321
2246
  options.config
2322
2247
  );
2323
2248
  }
2324
- async function executeWebPush(bundlePath, event, logger) {
2249
+ async function executeWebPush(bundlePath, event, logger2) {
2325
2250
  const startTime = Date.now();
2326
2251
  try {
2327
2252
  const virtualConsole = new VirtualConsole2();
@@ -2332,10 +2257,10 @@ async function executeWebPush(bundlePath, event, logger) {
2332
2257
  virtualConsole
2333
2258
  });
2334
2259
  const { window } = dom;
2335
- logger.debug("Loading bundle...");
2336
- const bundleCode = await fs11.readFile(bundlePath, "utf8");
2260
+ logger2.debug("Loading bundle...");
2261
+ const bundleCode = await fs10.readFile(bundlePath, "utf8");
2337
2262
  window.eval(bundleCode);
2338
- logger.debug("Waiting for elb...");
2263
+ logger2.debug("Waiting for elb...");
2339
2264
  await waitForWindowProperty2(
2340
2265
  window,
2341
2266
  "elb",
@@ -2343,7 +2268,7 @@ async function executeWebPush(bundlePath, event, logger) {
2343
2268
  );
2344
2269
  const windowObj = window;
2345
2270
  const elb = windowObj.elb;
2346
- logger.info(`Pushing event: ${event.name}`);
2271
+ logger2.info(`Pushing event: ${event.name}`);
2347
2272
  const elbResult = await elb(event.name, event.data);
2348
2273
  return {
2349
2274
  success: true,
@@ -2358,7 +2283,7 @@ async function executeWebPush(bundlePath, event, logger) {
2358
2283
  };
2359
2284
  }
2360
2285
  }
2361
- async function executeServerPush(bundlePath, event, logger, timeout = 6e4) {
2286
+ async function executeServerPush(bundlePath, event, logger2, timeout = 6e4) {
2362
2287
  const startTime = Date.now();
2363
2288
  try {
2364
2289
  const timeoutPromise = new Promise((_, reject) => {
@@ -2368,12 +2293,12 @@ async function executeServerPush(bundlePath, event, logger, timeout = 6e4) {
2368
2293
  );
2369
2294
  });
2370
2295
  const executePromise = (async () => {
2371
- logger.debug("Importing bundle...");
2296
+ logger2.debug("Importing bundle...");
2372
2297
  const flowModule = await import(bundlePath);
2373
2298
  if (!flowModule.default || typeof flowModule.default !== "function") {
2374
2299
  throw new Error("Bundle does not export default factory function");
2375
2300
  }
2376
- logger.debug("Calling factory function...");
2301
+ logger2.debug("Calling factory function...");
2377
2302
  const result = await flowModule.default();
2378
2303
  if (!result || !result.elb || typeof result.elb !== "function") {
2379
2304
  throw new Error(
@@ -2381,7 +2306,7 @@ async function executeServerPush(bundlePath, event, logger, timeout = 6e4) {
2381
2306
  );
2382
2307
  }
2383
2308
  const { elb } = result;
2384
- logger.info(`Pushing event: ${event.name}`);
2309
+ logger2.info(`Pushing event: ${event.name}`);
2385
2310
  const elbResult = await elb(event.name, event.data);
2386
2311
  return {
2387
2312
  success: true,
@@ -2474,7 +2399,7 @@ function validatePort(port) {
2474
2399
 
2475
2400
  // src/commands/run/utils.ts
2476
2401
  import path12 from "path";
2477
- import fs12 from "fs-extra";
2402
+ import fs11 from "fs-extra";
2478
2403
  async function prepareBundleForRun(configPath, options) {
2479
2404
  const configDir = path12.dirname(path12.resolve(configPath));
2480
2405
  const tempDir = path12.join(
@@ -2482,7 +2407,7 @@ async function prepareBundleForRun(configPath, options) {
2482
2407
  ".tmp",
2483
2408
  `run-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`
2484
2409
  );
2485
- await fs12.ensureDir(tempDir);
2410
+ await fs11.ensureDir(tempDir);
2486
2411
  const tempPath = path12.join(tempDir, "bundle.mjs");
2487
2412
  await bundle(configPath, {
2488
2413
  cache: true,
@@ -2501,7 +2426,10 @@ function isPreBuiltConfig(configPath) {
2501
2426
  }
2502
2427
 
2503
2428
  // src/commands/run/execution.ts
2429
+ import { createLogger as createLogger2, Level } from "@walkeros/core";
2504
2430
  import { runFlow, runServeMode } from "@walkeros/docker";
2431
+ var logLevel = process.env.VERBOSE === "true" ? Level.DEBUG : Level.INFO;
2432
+ var logger = createLogger2({ level: logLevel });
2505
2433
  async function executeRunLocal(mode, flowPath, options) {
2506
2434
  switch (mode) {
2507
2435
  case "collect": {
@@ -2512,7 +2440,7 @@ async function executeRunLocal(mode, flowPath, options) {
2512
2440
  port: options.port,
2513
2441
  host: options.host
2514
2442
  };
2515
- await runFlow(flowPath, config);
2443
+ await runFlow(flowPath, config, logger.scope("runner"));
2516
2444
  break;
2517
2445
  }
2518
2446
  case "serve": {
@@ -2521,9 +2449,9 @@ async function executeRunLocal(mode, flowPath, options) {
2521
2449
  host: options.host,
2522
2450
  serveName: options.serveName,
2523
2451
  servePath: options.servePath,
2524
- filePath: flowPath || void 0
2452
+ file: flowPath || void 0
2525
2453
  };
2526
- await runServeMode(config);
2454
+ await runServeMode(config, logger.scope("serve"));
2527
2455
  break;
2528
2456
  }
2529
2457
  default:
@@ -2535,7 +2463,7 @@ async function executeRunLocal(mode, flowPath, options) {
2535
2463
  async function runCommand(mode, options) {
2536
2464
  const timer = createTimer();
2537
2465
  timer.start();
2538
- const logger = createCommandLogger(options);
2466
+ const logger2 = createCommandLogger(options);
2539
2467
  try {
2540
2468
  validateMode(mode);
2541
2469
  const configPath = validateFlowFile(options.config);
@@ -2548,29 +2476,29 @@ async function runCommand(mode, options) {
2548
2476
  if (isPreBuilt) {
2549
2477
  flowPath = path13.resolve(configPath);
2550
2478
  if (!options.json && !options.silent) {
2551
- logger.info(`\u{1F4E6} Using pre-built flow: ${path13.basename(flowPath)}`);
2479
+ logger2.info(`\u{1F4E6} Using pre-built flow: ${path13.basename(flowPath)}`);
2552
2480
  }
2553
2481
  } else {
2554
2482
  if (!options.json && !options.silent) {
2555
- logger.info("\u{1F528} Building flow bundle...");
2483
+ logger2.info("\u{1F528} Building flow bundle...");
2556
2484
  }
2557
2485
  flowPath = await prepareBundleForRun(configPath, {
2558
2486
  verbose: options.verbose,
2559
2487
  silent: options.json || options.silent
2560
2488
  });
2561
2489
  if (!options.json && !options.silent) {
2562
- logger.success("\u2705 Bundle ready");
2490
+ logger2.success("\u2705 Bundle ready");
2563
2491
  }
2564
2492
  }
2565
2493
  }
2566
2494
  const executionMode = getExecutionMode(options);
2567
2495
  if (options.dryRun) {
2568
2496
  if (executionMode === "docker") {
2569
- logger.info(
2497
+ logger2.info(
2570
2498
  `[DRY-RUN] Would execute in Docker: run ${mode} with runtime image`
2571
2499
  );
2572
2500
  } else {
2573
- logger.info(`[DRY-RUN] Would execute locally: run ${mode}`);
2501
+ logger2.info(`[DRY-RUN] Would execute locally: run ${mode}`);
2574
2502
  }
2575
2503
  return;
2576
2504
  }
@@ -2582,7 +2510,7 @@ async function runCommand(mode, options) {
2582
2510
  );
2583
2511
  }
2584
2512
  if (!options.json && !options.silent) {
2585
- logger.info("\u{1F433} Executing in production runtime container...");
2513
+ logger2.info("\u{1F433} Executing in production runtime container...");
2586
2514
  }
2587
2515
  await executeRunInDocker(mode, flowPath, {
2588
2516
  port: options.port,
@@ -2594,7 +2522,7 @@ async function runCommand(mode, options) {
2594
2522
  } else {
2595
2523
  if (!options.json && !options.silent) {
2596
2524
  const modeLabel = mode === "collect" ? "Collector" : "Server";
2597
- logger.info(`\u{1F5A5}\uFE0F Starting ${modeLabel} locally...`);
2525
+ logger2.info(`\u{1F5A5}\uFE0F Starting ${modeLabel} locally...`);
2598
2526
  }
2599
2527
  await executeRunLocal(mode, flowPath, {
2600
2528
  port: options.port,
@@ -2615,8 +2543,8 @@ async function runCommand(mode, options) {
2615
2543
  };
2616
2544
  console.log(JSON.stringify(output, null, 2));
2617
2545
  } else {
2618
- logger.error("\u274C Run failed:");
2619
- logger.error(errorMessage);
2546
+ logger2.error("\u274C Run failed:");
2547
+ logger2.error(errorMessage);
2620
2548
  }
2621
2549
  process.exit(1);
2622
2550
  }
@@ -2666,20 +2594,20 @@ async function run(mode, options) {
2666
2594
  }
2667
2595
 
2668
2596
  // src/commands/cache.ts
2669
- import fs13 from "fs-extra";
2597
+ import fs12 from "fs-extra";
2670
2598
  import path14 from "path";
2671
2599
  var CACHE_DIR = path14.join(".tmp", "cache");
2672
2600
  function registerCacheCommand(program2) {
2673
2601
  const cache = program2.command("cache").description("Manage the CLI cache");
2674
2602
  cache.command("clear").description("Clear all cached packages and builds").option("--packages", "Clear only package cache").option("--builds", "Clear only build cache").action(async (options) => {
2675
2603
  if (options.packages) {
2676
- await fs13.remove(path14.join(CACHE_DIR, "packages"));
2604
+ await fs12.remove(path14.join(CACHE_DIR, "packages"));
2677
2605
  console.log("Package cache cleared");
2678
2606
  } else if (options.builds) {
2679
- await fs13.remove(path14.join(CACHE_DIR, "builds"));
2607
+ await fs12.remove(path14.join(CACHE_DIR, "builds"));
2680
2608
  console.log("Build cache cleared");
2681
2609
  } else {
2682
- await fs13.remove(CACHE_DIR);
2610
+ await fs12.remove(CACHE_DIR);
2683
2611
  console.log("All caches cleared");
2684
2612
  }
2685
2613
  });
@@ -2694,8 +2622,8 @@ function registerCacheCommand(program2) {
2694
2622
  });
2695
2623
  }
2696
2624
  async function countEntries(dir) {
2697
- if (!await fs13.pathExists(dir)) return 0;
2698
- const entries = await fs13.readdir(dir);
2625
+ if (!await fs12.pathExists(dir)) return 0;
2626
+ const entries = await fs12.readdir(dir);
2699
2627
  return entries.length;
2700
2628
  }
2701
2629
 
@@ -2708,6 +2636,13 @@ var packageJson = JSON.parse(
2708
2636
  var VERSION = packageJson.version;
2709
2637
  var program = new Command();
2710
2638
  program.name("walkeros").description("walkerOS CLI - Bundle and deploy walkerOS components").version(VERSION);
2639
+ program.hook("preAction", (thisCommand, actionCommand) => {
2640
+ const options = actionCommand.opts();
2641
+ if (!options.silent && !options.json) {
2642
+ console.log(`\u{1F680} walkerOS CLI v${VERSION}`);
2643
+ console.log(`\u{1F433} Using Docker runtime: walkeros/docker:${DOCKER_VERSION2}`);
2644
+ }
2645
+ });
2711
2646
  program.command("bundle [file]").description("Bundle NPM packages with custom code").option("-f, --flow <name>", "flow to build (for multi-flow configs)").option("--all", "build all flows (for multi-flow configs)").option("-s, --stats", "show bundle statistics").option("--json", "output statistics in JSON format (implies --stats)").option("--no-cache", "disable package caching and download fresh packages").option("-v, --verbose", "verbose output").option("--local", "execute in local Node.js instead of Docker").option("--dry-run", "preview command without executing").option("--silent", "suppress output").action(async (file, options) => {
2712
2647
  await bundleCommand({
2713
2648
  config: file || "bundle.config.json",