@qodalis/cli-core 2.0.0-beta.9 → 2.0.0-rc.1

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
@@ -66,7 +66,7 @@ Add styles to `angular.json`:
66
66
  ```json
67
67
  {
68
68
  "styles": [
69
- "node_modules/@qodalis/angular-cli/src/assets/styles.sass"
69
+ "node_modules/@qodalis/angular-cli/src/assets/styles.css"
70
70
  ]
71
71
  }
72
72
  ```
@@ -86,6 +86,7 @@ npm install @qodalis/react-cli
86
86
  ```
87
87
 
88
88
  ```tsx
89
+ import '@qodalis/react-cli/styles.css';
89
90
  import { Cli } from '@qodalis/react-cli';
90
91
 
91
92
  function App() {
@@ -101,6 +102,7 @@ npm install @qodalis/vue-cli
101
102
 
102
103
  ```vue
103
104
  <script setup lang="ts">
105
+ import '@qodalis/vue-cli/styles.css';
104
106
  import { Cli } from '@qodalis/vue-cli';
105
107
  </script>
106
108
 
@@ -115,13 +117,10 @@ Pass options to customize the terminal:
115
117
 
116
118
  ```typescript
117
119
  const options = {
118
- welcomeMessage: {
120
+ welcome: {
119
121
  message: '-- your custom welcome message --',
120
122
  show: 'daily', // 'never', 'once', 'daily', 'always'
121
123
  },
122
- usersModule: {
123
- enabled: true,
124
- },
125
124
  };
126
125
  ```
127
126
 
@@ -134,7 +133,7 @@ const options = {
134
133
  | `help` | `man` | Show all commands or help for a specific command |
135
134
  | `version` | `ver` | Display CLI version and documentation link |
136
135
  | `hotkeys` | `shortcuts`, `keys` | Show keyboard shortcuts |
137
- | `history` | `hist` | Browse and clear command history |
136
+ | `history` | `hist` | Browse and clear your command history (per user with the users plugin) |
138
137
  | `theme` | `themes` | Apply, customize, and save terminal themes (interactive selection with live preview) |
139
138
  | `feedback` | `support` | Report bugs or request features on GitHub |
140
139
  | `pkg` | `packages` | Install, update, remove, and browse packages |
@@ -203,19 +202,60 @@ pkg source set unpkg # Set package source directly
203
202
 
204
203
  ### Available Packages
205
204
 
205
+ #### Utility Plugins
206
+
206
207
  | Package | Command | Description |
207
208
  |---------|---------|-------------|
209
+ | [@qodalis/cli-data-explorer](https://www.npmjs.com/package/@qodalis/cli-data-explorer) | `data-explorer` | Interactive query console for SQL, MongoDB, Redis, Elasticsearch |
208
210
  | [@qodalis/cli-guid](https://www.npmjs.com/package/@qodalis/cli-guid) | `guid` | Generate and validate UUIDs |
209
- | [@qodalis/cli-string](https://www.npmjs.com/package/@qodalis/cli-string) | `string` | String manipulation (case, trim, reverse, slug, wc, etc.) |
210
- | [@qodalis/cli-curl](https://www.npmjs.com/package/@qodalis/cli-curl) | `curl` | HTTP requests (GET, POST, PUT, DELETE) |
211
- | [@qodalis/cli-todo](https://www.npmjs.com/package/@qodalis/cli-todo) | `todo` | Task management |
212
211
  | [@qodalis/cli-regex](https://www.npmjs.com/package/@qodalis/cli-regex) | `regex` | Regular expression testing |
213
212
  | [@qodalis/cli-qr](https://www.npmjs.com/package/@qodalis/cli-qr) | `qr` | QR code generation |
214
213
  | [@qodalis/cli-speed-test](https://www.npmjs.com/package/@qodalis/cli-speed-test) | `speed-test` | Internet speed test |
215
- | [@qodalis/cli-server-logs](https://www.npmjs.com/package/@qodalis/cli-server-logs) | `server-logs` | Live server log streaming |
214
+ | [@qodalis/cli-curl](https://www.npmjs.com/package/@qodalis/cli-curl) | `curl` | HTTP requests (GET, POST, PUT, DELETE) |
215
+ | [@qodalis/cli-password-generator](https://www.npmjs.com/package/@qodalis/cli-password-generator) | `generate-password` | Password generation |
216
+ | [@qodalis/cli-string](https://www.npmjs.com/package/@qodalis/cli-string) | `string` | String manipulation (case, trim, reverse, slug, wc, etc.) |
217
+ | [@qodalis/cli-todo](https://www.npmjs.com/package/@qodalis/cli-todo) | `todo` | Task management |
216
218
  | [@qodalis/cli-browser-storage](https://www.npmjs.com/package/@qodalis/cli-browser-storage) | `local-storage`, `cookies` | Browser storage operations |
217
219
  | [@qodalis/cli-text-to-image](https://www.npmjs.com/package/@qodalis/cli-text-to-image) | `text-to-image` | Generate images from text |
218
- | [@qodalis/cli-password-generator](https://www.npmjs.com/package/@qodalis/cli-password-generator) | `generate-password` | Password generation |
220
+ | [@qodalis/cli-files](https://www.npmjs.com/package/@qodalis/cli-files) | `ls`, `cat`, `nano`, `mkdir`, `touch`, `rm` | Virtual filesystem |
221
+ | [@qodalis/cli-yesno](https://www.npmjs.com/package/@qodalis/cli-yesno) | `yesno` | Interactive yes/no confirmation prompts |
222
+ | [@qodalis/cli-server-logs](https://www.npmjs.com/package/@qodalis/cli-server-logs) | `server logs` | Live server log streaming with level filtering |
223
+ | [@qodalis/cli-server-jobs](https://www.npmjs.com/package/@qodalis/cli-server-jobs) | `server jobs` | Manage server-side background jobs |
224
+ | [@qodalis/cli-users](https://www.npmjs.com/package/@qodalis/cli-users) | `whoami`, `adduser`, `login` | User management and authentication |
225
+ | [@qodalis/cli-chart](https://www.npmjs.com/package/@qodalis/cli-chart) | `chart` | Render bar, line, and sparkline charts |
226
+ | [@qodalis/cli-cron](https://www.npmjs.com/package/@qodalis/cli-cron) | `cron` | Schedule and manage recurring commands |
227
+ | [@qodalis/cli-csv](https://www.npmjs.com/package/@qodalis/cli-csv) | `csv` | Parse, filter, sort, and convert CSV data |
228
+ | [@qodalis/cli-markdown](https://www.npmjs.com/package/@qodalis/cli-markdown) | `md` | Render Markdown content in the terminal |
229
+ | [@qodalis/cli-encode](https://www.npmjs.com/package/@qodalis/cli-encode) | `base64`, `url`, `hex`, `html` | Encode/decode Base64, URL, hex, HTML entities |
230
+ | [@qodalis/cli-scp](https://www.npmjs.com/package/@qodalis/cli-scp) | `scp` | Secure copy — transfer files between local and remote |
231
+ | [@qodalis/cli-wget](https://www.npmjs.com/package/@qodalis/cli-wget) | `wget` | Download files from URLs |
232
+ | [@qodalis/cli-stopwatch](https://www.npmjs.com/package/@qodalis/cli-stopwatch) | `stopwatch` | Interactive stopwatch and countdown timer |
233
+
234
+ #### Game Plugins
235
+
236
+ | Package | Command | Description |
237
+ |---------|---------|-------------|
238
+ | [@qodalis/cli-snake](https://www.npmjs.com/package/@qodalis/cli-snake) | `snake` | Classic Snake game |
239
+ | [@qodalis/cli-tetris](https://www.npmjs.com/package/@qodalis/cli-tetris) | `tetris` | Tetris |
240
+ | [@qodalis/cli-2048](https://www.npmjs.com/package/@qodalis/cli-2048) | `2048` | 2048 sliding puzzle |
241
+ | [@qodalis/cli-minesweeper](https://www.npmjs.com/package/@qodalis/cli-minesweeper) | `minesweeper` | Minesweeper |
242
+ | [@qodalis/cli-wordle](https://www.npmjs.com/package/@qodalis/cli-wordle) | `wordle` | Wordle word game |
243
+ | [@qodalis/cli-sudoku](https://www.npmjs.com/package/@qodalis/cli-sudoku) | `sudoku` | Sudoku puzzle |
244
+
245
+ #### Language Packs
246
+
247
+ | Package | Language |
248
+ |---------|----------|
249
+ | [@qodalis/cli-lang-es](https://www.npmjs.com/package/@qodalis/cli-lang-es) | Spanish |
250
+ | [@qodalis/cli-lang-fr](https://www.npmjs.com/package/@qodalis/cli-lang-fr) | French |
251
+ | [@qodalis/cli-lang-de](https://www.npmjs.com/package/@qodalis/cli-lang-de) | German |
252
+ | [@qodalis/cli-lang-it](https://www.npmjs.com/package/@qodalis/cli-lang-it) | Italian |
253
+ | [@qodalis/cli-lang-pt](https://www.npmjs.com/package/@qodalis/cli-lang-pt) | Portuguese |
254
+ | [@qodalis/cli-lang-ro](https://www.npmjs.com/package/@qodalis/cli-lang-ro) | Romanian |
255
+ | [@qodalis/cli-lang-ru](https://www.npmjs.com/package/@qodalis/cli-lang-ru) | Russian |
256
+ | [@qodalis/cli-lang-zh](https://www.npmjs.com/package/@qodalis/cli-lang-zh) | Chinese |
257
+ | [@qodalis/cli-lang-ja](https://www.npmjs.com/package/@qodalis/cli-lang-ja) | Japanese |
258
+ | [@qodalis/cli-lang-ko](https://www.npmjs.com/package/@qodalis/cli-lang-ko) | Korean |
219
259
 
220
260
  Any npm package with UMD support can also be loaded:
221
261
 
@@ -224,6 +264,90 @@ pkg add lodash
224
264
  eval _.map([1, 2, 3], n => n * 2)
225
265
  ```
226
266
 
267
+ ## Server Integration
268
+
269
+ Connect the frontend terminal to a backend server for server-side command execution, interactive shell sessions, filesystem access, and event streaming. Three official backend implementations are available:
270
+
271
+ | Server | Package | Port | Tech Stack |
272
+ |--------|---------|------|------------|
273
+ | **.NET** | [Qodalis.Cli](https://www.nuget.org/packages/Qodalis.Cli) | 8046 | ASP.NET Core, .NET 8 |
274
+ | **Node.js** | [@qodalis/cli-server](https://www.npmjs.com/package/@qodalis/cli-server) | 8047 | Express, TypeScript, node-pty |
275
+ | **Python** | [qodalis-cli-server](https://pypi.org/project/qodalis-cli-server/) | 8048 | FastAPI, uvicorn |
276
+
277
+ All three implement the same API surface:
278
+
279
+ | Endpoint | Method | Purpose |
280
+ |----------|--------|---------|
281
+ | `/api/cli/versions` | GET | Version discovery |
282
+ | `/api/v1/cli/commands` | GET | List registered command processors |
283
+ | `/api/v1/cli/execute` | POST | Execute a CLI command |
284
+ | `/api/v1/cli/execute/stream` | POST | Execute with SSE streaming output |
285
+ | `/ws/v1/cli/events` | WS | Server-push event streaming |
286
+ | `/ws/v1/cli/shell` | WS | Interactive PTY shell session |
287
+ | `/api/cli/fs/*` | Various | Filesystem operations (ls, cat, upload, download, mkdir, rm) |
288
+ | `/api/qcli/mcp` | POST | MCP endpoint for AI clients (opt-in) |
289
+
290
+ ### Connecting to a Server
291
+
292
+ ```typescript
293
+ import { CliOptions } from '@qodalis/cli-core';
294
+
295
+ const options: CliOptions = {
296
+ servers: [
297
+ { name: 'node', url: 'http://localhost:8047' },
298
+ { name: 'dotnet', url: 'http://localhost:8046' },
299
+ { name: 'python', url: 'http://localhost:8048' },
300
+ ],
301
+ };
302
+
303
+ // Angular: <cli [options]="options" />
304
+ // React: <Cli options={options} />
305
+ // Vue: <Cli :options="options" />
306
+ ```
307
+
308
+ ### SSE Streaming Execution
309
+
310
+ The frontend automatically uses SSE streaming when the server supports it, with transparent fallback to the legacy POST endpoint. Streaming processors emit output chunks as they execute rather than buffering the full response.
311
+
312
+ ### Resilience
313
+
314
+ The frontend includes built-in resilience features:
315
+
316
+ - **WebSocket auto-reconnect** with exponential backoff (up to 5 attempts, max 30s delay)
317
+ - **Periodic health checks** for disconnected servers (30s interval)
318
+ - **HTTP retry** on transient fetch failures (1 retry with 1s delay)
319
+ - **Configurable request timeout** per server (default 30s)
320
+
321
+ ### MCP
322
+
323
+ Each server can expose the whole system to AI clients such as Claude Code over the [Model Context Protocol](https://modelcontextprotocol.io) at `POST /api/qcli/mcp` (opt-in): CLI commands, the filesystem API, the data explorer, jobs and plugin-contributed tools, each with the caller's permissions. It works with or without the users plugin, whose `token create` command issues the API tokens MCP clients sign in with:
324
+
325
+ ```bash
326
+ # direct HTTP
327
+ claude mcp add --transport http qcli http://localhost:8047/api/qcli/mcp --header "Authorization: Bearer <token>"
328
+ # or the local stdio proxy @qodalis/mcp-cli (token or user/password, read-only mode, tool filters)
329
+ claude mcp add qcli -e QCLI_URL=http://localhost:8047 -e QCLI_TOKEN=<token> -- npx -y @qodalis/mcp-cli
330
+ ```
331
+
332
+ See [MCP endpoint](https://cli.qodalis.com/docs/server-integration#mcp-endpoint) for enabling it, the tools and permissions, and client setup.
333
+
334
+ ### Server Plugins
335
+
336
+ | Plugin | Servers | Description |
337
+ |--------|---------|-------------|
338
+ | **Background Jobs** | .NET, Node.js, Python | Scheduled and recurring job execution with cron/interval support |
339
+ | **Admin Dashboard** | .NET, Node.js | React-based web UI for server management — commands, jobs, plugins, logs, filesystem, events, and an embedded terminal |
340
+ | **AWS Cloud** | .NET, Python | S3, EC2, Lambda, DynamoDB, IAM, ECS, SQS, SNS, CloudWatch with multi-profile credential management |
341
+ | **Data Explorer** | .NET, Node.js, Python | SQL, MongoDB, Redis, Elasticsearch, and custom data source providers |
342
+
343
+ ### Docker
344
+
345
+ Run all three servers with Docker Compose from the [workspace root](https://github.com/qodalis-solutions/cli-workspace):
346
+
347
+ ```bash
348
+ docker compose up --build
349
+ ```
350
+
227
351
  ## Creating a CLI Plugin
228
352
 
229
353
  ### Quick Start
@@ -267,7 +391,7 @@ The tool auto-detects whether you're inside the `web-cli` monorepo:
267
391
  In monorepo mode, the tool also:
268
392
  - Creates `project.json` (Nx build + test targets)
269
393
  - Creates `tsconfig.spec.json` (Karma/Jasmine test config)
270
- - Updates `tsconfig.base.json` with the path alias `@qodalis/cli-<name>` → `dist/<name>`
394
+ - Updates `tsconfig.base.json` with the path alias `@qodalis/cli-<name>` -> `dist/<name>`
271
395
 
272
396
  ### Generated Project Structure
273
397
 
@@ -533,6 +657,81 @@ import { weatherModule } from '@qodalis/cli-weather';
533
657
  </template>
534
658
  ```
535
659
 
660
+ ## Data Explorer
661
+
662
+ The `@qodalis/cli-data-explorer` plugin adds an interactive, full-screen REPL for querying data sources (SQL, MongoDB, Redis, Elasticsearch, and custom providers) directly from the terminal.
663
+
664
+ ### Setup
665
+
666
+ Install and register the plugin, then configure backend servers:
667
+
668
+ ```typescript
669
+ import { dataExplorerModule } from '@qodalis/cli-data-explorer';
670
+
671
+ // Add to your modules array
672
+ const modules = [dataExplorerModule, /* ... other modules */];
673
+
674
+ // Configure at least one server with data explorer providers
675
+ const options: CliOptions = {
676
+ servers: [
677
+ { name: 'node', url: 'http://localhost:8047' },
678
+ { name: 'dotnet', url: 'http://localhost:8046' },
679
+ { name: 'python', url: 'http://localhost:8048' },
680
+ ],
681
+ };
682
+ ```
683
+
684
+ Or install at runtime without a rebuild:
685
+
686
+ ```bash
687
+ pkg add data-explorer
688
+ ```
689
+
690
+ ### Usage
691
+
692
+ ```bash
693
+ data-explorer
694
+ ```
695
+
696
+ Select a server and data source, then enter the full-screen REPL:
697
+
698
+ ```
699
+ data-explorer> SELECT * FROM users WHERE active = true;
700
+
701
+ 3 rows (12ms)
702
+ ┌────┬───────┬──────────────┐
703
+ │ id │ name │ email │
704
+ ├────┼───────┼──────────────┤
705
+ │ 1 │ Alice │ alice@ex.com │
706
+ │ 2 │ Bob │ bob@ex.com │
707
+ │ 3 │ Carol │ carol@ex.com │
708
+ └────┴───────┴──────────────┘
709
+
710
+ data-explorer> \format json
711
+ Output format set to: json
712
+
713
+ data-explorer> db.users.find({"age": {"$gt": 25}})
714
+ [
715
+ { "_id": "abc", "name": "Alice", "age": 30 },
716
+ { "_id": "def", "name": "Bob", "age": 28 }
717
+ ]
718
+ ```
719
+
720
+ ### REPL Commands
721
+
722
+ | Command | Description |
723
+ |---------|-------------|
724
+ | `\format <table\|json\|csv\|raw>` | Switch output format |
725
+ | `\schema` | Show database schema (tables, columns, types) |
726
+ | `\templates` | List available query templates |
727
+ | `\use <name>` | Load a template query |
728
+ | `\history` | Show query history |
729
+ | `\clear` | Clear screen |
730
+ | `\help` | Show all commands |
731
+ | `\quit` / `\q` | Exit |
732
+
733
+ Use **Up/Down arrows** for history navigation, **Escape** or **Ctrl+C** to exit.
734
+
536
735
  ## Extending with Inline Commands
537
736
 
538
737
  For quick one-off commands without creating a full plugin, implement `ICliCommandProcessor` directly in your app:
@@ -559,7 +758,7 @@ export class GreetCommandProcessor implements ICliCommandProcessor {
559
758
  }
560
759
  ```
561
760
 
562
- Register it with your framework (Angular: `resolveCommandProcessorProvider(GreetCommandProcessor)`, React/Vue: pass via `processors` prop), or wrap it in an inline `ICliModule`:
761
+ Wrap it in an `ICliModule` and register the module with your framework (Angular: `resolveCliModuleProvider(myModule)`, React/Vue: the `modules` prop, vanilla: `engine.registerModule(myModule)`):
563
762
 
564
763
  ```typescript
565
764
  const myModule: ICliModule = {
@@ -582,26 +781,35 @@ For advanced use cases or non-framework environments, use `CliEngine` directly:
582
781
  import { CliEngine } from '@qodalis/cli';
583
782
 
584
783
  const engine = new CliEngine(document.getElementById('terminal')!, {
585
- welcomeMessage: { message: 'Welcome!', show: 'always' },
784
+ welcome: { message: 'Welcome!', show: 'always' },
586
785
  });
587
786
 
588
- engine.registerProcessors([new GreetCommandProcessor()]);
787
+ engine.registerModule({
788
+ apiVersion: 2,
789
+ name: 'my-app-commands',
790
+ processors: [new GreetCommandProcessor()],
791
+ });
589
792
  await engine.start();
590
793
  ```
591
794
 
592
795
  ## Features
593
796
 
594
797
  - **Multi-framework** — Angular, React, Vue, or vanilla JS
798
+ - **38 official plugins** — 24 utility, 6 games, 10 language packs
595
799
  - **Command chaining** with `&&`, `||`, `|`, and `>>` operators
596
- - **Command history** with arrow key navigation
597
- - **Tab-like completions** and keyboard shortcuts (`Ctrl+C`, `Ctrl+L`, `Escape`)
598
- - **Theming** with built-in themes and custom color support
800
+ - **Command history** with arrow key navigation, per user when the users plugin is used (like `~/.bash_history`)
801
+ - **Tab-like completions** and readline keyboard shortcuts (`Ctrl+C`, `Ctrl+L`, `Escape`, `Ctrl+A/E`, `Ctrl+U/K/W/Y`, Home/End; `hotkeys` lists them)
802
+ - **29 built-in themes** with custom color support
803
+ - **Tabs & split panes** — multiple terminals in tabs with horizontal splitting
599
804
  - **User sessions** with multi-user support
600
805
  - **State persistence** across sessions
601
806
  - **Interactive prompts** with live preview (select menus with real-time feedback)
602
- - **Full-screen mode API** for rich TUI commands
807
+ - **Full-screen mode API** for rich TUI commands (games, editors, pagers)
603
808
  - **Progress bars, spinners, and text animations**
604
809
  - **Runtime package installation** from npm
810
+ - **Server integration** with SSE streaming, auto-reconnect, and health checks
811
+ - **Admin dashboard** for server management (React SPA)
812
+ - **Data explorer** for SQL, MongoDB, Redis, and Elasticsearch
605
813
 
606
814
  ## Contributing
607
815
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli-core",
3
- "version": "2.0.0-beta.9",
3
+ "version": "2.0.0-rc.1",
4
4
  "description": "Core interfaces, types, and utilities for the @qodalis CLI ecosystem.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  }
30
30
  },
31
31
  "dependencies": {
32
- "@xterm/xterm": "^5.5.0"
32
+ "@xterm/xterm": "^6.0.0"
33
33
  },
34
34
  "sideEffects": false
35
35
  }