-
Notifications
You must be signed in to change notification settings - Fork 7
Add pre-hook and post-hook support #69
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
base: main
Are you sure you want to change the base?
Conversation
This feature allows users to run configurable shell commands before and after LLM queries, enabling dynamic context generation workflows. Key features: - Pre-hooks execute before LLM queries - Stdout automatically captured to temp files when add_to_context = true - Temp files automatically added to context - Post-hooks execute after LLM response completes - Automatic cleanup of temp files (no manual file management) - Support for multiple pre-hooks and post-hooks Example use case: Integrate context-vacuum for dynamic project context generation without manual file creation/deletion. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
- Clarify automatic temp file management with vim.fn.tempname() - Emphasize zero manual file path management - Add debugging section with :Lazy sync reminder - Update examples to use realistic commands and modern model names - Add installation instructions for the pre-hook branch - Remove outdated/unimplemented advanced patterns - Simplify examples based on real-world usage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
The implementation is simple enough that the example config and inline comments are sufficient. No need for extensive markdown docs. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Pre-hooks and post-hooks are simple enough that an example config file is unnecessary. Users can see the schema in the type definitions. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
Sounds like a super interesting addition, lmk it is ready for a review |
Only create temp files and add to context when pre-hook stdout has non-whitespace content. Prevents empty files from cluttering the context when hooks produce no output. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
|
@mozanunal this is ready for review and I've updated the README since this is an addition to the existing config interface. This has been somewhat useful for me. No pressure though; I totally understand if you'd rather not grow the API like this. |
mozanunal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much for contributing to the sllm.nvim tool. This looks good, only concern is the implementation, I think we can do it similarly how we are adding the command outputs to the context (or any other ones except the file (fragment) additions). The issue is the tempfiles, we don't need them. Please raise if you have any concerns. If you have the availability, please go ahead with the changes otherwise I can takeover the PR. I really like the idea ⭐
|
I have enabled the CI runs, please check the CI error as well! |
|
Now I have sometime to work on the changes I described, let me do that @brojonat |
This feature allows users to run configurable shell commands before and after every LLM query. It is similar to the existing shell command functionality, but runs an arbitrary number of commands automatically. I'm not sure this is necessarily a "good" change to the API, but it's something I'm experimenting with.
Key features:
Example use case: Integrate
github.com/brojonat/context-vacuumfor dynamic project context generation without manual file creation/deletion.