| name | bulk-update-field |
| description | Bulk update a Contentful field value with the provided script, including dry runs and publishing guidance. |
Skill: Bulk Update Contentful Field
Overview
This skill explains how to use the scripts/bulk-update-field.js script to bulk update a field value for entries in Contentful, including publishing changes. It supports dry-run mode for safe testing.
Prerequisites
- Node.js 18+ (for global fetch)
- Environment variables set (or .env file):
CONTENTFUL_MANAGEMENT_TOKEN (API token)
CONTENTFUL_SPACE_ID (space ID)
- Optionally:
CONTENTFUL_ENV_ID (defaults to master)
- The script file:
scripts/bulk-update-field.js
Usage
Run the script from the project root:
node scripts/bulk-update-field.js <contentType> <fieldName> <oldValue> <newValue> [--dry]
<contentType>: Contentful content type ID (e.g. ruleReference)
<fieldName>: Field to update (e.g. category)
<oldValue>: Current value to match (e.g. skill)
<newValue>: New value to set (e.g. agent > skill)
--dry: Optional. If provided, the script logs actions but does not update or publish entries.
Example
To update all ruleReference entries with category skill to agent > skill:
node scripts/bulk-update-field.js ruleReference category skill "agent > skill"