summaryrefslogtreecommitdiffhomepage
path: root/internal/tui/page
diff options
context:
space:
mode:
authorEd Zynda <[email protected]>2025-05-09 17:33:35 +0300
committeradamdottv <[email protected]>2025-05-12 09:58:59 -0500
commit1f8580553c95e46bd478550f0a4fe17a2d039ddc (patch)
tree5c50da0644b2c64ebf467d6d7efca60b972c7ba2 /internal/tui/page
parentf92b2b76dc0836b8ad9f4a47a16941efdb2accf6 (diff)
downloadopencode-1f8580553c95e46bd478550f0a4fe17a2d039ddc.tar.gz
opencode-1f8580553c95e46bd478550f0a4fe17a2d039ddc.zip
feat: custom commands (#133)
* Implement custom commands * Add User: prefix * Reuse var * Check if the agent is busy and if so report a warning * Update README * fix typo * Implement user and project scoped custom commands * Allow for $ARGUMENTS * UI tweaks * Update internal/tui/components/dialog/arguments.go Co-authored-by: Kujtim Hoxha <[email protected]> * Also search in $HOME/.opencode/commands --------- Co-authored-by: Kujtim Hoxha <[email protected]>
Diffstat (limited to 'internal/tui/page')
-rw-r--r--internal/tui/page/chat.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/internal/tui/page/chat.go b/internal/tui/page/chat.go
index 378575f4d..14c514278 100644
--- a/internal/tui/page/chat.go
+++ b/internal/tui/page/chat.go
@@ -11,6 +11,7 @@ import (
"github.com/opencode-ai/opencode/internal/session"
"github.com/opencode-ai/opencode/internal/status"
"github.com/opencode-ai/opencode/internal/tui/components/chat"
+ "github.com/opencode-ai/opencode/internal/tui/components/dialog"
"github.com/opencode-ai/opencode/internal/tui/layout"
"github.com/opencode-ai/opencode/internal/tui/util"
)
@@ -64,6 +65,16 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if cmd != nil {
return p, cmd
}
+ case dialog.CommandRunCustomMsg:
+ // Check if the agent is busy before executing custom commands
+ if p.app.CoderAgent.IsBusy() {
+ return p, util.ReportWarn("Agent is busy, please wait before executing a command...")
+ }
+ // Handle custom command execution
+ cmd := p.sendMessage(msg.Content)
+ if cmd != nil {
+ return p, cmd
+ }
case chat.SessionSelectedMsg:
if p.session.ID == "" {
cmd := p.setSidebar()