mirror of
https://github.com/danielmiessler/Fabric.git
synced 2026-01-09 22:38:10 -05:00
docs: minor formatting fixes
This commit is contained in:
@@ -9,7 +9,7 @@
|
|||||||
# ❌ This DOES NOT WORK - extensions are not processed in stdin
|
# ❌ This DOES NOT WORK - extensions are not processed in stdin
|
||||||
echo "{{ext:word-generator:generate:3}}" | fabric
|
echo "{{ext:word-generator:generate:3}}" | fabric
|
||||||
|
|
||||||
# ✅ This WORKS - extensions are processed within patterns
|
# ✅ This WORKS - extensions are processed within patterns
|
||||||
fabric -p my-pattern-with-extensions.md
|
fabric -p my-pattern-with-extensions.md
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -18,6 +18,7 @@ When you pipe directly to fabric without a pattern, the input goes straight to t
|
|||||||
## Understanding Extension Architecture
|
## Understanding Extension Architecture
|
||||||
|
|
||||||
### Registry Structure
|
### Registry Structure
|
||||||
|
|
||||||
The extension registry is stored at `~/.config/fabric/extensions/extensions.yaml` and tracks registered extensions:
|
The extension registry is stored at `~/.config/fabric/extensions/extensions.yaml` and tracks registered extensions:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -31,6 +32,7 @@ extensions:
|
|||||||
The registry maintains security through hash verification of both configs and executables.
|
The registry maintains security through hash verification of both configs and executables.
|
||||||
|
|
||||||
### Extension Configuration
|
### Extension Configuration
|
||||||
|
|
||||||
Each extension requires a YAML configuration file with the following structure:
|
Each extension requires a YAML configuration file with the following structure:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
@@ -56,8 +58,10 @@ config: # Output configuration
|
|||||||
```
|
```
|
||||||
|
|
||||||
### Directory Structure
|
### Directory Structure
|
||||||
|
|
||||||
Recommended organization:
|
Recommended organization:
|
||||||
```
|
|
||||||
|
```text
|
||||||
~/.config/fabric/extensions/
|
~/.config/fabric/extensions/
|
||||||
├── bin/ # Extension executables
|
├── bin/ # Extension executables
|
||||||
├── configs/ # Extension YAML configs
|
├── configs/ # Extension YAML configs
|
||||||
@@ -65,9 +69,11 @@ Recommended organization:
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Example 1: Python Wrapper (Word Generator)
|
## Example 1: Python Wrapper (Word Generator)
|
||||||
|
|
||||||
A simple example wrapping a Python script.
|
A simple example wrapping a Python script.
|
||||||
|
|
||||||
### 1. Position Files
|
### 1. Position Files
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Create directories
|
# Create directories
|
||||||
mkdir -p ~/.config/fabric/extensions/{bin,configs}
|
mkdir -p ~/.config/fabric/extensions/{bin,configs}
|
||||||
@@ -78,7 +84,9 @@ chmod +x ~/.config/fabric/extensions/bin/word-generator.py
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2. Configure
|
### 2. Configure
|
||||||
|
|
||||||
Create `~/.config/fabric/extensions/configs/word-generator.yaml`:
|
Create `~/.config/fabric/extensions/configs/word-generator.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: word-generator
|
name: word-generator
|
||||||
executable: "~/.config/fabric/extensions/bin/word-generator.py"
|
executable: "~/.config/fabric/extensions/bin/word-generator.py"
|
||||||
@@ -97,6 +105,7 @@ config:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 3. Register & Run
|
### 3. Register & Run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Register
|
# Register
|
||||||
fabric --addextension ~/.config/fabric/extensions/configs/word-generator.yaml
|
fabric --addextension ~/.config/fabric/extensions/configs/word-generator.yaml
|
||||||
@@ -106,13 +115,16 @@ fabric --addextension ~/.config/fabric/extensions/configs/word-generator.yaml
|
|||||||
```
|
```
|
||||||
|
|
||||||
## Example 2: Direct Executable (SQLite3)
|
## Example 2: Direct Executable (SQLite3)
|
||||||
|
|
||||||
Using a system executable directly.
|
Using a system executable directly.
|
||||||
|
|
||||||
copy the memories to your home directory
|
copy the memories to your home directory
|
||||||
~/memories.db
|
~/memories.db
|
||||||
|
|
||||||
### 1. Configure
|
### 1. Configure
|
||||||
|
|
||||||
Create `~/.config/fabric/extensions/configs/memory-query.yaml`:
|
Create `~/.config/fabric/extensions/configs/memory-query.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
name: memory-query
|
name: memory-query
|
||||||
executable: "/usr/bin/sqlite3"
|
executable: "/usr/bin/sqlite3"
|
||||||
@@ -137,6 +149,7 @@ config:
|
|||||||
```
|
```
|
||||||
|
|
||||||
### 2. Register & Run
|
### 2. Register & Run
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Register
|
# Register
|
||||||
fabric --addextension ~/.config/fabric/extensions/configs/memory-query.yaml
|
fabric --addextension ~/.config/fabric/extensions/configs/memory-query.yaml
|
||||||
@@ -145,10 +158,10 @@ fabric --addextension ~/.config/fabric/extensions/configs/memory-query.yaml
|
|||||||
# Direct piping to fabric will NOT process extension syntax
|
# Direct piping to fabric will NOT process extension syntax
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
## Extension Management Commands
|
## Extension Management Commands
|
||||||
|
|
||||||
### Add Extension
|
### Add Extension
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fabric --addextension ~/.config/fabric/extensions/configs/memory-query.yaml
|
fabric --addextension ~/.config/fabric/extensions/configs/memory-query.yaml
|
||||||
```
|
```
|
||||||
@@ -156,25 +169,28 @@ fabric --addextension ~/.config/fabric/extensions/configs/memory-query.yaml
|
|||||||
Note : if the executable or config file changes, you must re-add the extension.
|
Note : if the executable or config file changes, you must re-add the extension.
|
||||||
This will recompute the hash for the extension.
|
This will recompute the hash for the extension.
|
||||||
|
|
||||||
|
|
||||||
### List Extensions
|
### List Extensions
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fabric --listextensions
|
fabric --listextensions
|
||||||
```
|
```
|
||||||
|
|
||||||
Shows all registered extensions with their status and configuration details.
|
Shows all registered extensions with their status and configuration details.
|
||||||
|
|
||||||
### Remove Extension
|
### Remove Extension
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fabric --rmextension <extension-name>
|
fabric --rmextension <extension-name>
|
||||||
```
|
```
|
||||||
Removes an extension from the registry.
|
|
||||||
|
|
||||||
|
Removes an extension from the registry.
|
||||||
|
|
||||||
## Extensions in patterns
|
## Extensions in patterns
|
||||||
|
|
||||||
**IMPORTANT**: Extensions are ONLY processed when used within pattern files, not via direct piping to fabric.
|
**IMPORTANT**: Extensions are ONLY processed when used within pattern files, not via direct piping to fabric.
|
||||||
|
|
||||||
Create a pattern file (e.g., `test_pattern.md`):
|
Create a pattern file (e.g., `test_pattern.md`):
|
||||||
|
|
||||||
```markdown
|
```markdown
|
||||||
These are my favorite
|
These are my favorite
|
||||||
{{ext:word-generator:generate:3}}
|
{{ext:word-generator:generate:3}}
|
||||||
@@ -186,13 +202,14 @@ what does this say about me?
|
|||||||
```
|
```
|
||||||
|
|
||||||
Run the pattern:
|
Run the pattern:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fabric -p ./internal/plugins/template/Examples/test_pattern.md
|
fabric -p ./internal/plugins/template/Examples/test_pattern.md
|
||||||
```
|
```
|
||||||
|
|
||||||
## Passing {{input}} to extensions inside patterns
|
## Passing {{input}} to extensions inside patterns
|
||||||
|
|
||||||
```
|
```text
|
||||||
Create a pattern called ai_summarize that uses extensions (see openai.yaml and copy for claude)
|
Create a pattern called ai_summarize that uses extensions (see openai.yaml and copy for claude)
|
||||||
|
|
||||||
Summarize the responses from both AI models:
|
Summarize the responses from both AI models:
|
||||||
@@ -232,6 +249,7 @@ echo "What is Artificial Intelligence" | ../fabric-fix -p ai_summarize
|
|||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### Common Issues
|
### Common Issues
|
||||||
|
|
||||||
1. **Registration Failures**
|
1. **Registration Failures**
|
||||||
- Verify file permissions
|
- Verify file permissions
|
||||||
- Check executable paths
|
- Check executable paths
|
||||||
@@ -249,10 +267,10 @@ echo "What is Artificial Intelligence" | ../fabric-fix -p ai_summarize
|
|||||||
- Monitor disk space for file operations
|
- Monitor disk space for file operations
|
||||||
|
|
||||||
### Debug Tips
|
### Debug Tips
|
||||||
|
|
||||||
1. Enable verbose logging when available
|
1. Enable verbose logging when available
|
||||||
2. Check system logs for execution errors
|
2. Check system logs for execution errors
|
||||||
3. Verify extension dependencies
|
3. Verify extension dependencies
|
||||||
4. Test extensions with minimal configurations first
|
4. Test extensions with minimal configurations first
|
||||||
|
|
||||||
|
Would you like me to expand on any particular section or add more examples?
|
||||||
Would you like me to expand on any particular section or add more examples?
|
|
||||||
|
|||||||
Reference in New Issue
Block a user