Custom prompts: passing arguments ($1..$9, $ARGUMENTS) + @ file picker + frontmatter hints (#3565)

Key features
- Custom prompts accept arguments: $1..$9, $ARGUMENTS, and $$ (literal)
- @ file picker in composer: type @ to fuzzy‑search and insert quoted
paths
- Frontmatter hints: optional description + argument-hint shown in
palette (body stripped before send)

Why
- Make saved prompts reusable with runtime parameters.
- Improve discoverability with concise, helpful hints in the slash
popup.
- Preserve privacy and approvals; no auto‑execution added.

Details
- Protocol: extend CustomPrompt with description, argument_hint
(optional).
- Core: parse minimal YAML‑style frontmatter at file top; strip it from
the submitted body.
- TUI: expand arguments; insert @ paths; render
description/argument-hint or fallback excerpt.
- Docs: prompts.md updated with frontmatter and argument examples.

Tests
- Frontmatter parsing (description/argument-hint extracted; body
stripped).
- Popup rows show description + argument-hint; excerpt fallback; builtin
name collision.
- Argument expansion for $1..$9, $ARGUMENTS, $$; quoted args and @ path
insertion.

Safety / Approvals
- No changes to approvals or sandboxing; prompts do not auto‑run tools.

Related
- Closes #2890
- Related #3265
- Complements #3403
This commit is contained in:
Evan David
2025-09-24 21:23:38 -07:00
committed by GitHub
parent e85742635f
commit f7da902be3
5 changed files with 660 additions and 16 deletions
+6
View File
@@ -8,4 +8,10 @@ pub struct CustomPrompt {
pub name: String,
pub path: PathBuf,
pub content: String,
// Optional short description shown in the slash popup, typically provided
// via frontmatter in the prompt file.
pub description: Option<String>,
// Optional argument hint (e.g., "[file] [flags]") shown alongside the
// description in the popup when available.
pub argument_hint: Option<String>,
}