@lanonasis/cli 1.5.2 ā 2.0.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 +12 -3
- package/dist/core/achievements.d.ts +102 -0
- package/dist/core/achievements.js +425 -0
- package/dist/core/architecture.d.ts +145 -0
- package/dist/core/architecture.js +355 -0
- package/dist/core/dashboard.d.ts +71 -0
- package/dist/core/dashboard.js +569 -0
- package/dist/core/error-handler.d.ts +97 -0
- package/dist/core/error-handler.js +380 -0
- package/dist/core/power-mode.d.ts +118 -0
- package/dist/core/power-mode.js +460 -0
- package/dist/core/progress.d.ts +160 -0
- package/dist/core/progress.js +428 -0
- package/dist/core/welcome.d.ts +40 -0
- package/dist/core/welcome.js +466 -0
- package/dist/enhanced-cli.d.ts +15 -0
- package/dist/enhanced-cli.js +296 -0
- package/dist/index-simple.js +2 -2
- package/dist/utils/mcp-client.js +1 -1
- package/package.json +6 -4
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Enhanced CLI Entry Point
|
|
4
|
+
* Integrates all the enhanced experience components
|
|
5
|
+
*/
|
|
6
|
+
import { Command } from 'commander';
|
|
7
|
+
import chalk from 'chalk';
|
|
8
|
+
import { config } from 'dotenv';
|
|
9
|
+
import { createCLIArchitecture } from './core/architecture.js';
|
|
10
|
+
import { WelcomeExperience } from './core/welcome.js';
|
|
11
|
+
import { DashboardCommandCenter } from './core/dashboard.js';
|
|
12
|
+
import { ErrorHandler, ErrorBoundary } from './core/error-handler.js';
|
|
13
|
+
import { PowerUserMode } from './core/power-mode.js';
|
|
14
|
+
import { AchievementSystem } from './core/achievements.js';
|
|
15
|
+
import { ProgressIndicator } from './core/progress.js';
|
|
16
|
+
import { CLIConfig } from './utils/config.js';
|
|
17
|
+
// Load environment variables
|
|
18
|
+
config();
|
|
19
|
+
// Initialize the enhanced architecture
|
|
20
|
+
const architecture = createCLIArchitecture();
|
|
21
|
+
const { stateManager, interactionEngine, presentationLayer } = architecture;
|
|
22
|
+
// Initialize systems
|
|
23
|
+
const errorHandler = new ErrorHandler(stateManager);
|
|
24
|
+
const errorBoundary = new ErrorBoundary(errorHandler);
|
|
25
|
+
const achievementSystem = new AchievementSystem(stateManager);
|
|
26
|
+
const progressIndicator = new ProgressIndicator();
|
|
27
|
+
const cliConfig = new CLIConfig();
|
|
28
|
+
// Create the main program
|
|
29
|
+
const program = new Command();
|
|
30
|
+
program
|
|
31
|
+
.name('onasis')
|
|
32
|
+
.description(chalk.cyan('š§ Onasis Memory Service - Enhanced CLI Experience'))
|
|
33
|
+
.version('2.0.0', '-v, --version', 'display version number')
|
|
34
|
+
.option('-V, --verbose', 'enable verbose logging')
|
|
35
|
+
.option('--api-url <url>', 'override API URL')
|
|
36
|
+
.option('--output <format>', 'output format (json, table, yaml, minimal)', 'table')
|
|
37
|
+
.option('--no-animations', 'disable animations')
|
|
38
|
+
.option('--expert', 'start in expert/power mode')
|
|
39
|
+
.option('--offline', 'work offline with cached data');
|
|
40
|
+
// Enhanced init command with interactive setup
|
|
41
|
+
program
|
|
42
|
+
.command('init')
|
|
43
|
+
.description('Initialize and configure Onasis CLI')
|
|
44
|
+
.action(errorBoundary.wrapAsync(async () => {
|
|
45
|
+
const welcome = new WelcomeExperience(stateManager);
|
|
46
|
+
await welcome.show();
|
|
47
|
+
}));
|
|
48
|
+
// Interactive dashboard command
|
|
49
|
+
program
|
|
50
|
+
.command('dashboard')
|
|
51
|
+
.alias('home')
|
|
52
|
+
.description('Open the interactive command center')
|
|
53
|
+
.action(errorBoundary.wrapAsync(async () => {
|
|
54
|
+
const dashboard = new DashboardCommandCenter(stateManager);
|
|
55
|
+
await dashboard.show();
|
|
56
|
+
}));
|
|
57
|
+
// Power mode for expert users
|
|
58
|
+
program
|
|
59
|
+
.command('power')
|
|
60
|
+
.alias('expert')
|
|
61
|
+
.description('Enter power user mode for streamlined operations')
|
|
62
|
+
.action(errorBoundary.wrapAsync(async () => {
|
|
63
|
+
const powerMode = new PowerUserMode(stateManager);
|
|
64
|
+
await powerMode.enter();
|
|
65
|
+
}));
|
|
66
|
+
// Enhanced memory commands with progress and feedback
|
|
67
|
+
program
|
|
68
|
+
.command('memory')
|
|
69
|
+
.alias('m')
|
|
70
|
+
.description('Memory operations')
|
|
71
|
+
.argument('[action]', 'action to perform (create, search, list, update, delete)')
|
|
72
|
+
.option('-t, --title <title>', 'memory title')
|
|
73
|
+
.option('-c, --content <content>', 'memory content')
|
|
74
|
+
.option('--tags <tags>', 'comma-separated tags')
|
|
75
|
+
.option('--type <type>', 'memory type (context, knowledge, reference, project)')
|
|
76
|
+
.option('--topic <topic>', 'topic to categorize under')
|
|
77
|
+
.option('-q, --query <query>', 'search query')
|
|
78
|
+
.option('--limit <n>', 'limit results')
|
|
79
|
+
.option('--interactive', 'use interactive mode')
|
|
80
|
+
.action(errorBoundary.wrapAsync(async (action, options) => {
|
|
81
|
+
const { InteractiveMemoryCreator, InteractiveSearch } = await import('./core/dashboard.js');
|
|
82
|
+
// Update stats for achievements
|
|
83
|
+
achievementSystem.updateStats({
|
|
84
|
+
totalMemories: achievementSystem.userStats.totalMemories + 1
|
|
85
|
+
});
|
|
86
|
+
switch (action) {
|
|
87
|
+
case 'create':
|
|
88
|
+
if (options.interactive || (!options.title && !options.content)) {
|
|
89
|
+
const creator = new InteractiveMemoryCreator(stateManager);
|
|
90
|
+
await creator.create();
|
|
91
|
+
}
|
|
92
|
+
else {
|
|
93
|
+
await progressIndicator.withSpinner(async () => {
|
|
94
|
+
// Create memory logic here
|
|
95
|
+
console.log(chalk.green('ā Memory created successfully'));
|
|
96
|
+
}, 'Creating memory...');
|
|
97
|
+
}
|
|
98
|
+
break;
|
|
99
|
+
case 'search':
|
|
100
|
+
const search = new InteractiveSearch(stateManager);
|
|
101
|
+
await search.search(options.query || '');
|
|
102
|
+
achievementSystem.updateStats({
|
|
103
|
+
totalSearches: achievementSystem.userStats.totalSearches + 1
|
|
104
|
+
});
|
|
105
|
+
break;
|
|
106
|
+
case 'list':
|
|
107
|
+
await progressIndicator.withSpinner(async () => {
|
|
108
|
+
// List memories logic
|
|
109
|
+
console.log(chalk.cyan('Memories listed'));
|
|
110
|
+
}, 'Loading memories...');
|
|
111
|
+
break;
|
|
112
|
+
default:
|
|
113
|
+
// If no action specified, go to interactive mode
|
|
114
|
+
const dashboard = new DashboardCommandCenter(stateManager);
|
|
115
|
+
await dashboard.show();
|
|
116
|
+
}
|
|
117
|
+
}));
|
|
118
|
+
// Topic management with visual feedback
|
|
119
|
+
program
|
|
120
|
+
.command('topic')
|
|
121
|
+
.alias('t')
|
|
122
|
+
.description('Manage topics')
|
|
123
|
+
.argument('[action]', 'action to perform (create, list, delete)')
|
|
124
|
+
.argument('[name]', 'topic name')
|
|
125
|
+
.action(errorBoundary.wrapAsync(async (action, name) => {
|
|
126
|
+
switch (action) {
|
|
127
|
+
case 'create':
|
|
128
|
+
if (!name) {
|
|
129
|
+
const { default: inquirer } = await import('inquirer');
|
|
130
|
+
const { topicName } = await inquirer.prompt([
|
|
131
|
+
{
|
|
132
|
+
type: 'input',
|
|
133
|
+
name: 'topicName',
|
|
134
|
+
message: 'Topic name:',
|
|
135
|
+
validate: (input) => input.length > 0 || 'Topic name is required'
|
|
136
|
+
}
|
|
137
|
+
]);
|
|
138
|
+
name = topicName;
|
|
139
|
+
}
|
|
140
|
+
console.log(chalk.green(`ā Topic "${name}" created`));
|
|
141
|
+
break;
|
|
142
|
+
case 'list':
|
|
143
|
+
console.log(chalk.bold('š Topics:'));
|
|
144
|
+
console.log(' ⢠Architecture');
|
|
145
|
+
console.log(' ⢠API Documentation');
|
|
146
|
+
console.log(' ⢠Meeting Notes');
|
|
147
|
+
break;
|
|
148
|
+
case 'delete':
|
|
149
|
+
console.log(chalk.red(`ā Topic "${name}" deleted`));
|
|
150
|
+
break;
|
|
151
|
+
default:
|
|
152
|
+
console.log(chalk.yellow('Usage: onasis topic [create|list|delete] [name]'));
|
|
153
|
+
}
|
|
154
|
+
}));
|
|
155
|
+
// Achievement system
|
|
156
|
+
program
|
|
157
|
+
.command('achievements')
|
|
158
|
+
.alias('badges')
|
|
159
|
+
.description('View your achievements and progress')
|
|
160
|
+
.action(() => {
|
|
161
|
+
achievementSystem.showAchievements();
|
|
162
|
+
});
|
|
163
|
+
// Stats and analytics
|
|
164
|
+
program
|
|
165
|
+
.command('stats')
|
|
166
|
+
.alias('analytics')
|
|
167
|
+
.description('View usage statistics and analytics')
|
|
168
|
+
.action(errorBoundary.wrapAsync(async () => {
|
|
169
|
+
const { AnalyticsView } = await import('./core/dashboard.js');
|
|
170
|
+
const analytics = new AnalyticsView(stateManager);
|
|
171
|
+
await analytics.show();
|
|
172
|
+
}));
|
|
173
|
+
// Settings management
|
|
174
|
+
program
|
|
175
|
+
.command('settings')
|
|
176
|
+
.alias('config')
|
|
177
|
+
.description('Manage CLI settings and preferences')
|
|
178
|
+
.argument('[key]', 'setting key')
|
|
179
|
+
.argument('[value]', 'setting value')
|
|
180
|
+
.action(errorBoundary.wrapAsync(async (key, value) => {
|
|
181
|
+
if (!key) {
|
|
182
|
+
// Show all settings
|
|
183
|
+
const prefs = stateManager.getPreferences();
|
|
184
|
+
console.log(chalk.bold('āļø Settings:\n'));
|
|
185
|
+
Object.entries(prefs).forEach(([k, v]) => {
|
|
186
|
+
console.log(` ${chalk.cyan(k)}: ${v}`);
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
else if (value !== undefined) {
|
|
190
|
+
// Set a value
|
|
191
|
+
stateManager.updatePreference(key, value);
|
|
192
|
+
console.log(chalk.green(`ā ${key} set to ${value}`));
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
// Get a value
|
|
196
|
+
const prefs = stateManager.getPreferences();
|
|
197
|
+
console.log(`${key}: ${prefs[key]}`);
|
|
198
|
+
}
|
|
199
|
+
}));
|
|
200
|
+
// Help command with enhanced formatting
|
|
201
|
+
program
|
|
202
|
+
.command('help [command]')
|
|
203
|
+
.description('Show help for a specific command')
|
|
204
|
+
.action((command) => {
|
|
205
|
+
if (command) {
|
|
206
|
+
const cmd = program.commands.find(c => c.name() === command);
|
|
207
|
+
if (cmd) {
|
|
208
|
+
cmd.outputHelp();
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
console.log(chalk.red(`Command "${command}" not found`));
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
console.log(chalk.bold.cyan('\nš§ Onasis Memory Service - Enhanced CLI\n'));
|
|
216
|
+
console.log('Available commands:\n');
|
|
217
|
+
program.commands.forEach(cmd => {
|
|
218
|
+
const name = cmd.name().padEnd(15);
|
|
219
|
+
const desc = cmd.description();
|
|
220
|
+
console.log(` ${chalk.cyan(name)} ${desc}`);
|
|
221
|
+
});
|
|
222
|
+
console.log('\nFor detailed help: onasis help [command]');
|
|
223
|
+
console.log('Interactive mode: onasis (no arguments)');
|
|
224
|
+
console.log('Power mode: onasis power');
|
|
225
|
+
}
|
|
226
|
+
});
|
|
227
|
+
// Status command
|
|
228
|
+
program
|
|
229
|
+
.command('status')
|
|
230
|
+
.description('Check service status and connectivity')
|
|
231
|
+
.action(errorBoundary.wrapAsync(async () => {
|
|
232
|
+
const spinner = progressIndicator;
|
|
233
|
+
await spinner.withSpinner(async () => {
|
|
234
|
+
// Check API connection
|
|
235
|
+
await new Promise(resolve => setTimeout(resolve, 1000));
|
|
236
|
+
}, 'Checking service status...');
|
|
237
|
+
console.log(chalk.green('ā Service: Online'));
|
|
238
|
+
console.log(chalk.green('ā API: Connected'));
|
|
239
|
+
console.log(chalk.green('ā Auth: Valid'));
|
|
240
|
+
console.log(chalk.cyan(' Endpoint: api.lanonasis.com'));
|
|
241
|
+
console.log(chalk.cyan(' Version: 2.0.0'));
|
|
242
|
+
}));
|
|
243
|
+
// Default action - show interactive dashboard if no command
|
|
244
|
+
if (process.argv.length === 2) {
|
|
245
|
+
(async () => {
|
|
246
|
+
try {
|
|
247
|
+
// Check if first run
|
|
248
|
+
const isFirstRun = !(await cliConfig.isAuthenticated());
|
|
249
|
+
if (isFirstRun) {
|
|
250
|
+
const welcome = new WelcomeExperience(stateManager);
|
|
251
|
+
await welcome.show();
|
|
252
|
+
}
|
|
253
|
+
else {
|
|
254
|
+
const dashboard = new DashboardCommandCenter(stateManager);
|
|
255
|
+
await dashboard.show();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
catch (error) {
|
|
259
|
+
errorHandler.handle(error);
|
|
260
|
+
process.exit(1);
|
|
261
|
+
}
|
|
262
|
+
})();
|
|
263
|
+
}
|
|
264
|
+
else {
|
|
265
|
+
// Parse command line arguments
|
|
266
|
+
program.parse(process.argv);
|
|
267
|
+
}
|
|
268
|
+
// Handle global options
|
|
269
|
+
const options = program.opts();
|
|
270
|
+
if (options.verbose) {
|
|
271
|
+
process.env.CLI_VERBOSE = 'true';
|
|
272
|
+
console.log(chalk.dim('Verbose mode enabled'));
|
|
273
|
+
}
|
|
274
|
+
if (options.apiUrl) {
|
|
275
|
+
process.env.MEMORY_API_URL = options.apiUrl;
|
|
276
|
+
console.log(chalk.dim(`API URL set to: ${options.apiUrl}`));
|
|
277
|
+
}
|
|
278
|
+
if (options.output) {
|
|
279
|
+
stateManager.updatePreference('outputFormat', options.output);
|
|
280
|
+
}
|
|
281
|
+
if (options.noAnimations) {
|
|
282
|
+
stateManager.updatePreference('animations', false);
|
|
283
|
+
}
|
|
284
|
+
if (options.expert) {
|
|
285
|
+
// Start directly in power mode
|
|
286
|
+
(async () => {
|
|
287
|
+
const powerMode = new PowerUserMode(stateManager);
|
|
288
|
+
await powerMode.enter();
|
|
289
|
+
})();
|
|
290
|
+
}
|
|
291
|
+
if (options.offline) {
|
|
292
|
+
process.env.CLI_OFFLINE = 'true';
|
|
293
|
+
console.log(chalk.yellow('ā Running in offline mode'));
|
|
294
|
+
}
|
|
295
|
+
// Export for testing and extension
|
|
296
|
+
export { architecture, stateManager, errorHandler, achievementSystem, progressIndicator };
|
package/dist/index-simple.js
CHANGED
|
@@ -43,7 +43,7 @@ program
|
|
|
43
43
|
.alias(isOnasisInvocation ? 'lanonasis' : 'memory')
|
|
44
44
|
.alias(isOnasisInvocation ? 'memory' : 'maas')
|
|
45
45
|
.description(colors.info(`š§ ${isOnasisInvocation ? 'Onasis-Core Golden Contract CLI' : 'LanOnasis Enterprise CLI'} - Memory as a Service, API Management & Infrastructure Orchestration`))
|
|
46
|
-
.version('
|
|
46
|
+
.version('2.0.0', '-v, --version', 'display version number')
|
|
47
47
|
.option('-V, --verbose', 'enable verbose logging')
|
|
48
48
|
.option('--api-url <url>', 'override API URL')
|
|
49
49
|
.option('--output <format>', 'output format (json, table, yaml)', 'table')
|
|
@@ -99,7 +99,7 @@ const showWelcome = () => {
|
|
|
99
99
|
const cmdName = isOnasisInvocation ? 'onasis' : 'lanonasis';
|
|
100
100
|
const title = isOnasisInvocation ? 'Onasis-Core Golden Contract CLI' : 'LanOnasis Enterprise CLI';
|
|
101
101
|
console.log();
|
|
102
|
-
console.log(colors.primary(`š ${title}
|
|
102
|
+
console.log(colors.primary(`š ${title} v2.0.0`));
|
|
103
103
|
console.log(colors.info('ā'.repeat(50)));
|
|
104
104
|
console.log(colors.highlight('Enterprise-grade Memory as a Service, API Management & Infrastructure Orchestration'));
|
|
105
105
|
if (isOnasisInvocation) {
|
package/dist/utils/mcp-client.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lanonasis/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
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": {
|
|
@@ -42,17 +42,19 @@
|
|
|
42
42
|
"README.md"
|
|
43
43
|
],
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@modelcontextprotocol/sdk": "^1.17.
|
|
45
|
+
"@modelcontextprotocol/sdk": "^1.17.2",
|
|
46
46
|
"@types/eventsource": "^1.1.15",
|
|
47
47
|
"@types/ws": "^8.18.1",
|
|
48
48
|
"axios": "^1.11.0",
|
|
49
|
-
"
|
|
49
|
+
"boxen": "^7.1.1",
|
|
50
|
+
"chalk": "^5.5.0",
|
|
51
|
+
"cli-progress": "^3.12.0",
|
|
50
52
|
"cli-table3": "^0.6.5",
|
|
51
53
|
"commander": "^12.1.0",
|
|
52
54
|
"date-fns": "^4.1.0",
|
|
53
55
|
"dotenv": "^17.2.1",
|
|
54
56
|
"eventsource": "^4.0.0",
|
|
55
|
-
"inquirer": "^12.9.
|
|
57
|
+
"inquirer": "^12.9.1",
|
|
56
58
|
"jwt-decode": "^4.0.0",
|
|
57
59
|
"open": "^10.2.0",
|
|
58
60
|
"ora": "^8.2.0",
|