@qodalis/cli 2.0.0-beta.17 → 2.0.0-beta.19
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/package.json +2 -2
- package/public-api.d.mts +1392 -154
- package/public-api.d.ts +1392 -154
- package/public-api.js +8228 -2769
- package/public-api.js.map +1 -1
- package/public-api.mjs +8150 -2773
- package/public-api.mjs.map +1 -1
package/public-api.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
166
|
+
declare const SyntaxHighlighterRegistry_TOKEN: any;
|
|
155
167
|
|
|
156
|
-
declare const LIBRARY_VERSION = "2.0.0-beta.
|
|
168
|
+
declare const LIBRARY_VERSION = "2.0.0-beta.19";
|
|
157
169
|
declare const API_VERSION = 2;
|
|
158
170
|
|
|
159
171
|
declare class CliAliasCommandProcessor implements ICliCommandProcessor {
|
|
160
172
|
command: string;
|
|
161
|
-
author:
|
|
173
|
+
author: any;
|
|
162
174
|
description: string;
|
|
163
|
-
|
|
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
|
-
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
562
|
-
readonly version = "1.0
|
|
563
|
-
readonly processors
|
|
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
|
|
567
|
-
private
|
|
568
|
-
private
|
|
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
|
|
626
|
+
writeDescription(context: ICliExecutionContext): void;
|
|
574
627
|
initialize(context: ICliExecutionContext): Promise<void>;
|
|
575
|
-
private
|
|
576
|
-
private
|
|
577
|
-
private
|
|
578
|
-
private
|
|
579
|
-
private
|
|
580
|
-
private
|
|
581
|
-
private
|
|
582
|
-
private
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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 {
|
|
@@ -781,6 +823,11 @@ declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
|
|
|
781
823
|
private editOption;
|
|
782
824
|
private setConfigValue;
|
|
783
825
|
private getConfigValue;
|
|
826
|
+
/**
|
|
827
|
+
* The language choices are the locales loaded so far: a language pack
|
|
828
|
+
* installed after boot (`pkg add @qodalis/cli-lang-de`) adds one.
|
|
829
|
+
*/
|
|
830
|
+
private refreshLanguageOptions;
|
|
784
831
|
private getAllOptions;
|
|
785
832
|
/**
|
|
786
833
|
* @param onBoot at startup, terminal options still at their default are skipped so the
|
|
@@ -820,6 +867,8 @@ declare class CliPingCommandProcessor implements ICliCommandProcessor {
|
|
|
820
867
|
private sleep;
|
|
821
868
|
}
|
|
822
869
|
|
|
870
|
+
/** Permission to change shared variables, when an auth module is loaded. */
|
|
871
|
+
declare const CLI_ENV_GLOBAL_PERMISSION = "system:env:global";
|
|
823
872
|
/** Parse `A=1 B="two words" C` into assignments; bare names have no value. */
|
|
824
873
|
declare function parseAssignments(raw: string): {
|
|
825
874
|
name: string;
|
|
@@ -832,19 +881,24 @@ declare function parseAssignments(raw: string): {
|
|
|
832
881
|
* export VAR=value
|
|
833
882
|
* export VAR="value with spaces" OTHER=1
|
|
834
883
|
*
|
|
835
|
-
*
|
|
884
|
+
* Variables are saved for the signed-in user (`--global`: for everyone) and
|
|
885
|
+
* restored on the next visit. `NAME=value` alone is for this terminal only.
|
|
836
886
|
*/
|
|
837
887
|
declare class CliExportCommandProcessor implements ICliCommandProcessor {
|
|
838
888
|
command: string;
|
|
839
889
|
description: string;
|
|
840
|
-
author:
|
|
890
|
+
author: any;
|
|
841
891
|
acceptsRawInput: boolean;
|
|
842
892
|
metadata: {
|
|
843
893
|
icon: string;
|
|
844
894
|
module: string;
|
|
845
895
|
};
|
|
896
|
+
parameters: ICliCommandParameterDescriptor[];
|
|
846
897
|
stateConfiguration: CliStateConfiguration;
|
|
847
|
-
/**
|
|
898
|
+
/**
|
|
899
|
+
* Restore saved variables, save every later change (export, unset) and
|
|
900
|
+
* follow changes saved in other tabs and terminals.
|
|
901
|
+
*/
|
|
848
902
|
initialize(context: ICliExecutionContext): Promise<void>;
|
|
849
903
|
processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
850
904
|
writeDescription(context: ICliExecutionContext): void;
|
|
@@ -855,12 +909,13 @@ declare class CliExportCommandProcessor implements ICliCommandProcessor {
|
|
|
855
909
|
declare class CliUnsetCommandProcessor implements ICliCommandProcessor {
|
|
856
910
|
command: string;
|
|
857
911
|
description: string;
|
|
858
|
-
author:
|
|
912
|
+
author: any;
|
|
859
913
|
acceptsRawInput: boolean;
|
|
860
914
|
metadata: {
|
|
861
915
|
icon: string;
|
|
862
916
|
module: string;
|
|
863
917
|
};
|
|
918
|
+
parameters: any[];
|
|
864
919
|
processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
865
920
|
writeDescription(context: ICliExecutionContext): void;
|
|
866
921
|
}
|
|
@@ -871,7 +926,7 @@ declare class CliEnvCommandProcessor implements ICliCommandProcessor {
|
|
|
871
926
|
command: string;
|
|
872
927
|
aliases: string[];
|
|
873
928
|
description: string;
|
|
874
|
-
author:
|
|
929
|
+
author: any;
|
|
875
930
|
acceptsRawInput: boolean;
|
|
876
931
|
metadata: {
|
|
877
932
|
icon: string;
|
|
@@ -893,13 +948,14 @@ declare class CliFontSizeCommandProcessor implements ICliCommandProcessor {
|
|
|
893
948
|
private hostFontSize?;
|
|
894
949
|
initialize(context: ICliExecutionContext): Promise<void>;
|
|
895
950
|
processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
951
|
+
writeDescription(context: ICliExecutionContext): void;
|
|
896
952
|
private getCurrent;
|
|
897
953
|
private getDefault;
|
|
898
954
|
private resetFontSize;
|
|
899
955
|
private setFontSize;
|
|
900
956
|
}
|
|
901
957
|
|
|
902
|
-
declare const miscProcessors: (
|
|
958
|
+
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)[];
|
|
903
959
|
declare const builtinProcessors: ICliCommandProcessor[];
|
|
904
960
|
|
|
905
961
|
declare class CliExecutionProcess implements ICliExecutionProcess {
|
|
@@ -964,6 +1020,8 @@ declare class CliCommandExecutionContext implements ICliExecutionContext {
|
|
|
964
1020
|
createInterval: (callback: () => void, ms: number) => ICliManagedInterval;
|
|
965
1021
|
createTimeout: (callback: () => void, ms: number) => ICliManagedTimer;
|
|
966
1022
|
submitCommand: (command: string) => Promise<void>;
|
|
1023
|
+
events?: ICliEventBus;
|
|
1024
|
+
get isBooted(): boolean | undefined;
|
|
967
1025
|
constructor(context: ICliExecutionContext, processor: ICliCommandProcessor);
|
|
968
1026
|
}
|
|
969
1027
|
|
|
@@ -1002,7 +1060,7 @@ declare class CliCommandHistory {
|
|
|
1002
1060
|
|
|
1003
1061
|
interface ICliStateStoreManager {
|
|
1004
1062
|
getProcessorStateStore(processor: ICliCommandProcessor): ICliStateStore;
|
|
1005
|
-
getStateStore(name: string, defaultState?: Record<string, any
|
|
1063
|
+
getStateStore(name: string, defaultState?: Record<string, any>, options?: CliStateStoreOptions): ICliStateStore;
|
|
1006
1064
|
getStoreEntries(): {
|
|
1007
1065
|
name: string;
|
|
1008
1066
|
state: Record<string, any>;
|
|
@@ -1012,9 +1070,25 @@ declare class CliStateStoreManager implements ICliStateStoreManager {
|
|
|
1012
1070
|
private readonly services;
|
|
1013
1071
|
private readonly registry;
|
|
1014
1072
|
private stores;
|
|
1073
|
+
private channel?;
|
|
1074
|
+
/** The signed-in user (for `scope: 'user'` stores). */
|
|
1075
|
+
private user?;
|
|
1076
|
+
private stopFollowingUser?;
|
|
1015
1077
|
constructor(services: ICliServiceProvider, registry: ICliCommandProcessorRegistry);
|
|
1016
|
-
|
|
1078
|
+
/**
|
|
1079
|
+
* Get (or create) the store `name`. Defaults and options passed for a
|
|
1080
|
+
* store that already exists are added to it: a store read early (e.g.
|
|
1081
|
+
* by the boot report) still gets its command's initial state.
|
|
1082
|
+
*/
|
|
1083
|
+
getStateStore(name: string, defaultState?: Record<string, any>, options?: CliStateStoreOptions): ICliStateStore;
|
|
1017
1084
|
getProcessorStateStore(processor: ICliCommandProcessor): ICliStateStore;
|
|
1085
|
+
/**
|
|
1086
|
+
* Follow the signed-in user (`session:changed` events), so `scope: 'user'`
|
|
1087
|
+
* stores switch to that user's state.
|
|
1088
|
+
*/
|
|
1089
|
+
followUser(events: ICliEventBus): void;
|
|
1090
|
+
/** Switch `scope: 'user'` stores to `user`'s saved state. */
|
|
1091
|
+
setUser(user: string | undefined): void;
|
|
1018
1092
|
/**
|
|
1019
1093
|
* Returns all store names and their current state values.
|
|
1020
1094
|
*/
|
|
@@ -1027,6 +1101,9 @@ declare class CliStateStoreManager implements ICliStateStoreManager {
|
|
|
1027
1101
|
* Called during engine teardown.
|
|
1028
1102
|
*/
|
|
1029
1103
|
dispose(): void;
|
|
1104
|
+
/** Tell other tabs and terminals that a store was saved. */
|
|
1105
|
+
private publish;
|
|
1106
|
+
private listen;
|
|
1030
1107
|
}
|
|
1031
1108
|
|
|
1032
1109
|
/**
|
|
@@ -1062,6 +1139,10 @@ declare class CliCompletionEngine {
|
|
|
1062
1139
|
candidates?: string[];
|
|
1063
1140
|
}>;
|
|
1064
1141
|
private buildContext;
|
|
1142
|
+
/**
|
|
1143
|
+
* Words with their start, quote-aware: `cat "my notes.txt"` has two, and an
|
|
1144
|
+
* unclosed quote runs to the end (`cat "my no` is being typed).
|
|
1145
|
+
*/
|
|
1065
1146
|
private tokenize;
|
|
1066
1147
|
private fetchCompletions;
|
|
1067
1148
|
/**
|
|
@@ -1215,7 +1296,12 @@ interface CliExecutionContextDeps {
|
|
|
1215
1296
|
declare class CliExecutionContext implements ICliExecutionContext, InputModeHost, CommandLineModeHost {
|
|
1216
1297
|
terminal: Terminal;
|
|
1217
1298
|
executor: ICliCommandExecutorService;
|
|
1218
|
-
|
|
1299
|
+
private _userSession?;
|
|
1300
|
+
/** The signed-in user; changing it emits `session:changed`. */
|
|
1301
|
+
get userSession(): ICliUserSession | undefined;
|
|
1302
|
+
set userSession(session: ICliUserSession | undefined);
|
|
1303
|
+
/** The terminal's event bus. */
|
|
1304
|
+
readonly events?: ICliEventBus;
|
|
1219
1305
|
contextProcessor?: ICliCommandProcessor;
|
|
1220
1306
|
readonly writer: ICliTerminalWriter;
|
|
1221
1307
|
readonly spinner: ICliSpinner;
|
|
@@ -1254,6 +1340,10 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
|
|
|
1254
1340
|
readonly commandHistory: CliCommandHistory;
|
|
1255
1341
|
readonly filePickerProvider: ICliFilePickerProvider;
|
|
1256
1342
|
private readonly modeStack;
|
|
1343
|
+
/** Command-line input typed while booting; `null` when not holding. */
|
|
1344
|
+
private heldInput;
|
|
1345
|
+
private releaseHeldInputAtPrompt;
|
|
1346
|
+
private _typedDuringBoot;
|
|
1257
1347
|
private readonly stateStoreManager;
|
|
1258
1348
|
private readonly timerManager;
|
|
1259
1349
|
private readonly fullScreenManager;
|
|
@@ -1266,6 +1356,25 @@ declare class CliExecutionContext implements ICliExecutionContext, InputModeHost
|
|
|
1266
1356
|
get cursorPosition(): number;
|
|
1267
1357
|
set cursorPosition(value: number);
|
|
1268
1358
|
initializeTerminalListeners(): void;
|
|
1359
|
+
private handleTerminalData;
|
|
1360
|
+
private _isBooted;
|
|
1361
|
+
/** `true` once boot has completed and the terminal is ready. */
|
|
1362
|
+
get isBooted(): boolean;
|
|
1363
|
+
/** Called by the engine when boot has completed. */
|
|
1364
|
+
markBooted(): void;
|
|
1365
|
+
/** Start keeping command-line input instead of handling it (boot). */
|
|
1366
|
+
holdInput(): void;
|
|
1367
|
+
/**
|
|
1368
|
+
* Stop holding input: what was typed is replayed at the next prompt, or
|
|
1369
|
+
* right away when `immediately` is set (e.g. no prompt will be drawn).
|
|
1370
|
+
*/
|
|
1371
|
+
releaseInput(immediately?: boolean): void;
|
|
1372
|
+
/** Whether a prompt (readLine, readSelect, ...) or full-screen mode owns the input. */
|
|
1373
|
+
get isReadingInput(): boolean;
|
|
1374
|
+
/** Whether keys were typed while input was held (boot). */
|
|
1375
|
+
get typedDuringBoot(): boolean;
|
|
1376
|
+
private replayHeldInput;
|
|
1377
|
+
private initializeWindowListeners;
|
|
1269
1378
|
setContextProcessor: (processor: ICliCommandProcessor | undefined, silent?: boolean, fullScreen?: boolean) => void;
|
|
1270
1379
|
setCurrentLine(line: string): void;
|
|
1271
1380
|
clearLine(): void;
|
|
@@ -1328,7 +1437,7 @@ declare class CliBackgroundServiceRegistry implements ICliBackgroundServiceRegis
|
|
|
1328
1437
|
private isFullScreen;
|
|
1329
1438
|
private notificationQueue;
|
|
1330
1439
|
private processRegistry?;
|
|
1331
|
-
constructor(state: ICliStateStore, services: ICliServiceProvider, writer?: ICliTerminalWriter
|
|
1440
|
+
constructor(state: ICliStateStore, services: ICliServiceProvider, writer?: ICliTerminalWriter);
|
|
1332
1441
|
/** Attach the process registry so background services get PIDs */
|
|
1333
1442
|
setProcessRegistry(registry: ICliProcessRegistry): void;
|
|
1334
1443
|
register(service: ICliBackgroundService): void;
|
|
@@ -1353,6 +1462,12 @@ declare class CliBackgroundServiceRegistry implements ICliBackgroundServiceRegis
|
|
|
1353
1462
|
private updateStatus;
|
|
1354
1463
|
private handleStartError;
|
|
1355
1464
|
private dispatchEvent;
|
|
1465
|
+
/**
|
|
1466
|
+
* Publish service events on the terminal's event bus: lifecycle events as
|
|
1467
|
+
* `service:<started|stopped|...>`, events relayed from a server's event
|
|
1468
|
+
* socket as `server:event`, other custom events as `service:event`.
|
|
1469
|
+
*/
|
|
1470
|
+
private forwardToEventBus;
|
|
1356
1471
|
private emitLifecycleEvent;
|
|
1357
1472
|
private notify;
|
|
1358
1473
|
private flushNotificationQueue;
|
|
@@ -1423,10 +1538,21 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
|
|
|
1423
1538
|
private globalParameters;
|
|
1424
1539
|
/** Exit status of the last command, expanded as `$?` (0 = success). */
|
|
1425
1540
|
private lastExitCode;
|
|
1541
|
+
/** Command lines running per terminal (they can overlap). */
|
|
1542
|
+
private readonly running;
|
|
1543
|
+
/** Exit status of the last command line run (`$?`). */
|
|
1544
|
+
get exitStatus(): number;
|
|
1426
1545
|
constructor(registry: ICliCommandProcessorRegistry);
|
|
1427
1546
|
registerGlobalParameter(handler: ICliGlobalParameterHandler): void;
|
|
1428
|
-
getGlobalParameters(): ICliCommandParameterDescriptor[];
|
|
1547
|
+
getGlobalParameters(): ICliCommandParameterDescriptor$1[];
|
|
1429
1548
|
executeCommand(command: string, context: ICliExecutionContext): Promise<void>;
|
|
1549
|
+
/** Whether the command named first on the line takes literal input. */
|
|
1550
|
+
private isLiteralInput;
|
|
1551
|
+
/**
|
|
1552
|
+
* Run a command line and return its output as text instead of showing
|
|
1553
|
+
* it (`$(...)`); its errors and warnings are still shown.
|
|
1554
|
+
*/
|
|
1555
|
+
capture(command: string, from: ICliExecutionContext): Promise<string>;
|
|
1430
1556
|
private executeSingleCommand;
|
|
1431
1557
|
private completeProcess;
|
|
1432
1558
|
private failProcess;
|
|
@@ -1455,6 +1581,11 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
|
|
|
1455
1581
|
* A guard that throws is treated as a denial (fail closed).
|
|
1456
1582
|
*/
|
|
1457
1583
|
private runGuards;
|
|
1584
|
+
/**
|
|
1585
|
+
* The text after the word that selected `processor`, which may be its
|
|
1586
|
+
* command or one of its aliases (e.g. `pkg rm guid` -> `guid`).
|
|
1587
|
+
*/
|
|
1588
|
+
private extractPositionalValue;
|
|
1458
1589
|
private guardDenial;
|
|
1459
1590
|
private processorOwnsParameter;
|
|
1460
1591
|
}
|
|
@@ -1482,6 +1613,9 @@ declare const contextGlobalParameter: ICliGlobalParameterHandler;
|
|
|
1482
1613
|
*
|
|
1483
1614
|
* After a command finishes, the executor can retrieve the captured data to use
|
|
1484
1615
|
* as implicit pipeline output when the command did not call `process.output()`.
|
|
1616
|
+
*
|
|
1617
|
+
* `muted` (output going into a pipe or a file) captures stdout-equivalent
|
|
1618
|
+
* output without showing it; diagnostics are still shown.
|
|
1485
1619
|
*/
|
|
1486
1620
|
declare class CapturingTerminalWriter implements ICliTerminalWriter {
|
|
1487
1621
|
private readonly inner;
|
|
@@ -1493,7 +1627,15 @@ declare class CapturingTerminalWriter implements ICliTerminalWriter {
|
|
|
1493
1627
|
private _tableObjects;
|
|
1494
1628
|
/** Raw text lines captured from writeError/writeWarning calls. */
|
|
1495
1629
|
private _stderrLines;
|
|
1496
|
-
|
|
1630
|
+
/** Number of writeError calls (warnings excluded). */
|
|
1631
|
+
private _errorCount;
|
|
1632
|
+
private readonly muted;
|
|
1633
|
+
constructor(inner: ICliTerminalWriter, options?: {
|
|
1634
|
+
muted?: boolean;
|
|
1635
|
+
});
|
|
1636
|
+
/** Show stdout-equivalent output unless muted. */
|
|
1637
|
+
private show;
|
|
1638
|
+
private captureText;
|
|
1497
1639
|
write(text: string): void;
|
|
1498
1640
|
writeln(text?: string): void;
|
|
1499
1641
|
writeJson(json: any): void;
|
|
@@ -1546,6 +1688,8 @@ declare class CapturingTerminalWriter implements ICliTerminalWriter {
|
|
|
1546
1688
|
* 4. Returns `undefined` if nothing was captured.
|
|
1547
1689
|
*/
|
|
1548
1690
|
getCapturedData(): any | undefined;
|
|
1691
|
+
/** Whether the command wrote an error message itself. */
|
|
1692
|
+
hasErrors(): boolean;
|
|
1549
1693
|
/**
|
|
1550
1694
|
* Returns true if any stderr-equivalent output was captured.
|
|
1551
1695
|
*/
|
|
@@ -1590,26 +1734,160 @@ declare function substituteVars(input: string, variables: Record<string, string>
|
|
|
1590
1734
|
*/
|
|
1591
1735
|
declare function expandEnvironmentVars(command: string, context: ICliExecutionContext, lastExitCode?: number): string;
|
|
1592
1736
|
|
|
1737
|
+
/**
|
|
1738
|
+
* Shell-style script runner shared by `sh <file>` / `source` (files plugin)
|
|
1739
|
+
* and `./script.sh` (the executor).
|
|
1740
|
+
*
|
|
1741
|
+
* Supported (a POSIX sh subset):
|
|
1742
|
+
* - one command per line or several separated by `;` (pipes, `&&`, `||`
|
|
1743
|
+
* and redirects are left to the executor)
|
|
1744
|
+
* - `# comments`, blank lines, `\` line continuation
|
|
1745
|
+
* - `set -e` (default) / `set +e`, `VAR=value` (script-scoped), `exit [n]`
|
|
1746
|
+
* - `if cmd; then ...; elif cmd; then ...; else ...; fi`
|
|
1747
|
+
* - `for NAME in words...; do ...; done` (words after `$VAR` and wildcard
|
|
1748
|
+
* expansion; NAME is set for this terminal)
|
|
1749
|
+
* - `while cmd; do ...; done`, `until cmd; do ...; done`
|
|
1750
|
+
* - `break [n]`, `continue [n]`, `! cmd` (negated status)
|
|
1751
|
+
*
|
|
1752
|
+
* Every simple command runs through the executor; its status is
|
|
1753
|
+
* `context.process.exitCode` (0 or undefined = success).
|
|
1754
|
+
*/
|
|
1755
|
+
/** Service token under which the engine provides the runner (for plugins). */
|
|
1756
|
+
declare const ICliScriptRunner_TOKEN: any;
|
|
1757
|
+
interface ICliScriptRunOptions {
|
|
1758
|
+
/** Prefix for error messages (`sh: line 4: ...`). Default `sh`. */
|
|
1759
|
+
name?: string;
|
|
1760
|
+
/** Runs one command line. Default `context.executor.executeCommand`. */
|
|
1761
|
+
executeCommand?: (command: string, context: ICliExecutionContext) => Promise<void>;
|
|
1762
|
+
/** Loop iterations allowed before a `while`/`until` is stopped. Default 10000. */
|
|
1763
|
+
maxLoopIterations?: number;
|
|
1764
|
+
/** Stop at the first failing command (`set -e`). Default true; false for typed lines. */
|
|
1765
|
+
stopOnError?: boolean;
|
|
1766
|
+
}
|
|
1767
|
+
interface ICliScriptRunner {
|
|
1768
|
+
/** Run script `content`; resolves to its exit status. */
|
|
1769
|
+
run(content: string, context: ICliExecutionContext, options?: ICliScriptRunOptions): Promise<number>;
|
|
1770
|
+
}
|
|
1771
|
+
/** The runner as a service value. */
|
|
1772
|
+
declare const cliScriptRunner: ICliScriptRunner;
|
|
1773
|
+
interface CommandNode {
|
|
1774
|
+
type: 'command';
|
|
1775
|
+
text: string;
|
|
1776
|
+
line: number;
|
|
1777
|
+
negate: boolean;
|
|
1778
|
+
}
|
|
1779
|
+
interface IfNode {
|
|
1780
|
+
type: 'if';
|
|
1781
|
+
line: number;
|
|
1782
|
+
branches: {
|
|
1783
|
+
condition: ScriptNode[];
|
|
1784
|
+
body: ScriptNode[];
|
|
1785
|
+
}[];
|
|
1786
|
+
elseBody?: ScriptNode[];
|
|
1787
|
+
}
|
|
1788
|
+
interface ForNode {
|
|
1789
|
+
type: 'for';
|
|
1790
|
+
line: number;
|
|
1791
|
+
name: string;
|
|
1792
|
+
words: string;
|
|
1793
|
+
body: ScriptNode[];
|
|
1794
|
+
}
|
|
1795
|
+
interface WhileNode {
|
|
1796
|
+
type: 'while';
|
|
1797
|
+
line: number;
|
|
1798
|
+
until: boolean;
|
|
1799
|
+
condition: ScriptNode[];
|
|
1800
|
+
body: ScriptNode[];
|
|
1801
|
+
}
|
|
1802
|
+
type ScriptNode = CommandNode | IfNode | ForNode | WhileNode;
|
|
1803
|
+
/** A syntax error found while parsing. */
|
|
1804
|
+
declare class CliScriptSyntaxError extends Error {
|
|
1805
|
+
readonly line: number;
|
|
1806
|
+
readonly detail: string;
|
|
1807
|
+
constructor(line: number, detail: string);
|
|
1808
|
+
}
|
|
1809
|
+
/** Parse script content (throws {@link CliScriptSyntaxError}). */
|
|
1810
|
+
declare function parseScript(content: string): ScriptNode[];
|
|
1811
|
+
/** Split a line into words, removing quotes (empty quoted words are kept). */
|
|
1812
|
+
declare function splitWords(text: string): string[];
|
|
1813
|
+
/**
|
|
1814
|
+
* Run script content with shell control flow. Resolves to the exit status
|
|
1815
|
+
* (also set as the context's process exit code).
|
|
1816
|
+
*/
|
|
1817
|
+
declare function runScript(content: string, context: ICliExecutionContext, options?: ICliScriptRunOptions): Promise<number>;
|
|
1818
|
+
|
|
1819
|
+
/** The file system calls glob expansion needs (`@qodalis/cli-files`). */
|
|
1820
|
+
interface GlobFileSystem {
|
|
1821
|
+
getCurrentDirectory(): string;
|
|
1822
|
+
resolvePath(path: string): string;
|
|
1823
|
+
listDirectory(path: string): {
|
|
1824
|
+
name: string;
|
|
1825
|
+
type: 'file' | 'directory';
|
|
1826
|
+
}[];
|
|
1827
|
+
exists(path: string): boolean;
|
|
1828
|
+
isDirectory(path: string): boolean;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Expand `*`, `?` and `[...]` in unquoted arguments to the matching paths,
|
|
1832
|
+
* as a shell does: `rm *.txt`, `cat docs/*.md`. The command name and flags
|
|
1833
|
+
* are left alone, names starting with `.` match only a pattern that starts
|
|
1834
|
+
* with `.`, and a pattern that matches nothing is kept as typed.
|
|
1835
|
+
* Without the files plugin the command is returned unchanged.
|
|
1836
|
+
*/
|
|
1837
|
+
declare function expandGlobs(command: string, context: ICliExecutionContext): string;
|
|
1838
|
+
/** Paths matching `pattern`, sorted, relative when the pattern is. */
|
|
1839
|
+
declare function matchGlob(fs: GlobFileSystem, pattern: string): string[];
|
|
1840
|
+
/**
|
|
1841
|
+
* Brace expansion, as a shell does before wildcards: `file.{ts,js}` is
|
|
1842
|
+
* `file.ts file.js`, `img{1..3}.png` is `img1.png img2.png img3.png`
|
|
1843
|
+
* (letters too: `{a..c}`). Only unquoted words with a `,` or `..` inside
|
|
1844
|
+
* balanced braces; `${VAR}` and quoted text are left alone. Works without
|
|
1845
|
+
* the files plugin.
|
|
1846
|
+
*/
|
|
1847
|
+
declare function expandBraces(command: string): string;
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* Replace `$(command)` and `` `command` `` with the command's output, as a
|
|
1851
|
+
* shell does: `echo "Today: $(date)"`. Not inside single quotes; inside
|
|
1852
|
+
* double quotes yes. Trailing newlines of the output are removed, and the
|
|
1853
|
+
* output is escaped so it is only ever text: inside double quotes `"`, `\`,
|
|
1854
|
+
* `$` and `` ` ``; outside quotes every shell character but spaces (which
|
|
1855
|
+
* still separate words), so quotes, operators, `$`, wildcards and braces in
|
|
1856
|
+
* the output are not interpreted.
|
|
1857
|
+
*/
|
|
1858
|
+
declare function substituteCommands(command: string, run: (inner: string) => Promise<string>): Promise<string>;
|
|
1859
|
+
|
|
1593
1860
|
/**
|
|
1594
1861
|
* A simple Map-based service container implementing ICliServiceProvider.
|
|
1595
1862
|
*
|
|
1596
1863
|
* Supports three provider types:
|
|
1597
1864
|
* - `useValue` : registers a static value
|
|
1598
|
-
* - `useFactory` : registers a factory function, invoked once on first `get`
|
|
1599
|
-
* - `useClass` : registers a class constructor, instantiated once on first `get`
|
|
1865
|
+
* - `useFactory` : registers a factory function, invoked once on the first `get`
|
|
1866
|
+
* - `useClass` : registers a class constructor, instantiated once on the first `get`
|
|
1867
|
+
*
|
|
1868
|
+
* Factories and classes are created lazily, so their `deps` only have to be
|
|
1869
|
+
* registered by the time the service is first used. Add `transient: true` to
|
|
1870
|
+
* create a new instance on every `get`.
|
|
1600
1871
|
*
|
|
1601
1872
|
* When `multi: true`, multiple providers for the same token are accumulated
|
|
1602
|
-
* and `
|
|
1873
|
+
* and `getAll()` returns all of them.
|
|
1874
|
+
*
|
|
1875
|
+
* Registering a single token again overrides it; removing that registration
|
|
1876
|
+
* (`remove(token, provider)`, e.g. when a module is unloaded) makes the
|
|
1877
|
+
* previous one active again.
|
|
1603
1878
|
*/
|
|
1604
1879
|
declare class CliServiceContainer implements ICliServiceProvider {
|
|
1605
|
-
/**
|
|
1880
|
+
/** Single-value registrations; the last one is active. */
|
|
1606
1881
|
private readonly services;
|
|
1607
|
-
/**
|
|
1882
|
+
/** Multi-provider registrations, in registration order. */
|
|
1608
1883
|
private readonly multiServices;
|
|
1609
1884
|
/** Tokens that cannot be overwritten by subsequent `set()` calls. */
|
|
1610
1885
|
private readonly sealedTokens;
|
|
1611
1886
|
/** Stores provider recipes for transient tokens (re-resolved on every get). */
|
|
1612
1887
|
private readonly transientRecipes;
|
|
1888
|
+
private disposed;
|
|
1889
|
+
/** Registrations being created, to report dependency cycles. */
|
|
1890
|
+
private readonly resolving;
|
|
1613
1891
|
/**
|
|
1614
1892
|
* Retrieve a service by its token.
|
|
1615
1893
|
* Returns `undefined` when no provider is registered for the token.
|
|
@@ -1618,6 +1896,7 @@ declare class CliServiceContainer implements ICliServiceProvider {
|
|
|
1618
1896
|
* @param token The token used to register the service.
|
|
1619
1897
|
* @returns The resolved service instance, or `undefined` if not registered.
|
|
1620
1898
|
*/
|
|
1899
|
+
get<T>(token: CliToken<T>): T | undefined;
|
|
1621
1900
|
get<T>(token: any): T | undefined;
|
|
1622
1901
|
/**
|
|
1623
1902
|
* Retrieve all registered services for a multi-provider token.
|
|
@@ -1626,6 +1905,7 @@ declare class CliServiceContainer implements ICliServiceProvider {
|
|
|
1626
1905
|
* @param token The token used to register the service.
|
|
1627
1906
|
* @returns Array of all resolved service instances.
|
|
1628
1907
|
*/
|
|
1908
|
+
getAll<T>(token: CliToken<T>): T[];
|
|
1629
1909
|
getAll<T>(token: any): T[];
|
|
1630
1910
|
/**
|
|
1631
1911
|
* Retrieve a service by its token, throwing if not registered.
|
|
@@ -1636,6 +1916,7 @@ declare class CliServiceContainer implements ICliServiceProvider {
|
|
|
1636
1916
|
* @returns The resolved service instance.
|
|
1637
1917
|
* @throws Error if the token has not been registered.
|
|
1638
1918
|
*/
|
|
1919
|
+
getRequired<T>(token: CliToken<T>): T;
|
|
1639
1920
|
getRequired<T>(token: any): T;
|
|
1640
1921
|
/**
|
|
1641
1922
|
* Check whether a service is registered for the given token.
|
|
@@ -1660,12 +1941,32 @@ declare class CliServiceContainer implements ICliServiceProvider {
|
|
|
1660
1941
|
* @param definition A single CliProvider or an array of CliProviders.
|
|
1661
1942
|
*/
|
|
1662
1943
|
set(definition: CliProvider | CliProvider[]): void;
|
|
1944
|
+
/**
|
|
1945
|
+
* Remove a registration. With `provider` (the provider object passed to
|
|
1946
|
+
* `set`, or the registered value), only that registration is removed: for
|
|
1947
|
+
* a single token the previous registration becomes active again, for a
|
|
1948
|
+
* multi token the others remain. Without it, every registration of the
|
|
1949
|
+
* token is removed.
|
|
1950
|
+
*
|
|
1951
|
+
* @throws Error if the token is sealed.
|
|
1952
|
+
* @returns Whether something was removed.
|
|
1953
|
+
*/
|
|
1954
|
+
remove(token: any, provider?: unknown): boolean;
|
|
1955
|
+
/**
|
|
1956
|
+
* Dispose the services the container created (`useFactory` / `useClass`)
|
|
1957
|
+
* that have a `dispose()` method. Values registered with `useValue`
|
|
1958
|
+
* belong to whoever registered them and are not disposed. Registrations
|
|
1959
|
+
* are kept, so late callbacks still find their services. Called when the
|
|
1960
|
+
* engine is destroyed; later calls do nothing.
|
|
1961
|
+
*/
|
|
1962
|
+
dispose(): void;
|
|
1663
1963
|
/**
|
|
1664
1964
|
* Returns all registered service tokens (single + multi providers).
|
|
1665
1965
|
*/
|
|
1666
1966
|
getRegisteredTokens(): string[];
|
|
1667
1967
|
/**
|
|
1668
1968
|
* Returns detailed info for each registered service: token name, value type, and multi flag.
|
|
1969
|
+
* Services not created yet are listed as `lazy(Name)` (listing does not create them).
|
|
1669
1970
|
*/
|
|
1670
1971
|
getRegisteredServiceDetails(): {
|
|
1671
1972
|
token: string;
|
|
@@ -1676,19 +1977,22 @@ declare class CliServiceContainer implements ICliServiceProvider {
|
|
|
1676
1977
|
* Convert a token to a human-readable string for diagnostics/errors.
|
|
1677
1978
|
*/
|
|
1678
1979
|
private tokenToString;
|
|
1980
|
+
private describeRegistration;
|
|
1679
1981
|
/**
|
|
1680
1982
|
* Describe a resolved value for diagnostic display.
|
|
1681
1983
|
*/
|
|
1682
1984
|
private describeValue;
|
|
1985
|
+
/** Whether `registration` is the one `provider` refers to. */
|
|
1986
|
+
private matches;
|
|
1683
1987
|
/**
|
|
1684
1988
|
* Register a single provider.
|
|
1685
1989
|
*/
|
|
1686
1990
|
private registerProvider;
|
|
1991
|
+
/** The value of a registration, created on first use. */
|
|
1992
|
+
private resolve;
|
|
1687
1993
|
/**
|
|
1688
|
-
* Resolve a provider definition to a concrete value
|
|
1689
|
-
*
|
|
1690
|
-
* Note: `deps` are resolved eagerly at registration time, so
|
|
1691
|
-
* dependency tokens must be registered before the provider that needs them.
|
|
1994
|
+
* Resolve a provider definition to a concrete value, resolving its `deps`
|
|
1995
|
+
* from the container.
|
|
1692
1996
|
*/
|
|
1693
1997
|
private resolveProvider;
|
|
1694
1998
|
}
|
|
@@ -1807,11 +2111,22 @@ declare class CliTerminalTextAnimator implements ICliTextAnimator {
|
|
|
1807
2111
|
isRunning: boolean;
|
|
1808
2112
|
context?: ICliExecutionContext;
|
|
1809
2113
|
private animationInterval?;
|
|
2114
|
+
/** Characters of the current animation still visible on the line. */
|
|
2115
|
+
private visibleChars;
|
|
2116
|
+
/** Ends the current `showText` promise early (set while it runs). */
|
|
2117
|
+
private finish?;
|
|
1810
2118
|
private text;
|
|
1811
2119
|
private textColor;
|
|
1812
2120
|
constructor(terminal: Terminal);
|
|
1813
2121
|
show(text?: string): void;
|
|
1814
2122
|
showText(text: string, options?: CliTextAnimatorOptions): Promise<void>;
|
|
2123
|
+
/** Cursor position as `row:col`, or `null` when unavailable. */
|
|
2124
|
+
private cursorPosition;
|
|
2125
|
+
/**
|
|
2126
|
+
* Stop the animation, erase the text it wrote and resolve its `showText`
|
|
2127
|
+
* promise. Used when the user starts typing over the greeting.
|
|
2128
|
+
*/
|
|
2129
|
+
cancel(): void;
|
|
1815
2130
|
/**
|
|
1816
2131
|
* Hide the animation and reset the state.
|
|
1817
2132
|
*/
|
|
@@ -1828,6 +2143,101 @@ interface ICliWelcomeModule extends ICliModule {
|
|
|
1828
2143
|
configure(config: CliWelcomeMessageConfig): ICliModule;
|
|
1829
2144
|
}
|
|
1830
2145
|
declare const welcomeModule: ICliWelcomeModule;
|
|
2146
|
+
/**
|
|
2147
|
+
* Animated, time-based greeting on the first prompt. Runs after every other
|
|
2148
|
+
* module's `onAfterBoot` hook (setup and sign-in prompts come first), and
|
|
2149
|
+
* only when the welcome banner was shown.
|
|
2150
|
+
*/
|
|
2151
|
+
declare const greetingModule: ICliModule;
|
|
2152
|
+
|
|
2153
|
+
interface CliBootLogOptions {
|
|
2154
|
+
/** Steps taking at least this long are highlighted as slow. */
|
|
2155
|
+
slowStepMs?: number;
|
|
2156
|
+
/** When boot started (ms since epoch); defaults to now. */
|
|
2157
|
+
startedAt?: number;
|
|
2158
|
+
}
|
|
2159
|
+
/**
|
|
2160
|
+
* Live boot report written to the terminal while the CLI starts: a list of
|
|
2161
|
+
* the steps (terminal, services, servers, modules) with a thin progress bar
|
|
2162
|
+
* and percentage pinned below it.
|
|
2163
|
+
*
|
|
2164
|
+
* Anything else written to the terminal meanwhile is captured and the bar
|
|
2165
|
+
* steps aside for it. When boot is complete the report is cleared so the
|
|
2166
|
+
* regular terminal takes over; warnings, errors and other output (plugin
|
|
2167
|
+
* warnings) are written again in order. First-run setup prompts, answered
|
|
2168
|
+
* while the report is suspended, are cleared with it.
|
|
2169
|
+
*
|
|
2170
|
+
* A disabled log records problems but writes nothing.
|
|
2171
|
+
*/
|
|
2172
|
+
declare class CliBootLog {
|
|
2173
|
+
private readonly terminal;
|
|
2174
|
+
readonly enabled: boolean;
|
|
2175
|
+
private readonly startedAt;
|
|
2176
|
+
private readonly slowStepMs;
|
|
2177
|
+
private readonly problems;
|
|
2178
|
+
private finished;
|
|
2179
|
+
private totalSteps;
|
|
2180
|
+
private completedSteps;
|
|
2181
|
+
private current;
|
|
2182
|
+
private barVisible;
|
|
2183
|
+
private cursorHidden;
|
|
2184
|
+
private suspended;
|
|
2185
|
+
private startRow;
|
|
2186
|
+
/** Output written by others during boot, replayed after the report is cleared. */
|
|
2187
|
+
private readonly captured;
|
|
2188
|
+
private originalWrite?;
|
|
2189
|
+
private originalWriteln?;
|
|
2190
|
+
private redrawScheduled;
|
|
2191
|
+
/** The last setup output did not end its line (cursor after a prompt). */
|
|
2192
|
+
private promptOpen;
|
|
2193
|
+
constructor(terminal: Terminal | undefined, enabled: boolean, options?: CliBootLogOptions);
|
|
2194
|
+
/** Milliseconds since boot started. */
|
|
2195
|
+
get elapsedMs(): number;
|
|
2196
|
+
/** Whether `finish()` was called; later entries are ignored. */
|
|
2197
|
+
get isFinished(): boolean;
|
|
2198
|
+
/** Completed share of the planned steps, 0–100. */
|
|
2199
|
+
get percent(): number;
|
|
2200
|
+
/** Announce `count` more steps that will each be completed with `completeStep`. */
|
|
2201
|
+
addSteps(count: number): void;
|
|
2202
|
+
/** Name what is being set up now (shown next to the bar). */
|
|
2203
|
+
setCurrent(text: string): void;
|
|
2204
|
+
/** Mark one planned step as done (successfully or not). */
|
|
2205
|
+
completeStep(): void;
|
|
2206
|
+
/**
|
|
2207
|
+
* Step aside for interactive output (e.g. a module's first-run setup
|
|
2208
|
+
* prompt): remove the bar and show the cursor until `resume()`.
|
|
2209
|
+
*/
|
|
2210
|
+
suspend(): void;
|
|
2211
|
+
/** Bring the bar back after `suspend()`. */
|
|
2212
|
+
resume(): void;
|
|
2213
|
+
info(text: string): void;
|
|
2214
|
+
/** A completed step, optionally with how long it took. */
|
|
2215
|
+
ok(text: string, durationMs?: number): void;
|
|
2216
|
+
warn(text: string): void;
|
|
2217
|
+
error(text: string): void;
|
|
2218
|
+
/**
|
|
2219
|
+
* Write the summary line, then hand the screen over to the terminal:
|
|
2220
|
+
* clear the report (unless `keep`), then write warnings, errors and the
|
|
2221
|
+
* output captured during boot again. The report is not cleared when the
|
|
2222
|
+
* terminal already held something before boot started.
|
|
2223
|
+
*/
|
|
2224
|
+
finish(summary: string, keep?: boolean): Promise<void>;
|
|
2225
|
+
private write;
|
|
2226
|
+
/** Redraw the bar on the line below the list (the cursor stays on it). */
|
|
2227
|
+
private drawBar;
|
|
2228
|
+
/** First output: remember where the report starts and capture other writes. */
|
|
2229
|
+
private begin;
|
|
2230
|
+
private stopCapture;
|
|
2231
|
+
/** Someone else writes during boot: move the bar aside and keep a copy. */
|
|
2232
|
+
private onExternalWrite;
|
|
2233
|
+
/** Write without being captured. */
|
|
2234
|
+
private out;
|
|
2235
|
+
private hideBar;
|
|
2236
|
+
private format;
|
|
2237
|
+
private absoluteRow;
|
|
2238
|
+
/** Resolve once xterm has parsed everything written so far. */
|
|
2239
|
+
private flush;
|
|
2240
|
+
}
|
|
1831
2241
|
|
|
1832
2242
|
declare class CliBoot {
|
|
1833
2243
|
private readonly registry;
|
|
@@ -1837,13 +2247,53 @@ declare class CliBoot {
|
|
|
1837
2247
|
private readonly moduleRegistry;
|
|
1838
2248
|
private readonly bootedModules;
|
|
1839
2249
|
private readonly initializedProcessors;
|
|
2250
|
+
/** Services and guards each module registered, removed when it is unloaded. */
|
|
2251
|
+
private readonly moduleProviders;
|
|
2252
|
+
/** Context modules were booted with (passed to `onDestroy` on unload). */
|
|
2253
|
+
private context?;
|
|
2254
|
+
/** Boot report of the startup boot. */
|
|
2255
|
+
private bootLogRef?;
|
|
2256
|
+
/** The boot report while startup is still in progress, else `undefined`. */
|
|
2257
|
+
private get bootLog();
|
|
1840
2258
|
constructor(registry: ICliCommandProcessorRegistry, services: ICliServiceProvider);
|
|
1841
2259
|
/**
|
|
1842
2260
|
* Get the module registry for external access.
|
|
1843
2261
|
*/
|
|
1844
2262
|
getModuleRegistry(): CliModuleRegistry;
|
|
1845
|
-
boot(context: CliExecutionContext, modules: ICliModule[]): Promise<void>;
|
|
2263
|
+
boot(context: CliExecutionContext, modules: ICliModule[], bootLog?: CliBootLog): Promise<void>;
|
|
2264
|
+
private bootAll;
|
|
2265
|
+
/**
|
|
2266
|
+
* Boot one module: declarations (services, guards, permissions,
|
|
2267
|
+
* translations), lifecycle (`onInit`, first-run `onSetup`), then its
|
|
2268
|
+
* commands. Modules already booted or with missing dependencies are skipped.
|
|
2269
|
+
*/
|
|
1846
2270
|
private bootModule;
|
|
2271
|
+
private dependenciesLoaded;
|
|
2272
|
+
/** Services, guards, permissions and translations the module declares. */
|
|
2273
|
+
private registerDeclarations;
|
|
2274
|
+
/** `onInit` runs before the module's commands are registered. */
|
|
2275
|
+
private runOnInit;
|
|
2276
|
+
/** `onSetup` runs once per browser (first-run flow), until it succeeds. */
|
|
2277
|
+
private runFirstSetup;
|
|
2278
|
+
/** Register and initialize the module's commands; returns how many. */
|
|
2279
|
+
private registerCommands;
|
|
2280
|
+
/** One boot-log line per module that does something at boot. */
|
|
2281
|
+
private reportModule;
|
|
2282
|
+
/**
|
|
2283
|
+
* Unload a module (`pkg remove`, or before `pkg update` boots the new
|
|
2284
|
+
* version): its commands, guards and permissions are removed at once,
|
|
2285
|
+
* then `onDestroy` runs, then its services are removed (so `onDestroy`
|
|
2286
|
+
* can still use them). Services are removed by registration, so a newer
|
|
2287
|
+
* version registered meanwhile keeps its own.
|
|
2288
|
+
*/
|
|
2289
|
+
private unloadModule;
|
|
2290
|
+
private removeProviders;
|
|
2291
|
+
/** Publish on the event bus; never lets the bus break booting. */
|
|
2292
|
+
private emitEvent;
|
|
2293
|
+
/** Boot warning: into the boot log when it is shown, else the terminal. */
|
|
2294
|
+
private warn;
|
|
2295
|
+
/** Boot error: into the boot log when it is shown, else the terminal. */
|
|
2296
|
+
private fail;
|
|
1847
2297
|
/**
|
|
1848
2298
|
* Sub-processors of an `extendsProcessor` processor are merged into the
|
|
1849
2299
|
* processor it extends, so they belong to that one: re-parent them so they
|
|
@@ -2010,7 +2460,7 @@ declare class CliInputReader implements ICliInputReader {
|
|
|
2010
2460
|
readFile(prompt: string, options?: CliFilePickerOptions): Promise<CliFileResult[] | null>;
|
|
2011
2461
|
}
|
|
2012
2462
|
|
|
2013
|
-
declare const CliProcessRegistry_TOKEN
|
|
2463
|
+
declare const CliProcessRegistry_TOKEN: any;
|
|
2014
2464
|
declare class CliProcessRegistry implements ICliProcessRegistry {
|
|
2015
2465
|
private nextPid;
|
|
2016
2466
|
private processes;
|
|
@@ -2029,7 +2479,7 @@ declare class CliProcessRegistry implements ICliProcessRegistry {
|
|
|
2029
2479
|
}
|
|
2030
2480
|
|
|
2031
2481
|
/**
|
|
2032
|
-
*
|
|
2482
|
+
* Environment variables for the CLI.
|
|
2033
2483
|
*
|
|
2034
2484
|
* Variables set here are available to all commands via `$VAR` / `${VAR}`
|
|
2035
2485
|
* substitution in the executor. Commands can also read/write the store
|
|
@@ -2038,16 +2488,29 @@ declare class CliProcessRegistry implements ICliProcessRegistry {
|
|
|
2038
2488
|
interface ICliEnvironment {
|
|
2039
2489
|
/** Get a variable value (undefined if not set). */
|
|
2040
2490
|
get(name: string): string | undefined;
|
|
2041
|
-
/**
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2491
|
+
/**
|
|
2492
|
+
* Set a variable: for the signed-in user (`'user'`, the default, saved),
|
|
2493
|
+
* for everyone (`'global'`, saved) or for this terminal only (`'session'`).
|
|
2494
|
+
*/
|
|
2495
|
+
set(name: string, value: string, scope?: CliEnvironmentScope): void;
|
|
2496
|
+
/**
|
|
2497
|
+
* Remove a variable. Without a scope it is removed for this terminal and
|
|
2498
|
+
* the user (and hidden when it still comes from a shared or built-in
|
|
2499
|
+
* value); `'global'` removes the shared value.
|
|
2500
|
+
*/
|
|
2501
|
+
unset(name: string, scope?: CliEnvironmentScope): void;
|
|
2045
2502
|
/** Get all variables as a record. */
|
|
2046
2503
|
getAll(): Record<string, string>;
|
|
2047
2504
|
/** Check if a variable is set. */
|
|
2048
2505
|
has(name: string): boolean;
|
|
2049
|
-
|
|
2050
|
-
|
|
2506
|
+
/** Where the current value of `name` comes from. */
|
|
2507
|
+
scopeOf?(name: string): CliEnvironmentSource | undefined;
|
|
2508
|
+
}
|
|
2509
|
+
declare const ICliEnvironment_TOKEN: any;
|
|
2510
|
+
/** Where a variable is set: this terminal, the signed-in user, or everyone. */
|
|
2511
|
+
type CliEnvironmentScope = 'session' | 'user' | 'global';
|
|
2512
|
+
/** Where a value comes from: a scope, or computed / built in (`HOME`, `SHELL`, …). */
|
|
2513
|
+
type CliEnvironmentSource = CliEnvironmentScope | 'builtin';
|
|
2051
2514
|
/** What one user (or the signed-out session, key '') changed: values set and defaults removed. */
|
|
2052
2515
|
interface CliEnvironmentProfile {
|
|
2053
2516
|
vars: Record<string, string>;
|
|
@@ -2055,37 +2518,76 @@ interface CliEnvironmentProfile {
|
|
|
2055
2518
|
}
|
|
2056
2519
|
/** Saved environment: one profile per user name ('' when nobody is signed in). */
|
|
2057
2520
|
type CliEnvironmentSnapshot = Record<string, CliEnvironmentProfile>;
|
|
2521
|
+
/**
|
|
2522
|
+
* One saved change, applied by the host to the latest saved state (so two
|
|
2523
|
+
* tabs changing different variables never overwrite each other).
|
|
2524
|
+
*/
|
|
2525
|
+
type CliEnvironmentChange = {
|
|
2526
|
+
scope: 'user';
|
|
2527
|
+
profile: string;
|
|
2528
|
+
name: string;
|
|
2529
|
+
value: string;
|
|
2530
|
+
} | {
|
|
2531
|
+
scope: 'user';
|
|
2532
|
+
profile: string;
|
|
2533
|
+
name: string;
|
|
2534
|
+
unset: true;
|
|
2535
|
+
hide: boolean;
|
|
2536
|
+
} | {
|
|
2537
|
+
scope: 'global';
|
|
2538
|
+
name: string;
|
|
2539
|
+
value: string;
|
|
2540
|
+
} | {
|
|
2541
|
+
scope: 'global';
|
|
2542
|
+
name: string;
|
|
2543
|
+
unset: true;
|
|
2544
|
+
};
|
|
2058
2545
|
/**
|
|
2059
2546
|
* Default in-memory implementation.
|
|
2060
2547
|
*
|
|
2061
|
-
* A variable resolves, in order, from
|
|
2062
|
-
*
|
|
2063
|
-
*
|
|
2064
|
-
*
|
|
2548
|
+
* A variable resolves, in order, from this terminal's variables
|
|
2549
|
+
* (`NAME=value`), the current user's own (`export`), the shared ones
|
|
2550
|
+
* (`export --global`), then bound live values (USER, HOME, PWD follow the
|
|
2551
|
+
* session and directory), then the standard variables seeded on
|
|
2552
|
+
* construction. Each user has a separate set, so `su`/`login` switch
|
|
2553
|
+
* environments, and `onChange` lets the host save each change.
|
|
2065
2554
|
*/
|
|
2066
2555
|
declare class CliEnvironment implements ICliEnvironment {
|
|
2067
2556
|
private readonly defaults;
|
|
2068
2557
|
/** Variables computed on read; a user's own value wins over them. */
|
|
2069
2558
|
private readonly bound;
|
|
2070
2559
|
private readonly profiles;
|
|
2560
|
+
private readonly global;
|
|
2561
|
+
private readonly session;
|
|
2071
2562
|
private profileKey;
|
|
2072
|
-
/** Called after every change
|
|
2073
|
-
onChange?: (
|
|
2563
|
+
/** Called after every saved change (user or global), to persist it. */
|
|
2564
|
+
onChange?: (change: CliEnvironmentChange) => void;
|
|
2074
2565
|
constructor();
|
|
2075
2566
|
/** Compute a variable on every read; the seeded value is the fallback while it returns nothing. */
|
|
2076
2567
|
bind(name: string, resolver: () => string | null | undefined): void;
|
|
2077
2568
|
/** Pick whose changes apply (the signed-in user's name, '' when signed out). */
|
|
2078
2569
|
setProfileResolver(resolver: () => string | null | undefined): void;
|
|
2079
|
-
/** Restore saved profiles (replaces the ones in memory). */
|
|
2080
|
-
load(snapshot: CliEnvironmentSnapshot | undefined): void;
|
|
2570
|
+
/** Restore saved profiles and shared variables (replaces the saved ones in memory). */
|
|
2571
|
+
load(snapshot: CliEnvironmentSnapshot | undefined, global?: Record<string, string>): void;
|
|
2081
2572
|
snapshot(): CliEnvironmentSnapshot;
|
|
2573
|
+
/** The shared variables. */
|
|
2574
|
+
globals(): Record<string, string>;
|
|
2082
2575
|
get(name: string): string | undefined;
|
|
2083
|
-
|
|
2084
|
-
|
|
2576
|
+
scopeOf(name: string): CliEnvironmentSource | undefined;
|
|
2577
|
+
set(name: string, value: string, scope?: CliEnvironmentScope): void;
|
|
2578
|
+
unset(name: string, scope?: CliEnvironmentScope): void;
|
|
2085
2579
|
getAll(): Record<string, string>;
|
|
2086
2580
|
has(name: string): boolean;
|
|
2087
|
-
private
|
|
2088
|
-
}
|
|
2581
|
+
private profileOf;
|
|
2582
|
+
}
|
|
2583
|
+
/** Apply one change to saved state (the host does this under the cross-tab lock). */
|
|
2584
|
+
declare function applyEnvironmentChange(state: {
|
|
2585
|
+
profiles?: CliEnvironmentSnapshot;
|
|
2586
|
+
global?: Record<string, string>;
|
|
2587
|
+
}, change: CliEnvironmentChange): {
|
|
2588
|
+
profiles: CliEnvironmentSnapshot;
|
|
2589
|
+
global: Record<string, string>;
|
|
2590
|
+
};
|
|
2089
2591
|
|
|
2090
2592
|
declare class CliDragDropService implements ICliDragDropService {
|
|
2091
2593
|
private readonly _container;
|
|
@@ -2130,7 +2632,7 @@ declare class CliHttpClient implements ICliHttpClient {
|
|
|
2130
2632
|
declare class CliNotifier implements ICliNotifier {
|
|
2131
2633
|
private _current;
|
|
2132
2634
|
private readonly _change$;
|
|
2133
|
-
readonly change$: rxjs.Observable<
|
|
2635
|
+
readonly change$: rxjs.Observable<any>;
|
|
2134
2636
|
get current(): CliNotification | undefined;
|
|
2135
2637
|
info(message: string): void;
|
|
2136
2638
|
success(message: string): void;
|
|
@@ -2144,6 +2646,7 @@ declare class CliNotifier implements ICliNotifier {
|
|
|
2144
2646
|
declare class CliPermissionRegistry implements ICliPermissionRegistry {
|
|
2145
2647
|
private readonly definitions;
|
|
2146
2648
|
register(definitions: CliPermissionDefinition[], module?: string): void;
|
|
2649
|
+
unregister(module: string): void;
|
|
2147
2650
|
list(): CliPermissionDefinition[];
|
|
2148
2651
|
get(name: string): CliPermissionDefinition | undefined;
|
|
2149
2652
|
}
|
|
@@ -2204,22 +2707,113 @@ declare class CliKeyValueStore implements ICliKeyValueStore {
|
|
|
2204
2707
|
declare class CliStateStore implements ICliStateStore {
|
|
2205
2708
|
private readonly services;
|
|
2206
2709
|
readonly name: string;
|
|
2207
|
-
private readonly initialState;
|
|
2208
2710
|
private state$;
|
|
2209
|
-
|
|
2210
|
-
|
|
2711
|
+
/** Signed-in user, for `scope: 'user'` stores. */
|
|
2712
|
+
private user?;
|
|
2713
|
+
private initialState;
|
|
2714
|
+
private options;
|
|
2715
|
+
/** The first load from storage (see `initialize`). */
|
|
2716
|
+
private loading?;
|
|
2717
|
+
private loaded;
|
|
2718
|
+
/** Keys changed before the saved state was loaded: they win over it. */
|
|
2719
|
+
private readonly changedBeforeLoad;
|
|
2720
|
+
/** Keys changed since the last save (only these are written). */
|
|
2721
|
+
private readonly unsaved;
|
|
2722
|
+
/** When each key was last changed here (`updateState`), to tell local edits from synced ones. */
|
|
2723
|
+
private readonly editedAt;
|
|
2724
|
+
private edits;
|
|
2725
|
+
/** `reset()` since the last save: the whole state is written. */
|
|
2726
|
+
private replaceOnSave;
|
|
2727
|
+
/**
|
|
2728
|
+
* Each key as last loaded, saved or received (JSON), to also find keys
|
|
2729
|
+
* changed in place without `updateState`.
|
|
2730
|
+
*/
|
|
2731
|
+
private baseline;
|
|
2732
|
+
private persistScheduled;
|
|
2733
|
+
/**
|
|
2734
|
+
* Called after the state was saved (set by the store manager to share it
|
|
2735
|
+
* with other tabs).
|
|
2736
|
+
*/
|
|
2737
|
+
onPersisted?: (storageKey: string, state: CliState) => void;
|
|
2738
|
+
constructor(services: ICliServiceProvider, name: string, initialState: CliState, options?: CliStateStoreOptions);
|
|
2739
|
+
/** Key the state is saved under. */
|
|
2740
|
+
get key(): string;
|
|
2741
|
+
/**
|
|
2742
|
+
* Saved per store, or per signed-in user for `scope: 'user'` (signed
|
|
2743
|
+
* out, the state is shared like a global store).
|
|
2744
|
+
*/
|
|
2745
|
+
private get storageKey();
|
|
2746
|
+
/**
|
|
2747
|
+
* The signed-in user changed: a `scope: 'user'` store switches to that
|
|
2748
|
+
* user's saved state (unsaved changes of the previous user are dropped,
|
|
2749
|
+
* so save before switching users).
|
|
2750
|
+
*/
|
|
2751
|
+
setUser(user: string | undefined): void;
|
|
2752
|
+
/** Whether changes saved by other tabs are applied to this store. */
|
|
2753
|
+
get syncAcrossTabs(): boolean;
|
|
2754
|
+
/** A session store lives in this terminal only and is never saved. */
|
|
2755
|
+
private get isSession();
|
|
2211
2756
|
getState<T extends CliState = CliState>(): T;
|
|
2212
2757
|
updateState(newState: Partial<CliState>): void;
|
|
2213
2758
|
select<K>(selector: (state: CliState) => K): Observable<K>;
|
|
2214
2759
|
subscribe(callback: (state: CliState) => void): Subscription;
|
|
2215
2760
|
reset(): void;
|
|
2761
|
+
/**
|
|
2762
|
+
* Save the state. The saved state is loaded first, so saving before the
|
|
2763
|
+
* store was loaded never replaces data with the initial state.
|
|
2764
|
+
*/
|
|
2216
2765
|
persist(): Promise<void>;
|
|
2766
|
+
/**
|
|
2767
|
+
* Change the state from its latest saved value and save it, atomically:
|
|
2768
|
+
* under the cross-tab lock, `change` gets the state as saved (plus this
|
|
2769
|
+
* terminal's unsaved changes) and its result is merged and written. Two
|
|
2770
|
+
* terminals updating the same key never lose each other's change, e.g.
|
|
2771
|
+
* both adding an item to a list. Without storage (or for a session
|
|
2772
|
+
* store) it is a plain `updateState`.
|
|
2773
|
+
*/
|
|
2774
|
+
update(change: (state: CliState) => Partial<CliState>): Promise<void>;
|
|
2217
2775
|
initialize(): Promise<void>;
|
|
2776
|
+
reload(): Promise<void>;
|
|
2777
|
+
/**
|
|
2778
|
+
* Add defaults for keys the store does not have yet (when it was first
|
|
2779
|
+
* created without them, e.g. read before its command registered).
|
|
2780
|
+
*/
|
|
2781
|
+
applyDefaults(defaults: CliState): void;
|
|
2782
|
+
/** Merge store options (later options win). */
|
|
2783
|
+
setOptions(options: CliStateStoreOptions): void;
|
|
2784
|
+
/**
|
|
2785
|
+
* State saved by another tab or terminal: apply it without saving again,
|
|
2786
|
+
* keeping the keys changed here and not saved yet.
|
|
2787
|
+
*/
|
|
2788
|
+
applySaved(state: CliState): void;
|
|
2789
|
+
/**
|
|
2790
|
+
* Another tab or terminal saved this store: apply what is saved now.
|
|
2791
|
+
* Messages can arrive out of order (one sent before this terminal's own
|
|
2792
|
+
* save can arrive after it), so storage, not the message, is the truth.
|
|
2793
|
+
* Reads are chained so the last one applied is the latest.
|
|
2794
|
+
*/
|
|
2795
|
+
refreshFromStorage(fallback?: CliState): Promise<void>;
|
|
2796
|
+
private refreshing;
|
|
2218
2797
|
/**
|
|
2219
2798
|
* Complete the BehaviorSubject so all subscribers are notified
|
|
2220
2799
|
* and no further emissions occur. Called during engine teardown.
|
|
2221
2800
|
*/
|
|
2222
2801
|
dispose(): void;
|
|
2802
|
+
private load;
|
|
2803
|
+
/**
|
|
2804
|
+
* Save the keys changed here, merged into the saved state (the whole
|
|
2805
|
+
* state after `reset()` or a migration). Runs under a lock shared by all
|
|
2806
|
+
* tabs, so two terminals saving at once do not lose each other's keys.
|
|
2807
|
+
* Keys others saved meanwhile are applied here.
|
|
2808
|
+
*/
|
|
2809
|
+
private write;
|
|
2810
|
+
/** Keys changed here since the last load, save or received state. */
|
|
2811
|
+
private changedKeys;
|
|
2812
|
+
private setBaseline;
|
|
2813
|
+
private pick;
|
|
2814
|
+
private get versionKey();
|
|
2815
|
+
/** With `autoPersist`, save once after the changes of this tick. */
|
|
2816
|
+
private schedulePersist;
|
|
2223
2817
|
}
|
|
2224
2818
|
|
|
2225
2819
|
interface CliEngineOptions extends CliOptions {
|
|
@@ -2251,6 +2845,10 @@ declare class CliEngine {
|
|
|
2251
2845
|
private bootService?;
|
|
2252
2846
|
private dragDropService?;
|
|
2253
2847
|
private _startedAt?;
|
|
2848
|
+
private terminalOptions;
|
|
2849
|
+
private _isBooted;
|
|
2850
|
+
private resolveBooted;
|
|
2851
|
+
private readonly bootedPromise;
|
|
2254
2852
|
constructor(container: HTMLElement, options?: CliEngineOptions | undefined);
|
|
2255
2853
|
/**
|
|
2256
2854
|
* Register a CLI module to be loaded on start().
|
|
@@ -2277,9 +2875,47 @@ declare class CliEngine {
|
|
|
2277
2875
|
*/
|
|
2278
2876
|
registerService(token: string, value: any): void;
|
|
2279
2877
|
/**
|
|
2280
|
-
*
|
|
2878
|
+
* Start the CLI: set up the terminal and services, boot the modules
|
|
2879
|
+
* (reporting progress in the terminal), then hand over to the prompt.
|
|
2880
|
+
*
|
|
2881
|
+
* Phases, in order:
|
|
2882
|
+
* 1. terminal xterm.js in the container
|
|
2883
|
+
* 2. services service container, executor, execution context
|
|
2884
|
+
* 3. boot report hold typed keys, show the boot log
|
|
2885
|
+
* 4. runtime environment, background services, servers
|
|
2886
|
+
* 5. modules core + welcome + server + user modules
|
|
2887
|
+
* 6. completion tab-completion providers
|
|
2888
|
+
* 7. ready clear the report, replay typed keys, `isBooted`
|
|
2889
|
+
* 8. after boot `onAfterBoot` hooks (welcome message), snapshot
|
|
2281
2890
|
*/
|
|
2282
2891
|
start(): Promise<void>;
|
|
2892
|
+
/** 1. Wait for the container to have a size, then create xterm.js. */
|
|
2893
|
+
private setupTerminal;
|
|
2894
|
+
/** 2. Service container, boot service, executor and execution context. */
|
|
2895
|
+
private setupServices;
|
|
2896
|
+
/**
|
|
2897
|
+
* 3. Keep what the user types until the terminal is ready (replayed at
|
|
2898
|
+
* the first prompt) and start the boot report (configurable).
|
|
2899
|
+
*/
|
|
2900
|
+
private beginBootReport;
|
|
2901
|
+
/** 4. Environment variables, background services, server auth and manager. */
|
|
2902
|
+
private registerRuntimeServices;
|
|
2903
|
+
/** 4. Connect to the configured servers, one boot step each. */
|
|
2904
|
+
private connectServers;
|
|
2905
|
+
/**
|
|
2906
|
+
* 5. Built-in welcome and server modules, the app's modules, and the
|
|
2907
|
+
* greeting, which runs after every other `onAfterBoot` hook.
|
|
2908
|
+
*/
|
|
2909
|
+
private modulesToBoot;
|
|
2910
|
+
/** 7. Replace the boot report with the terminal and mark the CLI booted. */
|
|
2911
|
+
private completeBoot;
|
|
2912
|
+
/**
|
|
2913
|
+
* Boot threw: never leave the terminal unusable. Keep the report with the
|
|
2914
|
+
* error on screen, show the cursor and hand over typed keys.
|
|
2915
|
+
*/
|
|
2916
|
+
private failBoot;
|
|
2917
|
+
/** 8. `onAfterBoot` hooks by priority (lower first); one failing hook does not stop the rest. */
|
|
2918
|
+
private runAfterBootHooks;
|
|
2283
2919
|
/**
|
|
2284
2920
|
* Clean up terminal and event listeners.
|
|
2285
2921
|
*/
|
|
@@ -2300,6 +2936,16 @@ declare class CliEngine {
|
|
|
2300
2936
|
* Get the command processor registry.
|
|
2301
2937
|
*/
|
|
2302
2938
|
getRegistry(): CliCommandProcessorRegistry;
|
|
2939
|
+
/**
|
|
2940
|
+
* `true` once boot has completed: modules are set up and the terminal
|
|
2941
|
+
* accepts input. `onAfterBoot` hooks (welcome message) run right after.
|
|
2942
|
+
*/
|
|
2943
|
+
get isBooted(): boolean;
|
|
2944
|
+
/**
|
|
2945
|
+
* Resolves when boot has completed (see `isBooted`). Never rejects; if
|
|
2946
|
+
* `start()` fails it stays pending.
|
|
2947
|
+
*/
|
|
2948
|
+
get booted(): Promise<void>;
|
|
2303
2949
|
/**
|
|
2304
2950
|
* Timestamp (ms since epoch) when the engine finished starting.
|
|
2305
2951
|
*/
|
|
@@ -2364,6 +3010,33 @@ declare function initializeTerminal(container: HTMLElement, opts: ITerminalOptio
|
|
|
2364
3010
|
*/
|
|
2365
3011
|
declare function waitForLayout(container: HTMLElement): Promise<void>;
|
|
2366
3012
|
|
|
3013
|
+
/**
|
|
3014
|
+
* In-memory publish/subscribe bus of one terminal. Handlers run
|
|
3015
|
+
* synchronously in subscription order; a throwing handler is reported to
|
|
3016
|
+
* `onHandlerError` and does not stop delivery. Keeps the last
|
|
3017
|
+
* {@link CLI_EVENT_HISTORY_SIZE} events; nothing is persisted.
|
|
3018
|
+
*/
|
|
3019
|
+
declare class CliEventBus implements ICliEventBus {
|
|
3020
|
+
private readonly onHandlerError;
|
|
3021
|
+
private readonly historySize;
|
|
3022
|
+
private readonly subject;
|
|
3023
|
+
private readonly recent;
|
|
3024
|
+
private disposed;
|
|
3025
|
+
constructor(onHandlerError?: (error: unknown, event: CliEvent) => void, historySize?: number);
|
|
3026
|
+
emit<K extends CliEventType>(type: K, data: CliEventMap[K], options?: CliEmitOptions): void;
|
|
3027
|
+
emit<T = unknown, K extends string = string>(type: K & CustomEventType<K>, data?: T, options?: CliEmitOptions): void;
|
|
3028
|
+
on<K extends CliEventType>(pattern: K, handler: CliEventHandler<CliEventMap[K]>): () => void;
|
|
3029
|
+
on<T = unknown>(pattern: string, handler: CliEventHandler<T>): () => void;
|
|
3030
|
+
once<K extends CliEventType>(pattern: K, handler: CliEventHandler<CliEventMap[K]>): () => void;
|
|
3031
|
+
once<T = unknown>(pattern: string, handler: CliEventHandler<T>): () => void;
|
|
3032
|
+
events$<K extends CliEventType>(pattern: K): Observable<CliEvent<CliEventMap[K]>>;
|
|
3033
|
+
events$<T = unknown>(pattern?: string): Observable<CliEvent<T>>;
|
|
3034
|
+
history<K extends CliEventType>(pattern: K, limit?: number): CliEvent<CliEventMap[K]>[];
|
|
3035
|
+
history<T = unknown>(pattern?: string, limit?: number): CliEvent<T>[];
|
|
3036
|
+
/** Stop delivering events and complete all observables. */
|
|
3037
|
+
dispose(): void;
|
|
3038
|
+
}
|
|
3039
|
+
|
|
2367
3040
|
/**
|
|
2368
3041
|
* Default implementation of the translation service.
|
|
2369
3042
|
*
|
|
@@ -2388,6 +3061,7 @@ interface InitializeServicesOptions {
|
|
|
2388
3061
|
}
|
|
2389
3062
|
interface InitializeServicesResult {
|
|
2390
3063
|
services: CliServiceContainer;
|
|
3064
|
+
events: CliEventBus;
|
|
2391
3065
|
logger: CliLogger;
|
|
2392
3066
|
commandHistory: CliCommandHistory;
|
|
2393
3067
|
stateStoreManager: CliStateStoreManager;
|
|
@@ -2402,6 +3076,36 @@ interface InitializeServicesResult {
|
|
|
2402
3076
|
*/
|
|
2403
3077
|
declare function initializeServices(options: InitializeServicesOptions): Promise<InitializeServicesResult>;
|
|
2404
3078
|
|
|
3079
|
+
/** Service token holding the name of the framework hosting the CLI. */
|
|
3080
|
+
declare const CLI_FRAMEWORK_SERVICE = "cli-framework";
|
|
3081
|
+
/** What a framework wrapper passes to an engine: shared by components, providers and config contexts. */
|
|
3082
|
+
interface CliHostConfig {
|
|
3083
|
+
modules?: ICliModule[];
|
|
3084
|
+
/** @deprecated Use modules instead. */
|
|
3085
|
+
processors?: ICliCommandProcessor[];
|
|
3086
|
+
options?: CliEngineOptions;
|
|
3087
|
+
/** Extra services registered by token before start. */
|
|
3088
|
+
services?: Record<string, any>;
|
|
3089
|
+
}
|
|
3090
|
+
interface CreateCliEngineConfig extends CliHostConfig {
|
|
3091
|
+
/** Reported by `version`, `debug` and `feedback`, e.g. 'React'. */
|
|
3092
|
+
framework?: string;
|
|
3093
|
+
/** Terminal state to restore on start. */
|
|
3094
|
+
snapshot?: CliEngineSnapshot;
|
|
3095
|
+
}
|
|
3096
|
+
/**
|
|
3097
|
+
* Create an engine for `container` with the services, modules and
|
|
3098
|
+
* processors of a wrapper registered (in that order). Call `start()` on it.
|
|
3099
|
+
*/
|
|
3100
|
+
declare function createCliEngine(container: HTMLElement, config?: CreateCliEngineConfig): CliEngine;
|
|
3101
|
+
/**
|
|
3102
|
+
* Resolve a component's config: each field set locally wins over the one
|
|
3103
|
+
* inherited from a surrounding config provider.
|
|
3104
|
+
*/
|
|
3105
|
+
declare function resolveCliHostConfig(local: CliHostConfig, inherited?: CliHostConfig | null): CliHostConfig;
|
|
3106
|
+
/** Merge option objects key by key: `local` overrides `inherited`. */
|
|
3107
|
+
declare function mergeCliOptions<T extends object>(local: T | undefined, inherited: object | undefined): T | undefined;
|
|
3108
|
+
|
|
2405
3109
|
declare class CliServerConnection {
|
|
2406
3110
|
private readonly _config;
|
|
2407
3111
|
private readonly _backgroundServices?;
|
|
@@ -2425,7 +3129,7 @@ declare class CliServerConnection {
|
|
|
2425
3129
|
private static readonly HEALTH_CHECK_MAX_ATTEMPTS;
|
|
2426
3130
|
onDisconnect?: () => void;
|
|
2427
3131
|
onReconnected?: () => void;
|
|
2428
|
-
constructor(_config: CliServerConfig, _backgroundServices?: ICliBackgroundServiceRegistry
|
|
3132
|
+
constructor(_config: CliServerConfig, _backgroundServices?: ICliBackgroundServiceRegistry, _logger?: ICliLogger, _authService?: ICliServerAuthService);
|
|
2429
3133
|
get config(): CliServerConfig;
|
|
2430
3134
|
get connected(): boolean;
|
|
2431
3135
|
get commands(): CliServerCommandDescriptor[];
|
|
@@ -2454,6 +3158,8 @@ declare class CliServerConnection {
|
|
|
2454
3158
|
exitCode: number;
|
|
2455
3159
|
}>;
|
|
2456
3160
|
ping(): Promise<boolean>;
|
|
3161
|
+
/** Whether the server answers HTTP at all (any status: it is running). */
|
|
3162
|
+
private answers;
|
|
2457
3163
|
private connectEventSocket;
|
|
2458
3164
|
private connectEventSocketDirect;
|
|
2459
3165
|
private connectEventSocketDirectAsync;
|
|
@@ -2495,7 +3201,7 @@ declare class CliServerProxyProcessor implements ICliCommandProcessor {
|
|
|
2495
3201
|
description?: string;
|
|
2496
3202
|
version?: string;
|
|
2497
3203
|
metadata?: CliProcessorMetadata;
|
|
2498
|
-
parameters?: ICliCommandParameterDescriptor[];
|
|
3204
|
+
parameters?: ICliCommandParameterDescriptor$1[];
|
|
2499
3205
|
processors?: ICliCommandProcessor[];
|
|
2500
3206
|
acceptsRawInput?: boolean;
|
|
2501
3207
|
/** Full command path from root to this processor (e.g. ["aws", "lambda", "list"]) */
|
|
@@ -2524,7 +3230,7 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
|
|
|
2524
3230
|
command: string;
|
|
2525
3231
|
description?: string;
|
|
2526
3232
|
metadata?: CliProcessorMetadata;
|
|
2527
|
-
parameters?: ICliCommandParameterDescriptor[];
|
|
3233
|
+
parameters?: ICliCommandParameterDescriptor$1[];
|
|
2528
3234
|
processors?: ICliCommandProcessor[];
|
|
2529
3235
|
acceptsRawInput?: boolean;
|
|
2530
3236
|
/** Full command path from root to this processor */
|
|
@@ -2533,10 +3239,11 @@ declare class CliServerMultiProxyProcessor implements ICliCommandProcessor {
|
|
|
2533
3239
|
processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
2534
3240
|
}
|
|
2535
3241
|
|
|
2536
|
-
declare const CliServerManager_TOKEN
|
|
3242
|
+
declare const CliServerManager_TOKEN: any;
|
|
2537
3243
|
declare class CliServerManager implements DefaultServerProvider {
|
|
2538
3244
|
private readonly registry;
|
|
2539
3245
|
private readonly authService?;
|
|
3246
|
+
private readonly events?;
|
|
2540
3247
|
readonly connections: Map<string, CliServerConnection>;
|
|
2541
3248
|
private _logger?;
|
|
2542
3249
|
private _cliLogger?;
|
|
@@ -2544,7 +3251,7 @@ declare class CliServerManager implements DefaultServerProvider {
|
|
|
2544
3251
|
/** Bare-name aliases this manager registered (only these are ever removed) */
|
|
2545
3252
|
private readonly _bareAliases;
|
|
2546
3253
|
private _backgroundServices?;
|
|
2547
|
-
constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService
|
|
3254
|
+
constructor(registry: ICliCommandProcessorRegistry, authService?: ICliServerAuthService, events?: ICliEventBus);
|
|
2548
3255
|
get defaultServer(): string | null;
|
|
2549
3256
|
preferredServer(): string | null;
|
|
2550
3257
|
setDefaultServer(name: string | null): void;
|
|
@@ -2557,6 +3264,7 @@ declare class CliServerManager implements DefaultServerProvider {
|
|
|
2557
3264
|
commandCount: number;
|
|
2558
3265
|
}>;
|
|
2559
3266
|
getConnection(name: string): CliServerConnection | undefined;
|
|
3267
|
+
private emitConnected;
|
|
2560
3268
|
private handleDisconnect;
|
|
2561
3269
|
private unregisterServerProcessors;
|
|
2562
3270
|
private unregisterBareAliases;
|
|
@@ -2566,25 +3274,37 @@ declare class CliServerManager implements DefaultServerProvider {
|
|
|
2566
3274
|
|
|
2567
3275
|
declare function createServerModule(): ICliModule;
|
|
2568
3276
|
|
|
3277
|
+
/**
|
|
3278
|
+
* `server`: the servers this terminal is connected to (configured by the
|
|
3279
|
+
* app in `options.servers`). Their commands are available directly (`echo`)
|
|
3280
|
+
* and namespaced (`node:echo`).
|
|
3281
|
+
*/
|
|
2569
3282
|
declare class CliServerCommandProcessor implements ICliCommandProcessor {
|
|
2570
3283
|
command: string;
|
|
3284
|
+
aliases: string[];
|
|
2571
3285
|
description: string;
|
|
2572
3286
|
metadata: {
|
|
2573
|
-
icon:
|
|
3287
|
+
icon: any;
|
|
2574
3288
|
module: string;
|
|
2575
3289
|
sealed: boolean;
|
|
2576
3290
|
};
|
|
3291
|
+
stateConfiguration: CliStateConfiguration;
|
|
2577
3292
|
processors: ICliCommandChildProcessor[];
|
|
3293
|
+
/** Restore the default server saved by `server default <name>`. */
|
|
3294
|
+
initialize(context: ICliExecutionContext): Promise<void>;
|
|
3295
|
+
/** `server` alone: the servers, then what can be done with them. */
|
|
2578
3296
|
processCommand(_command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
3297
|
+
writeDescription(context: ICliExecutionContext): void;
|
|
2579
3298
|
}
|
|
2580
3299
|
|
|
2581
3300
|
declare class CliSshCommandProcessor implements ICliCommandProcessor {
|
|
2582
3301
|
command: string;
|
|
3302
|
+
aliases: string[];
|
|
2583
3303
|
description: string;
|
|
2584
3304
|
acceptsRawInput: boolean;
|
|
2585
3305
|
valueRequired: boolean;
|
|
2586
3306
|
metadata: CliProcessorMetadata;
|
|
2587
|
-
parameters?: ICliCommandParameterDescriptor[];
|
|
3307
|
+
parameters?: ICliCommandParameterDescriptor$1[];
|
|
2588
3308
|
processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
|
|
2589
3309
|
/**
|
|
2590
3310
|
* Full-screen handler for one session: input, resize and disposal go to
|
|
@@ -2592,6 +3312,11 @@ declare class CliSshCommandProcessor implements ICliCommandProcessor {
|
|
|
2592
3312
|
*/
|
|
2593
3313
|
private fullScreenHandler;
|
|
2594
3314
|
private resolveServer;
|
|
3315
|
+
/** Why `name` cannot be used: unknown, unreachable or without a shell. */
|
|
3316
|
+
private writeWhyNotAvailable;
|
|
3317
|
+
/** No server has a shell: say whether none is configured, connected or shell-enabled. */
|
|
3318
|
+
private writeNoShellServers;
|
|
3319
|
+
writeDescription(context: ICliExecutionContext): void;
|
|
2595
3320
|
private executeInteractive;
|
|
2596
3321
|
private executeOneShot;
|
|
2597
3322
|
/** `ssh <server> <cmd...>` → `<cmd...>` exactly as typed */
|
|
@@ -2648,7 +3373,10 @@ declare class CliTestHarness {
|
|
|
2648
3373
|
readonly registry: CliCommandProcessorRegistry;
|
|
2649
3374
|
readonly executor: CliCommandExecutor;
|
|
2650
3375
|
readonly services: CliServiceContainer;
|
|
3376
|
+
/** Shared by every command: add a language pack and switch locale to test translations. */
|
|
3377
|
+
readonly translator: CliTranslationService;
|
|
2651
3378
|
private readonly stateStoreManager;
|
|
3379
|
+
private readonly initialized;
|
|
2652
3380
|
private readonly processRegistry;
|
|
2653
3381
|
/** Current user session — set via setUserSession() */
|
|
2654
3382
|
userSession?: ICliUserSession;
|
|
@@ -2667,7 +3395,8 @@ declare class CliTestHarness {
|
|
|
2667
3395
|
registerService(token: any, value: any): void;
|
|
2668
3396
|
/**
|
|
2669
3397
|
* Register a command processor. If the processor has an `initialize()`
|
|
2670
|
-
* method, it
|
|
3398
|
+
* method, it is called (with the processor's own state store, as in the
|
|
3399
|
+
* engine) before the first `execute()`, or by `initializeProcessors()`.
|
|
2671
3400
|
*/
|
|
2672
3401
|
registerProcessor(processor: ICliCommandProcessor): void;
|
|
2673
3402
|
/**
|
|
@@ -2679,6 +3408,8 @@ declare class CliTestHarness {
|
|
|
2679
3408
|
* Call this after registering all services and processors.
|
|
2680
3409
|
*/
|
|
2681
3410
|
initializeProcessors(): Promise<void>;
|
|
3411
|
+
/** As the engine's boot: link sub-commands to their parent, then initialize. */
|
|
3412
|
+
private initializeTree;
|
|
2682
3413
|
/**
|
|
2683
3414
|
* Set the active user session. Commands that check `context.userSession`
|
|
2684
3415
|
* will see this session.
|
|
@@ -2753,4 +3484,511 @@ declare function getAccelerator(): ICliWasmAccelerator;
|
|
|
2753
3484
|
*/
|
|
2754
3485
|
declare function isWasmAccelerated(): boolean;
|
|
2755
3486
|
|
|
2756
|
-
|
|
3487
|
+
/** One terminal inside a tab. */
|
|
3488
|
+
interface CliPanelPane {
|
|
3489
|
+
id: number;
|
|
3490
|
+
widthPercent: number;
|
|
3491
|
+
/** Snapshot to restore when the pane's engine starts (used by "Duplicate"). */
|
|
3492
|
+
snapshot?: CliEngineSnapshot;
|
|
3493
|
+
}
|
|
3494
|
+
/** One tab of the panel: a title and one or more panes side by side. */
|
|
3495
|
+
interface CliPanelTab {
|
|
3496
|
+
id: number;
|
|
3497
|
+
title: string;
|
|
3498
|
+
isEditing: boolean;
|
|
3499
|
+
panes: CliPanelPane[];
|
|
3500
|
+
}
|
|
3501
|
+
interface CliPanelContextMenu {
|
|
3502
|
+
visible: boolean;
|
|
3503
|
+
x: number;
|
|
3504
|
+
y: number;
|
|
3505
|
+
tabId: number;
|
|
3506
|
+
}
|
|
3507
|
+
interface CliPanelServiceDetail {
|
|
3508
|
+
name: string;
|
|
3509
|
+
status: string;
|
|
3510
|
+
description?: string;
|
|
3511
|
+
}
|
|
3512
|
+
interface CliPanelServerDetail {
|
|
3513
|
+
name: string;
|
|
3514
|
+
url: string;
|
|
3515
|
+
connected: boolean;
|
|
3516
|
+
apiVersion?: string;
|
|
3517
|
+
commandCount?: number;
|
|
3518
|
+
}
|
|
3519
|
+
type CliPanelExecutionState = 'idle' | 'running';
|
|
3520
|
+
type CliPanelServerState = 'connected' | 'disconnected' | 'none';
|
|
3521
|
+
/** Status derived from the engines of a single tab. */
|
|
3522
|
+
interface CliPanelTabStatus {
|
|
3523
|
+
executionState: CliPanelExecutionState;
|
|
3524
|
+
lastCommand: {
|
|
3525
|
+
name: string;
|
|
3526
|
+
success: boolean;
|
|
3527
|
+
} | null;
|
|
3528
|
+
notification: CliNotification | null;
|
|
3529
|
+
}
|
|
3530
|
+
/** Status derived from the first engine of the active tab. */
|
|
3531
|
+
interface CliPanelGlobalStatus {
|
|
3532
|
+
serviceCount: {
|
|
3533
|
+
running: number;
|
|
3534
|
+
total: number;
|
|
3535
|
+
};
|
|
3536
|
+
serviceDetails: CliPanelServiceDetail[];
|
|
3537
|
+
serverState: CliPanelServerState;
|
|
3538
|
+
serverDetails: CliPanelServerDetail[];
|
|
3539
|
+
/** Milliseconds since the engine started, 0 when unknown. */
|
|
3540
|
+
uptime: number;
|
|
3541
|
+
}
|
|
3542
|
+
declare const DEFAULT_TAB_STATUS: CliPanelTabStatus;
|
|
3543
|
+
declare const DEFAULT_GLOBAL_STATUS: CliPanelGlobalStatus;
|
|
3544
|
+
/**
|
|
3545
|
+
* Values a host may control from the outside. A defined value wins over the
|
|
3546
|
+
* panel's own state; `undefined` leaves the panel uncontrolled for that field.
|
|
3547
|
+
*/
|
|
3548
|
+
interface CliPanelControlledState {
|
|
3549
|
+
collapsed?: boolean;
|
|
3550
|
+
hidden?: boolean;
|
|
3551
|
+
maximized?: boolean;
|
|
3552
|
+
activeTabId?: number;
|
|
3553
|
+
position?: CliPanelPosition;
|
|
3554
|
+
height?: number;
|
|
3555
|
+
width?: number;
|
|
3556
|
+
}
|
|
3557
|
+
/** Change notifications and structural events, mapped by each framework wrapper. */
|
|
3558
|
+
interface CliPanelCallbacks {
|
|
3559
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
3560
|
+
onHiddenChange?: (hidden: boolean) => void;
|
|
3561
|
+
onMaximizedChange?: (maximized: boolean) => void;
|
|
3562
|
+
onActiveTabIdChange?: (tabId: number) => void;
|
|
3563
|
+
onPositionChange?: (position: CliPanelPosition) => void;
|
|
3564
|
+
onHeightChange?: (height: number) => void;
|
|
3565
|
+
onWidthChange?: (width: number) => void;
|
|
3566
|
+
onClose?: () => void;
|
|
3567
|
+
onTabAdded?: (event: {
|
|
3568
|
+
tabId: number;
|
|
3569
|
+
}) => void;
|
|
3570
|
+
onTabClosed?: (event: {
|
|
3571
|
+
tabId: number;
|
|
3572
|
+
}) => void;
|
|
3573
|
+
onPaneSplit?: (event: {
|
|
3574
|
+
paneId: number;
|
|
3575
|
+
tabId: number;
|
|
3576
|
+
}) => void;
|
|
3577
|
+
onPaneClosed?: (event: {
|
|
3578
|
+
paneId: number;
|
|
3579
|
+
}) => void;
|
|
3580
|
+
}
|
|
3581
|
+
interface CliPanelViewport {
|
|
3582
|
+
width: number;
|
|
3583
|
+
height: number;
|
|
3584
|
+
}
|
|
3585
|
+
interface CliPanelControllerOptions {
|
|
3586
|
+
/** Panel configuration (initial state, chrome buttons, theme sync). */
|
|
3587
|
+
config?: CliPanelConfig;
|
|
3588
|
+
callbacks?: CliPanelCallbacks;
|
|
3589
|
+
controlled?: CliPanelControlledState;
|
|
3590
|
+
/** Viewport size used for maximize and resize clamping. Defaults to `window`. */
|
|
3591
|
+
viewport?: () => CliPanelViewport;
|
|
3592
|
+
/**
|
|
3593
|
+
* Restore and persist the position through localStorage.
|
|
3594
|
+
* @default true
|
|
3595
|
+
*/
|
|
3596
|
+
persistPosition?: boolean;
|
|
3597
|
+
}
|
|
3598
|
+
/**
|
|
3599
|
+
* Immutable view of the whole panel. A new object is produced on every
|
|
3600
|
+
* change, so views can compare by reference.
|
|
3601
|
+
*/
|
|
3602
|
+
interface CliPanelSnapshot {
|
|
3603
|
+
visible: boolean;
|
|
3604
|
+
/** True once the first tab has been created (content rendered). */
|
|
3605
|
+
initialized: boolean;
|
|
3606
|
+
collapsed: boolean;
|
|
3607
|
+
hidden: boolean;
|
|
3608
|
+
maximized: boolean;
|
|
3609
|
+
position: CliPanelPosition;
|
|
3610
|
+
height: number;
|
|
3611
|
+
width: number;
|
|
3612
|
+
isHorizontal: boolean;
|
|
3613
|
+
/** Status text is shown in the header for top/bottom, compact dots otherwise. */
|
|
3614
|
+
showStatusIndicators: boolean;
|
|
3615
|
+
panelResizing: boolean;
|
|
3616
|
+
themeStyles: Record<string, string>;
|
|
3617
|
+
closable: boolean;
|
|
3618
|
+
resizable: boolean;
|
|
3619
|
+
hideable: boolean;
|
|
3620
|
+
hideAlignment: CliPanelHideAlignment;
|
|
3621
|
+
syncTheme: boolean;
|
|
3622
|
+
tabs: readonly CliPanelTab[];
|
|
3623
|
+
activeTabId: number;
|
|
3624
|
+
activePaneId: number;
|
|
3625
|
+
paneResizing: boolean;
|
|
3626
|
+
contextMenu: CliPanelContextMenu;
|
|
3627
|
+
positionDropdownOpen: boolean;
|
|
3628
|
+
servicesDropdownOpen: boolean;
|
|
3629
|
+
servicesDropdownStyle: Record<string, string>;
|
|
3630
|
+
serversDropdownOpen: boolean;
|
|
3631
|
+
serversDropdownStyle: Record<string, string>;
|
|
3632
|
+
/** Status of the active tab. */
|
|
3633
|
+
status: CliPanelTabStatus;
|
|
3634
|
+
tabStatuses: Readonly<Record<number, CliPanelTabStatus>>;
|
|
3635
|
+
global: CliPanelGlobalStatus;
|
|
3636
|
+
formattedUptime: string;
|
|
3637
|
+
}
|
|
3638
|
+
|
|
3639
|
+
declare const MIN_PANE_WIDTH_PERCENT = 10;
|
|
3640
|
+
declare const MIN_PANEL_SIZE = 100;
|
|
3641
|
+
declare const DEFAULT_PANEL_HEIGHT = 600;
|
|
3642
|
+
declare const DEFAULT_PANEL_WIDTH = 400;
|
|
3643
|
+
declare const PANEL_POSITIONS: readonly CliPanelPosition[];
|
|
3644
|
+
/** Scale pane widths so they add up to 100. Returns new pane objects. */
|
|
3645
|
+
declare function normalizePaneWidths(panes: readonly CliPanelPane[]): CliPanelPane[];
|
|
3646
|
+
/** Give every pane the same width. Returns new pane objects. */
|
|
3647
|
+
declare function distributePaneWidths(panes: readonly CliPanelPane[]): CliPanelPane[];
|
|
3648
|
+
/**
|
|
3649
|
+
* Move the divider between pane `dividerIndex` and `dividerIndex + 1` by
|
|
3650
|
+
* `deltaPercent`, keeping both panes at least `MIN_PANE_WIDTH_PERCENT` wide.
|
|
3651
|
+
*/
|
|
3652
|
+
declare function resizePaneWidths(startWidths: readonly number[], dividerIndex: number, deltaPercent: number): number[];
|
|
3653
|
+
/** Clamp a dragged panel size between the minimum and the viewport. */
|
|
3654
|
+
declare function clampPanelSize(size: number, max: number): number;
|
|
3655
|
+
/**
|
|
3656
|
+
* New panel size for a drag that started at `start` and moved by
|
|
3657
|
+
* (`deltaX`, `deltaY`). Only the axis matching the position matters.
|
|
3658
|
+
*/
|
|
3659
|
+
declare function resizedPanelSize(position: CliPanelPosition, start: {
|
|
3660
|
+
width: number;
|
|
3661
|
+
height: number;
|
|
3662
|
+
}, deltaX: number, deltaY: number, viewport: CliPanelViewport): {
|
|
3663
|
+
width?: number;
|
|
3664
|
+
height?: number;
|
|
3665
|
+
};
|
|
3666
|
+
interface AnchorRect {
|
|
3667
|
+
top: number;
|
|
3668
|
+
bottom: number;
|
|
3669
|
+
left: number;
|
|
3670
|
+
right: number;
|
|
3671
|
+
}
|
|
3672
|
+
/**
|
|
3673
|
+
* Fixed-position style for a dropdown opened from `anchor`, placed on the
|
|
3674
|
+
* side of the panel that faces the page.
|
|
3675
|
+
*/
|
|
3676
|
+
declare function dropdownAnchorStyle(anchor: AnchorRect, position: CliPanelPosition, viewport: CliPanelViewport): Record<string, string>;
|
|
3677
|
+
/** "12m", "1h05m"-style uptime label. */
|
|
3678
|
+
declare function formatUptime(ms: number): string;
|
|
3679
|
+
declare function isHorizontalPosition(position: CliPanelPosition): boolean;
|
|
3680
|
+
|
|
3681
|
+
/** Poll interval for execution state, last command and notifications. */
|
|
3682
|
+
declare const EXEC_POLL_MS = 300;
|
|
3683
|
+
/** Poll interval for services, servers and uptime. */
|
|
3684
|
+
declare const GLOBAL_POLL_MS = 2000;
|
|
3685
|
+
/** Status of a tab from all of its pane engines. */
|
|
3686
|
+
declare function computeTabStatus(engines: Iterable<CliEngine>): CliPanelTabStatus;
|
|
3687
|
+
/** Services, servers and uptime of one engine. */
|
|
3688
|
+
declare function computeGlobalStatus(engine: CliEngine | undefined, now?: number): CliPanelGlobalStatus;
|
|
3689
|
+
interface CliPanelStatusTrackerListener {
|
|
3690
|
+
onTabStatus(tabId: number, status: CliPanelTabStatus): void;
|
|
3691
|
+
onGlobalStatus(status: CliPanelGlobalStatus): void;
|
|
3692
|
+
}
|
|
3693
|
+
/**
|
|
3694
|
+
* Watches the engines of every tab and reports status changes. Execution
|
|
3695
|
+
* state is polled quickly, services and servers slowly; engine events
|
|
3696
|
+
* (notifier, background services) trigger an immediate refresh.
|
|
3697
|
+
*/
|
|
3698
|
+
declare class CliPanelStatusTracker {
|
|
3699
|
+
private readonly listener;
|
|
3700
|
+
private tabs;
|
|
3701
|
+
private activeTabId?;
|
|
3702
|
+
private globalStatus;
|
|
3703
|
+
private execTimer?;
|
|
3704
|
+
private globalTimer?;
|
|
3705
|
+
constructor(listener: CliPanelStatusTrackerListener);
|
|
3706
|
+
registerEngine(tabId: number, paneId: number, engine: CliEngine): void;
|
|
3707
|
+
unregisterPane(paneId: number): void;
|
|
3708
|
+
unregisterTab(tabId: number): void;
|
|
3709
|
+
setActiveTab(tabId: number): void;
|
|
3710
|
+
/** Recompute everything now. */
|
|
3711
|
+
refresh(): void;
|
|
3712
|
+
destroy(): void;
|
|
3713
|
+
private ensurePolling;
|
|
3714
|
+
private stopPolling;
|
|
3715
|
+
private refreshTab;
|
|
3716
|
+
private refreshGlobal;
|
|
3717
|
+
}
|
|
3718
|
+
|
|
3719
|
+
/**
|
|
3720
|
+
* Framework-agnostic state and behaviour of the collapsible CLI panel:
|
|
3721
|
+
* tabs and panes, chrome (collapse, hide, maximize, position, size),
|
|
3722
|
+
* menus, drag resizing, theme sync and the status bar.
|
|
3723
|
+
*
|
|
3724
|
+
* Views subscribe with {@link subscribe} and render {@link getSnapshot};
|
|
3725
|
+
* every change produces a new immutable snapshot. Hosts may control any of
|
|
3726
|
+
* the bindable values through {@link setControlled}; the matching
|
|
3727
|
+
* `onXChange` callback is invoked whenever the panel wants to change it.
|
|
3728
|
+
*/
|
|
3729
|
+
declare class CliPanelController implements ICliPanelRef<CliEngine> {
|
|
3730
|
+
callbacks: CliPanelCallbacks;
|
|
3731
|
+
private snapshot;
|
|
3732
|
+
private internal;
|
|
3733
|
+
private controlled;
|
|
3734
|
+
private readonly listeners;
|
|
3735
|
+
private readonly engines;
|
|
3736
|
+
private readonly tracker;
|
|
3737
|
+
private readonly viewport;
|
|
3738
|
+
private readonly persistPosition;
|
|
3739
|
+
private nextTabId;
|
|
3740
|
+
private nextPaneId;
|
|
3741
|
+
private preHideCollapsed;
|
|
3742
|
+
private previousHeight;
|
|
3743
|
+
private previousWidth;
|
|
3744
|
+
private panelDrag?;
|
|
3745
|
+
private paneDrag?;
|
|
3746
|
+
private documentListenersAttached;
|
|
3747
|
+
private rootElement;
|
|
3748
|
+
private themeObserver?;
|
|
3749
|
+
constructor(options?: CliPanelControllerOptions);
|
|
3750
|
+
readonly subscribe: (listener: () => void) => (() => void);
|
|
3751
|
+
readonly getSnapshot: () => CliPanelSnapshot;
|
|
3752
|
+
/** Apply a new panel configuration (chrome buttons, theme sync). */
|
|
3753
|
+
setOptions(config: CliPanelConfig | undefined): void;
|
|
3754
|
+
/** Replace the change callbacks (wrappers call this when their props change). */
|
|
3755
|
+
setCallbacks(callbacks: CliPanelCallbacks): void;
|
|
3756
|
+
/** Update host-controlled values. Unchanged values are ignored. */
|
|
3757
|
+
setControlled(values: CliPanelControlledState): void;
|
|
3758
|
+
/** Element containing the terminals, used for theme sync. */
|
|
3759
|
+
setRootElement(element: ParentNode | null): void;
|
|
3760
|
+
/**
|
|
3761
|
+
* Stop timers, observers and document listeners. Engines are not
|
|
3762
|
+
* destroyed (their views own them). Registering an engine again
|
|
3763
|
+
* restarts status tracking, so a remounted view can reuse the controller.
|
|
3764
|
+
*/
|
|
3765
|
+
destroy(): void;
|
|
3766
|
+
/** Header collapse button: expand (creating the first tab) or collapse. */
|
|
3767
|
+
toggle(): void;
|
|
3768
|
+
open(): void;
|
|
3769
|
+
collapse(): void;
|
|
3770
|
+
toggleCollapse(): void;
|
|
3771
|
+
hide(): void;
|
|
3772
|
+
unhide(): void;
|
|
3773
|
+
toggleHide(): void;
|
|
3774
|
+
close(): void;
|
|
3775
|
+
maximize(): void;
|
|
3776
|
+
restore(): void;
|
|
3777
|
+
toggleMaximize(): void;
|
|
3778
|
+
resize(dimensions: {
|
|
3779
|
+
height?: number;
|
|
3780
|
+
width?: number;
|
|
3781
|
+
}): void;
|
|
3782
|
+
setPosition(position: CliPanelPosition): void;
|
|
3783
|
+
addTab(title?: string): number;
|
|
3784
|
+
closeTab(tabId: number): void;
|
|
3785
|
+
selectTab(tabId: number): void;
|
|
3786
|
+
renameTab(tabId: number, title: string): void;
|
|
3787
|
+
/** Switch a tab's title into inline editing. */
|
|
3788
|
+
startRename(tabId: number): void;
|
|
3789
|
+
/** Finish inline editing; an empty value keeps the old title. */
|
|
3790
|
+
commitRename(tabId: number, value: string): void;
|
|
3791
|
+
cancelRename(): void;
|
|
3792
|
+
/** Open a new tab next to `tabId` with a copy of its first terminal's content. */
|
|
3793
|
+
duplicateTab(tabId: number): number;
|
|
3794
|
+
closeOtherTabs(tabId: number): void;
|
|
3795
|
+
closeTabsToTheRight(tabId: number): void;
|
|
3796
|
+
closeAllTabs(): void;
|
|
3797
|
+
splitPane(tabId?: number): number;
|
|
3798
|
+
closePane(paneId: number): void;
|
|
3799
|
+
/** A pane was clicked: make it (and its tab) active and focus its terminal. */
|
|
3800
|
+
activatePane(tabId: number, paneId: number): void;
|
|
3801
|
+
/** Called by the view once a pane's terminal engine is running. */
|
|
3802
|
+
registerEngine(tabId: number, paneId: number, engine: CliEngine): void;
|
|
3803
|
+
getEngine(paneId?: number): CliEngine | undefined;
|
|
3804
|
+
getState(): CliPanelState;
|
|
3805
|
+
openContextMenu(tabId: number, x: number, y: number): void;
|
|
3806
|
+
closeContextMenu(): void;
|
|
3807
|
+
togglePositionDropdown(): void;
|
|
3808
|
+
/** `anchor` is the clicked status item; the dropdown is placed next to it. */
|
|
3809
|
+
toggleServicesDropdown(anchor?: Element | null): void;
|
|
3810
|
+
toggleServersDropdown(anchor?: Element | null): void;
|
|
3811
|
+
/** Close the context menu and every dropdown. */
|
|
3812
|
+
closeMenus(): void;
|
|
3813
|
+
/** Mouse down on the panel's resize bar. */
|
|
3814
|
+
startPanelResize(clientX: number, clientY: number): void;
|
|
3815
|
+
/** Mouse down on the divider before pane `dividerIndex + 1` of a tab. */
|
|
3816
|
+
startPaneResize(tabId: number, dividerIndex: number, clientX: number, containerWidth: number): void;
|
|
3817
|
+
private readonly onPanelResizeMove;
|
|
3818
|
+
private readonly onPanelResizeEnd;
|
|
3819
|
+
private endPanelResize;
|
|
3820
|
+
private readonly onPaneResizeMove;
|
|
3821
|
+
private readonly onPaneResizeEnd;
|
|
3822
|
+
private endPaneResize;
|
|
3823
|
+
private readonly onDocumentClick;
|
|
3824
|
+
private readonly onDocumentKeydown;
|
|
3825
|
+
private syncDocumentListeners;
|
|
3826
|
+
private detachDocumentListeners;
|
|
3827
|
+
/** Read the first terminal's theme and derive the panel colours from it. */
|
|
3828
|
+
syncThemeFromEngine(): void;
|
|
3829
|
+
/**
|
|
3830
|
+
* Sync now and follow the first terminal's container: the `theme`
|
|
3831
|
+
* command restyles it, which re-derives the panel colours.
|
|
3832
|
+
* Engines are registered after they start, so their theme is set.
|
|
3833
|
+
*/
|
|
3834
|
+
private startThemeSync;
|
|
3835
|
+
private stopThemeSync;
|
|
3836
|
+
private ensureInitialized;
|
|
3837
|
+
private updateCollapsed;
|
|
3838
|
+
private updateHidden;
|
|
3839
|
+
private updateMaximized;
|
|
3840
|
+
private updateHeight;
|
|
3841
|
+
private updateWidth;
|
|
3842
|
+
private updateActiveTabId;
|
|
3843
|
+
private findTab;
|
|
3844
|
+
private patchTab;
|
|
3845
|
+
/** Remove tabs without touching collapsed/initialized state. */
|
|
3846
|
+
private removeTabs;
|
|
3847
|
+
private releaseTab;
|
|
3848
|
+
private releasePane;
|
|
3849
|
+
private focusPane;
|
|
3850
|
+
private anchorStyle;
|
|
3851
|
+
private setTabStatus;
|
|
3852
|
+
private configFields;
|
|
3853
|
+
/** Resolve controlled values and derived fields on top of a snapshot. */
|
|
3854
|
+
private derive;
|
|
3855
|
+
private commit;
|
|
3856
|
+
}
|
|
3857
|
+
|
|
3858
|
+
/**
|
|
3859
|
+
* Geometry of the panel's SVG icons, shared by every framework wrapper.
|
|
3860
|
+
* All icons use a 24x24 view box, `stroke="currentColor"`, round caps and
|
|
3861
|
+
* joins, and no fill unless a shape says otherwise.
|
|
3862
|
+
*/
|
|
3863
|
+
interface SvgShape {
|
|
3864
|
+
tag: 'polyline' | 'line' | 'rect';
|
|
3865
|
+
attrs: Record<string, string>;
|
|
3866
|
+
}
|
|
3867
|
+
interface SvgIcon {
|
|
3868
|
+
size: number;
|
|
3869
|
+
strokeWidth: number;
|
|
3870
|
+
shapes: SvgShape[];
|
|
3871
|
+
}
|
|
3872
|
+
declare const SVG_VIEW_BOX = "0 0 24 24";
|
|
3873
|
+
declare const SVG_COMMON_ATTRS: Record<string, string>;
|
|
3874
|
+
declare const TERMINAL_ICON: SvgIcon;
|
|
3875
|
+
declare const HIDE_TAB_TERMINAL_ICON: SvgIcon;
|
|
3876
|
+
declare const MAXIMIZE_ICON: SvgIcon;
|
|
3877
|
+
declare const RESTORE_ICON: SvgIcon;
|
|
3878
|
+
declare const CLOSE_ICON: SvgIcon;
|
|
3879
|
+
declare const HIDE_ICON: SvgIcon;
|
|
3880
|
+
/** Chevron that points where the panel body will go when the collapse button is pressed. */
|
|
3881
|
+
declare function collapseChevronIcon(position: CliPanelPosition, collapsed: boolean): SvgIcon;
|
|
3882
|
+
/** Chevron on the small "show CLI" tab, pointing into the page. */
|
|
3883
|
+
declare function hideTabChevronIcon(position: CliPanelPosition): SvgIcon;
|
|
3884
|
+
/** Square with a filled bar on the side the panel is docked to. */
|
|
3885
|
+
declare function positionIcon(position: CliPanelPosition, size?: number): SvgIcon;
|
|
3886
|
+
/** Attributes for the `<svg>` element of an icon. */
|
|
3887
|
+
declare function svgAttrs(icon: SvgIcon): Record<string, string>;
|
|
3888
|
+
|
|
3889
|
+
/**
|
|
3890
|
+
* View helpers shared by the React, Vue and Angular panels: class names,
|
|
3891
|
+
* inline styles, labels and the lists the header and menus are built from.
|
|
3892
|
+
*/
|
|
3893
|
+
declare const PANEL_LABELS: {
|
|
3894
|
+
readonly title: "CLI";
|
|
3895
|
+
readonly showCli: "Show CLI";
|
|
3896
|
+
readonly movePanel: "Move panel";
|
|
3897
|
+
readonly hide: "Hide";
|
|
3898
|
+
readonly maximize: "Maximize";
|
|
3899
|
+
readonly restore: "Restore";
|
|
3900
|
+
readonly expand: "Expand";
|
|
3901
|
+
readonly collapse: "Collapse";
|
|
3902
|
+
readonly close: "Close";
|
|
3903
|
+
readonly newTerminal: "New terminal";
|
|
3904
|
+
readonly closeTab: "Close tab";
|
|
3905
|
+
readonly closePane: "Close pane";
|
|
3906
|
+
readonly servicesHeader: "Background Services";
|
|
3907
|
+
readonly servicesEmpty: "No services registered";
|
|
3908
|
+
readonly serversHeader: "Server Connections";
|
|
3909
|
+
readonly serversEmpty: "No servers configured";
|
|
3910
|
+
};
|
|
3911
|
+
declare const SERVICES_ICON = "\u2699";
|
|
3912
|
+
declare const UPTIME_ICON = "\u2191";
|
|
3913
|
+
declare const SUCCESS_ICON = "\u2713";
|
|
3914
|
+
declare const ERROR_ICON = "\u2717";
|
|
3915
|
+
declare const CLOSE_GLYPH = "\u00D7";
|
|
3916
|
+
declare function capitalize(value: string): string;
|
|
3917
|
+
declare function joinClasses(...classes: Array<string | false | null | undefined>): string;
|
|
3918
|
+
declare function panelWrapperClass(s: CliPanelSnapshot, extra?: string): string;
|
|
3919
|
+
declare function panelTabClass(s: CliPanelSnapshot, tab: CliPanelTab): string;
|
|
3920
|
+
/** Activity dot of a tab: running, last command failed, or idle. */
|
|
3921
|
+
declare function tabDotClass(status: CliPanelTabStatus | undefined): string;
|
|
3922
|
+
declare function panelTabDotClass(s: CliPanelSnapshot, tab: CliPanelTab): string;
|
|
3923
|
+
declare function panesContainerClass(s: CliPanelSnapshot): string;
|
|
3924
|
+
declare function paneClass(s: CliPanelSnapshot, tabId: number, paneId: number): string;
|
|
3925
|
+
declare function glowLineClass(s: CliPanelSnapshot): string;
|
|
3926
|
+
declare function positionDropdownItemClass(s: CliPanelSnapshot, position: CliPanelPosition): string;
|
|
3927
|
+
/** Size, visibility and theme variables of the panel wrapper. */
|
|
3928
|
+
declare function panelWrapperStyle(s: CliPanelSnapshot): Record<string, string>;
|
|
3929
|
+
declare function paneStyle(widthPercent: number): Record<string, string>;
|
|
3930
|
+
declare function contextMenuStyle(s: CliPanelSnapshot): Record<string, string>;
|
|
3931
|
+
interface PanelStatusIndicator {
|
|
3932
|
+
key: 'execution' | 'services' | 'lastCommand' | 'servers' | 'uptime' | 'notification';
|
|
3933
|
+
/** Extra classes on the full item (top/bottom positions). */
|
|
3934
|
+
itemClass: string;
|
|
3935
|
+
/** Extra classes on the compact item (left/right positions). */
|
|
3936
|
+
compactClass: string;
|
|
3937
|
+
/** Class of the leading dot, when the indicator shows a dot. */
|
|
3938
|
+
dotClass?: string;
|
|
3939
|
+
/** Glyph shown before the label, when the indicator shows an icon. */
|
|
3940
|
+
icon?: string;
|
|
3941
|
+
iconClass?: string;
|
|
3942
|
+
label: string;
|
|
3943
|
+
/** Tooltip of the compact variant. */
|
|
3944
|
+
title: string;
|
|
3945
|
+
/** Compact variant shows only this dot (notifications). */
|
|
3946
|
+
compactDotClass?: string;
|
|
3947
|
+
/** Which dropdown a click opens. */
|
|
3948
|
+
dropdown?: 'services' | 'servers';
|
|
3949
|
+
}
|
|
3950
|
+
/** Items of the header status bar, in display order. */
|
|
3951
|
+
declare function statusIndicators(s: CliPanelSnapshot): PanelStatusIndicator[];
|
|
3952
|
+
interface PanelPositionOption {
|
|
3953
|
+
position: CliPanelPosition;
|
|
3954
|
+
label: string;
|
|
3955
|
+
className: string;
|
|
3956
|
+
}
|
|
3957
|
+
declare function positionOptions(s: CliPanelSnapshot): PanelPositionOption[];
|
|
3958
|
+
type PanelContextMenuAction = 'rename' | 'duplicate' | 'split-right' | 'close' | 'close-others' | 'close-right' | 'close-all';
|
|
3959
|
+
interface PanelContextMenuItem {
|
|
3960
|
+
action: PanelContextMenuAction;
|
|
3961
|
+
label: string;
|
|
3962
|
+
disabled: boolean;
|
|
3963
|
+
destructive: boolean;
|
|
3964
|
+
/** Draw a separator above this item. */
|
|
3965
|
+
separatorBefore: boolean;
|
|
3966
|
+
}
|
|
3967
|
+
declare function contextMenuItems(s: CliPanelSnapshot): PanelContextMenuItem[];
|
|
3968
|
+
/** Run a context-menu action against the tab the menu was opened for. */
|
|
3969
|
+
declare function runContextMenuAction(controller: CliPanelController, action: PanelContextMenuAction): void;
|
|
3970
|
+
/** Enter commits, Escape cancels an inline tab rename. */
|
|
3971
|
+
declare function handleRenameKey(controller: CliPanelController, tabId: number, key: string, value: string): void;
|
|
3972
|
+
/** Width of the panes container the divider belongs to, for drag math. */
|
|
3973
|
+
declare function panesContainerWidth(target: EventTarget | null): number;
|
|
3974
|
+
interface PanelDropdownRow {
|
|
3975
|
+
key: string;
|
|
3976
|
+
dotClass: string;
|
|
3977
|
+
name: string;
|
|
3978
|
+
description?: string;
|
|
3979
|
+
status: string;
|
|
3980
|
+
/** Extra lines under the status (servers: API version, command count). */
|
|
3981
|
+
meta: string[];
|
|
3982
|
+
}
|
|
3983
|
+
interface PanelStatusDropdown {
|
|
3984
|
+
kind: 'services' | 'servers';
|
|
3985
|
+
header: string;
|
|
3986
|
+
emptyText: string;
|
|
3987
|
+
style: Record<string, string>;
|
|
3988
|
+
rows: PanelDropdownRow[];
|
|
3989
|
+
}
|
|
3990
|
+
/** The open services or servers dropdown, or null when neither is open. */
|
|
3991
|
+
declare function openStatusDropdown(s: CliPanelSnapshot): PanelStatusDropdown | null;
|
|
3992
|
+
|
|
3993
|
+
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 };
|
|
3994
|
+
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 };
|