@mailmodo/cli 0.0.54-beta.pr56.89 → 0.0.54-beta.pr56.91
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.
|
@@ -4,6 +4,7 @@ import chalk from 'chalk';
|
|
|
4
4
|
import { BaseCommand } from '../../lib/base-command.js';
|
|
5
5
|
import { API_ENDPOINTS } from '../../lib/constants.js';
|
|
6
6
|
import { loadTemplate, getTemplateFilename, saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
|
|
7
|
+
import { handleMissingTemplates } from '../../lib/templates/missing-templates.js';
|
|
7
8
|
export default class Edit extends BaseCommand {
|
|
8
9
|
static args = {
|
|
9
10
|
id: Args.string({
|
|
@@ -43,6 +44,23 @@ export default class Edit extends BaseCommand {
|
|
|
43
44
|
json: flags.json ?? false,
|
|
44
45
|
yes: flags.yes ?? false,
|
|
45
46
|
};
|
|
47
|
+
if (!ctx.templateHtml) {
|
|
48
|
+
const regenCtx = {
|
|
49
|
+
error: (msg) => this.error(msg),
|
|
50
|
+
exit: (code) => this.exit(code),
|
|
51
|
+
log: (msg) => this.log(msg),
|
|
52
|
+
onApiError: (r) => this.handleApiError(r),
|
|
53
|
+
post: (path, body) => this.apiClient.post(path, body),
|
|
54
|
+
spinner: (text, json, work) => this.withApiSpinner({ json, text }, work),
|
|
55
|
+
syncYaml: () => this.syncYamlToServer(),
|
|
56
|
+
};
|
|
57
|
+
const regenerated = await handleMissingTemplates(regenCtx, yamlConfig, [email.id], editFlags);
|
|
58
|
+
if (!regenerated)
|
|
59
|
+
return;
|
|
60
|
+
ctx.templateHtml = await loadTemplate(templateFilename);
|
|
61
|
+
if (!ctx.templateHtml)
|
|
62
|
+
this.error('Template regeneration failed.');
|
|
63
|
+
}
|
|
46
64
|
const initialChange = flags.change?.trim() || (await this.askChangeDescription());
|
|
47
65
|
await this.runEditStep(ctx, initialChange, editFlags);
|
|
48
66
|
}
|
|
@@ -35,7 +35,8 @@ export default class Init extends BaseCommand {
|
|
|
35
35
|
async run() {
|
|
36
36
|
const { flags } = await this.parse(Init);
|
|
37
37
|
await this.ensureAuth();
|
|
38
|
-
|
|
38
|
+
const existing = await loadYaml();
|
|
39
|
+
if (!(await this.confirmOverwriteIfNeeded(flags, existing)))
|
|
39
40
|
return;
|
|
40
41
|
let productUrl = flags.url;
|
|
41
42
|
if (!productUrl) {
|
|
@@ -147,6 +148,8 @@ export default class Init extends BaseCommand {
|
|
|
147
148
|
webhookUrl: '',
|
|
148
149
|
},
|
|
149
150
|
};
|
|
151
|
+
if (existing)
|
|
152
|
+
this.preserveUserFields(yamlConfig, existing);
|
|
150
153
|
await saveYaml(yamlConfig);
|
|
151
154
|
await this.persistMonthlyCap(yamlConfig);
|
|
152
155
|
const templateSaves = analysisPayload.recommendedEmails.flatMap((rec, index) => {
|
|
@@ -182,8 +185,26 @@ export default class Init extends BaseCommand {
|
|
|
182
185
|
await saveYaml(yamlConfig);
|
|
183
186
|
}
|
|
184
187
|
}
|
|
185
|
-
|
|
186
|
-
const
|
|
188
|
+
preserveUserFields(config, existing) {
|
|
189
|
+
const p = existing.project;
|
|
190
|
+
if (p.fromEmail)
|
|
191
|
+
config.project.fromEmail = p.fromEmail;
|
|
192
|
+
if (p.replyTo)
|
|
193
|
+
config.project.replyTo = p.replyTo;
|
|
194
|
+
if (p.fromName)
|
|
195
|
+
config.project.fromName = p.fromName;
|
|
196
|
+
if (p.webhookUrl)
|
|
197
|
+
config.project.webhookUrl = p.webhookUrl;
|
|
198
|
+
if (p.emailStyle)
|
|
199
|
+
config.project.emailStyle = p.emailStyle;
|
|
200
|
+
if (p.domain)
|
|
201
|
+
config.project.domain = p.domain;
|
|
202
|
+
if (p.address)
|
|
203
|
+
config.project.address = p.address;
|
|
204
|
+
if (p.logoFile)
|
|
205
|
+
config.project.logoFile = p.logoFile;
|
|
206
|
+
}
|
|
207
|
+
async confirmOverwriteIfNeeded(flags, existing) {
|
|
187
208
|
if (!existing)
|
|
188
209
|
return true;
|
|
189
210
|
if (flags.yes)
|
package/oclif.manifest.json
CHANGED
|
@@ -76,15 +76,15 @@
|
|
|
76
76
|
"index.js"
|
|
77
77
|
]
|
|
78
78
|
},
|
|
79
|
-
"
|
|
79
|
+
"contacts": {
|
|
80
80
|
"aliases": [],
|
|
81
81
|
"args": {},
|
|
82
|
-
"description": "
|
|
82
|
+
"description": "Manage contacts — search, export, or delete",
|
|
83
83
|
"examples": [
|
|
84
|
-
"<%= config.bin %>
|
|
85
|
-
"<%= config.bin %>
|
|
86
|
-
"<%= config.bin %>
|
|
87
|
-
"<%= config.bin %>
|
|
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
88
|
],
|
|
89
89
|
"flags": {
|
|
90
90
|
"json": {
|
|
@@ -100,22 +100,22 @@
|
|
|
100
100
|
"allowNo": false,
|
|
101
101
|
"type": "boolean"
|
|
102
102
|
},
|
|
103
|
-
"
|
|
104
|
-
"description": "
|
|
105
|
-
"
|
|
106
|
-
"resume"
|
|
107
|
-
],
|
|
108
|
-
"name": "pause",
|
|
103
|
+
"delete": {
|
|
104
|
+
"description": "GDPR hard delete a contact by email",
|
|
105
|
+
"name": "delete",
|
|
109
106
|
"hasDynamicHelp": false,
|
|
110
107
|
"multiple": false,
|
|
111
108
|
"type": "option"
|
|
112
109
|
},
|
|
113
|
-
"
|
|
114
|
-
"description": "
|
|
115
|
-
"
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
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
119
|
"hasDynamicHelp": false,
|
|
120
120
|
"multiple": false,
|
|
121
121
|
"type": "option"
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
},
|
|
124
124
|
"hasDynamicHelp": false,
|
|
125
125
|
"hiddenAliases": [],
|
|
126
|
-
"id": "
|
|
126
|
+
"id": "contacts",
|
|
127
127
|
"pluginAlias": "@mailmodo/cli",
|
|
128
128
|
"pluginName": "@mailmodo/cli",
|
|
129
129
|
"pluginType": "core",
|
|
@@ -133,19 +133,19 @@
|
|
|
133
133
|
"relativePath": [
|
|
134
134
|
"dist",
|
|
135
135
|
"commands",
|
|
136
|
-
"
|
|
136
|
+
"contacts",
|
|
137
137
|
"index.js"
|
|
138
138
|
]
|
|
139
139
|
},
|
|
140
|
-
"
|
|
140
|
+
"deploy": {
|
|
141
141
|
"aliases": [],
|
|
142
142
|
"args": {},
|
|
143
|
-
"description": "
|
|
143
|
+
"description": "Deploy, pause, or resume an email sequence",
|
|
144
144
|
"examples": [
|
|
145
|
-
"<%= config.bin %>
|
|
146
|
-
"<%= config.bin %>
|
|
147
|
-
"<%= config.bin %>
|
|
148
|
-
"<%= config.bin %>
|
|
145
|
+
"<%= config.bin %> deploy",
|
|
146
|
+
"<%= config.bin %> deploy --yes",
|
|
147
|
+
"<%= config.bin %> deploy --pause seq_abc123",
|
|
148
|
+
"<%= config.bin %> deploy --resume seq_abc123 --json"
|
|
149
149
|
],
|
|
150
150
|
"flags": {
|
|
151
151
|
"json": {
|
|
@@ -161,22 +161,22 @@
|
|
|
161
161
|
"allowNo": false,
|
|
162
162
|
"type": "boolean"
|
|
163
163
|
},
|
|
164
|
-
"
|
|
165
|
-
"description": "
|
|
166
|
-
"
|
|
164
|
+
"pause": {
|
|
165
|
+
"description": "Pause a deployed sequence by ID (stops scheduled + triggered sends)",
|
|
166
|
+
"exclusive": [
|
|
167
|
+
"resume"
|
|
168
|
+
],
|
|
169
|
+
"name": "pause",
|
|
167
170
|
"hasDynamicHelp": false,
|
|
168
171
|
"multiple": false,
|
|
169
172
|
"type": "option"
|
|
170
173
|
},
|
|
171
|
-
"
|
|
172
|
-
"description": "
|
|
173
|
-
"
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
"search": {
|
|
178
|
-
"description": "Search for a contact by email",
|
|
179
|
-
"name": "search",
|
|
174
|
+
"resume": {
|
|
175
|
+
"description": "Resume a paused sequence by ID",
|
|
176
|
+
"exclusive": [
|
|
177
|
+
"pause"
|
|
178
|
+
],
|
|
179
|
+
"name": "resume",
|
|
180
180
|
"hasDynamicHelp": false,
|
|
181
181
|
"multiple": false,
|
|
182
182
|
"type": "option"
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
},
|
|
185
185
|
"hasDynamicHelp": false,
|
|
186
186
|
"hiddenAliases": [],
|
|
187
|
-
"id": "
|
|
187
|
+
"id": "deploy",
|
|
188
188
|
"pluginAlias": "@mailmodo/cli",
|
|
189
189
|
"pluginName": "@mailmodo/cli",
|
|
190
190
|
"pluginType": "core",
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
"relativePath": [
|
|
195
195
|
"dist",
|
|
196
196
|
"commands",
|
|
197
|
-
"
|
|
197
|
+
"deploy",
|
|
198
198
|
"index.js"
|
|
199
199
|
]
|
|
200
200
|
},
|
|
@@ -289,13 +289,19 @@
|
|
|
289
289
|
"index.js"
|
|
290
290
|
]
|
|
291
291
|
},
|
|
292
|
-
"
|
|
292
|
+
"edit": {
|
|
293
293
|
"aliases": [],
|
|
294
|
-
"args": {
|
|
295
|
-
|
|
294
|
+
"args": {
|
|
295
|
+
"id": {
|
|
296
|
+
"description": "Email template ID to edit",
|
|
297
|
+
"name": "id",
|
|
298
|
+
"required": true
|
|
299
|
+
}
|
|
300
|
+
},
|
|
301
|
+
"description": "Edit an email using AI-assisted natural language changes",
|
|
296
302
|
"examples": [
|
|
297
|
-
"<%= config.bin %>
|
|
298
|
-
"<%= config.bin %>
|
|
303
|
+
"<%= config.bin %> edit welcome",
|
|
304
|
+
"<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
|
|
299
305
|
],
|
|
300
306
|
"flags": {
|
|
301
307
|
"json": {
|
|
@@ -310,11 +316,18 @@
|
|
|
310
316
|
"name": "yes",
|
|
311
317
|
"allowNo": false,
|
|
312
318
|
"type": "boolean"
|
|
319
|
+
},
|
|
320
|
+
"change": {
|
|
321
|
+
"description": "Natural language description of the change",
|
|
322
|
+
"name": "change",
|
|
323
|
+
"hasDynamicHelp": false,
|
|
324
|
+
"multiple": false,
|
|
325
|
+
"type": "option"
|
|
313
326
|
}
|
|
314
327
|
},
|
|
315
328
|
"hasDynamicHelp": false,
|
|
316
329
|
"hiddenAliases": [],
|
|
317
|
-
"id": "
|
|
330
|
+
"id": "edit",
|
|
318
331
|
"pluginAlias": "@mailmodo/cli",
|
|
319
332
|
"pluginName": "@mailmodo/cli",
|
|
320
333
|
"pluginType": "core",
|
|
@@ -324,23 +337,17 @@
|
|
|
324
337
|
"relativePath": [
|
|
325
338
|
"dist",
|
|
326
339
|
"commands",
|
|
327
|
-
"
|
|
340
|
+
"edit",
|
|
328
341
|
"index.js"
|
|
329
342
|
]
|
|
330
343
|
},
|
|
331
|
-
"
|
|
344
|
+
"emails": {
|
|
332
345
|
"aliases": [],
|
|
333
|
-
"args": {
|
|
334
|
-
|
|
335
|
-
"description": "Email template ID to edit",
|
|
336
|
-
"name": "id",
|
|
337
|
-
"required": true
|
|
338
|
-
}
|
|
339
|
-
},
|
|
340
|
-
"description": "Edit an email using AI-assisted natural language changes",
|
|
346
|
+
"args": {},
|
|
347
|
+
"description": "List and view configured email sequences",
|
|
341
348
|
"examples": [
|
|
342
|
-
"<%= config.bin %>
|
|
343
|
-
"<%= config.bin %>
|
|
349
|
+
"<%= config.bin %> emails",
|
|
350
|
+
"<%= config.bin %> emails --json"
|
|
344
351
|
],
|
|
345
352
|
"flags": {
|
|
346
353
|
"json": {
|
|
@@ -355,18 +362,11 @@
|
|
|
355
362
|
"name": "yes",
|
|
356
363
|
"allowNo": false,
|
|
357
364
|
"type": "boolean"
|
|
358
|
-
},
|
|
359
|
-
"change": {
|
|
360
|
-
"description": "Natural language description of the change",
|
|
361
|
-
"name": "change",
|
|
362
|
-
"hasDynamicHelp": false,
|
|
363
|
-
"multiple": false,
|
|
364
|
-
"type": "option"
|
|
365
365
|
}
|
|
366
366
|
},
|
|
367
367
|
"hasDynamicHelp": false,
|
|
368
368
|
"hiddenAliases": [],
|
|
369
|
-
"id": "
|
|
369
|
+
"id": "emails",
|
|
370
370
|
"pluginAlias": "@mailmodo/cli",
|
|
371
371
|
"pluginName": "@mailmodo/cli",
|
|
372
372
|
"pluginType": "core",
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
"relativePath": [
|
|
377
377
|
"dist",
|
|
378
378
|
"commands",
|
|
379
|
-
"
|
|
379
|
+
"emails",
|
|
380
380
|
"index.js"
|
|
381
381
|
]
|
|
382
382
|
},
|
|
@@ -631,14 +631,13 @@
|
|
|
631
631
|
"index.js"
|
|
632
632
|
]
|
|
633
633
|
},
|
|
634
|
-
"
|
|
634
|
+
"status": {
|
|
635
635
|
"aliases": [],
|
|
636
636
|
"args": {},
|
|
637
|
-
"description": "
|
|
637
|
+
"description": "View email performance metrics and quota usage",
|
|
638
638
|
"examples": [
|
|
639
|
-
"<%= config.bin %>
|
|
640
|
-
"<%= config.bin %>
|
|
641
|
-
"<%= config.bin %> sdk --json"
|
|
639
|
+
"<%= config.bin %> status",
|
|
640
|
+
"<%= config.bin %> status --json"
|
|
642
641
|
],
|
|
643
642
|
"flags": {
|
|
644
643
|
"json": {
|
|
@@ -653,18 +652,11 @@
|
|
|
653
652
|
"name": "yes",
|
|
654
653
|
"allowNo": false,
|
|
655
654
|
"type": "boolean"
|
|
656
|
-
},
|
|
657
|
-
"sequence-id": {
|
|
658
|
-
"description": "Limit output to a single active sequence by ID (default: all active sequences)",
|
|
659
|
-
"name": "sequence-id",
|
|
660
|
-
"hasDynamicHelp": false,
|
|
661
|
-
"multiple": false,
|
|
662
|
-
"type": "option"
|
|
663
655
|
}
|
|
664
656
|
},
|
|
665
657
|
"hasDynamicHelp": false,
|
|
666
658
|
"hiddenAliases": [],
|
|
667
|
-
"id": "
|
|
659
|
+
"id": "status",
|
|
668
660
|
"pluginAlias": "@mailmodo/cli",
|
|
669
661
|
"pluginName": "@mailmodo/cli",
|
|
670
662
|
"pluginType": "core",
|
|
@@ -674,7 +666,7 @@
|
|
|
674
666
|
"relativePath": [
|
|
675
667
|
"dist",
|
|
676
668
|
"commands",
|
|
677
|
-
"
|
|
669
|
+
"status",
|
|
678
670
|
"index.js"
|
|
679
671
|
]
|
|
680
672
|
},
|
|
@@ -725,13 +717,14 @@
|
|
|
725
717
|
"index.js"
|
|
726
718
|
]
|
|
727
719
|
},
|
|
728
|
-
"
|
|
720
|
+
"sdk": {
|
|
729
721
|
"aliases": [],
|
|
730
722
|
"args": {},
|
|
731
|
-
"description": "
|
|
723
|
+
"description": "Show the SDK track() / identify() reference for deployed sequences",
|
|
732
724
|
"examples": [
|
|
733
|
-
"<%= config.bin %>
|
|
734
|
-
"<%= config.bin %>
|
|
725
|
+
"<%= config.bin %> sdk",
|
|
726
|
+
"<%= config.bin %> sdk --sequence-id a1b2c3d4",
|
|
727
|
+
"<%= config.bin %> sdk --json"
|
|
735
728
|
],
|
|
736
729
|
"flags": {
|
|
737
730
|
"json": {
|
|
@@ -746,11 +739,18 @@
|
|
|
746
739
|
"name": "yes",
|
|
747
740
|
"allowNo": false,
|
|
748
741
|
"type": "boolean"
|
|
742
|
+
},
|
|
743
|
+
"sequence-id": {
|
|
744
|
+
"description": "Limit output to a single active sequence by ID (default: all active sequences)",
|
|
745
|
+
"name": "sequence-id",
|
|
746
|
+
"hasDynamicHelp": false,
|
|
747
|
+
"multiple": false,
|
|
748
|
+
"type": "option"
|
|
749
749
|
}
|
|
750
750
|
},
|
|
751
751
|
"hasDynamicHelp": false,
|
|
752
752
|
"hiddenAliases": [],
|
|
753
|
-
"id": "
|
|
753
|
+
"id": "sdk",
|
|
754
754
|
"pluginAlias": "@mailmodo/cli",
|
|
755
755
|
"pluginName": "@mailmodo/cli",
|
|
756
756
|
"pluginType": "core",
|
|
@@ -760,10 +760,10 @@
|
|
|
760
760
|
"relativePath": [
|
|
761
761
|
"dist",
|
|
762
762
|
"commands",
|
|
763
|
-
"
|
|
763
|
+
"sdk",
|
|
764
764
|
"index.js"
|
|
765
765
|
]
|
|
766
766
|
}
|
|
767
767
|
},
|
|
768
|
-
"version": "0.0.54-beta.pr56.
|
|
768
|
+
"version": "0.0.54-beta.pr56.91"
|
|
769
769
|
}
|
package/package.json
CHANGED