@mailmodo/cli 0.0.11-beta.pr13.17 → 0.0.12-beta.pr14.18

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.
@@ -3,6 +3,7 @@ import { input } from '@inquirer/prompts';
3
3
  import chalk from 'chalk';
4
4
  import { BaseCommand } from '../../lib/base-command.js';
5
5
  import { API_ENDPOINTS, DNS_GUIDE_URL } from '../../lib/constants.js';
6
+ import { saveConfig } from '../../lib/config.js';
6
7
  import { saveYaml } from '../../lib/yaml-config.js';
7
8
  export default class Domain extends BaseCommand {
8
9
  static description = 'Set up and verify your sending domain';
@@ -24,22 +25,22 @@ export default class Domain extends BaseCommand {
24
25
  };
25
26
  async run() {
26
27
  const { flags } = await this.parse(Domain);
27
- await this.ensureAuth();
28
+ const config = await this.ensureAuth();
28
29
  if (flags.verify) {
29
- await this.verifyDomain(flags.json);
30
+ await this.verifyDomain(flags.json, config);
30
31
  return;
31
32
  }
32
33
  if (flags.status) {
33
- await this.showDomainStatus(flags.json);
34
+ await this.showDomainStatus(flags.json, config);
34
35
  return;
35
36
  }
36
- await this.setupDomain(flags);
37
+ await this.setupDomain(flags, config);
37
38
  }
38
39
  /**
39
40
  * Interactive domain setup: collects domain, sender email, and business address,
40
41
  * then calls the API to retrieve the required DNS records.
41
42
  */
42
- async setupDomain(flags) {
43
+ async setupDomain(flags, config) {
43
44
  const yamlConfig = await this.ensureYaml();
44
45
  this.log(`\n ${'─'.repeat(53)}`);
45
46
  this.log(` ${chalk.bold('DOMAIN SETUP')}`);
@@ -84,6 +85,7 @@ export default class Domain extends BaseCommand {
84
85
  yamlConfig.project.fromEmail = senderEmail;
85
86
  yamlConfig.project.address = address;
86
87
  await saveYaml(yamlConfig);
88
+ await saveConfig({ ...config, domain });
87
89
  const records = response.data?.dnsRecords || [];
88
90
  if (flags.json) {
89
91
  this.log(JSON.stringify({ dnsRecords: records, domain }, null, 2));
@@ -104,15 +106,21 @@ export default class Domain extends BaseCommand {
104
106
  message: "Press Enter once you've added the records, or 'skip'.",
105
107
  });
106
108
  if (action.toLowerCase() !== 'skip') {
107
- await this.verifyDomain(false);
109
+ await this.verifyDomain(false, { ...config, domain });
108
110
  }
109
111
  }
110
112
  }
111
113
  /**
112
114
  * Calls the domain verification API and displays pass/fail for each DNS record.
113
115
  */
114
- async verifyDomain(jsonOutput) {
115
- const response = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY));
116
+ async verifyDomain(jsonOutput, config) {
117
+ if (!config.domain) {
118
+ this.error(`No domain configured. Run ${chalk.cyan('mailmodo domain')} to set up your sending domain.`);
119
+ }
120
+ const domain = config.domain;
121
+ const response = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY, {
122
+ domain,
123
+ }));
116
124
  if (!response.ok) {
117
125
  this.handleApiError(response);
118
126
  }
@@ -144,8 +152,14 @@ export default class Domain extends BaseCommand {
144
152
  * Displays domain health metrics including verification status,
145
153
  * bounce rate, and spam complaint rate.
146
154
  */
147
- async showDomainStatus(jsonOutput) {
148
- const response = await this.withApiSpinner({ json: jsonOutput, text: ' Loading domain status...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_STATUS));
155
+ async showDomainStatus(jsonOutput, config) {
156
+ if (!config.domain) {
157
+ this.error(`No domain configured. Run ${chalk.cyan('mailmodo domain')} to set up your sending domain.`);
158
+ }
159
+ const domain = config.domain;
160
+ const response = await this.withApiSpinner({ json: jsonOutput, text: ' Loading domain status...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_STATUS, {
161
+ domain,
162
+ }));
149
163
  if (!response.ok) {
150
164
  this.handleApiError(response);
151
165
  }
@@ -1,6 +1,7 @@
1
1
  export interface MailmodoConfig {
2
2
  accountName?: string;
3
3
  apiKey: string;
4
+ domain?: string;
4
5
  email?: string;
5
6
  freeRemaining?: number;
6
7
  }
@@ -1,4 +1,4 @@
1
- export declare const API_BASE_URL: string;
1
+ export declare const API_BASE_URL = "https://app-vertex-debug.azurewebsites.net";
2
2
  export declare const API_ENDPOINTS: Readonly<{
3
3
  ANALYTICS: "/analytics";
4
4
  ANALYZE: "/analyze";
@@ -1,6 +1,7 @@
1
1
  /** Set by `bin/dev.js` when running the CLI locally (tsx bootstrap). */
2
2
  const DEV_API_BASE_URL = 'https://app-vertex-debug.azurewebsites.net';
3
- const PRODUCTION_API_BASE_URL = 'https://api.mailmodo.com';
3
+ // const PRODUCTION_API_BASE_URL = 'https://api.mailmodo.com';
4
+ const PRODUCTION_API_BASE_URL = 'https://app-vertex-debug.azurewebsites.net';
4
5
  export const API_BASE_URL = process.env.MAILMODO_DEV_TSX
5
6
  ? DEV_API_BASE_URL
6
7
  : PRODUCTION_API_BASE_URL;
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "commands": {
3
- "billing": {
3
+ "contacts": {
4
4
  "aliases": [],
5
5
  "args": {},
6
- "description": "View billing status, manage payment, and set spending cap",
6
+ "description": "Manage contacts — search, export, or delete",
7
7
  "examples": [
8
- "<%= config.bin %> billing",
9
- "<%= config.bin %> billing --status",
10
- "<%= config.bin %> billing --cap 5"
8
+ "<%= config.bin %> contacts",
9
+ "<%= config.bin %> contacts --search sarah@example.com",
10
+ "<%= config.bin %> contacts --export",
11
+ "<%= config.bin %> contacts --delete sarah@example.com"
11
12
  ],
12
13
  "flags": {
13
14
  "json": {
@@ -23,23 +24,30 @@
23
24
  "allowNo": false,
24
25
  "type": "boolean"
25
26
  },
26
- "cap": {
27
- "description": "Set monthly block cap (max blocks to auto-charge)",
28
- "name": "cap",
27
+ "delete": {
28
+ "description": "GDPR hard delete a contact by email",
29
+ "name": "delete",
29
30
  "hasDynamicHelp": false,
30
31
  "multiple": false,
31
32
  "type": "option"
32
33
  },
33
- "status": {
34
- "description": "Show billing status only",
35
- "name": "status",
34
+ "export": {
35
+ "description": "Export all contacts as CSV",
36
+ "name": "export",
36
37
  "allowNo": false,
37
38
  "type": "boolean"
39
+ },
40
+ "search": {
41
+ "description": "Search for a contact by email",
42
+ "name": "search",
43
+ "hasDynamicHelp": false,
44
+ "multiple": false,
45
+ "type": "option"
38
46
  }
39
47
  },
40
48
  "hasDynamicHelp": false,
41
49
  "hiddenAliases": [],
42
- "id": "billing",
50
+ "id": "contacts",
43
51
  "pluginAlias": "@mailmodo/cli",
44
52
  "pluginName": "@mailmodo/cli",
45
53
  "pluginType": "core",
@@ -49,19 +57,18 @@
49
57
  "relativePath": [
50
58
  "dist",
51
59
  "commands",
52
- "billing",
60
+ "contacts",
53
61
  "index.js"
54
62
  ]
55
63
  },
56
- "contacts": {
64
+ "billing": {
57
65
  "aliases": [],
58
66
  "args": {},
59
- "description": "Manage contacts — search, export, or delete",
67
+ "description": "View billing status, manage payment, and set spending cap",
60
68
  "examples": [
61
- "<%= config.bin %> contacts",
62
- "<%= config.bin %> contacts --search sarah@example.com",
63
- "<%= config.bin %> contacts --export",
64
- "<%= config.bin %> contacts --delete sarah@example.com"
69
+ "<%= config.bin %> billing",
70
+ "<%= config.bin %> billing --status",
71
+ "<%= config.bin %> billing --cap 5"
65
72
  ],
66
73
  "flags": {
67
74
  "json": {
@@ -77,30 +84,23 @@
77
84
  "allowNo": false,
78
85
  "type": "boolean"
79
86
  },
80
- "delete": {
81
- "description": "GDPR hard delete a contact by email",
82
- "name": "delete",
87
+ "cap": {
88
+ "description": "Set monthly block cap (max blocks to auto-charge)",
89
+ "name": "cap",
83
90
  "hasDynamicHelp": false,
84
91
  "multiple": false,
85
92
  "type": "option"
86
93
  },
87
- "export": {
88
- "description": "Export all contacts as CSV",
89
- "name": "export",
94
+ "status": {
95
+ "description": "Show billing status only",
96
+ "name": "status",
90
97
  "allowNo": false,
91
98
  "type": "boolean"
92
- },
93
- "search": {
94
- "description": "Search for a contact by email",
95
- "name": "search",
96
- "hasDynamicHelp": false,
97
- "multiple": false,
98
- "type": "option"
99
99
  }
100
100
  },
101
101
  "hasDynamicHelp": false,
102
102
  "hiddenAliases": [],
103
- "id": "contacts",
103
+ "id": "billing",
104
104
  "pluginAlias": "@mailmodo/cli",
105
105
  "pluginName": "@mailmodo/cli",
106
106
  "pluginType": "core",
@@ -110,7 +110,7 @@
110
110
  "relativePath": [
111
111
  "dist",
112
112
  "commands",
113
- "contacts",
113
+ "billing",
114
114
  "index.js"
115
115
  ]
116
116
  },
@@ -477,14 +477,15 @@
477
477
  "index.js"
478
478
  ]
479
479
  },
480
- "settings": {
480
+ "logs": {
481
481
  "aliases": [],
482
482
  "args": {},
483
- "description": "View and update project settings",
483
+ "description": "View email send logs and delivery events",
484
484
  "examples": [
485
- "<%= config.bin %> settings",
486
- "<%= config.bin %> settings --set brand_color=#0F3460",
487
- "<%= config.bin %> settings --json"
485
+ "<%= config.bin %> logs",
486
+ "<%= config.bin %> logs --email sarah@example.com",
487
+ "<%= config.bin %> logs --failed",
488
+ "<%= config.bin %> logs --json"
488
489
  ],
489
490
  "flags": {
490
491
  "json": {
@@ -500,17 +501,23 @@
500
501
  "allowNo": false,
501
502
  "type": "boolean"
502
503
  },
503
- "set": {
504
- "description": "Set a setting (format: key=value)",
505
- "name": "set",
504
+ "email": {
505
+ "description": "Filter logs by contact email",
506
+ "name": "email",
506
507
  "hasDynamicHelp": false,
507
508
  "multiple": false,
508
509
  "type": "option"
510
+ },
511
+ "failed": {
512
+ "description": "Show only failed/bounced events",
513
+ "name": "failed",
514
+ "allowNo": false,
515
+ "type": "boolean"
509
516
  }
510
517
  },
511
518
  "hasDynamicHelp": false,
512
519
  "hiddenAliases": [],
513
- "id": "settings",
520
+ "id": "logs",
514
521
  "pluginAlias": "@mailmodo/cli",
515
522
  "pluginName": "@mailmodo/cli",
516
523
  "pluginType": "core",
@@ -520,17 +527,18 @@
520
527
  "relativePath": [
521
528
  "dist",
522
529
  "commands",
523
- "settings",
530
+ "logs",
524
531
  "index.js"
525
532
  ]
526
533
  },
527
- "status": {
534
+ "settings": {
528
535
  "aliases": [],
529
536
  "args": {},
530
- "description": "View email performance metrics and quota usage",
537
+ "description": "View and update project settings",
531
538
  "examples": [
532
- "<%= config.bin %> status",
533
- "<%= config.bin %> status --json"
539
+ "<%= config.bin %> settings",
540
+ "<%= config.bin %> settings --set brand_color=#0F3460",
541
+ "<%= config.bin %> settings --json"
534
542
  ],
535
543
  "flags": {
536
544
  "json": {
@@ -545,11 +553,18 @@
545
553
  "name": "yes",
546
554
  "allowNo": false,
547
555
  "type": "boolean"
556
+ },
557
+ "set": {
558
+ "description": "Set a setting (format: key=value)",
559
+ "name": "set",
560
+ "hasDynamicHelp": false,
561
+ "multiple": false,
562
+ "type": "option"
548
563
  }
549
564
  },
550
565
  "hasDynamicHelp": false,
551
566
  "hiddenAliases": [],
552
- "id": "status",
567
+ "id": "settings",
553
568
  "pluginAlias": "@mailmodo/cli",
554
569
  "pluginName": "@mailmodo/cli",
555
570
  "pluginType": "core",
@@ -559,19 +574,17 @@
559
574
  "relativePath": [
560
575
  "dist",
561
576
  "commands",
562
- "status",
577
+ "settings",
563
578
  "index.js"
564
579
  ]
565
580
  },
566
- "logs": {
581
+ "status": {
567
582
  "aliases": [],
568
583
  "args": {},
569
- "description": "View email send logs and delivery events",
584
+ "description": "View email performance metrics and quota usage",
570
585
  "examples": [
571
- "<%= config.bin %> logs",
572
- "<%= config.bin %> logs --email sarah@example.com",
573
- "<%= config.bin %> logs --failed",
574
- "<%= config.bin %> logs --json"
586
+ "<%= config.bin %> status",
587
+ "<%= config.bin %> status --json"
575
588
  ],
576
589
  "flags": {
577
590
  "json": {
@@ -586,24 +599,11 @@
586
599
  "name": "yes",
587
600
  "allowNo": false,
588
601
  "type": "boolean"
589
- },
590
- "email": {
591
- "description": "Filter logs by contact email",
592
- "name": "email",
593
- "hasDynamicHelp": false,
594
- "multiple": false,
595
- "type": "option"
596
- },
597
- "failed": {
598
- "description": "Show only failed/bounced events",
599
- "name": "failed",
600
- "allowNo": false,
601
- "type": "boolean"
602
602
  }
603
603
  },
604
604
  "hasDynamicHelp": false,
605
605
  "hiddenAliases": [],
606
- "id": "logs",
606
+ "id": "status",
607
607
  "pluginAlias": "@mailmodo/cli",
608
608
  "pluginName": "@mailmodo/cli",
609
609
  "pluginType": "core",
@@ -613,10 +613,10 @@
613
613
  "relativePath": [
614
614
  "dist",
615
615
  "commands",
616
- "logs",
616
+ "status",
617
617
  "index.js"
618
618
  ]
619
619
  }
620
620
  },
621
- "version": "0.0.11-beta.pr13.17"
621
+ "version": "0.0.12-beta.pr14.18"
622
622
  }
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.11-beta.pr13.17",
4
+ "version": "0.0.12-beta.pr14.18",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"
@@ -24,7 +24,7 @@
24
24
  "@types/chai": "^4",
25
25
  "@types/js-yaml": "^4.0.9",
26
26
  "@types/mocha": "^10",
27
- "@types/node": "^18",
27
+ "@types/node": "^18.19.130",
28
28
  "chai": "^4",
29
29
  "eslint": "^9",
30
30
  "eslint-config-oclif": "^6",