{"id":28600599,"url":"https://github.com/edenreich/n8n-cli","last_synced_at":"2025-10-14T03:17:44.360Z","repository":{"id":292665979,"uuid":"981573658","full_name":"edenreich/n8n-cli","owner":"edenreich","description":"A simple n8n cli to sync workflows from Github to n8n using GitOps","archived":false,"fork":false,"pushed_at":"2025-09-20T20:28:37.000Z","size":320,"stargazers_count":9,"open_issues_count":2,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-20T21:16:34.615Z","etag":null,"topics":["apis","automation","cli","gitops","integrations","n8n","no-code","workflow","workflows"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/edenreich.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-11T12:21:18.000Z","updated_at":"2025-09-20T19:53:06.000Z","dependencies_parsed_at":"2025-09-20T21:06:31.276Z","dependency_job_id":"905fb191-2e39-41ce-97db-bcbabf3f42bc","html_url":"https://github.com/edenreich/n8n-cli","commit_stats":null,"previous_names":["edenreich/n8n-cli"],"tags_count":23,"template":false,"template_full_name":null,"purl":"pkg:github/edenreich/n8n-cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fn8n-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fn8n-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fn8n-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fn8n-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/edenreich","download_url":"https://codeload.github.com/edenreich/n8n-cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/edenreich%2Fn8n-cli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279017788,"owners_count":26086143,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-14T02:00:06.444Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apis","automation","cli","gitops","integrations","n8n","no-code","workflow","workflows"],"created_at":"2025-06-11T14:03:28.731Z","updated_at":"2025-10-14T03:17:44.341Z","avatar_url":"https://github.com/edenreich.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eN8N Command Line Interface (CLI)\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/edenreich/n8n-cli/actions/workflows/ci.yml\"\u003e\n    \u003cimg src=\"https://github.com/edenreich/n8n-cli/actions/workflows/ci.yml/badge.svg\" alt=\"CI Status\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/edenreich/n8n-cli/releases\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/v/release/edenreich/n8n-cli\" alt=\"Latest Release\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://github.com/edenreich/n8n-cli/blob/main/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/github/license/edenreich/n8n-cli\" alt=\"License\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://goreportcard.com/report/github.com/edenreich/n8n-cli\"\u003e\n    \u003cimg src=\"https://goreportcard.com/badge/github.com/edenreich/n8n-cli\" alt=\"Go Report Card\"\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://pkg.go.dev/github.com/edenreich/n8n-cli\"\u003e\n    \u003cimg src=\"https://pkg.go.dev/badge/github.com/edenreich/n8n-cli.svg\" alt=\"Go Reference\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003eCommand line interface for managing n8n instances.\u003c/p\u003e\n\n## Table of Contents\n\n- [Installation](#installation)\n  - [Quick Install](#quick-install-linux-macos-windows-with-wsl)\n  - [Autocompletion](#autocompletion)\n  - [Manual Installation with Go](#manual-installation-with-go)\n- [Configuration](#configuration)\n- [Commands](#commands)\n  - [Version](#version)\n  - [Workflows](#workflows)\n    - [List](#list)\n    - [Refresh](#refresh)\n    - [Sync](#sync)\n    - [Activate](#activate)\n    - [Deactivate](#deactivate)\n- [Development](#development)\n- [Examples](#examples)\n  - [Contact Form Example](#contact-form-example)\n  - [AI-Enhanced Contact Form Example](#ai-enhanced-contact-form-example)\n\n## Installation\n\n### Quick Install (Linux, macOS, Windows with WSL)\n\n```bash\ncurl -sSLf https://raw.github.com/edenreich/n8n-cli/main/install.sh | sh\n```\n\nOr install a specific version:\n\n```bash\ncurl -sSLf https://raw.github.com/edenreich/n8n-cli/main/install.sh | sh -s -- --version v0.1.0-rc.1\n```\n\nThis script will automatically detect your operating system and architecture and install the appropriate binary.\n\n### Autocompletion\n\nTo enable auto completion for `bash`, `zsh`, or `fish`, run the following command:\n\n```bash\nsource \u003c(n8n completion bash) # for bash\nsource \u003c(n8n completion zsh)  # for zsh\nsource \u003c(n8n completion fish) # for fish\n```\n\nIf you need it permanently, add it to your shell's configuration file (e.g., `~/.bashrc`, `~/.zshrc`, or `~/.config/fish/config.fish`).\n\n### Manual Installation with Go\n\n```bash\ngo install github.com/edenreich/n8n-cli@latest\n```\n\n## Configuration\n\nCreate a `.env` file in your current directory. The CLI will automatically load environment variables from this file.\n\n```\nN8N_API_KEY=your_n8n_api_key\nN8N_INSTANCE_URL=https://your-instance.n8n.cloud\n```\n\nYou can generate an API key in the n8n UI under Settings \u003e API.\n\nAlternatively, you can set these environment variables directly in your shell:\n\n```bash\nexport N8N_API_KEY=your_n8n_api_key\nexport N8N_INSTANCE_URL=https://your-instance.n8n.cloud\n```\n\nNote: Environment variables set directly in your shell will take precedence over those defined in the `.env` file.\n\n**Important:** Never commit your `.env` file containing API credentials to version control systems like GitHub. Make sure to add `.env` to your `.gitignore` file to prevent accidental exposure of sensitive credentials.\n\n## Commands\n\n### Version\n\nDisplay the version information of the n8n CLI:\n\n```bash\nn8n --version\n# Or use the explicit command\nn8n version\n```\n\n### Workflows\n\nManage n8n workflows with various subcommands.\n\n#### List\n\nList workflows from an n8n instance:\n\n```bash\nn8n workflows list\n```\n\nOptions:\n\n- `--output, -o`: Output format (default: \"table\"). Supported formats:\n  - `table`: Human-readable tabular format\n  - `json`: JSON format for programmatic use\n  - `yaml`: YAML format for configuration files\n\nExamples:\n\n```bash\n# List workflows in default table format\nn8n workflows list\n\n# List workflows in JSON format\nn8n workflows list --output json\n\n# List workflows in YAML format\nn8n workflows list --output yaml\n```\n\n#### Refresh\n\nRefresh local workflow files with the current state from an n8n instance:\n\n```bash\nn8n workflows refresh --directory workflows/\n```\n\nThe refresh command is an essential step before syncing to ensure you don't accidentally delete or overwrite workflows on the remote n8n instance. It pulls the current state of the workflows from n8n and updates or creates the corresponding local files.\n\nOptions:\n\n- `--directory, -d`: Directory to store the workflow files (required)\n- `--dry-run`: Show what would be updated without making changes\n- `--overwrite`: Overwrite existing files even if they have a different name\n- `--output, -o`: Output format for new workflow files (json or yaml)\n- `--no-truncate`: Include all fields in output files, including null and optional fields (default: false)\n- `--all`: Refresh all workflows from n8n instance, not just those in the directory.\n\nExamples:\n\n```bash\n# Refresh only existing workflows in the directory\nn8n workflows refresh --directory workflows/\n\n# Refresh all workflows from n8n instance (including new ones)\nn8n workflows refresh --directory workflows/ --all\n\n# Preview what would be refreshed without making changes\nn8n workflows refresh --directory workflows/ --dry-run\n\n# Refresh workflows and save them as YAML files\nn8n workflows refresh --directory workflows/ --output yaml\n\n# Refresh workflows without minimizing the JSON/YAML output\nn8n workflows refresh --directory workflows/ --no-truncate\n```\n\n#### Sync\n\nSynchronize JSON workflows from a local directory to an n8n instance:\n\n```bash\nn8n workflows sync --directory workflows/\n```\n\nOptions:\n\n- `--directory, -d`: Directory containing workflow JSON/YAML files (required)\n- `--dry-run`: Show what would be done without making changes\n- `--prune`: Remove workflows from the n8n instance that are not present in the local directory\n- `--refresh`: Refresh the local state with the remote state after sync (default: true)\n- `--output, -o`: Output format for refreshed workflow files (json or yaml). If not specified, uses the existing file extension in the directory\n- `--all`: Refresh all workflows from n8n instance when refreshing, not just those in the directory\n\nHow the sync command handles workflow IDs:\n\n1. If a workflow file contains an ID:\n   - If that ID exists on the n8n instance, the workflow will be updated\n   - If that ID doesn't exist on the n8n instance, a new workflow will be created (n8n API doesn't allow specifying IDs when creating workflows)\n2. If a workflow file doesn't have an ID, a new workflow will be created with a server-generated ID\n\nThis ensures that workflows maintain their IDs across different environments and prevents duplication.\n\nExample:\n\n```bash\n# Sync workflows to the n8n instance\nn8n workflows sync --directory workflows/\n\n# Test without making changes\nn8n workflows sync --directory workflows/ --dry-run\n\n# Sync workflows and remove any remote workflows not in the local directory\nn8n workflows sync --directory workflows/ --prune\n\n# Sync workflows and refresh as JSON (overrides existing format)\nn8n workflows sync --directory workflows/ --output json\n\n# Sync workflows and refresh all workflows from n8n instance (including ones not in local directory)\nn8n workflows sync --directory workflows/ --all\n\n# Sync workflows without refreshing the local state afterward\nn8n workflows sync --directory workflows/ --refresh=false\n```\n\n#### Activate\n\nActivate a specific workflow by ID:\n\n```bash\nn8n workflows activate WORKFLOW_ID\n```\n\nThis command activates a workflow in the n8n instance, making it ready to be triggered by events.\n\n#### Deactivate\n\nDeactivate a specific workflow by ID:\n\n```bash\nn8n workflows deactivate WORKFLOW_ID\n```\n\nThis command deactivates a workflow in the n8n instance, stopping it from being triggered by events.\n\n## Development\n\n### Available Tasks\n\nThe project uses [Taskfile](https://taskfile.dev) for automating common development operations:\n\n```bash\n# Run unit tests\ntask test-unit\n\n# Run integration tests\ntask test-integration\n\n# Run all tests\ntask test-all\n\n# Run linting\ntask lint\n\n# Build the CLI\ntask build\n\n# Run the CLI during development (args are passed to the CLI)\ntask cli -- workflows list\n```\n\n## Examples\n\nThe project includes practical examples to help you understand how to use the n8n-cli in real-world scenarios:\n\n### Contact Form Example\n\nA basic example that demonstrates how to set up a contact form workflow in n8n and synchronize it using the n8n-cli:\n\n- HTML contact form\n- n8n workflow for processing form submissions\n- GitHub Actions workflow for automated synchronization\n\n[View Contact Form Example](examples/contact-form/README.md)\n\n### AI-Enhanced Contact Form Example\n\nAn advanced example that builds upon the basic contact form by adding AI capabilities:\n\n- AI-powered message processing (summarization, sentiment analysis, categorization)\n- Response suggestions generated by AI\n\n[View AI-Enhanced Contact Form Example](examples/contact-form-ai/README.md)\n\nThese examples include complete workflow definitions, HTML templates, and detailed setup instructions.\n\n## Contributing\n\nWe welcome contributions! Please see the [CONTRIBUTING.md](CONTRIBUTING.md) guide for details on how to set up the development environment, project structure, testing, and the pull request process.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedenreich%2Fn8n-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fedenreich%2Fn8n-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fedenreich%2Fn8n-cli/lists"}