@wix/ditto-codegen-public 1.0.350 → 1.0.352
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/required-permissions.ts +23 -0
- package/dist/out.js +13 -22
- package/package.json +2 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { tool } from "@opencode-ai/plugin";
|
|
2
|
+
|
|
3
|
+
export default tool({
|
|
4
|
+
description:
|
|
5
|
+
"Declare the Wix app permissions the generated code requires. Call ONCE at the " +
|
|
6
|
+
"very end of your response, after all files are written and validated, and ONLY if " +
|
|
7
|
+
"the code actually requires permissions — do NOT call this tool when none are needed. " +
|
|
8
|
+
"Pass SCOPE ID format (not human-readable names), e.g. `@wix/data` read → 'SCOPE.DC-DATA.READ', " +
|
|
9
|
+
"write → 'SCOPE.DC-DATA.WRITE', embedded scripts → 'SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS'. " +
|
|
10
|
+
"Only include scope IDs you have explicitly seen in the Wix SDK documentation (via MCP or " +
|
|
11
|
+
"loaded skills) — NEVER guess or fabricate them. Omitting a permission is better than " +
|
|
12
|
+
"inventing one.",
|
|
13
|
+
args: {
|
|
14
|
+
permissions: tool.schema
|
|
15
|
+
.array(tool.schema.string())
|
|
16
|
+
.describe(
|
|
17
|
+
"The required permission SCOPE IDs, e.g. ['SCOPE.DC-DATA.READ', 'SCOPE.DC-DATA.WRITE'].",
|
|
18
|
+
),
|
|
19
|
+
},
|
|
20
|
+
async execute(args) {
|
|
21
|
+
return `✓ recorded ${args.permissions.length} required permission(s)`;
|
|
22
|
+
},
|
|
23
|
+
});
|
package/dist/out.js
CHANGED
|
@@ -12068,10 +12068,12 @@ TOOL USAGE:
|
|
|
12068
12068
|
- "Building project"
|
|
12069
12069
|
- \`validate\` for all validation (tsc + build).
|
|
12070
12070
|
- \`uuid\` to generate UUIDs (supports count param for multiple). Do NOT use bash.
|
|
12071
|
+
- \`required-permissions\` to declare the Wix app permissions the generated code needs. Call it ONCE at the end, and ONLY if permissions are actually needed \u2014 don't call it otherwise (see PERMISSIONS).
|
|
12071
12072
|
- File operations \u2014 pick the BATCH tool whenever you have 2+ files; the single-file variants are 5\u201310\xD7 slower:
|
|
12072
12073
|
- \`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.
|
|
12073
12074
|
- \`batch-read\` to read N files in one call. NEVER call \`read\` more than once per turn \u2014 use batch-read instead.
|
|
12074
12075
|
- \`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.
|
|
12076
|
+
- In \`write\`/\`batch-write\` (\`content\`) and \`edit\`/\`multi-edit\` (\`newString\`) payloads, use real newlines/tabs/quotes \u2014 NEVER the two-character escape sequences \`\\n\`, \`\\t\`, or \`\\"\`. Those are written literally to disk and break \`tsc\`.
|
|
12075
12077
|
- 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.
|
|
12076
12078
|
- Before calling MCP tools, check if loaded skills already cover the API. Only use MCP for gaps.
|
|
12077
12079
|
- When using MCP to look up a Wix SDK method, ALWAYS call \`ReadFullDocsMethodSchema\` (not just \`ReadFullDocsArticle\`). The schema is the source of truth for parameter shapes. Code examples in docs may use incorrect call signatures.
|
|
@@ -12084,7 +12086,8 @@ IMPLEMENTATION WORKFLOW:
|
|
|
12084
12086
|
3. **Build**: Create every extension file in a SINGLE \`batch-write\` call. Build all extensions before registering. Include one \`progress\` call per extension type (e.g. "Creating dashboard page", "Creating service plugin").
|
|
12085
12087
|
4. **Register**: Register all extensions in \`src/extensions.ts\`. Include a \`progress\` call (e.g. "Registering extensions").
|
|
12086
12088
|
5. **Validate**: Run \`validate\` (typecheck only). Fix any errors and re-validate until tsc passes. Include a \`progress\` call (e.g. "Running type checks"). Then run \`validate({ runBuild: true })\` ONCE to verify the build. Pass \`installDeps: true\` ONLY when you added a new dependency to package.json in this iteration; otherwise omit it (node_modules is pre-installed). Include a \`progress\` call (e.g. "Building project").
|
|
12087
|
-
6. **
|
|
12089
|
+
6. **Declare permissions**: If the generated code requires Wix app permissions, call \`required-permissions\` ONCE with their SCOPE IDs (see PERMISSIONS below). Skip this step entirely if no permissions are needed.
|
|
12090
|
+
7. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
|
|
12088
12091
|
|
|
12089
12092
|
EFFICIENCY:
|
|
12090
12093
|
- Always prefer the BATCH variant: \`batch-write\` over multiple \`write\`s, \`batch-read\` over multiple \`read\`s, \`multi-edit\` over multiple \`edit\`s.
|
|
@@ -12099,21 +12102,14 @@ TYPESCRIPT:
|
|
|
12099
12102
|
- The project enables \`verbatimModuleSyntax\`. Type-only imports MUST use \`import type\`.
|
|
12100
12103
|
|
|
12101
12104
|
PERMISSIONS:
|
|
12102
|
-
|
|
12105
|
+
After the final \`validate\` pass and before you Stop, if the generated code requires Wix app permissions, call the \`required-permissions\` tool ONCE with them. If no permissions are required, do NOT call the tool at all.
|
|
12103
12106
|
Use SCOPE ID format (not human-readable names). Examples:
|
|
12104
12107
|
- \`@wix/data\` read \u2192 "SCOPE.DC-DATA.READ", write \u2192 "SCOPE.DC-DATA.WRITE"
|
|
12105
12108
|
- Embedded scripts \u2192 "SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS"
|
|
12106
12109
|
|
|
12107
12110
|
CRITICAL: Only include permissions that you have explicitly seen in the Wix SDK documentation (via MCP or loaded skills). NEVER guess or fabricate permission scope IDs. If you are unsure which permission a feature requires, look it up in the docs first. Omitting a permission is better than inventing one that does not exist.
|
|
12108
12111
|
|
|
12109
|
-
|
|
12110
|
-
["SCOPE.DC-DATA.READ", "SCOPE.DC-DATA.WRITE"]
|
|
12111
|
-
\`\`\`
|
|
12112
|
-
|
|
12113
|
-
If no permissions are required, output an empty array:
|
|
12114
|
-
\`\`\`json:required-permissions
|
|
12115
|
-
[]
|
|
12116
|
-
\`\`\``;
|
|
12112
|
+
Example: \`required-permissions({ permissions: ["SCOPE.DC-DATA.READ", "SCOPE.DC-DATA.WRITE"] })\``;
|
|
12117
12113
|
}
|
|
12118
12114
|
});
|
|
12119
12115
|
|
|
@@ -12515,26 +12511,21 @@ var require_parser = __commonJS({
|
|
|
12515
12511
|
return output.split("\n").filter((line) => line.trim()).map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event !== null && event.type === type);
|
|
12516
12512
|
}
|
|
12517
12513
|
function parseRequiredPermissions(output) {
|
|
12514
|
+
let permissions = [];
|
|
12518
12515
|
const lines = output.split("\n");
|
|
12519
12516
|
for (const line of lines) {
|
|
12520
12517
|
if (!line.trim())
|
|
12521
12518
|
continue;
|
|
12522
12519
|
const event = (0, types_1.tryParseJson)(line);
|
|
12523
|
-
if (!event || event.type !== "
|
|
12524
|
-
continue;
|
|
12525
|
-
const text = event.part.text;
|
|
12526
|
-
const match = text.match(/```json:required-permissions\s*\n?\s*(\[.*?\])\s*\n?```/s);
|
|
12527
|
-
if (!match)
|
|
12528
|
-
continue;
|
|
12529
|
-
const parsed = (0, types_1.tryParseJson)(match[1]);
|
|
12530
|
-
if (!Array.isArray(parsed))
|
|
12520
|
+
if (!event || event.type !== "tool_use" || event.part?.tool !== "required-permissions" || event.part.state?.status !== "completed") {
|
|
12531
12521
|
continue;
|
|
12532
|
-
const permissions = parsed.filter((p) => typeof p === "string");
|
|
12533
|
-
if (permissions.length > 0) {
|
|
12534
|
-
return permissions;
|
|
12535
12522
|
}
|
|
12523
|
+
const declared = event.part.state.input?.permissions;
|
|
12524
|
+
if (!Array.isArray(declared))
|
|
12525
|
+
continue;
|
|
12526
|
+
permissions = declared.filter((p) => typeof p === "string");
|
|
12536
12527
|
}
|
|
12537
|
-
return
|
|
12528
|
+
return permissions;
|
|
12538
12529
|
}
|
|
12539
12530
|
function parseFilesChanged(output) {
|
|
12540
12531
|
const filesChanged = [];
|
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.352",
|
|
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": "1eb9485337cb79d255ab44882d5de88973d8debe58775a6885bfa47e"
|
|
33
33
|
}
|