feat(tui): add Backup command to the command palette#1004
Merged
Conversation
Surface the database backup (added in #999) from the TUI: a "Backup" entry in the command palette downloads a physical .db snapshot to ~/Downloads/taskdog-backup-<timestamp>.db and notifies with the path. Mirrors the Export command's structure — BackupCommand(TUICommandBase), a SimpleSingleCommandProvider, and an app.run_backup() action. Restore is intentionally left to the CLI (`restore-db`): it is destructive and only applies on server restart, which is awkward to drive from a live TUI.
There was a problem hiding this comment.
The backup command implementation is well-structured and follows the existing TUI command patterns. The code includes proper error handling for both server connection failures and generic exceptions, comprehensive test coverage, and correct integration with the command palette. The format_timestamp_for_filename() method provides second-precision timestamps to prevent filename collisions. All changes are consistent with the codebase architecture and ready for merge.
You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Surface the database backup (added in #999) from the TUI. A Backup entry in the command palette downloads a physical
.dbsnapshot to~/Downloads/taskdog-backup-<timestamp>.dband notifies with the full path.Design
Mirrors the existing Export command structure:
tui/commands/backup.py—BackupCommand(TUICommandBase);execute()builds the~/Downloadspath and callsapi_client.backup(path), with the sameServerConnectionError/ generic-error notification handling as Export.tui/palette/providers/backup_provider.py—BackupCommandProvider(SimpleSingleCommandProvider)(single-stage, same mechanism as Audit), callbackrun_backup.app.py— registers the provider and addsrun_backup()→command_factory.execute("backup").DateTimeFormatter.format_timestamp_for_filename()—YYYYMMDD-HHMMSS(second precision so multiple backups/day don't collide), matching the CLI/server backup filename.Scope: backup only. Restore stays in the CLI (
restore-db) — it is destructive and only applies on server restart, which is awkward to drive from a live TUI.Verification
test_backup.py: success path (downloads to~/Downloads,mkdirDownloads, notifies), filename istaskdog-backup-*.db, and both error paths notify.run_backupresolves on the app →command_factory.execute("backup")→BackupCommand.execute→api_client.backup(~/Downloads/...db). (Palette surfacing uses the sameSimpleSingleCommandProvidermechanism as the working Export/Audit entries.)