@mailmodo/cli 0.0.28-beta.pr29.47 → 0.0.29-beta.pr31.48

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.
@@ -1,7 +1,7 @@
1
1
  import { confirm, input } from '@inquirer/prompts';
2
2
  import chalk from 'chalk';
3
3
  import { BaseCommand } from '../../lib/base-command.js';
4
- import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, DNS_GUIDE_URL, } from '../../lib/constants.js';
4
+ import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, } from '../../lib/constants.js';
5
5
  import { loadTemplate, saveYaml, } from '../../lib/yaml-config.js';
6
6
  export default class Deploy extends BaseCommand {
7
7
  static description = 'Deploy email sequences and verify sending domain';
@@ -232,7 +232,7 @@ export default class Deploy extends BaseCommand {
232
232
  yamlConfig.project.fromEmail = senderEmail;
233
233
  yamlConfig.project.address = address;
234
234
  await saveYaml(yamlConfig);
235
- this.showDnsRecords(domainResponse.data?.dnsRecords || [], flags.json);
235
+ this.showDnsRecords(domainResponse.data?.dnsRecords || [], flags.json, domainResponse.data?.dnsGuideUrl);
236
236
  if (flags.yes) {
237
237
  return this.verifyDomain(flags.json, domain);
238
238
  }
@@ -273,7 +273,7 @@ export default class Deploy extends BaseCommand {
273
273
  });
274
274
  return { address, domain, senderEmail };
275
275
  }
276
- showDnsRecords(dnsRecords, jsonOutput) {
276
+ showDnsRecords(dnsRecords, jsonOutput, dnsGuideUrl) {
277
277
  if (jsonOutput)
278
278
  return;
279
279
  this.log(`\n Add these ${dnsRecords.length} DNS records to your domain provider:\n`);
@@ -284,7 +284,8 @@ export default class Deploy extends BaseCommand {
284
284
  this.log(` Value: ${record.value}\n`);
285
285
  }
286
286
  this.log(` DNS changes take 5–30 minutes to propagate.`);
287
- this.log(` Full guide: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
287
+ if (dnsGuideUrl)
288
+ this.log(` Full guide: ${chalk.cyan(dnsGuideUrl)}\n`);
288
289
  }
289
290
  async verifyDomain(jsonOutput, domain) {
290
291
  const verify = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY, {
@@ -293,7 +294,7 @@ export default class Deploy extends BaseCommand {
293
294
  if (!verify.ok) {
294
295
  this.handleApiError(verify);
295
296
  }
296
- const { dkim, dmarc, domainStatus, returnPath } = verify.data;
297
+ const { dkim, dmarc, dnsGuideUrl, domainStatus, returnPath } = verify.data;
297
298
  const allPassed = domainStatus === 'VERIFIED';
298
299
  if (!jsonOutput) {
299
300
  this.log(` DKIM ${dkim ? chalk.green('✓') : chalk.red('✗')}`);
@@ -304,7 +305,8 @@ export default class Deploy extends BaseCommand {
304
305
  }
305
306
  else {
306
307
  this.log(`\n ${chalk.yellow('Some records failed.')} Fix them and run ${chalk.cyan('mailmodo domain --verify')}.`);
307
- this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
308
+ if (dnsGuideUrl)
309
+ this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
308
310
  }
309
311
  }
310
312
  return allPassed;
@@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
2
2
  import { input } from '@inquirer/prompts';
3
3
  import chalk from 'chalk';
4
4
  import { BaseCommand } from '../../lib/base-command.js';
5
- import { API_ENDPOINTS, DNS_GUIDE_URL } from '../../lib/constants.js';
5
+ import { API_ENDPOINTS } from '../../lib/constants.js';
6
6
  import { saveConfig } from '../../lib/config.js';
7
7
  import { saveYaml } from '../../lib/yaml-config.js';
8
8
  export default class Domain extends BaseCommand {
@@ -69,7 +69,7 @@ export default class Domain extends BaseCommand {
69
69
  await saveYaml(yamlConfig);
70
70
  await saveConfig({ ...config, domain });
71
71
  const records = response.data?.dnsRecords || [];
72
- const guideUrl = response.data?.dnsGuideUrl ?? DNS_GUIDE_URL;
72
+ const guideUrl = response.data?.dnsGuideUrl;
73
73
  if (flags.json) {
74
74
  this.log(JSON.stringify({ dnsRecords: records, domain }, null, 2));
75
75
  return;
@@ -82,7 +82,8 @@ export default class Domain extends BaseCommand {
82
82
  this.log(` Value: ${record.value}\n`);
83
83
  }
84
84
  this.log(` DNS changes take 5–30 minutes to propagate.`);
85
- this.log(` Full guide: ${chalk.cyan(guideUrl)}\n`);
85
+ if (guideUrl)
86
+ this.log(` Full guide: ${chalk.cyan(guideUrl)}\n`);
86
87
  if (!flags.yes) {
87
88
  const action = await input({
88
89
  default: '',
@@ -107,7 +108,7 @@ export default class Domain extends BaseCommand {
107
108
  if (!response.ok) {
108
109
  this.handleApiError(response);
109
110
  }
110
- const { dkim, dmarc, returnPath, domainStatus } = response.data;
111
+ const { dkim, dmarc, dnsGuideUrl, returnPath, domainStatus } = response.data;
111
112
  if (jsonOutput) {
112
113
  this.log(JSON.stringify({ dkim, dmarc, returnPath, domainStatus }, null, 2));
113
114
  return;
@@ -133,7 +134,8 @@ export default class Domain extends BaseCommand {
133
134
  this.log(` - Cloudflare: proxy must be OFF (grey cloud, not orange)`);
134
135
  }
135
136
  this.log(`\n Fix the records and run ${chalk.cyan('mailmodo domain --verify')} again.`);
136
- this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
137
+ if (dnsGuideUrl)
138
+ this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
137
139
  }
138
140
  }
139
141
  /**
@@ -8,4 +8,5 @@ export default class Init extends BaseCommand {
8
8
  yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
9
  };
10
10
  run(): Promise<void>;
11
+ private confirmOverwriteIfNeeded;
11
12
  }
@@ -1,9 +1,9 @@
1
1
  import { Flags } from '@oclif/core';
2
- import { editor, input, select } from '@inquirer/prompts';
2
+ import { confirm, editor, input, select } from '@inquirer/prompts';
3
3
  import chalk from 'chalk';
4
4
  import { BaseCommand } from '../../lib/base-command.js';
5
5
  import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, } from '../../lib/constants.js';
6
- import { saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
6
+ import { loadYaml, saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
7
7
  function isValidUrl(value) {
8
8
  try {
9
9
  return Boolean(new URL(value));
@@ -42,6 +42,8 @@ export default class Init extends BaseCommand {
42
42
  async run() {
43
43
  const { flags } = await this.parse(Init);
44
44
  await this.ensureAuth();
45
+ if (!(await this.confirmOverwriteIfNeeded(flags)))
46
+ return;
45
47
  let productUrl = flags.url;
46
48
  if (!productUrl) {
47
49
  productUrl = await input({
@@ -177,4 +179,21 @@ export default class Init extends BaseCommand {
177
179
  this.log(` Created ${chalk.green('mailmodo.yaml')} + ${chalk.green(String(emailConfigs.length))} email templates in ${chalk.green('/mailmodo')}\n`);
178
180
  this.log(` Run ${chalk.cyan("'mailmodo emails'")} to review.\n`);
179
181
  }
182
+ async confirmOverwriteIfNeeded(flags) {
183
+ const existing = await loadYaml();
184
+ if (!existing)
185
+ return true;
186
+ if (flags.yes)
187
+ return true;
188
+ this.log(`\n ${chalk.yellow('⚠')} ${chalk.bold('mailmodo.yaml already exists.')}`);
189
+ this.log(` Running init will overwrite your current project configuration and all email templates.\n`);
190
+ const proceed = await confirm({
191
+ default: false,
192
+ message: 'Overwrite existing configuration and templates?',
193
+ });
194
+ if (!proceed) {
195
+ this.log(`\n Init cancelled. Run ${chalk.cyan('mailmodo edit')} to modify individual emails.\n`);
196
+ }
197
+ return proceed;
198
+ }
180
199
  }
@@ -5,7 +5,7 @@ import { existsSync } from 'node:fs';
5
5
  import { readFile } from 'node:fs/promises';
6
6
  import { resolve } from 'node:path';
7
7
  import { BaseCommand } from '../../lib/base-command.js';
8
- import { API_ENDPOINTS, DNS_GUIDE_URL } from '../../lib/constants.js';
8
+ import { API_ENDPOINTS } from '../../lib/constants.js';
9
9
  import { saveYaml } from '../../lib/yaml-config.js';
10
10
  const SETTINGS_GROUPS = Object.freeze({
11
11
  billing: ['monthly_cap'],
@@ -232,6 +232,7 @@ export default class Settings extends BaseCommand {
232
232
  this.handleApiError(response);
233
233
  }
234
234
  const records = response.data?.dnsRecords || [];
235
+ const dnsGuideUrl = response.data?.dnsGuideUrl;
235
236
  yamlConfig.project.domain = newDomain;
236
237
  yamlConfig.project.fromEmail = newFromEmail;
237
238
  yamlConfig.project.address = newAddress;
@@ -246,7 +247,8 @@ export default class Settings extends BaseCommand {
246
247
  }
247
248
  this.log(` Run ${chalk.cyan("'mailmodo domain --verify'")} once records are added.`);
248
249
  this.log(` Emails will not send until the new domain is verified.`);
249
- this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
250
+ if (dnsGuideUrl)
251
+ this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
250
252
  }
251
253
  recordLabel(index) {
252
254
  const labels = ['DKIM', 'DMARC', 'Return Path'];
@@ -76,67 +76,6 @@
76
76
  "index.js"
77
77
  ]
78
78
  },
79
- "contacts": {
80
- "aliases": [],
81
- "args": {},
82
- "description": "Manage contacts — search, export, or delete",
83
- "examples": [
84
- "<%= config.bin %> contacts",
85
- "<%= config.bin %> contacts --search sarah@example.com",
86
- "<%= config.bin %> contacts --export # GDPR CSV → contacts.csv",
87
- "<%= config.bin %> contacts --delete sarah@example.com"
88
- ],
89
- "flags": {
90
- "json": {
91
- "description": "Output as JSON",
92
- "name": "json",
93
- "allowNo": false,
94
- "type": "boolean"
95
- },
96
- "yes": {
97
- "char": "y",
98
- "description": "Skip confirmation prompts",
99
- "name": "yes",
100
- "allowNo": false,
101
- "type": "boolean"
102
- },
103
- "delete": {
104
- "description": "GDPR hard delete a contact by email",
105
- "name": "delete",
106
- "hasDynamicHelp": false,
107
- "multiple": false,
108
- "type": "option"
109
- },
110
- "export": {
111
- "description": "Export all contacts as GDPR-compliant CSV (writes contacts.csv in the current directory)",
112
- "name": "export",
113
- "allowNo": false,
114
- "type": "boolean"
115
- },
116
- "search": {
117
- "description": "Search for a contact by email",
118
- "name": "search",
119
- "hasDynamicHelp": false,
120
- "multiple": false,
121
- "type": "option"
122
- }
123
- },
124
- "hasDynamicHelp": false,
125
- "hiddenAliases": [],
126
- "id": "contacts",
127
- "pluginAlias": "@mailmodo/cli",
128
- "pluginName": "@mailmodo/cli",
129
- "pluginType": "core",
130
- "strict": true,
131
- "enableJsonFlag": false,
132
- "isESM": true,
133
- "relativePath": [
134
- "dist",
135
- "commands",
136
- "contacts",
137
- "index.js"
138
- ]
139
- },
140
79
  "deploy": {
141
80
  "aliases": [],
142
81
  "args": {},
@@ -365,6 +304,67 @@
365
304
  "index.js"
366
305
  ]
367
306
  },
307
+ "contacts": {
308
+ "aliases": [],
309
+ "args": {},
310
+ "description": "Manage contacts — search, export, or delete",
311
+ "examples": [
312
+ "<%= config.bin %> contacts",
313
+ "<%= config.bin %> contacts --search sarah@example.com",
314
+ "<%= config.bin %> contacts --export # GDPR CSV → contacts.csv",
315
+ "<%= config.bin %> contacts --delete sarah@example.com"
316
+ ],
317
+ "flags": {
318
+ "json": {
319
+ "description": "Output as JSON",
320
+ "name": "json",
321
+ "allowNo": false,
322
+ "type": "boolean"
323
+ },
324
+ "yes": {
325
+ "char": "y",
326
+ "description": "Skip confirmation prompts",
327
+ "name": "yes",
328
+ "allowNo": false,
329
+ "type": "boolean"
330
+ },
331
+ "delete": {
332
+ "description": "GDPR hard delete a contact by email",
333
+ "name": "delete",
334
+ "hasDynamicHelp": false,
335
+ "multiple": false,
336
+ "type": "option"
337
+ },
338
+ "export": {
339
+ "description": "Export all contacts as GDPR-compliant CSV (writes contacts.csv in the current directory)",
340
+ "name": "export",
341
+ "allowNo": false,
342
+ "type": "boolean"
343
+ },
344
+ "search": {
345
+ "description": "Search for a contact by email",
346
+ "name": "search",
347
+ "hasDynamicHelp": false,
348
+ "multiple": false,
349
+ "type": "option"
350
+ }
351
+ },
352
+ "hasDynamicHelp": false,
353
+ "hiddenAliases": [],
354
+ "id": "contacts",
355
+ "pluginAlias": "@mailmodo/cli",
356
+ "pluginName": "@mailmodo/cli",
357
+ "pluginType": "core",
358
+ "strict": true,
359
+ "enableJsonFlag": false,
360
+ "isESM": true,
361
+ "relativePath": [
362
+ "dist",
363
+ "commands",
364
+ "contacts",
365
+ "index.js"
366
+ ]
367
+ },
368
368
  "login": {
369
369
  "aliases": [],
370
370
  "args": {},
@@ -512,14 +512,19 @@
512
512
  "index.js"
513
513
  ]
514
514
  },
515
- "settings": {
515
+ "preview": {
516
516
  "aliases": [],
517
- "args": {},
518
- "description": "View and update project settings",
517
+ "args": {
518
+ "id": {
519
+ "description": "Email template ID to preview",
520
+ "name": "id"
521
+ }
522
+ },
523
+ "description": "Preview an email in browser, as text, or send a test",
519
524
  "examples": [
520
- "<%= config.bin %> settings",
521
- "<%= config.bin %> settings --set brand_color=#0F3460",
522
- "<%= config.bin %> settings --json"
525
+ "<%= config.bin %> preview welcome",
526
+ "<%= config.bin %> preview welcome --text",
527
+ "<%= config.bin %> preview welcome --send me@example.com"
523
528
  ],
524
529
  "flags": {
525
530
  "json": {
@@ -535,17 +540,23 @@
535
540
  "allowNo": false,
536
541
  "type": "boolean"
537
542
  },
538
- "set": {
539
- "description": "Set a setting (format: key=value)",
540
- "name": "set",
543
+ "send": {
544
+ "description": "Send test email to this address",
545
+ "name": "send",
541
546
  "hasDynamicHelp": false,
542
547
  "multiple": false,
543
548
  "type": "option"
549
+ },
550
+ "text": {
551
+ "description": "Output plain text version (for AI agents)",
552
+ "name": "text",
553
+ "allowNo": false,
554
+ "type": "boolean"
544
555
  }
545
556
  },
546
557
  "hasDynamicHelp": false,
547
558
  "hiddenAliases": [],
548
- "id": "settings",
559
+ "id": "preview",
549
560
  "pluginAlias": "@mailmodo/cli",
550
561
  "pluginName": "@mailmodo/cli",
551
562
  "pluginType": "core",
@@ -555,17 +566,18 @@
555
566
  "relativePath": [
556
567
  "dist",
557
568
  "commands",
558
- "settings",
569
+ "preview",
559
570
  "index.js"
560
571
  ]
561
572
  },
562
- "status": {
573
+ "settings": {
563
574
  "aliases": [],
564
575
  "args": {},
565
- "description": "View email performance metrics and quota usage",
576
+ "description": "View and update project settings",
566
577
  "examples": [
567
- "<%= config.bin %> status",
568
- "<%= config.bin %> status --json"
578
+ "<%= config.bin %> settings",
579
+ "<%= config.bin %> settings --set brand_color=#0F3460",
580
+ "<%= config.bin %> settings --json"
569
581
  ],
570
582
  "flags": {
571
583
  "json": {
@@ -580,11 +592,18 @@
580
592
  "name": "yes",
581
593
  "allowNo": false,
582
594
  "type": "boolean"
595
+ },
596
+ "set": {
597
+ "description": "Set a setting (format: key=value)",
598
+ "name": "set",
599
+ "hasDynamicHelp": false,
600
+ "multiple": false,
601
+ "type": "option"
583
602
  }
584
603
  },
585
604
  "hasDynamicHelp": false,
586
605
  "hiddenAliases": [],
587
- "id": "status",
606
+ "id": "settings",
588
607
  "pluginAlias": "@mailmodo/cli",
589
608
  "pluginName": "@mailmodo/cli",
590
609
  "pluginType": "core",
@@ -594,23 +613,17 @@
594
613
  "relativePath": [
595
614
  "dist",
596
615
  "commands",
597
- "status",
616
+ "settings",
598
617
  "index.js"
599
618
  ]
600
619
  },
601
- "preview": {
620
+ "status": {
602
621
  "aliases": [],
603
- "args": {
604
- "id": {
605
- "description": "Email template ID to preview",
606
- "name": "id"
607
- }
608
- },
609
- "description": "Preview an email in browser, as text, or send a test",
622
+ "args": {},
623
+ "description": "View email performance metrics and quota usage",
610
624
  "examples": [
611
- "<%= config.bin %> preview welcome",
612
- "<%= config.bin %> preview welcome --text",
613
- "<%= config.bin %> preview welcome --send me@example.com"
625
+ "<%= config.bin %> status",
626
+ "<%= config.bin %> status --json"
614
627
  ],
615
628
  "flags": {
616
629
  "json": {
@@ -625,24 +638,11 @@
625
638
  "name": "yes",
626
639
  "allowNo": false,
627
640
  "type": "boolean"
628
- },
629
- "send": {
630
- "description": "Send test email to this address",
631
- "name": "send",
632
- "hasDynamicHelp": false,
633
- "multiple": false,
634
- "type": "option"
635
- },
636
- "text": {
637
- "description": "Output plain text version (for AI agents)",
638
- "name": "text",
639
- "allowNo": false,
640
- "type": "boolean"
641
641
  }
642
642
  },
643
643
  "hasDynamicHelp": false,
644
644
  "hiddenAliases": [],
645
- "id": "preview",
645
+ "id": "status",
646
646
  "pluginAlias": "@mailmodo/cli",
647
647
  "pluginName": "@mailmodo/cli",
648
648
  "pluginType": "core",
@@ -652,10 +652,10 @@
652
652
  "relativePath": [
653
653
  "dist",
654
654
  "commands",
655
- "preview",
655
+ "status",
656
656
  "index.js"
657
657
  ]
658
658
  }
659
659
  },
660
- "version": "0.0.28-beta.pr29.47"
660
+ "version": "0.0.29-beta.pr31.48"
661
661
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mailmodo/cli",
3
3
  "description": "Email lifecycle automation for the AI-native builder generation.",
4
- "version": "0.0.28-beta.pr29.47",
4
+ "version": "0.0.29-beta.pr31.48",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"