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 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 ["dekit.yaml", "dekit.yml", "design.yaml", "design.yml"]) {
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 in current directory. Use -c to specify a config file.\n"
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 port = parseInt(
106
- commandArgs.find((_, i, a) => a[i - 1] === "-p") ?? "3000",
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, designPort, noOpen });
114
+ await startServers({ config, port, noOpen });
115
115
  break;
116
116
  }
117
117
  case "screenshot": {