create-signet-app 0.8.0 → 0.8.2

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
@@ -68,7 +68,14 @@ bunx create-signet-app my-app --starter saas --with ai # a starter, plus a
68
68
  is the default).
69
69
  - **Starters** are named mixes of parts, by the shape of app. `--with` adds to
70
70
  the starter, `--without` takes away; `--without` alone starts from `full`.
71
- Run with no flags on a terminal to pick a platform or starter from a list.
71
+ Run with no flags on a terminal and it asks in plain words: the name (if not
72
+ given), what you are building (web app, API only, command-line tool, browser
73
+ extension, desktop app), then for a web app or an API a mix to start from
74
+ (just the basics, a starter, or everything) and its features, ticked so you
75
+ can add or remove any. Ticks that equal a starter are `--starter`, anything
76
+ else is `--with`. Then the theme (where there is a web UI) and MCP (where
77
+ there is an API). Before creating it shows a summary and the one-line
78
+ command that builds the same app.
72
79
 
73
80
  | starter | parts (plus what they need) |
74
81
  | --- | --- |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-signet-app",
3
- "version": "0.8.0",
3
+ "version": "0.8.2",
4
4
  "license": "MIT",
5
5
  "description": "Scaffold a Vite + React + Tailwind app wired to Signet.",
6
6
  "keywords": [
package/src/compose.ts CHANGED
@@ -99,51 +99,70 @@ export const PARTS: Record<PartName, Part> = {
99
99
  * brings orgs, everything brings auth). `surface: "api"` is the API half only.
100
100
  * MCP is not listed: it is asked for (or --mcp / --no-mcp), as it always was.
101
101
  * Each description is one line, quoted, first: signet-mcp's index reads it.
102
+ * The label is the picker's row, in words for someone who knows none of the
103
+ * part names; at most 44 characters, or clack wraps the row at 60 columns.
102
104
  */
103
105
  export const STARTERS = {
104
106
  full: {
105
107
  description: "every part, web + API",
108
+ label: "Everything — every feature",
106
109
  parts: PART_NAMES.filter((p) => !["mcp", "dashboard", "pwa"].includes(p)),
107
110
  },
108
- blank: { description: "no parts: the shell, the API and the database", parts: [] },
111
+ blank: {
112
+ description: "no parts: the shell, the API and the database",
113
+ label: "Empty shell — site, server and database",
114
+ parts: [],
115
+ },
109
116
  saas: {
110
117
  description: "a paid team product: orgs, admin, billing, inbox, account, privacy",
118
+ label: "SaaS — teams, billing, admin, notifications",
111
119
  parts: ["account", "orgs", "admin", "notifications", "privacy", "payments"],
112
120
  },
113
121
  launch: {
114
122
  description: "before launch: sign-in, waitlist, invites, referrals, feedback, privacy",
123
+ label: "Pre-launch — waitlist, invites, feedback",
115
124
  parts: ["account", "privacy", "growth"],
116
125
  },
117
126
  "internal-tool": {
118
127
  description: "for your own team: orgs and roles, the admin panel, approval workflows",
128
+ label: "Internal tool — roles, admin, approvals",
119
129
  parts: ["account", "orgs", "admin", "workflows"],
120
130
  },
121
131
  "api-billing": {
122
132
  description: "the API half only: sign-in, API keys, billing webhooks",
133
+ label: "Sign-in + billing — accounts, API keys",
123
134
  parts: ["account", "payments"],
124
135
  surface: "api",
125
136
  },
126
137
  "ai-app": {
127
138
  description: "an AI product: spend caps per user, billing, account, privacy",
139
+ label: "AI product — per-user spend limits, billing",
128
140
  parts: ["account", "privacy", "payments", "ai"],
129
141
  },
130
142
  paywall: {
131
143
  description: "sell access: plans, entitlements, billing, remote paywalls",
144
+ label: "Paid access — plans, billing, paywalls",
132
145
  parts: ["account", "payments", "paywalls"],
133
146
  },
134
147
  automation: {
135
148
  description: "durable workflows with approvals, and an inbox to tell people",
149
+ label: "Automations — jobs, approvals, alerts",
136
150
  parts: ["account", "notifications", "workflows"],
137
151
  },
138
152
  dashboard: {
139
153
  description: "a sidebar shell and an overview: stat tiles, a chart, a table",
154
+ label: "Dashboard — sidebar, stats, a chart, a table",
140
155
  parts: ["account", "dashboard"],
141
156
  },
142
157
  pwa: {
143
158
  description: "installable and offline: web manifest, service worker, install prompt",
159
+ label: "Installable app — works offline",
144
160
  parts: ["account", "pwa"],
145
161
  },
146
- } satisfies Record<string, { description: string; parts: PartName[]; surface?: "api" }>
162
+ } satisfies Record<
163
+ string,
164
+ { description: string; label: string; parts: PartName[]; surface?: "api" }
165
+ >
147
166
  export type StarterName = keyof typeof STARTERS
148
167
 
149
168
  /**
package/src/index.ts CHANGED
@@ -13,7 +13,17 @@
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 { cancel, confirm, intro, isCancel, outro, select } from "@clack/prompts"
16
+ import {
17
+ cancel,
18
+ confirm,
19
+ intro,
20
+ isCancel,
21
+ multiselect,
22
+ note,
23
+ outro,
24
+ select,
25
+ text,
26
+ } from "@clack/prompts"
17
27
  import {
18
28
  applyBlocks,
19
29
  type BaseDeps,
@@ -28,11 +38,26 @@ import {
28
38
  type StarterName,
29
39
  } from "./compose.js"
30
40
  import { appId, DESKTOP_PKG } from "./desktop.js"
41
+ import {
42
+ answer,
43
+ choose,
44
+ command,
45
+ hasApi,
46
+ hasUi,
47
+ type Mix,
48
+ mixRows,
49
+ nameError,
50
+ PLATFORMS,
51
+ type Platform,
52
+ partRows,
53
+ summary,
54
+ THEME_LABELS,
55
+ ticked,
56
+ WHAT,
57
+ } from "./picker.js"
31
58
 
32
59
  const THEMES = ["editorial", "cinematic", "finance"] as const
33
60
  type Theme = (typeof THEMES)[number]
34
- const PLATFORMS = ["web", "api", "cli", "extension", "desktop"] as const
35
- type Platform = (typeof PLATFORMS)[number]
36
61
  // --template is the old name for --platform, kept working; its `full` is now `--starter full`.
37
62
  const TEMPLATES = [...PLATFORMS, "full"] as const
38
63
  type Template = (typeof TEMPLATES)[number]
@@ -474,7 +499,9 @@ Examples:
474
499
  }
475
500
  }
476
501
 
477
- if (!name) throw new Error("Missing target directory.\nUsage: create-signet-app <directory>")
502
+ // On a terminal a missing name is asked for (askName); elsewhere it is an error.
503
+ if (!name && !process.stdin.isTTY)
504
+ throw new Error("Missing target directory.\nUsage: create-signet-app <directory>")
478
505
  const composing =
479
506
  composeFlags.starter ||
480
507
  composeFlags.ui ||
@@ -508,7 +535,10 @@ Examples:
508
535
  describe: { sentence: describe, template: templateGiven, theme: themeGiven },
509
536
  }
510
537
  }
511
- checkCombo(template, theme, target, mcp, composeFlags)
538
+ // Nothing said what to build: asked on a terminal, else the web platform.
539
+ const pick = !templateGiven && !composing
540
+ // When the picker will run, --mcp / --no-mcp is checked against what it picks (main).
541
+ checkCombo(template, theme, target, pick && process.stdin.isTTY ? undefined : mcp, composeFlags)
512
542
  return {
513
543
  name,
514
544
  theme,
@@ -518,8 +548,8 @@ Examples:
518
548
  mcp,
519
549
  pm: pm ?? detectPm(),
520
550
  composeFlags,
521
- // Nothing said what to build: asked on a terminal, else the web platform.
522
- pick: !templateGiven && !composing,
551
+ themeGiven,
552
+ pick,
523
553
  }
524
554
  }
525
555
 
@@ -574,56 +604,83 @@ async function substitute(dir: string, vars: Record<string, string>) {
574
604
  }
575
605
  }
576
606
 
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
607
  /** Ctrl+C at a prompt: say so and leave without scaffolding. */
587
608
  function cancelled(): never {
588
609
  cancel("Cancelled.")
589
610
  process.exit(130)
590
611
  }
591
612
 
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,
602
- }
613
+ /** A prompt's answer, or Ctrl+C's exit. */
614
+ function ask<T>(answer: T): Exclude<T, symbol> {
615
+ if (isCancel(answer)) cancelled()
616
+ return answer as Exclude<T, symbol>
603
617
  }
604
618
 
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
+ /** The directory name, when it was not given; only asked on a terminal. */
620
+ async function askName(): Promise<string> {
621
+ const name = ask(
622
+ await text({
623
+ message: "Project name?",
624
+ placeholder: "my-app",
625
+ defaultValue: "my-app",
626
+ validate: (v) => nameError(v, process.cwd()),
627
+ }),
628
+ )
629
+ return name.trim() || "my-app"
630
+ }
631
+
632
+ /**
633
+ * The picker: what you are building; for web and api, a ready-made mix and
634
+ * its features (ticked, to adjust); the theme where there is a web UI; MCP
635
+ * where there is an API. Rows and the mapping to flags are in src/picker.ts.
636
+ */
637
+ async function askWhat(themeGiven?: Theme, mcpGiven?: boolean) {
638
+ const what = ask(
639
+ await select<Platform>({
640
+ message: "What are you building?",
641
+ initialValue: "web",
642
+ options: WHAT,
643
+ }),
644
+ )
645
+ let choice = choose(what)
646
+ let ticks: PartName[] = []
647
+ if (what === "web" || what === "api") {
648
+ const mix = ask(
649
+ await select<Mix>({ message: "Start from", initialValue: "basics", options: mixRows(what) }),
650
+ )
651
+ ticks = ask(
652
+ await multiselect<PartName>({
653
+ message: "Features (change any, Enter to accept)",
654
+ options: partRows(what),
655
+ initialValues: ticked(mix),
656
+ required: false,
657
+ }),
658
+ )
659
+ choice = choose(what, mix, ticks)
660
+ }
661
+ // A flag that already answered a question keeps its value; it is not asked.
662
+ const theme = await answer(hasUi(what), themeGiven, async () =>
663
+ ask(
664
+ await select<Theme>({
665
+ message: "Theme",
666
+ initialValue: "editorial",
667
+ options: THEMES.map((t) => ({ value: t, label: THEME_LABELS[t] ?? t })),
668
+ }),
669
+ ),
670
+ )
671
+ const mcp = await answer(hasApi(choice), mcpGiven, askMcp)
672
+ return { what, choice, ticks, theme, mcp }
619
673
  }
620
674
 
621
- /** "Add MCP for agents?", default yes; only asked on a terminal. */
675
+ /** "Let AI coding agents work with this app?", default yes; only asked on a terminal. */
622
676
  async function askMcp(): Promise<boolean> {
623
677
  if (!process.stdin.isTTY) return true
624
- const yes = await confirm({ message: "Add MCP for agents?", initialValue: true })
625
- if (isCancel(yes)) cancelled()
626
- return yes
678
+ return ask(
679
+ await confirm({
680
+ message: "Let AI coding agents work with this app? (adds an MCP server)",
681
+ initialValue: true,
682
+ }),
683
+ )
627
684
  }
628
685
 
629
686
  /** A platform's template, its --target files and MCP's overlay, as they always were. */
@@ -714,8 +771,12 @@ function composedMessage(
714
771
 
715
772
  async function main() {
716
773
  const parsed = parseArgs(process.argv)
717
- const { name, target, pm, ...flags } = parsed
774
+ const { target, pm, ...flags } = parsed
718
775
  let { theme, template } = parsed
776
+ // On a terminal, a missing name or a missing platform is asked for, in one frame.
777
+ const asking = process.stdin.isTTY && (parsed.pick || !parsed.name)
778
+ if (asking) intro("create-signet-app")
779
+ const name = parsed.name ?? (await askName())
719
780
  const dest = resolve(process.cwd(), name)
720
781
  const appName = basename(dest)
721
782
 
@@ -732,12 +793,27 @@ async function main() {
732
793
  }
733
794
  const picking = parsed.pick && process.stdin.isTTY
734
795
  if (picking) {
735
- const what = await askWhat()
736
- if ((PLATFORMS as readonly string[]).includes(what)) template = what as Platform
737
- else {
738
- template = "full"
739
- parsed.composeFlags.starter = what as StarterName
740
- }
796
+ const { what, choice, ticks, theme: picked, mcp } = await askWhat(parsed.themeGiven, flags.mcp)
797
+ template = choice.template
798
+ const c = parsed.composeFlags
799
+ c.starter = choice.starter
800
+ c.api = choice.api ?? false
801
+ c.with = choice.with ?? []
802
+ if (picked) theme = picked
803
+ // Set only when the picker asked (or kept the flag); a flag is never cleared.
804
+ if (mcp !== undefined) flags.mcp = mcp
805
+ // The flags' combinations, checked now that the platform is known (parseArgs left MCP to here).
806
+ checkCombo(template, theme, parsed.targetGiven, flags.mcp, c)
807
+ const runner = `${pm === "bun" ? "bunx" : "npx"} create-signet-app`
808
+ note(
809
+ [
810
+ ...summary(what, choice, ticks, picked, mcp),
811
+ "",
812
+ "Same as:",
813
+ command(runner, name, choice, picked, mcp),
814
+ ].join("\n"),
815
+ `Creating ${appName}`,
816
+ )
741
817
  }
742
818
  if (parsed.pm === "deno" && template === "cli")
743
819
  throw new Error(
@@ -867,7 +943,7 @@ async function main() {
867
943
  }
868
944
  const steps = `cd ${name}\n ${install}\n ${run} dev`
869
945
  // Closes the picker's frame; the next steps below are printed as they always were.
870
- if (picking) outro(`Scaffolded ${appName}.`)
946
+ if (asking) outro(`Scaffolded ${appName}.`)
871
947
  console.log(
872
948
  template === "cli"
873
949
  ? `
package/src/picker.ts ADDED
@@ -0,0 +1,197 @@
1
+ /**
2
+ * The picker's rows and what the answers scaffold, apart from the prompts so
3
+ * the mapping is tested without a terminal. Step 1 picks a platform; for web
4
+ * and api, "Start from" picks a ready-made mix and "Features" ticks its parts,
5
+ * which the user adjusts. Every row is one plain-language line, explanation
6
+ * included: clack shows a hint only on the highlighted row. Each label is at
7
+ * most 44 characters, or clack wraps the row at 60 columns.
8
+ */
9
+
10
+ import { existsSync, readdirSync } from "node:fs"
11
+ import { resolve } from "node:path"
12
+ import {
13
+ PART_NAMES,
14
+ PARTS,
15
+ type PartName,
16
+ resolveParts,
17
+ STARTERS,
18
+ type StarterName,
19
+ } from "./compose.js"
20
+
21
+ export const PLATFORMS = ["web", "api", "cli", "extension", "desktop"] as const
22
+ export type Platform = (typeof PLATFORMS)[number]
23
+
24
+ export const WHAT: { value: Platform; label: string }[] = [
25
+ { value: "web", label: "Web app — a site people open in a browser" },
26
+ { value: "api", label: "API only — a server other apps talk to" },
27
+ { value: "cli", label: "Command-line tool — runs in a terminal" },
28
+ { value: "extension", label: "Browser extension — a Chrome add-on" },
29
+ { value: "desktop", label: "Desktop app — Mac, Windows and Linux" },
30
+ ]
31
+
32
+ /** "Start from": the platform alone, or a starter. */
33
+ export type Mix = "basics" | StarterName
34
+
35
+ const STARTER_NAMES = Object.keys(STARTERS) as StarterName[]
36
+ const apiStarter = (s: StarterName) => "surface" in STARTERS[s]
37
+
38
+ /** The starters offered on a path: the API ones for api, the rest for web; full on both, last. */
39
+ function startersFor(what: "web" | "api"): StarterName[] {
40
+ const ends: StarterName[] = what === "web" ? ["blank", "full"] : ["full"]
41
+ const rest = STARTER_NAMES.filter((s) => !ends.includes(s) && (what === "api") === apiStarter(s))
42
+ return [...rest, ...ends]
43
+ }
44
+
45
+ /** "Start from" rows: the basics first, the starters, everything last. */
46
+ export function mixRows(what: "web" | "api"): { value: Mix; label: string }[] {
47
+ return [
48
+ {
49
+ value: "basics",
50
+ label:
51
+ what === "api"
52
+ ? "Just the basics — a plain API, no extras"
53
+ : "Just the basics — a themed site, no server",
54
+ },
55
+ ...startersFor(what).map((s) => ({ value: s, label: STARTERS[s].label })),
56
+ ]
57
+ }
58
+
59
+ /** Every part but mcp, which is its own question. */
60
+ const PART_LABELS: Record<Exclude<PartName, "mcp">, string> = {
61
+ auth: "Sign-in — log in with a phone code",
62
+ account: "Account page — profile, devices, API keys",
63
+ orgs: "Teams & roles — members and invite links",
64
+ admin: "Admin panel",
65
+ notifications: "Notifications — inbox and preferences",
66
+ privacy: "Privacy — consent, data export and deletion",
67
+ payments: "Billing — plans and payments",
68
+ paywalls: "Paywalls — offers shown per audience",
69
+ growth: "Growth — waitlist, referrals, feedback",
70
+ ai: "AI with spend limits",
71
+ workflows: "Approvals — multi-step jobs people sign off",
72
+ dashboard: "Dashboard — sidebar, stats, a chart, a table",
73
+ pwa: "Installable — works offline",
74
+ }
75
+ const partLabel = (p: PartName) => PART_LABELS[p as Exclude<PartName, "mcp">]
76
+
77
+ /** "Features" rows; the API path leaves out the web-only parts. */
78
+ export function partRows(what: "web" | "api"): { value: PartName; label: string }[] {
79
+ return PART_NAMES.filter((p) => p !== "mcp" && !(what === "api" && PARTS[p].webOnly)).map(
80
+ (p) => ({ value: p, label: partLabel(p) }),
81
+ )
82
+ }
83
+
84
+ /** Parts plus everything they need, as compose installs them. */
85
+ const installed = (parts: readonly PartName[]) => resolveParts([...parts], []).parts
86
+
87
+ /** The parts already ticked for a mix: the starter's own and what they need. */
88
+ export function ticked(mix: Mix): PartName[] {
89
+ return mix === "basics" ? [] : installed(STARTERS[mix].parts)
90
+ }
91
+
92
+ export type Choice = {
93
+ template: Platform | "full"
94
+ starter?: StarterName
95
+ api?: true
96
+ with?: PartName[]
97
+ }
98
+
99
+ const same = (a: readonly string[], b: readonly string[]) =>
100
+ a.length === b.length && a.every((x) => b.includes(x))
101
+
102
+ /**
103
+ * What the answers scaffold, as flags say it. Ticks that install the same
104
+ * parts as a starter on this path (needs counted on both sides) are
105
+ * `--starter <name>`, the chosen mix first; any other ticks are
106
+ * `--with`, plus `--api` on the API path. Nothing ticked from the basics, or
107
+ * nothing that matches a starter, is the platform alone.
108
+ */
109
+ export function choose(what: Platform, mix: Mix = "basics", ticks: PartName[] = []): Choice {
110
+ if (what !== "web" && what !== "api") return { template: what }
111
+ if (mix === "basics" && !ticks.length) return { template: what }
112
+ const api = what === "api" ? ({ api: true } as const) : {}
113
+ const order = mix === "basics" ? startersFor(what) : [mix, ...startersFor(what)]
114
+ const starter = order.find((s) => same(installed(STARTERS[s].parts), installed(ticks)))
115
+ if (starter) return { template: "full", starter, ...(apiStarter(starter) ? {} : api) }
116
+ if (!ticks.length) return { template: what }
117
+ return { template: "full", with: ticks, ...api }
118
+ }
119
+
120
+ /** The one-line command that scaffolds the same app, so the picker teaches the flags. */
121
+ export function command(
122
+ runner: string,
123
+ name: string,
124
+ c: Choice,
125
+ theme?: string,
126
+ mcp?: boolean,
127
+ ): string {
128
+ return [
129
+ runner,
130
+ name,
131
+ ...(c.template !== "web" && c.template !== "full" ? ["--platform", c.template] : []),
132
+ ...(c.starter ? ["--starter", c.starter] : []),
133
+ ...(c.with ? ["--with", c.with.join(",")] : []),
134
+ ...(c.api ? ["--api"] : []),
135
+ ...(theme && theme !== "editorial" ? ["--theme", theme] : []),
136
+ ...(mcp === undefined ? [] : [mcp ? "--mcp" : "--no-mcp"]),
137
+ ].join(" ")
138
+ }
139
+
140
+ /** The summary shown before creating: what, which mix, the parts installed (needs too), theme, MCP. */
141
+ export function summary(
142
+ what: Platform,
143
+ c: Choice,
144
+ ticks: PartName[],
145
+ theme?: string,
146
+ mcp?: boolean,
147
+ ): string[] {
148
+ const short = (label: string) => label.split(" — ")[0]
149
+ const parts = installed(ticks)
150
+ return [
151
+ what === "web"
152
+ ? c.template === "full"
153
+ ? "Web app (site + server)"
154
+ : "Web app"
155
+ : short(WHAT.find((w) => w.value === what)?.label ?? what),
156
+ ...(c.starter ? [`Starter: ${STARTERS[c.starter].label}`] : []),
157
+ ...(c.template === "full"
158
+ ? [`Features: ${parts.length ? parts.map((p) => short(partLabel(p))).join(", ") : "none"}`]
159
+ : []),
160
+ ...(theme ? [`Theme: ${theme}`] : []),
161
+ ...(mcp === undefined ? [] : [`AI coding agents (MCP): ${mcp ? "yes" : "no"}`]),
162
+ ]
163
+ }
164
+
165
+ /**
166
+ * A question the picker asks only where it applies and only when no flag
167
+ * answered it: the flag's value is kept, never overwritten. Undefined where
168
+ * it does not apply (a flag given there is left for checkCombo to refuse).
169
+ */
170
+ export async function answer<T>(
171
+ applies: boolean,
172
+ given: T | undefined,
173
+ ask: () => Promise<T>,
174
+ ): Promise<T | undefined> {
175
+ if (!applies) return undefined
176
+ return given ?? ask()
177
+ }
178
+
179
+ /** MCP applies where there is an API; the theme where there is a web UI. */
180
+ export const hasApi = (c: Choice) => c.template === "api" || c.template === "full"
181
+ export const hasUi = (what: Platform) => what !== "api" && what !== "cli"
182
+
183
+ /** Why a typed project name can't be used, or undefined; empty is the default, my-app. */
184
+ export function nameError(typed: string | undefined, cwd: string): string | undefined {
185
+ const name = typed?.trim() || "my-app"
186
+ if (name.startsWith("-")) return "A name can't start with -."
187
+ const dest = resolve(cwd, name)
188
+ if (existsSync(dest) && readdirSync(dest).length > 0)
189
+ return `${name} already exists and is not empty.`
190
+ }
191
+
192
+ /** The theme rows' explanations; a theme missing here shows its name alone. */
193
+ export const THEME_LABELS: Record<string, string> = {
194
+ editorial: "Editorial — warm paper, ink text, green",
195
+ cinematic: "Cinematic — cool neutrals, violet accent",
196
+ finance: "Finance — editorial plus money colours",
197
+ }