mirror of
https://github.com/shadcn-ui/ui.git
synced 2026-06-11 09:51:40 +00:00
- Search across multiple registries and make the registry argument optional: omit it to search every registry configured in components.json (builtins like @shadcn excluded). Without a components.json or configured registries, a clear usage error is printed. - Add a --type filter (accepts "ui" or "registry:ui", comma-separated) with validation against the known item types. - Fetch registries concurrently with a capped worker pool, preserving result order. - Tolerate per-registry failures when searching all configured registries (reported in a structured `errors` field); exit non-zero when every registry fails. Usage errors print directly instead of routing through handleError. - MCP parity: optional registries (search-all), a `types` filter, and type validation across the search/list/examples tools. - Keep the public registry surface to `searchRegistries` and make it self-contained (clears its own context, useCache defaults to false). - Consolidate search formatting into registry/search, add the `errors` field to searchResultsSchema, and update the skill docs.
Tests
This package contains integration tests that verify the shadcn CLI works correctly with a local registry. The tests run actual CLI commands against test fixtures to ensure files are created and updated properly.
Running Tests
Run the following command from the root of the workspace:
pnpm tests:test
Writing Tests
import {
createFixtureTestDirectory,
fileExists,
npxShadcn,
} from "../utils/helpers"
describe("my test suite", () => {
it("should do something", async () => {
// Create a test directory from a fixture
const testDir = await createFixtureTestDirectory("next-app")
// Run CLI command
await npxShadcn(testDir, ["init", "--base-color=neutral"])
// Make assertions
expect(await fileExists(path.join(testDir, "components.json"))).toBe(true)
})
})