rebake
Keep your cookiecutter projects fresh out of the oven.
A spiritual successor to cruft for managing cookiecutter projects.
Quick Start · Why rebake? · Usage · Configuration · Migrating from cruft
Quick Start
No installation required — run it with uv from any project generated by cookiecutter and tracked by rebake.yaml or .cruft.json:
uvx rebake check # is the project behind its template?
uvx rebake update # re-bake: apply the latest template changes
Already using cruft? rebake reads .cruft.json as-is — see Migrating from cruft.
Why rebake?
rebake improves on cruft in two key areas:
- Partial apply on conflict — uses
git apply --rejectto apply all applicable hunks; only the unresolvable portions are saved as.rejfiles. - New variable detection — prompts for variables added to the template since the project was last updated.
And adds a few things cruft does not have:
| cruft | rebake | |
|---|---|---|
| Templates per repository | One | Many — e.g. a shared root template plus per-directory scaffolds (Multiple templates) |
| Update hooks | — | pre-update / post-update shell commands (Hooks) |
| Config file | .cruft.json |
rebake.yaml (still reads .cruft.json) |
Installation
Requirements: Python 3.12+, uv and Git.
# install permanently
uv tool install rebake
# or add it to a project
uv add rebake
Usage
| Command | What it does |
|---|---|
rebake create |
Bootstrap a new project from one or more templates and write rebake.yaml |
rebake add |
Register and render an additional template into an existing repository |
rebake check |
Check whether the project is up-to-date with its template(s) |
rebake update |
Apply the latest template changes to the project |
rebake reparametrize |
Change template variables and re-apply the diff |
rebake create
rebake create <TEMPLATE> [TEMPLATE[=TARGET] ...] [OPTIONS]
Bootstrap a new project from one or more cookiecutter templates and write its
rebake.yaml. The first template creates the project directory; each later
template is rendered into the repository root or its specified sub-path —
equivalent to a create followed by one rebake add per template.
| Option | Description |
|---|---|
--output-dir, -o |
Directory to create the project in (default: .). |
--checkout |
Branch, tag or commit for the first template. |
Example — a Go scaffold at the root, a shared common template also at the root,
and a DB-migration scaffold under migrate/:
rebake create https://github.com/org/cookiecutter-go \
https://github.com/org/cookiecutter-common \
https://github.com/org/cookiecutter-migration=migrate
How the template arguments are interpreted:
- The first template determines the generated repository name through its
top-level Cookiecutter directory (commonly from
cookiecutter.project_name). It always creates the repository root; an=TARGETsuffix on the first argument is not supported. The first template is never split, so=in its URL is unambiguous. - Later templates have their Cookiecutter wrapper stripped before their
contents are copied into the new repository. A bare later template targets the
repository root; append
=TARGETto place it in a sub-directory. The template comes first and the split is on the last=, so a URL containing=needs an explicit=TARGET— use=.to place such a template at the root. - Overlapping targets — when more than one link targets the same directory
(typically the root), the templates are copied in argument order, so a later
copy replaces an earlier file during
create. Futurerebake updateoperations do not guarantee this precedence: overlapping changes can produce.rejfiles. Avoid having multiple templates own the same path.
Additional links are registered with their template and target_directory
only; to pin a checkout or set a name per link, edit rebake.yaml after
creating (see Multiple templates).
rebake add
rebake add <TEMPLATE> [--project-dir REPO] [--target-directory SUBDIR] [--checkout REF]
Register and render an additional cookiecutter template into an existing repository. This is how a repository comes to track multiple templates.
| Argument / Option | Description |
|---|---|
<TEMPLATE> |
A cookiecutter template URL or local path (anything cookiecutter accepts, e.g. https://github.com/org/repo or ./path/to/template). |
--target-directory, -t |
Sub-path within the repository to render into (default: ., the repository root). This is the entry's target_directory in rebake.yaml. Cookiecutter's top-level project-name folder is stripped, so the template's files land directly under this path. |
--project-dir, -p |
Repository root whose rebake.yaml the new entry is appended to (created if absent). |
--checkout, -c |
Branch, tag or commit to pin. |
Example — a repository tracking a shared "common" template at its root and a
Go service scaffold under api/:
rebake add https://github.com/org/cookiecutter-common # -> repo root
rebake add https://github.com/org/cookiecutter-go -t api # -> api/
rebake check
rebake check [PROJECT_DIR] [OPTIONS]
Check whether the project is up-to-date with its template(s). When a repository tracks multiple templates, every one is checked and the command reports each; it exits non-zero if any is outdated.
| Option | Description |
|---|---|
--name, -n |
Check only the multi-template link(s) with this name (repeatable, e.g. -n api -n batch). Defaults to all links. |
| Exit code | Meaning |
|---|---|
0 |
Up-to-date |
1 |
Outdated |
2 |
Error (e.g. neither rebake.yaml nor .cruft.json found) |
rebake update
rebake update [PROJECT_DIR] [OPTIONS]
Apply the latest template changes to the project. rebake will:
- Abort if there are uncommitted changes (commit or stash first)
- Then, for each selected template link in
rebake.yamlorder:- Detect new variables added to the template and prompt for their values
(with
--quiet, exit 1 here — before this link's hooks have run) - Generate a diff between the old and new rendered templates
- Run
pre-updatehooks (if defined) — abort if any hook fails, before the diff is applied - Apply the diff with
git apply --reject— applicable hunks are written immediately; unresolvable hunks are saved as.rejfiles for manual resolution. A file the template deleted is removed if it still matches the template; if you changed it, it is kept and the deletion diff is saved as its.rejfile; if you already removed it, nothing happens - Update
rebake.yamlwith the new commit hash and any newly added variables - Run
post-updatehooks (if defined)
- Detect new variables added to the template and prompt for their values
(with
Each link is fully updated and saved before the next one starts, so if a later link fails (e.g. a hook exits non-zero), the links before it stay updated.
| Option | Description |
|---|---|
--allow-untracked-files |
Allow update even if untracked files exist (no other changes). |
--quiet |
Disable interactive prompts; exit 1 if new variables are found without a supplied value. |
--checkout, -c |
Branch, tag or commit to follow. On a multi-template repo, use <name>@<ref> (e.g. go@main) to target the link named go; a bare <ref> is rejected as ambiguous. |
--name, -n |
Update only the multi-template link(s) with this name (repeatable, e.g. -n api -n batch). Defaults to all links. Orthogonal to --checkout, so they compose: --name api --checkout api@main. |
Hooks
Define shell commands to run before or after the update in rebake.yaml:
hooks:
pre-update:
- make lint # runs before the patch is applied; abort on failure
post-update:
- go generate ./... # runs after rebake.yaml is saved; abort on failure
- make fmt
Hooks run in the template link's target directory (the repository root unless
target_directory is set) with the following environment variables available:
| Variable | Value |
|---|---|
REBAKE_TEMPLATE |
Template repository URL |
REBAKE_OLD_COMMIT |
Commit hash before the update |
REBAKE_NEW_COMMIT |
Commit hash after the update |
REBAKE_PROJECT_DIR |
Absolute path to the repository root |
REBAKE_TARGET_DIR |
Absolute path to this template's target directory (REBAKE_PROJECT_DIR/<target_directory>) |
For multi-template repositories, hooks run once per template link.
Non-interactive usage (e.g. from an LLM agent)
--quiet is designed for automated workflows where interactive prompts are not possible.
# Attempt update non-interactively; exit 1 if new variables need values
rebake update --quiet
When --quiet is used and new variables are found, rebake prints each variable
name and its default value to stderr, then exits with code 1.
rebake reparametrize
rebake reparametrize [PROJECT_DIR] [OPTIONS]
Change the template variables of an existing project and re-apply the difference. rebake will:
- Abort if there are uncommitted changes (commit or stash first)
- Then, for each selected template link in
rebake.yamlorder:- Prompt for the link's cookiecutter variables, showing the current value
as the default (press Enter to keep it). Private variables (keys starting
with
_) are carried over without a prompt. If nothing changed, the link is left as-is. - Render the template at the link's recorded
committwice — with the old and with the new values — and apply the diff withgit apply --reject(unresolvable hunks are saved as.rejfiles, as inupdate) - Save the new values to
rebake.yaml
- Prompt for the link's cookiecutter variables, showing the current value
as the default (press Enter to keep it). Private variables (keys starting
with
As with update, each link is saved before the next one starts, so an aborted
run keeps the links already reparametrized.
The template commit is not changed; run rebake update
separately to follow the template. Hooks are not run, and there is no --quiet
mode since the command is interactive by nature.
| Option | Description |
|---|---|
--allow-untracked-files |
Allow reparametrize even if untracked files exist (no other changes). |
--name, -n |
Reparametrize only the multi-template link with this name. Defaults to all links. Unlike check/update, this option is not repeatable. |
Multiple templates
A single repository can track more than one cookiecutter template — for example a shared CI/config template at the root plus one language scaffold per sub-directory.
- Each template link (an entry in the
templates:list) records its owncommitand atarget_directory(the sub-path its patches apply to). rebake checkandrebake updateoperate on every link by default;updateapplies each template's diff into its owntarget_directory.- Pass
--name/-n(repeatable) to scope either command to specific links by theirname— handy for opening a focused, single-subproject PR when several links have drifted at once.rebake reparametrizetakes the same option, but only a single--name. - Every link is self-contained:
context,checkout,skipandhooksare all per-entry, so each template keeps its own variables and hooks.
Bootstrap several links at once with rebake create, add one
to an existing repository with rebake add, or hand-edit the
templates: list in rebake.yaml.
Migrating from cruft
rebake reads .cruft.json as-is. No migration needed — just replace cruft with rebake in your commands.
- cruft check
- cruft update
+ rebake check
+ rebake update
The next rebake update writes rebake.yaml and removes .cruft.json (see Legacy formats).
rebake.yaml format
rebake writes the templates: list form (one entry per template link, even
when there is only one):
templates:
- template: https://github.com/owner/cookiecutter-common
commit: aaa111...
name: common # optional: label to target this link from the CLI
checkout: main # optional: branch/tag/commit to track
context:
cookiecutter:
project_name: my-repo
author: Jane Doe
skip: # optional: paths the template never touches
- go.sum
- "**/*.lock"
hooks: # optional: shell commands to run on update
pre-update:
- make lint
post-update:
- make fmt
# target_directory defaults to "." (repository root)
- template: https://github.com/owner/cookiecutter-go
commit: bbb222...
name: go
target_directory: api # this link's patches apply under api/
context:
cookiecutter:
project_name: my-repo
| Key | Required | Description |
|---|---|---|
template |
yes | Template repository URL. |
commit |
yes | Template commit the project was last rendered from. |
context |
Cookiecutter variables (context.cookiecutter.*). |
|
name |
Label to target this link from the CLI. Must be unique and match [a-zA-Z0-9_-]+. |
|
checkout |
Branch, tag or commit to track. | |
target_directory |
Sub-path within your repository that the link's patches apply to (default: .). |
|
skip |
Paths that update / reparametrize leave alone (Skipping files). |
|
hooks |
pre-update / post-update shell commands (Hooks). |
target_directory is intentionally not named directory: cruft's
.cruft.json uses directory for the opposite thing (a sub-directory inside
the template repo), so rebake ignores that key on read and reserves the name.
name is an optional label for a link. On a multi-template repo it lets you
target one link from the CLI, e.g. rebake update --checkout go@main follows
main only for the link named go.
Skipping files
skip lists paths, relative to target_directory, that rebake update and
rebake reparametrize never create, modify or delete. Use it for files you own
after the initial render, such as lock files. The semantics match cruft's, so a
.cruft.json skip list keeps its meaning:
- An entry without
*is a literal path. If it names a directory, rebake skips the whole directory. - An entry containing
*is a glob pattern, matched like Python'sPath.glob.*.lockmatches only at the top level. Use**/*.lockto match at any depth.
Entries match the rendered paths. If a template variable is part of a skipped
path and reparametrize changes it, list the path under both its old and new
names.
Legacy formats (read-only)
For backward compatibility, rebake also reads the older single-template
top-level form and a cruft .cruft.json with the same keys. The next
rebake update rewrites the file into the templates: list form above.
template: https://github.com/owner/template
commit: abc123...
checkout: main
context:
cookiecutter:
project_name: my-project
Development
git clone https://github.com/kitagry/rebake
cd rebake
uv sync
uv run pytest
Metadata
Release files for rebake 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rebake-0.3.1.tar.gz | 73.0 kB | With provenance | Details for rebake-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rebake-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for rebake-0.3.1-py3-none-any.whl |
Total release size: 102.5 kB
Release files / rebake-0.3.1.tar.gz
| Download URL | rebake-0.3.1.tar.gz |
|---|---|
| Size | 73.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
66d47da0e87568e55b024b1ff07bfff7a87fcd5d9ac19e0e76eaa3e21b6d0dd4
|
|
BLAKE2b-256 checksum How to use checksums |
1818ab736b6d8efd6d68f59fe6711ba5b0c13e2235f14f52720205a1ff9e575b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logRelease files / rebake-0.3.1-py3-none-any.whl
| Download URL | rebake-0.3.1-py3-none-any.whl |
|---|---|
| Size | 29.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
61d7b7ce27a950c61dbd90605520a2c43e9bd33f9b717ae32451f45cc82e97d2
|
|
BLAKE2b-256 checksum How to use checksums |
c44c55c509ed18f0e894eb2066d4e0c506058c705bdc5b714b107652c0764a29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logSecurity for rebake 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rebake-0.3.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.