@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,378 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { CLIConfig } from '../utils/config.js';
|
|
3
|
+
import { apiClient } from '../utils/api.js';
|
|
4
|
+
// Color scheme
|
|
5
|
+
const colors = {
|
|
6
|
+
primary: chalk.blue.bold,
|
|
7
|
+
success: chalk.green,
|
|
8
|
+
warning: chalk.yellow,
|
|
9
|
+
error: chalk.red,
|
|
10
|
+
info: chalk.cyan,
|
|
11
|
+
accent: chalk.magenta,
|
|
12
|
+
muted: chalk.gray,
|
|
13
|
+
highlight: chalk.white.bold
|
|
14
|
+
};
|
|
15
|
+
export async function generateCompletionData() {
|
|
16
|
+
const config = new CLIConfig();
|
|
17
|
+
await config.init();
|
|
18
|
+
// Dynamic data that might come from API or config
|
|
19
|
+
let memoryTypes = ['context', 'project', 'knowledge', 'reference', 'personal', 'workflow'];
|
|
20
|
+
let topics = [];
|
|
21
|
+
try {
|
|
22
|
+
// Try to fetch dynamic data if authenticated
|
|
23
|
+
if (await config.isAuthenticated()) {
|
|
24
|
+
const topicsData = await apiClient.getTopics();
|
|
25
|
+
topics = topicsData.map(t => t.name);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
catch {
|
|
29
|
+
// Ignore errors in completion generation
|
|
30
|
+
}
|
|
31
|
+
const completionData = {
|
|
32
|
+
commands: [
|
|
33
|
+
{
|
|
34
|
+
name: 'init',
|
|
35
|
+
description: 'Initialize CLI configuration',
|
|
36
|
+
subcommands: []
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'auth',
|
|
40
|
+
aliases: ['login'],
|
|
41
|
+
description: 'Authentication commands',
|
|
42
|
+
subcommands: [
|
|
43
|
+
{
|
|
44
|
+
name: 'login',
|
|
45
|
+
description: 'Login to your account',
|
|
46
|
+
options: [
|
|
47
|
+
{ name: '--email', description: 'Email address', type: 'string' },
|
|
48
|
+
{ name: '--password', description: 'Password', type: 'string' },
|
|
49
|
+
{ name: '--vendor-key', description: 'Vendor key (pk_xxx.sk_xxx)', type: 'string' },
|
|
50
|
+
{ name: '--oauth', description: 'Use OAuth flow', type: 'boolean' }
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'logout',
|
|
55
|
+
description: 'Logout from your account',
|
|
56
|
+
options: []
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'status',
|
|
60
|
+
description: 'Show authentication status',
|
|
61
|
+
options: []
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'memory',
|
|
67
|
+
aliases: ['mem'],
|
|
68
|
+
description: 'Memory management commands',
|
|
69
|
+
subcommands: [
|
|
70
|
+
{
|
|
71
|
+
name: 'list',
|
|
72
|
+
description: 'List memories',
|
|
73
|
+
options: [
|
|
74
|
+
{ name: '--limit', description: 'Number of results', type: 'number' },
|
|
75
|
+
{ name: '--offset', description: 'Results offset', type: 'number' },
|
|
76
|
+
{ name: '--memory-type', description: 'Filter by memory type', type: 'choice', choices: memoryTypes },
|
|
77
|
+
{ name: '--sort-by', description: 'Sort field', type: 'choice', choices: ['created_at', 'updated_at', 'last_accessed', 'access_count'] },
|
|
78
|
+
{ name: '--sort-order', description: 'Sort order', type: 'choice', choices: ['asc', 'desc'] },
|
|
79
|
+
{ name: '--tags', description: 'Filter by tags', type: 'string' }
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'create',
|
|
84
|
+
description: 'Create a new memory',
|
|
85
|
+
options: [
|
|
86
|
+
{ name: '--title', description: 'Memory title', type: 'string', required: true },
|
|
87
|
+
{ name: '--content', description: 'Memory content', type: 'string', required: true },
|
|
88
|
+
{ name: '--memory-type', description: 'Memory type', type: 'choice', choices: memoryTypes },
|
|
89
|
+
{ name: '--tags', description: 'Comma-separated tags', type: 'string' },
|
|
90
|
+
{ name: '--topic-id', description: 'Topic ID', type: 'string' }
|
|
91
|
+
]
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
name: 'get',
|
|
95
|
+
description: 'Get a specific memory',
|
|
96
|
+
options: [
|
|
97
|
+
{ name: 'id', description: 'Memory ID', type: 'string', required: true }
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'update',
|
|
102
|
+
description: 'Update an existing memory',
|
|
103
|
+
options: [
|
|
104
|
+
{ name: 'id', description: 'Memory ID', type: 'string', required: true },
|
|
105
|
+
{ name: '--title', description: 'Memory title', type: 'string' },
|
|
106
|
+
{ name: '--content', description: 'Memory content', type: 'string' },
|
|
107
|
+
{ name: '--memory-type', description: 'Memory type', type: 'choice', choices: memoryTypes },
|
|
108
|
+
{ name: '--tags', description: 'Comma-separated tags', type: 'string' }
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: 'delete',
|
|
113
|
+
description: 'Delete a memory',
|
|
114
|
+
options: [
|
|
115
|
+
{ name: 'id', description: 'Memory ID', type: 'string', required: true }
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
name: 'search',
|
|
120
|
+
description: 'Search memories',
|
|
121
|
+
options: [
|
|
122
|
+
{ name: 'query', description: 'Search query', type: 'string', required: true },
|
|
123
|
+
{ name: '--memory-types', description: 'Filter by memory types', type: 'string' },
|
|
124
|
+
{ name: '--limit', description: 'Number of results', type: 'number' },
|
|
125
|
+
{ name: '--threshold', description: 'Relevance threshold', type: 'number' }
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
name: 'stats',
|
|
130
|
+
description: 'Show memory statistics',
|
|
131
|
+
options: []
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
name: 'bulk-delete',
|
|
135
|
+
description: 'Delete multiple memories',
|
|
136
|
+
options: [
|
|
137
|
+
{ name: '--ids', description: 'Comma-separated memory IDs', type: 'string', required: true }
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
]
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'topic',
|
|
144
|
+
aliases: ['topics'],
|
|
145
|
+
description: 'Topic management commands',
|
|
146
|
+
subcommands: [
|
|
147
|
+
{
|
|
148
|
+
name: 'list',
|
|
149
|
+
description: 'List topics',
|
|
150
|
+
options: []
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'create',
|
|
154
|
+
description: 'Create a new topic',
|
|
155
|
+
options: [
|
|
156
|
+
{ name: '--name', description: 'Topic name', type: 'string', required: true },
|
|
157
|
+
{ name: '--description', description: 'Topic description', type: 'string' },
|
|
158
|
+
{ name: '--color', description: 'Topic color', type: 'string' },
|
|
159
|
+
{ name: '--icon', description: 'Topic icon', type: 'string' }
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
name: 'get',
|
|
164
|
+
description: 'Get a specific topic',
|
|
165
|
+
options: [
|
|
166
|
+
{ name: 'id', description: 'Topic ID', type: 'string', required: true }
|
|
167
|
+
]
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: 'update',
|
|
171
|
+
description: 'Update an existing topic',
|
|
172
|
+
options: [
|
|
173
|
+
{ name: 'id', description: 'Topic ID', type: 'string', required: true },
|
|
174
|
+
{ name: '--name', description: 'Topic name', type: 'string' },
|
|
175
|
+
{ name: '--description', description: 'Topic description', type: 'string' },
|
|
176
|
+
{ name: '--color', description: 'Topic color', type: 'string' }
|
|
177
|
+
]
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
name: 'delete',
|
|
181
|
+
description: 'Delete a topic',
|
|
182
|
+
options: [
|
|
183
|
+
{ name: 'id', description: 'Topic ID', type: 'string', required: true }
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: 'config',
|
|
190
|
+
description: 'Configuration management',
|
|
191
|
+
subcommands: [
|
|
192
|
+
{
|
|
193
|
+
name: 'get',
|
|
194
|
+
description: 'Get configuration value',
|
|
195
|
+
options: [
|
|
196
|
+
{ name: 'key', description: 'Configuration key', type: 'string', required: true }
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: 'set',
|
|
201
|
+
description: 'Set configuration value',
|
|
202
|
+
options: [
|
|
203
|
+
{ name: 'key', description: 'Configuration key', type: 'string', required: true },
|
|
204
|
+
{ name: 'value', description: 'Configuration value', type: 'string', required: true }
|
|
205
|
+
]
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: 'list',
|
|
209
|
+
description: 'List all configuration',
|
|
210
|
+
options: []
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
name: 'reset',
|
|
214
|
+
description: 'Reset configuration',
|
|
215
|
+
options: [
|
|
216
|
+
{ name: '--confirm', description: 'Confirm reset', type: 'boolean' }
|
|
217
|
+
]
|
|
218
|
+
}
|
|
219
|
+
]
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: 'api-keys',
|
|
223
|
+
description: 'API key management',
|
|
224
|
+
subcommands: [
|
|
225
|
+
{
|
|
226
|
+
name: 'list',
|
|
227
|
+
description: 'List API keys',
|
|
228
|
+
options: []
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: 'create',
|
|
232
|
+
description: 'Create a new API key',
|
|
233
|
+
options: [
|
|
234
|
+
{ name: '--name', description: 'API key name', type: 'string', required: true },
|
|
235
|
+
{ name: '--scope', description: 'API key scope', type: 'string' },
|
|
236
|
+
{ name: '--expires', description: 'Expiration date', type: 'string' }
|
|
237
|
+
]
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
name: 'revoke',
|
|
241
|
+
description: 'Revoke an API key',
|
|
242
|
+
options: [
|
|
243
|
+
{ name: 'id', description: 'API key ID', type: 'string', required: true }
|
|
244
|
+
]
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: 'rotate',
|
|
248
|
+
description: 'Rotate an API key',
|
|
249
|
+
options: [
|
|
250
|
+
{ name: 'id', description: 'API key ID', type: 'string', required: true }
|
|
251
|
+
]
|
|
252
|
+
}
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
{
|
|
256
|
+
name: 'mcp',
|
|
257
|
+
description: 'Model Context Protocol commands',
|
|
258
|
+
subcommands: [
|
|
259
|
+
{
|
|
260
|
+
name: 'status',
|
|
261
|
+
description: 'Show MCP server status',
|
|
262
|
+
options: []
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: 'connect',
|
|
266
|
+
description: 'Connect to MCP server',
|
|
267
|
+
options: [
|
|
268
|
+
{ name: '--remote', description: 'Use remote server', type: 'boolean' },
|
|
269
|
+
{ name: '--local', description: 'Use local server', type: 'boolean' }
|
|
270
|
+
]
|
|
271
|
+
},
|
|
272
|
+
{
|
|
273
|
+
name: 'disconnect',
|
|
274
|
+
description: 'Disconnect from MCP server',
|
|
275
|
+
options: []
|
|
276
|
+
},
|
|
277
|
+
{
|
|
278
|
+
name: 'servers',
|
|
279
|
+
description: 'List MCP servers',
|
|
280
|
+
options: []
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: 'tools',
|
|
284
|
+
description: 'List available tools',
|
|
285
|
+
options: []
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
name: 'resources',
|
|
289
|
+
description: 'List available resources',
|
|
290
|
+
options: []
|
|
291
|
+
}
|
|
292
|
+
]
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
name: 'dashboard',
|
|
296
|
+
description: 'Dashboard management',
|
|
297
|
+
subcommands: [
|
|
298
|
+
{
|
|
299
|
+
name: 'status',
|
|
300
|
+
description: 'Check dashboard status',
|
|
301
|
+
options: []
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
name: 'logs',
|
|
305
|
+
description: 'View dashboard logs',
|
|
306
|
+
options: []
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
name: 'open',
|
|
310
|
+
description: 'Open dashboard in browser',
|
|
311
|
+
options: []
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: 'status',
|
|
317
|
+
description: 'Show overall system status',
|
|
318
|
+
subcommands: []
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: 'health',
|
|
322
|
+
aliases: ['check'],
|
|
323
|
+
description: 'Comprehensive system health check',
|
|
324
|
+
subcommands: []
|
|
325
|
+
}
|
|
326
|
+
],
|
|
327
|
+
globalOptions: [
|
|
328
|
+
{ name: '--help', description: 'Show help information', type: 'boolean' },
|
|
329
|
+
{ name: '--version', description: 'Show version information', type: 'boolean' },
|
|
330
|
+
{ name: '--verbose', description: 'Enable verbose logging', type: 'boolean' },
|
|
331
|
+
{ name: '--output', description: 'Output format', type: 'choice', choices: ['table', 'json', 'yaml', 'csv'] },
|
|
332
|
+
{ name: '--api-url', description: 'Override API URL', type: 'string' },
|
|
333
|
+
{ name: '--no-mcp', description: 'Disable MCP and use direct API', type: 'boolean' }
|
|
334
|
+
],
|
|
335
|
+
contextualData: {
|
|
336
|
+
memoryTypes,
|
|
337
|
+
outputFormats: ['table', 'json', 'yaml', 'csv'],
|
|
338
|
+
sortOptions: ['created_at', 'updated_at', 'last_accessed', 'access_count'],
|
|
339
|
+
authMethods: ['vendor_key', 'oauth', 'credentials']
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
return completionData;
|
|
343
|
+
}
|
|
344
|
+
export async function completionCommand() {
|
|
345
|
+
try {
|
|
346
|
+
const data = await generateCompletionData();
|
|
347
|
+
console.log(JSON.stringify(data, null, 2));
|
|
348
|
+
}
|
|
349
|
+
catch (error) {
|
|
350
|
+
console.error(chalk.red('✖ Failed to generate completion data:'), error instanceof Error ? error.message : String(error));
|
|
351
|
+
process.exit(1);
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
export async function installCompletionsCommand() {
|
|
355
|
+
console.log(chalk.blue.bold('🔧 Installing Shell Completions'));
|
|
356
|
+
console.log(colors.info('═'.repeat(40)));
|
|
357
|
+
console.log();
|
|
358
|
+
console.log(chalk.yellow('📋 Installation Instructions:'));
|
|
359
|
+
console.log();
|
|
360
|
+
console.log(chalk.white('Bash:'));
|
|
361
|
+
console.log(chalk.gray(' # Add to ~/.bashrc or ~/.bash_profile:'));
|
|
362
|
+
console.log(chalk.cyan(' source <(lanonasis --completion bash)'));
|
|
363
|
+
console.log();
|
|
364
|
+
console.log(chalk.white('Zsh:'));
|
|
365
|
+
console.log(chalk.gray(' # Add to ~/.zshrc:'));
|
|
366
|
+
console.log(chalk.cyan(' source <(lanonasis --completion zsh)'));
|
|
367
|
+
console.log(chalk.gray(' # Or for Oh My Zsh, create ~/.oh-my-zsh/completions/_lanonasis'));
|
|
368
|
+
console.log();
|
|
369
|
+
console.log(chalk.white('Fish:'));
|
|
370
|
+
console.log(chalk.gray(' # Add to ~/.config/fish/config.fish:'));
|
|
371
|
+
console.log(chalk.cyan(' lanonasis --completion fish | source'));
|
|
372
|
+
console.log(chalk.gray(' # Or save to ~/.config/fish/completions/lanonasis.fish'));
|
|
373
|
+
console.log();
|
|
374
|
+
console.log(colors.info('💡 Completions support all command aliases:'));
|
|
375
|
+
console.log(chalk.gray(' • lanonasis, onasis, memory, maas'));
|
|
376
|
+
console.log();
|
|
377
|
+
console.log(colors.success('✅ Run the appropriate command above for your shell'));
|
|
378
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare class UserGuidanceSystem {
|
|
2
|
+
private config;
|
|
3
|
+
private steps;
|
|
4
|
+
constructor();
|
|
5
|
+
private initializeSteps;
|
|
6
|
+
runGuidedSetup(): Promise<void>;
|
|
7
|
+
private assessCurrentStatus;
|
|
8
|
+
private markStepCompleted;
|
|
9
|
+
private executeStep;
|
|
10
|
+
private initializeConfig;
|
|
11
|
+
private setupAuthentication;
|
|
12
|
+
private verifyConnection;
|
|
13
|
+
private createFirstMemory;
|
|
14
|
+
private exploreFeatures;
|
|
15
|
+
private setupProductivity;
|
|
16
|
+
private showCompletionSummary;
|
|
17
|
+
}
|
|
18
|
+
export declare function guideCommand(): Promise<void>;
|
|
19
|
+
export declare function quickStartCommand(): Promise<void>;
|