Documentation
¶
Index ¶
- Variables
- func RegisterBuiltinTools(r *Registry)
- func ValidatePathAllowParent(path string) (string, error)
- type AppendFileTool
- type BashTool
- type CopyFileTool
- type CreateDirTool
- type DeleteFileTool
- type DeleteLinesTool
- type FileChange
- type FormatTool
- type GitAddTool
- type GitBranchTool
- type GitCheckoutTool
- type GitCommitTool
- type GitDiffTool
- type GitLogTool
- type GitPushTool
- type GitStashTool
- type GitStatusTool
- type InsertAfterTool
- type InsertBeforeTool
- type LintTool
- type ListDirTool
- type MoveFileTool
- type PrependFileTool
- type ReadFileTool
- type Registry
- type RunTestTool
- type SearchCodeTool
- type SearchFileTool
- type StrReplaceTool
- type Tool
- type ToolCall
- type WebSearchTool
- type WriteFileTool
Constants ¶
This section is empty.
Variables ¶
var DefaultRegistry = NewRegistry()
DefaultRegistry はデフォルトのツールレジストリ
var ValidatePath = validatePathImpl
ValidatePath はパストラバーサル攻撃を防ぐためにパスを検証(テスト用にグローバル変数として定義)
Functions ¶
func RegisterBuiltinTools ¶
func RegisterBuiltinTools(r *Registry)
RegisterBuiltinTools はすべての組み込みツールを登録
func ValidatePathAllowParent ¶
ValidatePathAllowParent は親ディレクトリへのアクセスを許可 (特定の用途でのみ使用)
Types ¶
type AppendFileTool ¶
type AppendFileTool struct{}
===== Append File Tool =====
func (*AppendFileTool) Name ¶
func (t *AppendFileTool) Name() string
func (*AppendFileTool) Run ¶
func (t *AppendFileTool) Run(args map[string]string) (string, *FileChange, error)
type CopyFileTool ¶
type CopyFileTool struct{}
===== Copy File Tool =====
func (*CopyFileTool) Name ¶
func (t *CopyFileTool) Name() string
func (*CopyFileTool) Run ¶
func (t *CopyFileTool) Run(args map[string]string) (string, *FileChange, error)
type CreateDirTool ¶
type CreateDirTool struct{}
===== Create Directory Tool =====
func (*CreateDirTool) Name ¶
func (t *CreateDirTool) Name() string
func (*CreateDirTool) Run ¶
func (t *CreateDirTool) Run(args map[string]string) (string, *FileChange, error)
type DeleteFileTool ¶
type DeleteFileTool struct{}
DeleteFileTool deletes a file permanently (with backup)
func (*DeleteFileTool) Name ¶
func (t *DeleteFileTool) Name() string
func (*DeleteFileTool) Run ¶
func (t *DeleteFileTool) Run(args map[string]string) (string, *FileChange, error)
type DeleteLinesTool ¶
type DeleteLinesTool struct{}
DeleteLinesTool deletes a range of lines from a file
func (*DeleteLinesTool) Name ¶
func (t *DeleteLinesTool) Name() string
func (*DeleteLinesTool) Run ¶
func (t *DeleteLinesTool) Run(args map[string]string) (string, *FileChange, error)
type FileChange ¶
type FileChange struct {
FilePath string
BackupPath string
Timestamp time.Time
Tool string
Description string
}
FileChange はファイル変更履歴
type FormatTool ¶
type FormatTool struct{}
===== Format Tool =====
func (*FormatTool) Name ¶
func (t *FormatTool) Name() string
func (*FormatTool) Run ¶
func (t *FormatTool) Run(args map[string]string) (string, *FileChange, error)
type GitAddTool ¶
type GitAddTool struct{}
===== Git Add Tool =====
func (*GitAddTool) Name ¶
func (t *GitAddTool) Name() string
func (*GitAddTool) Run ¶
func (t *GitAddTool) Run(args map[string]string) (string, *FileChange, error)
type GitBranchTool ¶
type GitBranchTool struct{}
===== Git Branch Tool =====
func (*GitBranchTool) Name ¶
func (t *GitBranchTool) Name() string
func (*GitBranchTool) Run ¶
func (t *GitBranchTool) Run(args map[string]string) (string, *FileChange, error)
type GitCheckoutTool ¶
type GitCheckoutTool struct{}
===== Git Checkout Tool =====
func (*GitCheckoutTool) Name ¶
func (t *GitCheckoutTool) Name() string
func (*GitCheckoutTool) Run ¶
func (t *GitCheckoutTool) Run(args map[string]string) (string, *FileChange, error)
type GitCommitTool ¶
type GitCommitTool struct{}
===== Git Commit Tool =====
func (*GitCommitTool) Name ¶
func (t *GitCommitTool) Name() string
func (*GitCommitTool) Run ¶
func (t *GitCommitTool) Run(args map[string]string) (string, *FileChange, error)
type GitDiffTool ¶
type GitDiffTool struct{}
===== Git Diff Tool =====
func (*GitDiffTool) Name ¶
func (t *GitDiffTool) Name() string
func (*GitDiffTool) Run ¶
func (t *GitDiffTool) Run(args map[string]string) (string, *FileChange, error)
type GitLogTool ¶
type GitLogTool struct{}
===== Git Log Tool =====
func (*GitLogTool) Name ¶
func (t *GitLogTool) Name() string
func (*GitLogTool) Run ¶
func (t *GitLogTool) Run(args map[string]string) (string, *FileChange, error)
type GitPushTool ¶
type GitPushTool struct{}
===== Git Push Tool =====
func (*GitPushTool) Name ¶
func (t *GitPushTool) Name() string
func (*GitPushTool) Run ¶
func (t *GitPushTool) Run(args map[string]string) (string, *FileChange, error)
type GitStashTool ¶
type GitStashTool struct{}
===== Git Stash Tool =====
func (*GitStashTool) Name ¶
func (t *GitStashTool) Name() string
func (*GitStashTool) Run ¶
func (t *GitStashTool) Run(args map[string]string) (string, *FileChange, error)
type GitStatusTool ¶
type GitStatusTool struct{}
===== Git Status Tool =====
func (*GitStatusTool) Name ¶
func (t *GitStatusTool) Name() string
func (*GitStatusTool) Run ¶
func (t *GitStatusTool) Run(args map[string]string) (string, *FileChange, error)
type InsertAfterTool ¶
type InsertAfterTool struct{}
===== Insert After Tool =====
func (*InsertAfterTool) Name ¶
func (t *InsertAfterTool) Name() string
func (*InsertAfterTool) Run ¶
func (t *InsertAfterTool) Run(args map[string]string) (string, *FileChange, error)
type InsertBeforeTool ¶
type InsertBeforeTool struct{}
===== Insert Before Tool =====
func (*InsertBeforeTool) Name ¶
func (t *InsertBeforeTool) Name() string
func (*InsertBeforeTool) Run ¶
func (t *InsertBeforeTool) Run(args map[string]string) (string, *FileChange, error)
type ListDirTool ¶
type ListDirTool struct{}
===== List Dir Tool =====
func (*ListDirTool) Name ¶
func (t *ListDirTool) Name() string
func (*ListDirTool) Run ¶
func (t *ListDirTool) Run(args map[string]string) (string, *FileChange, error)
type MoveFileTool ¶
type MoveFileTool struct{}
MoveFileTool moves/renames a file
func (*MoveFileTool) Name ¶
func (t *MoveFileTool) Name() string
func (*MoveFileTool) Run ¶
func (t *MoveFileTool) Run(args map[string]string) (string, *FileChange, error)
type PrependFileTool ¶
type PrependFileTool struct{}
===== Prepend File Tool =====
func (*PrependFileTool) Name ¶
func (t *PrependFileTool) Name() string
func (*PrependFileTool) Run ¶
func (t *PrependFileTool) Run(args map[string]string) (string, *FileChange, error)
type ReadFileTool ¶
type ReadFileTool struct{}
===== Read File Tool =====
func (*ReadFileTool) Name ¶
func (t *ReadFileTool) Name() string
func (*ReadFileTool) Run ¶
func (t *ReadFileTool) Run(args map[string]string) (string, *FileChange, error)
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry はツールの登録・管理を行う
type RunTestTool ¶
type RunTestTool struct{}
===== Run Test Tool =====
func (*RunTestTool) Name ¶
func (t *RunTestTool) Name() string
func (*RunTestTool) Run ¶
func (t *RunTestTool) Run(args map[string]string) (string, *FileChange, error)
type SearchCodeTool ¶
type SearchCodeTool struct{}
===== Search Code Tool =====
func (*SearchCodeTool) Name ¶
func (t *SearchCodeTool) Name() string
func (*SearchCodeTool) Run ¶
func (t *SearchCodeTool) Run(args map[string]string) (string, *FileChange, error)
type SearchFileTool ¶
type SearchFileTool struct{}
===== Search File Tool =====
func (*SearchFileTool) Name ¶
func (t *SearchFileTool) Name() string
func (*SearchFileTool) Run ¶
func (t *SearchFileTool) Run(args map[string]string) (string, *FileChange, error)
type StrReplaceTool ¶
type StrReplaceTool struct{}
===== Str Replace Tool =====
func (*StrReplaceTool) Name ¶
func (t *StrReplaceTool) Name() string
func (*StrReplaceTool) Run ¶
func (t *StrReplaceTool) Run(args map[string]string) (string, *FileChange, error)
type Tool ¶
type Tool interface {
// Name はツール名を返す
Name() string
// Run はツールを実行
// output: ツールの実行結果
// change: ファイル変更情報(変更がない場合はnil)
// err: エラー(エラーがない場合はnil)
Run(args map[string]string) (output string, change *FileChange, err error)
}
Tool はツールの共通インターフェース
type WebSearchTool ¶
type WebSearchTool struct{}
===== Web Search Tool =====
func (*WebSearchTool) Name ¶
func (t *WebSearchTool) Name() string
func (*WebSearchTool) Run ¶
func (t *WebSearchTool) Run(args map[string]string) (string, *FileChange, error)
type WriteFileTool ¶
type WriteFileTool struct{}
===== Write File Tool =====
func (*WriteFileTool) Name ¶
func (t *WriteFileTool) Name() string
func (*WriteFileTool) Run ¶
func (t *WriteFileTool) Run(args map[string]string) (string, *FileChange, error)
Source Files
¶
- append_file.go
- bash.go
- builtin.go
- common.go
- copy_file.go
- create_dir.go
- delete_file.go
- delete_lines.go
- execute.go
- format.go
- git_add.go
- git_branch.go
- git_checkout.go
- git_commit.go
- git_diff.go
- git_log.go
- git_push.go
- git_stash.go
- git_status.go
- insert_after.go
- insert_before.go
- lint.go
- list_dir.go
- move_file.go
- prepend_file.go
- read_file.go
- registry.go
- search_code.go
- search_file.go
- str_replace.go
- test.go
- test_helpers.go
- types.go
- validation.go
- web_search.go
- write_file.go