I wanted Copier in Rust, so I wrote rootstock
Описание и применение
Rootstock – это Rust‑бинарник, который позволяет создавать проекты из версии git‑шаблонов и обновлять их, сохраняя локальные изменения, через трёх‑сторонний слияние, устраняя необходимость Python‑зависимостей.
Задача
Project templates change over time, but tools like Copier are Python-based, requiring Python and pipx on every machine and CI job, which is inconvenient for Rust developers who prefer a single binary.
Результат
Rootstock enables Rust developers to create and update projects from versioned git templates with a single binary, preserving local edits through three‑way merges and providing automated CI integration.
Рабочий процесс
- 1. Run
rootstock new <template> <project> --data <answers>to generate a project and write.rootstock.tomlwith template source, tag, commit, answers, and file list. - 2. When the template updates, run
rootstock updateto perform a three‑way merge, showing conflicts with Git merge markers. - 3. Resolve conflicts, run
rootstock checkto ensure no leftover markers, commit, and optionally open a PR. - 4. For existing projects, use
rootstock import-copierto convert a Copier template or project into rootstock format. - 5. Automate updates in CI by running
rootstock updateand handling exit code 2 for conflicts. - 6. Use
rootstock checkin CI to fail on unresolved markers or side files.
Доказательства
Project templates were the exception. The best tool I know for them is Copier, and it's genuinely good. But it's Python, so every machine and every CI job that touches a template needs Python and pipx first.
rootstock new renders the template and writes a small record, .rootstock.toml, next to your files: the template source, the tag and exact commit, your answers, and the list of files it wrote.
Later the template ships v1.1.0. It bumps actions/checkout in CI and adds --all-targets to the test and lint targets in the Makefile.
rootstock update updated to v1.1.0 markers Makefile 1 conflict
rootstock check runs in CI without network access and fails on leftover markers or side files, so a half-resolved conflict can't slip into main.
rootstock import-copier converts a Copier template, a project generated by Copier, or both if they live in the same directory.
- Дата записи: 2026-11-01T03:43:58.217Z