dekit-cli 0.2.3 → 0.4.0
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/README.md +16 -0
- package/bin/dekit.ts +12 -12
- package/dist/editor/assets/{index-yt1AtkL3.js → index-D16Bm-Rw.js} +13 -13
- package/dist/editor/assets/{index-Bx5YsS46.css → index-HLKs1tz-.css} +1 -1
- package/dist/editor/index.html +2 -2
- package/editor/src/App.tsx +33 -7
- package/editor/src/styles/editor.css +4 -2
- package/editor/vite.config.ts +6 -0
- package/package.json +3 -2
- package/src/cli/add.test.ts +14 -12
- package/src/cli/init.test.ts +15 -17
- package/src/cli/init.ts +7 -5
- package/src/cli/ls.test.ts +1 -1
- package/src/cli/resolve.test.ts +3 -3
- package/src/cli/screenshot.test.ts +4 -4
- package/src/design-server.ts +5 -4
- package/src/injected/inspector.ts +37 -3
- package/src/parser.test.ts +8 -8
- package/src/server.ts +32 -6
- package/src/types.ts +1 -1
- package/src/vite-plugin-dekit.test.ts +21 -14
- package/src/vite-plugin-dekit.ts +1 -0
package/README.md
CHANGED
|
@@ -54,6 +54,22 @@ When the agent starts the preview server, open the browser to review. Right-clic
|
|
|
54
54
|
> The hero section $${home@.hero} needs more padding, and make the CTA button blue
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
+
**Initialize in an existing project:**
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
> Initialize a dekit design project in the design/ directory using the dashboard template
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
The agent creates a `design/` subdirectory with all the scaffolding, without touching your existing code.
|
|
64
|
+
|
|
65
|
+
**Build reusable components:**
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
> Create a ui-card component with an image slot and body slot, then build a showcase page that uses it
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The agent creates Web Components with `<template>` + scoped CSS, registers them in `dekit.yaml`, and uses them in pages like `<ui-card>`.
|
|
72
|
+
|
|
57
73
|
**Add a page to an existing design:**
|
|
58
74
|
|
|
59
75
|
```
|
package/bin/dekit.ts
CHANGED
|
@@ -11,13 +11,14 @@ Commands:
|
|
|
11
11
|
init [path] Initialize a new design project
|
|
12
12
|
add <type> <name> Add a page or component
|
|
13
13
|
ls List pages and components
|
|
14
|
-
serve Start the preview server (default)
|
|
14
|
+
serve Start the preview server (default, port 7980)
|
|
15
15
|
screenshot <ref> Take a screenshot of a page or element
|
|
16
16
|
resolve <ref> Resolve a ref to file path and line range
|
|
17
17
|
usage Print the agent usage guide
|
|
18
18
|
|
|
19
19
|
Options:
|
|
20
20
|
-c, --config Path to dekit.yaml
|
|
21
|
+
-p, --port Editor server port (default: 7980)
|
|
21
22
|
-h, --help Show this help message
|
|
22
23
|
|
|
23
24
|
Run 'dekit <command> --help' for command-specific help.
|
|
@@ -25,7 +26,12 @@ Run 'dekit <command> --help' for command-specific help.
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
function findDefaultConfig(): string | undefined {
|
|
28
|
-
for (const name of [
|
|
29
|
+
for (const name of [
|
|
30
|
+
".dekit/dekit.yaml",
|
|
31
|
+
".dekit/dekit.yml",
|
|
32
|
+
"dekit.yaml",
|
|
33
|
+
"dekit.yml",
|
|
34
|
+
]) {
|
|
29
35
|
const p = resolve(name);
|
|
30
36
|
if (existsSync(p)) return p;
|
|
31
37
|
}
|
|
@@ -56,7 +62,7 @@ async function loadConfig(configArg?: string) {
|
|
|
56
62
|
const configPath = configArg ? resolve(configArg) : findDefaultConfig();
|
|
57
63
|
if (!configPath) {
|
|
58
64
|
console.error(
|
|
59
|
-
"Error: no dekit.yaml found
|
|
65
|
+
"Error: no .dekit/dekit.yaml found. Run 'dekit init' or use -c to specify a config file.\n"
|
|
60
66
|
);
|
|
61
67
|
process.exit(1);
|
|
62
68
|
}
|
|
@@ -102,16 +108,10 @@ async function main() {
|
|
|
102
108
|
}
|
|
103
109
|
case "serve": {
|
|
104
110
|
const config = await loadConfig(configArg);
|
|
105
|
-
const
|
|
106
|
-
|
|
107
|
-
10
|
|
108
|
-
);
|
|
109
|
-
const designPort = parseInt(
|
|
110
|
-
commandArgs.find((_, i, a) => a[i - 1] === "--design-port") ?? "3001",
|
|
111
|
-
10
|
|
112
|
-
);
|
|
111
|
+
const portArg = commandArgs.find((_, i, a) => a[i - 1] === "-p");
|
|
112
|
+
const port = portArg ? parseInt(portArg, 10) : undefined;
|
|
113
113
|
const noOpen = commandArgs.includes("--no-open");
|
|
114
|
-
await startServers({ config, port,
|
|
114
|
+
await startServers({ config, port, noOpen });
|
|
115
115
|
break;
|
|
116
116
|
}
|
|
117
117
|
case "screenshot": {
|