@mtndev/cli 2.0.0 → 2.0.1

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 (264) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/cjs/__chunks/VH7oDXx4.cjs +28 -0
  3. package/cjs/commands/aws/ec2/allow-ip/handler.cjs +261 -12
  4. package/cjs/commands/aws/ec2/allow-ip/index.cjs +25 -55
  5. package/cjs/commands/aws/ec2/allow-ip/schema.cjs +33 -13
  6. package/cjs/commands/aws/ec2/allow-ip/utils.cjs +379 -39
  7. package/cjs/commands/aws/iam/admin-group.cjs +111 -15
  8. package/cjs/commands/aws/iam/break-glass/handler.cjs +127 -12
  9. package/cjs/commands/aws/iam/break-glass/index.cjs +7 -19
  10. package/cjs/commands/aws/iam/break-glass/schema.cjs +21 -12
  11. package/cjs/commands/aws/iam/check-admin/handler.cjs +89 -10
  12. package/cjs/commands/aws/iam/check-admin/index.cjs +7 -17
  13. package/cjs/commands/aws/iam/check-admin/schema.cjs +19 -12
  14. package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
  15. package/cjs/commands/aws/iam/policies/sts-federation.json +11 -0
  16. package/cjs/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
  17. package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
  18. package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
  19. package/cjs/commands/aws/iam/policies/user-admins-write-list.json +117 -0
  20. package/cjs/commands/aws/iam/remove-admin/handler.cjs +120 -11
  21. package/cjs/commands/aws/iam/remove-admin/index.cjs +7 -18
  22. package/cjs/commands/aws/iam/remove-admin/schema.cjs +22 -12
  23. package/cjs/commands/aws/iam/setup-acl/handler.cjs +227 -14
  24. package/cjs/commands/aws/iam/setup-acl/index.cjs +13 -33
  25. package/cjs/commands/aws/iam/setup-acl/schema.cjs +19 -7
  26. package/cjs/commands/aws/iam/setup-acl/utils.cjs +305 -20
  27. package/cjs/commands/aws/iam/users/handler.cjs +59 -12
  28. package/cjs/commands/aws/iam/users/index.cjs +18 -41
  29. package/cjs/commands/aws/iam/users/schema.cjs +17 -7
  30. package/cjs/commands/aws/iam/users/utils.cjs +454 -30
  31. package/cjs/commands/aws/index.cjs +223 -229
  32. package/cjs/commands/aws/route53/add-record/handler.cjs +264 -18
  33. package/cjs/commands/aws/route53/add-record/index.cjs +26 -57
  34. package/cjs/commands/aws/route53/add-record/schema.cjs +43 -11
  35. package/cjs/commands/aws/route53/add-record/utils.cjs +404 -37
  36. package/cjs/commands/aws/route53/remove-record/handler.cjs +114 -14
  37. package/cjs/commands/aws/route53/remove-record/index.cjs +5 -18
  38. package/cjs/commands/aws/route53/remove-record/schema.cjs +22 -8
  39. package/cjs/commands/aws/schema.cjs +19 -10
  40. package/cjs/commands/aws/ses/send-email/handler.cjs +73 -12
  41. package/cjs/commands/aws/ses/send-email/index.cjs +9 -23
  42. package/cjs/commands/aws/ses/send-email/schema.cjs +24 -7
  43. package/cjs/commands/aws/ses/send-email/utils.cjs +87 -11
  44. package/cjs/commands/aws/ses/smtp-password.cjs +72 -10
  45. package/cjs/commands/aws/utils/exec-aws.cjs +145 -16
  46. package/cjs/commands/aws/utils/resolve-policy-path.cjs +15 -6
  47. package/cjs/commands/aws/utils/resolve-profile.cjs +93 -11
  48. package/cjs/commands/aws/utils/tty.cjs +54 -10
  49. package/cjs/commands/db/create-readonly-user/handler.cjs +254 -11
  50. package/cjs/commands/db/create-readonly-user/index.cjs +18 -40
  51. package/cjs/commands/db/create-readonly-user/mysql.cjs +102 -9
  52. package/cjs/commands/db/create-readonly-user/postgres.cjs +209 -9
  53. package/cjs/commands/db/create-readonly-user/schema.cjs +39 -12
  54. package/cjs/commands/db/create-readonly-user/utils.cjs +160 -22
  55. package/cjs/commands/db/index.cjs +46 -44
  56. package/cjs/commands/doppler/handler.cjs +95 -11
  57. package/cjs/commands/doppler/index.cjs +33 -68
  58. package/cjs/commands/doppler/schema.cjs +130 -14
  59. package/cjs/commands/doppler/set-secret.cjs +378 -19
  60. package/cjs/commands/doppler/utils/exec.cjs +106 -12
  61. package/cjs/commands/doppler/utils.cjs +412 -34
  62. package/cjs/commands/icons/handler.cjs +82 -8
  63. package/cjs/commands/icons/index.cjs +15 -31
  64. package/cjs/commands/icons/schema.cjs +101 -13
  65. package/cjs/commands/icons/utils.cjs +131 -13
  66. package/cjs/commands/index.cjs +54 -161
  67. package/cjs/commands/schema.cjs +25 -8
  68. package/cjs/index.cjs +3 -4
  69. package/esm/commands/aws/ec2/allow-ip/handler.js +258 -12
  70. package/esm/commands/aws/ec2/allow-ip/index.js +4 -55
  71. package/esm/commands/aws/ec2/allow-ip/schema.js +29 -13
  72. package/esm/commands/aws/ec2/allow-ip/utils.js +363 -39
  73. package/esm/commands/aws/iam/admin-group.js +104 -15
  74. package/esm/commands/aws/iam/break-glass/handler.js +124 -12
  75. package/esm/commands/aws/iam/break-glass/index.js +4 -19
  76. package/esm/commands/aws/iam/break-glass/schema.js +19 -12
  77. package/esm/commands/aws/iam/check-admin/handler.js +86 -10
  78. package/esm/commands/aws/iam/check-admin/index.js +4 -17
  79. package/esm/commands/aws/iam/check-admin/schema.js +17 -12
  80. package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.json +20 -0
  81. package/esm/commands/aws/iam/policies/sts-federation.json +11 -0
  82. package/esm/commands/aws/iam/policies/user-admins-deny-list.json +175 -0
  83. package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.json +41 -0
  84. package/esm/commands/aws/iam/policies/user-admins-self-service-iam.json +56 -0
  85. package/esm/commands/aws/iam/policies/user-admins-write-list.json +117 -0
  86. package/esm/commands/aws/iam/remove-admin/handler.js +117 -11
  87. package/esm/commands/aws/iam/remove-admin/index.js +4 -18
  88. package/esm/commands/aws/iam/remove-admin/schema.js +20 -12
  89. package/esm/commands/aws/iam/setup-acl/handler.js +224 -14
  90. package/esm/commands/aws/iam/setup-acl/index.js +4 -33
  91. package/esm/commands/aws/iam/setup-acl/schema.js +18 -7
  92. package/esm/commands/aws/iam/setup-acl/utils.js +298 -20
  93. package/esm/commands/aws/iam/users/handler.js +56 -12
  94. package/esm/commands/aws/iam/users/index.js +4 -41
  95. package/esm/commands/aws/iam/users/schema.js +16 -7
  96. package/esm/commands/aws/iam/users/utils.js +440 -30
  97. package/esm/commands/aws/index.js +142 -229
  98. package/esm/commands/aws/route53/add-record/handler.js +258 -18
  99. package/esm/commands/aws/route53/add-record/index.js +4 -57
  100. package/esm/commands/aws/route53/add-record/schema.js +40 -11
  101. package/esm/commands/aws/route53/add-record/utils.js +389 -37
  102. package/esm/commands/aws/route53/remove-record/handler.js +111 -14
  103. package/esm/commands/aws/route53/remove-record/index.js +3 -18
  104. package/esm/commands/aws/route53/remove-record/schema.js +21 -8
  105. package/esm/commands/aws/schema.js +16 -10
  106. package/esm/commands/aws/ses/send-email/handler.js +70 -12
  107. package/esm/commands/aws/ses/send-email/index.js +4 -23
  108. package/esm/commands/aws/ses/send-email/schema.js +23 -7
  109. package/esm/commands/aws/ses/send-email/utils.js +84 -11
  110. package/esm/commands/aws/ses/smtp-password.js +69 -10
  111. package/esm/commands/aws/utils/exec-aws.js +136 -15
  112. package/esm/commands/aws/utils/resolve-policy-path.js +14 -6
  113. package/esm/commands/aws/utils/resolve-profile.js +88 -11
  114. package/esm/commands/aws/utils/tty.js +51 -10
  115. package/esm/commands/db/create-readonly-user/handler.js +251 -11
  116. package/esm/commands/db/create-readonly-user/index.js +4 -40
  117. package/esm/commands/db/create-readonly-user/mysql.js +98 -9
  118. package/esm/commands/db/create-readonly-user/postgres.js +205 -9
  119. package/esm/commands/db/create-readonly-user/schema.js +35 -12
  120. package/esm/commands/db/create-readonly-user/utils.js +151 -22
  121. package/esm/commands/db/index.js +31 -44
  122. package/esm/commands/doppler/handler.js +92 -11
  123. package/esm/commands/doppler/index.js +6 -68
  124. package/esm/commands/doppler/schema.js +125 -15
  125. package/esm/commands/doppler/set-secret.js +370 -19
  126. package/esm/commands/doppler/utils/exec.js +100 -12
  127. package/esm/commands/doppler/utils.js +396 -34
  128. package/esm/commands/icons/handler.js +79 -8
  129. package/esm/commands/icons/index.js +4 -31
  130. package/esm/commands/icons/schema.js +97 -15
  131. package/esm/commands/icons/utils.js +125 -13
  132. package/esm/commands/index.js +47 -155
  133. package/esm/commands/schema.js +22 -7
  134. package/esm/index.js +3 -4
  135. package/package.json +5 -2
  136. package/vitest.config.ts +11 -0
  137. package/cjs/__chunks/2FSYDFUV.cjs +0 -146
  138. package/cjs/__chunks/3A5ZYU5M.cjs +0 -105
  139. package/cjs/__chunks/3BY5Y4W7.cjs +0 -1
  140. package/cjs/__chunks/3NOHGUCF.cjs +0 -9
  141. package/cjs/__chunks/3T2LXW7J.cjs +0 -387
  142. package/cjs/__chunks/4SFWHCB3.cjs +0 -133
  143. package/cjs/__chunks/4XT5JEAS.cjs +0 -1
  144. package/cjs/__chunks/AZEB4H4I.cjs +0 -208
  145. package/cjs/__chunks/B2KFW7T7.cjs +0 -1
  146. package/cjs/__chunks/B5ENMOCD.cjs +0 -288
  147. package/cjs/__chunks/B6XM5KSF.cjs +0 -338
  148. package/cjs/__chunks/BDU2UCE5.cjs +0 -1
  149. package/cjs/__chunks/BLMSMR5E.cjs +0 -46
  150. package/cjs/__chunks/CMUD7LLN.cjs +0 -47
  151. package/cjs/__chunks/DTQ2LB3I.cjs +0 -49
  152. package/cjs/__chunks/FM5MVRQF.cjs +0 -23
  153. package/cjs/__chunks/FRHST54J.cjs +0 -135
  154. package/cjs/__chunks/FU4VP2LN.cjs +0 -1
  155. package/cjs/__chunks/G5K4PVIL.cjs +0 -26
  156. package/cjs/__chunks/GU3R54MK.cjs +0 -127
  157. package/cjs/__chunks/GUL36IFZ.cjs +0 -61
  158. package/cjs/__chunks/GZMTNK5N.cjs +0 -1
  159. package/cjs/__chunks/H74JSDBU.cjs +0 -30
  160. package/cjs/__chunks/INFOPAHN.cjs +0 -117
  161. package/cjs/__chunks/J36P6UNE.cjs +0 -75
  162. package/cjs/__chunks/JB7T7PKQ.cjs +0 -538
  163. package/cjs/__chunks/JSL2JDMW.cjs +0 -1
  164. package/cjs/__chunks/K4QNHRTP.cjs +0 -163
  165. package/cjs/__chunks/KU76LC42.cjs +0 -192
  166. package/cjs/__chunks/LFDSHANP.cjs +0 -34
  167. package/cjs/__chunks/LHE24ECK.cjs +0 -192
  168. package/cjs/__chunks/LIKQ3SI4.cjs +0 -1
  169. package/cjs/__chunks/LXDF5QVZ.cjs +0 -313
  170. package/cjs/__chunks/LXOOJR2R.cjs +0 -74
  171. package/cjs/__chunks/N5MXFOQZ.cjs +0 -167
  172. package/cjs/__chunks/N7D56LPP.cjs +0 -25
  173. package/cjs/__chunks/NFXQNOQH.cjs +0 -393
  174. package/cjs/__chunks/NIMXXHJQ.cjs +0 -92
  175. package/cjs/__chunks/NLKJIUEX.cjs +0 -126
  176. package/cjs/__chunks/NT2XXAI6.cjs +0 -89
  177. package/cjs/__chunks/NWZGFHKH.cjs +0 -121
  178. package/cjs/__chunks/R3GUC7O7.cjs +0 -110
  179. package/cjs/__chunks/RPVAXPJ4.cjs +0 -1
  180. package/cjs/__chunks/S3LVCWPN.cjs +0 -23
  181. package/cjs/__chunks/SBBNW2BF.cjs +0 -249
  182. package/cjs/__chunks/T2A7TN4F.cjs +0 -81
  183. package/cjs/__chunks/TKNNDDIB.cjs +0 -97
  184. package/cjs/__chunks/TNSRDJPR.cjs +0 -1
  185. package/cjs/__chunks/UWHPE2GI.cjs +0 -20
  186. package/cjs/__chunks/W6K7BV74.cjs +0 -1
  187. package/cjs/__chunks/WBOQ6AUN.cjs +0 -320
  188. package/cjs/__chunks/WHGN5PZI.cjs +0 -299
  189. package/cjs/__chunks/WOYF2L6T.cjs +0 -11
  190. package/cjs/__chunks/X26XY2N6.cjs +0 -18
  191. package/cjs/__chunks/XMKOKRXZ.cjs +0 -16
  192. package/cjs/__chunks/XTJPQ3EX.cjs +0 -1
  193. package/cjs/__chunks/YRHFKTW2.cjs +0 -63
  194. package/cjs/__chunks/ZMDIOZPT.cjs +0 -22
  195. package/cjs/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.cjs +0 -28
  196. package/cjs/commands/aws/iam/policies/sts-federation.cjs +0 -19
  197. package/cjs/commands/aws/iam/policies/user-admins-deny-list.cjs +0 -183
  198. package/cjs/commands/aws/iam/policies/user-admins-deny-regions-list.cjs +0 -49
  199. package/cjs/commands/aws/iam/policies/user-admins-self-service-iam.cjs +0 -64
  200. package/cjs/commands/aws/iam/policies/user-admins-write-list.cjs +0 -125
  201. package/esm/__chunks/2FTTEFEK.js +0 -97
  202. package/esm/__chunks/33UYMUQD.js +0 -338
  203. package/esm/__chunks/3BKWTHLJ.js +0 -25
  204. package/esm/__chunks/3HE4BEJX.js +0 -105
  205. package/esm/__chunks/3QLI5BDL.js +0 -387
  206. package/esm/__chunks/5GIUAFXL.js +0 -89
  207. package/esm/__chunks/5ZBVGSOK.js +0 -0
  208. package/esm/__chunks/6G4PXXKF.js +0 -75
  209. package/esm/__chunks/73BJG53F.js +0 -11
  210. package/esm/__chunks/7VF4Q43Q.js +0 -0
  211. package/esm/__chunks/AEDEAYF5.js +0 -0
  212. package/esm/__chunks/AZCP3SFJ.js +0 -0
  213. package/esm/__chunks/B2DVQ2UL.js +0 -61
  214. package/esm/__chunks/CVQVHLW5.js +0 -0
  215. package/esm/__chunks/D62SPZXC.js +0 -0
  216. package/esm/__chunks/DLEJ25GZ.js +0 -121
  217. package/esm/__chunks/DMYFNF54.js +0 -192
  218. package/esm/__chunks/DNFTUMGD.js +0 -23
  219. package/esm/__chunks/DVKD6YSR.js +0 -49
  220. package/esm/__chunks/EMSH4P76.js +0 -20
  221. package/esm/__chunks/FFKFVMIE.js +0 -167
  222. package/esm/__chunks/FL7AILGH.js +0 -133
  223. package/esm/__chunks/FNXUONAV.js +0 -110
  224. package/esm/__chunks/G4NJHFFU.js +0 -320
  225. package/esm/__chunks/HJSXC6HP.js +0 -117
  226. package/esm/__chunks/IEOGAQYI.js +0 -46
  227. package/esm/__chunks/IZFGBYGE.js +0 -34
  228. package/esm/__chunks/J34UVKLA.js +0 -26
  229. package/esm/__chunks/JZPBBBIG.js +0 -74
  230. package/esm/__chunks/KWUJP5MG.js +0 -135
  231. package/esm/__chunks/M35URMT4.js +0 -313
  232. package/esm/__chunks/NF3M2L6C.js +0 -81
  233. package/esm/__chunks/O3CCA76Q.js +0 -22
  234. package/esm/__chunks/PNPPDYKC.js +0 -299
  235. package/esm/__chunks/QFXN4EHM.js +0 -393
  236. package/esm/__chunks/QKDDLIWD.js +0 -146
  237. package/esm/__chunks/QSE66AKY.js +0 -208
  238. package/esm/__chunks/QUF7PS4R.js +0 -18
  239. package/esm/__chunks/S7IJPJ4R.js +0 -126
  240. package/esm/__chunks/SD3E3EPH.js +0 -163
  241. package/esm/__chunks/SJXQJ7RS.js +0 -92
  242. package/esm/__chunks/SNCKIAOR.js +0 -0
  243. package/esm/__chunks/T3TTUHTW.js +0 -30
  244. package/esm/__chunks/TIOVE6HR.js +0 -0
  245. package/esm/__chunks/TXKMEIDQ.js +0 -0
  246. package/esm/__chunks/U7HAE2RF.js +0 -288
  247. package/esm/__chunks/UXWY7BYE.js +0 -63
  248. package/esm/__chunks/VKAKISRG.js +0 -192
  249. package/esm/__chunks/WD2YR6I7.js +0 -0
  250. package/esm/__chunks/WOZFZKFY.js +0 -0
  251. package/esm/__chunks/XI7GZDE2.js +0 -0
  252. package/esm/__chunks/XOUWDB3T.js +0 -249
  253. package/esm/__chunks/XQN2TA4S.js +0 -23
  254. package/esm/__chunks/XXK32TIM.js +0 -16
  255. package/esm/__chunks/YGWTVPZE.js +0 -538
  256. package/esm/__chunks/YRG7PT33.js +0 -127
  257. package/esm/__chunks/ZHKVJO2U.js +0 -47
  258. package/esm/__chunks/ZO55YUSY.js +0 -9
  259. package/esm/commands/aws/iam/policies/s3-restrictions-deny-non-s3-services.js +0 -28
  260. package/esm/commands/aws/iam/policies/sts-federation.js +0 -19
  261. package/esm/commands/aws/iam/policies/user-admins-deny-list.js +0 -183
  262. package/esm/commands/aws/iam/policies/user-admins-deny-regions-list.js +0 -49
  263. package/esm/commands/aws/iam/policies/user-admins-self-service-iam.js +0 -64
  264. package/esm/commands/aws/iam/policies/user-admins-write-list.js +0 -125
@@ -1,12 +1,106 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
- var _NIMXXHJQcjs = require('../../../__chunks/NIMXXHJQ.cjs');
7
-
8
-
9
-
10
-
11
-
12
- exports.exec = _NIMXXHJQcjs.exec; exports.execJson = _NIMXXHJQcjs.execJson; exports.execNumber = _NIMXXHJQcjs.execNumber; exports.execString = _NIMXXHJQcjs.execString;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_rolldown_runtime = require("../../../__chunks/VH7oDXx4.cjs");
3
+ let chalk = require("chalk");
4
+ chalk = require_rolldown_runtime.__toESM(chalk, 1);
5
+ let child_process = require("child_process");
6
+ //#region src/commands/doppler/utils/exec.js
7
+ /**
8
+ * @typedef {'silent' | 'verbose' | 'default'} VerbosityLevel
9
+ */
10
+ /**
11
+ * @typedef {Object} ExecOptions
12
+ * @property {'string' | 'number' | 'json'} [stdoutParser='string'] - How to parse stdout
13
+ * @property {boolean} [throwOnError=true] - Whether to throw on error
14
+ * @property {VerbosityLevel} [verbosity='default'] - Output verbosity level
15
+ */
16
+ /**
17
+ * Execute a command and parse the output
18
+ * @param {string} command - Command to execute
19
+ * @param {import('child_process').ExecSyncOptions & ExecOptions} [options={}] - Execution options (inherits all execSync options + custom options)
20
+ * @returns {string | number | any} - Parsed output based on stdoutParser
21
+ */
22
+ function exec(command, options = {}) {
23
+ const { stdoutParser = "string", throwOnError = true, verbosity = "default", stdio: userStdio, ...execSyncOptions } = options;
24
+ try {
25
+ if (verbosity === "verbose") console.log(chalk.default.gray(` Executing: ${command}`));
26
+ /** @type {import('child_process').StdioOptions} */
27
+ let stdio;
28
+ if (userStdio) stdio = userStdio;
29
+ else if (verbosity === "verbose") stdio = "inherit";
30
+ else if (verbosity === "silent") stdio = "pipe";
31
+ else stdio = [
32
+ "pipe",
33
+ "pipe",
34
+ "pipe"
35
+ ];
36
+ const result = (0, child_process.execSync)(command, {
37
+ encoding: "utf-8",
38
+ stdio,
39
+ ...execSyncOptions
40
+ });
41
+ if (stdio === "inherit") return stdoutParser === "string" ? "" : void 0;
42
+ if (!result || typeof result === "string" && !result.trim()) return stdoutParser === "string" ? "" : void 0;
43
+ switch (stdoutParser) {
44
+ case "json": try {
45
+ return JSON.parse(result);
46
+ } catch (parseError) {
47
+ if (throwOnError) throw new Error(`Failed to parse JSON output: ${parseError.message}`);
48
+ return;
49
+ }
50
+ case "number": {
51
+ const num = parseFloat(result.trim());
52
+ if (isNaN(num)) {
53
+ if (throwOnError) throw new Error(`Failed to parse number from output: ${result}`);
54
+ return;
55
+ }
56
+ return num;
57
+ }
58
+ default: return result;
59
+ }
60
+ } catch (error) {
61
+ if (!throwOnError) return;
62
+ if (error.stderr) throw new Error(error.stderr.toString());
63
+ throw error;
64
+ }
65
+ }
66
+ /**
67
+ * Execute a command with string output
68
+ * @param {string} command - Command to execute
69
+ * @param {import('child_process').ExecSyncOptions & ExecOptions} [options] - Execution options
70
+ * @returns {string}
71
+ */
72
+ function execString(command, options = {}) {
73
+ return exec(command, {
74
+ ...options,
75
+ stdoutParser: "string"
76
+ });
77
+ }
78
+ /**
79
+ * Execute a command with JSON output
80
+ * @param {string} command - Command to execute
81
+ * @param {import('child_process').ExecSyncOptions & ExecOptions} [options] - Execution options
82
+ * @returns {any}
83
+ */
84
+ function execJson(command, options = {}) {
85
+ return exec(command, {
86
+ ...options,
87
+ stdoutParser: "json"
88
+ });
89
+ }
90
+ /**
91
+ * Execute a command with number output
92
+ * @param {string} command - Command to execute
93
+ * @param {import('child_process').ExecSyncOptions & ExecOptions} [options] - Execution options
94
+ * @returns {number}
95
+ */
96
+ function execNumber(command, options = {}) {
97
+ return exec(command, {
98
+ ...options,
99
+ stdoutParser: "number"
100
+ });
101
+ }
102
+ //#endregion
103
+ exports.exec = exec;
104
+ exports.execJson = execJson;
105
+ exports.execNumber = execNumber;
106
+ exports.execString = execString;
@@ -1,34 +1,412 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
-
12
- var _JB7T7PKQcjs = require('../../__chunks/JB7T7PKQ.cjs');
13
-
14
-
15
-
16
-
17
-
18
- var _NIMXXHJQcjs = require('../../__chunks/NIMXXHJQ.cjs');
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
-
28
-
29
-
30
-
31
-
32
-
33
-
34
- exports.checkDependencies = _JB7T7PKQcjs.checkDependencies; exports.checkDopplerAuth = _JB7T7PKQcjs.checkDopplerAuth; exports.cloneProject = _JB7T7PKQcjs.cloneProject; exports.createDiff = _JB7T7PKQcjs.createDiff; exports.downloadConfigs = _JB7T7PKQcjs.downloadConfigs; exports.exec = _NIMXXHJQcjs.exec; exports.execDoppler = _JB7T7PKQcjs.execDoppler; exports.execJson = _NIMXXHJQcjs.execJson; exports.execNumber = _NIMXXHJQcjs.execNumber; exports.execString = _NIMXXHJQcjs.execString; exports.getConfigs = _JB7T7PKQcjs.getConfigs; exports.normalizeEscapeSequences = _JB7T7PKQcjs.normalizeEscapeSequences; exports.promptConfirmation = _JB7T7PKQcjs.promptConfirmation; exports.uploadConfigs = _JB7T7PKQcjs.uploadConfigs;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_rolldown_runtime = require("../../__chunks/VH7oDXx4.cjs");
3
+ const require_commands_doppler_utils_exec = require("./utils/exec.cjs");
4
+ let chalk = require("chalk");
5
+ chalk = require_rolldown_runtime.__toESM(chalk, 1);
6
+ let child_process = require("child_process");
7
+ let fs = require("fs");
8
+ let path = require("path");
9
+ let readline = require("readline");
10
+ let os = require("os");
11
+ //#region src/commands/doppler/utils.js
12
+ /**
13
+ * @typedef {import('./utils/exec.js').VerbosityLevel} VerbosityLevel
14
+ * @typedef {import('./utils/exec.js').ExecOptions} ExecOptions
15
+ */
16
+ const DEFAULT_DOPPLER_ENVIRONMENT = "dev";
17
+ const DOPPLER_INTERNAL_KEYS = /* @__PURE__ */ new Set([
18
+ "DOPPLER_CONFIG",
19
+ "DOPPLER_ENVIRONMENT",
20
+ "DOPPLER_PROJECT"
21
+ ]);
22
+ /**
23
+ * Execute a doppler command and return the result
24
+ * @param {string[]} args - Command arguments
25
+ * @param {'string' | 'json'} parser - How to parse the output
26
+ * @param {boolean} silent - Suppress output
27
+ * @param {boolean} verbose - Show verbose output
28
+ * @returns {string | any}
29
+ */
30
+ function execDoppler(args, parser = "string", silent = false, verbose = false) {
31
+ const command = `doppler ${args.join(" ")}`;
32
+ /** @type {import('./utils/exec.js').VerbosityLevel} */
33
+ let verbosity = "default";
34
+ if (verbose) verbosity = "verbose";
35
+ else if (silent) verbosity = "silent";
36
+ return require_commands_doppler_utils_exec.exec(command, {
37
+ verbosity,
38
+ stdoutParser: parser,
39
+ throwOnError: true
40
+ });
41
+ }
42
+ /**
43
+ * Check if the Doppler CLI is installed and the user is logged in.
44
+ * Does not require a local project setup (doppler setup).
45
+ * @param {boolean} verbose - Show verbose output
46
+ */
47
+ function checkDopplerAuth(verbose = false) {
48
+ if (verbose) console.log(chalk.default.blue("\nšŸ” Checking Doppler authentication..."));
49
+ try {
50
+ (0, child_process.execSync)("which doppler", { stdio: "pipe" });
51
+ if (verbose) console.log(chalk.default.green(" āœ“ Doppler CLI is installed"));
52
+ } catch {
53
+ throw new Error("Doppler is not installed. Please install Doppler (brew install dopplerhq/cli/doppler), login, and try again.");
54
+ }
55
+ try {
56
+ execDoppler(["me"], "string", true, verbose);
57
+ if (verbose) console.log(chalk.default.green(" āœ“ Doppler is authenticated"));
58
+ } catch {
59
+ throw new Error("Doppler is not logged in. Please run 'doppler login' and try again.");
60
+ }
61
+ }
62
+ /**
63
+ * Check if doppler CLI is installed, logged in, and a project is configured.
64
+ * @param {boolean} verbose - Show verbose output
65
+ */
66
+ function checkDependencies(verbose = false) {
67
+ checkDopplerAuth(verbose);
68
+ if (verbose) console.log(chalk.default.blue("\nšŸ” Checking Doppler project setup..."));
69
+ try {
70
+ execDoppler(["configs", "--json"], "json", true, verbose);
71
+ if (verbose) console.log(chalk.default.green(" āœ“ Doppler project is configured"));
72
+ } catch {
73
+ throw new Error("Doppler is not configured. Please run 'doppler setup' and try again.");
74
+ }
75
+ }
76
+ /**
77
+ * Get list of configurations based on environments parameter
78
+ * @param {string} environments - Comma-separated env names ('all', 'dev', 'dev,stg', etc.)
79
+ * @param {boolean} verbose - Show verbose output
80
+ * @param {string | null} project - Optional Doppler project name
81
+ * @returns {string[]}
82
+ */
83
+ function getConfigs(environments, verbose = false, project = null) {
84
+ if (verbose) console.log(chalk.default.blue(`\nšŸ“‹ Resolving configurations for environments: ${chalk.default.cyan(environments)}`));
85
+ const configArgs = ["configs", "--json"];
86
+ if (project) configArgs.push("--project", project);
87
+ const availableConfigs = execDoppler(configArgs, "json", true, verbose);
88
+ const configNames = Array.isArray(availableConfigs) ? availableConfigs.map((config) => config.name) : [];
89
+ if (verbose && configNames.length > 0) console.log(chalk.default.gray(` Available configurations: ${configNames.join(", ")}`));
90
+ if (environments === "all") {
91
+ if (configNames.length === 0) throw new Error("No configurations found in Doppler");
92
+ if (verbose) console.log(chalk.default.green(` āœ“ Using all ${configNames.length} configurations`));
93
+ return configNames;
94
+ }
95
+ const requested = environments.split(",").map((e) => e.trim());
96
+ if (configNames.length > 0) {
97
+ const missing = requested.filter((e) => !configNames.includes(e));
98
+ if (missing.length > 0) throw new Error(`Configurations not found: ${missing.join(", ")}. Available: ${configNames.join(", ")}`);
99
+ }
100
+ if (verbose) console.log(chalk.default.green(` āœ“ Using configurations: ${requested.join(", ")}`));
101
+ return requested;
102
+ }
103
+ /**
104
+ * Normalize escape sequences in file content
105
+ * @param {string} content - File content
106
+ * @returns {string}
107
+ */
108
+ function normalizeEscapeSequences(content) {
109
+ return content.replace(/\\n/g, "\n").replace(/\\t/g, " ").replace(/\\r/g, "\r");
110
+ }
111
+ /**
112
+ * Create a unified diff between two strings
113
+ * @param {string} oldContent - Original content
114
+ * @param {string} newContent - New content
115
+ * @returns {string[]}
116
+ */
117
+ function createDiff(oldContent, newContent) {
118
+ const oldLines = oldContent.split("\n");
119
+ const newLines = newContent.split("\n");
120
+ const diff = [];
121
+ const maxLines = Math.max(oldLines.length, newLines.length);
122
+ for (let i = 0; i < maxLines; i++) {
123
+ const oldLine = oldLines[i] || "";
124
+ const newLine = newLines[i] || "";
125
+ if (oldLine !== newLine) {
126
+ if (oldLine && !newLine) diff.push(`-${oldLine}`);
127
+ else if (!oldLine && newLine) diff.push(`+${newLine}`);
128
+ else {
129
+ diff.push(`-${oldLine}`);
130
+ diff.push(`+${newLine}`);
131
+ }
132
+ }
133
+ }
134
+ return diff;
135
+ }
136
+ /**
137
+ * Prompt user for confirmation
138
+ * @param {string} message - Prompt message
139
+ * @returns {Promise<boolean>}
140
+ */
141
+ function promptConfirmation(message) {
142
+ return new Promise((resolve) => {
143
+ const rl = (0, readline.createInterface)({
144
+ input: process.stdin,
145
+ output: process.stdout
146
+ });
147
+ rl.question(message, (answer) => {
148
+ rl.close();
149
+ resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
150
+ });
151
+ });
152
+ }
153
+ /**
154
+ * Download configurations from Doppler
155
+ * @param {{
156
+ * verbose: boolean;
157
+ * environments: string;
158
+ * }} options - Options for downloading configurations
159
+ */
160
+ async function downloadConfigs(options) {
161
+ const { environments, verbose } = options;
162
+ const actualEnvironments = environments ?? DEFAULT_DOPPLER_ENVIRONMENT;
163
+ const configs = getConfigs(actualEnvironments, verbose);
164
+ if (verbose) console.log(chalk.default.blue(`\nā¬‡ļø Starting download process for ${configs.length} configuration(s)...`));
165
+ if (configs.length === 1 && actualEnvironments !== "all") console.log("You can use -e all to download all configurations, or -e dev,stg for specific environments.");
166
+ for (const config of configs) {
167
+ const envFile = `.env.${config}`;
168
+ const backupFile = `${envFile}.backup`;
169
+ let backupMsg = "";
170
+ if (verbose) console.log(chalk.default.blue(`\nšŸ“¦ Processing config: ${chalk.default.cyan(config)}`));
171
+ try {
172
+ if ((0, fs.existsSync)(envFile)) {
173
+ if (verbose) console.log(chalk.default.gray(` Creating backup: ${backupFile}`));
174
+ (0, fs.renameSync)(envFile, backupFile);
175
+ backupMsg = "Backed up existing file, ";
176
+ }
177
+ if (verbose) console.log(chalk.default.gray(` Downloading secrets from Doppler...`));
178
+ const content = execDoppler([
179
+ "secrets",
180
+ "download",
181
+ "--no-file",
182
+ "--format",
183
+ "env",
184
+ "--config",
185
+ config
186
+ ], "string", !verbose, verbose);
187
+ if (typeof content === "string") {
188
+ (0, fs.writeFileSync)(envFile, content, "utf-8");
189
+ if (verbose) console.log(chalk.default.gray(` Written to: ${envFile}`));
190
+ } else throw new Error("Invalid content received from Doppler");
191
+ console.log(`Config ${chalk.default.blue(config)}: ${backupMsg}downloaded successfully to ${chalk.default.green(envFile)}`);
192
+ if (config === "dev" && !(0, fs.existsSync)(".env")) {
193
+ (0, fs.copyFileSync)(envFile, ".env");
194
+ console.log(`Copied ${chalk.default.green(".env.dev")} to ${chalk.default.green(".env")}`);
195
+ }
196
+ if ((0, fs.existsSync)(backupFile)) {
197
+ if (verbose) console.log(chalk.default.gray(` Removing backup file`));
198
+ (0, fs.unlinkSync)(backupFile);
199
+ }
200
+ } catch (error) {
201
+ console.error(`Failed to download ${config}: ${error?.message || error}`);
202
+ if ((0, fs.existsSync)(backupFile)) {
203
+ (0, fs.renameSync)(backupFile, envFile);
204
+ console.log(`Restored backup for ${envFile}`);
205
+ }
206
+ }
207
+ }
208
+ }
209
+ /**
210
+ * Upload configurations to Doppler
211
+ * @param {{
212
+ * environments: string;
213
+ * verbose: boolean;
214
+ * }} options - Options for uploading configurations
215
+ */
216
+ async function uploadConfigs(options) {
217
+ const { environments, verbose } = options;
218
+ const configs = getConfigs(environments, verbose);
219
+ if (verbose) console.log(chalk.default.blue(`\nā¬†ļø Starting upload process for ${configs.length} configuration(s)...`));
220
+ for (const config of configs) {
221
+ const envFile = `.env.${config}`;
222
+ const backupFile = `${envFile}.doppler`;
223
+ const normalizedFile = `${envFile}.normalized`;
224
+ if (verbose) console.log(chalk.default.blue(`\nšŸ“¦ Processing config: ${chalk.default.cyan(config)}`));
225
+ try {
226
+ if (!(0, fs.existsSync)(envFile)) {
227
+ console.log(`Config ${config}: ${chalk.default.green(envFile)} does not exist. Skipping upload.`);
228
+ continue;
229
+ }
230
+ if (verbose) console.log(chalk.default.gray(` Creating backup of current Doppler config...`));
231
+ try {
232
+ const backupContent = execDoppler([
233
+ "secrets",
234
+ "download",
235
+ "--no-file",
236
+ "--format",
237
+ "env",
238
+ "--config",
239
+ config
240
+ ], "string", !verbose, verbose);
241
+ if (typeof backupContent === "string") {
242
+ (0, fs.writeFileSync)(backupFile, backupContent, "utf-8");
243
+ if (verbose) console.log(chalk.default.gray(` Backup created: ${backupFile}`));
244
+ } else throw new Error("Invalid backup content received from Doppler");
245
+ } catch {
246
+ console.log(`Config ${config}: Failed to create backup. Skipping upload.`);
247
+ continue;
248
+ }
249
+ if (verbose) console.log(chalk.default.gray(` Reading local file: ${envFile}`));
250
+ const normalizedContent = normalizeEscapeSequences((0, fs.readFileSync)(envFile, "utf-8"));
251
+ (0, fs.writeFileSync)(normalizedFile, normalizedContent, "utf-8");
252
+ if (verbose) console.log(chalk.default.gray(` Comparing local changes with Doppler...`));
253
+ const diff = createDiff((0, fs.readFileSync)(backupFile, "utf-8"), normalizedContent);
254
+ if (diff.length === 0) {
255
+ console.log(`Config ${config}: No differences found. Skipping upload.`);
256
+ (0, fs.unlinkSync)(backupFile);
257
+ (0, fs.unlinkSync)(normalizedFile);
258
+ continue;
259
+ }
260
+ if (verbose) console.log(chalk.default.yellow(` Found ${diff.length} line changes`));
261
+ console.log("\nChanges to be uploaded:");
262
+ for (const line of diff) if (line.startsWith("-")) console.log(chalk.default.red(line));
263
+ else if (line.startsWith("+")) console.log(chalk.default.green(line));
264
+ if (!await promptConfirmation("\nDo you want to proceed with the upload? (y/n) ")) {
265
+ console.log(`Upload cancelled for ${chalk.default.green(envFile)}`);
266
+ (0, fs.unlinkSync)(backupFile);
267
+ (0, fs.unlinkSync)(normalizedFile);
268
+ continue;
269
+ }
270
+ if (verbose) console.log(chalk.default.gray(` Uploading to Doppler...`));
271
+ try {
272
+ execDoppler([
273
+ "secrets",
274
+ "upload",
275
+ normalizedFile,
276
+ "--config",
277
+ config,
278
+ "--silent"
279
+ ], "string", !verbose, verbose);
280
+ if (config === "dev") console.log(`Config ${chalk.default.blue(config)}: Successfully uploaded ${chalk.default.green(envFile)}`);
281
+ else console.log(`Config ${config}: Successfully uploaded ${chalk.default.green(envFile)}`);
282
+ } catch {
283
+ console.error(`Config ${config}: Failed to upload ${chalk.default.green(envFile)}. Restoring previous configuration.`);
284
+ try {
285
+ if (verbose) console.log(chalk.default.gray(` Restoring previous configuration...`));
286
+ execDoppler([
287
+ "secrets",
288
+ "upload",
289
+ backupFile,
290
+ "--config",
291
+ config,
292
+ "--silent"
293
+ ], "string", !verbose, verbose);
294
+ console.log(`Config ${config}: Successfully restored previous configuration`);
295
+ } catch {
296
+ console.error(`Config ${config}: Failed to restore previous configuration`);
297
+ }
298
+ }
299
+ if ((0, fs.existsSync)(backupFile)) (0, fs.unlinkSync)(backupFile);
300
+ if ((0, fs.existsSync)(normalizedFile)) (0, fs.unlinkSync)(normalizedFile);
301
+ } catch (error) {
302
+ console.error(`Error processing config ${config}: ${error?.message || error}`);
303
+ if ((0, fs.existsSync)(backupFile)) (0, fs.unlinkSync)(backupFile);
304
+ if ((0, fs.existsSync)(normalizedFile)) (0, fs.unlinkSync)(normalizedFile);
305
+ }
306
+ }
307
+ }
308
+ /**
309
+ * Clone secrets from one Doppler project to another
310
+ * @param {{
311
+ * from: string;
312
+ * to: string;
313
+ * environments: string;
314
+ * force: boolean;
315
+ * verbose: boolean;
316
+ * }} options
317
+ */
318
+ async function cloneProject({ from, to, environments, force, verbose }) {
319
+ if (verbose) console.log(chalk.default.blue(`\nšŸ” Cloning from ${chalk.default.cyan(from)} to ${chalk.default.cyan(to)}...`));
320
+ const configsToClone = getConfigs(environments, verbose, from);
321
+ if (configsToClone.length === 0) throw new Error(`No configurations found in source project "${from}"`);
322
+ const targetConfigsRaw = execDoppler([
323
+ "configs",
324
+ "--json",
325
+ "--project",
326
+ to
327
+ ], "json", true, verbose);
328
+ const targetConfigNames = Array.isArray(targetConfigsRaw) ? targetConfigsRaw.map((c) => c.name) : [];
329
+ const missingInTarget = configsToClone.filter((c) => !targetConfigNames.includes(c));
330
+ if (missingInTarget.length > 0) throw new Error(`Configs missing in target project "${to}": ${missingInTarget.join(", ")}. Create them in Doppler first.`);
331
+ for (const config of configsToClone) {
332
+ if (verbose) console.log(chalk.default.blue(`\nšŸ“¦ Processing config: ${chalk.default.cyan(config)}`));
333
+ const sourceSecrets = execDoppler([
334
+ "secrets",
335
+ "--json",
336
+ "--project",
337
+ from,
338
+ "--config",
339
+ config
340
+ ], "json", true, verbose);
341
+ const sourceKeys = sourceSecrets ? Object.keys(sourceSecrets).filter((k) => !DOPPLER_INTERNAL_KEYS.has(k)) : [];
342
+ const targetSecrets = execDoppler([
343
+ "secrets",
344
+ "--json",
345
+ "--project",
346
+ to,
347
+ "--config",
348
+ config
349
+ ], "json", true, verbose);
350
+ const targetKeys = targetSecrets ? Object.keys(targetSecrets) : [];
351
+ const conflicts = sourceKeys.filter((k) => targetKeys.includes(k));
352
+ if (conflicts.length > 0) {
353
+ if (process.env["CI"]) throw new Error(`Config "${config}" has ${conflicts.length} conflicting key(s) in target: ${conflicts.join(", ")}`);
354
+ if (!force) {
355
+ console.log(`\nConfig ${chalk.default.cyan(config)}: ${conflicts.length} key(s) already exist in ${chalk.default.cyan(to)}:`);
356
+ conflicts.forEach((k) => console.log(chalk.default.yellow(` • ${k}`)));
357
+ if (!await promptConfirmation(`\nOverwrite these keys in "${to}/${config}"? (y/n) `)) {
358
+ console.log(`Skipped ${chalk.default.blue(config)}`);
359
+ continue;
360
+ }
361
+ }
362
+ }
363
+ const tmpFile = (0, path.join)((0, os.tmpdir)(), `doppler-clone-${config}-${Date.now()}.env`);
364
+ try {
365
+ const content = execDoppler([
366
+ "secrets",
367
+ "download",
368
+ "--no-file",
369
+ "--format",
370
+ "env",
371
+ "--project",
372
+ from,
373
+ "--config",
374
+ config
375
+ ], "string", true, verbose);
376
+ if (typeof content !== "string" || !content) throw new Error(`No secrets returned for config "${config}"`);
377
+ const filtered = content.split("\n").filter((line) => {
378
+ const key = line.split("=")[0] ?? "";
379
+ return !DOPPLER_INTERNAL_KEYS.has(key);
380
+ }).join("\n");
381
+ (0, fs.writeFileSync)(tmpFile, filtered, "utf-8");
382
+ execDoppler([
383
+ "secrets",
384
+ "upload",
385
+ tmpFile,
386
+ "--project",
387
+ to,
388
+ "--config",
389
+ config,
390
+ "--silent"
391
+ ], "string", true, verbose);
392
+ console.log(`Config ${chalk.default.blue(config)}: cloned to ${chalk.default.green(to)}`);
393
+ } finally {
394
+ if ((0, fs.existsSync)(tmpFile)) (0, fs.unlinkSync)(tmpFile);
395
+ }
396
+ }
397
+ }
398
+ //#endregion
399
+ exports.checkDependencies = checkDependencies;
400
+ exports.checkDopplerAuth = checkDopplerAuth;
401
+ exports.cloneProject = cloneProject;
402
+ exports.createDiff = createDiff;
403
+ exports.downloadConfigs = downloadConfigs;
404
+ exports.exec = require_commands_doppler_utils_exec.exec;
405
+ exports.execDoppler = execDoppler;
406
+ exports.execJson = require_commands_doppler_utils_exec.execJson;
407
+ exports.execNumber = require_commands_doppler_utils_exec.execNumber;
408
+ exports.execString = require_commands_doppler_utils_exec.execString;
409
+ exports.getConfigs = getConfigs;
410
+ exports.normalizeEscapeSequences = normalizeEscapeSequences;
411
+ exports.promptConfirmation = promptConfirmation;
412
+ exports.uploadConfigs = uploadConfigs;
@@ -1,8 +1,82 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
- var _INFOPAHNcjs = require('../../__chunks/INFOPAHN.cjs');
4
- require('../../__chunks/4SFWHCB3.cjs');
5
- require('../../__chunks/J36P6UNE.cjs');
6
-
7
-
8
- exports.iconsCommand = _INFOPAHNcjs.iconsCommand;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_rolldown_runtime = require("../../__chunks/VH7oDXx4.cjs");
3
+ const require_commands_icons_schema = require("./schema.cjs");
4
+ const require_commands_icons_utils = require("./utils.cjs");
5
+ let chalk = require("chalk");
6
+ chalk = require_rolldown_runtime.__toESM(chalk, 1);
7
+ let zod = require("zod");
8
+ //#region src/commands/icons/handler.js
9
+ /**
10
+ * Main icons command handler
11
+ * @param {unknown} options - Command options (will be validated)
12
+ */
13
+ async function iconsCommand(options) {
14
+ try {
15
+ const validatedOptions = require_commands_icons_schema.iconsCommandOptionsSchema.parse(options);
16
+ if (validatedOptions.help) {
17
+ console.log(chalk.default.bold(`\nUsage: mtn icons <input> [options]`));
18
+ console.log(chalk.default.gray(require_commands_icons_schema.iconsCommandMetadata.description));
19
+ console.log(chalk.default.bold("\nOptions:"));
20
+ Object.entries(require_commands_icons_schema.iconsCommandOptionsSchema.shape).forEach(([key, fieldSchema]) => {
21
+ if (key === "input") return;
22
+ const description = fieldSchema.description || "No description available";
23
+ const optionMeta = require_commands_icons_schema.iconsCommandMetadata.options[key];
24
+ const defaultValue = optionMeta?.default ?? false;
25
+ const alias = optionMeta?.alias ? chalk.default.cyan(`, -${optionMeta.alias}`) : "";
26
+ console.log(chalk.default.cyan(` --${key}`) + alias + ` ${description} (default: ${defaultValue})`);
27
+ });
28
+ console.log("");
29
+ return;
30
+ }
31
+ const { input, channels, iconTypes, verbose } = validatedOptions;
32
+ if (verbose) {
33
+ console.log(chalk.default.blue("\nšŸ“± Icon Generation"));
34
+ console.log(chalk.default.gray(` Input directory: ${input}`));
35
+ console.log(chalk.default.gray(` Channels: ${channels.join(", ")}`));
36
+ console.log(chalk.default.gray(` Icon types: ${iconTypes.join(", ")}`));
37
+ }
38
+ require_commands_icons_utils.checkDependencies(verbose);
39
+ require_commands_icons_utils.validateBaseIcons(input, iconTypes, verbose);
40
+ const result = require_commands_icons_utils.generateAllIcons({
41
+ baseDir: input,
42
+ channels,
43
+ iconTypes,
44
+ verbose
45
+ });
46
+ console.log(chalk.default.bold("\nšŸ“Š Summary:"));
47
+ console.log(chalk.default.green(` āœ“ Successfully generated: ${result.success.length} icon(s)`));
48
+ if (result.failed.length > 0) {
49
+ console.log(chalk.default.red(` āœ— Failed: ${result.failed.length} icon(s)`));
50
+ result.failed.forEach(({ icon, error }) => {
51
+ console.log(chalk.default.red(` - ${icon}: ${error}`));
52
+ });
53
+ process.exit(1);
54
+ }
55
+ console.log(chalk.default.green(`\nāœ… All icons generated successfully!`));
56
+ } catch (error) {
57
+ if (error instanceof zod.ZodError) {
58
+ console.error(chalk.default.red(`\nāŒ Invalid command options:`));
59
+ error.errors.forEach((err) => {
60
+ console.error(chalk.default.red(` ${err.path.join(".")}: ${err.message}`));
61
+ });
62
+ process.exit(1);
63
+ }
64
+ const verbose = options?.verbose || false;
65
+ console.error(chalk.default.red(`\nāŒ Icon generation failed:`));
66
+ if (error instanceof Error) {
67
+ console.error(chalk.default.red(` ${error.message}`));
68
+ if (verbose && error.stack) {
69
+ console.error(chalk.default.gray("\nStack trace:"));
70
+ console.error(chalk.default.gray(error.stack));
71
+ }
72
+ } else console.error(chalk.default.red(` ${String(error)}`));
73
+ console.error(chalk.default.yellow("\nšŸ’” Troubleshooting tips:"));
74
+ console.error(chalk.default.yellow(" • Ensure ImageMagick is installed (brew install imagemagick)"));
75
+ console.error(chalk.default.yellow(" • Make sure icon.png and adaptive-icon.png exist in the input directory"));
76
+ console.error(chalk.default.yellow(" • Verify the input directory path is correct"));
77
+ console.error(chalk.default.yellow(" • Use --verbose for detailed error information\n"));
78
+ process.exit(1);
79
+ }
80
+ }
81
+ //#endregion
82
+ exports.iconsCommand = iconsCommand;