Skip to content

feat: diff to compare archives#50

Merged
shikaan merged 14 commits intomainfrom
feat/diffs
Mar 21, 2026
Merged

feat: diff to compare archives#50
shikaan merged 14 commits intomainfrom
feat/diffs

Conversation

@shikaan
Copy link
Copy Markdown
Owner

@shikaan shikaan commented Mar 21, 2026

This change introduces a diff command to compare two archives. The comparison does not introspect the entries and it's purely based on timestamps.

The output format is based on POSIX unified diffs, so that it can be piped into other tools for interoperability.

Closes #35

shikaan added 5 commits March 20, 2026 08:39
Improves interop with other CLI tooling, not polluting the stdout with the
prompt
This functionality allows diffing kdbx archiving identifying which entries
differ. It's read only and does not try to open entries
This also moves the path formatters in the same module
Copy link
Copy Markdown

Copilot AI left a comment

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 new diff CLI command to compare two KeePass (.kdbx) archives and output changes in a unified-diff-like format, based on entry modification timestamps.

Changes:

  • Introduces keydex diff command with support for separate passphrases and key files for each archive.
  • Adds database diffing + diff formatting utilities in pkg/kdbx with accompanying unit tests.
  • Updates CLI secret prompt behavior to write prompts/newlines to stderr, plus tests and integration coverage.

Reviewed changes

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

Show a summary per file
File Description
cmd/diff.go Adds the new diff cobra command wiring and execution logic.
cmd/root.go Registers the new Diff command and adds --key-a/--key-b flags.
cmd/utils.go Adds KEYDEX_PASSPHRASE_A/B env var constants for diff.
pkg/kdbx/diff.go Implements database diffing by UUID + last modification time, sorted by path.
pkg/kdbx/diff_test.go Unit tests for DiffDatabases behavior and sorting.
pkg/kdbx/format.go Adds helpers for path formatting and unified-diff-like rendering (FormatDiff).
pkg/kdbx/format_test.go Unit tests for FormatDiff output structure and semantics.
pkg/kdbx/kdbx.go Refactors entry/group path building to reuse the new formatting helpers.
pkg/cli/cli.go Sends password prompt and trailing newline to stderr instead of stdout.
pkg/cli/cli_test.go Adds a test asserting ReadSecret prompt goes to stderr.
test/cli_test.go Adds integration tests for keydex diff and creates a second fixture database.

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

@shikaan shikaan requested a review from Copilot March 21, 2026 10:10
@shikaan shikaan marked this pull request as ready for review March 21, 2026 10:12
Copy link
Copy Markdown

Copilot AI left a comment

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 14 out of 14 changed files in this pull request and generated 3 comments.


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

Copy link
Copy Markdown

Copilot AI left a comment

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 15 out of 15 changed files in this pull request and generated 1 comment.


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

@shikaan shikaan merged commit 9ebce4b into main Mar 21, 2026
1 check passed
@shikaan shikaan deleted the feat/diffs branch March 21, 2026 14:15
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.

Diff archives

2 participants