CLI: improve for Sanity registry

This commit is contained in:
Fuma Nama
2026-05-02 22:23:17 +08:00
parent ad1429afd2
commit 2d220860af
6 changed files with 17 additions and 10 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@fumadocs/cli': patch
---
Improve for Sanity registry
+4 -4
View File
@@ -124,8 +124,8 @@ export const registry: Registry = {
},
{
name: 'ai/openrouter',
title: 'AI Chat (Next.js + OpenRouter)',
description: 'Ask AI dialog for your docs, requires OPENROUTER_API_KEY',
title: 'AI Chat (AI SDK)',
description: 'Ask AI dialog for your docs, default using OpenRouter',
files: [
{
type: 'components',
@@ -154,7 +154,7 @@ export const registry: Registry = {
},
{
name: 'ai/inkeep',
title: 'AI Chat (Next.js + Inkeep AI)',
title: 'AI Chat (Inkeep AI)',
description: 'Ask AI dialog for your docs, requires Inkeep AI',
files: [
{
@@ -176,7 +176,7 @@ export const registry: Registry = {
},
{
name: 'og/mono',
description: 'Open graph image generation (mono-style)',
description: 'Open graph image generation - mono style',
files: [
{
type: 'lib',
-1
View File
@@ -328,7 +328,6 @@ export const registry: Registry = {
},
{
name: 'ai/page-actions',
title: 'Page Actions',
description: 'Common page actions',
files: [
{
+7 -3
View File
@@ -25,11 +25,11 @@ export async function add(input: string[], connector: RegistryConnector, config:
const spin = spinner();
spin.start('fetching registry');
async function scan(subRegistry?: string): Promise<AddOption[]> {
async function scan(subRegistry?: string, prefix?: string): Promise<AddOption[]> {
const info = await connector.fetchRegistryInfo(subRegistry);
return info.indexes.map((item) => ({
label: item.title ?? item.name,
label: `${prefix ? `${picocolors.bold(prefix)} - ` : ''}${item.title ?? item.name}`,
value: { name: item.name, subRegistry },
hint: item.description,
}));
@@ -38,7 +38,11 @@ export async function add(input: string[], connector: RegistryConnector, config:
spin.stop(picocolors.bold(picocolors.greenBright('registry fetched')));
const value = await autocompleteMultiselect({
message: 'Select components to install',
options: [...(await scan()), ...(await scan(subRegistry))],
options: [
...(await scan(undefined, 'common')),
...(await scan('fumadocs/sanity', 'sanity')),
...(await scan(subRegistry, 'ui')),
].sort((a, b) => a.label.localeCompare(b.label)),
});
if (isCancel(value)) {
-1
View File
@@ -328,7 +328,6 @@ export const registry: Registry = {
},
{
name: 'ai/page-actions',
title: 'Page Actions',
description: 'Common page actions',
files: [
{
+1 -1
View File
@@ -57,7 +57,7 @@ export const registry: Registry = {
name: 'all',
subComponents: components.map((comp) => ({
type: 'sub-registry',
subRegistry: 'sanity',
subRegistry: 'fumadocs/sanity',
component: comp.name,
})),
},