@xrystal/core 3.32.1 → 3.37.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 (262) hide show
  1. package/README.md +651 -136
  2. package/package.json +27 -24
  3. package/tsconfig.base.json +15 -0
  4. package/x/bin/commands/create.mjs +34 -5
  5. package/x/bin/commands/doctor.mjs +115 -25
  6. package/x/bin/commands/hooks.mjs +55 -0
  7. package/x/bin/commands/project.mjs +75 -42
  8. package/x/bin/commands/release.mjs +8 -3
  9. package/x/bin/commands/sync-toolchain.mjs +43 -0
  10. package/x/bin/commands/tmp.mjs +13 -4
  11. package/x/bin/helpers/.generated/.generated-from +1 -0
  12. package/x/bin/helpers/.generated/tmp-schema.mjs +192 -0
  13. package/x/bin/helpers/banner.mjs +66 -12
  14. package/x/bin/helpers/build-config.mjs +342 -0
  15. package/x/bin/helpers/cli-help.mjs +164 -0
  16. package/x/bin/helpers/create-target.mjs +18 -2
  17. package/x/bin/helpers/project-artifacts.mjs +140 -0
  18. package/x/bin/helpers/runtime-info.mjs +172 -0
  19. package/x/bin/helpers/tmp-config.mjs +11 -10
  20. package/x/bin/helpers/tmp-layout.mjs +10 -16
  21. package/x/bin/helpers/tmp-schema.mjs +9 -0
  22. package/x/bin/helpers/toolchain-config.mjs +233 -0
  23. package/x/bin/main-cli.js +31 -3
  24. package/x/bin/scripts/clean-source-types.mjs +19 -0
  25. package/x/bin/scripts/fix-dist-imports.mjs +80 -0
  26. package/x/bin/scripts/install-git-hooks.mjs +86 -0
  27. package/x/bin/scripts/minify-dist.mjs +50 -0
  28. package/x/bin/scripts/prepare-npm-publish.mjs +49 -0
  29. package/x/bin/scripts/unpublish-leaked-versions.mjs +62 -0
  30. package/x/bin/scripts/verify-npm-pack.mjs +45 -0
  31. package/x/bin/scripts/verify-version-bump.mjs +27 -0
  32. package/x/bin/scripts/version-check.mjs +173 -0
  33. package/x/dist/index.d.ts +3 -0
  34. package/x/dist/index.js +1 -0
  35. package/x/dist/loader/clients/index.js +1 -0
  36. package/x/dist/loader/configs/index.js +1 -0
  37. package/{source → x/dist}/loader/controller/index.d.ts +20 -17
  38. package/x/dist/loader/controller/index.js +1 -0
  39. package/x/dist/loader/dto/index.js +1 -0
  40. package/x/dist/loader/events/index.js +1 -0
  41. package/x/dist/loader/index.d.ts +11 -0
  42. package/x/dist/loader/index.js +1 -0
  43. package/{source → x/dist}/loader/kafka/index.d.ts +1 -0
  44. package/x/dist/loader/kafka/index.js +1 -0
  45. package/x/dist/loader/localizations/index.js +1 -0
  46. package/{source → x/dist}/loader/logger/index.d.ts +1 -0
  47. package/x/dist/loader/logger/index.js +2 -0
  48. package/x/dist/loader/service/index.js +1 -0
  49. package/x/dist/loader/system/index.js +1 -0
  50. package/x/dist/project/index.js +1 -0
  51. package/x/dist/utils/constants/defaults.json +44 -0
  52. package/x/dist/utils/constants/index.js +1 -0
  53. package/x/dist/utils/helpers/configs/index.js +1 -0
  54. package/x/dist/utils/helpers/context/controller-store.js +1 -0
  55. package/x/dist/utils/helpers/context/index.js +1 -0
  56. package/{source → x/dist}/utils/helpers/core/index.d.ts +1 -1
  57. package/x/dist/utils/helpers/core/index.js +1 -0
  58. package/x/dist/utils/helpers/core/paths.js +1 -0
  59. package/x/dist/utils/helpers/core/tmp-layout.js +1 -0
  60. package/x/dist/utils/helpers/date/index.js +1 -0
  61. package/x/dist/utils/helpers/dispatch/index.js +1 -0
  62. package/x/dist/utils/helpers/dto/index.js +1 -0
  63. package/x/dist/utils/helpers/filters/index.js +1 -0
  64. package/x/dist/utils/helpers/framework/index.js +1 -0
  65. package/x/dist/utils/helpers/handlers/adapters.js +1 -0
  66. package/x/dist/utils/helpers/handlers/execute.js +1 -0
  67. package/x/dist/utils/helpers/handlers/index.js +1 -0
  68. package/x/dist/utils/helpers/hash/crypto.js +1 -0
  69. package/x/dist/utils/helpers/id/index.js +1 -0
  70. package/x/dist/utils/helpers/index.js +1 -0
  71. package/x/dist/utils/helpers/ip/index.js +1 -0
  72. package/x/dist/utils/helpers/is/index.js +1 -0
  73. package/x/dist/utils/helpers/locales/index.js +1 -0
  74. package/x/dist/utils/helpers/math/index.js +1 -0
  75. package/{source → x/dist}/utils/helpers/middleware/index.d.ts +2 -2
  76. package/x/dist/utils/helpers/middleware/index.js +1 -0
  77. package/x/dist/utils/helpers/objects/index.js +1 -0
  78. package/x/dist/utils/helpers/path/index.js +1 -0
  79. package/{source → x/dist}/utils/helpers/protocol/index.d.ts +2 -10
  80. package/x/dist/utils/helpers/protocol/index.js +1 -0
  81. package/x/dist/utils/helpers/protocol/options.js +1 -0
  82. package/x/dist/utils/helpers/regex/checkSpecialRegexControl.js +1 -0
  83. package/x/dist/utils/helpers/runtime/dto-access.js +1 -0
  84. package/x/dist/utils/helpers/runtime/dto-types.js +1 -0
  85. package/{source → x/dist}/utils/helpers/runtime/index.d.ts +1 -0
  86. package/x/dist/utils/helpers/runtime/index.js +1 -0
  87. package/x/dist/utils/helpers/runtime/shutdown.d.ts +3 -0
  88. package/x/dist/utils/helpers/runtime/shutdown.js +1 -0
  89. package/x/dist/utils/helpers/state/index.js +1 -0
  90. package/x/dist/utils/helpers/state/props-from-tmp.js +1 -0
  91. package/x/dist/utils/helpers/state/request-key-guard.js +1 -0
  92. package/x/dist/utils/helpers/state/scopes.js +1 -0
  93. package/x/dist/utils/helpers/string/index.js +1 -0
  94. package/x/dist/utils/helpers/tests/tmp-schema.test.js +1 -0
  95. package/x/dist/utils/helpers/tests/tmp-watch.test.js +1 -0
  96. package/x/dist/utils/helpers/timer/index.js +1 -0
  97. package/x/dist/utils/helpers/tmp/index.d.ts +5 -0
  98. package/x/dist/utils/helpers/tmp/index.js +1 -0
  99. package/x/dist/utils/helpers/tmp/loader-tmp-sync.js +1 -0
  100. package/{source → x/dist}/utils/helpers/tmp/runtime-tmp.d.ts +2 -6
  101. package/x/dist/utils/helpers/tmp/runtime-tmp.js +1 -0
  102. package/{source → x/dist}/utils/helpers/tmp/tmp-loader.d.ts +1 -0
  103. package/x/dist/utils/helpers/tmp/tmp-loader.js +1 -0
  104. package/x/dist/utils/helpers/tmp/tmp-schema.d.ts +47 -0
  105. package/x/dist/utils/helpers/tmp/tmp-schema.js +1 -0
  106. package/x/dist/utils/helpers/tmp/tmp-watch.d.ts +1 -0
  107. package/x/dist/utils/helpers/tmp/tmp-watch.js +1 -0
  108. package/x/dist/utils/helpers/validates/index.js +1 -0
  109. package/x/dist/utils/index.js +1 -0
  110. package/x/dist/utils/models/classes/class.clients.js +1 -0
  111. package/x/dist/utils/models/classes/class.interfaces.js +1 -0
  112. package/x/dist/utils/models/classes/class.service-locator.js +1 -0
  113. package/{source → x/dist}/utils/models/classes/class.tmp-file-loader.d.ts +3 -2
  114. package/x/dist/utils/models/classes/class.tmp-file-loader.js +1 -0
  115. package/x/dist/utils/models/classes/class.x.js +1 -0
  116. package/x/dist/utils/models/enums/index.js +1 -0
  117. package/x/dist/utils/models/index.js +1 -0
  118. package/x/dist/utils/models/types/index.js +1 -0
  119. package/x/dist/utils/package-root.js +1 -0
  120. package/x/tmp.yml +51 -42
  121. package/source/index.js +0 -11
  122. package/source/loader/clients/index.js +0 -22
  123. package/source/loader/configs/index.js +0 -88
  124. package/source/loader/controller/index.js +0 -236
  125. package/source/loader/dto/index.js +0 -92
  126. package/source/loader/events/index.js +0 -44
  127. package/source/loader/index.d.ts +0 -11
  128. package/source/loader/index.js +0 -11
  129. package/source/loader/kafka/index.js +0 -137
  130. package/source/loader/localizations/index.js +0 -46
  131. package/source/loader/logger/index.js +0 -217
  132. package/source/loader/service/index.js +0 -7
  133. package/source/loader/system/index.js +0 -25
  134. package/source/project/index.js +0 -70
  135. package/source/utils/constants/defaults.json +0 -15
  136. package/source/utils/constants/defaults.mjs +0 -10
  137. package/source/utils/constants/index.js +0 -22
  138. package/source/utils/helpers/configs/index.js +0 -1
  139. package/source/utils/helpers/context/controller-store.js +0 -12
  140. package/source/utils/helpers/context/index.js +0 -24
  141. package/source/utils/helpers/core/index.js +0 -58
  142. package/source/utils/helpers/core/paths.js +0 -78
  143. package/source/utils/helpers/core/tmp-layout.js +0 -241
  144. package/source/utils/helpers/date/index.js +0 -48
  145. package/source/utils/helpers/dispatch/index.js +0 -53
  146. package/source/utils/helpers/dto/index.js +0 -10
  147. package/source/utils/helpers/filters/index.js +0 -44
  148. package/source/utils/helpers/framework/index.js +0 -17
  149. package/source/utils/helpers/handlers/adapters.js +0 -40
  150. package/source/utils/helpers/handlers/execute.js +0 -82
  151. package/source/utils/helpers/handlers/index.js +0 -31
  152. package/source/utils/helpers/hash/crypto.js +0 -22
  153. package/source/utils/helpers/id/index.js +0 -24
  154. package/source/utils/helpers/index.js +0 -26
  155. package/source/utils/helpers/ip/index.js +0 -21
  156. package/source/utils/helpers/is/index.js +0 -35
  157. package/source/utils/helpers/locales/index.js +0 -82
  158. package/source/utils/helpers/math/index.js +0 -14
  159. package/source/utils/helpers/middleware/index.js +0 -36
  160. package/source/utils/helpers/objects/index.js +0 -55
  161. package/source/utils/helpers/path/index.js +0 -4
  162. package/source/utils/helpers/protocol/index.js +0 -99
  163. package/source/utils/helpers/protocol/options.js +0 -13
  164. package/source/utils/helpers/regex/checkSpecialRegexControl.js +0 -3
  165. package/source/utils/helpers/runtime/dto-access.js +0 -5
  166. package/source/utils/helpers/runtime/index.js +0 -1
  167. package/source/utils/helpers/state/index.js +0 -185
  168. package/source/utils/helpers/state/props-from-tmp.js +0 -44
  169. package/source/utils/helpers/state/request-key-guard.js +0 -42
  170. package/source/utils/helpers/state/scopes.js +0 -69
  171. package/source/utils/helpers/string/index.js +0 -9
  172. package/source/utils/helpers/timer/index.js +0 -5
  173. package/source/utils/helpers/tmp/index.d.ts +0 -3
  174. package/source/utils/helpers/tmp/index.js +0 -3
  175. package/source/utils/helpers/tmp/loader-tmp-sync.js +0 -13
  176. package/source/utils/helpers/tmp/runtime-tmp.js +0 -30
  177. package/source/utils/helpers/tmp/tmp-loader.js +0 -48
  178. package/source/utils/helpers/validates/index.js +0 -20
  179. package/source/utils/index.js +0 -3
  180. package/source/utils/models/classes/class.clients.js +0 -142
  181. package/source/utils/models/classes/class.interfaces.js +0 -10
  182. package/source/utils/models/classes/class.service-locator.js +0 -16
  183. package/source/utils/models/classes/class.tmp-file-loader.js +0 -38
  184. package/source/utils/models/classes/class.x.js +0 -180
  185. package/source/utils/models/enums/index.js +0 -148
  186. package/source/utils/models/index.js +0 -9
  187. package/source/utils/models/types/index.js +0 -2
  188. package/source/utils/models/types/shims.d.ts +0 -123
  189. package/source/utils/package-root.js +0 -5
  190. package/x/tests/cli.test.ts +0 -85
  191. package/x/tests/context.test.ts +0 -25
  192. package/x/tests/dispatch.test.ts +0 -84
  193. package/x/tests/fixtures/locales/en/translation.json +0 -8
  194. package/x/tests/fixtures/locales/tr/translation.json +0 -8
  195. package/x/tests/frameworks.integration.test.ts +0 -185
  196. package/x/tests/helpers/i18n-setup.ts +0 -52
  197. package/x/tests/helpers/middleware.ts +0 -23
  198. package/x/tests/helpers/register-test-dto.ts +0 -52
  199. package/x/tests/i18n.integration.test.ts +0 -77
  200. package/x/tests/i18n.test.ts +0 -96
  201. package/x/tests/middleware.test.ts +0 -83
  202. package/x/tests/project-layout.test.ts +0 -65
  203. package/x/tests/protocol.test.ts +0 -75
  204. package/x/tests/realtime.examples.test.ts +0 -198
  205. package/x/tests/runtime-tmp.test.ts +0 -49
  206. package/x/tests/socket.integration.test.ts +0 -174
  207. package/x/tests/state.test.ts +0 -183
  208. package/x/tests/tmp-layout-guard.test.ts +0 -40
  209. /package/{source → x/dist}/loader/clients/index.d.ts +0 -0
  210. /package/{source → x/dist}/loader/configs/index.d.ts +0 -0
  211. /package/{source → x/dist}/loader/dto/index.d.ts +0 -0
  212. /package/{source → x/dist}/loader/events/index.d.ts +0 -0
  213. /package/{source → x/dist}/loader/localizations/index.d.ts +0 -0
  214. /package/{source → x/dist}/loader/service/index.d.ts +0 -0
  215. /package/{source → x/dist}/loader/system/index.d.ts +0 -0
  216. /package/{source → x/dist}/project/index.d.ts +0 -0
  217. /package/{source → x/dist}/utils/constants/index.d.ts +0 -0
  218. /package/{source → x/dist}/utils/helpers/configs/index.d.ts +0 -0
  219. /package/{source → x/dist}/utils/helpers/context/controller-store.d.ts +0 -0
  220. /package/{source → x/dist}/utils/helpers/context/index.d.ts +0 -0
  221. /package/{source → x/dist}/utils/helpers/core/paths.d.ts +0 -0
  222. /package/{source → x/dist}/utils/helpers/core/tmp-layout.d.ts +0 -0
  223. /package/{source → x/dist}/utils/helpers/date/index.d.ts +0 -0
  224. /package/{source → x/dist}/utils/helpers/dispatch/index.d.ts +0 -0
  225. /package/{source → x/dist}/utils/helpers/dto/index.d.ts +0 -0
  226. /package/{source → x/dist}/utils/helpers/filters/index.d.ts +0 -0
  227. /package/{source → x/dist}/utils/helpers/framework/index.d.ts +0 -0
  228. /package/{source → x/dist}/utils/helpers/handlers/adapters.d.ts +0 -0
  229. /package/{source → x/dist}/utils/helpers/handlers/execute.d.ts +0 -0
  230. /package/{source → x/dist}/utils/helpers/handlers/index.d.ts +0 -0
  231. /package/{source → x/dist}/utils/helpers/hash/crypto.d.ts +0 -0
  232. /package/{source → x/dist}/utils/helpers/id/index.d.ts +0 -0
  233. /package/{source → x/dist}/utils/helpers/index.d.ts +0 -0
  234. /package/{source → x/dist}/utils/helpers/ip/index.d.ts +0 -0
  235. /package/{source → x/dist}/utils/helpers/is/index.d.ts +0 -0
  236. /package/{source → x/dist}/utils/helpers/locales/index.d.ts +0 -0
  237. /package/{source → x/dist}/utils/helpers/math/index.d.ts +0 -0
  238. /package/{source → x/dist}/utils/helpers/objects/index.d.ts +0 -0
  239. /package/{source → x/dist}/utils/helpers/path/index.d.ts +0 -0
  240. /package/{source → x/dist}/utils/helpers/protocol/options.d.ts +0 -0
  241. /package/{source → x/dist}/utils/helpers/regex/checkSpecialRegexControl.d.ts +0 -0
  242. /package/{source → x/dist}/utils/helpers/runtime/dto-access.d.ts +0 -0
  243. /package/{source → x/dist}/utils/helpers/runtime/dto-types.d.ts +0 -0
  244. /package/{source → x/dist}/utils/helpers/state/index.d.ts +0 -0
  245. /package/{source → x/dist}/utils/helpers/state/props-from-tmp.d.ts +0 -0
  246. /package/{source → x/dist}/utils/helpers/state/request-key-guard.d.ts +0 -0
  247. /package/{source → x/dist}/utils/helpers/state/scopes.d.ts +0 -0
  248. /package/{source → x/dist}/utils/helpers/string/index.d.ts +0 -0
  249. /package/{source/index.d.ts → x/dist/utils/helpers/tests/tmp-schema.test.d.ts} +0 -0
  250. /package/{source/utils/helpers/runtime/dto-types.js → x/dist/utils/helpers/tests/tmp-watch.test.d.ts} +0 -0
  251. /package/{source → x/dist}/utils/helpers/timer/index.d.ts +0 -0
  252. /package/{source → x/dist}/utils/helpers/tmp/loader-tmp-sync.d.ts +0 -0
  253. /package/{source → x/dist}/utils/helpers/validates/index.d.ts +0 -0
  254. /package/{source → x/dist}/utils/index.d.ts +0 -0
  255. /package/{source → x/dist}/utils/models/classes/class.clients.d.ts +0 -0
  256. /package/{source → x/dist}/utils/models/classes/class.interfaces.d.ts +0 -0
  257. /package/{source → x/dist}/utils/models/classes/class.service-locator.d.ts +0 -0
  258. /package/{source → x/dist}/utils/models/classes/class.x.d.ts +0 -0
  259. /package/{source → x/dist}/utils/models/enums/index.d.ts +0 -0
  260. /package/{source → x/dist}/utils/models/index.d.ts +0 -0
  261. /package/{source → x/dist}/utils/models/types/index.d.ts +0 -0
  262. /package/{source → x/dist}/utils/package-root.d.ts +0 -0
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Yusuf Yasir KAYGUSUZ",
3
3
  "name": "@xrystal/core",
4
- "version": "3.32.1",
4
+ "version": "3.37.3",
5
5
  "description": "Project core for xrystal",
6
6
  "publishConfig": {
7
7
  "access": "public",
@@ -12,39 +12,40 @@
12
12
  "url": "git+https://github.com/xdloper/-xrystal-core.git"
13
13
  },
14
14
  "files": [
15
- "source",
15
+ "x/dist",
16
16
  "x/bin",
17
- "x/tests",
18
17
  "x/tmp.yml",
19
18
  "x/assets",
19
+ "tsconfig.base.json",
20
20
  "README.md"
21
21
  ],
22
- "main": "source/index.ts",
23
- "types": "./source/index.d.ts",
22
+ "main": "./x/dist/index.js",
23
+ "types": "./x/dist/index.d.ts",
24
24
  "exports": {
25
+ "./tsconfig.base.json": "./tsconfig.base.json",
25
26
  ".": {
26
- "types": "./source/index.d.ts",
27
- "default": "./source/index.js"
27
+ "types": "./x/dist/index.d.ts",
28
+ "default": "./x/dist/index.js"
28
29
  },
29
30
  "./utils": {
30
- "types": "./source/utils/index.d.ts",
31
- "default": "./source/utils/index.js"
31
+ "types": "./x/dist/utils/index.d.ts",
32
+ "default": "./x/dist/utils/index.js"
32
33
  },
33
34
  "./loader": {
34
- "types": "./source/loader/index.d.ts",
35
- "default": "./source/loader/index.js"
35
+ "types": "./x/dist/loader/index.d.ts",
36
+ "default": "./x/dist/loader/index.js"
36
37
  },
37
38
  "./loader/controller": {
38
- "types": "./source/loader/controller/index.d.ts",
39
- "default": "./source/loader/controller/index.js"
39
+ "types": "./x/dist/loader/controller/index.d.ts",
40
+ "default": "./x/dist/loader/controller/index.js"
40
41
  },
41
42
  "./loader/dto": {
42
- "types": "./source/loader/dto/index.d.ts",
43
- "default": "./source/loader/dto/index.js"
43
+ "types": "./x/dist/loader/dto/index.d.ts",
44
+ "default": "./x/dist/loader/dto/index.js"
44
45
  },
45
46
  "./project": {
46
- "types": "./source/project/index.d.ts",
47
- "default": "./source/project/index.js"
47
+ "types": "./x/dist/project/index.d.ts",
48
+ "default": "./x/dist/project/index.js"
48
49
  }
49
50
  },
50
51
  "type": "module",
@@ -54,16 +55,18 @@
54
55
  "tmp": "./x/bin/main-cli.js"
55
56
  },
56
57
  "scripts": {
57
- "dev": "bun --watch --env-file=../infrastructer/x/environments/.global.env --env-file=../infrastructer/x/environments/.dev.env source/index.ts",
58
- "build": "rm -rf x/dist && bun build ./source/index.ts ./source/loader/index.ts ./source/project/index.ts ./source/utils/index.ts --outdir ./x/dist --target node --external '*' && bun run tsc --project tsconfig.json && bunx tsc-alias -p tsconfig.json",
58
+ "dev": "node x/bin/main-cli.js dev",
59
+ "build": "node x/bin/main-cli.js build",
59
60
  "test": "bun test x/tests",
60
61
  "lint": "eslint source",
61
- "release:prepare": "bun run lint && bun test x/tests && bun run build",
62
- "build:prod": "bun run build && find source -name '*.ts' -not -name '*.d.ts' -delete && cp -r x/dist/* source/ && rm -rf x/dist",
63
- "build:dev": "bun --watch --env-file=../infrastructer/x/environments/.global.env --env-file=../infrastructer/x/environments/.dev.env ./x/dist/index.js",
64
- "start": "bun --env-file=../infrastructer/x/environments/.global.env --env-file=../infrastructer/x/environments/.dev.env source/index.js",
62
+ "prepublishOnly": "bun run release:prepare",
63
+ "release:prepare": "bun run lint && bun run build && bun test x/tests",
64
+ "build:prod": "bun run release:prepare && node x/bin/scripts/clean-source-types.mjs",
65
+ "build:dev": "node x/bin/main-cli.js dev",
66
+ "start": "node x/bin/main-cli.js start",
65
67
  "tag": "node x/bin/scripts/tag.mjs",
66
- "version:check": "node x/bin/scripts/version-check.mjs"
68
+ "version:check": "node x/bin/scripts/version-check.mjs",
69
+ "hooks:install": "node x/bin/scripts/install-git-hooks.mjs"
67
70
  },
68
71
  "dependencies": {
69
72
  "@xrystal/dto": "^26.6.28-v1",
@@ -0,0 +1,15 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "moduleResolution": "Bundler",
6
+ "baseUrl": ".",
7
+ "esModuleInterop": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "skipLibCheck": true,
10
+ "strict": true,
11
+ "noImplicitAny": true,
12
+ "noEmitOnError": false,
13
+ "declarationMap": false
14
+ }
15
+ }
@@ -13,14 +13,30 @@ import {
13
13
  resolveMainFolderPath,
14
14
  } from '../helpers/tmp-layout.mjs'
15
15
  import { formatLoaderSummary, summarizeLoaders } from '../helpers/tmp-config.mjs'
16
+ import { formatCreateHelp, formatCreateCommandHelp, LIST_BULLET } from '../helpers/cli-help.mjs'
17
+ import { setupProjectGitHooks } from '../scripts/install-git-hooks.mjs'
16
18
 
17
- export function registerCreateCommand(cli, { runtimeName, packageManager, installCommand, devCommand }) {
19
+ export function registerCreateCommand(cli, { cliName = 'xcore', runtimeName, packageManager, installCommand, devCommand }) {
18
20
  cli
19
- .command('create [project-name] [target-path]')
20
- .description(`Scaffold from GitHub template (${Constants.templateRepoUri})`)
21
+ .command('create <project-name> [target-path]')
22
+ .description('Scaffold new service from GitHub template')
21
23
  .option('-f, --force', 'Allow creating in a non-empty directory')
22
24
  .action(async (projectName, targetDir, options) => {
23
- const { targetPath, isCurrentDir } = resolveCreateTarget(projectName ?? 'app', targetDir)
25
+ const name = projectName?.trim()
26
+ if (!name) {
27
+ console.error(chalk.red('\n✗ project-name is required\n'))
28
+ console.log(formatCreateHelp({ cliName }))
29
+ process.exit(1)
30
+ }
31
+
32
+ let targetPath
33
+ let isCurrentDir
34
+ try {
35
+ ;({ targetPath, isCurrentDir } = resolveCreateTarget(name, targetDir))
36
+ } catch (error) {
37
+ console.error(chalk.red(`\n✗ ${error.message}\n`))
38
+ process.exit(1)
39
+ }
24
40
 
25
41
  if (fs.existsSync(targetPath)) {
26
42
  const entries = fs.readdirSync(targetPath)
@@ -65,6 +81,19 @@ export function registerCreateCommand(cli, { runtimeName, packageManager, instal
65
81
 
66
82
  execSync(installCommand, { cwd: targetPath, stdio: 'inherit' })
67
83
 
84
+ try {
85
+ const hookResult = setupProjectGitHooks(targetPath, { cliName })
86
+ console.log(
87
+ hookResult.refreshed
88
+ ? chalk.yellow(' pre-commit hook refreshed')
89
+ : chalk.green(' pre-commit hook installed'),
90
+ )
91
+ console.log(chalk.gray(` hook: ${hookResult.hookPath}`))
92
+ } catch (hookError) {
93
+ console.log(chalk.yellow(` pre-commit hook skipped: ${hookError.message}`))
94
+ console.log(chalk.gray(` run later: ${cliName} hooks install`))
95
+ }
96
+
68
97
  let loaderSummary = null
69
98
  try {
70
99
  loaderSummary = summarizeLoaders(resolvedTmp)
@@ -78,7 +107,7 @@ export function registerCreateCommand(cli, { runtimeName, packageManager, instal
78
107
  console.log(chalk.cyan.bold('\n Loaders & config\n'))
79
108
  for (const line of formatLoaderSummary(loaderSummary)) {
80
109
  const [key, ...rest] = line.split(': ')
81
- console.log(` ${chalk.green('●')} ${chalk.white(key)}${rest.length ? chalk.gray(`: ${rest.join(': ')}`) : ''}`)
110
+ console.log(` ${LIST_BULLET} ${chalk.white(key)}${rest.length ? chalk.gray(`: ${rest.join(': ')}`) : ''}`)
82
111
  }
83
112
  console.log('')
84
113
  console.log(chalk.dim(' HTTP → dtoMiddleware() + ctr()'))
@@ -1,59 +1,149 @@
1
1
  import chalk from 'chalk'
2
+
3
+ import { printCommandHeader } from '../helpers/banner.mjs'
4
+ import { resolveDistLayout } from '../helpers/project-artifacts.mjs'
2
5
  import {
3
6
  getInstalledCoreVersion,
4
7
  getProjectRoot,
5
8
  readCliPackageJson,
6
9
  readProjectPackageJson,
7
10
  } from '../helpers/project-root.mjs'
8
- import { getVersionState, VERSION_PATTERN } from '../scripts/version-check.mjs'
11
+ import { listRuntimeInventory, resolveRuntimeInfo } from '../helpers/runtime-info.mjs'
12
+ import { evaluateVersionBump, getLatestTagVersion, getVersionState, VERSION_PATTERN } from '../scripts/version-check.mjs'
13
+ import { auditTsconfigAlignment, resolveToolchainPathsFromProject } from '../helpers/toolchain-config.mjs'
14
+ import { isGitHookInstalled } from '../scripts/install-git-hooks.mjs'
15
+
16
+ function statusValue(value, okLabel = null) {
17
+ if (value == null || value === '') return chalk.gray('—')
18
+ return okLabel ?? value
19
+ }
9
20
 
10
- export function registerDoctorCommand(cli, { cliName = 'xcore', runtimeName }) {
21
+ function printSection(title) {
22
+ console.log(chalk.bold.cyan(`\n ${title}`))
23
+ }
24
+
25
+ export function registerDoctorCommand(cli, { cliName = 'xcore' } = {}) {
11
26
  cli
12
27
  .command('doctor')
13
- .description('Verify runtime, git, project version, and @xrystal/core alignment')
28
+ .description('Check runtime, git, and @xrystal/core alignment')
14
29
  .action(async () => {
15
30
  const root = getProjectRoot()
16
31
  const cliPkg = readCliPackageJson()
17
32
  const projectPkg = readProjectPackageJson(root)
18
33
  const core = getInstalledCoreVersion(root)
34
+ const runtime = resolveRuntimeInfo(root)
35
+ let distLayout = null
19
36
 
20
- console.log(chalk.cyan(`\n${cliName} doctor\n`))
21
- console.log(` project root: ${chalk.bold(root)}`)
22
- console.log(` runtime: ${runtimeName} ${process.version}`)
23
- console.log('')
24
- console.log(chalk.gray(' CLI (tool)'))
25
- console.log(` @xrystal/core: ${chalk.bold(`${cliPkg.name}@${cliPkg.version}`)}`)
26
- console.log('')
27
- console.log(chalk.gray(' Project (service)'))
28
- console.log(` name: ${chalk.bold(projectPkg.name)}`)
29
- console.log(` version: ${chalk.bold(projectPkg.version)}`)
30
- console.log(` version format: ${VERSION_PATTERN.test(projectPkg.version) ? chalk.green('valid semver') : chalk.yellow('check format')}`)
37
+ try {
38
+ distLayout = resolveDistLayout(root)
39
+ } catch {
40
+ distLayout = null
41
+ }
42
+
43
+ printCommandHeader({ cliName, command: 'doctor', version: cliPkg.version })
44
+
45
+ const inventory = listRuntimeInventory(runtime)
46
+
47
+ function printRuntimeRow(item) {
48
+ const label = item.label.padEnd(18)
49
+ if (!item.version && !item.path) {
50
+ console.log(` ${label}${chalk.gray('—')}`)
51
+ return
52
+ }
53
+ const versionText = item.version ? chalk.white(item.version) : chalk.gray('—')
54
+ const activeMark = item.active ? chalk.green(' · active') : ''
55
+ const pathText = item.path ? chalk.gray(` · ${item.path}`) : ''
56
+ console.log(` ${label}${versionText}${activeMark}${pathText}`)
57
+ }
58
+
59
+ printSection('Environment')
60
+ console.log(` ${'platform'.padEnd(18)}${chalk.bold(runtime.platform)} ${chalk.gray(`(${runtime.osRelease})`)}`)
61
+ console.log(` ${'CLI host'.padEnd(18)}${chalk.bold(`${runtime.cliHostLabel} ${runtime.cliHostVersion}`)} ${chalk.gray(`(${runtime.cliHost})`)}`)
62
+ console.log(` ${'git'.padEnd(18)}${statusValue(runtime.git, runtime.git ? chalk.gray(runtime.git) : null)}`)
63
+ console.log(` ${'package manager'.padEnd(18)}${chalk.bold(runtime.packageManager)} ${chalk.gray('(lockfile)')}`)
64
+
65
+ printSection('Runtimes (PATH)')
66
+ for (const item of inventory.executables) printRuntimeRow(item)
67
+
68
+ printSection('Node version managers')
69
+ for (const item of inventory.managers) printRuntimeRow(item)
70
+
71
+ printSection('Project')
72
+ console.log(` ${'root'.padEnd(18)}${chalk.bold(root)}`)
73
+ if (distLayout) {
74
+ console.log(` ${'tmp root'.padEnd(18)}${chalk.bold(distLayout.rootFolderPath)} ${chalk.gray('(paths.root)')}`)
75
+ console.log(` ${'source'.padEnd(18)}${chalk.bold(distLayout.layout.mainFolderPath)} ${chalk.gray('(paths.source)')}`)
76
+ console.log(` ${'dist'.padEnd(18)}${chalk.bold(distLayout.distPrefix)} ${chalk.gray('(paths.special.dist)')}`)
77
+ } else {
78
+ console.log(chalk.yellow(' layout: tmp.yml not resolved — run xcore tmp'))
79
+ }
80
+
81
+ printSection('CLI (tool)')
82
+ console.log(` ${'@xrystal/core'.padEnd(18)}${chalk.bold(`${cliPkg.name}@${cliPkg.version}`)}`)
83
+
84
+ printSection('Package')
85
+ console.log(` ${'name'.padEnd(18)}${chalk.bold(projectPkg.name)}`)
86
+ console.log(` ${'version'.padEnd(18)}${chalk.bold(projectPkg.version)}`)
87
+ console.log(` ${'semver'.padEnd(18)}${VERSION_PATTERN.test(projectPkg.version) ? chalk.green('valid') : chalk.yellow('check format')}`)
31
88
 
32
89
  if (core.declared) {
33
- console.log(` @xrystal/core (pkg): ${core.declared}`)
90
+ console.log(` ${'dependency'.padEnd(18)}${core.declared}`)
34
91
  }
35
92
  if (core.installed) {
36
93
  const latestHint = core.installed === cliPkg.version ? chalk.green('matches CLI') : chalk.yellow(`CLI is ${cliPkg.version}`)
37
- console.log(` @xrystal/core (node_modules): ${chalk.bold(core.installed)} ${latestHint}`)
94
+ console.log(` ${'node_modules'.padEnd(18)}${chalk.bold(core.installed)} ${latestHint}`)
38
95
  } else if (!core.isWorkspace) {
39
- console.log(chalk.yellow(' @xrystal/core (node_modules): not installed'))
96
+ console.log(chalk.yellow(` ${'node_modules'.padEnd(18)}not installed`))
97
+ }
98
+ if (core.installed && core.installed !== cliPkg.version && !core.isWorkspace) {
99
+ console.log('')
100
+ console.log(chalk.bold.red(' ⚠ CLI / node_modules version mismatch'))
101
+ console.log(chalk.yellow(` CLI (this binary): ${cliPkg.version}`))
102
+ console.log(chalk.yellow(` node_modules installed: ${core.installed}`))
103
+ console.log(chalk.gray(` fix: bun add @xrystal/core@${cliPkg.version}`))
40
104
  }
41
105
 
42
- console.log('')
43
- console.log(chalk.gray(' Git'))
106
+ printSection('Git')
44
107
 
45
108
  try {
46
109
  const state = getVersionState('HEAD', root)
47
- console.log(` branch: ${state.branch}`)
48
- console.log(` HEAD version: ${state.committed.version}`)
49
- console.log(` disk version: ${state.disk.version}`)
50
- console.log(` version match: ${state.versionMatch ? chalk.green('yes') : chalk.red('no')}`)
51
- console.log(` package.json: ${state.isPackageJsonClean ? chalk.green('committed') : chalk.yellow('dirty')}`)
52
- console.log(` working tree: ${state.isClean ? chalk.green('clean') : chalk.yellow('dirty')}`)
110
+ console.log(` ${'branch'.padEnd(18)}${state.branch}`)
111
+ console.log(` ${'HEAD version'.padEnd(18)}${state.committed.version}`)
112
+ console.log(` ${'disk version'.padEnd(18)}${state.disk.version}`)
113
+ console.log(` ${'version match'.padEnd(18)}${state.versionMatch ? chalk.green('yes') : chalk.red('no')}`)
114
+ console.log(` ${'package.json'.padEnd(18)}${state.isPackageJsonClean ? chalk.green('committed') : chalk.yellow('dirty')}`)
115
+ const latestTag = getLatestTagVersion(root)
116
+ console.log(` ${'latest tag'.padEnd(18)}${latestTag ? `v${latestTag}` : chalk.gray('none')}`)
117
+ const evaluation = evaluateVersionBump(state.committed.version, 'HEAD', root)
118
+ if (evaluation.baselineVersion) {
119
+ const bumpText = evaluation.ok
120
+ ? chalk.green(`ok (${evaluation.status})`)
121
+ : chalk.red(`must be > ${evaluation.baselineVersion}`)
122
+ console.log(` bump vs ${evaluation.baselineLabel}: ${bumpText}`)
123
+ } else {
124
+ console.log(` ${'bump check'.padEnd(18)}${chalk.green('first release baseline')}`)
125
+ }
126
+ console.log(` ${'working tree'.padEnd(18)}${state.isClean ? chalk.green('clean') : chalk.yellow('dirty')}`)
127
+ const hookOk = isGitHookInstalled(root)
128
+ console.log(` ${'pre-commit hook'.padEnd(18)}${hookOk ? chalk.green('installed') : chalk.yellow('missing')} ${chalk.gray('· xcore hooks install')}`)
53
129
  } catch (error) {
54
130
  console.log(chalk.yellow(` git: ${error.message}`))
55
131
  }
56
132
 
133
+ printSection('Toolchain')
134
+ const toolchain = resolveToolchainPathsFromProject(root)
135
+ console.log(` ${'source'.padEnd(18)}${chalk.bold(toolchain.mainSourceRel)}`)
136
+ console.log(` ${'outDir'.padEnd(18)}${chalk.bold(toolchain.outDir)}`)
137
+ const tsAudit = auditTsconfigAlignment(root)
138
+ if (tsAudit.missing) {
139
+ console.log(chalk.yellow(` ${'tsconfig'.padEnd(18)}missing · run xcore sync-toolchain`))
140
+ } else if (tsAudit.ok) {
141
+ console.log(chalk.green(` ${'tsconfig'.padEnd(18)}aligned with tmp.yml`))
142
+ } else {
143
+ console.log(chalk.yellow(` ${'tsconfig'.padEnd(18)}drift from tmp.yml`))
144
+ for (const note of tsAudit.notes) console.log(chalk.gray(` · ${note}`))
145
+ }
146
+ console.log(` ${'eslint'.padEnd(18)}${toolchain.eslintFiles.join(', ')}`)
57
147
  console.log('')
58
148
  })
59
149
  }
@@ -0,0 +1,55 @@
1
+ import chalk from 'chalk'
2
+
3
+ import { printCommandHeader } from '../helpers/banner.mjs'
4
+ import { readCliPackageJson } from '../helpers/project-root.mjs'
5
+ import { installGitHooks, isGitHookInstalled } from '../scripts/install-git-hooks.mjs'
6
+ import { getProjectRoot } from '../helpers/project-root.mjs'
7
+
8
+ export function registerHooksCommand(cli, { cliName = 'xcore' } = {}) {
9
+ const hooks = cli
10
+ .command('hooks')
11
+ .description('Install git hooks for version bump checks')
12
+ .addHelpText(
13
+ 'after',
14
+ `
15
+ ${chalk.gray('Examples:')}
16
+ ${cliName} hooks install
17
+ ${cliName} hooks status
18
+ `,
19
+ )
20
+
21
+ hooks
22
+ .command('install')
23
+ .description('Write pre-commit hook to .git/hooks (core repo + services)')
24
+ .action(() => {
25
+ try {
26
+ const root = getProjectRoot()
27
+ printCommandHeader({ cliName, command: 'hooks install', version: readCliPackageJson().version })
28
+
29
+ if (isGitHookInstalled(root)) {
30
+ console.log(chalk.yellow(' pre-commit hook already installed — refreshing'))
31
+ }
32
+
33
+ const result = installGitHooks(root)
34
+ console.log(chalk.green('\n✓ pre-commit hook installed\n'))
35
+ console.log(chalk.gray(` project: ${result.root}`))
36
+ console.log(chalk.gray(` hook: ${result.hookPath}`))
37
+ console.log(chalk.gray(` checker: ${result.scriptPath}`))
38
+ console.log(chalk.dim('\n Runs on git commit when package.json version changes.\n'))
39
+ } catch (error) {
40
+ console.error(chalk.red(`\n✗ ${error.message}\n`))
41
+ process.exit(1)
42
+ }
43
+ })
44
+
45
+ hooks
46
+ .command('status')
47
+ .description('Show whether @xrystal/core pre-commit hook is installed')
48
+ .action(() => {
49
+ const root = getProjectRoot()
50
+ printCommandHeader({ cliName, command: 'hooks status', version: readCliPackageJson().version })
51
+ const installed = isGitHookInstalled(root)
52
+ console.log(` pre-commit: ${installed ? chalk.green('installed') : chalk.yellow('not installed')}`)
53
+ console.log(chalk.gray(` fix: ${cliName} hooks install\n`))
54
+ })
55
+ }
@@ -2,29 +2,26 @@ import { execSync } from 'node:child_process'
2
2
  import fs from 'node:fs'
3
3
  import path from 'node:path'
4
4
  import chalk from 'chalk'
5
- import { getProjectRoot, projectHasPath } from '../helpers/project-root.mjs'
6
- import { ensureTmpFile, relativeFromRoot } from '../helpers/tmp-layout.mjs'
7
5
 
8
- function resolveEntry(root) {
9
- const layout = ensureTmpFile(root).layout
10
- const mainFolder = path.resolve(root, layout.mainFolderPath)
11
- const tsEntry = path.join(mainFolder, 'index.ts')
12
- const jsEntry = path.join(mainFolder, 'index.js')
13
-
14
- if (fs.existsSync(tsEntry)) return relativeFromRoot(root, tsEntry)
15
- if (fs.existsSync(jsEntry)) return relativeFromRoot(root, jsEntry)
16
- if (projectHasPath(root, 'source/index.ts')) return 'source/index.ts'
17
- if (projectHasPath(root, 'source/index.js')) return 'source/index.js'
18
- throw new Error('No index.ts or index.js found (check configs.mainFolderPath in tmp.yml).')
19
- }
6
+ import {
7
+ isCorePackageName,
8
+ readTmpBuildContext,
9
+ resolveCoreBuildSteps,
10
+ resolveDevEntry,
11
+ resolveDistEntryAbs,
12
+ resolveEnvFiles,
13
+ resolveServiceBuildSteps,
14
+ shouldDelegatePackageBuild,
15
+ summarizeBuildPlan,
16
+ } from '../helpers/build-config.mjs'
17
+ import { getProjectRoot } from '../helpers/project-root.mjs'
18
+ import { printCommandHeader } from '../helpers/banner.mjs'
19
+ import { readCliPackageJson } from '../helpers/project-root.mjs'
20
+ import { ensureTmpFile, relativeFromRoot } from '../helpers/tmp-layout.mjs'
21
+ import { ensureProjectArtifacts } from '../helpers/project-artifacts.mjs'
20
22
 
21
- function resolveEnvFiles(root) {
22
- const layout = ensureTmpFile(root).layout
23
- const candidates = [
24
- path.join(layout.pathsAbs.environments, '.global.env'),
25
- path.join(layout.pathsAbs.environments, '.dev.env'),
26
- ]
27
- return candidates.filter((file) => fs.existsSync(file))
23
+ function runInProject(root, command) {
24
+ execSync(command, { cwd: root, stdio: 'inherit', env: process.env })
28
25
  }
29
26
 
30
27
  function resolveTestTarget(root) {
@@ -37,57 +34,93 @@ function resolveTestTarget(root) {
37
34
  )
38
35
  }
39
36
 
40
- function runInProject(root, command) {
41
- execSync(command, { cwd: root, stdio: 'inherit', env: process.env })
42
- }
43
-
44
37
  export function registerProjectCommands(cli, { cliName = 'xcore' } = {}) {
45
38
  cli
46
39
  .command('dev')
47
- .description('Run project in watch mode (mainFolderPath + rootFolder/environments from tmp.yml)')
40
+ .description('Watch source/index.ts with dev env files')
48
41
  .action(() => {
49
42
  const root = getProjectRoot()
50
- const entry = resolveEntry(root)
51
- const envFiles = resolveEnvFiles(root)
43
+ const { layout } = readTmpBuildContext(root)
44
+ const entry = resolveDevEntry(root, layout)
45
+ const envFiles = resolveEnvFiles(layout.pathsAbs.environments, ['.global.env', '.dev.env'])
52
46
  const envArgs = envFiles.map((file) => `--env-file=${file}`).join(' ')
53
47
 
54
- console.log(chalk.cyan(`\n${cliName} dev · ${root}\n`))
48
+ printCommandHeader({ cliName, command: 'dev', version: readCliPackageJson().version })
49
+ console.log(chalk.gray(` root: ${root}`))
50
+ console.log(chalk.gray(` entry: ${entry} (.ts)\n`))
55
51
  runInProject(root, `bun --watch ${envArgs} ${entry}`.trim())
56
52
  })
57
53
 
58
54
  cli
59
55
  .command('build')
60
- .description('Build project (service script or core default → rootFolder/dist from tmp.yml)')
56
+ .description('Bundle to dist/ (Bun + optional tsc)')
61
57
  .action(() => {
62
58
  const root = getProjectRoot()
59
+ ensureProjectArtifacts(root, { writeToolchain: true, writeManifest: true })
63
60
  const pkg = JSON.parse(fs.readFileSync(path.join(root, 'package.json'), 'utf8'))
64
61
 
65
- console.log(chalk.cyan(`\n${cliName} build · ${root}\n`))
62
+ printCommandHeader({ cliName, command: 'build', version: readCliPackageJson().version })
63
+ console.log(chalk.gray(` root: ${root}`))
66
64
 
67
- if (pkg.scripts?.build && pkg.name !== '@xrystal/core') {
65
+ if (shouldDelegatePackageBuild(pkg)) {
68
66
  runInProject(root, 'bun run build')
69
67
  return
70
68
  }
71
69
 
72
- const layout = ensureTmpFile(root).layout
73
- const distDir = relativeFromRoot(root, layout.pathsAbs.dist)
70
+ const { layout, build } = readTmpBuildContext(root)
71
+ const plan = summarizeBuildPlan(root, layout, build)
72
+ const steps = isCorePackageName(pkg.name)
73
+ ? resolveCoreBuildSteps(root, plan.distRel, build)
74
+ : resolveServiceBuildSteps(root, layout, build)
75
+ console.log(chalk.gray(` mode: ${isCorePackageName(pkg.name) ? 'core entries' : 'service tsconfig + tmp overrides'}`))
76
+ if (plan.tsconfigRel) {
77
+ console.log(chalk.gray(` tsconfig: ${plan.tsconfigRel}`))
78
+ }
79
+ console.log(chalk.gray(` dist: ${plan.distRel}/ (${plan.distSource})`))
80
+ console.log(chalk.gray(` glob: ${plan.entryGlobs.join(', ')} (${plan.globSource})`))
81
+ if (plan.typecheck) console.log(chalk.gray(' typecheck: tsc --noEmit'))
82
+ if (plan.declarations) console.log(chalk.gray(' declarations: tsc --emitDeclarationOnly'))
83
+ if (plan.sourcemap !== 'false') console.log(chalk.gray(` sourcemap: ${plan.sourcemap}`))
84
+ if (plan.minify && plan.minify !== 'off') console.log(chalk.gray(` minify: ${plan.minify}`))
85
+ console.log('')
86
+
87
+ runInProject(root, steps.join(' && '))
88
+ })
89
+
90
+ cli
91
+ .command('start')
92
+ .alias('start:dist')
93
+ .description('Run dist/index.js with prod env files')
94
+ .action(() => {
95
+ const root = getProjectRoot()
96
+ const { layout, build } = readTmpBuildContext(root)
97
+ const entryAbs = resolveDistEntryAbs(root, layout, build)
98
+
99
+ if (!fs.existsSync(entryAbs)) {
100
+ throw new Error(
101
+ `Build output not found: ${path.relative(root, entryAbs)}. Run ${cliName} build first.`,
102
+ )
103
+ }
104
+
105
+ const entry = relativeFromRoot(root, entryAbs)
106
+ const envFiles = resolveEnvFiles(layout.pathsAbs.environments, ['.global.env', '.prod.env'])
107
+ const envArgs = envFiles.map((file) => `--env-file=${file}`).join(' ')
74
108
 
75
- runInProject(root, [
76
- `rm -rf ${distDir}`,
77
- `bun build ./source/index.ts ./source/loader/index.ts ./source/project/index.ts ./source/utils/index.ts --outdir ${distDir} --target node --external '*'`,
78
- 'bun run tsc --project tsconfig.json',
79
- 'bunx tsc-alias -p tsconfig.json',
80
- ].join(' && '))
109
+ printCommandHeader({ cliName, command: 'start', version: readCliPackageJson().version })
110
+ console.log(chalk.gray(` root: ${root}`))
111
+ console.log(chalk.gray(` entry: ${entry} (.js)\n`))
112
+ runInProject(root, `bun ${envArgs} ${entry}`.trim())
81
113
  })
82
114
 
83
115
  cli
84
116
  .command('test')
85
- .description('Run project tests (rootFolder/tests from tmp.yml)')
117
+ .description('Run tests from tmp.yml paths')
86
118
  .action(() => {
87
119
  const root = getProjectRoot()
88
120
  const target = resolveTestTarget(root)
89
121
 
90
- console.log(chalk.cyan(`\n${cliName} test · ${target}\n`))
122
+ printCommandHeader({ cliName, command: 'test', version: readCliPackageJson().version })
123
+ console.log(chalk.gray(` target: ${target}\n`))
91
124
  runInProject(root, `bun test ${target}`)
92
125
  })
93
126
  }
@@ -1,11 +1,11 @@
1
1
  import chalk from 'chalk'
2
2
  import { readCliPackageJson, readProjectPackageJson, getProjectRoot } from '../helpers/project-root.mjs'
3
- import { getVersionState, runTagRelease } from '../scripts/version-check.mjs'
3
+ import { compareSemver, getVersionState, resolveVersionBaseline, runTagRelease } from '../scripts/version-check.mjs'
4
4
 
5
5
  export function registerTagCommand(cli, { cliName = 'xcore' } = {}) {
6
6
  cli
7
7
  .command('tag')
8
- .description('Tag project HEAD from package.json version and push (triggers npm publish for core)')
8
+ .description('Git tag from package.json (+ npm publish for core)')
9
9
  .option('--dry-run', 'Print commands without executing')
10
10
  .option('--strict-clean', 'Require fully clean working tree (default: only package.json must be committed)')
11
11
  .option('--skip-prepare', 'Skip lint, test, and build:prod (core only)')
@@ -30,7 +30,7 @@ export function registerTagCommand(cli, { cliName = 'xcore' } = {}) {
30
30
  export function registerVersionCommand(cli, { cliName = 'xcore' } = {}) {
31
31
  cli
32
32
  .command('version')
33
- .description('Show CLI tool version and project package.json alignment')
33
+ .description('Show CLI and project package versions')
34
34
  .action(() => {
35
35
  try {
36
36
  const root = getProjectRoot()
@@ -51,6 +51,11 @@ export function registerVersionCommand(cli, { cliName = 'xcore' } = {}) {
51
51
  console.log(` branch: ${state.branch}`)
52
52
  console.log(` version match: ${state.versionMatch ? chalk.green('yes') : chalk.red('no')}`)
53
53
  console.log(` package.json committed: ${state.isPackageJsonClean ? chalk.green('yes') : chalk.red('no')}`)
54
+ const { baselineVersion, baselineLabel } = resolveVersionBaseline(root)
55
+ if (baselineVersion) {
56
+ const bumpOk = compareSemver(state.committed.version, baselineVersion) > 0
57
+ console.log(` bump vs ${baselineLabel}: ${bumpOk ? chalk.green('ok') : chalk.red('must be > ' + baselineVersion)}`)
58
+ }
54
59
  console.log(` working tree: ${state.isClean ? chalk.green('clean') : chalk.yellow('dirty')}`)
55
60
  console.log('')
56
61
  } catch (error) {