@n8n-as-code/skills 2.0.2-next.7 → 2.1.0-next.45

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.
package/README.md CHANGED
@@ -6,9 +6,9 @@ This package powers the shared n8n ontology behind `n8n-as-code`: searchable nod
6
6
 
7
7
  > **⚠️ BREAKING CHANGE (v0.16.0)**: Workflows are now generated and documented in **TypeScript format** (`.workflow.ts`) instead of JSON for better AI compatibility and readability.
8
8
 
9
- > **BREAKING CHANGE (v2.0.0)**: Generated agent context now assumes the split runtime model: use `n8n-manager` for global instance/auth/runtime/project state and `n8nac workspace` for workspace overrides. Legacy workspace-local instance libraries are no longer treated as the runtime source of truth.
9
+ > **BREAKING CHANGE (v2.0.0)**: Generated agent context now assumes the environment model: use `n8nac env` for workspace environments, `n8nac workspace` for readiness/migration/upgrade, and `n8n-manager` for local managed instances. Legacy workspace-local instance libraries are no longer treated as the source of truth.
10
10
 
11
- Runtime documentation: [n8n-manager guide](https://n8nascode.dev/docs/usage/n8n-manager/) · [CLI workspace commands](https://n8nascode.dev/docs/usage/cli/#workspace) · [Skills guide](https://n8nascode.dev/docs/usage/skills/)
11
+ Documentation: [CLI guide](https://n8nascode.dev/docs/usage/cli/) · [n8n-manager guide](https://n8nascode.dev/docs/usage/n8n-manager/) · [Skills guide](https://n8nascode.dev/docs/usage/skills/)
12
12
 
13
13
  > **📌 Internal Library** — This package is not meant to be used directly. Public access is via [`n8nac`](https://www.npmjs.com/package/n8nac): `npx n8nac skills <command>`.
14
14
 
@@ -5,7 +5,9 @@ description: Use when the user explicitly wants to create, edit, validate, sync,
5
5
 
6
6
  # n8n Architect
7
7
 
8
- Use this skill for workflow engineering. Use the `n8n-manager` skill for instance, auth, runtime, tunnel, project-default, credential infrastructure, or workflow presentation work.
8
+ Use this skill for all n8n-as-code work: workspace readiness, migration, environments, managed local instances, tunnels, workflow authoring, validation, sync, push, and pull.
9
+
10
+ Use `{{N8NAC_CMD}}` as the primary interface. Use `{{N8N_MANAGER_CMD}}` only for local managed runtime lifecycle, tunnels, and workflow presentation commands that are explicitly exposed by n8n-manager.
9
11
 
10
12
  ## Context Root Protocol
11
13
 
@@ -13,42 +15,171 @@ Use this skill for workflow engineering. Use the `n8n-manager` skill for instanc
13
15
  - {{N8NAC_CONTEXT_ROOT_HINT}}
14
16
  - Before any n8n work, first run `{{N8NAC_CMD}} update-ai` from the context root, then read `AGENTS.md`. `update-ai` is designed to create or refresh the n8n-as-code block without destroying existing user or agent instructions.
15
17
  - Use the exact `n8nac command` and `n8n-manager command` listed in `AGENTS.md`. Those context-root commands override the portable examples in this skill.
16
- - Run every `{{N8NAC_CMD}} workspace ...`, `{{N8NAC_CMD}} list`, `pull`, `push`, `validate`, `test`, and `update-ai` command from the context root unless the user explicitly gives another context root.
18
+ - Run every `{{N8NAC_CMD}} env ...`, `{{N8NAC_CMD}} workspace ...`, `{{N8NAC_CMD}} list`, `pull`, `push`, `validate`, `test`, and `update-ai` command from the context root unless the user explicitly gives another context root.
17
19
  - `AGENTS.md` is bootstrap context only, not a source of configuration truth.
18
- - Do not infer instance, project, sync folder, or workflow directory from `AGENTS.md`.
20
+ - Do not infer environment, project, sync folder, or workflow directory from `AGENTS.md`.
19
21
  - Before n8n work, resolve the effective context from the backend:
20
22
 
21
23
  ```bash
22
- {{N8NAC_CMD}} workspace status --json
24
+ {{N8NAC_CMD}} env status --json
23
25
  ```
24
26
 
25
27
  - Use the returned `workflowDir` for workflow files. Do not reconstruct it from `syncFolder`, `instanceIdentifier`, or `projectName`.
26
- - Never write `n8nac-config.json` by hand. Use `{{N8NAC_CMD}} workspace ...` commands.
28
+ - Never write `n8nac-config.json`, `~/.n8n-manager`, or n8n-manager secret files by hand.
29
+
30
+ ## Workspace Readiness
31
+
32
+ Use the unified migration preflight before resolving the effective environment. The dry-run is safe and reports whether any workspace migration is required:
33
+
34
+ ```bash
35
+ {{N8NAC_CMD}} workspace migrate --json
36
+ {{N8NAC_CMD}} env status --json
37
+ ```
38
+
39
+ - Treat `workspace migrate --json` as the source of migration need.
40
+ - Treat `env status --json` as the source of effective workspace readiness only after migration is not required or has been applied.
41
+ - Do not infer readiness from raw files, generated agent docs, or directory names.
42
+ - If migration is required, do not edit config files by hand or continue with environment/workflow work until it has been applied or explicitly deferred by the user.
43
+
44
+ ## Migration
45
+
46
+ Migration is one user-facing command. Do not reason about internal migration phases directly; summarize the report `operations` array when explaining what will change.
47
+
48
+ 1. Run the dry-run first:
49
+
50
+ ```bash
51
+ {{N8NAC_CMD}} workspace migrate --json
52
+ ```
53
+
54
+ 2. If the dry-run reports `status: "dry-run"`, `required: true`, or otherwise indicates pending changes, stop and ask once before applying it. Do not run `workspace migrate --write` unless the user already directly requested applying migration.
55
+ 3. After confirmation, apply migration and re-check readiness:
56
+
57
+ ```bash
58
+ {{N8NAC_CMD}} workspace migrate --write
59
+ {{N8NAC_CMD}} workspace migrate --json
60
+ {{N8NAC_CMD}} env status --json
61
+ ```
62
+
63
+ - Do not run `workspace migrate --write` without explicit confirmation unless the user already directly requested applying migration.
64
+ - When reporting a dry-run, summarize the unified `operations` list and ask for exactly one confirmation for `{{N8NAC_CMD}} workspace migrate --write`.
65
+ - Do not ask separately for different operation types. `{{N8NAC_CMD}} workspace migrate --write` applies the required migration as one operation.
66
+ - Do not run environment, workflow, or setup commands while `workspace migrate --json` still reports migration required.
67
+ - Managed local instances remain machine-global runtime resources.
68
+ - Workspace environments remain workspace-scoped and are managed through `{{N8NAC_CMD}} env ...`.
27
69
 
28
70
  ## Bootstrap Order
29
71
 
30
72
  1. `cd` to the context root.
31
73
  2. Run `{{N8NAC_CMD}} update-ai`, then read `AGENTS.md`.
32
- 3. Run `{{N8NAC_CMD}} workspace status --json`.
33
- 4. If the context root is not ready, inspect instances with `{{N8N_MANAGER_CMD}} instances list`.
34
- 5. Reuse an existing instance when suitable.
35
- 6. If no suitable instance exists, stop and ask the user whether they want to reuse/configure an existing instance, create a managed local n8n instance, or connect an existing/remote n8n instance. Do not create infrastructure by default. If the user chooses a managed local instance, ask separately whether they want a public tunnel.
36
- 7. Ask for host/API key only for an explicitly remote or existing n8n instance.
37
- 8. Configure context-root overrides with:
74
+ 3. Run `{{N8NAC_CMD}} workspace migrate --json`.
75
+ 4. If migration is required, stop and ask for confirmation before `{{N8NAC_CMD}} workspace migrate --write` unless the user already requested applying migration.
76
+ 5. Run `{{N8NAC_CMD}} env status --json` after migration is not required or has been applied.
77
+ 6. If the context root is not ready, inspect managed local instances with `{{N8N_MANAGER_CMD}} instance list`.
78
+ 7. Reuse an existing environment or managed local instance when suitable.
79
+ 8. If no suitable environment exists, stop and ask the user whether they want to connect a remote n8n URL or create/reuse a managed local n8n instance. Do not create infrastructure by default. If the user chooses a managed local instance, ask separately whether they want a public tunnel.
80
+ 9. Ask for host/API key only for an explicitly remote n8n environment.
81
+ 10. Configure the environment with:
82
+
83
+ ```bash
84
+ {{N8NAC_CMD}} env add <name> --base-url <url> --sync-folder workflows/<name>
85
+ {{N8NAC_CMD}} env auth set <name> --api-key-stdin
86
+ {{N8NAC_CMD}} env use <name>
87
+ ```
88
+
89
+ For a managed local instance:
90
+
91
+ ```bash
92
+ {{N8NAC_CMD}} env add Local --managed-instance <id> --sync-folder workflows/local
93
+ {{N8NAC_CMD}} env use Local
94
+ ```
95
+
96
+ 11. Run `{{N8NAC_CMD}} update-ai` after changing environments when the facade does not do it automatically.
97
+
98
+ ## Environments
99
+
100
+ Use `{{N8NAC_CMD}} env ...` for workspace environments, remote URLs, active environment, API-key binding, projects, and sync folders.
101
+
102
+ ```bash
103
+ {{N8NAC_CMD}} env status --json
104
+ {{N8NAC_CMD}} env list
105
+ {{N8NAC_CMD}} env add <name> --base-url <url> --sync-folder workflows/<name>
106
+ {{N8NAC_CMD}} env auth set <name> --api-key-stdin
107
+ {{N8NAC_CMD}} env use <name>
108
+ ```
109
+
110
+ - Prefer `--api-key-stdin` for API keys.
111
+ - Do not pass secrets inline in shell arguments.
112
+ - Do not ask for host/API key when the user wants a managed local Docker instance.
113
+ - Do not print API keys or credential secret values back to the user.
114
+ - If a command or flag is unfamiliar, run `{{N8NAC_CMD}} env --help` or `{{N8NAC_CMD}} env <subcommand> --help`.
115
+
116
+ Attach a managed local instance to the workspace with `{{N8NAC_CMD}} env ...`:
117
+
118
+ ```bash
119
+ {{N8NAC_CMD}} env add Local --managed-instance <id> --sync-folder workflows/local
120
+ {{N8NAC_CMD}} env use Local
121
+ ```
122
+
123
+ ## Managed Local Runtime
124
+
125
+ Use `{{N8N_MANAGER_CMD}}` only for local managed instance lifecycle, tunnels, and workflow presentation commands that are part of the local runtime layer.
126
+
127
+ Inspect existing managed instances before changing local machine state:
128
+
129
+ ```bash
130
+ {{N8N_MANAGER_CMD}} instance list
131
+ {{N8N_MANAGER_CMD}} instance --help
132
+ {{N8N_MANAGER_CMD}} config get
133
+ ```
134
+
135
+ Do not invent n8n-manager subcommands. Use `{{N8N_MANAGER_CMD}} <subcommand> --help` when unsure.
136
+
137
+ When the context root is not configured and no suitable existing instance is available, stop and ask the user to choose. Do not create infrastructure by default.
138
+
139
+ Present these choices clearly:
140
+
141
+ - use an existing managed local instance if one is available;
142
+ - create a new managed local n8n instance;
143
+ - configure a remote n8n URL as a workspace environment through `{{N8NAC_CMD}} env`.
144
+
145
+ If the user chooses a managed local Docker instance, ask the tunnel question separately:
146
+
147
+ - without public tunnel: local n8n only, suitable for normal UI/API workflow work;
148
+ - with public tunnel: exposes the instance through a public URL, useful for webhooks/forms/chat triggers and remote callbacks.
149
+
150
+ Do not enable, refresh, or start a public tunnel unless the user explicitly requested public access, webhook testing, or approved the tunnel option. If public access is not needed, create/start the managed instance without `--tunnel`.
151
+
152
+ Only run these commands after the user has explicitly chosen the corresponding option.
153
+
154
+ Managed local instance without public tunnel:
155
+
156
+ ```bash
157
+ {{N8N_MANAGER_CMD}} instance create
158
+ {{N8N_MANAGER_CMD}} instance start <id>
159
+ {{N8N_MANAGER_CMD}} instance list
160
+ ```
161
+
162
+ Managed local instance with public tunnel:
38
163
 
39
164
  ```bash
40
- {{N8NAC_CMD}} workspace pin-instance --instance-id <id>
41
- {{N8NAC_CMD}} workspace set-sync-folder workflows
42
- {{N8NAC_CMD}} workspace set-project --project-id <id> --project-name <name>
165
+ {{N8N_MANAGER_CMD}} instance create
166
+ {{N8N_MANAGER_CMD}} instance start <id>
167
+ {{N8N_MANAGER_CMD}} tunnel start <id>
43
168
  ```
44
169
 
45
- For self-hosted n8n instances where the projects API is unavailable or returns 401/403, do not keep retrying project discovery. Use the standard personal project override unless the user gave another project:
170
+ Instance and tunnel operations are per managed local instance:
46
171
 
47
172
  ```bash
48
- {{N8NAC_CMD}} workspace set-project --project-id personal --project-name Personal
173
+ {{N8N_MANAGER_CMD}} instance start <id>
174
+ {{N8N_MANAGER_CMD}} instance stop <id>
175
+ {{N8N_MANAGER_CMD}} instance remove <id>
176
+ {{N8N_MANAGER_CMD}} tunnel start <id>
177
+ {{N8N_MANAGER_CMD}} tunnel stop <id>
49
178
  ```
50
179
 
51
- 9. Run `{{N8NAC_CMD}} update-ai` after changing context-root overrides when the facade does not do it automatically.
180
+ - Do not delete local instance data unless the user explicitly asks for destructive deletion.
181
+ - If Docker is unavailable or the daemon is stopped, report the backend diagnostic and stop. Do not loop.
182
+ - If a command fails repeatedly, stop after two attempts and explain the backend diagnostic.
52
183
 
53
184
  ## Sync Discipline
54
185
 
@@ -63,7 +194,7 @@ For self-hosted n8n instances where the projects API is unavailable or returns 4
63
194
  ```
64
195
 
65
196
  - `push` requires the full workflow file path, either absolute or context-root-relative. Do not pass a bare filename.
66
- - For a new workflow, create the file inside the `workflowDir` returned by `workspace status --json`, then confirm it with `{{N8NAC_CMD}} list --local`.
197
+ - For a new workflow, create the file inside the `workflowDir` returned by `env status --json`, then confirm it with `{{N8NAC_CMD}} list --local`.
67
198
  - If push/pull reports a conflict, use explicit resolution commands. Do not overwrite remote changes blindly.
68
199
  - `pull` and conflict resolution operate on a single workflow ID.
69
200
  - `list` is the lightweight command that covers all workflows at once.
@@ -275,7 +406,7 @@ For webhook, chat, or form workflows, prefer the production test sequence:
275
406
 
276
407
  ## Workflow Presentation Contract
277
408
 
278
- `presentWorkflowResult` is the standard way to show a workflow to the user. It is part of the workflow authoring loop, even though the command lives in n8n-manager.
409
+ `{{N8NAC_CMD}} workflow present` is the standard way to show a workflow to the user. It is v4-environment aware and part of the workflow authoring loop.
279
410
 
280
411
  Run it whenever one of these is true:
281
412
 
@@ -285,16 +416,17 @@ Run it whenever one of these is true:
285
416
  - the user asks to show, open, present, display, or give the URL/link for a workflow.
286
417
 
287
418
  ```bash
288
- {{N8N_MANAGER_CMD}} presentWorkflowResult --workflow-id <workflowId> --workspace-root <contextRoot>
419
+ {{N8NAC_CMD}} workflow present <workflowId> --json
289
420
  ```
290
421
 
291
422
  Rules:
292
423
 
293
424
  - Do not manually construct n8n workflow URLs.
294
425
  - Do not return an internal local n8n URL when a presentation URL is available.
295
- - Use the `url` returned by `presentWorkflowResult` as the user-facing URL.
426
+ - Use the `url` returned by `workflow present --json` as the user-facing URL.
296
427
  - If you do not know the workflow ID, run `{{N8NAC_CMD}} list` first and select the matching workflow.
297
- - If `presentWorkflowResult` fails, report the backend diagnostic and then provide the best direct n8n URL only as a fallback.
428
+ - Do not call `{{N8N_MANAGER_CMD}} presentWorkflowResult`; it is a legacy runtime command and is not workspace-environment aware.
429
+ - If `workflow present` fails, report the backend diagnostic and then provide the best direct n8n URL only as a fallback.
298
430
  - Do this before the final response when the task created, changed, pushed, ran, or explicitly asks to show a workflow.
299
431
 
300
432
  ### Testability Protocol
@@ -357,7 +489,7 @@ When a workflow is blocked by missing credentials, resolve the credential gap wi
357
489
 
358
490
  For most workflow tasks:
359
491
 
360
- 1. Resolve context with `workspace status --json`.
492
+ 1. Resolve context with `env status --json`.
361
493
  2. Read `workflowDir` from the backend response.
362
494
  3. Inspect existing workflows with `list`.
363
495
  4. Pull before editing an existing workflow.
@@ -367,13 +499,13 @@ For most workflow tasks:
367
499
  8. Push with `--verify`.
368
500
  9. Test if the workflow is HTTP-triggered.
369
501
  10. Inspect executions when behavior is unclear.
370
- 11. Present the final workflow link with `presentWorkflowResult`.
502
+ 11. Present the final workflow link with `{{N8NAC_CMD}} workflow present <workflowId> --json`.
371
503
 
372
504
  ## Response Discipline
373
505
 
374
506
  - Explain concrete actions and command results, not generic capability.
375
- - When the user asks for an URL or visual inspection of a workflow, run `presentWorkflowResult` instead of composing a URL manually.
376
- - If setup is missing, use `n8n-manager` for instance/auth/runtime and `n8nac workspace ...` for context-root overrides.
377
- - Do not ask for host/API key until existing n8n-manager instances have been inspected.
507
+ - When the user asks for an URL or visual inspection of a workflow, run `{{N8NAC_CMD}} workflow present <workflowId> --json` instead of composing a URL manually.
508
+ - If setup is missing, use `n8nac env ...` for workspace environments and `n8n-manager` only for managed local instances.
509
+ - Do not ask for host/API key unless the user chooses a remote n8n environment.
378
510
  - Do not tell the user to run setup commands when you can run non-interactive commands yourself.
379
511
  - Stop after two repeated failures with the same diagnostic and report the backend error clearly.
@@ -1,5 +1,5 @@
1
1
  {
2
- "generatedAt": "2026-05-08T10:19:20.566Z",
2
+ "generatedAt": "2026-05-11T08:14:21.198Z",
3
3
  "n8nVersion": "unknown",
4
4
  "sourceFileCount": 428,
5
5
  "scanDirectories": [