Skip to main content
Codegen requires you to explicitly commit changes by calling codebase.commit().
Keeping everything in memory enables fast, large-scale writes. See the How it Works guide to learn more.
You can manage your codebase’s state with two core APIs:

Committing Changes

When you make changes to your codebase through Codegen’s APIs, they aren’t immediately written to disk. You need to explicitly commit them with codebase.commit():
This transaction-like behavior helps ensure your changes are atomic and consistent.

Resetting State

The codebase.reset() method allows you to revert the codebase to its initial state:
reset() reverts both the in-memory state and any uncommitted filesystem changes. However, it preserves your codemod implementation in .codegen/.