Introduce prompt override script and adjust names (#16094)

This PR introduces a new script for iterative development of prompt
overrides in Zed.

Just `script/prompts link` and your running Zed should start using
prompts from `zed/assets/prompts`. Use `script/prompts unlink` to undo.
You can also link with `script/prompts link --worktree` to store the
prompts to a `../zed_prompts` worktree that's a sibling of your repo, in
case you don't want to mess with your working copy. Just don't forget
about it!

Key changes:
- Add new `script/prompts` for managing prompt overrides
- Rename `prompt_templates_dir` to `prompt_overrides_dir` for clarity
- Update paths to use `~/.config/zed/prompt_overrides` instead of
`~/.config/zed/prompts/templates`
- Adjust `PromptBuilder` to use the new `prompt_overrides_dir` function

These changes simplify the process of customizing prompts and provide a
more intuitive naming convention for override-related functionality.

Release Notes:

- N/A
This commit is contained in:
Nathan Sobo 2024-08-11 17:21:17 -06:00 committed by GitHub
parent 10937c6e37
commit 355aebd0e4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 61 additions and 4 deletions

View file

@ -187,13 +187,13 @@ pub fn prompts_dir() -> &'static PathBuf {
/// Returns the path to the prompt templates directory.
///
/// This is where the prompt templates for core features can be overridden with templates.
pub fn prompt_templates_dir() -> &'static PathBuf {
pub fn prompt_overrides_dir() -> &'static PathBuf {
static PROMPT_TEMPLATES_DIR: OnceLock<PathBuf> = OnceLock::new();
PROMPT_TEMPLATES_DIR.get_or_init(|| {
if cfg!(target_os = "macos") {
config_dir().join("prompts").join("templates")
config_dir().join("prompt_overrides")
} else {
support_dir().join("prompts").join("templates")
support_dir().join("prompt_overrides")
}
})
}