@robinmordasiewicz/f5xc-xcsh 2.0.21-2601101304 → 2.0.21-2601130605
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/completions/_xcsh +3 -3
- package/completions/xcsh.bash +20 -20
- package/completions/xcsh.fish +25 -32
- package/dist/index.js +1246 -668
- 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-2601130605") {
|
|
49219
|
+
return "v2.0.21-2601130605";
|
|
49220
49220
|
}
|
|
49221
49221
|
if (process.env.XCSH_VERSION) {
|
|
49222
49222
|
return process.env.XCSH_VERSION;
|
|
@@ -49643,7 +49643,7 @@ function calculateBackoffDelay(attempt, config) {
|
|
|
49643
49643
|
return cappedDelay;
|
|
49644
49644
|
}
|
|
49645
49645
|
function sleep(ms) {
|
|
49646
|
-
return new Promise((
|
|
49646
|
+
return new Promise((resolve2) => setTimeout(resolve2, ms));
|
|
49647
49647
|
}
|
|
49648
49648
|
var APIClient = class {
|
|
49649
49649
|
serverUrl;
|
|
@@ -50512,15 +50512,33 @@ var DEFAULT_RESOURCE_COLUMNS = [
|
|
|
50512
50512
|
{ header: "NAME", accessor: "name", minWidth: 10, maxWidth: 40 },
|
|
50513
50513
|
{ header: "LABELS", accessor: "labels", minWidth: 10, maxWidth: 35 }
|
|
50514
50514
|
];
|
|
50515
|
+
var TOP_LEVEL_RESOURCE_COLUMNS = [
|
|
50516
|
+
{ header: "NAME", accessor: "name", minWidth: 10, maxWidth: 30 },
|
|
50517
|
+
{
|
|
50518
|
+
header: "DESCRIPTION",
|
|
50519
|
+
accessor: "description",
|
|
50520
|
+
minWidth: 15,
|
|
50521
|
+
maxWidth: 50
|
|
50522
|
+
},
|
|
50523
|
+
{ header: "LABELS", accessor: "labels", minWidth: 10, maxWidth: 35 }
|
|
50524
|
+
];
|
|
50525
|
+
function isTopLevelResource(items) {
|
|
50526
|
+
if (items.length === 0) return false;
|
|
50527
|
+
return items.every((item) => {
|
|
50528
|
+
const ns = item.namespace;
|
|
50529
|
+
return ns === "" || ns === null || ns === void 0;
|
|
50530
|
+
});
|
|
50531
|
+
}
|
|
50515
50532
|
function formatResourceTable(data, noColor = false) {
|
|
50516
50533
|
const items = extractItems(data);
|
|
50517
50534
|
if (items.length === 0) {
|
|
50518
50535
|
return "";
|
|
50519
50536
|
}
|
|
50537
|
+
const columns = isTopLevelResource(items) ? TOP_LEVEL_RESOURCE_COLUMNS : DEFAULT_RESOURCE_COLUMNS;
|
|
50520
50538
|
return formatBeautifulTable(
|
|
50521
50539
|
items,
|
|
50522
50540
|
{
|
|
50523
|
-
columns
|
|
50541
|
+
columns,
|
|
50524
50542
|
wrapText: true
|
|
50525
50543
|
},
|
|
50526
50544
|
noColor
|
|
@@ -74769,36 +74787,6 @@ function formatCustomDomainHelp(domain) {
|
|
|
74769
74787
|
output.push("");
|
|
74770
74788
|
return output;
|
|
74771
74789
|
}
|
|
74772
|
-
function formatSubcommandHelp(domainName, subcommand) {
|
|
74773
|
-
const output = [
|
|
74774
|
-
"",
|
|
74775
|
-
colorBoldWhite(`${domainName} ${subcommand.name}`),
|
|
74776
|
-
""
|
|
74777
|
-
];
|
|
74778
|
-
output.push("DESCRIPTION");
|
|
74779
|
-
output.push(...wrapText3(subcommand.description, 80, 2));
|
|
74780
|
-
output.push("");
|
|
74781
|
-
output.push("USAGE");
|
|
74782
|
-
output.push(
|
|
74783
|
-
` ${CLI_NAME} ${domainName} ${subcommand.name} <command> [options]`
|
|
74784
|
-
);
|
|
74785
|
-
output.push("");
|
|
74786
|
-
if (subcommand.commands.size > 0) {
|
|
74787
|
-
output.push("COMMANDS");
|
|
74788
|
-
for (const [name, cmd] of subcommand.commands) {
|
|
74789
|
-
const usage = cmd.usage ? ` ${cmd.usage}` : "";
|
|
74790
|
-
output.push(
|
|
74791
|
-
` ${name}${usage.padEnd(16 - name.length)} ${cmd.descriptionShort}`
|
|
74792
|
-
);
|
|
74793
|
-
}
|
|
74794
|
-
output.push("");
|
|
74795
|
-
}
|
|
74796
|
-
output.push(
|
|
74797
|
-
colorDim(`For domain help, run: ${CLI_NAME} ${domainName} --help`)
|
|
74798
|
-
);
|
|
74799
|
-
output.push("");
|
|
74800
|
-
return output;
|
|
74801
|
-
}
|
|
74802
74790
|
|
|
74803
74791
|
// src/domains/registry.ts
|
|
74804
74792
|
var DomainRegistry = class {
|
|
@@ -74863,59 +74851,15 @@ var DomainRegistry = class {
|
|
|
74863
74851
|
if (firstArg === "--help" || firstArg === "-h" || firstArg === "help") {
|
|
74864
74852
|
return this.showDomainHelp(domain);
|
|
74865
74853
|
}
|
|
74866
|
-
const
|
|
74867
|
-
if (
|
|
74868
|
-
|
|
74869
|
-
|
|
74870
|
-
|
|
74871
|
-
|
|
74872
|
-
|
|
74873
|
-
|
|
74874
|
-
|
|
74875
|
-
if (cmdName === "--help" || cmdName === "-h" || cmdName === "help") {
|
|
74876
|
-
return this.showSubcommandHelp(domain, subgroup);
|
|
74877
|
-
}
|
|
74878
|
-
const cmdArgs = restArgs.slice(1);
|
|
74879
|
-
const cmd2 = subgroup.commands.get(cmdName);
|
|
74880
|
-
if (cmd2) {
|
|
74881
|
-
const commandPath = `${domainName} ${firstArg} ${cmdName}`;
|
|
74882
|
-
const validationError = this.validateCommandArgs(
|
|
74883
|
-
cmd2,
|
|
74884
|
-
cmdArgs,
|
|
74885
|
-
subgroup.commands,
|
|
74886
|
-
commandPath
|
|
74887
|
-
);
|
|
74888
|
-
if (validationError) {
|
|
74889
|
-
return validationError;
|
|
74890
|
-
}
|
|
74891
|
-
return cmd2.execute(cmdArgs, session);
|
|
74892
|
-
}
|
|
74893
|
-
for (const [, command] of subgroup.commands) {
|
|
74894
|
-
if (command.aliases?.includes(cmdName)) {
|
|
74895
|
-
const commandPath = `${domainName} ${firstArg} ${command.name}`;
|
|
74896
|
-
const validationError = this.validateCommandArgs(
|
|
74897
|
-
command,
|
|
74898
|
-
cmdArgs,
|
|
74899
|
-
subgroup.commands,
|
|
74900
|
-
commandPath
|
|
74901
|
-
);
|
|
74902
|
-
if (validationError) {
|
|
74903
|
-
return validationError;
|
|
74904
|
-
}
|
|
74905
|
-
return command.execute(cmdArgs, session);
|
|
74906
|
-
}
|
|
74907
|
-
}
|
|
74908
|
-
return {
|
|
74909
|
-
output: [
|
|
74910
|
-
`Unknown command: ${domainName} ${firstArg} ${cmdName}`,
|
|
74911
|
-
``,
|
|
74912
|
-
`Run '${domainName} ${firstArg}' for available commands.`
|
|
74913
|
-
],
|
|
74914
|
-
shouldExit: false,
|
|
74915
|
-
shouldClear: false,
|
|
74916
|
-
contextChanged: false,
|
|
74917
|
-
error: "Unknown command"
|
|
74918
|
-
};
|
|
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
|
+
);
|
|
74919
74863
|
}
|
|
74920
74864
|
const cmd = domain.commands.get(firstArg);
|
|
74921
74865
|
if (cmd) {
|
|
@@ -74958,6 +74902,90 @@ var DomainRegistry = class {
|
|
|
74958
74902
|
error: "Unknown command"
|
|
74959
74903
|
};
|
|
74960
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
|
+
}
|
|
74961
74989
|
/**
|
|
74962
74990
|
* Get completions for a domain command
|
|
74963
74991
|
*/
|
|
@@ -74968,13 +74996,15 @@ var DomainRegistry = class {
|
|
|
74968
74996
|
}
|
|
74969
74997
|
const suggestions = [];
|
|
74970
74998
|
if (args.length === 0) {
|
|
74971
|
-
|
|
74972
|
-
|
|
74973
|
-
|
|
74974
|
-
|
|
74975
|
-
|
|
74976
|
-
|
|
74977
|
-
|
|
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
|
+
}
|
|
74978
75008
|
}
|
|
74979
75009
|
}
|
|
74980
75010
|
for (const [name, cmd] of domain.commands) {
|
|
@@ -74989,22 +75019,22 @@ var DomainRegistry = class {
|
|
|
74989
75019
|
return suggestions;
|
|
74990
75020
|
}
|
|
74991
75021
|
const firstArg = args[0]?.toLowerCase() ?? "";
|
|
74992
|
-
const
|
|
74993
|
-
if (
|
|
74994
|
-
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) {
|
|
74995
75025
|
if (name.toLowerCase().startsWith(partial.toLowerCase())) {
|
|
74996
75026
|
suggestions.push({
|
|
74997
75027
|
text: name,
|
|
74998
75028
|
description: cmd.descriptionShort,
|
|
74999
|
-
category: "
|
|
75029
|
+
category: "resource"
|
|
75000
75030
|
});
|
|
75001
75031
|
}
|
|
75002
75032
|
}
|
|
75003
75033
|
return suggestions;
|
|
75004
75034
|
}
|
|
75005
|
-
if (
|
|
75006
|
-
const
|
|
75007
|
-
const cmd =
|
|
75035
|
+
if (actionGroup && args.length >= 2) {
|
|
75036
|
+
const resourceName = args[1]?.toLowerCase() ?? "";
|
|
75037
|
+
const cmd = actionGroup.resources.get(resourceName);
|
|
75008
75038
|
if (cmd?.completion) {
|
|
75009
75039
|
const completions = await cmd.completion(
|
|
75010
75040
|
partial,
|
|
@@ -75018,6 +75048,19 @@ var DomainRegistry = class {
|
|
|
75018
75048
|
}));
|
|
75019
75049
|
}
|
|
75020
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
|
+
}
|
|
75021
75064
|
return suggestions;
|
|
75022
75065
|
}
|
|
75023
75066
|
/**
|
|
@@ -75032,18 +75075,6 @@ var DomainRegistry = class {
|
|
|
75032
75075
|
contextChanged: false
|
|
75033
75076
|
};
|
|
75034
75077
|
}
|
|
75035
|
-
/**
|
|
75036
|
-
* Show help for a subcommand group using the unified help formatter.
|
|
75037
|
-
* This ensures consistent professional formatting across all subcommands.
|
|
75038
|
-
*/
|
|
75039
|
-
showSubcommandHelp(domain, subgroup) {
|
|
75040
|
-
return {
|
|
75041
|
-
output: formatSubcommandHelp(domain.name, subgroup),
|
|
75042
|
-
shouldExit: false,
|
|
75043
|
-
shouldClear: false,
|
|
75044
|
-
contextChanged: false
|
|
75045
|
-
};
|
|
75046
|
-
}
|
|
75047
75078
|
/**
|
|
75048
75079
|
* Filter out global flags from command arguments.
|
|
75049
75080
|
* Returns args without global flags like --output/-o.
|
|
@@ -75942,6 +75973,8 @@ var REPLSession = class {
|
|
|
75942
75973
|
_fallbackReason = null;
|
|
75943
75974
|
// Connection status for graceful offline handling
|
|
75944
75975
|
_connectionStatus = "unknown";
|
|
75976
|
+
// Track if environment variables are present (for display purposes)
|
|
75977
|
+
_envVarsPresent = false;
|
|
75945
75978
|
constructor(config = {}) {
|
|
75946
75979
|
this._namespace = config.namespace ?? this.getDefaultNamespace();
|
|
75947
75980
|
this._contextPath = new ContextPath();
|
|
@@ -75949,6 +75982,7 @@ var REPLSession = class {
|
|
|
75949
75982
|
this._profileManager = getProfileManager();
|
|
75950
75983
|
const envUrl = process.env[`${ENV_PREFIX}_API_URL`];
|
|
75951
75984
|
const envToken = process.env[`${ENV_PREFIX}_API_TOKEN`];
|
|
75985
|
+
this._envVarsPresent = !!(envUrl || envToken);
|
|
75952
75986
|
this._serverUrl = config.serverUrl ?? envUrl ?? "";
|
|
75953
75987
|
this._apiToken = config.apiToken ?? envToken ?? "";
|
|
75954
75988
|
if (envUrl && envToken) {
|
|
@@ -76147,8 +76181,9 @@ var REPLSession = class {
|
|
|
76147
76181
|
}
|
|
76148
76182
|
/**
|
|
76149
76183
|
* Load the active profile from profile manager
|
|
76150
|
-
*
|
|
76151
|
-
*
|
|
76184
|
+
* Profile credentials ALWAYS take priority when a profile is active.
|
|
76185
|
+
* Environment variables are only used when NO profile is active (fallback for scripts/CI).
|
|
76186
|
+
* If no active profile is set but exactly one profile exists, auto-activate it.
|
|
76152
76187
|
*/
|
|
76153
76188
|
async loadActiveProfile() {
|
|
76154
76189
|
try {
|
|
@@ -76166,28 +76201,18 @@ var REPLSession = class {
|
|
|
76166
76201
|
if (profile) {
|
|
76167
76202
|
this._activeProfileName = activeName;
|
|
76168
76203
|
this._activeProfile = profile;
|
|
76169
|
-
|
|
76170
|
-
const envToken = process.env[`${ENV_PREFIX}_API_TOKEN`];
|
|
76171
|
-
const envNamespace = process.env[`${ENV_PREFIX}_NAMESPACE`];
|
|
76172
|
-
let usingProfileUrl = false;
|
|
76173
|
-
let usingProfileToken = false;
|
|
76174
|
-
if (!envUrl && profile.apiUrl) {
|
|
76204
|
+
if (profile.apiUrl) {
|
|
76175
76205
|
this._serverUrl = profile.apiUrl;
|
|
76176
76206
|
this._tenant = this.extractTenant(profile.apiUrl);
|
|
76177
|
-
usingProfileUrl = true;
|
|
76178
76207
|
}
|
|
76179
|
-
if (
|
|
76208
|
+
if (profile.apiToken) {
|
|
76180
76209
|
this._apiToken = profile.apiToken;
|
|
76181
|
-
usingProfileToken = true;
|
|
76182
76210
|
}
|
|
76211
|
+
const envNamespace = process.env[`${ENV_PREFIX}_NAMESPACE`];
|
|
76183
76212
|
if (!envNamespace && profile.defaultNamespace) {
|
|
76184
76213
|
this._namespace = profile.defaultNamespace;
|
|
76185
76214
|
}
|
|
76186
|
-
|
|
76187
|
-
this._authSource = "profile";
|
|
76188
|
-
} else if (usingProfileUrl || usingProfileToken) {
|
|
76189
|
-
this._authSource = "mixed";
|
|
76190
|
-
}
|
|
76215
|
+
this._authSource = "profile";
|
|
76191
76216
|
if (this._serverUrl) {
|
|
76192
76217
|
this._apiClient = new APIClient({
|
|
76193
76218
|
serverUrl: this._serverUrl,
|
|
@@ -76322,6 +76347,13 @@ var REPLSession = class {
|
|
|
76322
76347
|
getAuthSource() {
|
|
76323
76348
|
return this._authSource;
|
|
76324
76349
|
}
|
|
76350
|
+
/**
|
|
76351
|
+
* Check if environment variables are present
|
|
76352
|
+
* Used for display purposes to show when env vars are being ignored
|
|
76353
|
+
*/
|
|
76354
|
+
getEnvVarsPresent() {
|
|
76355
|
+
return this._envVarsPresent;
|
|
76356
|
+
}
|
|
76325
76357
|
/**
|
|
76326
76358
|
* Check if a credential fallback was attempted
|
|
76327
76359
|
*/
|
|
@@ -76390,6 +76422,7 @@ var REPLSession = class {
|
|
|
76390
76422
|
}
|
|
76391
76423
|
/**
|
|
76392
76424
|
* Switch to a different profile
|
|
76425
|
+
* Profile credentials always take priority over environment variables.
|
|
76393
76426
|
*/
|
|
76394
76427
|
async switchProfile(profileName) {
|
|
76395
76428
|
const profile = await this._profileManager.get(profileName);
|
|
@@ -76417,6 +76450,10 @@ var REPLSession = class {
|
|
|
76417
76450
|
if (profile.defaultNamespace) {
|
|
76418
76451
|
this._namespace = profile.defaultNamespace;
|
|
76419
76452
|
}
|
|
76453
|
+
this._authSource = "profile";
|
|
76454
|
+
const envUrl = process.env[`${ENV_PREFIX}_API_URL`];
|
|
76455
|
+
const envToken = process.env[`${ENV_PREFIX}_API_TOKEN`];
|
|
76456
|
+
this._envVarsPresent = !!(envUrl || envToken);
|
|
76420
76457
|
if (this._serverUrl) {
|
|
76421
76458
|
this._apiClient = new APIClient({
|
|
76422
76459
|
serverUrl: this._serverUrl,
|
|
@@ -76494,7 +76531,7 @@ function buildPlainPrompt(session) {
|
|
|
76494
76531
|
}
|
|
76495
76532
|
|
|
76496
76533
|
// src/repl/App.tsx
|
|
76497
|
-
var
|
|
76534
|
+
var import_react34 = __toESM(require_react(), 1);
|
|
76498
76535
|
|
|
76499
76536
|
// src/repl/components/InputBox.tsx
|
|
76500
76537
|
var import_react23 = __toESM(require_react(), 1);
|
|
@@ -77649,14 +77686,495 @@ function ChatMode({
|
|
|
77649
77686
|
] });
|
|
77650
77687
|
}
|
|
77651
77688
|
|
|
77652
|
-
// src/repl/
|
|
77689
|
+
// src/repl/components/ProfileDeleteWizard.tsx
|
|
77690
|
+
var import_react29 = __toESM(require_react(), 1);
|
|
77691
|
+
|
|
77692
|
+
// src/repl/components/ProfileSwitcher.tsx
|
|
77653
77693
|
var import_react27 = __toESM(require_react(), 1);
|
|
77694
|
+
|
|
77695
|
+
// src/domains/login/profile/connection-table.ts
|
|
77696
|
+
var UNICODE_BOX2 = {
|
|
77697
|
+
topLeft: "\u256D",
|
|
77698
|
+
// ╭
|
|
77699
|
+
topRight: "\u256E",
|
|
77700
|
+
// ╮
|
|
77701
|
+
bottomLeft: "\u2570",
|
|
77702
|
+
// ╰
|
|
77703
|
+
bottomRight: "\u256F",
|
|
77704
|
+
// ╯
|
|
77705
|
+
horizontal: "\u2500",
|
|
77706
|
+
// ─
|
|
77707
|
+
vertical: "\u2502",
|
|
77708
|
+
// │
|
|
77709
|
+
leftT: "\u251C",
|
|
77710
|
+
// ├
|
|
77711
|
+
rightT: "\u2524"
|
|
77712
|
+
// ┤
|
|
77713
|
+
};
|
|
77714
|
+
var ASCII_BOX2 = {
|
|
77715
|
+
topLeft: "+",
|
|
77716
|
+
topRight: "+",
|
|
77717
|
+
bottomLeft: "+",
|
|
77718
|
+
bottomRight: "+",
|
|
77719
|
+
horizontal: "-",
|
|
77720
|
+
vertical: "|",
|
|
77721
|
+
leftT: "+",
|
|
77722
|
+
rightT: "+"
|
|
77723
|
+
};
|
|
77724
|
+
function extractTenantFromUrl(url) {
|
|
77725
|
+
try {
|
|
77726
|
+
const parsed = new URL(url);
|
|
77727
|
+
const hostname = parsed.hostname;
|
|
77728
|
+
const parts = hostname.split(".");
|
|
77729
|
+
if (parts.length > 0 && parts[0]) {
|
|
77730
|
+
return parts[0];
|
|
77731
|
+
}
|
|
77732
|
+
return hostname;
|
|
77733
|
+
} catch {
|
|
77734
|
+
return "unknown";
|
|
77735
|
+
}
|
|
77736
|
+
}
|
|
77737
|
+
function getAuthSourceDisplay(info) {
|
|
77738
|
+
if (info.authSource === "env") {
|
|
77739
|
+
return "Environment variables";
|
|
77740
|
+
}
|
|
77741
|
+
if (info.authSource === "profile") {
|
|
77742
|
+
if (info.envVarsPresent) {
|
|
77743
|
+
return "Profile (env vars ignored)";
|
|
77744
|
+
}
|
|
77745
|
+
return "Profile";
|
|
77746
|
+
}
|
|
77747
|
+
if (info.authSource === "profile-fallback") {
|
|
77748
|
+
return "Profile (fallback)";
|
|
77749
|
+
}
|
|
77750
|
+
if (info.authSource === "mixed") {
|
|
77751
|
+
return "Mixed (env + profile)";
|
|
77752
|
+
}
|
|
77753
|
+
return "Not configured";
|
|
77754
|
+
}
|
|
77755
|
+
function getStatusValue(info, colorStatus) {
|
|
77756
|
+
if (info.isConnected && info.isValidated) {
|
|
77757
|
+
return colorStatus("\u25CF Connected & Authenticated", true);
|
|
77758
|
+
}
|
|
77759
|
+
if (info.hasToken && !info.isConnected) {
|
|
77760
|
+
return colorStatus("\u25CB Offline (token not verified)", false);
|
|
77761
|
+
}
|
|
77762
|
+
return colorStatus("\u25CB Not authenticated", false);
|
|
77763
|
+
}
|
|
77764
|
+
function formatConnectionTable(info, noColor = false) {
|
|
77765
|
+
const useColors = shouldUseColors(void 0, noColor);
|
|
77766
|
+
const box = useColors ? UNICODE_BOX2 : ASCII_BOX2;
|
|
77767
|
+
const borderColor = colors.red;
|
|
77768
|
+
const successColor = colors.green;
|
|
77769
|
+
const errorColor = colors.red;
|
|
77770
|
+
const colorBorder = (text) => useColors ? `${borderColor}${text}${colors.reset}` : text;
|
|
77771
|
+
const colorStatus = (text, isGood) => useColors ? `${isGood ? successColor : errorColor}${text}${colors.reset}` : text;
|
|
77772
|
+
const rows = [
|
|
77773
|
+
{ label: "Login Profile", value: info.profileName },
|
|
77774
|
+
{ label: "Tenant", value: info.tenant },
|
|
77775
|
+
{ label: "API URL", value: info.apiUrl },
|
|
77776
|
+
{ label: "Default Namespace", value: info.namespace || "default" },
|
|
77777
|
+
{ label: "Auth Source", value: getAuthSourceDisplay(info) },
|
|
77778
|
+
{
|
|
77779
|
+
label: "Status",
|
|
77780
|
+
value: getStatusValue(info, colorStatus)
|
|
77781
|
+
}
|
|
77782
|
+
];
|
|
77783
|
+
const labelWidth = Math.max(...rows.map((r) => r.label.length));
|
|
77784
|
+
const valueWidth = Math.max(
|
|
77785
|
+
...rows.map((r) => stripAnsi2(r.value).length),
|
|
77786
|
+
30
|
|
77787
|
+
);
|
|
77788
|
+
const innerWidth = labelWidth + valueWidth + 5;
|
|
77789
|
+
const title = " Connection Summary ";
|
|
77790
|
+
const remainingWidth = innerWidth - title.length;
|
|
77791
|
+
const leftDashes = 1;
|
|
77792
|
+
const rightDashes = Math.max(0, remainingWidth - leftDashes);
|
|
77793
|
+
const lines = [];
|
|
77794
|
+
lines.push(
|
|
77795
|
+
colorBorder(box.topLeft + box.horizontal.repeat(leftDashes)) + title + colorBorder(box.horizontal.repeat(rightDashes) + box.topRight)
|
|
77796
|
+
);
|
|
77797
|
+
for (const row of rows) {
|
|
77798
|
+
const paddedLabel = row.label.padEnd(labelWidth);
|
|
77799
|
+
const valueLen = stripAnsi2(row.value).length;
|
|
77800
|
+
const paddedValue = row.value + " ".repeat(Math.max(0, valueWidth - valueLen));
|
|
77801
|
+
const content = ` ${paddedLabel} ${colorBorder(box.vertical)} ${paddedValue} `;
|
|
77802
|
+
lines.push(
|
|
77803
|
+
colorBorder(box.vertical) + content + colorBorder(box.vertical)
|
|
77804
|
+
);
|
|
77805
|
+
}
|
|
77806
|
+
lines.push(
|
|
77807
|
+
colorBorder(
|
|
77808
|
+
box.bottomLeft + box.horizontal.repeat(innerWidth) + box.bottomRight
|
|
77809
|
+
)
|
|
77810
|
+
);
|
|
77811
|
+
return lines;
|
|
77812
|
+
}
|
|
77813
|
+
function stripAnsi2(str) {
|
|
77814
|
+
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
77815
|
+
}
|
|
77816
|
+
function buildConnectionInfo(profileName, apiUrl, hasToken, namespace, isConnected, isValidated, validationError, authSource, envVarsPresent) {
|
|
77817
|
+
const info = {
|
|
77818
|
+
profileName,
|
|
77819
|
+
tenant: extractTenantFromUrl(apiUrl),
|
|
77820
|
+
apiUrl,
|
|
77821
|
+
hasToken,
|
|
77822
|
+
namespace,
|
|
77823
|
+
isConnected
|
|
77824
|
+
};
|
|
77825
|
+
if (isValidated !== void 0) {
|
|
77826
|
+
info.isValidated = isValidated;
|
|
77827
|
+
}
|
|
77828
|
+
if (validationError) {
|
|
77829
|
+
info.validationError = validationError;
|
|
77830
|
+
}
|
|
77831
|
+
if (authSource !== void 0) {
|
|
77832
|
+
info.authSource = authSource;
|
|
77833
|
+
}
|
|
77834
|
+
if (envVarsPresent !== void 0) {
|
|
77835
|
+
info.envVarsPresent = envVarsPresent;
|
|
77836
|
+
}
|
|
77837
|
+
return info;
|
|
77838
|
+
}
|
|
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);
|
|
77654
78172
|
function useDoubleCtrlC(options = {}) {
|
|
77655
78173
|
const { windowMs = 500, onFirstPress, onDoublePress } = options;
|
|
77656
|
-
const lastPressRef = (0,
|
|
77657
|
-
const [isWaiting, setIsWaiting] = (0,
|
|
77658
|
-
const timeoutRef = (0,
|
|
77659
|
-
const reset = (0,
|
|
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)(() => {
|
|
77660
78178
|
lastPressRef.current = 0;
|
|
77661
78179
|
setIsWaiting(false);
|
|
77662
78180
|
if (timeoutRef.current) {
|
|
@@ -77664,7 +78182,7 @@ function useDoubleCtrlC(options = {}) {
|
|
|
77664
78182
|
timeoutRef.current = null;
|
|
77665
78183
|
}
|
|
77666
78184
|
}, []);
|
|
77667
|
-
const handleCtrlC = (0,
|
|
78185
|
+
const handleCtrlC = (0, import_react30.useCallback)(() => {
|
|
77668
78186
|
const now = Date.now();
|
|
77669
78187
|
const elapsed = now - lastPressRef.current;
|
|
77670
78188
|
if (elapsed < windowMs && lastPressRef.current !== 0) {
|
|
@@ -77691,14 +78209,14 @@ function useDoubleCtrlC(options = {}) {
|
|
|
77691
78209
|
}
|
|
77692
78210
|
|
|
77693
78211
|
// src/repl/hooks/useHistory.ts
|
|
77694
|
-
var
|
|
78212
|
+
var import_react31 = __toESM(require_react(), 1);
|
|
77695
78213
|
function useHistory(options) {
|
|
77696
78214
|
const { history, onSelect } = options;
|
|
77697
|
-
const [historyIndex, setHistoryIndex] = (0,
|
|
77698
|
-
const reset = (0,
|
|
78215
|
+
const [historyIndex, setHistoryIndex] = (0, import_react31.useState)(-1);
|
|
78216
|
+
const reset = (0, import_react31.useCallback)(() => {
|
|
77699
78217
|
setHistoryIndex(-1);
|
|
77700
78218
|
}, []);
|
|
77701
|
-
const navigateUp = (0,
|
|
78219
|
+
const navigateUp = (0, import_react31.useCallback)(() => {
|
|
77702
78220
|
if (history.length === 0) {
|
|
77703
78221
|
return null;
|
|
77704
78222
|
}
|
|
@@ -77711,7 +78229,7 @@ function useHistory(options) {
|
|
|
77711
78229
|
}
|
|
77712
78230
|
return null;
|
|
77713
78231
|
}, [history, historyIndex, onSelect]);
|
|
77714
|
-
const navigateDown = (0,
|
|
78232
|
+
const navigateDown = (0, import_react31.useCallback)(() => {
|
|
77715
78233
|
if (historyIndex <= 0) {
|
|
77716
78234
|
if (historyIndex === 0) {
|
|
77717
78235
|
setHistoryIndex(-1);
|
|
@@ -77739,7 +78257,7 @@ function useHistory(options) {
|
|
|
77739
78257
|
}
|
|
77740
78258
|
|
|
77741
78259
|
// src/repl/hooks/useCompletion.ts
|
|
77742
|
-
var
|
|
78260
|
+
var import_react32 = __toESM(require_react(), 1);
|
|
77743
78261
|
|
|
77744
78262
|
// src/domains/login/profile/list.ts
|
|
77745
78263
|
var listCommand = {
|
|
@@ -77882,133 +78400,6 @@ var showCommand = {
|
|
|
77882
78400
|
}
|
|
77883
78401
|
};
|
|
77884
78402
|
|
|
77885
|
-
// src/domains/login/profile/connection-table.ts
|
|
77886
|
-
var UNICODE_BOX2 = {
|
|
77887
|
-
topLeft: "\u256D",
|
|
77888
|
-
// ╭
|
|
77889
|
-
topRight: "\u256E",
|
|
77890
|
-
// ╮
|
|
77891
|
-
bottomLeft: "\u2570",
|
|
77892
|
-
// ╰
|
|
77893
|
-
bottomRight: "\u256F",
|
|
77894
|
-
// ╯
|
|
77895
|
-
horizontal: "\u2500",
|
|
77896
|
-
// ─
|
|
77897
|
-
vertical: "\u2502",
|
|
77898
|
-
// │
|
|
77899
|
-
leftT: "\u251C",
|
|
77900
|
-
// ├
|
|
77901
|
-
rightT: "\u2524"
|
|
77902
|
-
// ┤
|
|
77903
|
-
};
|
|
77904
|
-
var ASCII_BOX2 = {
|
|
77905
|
-
topLeft: "+",
|
|
77906
|
-
topRight: "+",
|
|
77907
|
-
bottomLeft: "+",
|
|
77908
|
-
bottomRight: "+",
|
|
77909
|
-
horizontal: "-",
|
|
77910
|
-
vertical: "|",
|
|
77911
|
-
leftT: "+",
|
|
77912
|
-
rightT: "+"
|
|
77913
|
-
};
|
|
77914
|
-
function extractTenantFromUrl(url) {
|
|
77915
|
-
try {
|
|
77916
|
-
const parsed = new URL(url);
|
|
77917
|
-
const hostname = parsed.hostname;
|
|
77918
|
-
const parts = hostname.split(".");
|
|
77919
|
-
if (parts.length > 0 && parts[0]) {
|
|
77920
|
-
return parts[0];
|
|
77921
|
-
}
|
|
77922
|
-
return hostname;
|
|
77923
|
-
} catch {
|
|
77924
|
-
return "unknown";
|
|
77925
|
-
}
|
|
77926
|
-
}
|
|
77927
|
-
function getAuthStatusValue(info, colorStatus) {
|
|
77928
|
-
if (!info.hasToken) {
|
|
77929
|
-
return colorStatus("\u2717 No token", false);
|
|
77930
|
-
}
|
|
77931
|
-
if (info.isValidated) {
|
|
77932
|
-
return colorStatus("\u2713 Authenticated", true);
|
|
77933
|
-
}
|
|
77934
|
-
if (info.validationError) {
|
|
77935
|
-
return colorStatus(`\u2717 ${info.validationError}`, false);
|
|
77936
|
-
}
|
|
77937
|
-
return colorStatus("\u26A0 Token not verified", false);
|
|
77938
|
-
}
|
|
77939
|
-
function formatConnectionTable(info, noColor = false) {
|
|
77940
|
-
const useColors = shouldUseColors(void 0, noColor);
|
|
77941
|
-
const box = useColors ? UNICODE_BOX2 : ASCII_BOX2;
|
|
77942
|
-
const borderColor = colors.red;
|
|
77943
|
-
const successColor = colors.green;
|
|
77944
|
-
const errorColor = colors.red;
|
|
77945
|
-
const colorBorder = (text) => useColors ? `${borderColor}${text}${colors.reset}` : text;
|
|
77946
|
-
const colorStatus = (text, isGood) => useColors ? `${isGood ? successColor : errorColor}${text}${colors.reset}` : text;
|
|
77947
|
-
const rows = [
|
|
77948
|
-
{ label: "Profile", value: info.profileName },
|
|
77949
|
-
{ label: "Tenant", value: info.tenant },
|
|
77950
|
-
{ label: "API URL", value: info.apiUrl },
|
|
77951
|
-
{
|
|
77952
|
-
label: "Auth",
|
|
77953
|
-
value: getAuthStatusValue(info, colorStatus)
|
|
77954
|
-
},
|
|
77955
|
-
{ label: "Namespace", value: info.namespace || "default" },
|
|
77956
|
-
{
|
|
77957
|
-
label: "Status",
|
|
77958
|
-
value: info.isConnected ? colorStatus("\u25CF Connected", true) : colorStatus("\u25CB Not connected", false)
|
|
77959
|
-
}
|
|
77960
|
-
];
|
|
77961
|
-
const labelWidth = Math.max(...rows.map((r) => r.label.length));
|
|
77962
|
-
const valueWidth = Math.max(
|
|
77963
|
-
...rows.map((r) => stripAnsi2(r.value).length),
|
|
77964
|
-
30
|
|
77965
|
-
);
|
|
77966
|
-
const innerWidth = labelWidth + valueWidth + 5;
|
|
77967
|
-
const title = " Connection Summary ";
|
|
77968
|
-
const remainingWidth = innerWidth - title.length;
|
|
77969
|
-
const leftDashes = 1;
|
|
77970
|
-
const rightDashes = Math.max(0, remainingWidth - leftDashes);
|
|
77971
|
-
const lines = [];
|
|
77972
|
-
lines.push(
|
|
77973
|
-
colorBorder(box.topLeft + box.horizontal.repeat(leftDashes)) + title + colorBorder(box.horizontal.repeat(rightDashes) + box.topRight)
|
|
77974
|
-
);
|
|
77975
|
-
for (const row of rows) {
|
|
77976
|
-
const paddedLabel = row.label.padEnd(labelWidth);
|
|
77977
|
-
const valueLen = stripAnsi2(row.value).length;
|
|
77978
|
-
const paddedValue = row.value + " ".repeat(Math.max(0, valueWidth - valueLen));
|
|
77979
|
-
const content = ` ${paddedLabel} ${colorBorder(box.vertical)} ${paddedValue} `;
|
|
77980
|
-
lines.push(
|
|
77981
|
-
colorBorder(box.vertical) + content + colorBorder(box.vertical)
|
|
77982
|
-
);
|
|
77983
|
-
}
|
|
77984
|
-
lines.push(
|
|
77985
|
-
colorBorder(
|
|
77986
|
-
box.bottomLeft + box.horizontal.repeat(innerWidth) + box.bottomRight
|
|
77987
|
-
)
|
|
77988
|
-
);
|
|
77989
|
-
return lines;
|
|
77990
|
-
}
|
|
77991
|
-
function stripAnsi2(str) {
|
|
77992
|
-
return str.replace(/\x1b\[[0-9;]*m/g, "");
|
|
77993
|
-
}
|
|
77994
|
-
function buildConnectionInfo(profileName, apiUrl, hasToken, namespace, isConnected, isValidated, validationError) {
|
|
77995
|
-
const info = {
|
|
77996
|
-
profileName,
|
|
77997
|
-
tenant: extractTenantFromUrl(apiUrl),
|
|
77998
|
-
apiUrl,
|
|
77999
|
-
hasToken,
|
|
78000
|
-
namespace,
|
|
78001
|
-
isConnected
|
|
78002
|
-
};
|
|
78003
|
-
if (isValidated !== void 0) {
|
|
78004
|
-
info.isValidated = isValidated;
|
|
78005
|
-
}
|
|
78006
|
-
if (validationError) {
|
|
78007
|
-
info.validationError = validationError;
|
|
78008
|
-
}
|
|
78009
|
-
return info;
|
|
78010
|
-
}
|
|
78011
|
-
|
|
78012
78403
|
// src/validation/namespace.ts
|
|
78013
78404
|
function validateNamespaceScope(domain, action, currentNamespace, resourceType) {
|
|
78014
78405
|
const opInfo = getOperationDescription(domain, action, resourceType);
|
|
@@ -78479,7 +78870,9 @@ var createCommand2 = {
|
|
|
78479
78870
|
defaultNamespace || session.getNamespace(),
|
|
78480
78871
|
session.isAuthenticated(),
|
|
78481
78872
|
session.isTokenValidated(),
|
|
78482
|
-
session.getValidationError() ?? void 0
|
|
78873
|
+
session.getValidationError() ?? void 0,
|
|
78874
|
+
session.getAuthSource(),
|
|
78875
|
+
session.getEnvVarsPresent()
|
|
78483
78876
|
);
|
|
78484
78877
|
const tableLines = formatConnectionTable(connectionInfo);
|
|
78485
78878
|
return successResult(
|
|
@@ -78516,7 +78909,9 @@ var useCommand = {
|
|
|
78516
78909
|
profile?.defaultNamespace || session.getNamespace(),
|
|
78517
78910
|
session.isAuthenticated(),
|
|
78518
78911
|
session.isTokenValidated(),
|
|
78519
|
-
session.getValidationError() ?? void 0
|
|
78912
|
+
session.getValidationError() ?? void 0,
|
|
78913
|
+
session.getAuthSource(),
|
|
78914
|
+
session.getEnvVarsPresent()
|
|
78520
78915
|
);
|
|
78521
78916
|
const tableLines = formatConnectionTable(connectionInfo);
|
|
78522
78917
|
return successResult(
|
|
@@ -78542,17 +78937,16 @@ var useCommand = {
|
|
|
78542
78937
|
// src/domains/login/profile/delete.ts
|
|
78543
78938
|
var deleteCommand = {
|
|
78544
78939
|
name: "delete",
|
|
78545
|
-
description: "Delete a saved connection profile permanently.
|
|
78546
|
-
descriptionShort: "Delete a saved profile",
|
|
78547
|
-
descriptionMedium: "Remove a
|
|
78548
|
-
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>",
|
|
78549
78944
|
aliases: ["rm", "remove"],
|
|
78550
78945
|
async execute(args, _session) {
|
|
78551
78946
|
const manager = getProfileManager();
|
|
78552
78947
|
const name = args.find((arg) => !arg.startsWith("-"));
|
|
78553
|
-
const force = args.includes("--force") || args.includes("-f");
|
|
78554
78948
|
if (!name) {
|
|
78555
|
-
return errorResult("Usage: login profile delete <name>
|
|
78949
|
+
return errorResult("Usage: login profile delete <name>");
|
|
78556
78950
|
}
|
|
78557
78951
|
try {
|
|
78558
78952
|
const profile = await manager.get(name);
|
|
@@ -78560,28 +78954,21 @@ var deleteCommand = {
|
|
|
78560
78954
|
return errorResult(`Profile '${name}' not found.`);
|
|
78561
78955
|
}
|
|
78562
78956
|
const activeProfile = await manager.getActive();
|
|
78563
|
-
|
|
78564
|
-
|
|
78565
|
-
|
|
78566
|
-
|
|
78567
|
-
|
|
78568
|
-
|
|
78569
|
-
|
|
78570
|
-
|
|
78571
|
-
|
|
78572
|
-
|
|
78573
|
-
);
|
|
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
|
|
78574
78967
|
}
|
|
78575
|
-
|
|
78576
|
-
}
|
|
78577
|
-
const result = await manager.delete(name);
|
|
78578
|
-
if (!result.success) {
|
|
78579
|
-
return errorResult(result.message);
|
|
78580
|
-
}
|
|
78581
|
-
return successResult([`Profile '${name}' deleted successfully.`]);
|
|
78968
|
+
};
|
|
78582
78969
|
} catch (error) {
|
|
78583
78970
|
return errorResult(
|
|
78584
|
-
`Failed to
|
|
78971
|
+
`Failed to initiate profile deletion: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
78585
78972
|
);
|
|
78586
78973
|
}
|
|
78587
78974
|
},
|
|
@@ -78765,7 +79152,9 @@ Use 'login profile list' to see available profiles.`
|
|
|
78765
79152
|
profile?.defaultNamespace || session.getNamespace(),
|
|
78766
79153
|
session.isAuthenticated(),
|
|
78767
79154
|
session.isTokenValidated(),
|
|
78768
|
-
session.getValidationError() ?? void 0
|
|
79155
|
+
session.getValidationError() ?? void 0,
|
|
79156
|
+
session.getAuthSource(),
|
|
79157
|
+
session.getEnvVarsPresent()
|
|
78769
79158
|
);
|
|
78770
79159
|
const tableLines = formatConnectionTable(connectionInfo);
|
|
78771
79160
|
output.push("", ...tableLines);
|
|
@@ -78791,88 +79180,6 @@ Use 'login profile list' to see available profiles.`
|
|
|
78791
79180
|
}
|
|
78792
79181
|
};
|
|
78793
79182
|
|
|
78794
|
-
// src/domains/login/profile/active.ts
|
|
78795
|
-
var activeCommand = {
|
|
78796
|
-
name: "active",
|
|
78797
|
-
description: "Display the currently active profile configuration including tenant URL, authentication method, and default namespace. Shows masked credentials for security while confirming connection settings.",
|
|
78798
|
-
descriptionShort: "Display active profile configuration",
|
|
78799
|
-
descriptionMedium: "Show current active profile details including tenant URL, auth type, and namespace settings.",
|
|
78800
|
-
async execute(args, session) {
|
|
78801
|
-
const { options } = parseDomainOutputFlags(
|
|
78802
|
-
args,
|
|
78803
|
-
session.getOutputFormat()
|
|
78804
|
-
);
|
|
78805
|
-
const manager = getProfileManager();
|
|
78806
|
-
try {
|
|
78807
|
-
const activeName = await manager.getActive();
|
|
78808
|
-
if (!activeName) {
|
|
78809
|
-
if (options.format === "none") {
|
|
78810
|
-
return successResult([]);
|
|
78811
|
-
}
|
|
78812
|
-
return successResult([
|
|
78813
|
-
"No active profile set.",
|
|
78814
|
-
"",
|
|
78815
|
-
"Run 'login profile list' to see available profiles.",
|
|
78816
|
-
"Run 'login profile use <name>' to activate a profile."
|
|
78817
|
-
]);
|
|
78818
|
-
}
|
|
78819
|
-
const profile = await manager.get(activeName);
|
|
78820
|
-
if (!profile) {
|
|
78821
|
-
return errorResult(
|
|
78822
|
-
`Active profile '${activeName}' not found. Run 'login profile list' to see available profiles.`
|
|
78823
|
-
);
|
|
78824
|
-
}
|
|
78825
|
-
const masked = manager.maskProfile(profile);
|
|
78826
|
-
if (options.format === "none") {
|
|
78827
|
-
return successResult([]);
|
|
78828
|
-
}
|
|
78829
|
-
const data = {
|
|
78830
|
-
name: profile.name,
|
|
78831
|
-
apiUrl: masked.apiUrl
|
|
78832
|
-
};
|
|
78833
|
-
if (masked.apiToken) data.apiToken = masked.apiToken;
|
|
78834
|
-
if (masked.p12Bundle) data.p12Bundle = masked.p12Bundle;
|
|
78835
|
-
if (masked.cert) data.cert = masked.cert;
|
|
78836
|
-
if (masked.key) data.key = masked.key;
|
|
78837
|
-
if (masked.defaultNamespace)
|
|
78838
|
-
data.namespace = masked.defaultNamespace;
|
|
78839
|
-
if (options.format === "json" || options.format === "yaml" || options.format === "tsv") {
|
|
78840
|
-
return successResult(
|
|
78841
|
-
formatKeyValueOutput(data, {
|
|
78842
|
-
...options,
|
|
78843
|
-
title: "Active Profile"
|
|
78844
|
-
})
|
|
78845
|
-
);
|
|
78846
|
-
}
|
|
78847
|
-
const output = [
|
|
78848
|
-
`Active Profile: ${profile.name}`,
|
|
78849
|
-
``,
|
|
78850
|
-
` API URL: ${masked.apiUrl}`
|
|
78851
|
-
];
|
|
78852
|
-
if (masked.apiToken) {
|
|
78853
|
-
output.push(` API Token: ${masked.apiToken}`);
|
|
78854
|
-
}
|
|
78855
|
-
if (masked.p12Bundle) {
|
|
78856
|
-
output.push(` P12 Bundle: ${masked.p12Bundle}`);
|
|
78857
|
-
}
|
|
78858
|
-
if (masked.cert) {
|
|
78859
|
-
output.push(` Certificate: ${masked.cert}`);
|
|
78860
|
-
}
|
|
78861
|
-
if (masked.key) {
|
|
78862
|
-
output.push(` Private Key: ${masked.key}`);
|
|
78863
|
-
}
|
|
78864
|
-
if (masked.defaultNamespace) {
|
|
78865
|
-
output.push(` Namespace: ${masked.defaultNamespace}`);
|
|
78866
|
-
}
|
|
78867
|
-
return successResult(output);
|
|
78868
|
-
} catch (error) {
|
|
78869
|
-
return errorResult(
|
|
78870
|
-
`Failed to get active profile: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
78871
|
-
);
|
|
78872
|
-
}
|
|
78873
|
-
}
|
|
78874
|
-
};
|
|
78875
|
-
|
|
78876
79183
|
// src/domains/login/context/index.ts
|
|
78877
79184
|
var showCommand2 = {
|
|
78878
79185
|
name: "show",
|
|
@@ -79031,17 +79338,6 @@ var listCommand2 = {
|
|
|
79031
79338
|
}
|
|
79032
79339
|
}
|
|
79033
79340
|
};
|
|
79034
|
-
var contextSubcommands = {
|
|
79035
|
-
name: "context",
|
|
79036
|
-
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.",
|
|
79037
|
-
descriptionShort: "Manage default namespace context",
|
|
79038
|
-
descriptionMedium: "Set, display, and list namespaces for scoping operations without explicit namespace flags.",
|
|
79039
|
-
commands: /* @__PURE__ */ new Map([
|
|
79040
|
-
["show", showCommand2],
|
|
79041
|
-
["set", setCommand],
|
|
79042
|
-
["list", listCommand2]
|
|
79043
|
-
])
|
|
79044
|
-
};
|
|
79045
79341
|
|
|
79046
79342
|
// src/domains/login/banner/display.ts
|
|
79047
79343
|
function colorizeLogoLine(line) {
|
|
@@ -79593,20 +79889,57 @@ var whoamiCommand = {
|
|
|
79593
79889
|
};
|
|
79594
79890
|
|
|
79595
79891
|
// src/domains/login/index.ts
|
|
79596
|
-
var
|
|
79597
|
-
name: "
|
|
79598
|
-
description: "
|
|
79599
|
-
descriptionShort: "
|
|
79600
|
-
descriptionMedium: "
|
|
79601
|
-
|
|
79602
|
-
["
|
|
79603
|
-
["
|
|
79604
|
-
|
|
79605
|
-
|
|
79606
|
-
|
|
79607
|
-
|
|
79608
|
-
|
|
79609
|
-
|
|
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]])
|
|
79610
79943
|
};
|
|
79611
79944
|
var loginDomain = {
|
|
79612
79945
|
name: "login",
|
|
@@ -79615,10 +79948,16 @@ var loginDomain = {
|
|
|
79615
79948
|
descriptionMedium: "Manage connection profiles, authentication contexts, and session identity for F5 Distributed Cloud.",
|
|
79616
79949
|
defaultCommand: whoamiCommand,
|
|
79617
79950
|
commands: /* @__PURE__ */ new Map([["banner", bannerCommand]]),
|
|
79618
|
-
|
|
79619
|
-
["
|
|
79620
|
-
["
|
|
79621
|
-
|
|
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
|
|
79622
79961
|
};
|
|
79623
79962
|
|
|
79624
79963
|
// src/cloudstatus/client.ts
|
|
@@ -80494,8 +80833,28 @@ function fromSubcommandGroup(group) {
|
|
|
80494
80833
|
}
|
|
80495
80834
|
return node;
|
|
80496
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
|
+
}
|
|
80497
80851
|
function fromCustomDomain(domain) {
|
|
80498
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
|
+
}
|
|
80499
80858
|
for (const [name, cmd] of domain.commands) {
|
|
80500
80859
|
children.set(name, fromCommand(cmd));
|
|
80501
80860
|
}
|
|
@@ -81373,17 +81732,6 @@ Negative types: ${validTypes}`
|
|
|
81373
81732
|
}
|
|
81374
81733
|
}
|
|
81375
81734
|
};
|
|
81376
|
-
var evalSubcommands = {
|
|
81377
|
-
name: "eval",
|
|
81378
|
-
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.",
|
|
81379
|
-
descriptionShort: "RBAC testing mode commands",
|
|
81380
|
-
descriptionMedium: "Query and provide feedback in eval mode for RBAC testing and permission validation.",
|
|
81381
|
-
commands: /* @__PURE__ */ new Map([
|
|
81382
|
-
["query", evalQueryCommand],
|
|
81383
|
-
["feedback", evalFeedbackCommand]
|
|
81384
|
-
]),
|
|
81385
|
-
defaultCommand: evalQueryCommand
|
|
81386
|
-
};
|
|
81387
81735
|
|
|
81388
81736
|
// src/domains/domain-overview.ts
|
|
81389
81737
|
function formatDomainOverview(config) {
|
|
@@ -81467,6 +81815,17 @@ var entryCommand = {
|
|
|
81467
81815
|
};
|
|
81468
81816
|
}
|
|
81469
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
|
+
};
|
|
81470
81829
|
var aiServicesDomain = {
|
|
81471
81830
|
name: "ai_services",
|
|
81472
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.",
|
|
@@ -81478,7 +81837,9 @@ var aiServicesDomain = {
|
|
|
81478
81837
|
["chat", chatCommand],
|
|
81479
81838
|
["feedback", feedbackCommand]
|
|
81480
81839
|
]),
|
|
81481
|
-
|
|
81840
|
+
actions: /* @__PURE__ */ new Map([["eval", evalAction]]),
|
|
81841
|
+
subcommands: /* @__PURE__ */ new Map()
|
|
81842
|
+
// Clean break - no backward compatibility
|
|
81482
81843
|
};
|
|
81483
81844
|
var aiServicesAliases = [];
|
|
81484
81845
|
|
|
@@ -82161,17 +82522,6 @@ var planListCommand = {
|
|
|
82161
82522
|
}
|
|
82162
82523
|
}
|
|
82163
82524
|
};
|
|
82164
|
-
var planSubcommands = {
|
|
82165
|
-
name: "plan",
|
|
82166
|
-
description: "View and manage subscription plan information. Show current plan details, list available plans, and initiate plan transitions.",
|
|
82167
|
-
descriptionShort: "Manage subscription plans",
|
|
82168
|
-
descriptionMedium: "View current plan, list available options, and manage plan transitions.",
|
|
82169
|
-
commands: /* @__PURE__ */ new Map([
|
|
82170
|
-
["show", planShowCommand],
|
|
82171
|
-
["list", planListCommand]
|
|
82172
|
-
]),
|
|
82173
|
-
defaultCommand: planShowCommand
|
|
82174
|
-
};
|
|
82175
82525
|
var addonListCommand = {
|
|
82176
82526
|
name: "list",
|
|
82177
82527
|
description: "List all available addon services with their status, category, and access level. Use --subscribed to filter for active subscriptions only.",
|
|
@@ -82369,18 +82719,6 @@ var addonStatusCommand = {
|
|
|
82369
82719
|
}
|
|
82370
82720
|
}
|
|
82371
82721
|
};
|
|
82372
|
-
var addonSubcommands = {
|
|
82373
|
-
name: "addon",
|
|
82374
|
-
description: "Manage addon services for your subscription. List available addons, view details, check activation status, and manage subscriptions.",
|
|
82375
|
-
descriptionShort: "Manage addon services",
|
|
82376
|
-
descriptionMedium: "List, view, and manage addon service subscriptions and activation status.",
|
|
82377
|
-
commands: /* @__PURE__ */ new Map([
|
|
82378
|
-
["list", addonListCommand],
|
|
82379
|
-
["show", addonShowCommand],
|
|
82380
|
-
["status", addonStatusCommand]
|
|
82381
|
-
]),
|
|
82382
|
-
defaultCommand: addonListCommand
|
|
82383
|
-
};
|
|
82384
82722
|
var quotaLimitsCommand = {
|
|
82385
82723
|
name: "limits",
|
|
82386
82724
|
description: "Display all tenant-level quota limits including resource caps for load balancers, origins, sites, and other configurable resources.",
|
|
@@ -82513,17 +82851,6 @@ var quotaUsageCommand = {
|
|
|
82513
82851
|
}
|
|
82514
82852
|
}
|
|
82515
82853
|
};
|
|
82516
|
-
var quotaSubcommands = {
|
|
82517
|
-
name: "quota",
|
|
82518
|
-
description: "View tenant-level quota limits and current usage. Monitor resource utilization to avoid quota exhaustion.",
|
|
82519
|
-
descriptionShort: "View quota limits and usage",
|
|
82520
|
-
descriptionMedium: "Display tenant-level quota limits and current usage with utilization metrics.",
|
|
82521
|
-
commands: /* @__PURE__ */ new Map([
|
|
82522
|
-
["limits", quotaLimitsCommand],
|
|
82523
|
-
["usage", quotaUsageCommand]
|
|
82524
|
-
]),
|
|
82525
|
-
defaultCommand: quotaUsageCommand
|
|
82526
|
-
};
|
|
82527
82854
|
var usageCurrentCommand = {
|
|
82528
82855
|
name: "current",
|
|
82529
82856
|
description: "Display current billing period usage including itemized costs and projected totals.",
|
|
@@ -82651,17 +82978,6 @@ var usageMonthlyCommand = {
|
|
|
82651
82978
|
}
|
|
82652
82979
|
}
|
|
82653
82980
|
};
|
|
82654
|
-
var usageSubcommands = {
|
|
82655
|
-
name: "usage",
|
|
82656
|
-
description: "View usage metrics and cost data for current and historical billing periods.",
|
|
82657
|
-
descriptionShort: "View usage metrics",
|
|
82658
|
-
descriptionMedium: "Display usage metrics, cost breakdowns, and historical billing data.",
|
|
82659
|
-
commands: /* @__PURE__ */ new Map([
|
|
82660
|
-
["current", usageCurrentCommand],
|
|
82661
|
-
["monthly", usageMonthlyCommand]
|
|
82662
|
-
]),
|
|
82663
|
-
defaultCommand: usageCurrentCommand
|
|
82664
|
-
};
|
|
82665
82981
|
var billingPaymentListCommand = {
|
|
82666
82982
|
name: "list",
|
|
82667
82983
|
description: "List all configured payment methods showing type, status, and primary designation.",
|
|
@@ -82790,52 +83106,6 @@ var billingInvoiceListCommand = {
|
|
|
82790
83106
|
}
|
|
82791
83107
|
}
|
|
82792
83108
|
};
|
|
82793
|
-
var billingPaymentSubcommands = {
|
|
82794
|
-
name: "payment",
|
|
82795
|
-
description: "Manage payment methods for your subscription billing.",
|
|
82796
|
-
descriptionShort: "Manage payment methods",
|
|
82797
|
-
descriptionMedium: "List, view, and manage payment methods for subscription billing.",
|
|
82798
|
-
commands: /* @__PURE__ */ new Map([["list", billingPaymentListCommand]]),
|
|
82799
|
-
defaultCommand: billingPaymentListCommand
|
|
82800
|
-
};
|
|
82801
|
-
var billingInvoiceSubcommands = {
|
|
82802
|
-
name: "invoice",
|
|
82803
|
-
description: "View and download invoices for your subscription.",
|
|
82804
|
-
descriptionShort: "Manage invoices",
|
|
82805
|
-
descriptionMedium: "List invoices and download invoice PDFs for billing records.",
|
|
82806
|
-
commands: /* @__PURE__ */ new Map([["list", billingInvoiceListCommand]]),
|
|
82807
|
-
defaultCommand: billingInvoiceListCommand
|
|
82808
|
-
};
|
|
82809
|
-
var billingPaymentCommand = {
|
|
82810
|
-
name: "payment",
|
|
82811
|
-
description: billingPaymentSubcommands.description,
|
|
82812
|
-
descriptionShort: billingPaymentSubcommands.descriptionShort,
|
|
82813
|
-
descriptionMedium: billingPaymentSubcommands.descriptionMedium,
|
|
82814
|
-
usage: "<list>",
|
|
82815
|
-
async execute(args, session) {
|
|
82816
|
-
return billingPaymentListCommand.execute(args, session);
|
|
82817
|
-
}
|
|
82818
|
-
};
|
|
82819
|
-
var billingInvoiceCommand = {
|
|
82820
|
-
name: "invoice",
|
|
82821
|
-
description: billingInvoiceSubcommands.description,
|
|
82822
|
-
descriptionShort: billingInvoiceSubcommands.descriptionShort,
|
|
82823
|
-
descriptionMedium: billingInvoiceSubcommands.descriptionMedium,
|
|
82824
|
-
usage: "<list>",
|
|
82825
|
-
async execute(args, session) {
|
|
82826
|
-
return billingInvoiceListCommand.execute(args, session);
|
|
82827
|
-
}
|
|
82828
|
-
};
|
|
82829
|
-
var billingSubcommands = {
|
|
82830
|
-
name: "billing",
|
|
82831
|
-
description: "Manage billing information including payment methods and invoices.",
|
|
82832
|
-
descriptionShort: "Manage billing",
|
|
82833
|
-
descriptionMedium: "View and manage payment methods, invoices, and billing details.",
|
|
82834
|
-
commands: /* @__PURE__ */ new Map([
|
|
82835
|
-
["payment", billingPaymentCommand],
|
|
82836
|
-
["invoice", billingInvoiceCommand]
|
|
82837
|
-
])
|
|
82838
|
-
};
|
|
82839
83109
|
var reportSummaryCommand = {
|
|
82840
83110
|
name: "summary",
|
|
82841
83111
|
description: "Generate comprehensive subscription report combining plan details, addon status, quota utilization, usage metrics, and billing summary.",
|
|
@@ -82989,13 +83259,40 @@ var reportSummaryCommand = {
|
|
|
82989
83259
|
}
|
|
82990
83260
|
}
|
|
82991
83261
|
};
|
|
82992
|
-
var
|
|
82993
|
-
name: "
|
|
82994
|
-
description: "
|
|
82995
|
-
descriptionShort: "
|
|
82996
|
-
descriptionMedium: "
|
|
82997
|
-
|
|
82998
|
-
|
|
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]])
|
|
82999
83296
|
};
|
|
83000
83297
|
var subscriptionDomain = {
|
|
83001
83298
|
name: "subscription",
|
|
@@ -83004,14 +83301,13 @@ var subscriptionDomain = {
|
|
|
83004
83301
|
descriptionMedium: "Manage subscription tier, addon services, quota limits, usage metrics, and billing information.",
|
|
83005
83302
|
defaultCommand: showCommand3,
|
|
83006
83303
|
commands: /* @__PURE__ */ new Map([["show", showCommand3]]),
|
|
83007
|
-
|
|
83008
|
-
["
|
|
83009
|
-
["
|
|
83010
|
-
["
|
|
83011
|
-
|
|
83012
|
-
|
|
83013
|
-
|
|
83014
|
-
])
|
|
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
|
|
83015
83311
|
};
|
|
83016
83312
|
var subscriptionAliases = [];
|
|
83017
83313
|
|
|
@@ -83754,8 +84050,11 @@ var Completer = class {
|
|
|
83754
84050
|
if (args.length >= 2 && this.session) {
|
|
83755
84051
|
const cmdName = args[1]?.toLowerCase() ?? "";
|
|
83756
84052
|
const domain2 = customDomains.get(domainName);
|
|
83757
|
-
|
|
83758
|
-
|
|
84053
|
+
let cmd = domain2?.actions?.get(subgroupName)?.resources.get(cmdName);
|
|
84054
|
+
if (!cmd) {
|
|
84055
|
+
const subgroup = domain2?.subcommands.get(subgroupName);
|
|
84056
|
+
cmd = subgroup?.commands.get(cmdName);
|
|
84057
|
+
}
|
|
83759
84058
|
if (cmd?.completion) {
|
|
83760
84059
|
try {
|
|
83761
84060
|
const completions = await cmd.completion(
|
|
@@ -84319,27 +84618,27 @@ var Completer = class {
|
|
|
84319
84618
|
// src/repl/hooks/useCompletion.ts
|
|
84320
84619
|
function useCompletion(options) {
|
|
84321
84620
|
const { session } = options;
|
|
84322
|
-
const [completer] = (0,
|
|
84621
|
+
const [completer] = (0, import_react32.useState)(() => {
|
|
84323
84622
|
const c = new Completer();
|
|
84324
84623
|
if (session) {
|
|
84325
84624
|
c.setSession(session);
|
|
84326
84625
|
}
|
|
84327
84626
|
return c;
|
|
84328
84627
|
});
|
|
84329
|
-
const [suggestions, setSuggestions] = (0,
|
|
84330
|
-
const [selectedIndex, setSelectedIndex] = (0,
|
|
84331
|
-
const [isShowing, setIsShowing] = (0,
|
|
84332
|
-
(0,
|
|
84628
|
+
const [suggestions, setSuggestions] = (0, import_react32.useState)([]);
|
|
84629
|
+
const [selectedIndex, setSelectedIndex] = (0, import_react32.useState)(0);
|
|
84630
|
+
const [isShowing, setIsShowing] = (0, import_react32.useState)(false);
|
|
84631
|
+
(0, import_react32.useEffect)(() => {
|
|
84333
84632
|
if (session) {
|
|
84334
84633
|
completer.setSession(session);
|
|
84335
84634
|
}
|
|
84336
84635
|
}, [session, completer]);
|
|
84337
|
-
const hide = (0,
|
|
84636
|
+
const hide = (0, import_react32.useCallback)(() => {
|
|
84338
84637
|
setIsShowing(false);
|
|
84339
84638
|
setSuggestions([]);
|
|
84340
84639
|
setSelectedIndex(0);
|
|
84341
84640
|
}, []);
|
|
84342
|
-
const triggerCompletion = (0,
|
|
84641
|
+
const triggerCompletion = (0, import_react32.useCallback)(
|
|
84343
84642
|
async (input) => {
|
|
84344
84643
|
const newSuggestions = await completer.complete(input);
|
|
84345
84644
|
if (newSuggestions.length === 1) {
|
|
@@ -84357,7 +84656,7 @@ function useCompletion(options) {
|
|
|
84357
84656
|
},
|
|
84358
84657
|
[completer, hide]
|
|
84359
84658
|
);
|
|
84360
|
-
const filterSuggestions = (0,
|
|
84659
|
+
const filterSuggestions = (0, import_react32.useCallback)(
|
|
84361
84660
|
async (input) => {
|
|
84362
84661
|
if (!isShowing) return;
|
|
84363
84662
|
const newSuggestions = await completer.complete(input);
|
|
@@ -84370,19 +84669,19 @@ function useCompletion(options) {
|
|
|
84370
84669
|
},
|
|
84371
84670
|
[completer, isShowing, hide]
|
|
84372
84671
|
);
|
|
84373
|
-
const navigateUp = (0,
|
|
84672
|
+
const navigateUp = (0, import_react32.useCallback)(() => {
|
|
84374
84673
|
if (!isShowing || suggestions.length === 0) return;
|
|
84375
84674
|
setSelectedIndex(
|
|
84376
84675
|
(current) => current > 0 ? current - 1 : suggestions.length - 1
|
|
84377
84676
|
);
|
|
84378
84677
|
}, [isShowing, suggestions.length]);
|
|
84379
|
-
const navigateDown = (0,
|
|
84678
|
+
const navigateDown = (0, import_react32.useCallback)(() => {
|
|
84380
84679
|
if (!isShowing || suggestions.length === 0) return;
|
|
84381
84680
|
setSelectedIndex(
|
|
84382
84681
|
(current) => current < suggestions.length - 1 ? current + 1 : 0
|
|
84383
84682
|
);
|
|
84384
84683
|
}, [isShowing, suggestions.length]);
|
|
84385
|
-
const selectCurrent = (0,
|
|
84684
|
+
const selectCurrent = (0, import_react32.useCallback)(() => {
|
|
84386
84685
|
if (!isShowing || suggestions.length === 0) return null;
|
|
84387
84686
|
const selected = suggestions.at(selectedIndex);
|
|
84388
84687
|
hide();
|
|
@@ -84402,7 +84701,7 @@ function useCompletion(options) {
|
|
|
84402
84701
|
}
|
|
84403
84702
|
|
|
84404
84703
|
// src/repl/hooks/useGitStatus.ts
|
|
84405
|
-
var
|
|
84704
|
+
var import_react33 = __toESM(require_react(), 1);
|
|
84406
84705
|
var DEFAULT_POLL_INTERVAL_MS = 3e4;
|
|
84407
84706
|
var MIN_POLL_INTERVAL_MS = 5e3;
|
|
84408
84707
|
function getPollInterval() {
|
|
@@ -84416,20 +84715,20 @@ function getPollInterval() {
|
|
|
84416
84715
|
function useGitStatus(options = {}) {
|
|
84417
84716
|
const { enabled = true } = options;
|
|
84418
84717
|
const pollIntervalMs = options.pollIntervalMs ?? getPollInterval();
|
|
84419
|
-
const [gitInfo, setGitInfo] = (0,
|
|
84420
|
-
const [lastRefresh, setLastRefresh] = (0,
|
|
84421
|
-
const intervalRef = (0,
|
|
84422
|
-
const refresh = (0,
|
|
84718
|
+
const [gitInfo, setGitInfo] = (0, import_react33.useState)(void 0);
|
|
84719
|
+
const [lastRefresh, setLastRefresh] = (0, import_react33.useState)(0);
|
|
84720
|
+
const intervalRef = (0, import_react33.useRef)(null);
|
|
84721
|
+
const refresh = (0, import_react33.useCallback)(() => {
|
|
84423
84722
|
const info = getGitInfo();
|
|
84424
84723
|
setGitInfo(info);
|
|
84425
84724
|
setLastRefresh(Date.now());
|
|
84426
84725
|
}, []);
|
|
84427
|
-
(0,
|
|
84726
|
+
(0, import_react33.useEffect)(() => {
|
|
84428
84727
|
if (enabled) {
|
|
84429
84728
|
refresh();
|
|
84430
84729
|
}
|
|
84431
84730
|
}, [enabled, refresh]);
|
|
84432
|
-
(0,
|
|
84731
|
+
(0, import_react33.useEffect)(() => {
|
|
84433
84732
|
if (!enabled || pollIntervalMs === 0) {
|
|
84434
84733
|
return;
|
|
84435
84734
|
}
|
|
@@ -84444,6 +84743,37 @@ function useGitStatus(options = {}) {
|
|
|
84444
84743
|
return { gitInfo, refresh, lastRefresh };
|
|
84445
84744
|
}
|
|
84446
84745
|
|
|
84746
|
+
// src/operations/resolver.ts
|
|
84747
|
+
function getOperationDefinition(domain, action, resourceType) {
|
|
84748
|
+
const domainOps = generatedOperations.get(domain);
|
|
84749
|
+
if (!domainOps?.operations) return null;
|
|
84750
|
+
if (resourceType) {
|
|
84751
|
+
const exactMatch = domainOps.operations.find(
|
|
84752
|
+
(op) => op.action === action && op.resourceType === resourceType
|
|
84753
|
+
);
|
|
84754
|
+
if (exactMatch) return exactMatch;
|
|
84755
|
+
}
|
|
84756
|
+
return domainOps.operations.find((op) => op.action === action) ?? null;
|
|
84757
|
+
}
|
|
84758
|
+
function substitutePathParams(pathTemplate, params) {
|
|
84759
|
+
let path = pathTemplate;
|
|
84760
|
+
if (params.namespace) {
|
|
84761
|
+
path = path.replace(/\{namespace\}/g, params.namespace);
|
|
84762
|
+
path = path.replace(/\{metadata\.namespace\}/g, params.namespace);
|
|
84763
|
+
}
|
|
84764
|
+
if (params.name) {
|
|
84765
|
+
path = path.replace(/\{name\}/g, params.name);
|
|
84766
|
+
path = path.replace(/\{metadata\.name\}/g, params.name);
|
|
84767
|
+
}
|
|
84768
|
+
if (params.site) {
|
|
84769
|
+
path = path.replace(/\{site\}/g, params.site);
|
|
84770
|
+
}
|
|
84771
|
+
return path;
|
|
84772
|
+
}
|
|
84773
|
+
function hasUnsubstitutedParams(path) {
|
|
84774
|
+
return /\{[^}]+\}/.test(path);
|
|
84775
|
+
}
|
|
84776
|
+
|
|
84447
84777
|
// src/repl/executor.ts
|
|
84448
84778
|
var WRITE_OPERATIONS = /* @__PURE__ */ new Set([
|
|
84449
84779
|
"create",
|
|
@@ -84855,6 +85185,18 @@ async function handleDirectNavigation(cmd, ctx, session) {
|
|
|
84855
85185
|
error: "Unknown domain"
|
|
84856
85186
|
};
|
|
84857
85187
|
}
|
|
85188
|
+
if (cmd.targetAction && cmd.args.length > 0) {
|
|
85189
|
+
ctx.reset();
|
|
85190
|
+
ctx.setDomain(cmd.targetDomain);
|
|
85191
|
+
ctx.setAction(cmd.targetAction);
|
|
85192
|
+
const apiCmd = {
|
|
85193
|
+
raw: [cmd.targetDomain, cmd.targetAction, ...cmd.args].join(" "),
|
|
85194
|
+
args: cmd.args,
|
|
85195
|
+
isBuiltin: false,
|
|
85196
|
+
isDirectNavigation: false
|
|
85197
|
+
};
|
|
85198
|
+
return await executeAPICommand(session, ctx, apiCmd);
|
|
85199
|
+
}
|
|
84858
85200
|
ctx.reset();
|
|
84859
85201
|
ctx.setDomain(cmd.targetDomain);
|
|
84860
85202
|
if (cmd.targetAction) {
|
|
@@ -85294,8 +85636,35 @@ Suggestion: Use --namespace ${nsValidation.suggestion}` : "";
|
|
|
85294
85636
|
contextChanged: false
|
|
85295
85637
|
};
|
|
85296
85638
|
}
|
|
85297
|
-
|
|
85298
|
-
|
|
85639
|
+
let effectiveResourceType = resourceType;
|
|
85640
|
+
if (!effectiveResourceType && args.length > 0) {
|
|
85641
|
+
effectiveResourceType = args[0]?.toLowerCase();
|
|
85642
|
+
}
|
|
85643
|
+
const operation = getOperationDefinition(
|
|
85644
|
+
canonicalDomain,
|
|
85645
|
+
action,
|
|
85646
|
+
effectiveResourceType
|
|
85647
|
+
);
|
|
85648
|
+
let apiPath;
|
|
85649
|
+
let usedOperationPath = false;
|
|
85650
|
+
if (operation?.path) {
|
|
85651
|
+
const pathParams = {
|
|
85652
|
+
namespace: effectiveNamespace
|
|
85653
|
+
};
|
|
85654
|
+
if (name) {
|
|
85655
|
+
pathParams.name = name;
|
|
85656
|
+
}
|
|
85657
|
+
apiPath = substitutePathParams(operation.path, pathParams);
|
|
85658
|
+
usedOperationPath = true;
|
|
85659
|
+
if (hasUnsubstitutedParams(apiPath)) {
|
|
85660
|
+
const resourcePath = domainToResourcePath(effectiveResource);
|
|
85661
|
+
apiPath = `/api/config/namespaces/${effectiveNamespace}/${resourcePath}`;
|
|
85662
|
+
usedOperationPath = false;
|
|
85663
|
+
}
|
|
85664
|
+
} else {
|
|
85665
|
+
const resourcePath = domainToResourcePath(effectiveResource);
|
|
85666
|
+
apiPath = `/api/config/namespaces/${effectiveNamespace}/${resourcePath}`;
|
|
85667
|
+
}
|
|
85299
85668
|
try {
|
|
85300
85669
|
let result;
|
|
85301
85670
|
switch (action) {
|
|
@@ -85316,7 +85685,9 @@ Suggestion: Use --namespace ${nsValidation.suggestion}` : "";
|
|
|
85316
85685
|
error: "Usage: get <name>"
|
|
85317
85686
|
};
|
|
85318
85687
|
}
|
|
85319
|
-
|
|
85688
|
+
if (!usedOperationPath) {
|
|
85689
|
+
apiPath += `/${name}`;
|
|
85690
|
+
}
|
|
85320
85691
|
const response = await client.get(apiPath);
|
|
85321
85692
|
result = response.data;
|
|
85322
85693
|
break;
|
|
@@ -85333,7 +85704,9 @@ Suggestion: Use --namespace ${nsValidation.suggestion}` : "";
|
|
|
85333
85704
|
error: "Usage: delete <name>"
|
|
85334
85705
|
};
|
|
85335
85706
|
}
|
|
85336
|
-
|
|
85707
|
+
if (!usedOperationPath) {
|
|
85708
|
+
apiPath += `/${name}`;
|
|
85709
|
+
}
|
|
85337
85710
|
await client.delete(apiPath);
|
|
85338
85711
|
result = { message: `Deleted ${canonicalDomain} '${name}'` };
|
|
85339
85712
|
break;
|
|
@@ -85363,7 +85736,9 @@ Suggestion: Use --namespace ${nsValidation.suggestion}` : "";
|
|
|
85363
85736
|
error: "Usage: status <name>"
|
|
85364
85737
|
};
|
|
85365
85738
|
}
|
|
85366
|
-
|
|
85739
|
+
if (!usedOperationPath) {
|
|
85740
|
+
apiPath += `/${name}/status`;
|
|
85741
|
+
}
|
|
85367
85742
|
const response = await client.get(apiPath);
|
|
85368
85743
|
result = response.data;
|
|
85369
85744
|
break;
|
|
@@ -85523,8 +85898,67 @@ function getBuiltinDescription(cmd) {
|
|
|
85523
85898
|
return descriptions.get(cmd) ?? "Built-in command";
|
|
85524
85899
|
}
|
|
85525
85900
|
|
|
85901
|
+
// src/debug/logger.ts
|
|
85902
|
+
import { appendFileSync, writeFileSync as writeFileSync2 } from "fs";
|
|
85903
|
+
import { resolve } from "path";
|
|
85904
|
+
var DEBUG_ENABLED = process.env.XCSH_DEBUG === "1" || process.env.DEBUG === "xcsh" || process.env.DEBUG === "*";
|
|
85905
|
+
var DEBUG_FILE = process.env.XCSH_DEBUG_FILE || "./xcsh-debug.log";
|
|
85906
|
+
if (DEBUG_ENABLED) {
|
|
85907
|
+
const logPath = resolve(DEBUG_FILE);
|
|
85908
|
+
try {
|
|
85909
|
+
writeFileSync2(
|
|
85910
|
+
logPath,
|
|
85911
|
+
`=== XCSH Debug Log Started at ${(/* @__PURE__ */ new Date()).toISOString()} ===
|
|
85912
|
+
`
|
|
85913
|
+
);
|
|
85914
|
+
console.error(`[DEBUG] Logging to: ${logPath}`);
|
|
85915
|
+
} catch (error) {
|
|
85916
|
+
console.error(`[DEBUG] Failed to initialize log file: ${error}`);
|
|
85917
|
+
}
|
|
85918
|
+
}
|
|
85919
|
+
function isCategoryEnabled(category) {
|
|
85920
|
+
if (!DEBUG_ENABLED) return false;
|
|
85921
|
+
const categoryFilter = process.env.XCSH_DEBUG_CATEGORY;
|
|
85922
|
+
if (!categoryFilter || categoryFilter === "all") return true;
|
|
85923
|
+
const enabledCategories = categoryFilter.split(",");
|
|
85924
|
+
return enabledCategories.includes(category);
|
|
85925
|
+
}
|
|
85926
|
+
function timestamp() {
|
|
85927
|
+
const now = /* @__PURE__ */ new Date();
|
|
85928
|
+
const ms = now.getMilliseconds().toString().padStart(3, "0");
|
|
85929
|
+
return `${now.toISOString().slice(11, 19)}.${ms}`;
|
|
85930
|
+
}
|
|
85931
|
+
function writeToLog(entry) {
|
|
85932
|
+
try {
|
|
85933
|
+
appendFileSync(DEBUG_FILE, entry + "\n");
|
|
85934
|
+
} catch {
|
|
85935
|
+
}
|
|
85936
|
+
}
|
|
85937
|
+
function debug(category, message, data) {
|
|
85938
|
+
if (!isCategoryEnabled(category)) return;
|
|
85939
|
+
const prefix = `[${timestamp()}] [${category.toUpperCase()}]`;
|
|
85940
|
+
let logEntry;
|
|
85941
|
+
if (data === void 0) {
|
|
85942
|
+
logEntry = `${prefix} ${message}`;
|
|
85943
|
+
} else if (typeof data === "object" && data !== null) {
|
|
85944
|
+
logEntry = `${prefix} ${message}
|
|
85945
|
+
${JSON.stringify(data, null, 2)}`;
|
|
85946
|
+
} else {
|
|
85947
|
+
logEntry = `${prefix} ${message}: ${data}`;
|
|
85948
|
+
}
|
|
85949
|
+
writeToLog(logEntry);
|
|
85950
|
+
}
|
|
85951
|
+
var debugOutput = (message, data) => debug("output", message, data);
|
|
85952
|
+
var debugRender = (message, data) => debug("render", message, data);
|
|
85953
|
+
var debugTerminal = (message, data) => debug("terminal", message, data);
|
|
85954
|
+
var debugBuffer = (message, data) => debug("buffer", message, data);
|
|
85955
|
+
function debugSeparator() {
|
|
85956
|
+
if (!DEBUG_ENABLED) return;
|
|
85957
|
+
writeToLog("\u2500".repeat(80));
|
|
85958
|
+
}
|
|
85959
|
+
|
|
85526
85960
|
// src/repl/App.tsx
|
|
85527
|
-
var
|
|
85961
|
+
var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1);
|
|
85528
85962
|
function isValidDomain2(word) {
|
|
85529
85963
|
const lowerWord = word.toLowerCase();
|
|
85530
85964
|
if (isCustomDomain(lowerWord)) return true;
|
|
@@ -85544,11 +85978,11 @@ function toUISuggestions(suggestions) {
|
|
|
85544
85978
|
function App2({ initialSession } = {}) {
|
|
85545
85979
|
const { exit } = use_app_default();
|
|
85546
85980
|
const { stdout } = use_stdout_default();
|
|
85547
|
-
const [session] = (0,
|
|
85548
|
-
const [isInitialized, setIsInitialized] = (0,
|
|
85549
|
-
const [input, setInputState] = (0,
|
|
85550
|
-
const inputRef = (0,
|
|
85551
|
-
const setInput = (0,
|
|
85981
|
+
const [session] = (0, import_react34.useState)(() => initialSession ?? new REPLSession());
|
|
85982
|
+
const [isInitialized, setIsInitialized] = (0, import_react34.useState)(!!initialSession);
|
|
85983
|
+
const [input, setInputState] = (0, import_react34.useState)("");
|
|
85984
|
+
const inputRef = (0, import_react34.useRef)("");
|
|
85985
|
+
const setInput = (0, import_react34.useCallback)(
|
|
85552
85986
|
(value) => {
|
|
85553
85987
|
setInputState((prev) => {
|
|
85554
85988
|
const newValue = typeof value === "function" ? value(prev) : value;
|
|
@@ -85558,20 +85992,24 @@ function App2({ initialSession } = {}) {
|
|
|
85558
85992
|
},
|
|
85559
85993
|
[]
|
|
85560
85994
|
);
|
|
85561
|
-
const [outputItems, setOutputItems] = (0,
|
|
85562
|
-
const outputIdRef = (0,
|
|
85563
|
-
const
|
|
85564
|
-
const [
|
|
85565
|
-
const [
|
|
85566
|
-
const [
|
|
85567
|
-
const [
|
|
85568
|
-
const [
|
|
85569
|
-
const [
|
|
85995
|
+
const [outputItems, setOutputItems] = (0, import_react34.useState)([]);
|
|
85996
|
+
const outputIdRef = (0, import_react34.useRef)(0);
|
|
85997
|
+
const commandIdRef = (0, import_react34.useRef)(0);
|
|
85998
|
+
const [prompt, setPrompt] = (0, import_react34.useState)("> ");
|
|
85999
|
+
const [width, setWidth] = (0, import_react34.useState)(stdout?.columns ?? 80);
|
|
86000
|
+
const [statusHint, setStatusHint] = (0, import_react34.useState)("Ctrl+C twice to exit");
|
|
86001
|
+
const [historyArray, setHistoryArray] = (0, import_react34.useState)([]);
|
|
86002
|
+
const [inputKey, setInputKey] = (0, import_react34.useState)(0);
|
|
86003
|
+
const [hideStatusBar, setHideStatusBar] = (0, import_react34.useState)(false);
|
|
86004
|
+
const [pendingRawStdout, setPendingRawStdout] = (0, import_react34.useState)(
|
|
85570
86005
|
null
|
|
85571
86006
|
);
|
|
85572
|
-
const [mode, setMode] = (0,
|
|
85573
|
-
|
|
85574
|
-
|
|
86007
|
+
const [mode, setMode] = (0, import_react34.useState)(
|
|
86008
|
+
"repl"
|
|
86009
|
+
);
|
|
86010
|
+
const [chatConfig, setChatConfig] = (0, import_react34.useState)(null);
|
|
86011
|
+
const [profileDeleteConfig, setProfileDeleteConfig] = (0, import_react34.useState)(null);
|
|
86012
|
+
(0, import_react34.useEffect)(() => {
|
|
85575
86013
|
if (hideStatusBar && pendingRawStdout) {
|
|
85576
86014
|
process.stdout.write(pendingRawStdout);
|
|
85577
86015
|
process.stdout.write("\n\n\n");
|
|
@@ -85600,7 +86038,7 @@ function App2({ initialSession } = {}) {
|
|
|
85600
86038
|
session.saveHistory().finally(() => exit());
|
|
85601
86039
|
}
|
|
85602
86040
|
});
|
|
85603
|
-
(0,
|
|
86041
|
+
(0, import_react34.useEffect)(() => {
|
|
85604
86042
|
const init = async () => {
|
|
85605
86043
|
if (!isInitialized) {
|
|
85606
86044
|
await session.initialize();
|
|
@@ -85614,37 +86052,85 @@ function App2({ initialSession } = {}) {
|
|
|
85614
86052
|
};
|
|
85615
86053
|
init();
|
|
85616
86054
|
}, [session]);
|
|
85617
|
-
(0,
|
|
86055
|
+
(0, import_react34.useEffect)(() => {
|
|
85618
86056
|
const handleResize = () => {
|
|
85619
86057
|
if (stdout) {
|
|
85620
86058
|
const newWidth = stdout.columns ?? 80;
|
|
86059
|
+
const newHeight = stdout.rows ?? 24;
|
|
86060
|
+
debugTerminal("Terminal resized", {
|
|
86061
|
+
width: newWidth,
|
|
86062
|
+
height: newHeight,
|
|
86063
|
+
previousWidth: width
|
|
86064
|
+
});
|
|
85621
86065
|
setWidth(newWidth);
|
|
85622
86066
|
setTerminalWidth(newWidth);
|
|
85623
86067
|
}
|
|
85624
86068
|
};
|
|
85625
86069
|
if (stdout) {
|
|
85626
|
-
|
|
86070
|
+
const initialWidth = stdout.columns ?? 80;
|
|
86071
|
+
const initialHeight = stdout.rows ?? 24;
|
|
86072
|
+
debugTerminal("Terminal initialized", {
|
|
86073
|
+
width: initialWidth,
|
|
86074
|
+
height: initialHeight
|
|
86075
|
+
});
|
|
86076
|
+
setTerminalWidth(initialWidth);
|
|
85627
86077
|
}
|
|
85628
86078
|
stdout?.on("resize", handleResize);
|
|
85629
86079
|
return () => {
|
|
85630
86080
|
stdout?.off("resize", handleResize);
|
|
85631
86081
|
};
|
|
85632
|
-
}, [stdout]);
|
|
85633
|
-
const addOutput = (0,
|
|
86082
|
+
}, [stdout, width]);
|
|
86083
|
+
const addOutput = (0, import_react34.useCallback)((line) => {
|
|
85634
86084
|
const lines = line.split("\n");
|
|
86085
|
+
const currentCommandId = commandIdRef.current;
|
|
85635
86086
|
const newItems = lines.map((content) => ({
|
|
85636
86087
|
id: outputIdRef.current++,
|
|
85637
|
-
content
|
|
86088
|
+
content,
|
|
86089
|
+
commandId: currentCommandId
|
|
85638
86090
|
}));
|
|
86091
|
+
debugOutput("Adding output lines", {
|
|
86092
|
+
inputLineCount: 1,
|
|
86093
|
+
splitLineCount: lines.length,
|
|
86094
|
+
newItemsCount: newItems.length,
|
|
86095
|
+
commandId: currentCommandId,
|
|
86096
|
+
firstLineLength: lines[0]?.length,
|
|
86097
|
+
firstLinePreview: lines[0]?.slice(0, 80)
|
|
86098
|
+
});
|
|
85639
86099
|
setOutputItems((prev) => {
|
|
85640
86100
|
const combined = [...prev, ...newItems];
|
|
85641
|
-
|
|
85642
|
-
|
|
86101
|
+
const uniqueCommands = new Set(
|
|
86102
|
+
combined.map((item) => item.commandId)
|
|
86103
|
+
);
|
|
86104
|
+
const commandCount = uniqueCommands.size;
|
|
86105
|
+
debugBuffer("Buffer state before truncation", {
|
|
86106
|
+
previousItemCount: prev.length,
|
|
86107
|
+
newItemsCount: newItems.length,
|
|
86108
|
+
combinedItemCount: combined.length,
|
|
86109
|
+
commandCount,
|
|
86110
|
+
willTruncate: commandCount > 3
|
|
86111
|
+
});
|
|
86112
|
+
if (commandCount > 3) {
|
|
86113
|
+
const recentCommandIds = Array.from(uniqueCommands).sort((a, b) => b - a).slice(0, 3);
|
|
86114
|
+
const truncated = combined.filter(
|
|
86115
|
+
(item) => recentCommandIds.includes(item.commandId)
|
|
86116
|
+
);
|
|
86117
|
+
debugBuffer("Buffer truncated by command boundary", {
|
|
86118
|
+
beforeCount: combined.length,
|
|
86119
|
+
afterCount: truncated.length,
|
|
86120
|
+
itemsRemoved: combined.length - truncated.length,
|
|
86121
|
+
commandsRemoved: commandCount - 3,
|
|
86122
|
+
keptCommandIds: recentCommandIds
|
|
86123
|
+
});
|
|
86124
|
+
return truncated;
|
|
85643
86125
|
}
|
|
86126
|
+
debugBuffer("Buffer updated without truncation", {
|
|
86127
|
+
finalItemCount: combined.length,
|
|
86128
|
+
commandCount
|
|
86129
|
+
});
|
|
85644
86130
|
return combined;
|
|
85645
86131
|
});
|
|
85646
86132
|
}, []);
|
|
85647
|
-
const applyCompletion = (0,
|
|
86133
|
+
const applyCompletion = (0, import_react34.useCallback)(
|
|
85648
86134
|
(suggestion) => {
|
|
85649
86135
|
const currentInput = inputRef.current;
|
|
85650
86136
|
let newValue;
|
|
@@ -85672,30 +86158,60 @@ function App2({ initialSession } = {}) {
|
|
|
85672
86158
|
[]
|
|
85673
86159
|
// No dependencies needed since we use inputRef
|
|
85674
86160
|
);
|
|
85675
|
-
const refreshHistory = (0,
|
|
86161
|
+
const refreshHistory = (0, import_react34.useCallback)(() => {
|
|
85676
86162
|
const histMgr = session.getHistory();
|
|
85677
86163
|
if (histMgr) {
|
|
85678
86164
|
setHistoryArray(histMgr.getHistory());
|
|
85679
86165
|
}
|
|
85680
86166
|
}, [session]);
|
|
85681
|
-
const runCommand = (0,
|
|
86167
|
+
const runCommand = (0, import_react34.useCallback)(
|
|
85682
86168
|
async (cmd) => {
|
|
85683
86169
|
const trimmed = cmd.trim();
|
|
85684
86170
|
if (!trimmed) return;
|
|
86171
|
+
debugSeparator();
|
|
86172
|
+
debugOutput("Command execution started", {
|
|
86173
|
+
command: trimmed,
|
|
86174
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
86175
|
+
currentBufferSize: outputItems.length
|
|
86176
|
+
});
|
|
86177
|
+
commandIdRef.current++;
|
|
85685
86178
|
const scrollbackCommand = `${colorBlue("\u23FA")} ${colorBoldWhite(prompt + trimmed)}`;
|
|
85686
86179
|
addOutput(scrollbackCommand);
|
|
85687
86180
|
const result = await executeCommand(trimmed, session);
|
|
86181
|
+
debugOutput("Command execution completed", {
|
|
86182
|
+
command: trimmed,
|
|
86183
|
+
outputLineCount: result.output.length,
|
|
86184
|
+
shouldExit: result.shouldExit,
|
|
86185
|
+
shouldClear: result.shouldClear,
|
|
86186
|
+
hasRawStdout: !!result.rawStdout,
|
|
86187
|
+
enterChatMode: result.enterChatMode,
|
|
86188
|
+
enterProfileDeleteMode: result.enterProfileDeleteMode
|
|
86189
|
+
});
|
|
85688
86190
|
if (result.enterChatMode && result.chatConfig) {
|
|
85689
86191
|
setMode("chat");
|
|
85690
86192
|
setChatConfig(result.chatConfig);
|
|
85691
86193
|
return;
|
|
85692
86194
|
}
|
|
86195
|
+
if (result.enterProfileDeleteMode && result.profileDeleteConfig) {
|
|
86196
|
+
setMode("profile-delete");
|
|
86197
|
+
setProfileDeleteConfig(result.profileDeleteConfig);
|
|
86198
|
+
return;
|
|
86199
|
+
}
|
|
85693
86200
|
if (result.rawStdout) {
|
|
85694
86201
|
setHideStatusBar(true);
|
|
85695
86202
|
setPendingRawStdout(result.rawStdout);
|
|
85696
86203
|
} else if (result.shouldClear) {
|
|
86204
|
+
debugOutput("Clearing output buffer");
|
|
85697
86205
|
setOutputItems([]);
|
|
85698
86206
|
} else {
|
|
86207
|
+
debugOutput("Processing output lines", {
|
|
86208
|
+
totalLines: result.output.length,
|
|
86209
|
+
firstLine: result.output[0]?.slice(0, 100),
|
|
86210
|
+
lastLine: result.output[result.output.length - 1]?.slice(
|
|
86211
|
+
0,
|
|
86212
|
+
100
|
|
86213
|
+
)
|
|
86214
|
+
});
|
|
85699
86215
|
result.output.forEach((line) => addOutput(line));
|
|
85700
86216
|
}
|
|
85701
86217
|
if (result.shouldExit) {
|
|
@@ -85715,7 +86231,7 @@ function App2({ initialSession } = {}) {
|
|
|
85715
86231
|
},
|
|
85716
86232
|
[session, prompt, addOutput, exit, refreshHistory, gitStatus]
|
|
85717
86233
|
);
|
|
85718
|
-
const handleInputChange = (0,
|
|
86234
|
+
const handleInputChange = (0, import_react34.useCallback)(
|
|
85719
86235
|
(newValue) => {
|
|
85720
86236
|
const oldValue = input;
|
|
85721
86237
|
setInput(newValue);
|
|
@@ -85743,7 +86259,7 @@ function App2({ initialSession } = {}) {
|
|
|
85743
86259
|
},
|
|
85744
86260
|
[input, completion]
|
|
85745
86261
|
);
|
|
85746
|
-
const handleSubmit = (0,
|
|
86262
|
+
const handleSubmit = (0, import_react34.useCallback)(
|
|
85747
86263
|
async (value) => {
|
|
85748
86264
|
if (completion.isShowing && completion.suggestions.length > 0) {
|
|
85749
86265
|
const selected = completion.selectCurrent();
|
|
@@ -85841,7 +86357,7 @@ function App2({ initialSession } = {}) {
|
|
|
85841
86357
|
return;
|
|
85842
86358
|
}
|
|
85843
86359
|
});
|
|
85844
|
-
const handleSuggestionNavigate = (0,
|
|
86360
|
+
const handleSuggestionNavigate = (0, import_react34.useCallback)(
|
|
85845
86361
|
(direction) => {
|
|
85846
86362
|
if (direction === "up") {
|
|
85847
86363
|
completion.navigateUp();
|
|
@@ -85851,14 +86367,14 @@ function App2({ initialSession } = {}) {
|
|
|
85851
86367
|
},
|
|
85852
86368
|
[completion]
|
|
85853
86369
|
);
|
|
85854
|
-
const handleSuggestionSelect = (0,
|
|
86370
|
+
const handleSuggestionSelect = (0, import_react34.useCallback)(
|
|
85855
86371
|
(suggestion) => {
|
|
85856
86372
|
applyCompletion(suggestion);
|
|
85857
86373
|
completion.hide();
|
|
85858
86374
|
},
|
|
85859
86375
|
[applyCompletion, completion]
|
|
85860
86376
|
);
|
|
85861
|
-
const handleChatExit = (0,
|
|
86377
|
+
const handleChatExit = (0, import_react34.useCallback)(
|
|
85862
86378
|
(chatMessages) => {
|
|
85863
86379
|
chatMessages.forEach((msg) => addOutput(msg));
|
|
85864
86380
|
setMode("repl");
|
|
@@ -85866,9 +86382,41 @@ function App2({ initialSession } = {}) {
|
|
|
85866
86382
|
},
|
|
85867
86383
|
[addOutput]
|
|
85868
86384
|
);
|
|
85869
|
-
|
|
85870
|
-
|
|
85871
|
-
|
|
86385
|
+
const handleProfileDeleteExit = (0, import_react34.useCallback)(
|
|
86386
|
+
(success, messages) => {
|
|
86387
|
+
messages.forEach((msg) => addOutput(msg));
|
|
86388
|
+
if (success && profileDeleteConfig?.isActive) {
|
|
86389
|
+
setPrompt(buildPlainPrompt(session));
|
|
86390
|
+
}
|
|
86391
|
+
setMode("repl");
|
|
86392
|
+
setProfileDeleteConfig(null);
|
|
86393
|
+
setInput("");
|
|
86394
|
+
setInputKey((prev) => prev + 1);
|
|
86395
|
+
},
|
|
86396
|
+
[addOutput, session, profileDeleteConfig, setInput]
|
|
86397
|
+
);
|
|
86398
|
+
(0, import_react34.useEffect)(() => {
|
|
86399
|
+
const uniqueCommands = new Set(
|
|
86400
|
+
outputItems.map((item) => item.commandId)
|
|
86401
|
+
);
|
|
86402
|
+
debugRender("Static component render triggered", {
|
|
86403
|
+
itemCount: outputItems.length,
|
|
86404
|
+
commandCount: uniqueCommands.size,
|
|
86405
|
+
terminalWidth: width,
|
|
86406
|
+
terminalHeight: stdout?.rows ?? "unknown",
|
|
86407
|
+
firstItemId: outputItems[0]?.id,
|
|
86408
|
+
firstCommandId: outputItems[0]?.commandId,
|
|
86409
|
+
lastItemId: outputItems[outputItems.length - 1]?.id,
|
|
86410
|
+
lastCommandId: outputItems[outputItems.length - 1]?.commandId,
|
|
86411
|
+
lastItemContent: outputItems[outputItems.length - 1]?.content.slice(
|
|
86412
|
+
0,
|
|
86413
|
+
100
|
|
86414
|
+
)
|
|
86415
|
+
});
|
|
86416
|
+
}, [outputItems, width, stdout]);
|
|
86417
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Box_default, { flexDirection: "column", width, children: [
|
|
86418
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Static, { items: outputItems, children: (item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: item.content }, item.id) }),
|
|
86419
|
+
isInitialized && !hideStatusBar ? mode === "chat" && chatConfig ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
85872
86420
|
ChatMode,
|
|
85873
86421
|
{
|
|
85874
86422
|
session,
|
|
@@ -85876,8 +86424,17 @@ function App2({ initialSession } = {}) {
|
|
|
85876
86424
|
width,
|
|
85877
86425
|
onExit: handleChatExit
|
|
85878
86426
|
}
|
|
85879
|
-
) : /* @__PURE__ */ (0,
|
|
85880
|
-
|
|
86427
|
+
) : mode === "profile-delete" && profileDeleteConfig ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
86428
|
+
ProfileDeleteWizard,
|
|
86429
|
+
{
|
|
86430
|
+
profileToDelete: profileDeleteConfig.profileName,
|
|
86431
|
+
isActive: profileDeleteConfig.isActive,
|
|
86432
|
+
session,
|
|
86433
|
+
width,
|
|
86434
|
+
onExit: handleProfileDeleteExit
|
|
86435
|
+
}
|
|
86436
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
86437
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
85881
86438
|
InputBox,
|
|
85882
86439
|
{
|
|
85883
86440
|
prompt,
|
|
@@ -85889,7 +86446,7 @@ function App2({ initialSession } = {}) {
|
|
|
85889
86446
|
inputKey
|
|
85890
86447
|
}
|
|
85891
86448
|
),
|
|
85892
|
-
completion.isShowing && completion.suggestions.length > 0 ? /* @__PURE__ */ (0,
|
|
86449
|
+
completion.isShowing && completion.suggestions.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
85893
86450
|
Suggestions,
|
|
85894
86451
|
{
|
|
85895
86452
|
suggestions: toUISuggestions(
|
|
@@ -85902,7 +86459,7 @@ function App2({ initialSession } = {}) {
|
|
|
85902
86459
|
maxVisible: 20,
|
|
85903
86460
|
isActive: false
|
|
85904
86461
|
}
|
|
85905
|
-
) : /* @__PURE__ */ (0,
|
|
86462
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
85906
86463
|
StatusBar,
|
|
85907
86464
|
{
|
|
85908
86465
|
gitInfo: gitStatus.gitInfo,
|
|
@@ -85910,7 +86467,7 @@ function App2({ initialSession } = {}) {
|
|
|
85910
86467
|
hint: statusHint
|
|
85911
86468
|
}
|
|
85912
86469
|
)
|
|
85913
|
-
] }) : !isInitialized ? /* @__PURE__ */ (0,
|
|
86470
|
+
] }) : !isInitialized ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Text, { children: "Initializing..." }) : null
|
|
85914
86471
|
] });
|
|
85915
86472
|
}
|
|
85916
86473
|
|
|
@@ -86223,7 +86780,7 @@ var HeadlessController = class {
|
|
|
86223
86780
|
};
|
|
86224
86781
|
|
|
86225
86782
|
// src/index.tsx
|
|
86226
|
-
var
|
|
86783
|
+
var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
86227
86784
|
var profiler = initProfiler();
|
|
86228
86785
|
var importsSpan = profiler.startSpan("imports", "Module Imports");
|
|
86229
86786
|
profiler.memorySnapshot("script_start");
|
|
@@ -86302,47 +86859,68 @@ program2.name(CLI_NAME).description("F5 Distributed Cloud Shell - Interactive CL
|
|
|
86302
86859
|
profiler.memorySnapshot("pre_banner");
|
|
86303
86860
|
printProfileReport();
|
|
86304
86861
|
renderBanner(cliLogoMode, "startup");
|
|
86305
|
-
|
|
86306
|
-
|
|
86307
|
-
|
|
86308
|
-
`${colors.yellow}\u26A0\uFE0F Offline Mode: API endpoint unreachable${colors.reset}`
|
|
86309
|
-
);
|
|
86310
|
-
console.log(
|
|
86311
|
-
`${colors.dim} Commands requiring API access will fail. Check network and try again.${colors.reset}`
|
|
86312
|
-
);
|
|
86313
|
-
}
|
|
86314
|
-
if (session.getAuthSource() === "profile-fallback") {
|
|
86315
|
-
const profileName = session.getActiveProfileName();
|
|
86862
|
+
const activeProfile = session.getActiveProfile();
|
|
86863
|
+
const envConfigured = process.env[`${ENV_PREFIX}_API_URL`] && process.env[`${ENV_PREFIX}_API_TOKEN`];
|
|
86864
|
+
if (activeProfile) {
|
|
86316
86865
|
console.log("");
|
|
86317
|
-
|
|
86318
|
-
|
|
86866
|
+
const connectionInfo = buildConnectionInfo(
|
|
86867
|
+
session.getActiveProfileName() || activeProfile.name || "default",
|
|
86868
|
+
activeProfile.apiUrl || session.getServerUrl() || "",
|
|
86869
|
+
!!activeProfile.apiToken || session.isAuthenticated(),
|
|
86870
|
+
activeProfile.defaultNamespace || session.getNamespace(),
|
|
86871
|
+
session.isAuthenticated() && !session.isOfflineMode(),
|
|
86872
|
+
session.isTokenValidated(),
|
|
86873
|
+
session.getValidationError() ?? void 0,
|
|
86874
|
+
session.getAuthSource(),
|
|
86875
|
+
session.getEnvVarsPresent()
|
|
86319
86876
|
);
|
|
86320
|
-
|
|
86321
|
-
|
|
86322
|
-
|
|
86323
|
-
|
|
86324
|
-
console.log("");
|
|
86325
|
-
if (authSource === "env" || authSource === "mixed") {
|
|
86877
|
+
const tableLines = formatConnectionTable(connectionInfo);
|
|
86878
|
+
tableLines.forEach((line) => console.log(line));
|
|
86879
|
+
if (session.isOfflineMode()) {
|
|
86880
|
+
console.log("");
|
|
86326
86881
|
console.log(
|
|
86327
|
-
`${colors.yellow}
|
|
86882
|
+
`${colors.yellow}\u26A0\uFE0F Offline Mode: API endpoint unreachable${colors.reset}`
|
|
86328
86883
|
);
|
|
86329
|
-
if (fallbackReason) {
|
|
86330
|
-
console.log(
|
|
86331
|
-
`${colors.dim} ${fallbackReason}${colors.reset}`
|
|
86332
|
-
);
|
|
86333
|
-
}
|
|
86334
86884
|
console.log(
|
|
86335
|
-
`${colors.dim}
|
|
86885
|
+
`${colors.dim} Commands requiring API access will fail.${colors.reset}`
|
|
86336
86886
|
);
|
|
86337
|
-
}
|
|
86887
|
+
}
|
|
86888
|
+
if (session.getAuthSource() === "profile-fallback") {
|
|
86889
|
+
console.log("");
|
|
86890
|
+
console.log(
|
|
86891
|
+
`${colors.blue}Info: Using credentials from profile '${session.getActiveProfileName()}' (environment variables were invalid)${colors.reset}`
|
|
86892
|
+
);
|
|
86893
|
+
}
|
|
86894
|
+
} else if (envConfigured) {
|
|
86895
|
+
console.log("");
|
|
86896
|
+
const connectionInfo = buildConnectionInfo(
|
|
86897
|
+
"(environment)",
|
|
86898
|
+
process.env[`${ENV_PREFIX}_API_URL`] || "",
|
|
86899
|
+
!!process.env[`${ENV_PREFIX}_API_TOKEN`],
|
|
86900
|
+
session.getNamespace(),
|
|
86901
|
+
session.isAuthenticated() && !session.isOfflineMode(),
|
|
86902
|
+
session.isTokenValidated(),
|
|
86903
|
+
session.getValidationError() ?? void 0,
|
|
86904
|
+
"env",
|
|
86905
|
+
// authSource - using environment variables
|
|
86906
|
+
true
|
|
86907
|
+
// envVarsPresent - by definition, this flow means env vars exist
|
|
86908
|
+
);
|
|
86909
|
+
const tableLines = formatConnectionTable(connectionInfo);
|
|
86910
|
+
tableLines.forEach((line) => console.log(line));
|
|
86911
|
+
if (session.isOfflineMode()) {
|
|
86912
|
+
console.log("");
|
|
86913
|
+
console.log(
|
|
86914
|
+
`${colors.yellow}\u26A0\uFE0F Offline Mode: API endpoint unreachable${colors.reset}`
|
|
86915
|
+
);
|
|
86916
|
+
}
|
|
86917
|
+
if (!session.isTokenValidated() && session.getValidationError()) {
|
|
86918
|
+
console.log("");
|
|
86338
86919
|
console.log(
|
|
86339
86920
|
`${colors.yellow}Warning: ${session.getValidationError()}${colors.reset}`
|
|
86340
86921
|
);
|
|
86341
86922
|
}
|
|
86342
|
-
}
|
|
86343
|
-
const profiles = await session.getProfileManager().list();
|
|
86344
|
-
const envConfigured = process.env[`${ENV_PREFIX}_API_URL`] && process.env[`${ENV_PREFIX}_API_TOKEN`];
|
|
86345
|
-
if (profiles.length === 0 && !envConfigured) {
|
|
86923
|
+
} else {
|
|
86346
86924
|
console.log("");
|
|
86347
86925
|
console.log(
|
|
86348
86926
|
`${colors.yellow}No connection profiles found.${colors.reset}`
|
|
@@ -86368,7 +86946,7 @@ program2.name(CLI_NAME).description("F5 Distributed Cloud Shell - Interactive CL
|
|
|
86368
86946
|
}
|
|
86369
86947
|
process.stdin.resume();
|
|
86370
86948
|
const appProps = { initialSession: session };
|
|
86371
|
-
render_default(/* @__PURE__ */ (0,
|
|
86949
|
+
render_default(/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(App2, { ...appProps }), { exitOnCtrlC: false });
|
|
86372
86950
|
return;
|
|
86373
86951
|
}
|
|
86374
86952
|
await executeNonInteractive(commandArgs);
|