danielmiessler / fabric

fabric is an open-source framework for augmenting humans using AI. It provides a modular framework for solving specific problems using a crowdsourced set of AI prompts that can be used anywhere.
https://danielmiessler.com/p/fabric-origin-story
MIT License
22.95k stars 2.42k forks source link

[Question]: Did something change with fabric-bootstrap.inc with the migration to go version? #989

Open renatocan opened 2 hours ago

renatocan commented 2 hours ago

What is your question?

Before the migration to golang, there was a script to create aliases to the patterns that was automatically included to .bashrc and .zshrc, if I'm not wrong (fabric-bootstrap.inc). In the current version, I couldn't find this script.

Is there some easy way to create aliases to the patterns in the current version?

Thanks!

Renato.

snafu4 commented 2 hours ago

This will only work with linux/WSL. Create a file and execute the following:

#!/bin/bash

# Directory containing the subfolders
PATTERNS_DIR="$HOME/.config/fabric/patterns"

# Check if the directory exists
if [ ! -d "$PATTERNS_DIR" ]; then
    echo "Directory $PATTERNS_DIR does not exist."
    exit 1
fi

# Loop over each subdirectory and create an alias
for subdir in "$PATTERNS_DIR"/*/; do
    # Get the subdirectory name without the full path
    subdir_name=$(basename "$subdir")

    # Create the alias in the format 'alias <subdir_name>=fabric -p <subdir_name>'
    echo "alias $subdir_name='fabric -p $subdir_name'"
done

you can then run:

echo 'what is your name' | raw_query

instead of

echo 'what is your name' | fabric -p raw_query