MCPcopy Create free account
hub / github.com/astercloud/aster / createBackup

Method createBackup

pkg/tools/builtin/edit.go:315–325  ·  view source on GitHub ↗

createBackup 创建文件备份

(ctx context.Context, filePath, content string, tc *tools.ToolContext)

Source from the content-addressed store, hash-verified

313
314// createBackup 创建文件备份
315func (t *EditTool) createBackup(ctx context.Context, filePath, content string, tc *tools.ToolContext) string {
316 timestamp := time.Now().Format("20060102_150405")
317 backupPath := filePath + ".backup_" + timestamp
318
319 err := tc.Sandbox.FS().Write(ctx, backupPath, content)
320 if err != nil {
321 return ""
322 }
323
324 return backupPath
325}
326
327func (t *EditTool) Prompt() string {
328 return `对文件进行精确的字符串替换编辑。

Callers 1

ExecuteMethod · 0.95

Calls 2

WriteMethod · 0.65
FSMethod · 0.65

Tested by

no test coverage detected