@lanonasis/cli 1.5.0 â 1.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +284 -586
- package/dist/commands/api-keys.d.ts +3 -0
- package/dist/commands/api-keys.js +812 -0
- package/dist/commands/auth.d.ts +2 -0
- package/dist/commands/auth.js +127 -138
- package/dist/commands/completion.d.ts +33 -0
- package/dist/commands/completion.js +378 -0
- package/dist/commands/guide.d.ts +19 -0
- package/dist/commands/guide.js +446 -0
- package/dist/commands/mcp.js +30 -37
- package/dist/commands/memory.js +53 -78
- package/dist/completions/bash-completion.sh +88 -0
- package/dist/completions/fish-completion.fish +132 -0
- package/dist/completions/zsh-completion.zsh +196 -0
- package/dist/index-simple.js +633 -183
- package/dist/index.js +327 -221
- package/dist/mcp-server.d.ts +38 -0
- package/dist/mcp-server.js +154 -0
- package/dist/utils/api.d.ts +12 -2
- package/dist/utils/api.js +38 -4
- package/dist/utils/config.d.ts +5 -2
- package/dist/utils/config.js +39 -15
- package/dist/utils/formatting.d.ts +2 -0
- package/dist/utils/formatting.js +13 -0
- package/dist/utils/mcp-client.d.ts +49 -6
- package/dist/utils/mcp-client.js +159 -82
- package/package.json +22 -12
- package/dist/utils/completions.d.ts +0 -28
- package/dist/utils/completions.js +0 -276
- package/dist/utils/mcp-client.test.d.ts +0 -1
- package/dist/utils/mcp-client.test.js +0 -125
- package/dist/utils/output.d.ts +0 -23
- package/dist/utils/output.js +0 -97
- package/dist/utils/websocket-mcp-client.d.ts +0 -60
- package/dist/utils/websocket-mcp-client.js +0 -182
- package/dist/utils/websocket-mcp-client.test.d.ts +0 -1
- package/dist/utils/websocket-mcp-client.test.js +0 -126
|
@@ -0,0 +1,446 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import inquirer from 'inquirer';
|
|
3
|
+
import { CLIConfig } from '../utils/config.js';
|
|
4
|
+
import { apiClient } from '../utils/api.js';
|
|
5
|
+
// Color scheme
|
|
6
|
+
const colors = {
|
|
7
|
+
primary: chalk.blue.bold,
|
|
8
|
+
success: chalk.green,
|
|
9
|
+
warning: chalk.yellow,
|
|
10
|
+
error: chalk.red,
|
|
11
|
+
info: chalk.cyan,
|
|
12
|
+
accent: chalk.magenta,
|
|
13
|
+
muted: chalk.gray,
|
|
14
|
+
highlight: chalk.white.bold
|
|
15
|
+
};
|
|
16
|
+
export class UserGuidanceSystem {
|
|
17
|
+
config;
|
|
18
|
+
steps = [];
|
|
19
|
+
constructor() {
|
|
20
|
+
this.config = new CLIConfig();
|
|
21
|
+
this.initializeSteps();
|
|
22
|
+
}
|
|
23
|
+
initializeSteps() {
|
|
24
|
+
this.steps = [
|
|
25
|
+
{
|
|
26
|
+
id: 'initialization',
|
|
27
|
+
title: 'Initialize Configuration',
|
|
28
|
+
description: 'Set up your CLI configuration and preferences',
|
|
29
|
+
action: this.initializeConfig.bind(this)
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 'authentication',
|
|
33
|
+
title: 'Authentication Setup',
|
|
34
|
+
description: 'Connect to your Onasis-Core account using preferred method',
|
|
35
|
+
action: this.setupAuthentication.bind(this)
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: 'verification',
|
|
39
|
+
title: 'Connection Verification',
|
|
40
|
+
description: 'Verify your connection to Onasis-Core services',
|
|
41
|
+
action: this.verifyConnection.bind(this)
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: 'first_memory',
|
|
45
|
+
title: 'Create Your First Memory',
|
|
46
|
+
description: 'Learn how to store and retrieve information',
|
|
47
|
+
action: this.createFirstMemory.bind(this),
|
|
48
|
+
optional: true
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: 'explore_features',
|
|
52
|
+
title: 'Explore Advanced Features',
|
|
53
|
+
description: 'Discover topics, MCP integration, and advanced workflows',
|
|
54
|
+
action: this.exploreFeatures.bind(this),
|
|
55
|
+
optional: true
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
id: 'productivity_tips',
|
|
59
|
+
title: 'Productivity Setup',
|
|
60
|
+
description: 'Set up shell completions and aliases for efficient usage',
|
|
61
|
+
action: this.setupProductivity.bind(this),
|
|
62
|
+
optional: true
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
async runGuidedSetup() {
|
|
67
|
+
console.log(chalk.blue.bold('đ Welcome to Onasis-Core CLI Setup Guide'));
|
|
68
|
+
console.log(colors.info('â'.repeat(50)));
|
|
69
|
+
console.log();
|
|
70
|
+
console.log(colors.highlight('This guided setup will help you get started with enterprise-grade'));
|
|
71
|
+
console.log(colors.highlight('Memory as a Service and API management capabilities.'));
|
|
72
|
+
console.log();
|
|
73
|
+
// Check current status
|
|
74
|
+
await this.assessCurrentStatus();
|
|
75
|
+
const { proceedWithGuide } = await inquirer.prompt([
|
|
76
|
+
{
|
|
77
|
+
type: 'confirm',
|
|
78
|
+
name: 'proceedWithGuide',
|
|
79
|
+
message: 'Would you like to proceed with the guided setup?',
|
|
80
|
+
default: true
|
|
81
|
+
}
|
|
82
|
+
]);
|
|
83
|
+
if (!proceedWithGuide) {
|
|
84
|
+
console.log(chalk.yellow('Setup cancelled. You can run this guide anytime with:'));
|
|
85
|
+
console.log(chalk.cyan(' lanonasis guide'));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
// Run through steps
|
|
89
|
+
for (const step of this.steps) {
|
|
90
|
+
if (step.completed) {
|
|
91
|
+
console.log(chalk.green(`â
${step.title} (already completed)`));
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
await this.executeStep(step);
|
|
95
|
+
}
|
|
96
|
+
await this.showCompletionSummary();
|
|
97
|
+
}
|
|
98
|
+
async assessCurrentStatus() {
|
|
99
|
+
console.log(chalk.yellow('đ Checking current setup status...'));
|
|
100
|
+
console.log();
|
|
101
|
+
// Check configuration
|
|
102
|
+
const configExists = await this.config.exists();
|
|
103
|
+
if (configExists) {
|
|
104
|
+
this.markStepCompleted('initialization');
|
|
105
|
+
console.log(chalk.green('â
Configuration found'));
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
console.log(chalk.gray('âŗ Configuration needs setup'));
|
|
109
|
+
}
|
|
110
|
+
// Check authentication
|
|
111
|
+
const isAuthenticated = await this.config.isAuthenticated();
|
|
112
|
+
const hasVendorKey = this.config.hasVendorKey();
|
|
113
|
+
if (isAuthenticated || hasVendorKey) {
|
|
114
|
+
this.markStepCompleted('authentication');
|
|
115
|
+
console.log(chalk.green(`â
Authentication configured (${hasVendorKey ? 'vendor key' : 'JWT token'})`));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
console.log(chalk.gray('âŗ Authentication needs setup'));
|
|
119
|
+
}
|
|
120
|
+
// Check connection
|
|
121
|
+
try {
|
|
122
|
+
await apiClient.get('/health');
|
|
123
|
+
this.markStepCompleted('verification');
|
|
124
|
+
console.log(chalk.green('â
Service connection verified'));
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
console.log(chalk.gray('âŗ Service connection needs verification'));
|
|
128
|
+
}
|
|
129
|
+
console.log();
|
|
130
|
+
}
|
|
131
|
+
markStepCompleted(stepId) {
|
|
132
|
+
const step = this.steps.find(s => s.id === stepId);
|
|
133
|
+
if (step) {
|
|
134
|
+
step.completed = true;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async executeStep(step) {
|
|
138
|
+
console.log(chalk.blue.bold(`đ§ ${step.title}`));
|
|
139
|
+
console.log(colors.info('â'.repeat(30)));
|
|
140
|
+
console.log(chalk.white(step.description));
|
|
141
|
+
console.log();
|
|
142
|
+
if (step.optional) {
|
|
143
|
+
const { proceed } = await inquirer.prompt([
|
|
144
|
+
{
|
|
145
|
+
type: 'confirm',
|
|
146
|
+
name: 'proceed',
|
|
147
|
+
message: `Execute this optional step: ${step.title}?`,
|
|
148
|
+
default: true
|
|
149
|
+
}
|
|
150
|
+
]);
|
|
151
|
+
if (!proceed) {
|
|
152
|
+
console.log(chalk.yellow('âī¸ Skipped'));
|
|
153
|
+
console.log();
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
if (step.action) {
|
|
158
|
+
try {
|
|
159
|
+
await step.action();
|
|
160
|
+
step.completed = true;
|
|
161
|
+
console.log(chalk.green(`â
${step.title} completed successfully`));
|
|
162
|
+
}
|
|
163
|
+
catch (error) {
|
|
164
|
+
console.log(chalk.red(`â ${step.title} failed`));
|
|
165
|
+
console.log(chalk.gray(error instanceof Error ? error.message : String(error)));
|
|
166
|
+
const { retry } = await inquirer.prompt([
|
|
167
|
+
{
|
|
168
|
+
type: 'confirm',
|
|
169
|
+
name: 'retry',
|
|
170
|
+
message: 'Would you like to retry this step?',
|
|
171
|
+
default: true
|
|
172
|
+
}
|
|
173
|
+
]);
|
|
174
|
+
if (retry) {
|
|
175
|
+
await this.executeStep(step); // Recursive retry
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
console.log();
|
|
180
|
+
}
|
|
181
|
+
async initializeConfig() {
|
|
182
|
+
console.log(colors.info('Initializing CLI configuration...'));
|
|
183
|
+
const { apiUrl, outputFormat } = await inquirer.prompt([
|
|
184
|
+
{
|
|
185
|
+
type: 'input',
|
|
186
|
+
name: 'apiUrl',
|
|
187
|
+
message: 'API URL (press Enter for default):',
|
|
188
|
+
default: 'https://api.lanonasis.com/api/v1'
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
type: 'list',
|
|
192
|
+
name: 'outputFormat',
|
|
193
|
+
message: 'Preferred output format:',
|
|
194
|
+
choices: ['table', 'json', 'yaml', 'csv'],
|
|
195
|
+
default: 'table'
|
|
196
|
+
}
|
|
197
|
+
]);
|
|
198
|
+
await this.config.init();
|
|
199
|
+
await this.config.setApiUrl(apiUrl);
|
|
200
|
+
await this.config.setAndSave('defaultOutputFormat', outputFormat);
|
|
201
|
+
console.log(colors.success('Configuration initialized successfully'));
|
|
202
|
+
}
|
|
203
|
+
async setupAuthentication() {
|
|
204
|
+
console.log(colors.info('Setting up authentication...'));
|
|
205
|
+
console.log(chalk.gray('Choose the authentication method that best fits your use case:'));
|
|
206
|
+
console.log();
|
|
207
|
+
const { authMethod } = await inquirer.prompt([
|
|
208
|
+
{
|
|
209
|
+
type: 'list',
|
|
210
|
+
name: 'authMethod',
|
|
211
|
+
message: 'Choose authentication method:',
|
|
212
|
+
choices: [
|
|
213
|
+
{
|
|
214
|
+
name: 'đ Vendor Key (Recommended for API integration)',
|
|
215
|
+
value: 'vendor_key',
|
|
216
|
+
short: 'Vendor Key'
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
name: 'đ OAuth (Browser-based authentication)',
|
|
220
|
+
value: 'oauth',
|
|
221
|
+
short: 'OAuth'
|
|
222
|
+
},
|
|
223
|
+
{
|
|
224
|
+
name: 'đ§ Username/Password (Direct credentials)',
|
|
225
|
+
value: 'credentials',
|
|
226
|
+
short: 'Credentials'
|
|
227
|
+
}
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
]);
|
|
231
|
+
// Import and call the login command with the chosen method
|
|
232
|
+
const { loginCommand } = await import('./auth.js');
|
|
233
|
+
switch (authMethod) {
|
|
234
|
+
case 'vendor_key':
|
|
235
|
+
console.log(chalk.yellow('đ Vendor keys provide secure, programmatic access'));
|
|
236
|
+
console.log(chalk.gray('Format: pk_xxxxx.sk_xxxxx'));
|
|
237
|
+
console.log();
|
|
238
|
+
break;
|
|
239
|
+
case 'oauth':
|
|
240
|
+
console.log(chalk.yellow('đ OAuth provides secure browser-based authentication'));
|
|
241
|
+
console.log(chalk.gray('Your browser will open for authentication'));
|
|
242
|
+
console.log();
|
|
243
|
+
break;
|
|
244
|
+
case 'credentials':
|
|
245
|
+
console.log(chalk.yellow('đ§ Direct authentication with your account'));
|
|
246
|
+
console.log();
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
// This will be handled by the enhanced auth command
|
|
250
|
+
await loginCommand({});
|
|
251
|
+
}
|
|
252
|
+
async verifyConnection() {
|
|
253
|
+
console.log(colors.info('Verifying connection to Onasis-Core services...'));
|
|
254
|
+
try {
|
|
255
|
+
const health = await apiClient.get('/health');
|
|
256
|
+
console.log(colors.success('â
Connection verified successfully'));
|
|
257
|
+
console.log(chalk.gray(`Server status: ${health.status}`));
|
|
258
|
+
console.log(chalk.gray(`Server version: ${health.version}`));
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
throw new Error(`Connection verification failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
async createFirstMemory() {
|
|
265
|
+
console.log(colors.info('Creating your first memory entry...'));
|
|
266
|
+
console.log(chalk.gray('Memories are the core of the MaaS platform - they store and organize information'));
|
|
267
|
+
console.log();
|
|
268
|
+
const { createSample } = await inquirer.prompt([
|
|
269
|
+
{
|
|
270
|
+
type: 'confirm',
|
|
271
|
+
name: 'createSample',
|
|
272
|
+
message: 'Create a sample memory to get started?',
|
|
273
|
+
default: true
|
|
274
|
+
}
|
|
275
|
+
]);
|
|
276
|
+
if (createSample) {
|
|
277
|
+
try {
|
|
278
|
+
const memory = await apiClient.createMemory({
|
|
279
|
+
title: 'Welcome to Onasis-Core',
|
|
280
|
+
content: 'This is your first memory in the Onasis-Core MaaS platform. You can store, search, and organize information efficiently using memories.',
|
|
281
|
+
memory_type: 'reference',
|
|
282
|
+
tags: ['welcome', 'getting-started', 'onasis-core']
|
|
283
|
+
});
|
|
284
|
+
console.log(colors.success('â
Sample memory created successfully'));
|
|
285
|
+
console.log(chalk.gray(`Memory ID: ${memory.id}`));
|
|
286
|
+
console.log();
|
|
287
|
+
console.log(colors.info('đĄ Try these commands to explore:'));
|
|
288
|
+
console.log(chalk.cyan(' lanonasis memory list'));
|
|
289
|
+
console.log(chalk.cyan(' lanonasis memory search "welcome"'));
|
|
290
|
+
}
|
|
291
|
+
catch (error) {
|
|
292
|
+
throw new Error(`Failed to create sample memory: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
console.log(colors.info('đĄ You can create memories anytime with:'));
|
|
297
|
+
console.log(chalk.cyan(' lanonasis memory create --title "My Title" --content "Content"'));
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
async exploreFeatures() {
|
|
301
|
+
console.log(colors.info('đ¯ Advanced Features Overview'));
|
|
302
|
+
console.log();
|
|
303
|
+
const features = [
|
|
304
|
+
{
|
|
305
|
+
name: 'Topics',
|
|
306
|
+
description: 'Organize memories into categories',
|
|
307
|
+
command: 'lanonasis topic create --name "My Project"'
|
|
308
|
+
},
|
|
309
|
+
{
|
|
310
|
+
name: 'MCP Integration',
|
|
311
|
+
description: 'Model Context Protocol for AI interactions',
|
|
312
|
+
command: 'lanonasis mcp status'
|
|
313
|
+
},
|
|
314
|
+
{
|
|
315
|
+
name: 'API Key Management',
|
|
316
|
+
description: 'Create and manage API keys for integrations',
|
|
317
|
+
command: 'lanonasis api-keys list'
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
name: 'Memory Search',
|
|
321
|
+
description: 'Semantic search across all memories',
|
|
322
|
+
command: 'lanonasis memory search "your query"'
|
|
323
|
+
}
|
|
324
|
+
];
|
|
325
|
+
console.log(chalk.yellow('đ Available Features:'));
|
|
326
|
+
features.forEach((feature, index) => {
|
|
327
|
+
console.log(`${index + 1}. ${colors.accent(feature.name)}: ${feature.description}`);
|
|
328
|
+
console.log(` ${chalk.cyan(feature.command)}`);
|
|
329
|
+
console.log();
|
|
330
|
+
});
|
|
331
|
+
console.log(colors.info('đĄ Run any command with --help to learn more'));
|
|
332
|
+
}
|
|
333
|
+
async setupProductivity() {
|
|
334
|
+
console.log(colors.info('đ Productivity Setup'));
|
|
335
|
+
console.log();
|
|
336
|
+
const { shell } = await inquirer.prompt([
|
|
337
|
+
{
|
|
338
|
+
type: 'list',
|
|
339
|
+
name: 'shell',
|
|
340
|
+
message: 'Which shell do you use?',
|
|
341
|
+
choices: [
|
|
342
|
+
{ name: 'Bash', value: 'bash' },
|
|
343
|
+
{ name: 'Zsh', value: 'zsh' },
|
|
344
|
+
{ name: 'Fish', value: 'fish' },
|
|
345
|
+
{ name: 'Other / Skip', value: 'skip' }
|
|
346
|
+
]
|
|
347
|
+
}
|
|
348
|
+
]);
|
|
349
|
+
if (shell !== 'skip') {
|
|
350
|
+
console.log(chalk.yellow(`đ Shell Completion Setup (${shell}):`));
|
|
351
|
+
console.log();
|
|
352
|
+
switch (shell) {
|
|
353
|
+
case 'bash':
|
|
354
|
+
console.log(colors.info('Add to your ~/.bashrc:'));
|
|
355
|
+
console.log(chalk.cyan(' source <(lanonasis --completion bash)'));
|
|
356
|
+
break;
|
|
357
|
+
case 'zsh':
|
|
358
|
+
console.log(colors.info('Add to your ~/.zshrc:'));
|
|
359
|
+
console.log(chalk.cyan(' source <(lanonasis --completion zsh)'));
|
|
360
|
+
break;
|
|
361
|
+
case 'fish':
|
|
362
|
+
console.log(colors.info('Add to your ~/.config/fish/config.fish:'));
|
|
363
|
+
console.log(chalk.cyan(' lanonasis --completion fish | source'));
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
console.log();
|
|
367
|
+
console.log(colors.success('â
Completions will provide tab completion for all commands'));
|
|
368
|
+
}
|
|
369
|
+
console.log();
|
|
370
|
+
console.log(chalk.yellow('đ Useful Aliases:'));
|
|
371
|
+
console.log(colors.info('You can also use these command aliases:'));
|
|
372
|
+
console.log(chalk.cyan(' onasis # Same as lanonasis (Golden Contract compliant)'));
|
|
373
|
+
console.log(chalk.cyan(' memory # Direct memory management'));
|
|
374
|
+
console.log(chalk.cyan(' maas # MaaS-focused interface'));
|
|
375
|
+
}
|
|
376
|
+
async showCompletionSummary() {
|
|
377
|
+
console.log(chalk.blue.bold('đ Setup Complete!'));
|
|
378
|
+
console.log(colors.info('â'.repeat(30)));
|
|
379
|
+
console.log();
|
|
380
|
+
const completedSteps = this.steps.filter(s => s.completed);
|
|
381
|
+
const totalSteps = this.steps.filter(s => !s.optional).length;
|
|
382
|
+
const completedRequired = completedSteps.filter(s => !s.optional).length;
|
|
383
|
+
console.log(colors.success(`â
Completed ${completedRequired}/${totalSteps} required steps`));
|
|
384
|
+
if (completedSteps.some(s => s.optional)) {
|
|
385
|
+
console.log(colors.info(`đ Plus ${completedSteps.filter(s => s.optional).length} optional steps`));
|
|
386
|
+
}
|
|
387
|
+
console.log();
|
|
388
|
+
console.log(chalk.yellow('đ You\'re ready to use Onasis-Core CLI!'));
|
|
389
|
+
console.log();
|
|
390
|
+
console.log(colors.info('Next steps:'));
|
|
391
|
+
console.log(chalk.cyan(' lanonasis health # Check system status'));
|
|
392
|
+
console.log(chalk.cyan(' lanonasis memory list # View your memories'));
|
|
393
|
+
console.log(chalk.cyan(' lanonasis --help # Explore all commands'));
|
|
394
|
+
console.log();
|
|
395
|
+
console.log(chalk.gray('đĄ Need help? Visit: https://docs.lanonasis.com/cli'));
|
|
396
|
+
console.log(chalk.gray('đ Dashboard: https://api.lanonasis.com/dashboard'));
|
|
397
|
+
}
|
|
398
|
+
}
|
|
399
|
+
export async function guideCommand() {
|
|
400
|
+
const guide = new UserGuidanceSystem();
|
|
401
|
+
await guide.runGuidedSetup();
|
|
402
|
+
}
|
|
403
|
+
export async function quickStartCommand() {
|
|
404
|
+
console.log(chalk.blue.bold('⥠Onasis-Core CLI Quick Start'));
|
|
405
|
+
console.log(colors.info('â'.repeat(30)));
|
|
406
|
+
console.log();
|
|
407
|
+
const essentialCommands = [
|
|
408
|
+
{
|
|
409
|
+
category: 'Setup',
|
|
410
|
+
commands: [
|
|
411
|
+
{ cmd: 'lanonasis init', desc: 'Initialize configuration' },
|
|
412
|
+
{ cmd: 'lanonasis login --vendor-key pk_xxx.sk_xxx', desc: 'Authenticate with vendor key' },
|
|
413
|
+
{ cmd: 'lanonasis health', desc: 'Verify system health' }
|
|
414
|
+
]
|
|
415
|
+
},
|
|
416
|
+
{
|
|
417
|
+
category: 'Memory Management',
|
|
418
|
+
commands: [
|
|
419
|
+
{ cmd: 'lanonasis memory create --title "Title" --content "Content"', desc: 'Create memory' },
|
|
420
|
+
{ cmd: 'lanonasis memory list', desc: 'List all memories' },
|
|
421
|
+
{ cmd: 'lanonasis memory search "query"', desc: 'Search memories' }
|
|
422
|
+
]
|
|
423
|
+
},
|
|
424
|
+
{
|
|
425
|
+
category: 'Advanced',
|
|
426
|
+
commands: [
|
|
427
|
+
{ cmd: 'lanonasis topic create --name "Project"', desc: 'Create topic' },
|
|
428
|
+
{ cmd: 'lanonasis mcp status', desc: 'Check MCP server' },
|
|
429
|
+
{ cmd: 'lanonasis api-keys list', desc: 'Manage API keys' }
|
|
430
|
+
]
|
|
431
|
+
}
|
|
432
|
+
];
|
|
433
|
+
essentialCommands.forEach(category => {
|
|
434
|
+
console.log(colors.accent(`đ ${category.category}:`));
|
|
435
|
+
category.commands.forEach(({ cmd, desc }) => {
|
|
436
|
+
console.log(` ${chalk.cyan(cmd)}`);
|
|
437
|
+
console.log(` ${chalk.gray(desc)}`);
|
|
438
|
+
console.log();
|
|
439
|
+
});
|
|
440
|
+
});
|
|
441
|
+
console.log(colors.info('đĄ Pro Tips:'));
|
|
442
|
+
console.log(chalk.gray(' âĸ Use --help with any command for detailed options'));
|
|
443
|
+
console.log(chalk.gray(' âĸ Set up shell completions: lanonasis completion'));
|
|
444
|
+
console.log(chalk.gray(' âĸ Use --verbose for detailed operation logs'));
|
|
445
|
+
console.log();
|
|
446
|
+
}
|
package/dist/commands/mcp.js
CHANGED
|
@@ -19,10 +19,9 @@ export function mcpCommands(program) {
|
|
|
19
19
|
const config = new CLIConfig();
|
|
20
20
|
const isAuthenticated = !!config.get('token');
|
|
21
21
|
if (isAuthenticated) {
|
|
22
|
-
console.log(chalk.green('â Authenticated - Using
|
|
23
|
-
console.log('
|
|
24
|
-
console.log('
|
|
25
|
-
console.log(' with real-time updates enabled');
|
|
22
|
+
console.log(chalk.green('â Authenticated - Using remote MCP mode'));
|
|
23
|
+
console.log(' Your memory operations will use api.lanonasis.com');
|
|
24
|
+
console.log(' with real-time SSE updates enabled');
|
|
26
25
|
}
|
|
27
26
|
else {
|
|
28
27
|
console.log(chalk.yellow('â ī¸ Not authenticated - Using local MCP mode'));
|
|
@@ -31,8 +30,7 @@ export function mcpCommands(program) {
|
|
|
31
30
|
console.log('');
|
|
32
31
|
console.log(chalk.cyan('Available MCP Commands:'));
|
|
33
32
|
console.log(' lanonasis mcp connect # Auto-connect to best mode');
|
|
34
|
-
console.log(' lanonasis mcp connect -r # Force remote
|
|
35
|
-
console.log(' lanonasis mcp connect -w # Force WebSocket mode (enterprise)');
|
|
33
|
+
console.log(' lanonasis mcp connect -r # Force remote mode');
|
|
36
34
|
console.log(' lanonasis mcp connect -l # Force local mode');
|
|
37
35
|
console.log(' lanonasis mcp status # Check connection status');
|
|
38
36
|
console.log(' lanonasis mcp tools # List available tools');
|
|
@@ -50,79 +48,74 @@ export function mcpCommands(program) {
|
|
|
50
48
|
spinner.fail('Failed to auto-connect to MCP');
|
|
51
49
|
}
|
|
52
50
|
}
|
|
53
|
-
catch
|
|
51
|
+
catch {
|
|
54
52
|
spinner.fail('MCP auto-connect failed');
|
|
55
53
|
}
|
|
56
54
|
});
|
|
57
55
|
// Connect command
|
|
58
56
|
mcp.command('connect')
|
|
59
|
-
.description('Connect to MCP server (local, remote
|
|
57
|
+
.description('Connect to MCP server (local, remote, or WebSocket)')
|
|
60
58
|
.option('-l, --local', 'Connect to local MCP server')
|
|
61
|
-
.option('-r, --remote', 'Connect to remote
|
|
62
|
-
.option('-w, --websocket', 'Connect
|
|
59
|
+
.option('-r, --remote', 'Connect to remote MCP server (api.lanonasis.com)')
|
|
60
|
+
.option('-w, --websocket', 'Connect using WebSocket mode for enterprise users')
|
|
63
61
|
.option('-s, --server <path>', 'Local MCP server path')
|
|
64
|
-
.option('-u, --url <url>', 'Remote
|
|
62
|
+
.option('-u, --url <url>', 'Remote/WebSocket server URL')
|
|
65
63
|
.action(async (options) => {
|
|
66
64
|
const spinner = ora('Connecting to MCP server...').start();
|
|
67
65
|
const config = new CLIConfig();
|
|
68
66
|
try {
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
let connectionMode;
|
|
68
|
+
// Determine connection mode - WebSocket takes precedence over remote and local
|
|
71
69
|
if (options.websocket) {
|
|
72
70
|
connectionMode = 'websocket';
|
|
73
71
|
}
|
|
74
72
|
else if (options.remote) {
|
|
75
73
|
connectionMode = 'remote';
|
|
76
74
|
}
|
|
77
|
-
else if (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
75
|
+
else if (options.local) {
|
|
76
|
+
connectionMode = 'local';
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
// Default to remote if authenticated, otherwise local
|
|
80
|
+
connectionMode = !!config.get('token') ? 'remote' : 'local';
|
|
84
81
|
}
|
|
85
|
-
// Save
|
|
82
|
+
// Save preferences
|
|
86
83
|
config.set('mcpConnectionMode', connectionMode);
|
|
87
84
|
if (options.server) {
|
|
88
85
|
config.set('mcpServerPath', options.server);
|
|
89
86
|
}
|
|
90
87
|
if (options.url) {
|
|
91
|
-
|
|
88
|
+
if (connectionMode === 'websocket') {
|
|
89
|
+
config.set('mcpWebSocketUrl', options.url);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
config.set('mcpServerUrl', options.url);
|
|
93
|
+
}
|
|
92
94
|
}
|
|
93
95
|
const client = getMCPClient();
|
|
94
96
|
const connected = await client.connect({
|
|
95
|
-
|
|
97
|
+
connectionMode,
|
|
96
98
|
serverPath: options.server,
|
|
97
99
|
serverUrl: options.url
|
|
98
100
|
});
|
|
99
101
|
if (connected) {
|
|
100
|
-
|
|
101
|
-
local: 'local',
|
|
102
|
-
remote: 'remote SSE',
|
|
103
|
-
websocket: 'WebSocket (Enterprise)'
|
|
104
|
-
};
|
|
105
|
-
spinner.succeed(chalk.green(`Connected to ${modeLabels[connectionMode]} MCP server`));
|
|
102
|
+
spinner.succeed(chalk.green(`Connected to MCP server in ${connectionMode} mode`));
|
|
106
103
|
if (connectionMode === 'remote') {
|
|
107
104
|
console.log(chalk.cyan('âšī¸ Using remote MCP via api.lanonasis.com'));
|
|
108
105
|
console.log(chalk.cyan('đĄ SSE endpoint active for real-time updates'));
|
|
109
106
|
}
|
|
110
107
|
else if (connectionMode === 'websocket') {
|
|
111
|
-
console.log(chalk.cyan('
|
|
112
|
-
console.log(chalk.cyan('
|
|
113
|
-
console.log(chalk.cyan('đĸ Enterprise features enabled'));
|
|
108
|
+
console.log(chalk.cyan('âšī¸ Using enterprise WebSocket MCP server'));
|
|
109
|
+
console.log(chalk.cyan('đĄ WebSocket connection active with auto-reconnect'));
|
|
114
110
|
}
|
|
115
111
|
}
|
|
116
112
|
else {
|
|
117
113
|
spinner.fail('Failed to connect to MCP server');
|
|
118
|
-
if (connectionMode === 'websocket') {
|
|
119
|
-
console.log(chalk.yellow('đĄ WebSocket mode requires enterprise access'));
|
|
120
|
-
console.log(chalk.yellow(' Try: lanonasis mcp connect -r (for SSE mode)'));
|
|
121
|
-
}
|
|
122
114
|
}
|
|
123
115
|
}
|
|
124
116
|
catch (error) {
|
|
125
117
|
spinner.fail(`Connection failed: ${error instanceof Error ? error.message : 'Unknown error'}`);
|
|
118
|
+
process.exit(1);
|
|
126
119
|
}
|
|
127
120
|
});
|
|
128
121
|
// Disconnect command
|
|
@@ -222,7 +215,7 @@ export function mcpCommands(program) {
|
|
|
222
215
|
try {
|
|
223
216
|
args = JSON.parse(options.args);
|
|
224
217
|
}
|
|
225
|
-
catch
|
|
218
|
+
catch {
|
|
226
219
|
spinner.fail('Invalid JSON arguments');
|
|
227
220
|
process.exit(1);
|
|
228
221
|
}
|