|
1 |
| -<!-- |
2 |
| - Copyright 2025 CloudWeGo Authors |
3 |
| - |
4 |
| - Licensed under the Apache License, Version 2.0 (the "License"); |
5 |
| - you may not use this file except in compliance with the License. |
6 |
| - You may obtain a copy of the License at |
7 |
| - |
8 |
| - https://www.apache.org/licenses/LICENSE-2.0 |
9 |
| - |
10 |
| - Unless required by applicable law or agreed to in writing, software |
11 |
| - distributed under the License is distributed on an "AS IS" BASIS, |
12 |
| - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
13 |
| - See the License for the specific language governing permissions and |
14 |
| - limitations under the License. |
15 |
| ---> |
16 |
| - |
17 | 1 | # ABCoder: AI-Based Coder(AKA: A Brand-new Coder)
|
18 | 2 |
|
19 | 3 | 
|
20 | 4 |
|
21 |
| -ABCoder, an AI-powered tool, streamlines coding by keeping real-time status updates, providing lossless code compression, and giving development guidance. It enhances testing by identifying quality, generating reports, and auto-creating test cases. It also offers guidance for refactoring, including language stack switches. |
22 |
| - |
23 |
| -# Table of Contents |
24 |
| - |
25 |
| -- [ABCoder: AI-Based Coder(AKA: A Brand-new Coder)](#abcoder-ai-based-coderaka-a-brand-new-coder) |
26 |
| -- [Table of Contents](#table-of-contents) |
27 |
| -- [Overview](#overview) |
28 |
| -- [Quick Start](#quick-start) |
29 |
| - - [Prerequisites](#prerequisites) |
30 |
| - - [Running through Coze OpenAPI](#running-through-coze-openapi) |
31 |
| -- [Status Update](#status-update) |
32 |
| -- [Lossless Compression](#lossless-compression) |
33 |
| -- [Development Guide](#development-guide) |
34 |
| -- [Testing Enhancements](#testing-enhancements) |
35 |
| -- [Refactor/Rewrite Guide](#refactorrewrite-guide) |
36 |
| -- [Getting Involved](#getting-involved) |
37 |
| - |
38 | 5 | # Overview
|
| 6 | +ABCoder, an AI-oriented code-processing SDK, is designed to enhance coding context for Large-Language-Model (LLM), and boost developing AI-assisted-coding applications. |
39 | 7 |
|
40 |
| -ABCoder is a comprehensive open-source software development tool that aims to utilize artificial intelligence to enhance |
41 |
| -the process of coding. This project focuses on various aspects of software development ranging from repository analysis, |
42 |
| -issue and pull request tracking, to automated code compression, development guidance, testing enhancement, and |
43 |
| -refactoring guidance. |
44 | 8 |
|
45 |
| -# Quick Start |
| 9 | +## Features |
46 | 10 |
|
47 |
| -## Prerequisites |
48 |
| -- install git and set your access token for github on cmd-line |
49 |
| -- install [rust-toolchain](https://www.rust-lang.org/tools/install) (stable) |
50 |
| -- (optional) install [ollama](https://github.com/ollama/ollama) and run your LLM |
51 |
| -- (optional) create a [Coze](https://www.coze.com/docs/developer_guides/coze_api_overview?_lang=en) agent and set its OpenAPI key |
| 11 | +- Universal Abstract Syntax Tree (UniAST), an language-independent, AI-friendly specification of code information, providing a flexible and structrual coding context for both AI and hunman. |
| 12 | + |
| 13 | +- General Parser, parses abitary-language codes to UniAST. |
52 | 14 |
|
53 |
| -## Running through Coze OpenAPI |
54 |
| -1. Set .env file for configuration on ABCoder's working directory. Taking Coze as an example: |
55 |
| -``` |
56 |
| -# cache for repo,AST and so on |
57 |
| -WORK_DIR=tmp_abcoder |
| 15 | +- General Writer, transforms UniAST back to codes. |
| 16 | + |
| 17 | +- (Comming Soon) General Iterator, a framework for visiting the UniAST easily and implementing batch-code-processing workflows. |
58 | 18 |
|
59 |
| -# exclude dirs for repo parsing, separated by comma |
60 |
| -EXCLUDE_DIRS=target,gen-codes |
| 19 | +- (Comming Soon) Code RAG, provides a set of tools and functions to help the LLM understand your codes much deeper than ever. |
61 | 20 |
|
62 |
| -# LLM's api type |
63 |
| -API_TYPE=coze # coze|ollama |
| 21 | +Based on these features, developers can easily implement or enhance their AI-assisted-coding applications, such as reviewing, optimizing, translating, etc. |
64 | 22 |
|
65 |
| -# LLM's output language |
66 |
| -LANGUAGE=zh |
67 | 23 |
|
68 |
| -# Coze options |
69 |
| -COZE_API_TOKEN="{YOUR_COZE_API_TOKEN}" |
70 |
| -COZE_BOT_ID={YOUR_COZE_BOT_ID} |
71 |
| -``` |
| 24 | +## Universal-Abstract-Syntax-Tree Specification |
72 | 25 |
|
73 |
| -2. compile the parsers |
74 |
| -``` |
75 |
| -./script/make_parser.sh |
76 |
| -``` |
| 26 | +see [UniAST Specification](docs/uniast-zh.md) |
77 | 27 |
|
78 |
| -3. compile and run ABCoder |
79 |
| -``` |
80 |
| -cargo run --bin cmd compress https://xxx.git |
81 |
| -``` |
82 | 28 |
|
83 |
| -4. Once triggered, ABCoder will take three steps: |
84 |
| - 1. Download the repository in {REPO_DIR} |
85 |
| - 2. Parse the repository and store the AST in {CACHE_DIR} |
86 |
| - 3. Call the LLM to compress the repository codes, and refresh the AST for each call. |
87 |
| -You can stop the process at anytime after step 2. You can restart the compressing by running the same command. |
| 29 | +# Getting Started |
88 | 30 |
|
89 |
| -5. Export the compressed results |
| 31 | +1. Install ABCoder: |
| 32 | +```bash |
| 33 | +go install github.com/cloudwego/abcoder@latest |
90 | 34 | ```
|
91 |
| -cargo run --bin cmd export https://xxx.git --out-dir {OUTPUT_DIR} |
| 35 | +2. Use ABCoder to parse a repository to UniAST (JSON) |
| 36 | +```bash |
| 37 | +abcoder parse {language} {repo-path} > ast.json |
| 38 | +``` |
| 39 | +3. Do your magic with UniAST... |
| 40 | +4. Use ABCoder to write a UniAST back to codes |
| 41 | +```bash |
| 42 | +abcoder write {language} ast.json |
92 | 43 | ```
|
93 | 44 |
|
94 |
| -# Status Update |
95 |
| - |
96 |
| -The system is designed to automatically fetch the latest data from Github upon triggering relevant tasks, ensuring the |
97 |
| -repository status is always up-to-date. It can answer queries related to function, defects based on issue and PR |
98 |
| -information. For more details, check out our Issues and Pull Requests sections on Github. |
99 |
| - |
100 |
| -# Lossless Compression |
101 |
| - |
102 |
| -The system also offers a lossless compression feature for repository code. The specific implementation methods are being |
103 |
| -optimized, and more details will be available soon. |
104 |
| - |
105 |
| -# Development Guide |
106 | 45 |
|
107 |
| -We welcome all developers wishing to contribute to ABCoder. Our system provides detailed guidance for manual development |
108 |
| -and also supports auto-generation of instructions. Check out our Contribution Guide for more information. |
| 46 | +# Supported Languages |
109 | 47 |
|
110 |
| -# Testing Enhancements |
| 48 | +ABCoder currently supports the following languages: |
111 | 49 |
|
112 |
| -The system is designed to analyze existing functions and corresponding tests, identify the overall quality of testing, |
113 |
| -produce reports, and automatically generate test cases for weakly covered items. Our goal is to help repositories |
114 |
| -enhance and perfect their test cases. |
| 50 | +| Language | Parser | Writer | |
| 51 | +| -------- | ----------- | ----------- | |
| 52 | +| Go | ✅ | ✅ | |
| 53 | +| Rust | ✅ | Coming Soon | |
| 54 | +| C | Coming Soon | ❌ | |
115 | 55 |
|
116 |
| -# Refactor/Rewrite Guide |
117 | 56 |
|
118 |
| -We offer guidance for both small-scale feature iterations and large-scale rewrites, including language stack switches. |
119 |
| -Our system provides a detailed guide for manual development and also supports automated guidance generation. |
120 | 57 |
|
121 | 58 | # Getting Involved
|
122 | 59 |
|
123 | 60 | We encourage developers to contribute and make this tool more powerful. If you are interested in contributing to ABCoder
|
124 |
| -project, kindly check out our Getting Involved Guide. |
| 61 | +project, kindly check out our Getting Involved Guide: |
| 62 | +- [Parser Extension](docs/parser-zh.md) |
125 | 63 |
|
126 | 64 | > Note: This is a dynamic README and is subject to changes as the project evolves.
|
0 commit comments