create-zenbu-app 0.0.13 → 0.0.14

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/index.mjs CHANGED
@@ -409,8 +409,6 @@ async function main() {
409
409
  if (!fs.existsSync(templateDir)) bail(`No template found for configuration "${slug}".`);
410
410
  const pm = detectPackageManager();
411
411
  p.log.step(`Scaffolding Zenbu ${pluginMode ? "plugin" : "app"} in "${displayName}" (template: ${slug})`);
412
- if (pm.fallback) p.log.info(`couldn't detect invoking package manager; defaulting to ${pm.type}@${pm.version}.`);
413
- else p.log.info(`detected ${pm.type}@${pm.version} as the invoking package manager`);
414
412
  const ctx = pluginMode ? {
415
413
  projectName: displayName,
416
414
  className: toPascalCase(displayName),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-zenbu-app",
3
- "version": "0.0.13",
3
+ "version": "0.0.14",
4
4
  "description": "Scaffold a new Zenbu app",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -8,8 +8,7 @@
8
8
  "build:source": "zen build:source",
9
9
  "build:electron": "zen build:electron",
10
10
  "publish:source": "zen publish:source",
11
- "link": "zen link",
12
- "db:generate": "zen db generate"
11
+ "link": "zen link"
13
12
  },
14
13
  "dependencies": {
15
14
  "@zenbujs/core": "^0.0.15",
@@ -18,8 +17,7 @@
18
17
  "react": "^19.0.0",
19
18
  "react-dom": "^19.0.0",
20
19
  "tailwindcss": "^4.2.0",
21
- "vite": "^6.0.0",
22
- "zod": "^4.0.0"
20
+ "vite": "^6.0.0"
23
21
  },
24
22
  "devDependencies": {
25
23
  "@types/node": "^22.0.0",
@@ -1,10 +1,10 @@
1
- import { useDb, useDbClient, useRpc } from "@zenbujs/core/react"
1
+ import { useRpc } from "@zenbujs/core/react"
2
2
  import { useState } from "react"
3
3
 
4
4
  function Titlebar() {
5
5
  return (
6
6
  <div
7
- className="h-10 flex items-center justify-end px-3 pl-[72px] shrink-0"
7
+ className="h-10 shrink-0 border-b border-[#222]"
8
8
  // @ts-expect-error webkit property
9
9
  style={{ WebkitAppRegion: "drag" }}
10
10
  />
@@ -12,78 +12,42 @@ function Titlebar() {
12
12
  }
13
13
 
14
14
  function Home() {
15
- const db = useDb()
16
- const client = useDbClient()
17
15
  const rpc = useRpc()
18
16
  const [cwd, setCwd] = useState<string | null>(null)
19
-
20
- const issues = db.app.issues
17
+ const [copied, setCopied] = useState(false)
21
18
 
22
19
  return (
23
- <main className="flex-1 px-8 pb-8 font-sans text-[#e5e5e5]">
20
+ <main className="flex-1 px-8 pt-6 pb-8 font-sans text-[#e5e5e5]">
24
21
  <h1 className="text-2xl font-bold mb-2">Welcome to Zenbu</h1>
25
22
  <p className="text-[#888] mb-6">
26
23
  Edit <code>src/renderer/App.tsx</code> to get started.
27
24
  </p>
28
25
 
29
- <form
30
- className="flex flex-col gap-3 bg-[#18181b] rounded-xl p-4 max-w-md mb-6"
31
- onSubmit={(e) => {
32
- e.preventDefault()
33
- const form = e.currentTarget
34
- const title = (form.elements.namedItem("title") as HTMLInputElement).value
35
- if (!title.trim()) return
36
- client.update((db) => {
37
- db.app.issues.push({
38
- id: crypto.randomUUID(),
39
- title,
40
- createdAt: Date.now(),
41
- })
42
- })
43
- form.reset()
44
- }}
45
- >
46
- <input
47
- name="title"
48
- placeholder="New issue title"
49
- autoComplete="off"
50
- className="px-3 py-2 rounded bg-[#222] border border-[#333] outline-none focus:border-indigo-500"
51
- />
52
- <button
53
- type="submit"
54
- className="bg-indigo-600 hover:bg-indigo-700 transition text-white font-semibold px-4 py-2 rounded"
55
- >
56
- + add
57
- </button>
58
- </form>
59
-
60
- <div className="max-w-md mb-6">
61
- {issues.length === 0 ? (
62
- <div className="text-[#888] italic">No issues yet — try adding one.</div>
63
- ) : (
64
- issues.map((issue) => (
65
- <div
66
- key={issue.id}
67
- className="mb-2 p-3 rounded-lg bg-[#222] border border-[#2a2a2a] flex items-center justify-between"
68
- >
69
- <span>{issue.title}</span>
70
- <span className="text-xs text-[#666]">
71
- {new Date(issue.createdAt).toLocaleTimeString()}
72
- </span>
73
- </div>
74
- ))
75
- )}
76
- </div>
77
-
78
26
  <button
79
- className="bg-zinc-800 hover:bg-zinc-700 px-4 py-2 rounded text-sm"
80
- onClick={async () => setCwd(await rpc.repo.getCwd())}
27
+ className="bg-indigo-600 hover:bg-indigo-700 transition text-white font-semibold px-4 py-2 rounded text-sm"
28
+ onClick={async () => {
29
+ setCopied(false)
30
+ setCwd(await rpc.app.repo.getCwd())
31
+ }}
81
32
  >
82
- rpc main process cwd
33
+ Get main-process cwd
83
34
  </button>
35
+
84
36
  {cwd && (
85
- <div className="mt-2 p-2 rounded bg-[#232328] text-[#b0b0b0] w-fit text-xs">
86
- {cwd}
37
+ <div className="mt-3 flex items-center gap-2 max-w-md">
38
+ <code className="flex-1 p-2 rounded bg-[#232328] text-[#b0b0b0] text-xs truncate">
39
+ {cwd}
40
+ </code>
41
+ <button
42
+ className="bg-zinc-800 hover:bg-zinc-700 px-3 py-2 rounded text-xs"
43
+ onClick={async () => {
44
+ await navigator.clipboard.writeText(cwd)
45
+ setCopied(true)
46
+ setTimeout(() => setCopied(false), 1500)
47
+ }}
48
+ >
49
+ {copied ? "Copied!" : "Copy"}
50
+ </button>
87
51
  </div>
88
52
  )}
89
53
  </main>
@@ -5,9 +5,6 @@ import {
5
5
  } from "@zenbujs/core/config"
6
6
 
7
7
  export default defineConfig({
8
- // Where the kyju database lives (relative to this file).
9
- db: "./.zenbu/db",
10
-
11
8
  // Boot-window HTML. The single ui entrypoint for the whole app.
12
9
  uiEntrypoint: "./src/renderer",
13
10
 
@@ -17,7 +14,6 @@ export default defineConfig({
17
14
  definePlugin({
18
15
  name: "app",
19
16
  services: ["./src/main/services/*.ts"],
20
- schema: "./src/main/schema.ts",
21
17
  }),
22
18
  ],
23
19
 
@@ -8,16 +8,14 @@
8
8
  "build:source": "zen build:source",
9
9
  "build:electron": "zen build:electron",
10
10
  "publish:source": "zen publish:source",
11
- "link": "zen link",
12
- "db:generate": "zen db generate"
11
+ "link": "zen link"
13
12
  },
14
13
  "dependencies": {
15
14
  "@zenbujs/core": "^0.0.15",
16
15
  "@vitejs/plugin-react": "^5.0.0",
17
16
  "react": "^19.0.0",
18
17
  "react-dom": "^19.0.0",
19
- "vite": "^6.0.0",
20
- "zod": "^4.0.0"
18
+ "vite": "^6.0.0"
21
19
  },
22
20
  "devDependencies": {
23
21
  "@types/node": "^22.0.0",
@@ -1,4 +1,4 @@
1
- import { useDb, useDbClient, useRpc } from "@zenbujs/core/react"
1
+ import { useRpc } from "@zenbujs/core/react"
2
2
  import { useState } from "react"
3
3
 
4
4
  function Titlebar() {
@@ -12,12 +12,9 @@ function Titlebar() {
12
12
  }
13
13
 
14
14
  function Home() {
15
- const db = useDb()
16
- const client = useDbClient()
17
15
  const rpc = useRpc()
18
16
  const [cwd, setCwd] = useState<string | null>(null)
19
-
20
- const issues = db.app.issues
17
+ const [copied, setCopied] = useState(false)
21
18
 
22
19
  return (
23
20
  <main className="home">
@@ -26,49 +23,31 @@ function Home() {
26
23
  Edit <code>src/renderer/App.tsx</code> to get started.
27
24
  </p>
28
25
 
29
- <form
30
- className="add-form"
31
- onSubmit={(e) => {
32
- e.preventDefault()
33
- const form = e.currentTarget
34
- const title = (form.elements.namedItem("title") as HTMLInputElement).value
35
- if (!title.trim()) return
36
- client.update((db) => {
37
- db.app.issues.push({
38
- id: crypto.randomUUID(),
39
- title,
40
- createdAt: Date.now(),
41
- })
42
- })
43
- form.reset()
44
- }}
45
- >
46
- <input name="title" placeholder="New issue title" autoComplete="off" />
47
- <button type="submit">+ add</button>
48
- </form>
49
-
50
- <div className="issues">
51
- {issues.length === 0 ? (
52
- <div className="issues-empty">No issues yet — try adding one.</div>
53
- ) : (
54
- issues.map((issue) => (
55
- <div key={issue.id} className="issue">
56
- <span>{issue.title}</span>
57
- <span className="issue-time">
58
- {new Date(issue.createdAt).toLocaleTimeString()}
59
- </span>
60
- </div>
61
- ))
62
- )}
63
- </div>
64
-
65
26
  <button
66
- className="rpc-button"
67
- onClick={async () => setCwd(await rpc.repo.getCwd())}
27
+ className="primary-button"
28
+ onClick={async () => {
29
+ setCopied(false)
30
+ setCwd(await rpc.app.repo.getCwd())
31
+ }}
68
32
  >
69
- rpc main process cwd
33
+ Get main-process cwd
70
34
  </button>
71
- {cwd && <div className="rpc-result">{cwd}</div>}
35
+
36
+ {cwd && (
37
+ <div className="cwd-row">
38
+ <code className="cwd-value">{cwd}</code>
39
+ <button
40
+ className="copy-button"
41
+ onClick={async () => {
42
+ await navigator.clipboard.writeText(cwd)
43
+ setCopied(true)
44
+ setTimeout(() => setCopied(false), 1500)
45
+ }}
46
+ >
47
+ {copied ? "Copied!" : "Copy"}
48
+ </button>
49
+ </div>
50
+ )}
72
51
  </main>
73
52
  )
74
53
  }
@@ -23,16 +23,13 @@ body {
23
23
 
24
24
  .titlebar {
25
25
  height: 40px;
26
- display: flex;
27
- align-items: center;
28
- justify-content: flex-end;
29
- padding: 0 12px 0 72px;
30
26
  flex-shrink: 0;
27
+ border-bottom: 1px solid #222;
31
28
  }
32
29
 
33
30
  .home {
34
31
  flex: 1;
35
- padding: 0 32px 32px;
32
+ padding: 24px 32px 32px;
36
33
  color: #e5e5e5;
37
34
  }
38
35
 
@@ -51,93 +48,54 @@ body {
51
48
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
52
49
  }
53
50
 
54
- .add-form {
55
- display: flex;
56
- flex-direction: column;
57
- gap: 12px;
58
- background: #18181b;
59
- border-radius: 12px;
60
- padding: 16px;
61
- max-width: 28rem;
62
- margin-bottom: 24px;
63
- }
64
-
65
- .add-form input {
66
- padding: 8px 12px;
67
- border-radius: 4px;
68
- background: #222;
69
- border: 1px solid #333;
70
- color: inherit;
71
- outline: none;
72
- font: inherit;
73
- }
74
-
75
- .add-form input:focus {
76
- border-color: #6366f1;
77
- }
78
-
79
- .add-form button {
51
+ .primary-button {
80
52
  background: #4f46e5;
81
53
  color: white;
82
54
  font-weight: 600;
83
55
  padding: 8px 16px;
84
56
  border-radius: 4px;
85
57
  border: 0;
58
+ font-size: 14px;
86
59
  cursor: pointer;
87
60
  transition: background 120ms ease;
88
61
  }
89
62
 
90
- .add-form button:hover {
63
+ .primary-button:hover {
91
64
  background: #4338ca;
92
65
  }
93
66
 
94
- .issues {
95
- max-width: 28rem;
96
- margin-bottom: 24px;
97
- }
98
-
99
- .issues-empty {
100
- color: #888;
101
- font-style: italic;
102
- }
103
-
104
- .issue {
105
- margin-bottom: 8px;
106
- padding: 12px;
107
- border-radius: 8px;
108
- background: #222;
109
- border: 1px solid #2a2a2a;
67
+ .cwd-row {
68
+ margin-top: 12px;
110
69
  display: flex;
111
70
  align-items: center;
112
- justify-content: space-between;
71
+ gap: 8px;
72
+ max-width: 28rem;
113
73
  }
114
74
 
115
- .issue-time {
75
+ .cwd-value {
76
+ flex: 1;
77
+ padding: 8px;
78
+ border-radius: 4px;
79
+ background: #232328;
80
+ color: #b0b0b0;
116
81
  font-size: 12px;
117
- color: #666;
82
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
83
+ overflow: hidden;
84
+ text-overflow: ellipsis;
85
+ white-space: nowrap;
118
86
  }
119
87
 
120
- .rpc-button {
88
+ .copy-button {
121
89
  background: #27272a;
122
90
  color: inherit;
123
91
  border: 0;
124
- padding: 8px 16px;
92
+ padding: 8px 12px;
125
93
  border-radius: 4px;
126
- font-size: 14px;
94
+ font-size: 12px;
127
95
  cursor: pointer;
128
96
  transition: background 120ms ease;
129
97
  }
130
98
 
131
- .rpc-button:hover {
99
+ .copy-button:hover {
132
100
  background: #3f3f46;
133
101
  }
134
-
135
- .rpc-result {
136
- margin-top: 8px;
137
- padding: 8px;
138
- border-radius: 4px;
139
- background: #232328;
140
- color: #b0b0b0;
141
- width: fit-content;
142
- font-size: 12px;
143
- }
@@ -5,9 +5,6 @@ import {
5
5
  } from "@zenbujs/core/config"
6
6
 
7
7
  export default defineConfig({
8
- // Where the kyju database lives (relative to this file).
9
- db: "./.zenbu/db",
10
-
11
8
  // Boot-window HTML. The single ui entrypoint for the whole app.
12
9
  uiEntrypoint: "./src/renderer",
13
10
 
@@ -17,7 +14,6 @@ export default defineConfig({
17
14
  definePlugin({
18
15
  name: "app",
19
16
  services: ["./src/main/services/*.ts"],
20
- schema: "./src/main/schema.ts",
21
17
  }),
22
18
  ],
23
19
 
@@ -1,13 +0,0 @@
1
- import { createSchema, z } from "@zenbujs/core/db"
2
-
3
- export default createSchema({
4
- issues: z
5
- .array(
6
- z.object({
7
- id: z.string(),
8
- title: z.string(),
9
- createdAt: z.number(),
10
- }),
11
- )
12
- .default([]),
13
- })
@@ -1,13 +0,0 @@
1
- import { createSchema, z } from "@zenbujs/core/db"
2
-
3
- export default createSchema({
4
- issues: z
5
- .array(
6
- z.object({
7
- id: z.string(),
8
- title: z.string(),
9
- createdAt: z.number(),
10
- }),
11
- )
12
- .default([]),
13
- })