Skip to content

Commit 563d2ab

Browse files
committed
fix: update docs
1 parent d0e331a commit 563d2ab

7 files changed

Lines changed: 44 additions & 32 deletions

File tree

docs/content/docs/api-reference/cli.mdx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ openui create [options]
5858
| `-n, --name <string>` | Project name (interactive default: `openui-agent`) |
5959
| `-t, --template <template>` | AI backend: `openui-cloud` (recommended) or `openui-self-hosted` |
6060
| `--backend-framework <framework>` | Backend integration: `default`, `langgraph`, `vercel-ai-sdk`, or `vercel-eve` |
61-
| `-e, --example <example>` | Scaffold a featured example instead of a starter template |
61+
| `-e, --example <example>` | Scaffold any example from the OpenUI Repository |
6262
| `--api-key <key>` | OpenUI Cloud API key; skips sign-in for the Cloud setup |
6363
| `--auth <method>` | Cloud auth method: `oauth` or `skip`; `manual` is deprecated |
6464
| `--skill` | Install the OpenUI agent skill for AI coding assistants |
@@ -69,7 +69,7 @@ openui create [options]
6969
| `--no-interactive` | Fail instead of prompting for missing input |
7070
| `--agent-name <name>` | Declare the invoking coding-agent slug (default: `unknown`) |
7171

72-
When run interactively (default), the CLI prompts for any missing options, including a starter template or featured example, then asks whether to start the development server after installing dependencies with the detected package manager. The start prompt defaults to yes; answering no preserves the existing install-and-exit behavior and prints the `cd` and dev commands. For most prototypes and evaluations, start with **OpenUI Cloud, the recommended default**: hosted models, managed conversation history and streaming, built-in tools, and ready-to-use reports and presentations without operating the model, storage, or artifact infrastructure. Choose **self-hosted** when owning the OpenAI-compatible provider, AI route, and persistence is a requirement. Choose a **feature example** when you want a FastAPI, shadcn/ui, React Native, Mastra, or other integration listed in `examples/examples.json`.
72+
When run interactively (default), the CLI prompts for any missing options, including a starter template or featured example, then asks whether to start the development server after installing dependencies with the detected package manager. The start prompt defaults to yes; answering no preserves the existing install-and-exit behavior and prints the `cd` and dev commands. For most prototypes and evaluations, start with **OpenUI Cloud, the recommended default**: hosted models, managed conversation history and streaming, built-in tools, and ready-to-use reports and presentations without operating the model, storage, or artifact infrastructure. Choose **self-hosted** when owning the OpenAI-compatible provider, AI route, and persistence is a requirement.
7373

7474
In non-interactive mode, dependencies are installed without starting the long-running development server. Pass `--immediate` to install, start, and open the app, or `--no-install` to scaffold only.
7575

@@ -100,9 +100,9 @@ For Cloud LangGraph and Vercel AI SDK variants, the framework owns orchestration
100100

101101
Every framework overlay includes a `get_weather` example backed by Open-Meteo. Ask “What’s the weather in Berlin?” to verify the selected framework’s native multi-step tool loop.
102102

103-
**Feature examples**
103+
**Examples**
104104

105-
Interactive `openui create` lists starter templates and featured examples in one prompt. The featured list is prefetched at runtime from [`examples/examples.json`](https://github.com/thesysdev/openui/blob/main/examples/examples.json) — edit that file to change what the CLI offers. `--example` cannot be combined with `--template` or `--backend-framework`. Examples are copied from a local OpenUI checkout when available, otherwise checked out from GitHub. Workspace and catalog dependencies are rewritten to `latest`.
105+
Interactive `openui create` lists starter templates and featured examples in one prompt. `--example` cannot be combined with `--template` or `--backend-framework`.
106106

107107
| Value | Demonstrates |
108108
| -------------- | -------------------------------------------------------------- |
@@ -142,9 +142,10 @@ pnpx @openuidev/cli@latest create --name my-app --template openui-self-hosted --
142142
pnpx @openuidev/cli@latest create --name my-app --template openui-self-hosted --backend-framework vercel-ai-sdk
143143
pnpx @openuidev/cli@latest create --name my-app --template openui-self-hosted --backend-framework vercel-eve
144144

145-
# Select a featured example
145+
# Select an example
146146
pnpx @openuidev/cli@latest create --name my-app --example shadcn
147147
pnpx @openuidev/cli@latest create --name my-app --example mastra
148+
pnpx @openuidev/cli@latest create --name my-app --example vue
148149

149150
# Non-interactive
150151
pnpx @openuidev/cli@latest create --no-interactive --name my-app --template openui-cloud --auth skip
@@ -170,9 +171,10 @@ bunx @openuidev/cli@latest create --name my-app --template openui-self-hosted --
170171
bunx @openuidev/cli@latest create --name my-app --template openui-self-hosted --backend-framework vercel-ai-sdk
171172
bunx @openuidev/cli@latest create --name my-app --template openui-self-hosted --backend-framework vercel-eve
172173

173-
# Select a featured example
174+
# Select an example
174175
bunx @openuidev/cli@latest create --name my-app --example shadcn
175176
bunx @openuidev/cli@latest create --name my-app --example mastra
177+
bunx @openuidev/cli@latest create --name my-app --example vue
176178

177179
# Non-interactive
178180
bunx @openuidev/cli@latest create --no-interactive --name my-app --template openui-cloud --auth skip
@@ -198,9 +200,10 @@ yarn dlx @openuidev/cli@latest create --name my-app --template openui-self-hoste
198200
yarn dlx @openuidev/cli@latest create --name my-app --template openui-self-hosted --backend-framework vercel-ai-sdk
199201
yarn dlx @openuidev/cli@latest create --name my-app --template openui-self-hosted --backend-framework vercel-eve
200202

201-
# Select a featured example
203+
# Select an example
202204
yarn dlx @openuidev/cli@latest create --name my-app --example shadcn
203205
yarn dlx @openuidev/cli@latest create --name my-app --example mastra
206+
yarn dlx @openuidev/cli@latest create --name my-app --example vue
204207

205208
# Non-interactive
206209
yarn dlx @openuidev/cli@latest create --no-interactive --name my-app --template openui-cloud --auth skip
@@ -226,9 +229,10 @@ npx @openuidev/cli@latest create --name my-app --template openui-self-hosted --b
226229
npx @openuidev/cli@latest create --name my-app --template openui-self-hosted --backend-framework vercel-ai-sdk
227230
npx @openuidev/cli@latest create --name my-app --template openui-self-hosted --backend-framework vercel-eve
228231

229-
# Select a featured example
232+
# Select an example
230233
npx @openuidev/cli@latest create --name my-app --example shadcn
231234
npx @openuidev/cli@latest create --name my-app --example mastra
235+
npx @openuidev/cli@latest create --name my-app --example vue
232236

233237
# Non-interactive
234238
npx @openuidev/cli@latest create --no-interactive --name my-app --template openui-cloud --auth skip

packages/openui-cli/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ It currently supports two workflows:
1313
- **OpenUI Cloud (recommended)** — hosted models with managed conversations, streaming, built-in tools, and ready-to-use report and presentation artifacts
1414
- **Self-hosted** — bring an OpenAI-compatible model key and own the AI route and persistence
1515
- keeping the default minimal SDK route or adding a LangGraph, Vercel AI SDK, or Vercel Eve backend to either template
16-
- scaffolding a featured example listed in [`examples/examples.json`](https://github.com/thesysdev/openui/blob/main/examples/examples.json)
16+
- scaffolding an example from [`examples/examples.json`](https://github.com/thesysdev/openui/blob/main/examples/examples.json)
1717
- generating a system prompt or JSON Schema from a `createLibrary()` export
1818

1919
## Install
@@ -81,7 +81,7 @@ Options:
8181
- `-n, --name <string>`: Project name (interactive default: `openui-agent`)
8282
- `-t, --template <template>`: AI backend `key` from `templates/templates.json` — interactive default `openui-cloud`
8383
- `--backend-framework <framework>`: Overlay `key` from that template's `overlays` list (plus `default` for the base template)
84-
- `-e, --example <example>`: Scaffold a featured example from `examples/examples.json` instead of a starter template
84+
- `-e, --example <example>`: Scaffold any example from `examples/examples.json` (folder name)
8585
- `--skill`: Install the OpenUI agent skill for AI coding assistants
8686
- `--no-skill`: Skip installing the OpenUI agent skill
8787
- `--no-install`: Scaffold without running the package install
@@ -133,13 +133,14 @@ Every framework overlay includes `get_weather` as its example app-owned function
133133

134134
#### Feature examples
135135

136-
Interactive `openui create` lists **Feature Examples** under the starter templates. The names come from [`examples/examples.json`](https://github.com/thesysdev/openui/blob/main/examples/examples.json) in the OpenUI repo — the CLI prefetches that catalog at runtime, so adding or removing an example does not require a CLI release. Pick one in the prompt, or pass `--example <name>`. `--example` cannot be combined with `--template` or `--backend-framework`.
136+
Interactive `openui create` lists **Feature Examples** under the starter templates. The names come from [`examples/examples.json`](https://github.com/thesysdev/openui/blob/main/examples/examples.json) in the OpenUI repo — the CLI prefetches that catalog at runtime, so adding or removing an example does not require a CLI release. `--example` cannot be combined with `--template` or `--backend-framework`.
137137

138138
The catalog currently features FastAPI, shadcn/ui, React Native, and Mastra. Examples are copied from the local OpenUI checkout when the CLI can see `examples/`, otherwise checked out from GitHub with sparse-checkout. Workspace and catalog dependencies are rewritten to `latest`, and monorepo `generate` scripts are rewritten to `npx @openuidev/cli generate`.
139139

140140
```bash
141141
openui create --example shadcn
142142
openui create --name my-mastra-app --example mastra --no-immediate
143+
openui create --example vue
143144
```
144145

145146
#### Conversation storage

packages/openui-cli/src/commands/create-app.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
type PackageManagerName,
1717
} from "../lib/detect-package-manager";
1818
import { runDevCommand } from "../lib/dev-server";
19-
import { loadFeaturedExamples, requireFeaturedExamples } from "../lib/featured-examples";
19+
import { loadExamplesCatalog, requireExamplesCatalog } from "../lib/featured-examples";
2020
import { runSkillInstall, shouldInstallSkill } from "../lib/install-skill";
2121
import {
2222
applyOverlay,
@@ -201,18 +201,18 @@ export async function runCreateApp(options: CreateAppOptions): Promise<void> {
201201
);
202202
}
203203

204-
const [catalog, featuredExamples] = await Promise.all([
204+
const [catalog, examples] = await Promise.all([
205205
loadTemplatesCatalog(),
206-
loadFeaturedExamples(),
206+
loadExamplesCatalog(),
207207
]);
208-
requireFeaturedExamples(featuredExamples, options.example);
208+
requireExamplesCatalog(examples, options.example);
209209

210210
const template: TemplateName | undefined = options.example
211211
? undefined
212212
: (options.template ?? DEFAULT_TEMPLATE_KEY);
213213
const templateEntry = template ? findCatalogTemplate(catalog, template) : undefined;
214214
if (options.example) {
215-
findExample(options.example, featuredExamples);
215+
findExample(options.example, examples);
216216
} else if (options.backendFramework && templateEntry) {
217217
findCatalogOverlay(templateEntry, options.backendFramework);
218218
}
@@ -236,7 +236,7 @@ export async function runCreateApp(options: CreateAppOptions): Promise<void> {
236236
const project = await resolveProject({
237237
backendFramework: options.backendFramework,
238238
example: options.example,
239-
examples: featuredExamples,
239+
examples,
240240
templates: templatesFromOverlays(
241241
(templateEntry?.overlays ?? []).map((overlay) => ({
242242
name: overlay.key,

packages/openui-cli/src/index.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,10 @@ program
6565
"--backend-framework <framework>",
6666
"Backend framework: default | langgraph | vercel-ai-sdk | vercel-eve",
6767
)
68-
.option("-e, --example <example>", "create from a featured example (see examples/examples.json)")
68+
.option(
69+
"-e, --example <example>",
70+
"create from an example in examples/examples.json (interactive picker shows featured ones)",
71+
)
6972
.option("--api-key <key>", "OpenUI Cloud API key (cloud template; skips sign-in)")
7073
.option("--auth <method>", "Cloud auth method: oauth | skip (manual is deprecated)")
7174
.option("--skill", "Install the OpenUI agent skill for AI coding assistants")
@@ -97,7 +100,8 @@ Backend frameworks:
97100
98101
Feature examples:
99102
Loaded at runtime from examples/examples.json in the OpenUI repo.
100-
Use --example <name>, or pick one interactively from Feature Examples.
103+
The interactive picker lists featured examples. --example <name> accepts any
104+
catalog name (folder name), including ones not shown in the picker.
101105
`,
102106
)
103107
.action(

packages/openui-cli/src/lib/checkout.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const FETCH_TIMEOUT_MS = 30_000;
1010

1111
const SOURCE_OWNER = "thesysdev";
1212
const SOURCE_REPO = "openui";
13-
const SOURCE_REF = "main";
13+
const SOURCE_REF = "feat/cli-featured-examples";
1414
const SOURCE_GIT_URL = `https://github.com/${SOURCE_OWNER}/${SOURCE_REPO}.git`;
1515

1616
export type SourceFetchOptions = {

packages/openui-cli/src/lib/featured-examples.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ type CatalogExample = {
1111
featured?: unknown;
1212
};
1313

14-
function parseFeaturedEntry(item: CatalogExample): ExampleProject | undefined {
15-
if (item.featured !== true) return undefined;
14+
function parseCatalogEntry(item: CatalogExample): ExampleProject | undefined {
1615
if (
1716
typeof item.title !== "string" ||
1817
typeof item.description !== "string" ||
@@ -30,40 +29,41 @@ function parseFeaturedEntry(item: CatalogExample): ExampleProject | undefined {
3029
category: "example",
3130
path: relative.startsWith("examples/") ? relative : `examples/${relative}`,
3231
envFile: ".env",
32+
featured: item.featured === true,
3333
};
3434
}
3535

36-
function parseFeaturedExamples(raw: string): ExampleProject[] {
36+
function parseExamplesCatalog(raw: string): ExampleProject[] {
3737
const parsed = JSON.parse(raw) as { examples?: unknown };
3838
if (!Array.isArray(parsed.examples)) {
3939
throw new Error(`${EXAMPLES_CATALOG_PATH} must contain an "examples" array.`);
4040
}
4141
return parsed.examples
42-
.map((entry) => parseFeaturedEntry(entry as CatalogExample))
42+
.map((entry) => parseCatalogEntry(entry as CatalogExample))
4343
.filter((entry): entry is ExampleProject => Boolean(entry));
4444
}
4545

46-
/** Prefetch featured examples (`featured: true`) from GitHub. */
47-
export async function loadFeaturedExamples(): Promise<ExampleProject[]> {
46+
/** Prefetch every example in `examples/examples.json`. The interactive picker uses `featured` only. */
47+
export async function loadExamplesCatalog(): Promise<ExampleProject[]> {
4848
try {
4949
const { content } = await fetchSourceFile(EXAMPLES_CATALOG_PATH);
50-
return parseFeaturedExamples(content);
50+
return parseExamplesCatalog(content);
5151
} catch (err) {
5252
if (err instanceof CreateError) throw err;
5353
throw new CreateError(
5454
"args_resolution",
55-
`Could not load featured examples from ${EXAMPLES_CATALOG_PATH}.`,
55+
`Could not load examples from ${EXAMPLES_CATALOG_PATH}.`,
5656
"network",
5757
"FEATURED_CATALOG_UNAVAILABLE",
5858
);
5959
}
6060
}
6161

62-
export function requireFeaturedExamples(examples: ExampleProject[], requested?: string): void {
62+
export function requireExamplesCatalog(examples: ExampleProject[], requested?: string): void {
6363
if (!requested || examples.length > 0) return;
6464
throw new CreateError(
6565
"args_resolution",
66-
`Could not load featured examples from ${EXAMPLES_CATALOG_PATH}.`,
66+
`Could not load examples from ${EXAMPLES_CATALOG_PATH}.`,
6767
"network",
6868
"FEATURED_CATALOG_UNAVAILABLE",
6969
);

packages/openui-cli/src/lib/projects.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ export interface ExampleProject {
2424
/** Primary env var to prompt for. Omit when the example needs several keys. */
2525
envKey?: string;
2626
aliases?: string[];
27+
/** When true, the example appears in the interactive create picker. */
28+
featured?: boolean;
2729
}
2830

2931
export type ProjectMetadata = TemplateProject | ExampleProject;
@@ -118,10 +120,11 @@ export async function resolveProject(params: {
118120
description: project.description,
119121
})),
120122
];
121-
if (examples.length > 0) {
123+
const pickerExamples = examples.filter((project) => project.featured);
124+
if (pickerExamples.length > 0) {
122125
choices.push(
123126
new Separator("────── Feature Examples ──────"),
124-
...examples.map((project) => ({
127+
...pickerExamples.map((project) => ({
125128
value: `example:${project.name}`,
126129
name: project.label,
127130
description: project.description,

0 commit comments

Comments
 (0)