diff --git a/docs/cli/tg-delete-flow-class.md b/docs/cli/tg-delete-flow-blueprint.md similarity index 53% rename from docs/cli/tg-delete-flow-class.md rename to docs/cli/tg-delete-flow-blueprint.md index cc3c58d8..c99fd6da 100644 --- a/docs/cli/tg-delete-flow-class.md +++ b/docs/cli/tg-delete-flow-blueprint.md @@ -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 " + echo "Usage: $0 " 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 diff --git a/docs/cli/tg-get-flow-class.md b/docs/cli/tg-get-flow-blueprint.md similarity index 52% rename from docs/cli/tg-get-flow-class.md rename to docs/cli/tg-get-flow-blueprint.md index c71b4367..1998c3b1 100644 --- a/docs/cli/tg-get-flow-class.md +++ b/docs/cli/tg-get-flow-blueprint.md @@ -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 " + echo "Usage: $0 " 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 ``` diff --git a/docs/cli/tg-put-flow-class.md b/docs/cli/tg-put-flow-blueprint.md similarity index 76% rename from docs/cli/tg-put-flow-class.md rename to docs/cli/tg-put-flow-blueprint.md index 7b62b5e4..059d4efa 100644 --- a/docs/cli/tg-put-flow-class.md +++ b/docs/cli/tg-put-flow-blueprint.md @@ -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", diff --git a/docs/cli/tg-show-flow-blueprints.md b/docs/cli/tg-show-flow-blueprints.md new file mode 100644 index 00000000..40667dda --- /dev/null +++ b/docs/cli/tg-show-flow-blueprints.md @@ -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 +``` \ No newline at end of file diff --git a/docs/cli/tg-show-flow-classes.md b/docs/cli/tg-show-flow-classes.md deleted file mode 100644 index f81d9331..00000000 --- a/docs/cli/tg-show-flow-classes.md +++ /dev/null @@ -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 -``` \ No newline at end of file diff --git a/trustgraph-cli/trustgraph/cli/show_flow_state.py b/trustgraph-cli/trustgraph/cli/show_flow_state.py index 6ca4df8f..d5d87f2c 100644 --- a/trustgraph-cli/trustgraph/cli/show_flow_state.py +++ b/trustgraph-cli/trustgraph/cli/show_flow_state.py @@ -16,15 +16,15 @@ def dump_status(metrics_url, api_url, flow_id, token=None): api = Api(api_url, token=token).flow() flow = api.get(flow_id) - class_name = flow["class-name"] + blueprint_name = flow["blueprint-name"] print() print(f"Flow {flow_id}") show_processors(metrics_url, flow_id) print() - print(f"Class {class_name}") - show_processors(metrics_url, class_name) + print(f"Blueprint {blueprint_name}") + show_processors(metrics_url, blueprint_name) print()