create-signet-app 0.7.0 → 0.8.1

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
  | --- | --- |
@@ -77,7 +84,7 @@ bunx create-signet-app my-app --starter saas --with ai # a starter, plus a
77
84
  | `saas` | account, orgs, admin, notifications, privacy, payments |
78
85
  | `launch` | account, privacy, growth (waitlist, invites, referrals, feedback) |
79
86
  | `internal-tool` | account, orgs, admin, workflows |
80
- | `api` | account, payments; the API half only |
87
+ | `api-billing` | account, payments; the API half only (`--starter api` still works) |
81
88
  | `ai-app` | account, privacy, payments, ai |
82
89
  | `paywall` | account, payments, paywalls |
83
90
  | `automation` | account, notifications, workflows |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-signet-app",
3
- "version": "0.7.0",
3
+ "version": "0.8.1",
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": {
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
- api: {
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 { createInterface } from "node:readline/promises"
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,23 @@ import {
28
38
  type StarterName,
29
39
  } from "./compose.js"
30
40
  import { appId, DESKTOP_PKG } from "./desktop.js"
41
+ import {
42
+ choose,
43
+ command,
44
+ type Mix,
45
+ mixRows,
46
+ nameError,
47
+ PLATFORMS,
48
+ type Platform,
49
+ partRows,
50
+ summary,
51
+ THEME_LABELS,
52
+ ticked,
53
+ WHAT,
54
+ } from "./picker.js"
31
55
 
32
56
  const THEMES = ["editorial", "cinematic", "finance"] as const
33
57
  type Theme = (typeof THEMES)[number]
34
- const PLATFORMS = ["web", "api", "cli", "extension", "desktop"] as const
35
- type Platform = (typeof PLATFORMS)[number]
36
58
  // --template is the old name for --platform, kept working; its `full` is now `--starter full`.
37
59
  const TEMPLATES = [...PLATFORMS, "full"] as const
38
60
  type Template = (typeof TEMPLATES)[number]
@@ -373,7 +395,8 @@ function parseArgs(argv: string[]) {
373
395
  throw new Error("--platform and --template are the same flag; give one.")
374
396
  template = templateGiven = v as Template
375
397
  } else if (a === "--starter") {
376
- const v = args[++i]
398
+ // `api` was api-billing's name until the picker listed it beside the api platform.
399
+ const v = args[++i] === "api" ? "api-billing" : args[i]
377
400
  if (!STARTER_NAMES.includes(v as StarterName)) {
378
401
  throw new Error(`Unknown starter "${v}". Available: ${STARTER_NAMES.join(", ")}`)
379
402
  }
@@ -473,7 +496,9 @@ Examples:
473
496
  }
474
497
  }
475
498
 
476
- if (!name) throw new Error("Missing target directory.\nUsage: create-signet-app <directory>")
499
+ // On a terminal a missing name is asked for (askName); elsewhere it is an error.
500
+ if (!name && !process.stdin.isTTY)
501
+ throw new Error("Missing target directory.\nUsage: create-signet-app <directory>")
477
502
  const composing =
478
503
  composeFlags.starter ||
479
504
  composeFlags.ui ||
@@ -517,6 +542,7 @@ Examples:
517
542
  mcp,
518
543
  pm: pm ?? detectPm(),
519
544
  composeFlags,
545
+ themeGiven,
520
546
  // Nothing said what to build: asked on a terminal, else the web platform.
521
547
  pick: !templateGiven && !composing,
522
548
  }
@@ -573,44 +599,85 @@ async function substitute(dir: string, vars: Record<string, string>) {
573
599
  }
574
600
  }
575
601
 
576
- /** "What are you building?": a platform or a starter, by number or name; default web. */
577
- async function askWhat(): Promise<Platform | StarterName> {
578
- const choices = [...PLATFORMS, ...STARTER_NAMES.map((s) => `starter ${s}`)]
579
- const lines = [
580
- ...PLATFORMS.map((p) => p),
581
- ...STARTER_NAMES.map((s) => `${s.padEnd(14)}${STARTERS[s].description}`),
582
- ]
583
- console.log(
584
- `\n What are you building?\n${lines.map((l, i) => ` ${String(i + 1).padStart(3)}. ${l}`).join("\n")}`,
602
+ /** Ctrl+C at a prompt: say so and leave without scaffolding. */
603
+ function cancelled(): never {
604
+ cancel("Cancelled.")
605
+ process.exit(130)
606
+ }
607
+
608
+ /** A prompt's answer, or Ctrl+C's exit. */
609
+ function ask<T>(answer: T): Exclude<T, symbol> {
610
+ if (isCancel(answer)) cancelled()
611
+ return answer as Exclude<T, symbol>
612
+ }
613
+
614
+ /** The directory name, when it was not given; only asked on a terminal. */
615
+ async function askName(): Promise<string> {
616
+ const name = ask(
617
+ await text({
618
+ message: "Project name?",
619
+ placeholder: "my-app",
620
+ defaultValue: "my-app",
621
+ validate: (v) => nameError(v, process.cwd()),
622
+ }),
585
623
  )
586
- const rl = createInterface({ input: process.stdin, output: process.stdout })
587
- try {
588
- for (;;) {
589
- const a = (await rl.question(" Number or name (web): ")).trim().toLowerCase()
590
- if (a === "") return "web"
591
- const n = Number(a)
592
- const pick =
593
- Number.isInteger(n) && n >= 1
594
- ? choices[n - 1]
595
- : choices.find((c) => c === a || c === `starter ${a}`)
596
- if (pick) return pick.replace(/^starter /, "") as Platform | StarterName
597
- console.log(` Not one of these: ${a}`)
598
- }
599
- } finally {
600
- rl.close()
624
+ return name.trim() || "my-app"
625
+ }
626
+
627
+ /**
628
+ * The picker: what you are building; for web and api, a ready-made mix and
629
+ * its features (ticked, to adjust); the theme where there is a web UI; MCP
630
+ * where there is an API. Rows and the mapping to flags are in src/picker.ts.
631
+ */
632
+ async function askWhat(themeGiven?: Theme) {
633
+ const what = ask(
634
+ await select<Platform>({
635
+ message: "What are you building?",
636
+ initialValue: "web",
637
+ options: WHAT,
638
+ }),
639
+ )
640
+ let choice = choose(what)
641
+ let ticks: PartName[] = []
642
+ if (what === "web" || what === "api") {
643
+ const mix = ask(
644
+ await select<Mix>({ message: "Start from", initialValue: "basics", options: mixRows(what) }),
645
+ )
646
+ ticks = ask(
647
+ await multiselect<PartName>({
648
+ message: "Features (change any, Enter to accept)",
649
+ options: partRows(what),
650
+ initialValues: ticked(mix),
651
+ required: false,
652
+ }),
653
+ )
654
+ choice = choose(what, mix, ticks)
601
655
  }
656
+ // A web app's every answer has a web UI; an API's and a CLI's none.
657
+ const ui = what !== "api" && what !== "cli"
658
+ const theme =
659
+ ui && !themeGiven
660
+ ? ask(
661
+ await select<Theme>({
662
+ message: "Theme",
663
+ initialValue: "editorial",
664
+ options: THEMES.map((t) => ({ value: t, label: THEME_LABELS[t] ?? t })),
665
+ }),
666
+ )
667
+ : themeGiven
668
+ const mcp = choice.template === "api" || choice.template === "full" ? await askMcp() : undefined
669
+ return { what, choice, ticks, theme: ui ? theme : undefined, mcp }
602
670
  }
603
671
 
604
- /** "Add MCP for agents?", default yes; only asked on a terminal. */
672
+ /** "Let AI coding agents work with this app?", default yes; only asked on a terminal. */
605
673
  async function askMcp(): Promise<boolean> {
606
674
  if (!process.stdin.isTTY) return true
607
- const rl = createInterface({ input: process.stdin, output: process.stdout })
608
- try {
609
- const answer = (await rl.question(" Add MCP for agents? (Y/n) ")).trim().toLowerCase()
610
- return answer === "" || answer.startsWith("y")
611
- } finally {
612
- rl.close()
613
- }
675
+ return ask(
676
+ await confirm({
677
+ message: "Let AI coding agents work with this app? (adds an MCP server)",
678
+ initialValue: true,
679
+ }),
680
+ )
614
681
  }
615
682
 
616
683
  /** A platform's template, its --target files and MCP's overlay, as they always were. */
@@ -701,8 +768,12 @@ function composedMessage(
701
768
 
702
769
  async function main() {
703
770
  const parsed = parseArgs(process.argv)
704
- const { name, target, pm, ...flags } = parsed
771
+ const { target, pm, ...flags } = parsed
705
772
  let { theme, template } = parsed
773
+ // On a terminal, a missing name or a missing platform is asked for, in one frame.
774
+ const asking = process.stdin.isTTY && (parsed.pick || !parsed.name)
775
+ if (asking) intro("create-signet-app")
776
+ const name = parsed.name ?? (await askName())
706
777
  const dest = resolve(process.cwd(), name)
707
778
  const appName = basename(dest)
708
779
 
@@ -717,13 +788,26 @@ async function main() {
717
788
  ;({ theme, template } = described)
718
789
  checkCombo(template, theme, parsed.targetGiven, flags.mcp)
719
790
  }
720
- if (parsed.pick && process.stdin.isTTY) {
721
- const what = await askWhat()
722
- if ((PLATFORMS as readonly string[]).includes(what)) template = what as Platform
723
- else {
724
- template = "full"
725
- parsed.composeFlags.starter = what as StarterName
726
- }
791
+ const picking = parsed.pick && process.stdin.isTTY
792
+ if (picking) {
793
+ const { what, choice, ticks, theme: picked, mcp } = await askWhat(parsed.themeGiven)
794
+ template = choice.template
795
+ const c = parsed.composeFlags
796
+ c.starter = choice.starter
797
+ c.api = choice.api ?? false
798
+ c.with = choice.with ?? []
799
+ if (picked) theme = picked
800
+ flags.mcp = mcp
801
+ const runner = `${pm === "bun" ? "bunx" : "npx"} create-signet-app`
802
+ note(
803
+ [
804
+ ...summary(what, choice, ticks, picked, mcp),
805
+ "",
806
+ "Same as:",
807
+ command(runner, name, choice, picked, mcp),
808
+ ].join("\n"),
809
+ `Creating ${appName}`,
810
+ )
727
811
  }
728
812
  if (parsed.pm === "deno" && template === "cli")
729
813
  throw new Error(
@@ -852,6 +936,8 @@ async function main() {
852
936
  await writeFile(join(dest, "AGENTS.md"), renderAgents(appName, described, runner))
853
937
  }
854
938
  const steps = `cd ${name}\n ${install}\n ${run} dev`
939
+ // Closes the picker's frame; the next steps below are printed as they always were.
940
+ if (asking) outro(`Scaffolded ${appName}.`)
855
941
  console.log(
856
942
  template === "cli"
857
943
  ? `
package/src/picker.ts ADDED
@@ -0,0 +1,179 @@
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
+ /** Why a typed project name can't be used, or undefined; empty is the default, my-app. */
166
+ export function nameError(typed: string | undefined, cwd: string): string | undefined {
167
+ const name = typed?.trim() || "my-app"
168
+ if (name.startsWith("-")) return "A name can't start with -."
169
+ const dest = resolve(cwd, name)
170
+ if (existsSync(dest) && readdirSync(dest).length > 0)
171
+ return `${name} already exists and is not empty.`
172
+ }
173
+
174
+ /** The theme rows' explanations; a theme missing here shows its name alone. */
175
+ export const THEME_LABELS: Record<string, string> = {
176
+ editorial: "Editorial — warm paper, ink text, green",
177
+ cinematic: "Cinematic — cool neutrals, violet accent",
178
+ finance: "Finance — editorial plus money colours",
179
+ }