unbound-cli 0.1.7 → 0.1.8
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.
- package/package.json +1 -1
- package/src/commands/login.js +2 -3
- package/src/commands/status.js +8 -11
- package/src/index.js +16 -35
package/package.json
CHANGED
package/src/commands/login.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const { Option } = require('commander');
|
|
1
2
|
const config = require('../config');
|
|
2
3
|
const output = require('../output');
|
|
3
4
|
const api = require('../api');
|
|
@@ -8,7 +9,7 @@ function register(program) {
|
|
|
8
9
|
.command('login')
|
|
9
10
|
.description('Authenticate with Unbound. Opens a browser for interactive login, or use --api-key for CI/CD environments.')
|
|
10
11
|
.option('--api-key <key>', 'Authenticate with an API key directly (non-interactive)')
|
|
11
|
-
.
|
|
12
|
+
.addOption(new Option('--base-url <url>', 'Set a custom API base URL').hideHelp())
|
|
12
13
|
.option('--domain <domain>', 'Use a custom domain for login (e.g. custom.example.com)')
|
|
13
14
|
.addHelpText('after', `
|
|
14
15
|
Authentication methods:
|
|
@@ -23,13 +24,11 @@ Authentication methods:
|
|
|
23
24
|
|
|
24
25
|
Options:
|
|
25
26
|
--domain sets a custom domain for organizations with self-hosted frontends.
|
|
26
|
-
--base-url sets the backend API URL before authenticating (persisted).
|
|
27
27
|
|
|
28
28
|
Examples:
|
|
29
29
|
$ unbound login # Login via default gateway
|
|
30
30
|
$ unbound login --domain custom.example.com # Login via custom domain
|
|
31
31
|
$ unbound login --api-key sk-abc123 # Non-interactive login
|
|
32
|
-
$ unbound login --base-url http://localhost:8000 # Use local backend
|
|
33
32
|
`)
|
|
34
33
|
.action(async (opts) => {
|
|
35
34
|
try {
|
package/src/commands/status.js
CHANGED
|
@@ -8,13 +8,12 @@ function register(program) {
|
|
|
8
8
|
.description('Show the current CLI status including config location, login state, and API connectivity. Useful for debugging connection issues.')
|
|
9
9
|
.addHelpText('after', `
|
|
10
10
|
Output fields:
|
|
11
|
-
Config file
|
|
12
|
-
Logged in
|
|
13
|
-
Email
|
|
14
|
-
Organization
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
API status - Connectivity check result (Connected / Error)
|
|
11
|
+
Config file - Path to the config file (~/.unbound/config.json)
|
|
12
|
+
Logged in - Whether credentials are stored (Yes/No)
|
|
13
|
+
Email - The authenticated user's email (if logged in)
|
|
14
|
+
Organization - The organization name (if logged in)
|
|
15
|
+
Unbound Gateway - The Unbound gateway URL (if logged in)
|
|
16
|
+
API status - Connectivity check result (Connected / Error)
|
|
18
17
|
|
|
19
18
|
Examples:
|
|
20
19
|
$ unbound status
|
|
@@ -34,8 +33,7 @@ Examples:
|
|
|
34
33
|
if (loggedIn) {
|
|
35
34
|
pairs.push(['Email', cfg.email || '-']);
|
|
36
35
|
pairs.push(['Organization', cfg.org_name || '-']);
|
|
37
|
-
pairs.push(['
|
|
38
|
-
pairs.push(['Frontend URL', config.getFrontendUrl()]);
|
|
36
|
+
pairs.push(['Unbound Gateway', config.getFrontendUrl()]);
|
|
39
37
|
}
|
|
40
38
|
|
|
41
39
|
// Check API connectivity
|
|
@@ -59,8 +57,7 @@ Examples:
|
|
|
59
57
|
logged_in: loggedIn,
|
|
60
58
|
email: loggedIn ? (cfg.email || null) : null,
|
|
61
59
|
organization: loggedIn ? (cfg.org_name || null) : null,
|
|
62
|
-
|
|
63
|
-
frontend_url: loggedIn ? config.getFrontendUrl() : null,
|
|
60
|
+
gateway_url: loggedIn ? config.getFrontendUrl() : null,
|
|
64
61
|
api_status: connectivity,
|
|
65
62
|
});
|
|
66
63
|
return;
|
package/src/index.js
CHANGED
|
@@ -67,14 +67,6 @@ TOOL CONNECTIONS
|
|
|
67
67
|
|
|
68
68
|
CONFIGURATION
|
|
69
69
|
$ unbound config show Show all settings
|
|
70
|
-
$ unbound config set-url <url> Set API base URL
|
|
71
|
-
$ unbound config set-frontend-url <url> Set frontend URL
|
|
72
|
-
$ unbound config reset-url Reset API URL to default
|
|
73
|
-
$ unbound config reset-frontend-url Reset frontend URL to default
|
|
74
|
-
|
|
75
|
-
ENVIRONMENT VARIABLES
|
|
76
|
-
UNBOUND_API_URL Override the API base URL (e.g. http://localhost:8000)
|
|
77
|
-
UNBOUND_FRONTEND_URL Override the frontend URL (e.g. http://localhost:3000)
|
|
78
70
|
|
|
79
71
|
FILES
|
|
80
72
|
~/.unbound/config.json Credentials and CLI settings
|
|
@@ -98,31 +90,27 @@ require('./commands/setup').register(program);
|
|
|
98
90
|
// config command for managing CLI settings
|
|
99
91
|
const configCmd = program
|
|
100
92
|
.command('config')
|
|
101
|
-
.description('Manage CLI configuration
|
|
93
|
+
.description('Manage CLI configuration settings.');
|
|
102
94
|
|
|
95
|
+
// Internal/dev commands — hidden from help but still functional
|
|
103
96
|
configCmd
|
|
104
|
-
.command('set-url <url>')
|
|
105
|
-
.description('Set the API base URL
|
|
106
|
-
.addHelpText('after', `
|
|
107
|
-
Examples:
|
|
108
|
-
$ unbound config set-url http://localhost:8000 # Local development
|
|
109
|
-
$ unbound config set-url https://backend.getunbound.ai # Production (default)
|
|
110
|
-
`)
|
|
97
|
+
.command('set-url <url>', { hidden: true })
|
|
98
|
+
.description('Set the API base URL (internal)')
|
|
111
99
|
.action((url) => {
|
|
112
100
|
config.setBaseUrl(url);
|
|
113
101
|
output.success(`API base URL set to ${url}`);
|
|
114
102
|
});
|
|
115
103
|
|
|
116
104
|
configCmd
|
|
117
|
-
.command('get-url')
|
|
118
|
-
.description('Show the current API base URL
|
|
105
|
+
.command('get-url', { hidden: true })
|
|
106
|
+
.description('Show the current API base URL (internal)')
|
|
119
107
|
.action(() => {
|
|
120
108
|
console.log(config.getBaseUrl());
|
|
121
109
|
});
|
|
122
110
|
|
|
123
111
|
configCmd
|
|
124
|
-
.command('reset-url')
|
|
125
|
-
.description('Reset the API base URL to
|
|
112
|
+
.command('reset-url', { hidden: true })
|
|
113
|
+
.description('Reset the API base URL to default (internal)')
|
|
126
114
|
.action(() => {
|
|
127
115
|
const cfg = config.readConfig();
|
|
128
116
|
delete cfg.base_url;
|
|
@@ -131,28 +119,23 @@ configCmd
|
|
|
131
119
|
});
|
|
132
120
|
|
|
133
121
|
configCmd
|
|
134
|
-
.command('set-frontend-url <url>')
|
|
135
|
-
.description('Set the frontend URL
|
|
136
|
-
.addHelpText('after', `
|
|
137
|
-
Examples:
|
|
138
|
-
$ unbound config set-frontend-url http://localhost:3000 # Local development
|
|
139
|
-
$ unbound config set-frontend-url https://gateway.getunbound.ai # Production (default)
|
|
140
|
-
`)
|
|
122
|
+
.command('set-frontend-url <url>', { hidden: true })
|
|
123
|
+
.description('Set the frontend URL (internal)')
|
|
141
124
|
.action((url) => {
|
|
142
125
|
config.setFrontendUrl(url);
|
|
143
126
|
output.success(`Frontend URL set to ${url}`);
|
|
144
127
|
});
|
|
145
128
|
|
|
146
129
|
configCmd
|
|
147
|
-
.command('get-frontend-url')
|
|
148
|
-
.description('Show the current frontend URL
|
|
130
|
+
.command('get-frontend-url', { hidden: true })
|
|
131
|
+
.description('Show the current frontend URL (internal)')
|
|
149
132
|
.action(() => {
|
|
150
133
|
console.log(config.getFrontendUrl());
|
|
151
134
|
});
|
|
152
135
|
|
|
153
136
|
configCmd
|
|
154
|
-
.command('reset-frontend-url')
|
|
155
|
-
.description('Reset the frontend URL to
|
|
137
|
+
.command('reset-frontend-url', { hidden: true })
|
|
138
|
+
.description('Reset the frontend URL to default (internal)')
|
|
156
139
|
.action(() => {
|
|
157
140
|
const cfg = config.readConfig();
|
|
158
141
|
delete cfg.frontend_url;
|
|
@@ -170,8 +153,7 @@ configCmd
|
|
|
170
153
|
if (opts.json) {
|
|
171
154
|
output.json({
|
|
172
155
|
config_file: config.CONFIG_FILE,
|
|
173
|
-
|
|
174
|
-
frontend_url: config.getFrontendUrl(),
|
|
156
|
+
gateway_url: config.getFrontendUrl(),
|
|
175
157
|
logged_in: config.isLoggedIn(),
|
|
176
158
|
email: cfg.email || null,
|
|
177
159
|
organization: cfg.org_name || null,
|
|
@@ -181,8 +163,7 @@ configCmd
|
|
|
181
163
|
|
|
182
164
|
output.keyValue([
|
|
183
165
|
['Config file', config.CONFIG_FILE],
|
|
184
|
-
['
|
|
185
|
-
['Frontend URL', config.getFrontendUrl()],
|
|
166
|
+
['Unbound Gateway', config.getFrontendUrl()],
|
|
186
167
|
['Logged in', config.isLoggedIn() ? 'Yes' : 'No'],
|
|
187
168
|
['Email', cfg.email || '-'],
|
|
188
169
|
['Organization', cfg.org_name || '-'],
|