Fix config inconsistency (#609)

* Plural/singular confusion in config key

* Flow class vs flow blueprint nomenclature change

* Update docs & CLI to reflect the above
This commit is contained in:
cybermaggedon 2026-01-14 12:31:40 +00:00 committed by GitHub
parent 99f17d1b9d
commit b08db761d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
36 changed files with 816 additions and 814 deletions

View file

@ -48,11 +48,11 @@ Most CLI commands support these common options:
- [`tg-show-flows`](tg-show-flows.md) - List all configured flows
- [`tg-show-flow-state`](tg-show-flow-state.md) - Show current flow states
**Flow Class Management:**
- [`tg-put-flow-class`](tg-put-flow-class.md) - Upload/update flow class definition
- [`tg-get-flow-class`](tg-get-flow-class.md) - Retrieve flow class definition
- [`tg-delete-flow-class`](tg-delete-flow-class.md) - Remove flow class definition
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes
**Flow Blueprint Management:**
- [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Upload/update flow blueprint definition
- [`tg-get-flow-blueprint`](tg-get-flow-blueprint.md) - Retrieve flow blueprint definition
- [`tg-delete-flow-blueprint`](tg-delete-flow-blueprint.md) - Remove flow blueprint definition
- [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
### Knowledge Graph Management
@ -115,7 +115,7 @@ Most CLI commands support these common options:
### Basic Document Processing
```bash
# Start a flow
tg-start-flow --flow-id my-flow --class-name document-processing
tg-start-flow --flow-id my-flow --blueprint-name document-processing
# Load a document
tg-load-text --flow-id my-flow --text "Your document content" --title "Test Document"
@ -138,8 +138,8 @@ tg-show-graph --limit 100
### Flow Management
```bash
# Show available flow classes
tg-show-flow-classes
# Show available flow blueprintes
tg-show-flow-blueprints
# Show running flows
tg-show-flows

View file

@ -1,24 +1,24 @@
# tg-delete-flow-class
# tg-delete-flow-blueprint
Permanently deletes a flow class definition from TrustGraph.
Permanently deletes a flow blueprint definition from TrustGraph.
## Synopsis
```bash
tg-delete-flow-class -n CLASS_NAME [options]
tg-delete-flow-blueprint -n CLASS_NAME [options]
```
## Description
The `tg-delete-flow-class` command permanently removes a flow class definition from TrustGraph. This operation cannot be undone, so use with caution.
The `tg-delete-flow-blueprint` command permanently removes a flow blueprint definition from TrustGraph. This operation cannot be undone, so use with caution.
**⚠️ Warning**: Deleting a flow class that has active flow instances may cause those instances to become unusable. Always check for active flows before deletion.
**⚠️ Warning**: Deleting a flow blueprint that has active flow instances may cause those instances to become unusable. Always check for active flows before deletion.
## Options
### Required Arguments
- `-n, --class-name CLASS_NAME`: Name of the flow class to delete
- `-n, --blueprint-name CLASS_NAME`: Name of the flow blueprint to delete
### Optional Arguments
@ -26,65 +26,65 @@ The `tg-delete-flow-class` command permanently removes a flow class definition f
## Examples
### Delete a Flow Class
### Delete a Flow Blueprint
```bash
tg-delete-flow-class -n "old-test-flow"
tg-delete-flow-blueprint -n "old-test-flow"
```
### Delete with Custom API URL
```bash
tg-delete-flow-class -n "deprecated-flow" -u http://staging:8088/
tg-delete-flow-blueprint -n "deprecated-flow" -u http://staging:8088/
```
### Safe Deletion Workflow
```bash
# 1. Check if flow class exists
tg-show-flow-classes | grep "target-flow"
# 1. Check if flow blueprint exists
tg-show-flow-blueprints | grep "target-flow"
# 2. Backup the flow class first
tg-get-flow-class -n "target-flow" > backup-target-flow.json
# 2. Backup the flow blueprint first
tg-get-flow-blueprint -n "target-flow" > backup-target-flow.json
# 3. Check for active flow instances
tg-show-flows | grep "target-flow"
# 4. Delete the flow class
tg-delete-flow-class -n "target-flow"
# 4. Delete the flow blueprint
tg-delete-flow-blueprint -n "target-flow"
# 5. Verify deletion
tg-show-flow-classes | grep "target-flow" || echo "Flow class deleted successfully"
tg-show-flow-blueprints | grep "target-flow" || echo "Flow blueprint deleted successfully"
```
## Prerequisites
### Flow Class Must Exist
Verify the flow class exists before attempting deletion:
### Flow Blueprint Must Exist
Verify the flow blueprint exists before attempting deletion:
```bash
# List all flow classes
tg-show-flow-classes
# List all flow blueprintes
tg-show-flow-blueprints
# Check specific flow class
tg-show-flow-classes | grep "target-class"
# Check specific flow blueprint
tg-show-flow-blueprints | grep "target-class"
```
### Check for Active Flow Instances
Before deleting a flow class, check if any flow instances are using it:
Before deleting a flow blueprint, check if any flow instances are using it:
```bash
# List all active flows
tg-show-flows
# Look for instances using the flow class
# Look for instances using the flow blueprint
tg-show-flows | grep "target-class"
```
## Error Handling
### Flow Class Not Found
### Flow Blueprint Not Found
```bash
Exception: Flow class 'nonexistent-class' not found
Exception: Flow blueprint 'nonexistent-class' not found
```
**Solution**: Verify the flow class exists with `tg-show-flow-classes`.
**Solution**: Verify the flow blueprint exists with `tg-show-flow-blueprints`.
### Connection Errors
```bash
@ -94,13 +94,13 @@ Exception: Connection refused
### Permission Errors
```bash
Exception: Access denied to delete flow class
Exception: Access denied to delete flow blueprint
```
**Solution**: Verify user permissions for flow class management.
**Solution**: Verify user permissions for flow blueprint management.
### Active Flow Instances
```bash
Exception: Cannot delete flow class with active instances
Exception: Cannot delete flow blueprint with active instances
```
**Solution**: Stop all flow instances using this class before deletion.
@ -108,37 +108,37 @@ Exception: Cannot delete flow class with active instances
### Cleanup Development Classes
```bash
# Delete test and development flow classes
# Delete test and development flow blueprintes
test_classes=("test-flow-v1" "dev-experiment" "prototype-flow")
for class in "${test_classes[@]}"; do
echo "Deleting $class..."
tg-delete-flow-class -n "$class"
tg-delete-flow-blueprint -n "$class"
done
```
### Migration Cleanup
```bash
# After migrating to new flow classes, remove old ones
# After migrating to new flow blueprintes, remove old ones
old_classes=("legacy-flow" "deprecated-processor" "old-pipeline")
for class in "${old_classes[@]}"; do
# Backup first
tg-get-flow-class -n "$class" > "backup-$class.json" 2>/dev/null
tg-get-flow-blueprint -n "$class" > "backup-$class.json" 2>/dev/null
# Delete
tg-delete-flow-class -n "$class"
tg-delete-flow-blueprint -n "$class"
echo "Deleted $class"
done
```
### Conditional Deletion
```bash
# Delete flow class only if no active instances exist
# Delete flow blueprint only if no active instances exist
flow_class="target-flow"
active_instances=$(tg-show-flows | grep "$flow_class" | wc -l)
if [ $active_instances -eq 0 ]; then
echo "No active instances found, deleting flow class..."
tg-delete-flow-class -n "$flow_class"
echo "No active instances found, deleting flow blueprint..."
tg-delete-flow-blueprint -n "$flow_class"
else
echo "Warning: $active_instances active instances found. Cannot delete."
tg-show-flows | grep "$flow_class"
@ -154,13 +154,13 @@ flow_class="important-flow"
backup_dir="flow-class-backups/$(date +%Y%m%d-%H%M%S)"
mkdir -p "$backup_dir"
echo "Backing up flow class: $flow_class"
tg-get-flow-class -n "$flow_class" > "$backup_dir/$flow_class.json"
echo "Backing up flow blueprint: $flow_class"
tg-get-flow-blueprint -n "$flow_class" > "$backup_dir/$flow_class.json"
if [ $? -eq 0 ]; then
echo "Backup created: $backup_dir/$flow_class.json"
echo "Proceeding with deletion..."
tg-delete-flow-class -n "$flow_class"
tg-delete-flow-blueprint -n "$flow_class"
else
echo "Backup failed. Aborting deletion."
exit 1
@ -174,22 +174,22 @@ fi
flow_class="$1"
if [ -z "$flow_class" ]; then
echo "Usage: $0 <flow-class-name>"
echo "Usage: $0 <flow-blueprint-name>"
exit 1
fi
echo "Safety checks for deleting flow class: $flow_class"
echo "Safety checks for deleting flow blueprint: $flow_class"
# Check if flow class exists
if ! tg-show-flow-classes | grep -q "$flow_class"; then
echo "ERROR: Flow class '$flow_class' not found"
# Check if flow blueprint exists
if ! tg-show-flow-blueprints | grep -q "$flow_class"; then
echo "ERROR: Flow blueprint '$flow_class' not found"
exit 1
fi
# Check for active instances
active_count=$(tg-show-flows | grep "$flow_class" | wc -l)
if [ $active_count -gt 0 ]; then
echo "ERROR: Found $active_count active instances using this flow class"
echo "ERROR: Found $active_count active instances using this flow blueprint"
echo "Active instances:"
tg-show-flows | grep "$flow_class"
exit 1
@ -198,7 +198,7 @@ fi
# Create backup
backup_file="backup-$flow_class-$(date +%Y%m%d-%H%M%S).json"
echo "Creating backup: $backup_file"
tg-get-flow-class -n "$flow_class" > "$backup_file"
tg-get-flow-blueprint -n "$flow_class" > "$backup_file"
if [ $? -ne 0 ]; then
echo "ERROR: Failed to create backup"
@ -206,19 +206,19 @@ if [ $? -ne 0 ]; then
fi
# Confirm deletion
echo "Ready to delete flow class: $flow_class"
echo "Ready to delete flow blueprint: $flow_class"
echo "Backup saved as: $backup_file"
read -p "Are you sure you want to delete this flow class? (y/N): " confirm
read -p "Are you sure you want to delete this flow blueprint? (y/N): " confirm
if [ "$confirm" = "y" ] || [ "$confirm" = "Y" ]; then
echo "Deleting flow class..."
tg-delete-flow-class -n "$flow_class"
echo "Deleting flow blueprint..."
tg-delete-flow-blueprint -n "$flow_class"
# Verify deletion
if ! tg-show-flow-classes | grep -q "$flow_class"; then
echo "Flow class deleted successfully"
if ! tg-show-flow-blueprints | grep -q "$flow_class"; then
echo "Flow blueprint deleted successfully"
else
echo "ERROR: Flow class still exists after deletion"
echo "ERROR: Flow blueprint still exists after deletion"
exit 1
fi
else
@ -229,13 +229,13 @@ fi
## Integration with Other Commands
### Complete Flow Class Lifecycle
### Complete Flow Blueprint Lifecycle
```bash
# 1. List existing flow classes
tg-show-flow-classes
# 1. List existing flow blueprintes
tg-show-flow-blueprints
# 2. Get flow class details
tg-get-flow-class -n "target-flow"
# 2. Get flow blueprint details
tg-get-flow-blueprint -n "target-flow"
# 3. Check for active instances
tg-show-flows | grep "target-flow"
@ -244,25 +244,25 @@ tg-show-flows | grep "target-flow"
tg-stop-flow -i "instance-id"
# 5. Create backup
tg-get-flow-class -n "target-flow" > backup.json
tg-get-flow-blueprint -n "target-flow" > backup.json
# 6. Delete flow class
tg-delete-flow-class -n "target-flow"
# 6. Delete flow blueprint
tg-delete-flow-blueprint -n "target-flow"
# 7. Verify deletion
tg-show-flow-classes | grep "target-flow"
tg-show-flow-blueprints | grep "target-flow"
```
### Bulk Deletion with Validation
```bash
# Delete multiple flow classes safely
# Delete multiple flow blueprintes safely
classes_to_delete=("old-flow1" "old-flow2" "test-flow")
for class in "${classes_to_delete[@]}"; do
echo "Processing $class..."
# Check if exists
if ! tg-show-flow-classes | grep -q "$class"; then
if ! tg-show-flow-blueprints | grep -q "$class"; then
echo " $class not found, skipping"
continue
fi
@ -274,8 +274,8 @@ for class in "${classes_to_delete[@]}"; do
fi
# Backup and delete
tg-get-flow-class -n "$class" > "backup-$class.json"
tg-delete-flow-class -n "$class"
tg-get-flow-blueprint -n "$class" > "backup-$class.json"
tg-delete-flow-blueprint -n "$class"
echo " $class deleted"
done
```
@ -286,15 +286,15 @@ done
## Related Commands
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes
- [`tg-get-flow-class`](tg-get-flow-class.md) - Retrieve flow class definitions
- [`tg-put-flow-class`](tg-put-flow-class.md) - Create/update flow class definitions
- [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-get-flow-blueprint`](tg-get-flow-blueprint.md) - Retrieve flow blueprint definitions
- [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Create/update flow blueprint definitions
- [`tg-show-flows`](tg-show-flows.md) - List active flow instances
- [`tg-stop-flow`](tg-stop-flow.md) - Stop flow instances
## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `delete-class` operation to remove flow class definitions.
This command uses the [Flow API](../apis/api-flow.md) with the `delete-class` operation to remove flow blueprint definitions.
## Best Practices
@ -310,10 +310,10 @@ This command uses the [Flow API](../apis/api-flow.md) with the `delete-class` op
### Command Succeeds but Class Still Exists
```bash
# Check if deletion actually occurred
tg-show-flow-classes | grep "deleted-class"
tg-show-flow-blueprints | grep "deleted-class"
# Verify API connectivity
tg-show-flow-classes > /dev/null && echo "API accessible"
tg-show-flow-blueprints > /dev/null && echo "API accessible"
```
### Permissions Issues

View file

@ -1,24 +1,24 @@
# tg-get-flow-class
# tg-get-flow-blueprint
Retrieves and displays a flow class definition in JSON format.
Retrieves and displays a flow blueprint definition in JSON format.
## Synopsis
```bash
tg-get-flow-class -n CLASS_NAME [options]
tg-get-flow-blueprint -n CLASS_NAME [options]
```
## Description
The `tg-get-flow-class` command retrieves a stored flow class definition from TrustGraph and displays it in formatted JSON. This is useful for examining flow class configurations, creating backups, or preparing to modify existing flow classes.
The `tg-get-flow-blueprint` command retrieves a stored flow blueprint definition from TrustGraph and displays it in formatted JSON. This is useful for examining flow blueprint configurations, creating backups, or preparing to modify existing flow blueprintes.
The output can be saved to files for version control, documentation, or as input for creating new flow classes with `tg-put-flow-class`.
The output can be saved to files for version control, documentation, or as input for creating new flow blueprintes with `tg-put-flow-blueprint`.
## Options
### Required Arguments
- `-n, --class-name CLASS_NAME`: Name of the flow class to retrieve
- `-n, --blueprint-name CLASS_NAME`: Name of the flow blueprint to retrieve
### Optional Arguments
@ -26,32 +26,32 @@ The output can be saved to files for version control, documentation, or as input
## Examples
### Display Flow Class Definition
### Display Flow Blueprint Definition
```bash
tg-get-flow-class -n "document-processing"
tg-get-flow-blueprint -n "document-processing"
```
### Save Flow Class to File
### Save Flow Blueprint to File
```bash
tg-get-flow-class -n "production-flow" > production-flow-backup.json
tg-get-flow-blueprint -n "production-flow" > production-flow-backup.json
```
### Compare Flow Classes
### Compare Flow Blueprintes
```bash
# Get multiple flow classes for comparison
tg-get-flow-class -n "dev-flow" > dev-flow.json
tg-get-flow-class -n "prod-flow" > prod-flow.json
# Get multiple flow blueprintes for comparison
tg-get-flow-blueprint -n "dev-flow" > dev-flow.json
tg-get-flow-blueprint -n "prod-flow" > prod-flow.json
diff dev-flow.json prod-flow.json
```
### Using Custom API URL
```bash
tg-get-flow-class -n "remote-flow" -u http://production:8088/
tg-get-flow-blueprint -n "remote-flow" -u http://production:8088/
```
## Output Format
The command outputs the flow class definition in formatted JSON:
The command outputs the flow blueprint definition in formatted JSON:
```json
{
@ -76,7 +76,7 @@ The command outputs the flow class definition in formatted JSON:
### Key Components
#### Description
Human-readable description of the flow class purpose and capabilities.
Human-readable description of the flow blueprint purpose and capabilities.
#### Interfaces
Service definitions showing:
@ -84,28 +84,28 @@ Service definitions showing:
- **Fire-and-Forget Services**: Services with only input queues
#### Tags (Optional)
Categorization tags for organizing flow classes.
Categorization tags for organizing flow blueprintes.
## Prerequisites
### Flow Class Must Exist
Verify the flow class exists before retrieval:
### Flow Blueprint Must Exist
Verify the flow blueprint exists before retrieval:
```bash
# Check available flow classes
tg-show-flow-classes
# Check available flow blueprintes
tg-show-flow-blueprints
# Look for specific class
tg-show-flow-classes | grep "target-class"
tg-show-flow-blueprints | grep "target-class"
```
## Error Handling
### Flow Class Not Found
### Flow Blueprint Not Found
```bash
Exception: Flow class 'invalid-class' not found
Exception: Flow blueprint 'invalid-class' not found
```
**Solution**: Check available classes with `tg-show-flow-classes` and verify the class name.
**Solution**: Check available classes with `tg-show-flow-blueprints` and verify the class name.
### Connection Errors
```bash
@ -115,54 +115,54 @@ Exception: Connection refused
### Permission Errors
```bash
Exception: Access denied to flow class
Exception: Access denied to flow blueprint
```
**Solution**: Verify user permissions for accessing flow class definitions.
**Solution**: Verify user permissions for accessing flow blueprint definitions.
## Use Cases
### Configuration Backup
```bash
# Backup all flow classes
# Backup all flow blueprintes
mkdir -p flow-class-backups/$(date +%Y%m%d)
tg-show-flow-classes | awk '{print $1}' | while read class; do
tg-show-flow-blueprints | awk '{print $1}' | while read class; do
if [ "$class" != "flow" ]; then # Skip header
tg-get-flow-class -n "$class" > "flow-class-backups/$(date +%Y%m%d)/$class.json"
tg-get-flow-blueprint -n "$class" > "flow-class-backups/$(date +%Y%m%d)/$class.json"
fi
done
```
### Flow Class Migration
### Flow Blueprint Migration
```bash
# Export from source environment
tg-get-flow-class -n "production-flow" -u http://source:8088/ > prod-flow.json
tg-get-flow-blueprint -n "production-flow" -u http://source:8088/ > prod-flow.json
# Import to target environment
tg-put-flow-class -n "production-flow" -c "$(cat prod-flow.json)" -u http://target:8088/
tg-put-flow-blueprint -n "production-flow" -c "$(cat prod-flow.json)" -u http://target:8088/
```
### Template Creation
```bash
# Get existing flow class as template
tg-get-flow-class -n "base-flow" > template.json
# Get existing flow blueprint as template
tg-get-flow-blueprint -n "base-flow" > template.json
# Modify template and create new class
sed 's/base-flow/new-flow/g' template.json > new-flow.json
tg-put-flow-class -n "custom-flow" -c "$(cat new-flow.json)"
tg-put-flow-blueprint -n "custom-flow" -c "$(cat new-flow.json)"
```
### Configuration Analysis
```bash
# Analyze flow class configurations
tg-get-flow-class -n "complex-flow" | jq '.interfaces | keys'
tg-get-flow-class -n "complex-flow" | jq '.interfaces | length'
# Analyze flow blueprint configurations
tg-get-flow-blueprint -n "complex-flow" | jq '.interfaces | keys'
tg-get-flow-blueprint -n "complex-flow" | jq '.interfaces | length'
```
### Version Control Integration
```bash
# Store flow classes in git
# Store flow blueprintes in git
mkdir -p flow-classes
tg-get-flow-class -n "main-flow" > flow-classes/main-flow.json
tg-get-flow-blueprint -n "main-flow" > flow-classes/main-flow.json
git add flow-classes/main-flow.json
git commit -m "Update main-flow configuration"
```
@ -172,60 +172,60 @@ git commit -m "Update main-flow configuration"
### Extract Specific Information
```bash
# Get only interface names
tg-get-flow-class -n "my-flow" | jq -r '.interfaces | keys[]'
tg-get-flow-blueprint -n "my-flow" | jq -r '.interfaces | keys[]'
# Get only description
tg-get-flow-class -n "my-flow" | jq -r '.description'
tg-get-flow-blueprint -n "my-flow" | jq -r '.description'
# Get request queues
tg-get-flow-class -n "my-flow" | jq -r '.interfaces | to_entries[] | select(.value.request) | .value.request'
tg-get-flow-blueprint -n "my-flow" | jq -r '.interfaces | to_entries[] | select(.value.request) | .value.request'
```
### Validate Configuration
```bash
# Validate JSON structure
tg-get-flow-class -n "my-flow" | jq . > /dev/null && echo "Valid JSON" || echo "Invalid JSON"
tg-get-flow-blueprint -n "my-flow" | jq . > /dev/null && echo "Valid JSON" || echo "Invalid JSON"
# Check required fields
config=$(tg-get-flow-class -n "my-flow")
config=$(tg-get-flow-blueprint -n "my-flow")
echo "$config" | jq -e '.description' > /dev/null || echo "Missing description"
echo "$config" | jq -e '.interfaces' > /dev/null || echo "Missing interfaces"
```
## Integration with Other Commands
### Flow Class Lifecycle
### Flow Blueprint Lifecycle
```bash
# 1. Examine existing flow class
tg-get-flow-class -n "old-flow"
# 1. Examine existing flow blueprint
tg-get-flow-blueprint -n "old-flow"
# 2. Save backup
tg-get-flow-class -n "old-flow" > old-flow-backup.json
tg-get-flow-blueprint -n "old-flow" > old-flow-backup.json
# 3. Modify configuration
cp old-flow-backup.json new-flow.json
# Edit new-flow.json as needed
# 4. Upload new version
tg-put-flow-class -n "updated-flow" -c "$(cat new-flow.json)"
tg-put-flow-blueprint -n "updated-flow" -c "$(cat new-flow.json)"
# 5. Test new flow class
# 5. Test new flow blueprint
tg-start-flow -n "updated-flow" -i "test-instance" -d "Testing updated flow"
```
### Bulk Operations
```bash
# Process multiple flow classes
# Process multiple flow blueprintes
flow_classes=("flow1" "flow2" "flow3")
for class in "${flow_classes[@]}"; do
echo "Processing $class..."
tg-get-flow-class -n "$class" > "backup-$class.json"
tg-get-flow-blueprint -n "$class" > "backup-$class.json"
# Modify configuration
sed 's/old-pattern/new-pattern/g' "backup-$class.json" > "updated-$class.json"
# Upload updated version
tg-put-flow-class -n "$class" -c "$(cat updated-$class.json)"
tg-put-flow-blueprint -n "$class" -c "$(cat updated-$class.json)"
done
```
@ -235,29 +235,29 @@ done
## Related Commands
- [`tg-put-flow-class`](tg-put-flow-class.md) - Upload/update flow class definitions
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes
- [`tg-delete-flow-class`](tg-delete-flow-class.md) - Remove flow class definitions
- [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Upload/update flow blueprint definitions
- [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-delete-flow-blueprint`](tg-delete-flow-blueprint.md) - Remove flow blueprint definitions
- [`tg-start-flow`](tg-start-flow.md) - Create flow instances from classes
## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `get-class` operation to retrieve flow class definitions.
This command uses the [Flow API](../apis/api-flow.md) with the `get-class` operation to retrieve flow blueprint definitions.
## Advanced Usage
### Configuration Diff
```bash
# Compare flow class versions
tg-get-flow-class -n "flow-v1" > v1.json
tg-get-flow-class -n "flow-v2" > v2.json
# Compare flow blueprint versions
tg-get-flow-blueprint -n "flow-v1" > v1.json
tg-get-flow-blueprint -n "flow-v2" > v2.json
diff -u v1.json v2.json
```
### Extract Queue Information
```bash
# Get all queue names from flow class
tg-get-flow-class -n "my-flow" | jq -r '
# Get all queue names from flow blueprint
tg-get-flow-blueprint -n "my-flow" | jq -r '
.interfaces |
to_entries[] |
if .value | type == "object" then
@ -275,16 +275,16 @@ tg-get-flow-class -n "my-flow" | jq -r '
flow_class="$1"
if [ -z "$flow_class" ]; then
echo "Usage: $0 <flow-class-name>"
echo "Usage: $0 <flow-blueprint-name>"
exit 1
fi
echo "Validating flow class: $flow_class"
echo "Validating flow blueprint: $flow_class"
# Get configuration
config=$(tg-get-flow-class -n "$flow_class" 2>/dev/null)
config=$(tg-get-flow-blueprint -n "$flow_class" 2>/dev/null)
if [ $? -ne 0 ]; then
echo "ERROR: Flow class not found"
echo "ERROR: Flow blueprint not found"
exit 1
fi
@ -307,32 +307,32 @@ if [ -z "$interfaces" ] || [ "$interfaces" = "null" ]; then
exit 1
fi
echo "Flow class validation passed"
echo "Flow blueprint validation passed"
```
## Best Practices
1. **Regular Backups**: Save flow class definitions before modifications
1. **Regular Backups**: Save flow blueprint definitions before modifications
2. **Version Control**: Store configurations in version control systems
3. **Documentation**: Include meaningful descriptions in flow classes
3. **Documentation**: Include meaningful descriptions in flow blueprintes
4. **Validation**: Validate JSON structure before using configurations
5. **Template Management**: Use existing classes as templates for new ones
6. **Change Tracking**: Document changes when updating flow classes
6. **Change Tracking**: Document changes when updating flow blueprintes
## Troubleshooting
### Empty Output
```bash
# If command returns empty output
tg-get-flow-class -n "my-flow"
# Check if flow class exists
tg-show-flow-classes | grep "my-flow"
tg-get-flow-blueprint -n "my-flow"
# Check if flow blueprint exists
tg-show-flow-blueprints | grep "my-flow"
```
### Invalid JSON Output
```bash
# If output appears corrupted
tg-get-flow-class -n "my-flow" | jq .
tg-get-flow-blueprint -n "my-flow" | jq .
# Should show parsing error if JSON is invalid
```

View file

@ -435,7 +435,7 @@ tg-invoke-mcp-tool -n tool-name -P '{}'
tg-show-flows | grep "flow-id"
# Verify flow supports MCP tools
tg-get-flow-class -n "flow-class" | jq '.interfaces.mcp_tool'
tg-get-flow-blueprint -n "flow-class" | jq '.interfaces.mcp_tool'
```
### Connection Issues

View file

@ -426,5 +426,5 @@ echo "variable=value" | grep "="
tg-show-flows | grep "flow-id"
# Verify flow has prompt service
tg-get-flow-class -n "flow-class" | jq '.interfaces.prompt'
tg-get-flow-blueprint -n "flow-class" | jq '.interfaces.prompt'
```

View file

@ -1,25 +1,25 @@
# tg-put-flow-class
# tg-put-flow-blueprint
Uploads or updates a flow class definition in TrustGraph.
Uploads or updates a flow blueprint definition in TrustGraph.
## Synopsis
```bash
tg-put-flow-class -n CLASS_NAME -c CONFIG_JSON [options]
tg-put-flow-blueprint -n CLASS_NAME -c CONFIG_JSON [options]
```
## Description
The `tg-put-flow-class` command creates or updates a flow class definition in TrustGraph. Flow classes are templates that define processing pipeline configurations, service interfaces, and resource requirements. These classes are used by `tg-start-flow` to create running flow instances.
The `tg-put-flow-blueprint` command creates or updates a flow blueprint definition in TrustGraph. Flow blueprintes are templates that define processing pipeline configurations, service interfaces, and resource requirements. These classes are used by `tg-start-flow` to create running flow instances.
Flow classes define the structure and capabilities of processing flows, including which services are available and how they connect to Pulsar queues.
Flow blueprintes define the structure and capabilities of processing flows, including which services are available and how they connect to Pulsar queues.
## Options
### Required Arguments
- `-n, --class-name CLASS_NAME`: Name for the flow class
- `-c, --config CONFIG_JSON`: Flow class configuration as raw JSON string
- `-n, --blueprint-name CLASS_NAME`: Name for the flow blueprint
- `-c, --config CONFIG_JSON`: Flow blueprint configuration as raw JSON string
### Optional Arguments
@ -27,16 +27,16 @@ Flow classes define the structure and capabilities of processing flows, includin
## Examples
### Basic Flow Class Creation
### Basic Flow Blueprint Creation
```bash
tg-put-flow-class \
tg-put-flow-blueprint \
-n "simple-processing" \
-c '{"description": "Simple text processing flow", "interfaces": {"text-completion": {"request": "non-persistent://tg/request/text-completion:simple", "response": "non-persistent://tg/response/text-completion:simple"}}}'
```
### Document Processing Flow Class
### Document Processing Flow Blueprint
```bash
tg-put-flow-class \
tg-put-flow-blueprint \
-n "document-analysis" \
-c '{
"description": "Document analysis and RAG processing",
@ -80,14 +80,14 @@ cat > research-flow.json << 'EOF'
}
EOF
# Upload the flow class
tg-put-flow-class -n "research-analysis" -c "$(cat research-flow.json)"
# Upload the flow blueprint
tg-put-flow-blueprint -n "research-analysis" -c "$(cat research-flow.json)"
```
### Update Existing Flow Class
### Update Existing Flow Blueprint
```bash
# Modify existing flow class by adding new service
tg-put-flow-class \
# Modify existing flow blueprint by adding new service
tg-put-flow-blueprint \
-n "existing-flow" \
-c '{
"description": "Updated flow with new capabilities",
@ -104,14 +104,14 @@ tg-put-flow-class \
}'
```
## Flow Class Configuration Format
## Flow Blueprint Configuration Format
### Required Fields
#### Description
```json
{
"description": "Human-readable description of the flow class"
"description": "Human-readable description of the flow blueprint"
}
```
@ -180,9 +180,9 @@ persistent://tg/flow/{service}:{flow-identifier}
## Complete Example
### Comprehensive Flow Class
### Comprehensive Flow Blueprint
```bash
tg-put-flow-class \
tg-put-flow-blueprint \
-n "full-processing-pipeline" \
-c '{
"description": "Complete document processing and analysis pipeline",
@ -234,11 +234,11 @@ tg-put-flow-class \
Successful upload typically produces no output:
```bash
# Upload flow class (no output expected)
tg-put-flow-class -n "my-flow" -c '{"description": "test", "interfaces": {}}'
# Upload flow blueprint (no output expected)
tg-put-flow-blueprint -n "my-flow" -c '{"description": "test", "interfaces": {}}'
# Verify upload
tg-show-flow-classes | grep "my-flow"
tg-show-flow-blueprints | grep "my-flow"
```
## Error Handling
@ -276,27 +276,27 @@ config='{"description": "test flow", "interfaces": {}}'
echo "$config" | jq . > /dev/null && echo "Valid JSON" || echo "Invalid JSON"
```
### Flow Class Verification
### Flow Blueprint Verification
```bash
# After uploading, verify the flow class exists
tg-show-flow-classes | grep "my-flow-class"
# After uploading, verify the flow blueprint exists
tg-show-flow-blueprints | grep "my-flow-class"
# Get the flow class definition to verify content
tg-get-flow-class -n "my-flow-class"
# Get the flow blueprint definition to verify content
tg-get-flow-blueprint -n "my-flow-class"
```
## Flow Class Lifecycle
## Flow Blueprint Lifecycle
### Development Workflow
```bash
# 1. Create flow class
tg-put-flow-class -n "dev-flow" -c "$dev_config"
# 1. Create flow blueprint
tg-put-flow-blueprint -n "dev-flow" -c "$dev_config"
# 2. Test with flow instance
tg-start-flow -n "dev-flow" -i "test-instance" -d "Testing"
# 3. Update flow class as needed
tg-put-flow-class -n "dev-flow" -c "$updated_config"
# 3. Update flow blueprint as needed
tg-put-flow-blueprint -n "dev-flow" -c "$updated_config"
# 4. Restart flow instance with updates
tg-stop-flow -i "test-instance"
@ -309,53 +309,53 @@ tg-start-flow -n "dev-flow" -i "test-instance" -d "Testing updated"
## Related Commands
- [`tg-get-flow-class`](tg-get-flow-class.md) - Retrieve flow class definitions
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes
- [`tg-delete-flow-class`](tg-delete-flow-class.md) - Remove flow class definitions
- [`tg-get-flow-blueprint`](tg-get-flow-blueprint.md) - Retrieve flow blueprint definitions
- [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-delete-flow-blueprint`](tg-delete-flow-blueprint.md) - Remove flow blueprint definitions
- [`tg-start-flow`](tg-start-flow.md) - Create flow instances from classes
## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `put-class` operation to store flow class definitions.
This command uses the [Flow API](../apis/api-flow.md) with the `put-class` operation to store flow blueprint definitions.
## Use Cases
### Custom Processing Pipelines
```bash
# Create specialized medical analysis flow
tg-put-flow-class -n "medical-nlp" -c "$medical_config"
tg-put-flow-blueprint -n "medical-nlp" -c "$medical_config"
```
### Development Environments
```bash
# Create lightweight development flow
tg-put-flow-class -n "dev-minimal" -c "$minimal_config"
tg-put-flow-blueprint -n "dev-minimal" -c "$minimal_config"
```
### Production Deployments
```bash
# Create robust production flow with all services
tg-put-flow-class -n "production-full" -c "$production_config"
tg-put-flow-blueprint -n "production-full" -c "$production_config"
```
### Domain-Specific Workflows
```bash
# Create legal document analysis flow
tg-put-flow-class -n "legal-analysis" -c "$legal_config"
tg-put-flow-blueprint -n "legal-analysis" -c "$legal_config"
```
## Best Practices
1. **Descriptive Names**: Use clear, descriptive flow class names
1. **Descriptive Names**: Use clear, descriptive flow blueprint names
2. **Comprehensive Descriptions**: Include detailed descriptions of flow capabilities
3. **Consistent Naming**: Follow consistent queue naming conventions
4. **Version Control**: Store flow class configurations in version control
5. **Testing**: Test flow classes thoroughly before production use
6. **Documentation**: Document flow class purposes and requirements
4. **Version Control**: Store flow blueprint configurations in version control
5. **Testing**: Test flow blueprintes thoroughly before production use
6. **Documentation**: Document flow blueprint purposes and requirements
## Template Examples
### Minimal Flow Class
### Minimal Flow Blueprint
```json
{
"description": "Minimal text processing flow",
@ -368,7 +368,7 @@ tg-put-flow-class -n "legal-analysis" -c "$legal_config"
}
```
### RAG-Focused Flow Class
### RAG-Focused Flow Blueprint
```json
{
"description": "Retrieval Augmented Generation flow",
@ -389,7 +389,7 @@ tg-put-flow-class -n "legal-analysis" -c "$legal_config"
}
```
### Document Processing Flow Class
### Document Processing Flow Blueprint
```json
{
"description": "Document ingestion and processing flow",

View file

@ -43,7 +43,7 @@ Version: 42
{
"flows": {
"default": {
"class-name": "document-rag+graph-rag",
"blueprint-name": "document-rag+graph-rag",
"description": "Default processing flow",
"interfaces": {
"agent": {
@ -77,7 +77,7 @@ Version: 42
### Flow Definitions
Flow configurations showing:
- **class-name**: The flow class being used
- **blueprint-name**: The flow blueprint being used
- **description**: Human-readable flow description
- **interfaces**: Pulsar queue names for each service
@ -131,7 +131,7 @@ Exception: Unauthorized
## Related Commands
- [`tg-put-flow-class`](tg-put-flow-class.md) - Update flow class definitions
- [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Update flow blueprint definitions
- [`tg-show-flows`](tg-show-flows.md) - List active flows
- [`tg-set-prompt`](tg-set-prompt.md) - Configure prompt templates
- [`tg-set-token-costs`](tg-set-token-costs.md) - Configure token costs

View file

@ -0,0 +1,330 @@
# tg-show-flow-blueprints
Lists all defined flow blueprintes in TrustGraph with their descriptions and tags.
## Synopsis
```bash
tg-show-flow-blueprints [options]
```
## Description
The `tg-show-flow-blueprints` command displays a formatted table of all flow blueprint definitions currently stored in TrustGraph. Each flow blueprint is shown with its name, description, and associated tags.
Flow blueprintes are templates that define the structure and services available for creating flow instances. This command helps you understand what flow blueprintes are available for use.
## Options
### Optional Arguments
- `-u, --api-url URL`: TrustGraph API URL (default: `$TRUSTGRAPH_URL` or `http://localhost:8088/`)
## Examples
### List All Flow Blueprintes
```bash
tg-show-flow-blueprints
```
Output:
```
+-----------------+----------------------------------+----------------------+
| flow blueprint | description | tags |
+-----------------+----------------------------------+----------------------+
| document-proc | Document processing pipeline | production, nlp |
| data-analysis | Data analysis and visualization | analytics, dev |
| web-scraper | Web content extraction flow | scraping, batch |
| chat-assistant | Conversational AI assistant | ai, interactive |
+-----------------+----------------------------------+----------------------+
```
### Using Custom API URL
```bash
tg-show-flow-blueprints -u http://production:8088/
```
### Filter Flow Blueprintes
```bash
# Show only production-tagged flow blueprintes
tg-show-flow-blueprints | grep "production"
# Count total flow blueprintes
tg-show-flow-blueprints | grep -c "^|"
# Show flow blueprintes with specific patterns
tg-show-flow-blueprints | grep -E "(document|text|nlp)"
```
## Output Format
The command displays results in a formatted table with columns:
- **flow blueprint**: The unique name/identifier of the flow blueprint
- **description**: Human-readable description of the flow blueprint purpose
- **tags**: Comma-separated list of categorization tags
### Empty Results
If no flow blueprintes exist:
```
No flows.
```
## Use Cases
### Flow Blueprint Discovery
```bash
# Find available flow blueprintes for document processing
tg-show-flow-blueprints | grep -i document
# List all AI-related flow blueprintes
tg-show-flow-blueprints | grep -i "ai\|nlp\|chat\|assistant"
# Find development vs production flow blueprintes
tg-show-flow-blueprints | grep -E "(dev|test|staging)"
tg-show-flow-blueprints | grep "production"
```
### Flow Blueprint Management
```bash
# Get list of flow blueprint names for scripting
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); print $2}' | grep -v "^$"
# Check if specific flow blueprint exists
if tg-show-flow-blueprints | grep -q "target-flow"; then
echo "Flow blueprint 'target-flow' exists"
else
echo "Flow blueprint 'target-flow' not found"
fi
```
### Environment Comparison
```bash
# Compare flow blueprintes between environments
echo "Development environment:"
tg-show-flow-blueprints -u http://dev:8088/
echo "Production environment:"
tg-show-flow-blueprints -u http://prod:8088/
```
### Reporting and Documentation
```bash
# Generate flow blueprint inventory report
echo "Flow Blueprint Inventory - $(date)" > flow-inventory.txt
echo "=====================================" >> flow-inventory.txt
tg-show-flow-blueprints >> flow-inventory.txt
# Create CSV export
echo "flow_class,description,tags" > flow-classes.csv
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {
gsub(/^\| */, "", $0); gsub(/ *\|$/, "", $0);
gsub(/ *\| */, ",", $0); print $0
}' >> flow-classes.csv
```
## Error Handling
### Connection Errors
```bash
Exception: Connection refused
```
**Solution**: Check the API URL and ensure TrustGraph is running.
### Permission Errors
```bash
Exception: Access denied to list flow blueprintes
```
**Solution**: Verify user permissions for reading flow blueprint definitions.
### Network Timeouts
```bash
Exception: Request timeout
```
**Solution**: Check network connectivity and API server status.
## Integration with Other Commands
### Flow Blueprint Lifecycle
```bash
# 1. List available flow blueprintes
tg-show-flow-blueprints
# 2. Get details of specific flow blueprint
tg-get-flow-blueprint -n "interesting-flow"
# 3. Start flow instance from class
tg-start-flow -n "interesting-flow" -i "my-instance"
# 4. Monitor flow instance
tg-show-flows | grep "my-instance"
```
### Bulk Operations
```bash
# Process all flow blueprintes
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
echo "Processing flow blueprint: $class_name"
tg-get-flow-blueprint -n "$class_name" > "backup-$class_name.json"
fi
done
```
### Automated Validation
```bash
# Check flow blueprint health
echo "Validating flow blueprintes..."
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
echo -n "Checking $class_name... "
if tg-get-flow-blueprint -n "$class_name" > /dev/null 2>&1; then
echo "OK"
else
echo "ERROR"
fi
fi
done
```
## Advanced Usage
### Flow Blueprint Analysis
```bash
# Analyze flow blueprint distribution by tags
tg-show-flow-blueprints | awk 'NR>3 && /^\|/ {
# Extract tags column
split($0, parts, "|");
tags = parts[4];
gsub(/^ *| *$/, "", tags);
if (tags) {
split(tags, tag_array, ",");
for (i in tag_array) {
gsub(/^ *| *$/, "", tag_array[i]);
if (tag_array[i]) print tag_array[i];
}
}
}' | sort | uniq -c | sort -nr
```
### Environment Synchronization
```bash
# Sync flow blueprintes between environments
echo "Synchronizing flow blueprintes from dev to staging..."
# Get list from development
dev_classes=$(tg-show-flow-blueprints -u http://dev:8088/ | \
awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}')
# Check each class in staging
for class in $dev_classes; do
if tg-show-flow-blueprints -u http://staging:8088/ | grep -q "$class"; then
echo "$class: Already exists in staging"
else
echo "$class: Missing in staging - needs sync"
# Get from dev and put to staging
tg-get-flow-blueprint -n "$class" -u http://dev:8088/ > temp-class.json
tg-put-flow-blueprint -n "$class" -c "$(cat temp-class.json)" -u http://staging:8088/
rm temp-class.json
fi
done
```
### Monitoring Script
```bash
#!/bin/bash
# monitor-flow-classes.sh
api_url="${1:-http://localhost:8088/}"
echo "Flow Blueprint Monitoring Report - $(date)"
echo "API URL: $api_url"
echo "----------------------------------------"
# Total count
total=$(tg-show-flow-blueprints -u "$api_url" | grep -c "^|" 2>/dev/null || echo "0")
echo "Total flow blueprintes: $((total - 3))" # Subtract header rows
# Tag analysis
echo -e "\nTag distribution:"
tg-show-flow-blueprints -u "$api_url" | awk 'NR>3 && /^\|/ {
split($0, parts, "|");
tags = parts[4];
gsub(/^ *| *$/, "", tags);
if (tags) {
split(tags, tag_array, ",");
for (i in tag_array) {
gsub(/^ *| *$/, "", tag_array[i]);
if (tag_array[i]) print tag_array[i];
}
}
}' | sort | uniq -c | sort -nr
# Health check
echo -e "\nHealth check:"
healthy=0
unhealthy=0
tg-show-flow-blueprints -u "$api_url" | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
if tg-get-flow-blueprint -n "$class_name" -u "$api_url" > /dev/null 2>&1; then
healthy=$((healthy + 1))
else
unhealthy=$((unhealthy + 1))
echo " ERROR: $class_name"
fi
fi
done
echo "Healthy: $healthy, Unhealthy: $unhealthy"
```
## Environment Variables
- `TRUSTGRAPH_URL`: Default API URL
## Related Commands
- [`tg-get-flow-blueprint`](tg-get-flow-blueprint.md) - Retrieve specific flow blueprint definitions
- [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Create/update flow blueprint definitions
- [`tg-delete-flow-blueprint`](tg-delete-flow-blueprint.md) - Delete flow blueprint definitions
- [`tg-start-flow`](tg-start-flow.md) - Create flow instances from classes
- [`tg-show-flows`](tg-show-flows.md) - List active flow instances
## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `list-classes` operation to retrieve flow blueprint listings.
## Best Practices
1. **Regular Inventory**: Periodically review available flow blueprintes
2. **Documentation**: Ensure flow blueprintes have meaningful descriptions
3. **Tagging**: Use consistent tagging for better organization
4. **Cleanup**: Remove unused or deprecated flow blueprintes
5. **Monitoring**: Include flow blueprint health checks in monitoring
6. **Environment Parity**: Keep flow blueprintes synchronized across environments
## Troubleshooting
### No Output
```bash
# If command returns no output, check API connectivity
tg-show-flow-blueprints -u http://localhost:8088/
# Verify TrustGraph is running and accessible
```
### Formatting Issues
```bash
# If table formatting is broken, check terminal width
export COLUMNS=120
tg-show-flow-blueprints
```
### Missing Flow Blueprintes
```bash
# If expected flow blueprintes are missing, verify:
# 1. Correct API URL
# 2. Database connectivity
# 3. Flow blueprint definitions are properly stored
```

View file

@ -1,330 +0,0 @@
# tg-show-flow-classes
Lists all defined flow classes in TrustGraph with their descriptions and tags.
## Synopsis
```bash
tg-show-flow-classes [options]
```
## Description
The `tg-show-flow-classes` command displays a formatted table of all flow class definitions currently stored in TrustGraph. Each flow class is shown with its name, description, and associated tags.
Flow classes are templates that define the structure and services available for creating flow instances. This command helps you understand what flow classes are available for use.
## Options
### Optional Arguments
- `-u, --api-url URL`: TrustGraph API URL (default: `$TRUSTGRAPH_URL` or `http://localhost:8088/`)
## Examples
### List All Flow Classes
```bash
tg-show-flow-classes
```
Output:
```
+-----------------+----------------------------------+----------------------+
| flow class | description | tags |
+-----------------+----------------------------------+----------------------+
| document-proc | Document processing pipeline | production, nlp |
| data-analysis | Data analysis and visualization | analytics, dev |
| web-scraper | Web content extraction flow | scraping, batch |
| chat-assistant | Conversational AI assistant | ai, interactive |
+-----------------+----------------------------------+----------------------+
```
### Using Custom API URL
```bash
tg-show-flow-classes -u http://production:8088/
```
### Filter Flow Classes
```bash
# Show only production-tagged flow classes
tg-show-flow-classes | grep "production"
# Count total flow classes
tg-show-flow-classes | grep -c "^|"
# Show flow classes with specific patterns
tg-show-flow-classes | grep -E "(document|text|nlp)"
```
## Output Format
The command displays results in a formatted table with columns:
- **flow class**: The unique name/identifier of the flow class
- **description**: Human-readable description of the flow class purpose
- **tags**: Comma-separated list of categorization tags
### Empty Results
If no flow classes exist:
```
No flows.
```
## Use Cases
### Flow Class Discovery
```bash
# Find available flow classes for document processing
tg-show-flow-classes | grep -i document
# List all AI-related flow classes
tg-show-flow-classes | grep -i "ai\|nlp\|chat\|assistant"
# Find development vs production flow classes
tg-show-flow-classes | grep -E "(dev|test|staging)"
tg-show-flow-classes | grep "production"
```
### Flow Class Management
```bash
# Get list of flow class names for scripting
tg-show-flow-classes | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); print $2}' | grep -v "^$"
# Check if specific flow class exists
if tg-show-flow-classes | grep -q "target-flow"; then
echo "Flow class 'target-flow' exists"
else
echo "Flow class 'target-flow' not found"
fi
```
### Environment Comparison
```bash
# Compare flow classes between environments
echo "Development environment:"
tg-show-flow-classes -u http://dev:8088/
echo "Production environment:"
tg-show-flow-classes -u http://prod:8088/
```
### Reporting and Documentation
```bash
# Generate flow class inventory report
echo "Flow Class Inventory - $(date)" > flow-inventory.txt
echo "=====================================" >> flow-inventory.txt
tg-show-flow-classes >> flow-inventory.txt
# Create CSV export
echo "flow_class,description,tags" > flow-classes.csv
tg-show-flow-classes | awk 'NR>3 && /^\|/ {
gsub(/^\| */, "", $0); gsub(/ *\|$/, "", $0);
gsub(/ *\| */, ",", $0); print $0
}' >> flow-classes.csv
```
## Error Handling
### Connection Errors
```bash
Exception: Connection refused
```
**Solution**: Check the API URL and ensure TrustGraph is running.
### Permission Errors
```bash
Exception: Access denied to list flow classes
```
**Solution**: Verify user permissions for reading flow class definitions.
### Network Timeouts
```bash
Exception: Request timeout
```
**Solution**: Check network connectivity and API server status.
## Integration with Other Commands
### Flow Class Lifecycle
```bash
# 1. List available flow classes
tg-show-flow-classes
# 2. Get details of specific flow class
tg-get-flow-class -n "interesting-flow"
# 3. Start flow instance from class
tg-start-flow -n "interesting-flow" -i "my-instance"
# 4. Monitor flow instance
tg-show-flows | grep "my-instance"
```
### Bulk Operations
```bash
# Process all flow classes
tg-show-flow-classes | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
echo "Processing flow class: $class_name"
tg-get-flow-class -n "$class_name" > "backup-$class_name.json"
fi
done
```
### Automated Validation
```bash
# Check flow class health
echo "Validating flow classes..."
tg-show-flow-classes | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
echo -n "Checking $class_name... "
if tg-get-flow-class -n "$class_name" > /dev/null 2>&1; then
echo "OK"
else
echo "ERROR"
fi
fi
done
```
## Advanced Usage
### Flow Class Analysis
```bash
# Analyze flow class distribution by tags
tg-show-flow-classes | awk 'NR>3 && /^\|/ {
# Extract tags column
split($0, parts, "|");
tags = parts[4];
gsub(/^ *| *$/, "", tags);
if (tags) {
split(tags, tag_array, ",");
for (i in tag_array) {
gsub(/^ *| *$/, "", tag_array[i]);
if (tag_array[i]) print tag_array[i];
}
}
}' | sort | uniq -c | sort -nr
```
### Environment Synchronization
```bash
# Sync flow classes between environments
echo "Synchronizing flow classes from dev to staging..."
# Get list from development
dev_classes=$(tg-show-flow-classes -u http://dev:8088/ | \
awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}')
# Check each class in staging
for class in $dev_classes; do
if tg-show-flow-classes -u http://staging:8088/ | grep -q "$class"; then
echo "$class: Already exists in staging"
else
echo "$class: Missing in staging - needs sync"
# Get from dev and put to staging
tg-get-flow-class -n "$class" -u http://dev:8088/ > temp-class.json
tg-put-flow-class -n "$class" -c "$(cat temp-class.json)" -u http://staging:8088/
rm temp-class.json
fi
done
```
### Monitoring Script
```bash
#!/bin/bash
# monitor-flow-classes.sh
api_url="${1:-http://localhost:8088/}"
echo "Flow Class Monitoring Report - $(date)"
echo "API URL: $api_url"
echo "----------------------------------------"
# Total count
total=$(tg-show-flow-classes -u "$api_url" | grep -c "^|" 2>/dev/null || echo "0")
echo "Total flow classes: $((total - 3))" # Subtract header rows
# Tag analysis
echo -e "\nTag distribution:"
tg-show-flow-classes -u "$api_url" | awk 'NR>3 && /^\|/ {
split($0, parts, "|");
tags = parts[4];
gsub(/^ *| *$/, "", tags);
if (tags) {
split(tags, tag_array, ",");
for (i in tag_array) {
gsub(/^ *| *$/, "", tag_array[i]);
if (tag_array[i]) print tag_array[i];
}
}
}' | sort | uniq -c | sort -nr
# Health check
echo -e "\nHealth check:"
healthy=0
unhealthy=0
tg-show-flow-classes -u "$api_url" | awk 'NR>3 && /^\|/ {gsub(/[| ]/, "", $2); if($2) print $2}' | \
while read class_name; do
if [ -n "$class_name" ]; then
if tg-get-flow-class -n "$class_name" -u "$api_url" > /dev/null 2>&1; then
healthy=$((healthy + 1))
else
unhealthy=$((unhealthy + 1))
echo " ERROR: $class_name"
fi
fi
done
echo "Healthy: $healthy, Unhealthy: $unhealthy"
```
## Environment Variables
- `TRUSTGRAPH_URL`: Default API URL
## Related Commands
- [`tg-get-flow-class`](tg-get-flow-class.md) - Retrieve specific flow class definitions
- [`tg-put-flow-class`](tg-put-flow-class.md) - Create/update flow class definitions
- [`tg-delete-flow-class`](tg-delete-flow-class.md) - Delete flow class definitions
- [`tg-start-flow`](tg-start-flow.md) - Create flow instances from classes
- [`tg-show-flows`](tg-show-flows.md) - List active flow instances
## API Integration
This command uses the [Flow API](../apis/api-flow.md) with the `list-classes` operation to retrieve flow class listings.
## Best Practices
1. **Regular Inventory**: Periodically review available flow classes
2. **Documentation**: Ensure flow classes have meaningful descriptions
3. **Tagging**: Use consistent tagging for better organization
4. **Cleanup**: Remove unused or deprecated flow classes
5. **Monitoring**: Include flow class health checks in monitoring
6. **Environment Parity**: Keep flow classes synchronized across environments
## Troubleshooting
### No Output
```bash
# If command returns no output, check API connectivity
tg-show-flow-classes -u http://localhost:8088/
# Verify TrustGraph is running and accessible
```
### Formatting Issues
```bash
# If table formatting is broken, check terminal width
export COLUMNS=120
tg-show-flow-classes
```
### Missing Flow Classes
```bash
# If expected flow classes are missing, verify:
# 1. Correct API URL
# 2. Database connectivity
# 3. Flow class definitions are properly stored
```

View file

@ -1,6 +1,6 @@
# tg-show-flow-state
Displays the processor states for a specific flow and its associated flow class.
Displays the processor states for a specific flow and its associated flow blueprint.
## Synopsis
@ -10,7 +10,7 @@ tg-show-flow-state [options]
## Description
The `tg-show-flow-state` command shows the current state of processors within a specific TrustGraph flow instance and its corresponding flow class. It queries the metrics system to determine which processing components are running and displays their status with visual indicators.
The `tg-show-flow-state` command shows the current state of processors within a specific TrustGraph flow instance and its corresponding flow blueprint. It queries the metrics system to determine which processing components are running and displays their status with visual indicators.
This command is essential for monitoring flow health and debugging processing issues.
@ -51,7 +51,7 @@ tg-show-flow-state \
## Output Format
The command displays processor states for both the flow instance and its flow class:
The command displays processor states for both the flow instance and its flow blueprint:
```
Flow production-flow
@ -75,7 +75,7 @@ Class document-processing-v2
### Information Displayed
- **Flow Section**: Shows the state of processors in the specific flow instance
- **Class Section**: Shows the state of processors in the flow class template
- **Class Section**: Shows the state of processors in the flow blueprint template
- **Processor Names**: Individual processing components within the flow
## Use Cases

View file

@ -135,7 +135,7 @@ Exception: Unauthorized
- [`tg-start-flow`](tg-start-flow.md) - Start a new flow instance
- [`tg-stop-flow`](tg-stop-flow.md) - Stop a running flow
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes
- [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-show-flow-state`](tg-show-flow-state.md) - Show detailed flow status
- [`tg-show-config`](tg-show-config.md) - Show complete system configuration
@ -186,7 +186,7 @@ tg-show-flows | grep "graph-rag request"
### Flow Information
- **id**: Unique flow instance identifier
- **class**: Flow class name used to create the instance
- **class**: Flow blueprint name used to create the instance
- **desc**: Human-readable flow description
- **queue**: Service interfaces and their Pulsar queue names
@ -196,7 +196,7 @@ Queue names indicate:
- **Tenant**: Usually `tg`
- **Namespace**: `request`, `response`, or `flow`
- **Service**: The specific service name
- **Flow Identifier**: Either flow class or flow ID
- **Flow Identifier**: Either flow blueprint or flow ID
## Best Practices

View file

@ -1,6 +1,6 @@
# tg-start-flow
Starts a processing flow using a defined flow class.
Starts a processing flow using a defined flow blueprint.
## Synopsis
@ -10,7 +10,7 @@ tg-start-flow -n CLASS_NAME -i FLOW_ID -d DESCRIPTION [options]
## Description
The `tg-start-flow` command creates and starts a new processing flow instance based on a predefined flow class. Flow classes define the processing pipeline configuration, while flow instances are running implementations of those classes with specific identifiers.
The `tg-start-flow` command creates and starts a new processing flow instance based on a predefined flow blueprint. Flow blueprintes define the processing pipeline configuration, while flow instances are running implementations of those classes with specific identifiers.
Once started, a flow provides endpoints for document processing, knowledge queries, and other TrustGraph services through its configured interfaces.
@ -18,7 +18,7 @@ Once started, a flow provides endpoints for document processing, knowledge queri
### Required Arguments
- `-n, --class-name CLASS_NAME`: Name of the flow class to instantiate
- `-n, --blueprint-name CLASS_NAME`: Name of the flow blueprint to instantiate
- `-i, --flow-id FLOW_ID`: Unique identifier for the new flow instance
- `-d, --description DESCRIPTION`: Human-readable description of the flow
@ -36,7 +36,7 @@ tg-start-flow \
-d "Research document processing pipeline"
```
### Start Custom Flow Class
### Start Custom Flow Blueprint
```bash
tg-start-flow \
-n "medical-analysis" \
@ -55,15 +55,15 @@ tg-start-flow \
## Prerequisites
### Flow Class Must Exist
Before starting a flow, the flow class must be available in the system:
### Flow Blueprint Must Exist
Before starting a flow, the flow blueprint must be available in the system:
```bash
# Check available flow classes
tg-show-flow-classes
# Check available flow blueprintes
tg-show-flow-blueprints
# Upload a flow class if needed
tg-put-flow-class -n "my-class" -f flow-definition.json
# Upload a flow blueprint if needed
tg-put-flow-blueprint -n "my-class" -f flow-definition.json
```
### System Requirements
@ -73,7 +73,7 @@ tg-put-flow-class -n "my-class" -f flow-definition.json
## Flow Lifecycle
1. **Flow Class Definition**: Flow classes define processing pipelines
1. **Flow Blueprint Definition**: Flow blueprintes define processing pipelines
2. **Flow Instance Creation**: `tg-start-flow` creates a running instance
3. **Service Availability**: Flow provides configured service endpoints
4. **Processing**: Documents and queries can be processed through the flow
@ -81,11 +81,11 @@ tg-put-flow-class -n "my-class" -f flow-definition.json
## Error Handling
### Flow Class Not Found
### Flow Blueprint Not Found
```bash
Exception: Flow class 'invalid-class' not found
Exception: Flow blueprint 'invalid-class' not found
```
**Solution**: Check available flow classes with `tg-show-flow-classes` and ensure the class name is correct.
**Solution**: Check available flow blueprintes with `tg-show-flow-blueprints` and ensure the class name is correct.
### Flow ID Already Exists
```bash
@ -137,8 +137,8 @@ Once started, flows provide service interfaces based on their class definition.
- [`tg-stop-flow`](tg-stop-flow.md) - Stop a running flow
- [`tg-show-flows`](tg-show-flows.md) - List active flows and their interfaces
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes
- [`tg-put-flow-class`](tg-put-flow-class.md) - Upload/update flow class definitions
- [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
- [`tg-put-flow-blueprint`](tg-put-flow-blueprint.md) - Upload/update flow blueprint definitions
- [`tg-show-flow-state`](tg-show-flow-state.md) - Check flow status
## API Integration

View file

@ -434,7 +434,7 @@ Exception: Processing ID already exists
```bash
Exception: Flow instance not found
```
**Solution**: Verify flow exists with `tg-show-flows` or `tg-show-flow-classes`.
**Solution**: Verify flow exists with `tg-show-flows` or `tg-show-flow-blueprints`.
### Insufficient Resources
```bash

View file

@ -171,7 +171,7 @@ done
- [`tg-start-flow`](tg-start-flow.md) - Start a new flow instance
- [`tg-show-flows`](tg-show-flows.md) - List active flows
- [`tg-show-flow-state`](tg-show-flow-state.md) - Check detailed flow status
- [`tg-show-flow-classes`](tg-show-flow-classes.md) - List available flow classes
- [`tg-show-flow-blueprints`](tg-show-flow-blueprints.md) - List available flow blueprintes
## API Integration