fix: prefill tari init prompts with existing Cargo.toml metadata#127
Merged
Conversation
ffc1ffc to
ffe6a21
Compare
The init prompts previously ignored any metadata already present in Cargo.toml, so re-running `tari init` forced the user to retype every field. Read the existing `[package].description` and `[package.metadata.tari-template]` values and use them as prompt defaults (and as fallbacks in non-interactive mode), so pressing enter preserves the current value. Bump workspace version to 0.16.1. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
ffe6a21 to
7cc0899
Compare
There was a problem hiding this comment.
Code Review
This pull request bumps the project version to 0.16.1 and enhances the init-metadata command to read and preserve existing metadata from Cargo.toml. The resolve_metadata function was refactored to use these existing values as defaults in both interactive and non-interactive modes, and new unit tests were added to verify this behavior. Review feedback suggests normalizing tags in non-interactive mode to ensure consistency and optimizing performance by reducing redundant parsing of the Cargo.toml file.
Match the interactive path by trimming whitespace and dropping empty entries from `--tags` before writing them to Cargo.toml, so input like `--tags "a, ,b"` cannot produce whitespace-only tags. 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
tari initre-prompted for every metadata field even when the values already existed inCargo.toml, forcing the user to retype them.[package].descriptionand[package.metadata.tari-template]on entry and use the existing values as prompt defaults (and as non-interactive fallbacks), so pressing enter preserves what is already there.0.16.1.Test plan
cargo test -p tari-ootle-cli cli::commands::template::init_metadata(new tests cover reading existing metadata and non-interactive fallback; all 7 pass)tari initin a crate that already has template metadata and confirm prompts are prefilled🤖 Generated with Claude Code