- Extend AvanteSlashCommandType to include "commit"
- Add new command entry for "commit" with description "Commit the changes"
- Implement callback function for "commit" command
- Update input container logic to handle "commit" command
- Set request to "Please commit the changes" when "commit" command is used
Hanchin Hsieh <me@yuchanns.xyz>
Added two new functions to support git operations:
- git_diff: Get git diff for generating commit message (both staged and unstaged changes)
- git_commit: Commit changes with commit message and optional signing
These functions also support:
- GPG signing if available and configured
- Automatic staging of files if scope is provided
- User confirmation before committing
- Signed-off-by line with git user info
Signed-off-by: Hanchin Hsieh <me@yuchanns.xyz>
This fixes a bunch of errors I was getting when switching away from the
avante sidebar and then back. Sometimes the sidebar would lose track of
the various windows, and you'd get errors like this:
```
|| stack traceback:
|| ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2350: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2349>
|| Error detected while processing BufLeave Autocommands for "<buffer=294>":
|| Error executing lua callback: ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: attempt to index field 'selected_files_container' (a nil value)
```
Or this one:
```
|| stack traceback:
|| ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2350: in function <...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2349>
|| Error detected while processing BufLeave Autocommands for "<buffer=294>":
|| Error executing lua callback: ...local/share/nvim/lazy/avante.nvim/lua/avante/sidebar.lua:2398: attempt to index field 'selected_files_container' (a nil value)
```
This change does the following:
1. Proper order of cleanup in `reset()`
2. Proper cleanup in `create_selected_files_container()`