Skip to content

Commit de7a607

Browse files
fix: expose n8n sync/export API and correct run command hints
Agent-Logs-Url: https://github.com/MervinPraison/PraisonAI/sessions/05dfa034-6016-4d31-8674-1626f148ceea Co-authored-by: MervinPraison <454862+MervinPraison@users.noreply.github.com>
1 parent 05dd2a3 commit de7a607

File tree

3 files changed

+30
-6
lines changed

3 files changed

+30
-6
lines changed

src/praisonai/praisonai/cli/commands/n8n.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def import_workflow(
101101
yaml_lib.dump(yaml_workflow, f, default_flow_style=False, sort_keys=False)
102102

103103
typer.echo(f"✅ Imported workflow to: {output}")
104-
typer.echo(f"💡 Run 'praisonai workflow run {output}' to execute the workflow")
104+
typer.echo(f"💡 Run 'praisonai run {output}' to execute the workflow")
105105

106106
except ImportError:
107107
typer.echo("Error: n8n dependencies not installed. Run: pip install 'praisonai[n8n]'", err=True)
@@ -183,7 +183,7 @@ def pull(
183183
)
184184

185185
typer.echo(f"✅ Pulled workflow {workflow_id} to: {output_path}")
186-
typer.echo(f"💡 Run 'praisonai workflow run {output_path}' to execute the workflow")
186+
typer.echo(f"💡 Run 'praisonai run {output_path}' to execute the workflow")
187187

188188
except ImportError:
189189
typer.echo("Error: n8n dependencies not installed. Run: pip install 'praisonai[n8n]'", err=True)
@@ -318,4 +318,4 @@ def list_workflows(
318318
raise typer.Exit(1)
319319
except Exception as e:
320320
typer.echo(f"Error: {e}", err=True)
321-
raise typer.Exit(1)
321+
raise typer.Exit(1)

src/praisonai/praisonai/n8n/__init__.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
if TYPE_CHECKING:
2626
from .converter import YAMLToN8nConverter
2727
from .reverse_converter import N8nToYAMLConverter
28-
from .preview import preview_workflow
28+
from .preview import preview_workflow, export_from_n8n, sync_workflow
2929
from .client import N8nClient
3030

3131
# Lazy imports for optional dependencies
@@ -39,6 +39,12 @@ def __getattr__(name: str):
3939
elif name == "preview_workflow":
4040
from .preview import preview_workflow
4141
return preview_workflow
42+
elif name == "export_from_n8n":
43+
from .preview import export_from_n8n
44+
return export_from_n8n
45+
elif name == "sync_workflow":
46+
from .preview import sync_workflow
47+
return sync_workflow
4248
elif name == "N8nClient":
4349
from .client import N8nClient
4450
return N8nClient
@@ -49,5 +55,7 @@ def __getattr__(name: str):
4955
"YAMLToN8nConverter",
5056
"N8nToYAMLConverter",
5157
"preview_workflow",
58+
"export_from_n8n",
59+
"sync_workflow",
5260
"N8nClient",
53-
]
61+
]

src/praisonai/tests/test_n8n_integration.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,22 @@ def test_preview_workflow_import(self):
8383
except ImportError:
8484
pytest.skip("n8n dependencies not available")
8585

86+
def test_export_from_n8n_import(self):
87+
"""Test that export_from_n8n can be imported."""
88+
try:
89+
from praisonai.n8n import export_from_n8n
90+
assert export_from_n8n is not None
91+
except ImportError:
92+
pytest.skip("n8n dependencies not available")
93+
94+
def test_sync_workflow_import(self):
95+
"""Test that sync_workflow can be imported."""
96+
try:
97+
from praisonai.n8n import sync_workflow
98+
assert sync_workflow is not None
99+
except ImportError:
100+
pytest.skip("n8n dependencies not available")
101+
86102
def test_yaml_to_n8n_conversion(self, sample_agents_yaml_dict):
87103
"""Test basic YAML to n8n conversion."""
88104
try:
@@ -470,4 +486,4 @@ def test_round_trip_conversion(self):
470486

471487

472488
if __name__ == "__main__":
473-
pytest.main([__file__, "-v"])
489+
pytest.main([__file__, "-v"])

0 commit comments

Comments
 (0)