diff options
| author | Kujtim Hoxha <[email protected]> | 2025-04-17 00:00:19 +0200 |
|---|---|---|
| committer | Kujtim Hoxha <[email protected]> | 2025-04-21 13:42:02 +0200 |
| commit | 36172979b45facc8ccec6861f124193eaebc42e9 (patch) | |
| tree | 41f7683c53bd1aaa550a7ec22e027e98c29e5d4e /internal/tui/components | |
| parent | cc07f7a186995f428436bc1adc66a264a95171a4 (diff) | |
| download | opencode-36172979b45facc8ccec6861f124193eaebc42e9.tar.gz opencode-36172979b45facc8ccec6861f124193eaebc42e9.zip | |
Update agent prompt, improve TUI patch UI, remove obsolete tool tests
- Replace and expand agent coder prompt for clarity and safety
- Add patch tool and TUI dialog support for patch diffs
- Sort sidebar modified files by name
- Remove Bash/Edit/Sourcegraph/Write tool tests
🤖 Generated with opencode
Co-Authored-By: opencode <[email protected]>
Diffstat (limited to 'internal/tui/components')
| -rw-r--r-- | internal/tui/components/chat/sidebar.go | 12 | ||||
| -rw-r--r-- | internal/tui/components/dialog/permission.go | 14 |
2 files changed, 25 insertions, 1 deletions
diff --git a/internal/tui/components/chat/sidebar.go b/internal/tui/components/chat/sidebar.go index 54b39f4a1..fe2845a08 100644 --- a/internal/tui/components/chat/sidebar.go +++ b/internal/tui/components/chat/sidebar.go @@ -3,6 +3,7 @@ package chat import ( "context" "fmt" + "sort" "strings" tea "github.com/charmbracelet/bubbletea" @@ -141,8 +142,17 @@ func (m *sidebarCmp) modifiedFiles() string { ) } + // Sort file paths alphabetically for consistent ordering + var paths []string + for path := range m.modFiles { + paths = append(paths, path) + } + sort.Strings(paths) + + // Create views for each file in sorted order var fileViews []string - for path, stats := range m.modFiles { + for _, path := range paths { + stats := m.modFiles[path] fileViews = append(fileViews, m.modifiedFile(path, stats.additions, stats.removals)) } diff --git a/internal/tui/components/dialog/permission.go b/internal/tui/components/dialog/permission.go index 200a7970d..295884432 100644 --- a/internal/tui/components/dialog/permission.go +++ b/internal/tui/components/dialog/permission.go @@ -266,6 +266,18 @@ func (p *permissionDialogCmp) renderEditContent() string { return "" } +func (p *permissionDialogCmp) renderPatchContent() string { + if pr, ok := p.permission.Params.(tools.PatchPermissionsParams); ok { + diff := p.GetOrSetDiff(p.permission.ID, func() (string, error) { + return diff.FormatDiff(pr.Diff, diff.WithTotalWidth(p.contentViewPort.Width)) + }) + + p.contentViewPort.SetContent(diff) + return p.styleViewport() + } + return "" +} + func (p *permissionDialogCmp) renderWriteContent() string { if pr, ok := p.permission.Params.(tools.WritePermissionsParams); ok { // Use the cache for diff rendering @@ -350,6 +362,8 @@ func (p *permissionDialogCmp) render() string { contentFinal = p.renderBashContent() case tools.EditToolName: contentFinal = p.renderEditContent() + case tools.PatchToolName: + contentFinal = p.renderPatchContent() case tools.WriteToolName: contentFinal = p.renderWriteContent() case tools.FetchToolName: |
