bejamas 0.2.11 → 0.2.12

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/dist/index.js CHANGED
@@ -1,10 +1,9 @@
1
1
  #!/usr/bin/env node
2
- import { _ as getWorkspaceConfig, b as highlighter, d as parseJsDocMetadata, g as getConfig, o as extractFrontmatter, p as resolveUiRoot, v as spinner, y as logger } from "./utils-Dr0kJLcx.js";
2
+ import { _ as getWorkspaceConfig, b as highlighter, d as parseJsDocMetadata, g as getConfig, o as extractFrontmatter, p as resolveUiRoot, v as spinner, y as logger } from "./utils-BfJTJvcy.js";
3
3
  import { Command } from "commander";
4
4
  import { createRequire } from "module";
5
- import { promises } from "fs";
6
5
  import path from "path";
7
- import fsExtra from "fs-extra";
6
+ import fs from "fs-extra";
8
7
  import os from "os";
9
8
  import dotenv from "dotenv";
10
9
  import { detect } from "@antfu/ni";
@@ -14,8 +13,8 @@ import { execa } from "execa";
14
13
  import prompts from "prompts";
15
14
  import fg from "fast-glob";
16
15
  import path$1, { extname as extname$1, isAbsolute, join as join$1, relative as relative$1, resolve } from "node:path";
17
- import { existsSync as existsSync$1, readFileSync, readdirSync } from "node:fs";
18
- import fs from "node:fs/promises";
16
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
17
+ import fs$1 from "node:fs/promises";
19
18
 
20
19
  //#region src/utils/errors.ts
21
20
  const MISSING_DIR_OR_EMPTY_PROJECT = "1";
@@ -24,7 +23,7 @@ const MISSING_DIR_OR_EMPTY_PROJECT = "1";
24
23
  //#region src/preflights/preflight-init.ts
25
24
  async function preFlightInit(options) {
26
25
  const errors = {};
27
- if (!fsExtra.existsSync(options.cwd) || !fsExtra.existsSync(path.resolve(options.cwd, "package.json"))) {
26
+ if (!fs.existsSync(options.cwd) || !fs.existsSync(path.resolve(options.cwd, "package.json"))) {
28
27
  errors[MISSING_DIR_OR_EMPTY_PROJECT] = true;
29
28
  return {
30
29
  errors,
@@ -62,12 +61,6 @@ async function getPackageManager(targetDir, { withFallback } = { withFallback: f
62
61
  if (userAgent.startsWith("bun")) return "bun";
63
62
  return "npm";
64
63
  }
65
- async function getPackageRunner(cwd) {
66
- const packageManager = await getPackageManager(cwd);
67
- if (packageManager === "pnpm") return "pnpm dlx";
68
- if (packageManager === "bun") return "bunx";
69
- return "npx";
70
- }
71
64
 
72
65
  //#endregion
73
66
  //#region src/registry/errors.ts
@@ -206,7 +199,7 @@ async function createProject(options) {
206
199
  const packageManager = await getPackageManager(options.cwd, { withFallback: true });
207
200
  const projectPath = `${options.cwd}/${projectName}`;
208
201
  try {
209
- await fsExtra.access(options.cwd, fsExtra.constants.W_OK);
202
+ await fs.access(options.cwd, fs.constants.W_OK);
210
203
  } catch (error) {
211
204
  logger.break();
212
205
  logger.error(`The path ${highlighter.info(options.cwd)} is not writable.`);
@@ -214,7 +207,7 @@ async function createProject(options) {
214
207
  logger.break();
215
208
  process.exit(1);
216
209
  }
217
- if (fsExtra.existsSync(path.resolve(options.cwd, projectName, "package.json"))) {
210
+ if (fs.existsSync(path.resolve(options.cwd, projectName, "package.json"))) {
218
211
  logger.break();
219
212
  logger.error(`A project with the name ${highlighter.info(projectName)} already exists.`);
220
213
  logger.error(`Please choose a different name and try again.`);
@@ -242,7 +235,7 @@ async function createProjectFromTemplate(projectPath, options) {
242
235
  try {
243
236
  dotenv.config({ quiet: true });
244
237
  const templatePath = path.join(os.tmpdir(), `bejamas-template-${Date.now()}`);
245
- await fsExtra.ensureDir(templatePath);
238
+ await fs.ensureDir(templatePath);
246
239
  const authToken = process.env.GITHUB_TOKEN || process.env.GH_TOKEN;
247
240
  const usedAuth = Boolean(authToken);
248
241
  const headers = { "User-Agent": "bejamas-cli" };
@@ -254,7 +247,7 @@ async function createProjectFromTemplate(projectPath, options) {
254
247
  throw new Error(`Failed to download template: ${response.status} ${response.statusText}`);
255
248
  }
256
249
  const tarPath = path.resolve(templatePath, "template.tar.gz");
257
- await fsExtra.writeFile(tarPath, Buffer.from(await response.arrayBuffer()));
250
+ await fs.writeFile(tarPath, Buffer.from(await response.arrayBuffer()));
258
251
  const tarSubpath = TEMPLATE_TAR_SUBPATH[options.templateKey];
259
252
  const leafName = tarSubpath.split("/").pop();
260
253
  await execa("tar", [
@@ -266,8 +259,8 @@ async function createProjectFromTemplate(projectPath, options) {
266
259
  tarSubpath
267
260
  ]);
268
261
  const extractedPath = path.resolve(templatePath, leafName);
269
- await fsExtra.move(extractedPath, projectPath);
270
- await fsExtra.remove(templatePath);
262
+ await fs.move(extractedPath, projectPath);
263
+ await fs.remove(templatePath);
271
264
  await execa(options.packageManager, ["install"], { cwd: projectPath });
272
265
  try {
273
266
  const { stdout } = await execa("git", ["rev-parse", "--is-inside-work-tree"], { cwd: projectPath });
@@ -288,11 +281,39 @@ async function createProjectFromTemplate(projectPath, options) {
288
281
  }
289
282
  }
290
283
 
284
+ //#endregion
285
+ //#region src/utils/shadcn-cli.ts
286
+ const require = createRequire(import.meta.url);
287
+ const PINNED_SHADCN_VERSION = "3.8.5";
288
+ const PINNED_SHADCN_PACKAGE = `shadcn@${PINNED_SHADCN_VERSION}`;
289
+ function resolveBundledShadcnEntrypoint() {
290
+ try {
291
+ return require.resolve("shadcn");
292
+ } catch {
293
+ return null;
294
+ }
295
+ }
296
+ function buildPinnedShadcnInvocation(shadcnArgs, bundledEntrypoint = resolveBundledShadcnEntrypoint()) {
297
+ if (bundledEntrypoint) return {
298
+ cmd: process.execPath,
299
+ args: [bundledEntrypoint, ...shadcnArgs],
300
+ source: "bundled"
301
+ };
302
+ return {
303
+ cmd: "npx",
304
+ args: [
305
+ "-y",
306
+ PINNED_SHADCN_PACKAGE,
307
+ ...shadcnArgs
308
+ ],
309
+ source: "fallback"
310
+ };
311
+ }
312
+
291
313
  //#endregion
292
314
  //#region src/commands/init.ts
293
315
  const DEFAULT_REGISTRY_URL$1 = "https://ui.bejamas.com/r";
294
316
  const DEFAULT_COMPONENTS_BASE_COLOR = "neutral";
295
- const SHADCN_INIT_ARGS = ["init"];
296
317
  const initOptionsSchema = z.object({
297
318
  cwd: z.string(),
298
319
  components: z.array(z.string()).optional(),
@@ -310,79 +331,14 @@ const initOptionsSchema = z.object({
310
331
  baseColor: z.string().optional(),
311
332
  baseStyle: z.boolean()
312
333
  });
313
- function buildShadcnInitInvocation(localShadcnPath, hasLocalShadcn, localShadcnVersion) {
314
- if (hasLocalShadcn) {
315
- const args = [...SHADCN_INIT_ARGS];
316
- if (usesLegacyBaseColorFlag(localShadcnVersion)) args.push("--base-color", DEFAULT_COMPONENTS_BASE_COLOR);
317
- return {
318
- cmd: localShadcnPath,
319
- args
320
- };
321
- }
322
- return {
323
- cmd: "npx",
324
- args: [
325
- "-y",
326
- "shadcn@latest",
327
- ...SHADCN_INIT_ARGS
328
- ]
329
- };
330
- }
331
- function usesLegacyBaseColorFlag(version) {
332
- if (!version) return false;
333
- const major = Number.parseInt(version.split(".")[0] ?? "", 10);
334
- return Number.isFinite(major) && major > 0 && major < 4;
335
- }
336
- async function getLocalShadcnVersion(cwd) {
337
- const filePath = path.resolve(cwd, "node_modules", "shadcn", "package.json");
338
- try {
339
- const contents = await promises.readFile(filePath, "utf8");
340
- const parsed = JSON.parse(contents);
341
- return typeof parsed.version === "string" ? parsed.version : null;
342
- } catch {
343
- return null;
344
- }
345
- }
346
- function getDeprecatedBaseColorWarning(baseColor) {
347
- if (!baseColor) return null;
334
+ function buildShadcnInitArgs(baseColor = DEFAULT_COMPONENTS_BASE_COLOR) {
348
335
  return [
349
- "The --base-color option is deprecated and ignored.",
350
- "Bejamas now aligns with shadcn CLI v4.",
351
- `Edit ${highlighter.info("components.json")} to change`,
352
- `${highlighter.info("tailwind.baseColor")} after init.`
353
- ].join(" ");
354
- }
355
- async function normalizeComponentsBaseColor(cwd, baseColor = DEFAULT_COMPONENTS_BASE_COLOR) {
356
- const filePath = path.resolve(cwd, "components.json");
357
- let originalContents;
358
- try {
359
- originalContents = await promises.readFile(filePath, "utf8");
360
- } catch {
361
- throw new Error(`Failed to read ${highlighter.info(filePath)} after shadcn init. Make sure the command completed successfully and created a valid components.json file.`);
362
- }
363
- let parsedConfig;
364
- try {
365
- const parsed = JSON.parse(originalContents);
366
- if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) throw new Error("Expected a JSON object.");
367
- parsedConfig = parsed;
368
- } catch {
369
- throw new Error(`Failed to parse ${highlighter.info(filePath)} after shadcn init. Expected a valid JSON object with a tailwind configuration.`);
370
- }
371
- const tailwind = parsedConfig.tailwind;
372
- if (!tailwind || typeof tailwind !== "object" || Array.isArray(tailwind)) throw new Error(`Invalid ${highlighter.info(filePath)} generated by shadcn init. Expected a ${highlighter.info("tailwind")} object so Bejamas can normalize ${highlighter.info("baseColor")}.`);
373
- const normalizedConfig = {
374
- ...parsedConfig,
375
- tailwind: {
376
- ...tailwind,
377
- baseColor
378
- }
379
- };
380
- const normalizedContents = `${JSON.stringify(normalizedConfig, null, 2)}\n`;
381
- if (normalizedContents === originalContents) return false;
382
- await promises.writeFile(filePath, normalizedContents, "utf8");
383
- return true;
336
+ "init",
337
+ "--base-color",
338
+ baseColor
339
+ ];
384
340
  }
385
- const init = new Command().name("init").description("initialize your project and install dependencies").argument("[components...]", "names, url or local path to component").option("-t, --template <template>", "the template to use. (next, next-monorepo)").option("-b, --base-color <base-color>", "deprecated: accepted for compatibility but ignored. Edit components.json to change tailwind.baseColor.", void 0).option("-y, --yes", "skip confirmation prompt.", true).option("-d, --defaults,", "use default configuration.", false).option("-f, --force", "force overwrite of existing configuration.", false).option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd()).option("-s, --silent", "mute output.", false).option("--src-dir", "use the src directory when creating a new project.", false).option("--no-src-dir", "do not use the src directory when creating a new project.").option("--css-variables", "use css variables for theming.", true).option("--no-css-variables", "do not use css variables for theming.").option("--no-base-style", "do not install the base shadcn style.").action(async (_components, opts) => {
341
+ const init = new Command().name("init").description("initialize your project and install dependencies").argument("[components...]", "names, url or local path to component").option("-t, --template <template>", "the template to use. (next, next-monorepo)").option("-b, --base-color <base-color>", "the base color to use. (neutral, gray, zinc, stone, slate)", void 0).option("-y, --yes", "skip confirmation prompt.", true).option("-d, --defaults,", "use default configuration.", false).option("-f, --force", "force overwrite of existing configuration.", false).option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd()).option("-s, --silent", "mute output.", false).option("--src-dir", "use the src directory when creating a new project.", false).option("--no-src-dir", "do not use the src directory when creating a new project.").option("--css-variables", "use css variables for theming.", true).option("--no-css-variables", "do not use css variables for theming.").option("--no-base-style", "do not install the base shadcn style.").action(async (_components, opts) => {
386
342
  try {
387
343
  await runInit(opts);
388
344
  } catch (error) {
@@ -393,8 +349,6 @@ const init = new Command().name("init").description("initialize your project and
393
349
  }
394
350
  });
395
351
  async function runInit(options) {
396
- const baseColorWarning = getDeprecatedBaseColorWarning(options.baseColor);
397
- if (baseColorWarning && !options.silent) logger.warn(baseColorWarning);
398
352
  let newProjectTemplate;
399
353
  if (!options.skipPreflight) {
400
354
  if ((await preFlightInit(options)).errors[MISSING_DIR_OR_EMPTY_PROJECT]) {
@@ -414,15 +368,12 @@ async function runInit(options) {
414
368
  logger.log(`${highlighter.success("Success!")} Project initialization completed.\nYou may now add components.`);
415
369
  return await getConfig(options.cwd);
416
370
  }
417
- const shadcnBin = process.platform === "win32" ? "shadcn.cmd" : "shadcn";
418
- const localShadcnPath = path.resolve(options.cwd, "node_modules", ".bin", shadcnBin);
419
371
  try {
420
372
  const env = {
421
373
  ...process.env,
422
374
  REGISTRY_URL: process.env.REGISTRY_URL || DEFAULT_REGISTRY_URL$1
423
375
  };
424
- const hasLocalShadcn = await fsExtra.pathExists(localShadcnPath);
425
- const invocation = buildShadcnInitInvocation(localShadcnPath, hasLocalShadcn, hasLocalShadcn ? await getLocalShadcnVersion(options.cwd) : null);
376
+ const invocation = buildPinnedShadcnInvocation(buildShadcnInitArgs(options.baseColor ?? DEFAULT_COMPONENTS_BASE_COLOR));
426
377
  await execa(invocation.cmd, invocation.args, {
427
378
  stdio: "inherit",
428
379
  cwd: options.cwd,
@@ -431,7 +382,6 @@ async function runInit(options) {
431
382
  } catch (err) {
432
383
  process.exit(1);
433
384
  }
434
- await normalizeComponentsBaseColor(options.cwd);
435
385
  }
436
386
 
437
387
  //#endregion
@@ -442,7 +392,7 @@ async function runInit(options) {
442
392
  function readTsConfig(projectRoot) {
443
393
  try {
444
394
  const tsconfigPath = resolve(projectRoot, "tsconfig.json");
445
- if (!existsSync$1(tsconfigPath)) return null;
395
+ if (!existsSync(tsconfigPath)) return null;
446
396
  const raw = readFileSync(tsconfigPath, "utf-8");
447
397
  return JSON.parse(raw);
448
398
  } catch {
@@ -480,7 +430,7 @@ async function generateDocs({ cwd, outDir, verbose }) {
480
430
  let probe = shellCwd;
481
431
  for (let i = 0; i < 6 && probe; i += 1) {
482
432
  const candidate = resolve(probe, "components.json");
483
- if (existsSync$1(candidate)) {
433
+ if (existsSync(candidate)) {
484
434
  projectRoot = probe;
485
435
  try {
486
436
  const raw = readFileSync(candidate, "utf-8");
@@ -534,7 +484,7 @@ async function generateDocs({ cwd, outDir, verbose }) {
534
484
  initial: (() => {
535
485
  let current = shellCwd;
536
486
  for (let i = 0; i < 6; i += 1) {
537
- if (existsSync$1(resolve(current, "packages/ui/package.json"))) {
487
+ if (existsSync(resolve(current, "packages/ui/package.json"))) {
538
488
  const abs = resolve(current, "packages/ui");
539
489
  return relative$1(shellCwd, abs) || abs;
540
490
  }
@@ -542,7 +492,7 @@ async function generateDocs({ cwd, outDir, verbose }) {
542
492
  if (parent === current) break;
543
493
  current = parent;
544
494
  }
545
- if (existsSync$1(resolve(shellCwd, "node_modules/@bejamas/ui/package.json"))) {
495
+ if (existsSync(resolve(shellCwd, "node_modules/@bejamas/ui/package.json"))) {
546
496
  const abs = resolve(shellCwd, "node_modules/@bejamas/ui");
547
497
  return relative$1(shellCwd, abs) || abs;
548
498
  }
@@ -550,7 +500,7 @@ async function generateDocs({ cwd, outDir, verbose }) {
550
500
  })(),
551
501
  validate: (val) => {
552
502
  const p = resolve(shellCwd, val);
553
- return existsSync$1(resolve(p, "package.json")) ? true : `No package.json found in ${p}`;
503
+ return existsSync(resolve(p, "package.json")) ? true : `No package.json found in ${p}`;
554
504
  }
555
505
  });
556
506
  if (!uiRoot) {
@@ -583,7 +533,7 @@ async function generateDocs({ cwd, outDir, verbose }) {
583
533
  if (process.env.BEJAMAS_DOCS_CWD) logger.info(`Docs CWD: ${process.env.BEJAMAS_DOCS_CWD}`);
584
534
  if (process.env.BEJAMAS_DOCS_OUT_DIR) logger.info(`Docs out: ${process.env.BEJAMAS_DOCS_OUT_DIR}`);
585
535
  }
586
- const mod = await import("./generate-mdx-C8gXBOHp.js");
536
+ const mod = await import("./generate-mdx-BejBMCLk.js");
587
537
  if (typeof mod.runDocsGenerator === "function") await mod.runDocsGenerator();
588
538
  else throw new Error("Failed to load docs generator. Export 'runDocsGenerator' not found.");
589
539
  } catch (err) {
@@ -651,7 +601,7 @@ async function checkDocs({ cwd, json }) {
651
601
  let probe = shellCwd;
652
602
  for (let i = 0; i < 6 && probe; i += 1) {
653
603
  const candidate = resolve(probe, "components.json");
654
- if (existsSync$1(candidate)) {
604
+ if (existsSync(candidate)) {
655
605
  projectRoot = probe;
656
606
  try {
657
607
  const raw = readFileSync(candidate, "utf-8");
@@ -690,7 +640,7 @@ async function checkDocs({ cwd, json }) {
690
640
  process.exit(1);
691
641
  }
692
642
  const componentsDir = join$1(uiRoot, "src", "components");
693
- if (!existsSync$1(componentsDir)) {
643
+ if (!existsSync(componentsDir)) {
694
644
  logger.error(`Components directory not found: ${componentsDir}\n\nExpected structure: <uiRoot>/src/components/*.astro\nUse --cwd to specify a different UI package root.`);
695
645
  process.exit(1);
696
646
  }
@@ -814,10 +764,10 @@ async function fixAstroImports(cwd, isVerbose) {
814
764
  dot: false
815
765
  });
816
766
  for (const filePath of astroFiles) {
817
- const original = await fs.readFile(filePath, "utf8");
767
+ const original = await fs$1.readFile(filePath, "utf8");
818
768
  const rewritten = rewriteAstroImports(original, config);
819
769
  if (rewritten === original) continue;
820
- await fs.writeFile(filePath, rewritten, "utf8");
770
+ await fs$1.writeFile(filePath, rewritten, "utf8");
821
771
  if (isVerbose) logger.info(`[bejamas-ui] fixed imports in ${path$1.relative(cwd, filePath)}`);
822
772
  }
823
773
  }
@@ -870,7 +820,7 @@ function getSubfolderFromPaths(files) {
870
820
  */
871
821
  async function pathExists(filePath) {
872
822
  try {
873
- await fs.access(filePath);
823
+ await fs$1.access(filePath);
874
824
  return true;
875
825
  } catch {
876
826
  return false;
@@ -911,7 +861,7 @@ async function reorganizeComponents(components, uiDir, registryUrl, verbose) {
911
861
  if (!await pathExists(flatPath)) continue;
912
862
  if (await pathExists(targetPath)) {
913
863
  try {
914
- await fs.unlink(flatPath);
864
+ await fs$1.unlink(flatPath);
915
865
  result.skippedFiles.push(`${subfolder}/${filename}`);
916
866
  if (verbose) logger.info(`[bejamas-ui] Removed flat duplicate: ${filename} (${subfolder}/${filename} exists)`);
917
867
  } catch {
@@ -919,8 +869,8 @@ async function reorganizeComponents(components, uiDir, registryUrl, verbose) {
919
869
  }
920
870
  continue;
921
871
  }
922
- await fs.mkdir(targetDir, { recursive: true });
923
- await fs.rename(flatPath, targetPath);
872
+ await fs$1.mkdir(targetDir, { recursive: true });
873
+ await fs$1.rename(flatPath, targetPath);
924
874
  movedCount++;
925
875
  result.totalMoved++;
926
876
  result.movedFiles.push(`${subfolder}/${filename}`);
@@ -1129,37 +1079,16 @@ function parseShadcnOutput(stdout, stderr) {
1129
1079
  return result;
1130
1080
  }
1131
1081
  async function addComponents(packages, forwardedOptions, isVerbose, isSilent, subfolderMapResult) {
1132
- const runner = await getPackageRunner(process.cwd());
1133
1082
  const env = {
1134
1083
  ...process.env,
1135
1084
  REGISTRY_URL: process.env.REGISTRY_URL || DEFAULT_REGISTRY_URL
1136
1085
  };
1137
- const autoFlags = [];
1138
- if (!forwardedOptions.includes("--yes")) autoFlags.push("--yes");
1139
- const baseArgs = [
1140
- "shadcn@latest",
1141
- "add",
1142
- ...packages,
1143
- ...autoFlags,
1144
- ...forwardedOptions
1145
- ];
1146
- let cmd = "npx";
1147
- let args = ["-y", ...baseArgs];
1148
- if (runner === "bunx") {
1149
- cmd = "bunx";
1150
- args = baseArgs;
1151
- } else if (runner === "pnpm dlx") {
1152
- cmd = "pnpm";
1153
- args = ["dlx", ...baseArgs];
1154
- } else if (runner === "npx") {
1155
- cmd = "npx";
1156
- args = ["-y", ...baseArgs];
1157
- }
1158
- if (isVerbose) logger.info(`[bejamas-ui] ${cmd} ${args.join(" ")}`);
1086
+ const invocation = buildPinnedShadcnInvocation(buildShadcnAddArgs(packages, forwardedOptions));
1087
+ if (isVerbose) logger.info(`[bejamas-ui] ${invocation.cmd} ${invocation.args.join(" ")}`);
1159
1088
  const registrySpinner = spinner("Checking registry.", { silent: isSilent });
1160
1089
  registrySpinner.start();
1161
1090
  try {
1162
- const result = await execa(cmd, args, {
1091
+ const result = await execa(invocation.cmd, invocation.args, {
1163
1092
  env,
1164
1093
  input: "n\nn\nn\nn\nn\nn\nn\nn\nn\nn\n",
1165
1094
  stdout: "pipe",
@@ -1186,7 +1115,17 @@ async function addComponents(packages, forwardedOptions, isVerbose, isSilent, su
1186
1115
  process.exit(1);
1187
1116
  }
1188
1117
  }
1189
- const add = new Command().name("add").description("Add components via shadcn@latest using registry URLs").argument("[components...]", "Component package names to add").option("-y, --yes", "skip confirmation prompt.", false).option("-o, --overwrite", "overwrite existing files.", false).option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd()).option("-a, --all", "add all available components", false).option("-p, --path <path>", "the path to add the component to.").option("-s, --silent", "mute output.", false).option("--src-dir", "use the src directory when creating a new project.", false).option("--no-src-dir", "do not use the src directory when creating a new project.").action(async function action(packages, _opts, cmd) {
1118
+ function buildShadcnAddArgs(packages, forwardedOptions) {
1119
+ const autoFlags = [];
1120
+ if (!forwardedOptions.includes("--yes")) autoFlags.push("--yes");
1121
+ return [
1122
+ "add",
1123
+ ...packages,
1124
+ ...autoFlags,
1125
+ ...forwardedOptions
1126
+ ];
1127
+ }
1128
+ const add = new Command().name("add").description("Add components via the pinned shadcn registry flow").argument("[components...]", "Component package names to add").option("-y, --yes", "skip confirmation prompt.", false).option("-o, --overwrite", "overwrite existing files.", false).option("-c, --cwd <cwd>", "the working directory. defaults to the current directory.", process.cwd()).option("-a, --all", "add all available components", false).option("-p, --path <path>", "the path to add the component to.").option("-s, --silent", "mute output.", false).option("--src-dir", "use the src directory when creating a new project.", false).option("--no-src-dir", "do not use the src directory when creating a new project.").action(async function action(packages, _opts, cmd) {
1190
1129
  const root = cmd?.parent;
1191
1130
  const verbose = Boolean(root?.opts?.().verbose);
1192
1131
  const forwardedOptions = extractOptionsForShadcn(process.argv.slice(2), cmd);