@mtndev/cli 0.0.0-dev-20260626045346 → 0.0.0-pr-20-20261020022402

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 (331) hide show
  1. package/CHANGELOG.md +86 -1
  2. package/cjs/__chunks/2FSYDFUV.cjs +146 -0
  3. package/cjs/__chunks/3A5ZYU5M.cjs +105 -0
  4. package/cjs/__chunks/3NOHGUCF.cjs +9 -0
  5. package/cjs/__chunks/3T2LXW7J.cjs +387 -0
  6. package/cjs/__chunks/4XT5JEAS.cjs +1 -0
  7. package/cjs/__chunks/AZEB4H4I.cjs +208 -0
  8. package/cjs/__chunks/B5ENMOCD.cjs +288 -0
  9. package/cjs/__chunks/B6XM5KSF.cjs +338 -0
  10. package/cjs/__chunks/BDU2UCE5.cjs +1 -0
  11. package/cjs/__chunks/BLMSMR5E.cjs +46 -0
  12. package/cjs/__chunks/CMUD7LLN.cjs +47 -0
  13. package/cjs/__chunks/DTQ2LB3I.cjs +49 -0
  14. package/cjs/__chunks/FM5MVRQF.cjs +23 -0
  15. package/cjs/__chunks/FRHST54J.cjs +135 -0
  16. package/cjs/__chunks/FU4VP2LN.cjs +1 -0
  17. package/cjs/__chunks/G5K4PVIL.cjs +26 -0
  18. package/cjs/__chunks/{NSRFG4DF.cjs → GU3R54MK.cjs} +45 -18
  19. package/cjs/__chunks/GUL36IFZ.cjs +61 -0
  20. package/cjs/__chunks/GZMTNK5N.cjs +1 -0
  21. package/cjs/__chunks/H74JSDBU.cjs +30 -0
  22. package/cjs/__chunks/{EMMC33QA.cjs → JB7T7PKQ.cjs} +170 -33
  23. package/cjs/__chunks/JSL2JDMW.cjs +1 -0
  24. package/cjs/__chunks/K4QNHRTP.cjs +163 -0
  25. package/cjs/__chunks/KU76LC42.cjs +192 -0
  26. package/cjs/__chunks/LFDSHANP.cjs +34 -0
  27. package/cjs/__chunks/LHE24ECK.cjs +192 -0
  28. package/cjs/__chunks/LIKQ3SI4.cjs +1 -0
  29. package/cjs/__chunks/LXDF5QVZ.cjs +313 -0
  30. package/cjs/__chunks/LXOOJR2R.cjs +74 -0
  31. package/cjs/__chunks/N5MXFOQZ.cjs +167 -0
  32. package/cjs/__chunks/N7D56LPP.cjs +25 -0
  33. package/cjs/__chunks/NFXQNOQH.cjs +393 -0
  34. package/cjs/__chunks/NLKJIUEX.cjs +126 -0
  35. package/cjs/__chunks/NT2XXAI6.cjs +89 -0
  36. package/cjs/__chunks/NWZGFHKH.cjs +121 -0
  37. package/cjs/__chunks/R3GUC7O7.cjs +110 -0
  38. package/cjs/__chunks/RPVAXPJ4.cjs +1 -0
  39. package/cjs/__chunks/S3LVCWPN.cjs +23 -0
  40. package/cjs/__chunks/SBBNW2BF.cjs +249 -0
  41. package/cjs/__chunks/T2A7TN4F.cjs +81 -0
  42. package/cjs/__chunks/TKNNDDIB.cjs +97 -0
  43. package/cjs/__chunks/TNSRDJPR.cjs +1 -0
  44. package/cjs/__chunks/UWHPE2GI.cjs +20 -0
  45. package/cjs/__chunks/W6K7BV74.cjs +1 -0
  46. package/cjs/__chunks/WBOQ6AUN.cjs +320 -0
  47. package/cjs/__chunks/WHGN5PZI.cjs +299 -0
  48. package/cjs/__chunks/WOYF2L6T.cjs +11 -0
  49. package/cjs/__chunks/X26XY2N6.cjs +18 -0
  50. package/cjs/__chunks/XMKOKRXZ.cjs +16 -0
  51. package/cjs/__chunks/XTJPQ3EX.cjs +1 -0
  52. package/cjs/__chunks/YRHFKTW2.cjs +63 -0
  53. package/cjs/commands/aws/ec2/allow-ip/handler.cjs +12 -0
  54. package/cjs/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
  55. package/cjs/commands/aws/ec2/allow-ip/index.cjs +55 -0
  56. package/cjs/commands/aws/ec2/allow-ip/index.d.ts +3 -0
  57. package/cjs/commands/aws/ec2/allow-ip/schema.cjs +13 -0
  58. package/cjs/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
  59. package/cjs/commands/aws/ec2/allow-ip/utils.cjs +39 -0
  60. package/cjs/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
  61. package/cjs/commands/aws/iam/admin-group.cjs +15 -0
  62. package/cjs/commands/aws/iam/admin-group.d.ts +55 -0
  63. package/cjs/commands/aws/iam/break-glass/handler.cjs +12 -0
  64. package/cjs/commands/aws/iam/break-glass/handler.d.ts +7 -0
  65. package/cjs/commands/aws/iam/break-glass/index.cjs +19 -0
  66. package/cjs/commands/aws/iam/break-glass/index.d.ts +2 -0
  67. package/cjs/commands/aws/iam/break-glass/schema.cjs +12 -0
  68. package/cjs/commands/aws/iam/break-glass/schema.d.ts +25 -0
  69. package/cjs/commands/aws/iam/check-admin/handler.cjs +10 -0
  70. package/cjs/commands/aws/iam/check-admin/handler.d.ts +5 -0
  71. package/cjs/commands/aws/iam/check-admin/index.cjs +17 -0
  72. package/cjs/commands/aws/iam/check-admin/index.d.ts +2 -0
  73. package/cjs/commands/aws/iam/check-admin/schema.cjs +12 -0
  74. package/cjs/commands/aws/iam/check-admin/schema.d.ts +19 -0
  75. package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.cjs +28 -0
  76. package/cjs/commands/aws/iam/policies/sts-federation.cjs +19 -0
  77. package/cjs/commands/aws/iam/policies/user-admins-deny-list.cjs +183 -0
  78. package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.cjs +49 -0
  79. package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.cjs +64 -0
  80. package/cjs/commands/aws/iam/policies/user-admins-write-list.cjs +125 -0
  81. package/cjs/commands/aws/iam/remove-admin/handler.cjs +11 -0
  82. package/cjs/commands/aws/iam/remove-admin/handler.d.ts +6 -0
  83. package/cjs/commands/aws/iam/remove-admin/index.cjs +18 -0
  84. package/cjs/commands/aws/iam/remove-admin/index.d.ts +2 -0
  85. package/cjs/commands/aws/iam/remove-admin/schema.cjs +12 -0
  86. package/cjs/commands/aws/iam/remove-admin/schema.d.ts +28 -0
  87. package/cjs/commands/aws/iam/setup-acl/handler.cjs +14 -0
  88. package/cjs/commands/aws/iam/setup-acl/handler.d.ts +6 -0
  89. package/cjs/commands/aws/iam/setup-acl/index.cjs +33 -0
  90. package/cjs/commands/aws/iam/setup-acl/index.d.ts +3 -0
  91. package/cjs/commands/aws/iam/setup-acl/schema.cjs +7 -0
  92. package/cjs/commands/aws/iam/setup-acl/schema.d.ts +24 -0
  93. package/cjs/commands/aws/iam/setup-acl/utils.cjs +20 -0
  94. package/cjs/commands/aws/iam/setup-acl/utils.d.ts +61 -0
  95. package/cjs/commands/aws/iam/users/handler.cjs +12 -0
  96. package/cjs/commands/aws/iam/users/handler.d.ts +5 -0
  97. package/cjs/commands/aws/iam/users/index.cjs +41 -0
  98. package/cjs/commands/aws/iam/users/index.d.ts +3 -0
  99. package/cjs/commands/aws/iam/users/schema.cjs +7 -0
  100. package/cjs/commands/aws/iam/users/schema.d.ts +18 -0
  101. package/cjs/commands/aws/iam/users/utils.cjs +30 -0
  102. package/cjs/commands/aws/iam/users/utils.d.ts +119 -0
  103. package/cjs/commands/aws/index.cjs +229 -0
  104. package/cjs/commands/aws/index.d.ts +14 -0
  105. package/cjs/commands/aws/route53/add-record/handler.cjs +18 -0
  106. package/cjs/commands/aws/route53/add-record/handler.d.ts +36 -0
  107. package/cjs/commands/aws/route53/add-record/index.cjs +57 -0
  108. package/cjs/commands/aws/route53/add-record/index.d.ts +3 -0
  109. package/cjs/commands/aws/route53/add-record/schema.cjs +11 -0
  110. package/cjs/commands/aws/route53/add-record/schema.d.ts +45 -0
  111. package/cjs/commands/aws/route53/add-record/utils.cjs +37 -0
  112. package/cjs/commands/aws/route53/add-record/utils.d.ts +216 -0
  113. package/cjs/commands/aws/route53/remove-record/handler.cjs +14 -0
  114. package/cjs/commands/aws/route53/remove-record/handler.d.ts +6 -0
  115. package/cjs/commands/aws/route53/remove-record/index.cjs +18 -0
  116. package/cjs/commands/aws/route53/remove-record/index.d.ts +2 -0
  117. package/cjs/commands/aws/route53/remove-record/schema.cjs +8 -0
  118. package/cjs/commands/aws/route53/remove-record/schema.d.ts +30 -0
  119. package/cjs/commands/aws/schema.cjs +10 -0
  120. package/cjs/commands/aws/schema.d.ts +13 -0
  121. package/cjs/commands/aws/ses/send-email/handler.cjs +12 -0
  122. package/cjs/commands/aws/ses/send-email/handler.d.ts +5 -0
  123. package/cjs/commands/aws/ses/send-email/index.cjs +23 -0
  124. package/cjs/commands/aws/ses/send-email/index.d.ts +3 -0
  125. package/cjs/commands/aws/ses/send-email/schema.cjs +7 -0
  126. package/cjs/commands/aws/ses/send-email/schema.d.ts +39 -0
  127. package/cjs/commands/aws/ses/send-email/utils.cjs +11 -0
  128. package/cjs/commands/aws/ses/send-email/utils.d.ts +47 -0
  129. package/cjs/commands/aws/ses/smtp-password.cjs +10 -0
  130. package/cjs/commands/aws/ses/smtp-password.d.ts +21 -0
  131. package/cjs/commands/aws/utils/exec-aws.cjs +16 -0
  132. package/cjs/commands/aws/utils/exec-aws.d.ts +79 -0
  133. package/cjs/commands/aws/utils/resolve-policy-path.cjs +6 -0
  134. package/cjs/commands/aws/utils/resolve-policy-path.d.ts +8 -0
  135. package/cjs/commands/aws/utils/resolve-profile.cjs +11 -0
  136. package/cjs/commands/aws/utils/resolve-profile.d.ts +28 -0
  137. package/cjs/commands/aws/utils/tty.cjs +10 -0
  138. package/cjs/commands/aws/utils/tty.d.ts +24 -0
  139. package/cjs/commands/db/create-readonly-user/handler.cjs +11 -0
  140. package/cjs/commands/db/create-readonly-user/handler.d.ts +5 -0
  141. package/cjs/commands/db/create-readonly-user/index.cjs +40 -0
  142. package/cjs/commands/db/create-readonly-user/index.d.ts +3 -0
  143. package/cjs/commands/db/create-readonly-user/mysql.cjs +9 -0
  144. package/cjs/commands/db/create-readonly-user/mysql.d.ts +33 -0
  145. package/cjs/commands/db/create-readonly-user/postgres.cjs +9 -0
  146. package/cjs/commands/db/create-readonly-user/postgres.d.ts +31 -0
  147. package/cjs/commands/db/create-readonly-user/schema.cjs +12 -0
  148. package/cjs/commands/db/create-readonly-user/schema.d.ts +55 -0
  149. package/cjs/commands/db/create-readonly-user/utils.cjs +22 -0
  150. package/cjs/commands/db/create-readonly-user/utils.d.ts +112 -0
  151. package/cjs/commands/db/index.cjs +44 -0
  152. package/cjs/commands/db/index.d.ts +6 -0
  153. package/cjs/commands/doppler/handler.cjs +6 -4
  154. package/cjs/commands/doppler/index.cjs +32 -5
  155. package/cjs/commands/doppler/index.d.ts +1 -0
  156. package/cjs/commands/doppler/schema.cjs +10 -2
  157. package/cjs/commands/doppler/schema.d.ts +233 -17
  158. package/cjs/commands/doppler/set-secret.cjs +19 -0
  159. package/cjs/commands/doppler/set-secret.d.ts +113 -0
  160. package/cjs/commands/doppler/utils.cjs +6 -2
  161. package/cjs/commands/doppler/utils.d.ts +32 -8
  162. package/cjs/commands/icons/schema.d.ts +1 -1
  163. package/cjs/commands/index.cjs +91 -12
  164. package/esm/__chunks/2FTTEFEK.js +97 -0
  165. package/esm/__chunks/33UYMUQD.js +338 -0
  166. package/esm/__chunks/3BKWTHLJ.js +25 -0
  167. package/esm/__chunks/3HE4BEJX.js +105 -0
  168. package/esm/__chunks/3QLI5BDL.js +387 -0
  169. package/esm/__chunks/5GIUAFXL.js +89 -0
  170. package/esm/__chunks/73BJG53F.js +11 -0
  171. package/esm/__chunks/7VF4Q43Q.js +0 -0
  172. package/esm/__chunks/AEDEAYF5.js +0 -0
  173. package/esm/__chunks/AZCP3SFJ.js +0 -0
  174. package/esm/__chunks/B2DVQ2UL.js +61 -0
  175. package/esm/__chunks/CVQVHLW5.js +0 -0
  176. package/esm/__chunks/D62SPZXC.js +0 -0
  177. package/esm/__chunks/DLEJ25GZ.js +121 -0
  178. package/esm/__chunks/DMYFNF54.js +192 -0
  179. package/esm/__chunks/DNFTUMGD.js +23 -0
  180. package/esm/__chunks/DVKD6YSR.js +49 -0
  181. package/esm/__chunks/EMSH4P76.js +20 -0
  182. package/esm/__chunks/FFKFVMIE.js +167 -0
  183. package/esm/__chunks/FNXUONAV.js +110 -0
  184. package/esm/__chunks/G4NJHFFU.js +320 -0
  185. package/esm/__chunks/IEOGAQYI.js +46 -0
  186. package/esm/__chunks/IZFGBYGE.js +34 -0
  187. package/esm/__chunks/J34UVKLA.js +26 -0
  188. package/esm/__chunks/JZPBBBIG.js +74 -0
  189. package/esm/__chunks/KWUJP5MG.js +135 -0
  190. package/esm/__chunks/M35URMT4.js +313 -0
  191. package/esm/__chunks/NF3M2L6C.js +81 -0
  192. package/esm/__chunks/PNPPDYKC.js +299 -0
  193. package/esm/__chunks/QFXN4EHM.js +393 -0
  194. package/esm/__chunks/QKDDLIWD.js +146 -0
  195. package/esm/__chunks/QSE66AKY.js +208 -0
  196. package/esm/__chunks/QUF7PS4R.js +18 -0
  197. package/esm/__chunks/S7IJPJ4R.js +126 -0
  198. package/esm/__chunks/SD3E3EPH.js +163 -0
  199. package/esm/__chunks/T3TTUHTW.js +30 -0
  200. package/esm/__chunks/TIOVE6HR.js +0 -0
  201. package/esm/__chunks/TXKMEIDQ.js +0 -0
  202. package/esm/__chunks/U7HAE2RF.js +288 -0
  203. package/esm/__chunks/UXWY7BYE.js +63 -0
  204. package/esm/__chunks/VKAKISRG.js +192 -0
  205. package/esm/__chunks/WD2YR6I7.js +0 -0
  206. package/esm/__chunks/WOZFZKFY.js +0 -0
  207. package/esm/__chunks/XI7GZDE2.js +0 -0
  208. package/esm/__chunks/XOUWDB3T.js +249 -0
  209. package/esm/__chunks/XQN2TA4S.js +23 -0
  210. package/esm/__chunks/XXK32TIM.js +16 -0
  211. package/esm/__chunks/{O262GK4B.js → YGWTVPZE.js} +164 -27
  212. package/esm/__chunks/{6L5RNR7G.js → YRG7PT33.js} +44 -17
  213. package/esm/__chunks/ZHKVJO2U.js +47 -0
  214. package/esm/__chunks/ZO55YUSY.js +9 -0
  215. package/esm/commands/aws/ec2/allow-ip/handler.d.ts +6 -0
  216. package/esm/commands/aws/ec2/allow-ip/handler.js +12 -0
  217. package/esm/commands/aws/ec2/allow-ip/index.d.ts +3 -0
  218. package/esm/commands/aws/ec2/allow-ip/index.js +55 -0
  219. package/esm/commands/aws/ec2/allow-ip/schema.d.ts +33 -0
  220. package/esm/commands/aws/ec2/allow-ip/schema.js +13 -0
  221. package/esm/commands/aws/ec2/allow-ip/utils.d.ts +189 -0
  222. package/esm/commands/aws/ec2/allow-ip/utils.js +39 -0
  223. package/esm/commands/aws/iam/admin-group.d.ts +55 -0
  224. package/esm/commands/aws/iam/admin-group.js +15 -0
  225. package/esm/commands/aws/iam/break-glass/handler.d.ts +7 -0
  226. package/esm/commands/aws/iam/break-glass/handler.js +12 -0
  227. package/esm/commands/aws/iam/break-glass/index.d.ts +2 -0
  228. package/esm/commands/aws/iam/break-glass/index.js +19 -0
  229. package/esm/commands/aws/iam/break-glass/schema.d.ts +25 -0
  230. package/esm/commands/aws/iam/break-glass/schema.js +12 -0
  231. package/esm/commands/aws/iam/check-admin/handler.d.ts +5 -0
  232. package/esm/commands/aws/iam/check-admin/handler.js +10 -0
  233. package/esm/commands/aws/iam/check-admin/index.d.ts +2 -0
  234. package/esm/commands/aws/iam/check-admin/index.js +17 -0
  235. package/esm/commands/aws/iam/check-admin/schema.d.ts +19 -0
  236. package/esm/commands/aws/iam/check-admin/schema.js +12 -0
  237. package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.js +28 -0
  238. package/esm/commands/aws/iam/policies/sts-federation.js +19 -0
  239. package/esm/commands/aws/iam/policies/user-admins-deny-list.js +183 -0
  240. package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.js +49 -0
  241. package/esm/commands/aws/iam/policies/user-admins-self-service-iam.js +64 -0
  242. package/esm/commands/aws/iam/policies/user-admins-write-list.js +125 -0
  243. package/esm/commands/aws/iam/remove-admin/handler.d.ts +6 -0
  244. package/esm/commands/aws/iam/remove-admin/handler.js +11 -0
  245. package/esm/commands/aws/iam/remove-admin/index.d.ts +2 -0
  246. package/esm/commands/aws/iam/remove-admin/index.js +18 -0
  247. package/esm/commands/aws/iam/remove-admin/schema.d.ts +28 -0
  248. package/esm/commands/aws/iam/remove-admin/schema.js +12 -0
  249. package/esm/commands/aws/iam/setup-acl/handler.d.ts +6 -0
  250. package/esm/commands/aws/iam/setup-acl/handler.js +14 -0
  251. package/esm/commands/aws/iam/setup-acl/index.d.ts +3 -0
  252. package/esm/commands/aws/iam/setup-acl/index.js +33 -0
  253. package/esm/commands/aws/iam/setup-acl/schema.d.ts +24 -0
  254. package/esm/commands/aws/iam/setup-acl/schema.js +7 -0
  255. package/esm/commands/aws/iam/setup-acl/utils.d.ts +61 -0
  256. package/esm/commands/aws/iam/setup-acl/utils.js +20 -0
  257. package/esm/commands/aws/iam/users/handler.d.ts +5 -0
  258. package/esm/commands/aws/iam/users/handler.js +12 -0
  259. package/esm/commands/aws/iam/users/index.d.ts +3 -0
  260. package/esm/commands/aws/iam/users/index.js +41 -0
  261. package/esm/commands/aws/iam/users/schema.d.ts +18 -0
  262. package/esm/commands/aws/iam/users/schema.js +7 -0
  263. package/esm/commands/aws/iam/users/utils.d.ts +119 -0
  264. package/esm/commands/aws/iam/users/utils.js +30 -0
  265. package/esm/commands/aws/index.d.ts +14 -0
  266. package/esm/commands/aws/index.js +229 -0
  267. package/esm/commands/aws/route53/add-record/handler.d.ts +36 -0
  268. package/esm/commands/aws/route53/add-record/handler.js +18 -0
  269. package/esm/commands/aws/route53/add-record/index.d.ts +3 -0
  270. package/esm/commands/aws/route53/add-record/index.js +57 -0
  271. package/esm/commands/aws/route53/add-record/schema.d.ts +45 -0
  272. package/esm/commands/aws/route53/add-record/schema.js +11 -0
  273. package/esm/commands/aws/route53/add-record/utils.d.ts +216 -0
  274. package/esm/commands/aws/route53/add-record/utils.js +37 -0
  275. package/esm/commands/aws/route53/remove-record/handler.d.ts +6 -0
  276. package/esm/commands/aws/route53/remove-record/handler.js +14 -0
  277. package/esm/commands/aws/route53/remove-record/index.d.ts +2 -0
  278. package/esm/commands/aws/route53/remove-record/index.js +18 -0
  279. package/esm/commands/aws/route53/remove-record/schema.d.ts +30 -0
  280. package/esm/commands/aws/route53/remove-record/schema.js +8 -0
  281. package/esm/commands/aws/schema.d.ts +13 -0
  282. package/esm/commands/aws/schema.js +10 -0
  283. package/esm/commands/aws/ses/send-email/handler.d.ts +5 -0
  284. package/esm/commands/aws/ses/send-email/handler.js +12 -0
  285. package/esm/commands/aws/ses/send-email/index.d.ts +3 -0
  286. package/esm/commands/aws/ses/send-email/index.js +23 -0
  287. package/esm/commands/aws/ses/send-email/schema.d.ts +39 -0
  288. package/esm/commands/aws/ses/send-email/schema.js +7 -0
  289. package/esm/commands/aws/ses/send-email/utils.d.ts +47 -0
  290. package/esm/commands/aws/ses/send-email/utils.js +11 -0
  291. package/esm/commands/aws/ses/smtp-password.d.ts +21 -0
  292. package/esm/commands/aws/ses/smtp-password.js +10 -0
  293. package/esm/commands/aws/utils/exec-aws.d.ts +79 -0
  294. package/esm/commands/aws/utils/exec-aws.js +16 -0
  295. package/esm/commands/aws/utils/resolve-policy-path.d.ts +8 -0
  296. package/esm/commands/aws/utils/resolve-policy-path.js +6 -0
  297. package/esm/commands/aws/utils/resolve-profile.d.ts +28 -0
  298. package/esm/commands/aws/utils/resolve-profile.js +11 -0
  299. package/esm/commands/aws/utils/tty.d.ts +24 -0
  300. package/esm/commands/aws/utils/tty.js +10 -0
  301. package/esm/commands/db/create-readonly-user/handler.d.ts +5 -0
  302. package/esm/commands/db/create-readonly-user/handler.js +11 -0
  303. package/esm/commands/db/create-readonly-user/index.d.ts +3 -0
  304. package/esm/commands/db/create-readonly-user/index.js +40 -0
  305. package/esm/commands/db/create-readonly-user/mysql.d.ts +33 -0
  306. package/esm/commands/db/create-readonly-user/mysql.js +9 -0
  307. package/esm/commands/db/create-readonly-user/postgres.d.ts +31 -0
  308. package/esm/commands/db/create-readonly-user/postgres.js +9 -0
  309. package/esm/commands/db/create-readonly-user/schema.d.ts +55 -0
  310. package/esm/commands/db/create-readonly-user/schema.js +12 -0
  311. package/esm/commands/db/create-readonly-user/utils.d.ts +112 -0
  312. package/esm/commands/db/create-readonly-user/utils.js +22 -0
  313. package/esm/commands/db/index.d.ts +6 -0
  314. package/esm/commands/db/index.js +44 -0
  315. package/esm/commands/doppler/handler.js +5 -3
  316. package/esm/commands/doppler/index.d.ts +1 -0
  317. package/esm/commands/doppler/index.js +32 -5
  318. package/esm/commands/doppler/schema.d.ts +233 -17
  319. package/esm/commands/doppler/schema.js +11 -3
  320. package/esm/commands/doppler/set-secret.d.ts +113 -0
  321. package/esm/commands/doppler/set-secret.js +19 -0
  322. package/esm/commands/doppler/utils.d.ts +32 -8
  323. package/esm/commands/doppler/utils.js +5 -1
  324. package/esm/commands/icons/schema.d.ts +1 -1
  325. package/esm/commands/index.js +86 -7
  326. package/package.json +13 -3
  327. package/vitest.config.ts +11 -0
  328. package/cjs/__chunks/4GFJUCSP.cjs +0 -52
  329. package/esm/__chunks/X3R5PSWH.js +0 -52
  330. /package/cjs/__chunks/{WNJ3ZYLI.cjs → 3BY5Y4W7.cjs} +0 -0
  331. /package/esm/__chunks/{46HGXFME.js → 5ZBVGSOK.js} +0 -0
@@ -12,9 +12,16 @@ var _child_process = require('child_process');
12
12
 
13
13
 
14
14
  var _fs = require('fs');
15
+ var _os = require('os');
16
+ var _path = require('path');
15
17
  var _readline = require('readline');
16
18
  var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
17
19
  var DEFAULT_DOPPLER_ENVIRONMENT = "dev";
20
+ var DOPPLER_INTERNAL_KEYS = /* @__PURE__ */ new Set([
21
+ "DOPPLER_CONFIG",
22
+ "DOPPLER_ENVIRONMENT",
23
+ "DOPPLER_PROJECT"
24
+ ]);
18
25
  function execDoppler(args, parser = "string", silent = false, verbose = false) {
19
26
  const command = `doppler ${args.join(" ")}`;
20
27
  let verbosity = "default";
@@ -29,18 +36,18 @@ function execDoppler(args, parser = "string", silent = false, verbose = false) {
29
36
  throwOnError: true
30
37
  });
31
38
  }
32
- function checkDependencies(verbose = false) {
39
+ function checkDopplerAuth(verbose = false) {
33
40
  if (verbose) {
34
- console.log(_chalk2.default.blue("\n\u{1F50D} Checking Doppler dependencies..."));
41
+ console.log(_chalk2.default.blue("\n\u{1F50D} Checking Doppler authentication..."));
35
42
  }
36
43
  try {
37
44
  _child_process.execSync.call(void 0, "which doppler", { stdio: "pipe" });
38
45
  if (verbose) {
39
46
  console.log(_chalk2.default.green(" \u2713 Doppler CLI is installed"));
40
47
  }
41
- } catch (e) {
48
+ } catch (e2) {
42
49
  throw new Error(
43
- "Doppler is not installed. Please install Doppler (brew install dopplerhq/cli/doppler), login, setup, and try again."
50
+ "Doppler is not installed. Please install Doppler (brew install dopplerhq/cli/doppler), login, and try again."
44
51
  );
45
52
  }
46
53
  try {
@@ -48,37 +55,40 @@ function checkDependencies(verbose = false) {
48
55
  if (verbose) {
49
56
  console.log(_chalk2.default.green(" \u2713 Doppler is authenticated"));
50
57
  }
51
- } catch (e2) {
58
+ } catch (e3) {
52
59
  throw new Error(
53
- "Doppler is not logged in. Please run 'doppler login' then 'doppler setup' and try again."
60
+ "Doppler is not logged in. Please run 'doppler login' and try again."
54
61
  );
55
62
  }
63
+ }
64
+ function checkDependencies(verbose = false) {
65
+ checkDopplerAuth(verbose);
66
+ if (verbose) {
67
+ console.log(_chalk2.default.blue("\n\u{1F50D} Checking Doppler project setup..."));
68
+ }
56
69
  try {
57
70
  execDoppler(["configs", "--json"], "json", true, verbose);
58
71
  if (verbose) {
59
72
  console.log(_chalk2.default.green(" \u2713 Doppler project is configured"));
60
73
  }
61
- } catch (e3) {
74
+ } catch (e4) {
62
75
  throw new Error(
63
76
  "Doppler is not configured. Please run 'doppler setup' and try again."
64
77
  );
65
78
  }
66
79
  }
67
- function getConfigs(environment, verbose = false) {
80
+ function getConfigs(environments, verbose = false, project = null) {
68
81
  if (verbose) {
69
82
  console.log(
70
83
  _chalk2.default.blue(
71
84
  `
72
- \u{1F4CB} Resolving configurations for environment: ${_chalk2.default.cyan(environment)}`
85
+ \u{1F4CB} Resolving configurations for environments: ${_chalk2.default.cyan(environments)}`
73
86
  )
74
87
  );
75
88
  }
76
- const availableConfigs = execDoppler(
77
- ["configs", "--json"],
78
- "json",
79
- true,
80
- verbose
81
- );
89
+ const configArgs = ["configs", "--json"];
90
+ if (project) configArgs.push("--project", project);
91
+ const availableConfigs = execDoppler(configArgs, "json", true, verbose);
82
92
  const configNames = Array.isArray(availableConfigs) ? availableConfigs.map(
83
93
  (config) => config.name
84
94
  ) : [];
@@ -87,7 +97,7 @@ function getConfigs(environment, verbose = false) {
87
97
  _chalk2.default.gray(` Available configurations: ${configNames.join(", ")}`)
88
98
  );
89
99
  }
90
- if (environment === "all") {
100
+ if (environments === "all") {
91
101
  if (configNames.length === 0) {
92
102
  throw new Error("No configurations found in Doppler");
93
103
  }
@@ -98,15 +108,21 @@ function getConfigs(environment, verbose = false) {
98
108
  }
99
109
  return configNames;
100
110
  }
101
- if (configNames.length > 0 && !configNames.includes(environment)) {
102
- throw new Error(
103
- `Configuration "${environment}" not found. Available configurations: ${configNames.join(", ")}`
104
- );
111
+ const requested = environments.split(",").map((e) => e.trim());
112
+ if (configNames.length > 0) {
113
+ const missing = requested.filter((e) => !configNames.includes(e));
114
+ if (missing.length > 0) {
115
+ throw new Error(
116
+ `Configurations not found: ${missing.join(", ")}. Available: ${configNames.join(", ")}`
117
+ );
118
+ }
105
119
  }
106
120
  if (verbose) {
107
- console.log(_chalk2.default.green(` \u2713 Using configuration: ${environment}`));
121
+ console.log(
122
+ _chalk2.default.green(` \u2713 Using configurations: ${requested.join(", ")}`)
123
+ );
108
124
  }
109
- return [environment];
125
+ return requested;
110
126
  }
111
127
  function normalizeEscapeSequences(content) {
112
128
  return content.replace(/\\n/g, "\n").replace(/\\t/g, " ").replace(/\\r/g, "\r");
@@ -145,9 +161,9 @@ function promptConfirmation(message) {
145
161
  });
146
162
  }
147
163
  async function downloadConfigs(options) {
148
- const { environment, verbose } = options;
149
- const actualEnvironment = _nullishCoalesce(environment, () => ( DEFAULT_DOPPLER_ENVIRONMENT));
150
- const configs = getConfigs(actualEnvironment, verbose);
164
+ const { environments, verbose } = options;
165
+ const actualEnvironments = _nullishCoalesce(environments, () => ( DEFAULT_DOPPLER_ENVIRONMENT));
166
+ const configs = getConfigs(actualEnvironments, verbose);
151
167
  if (verbose) {
152
168
  console.log(
153
169
  _chalk2.default.blue(
@@ -156,9 +172,9 @@ async function downloadConfigs(options) {
156
172
  )
157
173
  );
158
174
  }
159
- if (configs.length === 1 && environment !== "all") {
175
+ if (configs.length === 1 && actualEnvironments !== "all") {
160
176
  console.log(
161
- "You can use -e all to download all configurations, or -e <env> for a specific environment."
177
+ "You can use -e all to download all configurations, or -e dev,stg for specific environments."
162
178
  );
163
179
  }
164
180
  for (const config of configs) {
@@ -228,8 +244,8 @@ async function downloadConfigs(options) {
228
244
  }
229
245
  }
230
246
  async function uploadConfigs(options) {
231
- const { environment, verbose } = options;
232
- const configs = getConfigs(environment, verbose);
247
+ const { environments, verbose } = options;
248
+ const configs = getConfigs(environments, verbose);
233
249
  if (verbose) {
234
250
  console.log(
235
251
  _chalk2.default.blue(
@@ -282,7 +298,7 @@ async function uploadConfigs(options) {
282
298
  } else {
283
299
  throw new Error("Invalid backup content received from Doppler");
284
300
  }
285
- } catch (e4) {
301
+ } catch (e5) {
286
302
  console.log(
287
303
  `Config ${config}: Failed to create backup. Skipping upload.`
288
304
  );
@@ -345,7 +361,7 @@ async function uploadConfigs(options) {
345
361
  `Config ${config}: Successfully uploaded ${_chalk2.default.green(envFile)}`
346
362
  );
347
363
  }
348
- } catch (e5) {
364
+ } catch (e6) {
349
365
  console.error(
350
366
  `Config ${config}: Failed to upload ${_chalk2.default.green(envFile)}. Restoring previous configuration.`
351
367
  );
@@ -363,7 +379,7 @@ async function uploadConfigs(options) {
363
379
  console.log(
364
380
  `Config ${config}: Successfully restored previous configuration`
365
381
  );
366
- } catch (e6) {
382
+ } catch (e7) {
367
383
  console.error(
368
384
  `Config ${config}: Failed to restore previous configuration`
369
385
  );
@@ -388,6 +404,127 @@ async function uploadConfigs(options) {
388
404
  }
389
405
  }
390
406
  }
407
+ async function cloneProject({ from, to, environments, force, verbose }) {
408
+ if (verbose) {
409
+ console.log(
410
+ _chalk2.default.blue(
411
+ `
412
+ \u{1F501} Cloning from ${_chalk2.default.cyan(from)} to ${_chalk2.default.cyan(to)}...`
413
+ )
414
+ );
415
+ }
416
+ const configsToClone = getConfigs(environments, verbose, from);
417
+ if (configsToClone.length === 0) {
418
+ throw new Error(`No configurations found in source project "${from}"`);
419
+ }
420
+ const targetConfigsRaw = execDoppler(
421
+ ["configs", "--json", "--project", to],
422
+ "json",
423
+ true,
424
+ verbose
425
+ );
426
+ const targetConfigNames = Array.isArray(targetConfigsRaw) ? targetConfigsRaw.map((c) => c.name) : [];
427
+ const missingInTarget = configsToClone.filter(
428
+ (c) => !targetConfigNames.includes(c)
429
+ );
430
+ if (missingInTarget.length > 0) {
431
+ throw new Error(
432
+ `Configs missing in target project "${to}": ${missingInTarget.join(", ")}. Create them in Doppler first.`
433
+ );
434
+ }
435
+ for (const config of configsToClone) {
436
+ if (verbose) {
437
+ console.log(_chalk2.default.blue(`
438
+ \u{1F4E6} Processing config: ${_chalk2.default.cyan(config)}`));
439
+ }
440
+ const sourceSecrets = execDoppler(
441
+ ["secrets", "--json", "--project", from, "--config", config],
442
+ "json",
443
+ true,
444
+ verbose
445
+ );
446
+ const sourceKeys = sourceSecrets ? Object.keys(sourceSecrets).filter((k) => !DOPPLER_INTERNAL_KEYS.has(k)) : [];
447
+ const targetSecrets = execDoppler(
448
+ ["secrets", "--json", "--project", to, "--config", config],
449
+ "json",
450
+ true,
451
+ verbose
452
+ );
453
+ const targetKeys = targetSecrets ? Object.keys(targetSecrets) : [];
454
+ const conflicts = sourceKeys.filter((k) => targetKeys.includes(k));
455
+ if (conflicts.length > 0) {
456
+ if (process.env["CI"]) {
457
+ throw new Error(
458
+ `Config "${config}" has ${conflicts.length} conflicting key(s) in target: ${conflicts.join(", ")}`
459
+ );
460
+ }
461
+ if (!force) {
462
+ console.log(
463
+ `
464
+ Config ${_chalk2.default.cyan(config)}: ${conflicts.length} key(s) already exist in ${_chalk2.default.cyan(to)}:`
465
+ );
466
+ conflicts.forEach((k) => console.log(_chalk2.default.yellow(` \u2022 ${k}`)));
467
+ const confirmed = await promptConfirmation(
468
+ `
469
+ Overwrite these keys in "${to}/${config}"? (y/n) `
470
+ );
471
+ if (!confirmed) {
472
+ console.log(`Skipped ${_chalk2.default.blue(config)}`);
473
+ continue;
474
+ }
475
+ }
476
+ }
477
+ const tmpFile = _path.join.call(void 0, _os.tmpdir.call(void 0, ), `doppler-clone-${config}-${Date.now()}.env`);
478
+ try {
479
+ const content = execDoppler(
480
+ [
481
+ "secrets",
482
+ "download",
483
+ "--no-file",
484
+ "--format",
485
+ "env",
486
+ "--project",
487
+ from,
488
+ "--config",
489
+ config
490
+ ],
491
+ "string",
492
+ true,
493
+ verbose
494
+ );
495
+ if (typeof content !== "string" || !content) {
496
+ throw new Error(`No secrets returned for config "${config}"`);
497
+ }
498
+ const filtered = content.split("\n").filter((line) => {
499
+ const key = _nullishCoalesce(line.split("=")[0], () => ( ""));
500
+ return !DOPPLER_INTERNAL_KEYS.has(key);
501
+ }).join("\n");
502
+ _fs.writeFileSync.call(void 0, tmpFile, filtered, "utf-8");
503
+ execDoppler(
504
+ [
505
+ "secrets",
506
+ "upload",
507
+ tmpFile,
508
+ "--project",
509
+ to,
510
+ "--config",
511
+ config,
512
+ "--silent"
513
+ ],
514
+ "string",
515
+ true,
516
+ verbose
517
+ );
518
+ console.log(`Config ${_chalk2.default.blue(config)}: cloned to ${_chalk2.default.green(to)}`);
519
+ } finally {
520
+ if (_fs.existsSync.call(void 0, tmpFile)) {
521
+ _fs.unlinkSync.call(void 0, tmpFile);
522
+ }
523
+ }
524
+ }
525
+ }
526
+
527
+
391
528
 
392
529
 
393
530
 
@@ -398,4 +535,4 @@ async function uploadConfigs(options) {
398
535
 
399
536
 
400
537
 
401
- exports.execDoppler = execDoppler; exports.checkDependencies = checkDependencies; exports.getConfigs = getConfigs; exports.normalizeEscapeSequences = normalizeEscapeSequences; exports.createDiff = createDiff; exports.promptConfirmation = promptConfirmation; exports.downloadConfigs = downloadConfigs; exports.uploadConfigs = uploadConfigs;
538
+ exports.execDoppler = execDoppler; exports.checkDopplerAuth = checkDopplerAuth; exports.checkDependencies = checkDependencies; exports.getConfigs = getConfigs; exports.normalizeEscapeSequences = normalizeEscapeSequences; exports.createDiff = createDiff; exports.promptConfirmation = promptConfirmation; exports.downloadConfigs = downloadConfigs; exports.uploadConfigs = uploadConfigs; exports.cloneProject = cloneProject;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,163 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+
4
+
5
+ var _NWZGFHKHcjs = require('./NWZGFHKH.cjs');
6
+
7
+ // src/commands/db/create-readonly-user/postgres.js
8
+ var _pg = require('pg'); var _pg2 = _interopRequireDefault(_pg);
9
+ var { Client } = _pg2.default;
10
+ function createClient(config, database) {
11
+ return new Client({
12
+ host: config.host,
13
+ port: config.port,
14
+ user: config.user,
15
+ password: config.password,
16
+ database: _nullishCoalesce(database, () => ( (config.database || "postgres"))),
17
+ ssl: config.ssl
18
+ });
19
+ }
20
+ async function query(client, sql, params) {
21
+ return client.query(sql, params);
22
+ }
23
+ async function listPostgresDatabases(config) {
24
+ const client = createClient(config, config.database || "postgres");
25
+ await client.connect();
26
+ try {
27
+ const result = await query(
28
+ client,
29
+ `SELECT datname
30
+ FROM pg_database
31
+ WHERE datistemplate = false
32
+ ORDER BY datname`
33
+ );
34
+ return result.rows.map((row) => row.datname).filter((name) => !_NWZGFHKHcjs.isSystemDatabase.call(void 0, { engine: "postgres", name }));
35
+ } finally {
36
+ await client.end();
37
+ }
38
+ }
39
+ async function ensureRole(client, params) {
40
+ const { username, password } = params;
41
+ const ident = _NWZGFHKHcjs.quoteIdent.call(void 0, { engine: "postgres", name: username });
42
+ const passwordLiteral = _NWZGFHKHcjs.quoteLiteral.call(void 0, password);
43
+ const existing = await query(
44
+ client,
45
+ "SELECT 1 FROM pg_roles WHERE rolname = $1",
46
+ [username]
47
+ );
48
+ const statements = [];
49
+ if (existing.rowCount && existing.rowCount > 0) {
50
+ const sql2 = `ALTER ROLE ${ident} WITH LOGIN PASSWORD ${passwordLiteral}`;
51
+ statements.push(sql2);
52
+ await query(client, sql2);
53
+ return { created: false, statements };
54
+ }
55
+ const sql = `CREATE ROLE ${ident} WITH LOGIN PASSWORD ${passwordLiteral}`;
56
+ statements.push(sql);
57
+ await query(client, sql);
58
+ return { created: true, statements };
59
+ }
60
+ async function grantReadonlyInDatabase(client, params) {
61
+ const { username } = params;
62
+ const ident = _NWZGFHKHcjs.quoteIdent.call(void 0, { engine: "postgres", name: username });
63
+ const statements = [];
64
+ const schemasResult = await query(
65
+ client,
66
+ `SELECT nspname
67
+ FROM pg_namespace
68
+ WHERE nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast')
69
+ AND nspname NOT LIKE 'pg_temp_%'
70
+ AND nspname NOT LIKE 'pg_toast_temp_%'
71
+ ORDER BY nspname`
72
+ );
73
+ const schemas = schemasResult.rows.map(
74
+ (row) => row.nspname
75
+ );
76
+ if (schemas.length === 0) {
77
+ schemas.push("public");
78
+ }
79
+ for (const schema of schemas) {
80
+ const schemaIdent = _NWZGFHKHcjs.quoteIdent.call(void 0, { engine: "postgres", name: schema });
81
+ const grants = [
82
+ `GRANT USAGE ON SCHEMA ${schemaIdent} TO ${ident}`,
83
+ `GRANT SELECT ON ALL TABLES IN SCHEMA ${schemaIdent} TO ${ident}`,
84
+ `GRANT SELECT ON ALL SEQUENCES IN SCHEMA ${schemaIdent} TO ${ident}`,
85
+ `ALTER DEFAULT PRIVILEGES IN SCHEMA ${schemaIdent} GRANT SELECT ON TABLES TO ${ident}`,
86
+ `ALTER DEFAULT PRIVILEGES IN SCHEMA ${schemaIdent} GRANT SELECT ON SEQUENCES TO ${ident}`
87
+ ];
88
+ for (const sql of grants) {
89
+ statements.push(sql);
90
+ await query(client, sql);
91
+ }
92
+ }
93
+ return statements;
94
+ }
95
+ async function applyPostgresReadonly(params) {
96
+ const {
97
+ config,
98
+ username,
99
+ password,
100
+ databases,
101
+ dryRun = false,
102
+ verbose = false
103
+ } = params;
104
+ const statements = [];
105
+ let created = false;
106
+ if (dryRun) {
107
+ const ident = _NWZGFHKHcjs.quoteIdent.call(void 0, { engine: "postgres", name: username });
108
+ statements.push(
109
+ `-- Would CREATE/ALTER ROLE ${ident} WITH LOGIN PASSWORD ***`
110
+ );
111
+ for (const database of databases) {
112
+ const dbIdent = _NWZGFHKHcjs.quoteIdent.call(void 0, { engine: "postgres", name: database });
113
+ statements.push(`GRANT CONNECT ON DATABASE ${dbIdent} TO ${ident}`);
114
+ statements.push(
115
+ `-- In database ${database}: GRANT USAGE/SELECT on all user schemas + ALTER DEFAULT PRIVILEGES`
116
+ );
117
+ }
118
+ return { created: true, statements, databases };
119
+ }
120
+ const adminDb = config.database || "postgres";
121
+ const adminClient = createClient(config, adminDb);
122
+ await adminClient.connect();
123
+ try {
124
+ if (verbose) {
125
+ console.log(
126
+ ` Connected to Postgres as ${config.user}@${config.host}/${adminDb}`
127
+ );
128
+ }
129
+ const roleResult = await ensureRole(adminClient, { username, password });
130
+ created = roleResult.created;
131
+ statements.push(...roleResult.statements);
132
+ const ident = _NWZGFHKHcjs.quoteIdent.call(void 0, { engine: "postgres", name: username });
133
+ for (const database of databases) {
134
+ const dbIdent = _NWZGFHKHcjs.quoteIdent.call(void 0, { engine: "postgres", name: database });
135
+ const connectSql = `GRANT CONNECT ON DATABASE ${dbIdent} TO ${ident}`;
136
+ statements.push(connectSql);
137
+ await query(adminClient, connectSql);
138
+ }
139
+ } finally {
140
+ await adminClient.end();
141
+ }
142
+ for (const database of databases) {
143
+ const dbClient = createClient(config, database);
144
+ await dbClient.connect();
145
+ try {
146
+ if (verbose) {
147
+ console.log(` Granting read-only in database ${database}`);
148
+ }
149
+ const dbStatements = await grantReadonlyInDatabase(dbClient, {
150
+ username
151
+ });
152
+ statements.push(...dbStatements);
153
+ } finally {
154
+ await dbClient.end();
155
+ }
156
+ }
157
+ return { created, statements, databases };
158
+ }
159
+
160
+
161
+
162
+
163
+ exports.listPostgresDatabases = listPostgresDatabases; exports.applyPostgresReadonly = applyPostgresReadonly;
@@ -0,0 +1,192 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _UWHPE2GIcjs = require('./UWHPE2GI.cjs');
4
+
5
+
6
+
7
+ var _T2A7TN4Fcjs = require('./T2A7TN4F.cjs');
8
+
9
+
10
+ var _R3GUC7O7cjs = require('./R3GUC7O7.cjs');
11
+
12
+
13
+ var _NT2XXAI6cjs = require('./NT2XXAI6.cjs');
14
+
15
+
16
+ var _CMUD7LLNcjs = require('./CMUD7LLN.cjs');
17
+
18
+ // src/commands/aws/iam/break-glass/handler.js
19
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
20
+ var _zod = require('zod');
21
+ function userNameFromArn(arn) {
22
+ const marker = ":user/";
23
+ const index = arn.indexOf(marker);
24
+ if (index === -1) {
25
+ return null;
26
+ }
27
+ const name = arn.slice(index + marker.length).split("/").pop();
28
+ return name && name.length > 0 ? name : null;
29
+ }
30
+ async function breakGlassCommand(options) {
31
+ try {
32
+ const { profile, user, yes, dryRun, verbose } = _UWHPE2GIcjs.breakGlassOptionsSchema.parse(options);
33
+ _R3GUC7O7cjs.requireCommands.call(void 0, ["aws"]);
34
+ const targetProfile = await _NT2XXAI6cjs.resolveProfile.call(void 0, { profile });
35
+ if (!targetProfile) {
36
+ console.error(
37
+ _chalk2.default.red(
38
+ "No profile specified. Pass --profile <name> or set AWS_PROFILE."
39
+ )
40
+ );
41
+ process.exit(1);
42
+ }
43
+ const scan = _T2A7TN4Fcjs.resolveProfileScan.call(void 0, { profile: targetProfile, verbose });
44
+ if (!scan) {
45
+ console.error(
46
+ _chalk2.default.red(
47
+ `
48
+ \u274C Could not read ${_T2A7TN4Fcjs.ADMIN_GROUP_NAME} for profile "${targetProfile}".`
49
+ )
50
+ );
51
+ console.error(
52
+ _chalk2.default.yellow(
53
+ " Check your credentials, and run `mtn aws iam setup-acl` first if the group does not exist yet.\n"
54
+ )
55
+ );
56
+ process.exit(1);
57
+ }
58
+ let targets = user;
59
+ if (targets.length === 0) {
60
+ const derived = userNameFromArn(scan.arn);
61
+ if (!derived) {
62
+ console.error(
63
+ _chalk2.default.red(
64
+ `
65
+ \u274C Could not determine your IAM user from the caller identity:
66
+ ${scan.arn}`
67
+ )
68
+ );
69
+ console.error(
70
+ _chalk2.default.yellow(" Pass --user <name> to choose who to grant.\n")
71
+ );
72
+ process.exit(1);
73
+ }
74
+ targets = [derived];
75
+ }
76
+ const alreadyMembers = new Set(scan.users);
77
+ const toGrant = targets.filter((name) => !alreadyMembers.has(name));
78
+ const existing = targets.filter((name) => alreadyMembers.has(name));
79
+ console.log(
80
+ _chalk2.default.blue(
81
+ `
82
+ ==> Break-glass admin (${_T2A7TN4Fcjs.ADMIN_GROUP_NAME}) \u2014 profile ${targetProfile} (${scan.accountId})
83
+ `
84
+ )
85
+ );
86
+ for (const name of existing) {
87
+ console.log(_chalk2.default.dim(`-- ${name} already has break-glass access`));
88
+ }
89
+ if (toGrant.length === 0) {
90
+ console.log(
91
+ _chalk2.default.green(
92
+ "\nNothing to do \u2014 all target user(s) already have break-glass access.\n"
93
+ )
94
+ );
95
+ return;
96
+ }
97
+ console.log(
98
+ _chalk2.default.red.bold(
99
+ `\u26A0 This grants AdministratorAccess to ${toGrant.length} user(s): ${toGrant.join(", ")}`
100
+ )
101
+ );
102
+ if (dryRun) {
103
+ for (const name of toGrant) {
104
+ console.log(
105
+ _chalk2.default.yellow(` [dry-run] would add ${name} to ${_T2A7TN4Fcjs.ADMIN_GROUP_NAME}`)
106
+ );
107
+ }
108
+ console.log(
109
+ _chalk2.default.yellow("\n[dry-run] Re-run without --dry-run to apply.\n")
110
+ );
111
+ return;
112
+ }
113
+ let confirmed = yes;
114
+ if (!confirmed) {
115
+ confirmed = await _CMUD7LLNcjs.promptYesNo.call(void 0, {
116
+ message: ` Grant break-glass admin to ${toGrant.length} user(s) in ${targetProfile}?`,
117
+ defaultYes: false
118
+ });
119
+ }
120
+ if (!confirmed) {
121
+ console.log(_chalk2.default.dim(" aborted (not confirmed)\n"));
122
+ return;
123
+ }
124
+ let granted = 0;
125
+ for (const name of toGrant) {
126
+ try {
127
+ scan.run(
128
+ [
129
+ "iam",
130
+ "add-user-to-group",
131
+ "--group-name",
132
+ _T2A7TN4Fcjs.ADMIN_GROUP_NAME,
133
+ "--user-name",
134
+ name
135
+ ],
136
+ { expectJson: false }
137
+ );
138
+ console.log(_chalk2.default.green(` granted ${name}`));
139
+ granted += 1;
140
+ } catch (grantError) {
141
+ const reason = grantError instanceof Error ? _nullishCoalesce(grantError.message.split("\n")[0], () => ( "")) : String(grantError);
142
+ console.log(_chalk2.default.red(` failed to grant ${name}: ${reason}`));
143
+ }
144
+ }
145
+ console.log(_chalk2.default.blue("\n==> Summary"));
146
+ console.log(` Profile: ${targetProfile} (${scan.accountId})`);
147
+ console.log(` Users granted: ${granted}`);
148
+ console.log(` Already had it: ${existing.length}`);
149
+ console.log(
150
+ _chalk2.default.yellow(
151
+ "\n\u{1F4A1} Revoke with `mtn aws iam remove-admin` when you are done."
152
+ )
153
+ );
154
+ console.log(
155
+ _chalk2.default.dim(
156
+ " You may need a fresh session (e.g. clear the aws-vault cache) before the new permissions apply.\n"
157
+ )
158
+ );
159
+ } catch (error) {
160
+ if (error instanceof _zod.ZodError) {
161
+ console.error(_chalk2.default.red("\n\u274C Invalid command options:"));
162
+ error.errors.forEach((err) => {
163
+ console.error(_chalk2.default.red(` ${err.path.join(".")}: ${err.message}`));
164
+ });
165
+ process.exit(1);
166
+ }
167
+ const verbose = (
168
+ /** @type {any} */
169
+ _optionalChain([options, 'optionalAccess', _ => _.verbose]) || false
170
+ );
171
+ console.error(_chalk2.default.red("\n\u274C break-glass failed:"));
172
+ if (error instanceof Error) {
173
+ console.error(_chalk2.default.red(` ${error.message}`));
174
+ if (verbose && error.stack) {
175
+ console.error(_chalk2.default.gray("\nStack trace:"));
176
+ console.error(_chalk2.default.gray(error.stack));
177
+ }
178
+ } else {
179
+ console.error(_chalk2.default.red(` ${String(error)}`));
180
+ }
181
+ console.error(
182
+ _chalk2.default.yellow(
183
+ "\n\u{1F4A1} Requires the AWS CLI and iam:AddUserToGroup on the target profile.\n"
184
+ )
185
+ );
186
+ process.exit(1);
187
+ }
188
+ }
189
+
190
+
191
+
192
+ exports.breakGlassCommand = breakGlassCommand;