roneoREADME.md
ee892817f152551895f8482d4db15cefa51ef865- <p align="center">
- <img src="assets/logo.svg" alt="Ronéo" width="96" height="96" />
- </p>
- # Ronéo (`roneo`)
- > A fast, standalone Rust port of [Copier](https://github.com/copier-org/copier) — scaffold and update projects from Jinja2 templates with no Python runtime.
- The name **Ronéo** comes from the classic stencil duplicator (*"passer à la ronéo"*): reproducing project templates cleanly, quickly, and without friction.
- ## Installation
- ### Via `mise` (recommended)
- ```bash
- mise plugins install forge https://code.cleyrop.tech/mise.git
- mise use -g forge:roneo@latest
- ```
- Or declare it in `mise.toml`:
- ```toml
- [plugins]
- forge = "https://code.cleyrop.tech/mise.git"
- [tools]
- "forge:roneo" = "latest"
- ```
- Upgrade later with:
- ```bash
- mise upgrade forge:roneo
- ```
- ### Via install script (macOS & Linux, SHA-256 verified)
- ```bash
- curl -fsSL https://code.cleyrop.tech/roneo/raw/main/install.sh | sh
- ```
- ### From source (`cargo`, Rust `1.100+`)
- ```bash
- cargo install --path crates/roneo-cli
- ```
- ## Benchmarks
- Measured on Apple M3 Pro (macOS, `hyperfine`, release build of `roneo 0.1.0` vs. `copier 9.15.1` on `examples/starter-template`):
- | Operation | `roneo` | `copier` | Speedup | Peak RAM (`roneo` / `copier`) |
- | --- | ---: | ---: | ---: | ---: |
- | `--version` (CLI startup) | **3.0 ms** | 365.0 ms | **121x** | **2.5 MiB** / 55.4 MiB |
- | `copy --defaults` | **4.3 ms** | 412.7 ms | **96x** | **5.0 MiB** / 55.9 MiB |
- | `copy --defaults --pretend` | **3.5 ms** | 370.4 ms | **107x** | **5.1 MiB** / 55.9 MiB |
- | `inspect` | **2.5 ms** | — | — | **3.4 MiB** / — |
- Reproduce locally:
- ```bash
- cargo build --release
- hyperfine --warmup 2 \
- "./target/release/roneo copy ./examples/starter-template /tmp/out-r --defaults --overwrite" \
- "copier copy ./examples/starter-template /tmp/out-c --defaults --overwrite"
- ```
- ## Ronéo vs. Copier
- | Aspect | Ronéo (`roneo`) | Copier (`copier`) |
- | --- | --- | --- |
- | Distribution | Single native binary (~5.8 MB) | Python package (`pipx` / `uvx` / virtualenv) |
- | Runtime dependency | None (static musl on Linux, notarised arm64 on macOS) | Python 3.9+ and dependencies |
- | Template format | `copier.yml` / `copier.yaml` / `roneo.yml` | `copier.yml` / `copier.yaml` |
- | Answers file | Interoperable `.copier-answers.yml` (auto-written if omitted) | `.copier-answers.yml` |
- | Template engine | `minijinja` + `pycompat` (Python methods) | Jinja2 (Python) |
- | Extensions | Sandboxed WebAssembly (`wasmi`, no disk/network) | Arbitrary Python Jinja extensions (`--trust`) |
- | Extra CLI tools | `inspect` (`--json`), `diff`, `plugin`, `completions` | — |
- | Library reuse | `roneo-core` crate (`Prompter` / `Reporter` traits) | Python API |
- ## Quick Start
- ```bash
- # Inspect a template's questions, settings, and tasks
- roneo inspect ./examples/starter-template
- # Dry-run without writing any files
- roneo copy ./examples/starter-template /tmp/my-project --defaults --pretend
- # Scaffold interactively
- roneo copy ./examples/starter-template /tmp/my-project
- # Non-interactive with variable overrides
- roneo copy ./examples/starter-template /tmp/my-project \
- --defaults \
- -d project_name=super-api \
- -d license=Apache-2.0
- ```
- ## CLI Reference
- ### Commands
- | Command | Purpose |
- | --- | --- |
- | `roneo copy <template> [dest]` | Scaffold a project from a local path, Git URL, `gh:owner/repo`, or `gl:owner/repo`. |
- | `roneo update [dest]` | Update a Git-tracked project via 3-way merge (`--conflict inline\|rej`), keeping local edits. |
- | `roneo diff [dest]` | Preview the colored 3-way diff of `roneo update` without modifying files. |
- | `roneo check-update [dest]` | Check for newer template versions (`--output-format plain\|json`, `-q` exits `2` if outdated). |
- | `roneo recopy [dest]` | Re-apply a template using saved `.copier-answers.yml` answers (no 3-way diff). |
- | `roneo inspect <template>` | Print metadata, settings, `--trust` tasks, and questions (`--json` supported). |
- | `roneo plugin <subcmd>` | Manage local `.wasm` plugins (`install`, `list`, `inspect`, `remove`). |
- | `roneo completions <shell>` | Generate shell completions (`bash`, `zsh`, `fish`). |
- ### Key Flags
- | Flag | Scope | Effect |
- | --- | --- | --- |
- | `-r, --vcs-ref REF` | `copy`, `update`, `diff` | Target branch, tag, commit, or `:current:` |
- | `-d, --data KEY=VAL` / `--data-file PATH` | `copy`, `update`, `recopy` | Supply or override answers (`-d` repeatable) |
- | `-l, --defaults` / `--ask Q` | `copy`, `update`, `recopy` | Skip prompts, or force a prompt for specific questions |
- | `-A, --skip-answered` | `update`, `recopy` | Reuse existing answers without prompting |
- | `-n, --pretend` | `copy`, `update`, `recopy` | Dry-run (no writes, no tasks) |
- | `-w, --overwrite` / `-f, --force` | `copy` | Overwrite files (`-f` = `--defaults --overwrite`) |
- | `-o, --conflict inline\|rej` / `-c N` | `update`, `diff` | Conflict markers or `.rej` files; diff context lines |
- | `-s, --skip PATTERN` / `-g, --prereleases` | `copy`, `update`, `check-update` | Skip matching paths; allow PEP 440 pre-releases |
- | `--trust` (`--UNSAFE`) / `-T, --skip-tasks` | `copy`, `update`, `recopy` | Allow or skip shell `_tasks` and `_migrations` |
- | `--plugin PATH_OR_NAME` | `copy`, `update`, `recopy` | Load a `.wasm` plugin by path or installed alias |
- ## Copier Compatibility
- Targets **Copier 9.19.1** (`_min_copier_version` enforced):
- | Area | Supported Features |
- | --- | --- |
- | Configuration | `copier.yml` / `copier.yaml`, multi-document YAML, list merging, `!include` + globs, `_external_data`, `settings.yml` |
- | Questions | `str`, `int`, `float`, `bool`, `yaml`, `json`; Jinja `type`, `default`, `choices` (list/map), `multiselect`, `when`, `ask`, `validator`, `multiline`, `secret` |
- | Templates & paths | Jinja2 (`minijinja` + `pycompat`, `_envops`), path confinement, dynamic paths, conditional dirs, `{% yield %}` loops, `_subdirectory`, `_templates_suffix`, `_preserve_symlinks` |
- | Built-in filters | `to_nice_yaml`, `from_yaml`, `from_json`, `to_nice_json`, `slugify`, `to_snake`/`to_camel`/`to_pascal`/`to_kebab`, `b64encode`/`b64decode`, `to_bool`, `pathjoin`, `now()`, `UNSET` |
- | Lifecycle & updates | 3-way Git merge (`--3way` / `--reject` + squash-safe `git merge-file` fallback), `.gitignore` & `_skip_if_exists` guards, PEP 440 downgrade guard, `_answers_file` rename cleanup |
- | VCS & caching | Local dirs, Git URLs, `gh:` / `gl:`, monorepo subdirectories, `.bundle`, submodules, local mirror cache (`~/.cache/roneo/repos`) |
- | Tasks & migrations | `_tasks` and `_migrations` (`before` / `after`, `_stage`, `extra_env`, `COPIER_OPERATION`) behind `--trust` |
- | Extensions | Sandboxed WebAssembly plugins via `roneo-plugin-sdk`, `roneo plugin`, and `_roneo_plugins` |
- ## WebAssembly Plugins (`roneo-plugin-sdk`)
- `roneo` stays 100% generic: no domain-specific extension is compiled into the binary. Write extensions in an independent Rust crate targeting `wasm32-unknown-unknown`, executed in a `wasmi` sandbox without disk or network access:
- ```bash
- # Build a WASM plugin depending on roneo-plugin-sdk
- cd my-plugin && cargo build --release --target wasm32-unknown-unknown
- # Install it under ~/.config/roneo/plugins/my-plugin.wasm
- roneo plugin install target/wasm32-unknown-unknown/release/my_plugin.wasm
- # Run with the plugin alias
- roneo copy --trust --defaults --plugin my-plugin <template> <dest>
- ```
- Templates can also bundle a `.wasm` file and declare `_roneo_plugins: [template/extensions/my-plugin.wasm]` in `copier.yml` / `roneo.yml` for automatic loading.
- ## User Settings (`settings.yml`)
- Read automatically in priority order from `$RONEO_SETTINGS_PATH`, `$COPIER_SETTINGS_PATH`, `~/.config/roneo/settings.yml`, or `~/.config/copier/settings.yml`:
- ```yaml
- defaults:
- author_name: Alice
- trust:
- - /srv/trusted-templates/
- - https://code.cleyrop.tech/
- ```
- ## Development
- ```bash
- cargo test --workspace
- cargo clippy --workspace --all-targets -- -D warnings
- cargo build --release
- ```
- ## License
- MIT — see [LICENSE](LICENSE).