autocmdr

module
v0.0.0-...-cc308a7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 24, 2025 License: MIT

README ยถ

AutoCmdr App

Go Version License Go Report Card CI

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:

  1. Configuration File: ~/.autocmdr/config.json
  2. Environment Variables: Prefixed with LANGCHAIN_CHAT_
  3. 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
  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Run the test suite
  6. 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

Directories ยถ

Path Synopsis
cmd
autocmdr command
examples
advanced command
basic command
pkg
chat
Package chat implements the core chat assistant functionality including conversation management and response generation.
Package chat implements the core chat assistant functionality including conversation management and response generation.
config
Package config provides functionality for loading, saving, and validating application configuration.
Package config provides functionality for loading, saving, and validating application configuration.
prompts
Package prompts provides functionality for loading and managing prompt templates.
Package prompts provides functionality for loading and managing prompt templates.
utils
Package utils provides common utility functions including JSON manipulation and path handling.
Package utils provides common utility functions including JSON manipulation and path handling.
version
Package version manages the application version information and provides version-related utilities.
Package version manages the application version information and provides version-related utilities.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL