Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65021e1fe2 |
No files matched your search
@@ -5,7 +5,9 @@ import (
|
|||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/sausheong/harness/tool"
|
"github.com/sausheong/harness/tool"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -61,6 +63,9 @@ func (t *EditFileTool) Execute(_ context.Context, input json.RawMessage) (tool.T
|
|||||||
}
|
}
|
||||||
|
|
||||||
in.Path = tool.ExpandHome(in.Path)
|
in.Path = tool.ExpandHome(in.Path)
|
||||||
|
if t.WorkDir != "" && !filepath.IsAbs(in.Path) {
|
||||||
|
in.Path = filepath.Join(t.WorkDir, in.Path)
|
||||||
|
}
|
||||||
in.Path = tool.ResolveExistingPath(in.Path)
|
in.Path = tool.ResolveExistingPath(in.Path)
|
||||||
|
|
||||||
if t.WorkDir != "" {
|
if t.WorkDir != "" {
|
||||||
|
|||||||
@@ -82,6 +82,9 @@ func (t *ReadFileTool) Execute(_ context.Context, input json.RawMessage) (tool.T
|
|||||||
}
|
}
|
||||||
|
|
||||||
in.Path = tool.ExpandHome(in.Path)
|
in.Path = tool.ExpandHome(in.Path)
|
||||||
|
if t.WorkDir != "" && !filepath.IsAbs(in.Path) {
|
||||||
|
in.Path = filepath.Join(t.WorkDir, in.Path)
|
||||||
|
}
|
||||||
in.Path = tool.ResolveExistingPath(in.Path)
|
in.Path = tool.ResolveExistingPath(in.Path)
|
||||||
|
|
||||||
if t.WorkDir != "" {
|
if t.WorkDir != "" {
|
||||||
|
|||||||
@@ -56,6 +56,9 @@ func (t *WriteFileTool) Execute(_ context.Context, input json.RawMessage) (tool.
|
|||||||
}
|
}
|
||||||
|
|
||||||
in.Path = tool.ExpandHome(in.Path)
|
in.Path = tool.ExpandHome(in.Path)
|
||||||
|
if t.WorkDir != "" && !filepath.IsAbs(in.Path) {
|
||||||
|
in.Path = filepath.Join(t.WorkDir, in.Path)
|
||||||
|
}
|
||||||
|
|
||||||
if t.WorkDir != "" {
|
if t.WorkDir != "" {
|
||||||
if err := tool.ValidatePathInWorkDir(in.Path, t.WorkDir); err != nil {
|
if err := tool.ValidatePathInWorkDir(in.Path, t.WorkDir); err != nil {
|
||||||
|
|||||||
Reference in new issue
Block a user