@mailmodo/cli 0.0.54-beta.pr56.89 → 0.0.54-beta.pr56.90

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
  }
@@ -137,15 +137,13 @@
137
137
  "index.js"
138
138
  ]
139
139
  },
140
- "contacts": {
140
+ "deployments": {
141
141
  "aliases": [],
142
142
  "args": {},
143
- "description": "Manage contacts search, export, or delete",
143
+ "description": "List every deployed sequence on this account, with the IDs needed for deploy --pause / --resume",
144
144
  "examples": [
145
- "<%= config.bin %> contacts",
146
- "<%= config.bin %> contacts --search sarah@example.com",
147
- "<%= config.bin %> contacts --export # GDPR CSV → contacts.csv",
148
- "<%= config.bin %> contacts --delete sarah@example.com"
145
+ "<%= config.bin %> deployments",
146
+ "<%= config.bin %> deployments --json"
149
147
  ],
150
148
  "flags": {
151
149
  "json": {
@@ -160,31 +158,11 @@
160
158
  "name": "yes",
161
159
  "allowNo": false,
162
160
  "type": "boolean"
163
- },
164
- "delete": {
165
- "description": "GDPR hard delete a contact by email",
166
- "name": "delete",
167
- "hasDynamicHelp": false,
168
- "multiple": false,
169
- "type": "option"
170
- },
171
- "export": {
172
- "description": "Export all contacts as GDPR-compliant CSV (writes contacts.csv in the current directory)",
173
- "name": "export",
174
- "allowNo": false,
175
- "type": "boolean"
176
- },
177
- "search": {
178
- "description": "Search for a contact by email",
179
- "name": "search",
180
- "hasDynamicHelp": false,
181
- "multiple": false,
182
- "type": "option"
183
161
  }
184
162
  },
185
163
  "hasDynamicHelp": false,
186
164
  "hiddenAliases": [],
187
- "id": "contacts",
165
+ "id": "deployments",
188
166
  "pluginAlias": "@mailmodo/cli",
189
167
  "pluginName": "@mailmodo/cli",
190
168
  "pluginType": "core",
@@ -194,17 +172,19 @@
194
172
  "relativePath": [
195
173
  "dist",
196
174
  "commands",
197
- "contacts",
175
+ "deployments",
198
176
  "index.js"
199
177
  ]
200
178
  },
201
- "deployments": {
179
+ "contacts": {
202
180
  "aliases": [],
203
181
  "args": {},
204
- "description": "List every deployed sequence on this account, with the IDs needed for deploy --pause / --resume",
182
+ "description": "Manage contacts search, export, or delete",
205
183
  "examples": [
206
- "<%= config.bin %> deployments",
207
- "<%= config.bin %> deployments --json"
184
+ "<%= config.bin %> contacts",
185
+ "<%= config.bin %> contacts --search sarah@example.com",
186
+ "<%= config.bin %> contacts --export # GDPR CSV → contacts.csv",
187
+ "<%= config.bin %> contacts --delete sarah@example.com"
208
188
  ],
209
189
  "flags": {
210
190
  "json": {
@@ -219,11 +199,31 @@
219
199
  "name": "yes",
220
200
  "allowNo": false,
221
201
  "type": "boolean"
202
+ },
203
+ "delete": {
204
+ "description": "GDPR hard delete a contact by email",
205
+ "name": "delete",
206
+ "hasDynamicHelp": false,
207
+ "multiple": false,
208
+ "type": "option"
209
+ },
210
+ "export": {
211
+ "description": "Export all contacts as GDPR-compliant CSV (writes contacts.csv in the current directory)",
212
+ "name": "export",
213
+ "allowNo": false,
214
+ "type": "boolean"
215
+ },
216
+ "search": {
217
+ "description": "Search for a contact by email",
218
+ "name": "search",
219
+ "hasDynamicHelp": false,
220
+ "multiple": false,
221
+ "type": "option"
222
222
  }
223
223
  },
224
224
  "hasDynamicHelp": false,
225
225
  "hiddenAliases": [],
226
- "id": "deployments",
226
+ "id": "contacts",
227
227
  "pluginAlias": "@mailmodo/cli",
228
228
  "pluginName": "@mailmodo/cli",
229
229
  "pluginType": "core",
@@ -233,7 +233,7 @@
233
233
  "relativePath": [
234
234
  "dist",
235
235
  "commands",
236
- "deployments",
236
+ "contacts",
237
237
  "index.js"
238
238
  ]
239
239
  },
@@ -289,13 +289,19 @@
289
289
  "index.js"
290
290
  ]
291
291
  },
292
- "emails": {
292
+ "edit": {
293
293
  "aliases": [],
294
- "args": {},
295
- "description": "List and view configured email sequences",
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 %> emails",
298
- "<%= config.bin %> emails --json"
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": "emails",
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
- "emails",
340
+ "edit",
328
341
  "index.js"
329
342
  ]
330
343
  },
331
- "edit": {
344
+ "emails": {
332
345
  "aliases": [],
333
- "args": {
334
- "id": {
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 %> edit welcome",
343
- "<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
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": "edit",
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
- "edit",
379
+ "emails",
380
380
  "index.js"
381
381
  ]
382
382
  },
@@ -765,5 +765,5 @@
765
765
  ]
766
766
  }
767
767
  },
768
- "version": "0.0.54-beta.pr56.89"
768
+ "version": "0.0.54-beta.pr56.90"
769
769
  }
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.54-beta.pr56.89",
4
+ "version": "0.0.54-beta.pr56.90",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"