@mailmodo/cli 0.0.56-beta.pr58.94 → 0.0.56-beta.pr58.95

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.
@@ -42,12 +42,12 @@ export function buildDiffPreview(email, updated, templateHtml) {
42
42
  diff.subject = subjectChanged
43
43
  ? { new: updated.subject, old: email.subject }
44
44
  : { unchanged: true, value: email.subject };
45
- if (email.previewText ?? updated.previewText) {
45
+ if (email.previewText || updated.previewText) {
46
46
  diff.previewText = previewChanged
47
47
  ? { new: updated.previewText, old: email.previewText }
48
48
  : { unchanged: true, value: email.previewText };
49
49
  }
50
- if (templateHtml ?? updated.html) {
50
+ if (templateHtml || updated.html) {
51
51
  const oldText = templateHtml
52
52
  ? truncate(stripHtml(templateHtml), 500)
53
53
  : null;
@@ -22,11 +22,11 @@ async function persistChanges(ctx, editCtx, updated) {
22
22
  await ctx.syncYaml();
23
23
  await ctx.syncTemplate(editCtx.email.id);
24
24
  }
25
- function logJsonResult(ctx, email, updated, oldSubject) {
25
+ function logJsonResult(ctx, email, updated, oldSubject, oldPreviewText) {
26
26
  ctx.log(JSON.stringify({
27
27
  diff: {
28
- previewText: updated.previewText && updated.previewText !== email.previewText
29
- ? { new: updated.previewText, old: email.previewText }
28
+ previewText: updated.previewText && updated.previewText !== oldPreviewText
29
+ ? { new: updated.previewText, old: oldPreviewText }
30
30
  : undefined,
31
31
  subject: oldSubject === email.subject
32
32
  ? undefined
@@ -52,10 +52,11 @@ async function handleAcceptOutput(ctx, email) {
52
52
  export async function finalizeEdit(ctx, editCtx, opts) {
53
53
  const { flags, updated } = opts;
54
54
  const oldSubject = editCtx.email.subject;
55
+ const oldPreviewText = editCtx.email.previewText;
55
56
  applyEmailChanges(editCtx.email, updated);
56
57
  await persistChanges(ctx, editCtx, updated);
57
58
  if (flags.json) {
58
- logJsonResult(ctx, editCtx.email, updated, oldSubject);
59
+ logJsonResult(ctx, editCtx.email, updated, oldSubject, oldPreviewText);
59
60
  }
60
61
  else if (flags.yes) {
61
62
  ctx.log(`\n Updated ${chalk.green('mailmodo.yaml')}\n`);
@@ -27,7 +27,7 @@ export async function openTemplateInEditor(ctx, template) {
27
27
  stdio: 'inherit',
28
28
  });
29
29
  child.on('error', () => resolve(false));
30
- child.on('close', () => resolve(true));
30
+ child.on('close', (code) => resolve(code === 0));
31
31
  });
32
32
  if (launched)
33
33
  return;
@@ -4,8 +4,12 @@ import { API_ENDPOINTS } from '../../constants.js';
4
4
  import { isValidUrl } from '../../utils.js';
5
5
  import { logAnalysisSummary } from './output.js';
6
6
  export async function promptProductUrl(flagUrl) {
7
- if (flagUrl)
7
+ if (flagUrl) {
8
+ if (!isValidUrl(flagUrl)) {
9
+ throw new Error(`Invalid URL: "${flagUrl}". Please enter a valid URL (e.g., https://myapp.com)`);
10
+ }
8
11
  return flagUrl;
12
+ }
9
13
  return input({
10
14
  message: 'What is your product URL?',
11
15
  validate(value) {
@@ -465,6 +465,44 @@
465
465
  "index.js"
466
466
  ]
467
467
  },
468
+ "logout": {
469
+ "aliases": [],
470
+ "args": {},
471
+ "description": "Sign out by removing saved credentials from this machine",
472
+ "examples": [
473
+ "<%= config.bin %> logout"
474
+ ],
475
+ "flags": {
476
+ "json": {
477
+ "description": "Output as JSON",
478
+ "name": "json",
479
+ "allowNo": false,
480
+ "type": "boolean"
481
+ },
482
+ "yes": {
483
+ "char": "y",
484
+ "description": "Skip confirmation prompts",
485
+ "name": "yes",
486
+ "allowNo": false,
487
+ "type": "boolean"
488
+ }
489
+ },
490
+ "hasDynamicHelp": false,
491
+ "hiddenAliases": [],
492
+ "id": "logout",
493
+ "pluginAlias": "@mailmodo/cli",
494
+ "pluginName": "@mailmodo/cli",
495
+ "pluginType": "core",
496
+ "strict": true,
497
+ "enableJsonFlag": false,
498
+ "isESM": true,
499
+ "relativePath": [
500
+ "dist",
501
+ "commands",
502
+ "logout",
503
+ "index.js"
504
+ ]
505
+ },
468
506
  "logs": {
469
507
  "aliases": [],
470
508
  "args": {},
@@ -725,45 +763,7 @@
725
763
  "status",
726
764
  "index.js"
727
765
  ]
728
- },
729
- "logout": {
730
- "aliases": [],
731
- "args": {},
732
- "description": "Sign out by removing saved credentials from this machine",
733
- "examples": [
734
- "<%= config.bin %> logout"
735
- ],
736
- "flags": {
737
- "json": {
738
- "description": "Output as JSON",
739
- "name": "json",
740
- "allowNo": false,
741
- "type": "boolean"
742
- },
743
- "yes": {
744
- "char": "y",
745
- "description": "Skip confirmation prompts",
746
- "name": "yes",
747
- "allowNo": false,
748
- "type": "boolean"
749
- }
750
- },
751
- "hasDynamicHelp": false,
752
- "hiddenAliases": [],
753
- "id": "logout",
754
- "pluginAlias": "@mailmodo/cli",
755
- "pluginName": "@mailmodo/cli",
756
- "pluginType": "core",
757
- "strict": true,
758
- "enableJsonFlag": false,
759
- "isESM": true,
760
- "relativePath": [
761
- "dist",
762
- "commands",
763
- "logout",
764
- "index.js"
765
- ]
766
766
  }
767
767
  },
768
- "version": "0.0.56-beta.pr58.94"
768
+ "version": "0.0.56-beta.pr58.95"
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.56-beta.pr58.94",
4
+ "version": "0.0.56-beta.pr58.95",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"