Skip to content

feat: add modified-only mode to update only changed files#118

Merged
kubrickcode merged 1 commit intomainfrom
develop/shlee/117
Nov 29, 2025
Merged

feat: add modified-only mode to update only changed files#118
kubrickcode merged 1 commit intomainfrom
develop/shlee/117

Conversation

@kubrickcode
Copy link
Copy Markdown
Owner

When syncing from template repositories, users need to pull only bug fixes or config updates while ignoring newly added files

Implemented selective file updates using SHA-256 hash comparison to detect actual content changes, ignoring new files and updating only existing files that have been modified

  • Add modified-only mode to ConflictMode
  • Implement stream-based SHA-256 hash comparison in file-compare utility
  • Add --modified-only (-m) CLI flag
  • Use two-temp-dir strategy to copy only changed files

fix #117

@github-actions github-actions Bot added the feature New feature label Nov 29, 2025
@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @kubrickcode, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the baedal pull command by introducing a "modified-only" conflict resolution mode. This new functionality enables users to selectively update files from a source repository, ensuring that only files present in both the source and destination, and whose content has actually changed, are updated. This is particularly beneficial for scenarios like syncing bug fixes or configuration updates from template repositories without inadvertently adding new, unwanted files.

Highlights

  • New Conflict Mode: Introduced a new modified-only conflict resolution mode for baedal pull operations, allowing users to update only existing files that have been modified.
  • SHA-256 Hash Comparison: Implemented a stream-based SHA-256 hash comparison utility (file-compare.ts) to efficiently detect content changes between files, forming the core logic for the new mode.
  • CLI Flag: Added a --modified-only (-m) CLI flag to enable this new conflict resolution mode.
  • Two-Temp-Dir Strategy: Refactored the file handling logic to use a two-temporary-directory strategy for processing and copying only the truly changed files, improving efficiency and safety.
  • Documentation and Validation Updates: Updated documentation (CLAUDE.md, README.md) and CLI option validation to reflect the new conflict mode and its usage.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

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 introduces a valuable modified-only mode, allowing users to update only files that have changed, which is a great feature for syncing templates. The implementation is well-done, particularly the use of stream-based SHA-256 hashing for efficient file comparison. My review includes a few suggestions to better align the new code with the repository's style guide, focusing on function ordering, immutability, and alphabetical sorting. Overall, this is a solid contribution.

Comment thread src/internal/utils/file-compare.ts
Comment thread src/pkg/pull/index.ts Outdated
Comment thread src/pkg/pull/types.ts Outdated
@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

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 introduces a modified-only mode, which is a great feature for syncing templates. The implementation uses SHA-256 hash comparison to detect file changes, which is robust. The new logic is well-tested and handles temporary file extraction and cleanup correctly. My review includes a few minor suggestions to improve code quality by adhering to the project's style guide, such as replacing magic strings with constants and using more descriptive variable names.

Comment thread src/internal/utils/file-compare.ts
Comment thread src/pkg/pull/index.ts Outdated
Comment thread src/pkg/pull/index.ts Outdated
@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

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 introduces a modified-only mode to selectively update files based on content changes, which is a great feature for syncing templates. The implementation is solid, using SHA-256 hash comparison for detecting modifications and a temporary directory strategy to handle file operations. The changes are well-tested and documented across the CLI, library API, and README files. I have a couple of suggestions for improvement. One is a minor code quality refinement in the new file hashing utility to avoid an async promise constructor anti-pattern. The other is a potential performance optimization in the handleModifiedOnlyMode function to reduce unnecessary file extraction. Overall, this is a well-executed feature addition.

Comment thread src/internal/utils/file-compare.ts
Comment thread src/pkg/pull/index.ts
@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

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 introduces a modified-only mode, a valuable feature for syncing templates. The implementation is well-structured, notably with the new file-compare utility for hash-based comparisons. My review includes suggestions to leverage modern Node.js stream APIs and project-specific utility libraries like es-toolkit to enhance code clarity and efficiency. I've also pointed out a few minor areas where we can improve adherence to the project's style guide regarding alphabetical ordering.

Comment thread src/cli/types.ts
Comment thread src/cli/types.ts Outdated
Comment thread src/internal/utils/file-compare.ts
Comment thread src/pkg/pull/index.ts Outdated
Comment thread src/pkg/pull/types.ts Outdated
@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

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 introduces a modified-only mode, which is a great feature for syncing templates. The implementation is solid, using SHA-256 hash comparison for detecting file changes. The new code is well-tested and integrated into the CLI and library API. My review includes a few suggestions to improve code consistency by adhering to the project's alphabetical ordering convention, a minor refactoring to follow the style guide for constants, and a performance optimization for the new mode to avoid unnecessary file operations. Overall, great work on this feature.

Comment thread src/cli.ts
Comment thread src/cli/adapter.ts
Comment thread src/pkg/pull/index.ts
Comment thread src/pkg/pull/index.ts Outdated
@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

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 introduces a valuable modified-only mode for selective file updates based on SHA-256 hash comparison. The implementation is well-structured, with the core logic neatly encapsulated in a new file-compare utility and comprehensive test coverage. I've identified a potential bug in the main pull logic that could cause new files to be added incorrectly in modified-only mode. Additionally, there are a few minor inconsistencies with the repository's style guide regarding alphabetical ordering and function placement. My review includes suggestions to address these points.

Comment thread src/pkg/pull/index.ts Outdated
Comment thread CLAUDE.md Outdated
Comment thread src/cli/types.ts Outdated
Comment thread src/internal/utils/file-compare.ts Outdated
@kubrickcode
Copy link
Copy Markdown
Owner Author

/gemini review

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 introduces a modified-only mode, which is a great feature for syncing updates from template repositories. The implementation is solid, using SHA-256 hash comparison to detect file changes efficiently. The new file-compare utility is well-designed and stream-based, making it memory-efficient for large files. The associated tests are comprehensive, covering various edge cases. The code adheres well to the project's conventions and style guide. I have one minor suggestion regarding documentation consistency in README.md to align it with the alphabetical ordering used elsewhere in the codebase. Overall, this is an excellent contribution.

Comment thread README.md Outdated
When syncing from template repositories, users need to pull only bug fixes or config updates while ignoring newly added files

Implemented selective file updates using SHA-256 hash comparison to detect actual content changes, ignoring new files and updating only existing files that have been modified

- Add modified-only mode to ConflictMode
- Implement stream-based SHA-256 hash comparison in file-compare utility
- Add --modified-only (-m) CLI flag
- Use two-temp-dir strategy to copy only changed files

fix #117
@kubrickcode kubrickcode merged commit e1f201d into main Nov 29, 2025
4 checks passed
@kubrickcode kubrickcode deleted the develop/shlee/117 branch November 29, 2025 09:12
@kubrickcode
Copy link
Copy Markdown
Owner Author

🎉 This PR is included in version 1.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add feature: modified-only mode to update only changed files

1 participant