@ultrst-armada/krnl 1.0.1 → 1.0.3

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 (235) hide show
  1. package/README.md +67 -65
  2. package/package.json +13 -9
  3. package/packages/cli/dist/bin/krnl.cjs +1535 -9508
  4. package/packages/cli/dist/bin/krnl.js +55 -1915
  5. package/packages/cli/dist/chunk-6SHSECXR.js +1628 -0
  6. package/packages/cli/dist/index.cjs +1244 -7373
  7. package/packages/cli/dist/index.d.cts +45 -2
  8. package/packages/cli/dist/index.d.ts +45 -2
  9. package/packages/cli/dist/index.js +5 -20
  10. package/packages/cli/package.json +17 -10
  11. package/packages/core/dist/index.cjs +3039 -141
  12. package/packages/core/dist/index.d.cts +633 -27
  13. package/packages/core/dist/index.d.ts +633 -27
  14. package/packages/core/dist/index.js +3028 -139
  15. package/packages/core/package.json +15 -7
  16. package/packages/create-krnl/dist/index.cjs +322 -316
  17. package/packages/create-krnl/dist/index.js +322 -316
  18. package/packages/create-krnl/package.json +5 -3
  19. package/packages/eslint-plugin/dist/index.cjs +17 -55
  20. package/packages/eslint-plugin/dist/index.d.cts +8 -43
  21. package/packages/eslint-plugin/dist/index.d.ts +8 -43
  22. package/packages/eslint-plugin/dist/index.js +17 -55
  23. package/packages/eslint-plugin/package.json +5 -4
  24. package/packages/validate/dist/index.cjs +692 -361
  25. package/packages/validate/dist/index.d.cts +12 -14
  26. package/packages/validate/dist/index.d.ts +12 -14
  27. package/packages/validate/dist/index.js +692 -361
  28. package/packages/validate/package.json +14 -7
  29. package/packages/cli/dist/K_ENT_Entity-PQ5MURQY-ZG6FZXXX.js +0 -13
  30. package/packages/cli/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-K4CRQYA5.js +0 -8
  31. package/packages/cli/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-LNPXZYOE.js +0 -110
  32. package/packages/cli/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-3ALZPNX4.js +0 -11
  33. package/packages/cli/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-PJTICYSW.js +0 -11
  34. package/packages/cli/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-M5TYU55O.js +0 -8
  35. package/packages/cli/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-H6STOXRK.js +0 -20
  36. package/packages/cli/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-XPJXSF7D.js +0 -19
  37. package/packages/cli/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-CUYGTWOW.js +0 -7
  38. package/packages/cli/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-VR6T4N6J.js +0 -17
  39. package/packages/cli/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-RLJ4QWDP.js +0 -58
  40. package/packages/cli/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-BOQGUASC.js +0 -22
  41. package/packages/cli/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-XJI7KIT5.js +0 -8
  42. package/packages/cli/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-K5VCWAFW.js +0 -9
  43. package/packages/cli/dist/chunk-3TRM6CYL.js +0 -152
  44. package/packages/cli/dist/chunk-5JDK35TG.js +0 -3872
  45. package/packages/cli/dist/chunk-63PTK33I.js +0 -997
  46. package/packages/cli/dist/chunk-6NIKAMUZ.js +0 -82
  47. package/packages/cli/dist/chunk-BOXWWXQG.js +0 -400
  48. package/packages/cli/dist/chunk-EEKLK7QJ.js +0 -565
  49. package/packages/cli/dist/chunk-EG7T2IAD.js +0 -107
  50. package/packages/cli/dist/chunk-F5EHXE2O.js +0 -1036
  51. package/packages/cli/dist/chunk-F65ANSQG.js +0 -269
  52. package/packages/cli/dist/chunk-FDNCADFE.js +0 -71
  53. package/packages/cli/dist/chunk-GDLRMDAN.js +0 -127
  54. package/packages/cli/dist/chunk-HWMTCMOS.js +0 -656
  55. package/packages/cli/dist/chunk-I74QIQOD.js +0 -5536
  56. package/packages/cli/dist/chunk-JTLSTO25.js +0 -71
  57. package/packages/cli/dist/chunk-JULBBJ27.js +0 -1033
  58. package/packages/cli/dist/chunk-OHVMVRBP.js +0 -117
  59. package/packages/cli/dist/chunk-P2PCLEKX.js +0 -666
  60. package/packages/cli/dist/chunk-PJQIUOX2.js +0 -7767
  61. package/packages/cli/dist/chunk-PPOF3DJW.js +0 -471
  62. package/packages/cli/dist/chunk-Q45257P6.js +0 -173
  63. package/packages/cli/dist/chunk-QNROWGBI.js +0 -1036
  64. package/packages/cli/dist/chunk-RJNYUXZD.js +0 -977
  65. package/packages/cli/dist/chunk-SRTOPJ5W.js +0 -104
  66. package/packages/cli/dist/chunk-TCEX3MPS.js +0 -702
  67. package/packages/cli/dist/chunk-TNOAJO2J.js +0 -675
  68. package/packages/cli/dist/chunk-UR2SUCSF.js +0 -701
  69. package/packages/cli/dist/chunk-X5LOIFM7.js +0 -68
  70. package/packages/cli/dist/chunk-XIRFOO3H.js +0 -589
  71. package/packages/cli/dist/chunk-ZAAV3JXQ.js +0 -809
  72. package/packages/core/dist/K_ENT_Entity-4MB7CU4A.js +0 -12
  73. package/packages/core/dist/K_ENT_Entity-DEJGIDGH.js +0 -12
  74. package/packages/core/dist/K_ENT_Entity-FXZO5UZ2.js +0 -12
  75. package/packages/core/dist/K_ENT_Entity-HDSCXC5F.js +0 -12
  76. package/packages/core/dist/K_ENT_Entity-JILABHLW.js +0 -12
  77. package/packages/core/dist/K_ENT_Entity-PQ5MURQY.js +0 -13
  78. package/packages/core/dist/K_ENT_Entity-ROAKDIHW.js +0 -12
  79. package/packages/core/dist/K_ENT_Entity-TBVFSKDV.js +0 -12
  80. package/packages/core/dist/K_ENT_Entity-ZFLKG3JO.js +0 -12
  81. package/packages/core/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW.js +0 -8
  82. package/packages/core/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF.js +0 -110
  83. package/packages/core/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF.js +0 -9
  84. package/packages/core/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X.js +0 -9
  85. package/packages/core/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW.js +0 -8
  86. package/packages/core/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2.js +0 -20
  87. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-4C6GBQAG.js +0 -18
  88. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-6V23A6F6.js +0 -18
  89. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK.js +0 -19
  90. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-DYLLC5G2.js +0 -18
  91. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-F4FOFAUP.js +0 -18
  92. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-FBOXXMI3.js +0 -18
  93. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-Q73BWLNP.js +0 -18
  94. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QM2C4MVA.js +0 -18
  95. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-QUGI6SMP.js +0 -18
  96. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RGMTBHNP.js +0 -18
  97. package/packages/core/dist/K_LIB_Krnl_SubApp_Registry-RWR7UNDW.js +0 -18
  98. package/packages/core/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7.js +0 -7
  99. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-32MFJJ5Z.js +0 -17
  100. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-4J4CEWRY.js +0 -17
  101. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-A366YHF2.js +0 -17
  102. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-LK4LYJHI.js +0 -17
  103. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU.js +0 -17
  104. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-NW3K63II.js +0 -17
  105. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-QDHTI5ZV.js +0 -17
  106. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-VHCT6VIW.js +0 -17
  107. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-WBRKF24R.js +0 -17
  108. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-XKYQYT6Q.js +0 -17
  109. package/packages/core/dist/K_LIB_Krnl_System_App_Adapter-Z2PWZYDZ.js +0 -17
  110. package/packages/core/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5.js +0 -58
  111. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-2EZU7QF4.js +0 -21
  112. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-6G3AQNAV.js +0 -21
  113. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-B2NZMQUG.js +0 -21
  114. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-C2RABMZP.js +0 -21
  115. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-HHE3NZ4F.js +0 -21
  116. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-LHFGR6WK.js +0 -21
  117. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-M74BLM3N.js +0 -21
  118. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-PT6ZA6EA.js +0 -21
  119. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-SP52V3CX.js +0 -21
  120. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF.js +0 -22
  121. package/packages/core/dist/K_LIB_Krnl_System_Magnetic_Loader-YNSEUHJJ.js +0 -21
  122. package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-M6SBHIVA.js +0 -8
  123. package/packages/core/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG.js +0 -8
  124. package/packages/core/dist/K_LIB_Krnl_Telemetry-77FRZ3KV.js +0 -9
  125. package/packages/core/dist/chunk-33L2J7V7.js +0 -82
  126. package/packages/core/dist/chunk-3ES4K2ZP.js +0 -817
  127. package/packages/core/dist/chunk-3SMHVVLL.js +0 -82
  128. package/packages/core/dist/chunk-3UEZ7JQA.js +0 -4877
  129. package/packages/core/dist/chunk-3XIE6KBD.js +0 -4877
  130. package/packages/core/dist/chunk-46ZLCML6.js +0 -107
  131. package/packages/core/dist/chunk-4UEL3DWJ.js +0 -107
  132. package/packages/core/dist/chunk-54GWZ5PC.js +0 -82
  133. package/packages/core/dist/chunk-6QCYRS5L.js +0 -127
  134. package/packages/core/dist/chunk-6ULMHNXR.js +0 -104
  135. package/packages/core/dist/chunk-7WUETJEV.js +0 -117
  136. package/packages/core/dist/chunk-A5KRAYDB.js +0 -107
  137. package/packages/core/dist/chunk-ANEAZ3PO.js +0 -107
  138. package/packages/core/dist/chunk-BE76RL6F.js +0 -82
  139. package/packages/core/dist/chunk-CIARVYDO.js +0 -107
  140. package/packages/core/dist/chunk-CR2ANE62.js +0 -107
  141. package/packages/core/dist/chunk-DI27MOR7.js +0 -173
  142. package/packages/core/dist/chunk-E6RLFHM5.js +0 -596
  143. package/packages/core/dist/chunk-EELAPMNV.js +0 -4877
  144. package/packages/core/dist/chunk-ENZ2RQVJ.js +0 -107
  145. package/packages/core/dist/chunk-F2U6CX4F.js +0 -4877
  146. package/packages/core/dist/chunk-FKG64OHL.js +0 -82
  147. package/packages/core/dist/chunk-FYAZJYM5.js +0 -772
  148. package/packages/core/dist/chunk-G4NP4RDQ.js +0 -82
  149. package/packages/core/dist/chunk-GADIRLRS.js +0 -473
  150. package/packages/core/dist/chunk-GR6CSLQJ.js +0 -772
  151. package/packages/core/dist/chunk-HDS7AT6O.js +0 -772
  152. package/packages/core/dist/chunk-HIMEZUU2.js +0 -71
  153. package/packages/core/dist/chunk-IB4UHG5I.js +0 -596
  154. package/packages/core/dist/chunk-J7ZYNVRS.js +0 -772
  155. package/packages/core/dist/chunk-JVLZU4K7.js +0 -604
  156. package/packages/core/dist/chunk-JYXXI7Q3.js +0 -82
  157. package/packages/core/dist/chunk-K54K2KZW.js +0 -192
  158. package/packages/core/dist/chunk-K6VHLBNH.js +0 -3316
  159. package/packages/core/dist/chunk-KCBP7ZYA.js +0 -596
  160. package/packages/core/dist/chunk-KFQGP6VL.js +0 -33
  161. package/packages/core/dist/chunk-KIUEUI7K.js +0 -82
  162. package/packages/core/dist/chunk-LB67NIZP.js +0 -949
  163. package/packages/core/dist/chunk-LDTYFUNW.js +0 -596
  164. package/packages/core/dist/chunk-MLVWARD4.js +0 -596
  165. package/packages/core/dist/chunk-MPYVXHKO.js +0 -2777
  166. package/packages/core/dist/chunk-MRQ3MITU.js +0 -772
  167. package/packages/core/dist/chunk-MVUN7I7O.js +0 -107
  168. package/packages/core/dist/chunk-NDDOIRW7.js +0 -596
  169. package/packages/core/dist/chunk-O3KDB5MH.js +0 -3330
  170. package/packages/core/dist/chunk-OEINUDSE.js +0 -400
  171. package/packages/core/dist/chunk-OPDENPT4.js +0 -4877
  172. package/packages/core/dist/chunk-P6XEM2LA.js +0 -429
  173. package/packages/core/dist/chunk-QKMRSQV4.js +0 -82
  174. package/packages/core/dist/chunk-R6CCWALL.js +0 -4877
  175. package/packages/core/dist/chunk-RAMMOO73.js +0 -774
  176. package/packages/core/dist/chunk-S3FTZFG6.js +0 -772
  177. package/packages/core/dist/chunk-T2ZVN434.js +0 -4877
  178. package/packages/core/dist/chunk-TFHLDMIA.js +0 -107
  179. package/packages/core/dist/chunk-TI3QUCIJ.js +0 -107
  180. package/packages/core/dist/chunk-TR2BAIGI.js +0 -107
  181. package/packages/core/dist/chunk-UGVVJKC6.js +0 -4877
  182. package/packages/core/dist/chunk-V2DX7YIU.js +0 -984
  183. package/packages/core/dist/chunk-W4IHYUYD.js +0 -772
  184. package/packages/core/dist/chunk-W6WBG5OY.js +0 -4877
  185. package/packages/core/dist/chunk-WN3M7O7H.js +0 -3312
  186. package/packages/core/dist/chunk-WR3NCU7U.js +0 -4877
  187. package/packages/core/dist/chunk-XC6B6L27.js +0 -82
  188. package/packages/core/dist/chunk-XNSE64ZY.js +0 -3316
  189. package/packages/core/dist/chunk-XROES2WN.js +0 -634
  190. package/packages/core/dist/chunk-XSCKNRCZ.js +0 -5020
  191. package/packages/core/dist/chunk-XVABPAUZ.js +0 -82
  192. package/packages/core/dist/chunk-YOBCB5C5.js +0 -596
  193. package/packages/core/dist/chunk-YUK6Q563.js +0 -666
  194. package/packages/core/dist/chunk-YXGL3ZEU.js +0 -1030
  195. package/packages/core/dist/chunk-ZINJ5OUX.js +0 -596
  196. package/packages/core/dist/chunk-ZPFD4BIQ.js +0 -604
  197. package/packages/core/dist/chunk-ZQZBFG6F.js +0 -4826
  198. package/packages/core/dist/chunk-ZZFRJGXM.js +0 -4877
  199. package/packages/create-krnl/dist/K_ENT_Entity-PQ5MURQY-R2OH4VXE.js +0 -14
  200. package/packages/create-krnl/dist/K_LIB_Krnl_Aiko_Client-OPZAVZCW-AZM5HF4M.js +0 -9
  201. package/packages/create-krnl/dist/K_LIB_Krnl_Ep_Tools-ROOE2TQF-X5N6SV2S.js +0 -111
  202. package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Builder-2ZDUH6PF-5PFHF4JU.js +0 -12
  203. package/packages/create-krnl/dist/K_LIB_Krnl_Frontend_Generator-UYNRNX2X-ED33OQPH.js +0 -12
  204. package/packages/create-krnl/dist/K_LIB_Krnl_Registry_Client-NXV6D2QW-YGQLVR4P.js +0 -9
  205. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Engine-7HR5HWW2-VM7CTU2L.js +0 -21
  206. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Registry-7XYGDKJK-Y2GQFJ7I.js +0 -21
  207. package/packages/create-krnl/dist/K_LIB_Krnl_SubApp_Worker_Host-CQVTGGG7-L3JQWO54.js +0 -8
  208. package/packages/create-krnl/dist/K_LIB_Krnl_System_App_Adapter-M6FJKLGU-KQARASPR.js +0 -19
  209. package/packages/create-krnl/dist/K_LIB_Krnl_System_Base_Functionality_APIs-ZZUZ6ZG5-OF3IGLVL.js +0 -59
  210. package/packages/create-krnl/dist/K_LIB_Krnl_System_Magnetic_Loader-XBQO2KXF-JOLHKOEX.js +0 -24
  211. package/packages/create-krnl/dist/K_LIB_Krnl_System_Unified_Http_Adapter-RCEGP3OG-L46LSHKQ.js +0 -10
  212. package/packages/create-krnl/dist/K_LIB_Krnl_Telemetry-77FRZ3KV-4JUPRR3X.js +0 -10
  213. package/packages/create-krnl/dist/chunk-3TRM6CYL.js +0 -152
  214. package/packages/create-krnl/dist/chunk-3URCB3QS.js +0 -127
  215. package/packages/create-krnl/dist/chunk-5JDK35TG.js +0 -3872
  216. package/packages/create-krnl/dist/chunk-A2XAXDOW.js +0 -812
  217. package/packages/create-krnl/dist/chunk-AN6TMQHG.js +0 -1033
  218. package/packages/create-krnl/dist/chunk-BOXWWXQG.js +0 -400
  219. package/packages/create-krnl/dist/chunk-BPTBREBG.js +0 -38
  220. package/packages/create-krnl/dist/chunk-FDNCADFE.js +0 -71
  221. package/packages/create-krnl/dist/chunk-JTLSTO25.js +0 -71
  222. package/packages/create-krnl/dist/chunk-M3NCUIPL.js +0 -107
  223. package/packages/create-krnl/dist/chunk-N2EONSOC.js +0 -7769
  224. package/packages/create-krnl/dist/chunk-OHVMVRBP.js +0 -117
  225. package/packages/create-krnl/dist/chunk-Q45257P6.js +0 -173
  226. package/packages/create-krnl/dist/chunk-QGM4M3NI.js +0 -37
  227. package/packages/create-krnl/dist/chunk-RJNYUXZD.js +0 -977
  228. package/packages/create-krnl/dist/chunk-SRTOPJ5W.js +0 -104
  229. package/packages/create-krnl/dist/chunk-UPBIGEC3.js +0 -666
  230. package/packages/create-krnl/dist/chunk-V2DB7UD7.js +0 -82
  231. package/packages/create-krnl/dist/chunk-WMHLIUI6.js +0 -3644
  232. package/packages/create-krnl/dist/chunk-XIRFOO3H.js +0 -589
  233. package/packages/create-krnl/dist/chunk-Y2CEEVZP.js +0 -5536
  234. package/packages/create-krnl/dist/main-DXUMPBND.js +0 -2217
  235. package/packages/create-krnl/dist/wrapper-SDF2VKX3.js +0 -31
@@ -1,269 +0,0 @@
1
- // src/commands/validate.ts
2
- import { KrnlValidatorEngine } from "@dinilmusick/krnl-validate";
3
- async function runValidate(projectRoot = process.cwd()) {
4
- console.log(`
5
- \u{1F50D} [Krnl Validate] Scanning project at: ${projectRoot}
6
- `);
7
- const validator = new KrnlValidatorEngine({ projectRoot });
8
- const report = validator.validateAll();
9
- if (report.warnings.length > 0) {
10
- console.warn(`\u26A0\uFE0F [WARNINGS] Found ${report.warnings.length} warning(s):`);
11
- for (const w of report.warnings) {
12
- console.warn(` - [${w.ruleId}] ${w.filePath}${w.line ? `:${w.line}` : ""}: ${w.message}`);
13
- }
14
- }
15
- if (!report.valid) {
16
- console.error(`
17
- \u274C [VALIDATION FAILED] Found ${report.errors.length} error(s):
18
- `);
19
- for (const err of report.errors) {
20
- console.error(` \u274C [${err.ruleId}] ${err.filePath}${err.line ? `:${err.line}` : ""}`);
21
- console.error(` ${err.message}
22
- `);
23
- }
24
- return false;
25
- }
26
- console.log(`\u2705 [VALIDATION PASSED] ${report.totalFiles} source files verified clean against Krnl paradigms.
27
- `);
28
- return true;
29
- }
30
-
31
- // src/commands/generate.ts
32
- import * as fs from "fs";
33
- import * as path from "path";
34
- async function runGenerate(type, name, parentEntity, projectRoot = process.cwd()) {
35
- if (!name) {
36
- console.error("\u274C Error: Resource name is required. Usage: krnl generate <entity|functionality|library|subapp> <Name> [ParentEntity]");
37
- process.exit(1);
38
- }
39
- switch (type.toLowerCase()) {
40
- case "entity":
41
- generateEntity(name, projectRoot);
42
- break;
43
- case "functionality":
44
- if (!parentEntity) {
45
- console.error("\u274C Error: Parent entity name is required for functionality. Usage: krnl generate functionality <Name> <ParentEntity>");
46
- process.exit(1);
47
- }
48
- generateFunctionality(name, parentEntity, projectRoot);
49
- break;
50
- case "library":
51
- generateLibrary(name, projectRoot);
52
- break;
53
- case "subapp":
54
- generateSubApp(name, projectRoot);
55
- break;
56
- default:
57
- console.error(`\u274C Unknown resource type '${type}'. Valid types: entity, functionality, library, subapp`);
58
- process.exit(1);
59
- }
60
- }
61
- function generateEntity(name, projectRoot) {
62
- const entityDir = path.join(projectRoot, "src", "entities", name);
63
- fs.mkdirSync(entityDir, { recursive: true });
64
- fs.mkdirSync(path.join(entityDir, "functionalities"), { recursive: true });
65
- const entityFile = path.join(entityDir, `${name}.ts`);
66
- const content = `import { Entity, KrnlMagneticLoader } from '@dinilmusick/krnl-core';
67
-
68
- export class ${name} extends Entity {
69
- constructor() {
70
- super({
71
- id: '${name}',
72
- version: '1.0.0',
73
- description: '${name} root entity'
74
- });
75
- }
76
-
77
- async boot(): Promise<void> {
78
- // 1. Local functionalities with UI must precede loadAll
79
-
80
- // 2. Discover magnetic functionalities, child entities, and subapps
81
- await KrnlMagneticLoader.loadAll(this, import.meta.url);
82
- }
83
- }
84
-
85
- export default ${name};
86
- `;
87
- fs.writeFileSync(entityFile, content);
88
- console.log(`\u2705 Created Entity: src/entities/${name}/${name}.ts`);
89
- }
90
- function generateFunctionality(name, entityName, projectRoot) {
91
- const funcDir = path.join(projectRoot, "src", "entities", entityName, "functionalities", name);
92
- fs.mkdirSync(path.join(funcDir, "main_function"), { recursive: true });
93
- fs.mkdirSync(path.join(funcDir, "state_data"), { recursive: true });
94
- fs.mkdirSync(path.join(funcDir, "helper_functions"), { recursive: true });
95
- fs.mkdirSync(path.join(funcDir, "events"), { recursive: true });
96
- fs.writeFileSync(path.join(funcDir, `${name}Atom.ts`), `export interface ${name}Input {
97
- message?: string;
98
- }
99
-
100
- export interface ${name}Output {
101
- success: boolean;
102
- timestamp: number;
103
- }
104
- `);
105
- fs.writeFileSync(path.join(funcDir, "main_function", "logic.ts"), `import { ${name}Input, ${name}Output } from '../${name}Atom.js';
106
- import { formatTimestamp } from '../helper_functions/formatTimestamp.js';
107
-
108
- export const main = async (input: ${name}Input, { state, entity }: any): Promise<${name}Output> => {
109
- const timestamp = formatTimestamp();
110
- return {
111
- success: true,
112
- timestamp
113
- };
114
- };
115
- `);
116
- fs.writeFileSync(path.join(funcDir, "state_data", "state.ts"), `export interface ${name}State {
117
- executionCount: number;
118
- }
119
-
120
- export const initialState: ${name}State = {
121
- executionCount: 0
122
- };
123
- `);
124
- fs.writeFileSync(path.join(funcDir, "helper_functions", "formatTimestamp.ts"), `export function formatTimestamp(): number {
125
- return Date.now();
126
- }
127
- `);
128
- console.log(`\u2705 Created Quad-Unit Functionality: src/entities/${entityName}/functionalities/${name}/`);
129
- }
130
- function generateLibrary(name, projectRoot) {
131
- const libDir = path.join(projectRoot, "src", "libraries");
132
- fs.mkdirSync(libDir, { recursive: true });
133
- const fileName = `${name}Concepts.ts`;
134
- fs.writeFileSync(path.join(libDir, fileName), `/**
135
- * @file ${fileName}
136
- * @role component
137
- * @description Layer 0 pure domain concept library for ${name}.
138
- */
139
-
140
- export class ${name}Concepts {
141
- static pureTransform<T>(data: T): T {
142
- return data;
143
- }
144
- }
145
- `);
146
- console.log(`\u2705 Created Domain Concept Library: src/libraries/${fileName}`);
147
- }
148
- function generateSubApp(name, projectRoot) {
149
- const subappDir = path.join(projectRoot, "src", "subapps", name);
150
- fs.mkdirSync(subappDir, { recursive: true });
151
- fs.writeFileSync(path.join(subappDir, "subapp.json"), JSON.stringify({
152
- name,
153
- version: "1.0.0",
154
- description: `${name} self-contained sub-app`,
155
- registrationEntry: "./register.js"
156
- }, null, 2));
157
- fs.writeFileSync(path.join(subappDir, "register.ts"), `export function register(context: any) {
158
- context.logger.log('Registering ${name} sub-app');
159
- return {
160
- name: '${name}',
161
- operations: []
162
- };
163
- }
164
- export default register;
165
- `);
166
- console.log(`\u2705 Created Sub-App: src/subapps/${name}/`);
167
- }
168
-
169
- // src/commands/watch.ts
170
- import * as fs2 from "fs";
171
- import * as path2 from "path";
172
- function generateMagneticDeclarations(projectRoot = process.cwd()) {
173
- const functionalities = scanDirectory(projectRoot);
174
- let dtsContent = `// Automatically generated by Krnl Magnetic Watcher. Do not edit manually.
175
-
176
- `;
177
- dtsContent += `import { Entity } from '@dinilmusick/krnl-core';
178
-
179
- `;
180
- const globalDeclarations = [];
181
- for (const func of functionalities) {
182
- const helpersDir = path2.join(func.funcPath, "helper_functions");
183
- if (fs2.existsSync(helpersDir)) {
184
- const files = fs2.readdirSync(helpersDir);
185
- for (const file of files) {
186
- if (file.endsWith(".js") || file.endsWith(".ts")) {
187
- const filePath = path2.join(helpersDir, file);
188
- const baseName = path2.basename(file, path2.extname(file));
189
- const importPath = `./${path2.relative(projectRoot, filePath).replace(/\\/g, "/")}`;
190
- const { named, hasDefault } = parseExports(filePath, baseName);
191
- if (hasDefault) {
192
- globalDeclarations.push(` const ${baseName}: typeof import('${importPath}')['default'];`);
193
- }
194
- for (const name of named) {
195
- globalDeclarations.push(` const ${name}: typeof import('${importPath}')['${name}'];`);
196
- }
197
- }
198
- }
199
- }
200
- const eventsDir = path2.join(func.funcPath, "events");
201
- if (fs2.existsSync(eventsDir)) {
202
- const files = fs2.readdirSync(eventsDir);
203
- for (const file of files) {
204
- if (file.endsWith(".js") || file.endsWith(".ts")) {
205
- const filePath = path2.join(eventsDir, file);
206
- const baseName = path2.basename(file, path2.extname(file));
207
- const importPath = `./${path2.relative(projectRoot, filePath).replace(/\\/g, "/")}`;
208
- const { named, hasDefault } = parseExports(filePath, baseName);
209
- if (hasDefault) {
210
- globalDeclarations.push(` const ${baseName}: typeof import('${importPath}')['default'];`);
211
- }
212
- for (const name of named) {
213
- globalDeclarations.push(` const ${name}: typeof import('${importPath}')['${name}'];`);
214
- }
215
- }
216
- }
217
- }
218
- }
219
- if (globalDeclarations.length > 0) {
220
- dtsContent += `declare global {
221
- ${Array.from(new Set(globalDeclarations)).join("\n")}
222
- }
223
- `;
224
- }
225
- const outPath = path2.join(projectRoot, "krnl-magnetic.d.ts");
226
- fs2.writeFileSync(outPath, dtsContent);
227
- console.log(`[Krnl Watch] Updated ambient declarations: ${outPath}`);
228
- }
229
- function scanDirectory(dir, results = []) {
230
- if (!fs2.existsSync(dir)) return results;
231
- const list = fs2.readdirSync(dir, { withFileTypes: true });
232
- for (const entry of list) {
233
- if (entry.isDirectory()) {
234
- if (entry.name === "node_modules" || entry.name === "dist" || entry.name === ".git") continue;
235
- const fullPath = path2.join(dir, entry.name);
236
- if (entry.name === "functionalities") {
237
- const funcs = fs2.readdirSync(fullPath, { withFileTypes: true });
238
- for (const f of funcs) {
239
- if (f.isDirectory()) {
240
- results.push({ funcPath: path2.join(fullPath, f.name), funcName: f.name });
241
- }
242
- }
243
- } else {
244
- scanDirectory(fullPath, results);
245
- }
246
- }
247
- }
248
- return results;
249
- }
250
- function parseExports(filePath, defaultName) {
251
- const content = fs2.readFileSync(filePath, "utf8");
252
- const named = [];
253
- let hasDefault = false;
254
- const namedRegex = /export\s+(?:const|let|var|function|class|async\s+function)\s+([a-zA-Z0-9_$]+)/g;
255
- let match;
256
- while ((match = namedRegex.exec(content)) !== null) {
257
- if (match[1]) named.push(match[1]);
258
- }
259
- if (content.includes("export default")) {
260
- hasDefault = true;
261
- }
262
- return { named, hasDefault };
263
- }
264
-
265
- export {
266
- runValidate,
267
- runGenerate,
268
- generateMagneticDeclarations
269
- };
@@ -1,71 +0,0 @@
1
- // ../core/dist/chunk-HIMEZUU2.js
2
- var KrnlEntityRegistry = class _KrnlEntityRegistry {
3
- static instance = null;
4
- entities = /* @__PURE__ */ new Map();
5
- constructor() {
6
- }
7
- /**
8
- * Get the singleton instance of the entity registry.
9
- */
10
- static getInstance() {
11
- if (!_KrnlEntityRegistry.instance) {
12
- _KrnlEntityRegistry.instance = new _KrnlEntityRegistry();
13
- }
14
- return _KrnlEntityRegistry.instance;
15
- }
16
- /**
17
- * Registers an entity instance into the global registry.
18
- */
19
- static register(entity) {
20
- const reg = _KrnlEntityRegistry.getInstance();
21
- const id = entity.id || entity.entityName;
22
- if (id) {
23
- reg.entities.set(id, entity);
24
- }
25
- if (entity.entityName && entity.entityName !== id) {
26
- reg.entities.set(entity.entityName, entity);
27
- }
28
- }
29
- /**
30
- * Unregisters an entity instance or ID from the registry.
31
- */
32
- static unregister(entityOrId) {
33
- const reg = _KrnlEntityRegistry.getInstance();
34
- if (typeof entityOrId === "string") {
35
- reg.entities.delete(entityOrId);
36
- } else {
37
- const id = entityOrId.id || entityOrId.entityName;
38
- if (id) reg.entities.delete(id);
39
- if (entityOrId.entityName) reg.entities.delete(entityOrId.entityName);
40
- }
41
- }
42
- /**
43
- * Retrieves an entity by its ID or name.
44
- */
45
- static get(idOrName) {
46
- return _KrnlEntityRegistry.getInstance().entities.get(idOrName);
47
- }
48
- /**
49
- * Checks if an entity with the given ID or name is registered.
50
- */
51
- static has(idOrName) {
52
- return _KrnlEntityRegistry.getInstance().entities.has(idOrName);
53
- }
54
- /**
55
- * Returns a list of all currently registered unique entities.
56
- */
57
- static getAll() {
58
- const set = new Set(_KrnlEntityRegistry.getInstance().entities.values());
59
- return Array.from(set);
60
- }
61
- /**
62
- * Clears all registered entities.
63
- */
64
- static clear() {
65
- _KrnlEntityRegistry.getInstance().entities.clear();
66
- }
67
- };
68
-
69
- export {
70
- KrnlEntityRegistry
71
- };
@@ -1,127 +0,0 @@
1
- import {
2
- __esm,
3
- __export
4
- } from "./chunk-X5LOIFM7.js";
5
-
6
- // ../core/dist/chunk-6QCYRS5L.js
7
- import fs from "fs";
8
- import path from "path";
9
- var K_LIB_Krnl_Frontend_Builder_exports = {};
10
- __export(K_LIB_Krnl_Frontend_Builder_exports, {
11
- KrnlFrontendBuilder: () => KrnlFrontendBuilder
12
- });
13
- var KrnlFrontendBuilder;
14
- var init_K_LIB_Krnl_Frontend_Builder = __esm({
15
- "src/core/K_LIB_Krnl_Frontend_Builder.ts"() {
16
- KrnlFrontendBuilder = class {
17
- static activeContexts = /* @__PURE__ */ new Map();
18
- /**
19
- * Bundles frontend/src/index.ts -> frontend/dist/bundle.js
20
- */
21
- static async build(frontendDir) {
22
- const entryFileTs = path.join(frontendDir, "src", "index.ts");
23
- const entryFileTsx = path.join(frontendDir, "src", "index.tsx");
24
- const entryFile = fs.existsSync(entryFileTs) ? entryFileTs : entryFileTsx;
25
- if (!fs.existsSync(entryFile)) {
26
- return false;
27
- }
28
- const distDir = path.join(frontendDir, "dist");
29
- fs.mkdirSync(distDir, { recursive: true });
30
- try {
31
- const candidates = [
32
- // When running from inside KrnlTS dist (relative to __dirname)
33
- path.resolve(__dirname, "..", "..", "frontend", "atoms"),
34
- path.resolve(__dirname, "..", "frontend", "atoms"),
35
- // Scoped package (@dinilmusick/krnlts) installed in consuming app
36
- path.resolve(process.cwd(), "node_modules", "@dinilmusick", "krnlts", "dist", "frontend", "atoms"),
37
- path.resolve(process.cwd(), "node_modules", "@dinilmusick", "krnlts", "src", "krnl", "frontend", "atoms"),
38
- // Unscoped fallback (krnlts)
39
- path.resolve(process.cwd(), "node_modules", "krnlts", "dist", "frontend", "atoms"),
40
- path.resolve(process.cwd(), "node_modules", "krnlts", "src", "krnl", "frontend", "atoms")
41
- ];
42
- const nodeModulesAtoms = candidates.find((c) => fs.existsSync(c));
43
- const srcAtoms = path.join(frontendDir, "src", "atoms");
44
- if (nodeModulesAtoms) {
45
- fs.mkdirSync(srcAtoms, { recursive: true });
46
- fs.cpSync(nodeModulesAtoms, srcAtoms, { recursive: true, force: true });
47
- console.log(`[KrnlFrontendBuilder] Atoms synced from ${nodeModulesAtoms}`);
48
- } else {
49
- console.warn(`[KrnlFrontendBuilder] No atoms source found in any candidate path.`);
50
- }
51
- } catch (e) {
52
- }
53
- try {
54
- const esbuild = await import("esbuild");
55
- console.log(`[KrnlFrontendBuilder] Bundling ${entryFile} -> ${distDir}/bundle.js...`);
56
- await esbuild.build({
57
- entryPoints: [entryFile],
58
- bundle: true,
59
- outfile: path.join(distDir, "bundle.js"),
60
- loader: {
61
- ".css": "css",
62
- ".ts": "ts",
63
- ".js": "js"
64
- },
65
- sourcemap: process.env.NODE_ENV !== "production",
66
- minify: process.env.NODE_ENV === "production",
67
- logLevel: "warning"
68
- });
69
- console.log(`[KrnlFrontendBuilder] Bundle build successful.`);
70
- return true;
71
- } catch (err) {
72
- if (err.code === "ERR_MODULE_NOT_FOUND" || err.message?.includes("Cannot find module")) {
73
- console.warn(`[KrnlFrontendBuilder] esbuild peer dependency not found. Skipping build. Run 'npm i esbuild' to enable in-process UI compilation.`);
74
- } else {
75
- console.error(`[KrnlFrontendBuilder] Build failed:`, err.message || err);
76
- }
77
- return false;
78
- }
79
- }
80
- /**
81
- * Starts esbuild watch mode for live updates during development
82
- */
83
- static async watch(frontendDir) {
84
- if (this.activeContexts.has(frontendDir)) {
85
- return;
86
- }
87
- const entryFileTs = path.join(frontendDir, "src", "index.ts");
88
- const entryFileTsx = path.join(frontendDir, "src", "index.tsx");
89
- const entryFile = fs.existsSync(entryFileTs) ? entryFileTs : entryFileTsx;
90
- if (!fs.existsSync(entryFile)) {
91
- return;
92
- }
93
- try {
94
- const esbuild = await import("esbuild");
95
- const ctx = await esbuild.context({
96
- entryPoints: [entryFile],
97
- bundle: true,
98
- outfile: path.join(frontendDir, "dist", "bundle.js"),
99
- loader: {
100
- ".css": "css",
101
- ".ts": "ts",
102
- ".js": "js"
103
- },
104
- logLevel: "warning"
105
- });
106
- await ctx.watch();
107
- this.activeContexts.set(frontendDir, ctx);
108
- console.log(`[KrnlFrontendBuilder] esbuild watching ${frontendDir}/src for changes.`);
109
- } catch (err) {
110
- }
111
- }
112
- static stop(frontendDir) {
113
- const ctx = this.activeContexts.get(frontendDir);
114
- if (ctx) {
115
- ctx.dispose();
116
- this.activeContexts.delete(frontendDir);
117
- }
118
- }
119
- };
120
- }
121
- });
122
-
123
- export {
124
- K_LIB_Krnl_Frontend_Builder_exports,
125
- KrnlFrontendBuilder,
126
- init_K_LIB_Krnl_Frontend_Builder
127
- };