@@ -38,7 +38,6 @@ import (
3838 "path/filepath"
3939 "strings"
4040
41- "github.com/spf13/cobra"
4241 interutils "github.com/cloudwego/abcoder/internal/utils"
4342 "github.com/cloudwego/abcoder/lang"
4443 "github.com/cloudwego/abcoder/lang/log"
@@ -49,26 +48,9 @@ import (
4948 "github.com/cloudwego/abcoder/llm/mcp"
5049 "github.com/cloudwego/abcoder/llm/tool"
5150 "github.com/cloudwego/abcoder/version"
51+ "github.com/spf13/cobra"
5252)
5353
54- const Usage = `abcoder <Action> [Language] <Path> [Flags]
55- Action:
56- parse parse the specific repo and write its UniAST (to stdout by default)
57- write write the specific UniAST back to codes
58- mcp run as a MCP server for all repo ASTs (*.json) in the specific directory
59- agent run as an Agent for all repo ASTs (*.json) in the specific directory. WIP: only support code-analyzing at present.
60- init-spec initialize ABCoder integration for Claude Code (copies .claude directory and configures MCP servers)
61- version print the version of abcoder
62- Language:
63- go for golang codes
64- rust for rust codes
65- cxx for c codes (cpp support is on the way)
66- python for python codes
67- ts for typescript codes
68- js for javascript codes
69- java for java codes
70- `
71-
7254func main () {
7355 cmd := NewRootCmd ()
7456 if err := cmd .Execute (); err != nil {
@@ -115,10 +97,10 @@ Use this command to verify installation or when reporting issues.`,
11597
11698func newParseCmd () * cobra.Command {
11799 var (
118- flagOutput string
119- flagLsp string
120- javaHome string
121- opts lang.ParseOptions
100+ flagOutput string
101+ flagLsp string
102+ javaHome string
103+ opts lang.ParseOptions
122104 )
123105
124106 cmd := & cobra.Command {
@@ -137,7 +119,7 @@ Language Support:
137119 js - JavaScript projects
138120 java - Java projects` ,
139121 Example : `abcoder parse go ./my-project -o ast.json` ,
140- Args : cobra .ExactArgs (2 ),
122+ Args : cobra .ExactArgs (2 ),
141123 PreRunE : func (cmd * cobra.Command , args []string ) error {
142124 // Validate language
143125 language := uniast .NewLanguage (args [0 ])
@@ -271,7 +253,7 @@ The server communicates via stdio and can be integrated with Claude Code or othe
271253
272254It serves all *.json AST files in the specified directory.` ,
273255 Example : `abcoder mcp ./asts/` ,
274- Args : cobra .ExactArgs (1 ),
256+ Args : cobra .ExactArgs (1 ),
275257 PreRunE : func (cmd * cobra.Command , args []string ) error {
276258 if args [0 ] == "" {
277259 return fmt .Errorf ("argument Path is required" )
@@ -315,7 +297,7 @@ The command will:
3152971. Copy the .claude configuration directory
3162982. Configure MCP server settings in Claude's config.json` ,
317299 Example : `abcoder init-spec /path/to/project` ,
318- Args : cobra .MaximumNArgs (1 ),
300+ Args : cobra .MaximumNArgs (1 ),
319301 RunE : func (cmd * cobra.Command , args []string ) error {
320302 verbose , _ := cmd .Flags ().GetBool ("verbose" )
321303 if verbose {
@@ -364,7 +346,7 @@ Examples:
364346 # With custom API endpoint and step limit
365347 API_TYPE=custom API_KEY=xxx MODEL_NAME=my-model BASE_URL=https://api.example.com \
366348 abcoder agent ./asts/ --agent-max-steps 100` ,
367- Args : cobra .ExactArgs (1 ),
349+ Args : cobra .ExactArgs (1 ),
368350 PreRunE : func (cmd * cobra.Command , args []string ) error {
369351 if args [0 ] == "" {
370352 return fmt .Errorf ("argument Path is required" )
0 commit comments