feat(init): Default-driven template + --force / --name flags#72
Merged
Conversation
Closes #36. `init_manifest` previously hardcoded TOML strings for the octad defaults. Any change to `OctadConfig::default()` silently diverged from what `init` wrote. Replace the hardcoded body with `render_manifest_template(database, name)`, which builds the TOML from `ProjectConfig::default()`, `OctadConfig::default()` and `SidecarConfig::default()`. The rendered output now tracks code. Add two flags to `Commands::Init`: - `--name <NAME>` — set `[project].name` directly so a new repo doesn't need a post-init edit. - `--force` — overwrite an existing `verisimiser.toml` instead of bailing. Default behaviour (no flag) still refuses to clobber. Three unit tests in `manifest::init_template_tests`: - `template_round_trips_through_toml` — rendered template parses as `Manifest` and every octad field equals `OctadConfig::default()`. - `template_uses_explicit_name_when_provided` — passing `Some("name")` produces `[project].name = "name"`. - `template_falls_back_to_default_name` — passing `None` uses the default project name. `cargo clippy --all-targets -- -D warnings` clean; 32 unit tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Per V-L2-O1: stop the init template from drifting from
Default::default(), and add ergonomic flags.init_manifestnow callsrender_manifest_template(database, name)which pulls every field value fromProjectConfig::default()/OctadConfig::default()/SidecarConfig::default(). If defaults change in code, the emitted TOML follows.--forceflag to overwrite an existingverisimiser.toml(default behaviour still refuses).--name <NAME>flag to set[project].namedirectly.Closes
Test plan
cargo clippy --all-targets -- -D warningscleanmanifest::init_template_tests)template_round_trips_through_tomlproves rendered TOML parses back and every octad field equalsDefault::default()