This project generates package files for Espanso from individual YAML prompt files. It uses Jinja2 templates to format the prompts into a package.yml file and creates a _manifest.yml file with the version from the VERSION file.
- Python 3.6 or higher
- Git (optional, for cloning the repository)
Follow these steps to set up and use the prompt expander:
git clone git@github.com:mmarschall/prompt-expander.git
cd prompt-expander
Create a Python virtual environment to isolate the project dependencies:
python -m venv venv
source venv/bin/activate
Install the required Python packages:
pip install pyyaml jinja2
Create YAML files in the prompts
directory with the following structure:
trigger: ":shortcut"
replace: |
Your prompt text here
Can be multiple lines
label: "Optional label for the prompt"
source: "Optional source URL"
author: "Optional author name"
Example (prompts/rtf.yml
):
trigger: ":rtf"
replace: |
Role: $|$
Task:
Format:
label: "Role - Task - Format"
source: "https://www.linkedin.com/posts/jeremygrandillon_5-chatgpt-prompt-frameworks-that-make-your-activity-7301956962898837504-NR_i"
author: ""
Use the prompter
CLI tool to generate the package files:
# Make sure the virtual environment is activated
source venv/bin/activate
# Run the script
./prompter deploy
This will:
- Read the version number from the
VERSION
file - Read all YAML files from the
prompts
directory - Process them using the Jinja2 templates:
src/espanso-hub/package.yml.j2
for the package.yml filesrc/espanso-hub/_manifest.yml.j2
for the _manifest.yml file (using the version from the VERSION file)src/textexpander/llm-prompts.csv.j2
for the TextExpander CSV file
- Generate the final files:
- Espanso files at
deploy/espanso-hub/packages/llm-prompts/<version>/
(where<version>
is the content of the VERSION file) - TextExpander CSV file at
deploy/textexpander/llm-prompts.csv
- Espanso files at
The project includes a command-line tool called prompter
that provides various commands for managing and deploying prompt packages:
./prompter [command] [subcommand] [options]
Available commands:
-
Deploy commands:
./prompter deploy # Deploy to both platforms ./prompter deploy -c # Deploy to both platforms, cleaning first ./prompter deploy espanso # Deploy only to Espanso ./prompter deploy textexpander # Deploy only to TextExpander
-
Clean commands:
./prompter clean # Clean all platforms ./prompter clean espanso # Clean ALL Espanso versions ./prompter clean espanso -v 0.1.0 # Clean specific Espanso version ./prompter clean textexpander # Clean TextExpander
-
Version commands:
./prompter version # Display current version ./prompter version 1.2.0 # Set version to 1.2.0 ./prompter -v # Display current version
-
Help command:
./prompter help # Display help information
For more information, run ./prompter help
.
prompts/
: Directory containing individual prompt YAML filessrc/espanso-hub/package.yml.j2
: Jinja2 template for the package.yml filesrc/espanso-hub/_manifest.yml.j2
: Jinja2 template for the _manifest.yml filesrc/textexpander/llm-prompts.csv.j2
: Jinja2 template for the TextExpander CSV fileprompter
: CLI tool for deploying prompt packagessrc/deploy.py
: Python script used by the CLI toolVERSION
: Contains the current version numberdeploy/espanso-hub/packages/llm-prompts/<version>/
: Output directory for Espanso files containing:package.yml
: Generated package file_manifest.yml
: Generated manifest file with version from VERSION fileREADME.md
: Copied README file
deploy/textexpander/llm-prompts.csv
: Generated CSV file for TextExpander
In addition to Espanso, this project also generates a CSV file that can be imported into TextExpander. Here's how to import the CSV file:
-
Run the deploy script to generate the CSV file:
./prompter deploy textexpander
-
Open TextExpander on your computer.
-
Go to File > Import > Snippets...
-
Select "Tab-delimited text or CSV file" from the import options.
-
Navigate to the
deploy/textexpander/llm-prompts.csv
file and select it. -
In the import dialog:
- Make sure the columns are correctly mapped:
- First column: Abbreviation
- Second column: Content
- Third column: Label
- Choose whether to import into an existing group or create a new group.
- Click "Import" to complete the process.
- Make sure the columns are correctly mapped:
-
Your prompts are now available in TextExpander. You can use them by typing the trigger text (e.g.,
:pirate
) and TextExpander will replace it with the corresponding prompt.
This project generates an Espanso package that can be installed directly from the Espanso Hub. Here's how to install and use the package:
-
Make sure you have Espanso installed on your system.
-
Install the package using the Espanso CLI:
espanso install llm-prompts
Alternatively, if you've generated the package locally:
# First, generate the package files ./prompter deploy espanso # Then, install the package from the local directory espanso package install --path deploy/espanso-hub/packages/llm-prompts/0.1.0/
Once installed, you can use the prompts in two ways:
- Type
:prompt
to open a search menu with all available prompts - Use the specific trigger for each prompt directly (e.g.,
:rtf
,:bab
,:pirate
)
After inserting a prompt template, fill in the details as needed. The cursor will be positioned at the first input field.
The package includes various prompt templates for different purposes:
- Simple prompts like
:pirate
- Structured frameworks like Role-Task-Format (
:rtf
), Before-After-Bridge (:bab
), and Situation-Complication-Question-Answer (:scqa
) - Special purpose prompts for goal setting (
:goals
), abundance mindset (:abundance
), and startup evaluation (:startup
)
For a complete list of available prompts and their descriptions, refer to the YAML files in the prompts
directory.