@robinmordasiewicz/f5xc-xcsh 2.0.21-2601122136 → 2.0.21-2601131415
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/completions/_xcsh +3 -3
- package/completions/xcsh.bash +20 -20
- package/completions/xcsh.fish +25 -32
- package/dist/index.js +1175 -718
- package/package.json +1 -1
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
|
|
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
|
|
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
|
|
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(
|
|
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,
|
|
2030
|
+
recursivelyFlushAsyncActWork(returnValue2, resolve2, reject);
|
|
2031
2031
|
} else {
|
|
2032
|
-
|
|
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(
|
|
2062
|
+
then: function(resolve2, reject) {
|
|
2063
2063
|
if (ReactCurrentActQueue.current === null) {
|
|
2064
2064
|
ReactCurrentActQueue.current = [];
|
|
2065
|
-
recursivelyFlushAsyncActWork(returnValue,
|
|
2065
|
+
recursivelyFlushAsyncActWork(returnValue, resolve2, reject);
|
|
2066
2066
|
} else {
|
|
2067
|
-
|
|
2067
|
+
resolve2(returnValue);
|
|
2068
2068
|
}
|
|
2069
2069
|
}
|
|
2070
2070
|
};
|
|
2071
2071
|
return _thenable;
|
|
2072
2072
|
} else {
|
|
2073
2073
|
var _thenable2 = {
|
|
2074
|
-
then: function(
|
|
2075
|
-
|
|
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,
|
|
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
|
-
|
|
2100
|
+
resolve2(returnValue);
|
|
2101
2101
|
} else {
|
|
2102
|
-
recursivelyFlushAsyncActWork(returnValue,
|
|
2102
|
+
recursivelyFlushAsyncActWork(returnValue, resolve2, reject);
|
|
2103
2103
|
}
|
|
2104
2104
|
});
|
|
2105
2105
|
} catch (error2) {
|
|
2106
2106
|
reject(error2);
|
|
2107
2107
|
}
|
|
2108
2108
|
} else {
|
|
2109
|
-
|
|
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 =
|
|
2166
|
+
exports.useCallback = useCallback11;
|
|
2167
2167
|
exports.useContext = useContext7;
|
|
2168
2168
|
exports.useDebugValue = useDebugValue;
|
|
2169
2169
|
exports.useDeferredValue = useDeferredValue;
|
|
2170
|
-
exports.useEffect =
|
|
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 =
|
|
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
|
|
7873
|
+
var React19 = require_react();
|
|
7874
7874
|
var Scheduler = require_scheduler();
|
|
7875
|
-
var ReactSharedInternals =
|
|
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
|
|
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 =
|
|
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
|
|
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(
|
|
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 =
|
|
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
|
|
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
|
-
|
|
33329
|
-
|
|
33330
|
-
|
|
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
|
|
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:
|
|
33369
|
+
floatTime: timestamp2.floatTime,
|
|
33370
33370
|
int: int.int,
|
|
33371
33371
|
intHex: int.intHex,
|
|
33372
33372
|
intOct: int.intOct,
|
|
33373
|
-
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:
|
|
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":
|
|
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
|
|
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 =
|
|
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
|
|
38395
|
-
var
|
|
38394
|
+
var jsx10 = jsxWithValidationDynamic;
|
|
38395
|
+
var jsxs9 = jsxWithValidationStatic;
|
|
38396
38396
|
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
38397
|
-
exports.jsx =
|
|
38398
|
-
exports.jsxs =
|
|
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((
|
|
45925
|
-
this.resolveExitPromise =
|
|
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-
|
|
49219
|
-
return "v2.0.21-
|
|
49218
|
+
if ("v2.0.21-2601131415") {
|
|
49219
|
+
return "v2.0.21-2601131415";
|
|
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((
|
|
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
|
|
74885
|
-
if (
|
|
74886
|
-
|
|
74887
|
-
|
|
74888
|
-
|
|
74889
|
-
|
|
74890
|
-
|
|
74891
|
-
|
|
74892
|
-
|
|
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
|
-
|
|
74990
|
-
|
|
74991
|
-
|
|
74992
|
-
|
|
74993
|
-
|
|
74994
|
-
|
|
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
|
|
75011
|
-
if (
|
|
75012
|
-
for (const [name, cmd] of
|
|
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: "
|
|
75029
|
+
category: "resource"
|
|
75018
75030
|
});
|
|
75019
75031
|
}
|
|
75020
75032
|
}
|
|
75021
75033
|
return suggestions;
|
|
75022
75034
|
}
|
|
75023
|
-
if (
|
|
75024
|
-
const
|
|
75025
|
-
const cmd =
|
|
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
|
|
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/
|
|
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/
|
|
77769
|
-
var
|
|
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.
|
|
78592
|
-
descriptionShort: "Delete a saved profile",
|
|
78593
|
-
descriptionMedium: "Remove a
|
|
78594
|
-
usage: "<name>
|
|
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>
|
|
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
|
-
|
|
78610
|
-
|
|
78611
|
-
|
|
78612
|
-
|
|
78613
|
-
|
|
78614
|
-
|
|
78615
|
-
|
|
78616
|
-
|
|
78617
|
-
|
|
78618
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
79645
|
-
name: "
|
|
79646
|
-
description: "
|
|
79647
|
-
descriptionShort: "
|
|
79648
|
-
descriptionMedium: "
|
|
79649
|
-
|
|
79650
|
-
["
|
|
79651
|
-
["
|
|
79652
|
-
|
|
79653
|
-
|
|
79654
|
-
|
|
79655
|
-
|
|
79656
|
-
|
|
79657
|
-
|
|
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
|
-
|
|
79667
|
-
["
|
|
79668
|
-
["
|
|
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
|
-
|
|
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
|
|
83041
|
-
name: "
|
|
83042
|
-
description: "
|
|
83043
|
-
descriptionShort: "
|
|
83044
|
-
descriptionMedium: "
|
|
83045
|
-
|
|
83046
|
-
|
|
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
|
-
|
|
83056
|
-
["
|
|
83057
|
-
["
|
|
83058
|
-
["
|
|
83059
|
-
|
|
83060
|
-
|
|
83061
|
-
|
|
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
|
|
|
@@ -83727,7 +83975,7 @@ var Completer = class {
|
|
|
83727
83975
|
resourceCtx.domain
|
|
83728
83976
|
);
|
|
83729
83977
|
if (resourceTypes.length > 0) {
|
|
83730
|
-
if (parsed.currentWord && !parsed.currentWord.startsWith("-")) {
|
|
83978
|
+
if (parsed.currentWord && !parsed.currentWord.startsWith("-") && parsed.currentWord.toLowerCase() !== resourceCtx.action) {
|
|
83731
83979
|
const filtered = this.filterSuggestions(
|
|
83732
83980
|
resourceTypes,
|
|
83733
83981
|
parsed.currentWord
|
|
@@ -83735,7 +83983,7 @@ var Completer = class {
|
|
|
83735
83983
|
if (filtered.length > 0) {
|
|
83736
83984
|
return filtered;
|
|
83737
83985
|
}
|
|
83738
|
-
} else if (!parsed.currentWord) {
|
|
83986
|
+
} else if (!parsed.currentWord || parsed.currentWord.toLowerCase() === resourceCtx.action) {
|
|
83739
83987
|
return [
|
|
83740
83988
|
...resourceTypes,
|
|
83741
83989
|
...this.getActionFlagSuggestions(resourceCtx.action)
|
|
@@ -83748,10 +83996,21 @@ var Completer = class {
|
|
|
83748
83996
|
const firstArg2 = parsed.args[0];
|
|
83749
83997
|
if (parsed.args.length > 0 && firstArg2 && !isStillTypingDomain) {
|
|
83750
83998
|
const targetDomain = firstArg2.toLowerCase();
|
|
83751
|
-
|
|
83752
|
-
|
|
83753
|
-
|
|
83754
|
-
|
|
83999
|
+
const domainNode = completionRegistry.get(targetDomain);
|
|
84000
|
+
const apiDomainInfo = getDomainInfo(targetDomain);
|
|
84001
|
+
if (domainNode || apiDomainInfo) {
|
|
84002
|
+
const isApiDomain = domainNode?.source === "api" || apiDomainInfo !== null;
|
|
84003
|
+
if (isApiDomain) {
|
|
84004
|
+
const hasAction = parsed.args.length > 1 && RESOURCE_ACTIONS.has(
|
|
84005
|
+
parsed.args[1]?.toLowerCase() ?? ""
|
|
84006
|
+
);
|
|
84007
|
+
if (!hasAction) {
|
|
84008
|
+
suggestions = this.getActionSuggestions();
|
|
84009
|
+
} else {
|
|
84010
|
+
suggestions = this.getActionFlagSuggestions(
|
|
84011
|
+
parsed.args[1]?.toLowerCase()
|
|
84012
|
+
);
|
|
84013
|
+
}
|
|
83755
84014
|
} else {
|
|
83756
84015
|
suggestions = completionRegistry.getChildSuggestions(
|
|
83757
84016
|
targetDomain,
|
|
@@ -83802,8 +84061,11 @@ var Completer = class {
|
|
|
83802
84061
|
if (args.length >= 2 && this.session) {
|
|
83803
84062
|
const cmdName = args[1]?.toLowerCase() ?? "";
|
|
83804
84063
|
const domain2 = customDomains.get(domainName);
|
|
83805
|
-
|
|
83806
|
-
|
|
84064
|
+
let cmd = domain2?.actions?.get(subgroupName)?.resources.get(cmdName);
|
|
84065
|
+
if (!cmd) {
|
|
84066
|
+
const subgroup = domain2?.subcommands.get(subgroupName);
|
|
84067
|
+
cmd = subgroup?.commands.get(cmdName);
|
|
84068
|
+
}
|
|
83807
84069
|
if (cmd?.completion) {
|
|
83808
84070
|
try {
|
|
83809
84071
|
const completions = await cmd.completion(
|
|
@@ -84074,11 +84336,22 @@ var Completer = class {
|
|
|
84074
84336
|
return ctx;
|
|
84075
84337
|
}
|
|
84076
84338
|
const navCtx = this.session.getContextPath();
|
|
84077
|
-
|
|
84078
|
-
if (
|
|
84339
|
+
let argOffset = 0;
|
|
84340
|
+
if (navCtx.domain) {
|
|
84341
|
+
ctx.domain = navCtx.domain;
|
|
84342
|
+
argOffset = 0;
|
|
84343
|
+
} else if (parsed.args.length > 0) {
|
|
84079
84344
|
const firstArg = parsed.args[0]?.toLowerCase() ?? "";
|
|
84080
|
-
|
|
84081
|
-
|
|
84345
|
+
const domainInfo = getDomainInfo(firstArg);
|
|
84346
|
+
if (domainInfo) {
|
|
84347
|
+
ctx.domain = firstArg;
|
|
84348
|
+
argOffset = 1;
|
|
84349
|
+
}
|
|
84350
|
+
}
|
|
84351
|
+
if (parsed.args.length > argOffset) {
|
|
84352
|
+
const actionArg = parsed.args[argOffset]?.toLowerCase() ?? "";
|
|
84353
|
+
if (RESOURCE_ACTIONS.has(actionArg)) {
|
|
84354
|
+
ctx.action = actionArg;
|
|
84082
84355
|
}
|
|
84083
84356
|
}
|
|
84084
84357
|
if (ctx.domain && ctx.action && RESOURCE_ACTIONS.has(ctx.action)) {
|
|
@@ -84086,7 +84359,7 @@ var Completer = class {
|
|
|
84086
84359
|
const resourceNames = new Set(
|
|
84087
84360
|
domainInfo?.primaryResources?.map((r) => r.name) ?? []
|
|
84088
84361
|
);
|
|
84089
|
-
for (let i = 1; i < parsed.args.length; i++) {
|
|
84362
|
+
for (let i = argOffset + 1; i < parsed.args.length; i++) {
|
|
84090
84363
|
const arg = parsed.args[i]?.toLowerCase() ?? "";
|
|
84091
84364
|
if (resourceNames.has(arg)) {
|
|
84092
84365
|
const isLastArg = i === parsed.args.length - 1;
|
|
@@ -84252,6 +84525,7 @@ var Completer = class {
|
|
|
84252
84525
|
if (resourceType && namespace) {
|
|
84253
84526
|
return this.completeResourceName(
|
|
84254
84527
|
resourceType,
|
|
84528
|
+
// Will be pluralized for API path (e.g., 'http_loadbalancer' → 'http_loadbalancers')
|
|
84255
84529
|
resourceType,
|
|
84256
84530
|
valuePartial,
|
|
84257
84531
|
namespace
|
|
@@ -84310,11 +84584,12 @@ var Completer = class {
|
|
|
84310
84584
|
}));
|
|
84311
84585
|
}
|
|
84312
84586
|
/**
|
|
84313
|
-
* Convert
|
|
84587
|
+
* Convert resource type to API resource path
|
|
84588
|
+
* F5 XC API paths keep underscores and use plural form
|
|
84589
|
+
* Example: http_loadbalancer → http_loadbalancers
|
|
84314
84590
|
*/
|
|
84315
|
-
domainToResourcePath(
|
|
84316
|
-
|
|
84317
|
-
return resourceName.endsWith("s") ? resourceName : `${resourceName}s`;
|
|
84591
|
+
domainToResourcePath(resourceType) {
|
|
84592
|
+
return resourceType.endsWith("s") ? resourceType : `${resourceType}s`;
|
|
84318
84593
|
}
|
|
84319
84594
|
/**
|
|
84320
84595
|
* Complete resource names with caching
|
|
@@ -84367,27 +84642,27 @@ var Completer = class {
|
|
|
84367
84642
|
// src/repl/hooks/useCompletion.ts
|
|
84368
84643
|
function useCompletion(options) {
|
|
84369
84644
|
const { session } = options;
|
|
84370
|
-
const [completer] = (0,
|
|
84645
|
+
const [completer] = (0, import_react32.useState)(() => {
|
|
84371
84646
|
const c = new Completer();
|
|
84372
84647
|
if (session) {
|
|
84373
84648
|
c.setSession(session);
|
|
84374
84649
|
}
|
|
84375
84650
|
return c;
|
|
84376
84651
|
});
|
|
84377
|
-
const [suggestions, setSuggestions] = (0,
|
|
84378
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
84379
|
-
const [isShowing, setIsShowing] = (0,
|
|
84380
|
-
(0,
|
|
84652
|
+
const [suggestions, setSuggestions] = (0, import_react32.useState)([]);
|
|
84653
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react32.useState)(0);
|
|
84654
|
+
const [isShowing, setIsShowing] = (0, import_react32.useState)(false);
|
|
84655
|
+
(0, import_react32.useEffect)(() => {
|
|
84381
84656
|
if (session) {
|
|
84382
84657
|
completer.setSession(session);
|
|
84383
84658
|
}
|
|
84384
84659
|
}, [session, completer]);
|
|
84385
|
-
const hide = (0,
|
|
84660
|
+
const hide = (0, import_react32.useCallback)(() => {
|
|
84386
84661
|
setIsShowing(false);
|
|
84387
84662
|
setSuggestions([]);
|
|
84388
84663
|
setSelectedIndex(0);
|
|
84389
84664
|
}, []);
|
|
84390
|
-
const triggerCompletion = (0,
|
|
84665
|
+
const triggerCompletion = (0, import_react32.useCallback)(
|
|
84391
84666
|
async (input) => {
|
|
84392
84667
|
const newSuggestions = await completer.complete(input);
|
|
84393
84668
|
if (newSuggestions.length === 1) {
|
|
@@ -84405,7 +84680,7 @@ function useCompletion(options) {
|
|
|
84405
84680
|
},
|
|
84406
84681
|
[completer, hide]
|
|
84407
84682
|
);
|
|
84408
|
-
const filterSuggestions = (0,
|
|
84683
|
+
const filterSuggestions = (0, import_react32.useCallback)(
|
|
84409
84684
|
async (input) => {
|
|
84410
84685
|
if (!isShowing) return;
|
|
84411
84686
|
const newSuggestions = await completer.complete(input);
|
|
@@ -84418,19 +84693,19 @@ function useCompletion(options) {
|
|
|
84418
84693
|
},
|
|
84419
84694
|
[completer, isShowing, hide]
|
|
84420
84695
|
);
|
|
84421
|
-
const navigateUp = (0,
|
|
84696
|
+
const navigateUp = (0, import_react32.useCallback)(() => {
|
|
84422
84697
|
if (!isShowing || suggestions.length === 0) return;
|
|
84423
84698
|
setSelectedIndex(
|
|
84424
84699
|
(current) => current > 0 ? current - 1 : suggestions.length - 1
|
|
84425
84700
|
);
|
|
84426
84701
|
}, [isShowing, suggestions.length]);
|
|
84427
|
-
const navigateDown = (0,
|
|
84702
|
+
const navigateDown = (0, import_react32.useCallback)(() => {
|
|
84428
84703
|
if (!isShowing || suggestions.length === 0) return;
|
|
84429
84704
|
setSelectedIndex(
|
|
84430
84705
|
(current) => current < suggestions.length - 1 ? current + 1 : 0
|
|
84431
84706
|
);
|
|
84432
84707
|
}, [isShowing, suggestions.length]);
|
|
84433
|
-
const selectCurrent = (0,
|
|
84708
|
+
const selectCurrent = (0, import_react32.useCallback)(() => {
|
|
84434
84709
|
if (!isShowing || suggestions.length === 0) return null;
|
|
84435
84710
|
const selected = suggestions.at(selectedIndex);
|
|
84436
84711
|
hide();
|
|
@@ -84450,7 +84725,7 @@ function useCompletion(options) {
|
|
|
84450
84725
|
}
|
|
84451
84726
|
|
|
84452
84727
|
// src/repl/hooks/useGitStatus.ts
|
|
84453
|
-
var
|
|
84728
|
+
var import_react33 = __toESM(require_react(), 1);
|
|
84454
84729
|
var DEFAULT_POLL_INTERVAL_MS = 3e4;
|
|
84455
84730
|
var MIN_POLL_INTERVAL_MS = 5e3;
|
|
84456
84731
|
function getPollInterval() {
|
|
@@ -84464,20 +84739,20 @@ function getPollInterval() {
|
|
|
84464
84739
|
function useGitStatus(options = {}) {
|
|
84465
84740
|
const { enabled = true } = options;
|
|
84466
84741
|
const pollIntervalMs = options.pollIntervalMs ?? getPollInterval();
|
|
84467
|
-
const [gitInfo, setGitInfo] = (0,
|
|
84468
|
-
const [lastRefresh, setLastRefresh] = (0,
|
|
84469
|
-
const intervalRef = (0,
|
|
84470
|
-
const refresh = (0,
|
|
84742
|
+
const [gitInfo, setGitInfo] = (0, import_react33.useState)(void 0);
|
|
84743
|
+
const [lastRefresh, setLastRefresh] = (0, import_react33.useState)(0);
|
|
84744
|
+
const intervalRef = (0, import_react33.useRef)(null);
|
|
84745
|
+
const refresh = (0, import_react33.useCallback)(() => {
|
|
84471
84746
|
const info = getGitInfo();
|
|
84472
84747
|
setGitInfo(info);
|
|
84473
84748
|
setLastRefresh(Date.now());
|
|
84474
84749
|
}, []);
|
|
84475
|
-
(0,
|
|
84750
|
+
(0, import_react33.useEffect)(() => {
|
|
84476
84751
|
if (enabled) {
|
|
84477
84752
|
refresh();
|
|
84478
84753
|
}
|
|
84479
84754
|
}, [enabled, refresh]);
|
|
84480
|
-
(0,
|
|
84755
|
+
(0, import_react33.useEffect)(() => {
|
|
84481
84756
|
if (!enabled || pollIntervalMs === 0) {
|
|
84482
84757
|
return;
|
|
84483
84758
|
}
|
|
@@ -85647,8 +85922,67 @@ function getBuiltinDescription(cmd) {
|
|
|
85647
85922
|
return descriptions.get(cmd) ?? "Built-in command";
|
|
85648
85923
|
}
|
|
85649
85924
|
|
|
85925
|
+
// src/debug/logger.ts
|
|
85926
|
+
import { appendFileSync, writeFileSync as writeFileSync2 } from "fs";
|
|
85927
|
+
import { resolve } from "path";
|
|
85928
|
+
var DEBUG_ENABLED = process.env.XCSH_DEBUG === "1" || process.env.DEBUG === "xcsh" || process.env.DEBUG === "*";
|
|
85929
|
+
var DEBUG_FILE = process.env.XCSH_DEBUG_FILE || "./xcsh-debug.log";
|
|
85930
|
+
if (DEBUG_ENABLED) {
|
|
85931
|
+
const logPath = resolve(DEBUG_FILE);
|
|
85932
|
+
try {
|
|
85933
|
+
writeFileSync2(
|
|
85934
|
+
logPath,
|
|
85935
|
+
`=== XCSH Debug Log Started at ${(/* @__PURE__ */ new Date()).toISOString()} ===
|
|
85936
|
+
`
|
|
85937
|
+
);
|
|
85938
|
+
console.error(`[DEBUG] Logging to: ${logPath}`);
|
|
85939
|
+
} catch (error) {
|
|
85940
|
+
console.error(`[DEBUG] Failed to initialize log file: ${error}`);
|
|
85941
|
+
}
|
|
85942
|
+
}
|
|
85943
|
+
function isCategoryEnabled(category) {
|
|
85944
|
+
if (!DEBUG_ENABLED) return false;
|
|
85945
|
+
const categoryFilter = process.env.XCSH_DEBUG_CATEGORY;
|
|
85946
|
+
if (!categoryFilter || categoryFilter === "all") return true;
|
|
85947
|
+
const enabledCategories = categoryFilter.split(",");
|
|
85948
|
+
return enabledCategories.includes(category);
|
|
85949
|
+
}
|
|
85950
|
+
function timestamp() {
|
|
85951
|
+
const now = /* @__PURE__ */ new Date();
|
|
85952
|
+
const ms = now.getMilliseconds().toString().padStart(3, "0");
|
|
85953
|
+
return `${now.toISOString().slice(11, 19)}.${ms}`;
|
|
85954
|
+
}
|
|
85955
|
+
function writeToLog(entry) {
|
|
85956
|
+
try {
|
|
85957
|
+
appendFileSync(DEBUG_FILE, entry + "\n");
|
|
85958
|
+
} catch {
|
|
85959
|
+
}
|
|
85960
|
+
}
|
|
85961
|
+
function debug(category, message, data) {
|
|
85962
|
+
if (!isCategoryEnabled(category)) return;
|
|
85963
|
+
const prefix = `[${timestamp()}] [${category.toUpperCase()}]`;
|
|
85964
|
+
let logEntry;
|
|
85965
|
+
if (data === void 0) {
|
|
85966
|
+
logEntry = `${prefix} ${message}`;
|
|
85967
|
+
} else if (typeof data === "object" && data !== null) {
|
|
85968
|
+
logEntry = `${prefix} ${message}
|
|
85969
|
+
${JSON.stringify(data, null, 2)}`;
|
|
85970
|
+
} else {
|
|
85971
|
+
logEntry = `${prefix} ${message}: ${data}`;
|
|
85972
|
+
}
|
|
85973
|
+
writeToLog(logEntry);
|
|
85974
|
+
}
|
|
85975
|
+
var debugOutput = (message, data) => debug("output", message, data);
|
|
85976
|
+
var debugRender = (message, data) => debug("render", message, data);
|
|
85977
|
+
var debugTerminal = (message, data) => debug("terminal", message, data);
|
|
85978
|
+
var debugBuffer = (message, data) => debug("buffer", message, data);
|
|
85979
|
+
function debugSeparator() {
|
|
85980
|
+
if (!DEBUG_ENABLED) return;
|
|
85981
|
+
writeToLog("\u2500".repeat(80));
|
|
85982
|
+
}
|
|
85983
|
+
|
|
85650
85984
|
// src/repl/App.tsx
|
|
85651
|
-
var
|
|
85985
|
+
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
85652
85986
|
function isValidDomain2(word) {
|
|
85653
85987
|
const lowerWord = word.toLowerCase();
|
|
85654
85988
|
if (isCustomDomain(lowerWord)) return true;
|
|
@@ -85668,11 +86002,11 @@ function toUISuggestions(suggestions) {
|
|
|
85668
86002
|
function App2({ initialSession } = {}) {
|
|
85669
86003
|
const { exit } = use_app_default();
|
|
85670
86004
|
const { stdout } = use_stdout_default();
|
|
85671
|
-
const [session] = (0,
|
|
85672
|
-
const [isInitialized, setIsInitialized] = (0,
|
|
85673
|
-
const [input, setInputState] = (0,
|
|
85674
|
-
const inputRef = (0,
|
|
85675
|
-
const setInput = (0,
|
|
86005
|
+
const [session] = (0, import_react34.useState)(() => initialSession ?? new REPLSession());
|
|
86006
|
+
const [isInitialized, setIsInitialized] = (0, import_react34.useState)(!!initialSession);
|
|
86007
|
+
const [input, setInputState] = (0, import_react34.useState)("");
|
|
86008
|
+
const inputRef = (0, import_react34.useRef)("");
|
|
86009
|
+
const setInput = (0, import_react34.useCallback)(
|
|
85676
86010
|
(value) => {
|
|
85677
86011
|
setInputState((prev) => {
|
|
85678
86012
|
const newValue = typeof value === "function" ? value(prev) : value;
|
|
@@ -85682,20 +86016,24 @@ function App2({ initialSession } = {}) {
|
|
|
85682
86016
|
},
|
|
85683
86017
|
[]
|
|
85684
86018
|
);
|
|
85685
|
-
const [outputItems, setOutputItems] = (0,
|
|
85686
|
-
const outputIdRef = (0,
|
|
85687
|
-
const
|
|
85688
|
-
const [
|
|
85689
|
-
const [
|
|
85690
|
-
const [
|
|
85691
|
-
const [
|
|
85692
|
-
const [
|
|
85693
|
-
const [
|
|
86019
|
+
const [outputItems, setOutputItems] = (0, import_react34.useState)([]);
|
|
86020
|
+
const outputIdRef = (0, import_react34.useRef)(0);
|
|
86021
|
+
const commandIdRef = (0, import_react34.useRef)(0);
|
|
86022
|
+
const [prompt, setPrompt] = (0, import_react34.useState)("> ");
|
|
86023
|
+
const [width, setWidth] = (0, import_react34.useState)(stdout?.columns ?? 80);
|
|
86024
|
+
const [statusHint, setStatusHint] = (0, import_react34.useState)("Ctrl+C twice to exit");
|
|
86025
|
+
const [historyArray, setHistoryArray] = (0, import_react34.useState)([]);
|
|
86026
|
+
const [inputKey, setInputKey] = (0, import_react34.useState)(0);
|
|
86027
|
+
const [hideStatusBar, setHideStatusBar] = (0, import_react34.useState)(false);
|
|
86028
|
+
const [pendingRawStdout, setPendingRawStdout] = (0, import_react34.useState)(
|
|
85694
86029
|
null
|
|
85695
86030
|
);
|
|
85696
|
-
const [mode, setMode] = (0,
|
|
85697
|
-
|
|
85698
|
-
|
|
86031
|
+
const [mode, setMode] = (0, import_react34.useState)(
|
|
86032
|
+
"repl"
|
|
86033
|
+
);
|
|
86034
|
+
const [chatConfig, setChatConfig] = (0, import_react34.useState)(null);
|
|
86035
|
+
const [profileDeleteConfig, setProfileDeleteConfig] = (0, import_react34.useState)(null);
|
|
86036
|
+
(0, import_react34.useEffect)(() => {
|
|
85699
86037
|
if (hideStatusBar && pendingRawStdout) {
|
|
85700
86038
|
process.stdout.write(pendingRawStdout);
|
|
85701
86039
|
process.stdout.write("\n\n\n");
|
|
@@ -85724,7 +86062,7 @@ function App2({ initialSession } = {}) {
|
|
|
85724
86062
|
session.saveHistory().finally(() => exit());
|
|
85725
86063
|
}
|
|
85726
86064
|
});
|
|
85727
|
-
(0,
|
|
86065
|
+
(0, import_react34.useEffect)(() => {
|
|
85728
86066
|
const init = async () => {
|
|
85729
86067
|
if (!isInitialized) {
|
|
85730
86068
|
await session.initialize();
|
|
@@ -85738,37 +86076,85 @@ function App2({ initialSession } = {}) {
|
|
|
85738
86076
|
};
|
|
85739
86077
|
init();
|
|
85740
86078
|
}, [session]);
|
|
85741
|
-
(0,
|
|
86079
|
+
(0, import_react34.useEffect)(() => {
|
|
85742
86080
|
const handleResize = () => {
|
|
85743
86081
|
if (stdout) {
|
|
85744
86082
|
const newWidth = stdout.columns ?? 80;
|
|
86083
|
+
const newHeight = stdout.rows ?? 24;
|
|
86084
|
+
debugTerminal("Terminal resized", {
|
|
86085
|
+
width: newWidth,
|
|
86086
|
+
height: newHeight,
|
|
86087
|
+
previousWidth: width
|
|
86088
|
+
});
|
|
85745
86089
|
setWidth(newWidth);
|
|
85746
86090
|
setTerminalWidth(newWidth);
|
|
85747
86091
|
}
|
|
85748
86092
|
};
|
|
85749
86093
|
if (stdout) {
|
|
85750
|
-
|
|
86094
|
+
const initialWidth = stdout.columns ?? 80;
|
|
86095
|
+
const initialHeight = stdout.rows ?? 24;
|
|
86096
|
+
debugTerminal("Terminal initialized", {
|
|
86097
|
+
width: initialWidth,
|
|
86098
|
+
height: initialHeight
|
|
86099
|
+
});
|
|
86100
|
+
setTerminalWidth(initialWidth);
|
|
85751
86101
|
}
|
|
85752
86102
|
stdout?.on("resize", handleResize);
|
|
85753
86103
|
return () => {
|
|
85754
86104
|
stdout?.off("resize", handleResize);
|
|
85755
86105
|
};
|
|
85756
|
-
}, [stdout]);
|
|
85757
|
-
const addOutput = (0,
|
|
86106
|
+
}, [stdout, width]);
|
|
86107
|
+
const addOutput = (0, import_react34.useCallback)((line) => {
|
|
85758
86108
|
const lines = line.split("\n");
|
|
86109
|
+
const currentCommandId = commandIdRef.current;
|
|
85759
86110
|
const newItems = lines.map((content) => ({
|
|
85760
86111
|
id: outputIdRef.current++,
|
|
85761
|
-
content
|
|
86112
|
+
content,
|
|
86113
|
+
commandId: currentCommandId
|
|
85762
86114
|
}));
|
|
86115
|
+
debugOutput("Adding output lines", {
|
|
86116
|
+
inputLineCount: 1,
|
|
86117
|
+
splitLineCount: lines.length,
|
|
86118
|
+
newItemsCount: newItems.length,
|
|
86119
|
+
commandId: currentCommandId,
|
|
86120
|
+
firstLineLength: lines[0]?.length,
|
|
86121
|
+
firstLinePreview: lines[0]?.slice(0, 80)
|
|
86122
|
+
});
|
|
85763
86123
|
setOutputItems((prev) => {
|
|
85764
86124
|
const combined = [...prev, ...newItems];
|
|
85765
|
-
|
|
85766
|
-
|
|
86125
|
+
const uniqueCommands = new Set(
|
|
86126
|
+
combined.map((item) => item.commandId)
|
|
86127
|
+
);
|
|
86128
|
+
const commandCount = uniqueCommands.size;
|
|
86129
|
+
debugBuffer("Buffer state before truncation", {
|
|
86130
|
+
previousItemCount: prev.length,
|
|
86131
|
+
newItemsCount: newItems.length,
|
|
86132
|
+
combinedItemCount: combined.length,
|
|
86133
|
+
commandCount,
|
|
86134
|
+
willTruncate: commandCount > 3
|
|
86135
|
+
});
|
|
86136
|
+
if (commandCount > 3) {
|
|
86137
|
+
const recentCommandIds = Array.from(uniqueCommands).sort((a, b) => b - a).slice(0, 3);
|
|
86138
|
+
const truncated = combined.filter(
|
|
86139
|
+
(item) => recentCommandIds.includes(item.commandId)
|
|
86140
|
+
);
|
|
86141
|
+
debugBuffer("Buffer truncated by command boundary", {
|
|
86142
|
+
beforeCount: combined.length,
|
|
86143
|
+
afterCount: truncated.length,
|
|
86144
|
+
itemsRemoved: combined.length - truncated.length,
|
|
86145
|
+
commandsRemoved: commandCount - 3,
|
|
86146
|
+
keptCommandIds: recentCommandIds
|
|
86147
|
+
});
|
|
86148
|
+
return truncated;
|
|
85767
86149
|
}
|
|
86150
|
+
debugBuffer("Buffer updated without truncation", {
|
|
86151
|
+
finalItemCount: combined.length,
|
|
86152
|
+
commandCount
|
|
86153
|
+
});
|
|
85768
86154
|
return combined;
|
|
85769
86155
|
});
|
|
85770
86156
|
}, []);
|
|
85771
|
-
const applyCompletion = (0,
|
|
86157
|
+
const applyCompletion = (0, import_react34.useCallback)(
|
|
85772
86158
|
(suggestion) => {
|
|
85773
86159
|
const currentInput = inputRef.current;
|
|
85774
86160
|
let newValue;
|
|
@@ -85796,30 +86182,60 @@ function App2({ initialSession } = {}) {
|
|
|
85796
86182
|
[]
|
|
85797
86183
|
// No dependencies needed since we use inputRef
|
|
85798
86184
|
);
|
|
85799
|
-
const refreshHistory = (0,
|
|
86185
|
+
const refreshHistory = (0, import_react34.useCallback)(() => {
|
|
85800
86186
|
const histMgr = session.getHistory();
|
|
85801
86187
|
if (histMgr) {
|
|
85802
86188
|
setHistoryArray(histMgr.getHistory());
|
|
85803
86189
|
}
|
|
85804
86190
|
}, [session]);
|
|
85805
|
-
const runCommand = (0,
|
|
86191
|
+
const runCommand = (0, import_react34.useCallback)(
|
|
85806
86192
|
async (cmd) => {
|
|
85807
86193
|
const trimmed = cmd.trim();
|
|
85808
86194
|
if (!trimmed) return;
|
|
86195
|
+
debugSeparator();
|
|
86196
|
+
debugOutput("Command execution started", {
|
|
86197
|
+
command: trimmed,
|
|
86198
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
86199
|
+
currentBufferSize: outputItems.length
|
|
86200
|
+
});
|
|
86201
|
+
commandIdRef.current++;
|
|
85809
86202
|
const scrollbackCommand = `${colorBlue("\u23FA")} ${colorBoldWhite(prompt + trimmed)}`;
|
|
85810
86203
|
addOutput(scrollbackCommand);
|
|
85811
86204
|
const result = await executeCommand(trimmed, session);
|
|
86205
|
+
debugOutput("Command execution completed", {
|
|
86206
|
+
command: trimmed,
|
|
86207
|
+
outputLineCount: result.output.length,
|
|
86208
|
+
shouldExit: result.shouldExit,
|
|
86209
|
+
shouldClear: result.shouldClear,
|
|
86210
|
+
hasRawStdout: !!result.rawStdout,
|
|
86211
|
+
enterChatMode: result.enterChatMode,
|
|
86212
|
+
enterProfileDeleteMode: result.enterProfileDeleteMode
|
|
86213
|
+
});
|
|
85812
86214
|
if (result.enterChatMode && result.chatConfig) {
|
|
85813
86215
|
setMode("chat");
|
|
85814
86216
|
setChatConfig(result.chatConfig);
|
|
85815
86217
|
return;
|
|
85816
86218
|
}
|
|
86219
|
+
if (result.enterProfileDeleteMode && result.profileDeleteConfig) {
|
|
86220
|
+
setMode("profile-delete");
|
|
86221
|
+
setProfileDeleteConfig(result.profileDeleteConfig);
|
|
86222
|
+
return;
|
|
86223
|
+
}
|
|
85817
86224
|
if (result.rawStdout) {
|
|
85818
86225
|
setHideStatusBar(true);
|
|
85819
86226
|
setPendingRawStdout(result.rawStdout);
|
|
85820
86227
|
} else if (result.shouldClear) {
|
|
86228
|
+
debugOutput("Clearing output buffer");
|
|
85821
86229
|
setOutputItems([]);
|
|
85822
86230
|
} else {
|
|
86231
|
+
debugOutput("Processing output lines", {
|
|
86232
|
+
totalLines: result.output.length,
|
|
86233
|
+
firstLine: result.output[0]?.slice(0, 100),
|
|
86234
|
+
lastLine: result.output[result.output.length - 1]?.slice(
|
|
86235
|
+
0,
|
|
86236
|
+
100
|
|
86237
|
+
)
|
|
86238
|
+
});
|
|
85823
86239
|
result.output.forEach((line) => addOutput(line));
|
|
85824
86240
|
}
|
|
85825
86241
|
if (result.shouldExit) {
|
|
@@ -85839,7 +86255,7 @@ function App2({ initialSession } = {}) {
|
|
|
85839
86255
|
},
|
|
85840
86256
|
[session, prompt, addOutput, exit, refreshHistory, gitStatus]
|
|
85841
86257
|
);
|
|
85842
|
-
const handleInputChange = (0,
|
|
86258
|
+
const handleInputChange = (0, import_react34.useCallback)(
|
|
85843
86259
|
(newValue) => {
|
|
85844
86260
|
const oldValue = input;
|
|
85845
86261
|
setInput(newValue);
|
|
@@ -85867,7 +86283,7 @@ function App2({ initialSession } = {}) {
|
|
|
85867
86283
|
},
|
|
85868
86284
|
[input, completion]
|
|
85869
86285
|
);
|
|
85870
|
-
const handleSubmit = (0,
|
|
86286
|
+
const handleSubmit = (0, import_react34.useCallback)(
|
|
85871
86287
|
async (value) => {
|
|
85872
86288
|
if (completion.isShowing && completion.suggestions.length > 0) {
|
|
85873
86289
|
const selected = completion.selectCurrent();
|
|
@@ -85965,7 +86381,7 @@ function App2({ initialSession } = {}) {
|
|
|
85965
86381
|
return;
|
|
85966
86382
|
}
|
|
85967
86383
|
});
|
|
85968
|
-
const handleSuggestionNavigate = (0,
|
|
86384
|
+
const handleSuggestionNavigate = (0, import_react34.useCallback)(
|
|
85969
86385
|
(direction) => {
|
|
85970
86386
|
if (direction === "up") {
|
|
85971
86387
|
completion.navigateUp();
|
|
@@ -85975,14 +86391,14 @@ function App2({ initialSession } = {}) {
|
|
|
85975
86391
|
},
|
|
85976
86392
|
[completion]
|
|
85977
86393
|
);
|
|
85978
|
-
const handleSuggestionSelect = (0,
|
|
86394
|
+
const handleSuggestionSelect = (0, import_react34.useCallback)(
|
|
85979
86395
|
(suggestion) => {
|
|
85980
86396
|
applyCompletion(suggestion);
|
|
85981
86397
|
completion.hide();
|
|
85982
86398
|
},
|
|
85983
86399
|
[applyCompletion, completion]
|
|
85984
86400
|
);
|
|
85985
|
-
const handleChatExit = (0,
|
|
86401
|
+
const handleChatExit = (0, import_react34.useCallback)(
|
|
85986
86402
|
(chatMessages) => {
|
|
85987
86403
|
chatMessages.forEach((msg) => addOutput(msg));
|
|
85988
86404
|
setMode("repl");
|
|
@@ -85990,9 +86406,41 @@ function App2({ initialSession } = {}) {
|
|
|
85990
86406
|
},
|
|
85991
86407
|
[addOutput]
|
|
85992
86408
|
);
|
|
85993
|
-
|
|
85994
|
-
|
|
85995
|
-
|
|
86409
|
+
const handleProfileDeleteExit = (0, import_react34.useCallback)(
|
|
86410
|
+
(success, messages) => {
|
|
86411
|
+
messages.forEach((msg) => addOutput(msg));
|
|
86412
|
+
if (success && profileDeleteConfig?.isActive) {
|
|
86413
|
+
setPrompt(buildPlainPrompt(session));
|
|
86414
|
+
}
|
|
86415
|
+
setMode("repl");
|
|
86416
|
+
setProfileDeleteConfig(null);
|
|
86417
|
+
setInput("");
|
|
86418
|
+
setInputKey((prev) => prev + 1);
|
|
86419
|
+
},
|
|
86420
|
+
[addOutput, session, profileDeleteConfig, setInput]
|
|
86421
|
+
);
|
|
86422
|
+
(0, import_react34.useEffect)(() => {
|
|
86423
|
+
const uniqueCommands = new Set(
|
|
86424
|
+
outputItems.map((item) => item.commandId)
|
|
86425
|
+
);
|
|
86426
|
+
debugRender("Static component render triggered", {
|
|
86427
|
+
itemCount: outputItems.length,
|
|
86428
|
+
commandCount: uniqueCommands.size,
|
|
86429
|
+
terminalWidth: width,
|
|
86430
|
+
terminalHeight: stdout?.rows ?? "unknown",
|
|
86431
|
+
firstItemId: outputItems[0]?.id,
|
|
86432
|
+
firstCommandId: outputItems[0]?.commandId,
|
|
86433
|
+
lastItemId: outputItems[outputItems.length - 1]?.id,
|
|
86434
|
+
lastCommandId: outputItems[outputItems.length - 1]?.commandId,
|
|
86435
|
+
lastItemContent: outputItems[outputItems.length - 1]?.content.slice(
|
|
86436
|
+
0,
|
|
86437
|
+
100
|
|
86438
|
+
)
|
|
86439
|
+
});
|
|
86440
|
+
}, [outputItems, width, stdout]);
|
|
86441
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", width, children: [
|
|
86442
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Static, { items: outputItems, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: item.content }, item.id) }),
|
|
86443
|
+
isInitialized && !hideStatusBar ? mode === "chat" && chatConfig ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
85996
86444
|
ChatMode,
|
|
85997
86445
|
{
|
|
85998
86446
|
session,
|
|
@@ -86000,8 +86448,17 @@ function App2({ initialSession } = {}) {
|
|
|
86000
86448
|
width,
|
|
86001
86449
|
onExit: handleChatExit
|
|
86002
86450
|
}
|
|
86003
|
-
) : /* @__PURE__ */ (0,
|
|
86004
|
-
|
|
86451
|
+
) : mode === "profile-delete" && profileDeleteConfig ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
86452
|
+
ProfileDeleteWizard,
|
|
86453
|
+
{
|
|
86454
|
+
profileToDelete: profileDeleteConfig.profileName,
|
|
86455
|
+
isActive: profileDeleteConfig.isActive,
|
|
86456
|
+
session,
|
|
86457
|
+
width,
|
|
86458
|
+
onExit: handleProfileDeleteExit
|
|
86459
|
+
}
|
|
86460
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
86461
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
86005
86462
|
InputBox,
|
|
86006
86463
|
{
|
|
86007
86464
|
prompt,
|
|
@@ -86013,7 +86470,7 @@ function App2({ initialSession } = {}) {
|
|
|
86013
86470
|
inputKey
|
|
86014
86471
|
}
|
|
86015
86472
|
),
|
|
86016
|
-
completion.isShowing && completion.suggestions.length > 0 ? /* @__PURE__ */ (0,
|
|
86473
|
+
completion.isShowing && completion.suggestions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
86017
86474
|
Suggestions,
|
|
86018
86475
|
{
|
|
86019
86476
|
suggestions: toUISuggestions(
|
|
@@ -86026,7 +86483,7 @@ function App2({ initialSession } = {}) {
|
|
|
86026
86483
|
maxVisible: 20,
|
|
86027
86484
|
isActive: false
|
|
86028
86485
|
}
|
|
86029
|
-
) : /* @__PURE__ */ (0,
|
|
86486
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
86030
86487
|
StatusBar,
|
|
86031
86488
|
{
|
|
86032
86489
|
gitInfo: gitStatus.gitInfo,
|
|
@@ -86034,7 +86491,7 @@ function App2({ initialSession } = {}) {
|
|
|
86034
86491
|
hint: statusHint
|
|
86035
86492
|
}
|
|
86036
86493
|
)
|
|
86037
|
-
] }) : !isInitialized ? /* @__PURE__ */ (0,
|
|
86494
|
+
] }) : !isInitialized ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "Initializing..." }) : null
|
|
86038
86495
|
] });
|
|
86039
86496
|
}
|
|
86040
86497
|
|
|
@@ -86347,7 +86804,7 @@ var HeadlessController = class {
|
|
|
86347
86804
|
};
|
|
86348
86805
|
|
|
86349
86806
|
// src/index.tsx
|
|
86350
|
-
var
|
|
86807
|
+
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
86351
86808
|
var profiler = initProfiler();
|
|
86352
86809
|
var importsSpan = profiler.startSpan("imports", "Module Imports");
|
|
86353
86810
|
profiler.memorySnapshot("script_start");
|
|
@@ -86513,7 +86970,7 @@ program2.name(CLI_NAME).description("F5 Distributed Cloud Shell - Interactive CL
|
|
|
86513
86970
|
}
|
|
86514
86971
|
process.stdin.resume();
|
|
86515
86972
|
const appProps = { initialSession: session };
|
|
86516
|
-
render_default(/* @__PURE__ */ (0,
|
|
86973
|
+
render_default(/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(App2, { ...appProps }), { exitOnCtrlC: false });
|
|
86517
86974
|
return;
|
|
86518
86975
|
}
|
|
86519
86976
|
await executeNonInteractive(commandArgs);
|