Documentation
¶
Overview ¶
Package file provides file ops tool calls
Index ¶
- func AppendEditContext(path string, startLine, endLine, oldReplaced, newLineCount int) string
- func AppendWriteFileContext(path string) string
- func DisplayPath(ctx context.Context, path string) string
- func ExpandFilePattern(pattern string) ([]string, error)
- func ParseLineRange(args ToolArgs) (int, int, error)
- func ResolvePath(ctx context.Context, path string) string
- type SearchConfig
- type ToolArgs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendEditContext ¶
AppendEditContext 生成行范围编辑后的上下文窗口。
startLine/endLine 是原编辑范围的 1-based 包含行号; oldReplaced 是被替换的原始行数(endLine - startLine + 1); newLineCount 是替换后的新行数。
参考 ds4 agent_edit_result_append_context 的设计:
- 编辑前 5 行 + 编辑后 8 行非对称窗口(下游更重要)
- 编辑块 ≤36 行全量显示,>36 行首尾各 18 行截断
- 行偏移警告(行数变化时)
func DisplayPath ¶ added in v0.8.6
DisplayPath 返回适合显示的文件路径(相对于项目根目录)。 如果 path 在项目根目录下,返回相对路径;否则返回原始 path。 projectRoot 为空时也返回原始 path。
func ExpandFilePattern ¶
ExpandFilePattern 扩展文件模式
Types ¶
type SearchConfig ¶
type SearchConfig struct {
MaxDepth int // 最大递归深度
ExcludeDirs []string // 排除目录列表
ExcludePatterns []string // 排除模式列表
}
SearchConfig 搜索配置
Click to show internal directories.
Click to hide internal directories.