Skip to content

Add support for bump command.#7

Merged
MatthewMckee4 merged 14 commits into
mainfrom
bump
Dec 7, 2025
Merged

Add support for bump command.#7
MatthewMckee4 merged 14 commits into
mainfrom
bump

Conversation

@MatthewMckee4

@MatthewMckee4 MatthewMckee4 commented Dec 7, 2025

Copy link
Copy Markdown
Owner

Summary

Supports seal bump <version> (--dry-run) command.

Several other features here too.

Added configuration support for pushing, creating pr and confirming.

Test Plan

Added comprehensive cli tests.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 comprehensive version bumping functionality to Seal, enabling automated version management across multiple files with flexible configuration options. The feature supports semantic versioning bumps (major/minor/patch), prerelease versions (alpha/beta/rc), custom search patterns, and version templates for formatting versions differently across files.

Key Changes:

  • New seal_bump crate implementing version calculation logic with prerelease support
  • Version file management with auto-detection for common formats (TOML, JSON, Python) and custom search patterns
  • CLI bump command with dry-run support and configurable confirmation, push, and PR creation options

Reviewed changes

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

Show a summary per file
File Description
docs/version-files.md New comprehensive documentation for version file customization features
docs/configuration.md Configuration reference with version file, template, and bump command documentation
README.md Updated with features overview and basic configuration example
crates/seal_bump/src/lib.rs Core version bump logic with semantic versioning and prerelease support
crates/seal_bump/Cargo.toml New crate definition with semver and thiserror dependencies
crates/seal_project/src/config.rs Added VersionFile enum supporting simple paths and detailed configurations with templates
crates/seal_project/src/lib.rs Exported VersionFile type for public API
crates/seal/src/commands/bump.rs Bump command implementation with file updates, git operations, and PR creation
crates/seal/src/cli.rs Added BumpArgs with version and dry-run arguments
crates/seal/tests/it/bump/*.rs Comprehensive test coverage for version calculations, custom formats, and confirmation flows
Cargo.toml Added seal_bump and semver workspace dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/seal/src/commands/bump.rs Outdated
Comment thread crates/seal/src/commands/bump.rs
Comment thread docs/version-files.md Outdated
@MatthewMckee4 MatthewMckee4 requested a review from Copilot December 7, 2025 15:11
@MatthewMckee4 MatthewMckee4 changed the title Add support for bumping files. Add support for bumping files Dec 7, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 9 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread docs/configuration.md
Comment thread crates/seal/src/commands/bump.rs
Comment thread crates/seal/src/commands/bump.rs
Comment thread crates/seal/src/commands/bump.rs Outdated
Comment thread crates/seal/src/commands/bump.rs Outdated
Comment thread crates/seal/src/commands/bump.rs
Comment thread crates/seal/src/commands/bump.rs
Comment thread crates/seal/src/commands/bump.rs Outdated
Comment thread crates/seal/src/commands/bump.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 24 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread crates/seal/src/commands/bump.rs Outdated
Comment on lines +352 to +363
let extra = if parsed_version.pre.is_empty() {
String::new()
} else {
parsed_version.pre.to_string()
};

let result = template
.replace("{major}", &parsed_version.major.to_string())
.replace("{minor}", &parsed_version.minor.to_string())
.replace("{patch}", &parsed_version.patch.to_string())
.replace("{extra}", &extra);

Copilot AI Dec 7, 2025

Copy link

Choose a reason for hiding this comment

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

The {extra} placeholder in version templates doesn't include the hyphen separator for prerelease versions, causing malformed output. When using version-template = "{major}.{minor}.{patch}{extra}", a prerelease version like 2.0.0-beta.2 becomes 2.0.0beta.2 (missing the hyphen).

The expected output for the test at line 230 is version=2.0.0beta.2, which indicates this is the current behavior, but this appears to be incorrect. The template should either:

  1. Include the hyphen in {extra} (e.g., {extra} = -beta.2), or
  2. Document that users must include the hyphen in their template (e.g., {major}.{minor}.{patch}-{extra})

Looking at the test at line 483 (version-template = "{major}.{minor}.{patch}-{extra}"), it appears option 2 is the intended design, but the test at line 205 suggests users expect option 1 to work.

Copilot uses AI. Check for mistakes.
Comment thread crates/seal/src/commands/bump.rs Outdated
Comment on lines +324 to +337
let patterns = [
(
regex::Regex::new(r#"version\s*=\s*"[^"]+""#)?,
format!(r#"version = "{version_str}""#),
),
(
regex::Regex::new(r#""version"\s*:\s*"[^"]+""#)?,
format!(r#""version": "{version_str}""#),
),
(
regex::Regex::new(r#"__version__\s*=\s*"[^"]+""#)?,
format!(r#"__version__ = "{version_str}""#),
),
];

Copilot AI Dec 7, 2025

Copy link

Choose a reason for hiding this comment

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

The regex patterns for auto-detecting version fields are created inside a loop on every call to update_version_in_content, which is inefficient. These regexes should be compiled once (e.g., using lazy_static or once_cell::sync::Lazy) and reused, especially since this function is called for each version file being updated.

This is a performance issue that could become noticeable when bumping versions across many files.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Comment thread crates/seal/src/commands/bump.rs Outdated
Comment on lines +238 to +249
let old_lines: Vec<&str> = old_content.lines().collect();
let new_lines: Vec<&str> = new_content.lines().collect();

for (i, (old_line, new_line)) in old_lines.iter().zip(new_lines.iter()).enumerate() {
if old_line != new_line {
writeln!(stdout, "@@ -{},{} +{},{} @@", i + 1, 1, i + 1, 1)?;
writeln!(stdout, "-{old_line}")?;
writeln!(stdout, "+{new_line}")?;
}
}

Ok(())

Copilot AI Dec 7, 2025

Copy link

Choose a reason for hiding this comment

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

The diff display logic in display_diff only shows changes when lines differ at the same position (using zip). If the old and new content have different numbers of lines, the function won't show all changes.

For example:

  • If a line is added or removed, those changes won't be displayed
  • If content has different line counts, only the minimum number of lines will be compared

This could lead to incomplete diff previews. Consider using a proper diff algorithm or handling cases where line counts differ.

Copilot uses AI. Check for mistakes.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

Comment thread crates/seal_bump/src/lib.rs Outdated

Copilot AI commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

@MatthewMckee4 I've opened a new pull request, #8, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI commented Dec 7, 2025

Copy link
Copy Markdown
Contributor

@MatthewMckee4 I've opened a new pull request, #9, to work on those changes. Once the pull request is ready, I'll request review from you.

@MatthewMckee4 MatthewMckee4 changed the title Add support for bumping files Add support for bump command. Dec 7, 2025
@MatthewMckee4 MatthewMckee4 merged commit 74291dd into main Dec 7, 2025
5 checks passed
@MatthewMckee4 MatthewMckee4 deleted the bump branch December 7, 2025 16:42
MatthewMckee4 added a commit that referenced this pull request Dec 7, 2025
Supports `seal bump <version> (--dry-run)` command.

Several other features here too.

Added configuration support for pushing, creating pr and confirming.

Added comprehensive cli tests.
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.

3 participants