@mailmodo/cli 0.0.47-beta.pr49.75 → 0.0.47

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.
@@ -10,7 +10,6 @@ export default class Deploy extends BaseCommand {
10
10
  run(): Promise<void>;
11
11
  private validateSequence;
12
12
  private buildDeployPayload;
13
- private resolveMonthlyCapForDeploy;
14
13
  private mapEmailToPayload;
15
14
  private buildBrandSection;
16
15
  private buildProductSection;
@@ -1,7 +1,7 @@
1
1
  import { confirm, input } from '@inquirer/prompts';
2
2
  import chalk from 'chalk';
3
3
  import { BaseCommand } from '../../lib/base-command.js';
4
- import { API_ENDPOINTS, DEFAULT_BRAND_COLOR } from '../../lib/constants.js';
4
+ import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, } from '../../lib/constants.js';
5
5
  import { ERRORS, INFO, PROMPTS, SEPARATOR } from '../../lib/messages.js';
6
6
  import { loadTemplate, } from '../../lib/yaml-config.js';
7
7
  export default class Deploy extends BaseCommand {
@@ -61,25 +61,16 @@ export default class Deploy extends BaseCommand {
61
61
  return response.data;
62
62
  }
63
63
  async buildDeployPayload(yamlConfig) {
64
- const [emailsWithHtml, monthlyCap] = await Promise.all([
65
- Promise.all(yamlConfig.emails.map(async (email) => {
66
- const html = (await loadTemplate(`${email.id}.html`)) || '';
67
- const plainHtml = (await loadTemplate(`${email.id}_plain.html`)) || html;
68
- return { ...this.mapEmailToPayload(email), html, plainHtml };
69
- })),
70
- this.resolveMonthlyCapForDeploy(yamlConfig.project.monthlyCap),
71
- ]);
64
+ const emailsWithHtml = await Promise.all(yamlConfig.emails.map(async (email) => {
65
+ const html = (await loadTemplate(`${email.id}.html`)) || '';
66
+ const plainHtml = (await loadTemplate(`${email.id}_plain.html`)) || html;
67
+ return { ...this.mapEmailToPayload(email), html, plainHtml };
68
+ }));
72
69
  return {
73
- ...this.buildProjectPayload(yamlConfig.project, monthlyCap),
70
+ ...this.buildProjectPayload(yamlConfig.project),
74
71
  emails: emailsWithHtml,
75
72
  };
76
73
  }
77
- async resolveMonthlyCapForDeploy(yamlMonthlyCap) {
78
- if (yamlMonthlyCap !== undefined)
79
- return yamlMonthlyCap;
80
- const billingStatus = await this.fetchBillingStatus();
81
- return billingStatus?.cap?.inBlocks ?? undefined;
82
- }
83
74
  mapEmailToPayload(email) {
84
75
  return {
85
76
  condition: email.condition || null,
@@ -120,11 +111,11 @@ export default class Deploy extends BaseCommand {
120
111
  replyTo: project?.replyTo || project?.fromEmail || '',
121
112
  };
122
113
  }
123
- buildProjectPayload(project, monthlyCap) {
114
+ buildProjectPayload(project) {
124
115
  return {
125
116
  brand: this.buildBrandSection(project),
126
117
  emailStyle: project?.emailStyle || 'branded',
127
- ...(monthlyCap === undefined ? {} : { monthlyCap }),
118
+ monthlyCap: project?.monthlyCap ?? DEFAULT_MONTHLY_CAP,
128
119
  product: this.buildProductSection(project),
129
120
  senderDetails: this.buildSenderSection(project),
130
121
  ...(project?.webhookUrl ? { webhookUrl: project.webhookUrl } : {}),
@@ -2,7 +2,7 @@ import { Flags } from '@oclif/core';
2
2
  import { confirm, editor, input, select } from '@inquirer/prompts';
3
3
  import chalk from 'chalk';
4
4
  import { BaseCommand } from '../../lib/base-command.js';
5
- import { API_ENDPOINTS, DEFAULT_BRAND_COLOR } from '../../lib/constants.js';
5
+ import { API_ENDPOINTS, DEFAULT_BRAND_COLOR, DEFAULT_MONTHLY_CAP, } from '../../lib/constants.js';
6
6
  import { loadYaml, saveTemplate, saveYaml, } from '../../lib/yaml-config.js';
7
7
  function isValidUrl(value) {
8
8
  try {
@@ -143,6 +143,7 @@ export default class Init extends BaseCommand {
143
143
  fromEmail: '',
144
144
  fromName: `Team ${analysisPayload.productName}`,
145
145
  logoUrl: analysisPayload.brand?.logoUrl || '',
146
+ monthlyCap: DEFAULT_MONTHLY_CAP,
146
147
  name: analysisPayload.productName,
147
148
  pricingModel: analysisPayload.pricingModel,
148
149
  replyTo: '',
@@ -154,12 +155,6 @@ export default class Init extends BaseCommand {
154
155
  },
155
156
  };
156
157
  await saveYaml(yamlConfig);
157
- const billingStatus = await this.fetchBillingStatus();
158
- const monthlyCap = billingStatus?.cap?.inBlocks;
159
- if (monthlyCap !== null && monthlyCap !== undefined) {
160
- yamlConfig.project.monthlyCap = monthlyCap;
161
- await saveYaml(yamlConfig);
162
- }
163
158
  const templateSaves = analysisPayload.recommendedEmails.flatMap((rec, index) => {
164
159
  const generated = generatedEmails[index];
165
160
  const saves = [];
@@ -48,22 +48,14 @@ export default class Settings extends BaseCommand {
48
48
  await this.applySetFlag(flags.set, yamlConfig, flags.json ?? false);
49
49
  return;
50
50
  }
51
- const [domainVerified, billingStatus] = await Promise.all([
52
- flags.json
53
- ? Promise.resolve(null)
54
- : this.fetchDomainVerified(yamlConfig.project.domain),
55
- this.fetchBillingStatus(),
56
- ]);
57
- const tier = billingStatus?.tier ?? null;
58
- const capFromApi = billingStatus?.cap?.inBlocks ?? null;
59
- if (capFromApi !== null) {
60
- yamlConfig.project.monthlyCap = capFromApi;
61
- await saveYaml(yamlConfig);
62
- }
63
51
  if (flags.json) {
64
52
  this.log(JSON.stringify({ settings: yamlConfig.project }, null, 2));
65
53
  return;
66
54
  }
55
+ const [domainVerified, tier] = await Promise.all([
56
+ this.fetchDomainVerified(yamlConfig.project.domain),
57
+ this.fetchBillingTier(),
58
+ ]);
67
59
  this.log(`\n Current settings for ${chalk.bold(yamlConfig.project.name || 'project')}:\n`);
68
60
  for (const [group, keys] of Object.entries(SETTINGS_GROUPS)) {
69
61
  if (group === 'billing' && tier === FREE_TIER)
@@ -8,14 +8,6 @@ export interface BillingCapUpdateResult {
8
8
  capEmails: number;
9
9
  message: string;
10
10
  }
11
- export interface BillingStatusResult {
12
- cap?: {
13
- capUpdatedAt: null | string;
14
- inBlocks: null | number;
15
- inEmails: null | number;
16
- };
17
- tier?: string;
18
- }
19
11
  export declare const FREE_TIER = "free";
20
12
  /**
21
13
  * Abstract base command providing shared functionality for all Mailmodo CLI commands.
@@ -110,12 +102,6 @@ export declare abstract class BaseCommand extends Command {
110
102
  * distinguish from a successful update.
111
103
  */
112
104
  protected warnFreeTierCapBlocked(jsonOutput: boolean): void;
113
- /**
114
- * Fetches the full billing status from `/billing/status`. Returns `null`
115
- * when the request cannot be completed (no credentials, network failure,
116
- * non-OK response) so callers can degrade gracefully without halting.
117
- */
118
- protected fetchBillingStatus(): Promise<BillingStatusResult | null>;
119
105
  /**
120
106
  * Fetches the account's billing tier from `/billing/status`. Returns `null`
121
107
  * when the request cannot be completed (no credentials, network failure,
@@ -198,33 +198,24 @@ export class BaseCommand extends Command {
198
198
  this.warn(chalk.yellow(INFO.FREE_TIER_CAP_BLOCKED));
199
199
  }
200
200
  /**
201
- * Fetches the full billing status from `/billing/status`. Returns `null`
201
+ * Fetches the account's billing tier from `/billing/status`. Returns `null`
202
202
  * when the request cannot be completed (no credentials, network failure,
203
203
  * non-OK response) so callers can degrade gracefully without halting.
204
+ * Callers that need a hard "free vs paid" decision should treat `null` as
205
+ * unknown and fall through to their default behavior.
204
206
  */
205
- async fetchBillingStatus() {
207
+ async fetchBillingTier() {
206
208
  try {
207
209
  await this.ensureAuth();
208
210
  const response = await this.apiClient.get(API_ENDPOINTS.BILLING_STATUS);
209
211
  if (!response.ok)
210
212
  return null;
211
- return response.data ?? null;
213
+ return response.data?.tier ?? null;
212
214
  }
213
215
  catch {
214
216
  return null;
215
217
  }
216
218
  }
217
- /**
218
- * Fetches the account's billing tier from `/billing/status`. Returns `null`
219
- * when the request cannot be completed (no credentials, network failure,
220
- * non-OK response) so callers can degrade gracefully without halting.
221
- * Callers that need a hard "free vs paid" decision should treat `null` as
222
- * unknown and fall through to their default behavior.
223
- */
224
- async fetchBillingTier() {
225
- const status = await this.fetchBillingStatus();
226
- return status?.tier ?? null;
227
- }
228
219
  async registerDomain(yamlConfig, inputs, json) {
229
220
  const apiPayload = {
230
221
  address: inputs.address,
@@ -23,7 +23,10 @@ export declare const API_ENDPOINTS: Readonly<{
23
23
  SEQUENCES_VALIDATE: "/sequences/validate";
24
24
  }>;
25
25
  export declare const LOGIN_URL = "https://app-vertex-debug.azurewebsites.net/signup.html";
26
+ export declare const DOCS_URL = "https://mailmodo.com/docs/cli";
27
+ export declare const DNS_GUIDE_URL = "https://mailmodo.com/docs/dns";
26
28
  export declare const PREVIEW_PORT = 3421;
27
29
  export declare const DEFAULT_BRAND_COLOR = "#1A56DB";
30
+ export declare const DEFAULT_MONTHLY_CAP = 5;
28
31
  export declare const TEMPLATES_DIR = "mailmodo";
29
32
  export declare const YAML_FILE = "mailmodo.yaml";
@@ -34,7 +34,10 @@ const PRODUCTION_LOGIN_URL = 'https://app-vertex-debug.azurewebsites.net/signup.
34
34
  export const LOGIN_URL = process.env.MAILMODO_DEV_TSX
35
35
  ? DEV_LOGIN_URL
36
36
  : PRODUCTION_LOGIN_URL;
37
+ export const DOCS_URL = 'https://mailmodo.com/docs/cli';
38
+ export const DNS_GUIDE_URL = 'https://mailmodo.com/docs/dns';
37
39
  export const PREVIEW_PORT = 3421;
38
40
  export const DEFAULT_BRAND_COLOR = '#1A56DB';
41
+ export const DEFAULT_MONTHLY_CAP = 5;
39
42
  export const TEMPLATES_DIR = 'mailmodo';
40
43
  export const YAML_FILE = 'mailmodo.yaml';
@@ -228,19 +228,13 @@
228
228
  "index.js"
229
229
  ]
230
230
  },
231
- "edit": {
231
+ "emails": {
232
232
  "aliases": [],
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",
233
+ "args": {},
234
+ "description": "List and view configured email sequences",
241
235
  "examples": [
242
- "<%= config.bin %> edit welcome",
243
- "<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
236
+ "<%= config.bin %> emails",
237
+ "<%= config.bin %> emails --json"
244
238
  ],
245
239
  "flags": {
246
240
  "json": {
@@ -255,18 +249,11 @@
255
249
  "name": "yes",
256
250
  "allowNo": false,
257
251
  "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"
265
252
  }
266
253
  },
267
254
  "hasDynamicHelp": false,
268
255
  "hiddenAliases": [],
269
- "id": "edit",
256
+ "id": "emails",
270
257
  "pluginAlias": "@mailmodo/cli",
271
258
  "pluginName": "@mailmodo/cli",
272
259
  "pluginType": "core",
@@ -276,17 +263,23 @@
276
263
  "relativePath": [
277
264
  "dist",
278
265
  "commands",
279
- "edit",
266
+ "emails",
280
267
  "index.js"
281
268
  ]
282
269
  },
283
- "emails": {
270
+ "edit": {
284
271
  "aliases": [],
285
- "args": {},
286
- "description": "List and view configured email sequences",
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",
287
280
  "examples": [
288
- "<%= config.bin %> emails",
289
- "<%= config.bin %> emails --json"
281
+ "<%= config.bin %> edit welcome",
282
+ "<%= config.bin %> edit welcome --change \"make subject more urgent\" --yes"
290
283
  ],
291
284
  "flags": {
292
285
  "json": {
@@ -301,11 +294,18 @@
301
294
  "name": "yes",
302
295
  "allowNo": false,
303
296
  "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": "emails",
308
+ "id": "edit",
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
- "emails",
318
+ "edit",
319
319
  "index.js"
320
320
  ]
321
321
  },
@@ -657,5 +657,5 @@
657
657
  ]
658
658
  }
659
659
  },
660
- "version": "0.0.47-beta.pr49.75"
660
+ "version": "0.0.47"
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.47-beta.pr49.75",
4
+ "version": "0.0.47",
5
5
  "author": "provishalk",
6
6
  "bin": {
7
7
  "mailmodo": "bin/run.js"