@qodalis/cli-core 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  ![Help command](https://raw.githubusercontent.com/qodalis-solutions/web-cli/main/assets/help_command.gif)
22
22
 
23
- Qodalis CLI renders an [xterm.js](https://xtermjs.org/) terminal in your app with a shell-like command line, built-in commands, themes and a runtime package manager. You add commands as **modules** (`ICliModule`): the 40 official plugins, your own commands, or packages installed at runtime with `pkg add`. It can also connect to a Node.js, .NET or Python backend to run server-side commands.
23
+ Qodalis CLI renders an [xterm.js](https://xtermjs.org/) terminal in your app with a shell-like command line, built-in commands, themes and a runtime package manager. You add commands as **modules** (`ICliModule`): the 40 official plugins (34 here, 6 games in [cli-games](https://github.com/qodalis-solutions/cli-games)), your own commands, or packages installed at runtime with `pkg add`. It can also connect to a Node.js, .NET or Python backend to run server-side commands.
24
24
 
25
25
  ## Try it online
26
26
 
@@ -210,7 +210,7 @@ Install from npm and pass the module, or run `pkg add <name>` in the terminal.
210
210
  | [`@qodalis/cli-wget`](https://www.npmjs.com/package/@qodalis/cli-wget) | `wgetModule` | `wget` |
211
211
  | [`@qodalis/cli-yesno`](https://www.npmjs.com/package/@qodalis/cli-yesno) | `yesnoModule` | `yesno` |
212
212
 
213
- **Games**: [`@qodalis/cli-2048`](https://www.npmjs.com/package/@qodalis/cli-2048) (`game2048Module`), [`@qodalis/cli-minesweeper`](https://www.npmjs.com/package/@qodalis/cli-minesweeper), [`@qodalis/cli-snake`](https://www.npmjs.com/package/@qodalis/cli-snake), [`@qodalis/cli-sudoku`](https://www.npmjs.com/package/@qodalis/cli-sudoku), [`@qodalis/cli-tetris`](https://www.npmjs.com/package/@qodalis/cli-tetris), [`@qodalis/cli-wordle`](https://www.npmjs.com/package/@qodalis/cli-wordle).
213
+ **Games** ([cli-games](https://github.com/qodalis-solutions/cli-games), same `@qodalis/cli-<game>` names): [`@qodalis/cli-2048`](https://www.npmjs.com/package/@qodalis/cli-2048) (`game2048Module`), [`@qodalis/cli-minesweeper`](https://www.npmjs.com/package/@qodalis/cli-minesweeper), [`@qodalis/cli-snake`](https://www.npmjs.com/package/@qodalis/cli-snake), [`@qodalis/cli-sudoku`](https://www.npmjs.com/package/@qodalis/cli-sudoku), [`@qodalis/cli-tetris`](https://www.npmjs.com/package/@qodalis/cli-tetris), [`@qodalis/cli-wordle`](https://www.npmjs.com/package/@qodalis/cli-wordle).
214
214
 
215
215
  **Language packs**: `@qodalis/cli-lang-<code>` for `de`, `es`, `fr`, `it`, `ja`, `ko`, `pt`, `ro`, `ru`, `zh` (`langDeModule`, ...).
216
216
 
@@ -220,6 +220,7 @@ Details and examples for each plugin: [Plugins](https://cli.qodalis.com/docs/plu
220
220
 
221
221
  | Repository | What it is |
222
222
  | --- | --- |
223
+ | [cli-games](https://github.com/qodalis-solutions/cli-games) | The six game plugins (`@qodalis/cli-2048`, `-minesweeper`, `-snake`, `-sudoku`, `-tetris`, `-wordle`) |
223
224
  | [cli-server-node](https://github.com/qodalis-solutions/cli-server-node) | Node.js server (`@qodalis/cli-server-node`): server commands, shell, filesystem, data explorer, jobs, MCP |
224
225
  | [cli-server-dotnet](https://github.com/qodalis-solutions/cli-server-dotnet) | The same server for ASP.NET Core (NuGet `Qodalis.Cli`) |
225
226
  | [cli-server-python](https://github.com/qodalis-solutions/cli-server-python) | The same server for FastAPI (PyPI `qodalis-cli-server`) |
@@ -263,7 +264,7 @@ pnpm run create-plugin -- --name <name> --description "<desc>" --processor-name
263
264
  | `packages/cli` | `@qodalis/cli`: the engine and built-in commands |
264
265
  | `packages/angular-cli`, `react-cli`, `vue-cli`, `electron-cli` | Framework wrappers |
265
266
  | `packages/create-cli-plugin` | Plugin scaffolder |
266
- | `packages/plugins/*` | The 40 plugins |
267
+ | `packages/plugins/*` | The 34 plugins (the 6 games live in [cli-games](https://github.com/qodalis-solutions/cli-games)) |
267
268
  | `apps/` | Docs site and demo apps |
268
269
 
269
270
  [CONTRIBUTING.md](https://github.com/qodalis-solutions/web-cli/blob/main/CONTRIBUTING.md) covers branches and pull requests, [DEVELOPER.md](https://github.com/qodalis-solutions/web-cli/blob/main/DEVELOPER.md) the architecture and build details.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli-core",
3
- "version": "2.4.1",
3
+ "version": "2.5.0",
4
4
  "description": "Core interfaces, types, and utilities for the @qodalis CLI ecosystem.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
package/public-api.d.mts CHANGED
@@ -677,6 +677,27 @@ interface ICliStateStore {
677
677
  reload?(): Promise<void>;
678
678
  }
679
679
 
680
+ /**
681
+ * Where the CLI keeps secrets such as the API tokens of servers linked with
682
+ * `server add`. The default encrypts them with a non-extractable Web Crypto key
683
+ * kept in IndexedDB; a host replaces it (Android Keystore, iOS Keychain,
684
+ * Electron `safeStorage`) by providing {@link ICliSecretStore_TOKEN}.
685
+ */
686
+ interface ICliSecretStore {
687
+ /** Whether secrets can be kept (e.g. false without Web Crypto on an insecure page). */
688
+ isAvailable(): boolean | Promise<boolean>;
689
+ /** The secret saved under `key`, or undefined. */
690
+ get(key: string): Promise<string | undefined>;
691
+ /** Saves a secret under `key`, replacing any previous one. */
692
+ set(key: string, value: string): Promise<void>;
693
+ /** Deletes the secret saved under `key`. */
694
+ delete(key: string): Promise<void>;
695
+ /** Deletes every secret (and the key that encrypts them). */
696
+ clear(): Promise<void>;
697
+ }
698
+ /** Token for {@link ICliSecretStore} */
699
+ declare const ICliSecretStore_TOKEN: CliToken<ICliSecretStore>;
700
+
680
701
  /** Ownership metadata attached to files, directories, or other resources */
681
702
  interface ICliOwnership {
682
703
  /** User ID of the owner */
@@ -2180,6 +2201,17 @@ type CliOptions = Record<string, any> & {
2180
2201
  */
2181
2202
  sources?: CliPackageSource[];
2182
2203
  };
2204
+ /**
2205
+ * Servers the user links from the terminal (`server add`): `true` (default),
2206
+ * `false` (no linking: `server add` is refused and linked servers are not
2207
+ * restored), or `{ allowedOrigins }` to accept only servers whose origin
2208
+ * matches one of them (`https://*.example.com`; `*` matches within the host
2209
+ * name). Host servers (`servers`) can never be removed or replaced from the
2210
+ * terminal.
2211
+ */
2212
+ userServers?: boolean | {
2213
+ allowedOrigins: string[];
2214
+ };
2183
2215
  /**
2184
2216
  * Remote CLI servers to connect to.
2185
2217
  * Commands from each server are discovered and registered as proxy processors.
@@ -2239,6 +2271,10 @@ type CliProcessorMetadata = Record<string, any> & {
2239
2271
  * If true, the processor requires the server to be running
2240
2272
  */
2241
2273
  requireServer?: boolean;
2274
+ /**
2275
+ * The connected server the command runs on (server commands); help names it.
2276
+ */
2277
+ server?: string;
2242
2278
  /**
2243
2279
  * The module the processor belongs to
2244
2280
  */
@@ -2623,6 +2659,12 @@ interface ICliExecutionContext {
2623
2659
  * ready). Optional for backward compatibility; `undefined` means unknown.
2624
2660
  */
2625
2661
  readonly isBooted?: boolean;
2662
+ /**
2663
+ * What pressing Ctrl+C does: the current input (a running command, a
2664
+ * prompt, a context) is interrupted. Hosts call it from a button where
2665
+ * there is no keyboard (a phone).
2666
+ */
2667
+ interrupt?(): void;
2626
2668
  /**
2627
2669
  * A subject that emits when the command is aborted
2628
2670
  */
@@ -2848,6 +2890,17 @@ interface ICliCommandParameterDescriptor {
2848
2890
  * The default value of the parameter
2849
2891
  */
2850
2892
  defaultValue?: any;
2893
+ /**
2894
+ * The only values the parameter takes. Help lists them and Tab completes
2895
+ * them after `--name ` and `--name=`. Add a `validator` to refuse other
2896
+ * values (server commands get one that ignores case).
2897
+ */
2898
+ allowedValues?: string[];
2899
+ /**
2900
+ * Example values of the parameter (e.g. `Paris`, `New York`). Help lists
2901
+ * them after the description.
2902
+ */
2903
+ examples?: string[];
2851
2904
  /**
2852
2905
  * A validator function that validates the value of the parameter
2853
2906
  * @param value The value to validate
@@ -3510,6 +3563,19 @@ type CliServerCommandDescriptor = {
3510
3563
  command: string;
3511
3564
  description?: string;
3512
3565
  version?: string;
3566
+ /** Other names of the command (servers with command metadata) */
3567
+ aliases?: string[];
3568
+ /** Example command lines for help */
3569
+ examples?: {
3570
+ command: string;
3571
+ description?: string;
3572
+ }[];
3573
+ /** Longer help text: paragraphs separated by a blank line */
3574
+ documentation?: string;
3575
+ /** The group the command is listed under in help */
3576
+ module?: string;
3577
+ /** One emoji for help */
3578
+ icon?: string;
3513
3579
  parameters?: {
3514
3580
  name: string;
3515
3581
  aliases?: string[];
@@ -3517,6 +3583,10 @@ type CliServerCommandDescriptor = {
3517
3583
  required: boolean;
3518
3584
  type: string;
3519
3585
  defaultValue?: any;
3586
+ /** The only values the parameter takes */
3587
+ allowedValues?: string[];
3588
+ /** Example values */
3589
+ examples?: string[];
3520
3590
  }[];
3521
3591
  processors?: CliServerCommandDescriptor[];
3522
3592
  };
@@ -4260,7 +4330,7 @@ interface CliThemeInfo {
4260
4330
 
4261
4331
  declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
4262
4332
 
4263
- declare const LIBRARY_VERSION = "2.4.1";
4333
+ declare const LIBRARY_VERSION = "2.5.0";
4264
4334
  declare const API_VERSION = 2;
4265
4335
 
4266
4336
  /**
@@ -4321,5 +4391,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
4321
4391
  private _pickFile;
4322
4392
  }
4323
4393
 
4324
- export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliPanelPalettes, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorSchemeOf, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelColors, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, panelColorStyles, prefersDarkScheme, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolvePanelTheme, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
4325
- export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelColorScheme, CliPanelColors, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPanelTheme, CliPanelThemeInput, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliResolvedPanelTheme, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
4394
+ export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliPanelPalettes, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliSecretStore_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorSchemeOf, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelColors, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, panelColorStyles, prefersDarkScheme, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolvePanelTheme, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
4395
+ export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelColorScheme, CliPanelColors, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPanelTheme, CliPanelThemeInput, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliResolvedPanelTheme, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliSecretStore, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
package/public-api.d.ts CHANGED
@@ -677,6 +677,27 @@ interface ICliStateStore {
677
677
  reload?(): Promise<void>;
678
678
  }
679
679
 
680
+ /**
681
+ * Where the CLI keeps secrets such as the API tokens of servers linked with
682
+ * `server add`. The default encrypts them with a non-extractable Web Crypto key
683
+ * kept in IndexedDB; a host replaces it (Android Keystore, iOS Keychain,
684
+ * Electron `safeStorage`) by providing {@link ICliSecretStore_TOKEN}.
685
+ */
686
+ interface ICliSecretStore {
687
+ /** Whether secrets can be kept (e.g. false without Web Crypto on an insecure page). */
688
+ isAvailable(): boolean | Promise<boolean>;
689
+ /** The secret saved under `key`, or undefined. */
690
+ get(key: string): Promise<string | undefined>;
691
+ /** Saves a secret under `key`, replacing any previous one. */
692
+ set(key: string, value: string): Promise<void>;
693
+ /** Deletes the secret saved under `key`. */
694
+ delete(key: string): Promise<void>;
695
+ /** Deletes every secret (and the key that encrypts them). */
696
+ clear(): Promise<void>;
697
+ }
698
+ /** Token for {@link ICliSecretStore} */
699
+ declare const ICliSecretStore_TOKEN: CliToken<ICliSecretStore>;
700
+
680
701
  /** Ownership metadata attached to files, directories, or other resources */
681
702
  interface ICliOwnership {
682
703
  /** User ID of the owner */
@@ -2180,6 +2201,17 @@ type CliOptions = Record<string, any> & {
2180
2201
  */
2181
2202
  sources?: CliPackageSource[];
2182
2203
  };
2204
+ /**
2205
+ * Servers the user links from the terminal (`server add`): `true` (default),
2206
+ * `false` (no linking: `server add` is refused and linked servers are not
2207
+ * restored), or `{ allowedOrigins }` to accept only servers whose origin
2208
+ * matches one of them (`https://*.example.com`; `*` matches within the host
2209
+ * name). Host servers (`servers`) can never be removed or replaced from the
2210
+ * terminal.
2211
+ */
2212
+ userServers?: boolean | {
2213
+ allowedOrigins: string[];
2214
+ };
2183
2215
  /**
2184
2216
  * Remote CLI servers to connect to.
2185
2217
  * Commands from each server are discovered and registered as proxy processors.
@@ -2239,6 +2271,10 @@ type CliProcessorMetadata = Record<string, any> & {
2239
2271
  * If true, the processor requires the server to be running
2240
2272
  */
2241
2273
  requireServer?: boolean;
2274
+ /**
2275
+ * The connected server the command runs on (server commands); help names it.
2276
+ */
2277
+ server?: string;
2242
2278
  /**
2243
2279
  * The module the processor belongs to
2244
2280
  */
@@ -2623,6 +2659,12 @@ interface ICliExecutionContext {
2623
2659
  * ready). Optional for backward compatibility; `undefined` means unknown.
2624
2660
  */
2625
2661
  readonly isBooted?: boolean;
2662
+ /**
2663
+ * What pressing Ctrl+C does: the current input (a running command, a
2664
+ * prompt, a context) is interrupted. Hosts call it from a button where
2665
+ * there is no keyboard (a phone).
2666
+ */
2667
+ interrupt?(): void;
2626
2668
  /**
2627
2669
  * A subject that emits when the command is aborted
2628
2670
  */
@@ -2848,6 +2890,17 @@ interface ICliCommandParameterDescriptor {
2848
2890
  * The default value of the parameter
2849
2891
  */
2850
2892
  defaultValue?: any;
2893
+ /**
2894
+ * The only values the parameter takes. Help lists them and Tab completes
2895
+ * them after `--name ` and `--name=`. Add a `validator` to refuse other
2896
+ * values (server commands get one that ignores case).
2897
+ */
2898
+ allowedValues?: string[];
2899
+ /**
2900
+ * Example values of the parameter (e.g. `Paris`, `New York`). Help lists
2901
+ * them after the description.
2902
+ */
2903
+ examples?: string[];
2851
2904
  /**
2852
2905
  * A validator function that validates the value of the parameter
2853
2906
  * @param value The value to validate
@@ -3510,6 +3563,19 @@ type CliServerCommandDescriptor = {
3510
3563
  command: string;
3511
3564
  description?: string;
3512
3565
  version?: string;
3566
+ /** Other names of the command (servers with command metadata) */
3567
+ aliases?: string[];
3568
+ /** Example command lines for help */
3569
+ examples?: {
3570
+ command: string;
3571
+ description?: string;
3572
+ }[];
3573
+ /** Longer help text: paragraphs separated by a blank line */
3574
+ documentation?: string;
3575
+ /** The group the command is listed under in help */
3576
+ module?: string;
3577
+ /** One emoji for help */
3578
+ icon?: string;
3513
3579
  parameters?: {
3514
3580
  name: string;
3515
3581
  aliases?: string[];
@@ -3517,6 +3583,10 @@ type CliServerCommandDescriptor = {
3517
3583
  required: boolean;
3518
3584
  type: string;
3519
3585
  defaultValue?: any;
3586
+ /** The only values the parameter takes */
3587
+ allowedValues?: string[];
3588
+ /** Example values */
3589
+ examples?: string[];
3520
3590
  }[];
3521
3591
  processors?: CliServerCommandDescriptor[];
3522
3592
  };
@@ -4260,7 +4330,7 @@ interface CliThemeInfo {
4260
4330
 
4261
4331
  declare const DefaultThemeInfos: Record<string, CliThemeInfo>;
4262
4332
 
4263
- declare const LIBRARY_VERSION = "2.4.1";
4333
+ declare const LIBRARY_VERSION = "2.5.0";
4264
4334
  declare const API_VERSION = 2;
4265
4335
 
4266
4336
  /**
@@ -4321,5 +4391,5 @@ declare class BrowserFileTransferService implements ICliFileTransferService {
4321
4391
  private _pickFile;
4322
4392
  }
4323
4393
 
4324
- export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliPanelPalettes, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorSchemeOf, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelColors, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, panelColorStyles, prefersDarkScheme, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolvePanelTheme, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
4325
- export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelColorScheme, CliPanelColors, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPanelTheme, CliPanelThemeInput, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliResolvedPanelTheme, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
4394
+ export { API_VERSION, BrowserFileTransferService, CANCELLATION_ERROR_MESSAGE, CLI_CONFIGURE_STORE_NAME, CLI_WS_TICKET_PATH, CancellablePromise, CliAccessDeniedError, CliBackgroundColor, CliForegroundColor, CliHttpError, CliIcon, CliKeyData, CliLogLevel, CliModuleRegistry, CliPanelPalettes, CliServerPermissions, CliUsersPermissions, DEFAULT_DIR_PERMISSIONS, DEFAULT_FILE_PERMISSIONS, DefaultLibraryAuthor, DefaultThemeInfos, DefaultThemes, ICliAuditService_TOKEN, ICliAuthService_TOKEN, ICliAuthorizationService_TOKEN, ICliCommandGuard_TOKEN, ICliCompletionProvider_TOKEN, ICliDragDropService_TOKEN, ICliEventBus_TOKEN, ICliFilePickerProvider_TOKEN, ICliFileTransferService_TOKEN, ICliGroupsStoreService_TOKEN, ICliHttpClient_TOKEN, ICliKeyValueStore_TOKEN, ICliPermissionRegistry_TOKEN, ICliPermissionService_TOKEN, ICliSecretStore_TOKEN, ICliServerAuthService_TOKEN, ICliServerAuthTokenProvider_TOKEN, ICliServerManager_TOKEN, ICliSessionsService_TOKEN, ICliTranslationService_TOKEN, ICliUserEventService_TOKEN, ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN, LIBRARY_VERSION, ObjectDescriber, ServerVersionNegotiator, appendQueryParams, bootCliModule, buildAuthenticatedWebSocketUrl, buildServerWebSocketUrl, clearTerminalLine, cliAccessMetadataGuards, cliAuthorize, cliCanAccess, cliDefaultServer, cliEvaluateAccess, cliHasPermission, cliMergePermissions, cliMissingPermissions, cliPermissionMatches, cliRequireAuthGuard, cliRequiredGroupsGuard, cliRequiredPermissionsGuard, colorFirstWord, colorSchemeOf, colorizeJson, compareVersions, constants, createCliToken, createWorkerService, delay, derivePanelColors, derivePanelThemeStyles, enums, formatJson, getConfigValue, getParameterValue, getPluginConfigValue, getRightOfWord, highlightTextWithBg, initializeBrowserEnvironment, isCliAccessDeniedError, joinShellWords, loadPanelPosition, nextPanelPosition, panelColorStyles, prefersDarkScheme, quoteShellWord, resolveConfigurationCategories, resolveHeaders, resolvePanelTheme, resolveServerHeaders, resolveServerWebSocketUrl, satisfiesMinVersion, satisfiesVersionRange, savePanelPosition, splitShellWords, stripAnsi, toQueryString, truncateToWidth, unquoteRawArgument, utils, visibleLength, writeExamples, writeHint, writeUsage, writeWrapped };
4395
+ export type { CliAccessAction, CliAddUser, CliBackgroundServiceStatus, CliBackgroundServiceType, CliBootOptions, CliBranding, CliCommandGuardResult, CliDateOptions, CliEmitOptions, CliEngineSnapshot, CliEvent, CliEventData, CliEventHandler, CliEventMap, CliEventType, CliFactoryProvider, CliFilePickerOptions, CliFileResult, CliFullScreenOptions, CliHeadersProvider, CliHelpRow, CliHttpRequestOptions, CliLineOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNotification, CliNotificationLevel, CliNumberOptions, CliOptions, CliPackageSource, CliPanelColorScheme, CliPanelColors, CliPanelConfig, CliPanelHideAlignment, CliPanelPaneState, CliPanelPosition, CliPanelState, CliPanelTabState, CliPanelTheme, CliPanelThemeInput, CliPercentageProgressBarUpdateValueOptions, CliPermissionDefinition, CliProcessCommand, CliProcessorMetadata, CliProvider, CliResolvedPanelTheme, CliSelectOption, CliSelectOptions, CliServerCapabilities, CliServerCommandDescriptor, CliServerConfig, CliServerOutput, CliServerResponse, CliServerTablePage, CliServiceEventHandler, CliServiceExecutionMode, CliServiceLogLevel, CliState, CliStateConfiguration, CliStateScope, CliStateStoreOptions, CliTableOptions, CliTextAnimatorOptions, CliTheme, CliThemeCategory, CliThemeInfo, CliToken, CliTypeProvider, CliUpdateUser, CliValueProvider, CliWebSocketAuthOptions, CliWorkerInboundMessage, CliWorkerOutboundMessage, CustomEventType, DefaultThemesType, ICliAuditEntry, ICliAuditService, ICliAuthService, ICliAuthorizationService, ICliBackgroundService, ICliBackgroundServiceInfo, ICliBackgroundServiceRegistry, ICliClipboard, ICliCommandAuthor, ICliCommandChildProcessor, ICliCommandControls, ICliCommandExecutorService, ICliCommandGuard, ICliCommandKey, ICliCommandParameterDescriptor, ICliCommandProcessor, ICliCommandProcessorRegistry, ICliCompletionContext, ICliCompletionProvider, ICliConfigurableModule, ICliConfigurationOption, ICliDragDropService, ICliEventBus, ICliExecutionContext, ICliExecutionProcess, ICliFileEntry, ICliFilePickerProvider, ICliFileTransferService, ICliGlobalParameterHandler, ICliGroup, ICliGroupsStoreService, ICliHttpClient, ICliInputReader, ICliKeyValueStore, ICliLogger, ICliManagedInterval, ICliManagedTimer, ICliModule, ICliNotifier, ICliOwnership, ICliPanelRef, ICliPercentageProgressBar, ICliPermissionRegistry, ICliPermissionService, ICliPingServerService, ICliPrincipal, ICliProcessEntry, ICliProcessRegisterOptions, ICliProcessRegistry, ICliProcessorHook, ICliProgressBar, ICliProtectedResource, ICliSecretStore, ICliServerAuthService, ICliServerAuthTokenProvider, ICliServerManager, ICliServiceContext, ICliServiceEvent, ICliServiceLogEntry, ICliServiceProvider, ICliSessionInfo, ICliSessionsService, ICliSpinner, ICliStateStore, ICliTerminalWriter, ICliTextAnimator, ICliTranslationService, ICliUser, ICliUserCredentials, ICliUserEvent, ICliUserEventService, ICliUserSession, ICliUserSessionService, ICliUsersStoreService, ISyntaxHighlightRule, ISyntaxHighlighter, ISyntaxTheme, LineState, Package, ServerVersionInfo, WorkerServiceContext };
package/public-api.js CHANGED
@@ -2191,6 +2191,9 @@ var enums = {
2191
2191
  CliLogLevel
2192
2192
  };
2193
2193
 
2194
+ // src/lib/interfaces/secret-store.ts
2195
+ var ICliSecretStore_TOKEN = createCliToken("cli-secret-store");
2196
+
2194
2197
  // src/lib/interfaces/command-controls.ts
2195
2198
  var CliKeyData = {
2196
2199
  up: "\x1B[A",
@@ -2599,7 +2602,7 @@ function satisfiesVersionRange(installed, range) {
2599
2602
  }
2600
2603
 
2601
2604
  // src/lib/version.ts
2602
- var LIBRARY_VERSION = "2.4.1";
2605
+ var LIBRARY_VERSION = "2.5.0";
2603
2606
  var API_VERSION = 2;
2604
2607
 
2605
2608
  // src/lib/utils/server-version-negotiator.ts
@@ -3708,7 +3711,7 @@ function writeExamples(context, rows) {
3708
3711
  context,
3709
3712
  rows,
3710
3713
  (cmd) => cmd,
3711
- (comment) => writer.wrapInColor(`# ${comment}`, "\x1B[32m" /* Green */)
3714
+ (comment) => comment ? writer.wrapInColor(`# ${comment}`, "\x1B[32m" /* Green */) : ""
3712
3715
  );
3713
3716
  }
3714
3717
  function writeWrapped(context, text, indent = 0) {
@@ -4425,6 +4428,7 @@ exports.ICliHttpClient_TOKEN = ICliHttpClient_TOKEN;
4425
4428
  exports.ICliKeyValueStore_TOKEN = ICliKeyValueStore_TOKEN;
4426
4429
  exports.ICliPermissionRegistry_TOKEN = ICliPermissionRegistry_TOKEN;
4427
4430
  exports.ICliPermissionService_TOKEN = ICliPermissionService_TOKEN;
4431
+ exports.ICliSecretStore_TOKEN = ICliSecretStore_TOKEN;
4428
4432
  exports.ICliServerAuthService_TOKEN = ICliServerAuthService_TOKEN;
4429
4433
  exports.ICliServerAuthTokenProvider_TOKEN = ICliServerAuthTokenProvider_TOKEN;
4430
4434
  exports.ICliServerManager_TOKEN = ICliServerManager_TOKEN;