@lanonasis/cli 2.0.1 → 2.0.4

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 CHANGED
@@ -1,4 +1,4 @@
1
- # @lanonasis/cli v2.0.0 - Enhanced Interactive CLI Experience
1
+ # @lanonasis/cli v2.0.1 - Enhanced Interactive CLI Experience
2
2
 
3
3
  [![NPM Version](https://img.shields.io/npm/v/@lanonasis/cli)](https://www.npmjs.com/package/@lanonasis/cli)
4
4
  [![Downloads](https://img.shields.io/npm/dt/@lanonasis/cli)](https://www.npmjs.com/package/@lanonasis/cli)
@@ -118,7 +118,9 @@ async function handleOAuthFlow(config) {
118
118
  console.log(chalk.yellow('Authentication cancelled'));
119
119
  return;
120
120
  }
121
- const authUrl = `${config.getDiscoveredApiUrl()}/auth/cli-login`;
121
+ // Ensure proper URL joining to prevent double slashes
122
+ const baseUrl = config.getDiscoveredApiUrl().replace(/\/+$/, ''); // Remove trailing slashes
123
+ const authUrl = `${baseUrl}/auth/cli-login`;
122
124
  try {
123
125
  console.log(colors.info('Opening browser...'));
124
126
  await open(authUrl);
@@ -6,7 +6,7 @@ import { EventEmitter } from 'events';
6
6
  export interface NavigationState {
7
7
  name: string;
8
8
  path: string;
9
- context: Record<string, any>;
9
+ preferences: Record<string, unknown>;
10
10
  timestamp: Date;
11
11
  }
12
12
  export interface UserContext {
@@ -83,7 +83,7 @@ export declare class AdaptivePromptSystem {
83
83
  private guidedPrompt;
84
84
  }
85
85
  export declare class ContextualValidator {
86
- validate(value: any, rules: ValidationRule[]): ValidationResult;
86
+ validate(value: unknown, rules: ValidationRule[]): ValidationResult;
87
87
  }
88
88
  export declare class RealTimeFeedback {
89
89
  private readonly icons;
@@ -103,7 +103,7 @@ export declare class PresentationLayer {
103
103
  constructor();
104
104
  applyTheme(theme: string): void;
105
105
  renderLayout(content: any, layout: string): void;
106
- animate(element: any, animation: string): void;
106
+ private animate;
107
107
  }
108
108
  export declare class AdaptiveThemeEngine {
109
109
  private currentTheme;
@@ -112,16 +112,16 @@ export declare class AdaptiveThemeEngine {
112
112
  getColors(): any;
113
113
  }
114
114
  export declare class ResponsiveLayoutManager {
115
- render(content: any, layout: string): void;
116
- private renderCard;
117
- private renderTable;
115
+ render(content: unknown, layout: string): void;
116
+ private renderContent;
117
+ private renderTitle;
118
118
  private renderDashboard;
119
119
  }
120
120
  export declare class SubtleAnimationController {
121
- animate(element: any, animation: string): void;
121
+ animate(_element: unknown, _animation: string): void;
122
122
  }
123
123
  export interface ValidationRule {
124
- validate(value: any): {
124
+ validate(value: unknown): {
125
125
  valid: boolean;
126
126
  message: string;
127
127
  severity: 'error' | 'warning';
@@ -155,12 +155,12 @@ export class AdaptivePromptSystem {
155
155
  return this.guidedPrompt(config);
156
156
  }
157
157
  }
158
- async expertPrompt(config) {
158
+ async expertPrompt(_config) {
159
159
  // Minimal, streamlined prompt for expert users
160
160
  // Implementation would use minimal UI elements
161
161
  return null;
162
162
  }
163
- async guidedPrompt(config) {
163
+ async guidedPrompt(_config) {
164
164
  // Rich, guided prompt with helpful hints
165
165
  // Implementation would use enhanced UI elements
166
166
  return null;
@@ -230,7 +230,7 @@ export class InlineHelpProvider {
230
230
  // Return contextual help based on current state
231
231
  return this.generateHelpText(currentState, context);
232
232
  }
233
- generateHelpText(state, context) {
233
+ generateHelpText(state, _context) {
234
234
  if (!state) {
235
235
  return 'Type "help" for available commands';
236
236
  }
@@ -260,8 +260,8 @@ export class PresentationLayer {
260
260
  renderLayout(content, layout) {
261
261
  this.layoutManager.render(content, layout);
262
262
  }
263
- animate(element, animation) {
264
- this.animationController.animate(element, animation);
263
+ animate(_element, _animation) {
264
+ this.animationController.animate(_element, _animation);
265
265
  }
266
266
  }
267
267
  // Theme Engine
@@ -306,10 +306,10 @@ export class ResponsiveLayoutManager {
306
306
  // Implement different layout strategies
307
307
  switch (layout) {
308
308
  case 'card':
309
- this.renderCard(content);
309
+ this.renderContent(content);
310
310
  break;
311
311
  case 'table':
312
- this.renderTable(content);
312
+ this.renderTitle(content);
313
313
  break;
314
314
  case 'dashboard':
315
315
  this.renderDashboard(content);
@@ -318,7 +318,7 @@ export class ResponsiveLayoutManager {
318
318
  console.log(content);
319
319
  }
320
320
  }
321
- renderCard(content) {
321
+ renderContent(content) {
322
322
  // Render content in card layout
323
323
  console.log('╭─────────────────────────────────────────╮');
324
324
  console.log(`│ ${content.title || ''}`.padEnd(42) + '│');
@@ -326,18 +326,18 @@ export class ResponsiveLayoutManager {
326
326
  console.log(`│ ${content.body || ''}`.padEnd(42) + '│');
327
327
  console.log('╰─────────────────────────────────────────╯');
328
328
  }
329
- renderTable(content) {
329
+ renderTitle(_content) {
330
330
  // Render content in table layout
331
331
  // Implementation here
332
332
  }
333
- renderDashboard(content) {
333
+ renderDashboard(_content) {
334
334
  // Render dashboard layout
335
335
  // Implementation here
336
336
  }
337
337
  }
338
338
  // Animation Controller
339
339
  export class SubtleAnimationController {
340
- animate(element, animation) {
340
+ animate(_element, _animation) {
341
341
  // Implement subtle animations for CLI
342
342
  // This would handle progress bars, spinners, etc.
343
343
  }
@@ -166,9 +166,9 @@ export class DashboardCommandCenter {
166
166
  const creator = new InteractiveMemoryCreator(this.stateManager);
167
167
  await creator.create();
168
168
  }
169
- async searchMemories(query) {
169
+ async searchMemories(_query) {
170
170
  const search = new InteractiveSearch(this.stateManager);
171
- await search.search(query);
171
+ await search.search(_query);
172
172
  }
173
173
  async browseTopics() {
174
174
  console.log(chalk.yellow('Browse Topics - Coming soon...'));
@@ -484,7 +484,7 @@ export class InteractiveSearch {
484
484
  break;
485
485
  }
486
486
  }
487
- displayResults(query) {
487
+ displayResults(_query) {
488
488
  const results = [
489
489
  { score: 94, title: 'Payment Gateway Integration Guide', age: '3 days ago', type: 'Knowledge', tags: 'api, payments, stripe' },
490
490
  { score: 87, title: 'Payment Error Handling Strategy', age: '1 week ago', type: 'Context', tags: 'error-handling, payments' },
@@ -116,7 +116,7 @@ export class WelcomeExperience {
116
116
  this.stateManager.pushNavigation({
117
117
  name: 'dashboard',
118
118
  path: '/dashboard',
119
- context: {},
119
+ preferences: {},
120
120
  timestamp: new Date()
121
121
  });
122
122
  }
package/dist/utils/api.js CHANGED
@@ -13,7 +13,11 @@ export class APIClient {
13
13
  await this.config.init();
14
14
  // Service Discovery
15
15
  await this.config.discoverServices();
16
- config.baseURL = this.config.getDiscoveredApiUrl();
16
+ // Use appropriate base URL based on endpoint
17
+ const isAuthEndpoint = config.url?.includes('/auth/') || config.url?.includes('/login') || config.url?.includes('/register');
18
+ config.baseURL = isAuthEndpoint ?
19
+ (this.config.get('discoveredServices')?.auth_base || 'https://api.lanonasis.com/auth') :
20
+ this.config.getApiUrl();
17
21
  // Enhanced Authentication Support
18
22
  const token = this.config.getToken();
19
23
  const vendorKey = this.config.getVendorKey();
@@ -51,11 +51,20 @@ export class CLIConfig {
51
51
  this.config.discoveredServices = response.data;
52
52
  await this.save();
53
53
  }
54
- catch (error) {
55
- // Service discovery failed, use defaults
54
+ catch {
55
+ // Service discovery failed, use fallback defaults
56
56
  if (process.env.CLI_VERBOSE === 'true') {
57
- console.log('Service discovery failed, using defaults');
57
+ console.log('Service discovery failed, using fallback defaults');
58
58
  }
59
+ // Set fallback service endpoints to prevent double slash issues
60
+ // Based on architecture: auth routes through onasis-core, not MCP server
61
+ this.config.discoveredServices = {
62
+ auth_base: 'https://api.lanonasis.com/api/v1',
63
+ memory_base: 'https://api.lanonasis.com/api/v1',
64
+ mcp_ws_base: 'wss://mcp.lanonasis.com/ws',
65
+ project_scope: 'lanonasis'
66
+ };
67
+ await this.save();
59
68
  }
60
69
  }
61
70
  getDiscoveredApiUrl() {
@@ -3,6 +3,7 @@ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
3
3
  import chalk from 'chalk';
4
4
  import { CLIConfig } from './config.js';
5
5
  import * as path from 'path';
6
+ import * as fs from 'fs';
6
7
  import { EventSource } from 'eventsource';
7
8
  import { fileURLToPath } from 'url';
8
9
  import WebSocket from 'ws';
@@ -23,11 +24,12 @@ export class MCPClient {
23
24
  async connect(options = {}) {
24
25
  try {
25
26
  // Determine connection mode with priority to explicit mode option
27
+ // Default to 'remote' for better user experience
26
28
  const connectionMode = options.connectionMode ??
27
29
  (options.useWebSocket ? 'websocket' :
28
30
  options.useRemote ? 'remote' :
29
31
  this.config.get('mcpConnectionMode') ??
30
- this.config.get('mcpUseRemote') ? 'remote' : 'local');
32
+ this.config.get('mcpUseRemote') ? 'remote' : 'remote');
31
33
  let wsUrl;
32
34
  let serverUrl;
33
35
  let serverPath;
@@ -55,10 +57,17 @@ export class MCPClient {
55
57
  case 'local':
56
58
  default:
57
59
  {
58
- // Local MCP server connection
60
+ // Local MCP server connection - check if server exists
59
61
  serverPath = options.serverPath ??
60
62
  this.config.get('mcpServerPath') ??
61
63
  path.join(__dirname, '../../../../onasis-gateway/mcp-server/server.js');
64
+ // Check if the server file exists
65
+ if (!fs.existsSync(serverPath)) {
66
+ console.log(chalk.yellow(`⚠️ Local MCP server not found at ${serverPath}`));
67
+ console.log(chalk.cyan('💡 For remote connection, use: onasis mcp connect --url wss://mcp.lanonasis.com/ws'));
68
+ console.log(chalk.cyan('💡 Or install local server: npm install -g @lanonasis/mcp-server'));
69
+ throw new Error(`MCP server not found at ${serverPath}`);
70
+ }
62
71
  console.log(chalk.cyan(`Connecting to local MCP server at ${serverPath}...`));
63
72
  const localTransport = new StdioClientTransport({
64
73
  command: 'node',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lanonasis/cli",
3
- "version": "2.0.1",
3
+ "version": "2.0.4",
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": {
@@ -41,11 +41,24 @@
41
41
  "dist",
42
42
  "README.md"
43
43
  ],
44
+ "publishConfig": {
45
+ "access": "public",
46
+ "registry": "https://registry.npmjs.org/"
47
+ },
48
+ "repository": {
49
+ "type": "git",
50
+ "url": "https://github.com/lanonasis/lanonasis-maas.git",
51
+ "directory": "cli"
52
+ },
53
+ "bugs": {
54
+ "url": "https://github.com/lanonasis/lanonasis-maas/issues"
55
+ },
56
+ "homepage": "https://github.com/lanonasis/lanonasis-maas#readme",
44
57
  "dependencies": {
45
- "@modelcontextprotocol/sdk": "^1.17.2",
58
+ "@modelcontextprotocol/sdk": "^1.17.4",
46
59
  "@types/eventsource": "^1.1.15",
47
60
  "@types/ws": "^8.18.1",
48
- "axios": "^1.11.0",
61
+ "axios": "^1.12.0",
49
62
  "boxen": "^7.1.1",
50
63
  "chalk": "^5.5.0",
51
64
  "cli-progress": "^3.12.0",
@@ -54,7 +67,7 @@
54
67
  "date-fns": "^4.1.0",
55
68
  "dotenv": "^17.2.1",
56
69
  "eventsource": "^4.0.0",
57
- "inquirer": "^12.9.1",
70
+ "inquirer": "^12.9.3",
58
71
  "jwt-decode": "^4.0.0",
59
72
  "open": "^10.2.0",
60
73
  "ora": "^8.2.0",