@robinmordasiewicz/f5xc-xcsh 2.0.21-2601122136 → 2.0.21-2601130605

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/dist/index.js CHANGED
@@ -1372,7 +1372,7 @@ var require_react_development = __commonJS({
1372
1372
  }
1373
1373
  return dispatcher.useContext(Context);
1374
1374
  }
1375
- function useState11(initialState) {
1375
+ function useState14(initialState) {
1376
1376
  var dispatcher = resolveDispatcher();
1377
1377
  return dispatcher.useState(initialState);
1378
1378
  }
@@ -1384,7 +1384,7 @@ var require_react_development = __commonJS({
1384
1384
  var dispatcher = resolveDispatcher();
1385
1385
  return dispatcher.useRef(initialValue);
1386
1386
  }
1387
- function useEffect9(create2, deps) {
1387
+ function useEffect10(create2, deps) {
1388
1388
  var dispatcher = resolveDispatcher();
1389
1389
  return dispatcher.useEffect(create2, deps);
1390
1390
  }
@@ -1396,7 +1396,7 @@ var require_react_development = __commonJS({
1396
1396
  var dispatcher = resolveDispatcher();
1397
1397
  return dispatcher.useLayoutEffect(create2, deps);
1398
1398
  }
1399
- function useCallback8(callback, deps) {
1399
+ function useCallback11(callback, deps) {
1400
1400
  var dispatcher = resolveDispatcher();
1401
1401
  return dispatcher.useCallback(callback, deps);
1402
1402
  }
@@ -2022,14 +2022,14 @@ var require_react_development = __commonJS({
2022
2022
  var thenableResult = result;
2023
2023
  var wasAwaited = false;
2024
2024
  var thenable = {
2025
- then: function(resolve, reject) {
2025
+ then: function(resolve2, reject) {
2026
2026
  wasAwaited = true;
2027
2027
  thenableResult.then(function(returnValue2) {
2028
2028
  popActScope(prevActScopeDepth);
2029
2029
  if (actScopeDepth === 0) {
2030
- recursivelyFlushAsyncActWork(returnValue2, resolve, reject);
2030
+ recursivelyFlushAsyncActWork(returnValue2, resolve2, reject);
2031
2031
  } else {
2032
- resolve(returnValue2);
2032
+ resolve2(returnValue2);
2033
2033
  }
2034
2034
  }, function(error2) {
2035
2035
  popActScope(prevActScopeDepth);
@@ -2059,20 +2059,20 @@ var require_react_development = __commonJS({
2059
2059
  ReactCurrentActQueue.current = null;
2060
2060
  }
2061
2061
  var _thenable = {
2062
- then: function(resolve, reject) {
2062
+ then: function(resolve2, reject) {
2063
2063
  if (ReactCurrentActQueue.current === null) {
2064
2064
  ReactCurrentActQueue.current = [];
2065
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2065
+ recursivelyFlushAsyncActWork(returnValue, resolve2, reject);
2066
2066
  } else {
2067
- resolve(returnValue);
2067
+ resolve2(returnValue);
2068
2068
  }
2069
2069
  }
2070
2070
  };
2071
2071
  return _thenable;
2072
2072
  } else {
2073
2073
  var _thenable2 = {
2074
- then: function(resolve, reject) {
2075
- resolve(returnValue);
2074
+ then: function(resolve2, reject) {
2075
+ resolve2(returnValue);
2076
2076
  }
2077
2077
  };
2078
2078
  return _thenable2;
@@ -2088,7 +2088,7 @@ var require_react_development = __commonJS({
2088
2088
  actScopeDepth = prevActScopeDepth;
2089
2089
  }
2090
2090
  }
2091
- function recursivelyFlushAsyncActWork(returnValue, resolve, reject) {
2091
+ function recursivelyFlushAsyncActWork(returnValue, resolve2, reject) {
2092
2092
  {
2093
2093
  var queue = ReactCurrentActQueue.current;
2094
2094
  if (queue !== null) {
@@ -2097,16 +2097,16 @@ var require_react_development = __commonJS({
2097
2097
  enqueueTask(function() {
2098
2098
  if (queue.length === 0) {
2099
2099
  ReactCurrentActQueue.current = null;
2100
- resolve(returnValue);
2100
+ resolve2(returnValue);
2101
2101
  } else {
2102
- recursivelyFlushAsyncActWork(returnValue, resolve, reject);
2102
+ recursivelyFlushAsyncActWork(returnValue, resolve2, reject);
2103
2103
  }
2104
2104
  });
2105
2105
  } catch (error2) {
2106
2106
  reject(error2);
2107
2107
  }
2108
2108
  } else {
2109
- resolve(returnValue);
2109
+ resolve2(returnValue);
2110
2110
  }
2111
2111
  }
2112
2112
  }
@@ -2163,11 +2163,11 @@ var require_react_development = __commonJS({
2163
2163
  exports.memo = memo;
2164
2164
  exports.startTransition = startTransition;
2165
2165
  exports.unstable_act = act;
2166
- exports.useCallback = useCallback8;
2166
+ exports.useCallback = useCallback11;
2167
2167
  exports.useContext = useContext7;
2168
2168
  exports.useDebugValue = useDebugValue;
2169
2169
  exports.useDeferredValue = useDeferredValue;
2170
- exports.useEffect = useEffect9;
2170
+ exports.useEffect = useEffect10;
2171
2171
  exports.useId = useId;
2172
2172
  exports.useImperativeHandle = useImperativeHandle;
2173
2173
  exports.useInsertionEffect = useInsertionEffect;
@@ -2175,7 +2175,7 @@ var require_react_development = __commonJS({
2175
2175
  exports.useMemo = useMemo3;
2176
2176
  exports.useReducer = useReducer;
2177
2177
  exports.useRef = useRef5;
2178
- exports.useState = useState11;
2178
+ exports.useState = useState14;
2179
2179
  exports.useSyncExternalStore = useSyncExternalStore;
2180
2180
  exports.useTransition = useTransition;
2181
2181
  exports.version = ReactVersion;
@@ -7870,9 +7870,9 @@ var require_react_reconciler_development = __commonJS({
7870
7870
  module.exports = function $$$reconciler($$$hostConfig) {
7871
7871
  var exports2 = {};
7872
7872
  "use strict";
7873
- var React16 = require_react();
7873
+ var React19 = require_react();
7874
7874
  var Scheduler = require_scheduler();
7875
- var ReactSharedInternals = React16.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
7875
+ var ReactSharedInternals = React19.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
7876
7876
  var suppressWarning = false;
7877
7877
  function setSuppressWarning(newSuppressWarning) {
7878
7878
  {
@@ -31830,7 +31830,7 @@ var require_log = __commonJS({
31830
31830
  "node_modules/yaml/dist/log.js"(exports) {
31831
31831
  "use strict";
31832
31832
  var node_process = __require("process");
31833
- function debug(logLevel, ...messages) {
31833
+ function debug2(logLevel, ...messages) {
31834
31834
  if (logLevel === "debug")
31835
31835
  console.log(...messages);
31836
31836
  }
@@ -31842,7 +31842,7 @@ var require_log = __commonJS({
31842
31842
  console.warn(warning);
31843
31843
  }
31844
31844
  }
31845
- exports.debug = debug;
31845
+ exports.debug = debug2;
31846
31846
  exports.warn = warn;
31847
31847
  }
31848
31848
  });
@@ -33257,7 +33257,7 @@ var require_timestamp = __commonJS({
33257
33257
  resolve: (str) => parseSexagesimal(str, false),
33258
33258
  stringify: stringifySexagesimal
33259
33259
  };
33260
- var timestamp = {
33260
+ var timestamp2 = {
33261
33261
  identify: (value) => value instanceof Date,
33262
33262
  default: true,
33263
33263
  tag: "tag:yaml.org,2002:timestamp",
@@ -33266,7 +33266,7 @@ var require_timestamp = __commonJS({
33266
33266
  // assumed to be 00:00:00Z (start of day, UTC).
33267
33267
  test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
33268
33268
  resolve(str) {
33269
- const match = str.match(timestamp.test);
33269
+ const match = str.match(timestamp2.test);
33270
33270
  if (!match)
33271
33271
  throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
33272
33272
  const [, year, month, day, hour, minute, second] = match.map(Number);
@@ -33285,7 +33285,7 @@ var require_timestamp = __commonJS({
33285
33285
  };
33286
33286
  exports.floatTime = floatTime;
33287
33287
  exports.intTime = intTime;
33288
- exports.timestamp = timestamp;
33288
+ exports.timestamp = timestamp2;
33289
33289
  }
33290
33290
  });
33291
33291
 
@@ -33305,7 +33305,7 @@ var require_schema3 = __commonJS({
33305
33305
  var omap = require_omap();
33306
33306
  var pairs = require_pairs();
33307
33307
  var set = require_set();
33308
- var timestamp = require_timestamp();
33308
+ var timestamp2 = require_timestamp();
33309
33309
  var schema = [
33310
33310
  map.map,
33311
33311
  seq.seq,
@@ -33325,9 +33325,9 @@ var require_schema3 = __commonJS({
33325
33325
  omap.omap,
33326
33326
  pairs.pairs,
33327
33327
  set.set,
33328
- timestamp.intTime,
33329
- timestamp.floatTime,
33330
- timestamp.timestamp
33328
+ timestamp2.intTime,
33329
+ timestamp2.floatTime,
33330
+ timestamp2.timestamp
33331
33331
  ];
33332
33332
  exports.schema = schema;
33333
33333
  }
@@ -33352,7 +33352,7 @@ var require_tags = __commonJS({
33352
33352
  var pairs = require_pairs();
33353
33353
  var schema$2 = require_schema3();
33354
33354
  var set = require_set();
33355
- var timestamp = require_timestamp();
33355
+ var timestamp2 = require_timestamp();
33356
33356
  var schemas = /* @__PURE__ */ new Map([
33357
33357
  ["core", schema.schema],
33358
33358
  ["failsafe", [map.map, seq.seq, string.string]],
@@ -33366,11 +33366,11 @@ var require_tags = __commonJS({
33366
33366
  float: float.float,
33367
33367
  floatExp: float.floatExp,
33368
33368
  floatNaN: float.floatNaN,
33369
- floatTime: timestamp.floatTime,
33369
+ floatTime: timestamp2.floatTime,
33370
33370
  int: int.int,
33371
33371
  intHex: int.intHex,
33372
33372
  intOct: int.intOct,
33373
- intTime: timestamp.intTime,
33373
+ intTime: timestamp2.intTime,
33374
33374
  map: map.map,
33375
33375
  merge: merge.merge,
33376
33376
  null: _null.nullTag,
@@ -33378,7 +33378,7 @@ var require_tags = __commonJS({
33378
33378
  pairs: pairs.pairs,
33379
33379
  seq: seq.seq,
33380
33380
  set: set.set,
33381
- timestamp: timestamp.timestamp
33381
+ timestamp: timestamp2.timestamp
33382
33382
  };
33383
33383
  var coreKnownTags = {
33384
33384
  "tag:yaml.org,2002:binary": binary.binary,
@@ -33386,7 +33386,7 @@ var require_tags = __commonJS({
33386
33386
  "tag:yaml.org,2002:omap": omap.omap,
33387
33387
  "tag:yaml.org,2002:pairs": pairs.pairs,
33388
33388
  "tag:yaml.org,2002:set": set.set,
33389
- "tag:yaml.org,2002:timestamp": timestamp.timestamp
33389
+ "tag:yaml.org,2002:timestamp": timestamp2.timestamp
33390
33390
  };
33391
33391
  function getTags(customTags, schemaName, addMergeTag) {
33392
33392
  const schemaTags = schemas.get(schemaName);
@@ -37515,7 +37515,7 @@ var require_react_jsx_runtime_development = __commonJS({
37515
37515
  if (process.env.NODE_ENV !== "production") {
37516
37516
  (function() {
37517
37517
  "use strict";
37518
- var React16 = require_react();
37518
+ var React19 = require_react();
37519
37519
  var REACT_ELEMENT_TYPE = /* @__PURE__ */ Symbol.for("react.element");
37520
37520
  var REACT_PORTAL_TYPE = /* @__PURE__ */ Symbol.for("react.portal");
37521
37521
  var REACT_FRAGMENT_TYPE = /* @__PURE__ */ Symbol.for("react.fragment");
@@ -37541,7 +37541,7 @@ var require_react_jsx_runtime_development = __commonJS({
37541
37541
  }
37542
37542
  return null;
37543
37543
  }
37544
- var ReactSharedInternals = React16.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
37544
+ var ReactSharedInternals = React19.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
37545
37545
  function error(format) {
37546
37546
  {
37547
37547
  {
@@ -38391,11 +38391,11 @@ var require_react_jsx_runtime_development = __commonJS({
38391
38391
  return jsxWithValidation(type, props, key, false);
38392
38392
  }
38393
38393
  }
38394
- var jsx7 = jsxWithValidationDynamic;
38395
- var jsxs6 = jsxWithValidationStatic;
38394
+ var jsx10 = jsxWithValidationDynamic;
38395
+ var jsxs9 = jsxWithValidationStatic;
38396
38396
  exports.Fragment = REACT_FRAGMENT_TYPE;
38397
- exports.jsx = jsx7;
38398
- exports.jsxs = jsxs6;
38397
+ exports.jsx = jsx10;
38398
+ exports.jsxs = jsxs9;
38399
38399
  })();
38400
38400
  }
38401
38401
  }
@@ -45921,8 +45921,8 @@ var Ink = class {
45921
45921
  }
45922
45922
  }
45923
45923
  async waitUntilExit() {
45924
- this.exitPromise ||= new Promise((resolve, reject) => {
45925
- this.resolveExitPromise = resolve;
45924
+ this.exitPromise ||= new Promise((resolve2, reject) => {
45925
+ this.resolveExitPromise = resolve2;
45926
45926
  this.rejectExitPromise = reject;
45927
45927
  });
45928
45928
  return this.exitPromise;
@@ -49215,8 +49215,8 @@ function getLogoModeFromEnv(envPrefix) {
49215
49215
  var CLI_NAME = "xcsh";
49216
49216
  var CLI_FULL_NAME = "F5 Distributed Cloud Shell";
49217
49217
  function getVersion() {
49218
- if ("v2.0.21-2601122136") {
49219
- return "v2.0.21-2601122136";
49218
+ if ("v2.0.21-2601130605") {
49219
+ return "v2.0.21-2601130605";
49220
49220
  }
49221
49221
  if (process.env.XCSH_VERSION) {
49222
49222
  return process.env.XCSH_VERSION;
@@ -49643,7 +49643,7 @@ function calculateBackoffDelay(attempt, config) {
49643
49643
  return cappedDelay;
49644
49644
  }
49645
49645
  function sleep(ms) {
49646
- return new Promise((resolve) => setTimeout(resolve, ms));
49646
+ return new Promise((resolve2) => setTimeout(resolve2, ms));
49647
49647
  }
49648
49648
  var APIClient = class {
49649
49649
  serverUrl;
@@ -74787,36 +74787,6 @@ function formatCustomDomainHelp(domain) {
74787
74787
  output.push("");
74788
74788
  return output;
74789
74789
  }
74790
- function formatSubcommandHelp(domainName, subcommand) {
74791
- const output = [
74792
- "",
74793
- colorBoldWhite(`${domainName} ${subcommand.name}`),
74794
- ""
74795
- ];
74796
- output.push("DESCRIPTION");
74797
- output.push(...wrapText3(subcommand.description, 80, 2));
74798
- output.push("");
74799
- output.push("USAGE");
74800
- output.push(
74801
- ` ${CLI_NAME} ${domainName} ${subcommand.name} <command> [options]`
74802
- );
74803
- output.push("");
74804
- if (subcommand.commands.size > 0) {
74805
- output.push("COMMANDS");
74806
- for (const [name, cmd] of subcommand.commands) {
74807
- const usage = cmd.usage ? ` ${cmd.usage}` : "";
74808
- output.push(
74809
- ` ${name}${usage.padEnd(16 - name.length)} ${cmd.descriptionShort}`
74810
- );
74811
- }
74812
- output.push("");
74813
- }
74814
- output.push(
74815
- colorDim(`For domain help, run: ${CLI_NAME} ${domainName} --help`)
74816
- );
74817
- output.push("");
74818
- return output;
74819
- }
74820
74790
 
74821
74791
  // src/domains/registry.ts
74822
74792
  var DomainRegistry = class {
@@ -74881,59 +74851,15 @@ var DomainRegistry = class {
74881
74851
  if (firstArg === "--help" || firstArg === "-h" || firstArg === "help") {
74882
74852
  return this.showDomainHelp(domain);
74883
74853
  }
74884
- const subgroup = domain.subcommands.get(firstArg);
74885
- if (subgroup) {
74886
- if (restArgs.length === 0) {
74887
- if (subgroup.defaultCommand) {
74888
- return subgroup.defaultCommand.execute([], session);
74889
- }
74890
- return this.showSubcommandHelp(domain, subgroup);
74891
- }
74892
- const cmdName = restArgs[0]?.toLowerCase() ?? "";
74893
- if (cmdName === "--help" || cmdName === "-h" || cmdName === "help") {
74894
- return this.showSubcommandHelp(domain, subgroup);
74895
- }
74896
- const cmdArgs = restArgs.slice(1);
74897
- const cmd2 = subgroup.commands.get(cmdName);
74898
- if (cmd2) {
74899
- const commandPath = `${domainName} ${firstArg} ${cmdName}`;
74900
- const validationError = this.validateCommandArgs(
74901
- cmd2,
74902
- cmdArgs,
74903
- subgroup.commands,
74904
- commandPath
74905
- );
74906
- if (validationError) {
74907
- return validationError;
74908
- }
74909
- return cmd2.execute(cmdArgs, session);
74910
- }
74911
- for (const [, command] of subgroup.commands) {
74912
- if (command.aliases?.includes(cmdName)) {
74913
- const commandPath = `${domainName} ${firstArg} ${command.name}`;
74914
- const validationError = this.validateCommandArgs(
74915
- command,
74916
- cmdArgs,
74917
- subgroup.commands,
74918
- commandPath
74919
- );
74920
- if (validationError) {
74921
- return validationError;
74922
- }
74923
- return command.execute(cmdArgs, session);
74924
- }
74925
- }
74926
- return {
74927
- output: [
74928
- `Unknown command: ${domainName} ${firstArg} ${cmdName}`,
74929
- ``,
74930
- `Run '${domainName} ${firstArg}' for available commands.`
74931
- ],
74932
- shouldExit: false,
74933
- shouldClear: false,
74934
- contextChanged: false,
74935
- error: "Unknown command"
74936
- };
74854
+ const actionGroup = domain.actions?.get(firstArg);
74855
+ if (actionGroup) {
74856
+ return this.executeActionCommand(
74857
+ domain,
74858
+ domainName,
74859
+ firstArg,
74860
+ restArgs,
74861
+ session
74862
+ );
74937
74863
  }
74938
74864
  const cmd = domain.commands.get(firstArg);
74939
74865
  if (cmd) {
@@ -74976,6 +74902,90 @@ var DomainRegistry = class {
74976
74902
  error: "Unknown command"
74977
74903
  };
74978
74904
  }
74905
+ /**
74906
+ * Execute an action-based command (verb-first routing)
74907
+ * E.g., "login list profile" → action="list", resource="profile"
74908
+ */
74909
+ async executeActionCommand(domain, domainName, actionName, args, session) {
74910
+ const actionGroup = domain.actions?.get(actionName);
74911
+ if (!actionGroup) {
74912
+ return {
74913
+ output: [
74914
+ `Unknown action: ${domainName} ${actionName}`,
74915
+ ``,
74916
+ `Run '${domainName}' for available commands.`
74917
+ ],
74918
+ shouldExit: false,
74919
+ shouldClear: false,
74920
+ contextChanged: false,
74921
+ error: "Unknown action"
74922
+ };
74923
+ }
74924
+ if (args.length === 0) {
74925
+ if (actionGroup.defaultResource) {
74926
+ const cmd2 = actionGroup.resources.get(
74927
+ actionGroup.defaultResource
74928
+ );
74929
+ if (cmd2) {
74930
+ return cmd2.execute([], session);
74931
+ }
74932
+ }
74933
+ return this.showActionGroupHelp(domain, domainName, actionGroup);
74934
+ }
74935
+ const resourceName = args[0]?.toLowerCase() ?? "";
74936
+ const resourceArgs = args.slice(1);
74937
+ if (resourceName === "--help" || resourceName === "-h" || resourceName === "help") {
74938
+ return this.showActionGroupHelp(domain, domainName, actionGroup);
74939
+ }
74940
+ const cmd = actionGroup.resources.get(resourceName);
74941
+ if (cmd) {
74942
+ const commandPath = `${domainName} ${actionName} ${resourceName}`;
74943
+ const validationError = this.validateCommandArgs(
74944
+ cmd,
74945
+ resourceArgs,
74946
+ actionGroup.resources,
74947
+ commandPath
74948
+ );
74949
+ if (validationError) {
74950
+ return validationError;
74951
+ }
74952
+ return cmd.execute(resourceArgs, session);
74953
+ }
74954
+ return {
74955
+ output: [
74956
+ `Unknown resource: ${domainName} ${actionName} ${resourceName}`,
74957
+ ``,
74958
+ `Run '${domainName} ${actionName}' for available resources.`
74959
+ ],
74960
+ shouldExit: false,
74961
+ shouldClear: false,
74962
+ contextChanged: false,
74963
+ error: "Unknown resource"
74964
+ };
74965
+ }
74966
+ /**
74967
+ * Show help for an action group
74968
+ */
74969
+ showActionGroupHelp(_domain, domainName, actionGroup) {
74970
+ const output = [];
74971
+ output.push(`${domainName} ${actionGroup.name}`);
74972
+ output.push(actionGroup.description);
74973
+ output.push(``);
74974
+ output.push(`Available resources:`);
74975
+ for (const [resourceName, cmd] of actionGroup.resources) {
74976
+ output.push(` ${resourceName.padEnd(20)} ${cmd.descriptionShort}`);
74977
+ }
74978
+ output.push(``);
74979
+ output.push(
74980
+ `Usage: ${domainName} ${actionGroup.name} <resource> [options]`
74981
+ );
74982
+ return {
74983
+ output,
74984
+ shouldExit: false,
74985
+ shouldClear: false,
74986
+ contextChanged: false
74987
+ };
74988
+ }
74979
74989
  /**
74980
74990
  * Get completions for a domain command
74981
74991
  */
@@ -74986,13 +74996,15 @@ var DomainRegistry = class {
74986
74996
  }
74987
74997
  const suggestions = [];
74988
74998
  if (args.length === 0) {
74989
- for (const [name, group] of domain.subcommands) {
74990
- if (name.toLowerCase().startsWith(partial.toLowerCase())) {
74991
- suggestions.push({
74992
- text: name,
74993
- description: group.descriptionShort,
74994
- category: "subcommand"
74995
- });
74999
+ if (domain.actions) {
75000
+ for (const [name, group] of domain.actions) {
75001
+ if (name.toLowerCase().startsWith(partial.toLowerCase())) {
75002
+ suggestions.push({
75003
+ text: name,
75004
+ description: group.descriptionShort,
75005
+ category: "action"
75006
+ });
75007
+ }
74996
75008
  }
74997
75009
  }
74998
75010
  for (const [name, cmd] of domain.commands) {
@@ -75007,22 +75019,22 @@ var DomainRegistry = class {
75007
75019
  return suggestions;
75008
75020
  }
75009
75021
  const firstArg = args[0]?.toLowerCase() ?? "";
75010
- const subgroup = domain.subcommands.get(firstArg);
75011
- if (subgroup && args.length === 1) {
75012
- for (const [name, cmd] of subgroup.commands) {
75022
+ const actionGroup = domain.actions?.get(firstArg);
75023
+ if (actionGroup && args.length === 1) {
75024
+ for (const [name, cmd] of actionGroup.resources) {
75013
75025
  if (name.toLowerCase().startsWith(partial.toLowerCase())) {
75014
75026
  suggestions.push({
75015
75027
  text: name,
75016
75028
  description: cmd.descriptionShort,
75017
- category: "command"
75029
+ category: "resource"
75018
75030
  });
75019
75031
  }
75020
75032
  }
75021
75033
  return suggestions;
75022
75034
  }
75023
- if (subgroup && args.length >= 2) {
75024
- const cmdName = args[1]?.toLowerCase() ?? "";
75025
- const cmd = subgroup.commands.get(cmdName);
75035
+ if (actionGroup && args.length >= 2) {
75036
+ const resourceName = args[1]?.toLowerCase() ?? "";
75037
+ const cmd = actionGroup.resources.get(resourceName);
75026
75038
  if (cmd?.completion) {
75027
75039
  const completions = await cmd.completion(
75028
75040
  partial,
@@ -75036,6 +75048,19 @@ var DomainRegistry = class {
75036
75048
  }));
75037
75049
  }
75038
75050
  }
75051
+ const directCmd = domain.commands.get(firstArg);
75052
+ if (directCmd?.completion && args.length >= 1) {
75053
+ const completions = await directCmd.completion(
75054
+ partial,
75055
+ args.slice(1),
75056
+ session
75057
+ );
75058
+ return completions.map((text) => ({
75059
+ text,
75060
+ description: "",
75061
+ category: "argument"
75062
+ }));
75063
+ }
75039
75064
  return suggestions;
75040
75065
  }
75041
75066
  /**
@@ -75050,18 +75075,6 @@ var DomainRegistry = class {
75050
75075
  contextChanged: false
75051
75076
  };
75052
75077
  }
75053
- /**
75054
- * Show help for a subcommand group using the unified help formatter.
75055
- * This ensures consistent professional formatting across all subcommands.
75056
- */
75057
- showSubcommandHelp(domain, subgroup) {
75058
- return {
75059
- output: formatSubcommandHelp(domain.name, subgroup),
75060
- shouldExit: false,
75061
- shouldClear: false,
75062
- contextChanged: false
75063
- };
75064
- }
75065
75078
  /**
75066
75079
  * Filter out global flags from command arguments.
75067
75080
  * Returns args without global flags like --output/-o.
@@ -76518,7 +76531,7 @@ function buildPlainPrompt(session) {
76518
76531
  }
76519
76532
 
76520
76533
  // src/repl/App.tsx
76521
- var import_react31 = __toESM(require_react(), 1);
76534
+ var import_react34 = __toESM(require_react(), 1);
76522
76535
 
76523
76536
  // src/repl/components/InputBox.tsx
76524
76537
  var import_react23 = __toESM(require_react(), 1);
@@ -77673,238 +77686,11 @@ function ChatMode({
77673
77686
  ] });
77674
77687
  }
77675
77688
 
77676
- // src/repl/hooks/useDoubleCtrlC.ts
77677
- var import_react27 = __toESM(require_react(), 1);
77678
- function useDoubleCtrlC(options = {}) {
77679
- const { windowMs = 500, onFirstPress, onDoublePress } = options;
77680
- const lastPressRef = (0, import_react27.useRef)(0);
77681
- const [isWaiting, setIsWaiting] = (0, import_react27.useState)(false);
77682
- const timeoutRef = (0, import_react27.useRef)(null);
77683
- const reset = (0, import_react27.useCallback)(() => {
77684
- lastPressRef.current = 0;
77685
- setIsWaiting(false);
77686
- if (timeoutRef.current) {
77687
- clearTimeout(timeoutRef.current);
77688
- timeoutRef.current = null;
77689
- }
77690
- }, []);
77691
- const handleCtrlC = (0, import_react27.useCallback)(() => {
77692
- const now = Date.now();
77693
- const elapsed = now - lastPressRef.current;
77694
- if (elapsed < windowMs && lastPressRef.current !== 0) {
77695
- reset();
77696
- onDoublePress?.();
77697
- return true;
77698
- }
77699
- lastPressRef.current = now;
77700
- setIsWaiting(true);
77701
- onFirstPress?.();
77702
- if (timeoutRef.current) {
77703
- clearTimeout(timeoutRef.current);
77704
- }
77705
- timeoutRef.current = setTimeout(() => {
77706
- setIsWaiting(false);
77707
- }, windowMs);
77708
- return false;
77709
- }, [windowMs, onFirstPress, onDoublePress, reset]);
77710
- return {
77711
- handleCtrlC,
77712
- reset,
77713
- isWaiting
77714
- };
77715
- }
77716
-
77717
- // src/repl/hooks/useHistory.ts
77718
- var import_react28 = __toESM(require_react(), 1);
77719
- function useHistory(options) {
77720
- const { history, onSelect } = options;
77721
- const [historyIndex, setHistoryIndex] = (0, import_react28.useState)(-1);
77722
- const reset = (0, import_react28.useCallback)(() => {
77723
- setHistoryIndex(-1);
77724
- }, []);
77725
- const navigateUp = (0, import_react28.useCallback)(() => {
77726
- if (history.length === 0) {
77727
- return null;
77728
- }
77729
- const newIndex = Math.min(historyIndex + 1, history.length - 1);
77730
- setHistoryIndex(newIndex);
77731
- const command = history[history.length - 1 - newIndex];
77732
- if (command !== void 0) {
77733
- onSelect?.(command);
77734
- return command;
77735
- }
77736
- return null;
77737
- }, [history, historyIndex, onSelect]);
77738
- const navigateDown = (0, import_react28.useCallback)(() => {
77739
- if (historyIndex <= 0) {
77740
- if (historyIndex === 0) {
77741
- setHistoryIndex(-1);
77742
- onSelect?.("");
77743
- return "";
77744
- }
77745
- return null;
77746
- }
77747
- const newIndex = historyIndex - 1;
77748
- setHistoryIndex(newIndex);
77749
- const command = history[history.length - 1 - newIndex];
77750
- if (command !== void 0) {
77751
- onSelect?.(command);
77752
- return command;
77753
- }
77754
- return null;
77755
- }, [history, historyIndex, onSelect]);
77756
- return {
77757
- navigateUp,
77758
- navigateDown,
77759
- reset,
77760
- isNavigating: historyIndex >= 0,
77761
- currentIndex: historyIndex
77762
- };
77763
- }
77764
-
77765
- // src/repl/hooks/useCompletion.ts
77689
+ // src/repl/components/ProfileDeleteWizard.tsx
77766
77690
  var import_react29 = __toESM(require_react(), 1);
77767
77691
 
77768
- // src/domains/login/profile/list.ts
77769
- var listCommand = {
77770
- name: "list",
77771
- description: "Display all saved connection profiles with their tenant URLs and authentication types. Highlights the currently active profile for easy identification when managing multiple tenants.",
77772
- descriptionShort: "List all saved profiles",
77773
- descriptionMedium: "Show all profiles with tenant URLs, auth types, and active status indicator.",
77774
- async execute(args, session) {
77775
- const { options } = parseDomainOutputFlags(
77776
- args,
77777
- session.getOutputFormat()
77778
- );
77779
- const manager = getProfileManager();
77780
- try {
77781
- const profiles = await manager.list();
77782
- const activeProfile = await manager.getActive();
77783
- if (profiles.length === 0) {
77784
- if (options.format === "none") {
77785
- return successResult([]);
77786
- }
77787
- return successResult([
77788
- "No profiles configured.",
77789
- "",
77790
- "Create a profile with: login profile create <name>"
77791
- ]);
77792
- }
77793
- const data = profiles.map((profile) => {
77794
- const isActive = profile.name === activeProfile;
77795
- const authType = profile.apiToken ? "token" : profile.cert ? "cert" : profile.p12Bundle ? "p12" : "none";
77796
- return {
77797
- name: profile.name,
77798
- apiUrl: profile.apiUrl,
77799
- authType,
77800
- active: isActive
77801
- };
77802
- });
77803
- if (options.format === "none") {
77804
- return successResult([]);
77805
- }
77806
- if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
77807
- return successResult(formatListOutput(data, options));
77808
- }
77809
- const output = ["Saved profiles:"];
77810
- for (const item of data) {
77811
- const marker = item.active ? " [active]" : "";
77812
- output.push(
77813
- ` ${item.name}${marker} - ${item.apiUrl} (${item.authType})`
77814
- );
77815
- }
77816
- return successResult(output);
77817
- } catch (error) {
77818
- return errorResult(
77819
- `Failed to list profiles: ${error instanceof Error ? error.message : "Unknown error"}`
77820
- );
77821
- }
77822
- }
77823
- };
77824
-
77825
- // src/domains/login/profile/show.ts
77826
- var showCommand = {
77827
- name: "show",
77828
- description: "Display detailed configuration for a specific profile. Shows tenant URL, authentication method, and namespace settings with sensitive credentials securely masked for safe viewing.",
77829
- descriptionShort: "Show profile details (masked credentials)",
77830
- descriptionMedium: "Display profile configuration with tenant URL, auth type, and masked credentials.",
77831
- usage: "<name>",
77832
- aliases: ["get", "view"],
77833
- async execute(args, session) {
77834
- const { options, remainingArgs } = parseDomainOutputFlags(
77835
- args,
77836
- session.getOutputFormat()
77837
- );
77838
- const manager = getProfileManager();
77839
- const name = remainingArgs[0];
77840
- if (!name) {
77841
- return errorResult("Usage: login profile show <name>");
77842
- }
77843
- try {
77844
- const profile = await manager.get(name);
77845
- if (!profile) {
77846
- return errorResult(`Profile '${name}' not found.`);
77847
- }
77848
- const masked = manager.maskProfile(profile);
77849
- const activeProfile = await manager.getActive();
77850
- const isActive = profile.name === activeProfile;
77851
- if (options.format === "none") {
77852
- return successResult([]);
77853
- }
77854
- const data = {
77855
- name: profile.name,
77856
- apiUrl: masked.apiUrl,
77857
- active: isActive
77858
- };
77859
- if (masked.apiToken) data.apiToken = masked.apiToken;
77860
- if (masked.p12Bundle) data.p12Bundle = masked.p12Bundle;
77861
- if (masked.cert) data.cert = masked.cert;
77862
- if (masked.key) data.key = masked.key;
77863
- if (masked.defaultNamespace)
77864
- data.namespace = masked.defaultNamespace;
77865
- if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
77866
- return successResult(
77867
- formatKeyValueOutput(data, {
77868
- ...options,
77869
- title: "Profile"
77870
- })
77871
- );
77872
- }
77873
- const output = [
77874
- `Profile: ${profile.name}${isActive ? " [active]" : ""}`,
77875
- ``,
77876
- ` API URL: ${masked.apiUrl}`
77877
- ];
77878
- if (masked.apiToken) {
77879
- output.push(` API Token: ${masked.apiToken}`);
77880
- }
77881
- if (masked.p12Bundle) {
77882
- output.push(` P12 Bundle: ${masked.p12Bundle}`);
77883
- }
77884
- if (masked.cert) {
77885
- output.push(` Certificate: ${masked.cert}`);
77886
- }
77887
- if (masked.key) {
77888
- output.push(` Private Key: ${masked.key}`);
77889
- }
77890
- if (masked.defaultNamespace) {
77891
- output.push(` Namespace: ${masked.defaultNamespace}`);
77892
- }
77893
- return successResult(output);
77894
- } catch (error) {
77895
- return errorResult(
77896
- `Failed to show profile: ${error instanceof Error ? error.message : "Unknown error"}`
77897
- );
77898
- }
77899
- },
77900
- async completion(partial, _args, _session) {
77901
- const manager = getProfileManager();
77902
- const profiles = await manager.list();
77903
- return profiles.map((p) => p.name).filter(
77904
- (name) => name.toLowerCase().startsWith(partial.toLowerCase())
77905
- );
77906
- }
77907
- };
77692
+ // src/repl/components/ProfileSwitcher.tsx
77693
+ var import_react27 = __toESM(require_react(), 1);
77908
77694
 
77909
77695
  // src/domains/login/profile/connection-table.ts
77910
77696
  var UNICODE_BOX2 = {
@@ -78051,6 +77837,569 @@ function buildConnectionInfo(profileName, apiUrl, hasToken, namespace, isConnect
78051
77837
  return info;
78052
77838
  }
78053
77839
 
77840
+ // src/repl/components/ProfileSwitcher.tsx
77841
+ var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
77842
+ function HorizontalRule3({ width }) {
77843
+ const rule = "\u2500".repeat(Math.max(width, 1));
77844
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "#CA260A", children: rule });
77845
+ }
77846
+ function ProfileSwitcher({
77847
+ currentProfile,
77848
+ onSelect,
77849
+ onCreate,
77850
+ onCancel,
77851
+ session,
77852
+ width = 80
77853
+ }) {
77854
+ const [profiles, setProfiles] = (0, import_react27.useState)([]);
77855
+ const [selectedIndex, setSelectedIndex] = (0, import_react27.useState)(0);
77856
+ const [loading, setLoading] = (0, import_react27.useState)(true);
77857
+ (0, import_react27.useEffect)(() => {
77858
+ async function loadProfiles() {
77859
+ try {
77860
+ const manager = session.getProfileManager();
77861
+ const allProfiles = await manager.list();
77862
+ const otherProfiles = allProfiles.filter(
77863
+ (p) => p.name !== currentProfile
77864
+ );
77865
+ setProfiles(otherProfiles);
77866
+ setLoading(false);
77867
+ } catch (error) {
77868
+ console.error("Failed to load profiles:", error);
77869
+ setLoading(false);
77870
+ }
77871
+ }
77872
+ loadProfiles();
77873
+ }, [session, currentProfile]);
77874
+ use_input_default(
77875
+ (0, import_react27.useCallback)(
77876
+ (inputChar, key) => {
77877
+ if (key.escape) {
77878
+ onCancel();
77879
+ return;
77880
+ }
77881
+ if (inputChar === "c" || inputChar === "C") {
77882
+ onCreate();
77883
+ return;
77884
+ }
77885
+ if (profiles.length === 0) return;
77886
+ if (key.upArrow) {
77887
+ setSelectedIndex(
77888
+ (prev) => prev > 0 ? prev - 1 : profiles.length - 1
77889
+ );
77890
+ } else if (key.downArrow) {
77891
+ setSelectedIndex(
77892
+ (prev) => prev < profiles.length - 1 ? prev + 1 : 0
77893
+ );
77894
+ } else if (key.return && profiles[selectedIndex]) {
77895
+ const selected = profiles[selectedIndex];
77896
+ if (selected) {
77897
+ onSelect(selected.name);
77898
+ }
77899
+ }
77900
+ },
77901
+ [profiles, selectedIndex, onSelect, onCreate, onCancel]
77902
+ )
77903
+ );
77904
+ if (loading) {
77905
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexDirection: "column", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: "Loading profiles..." }) });
77906
+ }
77907
+ if (profiles.length === 0) {
77908
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, children: [
77909
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HorizontalRule3, { width }),
77910
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { paddingTop: 1, paddingBottom: 1, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, color: "yellow", children: "\u26A0\uFE0F No other profiles available" }) }),
77911
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, paddingBottom: 1, children: [
77912
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: "You must create a new profile before deleting this one." }),
77913
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: " " }),
77914
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { bold: true, children: [
77915
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: "[c]" }),
77916
+ " Create new profile"
77917
+ ] }),
77918
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { bold: true, children: [
77919
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "dim", children: "[ESC]" }),
77920
+ " Cancel deletion"
77921
+ ] })
77922
+ ] }),
77923
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HorizontalRule3, { width })
77924
+ ] });
77925
+ }
77926
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", paddingTop: 1, children: [
77927
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HorizontalRule3, { width }),
77928
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { paddingTop: 1, paddingBottom: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { bold: true, children: "Select replacement profile:" }) }),
77929
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Box_default, { flexDirection: "column", paddingLeft: 2, paddingBottom: 1, children: profiles.map((profile, index) => {
77930
+ const isSelected = index === selectedIndex;
77931
+ const arrow = isSelected ? "\u276F" : " ";
77932
+ const tenant = extractTenantFromUrl(profile.apiUrl);
77933
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { children: [
77934
+ isSelected ? /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { bold: true, color: "yellow", children: [
77935
+ arrow,
77936
+ " ",
77937
+ profile.name
77938
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { children: [
77939
+ arrow,
77940
+ " ",
77941
+ profile.name
77942
+ ] }),
77943
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { color: "dim", children: [
77944
+ " (",
77945
+ tenant,
77946
+ ")"
77947
+ ] })
77948
+ ] }, profile.name);
77949
+ }) }),
77950
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", paddingLeft: 2, paddingBottom: 1, children: [
77951
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { bold: true, children: [
77952
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "yellow", children: "[c]" }),
77953
+ " Create new profile"
77954
+ ] }),
77955
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Text, { bold: true, children: [
77956
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { color: "dim", children: "[ESC]" }),
77957
+ " Cancel deletion"
77958
+ ] })
77959
+ ] }),
77960
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HorizontalRule3, { width })
77961
+ ] });
77962
+ }
77963
+
77964
+ // src/repl/components/ConfirmationDialog.tsx
77965
+ var import_react28 = __toESM(require_react(), 1);
77966
+ var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
77967
+ function HorizontalRule4({ width }) {
77968
+ const rule = "\u2500".repeat(Math.max(width, 1));
77969
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "#CA260A", children: rule });
77970
+ }
77971
+ function ConfirmationDialog({
77972
+ title,
77973
+ message,
77974
+ confirmText,
77975
+ onConfirm,
77976
+ onCancel,
77977
+ width = 80
77978
+ }) {
77979
+ const [input, setInput] = (0, import_react28.useState)("");
77980
+ use_input_default((_inputChar, key) => {
77981
+ if (key.escape) {
77982
+ onCancel();
77983
+ }
77984
+ });
77985
+ const handleSubmit = (0, import_react28.useCallback)(
77986
+ (value) => {
77987
+ if (value.toLowerCase() === confirmText.toLowerCase()) {
77988
+ onConfirm();
77989
+ } else {
77990
+ setInput("");
77991
+ }
77992
+ },
77993
+ [confirmText, onConfirm]
77994
+ );
77995
+ const inputMatches = input.toLowerCase() === confirmText.toLowerCase() && input.length > 0;
77996
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { flexDirection: "column", width, children: [
77997
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { borderStyle: "round", borderColor: "red", padding: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Text, { bold: true, color: "red", children: [
77998
+ "\u26A0\uFE0F ",
77999
+ title
78000
+ ] }) }),
78001
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { flexDirection: "column", paddingTop: 1, paddingLeft: 2, children: message.map(
78002
+ (line, index) => line ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "white", children: line }, index) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { children: line }, index)
78003
+ ) }),
78004
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { paddingTop: 1, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HorizontalRule4, { width }) }),
78005
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Box_default, { paddingLeft: 2, paddingTop: 1, paddingBottom: 1, children: [
78006
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: 'Type "' }),
78007
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, color: "yellow", children: confirmText }),
78008
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { bold: true, children: '" to confirm: ' }),
78009
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
78010
+ build_default,
78011
+ {
78012
+ value: input,
78013
+ onChange: setInput,
78014
+ onSubmit: handleSubmit,
78015
+ focus: true
78016
+ }
78017
+ )
78018
+ ] }),
78019
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(HorizontalRule4, { width }) }),
78020
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Box_default, { paddingTop: 1, paddingLeft: 2, children: input.length > 0 && !inputMatches ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "yellow", children: "\u26A0\uFE0F Input doesn't match. Press Enter to try again." }) : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Text, { color: "dim", children: "[ESC] Cancel" }) })
78021
+ ] });
78022
+ }
78023
+
78024
+ // src/repl/components/ProfileDeleteWizard.tsx
78025
+ var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1);
78026
+ function ProfileDeleteWizard({
78027
+ profileToDelete,
78028
+ isActive,
78029
+ session,
78030
+ width = 80,
78031
+ onExit
78032
+ }) {
78033
+ const [step, setStep] = (0, import_react29.useState)("confirmation" /* CONFIRMATION */);
78034
+ const [error, setError] = (0, import_react29.useState)(null);
78035
+ const [statusMessage, setStatusMessage] = (0, import_react29.useState)("");
78036
+ const handleProfileSelect = (0, import_react29.useCallback)(
78037
+ async (profileName) => {
78038
+ setStep("executing" /* EXECUTING */);
78039
+ setStatusMessage("Switching profiles...");
78040
+ setError(null);
78041
+ try {
78042
+ const success = await session.switchProfile(profileName);
78043
+ if (!success) {
78044
+ throw new Error(
78045
+ `Failed to switch to profile '${profileName}'`
78046
+ );
78047
+ }
78048
+ setStatusMessage("Deleting profile...");
78049
+ const manager = session.getProfileManager();
78050
+ const result = await manager.delete(profileToDelete);
78051
+ if (!result.success) {
78052
+ throw new Error(result.message);
78053
+ }
78054
+ const messages = [
78055
+ `Profile '${profileToDelete}' deleted successfully.`
78056
+ ];
78057
+ messages.push(`Now using profile '${profileName}'.`);
78058
+ messages.push("");
78059
+ const profile = session.getActiveProfile();
78060
+ if (profile) {
78061
+ const connectionInfo = buildConnectionInfo(
78062
+ profileName,
78063
+ profile.apiUrl,
78064
+ !!profile.apiToken,
78065
+ profile.defaultNamespace || session.getNamespace(),
78066
+ session.isAuthenticated(),
78067
+ session.isTokenValidated(),
78068
+ session.getValidationError() ?? void 0,
78069
+ session.getAuthSource(),
78070
+ session.getEnvVarsPresent()
78071
+ );
78072
+ const tableLines = formatConnectionTable(connectionInfo);
78073
+ messages.push(...tableLines);
78074
+ }
78075
+ onExit(true, messages);
78076
+ } catch (err) {
78077
+ const errorMessage = err instanceof Error ? err.message : "Unknown error";
78078
+ setError(`Failed: ${errorMessage}`);
78079
+ setStep("switch" /* PROFILE_SWITCH */);
78080
+ }
78081
+ },
78082
+ [session, profileToDelete, onExit]
78083
+ );
78084
+ const handleCreateProfile = (0, import_react29.useCallback)(() => {
78085
+ setStep("create" /* CREATE_PROFILE */);
78086
+ onExit(false, [
78087
+ "Profile creation from wizard is not yet implemented.",
78088
+ "Please use 'login profile create' command and try deletion again."
78089
+ ]);
78090
+ }, [onExit]);
78091
+ const handleConfirm = (0, import_react29.useCallback)(async () => {
78092
+ setError(null);
78093
+ if (isActive) {
78094
+ setStep("switch" /* PROFILE_SWITCH */);
78095
+ return;
78096
+ }
78097
+ setStep("executing" /* EXECUTING */);
78098
+ setStatusMessage("Deleting profile...");
78099
+ try {
78100
+ const manager = session.getProfileManager();
78101
+ const result = await manager.delete(profileToDelete);
78102
+ if (!result.success) {
78103
+ throw new Error(result.message);
78104
+ }
78105
+ const messages = [
78106
+ `Profile '${profileToDelete}' deleted successfully.`
78107
+ ];
78108
+ onExit(true, messages);
78109
+ } catch (err) {
78110
+ const errorMessage = err instanceof Error ? err.message : "Unknown error";
78111
+ setError(`Deletion failed: ${errorMessage}`);
78112
+ setStep("confirmation" /* CONFIRMATION */);
78113
+ }
78114
+ }, [session, profileToDelete, isActive, onExit]);
78115
+ const handleCancel = (0, import_react29.useCallback)(() => {
78116
+ onExit(false, ["Profile deletion cancelled."]);
78117
+ }, [onExit]);
78118
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { flexDirection: "column", width, children: [
78119
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { borderStyle: "round", borderColor: "red", padding: 1, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { bold: true, color: "red", children: [
78120
+ "\u26A0\uFE0F Delete Profile: ",
78121
+ profileToDelete
78122
+ ] }) }),
78123
+ step === "switch" /* PROFILE_SWITCH */ && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
78124
+ ProfileSwitcher,
78125
+ {
78126
+ currentProfile: profileToDelete,
78127
+ onSelect: handleProfileSelect,
78128
+ onCreate: handleCreateProfile,
78129
+ onCancel: handleCancel,
78130
+ session,
78131
+ width
78132
+ }
78133
+ ),
78134
+ step === "confirmation" /* CONFIRMATION */ && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
78135
+ ConfirmationDialog,
78136
+ {
78137
+ title: "Confirm Profile Deletion",
78138
+ message: [
78139
+ `You are about to permanently delete profile '${profileToDelete}'.`,
78140
+ "This action cannot be undone.",
78141
+ "",
78142
+ isActive ? "After confirmation, you will be prompted to select a replacement profile." : "",
78143
+ ""
78144
+ ],
78145
+ confirmText: "yes",
78146
+ onConfirm: handleConfirm,
78147
+ onCancel: handleCancel,
78148
+ width
78149
+ }
78150
+ ),
78151
+ step === "executing" /* EXECUTING */ && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { paddingTop: 1, paddingBottom: 1, paddingLeft: 2, children: [
78152
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "yellow", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(build_default2, { type: "dots" }) }),
78153
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { children: [
78154
+ " ",
78155
+ statusMessage
78156
+ ] })
78157
+ ] }),
78158
+ step === "create" /* CREATE_PROFILE */ && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Box_default, { paddingTop: 1, paddingBottom: 1, paddingLeft: 2, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "yellow", children: "Profile creation wizard (TODO)" }) }),
78159
+ error && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Box_default, { paddingTop: 1, paddingLeft: 2, children: [
78160
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Text, { color: "red", children: [
78161
+ "\u26A0\uFE0F ",
78162
+ error
78163
+ ] }),
78164
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { children: " " }),
78165
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Text, { color: "dim", children: "Press ESC to go back or try again." })
78166
+ ] })
78167
+ ] });
78168
+ }
78169
+
78170
+ // src/repl/hooks/useDoubleCtrlC.ts
78171
+ var import_react30 = __toESM(require_react(), 1);
78172
+ function useDoubleCtrlC(options = {}) {
78173
+ const { windowMs = 500, onFirstPress, onDoublePress } = options;
78174
+ const lastPressRef = (0, import_react30.useRef)(0);
78175
+ const [isWaiting, setIsWaiting] = (0, import_react30.useState)(false);
78176
+ const timeoutRef = (0, import_react30.useRef)(null);
78177
+ const reset = (0, import_react30.useCallback)(() => {
78178
+ lastPressRef.current = 0;
78179
+ setIsWaiting(false);
78180
+ if (timeoutRef.current) {
78181
+ clearTimeout(timeoutRef.current);
78182
+ timeoutRef.current = null;
78183
+ }
78184
+ }, []);
78185
+ const handleCtrlC = (0, import_react30.useCallback)(() => {
78186
+ const now = Date.now();
78187
+ const elapsed = now - lastPressRef.current;
78188
+ if (elapsed < windowMs && lastPressRef.current !== 0) {
78189
+ reset();
78190
+ onDoublePress?.();
78191
+ return true;
78192
+ }
78193
+ lastPressRef.current = now;
78194
+ setIsWaiting(true);
78195
+ onFirstPress?.();
78196
+ if (timeoutRef.current) {
78197
+ clearTimeout(timeoutRef.current);
78198
+ }
78199
+ timeoutRef.current = setTimeout(() => {
78200
+ setIsWaiting(false);
78201
+ }, windowMs);
78202
+ return false;
78203
+ }, [windowMs, onFirstPress, onDoublePress, reset]);
78204
+ return {
78205
+ handleCtrlC,
78206
+ reset,
78207
+ isWaiting
78208
+ };
78209
+ }
78210
+
78211
+ // src/repl/hooks/useHistory.ts
78212
+ var import_react31 = __toESM(require_react(), 1);
78213
+ function useHistory(options) {
78214
+ const { history, onSelect } = options;
78215
+ const [historyIndex, setHistoryIndex] = (0, import_react31.useState)(-1);
78216
+ const reset = (0, import_react31.useCallback)(() => {
78217
+ setHistoryIndex(-1);
78218
+ }, []);
78219
+ const navigateUp = (0, import_react31.useCallback)(() => {
78220
+ if (history.length === 0) {
78221
+ return null;
78222
+ }
78223
+ const newIndex = Math.min(historyIndex + 1, history.length - 1);
78224
+ setHistoryIndex(newIndex);
78225
+ const command = history[history.length - 1 - newIndex];
78226
+ if (command !== void 0) {
78227
+ onSelect?.(command);
78228
+ return command;
78229
+ }
78230
+ return null;
78231
+ }, [history, historyIndex, onSelect]);
78232
+ const navigateDown = (0, import_react31.useCallback)(() => {
78233
+ if (historyIndex <= 0) {
78234
+ if (historyIndex === 0) {
78235
+ setHistoryIndex(-1);
78236
+ onSelect?.("");
78237
+ return "";
78238
+ }
78239
+ return null;
78240
+ }
78241
+ const newIndex = historyIndex - 1;
78242
+ setHistoryIndex(newIndex);
78243
+ const command = history[history.length - 1 - newIndex];
78244
+ if (command !== void 0) {
78245
+ onSelect?.(command);
78246
+ return command;
78247
+ }
78248
+ return null;
78249
+ }, [history, historyIndex, onSelect]);
78250
+ return {
78251
+ navigateUp,
78252
+ navigateDown,
78253
+ reset,
78254
+ isNavigating: historyIndex >= 0,
78255
+ currentIndex: historyIndex
78256
+ };
78257
+ }
78258
+
78259
+ // src/repl/hooks/useCompletion.ts
78260
+ var import_react32 = __toESM(require_react(), 1);
78261
+
78262
+ // src/domains/login/profile/list.ts
78263
+ var listCommand = {
78264
+ name: "list",
78265
+ description: "Display all saved connection profiles with their tenant URLs and authentication types. Highlights the currently active profile for easy identification when managing multiple tenants.",
78266
+ descriptionShort: "List all saved profiles",
78267
+ descriptionMedium: "Show all profiles with tenant URLs, auth types, and active status indicator.",
78268
+ async execute(args, session) {
78269
+ const { options } = parseDomainOutputFlags(
78270
+ args,
78271
+ session.getOutputFormat()
78272
+ );
78273
+ const manager = getProfileManager();
78274
+ try {
78275
+ const profiles = await manager.list();
78276
+ const activeProfile = await manager.getActive();
78277
+ if (profiles.length === 0) {
78278
+ if (options.format === "none") {
78279
+ return successResult([]);
78280
+ }
78281
+ return successResult([
78282
+ "No profiles configured.",
78283
+ "",
78284
+ "Create a profile with: login profile create <name>"
78285
+ ]);
78286
+ }
78287
+ const data = profiles.map((profile) => {
78288
+ const isActive = profile.name === activeProfile;
78289
+ const authType = profile.apiToken ? "token" : profile.cert ? "cert" : profile.p12Bundle ? "p12" : "none";
78290
+ return {
78291
+ name: profile.name,
78292
+ apiUrl: profile.apiUrl,
78293
+ authType,
78294
+ active: isActive
78295
+ };
78296
+ });
78297
+ if (options.format === "none") {
78298
+ return successResult([]);
78299
+ }
78300
+ if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
78301
+ return successResult(formatListOutput(data, options));
78302
+ }
78303
+ const output = ["Saved profiles:"];
78304
+ for (const item of data) {
78305
+ const marker = item.active ? " [active]" : "";
78306
+ output.push(
78307
+ ` ${item.name}${marker} - ${item.apiUrl} (${item.authType})`
78308
+ );
78309
+ }
78310
+ return successResult(output);
78311
+ } catch (error) {
78312
+ return errorResult(
78313
+ `Failed to list profiles: ${error instanceof Error ? error.message : "Unknown error"}`
78314
+ );
78315
+ }
78316
+ }
78317
+ };
78318
+
78319
+ // src/domains/login/profile/show.ts
78320
+ var showCommand = {
78321
+ name: "show",
78322
+ description: "Display detailed configuration for a specific profile. Shows tenant URL, authentication method, and namespace settings with sensitive credentials securely masked for safe viewing.",
78323
+ descriptionShort: "Show profile details (masked credentials)",
78324
+ descriptionMedium: "Display profile configuration with tenant URL, auth type, and masked credentials.",
78325
+ usage: "<name>",
78326
+ aliases: ["get", "view"],
78327
+ async execute(args, session) {
78328
+ const { options, remainingArgs } = parseDomainOutputFlags(
78329
+ args,
78330
+ session.getOutputFormat()
78331
+ );
78332
+ const manager = getProfileManager();
78333
+ const name = remainingArgs[0];
78334
+ if (!name) {
78335
+ return errorResult("Usage: login profile show <name>");
78336
+ }
78337
+ try {
78338
+ const profile = await manager.get(name);
78339
+ if (!profile) {
78340
+ return errorResult(`Profile '${name}' not found.`);
78341
+ }
78342
+ const masked = manager.maskProfile(profile);
78343
+ const activeProfile = await manager.getActive();
78344
+ const isActive = profile.name === activeProfile;
78345
+ if (options.format === "none") {
78346
+ return successResult([]);
78347
+ }
78348
+ const data = {
78349
+ name: profile.name,
78350
+ apiUrl: masked.apiUrl,
78351
+ active: isActive
78352
+ };
78353
+ if (masked.apiToken) data.apiToken = masked.apiToken;
78354
+ if (masked.p12Bundle) data.p12Bundle = masked.p12Bundle;
78355
+ if (masked.cert) data.cert = masked.cert;
78356
+ if (masked.key) data.key = masked.key;
78357
+ if (masked.defaultNamespace)
78358
+ data.namespace = masked.defaultNamespace;
78359
+ if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
78360
+ return successResult(
78361
+ formatKeyValueOutput(data, {
78362
+ ...options,
78363
+ title: "Profile"
78364
+ })
78365
+ );
78366
+ }
78367
+ const output = [
78368
+ `Profile: ${profile.name}${isActive ? " [active]" : ""}`,
78369
+ ``,
78370
+ ` API URL: ${masked.apiUrl}`
78371
+ ];
78372
+ if (masked.apiToken) {
78373
+ output.push(` API Token: ${masked.apiToken}`);
78374
+ }
78375
+ if (masked.p12Bundle) {
78376
+ output.push(` P12 Bundle: ${masked.p12Bundle}`);
78377
+ }
78378
+ if (masked.cert) {
78379
+ output.push(` Certificate: ${masked.cert}`);
78380
+ }
78381
+ if (masked.key) {
78382
+ output.push(` Private Key: ${masked.key}`);
78383
+ }
78384
+ if (masked.defaultNamespace) {
78385
+ output.push(` Namespace: ${masked.defaultNamespace}`);
78386
+ }
78387
+ return successResult(output);
78388
+ } catch (error) {
78389
+ return errorResult(
78390
+ `Failed to show profile: ${error instanceof Error ? error.message : "Unknown error"}`
78391
+ );
78392
+ }
78393
+ },
78394
+ async completion(partial, _args, _session) {
78395
+ const manager = getProfileManager();
78396
+ const profiles = await manager.list();
78397
+ return profiles.map((p) => p.name).filter(
78398
+ (name) => name.toLowerCase().startsWith(partial.toLowerCase())
78399
+ );
78400
+ }
78401
+ };
78402
+
78054
78403
  // src/validation/namespace.ts
78055
78404
  function validateNamespaceScope(domain, action, currentNamespace, resourceType) {
78056
78405
  const opInfo = getOperationDescription(domain, action, resourceType);
@@ -78588,17 +78937,16 @@ var useCommand = {
78588
78937
  // src/domains/login/profile/delete.ts
78589
78938
  var deleteCommand = {
78590
78939
  name: "delete",
78591
- description: "Delete a saved connection profile permanently. Requires --force flag to delete the currently active profile to prevent accidental disconnection from active tenant.",
78592
- descriptionShort: "Delete a saved profile",
78593
- descriptionMedium: "Remove a saved profile permanently. Use --force to delete active profile.",
78594
- usage: "<name> [--force]",
78940
+ description: "Delete a saved connection profile permanently. For active profiles, you'll be guided through selecting a replacement profile before deletion. All deletions require typing 'yes' to confirm.",
78941
+ descriptionShort: "Delete a saved profile with confirmation",
78942
+ descriptionMedium: "Remove a profile permanently with interactive confirmation and profile switching.",
78943
+ usage: "<name>",
78595
78944
  aliases: ["rm", "remove"],
78596
78945
  async execute(args, _session) {
78597
78946
  const manager = getProfileManager();
78598
78947
  const name = args.find((arg) => !arg.startsWith("-"));
78599
- const force = args.includes("--force") || args.includes("-f");
78600
78948
  if (!name) {
78601
- return errorResult("Usage: login profile delete <name> [--force]");
78949
+ return errorResult("Usage: login profile delete <name>");
78602
78950
  }
78603
78951
  try {
78604
78952
  const profile = await manager.get(name);
@@ -78606,28 +78954,21 @@ var deleteCommand = {
78606
78954
  return errorResult(`Profile '${name}' not found.`);
78607
78955
  }
78608
78956
  const activeProfile = await manager.getActive();
78609
- if (profile.name === activeProfile) {
78610
- if (!force) {
78611
- return errorResult(
78612
- [
78613
- `Cannot delete active profile '${name}'.`,
78614
- ``,
78615
- `Either:`,
78616
- ` - Switch to another profile first: login profile use <other>`,
78617
- ` - Force delete with: login profile delete ${name} --force`
78618
- ].join("\n")
78619
- );
78957
+ const isActive = profile.name === activeProfile;
78958
+ return {
78959
+ output: [],
78960
+ shouldExit: false,
78961
+ shouldClear: false,
78962
+ contextChanged: false,
78963
+ enterProfileDeleteMode: true,
78964
+ profileDeleteConfig: {
78965
+ profileName: name,
78966
+ isActive
78620
78967
  }
78621
- await manager.clearActive();
78622
- }
78623
- const result = await manager.delete(name);
78624
- if (!result.success) {
78625
- return errorResult(result.message);
78626
- }
78627
- return successResult([`Profile '${name}' deleted successfully.`]);
78968
+ };
78628
78969
  } catch (error) {
78629
78970
  return errorResult(
78630
- `Failed to delete profile: ${error instanceof Error ? error.message : "Unknown error"}`
78971
+ `Failed to initiate profile deletion: ${error instanceof Error ? error.message : "Unknown error"}`
78631
78972
  );
78632
78973
  }
78633
78974
  },
@@ -78839,88 +79180,6 @@ Use 'login profile list' to see available profiles.`
78839
79180
  }
78840
79181
  };
78841
79182
 
78842
- // src/domains/login/profile/active.ts
78843
- var activeCommand = {
78844
- name: "active",
78845
- description: "Display the currently active profile configuration including tenant URL, authentication method, and default namespace. Shows masked credentials for security while confirming connection settings.",
78846
- descriptionShort: "Display active profile configuration",
78847
- descriptionMedium: "Show current active profile details including tenant URL, auth type, and namespace settings.",
78848
- async execute(args, session) {
78849
- const { options } = parseDomainOutputFlags(
78850
- args,
78851
- session.getOutputFormat()
78852
- );
78853
- const manager = getProfileManager();
78854
- try {
78855
- const activeName = await manager.getActive();
78856
- if (!activeName) {
78857
- if (options.format === "none") {
78858
- return successResult([]);
78859
- }
78860
- return successResult([
78861
- "No active profile set.",
78862
- "",
78863
- "Run 'login profile list' to see available profiles.",
78864
- "Run 'login profile use <name>' to activate a profile."
78865
- ]);
78866
- }
78867
- const profile = await manager.get(activeName);
78868
- if (!profile) {
78869
- return errorResult(
78870
- `Active profile '${activeName}' not found. Run 'login profile list' to see available profiles.`
78871
- );
78872
- }
78873
- const masked = manager.maskProfile(profile);
78874
- if (options.format === "none") {
78875
- return successResult([]);
78876
- }
78877
- const data = {
78878
- name: profile.name,
78879
- apiUrl: masked.apiUrl
78880
- };
78881
- if (masked.apiToken) data.apiToken = masked.apiToken;
78882
- if (masked.p12Bundle) data.p12Bundle = masked.p12Bundle;
78883
- if (masked.cert) data.cert = masked.cert;
78884
- if (masked.key) data.key = masked.key;
78885
- if (masked.defaultNamespace)
78886
- data.namespace = masked.defaultNamespace;
78887
- if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
78888
- return successResult(
78889
- formatKeyValueOutput(data, {
78890
- ...options,
78891
- title: "Active Profile"
78892
- })
78893
- );
78894
- }
78895
- const output = [
78896
- `Active Profile: ${profile.name}`,
78897
- ``,
78898
- ` API URL: ${masked.apiUrl}`
78899
- ];
78900
- if (masked.apiToken) {
78901
- output.push(` API Token: ${masked.apiToken}`);
78902
- }
78903
- if (masked.p12Bundle) {
78904
- output.push(` P12 Bundle: ${masked.p12Bundle}`);
78905
- }
78906
- if (masked.cert) {
78907
- output.push(` Certificate: ${masked.cert}`);
78908
- }
78909
- if (masked.key) {
78910
- output.push(` Private Key: ${masked.key}`);
78911
- }
78912
- if (masked.defaultNamespace) {
78913
- output.push(` Namespace: ${masked.defaultNamespace}`);
78914
- }
78915
- return successResult(output);
78916
- } catch (error) {
78917
- return errorResult(
78918
- `Failed to get active profile: ${error instanceof Error ? error.message : "Unknown error"}`
78919
- );
78920
- }
78921
- }
78922
- };
78923
-
78924
79183
  // src/domains/login/context/index.ts
78925
79184
  var showCommand2 = {
78926
79185
  name: "show",
@@ -79079,17 +79338,6 @@ var listCommand2 = {
79079
79338
  }
79080
79339
  }
79081
79340
  };
79082
- var contextSubcommands = {
79083
- name: "context",
79084
- description: "Manage default namespace context for scoping operations. Set, display, and list namespaces to control which namespace is used when no explicit namespace is specified in commands.",
79085
- descriptionShort: "Manage default namespace context",
79086
- descriptionMedium: "Set, display, and list namespaces for scoping operations without explicit namespace flags.",
79087
- commands: /* @__PURE__ */ new Map([
79088
- ["show", showCommand2],
79089
- ["set", setCommand],
79090
- ["list", listCommand2]
79091
- ])
79092
- };
79093
79341
 
79094
79342
  // src/domains/login/banner/display.ts
79095
79343
  function colorizeLogoLine(line) {
@@ -79641,20 +79889,57 @@ var whoamiCommand = {
79641
79889
  };
79642
79890
 
79643
79891
  // src/domains/login/index.ts
79644
- var profileSubcommands = {
79645
- name: "profile",
79646
- description: "Manage saved connection profiles for tenant authentication. Create, list, activate, and delete profiles that store tenant URL, credentials, and default namespace settings for seamless tenant switching.",
79647
- descriptionShort: "Manage saved connection profiles",
79648
- descriptionMedium: "Create, list, switch, and delete saved authentication profiles for multi-tenant management.",
79649
- commands: /* @__PURE__ */ new Map([
79650
- ["list", listCommand],
79651
- ["show", showCommand],
79652
- ["create", createCommand2],
79653
- ["use", useCommand],
79654
- ["edit", editCommand],
79655
- ["delete", deleteCommand]
79656
- ]),
79657
- defaultCommand: activeCommand
79892
+ var listAction = {
79893
+ name: "list",
79894
+ description: "List available items of a given resource type. Display profiles or namespaces with current status indicators.",
79895
+ descriptionShort: "List profiles or namespaces",
79896
+ descriptionMedium: "Enumerate profiles or namespaces with status indicators.",
79897
+ resources: /* @__PURE__ */ new Map([
79898
+ ["profile", listCommand],
79899
+ ["context", listCommand2]
79900
+ ])
79901
+ };
79902
+ var showAction = {
79903
+ name: "show",
79904
+ description: "Show detailed information about a specific resource or current status. Display profile details or current namespace context.",
79905
+ descriptionShort: "Show profile or context details",
79906
+ descriptionMedium: "Display detailed information for profiles or namespace context.",
79907
+ resources: /* @__PURE__ */ new Map([
79908
+ ["profile", showCommand],
79909
+ ["context", showCommand2]
79910
+ ])
79911
+ };
79912
+ var createAction = {
79913
+ name: "create",
79914
+ description: "Create new resources interactively. Set up new connection profiles with tenant URL and credentials.",
79915
+ descriptionShort: "Create new profiles",
79916
+ descriptionMedium: "Interactively create new connection profiles.",
79917
+ resources: /* @__PURE__ */ new Map([["profile", createCommand2]])
79918
+ };
79919
+ var useAction = {
79920
+ name: "use",
79921
+ description: "Activate or switch to a different resource. Change active profile or namespace context for subsequent operations.",
79922
+ descriptionShort: "Switch active profile or context",
79923
+ descriptionMedium: "Activate a different profile or namespace for operations.",
79924
+ resources: /* @__PURE__ */ new Map([
79925
+ ["profile", useCommand],
79926
+ ["context", setCommand]
79927
+ // context "use" maps to context "set"
79928
+ ])
79929
+ };
79930
+ var editAction = {
79931
+ name: "edit",
79932
+ description: "Edit existing resource configuration. Modify profile settings including URL, token, and namespace defaults.",
79933
+ descriptionShort: "Edit profile configuration",
79934
+ descriptionMedium: "Modify existing profile settings.",
79935
+ resources: /* @__PURE__ */ new Map([["profile", editCommand]])
79936
+ };
79937
+ var deleteAction = {
79938
+ name: "delete",
79939
+ description: "Delete existing resources. Remove saved profiles from local configuration.",
79940
+ descriptionShort: "Delete profiles",
79941
+ descriptionMedium: "Remove saved profiles from configuration.",
79942
+ resources: /* @__PURE__ */ new Map([["profile", deleteCommand]])
79658
79943
  };
79659
79944
  var loginDomain = {
79660
79945
  name: "login",
@@ -79663,10 +79948,16 @@ var loginDomain = {
79663
79948
  descriptionMedium: "Manage connection profiles, authentication contexts, and session identity for F5 Distributed Cloud.",
79664
79949
  defaultCommand: whoamiCommand,
79665
79950
  commands: /* @__PURE__ */ new Map([["banner", bannerCommand]]),
79666
- subcommands: /* @__PURE__ */ new Map([
79667
- ["profile", profileSubcommands],
79668
- ["context", contextSubcommands]
79669
- ])
79951
+ actions: /* @__PURE__ */ new Map([
79952
+ ["list", listAction],
79953
+ ["show", showAction],
79954
+ ["create", createAction],
79955
+ ["use", useAction],
79956
+ ["edit", editAction],
79957
+ ["delete", deleteAction]
79958
+ ]),
79959
+ subcommands: /* @__PURE__ */ new Map()
79960
+ // Clean break - no backward compatibility
79670
79961
  };
79671
79962
 
79672
79963
  // src/cloudstatus/client.ts
@@ -80542,8 +80833,28 @@ function fromSubcommandGroup(group) {
80542
80833
  }
80543
80834
  return node;
80544
80835
  }
80836
+ function fromActionGroup(group) {
80837
+ const children = /* @__PURE__ */ new Map();
80838
+ for (const [name, cmd] of group.resources) {
80839
+ children.set(name, fromCommand(cmd));
80840
+ }
80841
+ const node = {
80842
+ name: group.name,
80843
+ description: group.descriptionShort,
80844
+ source: "custom"
80845
+ };
80846
+ if (children.size > 0) {
80847
+ node.children = children;
80848
+ }
80849
+ return node;
80850
+ }
80545
80851
  function fromCustomDomain(domain) {
80546
80852
  const children = /* @__PURE__ */ new Map();
80853
+ if (domain.actions) {
80854
+ for (const [name, group] of domain.actions) {
80855
+ children.set(name, fromActionGroup(group));
80856
+ }
80857
+ }
80547
80858
  for (const [name, cmd] of domain.commands) {
80548
80859
  children.set(name, fromCommand(cmd));
80549
80860
  }
@@ -81421,17 +81732,6 @@ Negative types: ${validTypes}`
81421
81732
  }
81422
81733
  }
81423
81734
  };
81424
- var evalSubcommands = {
81425
- name: "eval",
81426
- description: "Eval mode commands for RBAC testing and permission validation. Use these endpoints to test AI assistant queries and feedback without affecting production analytics. Useful for administrators validating access controls.",
81427
- descriptionShort: "RBAC testing mode commands",
81428
- descriptionMedium: "Query and provide feedback in eval mode for RBAC testing and permission validation.",
81429
- commands: /* @__PURE__ */ new Map([
81430
- ["query", evalQueryCommand],
81431
- ["feedback", evalFeedbackCommand]
81432
- ]),
81433
- defaultCommand: evalQueryCommand
81434
- };
81435
81735
 
81436
81736
  // src/domains/domain-overview.ts
81437
81737
  function formatDomainOverview(config) {
@@ -81515,6 +81815,17 @@ var entryCommand = {
81515
81815
  };
81516
81816
  }
81517
81817
  };
81818
+ var evalAction = {
81819
+ name: "eval",
81820
+ description: "Execute AI commands in eval mode for RBAC testing and permission validation. Provides testing endpoints that don't affect production analytics.",
81821
+ descriptionShort: "RBAC testing mode",
81822
+ descriptionMedium: "Query and feedback in eval mode for RBAC testing without affecting analytics.",
81823
+ resources: /* @__PURE__ */ new Map([
81824
+ ["query", evalQueryCommand],
81825
+ ["feedback", evalFeedbackCommand]
81826
+ ]),
81827
+ defaultResource: "query"
81828
+ };
81518
81829
  var aiServicesDomain = {
81519
81830
  name: "ai_services",
81520
81831
  description: "Interact with the F5 Distributed Cloud AI assistant for natural language queries about platform operations. Ask questions about load balancers, WAF configurations, site status, security events, or any platform topic. Supports single queries with follow-up suggestions, interactive multi-turn chat sessions, and feedback submission to improve AI responses.",
@@ -81526,7 +81837,9 @@ var aiServicesDomain = {
81526
81837
  ["chat", chatCommand],
81527
81838
  ["feedback", feedbackCommand]
81528
81839
  ]),
81529
- subcommands: /* @__PURE__ */ new Map([["eval", evalSubcommands]])
81840
+ actions: /* @__PURE__ */ new Map([["eval", evalAction]]),
81841
+ subcommands: /* @__PURE__ */ new Map()
81842
+ // Clean break - no backward compatibility
81530
81843
  };
81531
81844
  var aiServicesAliases = [];
81532
81845
 
@@ -82209,17 +82522,6 @@ var planListCommand = {
82209
82522
  }
82210
82523
  }
82211
82524
  };
82212
- var planSubcommands = {
82213
- name: "plan",
82214
- description: "View and manage subscription plan information. Show current plan details, list available plans, and initiate plan transitions.",
82215
- descriptionShort: "Manage subscription plans",
82216
- descriptionMedium: "View current plan, list available options, and manage plan transitions.",
82217
- commands: /* @__PURE__ */ new Map([
82218
- ["show", planShowCommand],
82219
- ["list", planListCommand]
82220
- ]),
82221
- defaultCommand: planShowCommand
82222
- };
82223
82525
  var addonListCommand = {
82224
82526
  name: "list",
82225
82527
  description: "List all available addon services with their status, category, and access level. Use --subscribed to filter for active subscriptions only.",
@@ -82417,18 +82719,6 @@ var addonStatusCommand = {
82417
82719
  }
82418
82720
  }
82419
82721
  };
82420
- var addonSubcommands = {
82421
- name: "addon",
82422
- description: "Manage addon services for your subscription. List available addons, view details, check activation status, and manage subscriptions.",
82423
- descriptionShort: "Manage addon services",
82424
- descriptionMedium: "List, view, and manage addon service subscriptions and activation status.",
82425
- commands: /* @__PURE__ */ new Map([
82426
- ["list", addonListCommand],
82427
- ["show", addonShowCommand],
82428
- ["status", addonStatusCommand]
82429
- ]),
82430
- defaultCommand: addonListCommand
82431
- };
82432
82722
  var quotaLimitsCommand = {
82433
82723
  name: "limits",
82434
82724
  description: "Display all tenant-level quota limits including resource caps for load balancers, origins, sites, and other configurable resources.",
@@ -82561,17 +82851,6 @@ var quotaUsageCommand = {
82561
82851
  }
82562
82852
  }
82563
82853
  };
82564
- var quotaSubcommands = {
82565
- name: "quota",
82566
- description: "View tenant-level quota limits and current usage. Monitor resource utilization to avoid quota exhaustion.",
82567
- descriptionShort: "View quota limits and usage",
82568
- descriptionMedium: "Display tenant-level quota limits and current usage with utilization metrics.",
82569
- commands: /* @__PURE__ */ new Map([
82570
- ["limits", quotaLimitsCommand],
82571
- ["usage", quotaUsageCommand]
82572
- ]),
82573
- defaultCommand: quotaUsageCommand
82574
- };
82575
82854
  var usageCurrentCommand = {
82576
82855
  name: "current",
82577
82856
  description: "Display current billing period usage including itemized costs and projected totals.",
@@ -82699,17 +82978,6 @@ var usageMonthlyCommand = {
82699
82978
  }
82700
82979
  }
82701
82980
  };
82702
- var usageSubcommands = {
82703
- name: "usage",
82704
- description: "View usage metrics and cost data for current and historical billing periods.",
82705
- descriptionShort: "View usage metrics",
82706
- descriptionMedium: "Display usage metrics, cost breakdowns, and historical billing data.",
82707
- commands: /* @__PURE__ */ new Map([
82708
- ["current", usageCurrentCommand],
82709
- ["monthly", usageMonthlyCommand]
82710
- ]),
82711
- defaultCommand: usageCurrentCommand
82712
- };
82713
82981
  var billingPaymentListCommand = {
82714
82982
  name: "list",
82715
82983
  description: "List all configured payment methods showing type, status, and primary designation.",
@@ -82838,52 +83106,6 @@ var billingInvoiceListCommand = {
82838
83106
  }
82839
83107
  }
82840
83108
  };
82841
- var billingPaymentSubcommands = {
82842
- name: "payment",
82843
- description: "Manage payment methods for your subscription billing.",
82844
- descriptionShort: "Manage payment methods",
82845
- descriptionMedium: "List, view, and manage payment methods for subscription billing.",
82846
- commands: /* @__PURE__ */ new Map([["list", billingPaymentListCommand]]),
82847
- defaultCommand: billingPaymentListCommand
82848
- };
82849
- var billingInvoiceSubcommands = {
82850
- name: "invoice",
82851
- description: "View and download invoices for your subscription.",
82852
- descriptionShort: "Manage invoices",
82853
- descriptionMedium: "List invoices and download invoice PDFs for billing records.",
82854
- commands: /* @__PURE__ */ new Map([["list", billingInvoiceListCommand]]),
82855
- defaultCommand: billingInvoiceListCommand
82856
- };
82857
- var billingPaymentCommand = {
82858
- name: "payment",
82859
- description: billingPaymentSubcommands.description,
82860
- descriptionShort: billingPaymentSubcommands.descriptionShort,
82861
- descriptionMedium: billingPaymentSubcommands.descriptionMedium,
82862
- usage: "<list>",
82863
- async execute(args, session) {
82864
- return billingPaymentListCommand.execute(args, session);
82865
- }
82866
- };
82867
- var billingInvoiceCommand = {
82868
- name: "invoice",
82869
- description: billingInvoiceSubcommands.description,
82870
- descriptionShort: billingInvoiceSubcommands.descriptionShort,
82871
- descriptionMedium: billingInvoiceSubcommands.descriptionMedium,
82872
- usage: "<list>",
82873
- async execute(args, session) {
82874
- return billingInvoiceListCommand.execute(args, session);
82875
- }
82876
- };
82877
- var billingSubcommands = {
82878
- name: "billing",
82879
- description: "Manage billing information including payment methods and invoices.",
82880
- descriptionShort: "Manage billing",
82881
- descriptionMedium: "View and manage payment methods, invoices, and billing details.",
82882
- commands: /* @__PURE__ */ new Map([
82883
- ["payment", billingPaymentCommand],
82884
- ["invoice", billingInvoiceCommand]
82885
- ])
82886
- };
82887
83109
  var reportSummaryCommand = {
82888
83110
  name: "summary",
82889
83111
  description: "Generate comprehensive subscription report combining plan details, addon status, quota utilization, usage metrics, and billing summary.",
@@ -83037,13 +83259,40 @@ var reportSummaryCommand = {
83037
83259
  }
83038
83260
  }
83039
83261
  };
83040
- var reportSubcommands = {
83041
- name: "report",
83042
- description: "Generate comprehensive subscription reports for analysis and planning.",
83043
- descriptionShort: "Generate reports",
83044
- descriptionMedium: "Create detailed subscription reports combining multiple data sources.",
83045
- commands: /* @__PURE__ */ new Map([["summary", reportSummaryCommand]]),
83046
- defaultCommand: reportSummaryCommand
83262
+ var showAction2 = {
83263
+ name: "show",
83264
+ description: "Display detailed information about subscription resources. Show plan details, addon information, quota limits, usage metrics, or generate reports.",
83265
+ descriptionShort: "Show subscription resource details",
83266
+ descriptionMedium: "Display detailed information for plans, addons, quotas, usage, or reports.",
83267
+ resources: /* @__PURE__ */ new Map([
83268
+ ["plan", planShowCommand],
83269
+ ["addon", addonShowCommand],
83270
+ ["quota-limits", quotaLimitsCommand],
83271
+ ["quota-usage", quotaUsageCommand],
83272
+ ["usage-current", usageCurrentCommand],
83273
+ ["usage-monthly", usageMonthlyCommand],
83274
+ ["report-summary", reportSummaryCommand]
83275
+ ]),
83276
+ defaultResource: "plan"
83277
+ };
83278
+ var listAction2 = {
83279
+ name: "list",
83280
+ description: "List subscription resources. Display available plans, addon services, billing payment methods, or invoices.",
83281
+ descriptionShort: "List subscription resources",
83282
+ descriptionMedium: "Enumerate plans, addons, payment methods, or invoices with status information.",
83283
+ resources: /* @__PURE__ */ new Map([
83284
+ ["plan", planListCommand],
83285
+ ["addon", addonListCommand],
83286
+ ["billing-payment", billingPaymentListCommand],
83287
+ ["billing-invoice", billingInvoiceListCommand]
83288
+ ])
83289
+ };
83290
+ var statusAction = {
83291
+ name: "status",
83292
+ description: "Display activation status for subscription resources. Show addon activation status and details.",
83293
+ descriptionShort: "Show resource status",
83294
+ descriptionMedium: "Display activation status for addon services.",
83295
+ resources: /* @__PURE__ */ new Map([["addon", addonStatusCommand]])
83047
83296
  };
83048
83297
  var subscriptionDomain = {
83049
83298
  name: "subscription",
@@ -83052,14 +83301,13 @@ var subscriptionDomain = {
83052
83301
  descriptionMedium: "Manage subscription tier, addon services, quota limits, usage metrics, and billing information.",
83053
83302
  defaultCommand: showCommand3,
83054
83303
  commands: /* @__PURE__ */ new Map([["show", showCommand3]]),
83055
- subcommands: /* @__PURE__ */ new Map([
83056
- ["plan", planSubcommands],
83057
- ["addon", addonSubcommands],
83058
- ["quota", quotaSubcommands],
83059
- ["usage", usageSubcommands],
83060
- ["billing", billingSubcommands],
83061
- ["report", reportSubcommands]
83062
- ])
83304
+ actions: /* @__PURE__ */ new Map([
83305
+ ["show", showAction2],
83306
+ ["list", listAction2],
83307
+ ["status", statusAction]
83308
+ ]),
83309
+ subcommands: /* @__PURE__ */ new Map()
83310
+ // Clean break - no backward compatibility
83063
83311
  };
83064
83312
  var subscriptionAliases = [];
83065
83313
 
@@ -83802,8 +84050,11 @@ var Completer = class {
83802
84050
  if (args.length >= 2 && this.session) {
83803
84051
  const cmdName = args[1]?.toLowerCase() ?? "";
83804
84052
  const domain2 = customDomains.get(domainName);
83805
- const subgroup = domain2?.subcommands.get(subgroupName);
83806
- const cmd = subgroup?.commands.get(cmdName);
84053
+ let cmd = domain2?.actions?.get(subgroupName)?.resources.get(cmdName);
84054
+ if (!cmd) {
84055
+ const subgroup = domain2?.subcommands.get(subgroupName);
84056
+ cmd = subgroup?.commands.get(cmdName);
84057
+ }
83807
84058
  if (cmd?.completion) {
83808
84059
  try {
83809
84060
  const completions = await cmd.completion(
@@ -84367,27 +84618,27 @@ var Completer = class {
84367
84618
  // src/repl/hooks/useCompletion.ts
84368
84619
  function useCompletion(options) {
84369
84620
  const { session } = options;
84370
- const [completer] = (0, import_react29.useState)(() => {
84621
+ const [completer] = (0, import_react32.useState)(() => {
84371
84622
  const c = new Completer();
84372
84623
  if (session) {
84373
84624
  c.setSession(session);
84374
84625
  }
84375
84626
  return c;
84376
84627
  });
84377
- const [suggestions, setSuggestions] = (0, import_react29.useState)([]);
84378
- const [selectedIndex, setSelectedIndex] = (0, import_react29.useState)(0);
84379
- const [isShowing, setIsShowing] = (0, import_react29.useState)(false);
84380
- (0, import_react29.useEffect)(() => {
84628
+ const [suggestions, setSuggestions] = (0, import_react32.useState)([]);
84629
+ const [selectedIndex, setSelectedIndex] = (0, import_react32.useState)(0);
84630
+ const [isShowing, setIsShowing] = (0, import_react32.useState)(false);
84631
+ (0, import_react32.useEffect)(() => {
84381
84632
  if (session) {
84382
84633
  completer.setSession(session);
84383
84634
  }
84384
84635
  }, [session, completer]);
84385
- const hide = (0, import_react29.useCallback)(() => {
84636
+ const hide = (0, import_react32.useCallback)(() => {
84386
84637
  setIsShowing(false);
84387
84638
  setSuggestions([]);
84388
84639
  setSelectedIndex(0);
84389
84640
  }, []);
84390
- const triggerCompletion = (0, import_react29.useCallback)(
84641
+ const triggerCompletion = (0, import_react32.useCallback)(
84391
84642
  async (input) => {
84392
84643
  const newSuggestions = await completer.complete(input);
84393
84644
  if (newSuggestions.length === 1) {
@@ -84405,7 +84656,7 @@ function useCompletion(options) {
84405
84656
  },
84406
84657
  [completer, hide]
84407
84658
  );
84408
- const filterSuggestions = (0, import_react29.useCallback)(
84659
+ const filterSuggestions = (0, import_react32.useCallback)(
84409
84660
  async (input) => {
84410
84661
  if (!isShowing) return;
84411
84662
  const newSuggestions = await completer.complete(input);
@@ -84418,19 +84669,19 @@ function useCompletion(options) {
84418
84669
  },
84419
84670
  [completer, isShowing, hide]
84420
84671
  );
84421
- const navigateUp = (0, import_react29.useCallback)(() => {
84672
+ const navigateUp = (0, import_react32.useCallback)(() => {
84422
84673
  if (!isShowing || suggestions.length === 0) return;
84423
84674
  setSelectedIndex(
84424
84675
  (current) => current > 0 ? current - 1 : suggestions.length - 1
84425
84676
  );
84426
84677
  }, [isShowing, suggestions.length]);
84427
- const navigateDown = (0, import_react29.useCallback)(() => {
84678
+ const navigateDown = (0, import_react32.useCallback)(() => {
84428
84679
  if (!isShowing || suggestions.length === 0) return;
84429
84680
  setSelectedIndex(
84430
84681
  (current) => current < suggestions.length - 1 ? current + 1 : 0
84431
84682
  );
84432
84683
  }, [isShowing, suggestions.length]);
84433
- const selectCurrent = (0, import_react29.useCallback)(() => {
84684
+ const selectCurrent = (0, import_react32.useCallback)(() => {
84434
84685
  if (!isShowing || suggestions.length === 0) return null;
84435
84686
  const selected = suggestions.at(selectedIndex);
84436
84687
  hide();
@@ -84450,7 +84701,7 @@ function useCompletion(options) {
84450
84701
  }
84451
84702
 
84452
84703
  // src/repl/hooks/useGitStatus.ts
84453
- var import_react30 = __toESM(require_react(), 1);
84704
+ var import_react33 = __toESM(require_react(), 1);
84454
84705
  var DEFAULT_POLL_INTERVAL_MS = 3e4;
84455
84706
  var MIN_POLL_INTERVAL_MS = 5e3;
84456
84707
  function getPollInterval() {
@@ -84464,20 +84715,20 @@ function getPollInterval() {
84464
84715
  function useGitStatus(options = {}) {
84465
84716
  const { enabled = true } = options;
84466
84717
  const pollIntervalMs = options.pollIntervalMs ?? getPollInterval();
84467
- const [gitInfo, setGitInfo] = (0, import_react30.useState)(void 0);
84468
- const [lastRefresh, setLastRefresh] = (0, import_react30.useState)(0);
84469
- const intervalRef = (0, import_react30.useRef)(null);
84470
- const refresh = (0, import_react30.useCallback)(() => {
84718
+ const [gitInfo, setGitInfo] = (0, import_react33.useState)(void 0);
84719
+ const [lastRefresh, setLastRefresh] = (0, import_react33.useState)(0);
84720
+ const intervalRef = (0, import_react33.useRef)(null);
84721
+ const refresh = (0, import_react33.useCallback)(() => {
84471
84722
  const info = getGitInfo();
84472
84723
  setGitInfo(info);
84473
84724
  setLastRefresh(Date.now());
84474
84725
  }, []);
84475
- (0, import_react30.useEffect)(() => {
84726
+ (0, import_react33.useEffect)(() => {
84476
84727
  if (enabled) {
84477
84728
  refresh();
84478
84729
  }
84479
84730
  }, [enabled, refresh]);
84480
- (0, import_react30.useEffect)(() => {
84731
+ (0, import_react33.useEffect)(() => {
84481
84732
  if (!enabled || pollIntervalMs === 0) {
84482
84733
  return;
84483
84734
  }
@@ -85647,8 +85898,67 @@ function getBuiltinDescription(cmd) {
85647
85898
  return descriptions.get(cmd) ?? "Built-in command";
85648
85899
  }
85649
85900
 
85901
+ // src/debug/logger.ts
85902
+ import { appendFileSync, writeFileSync as writeFileSync2 } from "fs";
85903
+ import { resolve } from "path";
85904
+ var DEBUG_ENABLED = process.env.XCSH_DEBUG === "1" || process.env.DEBUG === "xcsh" || process.env.DEBUG === "*";
85905
+ var DEBUG_FILE = process.env.XCSH_DEBUG_FILE || "./xcsh-debug.log";
85906
+ if (DEBUG_ENABLED) {
85907
+ const logPath = resolve(DEBUG_FILE);
85908
+ try {
85909
+ writeFileSync2(
85910
+ logPath,
85911
+ `=== XCSH Debug Log Started at ${(/* @__PURE__ */ new Date()).toISOString()} ===
85912
+ `
85913
+ );
85914
+ console.error(`[DEBUG] Logging to: ${logPath}`);
85915
+ } catch (error) {
85916
+ console.error(`[DEBUG] Failed to initialize log file: ${error}`);
85917
+ }
85918
+ }
85919
+ function isCategoryEnabled(category) {
85920
+ if (!DEBUG_ENABLED) return false;
85921
+ const categoryFilter = process.env.XCSH_DEBUG_CATEGORY;
85922
+ if (!categoryFilter || categoryFilter === "all") return true;
85923
+ const enabledCategories = categoryFilter.split(",");
85924
+ return enabledCategories.includes(category);
85925
+ }
85926
+ function timestamp() {
85927
+ const now = /* @__PURE__ */ new Date();
85928
+ const ms = now.getMilliseconds().toString().padStart(3, "0");
85929
+ return `${now.toISOString().slice(11, 19)}.${ms}`;
85930
+ }
85931
+ function writeToLog(entry) {
85932
+ try {
85933
+ appendFileSync(DEBUG_FILE, entry + "\n");
85934
+ } catch {
85935
+ }
85936
+ }
85937
+ function debug(category, message, data) {
85938
+ if (!isCategoryEnabled(category)) return;
85939
+ const prefix = `[${timestamp()}] [${category.toUpperCase()}]`;
85940
+ let logEntry;
85941
+ if (data === void 0) {
85942
+ logEntry = `${prefix} ${message}`;
85943
+ } else if (typeof data === "object" && data !== null) {
85944
+ logEntry = `${prefix} ${message}
85945
+ ${JSON.stringify(data, null, 2)}`;
85946
+ } else {
85947
+ logEntry = `${prefix} ${message}: ${data}`;
85948
+ }
85949
+ writeToLog(logEntry);
85950
+ }
85951
+ var debugOutput = (message, data) => debug("output", message, data);
85952
+ var debugRender = (message, data) => debug("render", message, data);
85953
+ var debugTerminal = (message, data) => debug("terminal", message, data);
85954
+ var debugBuffer = (message, data) => debug("buffer", message, data);
85955
+ function debugSeparator() {
85956
+ if (!DEBUG_ENABLED) return;
85957
+ writeToLog("\u2500".repeat(80));
85958
+ }
85959
+
85650
85960
  // src/repl/App.tsx
85651
- var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1);
85961
+ var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
85652
85962
  function isValidDomain2(word) {
85653
85963
  const lowerWord = word.toLowerCase();
85654
85964
  if (isCustomDomain(lowerWord)) return true;
@@ -85668,11 +85978,11 @@ function toUISuggestions(suggestions) {
85668
85978
  function App2({ initialSession } = {}) {
85669
85979
  const { exit } = use_app_default();
85670
85980
  const { stdout } = use_stdout_default();
85671
- const [session] = (0, import_react31.useState)(() => initialSession ?? new REPLSession());
85672
- const [isInitialized, setIsInitialized] = (0, import_react31.useState)(!!initialSession);
85673
- const [input, setInputState] = (0, import_react31.useState)("");
85674
- const inputRef = (0, import_react31.useRef)("");
85675
- const setInput = (0, import_react31.useCallback)(
85981
+ const [session] = (0, import_react34.useState)(() => initialSession ?? new REPLSession());
85982
+ const [isInitialized, setIsInitialized] = (0, import_react34.useState)(!!initialSession);
85983
+ const [input, setInputState] = (0, import_react34.useState)("");
85984
+ const inputRef = (0, import_react34.useRef)("");
85985
+ const setInput = (0, import_react34.useCallback)(
85676
85986
  (value) => {
85677
85987
  setInputState((prev) => {
85678
85988
  const newValue = typeof value === "function" ? value(prev) : value;
@@ -85682,20 +85992,24 @@ function App2({ initialSession } = {}) {
85682
85992
  },
85683
85993
  []
85684
85994
  );
85685
- const [outputItems, setOutputItems] = (0, import_react31.useState)([]);
85686
- const outputIdRef = (0, import_react31.useRef)(0);
85687
- const [prompt, setPrompt] = (0, import_react31.useState)("> ");
85688
- const [width, setWidth] = (0, import_react31.useState)(stdout?.columns ?? 80);
85689
- const [statusHint, setStatusHint] = (0, import_react31.useState)("Ctrl+C twice to exit");
85690
- const [historyArray, setHistoryArray] = (0, import_react31.useState)([]);
85691
- const [inputKey, setInputKey] = (0, import_react31.useState)(0);
85692
- const [hideStatusBar, setHideStatusBar] = (0, import_react31.useState)(false);
85693
- const [pendingRawStdout, setPendingRawStdout] = (0, import_react31.useState)(
85995
+ const [outputItems, setOutputItems] = (0, import_react34.useState)([]);
85996
+ const outputIdRef = (0, import_react34.useRef)(0);
85997
+ const commandIdRef = (0, import_react34.useRef)(0);
85998
+ const [prompt, setPrompt] = (0, import_react34.useState)("> ");
85999
+ const [width, setWidth] = (0, import_react34.useState)(stdout?.columns ?? 80);
86000
+ const [statusHint, setStatusHint] = (0, import_react34.useState)("Ctrl+C twice to exit");
86001
+ const [historyArray, setHistoryArray] = (0, import_react34.useState)([]);
86002
+ const [inputKey, setInputKey] = (0, import_react34.useState)(0);
86003
+ const [hideStatusBar, setHideStatusBar] = (0, import_react34.useState)(false);
86004
+ const [pendingRawStdout, setPendingRawStdout] = (0, import_react34.useState)(
85694
86005
  null
85695
86006
  );
85696
- const [mode, setMode] = (0, import_react31.useState)("repl");
85697
- const [chatConfig, setChatConfig] = (0, import_react31.useState)(null);
85698
- (0, import_react31.useEffect)(() => {
86007
+ const [mode, setMode] = (0, import_react34.useState)(
86008
+ "repl"
86009
+ );
86010
+ const [chatConfig, setChatConfig] = (0, import_react34.useState)(null);
86011
+ const [profileDeleteConfig, setProfileDeleteConfig] = (0, import_react34.useState)(null);
86012
+ (0, import_react34.useEffect)(() => {
85699
86013
  if (hideStatusBar && pendingRawStdout) {
85700
86014
  process.stdout.write(pendingRawStdout);
85701
86015
  process.stdout.write("\n\n\n");
@@ -85724,7 +86038,7 @@ function App2({ initialSession } = {}) {
85724
86038
  session.saveHistory().finally(() => exit());
85725
86039
  }
85726
86040
  });
85727
- (0, import_react31.useEffect)(() => {
86041
+ (0, import_react34.useEffect)(() => {
85728
86042
  const init = async () => {
85729
86043
  if (!isInitialized) {
85730
86044
  await session.initialize();
@@ -85738,37 +86052,85 @@ function App2({ initialSession } = {}) {
85738
86052
  };
85739
86053
  init();
85740
86054
  }, [session]);
85741
- (0, import_react31.useEffect)(() => {
86055
+ (0, import_react34.useEffect)(() => {
85742
86056
  const handleResize = () => {
85743
86057
  if (stdout) {
85744
86058
  const newWidth = stdout.columns ?? 80;
86059
+ const newHeight = stdout.rows ?? 24;
86060
+ debugTerminal("Terminal resized", {
86061
+ width: newWidth,
86062
+ height: newHeight,
86063
+ previousWidth: width
86064
+ });
85745
86065
  setWidth(newWidth);
85746
86066
  setTerminalWidth(newWidth);
85747
86067
  }
85748
86068
  };
85749
86069
  if (stdout) {
85750
- setTerminalWidth(stdout.columns ?? 80);
86070
+ const initialWidth = stdout.columns ?? 80;
86071
+ const initialHeight = stdout.rows ?? 24;
86072
+ debugTerminal("Terminal initialized", {
86073
+ width: initialWidth,
86074
+ height: initialHeight
86075
+ });
86076
+ setTerminalWidth(initialWidth);
85751
86077
  }
85752
86078
  stdout?.on("resize", handleResize);
85753
86079
  return () => {
85754
86080
  stdout?.off("resize", handleResize);
85755
86081
  };
85756
- }, [stdout]);
85757
- const addOutput = (0, import_react31.useCallback)((line) => {
86082
+ }, [stdout, width]);
86083
+ const addOutput = (0, import_react34.useCallback)((line) => {
85758
86084
  const lines = line.split("\n");
86085
+ const currentCommandId = commandIdRef.current;
85759
86086
  const newItems = lines.map((content) => ({
85760
86087
  id: outputIdRef.current++,
85761
- content
86088
+ content,
86089
+ commandId: currentCommandId
85762
86090
  }));
86091
+ debugOutput("Adding output lines", {
86092
+ inputLineCount: 1,
86093
+ splitLineCount: lines.length,
86094
+ newItemsCount: newItems.length,
86095
+ commandId: currentCommandId,
86096
+ firstLineLength: lines[0]?.length,
86097
+ firstLinePreview: lines[0]?.slice(0, 80)
86098
+ });
85763
86099
  setOutputItems((prev) => {
85764
86100
  const combined = [...prev, ...newItems];
85765
- if (combined.length > 1e3) {
85766
- return combined.slice(combined.length - 1e3);
86101
+ const uniqueCommands = new Set(
86102
+ combined.map((item) => item.commandId)
86103
+ );
86104
+ const commandCount = uniqueCommands.size;
86105
+ debugBuffer("Buffer state before truncation", {
86106
+ previousItemCount: prev.length,
86107
+ newItemsCount: newItems.length,
86108
+ combinedItemCount: combined.length,
86109
+ commandCount,
86110
+ willTruncate: commandCount > 3
86111
+ });
86112
+ if (commandCount > 3) {
86113
+ const recentCommandIds = Array.from(uniqueCommands).sort((a, b) => b - a).slice(0, 3);
86114
+ const truncated = combined.filter(
86115
+ (item) => recentCommandIds.includes(item.commandId)
86116
+ );
86117
+ debugBuffer("Buffer truncated by command boundary", {
86118
+ beforeCount: combined.length,
86119
+ afterCount: truncated.length,
86120
+ itemsRemoved: combined.length - truncated.length,
86121
+ commandsRemoved: commandCount - 3,
86122
+ keptCommandIds: recentCommandIds
86123
+ });
86124
+ return truncated;
85767
86125
  }
86126
+ debugBuffer("Buffer updated without truncation", {
86127
+ finalItemCount: combined.length,
86128
+ commandCount
86129
+ });
85768
86130
  return combined;
85769
86131
  });
85770
86132
  }, []);
85771
- const applyCompletion = (0, import_react31.useCallback)(
86133
+ const applyCompletion = (0, import_react34.useCallback)(
85772
86134
  (suggestion) => {
85773
86135
  const currentInput = inputRef.current;
85774
86136
  let newValue;
@@ -85796,30 +86158,60 @@ function App2({ initialSession } = {}) {
85796
86158
  []
85797
86159
  // No dependencies needed since we use inputRef
85798
86160
  );
85799
- const refreshHistory = (0, import_react31.useCallback)(() => {
86161
+ const refreshHistory = (0, import_react34.useCallback)(() => {
85800
86162
  const histMgr = session.getHistory();
85801
86163
  if (histMgr) {
85802
86164
  setHistoryArray(histMgr.getHistory());
85803
86165
  }
85804
86166
  }, [session]);
85805
- const runCommand = (0, import_react31.useCallback)(
86167
+ const runCommand = (0, import_react34.useCallback)(
85806
86168
  async (cmd) => {
85807
86169
  const trimmed = cmd.trim();
85808
86170
  if (!trimmed) return;
86171
+ debugSeparator();
86172
+ debugOutput("Command execution started", {
86173
+ command: trimmed,
86174
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
86175
+ currentBufferSize: outputItems.length
86176
+ });
86177
+ commandIdRef.current++;
85809
86178
  const scrollbackCommand = `${colorBlue("\u23FA")} ${colorBoldWhite(prompt + trimmed)}`;
85810
86179
  addOutput(scrollbackCommand);
85811
86180
  const result = await executeCommand(trimmed, session);
86181
+ debugOutput("Command execution completed", {
86182
+ command: trimmed,
86183
+ outputLineCount: result.output.length,
86184
+ shouldExit: result.shouldExit,
86185
+ shouldClear: result.shouldClear,
86186
+ hasRawStdout: !!result.rawStdout,
86187
+ enterChatMode: result.enterChatMode,
86188
+ enterProfileDeleteMode: result.enterProfileDeleteMode
86189
+ });
85812
86190
  if (result.enterChatMode && result.chatConfig) {
85813
86191
  setMode("chat");
85814
86192
  setChatConfig(result.chatConfig);
85815
86193
  return;
85816
86194
  }
86195
+ if (result.enterProfileDeleteMode && result.profileDeleteConfig) {
86196
+ setMode("profile-delete");
86197
+ setProfileDeleteConfig(result.profileDeleteConfig);
86198
+ return;
86199
+ }
85817
86200
  if (result.rawStdout) {
85818
86201
  setHideStatusBar(true);
85819
86202
  setPendingRawStdout(result.rawStdout);
85820
86203
  } else if (result.shouldClear) {
86204
+ debugOutput("Clearing output buffer");
85821
86205
  setOutputItems([]);
85822
86206
  } else {
86207
+ debugOutput("Processing output lines", {
86208
+ totalLines: result.output.length,
86209
+ firstLine: result.output[0]?.slice(0, 100),
86210
+ lastLine: result.output[result.output.length - 1]?.slice(
86211
+ 0,
86212
+ 100
86213
+ )
86214
+ });
85823
86215
  result.output.forEach((line) => addOutput(line));
85824
86216
  }
85825
86217
  if (result.shouldExit) {
@@ -85839,7 +86231,7 @@ function App2({ initialSession } = {}) {
85839
86231
  },
85840
86232
  [session, prompt, addOutput, exit, refreshHistory, gitStatus]
85841
86233
  );
85842
- const handleInputChange = (0, import_react31.useCallback)(
86234
+ const handleInputChange = (0, import_react34.useCallback)(
85843
86235
  (newValue) => {
85844
86236
  const oldValue = input;
85845
86237
  setInput(newValue);
@@ -85867,7 +86259,7 @@ function App2({ initialSession } = {}) {
85867
86259
  },
85868
86260
  [input, completion]
85869
86261
  );
85870
- const handleSubmit = (0, import_react31.useCallback)(
86262
+ const handleSubmit = (0, import_react34.useCallback)(
85871
86263
  async (value) => {
85872
86264
  if (completion.isShowing && completion.suggestions.length > 0) {
85873
86265
  const selected = completion.selectCurrent();
@@ -85965,7 +86357,7 @@ function App2({ initialSession } = {}) {
85965
86357
  return;
85966
86358
  }
85967
86359
  });
85968
- const handleSuggestionNavigate = (0, import_react31.useCallback)(
86360
+ const handleSuggestionNavigate = (0, import_react34.useCallback)(
85969
86361
  (direction) => {
85970
86362
  if (direction === "up") {
85971
86363
  completion.navigateUp();
@@ -85975,14 +86367,14 @@ function App2({ initialSession } = {}) {
85975
86367
  },
85976
86368
  [completion]
85977
86369
  );
85978
- const handleSuggestionSelect = (0, import_react31.useCallback)(
86370
+ const handleSuggestionSelect = (0, import_react34.useCallback)(
85979
86371
  (suggestion) => {
85980
86372
  applyCompletion(suggestion);
85981
86373
  completion.hide();
85982
86374
  },
85983
86375
  [applyCompletion, completion]
85984
86376
  );
85985
- const handleChatExit = (0, import_react31.useCallback)(
86377
+ const handleChatExit = (0, import_react34.useCallback)(
85986
86378
  (chatMessages) => {
85987
86379
  chatMessages.forEach((msg) => addOutput(msg));
85988
86380
  setMode("repl");
@@ -85990,9 +86382,41 @@ function App2({ initialSession } = {}) {
85990
86382
  },
85991
86383
  [addOutput]
85992
86384
  );
85993
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Box_default, { flexDirection: "column", width, children: [
85994
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Static, { items: outputItems, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: item.content }, item.id) }),
85995
- isInitialized && !hideStatusBar ? mode === "chat" && chatConfig ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
86385
+ const handleProfileDeleteExit = (0, import_react34.useCallback)(
86386
+ (success, messages) => {
86387
+ messages.forEach((msg) => addOutput(msg));
86388
+ if (success && profileDeleteConfig?.isActive) {
86389
+ setPrompt(buildPlainPrompt(session));
86390
+ }
86391
+ setMode("repl");
86392
+ setProfileDeleteConfig(null);
86393
+ setInput("");
86394
+ setInputKey((prev) => prev + 1);
86395
+ },
86396
+ [addOutput, session, profileDeleteConfig, setInput]
86397
+ );
86398
+ (0, import_react34.useEffect)(() => {
86399
+ const uniqueCommands = new Set(
86400
+ outputItems.map((item) => item.commandId)
86401
+ );
86402
+ debugRender("Static component render triggered", {
86403
+ itemCount: outputItems.length,
86404
+ commandCount: uniqueCommands.size,
86405
+ terminalWidth: width,
86406
+ terminalHeight: stdout?.rows ?? "unknown",
86407
+ firstItemId: outputItems[0]?.id,
86408
+ firstCommandId: outputItems[0]?.commandId,
86409
+ lastItemId: outputItems[outputItems.length - 1]?.id,
86410
+ lastCommandId: outputItems[outputItems.length - 1]?.commandId,
86411
+ lastItemContent: outputItems[outputItems.length - 1]?.content.slice(
86412
+ 0,
86413
+ 100
86414
+ )
86415
+ });
86416
+ }, [outputItems, width, stdout]);
86417
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", width, children: [
86418
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Static, { items: outputItems, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: item.content }, item.id) }),
86419
+ isInitialized && !hideStatusBar ? mode === "chat" && chatConfig ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
85996
86420
  ChatMode,
85997
86421
  {
85998
86422
  session,
@@ -86000,8 +86424,17 @@ function App2({ initialSession } = {}) {
86000
86424
  width,
86001
86425
  onExit: handleChatExit
86002
86426
  }
86003
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
86004
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
86427
+ ) : mode === "profile-delete" && profileDeleteConfig ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
86428
+ ProfileDeleteWizard,
86429
+ {
86430
+ profileToDelete: profileDeleteConfig.profileName,
86431
+ isActive: profileDeleteConfig.isActive,
86432
+ session,
86433
+ width,
86434
+ onExit: handleProfileDeleteExit
86435
+ }
86436
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
86437
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
86005
86438
  InputBox,
86006
86439
  {
86007
86440
  prompt,
@@ -86013,7 +86446,7 @@ function App2({ initialSession } = {}) {
86013
86446
  inputKey
86014
86447
  }
86015
86448
  ),
86016
- completion.isShowing && completion.suggestions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
86449
+ completion.isShowing && completion.suggestions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
86017
86450
  Suggestions,
86018
86451
  {
86019
86452
  suggestions: toUISuggestions(
@@ -86026,7 +86459,7 @@ function App2({ initialSession } = {}) {
86026
86459
  maxVisible: 20,
86027
86460
  isActive: false
86028
86461
  }
86029
- ) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
86462
+ ) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
86030
86463
  StatusBar,
86031
86464
  {
86032
86465
  gitInfo: gitStatus.gitInfo,
@@ -86034,7 +86467,7 @@ function App2({ initialSession } = {}) {
86034
86467
  hint: statusHint
86035
86468
  }
86036
86469
  )
86037
- ] }) : !isInitialized ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { children: "Initializing..." }) : null
86470
+ ] }) : !isInitialized ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "Initializing..." }) : null
86038
86471
  ] });
86039
86472
  }
86040
86473
 
@@ -86347,7 +86780,7 @@ var HeadlessController = class {
86347
86780
  };
86348
86781
 
86349
86782
  // src/index.tsx
86350
- var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1);
86783
+ var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
86351
86784
  var profiler = initProfiler();
86352
86785
  var importsSpan = profiler.startSpan("imports", "Module Imports");
86353
86786
  profiler.memorySnapshot("script_start");
@@ -86513,7 +86946,7 @@ program2.name(CLI_NAME).description("F5 Distributed Cloud Shell - Interactive CL
86513
86946
  }
86514
86947
  process.stdin.resume();
86515
86948
  const appProps = { initialSession: session };
86516
- render_default(/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(App2, { ...appProps }), { exitOnCtrlC: false });
86949
+ render_default(/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(App2, { ...appProps }), { exitOnCtrlC: false });
86517
86950
  return;
86518
86951
  }
86519
86952
  await executeNonInteractive(commandArgs);