pull-request-split-advisor 3.1.2

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 (375) hide show
  1. package/LICENSE +52 -0
  2. package/README.md +168 -0
  3. package/dist/ai/config-wizard.js +282 -0
  4. package/dist/ai/enricher.js +290 -0
  5. package/dist/ai/prompts.js +231 -0
  6. package/dist/ai/provider.js +265 -0
  7. package/dist/cli.js +442 -0
  8. package/dist/config/config.js +315 -0
  9. package/dist/config/default-config.js +223 -0
  10. package/dist/core/blocks.js +145 -0
  11. package/dist/core/commit-planner.js +273 -0
  12. package/dist/core/dependency.js +284 -0
  13. package/dist/core/file-stats.js +341 -0
  14. package/dist/core/history.js +72 -0
  15. package/dist/core/planner.js +25 -0
  16. package/dist/core/scoring.js +166 -0
  17. package/dist/core/strategy.js +486 -0
  18. package/dist/git/branch-naming.js +120 -0
  19. package/dist/git/executor.js +378 -0
  20. package/dist/git/git.js +239 -0
  21. package/dist/output/report-styles.generated.js +10 -0
  22. package/dist/output/report.js +726 -0
  23. package/dist/output/ui.js +417 -0
  24. package/dist/shared/constants.js +59 -0
  25. package/dist/shared/types.js +7 -0
  26. package/dist/shared/utils.js +73 -0
  27. package/node_modules/@colors/colors/LICENSE +26 -0
  28. package/node_modules/@colors/colors/README.md +219 -0
  29. package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
  30. package/node_modules/@colors/colors/examples/safe-string.js +80 -0
  31. package/node_modules/@colors/colors/index.d.ts +136 -0
  32. package/node_modules/@colors/colors/lib/colors.js +211 -0
  33. package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
  34. package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
  35. package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
  36. package/node_modules/@colors/colors/lib/index.js +13 -0
  37. package/node_modules/@colors/colors/lib/maps/america.js +10 -0
  38. package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
  39. package/node_modules/@colors/colors/lib/maps/random.js +11 -0
  40. package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
  41. package/node_modules/@colors/colors/lib/styles.js +95 -0
  42. package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
  43. package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
  44. package/node_modules/@colors/colors/package.json +45 -0
  45. package/node_modules/@colors/colors/safe.d.ts +48 -0
  46. package/node_modules/@colors/colors/safe.js +10 -0
  47. package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
  48. package/node_modules/ansi-align/LICENSE +13 -0
  49. package/node_modules/ansi-align/README.md +80 -0
  50. package/node_modules/ansi-align/index.js +61 -0
  51. package/node_modules/ansi-align/node_modules/ansi-regex/index.d.ts +37 -0
  52. package/node_modules/ansi-align/node_modules/ansi-regex/index.js +10 -0
  53. package/node_modules/ansi-align/node_modules/ansi-regex/license +9 -0
  54. package/node_modules/ansi-align/node_modules/ansi-regex/package.json +55 -0
  55. package/node_modules/ansi-align/node_modules/ansi-regex/readme.md +78 -0
  56. package/node_modules/ansi-align/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  57. package/node_modules/ansi-align/node_modules/emoji-regex/README.md +73 -0
  58. package/node_modules/ansi-align/node_modules/emoji-regex/es2015/index.js +6 -0
  59. package/node_modules/ansi-align/node_modules/emoji-regex/es2015/text.js +6 -0
  60. package/node_modules/ansi-align/node_modules/emoji-regex/index.d.ts +23 -0
  61. package/node_modules/ansi-align/node_modules/emoji-regex/index.js +6 -0
  62. package/node_modules/ansi-align/node_modules/emoji-regex/package.json +50 -0
  63. package/node_modules/ansi-align/node_modules/emoji-regex/text.js +6 -0
  64. package/node_modules/ansi-align/node_modules/string-width/index.d.ts +29 -0
  65. package/node_modules/ansi-align/node_modules/string-width/index.js +47 -0
  66. package/node_modules/ansi-align/node_modules/string-width/license +9 -0
  67. package/node_modules/ansi-align/node_modules/string-width/package.json +56 -0
  68. package/node_modules/ansi-align/node_modules/string-width/readme.md +50 -0
  69. package/node_modules/ansi-align/node_modules/strip-ansi/index.d.ts +17 -0
  70. package/node_modules/ansi-align/node_modules/strip-ansi/index.js +4 -0
  71. package/node_modules/ansi-align/node_modules/strip-ansi/license +9 -0
  72. package/node_modules/ansi-align/node_modules/strip-ansi/package.json +54 -0
  73. package/node_modules/ansi-align/node_modules/strip-ansi/readme.md +46 -0
  74. package/node_modules/ansi-align/package.json +43 -0
  75. package/node_modules/ansi-regex/index.d.ts +33 -0
  76. package/node_modules/ansi-regex/index.js +14 -0
  77. package/node_modules/ansi-regex/license +9 -0
  78. package/node_modules/ansi-regex/package.json +61 -0
  79. package/node_modules/ansi-regex/readme.md +66 -0
  80. package/node_modules/ansi-styles/index.d.ts +236 -0
  81. package/node_modules/ansi-styles/index.js +223 -0
  82. package/node_modules/ansi-styles/license +9 -0
  83. package/node_modules/ansi-styles/package.json +54 -0
  84. package/node_modules/ansi-styles/readme.md +173 -0
  85. package/node_modules/boxen/index.d.ts +267 -0
  86. package/node_modules/boxen/index.js +376 -0
  87. package/node_modules/boxen/license +9 -0
  88. package/node_modules/boxen/package.json +69 -0
  89. package/node_modules/boxen/readme.md +300 -0
  90. package/node_modules/camelcase/index.d.ts +102 -0
  91. package/node_modules/camelcase/index.js +110 -0
  92. package/node_modules/camelcase/license +9 -0
  93. package/node_modules/camelcase/package.json +47 -0
  94. package/node_modules/camelcase/readme.md +135 -0
  95. package/node_modules/chalk/license +9 -0
  96. package/node_modules/chalk/package.json +83 -0
  97. package/node_modules/chalk/readme.md +297 -0
  98. package/node_modules/chalk/source/index.d.ts +325 -0
  99. package/node_modules/chalk/source/index.js +225 -0
  100. package/node_modules/chalk/source/utilities.js +33 -0
  101. package/node_modules/chalk/source/vendor/ansi-styles/index.d.ts +236 -0
  102. package/node_modules/chalk/source/vendor/ansi-styles/index.js +223 -0
  103. package/node_modules/chalk/source/vendor/supports-color/browser.d.ts +1 -0
  104. package/node_modules/chalk/source/vendor/supports-color/browser.js +34 -0
  105. package/node_modules/chalk/source/vendor/supports-color/index.d.ts +55 -0
  106. package/node_modules/chalk/source/vendor/supports-color/index.js +190 -0
  107. package/node_modules/cli-boxes/boxes.json +82 -0
  108. package/node_modules/cli-boxes/index.d.ts +127 -0
  109. package/node_modules/cli-boxes/index.js +6 -0
  110. package/node_modules/cli-boxes/license +9 -0
  111. package/node_modules/cli-boxes/package.json +42 -0
  112. package/node_modules/cli-boxes/readme.md +115 -0
  113. package/node_modules/cli-table3/LICENSE +21 -0
  114. package/node_modules/cli-table3/README.md +236 -0
  115. package/node_modules/cli-table3/index.d.ts +96 -0
  116. package/node_modules/cli-table3/index.js +1 -0
  117. package/node_modules/cli-table3/node_modules/ansi-regex/index.d.ts +37 -0
  118. package/node_modules/cli-table3/node_modules/ansi-regex/index.js +10 -0
  119. package/node_modules/cli-table3/node_modules/ansi-regex/license +9 -0
  120. package/node_modules/cli-table3/node_modules/ansi-regex/package.json +55 -0
  121. package/node_modules/cli-table3/node_modules/ansi-regex/readme.md +78 -0
  122. package/node_modules/cli-table3/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  123. package/node_modules/cli-table3/node_modules/emoji-regex/README.md +73 -0
  124. package/node_modules/cli-table3/node_modules/emoji-regex/es2015/index.js +6 -0
  125. package/node_modules/cli-table3/node_modules/emoji-regex/es2015/text.js +6 -0
  126. package/node_modules/cli-table3/node_modules/emoji-regex/index.d.ts +23 -0
  127. package/node_modules/cli-table3/node_modules/emoji-regex/index.js +6 -0
  128. package/node_modules/cli-table3/node_modules/emoji-regex/package.json +50 -0
  129. package/node_modules/cli-table3/node_modules/emoji-regex/text.js +6 -0
  130. package/node_modules/cli-table3/node_modules/string-width/index.d.ts +29 -0
  131. package/node_modules/cli-table3/node_modules/string-width/index.js +47 -0
  132. package/node_modules/cli-table3/node_modules/string-width/license +9 -0
  133. package/node_modules/cli-table3/node_modules/string-width/package.json +56 -0
  134. package/node_modules/cli-table3/node_modules/string-width/readme.md +50 -0
  135. package/node_modules/cli-table3/node_modules/strip-ansi/index.d.ts +17 -0
  136. package/node_modules/cli-table3/node_modules/strip-ansi/index.js +4 -0
  137. package/node_modules/cli-table3/node_modules/strip-ansi/license +9 -0
  138. package/node_modules/cli-table3/node_modules/strip-ansi/package.json +54 -0
  139. package/node_modules/cli-table3/node_modules/strip-ansi/readme.md +46 -0
  140. package/node_modules/cli-table3/package.json +100 -0
  141. package/node_modules/cli-table3/src/cell.js +409 -0
  142. package/node_modules/cli-table3/src/debug.js +28 -0
  143. package/node_modules/cli-table3/src/layout-manager.js +254 -0
  144. package/node_modules/cli-table3/src/table.js +106 -0
  145. package/node_modules/cli-table3/src/utils.js +344 -0
  146. package/node_modules/commander/LICENSE +22 -0
  147. package/node_modules/commander/Readme.md +1157 -0
  148. package/node_modules/commander/esm.mjs +16 -0
  149. package/node_modules/commander/index.js +24 -0
  150. package/node_modules/commander/lib/argument.js +149 -0
  151. package/node_modules/commander/lib/command.js +2509 -0
  152. package/node_modules/commander/lib/error.js +39 -0
  153. package/node_modules/commander/lib/help.js +520 -0
  154. package/node_modules/commander/lib/option.js +330 -0
  155. package/node_modules/commander/lib/suggestSimilar.js +101 -0
  156. package/node_modules/commander/package-support.json +16 -0
  157. package/node_modules/commander/package.json +84 -0
  158. package/node_modules/commander/typings/esm.d.mts +3 -0
  159. package/node_modules/commander/typings/index.d.ts +969 -0
  160. package/node_modules/emoji-regex/LICENSE-MIT.txt +20 -0
  161. package/node_modules/emoji-regex/README.md +107 -0
  162. package/node_modules/emoji-regex/index.d.ts +3 -0
  163. package/node_modules/emoji-regex/index.js +4 -0
  164. package/node_modules/emoji-regex/index.mjs +4 -0
  165. package/node_modules/emoji-regex/package.json +45 -0
  166. package/node_modules/get-east-asian-width/index.d.ts +60 -0
  167. package/node_modules/get-east-asian-width/index.js +30 -0
  168. package/node_modules/get-east-asian-width/license +9 -0
  169. package/node_modules/get-east-asian-width/lookup-data.js +18 -0
  170. package/node_modules/get-east-asian-width/lookup.js +135 -0
  171. package/node_modules/get-east-asian-width/package.json +71 -0
  172. package/node_modules/get-east-asian-width/readme.md +65 -0
  173. package/node_modules/get-east-asian-width/utilities.js +24 -0
  174. package/node_modules/is-fullwidth-code-point/index.d.ts +17 -0
  175. package/node_modules/is-fullwidth-code-point/index.js +50 -0
  176. package/node_modules/is-fullwidth-code-point/license +9 -0
  177. package/node_modules/is-fullwidth-code-point/package.json +42 -0
  178. package/node_modules/is-fullwidth-code-point/readme.md +39 -0
  179. package/node_modules/isbinaryfile/LICENSE.txt +22 -0
  180. package/node_modules/isbinaryfile/README.md +70 -0
  181. package/node_modules/isbinaryfile/lib/index.d.ts +3 -0
  182. package/node_modules/isbinaryfile/lib/index.js +256 -0
  183. package/node_modules/isbinaryfile/package.json +64 -0
  184. package/node_modules/string-width/index.d.ts +39 -0
  185. package/node_modules/string-width/index.js +82 -0
  186. package/node_modules/string-width/license +9 -0
  187. package/node_modules/string-width/package.json +64 -0
  188. package/node_modules/string-width/readme.md +66 -0
  189. package/node_modules/strip-ansi/index.d.ts +15 -0
  190. package/node_modules/strip-ansi/index.js +19 -0
  191. package/node_modules/strip-ansi/license +9 -0
  192. package/node_modules/strip-ansi/package.json +59 -0
  193. package/node_modules/strip-ansi/readme.md +37 -0
  194. package/node_modules/type-fest/index.d.ts +178 -0
  195. package/node_modules/type-fest/license-cc0 +121 -0
  196. package/node_modules/type-fest/license-mit +9 -0
  197. package/node_modules/type-fest/package.json +91 -0
  198. package/node_modules/type-fest/readme.md +1060 -0
  199. package/node_modules/type-fest/source/all-union-fields.d.ts +88 -0
  200. package/node_modules/type-fest/source/and.d.ts +25 -0
  201. package/node_modules/type-fest/source/array-indices.d.ts +23 -0
  202. package/node_modules/type-fest/source/array-slice.d.ts +109 -0
  203. package/node_modules/type-fest/source/array-splice.d.ts +99 -0
  204. package/node_modules/type-fest/source/array-tail.d.ts +76 -0
  205. package/node_modules/type-fest/source/array-values.d.ts +22 -0
  206. package/node_modules/type-fest/source/arrayable.d.ts +29 -0
  207. package/node_modules/type-fest/source/async-return-type.d.ts +23 -0
  208. package/node_modules/type-fest/source/asyncify.d.ts +32 -0
  209. package/node_modules/type-fest/source/basic.d.ts +68 -0
  210. package/node_modules/type-fest/source/camel-case.d.ts +89 -0
  211. package/node_modules/type-fest/source/camel-cased-properties-deep.d.ts +97 -0
  212. package/node_modules/type-fest/source/camel-cased-properties.d.ts +43 -0
  213. package/node_modules/type-fest/source/conditional-except.d.ts +45 -0
  214. package/node_modules/type-fest/source/conditional-keys.d.ts +47 -0
  215. package/node_modules/type-fest/source/conditional-pick-deep.d.ts +118 -0
  216. package/node_modules/type-fest/source/conditional-pick.d.ts +44 -0
  217. package/node_modules/type-fest/source/conditional-simplify.d.ts +32 -0
  218. package/node_modules/type-fest/source/delimiter-case.d.ts +78 -0
  219. package/node_modules/type-fest/source/delimiter-cased-properties-deep.d.ts +106 -0
  220. package/node_modules/type-fest/source/delimiter-cased-properties.d.ts +46 -0
  221. package/node_modules/type-fest/source/distributed-omit.d.ts +89 -0
  222. package/node_modules/type-fest/source/distributed-pick.d.ts +85 -0
  223. package/node_modules/type-fest/source/empty-object.d.ts +46 -0
  224. package/node_modules/type-fest/source/enforce-optional.d.ts +47 -0
  225. package/node_modules/type-fest/source/entries.d.ts +62 -0
  226. package/node_modules/type-fest/source/entry.d.ts +65 -0
  227. package/node_modules/type-fest/source/exact.d.ts +68 -0
  228. package/node_modules/type-fest/source/except.d.ts +108 -0
  229. package/node_modules/type-fest/source/find-global-type.d.ts +64 -0
  230. package/node_modules/type-fest/source/fixed-length-array.d.ts +43 -0
  231. package/node_modules/type-fest/source/get.d.ts +219 -0
  232. package/node_modules/type-fest/source/global-this.d.ts +21 -0
  233. package/node_modules/type-fest/source/greater-than-or-equal.d.ts +22 -0
  234. package/node_modules/type-fest/source/greater-than.d.ts +56 -0
  235. package/node_modules/type-fest/source/has-optional-keys.d.ts +21 -0
  236. package/node_modules/type-fest/source/has-readonly-keys.d.ts +21 -0
  237. package/node_modules/type-fest/source/has-required-keys.d.ts +59 -0
  238. package/node_modules/type-fest/source/has-writable-keys.d.ts +21 -0
  239. package/node_modules/type-fest/source/if-any.d.ts +24 -0
  240. package/node_modules/type-fest/source/if-empty-object.d.ts +26 -0
  241. package/node_modules/type-fest/source/if-never.d.ts +24 -0
  242. package/node_modules/type-fest/source/if-null.d.ts +24 -0
  243. package/node_modules/type-fest/source/if-unknown.d.ts +24 -0
  244. package/node_modules/type-fest/source/includes.d.ts +22 -0
  245. package/node_modules/type-fest/source/int-closed-range.d.ts +35 -0
  246. package/node_modules/type-fest/source/int-range.d.ts +55 -0
  247. package/node_modules/type-fest/source/internal/array.d.ts +126 -0
  248. package/node_modules/type-fest/source/internal/characters.d.ts +67 -0
  249. package/node_modules/type-fest/source/internal/index.d.ts +8 -0
  250. package/node_modules/type-fest/source/internal/keys.d.ts +97 -0
  251. package/node_modules/type-fest/source/internal/numeric.d.ts +118 -0
  252. package/node_modules/type-fest/source/internal/object.d.ts +236 -0
  253. package/node_modules/type-fest/source/internal/string.d.ts +210 -0
  254. package/node_modules/type-fest/source/internal/tuple.d.ts +90 -0
  255. package/node_modules/type-fest/source/internal/type.d.ts +139 -0
  256. package/node_modules/type-fest/source/invariant-of.d.ts +76 -0
  257. package/node_modules/type-fest/source/is-any.d.ts +33 -0
  258. package/node_modules/type-fest/source/is-equal.d.ts +31 -0
  259. package/node_modules/type-fest/source/is-float.d.ts +41 -0
  260. package/node_modules/type-fest/source/is-integer.d.ts +58 -0
  261. package/node_modules/type-fest/source/is-literal.d.ts +296 -0
  262. package/node_modules/type-fest/source/is-never.d.ts +42 -0
  263. package/node_modules/type-fest/source/is-null.d.ts +20 -0
  264. package/node_modules/type-fest/source/is-tuple.d.ts +89 -0
  265. package/node_modules/type-fest/source/is-unknown.d.ts +52 -0
  266. package/node_modules/type-fest/source/iterable-element.d.ts +64 -0
  267. package/node_modules/type-fest/source/join.d.ts +68 -0
  268. package/node_modules/type-fest/source/jsonifiable.d.ts +37 -0
  269. package/node_modules/type-fest/source/jsonify.d.ts +122 -0
  270. package/node_modules/type-fest/source/kebab-case.d.ts +44 -0
  271. package/node_modules/type-fest/source/kebab-cased-properties-deep.d.ts +63 -0
  272. package/node_modules/type-fest/source/kebab-cased-properties.d.ts +40 -0
  273. package/node_modules/type-fest/source/keys-of-union.d.ts +42 -0
  274. package/node_modules/type-fest/source/last-array-element.d.ts +38 -0
  275. package/node_modules/type-fest/source/less-than-or-equal.d.ts +22 -0
  276. package/node_modules/type-fest/source/less-than.d.ts +26 -0
  277. package/node_modules/type-fest/source/literal-to-primitive-deep.d.ts +36 -0
  278. package/node_modules/type-fest/source/literal-to-primitive.d.ts +36 -0
  279. package/node_modules/type-fest/source/literal-union.d.ts +37 -0
  280. package/node_modules/type-fest/source/merge-deep.d.ts +486 -0
  281. package/node_modules/type-fest/source/merge-exclusive.d.ts +41 -0
  282. package/node_modules/type-fest/source/merge.d.ts +48 -0
  283. package/node_modules/type-fest/source/multidimensional-array.d.ts +44 -0
  284. package/node_modules/type-fest/source/multidimensional-readonly-array.d.ts +48 -0
  285. package/node_modules/type-fest/source/non-empty-object.d.ts +35 -0
  286. package/node_modules/type-fest/source/non-empty-string.d.ts +28 -0
  287. package/node_modules/type-fest/source/non-empty-tuple.d.ts +21 -0
  288. package/node_modules/type-fest/source/numeric.d.ts +222 -0
  289. package/node_modules/type-fest/source/observable-like.d.ts +63 -0
  290. package/node_modules/type-fest/source/omit-deep.d.ts +167 -0
  291. package/node_modules/type-fest/source/omit-index-signature.d.ts +95 -0
  292. package/node_modules/type-fest/source/opaque.d.ts +1 -0
  293. package/node_modules/type-fest/source/optional-keys-of.d.ts +39 -0
  294. package/node_modules/type-fest/source/or.d.ts +25 -0
  295. package/node_modules/type-fest/source/override-properties.d.ts +36 -0
  296. package/node_modules/type-fest/source/package-json.d.ts +676 -0
  297. package/node_modules/type-fest/source/partial-deep.d.ts +151 -0
  298. package/node_modules/type-fest/source/partial-on-undefined-deep.d.ts +78 -0
  299. package/node_modules/type-fest/source/pascal-case.d.ts +42 -0
  300. package/node_modules/type-fest/source/pascal-cased-properties-deep.d.ts +62 -0
  301. package/node_modules/type-fest/source/pascal-cased-properties.d.ts +36 -0
  302. package/node_modules/type-fest/source/paths.d.ts +262 -0
  303. package/node_modules/type-fest/source/pick-deep.d.ts +149 -0
  304. package/node_modules/type-fest/source/pick-index-signature.d.ts +50 -0
  305. package/node_modules/type-fest/source/primitive.d.ts +13 -0
  306. package/node_modules/type-fest/source/promisable.d.ts +25 -0
  307. package/node_modules/type-fest/source/readonly-deep.d.ts +81 -0
  308. package/node_modules/type-fest/source/readonly-keys-of.d.ts +30 -0
  309. package/node_modules/type-fest/source/readonly-tuple.d.ts +41 -0
  310. package/node_modules/type-fest/source/replace.d.ts +85 -0
  311. package/node_modules/type-fest/source/require-all-or-none.d.ts +51 -0
  312. package/node_modules/type-fest/source/require-at-least-one.d.ts +47 -0
  313. package/node_modules/type-fest/source/require-exactly-one.d.ts +45 -0
  314. package/node_modules/type-fest/source/require-one-or-none.d.ts +46 -0
  315. package/node_modules/type-fest/source/required-deep.d.ts +78 -0
  316. package/node_modules/type-fest/source/required-keys-of.d.ts +30 -0
  317. package/node_modules/type-fest/source/schema.d.ts +114 -0
  318. package/node_modules/type-fest/source/screaming-snake-case.d.ts +28 -0
  319. package/node_modules/type-fest/source/set-field-type.d.ts +65 -0
  320. package/node_modules/type-fest/source/set-non-nullable-deep.d.ts +83 -0
  321. package/node_modules/type-fest/source/set-non-nullable.d.ts +39 -0
  322. package/node_modules/type-fest/source/set-optional.d.ts +38 -0
  323. package/node_modules/type-fest/source/set-parameter-type.d.ts +117 -0
  324. package/node_modules/type-fest/source/set-readonly.d.ts +39 -0
  325. package/node_modules/type-fest/source/set-required-deep.d.ts +68 -0
  326. package/node_modules/type-fest/source/set-required.d.ts +70 -0
  327. package/node_modules/type-fest/source/set-return-type.d.ts +29 -0
  328. package/node_modules/type-fest/source/shared-union-fields-deep.d.ts +178 -0
  329. package/node_modules/type-fest/source/shared-union-fields.d.ts +76 -0
  330. package/node_modules/type-fest/source/simplify-deep.d.ts +115 -0
  331. package/node_modules/type-fest/source/simplify.d.ts +58 -0
  332. package/node_modules/type-fest/source/single-key-object.d.ts +29 -0
  333. package/node_modules/type-fest/source/snake-case.d.ts +45 -0
  334. package/node_modules/type-fest/source/snake-cased-properties-deep.d.ts +63 -0
  335. package/node_modules/type-fest/source/snake-cased-properties.d.ts +40 -0
  336. package/node_modules/type-fest/source/split.d.ts +88 -0
  337. package/node_modules/type-fest/source/spread.d.ts +84 -0
  338. package/node_modules/type-fest/source/string-key-of.d.ts +25 -0
  339. package/node_modules/type-fest/source/string-repeat.d.ts +47 -0
  340. package/node_modules/type-fest/source/string-slice.d.ts +37 -0
  341. package/node_modules/type-fest/source/stringified.d.ts +23 -0
  342. package/node_modules/type-fest/source/structured-cloneable.d.ts +92 -0
  343. package/node_modules/type-fest/source/subtract.d.ts +83 -0
  344. package/node_modules/type-fest/source/sum.d.ts +78 -0
  345. package/node_modules/type-fest/source/tagged-union.d.ts +51 -0
  346. package/node_modules/type-fest/source/tagged.d.ts +256 -0
  347. package/node_modules/type-fest/source/trim.d.ts +27 -0
  348. package/node_modules/type-fest/source/tsconfig-json.d.ts +1294 -0
  349. package/node_modules/type-fest/source/tuple-to-object.d.ts +42 -0
  350. package/node_modules/type-fest/source/tuple-to-union.d.ts +51 -0
  351. package/node_modules/type-fest/source/typed-array.d.ts +17 -0
  352. package/node_modules/type-fest/source/undefined-on-partial-deep.d.ts +80 -0
  353. package/node_modules/type-fest/source/union-to-intersection.d.ts +61 -0
  354. package/node_modules/type-fest/source/union-to-tuple.d.ts +56 -0
  355. package/node_modules/type-fest/source/unknown-array.d.ts +25 -0
  356. package/node_modules/type-fest/source/unknown-map.d.ts +24 -0
  357. package/node_modules/type-fest/source/unknown-record.d.ts +31 -0
  358. package/node_modules/type-fest/source/unknown-set.d.ts +24 -0
  359. package/node_modules/type-fest/source/value-of.d.ts +42 -0
  360. package/node_modules/type-fest/source/words.d.ts +118 -0
  361. package/node_modules/type-fest/source/writable-deep.d.ts +83 -0
  362. package/node_modules/type-fest/source/writable-keys-of.d.ts +33 -0
  363. package/node_modules/type-fest/source/writable.d.ts +68 -0
  364. package/node_modules/widest-line/index.d.ts +12 -0
  365. package/node_modules/widest-line/index.js +11 -0
  366. package/node_modules/widest-line/license +9 -0
  367. package/node_modules/widest-line/package.json +60 -0
  368. package/node_modules/widest-line/readme.md +26 -0
  369. package/node_modules/wrap-ansi/index.d.ts +41 -0
  370. package/node_modules/wrap-ansi/index.js +222 -0
  371. package/node_modules/wrap-ansi/license +9 -0
  372. package/node_modules/wrap-ansi/package.json +69 -0
  373. package/node_modules/wrap-ansi/readme.md +75 -0
  374. package/package.json +78 -0
  375. package/scripts/postinstall.cjs +122 -0
@@ -0,0 +1,417 @@
1
+ /**
2
+ * ui.ts — Capa de presentación en terminal.
3
+ *
4
+ * Exporta un objeto singleton `ui` con todos los métodos de salida al terminal.
5
+ * Centralizar la UI en un solo objeto tiene las siguientes ventajas:
6
+ * - Un único punto de configuración (colores, anchos, estilos).
7
+ * - Fácil de mockear en tests (sustituir `ui` completo).
8
+ * - Semántica clara: `ui.ok()` vs `ui.warn()` vs `ui.error()` expresan intención.
9
+ *
10
+ * ### Dependencias externas
11
+ * - **chalk** — colores y estilos ANSI en terminal
12
+ * - **cli-table3** — tablas con alineación y word-wrap
13
+ * - **boxen** — cajas con bordes redondeados para cards y headers
14
+ *
15
+ * ### Readline singleton
16
+ * El módulo mantiene una única instancia de `readline.Interface` compartida
17
+ * entre `confirm` y `prompt`. Reutilizar una instancia evita listeners colgados
18
+ * y saltos de línea inesperados al alternar preguntas en modo interactivo. La
19
+ * instancia se cierra explícitamente con `closeReadlineInterface()` al finalizar.
20
+ *
21
+ * ### Modo no interactivo
22
+ * Esta capa solo escribe a stdout/stderr; no toma decisiones de lógica de negocio.
23
+ */
24
+ import chalk from "chalk";
25
+ import Table from "cli-table3";
26
+ import boxen from "boxen";
27
+ import readline from "node:readline";
28
+ import { stdin as input, stdout as output } from "node:process";
29
+ // ---------------------------------------------------------------------------
30
+ // Singleton de readline
31
+ // ---------------------------------------------------------------------------
32
+ /**
33
+ * Instancia compartida de readline.Interface.
34
+ * Reutilizar una sola instancia evita el riesgo de crear y cerrar múltiples
35
+ * interfaces en modo interactivo (un close/open por cada confirm/prompt),
36
+ * lo que puede dejar listeners colgados en stdin o saltos de línea inesperados.
37
+ */
38
+ let _readline = null;
39
+ function getReadlineInterface() {
40
+ if (!_readline) {
41
+ _readline = readline.createInterface({ input, output });
42
+ _readline.setMaxListeners(50);
43
+ }
44
+ return _readline;
45
+ }
46
+ /** Cierra la interfaz readline global. Llamar al terminar la sesión interactiva. */
47
+ export function closeReadlineInterface() {
48
+ _readline?.close();
49
+ _readline = null;
50
+ }
51
+ // Garantizar que el handle de readline se cierra si el proceso termina abruptamente
52
+ // (Ctrl+C, SIGHUP, etc.) para evitar fugas de recursos.
53
+ process.once("exit", closeReadlineInterface);
54
+ process.once("SIGINT", () => { closeReadlineInterface(); process.exit(130); });
55
+ process.once("SIGHUP", () => { closeReadlineInterface(); process.exit(129); });
56
+ /**
57
+ * Spinner minimal de texto para indicar operaciones en curso.
58
+ *
59
+ * No usa códigos de reemplazo de cursor (ANSI \r) para mantener compatibilidad
60
+ * con terminales de CI/CD que registran cada línea como un log separado.
61
+ * Cada llamada simplemente escribe una nueva línea.
62
+ */
63
+ class Spinner {
64
+ active = false;
65
+ start(text) {
66
+ this.active = true;
67
+ process.stdout.write(chalk.cyanBright(`⏳ ${text}`) + "\n");
68
+ }
69
+ stop(text) {
70
+ if (!this.active)
71
+ return;
72
+ if (text) {
73
+ process.stdout.write(chalk.greenBright(`✔ ${text}`) + "\n");
74
+ }
75
+ this.active = false;
76
+ }
77
+ fail(text) {
78
+ process.stdout.write(chalk.redBright(`✖ ${text}`) + "\n");
79
+ this.active = false;
80
+ }
81
+ }
82
+ /**
83
+ * Aplica el color `tone` a una cadena usando chalk.
84
+ * Función utilitaria interna usada por `badge`, `score`, `dashboard` y otros.
85
+ */
86
+ function colorize(value, tone) {
87
+ switch (tone) {
88
+ case "blue":
89
+ return chalk.blueBright(value);
90
+ case "green":
91
+ return chalk.greenBright(value);
92
+ case "yellow":
93
+ return chalk.yellowBright(value);
94
+ case "red":
95
+ return chalk.redBright(value);
96
+ case "cyan":
97
+ return chalk.cyanBright(value);
98
+ case "magenta":
99
+ return chalk.magentaBright(value);
100
+ case "white":
101
+ default:
102
+ return chalk.whiteBright(value);
103
+ }
104
+ }
105
+ /** Rellena `value` con espacios a la derecha hasta alcanzar `size` caracteres. Usado para alinear columnas clave-valor. */
106
+ function padRight(value, size) {
107
+ if (value.length >= size)
108
+ return value;
109
+ return value + " ".repeat(size - value.length);
110
+ }
111
+ /**
112
+ * Trunca una cadena en el centro si supera `max` caracteres, insertando `...`.
113
+ * Preferible a truncar por la derecha para rutas de archivo: preserva tanto el
114
+ * inicio (directorio) como el final (nombre y extensión).
115
+ *
116
+ * @param value - Cadena a truncar.
117
+ * @param max - Longitud máxima. Por defecto: 48.
118
+ */
119
+ function truncateMiddle(value, max = 48) {
120
+ if (value.length <= max)
121
+ return value;
122
+ const left = Math.ceil((max - 3) / 2);
123
+ const right = Math.floor((max - 3) / 2);
124
+ return `${value.slice(0, left)}...${value.slice(value.length - right)}`;
125
+ }
126
+ /**
127
+ * Genera una etiqueta tipo «pastilla» con fondo de color para el terminal.
128
+ *
129
+ * @param label - Texto a mostrar dentro de la pastilla (se convierte a mayúsculas).
130
+ * @param tone - Color del fondo. Por defecto: `"blue"`.
131
+ */
132
+ function badge(label, tone = "blue") {
133
+ const content = ` ${label.toUpperCase()} `;
134
+ switch (tone) {
135
+ case "green":
136
+ return chalk.black.bgGreenBright(content);
137
+ case "yellow":
138
+ return chalk.black.bgYellowBright(content);
139
+ case "red":
140
+ return chalk.white.bgRedBright(content);
141
+ case "cyan":
142
+ return chalk.black.bgCyanBright(content);
143
+ case "magenta":
144
+ return chalk.white.bgMagentaBright(content);
145
+ case "white":
146
+ return chalk.black.bgWhiteBright(content);
147
+ case "blue":
148
+ default:
149
+ return chalk.white.bgBlueBright(content);
150
+ }
151
+ }
152
+ /**
153
+ * Determina el tono de color a usar para un score numérico.
154
+ *
155
+ * @param score - Score a evaluar (0–5).
156
+ * @param targetScore - Score objetivo de la configuración activa. Si se omite, se
157
+ * usa 4.0 como umbral verde (valor por defecto de `targetScore`).
158
+ *
159
+ * - Verde : score ≥ targetScore
160
+ * - Amarillo: score ≥ warnThreshold (targetScore > 4 → 4.0; else max(0, targetScore − 1))
161
+ * - Rojo : score < warnThreshold
162
+ */
163
+ function scoreColor(score, targetScore = 4.0) {
164
+ if (score >= targetScore)
165
+ return "green";
166
+ const warnThreshold = targetScore > 4 ? 4 : Math.max(0, targetScore - 1);
167
+ if (score >= warnThreshold)
168
+ return "yellow";
169
+ return "red";
170
+ }
171
+ /**
172
+ * Formatea un score numérico con su color semántico y 2 decimales.
173
+ *
174
+ * @param value - Score a formatear (0–5).
175
+ * @param targetScore - Score objetivo para determinar el color verde. Por defecto: 4.0.
176
+ * Pasar `config.targetScore` para consistencia con el reporte HTML.
177
+ */
178
+ function score(value, targetScore = 4.0) {
179
+ const fixed = value.toFixed(2);
180
+ return colorize(fixed, scoreColor(value, targetScore));
181
+ }
182
+ /**
183
+ * Imprime una cabecera de sección delimitada por líneas del `marker` repetido.
184
+ * Usado para separar visualmente las grandes secciones del reporte en terminal.
185
+ *
186
+ * @param title - Título de la sección.
187
+ * @param marker - Carácter usado para dibujar la línea. Por defecto: `"="`.
188
+ */
189
+ function section(title, marker = "=") {
190
+ const line = marker.repeat(Math.max(18, title.length + 6));
191
+ process.stdout.write("\n");
192
+ process.stdout.write(chalk.cyanBright(line) + "\n");
193
+ process.stdout.write(chalk.bold.whiteBright(` ${title}`) + "\n");
194
+ process.stdout.write(chalk.cyanBright(line) + "\n");
195
+ }
196
+ /** Imprime una subseción con símbolo `•` para jerarquías dentro de una sección. */
197
+ function subsection(title) {
198
+ process.stdout.write("\n");
199
+ process.stdout.write(chalk.bold.cyan(`• ${title}`) + "\n");
200
+ }
201
+ /**
202
+ * Imprime la cabecera principal del análisis en un box redondeado.
203
+ *
204
+ * @param title - Título principal.
205
+ * @param subtitle - Subtítulo opcional.
206
+ * @param meta - Pares [clave, valor] mostrados como tabla de metadatos.
207
+ */
208
+ function header(title, subtitle, meta) {
209
+ const lines = [];
210
+ lines.push(chalk.bold.whiteBright(title));
211
+ if (subtitle) {
212
+ lines.push(chalk.cyanBright(subtitle));
213
+ }
214
+ if (meta?.length) {
215
+ lines.push("");
216
+ for (const [key, value] of meta) {
217
+ lines.push(`${chalk.gray(`${key}:`)} ${chalk.whiteBright(String(value))}`);
218
+ }
219
+ }
220
+ process.stdout.write(boxen(lines.join("\n"), {
221
+ padding: 1,
222
+ borderStyle: "round",
223
+ borderColor: "cyan",
224
+ width: 90
225
+ }) + "\n");
226
+ }
227
+ /** Imprime un mensaje informativo con prefijo ℹ en color cyan. */
228
+ function info(message) {
229
+ process.stdout.write(chalk.cyanBright(`ℹ ${message}`) + "\n");
230
+ }
231
+ /** Imprime un mensaje de éxito con prefijo ✔ en color verde. */
232
+ function ok(message) {
233
+ process.stdout.write(chalk.greenBright(`✔ ${message}`) + "\n");
234
+ }
235
+ /** Imprime una advertencia con prefijo ⚠ en color amarillo. */
236
+ function warn(message) {
237
+ process.stdout.write(chalk.yellowBright(`⚠ ${message}`) + "\n");
238
+ }
239
+ /** Imprime un error con prefijo ✖ por **stderr** en color rojo. */
240
+ function error(message) {
241
+ process.stderr.write(chalk.redBright(`✖ ${message}`) + "\n");
242
+ }
243
+ /** Imprime texto secundario en gris (comentarios, rutas largas, detalles no críticos). */
244
+ function muted(message) {
245
+ process.stdout.write(chalk.gray(message) + "\n");
246
+ }
247
+ /** Imprime un par clave-valor alineado: la clave en gris con 26 caracteres de ancho, el valor en blanco brillante. */
248
+ function kv(key, value) {
249
+ process.stdout.write(`${chalk.gray(`${padRight(key, 26)}:`)} ${chalk.whiteBright(String(value))}` + "\n");
250
+ }
251
+ /**
252
+ * Imprime una tabla formateada con `cli-table3`.
253
+ *
254
+ * @param headers - Cabeceras de columna.
255
+ * @param rows - Filas de datos (valores se convierten a string automáticamente).
256
+ * @param compact - Si `true`, usa bordes transparentes para tablas densas.
257
+ */
258
+ function table(headers, rows, compact = false) {
259
+ const t = new Table({
260
+ head: headers.map((h) => chalk.cyanBright(h)),
261
+ wordWrap: true,
262
+ style: {
263
+ head: [],
264
+ border: compact ? [] : ["gray"]
265
+ },
266
+ colAligns: headers.map(() => "left")
267
+ });
268
+ for (const row of rows) {
269
+ t.push(row.map((cell) => String(cell)));
270
+ }
271
+ process.stdout.write(t.toString() + "\n");
272
+ }
273
+ /**
274
+ * Imprime una lista de rutas de archivos con guión y truncado central.
275
+ *
276
+ * @param files - Rutas a listar.
277
+ * @param width - Longitud máxima de cada ruta. Por defecto: 80.
278
+ */
279
+ function fileList(files, width = 80) {
280
+ for (const file of files) {
281
+ process.stdout.write(` ${chalk.gray("-")} ${chalk.whiteBright(truncateMiddle(file, width))}` + "\n");
282
+ }
283
+ }
284
+ /**
285
+ * Imprime una tabla compacta de métricas con etiqueta y valor coloreado.
286
+ *
287
+ * @param items - Tripletas `[etiqueta, valor, tono]`. El tono es opcional (por defecto `"blue"`).
288
+ */
289
+ function dashboard(items) {
290
+ const rows = items.map(([label, value, tone = "blue"]) => {
291
+ const renderedValue = colorize(String(value), tone);
292
+ return [chalk.gray(label), renderedValue];
293
+ });
294
+ table(["Métrica", "Valor"], rows, true);
295
+ }
296
+ /**
297
+ * Imprime una tarjeta con borde redondeado usando `boxen`.
298
+ *
299
+ * @param title - Título en blanco brillante negrita.
300
+ * @param lines - Contenido libre (strings ya formateados con chalk si se desea).
301
+ * @param tone - Color del borde. Por defecto: `"blue"`.
302
+ * @param footer - Línea de pie en gris (opcional).
303
+ */
304
+ function card(title, lines, tone = "blue", footer) {
305
+ const borderColor = tone === "green"
306
+ ? "green"
307
+ : tone === "yellow"
308
+ ? "yellow"
309
+ : tone === "red"
310
+ ? "red"
311
+ : tone === "magenta"
312
+ ? "magenta"
313
+ : tone === "cyan"
314
+ ? "cyan"
315
+ : "blue";
316
+ const content = [
317
+ chalk.bold.whiteBright(title),
318
+ "",
319
+ ...lines,
320
+ ...(footer ? ["", chalk.gray(footer)] : [])
321
+ ].join("\n");
322
+ process.stdout.write(boxen(content, {
323
+ padding: 1,
324
+ borderStyle: "round",
325
+ borderColor
326
+ }) + "\n");
327
+ }
328
+ /**
329
+ * Imprime una tarjeta de resumen con pares clave-valor coloreados.
330
+ * Usa `card` internamente con tono cyan.
331
+ *
332
+ * @param title - Título de la tarjeta.
333
+ * @param items - Tripletas `[etiqueta, valor, tono]`.
334
+ */
335
+ function summaryCard(title, items) {
336
+ const lines = items.map(([label, value, tone = "blue"]) => {
337
+ return `${chalk.gray(`${label}:`)} ${colorize(String(value), tone)}`;
338
+ });
339
+ card(title, lines, "cyan");
340
+ }
341
+ /**
342
+ * Genera la representación visual de un bloque para tablas y listas.
343
+ * Distingue bloques grandes (`large::`) de bloques agrupados normales.
344
+ */
345
+ function blockLabel(id) {
346
+ if (id.startsWith("large::")) {
347
+ return badge("large", "yellow") + " " + chalk.whiteBright(id.replace("large::", ""));
348
+ }
349
+ const parts = id.split("::");
350
+ if (parts.length === 2) {
351
+ return `${badge("block", "blue")} ${chalk.whiteBright(parts[0])} ${chalk.gray("::")} ${chalk.cyanBright(parts[1])}`;
352
+ }
353
+ return `${badge("block", "blue")} ${chalk.whiteBright(id)}`;
354
+ }
355
+ /** Imprime una línea horizontal de 100 guiones en gris para separar entradas dentro de una sección. */
356
+ function divider() {
357
+ process.stdout.write(chalk.gray("─".repeat(100)) + "\n");
358
+ }
359
+ /**
360
+ * Muestra una pregunta de sí/no y espera respuesta del usuario.
361
+ *
362
+ * @param message - Texto de la pregunta (sin el `[y/N]` que se agrega automáticamente).
363
+ * @returns `true` si el usuario responde `y` o `yes` (insensible a mayúsculas).
364
+ */
365
+ async function confirm(message) {
366
+ const rl = getReadlineInterface();
367
+ return new Promise((resolve) => {
368
+ rl.question(`${chalk.yellowBright("?")} ${message} ${chalk.gray("[y/N]: ")}`, (answer) => {
369
+ const normalized = answer.trim().toLowerCase();
370
+ resolve(normalized === "y" || normalized === "yes");
371
+ });
372
+ });
373
+ }
374
+ /**
375
+ * Muestra un prompt de texto libre y espera la respuesta del usuario.
376
+ *
377
+ * Si el usuario no escribe nada y pulsa Enter, se devuelve `defaultValue`.
378
+ *
379
+ * @param message - Texto del prompt.
380
+ * @param defaultValue - Valor a usar si el usuario no escribe nada. Por defecto: `""`.
381
+ */
382
+ async function prompt(message, defaultValue = "") {
383
+ const rl = getReadlineInterface();
384
+ return new Promise((resolve) => {
385
+ const suffix = defaultValue ? chalk.gray(` [predeterminado: ${defaultValue}]`) : "";
386
+ rl.question(`${chalk.yellowBright("?")} ${message}${suffix}: `, (answer) => {
387
+ const value = answer.trim();
388
+ resolve(value || defaultValue);
389
+ });
390
+ });
391
+ }
392
+ export const ui = {
393
+ spinner: new Spinner(),
394
+ truncateMiddle,
395
+ header,
396
+ section,
397
+ subsection,
398
+ info,
399
+ ok,
400
+ warn,
401
+ error,
402
+ muted,
403
+ kv,
404
+ table,
405
+ fileList,
406
+ dashboard,
407
+ card,
408
+ summaryCard,
409
+ badge,
410
+ scoreColor,
411
+ score,
412
+ blockLabel,
413
+ divider,
414
+ confirm,
415
+ prompt,
416
+ closeReadlineInterface
417
+ };
@@ -0,0 +1,59 @@
1
+ /**
2
+ * constants.ts — Constantes globales del proyecto.
3
+ *
4
+ * Centralizar los valores literales aquí permite cambiar un umbral o penalización
5
+ * desde un solo lugar, afectando todo el sistema.
6
+ *
7
+ * Las constantes `DIST_*` y `EVAL_*` son parámetros de ajuste heurístico.
8
+ * Si el algoritmo produce distribuciones subóptimas en un proyecto concreto,
9
+ * estos son los primeros valores a revisar.
10
+ */
11
+ import { createRequire } from "node:module";
12
+ const _require = createRequire(import.meta.url);
13
+ const _pkg = _require("../../package.json");
14
+ /** Nombre legible de la herramienta mostrado en cabeceras y reportes. */
15
+ export const APP_NAME = "PR Split Advisor";
16
+ /** Binario CLI tal como se registra en el campo `bin` de `package.json`. */
17
+ export const APP_BIN = "pr-split-advisor";
18
+ /** Versión sincronizada automáticamente con el campo "version" de package.json. */
19
+ export const APP_VERSION = _pkg.version;
20
+ /** Título que encabeza los reportes HTML. */
21
+ export const APP_REPORT_TITLE = "PR Split Advisor — Reporte de Plan";
22
+ // ---------------------------------------------------------------------------
23
+ // Umbrales de evaluación de ramas (`evaluateBranch`)
24
+ // ---------------------------------------------------------------------------
25
+ /**
26
+ * Total de líneas a partir del cual se fuerzan mínimo 2 commits en una rama
27
+ * con más de un bloque.
28
+ */
29
+ export const EVAL_MIN_COMMITS_LINE_THRESHOLD = 120;
30
+ /**
31
+ * Total de líneas a partir del cual `evaluateBranch` marca la razón como
32
+ * "PR demasiado grande por total de líneas". Los planes con esta razón no
33
+ * se rechazan porque el tamaño grande puede ser inevitable.
34
+ */
35
+ export const EVAL_MAX_PR_LINE_THRESHOLD = 1200;
36
+ // ---------------------------------------------------------------------------
37
+ // Penalizaciones para `distributeBlocks` (strategy.ts)
38
+ // ---------------------------------------------------------------------------
39
+ /** Penalización cuando los archivos proyectados superarían el límite por rama. */
40
+ export const DIST_PENALTY_OVERFLOW_FILES = 1000;
41
+ /** Penalización por colocar un bloque indivisible en una rama que ya tiene contenido. */
42
+ export const DIST_PENALTY_INDIVISIBLE_NONEMPTY = 800;
43
+ /** Bonificación por colocar un bloque indivisible en una rama vacía. */
44
+ export const DIST_BONUS_INDIVISIBLE_EMPTY = 60;
45
+ /** Divisor para la penalización proporcional al total de líneas proyectadas. */
46
+ export const DIST_PENALTY_LINE_FACTOR = 10;
47
+ /** Penalización por separar bloques con dependencia directa en ramas distintas. */
48
+ export const DIST_PENALTY_SPLIT_DEPS = 600;
49
+ /** Bonificación por colocar bloques con dependencia directa en la misma rama. */
50
+ export const DIST_BONUS_COLOCATE_DEPS = 300;
51
+ // ---------------------------------------------------------------------------
52
+ // Nomenclatura de ramas
53
+ // ---------------------------------------------------------------------------
54
+ /**
55
+ * Longitud máxima recomendada para un nombre de rama git.
56
+ * GitHub acepta hasta 255 chars, pero muchas herramientas de CI/CD fallan
57
+ * con nombres de más de 80 caracteres.
58
+ */
59
+ export const BRANCH_NAME_MAX_LENGTH = 80;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * types.ts — Definiciones de tipos y contratos compartidos en todo el proyecto.
3
+ *
4
+ * Jerarquía de datos (flujo de análisis):
5
+ * Config → FileStat[] → DependencyEdge[] → Block[] → BranchPlan[] (+ CommitPlan[])
6
+ */
7
+ export {};
@@ -0,0 +1,73 @@
1
+ /**
2
+ * utils.ts — Utilidades compartidas de bajo nivel.
3
+ *
4
+ * Funciones exportadas:
5
+ * - `isTrackedFile` — consulta el Set pre-cargado de archivos tracked (O(1))
6
+ * - `resetTrackedFilesCache` — limpia la caché entre ejecuciones
7
+ * - `changeTypeLabel` — etiqueta legible para los changeTypes de FileStat
8
+ * - `normalizePathValue` — normaliza separadores de ruta (Windows/POSIX)
9
+ * - `fileExistsInRepoOrFs` — detecta si un archivo existe en disco o en git
10
+ */
11
+ import { existsSync } from "node:fs";
12
+ import { normalize } from "node:path";
13
+ import { shSafe } from "../git/git.js";
14
+ /**
15
+ * Caché del conjunto de archivos bajo seguimiento git, construida una vez
16
+ * por análisis para evitar un subproceso `git ls-files` por cada archivo.
17
+ */
18
+ let _trackedFilesCache = null;
19
+ function getTrackedFilesSet() {
20
+ if (!_trackedFilesCache) {
21
+ _trackedFilesCache = new Set(shSafe("git ls-files")
22
+ .split("\n")
23
+ .map((s) => s.trim())
24
+ .filter(Boolean));
25
+ }
26
+ return _trackedFilesCache;
27
+ }
28
+ /**
29
+ * Limpia la caché interna del Set de archivos tracked.
30
+ * Útil en tests y en escenarios con múltiples análisis en el mismo proceso.
31
+ */
32
+ export function resetTrackedFilesCache() {
33
+ _trackedFilesCache = null;
34
+ }
35
+ /**
36
+ * Devuelve `true` si el archivo está bajo seguimiento git.
37
+ * O(1) por llamada después del primer acceso que construye el Set.
38
+ *
39
+ * @param file - Ruta relativa al raíz del repositorio.
40
+ */
41
+ export function isTrackedFile(file) {
42
+ return getTrackedFilesSet().has(file);
43
+ }
44
+ /**
45
+ * Devuelve una etiqueta legible para el tipo de cambio de un archivo git.
46
+ * Centraliza la lógica compartida entre `cli.ts` y `report.ts`.
47
+ */
48
+ export function changeTypeLabel(changeType) {
49
+ switch (changeType) {
50
+ case "A": return "A + creado";
51
+ case "M": return "M ~ actualizado";
52
+ case "D": return "D - eliminado";
53
+ case "R": return "R > renombrado";
54
+ case "U": return "U ? nuevo local";
55
+ default: return changeType;
56
+ }
57
+ }
58
+ /**
59
+ * Normaliza una ruta de archivo para comparaciones consistentes
60
+ * en sistemas Windows (backslash) y POSIX (forward slash).
61
+ */
62
+ export function normalizePathValue(p) {
63
+ return normalize(p).replace(/\\/g, "/").replace(/^\.\//, "");
64
+ }
65
+ /**
66
+ * Devuelve `true` si el archivo existe en el filesystem local O en el repositorio git.
67
+ * Detecta archivos eliminados que aún viven en el HEAD del repositorio.
68
+ */
69
+ export function fileExistsInRepoOrFs(file) {
70
+ if (existsSync(file))
71
+ return true;
72
+ return getTrackedFilesSet().has(file);
73
+ }
@@ -0,0 +1,26 @@
1
+ MIT License
2
+
3
+ Original Library
4
+ - Copyright (c) Marak Squires
5
+
6
+ Additional Functionality
7
+ - Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
8
+ - Copyright (c) DABH (https://github.com/DABH)
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in
18
+ all copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26
+ THE SOFTWARE.