Skip to content

feat: Add --compare-to option to override commit hash for incremental updates#67

Open
p0thi wants to merge 1 commit into
FSoft-AI4Code:mainfrom
p0thi:feature/compare-to-override
Open

feat: Add --compare-to option to override commit hash for incremental updates#67
p0thi wants to merge 1 commit into
FSoft-AI4Code:mainfrom
p0thi:feature/compare-to-override

Conversation

@p0thi

@p0thi p0thi commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

TL;DR

This PR adds a new --compare-to <commit-hash> CLI option to the generate command, allowing developers to explicitly specify the base commit to compare against when running incremental updates.

Description

Previously, incremental updates relied solely on the commit_id stored in metadata.json from the last generation run. This works well for local, continuous workflows but breaks down in CI/CD pipelines or after squashed PR merges, where the stored commit hash may no longer represent the correct baseline for detecting changes.

This pull request introduces a --compare-to flag that overrides the stored commit hash and uses a user-supplied commit as the diff baseline. When provided, the flag implicitly enables --update mode, so users do not need to pass both flags.

Key Changes:

  • CLI Option (generate.py):

    • Added a new --compare-to <commit-hash> option to the generate command.
    • When set, it implicitly enables --update, simplifying the command invocation for CI/CD usage.
  • Change Detection (generate.py):

    • Updated _detect_changed_files to accept an optional compare_to argument.
    • When compare_to is provided, it is used directly as prev_commit, bypassing the read of metadata.json and its stored commit_id.
    • Preserved the existing fallback behavior (reading from metadata.json) when --compare-to is not supplied.
  • Documentation (README.md):

    • Added a usage example demonstrating codewiki generate --compare-to <commit-hash>, including a note that it is useful in CI/CD or squashed PR scenarios.

@p0thi p0thi marked this pull request as ready for review June 22, 2026 14:40
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