go1-eng

command module
v0.0.0-...-8e82d8a Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: MIT Imports: 23 Imported by: 0

README

go1-engineer

Description

go1-engineer command-line tool designed to assist developers in managing and automating their project workflows. It leverages advanced AI capabilities to create, edit, review, and plan various aspects of your codebase, enhancing productivity.

Getting started

git clone https://gitlab.com/0x3a2d29/go1-eng.git
go build

# Add your OPENAI_API_KEY to env
./go1-eng

Configuration

go1-engineer uses a config.json file to manage AI providers and models. This configuration file is located in the same directory as the executable.

config.json Structure

Here's an example structure of the config.json:

{
  "default_provider": "openai",
  "default_model": "gpt-4",
  "providers": [
    {
      "name": "openai",
      "api_url": "https://api.openai.com/v1/chat/completions",
      "api_key_env": "OPENAI_API_KEY",
      "default_model": "gpt-4",
      "models": [
        {
          "text": "gpt-4-turbo",
          "description": "GPT-4 Turbo model",
          "max_context": 128000
        },
        {
          "text": "o1-mini",
          "description": "O1-mini model",
          "max_context": 128000
        },
        {
          "text": "o1-preview",
          "description": "O1-preview model",
          "max_context": 128000
        }
      ]
    },
    {
      "name": "anthropic",
      "api_url": "https://api.anthropic.com/v1/messages",
      "api_key_env": "ANTHROPIC_API_KEY",
      "default_model": "claude-3-5-sonnet-20240620",
      "models": [
        {
          "text": "claude-3-5-sonnet-20240620",
          "description": "Claude 3.5 Sonnet",
          "max_context": 200000
        },
        {
          "text": "claude-3-opus-20240229",
          "description": "Claude 3 Opus",
          "max_context": 200000
        }
      ]
    }
  ]
}
  1. The config.json in this repo has examples for OpenAI, Anthropic, OpenRouter, Groq, Cerebras, LM Studio, Perplexity, Mistal, Cohere, Together, xAI, Google and NVIDIA.

Managing API Keys:

  • Ensure that the environment variables referenced in api_key_env are set in your system.

  • For example, if a provider has "api_key_env": "OPENAI_API_KEY", set the OPENAI_API_KEY environment variable with your OpenAI API key:

    export OPENAI_API_KEY=your_openai_api_key
    
Commands

go1-engineer provides a range of commands to interact with your project effectively. Below is the current list of available commands:

  • /provider
    View and change the AI provider defined in config.json.
    Usage: /provider [provider_name]
    Example: /provider anthropic

  • /model
    View and change the AI model defined in config.json.
    Usage: /model [model_name]
    Example: /model claude-3-5-sonnet-20240620

  • /plan
    Generate a detailed plan based on your request.
    Usage: /plan Develop a feature for real-time data synchronization.

  • /create
    Create files or folders based on provided instructions.
    Usage: /create Generate a new API endpoint for user authentication.

  • /edit
    Edit files or directories by specifying their paths.
    Usage: /edit src/main.go utils/helper.go

  • /review
    Review code files by providing their file paths.
    Usage: /review src/main.go src/utils/helper.go

  • /add
    Add files or folders to the chat context.
    Usage: /add src/main.go utils/helper.go

  • /addlines
    Add specific lines from a file to context (usage: /addlines -)
    Usage: /addlines src/main.go 54-93

  • /view
    View conversation history.
    Usage: /view [all|last|Number]
    Examples:

    • /view all - View all conversation history.
    • /view last - View the last AI response.
    • /view 2 - View the second message in chat history
    • /view - will show a list all message in history to chooose from
  • /remove
    Remove selected chat history messages including files.
    Usage: /remove [all] or /remove [message_number]
    Examples:

    • /remove all - Remove the entire conversation history.
    • /remove 3 - Remove the third message pair.
  • /save
    Save an assistant message to a markdown file.
    Usage: /save [message_number]
    Example: /save 2

  • /extract
    Extract a specific language code block from the last AI response and save it to a file.
    Usage: /extract [language]
    Example: /extract python

  • /token
    Show token usage in context.
    Usage: /token

  • /git
    Execute Git commands.
    Usage: /git [git-command]
    Example: /git status

  • /cmd
    Run a shell command and optionally add the output to the chat. Alias: !
    Usage: /cmd [command]
    Example: /cmd ls -la

  • !
    Alias for /cmd.
    Usage: ! [command]
    Example: ! ls -la

  • /web
    Scrape a web page and add it to the context.
    Usage: /web [URL]
    Example: /web https://example.com

  • /quit
    Exit the program. Alias: /exit.
    Usage: /quit

  • /exit
    Alias for /quit.
    Usage: /exit

  • /help
    Show the help message with the list of available commands.
    Usage: /help

  • /temp
    Change Model Temperature between 0 and 1.
    Usage: /temp [value]
    Example: /temp 0.7

  • /summary
    Summarize the chat history, replacing the current chat history.
    Usage: /summary

Best used in a terminal with an editor like VSCode.

Auto Memory Save

go1-engineer manages your session's memory by saving the conversation history, added files, and AI settings in a .go1-eng-mem.json file within your current working directory. This ensures session persistence across multiple uses.

Features
  • Per Working Directory Storage: Each working directory has its own memory file, isolating sessions between different projects.
  • Automatic Saving and Restoration: The memory state is saved upon exiting and loaded automatically when restarting in the same directory.
Memory File Details
  • File Name: .go1-eng-mem.json
  • Contents:
    • conversation_history: Stores the messages exchanged during the session.
    • provider_name: The currently selected AI provider.
    • model: The AI model in use.
Managing Memory
  • Viewing Memory: Use the /view command to view the entire conversation history.
  • Saving Responses: Use the /save command to export an assistant message to a markdown file.
  • Remove Context: Use the /remove command to delete specific messages or the entire conversation history.

To Do

  • refresh modified files in chat history
  • add context to chatwithai
  • breakout file handling to submodule.
  • finish breakout of cmd's to submodule
  • Rewrite README.md and add demo gif

Future

  • function calls for /edit /create etc..
  • add notes.
  • image support?
  • possibly use /v1/models endponit for /models cmd
  • bubbletea conversion

Authors and Acknowledgment

go1-eng is 95% self-written by go1-eng and was guided and written by Colin Faulkingham 2024

Based on o1-engineer written by Doriandarko.

Also inspired by aider.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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