@lanonasis/cli 1.1.0 → 1.2.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 +129 -25
- package/dist/commands/api-keys.d.ts +3 -0
- package/dist/commands/api-keys.js +812 -0
- package/dist/commands/mcp.js +2 -2
- package/dist/commands/memory.js +13 -8
- package/dist/commands/topics.js +2 -2
- package/dist/index-simple.js +522 -189
- package/dist/index.js +319 -23
- package/dist/utils/api.d.ts +12 -2
- package/dist/utils/api.js +17 -0
- package/dist/utils/formatting.d.ts +2 -0
- package/dist/utils/formatting.js +13 -0
- package/dist/utils/mcp-client.js +13 -7
- package/package.json +8 -3
package/dist/index.js
CHANGED
|
@@ -9,19 +9,32 @@ 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
15
|
// Load environment variables
|
|
15
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
|
+
};
|
|
16
28
|
const program = new Command();
|
|
17
29
|
// CLI Configuration
|
|
18
30
|
const cliConfig = new CLIConfig();
|
|
19
31
|
program
|
|
20
|
-
.name('
|
|
32
|
+
.name('lanonasis')
|
|
33
|
+
.alias('memory')
|
|
21
34
|
.alias('maas')
|
|
22
|
-
.description('Enterprise Memory as a Service
|
|
23
|
-
.version('1.
|
|
24
|
-
.option('-
|
|
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')
|
|
25
38
|
.option('--api-url <url>', 'override API URL')
|
|
26
39
|
.option('--output <format>', 'output format (json, table, yaml)', 'table')
|
|
27
40
|
.option('--no-mcp', 'disable MCP and use direct API')
|
|
@@ -35,50 +48,121 @@ program
|
|
|
35
48
|
}
|
|
36
49
|
process.env.CLI_OUTPUT_FORMAT = opts.output;
|
|
37
50
|
// Auto-initialize MCP unless disabled
|
|
38
|
-
if (opts.mcp !== false && !['init', 'auth', 'login', 'mcp'].includes(actionCommand.name())) {
|
|
51
|
+
if (opts.mcp !== false && !['init', 'auth', 'login', 'mcp', 'health', 'status'].includes(actionCommand.name())) {
|
|
39
52
|
try {
|
|
40
53
|
const client = getMCPClient();
|
|
41
54
|
if (!client.isConnectedToServer()) {
|
|
42
55
|
const useRemote = await cliConfig.isAuthenticated();
|
|
43
56
|
await client.connect({ useRemote });
|
|
44
57
|
if (process.env.CLI_VERBOSE === 'true') {
|
|
45
|
-
console.log(
|
|
58
|
+
console.log(colors.muted(`MCP connected (${useRemote ? 'remote' : 'local'})`));
|
|
46
59
|
}
|
|
47
60
|
}
|
|
48
61
|
}
|
|
49
62
|
catch (error) {
|
|
50
63
|
if (process.env.CLI_VERBOSE === 'true') {
|
|
51
|
-
console.log(
|
|
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)}`));
|
|
52
66
|
}
|
|
53
67
|
}
|
|
54
68
|
}
|
|
55
69
|
});
|
|
56
|
-
//
|
|
70
|
+
// Enhanced global error handler
|
|
57
71
|
process.on('uncaughtException', (error) => {
|
|
58
|
-
console.error(
|
|
72
|
+
console.error(colors.error('✖ Unexpected error:'), error.message);
|
|
59
73
|
if (process.env.CLI_VERBOSE === 'true') {
|
|
60
|
-
console.error(error.stack);
|
|
74
|
+
console.error(colors.muted(error.stack || ''));
|
|
61
75
|
}
|
|
62
76
|
process.exit(1);
|
|
63
77
|
});
|
|
64
78
|
process.on('unhandledRejection', (reason, promise) => {
|
|
65
|
-
console.error(
|
|
79
|
+
console.error(colors.error('✖ Unhandled promise rejection:'), reason);
|
|
66
80
|
if (process.env.CLI_VERBOSE === 'true') {
|
|
67
|
-
console.error(promise);
|
|
81
|
+
console.error(colors.muted(String(promise)));
|
|
68
82
|
}
|
|
69
83
|
process.exit(1);
|
|
70
84
|
});
|
|
71
|
-
//
|
|
85
|
+
// Enhanced welcome message
|
|
72
86
|
const showWelcome = () => {
|
|
73
|
-
console.log(chalk.blue.bold('🧠 Memory as a Service (MaaS) CLI'));
|
|
74
|
-
console.log(chalk.gray('Enterprise-grade memory management for AI applications'));
|
|
75
87
|
console.log();
|
|
76
|
-
console.log(
|
|
77
|
-
console.log(
|
|
78
|
-
console.log(
|
|
79
|
-
console.log(
|
|
88
|
+
console.log(colors.primary('🚀 LanOnasis Enterprise CLI v1.2.0'));
|
|
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'));
|
|
80
100
|
console.log();
|
|
81
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'));
|
|
162
|
+
}
|
|
163
|
+
console.log();
|
|
164
|
+
console.log(colors.info('💡 For detailed diagnostics, run: lanonasis status --verbose'));
|
|
165
|
+
};
|
|
82
166
|
// Check if user is authenticated for protected commands
|
|
83
167
|
const requireAuth = (command) => {
|
|
84
168
|
command.hook('preAction', async () => {
|
|
@@ -161,6 +245,202 @@ const orgCmd = program
|
|
|
161
245
|
.description('Organization management');
|
|
162
246
|
requireAuth(orgCmd);
|
|
163
247
|
orgCommands(orgCmd);
|
|
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)));
|
|
370
|
+
console.log();
|
|
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')}`);
|
|
375
|
+
console.log();
|
|
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
|
+
}
|
|
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`));
|
|
443
|
+
});
|
|
164
444
|
// Global commands that don't require auth
|
|
165
445
|
program
|
|
166
446
|
.command('status')
|
|
@@ -179,11 +459,29 @@ program
|
|
|
179
459
|
}
|
|
180
460
|
}
|
|
181
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
|
+
});
|
|
182
480
|
program
|
|
183
481
|
.command('docs')
|
|
184
482
|
.description('Open documentation in browser')
|
|
185
483
|
.action(() => {
|
|
186
|
-
const url = 'https://
|
|
484
|
+
const url = 'https://api.lanonasis.com/docs';
|
|
187
485
|
console.log(chalk.blue(`Opening documentation: ${url}`));
|
|
188
486
|
// Try to open in browser
|
|
189
487
|
import('open').then(open => {
|
|
@@ -198,8 +496,6 @@ program
|
|
|
198
496
|
// Help customization
|
|
199
497
|
program.configureHelp({
|
|
200
498
|
formatHelp: (cmd, helper) => {
|
|
201
|
-
const term = helper.termWidth || 80;
|
|
202
|
-
const helpWidth = Math.min(term - 2, 80);
|
|
203
499
|
let help = chalk.blue.bold('🧠 Memory as a Service CLI\n\n');
|
|
204
500
|
help += helper.commandUsage(cmd) + '\n\n';
|
|
205
501
|
if (cmd.description()) {
|
|
@@ -225,7 +521,7 @@ program.configureHelp({
|
|
|
225
521
|
help += '\n';
|
|
226
522
|
}
|
|
227
523
|
help += chalk.gray('For more help on a specific command, run: memory <command> --help\n');
|
|
228
|
-
help += chalk.gray('Documentation: https://
|
|
524
|
+
help += chalk.gray('Documentation: https://api.lanonasis.com/docs\n');
|
|
229
525
|
return help;
|
|
230
526
|
}
|
|
231
527
|
});
|
package/dist/utils/api.d.ts
CHANGED
|
@@ -57,7 +57,7 @@ export interface GetMemoriesParams {
|
|
|
57
57
|
limit?: number;
|
|
58
58
|
offset?: number;
|
|
59
59
|
memory_type?: MemoryType;
|
|
60
|
-
tags?: string[];
|
|
60
|
+
tags?: string[] | string;
|
|
61
61
|
topic_id?: string;
|
|
62
62
|
sort_by?: 'created_at' | 'updated_at' | 'last_accessed' | 'access_count';
|
|
63
63
|
sort_order?: 'asc' | 'desc';
|
|
@@ -125,13 +125,19 @@ export interface HealthStatus {
|
|
|
125
125
|
}>;
|
|
126
126
|
}
|
|
127
127
|
export interface PaginatedResponse<T> {
|
|
128
|
-
data
|
|
128
|
+
data?: T[];
|
|
129
|
+
memories?: T[];
|
|
130
|
+
results?: T[];
|
|
129
131
|
pagination: {
|
|
130
132
|
total: number;
|
|
131
133
|
limit: number;
|
|
132
134
|
offset: number;
|
|
133
135
|
has_more: boolean;
|
|
136
|
+
page?: number;
|
|
137
|
+
pages?: number;
|
|
134
138
|
};
|
|
139
|
+
total_results?: number;
|
|
140
|
+
search_time_ms?: number;
|
|
135
141
|
}
|
|
136
142
|
export interface ApiErrorResponse {
|
|
137
143
|
error: string;
|
|
@@ -159,6 +165,10 @@ export declare class APIClient {
|
|
|
159
165
|
updateTopic(id: string, data: UpdateTopicRequest): Promise<MemoryTopic>;
|
|
160
166
|
deleteTopic(id: string): Promise<void>;
|
|
161
167
|
getHealth(): Promise<HealthStatus>;
|
|
168
|
+
get<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
169
|
+
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
170
|
+
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<T>;
|
|
171
|
+
delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<T>;
|
|
162
172
|
request<T = Record<string, unknown>>(config: AxiosRequestConfig): Promise<T>;
|
|
163
173
|
}
|
|
164
174
|
export declare const apiClient: APIClient;
|
package/dist/utils/api.js
CHANGED
|
@@ -132,6 +132,23 @@ export class APIClient {
|
|
|
132
132
|
const response = await this.client.get('/api/v1/health');
|
|
133
133
|
return response.data;
|
|
134
134
|
}
|
|
135
|
+
// Generic HTTP methods
|
|
136
|
+
async get(url, config) {
|
|
137
|
+
const response = await this.client.get(url, config);
|
|
138
|
+
return response.data;
|
|
139
|
+
}
|
|
140
|
+
async post(url, data, config) {
|
|
141
|
+
const response = await this.client.post(url, data, config);
|
|
142
|
+
return response.data;
|
|
143
|
+
}
|
|
144
|
+
async put(url, data, config) {
|
|
145
|
+
const response = await this.client.put(url, data, config);
|
|
146
|
+
return response.data;
|
|
147
|
+
}
|
|
148
|
+
async delete(url, config) {
|
|
149
|
+
const response = await this.client.delete(url, config);
|
|
150
|
+
return response.data;
|
|
151
|
+
}
|
|
135
152
|
// Generic request method
|
|
136
153
|
async request(config) {
|
|
137
154
|
const response = await this.client.request(config);
|
|
@@ -2,3 +2,5 @@ export declare function formatOutput(data: unknown, format?: string): void;
|
|
|
2
2
|
export declare function formatBytes(bytes: number): string;
|
|
3
3
|
export declare function truncateText(text: string, maxLength: number): string;
|
|
4
4
|
export declare function formatDuration(ms: number): string;
|
|
5
|
+
export declare function formatDate(date: string | Date): string;
|
|
6
|
+
export declare function formatTableData(data: unknown[]): string[][];
|
package/dist/utils/formatting.js
CHANGED
|
@@ -32,3 +32,16 @@ export function formatDuration(ms) {
|
|
|
32
32
|
return `${(ms / 1000).toFixed(1)}s`;
|
|
33
33
|
return `${(ms / 60000).toFixed(1)}m`;
|
|
34
34
|
}
|
|
35
|
+
export function formatDate(date) {
|
|
36
|
+
const d = new Date(date);
|
|
37
|
+
return d.toLocaleString();
|
|
38
|
+
}
|
|
39
|
+
export function formatTableData(data) {
|
|
40
|
+
return data.map(item => {
|
|
41
|
+
if (Array.isArray(item))
|
|
42
|
+
return item.map(String);
|
|
43
|
+
if (typeof item === 'object' && item !== null)
|
|
44
|
+
return Object.values(item).map(String);
|
|
45
|
+
return [String(item)];
|
|
46
|
+
});
|
|
47
|
+
}
|
package/dist/utils/mcp-client.js
CHANGED
|
@@ -70,11 +70,11 @@ export class MCPClient {
|
|
|
70
70
|
const data = JSON.parse(event.data);
|
|
71
71
|
console.log(chalk.blue('📡 Real-time update:'), data.type);
|
|
72
72
|
}
|
|
73
|
-
catch
|
|
73
|
+
catch {
|
|
74
74
|
// Ignore parse errors
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
this.sseConnection.onerror = (
|
|
77
|
+
this.sseConnection.onerror = () => {
|
|
78
78
|
console.error(chalk.yellow('⚠️ SSE connection error (will retry)'));
|
|
79
79
|
};
|
|
80
80
|
}
|
|
@@ -145,20 +145,21 @@ export class MCPClient {
|
|
|
145
145
|
},
|
|
146
146
|
'memory_get_memory': {
|
|
147
147
|
method: 'GET',
|
|
148
|
-
endpoint:
|
|
148
|
+
endpoint: '/api/v1/memory/{id}',
|
|
149
149
|
transform: () => undefined
|
|
150
150
|
},
|
|
151
151
|
'memory_update_memory': {
|
|
152
152
|
method: 'PUT',
|
|
153
|
-
endpoint:
|
|
153
|
+
endpoint: '/api/v1/memory/{id}',
|
|
154
154
|
transform: (args) => {
|
|
155
|
-
const {
|
|
155
|
+
const data = { ...args };
|
|
156
|
+
delete data.memory_id;
|
|
156
157
|
return data;
|
|
157
158
|
}
|
|
158
159
|
},
|
|
159
160
|
'memory_delete_memory': {
|
|
160
161
|
method: 'DELETE',
|
|
161
|
-
endpoint:
|
|
162
|
+
endpoint: '/api/v1/memory/{id}',
|
|
162
163
|
transform: () => undefined
|
|
163
164
|
},
|
|
164
165
|
'memory_list_memories': {
|
|
@@ -173,9 +174,14 @@ export class MCPClient {
|
|
|
173
174
|
}
|
|
174
175
|
try {
|
|
175
176
|
const axios = (await import('axios')).default;
|
|
177
|
+
// Handle dynamic endpoint for memory operations that need ID
|
|
178
|
+
let endpoint = mapping.endpoint;
|
|
179
|
+
if (endpoint.includes('{id}') && args.memory_id) {
|
|
180
|
+
endpoint = endpoint.replace('{id}', args.memory_id);
|
|
181
|
+
}
|
|
176
182
|
const response = await axios({
|
|
177
183
|
method: mapping.method,
|
|
178
|
-
url: `${apiUrl}${
|
|
184
|
+
url: `${apiUrl}${endpoint}`,
|
|
179
185
|
headers: {
|
|
180
186
|
'Authorization': `Bearer ${token}`,
|
|
181
187
|
'Content-Type': 'application/json'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lanonasis/cli",
|
|
3
|
-
"version": "1.1
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.1",
|
|
4
|
+
"description": "LanOnasis Enterprise CLI - Memory as a Service, API Key Management, and Infrastructure Orchestration",
|
|
5
5
|
"main": "dist/index-simple.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"lanonasis": "dist/index-simple.js",
|
|
@@ -25,7 +25,11 @@
|
|
|
25
25
|
"maas",
|
|
26
26
|
"enterprise",
|
|
27
27
|
"infrastructure",
|
|
28
|
-
"orchestrator"
|
|
28
|
+
"orchestrator",
|
|
29
|
+
"api-keys",
|
|
30
|
+
"secrets",
|
|
31
|
+
"mcp",
|
|
32
|
+
"security"
|
|
29
33
|
],
|
|
30
34
|
"author": "Lanonasis (Seye Derick)",
|
|
31
35
|
"license": "MIT",
|
|
@@ -38,6 +42,7 @@
|
|
|
38
42
|
"@types/eventsource": "^1.1.15",
|
|
39
43
|
"axios": "^1.11.0",
|
|
40
44
|
"chalk": "^5.4.1",
|
|
45
|
+
"cli-table3": "^0.6.5",
|
|
41
46
|
"commander": "^12.1.0",
|
|
42
47
|
"date-fns": "^4.1.0",
|
|
43
48
|
"dotenv": "^17.2.1",
|