feat: add diecut distill command#130
Open
raiderrobert wants to merge 9 commits intofeat/extract-auto-detectfrom
Open
feat: add diecut distill command#130raiderrobert wants to merge 9 commits intofeat/extract-auto-detectfrom
raiderrobert wants to merge 9 commits intofeat/extract-auto-detectfrom
Conversation
Three minimal Rust CLI projects that share structure but vary in project_name and author, with deliberate intersection/exclusion properties (.gitignore and assets/ only in A+B, LICENSE only in C) for testing diecut distill.
Add six new variants for the upcoming diecut distill command: DistillMinProjects, DistillNoCommonFiles, DistillInvalidVarName, DistillSlashInValue, DistillEmptyValue, and DistillOutputExists.
Adds an optional max_depth: Option<usize> parameter that limits how deep the file walker descends into subdirectories. None preserves existing unlimited-depth behavior. Updates all call sites to pass None.
…ctive Implements DistillVariable struct and the is_variable_active function that determines whether a variable genuinely varies across projects by checking if any variant literal appears in project[0] and if at least one other project has different content for that file. Binary files are skipped. Includes 7 unit tests covering all specified cases.
…cans Adds the distill module with intersect_scans, which computes the common-file intersection across multiple ScanResults and returns AlignedFile structs with per-project content aligned by scan index.
Implements the full plan_distill + execute_distill pipeline: phases 0-7 covering input validation, variable expansion, project scanning, file intersection, cross-validation, file processing, config generation, and output writing. Adds four integration tests covering the two-project happy path, static variable suppression, three-project intersection, and single-project error handling.
Wire up the `distill` subcommand with `Distill` variant in the Commands enum, a new `src/commands/distill.rs` handler, and dispatch in main.rs.
Proves the full cycle: distill a template from two projects, then generate a new project from that template, and verify substitutions are correctly applied in the output.
- Warn when a variable value is shorter than 3 characters (false match risk)
- Warn when two variables share the same value
- Warn when a processed file contains more {{ }} expressions than
our replacements introduced (likely needs {{% raw %}} blocks)
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
diecut distillcommand that creates templates by comparing 2+ existing projectsdiecut newUsage
Produces a template where:
--varvalues appear becomes parameterizedFlags:
--depth N(default 1),--dry-run,--force,--output DIRHow it works
diecut.tomlwith prompted + computed variablesTest plan
diecut new→ verify substitutions--dry-runcargo fmt --check && cargo clippy -- -D warnings && cargo testall pass (277 tests)