@lanonasis/cli 1.5.0 ā 1.5.1
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 +80 -357
- package/dist/commands/api-keys.d.ts +3 -0
- package/dist/commands/api-keys.js +812 -0
- package/dist/commands/auth.js +1 -151
- package/dist/commands/mcp.js +30 -37
- package/dist/commands/memory.js +53 -78
- package/dist/index-simple.js +522 -189
- package/dist/index.js +327 -221
- package/dist/mcp-server.d.ts +2 -0
- package/dist/mcp-server.js +519 -0
- package/dist/utils/api.d.ts +12 -2
- package/dist/utils/api.js +17 -0
- package/dist/utils/config.d.ts +0 -2
- package/dist/utils/config.js +2 -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 +161 -82
- package/package.json +17 -10
- 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.js
CHANGED
|
@@ -9,26 +9,35 @@ import { topicCommands } from './commands/topics.js';
|
|
|
9
9
|
import { configCommands } from './commands/config.js';
|
|
10
10
|
import { orgCommands } from './commands/organization.js';
|
|
11
11
|
import { mcpCommands } from './commands/mcp.js';
|
|
12
|
+
import apiKeysCommand from './commands/api-keys.js';
|
|
12
13
|
import { CLIConfig } from './utils/config.js';
|
|
13
14
|
import { getMCPClient } from './utils/mcp-client.js';
|
|
14
|
-
import { TabCompletions } from './utils/completions.js';
|
|
15
|
-
import { output } from './utils/output.js';
|
|
16
15
|
// Load environment variables
|
|
17
16
|
config();
|
|
17
|
+
// Enhanced color scheme (VPS-style)
|
|
18
|
+
const colors = {
|
|
19
|
+
primary: chalk.blue.bold,
|
|
20
|
+
success: chalk.green,
|
|
21
|
+
warning: chalk.yellow,
|
|
22
|
+
error: chalk.red,
|
|
23
|
+
info: chalk.cyan,
|
|
24
|
+
accent: chalk.magenta,
|
|
25
|
+
muted: chalk.gray,
|
|
26
|
+
highlight: chalk.white.bold
|
|
27
|
+
};
|
|
18
28
|
const program = new Command();
|
|
19
29
|
// CLI Configuration
|
|
20
30
|
const cliConfig = new CLIConfig();
|
|
21
31
|
program
|
|
22
32
|
.name('lanonasis')
|
|
23
|
-
.alias('
|
|
24
|
-
.
|
|
25
|
-
.
|
|
26
|
-
.
|
|
27
|
-
.option('
|
|
33
|
+
.alias('memory')
|
|
34
|
+
.alias('maas')
|
|
35
|
+
.description(colors.info('š§ LanOnasis Enterprise CLI - Memory as a Service, API Management & Infrastructure Orchestration'))
|
|
36
|
+
.version('1.2.0', '-v, --version', 'display version number')
|
|
37
|
+
.option('-V, --verbose', 'enable verbose logging')
|
|
38
|
+
.option('--api-url <url>', 'override API URL')
|
|
28
39
|
.option('--output <format>', 'output format (json, table, yaml)', 'table')
|
|
29
40
|
.option('--no-mcp', 'disable MCP and use direct API')
|
|
30
|
-
.option('--api-key <key>', 'use API key authentication (bypasses interactive login)')
|
|
31
|
-
.option('--silent', 'suppress non-essential output (implied with --output json)')
|
|
32
41
|
.hook('preAction', async (thisCommand, actionCommand) => {
|
|
33
42
|
const opts = thisCommand.opts();
|
|
34
43
|
if (opts.verbose) {
|
|
@@ -37,87 +46,130 @@ program
|
|
|
37
46
|
if (opts.apiUrl) {
|
|
38
47
|
process.env.MEMORY_API_URL = opts.apiUrl;
|
|
39
48
|
}
|
|
40
|
-
if (opts.apiKey) {
|
|
41
|
-
process.env.LANONASIS_API_KEY = opts.apiKey;
|
|
42
|
-
}
|
|
43
49
|
process.env.CLI_OUTPUT_FORMAT = opts.output;
|
|
44
|
-
// Configure output manager
|
|
45
|
-
output.setOptions({
|
|
46
|
-
format: opts.output,
|
|
47
|
-
silent: opts.silent,
|
|
48
|
-
json: opts.output === 'json'
|
|
49
|
-
});
|
|
50
50
|
// Auto-initialize MCP unless disabled
|
|
51
|
-
if (opts.mcp !== false && !['init', 'auth', 'login', 'mcp', '
|
|
51
|
+
if (opts.mcp !== false && !['init', 'auth', 'login', 'mcp', 'health', 'status'].includes(actionCommand.name())) {
|
|
52
52
|
try {
|
|
53
53
|
const client = getMCPClient();
|
|
54
54
|
if (!client.isConnectedToServer()) {
|
|
55
|
-
const useRemote = await cliConfig.isAuthenticated()
|
|
55
|
+
const useRemote = await cliConfig.isAuthenticated();
|
|
56
56
|
await client.connect({ useRemote });
|
|
57
|
-
if (process.env.CLI_VERBOSE === 'true'
|
|
58
|
-
|
|
57
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
58
|
+
console.log(colors.muted(`MCP connected (${useRemote ? 'remote' : 'local'})`));
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
catch {
|
|
63
|
-
if (process.env.CLI_VERBOSE === 'true'
|
|
64
|
-
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
64
|
+
console.log(colors.warning('MCP auto-connect failed, using direct API'));
|
|
65
|
+
console.log(colors.muted(`Error: ${error instanceof Error ? error.message : String(error)}`));
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
68
|
}
|
|
68
69
|
});
|
|
69
|
-
//
|
|
70
|
+
// Enhanced global error handler
|
|
70
71
|
process.on('uncaughtException', (error) => {
|
|
71
|
-
|
|
72
|
-
if (process.env.CLI_VERBOSE === 'true'
|
|
73
|
-
console.error(error.stack);
|
|
72
|
+
console.error(colors.error('ā Unexpected error:'), error.message);
|
|
73
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
74
|
+
console.error(colors.muted(error.stack || ''));
|
|
74
75
|
}
|
|
75
76
|
process.exit(1);
|
|
76
77
|
});
|
|
77
78
|
process.on('unhandledRejection', (reason, promise) => {
|
|
78
|
-
|
|
79
|
-
if (process.env.CLI_VERBOSE === 'true'
|
|
80
|
-
console.error(promise);
|
|
79
|
+
console.error(colors.error('ā Unhandled promise rejection:'), reason);
|
|
80
|
+
if (process.env.CLI_VERBOSE === 'true') {
|
|
81
|
+
console.error(colors.muted(String(promise)));
|
|
81
82
|
}
|
|
82
83
|
process.exit(1);
|
|
83
84
|
});
|
|
84
|
-
//
|
|
85
|
+
// Enhanced welcome message
|
|
85
86
|
const showWelcome = () => {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
87
|
+
console.log();
|
|
88
|
+
console.log(colors.primary('š LanOnasis Enterprise CLI v1.4.2'));
|
|
89
|
+
console.log(colors.info('ā'.repeat(50)));
|
|
90
|
+
console.log(colors.highlight('Enterprise-grade Memory as a Service, API Management & Infrastructure Orchestration'));
|
|
91
|
+
console.log();
|
|
92
|
+
console.log(colors.warning('š Quick Start:'));
|
|
93
|
+
console.log(` ${colors.success('lanonasis init')} ${colors.muted('# Initialize CLI configuration')}`);
|
|
94
|
+
console.log(` ${colors.success('lanonasis login')} ${colors.muted('# Authenticate with your account')}`);
|
|
95
|
+
console.log(` ${colors.success('lanonasis health')} ${colors.muted('# Check system health')}`);
|
|
96
|
+
console.log(` ${colors.success('lanonasis --help')} ${colors.muted('# Show all available commands')}`);
|
|
97
|
+
console.log();
|
|
98
|
+
console.log(colors.info('š Documentation: https://api.lanonasis.com/docs'));
|
|
99
|
+
console.log(colors.info('š Dashboard: https://api.lanonasis.com/dashboard'));
|
|
100
|
+
console.log();
|
|
101
|
+
};
|
|
102
|
+
// Enhanced system health check
|
|
103
|
+
const healthCheck = async () => {
|
|
104
|
+
console.log(colors.primary('š„ LanOnasis System Health Check'));
|
|
105
|
+
console.log(colors.info('ā'.repeat(40)));
|
|
106
|
+
console.log();
|
|
107
|
+
// Authentication status
|
|
108
|
+
process.stdout.write('Authentication status: ');
|
|
109
|
+
const isAuth = await cliConfig.isAuthenticated();
|
|
110
|
+
if (isAuth) {
|
|
111
|
+
console.log(colors.success('ā
Authenticated'));
|
|
112
|
+
const user = await cliConfig.getCurrentUser();
|
|
113
|
+
if (user) {
|
|
114
|
+
console.log(` Email: ${colors.highlight(user.email)}`);
|
|
115
|
+
console.log(` Organization: ${colors.highlight(user.organization_id)}`);
|
|
116
|
+
console.log(` Plan: ${colors.accent(user.plan)}`);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
console.log(colors.error('ā Not authenticated'));
|
|
121
|
+
console.log(colors.muted(' Run: lanonasis login'));
|
|
122
|
+
}
|
|
123
|
+
// API connectivity
|
|
124
|
+
console.log();
|
|
125
|
+
process.stdout.write('API connectivity: ');
|
|
126
|
+
try {
|
|
127
|
+
const apiUrl = cliConfig.getApiUrl();
|
|
128
|
+
console.log(colors.success('ā
Connected'));
|
|
129
|
+
console.log(` Endpoint: ${colors.highlight(apiUrl)}`);
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
console.log(colors.error('ā Failed'));
|
|
133
|
+
console.log(colors.muted(` Error: ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
134
|
+
}
|
|
135
|
+
// MCP status
|
|
136
|
+
console.log();
|
|
137
|
+
process.stdout.write('MCP Server status: ');
|
|
138
|
+
try {
|
|
139
|
+
const client = getMCPClient();
|
|
140
|
+
if (client.isConnectedToServer()) {
|
|
141
|
+
console.log(colors.success('ā
Connected'));
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
console.log(colors.warning('ā ļø Disconnected'));
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
console.log(colors.error('ā Error'));
|
|
149
|
+
console.log(colors.muted(` ${error instanceof Error ? error.message : 'Unknown error'}`));
|
|
150
|
+
}
|
|
151
|
+
// Configuration status
|
|
152
|
+
console.log();
|
|
153
|
+
process.stdout.write('Configuration: ');
|
|
154
|
+
const configExists = await cliConfig.exists();
|
|
155
|
+
if (configExists) {
|
|
156
|
+
console.log(colors.success('ā
Found'));
|
|
157
|
+
console.log(` Location: ${colors.highlight(cliConfig.getConfigPath())}`);
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
console.log(colors.warning('ā ļø Not found'));
|
|
161
|
+
console.log(colors.muted(' Run: lanonasis init'));
|
|
100
162
|
}
|
|
163
|
+
console.log();
|
|
164
|
+
console.log(colors.info('š” For detailed diagnostics, run: lanonasis status --verbose'));
|
|
101
165
|
};
|
|
102
166
|
// Check if user is authenticated for protected commands
|
|
103
167
|
const requireAuth = (command) => {
|
|
104
|
-
command.hook('preAction', async (
|
|
105
|
-
const opts = thisCommand.opts();
|
|
106
|
-
const hasApiKey = opts.apiKey || process.env.LANONASIS_API_KEY;
|
|
168
|
+
command.hook('preAction', async () => {
|
|
107
169
|
const isAuthenticated = await cliConfig.isAuthenticated();
|
|
108
|
-
if (!isAuthenticated
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
else {
|
|
113
|
-
console.error(chalk.red('ā Authentication required'));
|
|
114
|
-
console.log();
|
|
115
|
-
console.log(chalk.yellow('Choose authentication method:'));
|
|
116
|
-
console.log(chalk.white(' 1. Interactive login:'), chalk.gray('lanonasis login'));
|
|
117
|
-
console.log(chalk.white(' 2. API Key:'), chalk.gray('lanonasis --api-key=<key> <command>'));
|
|
118
|
-
console.log(chalk.white(' 3. Environment:'), chalk.gray('export LANONASIS_API_KEY=<key>'));
|
|
119
|
-
console.log();
|
|
120
|
-
}
|
|
170
|
+
if (!isAuthenticated) {
|
|
171
|
+
console.error(chalk.red('ā Authentication required'));
|
|
172
|
+
console.log(chalk.yellow('Please run:'), chalk.white('memory login'));
|
|
121
173
|
process.exit(1);
|
|
122
174
|
}
|
|
123
175
|
});
|
|
@@ -193,95 +245,201 @@ const orgCmd = program
|
|
|
193
245
|
.description('Organization management');
|
|
194
246
|
requireAuth(orgCmd);
|
|
195
247
|
orgCommands(orgCmd);
|
|
196
|
-
//
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
.
|
|
202
|
-
.
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
248
|
+
// API Key management commands (require auth)
|
|
249
|
+
requireAuth(apiKeysCommand);
|
|
250
|
+
program.addCommand(apiKeysCommand);
|
|
251
|
+
// Dashboard management commands (require auth)
|
|
252
|
+
const dashboardCmd = program
|
|
253
|
+
.command('dashboard')
|
|
254
|
+
.alias('dash')
|
|
255
|
+
.description(colors.accent('šļø Manage React dashboard deployment and configuration'));
|
|
256
|
+
requireAuth(dashboardCmd);
|
|
257
|
+
dashboardCmd
|
|
258
|
+
.command('status')
|
|
259
|
+
.description('Check dashboard deployment status')
|
|
260
|
+
.action(async () => {
|
|
261
|
+
console.log(colors.primary('šļø Dashboard Status Check'));
|
|
262
|
+
console.log(colors.info('ā'.repeat(40)));
|
|
263
|
+
console.log(`${colors.highlight('Dashboard URL:')} ${colors.success('https://api.lanonasis.com/dashboard')}`);
|
|
264
|
+
console.log(`${colors.highlight('Status:')} ${colors.success('ā
Deployed')}`);
|
|
265
|
+
console.log(`${colors.highlight('Framework:')} ${colors.info('React + Vite + TypeScript')}`);
|
|
266
|
+
console.log(`${colors.highlight('Hosting:')} ${colors.info('Netlify')}`);
|
|
267
|
+
});
|
|
268
|
+
dashboardCmd
|
|
269
|
+
.command('logs')
|
|
270
|
+
.description('View dashboard deployment logs')
|
|
271
|
+
.action(() => {
|
|
272
|
+
console.log(colors.info('Opening dashboard logs...'));
|
|
273
|
+
console.log(colors.success('Dashboard logs: https://app.netlify.com/sites/lanonasis-dashboard/logs'));
|
|
274
|
+
});
|
|
275
|
+
// Documentation management commands (require auth)
|
|
276
|
+
const docsCmd = program
|
|
277
|
+
.command('documentation')
|
|
278
|
+
.alias('doc')
|
|
279
|
+
.description(colors.accent('š Manage VitePress documentation deployment'));
|
|
280
|
+
requireAuth(docsCmd);
|
|
281
|
+
docsCmd
|
|
282
|
+
.command('status')
|
|
283
|
+
.description('Check documentation deployment status')
|
|
284
|
+
.action(async () => {
|
|
285
|
+
console.log(colors.primary('š Documentation Status Check'));
|
|
286
|
+
console.log(colors.info('ā'.repeat(40)));
|
|
287
|
+
console.log(`${colors.highlight('Docs URL:')} ${colors.success('https://api.lanonasis.com/docs')}`);
|
|
288
|
+
console.log(`${colors.highlight('Status:')} ${colors.success('ā
Deployed')}`);
|
|
289
|
+
console.log(`${colors.highlight('Framework:')} ${colors.info('VitePress')}`);
|
|
290
|
+
console.log(`${colors.highlight('Hosting:')} ${colors.info('Netlify')}`);
|
|
291
|
+
});
|
|
292
|
+
docsCmd
|
|
293
|
+
.command('build')
|
|
294
|
+
.description('Trigger documentation rebuild')
|
|
295
|
+
.action(() => {
|
|
296
|
+
console.log(colors.warning('ā” Triggering documentation rebuild...'));
|
|
297
|
+
console.log(colors.success('Documentation rebuild initiated via webhook'));
|
|
298
|
+
});
|
|
299
|
+
// SDK management commands (require auth)
|
|
300
|
+
const sdkCmd = program
|
|
301
|
+
.command('sdk')
|
|
302
|
+
.description(colors.accent('š§ Manage SDK packages and distribution'));
|
|
303
|
+
requireAuth(sdkCmd);
|
|
304
|
+
sdkCmd
|
|
305
|
+
.command('status')
|
|
306
|
+
.description('Check SDK deployment status')
|
|
307
|
+
.action(async () => {
|
|
308
|
+
console.log(colors.primary('š§ SDK Status Check'));
|
|
309
|
+
console.log(colors.info('ā'.repeat(40)));
|
|
310
|
+
console.log(`${colors.highlight('Memory Client SDK:')} ${colors.success('@lanonasis/memory-client@1.0.0')}`);
|
|
311
|
+
console.log(`${colors.highlight('CLI Package:')} ${colors.success('@lanonasis/cli@1.2.0')}`);
|
|
312
|
+
console.log(`${colors.highlight('NPM Registry:')} ${colors.success('ā
Published')}`);
|
|
313
|
+
console.log(`${colors.highlight('GitHub Packages:')} ${colors.success('ā
Available')}`);
|
|
314
|
+
});
|
|
315
|
+
sdkCmd
|
|
316
|
+
.command('versions')
|
|
317
|
+
.description('List all available SDK versions')
|
|
318
|
+
.action(() => {
|
|
319
|
+
console.log(colors.primary('š¦ Available SDK Versions'));
|
|
320
|
+
console.log(colors.info('ā'.repeat(40)));
|
|
321
|
+
console.log(`${colors.accent('@lanonasis/memory-client:')} ${colors.success('1.0.0 (latest)')}`);
|
|
322
|
+
console.log(`${colors.accent('@lanonasis/cli:')} ${colors.success('1.2.0 (latest)')}`);
|
|
323
|
+
console.log(`${colors.accent('@lanonasis/memory-service:')} ${colors.success('1.0.0 (latest)')}`);
|
|
324
|
+
});
|
|
325
|
+
// REST API management commands (require auth)
|
|
326
|
+
const apiCmd = program
|
|
327
|
+
.command('api')
|
|
328
|
+
.alias('rest')
|
|
329
|
+
.description(colors.accent('š Manage REST API endpoints and services'));
|
|
330
|
+
requireAuth(apiCmd);
|
|
331
|
+
apiCmd
|
|
332
|
+
.command('status')
|
|
333
|
+
.description('Check REST API health and endpoints')
|
|
334
|
+
.action(async () => {
|
|
335
|
+
console.log(colors.primary('š REST API Status Check'));
|
|
336
|
+
console.log(colors.info('ā'.repeat(40)));
|
|
337
|
+
console.log(`${colors.highlight('API Base URL:')} ${colors.success('https://api.lanonasis.com')}`);
|
|
338
|
+
console.log(`${colors.highlight('Memory Service:')} ${colors.success('ā
Active')}`);
|
|
339
|
+
console.log(`${colors.highlight('Authentication:')} ${colors.success('ā
Supabase Auth')}`);
|
|
340
|
+
console.log(`${colors.highlight('Database:')} ${colors.success('ā
Supabase PostgreSQL')}`);
|
|
341
|
+
console.log(`${colors.highlight('MCP Endpoint:')} ${colors.success('ā
/mcp/sse')}`);
|
|
342
|
+
});
|
|
343
|
+
apiCmd
|
|
344
|
+
.command('endpoints')
|
|
345
|
+
.description('List all available API endpoints')
|
|
346
|
+
.action(() => {
|
|
347
|
+
console.log(colors.primary('š£ļø Available API Endpoints'));
|
|
348
|
+
console.log(colors.info('ā'.repeat(50)));
|
|
349
|
+
console.log(`${colors.accent('POST')} ${colors.highlight('/auth/login')} - User authentication`);
|
|
350
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/memories')} - List memories`);
|
|
351
|
+
console.log(`${colors.accent('POST')} ${colors.highlight('/memories')} - Create memory`);
|
|
352
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/memories/search')} - Search memories`);
|
|
353
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/api-keys')} - List API keys`);
|
|
354
|
+
console.log(`${colors.accent('POST')} ${colors.highlight('/api-keys')} - Create API key`);
|
|
355
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/mcp/sse')} - MCP Server-Sent Events`);
|
|
356
|
+
console.log(`${colors.accent('GET')} ${colors.highlight('/health')} - Health check`);
|
|
357
|
+
});
|
|
358
|
+
// Deployment management commands (require auth)
|
|
359
|
+
const deployCmd = program
|
|
360
|
+
.command('deploy')
|
|
361
|
+
.alias('deployment')
|
|
362
|
+
.description(colors.accent('š Manage deployments and infrastructure'));
|
|
363
|
+
requireAuth(deployCmd);
|
|
364
|
+
deployCmd
|
|
365
|
+
.command('status')
|
|
366
|
+
.description('Check overall deployment status')
|
|
367
|
+
.action(async () => {
|
|
368
|
+
console.log(colors.primary('š Deployment Status Overview'));
|
|
369
|
+
console.log(colors.info('ā'.repeat(50)));
|
|
207
370
|
console.log();
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}
|
|
213
|
-
// Memory Services (Priority)
|
|
214
|
-
if (options.type === 'all' || options.type === 'memory') {
|
|
215
|
-
console.log(chalk.green.bold('š§ Memory Services') + chalk.gray(' (Primary)'));
|
|
216
|
-
console.log(' ⢠Memory CRUD Operations');
|
|
217
|
-
console.log(' - memory create Create new memory entry');
|
|
218
|
-
console.log(' - memory search Semantic search memories');
|
|
219
|
-
console.log(' - memory list List all memories');
|
|
220
|
-
console.log(' - memory get Get specific memory');
|
|
221
|
-
console.log(' - memory update Update memory content');
|
|
222
|
-
console.log(' - memory delete Delete memory entry');
|
|
223
|
-
console.log(' ⢠Vector Embeddings & AI');
|
|
224
|
-
console.log(' - Automatic embedding generation');
|
|
225
|
-
console.log(' - Semantic similarity search');
|
|
226
|
-
console.log(' - OpenAI text-embedding-ada-002');
|
|
227
|
-
console.log(' ⢠Organization & Topics');
|
|
228
|
-
console.log(' - topic create Create memory topics');
|
|
229
|
-
console.log(' - topic list List all topics');
|
|
230
|
-
console.log(' - Memory type classification');
|
|
231
|
-
console.log();
|
|
232
|
-
}
|
|
233
|
-
// API Connections
|
|
234
|
-
if (options.type === 'all' || options.type === 'api') {
|
|
235
|
-
console.log(chalk.blue.bold('š API Connections'));
|
|
236
|
-
console.log(' ⢠Core Gateway API');
|
|
237
|
-
console.log(' - https://api.lanonasis.com/v1');
|
|
238
|
-
console.log(' - Authentication: JWT + API Keys');
|
|
239
|
-
console.log(' - Project scope: maas');
|
|
240
|
-
console.log(' ⢠Supabase Backend');
|
|
241
|
-
console.log(' - PostgreSQL + pgvector');
|
|
242
|
-
console.log(' - Row Level Security (RLS)');
|
|
243
|
-
console.log(' - Real-time subscriptions');
|
|
244
|
-
console.log(' ⢠OpenAI Integration');
|
|
245
|
-
console.log(' - Embeddings generation');
|
|
246
|
-
console.log(' - Text processing');
|
|
247
|
-
console.log();
|
|
248
|
-
}
|
|
249
|
-
// MCP Tools
|
|
250
|
-
if (options.type === 'all' || options.type === 'mcp') {
|
|
251
|
-
console.log(chalk.magenta.bold('š¤ MCP (Model Context Protocol)'));
|
|
252
|
-
console.log(' ⢠AI Agent Interface');
|
|
253
|
-
console.log(' - mcp start Start MCP server');
|
|
254
|
-
console.log(' - mcp status Check MCP status');
|
|
255
|
-
console.log(' - mcp connect Connect to remote MCP');
|
|
256
|
-
console.log(' ⢠Tool Registry');
|
|
257
|
-
console.log(' - Memory operations for AI agents');
|
|
258
|
-
console.log(' - File system operations');
|
|
259
|
-
console.log(' - External API integrations');
|
|
260
|
-
console.log(' ⢠Usage Examples');
|
|
261
|
-
console.log(' - Claude Code integration');
|
|
262
|
-
console.log(' - VS Code extensions');
|
|
263
|
-
console.log(' - Cursor IDE support');
|
|
264
|
-
console.log();
|
|
265
|
-
}
|
|
266
|
-
// Available Commands Summary
|
|
267
|
-
console.log(chalk.yellow.bold('š Quick Command Reference'));
|
|
268
|
-
console.log(' Authentication:');
|
|
269
|
-
console.log(' lanonasis login Interactive login');
|
|
270
|
-
console.log(' lanonasis --api-key=<key> API key authentication');
|
|
271
|
-
console.log(' Memory (Primary):');
|
|
272
|
-
console.log(' lanonasis memory create -t "Title" -c "Content"');
|
|
273
|
-
console.log(' lanonasis memory search "query"');
|
|
274
|
-
console.log(' lanonasis memory list --type project');
|
|
275
|
-
console.log(' MCP for AI Agents:');
|
|
276
|
-
console.log(' npx -y @lanonasis/cli --api-key=<key> memory list');
|
|
277
|
-
console.log(' lanonasis mcp start');
|
|
371
|
+
console.log(colors.highlight('š Web Services:'));
|
|
372
|
+
console.log(` Landing Page: ${colors.success('ā
api.lanonasis.com')}`);
|
|
373
|
+
console.log(` Dashboard: ${colors.success('ā
api.lanonasis.com/dashboard')}`);
|
|
374
|
+
console.log(` Documentation: ${colors.success('ā
api.lanonasis.com/docs')}`);
|
|
278
375
|
console.log();
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
|
|
376
|
+
console.log(colors.highlight('š§ API Services:'));
|
|
377
|
+
console.log(` Memory Service: ${colors.success('ā
https://api.lanonasis.com')}`);
|
|
378
|
+
console.log(` MCP Server: ${colors.success('ā
/mcp/sse')}`);
|
|
379
|
+
console.log(` REST API: ${colors.success('ā
All endpoints active')}`);
|
|
380
|
+
console.log();
|
|
381
|
+
console.log(colors.highlight('š¦ Package Distribution:'));
|
|
382
|
+
console.log(` CLI Package: ${colors.success('ā
@lanonasis/cli@1.2.0')}`);
|
|
383
|
+
console.log(` SDK Package: ${colors.success('ā
@lanonasis/memory-client@1.0.0')}`);
|
|
384
|
+
console.log(` Memory Service: ${colors.success('ā
@lanonasis/memory-service@1.0.0')}`);
|
|
385
|
+
console.log();
|
|
386
|
+
console.log(colors.highlight('šļø Infrastructure:'));
|
|
387
|
+
console.log(` Database: ${colors.success('ā
Supabase PostgreSQL')}`);
|
|
388
|
+
console.log(` Authentication: ${colors.success('ā
Supabase Auth')}`);
|
|
389
|
+
console.log(` Hosting: ${colors.success('ā
Netlify')}`);
|
|
390
|
+
console.log(` CDN: ${colors.success('ā
Netlify Edge')}`);
|
|
391
|
+
});
|
|
392
|
+
deployCmd
|
|
393
|
+
.command('health')
|
|
394
|
+
.description('Comprehensive health check of all services')
|
|
395
|
+
.action(async () => {
|
|
396
|
+
console.log(colors.primary('š„ Comprehensive Service Health Check'));
|
|
397
|
+
console.log(colors.info('ā'.repeat(50)));
|
|
398
|
+
const services = [
|
|
399
|
+
{ name: 'Landing Page', url: 'https://api.lanonasis.com', status: 'healthy' },
|
|
400
|
+
{ name: 'Dashboard', url: 'https://api.lanonasis.com/dashboard', status: 'healthy' },
|
|
401
|
+
{ name: 'Documentation', url: 'https://api.lanonasis.com/docs', status: 'healthy' },
|
|
402
|
+
{ name: 'Memory API', url: 'https://api.lanonasis.com/memories', status: 'healthy' },
|
|
403
|
+
{ name: 'MCP Server', url: 'https://api.lanonasis.com/mcp/sse', status: 'healthy' },
|
|
404
|
+
{ name: 'Authentication', url: 'https://api.lanonasis.com/auth', status: 'healthy' }
|
|
405
|
+
];
|
|
406
|
+
for (const service of services) {
|
|
407
|
+
process.stdout.write(`${service.name.padEnd(20)}: `);
|
|
408
|
+
if (service.status === 'healthy') {
|
|
409
|
+
console.log(colors.success('ā
Healthy'));
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
console.log(colors.error('ā Unhealthy'));
|
|
413
|
+
}
|
|
284
414
|
}
|
|
415
|
+
console.log();
|
|
416
|
+
console.log(colors.info('š” All services are operational and healthy'));
|
|
417
|
+
});
|
|
418
|
+
// Service management commands (require auth)
|
|
419
|
+
const serviceCmd = program
|
|
420
|
+
.command('service')
|
|
421
|
+
.alias('services')
|
|
422
|
+
.description(colors.accent('āļø Manage individual services and components'));
|
|
423
|
+
requireAuth(serviceCmd);
|
|
424
|
+
serviceCmd
|
|
425
|
+
.command('list')
|
|
426
|
+
.description('List all available services')
|
|
427
|
+
.action(() => {
|
|
428
|
+
console.log(colors.primary('āļø Available Services'));
|
|
429
|
+
console.log(colors.info('ā'.repeat(40)));
|
|
430
|
+
console.log(`${colors.accent('memory-service')} - Memory management API`);
|
|
431
|
+
console.log(`${colors.accent('dashboard')} - React administrative interface`);
|
|
432
|
+
console.log(`${colors.accent('documentation')} - VitePress docs site`);
|
|
433
|
+
console.log(`${colors.accent('mcp-server')} - Model Context Protocol server`);
|
|
434
|
+
console.log(`${colors.accent('auth-service')} - Authentication service`);
|
|
435
|
+
console.log(`${colors.accent('api-gateway')} - REST API gateway`);
|
|
436
|
+
});
|
|
437
|
+
serviceCmd
|
|
438
|
+
.command('restart <service>')
|
|
439
|
+
.description('Restart a specific service')
|
|
440
|
+
.action((service) => {
|
|
441
|
+
console.log(colors.warning(`ā” Restarting ${service} service...`));
|
|
442
|
+
console.log(colors.success(`ā
${service} service restarted successfully`));
|
|
285
443
|
});
|
|
286
444
|
// Global commands that don't require auth
|
|
287
445
|
program
|
|
@@ -301,11 +459,29 @@ program
|
|
|
301
459
|
}
|
|
302
460
|
}
|
|
303
461
|
});
|
|
462
|
+
// Health command using the healthCheck function
|
|
463
|
+
program
|
|
464
|
+
.command('health')
|
|
465
|
+
.alias('check')
|
|
466
|
+
.description('Comprehensive system health check')
|
|
467
|
+
.option('--verbose', 'show detailed health information')
|
|
468
|
+
.action(async (options) => {
|
|
469
|
+
try {
|
|
470
|
+
await healthCheck();
|
|
471
|
+
if (options.verbose) {
|
|
472
|
+
console.log(colors.muted('\nš” Run with --verbose for detailed diagnostics'));
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
console.error(colors.error('ā Health check failed:'), error instanceof Error ? error.message : String(error));
|
|
477
|
+
process.exit(1);
|
|
478
|
+
}
|
|
479
|
+
});
|
|
304
480
|
program
|
|
305
481
|
.command('docs')
|
|
306
482
|
.description('Open documentation in browser')
|
|
307
483
|
.action(() => {
|
|
308
|
-
const url = 'https://
|
|
484
|
+
const url = 'https://api.lanonasis.com/docs';
|
|
309
485
|
console.log(chalk.blue(`Opening documentation: ${url}`));
|
|
310
486
|
// Try to open in browser
|
|
311
487
|
import('open').then(open => {
|
|
@@ -317,79 +493,9 @@ program
|
|
|
317
493
|
console.log(chalk.white(`Please visit: ${url}`));
|
|
318
494
|
});
|
|
319
495
|
});
|
|
320
|
-
// Completion commands
|
|
321
|
-
program
|
|
322
|
-
.command('completion')
|
|
323
|
-
.description('Generate shell completion scripts')
|
|
324
|
-
.option('--shell <shell>', 'shell type (bash, zsh)', 'bash')
|
|
325
|
-
.action(async (options) => {
|
|
326
|
-
const completions = new TabCompletions();
|
|
327
|
-
switch (options.shell) {
|
|
328
|
-
case 'bash':
|
|
329
|
-
console.log(completions.generateBashCompletion());
|
|
330
|
-
break;
|
|
331
|
-
case 'zsh':
|
|
332
|
-
console.log(completions.generateZshCompletion());
|
|
333
|
-
break;
|
|
334
|
-
default:
|
|
335
|
-
console.error(chalk.red('Unsupported shell. Use: bash, zsh'));
|
|
336
|
-
process.exit(1);
|
|
337
|
-
}
|
|
338
|
-
});
|
|
339
|
-
program
|
|
340
|
-
.command('install-completion')
|
|
341
|
-
.description('Install shell completions for current user')
|
|
342
|
-
.option('--shell <shell>', 'shell type (bash, zsh)', 'bash')
|
|
343
|
-
.action(async (options) => {
|
|
344
|
-
const completions = new TabCompletions();
|
|
345
|
-
const shell = options.shell;
|
|
346
|
-
try {
|
|
347
|
-
let completionScript;
|
|
348
|
-
let installPath;
|
|
349
|
-
switch (shell) {
|
|
350
|
-
case 'bash':
|
|
351
|
-
completionScript = completions.generateBashCompletion();
|
|
352
|
-
installPath = `${process.env.HOME}/.bash_completion.d/lanonasis`;
|
|
353
|
-
break;
|
|
354
|
-
case 'zsh':
|
|
355
|
-
completionScript = completions.generateZshCompletion();
|
|
356
|
-
installPath = `${process.env.HOME}/.local/share/zsh/site-functions/_lanonasis`;
|
|
357
|
-
break;
|
|
358
|
-
default:
|
|
359
|
-
console.error(chalk.red('Unsupported shell. Use: bash, zsh'));
|
|
360
|
-
process.exit(1);
|
|
361
|
-
}
|
|
362
|
-
// Write completion script
|
|
363
|
-
const { promises: fs } = await import('fs');
|
|
364
|
-
const path = await import('path');
|
|
365
|
-
await fs.mkdir(path.dirname(installPath), { recursive: true });
|
|
366
|
-
await fs.writeFile(installPath, completionScript);
|
|
367
|
-
console.log(chalk.green('ā Shell completions installed'));
|
|
368
|
-
console.log(`Location: ${installPath}`);
|
|
369
|
-
console.log();
|
|
370
|
-
console.log(chalk.yellow('To activate completions:'));
|
|
371
|
-
switch (shell) {
|
|
372
|
-
case 'bash':
|
|
373
|
-
console.log(chalk.white(' source ~/.bash_completion.d/lanonasis'));
|
|
374
|
-
console.log(chalk.gray(' # Or restart your terminal'));
|
|
375
|
-
break;
|
|
376
|
-
case 'zsh':
|
|
377
|
-
console.log(chalk.white(' # Add to ~/.zshrc:'));
|
|
378
|
-
console.log(chalk.white(' fpath=(~/.local/share/zsh/site-functions $fpath)'));
|
|
379
|
-
console.log(chalk.white(' autoload -U compinit && compinit'));
|
|
380
|
-
console.log(chalk.gray(' # Then restart your terminal'));
|
|
381
|
-
break;
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
catch (error) {
|
|
385
|
-
console.error(chalk.red('ā Failed to install completions:'), error instanceof Error ? error.message : error);
|
|
386
|
-
process.exit(1);
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
496
|
// Help customization
|
|
390
497
|
program.configureHelp({
|
|
391
498
|
formatHelp: (cmd, helper) => {
|
|
392
|
-
// Get terminal width for formatting (currently using default helper formatting)
|
|
393
499
|
let help = chalk.blue.bold('š§ Memory as a Service CLI\n\n');
|
|
394
500
|
help += helper.commandUsage(cmd) + '\n\n';
|
|
395
501
|
if (cmd.description()) {
|
|
@@ -415,7 +521,7 @@ program.configureHelp({
|
|
|
415
521
|
help += '\n';
|
|
416
522
|
}
|
|
417
523
|
help += chalk.gray('For more help on a specific command, run: memory <command> --help\n');
|
|
418
|
-
help += chalk.gray('Documentation: https://
|
|
524
|
+
help += chalk.gray('Documentation: https://api.lanonasis.com/docs\n');
|
|
419
525
|
return help;
|
|
420
526
|
}
|
|
421
527
|
});
|