@wix/ditto-codegen-public 1.0.350 → 1.0.351
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 +12 -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,6 +12068,7 @@ 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.
|
|
@@ -12084,7 +12085,8 @@ IMPLEMENTATION WORKFLOW:
|
|
|
12084
12085
|
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
12086
|
4. **Register**: Register all extensions in \`src/extensions.ts\`. Include a \`progress\` call (e.g. "Registering extensions").
|
|
12086
12087
|
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. **
|
|
12088
|
+
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.
|
|
12089
|
+
7. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
|
|
12088
12090
|
|
|
12089
12091
|
EFFICIENCY:
|
|
12090
12092
|
- 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 +12101,14 @@ TYPESCRIPT:
|
|
|
12099
12101
|
- The project enables \`verbatimModuleSyntax\`. Type-only imports MUST use \`import type\`.
|
|
12100
12102
|
|
|
12101
12103
|
PERMISSIONS:
|
|
12102
|
-
|
|
12104
|
+
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
12105
|
Use SCOPE ID format (not human-readable names). Examples:
|
|
12104
12106
|
- \`@wix/data\` read \u2192 "SCOPE.DC-DATA.READ", write \u2192 "SCOPE.DC-DATA.WRITE"
|
|
12105
12107
|
- Embedded scripts \u2192 "SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS"
|
|
12106
12108
|
|
|
12107
12109
|
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
12110
|
|
|
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
|
-
\`\`\``;
|
|
12111
|
+
Example: \`required-permissions({ permissions: ["SCOPE.DC-DATA.READ", "SCOPE.DC-DATA.WRITE"] })\``;
|
|
12117
12112
|
}
|
|
12118
12113
|
});
|
|
12119
12114
|
|
|
@@ -12515,26 +12510,21 @@ var require_parser = __commonJS({
|
|
|
12515
12510
|
return output.split("\n").filter((line) => line.trim()).map((line) => (0, types_1.tryParseJson)(line)).filter((event) => event !== null && event.type === type);
|
|
12516
12511
|
}
|
|
12517
12512
|
function parseRequiredPermissions(output) {
|
|
12513
|
+
let permissions = [];
|
|
12518
12514
|
const lines = output.split("\n");
|
|
12519
12515
|
for (const line of lines) {
|
|
12520
12516
|
if (!line.trim())
|
|
12521
12517
|
continue;
|
|
12522
12518
|
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))
|
|
12519
|
+
if (!event || event.type !== "tool_use" || event.part?.tool !== "required-permissions" || event.part.state?.status !== "completed") {
|
|
12531
12520
|
continue;
|
|
12532
|
-
const permissions = parsed.filter((p) => typeof p === "string");
|
|
12533
|
-
if (permissions.length > 0) {
|
|
12534
|
-
return permissions;
|
|
12535
12521
|
}
|
|
12522
|
+
const declared = event.part.state.input?.permissions;
|
|
12523
|
+
if (!Array.isArray(declared))
|
|
12524
|
+
continue;
|
|
12525
|
+
permissions = declared.filter((p) => typeof p === "string");
|
|
12536
12526
|
}
|
|
12537
|
-
return
|
|
12527
|
+
return permissions;
|
|
12538
12528
|
}
|
|
12539
12529
|
function parseFilesChanged(output) {
|
|
12540
12530
|
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.351",
|
|
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": "3708d27949830337bd148a06d1b7efee98e5e018a789462083489bb3"
|
|
33
33
|
}
|