Skip to content

feat(cli): add diff command to compare two versions - #751

Merged
BryanFRD merged 1 commit into
mainfrom
feat/diff-command
Jul 21, 2026
Merged

feat(cli): add diff command to compare two versions#751
BryanFRD merged 1 commit into
mainfrom
feat/diff-command

Conversation

@BryanFRD

Copy link
Copy Markdown
Contributor

Closes #222

Adds ferrflow diff [package] <from>..<to> — a detailed comparison of what went into a version range.

ferrflow diff v1.4.0..v1.6.0            # single-package repo
ferrflow diff api v1.4.0..v1.6.0        # monorepo: name the package

Output

  • Header<package> <from> → <to> (<overall bump>).
  • Commits — every commit in the range with its individual bump (major/minor/patch/none).
  • Breaking changes — highlighted separately (any ! / BREAKING CHANGE: commit).
  • Files changed — the aggregate file list for the range (capped at 40 with a "… and N more").
  • Changelog — the section FerrFlow would generate for the range, using the repo's changelog config.

--json emits the same data as a structured object.

Endpoint resolution

Each side of the range resolves to a commit by trying, in order: the literal string as a tag (a real tag, or v1.4.0 in a single-package repo), then the package's tag for that version (api@v1.4.0). An unresolvable endpoint errors with the candidates it tried.

Implementation

  • New version_diff module (the existing diff module is the unified-diff util). Reuses conventional_commits (bump/breaking classification) and build_section_with (changelog rendering) — no new logic duplicated.
  • Three small git helpers: get_commits_between / get_changed_files_between (range from..to) and resolve_tag_name_to_commit (peels annotated tags).

Tests

  • Unit tests on spec parsing ([package] <range> in any order, range required) and range splitting (rejects empty sides). 973 in the suite, clippy -D warnings clean, wasm builds (the command is CLI-only).
  • Smoke on this repo: ferrflow diff v5.40.0..v5.43.0 lists 8 commits with bumps, 33 changed files, and the rendered changelog; --json produces the structured form.

Note

For a monorepo the range spans all commits between the two tags (not path-scoped to the named package) — correct for single-package repos and a useful window audit for monorepos. Path-scoping to the package could be a follow-up.

@BryanFRD
BryanFRD enabled auto-merge (squash) July 21, 2026 12:52
@BryanFRD
BryanFRD merged commit 47fb58b into main Jul 21, 2026
39 checks passed
@BryanFRD
BryanFRD deleted the feat/diff-command branch July 21, 2026 12:56
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.

feat(cli): add diff command to compare two versions

1 participant