@qodalis/mcp-cli 0.2.5 → 0.2.6
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 +10 -0
- package/README.md +1 -1
- package/docs/llms-full.txt +365 -14
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@ 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.6] - 2026-12-03
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- Bundled plugin guide (`docs/llms-full.txt`) refreshed for web-cli 2.10.0 and the servers' 1.0.0-beta.36: plugin
|
|
12
|
+
dependencies (`requires`, `optional`, `requiresCapability`, `provides`, the `needs-dependencies` status,
|
|
13
|
+
`admin plugins deps`) and the Qodalis Console names (`@qodalis/console`, `@qodalis/console-kit`,
|
|
14
|
+
`addConsoleExtension`, `console:install`, `admin console ...`; the dashboard names keep working as deprecated aliases).
|
|
15
|
+
- README links the Console's repository under its new name, `qodalis-console`.
|
|
16
|
+
|
|
7
17
|
## [0.2.5] - 2026-11-06
|
|
8
18
|
|
|
9
19
|
### Changed
|
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ Qodalis CLI server through a resilient proxy.
|
|
|
22
22
|
| --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- |
|
|
23
23
|
| [web-cli](https://github.com/qodalis-solutions/web-cli) | The browser terminal (Angular, React, Vue) and its plugins, including `token create` for API tokens |
|
|
24
24
|
| [cli-server-node](https://github.com/qodalis-solutions/cli-server-node), [cli-server-dotnet](https://github.com/qodalis-solutions/cli-server-dotnet), [cli-server-python](https://github.com/qodalis-solutions/cli-server-python) | The servers that host the MCP endpoint |
|
|
25
|
-
| [
|
|
25
|
+
| [qodalis-console](https://github.com/qodalis-solutions/qodalis-console) | Qodalis Console, the admin UI served by the servers |
|
|
26
26
|
| [pwa-cli](https://github.com/qodalis-solutions/pwa-cli) | The CLI as a PWA and Android app |
|
|
27
27
|
| **mcp-cli** | This repository: the bridge from Claude Code to a server |
|
|
28
28
|
|
package/docs/llms-full.txt
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
A Qodalis CLI command is either a web plugin running in the browser or a server plugin running in a CLI server; the user types both in the same terminal.
|
|
10
10
|
|
|
11
|
-
- **Web plugin**: a TypeScript package exporting an `ICliModule` (from `@qodalis/cli-core`) whose `processors` implement `ICliCommandProcessor`. It runs in the page, writes to the xterm.js terminal through `context.writer`, can prompt (`context.reader`), keep state, call HTTP APIs, go full screen, run background services. Use it for anything that can run in the browser: tools, formatters, games, UIs over a REST API, interactive prompts.
|
|
11
|
+
- **Web plugin**: a TypeScript package exporting an `ICliModule` (from `@qodalis/cli-core`) whose `processors` implement `ICliCommandProcessor`. It runs in the page, writes to the xterm.js terminal through `context.writer`, can prompt (`context.reader`), keep state, call HTTP APIs, go full screen, run background services. Use it for anything that can run in the browser: tools, formatters, games, UIs over a REST API, interactive prompts. A plugin does not have to live in web-cli: the six game plugins (`@qodalis/cli-2048`, `-minesweeper`, `-snake`, `-tetris`, `-wordle`, `-sudoku`) are built and published from their own repository, [qodalis-solutions/cli-games](https://github.com/qodalis-solutions/cli-games), with `@qodalis/cli-core` as a peer dependency; it is a complete example of an external plugin repository (tsup build, Jasmine/Karma tests, npm publish on push to `main`).
|
|
12
12
|
- **Server plugin**: a processor/module for a Qodalis CLI server (`@qodalis/cli-server-abstractions` for Node, `Qodalis.Cli.Abstractions` for .NET, `qodalis-cli-server-abstractions` for Python). It runs on the server, receives the parsed command over HTTP and returns text or structured output (`text`, `table`, `list`, `json`, `key-value`). Use it when the command needs server resources: the filesystem, databases, secrets, OS processes, private networks. Server commands are also exposed as MCP tools when the server enables MCP.
|
|
13
13
|
- The browser terminal discovers server commands at startup (`GET /api/v1/qcli/commands`) and registers a proxy for each one as `<server>:<command>` (e.g. `node:weather`) plus the bare name (`weather`) when no local command owns it.
|
|
14
14
|
- Rule of thumb: no secrets and no server-only resources -> web plugin; otherwise server plugin. Both can coexist (a web command can call a server through `context.http`).
|
|
@@ -43,6 +43,47 @@ The npm, NuGet and PyPI packages a plugin author uses, by role.
|
|
|
43
43
|
- `icon` (an image URL: http(s), a path, or a `data:image` URL) replaces the panel's terminal glyph.
|
|
44
44
|
- The copyright line, the documentation link and `version` stay Qodalis CLI's; `version` adds the name as an `App` row.
|
|
45
45
|
|
|
46
|
+
### Panel and terminal themes
|
|
47
|
+
|
|
48
|
+
`theme` (on `CliPanelOptions`, and on `CliOptions` for a plain `<Cli>`) sets the look of the panel and of every terminal in it:
|
|
49
|
+
|
|
50
|
+
| Value | Result |
|
|
51
|
+
|---|---|
|
|
52
|
+
| `'dark'` (default) | Built-in dark palette, terminal theme `default` |
|
|
53
|
+
| `'light'` | Built-in light palette, terminal theme `light` |
|
|
54
|
+
| `'auto'` | Light or dark, following the system's `prefers-color-scheme`, live |
|
|
55
|
+
| a terminal theme name (`'dracula'`, `'nord'`, `'solarizedLight'`, ... see `theme list`) | That terminal theme; the panel's colors are derived from it |
|
|
56
|
+
| a `CliPanelTheme` object | `base` (`'light'`/`'dark'`/`'auto'`), `terminal` (name or xterm colors), `colors` (any of `background`, `headerBackground`, `border`, `text`, `textSecondary`, `accent`, `hoverBackground`, `activeBackground`, `danger`, `shadow`), `fontFamily`, `radius` |
|
|
57
|
+
|
|
58
|
+
Pass the host's own setting through, and the panel follows when it changes (React re-render, Vue reactivity, a new `options` object in Angular, or `panelRef.setTheme(theme)`):
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
const { dark } = useAppSettings();
|
|
62
|
+
<CliPanel options={{
|
|
63
|
+
theme: {
|
|
64
|
+
base: dark ? 'dark' : 'light',
|
|
65
|
+
colors: { accent: dark ? '#4f9be0' : '#2a6bba', headerBackground: dark ? '#13212f' : '#ffffff' },
|
|
66
|
+
fontFamily: 'Onest Variable, sans-serif',
|
|
67
|
+
},
|
|
68
|
+
}} />
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
- The host's `theme` is the default. A theme the user applies with the `theme` command (`theme apply dracula`, `theme set`, `theme import`) wins over it, is saved, and restyles the panel too; `theme reset` returns to the host's theme, which follows the host again from then on. Without a host `theme`, the terminals keep the user's saved theme and the panel uses the dark palette (or, with `syncTheme: true`, colors derived from the terminal).
|
|
72
|
+
- **Theme picker**: the panel's header has a theme button (a Theme group in the ⋮ menu of a narrow panel) with Auto, Light, Dark, Custom and, under "More themes", the terminal themes. A pick restyles the panel and all its terminals, is remembered in `localStorage` and wins over the host's `theme` on the next load; the host's next `theme` change (or `setTheme()`) applies again and forgets it. **Custom** shows color pickers for background, text and accent (starting from the current look, kept for the next time). The picker and the `theme` command share the command's saved state: a terminal theme is saved as `theme apply <name>`, Custom as custom colors, Auto/Light/Dark clear it as `theme reset` does; `theme apply` checks that theme in the picker, `theme set` shows its colors under Custom, `theme reset` returns the panel to the host's theme. The panel reports a pick as `{ theme, scheme, colors? }`: `(themeChange)` in Angular, `onThemeChange` in React, `@theme-change` in Vue, `callbacks.onThemeChange` on `CliPanelController` (`controller.pickTheme(name, colors?)` and `setCustomThemeColor(key, '#rrggbb')` pick from code). The host's own theme changes do not fire it. `themePicker: false` hides the picker.
|
|
73
|
+
- **Send key** (phones): the panel's keyboard button (Send key in the ⋮ menu of a narrow panel) lists the keys phone keyboards lack: Ctrl+C, Ctrl+L, Ctrl+A/E/U/K/W/Y/D, Esc, Tab, Shift+Tab, ↑/↓ (history), and "Ctrl + key" (the next letter typed gets Ctrl; the button shows it). The keys of the full-screen command running (its `controls.keys`, e.g. nano's Save and Exit) come first. Keys are sent as real keydowns to the active terminal, which keeps the focus. `sendKeys: false` hides it. The same helpers are exported for hosts with their own key bars: `sendTerminalKey`, `sendTerminalKeyPress`, `CLI_SEND_KEYS`, `CLI_KEY_PRESSES`, `ctrlLetterPress`, `CliStickyModifier`, `applyStickyCtrlToKeyboard`.
|
|
74
|
+
- The dropdowns and the context menu use the theme too. Stylesheets can override the CSS variables (`--cli-panel-bg`, `--cli-panel-accent`, `--cli-panel-font`, `--cli-panel-radius`, ... listed at the top of `@qodalis/cli/assets/cli-panel.css`).
|
|
75
|
+
- `resolvePanelTheme(theme, prefersDark)` and `CliPanelPalettes` (from `@qodalis/cli-core`) give the resolved CSS variables and terminal theme, for hosts that style other parts of the page to match.
|
|
76
|
+
|
|
77
|
+
### Phones
|
|
78
|
+
|
|
79
|
+
The panel resizes with touch (pointer events on the grip, a bigger grip on touch screens), stays above the on-screen keyboard (it follows `visualViewport`, so the prompt stays visible while typing), is never taller than the visible area and stays below the status bar of apps that draw under it (`safe-area-inset-top`). On screens up to 600px wide the header keeps the title, the run state and the buttons on one line.
|
|
80
|
+
|
|
81
|
+
An app with its own bottom bar docks the panel above it with a CSS variable, never by overriding `bottom` (that would stop the panel from moving above the keyboard):
|
|
82
|
+
|
|
83
|
+
```css
|
|
84
|
+
:root { --cli-panel-bottom-offset: var(--tab-bar-height, 0px); }
|
|
85
|
+
```
|
|
86
|
+
|
|
46
87
|
## Web plugins
|
|
47
88
|
|
|
48
89
|
### Scaffolding a web plugin with create-cli-plugin
|
|
@@ -346,6 +387,7 @@ export const deployModule: ICliModule = {
|
|
|
346
387
|
| `executor: ICliCommandExecutorService` | `showHelp(command, context)`, `executeCommand(line, context)`. |
|
|
347
388
|
| `process: ICliExecutionProcess` | `exit(code?, { silent? })` ends the command (it throws to unwind unless `silent`), `output(data)` sets pipe data. |
|
|
348
389
|
| `signal?: AbortSignal` / `onAbort: Subject<void>` | Ctrl+C / kill; check for cooperative cancellation. |
|
|
390
|
+
| `interrupt?(): void` | What Ctrl+C does: aborts the running command, cancels a prompt, leaves a context. For a host's Stop button (no keyboard on a phone). |
|
|
349
391
|
| `backgroundServices: ICliBackgroundServiceRegistry` | Register/start daemons and jobs. |
|
|
350
392
|
| `events?: ICliEventBus` | Terminal event bus. |
|
|
351
393
|
| `logger: ICliLogger` | `log`, `info`, `warn`, `error`, `debug`. |
|
|
@@ -599,7 +641,7 @@ await context.backgroundServices.startJob('export', async (ctx) => {
|
|
|
599
641
|
|
|
600
642
|
### Full-screen mode and raw input
|
|
601
643
|
|
|
602
|
-
A processor can take over the terminal (games, editors, pagers) with `enterFullScreenMode`, receiving every keystroke in `onData`.
|
|
644
|
+
A processor can take over the terminal (games, editors, pagers) with `enterFullScreenMode`, receiving every keystroke in `onData`. The game plugins in [qodalis-solutions/cli-games](https://github.com/qodalis-solutions/cli-games) are complete examples.
|
|
603
645
|
|
|
604
646
|
```typescript
|
|
605
647
|
export class CliClockCommandProcessor implements ICliCommandProcessor {
|
|
@@ -759,6 +801,37 @@ bootCliModule(module);
|
|
|
759
801
|
- `bootCliModule(module)` registers the module with the running terminal's module registry; it does nothing outside a browser terminal.
|
|
760
802
|
- UMD bundles must not use Angular decorators; use plain classes.
|
|
761
803
|
|
|
804
|
+
### Publishing to the plugin marketplace
|
|
805
|
+
|
|
806
|
+
The marketplace (`https://plugins.qodalis.com/`, the built-in `pkg` source `qodalis` of kind `marketplace`) indexes plugins from npm, records each version's module API and the SHA-384 of its bundle, and lists a plugin after review. Plugins stay on npm; the marketplace hosts no code.
|
|
807
|
+
|
|
808
|
+
```json
|
|
809
|
+
{
|
|
810
|
+
"name": "@acme/cli-weather",
|
|
811
|
+
"keywords": ["qodalis-cli-plugin"],
|
|
812
|
+
"unpkg": "dist/umd/index.global.js",
|
|
813
|
+
"peerDependencies": { "@qodalis/cli-core": "^2.8.0" },
|
|
814
|
+
"qodalis": {
|
|
815
|
+
"apiVersion": 2,
|
|
816
|
+
"category": "tools",
|
|
817
|
+
"serverPackages": [{ "ecosystem": "npm", "name": "@acme/cli-server-plugin-weather" }]
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
```bash
|
|
823
|
+
npm publish --access public
|
|
824
|
+
pkg publish @acme/cli-weather # in a Qodalis terminal: queue it for indexing and review (does not publish to npm)
|
|
825
|
+
pkg search weather # once listed
|
|
826
|
+
pkg info weather # publisher, versions and which fit this CLI, server packages
|
|
827
|
+
pkg add weather # short names resolve through the marketplace
|
|
828
|
+
```
|
|
829
|
+
|
|
830
|
+
- The keyword `qodalis-cli-plugin` is how the indexer finds the package; `@qodalis/create-cli-plugin` writes it and the `qodalis` block.
|
|
831
|
+
- `qodalis.apiVersion` is the module API the bundle needs (falls back to the major of the `@qodalis/cli-core` peer range, then 2). The `@qodalis/cli-core` peer range decides which CLIs a version runs on: set it to the oldest core you built against (`^2.8.0`), never `*`. `category`: `tools`, `data`, `games`, `language`, `server` or `other`. `icon` / `screenshots` are package paths or URLs.
|
|
832
|
+
- `pkg add` installs the newest listed version whose API matches the CLI and whose core peer range accepts the running `@qodalis/cli-core`, refuses one that does not (`needs CLI 2.9.0 or newer`) or was flagged/unlisted (naming the newest that works), and refuses a bundle whose SHA-384 differs from the recorded one. The hash is saved (`Package.integrity`) and the bundle is loaded with the `integrity` attribute at every start.
|
|
833
|
+
- A package the marketplace does not list installs by full name with a warning, unless the host set `packageSources.marketplaceOnly: true`. `packageSources.marketplace` takes the base URL of any server implementing the marketplace HTTP API (public endpoints under `<base>api/v1/qcli/marketplace`: `GET /plugins`, `/plugins/{name}`, `/plugins/{name}/versions/{version}`, `/resolve?name=`, `/categories`, `/stats`, `POST /submissions`; documented on the Publishing a plugin page) or `false` (off). When the marketplace does not answer within 4 s, `pkg` prints `Marketplace unreachable, searching npm` and uses npm and the CDNs.
|
|
834
|
+
|
|
762
835
|
### Testing with CliTestHarness
|
|
763
836
|
|
|
764
837
|
`CliTestHarness` (from `@qodalis/cli`) runs commands through the real parser and executor without xterm or DOM, capturing output.
|
|
@@ -814,6 +887,7 @@ pnpm nx lint <name>
|
|
|
814
887
|
|
|
815
888
|
- Mark `@qodalis/cli-core` as external in the library build (the scaffolded `tsup.config.ts` does); the IIFE build bundles everything (`noExternal: [/.*/]`).
|
|
816
889
|
- `@qodalis/cli-core` is a dependency; standalone plugins pin `^<scaffolder version>` (all `@qodalis/*` web packages share one version).
|
|
890
|
+
- To be found by `pkg browse` / `pkg search`, keep the `qodalis-cli-plugin` keyword and submit the name with `pkg publish <name>` (see "Publishing to the plugin marketplace").
|
|
817
891
|
|
|
818
892
|
### Conventions for web plugins
|
|
819
893
|
|
|
@@ -839,6 +913,25 @@ A server plugin registers command processors in a Qodalis CLI server (Node, .NET
|
|
|
839
913
|
- In the browser, a server command that has sub-commands accepts only its sub-command words; a leaf command accepts positional text (`weather current Paris`).
|
|
840
914
|
- Exceptions thrown by a processor become exit code 1 with `Error executing command: <message>` (style `error`). Unknown commands return `Unknown command: <name>`.
|
|
841
915
|
- Servers: Node `@qodalis/cli-server-node` (default port 8047 in the demos), .NET `Qodalis.Cli` (8046), Python `qodalis-cli-server` (8048).
|
|
916
|
+
- Users can link servers themselves with `server add [name] [url]`: browser approval (`POST /api/v1/qcli/link`, the user approves at `/qcli/admin/link?code=…`, the terminal polls `GET /api/v1/qcli/link/{linkId}` and receives an API token), a pasted API token (`--token`), or a user and password (the terminal creates a token and signs out). Linked servers persist (IndexedDB), their tokens are encrypted (`ICliSecretStore`, Web Crypto by default) and redacted from the history. `server edit`, `server remove`, `server forget-all`. Hosts restrict it with `CliOptions.userServers` (`false` or `{ allowedOrigins }`). Server side: the users plugin's link routes, `setLinkApprovalUrl` (Node) / `LinkApprovalUrl` (.NET) / `link_approval_url` (Python) for a host's own approval page.
|
|
917
|
+
|
|
918
|
+
### Connecting a server from the Android app, the PWA or the docs site
|
|
919
|
+
|
|
920
|
+
A user links their own server to the Android app (`com.qodalis.cli`), the PWA or the docs terminal with `server add`; the server needs an https address and must allow the terminal's origin.
|
|
921
|
+
|
|
922
|
+
- The pages are served over https: the Android app from `https://localhost` (Capacitor WebView, `allowMixedContent: false`, no clear-text traffic), the PWA from `https://qodalis-solutions.github.io`, the docs from `https://cli.qodalis.com`. `server add` accepts `http://` for private addresses after a confirmation, but these pages block http requests and `ws://` sockets as mixed content, so a plain `http://192.168.x.x:8047` server fails with `Cannot reach … Failed to fetch`. `localhost` on a phone is the phone.
|
|
923
|
+
- Serve the server at an https address with a publicly trusted certificate, like any web application (self-signed certificates are rejected): behind the hosting platform's https, a reverse proxy or load balancer, or a VPN or tunnel service that issues certificates. The proxy must pass WebSocket upgrades through for the shell and events.
|
|
924
|
+
- Allow the origins (CORS and WebSocket upgrades): `https://localhost`, `https://qodalis-solutions.github.io`, `https://cli.qodalis.com`. Node `createCliServer({ allowedOrigins })` (demo and Docker image: `QCLI_ALLOWED_ORIGINS`, comma-separated, replaces the demo list); .NET `cli.SetAllowedOrigins(...)` (demo and image: `QCLI_ALLOWED_ORIGINS`, added to the demo list); Python `CliServerOptions(allowed_origins=[...])` (no environment variable).
|
|
925
|
+
- Run a server with the users and admin plugins (the demos and `ghcr.io/qodalis-solutions/cli-server-{node,dotnet,python}` images have both; demo user `root`, password `admin` for Node/Python, `root` for .NET) so browser approval works; then `server add https://…` and pick approve in the browser, paste a `token create` token, or user and password.
|
|
926
|
+
- On the phone the token is encrypted with a non-extractable Web Crypto key in IndexedDB unless the host provides `ICliSecretStore_TOKEN` (for example the Android Keystore). Troubleshooting: `server status <name>`, `server edit <name> --token` after an expired or revoked token, `server edit <name> --url`, `server remove <name>`, `server forget-all`.
|
|
927
|
+
|
|
928
|
+
```bash
|
|
929
|
+
docker run -p 8047:8047 \
|
|
930
|
+
-e QCLI_ALLOWED_ORIGINS=https://localhost,https://qodalis-solutions.github.io,https://cli.qodalis.com \
|
|
931
|
+
ghcr.io/qodalis-solutions/cli-server-node
|
|
932
|
+
# served at https://cli.example.com by your hosting or reverse proxy; then, in the app:
|
|
933
|
+
server add https://cli.example.com
|
|
934
|
+
```
|
|
842
935
|
|
|
843
936
|
### Paging list output (all servers)
|
|
844
937
|
|
|
@@ -868,6 +961,42 @@ public async Task<ICliStructuredResponse?> HandleStructuredAsync(CliProcessComma
|
|
|
868
961
|
}
|
|
869
962
|
```
|
|
870
963
|
|
|
964
|
+
### Help for server commands (all servers)
|
|
965
|
+
|
|
966
|
+
A server command can carry the same help as a web command: examples, longer documentation, aliases, its own module and icon, and the allowed values of a parameter. All are optional; the web terminal shows them with `help <command>` and older servers simply send none.
|
|
967
|
+
|
|
968
|
+
- Command members: Node `aliases`, `examples` (`{ command, description? }[]`), `documentation`, `module`, `icon`; .NET `Aliases`, `Examples` (`new CliCommandExample("cmd", "what it does")`), `Documentation`, `Module`, `Icon`; Python properties `aliases`, `examples` (`CliCommandExample("cmd", "what it does")`), `documentation`, `module`, `icon`.
|
|
969
|
+
- Parameter member: Node `allowedValues` (7th constructor argument of `CliCommandParameterDescriptor`), .NET `AllowedValues`, Python `allowed_values`. The terminal lists them in help, completes them with Tab (`--format ` and `--format=`) and refuses other values before sending (ignoring case); MCP tools list them as an `enum`.
|
|
970
|
+
- Parameter examples: Node `examples` (8th constructor argument), .NET `Examples`, Python `examples`: example values shown in help after the description (`e.g. Paris, New York`) and as `examples` in MCP tool schemas.
|
|
971
|
+
- `documentation` is plain text; separate paragraphs with a blank line. Examples are command lines as the user types them.
|
|
972
|
+
- Aliases work on root commands and sub-commands, on the server too (execution and permission checks). In the terminal `node:base64` also answers to `node:b64`, and the bare alias `b64` is registered unless a local command owns that name.
|
|
973
|
+
- `module` and `icon` place the command in `help`'s list (default: the server's group, `Server (node)`, and 🖥); help still says which server the command runs on.
|
|
974
|
+
- Wire format in `GET /api/v1/qcli/commands`: `aliases`, `examples`, `documentation`, `module`, `icon` on each command and `allowedValues` and `examples` on each parameter, left out when unset.
|
|
975
|
+
|
|
976
|
+
Node example:
|
|
977
|
+
|
|
978
|
+
```typescript
|
|
979
|
+
class ExportProcessor extends CliCommandProcessor {
|
|
980
|
+
command = 'export';
|
|
981
|
+
description = 'Exports the orders';
|
|
982
|
+
aliases = ['exp'];
|
|
983
|
+
module = 'orders';
|
|
984
|
+
icon = '📦';
|
|
985
|
+
documentation = 'Writes the orders of a day in the chosen format.\n\nLarge days are paged: see --skip and --take.';
|
|
986
|
+
examples = [
|
|
987
|
+
{ command: 'export --format csv', description: "Today's orders as CSV" },
|
|
988
|
+
{ command: 'export --day 2026-11-01 --format json', description: 'One day as JSON' },
|
|
989
|
+
];
|
|
990
|
+
parameters = [
|
|
991
|
+
new CliCommandParameterDescriptor('format', 'Output format', false, 'string', ['f'], 'csv', ['csv', 'json']),
|
|
992
|
+
new CliCommandParameterDescriptor('day', 'Day (YYYY-MM-DD), default today', false, 'string'),
|
|
993
|
+
];
|
|
994
|
+
async handleAsync(command: CliProcessCommand): Promise<string> { /* ... */ }
|
|
995
|
+
}
|
|
996
|
+
```
|
|
997
|
+
|
|
998
|
+
.NET: `public override IEnumerable<CliCommandExample>? Examples { get; set; } = [new("export --format csv", "Today's orders as CSV")];` and `AllowedValues = ["csv", "json"]` in the parameter's object initializer. Python: `@property def examples(self): return [CliCommandExample("export --format csv", "Today's orders as CSV")]` and `allowed_values=["csv", "json"]`.
|
|
999
|
+
|
|
871
1000
|
### Node: minimal server processor
|
|
872
1001
|
|
|
873
1002
|
A Node server command extends `CliCommandProcessor` from `@qodalis/cli-server-abstractions` and returns its output text from `handleAsync`.
|
|
@@ -900,7 +1029,7 @@ const { app } = createCliServer({
|
|
|
900
1029
|
app.listen(8047);
|
|
901
1030
|
```
|
|
902
1031
|
|
|
903
|
-
- `ICliCommandProcessor` members: `command`, `description`, `author` (default `DefaultLibraryAuthor`), `version` (default `'1.0.0'`), `allowUnlistedCommands?`, `valueRequired?`, `acceptsValue?`, `processors?`, `parameters?`, `requiredPermissions?`, `handleAsync(command, signal?) => Promise<string>`, `handleStructuredAsync?(command, signal?) => Promise<CliStructuredResponse>` (takes precedence when present).
|
|
1032
|
+
- `ICliCommandProcessor` members: `command`, `description`, `author` (default `DefaultLibraryAuthor`), `version` (default `'1.0.0'`), `allowUnlistedCommands?`, `valueRequired?`, `acceptsValue?`, `processors?`, `parameters?`, `requiredPermissions?`, `aliases?`, `examples?`, `documentation?`, `module?`, `icon?` (see "Help for server commands"), `handleAsync(command, signal?) => Promise<string>`, `handleStructuredAsync?(command, signal?) => Promise<CliStructuredResponse>` (takes precedence when present).
|
|
904
1033
|
- `CliProcessCommand`: `command`, `chainCommands: string[]`, `rawCommand`, `value?` (as typed), `positionals?: string[]` (shell-split; sent by current browsers), `args: Record<string, any>`, `data?`. Helpers: `getPositionals(command)` (falls back to splitting `value`), `getPositionalText(command)`, `splitShellWords`, `joinShellWords`, `quoteShellWord`.
|
|
905
1034
|
- `signal` is aborted when the HTTP client disconnects.
|
|
906
1035
|
- Packages: `npm install @qodalis/cli-server-abstractions` for plugins; `@qodalis/cli-server-node` for the host.
|
|
@@ -1445,7 +1574,7 @@ class WeatherModule(CliModule):
|
|
|
1445
1574
|
# host: create_cli_server(CliServerOptions(configure=lambda b: b.add_module(WeatherModule())))
|
|
1446
1575
|
```
|
|
1447
1576
|
|
|
1448
|
-
- `CliCommandParameterDescriptor(name, description, required=False, type="string", aliases=None, default_value=None)`.
|
|
1577
|
+
- `CliCommandParameterDescriptor(name, description, required=False, type="string", aliases=None, default_value=None, allowed_values=None)`.
|
|
1449
1578
|
- Dispatch: root by `command.lower()`, then each `chain_commands` word against `processors`; if a word matches no child, the current processor handles it only when `allow_unlisted_commands` is truthy, else `Unknown command`. Only the resolved processor runs.
|
|
1450
1579
|
- `CliBuilder` (chainable): `add_processor`, `add_module`, `set_file_storage_provider`, `add_data_explorer_provider`, `add_filesystem` (legacy). Registering the same command twice replaces the first.
|
|
1451
1580
|
- `CliServerOptions`: `base_path` (`"/api/qcli"`), `cors`, `cors_origins`, `allowed_origins`, `enable_shell`, `shell`, `mcp` (`True`, dict or `CliMcpOptions`), `configure`. `create_cli_server` returns `CliServerResult` with `app`, `registry`, `builder`, `executor`, `mcp`, `mount_plugin(plugin)`, ...
|
|
@@ -1565,10 +1694,10 @@ async def test_greet_executor():
|
|
|
1565
1694
|
|
|
1566
1695
|
### .NET: jobs that run elsewhere
|
|
1567
1696
|
|
|
1568
|
-
The jobs API (`/api/v1/qcli/jobs`), the `jobs_*` MCP tools, `server jobs` and the
|
|
1697
|
+
The jobs API (`/api/v1/qcli/jobs`), the `jobs_*` MCP tools, `server jobs` and the Console'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
1698
|
|
|
1570
1699
|
- 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
|
|
1700
|
+
- `StopAsync`, `CancelAsync` and `UpdateAsync` default to `NotSupportedException` (HTTP `501`, `NOT_SUPPORTED`); the Console shows only the actions in `Actions`.
|
|
1572
1701
|
- Throw `KeyNotFoundException` for an unknown job (`404`) and `InvalidOperationException` when the job's state refuses the action (`409`).
|
|
1573
1702
|
|
|
1574
1703
|
### Jobs: inside a job (all servers)
|
|
@@ -1605,16 +1734,59 @@ builder.Services.AddControllers().AddCli(cli => cli
|
|
|
1605
1734
|
|
|
1606
1735
|
### Audit log plugin (all servers)
|
|
1607
1736
|
|
|
1608
|
-
The audit log is a plugin of its own (.NET `Qodalis.Cli.Plugin.Audit`, Node `@qodalis/cli-server-plugin-audit`, Python `qodalis-cli-server-plugin-audit`): it keeps the entries and serves `GET /api/v1/qcli/audit?event=&username=&actor=&limit=&offset=` (`audit:read`; newest first, 100 without a `limit`, at most 1000) and `DELETE /api/v1/qcli/audit` (`audit:clear`; records `audit_cleared` with who did it), read by the
|
|
1737
|
+
The audit log is a plugin of its own (.NET `Qodalis.Cli.Plugin.Audit`, Node `@qodalis/cli-server-plugin-audit`, Python `qodalis-cli-server-plugin-audit`): it keeps the entries and serves `GET /api/v1/qcli/audit?event=&username=&actor=&limit=&offset=` (`audit:read`; newest first, 100 without a `limit`, at most 1000) and `DELETE /api/v1/qcli/audit` (`audit:clear`; records `audit_cleared` with who did it), read by the web CLI's `audit` and the Console's Audit page, and listed on its Plugins page. The users plugin adds it and records sign-ins, failed sign-ins, user, group, token and shell events there; a host can add it alone: .NET `cli.AddAudit()`, Node `new CliAuditBuilder().build()` mounted with `mountPlugin` (pass it to the users plugin with `setAuditPlugin` to share it), Python `CliAuditBuilder().build()` mounted with `mount_plugin` (the users plugin joins a mounted one).
|
|
1609
1738
|
|
|
1610
1739
|
- 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
1740
|
- A host writes its own entries to the same log through the audit store: `IAuditStore.LogAsync` (.NET, `Qodalis.Cli.Abstractions.Audit`), `auditStore.log(...)` (Node), `await audit_store.log(...)` (Python).
|
|
1612
1741
|
- Another store: `cli.SetAuditStore<T>()` (.NET), `CliAuditBuilder.setStore(store)` (Node), `CliAuditBuilder().set_store(store)` (Python); the users plugin's audit-store option still works and does the same. The contract (`AuditEntry`, `AuditQueryOptions`, the store interface) is in each server's abstractions package. Old entries: `PruneAsync(before)` (.NET), `prune(before)` (Node; Python takes Unix milliseconds).
|
|
1613
1742
|
- .NET only: `cli.AddEfCoreAuditStore(o => o.UseNpgsql(connectionString))` (`Qodalis.Cli.Plugin.Audit.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
1743
|
|
|
1744
|
+
### Permission catalog and host tokens (all servers)
|
|
1745
|
+
|
|
1746
|
+
Servers 1.0.0-beta.29 keep a permission catalog: entries `{ name, description, group, surface }`, `surface` `cli` or `host`, registered at startup only (core's 11 route permissions such as `files:read`, `jobs:manage`, `audit:read`, then the users plugin's 12 `users:*`, `groups:*`, `sessions:*`, `tokens:*`). An invalid or duplicate entry fails startup (`invalid permission entry: <name>`, `permission already registered: <name>`), also when the host registers a name a plugin owns. The catalog is for choosing: `cli` tokens still accept any permission, wildcards included.
|
|
1747
|
+
|
|
1748
|
+
- Host entries: .NET `cli.AddPermissions(p => p.Group("Rates").Add("rates:read", "Official exchange rates"))`, Node `builder.addPermissions([{ name: 'rates:read', description: 'Official exchange rates', group: 'Rates' }])`, Python `builder.add_permissions([CliPermission(name="rates:read", description="Official exchange rates", group="Rates")])`.
|
|
1749
|
+
- `GET /api/v1/qcli/permissions` (users plugin) lists the entries the caller holds, `cli` entries first, then `host` entries; `?all=true` lists every entry (needs `users:read`, else 403 `permission denied: users:read`). The Console's and the web CLI's pickers (`token create <name> --select`, `token permissions [--all]`) read it.
|
|
1750
|
+
- Tokens have an `audience`: `cli` (default; every token created through `POST /tokens`) or `host`. A stored audience that is not exactly `cli` counts as `host`. `POST /tokens` refuses `"audience": "host"` (400 `host tokens can only be created by the host application`).
|
|
1751
|
+
- `host` tokens are refused with 403 `forbidden: host tokens cannot use CLI routes` on every CLI route and socket, whether or not the server is protected; only the host's own guarded routes accept them: .NET `[QcliAuthorize]` / `.RequireQcliAuthorization(...)`, Node `usersPlugin.requirePermission(...)`, Python `users_plugin.require_permission(...)`.
|
|
1752
|
+
- The host issues them through the token manager: .NET `IApiTokenManager` (`CreateAsync(userId, new ApiTokenCreateOptions { Name = "rates-app", Audience = "host", Permissions = ["rates:read"] })`, `ListAsync`, `RevokeAsync`, `GetGrantablePermissionsAsync`), Node `usersPlugin.apiTokens` (`create`, `list`, `revoke`, `grantablePermissions`), Python `users_plugin.api_tokens` (same, snake_case). It applies the routes' validation, limits, audit entries and events; a `host` token needs permissions, each a `host` catalog entry (400 `not a host permission: <p>`) the user holds (403 `forbidden: cannot grant <p>`).
|
|
1753
|
+
|
|
1754
|
+
### Public API, docs and portal plugins (all servers)
|
|
1755
|
+
|
|
1756
|
+
Three plugins publish a host's own REST API with `host` tokens: **public-api** (guard, quotas, usage, the public OpenAPI document and Swagger UI), **docs** (markdown guides served as JSON) and **portal** (the prebuilt site `@qodalis/cli-server-portal` showing both). Each works alone; the portal shows the sections it is given.
|
|
1757
|
+
|
|
1758
|
+
- .NET: `cli.AddPublicApi(o => o.UseQuotaResolver<PlanQuotaResolver>())` + `app.UseQodalisPublicApi()` (publishes the host's `services.AddOpenApi("public")` document), `cli.AddDocs(o => o.AddFolder("docs"))` + `app.UseQodalisDocs()`, `cli.AddPortal(o => o.Path = "/")` + `app.UseQodalisPortal()`; shared counters: `cli.AddEfCorePublicApiUsageStore(o => o.UseNpgsql(cs))`.
|
|
1759
|
+
- Node: `new CliPublicApiBuilder().setUsers(users).setQuota(resolver).setOpenApi('public.json').build()`, `new CliDocsBuilder().addFolder('docs').build()`, `new CliPortalBuilder().addSection(docs).addSection(publicApi).build()`, each mounted with `cli.mountPlugin(...)`.
|
|
1760
|
+
- Python: `CliPublicApiBuilder().set_users(users).set_quota(resolver).set_openapi(router).build()`, `CliDocsBuilder().add_folder("docs").build()`, `CliPortalBuilder().add_section(docs).add_section(public_api).build()`, each mounted with `result.mount_plugin(...)`.
|
|
1761
|
+
- Guard: .NET `app.MapGet("/v1/rates", ...).RequirePublicApi("rates:read")` (route groups too) or `[RequirePublicApi("rates:read")]`; Node `app.get('/v1/rates', publicApi.guard('rates:read'), handler)`; Python `Depends(public_api.guard("rates:read"))` (returns the caller). The handler reads the caller (`userId`, `userName`, `tokenId`, `audience`, `permissions`) with `HttpContext.GetQcliCaller()`, `req.qcliCaller` or `request.state.qcli_caller`; it is set only on admitted requests.
|
|
1762
|
+
- Checks in order, the first failure answers `{ "error": ... }` and nothing is counted: authentication (the users guard's 401/403 texts), not a `host` token (403 `forbidden: a host token is required`), the permission (403 `forbidden: missing permission <p>`), the quota resolver throws (500 `internal server error`, text never sent), a limit of 0 (403 `forbidden: no API access`), the day (429 `quota exceeded: <n> requests per day`) and the minute (429 `too many requests: <n> per minute`), both with `Retry-After`.
|
|
1763
|
+
- Quota resolver: .NET `IPublicApiQuotaResolver.GetQuotaAsync(QcliCaller caller, CancellationToken ct)` returning `PublicApiQuota(long? RequestsPerDay, long? RequestsPerMinute)` (or `o.UseQuotaResolver((caller, services, ct) => ...)`), Node `setQuota((caller) => ({ requestsPerDay, requestsPerMinute }))`, Python `set_quota(lambda caller: PublicApiQuota(requests_per_day=..., requests_per_minute=...))`; `null` is unlimited, no resolver means unlimited (still counted).
|
|
1764
|
+
- Limits are **per account**: counted per token, checked against the sum over every token of the user (revoked ones included) for the UTC day and minute. Answers that passed the permission check carry `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset` (the daily limit when set, else the minute's; none when unlimited). Stacked guards count a request once.
|
|
1765
|
+
- With the plugin, the users plugin's token views (`GET /api/v1/qcli/tokens`, the token manager's list, the Console) end with `usage` (`today`, `last30Days`, 30 `days`); the host's own pages use .NET `IPublicApiUsage.GetAccountUsageAsync(userId)`, Node `publicApi.usage.account(userId)`, Python `public_api.usage.account(user_id)`.
|
|
1766
|
+
- Routes (no sign-in, credentials ignored): `GET /qcli/api/openapi.json` (the host's document plus the `qcliToken` bearer scheme, `security`, `servers` and, where the server knows the guard, `x-required-permission` / `x-host-token-only`; Node hosts write those in their document) and `/qcli/api/swagger`; `GET /qcli/docs/pages` and `/qcli/docs/pages/<slug>` (404 `page not found`); the portal at `/qcli/portal` (`/`, `/guides/<slug>`, `/reference`, `/reference/<tag>`, `/portal.json`, `/assets/*`), which at `/` never shadows the host's routes. Paths are set with .NET `BasePath` / `Path`, Node `setBasePath` / `setPath`, Python `set_base_path` / `set_path`.
|
|
1767
|
+
- The users plugin's host-token-only guards (`[QcliAuthorize("p", HostTokenOnly = true)]`, `.RequireQcliAuthorization("p", hostTokenOnly: true)`, `usersPlugin.requireHostToken('p')`, `users_plugin.require_host_token("p")`) also refuse sessions and `cli` tokens and set the caller, but have no quota and count nothing: use the public-api guard for counted routes.
|
|
1768
|
+
- A second service that only serves the API turns the CLI off and validates tokens over the shared stores: .NET `cli.WithoutCliRoutes()` + `o.UseGuardOnly()`, Node `createCliServer({ cliRoutes: false })` + `new CliUsersBuilder().setGuardOnly()`, Python `CliServerOptions(cli_routes=False)` + `CliUsersBuilder().set_guard_only()`. Guard-only with the CLI routes on fails at startup (`guard-only needs WithoutCliRoutes()`, `guard-only needs cliRoutes: false`, `guard-only needs cli_routes=False`). Create and revoke tokens from one service only.
|
|
1769
|
+
- The portal's branding is a config provider, `portal`: section `branding` (`name` 1-80 characters, `logoUrl` an http(s) URL, root-relative path or `data:image` URL, `''` for none, `themeMode` `system|light|dark`, `footerLinks` a JSON list of at most 20 `{ label, url }`), whose defaults are the builder's values and whose changes (`config set portal.branding.<key> <value>`, `PATCH /api/v1/qcli/config/portal/branding`, the Console's Settings) apply to the next `/portal.json` without a restart; the read-only section `site` shows `path`, `siteFound` and `sections`. The theme's colour tokens stay in code. The `portal` command (`config:read`) prints the mount, the site and where it came from, the sections and the branding.
|
|
1770
|
+
- The portal's mount must not hold or sit inside the CLI's routes (`/api`, `/ws`, `/api/v1`, `/api/v1/qcli/...`): refused with `invalid portal path: <path>`.
|
|
1771
|
+
- .NET: the public-api plugin brings Microsoft.OpenApi 2 (`Microsoft.AspNetCore.OpenApi` 10); a host that also uses Swashbuckle needs Swashbuckle 10 or later.
|
|
1772
|
+
|
|
1773
|
+
### Data explorer sources: permissions, read-only, masking (all servers)
|
|
1774
|
+
|
|
1775
|
+
Each data explorer source takes these options besides `timeout` and `maxRows` (Node and JSON names; .NET PascalCase, Python snake_case):
|
|
1776
|
+
|
|
1777
|
+
- `readOnly` (default **true**): only queries that read are accepted (`SELECT`/`WITH`/`EXPLAIN`/`SHOW`..., MongoDB `find`/`aggregate`..., Redis read commands, Elasticsearch `GET` and `_search`), and SQL providers run them in a read-only transaction. Set it to false for a source that must write.
|
|
1778
|
+
- `requiredPermissions`: permissions the caller needs besides `data:query`; other users do not see the source (403 on `schema`/`execute`).
|
|
1779
|
+
- `allowedObjects`: glob patterns of the tables (`schema.table` or `table`), collections, Redis keys or indices the source shows and accepts.
|
|
1780
|
+
- `maskColumns` (values shown as `***`) and `dropColumns` (removed from results and schema): glob patterns of column or field names.
|
|
1781
|
+
- `rateLimit` `{ maxQueries, windowSeconds }`: per user and source; more answer 429.
|
|
1782
|
+
- `audit` (default true): every execute is written to the audit log as `data_query` with the source, the query (first 2000 characters), success, row count and duration.
|
|
1783
|
+
- `exportPermissions`: `GET /sources` reports `canExport`, and the web CLI's `data-explorer` refuses `\format json|csv` when it is false.
|
|
1784
|
+
|
|
1785
|
+
The object filter and the read-only check are a convenience: give the source a database account that can only read what its users may see.
|
|
1786
|
+
|
|
1615
1787
|
### Server logs and Seq (.NET)
|
|
1616
1788
|
|
|
1617
|
-
The
|
|
1789
|
+
The Console's Logs page reads `GET /api/v1/qcli/logs?level=&search=&service=&from=&to=&limit=&offset=` (`logs:read`; `level` is one level or a comma list of `DEBUG`, `INFO`, `WARN`, `ERROR`; `from`/`to` ISO 8601; at most 500 per page) and tails `/ws/v1/qcli/logs` live. By default the history is the admin plugin's in-memory buffer: the latest 1000 entries of that process, gone on restart.
|
|
1618
1790
|
|
|
1619
1791
|
- .NET: `cli.AddSeqLogs(seq => { seq.ServerUrl = "http://seq:5341"; seq.ApiKey = ...; seq.ServiceName = "my-api"; })` (`Qodalis.Cli.Plugin.Logs.Seq`) sends every log entry to Seq as CLEF, tagged `Service`, and makes Seq the history: it survives restarts and holds every service that writes there, filtered by service, level, text and time. A service that only writes (a worker without the admin plugin) sets `seq.ReadHistory = false`. Logging never waits for Seq or fails because of it.
|
|
1620
1792
|
- The answer carries `store` (`memory`, `seq`), `persistent`, `services` and `hasMore`; `total` is null when the store cannot count (Seq). 502 with `{ error }` when the store is unreachable.
|
|
@@ -1622,11 +1794,126 @@ The dashboard's Logs page reads `GET /api/v1/qcli/logs?level=&search=&service=&f
|
|
|
1622
1794
|
|
|
1623
1795
|
### Installed plugins (all servers)
|
|
1624
1796
|
|
|
1625
|
-
`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
|
|
1797
|
+
`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 Console'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).
|
|
1798
|
+
|
|
1799
|
+
### Plugin dependencies
|
|
1800
|
+
|
|
1801
|
+
A server plugin declares the plugins (or capabilities) it needs. The server loads them first, and a plugin whose dependencies are missing is not loaded (it does not fail at runtime). The marketplace installer installs a plugin's dependencies with it and protects the plugins that need them. The contract is the same on the Node, Python and .NET servers.
|
|
1802
|
+
|
|
1803
|
+
**Declaring.** Four fields:
|
|
1804
|
+
|
|
1805
|
+
| Field | Meaning |
|
|
1806
|
+
|---|---|
|
|
1807
|
+
| `requires` | `{ pluginId: range }`. Hard: the plugin is not loaded without them |
|
|
1808
|
+
| `optional` | `{ pluginId: range }`. Loaded first when present and in range; never blocks |
|
|
1809
|
+
| `requiresCapability` | Capability names. Hard: any loaded plugin that provides one satisfies it |
|
|
1810
|
+
| `provides` | Capabilities the plugin provides (its own id is always provided) |
|
|
1811
|
+
|
|
1812
|
+
Keys are marketplace ids (`users`, `data-explorer-postgres`). A capability matches `^[a-z0-9][a-z0-9._-]{0,63}$` (`messaging.email`) and is, by convention, the name of the service the provider shares. The range `before:<range>` (`before:*`) means the plugin extends the other one and loads **before** it (`users-postgres` gives `users` its stores); presence and version are checked the same way. An invalid declaration (bad id or capability, an unreadable range, a plugin requiring itself) never throws: the dependency is `invalid`.
|
|
1813
|
+
|
|
1814
|
+
Node: in the `qodalis` block of `package.json` (what the marketplace indexes) and/or the entry's `plugin`; a field on the entry wins.
|
|
1815
|
+
|
|
1816
|
+
```ts
|
|
1817
|
+
export const plugin: CliPluginEntryInfo = {
|
|
1818
|
+
id: 'store',
|
|
1819
|
+
package: '@acme/cli-server-plugin-store',
|
|
1820
|
+
requires: { contacts: '>=1.2', users: 'before:*' },
|
|
1821
|
+
optional: { search: '*' },
|
|
1822
|
+
requiresCapability: ['messaging.email'],
|
|
1823
|
+
provides: ['store'],
|
|
1824
|
+
};
|
|
1825
|
+
```
|
|
1826
|
+
|
|
1827
|
+
```json
|
|
1828
|
+
"qodalis": { "kind": "server", "plugin": "store", "entry": "./dist/plugin.js", "requires": { "contacts": ">=1.2" } }
|
|
1829
|
+
```
|
|
1830
|
+
|
|
1831
|
+
Python: the same fields in snake_case on the entry module's `plugin` (`CliPluginEntryInfo`); in JSON and on the wire they stay camelCase (`requiresCapability`). The marketplace reads them from the plugin's Node package and the installer copies them into `installed.json`; a field on the entry wins over the record's.
|
|
1832
|
+
|
|
1833
|
+
```python
|
|
1834
|
+
plugin = CliPluginEntryInfo(
|
|
1835
|
+
id="store",
|
|
1836
|
+
package="acme-cli-server-plugin-store",
|
|
1837
|
+
requires={"contacts": ">=1.2", "users": "before:*"},
|
|
1838
|
+
optional={"search": "*"},
|
|
1839
|
+
requires_capability=["messaging.email"],
|
|
1840
|
+
provides=["store"],
|
|
1841
|
+
)
|
|
1842
|
+
```
|
|
1843
|
+
|
|
1844
|
+
.NET: four default-implemented, nullable properties of `ICliPluginEntry` (null: none), so an entry declares only what it needs: `Requires` and `Optional` are `IReadOnlyDictionary<string, string>?`, `RequiresCapability` and `Provides` are `IReadOnlyList<string>?`. In JSON, `before:*` can also be written `{ "range": "*", "order": "before" }`. A plugin installed from the marketplace also has the declarations of its version record (copied to `installed.json`); a property of its entry wins.
|
|
1845
|
+
|
|
1846
|
+
```csharp
|
|
1847
|
+
[assembly: CliPlugin(typeof(StorePluginEntry), Id = "store")]
|
|
1848
|
+
|
|
1849
|
+
public sealed class StorePluginEntry : ICliPluginEntry
|
|
1850
|
+
{
|
|
1851
|
+
public IReadOnlyDictionary<string, string>? Requires => new Dictionary<string, string>
|
|
1852
|
+
{
|
|
1853
|
+
["contacts"] = ">=1.2", ["users"] = "before:*",
|
|
1854
|
+
};
|
|
1855
|
+
public IReadOnlyDictionary<string, string>? Optional => new Dictionary<string, string> { ["search"] = "*" };
|
|
1856
|
+
public IReadOnlyList<string>? RequiresCapability => ["messaging.email"];
|
|
1857
|
+
public IReadOnlyList<string>? Provides => ["store"];
|
|
1858
|
+
|
|
1859
|
+
public void Register(CliPluginContext context) { /* ... */ }
|
|
1860
|
+
}
|
|
1861
|
+
```
|
|
1862
|
+
|
|
1863
|
+
A package the host installed without an entry counts as a loaded plugin with an id derived from its package name: Node (`mountPlugin`/`addModule`) drops the scope and the `cli-server-plugin-` prefix (`@qodalis/cli-server-plugin-users` is `users`); Python (`mount_plugin`/`add_module`) drops `qodalis-cli-server-plugin-`; .NET (`AddModule`) drops `Qodalis.Cli.Plugin.`, lower-cases and turns dots into dashes (`Qodalis.Cli.Plugin.Users.EfCore` is `users-efcore`).
|
|
1864
|
+
|
|
1865
|
+
**Version ranges.** One small grammar. Comparators are separated by spaces and all must hold. There is no `||` and no `x`.
|
|
1866
|
+
|
|
1867
|
+
| Range | Means |
|
|
1868
|
+
|---|---|
|
|
1869
|
+
| `*` or empty | any version |
|
|
1870
|
+
| `>=1.2`, `>1.0`, `<2`, `<=1.2.3`, `=1.2.3` | comparison |
|
|
1871
|
+
| `1.2.3` | exactly that version |
|
|
1872
|
+
| `1.2` | a prefix: `>=1.2.0 <1.3.0` |
|
|
1873
|
+
| `^1.2` | `>=1.2.0 <2.0.0` (`^0.3` is `>=0.3.0 <0.4.0`) |
|
|
1874
|
+
| `~1.2` | `>=1.2.0 <1.3.0` |
|
|
1875
|
+
| `>=1.2 <2` | both comparators |
|
|
1876
|
+
|
|
1877
|
+
A comparator without a prerelease tag compares the release only, so `1.0.0-beta.35` satisfies `>=1.0`; one with a tag uses semver precedence (`>=1.0.0-beta.36` refuses `1.0.0-beta.35`). Versions are normalized first (Python's `1.0.0b35` is `1.0.0-beta.35`; a leading `v` and `+build` are dropped); a version that cannot be read satisfies only `*`. The helper is `satisfiesPluginVersionRange(version, range)` (Node abstractions), `satisfies_plugin_version_range` (Python abstractions; not PEP 440 specifiers) and `CliPluginDependencyResolver.Satisfies` (.NET, `Qodalis.Cli.Abstractions.Plugins`).
|
|
1878
|
+
|
|
1879
|
+
**Statuses.** A plugin with a hard dependency that is `missing`, `incompatible` (outside the range), `invalid` or in a `cycle` gets the status `needs-dependencies`: it registers nothing and startup goes on. So does a plugin whose dependency did not load at its turn (failed, needs configuration, needs dependencies itself): that dependency is `not-loaded`. The log says `store needs dependencies: contacts (missing), messaging >=1.2 (found 1.1.0)`, and a notification (`plugin.needs-dependencies:<id>`, "Plugin store needs other plugins") stays until the plugin loads. `GET /api/v1/qcli/plugins/installed` and the plugin states (`serverPlugins.states()` on Node, `result.server_plugins.states()` on Python, `CliServerPlugins.States()` on .NET) carry `requires`, `optional`, `requiresCapability`, `provides`, `dependencies` (each with `kind`, `id`, `range`, `status`, `version`, `providedBy`, `message`) and `dependents`; the installed-plugins record keeps `unmetDependencies`. Load order: dependencies first, then the usual plugin order; a plugin takes the lowest order of the plugins that require it.
|
|
1880
|
+
|
|
1881
|
+
**Services between plugins.** The plugin context's services stay. `provide(name, value)` shares a service and remembers its provider (a warning when another plugin replaces it); `plugin(id)` describes a plugin or host package of this start, `{ id, version, status }` (Python `CliPluginInfo(id, status, version)`; .NET `{ Id, Version, Status }`; nothing when it is absent or loads later), which is how a plugin checks an optional dependency. Put the interface of a shared service in a small `*-abstractions` package versioned with its provider, and name the capability like the service (a convention, not enforced).
|
|
1882
|
+
|
|
1883
|
+
```ts
|
|
1884
|
+
// provider (Node): context.provide('contacts', new ContactStore());
|
|
1885
|
+
// consumer:
|
|
1886
|
+
const contacts = context.services.get('contacts') as ContactStore;
|
|
1887
|
+
if (context.plugin?.('search')?.status === 'loaded') { /* use the optional plugin */ }
|
|
1888
|
+
```
|
|
1889
|
+
|
|
1890
|
+
Python: `context.provide("contacts", store)` and `info = context.plugin("search")` (`if info and info.status == "loaded"`). .NET: `context.Provide("contacts", store)` and `context.Plugin("search")?.Status == "loaded"` (the shared services are also `builder.PluginServices` and `CliPluginServices`).
|
|
1891
|
+
|
|
1892
|
+
**Installing.** The admin plugin's server marketplace (`/api/v1/qcli/server/marketplace`) reads the four fields from the marketplace's version records (an older marketplace without them: no dependencies).
|
|
1893
|
+
|
|
1894
|
+
- `install` installs what the plugin requires first (dependencies before dependents, each with its integrity checked, marked `auto: true`), then the plugin. `--no-deps` (REST: `dependencies: false`) installs it alone; it then shows `needs-dependencies`. A capability nobody present provides is never installed automatically: the conflict names the marketplace's providers.
|
|
1895
|
+
- `update` installs what the new version requires and refuses when an installed plugin requires a range the new version leaves (`breaks-dependents`).
|
|
1896
|
+
- `remove` refuses while installed or loaded plugins require the plugin, or a capability only it provides (`has-dependents`).
|
|
1897
|
+
- `--force` (REST: `force=true`) overrides the update and remove protection.
|
|
1626
1898
|
|
|
1627
|
-
|
|
1899
|
+
Optional dependencies are listed in the plan but never installed.
|
|
1628
1900
|
|
|
1629
|
-
|
|
1901
|
+
**Command.** `admin plugins deps [id] [--json]` (permission `admin:access`): what a plugin requires (a status per line) and what requires it; without an id, every plugin with dependencies and the problems. `admin plugins install <name> [--no-deps]`, `admin plugins remove|update <name> [--force]`.
|
|
1902
|
+
|
|
1903
|
+
**REST** (admin plugin):
|
|
1904
|
+
|
|
1905
|
+
| Request | Answer |
|
|
1906
|
+
|---|---|
|
|
1907
|
+
| `GET /api/v1/qcli/server/marketplace/plan?action=install\|update\|remove&name=<id>&version=<v>` | What the change does: `install` and `update` (plugins installed or updated with it, the newest version in range this server can install), `satisfied`, `optional`, `capabilities`, `conflicts` (`missing`, `incompatible`, `invalid`, `needs-setup`, `blocked`, `capability`, `breaks-dependent`), `dependents`, `ok` |
|
|
1908
|
+
| `GET /api/v1/qcli/plugins/dependencies` | The graph: `nodes` (`id`, `package`, `version`, `status`, `source`, `provides`) and `edges` (`from`, `to`, `kind`, `range`, `order`, `capability`, `status`, `version`, `message`); a dependency nobody has is a node with status `missing` |
|
|
1909
|
+
|
|
1910
|
+
The install, update and remove endpoints answer `409` with `code` `dependency-conflict` and the `plan`, `breaks-dependents` and the `plan`, or `has-dependents` and the `dependents`; a failure part-way answers `dependency-failed` with `failed` and `installed`.
|
|
1911
|
+
|
|
1912
|
+
**Official plugins.** The store that gives `users` its persistence requires `users` (`before:*`) where it exists: `users-postgres` on Node, `users-efcore` on .NET; Python has neither. The data explorer sources declare `data-explorer` as optional (a source works without it; with it, its rules apply), `public-api` declares `users` optional and `portal` declares `docs` and `public-api` optional. The filesystem storage plugins (on .NET also the other stores and the database drivers) declare nothing; each storage refuses to load when another storage is set.
|
|
1913
|
+
|
|
1914
|
+
### Console statistics endpoints (all servers)
|
|
1915
|
+
|
|
1916
|
+
Since 1.0.0-beta.19 every server answers read-only endpoints the Console (Qodalis Console, 1.0.0-beta.15) charts; the JSON is the same on .NET, Node and Python. Times are ISO 8601 (no offset = UTC), durations milliseconds; a range is `[since, until)` cut into `buckets` equal columns (1-200, default 24; the default range is the last 24 hours) and a start not before its end answers 400.
|
|
1630
1917
|
|
|
1631
1918
|
- `GET /api/v1/qcli/jobs/stats?since=&until=&buckets=&job=&group=` (jobs plugin): runs per column by result (`succeeded`, `failed` incl. timed out, `cancelled`, `running`), `totals` (`successRate` = succeeded / (succeeded + failed), `avgDuration`, `p95Duration`, `maxDuration`, `lastFailureAt`) and per job (`jobs[]` with the same totals and its 12 latest runs in `recent`). Counted over every run in the range through the store's execution query, so it works with any jobs store.
|
|
1632
1919
|
- `GET /api/v1/qcli/logs/histogram?from=&to=&buckets=&level=&search=&service=` (admin plugin): entries per level (`DEBUG`, `INFO`, `WARN`, `ERROR`) and column with the filters of `GET /logs`, from the in-memory history or, on .NET, Seq (`ILogStore.HistogramAsync`, with a default that pages `QueryAsync`).
|
|
@@ -1634,15 +1921,78 @@ Since 1.0.0-beta.19 every server answers read-only endpoints the admin dashboard
|
|
|
1634
1921
|
- `GET /api/v1/qcli/commands/stats` (core, same access as `GET /commands`): executions, failures (non-zero exit, exception, unknown command), average duration and last run of each root command since the server started; `known` is false for commands the registry does not have.
|
|
1635
1922
|
- `GET /api/v1/qcli/audit` takes `from` and `to` (ISO 8601 or epoch ms); a custom audit store applies them from `AuditQueryOptions`.
|
|
1636
1923
|
|
|
1637
|
-
###
|
|
1924
|
+
### Qodalis Console: pages, plugin pages and extensions (all servers)
|
|
1925
|
+
|
|
1926
|
+
The admin plugin serves the Qodalis Console ("the Console", the servers' admin UI) at `/qcli/admin` (the URL did not change). Its own pages: Overview, Commands, Plugins, Terminal, Events, Logs, Config. Every other page is a module (`@qodalis/console-module-<name>`, built in the qodalis-console repo, formerly `cli-server-dashboard`) embedded in the plugin that owns its API, served at `/qcli/modules/<id>` and registered when the plugin is mounted, so a server shows the page only when it has the plugin:
|
|
1927
|
+
|
|
1928
|
+
| Page | Plugin | Permission |
|
|
1929
|
+
|---|---|---|
|
|
1930
|
+
| Jobs (`/x/jobs`) | jobs | `jobs:read` |
|
|
1931
|
+
| Audit (`/x/audit`) | audit (the users plugin adds it) | `audit:read` |
|
|
1932
|
+
| Filesystem (`/x/filesystem`) | core, with the filesystem enabled | `files:read` |
|
|
1933
|
+
| Data explorer (`/x/data-explorer`) | core, with data explorer sources | `data:query` |
|
|
1934
|
+
| Databases (`/x/databases`, served at `/qcli/databases`) | databases | `databases:read` |
|
|
1935
|
+
| Users (`/x/users`: users, groups, sessions) | users | `users:read` |
|
|
1936
|
+
| API tokens (`/x/tokens`) | users | none |
|
|
1937
|
+
| Account (`/x/account`, in the account menu: profile, password, permissions) | users | none |
|
|
1938
|
+
|
|
1939
|
+
- Renamed from "the dashboard" (the Console). The old names keep working as deprecated aliases: packages `@qodalis/cli-server-dashboard`, `@qodalis/cli-server-dashboard-kit`, `@qodalis/cli-dashboard-module-<id>`; `addDashboardExtension` / `add_dashboard_extension` / `AddDashboardExtension` and the other `*Dashboard*` identifiers (`setDashboardModuleDir`, `setUsersDashboardDir`, `CliDashboardExtension`, ...); the permission `dashboard:install` (equivalent to `console:install`); `admin dashboard ...` (now `admin console ...`) and the `dashboard` command alias; the routes `/api/v1/qcli/dashboard/*`; manifest `qodalis.kind: "dashboard"` and keyword `qodalis-dashboard-plugin` (now `"console"` and `qodalis-console-plugin`). Marketplace Console plugins install with `admin console install <name>`; `pkg add` of one says so.
|
|
1940
|
+
- Sign-in: with the users plugin, the user's own account and `admin:access`; without it, the admin plugin's single account. With an auth adapter (the host signs users in, `GET /api/v1/qcli/auth/mode` answers `external`) the Console links to the host's sign-in and takes its `#token=`; the Users and Account pages then only show (no password forms, no edits), as with read-only user and group stores. A login answer with `mustChangePassword: true` asks for a new password (`PUT /api/v1/qcli/users/<name>/password` with `currentPassword`) before the Console opens.
|
|
1941
|
+
- Another build of a page, or none: Node `builder.setConsoleModuleDir('filesystem' | 'data-explorer', dir | false)` and the plugins' own options (`setUsersConsoleDir(false)`, ...); .NET `cli.ConfigureConsoleModule(id, fileProvider | null)`; Python `CliServerOptions(console_pages={"filesystem": dir | False})` and the plugins' options (`set_users_console_dir(False)`).
|
|
1942
|
+
- Your own page: register a Console extension and serve its ES module. Node `builder.addConsoleExtension({ id, title, titles, icon, group, order, permission, entry, styles, widgets, search })`, .NET `cli.AddConsoleExtension(new CliConsoleExtension { Id = ..., Entry = ... })`, Python `builder.add_console_extension({...})`; listed by `GET /api/v1/qcli/console/extensions` (`/api/v1/qcli/dashboard/extensions` still answers). `group` is a sidebar section (`overview`, `operations`, `data`, `access`, `system`, the default) or `account` (the account menu); `permission` hides the page from users without it; `widgets: ["overview"]` lets the module add Overview cards (`stat`, `half`, `full`) and attention items, `["palette"]` command palette entries; `search: "/?q="` adds "Search <title> for …" to the palette. The page is mounted at `/x/<id>` with the Console's context (user, permissions, theme, language, routing, `fetch` with the session, notices, confirm dialog, server events).
|
|
1943
|
+
- Build pages with `@qodalis/console-kit`: the Console's components, theme (Tailwind preset), texts in 11 languages, `defineExtension(App, { overview: { cards, attention }, palette })`, `useConsole`, `useApi`, `useTranslations`/`defineMessages`, hooks (`useAsync`, `useQueryParams`, `usePaging`, `useLiveReload`) and test helpers (`@qodalis/console-kit/testing`). Contract: qodalis-console `docs/extensions.md`.
|
|
1944
|
+
|
|
1945
|
+
### Qodalis Console: name and icon (all servers)
|
|
1638
1946
|
|
|
1639
|
-
The
|
|
1947
|
+
The Console is "Qodalis Console" 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.
|
|
1640
1948
|
|
|
1641
1949
|
- .NET: `cli.AddAdmin(o => { o.Branding.Name = "RateBell"; o.Branding.IconUrl = "/favicon.svg"; o.Branding.CliName = "RateBell CLI"; })`
|
|
1642
1950
|
- Node: `new CliAdminBuilder().setBranding({ name: 'RateBell', iconUrl: '/favicon.svg', cliName: 'RateBell CLI' })`
|
|
1643
1951
|
- Python: `CliAdminBuilder().set_branding({"name": "RateBell", "icon_url": "/favicon.svg", "cli_name": "RateBell CLI"})`
|
|
1644
1952
|
- 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`.
|
|
1645
|
-
- The filesystem API (`/api/qcli/fs/*`) and the
|
|
1953
|
+
- The filesystem API (`/api/qcli/fs/*`) and the Console's Files page exist only when the server enables the filesystem (`AddFileSystem()` in .NET); otherwise the routes answer `404`.
|
|
1954
|
+
|
|
1955
|
+
### Configuration providers (all servers)
|
|
1956
|
+
|
|
1957
|
+
The server's settings are read and changed through **config providers** registered by the server, its plugins and the host: the Console's Config page, the core `config` command and the `config_*` MCP tools show them. Node, .NET and Python share the contract and the JSON. A provider has sections, a section has entries; a provider is read-only unless it also implements the writer, and each entry says whether it can change (`mutable`) and whether a change needs a restart. Writable values live in the server's **config store** and are applied again at startup.
|
|
1958
|
+
|
|
1959
|
+
- Contract (abstractions packages): `ICliConfigProvider` (`id` lower case letters, digits, `_`, `-`; `title`, `description?`, `order?` default 100, `requiredPermission?`, `getSections(context)`) and the optional `ICliConfigWriter` on the same object (`validate(sectionId, changes, context)`, `update(sectionId, changes, expectedVersion, context)` returning `{ applied, requiresRestart, version }`). A section: `id`, `title?`, `description?`, `entries`, `version?` (writable sections; a stale version gets 409), `allowCustomKeys?`. An entry: `key`, `label?`, `description?`, `type` (`string`, `number`, `boolean`, `string[]`, `enum`, `secret`, `json`, `duration` such as `30m`, `url`), `value`, `default`, `source` (`default`, `file`, `environment`, `database`, `runtime`), `mutable`, `requiresRestart`, `sensitive` (every `secret`; the value is never returned, only `isSet`), `validation` (`min`, `max`, `pattern`, `options`, `required`), `editor` (a UI hint: `tags`, `origins`, `textarea`, `cron`, `code`). `null` in `changes` resets a setting to its default. Writers throw `CliConfigConflictError(currentVersion)` and `CliConfigValidationError(errors)`.
|
|
1960
|
+
- Settings described in code: `CliStoredConfigProvider` (`id`, `title`, `sections: [{ id, title, settings: [{ key, type, default, validation, mutable, value, apply }] }]`); the server attaches its store, calls `apply` with every stored value and after each change. Register it:
|
|
1961
|
+
- Node: `builder.addConfigProvider(new CliStoredConfigProvider({ id: 'billing', title: 'Billing', sections: [...] }))`, or a module's `configProviders`.
|
|
1962
|
+
- .NET: `cli.AddConfigProvider<BillingConfigProvider>()` or `cli.AddConfigProvider(new CliStoredConfigProvider(new CliStoredConfigProviderOptions { Id = "billing", Title = "Billing", Sections = [...] }))`, or `ICliModule.ConfigProviders`.
|
|
1963
|
+
- Python: `builder.add_config_provider(CliStoredConfigProvider(id="billing", title="Billing", sections=[CliConfigSectionDefinition(id="invoices", settings=[CliConfigSettingDefinition(key="dueDays", type="number", default=30)])]))`.
|
|
1964
|
+
- A provider registered under a built-in id replaces the built-in one.
|
|
1965
|
+
- Stores (keep only values changed from their defaults, with a version per section): `InMemoryConfigStore` (default, source `runtime`, lost on restart), `JsonFileConfigStore(path)` (source `file`, one JSON file, mode 0600), `CliDatabaseConfigStore` (databases plugin, source `database`, table `QcliConfig`, migration source `qcli-config`). Set it with `builder.setConfigStore(store)` (Node), `cli.SetConfigStore(...)` (.NET), `builder.set_config_store(store)` (Python); Node waits with `await server.config.ready()` before listening.
|
|
1966
|
+
- Built-in providers (order): `server` (0, runtime facts, read-only), `auth` (10, admin plugin, read-only), `host` (20, options and an allowlist of environment variables: `QCLI_*`, `NODE_ENV`, `PORT`, `HOST`, `TZ`, `LANG`, extended with `config.environment.allow` (Node `createCliServer({ config: { environment: { allow: ['APP_*'] } } })`), secrets masked, read-only), `cors` (30, `allowedOrigins` writable), `mcp` (40, writable when MCP is on), `filesystem` (50, `maxUploadBytes`), `jobs` (60, jobs plugin: history retention), `users` (70, users plugin: `sessions` and `security` writable, `access` read-only), `logs` (80, admin plugin: buffer capacity and lowest level), `custom` (1000, free keys).
|
|
1967
|
+
- API (admin plugin, behind the Console's sign-in): `GET /api/v1/qcli/config` answers `{ "providers": [{ "id", "title", "description", "order", "writable", "sections": [{ "id", "title", "description", "mutable", "version", "allowCustomKeys", "entries": [{ "key", "label", "description", "type", "value", "default", "source", "mutable", "requiresRestart", "sensitive", "isSet"?, "validation"?, "editor"? }] }] }] }`; `GET /api/v1/qcli/config/{provider}` one provider; `PATCH /api/v1/qcli/config/{provider}/{section}` with `{ "changes": { "key": value }, "version": "3" }` answers 200 `{ "provider", "section", "applied": [...], "requiresRestart", "version" }`, 400 `{ "error": "validation failed", "errors": { key: message } }` (or a read-only provider or section), 403 `forbidden: missing permission config:write`, 404 unknown provider or section, 409 `{ "error": "version conflict", "version": "4" }`.
|
|
1968
|
+
- Permissions (catalog group `Config`): `config:read` to see providers (secrets stay hidden), `config:write` to change them, plus a provider's own `requiredPermission`. An open server allows everything.
|
|
1969
|
+
- Audit: every change writes `config.update` (target `config:<provider>.<section>`, details `<provider>.<section>: key1, key2`, properties `{ provider, section, version, via, changes: [{ key, old, new }] }`, secrets as `***`) to the users plugin's audit log, or `builder.setConfigAuditStore(store)`.
|
|
1970
|
+
- Event: `config:changed` `{ provider, section, keys, version, requiresRestart, user }` (audience `config:read`, never values); open Consoles reload the provider.
|
|
1971
|
+
- MCP (when on): `config_list` and `config_get` (`provider`, `section?`, `key?`) need `config:read` and are read-only; `config_set` (`provider`, `section`, `changes`, `version?`) needs `config:write` and is hidden by `QCLI_READ_ONLY` and the endpoint's `readOnly`.
|
|
1972
|
+
- Terminal: `config list`, `config get <provider>[.<section>[.<key>]]` (`config:read`), `config set <provider>.<section>.<key> <value> [--expected-version v]`, `config reset <provider>.<section>.<key>` (`config:write`). Values are read as the setting's type (`a,b,c` or a JSON array for lists); secrets are accepted and never printed. Node leaves the command out with `createCliServer({ config: { command: false } })`.
|
|
1973
|
+
|
|
1974
|
+
### Plugin commands (all servers)
|
|
1975
|
+
|
|
1976
|
+
Every server plugin can be used from the terminal, either through **server-side commands** (processors of the plugin, the same on Node, .NET and Python, run on the server with `commands:execute` plus their permission, checked along the command chain) or through a **web-cli package** that calls the plugin's REST API. The full list with every flag is on the docs site's "Server plugin commands" page (`/docs/server-plugin-commands`).
|
|
1977
|
+
|
|
1978
|
+
| Plugin | Commands | Permission | Runs |
|
|
1979
|
+
|---|---|---|---|
|
|
1980
|
+
| core config | `config list\|get\|set\|reset` | `config:read`, `config:write` for set/reset | server |
|
|
1981
|
+
| admin | `admin status [--history] [--minutes 1-1440] [--json]`, `admin plugins [list] \| enable <id> \| disable <id>`, `admin clients`, `admin logs [--level] [--search] [--service] [--since] [-n 1-1000]` | `admin:access`; `admin logs` also `logs:read` | server |
|
|
1982
|
+
| admin (live logs) | `server logs [--level] [--pattern] [--file]` | `logs:read` | `@qodalis/cli-server-logs` |
|
|
1983
|
+
| audit | `audit`, `audit clear`, `last [user]` | `audit:read`, `audit:clear` | `@qodalis/cli-users` |
|
|
1984
|
+
| aws | `aws configure\|status\|s3\|ec2\|lambda\|cloudwatch\|sns\|sqs\|iam\|dynamodb\|ecs ...` | `aws:read` on every command; also `aws:write` on `aws configure set`, `s3 cp/rm/mb/rb`, `ec2 start/stop/reboot`, `lambda invoke`, `sqs send/purge`, `sns publish` | server |
|
|
1985
|
+
| data-explorer | `data-explorer [--server]` (query console) | `data:query` (+ the source's) | `@qodalis/cli-data-explorer` |
|
|
1986
|
+
| databases | `databases [list]` (alias `db`), `databases stats\|migrations [<db>]`, `databases up\|down [<db>] [--to] [--dry-run]`, `databases runs [<db>] [-n 1-100]` | `databases:read`; up/down `databases:migrate` | server |
|
|
1987
|
+
| docs | `docs list [--group]`, `docs read <slug>` (aliases `show`, `cat`) | none | server |
|
|
1988
|
+
| filesystem | `scp ls\|cat\|stat\|download\|upload\|mkdir\|rm <server> <path>` | `files:read`, `files:write` | `@qodalis/cli-scp` |
|
|
1989
|
+
| jobs | `server jobs [list\|info\|trigger\|pause\|resume\|stop\|cancel\|edit\|history\|logs\|runs\|stats\|watch]`, `server jobs history clear <job>`, `server jobs history rm <job> <run-id>` (clear/rm ask unless `--yes`) | `jobs:read`; actions, edit and deleting runs `jobs:manage` | `@qodalis/cli-server-jobs` |
|
|
1990
|
+
| portal | `portal [status] [--json]` (path, site found and where from, sections, branding); branding changed with `config set portal.branding.name\|logoUrl\|themeMode\|footerLinks <value>` (live in `/portal.json`) | `config:read`; `config set` `config:write` | server |
|
|
1991
|
+
| public-api | `api usage [--days 1-30] [--user <name\|id>] [--json]` (there is no `api routes`: the guarded routes are the host's) | none for your own usage; `tokens:read` with `--user` | server |
|
|
1992
|
+
| users | `login`, `su`, `whoami`, `adduser`, `usermod`, `userdel`, `groupadd`, `sessions`, `token create\|list\|revoke\|permissions`, `link approve <code> [--yes]`, `link deny <code>`, ... | per command (`users:*`, `groups:*`, `sessions:*`, `tokens:*`) | `@qodalis/cli-users` |
|
|
1993
|
+
| weather | `weather [current\|forecast] [location]` | none | server |
|
|
1994
|
+
|
|
1995
|
+
The data explorer providers, the filesystem storage providers and `users-postgres` have no commands: use the commands of the plugin they serve. A new server plugin adds its commands as processors in its module (see "Node: permissions and MCP tools" for `requiredPermissions`) and documents them in its README's `## Terminal commands` section.
|
|
1646
1996
|
|
|
1647
1997
|
## Recipes
|
|
1648
1998
|
|
|
@@ -1740,6 +2090,7 @@ describe('dice', () => {
|
|
|
1740
2090
|
```bash
|
|
1741
2091
|
npx tsup # dist/public-api.{js,mjs,d.ts} + dist/umd/index.global.js
|
|
1742
2092
|
npm publish --access public # then in any Qodalis terminal: pkg add @qodalis/cli-dice
|
|
2093
|
+
# (pkg publish @qodalis/cli-dice lists it in the plugin marketplace after review)
|
|
1743
2094
|
```
|
|
1744
2095
|
|
|
1745
2096
|
```tsx
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qodalis/mcp-cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
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",
|