Skip to main content

CLI harness for n8n workflow automation — CLI-Anything pattern (n8n API v1.1.1)

Project description

cli-anything-n8n

Python 3.10+ License: MIT CLI-Anything n8n API v1.1.1 n8n >= 1.0.0 Tests

Leer en Español | Read in English


English

CLI harness for n8n workflow automation — built with the CLI-Anything pattern.

Created as a community contribution to bring n8n into the CLI-Anything ecosystem. Verified against the n8n OpenAPI spec v1.1.1 (n8n 2.43.0) — only endpoints that actually exist in the public API are exposed.

Features

  • Verified n8n Public API coverage: workflows, executions, credentials, variables, tags
  • Interactive REPL mode with colored output, truncation indicators, and table formatting
  • JSON output for AI agent consumption (--json)
  • Config persistence at ~/.cli-anything/n8n/config.json
  • Robust error handling: clean messages for HTTP errors, connection failures, invalid JSON
  • PEP 420 namespace packaging — coexists with other CLI-Anything harnesses

Quick Start

pip install cli-anything-n8n

# Configure
export N8N_BASE_URL=https://your-n8n.example.com
export N8N_API_KEY=your-api-key

# Use
cli-anything-n8n workflow list
cli-anything-n8n --json execution list --status error
cli-anything-n8n tag create "production"

Or use the interactive REPL:

cli-anything-n8n
n8n> workflow list --active
n8n> execution list --status error
n8n> exit

Command Groups

Group Commands API Endpoints
workflow list, get, create, update, delete, activate, deactivate, tags, set-tags, transfer 9
execution list, get, delete, retry 4
credential create, delete, schema, transfer 4
variable list, create, update, delete 4
tag list, get, create, update, delete 5
config show, set -

Note: Some n8n features (Data Tables, credential listing, execution stop) are not available through the public API. This CLI only exposes verified, working endpoints.

Configuration

Three ways to configure (in priority order):

  1. CLI flags: --url and --api-key
  2. Environment variables: N8N_BASE_URL, N8N_API_KEY, N8N_TIMEOUT
  3. Config file: cli-anything-n8n config set base_url https://...

For AI Agents

  • Always use --json for structured, parseable output
  • Use @file.json to pass complex JSON payloads
  • Check return codes: 0 = success, non-zero = error
  • Workflow and execution IDs are strings
  • Set N8N_TIMEOUT env var for long-running operations (default: 30s)

n8n Compatibility

n8n Version API Version Status
>= 1.0.0 v1.1.1 Verified
2.43.0 v1.1.1 Tested (E2E)

Development

git clone https://github.com/webcomunicasolutions/cli-n8n.git
cd cli-n8n
pip install -e .
pytest cli_anything/n8n/tests/test_core.py -v        # unit tests (no n8n needed)
pytest cli_anything/n8n/tests/test_full_e2e.py -v     # E2E (requires running n8n)

Architecture

cli_anything/n8n/
├── n8n_cli.py              # Click CLI + REPL
├── core/                   # Business logic (thin API wrappers)
│   ├── workflows.py        # Workflow CRUD, activate/deactivate, tags, transfer
│   ├── executions.py       # Execution list, get, delete, retry
│   ├── credentials.py      # Credential create, delete, schema, transfer
│   ├── variables.py        # Variable CRUD
│   ├── tags.py             # Tag CRUD
│   └── project.py          # Config load/save
├── utils/
│   ├── n8n_backend.py      # HTTP client (sole point of contact with n8n API)
│   └── repl_skin.py        # Terminal UI (banner, colors, tables)
├── skills/
│   └── SKILL.md            # AI agent discovery document
└── tests/
    ├── test_core.py        # Unit tests (mocked)
    └── test_full_e2e.py    # E2E lifecycle tests

License

MIT


Español

CLI harness para n8n (automatizacion de workflows) — construido con el patron CLI-Anything.

Creado como contribucion a la comunidad para integrar n8n en el ecosistema CLI-Anything. Verificado contra la especificacion OpenAPI v1.1.1 de n8n (n8n 2.43.0) — solo se exponen endpoints que realmente existen en la API publica.

Caracteristicas

  • Cobertura verificada de la API publica de n8n: workflows, ejecuciones, credenciales, variables, tags
  • Modo REPL interactivo con salida coloreada, indicadores de truncado y tablas
  • Salida JSON para consumo por agentes IA (--json)
  • Configuracion persistente en ~/.cli-anything/n8n/config.json
  • Manejo robusto de errores: mensajes claros para errores HTTP, fallos de conexion, JSON invalido
  • PEP 420 namespace packaging — coexiste con otros harnesses de CLI-Anything

Inicio rapido

pip install cli-anything-n8n

# Configurar
export N8N_BASE_URL=https://tu-instancia-n8n.example.com
export N8N_API_KEY=tu-api-key

# Usar
cli-anything-n8n workflow list
cli-anything-n8n --json execution list --status error
cli-anything-n8n tag create "produccion"

Grupos de comandos

Grupo Comandos Endpoints API
workflow list, get, create, update, delete, activate, deactivate, tags, set-tags, transfer 9
execution list, get, delete, retry 4
credential create, delete, schema, transfer 4
variable list, create, update, delete 4
tag list, get, create, update, delete 5
config show, set -

Nota: Algunas funcionalidades de n8n (Data Tables, listar credenciales, parar ejecuciones) no estan disponibles via la API publica. Este CLI solo expone endpoints verificados y funcionales.

Compatibilidad con n8n

Version n8n Version API Estado
>= 1.0.0 v1.1.1 Verificado
2.43.0 v1.1.1 Testeado (E2E)

Desarrollo

git clone https://github.com/webcomunicasolutions/cli-n8n.git
cd cli-n8n
pip install -e .
pytest cli_anything/n8n/tests/test_core.py -v        # tests unitarios
pytest cli_anything/n8n/tests/test_full_e2e.py -v     # E2E (requiere n8n corriendo)

Licencia

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cli_anything_n8n-1.1.0.tar.gz (19.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cli_anything_n8n-1.1.0-py3-none-any.whl (24.3 kB view details)

Uploaded Python 3

File details

Details for the file cli_anything_n8n-1.1.0.tar.gz.

File metadata

  • Download URL: cli_anything_n8n-1.1.0.tar.gz
  • Upload date:
  • Size: 19.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for cli_anything_n8n-1.1.0.tar.gz
Algorithm Hash digest
SHA256 199658119e4340eb99054e8ce44ecda19dc47059ed01e53649fc23279ea3d319
MD5 f9d78e509fbb0531e653d2d6c4b6762b
BLAKE2b-256 aeabcbd0d0077b08937295b2d7b5ef0cccdf51f465fb42f5e221846613265251

See more details on using hashes here.

File details

Details for the file cli_anything_n8n-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for cli_anything_n8n-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eab3533f181233cac5be4e659aa18f3348bb768cad4859dc033cc42920f6d61d
MD5 ee1836f2ae8de225a6b4e30a6e9ee506
BLAKE2b-256 83c0924340ff901903526530e93ec54511f64061c06cb2bd5479d33e6036b8c2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page