feat: Add CLI scripts for PowerMem#214
Merged
Merged
Conversation
Member
|
Got it. Reviewing now. |
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.
This PR implements a Command-Line Interface (CLI) tool for PowerMem, enabling developers and system administrators to interact with PowerMem directly from the command line without writing Python scripts.
close #136
Solution Description
Features Implemented
1. Memory Operations (
pmem add/search/get/update/delete/list/delete-all)2. Configuration Management (
pmem config show/validate/test)3. Statistics (
pmem stats)--detailedflag4. Management Commands (
pmem manage backup/restore/cleanup/migrate)5. Interactive Mode (
pmem interactiveorpmem shell)Technical Implementation
click(existing dependency)--json), Table (default), Plain text.envandauto_config()system--install-completion)pmemandpowermem-clicommandsFile Structure
src/powermem/cli/
├── init.py # CLI package entry
├── main.py # Main command group + completion
├── commands/
│ ├── memory.py # Memory operations
│ ├── config.py # Configuration commands
│ ├── stats.py # Statistics command
│ ├── manage.py # Management commands
│ └── interactive.py # Interactive mode
└── utils/
└── output.py # Output formatting utilities
Usage Examples
Memory operations
pmem add "User prefers dark mode" --user-id user123
pmem search "user preferences" --user-id user123 --json
pmem list --user-id user123 --limit 50
Configuration
pmem config show
pmem config validate --strict
pmem config test --verbose
Statistics
pmem stats --user-id user123
Management
pmem manage backup --output backup.json
pmem manage restore --input backup.json --dry-run
pmem manage cleanup --threshold 0.1 --dry-run
Interactive mode
pmem interactive
Shell completion
pmem --install-completion bash