@xylabs/ts-scripts-yarn3 7.4.28 → 7.5.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 (412) hide show
  1. package/dist/actions/deploy-major.mjs +1 -90
  2. package/dist/actions/deploy-major.mjs.map +1 -1
  3. package/dist/actions/deploy-minor.mjs +1 -90
  4. package/dist/actions/deploy-minor.mjs.map +1 -1
  5. package/dist/actions/deploy-next.mjs +1 -90
  6. package/dist/actions/deploy-next.mjs.map +1 -1
  7. package/dist/actions/deploy.mjs +1 -90
  8. package/dist/actions/deploy.mjs.map +1 -1
  9. package/dist/actions/index.mjs +128 -3840
  10. package/dist/actions/index.mjs.map +1 -1
  11. package/dist/actions/publish.mjs +1 -90
  12. package/dist/actions/publish.mjs.map +1 -1
  13. package/dist/actions/reinstall.mjs +1 -90
  14. package/dist/actions/reinstall.mjs.map +1 -1
  15. package/dist/actions/up.mjs +1 -90
  16. package/dist/actions/up.mjs.map +1 -1
  17. package/dist/actions/updo.mjs +1 -90
  18. package/dist/actions/updo.mjs.map +1 -1
  19. package/dist/actions/upplug.mjs +1 -90
  20. package/dist/actions/upplug.mjs.map +1 -1
  21. package/dist/actions/upyarn.mjs +1 -90
  22. package/dist/actions/upyarn.mjs.map +1 -1
  23. package/dist/actions/yarn3only.mjs +2 -32
  24. package/dist/actions/yarn3only.mjs.map +1 -1
  25. package/dist/bin/xy.mjs +222 -3684
  26. package/dist/bin/xy.mjs.map +1 -1
  27. package/dist/index.d.ts +24 -502
  28. package/dist/index.mjs +224 -4659
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/lib/index.mjs +0 -804
  31. package/dist/lib/index.mjs.map +1 -1
  32. package/dist/lib/yarn/index.mjs +0 -7
  33. package/dist/lib/yarn/index.mjs.map +1 -1
  34. package/dist/pm/index.mjs +82 -0
  35. package/dist/pm/index.mjs.map +1 -0
  36. package/dist/pm/yarnPackageManager.mjs +82 -0
  37. package/dist/pm/yarnPackageManager.mjs.map +1 -0
  38. package/dist/xy/common/index.mjs +7 -1459
  39. package/dist/xy/common/index.mjs.map +1 -1
  40. package/dist/xy/common/upplugCommand.mjs +1 -90
  41. package/dist/xy/common/upplugCommand.mjs.map +1 -1
  42. package/dist/xy/common/upyarnCommand.mjs +1 -90
  43. package/dist/xy/common/upyarnCommand.mjs.map +1 -1
  44. package/dist/xy/common/yarn3OnlyCommand.mjs +1 -33
  45. package/dist/xy/common/yarn3OnlyCommand.mjs.map +1 -1
  46. package/dist/xy/deploy/deployCommand.mjs +3 -90
  47. package/dist/xy/deploy/deployCommand.mjs.map +1 -1
  48. package/dist/xy/deploy/deployMajorCommand.mjs +1 -90
  49. package/dist/xy/deploy/deployMajorCommand.mjs.map +1 -1
  50. package/dist/xy/deploy/deployMinorCommand.mjs +1 -90
  51. package/dist/xy/deploy/deployMinorCommand.mjs.map +1 -1
  52. package/dist/xy/deploy/deployNextCommand.mjs +1 -90
  53. package/dist/xy/deploy/deployNextCommand.mjs.map +1 -1
  54. package/dist/xy/deploy/index.mjs +11 -94
  55. package/dist/xy/deploy/index.mjs.map +1 -1
  56. package/dist/xy/deploy/publishCommand.mjs +1 -90
  57. package/dist/xy/deploy/publishCommand.mjs.map +1 -1
  58. package/dist/xy/index.mjs +183 -3717
  59. package/dist/xy/index.mjs.map +1 -1
  60. package/dist/xy/install/cleanCommand.mjs +6 -118
  61. package/dist/xy/install/cleanCommand.mjs.map +1 -1
  62. package/dist/xy/install/dupdepsCommand.mjs +6 -178
  63. package/dist/xy/install/dupdepsCommand.mjs.map +1 -1
  64. package/dist/xy/install/index.mjs +12 -305
  65. package/dist/xy/install/index.mjs.map +1 -1
  66. package/dist/xy/install/reinstallCommand.mjs +1 -90
  67. package/dist/xy/install/reinstallCommand.mjs.map +1 -1
  68. package/dist/xy/install/staticsCommand.mjs +6 -177
  69. package/dist/xy/install/staticsCommand.mjs.map +1 -1
  70. package/dist/xy/install/upCommand.mjs +1 -90
  71. package/dist/xy/install/upCommand.mjs.map +1 -1
  72. package/dist/xy/install/updoCommand.mjs +1 -90
  73. package/dist/xy/install/updoCommand.mjs.map +1 -1
  74. package/dist/xy/xy.mjs +64 -3595
  75. package/dist/xy/xy.mjs.map +1 -1
  76. package/dist/xy/yarnCommands.mjs +80 -0
  77. package/dist/xy/yarnCommands.mjs.map +1 -0
  78. package/package.json +5 -47
  79. package/dist/actions/build.mjs +0 -140
  80. package/dist/actions/build.mjs.map +0 -1
  81. package/dist/actions/claude-clean.mjs +0 -71
  82. package/dist/actions/claude-clean.mjs.map +0 -1
  83. package/dist/actions/claude-commands.mjs +0 -112
  84. package/dist/actions/claude-commands.mjs.map +0 -1
  85. package/dist/actions/claude-rules.mjs +0 -137
  86. package/dist/actions/claude-rules.mjs.map +0 -1
  87. package/dist/actions/claude-settings.mjs +0 -85
  88. package/dist/actions/claude-settings.mjs.map +0 -1
  89. package/dist/actions/claude-skills.mjs +0 -120
  90. package/dist/actions/claude-skills.mjs.map +0 -1
  91. package/dist/actions/clean-docs.mjs +0 -37
  92. package/dist/actions/clean-docs.mjs.map +0 -1
  93. package/dist/actions/clean-eslint.mjs +0 -26
  94. package/dist/actions/clean-eslint.mjs.map +0 -1
  95. package/dist/actions/clean.mjs +0 -124
  96. package/dist/actions/clean.mjs.map +0 -1
  97. package/dist/actions/compile.mjs +0 -157
  98. package/dist/actions/compile.mjs.map +0 -1
  99. package/dist/actions/copy-assets.mjs +0 -73
  100. package/dist/actions/copy-assets.mjs.map +0 -1
  101. package/dist/actions/cycle.mjs +0 -144
  102. package/dist/actions/cycle.mjs.map +0 -1
  103. package/dist/actions/dead.mjs +0 -98
  104. package/dist/actions/dead.mjs.map +0 -1
  105. package/dist/actions/deplint/checkPackage/checkPackage.mjs +0 -672
  106. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +0 -1
  107. package/dist/actions/deplint/checkPackage/checkPackageTypes.mjs +0 -1
  108. package/dist/actions/deplint/checkPackage/checkPackageTypes.mjs.map +0 -1
  109. package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs +0 -48
  110. package/dist/actions/deplint/checkPackage/getUnlistedDependencies.mjs.map +0 -1
  111. package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs +0 -33
  112. package/dist/actions/deplint/checkPackage/getUnlistedDevDependencies.mjs.map +0 -1
  113. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs +0 -30
  114. package/dist/actions/deplint/checkPackage/getUnusedDependencies.mjs.map +0 -1
  115. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs +0 -309
  116. package/dist/actions/deplint/checkPackage/getUnusedDevDependencies.mjs.map +0 -1
  117. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs +0 -26
  118. package/dist/actions/deplint/checkPackage/getUnusedPeerDependencies.mjs.map +0 -1
  119. package/dist/actions/deplint/checkPackage/index.mjs +0 -672
  120. package/dist/actions/deplint/checkPackage/index.mjs.map +0 -1
  121. package/dist/actions/deplint/deplint.mjs +0 -764
  122. package/dist/actions/deplint/deplint.mjs.map +0 -1
  123. package/dist/actions/deplint/findFiles.mjs +0 -39
  124. package/dist/actions/deplint/findFiles.mjs.map +0 -1
  125. package/dist/actions/deplint/findFilesByGlob.mjs +0 -14
  126. package/dist/actions/deplint/findFilesByGlob.mjs.map +0 -1
  127. package/dist/actions/deplint/getBasePackageName.mjs +0 -13
  128. package/dist/actions/deplint/getBasePackageName.mjs.map +0 -1
  129. package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs +0 -140
  130. package/dist/actions/deplint/getCliReferencedPackagesFromFiles.mjs.map +0 -1
  131. package/dist/actions/deplint/getDependenciesFromPackageJson.mjs +0 -20
  132. package/dist/actions/deplint/getDependenciesFromPackageJson.mjs.map +0 -1
  133. package/dist/actions/deplint/getExtendsFromTsconfigs.mjs +0 -44
  134. package/dist/actions/deplint/getExtendsFromTsconfigs.mjs.map +0 -1
  135. package/dist/actions/deplint/getExternalImportsFromFiles.mjs +0 -122
  136. package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +0 -1
  137. package/dist/actions/deplint/getImportsFromFile.mjs +0 -85
  138. package/dist/actions/deplint/getImportsFromFile.mjs.map +0 -1
  139. package/dist/actions/deplint/getRequiredPeerDependencies.mjs +0 -36
  140. package/dist/actions/deplint/getRequiredPeerDependencies.mjs.map +0 -1
  141. package/dist/actions/deplint/getScriptReferencedPackages.mjs +0 -83
  142. package/dist/actions/deplint/getScriptReferencedPackages.mjs.map +0 -1
  143. package/dist/actions/deplint/implicitDevDependencies.mjs +0 -80
  144. package/dist/actions/deplint/implicitDevDependencies.mjs.map +0 -1
  145. package/dist/actions/deplint/index.mjs +0 -764
  146. package/dist/actions/deplint/index.mjs.map +0 -1
  147. package/dist/actions/dupdeps.mjs +0 -184
  148. package/dist/actions/dupdeps.mjs.map +0 -1
  149. package/dist/actions/fix.mjs +0 -147
  150. package/dist/actions/fix.mjs.map +0 -1
  151. package/dist/actions/gen-docs.mjs +0 -109
  152. package/dist/actions/gen-docs.mjs.map +0 -1
  153. package/dist/actions/gitignore.mjs +0 -152
  154. package/dist/actions/gitignore.mjs.map +0 -1
  155. package/dist/actions/gitlint-fix.mjs +0 -27
  156. package/dist/actions/gitlint-fix.mjs.map +0 -1
  157. package/dist/actions/gitlint.mjs +0 -48
  158. package/dist/actions/gitlint.mjs.map +0 -1
  159. package/dist/actions/knip.mjs +0 -98
  160. package/dist/actions/knip.mjs.map +0 -1
  161. package/dist/actions/license.mjs +0 -84
  162. package/dist/actions/license.mjs.map +0 -1
  163. package/dist/actions/lint.mjs +0 -144
  164. package/dist/actions/lint.mjs.map +0 -1
  165. package/dist/actions/lintlint.mjs +0 -230
  166. package/dist/actions/lintlint.mjs.map +0 -1
  167. package/dist/actions/npmignore-gen.mjs +0 -88
  168. package/dist/actions/npmignore-gen.mjs.map +0 -1
  169. package/dist/actions/package/clean-outputs.mjs +0 -29
  170. package/dist/actions/package/clean-outputs.mjs.map +0 -1
  171. package/dist/actions/package/clean-typescript.mjs +0 -29
  172. package/dist/actions/package/clean-typescript.mjs.map +0 -1
  173. package/dist/actions/package/clean.mjs +0 -48
  174. package/dist/actions/package/clean.mjs.map +0 -1
  175. package/dist/actions/package/compile/XyConfig.mjs +0 -1
  176. package/dist/actions/package/compile/XyConfig.mjs.map +0 -1
  177. package/dist/actions/package/compile/buildEntries.mjs +0 -53
  178. package/dist/actions/package/compile/buildEntries.mjs.map +0 -1
  179. package/dist/actions/package/compile/compile.mjs +0 -433
  180. package/dist/actions/package/compile/compile.mjs.map +0 -1
  181. package/dist/actions/package/compile/copyTypeFiles.mjs +0 -34
  182. package/dist/actions/package/compile/copyTypeFiles.mjs.map +0 -1
  183. package/dist/actions/package/compile/deepMerge.mjs +0 -26
  184. package/dist/actions/package/compile/deepMerge.mjs.map +0 -1
  185. package/dist/actions/package/compile/getCompilerOptions.mjs +0 -12
  186. package/dist/actions/package/compile/getCompilerOptions.mjs.map +0 -1
  187. package/dist/actions/package/compile/index.mjs +0 -436
  188. package/dist/actions/package/compile/index.mjs.map +0 -1
  189. package/dist/actions/package/compile/inputs.mjs +0 -22
  190. package/dist/actions/package/compile/inputs.mjs.map +0 -1
  191. package/dist/actions/package/compile/packageCompileTsc.mjs +0 -94
  192. package/dist/actions/package/compile/packageCompileTsc.mjs.map +0 -1
  193. package/dist/actions/package/compile/packageCompileTscTypes.mjs +0 -92
  194. package/dist/actions/package/compile/packageCompileTscTypes.mjs.map +0 -1
  195. package/dist/actions/package/compile/packageCompileTsup.mjs +0 -402
  196. package/dist/actions/package/compile/packageCompileTsup.mjs.map +0 -1
  197. package/dist/actions/package/copy-assets.mjs +0 -46
  198. package/dist/actions/package/copy-assets.mjs.map +0 -1
  199. package/dist/actions/package/cycle.mjs +0 -39
  200. package/dist/actions/package/cycle.mjs.map +0 -1
  201. package/dist/actions/package/gen-docs.mjs +0 -114
  202. package/dist/actions/package/gen-docs.mjs.map +0 -1
  203. package/dist/actions/package/index.mjs +0 -825
  204. package/dist/actions/package/index.mjs.map +0 -1
  205. package/dist/actions/package/lint.mjs +0 -80
  206. package/dist/actions/package/lint.mjs.map +0 -1
  207. package/dist/actions/package/publint.mjs +0 -66
  208. package/dist/actions/package/publint.mjs.map +0 -1
  209. package/dist/actions/package/recompile.mjs +0 -483
  210. package/dist/actions/package/recompile.mjs.map +0 -1
  211. package/dist/actions/package-lint.mjs +0 -178
  212. package/dist/actions/package-lint.mjs.map +0 -1
  213. package/dist/actions/publint.mjs +0 -166
  214. package/dist/actions/publint.mjs.map +0 -1
  215. package/dist/actions/readme-gen.mjs +0 -289
  216. package/dist/actions/readme-gen.mjs.map +0 -1
  217. package/dist/actions/readme-init.mjs +0 -83
  218. package/dist/actions/readme-init.mjs.map +0 -1
  219. package/dist/actions/rebuild.mjs +0 -101
  220. package/dist/actions/rebuild.mjs.map +0 -1
  221. package/dist/actions/recompile.mjs +0 -187
  222. package/dist/actions/recompile.mjs.map +0 -1
  223. package/dist/actions/relint.mjs +0 -144
  224. package/dist/actions/relint.mjs.map +0 -1
  225. package/dist/actions/retest.mjs +0 -123
  226. package/dist/actions/retest.mjs.map +0 -1
  227. package/dist/actions/sonar.mjs +0 -98
  228. package/dist/actions/sonar.mjs.map +0 -1
  229. package/dist/actions/statics.mjs +0 -183
  230. package/dist/actions/statics.mjs.map +0 -1
  231. package/dist/actions/test.mjs +0 -117
  232. package/dist/actions/test.mjs.map +0 -1
  233. package/dist/bin/package/build-only.mjs +0 -445
  234. package/dist/bin/package/build-only.mjs.map +0 -1
  235. package/dist/bin/package/build.mjs +0 -445
  236. package/dist/bin/package/build.mjs.map +0 -1
  237. package/dist/bin/package/clean-outputs.mjs +0 -29
  238. package/dist/bin/package/clean-outputs.mjs.map +0 -1
  239. package/dist/bin/package/clean-typescript.mjs +0 -29
  240. package/dist/bin/package/clean-typescript.mjs.map +0 -1
  241. package/dist/bin/package/clean.mjs +0 -53
  242. package/dist/bin/package/clean.mjs.map +0 -1
  243. package/dist/bin/package/compile-only.mjs +0 -441
  244. package/dist/bin/package/compile-only.mjs.map +0 -1
  245. package/dist/bin/package/compile-tsup.mjs +0 -409
  246. package/dist/bin/package/compile-tsup.mjs.map +0 -1
  247. package/dist/bin/package/compile.mjs +0 -445
  248. package/dist/bin/package/compile.mjs.map +0 -1
  249. package/dist/bin/package/copy-assets-cjs.mjs +0 -54
  250. package/dist/bin/package/copy-assets-cjs.mjs.map +0 -1
  251. package/dist/bin/package/copy-assets-esm.mjs +0 -54
  252. package/dist/bin/package/copy-assets-esm.mjs.map +0 -1
  253. package/dist/bin/package/cycle.mjs +0 -51
  254. package/dist/bin/package/cycle.mjs.map +0 -1
  255. package/dist/bin/package/fix.mjs +0 -92
  256. package/dist/bin/package/fix.mjs.map +0 -1
  257. package/dist/bin/package/gen-docs.mjs +0 -121
  258. package/dist/bin/package/gen-docs.mjs.map +0 -1
  259. package/dist/bin/package/lint-verbose.mjs +0 -92
  260. package/dist/bin/package/lint-verbose.mjs.map +0 -1
  261. package/dist/bin/package/lint.mjs +0 -92
  262. package/dist/bin/package/lint.mjs.map +0 -1
  263. package/dist/bin/package/publint.mjs +0 -75
  264. package/dist/bin/package/publint.mjs.map +0 -1
  265. package/dist/bin/package/recompile.mjs +0 -489
  266. package/dist/bin/package/recompile.mjs.map +0 -1
  267. package/dist/bin/package/relint.mjs +0 -92
  268. package/dist/bin/package/relint.mjs.map +0 -1
  269. package/dist/lib/checkResult.mjs +0 -16
  270. package/dist/lib/checkResult.mjs.map +0 -1
  271. package/dist/lib/claudeMdTemplate.mjs +0 -65
  272. package/dist/lib/claudeMdTemplate.mjs.map +0 -1
  273. package/dist/lib/createBuildConfig.mjs +0 -55
  274. package/dist/lib/createBuildConfig.mjs.map +0 -1
  275. package/dist/lib/defaultBuildConfig.mjs +0 -23
  276. package/dist/lib/defaultBuildConfig.mjs.map +0 -1
  277. package/dist/lib/deleteGlob.mjs +0 -13
  278. package/dist/lib/deleteGlob.mjs.map +0 -1
  279. package/dist/lib/dependencies/DuplicateDetector.mjs +0 -81
  280. package/dist/lib/dependencies/DuplicateDetector.mjs.map +0 -1
  281. package/dist/lib/dependencies/detectDuplicateDependencies.mjs +0 -164
  282. package/dist/lib/dependencies/detectDuplicateDependencies.mjs.map +0 -1
  283. package/dist/lib/dependencies/index.mjs +0 -165
  284. package/dist/lib/dependencies/index.mjs.map +0 -1
  285. package/dist/lib/file/ReadFileSyncOptions.mjs +0 -6
  286. package/dist/lib/file/ReadFileSyncOptions.mjs.map +0 -1
  287. package/dist/lib/file/constants.mjs +0 -8
  288. package/dist/lib/file/constants.mjs.map +0 -1
  289. package/dist/lib/file/fileLines.mjs +0 -32
  290. package/dist/lib/file/fileLines.mjs.map +0 -1
  291. package/dist/lib/file/index.mjs +0 -42
  292. package/dist/lib/file/index.mjs.map +0 -1
  293. package/dist/lib/file/tryReadFileSync.mjs +0 -14
  294. package/dist/lib/file/tryReadFileSync.mjs.map +0 -1
  295. package/dist/lib/generateIgnoreFiles.mjs +0 -84
  296. package/dist/lib/generateIgnoreFiles.mjs.map +0 -1
  297. package/dist/lib/generateReadmeFiles.mjs +0 -257
  298. package/dist/lib/generateReadmeFiles.mjs.map +0 -1
  299. package/dist/lib/gitignoreTemplate.mjs +0 -12
  300. package/dist/lib/gitignoreTemplate.mjs.map +0 -1
  301. package/dist/lib/jsonFormatters.mjs +0 -11
  302. package/dist/lib/jsonFormatters.mjs.map +0 -1
  303. package/dist/lib/loadConfig.mjs +0 -24
  304. package/dist/lib/loadConfig.mjs.map +0 -1
  305. package/dist/lib/parsedPackageJSON.mjs +0 -11
  306. package/dist/lib/parsedPackageJSON.mjs.map +0 -1
  307. package/dist/lib/processEx.mjs +0 -36
  308. package/dist/lib/processEx.mjs.map +0 -1
  309. package/dist/lib/runSteps.mjs +0 -95
  310. package/dist/lib/runSteps.mjs.map +0 -1
  311. package/dist/lib/runStepsAsync.mjs +0 -113
  312. package/dist/lib/runStepsAsync.mjs.map +0 -1
  313. package/dist/lib/runXy.mjs +0 -103
  314. package/dist/lib/runXy.mjs.map +0 -1
  315. package/dist/lib/runXyWithWarning.mjs +0 -13
  316. package/dist/lib/runXyWithWarning.mjs.map +0 -1
  317. package/dist/lib/safeExit.mjs +0 -61
  318. package/dist/lib/safeExit.mjs.map +0 -1
  319. package/dist/lib/string/empty.mjs +0 -8
  320. package/dist/lib/string/empty.mjs.map +0 -1
  321. package/dist/lib/string/index.mjs +0 -12
  322. package/dist/lib/string/index.mjs.map +0 -1
  323. package/dist/lib/string/union.mjs +0 -6
  324. package/dist/lib/string/union.mjs.map +0 -1
  325. package/dist/lib/tryRunLocalScript.mjs +0 -33
  326. package/dist/lib/tryRunLocalScript.mjs.map +0 -1
  327. package/dist/lib/withErrnoException.mjs +0 -13
  328. package/dist/lib/withErrnoException.mjs.map +0 -1
  329. package/dist/lib/withError.mjs +0 -8
  330. package/dist/lib/withError.mjs.map +0 -1
  331. package/dist/loadPackageConfig.mjs +0 -11
  332. package/dist/loadPackageConfig.mjs.map +0 -1
  333. package/dist/types.d.mjs +0 -1
  334. package/dist/types.d.mjs.map +0 -1
  335. package/dist/xy/build/buildCommand.mjs +0 -161
  336. package/dist/xy/build/buildCommand.mjs.map +0 -1
  337. package/dist/xy/build/compileCommand.mjs +0 -174
  338. package/dist/xy/build/compileCommand.mjs.map +0 -1
  339. package/dist/xy/build/compileOnlyCommand.mjs +0 -175
  340. package/dist/xy/build/compileOnlyCommand.mjs.map +0 -1
  341. package/dist/xy/build/copyAssetsCommand.mjs +0 -84
  342. package/dist/xy/build/copyAssetsCommand.mjs.map +0 -1
  343. package/dist/xy/build/index.mjs +0 -507
  344. package/dist/xy/build/index.mjs.map +0 -1
  345. package/dist/xy/build/rebuildCommand.mjs +0 -114
  346. package/dist/xy/build/rebuildCommand.mjs.map +0 -1
  347. package/dist/xy/build/recompileCommand.mjs +0 -204
  348. package/dist/xy/build/recompileCommand.mjs.map +0 -1
  349. package/dist/xy/common/claude/cleanCommand.mjs +0 -79
  350. package/dist/xy/common/claude/cleanCommand.mjs.map +0 -1
  351. package/dist/xy/common/claude/commandsCommand.mjs +0 -120
  352. package/dist/xy/common/claude/commandsCommand.mjs.map +0 -1
  353. package/dist/xy/common/claude/index.mjs +0 -546
  354. package/dist/xy/common/claude/index.mjs.map +0 -1
  355. package/dist/xy/common/claude/initCommand.mjs +0 -319
  356. package/dist/xy/common/claude/initCommand.mjs.map +0 -1
  357. package/dist/xy/common/claude/rulesCommand.mjs +0 -153
  358. package/dist/xy/common/claude/rulesCommand.mjs.map +0 -1
  359. package/dist/xy/common/claude/settingsCommand.mjs +0 -93
  360. package/dist/xy/common/claude/settingsCommand.mjs.map +0 -1
  361. package/dist/xy/common/claude/skillsCommand.mjs +0 -129
  362. package/dist/xy/common/claude/skillsCommand.mjs.map +0 -1
  363. package/dist/xy/common/cleanDocsCommand.mjs +0 -45
  364. package/dist/xy/common/cleanDocsCommand.mjs.map +0 -1
  365. package/dist/xy/common/deadCommand.mjs +0 -116
  366. package/dist/xy/common/deadCommand.mjs.map +0 -1
  367. package/dist/xy/common/genDocsCommand.mjs +0 -125
  368. package/dist/xy/common/genDocsCommand.mjs.map +0 -1
  369. package/dist/xy/common/gitignoreCommand.mjs +0 -158
  370. package/dist/xy/common/gitignoreCommand.mjs.map +0 -1
  371. package/dist/xy/common/gitlintCommand.mjs +0 -82
  372. package/dist/xy/common/gitlintCommand.mjs.map +0 -1
  373. package/dist/xy/common/licenseCommand.mjs +0 -100
  374. package/dist/xy/common/licenseCommand.mjs.map +0 -1
  375. package/dist/xy/common/npmignoreGenCommand.mjs +0 -98
  376. package/dist/xy/common/npmignoreGenCommand.mjs.map +0 -1
  377. package/dist/xy/common/readme/genCommand.mjs +0 -321
  378. package/dist/xy/common/readme/genCommand.mjs.map +0 -1
  379. package/dist/xy/common/readme/index.mjs +0 -361
  380. package/dist/xy/common/readme/index.mjs.map +0 -1
  381. package/dist/xy/common/readme/initCommand.mjs +0 -103
  382. package/dist/xy/common/readme/initCommand.mjs.map +0 -1
  383. package/dist/xy/common/retestCommand.mjs +0 -136
  384. package/dist/xy/common/retestCommand.mjs.map +0 -1
  385. package/dist/xy/common/testCommand.mjs +0 -130
  386. package/dist/xy/common/testCommand.mjs.map +0 -1
  387. package/dist/xy/lint/cycleCommand.mjs +0 -163
  388. package/dist/xy/lint/cycleCommand.mjs.map +0 -1
  389. package/dist/xy/lint/deplintCommand.mjs +0 -814
  390. package/dist/xy/lint/deplintCommand.mjs.map +0 -1
  391. package/dist/xy/lint/fixCommand.mjs +0 -168
  392. package/dist/xy/lint/fixCommand.mjs.map +0 -1
  393. package/dist/xy/lint/index.mjs +0 -1691
  394. package/dist/xy/lint/index.mjs.map +0 -1
  395. package/dist/xy/lint/knipCommand.mjs +0 -121
  396. package/dist/xy/lint/knipCommand.mjs.map +0 -1
  397. package/dist/xy/lint/lintCommand.mjs +0 -186
  398. package/dist/xy/lint/lintCommand.mjs.map +0 -1
  399. package/dist/xy/lint/lintlintCommand.mjs +0 -250
  400. package/dist/xy/lint/lintlintCommand.mjs.map +0 -1
  401. package/dist/xy/lint/packageLintCommand.mjs +0 -193
  402. package/dist/xy/lint/packageLintCommand.mjs.map +0 -1
  403. package/dist/xy/lint/publintCommand.mjs +0 -187
  404. package/dist/xy/lint/publintCommand.mjs.map +0 -1
  405. package/dist/xy/lint/relintCommand.mjs +0 -163
  406. package/dist/xy/lint/relintCommand.mjs.map +0 -1
  407. package/dist/xy/lint/sonarCommand.mjs +0 -121
  408. package/dist/xy/lint/sonarCommand.mjs.map +0 -1
  409. package/dist/xy/param.mjs +0 -8
  410. package/dist/xy/param.mjs.map +0 -1
  411. package/dist/xy/xyParseOptions.mjs +0 -70
  412. package/dist/xy/xyParseOptions.mjs.map +0 -1
@@ -1,158 +1,3 @@
1
- // src/lib/checkResult.ts
2
- import chalk from "chalk";
3
- var checkResult = (name, result, level = "error", exitOnFail = false) => {
4
- if (result) {
5
- const exiting = exitOnFail ? "[Exiting Process]" : "[Continuing]";
6
- const chalkFunc = level === "error" ? chalk.red : chalk.yellow;
7
- console[level](chalkFunc(`${name} had ${result} failures ${exiting}`));
8
- if (exitOnFail) {
9
- process.exit(result);
10
- }
11
- }
12
- };
13
-
14
- // src/lib/claudeMdTemplate.ts
15
- import {
16
- readdirSync,
17
- readFileSync,
18
- statSync
19
- } from "fs";
20
- import { createRequire } from "module";
21
- import PATH from "path";
22
- var require2 = createRequire(import.meta.url);
23
- var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
24
- var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
25
- var XYLABS_RULES_PREFIX = "xylabs-";
26
- var XYLABS_COMMANDS_PREFIX = "xy-";
27
- var LEGACY_COMMANDS_PREFIX = "xylabs-";
28
- var XYLABS_SKILLS_PREFIX = "xylabs-";
29
- var claudeMdRuleTemplates = () => {
30
- const rulesDir = PATH.resolve(templatesDir, "rules");
31
- const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
32
- const result = {};
33
- for (const file of files) {
34
- result[file] = readFileSync(PATH.resolve(rulesDir, file), "utf8");
35
- }
36
- return result;
37
- };
38
- var claudeCommandTemplates = () => {
39
- const commandsDir = PATH.resolve(templatesDir, "commands");
40
- const files = readdirSync(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
41
- const result = {};
42
- for (const file of files) {
43
- result[file] = readFileSync(PATH.resolve(commandsDir, file), "utf8");
44
- }
45
- return result;
46
- };
47
- var claudeSkillTemplates = () => {
48
- const skillsDir = PATH.resolve(templatesDir, "skills");
49
- const dirs = readdirSync(skillsDir).filter(
50
- (f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync(PATH.resolve(skillsDir, f)).isDirectory()
51
- );
52
- const result = {};
53
- for (const dir of dirs) {
54
- const dirPath = PATH.resolve(skillsDir, dir);
55
- const files = readdirSync(dirPath, { recursive: true, encoding: "utf8" });
56
- result[dir] = {};
57
- for (const file of files) {
58
- if (statSync(PATH.resolve(dirPath, file)).isFile()) {
59
- result[dir][file] = readFileSync(PATH.resolve(dirPath, file), "utf8");
60
- }
61
- }
62
- }
63
- return result;
64
- };
65
- var claudeMdLocalTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-local.md"), "utf8");
66
-
67
- // src/lib/deleteGlob.ts
68
- import fs from "fs";
69
- import { glob } from "glob";
70
- var deleteGlob = (globPath) => {
71
- const files = glob.sync(globPath);
72
- for (const file of files) {
73
- fs.rmSync(file, { recursive: true, force: true });
74
- }
75
- };
76
-
77
- // src/lib/processEx.ts
78
- import chalk2 from "chalk";
79
-
80
- // src/lib/withError.ts
81
- var withError = (ex, closure, predicate = (ex2) => !!ex2.name && !!ex2.message) => {
82
- return predicate(ex) ? closure(ex) : void 0;
83
- };
84
-
85
- // src/lib/withErrnoException.ts
86
- var withErrnoException = (ex, closure) => {
87
- return withError(ex, closure, (ex2) => ex2.errno !== void 0);
88
- };
89
-
90
- // src/lib/processEx.ts
91
- var processEx = (ex) => {
92
- const error = typeof ex === "string" ? new Error(ex) : ex;
93
- const exitCode = withErrnoException(error, (error2) => {
94
- if (error2.code === "ENOENT") {
95
- console.error(chalk2.red(`'${error2.path}' not found.`));
96
- } else {
97
- console.error(chalk2.red(`Errno: ${error2.code}`));
98
- }
99
- return error2.errno ?? -1;
100
- }) ?? withError(error, (error2) => {
101
- console.error(chalk2.red(`${error2.name}: ${error2.message}`));
102
- return -1;
103
- }) ?? (() => {
104
- console.error(chalk2.red(`Unexpected Error: ${JSON.stringify(ex, null, 2)}`));
105
- return -1;
106
- })();
107
- process.exit(process.exitCode ?? exitCode);
108
- };
109
-
110
- // src/lib/safeExit.ts
111
- var safeExit = (func, exitOnFail = true) => {
112
- try {
113
- const result = func();
114
- if (result && exitOnFail) {
115
- process.exit(result);
116
- }
117
- return result;
118
- } catch (ex) {
119
- return processEx(ex);
120
- }
121
- };
122
-
123
- // src/lib/file/constants.ts
124
- var WINDOWS_NEWLINE_REGEX = /\r\n/g;
125
- var CROSS_PLATFORM_NEWLINE = "\n";
126
-
127
- // src/lib/file/fileLines.ts
128
- import {
129
- existsSync,
130
- readFileSync as readFileSync2,
131
- writeFileSync
132
- } from "fs";
133
-
134
- // src/lib/string/empty.ts
135
- var empty = (value) => value?.trim().length === 0;
136
- var notEmpty = (value) => !empty(value);
137
-
138
- // src/lib/string/union.ts
139
- var union = (a, b) => /* @__PURE__ */ new Set([...new Set(a), ...new Set(b)]);
140
-
141
- // src/lib/file/ReadFileSyncOptions.ts
142
- var defaultReadFileSyncOptions = { encoding: "utf8" };
143
-
144
- // src/lib/file/fileLines.ts
145
- var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync2(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [];
146
- var readNonEmptyLines = (uri, options = defaultReadFileSyncOptions) => readLines(uri, options).filter(notEmpty);
147
- var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
148
- const existing = existsSync(uri) ? readFileSync2(uri, options) : void 0;
149
- const desired = lines.join(CROSS_PLATFORM_NEWLINE);
150
- if (existing !== desired) writeFileSync(uri, desired, options);
151
- };
152
-
153
- // src/lib/generateIgnoreFiles.ts
154
- import chalk3 from "chalk";
155
-
156
1
  // src/lib/yarn/isYarnVersionOrGreater.ts
157
2
  import { spawnSync } from "child_process";
158
3
  var isYarnVersionOrGreater = (major, minor, patch) => {
@@ -168,1045 +13,8 @@ var isYarnVersionOrGreater = (major, minor, patch) => {
168
13
  return [majorOk && minorOk && patchOk, version];
169
14
  };
170
15
 
171
- // src/lib/yarn/workspace/yarnWorkspaces.ts
172
- import { spawnSync as spawnSync2 } from "child_process";
173
- var yarnWorkspaces = () => {
174
- const result = spawnSync2("yarn", ["workspaces", "list", "--json", "--recursive"], { encoding: "utf8", shell: true });
175
- if (result.error) {
176
- throw result.error;
177
- }
178
- return result.stdout.toString().split("\n").slice(0, -1).map((item) => {
179
- return JSON.parse(item);
180
- });
181
- };
182
-
183
- // src/lib/yarn/workspace/yarnWorkspace.ts
184
- var yarnWorkspace = (pkg) => {
185
- const workspace = yarnWorkspaces().find(({ name }) => name === pkg);
186
- if (!workspace) throw new Error(`Workspace ${pkg} not found`);
187
- return workspace;
188
- };
189
-
190
- // src/lib/yarn/yarnInitCwd.ts
191
- var INIT_CWD = () => {
192
- if (!process.env.INIT_CWD) console.error("Missing INIT_CWD");
193
- return process.env.INIT_CWD;
194
- };
195
-
196
- // src/lib/generateIgnoreFiles.ts
197
- var localeCompare = (a, b) => a.localeCompare(b);
198
- var mergeEntries = (a, b) => [...union(a, b)].toSorted(localeCompare);
199
- var generateIgnoreFiles = (filename2, pkg) => {
200
- console.log(chalk3.green(`Generate ${filename2} Files`));
201
- const cwd = INIT_CWD() ?? ".";
202
- const workspaces = pkg ? [yarnWorkspace(pkg)] : yarnWorkspaces();
203
- const readEntries = (location) => readNonEmptyLines(`${location}/${filename2}`);
204
- const writeEntries = (location, entries) => writeLines(`${location}/${filename2}`, entries);
205
- const results = workspaces.map(({ location, name }) => {
206
- try {
207
- writeEntries(location, mergeEntries(readEntries(cwd), readEntries(location)));
208
- return 0;
209
- } catch (ex) {
210
- const error = ex;
211
- console.error(`Generate ${filename2} Files [${name}] [${error.message}]`);
212
- return 1;
213
- }
214
- });
215
- const succeeded = results.every((result) => result === 0);
216
- return succeeded ? 0 : 1;
217
- };
218
-
219
- // src/lib/generateReadmeFiles.ts
220
- import { execSync } from "child_process";
221
- import FS, { readFileSync as readFileSync3 } from "fs";
222
- import {
223
- mkdir,
224
- readFile,
225
- writeFile
226
- } from "fs/promises";
227
- import { createRequire as createRequire2 } from "module";
228
- import PATH2 from "path";
229
- import { createInterface } from "readline";
230
- import chalk4 from "chalk";
231
- var require3 = createRequire2(import.meta.url);
232
- var packageRoot2 = PATH2.dirname(require3.resolve("@xylabs/ts-scripts-yarn3/package.json"));
233
- var readmeTemplatesDir = PATH2.resolve(packageRoot2, "templates", "readme");
234
- function fillTemplate(template, data) {
235
- const additionalData = { ...data, safeName: data.name.replaceAll("/", "__").replaceAll("@", "") };
236
- return template.replaceAll(/\{\{(.*?)\}\}/g, (_, key) => additionalData[key.trim()] ?? "");
237
- }
238
- function generateTypedoc(packageLocation, entryPoints) {
239
- const tempDir = PATH2.join(packageLocation, ".temp-typedoc");
240
- try {
241
- if (!FS.existsSync(tempDir)) {
242
- FS.mkdirSync(tempDir, { recursive: true });
243
- }
244
- const typedocConfig = {
245
- disableSources: true,
246
- entryPointStrategy: "expand",
247
- entryPoints: entryPoints.map((ep) => PATH2.resolve(packageLocation, ep)),
248
- excludeExternals: true,
249
- excludeInternal: true,
250
- excludePrivate: true,
251
- githubPages: false,
252
- hideBreadcrumbs: true,
253
- hideGenerator: true,
254
- hidePageTitle: true,
255
- out: tempDir,
256
- plugin: ["typedoc-plugin-markdown"],
257
- readme: "none",
258
- skipErrorChecking: true,
259
- sort: ["source-order"],
260
- theme: "markdown",
261
- useCodeBlocks: true
262
- };
263
- const typedocJsonPath = PATH2.join(tempDir, "typedoc.json");
264
- FS.writeFileSync(typedocJsonPath, JSON.stringify(typedocConfig, null, 2));
265
- try {
266
- execSync(`npx typedoc --options ${typedocJsonPath}`, {
267
- cwd: process.cwd(),
268
- stdio: ["ignore", "pipe", "pipe"]
269
- });
270
- } catch {
271
- return "";
272
- }
273
- return consolidateMarkdown(tempDir);
274
- } catch {
275
- return "";
276
- } finally {
277
- try {
278
- FS.rmSync(tempDir, { force: true, recursive: true });
279
- } catch {
280
- }
281
- }
282
- }
283
- function consolidateMarkdown(tempDir) {
284
- let consolidated = "## Reference\n\n";
285
- const mainReadmePath = PATH2.join(tempDir, "README.md");
286
- if (FS.existsSync(mainReadmePath)) {
287
- const mainContent = FS.readFileSync(mainReadmePath, "utf8").replace(/^---(.|\n)*?---\n/, "").replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
288
- consolidated += mainContent + "\n\n";
289
- }
290
- consolidated += processDirectory(tempDir);
291
- return consolidated.replaceAll(/\n\n\n+/g, "\n\n").replaceAll(/^#### /gm, "### ").replaceAll(/^##### /gm, "#### ").replaceAll(/^###### /gm, "##### ");
292
- }
293
- function processDirectory(dir, level = 0) {
294
- const indent = " ".repeat(level);
295
- let content = "";
296
- try {
297
- const items = FS.readdirSync(dir, { withFileTypes: true });
298
- for (const item of items) {
299
- if (item.isDirectory()) continue;
300
- if (item.name === "README.md" || !item.name.endsWith(".md")) continue;
301
- const fileContent = FS.readFileSync(PATH2.join(dir, item.name), "utf8").replace(/^---(.|\n)*?---\n/, "");
302
- const moduleName = item.name.replace(".md", "");
303
- content += `
304
-
305
- ${indent}### <a id="${moduleName}"></a>${moduleName}
306
-
307
- `;
308
- content += fileContent.replace(/^# .+\n/, "").replaceAll(/\]\((.+?)\.md\)/g, "](#$1)");
309
- }
310
- for (const item of items) {
311
- if (!item.isDirectory()) continue;
312
- if (item.name === "spec" || item.name.includes(".spec")) continue;
313
- content += `
314
-
315
- ${indent}### ${item.name}
316
- `;
317
- content += processDirectory(PATH2.join(dir, item.name), level + 1);
318
- }
319
- } catch {
320
- }
321
- return content;
322
- }
323
- function askConfirmation(question) {
324
- const rl = createInterface({ input: process.stdin, output: process.stdout });
325
- return new Promise((resolve) => {
326
- rl.question(question, (answer) => {
327
- rl.close();
328
- resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
329
- });
330
- });
331
- }
332
- var DEFAULT_README_TEMPLATE = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.template.md"), "utf8");
333
- var DEFAULT_README_BODY = readFileSync3(PATH2.resolve(readmeTemplatesDir, "README.body.md"), "utf8");
334
- function applyLogoConfig(template, logoUrl, logoLinkUrl) {
335
- let result = template;
336
- if (logoUrl) {
337
- result = result.replace(/\[logo]: .+/, `[logo]: ${logoUrl}`);
338
- if (logoLinkUrl) {
339
- result = result.replace(/\[!\[logo]\[]][^)]*\)/, `[![logo][]](${logoLinkUrl})`);
340
- }
341
- } else {
342
- result = result.replace(/\[!\[logo]\[]][^\n]*\n*/, "");
343
- result = result.replace(/\[logo]: [^\n]*\n?/, "");
344
- }
345
- return result;
346
- }
347
- function resolveTemplatePath(templatePath) {
348
- const cwd = INIT_CWD() ?? ".";
349
- return templatePath ?? PATH2.join(cwd, ".xy", "README.template.md");
350
- }
351
- async function loadOrCreateTemplate(resolvedTemplatePath) {
352
- try {
353
- const template = await readFile(resolvedTemplatePath, "utf8");
354
- return { created: false, template };
355
- } catch {
356
- console.log(chalk4.yellow(`Template not found: ${resolvedTemplatePath}`));
357
- const shouldCreate = await askConfirmation("Would you like to create a stock template? (y/N) ");
358
- if (!shouldCreate) {
359
- throw new Error("Template creation declined");
360
- }
361
- const template = DEFAULT_README_TEMPLATE;
362
- await scaffoldTemplate(resolvedTemplatePath, template);
363
- return { created: true, template };
364
- }
365
- }
366
- async function scaffoldTemplate(resolvedTemplatePath, template) {
367
- const xyDir = PATH2.dirname(resolvedTemplatePath);
368
- await mkdir(xyDir, { recursive: true });
369
- await writeFile(resolvedTemplatePath, template);
370
- console.log(chalk4.green(`Created template: ${resolvedTemplatePath}`));
371
- const bodyPath = PATH2.join(xyDir, "README.body.md");
372
- await writeFile(bodyPath, DEFAULT_README_BODY);
373
- console.log(chalk4.green(`Created body template: ${bodyPath}`));
374
- }
375
- async function resolveBody(location, defaultBody) {
376
- const localBodyPath = PATH2.join(location, "README.body.md");
377
- try {
378
- return await readFile(localBodyPath, "utf8");
379
- } catch {
380
- return defaultBody;
381
- }
382
- }
383
- async function generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose) {
384
- try {
385
- const pkgJsonPath = PATH2.join(location, "package.json");
386
- const pkgJson = JSON.parse(await readFile(pkgJsonPath, "utf8"));
387
- const body = await resolveBody(location, defaultBody);
388
- const typedocContent = typedoc ? generateTypedoc(location, ["src/index*.ts"]) : "";
389
- const readmeContent = fillTemplate(template, {
390
- ...pkgJson,
391
- body,
392
- typedoc: typedocContent
393
- });
394
- await writeFile(PATH2.join(location, "README.md"), readmeContent);
395
- if (verbose) console.log(chalk4.green(` ${name}`));
396
- return true;
397
- } catch (ex) {
398
- const error = ex;
399
- console.warn(chalk4.yellow(` Skipped ${location}: ${error.message}`));
400
- return false;
401
- }
402
- }
403
- async function generateReadmeFiles({
404
- logoLinkUrl,
405
- logoUrl,
406
- pkg,
407
- templatePath,
408
- typedoc = false,
409
- verbose = false
410
- }) {
411
- console.log(chalk4.green("Generate README Files"));
412
- const resolvedTemplatePath = resolveTemplatePath(templatePath);
413
- let template;
414
- let templateCreated;
415
- try {
416
- ({ template, created: templateCreated } = await loadOrCreateTemplate(resolvedTemplatePath));
417
- } catch {
418
- return 1;
419
- }
420
- template = applyLogoConfig(template, logoUrl, logoLinkUrl);
421
- if (templateCreated) {
422
- console.log(chalk4.green("Generating README files for all packages..."));
423
- }
424
- const xyDir = PATH2.dirname(resolvedTemplatePath);
425
- const xyBodyPath = PATH2.join(xyDir, "README.body.md");
426
- let defaultBody;
427
- try {
428
- defaultBody = await readFile(xyBodyPath, "utf8");
429
- } catch {
430
- defaultBody = DEFAULT_README_BODY;
431
- }
432
- const workspaces = pkg && !templateCreated ? [yarnWorkspace(pkg)] : yarnWorkspaces();
433
- let failed = false;
434
- for (const { location, name } of workspaces) {
435
- const success = await generateReadmeForWorkspace(location, name, template, defaultBody, typedoc, verbose);
436
- if (!success) failed = true;
437
- }
438
- return failed ? 1 : 0;
439
- }
440
-
441
- // src/lib/gitignoreTemplate.ts
442
- import { readFileSync as readFileSync4 } from "fs";
443
- import { createRequire as createRequire3 } from "module";
444
- import PATH3 from "path";
445
- var require4 = createRequire3(import.meta.url);
446
- var packageRoot3 = PATH3.dirname(require4.resolve("@xylabs/ts-scripts-yarn3/package.json"));
447
- var templatesDir2 = PATH3.resolve(packageRoot3, "templates", "gitignore");
448
- var gitignoreTemplate = () => readFileSync4(PATH3.resolve(templatesDir2, "template.gitignore"), "utf8");
449
-
450
- // src/lib/loadConfig.ts
451
- import chalk5 from "chalk";
452
- import { cosmiconfig } from "cosmiconfig";
453
- import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
454
- import deepmerge from "deepmerge";
455
- var config;
456
- var loadConfig = async (params) => {
457
- if (config === void 0) {
458
- const cosmicConfigResult = await cosmiconfig("xy", { cache: true, loaders: { ".ts": TypeScriptLoader() } }).search();
459
- config = cosmicConfigResult?.config;
460
- const configFilePath = cosmicConfigResult?.filepath;
461
- if (configFilePath !== void 0) {
462
- console.log(chalk5.green(`Loaded config from ${configFilePath}`));
463
- if (config.verbose) {
464
- console.log(chalk5.gray(`${JSON.stringify(config, null, 2)}`));
465
- }
466
- }
467
- }
468
- return deepmerge(config, params ?? {});
469
- };
470
-
471
- // src/lib/runSteps.ts
472
- import { spawnSync as spawnSync3 } from "child_process";
473
- import { existsSync as existsSync2 } from "fs";
474
- import chalk6 from "chalk";
475
- var runSteps = (name, steps, exitOnFail = true, messages) => {
476
- return safeExit(() => {
477
- const pkgName = process.env.npm_package_name;
478
- console.log(chalk6.green(`${name} [${pkgName}]`));
479
- let totalStatus = 0;
480
- for (const [i, [command, args, config2]] of steps.entries()) {
481
- if (messages?.[i]) {
482
- console.log(chalk6.gray(messages?.[i]));
483
- }
484
- const argList = Array.isArray(args) ? args : args.split(" ");
485
- if (command === "node" && !existsSync2(argList[0])) {
486
- throw new Error(`File not found [${argList[0]}]`);
487
- }
488
- const status = spawnSync3(command, Array.isArray(args) ? args : args.split(" "), {
489
- ...config2,
490
- encoding: "utf8",
491
- env: { FORCE_COLOR: "3", ...process.env },
492
- shell: true,
493
- stdio: "inherit"
494
- }).status ?? 0;
495
- checkResult(name, status, "error", exitOnFail);
496
- totalStatus += status ?? 0;
497
- }
498
- return totalStatus;
499
- }, !!exitOnFail);
500
- };
501
-
502
- // src/actions/claude-clean.ts
503
- import {
504
- existsSync as existsSync3,
505
- readdirSync as readdirSync2,
506
- rmSync,
507
- unlinkSync
508
- } from "fs";
509
- import PATH4 from "path";
510
- import chalk7 from "chalk";
511
- function removeFile(filePath, label) {
512
- if (existsSync3(filePath)) {
513
- unlinkSync(filePath);
514
- console.log(chalk7.yellow(` Removed ${label}`));
515
- return true;
516
- }
517
- return false;
518
- }
519
- function removeDir(dirPath, label) {
520
- if (existsSync3(dirPath)) {
521
- rmSync(dirPath, { recursive: true });
522
- console.log(chalk7.yellow(` Removed ${label}`));
523
- return true;
524
- }
525
- return false;
526
- }
527
- function claudeClean() {
528
- console.log(chalk7.green("Clean Claude configuration"));
529
- const cwd = INIT_CWD() ?? process.cwd();
530
- let removed = 0;
531
- const rootFiles = ["CLAUDE.md", "CLAUDE.local.md"];
532
- for (const file of rootFiles) {
533
- if (removeFile(PATH4.resolve(cwd, file), file)) removed++;
534
- }
535
- if (removeDir(PATH4.resolve(cwd, ".claude"), ".claude/")) removed++;
536
- const packagesDir = PATH4.resolve(cwd, "packages");
537
- if (existsSync3(packagesDir)) {
538
- const findClaudeFiles = (dir, prefix) => {
539
- const entries = readdirSync2(dir, { withFileTypes: true });
540
- for (const entry of entries) {
541
- const fullPath = PATH4.resolve(dir, entry.name);
542
- const label = `${prefix}${entry.name}`;
543
- if (entry.isFile() && (entry.name === "CLAUDE.md" || entry.name === "CLAUDE.local.md")) {
544
- if (removeFile(fullPath, label)) removed++;
545
- } else if (entry.isDirectory() && entry.name === ".claude") {
546
- if (removeDir(fullPath, `${label}/`)) removed++;
547
- } else if (entry.isDirectory() && entry.name !== "node_modules" && entry.name !== "dist") {
548
- findClaudeFiles(fullPath, `${label}/`);
549
- }
550
- }
551
- };
552
- findClaudeFiles(packagesDir, "packages/");
553
- }
554
- if (removed > 0) {
555
- console.log(chalk7.green(` Removed ${removed} item(s)`));
556
- } else {
557
- console.log(chalk7.gray(" Nothing to clean"));
558
- }
559
- return 0;
560
- }
561
-
562
- // src/actions/claude-commands.ts
563
- import {
564
- existsSync as existsSync4,
565
- mkdirSync,
566
- readdirSync as readdirSync3,
567
- readFileSync as readFileSync5,
568
- unlinkSync as unlinkSync2,
569
- writeFileSync as writeFileSync2
570
- } from "fs";
571
- import PATH5 from "path";
572
- import chalk8 from "chalk";
573
- var syncCommandFiles = (commandsDir) => {
574
- const templates = claudeCommandTemplates();
575
- const templateNames = new Set(Object.keys(templates));
576
- let updated = 0;
577
- let created = 0;
578
- for (const [filename2, content] of Object.entries(templates)) {
579
- const targetPath = PATH5.resolve(commandsDir, filename2);
580
- const existing = existsSync4(targetPath) ? readFileSync5(targetPath, "utf8") : void 0;
581
- if (existing === content) continue;
582
- writeFileSync2(targetPath, content, "utf8");
583
- if (existing) {
584
- updated++;
585
- } else {
586
- created++;
587
- }
588
- }
589
- return {
590
- created,
591
- templateNames,
592
- updated
593
- };
594
- };
595
- var removeStaleCommands = (commandsDir, templateNames) => {
596
- const existingCommands = readdirSync3(commandsDir).filter((f) => f.startsWith(XYLABS_COMMANDS_PREFIX) && f.endsWith(".md"));
597
- let removed = 0;
598
- for (const file of existingCommands) {
599
- if (!templateNames.has(file)) {
600
- unlinkSync2(PATH5.resolve(commandsDir, file));
601
- removed++;
602
- }
603
- }
604
- return removed;
605
- };
606
- var removeLegacyCommands = (commandsDir) => {
607
- const legacyFiles = readdirSync3(commandsDir).filter((f) => f.startsWith(LEGACY_COMMANDS_PREFIX) && f.endsWith(".md"));
608
- for (const file of legacyFiles) {
609
- unlinkSync2(PATH5.resolve(commandsDir, file));
610
- }
611
- return legacyFiles.length;
612
- };
613
- var logCommandsResult = (created, updated, removed) => {
614
- if (created || updated || removed) {
615
- const parts = [
616
- created ? `${created} created` : "",
617
- updated ? `${updated} updated` : "",
618
- removed ? `${removed} removed` : ""
619
- ].filter(Boolean);
620
- console.log(chalk8.green(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: ${parts.join(", ")}`));
621
- } else {
622
- console.log(chalk8.gray(`.claude/commands/${XYLABS_COMMANDS_PREFIX}*.md: already up to date`));
623
- }
624
- };
625
- var claudeCommands = () => {
626
- const cwd = INIT_CWD() ?? process.cwd();
627
- const commandsDir = PATH5.resolve(cwd, ".claude", "commands");
628
- mkdirSync(commandsDir, { recursive: true });
629
- const legacy = removeLegacyCommands(commandsDir);
630
- const {
631
- created,
632
- templateNames,
633
- updated
634
- } = syncCommandFiles(commandsDir);
635
- const removed = removeStaleCommands(commandsDir, templateNames);
636
- logCommandsResult(created, updated, removed + legacy);
637
- return 0;
638
- };
639
-
640
- // src/actions/claude-rules.ts
641
- import { spawnSync as spawnSync4 } from "child_process";
642
- import {
643
- existsSync as existsSync5,
644
- mkdirSync as mkdirSync2,
645
- readdirSync as readdirSync4,
646
- readFileSync as readFileSync6,
647
- unlinkSync as unlinkSync3,
648
- writeFileSync as writeFileSync3
649
- } from "fs";
650
- import PATH6 from "path";
651
- import chalk9 from "chalk";
652
- var syncRuleFiles = (rulesDir) => {
653
- const templates = claudeMdRuleTemplates();
654
- const templateNames = new Set(Object.keys(templates));
655
- let updated = 0;
656
- let created = 0;
657
- for (const [filename2, content] of Object.entries(templates)) {
658
- const targetPath = PATH6.resolve(rulesDir, filename2);
659
- const existing = existsSync5(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
660
- if (existing === content) continue;
661
- writeFileSync3(targetPath, content, "utf8");
662
- if (existing) {
663
- updated++;
664
- } else {
665
- created++;
666
- }
667
- }
668
- return {
669
- created,
670
- templateNames,
671
- updated
672
- };
673
- };
674
- var removeStaleRules = (rulesDir, templateNames) => {
675
- const existingRules = readdirSync4(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
676
- let removed = 0;
677
- for (const file of existingRules) {
678
- if (!templateNames.has(file)) {
679
- unlinkSync3(PATH6.resolve(rulesDir, file));
680
- removed++;
681
- }
682
- }
683
- return removed;
684
- };
685
- var logRulesResult = (created, updated, removed) => {
686
- if (created || updated || removed) {
687
- const parts = [
688
- created ? `${created} created` : "",
689
- updated ? `${updated} updated` : "",
690
- removed ? `${removed} removed` : ""
691
- ].filter(Boolean);
692
- console.log(chalk9.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
693
- } else {
694
- console.log(chalk9.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
695
- }
696
- };
697
- var ensureProjectClaudeMd = (cwd, force) => {
698
- const projectPath = PATH6.resolve(cwd, "CLAUDE.md");
699
- if (!existsSync5(projectPath) || force) {
700
- if (force && existsSync5(projectPath)) {
701
- console.log(chalk9.yellow("Regenerating CLAUDE.md"));
702
- }
703
- console.log(chalk9.green("Generating CLAUDE.md via claude /init..."));
704
- const result = spawnSync4("claude", ["-p", "/init", "--allowedTools", "Read", "Write", "Glob", "Grep"], {
705
- cwd,
706
- shell: true,
707
- stdio: "inherit"
708
- });
709
- if (result.status !== 0) {
710
- console.error(chalk9.red("claude /init failed \u2014 is Claude Code installed?"));
711
- return 1;
712
- }
713
- } else {
714
- console.log(chalk9.gray("CLAUDE.md already exists (skipped, use --force to regenerate)"));
715
- }
716
- return 0;
717
- };
718
- var ensureLocalClaudeMd = (cwd) => {
719
- const localPath = PATH6.resolve(cwd, "CLAUDE.local.md");
720
- if (existsSync5(localPath)) {
721
- console.log(chalk9.gray("CLAUDE.local.md already exists (skipped)"));
722
- } else {
723
- writeFileSync3(localPath, claudeMdLocalTemplate(), "utf8");
724
- console.log(chalk9.green("Generated CLAUDE.local.md"));
725
- }
726
- };
727
- var claudeRules = ({ force } = {}) => {
728
- const cwd = INIT_CWD() ?? process.cwd();
729
- const rulesDir = PATH6.resolve(cwd, ".claude", "rules");
730
- mkdirSync2(rulesDir, { recursive: true });
731
- const {
732
- created,
733
- templateNames,
734
- updated
735
- } = syncRuleFiles(rulesDir);
736
- const removed = removeStaleRules(rulesDir, templateNames);
737
- logRulesResult(created, updated, removed);
738
- const claudeMdResult = ensureProjectClaudeMd(cwd, force);
739
- ensureLocalClaudeMd(cwd);
740
- return claudeMdResult ?? 0;
741
- };
742
-
743
- // src/actions/claude-settings.ts
744
- import {
745
- existsSync as existsSync6,
746
- mkdirSync as mkdirSync3,
747
- writeFileSync as writeFileSync4
748
- } from "fs";
749
- import PATH7 from "path";
750
- import { createInterface as createInterface2 } from "readline";
751
- import chalk10 from "chalk";
752
- var DEFAULT_SETTINGS = {
753
- permissions: {
754
- allow: [
755
- "Bash(git *)",
756
- "Bash(yarn *)",
757
- "Bash(npx *)",
758
- "Bash(node *)",
759
- "Bash(ls *)",
760
- "Bash(mkdir *)",
761
- "Bash(cp *)",
762
- "Bash(mv *)",
763
- "Bash(rm *)",
764
- "Bash(cat *)",
765
- "Bash(head *)",
766
- "Bash(tail *)",
767
- "Bash(echo *)",
768
- "Bash(pwd)",
769
- "Bash(which *)",
770
- "Bash(grep *)",
771
- "Bash(find *)",
772
- "Bash(npm view *)",
773
- "Bash(gh *)",
774
- "Read",
775
- "Edit",
776
- "Write",
777
- "Glob",
778
- "Grep",
779
- "Skill"
780
- ],
781
- deny: [
782
- "Bash(git push --force *)",
783
- "Bash(git reset --hard *)",
784
- "Bash(rm -rf /*)"
785
- ]
786
- }
787
- };
788
- function askConfirmation2(question) {
789
- const rl = createInterface2({ input: process.stdin, output: process.stdout });
790
- return new Promise((resolve) => {
791
- rl.question(question, (answer) => {
792
- rl.close();
793
- resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
794
- });
795
- });
796
- }
797
- async function claudeSettings() {
798
- const cwd = INIT_CWD() ?? process.cwd();
799
- const claudeDir = PATH7.resolve(cwd, ".claude");
800
- const settingsPath = PATH7.resolve(claudeDir, "settings.local.json");
801
- mkdirSync3(claudeDir, { recursive: true });
802
- if (existsSync6(settingsPath)) {
803
- const confirmed = await askConfirmation2(
804
- chalk10.yellow(`${settingsPath} already exists. Replace it? (y/N) `)
805
- );
806
- if (!confirmed) {
807
- console.log(chalk10.gray("Skipped \u2014 existing settings.local.json preserved"));
808
- return 0;
809
- }
810
- }
811
- writeFileSync4(settingsPath, `${JSON.stringify(DEFAULT_SETTINGS, null, 2)}
812
- `, "utf8");
813
- console.log(chalk10.green("Generated .claude/settings.local.json"));
814
- return 0;
815
- }
816
-
817
- // src/actions/claude-skills.ts
818
- import {
819
- existsSync as existsSync7,
820
- mkdirSync as mkdirSync4,
821
- readdirSync as readdirSync5,
822
- readFileSync as readFileSync7,
823
- rmSync as rmSync2,
824
- statSync as statSync2,
825
- writeFileSync as writeFileSync5
826
- } from "fs";
827
- import PATH8 from "path";
828
- import chalk11 from "chalk";
829
- var syncSkillFiles = (skillsDir) => {
830
- const templates = claudeSkillTemplates();
831
- const templateNames = new Set(Object.keys(templates));
832
- let updated = 0;
833
- let created = 0;
834
- for (const [skillName, files] of Object.entries(templates)) {
835
- const skillDir = PATH8.resolve(skillsDir, skillName);
836
- mkdirSync4(skillDir, { recursive: true });
837
- for (const [filename2, content] of Object.entries(files)) {
838
- const targetPath = PATH8.resolve(skillDir, filename2);
839
- mkdirSync4(PATH8.dirname(targetPath), { recursive: true });
840
- const existing = existsSync7(targetPath) ? readFileSync7(targetPath, "utf8") : void 0;
841
- if (existing === content) continue;
842
- writeFileSync5(targetPath, content, "utf8");
843
- if (existing) {
844
- updated++;
845
- } else {
846
- created++;
847
- }
848
- }
849
- }
850
- return {
851
- created,
852
- templateNames,
853
- updated
854
- };
855
- };
856
- var removeStaleSkills = (skillsDir, templateNames) => {
857
- const existingSkills = readdirSync5(skillsDir).filter(
858
- (f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH8.resolve(skillsDir, f)).isDirectory()
859
- );
860
- let removed = 0;
861
- for (const dir of existingSkills) {
862
- if (!templateNames.has(dir)) {
863
- rmSync2(PATH8.resolve(skillsDir, dir), { recursive: true });
864
- removed++;
865
- }
866
- }
867
- return removed;
868
- };
869
- var logSkillsResult = (created, updated, removed) => {
870
- if (created || updated || removed) {
871
- const parts = [
872
- created ? `${created} created` : "",
873
- updated ? `${updated} updated` : "",
874
- removed ? `${removed} removed` : ""
875
- ].filter(Boolean);
876
- console.log(chalk11.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
877
- } else {
878
- console.log(chalk11.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
879
- }
880
- };
881
- var claudeSkills = () => {
882
- const cwd = INIT_CWD() ?? process.cwd();
883
- const skillsDir = PATH8.resolve(cwd, ".claude", "skills");
884
- mkdirSync4(skillsDir, { recursive: true });
885
- const {
886
- created,
887
- templateNames,
888
- updated
889
- } = syncSkillFiles(skillsDir);
890
- const removed = removeStaleSkills(skillsDir, templateNames);
891
- logSkillsResult(created, updated, removed);
892
- return 0;
893
- };
894
-
895
- // src/actions/clean-docs.ts
896
- import path from "path";
897
- import chalk12 from "chalk";
898
- var cleanDocs = () => {
899
- const pkgName = process.env.npm_package_name;
900
- console.log(chalk12.green(`Cleaning Docs [${pkgName}]`));
901
- for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
902
- return 0;
903
- };
904
-
905
- // src/actions/dead.ts
906
- var dead = () => {
907
- return runSteps("Dead", [["yarn", ["ts-prune", "-p", "tsconfig.json"]]]);
908
- };
909
-
910
- // src/actions/gen-docs.ts
911
- var genDocs = ({ pkg, incremental }) => {
912
- return pkg ? genDocsPackage({ pkg }) : genDocsAll({ incremental });
913
- };
914
- var genDocsPackage = ({ pkg }) => {
915
- const steps = [["yarn", ["workspace", pkg, "run", "package-gen-docs"]]];
916
- return runSteps(`GenDocs [${pkg}]`, [...steps]);
917
- };
918
- var genDocsAll = ({ incremental }) => {
919
- const incrementalOptions = incremental ? ["--since", "-pA"] : ["-pA"];
920
- const steps = [["yarn", ["workspaces", "foreach", ...incrementalOptions, "run", "package-gen-docs"]]];
921
- return runSteps(`GenDocs [All${incremental ? "-Incremental" : ""}]`, [...steps]);
922
- };
923
-
924
- // src/actions/gitignore.ts
925
- import { unlinkSync as unlinkSync4 } from "fs";
926
- import chalk13 from "chalk";
927
- var COMMENT_PREFIX = "#";
928
- var isComment = (line) => line.startsWith(COMMENT_PREFIX);
929
- var isNegation = (line) => line.startsWith("!");
930
- function parseTemplateSections(lines) {
931
- const sections = [];
932
- let current = [];
933
- for (const line of lines) {
934
- if (isComment(line)) {
935
- if (current.length > 0) {
936
- sections.push(current);
937
- }
938
- current = [line];
939
- } else {
940
- current.push(line);
941
- }
942
- }
943
- if (current.length > 0) {
944
- sections.push(current);
945
- }
946
- return sections;
947
- }
948
- function mergeWithTemplate(existing, templateContent) {
949
- const templateLines = templateContent.split("\n").filter((line) => line.trim().length > 0);
950
- const sections = parseTemplateSections(templateLines);
951
- const existingEntries = new Set(existing.filter((line) => !isComment(line)));
952
- const templateEntries = new Set(templateLines.filter((line) => !isComment(line)));
953
- const customEntries = [...existingEntries].filter((entry) => !templateEntries.has(entry));
954
- const result = [];
955
- for (const section of sections) {
956
- for (const line of section) {
957
- result.push(line);
958
- }
959
- result.push("");
960
- }
961
- if (customEntries.length > 0) {
962
- result.push("# Custom");
963
- const sorted = [...union(customEntries, [])].toSorted((a, b) => {
964
- if (isNegation(a) && !isNegation(b)) return 1;
965
- if (!isNegation(a) && isNegation(b)) return -1;
966
- return a.localeCompare(b);
967
- });
968
- for (const entry of sorted) {
969
- result.push(entry);
970
- }
971
- result.push("");
972
- }
973
- return result;
974
- }
975
- function removePackageGitignores(cwd) {
976
- let removed = 0;
977
- const workspaces = yarnWorkspaces();
978
- for (const { location } of workspaces) {
979
- if (location === ".") continue;
980
- const filePath = `${cwd}/${location}/.gitignore`;
981
- try {
982
- unlinkSync4(filePath);
983
- console.log(chalk13.yellow(` Removed ${location}/.gitignore`));
984
- removed++;
985
- } catch {
986
- }
987
- }
988
- return removed;
989
- }
990
- function gitignore() {
991
- console.log(chalk13.green("Generate .gitignore"));
992
- const cwd = INIT_CWD() ?? ".";
993
- const gitignorePath = `${cwd}/.gitignore`;
994
- try {
995
- const templateContent = gitignoreTemplate();
996
- const existing = readNonEmptyLines(gitignorePath);
997
- const merged = mergeWithTemplate(existing, templateContent);
998
- writeLines(gitignorePath, merged);
999
- console.log(chalk13.green(" Root .gitignore updated"));
1000
- const removed = removePackageGitignores(cwd);
1001
- if (removed > 0) {
1002
- console.log(chalk13.green(` Removed ${removed} package .gitignore file(s)`));
1003
- }
1004
- return 0;
1005
- } catch (ex) {
1006
- const error = ex;
1007
- console.error(chalk13.red(`Generate .gitignore failed: ${error.message}`));
1008
- return 1;
1009
- }
1010
- }
1011
-
1012
- // src/actions/gitlint.ts
1013
- import chalk14 from "chalk";
1014
- import ParseGitConfig from "parse-git-config";
1015
- var gitlint = () => {
1016
- console.log(`
1017
- Gitlint Start [${process.cwd()}]
1018
- `);
1019
- let valid = 0;
1020
- let warnings = 0;
1021
- const errors = 0;
1022
- const gitConfig = ParseGitConfig.sync();
1023
- const warn = (message) => {
1024
- console.warn(chalk14.yellow(`Warning: ${message}`));
1025
- warnings++;
1026
- };
1027
- if (gitConfig.core.ignorecase) {
1028
- warn("Please set core.ignorecase to FALSE in .git/config file [run yarn gitlint-fix]");
1029
- } else {
1030
- valid++;
1031
- }
1032
- if (gitConfig.core.autocrlf === false) {
1033
- valid++;
1034
- } else {
1035
- warn("Please set core.autocrlf to FALSE in .git/config file [run yarn gitlint-fix]");
1036
- }
1037
- if (gitConfig.core.eol === "lf") {
1038
- valid++;
1039
- } else {
1040
- warn('Please set core.eol to "lf" in .git/config file [run yarn gitlint-fix]');
1041
- }
1042
- const resultMessages = [];
1043
- if (valid > 0) {
1044
- resultMessages.push(chalk14.green(`Passed: ${valid}`));
1045
- }
1046
- if (warnings > 0) {
1047
- resultMessages.push(chalk14.yellow(`Warnings: ${warnings}`));
1048
- }
1049
- if (errors > 0) {
1050
- resultMessages.push(chalk14.red(` Errors: ${errors}`));
1051
- }
1052
- console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1053
- `);
1054
- return warnings + errors === 0 ? 1 : 0;
1055
- };
1056
-
1057
- // src/actions/gitlint-fix.ts
1058
- import { execSync as execSync2 } from "child_process";
1059
- import chalk15 from "chalk";
1060
- import ParseGitConfig2 from "parse-git-config";
1061
- var gitlintFix = () => {
1062
- console.log(`
1063
- Gitlint Fix Start [${process.cwd()}]
1064
- `);
1065
- const gitConfig = ParseGitConfig2.sync();
1066
- if (gitConfig.core.ignorecase) {
1067
- execSync2("git config core.ignorecase false", { stdio: "inherit" });
1068
- console.warn(chalk15.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1069
- }
1070
- if (gitConfig.core.autocrlf !== false) {
1071
- execSync2("git config core.autocrlf false", { stdio: "inherit" });
1072
- console.warn(chalk15.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1073
- }
1074
- if (gitConfig.core.eol !== "lf") {
1075
- execSync2("git config core.eol lf", { stdio: "inherit" });
1076
- console.warn(chalk15.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1077
- }
1078
- return 1;
1079
- };
1080
-
1081
- // src/actions/license.ts
1082
- import chalk16 from "chalk";
1083
- import { init } from "license-checker";
1084
- var license = async (pkg) => {
1085
- const workspaces = yarnWorkspaces();
1086
- const workspaceList = workspaces.filter(({ name }) => {
1087
- return pkg === void 0 || name === pkg;
1088
- });
1089
- const exclude = /* @__PURE__ */ new Set([
1090
- "MIT",
1091
- "MIT*",
1092
- "ISC",
1093
- "Apache-2.0",
1094
- "BSD",
1095
- "BSD*",
1096
- "BSD-2-Clause",
1097
- "BSD-3-Clause",
1098
- "CC-BY-4.0",
1099
- "Unlicense",
1100
- "CC-BY-3.0",
1101
- "CC0-1.0",
1102
- "LGPL-3.0-only",
1103
- "LGPL-3.0",
1104
- "LGPL-3.0-or-later",
1105
- "Python-2.0"
1106
- ]);
1107
- console.log(chalk16.green("License Checker"));
1108
- return (await Promise.all(
1109
- workspaceList.map(({ location, name }) => {
1110
- return new Promise((resolve) => {
1111
- init({ production: true, start: location }, (error, packages) => {
1112
- if (error) {
1113
- console.error(chalk16.red(`License Checker [${name}] Error`));
1114
- console.error(chalk16.gray(error));
1115
- console.log("\n");
1116
- resolve(1);
1117
- } else {
1118
- console.log(chalk16.green(`License Checker [${name}]`));
1119
- let count = 0;
1120
- for (const [name2, info] of Object.entries(packages)) {
1121
- const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
1122
- for (let license2 of licenses) {
1123
- if (license2) {
1124
- const processedLicense = license2[0] === "(" && license2.at(-1) === ")" ? license2.slice(1, -2) : license2;
1125
- const orLicenses = processedLicense.split(" OR ");
1126
- let orLicenseFound = false;
1127
- for (const orLicense of orLicenses) {
1128
- if (exclude.has(orLicense)) {
1129
- orLicenseFound = true;
1130
- }
1131
- }
1132
- if (!orLicenseFound) {
1133
- count++;
1134
- console.warn(chalk16.yellow(`${name2}: Package License not allowed [${license2}]`));
1135
- }
1136
- }
1137
- }
1138
- }
1139
- console.log("\n");
1140
- resolve(count);
1141
- }
1142
- });
1143
- });
1144
- })
1145
- )).reduce((prev, value) => prev || value, 0);
1146
- };
1147
-
1148
- // src/actions/npmignore-gen.ts
1149
- var filename = ".npmignore";
1150
- var npmignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1151
-
1152
- // src/actions/readme-gen.ts
1153
- async function readmeGen({
1154
- pkg,
1155
- templatePath,
1156
- typedoc,
1157
- verbose
1158
- }) {
1159
- const config2 = await loadConfig();
1160
- return await generateReadmeFiles({
1161
- logoLinkUrl: config2.readme?.logoLinkUrl,
1162
- logoUrl: config2.readme?.logoUrl,
1163
- pkg,
1164
- templatePath,
1165
- typedoc,
1166
- verbose
1167
- });
1168
- }
1169
-
1170
- // src/actions/readme-init.ts
1171
- async function readmeInit({ templatePath }) {
1172
- const config2 = await loadConfig();
1173
- const template = applyLogoConfig(DEFAULT_README_TEMPLATE, config2.readme?.logoUrl, config2.readme?.logoLinkUrl);
1174
- const resolvedTemplatePath = resolveTemplatePath(templatePath);
1175
- await scaffoldTemplate(resolvedTemplatePath, template);
1176
- return 0;
1177
- }
1178
-
1179
- // src/actions/retest.ts
1180
- function isWorkspace(target) {
1181
- return yarnWorkspaces().some((ws) => ws.name === target);
1182
- }
1183
- var retest = ({ target } = {}) => {
1184
- if (target && isWorkspace(target)) {
1185
- return runSteps(`Re-Test [${target}]`, [
1186
- ["yarn", ["workspace", target, "run", "vitest", "--clearCache"]],
1187
- ["yarn", ["workspace", target, "run", "vitest", "."]]
1188
- ]);
1189
- }
1190
- const path2 = target ?? ".";
1191
- return runSteps("Re-Test", [
1192
- ["yarn", ["vitest", "--clearCache"]],
1193
- ["yarn", ["vitest", path2]]
1194
- ]);
1195
- };
1196
-
1197
- // src/actions/test.ts
1198
- function isWorkspace2(target) {
1199
- return yarnWorkspaces().some((ws) => ws.name === target);
1200
- }
1201
- var test = ({ target } = {}) => {
1202
- if (target && isWorkspace2(target)) {
1203
- return runSteps(`Test [${target}]`, [["yarn", ["workspace", target, "run", "vitest", "."]]]);
1204
- }
1205
- const path2 = target ?? ".";
1206
- return runSteps("Test", [["yarn", ["vitest", path2]]]);
1207
- };
1208
-
1209
16
  // src/actions/upplug.ts
17
+ import { runSteps } from "@xylabs/ts-scripts-common";
1210
18
  var updateYarnPlugins = () => {
1211
19
  return runSteps("Update Yarn Plugins", [
1212
20
  ["yarn", ["plugin", "import", "https://mskelton.dev/yarn-outdated/v3"]],
@@ -1217,11 +25,13 @@ var updateYarnPlugins = () => {
1217
25
  };
1218
26
 
1219
27
  // src/actions/upyarn.ts
28
+ import { runSteps as runSteps2 } from "@xylabs/ts-scripts-common";
1220
29
  var updateYarnVersion = () => {
1221
- return runSteps("Update Yarn Version", [["yarn", ["set", "version", "latest"]]]);
30
+ return runSteps2("Update Yarn Version", [["yarn", ["set", "version", "latest"]]]);
1222
31
  };
1223
32
 
1224
33
  // src/actions/yarn3only.ts
34
+ import { processEx } from "@xylabs/ts-scripts-common";
1225
35
  var yarn3Only = () => {
1226
36
  const [valid, version] = isYarnVersionOrGreater(3);
1227
37
  if (!valid) {
@@ -1230,265 +40,6 @@ var yarn3Only = () => {
1230
40
  return 0;
1231
41
  };
1232
42
 
1233
- // src/xy/common/claude/cleanCommand.ts
1234
- var cleanCommand = {
1235
- command: "clean",
1236
- describe: "Remove all Claude configuration files from the repo",
1237
- handler: (argv) => {
1238
- if (argv.verbose) console.log("Claude Clean");
1239
- process.exitCode = claudeClean();
1240
- }
1241
- };
1242
-
1243
- // src/xy/common/claude/commandsCommand.ts
1244
- var commandsCommand = {
1245
- command: "commands",
1246
- describe: "Sync XY Labs standard Claude slash commands to .claude/commands/",
1247
- handler: (argv) => {
1248
- if (argv.verbose) console.log("Claude Commands");
1249
- process.exitCode = claudeCommands();
1250
- }
1251
- };
1252
-
1253
- // src/xy/common/claude/initCommand.ts
1254
- var initCommand = {
1255
- builder: (yargs) => {
1256
- return yargs.option("force", {
1257
- alias: "f",
1258
- default: false,
1259
- description: "Overwrite existing CLAUDE.md",
1260
- type: "boolean"
1261
- });
1262
- },
1263
- command: "init",
1264
- describe: "Initialize all Claude configuration (commands, rules, settings)",
1265
- handler: async (argv) => {
1266
- if (argv.verbose) console.log("Claude Init");
1267
- const commandsResult = claudeCommands();
1268
- const rulesResult = claudeRules({ force: argv.force });
1269
- const settingsResult = await claudeSettings();
1270
- process.exitCode = commandsResult || rulesResult || settingsResult;
1271
- }
1272
- };
1273
-
1274
- // src/xy/common/claude/rulesCommand.ts
1275
- var rulesCommand = {
1276
- builder: (yargs) => {
1277
- return yargs.option("force", {
1278
- alias: "f",
1279
- default: false,
1280
- description: "Overwrite existing CLAUDE.md",
1281
- type: "boolean"
1282
- });
1283
- },
1284
- command: "rules",
1285
- describe: "Sync XY Labs standard Claude rules to .claude/rules/",
1286
- handler: (argv) => {
1287
- if (argv.verbose) console.log("Claude Rules");
1288
- process.exitCode = claudeRules({ force: argv.force });
1289
- }
1290
- };
1291
-
1292
- // src/xy/common/claude/settingsCommand.ts
1293
- var settingsCommand = {
1294
- command: "settings",
1295
- describe: "Initialize .claude/settings.local.json with XY Labs defaults",
1296
- handler: async (argv) => {
1297
- if (argv.verbose) console.log("Claude Settings");
1298
- process.exitCode = await claudeSettings();
1299
- }
1300
- };
1301
-
1302
- // src/xy/common/claude/skillsCommand.ts
1303
- var skillsCommand = {
1304
- builder: (yargs) => yargs,
1305
- command: "skills",
1306
- describe: "Sync XY Labs standard Claude skills to .claude/skills/",
1307
- handler: (argv) => {
1308
- if (argv.verbose) console.log("Claude Skills");
1309
- process.exitCode = claudeSkills();
1310
- }
1311
- };
1312
-
1313
- // src/xy/common/claude/index.ts
1314
- var claudeCommand = {
1315
- builder: (yargs) => {
1316
- return yargs.command(cleanCommand).command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).command(skillsCommand).demandCommand(1, "Please specify a claude subcommand");
1317
- },
1318
- command: "claude",
1319
- describe: "Claude - Claude Code configuration utilities",
1320
- handler: () => {
1321
- }
1322
- };
1323
-
1324
- // src/xy/common/cleanDocsCommand.ts
1325
- var cleanDocsCommand = {
1326
- command: "clean-docs",
1327
- describe: "CleanDocs - Clean TypeDocs",
1328
- handler: (argv) => {
1329
- if (argv.verbose) console.log("Cleaning TypeDocs: all");
1330
- process.exitCode = cleanDocs();
1331
- }
1332
- };
1333
-
1334
- // src/xy/param.ts
1335
- var packagePositionalParam = (yargs) => {
1336
- return yargs.positional("package", { describe: "Specific package to target", type: "string" });
1337
- };
1338
-
1339
- // src/xy/common/deadCommand.ts
1340
- var deadCommand = {
1341
- builder: (yargs) => {
1342
- return packagePositionalParam(yargs);
1343
- },
1344
- command: "dead [package]",
1345
- describe: "Dead - Check for dead code",
1346
- handler: (argv) => {
1347
- if (argv.verbose) console.log("Dead");
1348
- process.exitCode = dead();
1349
- }
1350
- };
1351
-
1352
- // src/xy/common/genDocsCommand.ts
1353
- var genDocsCommand = {
1354
- builder: (yargs) => {
1355
- return packagePositionalParam(yargs);
1356
- },
1357
- command: "gen-docs [package]",
1358
- describe: "GenDocs - Generate TypeDocs",
1359
- handler: (argv) => {
1360
- if (argv.verbose) console.log(`Generating TypeDocs: ${argv.package ?? "all"}`);
1361
- process.exitCode = genDocs({ incremental: !!argv.incremental, pkg: argv.package });
1362
- }
1363
- };
1364
-
1365
- // src/xy/common/gitignoreCommand.ts
1366
- var gitignoreCommand = {
1367
- command: "gitignore",
1368
- describe: "GitIgnore - Generate root .gitignore and remove package .gitignore files",
1369
- handler: (argv) => {
1370
- if (argv.verbose) console.log("GitIgnore");
1371
- process.exitCode = gitignore();
1372
- }
1373
- };
1374
-
1375
- // src/xy/common/gitlintCommand.ts
1376
- var gitlintCommand = {
1377
- command: "gitlint [package]",
1378
- describe: "Gitlint - Lint your git config",
1379
- handler: (argv) => {
1380
- if (argv.verbose) console.log("Gitlint");
1381
- process.exitCode = argv.fix ? gitlintFix() : gitlint();
1382
- }
1383
- };
1384
-
1385
- // src/xy/common/licenseCommand.ts
1386
- var licenseCommand = {
1387
- builder: (yargs) => {
1388
- return packagePositionalParam(yargs);
1389
- },
1390
- command: "license [package]",
1391
- describe: "License - Check licenses of dependencies",
1392
- handler: async (argv) => {
1393
- if (argv.verbose) console.log(`License: ${argv.package ?? "all"}`);
1394
- process.exitCode = await license();
1395
- }
1396
- };
1397
-
1398
- // src/xy/common/npmignoreGenCommand.ts
1399
- var npmignoreGenCommand = {
1400
- command: "npmignore-gen",
1401
- describe: "NpmIgnore Gen - Generate .npmignore files",
1402
- handler: (argv) => {
1403
- if (argv.verbose) console.log("NpmIgnore Gen");
1404
- process.exitCode = npmignoreGen();
1405
- }
1406
- };
1407
-
1408
- // src/xy/common/readme/genCommand.ts
1409
- var genCommand = {
1410
- builder: (yargs) => {
1411
- return packagePositionalParam(yargs).option("template", {
1412
- alias: "t",
1413
- description: "Path to README.template.md",
1414
- type: "string"
1415
- }).option("typedoc", {
1416
- default: false,
1417
- description: "Generate TypeDoc reference sections",
1418
- type: "boolean"
1419
- });
1420
- },
1421
- aliases: ["$0"],
1422
- command: "gen [package]",
1423
- describe: "Generate README.md files from template",
1424
- handler: async (argv) => {
1425
- if (argv.verbose) console.log("Readme Gen");
1426
- process.exitCode = await readmeGen({
1427
- pkg: argv.package,
1428
- templatePath: argv.template,
1429
- typedoc: argv.typedoc,
1430
- verbose: !!argv.verbose
1431
- });
1432
- }
1433
- };
1434
-
1435
- // src/xy/common/readme/initCommand.ts
1436
- var initCommand2 = {
1437
- builder: (yargs) => {
1438
- return yargs.option("template", {
1439
- alias: "t",
1440
- description: "Path to README.template.md",
1441
- type: "string"
1442
- });
1443
- },
1444
- command: "init",
1445
- describe: "Initialize README template and logo files",
1446
- handler: async (argv) => {
1447
- if (argv.verbose) console.log("Readme Init");
1448
- process.exitCode = await readmeInit({
1449
- templatePath: argv.template,
1450
- verbose: !!argv.verbose
1451
- });
1452
- }
1453
- };
1454
-
1455
- // src/xy/common/readme/index.ts
1456
- var readmeCommand = {
1457
- builder: (yargs) => {
1458
- return yargs.command(genCommand).command(initCommand2);
1459
- },
1460
- command: "readme",
1461
- describe: "Readme - README file utilities",
1462
- handler: () => {
1463
- }
1464
- };
1465
-
1466
- // src/xy/common/retestCommand.ts
1467
- var retestCommand = {
1468
- command: "retest [target]",
1469
- describe: "Re-Test - Run Vitest Tests with cleaned cache",
1470
- builder: (yargs) => {
1471
- return yargs.positional("target", { describe: "Package name or file/folder path to test" });
1472
- },
1473
- handler: (argv) => {
1474
- if (argv.verbose) console.log(`Re-Testing: ${argv.target ?? "all"}`);
1475
- process.exitCode = retest({ target: argv.target });
1476
- }
1477
- };
1478
-
1479
- // src/xy/common/testCommand.ts
1480
- var testCommand = {
1481
- command: "test [target]",
1482
- describe: "Test - Run Vitest Tests",
1483
- builder: (yargs) => {
1484
- return yargs.positional("target", { describe: "Package name or file/folder path to test" });
1485
- },
1486
- handler: (argv) => {
1487
- if (argv.verbose) console.log(`Testing: ${argv.target ?? "all"}`);
1488
- process.exitCode = test({ target: argv.target });
1489
- }
1490
- };
1491
-
1492
43
  // src/xy/common/upplugCommand.ts
1493
44
  var upplugCommand = {
1494
45
  command: "upplug",
@@ -1518,12 +69,9 @@ var yarn3OnlyCommand = {
1518
69
  process.exitCode = yarn3Only();
1519
70
  }
1520
71
  };
1521
-
1522
- // src/xy/common/index.ts
1523
- var xyCommonCommands = (args) => {
1524
- return args.command(claudeCommand).command(licenseCommand).command(deadCommand).command(genDocsCommand).command(cleanDocsCommand).command(gitlintCommand).command(gitignoreCommand).command(npmignoreGenCommand).command(readmeCommand).command(retestCommand).command(testCommand).command(upplugCommand).command(upyarnCommand).command(yarn3OnlyCommand);
1525
- };
1526
72
  export {
1527
- xyCommonCommands
73
+ upplugCommand,
74
+ upyarnCommand,
75
+ yarn3OnlyCommand
1528
76
  };
1529
77
  //# sourceMappingURL=index.mjs.map