@mtndev/cli 0.0.0-dev-20260618142325

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 (73) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/cjs/__chunks/4SFWHCB3.cjs +133 -0
  3. package/cjs/__chunks/B2KFW7T7.cjs +1 -0
  4. package/cjs/__chunks/EMMC33QA.cjs +401 -0
  5. package/cjs/__chunks/FFFTVBUR.cjs +22 -0
  6. package/cjs/__chunks/HFSXD6YE.cjs +100 -0
  7. package/cjs/__chunks/INFOPAHN.cjs +117 -0
  8. package/cjs/__chunks/J36P6UNE.cjs +75 -0
  9. package/cjs/__chunks/NIMXXHJQ.cjs +92 -0
  10. package/cjs/__chunks/QBNNK2WX.cjs +52 -0
  11. package/cjs/__chunks/WNJ3ZYLI.cjs +1 -0
  12. package/cjs/commands/doppler/handler.cjs +9 -0
  13. package/cjs/commands/doppler/handler.d.ts +5 -0
  14. package/cjs/commands/doppler/index.cjs +41 -0
  15. package/cjs/commands/doppler/index.d.ts +3 -0
  16. package/cjs/commands/doppler/schema.cjs +8 -0
  17. package/cjs/commands/doppler/schema.d.ts +50 -0
  18. package/cjs/commands/doppler/utils/exec.cjs +12 -0
  19. package/cjs/commands/doppler/utils/exec.d.ts +52 -0
  20. package/cjs/commands/doppler/utils.cjs +30 -0
  21. package/cjs/commands/doppler/utils.d.ts +69 -0
  22. package/cjs/commands/icons/handler.cjs +8 -0
  23. package/cjs/commands/icons/handler.d.ts +5 -0
  24. package/cjs/commands/icons/index.cjs +31 -0
  25. package/cjs/commands/icons/index.d.ts +3 -0
  26. package/cjs/commands/icons/schema.cjs +16 -0
  27. package/cjs/commands/icons/schema.d.ts +86 -0
  28. package/cjs/commands/icons/utils.cjs +13 -0
  29. package/cjs/commands/icons/utils.d.ts +52 -0
  30. package/cjs/commands/index.cjs +84 -0
  31. package/cjs/commands/index.d.ts +2 -0
  32. package/cjs/commands/schema.cjs +8 -0
  33. package/cjs/commands/schema.d.ts +26 -0
  34. package/cjs/index.cjs +5 -0
  35. package/cjs/index.d.ts +2 -0
  36. package/esm/__chunks/46HGXFME.js +0 -0
  37. package/esm/__chunks/6G4PXXKF.js +75 -0
  38. package/esm/__chunks/EC6MPHID.js +22 -0
  39. package/esm/__chunks/FL7AILGH.js +133 -0
  40. package/esm/__chunks/G6WUCFLD.js +100 -0
  41. package/esm/__chunks/HJSXC6HP.js +117 -0
  42. package/esm/__chunks/LHVSSZI7.js +52 -0
  43. package/esm/__chunks/O262GK4B.js +401 -0
  44. package/esm/__chunks/SJXQJ7RS.js +92 -0
  45. package/esm/__chunks/SNCKIAOR.js +0 -0
  46. package/esm/commands/doppler/handler.d.ts +5 -0
  47. package/esm/commands/doppler/handler.js +9 -0
  48. package/esm/commands/doppler/index.d.ts +3 -0
  49. package/esm/commands/doppler/index.js +41 -0
  50. package/esm/commands/doppler/schema.d.ts +50 -0
  51. package/esm/commands/doppler/schema.js +8 -0
  52. package/esm/commands/doppler/utils/exec.d.ts +52 -0
  53. package/esm/commands/doppler/utils/exec.js +12 -0
  54. package/esm/commands/doppler/utils.d.ts +69 -0
  55. package/esm/commands/doppler/utils.js +30 -0
  56. package/esm/commands/icons/handler.d.ts +5 -0
  57. package/esm/commands/icons/handler.js +8 -0
  58. package/esm/commands/icons/index.d.ts +3 -0
  59. package/esm/commands/icons/index.js +31 -0
  60. package/esm/commands/icons/schema.d.ts +86 -0
  61. package/esm/commands/icons/schema.js +16 -0
  62. package/esm/commands/icons/utils.d.ts +52 -0
  63. package/esm/commands/icons/utils.js +13 -0
  64. package/esm/commands/index.d.ts +2 -0
  65. package/esm/commands/index.js +84 -0
  66. package/esm/commands/schema.d.ts +26 -0
  67. package/esm/commands/schema.js +8 -0
  68. package/esm/index.d.ts +2 -0
  69. package/esm/index.js +5 -0
  70. package/package.json +62 -0
  71. package/utils/input/package.json +8 -0
  72. package/utils/package/package.json +8 -0
  73. package/utils/validation/package.json +8 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,7 @@
1
+ # @mtndev/cli
2
+
3
+ ## 0.0.0-dev-20260618142325
4
+
5
+ ### Major Changes
6
+
7
+ - [#9](https://github.com/High-Country-Dev/core/pull/9) [`ff9c7fb`](https://github.com/High-Country-Dev/core/commit/ff9c7fb79bfee9e7b77f99e289bbba7804cda9bb) Thanks [@StarScape](https://github.com/StarScape)! - Change -e to -t
@@ -0,0 +1,133 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+
4
+ var _J36P6UNEcjs = require('./J36P6UNE.cjs');
5
+
6
+ // src/commands/icons/utils.js
7
+ var _child_process = require('child_process');
8
+ var _fs = require('fs');
9
+ var _path = require('path');
10
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
11
+ function checkDependencies(verbose = false) {
12
+ if (verbose) {
13
+ console.log(_chalk2.default.blue("\n\u{1F50D} Checking dependencies..."));
14
+ }
15
+ try {
16
+ _child_process.execSync.call(void 0, "which magick", { stdio: "pipe" });
17
+ if (verbose) {
18
+ console.log(_chalk2.default.green(" \u2713 ImageMagick is installed"));
19
+ }
20
+ } catch (e) {
21
+ throw new Error(
22
+ "ImageMagick is not installed. Please install it (brew install imagemagick) and try again."
23
+ );
24
+ }
25
+ }
26
+ function validateBaseIcons(baseDir, iconTypes, verbose = false) {
27
+ if (verbose) {
28
+ console.log(_chalk2.default.blue("\n\u{1F4C1} Validating base icons..."));
29
+ }
30
+ const resolvedDir = _path.resolve.call(void 0, baseDir);
31
+ if (!_fs.existsSync.call(void 0, resolvedDir)) {
32
+ throw new Error(`Input directory does not exist: ${resolvedDir}`);
33
+ }
34
+ const missingIcons = [];
35
+ for (const iconType of iconTypes) {
36
+ const iconPath = _path.join.call(void 0, resolvedDir, `${iconType}.png`);
37
+ if (!_fs.existsSync.call(void 0, iconPath)) {
38
+ missingIcons.push(`${iconType}.png`);
39
+ } else if (verbose) {
40
+ console.log(_chalk2.default.green(` \u2713 Found: ${iconType}.png`));
41
+ }
42
+ }
43
+ if (missingIcons.length > 0) {
44
+ throw new Error(
45
+ `Missing base icons in ${resolvedDir}: ${missingIcons.join(", ")}`
46
+ );
47
+ }
48
+ }
49
+ function generateIcon(options) {
50
+ const { baseDir, channel, iconType, verbose } = options;
51
+ const resolvedDir = _path.resolve.call(void 0, baseDir);
52
+ const inputFile = _path.join.call(void 0, resolvedDir, `${iconType}.png`);
53
+ const outputFile = _path.join.call(void 0, resolvedDir, `${iconType}-${channel}.png`);
54
+ const size = _J36P6UNEcjs.ICON_SIZE_MAP[
55
+ /** @type {keyof typeof ICON_SIZE_MAP} */
56
+ iconType
57
+ ] || 378;
58
+ const text = _J36P6UNEcjs.CHANNEL_TEXT_MAP[
59
+ /** @type {keyof typeof CHANNEL_TEXT_MAP} */
60
+ channel
61
+ ] || channel.toUpperCase().slice(0, 3);
62
+ const command = [
63
+ "magick",
64
+ `"${inputFile}"`,
65
+ `-pointsize ${size}`,
66
+ "-fill white",
67
+ "-gravity center",
68
+ "-font Arial-Black",
69
+ "-stroke black",
70
+ "-strokewidth 5",
71
+ `-draw "rotate -45 text 0,0 '${text}'"`,
72
+ `"${outputFile}"`
73
+ ].join(" ");
74
+ if (verbose) {
75
+ console.log(_chalk2.default.gray(` Command: ${command}`));
76
+ }
77
+ try {
78
+ _child_process.execSync.call(void 0, command, { stdio: verbose ? "inherit" : "pipe" });
79
+ return outputFile;
80
+ } catch (error) {
81
+ throw new Error(
82
+ `Failed to generate ${iconType}-${channel}.png: ${error instanceof Error ? error.message : String(error)}`
83
+ );
84
+ }
85
+ }
86
+ function generateAllIcons(options) {
87
+ const { baseDir, channels, iconTypes, verbose } = options;
88
+ const success = [];
89
+ const failed = [];
90
+ const totalIcons = channels.length * iconTypes.length;
91
+ let current = 0;
92
+ if (verbose) {
93
+ console.log(_chalk2.default.blue(`
94
+ \u{1F3A8} Generating ${totalIcons} icon(s)...`));
95
+ }
96
+ for (const channel of channels) {
97
+ for (const iconType of iconTypes) {
98
+ current++;
99
+ const iconName = `${iconType}-${channel}.png`;
100
+ if (verbose) {
101
+ console.log(
102
+ _chalk2.default.blue(`
103
+ [${current}/${totalIcons}] Generating ${iconName}...`)
104
+ );
105
+ }
106
+ try {
107
+ const outputPath = generateIcon({
108
+ baseDir,
109
+ channel,
110
+ iconType,
111
+ verbose
112
+ });
113
+ success.push(outputPath);
114
+ console.log(_chalk2.default.green(` \u2713 Generated: ${iconName}`));
115
+ } catch (error) {
116
+ const errorMessage = error instanceof Error ? error.message : String(error);
117
+ failed.push({ icon: iconName, error: errorMessage });
118
+ console.log(_chalk2.default.red(` \u2717 Failed: ${iconName}`));
119
+ if (verbose) {
120
+ console.log(_chalk2.default.red(` ${errorMessage}`));
121
+ }
122
+ }
123
+ }
124
+ }
125
+ return { success, failed };
126
+ }
127
+
128
+
129
+
130
+
131
+
132
+
133
+ exports.checkDependencies = checkDependencies; exports.validateBaseIcons = validateBaseIcons; exports.generateIcon = generateIcon; exports.generateAllIcons = generateAllIcons;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,401 @@
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 _NIMXXHJQcjs = require('./NIMXXHJQ.cjs');
4
+
5
+ // src/commands/doppler/utils.js
6
+ var _child_process = require('child_process');
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+ var _fs = require('fs');
15
+ var _readline = require('readline');
16
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
17
+ var DEFAULT_DOPPLER_ENVIRONMENT = "dev";
18
+ function execDoppler(args, parser = "string", silent = false, verbose = false) {
19
+ const command = `doppler ${args.join(" ")}`;
20
+ let verbosity = "default";
21
+ if (verbose) {
22
+ verbosity = "verbose";
23
+ } else if (silent) {
24
+ verbosity = "silent";
25
+ }
26
+ return _NIMXXHJQcjs.exec.call(void 0, command, {
27
+ verbosity,
28
+ stdoutParser: parser,
29
+ throwOnError: true
30
+ });
31
+ }
32
+ function checkDependencies(verbose = false) {
33
+ if (verbose) {
34
+ console.log(_chalk2.default.blue("\n\u{1F50D} Checking Doppler dependencies..."));
35
+ }
36
+ try {
37
+ _child_process.execSync.call(void 0, "which doppler", { stdio: "pipe" });
38
+ if (verbose) {
39
+ console.log(_chalk2.default.green(" \u2713 Doppler CLI is installed"));
40
+ }
41
+ } catch (e) {
42
+ throw new Error(
43
+ "Doppler is not installed. Please install Doppler (brew install dopplerhq/cli/doppler), login, setup, and try again."
44
+ );
45
+ }
46
+ try {
47
+ execDoppler(["me"], "string", true, verbose);
48
+ if (verbose) {
49
+ console.log(_chalk2.default.green(" \u2713 Doppler is authenticated"));
50
+ }
51
+ } catch (e2) {
52
+ throw new Error(
53
+ "Doppler is not logged in. Please run 'doppler login' then 'doppler setup' and try again."
54
+ );
55
+ }
56
+ try {
57
+ execDoppler(["configs", "--json"], "json", true, verbose);
58
+ if (verbose) {
59
+ console.log(_chalk2.default.green(" \u2713 Doppler project is configured"));
60
+ }
61
+ } catch (e3) {
62
+ throw new Error(
63
+ "Doppler is not configured. Please run 'doppler setup' and try again."
64
+ );
65
+ }
66
+ }
67
+ function getConfigs(environment, verbose = false) {
68
+ if (verbose) {
69
+ console.log(
70
+ _chalk2.default.blue(
71
+ `
72
+ \u{1F4CB} Resolving configurations for environment: ${_chalk2.default.cyan(environment)}`
73
+ )
74
+ );
75
+ }
76
+ const availableConfigs = execDoppler(
77
+ ["configs", "--json"],
78
+ "json",
79
+ true,
80
+ verbose
81
+ );
82
+ const configNames = Array.isArray(availableConfigs) ? availableConfigs.map(
83
+ (config) => config.name
84
+ ) : [];
85
+ if (verbose && configNames.length > 0) {
86
+ console.log(
87
+ _chalk2.default.gray(` Available configurations: ${configNames.join(", ")}`)
88
+ );
89
+ }
90
+ if (environment === "all") {
91
+ if (configNames.length === 0) {
92
+ throw new Error("No configurations found in Doppler");
93
+ }
94
+ if (verbose) {
95
+ console.log(
96
+ _chalk2.default.green(` \u2713 Using all ${configNames.length} configurations`)
97
+ );
98
+ }
99
+ return configNames;
100
+ }
101
+ if (configNames.length > 0 && !configNames.includes(environment)) {
102
+ throw new Error(
103
+ `Configuration "${environment}" not found. Available configurations: ${configNames.join(", ")}`
104
+ );
105
+ }
106
+ if (verbose) {
107
+ console.log(_chalk2.default.green(` \u2713 Using configuration: ${environment}`));
108
+ }
109
+ return [environment];
110
+ }
111
+ function normalizeEscapeSequences(content) {
112
+ return content.replace(/\\n/g, "\n").replace(/\\t/g, " ").replace(/\\r/g, "\r");
113
+ }
114
+ function createDiff(oldContent, newContent) {
115
+ const oldLines = oldContent.split("\n");
116
+ const newLines = newContent.split("\n");
117
+ const diff = [];
118
+ const maxLines = Math.max(oldLines.length, newLines.length);
119
+ for (let i = 0; i < maxLines; i++) {
120
+ const oldLine = oldLines[i] || "";
121
+ const newLine = newLines[i] || "";
122
+ if (oldLine !== newLine) {
123
+ if (oldLine && !newLine) {
124
+ diff.push(`-${oldLine}`);
125
+ } else if (!oldLine && newLine) {
126
+ diff.push(`+${newLine}`);
127
+ } else {
128
+ diff.push(`-${oldLine}`);
129
+ diff.push(`+${newLine}`);
130
+ }
131
+ }
132
+ }
133
+ return diff;
134
+ }
135
+ function promptConfirmation(message) {
136
+ return new Promise((resolve) => {
137
+ const rl = _readline.createInterface.call(void 0, {
138
+ input: process.stdin,
139
+ output: process.stdout
140
+ });
141
+ rl.question(message, (answer) => {
142
+ rl.close();
143
+ resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
144
+ });
145
+ });
146
+ }
147
+ async function downloadConfigs(options) {
148
+ const { environment, verbose } = options;
149
+ const actualEnvironment = _nullishCoalesce(environment, () => ( DEFAULT_DOPPLER_ENVIRONMENT));
150
+ const configs = getConfigs(actualEnvironment, verbose);
151
+ if (verbose) {
152
+ console.log(
153
+ _chalk2.default.blue(
154
+ `
155
+ \u2B07\uFE0F Starting download process for ${configs.length} configuration(s)...`
156
+ )
157
+ );
158
+ }
159
+ if (configs.length === 1 && environment !== "all") {
160
+ console.log(
161
+ "You can use -e all to download all configurations, or -e <env> for a specific environment."
162
+ );
163
+ }
164
+ for (const config of configs) {
165
+ const envFile = `.env.${config}`;
166
+ const backupFile = `${envFile}.backup`;
167
+ let backupMsg = "";
168
+ if (verbose) {
169
+ console.log(_chalk2.default.blue(`
170
+ \u{1F4E6} Processing config: ${_chalk2.default.cyan(config)}`));
171
+ }
172
+ try {
173
+ if (_fs.existsSync.call(void 0, envFile)) {
174
+ if (verbose) {
175
+ console.log(_chalk2.default.gray(` Creating backup: ${backupFile}`));
176
+ }
177
+ _fs.renameSync.call(void 0, envFile, backupFile);
178
+ backupMsg = "Backed up existing file, ";
179
+ }
180
+ if (verbose) {
181
+ console.log(_chalk2.default.gray(` Downloading secrets from Doppler...`));
182
+ }
183
+ const content = execDoppler(
184
+ [
185
+ "secrets",
186
+ "download",
187
+ "--no-file",
188
+ "--format",
189
+ "env",
190
+ "--config",
191
+ config
192
+ ],
193
+ "string",
194
+ !verbose,
195
+ // Only silent if not verbose
196
+ verbose
197
+ );
198
+ if (typeof content === "string") {
199
+ _fs.writeFileSync.call(void 0, envFile, content, "utf-8");
200
+ if (verbose) {
201
+ console.log(_chalk2.default.gray(` Written to: ${envFile}`));
202
+ }
203
+ } else {
204
+ throw new Error("Invalid content received from Doppler");
205
+ }
206
+ console.log(
207
+ `Config ${_chalk2.default.blue(config)}: ${backupMsg}downloaded successfully to ${_chalk2.default.green(envFile)}`
208
+ );
209
+ if (config === "dev" && !_fs.existsSync.call(void 0, ".env")) {
210
+ _fs.copyFileSync.call(void 0, envFile, ".env");
211
+ console.log(
212
+ `Copied ${_chalk2.default.green(".env.dev")} to ${_chalk2.default.green(".env")}`
213
+ );
214
+ }
215
+ if (_fs.existsSync.call(void 0, backupFile)) {
216
+ if (verbose) {
217
+ console.log(_chalk2.default.gray(` Removing backup file`));
218
+ }
219
+ _fs.unlinkSync.call(void 0, backupFile);
220
+ }
221
+ } catch (error) {
222
+ console.error(`Failed to download ${config}: ${_optionalChain([error, 'optionalAccess', _ => _.message]) || error}`);
223
+ if (_fs.existsSync.call(void 0, backupFile)) {
224
+ _fs.renameSync.call(void 0, backupFile, envFile);
225
+ console.log(`Restored backup for ${envFile}`);
226
+ }
227
+ }
228
+ }
229
+ }
230
+ async function uploadConfigs(options) {
231
+ const { environment, verbose } = options;
232
+ const configs = getConfigs(environment, verbose);
233
+ if (verbose) {
234
+ console.log(
235
+ _chalk2.default.blue(
236
+ `
237
+ \u2B06\uFE0F Starting upload process for ${configs.length} configuration(s)...`
238
+ )
239
+ );
240
+ }
241
+ for (const config of configs) {
242
+ const envFile = `.env.${config}`;
243
+ const backupFile = `${envFile}.doppler`;
244
+ const normalizedFile = `${envFile}.normalized`;
245
+ if (verbose) {
246
+ console.log(_chalk2.default.blue(`
247
+ \u{1F4E6} Processing config: ${_chalk2.default.cyan(config)}`));
248
+ }
249
+ try {
250
+ if (!_fs.existsSync.call(void 0, envFile)) {
251
+ console.log(
252
+ `Config ${config}: ${_chalk2.default.green(envFile)} does not exist. Skipping upload.`
253
+ );
254
+ continue;
255
+ }
256
+ if (verbose) {
257
+ console.log(
258
+ _chalk2.default.gray(` Creating backup of current Doppler config...`)
259
+ );
260
+ }
261
+ try {
262
+ const backupContent2 = execDoppler(
263
+ [
264
+ "secrets",
265
+ "download",
266
+ "--no-file",
267
+ "--format",
268
+ "env",
269
+ "--config",
270
+ config
271
+ ],
272
+ "string",
273
+ !verbose,
274
+ // Only silent if not verbose
275
+ verbose
276
+ );
277
+ if (typeof backupContent2 === "string") {
278
+ _fs.writeFileSync.call(void 0, backupFile, backupContent2, "utf-8");
279
+ if (verbose) {
280
+ console.log(_chalk2.default.gray(` Backup created: ${backupFile}`));
281
+ }
282
+ } else {
283
+ throw new Error("Invalid backup content received from Doppler");
284
+ }
285
+ } catch (e4) {
286
+ console.log(
287
+ `Config ${config}: Failed to create backup. Skipping upload.`
288
+ );
289
+ continue;
290
+ }
291
+ if (verbose) {
292
+ console.log(_chalk2.default.gray(` Reading local file: ${envFile}`));
293
+ }
294
+ const localContent = _fs.readFileSync.call(void 0, envFile, "utf-8");
295
+ const normalizedContent = normalizeEscapeSequences(localContent);
296
+ _fs.writeFileSync.call(void 0, normalizedFile, normalizedContent, "utf-8");
297
+ if (verbose) {
298
+ console.log(_chalk2.default.gray(` Comparing local changes with Doppler...`));
299
+ }
300
+ const backupContent = _fs.readFileSync.call(void 0, backupFile, "utf-8");
301
+ const diff = createDiff(backupContent, normalizedContent);
302
+ if (diff.length === 0) {
303
+ console.log(`Config ${config}: No differences found. Skipping upload.`);
304
+ _fs.unlinkSync.call(void 0, backupFile);
305
+ _fs.unlinkSync.call(void 0, normalizedFile);
306
+ continue;
307
+ }
308
+ if (verbose) {
309
+ console.log(_chalk2.default.yellow(` Found ${diff.length} line changes`));
310
+ }
311
+ console.log("\nChanges to be uploaded:");
312
+ for (const line of diff) {
313
+ if (line.startsWith("-")) {
314
+ console.log(_chalk2.default.red(line));
315
+ } else if (line.startsWith("+")) {
316
+ console.log(_chalk2.default.green(line));
317
+ }
318
+ }
319
+ const confirmed = await promptConfirmation(
320
+ "\nDo you want to proceed with the upload? (y/n) "
321
+ );
322
+ if (!confirmed) {
323
+ console.log(`Upload cancelled for ${_chalk2.default.green(envFile)}`);
324
+ _fs.unlinkSync.call(void 0, backupFile);
325
+ _fs.unlinkSync.call(void 0, normalizedFile);
326
+ continue;
327
+ }
328
+ if (verbose) {
329
+ console.log(_chalk2.default.gray(` Uploading to Doppler...`));
330
+ }
331
+ try {
332
+ execDoppler(
333
+ ["secrets", "upload", normalizedFile, "--config", config, "--silent"],
334
+ "string",
335
+ !verbose,
336
+ // Only silent if not verbose
337
+ verbose
338
+ );
339
+ if (config === "dev") {
340
+ console.log(
341
+ `Config ${_chalk2.default.blue(config)}: Successfully uploaded ${_chalk2.default.green(envFile)}`
342
+ );
343
+ } else {
344
+ console.log(
345
+ `Config ${config}: Successfully uploaded ${_chalk2.default.green(envFile)}`
346
+ );
347
+ }
348
+ } catch (e5) {
349
+ console.error(
350
+ `Config ${config}: Failed to upload ${_chalk2.default.green(envFile)}. Restoring previous configuration.`
351
+ );
352
+ try {
353
+ if (verbose) {
354
+ console.log(_chalk2.default.gray(` Restoring previous configuration...`));
355
+ }
356
+ execDoppler(
357
+ ["secrets", "upload", backupFile, "--config", config, "--silent"],
358
+ "string",
359
+ !verbose,
360
+ // Only silent if not verbose
361
+ verbose
362
+ );
363
+ console.log(
364
+ `Config ${config}: Successfully restored previous configuration`
365
+ );
366
+ } catch (e6) {
367
+ console.error(
368
+ `Config ${config}: Failed to restore previous configuration`
369
+ );
370
+ }
371
+ }
372
+ if (_fs.existsSync.call(void 0, backupFile)) {
373
+ _fs.unlinkSync.call(void 0, backupFile);
374
+ }
375
+ if (_fs.existsSync.call(void 0, normalizedFile)) {
376
+ _fs.unlinkSync.call(void 0, normalizedFile);
377
+ }
378
+ } catch (error) {
379
+ console.error(
380
+ `Error processing config ${config}: ${_optionalChain([error, 'optionalAccess', _2 => _2.message]) || error}`
381
+ );
382
+ if (_fs.existsSync.call(void 0, backupFile)) {
383
+ _fs.unlinkSync.call(void 0, backupFile);
384
+ }
385
+ if (_fs.existsSync.call(void 0, normalizedFile)) {
386
+ _fs.unlinkSync.call(void 0, normalizedFile);
387
+ }
388
+ }
389
+ }
390
+ }
391
+
392
+
393
+
394
+
395
+
396
+
397
+
398
+
399
+
400
+
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;
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/commands/schema.js
2
+ var _zod = require('zod');
3
+ var globalOptionsSchema = _zod.z.object({
4
+ verbose: _zod.z.boolean().default(false).optional().describe("Enable verbose logging for detailed output and error traces")
5
+ });
6
+ var globalCommandsMetadata = {
7
+ name: "mtndev-cli",
8
+ version: "1.0.0",
9
+ description: "CLI tool for mtndev projects",
10
+ options: {
11
+ verbose: {
12
+ description: globalOptionsSchema.shape.verbose.description,
13
+ default: false,
14
+ alias: "v"
15
+ }
16
+ }
17
+ };
18
+
19
+
20
+
21
+
22
+ exports.globalOptionsSchema = globalOptionsSchema; exports.globalCommandsMetadata = globalCommandsMetadata;
@@ -0,0 +1,100 @@
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
+
4
+
5
+ var _EMMC33QAcjs = require('./EMMC33QA.cjs');
6
+
7
+
8
+
9
+ var _QBNNK2WXcjs = require('./QBNNK2WX.cjs');
10
+
11
+ // src/commands/doppler/handler.js
12
+ var _chalk = require('chalk'); var _chalk2 = _interopRequireDefault(_chalk);
13
+ var _zod = require('zod');
14
+ async function dopplerCommand(options) {
15
+ try {
16
+ const validatedOptions = _QBNNK2WXcjs.dopplerCommandOptionsSchema.parse(options);
17
+ if (validatedOptions.help) {
18
+ console.log(
19
+ _chalk2.default.bold(`
20
+ Usage: @mtndev/cli doppler [options] <action>`)
21
+ );
22
+ console.log(_chalk2.default.gray(_QBNNK2WXcjs.dopplerCommandMetadata.description));
23
+ console.log(_chalk2.default.bold("\nOptions:"));
24
+ Object.entries(_QBNNK2WXcjs.dopplerCommandOptionsSchema.shape).forEach(
25
+ ([key, fieldSchema]) => {
26
+ if (key === "action") return;
27
+ const description = fieldSchema.description || "No description available";
28
+ const optionMeta = (
29
+ /** @type {any} */
30
+ _QBNNK2WXcjs.dopplerCommandMetadata.options[key]
31
+ );
32
+ const defaultValue = _nullishCoalesce(_optionalChain([optionMeta, 'optionalAccess', _ => _.default]), () => ( false));
33
+ const alias = _optionalChain([optionMeta, 'optionalAccess', _2 => _2.alias]) ? _chalk2.default.cyan(`, -${optionMeta.alias}`) : "";
34
+ console.log(
35
+ _chalk2.default.cyan(` --${key}`) + alias + ` ${description} (default: ${defaultValue})`
36
+ );
37
+ }
38
+ );
39
+ console.log("");
40
+ return;
41
+ }
42
+ const { action, environment, verbose } = validatedOptions;
43
+ _EMMC33QAcjs.checkDependencies.call(void 0, verbose);
44
+ if (action === "download") {
45
+ await _EMMC33QAcjs.downloadConfigs.call(void 0, { environment, verbose });
46
+ } else if (action === "upload") {
47
+ await _EMMC33QAcjs.uploadConfigs.call(void 0, { environment, verbose });
48
+ }
49
+ console.log(_chalk2.default.green(`
50
+ \u2705 Doppler ${action} completed successfully!`));
51
+ } catch (error) {
52
+ if (error instanceof _zod.ZodError) {
53
+ console.error(_chalk2.default.red(`
54
+ \u274C Invalid command options:`));
55
+ error.errors.forEach((err) => {
56
+ console.error(_chalk2.default.red(` ${err.path.join(".")}: ${err.message}`));
57
+ });
58
+ process.exit(1);
59
+ }
60
+ const action = (
61
+ /** @type {any} */
62
+ _optionalChain([options, 'optionalAccess', _3 => _3.action]) || "operation"
63
+ );
64
+ const verbose = (
65
+ /** @type {any} */
66
+ _optionalChain([options, 'optionalAccess', _4 => _4.verbose]) || false
67
+ );
68
+ console.error(_chalk2.default.red(`
69
+ \u274C Doppler ${action} failed:`));
70
+ if (error instanceof Error) {
71
+ console.error(_chalk2.default.red(` ${error.message}`));
72
+ if (verbose && error.stack) {
73
+ console.error(_chalk2.default.gray("\nStack trace:"));
74
+ console.error(_chalk2.default.gray(error.stack));
75
+ }
76
+ } else {
77
+ console.error(_chalk2.default.red(` ${String(error)}`));
78
+ }
79
+ console.error(_chalk2.default.yellow("\n\u{1F4A1} Troubleshooting tips:"));
80
+ console.error(
81
+ _chalk2.default.yellow(
82
+ " \u2022 Ensure Doppler CLI is installed (brew install dopplerhq/cli/doppler)"
83
+ )
84
+ );
85
+ console.error(
86
+ _chalk2.default.yellow(" \u2022 Make sure you're logged in (doppler login)")
87
+ );
88
+ console.error(
89
+ _chalk2.default.yellow(" \u2022 Verify project is configured (doppler setup)")
90
+ );
91
+ console.error(
92
+ _chalk2.default.yellow(" \u2022 Use --verbose for detailed error information\n")
93
+ );
94
+ process.exit(1);
95
+ }
96
+ }
97
+
98
+
99
+
100
+ exports.dopplerCommand = dopplerCommand;