@wix/ditto-codegen-public 1.0.365 → 1.0.367
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/dist/opencode-tools/batch-write.ts +27 -3
- package/dist/out.js +4 -4
- package/package.json +2 -2
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { tool } from "@opencode-ai/plugin";
|
|
2
|
-
import { writeFile, mkdir } from "fs/promises";
|
|
2
|
+
import { writeFile, mkdir, stat } from "fs/promises";
|
|
3
3
|
import { join, dirname, isAbsolute } from "path";
|
|
4
4
|
|
|
5
|
+
// Overwriting a non-trivial existing file re-emits the whole file (slow/costly);
|
|
6
|
+
// such edits must use multi-edit. Smaller files are scaffolding stubs (allowed).
|
|
7
|
+
const EXISTING_FILE_REWRITE_GUARD_BYTES = 2048;
|
|
8
|
+
|
|
9
|
+
// Size of an existing regular file, or null if absent/not a file (a fresh create).
|
|
10
|
+
async function existingFileSize(path: string): Promise<number | null> {
|
|
11
|
+
try {
|
|
12
|
+
const s = await stat(path);
|
|
13
|
+
return s.isFile() ? s.size : null;
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
5
19
|
function unescapeString(str: string): string {
|
|
6
20
|
return str.replace(/\\(n|t|r|"|\\)/g, (_, c: string) => {
|
|
7
21
|
if (c === "n") return "\n";
|
|
@@ -18,8 +32,8 @@ function normalizeToolString(text: string): string {
|
|
|
18
32
|
|
|
19
33
|
export default tool({
|
|
20
34
|
description:
|
|
21
|
-
"Write multiple files
|
|
22
|
-
"
|
|
35
|
+
"Write multiple new files in one call (creates dirs). " +
|
|
36
|
+
"For an existing file, use multi-edit instead; batch-write rejects overwriting a non-trivial existing file.",
|
|
23
37
|
args: {
|
|
24
38
|
files: tool.schema
|
|
25
39
|
.array(
|
|
@@ -39,6 +53,16 @@ export default tool({
|
|
|
39
53
|
? f.path
|
|
40
54
|
: join(context.directory, f.path);
|
|
41
55
|
try {
|
|
56
|
+
const existingSize = await existingFileSize(fullPath);
|
|
57
|
+
if (
|
|
58
|
+
existingSize !== null &&
|
|
59
|
+
existingSize > EXISTING_FILE_REWRITE_GUARD_BYTES
|
|
60
|
+
) {
|
|
61
|
+
results.push(
|
|
62
|
+
`BLOCKED: ${f.path} exists; use multi-edit to change existing files.`,
|
|
63
|
+
);
|
|
64
|
+
continue;
|
|
65
|
+
}
|
|
42
66
|
await mkdir(dirname(fullPath), { recursive: true });
|
|
43
67
|
const content =
|
|
44
68
|
typeof f.content === "string"
|
package/dist/out.js
CHANGED
|
@@ -11246,7 +11246,7 @@ ${(0, prompt_utils_1.formatChatHistory)(recentHistory, "CONVERSATION CONTEXT")}
|
|
|
11246
11246
|
INSTRUCTIONS:
|
|
11247
11247
|
1. Read the latest user request carefully
|
|
11248
11248
|
2. If it asks to CREATE something new, create it as a new extension using skills
|
|
11249
|
-
3. If it asks to MODIFY existing code,
|
|
11249
|
+
3. If it asks to MODIFY existing code, edit only what is needed with \`multi-edit\`; never rewrite a whole file.
|
|
11250
11250
|
4. Do NOT ignore the user's request or substitute your own interpretation`;
|
|
11251
11251
|
}
|
|
11252
11252
|
function buildIterationPrompt(chatHistory) {
|
|
@@ -13513,8 +13513,8 @@ Example: \`required-permissions({ permissions: ["SCOPE.DC-DATA.READ", "SCOPE.DC-
|
|
|
13513
13513
|
|
|
13514
13514
|
USER ACTIONS:
|
|
13515
13515
|
After the final \`validate\` pass and before you Stop, call the \`user-actions\` tool ONCE ONLY if the app needs the user to perform manual setup for it to ACTUALLY WORK. This includes setup OUTSIDE Wix (third-party API keys, connecting an external account, registering a webhook elsewhere) AND setup INSIDE Wix that you could not do in code (e.g. creating a Wix Triggered Email template, configuring a Wix Automation, adding a value in Secrets Manager). If there is no such setup, do NOT call the tool at all.
|
|
13516
|
-
Pass the steps in the \`output\` arg as a single markdown string \u2014 it is rendered directly to the user, so keep it concise and user-facing (a short intro line followed by a bulleted or numbered list). Example:
|
|
13517
|
-
"After installing the app, complete these steps:\\
|
|
13516
|
+
Pass the steps in the \`output\` arg as a single markdown string \u2014 it is rendered directly to the user, so keep it concise and user-facing (a short intro line followed by a bulleted or numbered list). FORMAT IT TIGHTLY: use a SINGLE newline (\`\\n\`) everywhere \u2014 between the intro line and the first item AND between items. Do NOT use blank lines (\`\\n\\n\`) anywhere. Blank lines make the client render each item on its own line with extra spacing. Example:
|
|
13517
|
+
"After installing the app, complete these steps:\\n1. **Add your Stripe secret key** \u2014 open the app's settings and paste your Stripe secret key.\\n2. **Create the stock-alert email template** \u2014 in your Wix dashboard, create a Triggered Email template so subscribers receive the alert email."
|
|
13518
13518
|
|
|
13519
13519
|
AUDIENCE \u2014 be explicit about WHO performs each step. Two audiences exist: (1) the APP DEVELOPER (working in Dev Center / the app's own settings), and (2) the SITE OWNER who INSTALLS the app on their site (the merchant with the real Stripe account, their own Wix dashboard, etc.). Most third-party credentials and dashboard setup (their API key, creating a Triggered Email template in their dashboard, configuring an automation) are done by the INSTALLING site owner \u2014 not the developer. When a step is for the installing user, phrase it that way: start it with "After installing the app, \u2026" or "The site owner must \u2026", so it's clear it happens post-install on the installer's site. Use developer-facing phrasing only for steps the developer genuinely performs.
|
|
13520
13520
|
|
|
@@ -13532,7 +13532,7 @@ Do NOT include the steps Wix already handles through its own flows:
|
|
|
13532
13532
|
- Publishing the site.
|
|
13533
13533
|
Also do NOT include things you already did in code (created files, registered extensions) or things the app does automatically on install. In particular, a site plugin configured with \`installation: { autoAdd: true }\` is placed on its slot automatically \u2014 NEVER tell the user to add it in the Editor. Only declare manual placement for slots that don't support auto-add (e.g. the checkout page).
|
|
13534
13534
|
|
|
13535
|
-
Example: \`user-actions({ output: "To finish setting up your app:\\
|
|
13535
|
+
Example: \`user-actions({ output: "To finish setting up your app:\\n1. **Add your Stripe secret key** \u2014 open the app settings and paste it." })\``;
|
|
13536
13536
|
}
|
|
13537
13537
|
});
|
|
13538
13538
|
|
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.367",
|
|
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": "334ea64feb8da31a445017f2c5a350e11334df997c23ffb1fe7984c9"
|
|
33
33
|
}
|