Skip to content

jubaoliang/ScriptMate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

ScriptMate

πŸ€– Your Intelligent Script Partner - Making command-line collaboration as seamless as working with a trusted companion

Python Version License: MIT PyPI version

Overview

ScriptMate is your intelligent script partner, making command-line collaboration as seamless as working with a trusted companion. It understands natural language descriptions and generates corresponding shell commands. Whether you're a beginner or an experienced developer, ScriptMate helps you quickly find and execute the right commands.

✨ Features

  • πŸ€– Natural Language Understanding: Supports natural language descriptions to understand user intent
  • πŸ”§ Cross-Platform: Works on Windows, macOS, and Linux
  • πŸ›‘οΈ Safe Execution: Requires user confirmation before execution for security
  • πŸ“ Detailed Explanations: Provides detailed explanations and reasoning process
  • βš™οΈ Flexible Configuration: Supports multiple LLM service providers
  • 🎨 Rich Interface: Beautiful terminal output with colors and icons
  • πŸ“Š Command History: Track and review executed commands
  • πŸ” Dry Run Mode: Preview commands without execution

πŸš€ Installation

Using pip

pip install scriptmate

Using uv

uv add scriptmate

From Source

git clone https://github.com/your-username/scriptmate.git
cd scriptmate
uv sync
uv pip install -e .

🎯 Quick Start

1. Initial Setup

On first use, ScriptMate will guide you through the configuration:

scriptmate generate "show current user"

You'll be prompted to enter:

  • API Key: Your LLM service API key
  • Model Name: e.g., gpt-3.5-turbo, gpt-4
  • Base URL: e.g., https://api.openai.com/v1

2. Basic Usage

# Generate and execute commands
scriptmate generate "show current user"
scriptmate generate "list files in current directory"
scriptmate generate "check disk usage"

# Preview without execution (dry run)
scriptmate generate --dry-run "find all Python files"

# Auto-confirm execution
scriptmate generate -y "show system time"

3. Configuration Management

# Show current configuration
scriptmate config show

# Setup new configuration
scriptmate config setup

# Test configuration
scriptmate config test

# Reset configuration
scriptmate config reset

4. System Information

# Show version
scriptmate --version

# Show system info
scriptmate info

# Show command history
scriptmate history

πŸ“‹ Command Examples

# File Operations
scriptmate generate "find all .py files recursively"
scriptmate generate "show file permissions of current directory"
scriptmate generate "compress folder into zip"

# System Monitoring
scriptmate generate "show memory usage"
scriptmate generate "list running processes"
scriptmate generate "check network connections"

# Git Operations
scriptmate generate "show git status with colors"
scriptmate generate "create new branch and switch to it"

# Network Operations
scriptmate generate "ping google.com 5 times"
scriptmate generate "download file from URL"

βš™οΈ Configuration

Configuration is stored in ~/.scriptmate/config.json:

{
    "api_key": "your-api-key",
    "model_name": "gpt-3.5-turbo",
    "base_url": "https://api.openai.com/v1",
    "created_at": "2024-01-01T00:00:00Z"
}

πŸ”Œ Supported LLM Services

ScriptMate supports all OpenAI API-compatible services:

  • OpenAI: GPT-3.5, GPT-4, GPT-4 Turbo
  • Azure OpenAI: Enterprise OpenAI services
  • Anthropic Claude: Via compatible interfaces
  • Local Models: Ollama, LocalAI, etc.
  • Other Services: Any OpenAI API-compatible service

πŸ›‘οΈ Security Features

  • User Confirmation: All commands require confirmation before execution
  • Dangerous Command Detection: Automatic detection of potentially harmful commands
  • Safe Storage: Secure API key storage with masked display
  • Dry Run Mode: Preview commands without execution
  • Error Handling: Comprehensive error handling and validation

πŸ—οΈ Architecture

scriptmate/
β”œβ”€β”€ cli.py          # Command-line interface (Click framework)
β”œβ”€β”€ config.py       # Configuration management (JSON storage)
β”œβ”€β”€ llm_client.py   # LLM client (OpenAI-compatible API)
β”œβ”€β”€ executor.py     # Command executor (Safe execution)
└── utils.py        # Utility functions

πŸ§ͺ Development

Setup Development Environment

git clone https://github.com/your-username/scriptmate.git
cd scriptmate
uv sync --dev

Run Tests

# Run all tests
uv run pytest

# Run with coverage
uv run pytest --cov=scriptmate

# Run linting
uv run flake8 src/ tests/
uv run black --check src/ tests/

Build and Publish

# Build package
uv build

# Publish to PyPI (requires credentials)
uv publish

πŸ“š Documentation

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

If you encounter issues or have suggestions:

  1. Check the FAQ
  2. Search existing Issues
  3. Create a new Issue

πŸ™ Acknowledgments

  • Built with Click for CLI interface
  • Powered by Rich for beautiful terminal output
  • Managed with uv for fast Python packaging

ScriptMate - Your intelligent script partner, making command-line collaboration as seamless as working with a trusted companion! πŸš€βœ¨

δΈ­ζ–‡ζ–‡ζ‘£ | English

About

ScriptMate is your intelligent script partner, making command-line collaboration as seamless as working with a trusted companion. It understands natural language descriptions and generates corresponding shell commands. Whether you're a beginner or an experienced developer, ScriptMate helps you quickly find and execute the right commands.

Resources

License

Contributing

Stars

4 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors