create-signet-app 0.6.0 → 0.8.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 +6 -2
- package/base/web/index.html +5 -0
- package/base/web/src/main.tsx +2 -0
- package/base/web/src/routes/_app/index.tsx +7 -0
- package/base/web/src/routes/_app.tsx +95 -49
- package/package.json +3 -2
- package/parts/dashboard/part.ts +6 -0
- package/parts/dashboard/web/src/components/overview.test.tsx +16 -0
- package/parts/dashboard/web/src/components/overview.tsx +175 -0
- package/parts/pwa/part.ts +6 -0
- package/parts/pwa/web/public/icon.svg +6 -0
- package/parts/pwa/web/public/manifest.webmanifest +10 -0
- package/parts/pwa/web/public/sw.js +69 -0
- package/parts/pwa/web/src/components/install-button.tsx +14 -0
- package/parts/pwa/web/src/lib/pwa.ts +39 -0
- package/src/compose.ts +23 -3
- package/src/index.ts +54 -36
package/README.md
CHANGED
|
@@ -72,15 +72,17 @@ bunx create-signet-app my-app --starter saas --with ai # a starter, plus a
|
|
|
72
72
|
|
|
73
73
|
| starter | parts (plus what they need) |
|
|
74
74
|
| --- | --- |
|
|
75
|
-
| `full` | every part (`--template full` is the same) |
|
|
75
|
+
| `full` | every part but `dashboard` and `pwa` (`--template full` is the same) |
|
|
76
76
|
| `blank` | none: the shell, the API, the database |
|
|
77
77
|
| `saas` | account, orgs, admin, notifications, privacy, payments |
|
|
78
78
|
| `launch` | account, privacy, growth (waitlist, invites, referrals, feedback) |
|
|
79
79
|
| `internal-tool` | account, orgs, admin, workflows |
|
|
80
|
-
| `api` | account, payments; the API half only |
|
|
80
|
+
| `api-billing` | account, payments; the API half only (`--starter api` still works) |
|
|
81
81
|
| `ai-app` | account, privacy, payments, ai |
|
|
82
82
|
| `paywall` | account, payments, paywalls |
|
|
83
83
|
| `automation` | account, notifications, workflows |
|
|
84
|
+
| `dashboard` | account, dashboard: a sidebar shell, home is an overview |
|
|
85
|
+
| `pwa` | account, pwa: installable, the app shell offline |
|
|
84
86
|
- **Needs** come along on their own and the output says so (`--with payments`
|
|
85
87
|
prints `added auth for payments`). Leaving out a part another one needs is
|
|
86
88
|
an error.
|
|
@@ -107,6 +109,8 @@ bunx create-signet-app my-app --starter saas --with ai # a starter, plus a
|
|
|
107
109
|
| `growth` | waitlist, invites, referral codes, referrals, feedback and marks tables, with signet-db's `createGrowth` (API only) | |
|
|
108
110
|
| `ai` | AI spend caps per user and for the app (signet-db's `createAiSpend`, `requireAiSpend` on `/api/ai/*`), a sample `/api/ai/summary` on signet-ai's fake provider (no key needed); with `admin`, `/api/admin/ai-spend` (API only) | auth |
|
|
109
111
|
| `workflows` | durable workflows (signet-db's `createWorkflows`) at `/api/workflows`, a generic approval-request example, the runner in `api/server.ts`, `/approvals` | auth |
|
|
112
|
+
| `dashboard` | the shell's nav in signet-ui's `Sidebar` (a drawer on phones), and home as an overview: stat tiles, a bar chart and a recent-activity table on sample data, with loading, empty and error states (`src/components/overview.tsx`; web only) | |
|
|
113
|
+
| `pwa` | `public/manifest.webmanifest`, a placeholder `public/icon.svg`, `public/sw.js` (network-first pages over a cached app shell, cached `/assets/`, never `/api`), registered in built apps by `src/lib/pwa.ts`, and an "Install app" button in the shell (web only) | |
|
|
110
114
|
| `mcp` | the API's validated routes as tools at `/mcp` (API only) | |
|
|
111
115
|
|
|
112
116
|
### How parts are put together
|
package/base/web/index.html
CHANGED
|
@@ -4,6 +4,11 @@
|
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
6
|
<title>__APP_NAME__</title>
|
|
7
|
+
<!-- pwa:begin -->
|
|
8
|
+
<link rel="manifest" href="/manifest.webmanifest" />
|
|
9
|
+
<link rel="icon" href="/icon.svg" type="image/svg+xml" />
|
|
10
|
+
<meta name="theme-color" content="#ffffff" />
|
|
11
|
+
<!-- pwa:end -->
|
|
7
12
|
<!-- Applies the stored theme before first paint. React mounts too late;
|
|
8
13
|
without this there is a visible flash of the wrong theme on load. -->
|
|
9
14
|
<script>
|
package/base/web/src/main.tsx
CHANGED
|
@@ -6,11 +6,13 @@ import { RouterProvider } from "@tanstack/react-router"
|
|
|
6
6
|
import { StrictMode } from "react"
|
|
7
7
|
import { createRoot } from "react-dom/client"
|
|
8
8
|
import { Toaster } from "./components/toaster"
|
|
9
|
+
import { registerPwa } from "./lib/pwa" // @pwa
|
|
9
10
|
import { createAppRouter } from "./router"
|
|
10
11
|
import "./app.css"
|
|
11
12
|
|
|
12
13
|
const queryClient = new QueryClient({ defaultOptions: queryDefaults() })
|
|
13
14
|
const router = createAppRouter()
|
|
15
|
+
registerPwa() // @pwa
|
|
14
16
|
// auth:begin
|
|
15
17
|
|
|
16
18
|
// One redirect on session expiry, however many requests fail at once. A full
|
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
// !dashboard:begin
|
|
1
2
|
import { Card, CardContent, CardHeader, CardTitle } from "@dapplelight/signet-ui/components/card"
|
|
2
3
|
import { useQuery } from "@tanstack/react-query" // @auth
|
|
3
4
|
import { createFileRoute, Link } from "@tanstack/react-router" // @payments
|
|
4
5
|
import { createFileRoute } from "@tanstack/react-router" // @!payments
|
|
5
6
|
import { meQuery } from "../../lib/api" // @auth
|
|
7
|
+
// !dashboard:end
|
|
8
|
+
import { createFileRoute } from "@tanstack/react-router" // @dashboard
|
|
9
|
+
import { Overview } from "../../components/overview" // @dashboard
|
|
6
10
|
|
|
7
11
|
export const Route = createFileRoute("/_app/")({
|
|
8
12
|
component: Home,
|
|
@@ -11,6 +15,8 @@ export const Route = createFileRoute("/_app/")({
|
|
|
11
15
|
// Your product goes here. The other pages are already wired; this one is
|
|
12
16
|
// yours.
|
|
13
17
|
function Home() {
|
|
18
|
+
return <Overview /> // @dashboard
|
|
19
|
+
// !dashboard:begin
|
|
14
20
|
// auth:begin
|
|
15
21
|
const me = useQuery(meQuery).data
|
|
16
22
|
return (
|
|
@@ -52,4 +58,5 @@ function Home() {
|
|
|
52
58
|
</Card>
|
|
53
59
|
)
|
|
54
60
|
// !auth:end
|
|
61
|
+
// !dashboard:end
|
|
55
62
|
}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import { Badge } from "@dapplelight/signet-ui/components/badge" // @notifications
|
|
2
2
|
import { Button } from "@dapplelight/signet-ui/components/button" // @auth
|
|
3
|
+
// dashboard:begin
|
|
4
|
+
import {
|
|
5
|
+
Sidebar,
|
|
6
|
+
SidebarContent,
|
|
7
|
+
SidebarHeader,
|
|
8
|
+
SidebarInset,
|
|
9
|
+
SidebarProvider,
|
|
10
|
+
SidebarTrigger,
|
|
11
|
+
} from "@dapplelight/signet-ui/components/sidebar"
|
|
12
|
+
// dashboard:end
|
|
3
13
|
import { ThemeToggle } from "@dapplelight/signet-ui/components/theme-toggle"
|
|
4
14
|
import { OrgSwitcher } from "@dapplelight/signet-ui/screens/org-screens" // @orgs
|
|
5
15
|
import { useQuery } from "@tanstack/react-query" // @orgs
|
|
@@ -8,6 +18,7 @@ import { useQuery } from "@tanstack/react-query" // @notifications
|
|
|
8
18
|
// !orgs:end
|
|
9
19
|
import { createFileRoute, Link, Outlet, useNavigate } from "@tanstack/react-router" // @orgs
|
|
10
20
|
import { createFileRoute, Link, Outlet } from "@tanstack/react-router" // @!orgs
|
|
21
|
+
import { InstallButton } from "../components/install-button" // @pwa
|
|
11
22
|
// auth:begin
|
|
12
23
|
import { api, currentOrgQuery, meQuery, orgsQuery, switchOrg } from "../lib/api" // @admin
|
|
13
24
|
// !admin:begin
|
|
@@ -48,65 +59,100 @@ function AppLayout() {
|
|
|
48
59
|
const current = useQuery({ ...currentOrgQuery, retry: false }).data
|
|
49
60
|
// orgs:end
|
|
50
61
|
|
|
62
|
+
const link =
|
|
63
|
+
"rounded-md px-2 py-1 text-muted-foreground data-[status=active]:bg-muted data-[status=active]:text-foreground"
|
|
64
|
+
const nav = (
|
|
65
|
+
<>
|
|
66
|
+
{NAV.map((n) => (
|
|
67
|
+
<Link key={n.to} to={n.to} className={link}>
|
|
68
|
+
{n.label}
|
|
69
|
+
{/* notifications:begin */}
|
|
70
|
+
{n.to === "/notifications" && unread ? <Badge className="ml-1">{unread}</Badge> : null}
|
|
71
|
+
{/* notifications:end */}
|
|
72
|
+
</Link>
|
|
73
|
+
))}
|
|
74
|
+
{/* admin:begin */}
|
|
75
|
+
{staff ? (
|
|
76
|
+
<Link to="/admin" className={link}>
|
|
77
|
+
Admin
|
|
78
|
+
</Link>
|
|
79
|
+
) : null}
|
|
80
|
+
{/* admin:end */}
|
|
81
|
+
</>
|
|
82
|
+
)
|
|
83
|
+
// orgs:begin
|
|
84
|
+
// Every org you belong to; switching reloads into the other one.
|
|
85
|
+
const switcher = (
|
|
86
|
+
<OrgSwitcher
|
|
87
|
+
className="w-48"
|
|
88
|
+
orgs={orgs}
|
|
89
|
+
currentId={current?.org.id ?? null}
|
|
90
|
+
onSwitch={(id) => switchOrg(id)}
|
|
91
|
+
onCreate={() => navigate({ to: "/org/new" })}
|
|
92
|
+
/>
|
|
93
|
+
)
|
|
94
|
+
// orgs:end
|
|
95
|
+
const actions = (
|
|
96
|
+
<>
|
|
97
|
+
<InstallButton /> {/* @pwa */}
|
|
98
|
+
<ThemeToggle />
|
|
99
|
+
{/* auth:begin */}
|
|
100
|
+
<Button
|
|
101
|
+
variant="ghost"
|
|
102
|
+
size="sm"
|
|
103
|
+
onClick={async () => {
|
|
104
|
+
await api.auth["sign-out"].$post()
|
|
105
|
+
window.location.assign("/login")
|
|
106
|
+
}}
|
|
107
|
+
>
|
|
108
|
+
Sign out
|
|
109
|
+
</Button>
|
|
110
|
+
{/* auth:end */}
|
|
111
|
+
</>
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
// dashboard:begin
|
|
115
|
+
// The nav in a sidebar: a drawer on phones, collapsed with Ctrl+B / Cmd+B.
|
|
116
|
+
return (
|
|
117
|
+
<SidebarProvider>
|
|
118
|
+
<Sidebar collapsible="offcanvas" aria-label="Main">
|
|
119
|
+
<SidebarHeader className="px-4 py-3">
|
|
120
|
+
<Link to="/" className="font-medium">
|
|
121
|
+
__APP_NAME__
|
|
122
|
+
</Link>
|
|
123
|
+
{switcher} {/* @orgs */}
|
|
124
|
+
</SidebarHeader>
|
|
125
|
+
<SidebarContent>
|
|
126
|
+
<nav className="flex flex-col gap-1 p-2 text-sm">{nav}</nav>
|
|
127
|
+
</SidebarContent>
|
|
128
|
+
</Sidebar>
|
|
129
|
+
<SidebarInset>
|
|
130
|
+
<header className="flex items-center gap-2 border-b border-border px-4 py-3">
|
|
131
|
+
<SidebarTrigger />
|
|
132
|
+
<div className="flex flex-1 items-center justify-end gap-2">{actions}</div>
|
|
133
|
+
</header>
|
|
134
|
+
<div className="mx-auto w-full max-w-6xl p-6">
|
|
135
|
+
<Outlet />
|
|
136
|
+
</div>
|
|
137
|
+
</SidebarInset>
|
|
138
|
+
</SidebarProvider>
|
|
139
|
+
)
|
|
140
|
+
// dashboard:end
|
|
141
|
+
// !dashboard:begin
|
|
51
142
|
return (
|
|
52
143
|
<>
|
|
53
144
|
<header className="flex flex-wrap items-center gap-4 border-b border-border px-6 py-3">
|
|
54
145
|
<Link to="/" className="font-medium">
|
|
55
146
|
__APP_NAME__
|
|
56
147
|
</Link>
|
|
57
|
-
{/* orgs
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
className="w-48"
|
|
61
|
-
orgs={orgs}
|
|
62
|
-
currentId={current?.org.id ?? null}
|
|
63
|
-
onSwitch={(id) => switchOrg(id)}
|
|
64
|
-
onCreate={() => navigate({ to: "/org/new" })}
|
|
65
|
-
/>
|
|
66
|
-
{/* orgs:end */}
|
|
67
|
-
<nav className="flex flex-1 flex-wrap items-center gap-1 text-sm">
|
|
68
|
-
{NAV.map((n) => (
|
|
69
|
-
<Link
|
|
70
|
-
key={n.to}
|
|
71
|
-
to={n.to}
|
|
72
|
-
className="rounded-md px-2 py-1 text-muted-foreground data-[status=active]:bg-muted data-[status=active]:text-foreground"
|
|
73
|
-
>
|
|
74
|
-
{n.label}
|
|
75
|
-
{/* notifications:begin */}
|
|
76
|
-
{n.to === "/notifications" && unread ? (
|
|
77
|
-
<Badge className="ml-1">{unread}</Badge>
|
|
78
|
-
) : null}
|
|
79
|
-
{/* notifications:end */}
|
|
80
|
-
</Link>
|
|
81
|
-
))}
|
|
82
|
-
{/* admin:begin */}
|
|
83
|
-
{staff ? (
|
|
84
|
-
<Link
|
|
85
|
-
to="/admin"
|
|
86
|
-
className="rounded-md px-2 py-1 text-muted-foreground data-[status=active]:bg-muted data-[status=active]:text-foreground"
|
|
87
|
-
>
|
|
88
|
-
Admin
|
|
89
|
-
</Link>
|
|
90
|
-
) : null}
|
|
91
|
-
{/* admin:end */}
|
|
92
|
-
</nav>
|
|
93
|
-
<ThemeToggle />
|
|
94
|
-
{/* auth:begin */}
|
|
95
|
-
<Button
|
|
96
|
-
variant="ghost"
|
|
97
|
-
size="sm"
|
|
98
|
-
onClick={async () => {
|
|
99
|
-
await api.auth["sign-out"].$post()
|
|
100
|
-
window.location.assign("/login")
|
|
101
|
-
}}
|
|
102
|
-
>
|
|
103
|
-
Sign out
|
|
104
|
-
</Button>
|
|
105
|
-
{/* auth:end */}
|
|
148
|
+
{switcher} {/* @orgs */}
|
|
149
|
+
<nav className="flex flex-1 flex-wrap items-center gap-1 text-sm">{nav}</nav>
|
|
150
|
+
{actions}
|
|
106
151
|
</header>
|
|
107
152
|
<main className="mx-auto max-w-3xl p-6">
|
|
108
153
|
<Outlet />
|
|
109
154
|
</main>
|
|
110
155
|
</>
|
|
111
156
|
)
|
|
157
|
+
// !dashboard:end
|
|
112
158
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-signet-app",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Scaffold a Vite + React + Tailwind app wired to Signet.",
|
|
6
6
|
"keywords": [
|
|
@@ -38,12 +38,13 @@
|
|
|
38
38
|
],
|
|
39
39
|
"scripts": {
|
|
40
40
|
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.test.json",
|
|
41
|
-
"test": "bun run test/scaffold.ts && bun run test/scaffold-api.ts && bun run test/scaffold-full.ts && bun run test/scaffold-cli.ts && bun run test/scaffold-extension.ts && bun run test/scaffold-desktop.ts && bun run test/describe.ts",
|
|
41
|
+
"test": "bun run test/scaffold.ts && bun run test/scaffold-api.ts && bun run test/scaffold-full.ts && bun run test/scaffold-cli.ts && bun run test/scaffold-extension.ts && bun run test/scaffold-desktop.ts && bun run test/describe.ts && bun run test/picker.ts",
|
|
42
42
|
"test:parts": "bun run test/scaffold-parts.ts",
|
|
43
43
|
"test:pm": "bun run test/scaffold-pm.ts",
|
|
44
44
|
"test:runtime": "bun run test/scaffold-runtime.ts"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
+
"@clack/prompts": "1.8.1",
|
|
47
48
|
"@dapplelight/signet-mcp": "^0.1.5"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { expect, test } from "bun:test"
|
|
2
|
+
import { renderToStaticMarkup } from "react-dom/server"
|
|
3
|
+
import { type OverviewData, OverviewView, SAMPLE_OVERVIEW } from "./overview"
|
|
4
|
+
|
|
5
|
+
// Each state renders its own thing, and only that.
|
|
6
|
+
test.each<["loading" | "error" | "ready", OverviewData | undefined, string]>([
|
|
7
|
+
["loading", undefined, "Loading overview"],
|
|
8
|
+
["error", undefined, "The overview did not load."],
|
|
9
|
+
["ready", { stats: [], series: [], rows: [] }, "Nothing here yet"],
|
|
10
|
+
["ready", SAMPLE_OVERVIEW, "Recent activity"],
|
|
11
|
+
])("%s shows %#", (state, data, text) => {
|
|
12
|
+
const html = renderToStaticMarkup(<OverviewView state={state} data={data} />)
|
|
13
|
+
expect(html).toContain(text)
|
|
14
|
+
for (const other of ["Loading overview", "did not load", "Nothing here yet", "Recent activity"])
|
|
15
|
+
if (!text.includes(other)) expect(html).not.toContain(other)
|
|
16
|
+
})
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { Badge } from "@dapplelight/signet-ui/components/badge"
|
|
2
|
+
import { Card, CardContent, CardHeader, CardTitle } from "@dapplelight/signet-ui/components/card"
|
|
3
|
+
import { EmptyState } from "@dapplelight/signet-ui/components/empty-state"
|
|
4
|
+
import { ErrorState } from "@dapplelight/signet-ui/components/error-state"
|
|
5
|
+
import { Skeleton } from "@dapplelight/signet-ui/components/skeleton"
|
|
6
|
+
import { type StatItem, StatStrip } from "@dapplelight/signet-ui/components/stat-strip"
|
|
7
|
+
import {
|
|
8
|
+
Table,
|
|
9
|
+
TableBody,
|
|
10
|
+
TableCell,
|
|
11
|
+
TableHead,
|
|
12
|
+
TableHeader,
|
|
13
|
+
TableRow,
|
|
14
|
+
} from "@dapplelight/signet-ui/components/table"
|
|
15
|
+
import { useQuery } from "@tanstack/react-query"
|
|
16
|
+
|
|
17
|
+
export type OverviewData = {
|
|
18
|
+
stats: StatItem[]
|
|
19
|
+
series: { label: string; value: number }[]
|
|
20
|
+
rows: {
|
|
21
|
+
id: string
|
|
22
|
+
name: string
|
|
23
|
+
status: string
|
|
24
|
+
tone?: "default" | "secondary" | "outline" | "destructive"
|
|
25
|
+
date: string
|
|
26
|
+
}[]
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Sample data for the first run. Replace loadOverview with a call to your API
|
|
30
|
+
// (src/lib/api.ts); the page already handles loading, empty and error.
|
|
31
|
+
export const SAMPLE_OVERVIEW: OverviewData = {
|
|
32
|
+
stats: [
|
|
33
|
+
{ label: "Visitors", value: "12,480", meta: "+8.2% vs last week", tone: "good" },
|
|
34
|
+
{ label: "Sign-ups", value: "684", meta: "+3.1% vs last week", tone: "good" },
|
|
35
|
+
{ label: "Active users", value: "3,912", meta: "-1.4% vs last week", tone: "warn" },
|
|
36
|
+
{ label: "Projects", value: "1,207", meta: "42 created today" },
|
|
37
|
+
],
|
|
38
|
+
series: [
|
|
39
|
+
{ label: "Mon", value: 1420 },
|
|
40
|
+
{ label: "Tue", value: 1760 },
|
|
41
|
+
{ label: "Wed", value: 1680 },
|
|
42
|
+
{ label: "Thu", value: 2040 },
|
|
43
|
+
{ label: "Fri", value: 2310 },
|
|
44
|
+
{ label: "Sat", value: 1590 },
|
|
45
|
+
{ label: "Sun", value: 1680 },
|
|
46
|
+
],
|
|
47
|
+
rows: [
|
|
48
|
+
{ id: "1", name: "Acme Studio", status: "Active", date: "Nov 16" },
|
|
49
|
+
{ id: "2", name: "Northwind", status: "Trial", tone: "secondary", date: "Nov 15" },
|
|
50
|
+
{ id: "3", name: "Globex", status: "Active", date: "Nov 15" },
|
|
51
|
+
{ id: "4", name: "Initech", status: "Paused", tone: "outline", date: "Nov 13" },
|
|
52
|
+
{ id: "5", name: "Umbrella Labs", status: "Past due", tone: "destructive", date: "Nov 12" },
|
|
53
|
+
],
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async function loadOverview(): Promise<OverviewData> {
|
|
57
|
+
return SAMPLE_OVERVIEW
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function Overview() {
|
|
61
|
+
const q = useQuery({ queryKey: ["overview"], queryFn: loadOverview })
|
|
62
|
+
return (
|
|
63
|
+
<OverviewView
|
|
64
|
+
state={q.isPending ? "loading" : q.isError ? "error" : "ready"}
|
|
65
|
+
data={q.data}
|
|
66
|
+
onRetry={() => q.refetch()}
|
|
67
|
+
/>
|
|
68
|
+
)
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** The page itself, by state: what a test or a preview renders without fetching. */
|
|
72
|
+
export function OverviewView({
|
|
73
|
+
state,
|
|
74
|
+
data,
|
|
75
|
+
onRetry,
|
|
76
|
+
}: {
|
|
77
|
+
state: "loading" | "error" | "ready"
|
|
78
|
+
data?: OverviewData
|
|
79
|
+
onRetry?: () => void
|
|
80
|
+
}) {
|
|
81
|
+
const empty = !data || (!data.stats.length && !data.series.length && !data.rows.length)
|
|
82
|
+
return (
|
|
83
|
+
<section className="flex flex-col gap-4 md:gap-6" aria-busy={state === "loading" || undefined}>
|
|
84
|
+
<h1 className="text-title font-semibold">Overview</h1>
|
|
85
|
+
{state === "error" ? (
|
|
86
|
+
<Card>
|
|
87
|
+
<CardContent>
|
|
88
|
+
<ErrorState message="The overview did not load." onRetry={onRetry} />
|
|
89
|
+
</CardContent>
|
|
90
|
+
</Card>
|
|
91
|
+
) : state === "loading" ? (
|
|
92
|
+
<div role="status" aria-label="Loading overview" className="contents">
|
|
93
|
+
<div className="grid grid-cols-2 gap-3 lg:grid-cols-4">
|
|
94
|
+
{[0, 1, 2, 3].map((i) => (
|
|
95
|
+
<Skeleton key={i} className="h-24" />
|
|
96
|
+
))}
|
|
97
|
+
</div>
|
|
98
|
+
<Skeleton className="h-64" />
|
|
99
|
+
<Skeleton className="h-56" />
|
|
100
|
+
</div>
|
|
101
|
+
) : empty ? (
|
|
102
|
+
<Card>
|
|
103
|
+
<CardContent>
|
|
104
|
+
<EmptyState
|
|
105
|
+
title="Nothing here yet"
|
|
106
|
+
description="Numbers show up here once there is activity."
|
|
107
|
+
/>
|
|
108
|
+
</CardContent>
|
|
109
|
+
</Card>
|
|
110
|
+
) : (
|
|
111
|
+
<>
|
|
112
|
+
<StatStrip items={data.stats} />
|
|
113
|
+
<Card>
|
|
114
|
+
<CardHeader>
|
|
115
|
+
<CardTitle>This week</CardTitle>
|
|
116
|
+
</CardHeader>
|
|
117
|
+
<CardContent>
|
|
118
|
+
<BarChart points={data.series} />
|
|
119
|
+
</CardContent>
|
|
120
|
+
</Card>
|
|
121
|
+
<Card>
|
|
122
|
+
<CardHeader>
|
|
123
|
+
<CardTitle>Recent activity</CardTitle>
|
|
124
|
+
</CardHeader>
|
|
125
|
+
<CardContent>
|
|
126
|
+
<Table>
|
|
127
|
+
<TableHeader>
|
|
128
|
+
<TableRow>
|
|
129
|
+
<TableHead>Name</TableHead>
|
|
130
|
+
<TableHead>Status</TableHead>
|
|
131
|
+
<TableHead className="text-right">Date</TableHead>
|
|
132
|
+
</TableRow>
|
|
133
|
+
</TableHeader>
|
|
134
|
+
<TableBody>
|
|
135
|
+
{data.rows.map((r) => (
|
|
136
|
+
<TableRow key={r.id}>
|
|
137
|
+
<TableCell className="font-medium">{r.name}</TableCell>
|
|
138
|
+
<TableCell>
|
|
139
|
+
<Badge variant={r.tone ?? "default"}>{r.status}</Badge>
|
|
140
|
+
</TableCell>
|
|
141
|
+
<TableCell className="text-right text-text-muted">{r.date}</TableCell>
|
|
142
|
+
</TableRow>
|
|
143
|
+
))}
|
|
144
|
+
</TableBody>
|
|
145
|
+
</Table>
|
|
146
|
+
</CardContent>
|
|
147
|
+
</Card>
|
|
148
|
+
</>
|
|
149
|
+
)}
|
|
150
|
+
</section>
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// ponytail: plain bars, no chart library. For axes, tooltips or many series,
|
|
155
|
+
// install recharts (an optional peer of signet-ui) and use its Chart component.
|
|
156
|
+
function BarChart({ points }: { points: OverviewData["series"] }) {
|
|
157
|
+
const max = Math.max(1, ...points.map((p) => p.value))
|
|
158
|
+
const summary = points.map((p) => `${p.label} ${p.value.toLocaleString()}`).join(", ")
|
|
159
|
+
return (
|
|
160
|
+
<div role="img" aria-label={`Bar chart: ${summary}`} className="flex h-48 items-end gap-2">
|
|
161
|
+
{points.map((p) => (
|
|
162
|
+
<div key={p.label} className="flex h-full flex-1 flex-col items-center gap-1">
|
|
163
|
+
<div className="flex w-full flex-1 items-end">
|
|
164
|
+
<div
|
|
165
|
+
className="w-full rounded-t-md bg-primary"
|
|
166
|
+
style={{ height: `${(p.value / max) * 100}%` }}
|
|
167
|
+
title={`${p.label}: ${p.value.toLocaleString()}`}
|
|
168
|
+
/>
|
|
169
|
+
</div>
|
|
170
|
+
<span className="text-xs text-text-muted">{p.label}</span>
|
|
171
|
+
</div>
|
|
172
|
+
))}
|
|
173
|
+
</div>
|
|
174
|
+
)
|
|
175
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<!-- A placeholder icon: replace it with your own (keep a square viewBox). -->
|
|
3
|
+
<title>__APP_NAME__</title>
|
|
4
|
+
<rect width="512" height="512" rx="112" fill="#18181b" />
|
|
5
|
+
<circle cx="256" cy="256" r="120" fill="none" stroke="#fafafa" stroke-width="40" />
|
|
6
|
+
</svg>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__APP_NAME__",
|
|
3
|
+
"short_name": "__APP_NAME__",
|
|
4
|
+
"start_url": "/",
|
|
5
|
+
"scope": "/",
|
|
6
|
+
"display": "standalone",
|
|
7
|
+
"background_color": "#ffffff",
|
|
8
|
+
"theme_color": "#ffffff",
|
|
9
|
+
"icons": [{ "src": "/icon.svg", "sizes": "any", "type": "image/svg+xml", "purpose": "any" }]
|
|
10
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// The service worker: the app shell works offline. src/lib/pwa.ts registers it
|
|
2
|
+
// in built apps only. Pages come from the network and fall back to the cached
|
|
3
|
+
// shell (index.html); built files under /assets/ have hashed names, so once
|
|
4
|
+
// cached they are served from the cache. /api and /mcp always go to the
|
|
5
|
+
// network, so nothing private is cached. A route chunk never loaded while
|
|
6
|
+
// online is not cached; visit it once, or list it in cacheShell.
|
|
7
|
+
// ponytail: one cache that grows by a few files per deploy; change VERSION to
|
|
8
|
+
// start a fresh one.
|
|
9
|
+
const VERSION = "v1"
|
|
10
|
+
const CACHE = `app-shell-${VERSION}`
|
|
11
|
+
|
|
12
|
+
async function cacheShell() {
|
|
13
|
+
const cache = await caches.open(CACHE)
|
|
14
|
+
const res = await fetch("/", { cache: "no-cache" })
|
|
15
|
+
const html = await res.clone().text()
|
|
16
|
+
const assets = [...html.matchAll(/\/assets\/[^"'\s]+/g)].map((m) => m[0])
|
|
17
|
+
await cache.put("/", res)
|
|
18
|
+
await cache.addAll(["/manifest.webmanifest", "/icon.svg", ...new Set(assets)])
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
self.addEventListener("install", (event) => {
|
|
22
|
+
event.waitUntil(cacheShell().then(() => self.skipWaiting()))
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
self.addEventListener("activate", (event) => {
|
|
26
|
+
event.waitUntil(
|
|
27
|
+
caches
|
|
28
|
+
.keys()
|
|
29
|
+
.then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
|
|
30
|
+
.then(() => self.clients.claim()),
|
|
31
|
+
)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
self.addEventListener("fetch", (event) => {
|
|
35
|
+
const { request } = event
|
|
36
|
+
const url = new URL(request.url)
|
|
37
|
+
if (request.method !== "GET" || url.origin !== self.location.origin) return
|
|
38
|
+
if (url.pathname.startsWith("/api/") || url.pathname.startsWith("/mcp")) return
|
|
39
|
+
|
|
40
|
+
if (request.mode === "navigate") {
|
|
41
|
+
// Every page is index.html (the server's SPA fallback): keep the newest.
|
|
42
|
+
event.respondWith(
|
|
43
|
+
fetch(request)
|
|
44
|
+
.then((res) => {
|
|
45
|
+
if (res.ok) {
|
|
46
|
+
const copy = res.clone()
|
|
47
|
+
event.waitUntil(caches.open(CACHE).then((c) => c.put("/", copy)))
|
|
48
|
+
}
|
|
49
|
+
return res
|
|
50
|
+
})
|
|
51
|
+
.catch(async () => (await caches.match("/")) ?? Response.error()),
|
|
52
|
+
)
|
|
53
|
+
return
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
event.respondWith(
|
|
57
|
+
caches.match(request).then(
|
|
58
|
+
(hit) =>
|
|
59
|
+
hit ??
|
|
60
|
+
fetch(request).then((res) => {
|
|
61
|
+
if (res.ok && url.pathname.startsWith("/assets/")) {
|
|
62
|
+
const copy = res.clone()
|
|
63
|
+
event.waitUntil(caches.open(CACHE).then((c) => c.put(request, copy)))
|
|
64
|
+
}
|
|
65
|
+
return res
|
|
66
|
+
}),
|
|
67
|
+
),
|
|
68
|
+
)
|
|
69
|
+
})
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Button } from "@dapplelight/signet-ui/components/button"
|
|
2
|
+
import { useSyncExternalStore } from "react"
|
|
3
|
+
import { canInstall, install, subscribeInstall } from "../lib/pwa"
|
|
4
|
+
|
|
5
|
+
/** "Install app", while the browser offers to install it. */
|
|
6
|
+
export function InstallButton() {
|
|
7
|
+
const available = useSyncExternalStore(subscribeInstall, canInstall)
|
|
8
|
+
if (!available) return null
|
|
9
|
+
return (
|
|
10
|
+
<Button variant="outline" size="sm" onClick={() => void install()}>
|
|
11
|
+
Install app
|
|
12
|
+
</Button>
|
|
13
|
+
)
|
|
14
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// The installable app: registers public/sw.js (the offline app shell) and
|
|
2
|
+
// keeps the browser's install prompt for InstallButton. Chromium browsers fire
|
|
3
|
+
// beforeinstallprompt; Safari installs from its Share menu, so there the
|
|
4
|
+
// button never shows.
|
|
5
|
+
|
|
6
|
+
type InstallPromptEvent = Event & { prompt: () => Promise<void> }
|
|
7
|
+
|
|
8
|
+
let deferred: InstallPromptEvent | null = null
|
|
9
|
+
const listeners = new Set<() => void>()
|
|
10
|
+
const set = (e: InstallPromptEvent | null) => {
|
|
11
|
+
deferred = e
|
|
12
|
+
for (const l of listeners) l()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Call once, before the app renders: the prompt can fire before React mounts. */
|
|
16
|
+
export function registerPwa(): void {
|
|
17
|
+
window.addEventListener("beforeinstallprompt", (e) => {
|
|
18
|
+
e.preventDefault()
|
|
19
|
+
set(e as InstallPromptEvent)
|
|
20
|
+
})
|
|
21
|
+
window.addEventListener("appinstalled", () => set(null))
|
|
22
|
+
// `dev` has no service worker: it would cache Vite's modules under you.
|
|
23
|
+
if (import.meta.env.PROD && "serviceWorker" in navigator)
|
|
24
|
+
navigator.serviceWorker.register("/sw.js").catch(() => {})
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export function subscribeInstall(onChange: () => void): () => void {
|
|
28
|
+
listeners.add(onChange)
|
|
29
|
+
return () => listeners.delete(onChange)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const canInstall = (): boolean => deferred !== null
|
|
33
|
+
|
|
34
|
+
/** Shows the browser's install dialog. It can be shown once per event. */
|
|
35
|
+
export async function install(): Promise<void> {
|
|
36
|
+
const e = deferred
|
|
37
|
+
set(null)
|
|
38
|
+
await e?.prompt()
|
|
39
|
+
}
|
package/src/compose.ts
CHANGED
|
@@ -18,6 +18,7 @@ import account from "../parts/account/part.js"
|
|
|
18
18
|
import admin from "../parts/admin/part.js"
|
|
19
19
|
import ai from "../parts/ai/part.js"
|
|
20
20
|
import auth from "../parts/auth/part.js"
|
|
21
|
+
import dashboard from "../parts/dashboard/part.js"
|
|
21
22
|
import growth from "../parts/growth/part.js"
|
|
22
23
|
import mcp from "../parts/mcp/part.js"
|
|
23
24
|
import notifications from "../parts/notifications/part.js"
|
|
@@ -25,6 +26,7 @@ import orgs from "../parts/orgs/part.js"
|
|
|
25
26
|
import payments from "../parts/payments/part.js"
|
|
26
27
|
import paywalls from "../parts/paywalls/part.js"
|
|
27
28
|
import privacy from "../parts/privacy/part.js"
|
|
29
|
+
import pwa from "../parts/pwa/part.js"
|
|
28
30
|
import workflows from "../parts/workflows/part.js"
|
|
29
31
|
|
|
30
32
|
type Deps = Record<string, string>
|
|
@@ -37,6 +39,8 @@ export type Part = {
|
|
|
37
39
|
needs?: PartName[]
|
|
38
40
|
/** Needs the API surface (it has no web half). */
|
|
39
41
|
apiOnly?: boolean
|
|
42
|
+
/** Needs the web surface (it has no API half). */
|
|
43
|
+
webOnly?: boolean
|
|
40
44
|
web?: { deps?: Deps }
|
|
41
45
|
api?: { deps?: Deps }
|
|
42
46
|
/** With both surfaces: dev deps and scripts (the browser test). */
|
|
@@ -65,6 +69,8 @@ export const PART_NAMES = [
|
|
|
65
69
|
"growth",
|
|
66
70
|
"ai",
|
|
67
71
|
"workflows",
|
|
72
|
+
"dashboard",
|
|
73
|
+
"pwa",
|
|
68
74
|
"mcp",
|
|
69
75
|
] as const
|
|
70
76
|
export type PartName = (typeof PART_NAMES)[number]
|
|
@@ -80,19 +86,25 @@ export const PARTS: Record<PartName, Part> = {
|
|
|
80
86
|
growth,
|
|
81
87
|
ai,
|
|
82
88
|
workflows,
|
|
89
|
+
dashboard,
|
|
90
|
+
pwa,
|
|
83
91
|
mcp,
|
|
84
92
|
}
|
|
85
93
|
|
|
86
94
|
/**
|
|
87
95
|
* A named mix of parts, by the shape of app, never its domain. `full` is
|
|
88
|
-
* everything the full template had
|
|
96
|
+
* everything the full template had (not dashboard or pwa, which reshape the
|
|
97
|
+
* web half); `blank` is the base alone (the shell, the
|
|
89
98
|
* API, the database), for parts of your own. Needs are added for you (admin
|
|
90
99
|
* brings orgs, everything brings auth). `surface: "api"` is the API half only.
|
|
91
100
|
* MCP is not listed: it is asked for (or --mcp / --no-mcp), as it always was.
|
|
92
101
|
* Each description is one line, quoted, first: signet-mcp's index reads it.
|
|
93
102
|
*/
|
|
94
103
|
export const STARTERS = {
|
|
95
|
-
full: {
|
|
104
|
+
full: {
|
|
105
|
+
description: "every part, web + API",
|
|
106
|
+
parts: PART_NAMES.filter((p) => !["mcp", "dashboard", "pwa"].includes(p)),
|
|
107
|
+
},
|
|
96
108
|
blank: { description: "no parts: the shell, the API and the database", parts: [] },
|
|
97
109
|
saas: {
|
|
98
110
|
description: "a paid team product: orgs, admin, billing, inbox, account, privacy",
|
|
@@ -106,7 +118,7 @@ export const STARTERS = {
|
|
|
106
118
|
description: "for your own team: orgs and roles, the admin panel, approval workflows",
|
|
107
119
|
parts: ["account", "orgs", "admin", "workflows"],
|
|
108
120
|
},
|
|
109
|
-
api: {
|
|
121
|
+
"api-billing": {
|
|
110
122
|
description: "the API half only: sign-in, API keys, billing webhooks",
|
|
111
123
|
parts: ["account", "payments"],
|
|
112
124
|
surface: "api",
|
|
@@ -123,6 +135,14 @@ export const STARTERS = {
|
|
|
123
135
|
description: "durable workflows with approvals, and an inbox to tell people",
|
|
124
136
|
parts: ["account", "notifications", "workflows"],
|
|
125
137
|
},
|
|
138
|
+
dashboard: {
|
|
139
|
+
description: "a sidebar shell and an overview: stat tiles, a chart, a table",
|
|
140
|
+
parts: ["account", "dashboard"],
|
|
141
|
+
},
|
|
142
|
+
pwa: {
|
|
143
|
+
description: "installable and offline: web manifest, service worker, install prompt",
|
|
144
|
+
parts: ["account", "pwa"],
|
|
145
|
+
},
|
|
126
146
|
} satisfies Record<string, { description: string; parts: PartName[]; surface?: "api" }>
|
|
127
147
|
export type StarterName = keyof typeof STARTERS
|
|
128
148
|
|
package/src/index.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
import { existsSync } from "node:fs"
|
|
14
14
|
import { cp, mkdir, readdir, readFile, rename, writeFile } from "node:fs/promises"
|
|
15
15
|
import { basename, join, resolve } from "node:path"
|
|
16
|
-
import {
|
|
16
|
+
import { cancel, confirm, intro, isCancel, outro, select } from "@clack/prompts"
|
|
17
17
|
import {
|
|
18
18
|
applyBlocks,
|
|
19
19
|
type BaseDeps,
|
|
@@ -373,7 +373,8 @@ function parseArgs(argv: string[]) {
|
|
|
373
373
|
throw new Error("--platform and --template are the same flag; give one.")
|
|
374
374
|
template = templateGiven = v as Template
|
|
375
375
|
} else if (a === "--starter") {
|
|
376
|
-
|
|
376
|
+
// `api` was api-billing's name until the picker listed it beside the api platform.
|
|
377
|
+
const v = args[++i] === "api" ? "api-billing" : args[i]
|
|
377
378
|
if (!STARTER_NAMES.includes(v as StarterName)) {
|
|
378
379
|
throw new Error(`Unknown starter "${v}". Available: ${STARTER_NAMES.join(", ")}`)
|
|
379
380
|
}
|
|
@@ -573,44 +574,56 @@ async function substitute(dir: string, vars: Record<string, string>) {
|
|
|
573
574
|
}
|
|
574
575
|
}
|
|
575
576
|
|
|
576
|
-
/**
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
577
|
+
/** One line each in the picker; cut to the terminal's width when shown. */
|
|
578
|
+
const PLATFORM_HINTS: Record<Platform, string> = {
|
|
579
|
+
web: "Vite + React + Signet UI",
|
|
580
|
+
api: "Hono Worker: error envelope, request ids, rate limiting",
|
|
581
|
+
cli: "Bun CLI compiled to one binary, device-code login",
|
|
582
|
+
extension: "Chrome MV3 extension: popup, options page, service worker",
|
|
583
|
+
desktop: "Tauri v2 desktop + menu-bar app, browser sign-in",
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/** Ctrl+C at a prompt: say so and leave without scaffolding. */
|
|
587
|
+
function cancelled(): never {
|
|
588
|
+
cancel("Cancelled.")
|
|
589
|
+
process.exit(130)
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** A picker row: "platform · web" or "starter · saas", its hint kept to one line. */
|
|
593
|
+
function pickerOption<V extends string>(group: string, value: V, hint: string, width: number) {
|
|
594
|
+
const label = `${group.padEnd(8)} · ${value}`
|
|
595
|
+
// "│ ● " before the label, " (" and ")" around the hint, and the margin
|
|
596
|
+
// clack keeps when it wraps a row.
|
|
597
|
+
const room = width - label.length - 21
|
|
598
|
+
return {
|
|
599
|
+
value,
|
|
600
|
+
label,
|
|
601
|
+
hint: room < 2 ? undefined : hint.length > room ? `${hint.slice(0, room - 1)}…` : hint,
|
|
601
602
|
}
|
|
602
603
|
}
|
|
603
604
|
|
|
605
|
+
/** "What are you building?": a platform or a starter, by arrow keys; default web. */
|
|
606
|
+
async function askWhat(): Promise<Platform | StarterName> {
|
|
607
|
+
intro("create-signet-app")
|
|
608
|
+
const width = process.stdout.columns || 80
|
|
609
|
+
const what = await select<Platform | StarterName>({
|
|
610
|
+
message: "What are you building?",
|
|
611
|
+
initialValue: "web",
|
|
612
|
+
options: [
|
|
613
|
+
...PLATFORMS.map((p) => pickerOption("platform", p, PLATFORM_HINTS[p], width)),
|
|
614
|
+
...STARTER_NAMES.map((s) => pickerOption("starter", s, STARTERS[s].description, width)),
|
|
615
|
+
],
|
|
616
|
+
})
|
|
617
|
+
if (isCancel(what)) cancelled()
|
|
618
|
+
return what
|
|
619
|
+
}
|
|
620
|
+
|
|
604
621
|
/** "Add MCP for agents?", default yes; only asked on a terminal. */
|
|
605
622
|
async function askMcp(): Promise<boolean> {
|
|
606
623
|
if (!process.stdin.isTTY) return true
|
|
607
|
-
const
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
return answer === "" || answer.startsWith("y")
|
|
611
|
-
} finally {
|
|
612
|
-
rl.close()
|
|
613
|
-
}
|
|
624
|
+
const yes = await confirm({ message: "Add MCP for agents?", initialValue: true })
|
|
625
|
+
if (isCancel(yes)) cancelled()
|
|
626
|
+
return yes
|
|
614
627
|
}
|
|
615
628
|
|
|
616
629
|
/** A platform's template, its --target files and MCP's overlay, as they always were. */
|
|
@@ -656,8 +669,10 @@ async function pickParts(c: ComposeFlags, mcpFlag: boolean | undefined) {
|
|
|
656
669
|
: api && (mcpFlag ?? (await askMcp()))
|
|
657
670
|
const chosen = [...base.filter((p) => !c.without.includes(p)), ...c.with, ...(mcp ? ["mcp"] : [])]
|
|
658
671
|
const { parts, added } = resolveParts([...new Set(chosen)], c.without)
|
|
659
|
-
for (const p of parts)
|
|
672
|
+
for (const p of parts) {
|
|
660
673
|
if (PARTS[p].apiOnly && !api) throw new Error(`${p} needs the API: drop --ui, or ${p}.`)
|
|
674
|
+
if (PARTS[p].webOnly && !web) throw new Error(`${p} is web only: drop --api, or ${p}.`)
|
|
675
|
+
}
|
|
661
676
|
return { parts, added, web, api, starter }
|
|
662
677
|
}
|
|
663
678
|
|
|
@@ -715,7 +730,8 @@ async function main() {
|
|
|
715
730
|
;({ theme, template } = described)
|
|
716
731
|
checkCombo(template, theme, parsed.targetGiven, flags.mcp)
|
|
717
732
|
}
|
|
718
|
-
|
|
733
|
+
const picking = parsed.pick && process.stdin.isTTY
|
|
734
|
+
if (picking) {
|
|
719
735
|
const what = await askWhat()
|
|
720
736
|
if ((PLATFORMS as readonly string[]).includes(what)) template = what as Platform
|
|
721
737
|
else {
|
|
@@ -850,6 +866,8 @@ async function main() {
|
|
|
850
866
|
await writeFile(join(dest, "AGENTS.md"), renderAgents(appName, described, runner))
|
|
851
867
|
}
|
|
852
868
|
const steps = `cd ${name}\n ${install}\n ${run} dev`
|
|
869
|
+
// Closes the picker's frame; the next steps below are printed as they always were.
|
|
870
|
+
if (picking) outro(`Scaffolded ${appName}.`)
|
|
853
871
|
console.log(
|
|
854
872
|
template === "cli"
|
|
855
873
|
? `
|