Add refactor slash command
What does this MR do and why?
Add refactor slash command
Adds the ability to send selected code and the /refactor
slash command
as input to directly use the RefactorCode tool.
Issue: #431576 (closed)
Screenshots or screen recordings
Before | After |
---|---|
How to set up and validate locally
Feature.enable(:slash_commands)
- In one browser tab open Duo Chat UI, in second tab open graphql-explorer
- Send the following request from graphql explorer and check the result in Duo Chat UI:
mutation {
aiAction(input: {chat: {content: "/refactor", currentFile: {
selectedText: "\n@sold_items = %w( onions garlic potatoes ) \ndef print_report\nputs '*** Sales Report for #{Time.new.strftime('%d/%m/%Y')} ***'\n@sold_items.each { |i| puts i }\nputs '*** End of Sales Report ***'\nend",
fileName: "hello.rb"
}}}) {
clientMutationId
errors
}
}
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Nicolas Dular