@wix/ditto-codegen-public 1.0.275 → 1.0.277
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/out.js +2651 -15
- package/package.json +2 -2
- package/dist/opencode-tools/wds-lookup.ts +0 -134
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.277",
|
|
4
4
|
"description": "AI-powered Wix CLI app generator - standalone executable",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "node build.mjs",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"@wix/ditto-codegen": "1.0.0",
|
|
28
28
|
"esbuild": "^0.27.2"
|
|
29
29
|
},
|
|
30
|
-
"falconPackageHash": "
|
|
30
|
+
"falconPackageHash": "f0059fd4e9e9e0c38f0aed2736cc7fece45c525cd38c430c579da505"
|
|
31
31
|
}
|
|
@@ -1,134 +0,0 @@
|
|
|
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
|
-
});
|