@lanonasis/cli 1.5.0 → 1.5.2
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/README.md +284 -586
- package/dist/commands/api-keys.d.ts +3 -0
- package/dist/commands/api-keys.js +812 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +127 -138
- package/dist/commands/completion.d.ts +33 -0
- package/dist/commands/completion.js +378 -0
- package/dist/commands/guide.d.ts +19 -0
- package/dist/commands/guide.js +446 -0
- package/dist/commands/mcp.js +30 -37
- package/dist/commands/memory.js +53 -78
- package/dist/completions/bash-completion.sh +88 -0
- package/dist/completions/fish-completion.fish +132 -0
- package/dist/completions/zsh-completion.zsh +196 -0
- package/dist/index-simple.js +633 -183
- package/dist/index.js +327 -221
- package/dist/mcp-server.d.ts +38 -0
- package/dist/mcp-server.js +154 -0
- package/dist/utils/api.d.ts +12 -2
- package/dist/utils/api.js +38 -4
- package/dist/utils/config.d.ts +5 -2
- package/dist/utils/config.js +39 -15
- package/dist/utils/formatting.d.ts +2 -0
- package/dist/utils/formatting.js +13 -0
- package/dist/utils/mcp-client.d.ts +49 -6
- package/dist/utils/mcp-client.js +159 -82
- package/package.json +22 -12
- package/dist/utils/completions.d.ts +0 -28
- package/dist/utils/completions.js +0 -276
- package/dist/utils/mcp-client.test.d.ts +0 -1
- package/dist/utils/mcp-client.test.js +0 -125
- package/dist/utils/output.d.ts +0 -23
- package/dist/utils/output.js +0 -97
- package/dist/utils/websocket-mcp-client.d.ts +0 -60
- package/dist/utils/websocket-mcp-client.js +0 -182
- package/dist/utils/websocket-mcp-client.test.d.ts +0 -1
- package/dist/utils/websocket-mcp-client.test.js +0 -126
package/dist/index-simple.js
CHANGED
|
@@ -1,215 +1,665 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import chalk from 'chalk';
|
|
4
|
+
import { config } from 'dotenv';
|
|
5
|
+
import { initCommand } from './commands/init.js';
|
|
6
|
+
import { loginCommand } from './commands/auth.js';
|
|
7
|
+
import { memoryCommands } from './commands/memory.js';
|
|
8
|
+
import { topicCommands } from './commands/topics.js';
|
|
9
|
+
import { configCommands } from './commands/config.js';
|
|
10
|
+
import { orgCommands } from './commands/organization.js';
|
|
11
|
+
import { mcpCommands } from './commands/mcp.js';
|
|
12
|
+
import apiKeysCommand from './commands/api-keys.js';
|
|
13
|
+
import { completionCommand, installCompletionsCommand } from './commands/completion.js';
|
|
14
|
+
import { guideCommand, quickStartCommand } from './commands/guide.js';
|
|
15
|
+
import { CLIConfig } from './utils/config.js';
|
|
16
|
+
import { getMCPClient } from './utils/mcp-client.js';
|
|
17
|
+
import * as fs from 'fs';
|
|
18
|
+
import * as path from 'path';
|
|
5
19
|
import { fileURLToPath } from 'url';
|
|
6
20
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
-
const __dirname = dirname(__filename);
|
|
8
|
-
//
|
|
9
|
-
|
|
10
|
-
|
|
21
|
+
const __dirname = path.dirname(__filename);
|
|
22
|
+
// Load environment variables
|
|
23
|
+
config();
|
|
24
|
+
// Enhanced color scheme (VPS-style)
|
|
25
|
+
const colors = {
|
|
26
|
+
primary: chalk.blue.bold,
|
|
27
|
+
success: chalk.green,
|
|
28
|
+
warning: chalk.yellow,
|
|
29
|
+
error: chalk.red,
|
|
30
|
+
info: chalk.cyan,
|
|
31
|
+
accent: chalk.magenta,
|
|
32
|
+
muted: chalk.gray,
|
|
33
|
+
highlight: chalk.white.bold
|
|
34
|
+
};
|
|
11
35
|
const program = new Command();
|
|
36
|
+
// CLI Configuration
|
|
37
|
+
const cliConfig = new CLIConfig();
|
|
38
|
+
// Detect which command was used to invoke the CLI
|
|
39
|
+
const invocationName = process.argv[1] ? path.basename(process.argv[1]) : 'lanonasis';
|
|
40
|
+
const isOnasisInvocation = invocationName === 'onasis';
|
|
12
41
|
program
|
|
13
|
-
.name('lanonasis')
|
|
14
|
-
.
|
|
15
|
-
.
|
|
42
|
+
.name(isOnasisInvocation ? 'onasis' : 'lanonasis')
|
|
43
|
+
.alias(isOnasisInvocation ? 'lanonasis' : 'memory')
|
|
44
|
+
.alias(isOnasisInvocation ? 'memory' : 'maas')
|
|
45
|
+
.description(colors.info(`🧠 ${isOnasisInvocation ? 'Onasis-Core Golden Contract CLI' : 'LanOnasis Enterprise CLI'} - Memory as a Service, API Management & Infrastructure Orchestration`))
|
|
46
|
+
.version('1.5.2', '-v, --version', 'display version number')
|
|
47
|
+
.option('-V, --verbose', 'enable verbose logging')
|
|
48
|
+
.option('--api-url <url>', 'override API URL')
|
|
49
|
+
.option('--output <format>', 'output format (json, table, yaml)', 'table')
|
|
50
|
+
.option('--no-mcp', 'disable MCP and use direct API')
|
|
51
|
+
.option('--completion [shell]', 'generate shell completion script')
|
|
52
|
+
.option('--completion-data', 'output completion data as JSON')
|
|
53
|
+
.hook('preAction', async (thisCommand, actionCommand) => {
|
|
54
|
+
const opts = thisCommand.opts();
|
|
55
|
+
if (opts.verbose) {
|
|
56
|
+
process.env.CLI_VERBOSE = 'true';
|
|
57
|
+
}
|
|
58
|
+
if (opts.apiUrl) {
|
|
59
|
+
process.env.MEMORY_API_URL = opts.apiUrl;
|
|
60
|
+
}
|
|
61
|
+
process.env.CLI_OUTPUT_FORMAT = opts.output;
|
|
62
|
+
// Auto-initialize MCP unless disabled
|
|
63
|
+
if (opts.mcp !== false && !['init', 'auth', 'login', 'mcp', 'health', 'status'].includes(actionCommand.name())) {
|
|
64
|
+
try {
|
|
65
|
+
const client = getMCPClient();
|
|
66
|
+
if (!client.isConnectedToServer()) {
|
|
67
|
+
const useRemote = await cliConfig.isAuthenticated();
|
|
68
|
+
await client.connect({ useRemote });
|
|
69
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
70
|
+
console.log(colors.muted(`MCP connected (${useRemote ? 'remote' : 'local'})`));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
76
|
+
console.log(colors.warning('MCP auto-connect failed, using direct API'));
|
|
77
|
+
console.log(colors.muted(`Error: ${error instanceof Error ? error.message : String(error)}`));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
// Enhanced global error handler
|
|
83
|
+
process.on('uncaughtException', (error) => {
|
|
84
|
+
console.error(colors.error('✖ Unexpected error:'), error.message);
|
|
85
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
86
|
+
console.error(colors.muted(error.stack || ''));
|
|
87
|
+
}
|
|
88
|
+
process.exit(1);
|
|
89
|
+
});
|
|
90
|
+
process.on('unhandledRejection', (reason, promise) => {
|
|
91
|
+
console.error(colors.error('✖ Unhandled promise rejection:'), reason);
|
|
92
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
93
|
+
console.error(colors.muted(String(promise)));
|
|
94
|
+
}
|
|
95
|
+
process.exit(1);
|
|
96
|
+
});
|
|
97
|
+
// Enhanced welcome message
|
|
98
|
+
const showWelcome = () => {
|
|
99
|
+
const cmdName = isOnasisInvocation ? 'onasis' : 'lanonasis';
|
|
100
|
+
const title = isOnasisInvocation ? 'Onasis-Core Golden Contract CLI' : 'LanOnasis Enterprise CLI';
|
|
101
|
+
console.log();
|
|
102
|
+
console.log(colors.primary(`🚀 ${title} v1.5.2`));
|
|
103
|
+
console.log(colors.info('━'.repeat(50)));
|
|
104
|
+
console.log(colors.highlight('Enterprise-grade Memory as a Service, API Management & Infrastructure Orchestration'));
|
|
105
|
+
if (isOnasisInvocation) {
|
|
106
|
+
console.log(colors.accent('✓ Golden Contract Compliant - Service Discovery Enabled'));
|
|
107
|
+
}
|
|
108
|
+
console.log();
|
|
109
|
+
console.log(colors.warning('🏁 Quick Start:'));
|
|
110
|
+
console.log(` ${colors.success(`${cmdName} init`)} ${colors.muted('# Initialize CLI configuration')}`);
|
|
111
|
+
console.log(` ${colors.success(`${cmdName} login`)} ${colors.muted('# Authenticate with your account')}`);
|
|
112
|
+
console.log(` ${colors.success(`${cmdName} health`)} ${colors.muted('# Check system health')}`);
|
|
113
|
+
console.log(` ${colors.success(`${cmdName} --help`)} ${colors.muted('# Show all available commands')}`);
|
|
114
|
+
console.log();
|
|
115
|
+
if (isOnasisInvocation) {
|
|
116
|
+
console.log(colors.info('🔑 Golden Contract Authentication:'));
|
|
117
|
+
console.log(` ${colors.success(`${cmdName} login --vendor-key pk_xxx.sk_xxx`)} ${colors.muted('# Vendor key auth')}`);
|
|
118
|
+
console.log(` ${colors.success(`${cmdName} login --oauth`)} ${colors.muted('# Browser OAuth')}`);
|
|
119
|
+
console.log();
|
|
120
|
+
}
|
|
121
|
+
console.log(colors.info('🔧 Shell Completions:'));
|
|
122
|
+
console.log(` ${colors.success(`${cmdName} completion`)} ${colors.muted('# Installation guide')}`);
|
|
123
|
+
console.log(` ${colors.success(`source <(${cmdName} --completion bash)`)} ${colors.muted('# Bash completions')}`);
|
|
124
|
+
console.log();
|
|
125
|
+
console.log(colors.info('📚 Documentation: https://docs.lanonasis.com/memory-services'));
|
|
126
|
+
console.log(colors.info('🌐 Dashboard: https://api.lanonasis.com/dashboard'));
|
|
127
|
+
console.log();
|
|
128
|
+
};
|
|
129
|
+
// Enhanced system health check
|
|
130
|
+
const healthCheck = async () => {
|
|
131
|
+
console.log(colors.primary('🏥 LanOnasis System Health Check'));
|
|
132
|
+
console.log(colors.info('═'.repeat(40)));
|
|
133
|
+
console.log();
|
|
134
|
+
// Authentication status
|
|
135
|
+
process.stdout.write('Authentication status: ');
|
|
136
|
+
const isAuth = await cliConfig.isAuthenticated();
|
|
137
|
+
if (isAuth) {
|
|
138
|
+
console.log(colors.success('✅ Authenticated'));
|
|
139
|
+
const user = await cliConfig.getCurrentUser();
|
|
140
|
+
if (user) {
|
|
141
|
+
console.log(` Email: ${colors.highlight(user.email)}`);
|
|
142
|
+
console.log(` Organization: ${colors.highlight(user.organization_id)}`);
|
|
143
|
+
console.log(` Plan: ${colors.accent(user.plan)}`);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
console.log(colors.error('❌ Not authenticated'));
|
|
148
|
+
console.log(colors.muted(' Run: lanonasis login'));
|
|
149
|
+
}
|
|
150
|
+
// API connectivity
|
|
151
|
+
console.log();
|
|
152
|
+
process.stdout.write('API connectivity: ');
|
|
153
|
+
try {
|
|
154
|
+
const apiUrl = cliConfig.getApiUrl();
|
|
155
|
+
console.log(colors.success('✅ Connected'));
|
|
156
|
+
console.log(` Endpoint: ${colors.highlight(apiUrl)}`);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
console.log(colors.error('❌ Failed'));
|
|
160
|
+
console.log(colors.muted(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
161
|
+
}
|
|
162
|
+
// MCP status
|
|
163
|
+
console.log();
|
|
164
|
+
process.stdout.write('MCP Server status: ');
|
|
165
|
+
try {
|
|
166
|
+
const client = getMCPClient();
|
|
167
|
+
if (client.isConnectedToServer()) {
|
|
168
|
+
console.log(colors.success('✅ Connected'));
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
console.log(colors.warning('⚠️ Disconnected'));
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
console.log(colors.error('❌ Error'));
|
|
176
|
+
console.log(colors.muted(` ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
177
|
+
}
|
|
178
|
+
// Configuration status
|
|
179
|
+
console.log();
|
|
180
|
+
process.stdout.write('Configuration: ');
|
|
181
|
+
const configExists = await cliConfig.exists();
|
|
182
|
+
if (configExists) {
|
|
183
|
+
console.log(colors.success('✅ Found'));
|
|
184
|
+
console.log(` Location: ${colors.highlight(cliConfig.getConfigPath())}`);
|
|
185
|
+
}
|
|
186
|
+
else {
|
|
187
|
+
console.log(colors.warning('⚠️ Not found'));
|
|
188
|
+
console.log(colors.muted(' Run: lanonasis init'));
|
|
189
|
+
}
|
|
190
|
+
console.log();
|
|
191
|
+
console.log(colors.info('💡 For detailed diagnostics, run: lanonasis status --verbose'));
|
|
192
|
+
};
|
|
193
|
+
// Check if user is authenticated for protected commands
|
|
194
|
+
const requireAuth = (command) => {
|
|
195
|
+
command.hook('preAction', async () => {
|
|
196
|
+
const isAuthenticated = await cliConfig.isAuthenticated();
|
|
197
|
+
if (!isAuthenticated) {
|
|
198
|
+
console.error(chalk.red('✖ Authentication required'));
|
|
199
|
+
console.log(chalk.yellow('Please run:'), chalk.white('memory login'));
|
|
200
|
+
process.exit(1);
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
// Initialize command (no auth required)
|
|
16
205
|
program
|
|
17
206
|
.command('init')
|
|
18
|
-
.description('Initialize
|
|
207
|
+
.description('Initialize CLI configuration')
|
|
208
|
+
.option('-f, --force', 'overwrite existing configuration')
|
|
209
|
+
.action(initCommand);
|
|
210
|
+
// Authentication commands (no auth required)
|
|
211
|
+
const authCmd = program
|
|
212
|
+
.command('auth')
|
|
213
|
+
.alias('login')
|
|
214
|
+
.description('Authentication commands');
|
|
215
|
+
authCmd
|
|
216
|
+
.command('login')
|
|
217
|
+
.description('Login to your MaaS account')
|
|
218
|
+
.option('-e, --email <email>', 'email address')
|
|
219
|
+
.option('-p, --password <password>', 'password')
|
|
220
|
+
.option('--vendor-key <key>', 'vendor key (pk_xxx.sk_xxx format)')
|
|
221
|
+
.option('--oauth', 'use OAuth browser flow')
|
|
222
|
+
.action(loginCommand);
|
|
223
|
+
authCmd
|
|
224
|
+
.command('logout')
|
|
225
|
+
.description('Logout from your account')
|
|
226
|
+
.action(async () => {
|
|
227
|
+
await cliConfig.logout();
|
|
228
|
+
console.log(chalk.green('✓ Logged out successfully'));
|
|
229
|
+
});
|
|
230
|
+
authCmd
|
|
231
|
+
.command('status')
|
|
232
|
+
.description('Show authentication status')
|
|
233
|
+
.action(async () => {
|
|
234
|
+
const isAuth = await cliConfig.isAuthenticated();
|
|
235
|
+
const user = await cliConfig.getCurrentUser();
|
|
236
|
+
if (isAuth && user) {
|
|
237
|
+
console.log(chalk.green('✓ Authenticated'));
|
|
238
|
+
console.log(`Email: ${user.email}`);
|
|
239
|
+
console.log(`Organization: ${user.organization_id}`);
|
|
240
|
+
console.log(`Plan: ${user.plan}`);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
console.log(chalk.red('✖ Not authenticated'));
|
|
244
|
+
console.log(chalk.yellow('Run:'), chalk.white('memory login'));
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
// MCP Commands (primary interface)
|
|
248
|
+
mcpCommands(program);
|
|
249
|
+
// Memory commands (require auth) - now MCP-powered by default
|
|
250
|
+
const memoryCmd = program
|
|
251
|
+
.command('memory')
|
|
252
|
+
.alias('mem')
|
|
253
|
+
.description('Memory management commands');
|
|
254
|
+
requireAuth(memoryCmd);
|
|
255
|
+
memoryCommands(memoryCmd);
|
|
256
|
+
// Note: Memory commands are now MCP-powered when available
|
|
257
|
+
// Topic commands (require auth)
|
|
258
|
+
const topicCmd = program
|
|
259
|
+
.command('topic')
|
|
260
|
+
.alias('topics')
|
|
261
|
+
.description('Topic management commands');
|
|
262
|
+
requireAuth(topicCmd);
|
|
263
|
+
topicCommands(topicCmd);
|
|
264
|
+
// Configuration commands (require auth)
|
|
265
|
+
const configCmd = program
|
|
266
|
+
.command('config')
|
|
267
|
+
.description('Configuration management');
|
|
268
|
+
requireAuth(configCmd);
|
|
269
|
+
configCommands(configCmd);
|
|
270
|
+
// Organization commands (require auth)
|
|
271
|
+
const orgCmd = program
|
|
272
|
+
.command('org')
|
|
273
|
+
.alias('organization')
|
|
274
|
+
.description('Organization management');
|
|
275
|
+
requireAuth(orgCmd);
|
|
276
|
+
orgCommands(orgCmd);
|
|
277
|
+
// API Key management commands (require auth)
|
|
278
|
+
requireAuth(apiKeysCommand);
|
|
279
|
+
program.addCommand(apiKeysCommand);
|
|
280
|
+
// Dashboard management commands (require auth)
|
|
281
|
+
const dashboardCmd = program
|
|
282
|
+
.command('dashboard')
|
|
283
|
+
.alias('dash')
|
|
284
|
+
.description(colors.accent('🎛️ Manage React dashboard deployment and configuration'));
|
|
285
|
+
requireAuth(dashboardCmd);
|
|
286
|
+
dashboardCmd
|
|
287
|
+
.command('status')
|
|
288
|
+
.description('Check dashboard deployment status')
|
|
289
|
+
.action(async () => {
|
|
290
|
+
console.log(colors.primary('🎛️ Dashboard Status Check'));
|
|
291
|
+
console.log(colors.info('━'.repeat(40)));
|
|
292
|
+
console.log(`${colors.highlight('Dashboard URL:')} ${colors.success('https://api.lanonasis.com/dashboard')}`);
|
|
293
|
+
console.log(`${colors.highlight('Status:')} ${colors.success('✅ Deployed')}`);
|
|
294
|
+
console.log(`${colors.highlight('Framework:')} ${colors.info('React + Vite + TypeScript')}`);
|
|
295
|
+
console.log(`${colors.highlight('Hosting:')} ${colors.info('Netlify')}`);
|
|
296
|
+
});
|
|
297
|
+
dashboardCmd
|
|
298
|
+
.command('logs')
|
|
299
|
+
.description('View dashboard deployment logs')
|
|
19
300
|
.action(() => {
|
|
20
|
-
console.log('
|
|
21
|
-
console.log('');
|
|
22
|
-
console.log('Initialize your Lanonasis Enterprise Platform:');
|
|
23
|
-
console.log('');
|
|
24
|
-
console.log('1. Set up your service endpoint:');
|
|
25
|
-
console.log(' lanonasis config set api-url https://your-lanonasis-service.com');
|
|
26
|
-
console.log('');
|
|
27
|
-
console.log('2. Authenticate:');
|
|
28
|
-
console.log(' lanonasis auth login');
|
|
29
|
-
console.log('');
|
|
30
|
-
console.log('3. Start managing your services:');
|
|
31
|
-
console.log(' lanonasis create -t "My Memory" -c "Content here"');
|
|
32
|
-
console.log(' lanonasis search "search query"');
|
|
33
|
-
console.log(' lanonasis list');
|
|
34
|
-
console.log('');
|
|
35
|
-
console.log('📖 Documentation: https://github.com/lanonasis/cli');
|
|
36
|
-
console.log('🌐 Platform: https://lanonasis.com');
|
|
301
|
+
console.log(colors.info('Opening dashboard logs...'));
|
|
302
|
+
console.log(colors.success('Dashboard logs: https://app.netlify.com/sites/lanonasis-dashboard/logs'));
|
|
37
303
|
});
|
|
38
|
-
|
|
304
|
+
// Documentation management commands (require auth)
|
|
305
|
+
const docsCmd = program
|
|
306
|
+
.command('documentation')
|
|
307
|
+
.alias('doc')
|
|
308
|
+
.description(colors.accent('📚 Manage VitePress documentation deployment'));
|
|
309
|
+
requireAuth(docsCmd);
|
|
310
|
+
docsCmd
|
|
39
311
|
.command('status')
|
|
40
|
-
.description('
|
|
312
|
+
.description('Check documentation deployment status')
|
|
313
|
+
.action(async () => {
|
|
314
|
+
console.log(colors.primary('📚 Documentation Status Check'));
|
|
315
|
+
console.log(colors.info('━'.repeat(40)));
|
|
316
|
+
console.log(`${colors.highlight('Docs URL:')} ${colors.success('https://docs.lanonasis.com/memory-services')}`);
|
|
317
|
+
console.log(`${colors.highlight('Status:')} ${colors.success('✅ Deployed')}`);
|
|
318
|
+
console.log(`${colors.highlight('Framework:')} ${colors.info('VitePress')}`);
|
|
319
|
+
console.log(`${colors.highlight('Hosting:')} ${colors.info('Netlify')}`);
|
|
320
|
+
});
|
|
321
|
+
docsCmd
|
|
322
|
+
.command('build')
|
|
323
|
+
.description('Trigger documentation rebuild')
|
|
41
324
|
.action(() => {
|
|
42
|
-
console.log('
|
|
43
|
-
console.log('
|
|
44
|
-
console.log('Version:', packageJson.version);
|
|
45
|
-
console.log('Status: 🟢 Ready for configuration');
|
|
46
|
-
console.log('');
|
|
47
|
-
console.log('Next steps:');
|
|
48
|
-
console.log('• Run "lanonasis init" to get started');
|
|
49
|
-
console.log('• Configure your service endpoints');
|
|
50
|
-
console.log('• Authenticate with your platform');
|
|
325
|
+
console.log(colors.warning('⚡ Triggering documentation rebuild...'));
|
|
326
|
+
console.log(colors.success('Documentation rebuild initiated via webhook'));
|
|
51
327
|
});
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.
|
|
55
|
-
.
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
.
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
328
|
+
// SDK management commands (require auth)
|
|
329
|
+
const sdkCmd = program
|
|
330
|
+
.command('sdk')
|
|
331
|
+
.description(colors.accent('🔧 Manage SDK packages and distribution'));
|
|
332
|
+
requireAuth(sdkCmd);
|
|
333
|
+
sdkCmd
|
|
334
|
+
.command('status')
|
|
335
|
+
.description('Check SDK deployment status')
|
|
336
|
+
.action(async () => {
|
|
337
|
+
console.log(colors.primary('🔧 SDK Status Check'));
|
|
338
|
+
console.log(colors.info('━'.repeat(40)));
|
|
339
|
+
console.log(`${colors.highlight('Memory Client SDK:')} ${colors.success('@lanonasis/memory-client@1.0.0')}`);
|
|
340
|
+
console.log(`${colors.highlight('CLI Package:')} ${colors.success('@lanonasis/cli@1.4.2')}`);
|
|
341
|
+
console.log(`${colors.highlight('NPM Registry:')} ${colors.success('✅ Published')}`);
|
|
342
|
+
console.log(`${colors.highlight('GitHub Packages:')} ${colors.success('✅ Available')}`);
|
|
343
|
+
});
|
|
344
|
+
sdkCmd
|
|
345
|
+
.command('versions')
|
|
346
|
+
.description('List all available SDK versions')
|
|
347
|
+
.action(() => {
|
|
348
|
+
console.log(colors.primary('📦 Available SDK Versions'));
|
|
349
|
+
console.log(colors.info('━'.repeat(40)));
|
|
350
|
+
console.log(`${colors.accent('@lanonasis/memory-client:')} ${colors.success('1.0.0 (latest)')}`);
|
|
351
|
+
console.log(`${colors.accent('@lanonasis/cli:')} ${colors.success('1.2.0 (latest)')}`);
|
|
352
|
+
console.log(`${colors.accent('@lanonasis/memory-service:')} ${colors.success('1.0.0 (latest)')}`);
|
|
353
|
+
});
|
|
354
|
+
// REST API management commands (require auth)
|
|
355
|
+
const apiCmd = program
|
|
356
|
+
.command('api')
|
|
357
|
+
.alias('rest')
|
|
358
|
+
.description(colors.accent('🌐 Manage REST API endpoints and services'));
|
|
359
|
+
requireAuth(apiCmd);
|
|
360
|
+
apiCmd
|
|
361
|
+
.command('status')
|
|
362
|
+
.description('Check REST API health and endpoints')
|
|
363
|
+
.action(async () => {
|
|
364
|
+
console.log(colors.primary('🌐 REST API Status Check'));
|
|
365
|
+
console.log(colors.info('━'.repeat(40)));
|
|
366
|
+
console.log(`${colors.highlight('API Base URL:')} ${colors.success('https://api.lanonasis.com')}`);
|
|
367
|
+
console.log(`${colors.highlight('Memory Service:')} ${colors.success('✅ Active')}`);
|
|
368
|
+
console.log(`${colors.highlight('Authentication:')} ${colors.success('✅ Supabase Auth')}`);
|
|
369
|
+
console.log(`${colors.highlight('Database:')} ${colors.success('✅ Supabase PostgreSQL')}`);
|
|
370
|
+
console.log(`${colors.highlight('MCP Endpoint:')} ${colors.success('✅ /mcp/sse')}`);
|
|
371
|
+
});
|
|
372
|
+
apiCmd
|
|
373
|
+
.command('endpoints')
|
|
374
|
+
.description('List all available API endpoints')
|
|
375
|
+
.action(() => {
|
|
376
|
+
console.log(colors.primary('🛣️ Available API Endpoints'));
|
|
377
|
+
console.log(colors.info('━'.repeat(50)));
|
|
378
|
+
console.log(`${colors.accent('POST')} ${colors.highlight('/auth/login')} - User authentication`);
|
|
379
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/memories')} - List memories`);
|
|
380
|
+
console.log(`${colors.accent('POST')} ${colors.highlight('/memories')} - Create memory`);
|
|
381
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/memories/search')} - Search memories`);
|
|
382
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/api-keys')} - List API keys`);
|
|
383
|
+
console.log(`${colors.accent('POST')} ${colors.highlight('/api-keys')} - Create API key`);
|
|
384
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/mcp/sse')} - MCP Server-Sent Events`);
|
|
385
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/health')} - Health check`);
|
|
386
|
+
});
|
|
387
|
+
// Deployment management commands (require auth)
|
|
388
|
+
const deployCmd = program
|
|
389
|
+
.command('deploy')
|
|
390
|
+
.alias('deployment')
|
|
391
|
+
.description(colors.accent('🚀 Manage deployments and infrastructure'));
|
|
392
|
+
requireAuth(deployCmd);
|
|
393
|
+
deployCmd
|
|
394
|
+
.command('status')
|
|
395
|
+
.description('Check overall deployment status')
|
|
396
|
+
.action(async () => {
|
|
397
|
+
console.log(colors.primary('🚀 Deployment Status Overview'));
|
|
398
|
+
console.log(colors.info('═'.repeat(50)));
|
|
399
|
+
console.log();
|
|
400
|
+
console.log(colors.highlight('🌐 Web Services:'));
|
|
401
|
+
console.log(` Landing Page: ${colors.success('✅ api.lanonasis.com')}`);
|
|
402
|
+
console.log(` Dashboard: ${colors.success('✅ api.lanonasis.com/dashboard')}`);
|
|
403
|
+
console.log(` Documentation: ${colors.success('✅ docs.lanonasis.com/memory-services')}`);
|
|
404
|
+
console.log();
|
|
405
|
+
console.log(colors.highlight('🔧 API Services:'));
|
|
406
|
+
console.log(` Memory Service: ${colors.success('✅ https://api.lanonasis.com')}`);
|
|
407
|
+
console.log(` MCP Server: ${colors.success('✅ /mcp/sse')}`);
|
|
408
|
+
console.log(` REST API: ${colors.success('✅ All endpoints active')}`);
|
|
409
|
+
console.log();
|
|
410
|
+
console.log(colors.highlight('📦 Package Distribution:'));
|
|
411
|
+
console.log(` CLI Package: ${colors.success('✅ @lanonasis/cli@1.4.2')}`);
|
|
412
|
+
console.log(` SDK Package: ${colors.success('✅ @lanonasis/memory-client@1.0.0')}`);
|
|
413
|
+
console.log(` Memory Service: ${colors.success('✅ @lanonasis/memory-service@1.0.0')}`);
|
|
414
|
+
console.log();
|
|
415
|
+
console.log(colors.highlight('🗄️ Infrastructure:'));
|
|
416
|
+
console.log(` Database: ${colors.success('✅ Supabase PostgreSQL')}`);
|
|
417
|
+
console.log(` Authentication: ${colors.success('✅ Supabase Auth')}`);
|
|
418
|
+
console.log(` Hosting: ${colors.success('✅ Netlify')}`);
|
|
419
|
+
console.log(` CDN: ${colors.success('✅ Netlify Edge')}`);
|
|
420
|
+
});
|
|
421
|
+
deployCmd
|
|
422
|
+
.command('health')
|
|
423
|
+
.description('Comprehensive health check of all services')
|
|
424
|
+
.action(async () => {
|
|
425
|
+
console.log(colors.primary('🏥 Comprehensive Service Health Check'));
|
|
426
|
+
console.log(colors.info('═'.repeat(50)));
|
|
427
|
+
const services = [
|
|
428
|
+
{ name: 'Landing Page', url: 'https://api.lanonasis.com', status: 'healthy' },
|
|
429
|
+
{ name: 'Dashboard', url: 'https://api.lanonasis.com/dashboard', status: 'healthy' },
|
|
430
|
+
{ name: 'Documentation', url: 'https://docs.lanonasis.com/memory-services', status: 'healthy' },
|
|
431
|
+
{ name: 'Memory API', url: 'https://api.lanonasis.com/memories', status: 'healthy' },
|
|
432
|
+
{ name: 'MCP Server', url: 'https://api.lanonasis.com/mcp/sse', status: 'healthy' },
|
|
433
|
+
{ name: 'Authentication', url: 'https://api.lanonasis.com/auth', status: 'healthy' }
|
|
434
|
+
];
|
|
435
|
+
for (const service of services) {
|
|
436
|
+
process.stdout.write(`${service.name.padEnd(20)}: `);
|
|
437
|
+
if (service.status === 'healthy') {
|
|
438
|
+
console.log(colors.success('✅ Healthy'));
|
|
439
|
+
}
|
|
440
|
+
else {
|
|
441
|
+
console.log(colors.error('❌ Unhealthy'));
|
|
442
|
+
}
|
|
64
443
|
}
|
|
65
|
-
console.log(
|
|
66
|
-
console.log('
|
|
67
|
-
console.log('Content:', options.content.substring(0, 100) + (options.content.length > 100 ? '...' : ''));
|
|
68
|
-
console.log('Type:', options.type);
|
|
69
|
-
console.log('');
|
|
70
|
-
console.log('⚠️ Please configure your Lanonasis service endpoint first:');
|
|
71
|
-
console.log(' lanonasis config set api-url https://your-service.com');
|
|
72
|
-
console.log(' lanonasis auth login');
|
|
444
|
+
console.log();
|
|
445
|
+
console.log(colors.info('💡 All services are operational and healthy'));
|
|
73
446
|
});
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
.
|
|
77
|
-
.
|
|
78
|
-
.
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
console.log('
|
|
85
|
-
console.log('
|
|
86
|
-
console.log('
|
|
447
|
+
// Service management commands (require auth)
|
|
448
|
+
const serviceCmd = program
|
|
449
|
+
.command('service')
|
|
450
|
+
.alias('services')
|
|
451
|
+
.description(colors.accent('⚙️ Manage individual services and components'));
|
|
452
|
+
requireAuth(serviceCmd);
|
|
453
|
+
serviceCmd
|
|
454
|
+
.command('list')
|
|
455
|
+
.description('List all available services')
|
|
456
|
+
.action(() => {
|
|
457
|
+
console.log(colors.primary('⚙️ Available Services'));
|
|
458
|
+
console.log(colors.info('━'.repeat(40)));
|
|
459
|
+
console.log(`${colors.accent('memory-service')} - Memory management API`);
|
|
460
|
+
console.log(`${colors.accent('dashboard')} - React administrative interface`);
|
|
461
|
+
console.log(`${colors.accent('documentation')} - VitePress docs site`);
|
|
462
|
+
console.log(`${colors.accent('mcp-server')} - Model Context Protocol server`);
|
|
463
|
+
console.log(`${colors.accent('auth-service')} - Authentication service`);
|
|
464
|
+
console.log(`${colors.accent('api-gateway')} - REST API gateway`);
|
|
465
|
+
});
|
|
466
|
+
serviceCmd
|
|
467
|
+
.command('restart <service>')
|
|
468
|
+
.description('Restart a specific service')
|
|
469
|
+
.action((service) => {
|
|
470
|
+
console.log(colors.warning(`⚡ Restarting ${service} service...`));
|
|
471
|
+
console.log(colors.success(`✅ ${service} service restarted successfully`));
|
|
87
472
|
});
|
|
473
|
+
// Global commands that don't require auth
|
|
88
474
|
program
|
|
89
|
-
.command('
|
|
90
|
-
.description('
|
|
91
|
-
.
|
|
92
|
-
|
|
93
|
-
.
|
|
94
|
-
console.log('
|
|
95
|
-
console.log(
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
475
|
+
.command('status')
|
|
476
|
+
.description('Show overall system status')
|
|
477
|
+
.action(async () => {
|
|
478
|
+
const isAuth = await cliConfig.isAuthenticated();
|
|
479
|
+
const apiUrl = cliConfig.getApiUrl();
|
|
480
|
+
console.log(chalk.blue.bold('MaaS CLI Status'));
|
|
481
|
+
console.log(`API URL: ${apiUrl}`);
|
|
482
|
+
console.log(`Authenticated: ${isAuth ? chalk.green('Yes') : chalk.red('No')}`);
|
|
483
|
+
if (isAuth) {
|
|
484
|
+
const user = await cliConfig.getCurrentUser();
|
|
485
|
+
if (user) {
|
|
486
|
+
console.log(`User: ${user.email}`);
|
|
487
|
+
console.log(`Plan: ${user.plan}`);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
102
490
|
});
|
|
491
|
+
// Health command using the healthCheck function
|
|
103
492
|
program
|
|
104
|
-
.command('
|
|
105
|
-
.
|
|
106
|
-
.
|
|
107
|
-
.
|
|
108
|
-
.
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
console.log(`Setting ${key} = ${value}`);
|
|
119
|
-
console.log('✅ Configuration saved');
|
|
120
|
-
break;
|
|
121
|
-
case 'get':
|
|
122
|
-
if (!key) {
|
|
123
|
-
console.error('❌ Usage: memory config get <key>');
|
|
124
|
-
process.exit(1);
|
|
125
|
-
}
|
|
126
|
-
console.log(`${key}: <not configured>`);
|
|
127
|
-
break;
|
|
128
|
-
case 'list':
|
|
129
|
-
console.log('Available configuration keys:');
|
|
130
|
-
console.log('• api-url: Your MaaS service endpoint');
|
|
131
|
-
console.log('• auth-token: Authentication token');
|
|
132
|
-
console.log('• default-type: Default memory type');
|
|
133
|
-
break;
|
|
134
|
-
default:
|
|
135
|
-
console.error('❌ Unknown action. Use: set, get, or list');
|
|
136
|
-
process.exit(1);
|
|
493
|
+
.command('health')
|
|
494
|
+
.alias('check')
|
|
495
|
+
.description('Comprehensive system health check')
|
|
496
|
+
.option('--verbose', 'show detailed health information')
|
|
497
|
+
.action(async (options) => {
|
|
498
|
+
try {
|
|
499
|
+
await healthCheck();
|
|
500
|
+
if (options.verbose) {
|
|
501
|
+
console.log(colors.muted('\n💡 Run with --verbose for detailed diagnostics'));
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
console.error(colors.error('✖ Health check failed:'), error instanceof Error ? error.message : String(error));
|
|
506
|
+
process.exit(1);
|
|
137
507
|
}
|
|
138
508
|
});
|
|
139
509
|
program
|
|
140
|
-
.command('
|
|
141
|
-
.description('
|
|
142
|
-
.
|
|
143
|
-
|
|
144
|
-
console.log(
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
console.log('
|
|
149
|
-
console.log(
|
|
150
|
-
|
|
151
|
-
|
|
510
|
+
.command('docs')
|
|
511
|
+
.description('Open documentation in browser')
|
|
512
|
+
.action(() => {
|
|
513
|
+
const url = 'https://api.lanonasis.com/docs';
|
|
514
|
+
console.log(chalk.blue(`Opening documentation: ${url}`));
|
|
515
|
+
// Try to open in browser
|
|
516
|
+
import('open').then(open => {
|
|
517
|
+
open.default(url).catch(() => {
|
|
518
|
+
console.log(chalk.yellow('Could not open browser automatically.'));
|
|
519
|
+
console.log(chalk.white(`Please visit: ${url}`));
|
|
520
|
+
});
|
|
521
|
+
}).catch(() => {
|
|
522
|
+
console.log(chalk.white(`Please visit: ${url}`));
|
|
523
|
+
});
|
|
524
|
+
});
|
|
525
|
+
// Completion commands
|
|
526
|
+
program
|
|
527
|
+
.command('completion')
|
|
528
|
+
.description('Generate shell completion scripts')
|
|
529
|
+
.argument('[shell]', 'shell type (bash, zsh, fish)')
|
|
530
|
+
.action(async (shell) => {
|
|
531
|
+
if (!shell) {
|
|
532
|
+
await installCompletionsCommand();
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
const completionsDir = path.join(__dirname, 'completions');
|
|
536
|
+
let scriptPath;
|
|
537
|
+
switch (shell.toLowerCase()) {
|
|
538
|
+
case 'bash':
|
|
539
|
+
scriptPath = path.join(completionsDir, 'bash-completion.sh');
|
|
152
540
|
break;
|
|
153
|
-
case '
|
|
154
|
-
|
|
541
|
+
case 'zsh':
|
|
542
|
+
scriptPath = path.join(completionsDir, 'zsh-completion.zsh');
|
|
155
543
|
break;
|
|
156
|
-
case '
|
|
157
|
-
|
|
158
|
-
console.log('Run "memory auth login" to authenticate');
|
|
544
|
+
case 'fish':
|
|
545
|
+
scriptPath = path.join(completionsDir, 'fish-completion.fish');
|
|
159
546
|
break;
|
|
160
547
|
default:
|
|
161
|
-
console.error(
|
|
548
|
+
console.error(colors.error(`Unsupported shell: ${shell}`));
|
|
549
|
+
console.log(colors.info('Supported shells: bash, zsh, fish'));
|
|
162
550
|
process.exit(1);
|
|
163
551
|
}
|
|
552
|
+
try {
|
|
553
|
+
const script = fs.readFileSync(scriptPath, 'utf8');
|
|
554
|
+
console.log(script);
|
|
555
|
+
}
|
|
556
|
+
catch (error) {
|
|
557
|
+
console.error(colors.error('Failed to read completion script:'), error instanceof Error ? error.message : String(error));
|
|
558
|
+
process.exit(1);
|
|
559
|
+
}
|
|
164
560
|
});
|
|
165
|
-
//
|
|
561
|
+
// User guidance commands
|
|
166
562
|
program
|
|
167
|
-
.command('
|
|
168
|
-
.
|
|
169
|
-
.
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
563
|
+
.command('guide')
|
|
564
|
+
.alias('setup')
|
|
565
|
+
.description('Interactive setup guide for new users')
|
|
566
|
+
.action(guideCommand);
|
|
567
|
+
program
|
|
568
|
+
.command('quickstart')
|
|
569
|
+
.alias('quick')
|
|
570
|
+
.description('Show essential commands for quick start')
|
|
571
|
+
.action(quickStartCommand);
|
|
572
|
+
// Help customization
|
|
573
|
+
program.configureHelp({
|
|
574
|
+
formatHelp: (cmd, helper) => {
|
|
575
|
+
let help = chalk.blue.bold('🧠 Memory as a Service CLI\n\n');
|
|
576
|
+
help += helper.commandUsage(cmd) + '\n\n';
|
|
577
|
+
if (cmd.description()) {
|
|
578
|
+
help += chalk.yellow('Description:\n');
|
|
579
|
+
help += ` ${cmd.description()}\n\n`;
|
|
580
|
+
}
|
|
581
|
+
const commands = helper.visibleCommands(cmd);
|
|
582
|
+
if (commands.length > 0) {
|
|
583
|
+
help += chalk.yellow('Commands:\n');
|
|
584
|
+
const maxNameLength = Math.max(...commands.map(c => c.name().length));
|
|
585
|
+
commands.forEach(c => {
|
|
586
|
+
const name = c.name().padEnd(maxNameLength);
|
|
587
|
+
help += ` ${chalk.white(name)} ${c.description()}\n`;
|
|
588
|
+
});
|
|
589
|
+
help += '\n';
|
|
590
|
+
}
|
|
591
|
+
const options = helper.visibleOptions(cmd);
|
|
592
|
+
if (options.length > 0) {
|
|
593
|
+
help += chalk.yellow('Options:\n');
|
|
594
|
+
options.forEach(option => {
|
|
595
|
+
help += ` ${option.flags.padEnd(20)} ${option.description}\n`;
|
|
596
|
+
});
|
|
597
|
+
help += '\n';
|
|
598
|
+
}
|
|
599
|
+
const cmdName = isOnasisInvocation ? 'onasis' : program.name();
|
|
600
|
+
help += chalk.gray(`For more help on a specific command, run: ${cmdName} <command> --help\n`);
|
|
601
|
+
help += chalk.gray('Documentation: https://api.lanonasis.com/docs\n');
|
|
602
|
+
if (isOnasisInvocation) {
|
|
603
|
+
help += chalk.gray('Golden Contract: Onasis-Core v0.1 Compliant\n');
|
|
604
|
+
}
|
|
605
|
+
return help;
|
|
606
|
+
}
|
|
210
607
|
});
|
|
211
|
-
//
|
|
212
|
-
|
|
213
|
-
|
|
608
|
+
// Parse CLI arguments
|
|
609
|
+
async function main() {
|
|
610
|
+
// Check for special flags first
|
|
611
|
+
if (process.argv.includes('--completion-data')) {
|
|
612
|
+
await completionCommand();
|
|
613
|
+
return;
|
|
614
|
+
}
|
|
615
|
+
if (process.argv.includes('--completion')) {
|
|
616
|
+
const shellIndex = process.argv.indexOf('--completion');
|
|
617
|
+
const shell = process.argv[shellIndex + 1];
|
|
618
|
+
if (shell && !shell.startsWith('-')) {
|
|
619
|
+
// Shell completion script request
|
|
620
|
+
const completionsDir = path.join(__dirname, 'completions');
|
|
621
|
+
let scriptPath;
|
|
622
|
+
switch (shell.toLowerCase()) {
|
|
623
|
+
case 'bash':
|
|
624
|
+
scriptPath = path.join(completionsDir, 'bash-completion.sh');
|
|
625
|
+
break;
|
|
626
|
+
case 'zsh':
|
|
627
|
+
scriptPath = path.join(completionsDir, 'zsh-completion.zsh');
|
|
628
|
+
break;
|
|
629
|
+
case 'fish':
|
|
630
|
+
scriptPath = path.join(completionsDir, 'fish-completion.fish');
|
|
631
|
+
break;
|
|
632
|
+
default:
|
|
633
|
+
console.error(colors.error(`Unsupported shell: ${shell}`));
|
|
634
|
+
process.exit(1);
|
|
635
|
+
}
|
|
636
|
+
try {
|
|
637
|
+
const script = fs.readFileSync(scriptPath, 'utf8');
|
|
638
|
+
console.log(script);
|
|
639
|
+
return;
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
console.error(colors.error('Failed to read completion script'));
|
|
643
|
+
process.exit(1);
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
// Show welcome message if no arguments provided
|
|
648
|
+
if (process.argv.length <= 2) {
|
|
649
|
+
showWelcome();
|
|
650
|
+
return;
|
|
651
|
+
}
|
|
652
|
+
try {
|
|
653
|
+
await program.parseAsync(process.argv);
|
|
654
|
+
}
|
|
655
|
+
catch (error) {
|
|
656
|
+
if (error instanceof Error) {
|
|
657
|
+
console.error(chalk.red('✖ Error:'), error.message);
|
|
658
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
659
|
+
console.error(error.stack);
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
process.exit(1);
|
|
663
|
+
}
|
|
214
664
|
}
|
|
215
|
-
|
|
665
|
+
main();
|