Conversation
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
There was a problem hiding this comment.
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 diffcommand with support for separate passphrases and key files for each archive. - Adds database diffing + diff formatting utilities in
pkg/kdbxwith 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
This change introduces a
diffcommand 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