fix: resolve CI linting issues - remove unused imports and f-strings
Some checks failed
CI / lint (push) Has been cancelled
CI / build (push) Has been cancelled
CI / test (push) Has been cancelled

This commit is contained in:
2026-01-31 09:32:58 +00:00
parent a8f28e0459
commit 0deed28c5d

332
app/README.md Normal file
View File

@@ -0,0 +1,332 @@
# CLI Command Memory
A CLI tool that records developer terminal workflows with project context, enables smart autocomplete based on history, detects automation patterns, and generates reusable scripts from recurring command sequences.
## Features
- **Command Recording**: Record terminal workflows with automatic project context detection
- **Smart Autocomplete**: Get intelligent command suggestions based on history and patterns
- **Pattern Detection**: Automatically detect recurring command sequences
- **Script Generation**: Convert workflows into reusable bash scripts
- **Workflow Playback**: Replay recorded workflows with configurable speed
- **Searchable History**: Search commands by project, technology, or time range
- **Shell Integration**: Auto-capture commands in your shell sessions
- **Export/Import**: Share workflows with JSON/YAML export
## Installation
```bash
# Clone the repository
git clone <repository-url>
cd cli-command-memory
# Install dependencies
pip install -r requirements.txt
# Install in development mode
pip install -e .
```
## Quick Start
```bash
# Initialize CLI Command Memory
cli-memory init
# Start recording a command session
cli-memory record start
# Search for previous commands
cli-memory search commands "git status"
# Get suggestions for next command
cli-memory suggest next "git "
# Generate a script from a workflow
cli-memory workflow generate 1 --name my-script
```
## Usage
### Recording Commands
```bash
# Start interactive recording session
cli-memory record start
# Record a single command
cli-memory record single "git status"
# View recent recorded commands
cli-memory record recent --limit 20
```
### Searching History
```bash
# Search commands by query
cli-memory search commands "git commit"
# Search by project
cli-memory search commands --project my-project
# Search by command type
cli-memory search commands --type git
# Fuzzy search
cli-memory search commands "stts" --fuzzy
# Search by technology stack
cli-memory search tech python
# Show recent commands
cli-memory search recent --hours 24
# View command statistics
cli-memory search stats
```
### Smart Suggestions
```bash
# Get suggestions for next command
cli-memory suggest next "git "
# Get autocomplete candidates
cli-memory suggest autocomplete "git ch"
# Train suggestion engine
cli-memory suggest train
# View detected patterns
cli-memory suggest patterns
```
### Workflow Management
```bash
# List workflows
cli-memory workflow list
# Show workflow details
cli-memory workflow show 1
# Playback a workflow
cli-memory workflow play 1 --speed 2.0
# Preview workflow commands
cli-memory workflow preview 1
# Generate script from workflow
cli-memory workflow generate 1 --name my-script
```
### Export and Import
```bash
# Export commands to JSON
cli-memory export commands -o commands.json
# Export workflows
cli-memory export workflows -o workflows.yaml
# Export all data
cli-memory export all -o backup.json
# List generated scripts
cli-memory export scripts
```
## Configuration
Configuration is managed through `config.yaml` and environment variables.
### Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| `CLI_MEMORY_HOME` | `~/.cli_memory` | Base directory for storing data |
| `LOG_LEVEL` | `info` | Logging level: debug, info, warning, error |
| `MAX_WORKFLOW_COMMANDS` | `100` | Max commands to store per workflow |
| `MAX_SUGGESTIONS` | `10` | Number of suggestions to return |
| `ENABLE_AUTOCOMPLETE` | `true` | Enable autocomplete integration |
### Configuration File
Create a `config.yaml` file in your project directory or `~/.cli_memory/`:
```yaml
database:
path: "~/.cli_memory/database.db"
wal_mode: true
recording:
max_commands_per_workflow: 100
min_commands_for_workflow: 3
suggestions:
max_suggestions: 10
min_confidence: 0.3
```
## Shell Integration
For automatic command recording, set up shell integration:
```bash
# Set up bash integration
cli-memory shell setup
# Restart your shell or source your profile
source ~/.bashrc
```
## Commands Reference
### Main Commands
| Command | Description |
|---------|-------------|
| `cli-memory init` | Initialize CLI Command Memory |
| `cli-memory status` | Show current status and statistics |
| `cli-memory detect` | Detect project context |
### Record Group
| Command | Description |
|---------|-------------|
| `record start` | Start interactive recording session |
| `record single` | Record a single command |
| `record recent` | Show recent recorded commands |
### Search Group
| Command | Description |
|---------|-------------|
| `search commands` | Search recorded commands |
| `search workflows` | Search workflows |
| `search tech` | Search by technology stack |
| `search recent` | Show recent commands |
| `search stats` | Show command statistics |
### Suggest Group
| Command | Description |
|---------|-------------|
| `suggest next` | Get command suggestions |
| `suggest autocomplete` | Get autocomplete candidates |
| `suggest train` | Train suggestion engine |
| `suggest patterns` | Show detected patterns |
### Workflow Group
| Command | Description |
|---------|-------------|
| `workflow list` | List all workflows |
| `workflow show` | Show workflow details |
| `workflow play` | Playback a workflow |
| `workflow preview` | Preview workflow commands |
| `workflow generate` | Generate script from workflow |
### Export Group
| Command | Description |
|---------|-------------|
| `export commands` | Export commands to file |
| `export workflows` | Export workflows to file |
| `export all` | Export all data |
| `export scripts` | List generated scripts |
## Examples
### Recording a Git Workflow
```bash
# Start recording
cli-memory record start --project my-repo --tag git
# Execute commands
git checkout -b feature/new-feature
git add .
git commit -m "Add new feature"
git push origin feature/new-feature
# Exit recording (type 'exit')
exit
# Save as workflow when prompted
```
### Creating a Deployment Script
```bash
# Search for deployment commands
cli-memory search commands "docker build"
# Generate script from workflow
cli-memory workflow generate 5 --name deploy-prod --output deploy.sh
```
### Finding Common Patterns
```bash
# Train suggestion engine
cli-memory suggest train
# View detected patterns
cli-memory suggest patterns
# Generate automation script
cli-memory workflow generate 3 --name automation-script
```
## Architecture
```
cli_command_memory/
├── cli_memory/
│ ├── __init__.py # Package initialization
│ ├── cli.py # Main Click CLI interface
│ ├── config.py # Configuration management
│ ├── database.py # SQLite database layer
│ ├── models.py # Data models
│ ├── recorder.py # Command recording
│ ├── project.py # Project detection
│ ├── context.py # Context extraction
│ ├── search.py # Search engine
│ ├── history.py # History management
│ ├── suggestions.py # Suggestion engine
│ ├── patterns.py # Pattern detection
│ ├── generator.py # Script generation
│ ├── playback.py # Workflow playback
│ └── commands/ # CLI commands
├── shell/ # Shell integration
│ ├── bash_completion.sh
│ └── setup.sh
└── tests/ # Unit tests
```
## Testing
```bash
# Run all tests
pytest tests/ -v
# Run with coverage
pytest tests/ --cov=cli_memory --cov-report=term-missing
# Run specific test file
pytest tests/test_models.py -v
```
## Contributing
1. Fork the repository
2. Create a feature branch
3. Make your changes
4. Run tests: `pytest tests/`
5. Submit a pull request
## License
MIT License - see LICENSE file for details.