AutoCmdr App

English | ็ฎไฝไธญๆ
A command-line assistant application built using Go and LangChain, designed to help users securely interact with AI models to generate and execute system commands.
๐ Features
- Cross-Platform Support: Works on Windows (PowerShell), Linux, and macOS (Bash)
- Interactive CLI: Rich command-line interface with readline support
- Smart Command Generation: AI-powered command generation with safety checks
- Configuration Management: Flexible configuration with file and environment variable support
- Structured Logging: Comprehensive logging with configurable levels
- Memory Management: Conversation history with configurable window size
- Safety First: Built-in safety checks and confirmation prompts
- Extensible Architecture: Modular design following Go best practices
๐ฆ Installation
From Source
# Clone the repository
git clone https://github.com/blysin/autocmdr.git
cd autocmdr-app
# Build and install
make install
Using Go Install
go install github.com/blysin/autocmdr/cmd/autocmdr@latest
Pre-built Binaries
Download the latest release from the releases page.
๐ง Configuration
Initialize Configuration
autocmdr -init -m "your-model" -u "http://your-ollama-server:11434"
Configuration Options
The application supports configuration through:
- Configuration File:
~/.autocmdr/config.json
- Environment Variables: Prefixed with
LANGCHAIN_CHAT_
- Command Line Flags
Configuration Parameters
| Parameter |
Environment Variable |
Default |
Description |
model |
LANGCHAIN_CHAT_MODEL |
qwen3:14b |
AI model name |
server_url |
LANGCHAIN_CHAT_SERVER_URL |
http://localhost:11434 |
Ollama server URL |
token |
LANGCHAIN_CHAT_TOKEN |
"" |
API authentication token |
log_level |
LANGCHAIN_CHAT_LOG_LEVEL |
info |
Log level (debug, info, warn, error) |
Example Configuration File
{
"model": "qwen3:14b",
"server_url": "http://localhost:11434",
"token": "",
"log_level": "info"
}
๐ฏ Usage
Basic Usage
# Start interactive chat
autocmdr
# View current configuration
autocmdr -view
# View system prompt
autocmdr -prompt
# Show version information
autocmdr -version
Interactive Commands
Once in the chat session:
- Type your request in natural language
- The AI will generate appropriate commands
- Confirm execution with
y or n
- Use
clear to clear conversation history
- Use
exit to quit the application
Example Session
You: list all files in the current directory
Bot: I'll help you list all files in the current directory.
{
"success": "true",
"multipleLines": "false",
"script": "Get-ChildItem -Force"
}
Execute script directly? (y/n)
You: y
โ
Script executed successfully (exit code: 0)
Output:
Directory: C:\Users\example
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 2023/12/01 10:30 Documents
d----- 2023/12/01 10:30 Downloads
...
๐๏ธ Development
Prerequisites
- Go 1.21 or later
- Make (optional, for using Makefile)
Building from Source
# Clone the repository
git clone https://github.com/blysin/autocmdr.git
cd autocmdr-app
# Install dependencies
make deps
# Run tests
make test
# Build the application
make build
# Run the application
make run
Project Structure
autocmdr-app/
โโโ cmd/
โ โโโ autocmdr/ # Application entry point
โโโ pkg/
โ โโโ config/ # Configuration management
โ โโโ chat/ # Chat functionality
โ โโโ prompts/ # Prompt templates and loading
โ โโโ utils/ # Utility functions
โโโ internal/
โ โโโ version/ # Version information
โโโ examples/ # Usage examples
โโโ docs/ # Documentation
โโโ scripts/ # Build and utility scripts
โโโ .github/ # GitHub workflows and templates
Available Make Targets
make help # Show all available targets
make build # Build the application
make test # Run tests
make test-coverage # Run tests with coverage
make lint # Run linters
make fmt # Format code
make clean # Clean build artifacts
๐งช Testing
# Run all tests
make test
# Run tests with coverage
make test-coverage
# Run benchmarks
make bench
๐ Documentation
๐ค Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Workflow
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Run the test suite
- Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
๐ Support
Made with โค๏ธ by the AutoCmdr App team