file

package
v0.7.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package file provides file ops tool calls

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExpandFilePattern

func ExpandFilePattern(pattern string) ([]string, error)

ExpandFilePattern 扩展文件模式

func JSONString

func JSONString(matches []GrepMatch) string

func ParseLineRange

func ParseLineRange(args ToolArgs) (int, int, error)

ParseLineRange parse line range

func ResolvePath

func ResolvePath(ctx context.Context, path string) string

ResolvePath 解析文件路径:如果是相对路径,则拼接项目根目录;否则直接使用

func RipgrepExists

func RipgrepExists() bool

Types

type GrepMatch

type GrepMatch struct {
	Content string `json:"content,omitzero"`

	// Path is the file path where the match was found.
	Path string `json:"path,omitzero"`

	// Line is the 1-based line number of the match.
	Line int `json:"line,omitzero"`
}

GrepMatch represents a single pattern match result.

func Ripgrep

func Ripgrep(ctx context.Context, pattern string, path string, glob string, fileType string, afterLines int64, beforeLines int64, caseInsensitive bool, enableMultiline bool) (matches []GrepMatch, err error)

type SearchConfig

type SearchConfig struct {
	MaxDepth        int      // 最大递归深度
	ExcludeDirs     []string // 排除目录列表
	ExcludePatterns []string // 排除模式列表
}

SearchConfig 搜索配置

type ToolArgs

type ToolArgs = toolcall.ToolArgs

Source Files

  • file.go
  • file_pattern_expand.go
  • file_read.go
  • file_read_with_line_range.go
  • file_ripgrep.go
  • file_search.go
  • file_search_with_pattern.go
  • file_write.go
  • file_write_with_line_range.go

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL