From 525601174236ed601c4c6c72e2abf1a83fb56ce1 Mon Sep 17 00:00:00 2001 From: ilappe Date: Tue, 25 Feb 2025 15:13:45 +0200 Subject: [PATCH 1/3] support hidden commands --- demisto_sdk/commands/common/tools.py | 2 +- demisto_sdk/commands/content_graph/objects/integration.py | 1 + demisto_sdk/commands/content_graph/parsers/integration.py | 3 +++ .../validators/RM_validators/RM110_is_commands_in_readme.py | 1 + 4 files changed, 6 insertions(+), 1 deletion(-) diff --git a/demisto_sdk/commands/common/tools.py b/demisto_sdk/commands/common/tools.py index f031490a560..7657e3ad668 100644 --- a/demisto_sdk/commands/common/tools.py +++ b/demisto_sdk/commands/common/tools.py @@ -3540,7 +3540,7 @@ def extract_none_deprecated_command_names_from_yml(yml_data: dict) -> list: """ commands_ls = [] for command in yml_data.get("script", {}).get("commands", {}): - if command.get("name") and not command.get("deprecated"): + if command.get("name") and not command.get("deprecated") and not command.get("hidden"): commands_ls.append(command.get("name")) return commands_ls diff --git a/demisto_sdk/commands/content_graph/objects/integration.py b/demisto_sdk/commands/content_graph/objects/integration.py index 42f305a8229..d00ba2669fd 100644 --- a/demisto_sdk/commands/content_graph/objects/integration.py +++ b/demisto_sdk/commands/content_graph/objects/integration.py @@ -61,6 +61,7 @@ class Command(BaseNode, content_type=ContentType.COMMAND): # type: ignore[call- outputs: List[IntegrationOutput] = Field([], exclude=True) deprecated: bool = Field(False) + hidden: bool = Field(False) description: Optional[str] = Field("") # missing attributes in DB diff --git a/demisto_sdk/commands/content_graph/parsers/integration.py b/demisto_sdk/commands/content_graph/parsers/integration.py index a2f297bee8e..262eaa9170f 100644 --- a/demisto_sdk/commands/content_graph/parsers/integration.py +++ b/demisto_sdk/commands/content_graph/parsers/integration.py @@ -21,6 +21,7 @@ class CommandParser: name: str deprecated: bool + hidden: bool description: str args: List[dict] outputs: List[dict] @@ -87,6 +88,7 @@ def connect_to_commands(self) -> None: for command_data in self.script_info.get("commands", []): name = command_data.get("name") deprecated = command_data.get("deprecated", False) or self.deprecated + hidden = command_data.get("hidden", False) description = command_data.get("description") args = command_data.get("arguments") or [] outputs = command_data.get("outputs") or [] @@ -103,6 +105,7 @@ def connect_to_commands(self) -> None: name=name, description=description, deprecated=deprecated, + hidden=hidden, args=args, outputs=outputs, ) diff --git a/demisto_sdk/commands/validate/validators/RM_validators/RM110_is_commands_in_readme.py b/demisto_sdk/commands/validate/validators/RM_validators/RM110_is_commands_in_readme.py index cf16a4c28cc..69ae341cc04 100644 --- a/demisto_sdk/commands/validate/validators/RM_validators/RM110_is_commands_in_readme.py +++ b/demisto_sdk/commands/validate/validators/RM_validators/RM110_is_commands_in_readme.py @@ -41,6 +41,7 @@ def obtain_invalid_content_items( if command.name not in content_item.readme.file_content and command.name not in COMMANDS_EXCLUDED_FROM_README_DOCUMENTATION and not command.deprecated + and not command.hidden and not command.name.endswith("get-indicators") ] if undocumented_commands: From 3c7335fc6743bfd3f17a263091bb15ba55127d6c Mon Sep 17 00:00:00 2001 From: ilappe Date: Tue, 25 Feb 2025 15:39:24 +0200 Subject: [PATCH 2/3] fix pre commit --- demisto_sdk/commands/common/tools.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/demisto_sdk/commands/common/tools.py b/demisto_sdk/commands/common/tools.py index 7657e3ad668..dd29f792991 100644 --- a/demisto_sdk/commands/common/tools.py +++ b/demisto_sdk/commands/common/tools.py @@ -3540,7 +3540,11 @@ def extract_none_deprecated_command_names_from_yml(yml_data: dict) -> list: """ commands_ls = [] for command in yml_data.get("script", {}).get("commands", {}): - if command.get("name") and not command.get("deprecated") and not command.get("hidden"): + if ( + command.get("name") + and not command.get("deprecated") + and not command.get("hidden") + ): commands_ls.append(command.get("name")) return commands_ls From f997e6c7eb200b32929b073881e101fb87275969 Mon Sep 17 00:00:00 2001 From: ilappe Date: Tue, 25 Feb 2025 17:47:05 +0200 Subject: [PATCH 3/3] added chanlog --- .changelog/4836.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .changelog/4836.yml diff --git a/.changelog/4836.yml b/.changelog/4836.yml new file mode 100644 index 00000000000..bebf9791366 --- /dev/null +++ b/.changelog/4836.yml @@ -0,0 +1,4 @@ +changes: +- description: Added support for hidden commands. + type: internal +pr_number: 4836