Skip to content

feat(tui): add Backup command to the command palette#1004

Merged
Kohei-Wada merged 1 commit into
mainfrom
feat/tui-backup
Jun 6, 2026
Merged

feat(tui): add Backup command to the command palette#1004
Kohei-Wada merged 1 commit into
mainfrom
feat/tui-backup

Conversation

@Kohei-Wada
Copy link
Copy Markdown
Owner

Summary

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 full path.

Design

Mirrors the existing Export command structure:

  • tui/commands/backup.pyBackupCommand(TUICommandBase); execute() builds the ~/Downloads path and calls api_client.backup(path), with the same ServerConnectionError / generic-error notification handling as Export.
  • tui/palette/providers/backup_provider.pyBackupCommandProvider(SimpleSingleCommandProvider) (single-stage, same mechanism as Audit), callback run_backup.
  • app.py — registers the provider and adds run_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

  • New test_backup.py: success path (downloads to ~/Downloads, mkdir Downloads, notifies), filename is taskdog-backup-*.db, and both error paths notify.
  • Wiring integration check: provider callback run_backup resolves on the app → command_factory.execute("backup")BackupCommand.executeapi_client.backup(~/Downloads/...db). (Palette surfacing uses the same SimpleSingleCommandProvider mechanism as the working Export/Audit entries.)
  • Full UI suite 1053 passed; ruff + mypy clean; pre-push (make test, vulture) green.

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.
Copy link
Copy Markdown

@amazon-q-developer amazon-q-developer Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Kohei-Wada Kohei-Wada merged commit 7d795cd into main Jun 6, 2026
15 checks passed
@Kohei-Wada Kohei-Wada deleted the feat/tui-backup branch June 6, 2026 03:14
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.

1 participant