Skip to content

Add prek util yaml-to-toml to convert .pre-commit-config.yaml to prek.toml#1584

Merged
j178 merged 5 commits intomasterfrom
yaml-to-toml
Feb 6, 2026
Merged

Add prek util yaml-to-toml to convert .pre-commit-config.yaml to prek.toml#1584
j178 merged 5 commits intomasterfrom
yaml-to-toml

Conversation

@j178
Copy link
Owner

@j178 j178 commented Feb 6, 2026

No description provided.

Copilot AI review requested due to automatic review settings February 6, 2026 07:47
@j178 j178 added the enhancement New feature or request label Feb 6, 2026
@j178 j178 mentioned this pull request Feb 6, 2026
16 tasks
@j178 j178 changed the title yaml to toml Add prek util yaml-to-toml to convert .pre-commit-config.yaml to prek.toml Feb 6, 2026
@codecov
Copy link

codecov bot commented Feb 6, 2026

Codecov Report

❌ Patch coverage is 93.75000% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.65%. Comparing base (2314871) to head (50c941d).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
crates/prek/src/cli/yaml_to_toml.rs 93.61% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1584      +/-   ##
==========================================
+ Coverage   91.58%   91.65%   +0.07%     
==========================================
  Files          92       93       +1     
  Lines       18136    18280     +144     
==========================================
+ Hits        16609    16755     +146     
+ Misses       1527     1525       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@prek-ci-bot
Copy link

prek-ci-bot bot commented Feb 6, 2026

📦 Cargo Bloat Comparison

Binary size change: +0.42% (23.6 MiB → 23.7 MiB)

Expand for cargo-bloat output

Head Branch Results

 File  .text    Size             Crate Name
 0.3%   0.8% 81.8KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.7% 71.1KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6% 65.6KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 51.2KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.5% 50.5KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4% 41.4KiB              prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4% 38.4KiB              prek prek::run::{{closure}}
 0.1%   0.3% 31.3KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.3% 28.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.3% 28.3KiB              prek prek::identify::by_extension::{{closure}}
 0.1%   0.2% 24.8KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 22.6KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2% 22.1KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 22.1KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.2KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.0KiB   cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.5KiB              prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 19.5KiB              prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.3KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2% 19.2KiB              prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
38.4%  91.6%  9.1MiB                   And 20905 smaller methods. Use -n N to show more.
41.9% 100.0%  9.9MiB                   .text section size, the file size is 23.7MiB

Base Branch Results

 File  .text    Size             Crate Name
 0.3%   0.7% 73.5KiB             prek? <prek::cli::Command as clap_builder::derive::Subcommand>::augment_subcommands
 0.3%   0.7% 71.3KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.3%   0.6% 65.6KiB              prek prek::languages::<impl prek::config::Language>::run::{{closure}}::{{closure}}
 0.2%   0.5% 51.2KiB annotate_snippets annotate_snippets::renderer::render::render
 0.2%   0.5% 50.5KiB              prek prek::languages::<impl prek::config::Language>::install::{{closure}}
 0.2%   0.4% 41.5KiB              prek prek::cli::run::run::run::{{closure}}
 0.2%   0.4% 38.1KiB              prek prek::run::{{closure}}
 0.1%   0.3% 32.0KiB             prek? <prek::cli::RunArgs as clap_builder::derive::Args>::augment_args
 0.1%   0.3% 28.4KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.3% 28.3KiB              prek prek::identify::by_extension::{{closure}}
 0.1%   0.2% 24.9KiB             prek? <prek::config::_::<impl serde_core::de::Deserialize for prek::config::Config>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 22.6KiB      serde_saphyr saphyr_parser_bw::scanner::Scanner<T>::fetch_more_tokens
 0.1%   0.2% 22.2KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 21.2KiB      clap_builder clap_builder::parser::parser::Parser::get_matches_with
 0.1%   0.2% 20.6KiB              prek prek::hooks::meta_hooks::MetaHooks::run::{{closure}}
 0.1%   0.2% 20.0KiB   cargo_metadata? <cargo_metadata::_::<impl serde_core::de::Deserialize for cargo_metadata::Package>::deserialize::__Visitor as serde_core::de::Visitor>::visit_map
 0.1%   0.2% 19.5KiB              prek prek::archive::unzip::{{closure}}
 0.1%   0.2% 19.5KiB              prek prek::cli::run::filter::collect_files_from_args::{{closure}}
 0.1%   0.2% 19.3KiB               std core::ptr::drop_in_place<prek::languages::<impl prek::config::Language>::install::{{closure}}>
 0.1%   0.2% 19.2KiB              prek <prek::languages::ruby::ruby::Ruby as prek::languages::LanguageImpl>::install::{{closure}}
38.3%  91.6%  9.1MiB                   And 20911 smaller methods. Use -n N to show more.
41.9% 100.0%  9.9MiB                   .text section size, the file size is 23.6MiB

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new prek util yaml-to-toml command to convert .pre-commit-config.yaml files to the native prek.toml format. The conversion reads YAML configuration files, validates them, and outputs properly formatted TOML files with support for custom output paths and force-overwrite functionality.

Changes:

  • Added new CLI command prek util yaml-to-toml with input file argument, --output and --force options
  • Implemented YAML-to-TOML conversion logic using serde_saphyr for YAML parsing and toml_edit for TOML generation
  • Added comprehensive integration tests covering basic conversion, overwrite protection, and invalid config handling
  • Updated documentation to reference the new conversion utility

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
crates/prek/src/cli/yaml_to_toml.rs New file implementing the yaml-to-toml conversion command with file I/O, validation, and TOML generation logic
crates/prek/src/cli/mod.rs Added YamlToTomlArgs struct and YamlToToml variant to UtilCommand enum, plus Debug derive on ExitStatus
crates/prek/src/main.rs Integrated the yaml-to-toml command handler into the main command dispatcher
crates/prek/src/config.rs Added accessor methods (patterns, regex_pattern, glob_patterns) to FilePattern types
crates/prek/tests/yaml_to_toml.rs New integration test file with tests for default output, overwrite protection, and invalid config handling
docs/configuration.md Added tip box recommending the new yaml-to-toml command for converting from YAML to TOML format
docs/cli.md Auto-generated documentation for the new yaml-to-toml command with all options and arguments
crates/prek/Cargo.toml Added "display" feature to toml dependency for better error formatting
Cargo.toml Workspace-level addition of "display" feature to toml dependency

@j178 j178 merged commit 3fa9187 into master Feb 6, 2026
49 checks passed
@j178 j178 deleted the yaml-to-toml branch February 6, 2026 08:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants