@n8n-as-code/n8nac 2.0.0-next.68 → 2.0.0-next.72

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.
Files changed (3) hide show
  1. package/index.ts +9 -3
  2. package/package.json +2 -1
  3. package/src/cli.ts +11 -1
package/index.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { accessSync, constants, mkdirSync } from "node:fs";
2
2
  import { join } from "node:path";
3
3
  import { N8N_FACADE_SETUP_MODES } from "@n8n-as-code/workflow-core";
4
+ import { createTelemetryClient } from "@n8n-as-code/telemetry";
4
5
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
5
6
  import { registerN8nAcCli } from "./src/cli.js";
6
7
  import { getWorkspaceDir, isWorkspaceInitialized, readWorkspaceBinding } from "./src/workspace.js";
@@ -98,6 +99,7 @@ const n8nAcPlugin = {
98
99
 
99
100
  register(api: OpenClawPluginApi) {
100
101
  const workspaceDir = getWorkspaceDir();
102
+ const telemetry = createTelemetryClient({ facade: "openclaw" });
101
103
 
102
104
  // Ensure the plugin workspace directory always exists.
103
105
  mkdirSync(workspaceDir, { recursive: true });
@@ -111,7 +113,7 @@ const n8nAcPlugin = {
111
113
 
112
114
  // -- CLI status ----------------------------------------------------------
113
115
  api.registerCli(
114
- ({ program }) => registerN8nAcCli({ program, workspaceDir }),
116
+ ({ program }) => registerN8nAcCli({ program, workspaceDir, telemetry }),
115
117
  { commands: ["n8nac:status"] },
116
118
  );
117
119
 
@@ -119,7 +121,9 @@ const n8nAcPlugin = {
119
121
  api.registerService({
120
122
  id: "n8nac-context",
121
123
  start: async () => {
122
- if (isWorkspaceInitialized(workspaceDir)) {
124
+ const initialized = isWorkspaceInitialized(workspaceDir);
125
+ telemetry.track("openclaw_service_started", { workspace_initialized: initialized });
126
+ if (initialized) {
123
127
  if (hasAgentsContext(workspaceDir)) {
124
128
  api.logger.info("[n8nac] Workspace ready — lightweight prompt context enabled; n8n skill available.");
125
129
  } else {
@@ -129,7 +133,9 @@ const n8nAcPlugin = {
129
133
  api.logger.info("[n8nac] Workspace not initialized. Use the n8n-manager and n8n-architect skills to configure it.");
130
134
  }
131
135
  },
132
- stop: async () => {},
136
+ stop: async () => {
137
+ await telemetry.flush(1000);
138
+ },
133
139
  });
134
140
  },
135
141
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@n8n-as-code/n8nac",
3
- "version": "2.0.0-next.68",
3
+ "version": "2.0.0-next.72",
4
4
  "description": "OpenClaw plugin for n8n-as-code — create and manage n8n workflows from OpenClaw",
5
5
  "keywords": [
6
6
  "n8n",
@@ -24,6 +24,7 @@
24
24
  "typecheck": "tsc --noEmit"
25
25
  },
26
26
  "dependencies": {
27
+ "@n8n-as-code/telemetry": "0.1.0",
27
28
  "@n8n-as-code/workflow-core": "0.1.0"
28
29
  },
29
30
  "devDependencies": {
package/src/cli.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
2
+ import type { TelemetryClient } from "@n8n-as-code/telemetry";
2
3
  import { isWorkspaceInitialized } from "./workspace.js";
3
4
 
4
5
  type CliProgram = Parameters<Parameters<OpenClawPluginApi["registerCli"]>[0]>[0]["program"];
@@ -6,14 +7,23 @@ type CliProgram = Parameters<Parameters<OpenClawPluginApi["registerCli"]>[0]>[0]
6
7
  type CliOpts = {
7
8
  program: CliProgram;
8
9
  workspaceDir: string;
10
+ telemetry: TelemetryClient;
9
11
  };
10
12
 
11
- export function registerN8nAcCli({ program, workspaceDir }: CliOpts): void {
13
+ export function registerN8nAcCli({ program, workspaceDir, telemetry }: CliOpts): void {
12
14
  program
13
15
  .command("n8nac:status")
14
16
  .description("Show n8n-as-code workspace status")
15
17
  .action(() => {
18
+ const startedAt = Date.now();
16
19
  const initialized = isWorkspaceInitialized(workspaceDir);
20
+ telemetry.track("openclaw_cli_command_completed", {
21
+ command: "n8nac:status",
22
+ outcome: "success",
23
+ duration_ms: Date.now() - startedAt,
24
+ workspace_initialized: initialized,
25
+ });
26
+ telemetry.trackActive({ activation_source_event: "openclaw_cli_command_completed" });
17
27
  console.log(`\nn8n-as-code workspace: ${workspaceDir}`);
18
28
  console.log(`Status: ${initialized ? "✓ Initialized" : "✗ Not initialized"}`);
19
29
  if (!initialized) {