Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lang/parse.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
"github.com/cloudwego/abcoder/lang/register"
"github.com/cloudwego/abcoder/lang/rust"
"github.com/cloudwego/abcoder/lang/uniast"
"github.com/cloudwego/abcoder/version"
)

// ParseOptions is the options for parsing the repo.
Expand Down Expand Up @@ -104,7 +105,8 @@ func Parse(ctx context.Context, uri string, args ParseOptions) ([]byte, error) {
repo.Name = args.RepoID
}

repo.ASTVersion = uniast.Version
repo.ASTVersion = uniast.ABCoderSpecificationVersion
repo.ABCoderToolVersion = version.ABCoderToolVersion

out, err := json.Marshal(repo)
if err != nil {
Expand Down
24 changes: 15 additions & 9 deletions lang/uniast/ast.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import (
"path/filepath"
"strconv"
"strings"

"github.com/cloudwego/abcoder/version"
)

type Language string
Expand Down Expand Up @@ -83,11 +85,14 @@ type NodeGraph map[string]*Node

// Repository
type Repository struct {
// ASTVersion is 'ABCoder Specification Version'
ASTVersion string
Name string `json:"id"` // module name
Path string // repo path
Modules map[string]*Module // module name => module
Graph NodeGraph // node id => node
// ABCoderToolVersion is 'ABCoder Tool Version'
ABCoderToolVersion string
Name string `json:"id"` // module name
Path string // repo path
Modules map[string]*Module // module name => module
Graph NodeGraph // node id => node
}

func (r Repository) ID() string {
Expand All @@ -107,11 +112,12 @@ func (r Repository) InternalModules() []*Module {
// NOTICE: Repository.Path is set as name by default, if th name isn't a path, set path somewhere
func NewRepository(name string) Repository {
ret := Repository{
Name: name,
Path: name,
Modules: map[string]*Module{},
Graph: map[string]*Node{},
ASTVersion: Version,
Name: name,
Path: name,
Modules: map[string]*Module{},
Graph: map[string]*Node{},
ASTVersion: ABCoderSpecificationVersion,
ABCoderToolVersion: version.ABCoderToolVersion,
}
return ret
}
Expand Down
2 changes: 1 addition & 1 deletion lang/uniast/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

package uniast

const Version = "v0.1.3"
const ABCoderSpecificationVersion = "v0.1.3"
6 changes: 4 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ import (
"github.com/cloudwego/abcoder/llm/agent"
"github.com/cloudwego/abcoder/llm/mcp"
"github.com/cloudwego/abcoder/llm/tool"
"github.com/cloudwego/abcoder/version"
)

const Usage = `abcoder <Action> [Language] <Path> [Flags]
Expand Down Expand Up @@ -106,7 +107,8 @@ func main() {

switch action {
case "version":
fmt.Fprintf(os.Stdout, "%s\n", Version)
fmt.Fprintf(os.Stdout, "ABCoder Tool Version: %s\n", version.ABCoderToolVersion)
fmt.Fprintf(os.Stdout, "ABCoder Universal Abstract-Syntax-Tree Specification Version: %s\n", uniast.ABCoderSpecificationVersion)

case "parse":
language, uri := parseArgsAndFlags(flags, true, flagHelp, flagVerbose)
Expand Down Expand Up @@ -183,7 +185,7 @@ func main() {

svr := mcp.NewServer(mcp.ServerOptions{
ServerName: "abcoder",
ServerVersion: Version,
ServerVersion: version.ABCoderToolVersion,
Verbose: *flagVerbose,
ASTReadToolsOptions: tool.ASTReadToolsOptions{
RepoASTsDir: uri,
Expand Down
4 changes: 2 additions & 2 deletions version.go → version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
* limitations under the License.
*/

package main
package version

const (
Version = "0.2.1"
ABCoderToolVersion = "0.2.1"
)
Loading