cli-anything-n8n 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- cli_anything_n8n-1.1.0/LICENSE +21 -0
- cli_anything_n8n-1.1.0/PKG-INFO +226 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/README.md +193 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/__init__.py +1 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/__main__.py +5 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/core/__init__.py +0 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/core/credentials.py +33 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/core/executions.py +52 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/core/project.py +49 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/core/tags.py +32 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/core/variables.py +28 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/core/workflows.py +70 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/n8n_cli.py +481 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/skills/SKILL.md +50 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/tests/__init__.py +0 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/tests/test_core.py +257 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/tests/test_full_e2e.py +169 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/utils/__init__.py +0 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/utils/n8n_backend.py +98 -0
- cli_anything_n8n-1.1.0/cli_anything/n8n/utils/repl_skin.py +122 -0
- cli_anything_n8n-1.1.0/cli_anything_n8n.egg-info/PKG-INFO +226 -0
- cli_anything_n8n-1.1.0/cli_anything_n8n.egg-info/SOURCES.txt +26 -0
- cli_anything_n8n-1.1.0/cli_anything_n8n.egg-info/dependency_links.txt +1 -0
- cli_anything_n8n-1.1.0/cli_anything_n8n.egg-info/entry_points.txt +2 -0
- cli_anything_n8n-1.1.0/cli_anything_n8n.egg-info/requires.txt +3 -0
- cli_anything_n8n-1.1.0/cli_anything_n8n.egg-info/top_level.txt +1 -0
- cli_anything_n8n-1.1.0/pyproject.toml +60 -0
- cli_anything_n8n-1.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Juan Jose Sanchez Bernal / Webcomunica Soluciones Informaticas
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: cli-anything-n8n
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: CLI harness for n8n workflow automation — CLI-Anything pattern (n8n API v1.1.1)
|
|
5
|
+
Author-email: Juan Jose Sanchez Bernal <info@webcomunica.solutions>
|
|
6
|
+
Maintainer-email: Webcomunica Soluciones Informaticas <info@webcomunica.solutions>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Homepage, https://webcomunica.solutions
|
|
9
|
+
Project-URL: Documentation, https://optimizaconia.es
|
|
10
|
+
Project-URL: Repository, https://github.com/webcomunicasolutions/cli-n8n
|
|
11
|
+
Project-URL: Issues, https://github.com/webcomunicasolutions/cli-n8n/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/webcomunicasolutions/cli-n8n/blob/main/CHANGELOG.md
|
|
13
|
+
Keywords: n8n,cli,workflow,automation,cli-anything,ai-agent
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Intended Audience :: Developers
|
|
17
|
+
Classifier: Intended Audience :: System Administrators
|
|
18
|
+
Classifier: Operating System :: OS Independent
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Classifier: Topic :: System :: Systems Administration
|
|
26
|
+
Classifier: Topic :: Utilities
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: click>=8.0.0
|
|
31
|
+
Requires-Dist: prompt-toolkit>=3.0.0
|
|
32
|
+
Requires-Dist: requests>=2.28.0
|
|
33
|
+
|
|
34
|
+
# cli-anything-n8n
|
|
35
|
+
|
|
36
|
+
[](https://www.python.org/downloads/)
|
|
37
|
+
[](https://opensource.org/licenses/MIT)
|
|
38
|
+
[](https://github.com/HKUDS/CLI-Anything)
|
|
39
|
+
[](https://docs.n8n.io/api/api-reference/)
|
|
40
|
+
[]()
|
|
41
|
+
[]()
|
|
42
|
+
|
|
43
|
+
> [Leer en Español](#spanish) | [Read in English](#english)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
<a id="english"></a>
|
|
48
|
+
|
|
49
|
+
## English
|
|
50
|
+
|
|
51
|
+
CLI harness for [n8n](https://n8n.io) workflow automation — built with the [CLI-Anything](https://github.com/HKUDS/CLI-Anything) pattern.
|
|
52
|
+
|
|
53
|
+
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.
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
- **Verified n8n Public API coverage**: workflows, executions, credentials, variables, tags
|
|
58
|
+
- **Interactive REPL mode** with colored output, truncation indicators, and table formatting
|
|
59
|
+
- **JSON output** for AI agent consumption (`--json`)
|
|
60
|
+
- **Config persistence** at `~/.cli-anything/n8n/config.json`
|
|
61
|
+
- **Robust error handling**: clean messages for HTTP errors, connection failures, invalid JSON
|
|
62
|
+
- **PEP 420 namespace packaging** — coexists with other CLI-Anything harnesses
|
|
63
|
+
|
|
64
|
+
### Quick Start
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
pip install cli-anything-n8n
|
|
68
|
+
|
|
69
|
+
# Configure
|
|
70
|
+
export N8N_BASE_URL=https://your-n8n.example.com
|
|
71
|
+
export N8N_API_KEY=your-api-key
|
|
72
|
+
|
|
73
|
+
# Use
|
|
74
|
+
cli-anything-n8n workflow list
|
|
75
|
+
cli-anything-n8n --json execution list --status error
|
|
76
|
+
cli-anything-n8n tag create "production"
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Or use the interactive REPL:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
cli-anything-n8n
|
|
83
|
+
n8n> workflow list --active
|
|
84
|
+
n8n> execution list --status error
|
|
85
|
+
n8n> exit
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Command Groups
|
|
89
|
+
|
|
90
|
+
| Group | Commands | API Endpoints |
|
|
91
|
+
|-------|----------|---------------|
|
|
92
|
+
| `workflow` | list, get, create, update, delete, activate, deactivate, tags, set-tags, transfer | 9 |
|
|
93
|
+
| `execution` | list, get, delete, retry | 4 |
|
|
94
|
+
| `credential` | create, delete, schema, transfer | 4 |
|
|
95
|
+
| `variable` | list, create, update, delete | 4 |
|
|
96
|
+
| `tag` | list, get, create, update, delete | 5 |
|
|
97
|
+
| `config` | show, set | - |
|
|
98
|
+
|
|
99
|
+
> **Note**: Some n8n features (Data Tables, credential listing, execution stop) are not available through the public API. This CLI only exposes verified, working endpoints.
|
|
100
|
+
|
|
101
|
+
### Configuration
|
|
102
|
+
|
|
103
|
+
Three ways to configure (in priority order):
|
|
104
|
+
|
|
105
|
+
1. **CLI flags**: `--url` and `--api-key`
|
|
106
|
+
2. **Environment variables**: `N8N_BASE_URL`, `N8N_API_KEY`, `N8N_TIMEOUT`
|
|
107
|
+
3. **Config file**: `cli-anything-n8n config set base_url https://...`
|
|
108
|
+
|
|
109
|
+
### For AI Agents
|
|
110
|
+
|
|
111
|
+
- Always use `--json` for structured, parseable output
|
|
112
|
+
- Use `@file.json` to pass complex JSON payloads
|
|
113
|
+
- Check return codes: 0 = success, non-zero = error
|
|
114
|
+
- Workflow and execution IDs are strings
|
|
115
|
+
- Set `N8N_TIMEOUT` env var for long-running operations (default: 30s)
|
|
116
|
+
|
|
117
|
+
### n8n Compatibility
|
|
118
|
+
|
|
119
|
+
| n8n Version | API Version | Status |
|
|
120
|
+
|-------------|-------------|--------|
|
|
121
|
+
| >= 1.0.0 | v1.1.1 | Verified |
|
|
122
|
+
| 2.43.0 | v1.1.1 | Tested (E2E) |
|
|
123
|
+
|
|
124
|
+
### Development
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
git clone https://github.com/webcomunicasolutions/cli-n8n.git
|
|
128
|
+
cd cli-n8n
|
|
129
|
+
pip install -e .
|
|
130
|
+
pytest cli_anything/n8n/tests/test_core.py -v # unit tests (no n8n needed)
|
|
131
|
+
pytest cli_anything/n8n/tests/test_full_e2e.py -v # E2E (requires running n8n)
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Architecture
|
|
135
|
+
|
|
136
|
+
```
|
|
137
|
+
cli_anything/n8n/
|
|
138
|
+
├── n8n_cli.py # Click CLI + REPL
|
|
139
|
+
├── core/ # Business logic (thin API wrappers)
|
|
140
|
+
│ ├── workflows.py # Workflow CRUD, activate/deactivate, tags, transfer
|
|
141
|
+
│ ├── executions.py # Execution list, get, delete, retry
|
|
142
|
+
│ ├── credentials.py # Credential create, delete, schema, transfer
|
|
143
|
+
│ ├── variables.py # Variable CRUD
|
|
144
|
+
│ ├── tags.py # Tag CRUD
|
|
145
|
+
│ └── project.py # Config load/save
|
|
146
|
+
├── utils/
|
|
147
|
+
│ ├── n8n_backend.py # HTTP client (sole point of contact with n8n API)
|
|
148
|
+
│ └── repl_skin.py # Terminal UI (banner, colors, tables)
|
|
149
|
+
├── skills/
|
|
150
|
+
│ └── SKILL.md # AI agent discovery document
|
|
151
|
+
└── tests/
|
|
152
|
+
├── test_core.py # Unit tests (mocked)
|
|
153
|
+
└── test_full_e2e.py # E2E lifecycle tests
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### License
|
|
157
|
+
|
|
158
|
+
MIT
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
<a id="spanish"></a>
|
|
163
|
+
|
|
164
|
+
## Español
|
|
165
|
+
|
|
166
|
+
CLI harness para [n8n](https://n8n.io) (automatizacion de workflows) — construido con el patron [CLI-Anything](https://github.com/HKUDS/CLI-Anything).
|
|
167
|
+
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
### Caracteristicas
|
|
171
|
+
|
|
172
|
+
- **Cobertura verificada de la API publica de n8n**: workflows, ejecuciones, credenciales, variables, tags
|
|
173
|
+
- **Modo REPL interactivo** con salida coloreada, indicadores de truncado y tablas
|
|
174
|
+
- **Salida JSON** para consumo por agentes IA (`--json`)
|
|
175
|
+
- **Configuracion persistente** en `~/.cli-anything/n8n/config.json`
|
|
176
|
+
- **Manejo robusto de errores**: mensajes claros para errores HTTP, fallos de conexion, JSON invalido
|
|
177
|
+
- **PEP 420 namespace packaging** — coexiste con otros harnesses de CLI-Anything
|
|
178
|
+
|
|
179
|
+
### Inicio rapido
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pip install cli-anything-n8n
|
|
183
|
+
|
|
184
|
+
# Configurar
|
|
185
|
+
export N8N_BASE_URL=https://tu-instancia-n8n.example.com
|
|
186
|
+
export N8N_API_KEY=tu-api-key
|
|
187
|
+
|
|
188
|
+
# Usar
|
|
189
|
+
cli-anything-n8n workflow list
|
|
190
|
+
cli-anything-n8n --json execution list --status error
|
|
191
|
+
cli-anything-n8n tag create "produccion"
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Grupos de comandos
|
|
195
|
+
|
|
196
|
+
| Grupo | Comandos | Endpoints API |
|
|
197
|
+
|-------|----------|---------------|
|
|
198
|
+
| `workflow` | list, get, create, update, delete, activate, deactivate, tags, set-tags, transfer | 9 |
|
|
199
|
+
| `execution` | list, get, delete, retry | 4 |
|
|
200
|
+
| `credential` | create, delete, schema, transfer | 4 |
|
|
201
|
+
| `variable` | list, create, update, delete | 4 |
|
|
202
|
+
| `tag` | list, get, create, update, delete | 5 |
|
|
203
|
+
| `config` | show, set | - |
|
|
204
|
+
|
|
205
|
+
> **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.
|
|
206
|
+
|
|
207
|
+
### Compatibilidad con n8n
|
|
208
|
+
|
|
209
|
+
| Version n8n | Version API | Estado |
|
|
210
|
+
|-------------|-------------|--------|
|
|
211
|
+
| >= 1.0.0 | v1.1.1 | Verificado |
|
|
212
|
+
| 2.43.0 | v1.1.1 | Testeado (E2E) |
|
|
213
|
+
|
|
214
|
+
### Desarrollo
|
|
215
|
+
|
|
216
|
+
```bash
|
|
217
|
+
git clone https://github.com/webcomunicasolutions/cli-n8n.git
|
|
218
|
+
cd cli-n8n
|
|
219
|
+
pip install -e .
|
|
220
|
+
pytest cli_anything/n8n/tests/test_core.py -v # tests unitarios
|
|
221
|
+
pytest cli_anything/n8n/tests/test_full_e2e.py -v # E2E (requiere n8n corriendo)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
### Licencia
|
|
225
|
+
|
|
226
|
+
MIT
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
# cli-anything-n8n
|
|
2
|
+
|
|
3
|
+
[](https://www.python.org/downloads/)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
[](https://github.com/HKUDS/CLI-Anything)
|
|
6
|
+
[](https://docs.n8n.io/api/api-reference/)
|
|
7
|
+
[]()
|
|
8
|
+
[]()
|
|
9
|
+
|
|
10
|
+
> [Leer en Español](#spanish) | [Read in English](#english)
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<a id="english"></a>
|
|
15
|
+
|
|
16
|
+
## English
|
|
17
|
+
|
|
18
|
+
CLI harness for [n8n](https://n8n.io) workflow automation — built with the [CLI-Anything](https://github.com/HKUDS/CLI-Anything) pattern.
|
|
19
|
+
|
|
20
|
+
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.
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
- **Verified n8n Public API coverage**: workflows, executions, credentials, variables, tags
|
|
25
|
+
- **Interactive REPL mode** with colored output, truncation indicators, and table formatting
|
|
26
|
+
- **JSON output** for AI agent consumption (`--json`)
|
|
27
|
+
- **Config persistence** at `~/.cli-anything/n8n/config.json`
|
|
28
|
+
- **Robust error handling**: clean messages for HTTP errors, connection failures, invalid JSON
|
|
29
|
+
- **PEP 420 namespace packaging** — coexists with other CLI-Anything harnesses
|
|
30
|
+
|
|
31
|
+
### Quick Start
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install cli-anything-n8n
|
|
35
|
+
|
|
36
|
+
# Configure
|
|
37
|
+
export N8N_BASE_URL=https://your-n8n.example.com
|
|
38
|
+
export N8N_API_KEY=your-api-key
|
|
39
|
+
|
|
40
|
+
# Use
|
|
41
|
+
cli-anything-n8n workflow list
|
|
42
|
+
cli-anything-n8n --json execution list --status error
|
|
43
|
+
cli-anything-n8n tag create "production"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Or use the interactive REPL:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
cli-anything-n8n
|
|
50
|
+
n8n> workflow list --active
|
|
51
|
+
n8n> execution list --status error
|
|
52
|
+
n8n> exit
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Command Groups
|
|
56
|
+
|
|
57
|
+
| Group | Commands | API Endpoints |
|
|
58
|
+
|-------|----------|---------------|
|
|
59
|
+
| `workflow` | list, get, create, update, delete, activate, deactivate, tags, set-tags, transfer | 9 |
|
|
60
|
+
| `execution` | list, get, delete, retry | 4 |
|
|
61
|
+
| `credential` | create, delete, schema, transfer | 4 |
|
|
62
|
+
| `variable` | list, create, update, delete | 4 |
|
|
63
|
+
| `tag` | list, get, create, update, delete | 5 |
|
|
64
|
+
| `config` | show, set | - |
|
|
65
|
+
|
|
66
|
+
> **Note**: Some n8n features (Data Tables, credential listing, execution stop) are not available through the public API. This CLI only exposes verified, working endpoints.
|
|
67
|
+
|
|
68
|
+
### Configuration
|
|
69
|
+
|
|
70
|
+
Three ways to configure (in priority order):
|
|
71
|
+
|
|
72
|
+
1. **CLI flags**: `--url` and `--api-key`
|
|
73
|
+
2. **Environment variables**: `N8N_BASE_URL`, `N8N_API_KEY`, `N8N_TIMEOUT`
|
|
74
|
+
3. **Config file**: `cli-anything-n8n config set base_url https://...`
|
|
75
|
+
|
|
76
|
+
### For AI Agents
|
|
77
|
+
|
|
78
|
+
- Always use `--json` for structured, parseable output
|
|
79
|
+
- Use `@file.json` to pass complex JSON payloads
|
|
80
|
+
- Check return codes: 0 = success, non-zero = error
|
|
81
|
+
- Workflow and execution IDs are strings
|
|
82
|
+
- Set `N8N_TIMEOUT` env var for long-running operations (default: 30s)
|
|
83
|
+
|
|
84
|
+
### n8n Compatibility
|
|
85
|
+
|
|
86
|
+
| n8n Version | API Version | Status |
|
|
87
|
+
|-------------|-------------|--------|
|
|
88
|
+
| >= 1.0.0 | v1.1.1 | Verified |
|
|
89
|
+
| 2.43.0 | v1.1.1 | Tested (E2E) |
|
|
90
|
+
|
|
91
|
+
### Development
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
git clone https://github.com/webcomunicasolutions/cli-n8n.git
|
|
95
|
+
cd cli-n8n
|
|
96
|
+
pip install -e .
|
|
97
|
+
pytest cli_anything/n8n/tests/test_core.py -v # unit tests (no n8n needed)
|
|
98
|
+
pytest cli_anything/n8n/tests/test_full_e2e.py -v # E2E (requires running n8n)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Architecture
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
cli_anything/n8n/
|
|
105
|
+
├── n8n_cli.py # Click CLI + REPL
|
|
106
|
+
├── core/ # Business logic (thin API wrappers)
|
|
107
|
+
│ ├── workflows.py # Workflow CRUD, activate/deactivate, tags, transfer
|
|
108
|
+
│ ├── executions.py # Execution list, get, delete, retry
|
|
109
|
+
│ ├── credentials.py # Credential create, delete, schema, transfer
|
|
110
|
+
│ ├── variables.py # Variable CRUD
|
|
111
|
+
│ ├── tags.py # Tag CRUD
|
|
112
|
+
│ └── project.py # Config load/save
|
|
113
|
+
├── utils/
|
|
114
|
+
│ ├── n8n_backend.py # HTTP client (sole point of contact with n8n API)
|
|
115
|
+
│ └── repl_skin.py # Terminal UI (banner, colors, tables)
|
|
116
|
+
├── skills/
|
|
117
|
+
│ └── SKILL.md # AI agent discovery document
|
|
118
|
+
└── tests/
|
|
119
|
+
├── test_core.py # Unit tests (mocked)
|
|
120
|
+
└── test_full_e2e.py # E2E lifecycle tests
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### License
|
|
124
|
+
|
|
125
|
+
MIT
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
<a id="spanish"></a>
|
|
130
|
+
|
|
131
|
+
## Español
|
|
132
|
+
|
|
133
|
+
CLI harness para [n8n](https://n8n.io) (automatizacion de workflows) — construido con el patron [CLI-Anything](https://github.com/HKUDS/CLI-Anything).
|
|
134
|
+
|
|
135
|
+
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.
|
|
136
|
+
|
|
137
|
+
### Caracteristicas
|
|
138
|
+
|
|
139
|
+
- **Cobertura verificada de la API publica de n8n**: workflows, ejecuciones, credenciales, variables, tags
|
|
140
|
+
- **Modo REPL interactivo** con salida coloreada, indicadores de truncado y tablas
|
|
141
|
+
- **Salida JSON** para consumo por agentes IA (`--json`)
|
|
142
|
+
- **Configuracion persistente** en `~/.cli-anything/n8n/config.json`
|
|
143
|
+
- **Manejo robusto de errores**: mensajes claros para errores HTTP, fallos de conexion, JSON invalido
|
|
144
|
+
- **PEP 420 namespace packaging** — coexiste con otros harnesses de CLI-Anything
|
|
145
|
+
|
|
146
|
+
### Inicio rapido
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
pip install cli-anything-n8n
|
|
150
|
+
|
|
151
|
+
# Configurar
|
|
152
|
+
export N8N_BASE_URL=https://tu-instancia-n8n.example.com
|
|
153
|
+
export N8N_API_KEY=tu-api-key
|
|
154
|
+
|
|
155
|
+
# Usar
|
|
156
|
+
cli-anything-n8n workflow list
|
|
157
|
+
cli-anything-n8n --json execution list --status error
|
|
158
|
+
cli-anything-n8n tag create "produccion"
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
### Grupos de comandos
|
|
162
|
+
|
|
163
|
+
| Grupo | Comandos | Endpoints API |
|
|
164
|
+
|-------|----------|---------------|
|
|
165
|
+
| `workflow` | list, get, create, update, delete, activate, deactivate, tags, set-tags, transfer | 9 |
|
|
166
|
+
| `execution` | list, get, delete, retry | 4 |
|
|
167
|
+
| `credential` | create, delete, schema, transfer | 4 |
|
|
168
|
+
| `variable` | list, create, update, delete | 4 |
|
|
169
|
+
| `tag` | list, get, create, update, delete | 5 |
|
|
170
|
+
| `config` | show, set | - |
|
|
171
|
+
|
|
172
|
+
> **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.
|
|
173
|
+
|
|
174
|
+
### Compatibilidad con n8n
|
|
175
|
+
|
|
176
|
+
| Version n8n | Version API | Estado |
|
|
177
|
+
|-------------|-------------|--------|
|
|
178
|
+
| >= 1.0.0 | v1.1.1 | Verificado |
|
|
179
|
+
| 2.43.0 | v1.1.1 | Testeado (E2E) |
|
|
180
|
+
|
|
181
|
+
### Desarrollo
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
git clone https://github.com/webcomunicasolutions/cli-n8n.git
|
|
185
|
+
cd cli-n8n
|
|
186
|
+
pip install -e .
|
|
187
|
+
pytest cli_anything/n8n/tests/test_core.py -v # tests unitarios
|
|
188
|
+
pytest cli_anything/n8n/tests/test_full_e2e.py -v # E2E (requiere n8n corriendo)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Licencia
|
|
192
|
+
|
|
193
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# cli_anything.n8n — CLI harness for n8n workflow automation
|
|
File without changes
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"""Credential management — create, delete, schema, transfer.
|
|
2
|
+
|
|
3
|
+
Note: n8n Public API v1.1.1 does NOT support listing or updating credentials
|
|
4
|
+
via GET/PATCH. This is by design — credentials contain sensitive data.
|
|
5
|
+
Available operations: POST (create), DELETE, GET schema, PUT transfer.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
from typing import Any
|
|
11
|
+
|
|
12
|
+
from cli_anything.n8n.utils.n8n_backend import (
|
|
13
|
+
api_delete,
|
|
14
|
+
api_get,
|
|
15
|
+
api_post,
|
|
16
|
+
api_put,
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def create_credential(data: dict[str, Any], *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
21
|
+
return api_post("/credentials", data, base_url=base_url, api_key=api_key)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def delete_credential(credential_id: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
25
|
+
return api_delete(f"/credentials/{credential_id}", base_url=base_url, api_key=api_key)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
def get_credential_schema(credential_type: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
29
|
+
return api_get(f"/credentials/schema/{credential_type}", base_url=base_url, api_key=api_key)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def transfer_credential(credential_id: str, project_id: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
33
|
+
return api_put(f"/credentials/{credential_id}/transfer", {"destinationProjectId": project_id}, base_url=base_url, api_key=api_key)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""Execution management — list, get, delete, retry.
|
|
2
|
+
|
|
3
|
+
Note: n8n Public API v1.1.1 does NOT support stop or tags on executions.
|
|
4
|
+
Available: GET list, GET detail, DELETE, POST retry.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
from typing import Any
|
|
10
|
+
|
|
11
|
+
from cli_anything.n8n.utils.n8n_backend import (
|
|
12
|
+
api_delete,
|
|
13
|
+
api_get,
|
|
14
|
+
api_post,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def list_executions(
|
|
19
|
+
*,
|
|
20
|
+
base_url: str | None = None,
|
|
21
|
+
api_key: str | None = None,
|
|
22
|
+
status: str | None = None,
|
|
23
|
+
workflow_id: str | None = None,
|
|
24
|
+
limit: int = 20,
|
|
25
|
+
cursor: str | None = None,
|
|
26
|
+
include_data: bool = False,
|
|
27
|
+
) -> Any:
|
|
28
|
+
params: dict[str, Any] = {"limit": limit}
|
|
29
|
+
if status:
|
|
30
|
+
params["status"] = status
|
|
31
|
+
if workflow_id:
|
|
32
|
+
params["workflowId"] = workflow_id
|
|
33
|
+
if cursor:
|
|
34
|
+
params["cursor"] = cursor
|
|
35
|
+
if include_data:
|
|
36
|
+
params["includeData"] = "true"
|
|
37
|
+
return api_get("/executions", base_url=base_url, api_key=api_key, params=params)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def get_execution(execution_id: str, *, base_url: str | None = None, api_key: str | None = None, include_data: bool = True) -> Any:
|
|
41
|
+
params: dict[str, Any] = {}
|
|
42
|
+
if include_data:
|
|
43
|
+
params["includeData"] = "true"
|
|
44
|
+
return api_get(f"/executions/{execution_id}", base_url=base_url, api_key=api_key, params=params)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def delete_execution(execution_id: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
48
|
+
return api_delete(f"/executions/{execution_id}", base_url=base_url, api_key=api_key)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def retry_execution(execution_id: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
52
|
+
return api_post(f"/executions/{execution_id}/retry", base_url=base_url, api_key=api_key)
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""Configuration management — load/save from JSON file + env vars."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import os
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
from typing import Any
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
CONFIG_DIR = Path.home() / ".cli-anything" / "n8n"
|
|
12
|
+
CONFIG_FILE = CONFIG_DIR / "config.json"
|
|
13
|
+
|
|
14
|
+
DEFAULTS: dict[str, Any] = {
|
|
15
|
+
"base_url": "",
|
|
16
|
+
"api_key": "",
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def load_config() -> dict[str, Any]:
|
|
21
|
+
"""Load config from file, overlaid with env vars."""
|
|
22
|
+
cfg = dict(DEFAULTS)
|
|
23
|
+
if CONFIG_FILE.exists():
|
|
24
|
+
with open(CONFIG_FILE) as f:
|
|
25
|
+
cfg.update(json.load(f))
|
|
26
|
+
if url := os.environ.get("N8N_BASE_URL"):
|
|
27
|
+
cfg["base_url"] = url
|
|
28
|
+
if key := os.environ.get("N8N_API_KEY"):
|
|
29
|
+
cfg["api_key"] = key
|
|
30
|
+
return cfg
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def save_config(cfg: dict[str, Any]) -> Path:
|
|
34
|
+
"""Persist config to disk."""
|
|
35
|
+
CONFIG_DIR.mkdir(parents=True, exist_ok=True)
|
|
36
|
+
with open(CONFIG_FILE, "w") as f:
|
|
37
|
+
json.dump(cfg, f, indent=2)
|
|
38
|
+
return CONFIG_FILE
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def get_connection(
|
|
42
|
+
base_url: str | None = None,
|
|
43
|
+
api_key: str | None = None,
|
|
44
|
+
) -> tuple[str, str]:
|
|
45
|
+
"""Resolve base_url and api_key from args > env > config file."""
|
|
46
|
+
cfg = load_config()
|
|
47
|
+
url = base_url or cfg["base_url"]
|
|
48
|
+
key = api_key or cfg["api_key"]
|
|
49
|
+
return url, key
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"""Tag management — CRUD."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from cli_anything.n8n.utils.n8n_backend import (
|
|
8
|
+
api_delete,
|
|
9
|
+
api_get,
|
|
10
|
+
api_post,
|
|
11
|
+
api_put,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def list_tags(*, base_url: str | None = None, api_key: str | None = None, limit: int = 50) -> Any:
|
|
16
|
+
return api_get("/tags", base_url=base_url, api_key=api_key, params={"limit": limit})
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def get_tag(tag_id: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
20
|
+
return api_get(f"/tags/{tag_id}", base_url=base_url, api_key=api_key)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def create_tag(name: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
24
|
+
return api_post("/tags", {"name": name}, base_url=base_url, api_key=api_key)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def update_tag(tag_id: str, name: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
28
|
+
return api_put(f"/tags/{tag_id}", {"name": name}, base_url=base_url, api_key=api_key)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def delete_tag(tag_id: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
32
|
+
return api_delete(f"/tags/{tag_id}", base_url=base_url, api_key=api_key)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Variable management — CRUD."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
from cli_anything.n8n.utils.n8n_backend import (
|
|
8
|
+
api_delete,
|
|
9
|
+
api_get,
|
|
10
|
+
api_post,
|
|
11
|
+
api_put,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def list_variables(*, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
16
|
+
return api_get("/variables", base_url=base_url, api_key=api_key)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def create_variable(key: str, value: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
20
|
+
return api_post("/variables", {"key": key, "value": value}, base_url=base_url, api_key=api_key)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def update_variable(variable_id: str, key: str, value: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
24
|
+
return api_put(f"/variables/{variable_id}", {"key": key, "value": value}, base_url=base_url, api_key=api_key)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def delete_variable(variable_id: str, *, base_url: str | None = None, api_key: str | None = None) -> Any:
|
|
28
|
+
return api_delete(f"/variables/{variable_id}", base_url=base_url, api_key=api_key)
|