@wix/mcp 1.0.7 → 1.0.8

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 (46) hide show
  1. package/build/api-call/index.d.ts +2 -1
  2. package/build/api-call/index.js +149 -0
  3. package/build/auth/index.d.ts +5 -0
  4. package/build/bin-standalone.js +16370 -0
  5. package/build/bin-standalone.js.map +7 -0
  6. package/build/bin.d.ts +1 -1
  7. package/build/bin.js +82 -665
  8. package/build/cli-tools/cli.d.ts +2 -2
  9. package/build/cli-tools/cli.js +339 -0
  10. package/build/cli-tools/utils.js +25 -0
  11. package/build/docs/docs.js +447 -0
  12. package/build/docs/long-content.js +1 -0
  13. package/build/docs/semanticSearch.js +108 -0
  14. package/build/docs/semanticSearch.test.js +459 -0
  15. package/build/index-standalone.js +18849 -0
  16. package/build/index-standalone.js.map +7 -0
  17. package/build/index.d.ts +1 -0
  18. package/build/index.js +6 -201
  19. package/build/infra/bi-logger.d.ts +2 -0
  20. package/build/infra/bi-logger.js +10 -0
  21. package/build/infra/environment.d.ts +9 -0
  22. package/build/infra/environment.js +27 -0
  23. package/build/infra/logger.js +61 -0
  24. package/build/infra/panorama.d.ts +7 -0
  25. package/build/infra/panorama.js +35 -0
  26. package/build/infra/sentry.d.ts +1 -0
  27. package/build/infra/sentry.js +10 -0
  28. package/build/interactive-command-tools/eventually.js +15 -0
  29. package/build/interactive-command-tools/handleStdout.js +75 -0
  30. package/build/interactive-command-tools/interactive-command-utils.js +75 -0
  31. package/build/resources/docs.js +45 -0
  32. package/build/support/index.js +32 -0
  33. package/build/tool-utils.d.ts +2 -1
  34. package/build/tool-utils.js +30 -0
  35. package/build/tool-utils.spec.js +99 -0
  36. package/build/wix-mcp-server.d.ts +12 -1
  37. package/build/wix-mcp-server.js +114 -0
  38. package/package.json +15 -10
  39. package/bin.js +0 -2
  40. package/build/bin.js.map +0 -7
  41. package/build/chunk-QGIZNLF4.js +0 -8179
  42. package/build/chunk-QGIZNLF4.js.map +0 -7
  43. package/build/index.js.map +0 -7
  44. package/build/panorama.d.ts +0 -2
  45. /package/build/{sentry.d.ts → auth/index.js} +0 -0
  46. /package/build/{logger.d.ts → infra/logger.d.ts} +0 -0
@@ -0,0 +1,99 @@
1
+ import { handleWixAPIResponse } from './tool-utils.js';
2
+ import { expect, test, vi, describe, beforeEach } from 'vitest';
3
+ // Mock the global fetch function
4
+ global.fetch = vi.fn();
5
+ function mockHttpClientResponse(data, status = 200, statusText = 'OK', requestId = '') {
6
+ return {
7
+ requestId: '',
8
+ data,
9
+ status,
10
+ statusText,
11
+ headers: {
12
+ get: () => {
13
+ return requestId;
14
+ }
15
+ },
16
+ config: {},
17
+ request: {}
18
+ };
19
+ }
20
+ describe('handleWixAPIResponse', () => {
21
+ beforeEach(() => {
22
+ // Reset the mock before each test
23
+ global.fetch.mockClear();
24
+ });
25
+ describe('safeParseJSON', () => {
26
+ test('should parse valid JSON string', async () => {
27
+ const jsonString = '{"key": "value", "number": 123}';
28
+ const result = await handleWixAPIResponse(mockHttpClientResponse(jsonString));
29
+ expect(result).toEqual({ key: 'value', number: 123 });
30
+ });
31
+ test('should return the original string if parsing fails', async () => {
32
+ const invalidJSONString = 'this is not valid json';
33
+ const result = await handleWixAPIResponse(mockHttpClientResponse(invalidJSONString));
34
+ expect(result).toBe(invalidJSONString);
35
+ });
36
+ test('should return an empty string if the response text is empty', async () => {
37
+ global.fetch.mockResolvedValueOnce(new Response('', { status: 200 }));
38
+ const result = await handleWixAPIResponse(mockHttpClientResponse(''));
39
+ expect(result).toBe('');
40
+ });
41
+ });
42
+ test('should return parsed JSON data for a successful response', async () => {
43
+ const mockData = { message: 'Success!' };
44
+ global.fetch.mockResolvedValueOnce(new Response(JSON.stringify(mockData), {
45
+ status: 200,
46
+ statusText: 'OK',
47
+ headers: new Headers({ 'Content-Type': 'application/json' })
48
+ }));
49
+ const result = await handleWixAPIResponse(mockHttpClientResponse(mockData));
50
+ expect(result).toEqual(mockData);
51
+ });
52
+ test('should return the original string if the successful response is not JSON', async () => {
53
+ const mockData = 'This is plain text';
54
+ global.fetch.mockResolvedValueOnce(new Response(mockData, { status: 200, statusText: 'OK' }));
55
+ const result = await handleWixAPIResponse(mockHttpClientResponse(mockData));
56
+ expect(result).toBe(mockData);
57
+ });
58
+ test('should throw an error for a failed response with JSON error details', async () => {
59
+ const mockError = { error: 'Something went wrong', code: 500 };
60
+ const mockRequestId = 'some-request-id';
61
+ await expect(handleWixAPIResponse(mockHttpClientResponse(mockError, 500, 'Internal Server Error', mockRequestId))).rejects.toThrowError([
62
+ 'Failed to call Wix API: 500 Internal Server Error.',
63
+ `request id: ${mockRequestId}`,
64
+ '{"error":"Something went wrong","code":500}'
65
+ ].join('\n'));
66
+ });
67
+ test('should throw an error for a failed response with non-JSON error details', async () => {
68
+ const mockError = 'Internal server error occurred.';
69
+ global.fetch.mockResolvedValueOnce(new Response(mockError, {
70
+ status: 503,
71
+ statusText: 'Service Unavailable'
72
+ }));
73
+ await expect(handleWixAPIResponse(mockHttpClientResponse(mockError, 503, 'Service Unavailable'))).rejects.toThrowError(['Failed to call Wix API: 503 Service Unavailable.', mockError].join('\n'));
74
+ });
75
+ test('should include the request ID in the error message if present', async () => {
76
+ const mockError = { message: 'Unauthorized' };
77
+ const mockRequestId = 'another-id';
78
+ global.fetch.mockResolvedValueOnce(new Response(JSON.stringify(mockError), {
79
+ status: 401,
80
+ statusText: 'Unauthorized',
81
+ headers: new Headers({ 'x-wix-request-id': mockRequestId })
82
+ }));
83
+ await expect(handleWixAPIResponse(mockHttpClientResponse(mockError, 401, 'Unauthorized', mockRequestId))).rejects.toThrowError([
84
+ 'Failed to call Wix API: 401 Unauthorized.',
85
+ `request id: ${mockRequestId}`,
86
+ '{"message":"Unauthorized"}'
87
+ ].join('\n'));
88
+ });
89
+ test('should return "Not found" in the error message for a 404 with HTML content', async () => {
90
+ const mockHtmlError = '<html><body><h1>404 Not Found</h1></body></html>';
91
+ global.fetch.mockResolvedValueOnce(new Response(mockHtmlError, { status: 404, statusText: 'Not Found' }));
92
+ await expect(handleWixAPIResponse(mockHttpClientResponse(mockHtmlError, 404, 'Not Found'))).rejects.toThrowError(['Failed to call Wix API: 404 Not Found.', 'Not found'].join('\n'));
93
+ });
94
+ test('should include the HTML content in the error message for a 404 without typical HTML structure', async () => {
95
+ const mockNonHtmlError = 'Resource not found on the server.';
96
+ global.fetch.mockResolvedValueOnce(new Response(mockNonHtmlError, { status: 404, statusText: 'Not Found' }));
97
+ await expect(handleWixAPIResponse(mockHttpClientResponse(mockNonHtmlError, 404, 'Not Found'))).rejects.toThrowError(['Failed to call Wix API: 404 Not Found.', mockNonHtmlError].join('\n'));
98
+ });
99
+ });
@@ -1,13 +1,24 @@
1
1
  import type { z, ZodRawShape, ZodTypeAny } from 'zod';
2
2
  import type { RequestHandlerExtra } from '@modelcontextprotocol/sdk/shared/protocol.js';
3
- import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
3
+ import type { CallToolResult, Implementation } from '@modelcontextprotocol/sdk/types.js';
4
+ import type { BiLogger } from '@wix/wix-bi-logger-client';
4
5
  import type { PanoramaClientForComponent } from '@wix/panorama-client-node';
5
6
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
+ import { HttpClient } from '@wix/http-client';
8
+ import { ServerOptions } from '@modelcontextprotocol/sdk/server/index.js';
6
9
  type WixRequestHandlerExtra = RequestHandlerExtra & {
10
+ biLogger: BiLogger;
7
11
  panorama: PanoramaClientForComponent;
12
+ httpClient: HttpClient;
8
13
  };
9
14
  type WixToolCallback<Args extends undefined | ZodRawShape = undefined> = Args extends ZodRawShape ? (args: z.objectOutputType<Args, ZodTypeAny>, extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult> : (extra: WixRequestHandlerExtra) => CallToolResult | Promise<CallToolResult>;
10
15
  export declare class WixMcpServer extends McpServer {
16
+ private biLogger;
17
+ private nodeEnv;
18
+ private sessionId;
19
+ private getUserId?;
20
+ constructor(serverInfo: Implementation, options?: ServerOptions, nodeEnv?: string);
21
+ setUserIdGetter(getUserId: () => string): void;
11
22
  tool(name: string, cb: WixToolCallback): void;
12
23
  tool(name: string, description: string, cb: WixToolCallback): void;
13
24
  tool<Args extends ZodRawShape>(name: string, paramsSchema: Args, cb: WixToolCallback<Args>): void;
@@ -0,0 +1,114 @@
1
+ import { v4 as uuidv4 } from 'uuid';
2
+ import { captureException, setTags } from '@sentry/node';
3
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
+ import { wixMcpRequestSrc39Evid1607 } from '@wix/bi-logger-api-infra-data/v2';
5
+ import { createPanoramaClient } from './infra/panorama.js';
6
+ import { createBiLogger } from './infra/bi-logger.js';
7
+ import { DEV_ENVIRONMENTS, getEnvironment } from './infra/environment.js';
8
+ import { HttpClient } from '@wix/http-client';
9
+ export class WixMcpServer extends McpServer {
10
+ biLogger;
11
+ nodeEnv;
12
+ sessionId;
13
+ getUserId;
14
+ constructor(serverInfo, options, nodeEnv) {
15
+ super(serverInfo, options);
16
+ this.sessionId = uuidv4();
17
+ this.nodeEnv = getEnvironment(nodeEnv);
18
+ this.biLogger = createBiLogger({
19
+ _client_id: this.sessionId
20
+ });
21
+ }
22
+ setUserIdGetter(getUserId) {
23
+ this.getUserId = getUserId;
24
+ }
25
+ tool(...args) {
26
+ const cbIndex = args.findIndex((arg) => typeof arg === 'function');
27
+ if (cbIndex !== -1) {
28
+ const originalCb = args[cbIndex];
29
+ const toolName = args[0];
30
+ const isDevEnvironment = DEV_ENVIRONMENTS.includes(this.nodeEnv);
31
+ const wrappedCb = async (...cbArgs) => {
32
+ setTags({
33
+ panoramaSessionId: this.sessionId
34
+ });
35
+ const panorama = createPanoramaClient({
36
+ environment: this.nodeEnv,
37
+ sessionId: this.sessionId,
38
+ componentId: toolName,
39
+ uuid: this.getUserId?.()
40
+ });
41
+ const toolInvocationId = uuidv4();
42
+ const httpClient = new HttpClient({
43
+ headers: {
44
+ 'x-wix-mcp': `execution-id=${toolInvocationId}`
45
+ }
46
+ });
47
+ const argsBeforeExtra = cbArgs.slice(0, cbArgs.length - 1);
48
+ const extra = cbArgs[cbArgs.length - 1];
49
+ const wrappedExtra = {
50
+ ...extra,
51
+ panorama: panorama.createClientForComponent(),
52
+ httpClient
53
+ };
54
+ if (!isDevEnvironment) {
55
+ panorama.transaction(toolName).start({
56
+ toolInvocationId,
57
+ params: JSON.stringify(argsBeforeExtra)
58
+ });
59
+ }
60
+ const startTime = performance.now();
61
+ let toolSucceeded, errorBody;
62
+ try {
63
+ const cbResult = await originalCb(...argsBeforeExtra, wrappedExtra);
64
+ if (!isDevEnvironment) {
65
+ panorama.transaction(toolName).finish({ toolInvocationId });
66
+ }
67
+ toolSucceeded = true;
68
+ return cbResult;
69
+ }
70
+ catch (e) {
71
+ toolSucceeded = false;
72
+ errorBody = e.message;
73
+ if (!isDevEnvironment) {
74
+ panorama.errorMonitor().reportError(e);
75
+ captureException(e, {
76
+ tags: {
77
+ componentId: toolName,
78
+ toolName
79
+ }
80
+ });
81
+ }
82
+ return {
83
+ isError: true,
84
+ content: [{ type: 'text', text: e.message }]
85
+ };
86
+ }
87
+ finally {
88
+ const endTime = performance.now();
89
+ const duration = Math.round(endTime - startTime);
90
+ if (!isDevEnvironment) {
91
+ if (this.getUserId) {
92
+ const userId = this.getUserId();
93
+ this.biLogger.updateDefaults({
94
+ _uuid: userId
95
+ });
96
+ }
97
+ this.biLogger.report(wixMcpRequestSrc39Evid1607({
98
+ toolInvocationId,
99
+ toolName,
100
+ params: JSON.stringify(argsBeforeExtra),
101
+ origin: this.nodeEnv,
102
+ duration,
103
+ sessionId: this.sessionId,
104
+ executionResult: toolSucceeded ? 'Success' : 'Error',
105
+ errorBody: errorBody
106
+ }));
107
+ }
108
+ }
109
+ };
110
+ args[cbIndex] = wrappedCb;
111
+ }
112
+ return super.tool.apply(this, args);
113
+ }
114
+ }
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
1
  {
2
2
  "name": "@wix/mcp",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "A Model Context Protocol server for Wix AI tools",
5
5
  "type": "module",
6
- "bin": "./bin.js",
6
+ "bin": "./build/bin-standalone.js",
7
7
  "files": [
8
8
  "build",
9
9
  "README.md"
10
10
  ],
11
11
  "scripts": {
12
12
  "build": "tsc --noEmit && node ./scripts/build.mjs",
13
- "test": "vitest run",
14
- "test:watch": "vitest",
15
- "start": "npm run build && node ./build/bin.js",
16
- "watch": "tsup-node --watch",
13
+ "test": "NODE_ENV=TEST && vitest run",
14
+ "test:watch": "NODE_ENV=TEST && vitest",
15
+ "start": "NODE_ENV=DEV && npm run build && node ./build/bin.js",
16
+ "watch": "tsc --watch",
17
17
  "lint": "eslint .",
18
18
  "inspector": "npx @modelcontextprotocol/inspector build/bin.js"
19
19
  },
@@ -35,8 +35,13 @@
35
35
  "@eslint/js": "^9.25.1",
36
36
  "@types/express": "^5.0.1",
37
37
  "@types/minimist": "^1.2.5",
38
- "@types/node": "^20.17.31",
38
+ "@types/node": "^20.17.32",
39
+ "@vespaiach/axios-fetch-adapter": "^0.3.1",
40
+ "@wix/bi-logger-api-infra-data": "^1.109.0",
41
+ "@wix/http-client": "^2.68.0",
39
42
  "@wix/panorama-client-node": "^3.228.0",
43
+ "@wix/standalone-node-bi-logger": "^1.7.24",
44
+ "@wix/wix-bi-logger-client": "^1.0.4",
40
45
  "esbuild": "^0.25.3",
41
46
  "eslint": "^9.25.1",
42
47
  "eslint-config-prettier": "^10.1.2",
@@ -44,12 +49,12 @@
44
49
  "globals": "^16.0.0",
45
50
  "prettier": "^3.5.3",
46
51
  "typescript": "^5.8.3",
47
- "typescript-eslint": "^8.31.0",
52
+ "typescript-eslint": "^8.31.1",
48
53
  "vitest": "^3.1.2"
49
54
  },
50
55
  "exports": {
51
56
  ".": {
52
- "import": "./build/index.js",
57
+ "import": "./build/index-standalone.js",
53
58
  "types": "./build/index.d.ts"
54
59
  },
55
60
  "./package.json": "./package.json"
@@ -65,5 +70,5 @@
65
70
  ]
66
71
  }
67
72
  },
68
- "falconPackageHash": "13cb6cd071ececc23a18f00406f8d665dc94eb0874132810565b68df"
73
+ "falconPackageHash": "1566f817c09451904eda12d4928c0382b320141c43336196946d224d"
69
74
  }
package/bin.js DELETED
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- import './build/bin.js';
package/build/bin.js.map DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../src/sentry.ts", "../src/bin.ts", "../src/cli-tools/cli.ts", "../src/cli-tools/utils.ts", "../src/interactive-command-tools/handleStdout.ts", "../src/interactive-command-tools/eventually.ts", "../src/interactive-command-tools/interactive-command-utils.ts"],
4
- "sourcesContent": ["import * as Sentry from '@sentry/node';\n\nSentry.init({\n dsn: 'https://583c5af58c664fd1977d638a693b0ada@sentry-next.wixpress.com/20924',\n tracesSampleRate: 1.0,\n initialScope: {\n tags: {\n fullArtifactId: 'com.wixpress.spartans.wix-mcp'\n }\n }\n});\n", "import './sentry.js';\n\nimport minimist from 'minimist';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { addDocsTools, DocsTool, VALID_DOCS_TOOLS } from './docs/docs.js';\nimport { addCliTools, CLITool, VALID_CLI_TOOLS } from './cli-tools/cli.js';\nimport {\n logger,\n attachStdErrLogger,\n attachMcpServerLogger,\n attachFileLogger\n} from './logger.js';\nimport { WixMcpServer } from './wix-mcp-server.js';\nimport { addDocsResources } from './resources/docs.js';\nconst PUBLIC_TOOLS = [...VALID_DOCS_TOOLS] as const;\nconst EXPERIMENTAL_TOOLS = ['WIX_API', 'CLI_COMMAND'] as const;\ntype Tool = (typeof PUBLIC_TOOLS)[number] | (typeof EXPERIMENTAL_TOOLS)[number];\nexport const DEFAULT_TOOLS: Tool[] = [...VALID_DOCS_TOOLS];\n\nconst parsedArgs = minimist(process.argv.slice(2));\n\nfunction parseExperimentalArg(): Tool[] {\n const experimentalArg: string | undefined = parsedArgs['experimental'];\n if (!experimentalArg) return [];\n\n return experimentalArg\n .split(',')\n .map((t) => t.trim())\n .filter((tool) =>\n EXPERIMENTAL_TOOLS.includes(tool as (typeof EXPERIMENTAL_TOOLS)[number])\n ) as Tool[];\n}\n\nfunction parseToolsArg(): Tool[] {\n const toolsArg: string | undefined = parsedArgs['tools'];\n const experimentalTools = parseExperimentalArg();\n\n if (!toolsArg) {\n // When no tools specified, return both default and experimental tools\n return [...DEFAULT_TOOLS, ...experimentalTools];\n }\n\n const requestedTools = toolsArg.split(',').map((t) => t.trim());\n\n const tools: Tool[] = [\n // Include valid non-experimental tools\n ...(requestedTools.filter((tool) =>\n PUBLIC_TOOLS.includes(tool as (typeof PUBLIC_TOOLS)[number])\n ) as Tool[]),\n // Include enabled experimental tools\n ...experimentalTools\n ];\n\n // Warn about enabled experimental tools\n tools.forEach((tool) => {\n if (\n EXPERIMENTAL_TOOLS.includes(tool as (typeof EXPERIMENTAL_TOOLS)[number])\n ) {\n logger.log(\n `Warning: ${tool} is an experimental tool and may have limited functionality or breaking changes`\n );\n }\n });\n\n return tools;\n}\n\nconst loggerType = parsedArgs['logger'] || 'mcp';\n\nif (loggerType === 'file') {\n attachFileLogger();\n} else {\n // Initially we log to stderr, because MCP server is not connected yet\n // When the server is connected, we attach the MCP server logger\n attachStdErrLogger();\n}\n\nlogger.log('--------------------------------');\nlogger.log('starting WIX MCP server');\nlogger.log('--------------------------------');\nconst server = new WixMcpServer(\n {\n name: 'wix-mcp-server',\n version: '1.0.0'\n },\n {\n capabilities: {\n tools: {},\n prompts: {},\n logging: {},\n resources: {}\n }\n }\n);\n\nconst activeTools = parseToolsArg();\nlogger.log('Active tools:', activeTools);\n\nconst docsTools = activeTools.filter((tool) =>\n VALID_DOCS_TOOLS.includes(tool as DocsTool)\n) as DocsTool[];\nif (docsTools.length > 0) {\n logger.log('Adding docs tools:', docsTools);\n addDocsTools(server, docsTools);\n}\n\nconst isWixOne = parsedArgs['cli'] === 'wix-one';\nconst cliTools = activeTools.filter((tool) =>\n VALID_CLI_TOOLS.includes(tool as CLITool)\n) as CLITool[];\nif (cliTools.length > 0) {\n logger.log('Adding cli tools:', cliTools, 'isWixOne:', isWixOne);\n addCliTools(server, cliTools, isWixOne);\n}\n\ntry {\n const portals = parsedArgs['portals']?.split(',') || [];\n if (portals.length > 0) {\n logger.log('Adding docs resources for portals:', portals);\n await addDocsResources(server, portals);\n }\n} catch (error) {\n logger.error('Error adding docs resources:', error);\n}\n\nlogger.log('Starting server');\nconst transport = new StdioServerTransport();\nlogger.log('Connecting to transport');\nawait server.connect(transport);\nlogger.log('Transport connected');\n\nif (loggerType === 'mcp') {\n // From now on, we log to the MCP server\n attachMcpServerLogger(server);\n}\n", "import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { z } from 'zod';\nimport {\n getCliAuthTokenForSiteId,\n getSiteIdFromCliAppConfig\n} from './utils.js';\nimport { logger } from '../logger.js';\nimport { execa } from 'execa';\nimport { mockInteractiveGenerateCommandTool } from '../interactive-command-tools/interactive-command-utils.js';\nimport { handleWixAPIResponse } from '../tool-utils.js';\n\nexport const VALID_CLI_TOOLS = [\n 'WIX_API',\n 'CLI_COMMAND',\n 'CLI_COMMAND_INTERACTIVE_MODE'\n] as const;\nexport type CLITool = (typeof VALID_CLI_TOOLS)[number];\n\nexport function addCliTools(\n server: McpServer,\n allowedTools: CLITool[] = [\n 'WIX_API',\n 'CLI_COMMAND',\n 'CLI_COMMAND_INTERACTIVE_MODE'\n ],\n isWixOne: boolean = false\n) {\n if (allowedTools.includes('WIX_API')) {\n server.tool(\n 'CallWixAPI',\n 'Call Wix apis on an app. Use this to create, read, update, and delete data and other Wix entities in your Wix app.',\n {\n appPath: z\n .string()\n .describe(\n 'The dir path to the wix backoffice cli app to call the api on behalf of. should have {appPath}/.wix/app.config.json file with a siteId field. if passed, siteId is not required'\n )\n .optional(), // should we have appPath or siteId here? (appPath encapsulates this more since we can get the siteId from the appPath then perform the call)\n siteId: z\n .string()\n .describe(\n 'The siteId of the wix backoffice cli app to call the api on behalf of. You can find the siteId in the {appPath}/.wix/app.config.json file. You can pass any other siteId if you want to call the api on behalf of a different site. If passed, appPath is not required. if not passed, the appPath must be provided.'\n )\n .optional(),\n url: z\n .string()\n .describe(\n 'The url of the api to call - usually you get this from the Wix REST docs or from the conversation context'\n ),\n method: z\n .string()\n .describe(\n 'The HTTP method to use for the API call (e.g. GET, POST, PUT, DELETE)'\n ),\n body: z\n .string()\n .optional()\n .describe(\n 'A string representing of a valid JSON object to describe the body of the request'\n )\n },\n async ({ method, url, body, appPath, siteId }) => {\n logger.log(\n `Calling Wix API: ${appPath} ${siteId} ${method} ${url}, body: ${JSON.stringify(\n body\n )}`\n );\n\n if (!siteId && !appPath) {\n return {\n content: [\n {\n type: 'text',\n text: 'Either appPath or siteId must be provided'\n }\n ]\n };\n }\n\n let siteIdToUse = siteId;\n if (!siteIdToUse && appPath) {\n siteIdToUse = getSiteIdFromCliAppConfig(appPath);\n }\n if (!siteIdToUse) {\n return {\n content: [\n {\n type: 'text',\n text: 'Either appPath or siteId must be provided'\n }\n ]\n };\n }\n\n logger.log(`Site ID for Wix API call: ${siteIdToUse}`);\n const authorization = getCliAuthTokenForSiteId(siteIdToUse);\n if (!authorization) {\n return {\n content: [\n {\n type: 'text',\n text: 'Failed to get authorization token. Please check your siteId and appPath'\n }\n ]\n };\n }\n\n try {\n const response = await fetch(url, {\n method,\n headers: {\n Authorization: authorization,\n 'wix-site-id': siteIdToUse,\n ...(body ? { 'Content-Type': 'application/json' } : {})\n },\n body\n });\n\n const responseData = await handleWixAPIResponse(response);\n\n return {\n content: [\n {\n type: 'text',\n text: `Wix API call successful: ${JSON.stringify(responseData)}`\n }\n ]\n };\n } catch (error) {\n logger.error(`Failed to call Wix API: ${error}`);\n throw new Error(`Failed to call Wix API: ${error}`);\n }\n }\n );\n }\n\n if (allowedTools.includes('CLI_COMMAND_INTERACTIVE_MODE')) {\n server.tool(\n 'RunWixCliCommandInteractiveMode',\n `Executes Wix CLI commands for Wix app development and management.\n Use this tool to run commands like 'wix app generate' (adds new extensions), 'wix app build' (builds your app), 'wix app preview' (creates shareable preview), 'wix app release' (releases a new version of your app), and more.\n\n IMPORTANT: Before using this tool, check if the command is mapped in package.json scripts:\n * Use this tool for npm/yarn scripts that map to Wix CLI commands as well.\n * Do not use this tool for starting the local development server.\n \n Before using this tool, you MUST search the Wix documentation for the command you want to run.\n \n DO NOT USE THIS TOOL FOR ANY OTHER PURPOSE. IT IS ONLY FOR WIX CLI COMMANDS.`,\n {\n appPath: z\n .string()\n .describe('The full path to the Wix CLI app to run the command on'),\n extensionType: z\n .enum(['DASHBOARD_PAGE', 'BACKEND_EVENT'])\n .optional()\n .describe(\n 'The type of extension to generate. You MUST provide this for commands that generate extensions.'\n ),\n searchedDocs: z\n .boolean()\n .describe(\n 'Whether you have already searched the Wix documentation for the command you want to run.'\n ),\n command: z\n .string()\n .min(1, 'Command cannot be empty')\n .max(1000, 'Command is too long')\n .describe(\n \"The Wix CLI command to execute (e.g. 'wix app generate', 'wix app build', 'wix app preview', 'wix app release', etc.), or a npm/yarn script that maps to a Wix CLI command (e.g. 'npm run generate', 'yarn build', etc.).\"\n )\n },\n async ({ command, appPath, extensionType }) => {\n command = command.replace('wix app generate', 'npm run generate');\n if (command.includes('generate') && !extensionType) {\n return {\n content: [\n {\n type: 'text' as const,\n text: \"Error: You must provide an extension type for the 'generate' command.\"\n }\n ],\n isError: true\n };\n }\n\n logger.log(\n `RunWixCliCommand: command: ${command}, appPath: ${appPath}, extensionType: ${extensionType}`\n );\n\n try {\n logger.log(`Executing Wix CLI command: ${command}`);\n const commandParts = command.split(' ');\n const commandName = commandParts[0];\n const commandArgs = commandParts.slice(1);\n\n // Execute with timeout\n const subprocess = execa(commandName, commandArgs, {\n cwd: appPath,\n extendEnv: true,\n env: {\n ...process.env,\n PATH: process.env.PATH,\n WIX_CLI_TEST_OVERRIDES: JSON.stringify({\n inkDebug: true\n })\n },\n timeout: 5 * 60 * 1000, // 5 minute timeout\n maxBuffer: 10 * 1024 * 1024 // 10MB output limit\n });\n\n logger.log(`RunWixCliCommand: pid: ${subprocess.pid}`);\n\n if (!subprocess.pid) {\n let spawnError;\n\n // make sure spawnError is defined by waiting for the error event\n if (!spawnError) {\n await new Promise((resolve) => {\n subprocess.on('error', (err) => {\n spawnError = err;\n resolve({ spawnError });\n });\n });\n }\n\n return {\n content: [\n {\n type: 'text' as const,\n text: `Failed to start the Wix CLI command process. This usually indicates a problem with the command or the environment. Are you sure Wix CLI is installed globally?\\n\\nCommand: ${command}\\n\\n${spawnError}`\n }\n ]\n };\n }\n\n const { stdin, stdout, stderr } = subprocess;\n\n if (extensionType) {\n const output = await mockInteractiveGenerateCommandTool({\n extensionType,\n stdin,\n stdout\n });\n\n logger.log(`RunWixCliCommand: output: ${output}`);\n\n return {\n content: [{ type: 'text' as const, text: output }]\n };\n }\n\n const stringifyStdout = JSON.stringify(stdout);\n const stringifyStderr = JSON.stringify(stderr);\n\n return {\n content: [\n { type: 'text' as const, text: stringifyStdout },\n ...(stringifyStderr\n ? [{ type: 'text' as const, text: `Error: ${stringifyStderr}` }]\n : [])\n ]\n };\n } catch (error) {\n logger.error(`Error executing Wix CLI command: ${error}`);\n\n return {\n content: [{ type: 'text' as const, text: `Error: ${error}` }],\n isError: true\n };\n }\n }\n );\n }\n\n if (allowedTools.includes('CLI_COMMAND')) {\n server.tool(\n 'RunWixCliCommand',\n `Executes Wix CLI commands for Wix app development and management.\n Use this tool to run commands like 'wix app generate' (adds new extensions), 'wix app build' (builds your app), 'wix app preview' (creates shareable preview), 'wix app release' (releases a new version of your app), and more.\n\n IMPORTANT: Before using this tool, check if the command is mapped in package.json scripts:\n * Use this tool for npm/yarn scripts that map to Wix CLI commands as well.\n * Do not use this tool for starting the local development server.\n \n Before using this tool, you MUST search the Wix documentation for the command you want to run.\n \n DO NOT USE THIS TOOL FOR ANY OTHER PURPOSE. IT IS ONLY FOR WIX CLI COMMANDS.`,\n {\n appPath: z\n .string()\n .describe('The full path to the Wix CLI app to run the command on.'),\n extensionType: z\n .enum([\n 'dashboard-page',\n 'dashboard-plugin',\n 'dashboard-menu-plugin',\n 'dashboard-modal',\n 'web-method',\n 'api-route',\n 'event',\n 'service-plugin'\n ])\n .optional()\n .describe(\n 'The type of extension to generate. You MUST provide this for commands that generate extensions.'\n ),\n extensionName: z\n .string()\n .optional()\n .describe(\n 'The name of the extension to generate, e.g. My Dashboard Page. You MUST provide this for commands that generate extensions.'\n ),\n searchedDocs: z\n .boolean()\n .describe(\n 'Whether you have already searched the Wix documentation for the command you want to run.'\n ),\n command: z\n .string()\n .min(1, 'Command cannot be empty')\n .max(1000, 'Command is too long')\n .describe(\n \"The Wix CLI command to execute (e.g. 'wix app generate', 'wix app build', 'wix app preview', 'wix app release', etc.), or a script that maps to a Wix CLI command (e.g. 'npm run generate', 'yarn generate', etc.).\"\n )\n },\n async ({ command, appPath, extensionType, extensionName }) => {\n logger.log(\n `RunWixCliCommand: command: ${command}, appPath: ${appPath}, extensionType: ${extensionType}, extensionName: ${extensionName}`\n );\n let commandName = '';\n let commandArgs = [];\n\n if (command.includes('generate')) {\n if (!extensionType) {\n return {\n content: [\n {\n type: 'text' as const,\n text: \"Error: You must provide an extension type for the 'generate' command.\"\n }\n ],\n isError: true\n };\n }\n if (!extensionName) {\n return {\n content: [\n {\n type: 'text' as const,\n text: \"Error: You must provide an extension name for the 'generate' command.\"\n }\n ],\n isError: true\n };\n }\n // Format generate command with proper arguments\n commandName = 'npx';\n commandArgs = [\n isWixOne ? 'wix-one' : 'wix',\n 'app',\n 'generate',\n '-t',\n extensionType,\n '-n',\n extensionName,\n '--json'\n ];\n } else {\n const commandParts = command.split(' ');\n commandName = commandParts[0];\n commandArgs = commandParts.slice(1);\n }\n\n if (isWixOne && commandName === 'wix') {\n commandName = 'wix-one';\n }\n\n try {\n logger.log(\n `Executing Wix CLI command: ${commandName} ${commandArgs.join(' ')}`\n );\n\n // Execute with timeout\n const { stdout, stderr, exitCode } = await execa(\n commandName,\n commandArgs,\n {\n cwd: appPath,\n extendEnv: true,\n env: {\n ...process.env\n },\n timeout: 5 * 60 * 1000, // 5 minute timeout\n maxBuffer: 10 * 1024 * 1024 // 10MB output limit\n }\n );\n\n if (exitCode !== 0) {\n return {\n content: [{ type: 'text' as const, text: `Error: ${stderr}` }],\n isError: true\n };\n }\n\n logger.log(`RunWixCliCommand: stdout: ${stdout}`);\n logger.log(`RunWixCliCommand: stderr: ${stderr}`);\n\n return {\n content: [\n { type: 'text' as const, text: stdout },\n ...(stderr\n ? [{ type: 'text' as const, text: `Error: ${stderr}` }]\n : [])\n ]\n };\n } catch (error) {\n logger.error(`Error executing Wix CLI command: ${error}`);\n\n return {\n content: [{ type: 'text' as const, text: `Error: ${error}` }],\n isError: true\n };\n }\n }\n );\n }\n}\n", "import { existsSync, readFileSync } from 'fs';\nimport { homedir } from 'os';\nimport path from 'path';\n\nexport function getCliAuthTokenForSiteId(siteIdOrAccountsFileName: string) {\n // check if the api-key.json file exists:\n const apiKeyFileName = path.join(homedir(), `.wix/auth/api-key.json`);\n const apiKeyFileExists = existsSync(apiKeyFileName);\n\n if (apiKeyFileExists) {\n const apiKeyData = JSON.parse(readFileSync(apiKeyFileName, 'utf8'));\n return (apiKeyData.token || apiKeyData.accessToken) as string;\n }\n\n const siteTokenFileName = path.join(\n homedir(),\n `.wix/auth/${siteIdOrAccountsFileName}.json`\n );\n\n // check if the site token file exists:\n const siteTokenFileExists = existsSync(siteTokenFileName);\n if (siteTokenFileExists) {\n const authData = JSON.parse(readFileSync(siteTokenFileName, 'utf8'));\n return (authData.accessToken || authData.token) as string;\n }\n\n throw new Error(\n 'No site token or api key found. You need to authenticate with Wix CLI first.'\n );\n}\n\n// f\"first get the site id - its in the `{backoffice_app_dir}/.wix/app.config.json` file, it has a json object with a siteId field\",\nexport function getSiteIdFromCliAppConfig(appPath: string) {\n const appConfig = JSON.parse(\n readFileSync(path.join(appPath, '.wix/app.config.json'), 'utf8')\n );\n return appConfig.siteId;\n}\n", "import Stream from 'node:stream';\nimport stripAnsi from 'strip-ansi';\nimport eventually from './eventually.js';\nimport { logger } from '../logger.js';\n\nexport function handleStdout(stdout: Stream.Readable) {\n let checkStartIndex = 0;\n const lines: string[] = [];\n\n logger.log(`handleStdout: stdout: ${stdout}`);\n\n stdout.on('data', (chunk) => {\n logger.log(`handleStdout: chunk: ${chunk}`);\n // log(`create-cli: chunk: ${chunk}`);\n lines.push(...stripAnsi(chunk.toString()).split('\\n'));\n });\n\n return {\n async waitForText(\n match: string | RegExp,\n { timeout = 2 * 60 * 1000 } = {}\n ): Promise<string | undefined> {\n return eventually(\n () => {\n const matchedIndex = lines.findIndex((line, index) => {\n if (index < checkStartIndex) {\n return false;\n }\n if (typeof match === 'string') {\n return line.includes(match);\n }\n return line.match(match);\n });\n checkStartIndex = matchedIndex >= 0 ? matchedIndex + 1 : lines.length;\n if (matchedIndex !== -1) {\n return lines[matchedIndex];\n }\n const message = `Could not match text in output: ${match}`;\n throw new Error(message);\n },\n { timeout }\n );\n },\n async waitForAndCallback(\n matchesAndCallbacks: {\n match: string;\n callback: (stop: () => void) => void;\n }[],\n { timeout = 2 * 60 * 1000 } = {}\n ) {\n let stopResolve: any;\n const stopPromise = new Promise((resolve) => {\n stopResolve = resolve;\n });\n\n // Keep track of matches we've already processed\n const processedMatches = new Set<string>();\n\n const waitPromise = eventually(\n () => {\n //log(`create-cli: waiting for ${matchesAndCallbacks.length - processedMatches.size} matches`);\n for (const { match, callback } of matchesAndCallbacks) {\n // Skip if we've already processed this match\n if (processedMatches.has(match)) {\n continue;\n }\n\n if (lines.some((line) => line.includes(match))) {\n logger.log(`create-cli: found match ${match}`);\n // Add to processed matches so we don't match it again\n processedMatches.add(match);\n callback(() => {\n logger.log(`create-cli: stopping match loop`);\n stopResolve();\n });\n } else {\n // log(`create-cli: waiting for ${match}`);\n }\n }\n\n // If we've processed all matches, we're done\n if (processedMatches.size === matchesAndCallbacks.length) {\n return true;\n }\n\n throw new Error(\n `Could not find any of the remaining matches: ${matchesAndCallbacks\n .filter((m) => !processedMatches.has(m.match))\n .map((m) => m.match)\n .join(', ')}`\n );\n },\n { timeout }\n );\n\n return Promise.race([waitPromise, stopPromise]);\n },\n async getOutput() {\n return lines.join('\\n');\n }\n };\n}\n", "import waitForExpect from 'wait-for-expect';\n\ninterface Options {\n timeout?: number;\n interval?: number;\n}\n\nconst defaultOptions: Options = {\n timeout: 10000,\n interval: 200\n};\n\nexport default async function eventually<ReturnType = void>(\n expectation: () => ReturnType | Promise<ReturnType>,\n options?: Options\n): Promise<ReturnType> {\n return new Promise((resolve, reject) => {\n waitForExpect\n .default(\n async () => {\n const ret = await expectation();\n resolve(ret);\n },\n options?.timeout ?? defaultOptions.timeout,\n options?.interval ?? defaultOptions.interval\n )\n .catch((error: unknown) => reject(error));\n });\n}\n", "import { handleStdout } from './handleStdout.js';\nimport { logger } from '../logger.js';\nimport Stream from 'node:stream';\nexport const ENTER = '\\r';\nconst DOWN = '\\u001b[B';\n\nexport const mockInteractiveGenerateCommandTool = async ({\n extensionType,\n stdin,\n stdout\n}: {\n extensionType: string;\n stdin: Stream.Writable;\n stdout: Stream.Readable;\n}) => {\n try {\n logger.log('RunWixCliCommand: handle stdout');\n const stdoutHandler = handleStdout(stdout);\n\n logger.log('RunWixCliCommand: waiting for text');\n await stdoutHandler.waitForText(\n 'What kind of extension would you like to generate?'\n );\n\n // Enter the extension type\n if (extensionType === 'DASHBOARD_PAGE') {\n // No need to press enter\n } else if (extensionType === 'BACKEND_EVENT') {\n logger.log('RunWixCliCommand: writing DOWN 9 times');\n\n for (let i = 0; i < 9; i++) {\n stdin.write(DOWN);\n await new Promise((resolve) => setTimeout(resolve, 10));\n }\n }\n\n logger.log('RunWixCliCommand: writing ENTER 1');\n stdin.write(ENTER);\n\n // Wait for next step\n if (extensionType === 'DASHBOARD_PAGE') {\n await stdoutHandler.waitForText('Page title');\n\n logger.log('RunWixCliCommand: writing ENTER 2');\n stdin.write(ENTER);\n\n await stdoutHandler.waitForText('Enter the route for the new page');\n\n logger.log('RunWixCliCommand: writing ENTER 3');\n stdin.write(ENTER);\n } else if (extensionType === 'BACKEND_EVENT') {\n await stdoutHandler.waitForText('Event folder');\n\n logger.log('RunWixCliCommand: writing ENTER 2');\n stdin.write(ENTER);\n\n logger.log('RunWixCliCommand: waiting for text');\n\n // Check if the text is \"Would you like to install dependencies now?\", if dependencies are already installed, it will not be printed\n try {\n await stdoutHandler.waitForText(\n 'Would you like to install dependencies now?',\n { timeout: 1000 }\n );\n\n logger.log('RunWixCliCommand: writing ENTER 3');\n stdin.write(ENTER);\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes('Could not match text in output')\n ) {\n logger.log(\n 'RunWixCliCommand: dependencies are already installed, skipping install'\n );\n\n logger.log(await stdoutHandler.getOutput());\n } else {\n throw error;\n }\n }\n }\n\n logger.log('RunWixCliCommand: waiting for success message');\n\n try {\n await stdoutHandler.waitForText('Successfully', { timeout: 1000 });\n logger.log('RunWixCliCommand: success message found');\n } catch (error) {\n if (\n error instanceof Error &&\n error.message.includes('Could not match text in output')\n ) {\n logger.log('RunWixCliCommand: success message not found, skipping'); // just skip and try to continue by returning the output\n } else {\n throw error;\n }\n }\n\n return stdoutHandler.getOutput();\n } catch (error) {\n logger.error('RunWixCliCommand: error', error);\n throw error;\n }\n};\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA,YAAY,YAAY;AAEjB,YAAK;AAAA,EACV,KAAK;AAAA,EACL,kBAAkB;AAAA,EAClB,cAAc;AAAA,IACZ,MAAM;AAAA,MACJ,gBAAgB;AAAA,IAClB;AAAA,EACF;AACF,CAAC;;;ACRD,OAAO,cAAc;AACrB,SAAS,4BAA4B;;;ACFrC,SAAS,SAAS;;;ACDlB,SAAS,YAAY,oBAAoB;AACzC,SAAS,eAAe;AACxB,OAAO,UAAU;AAEV,SAAS,yBAAyB,0BAAkC;AAEzE,QAAM,iBAAiB,KAAK,KAAK,QAA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