@qodalis/mcp-cli 0.2.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -4,6 +4,24 @@ All notable changes to this project are documented here. The format follows
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses
5
5
  [Semantic Versioning](https://semver.org/).
6
6
 
7
+ ## [0.2.2] - 2026-11-05
8
+
9
+ ### Changed
10
+
11
+ - Bundled plugin guide (`docs/llms-full.txt`) refreshed for the servers' 1.0.0-beta.15: inside a
12
+ job (run properties, discard, a service scope per run in .NET), stable job ids, run on start,
13
+ executions across jobs and pruning; the audit log (target, properties, actor and offset
14
+ filters, the .NET EF Core store); the installed plugins list. For all three servers.
15
+
16
+ ## [0.2.1] - 2026-11-05
17
+
18
+ ### Changed
19
+
20
+ - Bundled plugin guide (`docs/llms-full.txt`) refreshed from web-cli 2.1.0: the CLI's
21
+ `branding` option (name and icon), .NET jobs that run elsewhere (`ICliJobManager`,
22
+ `SetJobManager`), the admin dashboard's name and icon on all three servers, and the
23
+ opt-in filesystem API.
24
+
7
25
  ## [0.2.0] - 2026-10-27
8
26
 
9
27
  ### Added
@@ -1,6 +1,6 @@
1
1
  # Qodalis CLI plugin development
2
2
 
3
- > Reference for writing Qodalis CLI plugins: browser (web) plugins that run in the terminal UI, and server plugins for the Node.js, .NET and Python CLI servers. Every topic is self-contained. Version 2.0 (web packages `2.0.0-rc.1`). Source: https://github.com/qodalis-solutions/web-cli. Docs: https://cli.qodalis.com.
3
+ > Reference for writing Qodalis CLI plugins: browser (web) plugins that run in the terminal UI, and server plugins for the Node.js, .NET and Python CLI servers. Every topic is self-contained. Version 2.0. Source: https://github.com/qodalis-solutions/web-cli. Docs: https://cli.qodalis.com.
4
4
 
5
5
  ## Overview
6
6
 
@@ -31,6 +31,18 @@ The npm, NuGet and PyPI packages a plugin author uses, by role.
31
31
  | `qodalis-cli-server-abstractions` (PyPI, import `qodalis_cli_server_abstractions`) | Python server plugin API. Server: `qodalis-cli-server` (import `qodalis_cli`). |
32
32
  | `@qodalis/mcp-cli` | MCP server for AI assistants: docs search, API lookup, plugin scaffolding, and (with `QCLI_URL`) driving a CLI server. |
33
33
 
34
+ ### Shipping the CLI under your own name
35
+
36
+ `CliOptions.branding` sets the name and icon an application ships the CLI under. Anything left out keeps Qodalis CLI's.
37
+
38
+ ```tsx
39
+ <CliPanel options={{ branding: { name: 'RateBell CLI', icon: '/favicon.svg' }, servers: [...] }} />
40
+ ```
41
+
42
+ - `name` replaces "Web CLI" and the Qodalis CLI art in the welcome banner and the startup log, and "CLI" in the panel's header and hide tab (React, Vue, Angular).
43
+ - `icon` (an image URL: http(s), a path, or a `data:image` URL) replaces the panel's terminal glyph.
44
+ - The copyright line, the documentation link and `version` stay Qodalis CLI's; `version` adds the name as an `App` row.
45
+
34
46
  ## Web plugins
35
47
 
36
48
  ### Scaffolding a web plugin with create-cli-plugin
@@ -154,6 +166,7 @@ All members:
154
166
  | `onData?(data, context)` | `Promise<void>` | Raw terminal input while this processor is the context processor (full-screen apps). |
155
167
  | `onResize?(cols, rows, context)` | `void` | Terminal resized while in full-screen mode. |
156
168
  | `onDispose?(context)` | `void` | Full-screen mode ended, terminal disconnected or component destroyed. |
169
+ | `controls?` | `ICliCommandControls` | Keys a full-screen command reads, so touch hosts can show them as buttons (see below). |
157
170
 
158
171
  Execution order for one command: parse -> find processor -> global parameter handlers (`--help`, ...) -> extract `value`/`positionals` -> command guards -> `valueRequired` check -> required-parameter and `validator` checks -> `validateBeforeExecution` -> `before` hooks -> `processCommand` -> `after` hooks.
159
172
 
@@ -621,6 +634,32 @@ export class CliClockCommandProcessor implements ICliCommandProcessor {
621
634
  - `onData` receives raw sequences: arrows `\x1b[A`/`\x1b[B`/`\x1b[C`/`\x1b[D`, Enter `\r`, Backspace `\x7f`, Escape `\x1b`, Ctrl+C `\x03` (passed through in full-screen mode).
622
635
  - Pass `{ showCursor: true }` for REPL-style UIs.
623
636
 
637
+ ### Touch keys for full-screen commands (controls)
638
+
639
+ A full-screen command lists the keys it reads in `controls`, so phones (which have no Ctrl, Esc or arrow keys) can show them as buttons.
640
+
641
+ Hosts on touch screens (the Qodalis CLI phone app) show them as buttons while the command runs and send each key's `data` to `onData`; help screens can list them.
642
+
643
+ ```typescript
644
+ import { CliKeyData, ICliCommandControls } from '@qodalis/cli-core';
645
+
646
+ controls: ICliCommandControls = {
647
+ keys: [
648
+ { label: 'ESC', key: 'Esc', data: CliKeyData.escape, description: 'Quit' },
649
+ { label: 'PAUSE', key: 'Space', data: CliKeyData.space, description: 'Pause' },
650
+ { label: '←', key: 'Left', data: CliKeyData.left, description: 'Left', repeat: true },
651
+ { label: 'SAVE', key: 'Ctrl+S', data: CliKeyData.ctrl('s'), description: 'Save' },
652
+ ],
653
+ swipe: true, // swipes on the screen send arrows (games on a board)
654
+ tap: CliKeyData.space, // a tap sends this key's data
655
+ // textInput: true, // the command also reads typed text (editors): keep the keyboard open
656
+ };
657
+ ```
658
+
659
+ - `data` is what a terminal sends for the key (`CliKeyData` has the arrows, Home/End, PgUp/PgDn, Esc, Enter, Backspace and `ctrl(letter)`); a letter key is just the letter (`'f'`).
660
+ - List the most used keys first; `repeat: true` repeats a held key.
661
+ - Without `textInput`, touch hosts close the on-screen keyboard so the command gets the screen (a hardware keyboard keeps working).
662
+
624
663
  ### Extending an existing command
625
664
 
626
665
  Set `extendsProcessor = true` to wrap a processor registered with the same `command` and delegate to `originalProcessor`.
@@ -801,6 +840,34 @@ A server plugin registers command processors in a Qodalis CLI server (Node, .NET
801
840
  - Exceptions thrown by a processor become exit code 1 with `Error executing command: <message>` (style `error`). Unknown commands return `Unknown command: <name>`.
802
841
  - Servers: Node `@qodalis/cli-server-node` (default port 8047 in the demos), .NET `Qodalis.Cli` (8046), Python `qodalis-cli-server` (8048).
803
842
 
843
+ ### Paging list output (all servers)
844
+
845
+ A command that can return many rows must page them: a terminal should never receive thousands of rows.
846
+
847
+ - Declare the parameters: `--skip` (default 0) and `--take` (default 50, at most 500). Node `CliPaging.parameters()`, .NET `CliPaging.Parameters()` (`Qodalis.Cli.Abstractions.Helpers`), Python `CliPaging.parameters()`.
848
+ - Read the request: Node `CliPaging.from(command)`, .NET `CliPaging.From(command)`, Python `CliPaging.from_command(command)`. It gives `skip` and `take` for the query; missing or invalid values fall back to the defaults.
849
+ - Query those rows (and the total when it is cheap) and write it with the paged table writer: Node `writePagedTable(headers, rows, page, { total, hasMore })`, .NET `WritePagedTable(headers, rows, page, total, hasMore)`, Python `write_paged_table(headers, rows, page, total=None, has_more=None)`. Without a total, pass `hasMore` (query `take + 1` rows to find out).
850
+ - On the wire the table carries `page: { skip, take, total?, hasMore }`. The web terminal prints `Rows 51–100 of 1987 · next: <command> --skip 100` under it; MCP text output adds `(rows 51-100 of 1987; next: skip=100)`.
851
+ - Safety net: a table without a page that has more than the server's `maxTableRows` / `MaxTableRows` / `max_table_rows` rows (default 200, 0 = no limit) is cut to that many and marked `page.truncated`; the terminal says the command does not page. Do not rely on it: page instead.
852
+
853
+ .NET example:
854
+
855
+ ```csharp
856
+ public override IEnumerable<ICliCommandParameterDescriptor>? Parameters { get; set; } = CliPaging.Parameters();
857
+
858
+ public async Task<ICliStructuredResponse?> HandleStructuredAsync(CliProcessCommand command, CancellationToken cancellationToken = default)
859
+ {
860
+ var page = CliPaging.From(command);
861
+ var total = await db.Orders.CountAsync(cancellationToken);
862
+ var rows = await db.Orders.OrderBy(o => o.Id).Skip(page.Skip).Take(page.Take)
863
+ .Select(o => new[] { o.Id.ToString(), o.Customer }).ToArrayAsync(cancellationToken);
864
+
865
+ var builder = new CliResponseBuilder();
866
+ builder.WritePagedTable(["Id", "Customer"], rows, page, total);
867
+ return builder.Build();
868
+ }
869
+ ```
870
+
804
871
  ### Node: minimal server processor
805
872
 
806
873
  A Node server command extends `CliCommandProcessor` from `@qodalis/cli-server-abstractions` and returns its output text from `handleAsync`.
@@ -942,8 +1009,8 @@ export class CliUsersCommandProcessor extends CliCommandProcessor implements ICl
942
1009
  }
943
1010
  ```
944
1011
 
945
- - `CliStructuredOutput` = `text` (`value`, `style?`) | `table` (`headers`, `rows`) | `list` (`items`, `ordered?`) | `json` (`value`) | `key-value` (`entries`). Import these types from `@qodalis/cli-server-abstractions` (the server package re-exports them as `CliServerOutput` / `CliServerResponse`).
946
- - `CliResponseBuilder` (from `@qodalis/cli-server-node`): `writeText(text, style?)`, `writeTable(headers, rows)`, `writeList(items, ordered?)`, `writeJson(value)`, `writeKeyValue(record)`, `setExitCode(code)`, `build()`.
1012
+ - `CliStructuredOutput` = `text` (`value`, `style?`) | `table` (`headers`, `rows`, `page?`) | `list` (`items`, `ordered?`) | `json` (`value`) | `key-value` (`entries`). Import these types from `@qodalis/cli-server-abstractions` (the server package re-exports them as `CliServerOutput` / `CliServerResponse`).
1013
+ - `CliResponseBuilder` (from `@qodalis/cli-server-node`): `writeText(text, style?)`, `writeTable(headers, rows)`, `writePagedTable(headers, rows, page, { total?, hasMore? })`, `writeList(items, ordered?)`, `writeJson(value)`, `writeKeyValue(record)`, `setExitCode(code)`, `build()`.
947
1014
  - `/execute/stream` prefers `handleStreamAsync`, then `handleStructuredAsync` (each output emitted), then `handleAsync`.
948
1015
 
949
1016
  ### Node: permissions and MCP tools
@@ -1163,8 +1230,8 @@ public class CliUsersCommandProcessor : CliCommandProcessor, ICliStreamCommandPr
1163
1230
  }
1164
1231
  ```
1165
1232
 
1166
- - `ICliResponseBuilder`: `WriteText(text, style?)`, `WriteTable(headers, rows)`, `WriteList(items, ordered = false)`, `WriteJson(value)`, `WriteKeyValue(dictionary)`, `SetExitCode(code)`, `Build()` -> `CliServerResponse { ExitCode, Outputs }`.
1167
- - Output classes (`Qodalis.Cli.Models`): `TextOutput { Value, Style }`, `TableOutput { Headers, Rows }`, `ListOutput { Items, Ordered }`, `JsonOutput { Value }`, `KeyValueOutput { Entries: KeyValueEntry[] }`.
1233
+ - `ICliResponseBuilder`: `WriteText(text, style?)`, `WriteTable(headers, rows)`, `WritePagedTable(headers, rows, page, total?, hasMore?)`, `WriteList(items, ordered = false)`, `WriteJson(value)`, `WriteKeyValue(dictionary)`, `SetExitCode(code)`, `Build()` -> `CliServerResponse { ExitCode, Outputs }`.
1234
+ - Output classes (`Qodalis.Cli.Models`): `TextOutput { Value, Style }`, `TableOutput { Headers, Rows, Page? }`, `ListOutput { Items, Ordered }`, `JsonOutput { Value }`, `KeyValueOutput { Entries: KeyValueEntry[] }`.
1168
1235
  - The executor uses the structured result only if it is a `CliServerResponse`; an empty `HandleAsync` string produces no output.
1169
1236
 
1170
1237
  ### .NET: permissions and MCP tools
@@ -1433,7 +1500,7 @@ class CliUsersCommandProcessor(CliCommandProcessor, ICliStreamCommandProcessor):
1433
1500
 
1434
1501
  - Keep the `cancellation_event` parameter in every override: the executor always passes two arguments.
1435
1502
  - Return `self._STRUCTURED_NOT_IMPLEMENTED` from `handle_structured_async` to fall back to `handle_async`.
1436
- - `CliResponseBuilder`: `write_text(text, style=None)`, `write_table(headers, rows)`, `write_list(items, ordered=False)`, `write_json(value)`, `write_key_value(dict)`, `set_exit_code(code)`, `build()` -> `CliServerResponse`. Output models (`qodalis_cli.models`): `CliServerTextOutput`, `CliServerTableOutput`, `CliServerListOutput`, `CliServerJsonOutput`, `CliServerKeyValueOutput`.
1503
+ - `CliResponseBuilder`: `write_text(text, style=None)`, `write_table(headers, rows)`, `write_paged_table(headers, rows, page, total=None, has_more=None)`, `write_list(items, ordered=False)`, `write_json(value)`, `write_key_value(dict)`, `set_exit_code(code)`, `build()` -> `CliServerResponse`. Output models (`qodalis_cli.models`): `CliServerTextOutput`, `CliServerTableOutput`, `CliServerListOutput`, `CliServerJsonOutput`, `CliServerKeyValueOutput`.
1437
1504
 
1438
1505
  ### Python: permissions and MCP tools
1439
1506
 
@@ -1496,6 +1563,69 @@ async def test_greet_executor():
1496
1563
 
1497
1564
  - HTTP tests: `from fastapi.testclient import TestClient`; `with TestClient(create_cli_server(CliServerOptions(configure=...)).app) as client: client.post("/api/v1/qcli/execute", json={...})`.
1498
1565
 
1566
+ ### .NET: jobs that run elsewhere
1567
+
1568
+ The jobs API (`/api/v1/qcli/jobs`), the `jobs_*` MCP tools, `server jobs` and the dashboard's jobs page work on an `ICliJobManager` (`Qodalis.Cli.Abstractions.Jobs`). The default runs the jobs registered with `AddJob` in the server's process; a host whose jobs run elsewhere implements the interface and registers it with `cli.SetJobManager<T>()` (scoped).
1569
+
1570
+ - Implement `GetJobsAsync` (each `CliJobInfo` with `Id`, `Name`, `Status`, `LastRunAt`, `LastRunStatus` and `Actions`, such as `["trigger", "pause", "resume"]`), `TriggerAsync`, `PauseAsync`, `ResumeAsync`, `GetExecutionsAsync` and `GetExecutionAsync`.
1571
+ - `StopAsync`, `CancelAsync` and `UpdateAsync` default to `NotSupportedException` (HTTP `501`, `NOT_SUPPORTED`); the dashboard shows only the actions in `Actions`.
1572
+ - Throw `KeyNotFoundException` for an unknown job (`404`) and `InvalidOperationException` when the job's state refuses the action (`409`).
1573
+
1574
+ ### Jobs: inside a job (all servers)
1575
+
1576
+ A job's execution context gives each run its log lines, `properties` (the run's own values, saved with the execution and returned by the API as `properties`, e.g. `items=32`) and `discard()` (leaves a completed run that found nothing to do out of the history; failed runs are always kept).
1577
+
1578
+ - .NET: `context.Properties["synced"] = 12`, `context.Discard()`, and `context.Services`, a DI scope created for the run (for a `DbContext`).
1579
+ - Node: `context.properties.synced = 12`, `context.discard()`.
1580
+ - Python: `context.properties["synced"] = 12`, `context.discard()`.
1581
+ - Job ids are stable: the `id` option (`Id`, `id`), or the job's name (`-2`, `-3`, ... for duplicate names). The API, the history and a saved pause use the id, so keep it the same across releases. Ids may not contain `/`, `\`, `?` or `#`.
1582
+ - A saved pause or stop survives a restart; disabling a job in code (`Enabled = false`, `enabled: false`, `enabled=False`) always keeps it stopped.
1583
+ - `RunOnStart` / `runOnStart` / `run_on_start` runs a job when the server starts; an interval job keeps its rhythm across restarts (the next run is the last run plus the interval).
1584
+ - Run a job from the host's own code through the scheduler interface: `ICliJobScheduler.TriggerAsync(id)` (.NET, resolve the interface), `scheduler.triggerAsync(id)` (Node), `await scheduler.trigger(id)` (Python).
1585
+ - `GET /api/v1/qcli/jobs/executions?job=a,b&group=&status=&since=&limit=&offset=` lists the runs of several jobs (or every job), newest first. Job storage can delete old runs: `PruneAsync(before)` (.NET), `prune(before)` (Node, Python).
1586
+
1587
+ ```csharp
1588
+ public class SyncOrdersJob : ICliJob
1589
+ {
1590
+ public async Task ExecuteAsync(ICliJobExecutionContext context, CancellationToken cancellationToken)
1591
+ {
1592
+ var synced = await context.Services.GetRequiredService<IOrderSync>().SyncAsync(cancellationToken);
1593
+ if (synced == 0) { context.Discard(); return; }
1594
+ context.Properties["synced"] = synced;
1595
+ }
1596
+ }
1597
+
1598
+ builder.Services.AddControllers().AddCli(cli => cli
1599
+ .AddJob(new SyncOrdersJob(), o => { o.Id = "sync-orders"; o.Interval = TimeSpan.FromMinutes(5); o.RunOnStart = true; })
1600
+ // history and state in your database (Qodalis.Cli.Plugin.Jobs.EfCore)
1601
+ .AddEfCoreJobStorage(o => o.UseNpgsql(connectionString)));
1602
+ ```
1603
+
1604
+ - .NET only: `AddEfCoreJobStorage` keeps the history in any EF Core database and creates its tables (`job_executions`, `job_states`) even in a database that already has others; call `modelBuilder.ApplyJobStorageModel()` to keep them in your own migrations. Database stores return `properties` values as JSON values.
1605
+
1606
+ ### Audit log (all servers)
1607
+
1608
+ The users plugin records sign-ins, token and group changes in its audit log, read with `audit:read` from `GET /api/v1/qcli/audit?event=&username=&actor=&limit=&offset=` (newest 100 without a `limit`, at most 1000), by the console's `audit` and by the dashboard's Audit page.
1609
+
1610
+ - An entry has `event`, `actor`, `username` (the user it is about), `target` (what else it is about, e.g. `group:admins`), `metadata` and `properties` (the host's own values).
1611
+ - A host writes its own entries to the same log: `IAuditStore.LogAsync` (.NET), `auditStore.log(...)` (Node), `await audit_store.log(...)` (Python).
1612
+ - Old entries: `PruneAsync(before)` (.NET), `prune(before)` (Node; Python takes Unix milliseconds).
1613
+ - .NET only: `cli.AddEfCoreAuditStore(o => o.UseNpgsql(connectionString))` (`Qodalis.Cli.Plugin.Users.EfCore`) keeps the log in a database (table `audit_entries`; `modelBuilder.ApplyAuditStorageModel()` for your own migrations). It keeps every entry, failed sign-ins included: prune it from a daily job.
1614
+
1615
+ ### Installed plugins (all servers)
1616
+
1617
+ `GET /api/v1/qcli/plugins/installed` (admin plugin) lists the server plugins the host installed (users, admin, jobs, storage providers, ...) with their package id, version and description; the dashboard's Plugins page shows them above the command modules. The built-in plugins list themselves; a plugin of your own registers with `cli.AddInstalledPlugin(assembly)` (.NET), `builder.addInstalledPlugin(...)` (Node) or `builder.add_installed_plugin(...)` (Python).
1618
+
1619
+ ### Admin dashboard: name and icon (all servers)
1620
+
1621
+ The dashboard is "Qodalis Cli Admin" with the Qodalis Solutions logo unless the admin plugin sets its branding: the name and icon (browser tab, sidebar, sign-in page) and the terminal's name in its welcome banner.
1622
+
1623
+ - .NET: `cli.AddAdmin(o => { o.Branding.Name = "RateBell"; o.Branding.IconUrl = "/favicon.svg"; o.Branding.CliName = "RateBell CLI"; })`
1624
+ - Node: `new CliAdminBuilder().setBranding({ name: 'RateBell', iconUrl: '/favicon.svg', cliName: 'RateBell CLI' })`
1625
+ - Python: `CliAdminBuilder().set_branding({"name": "RateBell", "icon_url": "/favicon.svg", "cli_name": "RateBell CLI"})`
1626
+ - The icon is an absolute http(s) URL, a root-relative path or a base64 `data:image` URL; invalid values fail at startup. The values are served as `branding` in `/qcli/admin/theme.json`.
1627
+ - The filesystem API (`/api/qcli/fs/*`) and the dashboard's Files page exist only when the server enables the filesystem (`AddFileSystem()` in .NET); otherwise the routes answer `404`.
1628
+
1499
1629
  ## Recipes
1500
1630
 
1501
1631
  ### Recipe: a complete web plugin end to end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/mcp-cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Model Context Protocol (MCP) server for Qodalis CLI: plugin-development tools (docs search, API declarations, scaffolding) for AI assistants, and a resilient stdio proxy to a Qodalis CLI server's commands, files, data explorer and jobs.",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",