Skip to content

feat: custom commands #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

ezynda3
Copy link

@ezynda3 ezynda3 commented May 1, 2025

Users can create custom commands by adding .md files to their configured <data_dir>/commands dir (default is .opencode/commands). They can then open the command dialog as normal with cttrl+k and select one of the custom commands.

Custom commands are simply prompts and work similar to custom slash commands in Claude Code
ref: https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/tutorials#create-custom-slash-commands

Addresses: #132

@ezynda3 ezynda3 changed the title Implement custom commands feat: custom commands May 1, 2025
@@ -56,6 +57,12 @@ func (p *chatPage) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
if cmd != nil {
return p, cmd
}
case dialog.CommandRunCustomMsg:
// Handle custom command execution
cmd := p.sendMessage(msg.Content)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to check if the agent is busy here before we send the message.
p.app.CoderAgent.IsBusy()

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's busy what should the behavior be?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess just returning a warning should be fine right?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you already did what I wanted to suggest 😂 awesome.

@kujtimiihoxha
Copy link
Collaborator

@ezynda3 do you mind adding a section for this in the readme?

@ezynda3
Copy link
Author

ezynda3 commented May 2, 2025

@ezynda3 do you mind adding a section for this in the readme?

Done!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants