@agent-native/core 0.63.4 → 0.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,33 +1,8 @@
1
1
  # Agent-Native
2
2
 
3
- ### Open-source framework for agentic applications you own.
4
-
5
- Don't choose between rich user interfaces and autonomous agents. Every Agent-Native app is both.
6
-
7
- ## Agents and UIs — Fully Connected
8
-
9
- The agent and the UI are equal citizens of the same system. Every action works both ways — click it or ask for it.
10
-
11
- ![Agents and UIs fully connected](https://cdn.builder.io/api/v1/file/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fadc1e9e9368e4a8cb1b4dbb5aae5aaa2)
12
-
13
- - **Everything syncs** — Agent and UI share one database and one state. Changes from either side show up instantly on the other.
14
- - **Real-time multiplayer** — Humans and agents collaborate in the same document simultaneously: CRDT merging, live presence (cursors, selection rings, who's on which slide), and the agent as a first-class peer editor. Works on any SQL database and any host, including serverless.
15
- - **Context-aware** — The agent knows what you're looking at. Select text, hit Cmd+I, and tell it what to do.
16
- - **Per-user workspace** — Skills, memory, instructions, sub-agents, and MCP servers — SQL-backed, customizable per user. Claude-Code-level flexibility, SaaS-grade economics.
17
- - **Agents call agents** — Tag another agent from any app. They discover each other over A2A and take action across your stack.
18
- - **Reusable integrations** — Connect a provider once in Dispatch, keep secret values in the vault, then grant apps like Brain, Analytics, Mail, and Dispatch access to the shared account metadata and credential refs.
19
- - **Three shapes** — Build the same agent as a headless API, a rich chat experience, or a full application where agent and UI stay in sync.
20
- - **Apps that improve themselves** — Your apps get better on their own. The agent can add features, fix bugs, and refine the UI over time.
21
- - **Any database, any host** — Any SQL database Drizzle supports. Any hosting target Nitro supports. No lock-in.
22
- - **Bring the agent surface you need** — MCP-compatible hosts can call your apps, coding agents can install skills, native chat renders reusable app outputs, and BYO agent runtimes can stream into the Agent-Native chat shell.
23
-
24
3
  ## The framework for agent-native apps
25
4
 
26
- Agent-Native is an open-source framework for building robust agents that can act inside real apps, not just chat next to them.
27
-
28
- It gives you primitives for product-grade agentic software: shared actions, SQL-backed state, identity, tools, skills, jobs, observability, and UI surfaces that all work together.
29
-
30
- Backend agnostic: bring your own database, hosting provider, model stack, and app code.
5
+ Agent-Native is an open-source framework for building robust agents that act inside real apps, not just chat next to them. It gives you primitives for product-grade agentic software: shared actions, SQL-backed state, identity, tools, skills, jobs, observability, and UI surfaces that all work together. Bring your own database, hosting provider, model stack, and app code.
31
6
 
32
7
  ```ts
33
8
  // One action powers UI, agent, HTTP, MCP, A2A, and CLI.
@@ -42,44 +17,25 @@ export default defineAction({
42
17
  });
43
18
  ```
44
19
 
45
- - **Actions** Define work once. Use it from UI, agent, API, MCP, A2A, and CLI.
46
- - **Agent runtime** Chat, tools, skills, memory, jobs, observability, and handoffs ship together.
47
- - **Backend agnostic** Plug in any Drizzle-supported SQL database and Nitro-compatible host.
48
-
49
- ## One agent, three product shapes
20
+ - **Actions**: Define work once. Use it from UI, agent, API, MCP, A2A, and CLI.
21
+ - **Agent runtime**: Chat, tools, skills, memory, jobs, observability, and handoffs ship together.
22
+ - **Backend agnostic**: Plug in any Drizzle-supported SQL database and Nitro-compatible host.
50
23
 
51
- Agent-Native primitives let you choose how much UI to put around an agent without rebuilding the agent contract:
52
-
53
- | Shape | What you ship | Same primitives underneath |
54
- | ------------- | --------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------- |
55
- | **Headless** | Call the agent and actions from code, CLI, HTTP, MCP, or A2A. | `defineAction`, auth, skills, memory, jobs, observability |
56
- | **Rich chat** | A standalone or embedded chat with native tables, charts, approvals, setup flows, and tool results. | Shared chat runtime, BYO runtime adapters, action-declared native renderers |
57
- | **Whole app** | A full SaaS/product UI where chat can start central, move to the sidebar, and stay synced with app state. | SQL state, actions, context awareness, deep links, live sync |
58
-
59
- Protocols come with the framework instead of becoming separate integrations per feature. Today that means A2A, MCP, MCP Apps, standard remote MCP OAuth, MCP clients, HTTP/CLI action calls, native chat widgets, `AgentChatRuntime` adapters, standard OpenAI, AG-UI, Claude Agent SDK, and Vercel AI SDK chat runtime connectors, and deep links all hang off the same action surface. ACP is best understood as the coding-agent/editor interoperability protocol, not the general BYO app-chat runtime.
60
-
61
- For the full decision guide — headless, rich chat on the built-in agent, rich chat on your own agent, embedded sidecar, or full app — see [Agent Surfaces](https://agent-native.com/docs/agent-surfaces).
62
-
63
- To connect Claude, ChatGPT, Codex, Cursor, OpenCode, GitHub Copilot / VS Code, or another MCP host to your hosted app, see the [External Agents guide](https://agent-native.com/docs/external-agents).
64
-
65
- ## Try it with a skill
66
-
67
- Don't want to scaffold a whole app yet? Add visual planning and PR recaps to Claude Code, Codex, Cursor, Pi, OpenCode, GitHub Copilot / VS Code, and similar agents with one command:
68
-
69
- ```bash
70
- npx @agent-native/core@latest skills add visual-plan
71
- ```
24
+ ## Agents and UIs, Fully Connected
72
25
 
73
- You get two slash commands that upgrade how your agent plans and reports its work:
26
+ The agent and the UI are equal citizens of one system. Every action works both ways: click it or ask for it.
74
27
 
75
- - **`/visual-plan`** — before the agent writes code, it opens a structured, reviewable plan document instead of a wall of text: inline diagrams, UI wireframes and prototypes, file-by-file implementation maps, and annotations you can comment on and approve.
76
- - **`/visual-recap`** — after changes land, it turns a PR or git diff into a high-altitude visual recap: schema, API, and file changes rendered as grounded before/after blocks with a shareable review link, instead of scrolling a raw diff.
28
+ ![Agents and UIs fully connected](https://cdn.builder.io/api/v1/file/assets%2FYJIGb4i01jvw0SRdL5Bt%2Fadc1e9e9368e4a8cb1b4dbb5aae5aaa2)
77
29
 
78
- See the **[Skills Guide](https://agent-native.com/docs/skills-guide#app-backed-skills)** for more skills and local installs.
30
+ - **Everything syncs**: One database, one state. Changes from either side show up instantly on the other.
31
+ - **Real-time multiplayer**: Humans and agents edit the same document together, with the agent as a first-class peer.
32
+ - **Context-aware**: The agent knows what you're looking at. Select text, hit Cmd+I, and tell it what to do.
33
+ - **Agents call agents**: Tag another agent from any app and they coordinate over A2A.
34
+ - **Self-improving**: The agent can add features, fix bugs, and refine the UI over time.
79
35
 
80
36
  ## Templates
81
37
 
82
- Start with a full featured template. Each one is a complete, 100% free and open-source SaaS app cloneable, not scaffolded except you own the code and can customize everything.
38
+ Start with a full featured template. Each one is a complete, 100% free and open-source SaaS app: cloneable, not scaffolded, except you own the code and can customize everything.
83
39
 
84
40
  <table>
85
41
  <tr>
@@ -113,7 +69,7 @@ Edit local Markdown/MDX files, generate rich interactive custom blocks, and draf
113
69
 
114
70
  **Visual plan mode for coding agents**
115
71
 
116
- Install `/visual-plan` and `/visual-recap` so your coding agent can plan before it builds and recap changes after they land — high-level code reviews with diagrams, wireframes, annotations, and review links.
72
+ Install `/visual-plan` and `/visual-recap` so your coding agent can plan before it builds and recap changes after they land. High-level code reviews with diagrams, wireframes, annotations, and review links.
117
73
 
118
74
  </td>
119
75
  </tr>
@@ -137,7 +93,7 @@ Generate and edit React-based presentations via prompt or point-and-click.
137
93
 
138
94
  **Agent-Native Amplitude, Mixpanel**
139
95
 
140
- Connect analytics data sources, prompt for real charts, and build reusable dashboards. Shared workspace connections can provide provider credentials, while Analytics still owns metrics, source-of-truth choices, and saved analyses.
96
+ Connect analytics data sources, prompt for real charts, and build reusable dashboards.
141
97
 
142
98
  </td>
143
99
  <td width="33%" align="center" valign="top">
@@ -154,62 +110,43 @@ Record your screen with auto-transcripts, shareable links, and an agent that sum
154
110
  </tr>
155
111
  </table>
156
112
 
157
- Every template is a complete cloneable SaaS — fork it, customize it with the agent, own it. Try them with example data before connecting your own sources.
158
-
159
113
  View the full template gallery at **[agent-native.com/templates](https://agent-native.com/templates)**.
160
114
 
161
- ## Quick Start
115
+ ## Try it with a skill
162
116
 
163
- One command to fork a template and start building locally.
117
+ Don't want to scaffold a whole app yet? Add visual planning and PR recaps to Claude Code, Codex, Cursor, Pi, OpenCode, GitHub Copilot / VS Code, and similar agents with one command:
164
118
 
165
119
  ```bash
166
- npx @agent-native/core@latest create my-platform
167
- cd my-platform
168
- pnpm install
169
- pnpm dev
120
+ npx @agent-native/core@latest skills add visual-plan
170
121
  ```
171
122
 
172
- The CLI shows a multi-select picker so you can include as many templates as you want in one workspace. Pick Mail + Calendar + Forms and you get all three apps wired up and sharing auth in one go. Or browse the **[template gallery](https://agent-native.com/templates)** for live demos.
123
+ ![Visual plan and recap in action](https://raw.githubusercontent.com/builderio/skills/main/media/visual-recap.gif)
173
124
 
174
- Want a single app, no monorepo? Use `--standalone`:
125
+ You get two slash commands:
175
126
 
176
- ```bash
177
- npx @agent-native/core@latest create my-app --standalone --template mail
178
- ```
179
-
180
- ## Workspaces (Monorepo)
127
+ - **`/visual-plan`**: before the agent writes code, it opens a structured, reviewable plan with inline diagrams, UI wireframes, file-by-file implementation maps, and annotations you can comment on and approve.
128
+ - **`/visual-recap`**: after changes land, it turns a PR or git diff into a high-altitude visual recap with a shareable review link instead of a raw diff.
181
129
 
182
- A workspace is the default shape of an agent-native project. Every app sits under `apps/`, and `packages/shared/` is available for the small amount of code, instructions, skills, or branding that should truly apply to every app.
130
+ See the **[Skills Guide](https://agent-native.com/docs/skills-guide#app-backed-skills)** for more.
183
131
 
184
- ```
185
- my-platform/
186
- ├── package.json # declares `agent-native.workspaceCore`
187
- ├── pnpm-workspace.yaml
188
- ├── .env # shared secrets: ANTHROPIC_API_KEY, BUILDER_PRIVATE_KEY, A2A_SECRET, ...
189
- ├── packages/
190
- │ └── shared/ # optional shared custom code
191
- └── apps/
192
- ├── mail/
193
- ├── calendar/
194
- └── forms/
195
- ```
132
+ ## Quick Start
196
133
 
197
- Add another app later:
134
+ One command to start a new project locally.
198
135
 
199
136
  ```bash
200
- npx @agent-native/core@latest add-app notes --template content
137
+ npx @agent-native/core@latest create my-app
138
+ cd my-app
139
+ pnpm install
140
+ pnpm dev
201
141
  ```
202
142
 
203
- Deploy every app behind one origin:
143
+ `create` first asks how you want to start:
204
144
 
205
- ```bash
206
- npx @agent-native/core@latest deploy
207
- # https://your-agents.com/mail/* → mail
208
- # https://your-agents.com/calendar/* → calendar
209
- # https://your-agents.com/forms/* → forms
210
- ```
145
+ - **Full template(s)**: clone one or more complete apps into a workspace. Pick Mail + Calendar + Forms and you get all three wired up and sharing auth.
146
+ - **Chat**: a single app with a minimal chat UI and the browser shell already wired, the simplest way to get a UI.
147
+ - **Headless**: a single action-first app with no UI shell. The CLI walks you through calling your first action and agent, and you can add a UI later.
211
148
 
212
- Same-origin deploy means a **shared login session** across every app and **zero-config cross-app A2A** — tag `@mail` from the calendar's agent chat and it just works (no JWT signing, no CORS). Full details at **[agent-native.com/docs/multi-app-workspace](https://agent-native.com/docs/multi-app-workspace)**.
149
+ Prefer flags? `create my-app --template mail`, `--headless`, or `--standalone` skip the prompt.
213
150
 
214
151
  ## The Best of Both Worlds
215
152
 
@@ -1 +1 @@
1
- {"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../src/cli/create-workspace.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,eAAe,CACnC,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,IAAI,CAAC,CAMf"}
1
+ {"version":3,"file":"create-workspace.d.ts","sourceRoot":"","sources":["../../src/cli/create-workspace.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,wBAAsB,eAAe,CACnC,IAAI,GAAE,sBAA2B,GAChC,OAAO,CAAC,IAAI,CAAC,CASf"}
@@ -12,6 +12,9 @@ export async function createWorkspace(opts = {}) {
12
12
  const passthrough = {
13
13
  template: opts.template,
14
14
  noInstall: opts.noInstall,
15
+ // Preserve the alias's contract: always scaffold a workspace, never the
16
+ // new start-shape prompt that could route to a standalone app.
17
+ forceWorkspace: true,
15
18
  };
16
19
  await createApp(opts.name, passthrough);
17
20
  }
@@ -1 +1 @@
1
- {"version":3,"file":"create-workspace.js","sourceRoot":"","sources":["../../src/cli/create-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAyB,MAAM,aAAa,CAAC;AAS/D,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA+B,EAAE;IAEjC,MAAM,WAAW,GAAqB;QACpC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC;IACF,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * @deprecated `create-workspace` is now an alias for `create`. In current\n * versions, `agent-native create <name>` defaults to scaffolding a workspace\n * with a multi-select template picker. Use `--standalone` for a single-app\n * standalone scaffold.\n *\n * This module is kept for backwards compatibility with older docs and\n * scripts that still invoke `agent-native create-workspace`.\n */\nimport { createApp, type CreateAppOptions } from \"./create.js\";\n\nexport interface CreateWorkspaceOptions {\n name?: string;\n /** Pre-select these templates in the picker. */\n template?: string;\n noInstall?: boolean;\n}\n\nexport async function createWorkspace(\n opts: CreateWorkspaceOptions = {},\n): Promise<void> {\n const passthrough: CreateAppOptions = {\n template: opts.template,\n noInstall: opts.noInstall,\n };\n await createApp(opts.name, passthrough);\n}\n"]}
1
+ {"version":3,"file":"create-workspace.js","sourceRoot":"","sources":["../../src/cli/create-workspace.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,SAAS,EAAyB,MAAM,aAAa,CAAC;AAS/D,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,OAA+B,EAAE;IAEjC,MAAM,WAAW,GAAqB;QACpC,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,wEAAwE;QACxE,+DAA+D;QAC/D,cAAc,EAAE,IAAI;KACrB,CAAC;IACF,MAAM,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAC1C,CAAC","sourcesContent":["/**\n * @deprecated `create-workspace` is now an alias for `create`. In current\n * versions, `agent-native create <name>` defaults to scaffolding a workspace\n * with a multi-select template picker. Use `--standalone` for a single-app\n * standalone scaffold.\n *\n * This module is kept for backwards compatibility with older docs and\n * scripts that still invoke `agent-native create-workspace`.\n */\nimport { createApp, type CreateAppOptions } from \"./create.js\";\n\nexport interface CreateWorkspaceOptions {\n name?: string;\n /** Pre-select these templates in the picker. */\n template?: string;\n noInstall?: boolean;\n}\n\nexport async function createWorkspace(\n opts: CreateWorkspaceOptions = {},\n): Promise<void> {\n const passthrough: CreateAppOptions = {\n template: opts.template,\n noInstall: opts.noInstall,\n // Preserve the alias's contract: always scaffold a workspace, never the\n // new start-shape prompt that could route to a standalone app.\n forceWorkspace: true,\n };\n await createApp(opts.name, passthrough);\n}\n"]}
@@ -15,6 +15,12 @@ export interface CreateAppOptions {
15
15
  standalone?: boolean;
16
16
  /** Internal: skip pnpm install at the end (for tests). */
17
17
  noInstall?: boolean;
18
+ /**
19
+ * Internal: always scaffold a workspace and skip the start-shape prompt.
20
+ * Used by the deprecated `create-workspace` alias, whose contract is an
21
+ * unconditional workspace scaffold.
22
+ */
23
+ forceWorkspace?: boolean;
18
24
  }
19
25
  /**
20
26
  * Main entry for `agent-native create [name]`.
@@ -1 +1 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"AAKA,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AA4BvE;;;;;GAKG;AACH,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B;AA6BD,MAAM,WAAW,gBAAgB;IAC/B,iFAAiF;IACjF,QAAQ,CAA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MAAM,EAAE,CASlD;AAED;;qDAEqD;AACrD,iBAAS,oBAAoB,IAAI,MAAM,CAEtC;AAoID,iBAAS,kBAAkB,CACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,YAAY,GAAG,WAAW,GAC/B,IAAI,CA8CN;AAoFD,iBAAS,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI1C;AAyED,iBAAS,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CA+BxE"}
@@ -65,6 +65,11 @@ const HEADLESS_OPTION = {
65
65
  */
66
66
  export async function createApp(name, opts) {
67
67
  const clack = await import("@clack/prompts");
68
+ // Reject an invalid provided name before any interactive prompt so bad input
69
+ // fails fast instead of blocking on the start-shape picker below.
70
+ if (name !== undefined) {
71
+ assertValidProjectName(name, clack);
72
+ }
68
73
  // If we're already inside a workspace, the meaning of `create <name>` is
69
74
  // "add a new app to this workspace". Delegate to add-app.
70
75
  const workspace = detectWorkspace(process.cwd());
@@ -82,17 +87,94 @@ export async function createApp(name, opts) {
82
87
  // Use `--template a,b` or pass no --template to opt into the workspace
83
88
  // flow with the multi-select picker.
84
89
  const parsed = parseTemplateList(opts?.template);
85
- if (parsed.includes("headless") && parsed.length > 1) {
90
+ // Headless can't live in a workspace, so reject it when more than one
91
+ // template is requested or when workspace semantics are forced.
92
+ if (parsed.includes("headless") &&
93
+ (parsed.length > 1 || opts?.forceWorkspace)) {
86
94
  clack.cancel("The headless scaffold is standalone-only. Use `agent-native create my-app --headless`, or use the Chat template when adding a UI app to a workspace.");
87
95
  process.exit(1);
88
96
  }
89
- if (parsed.length === 1) {
97
+ // A single explicit template scaffolds a standalone app, unless the caller
98
+ // forces workspace semantics (the deprecated `create-workspace` alias), in
99
+ // which case the template is preselected in the workspace picker below.
100
+ if (parsed.length === 1 && !opts?.forceWorkspace) {
90
101
  await createStandaloneApp(name, opts, clack);
91
102
  return;
92
103
  }
93
- // Default: create a workspace.
104
+ // No template specified: ask what shape to start from before diving into
105
+ // "which templates?". The on-ramp choice implies the project structure, so
106
+ // we don't ask a separate "workspace or standalone?" question — Chat and
107
+ // Headless scaffold a single standalone app (the lightest starts; headless
108
+ // cannot live in a workspace), while Template continues into the workspace
109
+ // multi-select.
110
+ if (parsed.length === 0) {
111
+ // The deprecated `create-workspace` alias forces workspace semantics, so
112
+ // it must skip the start-shape prompt and scaffold a workspace directly.
113
+ if (opts?.forceWorkspace) {
114
+ await createWorkspaceInteractive(name, opts, clack);
115
+ return;
116
+ }
117
+ const shape = await promptStartShape(clack);
118
+ if (shape === "headless" || shape === "chat") {
119
+ await createStandaloneApp(name, { ...opts, template: shape }, clack);
120
+ return;
121
+ }
122
+ // shape === "template" → full app(s) in a workspace.
123
+ await createWorkspaceInteractive(name, opts, clack);
124
+ return;
125
+ }
126
+ // Multiple explicit templates: create a workspace with them.
94
127
  await createWorkspaceInteractive(name, opts, clack);
95
128
  }
129
+ /**
130
+ * Top-level on-ramp shown by the bare `create <name>` command (no flags). The
131
+ * choice made here implies the project structure, so we deliberately avoid a
132
+ * separate "workspace or standalone?" question:
133
+ * - "template" → full app(s) in a workspace (the multi-select picker)
134
+ * - "chat" → a single standalone chat UI app
135
+ * - "headless" → a single standalone action-first app with no UI shell
136
+ * Chat and headless are standalone on purpose: a monorepo is unnecessary
137
+ * ceremony for the lightest on-ramps, and headless cannot be a workspace
138
+ * member. Either can grow into a workspace later via `add-app`.
139
+ */
140
+ async function promptStartShape(clack) {
141
+ const choice = await clack.select({
142
+ message: "How do you want to start?",
143
+ options: [
144
+ {
145
+ value: "template",
146
+ label: "Full template(s)",
147
+ hint: "Clone complete apps (Mail, Calendar, Slides, ...) into a workspace",
148
+ },
149
+ {
150
+ value: "chat",
151
+ label: "Chat",
152
+ hint: "A single app with a minimal chat UI and the browser shell wired up",
153
+ },
154
+ {
155
+ value: "headless",
156
+ label: "Headless",
157
+ hint: "A single action-first app with one primitive and no UI shell",
158
+ },
159
+ ],
160
+ });
161
+ if (clack.isCancel(choice)) {
162
+ clack.cancel("Cancelled.");
163
+ process.exit(0);
164
+ }
165
+ return choice;
166
+ }
167
+ /**
168
+ * Validate a project name supplied on the command line. Mirrors the rule in
169
+ * `promptNameIfMissing` so an invalid name is rejected before any interactive
170
+ * prompt runs (the sub-flows re-validate, which is a harmless no-op).
171
+ */
172
+ function assertValidProjectName(name, clack) {
173
+ if (!/^[a-z][a-z0-9-]*$/.test(name)) {
174
+ clack.cancel(`Invalid name "${name}". Use lowercase letters, numbers, and hyphens (must start with a letter).`);
175
+ process.exit(1);
176
+ }
177
+ }
96
178
  /* ─────────────────────────────────────────────────────────────────────────
97
179
  * Workspace creation (new default)
98
180
  * ───────────────────────────────────────────────────────────────────────── */