diff --git a/lang/parse.go b/lang/parse.go index 2c3ac204..f3a8ee5d 100644 --- a/lang/parse.go +++ b/lang/parse.go @@ -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. @@ -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 { diff --git a/lang/uniast/ast.go b/lang/uniast/ast.go index 12afedae..08c1b5be 100644 --- a/lang/uniast/ast.go +++ b/lang/uniast/ast.go @@ -22,6 +22,8 @@ import ( "path/filepath" "strconv" "strings" + + "github.com/cloudwego/abcoder/version" ) type Language string @@ -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 { @@ -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 } diff --git a/lang/uniast/version.go b/lang/uniast/version.go index 5d84a052..c278a617 100644 --- a/lang/uniast/version.go +++ b/lang/uniast/version.go @@ -16,4 +16,4 @@ package uniast -const Version = "v0.1.3" +const ABCoderSpecificationVersion = "v0.1.3" diff --git a/main.go b/main.go index 762aa38b..dbe65f1e 100644 --- a/main.go +++ b/main.go @@ -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 [Language] [Flags] @@ -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) @@ -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, diff --git a/version.go b/version/version.go similarity index 93% rename from version.go rename to version/version.go index af5561e1..2aabc762 100644 --- a/version.go +++ b/version/version.go @@ -14,8 +14,8 @@ * limitations under the License. */ -package main +package version const ( - Version = "0.2.1" + ABCoderToolVersion = "0.2.1" )