Skip to content

Add --kind flag to diff for filtering by manifest/lockfile - #301

Merged
andrew merged 2 commits into
mainfrom
diff-kind-filter
Jul 31, 2026
Merged

andrew merged 2 commits into
mainfrom
diff-kind-filter

Conversation

@andrew

@andrew andrew commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Adds --kind manifest|lockfile to git-pkgs diff, matching the existing --ecosystem and --type filters. Each diff entry now also carries manifest_kind in the JSON output so callers can filter client-side without the flag.

The dependency rows already carry ManifestKind from both the database path and the working-tree analyzer, so this just threads it through to DiffEntry and adds the filter check.

Closes #298.

Adds a --kind filter to git-pkgs diff that restricts output to entries
from either manifest files or lockfiles, and exposes manifest_kind on
each entry in the JSON output.

Closes #298

Copilot AI left a comment

Copy link
Copy Markdown

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 a --kind manifest|lockfile filter to git-pkgs diff and threads manifest kind information through diff computation so it’s also available in JSON output (manifest_kind). This addresses the request to limit diffs to lockfiles (Issue #298), enabling workflows that only care about installed dependency changes.

Changes:

  • Add --kind CLI flag to filter diff entries by manifest kind (manifest vs lockfile).
  • Include manifest_kind on each DiffEntry in JSON output.
  • Add unit test coverage for filtering diff results by kind and introduce a manifest manifest-kind constant.

Reviewed changes

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

File Description
cmd/diff.go Adds --kind flag handling, threads ManifestKind into DiffEntry, and extends filtering logic.
cmd/diff_test.go Adds a test verifying kind-based filtering behavior.
cmd/constants.go Defines manifestKindManifest alongside manifestKindLockfile.

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

Comment thread cmd/diff.go Resolved
Comment thread cmd/diff.go Resolved
Applying the kind filter to the input dependency lists rather than the
computed result means --by ecosystem never merges manifest and lockfile
rows into one bucket, so the reported manifest_kind is always correct
and a lockfile-only bump can't be masked by a sibling manifest row.

Also lowercases the flag value so --kind Lockfile matches.
@andrew
andrew merged commit 277fe1e into main Jul 31, 2026
7 checks passed
@andrew
andrew deleted the diff-kind-filter branch July 31, 2026 15: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.

Could diff mode have an option to only diff lock files?

2 participants