@qodalis/cli 2.0.0-beta.15 → 2.0.0-beta.17

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.
@@ -658,6 +658,18 @@
658
658
  letter-spacing: 0.03em;
659
659
  }
660
660
 
661
+ /* Phones: icon only, so the tab covers as little of the page as possible */
662
+ @media (max-width: 600px) {
663
+ .cli-panel-hide-tab {
664
+ padding: 6px 8px;
665
+ }
666
+
667
+ .cli-panel-hide-tab .cli-panel-hide-tab-label,
668
+ .cli-panel-hide-tab .cli-panel-hide-tab-arrow {
669
+ display: none;
670
+ }
671
+ }
672
+
661
673
  /* Arrow pulse on hover */
662
674
  @keyframes cli-hide-tab-pulse {
663
675
  0%, 100% { transform: translateX(0); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qodalis/cli",
3
- "version": "2.0.0-beta.15",
3
+ "version": "2.0.0-beta.17",
4
4
  "description": "Framework-agnostic CLI engine for @qodalis terminal applications.",
5
5
  "author": "Nicolae Lupei, Qodalis Solutions",
6
6
  "license": "MIT",
@@ -30,7 +30,7 @@
30
30
  "./assets/*": "./assets/*"
31
31
  },
32
32
  "dependencies": {
33
- "@qodalis/cli-core": "2.0.0-beta.15",
33
+ "@qodalis/cli-core": "2.0.0-beta.17",
34
34
  "@xterm/xterm": "^5.5.0",
35
35
  "@xterm/addon-fit": "^0.10.0",
36
36
  "@xterm/addon-web-links": "^0.11.0",
package/public-api.d.mts CHANGED
@@ -153,7 +153,7 @@ declare const CliKeyValueStore_TOKEN = "cli-key-value-store";
153
153
  */
154
154
  declare const SyntaxHighlighterRegistry_TOKEN = "syntax-highlighter-registry";
155
155
 
156
- declare const LIBRARY_VERSION = "2.0.0-beta.15";
156
+ declare const LIBRARY_VERSION = "2.0.0-beta.17";
157
157
  declare const API_VERSION = 2;
158
158
 
159
159
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -782,6 +782,10 @@ declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
782
782
  private setConfigValue;
783
783
  private getConfigValue;
784
784
  private getAllOptions;
785
+ /**
786
+ * @param onBoot at startup, terminal options still at their default are skipped so the
787
+ * host's `terminalOptions` (e.g. its own fontSize) are not overridden.
788
+ */
785
789
  private applySystemSettings;
786
790
  private buildListProcessor;
787
791
  private buildGetProcessor;
@@ -816,12 +820,19 @@ declare class CliPingCommandProcessor implements ICliCommandProcessor {
816
820
  private sleep;
817
821
  }
818
822
 
823
+ /** Parse `A=1 B="two words" C` into assignments; bare names have no value. */
824
+ declare function parseAssignments(raw: string): {
825
+ name: string;
826
+ value?: string;
827
+ }[] | null;
819
828
  /**
820
829
  * `export` — set environment variables.
821
830
  *
822
831
  * Usage:
823
832
  * export VAR=value
824
- * export VAR="value with spaces"
833
+ * export VAR="value with spaces" OTHER=1
834
+ *
835
+ * Changes are saved per user and restored on the next visit.
825
836
  */
826
837
  declare class CliExportCommandProcessor implements ICliCommandProcessor {
827
838
  command: string;
@@ -832,6 +843,9 @@ declare class CliExportCommandProcessor implements ICliCommandProcessor {
832
843
  icon: string;
833
844
  module: string;
834
845
  };
846
+ stateConfiguration: CliStateConfiguration;
847
+ /** Restore saved variables and save every later change (export, unset, VAR=value). */
848
+ initialize(context: ICliExecutionContext): Promise<void>;
835
849
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
836
850
  writeDescription(context: ICliExecutionContext): void;
837
851
  }
@@ -875,9 +889,13 @@ declare class CliFontSizeCommandProcessor implements ICliCommandProcessor {
875
889
  metadata: CliProcessorMetadata;
876
890
  stateConfiguration: CliStateConfiguration;
877
891
  processors: ICliCommandProcessor[];
892
+ /** The size the host configured (or the built-in default), restored by `font-size reset`. */
893
+ private hostFontSize?;
878
894
  initialize(context: ICliExecutionContext): Promise<void>;
879
895
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
880
896
  private getCurrent;
897
+ private getDefault;
898
+ private resetFontSize;
881
899
  private setFontSize;
882
900
  }
883
901
 
@@ -1403,6 +1421,8 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
1403
1421
  protected readonly registry: ICliCommandProcessorRegistry;
1404
1422
  private commandParser;
1405
1423
  private globalParameters;
1424
+ /** Exit status of the last command, expanded as `$?` (0 = success). */
1425
+ private lastExitCode;
1406
1426
  constructor(registry: ICliCommandProcessorRegistry);
1407
1427
  registerGlobalParameter(handler: ICliGlobalParameterHandler): void;
1408
1428
  getGlobalParameters(): ICliCommandParameterDescriptor[];
@@ -1564,10 +1584,11 @@ declare function tryExecuteScript(filePath: string, context: ICliExecutionHost,
1564
1584
  */
1565
1585
  declare function substituteVars(input: string, variables: Record<string, string>): string;
1566
1586
  /**
1567
- * Expand $VAR and ${VAR} references using the global environment store.
1568
- * Variables inside single-quoted strings are NOT expanded (like bash).
1587
+ * Expand `$VAR` and `${VAR}` references using the global environment store, `$?`
1588
+ * to the last exit status, and a leading `~` (alone or as `~/…`) to `$HOME`.
1589
+ * Nothing is expanded inside single-quoted strings (like bash).
1569
1590
  */
1570
- declare function expandEnvironmentVars(command: string, context: ICliExecutionContext): string;
1591
+ declare function expandEnvironmentVars(command: string, context: ICliExecutionContext, lastExitCode?: number): string;
1571
1592
 
1572
1593
  /**
1573
1594
  * A simple Map-based service container implementing ICliServiceProvider.
@@ -1712,6 +1733,8 @@ declare class CliTerminalWriter implements ICliTerminalWriter {
1712
1733
  padding?: number;
1713
1734
  }): void;
1714
1735
  writeIndented(text: string, level?: number): void;
1736
+ /** One block per row, header names as keys; used when a table cannot fit the terminal. */
1737
+ private writeRecords;
1715
1738
  writeTable(headers: string[], rows: string[][], options?: CliTableOptions): void;
1716
1739
  }
1717
1740
 
@@ -2025,18 +2048,43 @@ interface ICliEnvironment {
2025
2048
  has(name: string): boolean;
2026
2049
  }
2027
2050
  declare const ICliEnvironment_TOKEN = "cli-environment";
2051
+ /** What one user (or the signed-out session, key '') changed: values set and defaults removed. */
2052
+ interface CliEnvironmentProfile {
2053
+ vars: Record<string, string>;
2054
+ unset: string[];
2055
+ }
2056
+ /** Saved environment: one profile per user name ('' when nobody is signed in). */
2057
+ type CliEnvironmentSnapshot = Record<string, CliEnvironmentProfile>;
2028
2058
  /**
2029
2059
  * Default in-memory implementation.
2030
- * Seeded with some standard variables on construction.
2060
+ *
2061
+ * A variable resolves, in order, from the current user's own changes (`set`/`unset`),
2062
+ * then bound live values (USER, HOME, PWD follow the session and directory), then the
2063
+ * standard variables seeded on construction. Each user has a separate set of changes,
2064
+ * so `su`/`login` switch environments, and `onChange` lets the host save them.
2031
2065
  */
2032
2066
  declare class CliEnvironment implements ICliEnvironment {
2033
- private readonly vars;
2067
+ private readonly defaults;
2068
+ /** Variables computed on read; a user's own value wins over them. */
2069
+ private readonly bound;
2070
+ private readonly profiles;
2071
+ private profileKey;
2072
+ /** Called after every change with the full snapshot (to persist it). */
2073
+ onChange?: (snapshot: CliEnvironmentSnapshot) => void;
2034
2074
  constructor();
2075
+ /** Compute a variable on every read; the seeded value is the fallback while it returns nothing. */
2076
+ bind(name: string, resolver: () => string | null | undefined): void;
2077
+ /** Pick whose changes apply (the signed-in user's name, '' when signed out). */
2078
+ setProfileResolver(resolver: () => string | null | undefined): void;
2079
+ /** Restore saved profiles (replaces the ones in memory). */
2080
+ load(snapshot: CliEnvironmentSnapshot | undefined): void;
2081
+ snapshot(): CliEnvironmentSnapshot;
2035
2082
  get(name: string): string | undefined;
2036
2083
  set(name: string, value: string): void;
2037
2084
  unset(name: string): void;
2038
2085
  getAll(): Record<string, string>;
2039
2086
  has(name: string): boolean;
2087
+ private currentProfile;
2040
2088
  }
2041
2089
 
2042
2090
  declare class CliDragDropService implements ICliDragDropService {
@@ -2295,6 +2343,11 @@ interface TerminalSetupResult {
2295
2343
  dragDropService: CliDragDropService;
2296
2344
  wheelListener: (e: WheelEvent) => void;
2297
2345
  }
2346
+ /**
2347
+ * Default terminal font size: 20px, or 14px on phone-sized viewports so a
2348
+ * line still fits a useful number of columns (about 26 at 20px on a 390px screen).
2349
+ */
2350
+ declare function defaultFontSize(): number;
2298
2351
  /**
2299
2352
  * Merge user-supplied terminal options with sensible defaults.
2300
2353
  */
@@ -2700,4 +2753,4 @@ declare function getAccelerator(): ICliWasmAccelerator;
2700
2753
  */
2701
2754
  declare function isWasmAccelerated(): boolean;
2702
2755
 
2703
- export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, describeShellClose, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
2756
+ export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, type CliEnvironmentProfile, type CliEnvironmentSnapshot, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, defaultFontSize, describeShellClose, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, parseAssignments, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
package/public-api.d.ts CHANGED
@@ -153,7 +153,7 @@ declare const CliKeyValueStore_TOKEN = "cli-key-value-store";
153
153
  */
154
154
  declare const SyntaxHighlighterRegistry_TOKEN = "syntax-highlighter-registry";
155
155
 
156
- declare const LIBRARY_VERSION = "2.0.0-beta.15";
156
+ declare const LIBRARY_VERSION = "2.0.0-beta.17";
157
157
  declare const API_VERSION = 2;
158
158
 
159
159
  declare class CliAliasCommandProcessor implements ICliCommandProcessor {
@@ -782,6 +782,10 @@ declare class CliConfigureCommandProcessor implements ICliCommandProcessor {
782
782
  private setConfigValue;
783
783
  private getConfigValue;
784
784
  private getAllOptions;
785
+ /**
786
+ * @param onBoot at startup, terminal options still at their default are skipped so the
787
+ * host's `terminalOptions` (e.g. its own fontSize) are not overridden.
788
+ */
785
789
  private applySystemSettings;
786
790
  private buildListProcessor;
787
791
  private buildGetProcessor;
@@ -816,12 +820,19 @@ declare class CliPingCommandProcessor implements ICliCommandProcessor {
816
820
  private sleep;
817
821
  }
818
822
 
823
+ /** Parse `A=1 B="two words" C` into assignments; bare names have no value. */
824
+ declare function parseAssignments(raw: string): {
825
+ name: string;
826
+ value?: string;
827
+ }[] | null;
819
828
  /**
820
829
  * `export` — set environment variables.
821
830
  *
822
831
  * Usage:
823
832
  * export VAR=value
824
- * export VAR="value with spaces"
833
+ * export VAR="value with spaces" OTHER=1
834
+ *
835
+ * Changes are saved per user and restored on the next visit.
825
836
  */
826
837
  declare class CliExportCommandProcessor implements ICliCommandProcessor {
827
838
  command: string;
@@ -832,6 +843,9 @@ declare class CliExportCommandProcessor implements ICliCommandProcessor {
832
843
  icon: string;
833
844
  module: string;
834
845
  };
846
+ stateConfiguration: CliStateConfiguration;
847
+ /** Restore saved variables and save every later change (export, unset, VAR=value). */
848
+ initialize(context: ICliExecutionContext): Promise<void>;
835
849
  processCommand(command: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
836
850
  writeDescription(context: ICliExecutionContext): void;
837
851
  }
@@ -875,9 +889,13 @@ declare class CliFontSizeCommandProcessor implements ICliCommandProcessor {
875
889
  metadata: CliProcessorMetadata;
876
890
  stateConfiguration: CliStateConfiguration;
877
891
  processors: ICliCommandProcessor[];
892
+ /** The size the host configured (or the built-in default), restored by `font-size reset`. */
893
+ private hostFontSize?;
878
894
  initialize(context: ICliExecutionContext): Promise<void>;
879
895
  processCommand(_: CliProcessCommand, context: ICliExecutionContext): Promise<void>;
880
896
  private getCurrent;
897
+ private getDefault;
898
+ private resetFontSize;
881
899
  private setFontSize;
882
900
  }
883
901
 
@@ -1403,6 +1421,8 @@ declare class CliCommandExecutor implements ICliCommandExecutorService {
1403
1421
  protected readonly registry: ICliCommandProcessorRegistry;
1404
1422
  private commandParser;
1405
1423
  private globalParameters;
1424
+ /** Exit status of the last command, expanded as `$?` (0 = success). */
1425
+ private lastExitCode;
1406
1426
  constructor(registry: ICliCommandProcessorRegistry);
1407
1427
  registerGlobalParameter(handler: ICliGlobalParameterHandler): void;
1408
1428
  getGlobalParameters(): ICliCommandParameterDescriptor[];
@@ -1564,10 +1584,11 @@ declare function tryExecuteScript(filePath: string, context: ICliExecutionHost,
1564
1584
  */
1565
1585
  declare function substituteVars(input: string, variables: Record<string, string>): string;
1566
1586
  /**
1567
- * Expand $VAR and ${VAR} references using the global environment store.
1568
- * Variables inside single-quoted strings are NOT expanded (like bash).
1587
+ * Expand `$VAR` and `${VAR}` references using the global environment store, `$?`
1588
+ * to the last exit status, and a leading `~` (alone or as `~/…`) to `$HOME`.
1589
+ * Nothing is expanded inside single-quoted strings (like bash).
1569
1590
  */
1570
- declare function expandEnvironmentVars(command: string, context: ICliExecutionContext): string;
1591
+ declare function expandEnvironmentVars(command: string, context: ICliExecutionContext, lastExitCode?: number): string;
1571
1592
 
1572
1593
  /**
1573
1594
  * A simple Map-based service container implementing ICliServiceProvider.
@@ -1712,6 +1733,8 @@ declare class CliTerminalWriter implements ICliTerminalWriter {
1712
1733
  padding?: number;
1713
1734
  }): void;
1714
1735
  writeIndented(text: string, level?: number): void;
1736
+ /** One block per row, header names as keys; used when a table cannot fit the terminal. */
1737
+ private writeRecords;
1715
1738
  writeTable(headers: string[], rows: string[][], options?: CliTableOptions): void;
1716
1739
  }
1717
1740
 
@@ -2025,18 +2048,43 @@ interface ICliEnvironment {
2025
2048
  has(name: string): boolean;
2026
2049
  }
2027
2050
  declare const ICliEnvironment_TOKEN = "cli-environment";
2051
+ /** What one user (or the signed-out session, key '') changed: values set and defaults removed. */
2052
+ interface CliEnvironmentProfile {
2053
+ vars: Record<string, string>;
2054
+ unset: string[];
2055
+ }
2056
+ /** Saved environment: one profile per user name ('' when nobody is signed in). */
2057
+ type CliEnvironmentSnapshot = Record<string, CliEnvironmentProfile>;
2028
2058
  /**
2029
2059
  * Default in-memory implementation.
2030
- * Seeded with some standard variables on construction.
2060
+ *
2061
+ * A variable resolves, in order, from the current user's own changes (`set`/`unset`),
2062
+ * then bound live values (USER, HOME, PWD follow the session and directory), then the
2063
+ * standard variables seeded on construction. Each user has a separate set of changes,
2064
+ * so `su`/`login` switch environments, and `onChange` lets the host save them.
2031
2065
  */
2032
2066
  declare class CliEnvironment implements ICliEnvironment {
2033
- private readonly vars;
2067
+ private readonly defaults;
2068
+ /** Variables computed on read; a user's own value wins over them. */
2069
+ private readonly bound;
2070
+ private readonly profiles;
2071
+ private profileKey;
2072
+ /** Called after every change with the full snapshot (to persist it). */
2073
+ onChange?: (snapshot: CliEnvironmentSnapshot) => void;
2034
2074
  constructor();
2075
+ /** Compute a variable on every read; the seeded value is the fallback while it returns nothing. */
2076
+ bind(name: string, resolver: () => string | null | undefined): void;
2077
+ /** Pick whose changes apply (the signed-in user's name, '' when signed out). */
2078
+ setProfileResolver(resolver: () => string | null | undefined): void;
2079
+ /** Restore saved profiles (replaces the ones in memory). */
2080
+ load(snapshot: CliEnvironmentSnapshot | undefined): void;
2081
+ snapshot(): CliEnvironmentSnapshot;
2035
2082
  get(name: string): string | undefined;
2036
2083
  set(name: string, value: string): void;
2037
2084
  unset(name: string): void;
2038
2085
  getAll(): Record<string, string>;
2039
2086
  has(name: string): boolean;
2087
+ private currentProfile;
2040
2088
  }
2041
2089
 
2042
2090
  declare class CliDragDropService implements ICliDragDropService {
@@ -2295,6 +2343,11 @@ interface TerminalSetupResult {
2295
2343
  dragDropService: CliDragDropService;
2296
2344
  wheelListener: (e: WheelEvent) => void;
2297
2345
  }
2346
+ /**
2347
+ * Default terminal font size: 20px, or 14px on phone-sized viewports so a
2348
+ * line still fits a useful number of columns (about 26 at 20px on a 390px screen).
2349
+ */
2350
+ declare function defaultFontSize(): number;
2298
2351
  /**
2299
2352
  * Merge user-supplied terminal options with sensible defaults.
2300
2353
  */
@@ -2700,4 +2753,4 @@ declare function getAccelerator(): ICliWasmAccelerator;
2700
2753
  */
2701
2754
  declare function isWasmAccelerated(): boolean;
2702
2755
 
2703
- export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, describeShellClose, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
2756
+ export { API_VERSION, CLi_Name_Art, CapturingTerminalWriter, type CdnSourceName, CliAliasCommandProcessor, CliArgsParser, CliBackgroundServiceRegistry_TOKEN, CliBoot, CliCalCommandProcessor, CliCaptureCommandProcessor, CliClearCommandProcessor, CliClipboard, CliClipboardCommandProcessor, CliColorCommandProcessor, CliCommandExecutionContext, CliCommandExecutor, CliCommandHistory, CliCommandHistory_TOKEN, CliCommandProcessorRegistry, CliConfigureCommandProcessor, CliConvertCommandProcessor, CliDebugCommandProcessor, CliDefaultPingServerService, CliDiffCommandProcessor, CliDragDropService, CliEchoCommandProcessor, CliEngine, type CliEngineOptions, CliEnvCommandProcessor, CliEnvironment, type CliEnvironmentProfile, type CliEnvironmentSnapshot, CliEvalCommandProcessor, CliExecutionContext, type CliExecutionContextDeps, CliExecutionProcess, CliExportCommandProcessor, CliFeedbackCommandProcessor, CliFontSizeCommandProcessor, CliFullScreenManager, CliHelpCommandProcessor, CliHistoryCommandProcessor, CliHotKeysCommandProcessor, CliHtopCommandProcessor, CliHttpClient, CliInputReader, CliJsonCommandProcessor, CliKeyValueStore, CliKeyValueStore_TOKEN, CliKillCommandProcessor, CliLogger, CliLoremCommandProcessor, CliModuleRegistry_TOKEN, CliNanoCommandProcessor, CliNotifier, CliOpenCommandProcessor, CliPackageManagerService, CliPackageManagerService_TOKEN, CliPackagesCommandProcessor, CliPermissionRegistry, CliPingCommandProcessor, CliProcessRegistry, CliProcessRegistry_TOKEN, CliProcessorsRegistry_TOKEN, CliPsCommandProcessor, CliRandomCommandProcessor, CliScreenCommandProcessor, CliSeqCommandProcessor, CliServerCommandProcessor, CliServerConnection, CliServerManager, CliServerManager_TOKEN, CliServerMultiProxyProcessor, CliServerProxyProcessor, CliServiceContainer, CliServicesCommandProcessor, CliSleepCommandProcessor, CliSnippetCommandProcessor, CliSshCommandProcessor, CliStateStore, CliStateStoreManager, CliStateStoreManager_TOKEN, CliTerminalProgressBar, CliTerminalSpinner, CliTerminalTextAnimator, CliTerminalWriter, CliTestHarness, type CliTestResult, CliThemeCommandProcessor, CliTimeCommandProcessor, CliTimerManager, CliTimestampCommandProcessor, CliUnAliasCommandProcessor, CliUnameCommandProcessor, CliUnsetCommandProcessor, CliUptimeCommandProcessor, CliVersionCommandProcessor, type CliWelcomeMessageConfig, CliYesCommandProcessor, CommandParser, type CommandParserOutput, type CommandPart, type ConfigureState, type DefaultServerProvider, type DiffLine, type DiffType, type ICliEnvironment, ICliEnvironment_TOKEN, type ICliExecutionHost, ICliPingServerService_TOKEN, type ICliStateStoreManager, type ICliWasmAccelerator, type InitializeServicesOptions, type InitializeServicesResult, JsFallbackAccelerator, LIBRARY_VERSION, type MultiProxyEntry, OverlayAddon, type ParsedArg, type ParsedToken, ProcessExitedError, ScriptLoaderService, SyntaxHighlighterRegistry_TOKEN, type TerminalSetupResult, type ThemeState, appendOutputToFile, appendStderrToFile, builtinProcessors, computeDiff, contextGlobalParameter, createServerModule, defaultFontSize, describeShellClose, executeOnServer, expandEnvironmentVars, formatDiff, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, groupBy, helpGlobalParameter, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isWasmAccelerated, miscProcessors, openLink, parseAssignments, reconcileArgs, renderServerResponse, renderSingleOutput, substituteVars, systemProcessors, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };