feat(tools/file): write_file atomic + 0600

This commit is contained in:
sausheong committed 2026-06-13 00:50:46 +08:00
1 parent c4750347e6
commit 7ae944f0eb
2 files changed
+27 -1

No files matched your search

+1 -1
View File
@@ -72,7 +72,7 @@ func (t *WriteFileTool) Execute(_ context.Context, input json.RawMessage) (tool.
return tool.ToolResult{Error: fmt.Sprintf("failed to create directory: %v", err)}, nil
}
if err := os.WriteFile(in.Path, []byte(in.Content), 0o644); err != nil {
if err := tool.WriteFileAtomic(in.Path, []byte(in.Content), 0o600); err != nil {
return tool.ToolResult{Error: fmt.Sprintf("failed to write file: %v", err)}, nil
}