code-editing-agent

command module
v0.0.0-...-2647928 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 7 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Code Editing Agent

Go Report Card Go Reference GitHub go.mod Go version License GitHub last commit GitHub stars GitHub forks

This project is a Go-based code editing agent that uses the DeepSeek language model to interact with your codebase. It's inspired by the tutorial How to Build an Agent, but it has been adapted to use the DeepSeek API instead of the Claude API.

Architecture

arch

Features

  • Interactive Chat: Chat with the agent to give it instructions.
  • File System Tools: The agent can:
    • List files and directories.
    • Read the contents of files.
    • Edit files by replacing text.
  • Powered by DeepSeek: The agent uses the DeepSeek language model to understand your requests and generate code.

How It Works

The agent works by sending your chat messages to the DeepSeek API, along with a set of available tools. The DeepSeek model can then decide to use one of these tools to fulfill your request.

For example, if you ask the agent to "read the main.go file", it will call the read_file tool with the path main.go. The output of the tool will then be sent back to the DeepSeek model, which will use it to generate a response.

Getting Started

Prerequisites
  • Go 1.24.5 or later
  • A DeepSeek API key
Installation
  1. Clone the repository:

    git clone https://github.com/promacanthus/code-editing-agent.git
    
  2. Navigate to the project directory:

    cd code-editing-agent
    
  3. Install the dependencies:

    go mod tidy
    
Configuration

The agent requires a DeepSeek API key to be set in the main.go file. Replace "YOUR_DEEPSEEK_API_KEY" with your actual API key:

// main.go
client := deepseek.NewClient("YOUR_DEEPSEEK_API_KEY")
Usage

To run the agent, execute the following command:

go run main.go

You can then start chatting with the agent in your terminal.

Tools

The following tools are available to the agent:

  • list_files: List files and directories at a given path.
  • read_file: Read the contents of a given file.
  • edit_file: Make edits to a text file.

Project Structure

.
├── go.mod
├── go.sum
├── main.go
└── pkg
    ├── agent
    │   └── agent.go
    └── tool
        ├── edit_file.go
        ├── list_files.go
        ├── read_file.go
        └── types.go
  • main.go: The entry point of the application.
  • pkg/agent/agent.go: Contains the core logic for the agent.
  • pkg/tool/: Contains the definitions for the available tools.

Acknowledgments

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

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