codemods

codemods runs structured code transformations to migrate your project between c15t versions. It uses ts-morph to safely rewrite imports, JSX, and config objects.

Usage

Run interactively and pick which codemods to apply:

Preview without writing files:

Available codemods

Each codemod is version-aware — the CLI hides codemods that don't apply to your installed c15t version.

IDWhat it does
component-renamesRenames CookieBannerConsentBanner, ConsentManagerDialogConsentDialog, ConsentManagerWidgetConsentWidget.
gdpr-types-to-consent-categoriesMigrates gdprTypes/initialGDPRTypes to consentCategories.
translations-to-i18nMigrates legacy translation config keys to the v2 i18n shape.
tracking-blocker-to-network-blockerMigrates trackingBlockerConfig to network blocker rules.
mode-c15t-to-hostedMigrates legacy mode: 'c15t' to mode: 'hosted'.
react-options-to-top-levelLifts react.theme / react.colorScheme / react.disableAnimation to top-level options.
ignore-geo-location-to-overridesMigrates ignoreGeoLocation: true to overrides: { country: 'DE' }.
offline-add-policy-packsAdds starter policyPackPresets to offline configs missing policies.
add-stylesheet-importsMoves c15t imports into the app CSS entrypoint, including Tailwind 3 and IAB variants.
active-ui-apiMigrates showPopup / isPrivacyDialogOpen to the unified activeUI API.

Safety

  • All codemods support --dry-run.
  • Codemods are idempotent — running twice produces the same result.
  • The CLI prints a per-file diff summary so you can review changes before committing.
  • Run on a clean git working tree so you can git diff and revert if needed.