Supporting/integrating project-specific prompts #1969
3ZsForInsomnia
started this conversation in
Ideas
Replies: 1 comment 5 replies
-
|
I can't say I've ever seen what VS Code chatmode looks like. So if you can share what you're working with or the structure, that would be great. We could Tree-sitter to parse the file and add it to the prompt library list or simply have a slash command to add it to the chat buffer. |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Like many CodeCompanion users, I write software for a living. And like a lot of teams probably are doing these days, my team and I want to be able to share prompts easily. I am not sure if this is something that CodeCompanion itself should have support for, and I am 100% fine with creating a solution within my own dotfiles. If the latter, I would like some input on a hopefully more-optimal-than-naive solution for doing so.
As an example, right now my team has a PR up for a file to support VS Code's chat mode, in
.github/chatmodes/golang.chatmode.md. There are some potentially VSC/MCP server specific things in this file (we have a list of tools in ours,tools: ['codebase', 'usages', 'vscodeAPI', 'problems', 'changes', ...etc, along with adescription), but the rest of the file is a prompt that I figure I could make available for myself in CodeCompanion. I also figure the description and tools list could be converted into a format I could use in a prompt for CodeCompanion.I figure there are a few ways I could do this without anything depending on functionality or behavior within CodeCompanion, and a couple ways that might well depend on behavior in CodeCompanion.
Approaches
First Option, the simplest
I could simply copy/paste the prompt and add the tools manually in a string in my config.
This is not ideal as any changes to prompts or new prompts must be handled manually. Not terrible, but it would absolutely work as expected.
Second option, more automatic
I add code to detect matching
*.mdfiles within.githubto myconfigfunction for the CodeCompanion plugin, extract thepromptsection, and add that to my config.This is pretty doable, and avoids the manual-ness of the first option. Converting the prompting format from VSC's to CodeCompanions is trivial with a little Lua code.
However I figure there are ~3 ways to handle updating and loading the config from there:
First
I could run this search + conversion on plugin load, using the
configfunction in Lazy.Second
I could let the plugin load normally, and then grab the config as it currently is using
require("codecompanion.config"), add the converted VSC prompts to the custom prompts in the config object, and callsetupagain with the result. It appears I get an error about using a config that containsconstantswhen I try this locally, however if I just set that to nil before callingsetupagain, it seems fine.I could also use project config setups like exrc, neoconf, etc to help support this.
The one issue I see is, I am not aware of potential issues with calling
setupa second time after the plugin loads, but that doesn't mean side effects don't exist. This might be fine, it seems fine, for now at least.Third
If there was a command to add a prompt to the currently available custom prompts, that could also work. That would feel like a more "officially supported" way to add prompts from a specific project than patching the config object and re-calling
setup. This could also totally sidestep concerns over callingsetupa second time.Fourth
I am sure there are other ways to do this that I haven't thought of or am not aware of yet! I tried searching the docs, issues and other discussions for information on how to approach repo-specific prompts, but didn't see anything - but obviously, that doesn't mean it isn't there or that others haven't solved this problem already.
Beta Was this translation helpful? Give feedback.
All reactions