@qodalis/cli 2.4.0 → 2.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/public-api.mjs CHANGED
@@ -518,7 +518,7 @@ var CliKeyValueStore_TOKEN = createCliToken("cli-key-value-store");
518
518
  var SyntaxHighlighterRegistry_TOKEN = createCliToken("syntax-highlighter-registry");
519
519
 
520
520
  // src/lib/version.ts
521
- var LIBRARY_VERSION = "2.4.0";
521
+ var LIBRARY_VERSION = "2.4.1";
522
522
  var API_VERSION = 2;
523
523
  var ANONYMOUS = "\0anonymous";
524
524
  function aliasOwner(context2) {
@@ -14842,6 +14842,7 @@ var CliTerminalSpinner = class {
14842
14842
  }, 80);
14843
14843
  }
14844
14844
  hide() {
14845
+ if (!this.isRunning) return;
14845
14846
  this.isRunning = false;
14846
14847
  if (this.spinnerInterval) {
14847
14848
  clearInterval(this.spinnerInterval);
@@ -20204,8 +20205,8 @@ var CliBootLog = class {
20204
20205
  if (this.problems.length > 0) {
20205
20206
  this.terminal.write("\r\n");
20206
20207
  }
20207
- if (this.captured.length > 0) {
20208
- const output2 = this.captured.join("").replace(/(?:\s|\x1b\[[0-9;?]*[A-Za-z])+$/, "");
20208
+ const output2 = this.captured.join("").replace(/(?:\s|\x1b\[[0-9;?]*[A-Za-z])+$/, "");
20209
+ if (output2) {
20209
20210
  this.terminal.write(output2 + RESET4 + "\r\n\r\n");
20210
20211
  }
20211
20212
  }
@@ -23941,6 +23942,7 @@ function computeGlobalStatus(engine, now = Date.now()) {
23941
23942
  total: services.length
23942
23943
  };
23943
23944
  serviceDetails = services.map((s) => ({
23945
+ pid: s.pid,
23944
23946
  name: s.name,
23945
23947
  status: s.status,
23946
23948
  description: s.description
@@ -23987,6 +23989,15 @@ function computeGlobalStatus(engine, now = Date.now()) {
23987
23989
  const uptime = engine.startedAt ? now - engine.startedAt : 0;
23988
23990
  return { serviceCount, serviceDetails, serverState, serverDetails, uptime };
23989
23991
  }
23992
+ function killProcess(engine, pid) {
23993
+ const context2 = engine?.getContext();
23994
+ let registry;
23995
+ try {
23996
+ registry = context2?.services?.get?.(CliProcessRegistry_TOKEN);
23997
+ } catch {
23998
+ }
23999
+ return registry?.kill(pid) ?? false;
24000
+ }
23990
24001
  var CliPanelStatusTracker = class {
23991
24002
  constructor(listener) {
23992
24003
  this.listener = listener;
@@ -24051,6 +24062,11 @@ var CliPanelStatusTracker = class {
24051
24062
  this.activeTabId = tabId;
24052
24063
  this.refreshGlobal();
24053
24064
  }
24065
+ /** The engine the global status (services, servers) is computed from: the first pane of the active tab. */
24066
+ get globalEngine() {
24067
+ const entry = this.activeTabId != null ? this.tabs.get(this.activeTabId) : void 0;
24068
+ return entry?.engines.values().next().value;
24069
+ }
24054
24070
  /** Recompute everything now. */
24055
24071
  refresh() {
24056
24072
  for (const tabId of this.tabs.keys()) this.refreshTab(tabId);
@@ -24087,9 +24103,7 @@ var CliPanelStatusTracker = class {
24087
24103
  this.listener.onTabStatus(tabId, next);
24088
24104
  }
24089
24105
  refreshGlobal() {
24090
- const entry = this.activeTabId != null ? this.tabs.get(this.activeTabId) : void 0;
24091
- const engine = entry?.engines.values().next().value;
24092
- const next = computeGlobalStatus(engine);
24106
+ const next = computeGlobalStatus(this.globalEngine);
24093
24107
  if (sameJson(next, this.globalStatus)) return;
24094
24108
  this.globalStatus = next;
24095
24109
  this.listener.onGlobalStatus(next);
@@ -24571,6 +24585,16 @@ var CliPanelController = class {
24571
24585
  serversDropdownOpen: false
24572
24586
  });
24573
24587
  }
24588
+ /**
24589
+ * Stop a running background service listed in the services dropdown, as
24590
+ * `kill <pid>` does; the list refreshes. False when nothing was running
24591
+ * under that pid.
24592
+ */
24593
+ killProcess(pid) {
24594
+ const killed = killProcess(this.tracker.globalEngine, pid);
24595
+ if (killed) this.tracker.refresh();
24596
+ return killed;
24597
+ }
24574
24598
  /** `anchor` is the clicked status item; the dropdown is placed next to it. */
24575
24599
  toggleServicesDropdown(anchor) {
24576
24600
  const open = !this.snapshot.servicesDropdownOpen;
@@ -24999,6 +25023,7 @@ var PANEL_LABELS = {
24999
25023
  closePane: "Close pane",
25000
25024
  servicesHeader: "Background Services",
25001
25025
  servicesEmpty: "No services registered",
25026
+ stopService: "Stop",
25002
25027
  serversHeader: "Server Connections",
25003
25028
  serversEmpty: "No servers configured"
25004
25029
  };
@@ -25179,7 +25204,8 @@ function openStatusDropdown(s) {
25179
25204
  name: svc.name,
25180
25205
  description: svc.description,
25181
25206
  status: svc.status,
25182
- meta: []
25207
+ meta: [],
25208
+ stop: svc.status === "running" && svc.pid !== void 0 ? { pid: svc.pid, label: PANEL_LABELS.stopService, title: `${PANEL_LABELS.stopService} ${svc.name} (kill ${svc.pid})` } : void 0
25183
25209
  }))
25184
25210
  };
25185
25211
  }
@@ -25202,6 +25228,6 @@ function openStatusDropdown(s) {
25202
25228
  return null;
25203
25229
  }
25204
25230
 
25205
- export { API_VERSION, CLI_ENV_GLOBAL_PERMISSION, CLI_FRAMEWORK_SERVICE, CLOSE_GLYPH, CLOSE_ICON, 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_CLI_NAME, 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, formatUptime2 as formatUptime, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, glowLineClass, greetingModule, groupBy, handleRenameKey, helpGlobalParameter, hideTabChevronIcon, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isHorizontalPosition, isWasmAccelerated, joinClasses, matchGlob, mergeCliOptions, miscProcessors, nextRowsCommand, normalizePaneWidths, openLink, openStatusDropdown, paneClass, paneStyle, panelBranding, panelTabClass, panelTabDotClass, panelWrapperClass, panelWrapperStyle, panesContainerClass, panesContainerWidth, parseAssignments, parseScript, positionDropdownItemClass, positionIcon, positionOptions, reconcileArgs, renderServerResponse, renderSingleOutput, resizePaneWidths, resizedPanelSize, resolveCliBranding, resolveCliHostConfig, runContextMenuAction, runScript, splitWords, statusIndicators, substituteCommands, substituteVars, svgAttrs, systemProcessors, tabDotClass, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
25231
+ export { API_VERSION, CLI_ENV_GLOBAL_PERMISSION, CLI_FRAMEWORK_SERVICE, CLOSE_GLYPH, CLOSE_ICON, 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_CLI_NAME, 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, formatUptime2 as formatUptime, getAccelerator, getCliNameArt, getGreetingBasedOnTime, getTerminalOptions, glowLineClass, greetingModule, groupBy, handleRenameKey, helpGlobalParameter, hideTabChevronIcon, hotkeysInfo, initWasmAccelerator, initializeServices, initializeTerminal, isHorizontalPosition, isWasmAccelerated, joinClasses, killProcess, matchGlob, mergeCliOptions, miscProcessors, nextRowsCommand, normalizePaneWidths, openLink, openStatusDropdown, paneClass, paneStyle, panelBranding, panelTabClass, panelTabDotClass, panelWrapperClass, panelWrapperStyle, panesContainerClass, panesContainerWidth, parseAssignments, parseScript, positionDropdownItemClass, positionIcon, positionOptions, reconcileArgs, renderServerResponse, renderSingleOutput, resizePaneWidths, resizedPanelSize, resolveCliBranding, resolveCliHostConfig, runContextMenuAction, runScript, splitWords, statusIndicators, substituteCommands, substituteVars, svgAttrs, systemProcessors, tabDotClass, themeInfos, themes, tryExecuteScript, versionGlobalParameter, waitForLayout, welcomeModule, writeOutputToFile, writeStderrToFile };
25206
25232
  //# sourceMappingURL=public-api.mjs.map
25207
25233
  //# sourceMappingURL=public-api.mjs.map