@myapihq/cli 1.0.59 → 1.0.61

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.
@@ -31,7 +31,9 @@ export async function register(domainArg, flags) {
31
31
  const years = parseInt(flags.years) || 1;
32
32
  const res = await sdkDomain.registerDomain(config.api_key, orgId, domain, years);
33
33
  success(`Registered ${domain}!`);
34
- info(`Next: assign it to your org so your funnel goes live:\n myapi domain assign ${domain} --org ${orgId}`);
34
+ info(`Assign it to your org now:\n myapi domain assign ${domain} --org ${orgId}`);
35
+ info(`DNS propagation can take a few minutes — track it with: myapi domain status ${domain}`);
36
+ info(`Your funnel will be live on https://${domain} once propagation completes.`);
35
37
  }
36
38
  export async function importDomain(domainArg, flags) {
37
39
  const config = requireConfig();
@@ -93,6 +95,8 @@ export async function status(domainArg, flags) {
93
95
  info(`Status: ${res.status}`);
94
96
  if (res.expires_at)
95
97
  info(`Expires: ${formatDate(res.expires_at)}`);
98
+ if (res.status === 'active')
99
+ info(`Note: if recently activated, the SSL certificate may still be provisioning — allow a few minutes before the site is reachable over HTTPS.`);
96
100
  }
97
101
  export async function settings(domainArg, flags) {
98
102
  const config = requireConfig();
@@ -1,5 +1,5 @@
1
1
  import { funnel as sdkFunnel, hq } from '@myapihq/sdk';
2
- import { requireConfig } from '../config.js';
2
+ import { requireConfig, saveConfig } from '../config.js';
3
3
  import { success, error, printTable, info, printJson } from '../output.js';
4
4
  import { formatDate } from '../utils.js';
5
5
  export async function list(flags) {
@@ -47,14 +47,21 @@ export async function del(id, flags) {
47
47
  export async function push(id, slug, flags) {
48
48
  const config = requireConfig();
49
49
  const orgId = flags.org || config.default_org;
50
- const funnelId = id || config.default_funnel;
50
+ if (!orgId)
51
+ error("Missing org. Set a default with: myapi auth config set-org <id>");
51
52
  if (slug && flags.slug && slug !== flags.slug) {
52
53
  info(`› Note: positional slug "${slug}" takes precedence over --slug "${flags.slug}".`);
53
54
  }
54
55
  const rawSlug = slug || flags.slug || '/';
55
56
  const finalSlug = rawSlug.startsWith('/') ? rawSlug : `/${rawSlug}`;
56
- if (!orgId || !funnelId) {
57
- error("Missing required arguments.\nUsage: myapi funnel push [funnel_id] [slug] < index.html\n(Defaults to your configured funnel and slug '/' when omitted)");
57
+ let funnelId = id || config.default_funnel;
58
+ if (!funnelId) {
59
+ const existing = await sdkFunnel.listFunnels(config.api_key, orgId);
60
+ if (existing.length === 0)
61
+ error("No funnel found for this org. Try: myapi auth config set-org <id>");
62
+ funnelId = existing[0].id;
63
+ config.default_funnel = funnelId;
64
+ saveConfig(config);
58
65
  }
59
66
  const html = await new Promise((resolve, reject) => {
60
67
  let data = '';
@@ -1,5 +1,6 @@
1
- import { hq } from '@myapihq/sdk';
2
- import { requireConfig } from '../config.js';
1
+ import * as readline from 'readline';
2
+ import { hq, funnel as sdkFunnel } from '@myapihq/sdk';
3
+ import { requireConfig, saveConfig } from '../config.js';
3
4
  import { success, error, printTable, printJson, info } from '../output.js';
4
5
  import { sleep, formatDate } from '../utils.js';
5
6
  export async function create(flags) {
@@ -26,6 +27,21 @@ export async function create(flags) {
26
27
  if (org.preview_subdomain) {
27
28
  info(`Preview domain: https://${org.preview_subdomain}.makeautonomous.com`);
28
29
  }
30
+ const setDefault = flags.yes || await new Promise(resolve => {
31
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
32
+ rl.question(`› Set as default org and funnel? (Y/n) `, ans => {
33
+ rl.close();
34
+ resolve(ans.trim().toLowerCase() !== 'n');
35
+ });
36
+ });
37
+ if (setDefault) {
38
+ config.default_org = org.id;
39
+ const funnels = await sdkFunnel.listFunnels(config.api_key, org.id);
40
+ if (funnels.length > 0)
41
+ config.default_funnel = funnels[0].id;
42
+ saveConfig(config);
43
+ success(`Default org${funnels.length > 0 ? ' and funnel' : ''} updated.`);
44
+ }
29
45
  }
30
46
  export async function list(flags) {
31
47
  if (flags.help) {
package/dist/index.js CHANGED
@@ -108,7 +108,7 @@ async function main() {
108
108
  break;
109
109
  case 'org':
110
110
  if (!subcommand || (flags.help && !subcommand)) {
111
- info('Usage: myapi org <subcommand>\n\nSubcommands:\n list List organizations\n create Create an organization\n get Get details of an organization\n delete Delete an organization\n import Extract org from domain');
111
+ info('Usage: myapi org <subcommand>\n\nSubcommands:\n list List organizations\n create Create an organization (use --yes to auto-set it as your default org and funnel)\n get Get details of an organization\n delete Delete an organization\n import Extract org from domain');
112
112
  break;
113
113
  }
114
114
  if (subcommand === 'list')
@@ -199,8 +199,7 @@ function printHelp() {
199
199
  const config = loadConfig();
200
200
  const quickStart = config?.api_key
201
201
  ? `Quick start:
202
- myapi funnel create
203
- echo '<h1>Hello!</h1>' | myapi funnel push <funnel_id> /`
202
+ echo '<h1>Hello!</h1>' | myapi funnel push /`
204
203
  : `Quick start:
205
204
  myapi auth setup --help`;
206
205
  info(`myapi - MyAPI command-line interface
@@ -211,10 +210,10 @@ Usage: myapi <command> [subcommand] [args]
211
210
  Commands:
212
211
  auth Manage account · setup · whoami · link
213
212
  billing Check balance and manage billing
214
- org Manage organizations
213
+ org Manage organizations (tip: myapi org create "name" --yes to auto-set as default)
215
214
  update Update CLI and skills to the latest version
216
215
  domain Manage domain configurations
217
- funnel Manage headless funnels and pages
216
+ funnel Manage websites (publish pages, custom domains, funnels)
218
217
 
219
218
  Aliases:
220
219
  whoami → myapi auth whoami
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "description": "MyAPI command-line interface",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,7 +30,9 @@ export async function register(domainArg: string, flags: Record<string, string |
30
30
  const years = parseInt(flags.years as string) || 1;
31
31
  const res = await sdkDomain.registerDomain(config.api_key, orgId, domain, years);
32
32
  success(`Registered ${domain}!`);
33
- info(`Next: assign it to your org so your funnel goes live:\n myapi domain assign ${domain} --org ${orgId}`);
33
+ info(`Assign it to your org now:\n myapi domain assign ${domain} --org ${orgId}`);
34
+ info(`DNS propagation can take a few minutes — track it with: myapi domain status ${domain}`);
35
+ info(`Your funnel will be live on https://${domain} once propagation completes.`);
34
36
  }
35
37
 
36
38
  export async function importDomain(domainArg: string, flags: Record<string, string | boolean>) {
@@ -86,6 +88,7 @@ export async function status(domainArg: string, flags: Record<string, string | b
86
88
  info(`Domain: ${res.domain}`);
87
89
  info(`Status: ${res.status}`);
88
90
  if ((res as any).expires_at) info(`Expires: ${formatDate((res as any).expires_at)}`);
91
+ if (res.status === 'active') info(`Note: if recently activated, the SSL certificate may still be provisioning — allow a few minutes before the site is reachable over HTTPS.`);
89
92
  }
90
93
 
91
94
  export async function settings(domainArg: string, flags: Record<string, string | boolean>) {
@@ -1,5 +1,5 @@
1
1
  import { funnel as sdkFunnel, hq } from '@myapihq/sdk';
2
- import { requireConfig } from '../config.js';
2
+ import { requireConfig, saveConfig } from '../config.js';
3
3
  import { success, error, printTable, info, printJson } from '../output.js';
4
4
  import { formatDate } from '../utils.js';
5
5
  import * as fs from 'fs';
@@ -47,15 +47,21 @@ export async function del(id: string, flags: Record<string, string | boolean>) {
47
47
  export async function push(id: string, slug: string, flags: Record<string, string | boolean>) {
48
48
  const config = requireConfig();
49
49
  const orgId = (flags.org as string) || config.default_org;
50
- const funnelId = id || config.default_funnel;
50
+ if (!orgId) error("Missing org. Set a default with: myapi auth config set-org <id>");
51
+
51
52
  if (slug && flags.slug && slug !== flags.slug) {
52
53
  info(`› Note: positional slug "${slug}" takes precedence over --slug "${flags.slug}".`);
53
54
  }
54
55
  const rawSlug = slug || (flags.slug as string) || '/';
55
56
  const finalSlug = rawSlug.startsWith('/') ? rawSlug : `/${rawSlug}`;
56
57
 
57
- if (!orgId || !funnelId) {
58
- error("Missing required arguments.\nUsage: myapi funnel push [funnel_id] [slug] < index.html\n(Defaults to your configured funnel and slug '/' when omitted)");
58
+ let funnelId = id || config.default_funnel;
59
+ if (!funnelId) {
60
+ const existing = await sdkFunnel.listFunnels(config.api_key, orgId);
61
+ if (existing.length === 0) error("No funnel found for this org. Try: myapi auth config set-org <id>");
62
+ funnelId = existing[0].id;
63
+ config.default_funnel = funnelId;
64
+ saveConfig(config);
59
65
  }
60
66
 
61
67
  const html = await new Promise<string>((resolve, reject) => {
@@ -1,5 +1,6 @@
1
- import { hq } from '@myapihq/sdk';
2
- import { requireConfig } from '../config.js';
1
+ import * as readline from 'readline';
2
+ import { hq, funnel as sdkFunnel } from '@myapihq/sdk';
3
+ import { requireConfig, saveConfig } from '../config.js';
3
4
  import { success, error, printTable, printJson, info } from '../output.js';
4
5
  import { sleep, formatDate } from '../utils.js';
5
6
 
@@ -24,6 +25,22 @@ export async function create(flags: Record<string, string | boolean>) {
24
25
  if (org.preview_subdomain) {
25
26
  info(`Preview domain: https://${org.preview_subdomain}.makeautonomous.com`);
26
27
  }
28
+
29
+ const setDefault = flags.yes || await new Promise<boolean>(resolve => {
30
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
31
+ rl.question(`› Set as default org and funnel? (Y/n) `, ans => {
32
+ rl.close();
33
+ resolve(ans.trim().toLowerCase() !== 'n');
34
+ });
35
+ });
36
+
37
+ if (setDefault) {
38
+ config.default_org = org.id;
39
+ const funnels = await sdkFunnel.listFunnels(config.api_key, org.id);
40
+ if (funnels.length > 0) config.default_funnel = funnels[0].id;
41
+ saveConfig(config);
42
+ success(`Default org${funnels.length > 0 ? ' and funnel' : ''} updated.`);
43
+ }
27
44
  }
28
45
 
29
46
  export async function list(flags: Record<string, string | boolean>) {
package/src/index.ts CHANGED
@@ -102,7 +102,7 @@ async function main() {
102
102
  break;
103
103
  case 'org':
104
104
  if (!subcommand || (flags.help && !subcommand)) {
105
- info('Usage: myapi org <subcommand>\n\nSubcommands:\n list List organizations\n create Create an organization\n get Get details of an organization\n delete Delete an organization\n import Extract org from domain');
105
+ info('Usage: myapi org <subcommand>\n\nSubcommands:\n list List organizations\n create Create an organization (use --yes to auto-set it as your default org and funnel)\n get Get details of an organization\n delete Delete an organization\n import Extract org from domain');
106
106
  break;
107
107
  }
108
108
  if (subcommand === 'list') await orgCmd.list(flags);
@@ -170,8 +170,7 @@ function printHelp() {
170
170
  const config = loadConfig();
171
171
  const quickStart = config?.api_key
172
172
  ? `Quick start:
173
- myapi funnel create
174
- echo '<h1>Hello!</h1>' | myapi funnel push <funnel_id> /`
173
+ echo '<h1>Hello!</h1>' | myapi funnel push /`
175
174
  : `Quick start:
176
175
  myapi auth setup --help`;
177
176
  info(`myapi - MyAPI command-line interface
@@ -182,10 +181,10 @@ Usage: myapi <command> [subcommand] [args]
182
181
  Commands:
183
182
  auth Manage account · setup · whoami · link
184
183
  billing Check balance and manage billing
185
- org Manage organizations
184
+ org Manage organizations (tip: myapi org create "name" --yes to auto-set as default)
186
185
  update Update CLI and skills to the latest version
187
186
  domain Manage domain configurations
188
- funnel Manage headless funnels and pages
187
+ funnel Manage websites (publish pages, custom domains, funnels)
189
188
 
190
189
  Aliases:
191
190
  whoami → myapi auth whoami