@mailmodo/cli 0.0.52 → 0.0.53

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,14 +4,7 @@ import chalk from 'chalk';
4
4
  import { BaseCommand } from '../../lib/base-command.js';
5
5
  import { API_ENDPOINTS, DEFAULT_BRAND_COLOR } from '../../lib/constants.js';
6
6
  import { loadYaml, saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
7
- function isValidUrl(value) {
8
- try {
9
- return Boolean(new URL(value));
10
- }
11
- catch {
12
- return false;
13
- }
14
- }
7
+ import { isValidUrl, normalizeTrigger } from '../../lib/utils.js';
15
8
  /**
16
9
  * Prints the human-readable analysis summary using the provided line writer.
17
10
  * Use stderr when `--json` is set so stdout stays free for machine-readable JSON.
@@ -124,7 +117,7 @@ export default class Init extends BaseCommand {
124
117
  return {
125
118
  delay: rec.delay || '0',
126
119
  id: rec.id,
127
- trigger: rec.trigger,
120
+ trigger: normalizeTrigger(rec.trigger, analysisPayload.productName),
128
121
  ...(rec.condition ? { condition: rec.condition } : {}),
129
122
  subject: generated?.subject || `Email for ${rec.id}`,
130
123
  template: `mailmodo/${rec.id}.html`,
@@ -7,6 +7,7 @@ import { resolve } from 'node:path';
7
7
  import { BaseCommand, FREE_TIER } from '../../lib/base-command.js';
8
8
  import { API_ENDPOINTS } from '../../lib/constants.js';
9
9
  import { INFO } from '../../lib/messages.js';
10
+ import { settingKeyToProp } from '../../lib/utils.js';
10
11
  import { saveYaml } from '../../lib/yaml-config.js';
11
12
  const SETTINGS_GROUPS = Object.freeze({
12
13
  billing: ['monthly_cap'],
@@ -20,16 +21,6 @@ const SETUP_HINTS = {
20
21
  domain: "'mailmodo domain'",
21
22
  monthlyCap: "'mailmodo billing --cap <n>'",
22
23
  };
23
- /**
24
- * Converts a user-facing snake_case YAML setting key to its
25
- * corresponding camelCase TypeScript property name.
26
- *
27
- * @param {string} key - A snake_case setting key (e.g., "brand_color").
28
- * @returns {string} The camelCase property name (e.g., "brandColor").
29
- */
30
- function settingKeyToProp(key) {
31
- return key.replaceAll(/_([a-z])/g, (_, letter) => letter.toUpperCase());
32
- }
33
24
  export default class Settings extends BaseCommand {
34
25
  static description = 'View and update project settings';
35
26
  static examples = [
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Converts a user-facing snake_case YAML setting key to its
3
+ * corresponding camelCase TypeScript property name.
4
+ *
5
+ * @param {string} key - A snake_case setting key (e.g., "brand_color").
6
+ * @returns {string} The camelCase property name (e.g., "brandColor").
7
+ */
8
+ export declare function settingKeyToProp(key: string): string;
9
+ export declare function generateTriggerPrefix(productName: string): string;
10
+ export declare function normalizeTrigger(trigger: string, productName: string): string;
11
+ export declare function isValidUrl(value: string): boolean;
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Converts a user-facing snake_case YAML setting key to its
3
+ * corresponding camelCase TypeScript property name.
4
+ *
5
+ * @param {string} key - A snake_case setting key (e.g., "brand_color").
6
+ * @returns {string} The camelCase property name (e.g., "brandColor").
7
+ */
8
+ export function settingKeyToProp(key) {
9
+ return key.replaceAll(/_([a-z])/g, (_, letter) => letter.toUpperCase());
10
+ }
11
+ function toCamelCaseAlnum(input) {
12
+ const parts = input
13
+ .trim()
14
+ .split(/[^a-zA-Z0-9]+/)
15
+ .filter(Boolean);
16
+ if (parts.length === 0)
17
+ return '';
18
+ return (parts[0].toLowerCase() +
19
+ parts
20
+ .slice(1)
21
+ .map((p) => p.charAt(0).toUpperCase() + p.slice(1).toLowerCase())
22
+ .join(''));
23
+ }
24
+ export function generateTriggerPrefix(productName) {
25
+ return `${toCamelCaseAlnum(productName)}$`;
26
+ }
27
+ export function normalizeTrigger(trigger, productName) {
28
+ const prefix = generateTriggerPrefix(productName);
29
+ const dollarIdx = trigger.indexOf('$');
30
+ const eventName = dollarIdx === -1 ? trigger : trigger.slice(dollarIdx + 1);
31
+ return prefix + eventName;
32
+ }
33
+ export function isValidUrl(value) {
34
+ try {
35
+ return Boolean(new URL(value));
36
+ }
37
+ catch {
38
+ return false;
39
+ }
40
+ }
@@ -426,45 +426,6 @@
426
426
  "index.js"
427
427
  ]
428
428
  },
429
- "login": {
430
- "aliases": [],
431
- "args": {},
432
- "description": "Authenticate with Mailmodo using your API key",
433
- "examples": [
434
- "<%= config.bin %> login",
435
- "MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
436
- ],
437
- "flags": {
438
- "json": {
439
- "description": "Output as JSON",
440
- "name": "json",
441
- "allowNo": false,
442
- "type": "boolean"
443
- },
444
- "yes": {
445
- "char": "y",
446
- "description": "Skip confirmation prompts",
447
- "name": "yes",
448
- "allowNo": false,
449
- "type": "boolean"
450
- }
451
- },
452
- "hasDynamicHelp": false,
453
- "hiddenAliases": [],
454
- "id": "login",
455
- "pluginAlias": "@mailmodo/cli",
456
- "pluginName": "@mailmodo/cli",
457
- "pluginType": "core",
458
- "strict": true,
459
- "enableJsonFlag": false,
460
- "isESM": true,
461
- "relativePath": [
462
- "dist",
463
- "commands",
464
- "login",
465
- "index.js"
466
- ]
467
- },
468
429
  "logout": {
469
430
  "aliases": [],
470
431
  "args": {},
@@ -631,6 +592,45 @@
631
592
  "index.js"
632
593
  ]
633
594
  },
595
+ "login": {
596
+ "aliases": [],
597
+ "args": {},
598
+ "description": "Authenticate with Mailmodo using your API key",
599
+ "examples": [
600
+ "<%= config.bin %> login",
601
+ "MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
602
+ ],
603
+ "flags": {
604
+ "json": {
605
+ "description": "Output as JSON",
606
+ "name": "json",
607
+ "allowNo": false,
608
+ "type": "boolean"
609
+ },
610
+ "yes": {
611
+ "char": "y",
612
+ "description": "Skip confirmation prompts",
613
+ "name": "yes",
614
+ "allowNo": false,
615
+ "type": "boolean"
616
+ }
617
+ },
618
+ "hasDynamicHelp": false,
619
+ "hiddenAliases": [],
620
+ "id": "login",
621
+ "pluginAlias": "@mailmodo/cli",
622
+ "pluginName": "@mailmodo/cli",
623
+ "pluginType": "core",
624
+ "strict": true,
625
+ "enableJsonFlag": false,
626
+ "isESM": true,
627
+ "relativePath": [
628
+ "dist",
629
+ "commands",
630
+ "login",
631
+ "index.js"
632
+ ]
633
+ },
634
634
  "settings": {
635
635
  "aliases": [],
636
636
  "args": {},
@@ -718,5 +718,5 @@
718
718
  ]
719
719
  }
720
720
  },
721
- "version": "0.0.52"
721
+ "version": "0.0.53"
722
722
  }
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.52",
4
+ "version": "0.0.53",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"