@jordond/kit 0.0.0-stage → 0.2.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 (288) hide show
  1. package/README.md +139 -2
  2. package/bin/kit +39 -0
  3. package/dist/_verb-28xmg3d3.js +116 -0
  4. package/dist/android-fs3sesnn.js +60 -0
  5. package/dist/build-ak20h5cd.js +42 -0
  6. package/dist/builtins-bj2yypm6.js +10 -0
  7. package/dist/bump-hsfmz2rn.js +124 -0
  8. package/dist/certs-w5v0877b.js +76 -0
  9. package/dist/check-771pracn.js +33 -0
  10. package/dist/check-jf1apke7.js +54 -0
  11. package/dist/cleanup-hrcvxmh2.js +18 -0
  12. package/dist/cli/builtins.d.ts +13 -0
  13. package/dist/cli/command.d.ts +106 -0
  14. package/dist/cli/discover.d.ts +10 -0
  15. package/dist/cli/main.d.ts +1 -0
  16. package/dist/cli/plugin.d.ts +7 -0
  17. package/dist/cli/usage.d.ts +3 -0
  18. package/dist/cli-19me2qqg.js +1056 -0
  19. package/dist/cli-1htjx51v.js +80 -0
  20. package/dist/cli-51ha0t4k.js +70 -0
  21. package/dist/cli-540nme4e.js +46 -0
  22. package/dist/cli-5d61x8vg.js +675 -0
  23. package/dist/cli-5wasc5mr.js +76 -0
  24. package/dist/cli-699g070n.js +104 -0
  25. package/dist/cli-7wvrehng.js +23 -0
  26. package/dist/cli-cc13vv98.js +2023 -0
  27. package/dist/cli-dht27t4r.js +41 -0
  28. package/dist/cli-fqfan92n.js +135 -0
  29. package/dist/cli-fqxtcj42.js +75 -0
  30. package/dist/cli-g519ev8e.js +89 -0
  31. package/dist/cli-gqy1xp9t.js +97 -0
  32. package/dist/cli-qhs8ww91.js +51 -0
  33. package/dist/cli-qq1ktr8q.js +234 -0
  34. package/dist/cli-r6g14qrk.js +195 -0
  35. package/dist/cli-re3ntm60.js +48 -0
  36. package/dist/cli-sx073w8p.js +191 -0
  37. package/dist/cli-vt6582gp.js +122 -0
  38. package/dist/cli-xax5grx1.js +108 -0
  39. package/dist/cli-xjpjdc2c.js +70 -0
  40. package/dist/cli-y3mjprpv.js +31 -0
  41. package/dist/cli-zf47bkgh.js +227 -0
  42. package/dist/cli.d.ts +1 -0
  43. package/dist/cli.js +35 -0
  44. package/dist/cloudflare-xf7e2dn3.js +43 -0
  45. package/dist/command-j1etpmj6.js +21 -0
  46. package/dist/commands/_verb.d.ts +15 -0
  47. package/dist/commands/build.d.ts +11 -0
  48. package/dist/commands/check.d.ts +8 -0
  49. package/dist/commands/completion.d.ts +15 -0
  50. package/dist/commands/config.d.ts +2 -0
  51. package/dist/commands/db/create.d.ts +7 -0
  52. package/dist/commands/db/exec.d.ts +16 -0
  53. package/dist/commands/db/list.d.ts +11 -0
  54. package/dist/commands/db/migrate.d.ts +11 -0
  55. package/dist/commands/deploy.d.ts +18 -0
  56. package/dist/commands/deps.d.ts +72 -0
  57. package/dist/commands/dev.d.ts +8 -0
  58. package/dist/commands/doctor.d.ts +63 -0
  59. package/dist/commands/env/check.d.ts +7 -0
  60. package/dist/commands/env/init.d.ts +2 -0
  61. package/dist/commands/env/push.d.ts +16 -0
  62. package/dist/commands/env/sync.d.ts +2 -0
  63. package/dist/commands/fastlane.d.ts +2 -0
  64. package/dist/commands/format.d.ts +11 -0
  65. package/dist/commands/gradle.d.ts +2 -0
  66. package/dist/commands/init.d.ts +70 -0
  67. package/dist/commands/lint.d.ts +12 -0
  68. package/dist/commands/release/android.d.ts +30 -0
  69. package/dist/commands/release/certs.d.ts +7 -0
  70. package/dist/commands/release/ios.d.ts +22 -0
  71. package/dist/commands/release/service.d.ts +6 -0
  72. package/dist/commands/test.d.ts +2 -0
  73. package/dist/commands/typecheck.d.ts +2 -0
  74. package/dist/commands/version/bump.d.ts +17 -0
  75. package/dist/commands/version/show.d.ts +2 -0
  76. package/dist/commands/wrangler.d.ts +2 -0
  77. package/dist/commands/xcode.d.ts +10 -0
  78. package/dist/completion-m051yvzk.js +38 -0
  79. package/dist/concurrent-zdz69ye5.js +96 -0
  80. package/dist/config/load.d.ts +6 -0
  81. package/dist/config/schema.d.ts +139 -0
  82. package/dist/config-c8yh5m9j.js +22 -0
  83. package/dist/create-j7ve677k.js +38 -0
  84. package/dist/creds-rhxhmpe6.js +22 -0
  85. package/dist/deploy-af2v2jhj.js +152 -0
  86. package/dist/deps-1apnsrre.js +334 -0
  87. package/dist/dev-6dv5xbv2.js +114 -0
  88. package/dist/doctor-cr3hcfvt.js +377 -0
  89. package/dist/errors-1fjbr7ee.js +10 -0
  90. package/dist/exec-wa94sqwn.js +53 -0
  91. package/dist/fastlane-2kjyfqjg.js +26 -0
  92. package/dist/fastlane-qsjmbxtj.js +38 -0
  93. package/dist/format-rehf6c8g.js +39 -0
  94. package/dist/git-3gyyfk0x.js +24 -0
  95. package/dist/gradle-wv77a2f1.js +39 -0
  96. package/dist/index-cx34x4np.js +874 -0
  97. package/dist/index-erv82p4z.js +1528 -0
  98. package/dist/index-jqfz6hfy.js +2659 -0
  99. package/dist/index-mm4ht8yh.js +9 -0
  100. package/dist/index-s3ehw02w.js +1610 -0
  101. package/dist/index.d.ts +11 -0
  102. package/dist/index.js +55 -0
  103. package/dist/init-gtkmx54a.js +76 -0
  104. package/dist/init-kck1p6gj.js +250 -0
  105. package/dist/init-n38980zv.js +78 -0
  106. package/dist/ios-f6pwcqqt.js +50 -0
  107. package/dist/lib/cleanup.d.ts +21 -0
  108. package/dist/lib/cloudflare.d.ts +97 -0
  109. package/dist/lib/concurrent.d.ts +21 -0
  110. package/dist/lib/env/init.d.ts +22 -0
  111. package/dist/lib/env/load.d.ts +12 -0
  112. package/dist/lib/env/push.d.ts +54 -0
  113. package/dist/lib/env/render.d.ts +52 -0
  114. package/dist/lib/env/schema.d.ts +49 -0
  115. package/dist/lib/errors.d.ts +14 -0
  116. package/dist/lib/fastlane.d.ts +36 -0
  117. package/dist/lib/git.d.ts +36 -0
  118. package/dist/lib/log.d.ts +17 -0
  119. package/dist/lib/pm.d.ts +8 -0
  120. package/dist/lib/proc.d.ts +73 -0
  121. package/dist/lib/prompt.d.ts +32 -0
  122. package/dist/lib/release/creds.d.ts +26 -0
  123. package/dist/lib/release/mobile.d.ts +41 -0
  124. package/dist/lib/release/notes.d.ts +15 -0
  125. package/dist/lib/release/preflight.d.ts +30 -0
  126. package/dist/lib/release/version.d.ts +25 -0
  127. package/dist/lib/secrets.d.ts +32 -0
  128. package/dist/lib/steps.d.ts +38 -0
  129. package/dist/lib/targets.d.ts +46 -0
  130. package/dist/lib/toml.d.ts +15 -0
  131. package/dist/lint-e0j22mab.js +39 -0
  132. package/dist/list-fzwqsfsk.js +34 -0
  133. package/dist/load-dxhacsn4.js +137 -0
  134. package/dist/log-g1ebh60s.js +15 -0
  135. package/dist/main-jrcgdccz.js +1965 -0
  136. package/dist/migrate-4ncx9tqj.js +38 -0
  137. package/dist/mobile-9n86ytzx.js +384 -0
  138. package/dist/notes-1zsa7qac.js +21 -0
  139. package/dist/picocolors-0dxagz5d.js +6 -0
  140. package/dist/pm-5q5vz6w3.js +14 -0
  141. package/dist/proc-jv4bcyyx.js +33 -0
  142. package/dist/prompt-3wwegvqc.js +15 -0
  143. package/dist/push-acejr9gj.js +124 -0
  144. package/dist/push-fq5syn8c.js +117 -0
  145. package/dist/render-vn40fp54.js +22 -0
  146. package/dist/service-xekpd27p.js +102 -0
  147. package/dist/show-jw5bx55h.js +50 -0
  148. package/dist/steps-9knqpszw.js +16 -0
  149. package/dist/sync-9z8n875s.js +53 -0
  150. package/dist/targets-bywmzbtj.js +22 -0
  151. package/dist/test-8jws3x98.js +26 -0
  152. package/dist/toml-3fxsdkhr.js +14 -0
  153. package/dist/typecheck-1hn3hgz9.js +24 -0
  154. package/dist/version-4tz72w42.js +26 -0
  155. package/dist/wrangler-412fadcz.js +46 -0
  156. package/dist/xcode-qzyee632.js +75 -0
  157. package/fastlane/Fastfile +413 -0
  158. package/fastlane/Gemfile +21 -0
  159. package/fastlane/Gemfile.lock +275 -0
  160. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom +15 -0
  161. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom.md5 +1 -0
  162. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom.sha1 +1 -0
  163. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom.sha256 +1 -0
  164. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/0.2.0/io.github.jordond.kit.android.application.gradle.plugin-0.2.0.pom.sha512 +1 -0
  165. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml +13 -0
  166. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml.md5 +1 -0
  167. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  168. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  169. package/gradle/maven/io/github/jordond/kit/android/application/io.github.jordond.kit.android.application.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  170. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom +15 -0
  171. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom.md5 +1 -0
  172. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom.sha1 +1 -0
  173. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom.sha256 +1 -0
  174. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/0.2.0/io.github.jordond.kit.android.baseline.gradle.plugin-0.2.0.pom.sha512 +1 -0
  175. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml +13 -0
  176. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml.md5 +1 -0
  177. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  178. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  179. package/gradle/maven/io/github/jordond/kit/android/baseline/io.github.jordond.kit.android.baseline.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  180. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom +15 -0
  181. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom.md5 +1 -0
  182. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom.sha1 +1 -0
  183. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom.sha256 +1 -0
  184. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/0.2.0/io.github.jordond.kit.compose.gradle.plugin-0.2.0.pom.sha512 +1 -0
  185. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml +13 -0
  186. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml.md5 +1 -0
  187. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  188. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  189. package/gradle/maven/io/github/jordond/kit/compose/io.github.jordond.kit.compose.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  190. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom +15 -0
  191. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom.md5 +1 -0
  192. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom.sha1 +1 -0
  193. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom.sha256 +1 -0
  194. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/0.2.0/io.github.jordond.kit.jvm.app.gradle.plugin-0.2.0.pom.sha512 +1 -0
  195. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml +13 -0
  196. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml.md5 +1 -0
  197. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  198. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  199. package/gradle/maven/io/github/jordond/kit/jvm/app/io.github.jordond.kit.jvm.app.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  200. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar +0 -0
  201. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar.md5 +1 -0
  202. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar.sha1 +1 -0
  203. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar.sha256 +1 -0
  204. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.jar.sha512 +1 -0
  205. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module +64 -0
  206. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module.md5 +1 -0
  207. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module.sha1 +1 -0
  208. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module.sha256 +1 -0
  209. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.module.sha512 +1 -0
  210. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom +12 -0
  211. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom.md5 +1 -0
  212. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom.sha1 +1 -0
  213. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom.sha256 +1 -0
  214. package/gradle/maven/io/github/jordond/kit/kit-plugins/0.2.0/kit-plugins-0.2.0.pom.sha512 +1 -0
  215. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml +13 -0
  216. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml.md5 +1 -0
  217. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml.sha1 +1 -0
  218. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml.sha256 +1 -0
  219. package/gradle/maven/io/github/jordond/kit/kit-plugins/maven-metadata.xml.sha512 +1 -0
  220. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar +0 -0
  221. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar.md5 +1 -0
  222. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar.sha1 +1 -0
  223. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar.sha256 +1 -0
  224. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.jar.sha512 +1 -0
  225. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module +64 -0
  226. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module.md5 +1 -0
  227. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module.sha1 +1 -0
  228. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module.sha256 +1 -0
  229. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.module.sha512 +1 -0
  230. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom +12 -0
  231. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom.md5 +1 -0
  232. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom.sha1 +1 -0
  233. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom.sha256 +1 -0
  234. package/gradle/maven/io/github/jordond/kit/kit-settings/0.2.0/kit-settings-0.2.0.pom.sha512 +1 -0
  235. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml +13 -0
  236. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml.md5 +1 -0
  237. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml.sha1 +1 -0
  238. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml.sha256 +1 -0
  239. package/gradle/maven/io/github/jordond/kit/kit-settings/maven-metadata.xml.sha512 +1 -0
  240. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom +15 -0
  241. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom.md5 +1 -0
  242. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom.sha1 +1 -0
  243. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom.sha256 +1 -0
  244. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/0.2.0/io.github.jordond.kit.kmp.library.gradle.plugin-0.2.0.pom.sha512 +1 -0
  245. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml +13 -0
  246. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml.md5 +1 -0
  247. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  248. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  249. package/gradle/maven/io/github/jordond/kit/kmp/library/io.github.jordond.kit.kmp.library.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  250. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom +15 -0
  251. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom.md5 +1 -0
  252. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom.sha1 +1 -0
  253. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom.sha256 +1 -0
  254. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/0.2.0/io.github.jordond.kit.lint.gradle.plugin-0.2.0.pom.sha512 +1 -0
  255. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml +13 -0
  256. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml.md5 +1 -0
  257. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  258. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  259. package/gradle/maven/io/github/jordond/kit/lint/io.github.jordond.kit.lint.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  260. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom +15 -0
  261. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom.md5 +1 -0
  262. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom.sha1 +1 -0
  263. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom.sha256 +1 -0
  264. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/0.2.0/io.github.jordond.kit.release.gradle.plugin-0.2.0.pom.sha512 +1 -0
  265. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml +13 -0
  266. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml.md5 +1 -0
  267. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  268. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  269. package/gradle/maven/io/github/jordond/kit/release/io.github.jordond.kit.release.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  270. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom +15 -0
  271. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom.md5 +1 -0
  272. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom.sha1 +1 -0
  273. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom.sha256 +1 -0
  274. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/0.2.0/io.github.jordond.kit.settings.gradle.plugin-0.2.0.pom.sha512 +1 -0
  275. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml +13 -0
  276. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml.md5 +1 -0
  277. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml.sha1 +1 -0
  278. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml.sha256 +1 -0
  279. package/gradle/maven/io/github/jordond/kit/settings/io.github.jordond.kit.settings.gradle.plugin/maven-metadata.xml.sha512 +1 -0
  280. package/package.json +58 -4
  281. package/templates/lefthook.yml +6 -0
  282. package/templates/mise.toml +6 -0
  283. package/templates/new/.env.example +20 -0
  284. package/templates/new/.github/workflows/ci.yml +45 -0
  285. package/templates/new/apps/client/fastlane/Fastfile +1 -0
  286. package/templates/new/apps/client/gradle/libs.versions.toml +25 -0
  287. package/templates/new/apps/client/settings.gradle.kts +25 -0
  288. package/templates/new/kit.config.ts +15 -0
@@ -0,0 +1,1965 @@
1
+ // @bun
2
+ import {
3
+ builtins,
4
+ groupDescriptions
5
+ } from "./cli-sx073w8p.js";
6
+ import {
7
+ computeFlags,
8
+ toGunshi,
9
+ withBuiltin
10
+ } from "./cli-gqy1xp9t.js";
11
+ import {
12
+ ExitCode,
13
+ KitError
14
+ } from "./cli-7wvrehng.js";
15
+ import {
16
+ installSignalHandlers,
17
+ interrupted,
18
+ runCleanup
19
+ } from "./cli-fqxtcj42.js";
20
+ import {
21
+ emitJson,
22
+ jsonEmitted,
23
+ log
24
+ } from "./cli-540nme4e.js";
25
+ import {
26
+ require_picocolors
27
+ } from "./cli-5wasc5mr.js";
28
+ import {
29
+ __require,
30
+ __toESM
31
+ } from "./cli-re3ntm60.js";
32
+
33
+ // node_modules/gunshi/lib/utils-DbRhwNIU.js
34
+ function kebabnize(str) {
35
+ return str.replace(/[A-Z]/g, (match, offset) => (offset > 0 ? "-" : "") + match.toLowerCase());
36
+ }
37
+ function formatChoices(choices) {
38
+ return choices.map((value) => JSON.stringify(value)).join(", ");
39
+ }
40
+
41
+ // node_modules/gunshi/lib/utils.js
42
+ function isLazyCommand(cmd) {
43
+ return typeof cmd === "function" && "commandName" in cmd && !!cmd.commandName;
44
+ }
45
+ async function resolveLazyCommand(cmd, name, needRunResolving = false) {
46
+ let command;
47
+ if (isLazyCommand(cmd)) {
48
+ const baseCommand = {
49
+ name: cmd.commandName,
50
+ description: cmd.description,
51
+ args: cmd.args,
52
+ examples: cmd.examples,
53
+ internal: cmd.internal,
54
+ entry: cmd.entry,
55
+ subCommands: cmd.subCommands
56
+ };
57
+ if ("resource" in cmd && cmd.resource)
58
+ baseCommand.resource = cmd.resource;
59
+ command = Object.assign(create(), baseCommand);
60
+ if (needRunResolving) {
61
+ const loaded = await cmd();
62
+ if (typeof loaded === "function")
63
+ command.run = loaded;
64
+ else if (typeof loaded === "object") {
65
+ if (loaded.run == null)
66
+ throw new TypeError(`'run' is required in command: ${cmd.name || name}`);
67
+ command.run = loaded.run;
68
+ command.name = loaded.name;
69
+ command.description = loaded.description;
70
+ command.args = loaded.args;
71
+ command.examples = loaded.examples;
72
+ command.internal = loaded.internal;
73
+ command.entry = loaded.entry;
74
+ command.subCommands = loaded.subCommands || cmd.subCommands;
75
+ if ("resource" in loaded && loaded.resource)
76
+ command.resource = loaded.resource;
77
+ } else
78
+ throw new TypeError(`Cannot resolve command: ${cmd.name || name}`);
79
+ }
80
+ } else
81
+ command = Object.assign(create(), cmd);
82
+ if (command.name == null && name)
83
+ command.name = name;
84
+ return deepFreeze(command);
85
+ }
86
+ function create(obj = null) {
87
+ return Object.create(obj);
88
+ }
89
+ function log2(...args) {
90
+ console.log(...args);
91
+ }
92
+ function getCommandSubCommands(cmd) {
93
+ const subCommands = isLazyCommand(cmd) ? cmd.subCommands : typeof cmd === "object" ? cmd.subCommands : undefined;
94
+ if (!subCommands)
95
+ return;
96
+ if (subCommands instanceof Map)
97
+ return subCommands.size > 0 ? subCommands : undefined;
98
+ if (typeof subCommands === "object") {
99
+ const entries = Object.entries(subCommands);
100
+ if (entries.length === 0)
101
+ return;
102
+ const map = /* @__PURE__ */ new Map;
103
+ for (const [name, cmd2] of entries)
104
+ map.set(name, cmd2);
105
+ return map;
106
+ }
107
+ }
108
+ function deepFreeze(obj, ignores = []) {
109
+ if (obj === null || typeof obj !== "object")
110
+ return obj;
111
+ for (const key of Object.keys(obj)) {
112
+ const value = obj[key];
113
+ if (ignores.includes(key))
114
+ continue;
115
+ if (typeof value === "object" && value !== null)
116
+ deepFreeze(value, ignores);
117
+ }
118
+ return Object.freeze(obj);
119
+ }
120
+
121
+ // node_modules/gunshi/lib/context-CAPhwgJJ.js
122
+ var ANONYMOUS_COMMAND_NAME = "(anonymous)";
123
+ var NOOP = () => {};
124
+ var CLI_OPTIONS_DEFAULT = {
125
+ name: undefined,
126
+ description: undefined,
127
+ version: undefined,
128
+ cwd: undefined,
129
+ usageSilent: false,
130
+ subCommands: undefined,
131
+ leftMargin: 2,
132
+ middleMargin: 10,
133
+ usageOptionType: false,
134
+ usageOptionValue: true,
135
+ strict: false,
136
+ renderHeader: undefined,
137
+ renderUsage: undefined,
138
+ renderValidationErrors: undefined,
139
+ plugins: undefined,
140
+ fallbackToEntry: false
141
+ };
142
+ async function createCommandContext({ args = {}, explicit = {}, values = {}, positionals = [], rest = [], argv = [], tokens = [], command = {}, extensions = {}, cliOptions = {}, callMode = "entry", commandPath = [], omitted = false, validationError }) {
143
+ const _args = Object.entries(args).reduce((acc, [key, value]) => {
144
+ acc[key] = Object.assign(create(), value);
145
+ return acc;
146
+ }, create());
147
+ const env = Object.assign(create(), CLI_OPTIONS_DEFAULT, cliOptions);
148
+ if (command.rendering) {
149
+ const { header, usage, validationErrors } = command.rendering;
150
+ if (header !== undefined)
151
+ env.renderHeader = header;
152
+ if (usage !== undefined)
153
+ env.renderUsage = usage;
154
+ if (validationErrors !== undefined)
155
+ env.renderValidationErrors = validationErrors;
156
+ }
157
+ const core = Object.assign(create(), {
158
+ name: getCommandName(command),
159
+ description: command.description,
160
+ omitted,
161
+ callMode,
162
+ commandPath,
163
+ env,
164
+ args: _args,
165
+ explicit,
166
+ values,
167
+ positionals,
168
+ rest,
169
+ _: argv,
170
+ tokens,
171
+ toKebab: command.toKebab,
172
+ log: cliOptions.usageSilent ? NOOP : log2,
173
+ validationError
174
+ });
175
+ if (Object.keys(extensions).length > 0) {
176
+ const ext = create(null);
177
+ Object.defineProperty(core, "extensions", {
178
+ value: ext,
179
+ writable: false,
180
+ enumerable: true,
181
+ configurable: true
182
+ });
183
+ for (const [key, extension] of Object.entries(extensions)) {
184
+ ext[key] = await extension.factory(core, command);
185
+ if (extension.onFactory)
186
+ await extension.onFactory(core, command);
187
+ }
188
+ }
189
+ return deepFreeze(core, ["extensions"]);
190
+ }
191
+ function getCommandName(cmd) {
192
+ if (isLazyCommand(cmd))
193
+ return cmd.commandName || cmd.name || "(anonymous)";
194
+ else if (typeof cmd === "object")
195
+ return cmd.name || "(anonymous)";
196
+ else
197
+ return ANONYMOUS_COMMAND_NAME;
198
+ }
199
+
200
+ // node_modules/gunshi/lib/resolver-D5skgYcF.js
201
+ var HYPHEN_CHAR = "-";
202
+ var HYPHEN_CODE = HYPHEN_CHAR.codePointAt(0);
203
+ var EQUAL_CHAR = "=";
204
+ var EQUAL_CODE = EQUAL_CHAR.codePointAt(0);
205
+ var TERMINATOR = "--";
206
+ var SHORT_OPTION_PREFIX = HYPHEN_CHAR;
207
+ var LONG_OPTION_PREFIX = "--";
208
+ function parseArgs(args, options = {}) {
209
+ const { allowCompatible = false } = options;
210
+ const tokens = [];
211
+ const remainings = [...args];
212
+ let index = -1;
213
+ let groupCount = 0;
214
+ let hasShortValueSeparator = false;
215
+ while (remainings.length > 0) {
216
+ const arg = remainings.shift();
217
+ if (arg == undefined)
218
+ break;
219
+ const nextArg = remainings[0];
220
+ if (groupCount > 0)
221
+ groupCount--;
222
+ else
223
+ index++;
224
+ if (arg === TERMINATOR) {
225
+ tokens.push({
226
+ kind: "option-terminator",
227
+ index
228
+ });
229
+ const mapped = remainings.map((arg2) => {
230
+ return {
231
+ kind: "positional",
232
+ index: ++index,
233
+ value: arg2
234
+ };
235
+ });
236
+ tokens.push(...mapped);
237
+ break;
238
+ }
239
+ if (isShortOption(arg)) {
240
+ const shortOption = arg.charAt(1);
241
+ let value;
242
+ let inlineValue;
243
+ if (groupCount) {
244
+ tokens.push({
245
+ kind: "option",
246
+ name: shortOption,
247
+ rawName: arg,
248
+ index,
249
+ value,
250
+ inlineValue
251
+ });
252
+ if (groupCount === 1 && hasOptionValue(nextArg)) {
253
+ value = remainings.shift();
254
+ if (hasShortValueSeparator) {
255
+ inlineValue = true;
256
+ hasShortValueSeparator = false;
257
+ }
258
+ tokens.push({
259
+ kind: "option",
260
+ index,
261
+ value,
262
+ inlineValue
263
+ });
264
+ }
265
+ } else
266
+ tokens.push({
267
+ kind: "option",
268
+ name: shortOption,
269
+ rawName: arg,
270
+ index,
271
+ value,
272
+ inlineValue
273
+ });
274
+ if (value != null)
275
+ ++index;
276
+ continue;
277
+ }
278
+ if (isShortOptionGroup(arg)) {
279
+ const expanded = [];
280
+ let shortValue = "";
281
+ for (let i = 1;i < arg.length; i++) {
282
+ const shortableOption = arg.charAt(i);
283
+ if (hasShortValueSeparator)
284
+ shortValue += shortableOption;
285
+ else if (!allowCompatible && shortableOption.codePointAt(0) === EQUAL_CODE)
286
+ hasShortValueSeparator = true;
287
+ else
288
+ expanded.push(`${SHORT_OPTION_PREFIX}${shortableOption}`);
289
+ }
290
+ if (shortValue)
291
+ expanded.push(shortValue);
292
+ remainings.unshift(...expanded);
293
+ groupCount = expanded.length;
294
+ continue;
295
+ }
296
+ if (isLongOption(arg)) {
297
+ const longOption = arg.slice(2);
298
+ tokens.push({
299
+ kind: "option",
300
+ name: longOption,
301
+ rawName: arg,
302
+ index,
303
+ value: undefined,
304
+ inlineValue: undefined
305
+ });
306
+ continue;
307
+ }
308
+ if (isLongOptionAndValue(arg)) {
309
+ const equalIndex = arg.indexOf(EQUAL_CHAR);
310
+ const longOption = arg.slice(2, equalIndex);
311
+ const value = arg.slice(equalIndex + 1);
312
+ tokens.push({
313
+ kind: "option",
314
+ name: longOption,
315
+ rawName: `${LONG_OPTION_PREFIX}${longOption}`,
316
+ index,
317
+ value,
318
+ inlineValue: true
319
+ });
320
+ continue;
321
+ }
322
+ tokens.push({
323
+ kind: "positional",
324
+ index,
325
+ value: arg
326
+ });
327
+ }
328
+ return tokens;
329
+ }
330
+ function isShortOption(arg) {
331
+ return arg.length === 2 && arg.codePointAt(0) === HYPHEN_CODE && arg.codePointAt(1) !== HYPHEN_CODE;
332
+ }
333
+ function isShortOptionGroup(arg) {
334
+ if (arg.length <= 2)
335
+ return false;
336
+ if (arg.codePointAt(0) !== HYPHEN_CODE)
337
+ return false;
338
+ if (arg.codePointAt(1) === HYPHEN_CODE)
339
+ return false;
340
+ return true;
341
+ }
342
+ function isLongOption(arg) {
343
+ return hasLongOptionPrefix(arg) && !arg.includes(EQUAL_CHAR, 3);
344
+ }
345
+ function isLongOptionAndValue(arg) {
346
+ return hasLongOptionPrefix(arg) && arg.includes(EQUAL_CHAR, 3);
347
+ }
348
+ function hasLongOptionPrefix(arg) {
349
+ return arg.startsWith(LONG_OPTION_PREFIX) && arg.length > 2;
350
+ }
351
+ function hasOptionValue(value) {
352
+ return !(value == null) && value.codePointAt(0) !== HYPHEN_CODE;
353
+ }
354
+ var ArgsValidationErrorKeys = {
355
+ requiredOption: "err:arg:required-option",
356
+ requiredPositional: "err:arg:required-positional",
357
+ invalidType: "err:arg:invalid-type",
358
+ invalidChoice: "err:arg:invalid-choice",
359
+ customParse: "err:arg:custom-parse",
360
+ unknownOption: "err:arg:unknown-option"
361
+ };
362
+ var ARGS_VALIDATION_ERROR_BRAND = Symbol.for("args-tokens.ArgsValidationError");
363
+ var ArgsValidationError = class extends Error {
364
+ code;
365
+ values;
366
+ constructor(message, options = {}) {
367
+ super(message, { cause: options.cause });
368
+ this.name = "ArgsValidationError";
369
+ this.code = options.code;
370
+ this.values = options.values ?? {};
371
+ Object.defineProperty(this, ARGS_VALIDATION_ERROR_BRAND, {
372
+ value: true,
373
+ enumerable: false,
374
+ writable: false,
375
+ configurable: false
376
+ });
377
+ }
378
+ };
379
+ function isArgsValidationError(error) {
380
+ if (error instanceof ArgsValidationError)
381
+ return true;
382
+ if (typeof error !== "object" || error === null)
383
+ return false;
384
+ if (!Object.hasOwn(error, ARGS_VALIDATION_ERROR_BRAND) || error[ARGS_VALIDATION_ERROR_BRAND] !== true)
385
+ return false;
386
+ const values = error.values;
387
+ return typeof values === "object" && values !== null;
388
+ }
389
+ var SKIP_POSITIONAL_DEFAULT = -1;
390
+ function resolveArgs(args, tokens, { shortGrouping = false, skipPositional = SKIP_POSITIONAL_DEFAULT, toKebab = false } = {}) {
391
+ const skipPositionalIndex = typeof skipPositional === "number" ? Math.max(skipPositional, SKIP_POSITIONAL_DEFAULT) : SKIP_POSITIONAL_DEFAULT;
392
+ const rest = [];
393
+ const optionTokens = [];
394
+ const positionalTokens = [];
395
+ const argEntries = Object.entries(args);
396
+ let currentLongOption;
397
+ let currentShortOption;
398
+ const expandableShortOptions = [];
399
+ function getOptionName(rawArg, schema) {
400
+ return toKebab || schema.toKebab ? kebabnize(rawArg) : rawArg;
401
+ }
402
+ function checkLongTokenName(option, schema, token) {
403
+ if (token.rawName == undefined || !hasLongOptionPrefix(token.rawName))
404
+ return false;
405
+ return token.name === option || schema.type === "boolean" && schema.negatable === true && token.name === `no-${option}`;
406
+ }
407
+ function toShortValue() {
408
+ if (expandableShortOptions.length === 0)
409
+ return;
410
+ else {
411
+ const value = expandableShortOptions.map((token) => token.name).join("");
412
+ expandableShortOptions.length = 0;
413
+ return value;
414
+ }
415
+ }
416
+ function applyLongOptionValue(value) {
417
+ if (currentLongOption) {
418
+ currentLongOption.value = value;
419
+ optionTokens.push({ ...currentLongOption });
420
+ currentLongOption = undefined;
421
+ }
422
+ }
423
+ function applyShortOptionValue(value) {
424
+ if (currentShortOption) {
425
+ currentShortOption.value = value || toShortValue();
426
+ optionTokens.push({ ...currentShortOption });
427
+ currentShortOption = undefined;
428
+ }
429
+ }
430
+ const schemas = Object.values(args);
431
+ const booleanLongOptionNames = /* @__PURE__ */ new Set;
432
+ for (const [rawArg, schema] of Object.entries(args)) {
433
+ if (schema.type !== "boolean")
434
+ continue;
435
+ const arg = toKebab || schema.toKebab ? kebabnize(rawArg) : rawArg;
436
+ booleanLongOptionNames.add(arg);
437
+ if (schema.negatable === true)
438
+ booleanLongOptionNames.add(`no-${arg}`);
439
+ }
440
+ let terminated = false;
441
+ for (let i = 0;i < tokens.length; i++) {
442
+ const token = tokens[i];
443
+ if (token.kind === "positional") {
444
+ if (terminated && token.value) {
445
+ rest.push(token.value);
446
+ continue;
447
+ }
448
+ if (currentShortOption) {
449
+ if (schemas.find((schema) => schema.short === currentShortOption.name && schema.type === "boolean")) {
450
+ positionalTokens.push({ ...token });
451
+ applyShortOptionValue();
452
+ } else
453
+ applyShortOptionValue(token.value);
454
+ } else if (currentLongOption) {
455
+ if (booleanLongOptionNames.has(currentLongOption.name)) {
456
+ positionalTokens.push({ ...token });
457
+ applyLongOptionValue();
458
+ } else
459
+ applyLongOptionValue(token.value);
460
+ } else
461
+ positionalTokens.push({ ...token });
462
+ } else if (token.kind === "option") {
463
+ if (token.rawName) {
464
+ if (hasLongOptionPrefix(token.rawName)) {
465
+ applyLongOptionValue();
466
+ if (token.inlineValue)
467
+ optionTokens.push({ ...token });
468
+ else
469
+ currentLongOption = { ...token };
470
+ applyShortOptionValue();
471
+ } else if (isShortOption(token.rawName)) {
472
+ if (currentShortOption) {
473
+ if (currentShortOption.index === token.index) {
474
+ if (shortGrouping) {
475
+ currentShortOption.value = token.value;
476
+ optionTokens.push({ ...currentShortOption });
477
+ currentShortOption = { ...token };
478
+ } else
479
+ expandableShortOptions.push({ ...token });
480
+ } else {
481
+ currentShortOption.value = toShortValue();
482
+ optionTokens.push({ ...currentShortOption });
483
+ currentShortOption = { ...token };
484
+ }
485
+ applyLongOptionValue();
486
+ } else {
487
+ currentShortOption = { ...token };
488
+ applyLongOptionValue();
489
+ }
490
+ }
491
+ } else {
492
+ if (currentShortOption && currentShortOption.index == token.index && token.inlineValue) {
493
+ currentShortOption.value = token.value;
494
+ optionTokens.push({ ...currentShortOption });
495
+ currentShortOption = undefined;
496
+ }
497
+ applyLongOptionValue();
498
+ }
499
+ } else {
500
+ if (token.kind === "option-terminator")
501
+ terminated = true;
502
+ applyLongOptionValue();
503
+ applyShortOptionValue();
504
+ }
505
+ }
506
+ applyLongOptionValue();
507
+ applyShortOptionValue();
508
+ const values = Object.create(null);
509
+ const errors = [];
510
+ const explicit = Object.create(null);
511
+ const actualInputNames = /* @__PURE__ */ new Map;
512
+ let requiredPositionalsAfter;
513
+ const positionalItemCount = tokens.filter((token) => token.kind === "positional").length;
514
+ function getPositionalSkipIndex() {
515
+ return Math.min(skipPositionalIndex, positionalItemCount);
516
+ }
517
+ function getRequiredPositionalsAfter(rawArg) {
518
+ requiredPositionalsAfter ??= createRequiredPositionalsAfter(argEntries);
519
+ return requiredPositionalsAfter[rawArg] ?? 0;
520
+ }
521
+ let positionalsCount = 0;
522
+ for (const [rawArg, schema] of argEntries) {
523
+ const arg = getOptionName(rawArg, schema);
524
+ explicit[rawArg] = false;
525
+ if (schema.type === "positional") {
526
+ if (skipPositionalIndex > SKIP_POSITIONAL_DEFAULT)
527
+ while (positionalsCount <= getPositionalSkipIndex())
528
+ positionalsCount++;
529
+ if (schema.multiple) {
530
+ const availablePositionals = Math.max(positionalTokens.length - positionalsCount, 0);
531
+ if (availablePositionals > 0) {
532
+ const requiredPositionals = getRequiredPositionalsAfter(rawArg);
533
+ const positionalsToConsume = Math.max(availablePositionals - requiredPositionals, 0);
534
+ if (positionalsToConsume > 0) {
535
+ const endPositionals = positionalsCount + positionalsToConsume;
536
+ if (typeof schema.parse === "function") {
537
+ const parsed = [];
538
+ for (let i = positionalsCount;i < endPositionals; i++) {
539
+ const p = positionalTokens[i];
540
+ const [parsedValue, error] = parseSchemaValue(p.value, rawArg, arg, schema);
541
+ if (error)
542
+ errors.push(error);
543
+ else
544
+ parsed.push(parsedValue);
545
+ }
546
+ values[rawArg] = parsed;
547
+ } else {
548
+ const valuesArray = [];
549
+ for (let i = positionalsCount;i < endPositionals; i++)
550
+ valuesArray.push(positionalTokens[i].value);
551
+ values[rawArg] = valuesArray;
552
+ }
553
+ positionalsCount = endPositionals;
554
+ explicit[rawArg] = true;
555
+ } else if (schema.required)
556
+ errors.push(createRequireError(rawArg, arg, schema));
557
+ } else if (schema.required)
558
+ errors.push(createRequireError(rawArg, arg, schema));
559
+ } else {
560
+ const positional = positionalTokens[positionalsCount];
561
+ if (shouldRequireMissingSinglePositional(schema)) {
562
+ if (positional != null) {
563
+ resolveSinglePositionalValue(values, errors, rawArg, arg, schema, positional);
564
+ explicit[rawArg] = true;
565
+ positionalsCount++;
566
+ } else
567
+ errors.push(createRequireError(rawArg, arg, schema));
568
+ continue;
569
+ }
570
+ if (positional != null) {
571
+ const requiredPositionals = getRequiredPositionalsAfter(rawArg);
572
+ if (Math.max(positionalTokens.length - positionalsCount, 0) > requiredPositionals) {
573
+ resolveSinglePositionalValue(values, errors, rawArg, arg, schema, positional);
574
+ explicit[rawArg] = true;
575
+ positionalsCount++;
576
+ continue;
577
+ }
578
+ }
579
+ if (hasDefault(schema))
580
+ values[rawArg] = schema.default;
581
+ }
582
+ continue;
583
+ }
584
+ if (schema.required) {
585
+ if (!optionTokens.find((token) => {
586
+ return schema.short && token.name === schema.short && token.rawName != null && isShortOption(token.rawName) || checkLongTokenName(arg, schema, token);
587
+ })) {
588
+ errors.push(createRequireError(rawArg, arg, schema));
589
+ continue;
590
+ }
591
+ }
592
+ for (let i = 0;i < optionTokens.length; i++) {
593
+ const token = optionTokens[i];
594
+ if (checkLongTokenName(arg, schema, token) || schema.short === token.name && token.rawName != null && isShortOption(token.rawName)) {
595
+ const invalid = validateRequire(token, rawArg, arg, schema);
596
+ if (invalid) {
597
+ errors.push(invalid);
598
+ continue;
599
+ }
600
+ explicit[rawArg] = true;
601
+ const rawName = token.rawName;
602
+ const actualInputName = isShortOption(rawName) ? `-${token.name}` : rawName;
603
+ actualInputNames.set(rawArg, actualInputName);
604
+ const [parsedValue, error] = parse(token, rawArg, arg, schema);
605
+ if (error)
606
+ errors.push(error);
607
+ else if (schema.multiple) {
608
+ values[rawArg] ||= [];
609
+ values[rawArg].push(parsedValue);
610
+ } else
611
+ values[rawArg] = parsedValue;
612
+ }
613
+ }
614
+ if (values[rawArg] == null && schema.default != null)
615
+ values[rawArg] = schema.default;
616
+ }
617
+ const conflictErrors = checkConflicts(args, explicit, toKebab, actualInputNames);
618
+ errors.push(...conflictErrors);
619
+ return {
620
+ values,
621
+ positionals: positionalTokens.map((token) => token.value),
622
+ rest,
623
+ error: errors.length > 0 ? new AggregateError(errors) : undefined,
624
+ explicit
625
+ };
626
+ }
627
+ function parse(token, rawArg, option, schema) {
628
+ if (typeof schema.parse === "function") {
629
+ if (schema.type === "boolean") {
630
+ const boolValue = !(schema.negatable && token.name.startsWith("no-"));
631
+ return parseSchemaValue(String(boolValue), rawArg, option, schema);
632
+ }
633
+ return parseSchemaValue(token.value ?? String(schema.default ?? ""), rawArg, option, schema);
634
+ }
635
+ switch (schema.type) {
636
+ case "string":
637
+ return typeof token.value === "string" ? [token.value || schema.default, undefined] : [undefined, createTypeError(rawArg, option, schema, token.value)];
638
+ case "boolean":
639
+ return [!(schema.negatable && token.name.startsWith("no-")), undefined];
640
+ case "number":
641
+ if (!isNumeric(token.value))
642
+ return [undefined, createTypeError(rawArg, option, schema, token.value)];
643
+ return token.value ? [+token.value, undefined] : [+(schema.default || ""), undefined];
644
+ case "enum":
645
+ if (schema.choices && !schema.choices.includes(token.value))
646
+ return [undefined, createChoiceError(rawArg, option, schema, token.value)];
647
+ return [token.value || schema.default, undefined];
648
+ case "custom":
649
+ throw new TypeError(`argument '${option}' should have a 'parse' function`);
650
+ default:
651
+ throw new Error(`Unsupported argument type '${schema.type}' for option '${option}'`);
652
+ }
653
+ }
654
+ function parseSchemaValue(value, rawArg, option, schema) {
655
+ try {
656
+ return [schema.parse(value), undefined];
657
+ } catch (error) {
658
+ return [undefined, createCustomParseError(error, rawArg, option, schema, value)];
659
+ }
660
+ }
661
+ function createRequireError(rawArg, option, schema) {
662
+ return new ArgResolveError(schema.type === "positional" ? `Positional argument '${option}' is required` : `Optional argument ${createOptionDisplayName(option, schema)} is required`, option, "required", schema, {
663
+ code: schema.type === "positional" ? ArgsValidationErrorKeys.requiredPositional : ArgsValidationErrorKeys.requiredOption,
664
+ values: schema.type === "positional" ? { name: rawArg } : {
665
+ displayName: createOptionDisplayName(option, schema),
666
+ name: rawArg
667
+ }
668
+ });
669
+ }
670
+ function resolveSinglePositionalValue(values, errors, rawArg, option, schema, positional) {
671
+ if (typeof schema.parse === "function") {
672
+ const [parsedValue, error] = parseSchemaValue(positional.value, rawArg, option, schema);
673
+ if (error)
674
+ errors.push(error);
675
+ else
676
+ values[rawArg] = parsedValue;
677
+ } else
678
+ values[rawArg] = positional.value;
679
+ }
680
+ function hasDefault(schema) {
681
+ return schema.default != null;
682
+ }
683
+ function shouldRequireMissingSinglePositional(schema) {
684
+ if (schema.required === true)
685
+ return true;
686
+ if (schema.required === false)
687
+ return false;
688
+ return !hasDefault(schema);
689
+ }
690
+ function getRequiredPositionalInputCount(schema) {
691
+ if (schema.type !== "positional")
692
+ return 0;
693
+ if (schema.multiple)
694
+ return schema.required === true ? 1 : 0;
695
+ return shouldRequireMissingSinglePositional(schema) ? 1 : 0;
696
+ }
697
+ function createRequiredPositionalsAfter(argEntries) {
698
+ const requiredPositionalsAfter = Object.create(null);
699
+ let minimumRequiredPositionals = 0;
700
+ for (let i = argEntries.length - 1;i >= 0; i--) {
701
+ const [rawArg, schema] = argEntries[i];
702
+ if (schema.type !== "positional")
703
+ continue;
704
+ requiredPositionalsAfter[rawArg] = minimumRequiredPositionals;
705
+ minimumRequiredPositionals += getRequiredPositionalInputCount(schema);
706
+ }
707
+ return requiredPositionalsAfter;
708
+ }
709
+ var ArgResolveError = class extends ArgsValidationError {
710
+ name;
711
+ schema;
712
+ type;
713
+ constructor(message, name, type, schema, options = {}) {
714
+ super(message, options);
715
+ this.name = name;
716
+ this.type = type;
717
+ this.schema = schema;
718
+ }
719
+ };
720
+ function validateRequire(token, rawArg, option, schema) {
721
+ if (schema.required && schema.type !== "boolean" && !token.value)
722
+ return createRequireError(rawArg, option, schema);
723
+ }
724
+ function isNumeric(str) {
725
+ return str.trim() !== "" && !isNaN(str);
726
+ }
727
+ function createTypeError(rawArg, option, schema, actual) {
728
+ return new ArgResolveError(`Optional argument ${createOptionDisplayName(option, schema)} should be '${schema.type}'`, option, "type", schema, {
729
+ code: ArgsValidationErrorKeys.invalidType,
730
+ values: {
731
+ displayName: createOptionDisplayName(option, schema),
732
+ name: rawArg,
733
+ expected: schema.type,
734
+ ...actual != null ? { actual } : {}
735
+ }
736
+ });
737
+ }
738
+ function createChoiceError(rawArg, option, schema, actual) {
739
+ const choices = schema.choices ?? [];
740
+ return new ArgResolveError(`Optional argument ${createOptionDisplayName(option, schema)} should be chosen from '${schema.type}' [${formatChoices(choices)}] values`, option, "type", schema, {
741
+ code: ArgsValidationErrorKeys.invalidChoice,
742
+ values: {
743
+ displayName: createOptionDisplayName(option, schema),
744
+ name: rawArg,
745
+ expected: schema.type,
746
+ choices: formatChoices(choices),
747
+ choiceValues: [...choices],
748
+ ...actual != null ? { actual } : {}
749
+ }
750
+ });
751
+ }
752
+ function createCustomParseError(error, rawArg, option, schema, value) {
753
+ const reused = reuseValidationError(error, rawArg, option, schema, value);
754
+ if (reused)
755
+ return reused;
756
+ const reason = getErrorReason(error);
757
+ return new ArgsValidationError(reason, {
758
+ code: ArgsValidationErrorKeys.customParse,
759
+ values: {
760
+ displayName: createArgumentDisplayName(option, schema),
761
+ name: rawArg,
762
+ reason
763
+ },
764
+ cause: error
765
+ });
766
+ }
767
+ function reuseValidationError(error, rawArg, option, schema, value) {
768
+ try {
769
+ if (isArgsValidationError(error)) {
770
+ augmentValidationError(error, rawArg, option, schema, value);
771
+ return error;
772
+ }
773
+ } catch {}
774
+ }
775
+ function augmentValidationError(error, rawArg, option, schema, value) {
776
+ const values = error.values;
777
+ values.name ??= rawArg;
778
+ values.displayName ??= createArgumentDisplayName(option, schema);
779
+ if ((error.code === ArgsValidationErrorKeys.invalidType || error.code === ArgsValidationErrorKeys.invalidChoice) && values.actual == null)
780
+ values.actual = value;
781
+ }
782
+ function getErrorReason(error) {
783
+ return error instanceof Error ? error.message : String(error);
784
+ }
785
+ function createArgumentDisplayName(option, schema) {
786
+ return schema.type === "positional" ? `'${option}'` : createOptionDisplayName(option, schema);
787
+ }
788
+ function createOptionDisplayName(option, schema) {
789
+ return `'--${option}'${schema.short ? ` or '-${schema.short}'` : ""}`;
790
+ }
791
+ function checkConflicts(args, explicit, toKebab, actualInputNames) {
792
+ for (const rawArg in args) {
793
+ const schema = args[rawArg];
794
+ if (!explicit[rawArg])
795
+ continue;
796
+ if (!schema.conflicts)
797
+ continue;
798
+ const conflicts = Array.isArray(schema.conflicts) ? schema.conflicts : [schema.conflicts];
799
+ for (let i = 0;i < conflicts.length; i++) {
800
+ const conflictingArg = conflicts[i];
801
+ if (!explicit[conflictingArg])
802
+ continue;
803
+ const arg = toKebab || schema.toKebab ? kebabnize(rawArg) : rawArg;
804
+ const conflictingArgKebab = toKebab || args[conflictingArg]?.toKebab ? kebabnize(conflictingArg) : conflictingArg;
805
+ return [new ArgResolveError(`Optional argument '${actualInputNames.get(rawArg) || `--${arg}`}' conflicts with '${actualInputNames.get(conflictingArg) || `--${conflictingArgKebab}`}'`, rawArg, "conflict", schema)];
806
+ }
807
+ }
808
+ return [];
809
+ }
810
+
811
+ // node_modules/gunshi/lib/error-B5QxSzk9.js
812
+ var CommandNotFoundErrorKeys = { notFound: "err:cmd:not-found" };
813
+ var COMMAND_NOT_FOUND_ERROR_BRAND = Symbol.for("gunshi.CommandNotFoundError");
814
+ var CommandNotFoundError = class extends Error {
815
+ code;
816
+ values;
817
+ commandName;
818
+ candidates;
819
+ commandPath;
820
+ constructor(message, options) {
821
+ super(message, { cause: options.cause });
822
+ this.name = "CommandNotFoundError";
823
+ this.code = options.code;
824
+ this.values = options.values || {};
825
+ this.commandName = options.commandName;
826
+ this.candidates = options.candidates || [];
827
+ this.commandPath = options.commandPath || [];
828
+ Object.defineProperty(this, COMMAND_NOT_FOUND_ERROR_BRAND, {
829
+ value: true,
830
+ enumerable: false,
831
+ writable: false,
832
+ configurable: false
833
+ });
834
+ }
835
+ };
836
+ function isCommandNotFoundError(error) {
837
+ if (error instanceof CommandNotFoundError)
838
+ return true;
839
+ if (!isRecord(error) || !hasCommandNotFoundErrorShape(error))
840
+ return false;
841
+ if (Object.hasOwn(error, COMMAND_NOT_FOUND_ERROR_BRAND) && error[COMMAND_NOT_FOUND_ERROR_BRAND] === true)
842
+ return true;
843
+ return error instanceof Error && error.name === "CommandNotFoundError";
844
+ }
845
+ function isArgsValidationError2(error) {
846
+ if (error instanceof ArgsValidationError)
847
+ return true;
848
+ if (!isRecord(error) || !hasArgsValidationErrorShape(error))
849
+ return false;
850
+ if (isArgsValidationError(error))
851
+ return true;
852
+ return error instanceof Error && error.name === "ArgsValidationError";
853
+ }
854
+ function isRecord(value) {
855
+ return typeof value === "object" && value !== null;
856
+ }
857
+ function isStringArray(value) {
858
+ return Array.isArray(value) && value.every((item) => typeof item === "string");
859
+ }
860
+ function hasOptionalStringCode(error) {
861
+ return "code" in error && (error.code === undefined || typeof error.code === "string");
862
+ }
863
+ function hasCommandNotFoundErrorShape(error) {
864
+ return hasOptionalStringCode(error) && isRecord(error.values) && typeof error.commandName === "string" && isStringArray(error.candidates) && isStringArray(error.commandPath);
865
+ }
866
+ function hasArgsValidationErrorShape(error) {
867
+ return hasOptionalStringCode(error) && isRecord(error.values);
868
+ }
869
+ function hasPriorityValidationError(error) {
870
+ return error?.errors.some((error2) => isCommandNotFoundError(error2) || isArgsValidationError2(error2) && error2.code === ArgsValidationErrorKeys.unknownOption) ?? false;
871
+ }
872
+
873
+ // node_modules/gunshi/lib/core-CLzX86kY.js
874
+ var EMPTY_RENDERER = () => Promise.resolve("");
875
+ function createDecorators() {
876
+ const headerDecorators = [];
877
+ const usageDecorators = [];
878
+ const validationDecorators = [];
879
+ const commandDecorators = [];
880
+ function buildRenderer(decorators, defaultRenderer) {
881
+ if (decorators.length === 0)
882
+ return defaultRenderer;
883
+ let renderer = defaultRenderer;
884
+ for (const decorator of decorators) {
885
+ const previousRenderer = renderer;
886
+ renderer = (ctx) => decorator(previousRenderer, ctx);
887
+ }
888
+ return renderer;
889
+ }
890
+ return Object.freeze({
891
+ addHeaderDecorator(decorator) {
892
+ headerDecorators.push(decorator);
893
+ },
894
+ addUsageDecorator(decorator) {
895
+ usageDecorators.push(decorator);
896
+ },
897
+ addValidationErrorsDecorator(decorator) {
898
+ validationDecorators.push(decorator);
899
+ },
900
+ addCommandDecorator(decorator) {
901
+ commandDecorators.push(decorator);
902
+ },
903
+ get commandDecorators() {
904
+ return [...commandDecorators];
905
+ },
906
+ getHeaderRenderer() {
907
+ return buildRenderer(headerDecorators, EMPTY_RENDERER);
908
+ },
909
+ getUsageRenderer() {
910
+ return buildRenderer(usageDecorators, EMPTY_RENDERER);
911
+ },
912
+ getValidationErrorsRenderer() {
913
+ if (validationDecorators.length === 0)
914
+ return EMPTY_RENDERER;
915
+ let renderer = EMPTY_RENDERER;
916
+ for (const decorator of validationDecorators) {
917
+ const previousRenderer = renderer;
918
+ renderer = (ctx, error) => decorator(previousRenderer, ctx, error);
919
+ }
920
+ return renderer;
921
+ }
922
+ });
923
+ }
924
+ function createPluginContext(decorators, initialSubCommands) {
925
+ const globalOptions = /* @__PURE__ */ new Map;
926
+ const subCommands = new Map(initialSubCommands || []);
927
+ return Object.freeze({
928
+ get globalOptions() {
929
+ return new Map(globalOptions);
930
+ },
931
+ addGlobalOption(name, schema) {
932
+ if (!name)
933
+ throw new Error("Option name must be a non-empty string");
934
+ if (globalOptions.has(name))
935
+ throw new Error(`Global option '${name}' is already registered`);
936
+ globalOptions.set(name, schema);
937
+ },
938
+ get subCommands() {
939
+ return new Map(subCommands);
940
+ },
941
+ addCommand(name, command) {
942
+ if (!name)
943
+ throw new Error("Command name must be a non-empty string");
944
+ if (subCommands.has(name))
945
+ throw new Error(`Command '${name}' is already registered`);
946
+ subCommands.set(name, command);
947
+ },
948
+ hasCommand(name) {
949
+ return subCommands.has(name);
950
+ },
951
+ decorateHeaderRenderer(decorator) {
952
+ decorators.addHeaderDecorator(decorator);
953
+ },
954
+ decorateUsageRenderer(decorator) {
955
+ decorators.addUsageDecorator(decorator);
956
+ },
957
+ decorateValidationErrorsRenderer(decorator) {
958
+ decorators.addValidationErrorsDecorator(decorator);
959
+ },
960
+ decorateCommand(decorator) {
961
+ decorators.addCommandDecorator(decorator);
962
+ }
963
+ });
964
+ }
965
+ function resolveDependencies(plugins) {
966
+ const sorted = [];
967
+ const visited = /* @__PURE__ */ new Set;
968
+ const visiting = /* @__PURE__ */ new Set;
969
+ const pluginMap = /* @__PURE__ */ new Map;
970
+ for (const plugin of plugins)
971
+ if (plugin.id) {
972
+ if (pluginMap.has(plugin.id))
973
+ console.warn(`Duplicate plugin id detected: \`${plugin.id}\``);
974
+ pluginMap.set(plugin.id, plugin);
975
+ }
976
+ function visit(plugin) {
977
+ if (!plugin.id)
978
+ return;
979
+ if (visited.has(plugin.id))
980
+ return;
981
+ if (visiting.has(plugin.id))
982
+ throw new Error(`Circular dependency detected: \`${[...visiting].join(` -> `) + " -> " + plugin.id}\``);
983
+ visiting.add(plugin.id);
984
+ const deps = plugin.dependencies || [];
985
+ for (const dep of deps) {
986
+ const depId = typeof dep === "string" ? dep : dep.id;
987
+ const isOptional = typeof dep === "string" ? false : dep.optional || false;
988
+ const depPlugin = pluginMap.get(depId);
989
+ if (!depPlugin && !isOptional)
990
+ throw new Error(`Missing required dependency: \`${depId}\` on \`${plugin.id}\``);
991
+ if (depPlugin)
992
+ visit(depPlugin);
993
+ }
994
+ visiting.delete(plugin.id);
995
+ visited.add(plugin.id);
996
+ sorted.push(plugin);
997
+ }
998
+ for (const plugin of plugins)
999
+ visit(plugin);
1000
+ return sorted;
1001
+ }
1002
+ async function cliCore(argv, entry, options, plugins) {
1003
+ const decorators = createDecorators();
1004
+ const pluginContext = createPluginContext(decorators, createInitialSubCommands(options, entry));
1005
+ const resolvedPlugins = await applyPlugins(pluginContext, [...plugins, ...options.plugins || []]);
1006
+ const cliOptions = normalizeCliOptions(options, decorators, pluginContext);
1007
+ const tokens = parseArgs(argv);
1008
+ const resolved = resolveCommandTree(tokens, entry, cliOptions);
1009
+ const { commandName: name, command, callMode, commandPath, depth, levelSubCommands } = resolved;
1010
+ let targetCommand = command;
1011
+ let targetCommandName = name;
1012
+ let targetCallMode = callMode;
1013
+ let targetCommandPath = commandPath;
1014
+ let targetDepth = depth;
1015
+ let targetOmitted = resolved.omitted;
1016
+ let targetLevelSubCommands = levelSubCommands;
1017
+ const additionalValidationErrors = [];
1018
+ if (!targetCommand) {
1019
+ if (!resolved.parentCommand || !resolved.unresolvedCommandName)
1020
+ throw new Error(`Command not found: ${name || ""}`);
1021
+ targetCommand = resolved.parentCommand;
1022
+ targetCommandName = resolved.parentCommandName;
1023
+ targetCommandPath = resolved.parentCommandPath || [];
1024
+ targetDepth = targetCommandPath.length;
1025
+ targetCallMode = targetDepth > 0 ? "subCommand" : "entry";
1026
+ targetOmitted = false;
1027
+ targetLevelSubCommands = resolved.parentSubCommands;
1028
+ additionalValidationErrors.push(createCommandNotFoundError(resolved));
1029
+ }
1030
+ if (targetLevelSubCommands)
1031
+ cliOptions.subCommands = targetLevelSubCommands;
1032
+ const resolvedCommand = isLazyCommand(targetCommand) ? await resolveLazyCommand(targetCommand, targetCommandName, true) : targetCommand;
1033
+ const args = resolveArguments(pluginContext, getCommandArgs(resolvedCommand));
1034
+ const skipPositional = targetDepth > 0 ? targetDepth - 1 : -1;
1035
+ const { explicit, values, positionals, rest, error } = resolveArgs(args, tokens, {
1036
+ shortGrouping: true,
1037
+ toKebab: resolvedCommand.toKebab,
1038
+ skipPositional
1039
+ });
1040
+ const validationError = mergeValidationErrors(error, [...additionalValidationErrors, ...cliOptions.strict ? createUnknownOptionErrors(findUnknownOptions(args, tokens, { toKebab: resolvedCommand.toKebab })) : []]);
1041
+ return await executeCommand(resolvedCommand, await createCommandContext({
1042
+ args,
1043
+ explicit,
1044
+ values,
1045
+ positionals,
1046
+ rest,
1047
+ argv,
1048
+ tokens,
1049
+ omitted: targetOmitted,
1050
+ callMode: targetCallMode,
1051
+ commandPath: targetCommandPath,
1052
+ command: resolvedCommand,
1053
+ extensions: getPluginExtensions(resolvedPlugins),
1054
+ validationError,
1055
+ cliOptions
1056
+ }), decorators.commandDecorators);
1057
+ }
1058
+ async function applyPlugins(pluginContext, plugins) {
1059
+ const sortedPlugins = resolveDependencies(plugins);
1060
+ try {
1061
+ for (const plugin of sortedPlugins)
1062
+ await plugin(pluginContext);
1063
+ } catch (error) {
1064
+ console.error("Error loading plugin:", error.message);
1065
+ }
1066
+ return sortedPlugins;
1067
+ }
1068
+ function getCommandArgs(cmd) {
1069
+ if (isLazyCommand(cmd))
1070
+ return cmd.args || create();
1071
+ else if (typeof cmd === "object")
1072
+ return cmd.args || create();
1073
+ else
1074
+ return create();
1075
+ }
1076
+ function resolveArguments(pluginContext, args) {
1077
+ return Object.assign(create(), Object.fromEntries(pluginContext.globalOptions), args);
1078
+ }
1079
+ var NEGATABLE_OPTION_PREFIX = "no-";
1080
+ function findUnknownOptions(args, tokens, options) {
1081
+ const knownLongOptions = /* @__PURE__ */ new Set;
1082
+ const knownShortOptions = /* @__PURE__ */ new Set;
1083
+ const knownNegatableOptions = /* @__PURE__ */ new Set;
1084
+ const knownLongOptionCandidates = /* @__PURE__ */ new Set;
1085
+ const longOptionCandidates = [];
1086
+ function addLongOptionCandidate(name) {
1087
+ const candidate = `--${name}`;
1088
+ if (knownLongOptionCandidates.has(candidate))
1089
+ return;
1090
+ knownLongOptionCandidates.add(candidate);
1091
+ longOptionCandidates.push(candidate);
1092
+ }
1093
+ for (const [name, schema] of Object.entries(args)) {
1094
+ if (schema.type === "positional")
1095
+ continue;
1096
+ const optionName = resolveOptionName(name, schema, options);
1097
+ knownLongOptions.add(optionName);
1098
+ addLongOptionCandidate(optionName);
1099
+ if (schema.short)
1100
+ knownShortOptions.add(schema.short);
1101
+ if (schema.type === "boolean" && schema.negatable) {
1102
+ const negatableOptionName = `${NEGATABLE_OPTION_PREFIX}${optionName}`;
1103
+ knownNegatableOptions.add(negatableOptionName);
1104
+ addLongOptionCandidate(negatableOptionName);
1105
+ }
1106
+ }
1107
+ const unknownOptions = [];
1108
+ for (const token of tokens) {
1109
+ if (token.kind === "option-terminator")
1110
+ break;
1111
+ if (token.kind !== "option" || !token.name || !token.rawName)
1112
+ continue;
1113
+ const isLongOption2 = token.rawName.startsWith("--");
1114
+ if (isLongOption2) {
1115
+ if (knownLongOptions.has(token.name) || knownNegatableOptions.has(token.name))
1116
+ continue;
1117
+ } else if (knownShortOptions.has(token.name))
1118
+ continue;
1119
+ unknownOptions.push({
1120
+ rawName: token.rawName,
1121
+ name: token.name,
1122
+ candidates: isLongOption2 ? longOptionCandidates : []
1123
+ });
1124
+ }
1125
+ return unknownOptions;
1126
+ }
1127
+ function resolveOptionName(name, schema, options) {
1128
+ return options.toKebab || schema.toKebab ? kebabnize(name) : name;
1129
+ }
1130
+ function createUnknownOptionErrors(unknownOptions) {
1131
+ return unknownOptions.map(({ rawName, name, candidates }) => {
1132
+ return new ArgsValidationError(`Unknown option: ${rawName}`, {
1133
+ code: ArgsValidationErrorKeys.unknownOption,
1134
+ values: {
1135
+ rawName,
1136
+ name,
1137
+ candidates
1138
+ }
1139
+ });
1140
+ });
1141
+ }
1142
+ function mergeValidationErrors(error, additionalErrors) {
1143
+ if (additionalErrors.length === 0)
1144
+ return error;
1145
+ return new AggregateError(error ? [...error.errors, ...additionalErrors] : additionalErrors, error?.message || additionalErrors[0]?.message);
1146
+ }
1147
+ var isObject = (val) => val !== null && typeof val === "object";
1148
+ function createInitialSubCommands(options, entryCmd) {
1149
+ const hasSubCommands = options.subCommands ? options.subCommands instanceof Map ? options.subCommands.size > 0 : isObject(options.subCommands) && Object.keys(options.subCommands).length > 0 : false;
1150
+ const subCommands = new Map(options.subCommands instanceof Map ? options.subCommands : []);
1151
+ if (!(options.subCommands instanceof Map) && isObject(options.subCommands))
1152
+ for (const [name, cmd] of Object.entries(options.subCommands))
1153
+ subCommands.set(name, cmd);
1154
+ if (hasSubCommands) {
1155
+ if (isLazyCommand(entryCmd)) {
1156
+ const entryCopy = Object.assign((...args) => entryCmd(...args), entryCmd, { entry: true });
1157
+ subCommands.set(resolveEntryName(entryCopy), entryCopy);
1158
+ } else if (typeof entryCmd === "object") {
1159
+ const entryCopy = Object.assign(create(), entryCmd, { entry: true });
1160
+ subCommands.set(resolveEntryName(entryCopy), entryCopy);
1161
+ } else if (typeof entryCmd === "function") {
1162
+ const name = entryCmd.name || "(anonymous)";
1163
+ subCommands.set(name, {
1164
+ run: entryCmd,
1165
+ name,
1166
+ entry: true
1167
+ });
1168
+ }
1169
+ }
1170
+ return subCommands;
1171
+ }
1172
+ function normalizeCliOptions(options, decorators, pluginContext) {
1173
+ const subCommands = new Map(pluginContext.subCommands);
1174
+ const resolvedOptions = Object.assign(create(), CLI_OPTIONS_DEFAULT, options, { subCommands });
1175
+ if (resolvedOptions.renderHeader === undefined)
1176
+ resolvedOptions.renderHeader = decorators.getHeaderRenderer();
1177
+ if (resolvedOptions.renderUsage === undefined)
1178
+ resolvedOptions.renderUsage = decorators.getUsageRenderer();
1179
+ if (resolvedOptions.renderValidationErrors === undefined)
1180
+ resolvedOptions.renderValidationErrors = decorators.getValidationErrorsRenderer();
1181
+ return resolvedOptions;
1182
+ }
1183
+ function getPositionalTokens(tokens) {
1184
+ return tokens.filter((t) => t.kind === "positional").map((t) => t.value).filter((v) => !!v);
1185
+ }
1186
+ function resolveCommandTree(tokens, entry, options) {
1187
+ const positionals = getPositionalTokens(tokens);
1188
+ function resolveAsEntry() {
1189
+ if (typeof entry === "function") {
1190
+ if ("commandName" in entry && entry.commandName)
1191
+ return {
1192
+ commandName: entry.commandName,
1193
+ command: entry,
1194
+ callMode: "entry",
1195
+ commandPath: [],
1196
+ depth: 0,
1197
+ omitted: options.subCommands.size > 0 && !positionals[0],
1198
+ levelSubCommands: options.subCommands.size > 0 ? options.subCommands : undefined
1199
+ };
1200
+ else
1201
+ return {
1202
+ command: {
1203
+ run: entry,
1204
+ entry: true
1205
+ },
1206
+ callMode: "entry",
1207
+ commandPath: [],
1208
+ depth: 0,
1209
+ omitted: options.subCommands.size > 0 && !positionals[0],
1210
+ levelSubCommands: options.subCommands.size > 0 ? options.subCommands : undefined
1211
+ };
1212
+ } else if (typeof entry === "object")
1213
+ return {
1214
+ commandName: resolveEntryName(entry),
1215
+ command: entry,
1216
+ callMode: "entry",
1217
+ commandPath: [],
1218
+ depth: 0,
1219
+ omitted: options.subCommands.size > 0 && !positionals[0],
1220
+ levelSubCommands: options.subCommands.size > 0 ? options.subCommands : undefined
1221
+ };
1222
+ else
1223
+ return {
1224
+ callMode: "unexpected",
1225
+ commandPath: [],
1226
+ depth: 0,
1227
+ omitted: false,
1228
+ levelSubCommands: undefined
1229
+ };
1230
+ }
1231
+ if (positionals.length === 0 || options.subCommands.size === 0)
1232
+ return resolveAsEntry();
1233
+ let currentSubCommands = options.subCommands;
1234
+ let resolvedCommand;
1235
+ let resolvedName;
1236
+ const commandPath = [];
1237
+ let depth = 0;
1238
+ for (let i = 0;i < positionals.length; i++) {
1239
+ const token = positionals[i];
1240
+ const cmd = currentSubCommands.get(token);
1241
+ if (cmd == null) {
1242
+ if (depth === 0) {
1243
+ if (options.fallbackToEntry)
1244
+ return resolveAsEntry();
1245
+ const parent = resolveAsEntry();
1246
+ return {
1247
+ commandName: token,
1248
+ callMode: "unexpected",
1249
+ commandPath: [],
1250
+ depth: 0,
1251
+ omitted: false,
1252
+ levelSubCommands: undefined,
1253
+ unresolvedCommandName: token,
1254
+ parentCommand: parent.command,
1255
+ parentCommandName: parent.commandName,
1256
+ parentCommandPath: [],
1257
+ parentSubCommands: options.subCommands
1258
+ };
1259
+ }
1260
+ return {
1261
+ commandName: token,
1262
+ callMode: "unexpected",
1263
+ commandPath: [...commandPath],
1264
+ depth,
1265
+ omitted: false,
1266
+ levelSubCommands: undefined,
1267
+ unresolvedCommandName: token,
1268
+ parentCommand: resolvedCommand,
1269
+ parentCommandName: resolvedName,
1270
+ parentCommandPath: [...commandPath],
1271
+ parentSubCommands: currentSubCommands
1272
+ };
1273
+ }
1274
+ let resolved = cmd;
1275
+ if (typeof cmd === "function" && cmd.commandName == null)
1276
+ resolved = Object.assign((...args) => cmd(...args), cmd, { commandName: token });
1277
+ else if (typeof cmd === "object" && cmd.name == null)
1278
+ resolved = Object.assign(create(), cmd, { name: token });
1279
+ resolvedCommand = resolved;
1280
+ resolvedName = token;
1281
+ commandPath.push(token);
1282
+ depth++;
1283
+ const nestedSubCommands = getCommandSubCommands(cmd);
1284
+ if (nestedSubCommands && nestedSubCommands.size > 0)
1285
+ currentSubCommands = nestedSubCommands;
1286
+ else
1287
+ break;
1288
+ }
1289
+ if (!resolvedCommand)
1290
+ return resolveAsEntry();
1291
+ const resolvedSubCommands = getCommandSubCommands(resolvedCommand);
1292
+ const omitted = resolvedSubCommands != null && resolvedSubCommands.size > 0;
1293
+ let levelSubCommands;
1294
+ if (omitted && resolvedSubCommands) {
1295
+ levelSubCommands = new Map(resolvedSubCommands);
1296
+ let entryCopy;
1297
+ if (typeof resolvedCommand === "function")
1298
+ entryCopy = Object.assign((...args) => resolvedCommand(...args), resolvedCommand, { entry: true });
1299
+ else
1300
+ entryCopy = Object.assign(create(), resolvedCommand, { entry: true });
1301
+ levelSubCommands.set(resolvedName || resolveEntryName(entryCopy), entryCopy);
1302
+ }
1303
+ return {
1304
+ commandName: resolvedName,
1305
+ command: resolvedCommand,
1306
+ callMode: depth > 0 ? "subCommand" : "entry",
1307
+ commandPath,
1308
+ depth,
1309
+ omitted,
1310
+ levelSubCommands
1311
+ };
1312
+ }
1313
+ function createCommandNotFoundError(resolved) {
1314
+ const commandName = resolved.unresolvedCommandName || resolved.commandName || "";
1315
+ return new CommandNotFoundError(`Command not found: ${commandName}`, {
1316
+ code: CommandNotFoundErrorKeys.notFound,
1317
+ values: { commandName },
1318
+ commandName,
1319
+ candidates: [...resolved.parentSubCommands?.keys() || []],
1320
+ commandPath: resolved.parentCommandPath || []
1321
+ });
1322
+ }
1323
+ function resolveEntryName(entry) {
1324
+ return isLazyCommand(entry) ? entry.commandName || "(anonymous)" : entry.name || "(anonymous)";
1325
+ }
1326
+ function getPluginExtensions(plugins) {
1327
+ const extensions = create();
1328
+ for (const plugin of plugins)
1329
+ if (plugin.extension) {
1330
+ const key = plugin.id;
1331
+ if (extensions[key])
1332
+ console.warn(`Plugin "${key}" is already installed. Ignore it for command context extending.`);
1333
+ else
1334
+ extensions[key] = plugin.extension;
1335
+ }
1336
+ return extensions;
1337
+ }
1338
+ async function executeCommand(cmd, ctx, decorators) {
1339
+ const commandRunner = cmd.run || NOOP;
1340
+ const baseRunner = (ctx2) => {
1341
+ if (hasPriorityValidationError(ctx2.validationError))
1342
+ throw ctx2.validationError;
1343
+ return commandRunner(ctx2);
1344
+ };
1345
+ const decoratedRunner = decorators.reduceRight((runner, decorator) => decorator(runner), baseRunner);
1346
+ try {
1347
+ if (ctx.env.onBeforeCommand)
1348
+ await ctx.env.onBeforeCommand(ctx);
1349
+ const result = await decoratedRunner(ctx);
1350
+ if (ctx.env.onAfterCommand)
1351
+ await ctx.env.onAfterCommand(ctx, result);
1352
+ return typeof result === "string" ? result : undefined;
1353
+ } catch (error) {
1354
+ if (ctx.env.onErrorCommand)
1355
+ try {
1356
+ await ctx.env.onErrorCommand(ctx, error);
1357
+ } catch (hookError) {
1358
+ console.error("Error in onErrorCommand hook:", hookError);
1359
+ }
1360
+ throw error;
1361
+ }
1362
+ }
1363
+
1364
+ // node_modules/gunshi/lib/bone.js
1365
+ async function cli(args, entry, options = {}) {
1366
+ return cliCore(args, entry, options, []);
1367
+ }
1368
+
1369
+ // src/cli/main.ts
1370
+ var import_picocolors2 = __toESM(require_picocolors(), 1);
1371
+ // package.json
1372
+ var package_default = {
1373
+ name: "@jordond/kit",
1374
+ version: "0.2.0",
1375
+ description: "One dev toolkit for every app: CLI, shared fastlane, Gradle conventions",
1376
+ license: "MIT",
1377
+ type: "module",
1378
+ repository: {
1379
+ type: "git",
1380
+ url: "git+https://github.com/jordond/kit.git"
1381
+ },
1382
+ bin: {
1383
+ kit: "bin/kit"
1384
+ },
1385
+ exports: {
1386
+ ".": {
1387
+ types: "./dist/index.d.ts",
1388
+ default: "./dist/index.js"
1389
+ }
1390
+ },
1391
+ files: [
1392
+ "bin",
1393
+ "dist",
1394
+ "fastlane",
1395
+ "gradle/maven",
1396
+ "templates"
1397
+ ],
1398
+ engines: {
1399
+ bun: ">=1.3"
1400
+ },
1401
+ scripts: {
1402
+ build: "rm -rf dist && bun build src/cli.ts src/index.ts --outdir dist --target bun --splitting --external zod && tsc -p tsconfig.build.json",
1403
+ "build:gradle": "gradle/gradlew -p gradle publishKit",
1404
+ dev: "bun src/cli.ts",
1405
+ test: "bun test",
1406
+ "test:pack": "KIT_PACK_TEST=1 bun test test/pack",
1407
+ typecheck: "tsc --noEmit",
1408
+ lint: "biome check .",
1409
+ format: "biome format --write ."
1410
+ },
1411
+ publishConfig: {
1412
+ access: "public"
1413
+ },
1414
+ peerDependencies: {
1415
+ zod: "^4.0.0"
1416
+ },
1417
+ dependencies: {
1418
+ "@clack/prompts": "^1.9.0",
1419
+ gunshi: "0.37.3",
1420
+ "@gunshi/plugin-completion": "0.37.3",
1421
+ listr2: "^11.4.1",
1422
+ picocolors: "^1.1.1",
1423
+ "smol-toml": "^1.9.1"
1424
+ },
1425
+ devDependencies: {
1426
+ "@biomejs/biome": "^2.6.6",
1427
+ "@types/bun": "^1.4.4",
1428
+ typescript: "^7.0.2",
1429
+ zod: "^4.6.7"
1430
+ }
1431
+ };
1432
+
1433
+ // src/config/load.ts
1434
+ import { existsSync } from "fs";
1435
+ import { dirname, join } from "path";
1436
+ import { pathToFileURL } from "url";
1437
+
1438
+ // src/config/schema.ts
1439
+ import { z } from "zod";
1440
+ var verbs = ["lint", "format", "typecheck", "test", "build", "dev", "deploy"];
1441
+ var kinds = ["gradle", "worker", "vite", "astro", "docker", "custom"];
1442
+ var tracks = ["internal", "alpha", "beta", "prod"];
1443
+ var command = z.union([z.string(), z.array(z.string()), z.literal(false)]);
1444
+ var verbOverrides = Object.fromEntries(verbs.map((v) => [v, command.optional()]));
1445
+ var deploy = z.union([
1446
+ command,
1447
+ z.object({
1448
+ run: command.optional(),
1449
+ before: z.array(z.string()).optional()
1450
+ }).strict()
1451
+ ]);
1452
+ var target = z.object({
1453
+ kind: z.enum(kinds),
1454
+ dir: z.string(),
1455
+ envs: z.array(z.string()).optional(),
1456
+ ...verbOverrides,
1457
+ deploy: deploy.optional()
1458
+ }).strict();
1459
+ var workspace = z.object({
1460
+ ...verbOverrides,
1461
+ prepare: command.optional()
1462
+ }).strict();
1463
+ var configSchema = z.object({
1464
+ name: z.string().min(1),
1465
+ gradle: z.object({
1466
+ root: z.string(),
1467
+ init: z.union([z.string(), z.array(z.string())]).optional()
1468
+ }).strict().optional(),
1469
+ versions: z.object({
1470
+ file: z.string(),
1471
+ keys: z.record(z.string(), z.string())
1472
+ }).strict().optional(),
1473
+ env: z.object({
1474
+ schema: z.string().optional(),
1475
+ outputs: z.record(z.string(), z.object({
1476
+ pick: z.array(z.string()).optional(),
1477
+ rename: z.record(z.string(), z.string()).optional(),
1478
+ vars: z.record(z.string(), z.string()).optional()
1479
+ }).strict()).optional(),
1480
+ workerSecrets: z.record(z.string(), z.array(z.string())).optional(),
1481
+ githubSecrets: z.array(z.string()).optional()
1482
+ }).strict().optional(),
1483
+ workspace: workspace.optional(),
1484
+ targets: z.record(z.string(), target).default({}),
1485
+ cloudflare: z.object({
1486
+ accountId: z.string().optional(),
1487
+ d1: z.record(z.string(), z.object({
1488
+ name: z.string(),
1489
+ target: z.string(),
1490
+ default: z.boolean().optional()
1491
+ }).strict()).optional()
1492
+ }).strict().optional(),
1493
+ release: z.object({
1494
+ branches: z.array(z.string()).optional(),
1495
+ fastlaneDir: z.string().optional(),
1496
+ notes: z.object({ maxLength: z.number().int().positive().optional() }).strict().optional(),
1497
+ preflight: z.array(z.string()).optional(),
1498
+ ios: z.object({
1499
+ bundleIds: z.array(z.string()).min(1),
1500
+ project: z.string(),
1501
+ scheme: z.string(),
1502
+ output: z.string(),
1503
+ teamId: z.string().optional(),
1504
+ testflightGroups: z.object({ alpha: z.string(), beta: z.string() }).partial().optional(),
1505
+ sentry: z.object({ org: z.string(), project: z.string() }).strict().optional()
1506
+ }).strict().optional(),
1507
+ android: z.object({
1508
+ packageName: z.string(),
1509
+ module: z.string(),
1510
+ prodRollout: z.number().gt(0).lte(1).optional(),
1511
+ gates: z.array(z.object({
1512
+ task: z.string(),
1513
+ tracks: z.array(z.enum(tracks))
1514
+ })).optional()
1515
+ }).strict().optional(),
1516
+ services: z.record(z.string(), z.object({ versionKey: z.string(), build: z.string().optional(), deploy: z.string() }).strict()).optional()
1517
+ }).strict().optional()
1518
+ }).strict().superRefine((c, ctx) => {
1519
+ for (const [name, d] of Object.entries(c.cloudflare?.d1 ?? {})) {
1520
+ if (!c.targets[d.target]) {
1521
+ ctx.addIssue({
1522
+ code: "custom",
1523
+ path: ["cloudflare", "d1", name, "target"],
1524
+ message: `Unknown target "${d.target}"`
1525
+ });
1526
+ }
1527
+ }
1528
+ const defaults = Object.entries(c.cloudflare?.d1 ?? {}).filter(([, d]) => d.default);
1529
+ if (defaults.length > 1) {
1530
+ ctx.addIssue({
1531
+ code: "custom",
1532
+ path: ["cloudflare", "d1"],
1533
+ message: `Only one database can be the default (${defaults.map(([k]) => k).join(", ")})`
1534
+ });
1535
+ }
1536
+ if (c.targets.workspace) {
1537
+ ctx.addIssue({ code: "custom", path: ["targets", "workspace"], message: '"workspace" is reserved' });
1538
+ }
1539
+ });
1540
+
1541
+ // src/config/load.ts
1542
+ var CONFIG_FILE = "kit.config.ts";
1543
+ function findRoot(from = process.cwd()) {
1544
+ if (process.env.KIT_ROOT && existsSync(join(process.env.KIT_ROOT, CONFIG_FILE)))
1545
+ return process.env.KIT_ROOT;
1546
+ let dir = from;
1547
+ while (true) {
1548
+ if (existsSync(join(dir, CONFIG_FILE)))
1549
+ return dir;
1550
+ const parent = dirname(dir);
1551
+ if (parent === dir)
1552
+ return;
1553
+ dir = parent;
1554
+ }
1555
+ }
1556
+ async function loadDotEnv(root) {
1557
+ const file = Bun.file(join(root, ".env"));
1558
+ if (!await file.exists())
1559
+ return;
1560
+ for (const line of (await file.text()).split(`
1561
+ `)) {
1562
+ const m = line.match(/^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*?)\s*$/);
1563
+ if (!m)
1564
+ continue;
1565
+ const [, key, raw] = m;
1566
+ if (process.env[key] !== undefined)
1567
+ continue;
1568
+ process.env[key] = raw.replace(/^(['"])(.*)\1$/, "$2");
1569
+ }
1570
+ }
1571
+ async function loadConfig(root) {
1572
+ const mod = await import(pathToFileURL(join(root, CONFIG_FILE)).href);
1573
+ const result = configSchema.safeParse(mod.default);
1574
+ if (!result.success) {
1575
+ const issues = result.error.issues.map((i) => ` ${i.path.join(".") || "(root)"}: ${i.message}`).join(`
1576
+ `);
1577
+ throw new KitError(`Invalid ${CONFIG_FILE}:
1578
+ ${issues}`, "Fix the fields above", ExitCode.config);
1579
+ }
1580
+ return result.data;
1581
+ }
1582
+
1583
+ // src/cli/discover.ts
1584
+ import { join as join2 } from "path";
1585
+ import { pathToFileURL as pathToFileURL2 } from "url";
1586
+ function listRepoCommands(root) {
1587
+ const dir = join2(root, ".kit", "commands");
1588
+ const glob = new Bun.Glob("**/*.ts");
1589
+ const out = [];
1590
+ try {
1591
+ for (const rel of glob.scanSync({ cwd: dir, onlyFiles: true })) {
1592
+ if (rel.endsWith(".d.ts") || rel.split("/").some((s) => s.startsWith("_")))
1593
+ continue;
1594
+ out.push({ path: rel.replace(/\.ts$/, "").split("/"), file: join2(dir, rel) });
1595
+ }
1596
+ } catch {
1597
+ return [];
1598
+ }
1599
+ return out.sort((a, b) => a.path.join(" ").localeCompare(b.path.join(" ")));
1600
+ }
1601
+ async function importRepoCommand(f) {
1602
+ const mod = await import(pathToFileURL2(f.file).href);
1603
+ const cmd = mod.default;
1604
+ if (!cmd || typeof cmd.run !== "function") {
1605
+ throw new KitError(`${f.file} does not default-export a command`, "export default defineCommand({ description, run })");
1606
+ }
1607
+ return cmd;
1608
+ }
1609
+
1610
+ // node_modules/gunshi/lib/plugin-DneW3Toi.js
1611
+ var NOOP_EXTENSION = () => {
1612
+ return Object.create(null);
1613
+ };
1614
+ function plugin(options = {}) {
1615
+ const { id, name, setup, onExtension, dependencies } = options;
1616
+ const extension = options.extension || NOOP_EXTENSION;
1617
+ const pluginFn = async (ctx) => {
1618
+ if (setup)
1619
+ await setup(ctx);
1620
+ };
1621
+ const props = {
1622
+ writable: false,
1623
+ enumerable: true,
1624
+ configurable: true
1625
+ };
1626
+ return Object.defineProperties(pluginFn, {
1627
+ id: {
1628
+ value: id,
1629
+ ...props
1630
+ },
1631
+ ...name && { name: {
1632
+ value: name,
1633
+ ...props
1634
+ } },
1635
+ ...dependencies && { dependencies: {
1636
+ value: dependencies,
1637
+ ...props
1638
+ } },
1639
+ ...extension && { extension: {
1640
+ value: {
1641
+ key: Symbol(id),
1642
+ factory: extension,
1643
+ onFactory: onExtension
1644
+ },
1645
+ ...props
1646
+ } }
1647
+ });
1648
+ }
1649
+
1650
+ // src/cli/plugin.ts
1651
+ var SHOW_USAGE = Symbol("kit.showUsage");
1652
+ function kitGlobals(version, renderUsage) {
1653
+ return plugin({
1654
+ id: "kit:globals",
1655
+ name: "kit global options",
1656
+ setup(ctx) {
1657
+ ctx.addGlobalOption("help", { type: "boolean", short: "h", description: "Show help" });
1658
+ ctx.addGlobalOption("version", { type: "boolean", short: "V", description: "Show kit version" });
1659
+ ctx.decorateCommand((run) => async (c) => {
1660
+ if (c.values.version) {
1661
+ process.stdout.write(`${version}
1662
+ `);
1663
+ return;
1664
+ }
1665
+ if (c.values.help || c.callMode === "entry") {
1666
+ process.stdout.write(`${await renderUsage(c)}
1667
+ `);
1668
+ return;
1669
+ }
1670
+ if (c.validationError) {
1671
+ const msgs = c.validationError.errors.map((e) => e.message).join(`
1672
+ `);
1673
+ throw new KitError(msgs, `Run \`kit ${c.commandPath.join(" ")} --help\``, ExitCode.usage);
1674
+ }
1675
+ try {
1676
+ return await run(c);
1677
+ } catch (e) {
1678
+ if (e !== SHOW_USAGE)
1679
+ throw e;
1680
+ process.stdout.write(`${await renderUsage(c)}
1681
+ `);
1682
+ }
1683
+ });
1684
+ }
1685
+ });
1686
+ }
1687
+
1688
+ // src/cli/usage.ts
1689
+ var import_picocolors = __toESM(require_picocolors(), 1);
1690
+ var GROUP_ORDER = ["Develop", "Quality", "Release", "Infra", "Setup"];
1691
+ function lookup(ctx) {
1692
+ let level = ctx.env.subCommands;
1693
+ let cmd;
1694
+ for (const seg of ctx.commandPath ?? []) {
1695
+ cmd = level?.get(seg);
1696
+ const next = cmd?.subCommands;
1697
+ level = next ? new Map(Object.entries(next)) : undefined;
1698
+ }
1699
+ return { cmd, children: level ?? new Map };
1700
+ }
1701
+ async function renderUsage(ctx) {
1702
+ const path = ["kit", ...ctx.commandPath ?? []].join(" ");
1703
+ const lines = [];
1704
+ if (ctx.description)
1705
+ lines.push(ctx.description, "");
1706
+ const { cmd: self, children } = lookup(ctx);
1707
+ const hasRun = typeof ctx === "object" && ctx.commandPath.length > 0;
1708
+ const positionals = Object.entries(ctx.args ?? {}).filter(([, a]) => a.type === "positional").map(([name]) => ` <${name}>`).join("");
1709
+ const tail = self?.passthrough ? " [args\u2026]" : `${children.size ? " <command>" : ""}${positionals} [options]`;
1710
+ lines.push(import_picocolors.default.bold("Usage"), ` ${import_picocolors.default.cyan(path)}${tail}`, "");
1711
+ if (self?.passthrough) {
1712
+ lines.push("Every argument passes through untouched; kit parses no flags here (no --json).", `Only a leading -h/--help shows this; \`${path} <args> --help\` reaches the tool.`, "");
1713
+ }
1714
+ const examples = typeof self?.examples === "string" ? self.examples : "";
1715
+ if (examples) {
1716
+ lines.push(import_picocolors.default.bold("Examples"));
1717
+ for (const e of examples.split(`
1718
+ `))
1719
+ lines.push(` ${e.startsWith("#") ? import_picocolors.default.dim(e) : e}`);
1720
+ lines.push("");
1721
+ }
1722
+ if (children.size) {
1723
+ const groups = new Map;
1724
+ for (const [name, cmd] of children) {
1725
+ if (cmd.internal || cmd.entry || name === ctx.env.name)
1726
+ continue;
1727
+ const g = ctx.commandPath.length ? "Commands" : cmd.group ?? "Other";
1728
+ groups.set(g, [...groups.get(g) ?? [], [name, cmd]]);
1729
+ }
1730
+ const order = [...groups.keys()].sort((a, b) => {
1731
+ const ia = GROUP_ORDER.indexOf(a);
1732
+ const ib = GROUP_ORDER.indexOf(b);
1733
+ return (ia < 0 ? 99 : ia) - (ib < 0 ? 99 : ib) || a.localeCompare(b);
1734
+ });
1735
+ const width = Math.max(...[...children.keys()].map((n) => n.length)) + 2;
1736
+ for (const g of order) {
1737
+ lines.push(import_picocolors.default.bold(g));
1738
+ for (const [name, cmd] of groups.get(g) ?? []) {
1739
+ const more = cmd.subCommands ? import_picocolors.default.dim(" \u2026") : "";
1740
+ lines.push(` ${import_picocolors.default.cyan(name.padEnd(width))}${cmd.description ?? ""}${more}`);
1741
+ }
1742
+ lines.push("");
1743
+ }
1744
+ }
1745
+ const args = Object.entries(ctx.args ?? {});
1746
+ if (args.length && (hasRun || !children.size) && !self?.passthrough) {
1747
+ lines.push(import_picocolors.default.bold("Options"));
1748
+ const rows = args.map(([name, a]) => {
1749
+ const flag = a.type === "positional" ? `<${name}>` : `${a.short ? `-${a.short}, ` : " "}--${name}`;
1750
+ const value = a.type === "string" || a.type === "number" || a.type === "enum" ? ` <${a.type}>` : "";
1751
+ return [`${flag}${value}`, a.description ?? ""];
1752
+ });
1753
+ const w = Math.max(...rows.map(([f]) => f.length)) + 2;
1754
+ for (const [f, d] of rows)
1755
+ lines.push(` ${f.padEnd(w)}${import_picocolors.default.dim(d)}`);
1756
+ lines.push("");
1757
+ }
1758
+ return lines.join(`
1759
+ `);
1760
+ }
1761
+
1762
+ // src/cli/main.ts
1763
+ var SHELLS = ["zsh", "bash", "fish"];
1764
+ function commandTokens(argv) {
1765
+ const out = [];
1766
+ for (const a of argv) {
1767
+ if (a === "--" || a.startsWith("-"))
1768
+ break;
1769
+ out.push(a);
1770
+ }
1771
+ return out;
1772
+ }
1773
+ var same = (a, b) => a.length === b.length && a.every((s, i) => s === b[i]);
1774
+ var startsWith = (a, prefix) => prefix.every((s, i) => a[i] === s);
1775
+ async function collectLeaves(root, config) {
1776
+ const appName = config?.name;
1777
+ const leaves = builtins.map((b) => ({
1778
+ path: b.path,
1779
+ description: b.description,
1780
+ group: b.group,
1781
+ source: "builtin",
1782
+ load: async () => (await b.load()).default
1783
+ }));
1784
+ if (!root)
1785
+ return leaves;
1786
+ for (const name of Object.keys(config?.release?.services ?? {})) {
1787
+ if (leaves.some((l) => l.path[0] === "release" && l.path[1] === name))
1788
+ continue;
1789
+ leaves.push({
1790
+ path: ["release", name],
1791
+ description: `Release the ${name} service`,
1792
+ group: "Release",
1793
+ source: "builtin",
1794
+ load: async () => (await import("./service-xekpd27p.js")).serviceCommand(name)
1795
+ });
1796
+ }
1797
+ for (const f of listRepoCommands(root)) {
1798
+ leaves.push({
1799
+ path: f.path,
1800
+ description: "",
1801
+ group: appName ?? "Repo",
1802
+ source: "repo",
1803
+ load: () => importRepoCommand(f)
1804
+ });
1805
+ }
1806
+ return leaves;
1807
+ }
1808
+ function buildTree(leaves, loaded, rt, depth = 0) {
1809
+ const tree = {};
1810
+ const names = [...new Set(leaves.map((l) => l.path[depth]))];
1811
+ for (const name of names) {
1812
+ const here = leaves.filter((l) => l.path[depth] === name);
1813
+ const atDepth = here.filter((l) => l.path.length === depth + 1);
1814
+ const leaf = atDepth.find((l) => l.source === "repo" && (l.override || loaded.get(l)?.override)) ?? atDepth[0];
1815
+ const children = here.filter((l) => l.path.length > depth + 1);
1816
+ const loadedCmd = leaf ? loaded.get(leaf) : undefined;
1817
+ const base = loadedCmd ? toGunshi(name, loadedCmd, rt) : {
1818
+ name,
1819
+ description: leaf ? leaf.description || loaded.get(leaf)?.description : groupDescriptions[name] ?? "",
1820
+ group: leaf?.group ?? here[0]?.group,
1821
+ run: () => {
1822
+ throw SHOW_USAGE;
1823
+ }
1824
+ };
1825
+ if (children.length)
1826
+ base.subCommands = buildTree(children, loaded, rt, depth + 1);
1827
+ tree[name] = base;
1828
+ }
1829
+ return tree;
1830
+ }
1831
+ function suggest(token, candidates) {
1832
+ const dist = (a, b) => {
1833
+ const d = Array.from({ length: a.length + 1 }, (_, i) => [i, ...Array(b.length).fill(0)]);
1834
+ for (let j = 1;j <= b.length; j++)
1835
+ d[0][j] = j;
1836
+ for (let i = 1;i <= a.length; i++)
1837
+ for (let j = 1;j <= b.length; j++)
1838
+ d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + (a[i - 1] === b[j - 1] ? 0 : 1));
1839
+ return d[a.length][b.length];
1840
+ };
1841
+ const best = candidates.map((c) => [c, dist(token, c)]).sort((x, y) => x[1] - y[1])[0];
1842
+ return best && best[1] <= 2 ? best[0] : undefined;
1843
+ }
1844
+ async function main(argv) {
1845
+ const root = findRoot();
1846
+ let config;
1847
+ if (root) {
1848
+ await loadDotEnv(root);
1849
+ config = await loadConfig(root);
1850
+ }
1851
+ const rt = { root, config };
1852
+ const leaves = await collectLeaves(root, config);
1853
+ const tokens = commandTokens(argv);
1854
+ const wantsHelp = argv.includes("--help") || argv.includes("-h");
1855
+ const script = tokens[0] === "completion" && SHELLS.includes(tokens[1] ?? "") && !wantsHelp;
1856
+ if (tokens[0] === "complete" || script) {
1857
+ const { default: completion } = await import("./index-erv82p4z.js");
1858
+ const all = new Map;
1859
+ await Promise.all(leaves.map(async (l) => all.set(l, await l.load())));
1860
+ if (script)
1861
+ Object.defineProperty(process, "execPath", { value: "kit", configurable: true });
1862
+ await cli(script ? ["complete", tokens[1]] : argv, { name: "kit", run: () => {} }, {
1863
+ name: "kit",
1864
+ version: package_default.version,
1865
+ subCommands: buildTree(leaves, all, rt),
1866
+ renderUsage: null,
1867
+ renderHeader: null,
1868
+ plugins: [completion()]
1869
+ });
1870
+ return 0;
1871
+ }
1872
+ const matches = leaves.filter((l) => startsWith(tokens, l.path)).sort((a, b) => b.path.length - a.path.length);
1873
+ const loaded = new Map;
1874
+ let target2;
1875
+ const longest = matches[0]?.path.length;
1876
+ for (const m of matches.filter((x) => x.path.length === longest)) {
1877
+ const cmd = await m.load();
1878
+ if (target2 && target2.source === "builtin" && m.source === "repo" && !cmd.override) {
1879
+ throw new KitError(`.kit/commands/${m.path.join("/")}.ts conflicts with built-in \`kit ${m.path.join(" ")}\``, "Rename it, or set `override: true` to replace the built-in", ExitCode.usage);
1880
+ }
1881
+ if (!target2 || m.source === "repo" && cmd.override) {
1882
+ if (target2)
1883
+ loaded.delete(target2);
1884
+ target2 = m;
1885
+ loaded.set(m, cmd);
1886
+ }
1887
+ }
1888
+ const picked = target2 && loaded.get(target2);
1889
+ if (target2 && picked?.passthrough) {
1890
+ const rest = argv.slice(target2.path.length);
1891
+ if (rest[0] !== "-h" && rest[0] !== "--help") {
1892
+ await picked.run(withBuiltin({ root, config, args: {}, positionals: [], rest, flags: computeFlags({}), log }));
1893
+ return process.exitCode === undefined ? 0 : Number(process.exitCode);
1894
+ }
1895
+ }
1896
+ if (!target2 || wantsHelp) {
1897
+ const level = leaves.filter((l) => l.source === "repo" && startsWith(l.path, tokens.slice(0, l.path.length - 1)));
1898
+ await Promise.all(level.map(async (l) => loaded.set(l, await l.load())));
1899
+ for (const l of level) {
1900
+ l.description = loaded.get(l)?.description ?? "";
1901
+ l.override = loaded.get(l)?.override;
1902
+ }
1903
+ if (!target2)
1904
+ for (const l of level)
1905
+ loaded.delete(l);
1906
+ }
1907
+ if (!target2 && tokens.length) {
1908
+ let i = 0;
1909
+ while (i < tokens.length && leaves.some((l) => same(l.path.slice(0, i + 1), tokens.slice(0, i + 1))))
1910
+ i++;
1911
+ const isGroup = i === tokens.length;
1912
+ if (!isGroup) {
1913
+ const prefix = tokens.slice(0, i);
1914
+ const options = [...new Set(leaves.filter((l) => startsWith(l.path, prefix)).map((l) => l.path[i]))];
1915
+ const guess = suggest(tokens[i], options);
1916
+ throw new KitError(`Unknown command "${tokens.slice(0, i + 1).join(" ")}".${guess ? ` Did you mean "${[...prefix, guess].join(" ")}"?` : ""}`, `Run \`kit ${prefix.length ? `${prefix.join(" ")} ` : ""}--help\` to list commands`, ExitCode.usage);
1917
+ }
1918
+ }
1919
+ const subCommands = buildTree(leaves, loaded, rt);
1920
+ const entry = {
1921
+ name: "kit",
1922
+ description: config ? `kit \xB7 ${config.name}` : "kit",
1923
+ run: () => {}
1924
+ };
1925
+ await cli(argv, entry, {
1926
+ name: "kit",
1927
+ version: package_default.version,
1928
+ description: "One dev toolkit for every app",
1929
+ subCommands,
1930
+ renderUsage: null,
1931
+ renderHeader: null,
1932
+ renderValidationErrors: null,
1933
+ plugins: [kitGlobals(package_default.version, renderUsage)]
1934
+ });
1935
+ return process.exitCode === undefined ? 0 : Number(process.exitCode);
1936
+ }
1937
+ installSignalHandlers();
1938
+ try {
1939
+ process.exitCode = await main(process.argv.slice(2));
1940
+ } catch (e) {
1941
+ const argv = process.argv.slice(2);
1942
+ const dashdash = argv.indexOf("--");
1943
+ if ((dashdash < 0 ? argv : argv.slice(0, dashdash)).includes("--json") && !jsonEmitted()) {
1944
+ emitJson({
1945
+ ok: false,
1946
+ error: e instanceof Error ? e.message : String(e),
1947
+ ...e instanceof KitError && e.hint ? { hint: e.hint } : {},
1948
+ exitCode: e instanceof KitError ? e.exitCode : ExitCode.failed
1949
+ });
1950
+ }
1951
+ if (e instanceof KitError) {
1952
+ log.error(e.message, e.hint);
1953
+ process.exitCode = e.exitCode;
1954
+ } else {
1955
+ log.error(e instanceof Error ? e.message : String(e));
1956
+ if (process.env.DEBUG?.includes("kit") && e instanceof Error)
1957
+ log.dim(e.stack ?? "");
1958
+ else
1959
+ log.dim(` ${import_picocolors2.default.dim("re-run with DEBUG=kit for a stack trace")}`);
1960
+ process.exitCode = ExitCode.failed;
1961
+ }
1962
+ }
1963
+ if (interrupted())
1964
+ process.exitCode = ExitCode.interrupted;
1965
+ await runCleanup();