@mailmodo/cli 0.0.29-beta.pr31.49 → 0.0.29

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, } from '../../lib/constants.js';
4
+ import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, DNS_GUIDE_URL, } 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, domainResponse.data?.dnsGuideUrl);
235
+ this.showDnsRecords(domainResponse.data?.dnsRecords || [], flags.json);
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, dnsGuideUrl) {
276
+ showDnsRecords(dnsRecords, jsonOutput) {
277
277
  if (jsonOutput)
278
278
  return;
279
279
  this.log(`\n Add these ${dnsRecords.length} DNS records to your domain provider:\n`);
@@ -284,8 +284,7 @@ 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
- if (dnsGuideUrl)
288
- this.log(` Full guide: ${chalk.cyan(dnsGuideUrl)}\n`);
287
+ this.log(` Full guide: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
289
288
  }
290
289
  async verifyDomain(jsonOutput, domain) {
291
290
  const verify = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY, {
@@ -294,7 +293,7 @@ export default class Deploy extends BaseCommand {
294
293
  if (!verify.ok) {
295
294
  this.handleApiError(verify);
296
295
  }
297
- const { dkim, dmarc, dnsGuideUrl, domainStatus, returnPath } = verify.data;
296
+ const { dkim, dmarc, domainStatus, returnPath } = verify.data;
298
297
  const allPassed = domainStatus === 'VERIFIED';
299
298
  if (!jsonOutput) {
300
299
  this.log(` DKIM ${dkim ? chalk.green('✓') : chalk.red('✗')}`);
@@ -305,8 +304,7 @@ export default class Deploy extends BaseCommand {
305
304
  }
306
305
  else {
307
306
  this.log(`\n ${chalk.yellow('Some records failed.')} Fix them and run ${chalk.cyan('mailmodo domain --verify')}.`);
308
- if (dnsGuideUrl)
309
- this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
307
+ this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
310
308
  }
311
309
  }
312
310
  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 } from '../../lib/constants.js';
5
+ import { API_ENDPOINTS, DNS_GUIDE_URL } 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;
72
+ const guideUrl = response.data?.dnsGuideUrl ?? DNS_GUIDE_URL;
73
73
  if (flags.json) {
74
74
  this.log(JSON.stringify({ dnsRecords: records, domain }, null, 2));
75
75
  return;
@@ -82,8 +82,7 @@ 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
- if (guideUrl)
86
- this.log(` Full guide: ${chalk.cyan(guideUrl)}\n`);
85
+ this.log(` Full guide: ${chalk.cyan(guideUrl)}\n`);
87
86
  if (!flags.yes) {
88
87
  const action = await input({
89
88
  default: '',
@@ -108,7 +107,7 @@ export default class Domain extends BaseCommand {
108
107
  if (!response.ok) {
109
108
  this.handleApiError(response);
110
109
  }
111
- const { dkim, dmarc, dnsGuideUrl, returnPath, domainStatus } = response.data;
110
+ const { dkim, dmarc, returnPath, domainStatus } = response.data;
112
111
  if (jsonOutput) {
113
112
  this.log(JSON.stringify({ dkim, dmarc, returnPath, domainStatus }, null, 2));
114
113
  return;
@@ -134,8 +133,7 @@ export default class Domain extends BaseCommand {
134
133
  this.log(` - Cloudflare: proxy must be OFF (grey cloud, not orange)`);
135
134
  }
136
135
  this.log(`\n Fix the records and run ${chalk.cyan('mailmodo domain --verify')} again.`);
137
- if (dnsGuideUrl)
138
- this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
136
+ this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
139
137
  }
140
138
  }
141
139
  /**
@@ -8,5 +8,4 @@ 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;
12
11
  }
@@ -1,9 +1,9 @@
1
1
  import { Flags } from '@oclif/core';
2
- import { confirm, editor, input, select } from '@inquirer/prompts';
2
+ import { 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 { loadYaml, saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
6
+ import { saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
7
7
  function isValidUrl(value) {
8
8
  try {
9
9
  return Boolean(new URL(value));
@@ -42,8 +42,6 @@ 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;
47
45
  let productUrl = flags.url;
48
46
  if (!productUrl) {
49
47
  productUrl = await input({
@@ -179,21 +177,4 @@ export default class Init extends BaseCommand {
179
177
  this.log(` Created ${chalk.green('mailmodo.yaml')} + ${chalk.green(String(emailConfigs.length))} email templates in ${chalk.green('/mailmodo')}\n`);
180
178
  this.log(` Run ${chalk.cyan("'mailmodo emails'")} to review.\n`);
181
179
  }
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
- }
199
180
  }
@@ -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 } from '../../lib/constants.js';
8
+ import { API_ENDPOINTS, DNS_GUIDE_URL } 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,7 +232,6 @@ 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;
236
235
  yamlConfig.project.domain = newDomain;
237
236
  yamlConfig.project.fromEmail = newFromEmail;
238
237
  yamlConfig.project.address = newAddress;
@@ -247,8 +246,7 @@ export default class Settings extends BaseCommand {
247
246
  }
248
247
  this.log(` Run ${chalk.cyan("'mailmodo domain --verify'")} once records are added.`);
249
248
  this.log(` Emails will not send until the new domain is verified.`);
250
- if (dnsGuideUrl)
251
- this.log(` Help: ${chalk.cyan(dnsGuideUrl)}\n`);
249
+ this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
252
250
  }
253
251
  recordLabel(index) {
254
252
  const labels = ['DKIM', 'DMARC', 'Return Path'];
@@ -12,8 +12,6 @@ export interface ApiRequestDebugInfo {
12
12
  responseSummary?: string;
13
13
  }
14
14
  export interface ApiResponse<T = Record<string, unknown>> {
15
- /** Warning string from the API when the user's card is expiring or has issues. */
16
- addCardWarning?: string;
17
15
  data: T;
18
16
  /** Populated for tracing; especially useful when `ok` is false. */
19
17
  debug?: ApiRequestDebugInfo;
@@ -14,12 +14,6 @@ import { fetchFileNoAuth, fetchFileWithBearerAuth, } from './fetch-file.js';
14
14
  * indicating the API may not be available, rather than a raw stack trace.
15
15
  */
16
16
  const RESPONSE_BODY_DEBUG_MAX = 800;
17
- function extractAddCardWarning(data) {
18
- const raw = data;
19
- return typeof raw.addCardWarning === 'string'
20
- ? raw.addCardWarning
21
- : undefined;
22
- }
23
17
  function summarizeResponseBody(data) {
24
18
  if (data === null || data === undefined)
25
19
  return undefined;
@@ -96,13 +90,7 @@ export class ApiClient {
96
90
  status: response.status,
97
91
  };
98
92
  }
99
- const addCardWarning = extractAddCardWarning(data);
100
- return {
101
- ...(addCardWarning === undefined ? {} : { addCardWarning }),
102
- data: data,
103
- ok: true,
104
- status: response.status,
105
- };
93
+ return { data: data, ok: true, status: response.status };
106
94
  }
107
95
  catch (error) {
108
96
  const err = error;
@@ -176,13 +164,7 @@ export class ApiClient {
176
164
  status: response.status,
177
165
  };
178
166
  }
179
- const addCardWarning = extractAddCardWarning(data);
180
- return {
181
- ...(addCardWarning === undefined ? {} : { addCardWarning }),
182
- data: data,
183
- ok: true,
184
- status: response.status,
185
- };
167
+ return { data: data, ok: true, status: response.status };
186
168
  }
187
169
  catch (error) {
188
170
  const err = error;
@@ -63,12 +63,12 @@ export class BaseCommand extends Command {
63
63
  color: 'cyan',
64
64
  text: options.text,
65
65
  }).start();
66
- const result = await work().finally(() => spinner.stop());
67
- const warning = result.addCardWarning;
68
- if (typeof warning === 'string' && warning) {
69
- this.warn(warning);
66
+ try {
67
+ return await work();
68
+ }
69
+ finally {
70
+ spinner.stop();
70
71
  }
71
- return result;
72
72
  }
73
73
  /**
74
74
  * Loads and returns the mailmodo.yaml configuration from the current directory.
@@ -570,13 +570,14 @@
570
570
  "index.js"
571
571
  ]
572
572
  },
573
- "status": {
573
+ "settings": {
574
574
  "aliases": [],
575
575
  "args": {},
576
- "description": "View email performance metrics and quota usage",
576
+ "description": "View and update project settings",
577
577
  "examples": [
578
- "<%= config.bin %> status",
579
- "<%= config.bin %> status --json"
578
+ "<%= config.bin %> settings",
579
+ "<%= config.bin %> settings --set brand_color=#0F3460",
580
+ "<%= config.bin %> settings --json"
580
581
  ],
581
582
  "flags": {
582
583
  "json": {
@@ -591,11 +592,18 @@
591
592
  "name": "yes",
592
593
  "allowNo": false,
593
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"
594
602
  }
595
603
  },
596
604
  "hasDynamicHelp": false,
597
605
  "hiddenAliases": [],
598
- "id": "status",
606
+ "id": "settings",
599
607
  "pluginAlias": "@mailmodo/cli",
600
608
  "pluginName": "@mailmodo/cli",
601
609
  "pluginType": "core",
@@ -605,18 +613,17 @@
605
613
  "relativePath": [
606
614
  "dist",
607
615
  "commands",
608
- "status",
616
+ "settings",
609
617
  "index.js"
610
618
  ]
611
619
  },
612
- "settings": {
620
+ "status": {
613
621
  "aliases": [],
614
622
  "args": {},
615
- "description": "View and update project settings",
623
+ "description": "View email performance metrics and quota usage",
616
624
  "examples": [
617
- "<%= config.bin %> settings",
618
- "<%= config.bin %> settings --set brand_color=#0F3460",
619
- "<%= config.bin %> settings --json"
625
+ "<%= config.bin %> status",
626
+ "<%= config.bin %> status --json"
620
627
  ],
621
628
  "flags": {
622
629
  "json": {
@@ -631,18 +638,11 @@
631
638
  "name": "yes",
632
639
  "allowNo": false,
633
640
  "type": "boolean"
634
- },
635
- "set": {
636
- "description": "Set a setting (format: key=value)",
637
- "name": "set",
638
- "hasDynamicHelp": false,
639
- "multiple": false,
640
- "type": "option"
641
641
  }
642
642
  },
643
643
  "hasDynamicHelp": false,
644
644
  "hiddenAliases": [],
645
- "id": "settings",
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
- "settings",
655
+ "status",
656
656
  "index.js"
657
657
  ]
658
658
  }
659
659
  },
660
- "version": "0.0.29-beta.pr31.49"
660
+ "version": "0.0.29"
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.29-beta.pr31.49",
4
+ "version": "0.0.29",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"