@n8n-as-code/n8nac 2026.3.1-next.12 → 2026.3.1-next.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n-as-code/n8nac",
3
- "version": "2026.3.1-next.12",
3
+ "version": "2026.3.1-next.14",
4
4
  "description": "OpenClaw plugin for n8n-as-code — create and manage n8n workflows from OpenClaw",
5
5
  "keywords": [
6
6
  "n8n",
package/src/cli.ts CHANGED
@@ -24,14 +24,13 @@ function runN8nac(
24
24
  opts: {
25
25
  cwd: string;
26
26
  timeout: number;
27
- env?: NodeJS.ProcessEnv;
27
+ stdinInput?: string;
28
28
  stdio?: "pipe" | "inherit";
29
29
  },
30
30
  ): Promise<RunResult> {
31
31
  return new Promise((resolve) => {
32
32
  const baseOptions = {
33
33
  cwd: opts.cwd,
34
- env: { ...process.env, ...opts.env },
35
34
  };
36
35
 
37
36
  const child: ChildProcess | ChildProcessWithoutNullStreams =
@@ -65,6 +64,11 @@ function runN8nac(
65
64
  });
66
65
  }
67
66
 
67
+ if (opts.stdinInput !== undefined && "stdin" in child && child.stdin) {
68
+ child.stdin.write(`${opts.stdinInput}\n`);
69
+ child.stdin.end();
70
+ }
71
+
68
72
  const timer = setTimeout(() => {
69
73
  timedOut = true;
70
74
  child.kill("SIGTERM");
@@ -154,10 +158,10 @@ export function registerN8nAcCli({ program, workspaceDir }: CliOpts): void {
154
158
  const authSpinner = p.spinner();
155
159
  authSpinner.start("Saving credentials…");
156
160
 
157
- const authResult = await runN8nac(["init-auth", "--host", host], {
161
+ const authResult = await runN8nac(["init-auth", "--host", host, "--api-key-stdin"], {
158
162
  cwd: workspaceDir,
159
163
  timeout: 60_000,
160
- env: { N8N_API_KEY: apiKey },
164
+ stdinInput: apiKey,
161
165
  });
162
166
 
163
167
  if (authResult.exitCode !== 0) {
package/src/tool.ts CHANGED
@@ -100,12 +100,11 @@ type RunResult = {
100
100
  function runNpx(
101
101
  args: string[],
102
102
  cwd: string,
103
- env?: NodeJS.ProcessEnv,
103
+ stdinInput?: string,
104
104
  ): Promise<RunResult> {
105
105
  return new Promise((resolve) => {
106
106
  const child = spawn("npx", ["--yes", "n8nac", ...args], {
107
107
  cwd,
108
- env: { ...process.env, ...env },
109
108
  stdio: "pipe",
110
109
  });
111
110
 
@@ -131,6 +130,11 @@ function runNpx(
131
130
  stderr += chunk.toString();
132
131
  });
133
132
 
133
+ if (stdinInput !== undefined) {
134
+ child.stdin.write(`${stdinInput}\n`);
135
+ child.stdin.end();
136
+ }
137
+
134
138
  const timer = setTimeout(() => {
135
139
  timedOut = true;
136
140
  child.kill("SIGTERM");
@@ -250,7 +254,7 @@ export function createN8nAcTool(opts: { workspaceDir: string }) {
250
254
  if (!host || !key) {
251
255
  return ok({ error: "n8nHost and n8nApiKey are required for init_auth" });
252
256
  }
253
- const r = await runNpx(["init-auth", "--host", host], workspaceDir, { N8N_API_KEY: key });
257
+ const r = await runNpx(["init-auth", "--host", host, "--api-key-stdin"], workspaceDir, key);
254
258
  if (r.exitCode !== 0) {
255
259
  return ok({ error: r.stderr || r.stdout, exitCode: r.exitCode });
256
260
  }