@mailmodo/cli 0.0.30-beta.pr32.50 → 0.0.30-beta.pr32.51

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.
@@ -62,7 +62,8 @@ export default class Deploy extends BaseCommand {
62
62
  async buildDeployPayload(yamlConfig) {
63
63
  const emailsWithHtml = await Promise.all(yamlConfig.emails.map(async (email) => {
64
64
  const html = (await loadTemplate(`${email.id}.html`)) || '';
65
- return { ...this.mapEmailToPayload(email), html, plainHtml: html };
65
+ const plainHtml = (await loadTemplate(`${email.id}_plain.html`)) || html;
66
+ return { ...this.mapEmailToPayload(email), html, plainHtml };
66
67
  }));
67
68
  return {
68
69
  ...this.buildProjectPayload(yamlConfig.project),
@@ -3,7 +3,7 @@ import { confirm, 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 } from '../../lib/constants.js';
6
- import { loadTemplate, saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
6
+ import { loadTemplate, resolveTemplateFilename, saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
7
7
  export default class Edit extends BaseCommand {
8
8
  static args = {
9
9
  id: Args.string({
@@ -30,10 +30,13 @@ export default class Edit extends BaseCommand {
30
30
  if (emailIndex === -1) {
31
31
  this.error(`Email '${args.id}' not found in mailmodo.yaml.`);
32
32
  }
33
+ const email = yamlConfig.emails[emailIndex];
34
+ const templateFilename = resolveTemplateFilename(email.id, email.style, yamlConfig.project?.emailStyle);
33
35
  const ctx = {
34
- email: yamlConfig.emails[emailIndex],
36
+ email,
35
37
  emailIndex,
36
- templateHtml: await loadTemplate(`${yamlConfig.emails[emailIndex].id}.html`),
38
+ templateFilename,
39
+ templateHtml: await loadTemplate(templateFilename),
37
40
  yamlConfig,
38
41
  };
39
42
  const editFlags = {
@@ -119,7 +122,7 @@ export default class Edit extends BaseCommand {
119
122
  updatedYaml.emails[ctx.emailIndex] = ctx.email;
120
123
  await saveYaml(updatedYaml);
121
124
  if (updated.html) {
122
- await saveTemplate(`${ctx.email.id}.html`, updated.html);
125
+ await saveTemplate(ctx.templateFilename, updated.html);
123
126
  }
124
127
  }
125
128
  logJsonResult(email, updated, oldSubject) {
@@ -139,7 +139,7 @@ export default class Init extends BaseCommand {
139
139
  project: {
140
140
  brandColor: analysisPayload.brand?.color || DEFAULT_BRAND_COLOR,
141
141
  description: analysisPayload.description,
142
- emailStyle: 'branded',
142
+ emailStyle: 'plain',
143
143
  fromEmail: '',
144
144
  fromName: `Team ${analysisPayload.productName}`,
145
145
  logoUrl: analysisPayload.brand?.logoUrl || '',
@@ -4,7 +4,7 @@ import chalk from 'chalk';
4
4
  import open from 'open';
5
5
  import { BaseCommand } from '../../lib/base-command.js';
6
6
  import { API_ENDPOINTS, PREVIEW_PORT } from '../../lib/constants.js';
7
- import { loadTemplate } from '../../lib/yaml-config.js';
7
+ import { loadTemplate, resolveTemplateFilename, } from '../../lib/yaml-config.js';
8
8
  /* eslint-disable camelcase */
9
9
  const SAMPLE_DATA = Object.freeze({
10
10
  app_url: 'https://yourapp.com',
@@ -84,7 +84,7 @@ export default class Preview extends BaseCommand {
84
84
  app_url: yamlConfig.project?.url || 'https://yourapp.com', // eslint-disable-line camelcase
85
85
  product_name: yamlConfig.project?.name || 'YourApp', // eslint-disable-line camelcase
86
86
  };
87
- const templateHtml = await loadTemplate(`${email.id}.html`);
87
+ const templateHtml = await loadTemplate(resolveTemplateFilename(email.id, email.style, yamlConfig.project?.emailStyle));
88
88
  if (flags.send) {
89
89
  const rendered = templateHtml
90
90
  ? renderTemplate(templateHtml, sampleData)
@@ -68,3 +68,4 @@ export declare function saveTemplate(filename: string, html: string, cwd?: strin
68
68
  * or null if the file doesn't exist or can't be read.
69
69
  */
70
70
  export declare function loadTemplate(filename: string, cwd?: string): Promise<null | string>;
71
+ export declare function resolveTemplateFilename(emailId: string, emailStyle?: 'branded' | 'plain', projectStyle?: 'branded' | 'plain'): string;
@@ -72,3 +72,7 @@ export async function loadTemplate(filename, cwd) {
72
72
  return null;
73
73
  }
74
74
  }
75
+ export function resolveTemplateFilename(emailId, emailStyle, projectStyle) {
76
+ const style = emailStyle ?? projectStyle ?? 'branded';
77
+ return style === 'plain' ? `${emailId}_plain.html` : `${emailId}.html`;
78
+ }
@@ -228,13 +228,19 @@
228
228
  "index.js"
229
229
  ]
230
230
  },
231
- "emails": {
231
+ "edit": {
232
232
  "aliases": [],
233
- "args": {},
234
- "description": "List and view configured email sequences",
233
+ "args": {
234
+ "id": {
235
+ "description": "Email template ID to edit",
236
+ "name": "id",
237
+ "required": true
238
+ }
239
+ },
240
+ "description": "Edit an email using AI-assisted natural language changes",
235
241
  "examples": [
236
- "<%= config.bin %> emails",
237
- "<%= config.bin %> emails --json"
242
+ "<%= config.bin %> edit welcome",
243
+ "<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
238
244
  ],
239
245
  "flags": {
240
246
  "json": {
@@ -249,11 +255,18 @@
249
255
  "name": "yes",
250
256
  "allowNo": false,
251
257
  "type": "boolean"
258
+ },
259
+ "change": {
260
+ "description": "Natural language description of the change",
261
+ "name": "change",
262
+ "hasDynamicHelp": false,
263
+ "multiple": false,
264
+ "type": "option"
252
265
  }
253
266
  },
254
267
  "hasDynamicHelp": false,
255
268
  "hiddenAliases": [],
256
- "id": "emails",
269
+ "id": "edit",
257
270
  "pluginAlias": "@mailmodo/cli",
258
271
  "pluginName": "@mailmodo/cli",
259
272
  "pluginType": "core",
@@ -263,23 +276,17 @@
263
276
  "relativePath": [
264
277
  "dist",
265
278
  "commands",
266
- "emails",
279
+ "edit",
267
280
  "index.js"
268
281
  ]
269
282
  },
270
- "edit": {
283
+ "emails": {
271
284
  "aliases": [],
272
- "args": {
273
- "id": {
274
- "description": "Email template ID to edit",
275
- "name": "id",
276
- "required": true
277
- }
278
- },
279
- "description": "Edit an email using AI-assisted natural language changes",
285
+ "args": {},
286
+ "description": "List and view configured email sequences",
280
287
  "examples": [
281
- "<%= config.bin %> edit welcome",
282
- "<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
288
+ "<%= config.bin %> emails",
289
+ "<%= config.bin %> emails --json"
283
290
  ],
284
291
  "flags": {
285
292
  "json": {
@@ -294,18 +301,11 @@
294
301
  "name": "yes",
295
302
  "allowNo": false,
296
303
  "type": "boolean"
297
- },
298
- "change": {
299
- "description": "Natural language description of the change",
300
- "name": "change",
301
- "hasDynamicHelp": false,
302
- "multiple": false,
303
- "type": "option"
304
304
  }
305
305
  },
306
306
  "hasDynamicHelp": false,
307
307
  "hiddenAliases": [],
308
- "id": "edit",
308
+ "id": "emails",
309
309
  "pluginAlias": "@mailmodo/cli",
310
310
  "pluginName": "@mailmodo/cli",
311
311
  "pluginType": "core",
@@ -315,7 +315,7 @@
315
315
  "relativePath": [
316
316
  "dist",
317
317
  "commands",
318
- "edit",
318
+ "emails",
319
319
  "index.js"
320
320
  ]
321
321
  },
@@ -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.30-beta.pr32.50"
660
+ "version": "0.0.30-beta.pr32.51"
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.30-beta.pr32.50",
4
+ "version": "0.0.30-beta.pr32.51",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"