Documentation
¶
Index ¶
- Constants
- Variables
- func GetJSONSchema(sch any) json.RawMessage
- type ASTReadTools
- func (t *ASTReadTools) GetASTNode(_ context.Context, params GetASTNodeReq) (*GetASTNodeResp, error)
- func (t *ASTReadTools) GetFileStructure(_ context.Context, req GetFileStructReq) (*GetFileStructResp, error)
- func (t *ASTReadTools) GetPackageStructure(ctx context.Context, req GetPackageStructReq) (*GetPackageStructResp, error)
- func (t *ASTReadTools) GetRepoStructure(_ context.Context, req GetRepoStructReq) (*GetRepoStructResp, error)
- func (t *ASTReadTools) GetTool(name string) Tool
- func (t *ASTReadTools) GetTools() []Tool
- func (t *ASTReadTools) ListRepos(ctx context.Context, req ListReposReq) (*ListReposResp, error)
- type ASTReadToolsOptions
- type ASTWriteTools
- type ASTWriteToolsOptions
- type FileStruct
- type FuncType
- type FunctionConfig
- type GetASTNodeReq
- type GetASTNodeResp
- type GetFileStructReq
- type GetFileStructResp
- type GetPackageStructReq
- type GetPackageStructResp
- type GetRepoStructReq
- type GetRepoStructResp
- type ListReposReq
- type ListReposResp
- type MCPClient
- type MCPConfig
- type MCPType
- type ModuleStruct
- type NodeID
- type NodeStruct
- type PackageStruct
- type Tool
- type ToolConfig
- type WriteASTNodeReq
- type WriteASTNodeResp
Constants ¶
View Source
const ( ToolListRepos = "list_repos" DescListRepos = "list all repositories" ToolGetRepoStructure = "get_repo_structure" DescGetRepoStructure = "get the repository structure, including package list and file list" ToolGetPackageStructure = "get_package_structure" DescGetPackageStructure = "get the package (NameSpace) structure, including file list and node-id list" ToolGetFileStructure = "get_file_structure" DescGetFileStructure = "get the file structure, including node (id,signature,type) list" ToolGetASTNode = "get_ast_node" DescGetASTNode = "" /* 152-byte string literal not displayed */ )
View Source
const (
ToolWriteASTNode = "write_ast_node"
)
Variables ¶
View Source
var ( SchemaListRepos = GetJSONSchema(ListReposReq{}) SchemaGetRepoStructure = GetJSONSchema(GetRepoStructReq{}) SchemaGetPackageStructure = GetJSONSchema(GetPackageStructReq{}) SchemaGetFileStructure = GetJSONSchema(GetFileStructReq{}) SchemaGetASTNode = GetJSONSchema(GetASTNodeReq{}) )
Functions ¶
func GetJSONSchema ¶
func GetJSONSchema(sch any) json.RawMessage
Types ¶
type ASTReadTools ¶
type ASTReadTools struct {
// contains filtered or unexported fields
}
func NewASTReadTools ¶
func NewASTReadTools(opts ASTReadToolsOptions) *ASTReadTools
func (*ASTReadTools) GetASTNode ¶
func (t *ASTReadTools) GetASTNode(_ context.Context, params GetASTNodeReq) (*GetASTNodeResp, error)
func (*ASTReadTools) GetFileStructure ¶
func (t *ASTReadTools) GetFileStructure(_ context.Context, req GetFileStructReq) (*GetFileStructResp, error)
GetFileStruct get node list, each node only includes ID\Type\Signature
func (*ASTReadTools) GetPackageStructure ¶
func (t *ASTReadTools) GetPackageStructure(ctx context.Context, req GetPackageStructReq) (*GetPackageStructResp, error)
GetPackageStruct get package structure
func (*ASTReadTools) GetRepoStructure ¶
func (t *ASTReadTools) GetRepoStructure(_ context.Context, req GetRepoStructReq) (*GetRepoStructResp, error)
GetRepoStructure list the packages and file-paths
func (*ASTReadTools) GetTool ¶
func (t *ASTReadTools) GetTool(name string) Tool
func (*ASTReadTools) GetTools ¶
func (t *ASTReadTools) GetTools() []Tool
func (*ASTReadTools) ListRepos ¶
func (t *ASTReadTools) ListRepos(ctx context.Context, req ListReposReq) (*ListReposResp, error)
type ASTReadToolsOptions ¶
type ASTReadToolsOptions struct {
// PatchOptions patch.Options
RepoASTsDir string
}
type ASTWriteTools ¶
type ASTWriteTools struct {
// contains filtered or unexported fields
}
func NewASTWriteTools ¶
func NewASTWriteTools(repo *uniast.Repository, opts ASTWriteToolsOptions) *ASTWriteTools
func (ASTWriteTools) GetTool ¶
func (t ASTWriteTools) GetTool(name string) Tool
func (ASTWriteTools) GetTools ¶
func (t ASTWriteTools) GetTools() []Tool
func (ASTWriteTools) WriteASTNode ¶
func (t ASTWriteTools) WriteASTNode(_ context.Context, req WriteASTNodeReq) (*WriteASTNodeResp, error)
type ASTWriteToolsOptions ¶
type FileStruct ¶
type FileStruct struct {
FilePath string `json:"file_path" jsonschema:"description=the path of the file"`
Imports []uniast.Import `json:"imports,omitempty" jsonschema:"description=the imports of the file"`
Nodes []NodeStruct `json:"nodes,omitempty" jsonschema:"description=the node structs of the file"`
}
type FunctionConfig ¶
type FunctionConfig struct {
Type FuncType `json:"type"` // plugin type includes builtin, stdio
URI string `json:"uri"` // exec-path for stdio, func-URI for func
Options json.RawMessage `json:"options"` // raw config for specific plugin
}
FunctionConfig is the config for function It can be either builtin function or stdio-plugin or MCP (TODO)
type GetASTNodeReq ¶
type GetASTNodeResp ¶
type GetASTNodeResp struct {
Nodes []NodeStruct `json:"nodes" jsonschema:"description=the ast nodes"`
Error string `json:"error,omitempty" jsonschema:"description=the error message"`
}
type GetFileStructReq ¶
type GetFileStructResp ¶
type GetFileStructResp struct {
FileStruct
Error string `json:"error,omitempty" jsonschema:"description=the error message"`
}
type GetPackageStructReq ¶
type GetPackageStructResp ¶
type GetPackageStructResp struct {
Files []FileStruct `json:"files" jsonschema:"description=the file structures"`
Error string `json:"error,omitempty" jsonschema:"description=the error message"`
}
type GetRepoStructReq ¶
type GetRepoStructReq struct {
RepoName string `json:"repo_name" jsonschema:"description=the name of the repository"`
}
type GetRepoStructResp ¶
type GetRepoStructResp struct {
Modules []ModuleStruct `json:"modules" jsonschema:"description=the module structure of the repository"`
Error string `json:"error,omitempty" jsonschema:"description=the error message"`
}
type ListReposReq ¶
type ListReposReq struct {
}
type ListReposResp ¶
type ListReposResp struct {
RepoNames []string `json:"repo_names" jsonschema:"description=the names of the repositories"`
}
type MCPClient ¶
type MCPClient struct {
// contains filtered or unexported fields
}
func NewMCPClient ¶
type ModuleStruct ¶
type ModuleStruct struct {
uniast.ModPath `json:"mod_path" jsonschema:"description=the mod path of the module"`
Packages []PackageStruct `json:"packages,omitempty" jsonschema:"description=the package structures of the module"`
}
type NodeID ¶
type NodeStruct ¶
type NodeStruct struct {
ModPath uniast.ModPath `json:"mod_path,omitempty" jsonschema:"description=the module path"`
PkgPath uniast.PkgPath `json:"pkg_path,omitempty" jsonschema:"description=the package path"`
Name string `json:"name" jsonschema:"description=the name of the node"`
Type string `json:"type,omitempty" jsonschema:"description=the type of the node"`
Signature string `json:"signature,omitempty" jsonschema:"description=the func signature of the node"`
File string `json:"file,omitempty" jsonschema:"description=the file path of the node"`
Line int `json:"line,omitempty" jsonschema:"description=the line of the node"`
Codes string `json:"codes,omitempty" jsonschema:"description=the codes of the node"`
Dependencies []NodeID `json:"dependencies,omitempty" jsonschema:"description=the dependencies of the node"`
References []NodeID `json:"references,omitempty" jsonschema:"description=the references of the node"`
Implements []NodeID `json:"implements,omitempty" jsonschema:"description=the implements of the node"`
Groups []NodeID `json:"groups,omitempty" jsonschema:"description=the groups of the node"`
Inherits []NodeID `json:"inherits,omitempty" jsonschema:"description=the inherits of the node"`
}
type PackageStruct ¶
type PackageStruct struct {
uniast.PkgPath `json:"pkg_path" jsonschema:"description=the path of the package"`
Files []FileStruct `json:"files,omitempty" jsonschema:"description=the file structures of the package"`
}
type ToolConfig ¶
type ToolConfig struct {
Name string `json:"name"` // name of the tool
FunctionConfig
}
ToolConfig is the config for LLM-calling tools.
type WriteASTNodeReq ¶
type WriteASTNodeReq struct {
ID uniast.Identity `json:"id" jsonschema:"description=the id of the ast node"`
Codes string `json:"codes" jsonschema:"description=the codes of the ast node"`
Type string `json:"type" jsonschema:"description=the type of the ast node, must be enum of 'FUNC'|'TYPE'|'VAR'"`
File string `json:"file,omitempty" jsonschema:"description=the file path for newly-added ast node"`
AddedDeps []uniast.Identity `json:"added_deps" jsonschema:"description=the added dependencies of the ast node"`
}
type WriteASTNodeResp ¶
type WriteASTNodeResp struct {
Success bool `json:"success" jsonschema:"description=whether the ast node is written successfully"`
Message string `json:"message" jsonschema:"description=the feedback message"`
References []uniast.Identity `json:"references,omitempty" jsonschema:"description=the references of the ast node"`
}
Click to show internal directories.
Click to hide internal directories.