Improve validation tool robustness and fix documentation link

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-10 23:33:00 +00:00
parent 73f009bde8
commit 5fbc911909
2 changed files with 17 additions and 8 deletions

View File

@@ -5,11 +5,14 @@ import sys
from pathlib import Path
from typing import List, Tuple
# Add the backend directory to the path to import the schema module
backend_dir = Path(__file__).parent.parent.parent
sys.path.insert(0, str(backend_dir))
from autometabuilder.workflow.n8n_schema import N8NWorkflow
# Import the schema module - try direct import first (when installed via poetry)
# If that fails, add parent directory to path (for direct script execution)
try:
from autometabuilder.workflow.n8n_schema import N8NWorkflow
except ImportError:
backend_dir = Path(__file__).resolve().parent.parent.parent
sys.path.insert(0, str(backend_dir))
from autometabuilder.workflow.n8n_schema import N8NWorkflow
def find_workflow_files(base_path: Path) -> List[Path]:
@@ -75,8 +78,14 @@ def validate_workflow_file(workflow_path: Path) -> Tuple[bool, str]:
def main():
"""Main function to validate all workflow files."""
# Find the backend directory
script_dir = Path(__file__).parent.parent.parent / "autometabuilder"
# Find the autometabuilder directory by looking for the packages subdirectory
# This works whether run as a script or via poetry command
script_dir = Path(__file__).resolve().parent.parent
# Verify we found the right directory
if not (script_dir / "packages").exists():
print("Error: Could not locate autometabuilder/packages directory")
return 1
# Find all workflow files
workflow_files = find_workflow_files(script_dir)

View File

@@ -4,7 +4,7 @@ This repository includes a validation tool for workflow JSON files based on the
## Schema Definition
The workflow JSON schema is defined in [ROADMAP.md](ROADMAP.md) (lines 84-430). It defines the structure for N8N-style workflows with the following key requirements:
The workflow JSON schema is defined in [ROADMAP.md](../ROADMAP.md) (lines 84-430). It defines the structure for N8N-style workflows with the following key requirements:
- **Required fields**: `name`, `nodes`, `connections`
- **Nodes**: Must contain at least 1 node with `id`, `name`, `type`, `typeVersion`, and `position`