@qodalis/console 0.0.0-stage → 1.0.0-beta.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +505 -2
- package/dist/assets/Badge-DXfBhPf0.js +1 -0
- package/dist/assets/ButtonGroup-cc0CHohH.js +1 -0
- package/dist/assets/CommandsPage-TbFBAI3h.js +1 -0
- package/dist/assets/ConfigInput-Di-TZY52.js +3 -0
- package/dist/assets/ConfigPage-Bzdq0_q9.js +2 -0
- package/dist/assets/DataTable-_7R5GVOB.js +1 -0
- package/dist/assets/DependencyParts-BI02t_lf.js +3 -0
- package/dist/assets/EventsPage-DWr3pu8Q.js +2 -0
- package/dist/assets/LogsPage-DU8xJjql.js +2 -0
- package/dist/assets/NotificationsPage-DBrtr76S.js +1 -0
- package/dist/assets/PluginDetailsPage-MoFhh4KD.js +1 -0
- package/dist/assets/PluginsPage-CA5Mw42Q.js +32 -0
- package/dist/assets/TerminalPage-CoEN-T8C.js +192 -0
- package/dist/assets/commandInfo-B8tZOPKW.js +1 -0
- package/dist/assets/index-D3BEVhbx.css +32 -0
- package/dist/assets/index-DNbEWPIs.js +65 -0
- package/dist/assets/paging-CCKbuXJo.js +1 -0
- package/dist/assets/wasm/qodalis_cli_wasm_bg.wasm +0 -0
- package/dist/index.html +15 -0
- package/dist/qodalis-icon.svg +50 -0
- package/package.json +89 -4
package/README.md
CHANGED
|
@@ -1,3 +1,506 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Qodalis Console
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**The admin UI of every Qodalis CLI server.** You can watch your background jobs and look into each run, follow
|
|
4
|
+
the logs and events live, browse files, query data sources, manage API tokens and open a terminal on the server. The
|
|
5
|
+
same React app runs on the Node.js, .NET and Python servers at `/qcli/admin`.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@qodalis/console)
|
|
8
|
+
[](https://github.com/qodalis-solutions/qodalis-console/actions/workflows/build.yml)
|
|
9
|
+
|
|
10
|
+
<picture>
|
|
11
|
+
<source media="(prefers-color-scheme: light)" srcset="docs/screenshots/overview-light.webp">
|
|
12
|
+
<img alt="The Console overview: server health, resources over time and the jobs that need attention" src="docs/screenshots/overview-dark.webp">
|
|
13
|
+
</picture>
|
|
14
|
+
|
|
15
|
+
## Highlights
|
|
16
|
+
|
|
17
|
+
**Jobs, runs and retention**
|
|
18
|
+
- The jobs and their recent runs are on separate tabs, and the tab is kept in the URL. Filters fold away and show how many are set: search, status, group, time range, and tags picked from a multi-select with each tag in its own colour.
|
|
19
|
+
- Run statistics and charts: success rate, failures, average and p95 duration, runs over time, and the duration of each recent run.
|
|
20
|
+
- Each job's last runs show as small bars. A bar's tooltip shows the run's status, duration, error and last log lines, and a click opens the run.
|
|
21
|
+
- Run controls (trigger, pause or resume, stop, cancel) are one button group. Each row of the runs and history tables has its own group, with a ⋯ menu for less common actions.
|
|
22
|
+
- History retention per job (max age and max runs, separately for failed runs; overridden or global), and the last run of the history pruning job.
|
|
23
|
+
- Runs can be deleted one at a time, by result, or all finished runs. Each deletion is confirmed in a dialog that shows its progress.
|
|
24
|
+
- A job's settings are edited in a dialog: schedule or interval, retries, timeout, overlap policy, concurrency and tags.
|
|
25
|
+
|
|
26
|
+
**Logs, events and audit**
|
|
27
|
+
- Logs: level, text, service and time filters, a volume chart by level, older entries loaded when you scroll up, a live tail that can be paused, and collapsed exceptions.
|
|
28
|
+
- Events: the server's WebSocket event stream, with a readable summary of each event, and the connected clients.
|
|
29
|
+
- Audit: who did what to whom, an activity chart, the most frequent events and users, filters and CSV export.
|
|
30
|
+
|
|
31
|
+
**Data and files**
|
|
32
|
+
- Data explorer: a SQL editor (CodeMirror, highlighted in the source's dialect, with completion from the schema), templates, read-only and export badges, and "Ran as" when the server rewrote the query.
|
|
33
|
+
- Filesystem: browse, upload, download and delete files, with the folder kept in the URL.
|
|
34
|
+
|
|
35
|
+
**Server and access**
|
|
36
|
+
- Overview: health, uptime, memory, CPU and WebSocket clients over time, and failing jobs and errors that need attention.
|
|
37
|
+
- Terminal: the Qodalis CLI in the browser, signed in as you, with the server's commands and an interactive shell when the server enables one.
|
|
38
|
+
- Plugins: the installed server packages with their icons, plus command modules you can turn on and off. Commands: what is registered and what is used most.
|
|
39
|
+
- Users and API tokens: server sign-in, sessions and WebSocket tickets, and API tokens for MCP clients, CI and scripts, each scoped to permissions you choose.
|
|
40
|
+
- Config: the server's configuration, with its mutable settings editable.
|
|
41
|
+
|
|
42
|
+
**Everywhere**
|
|
43
|
+
- **Ctrl+K / ⌘K** opens a command palette for pages, jobs and commands, and searches the jobs, logs and audit log.
|
|
44
|
+
- 11 languages: English, Español, Français, Deutsch, Português, Italiano, 日本語, 한국어, 中文, Русский and Română.
|
|
45
|
+
- Works on phones: a top bar with a navigation drawer, 44px touch targets, dialogs as bottom sheets, and no horizontal scrolling.
|
|
46
|
+
- Shared, accessible controls: themed selects and multi-selects, menus, dialogs and confirmations, all usable from the keyboard.
|
|
47
|
+
- Fully themeable (dark, light or system), and the name and icon can be your own. Every page keeps its filters in the URL.
|
|
48
|
+
|
|
49
|
+
## Screenshots
|
|
50
|
+
|
|
51
|
+
| | |
|
|
52
|
+
| --- | --- |
|
|
53
|
+
|  **Jobs**: tabs, filters, coloured tags and a button group per job |  **Last runs**: a tooltip with the run's error, a click opens it |
|
|
54
|
+
|  **Job page**: settings, history retention, statistics and run durations |  **Run history**: Logs, Details, Run again, and Delete in the ⋯ menu |
|
|
55
|
+
|  **Recent runs**: runs over time and every job's runs |  **Plugins**: server packages with icons and command modules |
|
|
56
|
+
|  **Logs**: volume by level, filters and a live tail |  **Events**: the live stream and connected clients |
|
|
57
|
+
|  **Data explorer**: SQL editor and results |  **Terminal**: the Qodalis CLI, signed in as you |
|
|
58
|
+
|  **Filesystem**: browse, upload, download, delete |  **API tokens**: scoped tokens for MCP clients, CI and scripts |
|
|
59
|
+
|  **Audit**: who did what, when |  **Command palette**: Ctrl+K / ⌘K |
|
|
60
|
+
|
|
61
|
+
<p>
|
|
62
|
+
<img alt="The navigation drawer on a phone" src="docs/screenshots/mobile-drawer.webp" width="240">
|
|
63
|
+
|
|
64
|
+
<img alt="The jobs page on a phone" src="docs/screenshots/mobile-jobs.webp" width="240">
|
|
65
|
+
</p>
|
|
66
|
+
|
|
67
|
+
The screenshots come from the .NET demo server (60 rate-fetch jobs with history retention) and are regenerated with
|
|
68
|
+
`npm run screenshots` (see [Development](#development)).
|
|
69
|
+
|
|
70
|
+
## How it fits
|
|
71
|
+
|
|
72
|
+
You do not run the Console on its own. It ships as the npm package `@qodalis/console` (static files in
|
|
73
|
+
`dist/`), and the admin plugin of each Qodalis CLI server copies those files and serves them next to its API, at
|
|
74
|
+
`/qcli/admin` (see [How the servers pick up the Console](#how-the-servers-pick-up-the-console)).
|
|
75
|
+
|
|
76
|
+
| Repository | Role |
|
|
77
|
+
| --- | --- |
|
|
78
|
+
| [web-cli](https://github.com/qodalis-solutions/web-cli) | The browser terminal engine with Angular, React and Vue wrappers and plugins. The Console's Terminal page uses `@qodalis/react-cli`. |
|
|
79
|
+
| [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. Their admin plugins serve this Console and its API. |
|
|
80
|
+
| **qodalis-console** (formerly cli-server-dashboard) | This repository. |
|
|
81
|
+
| [mcp-cli](https://github.com/qodalis-solutions/mcp-cli) | Local MCP server that connects Claude Code to a CLI server. |
|
|
82
|
+
| [pwa-cli](https://github.com/qodalis-solutions/pwa-cli) | The CLI as an installable PWA and Android app. |
|
|
83
|
+
|
|
84
|
+
### What appears when
|
|
85
|
+
|
|
86
|
+
Terminal, Jobs, Filesystem and Audit appear only when the server provides them: the shell from
|
|
87
|
+
`GET /api/v1/qcli/capabilities` (`shell: true`), jobs, filesystem and audit from the admin status (`enabledFeatures`), or,
|
|
88
|
+
on servers whose status has no `enabledFeatures`, from the plugin list (`/plugins`). They are left out of the
|
|
89
|
+
sidebar, and a direct link to one of them shows "Not enabled on this server" instead of a page that would fail.
|
|
90
|
+
|
|
91
|
+
The Console keeps **one** events WebSocket for the whole session (not one per page). When it drops, it reconnects
|
|
92
|
+
after 1 s, 2 s, 4 s … up to 30 s; the delay starts over once a connection has stayed up for 10 seconds.
|
|
93
|
+
|
|
94
|
+
A failing page or panel shows its error in place, with **Retry**, instead of taking down the whole Console.
|
|
95
|
+
|
|
96
|
+
The charts use the servers' statistics endpoints (`/jobs/stats`, `/logs/histogram`, `/status/history`,
|
|
97
|
+
`/commands/stats`, servers since 1.0.0-beta.19); with older servers the Console counts what it loads, samples the
|
|
98
|
+
status itself, or leaves the chart out.
|
|
99
|
+
|
|
100
|
+
The Console keeps **one** events WebSocket for the whole session (not one per page). When it drops, it reconnects
|
|
101
|
+
after 1 s, 2 s, 4 s … up to 30 s; the delay starts over once a connection has stayed up for 10 seconds.
|
|
102
|
+
|
|
103
|
+
### Live updates
|
|
104
|
+
|
|
105
|
+
Pages follow the server events (`/ws/v1/qcli/events`, flat JSON `{type, timestamp, ...fields}`) and reload what they
|
|
106
|
+
show about 1.5 s after a burst of events, keeping the current rows until the new ones arrive:
|
|
107
|
+
|
|
108
|
+
| Page | Reloads on |
|
|
109
|
+
| --- | --- |
|
|
110
|
+
| Jobs | any `job:*`: the job list, the run statistics and chart, and the recent runs; `job:paused`/`resumed`/`stopped` change the job's status at once |
|
|
111
|
+
| Job detail | any `job:*` of that job (runs, `job:updated`, `job:runs-deleted`); waits while its settings are being edited |
|
|
112
|
+
| Overview | job runs chart on any `job:*`; the activity panel shows one readable, translated line per event (log entries left out) |
|
|
113
|
+
| Filesystem | `fs:changed` of an entry of the open folder (or of the folder itself) |
|
|
114
|
+
| Audit | `audit:recorded` matching the event, actor and user filters; on later pages it waits until you return to the first |
|
|
115
|
+
| Events | every event, with a one-line summary next to its JSON; connected clients on `session:*` |
|
|
116
|
+
| Logs | `log:entry` (a log line of the server): appended below the history at once, filtered like it, held while the tail is paused |
|
|
117
|
+
|
|
118
|
+
The events come from servers 1.0.0-beta.23; with older servers only the jobs events (`job:started`, `job:completed`,
|
|
119
|
+
...) arrive and the other pages reload when you ask them to.
|
|
120
|
+
|
|
121
|
+
### Server compatibility
|
|
122
|
+
|
|
123
|
+
The Console works with older servers and leaves out what they do not send:
|
|
124
|
+
|
|
125
|
+
| Feature | Needs servers |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| Job history retention (`historyRetention` on each job) and the history pruning job | 1.0.0-beta.28 |
|
|
128
|
+
| Run ids in the last runs of `GET /jobs/stats` (older servers: the Console finds the run by its start time among the job's last 50) | 1.0.0-beta.28 |
|
|
129
|
+
| Job tags | 1.0.0-beta.25 |
|
|
130
|
+
| Live events for every page (logs, filesystem, audit, sessions); running runs and max concurrent runs | 1.0.0-beta.23 |
|
|
131
|
+
| Deleting runs | 1.0.0-beta.21 |
|
|
132
|
+
| Statistics endpoints (job, log, status and command charts) | 1.0.0-beta.19 |
|
|
133
|
+
| Runs across jobs (Recent runs) | 1.0.0-beta.15 |
|
|
134
|
+
|
|
135
|
+
## Enabling it on a server
|
|
136
|
+
|
|
137
|
+
Each admin plugin mounts the API under `/api/v1/qcli` and the Console under `/qcli/admin`.
|
|
138
|
+
|
|
139
|
+
**Node.js** (`@qodalis/cli-server-plugin-admin`)
|
|
140
|
+
|
|
141
|
+
```typescript
|
|
142
|
+
import { createCliServer } from '@qodalis/cli-server-node';
|
|
143
|
+
import { CliAdminBuilder } from '@qodalis/cli-server-plugin-admin';
|
|
144
|
+
|
|
145
|
+
const { registry, builder, executor, eventSocketManager, mountPlugin } = createCliServer({ /* ... */ });
|
|
146
|
+
|
|
147
|
+
const adminPlugin = new CliAdminBuilder()
|
|
148
|
+
.setCredentials('admin', 'a-strong-password') // or .setAuthProvider(usersPlugin.serverAuth)
|
|
149
|
+
.build({ registry, eventSocketManager, builder, executor });
|
|
150
|
+
|
|
151
|
+
mountPlugin(adminPlugin);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**.NET** (`Qodalis.Cli.Plugin.Admin`)
|
|
155
|
+
|
|
156
|
+
```csharp
|
|
157
|
+
builder.Services.AddCli(cli =>
|
|
158
|
+
{
|
|
159
|
+
cli.AddAdmin();
|
|
160
|
+
});
|
|
161
|
+
|
|
162
|
+
// After UseWebSockets() and before MapControllers()
|
|
163
|
+
app.UseQodalisAdmin();
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
**Python** (`qodalis-cli-server-plugin-admin`)
|
|
167
|
+
|
|
168
|
+
```python
|
|
169
|
+
from qodalis_cli_admin import AdminBuildDeps, CliAdminBuilder
|
|
170
|
+
|
|
171
|
+
admin_plugin = (
|
|
172
|
+
CliAdminBuilder()
|
|
173
|
+
.set_credentials("admin", "a-strong-password") # or .set_users_plugin(users_plugin)
|
|
174
|
+
.build(AdminBuildDeps(
|
|
175
|
+
registry=result.registry,
|
|
176
|
+
event_socket_manager=result.event_socket_manager,
|
|
177
|
+
builder=result.builder,
|
|
178
|
+
))
|
|
179
|
+
)
|
|
180
|
+
result.mount_plugin(admin_plugin)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
Then open `http://<server>/qcli/admin`. See each server's admin plugin README for every option.
|
|
184
|
+
|
|
185
|
+
### Sign-in
|
|
186
|
+
|
|
187
|
+
| Server setup | How you sign in |
|
|
188
|
+
| --- | --- |
|
|
189
|
+
| With the users plugin (protected server) | A server account with the `admin:access` permission. Members of `admin` have it; grant it to another group with `groupmod ops --grant=admin:access`. |
|
|
190
|
+
| Without the users plugin | The admin plugin's own credentials, set in code or through the variables below. |
|
|
191
|
+
| Users plugin with an external auth adapter (`UseExternalAuth`) | The host application's own sign-in, see [Sign in with the host app's session](#sign-in-with-the-host-apps-session). The password form is not shown. |
|
|
192
|
+
|
|
193
|
+
| Variable | Default | Purpose |
|
|
194
|
+
| --- | --- | --- |
|
|
195
|
+
| `QCLI_ADMIN_USERNAME` | `admin` | Admin user name |
|
|
196
|
+
| `QCLI_ADMIN_PASSWORD` | `admin` | Admin password |
|
|
197
|
+
| `QCLI_ADMIN_JWT_SECRET` | random per start | Secret that signs Console tokens |
|
|
198
|
+
|
|
199
|
+
The servers log a warning at startup while the default credentials are in use. Change them for anything that is not a
|
|
200
|
+
local test.
|
|
201
|
+
|
|
202
|
+
On startup the Console asks `GET /api/v1/qcli/auth/mode` which sign-in to show. Servers without that endpoint
|
|
203
|
+
(404) or that can't be reached are treated as `password`.
|
|
204
|
+
|
|
205
|
+
### Sign in with the host app's session
|
|
206
|
+
|
|
207
|
+
When the server's users plugin delegates authentication to your application, `/auth/mode` answers
|
|
208
|
+
`{ "mode": "external", "signInUrl": "…" }` and the Console:
|
|
209
|
+
|
|
210
|
+
- shows **Sign in at `<signInUrl>`** with a **Retry** button instead of the username/password form (or, without a
|
|
211
|
+
`signInUrl`, tells users to sign in through the host application);
|
|
212
|
+
- goes to that screen on any 401 (an expired host token, for example);
|
|
213
|
+
- never sends or advertises the static `QCLI_ADMIN_USERNAME`/`QCLI_ADMIN_PASSWORD`: the server answers its login
|
|
214
|
+
endpoint with 501 in this mode.
|
|
215
|
+
|
|
216
|
+
**Handoff.** The host opens the Console with its bearer token in the URL fragment:
|
|
217
|
+
|
|
218
|
+
```ts
|
|
219
|
+
// In the host app, for a signed-in admin
|
|
220
|
+
window.location.href = `/qcli/admin/#token=${encodeURIComponent(accessToken)}`;
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
A fragment is never sent to servers or written to their logs. On startup the Console reads `#token=`, stores it as
|
|
224
|
+
its admin token (`localStorage['qcli_admin_token']`), removes it from the address bar with `history.replaceState`
|
|
225
|
+
(other fragment parameters are kept) and sends it as `Authorization: Bearer …` on every API call. The server's
|
|
226
|
+
external auth adapter validates it like any other request from the host. If the host's adapter authenticates with
|
|
227
|
+
its own cookie instead, the Console needs no handoff: **Retry** checks the session again.
|
|
228
|
+
|
|
229
|
+
Server side, set the sign-in page with the admin plugin's `SignInUrl` option (.NET:
|
|
230
|
+
`AddAdmin(o => o.SignInUrl = "https://app.example.com/sign-in")`): an absolute http(s) URL or a root-relative path.
|
|
231
|
+
|
|
232
|
+
### Security
|
|
233
|
+
|
|
234
|
+
- On protected servers the Console token is a server session: **Sign out** ends it
|
|
235
|
+
(`DELETE /api/v1/qcli/sessions/current`), and revoking the session elsewhere (`session-kick`, disabling the user)
|
|
236
|
+
signs the Console out on its next request.
|
|
237
|
+
- WebSocket connections (events, terminal) on protected servers never put the token in the URL. Each connection
|
|
238
|
+
first gets a single-use ticket from `POST /api/v1/qcli/sessions/ws-ticket`. Servers without the users plugin still
|
|
239
|
+
accept `?token=`.
|
|
240
|
+
- The Console is served from the server's own origin, so no CORS configuration is needed.
|
|
241
|
+
- `ssh` from the embedded terminal follows the server's remote shell policy; see the server READMEs.
|
|
242
|
+
- **Content-Security-Policy.** The built `index.html` carries a strict policy as a `<meta http-equiv>` tag
|
|
243
|
+
(`csp.ts`, added by `vite build` only, so `npm run dev` and HMR are unaffected):
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
default-src 'self'; script-src 'self' 'wasm-unsafe-eval' blob: https://unpkg.com https://cdn.jsdelivr.net;
|
|
247
|
+
style-src 'self' 'unsafe-inline'; img-src 'self' data: https://cdn.jsdelivr.net; font-src 'self';
|
|
248
|
+
connect-src 'self' https://plugins.qodalis.com https://registry.npmjs.org https://unpkg.com https://cdn.jsdelivr.net;
|
|
249
|
+
worker-src 'self'; frame-src 'none'; object-src 'none'; base-uri 'self'; form-action 'self'
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Plugins' pages run inside the Console with the signed-in admin's token, so every request stays on the server's
|
|
253
|
+
origin, apart from the read-only package hosts the embedded terminal's `pkg add` uses (the marketplace, the npm
|
|
254
|
+
registry, unpkg and jsDelivr): `fetch`, WebSockets (same-host `ws:`/`wss:` are covered by `'self'`), images,
|
|
255
|
+
beacons, forms, frames and scripts to or from any other origin are blocked. `'wasm-unsafe-eval'` lets the terminal run the CLI's WebAssembly;
|
|
256
|
+
`'unsafe-eval'` is not allowed. Consequence: images (branding icon) must be served by the server itself, be
|
|
257
|
+
`data:` URLs or come from jsDelivr (others fall back to the default icon). `frame-ancestors` has no effect in a meta tag: a server that wants to forbid framing
|
|
258
|
+
sends it as a response header.
|
|
259
|
+
- **Installing a Console plugin (`console:install`, or `dashboard:install` as servers before the rename call it) amounts to full admin**: its code runs in the Console page
|
|
260
|
+
with the signed-in admin's session, and can call every API that admin may. The policy above stops it from sending
|
|
261
|
+
data elsewhere, not from using the session. Install only from publishers you trust.
|
|
262
|
+
|
|
263
|
+
## Color scheme
|
|
264
|
+
|
|
265
|
+
Every color in the Console is a token, so you can match the Console to your own design. Set the scheme in the
|
|
266
|
+
admin plugin's options on the server; the same option shape works on all three servers.
|
|
267
|
+
|
|
268
|
+
```jsonc
|
|
269
|
+
{
|
|
270
|
+
"mode": "system", // "dark" (default), "light", or "system" to follow the browser
|
|
271
|
+
"light": { "primary": "#2a6bba", "background": "#f1f6fa" }, // any subset of the tokens below
|
|
272
|
+
"dark": { "primary": "#4f9be0", "background": "#0d1823" }
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
**Node.js**
|
|
277
|
+
|
|
278
|
+
```typescript
|
|
279
|
+
const adminPlugin = new CliAdminBuilder()
|
|
280
|
+
.setTheme({
|
|
281
|
+
mode: 'system',
|
|
282
|
+
light: { primary: '#2a6bba', primaryHover: '#1f5596', accent: '#2a6bba', background: '#f1f6fa',
|
|
283
|
+
backgroundAccent: '#f1f6fa', surface: '#ffffff', border: '#d9e3ec', text: '#142231', muted: '#5d6f82' },
|
|
284
|
+
dark: { primary: '#4f9be0', primaryHover: '#3f8ad3', onPrimary: '#0d1823', accent: '#4f9be0',
|
|
285
|
+
background: '#0d1823', backgroundAccent: '#0d1823', surface: '#13212f', border: '#22364a',
|
|
286
|
+
text: '#e6eef6', muted: '#93a6b9' },
|
|
287
|
+
})
|
|
288
|
+
.build({ registry, eventSocketManager, builder, executor });
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**.NET**
|
|
292
|
+
|
|
293
|
+
```csharp
|
|
294
|
+
cli.AddAdmin(o =>
|
|
295
|
+
{
|
|
296
|
+
o.Theme.Mode = AdminThemeMode.System;
|
|
297
|
+
o.Theme.Light = new AdminThemeColors { Primary = "#2a6bba", Background = "#f1f6fa", Text = "#142231" };
|
|
298
|
+
o.Theme.Dark = new AdminThemeColors { Primary = "#4f9be0", Background = "#0d1823", Surface = "#13212f" };
|
|
299
|
+
});
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
**Python**
|
|
303
|
+
|
|
304
|
+
```python
|
|
305
|
+
admin_plugin = (
|
|
306
|
+
CliAdminBuilder()
|
|
307
|
+
.set_theme({
|
|
308
|
+
"mode": "system",
|
|
309
|
+
"light": {"primary": "#2a6bba", "background": "#f1f6fa", "text": "#142231"},
|
|
310
|
+
"dark": {"primary": "#4f9be0", "background": "#0d1823", "surface": "#13212f"},
|
|
311
|
+
})
|
|
312
|
+
.build(deps)
|
|
313
|
+
)
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
Python also accepts snake_case token keys (`primary_hover`).
|
|
317
|
+
|
|
318
|
+
Each value must be a plain CSS color: hex (`#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`), a color function with numeric
|
|
319
|
+
arguments (`rgb()`, `rgba()`, `hsl()`, `hsla()`, `hwb()`, `lab()`, `lch()`, `oklab()`, `oklch()`) or a named color
|
|
320
|
+
(`white`, `transparent`). The server rejects anything else at startup (an unknown mode or token, `var()`, `url()`,
|
|
321
|
+
`;` and the like), so a theme cannot inject CSS. Translucent values work: the default dark surfaces are white at a few
|
|
322
|
+
percent opacity over the background.
|
|
323
|
+
|
|
324
|
+
How it reaches the Console: the server publishes the validated scheme at `GET /qcli/admin/theme.json` (public, like
|
|
325
|
+
the Console files, because the sign-in page uses it too), for example
|
|
326
|
+
`{"mode":"light","dark":{},"light":{"primary":"#2a6bba"}}`. The Console loads it before its first render and
|
|
327
|
+
writes the tokens as CSS custom properties on `:root`. Tokens you leave out, a missing file or an invalid value keep the
|
|
328
|
+
defaults below. The page shows the dark or light set according to `mode`; with `system` it follows the browser's
|
|
329
|
+
`prefers-color-scheme` and switches live.
|
|
330
|
+
|
|
331
|
+
The defaults match the Qodalis CLI panel: its grays, indigo accent with the violet glow, and status colors in dark; the same palette for light backgrounds in light.
|
|
332
|
+
|
|
333
|
+
| Token | CSS variable | Used for | Dark default | Light default |
|
|
334
|
+
| --- | --- | --- | --- | --- |
|
|
335
|
+
| `primary` | `--qcli-primary` | Primary buttons, active navigation, toggles, focus rings | `#818cf8` | `#4f46e5` |
|
|
336
|
+
| `primaryHover` | `--qcli-primary-hover` | Primary buttons on hover | `#a5b4fc` | `#4338ca` |
|
|
337
|
+
| `onPrimary` | `--qcli-on-primary` | Text and icons on `primary` | `#111827` | `#ffffff` |
|
|
338
|
+
| `accent` | `--qcli-accent` | Highlighted text: links, command names, active items | `#a78bfa` | `#7c3aed` |
|
|
339
|
+
| `background` | `--qcli-background` | Page background | `#111827` | `#f9fafb` |
|
|
340
|
+
| `backgroundAccent` | `--qcli-background-accent` | Start of the page background gradient (set it to `background` for a flat page) | `#1f2937` | `#eef2ff` |
|
|
341
|
+
| `sidebar` | `--qcli-sidebar` | Sidebar background | `#1f2937` | `#ffffff` |
|
|
342
|
+
| `surface` | `--qcli-surface` | Cards, panels and tables | `rgba(255, 255, 255, 0.04)` | `#ffffff` |
|
|
343
|
+
| `popover` | `--qcli-popover` | Dialogs and dropdown menus (opaque) | `#1f2937` | `#ffffff` |
|
|
344
|
+
| `control` | `--qcli-control` | Inputs, secondary buttons, chips | `rgba(255, 255, 255, 0.06)` | `rgba(17, 24, 39, 0.05)` |
|
|
345
|
+
| `controlHover` | `--qcli-control-hover` | Inputs and secondary buttons on hover | `rgba(255, 255, 255, 0.1)` | `rgba(17, 24, 39, 0.1)` |
|
|
346
|
+
| `border` | `--qcli-border` | Borders and dividers | `#374151` | `#e5e7eb` |
|
|
347
|
+
| `overlay` | `--qcli-overlay` | Backdrop behind dialogs | `rgba(0, 0, 0, 0.6)` | `rgba(17, 24, 39, 0.45)` |
|
|
348
|
+
| `heading` | `--qcli-heading` | Headings and values | `#ffffff` | `#111827` |
|
|
349
|
+
| `text` | `--qcli-text` | Body text | `rgba(255, 255, 255, 0.87)` | `#1f2937` |
|
|
350
|
+
| `muted` | `--qcli-muted` | Secondary text and labels | `rgba(255, 255, 255, 0.6)` | `#4b5563` |
|
|
351
|
+
| `subtle` | `--qcli-subtle` | Hints, placeholders, timestamps | `rgba(255, 255, 255, 0.4)` | `#6b7280` |
|
|
352
|
+
| `success` | `--qcli-success` | Success states | `#3fb950` | `#1a7f37` |
|
|
353
|
+
| `warning` | `--qcli-warning` | Warning states | `#f0883e` | `#bc4c00` |
|
|
354
|
+
| `error` | `--qcli-error` | Errors and destructive actions | `#f85149` | `#cf222e` |
|
|
355
|
+
| `info` | `--qcli-info` | Informational states | `#58a6ff` | `#0969da` |
|
|
356
|
+
|
|
357
|
+
The embedded terminal keeps the CLI's own terminal theme (change it there with the `theme` command).
|
|
358
|
+
|
|
359
|
+
## Name and icon
|
|
360
|
+
|
|
361
|
+
By default the Console is "Qodalis Console" with the Qodalis Solutions logo (`public/qodalis-icon.svg`). An
|
|
362
|
+
application that ships it under its own name sets the admin plugin's branding: the name and icon of the browser tab,
|
|
363
|
+
the sidebar and the sign-in page, and the name its terminal shows in the welcome banner.
|
|
364
|
+
|
|
365
|
+
```csharp
|
|
366
|
+
cli.AddAdmin(o => { o.Branding.Name = "RateBell"; o.Branding.IconUrl = "/favicon.svg"; o.Branding.CliName = "RateBell CLI"; });
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
```ts
|
|
370
|
+
new CliAdminBuilder().setBranding({ name: 'RateBell', iconUrl: '/favicon.svg', cliName: 'RateBell CLI' });
|
|
371
|
+
```
|
|
372
|
+
|
|
373
|
+
```python
|
|
374
|
+
CliAdminBuilder().set_branding({"name": "RateBell", "icon_url": "/favicon.svg", "cli_name": "RateBell CLI"})
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
The icon is an absolute http(s) URL, a root-relative path or a base64 `data:image` URL (the Console's
|
|
378
|
+
Content-Security-Policy shows only images of the server's own origin, jsDelivr and `data:` URLs, see [Security](#security));
|
|
379
|
+
the servers validate the
|
|
380
|
+
values at startup. They reach the Console as `branding` in `theme.json`
|
|
381
|
+
(`{ "name": "RateBell", "icon": "/favicon.svg", "cli": { "name": "RateBell CLI" } }`), read before the first render;
|
|
382
|
+
the Console drops anything malformed and falls back to the Qodalis logo when a custom icon fails to load. The
|
|
383
|
+
terminal's copyright line, docs link and `version` stay Qodalis CLI's (`version` adds the name).
|
|
384
|
+
|
|
385
|
+
### Using the tokens in the Console code
|
|
386
|
+
|
|
387
|
+
The tokens live in `src/theme/tokens.ts` and Tailwind exposes each one as a color (`bg-primary`, `text-muted`,
|
|
388
|
+
`border-border`, `bg-error/10`); opacity modifiers work with any color format. The stock Tailwind palette is turned
|
|
389
|
+
off, and `npm test` fails on a stock color class (`text-slate-400`) or a literal color in a component, so new UI stays
|
|
390
|
+
themeable.
|
|
391
|
+
|
|
392
|
+
## Admin API
|
|
393
|
+
|
|
394
|
+
The admin plugins expose these endpoints under `/api/v1/qcli`. Everything except `/auth/mode` and login requires a
|
|
395
|
+
token.
|
|
396
|
+
|
|
397
|
+
| Endpoint | Method | Purpose |
|
|
398
|
+
| --- | --- | --- |
|
|
399
|
+
| `/auth/mode` | GET | Which sign-in to show: `{ "mode": "password" \| "external", "signInUrl": string \| null }` |
|
|
400
|
+
| `/auth/login` | POST | Sign in, returns a token (501 with `code: "EXTERNAL_AUTH"` in external mode) |
|
|
401
|
+
| `/auth/me` | GET | Current user |
|
|
402
|
+
| `/status` | GET | Health, uptime, memory, connections, features |
|
|
403
|
+
| `/config` | GET, PUT | Read configuration sections, update mutable settings |
|
|
404
|
+
| `/plugins` | GET | Registered modules and their processors |
|
|
405
|
+
| `/plugins/:id/toggle` | POST | Enable or disable a module |
|
|
406
|
+
| `/logs` | GET | Query logs (`level`, `search`, `limit`, `offset`) |
|
|
407
|
+
| `/ws/clients` | GET | Connected WebSocket clients |
|
|
408
|
+
|
|
409
|
+
The other pages use the standard server API (`/api/v1/qcli/commands`, `/api/v1/qcli/jobs`, `/api/qcli/fs/*`,
|
|
410
|
+
`/api/v1/qcli/capabilities`, `/ws/v1/qcli/events`).
|
|
411
|
+
|
|
412
|
+
## Languages
|
|
413
|
+
|
|
414
|
+
English, Español, Français, Deutsch, Português, Italiano, 日本語, 한국어, 中文 and Русский. The Console starts in the
|
|
415
|
+
browser's language (English otherwise); the language picker at the bottom of the sidebar (or the navigation drawer on phones) changes it and the choice is remembered per
|
|
416
|
+
browser. Dates, numbers and relative times follow the language, and the embedded terminal switches too through the CLI
|
|
417
|
+
language packs (`@qodalis/cli-lang-*`).
|
|
418
|
+
|
|
419
|
+
To add or change text:
|
|
420
|
+
|
|
421
|
+
- Messages live in `src/i18n/messages/<area>.ts`, one file per page with all languages side by side. English is the
|
|
422
|
+
source; a missing translation falls back to English.
|
|
423
|
+
- Read them with `const { t } = useI18n()` and `t('jobs.title')`. Keys are type-checked, so a typo fails the build.
|
|
424
|
+
- Placeholders: `'{count} entries shown'` with `t('logs.shown', { count })`. Plurals: define `key_one` and `key_other`
|
|
425
|
+
(plus `key_few` / `key_many` where the language needs them) and pass `count`.
|
|
426
|
+
- Dates and numbers: `formatDate`, `formatRelative` and `formatNumber` from the same hook.
|
|
427
|
+
- A new language goes into `src/i18n/locales.ts` and gets a block in each message file.
|
|
428
|
+
|
|
429
|
+
## Development
|
|
430
|
+
|
|
431
|
+
CI builds with Node.js 22.
|
|
432
|
+
|
|
433
|
+
| Command | What it does |
|
|
434
|
+
| --- | --- |
|
|
435
|
+
| `npm install` | Install dependencies |
|
|
436
|
+
| `npm run dev` | Vite dev server; proxies `/api`, `/ws` and `/qcli/admin/theme.json` to `http://localhost:8047` (Node server) |
|
|
437
|
+
| `npm run dev:node` / `dev:dotnet` / `dev:python` | Dev server proxied to port 8047 / 8046 / 8048 |
|
|
438
|
+
| `npm run build` | Type-check and build into `dist/` |
|
|
439
|
+
| `npm test` | Tests (Vitest, Testing Library, jsdom): the pages, the shared components (select, menu, dialog, button group, tooltip) and their keyboard support, theme parsing and validation, the check that components use only theme tokens, sign-in modes and the `#token=` handoff, the events socket and its backoff, feature gating |
|
|
440
|
+
| `npm run lint` | ESLint |
|
|
441
|
+
| `npm run screenshots` | The README screenshots, into `docs/screenshots/` (see below) |
|
|
442
|
+
| `npm run preview` | Serve the production build |
|
|
443
|
+
|
|
444
|
+
Any other target works with `VITE_PROXY_TARGET=http://host:port npm run dev`. The app is built for the base path
|
|
445
|
+
`/qcli/admin/`.
|
|
446
|
+
|
|
447
|
+
**Screenshots.** `npm run screenshots` (Playwright) signs in to a running server and saves every screenshot of this
|
|
448
|
+
README as WebP: desktop at 1440×900, phone at 390×844, both at 2x, and the overview in both color schemes, cut above its "Needs attention" list. Build first
|
|
449
|
+
(`npm run build`), because the server serves the Console from the sibling `dist`. Set `QCLI_URL` for the server
|
|
450
|
+
(default `http://localhost:8046`, the .NET demo), `QCLI_ADMIN_URL` to shoot another build (for example the dev server
|
|
451
|
+
at `http://localhost:5173/qcli/admin/`), `QCLI_USER` and `QCLI_PASSWORD` (default `root`/`root`), and `ONLY` for some
|
|
452
|
+
shots (`ONLY=jobs,logs`). An empty filesystem gets a few sample files first. Two API tokens are created for the tokens
|
|
453
|
+
shot and revoked right after it. The first run on a machine needs `npx playwright install chromium`.
|
|
454
|
+
|
|
455
|
+
`dev` and `build` first copy the CLI's optional WebAssembly module from `node_modules/@qodalis/cli` into
|
|
456
|
+
`public/assets/wasm/` (`scripts/copy-wasm.mjs`, git-ignored). Without it the terminal falls back to JavaScript.
|
|
457
|
+
|
|
458
|
+
### How the servers pick up the Console
|
|
459
|
+
|
|
460
|
+
Each admin plugin copies the Console at build time. It prefers a sibling checkout of this repository
|
|
461
|
+
(`../qodalis-console/dist`, then `../cli-server-dashboard/dist`, the folder's name before the rename; run
|
|
462
|
+
`npm run build` here first) and otherwise uses the published npm package: `@qodalis/console`, then
|
|
463
|
+
`@qodalis/cli-server-dashboard`. Module builds are found the same way (`…/modules/<name>/dist`,
|
|
464
|
+
`@qodalis/console-module-<name>`, then `@qodalis/cli-dashboard-module-<name>`).
|
|
465
|
+
|
|
466
|
+
| Server | Copied by | Served from |
|
|
467
|
+
| --- | --- | --- |
|
|
468
|
+
| Node.js | `npm run build` in `plugins/admin` (`prebuild` runs `scripts/copy-console.js`) | `plugins/admin/console/` |
|
|
469
|
+
| Python | `python scripts/copy_console.py` in `plugins/admin`; also resolved at runtime from `node_modules` or the sibling checkout | `plugins/admin/qodalis_cli_admin/console/` |
|
|
470
|
+
| .NET | `dotnet build` of `Qodalis.Cli.Plugin.Admin` (runs `npm install` itself when neither source exists) | Embedded in the plugin assembly (staged in `wwwroot/admin/`) |
|
|
471
|
+
|
|
472
|
+
Servers released before the rename use the old script and folder names (`copy-dashboard`, `dashboard/`).
|
|
473
|
+
|
|
474
|
+
The servers' Docker images install the npm package, so they ship the published version. After publishing a new
|
|
475
|
+
Console, refresh the admin plugins' lockfiles.
|
|
476
|
+
|
|
477
|
+
## Developer portal (`portal/`)
|
|
478
|
+
|
|
479
|
+
The repository also holds `@qodalis/cli-server-portal`, the developer portal the servers' portal plugin serves
|
|
480
|
+
(guides and an API reference). It is an npm workspace that reuses the Console's theme and components:
|
|
481
|
+
`npm test -w portal`, `npm run build -w portal` (into `portal/dist/`). See [portal/README.md](portal/README.md).
|
|
482
|
+
|
|
483
|
+
## Extensions and the kit (`kit/`)
|
|
484
|
+
|
|
485
|
+
Plugins add their own pages to the Console: the server lists them (`GET /api/v1/qcli/console/extensions`), the
|
|
486
|
+
Console puts them in its navigation and mounts each one's ES module at `/x/<id>`. Pages are built with
|
|
487
|
+
`@qodalis/console-kit`, the workspace in `kit/` that also holds the components the Console itself
|
|
488
|
+
uses, so they share its look, theme and languages. Contract: [docs/extensions.md](docs/extensions.md); how to write
|
|
489
|
+
one: [kit/README.md](kit/README.md); an example: `kit/example/` (`npm run build:example -w kit`).
|
|
490
|
+
|
|
491
|
+
## Releases
|
|
492
|
+
|
|
493
|
+
Pull requests go into `develop`; CI (`build.yml`) runs `npm ci`, `npm run lint`, then the tests and the build of the
|
|
494
|
+
Console, the portal and the kit (with its example extension). A push to `main` publishes the packages' versions to npm
|
|
495
|
+
(`publish.yml`: `@qodalis/console`, `@qodalis/cli-server-portal`, `@qodalis/console-kit` and every
|
|
496
|
+
`@qodalis/console-module-<name>`), skipping versions that already exist.
|
|
497
|
+
|
|
498
|
+
**Old package names.** Until the rename to Qodalis Console the packages were `@qodalis/cli-server-dashboard`,
|
|
499
|
+
`@qodalis/cli-server-dashboard-kit` and `@qodalis/cli-dashboard-module-<name>`. `publish.yml` publishes each release
|
|
500
|
+
under those names too (`node scripts/publish-legacy.mjs --publish`: the same contents with the old name and a README
|
|
501
|
+
note; a dry run without `--publish`, which `build.yml` runs), so hosts that still install them get it. Once the
|
|
502
|
+
servers install the new names, deprecate the old ones with the `npm deprecate` commands the script prints.
|
|
503
|
+
|
|
504
|
+
## Tech stack
|
|
505
|
+
|
|
506
|
+
React 18, TypeScript, Vite, Tailwind CSS, React Router, CodeMirror 6, `@qodalis/react-cli`; Vitest and Testing Library for tests, Playwright for the screenshots.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{j as r}from"./index-DNbEWPIs.js";const t={success:"bg-success/15 text-success border-success/30",warning:"bg-warning/15 text-warning border-warning/30",error:"bg-error/15 text-error border-error/30",info:"bg-info/15 text-info border-info/30",neutral:"bg-subtle/15 text-muted border-subtle/30"};function a({variant:e,children:s,dot:n}){return r.jsxs("span",{className:`inline-flex items-center gap-1.5 px-2 py-0.5 rounded-full text-[11px] font-medium border ${t[e]}`,children:[n&&r.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-current"}),s]})}export{a as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a9 as x,j as r,q as u,ca as b}from"./index-DNbEWPIs.js";const a={default:"text-text hover:bg-control-hover",primary:"text-accent hover:bg-primary/15",success:"text-success hover:bg-success/15",warning:"text-warning hover:bg-warning/15",danger:"text-error hover:bg-error/15"},i="inline-flex items-center justify-center gap-1.5 min-h-11 min-w-11 sm:min-h-8 sm:min-w-8 px-2.5 text-xs font-medium whitespace-nowrap transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-primary disabled:opacity-50 disabled:cursor-not-allowed",g={always:"",sm:"sr-only sm:not-sr-only",xl:"sr-only xl:not-sr-only",never:"sr-only"};function p({items:o,label:l,labels:n="always",overflow:s=[],className:t=""}){const c=x();return o.length===0&&s.length===0?null:r.jsxs("div",{role:"group","aria-label":l,className:`inline-flex items-stretch rounded-lg border border-border/75 bg-control divide-x divide-border/75 overflow-hidden ${t}`,children:[o.map(e=>{const d=e.disabled||e.loading;return r.jsxs("button",{type:"button",onClick:e.onClick,disabled:d,"aria-busy":e.loading||void 0,"aria-pressed":e.pressed,"aria-label":e.ariaLabel??(n==="always"?void 0:e.label),title:n==="always"?void 0:e.label,className:`${i} ${a[e.tone??"default"]} ${e.pressed?"bg-primary/15":""}`,children:[e.loading?r.jsx(u,{}):e.icon&&r.jsx("span",{"aria-hidden":!0,className:"inline-flex",children:e.icon}),r.jsx("span",{className:g[n],children:e.label})]},e.key)}),s.length>0&&r.jsx(b,{items:s,label:c("moreActions"),align:"end",buttonClassName:`${i} ${a.default}`,children:r.jsxs("svg",{"aria-hidden":!0,width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:[r.jsx("circle",{cx:"5",cy:"12",r:"2"}),r.jsx("circle",{cx:"12",cy:"12",r:"2"}),r.jsx("circle",{cx:"19",cy:"12",r:"2"})]})})]})}export{p as B};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as j,j as e,a as E,b as q,P as F,S as T,C as M,s as V,c as I,d as O,e as U,E as _,f as H,g as z,r as D,h as B,A as G}from"./index-DNbEWPIs.js";import{d as J,C as R,f as K,m as Q,r as W,h as X,c as Y}from"./commandInfo-B8tZOPKW.js";const k="text-[10px] text-subtle uppercase tracking-wider font-medium mb-1.5",f="px-3 py-2 text-left text-[10px] text-subtle uppercase tracking-wide font-medium";function Z({command:s,aliases:r}){const{t:l}=j();return r!=null&&r.length?e.jsx(R,{items:r.map(o=>({label:o,title:l("commands.alias")})),max:2,label:l("commands.aliases"),title:l("commands.aliasesOf",{command:s}),chipClassName:"font-mono text-[11px] px-1.5 py-0.5 rounded bg-control text-muted border border-border/75"}):null}function ee({command:s,permissions:r}){const{t:l}=j();return r!=null&&r.length?e.jsx(R,{items:r,max:2,label:l("commands.colPermissions"),title:l("commands.permissionsOf",{command:s}),chipClassName:"font-mono text-[11px] px-1.5 py-0.5 rounded bg-primary/10 text-accent border border-primary/25 whitespace-nowrap"}):e.jsx("span",{className:"text-subtle","aria-label":l("commands.noPermissions"),children:"—"})}function se({param:s}){var l,o,n;const{t:r}=j();return e.jsxs("tr",{className:"border-b border-border/50 last:border-0 align-top",children:[e.jsxs("td",{className:"px-3 py-1.5 font-mono text-xs text-accent whitespace-nowrap",children:[s.name,(l=s.aliases)!=null&&l.length?e.jsxs("span",{className:"text-subtle",children:[" (",s.aliases.join(", "),")"]}):null]}),e.jsx("td",{className:"px-3 py-1.5 text-xs text-muted",children:s.type}),e.jsxs("td",{className:"px-3 py-1.5 text-xs text-muted",children:[s.description,(o=s.examples)!=null&&o.length?e.jsxs("span",{className:"block mt-0.5 text-subtle",children:[r("commands.forExample")," ",s.examples.map((d,i)=>e.jsxs("span",{children:[i>0&&", ",e.jsx("code",{className:"font-mono text-[11px] text-accent",children:d})]},`${d}-${i}`))]}):null]}),e.jsx("td",{className:"px-3 py-1.5 text-xs",children:s.required?e.jsx("span",{className:"text-error font-medium",children:r("commands.yes")}):e.jsx("span",{className:"text-subtle",children:r("commands.no")})}),e.jsx("td",{className:"px-3 py-1.5 text-xs font-mono text-muted",children:K(s.defaultValue)}),e.jsx("td",{className:"px-3 py-1.5 text-xs",children:(n=s.allowedValues)!=null&&n.length?e.jsx("span",{className:"flex flex-wrap gap-1",children:s.allowedValues.map(d=>e.jsx("span",{className:"font-mono text-[11px] px-1.5 py-0.5 rounded bg-primary/10 text-accent border border-primary/25",children:d},d))}):e.jsx("span",{className:"text-subtle",children:r("commands.anyValue")})})]})}function te({cmd:s}){const{t:r}=j(),l=J(s.documentation);return e.jsxs(e.Fragment,{children:[l.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:k,children:r("commands.documentation")}),e.jsx("div",{className:"space-y-2 text-sm text-text max-w-3xl",children:l.map((o,n)=>e.jsx("p",{className:"whitespace-pre-line",children:o},n))})]}),s.examples&&s.examples.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:k,children:r("commands.examples")}),e.jsx("ul",{className:"bg-surface/75 border border-border/75 rounded-lg divide-y divide-border/50",children:s.examples.map((o,n)=>e.jsxs("li",{className:"px-3 py-2 flex flex-col sm:flex-row sm:items-baseline gap-x-4 gap-y-0.5",children:[e.jsx("code",{className:"font-mono text-xs text-accent whitespace-pre-wrap break-all",children:o.command}),o.description&&e.jsx("span",{className:"text-xs text-muted",children:o.description})]},`${o.command}-${n}`))})]}),s.parameters&&s.parameters.length>0&&e.jsxs("div",{className:"mb-3",children:[e.jsx("div",{className:k,children:r("commands.parameters")}),e.jsx("div",{className:"bg-surface/75 border border-border/75 rounded-lg overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border/75",children:[e.jsx("th",{className:f,children:r("commands.colName")}),e.jsx("th",{className:f,children:r("commands.colType")}),e.jsx("th",{className:f,children:r("commands.colDescription")}),e.jsx("th",{className:f,children:r("commands.colRequired")}),e.jsx("th",{className:f,children:r("commands.colDefault")}),e.jsx("th",{className:f,children:r("commands.colAllowed")})]})}),e.jsx("tbody",{children:s.parameters.map(o=>e.jsx(se,{param:o},o.name))})]})})]})]})}async function ae(){try{const s=await B();return Array.isArray(s==null?void 0:s.commands)?s:null}catch(s){if(s instanceof G&&(s.status===404||s.status===501))return null;throw s}}function A({cmd:s,depth:r=0,usage:l,search:o=""}){var N;const{t:n,formatNumber:d}=j(),i=W(s,o),[x,g]=D.useState(i),[h,b]=D.useState(i),a=X(s);i!==h&&(b(i),i&&g(!0));const p=r*16;return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{className:`border-b border-border/50 last:border-0 ${a?"cursor-pointer hover:bg-control":""}`,onClick:()=>a&&g(!x),children:[e.jsx("td",{className:"px-4 py-3",children:e.jsxs("div",{className:"flex flex-wrap items-center gap-2",style:{paddingLeft:`${p}px`},children:[a?e.jsxs("button",{type:"button",onClick:c=>{c.stopPropagation(),g(!x)},"aria-expanded":x,className:"inline-flex items-center gap-2 rounded focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/60",children:[e.jsx("span",{"aria-hidden":!0,className:`text-subtle transition-transform text-xs ${x?"rotate-90":""}`,children:"▶"}),s.icon&&e.jsx("span",{"aria-hidden":!0,children:s.icon}),e.jsx("span",{className:"font-mono text-sm text-accent",children:s.command})]}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"w-[0.6rem]","aria-hidden":!0}),s.icon&&e.jsx("span",{"aria-hidden":!0,children:s.icon}),e.jsx("span",{className:"font-mono text-sm text-accent",children:s.command})]}),e.jsx(Z,{command:s.command,aliases:s.aliases})]})}),e.jsx("td",{className:"px-4 py-3 text-sm text-muted",children:s.description||"—"}),e.jsx("td",{className:"px-4 py-3 text-xs text-subtle font-mono",children:Y(s)??"—"}),e.jsx("td",{className:"px-4 py-3 text-xs text-subtle text-center",children:d(((N=s.parameters)==null?void 0:N.length)??0)}),e.jsx("td",{className:"px-4 py-3 text-xs",children:e.jsx(ee,{command:s.command,permissions:s.requiredPermissions})}),l&&r===0&&(()=>{const c=l.get(s.command.toLowerCase());return e.jsxs(e.Fragment,{children:[e.jsx("td",{className:"px-4 py-3 text-xs text-right tabular-nums text-text",children:c?d(c.executions):"—"}),e.jsx("td",{className:`px-4 py-3 text-xs text-right tabular-nums ${c!=null&&c.failures?"text-error":"text-subtle"}`,children:c?d(c.failures):"—"})]})})(),l&&r>0&&e.jsxs(e.Fragment,{children:[e.jsx("td",{}),e.jsx("td",{})]})]}),x&&a&&e.jsx("tr",{className:"border-b border-border/50",children:e.jsxs("td",{colSpan:l?7:5,className:"px-4 py-3 bg-surface/50",children:[e.jsx("div",{className:"sticky left-4 max-w-[calc(100vw-4.5rem)] md:static md:max-w-none",children:e.jsx(te,{cmd:s})}),s.processors&&s.processors.length>0&&e.jsxs("div",{children:[e.jsx("div",{className:"text-[10px] text-subtle uppercase tracking-wider font-medium mb-1.5",children:n("commands.subCommands")}),e.jsx("div",{className:"bg-surface/75 border border-border/75 rounded-lg overflow-x-auto",children:e.jsxs("table",{className:"w-full",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border/75",children:[e.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-subtle uppercase tracking-wide font-medium",children:n("commands.colCommand")}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-subtle uppercase tracking-wide font-medium",children:n("commands.colDescription")}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-subtle uppercase tracking-wide font-medium",children:n("commands.colModule")}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-subtle uppercase tracking-wide font-medium text-center",children:n("commands.colParams")}),e.jsx("th",{className:"px-3 py-2 text-left text-[10px] text-subtle uppercase tracking-wide font-medium",children:n("commands.colPermissions")})]})}),e.jsx("tbody",{children:s.processors.map(c=>e.jsx(A,{cmd:c,depth:1,search:o},c.command))})]})})]})]})})]})}function le(){const{data:s,loading:r,error:l,refetch:o}=E(z,[]),{data:n,loading:d,refetch:i}=E(ae,[]),[x,g]=q(),h=x.get("q")??"",b=["executions","failures"].find(t=>t===x.get("sort"))??"name",{t:a,formatNumber:p,formatDate:N,formatRelative:c}=j(),v=(t,m)=>g(w=>{const C=new URLSearchParams(w);return m?C.set(t,m):C.delete(t),C},{replace:!0}),u=n?new Map(n.commands.map(t=>[t.command.toLowerCase(),t])):void 0,P=(t,m)=>{var w;return((w=u==null?void 0:u.get(t.command.toLowerCase()))==null?void 0:w[m])??0},S=(s?s.filter(t=>Q(t,h)):[]).sort((t,m)=>b==="name"||!u?t.command.localeCompare(m.command):P(m,b)-P(t,b)||t.command.localeCompare(m.command)),y=n?n.commands.filter(t=>t.executions>0).slice(0,8):[],L=n?n.commands.reduce((t,m)=>t+m.executions,0):0,$=n?n.commands.reduce((t,m)=>t+m.failures,0):0;return e.jsxs("div",{children:[e.jsx(F,{title:a("nav.commands"),subtitle:s?a("commands.subtitle",{count:s.length}):a("common.loading"),actions:e.jsx("button",{onClick:()=>{o(),i()},className:"px-3 py-1.5 text-xs bg-control hover:bg-control-hover text-text rounded-lg transition-colors",children:a("common.refresh")})}),e.jsxs("div",{className:"p-4 sm:p-6 space-y-4",children:[d&&!n&&e.jsx(T,{height:150}),n&&e.jsx(M,{title:a("commands.usage"),note:a("commands.usageSince",{time:N(n.since)}),legend:e.jsx(I,{items:[{label:a("commands.succeeded"),color:"var(--qcli-primary)",value:p(L-$)},{label:a("commands.failed"),color:"var(--qcli-error)",value:p($)}]}),children:y.length===0?e.jsx("div",{className:"text-sm text-subtle",children:a("commands.noUsage")}):e.jsx("ul",{className:"space-y-2",children:y.map(t=>e.jsx("li",{children:e.jsxs("button",{onClick:()=>v("q",t.command),className:"w-full grid grid-cols-[minmax(80px,160px)_1fr_auto] items-center gap-3 text-xs group",title:`${t.command}: ${p(t.executions)} · ${a("commands.failed")} ${p(t.failures)} · ${V(t.avgDuration)}${t.lastExecutedAt?` · ${c(t.lastExecutedAt)}`:""}`,children:[e.jsx("span",{className:"font-mono text-left truncate text-accent group-hover:underline",children:t.command}),e.jsxs("span",{className:"flex h-3 gap-[2px]","aria-hidden":!0,children:[e.jsx("span",{className:"h-full rounded-l-sm bg-primary",style:{width:`${(t.executions-t.failures)/y[0].executions*100}%`}}),t.failures>0&&e.jsx("span",{className:"h-full rounded-r-sm bg-error",style:{width:`${t.failures/y[0].executions*100}%`}})]}),e.jsxs("span",{className:"tabular-nums text-muted text-right w-24",children:[p(t.executions),t.failures>0&&e.jsxs("span",{className:"text-error",children:[" · ",p(t.failures)]})]})]})},t.command))})}),e.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[e.jsx("input",{type:"search",placeholder:a("commands.searchPlaceholder"),"aria-label":a("commands.searchPlaceholder"),value:h,onChange:t=>v("q",t.target.value||null),className:"w-full max-w-sm px-3 py-2 text-sm bg-control border border-border rounded-lg text-text placeholder-subtle focus:outline-none focus:border-primary/50"}),u&&e.jsx(O,{label:a("commands.sort"),size:"md",options:[{value:"name",label:a("commands.sortName")},{value:"executions",label:a("commands.sortExecutions")},{value:"failures",label:a("commands.sortFailures")}],value:b,onChange:t=>v("sort",t==="name"?null:t)})]}),r&&!s&&e.jsx(U,{rows:8,columns:n?7:5,label:a("commands.loadingCommands")}),l&&e.jsx(_,{error:l,onRetry:o}),s&&!l&&e.jsxs("div",{className:"bg-surface border border-border rounded-xl overflow-x-auto",children:[e.jsxs("table",{className:"w-full text-sm",children:[e.jsx("thead",{children:e.jsxs("tr",{className:"border-b border-border/75",children:[e.jsx("th",{className:"px-4 py-3 text-left text-xs text-subtle font-medium uppercase tracking-wide",children:a("commands.colCommand")}),e.jsx("th",{className:"px-4 py-3 text-left text-xs text-subtle font-medium uppercase tracking-wide",children:a("commands.colDescription")}),e.jsx("th",{className:"px-4 py-3 text-left text-xs text-subtle font-medium uppercase tracking-wide",children:a("commands.colModule")}),e.jsx("th",{className:"px-4 py-3 text-center text-xs text-subtle font-medium uppercase tracking-wide",children:a("commands.colParams")}),e.jsx("th",{className:"px-4 py-3 text-left text-xs text-subtle font-medium uppercase tracking-wide",children:a("commands.colPermissions")}),u&&e.jsxs(e.Fragment,{children:[e.jsx("th",{className:"px-4 py-3 text-right text-xs text-subtle font-medium uppercase tracking-wide",children:a("commands.colRuns")}),e.jsx("th",{className:"px-4 py-3 text-right text-xs text-subtle font-medium uppercase tracking-wide",children:a("commands.failed")})]})]})}),e.jsx("tbody",{children:S.map(t=>e.jsx(A,{cmd:t,usage:u,search:h},t.command))})]}),S.length===0&&e.jsx(H,{message:a(h?"commands.noMatch":"commands.noCommands")})]})]})]})}export{le as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{j as a,ak as E,r as h,al as O,u as k,d as I}from"./index-DNbEWPIs.js";const D=/^(\d+)(ms|s|m|h|d)$/,y={ms:1,s:1e3,m:6e4,h:36e5,d:864e5};function M(t){if(typeof t!="string")return;const e=D.exec(t.trim());return e?Number(e[1])*y[e[2]]:void 0}function S(t){const e=Math.round(t);if(e===0)return"0s";for(const n of["d","h","m","s"])if(e%y[n]===0)return`${e/y[n]}${n}`;return`${e}ms`}function F(t,e){switch(t){case"boolean":return e===!0;case"string[]":return Array.isArray(e)?e.map(String):[];case"json":return e==null?"":JSON.stringify(e,null,2);case"secret":return"";default:return e==null?"":String(e)}}function A(t,e){switch(t){case"boolean":return{value:e===!0};case"string[]":return{value:Array.isArray(e)?e:[]};case"number":{const n=String(e).trim(),s=Number(n);return n===""||!Number.isFinite(s)?{problem:{key:"config.invalidNumber"}}:{value:s}}case"json":{const n=String(e).trim();if(n==="")return{problem:{key:"config.invalidJson"}};try{return{value:JSON.parse(n)}}catch{return{problem:{key:"config.invalidJson"}}}}default:return{value:String(e)}}}function R(t){return t==null||t===""||Array.isArray(t)&&t.length===0}function C(t,e){try{return new RegExp(t).test(e)}catch{return!0}}function J(t,e){var u,x;const n=t.validation??{};if(n.required&&R(e))return{key:"config.required"};const s=r=>n.min!==void 0&&r.length<n.min?{key:"config.minLength",params:{min:n.min}}:n.max!==void 0&&r.length>n.max?{key:"config.maxLength",params:{max:n.max}}:n.pattern!==void 0&&!C(n.pattern,r)?{key:"config.pattern",params:{pattern:n.pattern}}:null;switch(t.type){case"string":case"secret":{if(typeof e!="string"||e===""&&!n.required)return null;const r=s(e);return r||((u=n.options)!=null&&u.length&&!n.options.includes(e)?{key:"config.oneOf",params:{options:n.options.join(", ")}}:null)}case"url":{if(typeof e!="string"||e==="")return null;let r=/^[a-z][a-z0-9+.-]*:\/\//i.test(e);if(r)try{new URL(e)}catch{r=!1}return r?s(e):{key:"config.invalidUrl"}}case"number":return typeof e!="number"||!Number.isFinite(e)?{key:"config.invalidNumber"}:n.min!==void 0&&e<n.min?{key:"config.min",params:{min:n.min}}:n.max!==void 0&&e>n.max?{key:"config.max",params:{max:n.max}}:null;case"enum":{const r=n.options??[];return typeof e=="string"&&r.includes(e)?null:{key:"config.oneOf",params:{options:r.join(", ")}}}case"string[]":{if(!Array.isArray(e))return null;if(n.min!==void 0&&e.length<n.min)return{key:"config.minItems",params:{min:n.min}};if(n.max!==void 0&&e.length>n.max)return{key:"config.maxItems",params:{max:n.max}};for(const r of e){if(n.pattern!==void 0&&!C(n.pattern,r))return{key:"config.itemPattern",params:{item:r,pattern:n.pattern}};if((x=n.options)!=null&&x.length&&!n.options.includes(r))return{key:"config.itemOneOf",params:{item:r,options:n.options.join(", ")}}}return null}case"duration":{const r=M(e);return r===void 0?{key:"config.invalidDuration"}:n.min!==void 0&&r<n.min?{key:"config.min",params:{min:S(n.min)}}:n.max!==void 0&&r>n.max?{key:"config.max",params:{max:S(n.max)}}:null}default:return null}}function U(t,e){if(e.kind==="reset")return{value:null};const n=e.kind==="value"?{value:e.value}:A(t.type,e.draft);if("problem"in n)return n;const s=J(t,n.value);return s?{problem:s}:n}function $(t,e){return JSON.stringify(t??null)===JSON.stringify(e??null)}function H(t,e){if(e.kind==="reset")return t.sensitive?t.isSet===!0:!$(t.value,t.default);if(t.sensitive||t.type==="secret")return!0;const n=e.kind==="value"?{value:e.value}:A(t.type,e.draft);return!("value"in n)||!$(n.value,t.value)}function K(t){return t==null?"—":typeof t=="string"?t===""?'""':t:Array.isArray(t)&&t.every(e=>typeof e=="string")?t.length?t.join(", "):"[]":JSON.stringify(t)}function P(t,e){const n=e.trim().toLowerCase();return n?[t.key,t.label,t.description].some(s=>typeof s=="string"&&s.toLowerCase().includes(n)):!0}const Y=["string","number","boolean","string[]","json"],B=/^[A-Za-z0-9_][A-Za-z0-9_.-]{0,127}$/;function _({extension:t,mount:e,props:n}){const{context:s}=E(t,"/"),u=h.useRef(null),x=h.useRef(void 0),r=h.useRef(n),[c,g]=h.useState(null);return h.useEffect(()=>{var l;r.current=n,(l=x.current)==null||l.update(n)}),h.useEffect(()=>{const l=u.current;if(!l)return;let o=!1;const m=document.createElement("div");return m.className=O,l.appendChild(m),(async()=>{var p;try{const f=await e(m,r.current,s);o?(p=f==null?void 0:f.unmount)==null||p.call(f):x.current=f}catch(f){o||g(f instanceof Error?f.message:String(f))}})(),()=>{var p,f;o=!0;try{(f=(p=x.current)==null?void 0:p.unmount)==null||f.call(p)}catch{}x.current=void 0,m.remove()}},[e,s]),c?a.jsx("div",{role:"alert",className:"text-xs text-error",children:c}):a.jsx("div",{ref:u,"data-config-editor":`${t.id}:${n.entry.editor??""}`})}function L({editor:t,props:e}){if(t.kind==="component"){const{Component:n}=t;return a.jsx(n,{...e})}return a.jsx(_,{extension:t.extension,mount:t.mount,props:e})}const T="w-full px-3 py-2 text-sm bg-control border rounded-lg text-text placeholder-subtle focus:outline-none focus:border-primary/50 disabled:opacity-50 disabled:cursor-not-allowed";function b(t,e="max-w-sm"){return`${T} ${e} ${t?"border-error/60":"border-border"}`}function V({id:t,value:e,onChange:n,disabled:s,label:u,invalid:x}){const{t:r}=k(),[c,g]=h.useState("");function l(){const o=c.trim();o&&!e.includes(o)&&n([...e,o]),g("")}return a.jsxs("div",{className:`flex flex-wrap gap-1.5 p-2 bg-control border rounded-lg min-h-[38px] max-w-xl ${x?"border-error/60":"border-border"} ${s?"opacity-50":""}`,children:[e.map(o=>a.jsxs("span",{className:"inline-flex items-center gap-1 px-2 py-0.5 bg-primary/20 text-accent rounded text-xs font-mono break-all",children:[o,!s&&a.jsx("button",{type:"button",onClick:()=>n(e.filter(m=>m!==o)),"aria-label":r("config.removeValue",{value:o}),title:r("config.removeValue",{value:o}),className:"text-accent hover:text-heading ml-0.5",children:"×"})]},o)),!s&&a.jsx("input",{id:t,type:"text",value:c,onChange:o=>g(o.target.value),onKeyDown:o=>{o.key==="Enter"||o.key===","?(o.preventDefault(),l()):o.key==="Backspace"&&c===""&&e.length>0&&n(e.slice(0,-1))},onBlur:l,placeholder:r("config.addValue"),"aria-label":u,className:"flex-1 bg-transparent text-xs text-text placeholder-subtle focus:outline-none min-w-[80px]"})]})}function z({id:t,entry:e,edit:n,onEdit:s,disabled:u,label:x,invalid:r}){const{t:c}=k();return(n==null?void 0:n.kind)==="reset"?a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[a.jsx("span",{className:"text-warning",children:c("config.secretWillClear")}),a.jsx("button",{type:"button",onClick:()=>s(void 0),className:"px-2 py-1 rounded-md bg-control hover:bg-control-hover text-text",children:c("config.undo")})]}):(n==null?void 0:n.kind)==="set"?a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("input",{id:t,type:"password",autoComplete:"new-password",value:String(n.draft),disabled:u,onChange:g=>s({kind:"set",draft:g.target.value}),placeholder:c("config.newSecret"),"aria-label":x,"aria-invalid":r||void 0,autoFocus:!0,className:b(r,"max-w-xs")}),a.jsx("button",{type:"button",onClick:()=>s(void 0),className:"px-2 py-1 text-xs rounded-md bg-control hover:bg-control-hover text-text",children:c("config.cancelEdit")})]}):a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs",children:[a.jsx("span",{className:"font-mono text-subtle",children:e.isSet?"••••••••":c("config.secretNotSet")}),!u&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>s({kind:"set",draft:""}),className:"px-2 py-1 rounded-md bg-control hover:bg-control-hover text-text",children:e.isSet?c("config.replaceSecret"):c("config.setSecret")}),e.isSet&&a.jsx("button",{type:"button",onClick:()=>s({kind:"reset"}),className:"px-2 py-1 rounded-md bg-control hover:bg-error/15 text-error",children:c("config.clearSecret")})]})]})}function Z({id:t,entry:e,edit:n,onEdit:s,disabled:u,error:x,editors:r}){var N,j,w;const{t:c}=k(),g=e.label||e.key,l=!!x,o=(n==null?void 0:n.kind)==="set"?n.draft:F(e.type,(n==null?void 0:n.kind)==="reset"?e.default:e.value),m=i=>s({kind:"set",draft:i}),p={id:t,disabled:u,"aria-label":g,"aria-invalid":l||void 0},f=e.editor?r==null?void 0:r.get(e.editor):void 0;if(f&&!e.sensitive){const i=(n==null?void 0:n.kind)==="value"?n.value:(n==null?void 0:n.kind)==="reset"?e.default:e.value;return a.jsx(L,{editor:f,props:{entry:e,value:i,onChange:d=>s({kind:"value",value:d}),disabled:u,error:x}})}if(e.type==="secret"||e.sensitive)return a.jsx(z,{id:t,entry:e,edit:n,onEdit:s,disabled:u,label:g,invalid:l});switch(e.type){case"boolean":{const i=o===!0;return a.jsx("button",{...p,type:"button",role:"switch","aria-checked":i,onClick:()=>m(!i),title:c(i?"common.enabled":"common.disabled"),className:`relative inline-flex h-5 w-9 items-center rounded-full transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-primary/50 disabled:opacity-50 disabled:cursor-not-allowed ${i?"bg-primary":"bg-subtle"}`,children:a.jsx("span",{className:`inline-block h-3.5 w-3.5 transform rounded-full bg-on-primary transition-transform ${i?"translate-x-4":"translate-x-0.5"}`})})}case"string[]":return a.jsx(V,{id:t,value:Array.isArray(o)?o:[],onChange:m,disabled:u,label:g,invalid:l});case"enum":{const i=((N=e.validation)==null?void 0:N.options)??[],d=String(o);return a.jsx(I,{id:t,value:d||null,onChange:v=>m(v),options:[...!i.includes(d)&&d?[{value:d,label:d}]:[],...i.map(v=>({value:v,label:v}))],placeholder:c("config.chooseOption"),label:g,disabled:u,size:"md",width:"auto",className:l?"rounded-lg ring-1 ring-error/60":""})}case"number":return a.jsx("input",{...p,type:"number",inputMode:"decimal",min:(j=e.validation)==null?void 0:j.min,max:(w=e.validation)==null?void 0:w.max,value:String(o),onChange:i=>m(i.target.value),className:b(l,"max-w-[12rem]")});case"json":return a.jsx("textarea",{...p,value:String(o),onChange:i=>m(i.target.value),spellCheck:!1,rows:Math.min(12,Math.max(3,String(o).split(`
|
|
2
|
+
`).length)),className:`${b(l,"max-w-xl")} font-mono text-xs`});case"duration":return a.jsx("input",{...p,type:"text",value:String(o),onChange:i=>m(i.target.value),placeholder:c("config.durationHint"),className:`${b(l,"max-w-[12rem]")} font-mono`});case"url":return a.jsx("input",{...p,type:"url",inputMode:"url",value:String(o),onChange:i=>m(i.target.value),placeholder:"https://",className:`${b(l,"max-w-md")} font-mono`});default:return e.editor==="textarea"||e.editor==="code"?a.jsx("textarea",{...p,value:String(o),onChange:i=>m(i.target.value),rows:Math.min(10,Math.max(3,String(o).split(`
|
|
3
|
+
`).length)),className:`${b(l,"max-w-xl")} ${e.editor==="code"?"font-mono text-xs":""}`}):a.jsx("input",{...p,type:"text",value:String(o),onChange:i=>m(i.target.value),className:b(l)})}}export{Z as C,Y as F,P as a,B as b,K as d,U as e,S as f,H as i,$ as s,F as t,J as v};
|