intershell 0.3.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 (357) hide show
  1. package/README.md +301 -0
  2. package/dist/commands/ci/act.d.ts +13 -0
  3. package/dist/commands/ci/act.d.ts.map +1 -0
  4. package/dist/commands/ci/act.js +89 -0
  5. package/dist/commands/ci/act.js.map +1 -0
  6. package/dist/commands/ci/attach-affected.d.ts +12 -0
  7. package/dist/commands/ci/attach-affected.d.ts.map +1 -0
  8. package/dist/commands/ci/attach-affected.js +83 -0
  9. package/dist/commands/ci/attach-affected.js.map +1 -0
  10. package/dist/commands/ci/attach-service-ports.d.ts +10 -0
  11. package/dist/commands/ci/attach-service-ports.d.ts.map +1 -0
  12. package/dist/commands/ci/attach-service-ports.js +25 -0
  13. package/dist/commands/ci/attach-service-ports.js.map +1 -0
  14. package/dist/commands/commit-check.d.ts +13 -0
  15. package/dist/commands/commit-check.d.ts.map +1 -0
  16. package/dist/commands/commit-check.js +110 -0
  17. package/dist/commands/commit-check.js.map +1 -0
  18. package/dist/commands/commit.d.ts +16 -0
  19. package/dist/commands/commit.d.ts.map +1 -0
  20. package/dist/commands/commit.js +91 -0
  21. package/dist/commands/commit.js.map +1 -0
  22. package/dist/commands/dev/check.d.ts +13 -0
  23. package/dist/commands/dev/check.d.ts.map +1 -0
  24. package/dist/commands/dev/check.js +91 -0
  25. package/dist/commands/dev/check.js.map +1 -0
  26. package/dist/commands/dev/cleanup.d.ts +10 -0
  27. package/dist/commands/dev/cleanup.d.ts.map +1 -0
  28. package/dist/commands/dev/cleanup.js +28 -0
  29. package/dist/commands/dev/cleanup.js.map +1 -0
  30. package/dist/commands/dev/rm.d.ts +12 -0
  31. package/dist/commands/dev/rm.d.ts.map +1 -0
  32. package/dist/commands/dev/rm.js +49 -0
  33. package/dist/commands/dev/rm.js.map +1 -0
  34. package/dist/commands/dev/setup.d.ts +10 -0
  35. package/dist/commands/dev/setup.d.ts.map +1 -0
  36. package/dist/commands/dev/setup.js +40 -0
  37. package/dist/commands/dev/setup.js.map +1 -0
  38. package/dist/commands/local/cleanup.d.ts +12 -0
  39. package/dist/commands/local/cleanup.d.ts.map +1 -0
  40. package/dist/commands/local/cleanup.js +62 -0
  41. package/dist/commands/local/cleanup.js.map +1 -0
  42. package/dist/commands/local/setup.d.ts +11 -0
  43. package/dist/commands/local/setup.d.ts.map +1 -0
  44. package/dist/commands/local/setup.js +55 -0
  45. package/dist/commands/local/setup.js.map +1 -0
  46. package/dist/commands/local/vscode.d.ts +17 -0
  47. package/dist/commands/local/vscode.d.ts.map +1 -0
  48. package/dist/commands/local/vscode.js +94 -0
  49. package/dist/commands/local/vscode.js.map +1 -0
  50. package/dist/commands/update-package-json.d.ts +12 -0
  51. package/dist/commands/update-package-json.d.ts.map +1 -0
  52. package/dist/commands/update-package-json.js +82 -0
  53. package/dist/commands/update-package-json.js.map +1 -0
  54. package/dist/commands/version/apply.d.ts +16 -0
  55. package/dist/commands/version/apply.d.ts.map +1 -0
  56. package/dist/commands/version/apply.js +120 -0
  57. package/dist/commands/version/apply.js.map +1 -0
  58. package/dist/commands/version/ci.d.ts +12 -0
  59. package/dist/commands/version/ci.d.ts.map +1 -0
  60. package/dist/commands/version/ci.js +67 -0
  61. package/dist/commands/version/ci.js.map +1 -0
  62. package/dist/commands/version/prepare.d.ts +19 -0
  63. package/dist/commands/version/prepare.d.ts.map +1 -0
  64. package/dist/commands/version/prepare.js +153 -0
  65. package/dist/commands/version/prepare.js.map +1 -0
  66. package/dist/core/colorify.d.ts +21 -0
  67. package/dist/core/colorify.d.ts.map +1 -0
  68. package/dist/core/colorify.js +56 -0
  69. package/dist/core/colorify.js.map +1 -0
  70. package/dist/core/index.d.ts +4 -0
  71. package/dist/core/index.d.ts.map +1 -0
  72. package/dist/core/index.js +3 -0
  73. package/dist/core/index.js.map +1 -0
  74. package/dist/core/types.d.ts +181 -0
  75. package/dist/core/types.d.ts.map +1 -0
  76. package/dist/core/types.js +5 -0
  77. package/dist/core/types.js.map +1 -0
  78. package/dist/core/wrapshell.d.ts +19 -0
  79. package/dist/core/wrapshell.d.ts.map +1 -0
  80. package/dist/core/wrapshell.js +323 -0
  81. package/dist/core/wrapshell.js.map +1 -0
  82. package/dist/entities/affected/affected.d.ts +4 -0
  83. package/dist/entities/affected/affected.d.ts.map +1 -0
  84. package/dist/entities/affected/affected.js +20 -0
  85. package/dist/entities/affected/affected.js.map +1 -0
  86. package/dist/entities/affected/affected.test.d.ts +2 -0
  87. package/dist/entities/affected/affected.test.d.ts.map +1 -0
  88. package/dist/entities/affected/affected.test.js +305 -0
  89. package/dist/entities/affected/affected.test.js.map +1 -0
  90. package/dist/entities/affected/index.d.ts +2 -0
  91. package/dist/entities/affected/index.d.ts.map +1 -0
  92. package/dist/entities/affected/index.js +2 -0
  93. package/dist/entities/affected/index.js.map +1 -0
  94. package/dist/entities/branch/branch.d.ts +8 -0
  95. package/dist/entities/branch/branch.d.ts.map +1 -0
  96. package/dist/entities/branch/branch.js +74 -0
  97. package/dist/entities/branch/branch.js.map +1 -0
  98. package/dist/entities/branch/branch.test.d.ts +2 -0
  99. package/dist/entities/branch/branch.test.d.ts.map +1 -0
  100. package/dist/entities/branch/branch.test.js +316 -0
  101. package/dist/entities/branch/branch.test.js.map +1 -0
  102. package/dist/entities/branch/branch.types.d.ts +6 -0
  103. package/dist/entities/branch/branch.types.d.ts.map +1 -0
  104. package/dist/entities/branch/branch.types.js +2 -0
  105. package/dist/entities/branch/branch.types.js.map +1 -0
  106. package/dist/entities/branch/index.d.ts +3 -0
  107. package/dist/entities/branch/index.d.ts.map +1 -0
  108. package/dist/entities/branch/index.js +3 -0
  109. package/dist/entities/branch/index.js.map +1 -0
  110. package/dist/entities/commit/commit.d.ts +15 -0
  111. package/dist/entities/commit/commit.d.ts.map +1 -0
  112. package/dist/entities/commit/commit.js +196 -0
  113. package/dist/entities/commit/commit.js.map +1 -0
  114. package/dist/entities/commit/commit.test.d.ts +26 -0
  115. package/dist/entities/commit/commit.test.d.ts.map +1 -0
  116. package/dist/entities/commit/commit.test.js +550 -0
  117. package/dist/entities/commit/commit.test.js.map +1 -0
  118. package/dist/entities/commit/commit.types.d.ts +49 -0
  119. package/dist/entities/commit/commit.types.d.ts.map +1 -0
  120. package/dist/entities/commit/commit.types.js +31 -0
  121. package/dist/entities/commit/commit.types.js.map +1 -0
  122. package/dist/entities/commit/index.d.ts +3 -0
  123. package/dist/entities/commit/index.d.ts.map +1 -0
  124. package/dist/entities/commit/index.js +3 -0
  125. package/dist/entities/commit/index.js.map +1 -0
  126. package/dist/entities/commit/pr.d.ts +11 -0
  127. package/dist/entities/commit/pr.d.ts.map +1 -0
  128. package/dist/entities/commit/pr.js +201 -0
  129. package/dist/entities/commit/pr.js.map +1 -0
  130. package/dist/entities/commit/pr.test.d.ts +2 -0
  131. package/dist/entities/commit/pr.test.d.ts.map +1 -0
  132. package/dist/entities/commit/pr.test.js +782 -0
  133. package/dist/entities/commit/pr.test.js.map +1 -0
  134. package/dist/entities/compose/compose.d.ts +18 -0
  135. package/dist/entities/compose/compose.d.ts.map +1 -0
  136. package/dist/entities/compose/compose.js +197 -0
  137. package/dist/entities/compose/compose.js.map +1 -0
  138. package/dist/entities/compose/compose.test.d.ts +2 -0
  139. package/dist/entities/compose/compose.test.d.ts.map +1 -0
  140. package/dist/entities/compose/compose.test.js +406 -0
  141. package/dist/entities/compose/compose.test.js.map +1 -0
  142. package/dist/entities/compose/compose.types.d.ts +77 -0
  143. package/dist/entities/compose/compose.types.d.ts.map +1 -0
  144. package/dist/entities/compose/compose.types.js +2 -0
  145. package/dist/entities/compose/compose.types.js.map +1 -0
  146. package/dist/entities/compose/index.d.ts +3 -0
  147. package/dist/entities/compose/index.d.ts.map +1 -0
  148. package/dist/entities/compose/index.js +3 -0
  149. package/dist/entities/compose/index.js.map +1 -0
  150. package/dist/entities/entities.shell.d.ts +29 -0
  151. package/dist/entities/entities.shell.d.ts.map +1 -0
  152. package/dist/entities/entities.shell.js +27 -0
  153. package/dist/entities/entities.shell.js.map +1 -0
  154. package/dist/entities/entities.shell.test.d.ts +2 -0
  155. package/dist/entities/entities.shell.test.d.ts.map +1 -0
  156. package/dist/entities/entities.shell.test.js +23 -0
  157. package/dist/entities/entities.shell.test.js.map +1 -0
  158. package/dist/entities/index.d.ts +12 -0
  159. package/dist/entities/index.d.ts.map +1 -0
  160. package/dist/entities/index.js +12 -0
  161. package/dist/entities/index.js.map +1 -0
  162. package/dist/entities/intershell-config/intershell-config.d.ts +11 -0
  163. package/dist/entities/intershell-config/intershell-config.d.ts.map +1 -0
  164. package/dist/entities/intershell-config/intershell-config.default.d.ts +188 -0
  165. package/dist/entities/intershell-config/intershell-config.default.d.ts.map +1 -0
  166. package/dist/entities/intershell-config/intershell-config.default.js +225 -0
  167. package/dist/entities/intershell-config/intershell-config.default.js.map +1 -0
  168. package/dist/entities/intershell-config/intershell-config.js +132 -0
  169. package/dist/entities/intershell-config/intershell-config.js.map +1 -0
  170. package/dist/entities/intershell-config/intershell-config.test.d.ts +2 -0
  171. package/dist/entities/intershell-config/intershell-config.test.d.ts.map +1 -0
  172. package/dist/entities/intershell-config/intershell-config.test.js +102 -0
  173. package/dist/entities/intershell-config/intershell-config.test.js.map +1 -0
  174. package/dist/entities/intershell-config/intershell-config.types.d.ts +103 -0
  175. package/dist/entities/intershell-config/intershell-config.types.d.ts.map +1 -0
  176. package/dist/entities/intershell-config/intershell-config.types.js +2 -0
  177. package/dist/entities/intershell-config/intershell-config.types.js.map +1 -0
  178. package/dist/entities/package/index.d.ts +4 -0
  179. package/dist/entities/package/index.d.ts.map +1 -0
  180. package/dist/entities/package/index.js +4 -0
  181. package/dist/entities/package/index.js.map +1 -0
  182. package/dist/entities/package/package.d.ts +49 -0
  183. package/dist/entities/package/package.d.ts.map +1 -0
  184. package/dist/entities/package/package.js +234 -0
  185. package/dist/entities/package/package.js.map +1 -0
  186. package/dist/entities/package/package.shell.d.ts +48 -0
  187. package/dist/entities/package/package.shell.d.ts.map +1 -0
  188. package/dist/entities/package/package.shell.js +118 -0
  189. package/dist/entities/package/package.shell.js.map +1 -0
  190. package/dist/entities/package/package.test.d.ts +23 -0
  191. package/dist/entities/package/package.test.d.ts.map +1 -0
  192. package/dist/entities/package/package.test.js +637 -0
  193. package/dist/entities/package/package.test.js.map +1 -0
  194. package/dist/entities/package/package.types.d.ts +48 -0
  195. package/dist/entities/package/package.types.d.ts.map +1 -0
  196. package/dist/entities/package/package.types.js +2 -0
  197. package/dist/entities/package/package.types.js.map +1 -0
  198. package/dist/entities/package-changelog/index.d.ts +4 -0
  199. package/dist/entities/package-changelog/index.d.ts.map +1 -0
  200. package/dist/entities/package-changelog/index.js +4 -0
  201. package/dist/entities/package-changelog/index.js.map +1 -0
  202. package/dist/entities/package-changelog/package-changelog.d.ts +20 -0
  203. package/dist/entities/package-changelog/package-changelog.d.ts.map +1 -0
  204. package/dist/entities/package-changelog/package-changelog.js +59 -0
  205. package/dist/entities/package-changelog/package-changelog.js.map +1 -0
  206. package/dist/entities/package-changelog/package-changelog.types.d.ts +25 -0
  207. package/dist/entities/package-changelog/package-changelog.types.d.ts.map +1 -0
  208. package/dist/entities/package-changelog/package-changelog.types.js +2 -0
  209. package/dist/entities/package-changelog/package-changelog.types.js.map +1 -0
  210. package/dist/entities/package-changelog/template.d.ts +20 -0
  211. package/dist/entities/package-changelog/template.d.ts.map +1 -0
  212. package/dist/entities/package-changelog/template.default.d.ts +10 -0
  213. package/dist/entities/package-changelog/template.default.d.ts.map +1 -0
  214. package/dist/entities/package-changelog/template.default.js +85 -0
  215. package/dist/entities/package-changelog/template.default.js.map +1 -0
  216. package/dist/entities/package-changelog/template.js +90 -0
  217. package/dist/entities/package-changelog/template.js.map +1 -0
  218. package/dist/entities/package-commits/dependency-analyzer.d.ts +35 -0
  219. package/dist/entities/package-commits/dependency-analyzer.d.ts.map +1 -0
  220. package/dist/entities/package-commits/dependency-analyzer.js +169 -0
  221. package/dist/entities/package-commits/dependency-analyzer.js.map +1 -0
  222. package/dist/entities/package-commits/dependency-analyzer.test.d.ts +2 -0
  223. package/dist/entities/package-commits/dependency-analyzer.test.d.ts.map +1 -0
  224. package/dist/entities/package-commits/dependency-analyzer.test.js +25 -0
  225. package/dist/entities/package-commits/dependency-analyzer.test.js.map +1 -0
  226. package/dist/entities/package-commits/index.d.ts +3 -0
  227. package/dist/entities/package-commits/index.d.ts.map +1 -0
  228. package/dist/entities/package-commits/index.js +3 -0
  229. package/dist/entities/package-commits/index.js.map +1 -0
  230. package/dist/entities/package-commits/package-commits.d.ts +33 -0
  231. package/dist/entities/package-commits/package-commits.d.ts.map +1 -0
  232. package/dist/entities/package-commits/package-commits.js +149 -0
  233. package/dist/entities/package-commits/package-commits.js.map +1 -0
  234. package/dist/entities/package-commits/package-commits.test.d.ts +2 -0
  235. package/dist/entities/package-commits/package-commits.test.d.ts.map +1 -0
  236. package/dist/entities/package-commits/package-commits.test.js +40 -0
  237. package/dist/entities/package-commits/package-commits.test.js.map +1 -0
  238. package/dist/entities/package-tags/index.d.ts +2 -0
  239. package/dist/entities/package-tags/index.d.ts.map +1 -0
  240. package/dist/entities/package-tags/index.js +2 -0
  241. package/dist/entities/package-tags/index.js.map +1 -0
  242. package/dist/entities/package-tags/package-tags.d.ts +24 -0
  243. package/dist/entities/package-tags/package-tags.d.ts.map +1 -0
  244. package/dist/entities/package-tags/package-tags.js +197 -0
  245. package/dist/entities/package-tags/package-tags.js.map +1 -0
  246. package/dist/entities/package-tags/package-tags.test.d.ts +2 -0
  247. package/dist/entities/package-tags/package-tags.test.d.ts.map +1 -0
  248. package/dist/entities/package-tags/package-tags.test.js +60 -0
  249. package/dist/entities/package-tags/package-tags.test.js.map +1 -0
  250. package/dist/entities/package-version/index.d.ts +3 -0
  251. package/dist/entities/package-version/index.d.ts.map +1 -0
  252. package/dist/entities/package-version/index.js +3 -0
  253. package/dist/entities/package-version/index.js.map +1 -0
  254. package/dist/entities/package-version/package-version.d.ts +16 -0
  255. package/dist/entities/package-version/package-version.d.ts.map +1 -0
  256. package/dist/entities/package-version/package-version.js +166 -0
  257. package/dist/entities/package-version/package-version.js.map +1 -0
  258. package/dist/entities/package-version/package-version.test.d.ts +2 -0
  259. package/dist/entities/package-version/package-version.test.d.ts.map +1 -0
  260. package/dist/entities/package-version/package-version.test.js +113 -0
  261. package/dist/entities/package-version/package-version.test.js.map +1 -0
  262. package/dist/entities/package-version/package-version.types.d.ts +31 -0
  263. package/dist/entities/package-version/package-version.types.d.ts.map +1 -0
  264. package/dist/entities/package-version/package-version.types.js +2 -0
  265. package/dist/entities/package-version/package-version.types.js.map +1 -0
  266. package/dist/entities/tag/index.d.ts +3 -0
  267. package/dist/entities/tag/index.d.ts.map +1 -0
  268. package/dist/entities/tag/index.js +3 -0
  269. package/dist/entities/tag/index.js.map +1 -0
  270. package/dist/entities/tag/tag.d.ts +24 -0
  271. package/dist/entities/tag/tag.d.ts.map +1 -0
  272. package/dist/entities/tag/tag.js +168 -0
  273. package/dist/entities/tag/tag.js.map +1 -0
  274. package/dist/entities/tag/tag.test.d.ts +2 -0
  275. package/dist/entities/tag/tag.test.d.ts.map +1 -0
  276. package/dist/entities/tag/tag.test.js +638 -0
  277. package/dist/entities/tag/tag.test.js.map +1 -0
  278. package/dist/entities/tag/tag.types.d.ts +35 -0
  279. package/dist/entities/tag/tag.types.d.ts.map +1 -0
  280. package/dist/entities/tag/tag.types.js +2 -0
  281. package/dist/entities/tag/tag.types.js.map +1 -0
  282. package/dist/index.d.ts +3 -0
  283. package/dist/index.d.ts.map +1 -0
  284. package/dist/index.js +6 -0
  285. package/dist/index.js.map +1 -0
  286. package/package.json +73 -0
  287. package/src/commands/ci/act.ts +95 -0
  288. package/src/commands/ci/attach-affected.ts +93 -0
  289. package/src/commands/ci/attach-service-ports.ts +31 -0
  290. package/src/commands/commit-check.ts +124 -0
  291. package/src/commands/commit.ts +103 -0
  292. package/src/commands/dev/check.ts +117 -0
  293. package/src/commands/dev/cleanup.ts +34 -0
  294. package/src/commands/dev/rm.ts +66 -0
  295. package/src/commands/dev/setup.ts +48 -0
  296. package/src/commands/local/cleanup.ts +74 -0
  297. package/src/commands/local/setup.ts +68 -0
  298. package/src/commands/local/vscode.ts +118 -0
  299. package/src/commands/update-package-json.ts +104 -0
  300. package/src/commands/version/apply.ts +156 -0
  301. package/src/commands/version/ci.ts +85 -0
  302. package/src/commands/version/prepare.ts +217 -0
  303. package/src/core/colorify.ts +61 -0
  304. package/src/core/index.ts +3 -0
  305. package/src/core/types.ts +262 -0
  306. package/src/core/wrapshell.ts +388 -0
  307. package/src/entities/affected/affected.test.ts +427 -0
  308. package/src/entities/affected/affected.ts +22 -0
  309. package/src/entities/affected/index.ts +1 -0
  310. package/src/entities/branch/branch.test.ts +348 -0
  311. package/src/entities/branch/branch.ts +89 -0
  312. package/src/entities/branch/branch.types.ts +5 -0
  313. package/src/entities/branch/index.ts +2 -0
  314. package/src/entities/commit/commit.test.ts +769 -0
  315. package/src/entities/commit/commit.ts +245 -0
  316. package/src/entities/commit/commit.types.ts +81 -0
  317. package/src/entities/commit/index.ts +2 -0
  318. package/src/entities/commit/pr.test.ts +860 -0
  319. package/src/entities/commit/pr.ts +241 -0
  320. package/src/entities/compose/compose.test.ts +496 -0
  321. package/src/entities/compose/compose.ts +251 -0
  322. package/src/entities/compose/compose.types.ts +88 -0
  323. package/src/entities/compose/index.ts +2 -0
  324. package/src/entities/entities.shell.test.ts +35 -0
  325. package/src/entities/entities.shell.ts +81 -0
  326. package/src/entities/index.ts +11 -0
  327. package/src/entities/intershell-config/intershell-config.default.ts +229 -0
  328. package/src/entities/intershell-config/intershell-config.test.ts +117 -0
  329. package/src/entities/intershell-config/intershell-config.ts +143 -0
  330. package/src/entities/intershell-config/intershell-config.types.ts +118 -0
  331. package/src/entities/package/index.ts +3 -0
  332. package/src/entities/package/package.shell.ts +124 -0
  333. package/src/entities/package/package.test.ts +830 -0
  334. package/src/entities/package/package.ts +267 -0
  335. package/src/entities/package/package.types.ts +49 -0
  336. package/src/entities/package-changelog/index.ts +3 -0
  337. package/src/entities/package-changelog/package-changelog.ts +81 -0
  338. package/src/entities/package-changelog/package-changelog.types.ts +30 -0
  339. package/src/entities/package-changelog/template.default.ts +109 -0
  340. package/src/entities/package-changelog/template.ts +118 -0
  341. package/src/entities/package-commits/dependency-analyzer.test.ts +29 -0
  342. package/src/entities/package-commits/dependency-analyzer.ts +194 -0
  343. package/src/entities/package-commits/index.ts +2 -0
  344. package/src/entities/package-commits/package-commits.test.ts +44 -0
  345. package/src/entities/package-commits/package-commits.ts +191 -0
  346. package/src/entities/package-tags/index.ts +1 -0
  347. package/src/entities/package-tags/package-tags.test.ts +73 -0
  348. package/src/entities/package-tags/package-tags.ts +234 -0
  349. package/src/entities/package-version/index.ts +2 -0
  350. package/src/entities/package-version/package-version.test.ts +141 -0
  351. package/src/entities/package-version/package-version.ts +234 -0
  352. package/src/entities/package-version/package-version.types.ts +35 -0
  353. package/src/entities/tag/index.ts +2 -0
  354. package/src/entities/tag/tag.test.ts +844 -0
  355. package/src/entities/tag/tag.ts +208 -0
  356. package/src/entities/tag/tag.types.ts +37 -0
  357. package/src/index.ts +7 -0
@@ -0,0 +1,117 @@
1
+ import { describe, expect, mock, test } from "bun:test";
2
+
3
+ describe("Config", () => {
4
+ // Common mock setup for dependencies
5
+ const setupMocks = async () => {
6
+ // Mock EntityPackage methods
7
+ const { EntityPackage } = await import("../package");
8
+ EntityPackage.prototype.readJson = mock(() => ({
9
+ name: "test-package",
10
+ version: "1.0.0",
11
+ }));
12
+
13
+ return { EntityPackage };
14
+ };
15
+
16
+ test.skip("should have default commit configuration", async () => {
17
+ await setupMocks();
18
+ const { entitiesConfig } = await import("./intershell-config");
19
+ const config = entitiesConfig.getConfig();
20
+
21
+ expect(config.commit.conventional.type?.list).toBeDefined();
22
+ expect(config.commit.conventional.type?.list?.length).toBeGreaterThan(0);
23
+ expect(config.commit.staged).toBeDefined();
24
+ expect(config.commit.staged?.length).toBeGreaterThan(0);
25
+ });
26
+
27
+ test.skip("should have default branch configuration", async () => {
28
+ await setupMocks();
29
+ const { entitiesConfig } = await import("./intershell-config");
30
+ const config = entitiesConfig.getConfig();
31
+
32
+ expect(config.branch.defaultBranch).toBe("main");
33
+ expect(config.branch.prefixes).toEqual([
34
+ "feature",
35
+ "fix",
36
+ "hotfix",
37
+ "release",
38
+ "docs",
39
+ "refactor",
40
+ "ci",
41
+ "chore",
42
+ "wip",
43
+ "renovate",
44
+ ]);
45
+ });
46
+
47
+ test.skip("should have default tag configuration", async () => {
48
+ await setupMocks();
49
+ const { entitiesConfig } = await import("./intershell-config");
50
+ const config = entitiesConfig.getConfig();
51
+
52
+ expect(config.tag.name.enabled).toBe(true);
53
+ expect(config.tag.name.minLength).toBe(1);
54
+ expect(config.tag.name.maxLength).toBe(100);
55
+ expect(config.tag.name.noSpaces).toBe(true);
56
+ expect(config.tag.name.noSpecialChars).toBe(false);
57
+ });
58
+
59
+ test.skip("should merge custom commit configuration", async () => {
60
+ await setupMocks();
61
+ const { entitiesConfig } = await import("./intershell-config");
62
+
63
+ // Mock custom config as a JSON string (as expected by PackageJson interface)
64
+ const customConfig = {
65
+ commit: {
66
+ conventional: {
67
+ type: {
68
+ list: [
69
+ {
70
+ type: "feat",
71
+ label: "Features",
72
+ description: "A new feature",
73
+ category: "features" as const,
74
+ emoji: "🚀",
75
+ badgeColor: "00D4AA",
76
+ breakingAllowed: true,
77
+ },
78
+ ],
79
+ },
80
+ },
81
+ },
82
+ };
83
+
84
+ // Mock EntityPackage to return custom config
85
+ const { EntityPackage } = await import("../package");
86
+ EntityPackage.prototype.readJson = mock(() => ({
87
+ name: "test-package",
88
+ version: "1.0.0",
89
+ intershell: {
90
+ config: JSON.stringify(customConfig),
91
+ },
92
+ }));
93
+
94
+ const config = entitiesConfig.getConfig();
95
+ expect(config.commit.conventional.type?.list?.[0]?.type).toBe("feat");
96
+ expect(config.commit.conventional.type?.list?.[0]?.emoji).toBe("🚀");
97
+ });
98
+
99
+ test("should validate branch name regex pattern", async () => {
100
+ await setupMocks();
101
+ const { entitiesConfig } = await import("./intershell-config");
102
+ const config = entitiesConfig.getConfig();
103
+ const allowedCharacters = config.branch.name.allowedCharacters;
104
+
105
+ expect(allowedCharacters).toBeInstanceOf(RegExp);
106
+
107
+ // Test valid characters
108
+ expect(allowedCharacters.test("feature-branch")).toBe(true);
109
+ expect(allowedCharacters.test("fix_bug_123")).toBe(true);
110
+ expect(allowedCharacters.test("docs/update-readme")).toBe(true);
111
+
112
+ // Test invalid characters
113
+ expect(allowedCharacters.test("feature branch")).toBe(false); // space
114
+ expect(allowedCharacters.test("fix@bug")).toBe(false); // @ symbol
115
+ expect(allowedCharacters.test("docs#update")).toBe(false); // # symbol
116
+ });
117
+ });
@@ -0,0 +1,143 @@
1
+ import { existsSync, readdirSync, readFileSync } from "node:fs";
2
+ import { join } from "node:path";
3
+ import { defaultConfig } from "./intershell-config.default";
4
+ import type { CustomConfigJson, IConfig } from "./intershell-config.types";
5
+
6
+ class Config {
7
+ private config: IConfig;
8
+
9
+ constructor(customConfig?: CustomConfigJson) {
10
+ if (customConfig) {
11
+ this.config = this.mergeConfig(customConfig);
12
+ } else {
13
+ this.config = this.mergeConfig({});
14
+ }
15
+ }
16
+
17
+ getConfig(): IConfig {
18
+ return this.config;
19
+ }
20
+
21
+ private mergeConfig(config: CustomConfigJson): IConfig {
22
+ // Load packages for commit scopes if not provided
23
+ let commitScopes: string[] = [];
24
+ if (!config.commit?.conventional?.scopes?.list) {
25
+ try {
26
+ // This is a synchronous operation that reads from the filesystem
27
+ // We'll populate it with available packages
28
+ commitScopes = this.getAvailablePackages();
29
+ } catch {
30
+ commitScopes = [];
31
+ }
32
+ }
33
+
34
+ return {
35
+ ...defaultConfig,
36
+ commit: {
37
+ ...defaultConfig.commit,
38
+ ...config.commit,
39
+ conventional: {
40
+ ...defaultConfig.commit.conventional,
41
+ ...config.commit?.conventional,
42
+ type: {
43
+ ...defaultConfig.commit.conventional.type,
44
+ ...config.commit?.conventional?.type,
45
+ },
46
+ scopes: {
47
+ ...defaultConfig.commit.conventional.scopes,
48
+ ...config.commit?.conventional?.scopes,
49
+ list: config.commit?.conventional?.scopes?.list || commitScopes,
50
+ },
51
+ description: {
52
+ ...defaultConfig.commit.conventional.description,
53
+ ...config.commit?.conventional?.description,
54
+ },
55
+ bodyLines: {
56
+ ...defaultConfig.commit.conventional.bodyLines,
57
+ ...config.commit?.conventional?.bodyLines,
58
+ },
59
+ },
60
+ staged: config.commit?.staged || defaultConfig.commit.staged,
61
+ } as IConfig["commit"],
62
+ branch: {
63
+ ...defaultConfig.branch,
64
+ ...config.branch,
65
+ } as IConfig["branch"],
66
+ package: {
67
+ ...defaultConfig.package,
68
+ ...config.package,
69
+ } as IConfig["package"],
70
+ tag: {
71
+ ...defaultConfig.tag,
72
+ ...config.tag,
73
+ name: {
74
+ ...defaultConfig.tag.name,
75
+ ...config.tag?.name,
76
+ },
77
+ } as IConfig["tag"],
78
+ };
79
+ }
80
+
81
+ private getAvailablePackages(): string[] {
82
+ const packages: string[] = ["root"];
83
+
84
+ try {
85
+ // Get workspace root
86
+ const workspaceRoot = process.cwd();
87
+
88
+ // Check for apps directory
89
+ const appsPath = join(workspaceRoot, "apps");
90
+ if (existsSync(appsPath)) {
91
+ const apps = readdirSync(appsPath, { withFileTypes: true })
92
+ .filter((dirent) => dirent.isDirectory())
93
+ .map((dirent) => dirent.name);
94
+ packages.push(...apps);
95
+ }
96
+
97
+ // Check for packages directory
98
+ const packagesPath = join(workspaceRoot, "packages");
99
+ if (existsSync(packagesPath)) {
100
+ const pkgs = readdirSync(packagesPath, { withFileTypes: true })
101
+ .filter((dirent) => dirent.isDirectory())
102
+ .map((dirent) => `@repo/${dirent.name}`);
103
+ packages.push(...pkgs);
104
+ }
105
+ } catch {
106
+ // If we can't read directories, just return basic packages
107
+ packages.push("admin", "api", "storefront", "ui", "utils");
108
+ }
109
+
110
+ return packages;
111
+ }
112
+ }
113
+
114
+ function getCustomConfig(): CustomConfigJson | undefined {
115
+ let customConfig: CustomConfigJson | undefined;
116
+ try {
117
+ // Read root package.json directly
118
+ const rootPackageJsonPath = join(process.cwd(), "package.json");
119
+ const rootPackageJsonContent = readFileSync(rootPackageJsonPath, "utf-8");
120
+ const rootPackageJson = JSON.parse(rootPackageJsonContent);
121
+
122
+ const configFilePath = rootPackageJson.intershell?.config;
123
+ if (!configFilePath) throw new Error();
124
+
125
+ const config = readFileSync(configFilePath, "utf-8");
126
+ customConfig = JSON.parse(config) as CustomConfigJson;
127
+ } catch {
128
+ customConfig = undefined;
129
+ }
130
+ return customConfig;
131
+ }
132
+
133
+ // Lazy initialization to allow mocking in tests
134
+ let _entitiesConfig: Config | undefined;
135
+
136
+ function getEntitiesConfig(): Config {
137
+ if (!_entitiesConfig) {
138
+ _entitiesConfig = new Config(getCustomConfig());
139
+ }
140
+ return _entitiesConfig;
141
+ }
142
+
143
+ export const entitiesConfig = getEntitiesConfig();
@@ -0,0 +1,118 @@
1
+ export type PRCategory =
2
+ | "features"
3
+ | "bugfixes"
4
+ | "dependencies"
5
+ | "infrastructure"
6
+ | "documentation"
7
+ | "refactoring"
8
+ | "other";
9
+
10
+ type Validator = (commit: unknown) => true | string;
11
+
12
+ export interface CommitConfig {
13
+ conventional: {
14
+ type?: {
15
+ list?: CommitTypeDefinition[];
16
+ validator?: Validator;
17
+ };
18
+ scopes?: {
19
+ list?: string[];
20
+ validator?: Validator;
21
+ };
22
+ description?: {
23
+ minLength?: number;
24
+ maxLength?: number;
25
+ shouldNotEndWithPeriod?: boolean;
26
+ shouldNotStartWithType?: boolean;
27
+ validator?: Validator;
28
+ };
29
+ bodyLines?: {
30
+ minLength?: number;
31
+ maxLength?: number;
32
+ validator?: Validator;
33
+ };
34
+ isBreaking?: {
35
+ validator?: Validator;
36
+ };
37
+ isMerge?: {
38
+ validator?: Validator;
39
+ };
40
+ isDependency?: {
41
+ validator?: Validator;
42
+ };
43
+ };
44
+ staged?: StagedConfig;
45
+ }
46
+
47
+ export interface CommitTypeDefinition {
48
+ readonly type: string;
49
+ readonly label: string;
50
+ readonly description: string;
51
+ readonly category: PRCategory;
52
+ readonly emoji: string;
53
+ readonly badgeColor: string;
54
+ readonly breakingAllowed: boolean;
55
+ }
56
+
57
+ export type StagedConfig = {
58
+ filePattern: RegExp[];
59
+ contentPattern?: RegExp[];
60
+ description: string;
61
+ disabled?: boolean;
62
+ ignore?: {
63
+ mode: "create" | "update";
64
+ };
65
+ }[];
66
+
67
+ interface BranchConfig {
68
+ readonly defaultBranch: string;
69
+ readonly prefixes: string[];
70
+ readonly name: {
71
+ readonly minLength: number;
72
+ readonly maxLength: number;
73
+ readonly allowedCharacters: RegExp;
74
+ readonly noConsecutiveSeparators: boolean;
75
+ readonly noLeadingTrailingSeparators: boolean;
76
+ };
77
+ }
78
+
79
+ interface PackageValidationConfig {
80
+ readonly selectiveVersioning: {
81
+ readonly enabled: boolean;
82
+ readonly description: string;
83
+ };
84
+ readonly semanticVersioning: {
85
+ readonly enabled: boolean;
86
+ readonly description: string;
87
+ };
88
+ readonly description: {
89
+ readonly enabled: boolean;
90
+ readonly description: string;
91
+ };
92
+ }
93
+
94
+ interface TagValidationConfig {
95
+ readonly name: {
96
+ readonly enabled: boolean;
97
+ readonly description: string;
98
+ readonly minLength: number;
99
+ readonly maxLength: number;
100
+ readonly allowedCharacters: RegExp;
101
+ readonly noSpaces: boolean;
102
+ readonly noSpecialChars: boolean;
103
+ readonly validator?: Validator;
104
+ };
105
+ }
106
+
107
+ export interface IConfig {
108
+ readonly commit: CommitConfig;
109
+ readonly branch: BranchConfig;
110
+ readonly package: PackageValidationConfig;
111
+ readonly tag: TagValidationConfig;
112
+ }
113
+
114
+ type DeepPartial<T> = {
115
+ [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
116
+ };
117
+
118
+ export type CustomConfigJson = DeepPartial<IConfig>;
@@ -0,0 +1,3 @@
1
+ export * from "./package";
2
+ export * from "./package.shell";
3
+ export * from "./package.types";
@@ -0,0 +1,124 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { file, write } from "bun";
3
+ import { entitiesShell } from "../entities.shell";
4
+ import type { PackageJson } from "./package.types";
5
+
6
+ export const packagesShell = {
7
+ /**
8
+ * Reads a JSON file synchronously
9
+ */
10
+ readJsonFile: (filePath: string): PackageJson => {
11
+ try {
12
+ const json = readFileSync(filePath, "utf8");
13
+ return JSON.parse(json);
14
+ } catch (error) {
15
+ throw new Error(`Failed to read JSON file ${filePath}: ${error}`);
16
+ }
17
+ },
18
+
19
+ /**
20
+ * Writes JSON data to a file
21
+ */
22
+ writeJsonFile: async (filePath: string, data: PackageJson): Promise<void> => {
23
+ await write(filePath, JSON.stringify(data, null, 2));
24
+ },
25
+
26
+ /**
27
+ * Reads a changelog file
28
+ */
29
+ readChangelogFile: (filePath: string): string => {
30
+ try {
31
+ const changelog = readFileSync(filePath, "utf8");
32
+ return changelog || "";
33
+ } catch {
34
+ return "";
35
+ }
36
+ },
37
+
38
+ /**
39
+ * Writes content to a changelog file
40
+ */
41
+ writeChangelogFile: async (filePath: string, content: string): Promise<void> => {
42
+ try {
43
+ await file(filePath).exists();
44
+ } catch {
45
+ await entitiesShell.touch(filePath);
46
+ }
47
+ await write(filePath, content);
48
+ },
49
+
50
+ /**
51
+ * Checks if a file exists
52
+ */
53
+ fileExists: async (filePath: string): Promise<boolean> => {
54
+ try {
55
+ await file(filePath).exists();
56
+ return true;
57
+ } catch {
58
+ return false;
59
+ }
60
+ },
61
+
62
+ /**
63
+ * Reads directory contents
64
+ */
65
+ readDirectory: async (dirPath: string): Promise<string[]> => {
66
+ const fs = await import("node:fs/promises");
67
+ const entries = await fs.readdir(dirPath, { withFileTypes: true });
68
+ return entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name);
69
+ },
70
+
71
+ /**
72
+ * Checks if a file can be accessed
73
+ */
74
+ canAccessFile: async (filePath: string): Promise<boolean> => {
75
+ const fs = await import("node:fs/promises");
76
+ try {
77
+ await fs.access(filePath);
78
+ return true;
79
+ } catch {
80
+ return false;
81
+ }
82
+ },
83
+
84
+ /**
85
+ * Reads a file as text
86
+ */
87
+ readFileAsText: async (filePath: string): Promise<string> => {
88
+ const fs = await import("node:fs/promises");
89
+ return await fs.readFile(filePath, "utf-8");
90
+ },
91
+
92
+ /**
93
+ * Reads a file as text synchronously
94
+ */
95
+ readFileAsTextSync: (filePath: string): string => {
96
+ return readFileSync(filePath, "utf8");
97
+ },
98
+
99
+ /**
100
+ * Writes content to a file as text
101
+ */
102
+ writeFileAsText: async (filePath: string, content: string): Promise<void> => {
103
+ await write(filePath, content);
104
+ },
105
+
106
+ /**
107
+ * Gets the workspace root directory
108
+ */
109
+ getWorkspaceRoot: async (): Promise<string> => {
110
+ const fs = await import("node:fs/promises");
111
+ const path = await import("node:path");
112
+
113
+ let workspaceRoot = process.cwd();
114
+ while (workspaceRoot !== path.dirname(workspaceRoot)) {
115
+ try {
116
+ await fs.access(path.join(workspaceRoot, "package.json"));
117
+ break; // Found package.json, this is the workspace root
118
+ } catch {
119
+ workspaceRoot = path.dirname(workspaceRoot);
120
+ }
121
+ }
122
+ return workspaceRoot;
123
+ },
124
+ };