@n8n-as-code/n8nac 2.1.3 → 2.2.0
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/CHANGELOG.md +23 -0
- package/index.ts +9 -8
- package/package.json +1 -1
- package/skills/n8n-architect/SKILL.md +45 -39
- package/src/workspace.ts +21 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @n8n-as-code/n8nac
|
|
2
2
|
|
|
3
|
+
## [2.2.0](https://github.com/EtienneLescot/n8n-as-code/compare/@n8n-as-code/n8nac@v2.1.4...@n8n-as-code/n8nac@v2.2.0) (2026-06-09)
|
|
4
|
+
|
|
5
|
+
### Features
|
|
6
|
+
|
|
7
|
+
* **vscode:** discover native MCP tools dynamically ([57c9c03](https://github.com/EtienneLescot/n8n-as-code/commit/57c9c03c43f8501ab2e0b1753d79db9f41e61a0d))
|
|
8
|
+
* **mcp:** scope native assist config to environments ([f51a532](https://github.com/EtienneLescot/n8n-as-code/commit/f51a5326dfc2d905292dc685cc32b13dd4aa64fd))
|
|
9
|
+
* **mcp:** add optional native n8n MCP assist ([e1d32e4](https://github.com/EtienneLescot/n8n-as-code/commit/e1d32e451145b8d42c345fe03710c91c5e9eea41))
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **mcp:** gate native assist exposure ([1252b6b](https://github.com/EtienneLescot/n8n-as-code/commit/1252b6bb2f76e1ce58ea2d64b3748a930f0c1618))
|
|
14
|
+
|
|
15
|
+
### Documentation
|
|
16
|
+
|
|
17
|
+
* **mcp:** clarify native execution strategy ([21a86a8](https://github.com/EtienneLescot/n8n-as-code/commit/21a86a87862e3ccdb81c9c65c3e7c424bea019ec))
|
|
18
|
+
|
|
19
|
+
## [2.1.4](https://github.com/EtienneLescot/n8n-as-code/compare/@n8n-as-code/n8nac@v2.1.3...@n8n-as-code/n8nac@v2.1.4) (2026-06-05)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
* address v4 workspace review feedback ([d111a7f](https://github.com/EtienneLescot/n8n-as-code/commit/d111a7fcc31cbdc2a3309cf4979395ee8f179880))
|
|
24
|
+
* require v4 workspace environments ([6967d4d](https://github.com/EtienneLescot/n8n-as-code/commit/6967d4d0ecbaa4d18fe0077f42531b215f574d5e))
|
|
25
|
+
|
|
3
26
|
## [2.1.3](https://github.com/EtienneLescot/n8n-as-code/compare/@n8n-as-code/n8nac@v2.1.2...@n8n-as-code/n8nac@v2.1.3) (2026-05-21)
|
|
4
27
|
|
|
5
28
|
### Dependencies
|
package/index.ts
CHANGED
|
@@ -26,9 +26,10 @@ Supported facade runtime modes:
|
|
|
26
26
|
${SETUP_MODE_CONTEXT}
|
|
27
27
|
|
|
28
28
|
For agent-driven flows, use the installed \`n8n-manager\` and \`n8n-architect\`
|
|
29
|
-
skills and their documented shell commands.
|
|
30
|
-
belongs to \`n8n-manager\`;
|
|
31
|
-
|
|
29
|
+
skills and their documented shell commands. Local managed runtime lifecycle
|
|
30
|
+
belongs to \`n8n-manager\`; environment/project/auth/workflowsPath management
|
|
31
|
+
uses V4 \`n8nac env\` commands such as \`env add\`, \`env update\`, and
|
|
32
|
+
\`env auth set\`, and workflow sync uses the n8n-as-code skills.
|
|
32
33
|
`;
|
|
33
34
|
|
|
34
35
|
function buildStatusHeader(workspaceDir: string): string {
|
|
@@ -39,13 +40,13 @@ function buildStatusHeader(workspaceDir: string): string {
|
|
|
39
40
|
"**The context root is initialized. Do NOT infer effective n8n config from this prompt.**",
|
|
40
41
|
"",
|
|
41
42
|
`- Context root: \`${workspaceDir}\``,
|
|
42
|
-
`-
|
|
43
|
+
`- Workspace environment file: \`${join(workspaceDir, "n8nac-config.json")}\``,
|
|
43
44
|
`- Bootstrap file: \`${join(workspaceDir, "AGENTS.md")}\``,
|
|
44
45
|
"",
|
|
45
|
-
"Before n8n work, run `n8nac
|
|
46
|
-
cfg.
|
|
47
|
-
? "The
|
|
48
|
-
: "The
|
|
46
|
+
"Before n8n work, run `n8nac env status --json` from the context root and use the backend-resolved result.",
|
|
47
|
+
cfg.environmentId || cfg.workflowsPath
|
|
48
|
+
? "The workspace environment file exists, but n8nac backend resolution remains the only source of effective state."
|
|
49
|
+
: "The workspace environment file is present but incomplete.",
|
|
49
50
|
].join("\n");
|
|
50
51
|
}
|
|
51
52
|
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@ 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 all n8n-as-code work: workspace readiness,
|
|
8
|
+
Use this skill for all n8n-as-code work: workspace readiness, environments, managed local instances, tunnels, workflow authoring, validation, sync, push, and pull.
|
|
9
9
|
|
|
10
10
|
Use `npx --yes n8nac` as the primary interface. Use `npx --yes @n8n-as-code/n8n-manager` only for local managed runtime lifecycle, tunnels, and workflow presentation commands that are explicitly exposed by n8n-manager.
|
|
11
11
|
|
|
@@ -30,41 +30,15 @@ npx --yes n8nac env status --json
|
|
|
30
30
|
|
|
31
31
|
## Workspace Readiness
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Resolve the effective environment through the backend before workflow work:
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
npx --yes n8nac workspace migrate --json
|
|
37
36
|
npx --yes n8nac env status --json
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
- Treat `
|
|
41
|
-
- Treat `env status --json` as the source of effective workspace readiness only after migration is not required or has been applied.
|
|
39
|
+
- Treat `env status --json` as the source of effective workspace readiness.
|
|
42
40
|
- Do not infer readiness from raw files, generated agent docs, or directory names.
|
|
43
|
-
- If
|
|
44
|
-
|
|
45
|
-
## Migration
|
|
46
|
-
|
|
47
|
-
Migration is one user-facing command. Do not reason about internal migration phases directly; summarize the report `operations` array when explaining what will change.
|
|
48
|
-
|
|
49
|
-
1. Run the dry-run first:
|
|
50
|
-
|
|
51
|
-
```bash
|
|
52
|
-
npx --yes n8nac workspace migrate --json
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
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.
|
|
56
|
-
3. After confirmation, apply migration and re-check readiness:
|
|
57
|
-
|
|
58
|
-
```bash
|
|
59
|
-
npx --yes n8nac workspace migrate --write
|
|
60
|
-
npx --yes n8nac workspace migrate --json
|
|
61
|
-
npx --yes n8nac env status --json
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
- Do not run `workspace migrate --write` without explicit confirmation unless the user already directly requested applying migration.
|
|
65
|
-
- When reporting a dry-run, summarize the unified `operations` list and ask for exactly one confirmation for `npx --yes n8nac workspace migrate --write`.
|
|
66
|
-
- Do not ask separately for different operation types. `npx --yes n8nac workspace migrate --write` applies the required migration as one operation.
|
|
67
|
-
- Do not run environment, workflow, or setup commands while `workspace migrate --json` still reports migration required.
|
|
41
|
+
- If `env status --json` fails because the workspace is not configured, use `env add`, `env auth set`, and `env use` to create or select a V4 workspace environment.
|
|
68
42
|
- Managed local instances remain machine-global runtime resources.
|
|
69
43
|
- Workspace environments remain workspace-scoped and are managed through `npx --yes n8nac env ...`.
|
|
70
44
|
|
|
@@ -72,14 +46,12 @@ npx --yes n8nac env status --json
|
|
|
72
46
|
|
|
73
47
|
1. `cd` to the context root.
|
|
74
48
|
2. Run `npx --yes n8nac update-ai`, then read `AGENTS.md`.
|
|
75
|
-
3. Run `npx --yes n8nac
|
|
76
|
-
4. If
|
|
77
|
-
5.
|
|
78
|
-
6. If
|
|
79
|
-
7.
|
|
80
|
-
8.
|
|
81
|
-
9. Ask for host/API key only for an explicitly remote n8n environment.
|
|
82
|
-
10. Configure the environment with:
|
|
49
|
+
3. Run `npx --yes n8nac env status --json`.
|
|
50
|
+
4. If the context root is not ready, inspect managed local instances with `npx --yes @n8n-as-code/n8n-manager instance list`.
|
|
51
|
+
5. Reuse an existing environment or managed local instance when suitable.
|
|
52
|
+
6. 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.
|
|
53
|
+
7. Ask for host/API key only for an explicitly remote n8n environment.
|
|
54
|
+
8. Configure the environment with:
|
|
83
55
|
|
|
84
56
|
```bash
|
|
85
57
|
npx --yes n8nac env add <name> --base-url <url> --workflows-path workflows/<name>
|
|
@@ -94,7 +66,7 @@ npx --yes n8nac env add Local --managed-instance <id> --workflows-path workflows
|
|
|
94
66
|
npx --yes n8nac env use Local
|
|
95
67
|
```
|
|
96
68
|
|
|
97
|
-
|
|
69
|
+
9. Run `npx --yes n8nac update-ai` after changing environments when the facade does not do it automatically.
|
|
98
70
|
|
|
99
71
|
## Environments
|
|
100
72
|
|
|
@@ -232,6 +204,40 @@ npx --yes n8nac skills validate <workflow.workflow.ts>
|
|
|
232
204
|
- Prefer the highest valid `typeVersion` returned by schema output.
|
|
233
205
|
- For fixed collections such as Switch/If rules, Wait form fields, or nested options, read the full `node-info` output before writing values.
|
|
234
206
|
|
|
207
|
+
## Optional Native n8n MCP Assist
|
|
208
|
+
|
|
209
|
+
The `n8n-as-code` MCP server is a client adapter for N8NAC tools. The native n8n MCP server is a separate live n8n instance endpoint. Native n8n MCP can complement this workflow for native knowledge, live state, and runtime execution, but it does not replace `npx --yes n8nac`, bundled knowledge, `.workflow.ts`, Git, or the sync discipline.
|
|
210
|
+
|
|
211
|
+
Use this routing policy:
|
|
212
|
+
|
|
213
|
+
- Default to local `npx --yes n8nac` for code-first workflow authoring, validation, pull, push, credentials, execution history, and presentation. Use `npx --yes n8nac skills` as the bundled offline knowledge default.
|
|
214
|
+
- Native MCP assist is configured per n8n-as-code environment. When creating or updating an environment, offer to configure it with `npx --yes n8nac native-mcp configure <environment> --token-stdin`; do not ask the user to manually configure a separate MCP server for Claude Code or the VS Code Workbench.
|
|
215
|
+
- If native MCP assist is configured, use it where it complements n8n-as-code: read-only live discovery, server-side validation, native SDK/reference knowledge, live node definitions, credential metadata without secrets, execution inspection, projects, folders, and explicit runtime execution/test strategy when supported.
|
|
216
|
+
- Check native availability with `npx --yes n8nac native-mcp status --include-tools --json` before relying on native tools.
|
|
217
|
+
- For user requests about the current/live n8n instance, existing remote workflows, available nodes in this instance, credential metadata, projects, folders, executions, drift, or duplicate discovery, prefer native MCP read-only tools after the status check. Do not fall back to local `npx --yes n8nac list`, `fetch`, `verify`, or bundled `skills` as the primary source for those live-audit facts when native MCP read-only tools are available.
|
|
218
|
+
- Do not expose native MCP assist on non-loopback HTTP/SSE transports unless the MCP transport is authenticated and `N8NAC_NATIVE_MCP_ALLOW_REMOTE=1` is explicitly set.
|
|
219
|
+
- Do not request full live execution payloads with `includeData=true` unless the user explicitly needs payload data and `N8NAC_NATIVE_MCP_ALLOW_EXECUTION_DATA=1` is set.
|
|
220
|
+
- Prefer `npx --yes n8nac test` when the execution strategy is to exercise the real webhook, chat, or form trigger contract.
|
|
221
|
+
- Prefer native runtime execution only when the generated execution strategy explicitly calls for it and it does something better than `npx --yes n8nac test`, such as workflow ID execution, non-webhook workflow testing, native pin-data test preparation, or direct execution diagnostics.
|
|
222
|
+
- Treat native execute/test as a side-effecting runtime action, like `npx --yes n8nac test`; do not run it just because the tool exists.
|
|
223
|
+
- Do not use native MCP create, update, publish, unpublish, archive, or destructive data-table tools unless the user explicitly requests direct native MCP mode and the tool is gated by permissions.
|
|
224
|
+
- If a workflow is ever created or changed through native MCP direct mode, immediately pull it back with `npx --yes n8nac pull <workflowId>` so the `.workflow.ts` file and Git remain the source of truth.
|
|
225
|
+
- If native MCP validation and local validation disagree, stop and report the divergence instead of forcing a push or direct update.
|
|
226
|
+
- Never put native MCP tokens in project files, generated docs, command arguments, or responses.
|
|
227
|
+
|
|
228
|
+
Use-case routing examples:
|
|
229
|
+
|
|
230
|
+
- Workflow authoring, editing, pull, push, sync, credentials, and durable workflow changes: use local `npx --yes n8nac` commands and `.workflow.ts` files.
|
|
231
|
+
- Offline node knowledge, examples, documentation, and schema-first authoring: use local `npx --yes n8nac skills` commands first.
|
|
232
|
+
- Live workflow discovery, drift investigation, projects, folders, credentials metadata, duplicate discovery, and execution inspection: prefer native MCP read-only tools when configured because the user is asking for current instance state.
|
|
233
|
+
- Connected-version node definitions or server-side validation: prefer native MCP read-only tools when the user asks what is available in this instance or needs validation against the connected n8n version. Use bundled knowledge for offline authoring when live instance state is not needed.
|
|
234
|
+
- Runtime execution: prefer `npx --yes n8nac test` for real webhook, chat, or form trigger contracts; prefer native runtime execution only for explicit workflow-ID execution, non-webhook testing, native pin-data preparation, or direct execution diagnostics.
|
|
235
|
+
- Direct native workflow creation, update, publish, unpublish, archive, or destructive operations: do not use them as an automatic path; require an explicit direct-native request and sync-back plan.
|
|
236
|
+
|
|
237
|
+
Do not treat the presence of any MCP server as permission to call native n8n MCP tools. Native n8n MCP is used if and only if the generated execution or investigation strategy needs live n8n capabilities that local N8NAC cannot provide as well.
|
|
238
|
+
|
|
239
|
+
Native MCP assist is a complementary knowledge, live-state, and runtime enrichment path, not the primary authoring or sync path.
|
|
240
|
+
|
|
235
241
|
## Knowledge Commands
|
|
236
242
|
|
|
237
243
|
Use these commands instead of guessing:
|
package/src/workspace.ts
CHANGED
|
@@ -3,16 +3,18 @@ import { homedir } from "node:os";
|
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
|
|
5
5
|
export type WorkspaceBinding = {
|
|
6
|
+
activeEnvironmentId?: string;
|
|
7
|
+
environmentId?: string;
|
|
8
|
+
environmentName?: string;
|
|
9
|
+
workflowsPath?: string;
|
|
6
10
|
projectId?: string;
|
|
7
11
|
projectName?: string;
|
|
8
|
-
syncFolder?: string;
|
|
9
|
-
activeInstanceId?: string;
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
|
-
* Fixed context-root directory for
|
|
15
|
+
* Fixed context-root directory for n8n-as-code.
|
|
14
16
|
* All n8nac context files (n8nac-config.json, AGENTS.md, .agents/skills, workflows/) live here.
|
|
15
|
-
*
|
|
17
|
+
* Runtime access is resolved through V4 workspace environments.
|
|
16
18
|
*/
|
|
17
19
|
export function getWorkspaceDir(): string {
|
|
18
20
|
return join(homedir(), ".openclaw", "n8nac");
|
|
@@ -31,12 +33,21 @@ export function readWorkspaceBinding(workspaceDir: string): WorkspaceBinding {
|
|
|
31
33
|
try {
|
|
32
34
|
const raw = readFileSync(configPath, "utf-8");
|
|
33
35
|
const config = JSON.parse(raw) as Record<string, unknown>;
|
|
36
|
+
if (config.version !== 4) return {};
|
|
37
|
+
const environments = Array.isArray(config.environments) ? config.environments as Array<Record<string, unknown>> : [];
|
|
38
|
+
const activeEnvironmentId = readString(config.activeEnvironmentId);
|
|
39
|
+
const environment = activeEnvironmentId
|
|
40
|
+
? environments.find((item) => readString(item.id) === activeEnvironmentId)
|
|
41
|
+
: environments[0];
|
|
42
|
+
if (!environment) return { activeEnvironmentId: activeEnvironmentId || undefined };
|
|
34
43
|
|
|
35
44
|
return {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
45
|
+
activeEnvironmentId: activeEnvironmentId || undefined,
|
|
46
|
+
environmentId: readString(environment.id) || undefined,
|
|
47
|
+
environmentName: readString(environment.name) || undefined,
|
|
48
|
+
workflowsPath: readString(environment.workflowsPath) || undefined,
|
|
49
|
+
projectId: readString(environment.projectId) || undefined,
|
|
50
|
+
projectName: readString(environment.projectName) || undefined,
|
|
40
51
|
};
|
|
41
52
|
} catch {
|
|
42
53
|
return {};
|
|
@@ -45,9 +56,9 @@ export function readWorkspaceBinding(workspaceDir: string): WorkspaceBinding {
|
|
|
45
56
|
|
|
46
57
|
/**
|
|
47
58
|
* Returns true when n8nac has been initialized in the given directory,
|
|
48
|
-
* meaning the config exists and contains
|
|
59
|
+
* meaning the config exists and contains an active V4 environment with workflowsPath.
|
|
49
60
|
*/
|
|
50
61
|
export function isWorkspaceInitialized(workspaceDir: string): boolean {
|
|
51
62
|
const binding = readWorkspaceBinding(workspaceDir);
|
|
52
|
-
return Boolean(binding.
|
|
63
|
+
return Boolean(binding.environmentId && binding.workflowsPath);
|
|
53
64
|
}
|