@robinmordasiewicz/f5xc-xcsh 2.0.27-2601160811 → 2.0.27-2601161624
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +156 -21
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41228,8 +41228,8 @@ var init_logo_renderer = __esm({
|
|
|
41228
41228
|
|
|
41229
41229
|
// src/branding/index.ts
|
|
41230
41230
|
function getVersion() {
|
|
41231
|
-
if ("v2.0.27-
|
|
41232
|
-
return "v2.0.27-
|
|
41231
|
+
if ("v2.0.27-2601161624") {
|
|
41232
|
+
return "v2.0.27-2601161624";
|
|
41233
41233
|
}
|
|
41234
41234
|
if (process.env.XCSH_VERSION) {
|
|
41235
41235
|
return process.env.XCSH_VERSION;
|
|
@@ -50094,9 +50094,13 @@ var init_settings = __esm({
|
|
|
50094
50094
|
];
|
|
50095
50095
|
LOGO_MODE_HELP = LOGO_MODES.map((m) => m.mode).join(", ");
|
|
50096
50096
|
COMPLETION_MODES = [
|
|
50097
|
+
{
|
|
50098
|
+
mode: "standard",
|
|
50099
|
+
description: "Show primary and CRUD resources with valid descriptions (default)"
|
|
50100
|
+
},
|
|
50097
50101
|
{
|
|
50098
50102
|
mode: "all",
|
|
50099
|
-
description: "Show all discovered resources
|
|
50103
|
+
description: "Show all discovered resources"
|
|
50100
50104
|
},
|
|
50101
50105
|
{
|
|
50102
50106
|
mode: "primary",
|
|
@@ -50108,7 +50112,7 @@ var init_settings = __esm({
|
|
|
50108
50112
|
);
|
|
50109
50113
|
DEFAULT_SETTINGS = {
|
|
50110
50114
|
logo: "image",
|
|
50111
|
-
completionMode: "
|
|
50115
|
+
completionMode: "standard"
|
|
50112
50116
|
};
|
|
50113
50117
|
}
|
|
50114
50118
|
});
|
|
@@ -77869,6 +77873,73 @@ var init_response_renderer = __esm({
|
|
|
77869
77873
|
}
|
|
77870
77874
|
});
|
|
77871
77875
|
|
|
77876
|
+
// src/repl/completion/flag-aliases.ts
|
|
77877
|
+
function buildFlagAliasLookup() {
|
|
77878
|
+
const lookup = /* @__PURE__ */ new Map();
|
|
77879
|
+
for (const group of FLAG_ALIAS_GROUPS) {
|
|
77880
|
+
const allForms = new Set(group);
|
|
77881
|
+
for (const flag of group) {
|
|
77882
|
+
lookup.set(flag, allForms);
|
|
77883
|
+
}
|
|
77884
|
+
}
|
|
77885
|
+
return lookup;
|
|
77886
|
+
}
|
|
77887
|
+
var FLAG_ALIAS_GROUPS, FLAG_ALIAS_LOOKUP;
|
|
77888
|
+
var init_flag_aliases = __esm({
|
|
77889
|
+
"src/repl/completion/flag-aliases.ts"() {
|
|
77890
|
+
"use strict";
|
|
77891
|
+
FLAG_ALIAS_GROUPS = [
|
|
77892
|
+
["--namespace", "-ns"],
|
|
77893
|
+
["--output", "-o"],
|
|
77894
|
+
["--name", "-n"],
|
|
77895
|
+
["--file", "-f"],
|
|
77896
|
+
["--url", "-u"],
|
|
77897
|
+
["--token", "-t"],
|
|
77898
|
+
["--limit"],
|
|
77899
|
+
["--label"],
|
|
77900
|
+
["--show-labels"],
|
|
77901
|
+
["--force"],
|
|
77902
|
+
["--cascade"]
|
|
77903
|
+
];
|
|
77904
|
+
FLAG_ALIAS_LOOKUP = buildFlagAliasLookup();
|
|
77905
|
+
}
|
|
77906
|
+
});
|
|
77907
|
+
|
|
77908
|
+
// src/repl/completion/flag-utils.ts
|
|
77909
|
+
function extractUsedFlags(args) {
|
|
77910
|
+
const usedFlags = /* @__PURE__ */ new Set();
|
|
77911
|
+
for (const arg of args) {
|
|
77912
|
+
let flagPart = arg;
|
|
77913
|
+
if (arg.includes("=")) {
|
|
77914
|
+
flagPart = arg.split("=")[0] ?? arg;
|
|
77915
|
+
}
|
|
77916
|
+
if (!flagPart.startsWith("-")) {
|
|
77917
|
+
continue;
|
|
77918
|
+
}
|
|
77919
|
+
usedFlags.add(flagPart);
|
|
77920
|
+
const aliases = FLAG_ALIAS_LOOKUP.get(flagPart);
|
|
77921
|
+
if (aliases) {
|
|
77922
|
+
for (const alias of aliases) {
|
|
77923
|
+
usedFlags.add(alias);
|
|
77924
|
+
}
|
|
77925
|
+
}
|
|
77926
|
+
}
|
|
77927
|
+
return usedFlags;
|
|
77928
|
+
}
|
|
77929
|
+
function filterUsedFlags(suggestions, usedFlags) {
|
|
77930
|
+
return suggestions.filter((s) => !usedFlags.has(s.text));
|
|
77931
|
+
}
|
|
77932
|
+
function filterUsedFlagsFromStrings(flags, args) {
|
|
77933
|
+
const usedFlags = extractUsedFlags(args);
|
|
77934
|
+
return flags.filter((flag) => !usedFlags.has(flag));
|
|
77935
|
+
}
|
|
77936
|
+
var init_flag_utils = __esm({
|
|
77937
|
+
"src/repl/completion/flag-utils.ts"() {
|
|
77938
|
+
"use strict";
|
|
77939
|
+
init_flag_aliases();
|
|
77940
|
+
}
|
|
77941
|
+
});
|
|
77942
|
+
|
|
77872
77943
|
// src/utils/usage-parser.ts
|
|
77873
77944
|
function parseUsage(usageString) {
|
|
77874
77945
|
if (!usageString) {
|
|
@@ -77973,25 +78044,27 @@ function stripBrackets(token) {
|
|
|
77973
78044
|
return token.replace(/^[<[]/, "").replace(/[>\]]$/, "");
|
|
77974
78045
|
}
|
|
77975
78046
|
function generateSmartCompletions(usage, args, flags) {
|
|
78047
|
+
const availableFlags = filterUsedFlagsFromStrings(flags, args);
|
|
77976
78048
|
if (!usage) {
|
|
77977
|
-
return
|
|
78049
|
+
return availableFlags;
|
|
77978
78050
|
}
|
|
77979
78051
|
const requirements = parseUsage(usage);
|
|
77980
78052
|
const positionalArgsProvided = args.filter(
|
|
77981
|
-
(arg) => !arg.startsWith("
|
|
78053
|
+
(arg) => !arg.startsWith("-")
|
|
77982
78054
|
).length;
|
|
77983
78055
|
const requiredPositional = requirements.positional.filter(
|
|
77984
78056
|
(p) => p.required
|
|
77985
78057
|
);
|
|
77986
78058
|
if (positionalArgsProvided < requiredPositional.length) {
|
|
77987
78059
|
const placeholders = requiredPositional.slice(positionalArgsProvided).map((p) => `<${p.name}>`);
|
|
77988
|
-
return [...placeholders, ...
|
|
78060
|
+
return [...placeholders, ...availableFlags];
|
|
77989
78061
|
}
|
|
77990
|
-
return
|
|
78062
|
+
return availableFlags;
|
|
77991
78063
|
}
|
|
77992
78064
|
var init_usage_parser = __esm({
|
|
77993
78065
|
"src/utils/usage-parser.ts"() {
|
|
77994
78066
|
"use strict";
|
|
78067
|
+
init_flag_utils();
|
|
77995
78068
|
}
|
|
77996
78069
|
});
|
|
77997
78070
|
|
|
@@ -84587,6 +84660,22 @@ var init_resource_fetcher = __esm({
|
|
|
84587
84660
|
});
|
|
84588
84661
|
|
|
84589
84662
|
// src/repl/completion/completer.ts
|
|
84663
|
+
function isResourceCompletionAppropriate(resource) {
|
|
84664
|
+
if (resource.isPrimary) {
|
|
84665
|
+
return true;
|
|
84666
|
+
}
|
|
84667
|
+
if (resource.resourceCategory && EXCLUDED_RESOURCE_CATEGORIES.has(resource.resourceCategory)) {
|
|
84668
|
+
return false;
|
|
84669
|
+
}
|
|
84670
|
+
const desc = resource.descriptionShort || resource.description || "";
|
|
84671
|
+
if (GENERIC_RESOURCE_DESCRIPTIONS.has(desc)) {
|
|
84672
|
+
return false;
|
|
84673
|
+
}
|
|
84674
|
+
if (desc.toLowerCase() === resource.name.toLowerCase().replace(/_/g, " ")) {
|
|
84675
|
+
return false;
|
|
84676
|
+
}
|
|
84677
|
+
return true;
|
|
84678
|
+
}
|
|
84590
84679
|
function parseInputArgs(text) {
|
|
84591
84680
|
const args = [];
|
|
84592
84681
|
let current = "";
|
|
@@ -84671,7 +84760,7 @@ function parseInput(text) {
|
|
|
84671
84760
|
currentFlag
|
|
84672
84761
|
};
|
|
84673
84762
|
}
|
|
84674
|
-
var RESOURCE_ACTIONS, Completer;
|
|
84763
|
+
var RESOURCE_ACTIONS, GENERIC_RESOURCE_DESCRIPTIONS, EXCLUDED_RESOURCE_CATEGORIES, Completer;
|
|
84675
84764
|
var init_completer = __esm({
|
|
84676
84765
|
"src/repl/completion/completer.ts"() {
|
|
84677
84766
|
"use strict";
|
|
@@ -84683,6 +84772,7 @@ var init_completer = __esm({
|
|
|
84683
84772
|
init_domains();
|
|
84684
84773
|
init_resource_fetcher();
|
|
84685
84774
|
init_settings();
|
|
84775
|
+
init_flag_utils();
|
|
84686
84776
|
RESOURCE_ACTIONS = /* @__PURE__ */ new Set([
|
|
84687
84777
|
"list",
|
|
84688
84778
|
"get",
|
|
@@ -84695,6 +84785,17 @@ var init_completer = __esm({
|
|
|
84695
84785
|
"add-labels",
|
|
84696
84786
|
"remove-labels"
|
|
84697
84787
|
]);
|
|
84788
|
+
GENERIC_RESOURCE_DESCRIPTIONS = /* @__PURE__ */ new Set([
|
|
84789
|
+
"Resource retrieval operation",
|
|
84790
|
+
"Resource creation operation",
|
|
84791
|
+
"Resource update operation",
|
|
84792
|
+
"Resource deletion operation"
|
|
84793
|
+
]);
|
|
84794
|
+
EXCLUDED_RESOURCE_CATEGORIES = /* @__PURE__ */ new Set([
|
|
84795
|
+
"analytics",
|
|
84796
|
+
"utility",
|
|
84797
|
+
"management"
|
|
84798
|
+
]);
|
|
84698
84799
|
Completer = class {
|
|
84699
84800
|
session = null;
|
|
84700
84801
|
cache;
|
|
@@ -84705,7 +84806,7 @@ var init_completer = __esm({
|
|
|
84705
84806
|
this.cache = new CompletionCache();
|
|
84706
84807
|
this.settings = loadSettingsSync();
|
|
84707
84808
|
const cliCompletionMode = process.env.XCSH_COMPLETION_MODE;
|
|
84708
|
-
if (cliCompletionMode && (cliCompletionMode === "all" || cliCompletionMode === "primary")) {
|
|
84809
|
+
if (cliCompletionMode && (cliCompletionMode === "all" || cliCompletionMode === "primary" || cliCompletionMode === "standard")) {
|
|
84709
84810
|
this.settings.completionMode = cliCompletionMode;
|
|
84710
84811
|
}
|
|
84711
84812
|
}
|
|
@@ -84749,9 +84850,10 @@ var init_completer = __esm({
|
|
|
84749
84850
|
);
|
|
84750
84851
|
}
|
|
84751
84852
|
if (parsed.isCompletingFlag) {
|
|
84752
|
-
return this.
|
|
84853
|
+
return this.getAvailableFlagCompletions(
|
|
84753
84854
|
parsed.currentWord,
|
|
84754
|
-
resourceCtx.action ?? void 0
|
|
84855
|
+
resourceCtx.action ?? void 0,
|
|
84856
|
+
parsed.args
|
|
84755
84857
|
);
|
|
84756
84858
|
}
|
|
84757
84859
|
if (resourceCtx.resourceType) {
|
|
@@ -84762,29 +84864,36 @@ var init_completer = __esm({
|
|
|
84762
84864
|
if (resourceNames.length > 0) {
|
|
84763
84865
|
return resourceNames;
|
|
84764
84866
|
}
|
|
84765
|
-
|
|
84867
|
+
const allFlags = this.getActionFlagSuggestions(
|
|
84766
84868
|
resourceCtx.action ?? void 0
|
|
84767
84869
|
);
|
|
84870
|
+
const usedFlags = extractUsedFlags(parsed.args);
|
|
84871
|
+
return filterUsedFlags(allFlags, usedFlags);
|
|
84768
84872
|
}
|
|
84769
84873
|
if (resourceCtx.domain && resourceCtx.action && RESOURCE_ACTIONS.has(resourceCtx.action) && !resourceCtx.resourceType) {
|
|
84770
84874
|
const resourceTypes = this.getResourceTypeSuggestions(
|
|
84771
84875
|
resourceCtx.domain
|
|
84772
84876
|
);
|
|
84773
84877
|
if (resourceTypes.length > 0) {
|
|
84878
|
+
let suggestions2 = resourceTypes;
|
|
84774
84879
|
if (parsed.currentWord && !parsed.currentWord.startsWith("-") && parsed.currentWord.toLowerCase() !== resourceCtx.action) {
|
|
84775
84880
|
const filtered = this.filterSuggestions(
|
|
84776
84881
|
resourceTypes,
|
|
84777
84882
|
parsed.currentWord
|
|
84778
84883
|
);
|
|
84779
84884
|
if (filtered.length > 0) {
|
|
84780
|
-
|
|
84885
|
+
suggestions2 = filtered;
|
|
84781
84886
|
}
|
|
84782
|
-
} else if (!parsed.currentWord || parsed.currentWord.toLowerCase() === resourceCtx.action) {
|
|
84783
|
-
return [
|
|
84784
|
-
...resourceTypes,
|
|
84785
|
-
...this.getActionFlagSuggestions(resourceCtx.action)
|
|
84786
|
-
];
|
|
84787
84887
|
}
|
|
84888
|
+
const actionFlags = this.getActionFlagSuggestions(
|
|
84889
|
+
resourceCtx.action
|
|
84890
|
+
);
|
|
84891
|
+
const usedFlagsInContext = extractUsedFlags(parsed.args);
|
|
84892
|
+
const availableActionFlags = filterUsedFlags(
|
|
84893
|
+
actionFlags,
|
|
84894
|
+
usedFlagsInContext
|
|
84895
|
+
);
|
|
84896
|
+
return [...suggestions2, ...availableActionFlags];
|
|
84788
84897
|
}
|
|
84789
84898
|
}
|
|
84790
84899
|
let suggestions;
|
|
@@ -84803,9 +84912,14 @@ var init_completer = __esm({
|
|
|
84803
84912
|
if (!hasAction) {
|
|
84804
84913
|
suggestions = this.getActionSuggestions();
|
|
84805
84914
|
} else {
|
|
84806
|
-
|
|
84915
|
+
const flagsForAction = this.getActionFlagSuggestions(
|
|
84807
84916
|
parsed.args[1]?.toLowerCase()
|
|
84808
84917
|
);
|
|
84918
|
+
const usedFlagsHere = extractUsedFlags(parsed.args);
|
|
84919
|
+
suggestions = filterUsedFlags(
|
|
84920
|
+
flagsForAction,
|
|
84921
|
+
usedFlagsHere
|
|
84922
|
+
);
|
|
84809
84923
|
}
|
|
84810
84924
|
} else {
|
|
84811
84925
|
suggestions = completionRegistry.getChildSuggestions(
|
|
@@ -85087,7 +85201,10 @@ var init_completer = __esm({
|
|
|
85087
85201
|
* Get resource type suggestions for a domain
|
|
85088
85202
|
* Phase 1 Enhancement: Uses allResources (dynamically discovered) by default
|
|
85089
85203
|
* Falls back to primaryResources if allResources not available
|
|
85090
|
-
* Respects user configuration setting for completion mode
|
|
85204
|
+
* Respects user configuration setting for completion mode:
|
|
85205
|
+
* - "primary": Only curated primary resources
|
|
85206
|
+
* - "standard": Primary + CRUD resources with meaningful descriptions (default)
|
|
85207
|
+
* - "all": Everything discovered from OpenAPI
|
|
85091
85208
|
*/
|
|
85092
85209
|
getResourceTypeSuggestions(domain) {
|
|
85093
85210
|
const domainInfo = getDomainInfo(domain);
|
|
@@ -85097,6 +85214,12 @@ var init_completer = __esm({
|
|
|
85097
85214
|
let resources;
|
|
85098
85215
|
if (this.settings.completionMode === "primary") {
|
|
85099
85216
|
resources = domainInfo.primaryResources;
|
|
85217
|
+
} else if (this.settings.completionMode === "standard") {
|
|
85218
|
+
const allResources = domainInfo.allResources || domainInfo.primaryResources;
|
|
85219
|
+
resources = allResources?.filter(isResourceCompletionAppropriate);
|
|
85220
|
+
if (!resources || resources.length === 0) {
|
|
85221
|
+
resources = domainInfo.primaryResources;
|
|
85222
|
+
}
|
|
85100
85223
|
} else {
|
|
85101
85224
|
resources = domainInfo.allResources || domainInfo.primaryResources;
|
|
85102
85225
|
}
|
|
@@ -85304,6 +85427,18 @@ var init_completer = __esm({
|
|
|
85304
85427
|
const allFlags = this.getActionFlagSuggestions(action);
|
|
85305
85428
|
return this.filterSuggestions(allFlags, prefix);
|
|
85306
85429
|
}
|
|
85430
|
+
/**
|
|
85431
|
+
* Get available flag completions excluding already-used flags
|
|
85432
|
+
* @param prefix - The prefix to filter by
|
|
85433
|
+
* @param action - Optional action for action-specific flags
|
|
85434
|
+
* @param args - Current command arguments to check for used flags
|
|
85435
|
+
*/
|
|
85436
|
+
getAvailableFlagCompletions(prefix, action, args = []) {
|
|
85437
|
+
const allFlags = this.getActionFlagSuggestions(action);
|
|
85438
|
+
const usedFlags = extractUsedFlags(args);
|
|
85439
|
+
const availableFlags = filterUsedFlags(allFlags, usedFlags);
|
|
85440
|
+
return this.filterSuggestions(availableFlags, prefix);
|
|
85441
|
+
}
|
|
85307
85442
|
/**
|
|
85308
85443
|
* Extract a flag value from args array
|
|
85309
85444
|
* @param args - Array of command arguments
|