# Cd Repository Upgrade

> Migrates a CD Repository configuration file from v1 syntax to v2, enabling advanced content item filtering and improving CD restore performance. Automatically locates the config file from the discovery context if not provided.

- **Type:** Skill
- **Install:** `agentstack add skill-kentico-xperience-by-kentico-kenticopilot-cd-repository-upgrade`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [Kentico](https://agentstack.voostack.com/s/kentico)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [Kentico](https://github.com/Kentico)
- **Source:** https://github.com/Kentico/xperience-by-kentico-kenticopilot/tree/main/plugins/configure-cd-repository/skills/cd-repository-upgrade

## Install

```sh
agentstack add skill-kentico-xperience-by-kentico-kenticopilot-cd-repository-upgrade
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

You are tasked with migrating a CD Repository `repository.config` file from v1 to v2 syntax.

## Input Parameters

- **Repository Config Path** - *(Optional)* Absolute or relative path to the `repository.config` file to migrate.

If no path is provided, the skill will attempt to locate the context file (`cd-repository-context.json`) in the current directory or its parent folders. If found, it will extract the `cdRepositoryConfigPath` from the context file.

## Discovery Logic

If no repository config path is provided as an argument:

1. Search for `cd-repository-context.json` in the current directory and parent directories (up to 3 levels).
2. If found, read the file and extract `cdRepositoryConfigPath`.
3. If not found, ask the user to provide either:
   - The path to the `repository.config` file directly, or
   - The path to the folder containing `cd-repository-context.json`

## Primary Goal

Transform the config file to v2 syntax in-place, with a backup of the original, enabling advanced content item filtering and improved CD restore performance.

## Transformation Steps

### 1. Locate and Validate Input

**If repository config path was provided as argument:**
- Validate the file exists and is valid XML.

**If repository config path was NOT provided:**
- Use the discovery logic from the "Discovery Logic" section above to locate `cd-repository-context.json`.
- Extract `cdRepositoryConfigPath` from the context file.
- If context file cannot be found, ask the user to provide the config path or context folder path.

**For all cases, after locating the file:**
- Check that the file exists and is valid XML.
- Detect the current version:
  - If `` lacks a `Version` attribute or has `Version="1"`, it's v1.
  - If `Version="2"`, inform the user it's already v2 and stop.
  - If any other version, ask the user to verify.

### 2. Create Backup

Create a backup file named `repository.config.v1.backup` in the same directory.

### 3. Migrate RepositoryConfiguration Element

Update the root element to include `Version="2"`:

```xml

```

### 4. Ensure IncludedObjectTypes Exists and Is Explicit

**Behavior change:** In v1, `IncludedObjectTypes` is optional (defaults to all objects). In v2, it must be explicit.

- If `` is missing or empty, add/replace with ``.
- If `` already contains specific object types, keep them as-is.
- Preserve any `` section unchanged.

### 5. Remove Content Item Object Types from ObjectFilters

The following object types can **no longer** appear in `` with `` or ``:

- `cms.contentitem`
- `cms.contentitemcommondata`
- `cms.contentitemlanguagemetadata`
- `cms.contentitemreference`
- `cms.webpageitem`
- `cms.webpageformerurlpath`
- `cms.webpageurlpath`
- `emaillibrary.emailconfiguration`
- `emaillibrary.sendconfiguration`
- `cms.headlessitem`

**Migration approach:**

- Search `ObjectFilters` for any filters applied to these object types.
- **For content item code name filters (e.g., `` or ``):**
  - Extract the code name patterns (both included and excluded).
  - **Do NOT remove them yet** – they will be migrated to the new `ContentItemFilters` element in the next step.
  - Remove only the ObjectFilter entries for these object types from `ObjectFilters`.
  - Make a note of the extracted patterns for step 6.
- **For other object type filters:** Keep them unchanged in `ObjectFilters`.

See [Configure content item filters](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories#configure-content-item-filters) in the Kentico documentation for details on the new approach.

### 6. Migrate Content Item Code Name Filters to ContentItemFilters

If the v1 config had any `` or `` entries, create a new `` section to preserve this filtering.

**Example migration:**

```xml

  article.spring-launch;coffee.espresso;offer.summer
  article.draft%;offer.internal%

  
    article.spring-launch;coffee.espresso;offer.summer
  
  
    article.draft%;offer.internal%
  

```

**Placement:** Add `` **after** `` and before ``.

**If no content item code name filters existed:** Omit this section. Users can add it later if needed.

See [Configure content item filters](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories#configure-content-item-filters) for full details.

### 7. Add Content Items Section (If Not Present)

If no `` exists, add a new section **after** `IncludedObjectTypes` and **before** `ContentItemFilters` or `ExcludedObjectTypes` (if present):

```xml

  
  

```

**Note:** Use `` as the safe default migration choice. The user can refine this post-migration by specifying individual content types.

If `` already exists, preserve it as-is.

### 9. Update Discovery Context File (If Applicable)

If the config path was discovered from a `cd-repository-context.json` file (rather than provided as an argument):

- Read the context file again to ensure you have the latest version.
- Update the `discovery.repositoryConfigVersion` field from `"1"` to `"2"`.
- Write the updated context file back to disk.
- Include a note in the output that the context file was updated.

If the config path was provided explicitly as an argument, skip this step.

### 10. Validate XML

Parse the resulting XML to ensure it is well-formed. If validation fails, report the error and do not overwrite the original file.

### 11. Write Migrated File

- Overwrite the original `repository.config` with the migrated v2 syntax.
- Preserve formatting and indentation where possible.

## Output Format

Conclude with a clear summary:

```
✅ Migration Complete

Config File: [absolute path to repository.config]
Backup: [absolute path to backup file]
[If discovered from context: Located via cd-repository-context.json]
[If context file was updated: Updated discovery context at [path]]

Changes Made:
- Added Version="2" to RepositoryConfiguration element
- [List specific changes made]

Content Item Configuration:
- [Describe IncludedContentItemsOfType changes]
- [If content item code name filters were found and migrated to ContentItemFilters, note them explicitly]
- [Note if user needs to manually review or refine IncludedContentItemsOfType with specific types instead of IncludeAll]

Next Steps:
1. Review the migrated repository.config, especially:
   - IncludedContentItemsOfType configuration (consider replacing `` with specific content types for better performance)
   - ContentItemFilters if present (verify the migrated code name patterns are correct)
   - ObjectFilters to ensure non-content-item filters were preserved correctly
2. Test the migrated config by running a CD store operation:
   dotnet run --no-build -- --kxp-cd-store --repository-path "C:\path\to\CDRepository" --config-path "C:\path\to\repository.config"
   See [Store objects to a CD Repository](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/continuous-deployment#store-objects-to-a-cd-repository) for details.
3. Use 'cd-repository-configure' to build scoped deployment filters from PR/commit changes

References:
- [Migrate CI/CD repository.config to v2](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories/config-v2-migration)
- [Configure content item filters](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories#configure-content-item-filters)
- [Store objects to a CD Repository](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/continuous-deployment#store-objects-to-a-cd-repository)
```

## Rules

- **Discover from context when available.** If no config path is provided, automatically search for and use `cd-repository-context.json` to locate the config file.
- **Update context file if used.** If the config was discovered from a context file, update `discovery.repositoryConfigVersion` from `"1"` to `"2"` in that file. This eliminates the need for the user to run discovery again.
- **Backup first.** Always create a backup before modifying the original file.
- **Preserve non-content-item filters.** Do not remove or modify `ObjectFilters` for non-content-item object types.
- **Migrate content item code name filters.** If the v1 config has `` or ``, migrate these to the new `` element with `` and ``. See [Configure content item filters](https://docs.kentico.com/documentation/developers-and-admins/ci-cd/configure-ci-cd-repositories#configure-content-item-filters) for details.
- **Be explicit about content item filtering.** In the summary, explain what happened with content item filters and guide the user on fine-tuning `IncludedContentItemsOfType` (e.g., replacing `` with specific content types for better performance).
- **Use correct CD commands.** When referencing testing steps, use `--kxp-cd-store` for CD Repository operations (not `--kxp-ci-store`, which is for CI Repository).
- **Validate before writing.** Ensure the migrated XML is well-formed before overwriting the original.
- **Idempotent.** If the file is already v2, do not process it again.
- **Preserve existing IncludedContentItemsOfType.** If the user already has this section configured, do not replace it.

## Decision Tree

**Is the file already v2?**
→ Stop. Inform the user it's already v2 and no migration is needed.

**Does IncludedObjectTypes exist and is not empty?**
→ Keep as-is.

**Does IncludedObjectTypes not exist or is empty?**
→ Replace with ``.

**Does ObjectFilters contain cms.contentitem or related types (cms.contentitem, cms.contentitemcommondata, etc.)?**
→ Extract code name patterns from IncludedCodeNames/ExcludedCodeNames for cms.contentitem.
→ If patterns exist, create a new `` section with `` and `` using the extracted patterns.
→ Remove the cms.contentitem-related filter entries from `ObjectFilters`.
→ Note in the summary which content item code name patterns were migrated.

**Does IncludedContentItemsOfType not exist?**
→ Add `` as safe default.

**Does the migrated XML validate?**
→ If yes, write the file. If no, report the error and do not overwrite.

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [Kentico](https://github.com/Kentico)
- **Source:** [Kentico/xperience-by-kentico-kenticopilot](https://github.com/Kentico/xperience-by-kentico-kenticopilot)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-kentico-xperience-by-kentico-kenticopilot-cd-repository-upgrade
- Seller: https://agentstack.voostack.com/s/kentico
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
