@qodalis/cli 2.0.0-beta.16 → 2.0.0-beta.18

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/public-api.d.ts CHANGED
@@ -1,5 +1,4 @@
1
- import * as _qodalis_cli_core from '@qodalis/cli-core';
2
- import { ICliCommandProcessor, ICliCommandParameterDescriptor, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliKeyValueStore, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliProvider, CliTableOptions, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNumberOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliHttpRequestOptions, CliNotification, ICliPermissionRegistry, CliPermissionDefinition, CliState, CliEngineSnapshot, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliIcon } from '@qodalis/cli-core';
1
+ import { ICliCommandProcessor, ICliCommandParameterDescriptor as ICliCommandParameterDescriptor$1, ICliCommandProcessorRegistry, ICliCommandChildProcessor, CliProcessorMetadata, CliStateConfiguration, ICliExecutionContext, CliProcessCommand, ICliCommandAuthor, CliThemeInfo, ICliExecutionProcess, ICliUserSession, ICliSpinner, ICliPercentageProgressBar, ICliTextAnimator, ICliTerminalWriter, ICliCommandExecutorService, ICliClipboard, ICliStateStore, CliOptions, ICliLogger, ICliServiceProvider, ICliTranslationService, ICliInputReader, ICliBackgroundServiceRegistry, ICliHttpClient, ICliNotifier, ICliManagedInterval, ICliManagedTimer, ICliEventBus, ICliKeyValueStore, CliStateStoreOptions, ICliCompletionProvider, ICliFilePickerProvider, CliFullScreenOptions, ICliProcessRegistry, ICliBackgroundService, ICliServiceContext, ICliBackgroundServiceInfo, ICliServiceLogEntry, CliServiceEventHandler, ICliGlobalParameterHandler, CliForegroundColor, CliBackgroundColor, CliToken, CliProvider, CliTableOptions, CliLogLevel, CliPercentageProgressBarUpdateValueOptions, CliTextAnimatorOptions, ICliModule, CliModuleRegistry, Package, ICliPingServerService, CliLineOptions, CliSelectOption, CliSelectOptions, CliMultiSelectOption, CliMultiSelectOptions, CliNumberOptions, CliDateOptions, CliFilePickerOptions, CliFileResult, ICliProcessRegisterOptions, ICliProcessEntry, ICliDragDropService, CliHttpRequestOptions, CliNotification, ICliPermissionRegistry, CliPermissionDefinition, CliState, CliEngineSnapshot, CliEvent, CliEventType, CliEventMap, CliEmitOptions, CustomEventType, CliEventHandler, CliServerConfig, ICliServerAuthService, CliServerCommandDescriptor, CliServerCapabilities, CliServerResponse, CliServerOutput, CliPanelPosition, CliPanelConfig, CliPanelHideAlignment, ICliPanelRef, CliPanelState } from '@qodalis/cli-core';
3
2
  export { ICliUserSessionService_TOKEN, ICliUsersStoreService_TOKEN } from '@qodalis/cli-core';
4
3
  import { ITheme, Terminal, ITerminalAddon, ITerminalOptions, ITerminalInitOnlyOptions } from '@xterm/xterm';
5
4
  import * as rxjs from 'rxjs';
@@ -16,6 +15,8 @@ type ParsedToken = {
16
15
  name: string;
17
16
  value: string | number | boolean;
18
17
  hasEquals: boolean;
18
+ /** Written with one dash (`-rf`), so it may be several short flags */
19
+ short?: boolean;
19
20
  } | {
20
21
  kind: 'word';
21
22
  value: string;
@@ -73,7 +74,7 @@ declare class CliArgsParser {
73
74
  * @param descriptors - Parameter descriptors from the matched processor.
74
75
  * @returns Reconciled args array and remaining command parts.
75
76
  */
76
- declare function reconcileArgs(tokens: ParsedToken[], descriptors: ICliCommandParameterDescriptor[] | undefined): {
77
+ declare function reconcileArgs(tokens: ParsedToken[], descriptors: ICliCommandParameterDescriptor$1[] | undefined): {
77
78
  args: ParsedArg[];
78
79
  commandParts: string[];
79
80
  };
@@ -91,6 +92,11 @@ declare class ProcessExitedError extends Error {
91
92
 
92
93
  declare class CliCommandProcessorRegistry implements ICliCommandProcessorRegistry {
93
94
  readonly processors: ICliCommandProcessor[];
95
+ /**
96
+ * Sub-commands each extension (`extendsProcessor`) merged into an
97
+ * existing command, removed again when the extension is unregistered.
98
+ */
99
+ private readonly mergedByExtension;
94
100
  constructor(initialProcessors?: ICliCommandProcessor[]);
95
101
  registerProcessor(processor: ICliCommandProcessor): void;
96
102
  unregisterProcessor(processor: ICliCommandProcessor): void;
@@ -111,56 +117,62 @@ declare class CliCommandProcessorRegistry implements ICliCommandProcessorRegistr
111
117
  * Framework-agnostic token for the CLI command processor registry.
112
118
  * Used as a key in the service provider to retrieve the registry.
113
119
  */
114
- declare const CliProcessorsRegistry_TOKEN = "cli-processors-registry";
120
+ declare const CliProcessorsRegistry_TOKEN: any;
115
121
  /**
116
122
  * Framework-agnostic token for the CLI state store manager.
117
123
  * Used as a key in the service provider to retrieve the state store manager.
118
124
  */
119
- declare const CliStateStoreManager_TOKEN = "cli-state-store-manager";
125
+ declare const CliStateStoreManager_TOKEN: any;
120
126
  /**
121
127
  * Framework-agnostic token for the CLI command history service.
122
128
  * Used as a key in the service provider to retrieve the command history.
123
129
  */
124
- declare const CliCommandHistory_TOKEN = "cli-command-history";
130
+ declare const CliCommandHistory_TOKEN: any;
125
131
  /**
126
132
  * Framework-agnostic token for the CLI ping server service.
127
133
  * Used as a key in the service provider to retrieve the ping server service.
128
134
  */
129
- declare const ICliPingServerService_TOKEN = "cli-ping-server-service";
135
+ declare const ICliPingServerService_TOKEN: any;
130
136
  /**
131
137
  * Framework-agnostic token for the CLI module registry.
132
138
  * Used as a key in the service provider to retrieve the module registry.
133
139
  */
134
- declare const CliModuleRegistry_TOKEN = "cli-module-registry";
140
+ declare const CliModuleRegistry_TOKEN: any;
141
+ /**
142
+ * The live boot report (`CliBootLog`) while the CLI starts. Processors and
143
+ * modules can add steps and lines from `initialize`/`onInit`; it ignores
144
+ * entries once boot has finished.
145
+ */
146
+ declare const CliBootLog_TOKEN: any;
135
147
  /**
136
148
  * Framework-agnostic token for the CLI background service registry.
137
149
  * Used as a key in the service provider to retrieve the background service registry.
138
150
  */
139
- declare const CliBackgroundServiceRegistry_TOKEN = "cli-background-service-registry";
151
+ declare const CliBackgroundServiceRegistry_TOKEN: any;
140
152
  /**
141
153
  * Framework-agnostic token for the CLI package manager service.
142
154
  * Used as a key in the service provider to retrieve the package manager.
143
155
  */
144
- declare const CliPackageManagerService_TOKEN = "cli-package-manager-service";
156
+ declare const CliPackageManagerService_TOKEN: any;
145
157
  /**
146
158
  * Framework-agnostic token for the CLI key-value store.
147
159
  * Used as a key in the service provider to retrieve the persistent storage.
148
160
  */
149
- declare const CliKeyValueStore_TOKEN = "cli-key-value-store";
161
+ declare const CliKeyValueStore_TOKEN: any;
150
162
  /**
151
163
  * Framework-agnostic token for the syntax highlighter registry.
152
164
  * Used as a key in the service provider to retrieve the syntax highlighter registry.
153
165
  */
154
- declare const SyntaxHighlighterRegistry_TOKEN = "syntax-highlighter-registry";
166
+ declare const SyntaxHighlighterRegistry_TOKEN: any;
155
167
 
156
- declare const LIBRARY_VERSION = "2.0.0-beta.16";
168
+ declare const LIBRARY_VERSION = "2.0.0-beta.18";
157
169
  declare const API_VERSION = 2;
158
170
 
159
171
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
160
172
  command: string;
161
- author: _qodalis_cli_core.ICliCommandAuthor;
173
+ author: any;
162
174
  description: string;
163
- processors?: ICliCommandProcessor[] | undefined;
175
+ acceptsRawInput: boolean;
164
176
  metadata?: CliProcessorMetadata | undefined;
165
177
  stateConfiguration?: CliStateConfiguration | undefined;
166
178
  /** Shared aliases (used when no auth module is loaded) */
@@ -169,7 +181,8 @@ declare class CliAliasCommandProcessor implements ICliCommandProcessor {
169
181
  /** Aliases visible to the current principal */
170
182
  aliasesFor(context: Pick<ICliExecutionContext, 'services'>): Record<string, string>;
171
183
  private stateSubscription?;
172
- constructor();
184
+ /** `alias ls`: list the aliases visible to the current principal */
185
+ private listAliases;
173
186
  writeDescription(context: ICliExecutionContext): void;
174
187
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
175
188
  initialize(context: ICliExecutionContext): Promise<void>;
@@ -179,7 +192,7 @@ declare class CliCalCommandProcessor implements ICliCommandProcessor {
179
192
  command: string;
180
193
  aliases: string[];
181
194
  description: string;
182
- author: _qodalis_cli_core.ICliCommandAuthor;
195
+ author: any;
183
196
  metadata?: CliProcessorMetadata;
184
197
  parameters: {
185
198
  name: string;
@@ -196,7 +209,7 @@ declare class CliClearCommandProcessor implements ICliCommandProcessor {
196
209
  command: string;
197
210
  aliases: string[];
198
211
  description?: string | undefined;
199
- author: _qodalis_cli_core.ICliCommandAuthor;
212
+ author: any;
200
213
  metadata?: CliProcessorMetadata | undefined;
201
214
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
202
215
  writeDescription(context: ICliExecutionContext): void;
@@ -206,7 +219,7 @@ declare class CliClipboardCommandProcessor implements ICliCommandProcessor {
206
219
  command: string;
207
220
  aliases: string[];
208
221
  description: string;
209
- author: _qodalis_cli_core.ICliCommandAuthor;
222
+ author: any;
210
223
  processors?: ICliCommandProcessor[];
211
224
  metadata?: CliProcessorMetadata;
212
225
  constructor();
@@ -218,7 +231,7 @@ declare class CliColorCommandProcessor implements ICliCommandProcessor {
218
231
  command: string;
219
232
  aliases: string[];
220
233
  description: string;
221
- author: _qodalis_cli_core.ICliCommandAuthor;
234
+ author: any;
222
235
  acceptsRawInput: boolean;
223
236
  valueRequired: boolean;
224
237
  metadata?: CliProcessorMetadata;
@@ -236,7 +249,7 @@ declare class CliConvertCommandProcessor implements ICliCommandProcessor {
236
249
  command: string;
237
250
  aliases: string[];
238
251
  description: string;
239
- author: _qodalis_cli_core.ICliCommandAuthor;
252
+ author: any;
240
253
  acceptsRawInput: boolean;
241
254
  valueRequired: boolean;
242
255
  metadata?: CliProcessorMetadata;
@@ -252,11 +265,9 @@ declare class CliEchoCommandProcessor implements ICliCommandProcessor {
252
265
  aliases: string[];
253
266
  description: string;
254
267
  acceptsRawInput: boolean;
255
- author: _qodalis_cli_core.ICliCommandAuthor;
268
+ author: any;
256
269
  metadata?: CliProcessorMetadata | undefined;
257
270
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
258
- /** Remove surrounding quotes from the text. */
259
- private stripQuotes;
260
271
  /** Interpret common escape sequences like a POSIX echo -e. */
261
272
  private interpretEscapes;
262
273
  writeDescription(context: ICliExecutionContext): void;
@@ -266,7 +277,7 @@ declare class CliEvalCommandProcessor implements ICliCommandProcessor {
266
277
  command: string;
267
278
  aliases: string[];
268
279
  description: string;
269
- author: _qodalis_cli_core.ICliCommandAuthor;
280
+ author: any;
270
281
  acceptsRawInput: boolean;
271
282
  metadata?: CliProcessorMetadata | undefined;
272
283
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
@@ -276,7 +287,7 @@ declare class CliEvalCommandProcessor implements ICliCommandProcessor {
276
287
  declare class CliJsonCommandProcessor implements ICliCommandProcessor {
277
288
  command: string;
278
289
  description: string;
279
- author: _qodalis_cli_core.ICliCommandAuthor;
290
+ author: any;
280
291
  processors?: ICliCommandProcessor[];
281
292
  metadata?: CliProcessorMetadata;
282
293
  constructor();
@@ -288,7 +299,7 @@ declare class CliLoremCommandProcessor implements ICliCommandProcessor {
288
299
  command: string;
289
300
  aliases: string[];
290
301
  description: string;
291
- author: _qodalis_cli_core.ICliCommandAuthor;
302
+ author: any;
292
303
  processors?: ICliCommandProcessor[];
293
304
  metadata?: CliProcessorMetadata;
294
305
  constructor();
@@ -300,7 +311,7 @@ declare class CliLoremCommandProcessor implements ICliCommandProcessor {
300
311
  declare class CliOpenCommandProcessor implements ICliCommandProcessor {
301
312
  command: string;
302
313
  description: string;
303
- author: _qodalis_cli_core.ICliCommandAuthor;
314
+ author: any;
304
315
  acceptsRawInput: boolean;
305
316
  valueRequired: boolean;
306
317
  metadata?: CliProcessorMetadata;
@@ -312,7 +323,7 @@ declare class CliRandomCommandProcessor implements ICliCommandProcessor {
312
323
  command: string;
313
324
  aliases: string[];
314
325
  description: string;
315
- author: _qodalis_cli_core.ICliCommandAuthor;
326
+ author: any;
316
327
  processors?: ICliCommandProcessor[];
317
328
  metadata?: CliProcessorMetadata;
318
329
  constructor();
@@ -324,7 +335,7 @@ declare class CliScreenCommandProcessor implements ICliCommandProcessor {
324
335
  command: string;
325
336
  aliases: string[];
326
337
  description: string;
327
- author: _qodalis_cli_core.ICliCommandAuthor;
338
+ author: any;
328
339
  metadata?: CliProcessorMetadata;
329
340
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
330
341
  writeDescription(context: ICliExecutionContext): void;
@@ -334,7 +345,7 @@ declare class CliSeqCommandProcessor implements ICliCommandProcessor {
334
345
  command: string;
335
346
  aliases: string[];
336
347
  description: string;
337
- author: _qodalis_cli_core.ICliCommandAuthor;
348
+ author: any;
338
349
  acceptsRawInput: boolean;
339
350
  valueRequired: boolean;
340
351
  metadata?: CliProcessorMetadata;
@@ -359,7 +370,7 @@ declare class CliSleepCommandProcessor implements ICliCommandProcessor {
359
370
  command: string;
360
371
  aliases: string[];
361
372
  description?: string | undefined;
362
- author: _qodalis_cli_core.ICliCommandAuthor;
373
+ author: any;
363
374
  metadata?: CliProcessorMetadata | undefined;
364
375
  valueRequired?: boolean | undefined;
365
376
  constructor();
@@ -371,7 +382,7 @@ declare class CliTimeCommandProcessor implements ICliCommandProcessor {
371
382
  command: string;
372
383
  aliases: string[];
373
384
  description: string;
374
- author: _qodalis_cli_core.ICliCommandAuthor;
385
+ author: any;
375
386
  version: string;
376
387
  processors?: ICliCommandProcessor[] | undefined;
377
388
  metadata?: CliProcessorMetadata | undefined;
@@ -384,7 +395,7 @@ declare class CliTimestampCommandProcessor implements ICliCommandProcessor {
384
395
  command: string;
385
396
  aliases: string[];
386
397
  description: string;
387
- author: _qodalis_cli_core.ICliCommandAuthor;
398
+ author: any;
388
399
  processors?: ICliCommandProcessor[];
389
400
  metadata?: CliProcessorMetadata;
390
401
  constructor();
@@ -394,7 +405,7 @@ declare class CliTimestampCommandProcessor implements ICliCommandProcessor {
394
405
 
395
406
  declare class CliUnAliasCommandProcessor implements ICliCommandProcessor {
396
407
  command: string;
397
- author: _qodalis_cli_core.ICliCommandAuthor;
408
+ author: any;
398
409
  description: string;
399
410
  valueRequired?: boolean | undefined;
400
411
  stateConfiguration?: CliStateConfiguration | undefined;
@@ -407,7 +418,7 @@ declare class CliUnameCommandProcessor implements ICliCommandProcessor {
407
418
  command: string;
408
419
  aliases: string[];
409
420
  description?: string | undefined;
410
- author: _qodalis_cli_core.ICliCommandAuthor;
421
+ author: any;
411
422
  metadata?: CliProcessorMetadata | undefined;
412
423
  writeDescription(context: ICliExecutionContext): void;
413
424
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
@@ -421,7 +432,7 @@ declare class CliUnameCommandProcessor implements ICliCommandProcessor {
421
432
  declare class CliUptimeCommandProcessor implements ICliCommandProcessor {
422
433
  command: string;
423
434
  description: string;
424
- author: _qodalis_cli_core.ICliCommandAuthor;
435
+ author: any;
425
436
  metadata?: CliProcessorMetadata;
426
437
  initialize(context: ICliExecutionContext): Promise<void>;
427
438
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
@@ -431,7 +442,7 @@ declare class CliUptimeCommandProcessor implements ICliCommandProcessor {
431
442
  declare class CliYesCommandProcessor implements ICliCommandProcessor {
432
443
  command: string;
433
444
  description: string;
434
- author: _qodalis_cli_core.ICliCommandAuthor;
445
+ author: any;
435
446
  acceptsRawInput: boolean;
436
447
  metadata?: CliProcessorMetadata;
437
448
  parameters: {
@@ -445,14 +456,49 @@ declare class CliYesCommandProcessor implements ICliCommandProcessor {
445
456
  writeDescription(context: ICliExecutionContext): void;
446
457
  }
447
458
 
459
+ /**
460
+ * `test EXPR` / `[ EXPR ]`: evaluate a condition; exit status 0 when true,
461
+ * 1 when false and 2 on an error. Used by `if`, `while` and `&&`/`||`.
462
+ */
463
+ declare class CliTestCommandProcessor implements ICliCommandProcessor {
464
+ command: string;
465
+ aliases: string[];
466
+ description: string;
467
+ author: any;
468
+ acceptsRawInput: boolean;
469
+ metadata?: CliProcessorMetadata;
470
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
471
+ writeDescription(context: ICliExecutionContext): void;
472
+ }
473
+ /** `true`: do nothing, successfully (also `:`). */
474
+ declare class CliTrueCommandProcessor implements ICliCommandProcessor {
475
+ command: string;
476
+ aliases: string[];
477
+ description: string;
478
+ author: any;
479
+ acceptsRawInput: boolean;
480
+ metadata?: CliProcessorMetadata;
481
+ processCommand(): Promise<void>;
482
+ }
483
+ /** `false`: do nothing, unsuccessfully (exit status 1). */
484
+ declare class CliFalseCommandProcessor implements ICliCommandProcessor {
485
+ command: string;
486
+ description: string;
487
+ author: any;
488
+ acceptsRawInput: boolean;
489
+ metadata?: CliProcessorMetadata;
490
+ processCommand(_command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
491
+ }
492
+
448
493
  declare class CliCaptureCommandProcessor implements ICliCommandProcessor {
449
494
  command: string;
450
495
  description: string;
451
496
  aliases: string[];
452
497
  author: ICliCommandAuthor;
453
498
  metadata: CliProcessorMetadata;
454
- parameters: ICliCommandParameterDescriptor[];
499
+ parameters: ICliCommandParameterDescriptor$1[];
455
500
  processCommand(cmd: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
501
+ writeDescription(context: ICliExecutionContext): void;
456
502
  private sanitizeCssColor;
457
503
  private toHtml;
458
504
  private escapeHtml;
@@ -467,6 +513,7 @@ declare class CliSnippetCommandProcessor implements ICliCommandProcessor {
467
513
  metadata: CliProcessorMetadata;
468
514
  stateConfiguration: CliStateConfiguration;
469
515
  processors: ICliCommandChildProcessor[];
516
+ writeDescription(context: ICliExecutionContext): void;
470
517
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
471
518
  }
472
519
 
@@ -475,8 +522,9 @@ declare class CliDiffCommandProcessor implements ICliCommandProcessor {
475
522
  description: string;
476
523
  author: ICliCommandAuthor;
477
524
  metadata: CliProcessorMetadata;
478
- parameters: ICliCommandParameterDescriptor[];
525
+ parameters: ICliCommandParameterDescriptor$1[];
479
526
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
527
+ writeDescription(context: ICliExecutionContext): void;
480
528
  }
481
529
 
482
530
  type DiffType = 'same' | 'add' | 'remove';
@@ -498,11 +546,17 @@ declare class CliHelpCommandProcessor implements ICliCommandProcessor {
498
546
  aliases: string[];
499
547
  description: string;
500
548
  acceptsRawInput?: boolean | undefined;
501
- author: _qodalis_cli_core.ICliCommandAuthor;
549
+ author: any;
502
550
  metadata?: CliProcessorMetadata | undefined;
503
551
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
504
552
  writeDescription(context: ICliExecutionContext): void;
505
553
  private translateDescription;
554
+ /**
555
+ * Canonical path of the command being described (`server.status` for
556
+ * `help srv ping`), so a sub-command's translation keys include its
557
+ * parents: `cli.server.status.description`.
558
+ */
559
+ private commandPath;
506
560
  private writeProcessorDescription;
507
561
  private formatModuleName;
508
562
  private writeParameter;
@@ -548,44 +602,45 @@ declare class CliHotKeysCommandProcessor implements ICliCommandProcessor {
548
602
  aliases: string[];
549
603
  description: string;
550
604
  processors?: ICliCommandProcessor[] | undefined;
551
- author: _qodalis_cli_core.ICliCommandAuthor;
605
+ author: any;
552
606
  metadata?: CliProcessorMetadata | undefined;
553
607
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
554
608
  writeDescription(context: ICliExecutionContext): void;
555
609
  }
556
610
 
611
+ /** `pkg`: install, update and remove CLI plugins at runtime from npm/CDN sources. */
557
612
  declare class CliPackagesCommandProcessor implements ICliCommandProcessor {
558
613
  readonly command = "pkg";
559
614
  readonly aliases: string[];
560
615
  description: string;
561
- author: _qodalis_cli_core.ICliCommandAuthor;
562
- readonly version = "1.0.3";
563
- readonly processors?: ICliCommandProcessor[] | undefined;
616
+ author: any;
617
+ readonly version = "1.1.0";
618
+ readonly processors: ICliCommandProcessor[];
564
619
  readonly metadata?: CliProcessorMetadata | undefined;
565
620
  stateConfiguration?: CliStateConfiguration | undefined;
566
- private registeredDependencies;
567
- private scriptsLoader;
568
- private packagesManager;
569
- private registry;
570
- private createAbortSignal;
621
+ private readonly loader;
622
+ private readonly manager;
623
+ private readonly installer;
571
624
  constructor();
572
625
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
573
- writeDescription?(context: ICliExecutionContext): void;
626
+ writeDescription(context: ICliExecutionContext): void;
574
627
  initialize(context: ICliExecutionContext): Promise<void>;
575
- private removePackage;
576
- private addPackage;
577
- private doAddPackage;
578
- private updatePackage;
579
- private injectScriptWithCdnFallback;
580
- private registerPackageDependencies;
581
- private resolvePackageCdnPath;
582
- private waitForGlobal;
628
+ private lsCommand;
629
+ private browseCommand;
630
+ private addCommand;
631
+ private removeCommand;
632
+ private versionsCommand;
633
+ private checkCommand;
634
+ private updateCommand;
635
+ private sourceCommand;
636
+ /** Install as a tracked background job (visible in `services`), or inline if that fails. */
637
+ private installInBackground;
583
638
  }
584
639
 
585
640
  declare class CliDebugCommandProcessor implements ICliCommandProcessor {
586
641
  command: string;
587
642
  description: string;
588
- author: _qodalis_cli_core.ICliCommandAuthor;
643
+ author: any;
589
644
  metadata?: CliProcessorMetadata;
590
645
  processors?: ICliCommandProcessor[];
591
646
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
@@ -597,7 +652,7 @@ declare class CliNanoCommandProcessor implements ICliCommandProcessor {
597
652
  command: string;
598
653
  aliases: string[];
599
654
  description: string;
600
- author: _qodalis_cli_core.ICliCommandAuthor;
655
+ author: any;
601
656
  acceptsRawInput: boolean;
602
657
  metadata: CliProcessorMetadata;
603
658
  private buffer;
@@ -635,7 +690,7 @@ declare class CliServicesCommandProcessor implements ICliCommandProcessor {
635
690
  command: string;
636
691
  aliases: string[];
637
692
  description: string;
638
- author: _qodalis_cli_core.ICliCommandAuthor;
693
+ author: any;
639
694
  processors?: ICliCommandProcessor[];
640
695
  metadata?: CliProcessorMetadata;
641
696
  constructor();
@@ -643,33 +698,50 @@ declare class CliServicesCommandProcessor implements ICliCommandProcessor {
643
698
  writeDescription(context: ICliExecutionContext): void;
644
699
  }
645
700
 
701
+ /**
702
+ * `events`: inspect the terminal's event bus — watch events live, show the
703
+ * recent ones, or emit one (for testing plugins).
704
+ */
705
+ declare class CliEventsCommandProcessor implements ICliCommandProcessor {
706
+ command: string;
707
+ description: string;
708
+ author: any;
709
+ version: string;
710
+ metadata?: CliProcessorMetadata;
711
+ processors: ICliCommandProcessor[];
712
+ processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
713
+ writeDescription(context: ICliExecutionContext): void;
714
+ }
715
+
646
716
  declare class CliPsCommandProcessor implements ICliCommandProcessor {
647
717
  command: string;
648
718
  description: string;
649
- author: _qodalis_cli_core.ICliCommandAuthor;
719
+ author: any;
650
720
  metadata: {
651
721
  icon: string;
652
722
  sealed: boolean;
653
723
  };
654
724
  processCommand(_command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
725
+ writeDescription(context: ICliExecutionContext): void;
655
726
  }
656
727
 
657
728
  declare class CliKillCommandProcessor implements ICliCommandProcessor {
658
729
  command: string;
659
730
  description: string;
660
- author: _qodalis_cli_core.ICliCommandAuthor;
731
+ author: any;
661
732
  valueRequired: boolean;
662
733
  metadata: {
663
734
  icon: string;
664
735
  sealed: boolean;
665
736
  };
666
737
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
738
+ writeDescription(context: ICliExecutionContext): void;
667
739
  }
668
740
 
669
741
  declare class CliHtopCommandProcessor implements ICliCommandProcessor {
670
742
  command: string;
671
743
  description: string;
672
- author: _qodalis_cli_core.ICliCommandAuthor;
744
+ author: any;
673
745
  metadata?: CliProcessorMetadata;
674
746
  private context;
675
747
  private registry;
@@ -718,6 +790,8 @@ declare class CliThemeCommandProcessor implements ICliCommandProcessor {
718
790
  private defaultTheme;
719
791
  constructor();
720
792
  initialize(context: ICliExecutionContext): Promise<void>;
793
+ /** Apply the saved theme (or the default one when `reset` and none is saved). */
794
+ private applySavedTheme;
721
795
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
722
796
  private renderThemePreview;
723
797
  private applyStyles;
@@ -729,39 +803,7 @@ type ThemeState = {
729
803
  selectedTheme?: string;
730
804
  customOptions?: ITheme;
731
805
  };
732
- declare const themes: {
733
- [key: string]: ITheme;
734
- default: _qodalis_cli_core.CliTheme;
735
- classic: _qodalis_cli_core.CliTheme;
736
- dracula: _qodalis_cli_core.CliTheme;
737
- monokai: _qodalis_cli_core.CliTheme;
738
- solarizedDark: _qodalis_cli_core.CliTheme;
739
- solarizedLight: _qodalis_cli_core.CliTheme;
740
- gruvboxDark: _qodalis_cli_core.CliTheme;
741
- gruvboxLight: _qodalis_cli_core.CliTheme;
742
- nord: _qodalis_cli_core.CliTheme;
743
- oneDark: _qodalis_cli_core.CliTheme;
744
- material: _qodalis_cli_core.CliTheme;
745
- highContrastLight: _qodalis_cli_core.CliTheme;
746
- tokyoNight: _qodalis_cli_core.CliTheme;
747
- catppuccinMocha: _qodalis_cli_core.CliTheme;
748
- catppuccinFrappe: _qodalis_cli_core.CliTheme;
749
- rosePine: _qodalis_cli_core.CliTheme;
750
- kanagawa: _qodalis_cli_core.CliTheme;
751
- everforestDark: _qodalis_cli_core.CliTheme;
752
- ayuDark: _qodalis_cli_core.CliTheme;
753
- catppuccinLatte: _qodalis_cli_core.CliTheme;
754
- rosePineDawn: _qodalis_cli_core.CliTheme;
755
- everforestLight: _qodalis_cli_core.CliTheme;
756
- githubLight: _qodalis_cli_core.CliTheme;
757
- cyberpunk: _qodalis_cli_core.CliTheme;
758
- retroGreen: _qodalis_cli_core.CliTheme;
759
- retroAmber: _qodalis_cli_core.CliTheme;
760
- matrix: _qodalis_cli_core.CliTheme;
761
- synthwave: _qodalis_cli_core.CliTheme;
762
- highContrastDark: _qodalis_cli_core.CliTheme;
763
- yellow: _qodalis_cli_core.CliTheme;
764
- };
806
+ declare const themes: any;
765
807
  declare const themeInfos: Record<string, CliThemeInfo>;
766
808
 
767
809
  declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
@@ -782,6 +824,10 @@ declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
782
824
  private setConfigValue;
783
825
  private getConfigValue;
784
826
  private getAllOptions;
827
+ /**
828
+ * @param onBoot at startup, terminal options still at their default are skipped so the
829
+ * host's `terminalOptions` (e.g. its own fontSize) are not overridden.
830
+ */
785
831
  private applySystemSettings;
786
832
  private buildListProcessor;
787
833
  private buildGetProcessor;
@@ -816,22 +862,39 @@ declare class CliPingCommandProcessor implements ICliCommandProcessor {
816
862
  private sleep;
817
863
  }
818
864
 
865
+ /** Permission to change shared variables, when an auth module is loaded. */
866
+ declare const CLI_ENV_GLOBAL_PERMISSION = "system:env:global";
867
+ /** Parse `A=1 B="two words" C` into assignments; bare names have no value. */
868
+ declare function parseAssignments(raw: string): {
869
+ name: string;
870
+ value?: string;
871
+ }[] | null;
819
872
  /**
820
873
  * `export` — set environment variables.
821
874
  *
822
875
  * Usage:
823
876
  * export VAR=value
824
- * export VAR="value with spaces"
877
+ * export VAR="value with spaces" OTHER=1
878
+ *
879
+ * Variables are saved for the signed-in user (`--global`: for everyone) and
880
+ * restored on the next visit. `NAME=value` alone is for this terminal only.
825
881
  */
826
882
  declare class CliExportCommandProcessor implements ICliCommandProcessor {
827
883
  command: string;
828
884
  description: string;
829
- author: _qodalis_cli_core.ICliCommandAuthor;
885
+ author: any;
830
886
  acceptsRawInput: boolean;
831
887
  metadata: {
832
888
  icon: string;
833
889
  module: string;
834
890
  };
891
+ parameters: ICliCommandParameterDescriptor[];
892
+ stateConfiguration: CliStateConfiguration;
893
+ /**
894
+ * Restore saved variables, save every later change (export, unset) and
895
+ * follow changes saved in other tabs and terminals.
896
+ */
897
+ initialize(context: ICliExecutionContext): Promise<void>;
835
898
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
836
899
  writeDescription(context: ICliExecutionContext): void;
837
900
  }
@@ -841,12 +904,13 @@ declare class CliExportCommandProcessor implements ICliCommandProcessor {
841
904
  declare class CliUnsetCommandProcessor implements ICliCommandProcessor {
842
905
  command: string;
843
906
  description: string;
844
- author: _qodalis_cli_core.ICliCommandAuthor;
907
+ author: any;
845
908
  acceptsRawInput: boolean;
846
909
  metadata: {
847
910
  icon: string;
848
911
  module: string;
849
912
  };
913
+ parameters: any[];
850
914
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
851
915
  writeDescription(context: ICliExecutionContext): void;
852
916
  }
@@ -857,7 +921,7 @@ declare class CliEnvCommandProcessor implements ICliCommandProcessor {
857
921
  command: string;
858
922
  aliases: string[];
859
923
  description: string;
860
- author: _qodalis_cli_core.ICliCommandAuthor;
924
+ author: any;
861
925
  acceptsRawInput: boolean;
862
926
  metadata: {
863
927
  icon: string;
@@ -875,13 +939,18 @@ declare class CliFontSizeCommandProcessor implements ICliCommandProcessor {
875
939
  metadata: CliProcessorMetadata;
876
940
  stateConfiguration: CliStateConfiguration;
877
941
  processors: ICliCommandProcessor[];
942
+ /** The size the host configured (or the built-in default), restored by `font-size reset`. */
943
+ private hostFontSize?;
878
944
  initialize(context: ICliExecutionContext): Promise<void>;
879
945
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
946
+ writeDescription(context: ICliExecutionContext): void;
880
947
  private getCurrent;
948
+ private getDefault;
949
+ private resetFontSize;
881
950
  private setFontSize;
882
951
  }
883
952
 
884
- declare const miscProcessors: (CliAliasCommandProcessor | CliCalCommandProcessor | CliClearCommandProcessor | CliClipboardCommandProcessor | CliColorCommandProcessor | CliConvertCommandProcessor | CliEchoCommandProcessor | CliEvalCommandProcessor | CliJsonCommandProcessor | CliLoremCommandProcessor | CliOpenCommandProcessor | CliRandomCommandProcessor | CliScreenCommandProcessor | CliSeqCommandProcessor | CliSleepCommandProcessor | CliTimeCommandProcessor | CliTimestampCommandProcessor | CliUnAliasCommandProcessor | CliUnameCommandProcessor | CliUptimeCommandProcessor | CliYesCommandProcessor)[];
953
+ declare const miscProcessors: (CliClearCommandProcessor | CliEchoCommandProcessor | CliEvalCommandProcessor | CliAliasCommandProcessor | CliUnAliasCommandProcessor | CliSleepCommandProcessor | CliUnameCommandProcessor | CliTimeCommandProcessor | CliJsonCommandProcessor | CliRandomCommandProcessor | CliUptimeCommandProcessor | CliOpenCommandProcessor | CliLoremCommandProcessor | CliTimestampCommandProcessor | CliColorCommandProcessor | CliCalCommandProcessor | CliSeqCommandProcessor | CliScreenCommandProcessor | CliClipboardCommandProcessor | CliConvertCommandProcessor | CliYesCommandProcessor | CliTestCommandProcessor | CliTrueCommandProcessor | CliFalseCommandProcessor)[];
885
954
  declare const builtinProcessors: ICliCommandProcessor[];
886
955
 
887
956
  declare class CliExecutionProcess implements ICliExecutionProcess {
@@ -946,6 +1015,8 @@ declare class CliCommandExecutionContext implements ICliExecutionContext {
946
1015
  createInterval: (callback: () => void, ms: number) => ICliManagedInterval;
947
1016
  createTimeout: (callback: () => void, ms: number) => ICliManagedTimer;
948
1017
  submitCommand: (command: string) => Promise<void>;
1018
+ events?: ICliEventBus;
1019
+ get isBooted(): boolean | undefined;
949
1020
  constructor(context: ICliExecutionContext, processor: ICliCommandProcessor);
950
1021
  }
951
1022
 
@@ -984,7 +1055,7 @@ declare class CliCommandHistory {
984
1055
 
985
1056
  interface ICliStateStoreManager {
986
1057
  getProcessorStateStore(processor: ICliCommandProcessor): ICliStateStore;
987
- getStateStore(name: string, defaultState?: Record<string, any>): ICliStateStore;
1058
+ getStateStore(name: string, defaultState?: Record<string, any>, options?: CliStateStoreOptions): ICliStateStore;
988
1059
  getStoreEntries(): {
989
1060
  name: string;
990
1061
  state: Record<string, any>;
@@ -994,9 +1065,25 @@ declare class CliStateStoreManager implements ICliStateStoreManager {
994
1065
  private readonly services;
995
1066
  private readonly registry;
996
1067
  private stores;
1068
+ private channel?;
1069
+ /** The signed-in user (for `scope: 'user'` stores). */
1070
+ private user?;
1071
+ private stopFollowingUser?;
997
1072
  constructor(services: ICliServiceProvider, registry: ICliCommandProcessorRegistry);
998
- getStateStore(name: string, defaultState?: Record<string, any>): ICliStateStore;
1073
+ /**
1074
+ * Get (or create) the store `name`. Defaults and options passed for a
1075
+ * store that already exists are added to it: a store read early (e.g.
1076
+ * by the boot report) still gets its command's initial state.
1077
+ */
1078
+ getStateStore(name: string, defaultState?: Record<string, any>, options?: CliStateStoreOptions): ICliStateStore;
999
1079
  getProcessorStateStore(processor: ICliCommandProcessor): ICliStateStore;
1080
+ /**
1081
+ * Follow the signed-in user (`session:changed` events), so `scope: 'user'`
1082
+ * stores switch to that user's state.
1083
+ */
1084
+ followUser(events: ICliEventBus): void;
1085
+ /** Switch `scope: 'user'` stores to `user`'s saved state. */
1086
+ setUser(user: string | undefined): void;
1000
1087
  /**
1001
1088
  * Returns all store names and their current state values.
1002
1089
  */
@@ -1009,6 +1096,9 @@ declare class CliStateStoreManager implements ICliStateStoreManager {
1009
1096
  * Called during engine teardown.
1010
1097
  */
1011
1098
  dispose(): void;
1099
+ /** Tell other tabs and terminals that a store was saved. */
1100
+ private publish;
1101
+ private listen;
1012
1102
  }
1013
1103
 
1014
1104
  /**
@@ -1044,6 +1134,10 @@ declare class CliCompletionEngine {
1044
1134
  candidates?: string[];
1045
1135
  }>;
1046
1136
  private buildContext;
1137
+ /**
1138
+ * Words with their start, quote-aware: `cat "my notes.txt"` has two, and an
1139
+ * unclosed quote runs to the end (`cat "my no` is being typed).
1140
+ */
1047
1141
  private tokenize;
1048
1142
  private fetchCompletions;
1049
1143
  /**
@@ -1197,7 +1291,12 @@ interface CliExecutionContextDeps {
1197
1291
  declare class CliExecutionContext implements ICliExecutionContext, InputModeHost, CommandLineModeHost {
1198
1292
  terminal: Terminal;
1199
1293
  executor: ICliCommandExecutorService;
1200
- userSession?: ICliUserSession;
1294
+ private _userSession?;
1295
+ /** The signed-in user; changing it emits `session:changed`. */
1296
+ get userSession(): ICliUserSession | undefined;
1297
+ set userSession(session: ICliUserSession | undefined);
1298
+ /** The terminal's event bus. */
1299
+ readonly events?: ICliEventBus;
1201
1300
  contextProcessor?: ICliCommandProcessor;
1202
1301
  readonly writer: ICliTerminalWriter;
1203
1302
  readonly spinner: ICliSpinner;
@@ -1236,6 +1335,10 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1236
1335
  readonly commandHistory: CliCommandHistory;
1237
1336
  readonly filePickerProvider: ICliFilePickerProvider;
1238
1337
  private readonly modeStack;
1338
+ /** Command-line input typed while booting; `null` when not holding. */
1339
+ private heldInput;
1340
+ private releaseHeldInputAtPrompt;
1341
+ private _typedDuringBoot;
1239
1342
  private readonly stateStoreManager;
1240
1343
  private readonly timerManager;
1241
1344
  private readonly fullScreenManager;
@@ -1248,6 +1351,25 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
1248
1351
  get cursorPosition(): number;
1249
1352
  set cursorPosition(value: number);
1250
1353
  initializeTerminalListeners(): void;
1354
+ private handleTerminalData;
1355
+ private _isBooted;
1356
+ /** `true` once boot has completed and the terminal is ready. */
1357
+ get isBooted(): boolean;
1358
+ /** Called by the engine when boot has completed. */
1359
+ markBooted(): void;
1360
+ /** Start keeping command-line input instead of handling it (boot). */
1361
+ holdInput(): void;
1362
+ /**
1363
+ * Stop holding input: what was typed is replayed at the next prompt, or
1364
+ * right away when `immediately` is set (e.g. no prompt will be drawn).
1365
+ */
1366
+ releaseInput(immediately?: boolean): void;
1367
+ /** Whether a prompt (readLine, readSelect, ...) or full-screen mode owns the input. */
1368
+ get isReadingInput(): boolean;
1369
+ /** Whether keys were typed while input was held (boot). */
1370
+ get typedDuringBoot(): boolean;
1371
+ private replayHeldInput;
1372
+ private initializeWindowListeners;
1251
1373
  setContextProcessor: (processor: ICliCommandProcessor | undefined, silent?: boolean, fullScreen?: boolean) => void;
1252
1374
  setCurrentLine(line: string): void;
1253
1375
  clearLine(): void;
@@ -1310,7 +1432,7 @@ declare class CliBackgroundServiceRegistry implements ICliBackgroundServiceRegis
1310
1432
  private isFullScreen;
1311
1433
  private notificationQueue;
1312
1434
  private processRegistry?;
1313
- constructor(state: ICliStateStore, services: ICliServiceProvider, writer?: ICliTerminalWriter | undefined);
1435
+ constructor(state: ICliStateStore, services: ICliServiceProvider, writer?: ICliTerminalWriter);
1314
1436
  /** Attach the process registry so background services get PIDs */
1315
1437
  setProcessRegistry(registry: ICliProcessRegistry): void;
1316
1438
  register(service: ICliBackgroundService): void;
@@ -1335,6 +1457,12 @@ declare class CliBackgroundServiceRegistry implements ICliBackgroundServiceRegis
1335
1457
  private updateStatus;
1336
1458
  private handleStartError;
1337
1459
  private dispatchEvent;
1460
+ /**
1461
+ * Publish service events on the terminal's event bus: lifecycle events as
1462
+ * `service:<started|stopped|...>`, events relayed from a server's event
1463
+ * socket as `server:event`, other custom events as `service:event`.
1464
+ */
1465
+ private forwardToEventBus;
1338
1466
  private emitLifecycleEvent;
1339
1467
  private notify;
1340
1468
  private flushNotificationQueue;
@@ -1403,10 +1531,23 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
1403
1531
  protected readonly registry: ICliCommandProcessorRegistry;
1404
1532
  private commandParser;
1405
1533
  private globalParameters;
1534
+ /** Exit status of the last command, expanded as `$?` (0 = success). */
1535
+ private lastExitCode;
1536
+ /** Command lines running per terminal (they can overlap). */
1537
+ private readonly running;
1538
+ /** Exit status of the last command line run (`$?`). */
1539
+ get exitStatus(): number;
1406
1540
  constructor(registry: ICliCommandProcessorRegistry);
1407
1541
  registerGlobalParameter(handler: ICliGlobalParameterHandler): void;
1408
- getGlobalParameters(): ICliCommandParameterDescriptor[];
1542
+ getGlobalParameters(): ICliCommandParameterDescriptor$1[];
1409
1543
  executeCommand(command: string, context: ICliExecutionContext): Promise<void>;
1544
+ /** Whether the command named first on the line takes literal input. */
1545
+ private isLiteralInput;
1546
+ /**
1547
+ * Run a command line and return its output as text instead of showing
1548
+ * it (`$(...)`); its errors and warnings are still shown.
1549
+ */
1550
+ capture(command: string, from: ICliExecutionContext): Promise<string>;
1410
1551
  private executeSingleCommand;
1411
1552
  private completeProcess;
1412
1553
  private failProcess;
@@ -1435,6 +1576,11 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
1435
1576
  * A guard that throws is treated as a denial (fail closed).
1436
1577
  */
1437
1578
  private runGuards;
1579
+ /**
1580
+ * The text after the word that selected `processor`, which may be its
1581
+ * command or one of its aliases (e.g. `pkg rm guid` -> `guid`).
1582
+ */
1583
+ private extractPositionalValue;
1438
1584
  private guardDenial;
1439
1585
  private processorOwnsParameter;
1440
1586
  }
@@ -1462,6 +1608,9 @@ declare const contextGlobalParameter: ICliGlobalParameterHandler;
1462
1608
  *
1463
1609
  * After a command finishes, the executor can retrieve the captured data to use
1464
1610
  * as implicit pipeline output when the command did not call `process.output()`.
1611
+ *
1612
+ * `muted` (output going into a pipe or a file) captures stdout-equivalent
1613
+ * output without showing it; diagnostics are still shown.
1465
1614
  */
1466
1615
  declare class CapturingTerminalWriter implements ICliTerminalWriter {
1467
1616
  private readonly inner;
@@ -1473,7 +1622,15 @@ declare class CapturingTerminalWriter implements ICliTerminalWriter {
1473
1622
  private _tableObjects;
1474
1623
  /** Raw text lines captured from writeError/writeWarning calls. */
1475
1624
  private _stderrLines;
1476
- constructor(inner: ICliTerminalWriter);
1625
+ /** Number of writeError calls (warnings excluded). */
1626
+ private _errorCount;
1627
+ private readonly muted;
1628
+ constructor(inner: ICliTerminalWriter, options?: {
1629
+ muted?: boolean;
1630
+ });
1631
+ /** Show stdout-equivalent output unless muted. */
1632
+ private show;
1633
+ private captureText;
1477
1634
  write(text: string): void;
1478
1635
  writeln(text?: string): void;
1479
1636
  writeJson(json: any): void;
@@ -1526,6 +1683,8 @@ declare class CapturingTerminalWriter implements ICliTerminalWriter {
1526
1683
  * 4. Returns `undefined` if nothing was captured.
1527
1684
  */
1528
1685
  getCapturedData(): any | undefined;
1686
+ /** Whether the command wrote an error message itself. */
1687
+ hasErrors(): boolean;
1529
1688
  /**
1530
1689
  * Returns true if any stderr-equivalent output was captured.
1531
1690
  */
@@ -1564,31 +1723,166 @@ declare function tryExecuteScript(filePath: string, context: ICliExecutionHost,
1564
1723
  */
1565
1724
  declare function substituteVars(input: string, variables: Record<string, string>): string;
1566
1725
  /**
1567
- * Expand $VAR and ${VAR} references using the global environment store.
1568
- * Variables inside single-quoted strings are NOT expanded (like bash).
1726
+ * Expand `$VAR` and `${VAR}` references using the global environment store, `$?`
1727
+ * to the last exit status, and a leading `~` (alone or as `~/…`) to `$HOME`.
1728
+ * Nothing is expanded inside single-quoted strings (like bash).
1729
+ */
1730
+ declare function expandEnvironmentVars(command: string, context: ICliExecutionContext, lastExitCode?: number): string;
1731
+
1732
+ /**
1733
+ * Shell-style script runner shared by `sh <file>` / `source` (files plugin)
1734
+ * and `./script.sh` (the executor).
1735
+ *
1736
+ * Supported (a POSIX sh subset):
1737
+ * - one command per line or several separated by `;` (pipes, `&&`, `||`
1738
+ * and redirects are left to the executor)
1739
+ * - `# comments`, blank lines, `\` line continuation
1740
+ * - `set -e` (default) / `set +e`, `VAR=value` (script-scoped), `exit [n]`
1741
+ * - `if cmd; then ...; elif cmd; then ...; else ...; fi`
1742
+ * - `for NAME in words...; do ...; done` (words after `$VAR` and wildcard
1743
+ * expansion; NAME is set for this terminal)
1744
+ * - `while cmd; do ...; done`, `until cmd; do ...; done`
1745
+ * - `break [n]`, `continue [n]`, `! cmd` (negated status)
1746
+ *
1747
+ * Every simple command runs through the executor; its status is
1748
+ * `context.process.exitCode` (0 or undefined = success).
1749
+ */
1750
+ /** Service token under which the engine provides the runner (for plugins). */
1751
+ declare const ICliScriptRunner_TOKEN: any;
1752
+ interface ICliScriptRunOptions {
1753
+ /** Prefix for error messages (`sh: line 4: ...`). Default `sh`. */
1754
+ name?: string;
1755
+ /** Runs one command line. Default `context.executor.executeCommand`. */
1756
+ executeCommand?: (command: string, context: ICliExecutionContext) => Promise<void>;
1757
+ /** Loop iterations allowed before a `while`/`until` is stopped. Default 10000. */
1758
+ maxLoopIterations?: number;
1759
+ /** Stop at the first failing command (`set -e`). Default true; false for typed lines. */
1760
+ stopOnError?: boolean;
1761
+ }
1762
+ interface ICliScriptRunner {
1763
+ /** Run script `content`; resolves to its exit status. */
1764
+ run(content: string, context: ICliExecutionContext, options?: ICliScriptRunOptions): Promise<number>;
1765
+ }
1766
+ /** The runner as a service value. */
1767
+ declare const cliScriptRunner: ICliScriptRunner;
1768
+ interface CommandNode {
1769
+ type: 'command';
1770
+ text: string;
1771
+ line: number;
1772
+ negate: boolean;
1773
+ }
1774
+ interface IfNode {
1775
+ type: 'if';
1776
+ line: number;
1777
+ branches: {
1778
+ condition: ScriptNode[];
1779
+ body: ScriptNode[];
1780
+ }[];
1781
+ elseBody?: ScriptNode[];
1782
+ }
1783
+ interface ForNode {
1784
+ type: 'for';
1785
+ line: number;
1786
+ name: string;
1787
+ words: string;
1788
+ body: ScriptNode[];
1789
+ }
1790
+ interface WhileNode {
1791
+ type: 'while';
1792
+ line: number;
1793
+ until: boolean;
1794
+ condition: ScriptNode[];
1795
+ body: ScriptNode[];
1796
+ }
1797
+ type ScriptNode = CommandNode | IfNode | ForNode | WhileNode;
1798
+ /** A syntax error found while parsing. */
1799
+ declare class CliScriptSyntaxError extends Error {
1800
+ readonly line: number;
1801
+ readonly detail: string;
1802
+ constructor(line: number, detail: string);
1803
+ }
1804
+ /** Parse script content (throws {@link CliScriptSyntaxError}). */
1805
+ declare function parseScript(content: string): ScriptNode[];
1806
+ /** Split a line into words, removing quotes (empty quoted words are kept). */
1807
+ declare function splitWords(text: string): string[];
1808
+ /**
1809
+ * Run script content with shell control flow. Resolves to the exit status
1810
+ * (also set as the context's process exit code).
1811
+ */
1812
+ declare function runScript(content: string, context: ICliExecutionContext, options?: ICliScriptRunOptions): Promise<number>;
1813
+
1814
+ /** The file system calls glob expansion needs (`@qodalis/cli-files`). */
1815
+ interface GlobFileSystem {
1816
+ getCurrentDirectory(): string;
1817
+ resolvePath(path: string): string;
1818
+ listDirectory(path: string): {
1819
+ name: string;
1820
+ type: 'file' | 'directory';
1821
+ }[];
1822
+ exists(path: string): boolean;
1823
+ isDirectory(path: string): boolean;
1824
+ }
1825
+ /**
1826
+ * Expand `*`, `?` and `[...]` in unquoted arguments to the matching paths,
1827
+ * as a shell does: `rm *.txt`, `cat docs/*.md`. The command name and flags
1828
+ * are left alone, names starting with `.` match only a pattern that starts
1829
+ * with `.`, and a pattern that matches nothing is kept as typed.
1830
+ * Without the files plugin the command is returned unchanged.
1831
+ */
1832
+ declare function expandGlobs(command: string, context: ICliExecutionContext): string;
1833
+ /** Paths matching `pattern`, sorted, relative when the pattern is. */
1834
+ declare function matchGlob(fs: GlobFileSystem, pattern: string): string[];
1835
+ /**
1836
+ * Brace expansion, as a shell does before wildcards: `file.{ts,js}` is
1837
+ * `file.ts file.js`, `img{1..3}.png` is `img1.png img2.png img3.png`
1838
+ * (letters too: `{a..c}`). Only unquoted words with a `,` or `..` inside
1839
+ * balanced braces; `${VAR}` and quoted text are left alone. Works without
1840
+ * the files plugin.
1841
+ */
1842
+ declare function expandBraces(command: string): string;
1843
+
1844
+ /**
1845
+ * Replace `$(command)` and `` `command` `` with the command's output, as a
1846
+ * shell does: `echo "Today: $(date)"`. Not inside single quotes; inside
1847
+ * double quotes yes. Trailing newlines of the output are removed, and the
1848
+ * output is escaped so it is only ever text: inside double quotes `"`, `\`,
1849
+ * `$` and `` ` ``; outside quotes every shell character but spaces (which
1850
+ * still separate words), so quotes, operators, `$`, wildcards and braces in
1851
+ * the output are not interpreted.
1569
1852
  */
1570
- declare function expandEnvironmentVars(command: string, context: ICliExecutionContext): string;
1853
+ declare function substituteCommands(command: string, run: (inner: string) => Promise<string>): Promise<string>;
1571
1854
 
1572
1855
  /**
1573
1856
  * A simple Map-based service container implementing ICliServiceProvider.
1574
1857
  *
1575
1858
  * Supports three provider types:
1576
1859
  * - `useValue` : registers a static value
1577
- * - `useFactory` : registers a factory function, invoked once on first `get`
1578
- * - `useClass` : registers a class constructor, instantiated once on first `get`
1860
+ * - `useFactory` : registers a factory function, invoked once on the first `get`
1861
+ * - `useClass` : registers a class constructor, instantiated once on the first `get`
1862
+ *
1863
+ * Factories and classes are created lazily, so their `deps` only have to be
1864
+ * registered by the time the service is first used. Add `transient: true` to
1865
+ * create a new instance on every `get`.
1579
1866
  *
1580
1867
  * When `multi: true`, multiple providers for the same token are accumulated
1581
- * and `get()` returns an array of resolved values.
1868
+ * and `getAll()` returns all of them.
1869
+ *
1870
+ * Registering a single token again overrides it; removing that registration
1871
+ * (`remove(token, provider)`, e.g. when a module is unloaded) makes the
1872
+ * previous one active again.
1582
1873
  */
1583
1874
  declare class CliServiceContainer implements ICliServiceProvider {
1584
- /** Stores single-value providers (resolved singletons). */
1875
+ /** Single-value registrations; the last one is active. */
1585
1876
  private readonly services;
1586
- /** Stores multi-provider arrays. */
1877
+ /** Multi-provider registrations, in registration order. */
1587
1878
  private readonly multiServices;
1588
1879
  /** Tokens that cannot be overwritten by subsequent `set()` calls. */
1589
1880
  private readonly sealedTokens;
1590
1881
  /** Stores provider recipes for transient tokens (re-resolved on every get). */
1591
1882
  private readonly transientRecipes;
1883
+ private disposed;
1884
+ /** Registrations being created, to report dependency cycles. */
1885
+ private readonly resolving;
1592
1886
  /**
1593
1887
  * Retrieve a service by its token.
1594
1888
  * Returns `undefined` when no provider is registered for the token.
@@ -1597,6 +1891,7 @@ declare class CliServiceContainer implements ICliServiceProvider {
1597
1891
  * @param token The token used to register the service.
1598
1892
  * @returns The resolved service instance, or `undefined` if not registered.
1599
1893
  */
1894
+ get<T>(token: CliToken<T>): T | undefined;
1600
1895
  get<T>(token: any): T | undefined;
1601
1896
  /**
1602
1897
  * Retrieve all registered services for a multi-provider token.
@@ -1605,6 +1900,7 @@ declare class CliServiceContainer implements ICliServiceProvider {
1605
1900
  * @param token The token used to register the service.
1606
1901
  * @returns Array of all resolved service instances.
1607
1902
  */
1903
+ getAll<T>(token: CliToken<T>): T[];
1608
1904
  getAll<T>(token: any): T[];
1609
1905
  /**
1610
1906
  * Retrieve a service by its token, throwing if not registered.
@@ -1615,6 +1911,7 @@ declare class CliServiceContainer implements ICliServiceProvider {
1615
1911
  * @returns The resolved service instance.
1616
1912
  * @throws Error if the token has not been registered.
1617
1913
  */
1914
+ getRequired<T>(token: CliToken<T>): T;
1618
1915
  getRequired<T>(token: any): T;
1619
1916
  /**
1620
1917
  * Check whether a service is registered for the given token.
@@ -1639,12 +1936,32 @@ declare class CliServiceContainer implements ICliServiceProvider {
1639
1936
  * @param definition A single CliProvider or an array of CliProviders.
1640
1937
  */
1641
1938
  set(definition: CliProvider | CliProvider[]): void;
1939
+ /**
1940
+ * Remove a registration. With `provider` (the provider object passed to
1941
+ * `set`, or the registered value), only that registration is removed: for
1942
+ * a single token the previous registration becomes active again, for a
1943
+ * multi token the others remain. Without it, every registration of the
1944
+ * token is removed.
1945
+ *
1946
+ * @throws Error if the token is sealed.
1947
+ * @returns Whether something was removed.
1948
+ */
1949
+ remove(token: any, provider?: unknown): boolean;
1950
+ /**
1951
+ * Dispose the services the container created (`useFactory` / `useClass`)
1952
+ * that have a `dispose()` method. Values registered with `useValue`
1953
+ * belong to whoever registered them and are not disposed. Registrations
1954
+ * are kept, so late callbacks still find their services. Called when the
1955
+ * engine is destroyed; later calls do nothing.
1956
+ */
1957
+ dispose(): void;
1642
1958
  /**
1643
1959
  * Returns all registered service tokens (single + multi providers).
1644
1960
  */
1645
1961
  getRegisteredTokens(): string[];
1646
1962
  /**
1647
1963
  * Returns detailed info for each registered service: token name, value type, and multi flag.
1964
+ * Services not created yet are listed as `lazy(Name)` (listing does not create them).
1648
1965
  */
1649
1966
  getRegisteredServiceDetails(): {
1650
1967
  token: string;
@@ -1655,19 +1972,22 @@ declare class CliServiceContainer implements ICliServiceProvider {
1655
1972
  * Convert a token to a human-readable string for diagnostics/errors.
1656
1973
  */
1657
1974
  private tokenToString;
1975
+ private describeRegistration;
1658
1976
  /**
1659
1977
  * Describe a resolved value for diagnostic display.
1660
1978
  */
1661
1979
  private describeValue;
1980
+ /** Whether `registration` is the one `provider` refers to. */
1981
+ private matches;
1662
1982
  /**
1663
1983
  * Register a single provider.
1664
1984
  */
1665
1985
  private registerProvider;
1986
+ /** The value of a registration, created on first use. */
1987
+ private resolve;
1666
1988
  /**
1667
- * Resolve a provider definition to a concrete value.
1668
- *
1669
- * Note: `deps` are resolved eagerly at registration time, so
1670
- * dependency tokens must be registered before the provider that needs them.
1989
+ * Resolve a provider definition to a concrete value, resolving its `deps`
1990
+ * from the container.
1671
1991
  */
1672
1992
  private resolveProvider;
1673
1993
  }
@@ -1712,6 +2032,8 @@ declare class CliTerminalWriter implements ICliTerminalWriter {
1712
2032
  padding?: number;
1713
2033
  }): void;
1714
2034
  writeIndented(text: string, level?: number): void;
2035
+ /** One block per row, header names as keys; used when a table cannot fit the terminal. */
2036
+ private writeRecords;
1715
2037
  writeTable(headers: string[], rows: string[][], options?: CliTableOptions): void;
1716
2038
  }
1717
2039
 
@@ -1784,11 +2106,22 @@ declare class CliTerminalTextAnimator implements ICliTextAnimator {
1784
2106
  isRunning: boolean;
1785
2107
  context?: ICliExecutionContext;
1786
2108
  private animationInterval?;
2109
+ /** Characters of the current animation still visible on the line. */
2110
+ private visibleChars;
2111
+ /** Ends the current `showText` promise early (set while it runs). */
2112
+ private finish?;
1787
2113
  private text;
1788
2114
  private textColor;
1789
2115
  constructor(terminal: Terminal);
1790
2116
  show(text?: string): void;
1791
2117
  showText(text: string, options?: CliTextAnimatorOptions): Promise<void>;
2118
+ /** Cursor position as `row:col`, or `null` when unavailable. */
2119
+ private cursorPosition;
2120
+ /**
2121
+ * Stop the animation, erase the text it wrote and resolve its `showText`
2122
+ * promise. Used when the user starts typing over the greeting.
2123
+ */
2124
+ cancel(): void;
1792
2125
  /**
1793
2126
  * Hide the animation and reset the state.
1794
2127
  */
@@ -1805,6 +2138,101 @@ interface ICliWelcomeModule extends ICliModule {
1805
2138
  configure(config: CliWelcomeMessageConfig): ICliModule;
1806
2139
  }
1807
2140
  declare const welcomeModule: ICliWelcomeModule;
2141
+ /**
2142
+ * Animated, time-based greeting on the first prompt. Runs after every other
2143
+ * module's `onAfterBoot` hook (setup and sign-in prompts come first), and
2144
+ * only when the welcome banner was shown.
2145
+ */
2146
+ declare const greetingModule: ICliModule;
2147
+
2148
+ interface CliBootLogOptions {
2149
+ /** Steps taking at least this long are highlighted as slow. */
2150
+ slowStepMs?: number;
2151
+ /** When boot started (ms since epoch); defaults to now. */
2152
+ startedAt?: number;
2153
+ }
2154
+ /**
2155
+ * Live boot report written to the terminal while the CLI starts: a list of
2156
+ * the steps (terminal, services, servers, modules) with a thin progress bar
2157
+ * and percentage pinned below it.
2158
+ *
2159
+ * Anything else written to the terminal meanwhile is captured and the bar
2160
+ * steps aside for it. When boot is complete the report is cleared so the
2161
+ * regular terminal takes over; warnings, errors and other output (plugin
2162
+ * warnings) are written again in order. First-run setup prompts, answered
2163
+ * while the report is suspended, are cleared with it.
2164
+ *
2165
+ * A disabled log records problems but writes nothing.
2166
+ */
2167
+ declare class CliBootLog {
2168
+ private readonly terminal;
2169
+ readonly enabled: boolean;
2170
+ private readonly startedAt;
2171
+ private readonly slowStepMs;
2172
+ private readonly problems;
2173
+ private finished;
2174
+ private totalSteps;
2175
+ private completedSteps;
2176
+ private current;
2177
+ private barVisible;
2178
+ private cursorHidden;
2179
+ private suspended;
2180
+ private startRow;
2181
+ /** Output written by others during boot, replayed after the report is cleared. */
2182
+ private readonly captured;
2183
+ private originalWrite?;
2184
+ private originalWriteln?;
2185
+ private redrawScheduled;
2186
+ /** The last setup output did not end its line (cursor after a prompt). */
2187
+ private promptOpen;
2188
+ constructor(terminal: Terminal | undefined, enabled: boolean, options?: CliBootLogOptions);
2189
+ /** Milliseconds since boot started. */
2190
+ get elapsedMs(): number;
2191
+ /** Whether `finish()` was called; later entries are ignored. */
2192
+ get isFinished(): boolean;
2193
+ /** Completed share of the planned steps, 0–100. */
2194
+ get percent(): number;
2195
+ /** Announce `count` more steps that will each be completed with `completeStep`. */
2196
+ addSteps(count: number): void;
2197
+ /** Name what is being set up now (shown next to the bar). */
2198
+ setCurrent(text: string): void;
2199
+ /** Mark one planned step as done (successfully or not). */
2200
+ completeStep(): void;
2201
+ /**
2202
+ * Step aside for interactive output (e.g. a module's first-run setup
2203
+ * prompt): remove the bar and show the cursor until `resume()`.
2204
+ */
2205
+ suspend(): void;
2206
+ /** Bring the bar back after `suspend()`. */
2207
+ resume(): void;
2208
+ info(text: string): void;
2209
+ /** A completed step, optionally with how long it took. */
2210
+ ok(text: string, durationMs?: number): void;
2211
+ warn(text: string): void;
2212
+ error(text: string): void;
2213
+ /**
2214
+ * Write the summary line, then hand the screen over to the terminal:
2215
+ * clear the report (unless `keep`), then write warnings, errors and the
2216
+ * output captured during boot again. The report is not cleared when the
2217
+ * terminal already held something before boot started.
2218
+ */
2219
+ finish(summary: string, keep?: boolean): Promise<void>;
2220
+ private write;
2221
+ /** Redraw the bar on the line below the list (the cursor stays on it). */
2222
+ private drawBar;
2223
+ /** First output: remember where the report starts and capture other writes. */
2224
+ private begin;
2225
+ private stopCapture;
2226
+ /** Someone else writes during boot: move the bar aside and keep a copy. */
2227
+ private onExternalWrite;
2228
+ /** Write without being captured. */
2229
+ private out;
2230
+ private hideBar;
2231
+ private format;
2232
+ private absoluteRow;
2233
+ /** Resolve once xterm has parsed everything written so far. */
2234
+ private flush;
2235
+ }
1808
2236
 
1809
2237
  declare class CliBoot {
1810
2238
  private readonly registry;
@@ -1814,13 +2242,53 @@ declare class CliBoot {
1814
2242
  private readonly moduleRegistry;
1815
2243
  private readonly bootedModules;
1816
2244
  private readonly initializedProcessors;
2245
+ /** Services and guards each module registered, removed when it is unloaded. */
2246
+ private readonly moduleProviders;
2247
+ /** Context modules were booted with (passed to `onDestroy` on unload). */
2248
+ private context?;
2249
+ /** Boot report of the startup boot. */
2250
+ private bootLogRef?;
2251
+ /** The boot report while startup is still in progress, else `undefined`. */
2252
+ private get bootLog();
1817
2253
  constructor(registry: ICliCommandProcessorRegistry, services: ICliServiceProvider);
1818
2254
  /**
1819
2255
  * Get the module registry for external access.
1820
2256
  */
1821
2257
  getModuleRegistry(): CliModuleRegistry;
1822
- boot(context: CliExecutionContext, modules: ICliModule[]): Promise<void>;
2258
+ boot(context: CliExecutionContext, modules: ICliModule[], bootLog?: CliBootLog): Promise<void>;
2259
+ private bootAll;
2260
+ /**
2261
+ * Boot one module: declarations (services, guards, permissions,
2262
+ * translations), lifecycle (`onInit`, first-run `onSetup`), then its
2263
+ * commands. Modules already booted or with missing dependencies are skipped.
2264
+ */
1823
2265
  private bootModule;
2266
+ private dependenciesLoaded;
2267
+ /** Services, guards, permissions and translations the module declares. */
2268
+ private registerDeclarations;
2269
+ /** `onInit` runs before the module's commands are registered. */
2270
+ private runOnInit;
2271
+ /** `onSetup` runs once per browser (first-run flow), until it succeeds. */
2272
+ private runFirstSetup;
2273
+ /** Register and initialize the module's commands; returns how many. */
2274
+ private registerCommands;
2275
+ /** One boot-log line per module that does something at boot. */
2276
+ private reportModule;
2277
+ /**
2278
+ * Unload a module (`pkg remove`, or before `pkg update` boots the new
2279
+ * version): its commands, guards and permissions are removed at once,
2280
+ * then `onDestroy` runs, then its services are removed (so `onDestroy`
2281
+ * can still use them). Services are removed by registration, so a newer
2282
+ * version registered meanwhile keeps its own.
2283
+ */
2284
+ private unloadModule;
2285
+ private removeProviders;
2286
+ /** Publish on the event bus; never lets the bus break booting. */
2287
+ private emitEvent;
2288
+ /** Boot warning: into the boot log when it is shown, else the terminal. */
2289
+ private warn;
2290
+ /** Boot error: into the boot log when it is shown, else the terminal. */
2291
+ private fail;
1824
2292
  /**
1825
2293
  * Sub-processors of an `extendsProcessor` processor are merged into the
1826
2294
  * processor it extends, so they belong to that one: re-parent them so they
@@ -1987,7 +2455,7 @@ declare class CliInputReader implements ICliInputReader {
1987
2455
  readFile(prompt: string, options?: CliFilePickerOptions): Promise<CliFileResult[] | null>;
1988
2456
  }
1989
2457
 
1990
- declare const CliProcessRegistry_TOKEN = "cli-process-registry";
2458
+ declare const CliProcessRegistry_TOKEN: any;
1991
2459
  declare class CliProcessRegistry implements ICliProcessRegistry {
1992
2460
  private nextPid;
1993
2461
  private processes;
@@ -2006,7 +2474,7 @@ declare class CliProcessRegistry implements ICliProcessRegistry {
2006
2474
  }
2007
2475
 
2008
2476
  /**
2009
- * Global environment variable store for the CLI session.
2477
+ * Environment variables for the CLI.
2010
2478
  *
2011
2479
  * Variables set here are available to all commands via `$VAR` / `${VAR}`
2012
2480
  * substitution in the executor. Commands can also read/write the store
@@ -2015,29 +2483,106 @@ declare class CliProcessRegistry implements ICliProcessRegistry {
2015
2483
  interface ICliEnvironment {
2016
2484
  /** Get a variable value (undefined if not set). */
2017
2485
  get(name: string): string | undefined;
2018
- /** Set a variable. */
2019
- set(name: string, value: string): void;
2020
- /** Remove a variable. */
2021
- unset(name: string): void;
2486
+ /**
2487
+ * Set a variable: for the signed-in user (`'user'`, the default, saved),
2488
+ * for everyone (`'global'`, saved) or for this terminal only (`'session'`).
2489
+ */
2490
+ set(name: string, value: string, scope?: CliEnvironmentScope): void;
2491
+ /**
2492
+ * Remove a variable. Without a scope it is removed for this terminal and
2493
+ * the user (and hidden when it still comes from a shared or built-in
2494
+ * value); `'global'` removes the shared value.
2495
+ */
2496
+ unset(name: string, scope?: CliEnvironmentScope): void;
2022
2497
  /** Get all variables as a record. */
2023
2498
  getAll(): Record<string, string>;
2024
2499
  /** Check if a variable is set. */
2025
2500
  has(name: string): boolean;
2026
- }
2027
- declare const ICliEnvironment_TOKEN = "cli-environment";
2501
+ /** Where the current value of `name` comes from. */
2502
+ scopeOf?(name: string): CliEnvironmentSource | undefined;
2503
+ }
2504
+ declare const ICliEnvironment_TOKEN: any;
2505
+ /** Where a variable is set: this terminal, the signed-in user, or everyone. */
2506
+ type CliEnvironmentScope = 'session' | 'user' | 'global';
2507
+ /** Where a value comes from: a scope, or computed / built in (`HOME`, `SHELL`, …). */
2508
+ type CliEnvironmentSource = CliEnvironmentScope | 'builtin';
2509
+ /** What one user (or the signed-out session, key '') changed: values set and defaults removed. */
2510
+ interface CliEnvironmentProfile {
2511
+ vars: Record<string, string>;
2512
+ unset: string[];
2513
+ }
2514
+ /** Saved environment: one profile per user name ('' when nobody is signed in). */
2515
+ type CliEnvironmentSnapshot = Record<string, CliEnvironmentProfile>;
2516
+ /**
2517
+ * One saved change, applied by the host to the latest saved state (so two
2518
+ * tabs changing different variables never overwrite each other).
2519
+ */
2520
+ type CliEnvironmentChange = {
2521
+ scope: 'user';
2522
+ profile: string;
2523
+ name: string;
2524
+ value: string;
2525
+ } | {
2526
+ scope: 'user';
2527
+ profile: string;
2528
+ name: string;
2529
+ unset: true;
2530
+ hide: boolean;
2531
+ } | {
2532
+ scope: 'global';
2533
+ name: string;
2534
+ value: string;
2535
+ } | {
2536
+ scope: 'global';
2537
+ name: string;
2538
+ unset: true;
2539
+ };
2028
2540
  /**
2029
2541
  * Default in-memory implementation.
2030
- * Seeded with some standard variables on construction.
2542
+ *
2543
+ * A variable resolves, in order, from this terminal's variables
2544
+ * (`NAME=value`), the current user's own (`export`), the shared ones
2545
+ * (`export --global`), then bound live values (USER, HOME, PWD follow the
2546
+ * session and directory), then the standard variables seeded on
2547
+ * construction. Each user has a separate set, so `su`/`login` switch
2548
+ * environments, and `onChange` lets the host save each change.
2031
2549
  */
2032
2550
  declare class CliEnvironment implements ICliEnvironment {
2033
- private readonly vars;
2551
+ private readonly defaults;
2552
+ /** Variables computed on read; a user's own value wins over them. */
2553
+ private readonly bound;
2554
+ private readonly profiles;
2555
+ private readonly global;
2556
+ private readonly session;
2557
+ private profileKey;
2558
+ /** Called after every saved change (user or global), to persist it. */
2559
+ onChange?: (change: CliEnvironmentChange) => void;
2034
2560
  constructor();
2561
+ /** Compute a variable on every read; the seeded value is the fallback while it returns nothing. */
2562
+ bind(name: string, resolver: () => string | null | undefined): void;
2563
+ /** Pick whose changes apply (the signed-in user's name, '' when signed out). */
2564
+ setProfileResolver(resolver: () => string | null | undefined): void;
2565
+ /** Restore saved profiles and shared variables (replaces the saved ones in memory). */
2566
+ load(snapshot: CliEnvironmentSnapshot | undefined, global?: Record<string, string>): void;
2567
+ snapshot(): CliEnvironmentSnapshot;
2568
+ /** The shared variables. */
2569
+ globals(): Record<string, string>;
2035
2570
  get(name: string): string | undefined;
2036
- set(name: string, value: string): void;
2037
- unset(name: string): void;
2571
+ scopeOf(name: string): CliEnvironmentSource | undefined;
2572
+ set(name: string, value: string, scope?: CliEnvironmentScope): void;
2573
+ unset(name: string, scope?: CliEnvironmentScope): void;
2038
2574
  getAll(): Record<string, string>;
2039
2575
  has(name: string): boolean;
2040
- }
2576
+ private profileOf;
2577
+ }
2578
+ /** Apply one change to saved state (the host does this under the cross-tab lock). */
2579
+ declare function applyEnvironmentChange(state: {
2580
+ profiles?: CliEnvironmentSnapshot;
2581
+ global?: Record<string, string>;
2582
+ }, change: CliEnvironmentChange): {
2583
+ profiles: CliEnvironmentSnapshot;
2584
+ global: Record<string, string>;
2585
+ };
2041
2586
 
2042
2587
  declare class CliDragDropService implements ICliDragDropService {
2043
2588
  private readonly _container;
@@ -2082,7 +2627,7 @@ declare class CliHttpClient implements ICliHttpClient {
2082
2627
  declare class CliNotifier implements ICliNotifier {
2083
2628
  private _current;
2084
2629
  private readonly _change$;
2085
- readonly change$: rxjs.Observable<CliNotification | undefined>;
2630
+ readonly change$: rxjs.Observable<any>;
2086
2631
  get current(): CliNotification | undefined;
2087
2632
  info(message: string): void;
2088
2633
  success(message: string): void;
@@ -2096,6 +2641,7 @@ declare class CliNotifier implements ICliNotifier {
2096
2641
  declare class CliPermissionRegistry implements ICliPermissionRegistry {
2097
2642
  private readonly definitions;
2098
2643
  register(definitions: CliPermissionDefinition[], module?: string): void;
2644
+ unregister(module: string): void;
2099
2645
  list(): CliPermissionDefinition[];
2100
2646
  get(name: string): CliPermissionDefinition | undefined;
2101
2647
  }
@@ -2156,22 +2702,113 @@ declare class CliKeyValueStore implements ICliKeyValueStore {
2156
2702
  declare class CliStateStore implements ICliStateStore {
2157
2703
  private readonly services;
2158
2704
  readonly name: string;
2159
- private readonly initialState;
2160
2705
  private state$;
2161
- private storageKey;
2162
- constructor(services: ICliServiceProvider, name: string, initialState: CliState);
2706
+ /** Signed-in user, for `scope: 'user'` stores. */
2707
+ private user?;
2708
+ private initialState;
2709
+ private options;
2710
+ /** The first load from storage (see `initialize`). */
2711
+ private loading?;
2712
+ private loaded;
2713
+ /** Keys changed before the saved state was loaded: they win over it. */
2714
+ private readonly changedBeforeLoad;
2715
+ /** Keys changed since the last save (only these are written). */
2716
+ private readonly unsaved;
2717
+ /** When each key was last changed here (`updateState`), to tell local edits from synced ones. */
2718
+ private readonly editedAt;
2719
+ private edits;
2720
+ /** `reset()` since the last save: the whole state is written. */
2721
+ private replaceOnSave;
2722
+ /**
2723
+ * Each key as last loaded, saved or received (JSON), to also find keys
2724
+ * changed in place without `updateState`.
2725
+ */
2726
+ private baseline;
2727
+ private persistScheduled;
2728
+ /**
2729
+ * Called after the state was saved (set by the store manager to share it
2730
+ * with other tabs).
2731
+ */
2732
+ onPersisted?: (storageKey: string, state: CliState) => void;
2733
+ constructor(services: ICliServiceProvider, name: string, initialState: CliState, options?: CliStateStoreOptions);
2734
+ /** Key the state is saved under. */
2735
+ get key(): string;
2736
+ /**
2737
+ * Saved per store, or per signed-in user for `scope: 'user'` (signed
2738
+ * out, the state is shared like a global store).
2739
+ */
2740
+ private get storageKey();
2741
+ /**
2742
+ * The signed-in user changed: a `scope: 'user'` store switches to that
2743
+ * user's saved state (unsaved changes of the previous user are dropped,
2744
+ * so save before switching users).
2745
+ */
2746
+ setUser(user: string | undefined): void;
2747
+ /** Whether changes saved by other tabs are applied to this store. */
2748
+ get syncAcrossTabs(): boolean;
2749
+ /** A session store lives in this terminal only and is never saved. */
2750
+ private get isSession();
2163
2751
  getState<T extends CliState = CliState>(): T;
2164
2752
  updateState(newState: Partial<CliState>): void;
2165
2753
  select<K>(selector: (state: CliState) => K): Observable<K>;
2166
2754
  subscribe(callback: (state: CliState) => void): Subscription;
2167
2755
  reset(): void;
2756
+ /**
2757
+ * Save the state. The saved state is loaded first, so saving before the
2758
+ * store was loaded never replaces data with the initial state.
2759
+ */
2168
2760
  persist(): Promise<void>;
2761
+ /**
2762
+ * Change the state from its latest saved value and save it, atomically:
2763
+ * under the cross-tab lock, `change` gets the state as saved (plus this
2764
+ * terminal's unsaved changes) and its result is merged and written. Two
2765
+ * terminals updating the same key never lose each other's change, e.g.
2766
+ * both adding an item to a list. Without storage (or for a session
2767
+ * store) it is a plain `updateState`.
2768
+ */
2769
+ update(change: (state: CliState) => Partial<CliState>): Promise<void>;
2169
2770
  initialize(): Promise<void>;
2771
+ reload(): Promise<void>;
2772
+ /**
2773
+ * Add defaults for keys the store does not have yet (when it was first
2774
+ * created without them, e.g. read before its command registered).
2775
+ */
2776
+ applyDefaults(defaults: CliState): void;
2777
+ /** Merge store options (later options win). */
2778
+ setOptions(options: CliStateStoreOptions): void;
2779
+ /**
2780
+ * State saved by another tab or terminal: apply it without saving again,
2781
+ * keeping the keys changed here and not saved yet.
2782
+ */
2783
+ applySaved(state: CliState): void;
2784
+ /**
2785
+ * Another tab or terminal saved this store: apply what is saved now.
2786
+ * Messages can arrive out of order (one sent before this terminal's own
2787
+ * save can arrive after it), so storage, not the message, is the truth.
2788
+ * Reads are chained so the last one applied is the latest.
2789
+ */
2790
+ refreshFromStorage(fallback?: CliState): Promise<void>;
2791
+ private refreshing;
2170
2792
  /**
2171
2793
  * Complete the BehaviorSubject so all subscribers are notified
2172
2794
  * and no further emissions occur. Called during engine teardown.
2173
2795
  */
2174
2796
  dispose(): void;
2797
+ private load;
2798
+ /**
2799
+ * Save the keys changed here, merged into the saved state (the whole
2800
+ * state after `reset()` or a migration). Runs under a lock shared by all
2801
+ * tabs, so two terminals saving at once do not lose each other's keys.
2802
+ * Keys others saved meanwhile are applied here.
2803
+ */
2804
+ private write;
2805
+ /** Keys changed here since the last load, save or received state. */
2806
+ private changedKeys;
2807
+ private setBaseline;
2808
+ private pick;
2809
+ private get versionKey();
2810
+ /** With `autoPersist`, save once after the changes of this tick. */
2811
+ private schedulePersist;
2175
2812
  }
2176
2813
 
2177
2814
  interface CliEngineOptions extends CliOptions {
@@ -2203,6 +2840,10 @@ declare class CliEngine {
2203
2840
  private bootService?;
2204
2841
  private dragDropService?;
2205
2842
  private _startedAt?;
2843
+ private terminalOptions;
2844
+ private _isBooted;
2845
+ private resolveBooted;
2846
+ private readonly bootedPromise;
2206
2847
  constructor(container: HTMLElement, options?: CliEngineOptions | undefined);
2207
2848
  /**
2208
2849
  * Register a CLI module to be loaded on start().
@@ -2229,9 +2870,47 @@ declare class CliEngine {
2229
2870
  */
2230
2871
  registerService(token: string, value: any): void;
2231
2872
  /**
2232
- * Initialize the terminal, wire up services, boot modules, and show welcome message.
2873
+ * Start the CLI: set up the terminal and services, boot the modules
2874
+ * (reporting progress in the terminal), then hand over to the prompt.
2875
+ *
2876
+ * Phases, in order:
2877
+ * 1. terminal xterm.js in the container
2878
+ * 2. services service container, executor, execution context
2879
+ * 3. boot report hold typed keys, show the boot log
2880
+ * 4. runtime environment, background services, servers
2881
+ * 5. modules core + welcome + server + user modules
2882
+ * 6. completion tab-completion providers
2883
+ * 7. ready clear the report, replay typed keys, `isBooted`
2884
+ * 8. after boot `onAfterBoot` hooks (welcome message), snapshot
2233
2885
  */
2234
2886
  start(): Promise<void>;
2887
+ /** 1. Wait for the container to have a size, then create xterm.js. */
2888
+ private setupTerminal;
2889
+ /** 2. Service container, boot service, executor and execution context. */
2890
+ private setupServices;
2891
+ /**
2892
+ * 3. Keep what the user types until the terminal is ready (replayed at
2893
+ * the first prompt) and start the boot report (configurable).
2894
+ */
2895
+ private beginBootReport;
2896
+ /** 4. Environment variables, background services, server auth and manager. */
2897
+ private registerRuntimeServices;
2898
+ /** 4. Connect to the configured servers, one boot step each. */
2899
+ private connectServers;
2900
+ /**
2901
+ * 5. Built-in welcome and server modules, the app's modules, and the
2902
+ * greeting, which runs after every other `onAfterBoot` hook.
2903
+ */
2904
+ private modulesToBoot;
2905
+ /** 7. Replace the boot report with the terminal and mark the CLI booted. */
2906
+ private completeBoot;
2907
+ /**
2908
+ * Boot threw: never leave the terminal unusable. Keep the report with the
2909
+ * error on screen, show the cursor and hand over typed keys.
2910
+ */
2911
+ private failBoot;
2912
+ /** 8. `onAfterBoot` hooks by priority (lower first); one failing hook does not stop the rest. */
2913
+ private runAfterBootHooks;
2235
2914
  /**
2236
2915
  * Clean up terminal and event listeners.
2237
2916
  */
@@ -2252,6 +2931,16 @@ declare class CliEngine {
2252
2931
  * Get the command processor registry.
2253
2932
  */
2254
2933
  getRegistry(): CliCommandProcessorRegistry;
2934
+ /**
2935
+ * `true` once boot has completed: modules are set up and the terminal
2936
+ * accepts input. `onAfterBoot` hooks (welcome message) run right after.
2937
+ */
2938
+ get isBooted(): boolean;
2939
+ /**
2940
+ * Resolves when boot has completed (see `isBooted`). Never rejects; if
2941
+ * `start()` fails it stays pending.
2942
+ */
2943
+ get booted(): Promise<void>;
2255
2944
  /**
2256
2945
  * Timestamp (ms since epoch) when the engine finished starting.
2257
2946
  */
@@ -2295,6 +2984,11 @@ interface TerminalSetupResult {
2295
2984
  dragDropService: CliDragDropService;
2296
2985
  wheelListener: (e: WheelEvent) => void;
2297
2986
  }
2987
+ /**
2988
+ * Default terminal font size: 20px, or 14px on phone-sized viewports so a
2989
+ * line still fits a useful number of columns (about 26 at 20px on a 390px screen).
2990
+ */
2991
+ declare function defaultFontSize(): number;
2298
2992
  /**
2299
2993
  * Merge user-supplied terminal options with sensible defaults.
2300
2994
  */
@@ -2311,6 +3005,33 @@ declare function initializeTerminal(container: HTMLElement, opts: ITerminalOptio
2311
3005
  */
2312
3006
  declare function waitForLayout(container: HTMLElement): Promise<void>;
2313
3007
 
3008
+ /**
3009
+ * In-memory publish/subscribe bus of one terminal. Handlers run
3010
+ * synchronously in subscription order; a throwing handler is reported to
3011
+ * `onHandlerError` and does not stop delivery. Keeps the last
3012
+ * {@link CLI_EVENT_HISTORY_SIZE} events; nothing is persisted.
3013
+ */
3014
+ declare class CliEventBus implements ICliEventBus {
3015
+ private readonly onHandlerError;
3016
+ private readonly historySize;
3017
+ private readonly subject;
3018
+ private readonly recent;
3019
+ private disposed;
3020
+ constructor(onHandlerError?: (error: unknown, event: CliEvent) => void, historySize?: number);
3021
+ emit<K extends CliEventType>(type: K, data: CliEventMap[K], options?: CliEmitOptions): void;
3022
+ emit<T = unknown, K extends string = string>(type: K & CustomEventType<K>, data?: T, options?: CliEmitOptions): void;
3023
+ on<K extends CliEventType>(pattern: K, handler: CliEventHandler<CliEventMap[K]>): () => void;
3024
+ on<T = unknown>(pattern: string, handler: CliEventHandler<T>): () => void;
3025
+ once<K extends CliEventType>(pattern: K, handler: CliEventHandler<CliEventMap[K]>): () => void;
3026
+ once<T = unknown>(pattern: string, handler: CliEventHandler<T>): () => void;
3027
+ events$<K extends CliEventType>(pattern: K): Observable<CliEvent<CliEventMap[K]>>;
3028
+ events$<T = unknown>(pattern?: string): Observable<CliEvent<T>>;
3029
+ history<K extends CliEventType>(pattern: K, limit?: number): CliEvent<CliEventMap[K]>[];
3030
+ history<T = unknown>(pattern?: string, limit?: number): CliEvent<T>[];
3031
+ /** Stop delivering events and complete all observables. */
3032
+ dispose(): void;
3033
+ }
3034
+
2314
3035
  /**
2315
3036
  * Default implementation of the translation service.
2316
3037
  *
@@ -2335,6 +3056,7 @@ interface InitializeServicesOptions {
2335
3056
  }
2336
3057
  interface InitializeServicesResult {
2337
3058
  services: CliServiceContainer;
3059
+ events: CliEventBus;
2338
3060
  logger: CliLogger;
2339
3061
  commandHistory: CliCommandHistory;
2340
3062
  stateStoreManager: CliStateStoreManager;
@@ -2349,6 +3071,36 @@ interface InitializeServicesResult {
2349
3071
  */
2350
3072
  declare function initializeServices(options: InitializeServicesOptions): Promise<InitializeServicesResult>;
2351
3073
 
3074
+ /** Service token holding the name of the framework hosting the CLI. */
3075
+ declare const CLI_FRAMEWORK_SERVICE = "cli-framework";
3076
+ /** What a framework wrapper passes to an engine: shared by components, providers and config contexts. */
3077
+ interface CliHostConfig {
3078
+ modules?: ICliModule[];
3079
+ /** @deprecated Use modules instead. */
3080
+ processors?: ICliCommandProcessor[];
3081
+ options?: CliEngineOptions;
3082
+ /** Extra services registered by token before start. */
3083
+ services?: Record<string, any>;
3084
+ }
3085
+ interface CreateCliEngineConfig extends CliHostConfig {
3086
+ /** Reported by `version`, `debug` and `feedback`, e.g. 'React'. */
3087
+ framework?: string;
3088
+ /** Terminal state to restore on start. */
3089
+ snapshot?: CliEngineSnapshot;
3090
+ }
3091
+ /**
3092
+ * Create an engine for `container` with the services, modules and
3093
+ * processors of a wrapper registered (in that order). Call `start()` on it.
3094
+ */
3095
+ declare function createCliEngine(container: HTMLElement, config?: CreateCliEngineConfig): CliEngine;
3096
+ /**
3097
+ * Resolve a component's config: each field set locally wins over the one
3098
+ * inherited from a surrounding config provider.
3099
+ */
3100
+ declare function resolveCliHostConfig(local: CliHostConfig, inherited?: CliHostConfig | null): CliHostConfig;
3101
+ /** Merge option objects key by key: `local` overrides `inherited`. */
3102
+ declare function mergeCliOptions<T extends object>(local: T | undefined, inherited: object | undefined): T | undefined;
3103
+
2352
3104
  declare class CliServerConnection {
2353
3105
  private readonly _config;
2354
3106
  private readonly _backgroundServices?;
@@ -2372,7 +3124,7 @@ declare class CliServerConnection {
2372
3124
  private static readonly HEALTH_CHECK_MAX_ATTEMPTS;
2373
3125
  onDisconnect?: () => void;
2374
3126
  onReconnected?: () => void;
2375
- constructor(_config: CliServerConfig, _backgroundServices?: ICliBackgroundServiceRegistry | undefined, _logger?: ICliLogger | undefined, _authService?: ICliServerAuthService | undefined);
3127
+ constructor(_config: CliServerConfig, _backgroundServices?: ICliBackgroundServiceRegistry, _logger?: ICliLogger, _authService?: ICliServerAuthService);
2376
3128
  get config(): CliServerConfig;
2377
3129
  get connected(): boolean;
2378
3130
  get commands(): CliServerCommandDescriptor[];
@@ -2401,6 +3153,8 @@ declare class CliServerConnection {
2401
3153
  exitCode: number;
2402
3154
  }>;
2403
3155
  ping(): Promise<boolean>;
3156
+ /** Whether the server answers HTTP at all (any status: it is running). */
3157
+ private answers;
2404
3158
  private connectEventSocket;
2405
3159
  private connectEventSocketDirect;
2406
3160
  private connectEventSocketDirectAsync;
@@ -2442,7 +3196,7 @@ declare class CliServerProxyProcessor implements ICliCommandProcessor {
2442
3196
  description?: string;
2443
3197
  version?: string;
2444
3198
  metadata?: CliProcessorMetadata;
2445
- parameters?: ICliCommandParameterDescriptor[];
3199
+ parameters?: ICliCommandParameterDescriptor$1[];
2446
3200
  processors?: ICliCommandProcessor[];
2447
3201
  acceptsRawInput?: boolean;
2448
3202
  /** Full command path from root to this processor (e.g. ["aws", "lambda", "list"]) */
@@ -2471,7 +3225,7 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
2471
3225
  command: string;
2472
3226
  description?: string;
2473
3227
  metadata?: CliProcessorMetadata;
2474
- parameters?: ICliCommandParameterDescriptor[];
3228
+ parameters?: ICliCommandParameterDescriptor$1[];
2475
3229
  processors?: ICliCommandProcessor[];
2476
3230
  acceptsRawInput?: boolean;
2477
3231
  /** Full command path from root to this processor */
@@ -2480,10 +3234,11 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
2480
3234
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2481
3235
  }
2482
3236
 
2483
- declare const CliServerManager_TOKEN = "cli-server-manager";
3237
+ declare const CliServerManager_TOKEN: any;
2484
3238
  declare class CliServerManager implements DefaultServerProvider {
2485
3239
  private readonly registry;
2486
3240
  private readonly authService?;
3241
+ private readonly events?;
2487
3242
  readonly connections: Map<string, CliServerConnection>;
2488
3243
  private _logger?;
2489
3244
  private _cliLogger?;
@@ -2491,7 +3246,7 @@ declare class CliServerManager implements DefaultServerProvider {
2491
3246
  /** Bare-name aliases this manager registered (only these are ever removed) */
2492
3247
  private readonly _bareAliases;
2493
3248
  private _backgroundServices?;
2494
- constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService | undefined);
3249
+ constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService, events?: ICliEventBus);
2495
3250
  get defaultServer(): string | null;
2496
3251
  preferredServer(): string | null;
2497
3252
  setDefaultServer(name: string | null): void;
@@ -2504,6 +3259,7 @@ declare class CliServerManager implements DefaultServerProvider {
2504
3259
  commandCount: number;
2505
3260
  }>;
2506
3261
  getConnection(name: string): CliServerConnection | undefined;
3262
+ private emitConnected;
2507
3263
  private handleDisconnect;
2508
3264
  private unregisterServerProcessors;
2509
3265
  private unregisterBareAliases;
@@ -2513,25 +3269,37 @@ declare class CliServerManager implements DefaultServerProvider {
2513
3269
 
2514
3270
  declare function createServerModule(): ICliModule;
2515
3271
 
3272
+ /**
3273
+ * `server`: the servers this terminal is connected to (configured by the
3274
+ * app in `options.servers`). Their commands are available directly (`echo`)
3275
+ * and namespaced (`node:echo`).
3276
+ */
2516
3277
  declare class CliServerCommandProcessor implements ICliCommandProcessor {
2517
3278
  command: string;
3279
+ aliases: string[];
2518
3280
  description: string;
2519
3281
  metadata: {
2520
- icon: CliIcon;
3282
+ icon: any;
2521
3283
  module: string;
2522
3284
  sealed: boolean;
2523
3285
  };
3286
+ stateConfiguration: CliStateConfiguration;
2524
3287
  processors: ICliCommandChildProcessor[];
3288
+ /** Restore the default server saved by `server default <name>`. */
3289
+ initialize(context: ICliExecutionContext): Promise<void>;
3290
+ /** `server` alone: the servers, then what can be done with them. */
2525
3291
  processCommand(_command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
3292
+ writeDescription(context: ICliExecutionContext): void;
2526
3293
  }
2527
3294
 
2528
3295
  declare class CliSshCommandProcessor implements ICliCommandProcessor {
2529
3296
  command: string;
3297
+ aliases: string[];
2530
3298
  description: string;
2531
3299
  acceptsRawInput: boolean;
2532
3300
  valueRequired: boolean;
2533
3301
  metadata: CliProcessorMetadata;
2534
- parameters?: ICliCommandParameterDescriptor[];
3302
+ parameters?: ICliCommandParameterDescriptor$1[];
2535
3303
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
2536
3304
  /**
2537
3305
  * Full-screen handler for one session: input, resize and disposal go to
@@ -2539,6 +3307,11 @@ declare class CliSshCommandProcessor implements ICliCommandProcessor {
2539
3307
  */
2540
3308
  private fullScreenHandler;
2541
3309
  private resolveServer;
3310
+ /** Why `name` cannot be used: unknown, unreachable or without a shell. */
3311
+ private writeWhyNotAvailable;
3312
+ /** No server has a shell: say whether none is configured, connected or shell-enabled. */
3313
+ private writeNoShellServers;
3314
+ writeDescription(context: ICliExecutionContext): void;
2542
3315
  private executeInteractive;
2543
3316
  private executeOneShot;
2544
3317
  /** `ssh <server> <cmd...>` → `<cmd...>` exactly as typed */
@@ -2595,7 +3368,10 @@ declare class CliTestHarness {
2595
3368
  readonly registry: CliCommandProcessorRegistry;
2596
3369
  readonly executor: CliCommandExecutor;
2597
3370
  readonly services: CliServiceContainer;
3371
+ /** Shared by every command: add a language pack and switch locale to test translations. */
3372
+ readonly translator: CliTranslationService;
2598
3373
  private readonly stateStoreManager;
3374
+ private readonly initialized;
2599
3375
  private readonly processRegistry;
2600
3376
  /** Current user session — set via setUserSession() */
2601
3377
  userSession?: ICliUserSession;
@@ -2614,7 +3390,8 @@ declare class CliTestHarness {
2614
3390
  registerService(token: any, value: any): void;
2615
3391
  /**
2616
3392
  * Register a command processor. If the processor has an `initialize()`
2617
- * method, it will be called with a context wired to the harness services.
3393
+ * method, it is called (with the processor's own state store, as in the
3394
+ * engine) before the first `execute()`, or by `initializeProcessors()`.
2618
3395
  */
2619
3396
  registerProcessor(processor: ICliCommandProcessor): void;
2620
3397
  /**
@@ -2626,6 +3403,8 @@ declare class CliTestHarness {
2626
3403
  * Call this after registering all services and processors.
2627
3404
  */
2628
3405
  initializeProcessors(): Promise<void>;
3406
+ /** As the engine's boot: link sub-commands to their parent, then initialize. */
3407
+ private initializeTree;
2629
3408
  /**
2630
3409
  * Set the active user session. Commands that check `context.userSession`
2631
3410
  * will see this session.
@@ -2700,4 +3479,511 @@ declare function getAccelerator(): ICliWasmAccelerator;
2700
3479
  */
2701
3480
  declare function isWasmAccelerated(): boolean;
2702
3481
 
2703
- export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, describeShellClose, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
3482
+ /** One terminal inside a tab. */
3483
+ interface CliPanelPane {
3484
+ id: number;
3485
+ widthPercent: number;
3486
+ /** Snapshot to restore when the pane's engine starts (used by "Duplicate"). */
3487
+ snapshot?: CliEngineSnapshot;
3488
+ }
3489
+ /** One tab of the panel: a title and one or more panes side by side. */
3490
+ interface CliPanelTab {
3491
+ id: number;
3492
+ title: string;
3493
+ isEditing: boolean;
3494
+ panes: CliPanelPane[];
3495
+ }
3496
+ interface CliPanelContextMenu {
3497
+ visible: boolean;
3498
+ x: number;
3499
+ y: number;
3500
+ tabId: number;
3501
+ }
3502
+ interface CliPanelServiceDetail {
3503
+ name: string;
3504
+ status: string;
3505
+ description?: string;
3506
+ }
3507
+ interface CliPanelServerDetail {
3508
+ name: string;
3509
+ url: string;
3510
+ connected: boolean;
3511
+ apiVersion?: string;
3512
+ commandCount?: number;
3513
+ }
3514
+ type CliPanelExecutionState = 'idle' | 'running';
3515
+ type CliPanelServerState = 'connected' | 'disconnected' | 'none';
3516
+ /** Status derived from the engines of a single tab. */
3517
+ interface CliPanelTabStatus {
3518
+ executionState: CliPanelExecutionState;
3519
+ lastCommand: {
3520
+ name: string;
3521
+ success: boolean;
3522
+ } | null;
3523
+ notification: CliNotification | null;
3524
+ }
3525
+ /** Status derived from the first engine of the active tab. */
3526
+ interface CliPanelGlobalStatus {
3527
+ serviceCount: {
3528
+ running: number;
3529
+ total: number;
3530
+ };
3531
+ serviceDetails: CliPanelServiceDetail[];
3532
+ serverState: CliPanelServerState;
3533
+ serverDetails: CliPanelServerDetail[];
3534
+ /** Milliseconds since the engine started, 0 when unknown. */
3535
+ uptime: number;
3536
+ }
3537
+ declare const DEFAULT_TAB_STATUS: CliPanelTabStatus;
3538
+ declare const DEFAULT_GLOBAL_STATUS: CliPanelGlobalStatus;
3539
+ /**
3540
+ * Values a host may control from the outside. A defined value wins over the
3541
+ * panel's own state; `undefined` leaves the panel uncontrolled for that field.
3542
+ */
3543
+ interface CliPanelControlledState {
3544
+ collapsed?: boolean;
3545
+ hidden?: boolean;
3546
+ maximized?: boolean;
3547
+ activeTabId?: number;
3548
+ position?: CliPanelPosition;
3549
+ height?: number;
3550
+ width?: number;
3551
+ }
3552
+ /** Change notifications and structural events, mapped by each framework wrapper. */
3553
+ interface CliPanelCallbacks {
3554
+ onCollapsedChange?: (collapsed: boolean) => void;
3555
+ onHiddenChange?: (hidden: boolean) => void;
3556
+ onMaximizedChange?: (maximized: boolean) => void;
3557
+ onActiveTabIdChange?: (tabId: number) => void;
3558
+ onPositionChange?: (position: CliPanelPosition) => void;
3559
+ onHeightChange?: (height: number) => void;
3560
+ onWidthChange?: (width: number) => void;
3561
+ onClose?: () => void;
3562
+ onTabAdded?: (event: {
3563
+ tabId: number;
3564
+ }) => void;
3565
+ onTabClosed?: (event: {
3566
+ tabId: number;
3567
+ }) => void;
3568
+ onPaneSplit?: (event: {
3569
+ paneId: number;
3570
+ tabId: number;
3571
+ }) => void;
3572
+ onPaneClosed?: (event: {
3573
+ paneId: number;
3574
+ }) => void;
3575
+ }
3576
+ interface CliPanelViewport {
3577
+ width: number;
3578
+ height: number;
3579
+ }
3580
+ interface CliPanelControllerOptions {
3581
+ /** Panel configuration (initial state, chrome buttons, theme sync). */
3582
+ config?: CliPanelConfig;
3583
+ callbacks?: CliPanelCallbacks;
3584
+ controlled?: CliPanelControlledState;
3585
+ /** Viewport size used for maximize and resize clamping. Defaults to `window`. */
3586
+ viewport?: () => CliPanelViewport;
3587
+ /**
3588
+ * Restore and persist the position through localStorage.
3589
+ * @default true
3590
+ */
3591
+ persistPosition?: boolean;
3592
+ }
3593
+ /**
3594
+ * Immutable view of the whole panel. A new object is produced on every
3595
+ * change, so views can compare by reference.
3596
+ */
3597
+ interface CliPanelSnapshot {
3598
+ visible: boolean;
3599
+ /** True once the first tab has been created (content rendered). */
3600
+ initialized: boolean;
3601
+ collapsed: boolean;
3602
+ hidden: boolean;
3603
+ maximized: boolean;
3604
+ position: CliPanelPosition;
3605
+ height: number;
3606
+ width: number;
3607
+ isHorizontal: boolean;
3608
+ /** Status text is shown in the header for top/bottom, compact dots otherwise. */
3609
+ showStatusIndicators: boolean;
3610
+ panelResizing: boolean;
3611
+ themeStyles: Record<string, string>;
3612
+ closable: boolean;
3613
+ resizable: boolean;
3614
+ hideable: boolean;
3615
+ hideAlignment: CliPanelHideAlignment;
3616
+ syncTheme: boolean;
3617
+ tabs: readonly CliPanelTab[];
3618
+ activeTabId: number;
3619
+ activePaneId: number;
3620
+ paneResizing: boolean;
3621
+ contextMenu: CliPanelContextMenu;
3622
+ positionDropdownOpen: boolean;
3623
+ servicesDropdownOpen: boolean;
3624
+ servicesDropdownStyle: Record<string, string>;
3625
+ serversDropdownOpen: boolean;
3626
+ serversDropdownStyle: Record<string, string>;
3627
+ /** Status of the active tab. */
3628
+ status: CliPanelTabStatus;
3629
+ tabStatuses: Readonly<Record<number, CliPanelTabStatus>>;
3630
+ global: CliPanelGlobalStatus;
3631
+ formattedUptime: string;
3632
+ }
3633
+
3634
+ declare const MIN_PANE_WIDTH_PERCENT = 10;
3635
+ declare const MIN_PANEL_SIZE = 100;
3636
+ declare const DEFAULT_PANEL_HEIGHT = 600;
3637
+ declare const DEFAULT_PANEL_WIDTH = 400;
3638
+ declare const PANEL_POSITIONS: readonly CliPanelPosition[];
3639
+ /** Scale pane widths so they add up to 100. Returns new pane objects. */
3640
+ declare function normalizePaneWidths(panes: readonly CliPanelPane[]): CliPanelPane[];
3641
+ /** Give every pane the same width. Returns new pane objects. */
3642
+ declare function distributePaneWidths(panes: readonly CliPanelPane[]): CliPanelPane[];
3643
+ /**
3644
+ * Move the divider between pane `dividerIndex` and `dividerIndex + 1` by
3645
+ * `deltaPercent`, keeping both panes at least `MIN_PANE_WIDTH_PERCENT` wide.
3646
+ */
3647
+ declare function resizePaneWidths(startWidths: readonly number[], dividerIndex: number, deltaPercent: number): number[];
3648
+ /** Clamp a dragged panel size between the minimum and the viewport. */
3649
+ declare function clampPanelSize(size: number, max: number): number;
3650
+ /**
3651
+ * New panel size for a drag that started at `start` and moved by
3652
+ * (`deltaX`, `deltaY`). Only the axis matching the position matters.
3653
+ */
3654
+ declare function resizedPanelSize(position: CliPanelPosition, start: {
3655
+ width: number;
3656
+ height: number;
3657
+ }, deltaX: number, deltaY: number, viewport: CliPanelViewport): {
3658
+ width?: number;
3659
+ height?: number;
3660
+ };
3661
+ interface AnchorRect {
3662
+ top: number;
3663
+ bottom: number;
3664
+ left: number;
3665
+ right: number;
3666
+ }
3667
+ /**
3668
+ * Fixed-position style for a dropdown opened from `anchor`, placed on the
3669
+ * side of the panel that faces the page.
3670
+ */
3671
+ declare function dropdownAnchorStyle(anchor: AnchorRect, position: CliPanelPosition, viewport: CliPanelViewport): Record<string, string>;
3672
+ /** "12m", "1h05m"-style uptime label. */
3673
+ declare function formatUptime(ms: number): string;
3674
+ declare function isHorizontalPosition(position: CliPanelPosition): boolean;
3675
+
3676
+ /** Poll interval for execution state, last command and notifications. */
3677
+ declare const EXEC_POLL_MS = 300;
3678
+ /** Poll interval for services, servers and uptime. */
3679
+ declare const GLOBAL_POLL_MS = 2000;
3680
+ /** Status of a tab from all of its pane engines. */
3681
+ declare function computeTabStatus(engines: Iterable<CliEngine>): CliPanelTabStatus;
3682
+ /** Services, servers and uptime of one engine. */
3683
+ declare function computeGlobalStatus(engine: CliEngine | undefined, now?: number): CliPanelGlobalStatus;
3684
+ interface CliPanelStatusTrackerListener {
3685
+ onTabStatus(tabId: number, status: CliPanelTabStatus): void;
3686
+ onGlobalStatus(status: CliPanelGlobalStatus): void;
3687
+ }
3688
+ /**
3689
+ * Watches the engines of every tab and reports status changes. Execution
3690
+ * state is polled quickly, services and servers slowly; engine events
3691
+ * (notifier, background services) trigger an immediate refresh.
3692
+ */
3693
+ declare class CliPanelStatusTracker {
3694
+ private readonly listener;
3695
+ private tabs;
3696
+ private activeTabId?;
3697
+ private globalStatus;
3698
+ private execTimer?;
3699
+ private globalTimer?;
3700
+ constructor(listener: CliPanelStatusTrackerListener);
3701
+ registerEngine(tabId: number, paneId: number, engine: CliEngine): void;
3702
+ unregisterPane(paneId: number): void;
3703
+ unregisterTab(tabId: number): void;
3704
+ setActiveTab(tabId: number): void;
3705
+ /** Recompute everything now. */
3706
+ refresh(): void;
3707
+ destroy(): void;
3708
+ private ensurePolling;
3709
+ private stopPolling;
3710
+ private refreshTab;
3711
+ private refreshGlobal;
3712
+ }
3713
+
3714
+ /**
3715
+ * Framework-agnostic state and behaviour of the collapsible CLI panel:
3716
+ * tabs and panes, chrome (collapse, hide, maximize, position, size),
3717
+ * menus, drag resizing, theme sync and the status bar.
3718
+ *
3719
+ * Views subscribe with {@link subscribe} and render {@link getSnapshot};
3720
+ * every change produces a new immutable snapshot. Hosts may control any of
3721
+ * the bindable values through {@link setControlled}; the matching
3722
+ * `onXChange` callback is invoked whenever the panel wants to change it.
3723
+ */
3724
+ declare class CliPanelController implements ICliPanelRef<CliEngine> {
3725
+ callbacks: CliPanelCallbacks;
3726
+ private snapshot;
3727
+ private internal;
3728
+ private controlled;
3729
+ private readonly listeners;
3730
+ private readonly engines;
3731
+ private readonly tracker;
3732
+ private readonly viewport;
3733
+ private readonly persistPosition;
3734
+ private nextTabId;
3735
+ private nextPaneId;
3736
+ private preHideCollapsed;
3737
+ private previousHeight;
3738
+ private previousWidth;
3739
+ private panelDrag?;
3740
+ private paneDrag?;
3741
+ private documentListenersAttached;
3742
+ private rootElement;
3743
+ private themeObserver?;
3744
+ constructor(options?: CliPanelControllerOptions);
3745
+ readonly subscribe: (listener: () => void) => (() => void);
3746
+ readonly getSnapshot: () => CliPanelSnapshot;
3747
+ /** Apply a new panel configuration (chrome buttons, theme sync). */
3748
+ setOptions(config: CliPanelConfig | undefined): void;
3749
+ /** Replace the change callbacks (wrappers call this when their props change). */
3750
+ setCallbacks(callbacks: CliPanelCallbacks): void;
3751
+ /** Update host-controlled values. Unchanged values are ignored. */
3752
+ setControlled(values: CliPanelControlledState): void;
3753
+ /** Element containing the terminals, used for theme sync. */
3754
+ setRootElement(element: ParentNode | null): void;
3755
+ /**
3756
+ * Stop timers, observers and document listeners. Engines are not
3757
+ * destroyed (their views own them). Registering an engine again
3758
+ * restarts status tracking, so a remounted view can reuse the controller.
3759
+ */
3760
+ destroy(): void;
3761
+ /** Header collapse button: expand (creating the first tab) or collapse. */
3762
+ toggle(): void;
3763
+ open(): void;
3764
+ collapse(): void;
3765
+ toggleCollapse(): void;
3766
+ hide(): void;
3767
+ unhide(): void;
3768
+ toggleHide(): void;
3769
+ close(): void;
3770
+ maximize(): void;
3771
+ restore(): void;
3772
+ toggleMaximize(): void;
3773
+ resize(dimensions: {
3774
+ height?: number;
3775
+ width?: number;
3776
+ }): void;
3777
+ setPosition(position: CliPanelPosition): void;
3778
+ addTab(title?: string): number;
3779
+ closeTab(tabId: number): void;
3780
+ selectTab(tabId: number): void;
3781
+ renameTab(tabId: number, title: string): void;
3782
+ /** Switch a tab's title into inline editing. */
3783
+ startRename(tabId: number): void;
3784
+ /** Finish inline editing; an empty value keeps the old title. */
3785
+ commitRename(tabId: number, value: string): void;
3786
+ cancelRename(): void;
3787
+ /** Open a new tab next to `tabId` with a copy of its first terminal's content. */
3788
+ duplicateTab(tabId: number): number;
3789
+ closeOtherTabs(tabId: number): void;
3790
+ closeTabsToTheRight(tabId: number): void;
3791
+ closeAllTabs(): void;
3792
+ splitPane(tabId?: number): number;
3793
+ closePane(paneId: number): void;
3794
+ /** A pane was clicked: make it (and its tab) active and focus its terminal. */
3795
+ activatePane(tabId: number, paneId: number): void;
3796
+ /** Called by the view once a pane's terminal engine is running. */
3797
+ registerEngine(tabId: number, paneId: number, engine: CliEngine): void;
3798
+ getEngine(paneId?: number): CliEngine | undefined;
3799
+ getState(): CliPanelState;
3800
+ openContextMenu(tabId: number, x: number, y: number): void;
3801
+ closeContextMenu(): void;
3802
+ togglePositionDropdown(): void;
3803
+ /** `anchor` is the clicked status item; the dropdown is placed next to it. */
3804
+ toggleServicesDropdown(anchor?: Element | null): void;
3805
+ toggleServersDropdown(anchor?: Element | null): void;
3806
+ /** Close the context menu and every dropdown. */
3807
+ closeMenus(): void;
3808
+ /** Mouse down on the panel's resize bar. */
3809
+ startPanelResize(clientX: number, clientY: number): void;
3810
+ /** Mouse down on the divider before pane `dividerIndex + 1` of a tab. */
3811
+ startPaneResize(tabId: number, dividerIndex: number, clientX: number, containerWidth: number): void;
3812
+ private readonly onPanelResizeMove;
3813
+ private readonly onPanelResizeEnd;
3814
+ private endPanelResize;
3815
+ private readonly onPaneResizeMove;
3816
+ private readonly onPaneResizeEnd;
3817
+ private endPaneResize;
3818
+ private readonly onDocumentClick;
3819
+ private readonly onDocumentKeydown;
3820
+ private syncDocumentListeners;
3821
+ private detachDocumentListeners;
3822
+ /** Read the first terminal's theme and derive the panel colours from it. */
3823
+ syncThemeFromEngine(): void;
3824
+ /**
3825
+ * Sync now and follow the first terminal's container: the `theme`
3826
+ * command restyles it, which re-derives the panel colours.
3827
+ * Engines are registered after they start, so their theme is set.
3828
+ */
3829
+ private startThemeSync;
3830
+ private stopThemeSync;
3831
+ private ensureInitialized;
3832
+ private updateCollapsed;
3833
+ private updateHidden;
3834
+ private updateMaximized;
3835
+ private updateHeight;
3836
+ private updateWidth;
3837
+ private updateActiveTabId;
3838
+ private findTab;
3839
+ private patchTab;
3840
+ /** Remove tabs without touching collapsed/initialized state. */
3841
+ private removeTabs;
3842
+ private releaseTab;
3843
+ private releasePane;
3844
+ private focusPane;
3845
+ private anchorStyle;
3846
+ private setTabStatus;
3847
+ private configFields;
3848
+ /** Resolve controlled values and derived fields on top of a snapshot. */
3849
+ private derive;
3850
+ private commit;
3851
+ }
3852
+
3853
+ /**
3854
+ * Geometry of the panel's SVG icons, shared by every framework wrapper.
3855
+ * All icons use a 24x24 view box, `stroke="currentColor"`, round caps and
3856
+ * joins, and no fill unless a shape says otherwise.
3857
+ */
3858
+ interface SvgShape {
3859
+ tag: 'polyline' | 'line' | 'rect';
3860
+ attrs: Record<string, string>;
3861
+ }
3862
+ interface SvgIcon {
3863
+ size: number;
3864
+ strokeWidth: number;
3865
+ shapes: SvgShape[];
3866
+ }
3867
+ declare const SVG_VIEW_BOX = "0 0 24 24";
3868
+ declare const SVG_COMMON_ATTRS: Record<string, string>;
3869
+ declare const TERMINAL_ICON: SvgIcon;
3870
+ declare const HIDE_TAB_TERMINAL_ICON: SvgIcon;
3871
+ declare const MAXIMIZE_ICON: SvgIcon;
3872
+ declare const RESTORE_ICON: SvgIcon;
3873
+ declare const CLOSE_ICON: SvgIcon;
3874
+ declare const HIDE_ICON: SvgIcon;
3875
+ /** Chevron that points where the panel body will go when the collapse button is pressed. */
3876
+ declare function collapseChevronIcon(position: CliPanelPosition, collapsed: boolean): SvgIcon;
3877
+ /** Chevron on the small "show CLI" tab, pointing into the page. */
3878
+ declare function hideTabChevronIcon(position: CliPanelPosition): SvgIcon;
3879
+ /** Square with a filled bar on the side the panel is docked to. */
3880
+ declare function positionIcon(position: CliPanelPosition, size?: number): SvgIcon;
3881
+ /** Attributes for the `<svg>` element of an icon. */
3882
+ declare function svgAttrs(icon: SvgIcon): Record<string, string>;
3883
+
3884
+ /**
3885
+ * View helpers shared by the React, Vue and Angular panels: class names,
3886
+ * inline styles, labels and the lists the header and menus are built from.
3887
+ */
3888
+ declare const PANEL_LABELS: {
3889
+ readonly title: "CLI";
3890
+ readonly showCli: "Show CLI";
3891
+ readonly movePanel: "Move panel";
3892
+ readonly hide: "Hide";
3893
+ readonly maximize: "Maximize";
3894
+ readonly restore: "Restore";
3895
+ readonly expand: "Expand";
3896
+ readonly collapse: "Collapse";
3897
+ readonly close: "Close";
3898
+ readonly newTerminal: "New terminal";
3899
+ readonly closeTab: "Close tab";
3900
+ readonly closePane: "Close pane";
3901
+ readonly servicesHeader: "Background Services";
3902
+ readonly servicesEmpty: "No services registered";
3903
+ readonly serversHeader: "Server Connections";
3904
+ readonly serversEmpty: "No servers configured";
3905
+ };
3906
+ declare const SERVICES_ICON = "\u2699";
3907
+ declare const UPTIME_ICON = "\u2191";
3908
+ declare const SUCCESS_ICON = "\u2713";
3909
+ declare const ERROR_ICON = "\u2717";
3910
+ declare const CLOSE_GLYPH = "\u00D7";
3911
+ declare function capitalize(value: string): string;
3912
+ declare function joinClasses(...classes: Array<string | false | null | undefined>): string;
3913
+ declare function panelWrapperClass(s: CliPanelSnapshot, extra?: string): string;
3914
+ declare function panelTabClass(s: CliPanelSnapshot, tab: CliPanelTab): string;
3915
+ /** Activity dot of a tab: running, last command failed, or idle. */
3916
+ declare function tabDotClass(status: CliPanelTabStatus | undefined): string;
3917
+ declare function panelTabDotClass(s: CliPanelSnapshot, tab: CliPanelTab): string;
3918
+ declare function panesContainerClass(s: CliPanelSnapshot): string;
3919
+ declare function paneClass(s: CliPanelSnapshot, tabId: number, paneId: number): string;
3920
+ declare function glowLineClass(s: CliPanelSnapshot): string;
3921
+ declare function positionDropdownItemClass(s: CliPanelSnapshot, position: CliPanelPosition): string;
3922
+ /** Size, visibility and theme variables of the panel wrapper. */
3923
+ declare function panelWrapperStyle(s: CliPanelSnapshot): Record<string, string>;
3924
+ declare function paneStyle(widthPercent: number): Record<string, string>;
3925
+ declare function contextMenuStyle(s: CliPanelSnapshot): Record<string, string>;
3926
+ interface PanelStatusIndicator {
3927
+ key: 'execution' | 'services' | 'lastCommand' | 'servers' | 'uptime' | 'notification';
3928
+ /** Extra classes on the full item (top/bottom positions). */
3929
+ itemClass: string;
3930
+ /** Extra classes on the compact item (left/right positions). */
3931
+ compactClass: string;
3932
+ /** Class of the leading dot, when the indicator shows a dot. */
3933
+ dotClass?: string;
3934
+ /** Glyph shown before the label, when the indicator shows an icon. */
3935
+ icon?: string;
3936
+ iconClass?: string;
3937
+ label: string;
3938
+ /** Tooltip of the compact variant. */
3939
+ title: string;
3940
+ /** Compact variant shows only this dot (notifications). */
3941
+ compactDotClass?: string;
3942
+ /** Which dropdown a click opens. */
3943
+ dropdown?: 'services' | 'servers';
3944
+ }
3945
+ /** Items of the header status bar, in display order. */
3946
+ declare function statusIndicators(s: CliPanelSnapshot): PanelStatusIndicator[];
3947
+ interface PanelPositionOption {
3948
+ position: CliPanelPosition;
3949
+ label: string;
3950
+ className: string;
3951
+ }
3952
+ declare function positionOptions(s: CliPanelSnapshot): PanelPositionOption[];
3953
+ type PanelContextMenuAction = 'rename' | 'duplicate' | 'split-right' | 'close' | 'close-others' | 'close-right' | 'close-all';
3954
+ interface PanelContextMenuItem {
3955
+ action: PanelContextMenuAction;
3956
+ label: string;
3957
+ disabled: boolean;
3958
+ destructive: boolean;
3959
+ /** Draw a separator above this item. */
3960
+ separatorBefore: boolean;
3961
+ }
3962
+ declare function contextMenuItems(s: CliPanelSnapshot): PanelContextMenuItem[];
3963
+ /** Run a context-menu action against the tab the menu was opened for. */
3964
+ declare function runContextMenuAction(controller: CliPanelController, action: PanelContextMenuAction): void;
3965
+ /** Enter commits, Escape cancels an inline tab rename. */
3966
+ declare function handleRenameKey(controller: CliPanelController, tabId: number, key: string, value: string): void;
3967
+ /** Width of the panes container the divider belongs to, for drag math. */
3968
+ declare function panesContainerWidth(target: EventTarget | null): number;
3969
+ interface PanelDropdownRow {
3970
+ key: string;
3971
+ dotClass: string;
3972
+ name: string;
3973
+ description?: string;
3974
+ status: string;
3975
+ /** Extra lines under the status (servers: API version, command count). */
3976
+ meta: string[];
3977
+ }
3978
+ interface PanelStatusDropdown {
3979
+ kind: 'services' | 'servers';
3980
+ header: string;
3981
+ emptyText: string;
3982
+ style: Record<string, string>;
3983
+ rows: PanelDropdownRow[];
3984
+ }
3985
+ /** The open services or servers dropdown, or null when neither is open. */
3986
+ declare function openStatusDropdown(s: CliPanelSnapshot): PanelStatusDropdown | null;
3987
+
3988
+ export { API_VERSION, CLI_ENV_GLOBAL_PERMISSION, CLI_FRAMEWORK_SERVICE, CLOSE_GLYPH, CLOSE_ICON, CLi_Name_Art, CapturingTerminalWriter, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliBootLog, CliBootLog_TOKEN, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliEventsCommandProcessor, CliExecutionContext, CliExecutionProcess, CliExportCommandProcessor, CliFalseCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPanelController, CliPanelStatusTracker, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliScriptSyntaxError, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestCommandProcessor, CliTestHarness, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliTrueCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, CliYesCommandProcessor, CommandParser, DEFAULT_GLOBAL_STATUS, DEFAULT_PANEL_HEIGHT, DEFAULT_PANEL_WIDTH, DEFAULT_TAB_STATUS, ERROR_ICON, EXEC_POLL_MS, GLOBAL_POLL_MS, HIDE_ICON, HIDE_TAB_TERMINAL_ICON, ICliEnvironment_TOKEN, ICliPingServerService_TOKEN, ICliScriptRunner_TOKEN, JsFallbackAccelerator, LIBRARY_VERSION, MAXIMIZE_ICON, MIN_PANEL_SIZE, MIN_PANE_WIDTH_PERCENT, OverlayAddon, PANEL_LABELS, PANEL_POSITIONS, ProcessExitedError, RESTORE_ICON, SERVICES_ICON, SUCCESS_ICON, SVG_COMMON_ATTRS, SVG_VIEW_BOX, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, TERMINAL_ICON, UPTIME_ICON, appendOutputToFile, appendStderrToFile, applyEnvironmentChange, builtinProcessors, capitalize, clampPanelSize, cliScriptRunner, collapseChevronIcon, computeDiff, computeGlobalStatus, computeTabStatus, contextGlobalParameter, contextMenuItems, contextMenuStyle, createCliEngine, createServerModule, defaultFontSize, describeShellClose, distributePaneWidths, dropdownAnchorStyle, executeOnServer, expandBraces, expandEnvironmentVars, expandGlobs, formatDiff, formatUptime, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, glowLineClass, greetingModule, groupBy, handleRenameKey, helpGlobalParameter, hideTabChevronIcon, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isHorizontalPosition, isWasmAccelerated, joinClasses, matchGlob, mergeCliOptions, miscProcessors, normalizePaneWidths, openLink, openStatusDropdown, paneClass, paneStyle, panelTabClass, panelTabDotClass, panelWrapperClass, panelWrapperStyle, panesContainerClass, panesContainerWidth, parseAssignments, parseScript, positionDropdownItemClass, positionIcon, positionOptions, reconcileArgs, renderServerResponse, renderSingleOutput, resizePaneWidths, resizedPanelSize, resolveCliHostConfig, runContextMenuAction, runScript, splitWords, statusIndicators, substituteCommands, substituteVars, svgAttrs, systemProcessors, tabDotClass, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
3989
+ export type { AnchorRect, CdnSourceName, CliBootLogOptions, CliEngineOptions, CliEnvironmentChange, CliEnvironmentProfile, CliEnvironmentScope, CliEnvironmentSnapshot, CliEnvironmentSource, CliExecutionContextDeps, CliHostConfig, CliPanelCallbacks, CliPanelContextMenu, CliPanelControlledState, CliPanelControllerOptions, CliPanelExecutionState, CliPanelGlobalStatus, CliPanelPane, CliPanelServerDetail, CliPanelServerState, CliPanelServiceDetail, CliPanelSnapshot, CliPanelStatusTrackerListener, CliPanelTab, CliPanelTabStatus, CliPanelViewport, CliTestResult, CliWelcomeMessageConfig, CommandParserOutput, CommandPart, ConfigureState, CreateCliEngineConfig, DefaultServerProvider, DiffLine, DiffType, ICliEnvironment, ICliExecutionHost, ICliScriptRunOptions, ICliScriptRunner, ICliStateStoreManager, ICliWasmAccelerator, InitializeServicesOptions, InitializeServicesResult, MultiProxyEntry, PanelContextMenuAction, PanelContextMenuItem, PanelDropdownRow, PanelPositionOption, PanelStatusDropdown, PanelStatusIndicator, ParsedArg, ParsedToken, SvgIcon, SvgShape, TerminalSetupResult, ThemeState };