@wix/ditto-codegen-public 1.0.273 → 1.0.275

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 (84) hide show
  1. package/dist/opencode-tools/batch-read.ts +28 -0
  2. package/dist/opencode-tools/batch-write.ts +38 -0
  3. package/dist/opencode-tools/uuid.ts +19 -0
  4. package/dist/opencode-tools/validate.ts +51 -0
  5. package/dist/opencode-tools/wds-lookup.ts +134 -0
  6. package/dist/out.js +392 -102
  7. package/package.json +2 -2
  8. package/dist/examples-apps/ai-chatbot/.nvmrc +0 -1
  9. package/dist/examples-apps/ai-chatbot/README.md +0 -21
  10. package/dist/examples-apps/ai-chatbot/package-lock.json +0 -7266
  11. package/dist/examples-apps/ai-chatbot/package.json +0 -35
  12. package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/ProductChat.module.css +0 -3
  13. package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/ProductChat.tsx +0 -108
  14. package/dist/examples-apps/ai-chatbot/src/dashboard/pages/product/page.tsx +0 -100
  15. package/dist/examples-apps/ai-chatbot/src/dashboard/withProviders.tsx +0 -15
  16. package/dist/examples-apps/ai-chatbot/src/env.d.ts +0 -4
  17. package/dist/examples-apps/ai-chatbot/src/types.ts +0 -4
  18. package/dist/examples-apps/ai-chatbot/tsconfig.json +0 -8
  19. package/dist/examples-apps/ai-chatbot/wix.config.json +0 -5
  20. package/dist/examples-apps/contact-created-logger/package-lock.json +0 -15102
  21. package/dist/examples-apps/contact-created-logger/package.json +0 -37
  22. package/dist/examples-apps/contact-created-logger/src/backend/events/contact-created-logger/event.ts +0 -56
  23. package/dist/examples-apps/contact-created-logger/tsconfig.json +0 -5
  24. package/dist/examples-apps/contact-created-logger/wix.config.json +0 -4
  25. package/dist/examples-apps/coupon-popup/README.md +0 -13
  26. package/dist/examples-apps/coupon-popup/package.json +0 -43
  27. package/dist/examples-apps/coupon-popup/src/extensions.ts +0 -12
  28. package/dist/examples-apps/coupon-popup/src/index.ts +0 -2
  29. package/dist/examples-apps/coupon-popup/src/site/embedded-scripts/cart-coupon-popup/embedded.html +0 -562
  30. package/dist/examples-apps/coupon-popup/src/site/embedded-scripts/cart-coupon-popup/extensions.ts +0 -8
  31. package/dist/examples-apps/coupon-popup/tsconfig.json +0 -10
  32. package/dist/examples-apps/coupon-popup/wix.config.json +0 -4
  33. package/dist/examples-apps/custom-element/countdown-widget/components/ColorPickerField.tsx +0 -27
  34. package/dist/examples-apps/custom-element/countdown-widget/components/FontPickerField.tsx +0 -34
  35. package/dist/examples-apps/custom-element/countdown-widget/components/Separator.tsx +0 -10
  36. package/dist/examples-apps/custom-element/countdown-widget/components/TimeBlock.tsx +0 -23
  37. package/dist/examples-apps/custom-element/countdown-widget/extensions.ts +0 -18
  38. package/dist/examples-apps/custom-element/countdown-widget/panel.tsx +0 -146
  39. package/dist/examples-apps/custom-element/countdown-widget/styles.ts +0 -73
  40. package/dist/examples-apps/custom-element/countdown-widget/utils.ts +0 -46
  41. package/dist/examples-apps/custom-element/countdown-widget/widget.tsx +0 -97
  42. package/dist/examples-apps/product-created-logger/package-lock.json +0 -15102
  43. package/dist/examples-apps/product-created-logger/package.json +0 -37
  44. package/dist/examples-apps/product-created-logger/src/backend/events/product-created-logger/event.ts +0 -66
  45. package/dist/examples-apps/product-created-logger/tsconfig.json +0 -5
  46. package/dist/examples-apps/product-created-logger/wix.config.json +0 -4
  47. package/dist/examples-apps/react-builder/component.tsx +0 -123
  48. package/dist/examples-apps/react-builder/components/Badge.tsx +0 -14
  49. package/dist/examples-apps/react-builder/components/Button.tsx +0 -31
  50. package/dist/examples-apps/react-builder/components/Counter.tsx +0 -14
  51. package/dist/examples-apps/react-builder/components/FeaturedImage.tsx +0 -31
  52. package/dist/examples-apps/react-builder/components/SocialLinks.tsx +0 -61
  53. package/dist/examples-apps/react-builder/components/Subtitle.tsx +0 -11
  54. package/dist/examples-apps/react-builder/components/Tags.tsx +0 -25
  55. package/dist/examples-apps/react-builder/components/Title.tsx +0 -11
  56. package/dist/examples-apps/react-builder/components/index.ts +0 -8
  57. package/dist/examples-apps/react-builder/manifest.json +0 -345
  58. package/dist/examples-apps/react-builder/style.css +0 -197
  59. package/dist/examples-apps/react-builder/types.ts +0 -70
  60. package/dist/examples-apps/spis-examples/.nvmrc +0 -1
  61. package/dist/examples-apps/spis-examples/README.md +0 -21
  62. package/dist/examples-apps/spis-examples/package-lock.json +0 -6903
  63. package/dist/examples-apps/spis-examples/package.json +0 -32
  64. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-additional-fees/additional-fees/plugin.ts +0 -66
  65. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-discount-triggers/discount-triggers/plugin.ts +0 -42
  66. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-gift-cards/gift-cards/plugin.ts +0 -38
  67. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-shipping-rates/shipping-rates/plugin.ts +0 -34
  68. package/dist/examples-apps/spis-examples/src/backend/service-plugins/ecom-validations/validations/plugin.ts +0 -24
  69. package/dist/examples-apps/spis-examples/src/env.d.ts +0 -4
  70. package/dist/examples-apps/spis-examples/tsconfig.json +0 -8
  71. package/dist/examples-apps/spis-examples/wix.config.json +0 -5
  72. package/dist/examples-apps/survey-manager/README.md +0 -21
  73. package/dist/examples-apps/survey-manager/package-lock.json +0 -14252
  74. package/dist/examples-apps/survey-manager/package.json +0 -36
  75. package/dist/examples-apps/survey-manager/src/dashboard/pages/apis.ts +0 -116
  76. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/PageLoader.tsx +0 -23
  77. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/QuestionModal.tsx +0 -84
  78. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/QuestionsTable.tsx +0 -139
  79. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/SurveyPageLayout.tsx +0 -99
  80. package/dist/examples-apps/survey-manager/src/dashboard/pages/components/SurveyStats.tsx +0 -50
  81. package/dist/examples-apps/survey-manager/src/dashboard/pages/page.tsx +0 -171
  82. package/dist/examples-apps/survey-manager/src/dashboard/pages/types.ts +0 -28
  83. package/dist/examples-apps/survey-manager/tsconfig.json +0 -8
  84. package/dist/examples-apps/survey-manager/wix.config.json +0 -4
@@ -0,0 +1,28 @@
1
+ import { tool } from "@opencode-ai/plugin";
2
+ import { readFile } from "fs/promises";
3
+ import { join, isAbsolute } from "path";
4
+
5
+ export default tool({
6
+ description:
7
+ "Read multiple files at once and return their contents. " +
8
+ "Use this instead of calling read multiple times sequentially.",
9
+ args: {
10
+ paths: tool.schema
11
+ .array(tool.schema.string())
12
+ .describe("Array of file paths (relative to project root) to read"),
13
+ },
14
+ async execute(args, context) {
15
+ const results: string[] = [];
16
+ for (const filePath of args.paths) {
17
+ const fullPath = isAbsolute(filePath) ? filePath : join(context.directory, filePath);
18
+ try {
19
+ const content = await readFile(fullPath, "utf-8");
20
+ results.push(`--- ${filePath} ---\n${content}`);
21
+ } catch (e) {
22
+ const msg = e instanceof Error ? e.message : String(e);
23
+ results.push(`--- ${filePath} ---\nERROR: ${msg}`);
24
+ }
25
+ }
26
+ return results.join("\n\n");
27
+ },
28
+ });
@@ -0,0 +1,38 @@
1
+ import { tool } from "@opencode-ai/plugin";
2
+ import { writeFile, mkdir } from "fs/promises";
3
+ import { join, dirname, isAbsolute } from "path";
4
+
5
+ export default tool({
6
+ description:
7
+ "Write multiple files at once. Creates directories as needed. " +
8
+ "Use this instead of calling write/edit multiple times for new files.",
9
+ args: {
10
+ files: tool.schema
11
+ .array(
12
+ tool.schema.object({
13
+ path: tool.schema
14
+ .string()
15
+ .describe("File path relative to project root"),
16
+ content: tool.schema.string().describe("Full file content"),
17
+ }),
18
+ )
19
+ .describe("Array of { path, content } objects to write"),
20
+ },
21
+ async execute(args, context) {
22
+ const results: string[] = [];
23
+ for (const f of args.files) {
24
+ const fullPath = isAbsolute(f.path)
25
+ ? f.path
26
+ : join(context.directory, f.path);
27
+ try {
28
+ await mkdir(dirname(fullPath), { recursive: true });
29
+ await writeFile(fullPath, f.content, "utf-8");
30
+ results.push(`OK: ${f.path}`);
31
+ } catch (e) {
32
+ const msg = e instanceof Error ? e.message : String(e);
33
+ results.push(`FAILED: ${f.path} - ${msg}`);
34
+ }
35
+ }
36
+ return results.join("\n");
37
+ },
38
+ });
@@ -0,0 +1,19 @@
1
+ import { tool } from "@opencode-ai/plugin";
2
+ import { randomUUID } from "crypto";
3
+
4
+ export default tool({
5
+ description:
6
+ "Generate one or more UUID v4s. Use this instead of bash commands. " +
7
+ "Set count to generate multiple UUIDs in a single call.",
8
+ args: {
9
+ count: tool.schema
10
+ .number()
11
+ .min(1)
12
+ .max(10)
13
+ .default(1)
14
+ .describe("Number of UUIDs to generate."),
15
+ },
16
+ async execute(args) {
17
+ return Array.from({ length: args.count }, () => randomUUID()).join("\n");
18
+ },
19
+ });
@@ -0,0 +1,51 @@
1
+ import { tool } from "@opencode-ai/plugin";
2
+
3
+ export default tool({
4
+ description:
5
+ "Run full project validation: install deps (if needed), TypeScript check, and build. " +
6
+ "Use this instead of running npm install, tsc, and wix build separately.",
7
+ args: {
8
+ installDeps: tool.schema
9
+ .boolean()
10
+ .optional()
11
+ .describe(
12
+ "Run npm install first (default: false, set true if you added new deps)",
13
+ ),
14
+ },
15
+ async execute(args, context) {
16
+ const steps: string[] = [];
17
+ const cwd = context.directory;
18
+
19
+ if (args.installDeps) {
20
+ const install = await Bun.$`npm install`.cwd(cwd).nothrow().quiet();
21
+ if (install.exitCode !== 0) {
22
+ return `FAILED at npm install (exit ${install.exitCode}):\n${install.stderr.toString()}`;
23
+ }
24
+ steps.push("npm install: OK");
25
+ }
26
+
27
+ const tsc = await Bun.$`npx tsc --noEmit`.cwd(cwd).nothrow().quiet();
28
+ if (tsc.exitCode !== 0) {
29
+ return [
30
+ ...steps,
31
+ `FAILED at tsc --noEmit (exit ${tsc.exitCode}):`,
32
+ tsc.stdout.toString(),
33
+ tsc.stderr.toString(),
34
+ ].join("\n");
35
+ }
36
+ steps.push("tsc --noEmit: OK");
37
+
38
+ const build = await Bun.$`npx wix build`.cwd(cwd).nothrow().quiet();
39
+ if (build.exitCode !== 0) {
40
+ return [
41
+ ...steps,
42
+ `FAILED at wix build (exit ${build.exitCode}):`,
43
+ build.stdout.toString(),
44
+ build.stderr.toString(),
45
+ ].join("\n");
46
+ }
47
+ steps.push("wix build: OK");
48
+
49
+ return steps.join("\n");
50
+ },
51
+ });
@@ -0,0 +1,134 @@
1
+ import { tool } from "@opencode-ai/plugin";
2
+ import { readFile, readdir } from "fs/promises";
3
+ import { join } from "path";
4
+ const MAX_EXAMPLE_LINES = 80;
5
+
6
+ const stripBlankLines = (s: string): string =>
7
+ s.split("\n").filter((l) => l.trim().length > 0).join("\n");
8
+
9
+ function parseComponentNames(files: string[]): string[] {
10
+ const names = new Set<string>();
11
+ for (const f of files) {
12
+ const m = f.match(/^(.+?)(Props|Examples)\.md$/);
13
+ if (m) names.add(m[1]);
14
+ }
15
+ return [...names].sort();
16
+ }
17
+
18
+ function trimExamples(raw: string): string {
19
+ const lines = raw.split("\n");
20
+ const headers: number[] = [];
21
+ lines.forEach((l, i) => {
22
+ if (l.startsWith("### ")) headers.push(i);
23
+ });
24
+ const end =
25
+ headers.length > 2
26
+ ? headers[2]
27
+ : Math.min(lines.length, MAX_EXAMPLE_LINES);
28
+ return lines.slice(0, end).join("\n");
29
+ }
30
+
31
+ export default tool({
32
+ description:
33
+ "Look up Wix Design System (WDS) component props, examples, and icons. " +
34
+ "Use this INSTEAD of the wds-docs skill. " +
35
+ "Pass component names to get their props (lightweight). " +
36
+ "Pass example names ONLY for complex components where you need usage patterns. " +
37
+ "Set listAll/listIcons to discover available components/icons. " +
38
+ "Combine all in one call. NEVER look up the same component twice.",
39
+ args: {
40
+ listAll: tool.schema
41
+ .boolean()
42
+ .optional()
43
+ .describe("List all available WDS component names."),
44
+ components: tool.schema
45
+ .array(tool.schema.string())
46
+ .optional()
47
+ .describe(
48
+ "Component names to get PROPS for, e.g. ['Table', 'Input'].",
49
+ ),
50
+ examples: tool.schema
51
+ .array(tool.schema.string())
52
+ .optional()
53
+ .describe(
54
+ "Component names to get EXAMPLES for. Only use for complex/unfamiliar components.",
55
+ ),
56
+ listIcons: tool.schema
57
+ .boolean()
58
+ .optional()
59
+ .describe("List all available WDS icon names."),
60
+ },
61
+ async execute(args, context) {
62
+ const docsPath = join(
63
+ context.directory,
64
+ "node_modules",
65
+ "@wix",
66
+ "design-system",
67
+ "dist",
68
+ "docs",
69
+ );
70
+ const compsDir = join(docsPath, "components");
71
+ const sections: string[] = [];
72
+
73
+ if (args.listAll) {
74
+ try {
75
+ const files = await readdir(compsDir);
76
+ const names = parseComponentNames(files);
77
+ sections.push(
78
+ `## Available WDS Components (${names.length})\n${names.join(", ")}`,
79
+ );
80
+ } catch (e) {
81
+ const msg = e instanceof Error ? e.message : String(e);
82
+ sections.push(`ERROR listing components: ${msg}`);
83
+ }
84
+ }
85
+
86
+ if (args.components?.length) {
87
+ for (const comp of args.components) {
88
+ try {
89
+ const raw = await readFile(
90
+ join(compsDir, `${comp}Props.md`),
91
+ "utf-8",
92
+ );
93
+ sections.push(`## ${comp} Props\n${raw}`);
94
+ } catch {
95
+ sections.push(`## ${comp} Props\nNot found: ${comp}Props.md`);
96
+ }
97
+ }
98
+ }
99
+
100
+ if (args.examples?.length) {
101
+ for (const comp of args.examples) {
102
+ try {
103
+ const raw = await readFile(
104
+ join(compsDir, `${comp}Examples.md`),
105
+ "utf-8",
106
+ );
107
+ sections.push(`## ${comp} Examples\n${trimExamples(raw)}`);
108
+ } catch {
109
+ sections.push(`## ${comp} Examples\nNot found: ${comp}Examples.md`);
110
+ }
111
+ }
112
+ }
113
+
114
+ if (args.listIcons) {
115
+ try {
116
+ const iconsMd = await readFile(join(docsPath, "icons.md"), "utf-8");
117
+ sections.push(iconsMd);
118
+ } catch (e) {
119
+ const msg = e instanceof Error ? e.message : String(e);
120
+ sections.push(`ERROR reading icons.md: ${msg}`);
121
+ }
122
+ }
123
+
124
+ if (!sections.length) {
125
+ return "No query provided. Pass listAll, components, examples, or listIcons.";
126
+ }
127
+
128
+ return stripBlankLines(
129
+ "IMPORTS: Components from '@wix/design-system', icons from '@wix/wix-ui-icons-common'.\n" +
130
+ "CSS: import '@wix/design-system/styles.global.css';\n\n" +
131
+ sections.join("\n\n"),
132
+ );
133
+ },
134
+ });