COMMANDS.md

 1# Custom Commands in Crush
 2
 3Crush supports custom commands (sometimes called saved prompts) that can be
 4created by users to quickly send predefined prompts to the AI assistant.
 5
 6## Creating Custom Commands
 7
 8Custom commands are predefined prompts stored as Markdown files in one of three
 9locations:
10
111. User Commands:
12
13   ```bash
14   # Unix-like systems (Linux, macOS, FreeBSD, etc.)
15   $XDG_CONFIG_HOME/crush/commands/
16
17   # Windows
18   %USERPROFILE%\AppData\Local\crush\commands\
19   ```
20
212. Project Commands:
22
23   ```bash
24   <PROJECT DIR>/.crush/commands/
25   ```
26
27Each Markdown file in these directories becomes a custom command. The file name
28(without the extension) becomes the name of the command.
29
30For example, creating a file at `~/.config/crush/commands/carrot-cake.md` with
31the following content:
32
33```markdown
34RUN git ls-files
35READ README.md
36```
37
38...creates a command called `user:carrot-cake`.
39
40### Command Arguments
41
42Crush supports named arguments in custom commands using placeholders in the
43format `$NAME` (where NAME consists of uppercase letters, numbers, and
44underscores, and must start with a letter).
45
46For example:
47
48```markdown
49# Fetch Context for Issue $ISSUE_NUMBER
50
51RUN gh issue view $ISSUE_NUMBER --json title,body,comments
52RUN git grep --author="$AUTHOR_NAME" -n .
53RUN grep -R "$SEARCH_PATTERN" $DIRECTORY
54```
55
56When you run a command with arguments, crush will prompt you to enter values
57for each unique placeholder.
58
59### Organizing Commands
60
61Commands can be organized into sub-directories:
62
63```
64~/.config/crush/commands/git/commit.md
65```
66
67This creates a command with ID `user:git:commit`.
68
69### Using Custom Commands
70
711. Press <kbd>Ctrl+p</kbd> to open the command dialog
722. Press <kbd>Tab</kbd> to switch to User Commands
733. Select your custom command
74
75---
76
77Part of [Charm](https://charm.land).
78
79<a href="https://charm.land/"><img alt="The Charm logo" width="400" src="https://stuff.charm.sh/charm-banner-next.jpg" /></a>
80
81<!--prettier-ignore-->
82Charm็ƒญ็ˆฑๅผ€ๆบ โ€ข Charm loves open source