Command-line interface for workflow database.
()
| 793 | |
| 794 | |
| 795 | def main(): |
| 796 | """Command-line interface for workflow database.""" |
| 797 | import argparse |
| 798 | |
| 799 | parser = argparse.ArgumentParser(description="N8N Workflow Database") |
| 800 | parser.add_argument("--index", action="store_true", help="Index all workflows") |
| 801 | parser.add_argument("--force", action="store_true", help="Force reindex all files") |
| 802 | parser.add_argument("--search", help="Search workflows") |
| 803 | parser.add_argument("--stats", action="store_true", help="Show database statistics") |
| 804 | |
| 805 | args = parser.parse_args() |
| 806 | |
| 807 | db = WorkflowDatabase() |
| 808 | |
| 809 | if args.index: |
| 810 | stats = db.index_all_workflows(force_reindex=args.force) |
| 811 | print(f"Indexed {stats['processed']} workflows") |
| 812 | |
| 813 | elif args.search: |
| 814 | results, total = db.search_workflows(args.search, limit=10) |
| 815 | print(f"Found {total} workflows:") |
| 816 | for workflow in results: |
| 817 | print( |
| 818 | f" - {workflow['name']} ({workflow['trigger_type']}, {workflow['node_count']} nodes)" |
| 819 | ) |
| 820 | |
| 821 | elif args.stats: |
| 822 | stats = db.get_stats() |
| 823 | print("Database Statistics:") |
| 824 | print(f" Total workflows: {stats['total']}") |
| 825 | print(f" Active: {stats['active']}") |
| 826 | print(f" Total nodes: {stats['total_nodes']}") |
| 827 | print(f" Unique integrations: {stats['unique_integrations']}") |
| 828 | print(f" Trigger types: {stats['triggers']}") |
| 829 | |
| 830 | else: |
| 831 | parser.print_help() |
| 832 | |
| 833 | |
| 834 | if __name__ == "__main__": |
no test coverage detected