ai-terminal

module
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: MIT

README

Language : 🇺🇸 us | 🇨🇳 zh | 🇯🇵 ja

AI-Terminal

AI-Terminal is an advanced AI-powered CLI that enhances terminal workflows through AI-driven automation and optimization. It efficiently manages tasks such as file management, data processing, and system diagnostics.

Key Features

  • Contextual Assistance: Learns from user commands to provide syntax suggestions.
  • Automated Tasks: Recognizes repetitive task patterns and creates shortcuts.
  • Intelligent Search: Conducts searches within files, directories, and specific file types.
  • Error Correction: Corrects incorrect commands and suggests alternatives.
  • Custom Integrations: Supports integration with various tools and services via plugins or APIs.

Getting Started

Prerequisites
  • Go version v1.22.0 or higher.
Installation

Install using Homebrew:

brew install coding-hui/tap/ai-terminal

Or, download it:

  • Packages are available in Debian and RPM formats
  • Binaries are available for Linux, macOS, and Windows

Or, build from source (requires Go 1.22+):

make build

Then initialize configuration:

ai configure
Shell Completions

All packages and archives come with pre-generated completion files for Bash, ZSH, Fish, and PowerShell.

If you built it from source, you can generate them with:

ai completion bash -h
ai completion zsh -h
ai completion fish -h
ai completion powershell -h

If you use a package (like Homebrew, Debs, etc), the completions should be set up automatically, given your shell is configured properly.

Usage

Here are some examples of how to use AI-Terminal, grouped by functionality:

Chat
  • Initiate a Chat:

    ai ask "What is the best way to manage Docker containers?"
    
  • Use a Prompt File:

    ai ask --file /path/to/prompt_file.txt
    
  • Pipe Input:

    cat some_script.go | ai ask generate unit tests
    
Code Generation
  • Interactive Code Generation:

    ai coder
    

    Starts interactive mode for generating code based on prompts.

  • CLI-based Code Generation:

    ai ctx load /path/to/context_file
    ai coder -c session_id -p "improve comments and add unit tests"
    

    Load context files and specify session ID for batch processing. Supports:

    • Code improvement
    • Comment enhancement
    • Unit test generation
    • Code refactoring
  • Generate Code with Context:

    ai ctx load /path/to/context_file
    ai coder "implement feature xxx"
    

    Load context files first to provide additional information for code generation.

Code Review
  • Review Code Changes:
    ai review --exclude-list "*.md,*.txt"
    
Commit Messages
  • Generate a Commit Message:
    ai commit --diff-unified 3 --lang en
    

Contributing

We welcome contributions! Please see our Contribution Guidelines for more details.

Changelog

Check out the CHANGELOG.md for detailed updates and changes to the project.

License

Copyright 2024 coding-hui. Licensed under the MIT License.

Directories

Path Synopsis
cmd
cli
internal
ai
cli
Package cli create a root cobra command and add subcommands to it.
Package cli create a root cobra command and add subcommands to it.
cli/completion
Package completion output shell completion code for the specified shell (bash or zsh).
Package completion output shell completion code for the specified shell (bash or zsh).
cli/version
Package version print the client and server version information.
Package version print the client and server version information.
git
options
Package options print a list of global command-line options (applies to all commands).
Package options print a list of global command-line options (applies to all commands).
ui
ui/coders
Package coders provides interfaces and types for working with code editors.
Package coders provides interfaces and types for working with code editors.
util/templates
Package templates provides template functions for working with templates.
Package templates provides template functions for working with templates.
util/term
Package term provides structures and helper functions to work with terminal (state, sizes).
Package term provides structures and helper functions to work with terminal (state, sizes).

Jump to

Keyboard shortcuts

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