For the complete documentation index, see llms.txt. This page is also available as Markdown.
Cortex XSOAR 6.xCortex XSOAR 8 (SaaS)Cortex XSOAR 8.x (On-premCortex XSIAM

format

Format Cortex content files to meet standards and validate new or modified content.

This command formats new or modified files to align with the Cortex standard. This is useful when developing a new integration, script, playbook, incident field, incident type, indicator field, indicator type, layout, or dashboard. When formatting is complete, the validate command runs and notifies you of any issues the formatter could not fix.

Arguments

-i PATH_TO_FILE or PATH_TO_DIRECTORY, --input PATH_TO_FILE or PATH_TO_DIRECTORY

The path of the file to be formatted. If no input is specified, the formatting will be executed on all new/changed files.

-o OUTPUT_PATH, --output OUTPUT_PATH

Specifies where the formatted file should be saved to. If not used, the default is to overwrite the original file.

-fv FROM_VERSION_KEY, --from-version FROM_VERSION_KEY

Specifies the minimum version that this content item or content pack is compatible with.

-nv, --no-validate

No file validation is needed.

-ud, --update-docker

Updates the Docker image of the integration/script to the newest available tag.

-ng, --no-graph

Skips formatting using graphs.

-y/-n, --assume-yes/--assume-no

Assumes automatic yes/no as an answer to all prompts and runs non-interactively.

-d, --deprecate

Deprecates the integration/script/playbook.

-g, --use-git

Uses Git to automatically recognize which files changed and runs format on them.

--prev-ver

The previous branch or SHA1 commit to run checks against.

-iu, --include-untracked

Whether to include untracked files in the formatting.

-at, --add-tests

Whether to answer manually to add a test configuration prompt when running interactively.

-gr/-ngr, --graph/--no-graph

Whether to use the content graph.

Examples
  • demisto-sdk format

    Checks your branch changes and runs only on them.

  • demisto-sdk format -i Integrations/Pwned-V2/Pwned-V2.yml

    Goes through the integration file, formats it, and overrides the original file with the necessary changes.

  • demisto-sdk format -i Integrations/Pwned-V2/Pwned-V2.yml -o Integrations/Pwned-V2/formatted-Pwned-V2.yml

    Goes through the integration file, formats it, and saves it to a new file Integrations/Pwned-V2/formatted-Pwned-V2.yml with the necessary changes, while keeping the origin file as it was.

  • demisto-sdk format -i Packs/CortexXDR --from-version 10.10.10

    Formats all JSON/YAML files under the Pack CortexXDR. This also sets the fromVersion key in all files to 10.10.10.

  • demisto-sdk format -i /Users/user/Downloads/Kenna_-_Search_and_Handle_Asset_Vulnerabilities.yml

    Formats the given YAML file, but validation is not run as this file is not part of the content repository.

  • demisto-sdk format -i /Users/user/Downloads/Kenna_-_Search_and_Handle_Asset_Vulnerabilities.yml -o Integrations/Kenna_-_Search_and_Handle_Asset_Vulnerabilities.yml

    Formats the given YAML file and saves it in the content repository under the specified file path. Also validation runs as the output file is in the content repository.

Set the fromVersion key in different files

Run without the fromVersion flag

If the source file name already exists in the content repository

  • If the fromVersion key exists already in the current file, the fromVersion key will not change.

  • If the fromVersion key does not exist in the current file:

    • If the fromVersion key exists in an old file in the content repository, set the fromVersion key as in the old file.

    • If the fromVersion key does not exist in an old file in the content repository, the system sets the fromVersion key to default 1.0.0.

If the source file name does not exist in content repository

  • If the fromVersion key exists already in the current file, the fromVersion key will not change.

  • If the fromVersion key does not exist in the current file, the system sets the fromVersion key to 5.0.0.

Run with the fromVersion flag

  • If the fromVersion key exists already in the current file, the system sets the fromVersion key to the required version.

  • If the fromVersion key does not exist in the current file, add the fromVersion key and set it to the required version.

Last updated

Was this helpful?