@lanonasis/cli 1.4.2 ā 1.5.0
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 +357 -80
- package/dist/commands/auth.js +151 -1
- package/dist/commands/mcp.js +37 -30
- package/dist/commands/memory.js +78 -53
- package/dist/index-simple.js +189 -522
- package/dist/index.js +221 -327
- package/dist/utils/api.d.ts +2 -12
- package/dist/utils/api.js +0 -17
- package/dist/utils/completions.d.ts +28 -0
- package/dist/utils/completions.js +276 -0
- package/dist/utils/config.d.ts +2 -0
- package/dist/utils/config.js +15 -2
- package/dist/utils/formatting.d.ts +0 -2
- package/dist/utils/formatting.js +0 -13
- package/dist/utils/mcp-client.d.ts +6 -49
- package/dist/utils/mcp-client.js +82 -161
- package/dist/utils/mcp-client.test.d.ts +1 -0
- package/dist/utils/mcp-client.test.js +125 -0
- package/dist/utils/output.d.ts +23 -0
- package/dist/utils/output.js +97 -0
- package/dist/utils/websocket-mcp-client.d.ts +60 -0
- package/dist/utils/websocket-mcp-client.js +182 -0
- package/dist/utils/websocket-mcp-client.test.d.ts +1 -0
- package/dist/utils/websocket-mcp-client.test.js +126 -0
- package/package.json +10 -17
- package/dist/commands/api-keys.d.ts +0 -3
- package/dist/commands/api-keys.js +0 -812
- package/dist/mcp-server.d.ts +0 -2
- package/dist/mcp-server.js +0 -519
package/dist/index-simple.js
CHANGED
|
@@ -1,548 +1,215 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import { mcpCommands } from './commands/mcp.js';
|
|
12
|
-
import apiKeysCommand from './commands/api-keys.js';
|
|
13
|
-
import { CLIConfig } from './utils/config.js';
|
|
14
|
-
import { getMCPClient } from './utils/mcp-client.js';
|
|
15
|
-
// Load environment variables
|
|
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
|
-
};
|
|
3
|
+
import { readFileSync } from 'fs';
|
|
4
|
+
import { join, dirname } from 'path';
|
|
5
|
+
import { fileURLToPath } from 'url';
|
|
6
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
7
|
+
const __dirname = dirname(__filename);
|
|
8
|
+
// Read package.json
|
|
9
|
+
const packagePath = join(__dirname, '..', 'package.json');
|
|
10
|
+
const packageJson = JSON.parse(readFileSync(packagePath, 'utf8'));
|
|
28
11
|
const program = new Command();
|
|
29
|
-
// CLI Configuration
|
|
30
|
-
const cliConfig = new CLIConfig();
|
|
31
12
|
program
|
|
32
13
|
.name('lanonasis')
|
|
33
|
-
.
|
|
34
|
-
.
|
|
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')
|
|
39
|
-
.option('--output <format>', 'output format (json, table, yaml)', 'table')
|
|
40
|
-
.option('--no-mcp', 'disable MCP and use direct API')
|
|
41
|
-
.hook('preAction', async (thisCommand, actionCommand) => {
|
|
42
|
-
const opts = thisCommand.opts();
|
|
43
|
-
if (opts.verbose) {
|
|
44
|
-
process.env.CLI_VERBOSE = 'true';
|
|
45
|
-
}
|
|
46
|
-
if (opts.apiUrl) {
|
|
47
|
-
process.env.MEMORY_API_URL = opts.apiUrl;
|
|
48
|
-
}
|
|
49
|
-
process.env.CLI_OUTPUT_FORMAT = opts.output;
|
|
50
|
-
// Auto-initialize MCP unless disabled
|
|
51
|
-
if (opts.mcp !== false && !['init', 'auth', 'login', 'mcp', 'health', 'status'].includes(actionCommand.name())) {
|
|
52
|
-
try {
|
|
53
|
-
const client = getMCPClient();
|
|
54
|
-
if (!client.isConnectedToServer()) {
|
|
55
|
-
const useRemote = await cliConfig.isAuthenticated();
|
|
56
|
-
await client.connect({ useRemote });
|
|
57
|
-
if (process.env.CLI_VERBOSE === 'true') {
|
|
58
|
-
console.log(colors.muted(`MCP connected (${useRemote ? 'remote' : 'local'})`));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
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)}`));
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
// Enhanced global error handler
|
|
71
|
-
process.on('uncaughtException', (error) => {
|
|
72
|
-
console.error(colors.error('ā Unexpected error:'), error.message);
|
|
73
|
-
if (process.env.CLI_VERBOSE === 'true') {
|
|
74
|
-
console.error(colors.muted(error.stack || ''));
|
|
75
|
-
}
|
|
76
|
-
process.exit(1);
|
|
77
|
-
});
|
|
78
|
-
process.on('unhandledRejection', (reason, promise) => {
|
|
79
|
-
console.error(colors.error('ā Unhandled promise rejection:'), reason);
|
|
80
|
-
if (process.env.CLI_VERBOSE === 'true') {
|
|
81
|
-
console.error(colors.muted(String(promise)));
|
|
82
|
-
}
|
|
83
|
-
process.exit(1);
|
|
84
|
-
});
|
|
85
|
-
// Enhanced welcome message
|
|
86
|
-
const showWelcome = () => {
|
|
87
|
-
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'));
|
|
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'));
|
|
162
|
-
}
|
|
163
|
-
console.log();
|
|
164
|
-
console.log(colors.info('š” For detailed diagnostics, run: lanonasis status --verbose'));
|
|
165
|
-
};
|
|
166
|
-
// Check if user is authenticated for protected commands
|
|
167
|
-
const requireAuth = (command) => {
|
|
168
|
-
command.hook('preAction', async () => {
|
|
169
|
-
const isAuthenticated = await cliConfig.isAuthenticated();
|
|
170
|
-
if (!isAuthenticated) {
|
|
171
|
-
console.error(chalk.red('ā Authentication required'));
|
|
172
|
-
console.log(chalk.yellow('Please run:'), chalk.white('memory login'));
|
|
173
|
-
process.exit(1);
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
};
|
|
177
|
-
// Initialize command (no auth required)
|
|
14
|
+
.description('Lanonasis Enterprise CLI - Memory as a Service with MCP Integration')
|
|
15
|
+
.version(packageJson.version);
|
|
178
16
|
program
|
|
179
17
|
.command('init')
|
|
180
|
-
.description('Initialize CLI configuration')
|
|
181
|
-
.option('-f, --force', 'overwrite existing configuration')
|
|
182
|
-
.action(initCommand);
|
|
183
|
-
// Authentication commands (no auth required)
|
|
184
|
-
const authCmd = program
|
|
185
|
-
.command('auth')
|
|
186
|
-
.alias('login')
|
|
187
|
-
.description('Authentication commands');
|
|
188
|
-
authCmd
|
|
189
|
-
.command('login')
|
|
190
|
-
.description('Login to your MaaS account')
|
|
191
|
-
.option('-e, --email <email>', 'email address')
|
|
192
|
-
.option('-p, --password <password>', 'password')
|
|
193
|
-
.action(loginCommand);
|
|
194
|
-
authCmd
|
|
195
|
-
.command('logout')
|
|
196
|
-
.description('Logout from your account')
|
|
197
|
-
.action(async () => {
|
|
198
|
-
await cliConfig.logout();
|
|
199
|
-
console.log(chalk.green('ā Logged out successfully'));
|
|
200
|
-
});
|
|
201
|
-
authCmd
|
|
202
|
-
.command('status')
|
|
203
|
-
.description('Show authentication status')
|
|
204
|
-
.action(async () => {
|
|
205
|
-
const isAuth = await cliConfig.isAuthenticated();
|
|
206
|
-
const user = await cliConfig.getCurrentUser();
|
|
207
|
-
if (isAuth && user) {
|
|
208
|
-
console.log(chalk.green('ā Authenticated'));
|
|
209
|
-
console.log(`Email: ${user.email}`);
|
|
210
|
-
console.log(`Organization: ${user.organization_id}`);
|
|
211
|
-
console.log(`Plan: ${user.plan}`);
|
|
212
|
-
}
|
|
213
|
-
else {
|
|
214
|
-
console.log(chalk.red('ā Not authenticated'));
|
|
215
|
-
console.log(chalk.yellow('Run:'), chalk.white('memory login'));
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
// MCP Commands (primary interface)
|
|
219
|
-
mcpCommands(program);
|
|
220
|
-
// Memory commands (require auth) - now MCP-powered by default
|
|
221
|
-
const memoryCmd = program
|
|
222
|
-
.command('memory')
|
|
223
|
-
.alias('mem')
|
|
224
|
-
.description('Memory management commands');
|
|
225
|
-
requireAuth(memoryCmd);
|
|
226
|
-
memoryCommands(memoryCmd);
|
|
227
|
-
// Note: Memory commands are now MCP-powered when available
|
|
228
|
-
// Topic commands (require auth)
|
|
229
|
-
const topicCmd = program
|
|
230
|
-
.command('topic')
|
|
231
|
-
.alias('topics')
|
|
232
|
-
.description('Topic management commands');
|
|
233
|
-
requireAuth(topicCmd);
|
|
234
|
-
topicCommands(topicCmd);
|
|
235
|
-
// Configuration commands (require auth)
|
|
236
|
-
const configCmd = program
|
|
237
|
-
.command('config')
|
|
238
|
-
.description('Configuration management');
|
|
239
|
-
requireAuth(configCmd);
|
|
240
|
-
configCommands(configCmd);
|
|
241
|
-
// Organization commands (require auth)
|
|
242
|
-
const orgCmd = program
|
|
243
|
-
.command('org')
|
|
244
|
-
.alias('organization')
|
|
245
|
-
.description('Organization management');
|
|
246
|
-
requireAuth(orgCmd);
|
|
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')
|
|
18
|
+
.description('Initialize Lanonasis CLI configuration')
|
|
318
19
|
.action(() => {
|
|
319
|
-
console.log(
|
|
320
|
-
console.log(
|
|
321
|
-
console.log(
|
|
322
|
-
console.log(
|
|
323
|
-
console.log(
|
|
20
|
+
console.log('š Lanonasis CLI v' + packageJson.version);
|
|
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');
|
|
324
37
|
});
|
|
325
|
-
|
|
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
|
|
38
|
+
program
|
|
332
39
|
.command('status')
|
|
333
|
-
.description('
|
|
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')
|
|
40
|
+
.description('Show Lanonasis CLI status and configuration')
|
|
346
41
|
.action(() => {
|
|
347
|
-
console.log(
|
|
348
|
-
console.log(
|
|
349
|
-
console.log(
|
|
350
|
-
console.log(
|
|
351
|
-
console.log(
|
|
352
|
-
console.log(
|
|
353
|
-
console.log(
|
|
354
|
-
console.log(
|
|
355
|
-
console.log(
|
|
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')}`);
|
|
42
|
+
console.log('š Lanonasis CLI Status');
|
|
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');
|
|
391
51
|
});
|
|
392
|
-
|
|
393
|
-
.command('
|
|
394
|
-
.description('
|
|
395
|
-
.
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
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
|
-
}
|
|
52
|
+
program
|
|
53
|
+
.command('create')
|
|
54
|
+
.description('Create a new memory entry')
|
|
55
|
+
.option('-t, --title <title>', 'Memory title')
|
|
56
|
+
.option('-c, --content <content>', 'Memory content')
|
|
57
|
+
.option('--type <type>', 'Memory type (conversation, knowledge, project, context, reference)', 'context')
|
|
58
|
+
.action((options) => {
|
|
59
|
+
if (!options.title || !options.content) {
|
|
60
|
+
console.error('ā Error: Both --title and --content are required');
|
|
61
|
+
console.log('');
|
|
62
|
+
console.log('Usage: lanonasis create -t "Title" -c "Content"');
|
|
63
|
+
process.exit(1);
|
|
414
64
|
}
|
|
415
|
-
console.log();
|
|
416
|
-
console.log(
|
|
65
|
+
console.log('š Creating memory...');
|
|
66
|
+
console.log('Title:', options.title);
|
|
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');
|
|
417
73
|
});
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
.
|
|
421
|
-
.
|
|
422
|
-
.
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
.
|
|
426
|
-
.
|
|
427
|
-
.
|
|
428
|
-
console.log(
|
|
429
|
-
console.log(
|
|
430
|
-
console.log(
|
|
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`);
|
|
74
|
+
program
|
|
75
|
+
.command('search')
|
|
76
|
+
.description('Search memories')
|
|
77
|
+
.argument('<query>', 'Search query')
|
|
78
|
+
.option('-l, --limit <limit>', 'Number of results', '10')
|
|
79
|
+
.action((query, options) => {
|
|
80
|
+
console.log('š Searching memories...');
|
|
81
|
+
console.log('Query:', query);
|
|
82
|
+
console.log('Limit:', options.limit);
|
|
83
|
+
console.log('');
|
|
84
|
+
console.log('ā ļø Please configure your Lanonasis service endpoint first:');
|
|
85
|
+
console.log(' lanonasis config set api-url https://your-service.com');
|
|
86
|
+
console.log(' lanonasis auth login');
|
|
436
87
|
});
|
|
437
|
-
|
|
438
|
-
.command('
|
|
439
|
-
.description('
|
|
440
|
-
.
|
|
441
|
-
|
|
442
|
-
|
|
88
|
+
program
|
|
89
|
+
.command('list')
|
|
90
|
+
.description('List all memories')
|
|
91
|
+
.option('-l, --limit <limit>', 'Number of results', '20')
|
|
92
|
+
.option('--type <type>', 'Filter by memory type')
|
|
93
|
+
.action((options) => {
|
|
94
|
+
console.log('š Listing memories...');
|
|
95
|
+
console.log('Limit:', options.limit);
|
|
96
|
+
if (options.type)
|
|
97
|
+
console.log('Type filter:', options.type);
|
|
98
|
+
console.log('');
|
|
99
|
+
console.log('ā ļø Please configure your Lanonasis service endpoint first:');
|
|
100
|
+
console.log(' lanonasis config set api-url https://your-service.com');
|
|
101
|
+
console.log(' lanonasis auth login');
|
|
443
102
|
});
|
|
444
|
-
// Global commands that don't require auth
|
|
445
103
|
program
|
|
446
|
-
.command('
|
|
447
|
-
.description('
|
|
448
|
-
.action
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
console.log(
|
|
453
|
-
console.log(
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
104
|
+
.command('config')
|
|
105
|
+
.description('Manage CLI configuration')
|
|
106
|
+
.argument('<action>', 'Action: set, get, list')
|
|
107
|
+
.argument('[key]', 'Configuration key')
|
|
108
|
+
.argument('[value]', 'Configuration value')
|
|
109
|
+
.action((action, key, value) => {
|
|
110
|
+
console.log('āļø Memory CLI Configuration');
|
|
111
|
+
console.log('===========================');
|
|
112
|
+
switch (action) {
|
|
113
|
+
case 'set':
|
|
114
|
+
if (!key || !value) {
|
|
115
|
+
console.error('ā Usage: memory config set <key> <value>');
|
|
116
|
+
process.exit(1);
|
|
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);
|
|
460
137
|
}
|
|
461
138
|
});
|
|
462
|
-
// Health command using the healthCheck function
|
|
463
139
|
program
|
|
464
|
-
.command('
|
|
465
|
-
.
|
|
466
|
-
.
|
|
467
|
-
.
|
|
468
|
-
.
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
console.log(
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
140
|
+
.command('auth')
|
|
141
|
+
.description('Authentication commands')
|
|
142
|
+
.argument('<action>', 'Action: login, logout, status')
|
|
143
|
+
.action((action) => {
|
|
144
|
+
console.log('š Memory CLI Authentication');
|
|
145
|
+
console.log('============================');
|
|
146
|
+
switch (action) {
|
|
147
|
+
case 'login':
|
|
148
|
+
console.log('Please configure your API endpoint first:');
|
|
149
|
+
console.log(' memory config set api-url https://your-maas-service.com');
|
|
150
|
+
console.log('');
|
|
151
|
+
console.log('Then authenticate with your service credentials.');
|
|
152
|
+
break;
|
|
153
|
+
case 'logout':
|
|
154
|
+
console.log('ā
Logged out successfully');
|
|
155
|
+
break;
|
|
156
|
+
case 'status':
|
|
157
|
+
console.log('Status: š“ Not authenticated');
|
|
158
|
+
console.log('Run "memory auth login" to authenticate');
|
|
159
|
+
break;
|
|
160
|
+
default:
|
|
161
|
+
console.error('ā Unknown action. Use: login, logout, or status');
|
|
162
|
+
process.exit(1);
|
|
478
163
|
}
|
|
479
164
|
});
|
|
165
|
+
// Help command
|
|
480
166
|
program
|
|
481
|
-
.command('
|
|
482
|
-
.description('
|
|
167
|
+
.command('help')
|
|
168
|
+
.description('Show detailed help information')
|
|
483
169
|
.action(() => {
|
|
484
|
-
|
|
485
|
-
console.log(
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
help += chalk.gray('Documentation: https://api.lanonasis.com/docs\n');
|
|
525
|
-
return help;
|
|
526
|
-
}
|
|
170
|
+
console.log('š Lanonasis Enterprise CLI');
|
|
171
|
+
console.log('============================');
|
|
172
|
+
console.log('');
|
|
173
|
+
console.log('The Lanonasis CLI provides unified access to your entire platform ecosystem.');
|
|
174
|
+
console.log('');
|
|
175
|
+
console.log('š Quick Start:');
|
|
176
|
+
console.log('1. lanonasis init - Initialize and see setup instructions');
|
|
177
|
+
console.log('2. lanonasis config set api-url <url> - Set your service endpoint');
|
|
178
|
+
console.log('3. lanonasis auth login - Authenticate with your platform');
|
|
179
|
+
console.log('4. lanonasis create -t "Title" -c "Content" - Create your first memory');
|
|
180
|
+
console.log('');
|
|
181
|
+
console.log('š Memory Operations:');
|
|
182
|
+
console.log('⢠lanonasis create -t "Title" -c "Content" --type knowledge');
|
|
183
|
+
console.log('⢠lanonasis search "query text"');
|
|
184
|
+
console.log('⢠lanonasis list --type project --limit 10');
|
|
185
|
+
console.log('');
|
|
186
|
+
console.log('āļø Configuration:');
|
|
187
|
+
console.log('⢠lanonasis config set api-url https://your-service.com');
|
|
188
|
+
console.log('⢠lanonasis config list');
|
|
189
|
+
console.log('');
|
|
190
|
+
console.log('š Authentication:');
|
|
191
|
+
console.log('⢠lanonasis auth login');
|
|
192
|
+
console.log('⢠lanonasis auth status');
|
|
193
|
+
console.log('');
|
|
194
|
+
console.log('š” Alternative Commands:');
|
|
195
|
+
console.log('⢠memory <command> - Direct memory operations');
|
|
196
|
+
console.log('⢠maas <command> - Memory as a Service operations');
|
|
197
|
+
console.log('');
|
|
198
|
+
console.log('Memory Types: conversation, knowledge, project, context, reference');
|
|
199
|
+
console.log('');
|
|
200
|
+
console.log('š Documentation: https://github.com/lanonasis/cli');
|
|
201
|
+
console.log('š Platform: https://lanonasis.com');
|
|
202
|
+
console.log('š Issues: https://github.com/lanonasis/cli/issues');
|
|
203
|
+
});
|
|
204
|
+
// Handle unknown commands
|
|
205
|
+
program.on('command:*', () => {
|
|
206
|
+
console.error('ā Unknown command: %s', program.args.join(' '));
|
|
207
|
+
console.log('');
|
|
208
|
+
console.log('Run "lanonasis help" for available commands');
|
|
209
|
+
process.exit(1);
|
|
527
210
|
});
|
|
528
|
-
//
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
if (process.argv.length <= 2) {
|
|
532
|
-
showWelcome();
|
|
533
|
-
return;
|
|
534
|
-
}
|
|
535
|
-
try {
|
|
536
|
-
await program.parseAsync(process.argv);
|
|
537
|
-
}
|
|
538
|
-
catch (error) {
|
|
539
|
-
if (error instanceof Error) {
|
|
540
|
-
console.error(chalk.red('ā Error:'), error.message);
|
|
541
|
-
if (process.env.CLI_VERBOSE === 'true') {
|
|
542
|
-
console.error(error.stack);
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
process.exit(1);
|
|
546
|
-
}
|
|
211
|
+
// Show help if no arguments provided
|
|
212
|
+
if (process.argv.length === 2) {
|
|
213
|
+
program.outputHelp();
|
|
547
214
|
}
|
|
548
|
-
|
|
215
|
+
program.parse();
|