@myapihq/cli 1.0.60 → 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.
@@ -95,6 +95,8 @@ export async function status(domainArg, flags) {
95
95
  info(`Status: ${res.status}`);
96
96
  if (res.expires_at)
97
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.`);
98
100
  }
99
101
  export async function settings(domainArg, flags) {
100
102
  const config = requireConfig();
@@ -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')
@@ -210,10 +210,10 @@ Usage: myapi <command> [subcommand] [args]
210
210
  Commands:
211
211
  auth Manage account · setup · whoami · link
212
212
  billing Check balance and manage billing
213
- org Manage organizations
213
+ org Manage organizations (tip: myapi org create "name" --yes to auto-set as default)
214
214
  update Update CLI and skills to the latest version
215
215
  domain Manage domain configurations
216
- funnel Manage headless funnels and pages
216
+ funnel Manage websites (publish pages, custom domains, funnels)
217
217
 
218
218
  Aliases:
219
219
  whoami → myapi auth whoami
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myapihq/cli",
3
- "version": "1.0.60",
3
+ "version": "1.0.61",
4
4
  "description": "MyAPI command-line interface",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -88,6 +88,7 @@ export async function status(domainArg: string, flags: Record<string, string | b
88
88
  info(`Domain: ${res.domain}`);
89
89
  info(`Status: ${res.status}`);
90
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.`);
91
92
  }
92
93
 
93
94
  export async function settings(domainArg: string, flags: Record<string, string | boolean>) {
@@ -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);
@@ -181,10 +181,10 @@ Usage: myapi <command> [subcommand] [args]
181
181
  Commands:
182
182
  auth Manage account · setup · whoami · link
183
183
  billing Check balance and manage billing
184
- org Manage organizations
184
+ org Manage organizations (tip: myapi org create "name" --yes to auto-set as default)
185
185
  update Update CLI and skills to the latest version
186
186
  domain Manage domain configurations
187
- funnel Manage headless funnels and pages
187
+ funnel Manage websites (publish pages, custom domains, funnels)
188
188
 
189
189
  Aliases:
190
190
  whoami → myapi auth whoami