@mailmodo/cli 0.0.58-beta.pr60.110 → 0.0.59-beta.pr61.111

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.
Files changed (3) hide show
  1. package/README.md +771 -69
  2. package/oclif.manifest.json +31 -31
  3. package/package.json +16 -4
package/README.md CHANGED
@@ -1,125 +1,827 @@
1
- # mailmodo-cli
1
+ # @mailmodo/cli
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@mailmodo/cli.svg)](https://www.npmjs.com/package/@mailmodo/cli)
4
+ [![npm downloads](https://img.shields.io/npm/dm/@mailmodo/cli.svg)](https://www.npmjs.com/package/@mailmodo/cli)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
6
+ [![Node.js >= 18](https://img.shields.io/badge/node-%3E%3D18.0.0-brightgreen.svg)](https://nodejs.org/)
7
+
8
+ **Email lifecycle automation for the AI-native builder generation.**
9
+
10
+ `@mailmodo/cli` is a command-line tool that analyzes your product, generates a full onboarding and lifecycle email sequence using AI, and deploys it — all from your terminal. It manages everything from domain setup and HTML template generation to live deployment, performance monitoring, and contact management.
11
+
12
+ ---
13
+
14
+ ## Table of Contents
15
+
16
+ - [Installation](#installation)
17
+ - [Quick Start](#quick-start)
18
+ - [Commands Reference](#commands-reference)
19
+ - [login](#login)
20
+ - [logout](#logout)
21
+ - [init](#init)
22
+ - [emails](#emails)
23
+ - [edit](#edit)
24
+ - [preview](#preview)
25
+ - [deploy](#deploy)
26
+ - [deployments](#deployments)
27
+ - [sdk](#sdk)
28
+ - [domain](#domain)
29
+ - [settings](#settings)
30
+ - [status](#status)
31
+ - [logs](#logs)
32
+ - [contacts](#contacts)
33
+ - [billing](#billing)
34
+ - [report](#report)
35
+ - [SDK / App Integration](#sdk--app-integration)
36
+ - [Configuration](#configuration)
37
+ - [AI Agent Support](#ai-agent-support)
38
+ - [Contributing](#contributing)
39
+
40
+ ---
41
+
42
+ ## Installation
43
+
44
+ ```bash
45
+ npm install -g @mailmodo/cli
46
+ ```
2
47
 
3
- Email lifecycle automation for the AI-native builder generation.
48
+ Requires **Node.js >= 18**.
4
49
 
5
- ## Prerequisites
50
+ Verify the installation:
6
51
 
7
- - **Node.js** v24.14.1
52
+ ```bash
53
+ mailmodo --version
54
+ mailmodo --help
55
+ ```
8
56
 
9
- ## Setup
57
+ ---
10
58
 
11
- ```sh
12
- git clone https://github.com/Mailmodo/mailmodo-cli.git
13
- cd mailmodo-cli
14
- npm install
59
+ ## Quick Start
60
+
61
+ The primary workflow from zero to deployed email sequence:
62
+
63
+ **1. Authenticate**
64
+
65
+ ```bash
66
+ mailmodo login
15
67
  ```
16
68
 
17
- ## Development
69
+ You will be prompted to enter your Mailmodo API key. Get one at [app.mailmodo.dev](https://app.mailmodo.dev).
18
70
 
19
- ### Run in dev mode (without building)
71
+ **2. Analyze your product and generate emails**
20
72
 
21
- ```sh
22
- node ./bin/run.js <command>
73
+ ```bash
74
+ mailmodo init --url https://yourapp.com
23
75
  ```
24
76
 
25
- Example:
77
+ The CLI scrapes your product URL, detects your business model, and generates a full email sequence with HTML templates. A `mailmodo.yaml` config file and a `mailmodo/` directory of HTML templates are created in your current working directory.
26
78
 
27
- ```sh
28
- node ./bin/run.js signup
79
+ **3. Preview an email**
80
+
81
+ ```bash
82
+ mailmodo preview welcome
29
83
  ```
30
84
 
31
- ### Build the project
85
+ Opens a local preview server in your browser. Use `--send me@example.com` to send yourself a test.
32
86
 
33
- ```sh
34
- npm run build
87
+ **4. Set up your sending domain**
88
+
89
+ ```bash
90
+ mailmodo domain
91
+ ```
92
+
93
+ Follow the prompts to register your domain and sender details. The CLI displays the DNS records you need to add. Verify once propagated:
94
+
95
+ ```bash
96
+ mailmodo domain --verify
97
+ ```
98
+
99
+ **5. Deploy**
100
+
101
+ ```bash
102
+ mailmodo deploy
103
+ ```
104
+
105
+ Validates your configuration, deploys all email sequences, and prints the `track()` and `identify()` SDK snippets to wire into your app.
106
+
107
+ **6. Monitor**
108
+
109
+ ```bash
110
+ mailmodo status # quota usage and per-email metrics
111
+ mailmodo logs # delivery event log
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Commands Reference
117
+
118
+ All commands support two universal flags:
119
+
120
+ | Flag | Alias | Description |
121
+ | -------- | ----- | -------------------------------------------------------------- |
122
+ | `--json` | | Output as machine-readable JSON instead of formatted text |
123
+ | `--yes` | `-y` | Skip all confirmation prompts (non-interactive / scripted use) |
124
+
125
+ ---
126
+
127
+ ### login
128
+
129
+ Authenticate with Mailmodo using your API key.
130
+
131
+ ```bash
132
+ mailmodo login
35
133
  ```
36
134
 
37
- ### Run after build
135
+ Validates your API key against the Mailmodo API, saves credentials to `~/.mailmodo/config`, and performs a silent cloud backup of any existing `mailmodo.yaml`. If credentials are already saved, displays current account status.
136
+
137
+ **Environment variable shortcut (for CI/CD):**
138
+
139
+ ```bash
140
+ # Linux / macOS
141
+ MAILMODO_API_KEY=your_key mailmodo login
142
+
143
+ # Windows PowerShell
144
+ $env:MAILMODO_API_KEY="your_key"; mailmodo login
38
145
 
39
- ```sh
40
- ./bin/run.js <command>
146
+ # Windows CMD
147
+ set MAILMODO_API_KEY=your_key && mailmodo login
41
148
  ```
42
149
 
43
- ### Link globally for local testing
150
+ **JSON output shape:**
151
+
152
+ ```json
153
+ {
154
+ "status": "logged_in",
155
+ "email": "you@example.com",
156
+ "plan": "free",
157
+ "totalFreeRemaining": 500,
158
+ "paidEmailsRemaining": 0,
159
+ "yamlRestored": false
160
+ }
161
+ ```
162
+
163
+ ---
44
164
 
45
- This registers the `mailmodo` binary on your system so you can use it from anywhere:
165
+ ### logout
46
166
 
47
- ```sh
48
- npm link
167
+ Remove saved credentials from this machine.
168
+
169
+ ```bash
170
+ mailmodo logout
49
171
  ```
50
172
 
51
- Then run commands directly:
173
+ Deletes `~/.mailmodo/config`. Does not affect the server-side account.
174
+
175
+ **JSON output shape:**
52
176
 
53
- ```sh
54
- mailmodo signup
177
+ ```json
178
+ { "status": "logged_out" }
55
179
  ```
56
180
 
57
- To unlink:
181
+ ---
58
182
 
59
- ```sh
60
- npm unlink -g @mailmodo/cli
183
+ ### init
184
+
185
+ Analyze your product and generate a full email sequence.
186
+
187
+ ```bash
188
+ mailmodo init
189
+ mailmodo init --url https://yourapp.com
190
+ mailmodo init --url https://yourapp.com --yes
61
191
  ```
62
192
 
63
- ## Commands
193
+ | Flag | Type | Description |
194
+ | ------- | ------ | ---------------------------------------------------------- |
195
+ | `--url` | string | Product URL to analyze (prompted interactively if omitted) |
196
+
197
+ What `init` does:
64
198
 
65
- ### `mailmodo signup`
199
+ 1. Calls the Mailmodo AI to analyze your product URL and detect business model, target user, SaaS model, and brand details.
200
+ 2. Generates email copy and HTML templates for a complete lifecycle sequence (welcome, onboarding, trial expiry, etc.).
201
+ 3. Writes `mailmodo.yaml` to the current directory.
202
+ 4. Creates a `mailmodo/` directory containing one `.html` file per email.
203
+ 5. Silently backs up the config and templates to the cloud.
66
204
 
67
- Sign up for Mailmodo. Prompts for an email address interactively.
205
+ **JSON output shape:**
68
206
 
69
- ```sh
70
- mailmodo signup
207
+ ```json
208
+ {
209
+ "brand": { "name": "...", "color": "...", "url": "..." },
210
+ "emailConfigs": [...],
211
+ "emailStyle": "branded",
212
+ "monthlyCap": 5
213
+ }
71
214
  ```
72
215
 
73
- ### `mailmodo help [COMMAND]`
216
+ ---
74
217
 
75
- Display help for any command.
218
+ ### emails
76
219
 
77
- ```sh
78
- mailmodo help
79
- mailmodo help signup
220
+ List and inspect your configured email sequences.
221
+
222
+ ```bash
223
+ mailmodo emails
224
+ mailmodo emails --json
80
225
  ```
81
226
 
82
- ## Scripts
227
+ Reads `mailmodo.yaml` locally and displays a table of all configured emails: ID, trigger event, delay, and subject. In interactive mode, you can select any email to view its full details or open the template in your editor.
228
+
229
+ **JSON output shape:**
230
+
231
+ ```json
232
+ {
233
+ "emails": [
234
+ {
235
+ "id": "welcome",
236
+ "trigger": "user.signup",
237
+ "delay": 0,
238
+ "subject": "Welcome to MyApp"
239
+ }
240
+ ],
241
+ "total": 4
242
+ }
243
+ ```
83
244
 
84
- | Script | Description |
85
- | --------------- | ------------------------------------ |
86
- | `npm run build` | Clean `dist/` and compile TypeScript |
87
- | `npm run lint` | Run ESLint |
88
- | `npm test` | Run tests with Mocha |
245
+ ---
89
246
 
90
- ## CI/CD & Release Automation
247
+ ### edit
91
248
 
92
- ### Beta releases (on PR)
249
+ Edit an email using AI-assisted natural language changes.
93
250
 
94
- Every time a pull request targeting `main` is opened or updated, a **beta version** is automatically published to npm. A comment is posted on the PR with install instructions:
251
+ ```bash
252
+ mailmodo edit <id>
253
+ mailmodo edit welcome
254
+ mailmodo edit welcome --change "make the subject more urgent"
255
+ mailmodo edit welcome --change "rewrite the body focusing on onboarding" --yes
256
+ ```
95
257
 
96
- ```sh
97
- npm install -g @mailmodo/cli@beta
258
+ | Argument | Description |
259
+ | -------- | ------------------------------------ |
260
+ | `id` | Email template ID to edit (required) |
261
+
262
+ | Flag | Type | Description |
263
+ | ---------- | ------ | ---------------------------------------------------------------------------------- |
264
+ | `--change` | string | Natural language description of what to change (prompted interactively if omitted) |
265
+
266
+ The CLI sends the current template and your change description to the Mailmodo AI, previews the diff (changed vs. unchanged fields), and lets you accept, retry, or skip.
267
+
268
+ **JSON output shape:**
269
+
270
+ Returns the updated email object with a `diff` property showing which fields changed and which were preserved.
271
+
272
+ ---
273
+
274
+ ### preview
275
+
276
+ Preview an email in the browser, as plain text, or send a test.
277
+
278
+ ```bash
279
+ mailmodo preview
280
+ mailmodo preview <id>
281
+ mailmodo preview welcome --text
282
+ mailmodo preview welcome --send me@example.com
98
283
  ```
99
284
 
100
- This lets anyone on the team test the PR changes without checking out the branch locally.
285
+ | Argument | Description |
286
+ | -------- | ---------------------------------------------------------------------------- |
287
+ | `id` | Email template ID (optional; defaults to the first email in `mailmodo.yaml`) |
288
+
289
+ | Flag | Type | Description |
290
+ | -------- | ------- | ---------------------------------------------------------------- |
291
+ | `--text` | boolean | Print a plain-text rendering of the email (useful for AI agents) |
292
+ | `--send` | string | Send a test email to the specified address |
101
293
 
102
- > **Note:** npm publishing requires the `NPM_AUTH_TOKEN_WRITE` secret to be configured in the repo settings. Until then, the publish step will be skipped but all other steps (build, version bump, release) still work.
294
+ In browser mode (default), a local server starts at `http://localhost:3421` and opens your browser.
103
295
 
104
- ### Automatic versioning (on merge)
296
+ ---
105
297
 
106
- When a PR is merged into `main`, the version in `package.json` is bumped automatically, a GitHub Release is created, and the new version is published to npm.
298
+ ### deploy
107
299
 
108
- The bump type is determined by a tag in the **PR title**:
300
+ Deploy, pause, or resume an email sequence.
109
301
 
110
- | PR title contains | Bump type | Example |
111
- | ----------------- | --------- | ----------------- |
112
- | `[major]` | major | `1.2.3` → `2.0.0` |
113
- | `[minor]` | minor | `1.2.3` → `1.3.0` |
114
- | `[patch]` | patch | `1.2.3` → `1.2.4` |
115
- | _(nothing)_ | patch | `1.2.3` → `1.2.4` |
302
+ ```bash
303
+ # Deploy all configured sequences
304
+ mailmodo deploy
305
+ mailmodo deploy --yes
306
+
307
+ # Pause a live sequence
308
+ mailmodo deploy --pause <sequenceId>
309
+
310
+ # Resume a paused sequence
311
+ mailmodo deploy --resume <sequenceId>
312
+ mailmodo deploy --resume <sequenceId> --json
313
+ ```
314
+
315
+ | Flag | Type | Description |
316
+ | ---------- | ------ | ------------------------------------------------------------------------- |
317
+ | `--pause` | string | Pause a deployed sequence by ID (stops all scheduled and triggered sends) |
318
+ | `--resume` | string | Resume a paused sequence by ID |
319
+
320
+ `--pause` and `--resume` are mutually exclusive.
321
+
322
+ **Deploy flow:**
323
+
324
+ 1. Checks domain verification status; runs domain setup if needed.
325
+ 2. Validates your email sequence configuration.
326
+ 3. Shows a pre-deploy summary: domain, sender, email count, and a diff of changes since the last deploy.
327
+ 4. Prompts for confirmation (skipped with `--yes`).
328
+ 5. Deploys and prints the `@mailmodo/sdk` code snippets to add to your app.
329
+
330
+ **Deploy JSON output shape:**
331
+
332
+ ```json
333
+ {
334
+ "deployed": true,
335
+ "emailsLive": 4,
336
+ "sequenceId": "seq_abc123",
337
+ "diff": { "added": [], "changed": [], "removed": [] },
338
+ "sdkSnippet": "..."
339
+ }
340
+ ```
341
+
342
+ **Pause/Resume JSON output shape:**
343
+
344
+ ```json
345
+ {
346
+ "sequenceId": "seq_abc123",
347
+ "status": "paused",
348
+ "alreadyInStatus": false
349
+ }
350
+ ```
351
+
352
+ ---
353
+
354
+ ### deployments
355
+
356
+ List every deployed sequence on this account.
357
+
358
+ ```bash
359
+ mailmodo deployments
360
+ mailmodo deployments --json
361
+ ```
362
+
363
+ Displays a table with product name, status (`active` / `paused`), email count, sequence ID, and last-updated date. The sequence IDs shown here are the values to pass to `deploy --pause` and `deploy --resume`.
364
+
365
+ **JSON output shape:**
366
+
367
+ ```json
368
+ {
369
+ "sequences": [
370
+ {
371
+ "sequenceId": "seq_abc123",
372
+ "product": "MyApp",
373
+ "status": "active",
374
+ "emailCount": 4,
375
+ "updatedAt": "2025-06-01T10:00:00Z"
376
+ }
377
+ ],
378
+ "total": 1
379
+ }
380
+ ```
381
+
382
+ ---
383
+
384
+ ### sdk
385
+
386
+ Show SDK `track()` and `identify()` reference for your deployed sequences.
387
+
388
+ ```bash
389
+ mailmodo sdk
390
+ mailmodo sdk --sequence-id seq_abc123
391
+ mailmodo sdk --json
392
+ ```
393
+
394
+ | Flag | Type | Description |
395
+ | --------------- | ------ | ------------------------------------------------------------------------- |
396
+ | `--sequence-id` | string | Limit output to a specific sequence by ID (default: all active sequences) |
397
+
398
+ Displays the install command, import line, and copy-ready `track()` / `identify()` function calls for each active sequence. See [SDK / App Integration](#sdk--app-integration) for details on using these in your app.
399
+
400
+ ---
401
+
402
+ ### domain
403
+
404
+ Set up and verify your sending domain.
405
+
406
+ ```bash
407
+ # Interactive setup (register domain and get DNS records)
408
+ mailmodo domain
409
+
410
+ # Verify DNS records after adding them
411
+ mailmodo domain --verify
412
+
413
+ # Show domain health metrics
414
+ mailmodo domain --status
415
+ ```
416
+
417
+ | Flag | Type | Description |
418
+ | ---------- | ------- | ----------------------------------------------------------------------- |
419
+ | `--verify` | boolean | Check SPF, DKIM, and DMARC record status |
420
+ | `--status` | boolean | Display domain health metrics (bounce rate, spam rate, verified status) |
421
+
422
+ During setup, you are prompted for: domain, sender email (must be `@<domain>`), from name, reply-to address, and physical business address (required by CAN-SPAM). The CLI outputs the exact DNS records to add to your registrar.
423
+
424
+ > **Note:** DNS changes take 5–30 minutes to propagate before verification will pass.
425
+
426
+ ---
427
+
428
+ ### settings
429
+
430
+ View and update project settings.
431
+
432
+ ```bash
433
+ mailmodo settings
434
+ mailmodo settings --set brand_color=#0F3460
435
+ mailmodo settings --json
436
+ ```
437
+
438
+ | Flag | Type | Description |
439
+ | ------- | ------ | --------------------------------------------- |
440
+ | `--set` | string | Set a single setting using `key=value` syntax |
441
+
442
+ In interactive mode (no flags), displays all settings grouped by category and prompts to edit each one. With `--set`, updates the specified key directly without prompting.
443
+
444
+ **Settable keys:**
445
+
446
+ | Category | Keys |
447
+ | ---------------- | ------------------------------------------------------------------------------- |
448
+ | Project Info | `name`, `url`, `description`, `type`, `targetUser`, `saasModel`, `pricingModel` |
449
+ | Branding | `brand_color`, `email_style` (`plain` \| `branded`), `logo_url`, `logo_file` |
450
+ | Domain / Sending | `domain`, `from_email`, `from_name`, `reply_to`, `address` |
451
+ | Billing | `monthly_cap` (paid tier only), `webhook_url` |
452
+
453
+ ---
454
+
455
+ ### status
456
+
457
+ View email performance metrics and quota usage.
458
+
459
+ ```bash
460
+ mailmodo status
461
+ mailmodo status --json
462
+ ```
463
+
464
+ Displays per-email metrics (sent, open rate, click rate, conversion rate), total monthly sends, and current quota status (free emails remaining or paid blocks consumed).
465
+
466
+ **JSON output shape:**
467
+
468
+ ```json
469
+ {
470
+ "emails": [
471
+ {
472
+ "id": "welcome",
473
+ "sent": 120,
474
+ "openRate": 0.42,
475
+ "clickRate": 0.15,
476
+ "conversionRate": 0.08
477
+ }
478
+ ],
479
+ "monthlySent": 480,
480
+ "quota": { "free": 20, "paidBlocksUsed": 0 }
481
+ }
482
+ ```
116
483
 
117
- **Examples of PR titles:**
484
+ ---
485
+
486
+ ### logs
487
+
488
+ View email send logs and delivery events.
489
+
490
+ ```bash
491
+ mailmodo logs
492
+ mailmodo logs --email sarah@example.com
493
+ mailmodo logs --failed
494
+ mailmodo logs --limit 100 --page 2
495
+ mailmodo logs --json
496
+ ```
497
+
498
+ | Flag | Type | Default | Description |
499
+ | ---------- | ------- | ------- | -------------------------------------- |
500
+ | `--email` | string | | Filter events by contact email address |
501
+ | `--failed` | boolean | false | Show only failed or bounced events |
502
+ | `--limit` | integer | 50 | Entries per page (max 200) |
503
+ | `--page` | integer | 1 | Page number for pagination |
504
+
505
+ **JSON output shape:**
506
+
507
+ ```json
508
+ {
509
+ "entries": [
510
+ {
511
+ "timestamp": "2025-06-01T10:00:00Z",
512
+ "emailId": "welcome",
513
+ "status": "delivered",
514
+ "contact": "sarah@example.com",
515
+ "reason": null
516
+ }
517
+ ],
518
+ "total": 480,
519
+ "page": 1,
520
+ "limit": 50
521
+ }
522
+ ```
523
+
524
+ ---
525
+
526
+ ### contacts
527
+
528
+ Manage contacts — search, export, or delete.
529
+
530
+ ```bash
531
+ # Show summary counts
532
+ mailmodo contacts
533
+
534
+ # Search for a specific contact
535
+ mailmodo contacts --search sarah@example.com
536
+
537
+ # Export all contacts as GDPR-compliant CSV
538
+ mailmodo contacts --export
539
+
540
+ # Hard-delete a contact (GDPR right to erasure)
541
+ mailmodo contacts --delete sarah@example.com
542
+ ```
543
+
544
+ | Flag | Type | Description |
545
+ | ---------- | ------- | --------------------------------------- |
546
+ | `--search` | string | Look up a contact by email address |
547
+ | `--export` | boolean | Download all contacts to `contacts.csv` |
548
+ | `--delete` | string | Permanently delete a contact by email |
549
+
550
+ Without any flags, displays total, active, unsubscribed, and bounced contact counts.
551
+
552
+ ---
553
+
554
+ ### billing
555
+
556
+ View billing status, purchase email blocks, set a monthly cap, or add a payment method.
557
+
558
+ ```bash
559
+ # View current billing status
560
+ mailmodo billing
561
+ mailmodo billing --status
562
+
563
+ # Open Stripe checkout to add or update a payment method
564
+ mailmodo billing --checkout
565
+
566
+ # Purchase email blocks immediately
567
+ mailmodo billing --purchase 3
568
+
569
+ # Set a monthly sending cap (paid tier)
570
+ mailmodo billing --cap 5
571
+
572
+ # Set cap with auto-refill when quota runs low
573
+ mailmodo billing --cap 5 --auto-charge-block-count 2
574
+ ```
575
+
576
+ | Flag | Type | Description |
577
+ | --------------------------- | ------- | ------------------------------------------------------------------- |
578
+ | `--status` | boolean | Show billing status only (tier, cap, spending) |
579
+ | `--checkout` | boolean | Open Stripe checkout to add or update a payment method |
580
+ | `--purchase` | integer | Manually purchase the specified number of email blocks |
581
+ | `--cap` | integer | Set monthly sending cap in blocks |
582
+ | `--auto-charge-block-count` | integer | Blocks to auto-purchase when quota runs low (use alongside `--cap`) |
583
+
584
+ Each block = 1,000 emails. `--monthly-cap` and `--auto-charge-block-count` require a saved payment method.
585
+
586
+ ---
587
+
588
+ ### report
589
+
590
+ Fetch a detailed analytics report with flexible filtering and grouping.
591
+
592
+ ```bash
593
+ # Quick report for the last 7 days
594
+ mailmodo report --preset last7d
595
+
596
+ # Group by email template
597
+ mailmodo report --preset last30d --group-by emailId
598
+
599
+ # Custom date range, raw event entries
600
+ mailmodo report --from 2025-05-01 --to 2025-06-01 --output entries
601
+
602
+ # Filter to a specific sequence and event type
603
+ mailmodo report --preset last30d --sequence seq_abc123 --event opened
604
+
605
+ # Paginate through entries
606
+ mailmodo report --preset last7d --output entries --page 2 --limit 100
607
+
608
+ mailmodo report --preset last7d --json
609
+ ```
610
+
611
+ | Flag | Type | Default | Description |
612
+ | ------------ | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------- |
613
+ | `--preset` | string | | Relative time range: `today`, `yesterday`, `last7d`, `last30d`, `last90d`, `thisMonth`, `lastMonth` |
614
+ | `--from` | string | | Start of range inclusive (YYYY-MM-DD). Exclusive with `--preset` |
615
+ | `--to` | string | | End of range exclusive (YYYY-MM-DD). Exclusive with `--preset` |
616
+ | `--group-by` | string | `none` | Group results by: `none`, `emailId`, `sequenceId`, `day`, `hour`, `contact`, `status` |
617
+ | `--output` | string | `summary` | Output shape: `summary`, `entries`, `timeseries` |
618
+ | `--email-id` | string[] | | Filter by one or more email template IDs (repeatable) |
619
+ | `--contact` | string[] | | Filter by one or more contact emails (repeatable) |
620
+ | `--sequence` | string[] | | Filter by one or more sequence IDs (repeatable) |
621
+ | `--event` | string[] | | Filter by event type: `sent`, `delivered`, `opened`, `clicked`, `bounced`, `complained`, `skipped`, `unsubscribed` (repeatable) |
622
+ | `--limit` | integer | 50 | Entries per page, max 200 (applies to `entries` output only) |
623
+ | `--page` | integer | 1 | Page number (applies to `entries` output only) |
624
+
625
+ `--preset` and `--from`/`--to` are mutually exclusive.
626
+
627
+ ---
628
+
629
+ ## SDK / App Integration
630
+
631
+ After deploying a sequence, the CLI prints the exact code to add to your application. You can always retrieve it with:
632
+
633
+ ```bash
634
+ npm install @mailmodo/sdk
635
+ ```
636
+
637
+ ```javascript
638
+ import { track, identify } from '@mailmodo/sdk';
639
+ ```
640
+
641
+ ### `track(event, properties)`
642
+
643
+ Called when a lifecycle event happens in your app. This triggers the email configured for that event.
644
+
645
+ ```javascript
646
+ // Example: trigger the "welcome" email on sign-up
647
+ track('myApp$user.signup', {
648
+ contactEmailId: user.email,
649
+ first_name: user.firstName,
650
+ onboarding_url: `https://app.example.com/onboard/${user.id}`,
651
+ });
652
+ ```
653
+
654
+ ### `identify(email, properties)`
655
+
656
+ Updates contact properties used by conditional send logic.
657
+
658
+ ```javascript
659
+ // Example: update onboarding status to conditionally suppress follow-up emails
660
+ identify(user.email, {
661
+ onboarding_not_completed: user.onboardingStep < 3,
662
+ });
663
+ ```
664
+
665
+ The `mailmodo sdk` command (or the post-deploy output) shows the exact event names and properties for each sequence in your account.
666
+
667
+ ---
668
+
669
+ ## Configuration
670
+
671
+ ### Credentials — `~/.mailmodo/config`
672
+
673
+ Stores your API key and account metadata. Written by `mailmodo login`, deleted by `mailmodo logout`. Never commit this file.
674
+
675
+ ```json
676
+ {
677
+ "apiKey": "mk_...",
678
+ "email": "you@example.com",
679
+ "totalFreeRemaining": 500
680
+ }
681
+ ```
682
+
683
+ **Environment variable override:** Set `MAILMODO_API_KEY` to bypass the config file entirely — useful in CI/CD pipelines and Docker containers.
684
+
685
+ ### Project Config — `mailmodo.yaml`
686
+
687
+ Created by `mailmodo init` in your current working directory. This is the source of truth for your email sequence. Commit it to version control.
688
+
689
+ ```yaml
690
+ project:
691
+ name: MyApp
692
+ url: https://myapp.com
693
+ description: Project management for remote teams
694
+ type: b2b_saas
695
+ targetUser: engineering managers
696
+ saasModel: subscription
697
+ pricingModel: per_seat
698
+
699
+ domain: myapp.com
700
+ fromEmail: hello@myapp.com
701
+ fromName: MyApp
702
+ replyTo: support@myapp.com
703
+ address: 123 Main St, San Francisco, CA 94105, US
704
+
705
+ emailStyle: branded # branded | plain
706
+ brandColor: '#1A56DB'
707
+ logoUrl: https://cdn.myapp.com/logo.png
708
+
709
+ monthlyCap: 5 # paid tier — blocks per month (1 block = 1,000 emails)
710
+ webhookUrl: https://myapp.com/webhooks/mailmodo
711
+
712
+ emails:
713
+ - id: welcome
714
+ trigger: user.signup
715
+ delay: 0
716
+ subject: 'Welcome to MyApp, {{first_name}}!'
717
+ template: welcome.html
718
+ style: branded
719
+ previewText: 'Your account is ready.'
720
+ goal: Drive user to complete the first key action
721
+ ctaText: Get Started
722
+
723
+ - id: day3-nudge
724
+ trigger: user.signup
725
+ delay: '3d'
726
+ subject: 'Quick tip for getting started'
727
+ template: day3-nudge.html
728
+ condition: 'onboarding_not_completed == true'
729
+ ```
730
+
731
+ ### HTML Templates — `mailmodo/`
732
+
733
+ Each email in `mailmodo.yaml` maps to an HTML file in the `mailmodo/` directory:
734
+
735
+ ```
736
+ mailmodo/
737
+ welcome.html
738
+ day3-nudge.html
739
+ trial-expiry.html
740
+ ```
741
+
742
+ Templates are generated by `mailmodo init` and editable directly or via `mailmodo edit`. They are automatically synced to the Mailmodo cloud as a backup on every modifying command and restored automatically if the local file is missing.
743
+
744
+ ---
745
+
746
+ ## AI Agent Support
747
+
748
+ All commands support two flags designed for headless and automated environments:
749
+
750
+ | Flag | Description |
751
+ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
752
+ | `--json` | All output is valid JSON on stdout. Spinners and progress text go to stderr, keeping stdout clean for piping and parsing. |
753
+ | `--yes` / `-y` | Skips all interactive confirmation prompts. The CLI proceeds with the inferred defaults, making it safe to run in scripts and CI pipelines. |
754
+
755
+ ### API key via environment variable
756
+
757
+ Set `MAILMODO_API_KEY` to authenticate without a config file:
758
+
759
+ ```bash
760
+ MAILMODO_API_KEY=mk_... mailmodo deploy --yes --json
761
+ ```
762
+
763
+ ### Example: fully non-interactive deploy in CI
764
+
765
+ ```bash
766
+ MAILMODO_API_KEY=$MAILMODO_API_KEY \
767
+ mailmodo deploy --yes --json | jq '.sequenceId'
768
+ ```
769
+
770
+ ### Example: AI agent loop
771
+
772
+ ```bash
773
+ # Generate emails, skip all prompts, get structured output
774
+ mailmodo init --url https://yourapp.com --yes --json
775
+
776
+ # Edit with a specific instruction, no confirmation
777
+ mailmodo edit welcome --change "add a P.S. with the link to our docs" --yes --json
778
+
779
+ # Deploy immediately
780
+ mailmodo deploy --yes --json
781
+ ```
782
+
783
+ ---
784
+
785
+ ## Contributing
786
+
787
+ Contributions are welcome. This is an open-source project and issues, bug reports, and pull requests are appreciated.
788
+
789
+ ```bash
790
+ # Clone and install
791
+ git clone https://github.com/Mailmodo/mailmodo-cli.git
792
+ cd mailmodo-cli
793
+ npm install
794
+
795
+ # Build
796
+ npm run build
797
+
798
+ # Run a command without building
799
+ node ./bin/run.js <command>
800
+
801
+ # Run tests
802
+ npm test
803
+
804
+ # Run a single test file
805
+ npx mocha --loader ts-node/esm test/commands/<name>/index.test.ts
806
+
807
+ # Lint
808
+ npm run lint
809
+ ```
810
+
811
+ **Versioning:** PR title tags control version bumps on merge to `main`:
812
+
813
+ - `[major]` → major bump
814
+ - `[minor]` → minor bump
815
+ - `[patch]` or no tag → patch bump
816
+
817
+ Beta builds are published automatically to npm on every PR:
818
+
819
+ ```bash
820
+ npm install -g @mailmodo/cli@beta
821
+ ```
118
822
 
119
- - `[minor] Add email validation` → minor bump
120
- - `[major] Rewrite auth flow` → major bump
121
- - `Fix typo in help text` → patch bump (default)
823
+ ---
122
824
 
123
825
  ## License
124
826
 
125
- MIT
827
+ MIT © [Mailmodo](https://github.com/Mailmodo)
@@ -341,13 +341,13 @@
341
341
  "index.js"
342
342
  ]
343
343
  },
344
- "init": {
344
+ "emails": {
345
345
  "aliases": [],
346
346
  "args": {},
347
- "description": "Analyze your product and generate email sequences",
347
+ "description": "List and view configured email sequences",
348
348
  "examples": [
349
- "<%= config.bin %> init",
350
- "<%= config.bin %> init --url https://myapp.com --yes"
349
+ "<%= config.bin %> emails",
350
+ "<%= config.bin %> emails --json"
351
351
  ],
352
352
  "flags": {
353
353
  "json": {
@@ -362,18 +362,11 @@
362
362
  "name": "yes",
363
363
  "allowNo": false,
364
364
  "type": "boolean"
365
- },
366
- "url": {
367
- "description": "Product URL to analyze",
368
- "name": "url",
369
- "hasDynamicHelp": false,
370
- "multiple": false,
371
- "type": "option"
372
365
  }
373
366
  },
374
367
  "hasDynamicHelp": false,
375
368
  "hiddenAliases": [],
376
- "id": "init",
369
+ "id": "emails",
377
370
  "pluginAlias": "@mailmodo/cli",
378
371
  "pluginName": "@mailmodo/cli",
379
372
  "pluginType": "core",
@@ -383,17 +376,17 @@
383
376
  "relativePath": [
384
377
  "dist",
385
378
  "commands",
386
- "init",
379
+ "emails",
387
380
  "index.js"
388
381
  ]
389
382
  },
390
- "login": {
383
+ "init": {
391
384
  "aliases": [],
392
385
  "args": {},
393
- "description": "Authenticate with Mailmodo using your API key",
386
+ "description": "Analyze your product and generate email sequences",
394
387
  "examples": [
395
- "<%= config.bin %> login",
396
- "MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
388
+ "<%= config.bin %> init",
389
+ "<%= config.bin %> init --url https://myapp.com --yes"
397
390
  ],
398
391
  "flags": {
399
392
  "json": {
@@ -408,11 +401,18 @@
408
401
  "name": "yes",
409
402
  "allowNo": false,
410
403
  "type": "boolean"
404
+ },
405
+ "url": {
406
+ "description": "Product URL to analyze",
407
+ "name": "url",
408
+ "hasDynamicHelp": false,
409
+ "multiple": false,
410
+ "type": "option"
411
411
  }
412
412
  },
413
413
  "hasDynamicHelp": false,
414
414
  "hiddenAliases": [],
415
- "id": "login",
415
+ "id": "init",
416
416
  "pluginAlias": "@mailmodo/cli",
417
417
  "pluginName": "@mailmodo/cli",
418
418
  "pluginType": "core",
@@ -422,16 +422,17 @@
422
422
  "relativePath": [
423
423
  "dist",
424
424
  "commands",
425
- "login",
425
+ "init",
426
426
  "index.js"
427
427
  ]
428
428
  },
429
- "logout": {
429
+ "login": {
430
430
  "aliases": [],
431
431
  "args": {},
432
- "description": "Sign out by removing saved credentials from this machine",
432
+ "description": "Authenticate with Mailmodo using your API key",
433
433
  "examples": [
434
- "<%= config.bin %> logout"
434
+ "<%= config.bin %> login",
435
+ "MAILMODO_API_KEY=YOUR_API_KEY <%= config.bin %> login"
435
436
  ],
436
437
  "flags": {
437
438
  "json": {
@@ -450,7 +451,7 @@
450
451
  },
451
452
  "hasDynamicHelp": false,
452
453
  "hiddenAliases": [],
453
- "id": "logout",
454
+ "id": "login",
454
455
  "pluginAlias": "@mailmodo/cli",
455
456
  "pluginName": "@mailmodo/cli",
456
457
  "pluginType": "core",
@@ -460,17 +461,16 @@
460
461
  "relativePath": [
461
462
  "dist",
462
463
  "commands",
463
- "logout",
464
+ "login",
464
465
  "index.js"
465
466
  ]
466
467
  },
467
- "emails": {
468
+ "logout": {
468
469
  "aliases": [],
469
470
  "args": {},
470
- "description": "List and view configured email sequences",
471
+ "description": "Sign out by removing saved credentials from this machine",
471
472
  "examples": [
472
- "<%= config.bin %> emails",
473
- "<%= config.bin %> emails --json"
473
+ "<%= config.bin %> logout"
474
474
  ],
475
475
  "flags": {
476
476
  "json": {
@@ -489,7 +489,7 @@
489
489
  },
490
490
  "hasDynamicHelp": false,
491
491
  "hiddenAliases": [],
492
- "id": "emails",
492
+ "id": "logout",
493
493
  "pluginAlias": "@mailmodo/cli",
494
494
  "pluginName": "@mailmodo/cli",
495
495
  "pluginType": "core",
@@ -499,7 +499,7 @@
499
499
  "relativePath": [
500
500
  "dist",
501
501
  "commands",
502
- "emails",
502
+ "logout",
503
503
  "index.js"
504
504
  ]
505
505
  },
@@ -932,5 +932,5 @@
932
932
  ]
933
933
  }
934
934
  },
935
- "version": "0.0.58-beta.pr60.110"
935
+ "version": "0.0.59-beta.pr61.111"
936
936
  }
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.58-beta.pr60.110",
4
+ "version": "0.0.59-beta.pr61.111",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"
@@ -51,8 +51,20 @@
51
51
  ],
52
52
  "homepage": "https://github.com/Mailmodo/mailmodo-cli",
53
53
  "keywords": [
54
- "oclif"
54
+ "email",
55
+ "email-automation",
56
+ "lifecycle-emails",
57
+ "onboarding",
58
+ "transactional-email",
59
+ "cli",
60
+ "ai",
61
+ "mailmodo",
62
+ "sdk",
63
+ "saas"
55
64
  ],
65
+ "publishConfig": {
66
+ "access": "public"
67
+ },
56
68
  "license": "MIT",
57
69
  "main": "dist/index.js",
58
70
  "type": "module",
@@ -73,9 +85,9 @@
73
85
  "lint": "eslint",
74
86
  "postpack": "shx rm -f oclif.manifest.json",
75
87
  "posttest": "npm run lint",
76
- "prepack": "oclif manifest && oclif readme",
88
+ "prepack": "oclif manifest",
77
89
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
78
- "version": "oclif readme && git add README.md",
90
+ "version": "git add README.md",
79
91
  "prepare": "husky"
80
92
  },
81
93
  "types": "dist/index.d.ts",