Skip to content

fix: prefill tari init prompts with existing Cargo.toml metadata#127

Merged
sdbondi merged 3 commits into
mainfrom
fix/init-prefill-existing-metadata
Apr 23, 2026
Merged

fix: prefill tari init prompts with existing Cargo.toml metadata#127
sdbondi merged 3 commits into
mainfrom
fix/init-prefill-existing-metadata

Conversation

@sdbondi
Copy link
Copy Markdown
Member

@sdbondi sdbondi commented Apr 23, 2026

Summary

  • tari init re-prompted for every metadata field even when the values already existed in Cargo.toml, forcing the user to retype them.
  • Read [package].description and [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.
  • Bump workspace version to 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)
  • Manually run tari init in a crate that already has template metadata and confirm prompts are prefilled

🤖 Generated with Claude Code

@sdbondi sdbondi force-pushed the fix/init-prefill-existing-metadata branch 2 times, most recently from ffc1ffc to ffe6a21 Compare April 23, 2026 09:53
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>
@sdbondi sdbondi force-pushed the fix/init-prefill-existing-metadata branch from ffe6a21 to 7cc0899 Compare April 23, 2026 09:55
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread crates/cli/src/cli/commands/template/init_metadata.rs
Comment thread crates/cli/src/cli/commands/template/init_metadata.rs
sdbondi and others added 2 commits April 23, 2026 15:32
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>
@sdbondi sdbondi merged commit 9e37700 into main Apr 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant