### Python Wrapper: Setup and Installation Source: https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/Examples/README.md Steps to set up the directory structure and install a Python script as a Fabric extension executable. ```bash # Create directories mkdir -p ~/.config/fabric/extensions/{bin,configs} # Install script cp word-generator.py ~/.config/fabric/extensions/bin/ chmod +x ~/.config/fabric/extensions/bin/word-generator.py ``` -------------------------------- ### Run Fabric Setup Command Source: https://github.com/danielmiessler/fabric/blob/main/README.md Execute the Fabric setup command to initialize directories and keys. This is a crucial step after installation. ```bash # Run the setup to set up your directories and keys fabric --setup ``` -------------------------------- ### Clone and Setup Fabric Project Source: https://github.com/danielmiessler/fabric/blob/main/docs/CONTRIBUTING.md Clone your fork of the Fabric repository, build the executable, and run the initial setup command. Ensure you have Go 1.24+ and GitHub CLI installed. ```bash gh repo clone YOUR_GITHUB_USER/fabric cd fabric go build -o fabric ./cmd/fabric ./fabric --setup ``` -------------------------------- ### Start Svelte development server Source: https://github.com/danielmiessler/fabric/blob/main/web/STD-README.md Run this command after installing dependencies to start the development server. The `--open` flag automatically opens the application in a new browser tab. ```bash npm run dev ``` ```bash npm run dev -- --open ``` -------------------------------- ### Quick Setup for Shell Completions (Automated) Source: https://github.com/danielmiessler/fabric/blob/main/docs/Shell-Completions.md Installs Fabric shell completions automatically by downloading a setup script. Supports Zsh, Bash, and Fish. Use the `--dry-run` flag to preview changes. ```bash # No-clone install (Zsh/Bash/Fish supported) curl -fsSL https://raw.githubusercontent.com/danielmiessler/Fabric/refs/heads/main/completions/setup-completions.sh | sh ``` ```bash # Optional: dry-run first curl -fsSL https://raw.githubusercontent.com/danielmiessler/Fabric/refs/heads/main/completions/setup-completions.sh | sh -s -- --dry-run ``` ```bash # Optional: override the download source FABRIC_COMPLETIONS_BASE_URL="https://raw.githubusercontent.com/danielmiessler/Fabric/refs/heads/main/completions" \ sh -c "$(curl -fsSL https://raw.githubusercontent.com/danielmiessler/Fabric/refs/heads/main/completions/setup-completions.sh)" ``` -------------------------------- ### Install code2context Binary Source: https://github.com/danielmiessler/fabric/blob/main/data/patterns/create_coding_feature/README.md Install the `code2context` binary using go install. This is a prerequisite for using the create coding feature. ```bash go install github.com/danielmiessler/fabric/cmd/code2context@latest ``` -------------------------------- ### Install to_pdf helper command Source: https://github.com/danielmiessler/fabric/blob/main/web/src/routes/about/README.md Install the `to_pdf` helper command using `go install`. Ensure you have a LaTeX distribution installed and `pdflatex` in your system's PATH. ```bash go install github.com/danielmiessler/fabric/plugins/tools/to_pdf@latest ``` -------------------------------- ### Docker Setup for Fabric Source: https://github.com/danielmiessler/fabric/blob/main/docs/rest-api.md Commands to set up and run the Fabric server using Docker. This includes initial configuration and starting the server, with an option for API key authentication. ```bash # Setup (first time) mkdir -p $HOME/.fabric-config docker run --rm -it \ -v $HOME/.fabric-config:/root/.config/fabric \ kayvan/fabric:latest --setup ``` ```bash # Start server docker run --rm -it \ -p 8080:8080 \ -v $HOME/.fabric-config:/root/.config/fabric \ kayvan/fabric:latest --serve ``` ```bash # With authentication docker run --rm -it \ -p 8080:8080 \ -v $HOME/.fabric-config:/root/.config/fabric \ kayvan/fabric:latest --serve --api-key my_secret_key ``` -------------------------------- ### Install Fabric from Source with Go Source: https://github.com/danielmiessler/fabric/blob/main/README.md Install Fabric directly from its GitHub repository using the Go toolchain. Ensure Go is installed and configured. ```bash # Install Fabric directly from the repo go install github.com/danielmiessler/fabric/cmd/fabric@latest ``` -------------------------------- ### Fabric Setup and Model Selection Source: https://github.com/danielmiessler/fabric/blob/main/docs/DigitalOcean-Agents-Setup.md Run the fabric --setup command to initiate the setup process and select DigitalOcean as the vendor. Subsequently, use fabric --listmodels to discover available models and then specify a model for a task like summarization. ```bash fabric --setup ``` ```bash fabric --listmodels ``` ```bash fabric --vendor DigitalOcean --model --pattern summarize ``` -------------------------------- ### Setup Shell Completions from Cloned Repository Source: https://github.com/danielmiessler/fabric/blob/main/docs/Shell-Completions.md Installs Fabric shell completions using the provided script within a cloned repository. Includes a dry-run option to preview actions. ```bash # Run the automated setup script from a cloned repo ./completions/setup-completions.sh ``` ```bash # Or see what it would do first ./completions/setup-completions.sh --dry-run ``` -------------------------------- ### Install Changelog Generator Source: https://github.com/danielmiessler/fabric/blob/main/cmd/generate_changelog/README.md Install the changelog generator using the go install command. Ensure you have Go installed and configured. ```bash go install github.com/danielmiessler/fabric/cmd/generate_changelog@latest ``` -------------------------------- ### Install Fabric Go Version Source: https://github.com/danielmiessler/fabric/blob/main/web/src/routes/about/README.md Installs the latest version of the Fabric CLI written in Go using `go install`. ```bash # Install the Go version go install github.com/danielmiessler/fabric@latest ``` -------------------------------- ### Go Install Commands for Fabric AI Source: https://github.com/danielmiessler/fabric/blob/main/docs/Project-Restructured.md Use these commands to install the main fabric tool and additional utilities after the project restructuring. Ensure you have Go installed and configured. ```bash # Main fabric tool go install github.com/danielmiessler/fabric/cmd/fabric@latest ``` ```bash # Additional tools (if desired) go install github.com/danielmiessler/fabric/cmd/code_helper@latest ``` ```bash go install github.com/danielmiessler/fabric/cmd/to_pdf@latest ``` -------------------------------- ### Docker Start Script Source: https://github.com/danielmiessler/fabric/blob/main/docs/Project-Restructured.md A helper script to start the Docker Compose stack. ```bash start-docker.sh # Helper script to start docker-compose stack ``` -------------------------------- ### System-Wide Install with Sudo on Unix/Linux/macOS Source: https://github.com/danielmiessler/fabric/blob/main/scripts/installer/README.md Install Fabric system-wide to a specified directory using sudo on Unix-like systems. Requires appropriate permissions. ```bash curl -fsSL https://raw.githubusercontent.com/danielmiessler/fabric/main/scripts/installer/install.sh | sudo INSTALL_DIR=/usr/local/bin bash ``` -------------------------------- ### Install xclip on Debian/Ubuntu Source: https://github.com/danielmiessler/fabric/blob/main/README.md Installs the `xclip` utility on Debian-based systems like Ubuntu, which is used to paste content from the clipboard on Linux. ```sh sudo apt update sudo apt install xclip -y ``` -------------------------------- ### Quick Setup and Testing Source: https://github.com/danielmiessler/fabric/blob/main/docs/CONTRIBUTING.md Instructions for cloning the repository, building the project, and running tests. ```APIDOC ## Quick Setup ### Prerequisites - Go 1.24+ installed - Git configured with your details - GitHub CLI (`gh`) ### Getting Started ```bash # Clone your fork (upstream is set automatically) gh repo clone YOUR_GITHUB_USER/fabric cd fabric go build -o fabric ./cmd/fabric ./fabric --setup # Run tests go test ./... ``` ``` -------------------------------- ### Example: Create Hello World C Program Source: https://github.com/danielmiessler/fabric/blob/main/data/patterns/create_coding_feature/README.md Demonstrates creating a simple C program file. Ensure you are in the project root directory. ```bash code2context . "Create a simple Hello World C program in file main.c" | fabric --pattern create_coding_feature ``` -------------------------------- ### Raw HTTP GET Request with Basic Auth Source: https://github.com/danielmiessler/fabric/blob/main/data/patterns/write_nuclei_template_rule/system.md This example shows a raw GET request with a dynamic Basic Authentication header using a base64 helper function. ```yaml - raw: - | GET /manager/html HTTP/1.1 Host: {{Hostname}} Authorization: Basic {{base64(\'username:password\')}} ``` -------------------------------- ### Quick Start Template Usage Source: https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/README.md Demonstrates a basic template substitution on the command line. ```bash echo "Hello {{name}}!" | fabric -v=name:World ``` -------------------------------- ### Get Pattern Example Source: https://github.com/danielmiessler/fabric/blob/main/docs/rest-api.md Use this endpoint to retrieve the content of a specific AI pattern by its name. ```bash curl http://localhost:8080/patterns/summarize ``` -------------------------------- ### Example Workflow: Hello World Program Source: https://github.com/danielmiessler/fabric/blob/main/data/patterns/create_coding_feature/README.md A complete workflow example including requesting AI changes, reviewing with git diff, testing with make, and committing. ```bash # Request AI to create a Hello World program code2context . "Create a simple Hello World C program in file main.c" | fabric --pattern create_coding_feature # Review the changes made to your project git diff # Run/test the code make check # If satisfied, commit the changes git add git commit -s -m "Add Hello World program" ``` -------------------------------- ### Get Fabric Version Source: https://github.com/danielmiessler/fabric/blob/main/docs/SUPPORT.md Use this command to check the currently installed version of Fabric, which is useful for bug reports. ```bash fabric --version ``` -------------------------------- ### Period Operations with DateTime Plugin Source: https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/datetime.md Get the start and end dates for the current week and month using these convenient template tags. ```template Week Start: {{plugin:datetime:startofweek}} Week End: {{plugin:datetime:endofweek}} Month Start: {{plugin:datetime:startofmonth}} Month End: {{plugin:datetime:endofmonth}} ``` -------------------------------- ### Quick Start: Set up and Test Copilot Source: https://github.com/danielmiessler/fabric/blob/main/docs/Microsoft-365-Copilot-Setup.md A comprehensive set of commands to log in, obtain an access token, configure Fabric with your tenant and client IDs, and test Copilot integration. ```bash # 1. Set up Azure AD app registration (see guide above) # 2. Get access token az login --tenant YOUR_TENANT_ID ACCESS_TOKEN=$(az account get-access-token --resource https://graph.microsoft.com --query accessToken -o tsv) # 3. Configure Fabric fabric --setup # Select Copilot, enter tenant ID, client ID, and access token # 4. Test it echo "What meetings do I have this week?" | fabric --vendor Copilot ``` -------------------------------- ### Nested Date Formatting Example Source: https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/README.md Illustrates nesting plugins to first get the current time and then format it based on a dynamic format string. ```markdown {{plugin:datetime:{{format}}:{{plugin:datetime:now}}}} ``` -------------------------------- ### Run Summarize Pattern from Stdin Source: https://github.com/danielmiessler/fabric/blob/main/README.md Execute the 'summarize' pattern using input piped from stdin. This example uses pbpaste to get content from the clipboard. ```bash pbpaste | fabric --pattern summarize ``` -------------------------------- ### Display Fabric Help Information Source: https://github.com/danielmiessler/fabric/blob/main/README.md Run this command to see all available options and their descriptions. ```bash fabric -h ``` -------------------------------- ### Obtain Microsoft Graph Access Token Source: https://github.com/danielmiessler/fabric/blob/main/docs/Microsoft-365-Copilot-Setup.md Use this command to get a fresh access token for the Microsoft Graph API, required for authentication. Ensure you have the Azure CLI installed and are logged in. ```bash az account get-access-token --resource https://graph.microsoft.com --query accessToken -o tsv ``` -------------------------------- ### Fabric Copilot Configuration Input Source: https://github.com/danielmiessler/fabric/blob/main/docs/Microsoft-365-Copilot-Setup.md Example of interactive input required during Fabric setup for Copilot configuration. This includes Tenant ID, Client ID, optional Client Secret, Access Token, Refresh Token, and timezone. ```text [Copilot] Enter your Azure AD Tenant ID: > contoso.onmicrosoft.com [Copilot] Enter your Azure AD Application (Client) ID: > 12345678-1234-1234-1234-123456789abc [Copilot] Enter your Azure AD Client Secret (optional): > (press Enter to skip, or enter secret for token refresh) [Copilot] Enter a pre-obtained OAuth2 Access Token: > eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIs... [Copilot] Enter a pre-obtained OAuth2 Refresh Token (optional): > (press Enter to skip, or enter refresh token) [Copilot] Enter your timezone: > America/New_York ``` -------------------------------- ### Generate Project Starter Code Source: https://github.com/danielmiessler/fabric/blob/main/data/patterns/create_coding_project/README.md Use this command to generate starter code for a new project based on your idea. The output includes a project structure and placeholder files. ```bash echo "INSERT_YOUR_IDEA_HERE" | fabric -p create_coding_project ``` ```bash echo "I want to create a project that can generate shell scripts from yaml files then upload them to a Jamf Pro server via the Jamf Pro API." | fabric -p create_coding_project ``` -------------------------------- ### Migrate to Go Version of Fabric Source: https://github.com/danielmiessler/fabric/blob/main/README.md Instructions for migrating from the legacy Python version to the Go version of Fabric. This involves uninstalling the old version, clearing old aliases, installing the new version using Go, and running the setup command. ```bash # Uninstall Legacy Fabric pipx uninstall fabric # Clear any old Fabric aliases (check your .bashrc, .zshrc, etc.) # Install the Go version go install github.com/danielmiessler/fabric/cmd/fabric@latest # Run setup for the new version. Important because things have changed fabric --setup ``` -------------------------------- ### Windows Setup Script Source: https://github.com/danielmiessler/fabric/blob/main/docs/Project-Restructured.md A batch script for setting up Fabric on Windows. ```batch setup_fabric.bat # Windows setup script ``` -------------------------------- ### Test Changes by Running the Server Source: https://github.com/danielmiessler/fabric/blob/main/docs/CONTRIBUTING.md Start the server to verify that your endpoint appears in Swagger UI. Access the UI via the provided URL. ```bash go run ./cmd/fabric --serve # Open http://localhost:8080/swagger/index.html ``` -------------------------------- ### Install notify-send on Linux Source: https://github.com/danielmiessler/fabric/blob/main/docs/Desktop-Notifications.md Ensure `notify-send` is installed on Linux systems for desktop notifications. Installation commands vary by distribution. ```bash # Ubuntu/Debian sudo apt install libnotify-bin # Fedora sudo dnf install libnotify ``` -------------------------------- ### Reconfigure Fabric Backend Source: https://github.com/danielmiessler/fabric/blob/main/docs/Azure-AI-Gateway.md Run the setup command to reconfigure Fabric and select a different backend, such as Azure AI Gateway. ```bash # Reconfigure to use a different backend fabric --setup # Select: AzureAIGateway # Change Backend from bedrock to azure-openai ``` -------------------------------- ### Quick Test Without Full Setup Source: https://github.com/danielmiessler/fabric/blob/main/docs/GitHub-Models-Setup.md Temporarily set the GitHub API key for the current session to perform quick tests, such as listing available models. This is useful for immediate verification before a full setup. ```bash # Temporary test (this session only) export GITHUB_API_KEY=github_pat_YOUR_TOKEN_HERE # Test immediately fabric --listmodels --vendor GitHub ``` -------------------------------- ### Start Fabric Web Development Server Source: https://github.com/danielmiessler/fabric/blob/main/web/src/routes/about/README.md Navigate to the `web/` directory of the Fabric project and run the development server using npm or pnpm. Ensure Fabric is running in a separate terminal with `fabric --serve`. ```shell npm run dev ## or ## pnpm run dev ## or your equivalent ``` -------------------------------- ### Get Basic System Information Source: https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/sys.md Retrieve hostname, username, operating system, and architecture using system plugin variables. ```template Hostname: {{plugin:sys:hostname}} Username: {{plugin:sys:user}} Operating System: {{plugin:sys:os}} Architecture: {{plugin:sys:arch}} ``` -------------------------------- ### Install Web App Dependencies with pnpm Source: https://github.com/danielmiessler/fabric/blob/main/web/README.md Installs all necessary dependencies for the Svelte web application using pnpm, which is recommended for faster installation. Requires Node.js version 18 or higher. ```bash pnpm install ``` -------------------------------- ### Main Application Entrypoint Source: https://github.com/danielmiessler/fabric/blob/main/docs/Project-Restructured.md This is the main entrypoint for the primary application. ```go main.go # Main application entrypoint ``` -------------------------------- ### Display Help for Changelog Tool Source: https://github.com/danielmiessler/fabric/blob/main/docs/Automated-Changelog-Usage.md Run this command to view all available options and usage instructions for the changelog generation tool. This is useful for understanding the full capabilities and troubleshooting. ```bash ./generate_changelog --help ``` -------------------------------- ### Install Mdsvex Source: https://github.com/danielmiessler/fabric/blob/main/web/src/lib/content/posts/using-svelte-in-markdown.md Install Mdsvex as a development dependency in your SvelteKit project using npm. ```bash npm install -D mdsvex ``` -------------------------------- ### System Plugin Operations Source: https://github.com/danielmiessler/fabric/blob/main/internal/plugins/template/README.md Illustrates how to retrieve system information such as hostname, current user, OS, and environment variables using the System plugin. ```markdown {{plugin:sys:hostname}} -> server1 {{plugin:sys:user}} -> currentuser {{plugin:sys:os}} -> linux {{plugin:sys:env:HOME}} -> /home/user ``` -------------------------------- ### Manual Zsh Completion Installation Source: https://github.com/danielmiessler/fabric/blob/main/docs/Shell-Completions.md Manually installs Zsh completion files. Requires copying the completion file and potentially creating a symlink if Fabric was installed as `fabric-ai`. Reload completions using `compinit`. ```bash sudo cp completions/_fabric /usr/local/share/zsh/site-functions/ ``` ```bash sudo ln -s /usr/local/share/zsh/site-functions/_fabric /usr/local/share/zsh/site-functions/_fabric-ai ``` ```bash autoload -U compinit && compinit ``` -------------------------------- ### Manual Fish Completion Installation Source: https://github.com/danielmiessler/fabric/blob/main/docs/Shell-Completions.md Manually installs Fish shell completion files by copying the script to the appropriate directory. A symlink may be needed if Fabric is installed as `fabric-ai`. Fish automatically loads completions. ```bash mkdir -p ~/.config/fish/completions cp completions/fabric.fish ~/.config/fish/completions/ ``` ```bash ln -s ~/.config/fish/completions/fabric.fish ~/.config/fish/completions/fabric-ai.fish ``` -------------------------------- ### Install terminal-notifier on macOS Source: https://github.com/danielmiessler/fabric/blob/main/docs/Desktop-Notifications.md For enhanced notifications on macOS, install the `terminal-notifier` tool using Homebrew. ```bash brew install terminal-notifier ``` -------------------------------- ### Example Azure AI Gateway Configuration Source: https://github.com/danielmiessler/fabric/blob/main/docs/Azure-AI-Gateway.md Illustrates environment variables for configuring the Azure AI Gateway backend in Fabric. ```bash # Example configuration AZUREAIGATEWAY_BACKEND=bedrock AZUREAIGATEWAY_GATEWAY_URL=https://gateway.company.com AZUREAIGATEWAY_SUBSCRIPTION_KEY=your-key-here AZUREAIGATEWAY_API_VERSION=2025-04-01-preview ``` -------------------------------- ### Subject Input Example Source: https://github.com/danielmiessler/fabric/blob/main/data/patterns/model_as_sherlock_freud/system.md Example of the text or dialogue format provided by the user as evidence for analysis. ```text Subject Input: "I keep saying I don’t care what people think, but then I spend hours rewriting my posts before I share them." ``` -------------------------------- ### Example Fabric YAML Configuration Source: https://github.com/danielmiessler/fabric/blob/main/internal/cli/README.md An example of a typical YAML configuration file for Fabric, located at `~/.config/fabric/config.yaml`. ```yaml # ~/.config/fabric/config.yaml model: gpt-4 temperature: 0.8 pattern: analyze stream: true topp: 0.95 presencepenalty: 0.1 frequencypenalty: 0.2 ```