@mailmodo/cli 0.0.12-beta.pr14.21 → 0.0.12-beta.pr15.19
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.
- package/dist/commands/domain/index.js +15 -29
- package/dist/commands/init/index.js +8 -26
- package/dist/commands/settings/index.d.ts +18 -1
- package/dist/commands/settings/index.js +159 -40
- package/dist/lib/config.d.ts +0 -1
- package/dist/lib/constants.d.ts +1 -1
- package/dist/lib/constants.js +1 -2
- package/oclif.manifest.json +50 -50
- package/package.json +4 -16
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
import { saveYaml } from '../../lib/yaml-config.js';
|
|
8
7
|
export default class Domain extends BaseCommand {
|
|
9
8
|
static description = 'Set up and verify your sending domain';
|
|
@@ -25,22 +24,22 @@ export default class Domain extends BaseCommand {
|
|
|
25
24
|
};
|
|
26
25
|
async run() {
|
|
27
26
|
const { flags } = await this.parse(Domain);
|
|
28
|
-
|
|
27
|
+
await this.ensureAuth();
|
|
29
28
|
if (flags.verify) {
|
|
30
|
-
await this.verifyDomain(flags.json
|
|
29
|
+
await this.verifyDomain(flags.json);
|
|
31
30
|
return;
|
|
32
31
|
}
|
|
33
32
|
if (flags.status) {
|
|
34
|
-
await this.showDomainStatus(flags.json
|
|
33
|
+
await this.showDomainStatus(flags.json);
|
|
35
34
|
return;
|
|
36
35
|
}
|
|
37
|
-
await this.setupDomain(flags
|
|
36
|
+
await this.setupDomain(flags);
|
|
38
37
|
}
|
|
39
38
|
/**
|
|
40
39
|
* Interactive domain setup: collects domain, sender email, and business address,
|
|
41
40
|
* then calls the API to retrieve the required DNS records.
|
|
42
41
|
*/
|
|
43
|
-
async setupDomain(flags
|
|
42
|
+
async setupDomain(flags) {
|
|
44
43
|
const yamlConfig = await this.ensureYaml();
|
|
45
44
|
this.log(`\n ${'─'.repeat(53)}`);
|
|
46
45
|
this.log(` ${chalk.bold('DOMAIN SETUP')}`);
|
|
@@ -85,7 +84,6 @@ export default class Domain extends BaseCommand {
|
|
|
85
84
|
yamlConfig.project.fromEmail = senderEmail;
|
|
86
85
|
yamlConfig.project.address = address;
|
|
87
86
|
await saveYaml(yamlConfig);
|
|
88
|
-
await saveConfig({ ...config, domain });
|
|
89
87
|
const records = response.data?.dnsRecords || [];
|
|
90
88
|
if (flags.json) {
|
|
91
89
|
this.log(JSON.stringify({ dnsRecords: records, domain }, null, 2));
|
|
@@ -106,21 +104,15 @@ export default class Domain extends BaseCommand {
|
|
|
106
104
|
message: "Press Enter once you've added the records, or 'skip'.",
|
|
107
105
|
});
|
|
108
106
|
if (action.toLowerCase() !== 'skip') {
|
|
109
|
-
await this.verifyDomain(false
|
|
107
|
+
await this.verifyDomain(false);
|
|
110
108
|
}
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
111
|
/**
|
|
114
112
|
* Calls the domain verification API and displays pass/fail for each DNS record.
|
|
115
113
|
*/
|
|
116
|
-
async verifyDomain(jsonOutput
|
|
117
|
-
|
|
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
|
-
}));
|
|
114
|
+
async verifyDomain(jsonOutput) {
|
|
115
|
+
const response = await this.withApiSpinner({ json: jsonOutput, text: ' Checking DNS...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_VERIFY));
|
|
124
116
|
if (!response.ok) {
|
|
125
117
|
this.handleApiError(response);
|
|
126
118
|
}
|
|
@@ -129,16 +121,16 @@ export default class Domain extends BaseCommand {
|
|
|
129
121
|
this.log(JSON.stringify({ dkim, dmarc, spf }, null, 2));
|
|
130
122
|
return;
|
|
131
123
|
}
|
|
132
|
-
this.log(` SPF ${spf ? chalk.green('✓') : chalk.red('✗ Not found')}`);
|
|
133
|
-
this.log(` DKIM ${dkim ? chalk.green('✓') : chalk.red('✗ Not found')}`);
|
|
134
|
-
this.log(` DMARC ${dmarc ? chalk.green('✓') : chalk.red('✗ Not found')}`);
|
|
135
|
-
const allPassed = spf && dkim && dmarc;
|
|
124
|
+
this.log(` SPF ${spf === 'pass' ? chalk.green('✓') : chalk.red('✗ Not found')}`);
|
|
125
|
+
this.log(` DKIM ${dkim === 'pass' ? chalk.green('✓') : chalk.red('✗ Not found')}`);
|
|
126
|
+
this.log(` DMARC ${dmarc === 'pass' ? chalk.green('✓') : chalk.red('✗ Not found')}`);
|
|
127
|
+
const allPassed = spf === 'pass' && dkim === 'pass' && dmarc === 'pass';
|
|
136
128
|
if (allPassed) {
|
|
137
129
|
this.log(`\n ${chalk.green('✓')} Domain verified.\n`);
|
|
138
130
|
}
|
|
139
131
|
else {
|
|
140
132
|
this.log(`\n ${chalk.yellow('Some records failed.')}`);
|
|
141
|
-
if (
|
|
133
|
+
if (dkim !== 'pass') {
|
|
142
134
|
this.log(`\n DKIM common mistakes:`);
|
|
143
135
|
this.log(` - Using TXT instead of CNAME record type`);
|
|
144
136
|
this.log(` - Including the full domain in the Host field`);
|
|
@@ -152,14 +144,8 @@ export default class Domain extends BaseCommand {
|
|
|
152
144
|
* Displays domain health metrics including verification status,
|
|
153
145
|
* bounce rate, and spam complaint rate.
|
|
154
146
|
*/
|
|
155
|
-
async showDomainStatus(jsonOutput
|
|
156
|
-
|
|
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
|
-
}));
|
|
147
|
+
async showDomainStatus(jsonOutput) {
|
|
148
|
+
const response = await this.withApiSpinner({ json: jsonOutput, text: ' Loading domain status...' }, () => this.apiClient.get(API_ENDPOINTS.DOMAIN_STATUS));
|
|
163
149
|
if (!response.ok) {
|
|
164
150
|
this.handleApiError(response);
|
|
165
151
|
}
|
|
@@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
|
|
|
2
2
|
import { editor, input, select } from '@inquirer/prompts';
|
|
3
3
|
import chalk from 'chalk';
|
|
4
4
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
5
|
-
import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP
|
|
5
|
+
import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP } from '../../lib/constants.js';
|
|
6
6
|
import { saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
|
|
7
7
|
function isValidUrl(value) {
|
|
8
8
|
try {
|
|
@@ -106,31 +106,13 @@ export default class Init extends BaseCommand {
|
|
|
106
106
|
analysisPayload = JSON.parse(editedAnalysis);
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
analysis: analysisPayload,
|
|
117
|
-
productUrl,
|
|
118
|
-
}))
|
|
119
|
-
: {
|
|
120
|
-
ok: true,
|
|
121
|
-
status: 200,
|
|
122
|
-
data: {
|
|
123
|
-
emails: analysisPayload.recommendedEmails.map((rec) => ({
|
|
124
|
-
ctaText: 'Get Started',
|
|
125
|
-
html: `<html><body><h1>${analysisPayload.productName}</h1><p>This is a placeholder email for <strong>${rec.id}</strong>.</p><a href="{{cta_url}}">Get Started</a></body></html>`,
|
|
126
|
-
id: rec.id,
|
|
127
|
-
plainHtml: `<html><body><p>This is a placeholder email for ${rec.id}.</p><a href="{{cta_url}}">Get Started</a></body></html>`,
|
|
128
|
-
previewText: `Welcome — ${rec.goal}`,
|
|
129
|
-
subject: `${analysisPayload.productName}: ${rec.goal}`,
|
|
130
|
-
suggestedCtaPath: '/dashboard',
|
|
131
|
-
})),
|
|
132
|
-
},
|
|
133
|
-
};
|
|
109
|
+
const generateResponse = await this.withApiSpinner({
|
|
110
|
+
json: flags.json,
|
|
111
|
+
text: ' Generating email templates...',
|
|
112
|
+
}, () => this.apiClient.post(API_ENDPOINTS.GENERATE, {
|
|
113
|
+
analysis: analysisPayload,
|
|
114
|
+
productUrl,
|
|
115
|
+
}));
|
|
134
116
|
if (!generateResponse.ok) {
|
|
135
117
|
this.handleApiError(generateResponse);
|
|
136
118
|
}
|
|
@@ -8,13 +8,30 @@ export default class Settings extends BaseCommand {
|
|
|
8
8
|
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
9
|
};
|
|
10
10
|
run(): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Prompts the user to pick a setting key to edit and dispatches
|
|
13
|
+
* to the appropriate handler for that key.
|
|
14
|
+
*/
|
|
15
|
+
private promptEditSetting;
|
|
16
|
+
/**
|
|
17
|
+
* Fetches the domain verification status from the API.
|
|
18
|
+
* Returns true/false for verified/unverified, or null if unavailable.
|
|
19
|
+
*/
|
|
20
|
+
private fetchDomainVerified;
|
|
21
|
+
/**
|
|
22
|
+
* Handles domain change: collects the new domain, sender email, and
|
|
23
|
+
* business address, calls the API to register them, displays the required
|
|
24
|
+
* DNS records, and saves the updated config. Emails won't send until the
|
|
25
|
+
* domain is re-verified.
|
|
26
|
+
*/
|
|
27
|
+
private handleDomainChange;
|
|
28
|
+
private recordLabel;
|
|
11
29
|
/**
|
|
12
30
|
* Handles the logo file upload flow: validates the local file exists,
|
|
13
31
|
* reads it, uploads to Mailmodo CDN via API, and updates both logoFile
|
|
14
32
|
* and logoUrl in the project config.
|
|
15
33
|
*
|
|
16
34
|
* @param {import('../../lib/yaml-config.js').MailmodoYaml} yamlConfig - The full YAML config to update and save.
|
|
17
|
-
* @param {boolean} jsonOutput - When true, spinner uses stderr so stdout stays clean.
|
|
18
35
|
*/
|
|
19
36
|
private handleLogoUpload;
|
|
20
37
|
}
|
|
@@ -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'],
|
|
@@ -14,6 +14,11 @@ const SETTINGS_GROUPS = Object.freeze({
|
|
|
14
14
|
identity: ['from_name', 'from_email', 'reply_to'],
|
|
15
15
|
integrations: ['webhook_url'],
|
|
16
16
|
});
|
|
17
|
+
const SETUP_HINTS = {
|
|
18
|
+
address: "'mailmodo domain'",
|
|
19
|
+
domain: "'mailmodo domain'",
|
|
20
|
+
monthlyCap: "'mailmodo billing --cap <n>'",
|
|
21
|
+
};
|
|
17
22
|
/**
|
|
18
23
|
* Converts a user-facing snake_case YAML setting key to its
|
|
19
24
|
* corresponding camelCase TypeScript property name.
|
|
@@ -65,66 +70,180 @@ export default class Settings extends BaseCommand {
|
|
|
65
70
|
this.log(JSON.stringify({ settings: project }, null, 2));
|
|
66
71
|
return;
|
|
67
72
|
}
|
|
73
|
+
const domainVerified = await this.fetchDomainVerified(project.domain);
|
|
68
74
|
this.log(`\n Current settings for ${chalk.bold(project.name || 'project')}:\n`);
|
|
69
75
|
for (const [group, keys] of Object.entries(SETTINGS_GROUPS)) {
|
|
76
|
+
const availableKeys = keys.filter((key) => settingKeyToProp(key) in project);
|
|
77
|
+
if (availableKeys.length === 0) {
|
|
78
|
+
const hint = SETUP_HINTS[settingKeyToProp(keys[0])];
|
|
79
|
+
if (hint) {
|
|
80
|
+
this.log(` ${chalk.bold(group.charAt(0).toUpperCase() + group.slice(1))}`);
|
|
81
|
+
this.log(` ${'─'.repeat(49)}`);
|
|
82
|
+
this.log(` ${chalk.dim(`Run ${hint} to configure.`)}`);
|
|
83
|
+
this.log('');
|
|
84
|
+
}
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
70
87
|
this.log(` ${chalk.bold(group.charAt(0).toUpperCase() + group.slice(1))}`);
|
|
71
88
|
this.log(` ${'─'.repeat(49)}`);
|
|
72
|
-
for (const key of
|
|
89
|
+
for (const key of availableKeys) {
|
|
73
90
|
const propKey = settingKeyToProp(key);
|
|
74
91
|
const value = project[propKey];
|
|
75
|
-
|
|
92
|
+
let displayValue = value ? String(value) : chalk.dim('(not set)');
|
|
93
|
+
if (key === 'domain' && value && domainVerified === true) {
|
|
94
|
+
displayValue += ` ${chalk.green('✓ verified')}`;
|
|
95
|
+
}
|
|
96
|
+
else if (key === 'domain' && value && domainVerified === false) {
|
|
97
|
+
displayValue += ` ${chalk.red('✗ not verified')}`;
|
|
98
|
+
}
|
|
76
99
|
this.log(` ${key.padEnd(16)} ${displayValue}`);
|
|
77
100
|
}
|
|
101
|
+
const missingKeys = keys.filter((key) => !(settingKeyToProp(key) in project));
|
|
102
|
+
for (const key of missingKeys) {
|
|
103
|
+
const hint = SETUP_HINTS[settingKeyToProp(key)];
|
|
104
|
+
if (hint) {
|
|
105
|
+
this.log(` ${key.padEnd(16)} ${chalk.dim(`(run ${hint} to set up)`)}`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
78
108
|
this.log('');
|
|
79
109
|
}
|
|
80
110
|
if (!flags.yes) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
111
|
+
await this.promptEditSetting(yamlConfig);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Prompts the user to pick a setting key to edit and dispatches
|
|
116
|
+
* to the appropriate handler for that key.
|
|
117
|
+
*/
|
|
118
|
+
async promptEditSetting(yamlConfig) {
|
|
119
|
+
const { project } = yamlConfig;
|
|
120
|
+
const editKey = await input({
|
|
121
|
+
default: 'n',
|
|
122
|
+
message: "Edit a setting? (key or 'n'):",
|
|
123
|
+
});
|
|
124
|
+
if (editKey === 'n')
|
|
125
|
+
return;
|
|
126
|
+
const editPropKey = settingKeyToProp(editKey);
|
|
127
|
+
if (!(editPropKey in project)) {
|
|
128
|
+
const hint = SETUP_HINTS[editPropKey];
|
|
129
|
+
if (hint) {
|
|
130
|
+
this.log(`\n ${editKey} is not configured yet. Run ${chalk.cyan(hint)} to set it up.\n`);
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
this.log(`\n Unknown setting: ${editKey}\n`);
|
|
134
|
+
}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
if (editKey === 'logo_file') {
|
|
138
|
+
await this.handleLogoUpload(yamlConfig);
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
if (editKey === 'domain') {
|
|
142
|
+
await this.handleDomainChange(yamlConfig);
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
if (editKey === 'email_style') {
|
|
146
|
+
const style = await select({
|
|
147
|
+
choices: [
|
|
148
|
+
{ name: 'plain', value: 'plain' },
|
|
149
|
+
{ name: 'branded', value: 'branded' },
|
|
150
|
+
],
|
|
151
|
+
message: 'Email style:',
|
|
84
152
|
});
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
project[editPropKey] =
|
|
113
|
-
editPropKey === 'monthlyCap' ? Number(newValue) : newValue;
|
|
114
|
-
await saveYaml(yamlConfig);
|
|
115
|
-
this.log(`\n ${chalk.green('✓')} Updated. Run ${chalk.cyan("'mailmodo deploy'")} to apply.\n`);
|
|
153
|
+
project.emailStyle = style;
|
|
154
|
+
await saveYaml(yamlConfig);
|
|
155
|
+
this.log(`\n ${chalk.green('✓')} email_style updated to ${chalk.cyan(style)}`);
|
|
156
|
+
this.log(` Run ${chalk.cyan("'mailmodo deploy'")} to apply.\n`);
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
const newValue = await input({
|
|
160
|
+
message: `New value for ${editKey}:`,
|
|
161
|
+
});
|
|
162
|
+
project[editPropKey] =
|
|
163
|
+
editPropKey === 'monthlyCap' ? Number(newValue) : newValue;
|
|
164
|
+
await saveYaml(yamlConfig);
|
|
165
|
+
this.log(`\n ${chalk.green('✓')} Updated. Run ${chalk.cyan("'mailmodo deploy'")} to apply.\n`);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Fetches the domain verification status from the API.
|
|
169
|
+
* Returns true/false for verified/unverified, or null if unavailable.
|
|
170
|
+
*/
|
|
171
|
+
async fetchDomainVerified(domain) {
|
|
172
|
+
if (!domain)
|
|
173
|
+
return null;
|
|
174
|
+
try {
|
|
175
|
+
await this.ensureAuth();
|
|
176
|
+
const response = await this.apiClient.get(API_ENDPOINTS.DOMAIN_STATUS, { domain });
|
|
177
|
+
if (!response.ok) {
|
|
178
|
+
this.log(` ${chalk.dim('Could not fetch domain status. Run')} ${chalk.cyan("'mailmodo domain --status'")} ${chalk.dim('to check manually.')}`);
|
|
179
|
+
return null;
|
|
116
180
|
}
|
|
181
|
+
return response.data?.verified === true;
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
this.log(` ${chalk.dim('Could not reach API for domain status. Skipping verification check.')}`);
|
|
185
|
+
return null;
|
|
117
186
|
}
|
|
118
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* Handles domain change: collects the new domain, sender email, and
|
|
190
|
+
* business address, calls the API to register them, displays the required
|
|
191
|
+
* DNS records, and saves the updated config. Emails won't send until the
|
|
192
|
+
* domain is re-verified.
|
|
193
|
+
*/
|
|
194
|
+
async handleDomainChange(yamlConfig) {
|
|
195
|
+
const newDomain = await input({
|
|
196
|
+
message: 'New domain:',
|
|
197
|
+
validate: (v) => (v?.trim() ? true : 'Domain is required'),
|
|
198
|
+
});
|
|
199
|
+
const newFromEmail = await input({
|
|
200
|
+
default: yamlConfig.project.fromEmail || '',
|
|
201
|
+
message: 'Sender email (from address):',
|
|
202
|
+
validate: (v) => v?.includes('@') ? true : 'Please enter a valid email',
|
|
203
|
+
});
|
|
204
|
+
const newAddress = await input({
|
|
205
|
+
default: yamlConfig.project.address || '',
|
|
206
|
+
message: 'Business address (required by law):',
|
|
207
|
+
validate: (v) => (v?.trim() ? true : 'Address is required'),
|
|
208
|
+
});
|
|
209
|
+
await this.ensureAuth();
|
|
210
|
+
const response = await this.apiClient.post(API_ENDPOINTS.DOMAIN, {
|
|
211
|
+
address: newAddress,
|
|
212
|
+
domain: newDomain,
|
|
213
|
+
fromEmail: newFromEmail,
|
|
214
|
+
});
|
|
215
|
+
if (!response.ok) {
|
|
216
|
+
this.handleApiError(response);
|
|
217
|
+
}
|
|
218
|
+
const records = response.data?.dnsRecords || [];
|
|
219
|
+
yamlConfig.project.domain = newDomain;
|
|
220
|
+
yamlConfig.project.fromEmail = newFromEmail;
|
|
221
|
+
yamlConfig.project.address = newAddress;
|
|
222
|
+
await saveYaml(yamlConfig);
|
|
223
|
+
this.log(`\n Domain, sender email, and business address updated. You will need to re-verify.`);
|
|
224
|
+
this.log(` New DNS records:\n`);
|
|
225
|
+
for (const [i, record] of records.entries()) {
|
|
226
|
+
this.log(` ${chalk.bold(`RECORD ${i + 1} — ${this.recordLabel(i)}`)}`);
|
|
227
|
+
this.log(` Type: ${record.type}`);
|
|
228
|
+
this.log(` Host: ${record.host}`);
|
|
229
|
+
this.log(` Value: ${record.value}\n`);
|
|
230
|
+
}
|
|
231
|
+
this.log(` Run ${chalk.cyan("'mailmodo domain --verify'")} once records are added.`);
|
|
232
|
+
this.log(` Emails will not send until the new domain is verified.`);
|
|
233
|
+
this.log(` Help: ${chalk.cyan(DNS_GUIDE_URL)}\n`);
|
|
234
|
+
}
|
|
235
|
+
recordLabel(index) {
|
|
236
|
+
const labels = ['SPF', 'DKIM', 'DMARC'];
|
|
237
|
+
return labels[index] || `Record ${index + 1}`;
|
|
238
|
+
}
|
|
119
239
|
/**
|
|
120
240
|
* Handles the logo file upload flow: validates the local file exists,
|
|
121
241
|
* reads it, uploads to Mailmodo CDN via API, and updates both logoFile
|
|
122
242
|
* and logoUrl in the project config.
|
|
123
243
|
*
|
|
124
244
|
* @param {import('../../lib/yaml-config.js').MailmodoYaml} yamlConfig - The full YAML config to update and save.
|
|
125
|
-
* @param {boolean} jsonOutput - When true, spinner uses stderr so stdout stays clean.
|
|
126
245
|
*/
|
|
127
|
-
async handleLogoUpload(yamlConfig
|
|
246
|
+
async handleLogoUpload(yamlConfig) {
|
|
128
247
|
const logoPath = await input({ message: 'Path to logo file:' });
|
|
129
248
|
const resolvedPath = resolve(logoPath);
|
|
130
249
|
if (!existsSync(resolvedPath)) {
|
|
@@ -135,7 +254,7 @@ export default class Settings extends BaseCommand {
|
|
|
135
254
|
const fileBuffer = await readFile(resolvedPath);
|
|
136
255
|
const formData = new FormData();
|
|
137
256
|
formData.append('logo', new Blob([new Uint8Array(fileBuffer)]), logoPath.split(/[/\\]/).pop() || 'logo.png');
|
|
138
|
-
const response = await this.
|
|
257
|
+
const response = await this.apiClient.postFormData(API_ENDPOINTS.ASSETS_LOGO, formData);
|
|
139
258
|
if (!response.ok) {
|
|
140
259
|
this.handleApiError(response);
|
|
141
260
|
}
|
package/dist/lib/config.d.ts
CHANGED
package/dist/lib/constants.d.ts
CHANGED
package/dist/lib/constants.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
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
|
-
|
|
4
|
-
const PRODUCTION_API_BASE_URL = 'https://app-vertex-debug.azurewebsites.net';
|
|
3
|
+
const PRODUCTION_API_BASE_URL = 'https://api.mailmodo.com';
|
|
5
4
|
export const API_BASE_URL = process.env.MAILMODO_DEV_TSX
|
|
6
5
|
? DEV_API_BASE_URL
|
|
7
6
|
: PRODUCTION_API_BASE_URL;
|
package/oclif.manifest.json
CHANGED
|
@@ -53,13 +53,15 @@
|
|
|
53
53
|
"index.js"
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
|
-
"
|
|
56
|
+
"contacts": {
|
|
57
57
|
"aliases": [],
|
|
58
58
|
"args": {},
|
|
59
|
-
"description": "
|
|
59
|
+
"description": "Manage contacts — search, export, or delete",
|
|
60
60
|
"examples": [
|
|
61
|
-
"<%= config.bin %>
|
|
62
|
-
"<%= config.bin %>
|
|
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"
|
|
63
65
|
],
|
|
64
66
|
"flags": {
|
|
65
67
|
"json": {
|
|
@@ -74,11 +76,31 @@
|
|
|
74
76
|
"name": "yes",
|
|
75
77
|
"allowNo": false,
|
|
76
78
|
"type": "boolean"
|
|
79
|
+
},
|
|
80
|
+
"delete": {
|
|
81
|
+
"description": "GDPR hard delete a contact by email",
|
|
82
|
+
"name": "delete",
|
|
83
|
+
"hasDynamicHelp": false,
|
|
84
|
+
"multiple": false,
|
|
85
|
+
"type": "option"
|
|
86
|
+
},
|
|
87
|
+
"export": {
|
|
88
|
+
"description": "Export all contacts as CSV",
|
|
89
|
+
"name": "export",
|
|
90
|
+
"allowNo": false,
|
|
91
|
+
"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"
|
|
77
99
|
}
|
|
78
100
|
},
|
|
79
101
|
"hasDynamicHelp": false,
|
|
80
102
|
"hiddenAliases": [],
|
|
81
|
-
"id": "
|
|
103
|
+
"id": "contacts",
|
|
82
104
|
"pluginAlias": "@mailmodo/cli",
|
|
83
105
|
"pluginName": "@mailmodo/cli",
|
|
84
106
|
"pluginType": "core",
|
|
@@ -88,18 +110,17 @@
|
|
|
88
110
|
"relativePath": [
|
|
89
111
|
"dist",
|
|
90
112
|
"commands",
|
|
91
|
-
"
|
|
113
|
+
"contacts",
|
|
92
114
|
"index.js"
|
|
93
115
|
]
|
|
94
116
|
},
|
|
95
|
-
"
|
|
117
|
+
"deploy": {
|
|
96
118
|
"aliases": [],
|
|
97
119
|
"args": {},
|
|
98
|
-
"description": "
|
|
120
|
+
"description": "Deploy email sequences and verify sending domain",
|
|
99
121
|
"examples": [
|
|
100
|
-
"<%= config.bin %>
|
|
101
|
-
"<%= config.bin %>
|
|
102
|
-
"<%= config.bin %> domain --status"
|
|
122
|
+
"<%= config.bin %> deploy",
|
|
123
|
+
"<%= config.bin %> deploy --yes"
|
|
103
124
|
],
|
|
104
125
|
"flags": {
|
|
105
126
|
"json": {
|
|
@@ -114,23 +135,11 @@
|
|
|
114
135
|
"name": "yes",
|
|
115
136
|
"allowNo": false,
|
|
116
137
|
"type": "boolean"
|
|
117
|
-
},
|
|
118
|
-
"status": {
|
|
119
|
-
"description": "Show domain health status",
|
|
120
|
-
"name": "status",
|
|
121
|
-
"allowNo": false,
|
|
122
|
-
"type": "boolean"
|
|
123
|
-
},
|
|
124
|
-
"verify": {
|
|
125
|
-
"description": "Verify DNS records",
|
|
126
|
-
"name": "verify",
|
|
127
|
-
"allowNo": false,
|
|
128
|
-
"type": "boolean"
|
|
129
138
|
}
|
|
130
139
|
},
|
|
131
140
|
"hasDynamicHelp": false,
|
|
132
141
|
"hiddenAliases": [],
|
|
133
|
-
"id": "
|
|
142
|
+
"id": "deploy",
|
|
134
143
|
"pluginAlias": "@mailmodo/cli",
|
|
135
144
|
"pluginName": "@mailmodo/cli",
|
|
136
145
|
"pluginType": "core",
|
|
@@ -140,19 +149,18 @@
|
|
|
140
149
|
"relativePath": [
|
|
141
150
|
"dist",
|
|
142
151
|
"commands",
|
|
143
|
-
"
|
|
152
|
+
"deploy",
|
|
144
153
|
"index.js"
|
|
145
154
|
]
|
|
146
155
|
},
|
|
147
|
-
"
|
|
156
|
+
"domain": {
|
|
148
157
|
"aliases": [],
|
|
149
158
|
"args": {},
|
|
150
|
-
"description": "
|
|
159
|
+
"description": "Set up and verify your sending domain",
|
|
151
160
|
"examples": [
|
|
152
|
-
"<%= config.bin %>
|
|
153
|
-
"<%= config.bin %>
|
|
154
|
-
"<%= config.bin %>
|
|
155
|
-
"<%= config.bin %> contacts --delete sarah@example.com"
|
|
161
|
+
"<%= config.bin %> domain",
|
|
162
|
+
"<%= config.bin %> domain --verify",
|
|
163
|
+
"<%= config.bin %> domain --status"
|
|
156
164
|
],
|
|
157
165
|
"flags": {
|
|
158
166
|
"json": {
|
|
@@ -168,30 +176,22 @@
|
|
|
168
176
|
"allowNo": false,
|
|
169
177
|
"type": "boolean"
|
|
170
178
|
},
|
|
171
|
-
"
|
|
172
|
-
"description": "
|
|
173
|
-
"name": "
|
|
174
|
-
"hasDynamicHelp": false,
|
|
175
|
-
"multiple": false,
|
|
176
|
-
"type": "option"
|
|
177
|
-
},
|
|
178
|
-
"export": {
|
|
179
|
-
"description": "Export all contacts as CSV",
|
|
180
|
-
"name": "export",
|
|
179
|
+
"status": {
|
|
180
|
+
"description": "Show domain health status",
|
|
181
|
+
"name": "status",
|
|
181
182
|
"allowNo": false,
|
|
182
183
|
"type": "boolean"
|
|
183
184
|
},
|
|
184
|
-
"
|
|
185
|
-
"description": "
|
|
186
|
-
"name": "
|
|
187
|
-
"
|
|
188
|
-
"
|
|
189
|
-
"type": "option"
|
|
185
|
+
"verify": {
|
|
186
|
+
"description": "Verify DNS records",
|
|
187
|
+
"name": "verify",
|
|
188
|
+
"allowNo": false,
|
|
189
|
+
"type": "boolean"
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
192
|
"hasDynamicHelp": false,
|
|
193
193
|
"hiddenAliases": [],
|
|
194
|
-
"id": "
|
|
194
|
+
"id": "domain",
|
|
195
195
|
"pluginAlias": "@mailmodo/cli",
|
|
196
196
|
"pluginName": "@mailmodo/cli",
|
|
197
197
|
"pluginType": "core",
|
|
@@ -201,7 +201,7 @@
|
|
|
201
201
|
"relativePath": [
|
|
202
202
|
"dist",
|
|
203
203
|
"commands",
|
|
204
|
-
"
|
|
204
|
+
"domain",
|
|
205
205
|
"index.js"
|
|
206
206
|
]
|
|
207
207
|
},
|
|
@@ -618,5 +618,5 @@
|
|
|
618
618
|
]
|
|
619
619
|
}
|
|
620
620
|
},
|
|
621
|
-
"version": "0.0.12-beta.
|
|
621
|
+
"version": "0.0.12-beta.pr15.19"
|
|
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.12-beta.
|
|
4
|
+
"version": "0.0.12-beta.pr15.19",
|
|
5
5
|
"author": "provishalk",
|
|
6
6
|
"bin": {
|
|
7
7
|
"mailmodo": "bin/run.js"
|
|
@@ -24,17 +24,13 @@
|
|
|
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",
|
|
28
28
|
"chai": "^4",
|
|
29
29
|
"eslint": "^9",
|
|
30
30
|
"eslint-config-oclif": "^6",
|
|
31
31
|
"eslint-config-prettier": "^10",
|
|
32
|
-
"eslint-plugin-unused-imports": "^4.4.1",
|
|
33
|
-
"husky": "^9.1.7",
|
|
34
|
-
"lint-staged": "^16.4.0",
|
|
35
32
|
"mocha": "^11",
|
|
36
33
|
"oclif": "^4",
|
|
37
|
-
"prettier": "^3.8.2",
|
|
38
34
|
"shx": "^0.3.3",
|
|
39
35
|
"ts-node": "^10",
|
|
40
36
|
"tsx": "^4.21.0",
|
|
@@ -73,15 +69,7 @@
|
|
|
73
69
|
"posttest": "npm run lint",
|
|
74
70
|
"prepack": "oclif manifest && oclif readme",
|
|
75
71
|
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
|
|
76
|
-
"version": "oclif readme && git add README.md"
|
|
77
|
-
"prepare": "husky"
|
|
72
|
+
"version": "oclif readme && git add README.md"
|
|
78
73
|
},
|
|
79
|
-
"types": "dist/index.d.ts"
|
|
80
|
-
"lint-staged": {
|
|
81
|
-
"*.{ts,tsx,js,jsx,mjs,cjs}": [
|
|
82
|
-
"prettier --write",
|
|
83
|
-
"eslint --fix"
|
|
84
|
-
],
|
|
85
|
-
"*.{json,md,yaml,yml}": "prettier --write"
|
|
86
|
-
}
|
|
74
|
+
"types": "dist/index.d.ts"
|
|
87
75
|
}
|