name: manage-profile description: Create or update a versioned profile pair (versioned + unversioned extends pattern). disable-model-invocation: true
Create or update a versioned profile.
Arguments: $ARGUMENTS
Expected arguments: <action> <profile_name> <product(s)> [version]
Actions:
create— Create a new versioned profile pair (versioned + unversioned)update— Bump an existing profile to a new version
For example:
create cis ocp4 1.7.0update cis ocp4 1.8.0
Background: Profile Versioning Pattern
This project uses a two-file versioning pattern for profiles (browse existing profiles under products/<product>/profiles/ for examples):
- Versioned profile (e.g.,
cis-v1-7-0.profile): Contains the actualselections,metadata.version, and all profile configuration. Users pin to this for a stable baseline. - Unversioned profile (e.g.,
cis.profile): Containsextends: cis-v1-7-0and noselectionsof its own. Users referencing this always get the latest version.
When multiple products are specified (e.g., ocp4,rhcos4), both profile pairs are created/updated under their respective products/<product>/profiles/ directories.
Action: create
Step 1: Validate
- Parse the product list (comma-separated). Valid product IDs are subdirectory names under
products/. - Verify
products/<product>/profiles/exists for each product. - Check that the profile does not already exist. If it does, suggest using
updateinstead. - Convert the version to a filename-safe format by replacing dots with dashes (e.g.,
2.0.0→v2-0-0).
Step 2: Check for a Control File
Check if a control file exists that matches the profile name. Control files live under controls/ and products/*/controls/, typically named <profile>_<product>.yml or as a split directory with the same base name. If found:
- Read the control file's top-level YAML to check the
productfield. - If the
productfield does not list all the products from the argument, warn the user and offer to update it. A control file needs all target products listed in itsproductfield to work with each product's profile. Check existing multi-product control files for examples of this pattern.
Step 3: Show the Proposed Files
For each product, show the two files that will be created:
Versioned profile (products/<product>/profiles/<name>-<version>.profile):
---
documentation_complete: true
title: '<Title> for <Product Full Name>'
platform: <product>
metadata:
version: <Version>
description: |-
<Description text.>
selections:
- <control_id>:all
Unversioned profile (products/<product>/profiles/<name>.profile):
---
documentation_complete: true
title: '<Title> for <Product Full Name>'
platform: <product>
metadata:
version: <Version>
description: |-
<Description text.>
extends: <name>-<version>
Ask the user to confirm before creating.
Step 4: Apply
Create all files for each product after approval.
Action: update
Step 1: Validate
- Parse the product list.
- Locate the existing unversioned profile for each product at
products/<product>/profiles/<name>.profile. - Read the unversioned profile to find the current
extendstarget (e.g.,cis-v1-7-0). - Read the current versioned profile to get its
selectionsand other configuration. - Convert the new version to filename-safe format (e.g.,
2.1.0→v2-1-0).
If the unversioned profile doesn't use extends, warn the user that it doesn't follow the versioning pattern and offer to convert it.
Step 2: Show the Proposed Changes
For each product, show what will happen:
- New versioned profile (
<name>-<new_version>.profile): Created with the sameselectionsas the current versioned profile (the user can modify selections afterward). - Previous versioned profile (
<name>-<old_version>.profile): Addstatus: deprecatedto mark it as superseded. - Unversioned profile (
<name>.profile): Updateextendsto point to the new version and updatemetadata.version.
Ask the user to confirm before applying.
Step 3: Apply
After approval:
- Create the new versioned profile by copying the current versioned profile's content and updating
metadata.version. - Add
status: deprecatedto the previous versioned profile. - Update the unversioned profile's
extendsfield to reference the new versioned profile. - Update the unversioned profile's
metadata.versionto the new version. - Show the final state of all modified/created files.
Notes
- Product full names for titles/descriptions: Read the
full_namefield fromproducts/<product>/product.ymlfor each product. - Version format in filenames: Replace dots with dashes and prefix with
v(e.g.,2.0.0→v2-0-0,V2R3→v2r3). - Version format in metadata: Use the version as provided by the user (e.g.,
V2.0.0,V2R3). - Always show the full proposed file contents before creating or modifying.
- When updating, preserve all existing
selections,filter_rules, variables, and other configuration from the current versioned profile.