@wix/ditto-codegen-public 1.0.425 → 1.0.427
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.
|
@@ -16,14 +16,13 @@ async function existingFileSize(path: string): Promise<number | null> {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
// Keep in sync with normalize-tool-string.ts. Only whitespace/control escapes
|
|
20
|
-
// are unescaped; `\"` and `\\` are NOT, or legitimate escaped quotes/backslashes
|
|
21
|
-
// in the content (e.g. "C:\\Users", /\\d+/) would be silently corrupted.
|
|
22
19
|
function unescapeString(str: string): string {
|
|
23
|
-
return str.replace(/\\(n|t|r)/g, (_, c: string) => {
|
|
20
|
+
return str.replace(/\\(n|t|r|"|\\)/g, (_, c: string) => {
|
|
24
21
|
if (c === "n") return "\n";
|
|
25
22
|
if (c === "t") return "\t";
|
|
26
|
-
return "\r";
|
|
23
|
+
if (c === "r") return "\r";
|
|
24
|
+
if (c === '"') return '"';
|
|
25
|
+
return "\\";
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
|
|
@@ -2,14 +2,13 @@ import { tool } from "@opencode-ai/plugin";
|
|
|
2
2
|
import { readFile, writeFile } from "fs/promises";
|
|
3
3
|
import { join, isAbsolute } from "path";
|
|
4
4
|
|
|
5
|
-
// Keep in sync with normalize-tool-string.ts. Only whitespace/control escapes
|
|
6
|
-
// are unescaped; `\"` and `\\` are NOT, or legitimate escaped quotes/backslashes
|
|
7
|
-
// in the content (e.g. "C:\\Users", /\\d+/) would be silently corrupted.
|
|
8
5
|
function unescapeString(str: string): string {
|
|
9
|
-
return str.replace(/\\(n|t|r)/g, (_, c: string) => {
|
|
6
|
+
return str.replace(/\\(n|t|r|"|\\)/g, (_, c: string) => {
|
|
10
7
|
if (c === "n") return "\n";
|
|
11
8
|
if (c === "t") return "\t";
|
|
12
|
-
return "\r";
|
|
9
|
+
if (c === "r") return "\r";
|
|
10
|
+
if (c === '"') return '"';
|
|
11
|
+
return "\\";
|
|
13
12
|
});
|
|
14
13
|
}
|
|
15
14
|
|
package/dist/out.js
CHANGED
|
@@ -11675,13 +11675,15 @@ or reports what it couldn't fix. Validation step only \u2014 never generates fea
|
|
|
11675
11675
|
var VALIDATOR_PROMPT = `Run 'validate({ runBuild: true })', fix the errors it reports, and re-run until
|
|
11676
11676
|
it passes. You are fixing EXISTING code \u2014 do NOT add features or rewrite whole
|
|
11677
11677
|
files. NEVER force a green build by suppressing types: no 'as any', no
|
|
11678
|
-
'@ts-ignore'/'@ts-expect-error', and do NOT switch a correct import
|
|
11679
|
-
'import
|
|
11680
|
-
|
|
11678
|
+
'@ts-ignore'/'@ts-expect-error', and do NOT switch a correct named import to
|
|
11679
|
+
'import * as' just to satisfy tsc \u2014 that ships code that compiles but breaks
|
|
11680
|
+
at runtime. A type error on a
|
|
11681
11681
|
Wix SDK method/namespace/parameter means the call is WRONG: look up the correct
|
|
11682
11682
|
usage via skills or wix-mcp ('SearchWixSDKDocumentation' \u2192
|
|
11683
11683
|
'ReadFullDocsMethodSchema') and fix it to the real exported method + its options
|
|
11684
|
-
object.
|
|
11684
|
+
object. Deleting the failing code is a regression, not a fix \u2014 the capability is
|
|
11685
|
+
usually on a sibling method or another Wix SDK; search both before reporting it
|
|
11686
|
+
unfixed. Work in a bounded number of fix cycles \u2014 if the build isn't converging
|
|
11685
11687
|
after a few attempts, STOP and return the remaining errors verbatim rather than
|
|
11686
11688
|
looping; never silence them.
|
|
11687
11689
|
|
|
@@ -14912,6 +14914,7 @@ var require_shared_rules = __commonJS({
|
|
|
14912
14914
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
14913
14915
|
exports2.OUTPUT_MESSAGE_RULES = exports2.BOUNDARY_RULES = void 0;
|
|
14914
14916
|
exports2.buildEnvironmentRules = buildEnvironmentRules;
|
|
14917
|
+
exports2.buildFileOperationsRules = buildFileOperationsRules;
|
|
14915
14918
|
function buildEnvironmentRules(environmentIdentity) {
|
|
14916
14919
|
return `ENVIRONMENT:
|
|
14917
14920
|
${environmentIdentity}`;
|
|
@@ -14924,6 +14927,15 @@ ${environmentIdentity}`;
|
|
|
14924
14927
|
- Match their technical level: include code/technical detail only if their request was technical; otherwise describe the outcome in plain language (no code, file/type names, or internals).
|
|
14925
14928
|
- List any manual setup the user must still do for the feature to work, as short "next steps" (e.g. installing a dependent app or enabling a dashboard setting).
|
|
14926
14929
|
- Be honest: if you didn't fully build what was asked (e.g. stored data but didn't send it), say so. Keep it short.`;
|
|
14930
|
+
function buildFileOperationsRules(multiEditContextClause) {
|
|
14931
|
+
return `- Package dependencies \u2014 \`npm install <pkg>\` any package not already in \`package.json\` BEFORE the first \`validate\` (do NOT wait for \`TS2307\`); install all needed packages in ONE command. Do NOT hand-edit \`package.json\` for deps unless npm cannot be used.
|
|
14932
|
+
- File operations \u2014 pick the BATCH tool whenever you have 2+ files; the single-file variants are 5\u201310\xD7 slower:
|
|
14933
|
+
- \`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.
|
|
14934
|
+
- \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
|
|
14935
|
+
- \`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.
|
|
14936
|
+
- 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.
|
|
14937
|
+
- 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.`;
|
|
14938
|
+
}
|
|
14927
14939
|
}
|
|
14928
14940
|
});
|
|
14929
14941
|
|
|
@@ -14953,13 +14965,7 @@ TOOL USAGE:
|
|
|
14953
14965
|
- \`uuid\` to generate UUIDs (supports count param for multiple). Do NOT use bash.
|
|
14954
14966
|
- \`wix-generate\` to scaffold extensions non-interactively \u2014 prefer over hand-writing boilerplate; pass an array to scaffold several at once. It RETURNS every created file's contents, so trust that and do NOT \`read\`/\`batch-read\` them afterward. On a \`FAILED\` block, fix the params per the error and retry.
|
|
14955
14967
|
- \`required-permissions\` \u2014 declare the Wix app permissions the generated code needs (when/whether to call: workflow step 6 + PERMISSIONS).
|
|
14956
|
-
|
|
14957
|
-
- File operations \u2014 pick the BATCH tool whenever you have 2+ files; the single-file variants are 5\u201310\xD7 slower:
|
|
14958
|
-
- \`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.
|
|
14959
|
-
- \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
|
|
14960
|
-
- \`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 fixing type errors across N files, use ONE \`multi-edit\` with all N edits.
|
|
14961
|
-
- Tool arguments are strict JSON. For multiline strings in \`write\`, \`edit\`, \`batch-write\`, and \`multi-edit\`, use JSON escape sequences (\`\\n\`, \`\\t\`, \`\\"\`) \u2014 do NOT put raw (unescaped) newlines inside JSON string values (that breaks parsing). All four write tools (\`write\`, \`edit\`, \`batch-write\`, \`multi-edit\`) normalize literal two-character escape sequences before writing; prefer proper JSON escapes.
|
|
14962
|
-
- 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.
|
|
14968
|
+
${(0, shared_rules_1.buildFileOperationsRules)("fixing type errors")}
|
|
14963
14969
|
- API discovery (shapes, method signatures, types) \u2014 in this order: (1) loaded skills + KNOWN WIX APIS, if they already cover the API \u2014 if so, do NOT delegate; (2) only when you genuinely don't know which method/API to use, delegate to \`codegen-wix-docs\` (Wix SDK) or \`codegen-wds-docs\` (WDS) to SEARCH for it \u2014 pass the question, not a known article link; the subagent searches AND reads the right schema (\`ReadFullDocsMethodSchema\` is the source of truth for parameter shapes) and returns a summary. Do NOT delegate just to fetch a doc you already identified; (3) grepping \`node_modules\` ONLY as a last resort if the above return nothing \u2014 SDK internals are not a documentation source, and doing it first wastes turns, inflates context, and is unreliable. ENFORCED: after 2 such lookups, further bash inspection of \`node_modules\` Wix/vite/astro internals is rejected.
|
|
14964
14970
|
- NEVER run preview, dev, release, or promote commands.
|
|
14965
14971
|
|
|
@@ -15048,6 +15054,7 @@ var require_git_conflicts_rules = __commonJS({
|
|
|
15048
15054
|
"use strict";
|
|
15049
15055
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
15050
15056
|
exports2.GIT_CONFLICTS_RULES = void 0;
|
|
15057
|
+
var shared_rules_1 = require_shared_rules();
|
|
15051
15058
|
exports2.GIT_CONFLICTS_RULES = `CORE PRINCIPLES:
|
|
15052
15059
|
- You are a Git merge conflict resolver. Your ONLY job is to fix merge conflict markers in files.
|
|
15053
15060
|
- Do NOT generate new features, refactor code, or make changes beyond resolving conflicts.
|
|
@@ -15079,13 +15086,7 @@ MINIMIZE TEXT OUTPUT \u2014 CRITICAL:
|
|
|
15079
15086
|
|
|
15080
15087
|
TOOL USAGE:
|
|
15081
15088
|
- \`validate\` for all validation (tsc + build). Run it after resolving the conflicts to make sure nothing breaks.
|
|
15082
|
-
|
|
15083
|
-
- File operations \u2014 pick the BATCH tool whenever you have 2+ files; the single-file variants are 5\u201310\xD7 slower:
|
|
15084
|
-
- \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
|
|
15085
|
-
- \`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 resolving conflicts across N files, use ONE \`multi-edit\` with all N edits.
|
|
15086
|
-
- \`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.
|
|
15087
|
-
- Tool arguments are strict JSON. For multiline strings in \`write\`, \`edit\`, \`batch-write\`, and \`multi-edit\`, use JSON escape sequences (\`\\n\`, \`\\t\`, \`\\"\`) \u2014 do NOT put raw (unescaped) newlines inside JSON string values (that breaks parsing). All four write tools (\`write\`, \`edit\`, \`batch-write\`, \`multi-edit\`) normalize literal two-character escape sequences before writing; prefer proper JSON escapes.
|
|
15088
|
-
- 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.
|
|
15089
|
+
${(0, shared_rules_1.buildFileOperationsRules)("resolving conflicts")}
|
|
15089
15090
|
- NEVER run preview, dev, release, or promote commands.
|
|
15090
15091
|
|
|
15091
15092
|
WORKFLOW:
|
|
@@ -23239,85 +23240,6 @@ export const GeneratedFilesGuard = async () => ({
|
|
|
23239
23240
|
}
|
|
23240
23241
|
});
|
|
23241
23242
|
|
|
23242
|
-
// dist/opencode-integration/normalize-tool-string.js
|
|
23243
|
-
var require_normalize_tool_string = __commonJS({
|
|
23244
|
-
"dist/opencode-integration/normalize-tool-string.js"(exports2) {
|
|
23245
|
-
"use strict";
|
|
23246
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
23247
|
-
exports2.unescapeString = unescapeString;
|
|
23248
|
-
exports2.normalizeToolString = normalizeToolString;
|
|
23249
|
-
function unescapeString(str) {
|
|
23250
|
-
return str.replace(/\\(n|t|r)/g, (_, c) => {
|
|
23251
|
-
if (c === "n")
|
|
23252
|
-
return "\n";
|
|
23253
|
-
if (c === "t")
|
|
23254
|
-
return " ";
|
|
23255
|
-
return "\r";
|
|
23256
|
-
});
|
|
23257
|
-
}
|
|
23258
|
-
function normalizeToolString(text) {
|
|
23259
|
-
return unescapeString(text).replace(/\r\n/g, "\n");
|
|
23260
|
-
}
|
|
23261
|
-
}
|
|
23262
|
-
});
|
|
23263
|
-
|
|
23264
|
-
// dist/opencode-integration/edit-normalizer.js
|
|
23265
|
-
var require_edit_normalizer = __commonJS({
|
|
23266
|
-
"dist/opencode-integration/edit-normalizer.js"(exports2) {
|
|
23267
|
-
"use strict";
|
|
23268
|
-
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
23269
|
-
exports2.NORMALIZE_PLUGIN_PATH = void 0;
|
|
23270
|
-
exports2.buildNormalizePluginSource = buildNormalizePluginSource;
|
|
23271
|
-
exports2.writeNormalizePlugin = writeNormalizePlugin;
|
|
23272
|
-
var promises_1 = require("fs/promises");
|
|
23273
|
-
var os_1 = require("os");
|
|
23274
|
-
var path_1 = require("path");
|
|
23275
|
-
var logger_12 = require_logger();
|
|
23276
|
-
var normalize_tool_string_1 = require_normalize_tool_string();
|
|
23277
|
-
var GLOBAL_PLUGIN_DIR = (0, path_1.join)((0, os_1.homedir)(), ".config", "opencode", "plugin");
|
|
23278
|
-
var NORMALIZE_PLUGIN_FILENAME = "edit-write-normalizer.ts";
|
|
23279
|
-
exports2.NORMALIZE_PLUGIN_PATH = (0, path_1.join)(GLOBAL_PLUGIN_DIR, NORMALIZE_PLUGIN_FILENAME);
|
|
23280
|
-
function buildNormalizePluginSource() {
|
|
23281
|
-
return `// Generated by @wix/ditto-codegen (edit-normalizer) \u2014 do not edit.
|
|
23282
|
-
${normalize_tool_string_1.unescapeString.toString()}
|
|
23283
|
-
|
|
23284
|
-
${normalize_tool_string_1.normalizeToolString.toString()}
|
|
23285
|
-
|
|
23286
|
-
export const EditWriteNormalizer = async () => ({
|
|
23287
|
-
"tool.execute.before": async (
|
|
23288
|
-
input: { tool: string },
|
|
23289
|
-
output: {
|
|
23290
|
-
args?: { oldString?: string; newString?: string; content?: string };
|
|
23291
|
-
},
|
|
23292
|
-
) => {
|
|
23293
|
-
const args = output?.args;
|
|
23294
|
-
if (!args) return;
|
|
23295
|
-
if (input.tool === "edit") {
|
|
23296
|
-
if (typeof args.oldString === "string") {
|
|
23297
|
-
args.oldString = normalizeToolString(args.oldString);
|
|
23298
|
-
}
|
|
23299
|
-
if (typeof args.newString === "string") {
|
|
23300
|
-
args.newString = normalizeToolString(args.newString);
|
|
23301
|
-
}
|
|
23302
|
-
} else if (input.tool === "write") {
|
|
23303
|
-
if (typeof args.content === "string") {
|
|
23304
|
-
args.content = normalizeToolString(args.content);
|
|
23305
|
-
}
|
|
23306
|
-
}
|
|
23307
|
-
},
|
|
23308
|
-
});
|
|
23309
|
-
`;
|
|
23310
|
-
}
|
|
23311
|
-
async function writeNormalizePlugin() {
|
|
23312
|
-
await (0, promises_1.mkdir)(GLOBAL_PLUGIN_DIR, { recursive: true });
|
|
23313
|
-
await (0, promises_1.writeFile)(exports2.NORMALIZE_PLUGIN_PATH, buildNormalizePluginSource(), "utf-8");
|
|
23314
|
-
logger_12.logger.info("[OpenCode] Wrote edit/write normalizer plugin", {
|
|
23315
|
-
path: exports2.NORMALIZE_PLUGIN_PATH
|
|
23316
|
-
});
|
|
23317
|
-
}
|
|
23318
|
-
}
|
|
23319
|
-
});
|
|
23320
|
-
|
|
23321
23243
|
// dist/plugin-host.js
|
|
23322
23244
|
var require_plugin_host = __commonJS({
|
|
23323
23245
|
"dist/plugin-host.js"(exports2) {
|
|
@@ -23386,7 +23308,6 @@ var tools_writer_1 = require_tools_writer();
|
|
|
23386
23308
|
var node_modules_guard_1 = require_node_modules_guard();
|
|
23387
23309
|
var generated_files_guard_1 = require_generated_files_guard();
|
|
23388
23310
|
var subagent_tool_logger_1 = require_subagent_tool_logger();
|
|
23389
|
-
var edit_normalizer_1 = require_edit_normalizer();
|
|
23390
23311
|
var plugin_artifacts_1 = require_plugin_artifacts();
|
|
23391
23312
|
var config_1 = require_config();
|
|
23392
23313
|
var environments_1 = require_environments();
|
|
@@ -23462,8 +23383,7 @@ async function initOpenCode() {
|
|
|
23462
23383
|
(0, tools_writer_1.writeToolFiles)(pluginArtifacts.tools),
|
|
23463
23384
|
(0, node_modules_guard_1.writeGuardPlugin)(),
|
|
23464
23385
|
(0, generated_files_guard_1.writeGeneratedFilesGuardPlugin)(),
|
|
23465
|
-
(0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)()
|
|
23466
|
-
(0, edit_normalizer_1.writeNormalizePlugin)()
|
|
23386
|
+
(0, subagent_tool_logger_1.writeSubagentToolLoggerPlugin)()
|
|
23467
23387
|
]);
|
|
23468
23388
|
}
|
|
23469
23389
|
async function main(ctx) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/ditto-codegen-public",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.427",
|
|
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": "
|
|
32
|
+
"falconPackageHash": "2a0054e25cf0cac56f2ab826137eb8c5fe54baa8861f95091fe0a6a7"
|
|
33
33
|
}
|