@wix/ditto-codegen-public 1.0.467 → 1.0.469

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.
@@ -10,6 +10,36 @@ const execFileAsync = promisify(execFile);
10
10
  const FEEDBACK_API_URL = "https://www.wixapis.com/mcp-serverless/v1/feedback";
11
11
  const FEEDBACK_TIMEOUT_MS = 15_000;
12
12
 
13
+ const WIX_MCP_TOOLS = [
14
+ "SearchWixSDKDocumentation",
15
+ "ReadFullDocsArticle",
16
+ "ReadFullDocsMethodSchema",
17
+ "SearchWixAPISpec",
18
+ "BrowseWixRESTDocsMenu",
19
+ "CallWixSiteAPI",
20
+ "ExecuteWixAPI",
21
+ ];
22
+
23
+ // Lookbehind rather than \b so opencode's "wix-mcp_<tool>" form matches too.
24
+ const WIX_DOCS_CITATION_RE = new RegExp(
25
+ `dev\\.wix\\.com|(?<![A-Za-z0-9])(?:${WIX_MCP_TOOLS.join("|")})\\b`,
26
+ );
27
+
28
+ const OUT_OF_SCOPE_RE = /\.md\b|\bskills?\b|@wix\/(?:patterns|design-system)\b/i;
29
+
30
+ export const MISSING_CITATION_REPLY =
31
+ "Not sent: the report doesn't cite a dev.wix.com URL or the wix-mcp tool you called " +
32
+ "(e.g. SearchWixSDKDocumentation, ReadFullDocsMethodSchema). Only wix-mcp and " +
33
+ "dev.wix.com docs problems belong here — skill references, skill scripts, docs in " +
34
+ "node_modules, and your own code are out of scope. If it is a wix-mcp problem, resend " +
35
+ "with the citation; otherwise continue your task.";
36
+
37
+ export const OUT_OF_SCOPE_REPLY =
38
+ "Not sent: the report mentions a skill, a .md reference, or @wix/patterns / " +
39
+ "@wix/design-system docs — none of those are wix-mcp or dev.wix.com docs problems. If " +
40
+ "part of it is a wix-mcp or dev.wix.com problem, resend only that part without " +
41
+ "mentioning them; otherwise continue your task.";
42
+
13
43
  async function getWixAccessToken(): Promise<string> {
14
44
  const { stdout } = await execFileAsync("wix", ["token", "--json"], {
15
45
  timeout: 30_000,
@@ -39,10 +69,11 @@ export default tool({
39
69
  "tools to the Wix MCP team: a search whose top results were off-target, a docs article " +
40
70
  "or example that is wrong or missing the fields you needed, a method schema that " +
41
71
  "doesn't match the installed SDK types, or a wix-mcp tool error. Include cases you " +
42
- "recovered from. Do NOT report skill references (SKILL.md, references/*.md), package " +
43
- "docs in node_modules, your own mistakes, or the user's request — those aren't wix-mcp " +
44
- "issues. Every report must cite the wix-mcp tool or dev.wix.com URL involved. Call it " +
45
- "at most ONCE per task, covering every friction point you've hit so far.",
72
+ "recovered from. Do NOT report skill references (SKILL.md, references/*.md), skill " +
73
+ "scripts, package docs in node_modules, your own mistakes, or the user's request — " +
74
+ "those aren't wix-mcp issues. Every report must cite the wix-mcp tool or dev.wix.com " +
75
+ "URL involved. Call it at most ONCE per task, covering every friction point you've " +
76
+ "hit so far.",
46
77
  args: {
47
78
  message: tool.schema
48
79
  .string()
@@ -63,6 +94,13 @@ export default tool({
63
94
  ),
64
95
  },
65
96
  async execute(args) {
97
+ if (!WIX_DOCS_CITATION_RE.test(args.message)) {
98
+ return MISSING_CITATION_REPLY;
99
+ }
100
+ if (OUT_OF_SCOPE_RE.test(args.message)) {
101
+ return OUT_OF_SCOPE_REPLY;
102
+ }
103
+
66
104
  const message = [
67
105
  buildProvenance(),
68
106
  args.message,
package/dist/out.js CHANGED
@@ -14916,7 +14916,8 @@ ${environmentIdentity}`;
14916
14916
  - \`batch-write\` to create N new files in one call. NEVER call \`write\` more than once per turn \u2014 use batch-write instead. \`write\` is reserved for single-file creation.
14917
14917
  - \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
14918
14918
  - \`multi-edit\` to apply N find-and-replace edits across one or more files in one call. NEVER call \`edit\` more than once per turn \u2014 use multi-edit instead. \`edit\` is reserved for a single edit to one file. When ${multiEditContextClause} across N files, use ONE \`multi-edit\` with all N edits.
14919
- - Tool arguments are strict JSON, and \`write\`/\`edit\`/\`batch-write\`/\`multi-edit\` write \`content\`/\`oldString\`/\`newString\` to disk EXACTLY as decoded from that JSON \u2014 there is no second unescaping pass, so encode for the ONE decode that happens. Use \`\\n\`/\`\\t\`/\`\\"\` in the JSON when you want the file to contain a REAL newline/tab/quote character (a raw unescaped newline inside a JSON string value breaks parsing). If the file itself must contain the two LITERAL characters backslash-then-n (e.g. inside a string literal like \`.join('\\n')\`, a regex, or an already-escaped JSON value), escape the backslash itself in your JSON so it survives the one decode intact \u2014 do NOT emit a bare \`\\n\` expecting a tool to turn it back into two literal characters for you; none of them do.
14919
+ - \`apply_patch\` (when available): inside each \`*** Update File\` section, list hunks in FILE ORDER, top to bottom. The applier only searches forward from where the previous hunk matched, so a hunk whose lines sit ABOVE the previous one fails with "Failed to find expected lines" even though the lines exist \u2014 the whole patch is then rejected. Unsure of the order? Re-read the file first, or split into one patch per hunk.
14920
+ - Tool arguments are strict JSON, and \`write\`/\`edit\`/\`batch-write\`/\`multi-edit\`/\`apply_patch\` write \`content\`/\`oldString\`/\`newString\`/\`patchText\` to disk EXACTLY as decoded from that JSON \u2014 there is no second unescaping pass, so encode for the ONE decode that happens. Use \`\\n\`/\`\\t\`/\`\\"\` in the JSON when you want the file to contain a REAL newline/tab/quote character (a raw unescaped newline inside a JSON string value breaks parsing). If the file itself must contain the two LITERAL characters backslash-then-n (e.g. inside a string literal like \`.join('\\n')\`, a regex, or an already-escaped JSON value), escape the backslash itself in your JSON so it survives the one decode intact \u2014 do NOT emit a bare \`\\n\` expecting a tool to turn it back into two literal characters for you; none of them do.
14920
14921
  - For tools where no batch variant exists (e.g. \`grep\`, \`glob\`), still emit MULTIPLE \`tool_use\` blocks in a SINGLE response when the calls are independent. Sequential turns waste a model round-trip per call.`;
14921
14922
  }
14922
14923
  }
@@ -14982,7 +14983,7 @@ FILE CREATION:
14982
14983
 
14983
14984
  GENERATED FILES:
14984
14985
  - \`src/extensions/site/components/**/*.generated.ts\` is an auto-generated editor-react-component manifest \u2014 NEVER hand-edit. Change a manifest VALUE in the component's \`*.extension.ts\`; change anything else in the \`*.tsx\` / \`*.module.css\` / \`*.props.ts\` source, then regenerate (workflow step 5). No other \`.generated.ts\` path is affected.
14985
- - A write guard rejects \`write\`/\`edit\`/\`batch-write\`/\`multi-edit\` there, dropping the ENTIRE call \u2014 never batch that path with real edits, or those are lost too and must be resubmitted.
14986
+ - A write guard rejects \`write\`/\`edit\`/\`batch-write\`/\`multi-edit\`/\`apply_patch\` there, dropping the ENTIRE call \u2014 never batch that path with real edits (or put it in a patch alongside other hunks), or those are lost too and must be resubmitted.
14986
14987
 
14987
14988
  TYPESCRIPT:
14988
14989
  - The project enables \`verbatimModuleSyntax\`. Type-only imports MUST use \`import type\`.
@@ -15727,6 +15728,20 @@ export const SubagentToolLogger = async () => {
15727
15728
  }
15728
15729
  });
15729
15730
 
15731
+ // dist/opencode-integration/apply-patch.js
15732
+ var require_apply_patch = __commonJS({
15733
+ "dist/opencode-integration/apply-patch.js"(exports2) {
15734
+ "use strict";
15735
+ Object.defineProperty(exports2, "__esModule", { value: true });
15736
+ exports2.PATCH_FILE_HEADER_RE = void 0;
15737
+ exports2.extractPatchPaths = extractPatchPaths;
15738
+ exports2.PATCH_FILE_HEADER_RE = /^\*\*\* (?:Add File|Update File|Delete File|Move to):(.*)$/;
15739
+ function extractPatchPaths(patchText) {
15740
+ return patchText.split(/\r?\n/).map((line) => exports2.PATCH_FILE_HEADER_RE.exec(line)?.[1].trim() ?? "").filter((p) => p !== "");
15741
+ }
15742
+ }
15743
+ });
15744
+
15730
15745
  // dist/opencode-integration/execution/parser.js
15731
15746
  var require_parser = __commonJS({
15732
15747
  "dist/opencode-integration/execution/parser.js"(exports2) {
@@ -15741,6 +15756,7 @@ var require_parser = __commonJS({
15741
15756
  exports2.summarizeOpenCodeLine = summarizeOpenCodeLine;
15742
15757
  var types_1 = require_types4();
15743
15758
  var subagent_tool_logger_1 = require_subagent_tool_logger();
15759
+ var apply_patch_1 = require_apply_patch();
15744
15760
  function parseRequiredPermissions(output) {
15745
15761
  let permissions = [];
15746
15762
  const lines = output.split("\n");
@@ -15851,7 +15867,14 @@ var require_parser = __commonJS({
15851
15867
  function summarizeOutput(tool, output) {
15852
15868
  return FULL_OUTPUT_TOOLS.has(tool) ? truncate(output, FULL_OUTPUT_CAP) : truncate(output);
15853
15869
  }
15870
+ var PATCH_TEXT_CAP = 4e3;
15854
15871
  function summarizeInput(input) {
15872
+ if (typeof input.patchText === "string") {
15873
+ return {
15874
+ patchFiles: (0, apply_patch_1.extractPatchPaths)(input.patchText),
15875
+ patchText: truncate(input.patchText, PATCH_TEXT_CAP)
15876
+ };
15877
+ }
15855
15878
  if (input.files) {
15856
15879
  return { files: input.files.map(({ path }) => ({ path })) };
15857
15880
  }
@@ -15866,6 +15889,18 @@ var require_parser = __commonJS({
15866
15889
  ...input.description && { description: truncate(input.description) }
15867
15890
  };
15868
15891
  }
15892
+ function summarizeMetadata(metadata) {
15893
+ const trimmed = { ...metadata };
15894
+ delete trimmed.diff;
15895
+ if (trimmed.files) {
15896
+ trimmed.files = trimmed.files.map((file) => {
15897
+ const copy = { ...file };
15898
+ delete copy.patch;
15899
+ return copy;
15900
+ });
15901
+ }
15902
+ return trimmed;
15903
+ }
15869
15904
  function summarizeOpenCodeLine(line) {
15870
15905
  if (line.type !== "tool_use" && line.type !== subagent_tool_logger_1.SUBAGENT_TOOL_EVENT_TYPE) {
15871
15906
  return line;
@@ -15881,6 +15916,9 @@ var require_parser = __commonJS({
15881
15916
  ...state?.input && { input: summarizeInput(state.input) },
15882
15917
  ...state?.output && {
15883
15918
  output: summarizeOutput(part.tool, state.output)
15919
+ },
15920
+ ...state?.metadata && part.tool === "apply_patch" && {
15921
+ metadata: summarizeMetadata(state.metadata)
15884
15922
  }
15885
15923
  }
15886
15924
  }
@@ -23929,8 +23967,9 @@ var require_generated_files_guard = __commonJS({
23929
23967
  exports2.buildGeneratedFilesGuardSource = buildGeneratedFilesGuardSource;
23930
23968
  exports2.writeGeneratedFilesGuardPlugin = writeGeneratedFilesGuardPlugin;
23931
23969
  var write_plugin_1 = require_write_plugin();
23970
+ var apply_patch_1 = require_apply_patch();
23932
23971
  var ERC_MANIFEST_RE = /(^|\/)src\/extensions\/site\/components\/.+\.generated\.tsx?$/;
23933
- exports2.GUARD_MESSAGE = "BLOCKED: this editor-react-component manifest is auto-generated. Do not create or edit it by hand \u2014 edit the *.tsx / *.module.css / *.props.ts source and regenerate with `npx wix build && npx wix generate manifest`, or override values in the component's *.extension.ts. Do not re-attempt the blocked path; the whole call was rejected, so resubmit any other paths it carried \u2014 they were not written. Only *.generated.ts under src/extensions/site/components/ is blocked.";
23972
+ exports2.GUARD_MESSAGE = "BLOCKED: this editor-react-component manifest is auto-generated. Do not create or edit it by hand \u2014 edit the *.tsx / *.module.css / *.props.ts source and regenerate with `npx wix build && npx wix generate manifest`, or override values in the component's *.extension.ts. Do not re-attempt the blocked path; the whole call was rejected \u2014 including every other file or apply_patch hunk it carried \u2014 so resubmit those; they were not written. Only *.generated.ts under src/extensions/site/components/ is blocked.";
23934
23973
  function isEditorComponentManifest(path) {
23935
23974
  return ERC_MANIFEST_RE.test(path);
23936
23975
  }
@@ -23938,6 +23977,9 @@ var require_generated_files_guard = __commonJS({
23938
23977
  if (tool === "write" || tool === "edit") {
23939
23978
  return typeof args.filePath === "string" ? [args.filePath] : [];
23940
23979
  }
23980
+ if (tool === "apply_patch") {
23981
+ return typeof args.patchText === "string" ? (0, apply_patch_1.extractPatchPaths)(args.patchText) : [];
23982
+ }
23941
23983
  const list = tool === "batch-write" ? args.files : tool === "multi-edit" ? args.edits : void 0;
23942
23984
  if (!list)
23943
23985
  return [];
@@ -23948,11 +23990,19 @@ var require_generated_files_guard = __commonJS({
23948
23990
  return `// Generated by @wix/ditto-codegen (generated-files-guard). Do not edit.
23949
23991
  const ERC_MANIFEST_RE = /${ERC_MANIFEST_RE.source}/;
23950
23992
  const GUARD_MESSAGE = ${JSON.stringify(exports2.GUARD_MESSAGE)};
23993
+ const PATCH_FILE_HEADER_RE = /${apply_patch_1.PATCH_FILE_HEADER_RE.source}/;
23951
23994
 
23952
23995
  function extractWritePaths(tool, args) {
23953
23996
  if (tool === "${"write"}" || tool === "${"edit"}") {
23954
23997
  return typeof args.filePath === "string" ? [args.filePath] : [];
23955
23998
  }
23999
+ if (tool === "${"apply_patch"}") {
24000
+ if (typeof args.patchText !== "string") return [];
24001
+ return args.patchText
24002
+ .split(/\\r?\\n/)
24003
+ .map((line) => PATCH_FILE_HEADER_RE.exec(line)?.[1].trim() ?? "")
24004
+ .filter((p) => p !== "");
24005
+ }
23956
24006
  const list =
23957
24007
  tool === "${"batch-write"}" ? args.files : tool === "${"multi-edit"}" ? args.edits : undefined;
23958
24008
  if (!list) return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.467",
3
+ "version": "1.0.469",
4
4
  "description": "AI-powered Wix CLI app generator - standalone executable",
5
5
  "scripts": {
6
6
  "build": "node build.mjs",
@@ -29,5 +29,5 @@
29
29
  "esbuild": "^0.27.2",
30
30
  "vitest": "^4.0.16"
31
31
  },
32
- "falconPackageHash": "6e0bea815a8cc927e371476a9322bb0e2056a44108fca77338b370ff"
32
+ "falconPackageHash": "e5fba022f3f6b012f98ca1d776f6a961488ea78cc5b9c837b512c528"
33
33
  }