@wix/ditto-codegen-public 1.0.507 → 1.0.508

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.
Files changed (2) hide show
  1. package/dist/out.js +49 -22
  2. package/package.json +2 -2
package/dist/out.js CHANGED
@@ -14154,7 +14154,8 @@ var require_dist8 = __commonJS({
14154
14154
  plugins: [codegen_checkpoint_plugin_1.checkpointPluginFactory],
14155
14155
  toolPolicies: [...codegen_common_logic_1.SITE_POLICIES, ...codegen_common_logic_1.STUDIO_2_POLICIES],
14156
14156
  chargingMode: "app",
14157
- moduleSpecifierPrefix: ditto_codegen_types_12.COMPANION_APP_MODULE_SPECIFIER_PREFIX
14157
+ moduleSpecifierPrefix: ditto_codegen_types_12.COMPANION_APP_MODULE_SPECIFIER_PREFIX,
14158
+ requiredPermissions: false
14158
14159
  };
14159
14160
  }
14160
14161
  });
@@ -14509,7 +14510,8 @@ var require_dist10 = __commonJS({
14509
14510
  decisionCheckers: [],
14510
14511
  plugins: [codegen_feature_vibe_plugin_1.featureVibePluginFactory],
14511
14512
  toolPolicies: codegen_common_logic_1.SITE_POLICIES,
14512
- chargingMode: "app"
14513
+ chargingMode: "app",
14514
+ requiredPermissions: true
14513
14515
  };
14514
14516
  }
14515
14517
  });
@@ -14653,7 +14655,28 @@ var require_codegen_rules = __commonJS({
14653
14655
  toolRule: "- `validate` (tsc + build + editor-component manifests) \u2014 you call it yourself at step 5. Do NOT delegate it.",
14654
14656
  step: `5. **Validate**: Call \`validate({ runBuild: true })\` yourself \u2014 it typechecks, builds, and generates manifests when editor components exist (tsc runs first and fails fast before the build). Fix any errors and re-run until it passes. Pass installDeps: true only if package.json changed and npm install was not already run in this session. Do NOT delegate this to a subagent, and do NOT make a separate tsc-only call first \u2014 the single runBuild pass already fails fast on type errors. NEVER force a green build: no \`as any\`, no \`@ts-ignore\`, no NEW \`@ts-expect-error\`, no switching a correct named import to \`import * as\`, and no changing runtime behaviour (e.g. unwanted \`defaultProps\` values) or deleting the failing code just to satisfy tsc. Do NOT move on until validation is clean. Do NOT inspect extension types or run \`npx wix generate manifest\` directly; \`validate\` handles manifest generation when editor components exist. Once validation is clean, run any further post-build checks the skill requires; if one makes you change code, re-run \`validate\`.`
14655
14657
  };
14656
- var buildCoreRules = (validation) => `CORE PRINCIPLES:
14658
+ var DECLARED_PERMISSIONS = {
14659
+ toolRule: "- `required-permissions` \u2014 declare the Wix app permissions the generated code needs (when/whether to call: workflow step 6 + PERMISSIONS).\n",
14660
+ step: "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.\n",
14661
+ reportDocsStep: 7,
14662
+ finalMessageRef: " (see PERMISSIONS)",
14663
+ section: `PERMISSIONS:
14664
+ When you call \`required-permissions\` (see workflow step 6 for when), use SCOPE ID format (not human-readable names). Examples:
14665
+ - \`@wix/data\` read \u2192 "SCOPE.DC-DATA.READ", write \u2192 "SCOPE.DC-DATA.WRITE"
14666
+ - Embedded scripts \u2192 "SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS"
14667
+
14668
+ CRITICAL: Only include permissions you have explicitly seen in the Wix SDK documentation (via MCP or loaded skills) \u2014 NEVER guess or infer a scope ID. If you cannot point to where you saw it, do NOT include it. When in doubt, skip the call entirely. A fabricated scope ID will show an error to the user and confuse them; a missing permission is just a warning the user can fix.
14669
+
14670
+ The \`required-permissions\` tool records and surfaces permissions to the user automatically \u2014 NEVER mention permissions/scopes (IDs or names) in your output, or tell the user to grant them.`
14671
+ };
14672
+ var FULL_PERMISSIONS = {
14673
+ toolRule: "",
14674
+ step: "",
14675
+ reportDocsStep: 6,
14676
+ finalMessageRef: "",
14677
+ section: "Every Wix API permission scope is already granted on this site. Never declare, request or mention permission scopes. Still set collection permissions and use `auth.elevate()` where the code needs them."
14678
+ };
14679
+ var buildCoreRules = (validation, permissions) => `CORE PRINCIPLES:
14657
14680
  - Do NOT invent or assume new types, modules, functions, props, events, or imports.
14658
14681
  - Do NOT leave mocks, placeholders, debug logging, or TODOs in code the user did not ask for. When the user explicitly asks for logs, debug output, or mock/sample data, add them as requested.
14659
14682
  - ALWAYS implement complete, production-ready functionality.
@@ -14668,11 +14691,10 @@ TOOL USAGE:
14668
14691
  ${validation.toolRule}
14669
14692
  - \`uuid\` to generate UUIDs (supports count param for multiple). Do NOT use bash.
14670
14693
  - \`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.
14671
- - \`required-permissions\` \u2014 declare the Wix app permissions the generated code needs (when/whether to call: workflow step 6 + PERMISSIONS).
14672
- ${(0, shared_rules_1.buildFileOperationsRules)("fixing type errors")}
14694
+ ${permissions.toolRule}${(0, shared_rules_1.buildFileOperationsRules)("fixing type errors")}
14673
14695
  - API discovery (shapes, method signatures, types) \u2014 in this order: (1) loaded skills + KNOWN WIX APIS, if they already cover the API; (2) wix-mcp, yourself: \`SearchWixSDKDocumentation\` to find the method, then \`ReadFullDocsMethodSchema\` for its exact exported name, options object, response fields, enum values and scope IDs \u2014 the schema is the source of truth; an article or its examples are not. Model the call on the SDK view, not REST, and use the direct form inside the extension: \`import { <namespace> } from "@wix/<pkg>"; await <namespace>.<method>(<options>)\` \u2014 never \`createClient\`. Note any setup the docs require from the user (an app to install, a dashboard setting to enable) for the final message. For WDS components/props, use the \`wix-design-system\` skill; (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.
14674
14696
  - NEVER write a Wix SDK method, field, or enum value you haven't seen in a skill or a method schema.
14675
- - \`report-wix-feedback\` \u2014 report problems with the Wix docs (dev.wix.com, via wix-mcp) or the wix-mcp tools to Wix (when: workflow step 7). NOT for skill references or your own code.
14697
+ - \`report-wix-feedback\` \u2014 report problems with the Wix docs (dev.wix.com, via wix-mcp) or the wix-mcp tools to Wix (when: workflow step ${permissions.reportDocsStep}). NOT for skill references or your own code.
14676
14698
  - NEVER run preview, dev, release, or promote commands.
14677
14699
  - The ONE exception to YOUR BOUNDARIES' ban on uploading files: when the \`wix-app\` skill tells you to run its \`upload-media.cjs\` script, run it. It puts the user's images into the site's Media Manager and prints the \`{ uri, url }\` an \`Image\` default needs, which makes it part of writing code. Run no other script that changes the site \u2014 publishing, releasing, deleting, and every other product/platform action stay off-limits.
14678
14700
 
@@ -14686,10 +14708,9 @@ IMPLEMENTATION WORKFLOW:
14686
14708
  3. **Build**: Write files incrementally \u2014 group by logical section, NOT all at once. For complex tasks (300+ total lines across files), split into multiple \`batch-write\` calls. NEVER hold back writing until all code is planned \u2014 write each logical piece as soon as it is ready. Build all extensions before registering.
14687
14709
  4. **Register**: Register all extensions in \`src/extensions.ts\`.
14688
14710
  ${validation.step}
14689
- 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.
14690
- 7. **Report docs problems**: Skip this step if you already called \`report-wix-feedback\` this run. Otherwise look back at the run: if ANY of these happened, call it ONCE covering all of them: (a) you inspected \`node_modules\` to find a Wix SDK signature, shape, or type because the docs didn't give you one that compiles; (b) the validator fixed a Wix SDK call you wrote from a dev.wix.com doc \u2014 read its summary; (c) a dev.wix.com example, article, or schema contradicted the installed SDK types; (d) a search's top results were off-target, or a wix-mcp tool failed. For each: the dev.wix.com URL or search term, what it showed, and what actually worked. A gap in a skill reference is not a wix-mcp problem \u2014 don't report it here.
14691
- 8. **Final message**: Your last message is returned to the user as the codegen output \u2014 keep it short and plain (a sentence or two on what the app now does). Do NOT mention permissions/scopes here (see PERMISSIONS) and follow OUTPUT MESSAGE below.
14692
- 9. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
14711
+ ${permissions.step}${permissions.reportDocsStep}. **Report docs problems**: Skip this step if you already called \`report-wix-feedback\` this run. Otherwise look back at the run: if ANY of these happened, call it ONCE covering all of them: (a) you inspected \`node_modules\` to find a Wix SDK signature, shape, or type because the docs didn't give you one that compiles; (b) the validator fixed a Wix SDK call you wrote from a dev.wix.com doc \u2014 read its summary; (c) a dev.wix.com example, article, or schema contradicted the installed SDK types; (d) a search's top results were off-target, or a wix-mcp tool failed. For each: the dev.wix.com URL or search term, what it showed, and what actually worked. A gap in a skill reference is not a wix-mcp problem \u2014 don't report it here.
14712
+ ${permissions.reportDocsStep + 1}. **Final message**: Your last message is returned to the user as the codegen output \u2014 keep it short and plain (a sentence or two on what the app now does). Do NOT mention permissions/scopes here${permissions.finalMessageRef} and follow OUTPUT MESSAGE below.
14713
+ ${permissions.reportDocsStep + 2}. **Stop**: STOP immediately. Do NOT refactor, clean up, or verify.
14693
14714
 
14694
14715
  FILE CREATION:
14695
14716
  - NEVER rewrite the same file twice. Once written, move on. Exception: see PORTING ATTACHED CODE.
@@ -14710,23 +14731,17 @@ GENERATED FILES:
14710
14731
  TYPESCRIPT:
14711
14732
  - The project enables \`verbatimModuleSyntax\`. Type-only imports MUST use \`import type\`.
14712
14733
 
14713
- PERMISSIONS:
14714
- When you call \`required-permissions\` (see workflow step 6 for when), use SCOPE ID format (not human-readable names). Examples:
14715
- - \`@wix/data\` read \u2192 "SCOPE.DC-DATA.READ", write \u2192 "SCOPE.DC-DATA.WRITE"
14716
- - Embedded scripts \u2192 "SCOPE.DC-APPS.MANAGE-EMBEDDED-SCRIPTS"
14717
-
14718
- CRITICAL: Only include permissions you have explicitly seen in the Wix SDK documentation (via MCP or loaded skills) \u2014 NEVER guess or infer a scope ID. If you cannot point to where you saw it, do NOT include it. When in doubt, skip the call entirely. A fabricated scope ID will show an error to the user and confuse them; a missing permission is just a warning the user can fix.
14719
-
14720
- The \`required-permissions\` tool records and surfaces permissions to the user automatically \u2014 NEVER mention permissions/scopes (IDs or names) in your output, or tell the user to grant them.`;
14734
+ ${permissions.section}`;
14721
14735
  function isValidatorSubagentSkipped() {
14722
14736
  return (0, model_knobs_1.readEnumEnv)("CODEGEN_RULES_NO_VALIDATOR", ["0", "1"]) !== "0";
14723
14737
  }
14724
- function buildCodegenRules(environmentIdentity) {
14738
+ function buildCodegenRules(environmentIdentity, isRequiredPermissionsStepOn) {
14725
14739
  const validation = isValidatorSubagentSkipped() ? DIRECT_VALIDATION : DELEGATED_VALIDATION;
14740
+ const permissions = isRequiredPermissionsStepOn ? DECLARED_PERMISSIONS : FULL_PERMISSIONS;
14726
14741
  return [
14727
14742
  (0, shared_rules_1.buildEnvironmentRules)(environmentIdentity),
14728
14743
  shared_rules_1.BOUNDARY_RULES,
14729
- buildCoreRules(validation),
14744
+ buildCoreRules(validation, permissions),
14730
14745
  `${shared_rules_1.OUTPUT_MESSAGE_RULES}
14731
14746
  ${shared_rules_1.OUTCOME_MESSAGE_RULES}`
14732
14747
  ].join("\n\n");
@@ -14950,6 +14965,7 @@ var require_environments = __commonJS({
14950
14965
  "dist/environments/index.js"(exports2) {
14951
14966
  "use strict";
14952
14967
  Object.defineProperty(exports2, "__esModule", { value: true });
14968
+ exports2.isRequiredPermissionsStepOn = isRequiredPermissionsStepOn;
14953
14969
  exports2.getValidatedCodegenEnvironment = getValidatedCodegenEnvironment;
14954
14970
  exports2.getModuleSpecifierPrefix = getModuleSpecifierPrefix;
14955
14971
  exports2.getCodegenEnvironmentConfig = getCodegenEnvironmentConfig;
@@ -14962,16 +14978,20 @@ var require_environments = __commonJS({
14962
14978
  var git_conflicts_rules_1 = require_git_conflicts_rules();
14963
14979
  var install_manifest_1 = require_install_manifest();
14964
14980
  var telemetry_tools_1 = require_telemetry_tools();
14981
+ var model_knobs_1 = require_model_knobs();
14965
14982
  var job_decision_manager_1 = require_job_decision_manager();
14966
14983
  var logger_12 = require_logger();
14967
14984
  var SHARED_GIT_CONFLICTS_RULE = {
14968
14985
  filename: "git-conflicts-instructions.md",
14969
14986
  content: git_conflicts_rules_1.GIT_CONFLICTS_RULES
14970
14987
  };
14988
+ function isRequiredPermissionsStepOn(env) {
14989
+ return (0, model_knobs_1.readEnumEnv)("CODEGEN_REQUIRED_PERMISSIONS", ["1"]) === "1" || env.requiredPermissions !== false;
14990
+ }
14971
14991
  var withSharedRules = (env) => {
14972
14992
  const sharedCodegenRule = {
14973
14993
  filename: install_manifest_1.SHARED_CODEGEN_RULE_FILENAME,
14974
- content: (0, codegen_rules_1.buildCodegenRules)(env.environmentIdentity)
14994
+ content: (0, codegen_rules_1.buildCodegenRules)(env.environmentIdentity, isRequiredPermissionsStepOn(env))
14975
14995
  };
14976
14996
  const sharedAskRule = {
14977
14997
  filename: "ask-instructions.md",
@@ -15688,6 +15708,13 @@ var require_config = __commonJS({
15688
15708
  doom_loop: "allow",
15689
15709
  external_directory: READABLE_EXTERNAL_DIRS
15690
15710
  };
15711
+ var CODEGEN_PERMISSIONS_WITHOUT_REQUIRED_PERMISSIONS = {
15712
+ ...CODEGEN_PERMISSIONS,
15713
+ [
15714
+ "required-permissions"
15715
+ /* OpenCodeTool.RequiredPermissions */
15716
+ ]: "deny"
15717
+ };
15691
15718
  var GIT_CONFLICTS_PERMISSIONS = {
15692
15719
  ...CODEGEN_PERMISSIONS,
15693
15720
  [
@@ -15814,7 +15841,7 @@ var require_config = __commonJS({
15814
15841
  withAgents: true
15815
15842
  });
15816
15843
  default:
15817
- return buildConfig(projectId, paths(env.codegenRules), CODEGEN_PERMISSIONS, {
15844
+ return buildConfig(projectId, paths(env.codegenRules), (0, environments_12.isRequiredPermissionsStepOn)(env) ? CODEGEN_PERMISSIONS : CODEGEN_PERMISSIONS_WITHOUT_REQUIRED_PERMISSIONS, {
15818
15845
  isCodeWritingFlow: true,
15819
15846
  withAgents: true
15820
15847
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/ditto-codegen-public",
3
- "version": "1.0.507",
3
+ "version": "1.0.508",
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": "614f75ed056063e03a3de948850c0c2f0036507720563ace81e083bc"
32
+ "falconPackageHash": "3269b77fd09c5f5b225c740bf3fcf6668ad10d240b6b7ba42fc45b0e"
33
33
  }