@myapihq/cli 1.0.12 → 1.0.14

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.
@@ -0,0 +1,4 @@
1
+ export declare function setOrg(id: string, flags: Record<string, string | boolean>): Promise<void>;
2
+ export declare function setDomain(domain: string, flags: Record<string, string | boolean>): Promise<void>;
3
+ export declare function view(flags: Record<string, string | boolean>): Promise<void>;
4
+ export declare function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>): Promise<void>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setOrg = setOrg;
4
+ exports.setDomain = setDomain;
5
+ exports.view = view;
6
+ exports.run = run;
7
+ const config_js_1 = require("../config.js");
8
+ const output_js_1 = require("../output.js");
9
+ async function setOrg(id, flags) {
10
+ if (!id || flags.help) {
11
+ (0, output_js_1.info)("Usage: myapi config set-org <id>\n\nSets a default organization ID for subsequent commands.");
12
+ return;
13
+ }
14
+ const config = (0, config_js_1.requireConfig)();
15
+ config.default_org = id;
16
+ (0, config_js_1.saveConfig)(config);
17
+ (0, output_js_1.success)(`Default organization set to: ${id}`);
18
+ }
19
+ async function setDomain(domain, flags) {
20
+ if (!domain || flags.help) {
21
+ (0, output_js_1.info)("Usage: myapi config set-domain <domain>\n\nSets a default domain for subsequent commands.");
22
+ return;
23
+ }
24
+ const config = (0, config_js_1.requireConfig)();
25
+ config.default_domain = domain;
26
+ (0, config_js_1.saveConfig)(config);
27
+ (0, output_js_1.success)(`Default domain set to: ${domain}`);
28
+ }
29
+ async function view(flags) {
30
+ if (flags.help) {
31
+ (0, output_js_1.info)("Usage: myapi config view\n\nViews current config settings.");
32
+ return;
33
+ }
34
+ const config = (0, config_js_1.requireConfig)();
35
+ (0, output_js_1.info)(`Default Org: ${config.default_org || 'Not set'}`);
36
+ (0, output_js_1.info)(`Default Domain: ${config.default_domain || 'Not set'}`);
37
+ }
38
+ async function run(subcommand, args, flags) {
39
+ if (!subcommand || (flags.help && !subcommand)) {
40
+ (0, output_js_1.info)('Usage: myapi config <subcommand>\n\nSubcommands:\n view View current config\n set-org Set default organization\n set-domain Set default domain');
41
+ return;
42
+ }
43
+ if (subcommand === 'view')
44
+ await view(flags);
45
+ else if (subcommand === 'set-org')
46
+ await setOrg(args[0], flags);
47
+ else if (subcommand === 'set-domain')
48
+ await setDomain(args[0], flags);
49
+ else
50
+ (0, output_js_1.error)(`Unknown subcommand: ${subcommand}. Run "myapi config --help" for a list of valid subcommands.`);
51
+ }
@@ -1,9 +1,9 @@
1
- export declare function check(domain: string, flags: Record<string, string | boolean>): Promise<void>;
2
- export declare function register(domain: string, flags: Record<string, string | boolean>): Promise<void>;
3
- export declare function importDomain(domain: string, flags: Record<string, string | boolean>): Promise<void>;
1
+ export declare function check(domainArg: string, flags: Record<string, string | boolean>): Promise<void>;
2
+ export declare function register(domainArg: string, flags: Record<string, string | boolean>): Promise<void>;
3
+ export declare function importDomain(domainArg: string, flags: Record<string, string | boolean>): Promise<void>;
4
4
  export declare function list(flags: Record<string, string | boolean>): Promise<void>;
5
- export declare function assign(domain: string, flags: Record<string, string | boolean>): Promise<void>;
6
- export declare function unassign(domain: string, flags: Record<string, string | boolean>): Promise<void>;
7
- export declare function settings(domain: string, flags: Record<string, string | boolean>): Promise<void>;
8
- export declare function updateSettings(domain: string, flags: Record<string, string | boolean>): Promise<void>;
5
+ export declare function assign(domainArg: string, flags: Record<string, string | boolean>): Promise<void>;
6
+ export declare function unassign(domainArg: string, flags: Record<string, string | boolean>): Promise<void>;
7
+ export declare function settings(domainArg: string, flags: Record<string, string | boolean>): Promise<void>;
8
+ export declare function updateSettings(domainArg: string, flags: Record<string, string | boolean>): Promise<void>;
9
9
  export declare function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>): Promise<void>;
@@ -12,11 +12,12 @@ exports.run = run;
12
12
  const sdk_1 = require("@myapihq/sdk");
13
13
  const config_js_1 = require("../config.js");
14
14
  const output_js_1 = require("../output.js");
15
- async function check(domain, flags) {
16
- const orgId = flags.org;
17
- if (!orgId || !domain)
18
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain check <domain> --org <id>");
15
+ async function check(domainArg, flags) {
19
16
  const config = (0, config_js_1.requireConfig)();
17
+ const orgId = flags.org || config.default_org;
18
+ const domain = domainArg || config.default_domain;
19
+ if (!orgId || !domain)
20
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain check <domain> --org <id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
20
21
  const res = await sdk_1.domain.checkDomain(config.api_key, orgId, domain);
21
22
  if (res.available) {
22
23
  (0, output_js_1.info)(`${domain} — Available ✓ Price: $${(res.price_cents / 100).toFixed(2)}/yr`);
@@ -25,23 +26,25 @@ async function check(domain, flags) {
25
26
  (0, output_js_1.info)(`Not available ✗`);
26
27
  }
27
28
  }
28
- async function register(domain, flags) {
29
- const orgId = flags.org;
29
+ async function register(domainArg, flags) {
30
+ const config = (0, config_js_1.requireConfig)();
31
+ const orgId = flags.org || config.default_org;
32
+ const domain = domainArg || config.default_domain;
30
33
  if (!orgId || !domain)
31
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain register <domain> --org <id> [--years <num>]");
34
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain register <domain> --org <id> [--years <num>]\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
32
35
  const years = parseInt(flags.years) || 1;
33
- const config = (0, config_js_1.requireConfig)();
34
36
  const res = await sdk_1.domain.registerDomain(config.api_key, orgId, domain, years);
35
37
  (0, output_js_1.success)(`Registered ${domain}!\n${JSON.stringify(res, null, 2)}`);
36
38
  }
37
- async function importDomain(domain, flags) {
38
- const orgId = flags.org;
39
+ async function importDomain(domainArg, flags) {
40
+ const config = (0, config_js_1.requireConfig)();
41
+ const orgId = flags.org || config.default_org;
42
+ const domain = domainArg || config.default_domain;
39
43
  if (!orgId || !domain)
40
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>");
44
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
41
45
  if (!flags['namecheap-user'] || !flags['namecheap-key']) {
42
46
  (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>");
43
47
  }
44
- const config = (0, config_js_1.requireConfig)();
45
48
  await sdk_1.domain.importDomain(config.api_key, orgId, {
46
49
  domain,
47
50
  namecheap_api_user: flags['namecheap-user'],
@@ -50,44 +53,48 @@ async function importDomain(domain, flags) {
50
53
  (0, output_js_1.success)(`Imported ${domain}`);
51
54
  }
52
55
  async function list(flags) {
53
- const orgId = flags.org;
54
- if (!orgId)
55
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain list --org <id> [--filter=all|unassigned|org]");
56
56
  const config = (0, config_js_1.requireConfig)();
57
+ const orgId = flags.org || config.default_org;
58
+ if (!orgId)
59
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain list --org <id> [--filter=all|unassigned|org]\n(Or set a default org via: myapi config set-org <id>)");
57
60
  const filter = flags.filter;
58
61
  const domains = await sdk_1.domain.listDomains(config.api_key, orgId, filter);
59
62
  (0, output_js_1.printTable)(domains);
60
63
  }
61
- async function assign(domain, flags) {
62
- const orgId = flags.org;
64
+ async function assign(domainArg, flags) {
65
+ const config = (0, config_js_1.requireConfig)();
66
+ const orgId = flags.org || config.default_org;
67
+ const domain = domainArg || config.default_domain;
63
68
  const targetOrgId = flags.target;
64
69
  if (!orgId || !domain || !targetOrgId)
65
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain assign <domain> --org <id> --target <target_org_id>");
66
- const config = (0, config_js_1.requireConfig)();
70
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain assign <domain> --org <id> --target <target_org_id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
67
71
  const res = await sdk_1.domain.assignDomain(config.api_key, orgId, domain, targetOrgId);
68
72
  (0, output_js_1.success)(`Assigned ${domain} to org ${targetOrgId}`);
69
73
  }
70
- async function unassign(domain, flags) {
71
- const orgId = flags.org;
72
- if (!orgId || !domain)
73
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain unassign <domain> --org <id>");
74
+ async function unassign(domainArg, flags) {
74
75
  const config = (0, config_js_1.requireConfig)();
76
+ const orgId = flags.org || config.default_org;
77
+ const domain = domainArg || config.default_domain;
78
+ if (!orgId || !domain)
79
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain unassign <domain> --org <id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
75
80
  const res = await sdk_1.domain.unassignDomain(config.api_key, orgId, domain);
76
81
  (0, output_js_1.success)(`Unassigned ${domain} from org ${orgId}`);
77
82
  }
78
- async function settings(domain, flags) {
79
- const orgId = flags.org;
80
- if (!orgId || !domain)
81
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain settings <domain> --org <id>");
83
+ async function settings(domainArg, flags) {
82
84
  const config = (0, config_js_1.requireConfig)();
85
+ const orgId = flags.org || config.default_org;
86
+ const domain = domainArg || config.default_domain;
87
+ if (!orgId || !domain)
88
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain settings <domain> --org <id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
83
89
  const res = await sdk_1.domain.getDomainSettings(config.api_key, orgId, domain);
84
90
  (0, output_js_1.printJson)(res);
85
91
  }
86
- async function updateSettings(domain, flags) {
87
- const orgId = flags.org;
88
- if (!orgId || !domain)
89
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain update-settings <domain> --org <id> [--security=...] [--browser-check=...] [--purge-cache]");
92
+ async function updateSettings(domainArg, flags) {
90
93
  const config = (0, config_js_1.requireConfig)();
94
+ const orgId = flags.org || config.default_org;
95
+ const domain = domainArg || config.default_domain;
96
+ if (!orgId || !domain)
97
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi domain update-settings <domain> --org <id> [--security=...] [--browser-check=...] [--purge-cache]\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
91
98
  const payload = {};
92
99
  if (flags.security)
93
100
  payload.security_level = flags.security;
@@ -6,3 +6,4 @@ export declare function listTemplates(flags: Record<string, string | boolean>):
6
6
  export declare function generateTemplate(flags: Record<string, string | boolean>): Promise<void>;
7
7
  export declare function listCampaigns(flags: Record<string, string | boolean>): Promise<void>;
8
8
  export declare function campaignStats(id: string, flags: Record<string, string | boolean>): Promise<void>;
9
+ export declare function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>): Promise<void>;
@@ -8,28 +8,36 @@ exports.listTemplates = listTemplates;
8
8
  exports.generateTemplate = generateTemplate;
9
9
  exports.listCampaigns = listCampaigns;
10
10
  exports.campaignStats = campaignStats;
11
+ exports.run = run;
11
12
  const sdk_1 = require("@myapihq/sdk");
12
13
  const config_js_1 = require("../config.js");
13
14
  const output_js_1 = require("../output.js");
14
15
  const utils_js_1 = require("../utils.js");
15
16
  async function createMailbox(flags) {
16
- if (!flags.domain || !flags.username)
17
- (0, output_js_1.error)("Missing --domain or --username flags");
18
17
  const config = (0, config_js_1.requireConfig)();
19
- const address = await sdk_1.email.createMailbox(config.api_key, flags.domain, flags.username);
18
+ const orgId = flags.org || config.default_org;
19
+ const domain = flags.domain || config.default_domain;
20
+ if (!orgId || !domain || !flags.username) {
21
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email create-mailbox --org <id> --domain <domain> --username <user>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
22
+ }
23
+ const address = await sdk_1.email.createMailbox(config.api_key, orgId, domain, flags.username);
20
24
  (0, output_js_1.success)(`Mailbox created: ${address.address}`);
21
25
  }
22
26
  async function listMailboxes(flags) {
23
27
  const config = (0, config_js_1.requireConfig)();
24
- const mailboxes = await sdk_1.email.listMailboxes(config.api_key);
28
+ const orgId = flags.org || config.default_org;
29
+ if (!orgId)
30
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email list-mailboxes --org <id>\n(Or set a default org via: myapi config set-org <id>)");
31
+ const mailboxes = await sdk_1.email.listMailboxes(config.api_key, orgId);
25
32
  (0, output_js_1.printTable)(mailboxes);
26
33
  }
27
34
  async function send(flags) {
28
- if (!flags.from || !flags.to || !flags.subject || !flags.body) {
29
- (0, output_js_1.error)("Missing --from, --to, --subject, or --body flags");
30
- }
31
35
  const config = (0, config_js_1.requireConfig)();
32
- const res = await sdk_1.email.sendEmail(config.api_key, {
36
+ const orgId = flags.org || config.default_org;
37
+ if (!orgId || !flags.from || !flags.to || !flags.subject || !flags.body) {
38
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email send --org <id> --from <email> --to <email> --subject <str> --body <str>");
39
+ }
40
+ const res = await sdk_1.email.sendEmail(config.api_key, orgId, {
33
41
  from: flags.from,
34
42
  to: [flags.to],
35
43
  subject: flags.subject,
@@ -38,24 +46,28 @@ async function send(flags) {
38
46
  (0, output_js_1.success)(`Email sent! Message ID: ${res.message_id}`);
39
47
  }
40
48
  async function inbox(address, flags) {
41
- if (!address)
42
- (0, output_js_1.error)("Missing address");
43
49
  const config = (0, config_js_1.requireConfig)();
44
- const messages = await sdk_1.email.getInbox(config.api_key, address);
50
+ const orgId = flags.org || config.default_org;
51
+ if (!orgId || !address)
52
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email inbox <address> --org <id>");
53
+ const messages = await sdk_1.email.getInbox(config.api_key, orgId, address);
45
54
  (0, output_js_1.printTable)(messages);
46
55
  }
47
56
  async function listTemplates(flags) {
48
57
  const config = (0, config_js_1.requireConfig)();
49
- const templates = await sdk_1.email.listTemplates(config.api_key);
58
+ const orgId = flags.org || config.default_org;
59
+ if (!orgId)
60
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email list-templates --org <id>\n(Or set a default org via: myapi config set-org <id>)");
61
+ const templates = await sdk_1.email.listTemplates(config.api_key, orgId);
50
62
  (0, output_js_1.printTable)(templates);
51
63
  }
52
64
  async function generateTemplate(flags) {
53
- if (!flags['org-id'] || !flags.prompt || !flags.name) {
54
- (0, output_js_1.error)("Missing --org-id, --prompt, or --name flags");
55
- }
56
65
  const config = (0, config_js_1.requireConfig)();
57
- const job = await sdk_1.email.generateTemplate(config.api_key, {
58
- org_id: flags['org-id'],
66
+ const orgId = flags.org || config.default_org;
67
+ if (!orgId || !flags.prompt || !flags.name) {
68
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email generate-template --org <id> --prompt <str> --name <str>");
69
+ }
70
+ const job = await sdk_1.email.generateTemplate(config.api_key, orgId, {
59
71
  prompt: flags.prompt,
60
72
  name: flags.name
61
73
  });
@@ -64,7 +76,7 @@ async function generateTemplate(flags) {
64
76
  let i = 0;
65
77
  let elapsed = 0;
66
78
  while (elapsed < 90000) {
67
- const status = await sdk_1.email.getTemplateJobStatus(config.api_key, job.job_id);
79
+ const status = await sdk_1.email.getTemplateJobStatus(config.api_key, orgId, job.job_id);
68
80
  if (status.status === 'completed') {
69
81
  process.stdout.write('\r\x1b[K');
70
82
  (0, output_js_1.success)(`Template generated! ID: ${status.template_id}\nPreview: ${status.result?.preview_url}`);
@@ -83,13 +95,60 @@ async function generateTemplate(flags) {
83
95
  }
84
96
  async function listCampaigns(flags) {
85
97
  const config = (0, config_js_1.requireConfig)();
86
- const campaigns = await sdk_1.email.listCampaigns(config.api_key);
98
+ const orgId = flags.org || config.default_org;
99
+ if (!orgId)
100
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email list-campaigns --org <id>\n(Or set a default org via: myapi config set-org <id>)");
101
+ const campaigns = await sdk_1.email.listCampaigns(config.api_key, orgId);
87
102
  (0, output_js_1.printTable)(campaigns);
88
103
  }
89
104
  async function campaignStats(id, flags) {
90
- if (!id)
91
- (0, output_js_1.error)("Missing campaign id");
92
105
  const config = (0, config_js_1.requireConfig)();
93
- const stats = await sdk_1.email.getCampaignStats(config.api_key, id);
106
+ const orgId = flags.org || config.default_org;
107
+ if (!orgId || !id)
108
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi email campaign-stats <id> --org <id>");
109
+ const stats = await sdk_1.email.getCampaignStats(config.api_key, orgId, id);
94
110
  (0, output_js_1.printJson)(stats);
95
111
  }
112
+ async function run(subcommand, args, flags) {
113
+ if (!subcommand || (flags.help && !subcommand)) {
114
+ (0, output_js_1.info)('Usage: myapi email <subcommand>\n\nSubcommands:\n create-mailbox Create a new mailbox\n list-mailboxes List mailboxes\n send Send an email\n inbox Read received emails\n list-templates List email templates\n generate-template Generate AI template\n list-campaigns List campaigns\n campaign-stats Get campaign stats\n\nNote: All email commands require the --org <id> flag.');
115
+ return;
116
+ }
117
+ if (flags.help) {
118
+ if (subcommand === 'create-mailbox')
119
+ (0, output_js_1.info)('Usage: myapi email create-mailbox --org <id> --domain <domain> --username <user>');
120
+ else if (subcommand === 'list-mailboxes')
121
+ (0, output_js_1.info)('Usage: myapi email list-mailboxes --org <id>');
122
+ else if (subcommand === 'send')
123
+ (0, output_js_1.info)('Usage: myapi email send --org <id> --from <email> --to <email> --subject <str> --body <str>');
124
+ else if (subcommand === 'inbox')
125
+ (0, output_js_1.info)('Usage: myapi email inbox <address> --org <id>');
126
+ else if (subcommand === 'list-templates')
127
+ (0, output_js_1.info)('Usage: myapi email list-templates --org <id>');
128
+ else if (subcommand === 'generate-template')
129
+ (0, output_js_1.info)('Usage: myapi email generate-template --org <id> --prompt <str> --name <str>');
130
+ else if (subcommand === 'list-campaigns')
131
+ (0, output_js_1.info)('Usage: myapi email list-campaigns --org <id>');
132
+ else if (subcommand === 'campaign-stats')
133
+ (0, output_js_1.info)('Usage: myapi email campaign-stats <campaign_id> --org <id>');
134
+ return;
135
+ }
136
+ if (subcommand === 'create-mailbox')
137
+ await createMailbox(flags);
138
+ else if (subcommand === 'list-mailboxes')
139
+ await listMailboxes(flags);
140
+ else if (subcommand === 'send')
141
+ await send(flags);
142
+ else if (subcommand === 'inbox')
143
+ await inbox(args[0], flags);
144
+ else if (subcommand === 'list-templates')
145
+ await listTemplates(flags);
146
+ else if (subcommand === 'generate-template')
147
+ await generateTemplate(flags);
148
+ else if (subcommand === 'list-campaigns')
149
+ await listCampaigns(flags);
150
+ else if (subcommand === 'campaign-stats')
151
+ await campaignStats(args[0], flags);
152
+ else
153
+ (0, output_js_1.error)(`Unknown subcommand: ${subcommand}. Run "myapi email --help" for a list of valid subcommands.`);
154
+ }
@@ -58,11 +58,15 @@ async function createNew(flags) {
58
58
  }
59
59
  async function list(flags) {
60
60
  if (flags.help) {
61
- (0, output_js_1.info)('Usage: myapi keys list\n\nLists all API keys associated with your account.');
61
+ (0, output_js_1.info)('Usage: myapi keys list [--json]\n\nLists all API keys associated with your account.');
62
62
  return;
63
63
  }
64
64
  const config = (0, config_js_1.requireConfig)();
65
65
  const keysList = await sdk_1.hq.listApiKeys(config.api_key);
66
+ if (flags.json) {
67
+ (0, output_js_1.printJson)(keysList);
68
+ return;
69
+ }
66
70
  const formattedKeys = keysList.map(k => {
67
71
  // Format creation date
68
72
  const createdDate = new Date(k.created_at);
@@ -71,13 +71,13 @@ async function importOrg(args, flags) {
71
71
  (0, output_js_1.info)('Usage: myapi org import <domain> --org <id>\n\nAutomatically extracts brand info from an existing website and updates the organization.\n\nNote: You must create a placeholder organization first using `myapi org create` to get an org_id.');
72
72
  return;
73
73
  }
74
- const domain = args[0];
75
- const orgId = flags.org;
74
+ const config = (0, config_js_1.requireConfig)();
75
+ const domain = args[0] || config.default_domain;
76
+ const orgId = flags.org || config.default_org;
76
77
  if (!domain || !orgId) {
77
- (0, output_js_1.error)("Missing required arguments.\nUsage: myapi org import <domain> --org <id>");
78
+ (0, output_js_1.error)("Missing required arguments.\nUsage: myapi org import <domain> --org <id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
78
79
  return;
79
80
  }
80
- const config = (0, config_js_1.requireConfig)();
81
81
  const result = await sdk_1.hq.importOrg(config.api_key, orgId, domain);
82
82
  const importId = result.job_id;
83
83
  process.stdout.write("Importing ");
package/dist/config.d.ts CHANGED
@@ -2,6 +2,8 @@ export interface Config {
2
2
  api_key: string;
3
3
  account_id: string;
4
4
  pin: string;
5
+ default_org?: string;
6
+ default_domain?: string;
5
7
  }
6
8
  export declare function loadConfig(): Config | null;
7
9
  export declare function saveConfig(config: Config): void;
package/dist/index.js CHANGED
@@ -42,7 +42,9 @@ const keysCmd = __importStar(require("./commands/keys.js"));
42
42
  const billingCmd = __importStar(require("./commands/billing.js"));
43
43
  const orgCmd = __importStar(require("./commands/org.js"));
44
44
  const setupCmd = __importStar(require("./commands/setup.js"));
45
+ const configCmd = __importStar(require("./commands/config.js"));
45
46
  const domainCmd = __importStar(require("./commands/domain.js"));
47
+ const emailCmd = __importStar(require("./commands/email.js"));
46
48
  async function main() {
47
49
  const { args, flags } = (0, utils_js_1.parseArgs)(process.argv.slice(2));
48
50
  if (args.length === 0) {
@@ -107,9 +109,15 @@ async function main() {
107
109
  else
108
110
  printHelp();
109
111
  break;
112
+ case 'config':
113
+ await configCmd.run(subcommand, restArgs, flags);
114
+ break;
110
115
  case 'domain':
111
116
  await domainCmd.run(subcommand, restArgs, flags);
112
117
  break;
118
+ case 'email':
119
+ await emailCmd.run(subcommand, restArgs, flags);
120
+ break;
113
121
  default:
114
122
  printHelp();
115
123
  process.exit(0);
@@ -135,7 +143,9 @@ Commands:
135
143
  billing Check balance and manage billing
136
144
  org Manage organizations
137
145
  setup Setup CLI credentials and view integration instructions
146
+ config Manage CLI defaults like org_id and domain
138
147
  domain Manage domain configurations
148
+ email Send emails and manage templates
139
149
 
140
150
  Run "myapi <command> --help" for subcommand help.`);
141
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
- "version": "1.0.12",
3
+ "version": "1.0.14",
4
4
  "description": "MyAPI command-line interface",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -0,0 +1,46 @@
1
+ import { requireConfig, saveConfig } from '../config.js';
2
+ import { success, error, info } from '../output.js';
3
+
4
+ export async function setOrg(id: string, flags: Record<string, string | boolean>) {
5
+ if (!id || flags.help) {
6
+ info("Usage: myapi config set-org <id>\n\nSets a default organization ID for subsequent commands.");
7
+ return;
8
+ }
9
+ const config = requireConfig();
10
+ config.default_org = id;
11
+ saveConfig(config);
12
+ success(`Default organization set to: ${id}`);
13
+ }
14
+
15
+ export async function setDomain(domain: string, flags: Record<string, string | boolean>) {
16
+ if (!domain || flags.help) {
17
+ info("Usage: myapi config set-domain <domain>\n\nSets a default domain for subsequent commands.");
18
+ return;
19
+ }
20
+ const config = requireConfig();
21
+ config.default_domain = domain;
22
+ saveConfig(config);
23
+ success(`Default domain set to: ${domain}`);
24
+ }
25
+
26
+ export async function view(flags: Record<string, string | boolean>) {
27
+ if (flags.help) {
28
+ info("Usage: myapi config view\n\nViews current config settings.");
29
+ return;
30
+ }
31
+ const config = requireConfig();
32
+ info(`Default Org: ${config.default_org || 'Not set'}`);
33
+ info(`Default Domain: ${config.default_domain || 'Not set'}`);
34
+ }
35
+
36
+ export async function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>) {
37
+ if (!subcommand || (flags.help && !subcommand)) {
38
+ info('Usage: myapi config <subcommand>\n\nSubcommands:\n view View current config\n set-org Set default organization\n set-domain Set default domain');
39
+ return;
40
+ }
41
+
42
+ if (subcommand === 'view') await view(flags);
43
+ else if (subcommand === 'set-org') await setOrg(args[0], flags);
44
+ else if (subcommand === 'set-domain') await setDomain(args[0], flags);
45
+ else error(`Unknown subcommand: ${subcommand}. Run "myapi config --help" for a list of valid subcommands.`);
46
+ }
@@ -2,10 +2,11 @@ import { domain as sdkDomain } from '@myapihq/sdk';
2
2
  import { requireConfig } from '../config.js';
3
3
  import { success, error, info, printTable, printJson } from '../output.js';
4
4
 
5
- export async function check(domain: string, flags: Record<string, string | boolean>) {
6
- const orgId = flags.org as string;
7
- if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain check <domain> --org <id>");
5
+ export async function check(domainArg: string, flags: Record<string, string | boolean>) {
8
6
  const config = requireConfig();
7
+ const orgId = (flags.org as string) || config.default_org;
8
+ const domain = domainArg || (config.default_domain as string);
9
+ if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain check <domain> --org <id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
9
10
  const res = await sdkDomain.checkDomain(config.api_key, orgId, domain);
10
11
  if (res.available) {
11
12
  info(`${domain} — Available ✓ Price: $${(res.price_cents / 100).toFixed(2)}/yr`);
@@ -14,22 +15,24 @@ export async function check(domain: string, flags: Record<string, string | boole
14
15
  }
15
16
  }
16
17
 
17
- export async function register(domain: string, flags: Record<string, string | boolean>) {
18
- const orgId = flags.org as string;
19
- if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain register <domain> --org <id> [--years <num>]");
20
- const years = parseInt(flags.years as string) || 1;
18
+ export async function register(domainArg: string, flags: Record<string, string | boolean>) {
21
19
  const config = requireConfig();
20
+ const orgId = (flags.org as string) || config.default_org;
21
+ const domain = domainArg || (config.default_domain as string);
22
+ if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain register <domain> --org <id> [--years <num>]\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
23
+ const years = parseInt(flags.years as string) || 1;
22
24
  const res = await sdkDomain.registerDomain(config.api_key, orgId, domain, years);
23
25
  success(`Registered ${domain}!\n${JSON.stringify(res, null, 2)}`);
24
26
  }
25
27
 
26
- export async function importDomain(domain: string, flags: Record<string, string | boolean>) {
27
- const orgId = flags.org as string;
28
- if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>");
28
+ export async function importDomain(domainArg: string, flags: Record<string, string | boolean>) {
29
+ const config = requireConfig();
30
+ const orgId = (flags.org as string) || config.default_org;
31
+ const domain = domainArg || (config.default_domain as string);
32
+ if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
29
33
  if (!flags['namecheap-user'] || !flags['namecheap-key']) {
30
34
  error("Missing required arguments.\nUsage: myapi domain import <domain> --org <id> --namecheap-user <user> --namecheap-key <key>");
31
35
  }
32
- const config = requireConfig();
33
36
  await sdkDomain.importDomain(config.api_key, orgId, {
34
37
  domain,
35
38
  namecheap_api_user: flags['namecheap-user'] as string,
@@ -39,43 +42,47 @@ export async function importDomain(domain: string, flags: Record<string, string
39
42
  }
40
43
 
41
44
  export async function list(flags: Record<string, string | boolean>) {
42
- const orgId = flags.org as string;
43
- if (!orgId) error("Missing required arguments.\nUsage: myapi domain list --org <id> [--filter=all|unassigned|org]");
44
45
  const config = requireConfig();
46
+ const orgId = (flags.org as string) || config.default_org;
47
+ if (!orgId) error("Missing required arguments.\nUsage: myapi domain list --org <id> [--filter=all|unassigned|org]\n(Or set a default org via: myapi config set-org <id>)");
45
48
  const filter = flags.filter as 'all' | 'unassigned' | 'org' | undefined;
46
49
  const domains = await sdkDomain.listDomains(config.api_key, orgId, filter);
47
50
  printTable(domains as unknown as Record<string, unknown>[]);
48
51
  }
49
52
 
50
- export async function assign(domain: string, flags: Record<string, string | boolean>) {
51
- const orgId = flags.org as string;
52
- const targetOrgId = flags.target as string;
53
- if (!orgId || !domain || !targetOrgId) error("Missing required arguments.\nUsage: myapi domain assign <domain> --org <id> --target <target_org_id>");
53
+ export async function assign(domainArg: string, flags: Record<string, string | boolean>) {
54
54
  const config = requireConfig();
55
+ const orgId = (flags.org as string) || config.default_org;
56
+ const domain = domainArg || (config.default_domain as string);
57
+ const targetOrgId = flags.target as string;
58
+ if (!orgId || !domain || !targetOrgId) error("Missing required arguments.\nUsage: myapi domain assign <domain> --org <id> --target <target_org_id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
55
59
  const res = await sdkDomain.assignDomain(config.api_key, orgId, domain, targetOrgId);
56
60
  success(`Assigned ${domain} to org ${targetOrgId}`);
57
61
  }
58
62
 
59
- export async function unassign(domain: string, flags: Record<string, string | boolean>) {
60
- const orgId = flags.org as string;
61
- if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain unassign <domain> --org <id>");
63
+ export async function unassign(domainArg: string, flags: Record<string, string | boolean>) {
62
64
  const config = requireConfig();
65
+ const orgId = (flags.org as string) || config.default_org;
66
+ const domain = domainArg || (config.default_domain as string);
67
+ if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain unassign <domain> --org <id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
63
68
  const res = await sdkDomain.unassignDomain(config.api_key, orgId, domain);
64
69
  success(`Unassigned ${domain} from org ${orgId}`);
65
70
  }
66
71
 
67
- export async function settings(domain: string, flags: Record<string, string | boolean>) {
68
- const orgId = flags.org as string;
69
- if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain settings <domain> --org <id>");
72
+ export async function settings(domainArg: string, flags: Record<string, string | boolean>) {
70
73
  const config = requireConfig();
74
+ const orgId = (flags.org as string) || config.default_org;
75
+ const domain = domainArg || (config.default_domain as string);
76
+ if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain settings <domain> --org <id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
71
77
  const res = await sdkDomain.getDomainSettings(config.api_key, orgId, domain);
72
78
  printJson(res);
73
79
  }
74
80
 
75
- export async function updateSettings(domain: string, flags: Record<string, string | boolean>) {
76
- const orgId = flags.org as string;
77
- if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain update-settings <domain> --org <id> [--security=...] [--browser-check=...] [--purge-cache]");
81
+ export async function updateSettings(domainArg: string, flags: Record<string, string | boolean>) {
78
82
  const config = requireConfig();
83
+ const orgId = (flags.org as string) || config.default_org;
84
+ const domain = domainArg || (config.default_domain as string);
85
+ if (!orgId || !domain) error("Missing required arguments.\nUsage: myapi domain update-settings <domain> --org <id> [--security=...] [--browser-check=...] [--purge-cache]\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
79
86
  const payload: any = {};
80
87
  if (flags.security) payload.security_level = flags.security as string;
81
88
  if (flags['browser-check']) payload.browser_check = flags['browser-check'] as string;
@@ -1,27 +1,34 @@
1
1
  import { email as sdkEmail } from '@myapihq/sdk';
2
2
  import { requireConfig } from '../config.js';
3
- import { success, error, printTable, printJson } from '../output.js';
3
+ import { success, error, printTable, printJson, info } from '../output.js';
4
4
  import { sleep } from '../utils.js';
5
5
 
6
6
  export async function createMailbox(flags: Record<string, string | boolean>) {
7
- if (!flags.domain || !flags.username) error("Missing --domain or --username flags");
8
7
  const config = requireConfig();
9
- const address = await sdkEmail.createMailbox(config.api_key, flags.domain as string, flags.username as string);
8
+ const orgId = (flags.org as string) || config.default_org;
9
+ const domain = (flags.domain as string) || config.default_domain;
10
+ if (!orgId || !domain || !flags.username) {
11
+ error("Missing required arguments.\nUsage: myapi email create-mailbox --org <id> --domain <domain> --username <user>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
12
+ }
13
+ const address = await sdkEmail.createMailbox(config.api_key, orgId, domain, flags.username as string);
10
14
  success(`Mailbox created: ${address.address}`);
11
15
  }
12
16
 
13
17
  export async function listMailboxes(flags: Record<string, string | boolean>) {
14
18
  const config = requireConfig();
15
- const mailboxes = await sdkEmail.listMailboxes(config.api_key);
19
+ const orgId = (flags.org as string) || config.default_org;
20
+ if (!orgId) error("Missing required arguments.\nUsage: myapi email list-mailboxes --org <id>\n(Or set a default org via: myapi config set-org <id>)");
21
+ const mailboxes = await sdkEmail.listMailboxes(config.api_key, orgId);
16
22
  printTable(mailboxes as unknown as Record<string, unknown>[]);
17
23
  }
18
24
 
19
25
  export async function send(flags: Record<string, string | boolean>) {
20
- if (!flags.from || !flags.to || !flags.subject || !flags.body) {
21
- error("Missing --from, --to, --subject, or --body flags");
22
- }
23
26
  const config = requireConfig();
24
- const res = await sdkEmail.sendEmail(config.api_key, {
27
+ const orgId = (flags.org as string) || config.default_org;
28
+ if (!orgId || !flags.from || !flags.to || !flags.subject || !flags.body) {
29
+ error("Missing required arguments.\nUsage: myapi email send --org <id> --from <email> --to <email> --subject <str> --body <str>");
30
+ }
31
+ const res = await sdkEmail.sendEmail(config.api_key, orgId, {
25
32
  from: flags.from as string,
26
33
  to: [flags.to as string],
27
34
  subject: flags.subject as string,
@@ -31,26 +38,29 @@ export async function send(flags: Record<string, string | boolean>) {
31
38
  }
32
39
 
33
40
  export async function inbox(address: string, flags: Record<string, string | boolean>) {
34
- if (!address) error("Missing address");
35
41
  const config = requireConfig();
36
- const messages = await sdkEmail.getInbox(config.api_key, address);
42
+ const orgId = (flags.org as string) || config.default_org;
43
+ if (!orgId || !address) error("Missing required arguments.\nUsage: myapi email inbox <address> --org <id>");
44
+ const messages = await sdkEmail.getInbox(config.api_key, orgId, address);
37
45
  printTable(messages as unknown as Record<string, unknown>[]);
38
46
  }
39
47
 
40
48
  export async function listTemplates(flags: Record<string, string | boolean>) {
41
49
  const config = requireConfig();
42
- const templates = await sdkEmail.listTemplates(config.api_key);
50
+ const orgId = (flags.org as string) || config.default_org;
51
+ if (!orgId) error("Missing required arguments.\nUsage: myapi email list-templates --org <id>\n(Or set a default org via: myapi config set-org <id>)");
52
+ const templates = await sdkEmail.listTemplates(config.api_key, orgId);
43
53
  printTable(templates as unknown as Record<string, unknown>[]);
44
54
  }
45
55
 
46
56
  export async function generateTemplate(flags: Record<string, string | boolean>) {
47
- if (!flags['org-id'] || !flags.prompt || !flags.name) {
48
- error("Missing --org-id, --prompt, or --name flags");
49
- }
50
57
  const config = requireConfig();
58
+ const orgId = (flags.org as string) || config.default_org;
59
+ if (!orgId || !flags.prompt || !flags.name) {
60
+ error("Missing required arguments.\nUsage: myapi email generate-template --org <id> --prompt <str> --name <str>");
61
+ }
51
62
 
52
- const job = await sdkEmail.generateTemplate(config.api_key, {
53
- org_id: flags['org-id'] as string,
63
+ const job = await sdkEmail.generateTemplate(config.api_key, orgId, {
54
64
  prompt: flags.prompt as string,
55
65
  name: flags.name as string
56
66
  });
@@ -61,7 +71,7 @@ export async function generateTemplate(flags: Record<string, string | boolean>)
61
71
  let elapsed = 0;
62
72
 
63
73
  while (elapsed < 90000) {
64
- const status = await sdkEmail.getTemplateJobStatus(config.api_key, job.job_id);
74
+ const status = await sdkEmail.getTemplateJobStatus(config.api_key, orgId, job.job_id);
65
75
  if (status.status === 'completed') {
66
76
  process.stdout.write('\r\x1b[K');
67
77
  success(`Template generated! ID: ${status.template_id}\nPreview: ${status.result?.preview_url}`);
@@ -81,13 +91,45 @@ export async function generateTemplate(flags: Record<string, string | boolean>)
81
91
 
82
92
  export async function listCampaigns(flags: Record<string, string | boolean>) {
83
93
  const config = requireConfig();
84
- const campaigns = await sdkEmail.listCampaigns(config.api_key);
94
+ const orgId = (flags.org as string) || config.default_org;
95
+ if (!orgId) error("Missing required arguments.\nUsage: myapi email list-campaigns --org <id>\n(Or set a default org via: myapi config set-org <id>)");
96
+ const campaigns = await sdkEmail.listCampaigns(config.api_key, orgId);
85
97
  printTable(campaigns as unknown as Record<string, unknown>[]);
86
98
  }
87
99
 
88
100
  export async function campaignStats(id: string, flags: Record<string, string | boolean>) {
89
- if (!id) error("Missing campaign id");
90
101
  const config = requireConfig();
91
- const stats = await sdkEmail.getCampaignStats(config.api_key, id);
102
+ const orgId = (flags.org as string) || config.default_org;
103
+ if (!orgId || !id) error("Missing required arguments.\nUsage: myapi email campaign-stats <id> --org <id>");
104
+ const stats = await sdkEmail.getCampaignStats(config.api_key, orgId, id);
92
105
  printJson(stats);
93
106
  }
107
+
108
+ export async function run(subcommand: string | undefined, args: string[], flags: Record<string, string | boolean>) {
109
+ if (!subcommand || (flags.help && !subcommand)) {
110
+ info('Usage: myapi email <subcommand>\n\nSubcommands:\n create-mailbox Create a new mailbox\n list-mailboxes List mailboxes\n send Send an email\n inbox Read received emails\n list-templates List email templates\n generate-template Generate AI template\n list-campaigns List campaigns\n campaign-stats Get campaign stats\n\nNote: All email commands require the --org <id> flag.');
111
+ return;
112
+ }
113
+
114
+ if (flags.help) {
115
+ if (subcommand === 'create-mailbox') info('Usage: myapi email create-mailbox --org <id> --domain <domain> --username <user>');
116
+ else if (subcommand === 'list-mailboxes') info('Usage: myapi email list-mailboxes --org <id>');
117
+ else if (subcommand === 'send') info('Usage: myapi email send --org <id> --from <email> --to <email> --subject <str> --body <str>');
118
+ else if (subcommand === 'inbox') info('Usage: myapi email inbox <address> --org <id>');
119
+ else if (subcommand === 'list-templates') info('Usage: myapi email list-templates --org <id>');
120
+ else if (subcommand === 'generate-template') info('Usage: myapi email generate-template --org <id> --prompt <str> --name <str>');
121
+ else if (subcommand === 'list-campaigns') info('Usage: myapi email list-campaigns --org <id>');
122
+ else if (subcommand === 'campaign-stats') info('Usage: myapi email campaign-stats <campaign_id> --org <id>');
123
+ return;
124
+ }
125
+
126
+ if (subcommand === 'create-mailbox') await createMailbox(flags);
127
+ else if (subcommand === 'list-mailboxes') await listMailboxes(flags);
128
+ else if (subcommand === 'send') await send(flags);
129
+ else if (subcommand === 'inbox') await inbox(args[0], flags);
130
+ else if (subcommand === 'list-templates') await listTemplates(flags);
131
+ else if (subcommand === 'generate-template') await generateTemplate(flags);
132
+ else if (subcommand === 'list-campaigns') await listCampaigns(flags);
133
+ else if (subcommand === 'campaign-stats') await campaignStats(args[0], flags);
134
+ else error(`Unknown subcommand: ${subcommand}. Run "myapi email --help" for a list of valid subcommands.`);
135
+ }
@@ -1,6 +1,6 @@
1
1
  import { hq } from '@myapihq/sdk';
2
2
  import { requireConfig } from '../config.js';
3
- import { success, error, printTable, info } from '../output.js';
3
+ import { success, error, printTable, info, printJson } from '../output.js';
4
4
  import * as readline from 'readline';
5
5
 
6
6
  export async function createNew(flags: Record<string, string | boolean>) {
@@ -24,12 +24,17 @@ export async function createNew(flags: Record<string, string | boolean>) {
24
24
 
25
25
  export async function list(flags: Record<string, string | boolean>) {
26
26
  if (flags.help) {
27
- info('Usage: myapi keys list\n\nLists all API keys associated with your account.');
27
+ info('Usage: myapi keys list [--json]\n\nLists all API keys associated with your account.');
28
28
  return;
29
29
  }
30
30
  const config = requireConfig();
31
31
  const keysList = await hq.listApiKeys(config.api_key);
32
32
 
33
+ if (flags.json) {
34
+ printJson(keysList);
35
+ return;
36
+ }
37
+
33
38
  const formattedKeys = keysList.map(k => {
34
39
  // Format creation date
35
40
  const createdDate = new Date(k.created_at);
@@ -66,14 +66,14 @@ export async function importOrg(args: string[], flags: Record<string, string | b
66
66
  info('Usage: myapi org import <domain> --org <id>\n\nAutomatically extracts brand info from an existing website and updates the organization.\n\nNote: You must create a placeholder organization first using `myapi org create` to get an org_id.');
67
67
  return;
68
68
  }
69
- const domain = args[0];
70
- const orgId = flags.org as string;
69
+ const config = requireConfig();
70
+ const domain = args[0] || (config.default_domain as string);
71
+ const orgId = (flags.org as string) || config.default_org;
71
72
 
72
73
  if (!domain || !orgId) {
73
- error("Missing required arguments.\nUsage: myapi org import <domain> --org <id>");
74
+ error("Missing required arguments.\nUsage: myapi org import <domain> --org <id>\n(Or set defaults via: myapi config set-org <id> / set-domain <domain>)");
74
75
  return;
75
76
  }
76
- const config = requireConfig();
77
77
 
78
78
  const result = await hq.importOrg(config.api_key, orgId, domain);
79
79
  const importId = result.job_id;
package/src/config.ts CHANGED
@@ -6,6 +6,8 @@ export interface Config {
6
6
  api_key: string;
7
7
  account_id: string;
8
8
  pin: string;
9
+ default_org?: string;
10
+ default_domain?: string;
9
11
  }
10
12
 
11
13
  const CONFIG_DIR = path.join(os.homedir(), '.myapi');
package/src/index.ts CHANGED
@@ -7,7 +7,9 @@ import * as keysCmd from './commands/keys.js';
7
7
  import * as billingCmd from './commands/billing.js';
8
8
  import * as orgCmd from './commands/org.js';
9
9
  import * as setupCmd from './commands/setup.js';
10
+ import * as configCmd from './commands/config.js';
10
11
  import * as domainCmd from './commands/domain.js';
12
+ import * as emailCmd from './commands/email.js';
11
13
 
12
14
  async function main() {
13
15
  const { args, flags } = parseArgs(process.argv.slice(2));
@@ -55,9 +57,15 @@ async function main() {
55
57
  else if (subcommand === 'setup') await billingCmd.setup(flags);
56
58
  else printHelp();
57
59
  break;
60
+ case 'config':
61
+ await configCmd.run(subcommand, restArgs, flags);
62
+ break;
58
63
  case 'domain':
59
64
  await domainCmd.run(subcommand, restArgs, flags);
60
65
  break;
66
+ case 'email':
67
+ await emailCmd.run(subcommand, restArgs, flags);
68
+ break;
61
69
  default:
62
70
  printHelp();
63
71
  process.exit(0);
@@ -81,7 +89,9 @@ Commands:
81
89
  billing Check balance and manage billing
82
90
  org Manage organizations
83
91
  setup Setup CLI credentials and view integration instructions
92
+ config Manage CLI defaults like org_id and domain
84
93
  domain Manage domain configurations
94
+ email Send emails and manage templates
85
95
 
86
96
  Run "myapi <command> --help" for subcommand help.`);
87
97
  }