starwind 1.12.0 → 1.12.2

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
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "starwind",
9
- version: "1.12.0",
9
+ version: "1.12.2",
10
10
  description: "Add beautifully designed components to your Astro applications",
11
11
  license: "MIT",
12
12
  author: {
@@ -56,20 +56,20 @@ var package_default = {
56
56
  },
57
57
  dependencies: {
58
58
  "@clack/prompts": "0.11.0",
59
- "@starwind-ui/core": "1.12.0",
60
- chalk: "5.4.1",
61
- commander: "14.0.0",
59
+ "@starwind-ui/core": "1.12.1",
60
+ chalk: "5.6.2",
61
+ commander: "14.0.2",
62
62
  execa: "9.6.0",
63
- "fs-extra": "11.2.0",
64
- semver: "7.7.2",
63
+ "fs-extra": "11.3.2",
64
+ semver: "7.7.3",
65
65
  zod: "3.25.74"
66
66
  },
67
67
  devDependencies: {
68
68
  "@types/fs-extra": "11.0.4",
69
- "@types/node": "24.0.10",
69
+ "@types/node": "24.10.1",
70
70
  "@types/prompts": "2.4.9",
71
- "@types/semver": "7.5.8",
72
- tsup: "8.5.0"
71
+ "@types/semver": "7.7.1",
72
+ tsup: "8.5.1"
73
73
  },
74
74
  engines: {
75
75
  node: "^20.6.0 || >=22.0.0"
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../package.json","../src/commands/add.ts","../src/utils/constants.ts","../src/utils/fs.ts","../src/utils/config.ts","../src/utils/highlighter.ts","../src/utils/install.ts","../src/utils/component.ts","../src/utils/registry.ts","../src/utils/dependency-resolver.ts","../src/utils/package-manager.ts","../src/utils/prompts.ts","../src/utils/shadcn-config.ts","../src/utils/sleep.ts","../src/utils/validate.ts","../src/commands/init.ts","../src/templates/starwind.css.ts","../src/utils/astro-config.ts","../src/commands/remove.ts","../src/commands/update.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from \"commander\";\n\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { add } from \"./commands/add.js\";\nimport { init } from \"./commands/init.js\";\nimport { remove } from \"./commands/remove.js\";\nimport { update } from \"./commands/update.js\";\n\nconst program = new Command()\n .name(\"starwind\")\n .description(\"Add beautifully designed components to your Astro applications\")\n .version(pkg.version);\n\nprogram\n .command(\"init\")\n .description(\"Initialize your project with Starwind\")\n .option(\"-d, --defaults\", \"Use default values for all prompts\")\n .option(\"-p, --pro\", \"Initialize with Starwind Pro setup\")\n .action((options) => init(false, { defaults: options.defaults, pro: options.pro }));\n\nprogram\n .command(\"add\")\n .description(\"Add Starwind components to your project\")\n .argument(\"[components...]\", \"The components to add (space separated)\")\n .allowExcessArguments()\n .option(\"-a, --all\", \"Add all available components\")\n .action(add);\n\nprogram\n .command(\"update\")\n .description(\"Update Starwind components to their latest versions\")\n .argument(\"[components...]\", \"The components to update (space separated)\")\n .allowExcessArguments()\n .option(\"-a, --all\", \"Update all installed components\")\n .option(\"-y, --yes\", \"Skip confirmation prompts\")\n .action(update);\n\nprogram\n .command(\"remove\")\n .description(\"Remove Starwind components from your project\")\n .argument(\"[components...]\", \"The components to remove (space separated)\")\n .allowExcessArguments()\n .option(\"-a, --all\", \"Remove all installed components\")\n .action(remove);\n\nprogram.parse();\n","{\n \"name\": \"starwind\",\n \"version\": \"1.12.0\",\n \"description\": \"Add beautifully designed components to your Astro applications\",\n \"license\": \"MIT\",\n \"author\": {\n \"name\": \"webreaper\",\n \"url\": \"https://x.com/BowTiedWebReapr\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/starwind-ui/starwind-ui.git\",\n \"directory\": \"packages/cli\"\n },\n \"keywords\": [\n \"starwind\",\n \"starwind ui\",\n \"starwind cli\",\n \"astro\",\n \"astro component\",\n \"astro ui\",\n \"astro ui library\",\n \"tailwind\",\n \"components\",\n \"add component\"\n ],\n \"type\": \"module\",\n \"bin\": {\n \"starwind\": \"./dist/index.js\"\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"cli:link\": \"pnpm link --global\",\n \"cli:unlink\": \"pnpm rm --global starwind\",\n \"test\": \"vitest\",\n \"test:run\": \"vitest run\",\n \"test:coverage\": \"vitest run --coverage\",\n \"typecheck\": \"tsc --noEmit\",\n \"format:check\": \"prettier --check \\\"**/*.{ts,tsx,md,json}\\\"\",\n \"format:write\": \"prettier --write \\\"**/*.{ts,tsx,md,json}\\\" --cache\",\n \"publish:beta\": \"pnpm publish --tag beta --access public\",\n \"publish:next\": \"pnpm publish --tag next --access public\",\n \"publish:release\": \"pnpm publish --access public\"\n },\n \"dependencies\": {\n \"@clack/prompts\": \"0.11.0\",\n \"@starwind-ui/core\": \"1.12.0\",\n \"chalk\": \"5.4.1\",\n \"commander\": \"14.0.0\",\n \"execa\": \"9.6.0\",\n \"fs-extra\": \"11.2.0\",\n \"semver\": \"7.7.2\",\n \"zod\": \"3.25.74\"\n },\n \"devDependencies\": {\n \"@types/fs-extra\": \"11.0.4\",\n \"@types/node\": \"24.0.10\",\n \"@types/prompts\": \"2.4.9\",\n \"@types/semver\": \"7.5.8\",\n \"tsup\": \"8.5.0\"\n },\n \"engines\": {\n \"node\": \"^20.6.0 || >=22.0.0\"\n }\n}\n","import * as p from \"@clack/prompts\";\nimport { execa } from \"execa\";\n\nimport type { InstallResult } from \"@/utils/component.js\";\nimport { getConfig, updateConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { installComponent } from \"@/utils/install.js\";\nimport { getShadcnCommand } from \"@/utils/package-manager.js\";\nimport { selectComponents } from \"@/utils/prompts.js\";\nimport { getAllComponents } from \"@/utils/registry.js\";\nimport { hasStarwindProRegistry, setupShadcnProConfig } from \"@/utils/shadcn-config.js\";\nimport { sleep } from \"@/utils/sleep.js\";\nimport { isValidComponent } from \"@/utils/validate.js\";\n\nimport { init } from \"./init.js\";\n\nexport async function add(components?: string[], options?: { all?: boolean }) {\n try {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n // Check if starwind.config.json exists\n const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n if (!configExists) {\n const shouldInit = await p.confirm({\n message: `Starwind configuration not found. Would you like to run ${highlighter.info(\"starwind init\")} now?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldInit)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n if (shouldInit) {\n await init(true);\n } else {\n p.log.error(\n `Please initialize starwind with ${highlighter.info(\"starwind init\")} before adding components`,\n );\n process.exit(1);\n }\n }\n\n let componentsToInstall: string[] = [];\n const registryComponents: string[] = [];\n let registryResults: { success: string[]; failed: string[] } | null = null;\n\n // ================================================================\n // Get components to install\n // ================================================================\n if (options?.all) {\n // Get all available components\n const availableComponents = await getAllComponents();\n componentsToInstall = availableComponents.map((c) => c.name);\n p.log.info(`Adding all ${componentsToInstall.length} available components...`);\n } else if (components && components.length > 0) {\n // Separate registry components from regular components\n const regularComponents: string[] = [];\n\n for (const component of components) {\n if (component.startsWith(\"@\")) {\n registryComponents.push(component);\n } else {\n regularComponents.push(component);\n }\n }\n\n // Handle registry components (e.g., @starwind-pro/login1)\n if (registryComponents.length > 0) {\n // Check if Starwind Pro registry is configured\n const hasProRegistry = await hasStarwindProRegistry();\n\n if (!hasProRegistry) {\n const shouldSetupPro = await p.confirm({\n message: `Starwind Pro registry not configured. Would you like to set it up now to install ${registryComponents.join(\", \")}?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldSetupPro)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n if (shouldSetupPro) {\n p.log.info(highlighter.info(\"Setting up Starwind Pro configuration...\"));\n\n // Get CSS file and base color from existing config or use defaults\n let cssFile: string = PATHS.LOCAL_CSS_FILE;\n let baseColor: string = \"neutral\";\n\n try {\n const config = await getConfig();\n cssFile = config.tailwind?.css || PATHS.LOCAL_CSS_FILE;\n baseColor = config.tailwind?.baseColor || \"neutral\";\n } catch {\n // Use defaults if config can't be read\n }\n\n await setupShadcnProConfig(cssFile, baseColor);\n p.log.success(\"Starwind Pro registry configured successfully!\");\n } else {\n p.log.error(\"Cannot install registry components without Starwind Pro configuration\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n }\n\n p.log.info(`Installing registry components: ${registryComponents.join(\", \")}`);\n\n const [command, baseArgs] = await getShadcnCommand();\n registryResults = {\n success: [] as string[],\n failed: [] as string[],\n };\n\n for (const registryComponent of registryComponents) {\n try {\n p.log.info(`Installing ${highlighter.info(registryComponent)} via shadcn...`);\n\n await execa(command, [...baseArgs, \"add\", registryComponent], {\n stdio: \"inherit\",\n cwd: process.cwd(),\n });\n\n registryResults.success.push(registryComponent);\n } catch (error) {\n registryResults.failed.push(registryComponent);\n }\n }\n }\n\n // Handle regular Starwind components\n if (regularComponents.length > 0) {\n // Get all available components once to avoid multiple registry calls\n const availableComponents = await getAllComponents();\n\n // Filter valid components and collect invalid ones\n const { valid, invalid } = await regularComponents.reduce<\n Promise<{ valid: string[]; invalid: string[] }>\n >(\n async (accPromise, component) => {\n const acc = await accPromise;\n const isValid = await isValidComponent(component, availableComponents);\n if (isValid) {\n acc.valid.push(component);\n } else {\n acc.invalid.push(component);\n }\n return acc;\n },\n Promise.resolve({ valid: [], invalid: [] }),\n );\n\n // Warn about invalid components\n if (invalid.length > 0) {\n p.log.warn(\n `${highlighter.warn(\"Invalid components found:\")}\\n${invalid\n .map((name) => ` ${name}`)\n .join(\"\\n\")}`,\n );\n }\n\n // Proceed with valid components\n if (valid.length > 0) {\n componentsToInstall = valid;\n } else if (registryComponents.length === 0) {\n p.log.warn(`${highlighter.warn(\"No valid components to install\")}`);\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n }\n } else {\n // If no components provided, show the interactive prompt\n const selected = await selectComponents();\n if (!selected) {\n p.cancel(\"No components selected\");\n return process.exit(0);\n }\n componentsToInstall = selected;\n }\n\n if (componentsToInstall.length === 0 && registryComponents.length === 0) {\n p.log.warn(`${highlighter.warn(\"No components selected\")}`);\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n // If we only have registry components, we still need to show the final summary\n // (removed early return to ensure summary is always shown)\n\n // confirm installation\n // const confirmed = await p.confirm({\n // \tmessage: `Install ${componentsToInstall\n // \t\t.map((comp) => highlighter.info(comp))\n // \t\t.join(\", \")} ${componentsToInstall.length > 1 ? \"components\" : \"component\"}?`,\n // });\n\n // if (!confirmed || p.isCancel(confirmed)) {\n // \tp.cancel(\"Operation cancelled\");\n // \treturn process.exit(0);\n // }\n\n const results = {\n installed: [] as InstallResult[],\n skipped: [] as InstallResult[],\n failed: [] as InstallResult[],\n };\n\n // ================================================================\n // Install components\n // ================================================================\n const installedComponents = [];\n for (const comp of componentsToInstall) {\n const result = await installComponent(comp);\n switch (result.status) {\n case \"installed\":\n results.installed.push(result);\n installedComponents.push({ name: result.name, version: result.version! });\n\n // Add dependency results to the main results\n if (result.dependencyResults) {\n for (const depResult of result.dependencyResults) {\n switch (depResult.status) {\n case \"installed\":\n results.installed.push(depResult);\n break;\n case \"skipped\":\n results.skipped.push(depResult);\n break;\n case \"failed\":\n results.failed.push(depResult);\n break;\n }\n }\n }\n break;\n case \"skipped\":\n results.skipped.push(result);\n break;\n case \"failed\":\n results.failed.push(result);\n\n // Add dependency results to the main results even if main component failed\n if (result.dependencyResults) {\n for (const depResult of result.dependencyResults) {\n switch (depResult.status) {\n case \"installed\":\n results.installed.push(depResult);\n break;\n case \"skipped\":\n results.skipped.push(depResult);\n break;\n case \"failed\":\n results.failed.push(depResult);\n break;\n }\n }\n }\n break;\n }\n }\n\n // ================================================================\n // Update Config File\n // ================================================================\n if (installedComponents.length > 0) {\n try {\n await updateConfig({ components: installedComponents }, { appendComponents: true });\n } catch (error) {\n p.log.error(\n `Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n process.exit(1);\n }\n }\n\n // ================================================================\n // Installation summary\n // ================================================================\n p.log.message(`\\n\\n${highlighter.underline(\"Installation Summary\")}`);\n\n if (results.failed.length > 0) {\n p.log.error(\n `${highlighter.error(\"Failed to install components:\")}\\n${results.failed\n .map((r) => ` ${r.name} - ${r.error}`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.skipped.length > 0) {\n p.log.warn(\n `${highlighter.warn(\"Skipped components (already installed):\")}\\n${results.skipped\n .map((r) => ` ${r.name} v${r.version}`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.installed.length > 0) {\n p.log.success(\n `${highlighter.success(\"Successfully installed components:\")}\n${results.installed.map((r) => ` ${r.name} v${r.version}`).join(\"\\n\")}`,\n );\n }\n\n // Show registry component results in the final summary\n if (registryResults) {\n if (registryResults.failed.length > 0) {\n p.log.error(\n `${highlighter.error(\"Failed to install registry components:\")}\n${registryResults.failed\n .map((name) => ` ${name} - see the error message above for further details`)\n .join(\"\\n\")}`,\n );\n }\n\n if (registryResults.success.length > 0) {\n p.log.success(\n `${highlighter.success(\"Successfully installed registry components:\")}\n${registryResults.success.map((name) => ` ${name}`).join(\"\\n\")}`,\n );\n }\n }\n\n await sleep(1000);\n\n p.outro(\"Enjoy using Starwind UI 🚀\");\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to add components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n","export const MIN_ASTRO_VERSION = \"5.0.0\";\n\n/**\n * File system paths used throughout the application\n */\nexport const PATHS = {\n STARWIND_CORE: \"@starwind-ui/core\",\n STARWIND_CORE_COMPONENTS: \"src/components\",\n STARWIND_REMOTE_COMPONENT_REGISTRY: \"https://starwind.dev/registry.json\",\n STARWIND_PRO_REGISTRY: \"https://pro.starwind.dev/r/{name}\",\n LOCAL_CSS_FILE: \"src/styles/starwind.css\",\n LOCAL_CONFIG_FILE: \"starwind.config.json\",\n LOCAL_STYLES_DIR: \"src/styles\",\n LOCAL_COMPONENTS_DIR: \"src/components\",\n} as const;\n\n/**\n * Core framework dependencies\n */\nexport const ASTRO_PACKAGES = {\n core: \"astro@latest\",\n} as const;\n\n/**\n * Tailwind CSS and other dependencies\n */\nexport const OTHER_PACKAGES = {\n tailwindCore: \"tailwindcss@^4\",\n tailwindVite: \"@tailwindcss/vite@^4\",\n tailwindForms: \"@tailwindcss/forms@^0.5\",\n tailwindAnimate: \"tw-animate-css@^1\",\n tailwindVariants: \"tailwind-variants@^3\",\n tailwindMerge: \"tailwind-merge@^3\",\n tablerIcons: \"@tabler/icons@^3\",\n} as const;\n\n/**\n * Get all Tailwind CSS related packages as an array\n */\nexport function getOtherPackages(): string[] {\n return Object.values(OTHER_PACKAGES);\n}\n\n/**\n * Get all Astro related packages as an array\n */\nexport function getAstroPackages(): string[] {\n return Object.values(ASTRO_PACKAGES);\n}\n","import fs from \"fs-extra\";\n\n/**\n * Ensures a directory exists, creating it and its parents if necessary\n * @param dir - Directory path to ensure exists\n */\nexport async function ensureDirectory(dir: string) {\n await fs.ensureDir(dir);\n}\n\n/**\n * Copies a file from source to destination\n * @param src - Source file path\n * @param dest - Destination file path\n */\nexport async function copyFile(src: string, dest: string) {\n await fs.copy(src, dest);\n}\n\n/**\n * Reads and parses a JSON file\n * @param filePath - Path to the JSON file\n * @returns Parsed JSON content\n */\nexport async function readJsonFile(filePath: string) {\n return fs.readJson(filePath);\n}\n\n/**\n * Writes data to a JSON file\n * @param filePath - Path to write the JSON file\n * @param data - Data to write to the file\n */\nexport async function writeJsonFile(filePath: string, data: unknown) {\n await fs.writeJson(filePath, data, { spaces: 2 });\n}\n\n/**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if the file exists, false otherwise\n */\nexport async function fileExists(filePath: string) {\n return fs.pathExists(filePath);\n}\n\n/**\n * Creates a CSS file with the provided content\n * @param filePath - Path to write the CSS file\n * @param content - CSS content to write\n */\nexport async function writeCssFile(filePath: string, content: string) {\n await fs.writeFile(filePath, content, \"utf-8\");\n}\n","import { PATHS } from \"./constants.js\";\nimport { fileExists, readJsonFile, writeJsonFile } from \"./fs.js\";\n\ninterface ComponentConfig {\n name: string;\n version: string;\n}\n\ninterface TailwindConfig {\n css: string;\n baseColor: \"slate\" | \"gray\" | \"zinc\" | \"neutral\" | \"stone\";\n cssVariables: boolean;\n}\n\n// interface AliasConfig {\n// \tcomponents: string;\n// }\n\nexport interface StarwindConfig {\n $schema: string;\n tailwind: TailwindConfig;\n // aliases: AliasConfig;\n componentDir: string;\n components: ComponentConfig[];\n}\n\nconst defaultConfig: StarwindConfig = {\n $schema: \"https://starwind.dev/config-schema.json\",\n tailwind: {\n css: \"src/styles/starwind.css\",\n baseColor: \"neutral\",\n cssVariables: true,\n },\n // aliases: {\n // \tcomponents: \"@/components\",\n // },\n componentDir: \"src/components/starwind\",\n components: [],\n};\n\n/**\n * Get the current config, ensuring the file is fully read\n */\nexport async function getConfig(): Promise<StarwindConfig> {\n try {\n if (await fileExists(PATHS.LOCAL_CONFIG_FILE)) {\n const config = await readJsonFile(PATHS.LOCAL_CONFIG_FILE);\n return {\n ...defaultConfig,\n ...config,\n components: Array.isArray(config.components) ? config.components : [],\n };\n }\n } catch (error) {\n console.error(\"Error reading config:\", error);\n }\n\n return defaultConfig;\n}\n\n/**\n * Options for updating the config file\n */\nexport interface UpdateConfigOptions {\n /** If true, append new components to existing array. If false, replace the components array. */\n appendComponents?: boolean;\n}\n\n/**\n * Update the config file, ensuring the write operation is completed\n * @param updates - Partial config object to update\n * @param options - Options for updating the config\n */\nexport async function updateConfig(\n updates: Partial<StarwindConfig>,\n options: UpdateConfigOptions = { appendComponents: true },\n): Promise<void> {\n const currentConfig = await getConfig();\n\n // Ensure components array exists\n const currentComponents = Array.isArray(currentConfig.components) ? currentConfig.components : [];\n\n const newConfig = {\n ...currentConfig,\n tailwind: {\n ...currentConfig.tailwind,\n ...(updates.tailwind || {}),\n },\n componentDir: updates.componentDir ? updates.componentDir : currentConfig.componentDir,\n components: updates.components\n ? options.appendComponents\n ? [...currentComponents, ...updates.components]\n : updates.components\n : currentComponents,\n };\n\n try {\n await writeJsonFile(PATHS.LOCAL_CONFIG_FILE, newConfig);\n } catch (error) {\n throw new Error(\n `Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n }\n}\n","import chalk from \"chalk\";\n\nexport const highlighter = {\n error: chalk.red,\n warn: chalk.yellow,\n info: chalk.cyan,\n infoBright: chalk.cyanBright,\n success: chalk.greenBright,\n underline: chalk.underline,\n title: chalk.bgBlue,\n};\n","import * as p from \"@clack/prompts\";\n\nimport { copyComponent, type InstallResult } from \"./component.js\";\nimport { getConfig, updateConfig } from \"./config.js\";\nimport {\n type DependencyResolution,\n filterUninstalledDependencies,\n separateDependencies,\n} from \"./dependency-resolver.js\";\nimport { highlighter } from \"./highlighter.js\";\nimport { installDependencies, requestPackageManager } from \"./package-manager.js\";\nimport { confirmInstall, getStarwindDependencyResolutions } from \"./prompts.js\";\nimport { getComponent } from \"./registry.js\";\n\nexport async function installComponent(name: string): Promise<InstallResult> {\n const component = await getComponent(name);\n\n if (!component) {\n return {\n status: \"failed\",\n name,\n error: \"Component not found in registry\",\n };\n }\n\n // Initialize dependency results\n let dependencyResults: InstallResult[] = [];\n\n // Handle dependencies installation\n if (component.dependencies.length > 0) {\n const confirmed = await confirmInstall(component);\n if (!confirmed) {\n return {\n status: \"failed\",\n name,\n error: \"Installation cancelled by user\",\n };\n }\n\n const { starwindDependencies, npmDependencies } = separateDependencies(component.dependencies);\n\n // Install npm dependencies\n if (npmDependencies.length > 0) {\n try {\n // Filter out already installed dependencies with valid versions\n const dependenciesToInstall = await filterUninstalledDependencies(npmDependencies);\n\n if (dependenciesToInstall.length > 0) {\n const pm = await requestPackageManager();\n\n const installTasks = [\n {\n title: `Installing ${dependenciesToInstall.length === 1 ? \"dependency\" : \"dependencies\"}`,\n task: async () => {\n await installDependencies(dependenciesToInstall, pm);\n return `${highlighter.info(\"Dependencies installed successfully\")}`;\n },\n },\n ];\n\n await p.tasks(installTasks);\n } else {\n // All dependencies are already installed with valid versions\n p.log.info(\n `${highlighter.info(\"All npm dependencies are already installed with valid versions\")}`,\n );\n }\n } catch (error) {\n return {\n status: \"failed\",\n name,\n error: `Failed to install npm dependencies: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n }\n\n // Install Starwind component dependencies\n if (starwindDependencies.length > 0) {\n let resolutions: DependencyResolution[] = [];\n try {\n resolutions = await getStarwindDependencyResolutions([name]);\n } catch (error) {\n console.warn(\n \"Proceeding without Starwind dependency installs due to resolution error:\",\n error,\n );\n resolutions = [];\n }\n\n if (resolutions.length > 0) {\n const installResults = await installStarwindDependencies(resolutions);\n dependencyResults = installResults;\n\n // Check if any dependency installation failed\n const failedDeps = installResults.filter((r: InstallResult) => r.status === \"failed\");\n if (failedDeps.length > 0) {\n return {\n status: \"failed\",\n name,\n error: `Failed to install Starwind dependencies: ${failedDeps.map((r: InstallResult) => r.name).join(\", \")}`,\n dependencyResults,\n };\n }\n }\n }\n }\n\n // Copy the component files\n const result = await copyComponent(name);\n\n // Include dependency results if any\n if (dependencyResults.length > 0) {\n return {\n ...result,\n dependencyResults,\n };\n }\n\n return result;\n}\n\n/**\n * Installs Starwind component dependencies based on dependency resolutions\n * @param resolutions - Array of dependency resolutions\n * @returns Promise<InstallResult[]> - Array of installation results\n */\nexport async function installStarwindDependencies(\n resolutions: DependencyResolution[],\n): Promise<InstallResult[]> {\n const results: InstallResult[] = [];\n const componentsToInstall: Array<{ name: string; version: string }> = [];\n const componentsToUpdate: Array<{ name: string; version: string }> = [];\n\n for (const resolution of resolutions) {\n if (resolution.needsInstall) {\n // Install the component\n const result = await copyComponent(resolution.component);\n results.push(result);\n\n if (result.status === \"installed\" && result.version) {\n componentsToInstall.push({ name: result.name, version: result.version });\n }\n } else if (resolution.needsUpdate) {\n // Update the component\n const result = await copyComponent(resolution.component, true); // overwrite = true\n results.push(result);\n\n if (result.status === \"installed\" && result.version) {\n componentsToUpdate.push({ name: result.name, version: result.version });\n }\n }\n }\n\n // Update config with newly installed components (append)\n if (componentsToInstall.length > 0) {\n try {\n await updateConfig({ components: componentsToInstall }, { appendComponents: true });\n } catch (error) {\n console.error(\"Failed to update config after installing new dependencies:\", error);\n }\n }\n\n // Update config with updated components (replace existing entries)\n if (componentsToUpdate.length > 0) {\n try {\n await updateExistingComponents(componentsToUpdate);\n } catch (error) {\n console.error(\"Failed to update config after updating dependencies:\", error);\n }\n }\n\n return results;\n}\n\n/**\n * Updates existing components in the config by replacing their versions\n * @param componentsToUpdate - Array of components with their new versions\n */\nasync function updateExistingComponents(\n componentsToUpdate: Array<{ name: string; version: string }>,\n): Promise<void> {\n const config = await getConfig();\n const updatedComponents = [...config.components];\n\n // Update existing components or add new ones\n for (const componentUpdate of componentsToUpdate) {\n const existingIndex = updatedComponents.findIndex((comp) => comp.name === componentUpdate.name);\n\n if (existingIndex >= 0) {\n // Update existing component version\n updatedComponents[existingIndex] = {\n name: componentUpdate.name,\n version: componentUpdate.version,\n };\n } else {\n // Add new component if not found (shouldn't happen in update case, but safety net)\n updatedComponents.push(componentUpdate);\n }\n }\n\n // Replace the entire components array\n await updateConfig({ components: updatedComponents }, { appendComponents: false });\n}\n","import * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport * as p from \"@clack/prompts\";\nimport fs from \"fs-extra\";\nimport semver from \"semver\";\n\nimport { getConfig } from \"./config.js\";\nimport { PATHS } from \"./constants.js\";\nimport { highlighter } from \"./highlighter.js\";\nimport { getComponent, getRegistry } from \"./registry.js\";\n\nexport type InstallResult = {\n status: \"installed\" | \"skipped\" | \"failed\";\n name: string;\n version?: string;\n error?: string;\n dependencyResults?: InstallResult[];\n};\n\nexport interface RemoveResult {\n name: string;\n status: \"removed\" | \"failed\";\n error?: string;\n}\n\nexport interface UpdateResult {\n name: string;\n status: \"updated\" | \"skipped\" | \"failed\";\n oldVersion?: string;\n newVersion?: string;\n error?: string;\n}\n\n/**\n * Copies a component from the core package to the local components directory\n * @param name - The name of the component to copy\n * @param overwrite - If true, will overwrite existing component instead of skipping\n * @returns A result object indicating the installation status\n */\nexport async function copyComponent(name: string, overwrite = false): Promise<InstallResult> {\n const config = await getConfig();\n\n // Ensure components array exists\n const currentComponents = Array.isArray(config.components) ? config.components : [];\n\n // Check if component already exists\n if (!overwrite && currentComponents.some((component) => component.name === name)) {\n const existingComponent = currentComponents.find((c) => c.name === name);\n return {\n status: \"skipped\",\n name,\n version: existingComponent?.version,\n };\n }\n\n const componentDir = path.join(config.componentDir, \"starwind\", name);\n\n try {\n await fs.ensureDir(componentDir);\n\n // Get the path to the installed @starwind/core package\n const pkgUrl = import.meta.resolve?.(PATHS.STARWIND_CORE);\n if (!pkgUrl) {\n throw new Error(`Could not resolve ${PATHS.STARWIND_CORE} package, is it installed?`);\n }\n\n const coreDir = path.dirname(fileURLToPath(pkgUrl));\n const sourceDir = path.join(coreDir, PATHS.STARWIND_CORE_COMPONENTS, name);\n\n const files = await fs.readdir(sourceDir);\n\n for (const file of files) {\n const sourcePath = path.join(sourceDir, file);\n const destPath = path.join(componentDir, file);\n await fs.copy(sourcePath, destPath, { overwrite: true });\n }\n\n // Get component version from registry\n const registry = await getRegistry();\n const componentInfo = registry.find((c) => c.name === name);\n if (!componentInfo) {\n throw new Error(`Component ${name} not found in registry`);\n }\n\n return {\n status: \"installed\",\n name,\n version: componentInfo.version,\n };\n } catch (error) {\n return {\n status: \"failed\",\n name,\n error: error instanceof Error ? error.message : \"Unknown error\",\n };\n }\n}\n\n/**\n * Removes a component from the project's component directory\n * @param name - The name of the component to remove\n * @param componentDir - The base directory where components are installed\n * @returns A result object indicating the removal status and any errors\n */\nexport async function removeComponent(name: string, componentDir: string): Promise<RemoveResult> {\n try {\n const componentPath = path.join(componentDir, \"starwind\", name);\n\n // Check if component directory exists\n if (await fs.pathExists(componentPath)) {\n // Remove the component directory\n await fs.remove(componentPath);\n return { name, status: \"removed\" };\n } else {\n return {\n name,\n status: \"failed\",\n error: \"Component directory not found\",\n };\n }\n } catch (error) {\n return {\n name,\n status: \"failed\",\n error: error instanceof Error ? error.message : \"Unknown error\",\n };\n }\n}\n\n/**\n * Updates a component to its latest version from the registry\n * @param name - The name of the component to update\n * @param currentVersion - The currently installed version\n * @param skipConfirm - If true, skips the confirmation prompt\n * @returns A result object indicating the update status\n */\nexport async function updateComponent(\n name: string,\n currentVersion: string,\n skipConfirm?: boolean,\n): Promise<UpdateResult> {\n try {\n // Get latest version from registry\n const registryComponent = await getComponent(name);\n if (!registryComponent) {\n return {\n name,\n status: \"failed\",\n error: \"Component not found in registry\",\n };\n }\n\n // Compare versions\n if (!semver.gt(registryComponent.version, currentVersion)) {\n return {\n name,\n status: \"skipped\",\n oldVersion: currentVersion,\n newVersion: registryComponent.version,\n };\n }\n\n // Confirm the component update with warning about overriding, unless skipConfirm is true\n let confirmUpdate = true; // Default to true if skipping confirmation\n if (!skipConfirm) {\n // Only prompt if skipConfirm is false or undefined\n const confirmedResult = await p.confirm({\n message: `Update component ${highlighter.info(\n name,\n )} from ${highlighter.warn(`v${currentVersion}`)} to ${highlighter.success(\n `v${registryComponent.version}`,\n )}? This will override the existing implementation.`,\n });\n\n // Check for cancellation immediately\n if (p.isCancel(confirmedResult)) {\n p.cancel(\"Update cancelled.\");\n return {\n name,\n status: \"skipped\",\n oldVersion: currentVersion,\n newVersion: registryComponent.version, // Still useful to return the target version\n };\n }\n\n // If not cancelled, confirmedResult is boolean. Assign it.\n confirmUpdate = confirmedResult;\n }\n\n // Now confirmUpdate is guaranteed to be boolean, proceed with the check\n if (!confirmUpdate) {\n // Handle non-confirmation ('No' was selected)\n p.log.info(`Skipping update for ${highlighter.info(name)}`);\n return {\n name,\n status: \"skipped\",\n oldVersion: currentVersion,\n newVersion: registryComponent.version,\n };\n }\n\n // Remove and reinstall component with overwrite enabled\n const result = await copyComponent(name, true);\n\n if (result.status === \"installed\") {\n return {\n name,\n status: \"updated\",\n oldVersion: currentVersion,\n newVersion: result.version,\n };\n } else {\n return {\n name,\n status: \"failed\",\n error: result.error || \"Failed to update component\",\n };\n }\n } catch (error) {\n return {\n name,\n status: \"failed\",\n error: error instanceof Error ? error.message : \"Unknown error\",\n };\n }\n}\n","import { registry as localRegistry } from \"@starwind-ui/core\";\nimport { z } from \"zod\";\n\nimport { PATHS } from \"./constants.js\";\n\n// Configuration to select registry source\nconst REGISTRY_CONFIG = {\n // Set to 'remote' to fetch from remote server or 'local' to use the imported registry\n SOURCE: \"local\" as \"remote\" | \"local\",\n};\n\nconst componentSchema = z.object({\n name: z.string(),\n version: z.string(),\n dependencies: z.array(z.string()).default([]),\n type: z.enum([\"component\"]),\n});\n\nexport type Component = z.infer<typeof componentSchema>;\n\n// Schema for the root registry object\nconst registryRootSchema = z.object({\n $schema: z.string().optional(),\n components: z.array(componentSchema),\n});\n\n// Cache for registry data - stores the promise of fetching to avoid multiple simultaneous requests\nconst registryCache = new Map<string, Promise<Component[]>>();\n\n/**\n * Fetches the component registry from either the remote server or the local import\n * @param forceRefresh Whether to force a refresh of the cache\n * @returns A promise that resolves to an array of Components\n */\nexport async function getRegistry(forceRefresh = false): Promise<Component[]> {\n const cacheKey =\n REGISTRY_CONFIG.SOURCE === \"remote\"\n ? PATHS.STARWIND_REMOTE_COMPONENT_REGISTRY\n : \"local-registry\";\n\n // Return cached promise if available and refresh not forced\n if (!forceRefresh && registryCache.has(cacheKey)) {\n return registryCache.get(cacheKey)!;\n }\n\n // Create a new promise for the registry operation based on source\n const registryPromise =\n REGISTRY_CONFIG.SOURCE === \"remote\"\n ? fetchRemoteRegistry()\n : Promise.resolve(getLocalRegistry());\n\n // Cache the promise\n registryCache.set(cacheKey, registryPromise);\n\n return registryPromise;\n}\n\n/**\n * Internal function to fetch the registry from the remote server\n */\nasync function fetchRemoteRegistry(): Promise<Component[]> {\n try {\n const response = await fetch(PATHS.STARWIND_REMOTE_COMPONENT_REGISTRY);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch registry: ${response.status} ${response.statusText}`);\n }\n\n const data = await response.json();\n const parsedRegistry = registryRootSchema.parse(data);\n\n return parsedRegistry.components;\n } catch (error) {\n console.error(\"Failed to load remote registry:\", error);\n throw error;\n }\n}\n\n/**\n * Internal function to get the registry from the local import\n */\nfunction getLocalRegistry(): Component[] {\n try {\n // Validate the local registry with the schema\n const components = localRegistry.map((comp) => componentSchema.parse(comp));\n return components;\n } catch (error) {\n console.error(\"Failed to validate local registry:\", error);\n throw error;\n }\n}\n\n/**\n * Clear the registry cache\n */\nexport function clearRegistryCache(): void {\n registryCache.clear();\n}\n\n/**\n * Get a component by name from the registry\n * @param name The name of the component to find\n * @param forceRefresh Whether to force a refresh of the registry cache\n * @returns The component or undefined if not found\n */\nexport async function getComponent(\n name: string,\n forceRefresh = false,\n): Promise<Component | undefined> {\n const registry = await getRegistry(forceRefresh);\n return registry.find((component) => component.name === name);\n}\n\n/**\n * Get all components from the registry\n * @param forceRefresh Whether to force a refresh of the registry cache\n * @returns All components in the registry\n */\nexport async function getAllComponents(forceRefresh = false): Promise<Component[]> {\n return getRegistry(forceRefresh);\n}\n\n/**\n * Set the registry source\n * @param source The source to use: 'remote' or 'local'\n */\nexport function setRegistrySource(source: \"remote\" | \"local\"): void {\n if (REGISTRY_CONFIG.SOURCE !== source) {\n REGISTRY_CONFIG.SOURCE = source;\n clearRegistryCache(); // Clear cache when changing sources\n }\n}\n","import semver from \"semver\";\n\nimport { getConfig } from \"./config.js\";\nimport { readJsonFile } from \"./fs.js\";\nimport { getComponent } from \"./registry.js\";\n\n/**\n * Checks if npm dependencies are already installed with valid versions\n * @param dependencies - Array of dependency strings (e.g., [\"react@^18.0.0\", \"typescript@^5.0.0\"])\n * @returns Array of dependencies that need to be installed\n */\nexport async function filterUninstalledDependencies(dependencies: string[]): Promise<string[]> {\n try {\n const pkg = await readJsonFile(\"package.json\");\n const installedDeps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };\n\n const dependenciesToInstall: string[] = [];\n\n for (const dep of dependencies) {\n let packageName: string;\n let requiredVersion: string;\n\n // Handle scoped packages properly (e.g., \"@scope/name@^1.2.3\")\n if (dep.startsWith(\"@\")) {\n // For scoped packages, find the last \"@\" to split package name and version\n const lastAtIndex = dep.lastIndexOf(\"@\");\n if (lastAtIndex > 0) {\n packageName = dep.substring(0, lastAtIndex);\n requiredVersion = dep.substring(lastAtIndex + 1);\n } else {\n // No version specified for scoped package\n packageName = dep;\n requiredVersion = \"*\";\n }\n } else {\n // For non-scoped packages, split on first \"@\"\n const atIndex = dep.indexOf(\"@\");\n if (atIndex > 0) {\n packageName = dep.substring(0, atIndex);\n requiredVersion = dep.substring(atIndex + 1);\n } else {\n // No version specified\n packageName = dep;\n requiredVersion = \"*\";\n }\n }\n\n const installedVersion = installedDeps[packageName];\n\n if (!installedVersion) {\n // Package not installed, needs installation\n dependenciesToInstall.push(dep);\n } else if (requiredVersion && requiredVersion !== \"*\") {\n // Check if installed version satisfies required version\n // Clean the installed version using semver.clean or manual prefix removal\n const cleanInstalledVersion =\n semver.clean(installedVersion) || installedVersion.replace(/^[\\^~>=<= ]+/, \"\");\n\n try {\n if (!semver.satisfies(cleanInstalledVersion, requiredVersion)) {\n dependenciesToInstall.push(dep);\n }\n } catch (error) {\n // If semver comparison fails, assume we need to install\n dependenciesToInstall.push(dep);\n }\n }\n // If no version specified or version satisfies, skip installation\n }\n\n return dependenciesToInstall;\n } catch (error) {\n // If we can't read package.json, install all dependencies\n return dependencies;\n }\n}\n\nexport interface StarwindDependency {\n name: string;\n version: string;\n originalSpec: string;\n}\n\nexport interface DependencyResolution {\n component: string;\n currentVersion?: string;\n requiredVersion: string;\n needsInstall: boolean;\n needsUpdate: boolean;\n isStarwindComponent: boolean;\n}\n\n/**\n * Parses a Starwind component dependency string\n * @param dependency - Dependency string like \"@starwind-ui/core/button@^2.1.0\"\n * @returns Parsed dependency object or null if not a Starwind component\n */\nexport function parseStarwindDependency(dependency: string): StarwindDependency | null {\n const starwindPattern = /^@starwind-ui\\/core\\/([^@]+)@(.+)$/;\n const match = dependency.match(starwindPattern);\n\n if (!match) {\n return null;\n }\n\n const [, name, version] = match;\n return {\n name,\n version,\n originalSpec: dependency,\n };\n}\n\n/**\n * Checks if a dependency is a Starwind component dependency\n * @param dependency - Dependency string to check\n * @returns True if it's a Starwind component dependency\n */\nexport function isStarwindDependency(dependency: string): boolean {\n return parseStarwindDependency(dependency) !== null;\n}\n\n/**\n * Gets the currently installed version of a Starwind component\n * @param componentName - Name of the component to check\n * @returns Version string if installed, undefined if not installed\n */\nexport async function getInstalledComponentVersion(\n componentName: string,\n): Promise<string | undefined> {\n try {\n const config = await getConfig();\n const installedComponent = config.components.find((comp) => comp.name === componentName);\n return installedComponent?.version;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Resolves a single Starwind component dependency\n * @param dependency - Dependency string to resolve\n * @returns Resolution information for the dependency\n */\nexport async function resolveStarwindDependency(\n dependency: string,\n): Promise<DependencyResolution | null> {\n const parsed = parseStarwindDependency(dependency);\n\n if (!parsed) {\n return {\n component: dependency,\n requiredVersion: \"\",\n needsInstall: false,\n needsUpdate: false,\n isStarwindComponent: false,\n };\n }\n\n const currentVersion = await getInstalledComponentVersion(parsed.name);\n const registryComponent = await getComponent(parsed.name);\n\n if (!registryComponent) {\n throw new Error(`Starwind component \"${parsed.name}\" not found in registry`);\n }\n\n let needsInstall = false;\n let needsUpdate = false;\n\n if (!currentVersion) {\n // Component not installed\n needsInstall = true;\n } else {\n // Component is installed, check if version satisfies requirement\n if (!semver.satisfies(currentVersion, parsed.version)) {\n // Current version doesn't satisfy requirement\n // Check if registry version satisfies requirement\n if (semver.satisfies(registryComponent.version, parsed.version)) {\n needsUpdate = true;\n } else {\n throw new Error(\n `No version of \"${parsed.name}\" satisfies requirement \"${parsed.version}\". ` +\n `Latest available: ${registryComponent.version}, currently installed: ${currentVersion}`,\n );\n }\n }\n }\n\n return {\n component: parsed.name,\n currentVersion,\n requiredVersion: parsed.version,\n needsInstall,\n needsUpdate,\n isStarwindComponent: true,\n };\n}\n\n/**\n * Recursively resolves all Starwind component dependencies\n * @param componentNames - Array of component names to resolve dependencies for\n * @param resolved - Set of already resolved components to avoid circular dependencies\n * @returns Array of dependency resolutions\n */\nexport async function resolveAllStarwindDependencies(\n componentNames: string[],\n resolved: Set<string> = new Set(),\n): Promise<DependencyResolution[]> {\n const resolutions: DependencyResolution[] = [];\n\n for (const componentName of componentNames) {\n if (resolved.has(componentName)) {\n continue;\n }\n\n resolved.add(componentName);\n\n const component = await getComponent(componentName);\n if (!component) {\n throw new Error(`Component \"${componentName}\" not found in registry`);\n }\n\n // Process dependencies of this component\n for (const dependency of component.dependencies) {\n const resolution = await resolveStarwindDependency(dependency);\n\n if (resolution && resolution.isStarwindComponent) {\n // Add this dependency to resolutions if it needs action\n if (resolution.needsInstall || resolution.needsUpdate) {\n resolutions.push(resolution);\n }\n\n // Recursively resolve dependencies of this dependency\n const nestedResolutions = await resolveAllStarwindDependencies(\n [resolution.component],\n resolved,\n );\n resolutions.push(...nestedResolutions);\n }\n }\n }\n\n // Remove duplicates and prioritize installs over updates\n const uniqueResolutions = new Map<string, DependencyResolution>();\n\n for (const resolution of resolutions) {\n const existing = uniqueResolutions.get(resolution.component);\n\n if (!existing) {\n uniqueResolutions.set(resolution.component, resolution);\n } else {\n // If we have both install and update for same component, prioritize install\n if (resolution.needsInstall && !existing.needsInstall) {\n uniqueResolutions.set(resolution.component, resolution);\n }\n }\n }\n\n return Array.from(uniqueResolutions.values());\n}\n\n/**\n * Separates regular npm dependencies from Starwind component dependencies\n * @param dependencies - Array of dependency strings\n * @returns Object with separated dependencies\n */\nexport function separateDependencies(dependencies: string[]): {\n starwindDependencies: string[];\n npmDependencies: string[];\n} {\n const starwindDependencies: string[] = [];\n const npmDependencies: string[] = [];\n\n for (const dependency of dependencies) {\n if (isStarwindDependency(dependency)) {\n starwindDependencies.push(dependency);\n } else {\n npmDependencies.push(dependency);\n }\n }\n\n return { starwindDependencies, npmDependencies };\n}\n","import * as p from \"@clack/prompts\";\nimport { execa } from \"execa\";\n\nimport { fileExists } from \"./fs.js\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\n/**\n * Prompts the user to select their preferred package manager\n * @returns The selected package manager, defaults to npm if cancelled\n */\nexport async function requestPackageManager(): Promise<PackageManager> {\n const pm = await p.select({\n message: \"Select your preferred package manager\",\n options: [\n { value: \"pnpm\", label: \"pnpm\", hint: \"Default\" },\n { value: \"npm\", label: \"npm\" },\n { value: \"yarn\", label: \"yarn\" },\n { value: \"bun\", label: \"bun\" },\n ],\n });\n\n if (p.isCancel(pm)) {\n p.log.warn(\"No package manager selected, defaulting to npm\");\n return \"npm\";\n }\n\n return pm as PackageManager;\n}\n\n/**\n * Detects the currently running package manager from user agent\n * @returns The detected package manager, or null if not detected\n */\nexport function getCurrentPackageManager(): PackageManager | null {\n const userAgent = process.env.npm_config_user_agent;\n\n if (userAgent) {\n if (userAgent.includes(\"pnpm\")) {\n return \"pnpm\";\n } else if (userAgent.includes(\"yarn\")) {\n return \"yarn\";\n } else if (userAgent.includes(\"npm\")) {\n return \"npm\";\n } else if (userAgent.includes(\"bun\")) {\n return \"bun\";\n }\n }\n\n return null;\n}\n\n/**\n * Detects and returns the default package manager based on lock files\n * @returns The detected package manager, defaults to npm if no lock file is found\n */\nexport async function getDefaultPackageManager(): Promise<PackageManager> {\n // First try to detect the currently running package manager\n const current = getCurrentPackageManager();\n if (current) {\n return current;\n }\n\n // Fallback to lock file detection\n if (await fileExists(\"yarn.lock\")) {\n return \"yarn\";\n } else if (await fileExists(\"pnpm-lock.yaml\")) {\n return \"pnpm\";\n } else {\n return \"npm\";\n }\n}\n\n/**\n * Gets the appropriate command to run shadcn with the detected package manager\n * @returns The command array for execa\n */\nexport async function getShadcnCommand(): Promise<[string, string[]]> {\n const pm = await getDefaultPackageManager();\n\n switch (pm) {\n case \"pnpm\":\n return [\"pnpm\", [\"dlx\", \"shadcn@3\"]];\n case \"yarn\":\n return [\"yarn\", [\"dlx\", \"shadcn@3\"]];\n case \"bun\":\n return [\"bunx\", [\"shadcn@3\"]];\n case \"npm\":\n default:\n return [\"npx\", [\"shadcn@3\"]];\n }\n}\n\n/**\n * Installs the specified packages using the detected package manager\n * @param packages - Array of package names to install\n * @param pm - The package manager to use\n * @param dev - Whether to install as dev dependencies\n * @param force - Whether to force install packages\n */\nexport async function installDependencies(\n packages: string[],\n pm: PackageManager,\n dev = false,\n force = false,\n): Promise<void> {\n const args = [\n pm === \"npm\" ? \"install\" : \"add\",\n ...packages,\n dev ? (pm === \"npm\" || pm === \"pnpm\" ? \"-D\" : \"--dev\") : \"\",\n force ? \"--force\" : \"\",\n ].filter(Boolean);\n\n await execa(pm, args);\n}\n","import { confirm, multiselect } from \"@clack/prompts\";\n\nimport {\n type DependencyResolution,\n filterUninstalledDependencies,\n resolveAllStarwindDependencies,\n separateDependencies,\n} from \"./dependency-resolver.js\";\nimport { highlighter } from \"./highlighter.js\";\nimport type { Component } from \"./registry.js\";\nimport { getAllComponents } from \"./registry.js\";\n\nexport async function selectComponents(): Promise<string[]> {\n const components = await getAllComponents();\n\n const selected = await multiselect({\n message: \"Select components to add\",\n options: components.map((component) => ({\n label: component.name,\n value: component.name,\n })),\n required: false,\n });\n\n // Return empty array if user cancels selection\n if (typeof selected === \"symbol\") {\n return [];\n }\n\n return selected;\n}\n\n/**\n * Confirms installation of Starwind component dependencies\n * @param componentNames - Array of component names to check dependencies for\n * @returns Promise<boolean> - true if user confirms, false otherwise\n */\nexport async function confirmStarwindDependencies(componentNames: string[]): Promise<boolean> {\n try {\n const resolutions = await resolveAllStarwindDependencies(componentNames);\n\n if (resolutions.length === 0) {\n return true; // No Starwind dependencies to handle\n }\n\n const toInstall = resolutions.filter((r) => r.needsInstall);\n const toUpdate = resolutions.filter((r) => r.needsUpdate);\n\n let message = \"This component has Starwind component dependencies:\\n\\n\";\n\n if (toInstall.length > 0) {\n message += `${highlighter.info(\"Components to install:\")}\\n`;\n for (const dep of toInstall) {\n message += ` • ${dep.component} (requires ${dep.requiredVersion})\\n`;\n }\n message += \"\\n\";\n }\n\n if (toUpdate.length > 0) {\n message += `${highlighter.warn(\"Components to update:\")}\\n`;\n for (const dep of toUpdate) {\n message += ` • ${dep.component} (${dep.currentVersion} → latest, requires ${dep.requiredVersion})\\n`;\n }\n message += \"\\n\";\n }\n\n message += \"Proceed with installation?\";\n\n const confirmed = await confirm({ message });\n\n if (typeof confirmed === \"symbol\") {\n return false;\n }\n\n return confirmed;\n } catch (error) {\n console.error(\"Error resolving Starwind dependencies:\", error);\n const confirmed = await confirm({\n message: `Error resolving dependencies: ${error instanceof Error ? error.message : \"Unknown error\"}. Continue anyway?`,\n });\n\n if (typeof confirmed === \"symbol\") {\n return false;\n }\n\n return confirmed;\n }\n}\n\n/**\n * Gets the dependency resolutions for given component names\n * @param componentNames - Array of component names to resolve dependencies for\n * @returns Promise<DependencyResolution[]> - Array of dependency resolutions\n */\nexport async function getStarwindDependencyResolutions(\n componentNames: string[],\n): Promise<DependencyResolution[]> {\n return resolveAllStarwindDependencies(componentNames);\n}\n\nexport async function confirmInstall(component: Component): Promise<boolean> {\n if (component.dependencies.length === 0) return true;\n\n const { starwindDependencies, npmDependencies } = separateDependencies(component.dependencies);\n\n // Handle npm dependencies - only prompt for dependencies that need to be installed\n if (npmDependencies.length > 0) {\n const dependenciesToInstall = await filterUninstalledDependencies(npmDependencies);\n\n if (dependenciesToInstall.length > 0) {\n const confirmed = await confirm({\n message: `This component requires the following npm dependencies: ${dependenciesToInstall.join(\", \")}. Install them?`,\n });\n\n if (typeof confirmed === \"symbol\" || !confirmed) {\n return false;\n }\n }\n }\n\n // Handle Starwind component dependencies\n if (starwindDependencies.length > 0) {\n const confirmed = await confirmStarwindDependencies([component.name]);\n if (!confirmed) {\n return false;\n }\n }\n\n return true;\n}\n","import { PATHS } from \"./constants.js\";\nimport { fileExists, readJsonFile, writeJsonFile } from \"./fs.js\";\n\nexport interface ShadcnRegistry {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport interface ShadcnConfig {\n $schema?: string;\n registries?: Record<string, ShadcnRegistry>;\n aliases?: {\n components?: string;\n utils?: string;\n };\n tailwind?: {\n config?: string;\n css?: string;\n baseColor?: string;\n cssVariables?: boolean;\n };\n style?: string;\n rsc?: boolean;\n}\n\nconst COMPONENTS_JSON_PATH = \"components.json\";\n\n/**\n * Creates a default shadcn components.json configuration with Starwind Pro registry\n */\nexport function createDefaultShadcnConfig(\n cssFilePath: string,\n baseColor: string = \"neutral\",\n): ShadcnConfig {\n return {\n $schema: \"https://ui.shadcn.com/schema.json\",\n registries: {\n \"@starwind-pro\": {\n url: PATHS.STARWIND_PRO_REGISTRY,\n headers: {\n Authorization: \"Bearer ${STARWIND_LICENSE_KEY}\",\n },\n },\n },\n aliases: {\n components: \"@/components\",\n utils: \"@/lib/utils\",\n },\n tailwind: {\n config: \"\",\n css: cssFilePath,\n baseColor,\n cssVariables: true,\n },\n style: \"default\",\n rsc: true,\n };\n}\n\n/**\n * Checks if components.json exists in the project root\n */\nexport async function componentsJsonExists(): Promise<boolean> {\n return fileExists(COMPONENTS_JSON_PATH);\n}\n\n/**\n * Reads the existing components.json file\n */\nexport async function readComponentsJson(): Promise<ShadcnConfig> {\n try {\n return await readJsonFile(COMPONENTS_JSON_PATH);\n } catch (error) {\n throw new Error(`Failed to read components.json: ${error}`);\n }\n}\n\n/**\n * Writes the components.json file\n */\nexport async function writeComponentsJson(config: ShadcnConfig): Promise<void> {\n try {\n await writeJsonFile(COMPONENTS_JSON_PATH, config);\n } catch (error) {\n throw new Error(`Failed to write components.json: ${error}`);\n }\n}\n\n/**\n * Adds or updates the Starwind Pro registry in an existing components.json\n */\nexport function addStarwindProRegistry(config: ShadcnConfig): ShadcnConfig {\n const updatedConfig = { ...config };\n\n // Initialize registries if it doesn't exist\n if (!updatedConfig.registries) {\n updatedConfig.registries = {};\n }\n\n // Add or update the Starwind Pro registry\n updatedConfig.registries[\"@starwind-pro\"] = {\n url: PATHS.STARWIND_PRO_REGISTRY,\n headers: {\n Authorization: \"Bearer ${STARWIND_LICENSE_KEY}\",\n },\n };\n\n return updatedConfig;\n}\n\n/**\n * Sets up shadcn components.json for Starwind Pro\n * Creates new file if it doesn't exist, or updates existing file\n */\nexport async function setupShadcnProConfig(\n cssFilePath: string,\n baseColor: string = \"neutral\",\n): Promise<void> {\n const exists = await componentsJsonExists();\n\n if (!exists) {\n // Create new components.json with pro registry\n const config = createDefaultShadcnConfig(cssFilePath, baseColor);\n await writeComponentsJson(config);\n } else {\n // Update existing components.json to add pro registry\n const existingConfig = await readComponentsJson();\n const updatedConfig = addStarwindProRegistry(existingConfig);\n await writeComponentsJson(updatedConfig);\n }\n}\n\n/**\n * Checks if the Starwind Pro registry is already configured with authorized URL\n */\nexport async function hasStarwindProRegistry(): Promise<boolean> {\n if (!(await componentsJsonExists())) {\n return false;\n }\n\n try {\n const config = await readComponentsJson();\n const starwindProRegistry = config.registries?.[\"@starwind-pro\"];\n\n if (!starwindProRegistry?.url) {\n return false;\n }\n\n // Validate that the registry URL is from authorized domains\n const url = starwindProRegistry.url;\n const isAuthorized =\n url.startsWith(\"http://localhost\") || url.startsWith(\"https://pro.starwind.dev\");\n\n return isAuthorized;\n } catch {\n return false;\n }\n}\n","/**\n * Pauses execution for the specified number of milliseconds.\n * @param ms - The number of milliseconds to sleep\n */\nexport const sleep = async (ms: number): Promise<void> => {\n await new Promise((resolve) => setTimeout(resolve, ms));\n};\n","import { highlighter } from \"../utils/highlighter.js\";\nimport { type Component, getAllComponents } from \"./registry.js\";\n\n/**\n * Checks if a component name exists in the registry\n * @param component - The component name to validate\n * @param availableComponents - Optional array of available components from registry\n */\nexport async function isValidComponent(\n component: string,\n availableComponents?: Component[],\n): Promise<boolean> {\n const components = availableComponents || (await getAllComponents());\n return components.some((c) => c.name === component);\n}\n\n/**\n * Validates that a component exists in the registry\n * @param component - The component name to validate\n * @throws {Error} If the component is not found in the registry\n */\nexport async function validateComponent(component: string): Promise<void> {\n const components = await getAllComponents();\n if (!(await isValidComponent(component, components))) {\n const availableComponents = components.map((c) => highlighter.info(c.name));\n throw new Error(\n `Invalid component: ${highlighter.error(component)}.\\nAvailable components:\\n ${availableComponents.join(\"\\n \")}`,\n );\n }\n}\n","import path from \"node:path\";\n\nimport * as p from \"@clack/prompts\";\nimport semver from \"semver\";\n\nimport { tailwindConfig } from \"@/templates/starwind.css.js\";\nimport { setupAstroConfig } from \"@/utils/astro-config.js\";\nimport { updateConfig } from \"@/utils/config.js\";\nimport { ASTRO_PACKAGES, getOtherPackages, MIN_ASTRO_VERSION, PATHS } from \"@/utils/constants.js\";\nimport { ensureDirectory, fileExists, readJsonFile, writeCssFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport {\n getDefaultPackageManager,\n installDependencies,\n requestPackageManager,\n} from \"@/utils/package-manager.js\";\nimport { hasStarwindProRegistry, setupShadcnProConfig } from \"@/utils/shadcn-config.js\";\nimport { sleep } from \"@/utils/sleep.js\";\n\nexport async function init(\n withinAdd: boolean = false,\n options?: { defaults?: boolean; pro?: boolean },\n) {\n if (!withinAdd) {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n }\n\n try {\n // Validate project structure\n if (!(await fileExists(\"package.json\"))) {\n throw new Error(\n \"No package.json found. Please run this command in the root of your project.\",\n );\n }\n\n const pkg = await readJsonFile(\"package.json\");\n\n // Check Astro version compatibility\n const installTasks = [];\n const configTasks = [];\n\n // ================================================================\n // Prepare project structure and configuration tasks\n // ================================================================\n let configChoices;\n\n // Use defaults if specified, otherwise prompt user for choices\n if (options?.defaults) {\n configChoices = {\n installLocation: PATHS.LOCAL_COMPONENTS_DIR,\n cssFile: PATHS.LOCAL_CSS_FILE,\n twBaseColor: \"neutral\",\n };\n\n if (!withinAdd) {\n p.log.info(\"Using default configuration values\");\n }\n } else {\n configChoices = await p.group(\n {\n // ask where to install components\n installLocation: () =>\n p.text({\n message: \"What is your components directory?\",\n placeholder: PATHS.LOCAL_COMPONENTS_DIR,\n initialValue: PATHS.LOCAL_COMPONENTS_DIR,\n validate(value) {\n // Check for empty value\n if (value.length === 0) return `Value is required!`;\n\n // Check for absolute paths\n if (path.isAbsolute(value)) return `Please use a relative path`;\n\n // Check for path traversal attempts\n if (value.includes(\"..\")) return `Path traversal is not allowed`;\n\n // Check for invalid characters in path\n const invalidChars = /[<>:\"|?*]/;\n if (invalidChars.test(value)) return `Path contains invalid characters`;\n\n // Check if path starts with system directories\n const systemDirs = [\"windows\", \"program files\", \"system32\"];\n if (systemDirs.some((dir) => value.toLowerCase().startsWith(dir))) {\n return `Cannot install in system directories`;\n }\n },\n }),\n // ask where to add the css file\n cssFile: () =>\n p.text({\n message: `Where would you like to add the Tailwind ${highlighter.info(\".css\")} file?`,\n placeholder: PATHS.LOCAL_CSS_FILE,\n initialValue: PATHS.LOCAL_CSS_FILE,\n validate(value) {\n // Check for empty value\n if (value.length === 0) return `Value is required!`;\n\n // Must end with .css\n if (!value.endsWith(\".css\")) return `File must end with .css extension`;\n\n // Check for absolute paths\n if (path.isAbsolute(value)) return `Please use a relative path`;\n\n // Check for path traversal attempts\n if (value.includes(\"..\")) return `Path traversal is not allowed`;\n\n // Check for invalid characters in path\n const invalidChars = /[<>:\"|?*]/;\n if (invalidChars.test(value)) return `Path contains invalid characters`;\n\n // Check if path starts with system directories\n const systemDirs = [\"windows\", \"program files\", \"system32\"];\n if (systemDirs.some((dir) => value.toLowerCase().startsWith(dir))) {\n return `Cannot use system directories`;\n }\n\n // Ensure the path has a valid filename\n const basename = path.basename(value, \".css\");\n if (!basename || basename.trim().length === 0) {\n return `Invalid filename`;\n }\n },\n }),\n\n twBaseColor: () =>\n p.select({\n message: \"What Tailwind base color would you like to use?\",\n initialValue: \"neutral\",\n options: [\n { label: \"Neutral (default)\", value: \"neutral\" },\n { label: \"Stone\", value: \"stone\" },\n { label: \"Zinc\", value: \"zinc\" },\n { label: \"Gray\", value: \"gray\" },\n { label: \"Slate\", value: \"slate\" },\n ],\n }),\n },\n {\n // On Cancel callback that wraps the group\n // So if the user cancels one of the prompts in the group this function will be called\n onCancel: () => {\n p.cancel(\"Operation cancelled.\");\n process.exit(0);\n },\n },\n );\n }\n\n // ================================================================\n // Make sure appropriate directories exist\n // ================================================================\n const cssFileDir = path.dirname(configChoices.cssFile);\n const componentInstallDir = path.join(configChoices.installLocation, \"starwind\");\n configTasks.push({\n title: \"Creating project structure\",\n task: async () => {\n await ensureDirectory(componentInstallDir);\n await ensureDirectory(cssFileDir);\n await sleep(250);\n return \"Created project structure\";\n },\n });\n\n // ================================================================\n // Prepare Astro config file setup\n // ================================================================\n configTasks.push({\n title: \"Setup Astro config file\",\n task: async () => {\n const success = await setupAstroConfig();\n if (!success) {\n throw new Error(\"Failed to setup Astro config\");\n }\n await sleep(250);\n return \"Astro config setup completed\";\n },\n });\n\n // ================================================================\n // Prepare CSS file\n // ================================================================\n // Check if CSS file already exists\n const cssFileExists = await fileExists(configChoices.cssFile);\n let updatedTailwindConfig = tailwindConfig;\n\n if (configChoices.twBaseColor !== \"neutral\") {\n // replace all \"--color-neutral\" with \"--color-twBaseColor\"\n updatedTailwindConfig = updatedTailwindConfig.replace(\n /--color-neutral-/g,\n `--color-${configChoices.twBaseColor}-`,\n );\n }\n\n if (cssFileExists) {\n const shouldOverride = options?.defaults\n ? true\n : await p.confirm({\n message: `${highlighter.info(configChoices.cssFile)} already exists. Do you want to override it?`,\n });\n\n if (p.isCancel(shouldOverride)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldOverride) {\n p.log.info(\"Skipping Tailwind CSS configuration\");\n } else {\n configTasks.push({\n title: \"Creating Tailwind CSS configuration\",\n task: async () => {\n await writeCssFile(configChoices.cssFile, updatedTailwindConfig);\n await sleep(250);\n return \"Created Tailwind configuration\";\n },\n });\n }\n } else {\n configTasks.push({\n title: \"Creating Tailwind CSS configuration\",\n task: async () => {\n await writeCssFile(configChoices.cssFile, updatedTailwindConfig);\n await sleep(250);\n return \"Created Tailwind configuration\";\n },\n });\n }\n\n // ================================================================\n // Prepare project starwind configuration\n // ================================================================\n configTasks.push({\n title: \"Updating project configuration\",\n task: async () => {\n await updateConfig({\n tailwind: {\n css: configChoices.cssFile,\n baseColor: configChoices.twBaseColor as \"slate\" | \"gray\" | \"zinc\" | \"neutral\" | \"stone\",\n cssVariables: true,\n },\n // aliases: {\n // \tcomponents: \"@/components\",\n // },\n componentDir: configChoices.installLocation,\n components: [],\n });\n await sleep(250);\n return \"Updated project starwind configuration\";\n },\n });\n\n // ================================================================\n // Prepare Starwind Pro configuration (if enabled)\n // ================================================================\n if (options?.pro) {\n const alreadyHasPro = await hasStarwindProRegistry();\n\n if (!alreadyHasPro) {\n if (!withinAdd) {\n p.log.info(highlighter.info(\"Setting up Starwind Pro configuration...\"));\n }\n\n configTasks.push({\n title: \"Setting up Starwind Pro registry\",\n task: async () => {\n await setupShadcnProConfig(configChoices.cssFile, configChoices.twBaseColor);\n await sleep(250);\n return \"Configured Starwind Pro registry in components.json\";\n },\n });\n } else {\n if (!withinAdd) {\n p.log.info(highlighter.info(\"Starwind Pro registry already configured\"));\n }\n }\n }\n\n // ================================================================\n // Prepare astro installation\n // ================================================================\n // Request package manager\n const pm = options?.defaults ? await getDefaultPackageManager() : await requestPackageManager();\n\n if (pkg.dependencies?.astro) {\n const astroVersion = pkg.dependencies.astro.replace(/^\\^|~/, \"\");\n if (!semver.gte(astroVersion, MIN_ASTRO_VERSION)) {\n const shouldUpgrade = options?.defaults\n ? true\n : await p.confirm({\n message: `Starwind requires Astro v${MIN_ASTRO_VERSION} or higher. Would you like to upgrade from v${astroVersion}?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldUpgrade)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldUpgrade) {\n p.cancel(\"Astro v5 or higher is required to use Starwind\");\n return process.exit(1);\n }\n\n installTasks.push({\n title: \"Upgrading Astro\",\n task: async () => {\n await installDependencies([ASTRO_PACKAGES.core], pm);\n return \"Upgraded Astro successfully\";\n },\n });\n }\n } else {\n const shouldInstall = options?.defaults\n ? true\n : await p.confirm({\n message: `Starwind requires Astro v${MIN_ASTRO_VERSION} or higher. Would you like to install it?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldInstall)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldInstall) {\n p.cancel(\"Astro is required to use Starwind\");\n return process.exit(1);\n }\n\n installTasks.push({\n title: `Installing ${ASTRO_PACKAGES.core}`,\n task: async () => {\n await installDependencies([ASTRO_PACKAGES.core], pm);\n return `Installed ${highlighter.info(ASTRO_PACKAGES.core)} successfully`;\n },\n });\n }\n\n // ================================================================\n // Prepare tailwind and other package installation\n // ================================================================\n const otherPackages = getOtherPackages();\n\n const shouldInstall = options?.defaults\n ? true\n : await p.confirm({\n message: `Install ${highlighter.info(otherPackages.join(\", \"))} using ${highlighter.info(pm)}?`,\n });\n\n if (p.isCancel(shouldInstall)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (shouldInstall) {\n installTasks.push({\n title: `Installing packages`,\n task: async () => {\n await installDependencies(getOtherPackages(), pm, false, false);\n return `${highlighter.info(\"Packages installed successfully\")}`;\n },\n });\n } else {\n p.log.warn(\n highlighter.warn(`Skipped installation of packages. Make sure to install them manually`),\n );\n }\n\n // ================================================================\n // Execute all tasks\n // ================================================================\n if (installTasks.length > 0) {\n await p.tasks(installTasks);\n }\n\n if (configTasks.length > 0) {\n await p.tasks(configTasks);\n }\n\n await sleep(250);\n\n let nextStepsMessage = `Make sure your layout imports the ${highlighter.infoBright(configChoices.cssFile)} file`;\n\n if (options?.pro) {\n nextStepsMessage += `\\n\\nStarwind Pro is now configured! You can install pro components using:\\n${highlighter.info(\"npx starwind@latest add @starwind-pro/component-name\")}\\n\\nMake sure to set your ${highlighter.infoBright(\"STARWIND_LICENSE_KEY\")} environment variable.`;\n }\n\n p.note(nextStepsMessage, \"Next steps\");\n\n if (!withinAdd) {\n sleep(1000);\n const outroMessage = options?.pro\n ? \"Enjoy using Starwind UI with Pro components! 🚀✨\"\n : \"Enjoy using Starwind UI 🚀\";\n p.outro(outroMessage);\n }\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to add components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n","export const tailwindConfig = `@import \"tailwindcss\";\n@import \"tw-animate-css\";\n@plugin \"@tailwindcss/forms\";\n@custom-variant dark (&:where(.dark, .dark *));\n\n@theme {\n --animate-accordion-down: accordion-down 0.2s ease-out;\n --animate-accordion-up: accordion-up 0.2s ease-out;\n\n @keyframes accordion-down {\n from {\n height: 0;\n }\n to {\n height: var(--starwind-accordion-content-height);\n }\n }\n\n @keyframes accordion-up {\n from {\n height: var(--starwind-accordion-content-height);\n }\n to {\n height: 0;\n }\n }\n}\n\n@theme inline {\n --color-background: var(--background);\n --color-foreground: var(--foreground);\n --color-card: var(--card);\n --color-card-foreground: var(--card-foreground);\n --color-popover: var(--popover);\n --color-popover-foreground: var(--popover-foreground);\n --color-primary: var(--primary);\n --color-primary-foreground: var(--primary-foreground);\n --color-primary-accent: var(--primary-accent);\n --color-secondary: var(--secondary);\n --color-secondary-foreground: var(--secondary-foreground);\n --color-secondary-accent: var(--secondary-accent);\n --color-muted: var(--muted);\n --color-muted-foreground: var(--muted-foreground);\n --color-accent: var(--accent);\n --color-accent-foreground: var(--accent-foreground);\n --color-info: var(--info);\n --color-info-foreground: var(--info-foreground);\n --color-success: var(--success);\n --color-success-foreground: var(--success-foreground);\n --color-warning: var(--warning);\n --color-warning-foreground: var(--warning-foreground);\n --color-error: var(--error);\n --color-error-foreground: var(--error-foreground);\n --color-border: var(--border);\n --color-input: var(--input);\n --color-outline: var(--outline);\n\n --radius-xs: calc(var(--radius) - 0.375rem);\n --radius-sm: calc(var(--radius) - 0.25rem);\n --radius-md: calc(var(--radius) - 0.125rem);\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 0.25rem);\n --radius-2xl: calc(var(--radius) + 0.5rem);\n --radius-3xl: calc(var(--radius) + 1rem);\n}\n\n:root {\n --background: var(--color-white);\n --foreground: var(--color-neutral-950);\n --card: var(--color-white);\n --card-foreground: var(--color-neutral-950);\n --popover: var(--color-white);\n --popover-foreground: var(--color-neutral-950);\n --primary: var(--color-blue-700);\n --primary-foreground: var(--color-neutral-50);\n --primary-accent: var(--color-blue-700);\n --secondary: var(--color-fuchsia-700);\n --secondary-foreground: var(--color-neutral-50);\n --secondary-accent: var(--color-fuchsia-700);\n --muted: var(--color-neutral-100);\n --muted-foreground: var(--color-neutral-600);\n --accent: var(--color-neutral-100);\n --accent-foreground: var(--color-neutral-900);\n --info: var(--color-sky-300);\n --info-foreground: var(--color-sky-950);\n --success: var(--color-green-300);\n --success-foreground: var(--color-green-950);\n --warning: var(--color-amber-300);\n --warning-foreground: var(--color-amber-950);\n --error: var(--color-red-700);\n --error-foreground: var(--color-neutral-50);\n --border: var(--color-neutral-200);\n --input: var(--color-neutral-200);\n --outline: var(--color-neutral-400);\n --radius: 0.625rem;\n}\n\n.dark {\n --background: var(--color-neutral-950);\n --foreground: var(--color-neutral-50);\n --card: var(--color-neutral-900);\n --card-foreground: var(--color-neutral-50);\n --popover: var(--color-neutral-800);\n --popover-foreground: var(--color-neutral-50);\n --primary: var(--color-blue-700);\n --primary-foreground: var(--color-neutral-50);\n --primary-accent: var(--color-blue-400);\n --secondary: var(--color-fuchsia-700);\n --secondary-foreground: var(--color-neutral-50);\n --secondary-accent: var(--color-fuchsia-400);\n --muted: var(--color-neutral-800);\n --muted-foreground: var(--color-neutral-400);\n --accent: var(--color-neutral-700);\n --accent-foreground: var(--color-neutral-100);\n --info: var(--color-sky-300);\n --info-foreground: var(--color-sky-950);\n --success: var(--color-green-300);\n --success-foreground: var(--color-green-950);\n --warning: var(--color-amber-300);\n --warning-foreground: var(--color-amber-950);\n --error: var(--color-red-800);\n --error-foreground: var(--color-neutral-50);\n --border: --alpha(var(--color-neutral-50) / 10%);\n --input: --alpha(var(--color-neutral-50) / 15%);\n --outline: var(--color-neutral-500);\n}\n\n@layer base {\n * {\n @apply border-border outline-outline/50;\n }\n body {\n @apply bg-background text-foreground scheme-light dark:scheme-dark;\n }\n button {\n @apply cursor-pointer;\n }\n}\n`;\n","import * as p from \"@clack/prompts\";\nimport fs from \"fs-extra\";\nimport semver from \"semver\";\n\nimport { readJsonFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\n\nimport { fileExists } from \"./fs.js\";\n\nconst CONFIG_EXTENSIONS = [\"ts\", \"js\", \"mjs\", \"cjs\"] as const;\n// type ConfigExtension = (typeof CONFIG_EXTENSIONS)[number];\n\n/**\n * Finds the Astro config file in the current directory\n * @returns The path to the config file if found, null otherwise\n */\nasync function findAstroConfig(): Promise<string | null> {\n for (const ext of CONFIG_EXTENSIONS) {\n const configPath = `astro.config.${ext}`;\n if (await fileExists(configPath)) {\n return configPath;\n }\n }\n return null;\n}\n\n/**\n * Gets the installed Astro version from the project's package.json\n * @returns The installed Astro version or null if not found\n */\nasync function getAstroVersion(): Promise<string | null> {\n try {\n const pkg = await readJsonFile(\"package.json\");\n if (pkg.dependencies?.astro) {\n const astroVersion = pkg.dependencies.astro.replace(/^\\^|~/, \"\");\n return astroVersion;\n }\n\n p.log.error(\n highlighter.error(\n \"Astro seems not installed in your project, please check your package.json\",\n ),\n );\n return null;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred\";\n p.log.error(highlighter.error(`Failed to check Astro version: ${errorMessage}`));\n return null;\n }\n}\n\n/**\n * Updates or creates the Astro configuration file\n * @returns true if successful, false otherwise\n */\nexport async function setupAstroConfig(): Promise<boolean> {\n try {\n let configPath = await findAstroConfig();\n let content = \"\";\n\n if (configPath) {\n content = await fs.readFile(configPath, \"utf-8\");\n } else {\n configPath = \"astro.config.ts\";\n content = `import { defineConfig } from \"astro/config\";\\n\\nexport default defineConfig({});\\n`;\n }\n\n // Add tailwindcss import if not present\n if (!content.includes('import tailwindcss from \"@tailwindcss/vite\"')) {\n content = `import tailwindcss from \"@tailwindcss/vite\";\\n${content}`;\n }\n\n // Parse the configuration object\n const configStart = content.indexOf(\"defineConfig(\") + \"defineConfig(\".length;\n const configEnd = content.lastIndexOf(\");\");\n let config = content.slice(configStart, configEnd);\n\n // Remove outer braces and trim\n config = config.trim().replace(/^{|}$/g, \"\").trim();\n\n const astroVersion = await getAstroVersion();\n\n if (astroVersion && semver.lt(astroVersion, \"5.7.0\")) {\n // Add experimental configuration\n if (!config.includes(\"experimental\")) {\n // Ensure there's a comma before adding new property if config is not empty\n const needsComma = config.length > 0 && !config.trimEnd().endsWith(\",\");\n config +=\n (needsComma ? \",\" : \"\") +\n `\\n\\texperimental: {\n\t\tsvg: true,\n\t},`;\n } else if (!config.includes(\"svg: true\") && !config.includes(\"svg: {\")) {\n // Insert svg config into existing experimental block\n const expEnd = config.indexOf(\"experimental:\") + \"experimental:\".length;\n const blockStart = config.indexOf(\"{\", expEnd) + 1;\n config = config.slice(0, blockStart) + `\\n\\t\\tsvg: true,` + config.slice(blockStart);\n }\n }\n\n // Add vite configuration\n if (!config.includes(\"vite:\")) {\n // Ensure there's a comma before adding new property if config is not empty\n const needsComma = config.length > 0 && !config.trimEnd().endsWith(\",\");\n config +=\n (needsComma ? \",\" : \"\") +\n `\\n\\tvite: {\n\t\tplugins: [tailwindcss()],\n\t},`;\n } else if (!config.includes(\"plugins: [\")) {\n // Insert plugins into existing vite block\n const viteEnd = config.indexOf(\"vite:\") + \"vite:\".length;\n const blockStart = config.indexOf(\"{\", viteEnd) + 1;\n config =\n config.slice(0, blockStart) + `\\n\\t\\tplugins: [tailwindcss()],` + config.slice(blockStart);\n } else if (!config.includes(\"tailwindcss()\")) {\n // Add tailwindcss to existing plugins array\n const pluginsStart = config.indexOf(\"plugins:\") + \"plugins:\".length;\n const arrayStart = config.indexOf(\"[\", pluginsStart) + 1;\n config = config.slice(0, arrayStart) + `tailwindcss(), ` + config.slice(arrayStart);\n }\n\n // Reconstruct the file content\n const newContent = `${content.slice(0, configStart)}{\\n\\t${config}\\n}${content.slice(configEnd)}`;\n\n await fs.writeFile(configPath, newContent, \"utf-8\");\n return true;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred\";\n p.log.error(highlighter.error(`Failed to setup Astro config: ${errorMessage}`));\n return false;\n }\n}\n","import * as p from \"@clack/prompts\";\n\nimport { removeComponent, type RemoveResult } from \"@/utils/component.js\";\nimport { getConfig, updateConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { sleep } from \"@/utils/sleep.js\";\n\nexport async function remove(components?: string[], options?: { all?: boolean }) {\n try {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n // Check if starwind.config.json exists\n const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n if (!configExists) {\n p.log.error(\"No Starwind configuration found. Please run starwind init first.\");\n process.exit(1);\n }\n\n // Get current config and installed components\n const config = await getConfig();\n const installedComponents = config.components;\n\n if (installedComponents.length === 0) {\n p.log.warn(\"No components are currently installed.\");\n process.exit(0);\n }\n\n let componentsToRemove: string[] = [];\n\n // ================================================================\n // Get components to remove\n // ================================================================\n if (options?.all) {\n // Remove all installed components\n componentsToRemove = installedComponents.map((comp) => comp.name);\n p.log.info(`Removing all ${componentsToRemove.length} installed components...`);\n } else if (components && components.length > 0) {\n // Validate that all specified components are installed\n const invalid = components.filter(\n (comp) => !installedComponents.some((ic) => ic.name === comp),\n );\n\n if (invalid.length > 0) {\n p.log.warn(\n `${highlighter.warn(\"Components not found:\")}\\n${invalid\n .map((name) => ` ${name}`)\n .join(\"\\n\")}`,\n );\n }\n\n componentsToRemove = components.filter((comp) =>\n installedComponents.some((ic) => ic.name === comp),\n );\n\n if (componentsToRemove.length === 0) {\n p.log.warn(\"No valid components to remove\");\n process.exit(0);\n }\n } else {\n // Show interactive prompt with installed components\n const choices = installedComponents.map((comp) => ({\n value: comp.name,\n label: comp.name,\n }));\n\n const selected = await p.multiselect({\n message: \"Select components to remove\",\n options: choices,\n });\n\n if (p.isCancel(selected)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n componentsToRemove = selected as string[];\n }\n\n if (componentsToRemove.length === 0) {\n p.log.warn(\"No components selected for removal\");\n process.exit(0);\n }\n\n // Confirm removal\n const confirmed = await p.confirm({\n message: `Remove ${componentsToRemove\n .map((comp) => highlighter.info(comp))\n .join(\", \")} ${componentsToRemove.length > 1 ? \"components\" : \"component\"}?`,\n });\n\n if (!confirmed || p.isCancel(confirmed)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n const results = {\n removed: [] as RemoveResult[],\n failed: [] as RemoveResult[],\n };\n\n // ================================================================\n // Remove Components\n // ================================================================\n for (const comp of componentsToRemove) {\n const result = await removeComponent(comp, config.componentDir);\n if (result.status === \"removed\") {\n results.removed.push(result);\n } else {\n results.failed.push(result);\n }\n }\n\n // ================================================================\n // Update Config File\n // ================================================================\n // Update config file by writing the filtered components directly\n const updatedComponents = config.components.filter(\n (comp) => !componentsToRemove.includes(comp.name),\n );\n await updateConfig(\n {\n ...config,\n components: updatedComponents,\n },\n { appendComponents: false },\n );\n\n // ================================================================\n // Removal summary\n // ================================================================\n p.log.message(`\\n\\n${highlighter.underline(\"Removal Summary\")}`);\n\n if (results.failed.length > 0) {\n p.log.error(\n `${highlighter.error(\"Failed to remove components:\")}\\n${results.failed\n .map((r) => ` ${r.name} - ${r.error}`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.removed.length > 0) {\n p.log.success(\n `${highlighter.success(\"Successfully removed components:\")}\\n${results.removed\n .map((r) => ` ${r.name}`)\n .join(\"\\n\")}`,\n );\n }\n\n await sleep(1000);\n\n if (results.removed.length > 0) {\n p.outro(\"Components removed successfully 🗑️\");\n } else {\n p.cancel(\"Errors occurred while removing components\");\n process.exit(1);\n }\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to remove components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n","import * as p from \"@clack/prompts\";\n\nimport { updateComponent, type UpdateResult } from \"@/utils/component.js\";\nimport { getConfig } from \"@/utils/config.js\";\nimport { updateConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { sleep } from \"@/utils/sleep.js\";\n\n// Define the type for options more explicitly\ninterface UpdateOptions {\n all?: boolean;\n yes?: boolean;\n}\n\nexport async function update(components?: string[], options?: UpdateOptions) {\n try {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n // Check if starwind.config.json exists\n const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n if (!configExists) {\n p.log.error(\"No Starwind configuration found. Please run starwind init first.\");\n process.exit(1);\n }\n\n // Get current config and installed components\n const config = await getConfig();\n const installedComponents = config.components;\n\n if (installedComponents.length === 0) {\n p.log.warn(\"No components are currently installed.\");\n process.exit(0);\n }\n\n let componentsToUpdate: string[] = [];\n\n // ================================================================\n // Get components to update\n // ================================================================\n if (options?.all) {\n // Update all installed components\n componentsToUpdate = installedComponents.map((comp) => comp.name);\n p.log.info(`Checking updates for all ${componentsToUpdate.length} installed components...`);\n } else if (components && components.length > 0) {\n // Validate that all specified components are installed\n const invalid = components.filter(\n (comp) => !installedComponents.some((ic) => ic.name === comp),\n );\n\n if (invalid.length > 0) {\n p.log.warn(\n `${highlighter.warn(\"Components not found in project:\")}\\n${invalid\n .map((name) => ` ${name}`)\n .join(\"\\n\")}`,\n );\n }\n\n componentsToUpdate = components.filter((comp) =>\n installedComponents.some((ic) => ic.name === comp),\n );\n\n if (componentsToUpdate.length === 0) {\n p.log.warn(\"No valid components to update\");\n process.exit(0);\n }\n } else {\n // Show interactive prompt with installed components\n const choices = installedComponents.map((comp) => ({\n value: comp.name,\n label: comp.name,\n }));\n\n const selected = await p.multiselect({\n message: \"Select components to update\",\n options: choices,\n });\n\n if (p.isCancel(selected)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n componentsToUpdate = selected as string[];\n }\n\n if (componentsToUpdate.length === 0) {\n p.log.warn(\"No components selected for update\");\n process.exit(0);\n }\n\n const results = {\n updated: [] as UpdateResult[],\n skipped: [] as UpdateResult[],\n failed: [] as UpdateResult[],\n };\n\n // ================================================================\n // Update Components\n // ================================================================\n for (const comp of componentsToUpdate) {\n const currentVersion = installedComponents.find((ic) => ic.name === comp)?.version;\n if (!currentVersion) {\n results.failed.push({\n name: comp,\n status: \"failed\",\n error: \"Could not determine current version\",\n });\n continue;\n }\n\n // Pass the 'yes' option down to updateComponent\n const result = await updateComponent(comp, currentVersion, options?.yes);\n switch (result.status) {\n case \"updated\":\n results.updated.push(result);\n break;\n case \"skipped\":\n results.skipped.push(result);\n break;\n case \"failed\":\n results.failed.push(result);\n break;\n }\n }\n\n // ================================================================\n // Update Config File\n // ================================================================\n if (results.updated.length > 0) {\n try {\n // Create a map of current components, excluding updated ones\n const updatedComponentNames = new Set(results.updated.map((r) => r.name));\n const currentComponents = config.components.filter(\n (comp) => !updatedComponentNames.has(comp.name),\n );\n\n // Add the updated components with their new versions\n const updatedComponents = [\n ...currentComponents,\n ...results.updated.map((r) => ({\n name: r.name,\n version: r.newVersion!,\n })),\n ];\n\n await updateConfig(\n {\n components: updatedComponents,\n },\n { appendComponents: false },\n );\n } catch (error) {\n p.log.error(\n `Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n process.exit(1);\n }\n }\n\n // ================================================================\n // Update summary\n // ================================================================\n p.log.message(`\\n\\n${highlighter.underline(\"Update Summary\")}`);\n\n if (results.failed.length > 0) {\n p.log.error(\n `${highlighter.error(\"Failed to update components:\")}\\n${results.failed\n .map((r) => ` ${r.name} - ${r.error}`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.skipped.length > 0) {\n p.log.info(\n `${highlighter.info(\"Components already up to date or skipped:\")}\\n${results.skipped\n .map((r) => ` ${r.name} (${r.oldVersion})`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.updated.length > 0) {\n p.log.success(\n `${highlighter.success(\"Successfully updated components:\")}\\n${results.updated\n .map((r) => ` ${r.name} (${r.oldVersion} → ${r.newVersion})`)\n .join(\"\\n\")}`,\n );\n }\n\n await sleep(1000);\n\n if (results.updated.length > 0) {\n p.outro(\"Components updated successfully 🚀\");\n } else if (results.skipped.length > 0 && results.failed.length === 0) {\n p.outro(\"Components already up to date or skipped ✨\");\n } else {\n p.cancel(\"No components were updated\");\n process.exit(1);\n }\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to update components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n"],"mappings":";;;AAEA,SAAS,eAAe;;;ACFxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,EACX,QAAU;AAAA,IACR,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,MAAQ;AAAA,EACR,KAAO;AAAA,IACL,UAAY;AAAA,EACd;AAAA,EACA,MAAQ;AAAA,EACR,OAAS;AAAA,EACT,OAAS;AAAA,IACP;AAAA,EACF;AAAA,EACA,SAAW;AAAA,IACT,OAAS;AAAA,IACT,KAAO;AAAA,IACP,YAAY;AAAA,IACZ,cAAc;AAAA,IACd,MAAQ;AAA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AAK,QAAQ,OAAO,WAAW,GAAG;AACpE,MAAE,SAAM,iDAA4C;AAAA,IACtD,OAAO;AACL,MAAE,UAAO,4BAA4B;AACrC,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF,SAAS,OAAO;AACd,IAAE,OAAI,MAAM,iBAAiB,QAAQ,MAAM,UAAU,6BAA6B;AAClF,IAAE,UAAO,qBAAqB;AAC9B,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF;;;ApBpMA,IAAM,UAAU,IAAI,QAAQ,EACzB,KAAK,UAAU,EACf,YAAY,gEAAgE,EAC5E,QAAQ,gBAAI,OAAO;AAEtB,QACG,QAAQ,MAAM,EACd,YAAY,uCAAuC,EACnD,OAAO,kBAAkB,oCAAoC,EAC7D,OAAO,aAAa,oCAAoC,EACxD,OAAO,CAAC,YAAY,KAAK,OAAO,EAAE,UAAU,QAAQ,UAAU,KAAK,QAAQ,IAAI,CAAC,CAAC;AAEpF,QACG,QAAQ,KAAK,EACb,YAAY,yCAAyC,EACrD,SAAS,mBAAmB,yCAAyC,EACrE,qBAAqB,EACrB,OAAO,aAAa,8BAA8B,EAClD,OAAO,GAAG;AAEb,QACG,QAAQ,QAAQ,EAChB,YAAY,qDAAqD,EACjE,SAAS,mBAAmB,4CAA4C,EACxE,qBAAqB,EACrB,OAAO,aAAa,iCAAiC,EACrD,OAAO,aAAa,2BAA2B,EAC/C,OAAO,MAAM;AAEhB,QACG,QAAQ,QAAQ,EAChB,YAAY,8CAA8C,EAC1D,SAAS,mBAAmB,4CAA4C,EACxE,qBAAqB,EACrB,OAAO,aAAa,iCAAiC,EACrD,OAAO,MAAM;AAEhB,QAAQ,MAAM;","names":["p","execa","p","fs","fs","semver","semver","p","confirm","confirm","path","p","semver","p","fs","semver","fs","semver","path","semver","shouldInstall","execa","p","p"]}
1
+ {"version":3,"sources":["../src/index.ts","../package.json","../src/commands/add.ts","../src/utils/constants.ts","../src/utils/fs.ts","../src/utils/config.ts","../src/utils/highlighter.ts","../src/utils/install.ts","../src/utils/component.ts","../src/utils/registry.ts","../src/utils/dependency-resolver.ts","../src/utils/package-manager.ts","../src/utils/prompts.ts","../src/utils/shadcn-config.ts","../src/utils/sleep.ts","../src/utils/validate.ts","../src/commands/init.ts","../src/templates/starwind.css.ts","../src/utils/astro-config.ts","../src/commands/remove.ts","../src/commands/update.ts"],"sourcesContent":["#!/usr/bin/env node\n\nimport { Command } from \"commander\";\n\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { add } from \"./commands/add.js\";\nimport { init } from \"./commands/init.js\";\nimport { remove } from \"./commands/remove.js\";\nimport { update } from \"./commands/update.js\";\n\nconst program = new Command()\n .name(\"starwind\")\n .description(\"Add beautifully designed components to your Astro applications\")\n .version(pkg.version);\n\nprogram\n .command(\"init\")\n .description(\"Initialize your project with Starwind\")\n .option(\"-d, --defaults\", \"Use default values for all prompts\")\n .option(\"-p, --pro\", \"Initialize with Starwind Pro setup\")\n .action((options) => init(false, { defaults: options.defaults, pro: options.pro }));\n\nprogram\n .command(\"add\")\n .description(\"Add Starwind components to your project\")\n .argument(\"[components...]\", \"The components to add (space separated)\")\n .allowExcessArguments()\n .option(\"-a, --all\", \"Add all available components\")\n .action(add);\n\nprogram\n .command(\"update\")\n .description(\"Update Starwind components to their latest versions\")\n .argument(\"[components...]\", \"The components to update (space separated)\")\n .allowExcessArguments()\n .option(\"-a, --all\", \"Update all installed components\")\n .option(\"-y, --yes\", \"Skip confirmation prompts\")\n .action(update);\n\nprogram\n .command(\"remove\")\n .description(\"Remove Starwind components from your project\")\n .argument(\"[components...]\", \"The components to remove (space separated)\")\n .allowExcessArguments()\n .option(\"-a, --all\", \"Remove all installed components\")\n .action(remove);\n\nprogram.parse();\n","{\n \"name\": \"starwind\",\n \"version\": \"1.12.2\",\n \"description\": \"Add beautifully designed components to your Astro applications\",\n \"license\": \"MIT\",\n \"author\": {\n \"name\": \"webreaper\",\n \"url\": \"https://x.com/BowTiedWebReapr\"\n },\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/starwind-ui/starwind-ui.git\",\n \"directory\": \"packages/cli\"\n },\n \"keywords\": [\n \"starwind\",\n \"starwind ui\",\n \"starwind cli\",\n \"astro\",\n \"astro component\",\n \"astro ui\",\n \"astro ui library\",\n \"tailwind\",\n \"components\",\n \"add component\"\n ],\n \"type\": \"module\",\n \"bin\": {\n \"starwind\": \"./dist/index.js\"\n },\n \"main\": \"./dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"files\": [\n \"dist\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"dev\": \"tsup --watch\",\n \"cli:link\": \"pnpm link --global\",\n \"cli:unlink\": \"pnpm rm --global starwind\",\n \"test\": \"vitest\",\n \"test:run\": \"vitest run\",\n \"test:coverage\": \"vitest run --coverage\",\n \"typecheck\": \"tsc --noEmit\",\n \"format:check\": \"prettier --check \\\"**/*.{ts,tsx,md,json}\\\"\",\n \"format:write\": \"prettier --write \\\"**/*.{ts,tsx,md,json}\\\" --cache\",\n \"publish:beta\": \"pnpm publish --tag beta --access public\",\n \"publish:next\": \"pnpm publish --tag next --access public\",\n \"publish:release\": \"pnpm publish --access public\"\n },\n \"dependencies\": {\n \"@clack/prompts\": \"0.11.0\",\n \"@starwind-ui/core\": \"1.12.1\",\n \"chalk\": \"5.6.2\",\n \"commander\": \"14.0.2\",\n \"execa\": \"9.6.0\",\n \"fs-extra\": \"11.3.2\",\n \"semver\": \"7.7.3\",\n \"zod\": \"3.25.74\"\n },\n \"devDependencies\": {\n \"@types/fs-extra\": \"11.0.4\",\n \"@types/node\": \"24.10.1\",\n \"@types/prompts\": \"2.4.9\",\n \"@types/semver\": \"7.7.1\",\n \"tsup\": \"8.5.1\"\n },\n \"engines\": {\n \"node\": \"^20.6.0 || >=22.0.0\"\n }\n}\n","import * as p from \"@clack/prompts\";\nimport { execa } from \"execa\";\n\nimport type { InstallResult } from \"@/utils/component.js\";\nimport { getConfig, updateConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { installComponent } from \"@/utils/install.js\";\nimport { getShadcnCommand } from \"@/utils/package-manager.js\";\nimport { selectComponents } from \"@/utils/prompts.js\";\nimport { getAllComponents } from \"@/utils/registry.js\";\nimport { hasStarwindProRegistry, setupShadcnProConfig } from \"@/utils/shadcn-config.js\";\nimport { sleep } from \"@/utils/sleep.js\";\nimport { isValidComponent } from \"@/utils/validate.js\";\n\nimport { init } from \"./init.js\";\n\nexport async function add(components?: string[], options?: { all?: boolean }) {\n try {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n // Check if starwind.config.json exists\n const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n if (!configExists) {\n const shouldInit = await p.confirm({\n message: `Starwind configuration not found. Would you like to run ${highlighter.info(\"starwind init\")} now?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldInit)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n if (shouldInit) {\n await init(true);\n } else {\n p.log.error(\n `Please initialize starwind with ${highlighter.info(\"starwind init\")} before adding components`,\n );\n process.exit(1);\n }\n }\n\n let componentsToInstall: string[] = [];\n const registryComponents: string[] = [];\n let registryResults: { success: string[]; failed: string[] } | null = null;\n\n // ================================================================\n // Get components to install\n // ================================================================\n if (options?.all) {\n // Get all available components\n const availableComponents = await getAllComponents();\n componentsToInstall = availableComponents.map((c) => c.name);\n p.log.info(`Adding all ${componentsToInstall.length} available components...`);\n } else if (components && components.length > 0) {\n // Separate registry components from regular components\n const regularComponents: string[] = [];\n\n for (const component of components) {\n if (component.startsWith(\"@\")) {\n registryComponents.push(component);\n } else {\n regularComponents.push(component);\n }\n }\n\n // Handle registry components (e.g., @starwind-pro/login1)\n if (registryComponents.length > 0) {\n // Check if Starwind Pro registry is configured\n const hasProRegistry = await hasStarwindProRegistry();\n\n if (!hasProRegistry) {\n const shouldSetupPro = await p.confirm({\n message: `Starwind Pro registry not configured. Would you like to set it up now to install ${registryComponents.join(\", \")}?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldSetupPro)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n if (shouldSetupPro) {\n p.log.info(highlighter.info(\"Setting up Starwind Pro configuration...\"));\n\n // Get CSS file and base color from existing config or use defaults\n let cssFile: string = PATHS.LOCAL_CSS_FILE;\n let baseColor: string = \"neutral\";\n\n try {\n const config = await getConfig();\n cssFile = config.tailwind?.css || PATHS.LOCAL_CSS_FILE;\n baseColor = config.tailwind?.baseColor || \"neutral\";\n } catch {\n // Use defaults if config can't be read\n }\n\n await setupShadcnProConfig(cssFile, baseColor);\n p.log.success(\"Starwind Pro registry configured successfully!\");\n } else {\n p.log.error(\"Cannot install registry components without Starwind Pro configuration\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n }\n\n p.log.info(`Installing registry components: ${registryComponents.join(\", \")}`);\n\n const [command, baseArgs] = await getShadcnCommand();\n registryResults = {\n success: [] as string[],\n failed: [] as string[],\n };\n\n for (const registryComponent of registryComponents) {\n try {\n p.log.info(`Installing ${highlighter.info(registryComponent)} via shadcn...`);\n\n await execa(command, [...baseArgs, \"add\", registryComponent], {\n stdio: \"inherit\",\n cwd: process.cwd(),\n });\n\n registryResults.success.push(registryComponent);\n } catch (error) {\n registryResults.failed.push(registryComponent);\n }\n }\n }\n\n // Handle regular Starwind components\n if (regularComponents.length > 0) {\n // Get all available components once to avoid multiple registry calls\n const availableComponents = await getAllComponents();\n\n // Filter valid components and collect invalid ones\n const { valid, invalid } = await regularComponents.reduce<\n Promise<{ valid: string[]; invalid: string[] }>\n >(\n async (accPromise, component) => {\n const acc = await accPromise;\n const isValid = await isValidComponent(component, availableComponents);\n if (isValid) {\n acc.valid.push(component);\n } else {\n acc.invalid.push(component);\n }\n return acc;\n },\n Promise.resolve({ valid: [], invalid: [] }),\n );\n\n // Warn about invalid components\n if (invalid.length > 0) {\n p.log.warn(\n `${highlighter.warn(\"Invalid components found:\")}\\n${invalid\n .map((name) => ` ${name}`)\n .join(\"\\n\")}`,\n );\n }\n\n // Proceed with valid components\n if (valid.length > 0) {\n componentsToInstall = valid;\n } else if (registryComponents.length === 0) {\n p.log.warn(`${highlighter.warn(\"No valid components to install\")}`);\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n }\n } else {\n // If no components provided, show the interactive prompt\n const selected = await selectComponents();\n if (!selected) {\n p.cancel(\"No components selected\");\n return process.exit(0);\n }\n componentsToInstall = selected;\n }\n\n if (componentsToInstall.length === 0 && registryComponents.length === 0) {\n p.log.warn(`${highlighter.warn(\"No components selected\")}`);\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n // If we only have registry components, we still need to show the final summary\n // (removed early return to ensure summary is always shown)\n\n // confirm installation\n // const confirmed = await p.confirm({\n // \tmessage: `Install ${componentsToInstall\n // \t\t.map((comp) => highlighter.info(comp))\n // \t\t.join(\", \")} ${componentsToInstall.length > 1 ? \"components\" : \"component\"}?`,\n // });\n\n // if (!confirmed || p.isCancel(confirmed)) {\n // \tp.cancel(\"Operation cancelled\");\n // \treturn process.exit(0);\n // }\n\n const results = {\n installed: [] as InstallResult[],\n skipped: [] as InstallResult[],\n failed: [] as InstallResult[],\n };\n\n // ================================================================\n // Install components\n // ================================================================\n const installedComponents = [];\n for (const comp of componentsToInstall) {\n const result = await installComponent(comp);\n switch (result.status) {\n case \"installed\":\n results.installed.push(result);\n installedComponents.push({ name: result.name, version: result.version! });\n\n // Add dependency results to the main results\n if (result.dependencyResults) {\n for (const depResult of result.dependencyResults) {\n switch (depResult.status) {\n case \"installed\":\n results.installed.push(depResult);\n break;\n case \"skipped\":\n results.skipped.push(depResult);\n break;\n case \"failed\":\n results.failed.push(depResult);\n break;\n }\n }\n }\n break;\n case \"skipped\":\n results.skipped.push(result);\n break;\n case \"failed\":\n results.failed.push(result);\n\n // Add dependency results to the main results even if main component failed\n if (result.dependencyResults) {\n for (const depResult of result.dependencyResults) {\n switch (depResult.status) {\n case \"installed\":\n results.installed.push(depResult);\n break;\n case \"skipped\":\n results.skipped.push(depResult);\n break;\n case \"failed\":\n results.failed.push(depResult);\n break;\n }\n }\n }\n break;\n }\n }\n\n // ================================================================\n // Update Config File\n // ================================================================\n if (installedComponents.length > 0) {\n try {\n await updateConfig({ components: installedComponents }, { appendComponents: true });\n } catch (error) {\n p.log.error(\n `Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n process.exit(1);\n }\n }\n\n // ================================================================\n // Installation summary\n // ================================================================\n p.log.message(`\\n\\n${highlighter.underline(\"Installation Summary\")}`);\n\n if (results.failed.length > 0) {\n p.log.error(\n `${highlighter.error(\"Failed to install components:\")}\\n${results.failed\n .map((r) => ` ${r.name} - ${r.error}`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.skipped.length > 0) {\n p.log.warn(\n `${highlighter.warn(\"Skipped components (already installed):\")}\\n${results.skipped\n .map((r) => ` ${r.name} v${r.version}`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.installed.length > 0) {\n p.log.success(\n `${highlighter.success(\"Successfully installed components:\")}\n${results.installed.map((r) => ` ${r.name} v${r.version}`).join(\"\\n\")}`,\n );\n }\n\n // Show registry component results in the final summary\n if (registryResults) {\n if (registryResults.failed.length > 0) {\n p.log.error(\n `${highlighter.error(\"Failed to install registry components:\")}\n${registryResults.failed\n .map((name) => ` ${name} - see the error message above for further details`)\n .join(\"\\n\")}`,\n );\n }\n\n if (registryResults.success.length > 0) {\n p.log.success(\n `${highlighter.success(\"Successfully installed registry components:\")}\n${registryResults.success.map((name) => ` ${name}`).join(\"\\n\")}`,\n );\n }\n }\n\n await sleep(1000);\n\n p.outro(\"Enjoy using Starwind UI 🚀\");\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to add components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n","export const MIN_ASTRO_VERSION = \"5.0.0\";\n\n/**\n * File system paths used throughout the application\n */\nexport const PATHS = {\n STARWIND_CORE: \"@starwind-ui/core\",\n STARWIND_CORE_COMPONENTS: \"src/components\",\n STARWIND_REMOTE_COMPONENT_REGISTRY: \"https://starwind.dev/registry.json\",\n STARWIND_PRO_REGISTRY: \"https://pro.starwind.dev/r/{name}\",\n LOCAL_CSS_FILE: \"src/styles/starwind.css\",\n LOCAL_CONFIG_FILE: \"starwind.config.json\",\n LOCAL_STYLES_DIR: \"src/styles\",\n LOCAL_COMPONENTS_DIR: \"src/components\",\n} as const;\n\n/**\n * Core framework dependencies\n */\nexport const ASTRO_PACKAGES = {\n core: \"astro@latest\",\n} as const;\n\n/**\n * Tailwind CSS and other dependencies\n */\nexport const OTHER_PACKAGES = {\n tailwindCore: \"tailwindcss@^4\",\n tailwindVite: \"@tailwindcss/vite@^4\",\n tailwindForms: \"@tailwindcss/forms@^0.5\",\n tailwindAnimate: \"tw-animate-css@^1\",\n tailwindVariants: \"tailwind-variants@^3\",\n tailwindMerge: \"tailwind-merge@^3\",\n tablerIcons: \"@tabler/icons@^3\",\n} as const;\n\n/**\n * Get all Tailwind CSS related packages as an array\n */\nexport function getOtherPackages(): string[] {\n return Object.values(OTHER_PACKAGES);\n}\n\n/**\n * Get all Astro related packages as an array\n */\nexport function getAstroPackages(): string[] {\n return Object.values(ASTRO_PACKAGES);\n}\n","import fs from \"fs-extra\";\n\n/**\n * Ensures a directory exists, creating it and its parents if necessary\n * @param dir - Directory path to ensure exists\n */\nexport async function ensureDirectory(dir: string) {\n await fs.ensureDir(dir);\n}\n\n/**\n * Copies a file from source to destination\n * @param src - Source file path\n * @param dest - Destination file path\n */\nexport async function copyFile(src: string, dest: string) {\n await fs.copy(src, dest);\n}\n\n/**\n * Reads and parses a JSON file\n * @param filePath - Path to the JSON file\n * @returns Parsed JSON content\n */\nexport async function readJsonFile(filePath: string) {\n return fs.readJson(filePath);\n}\n\n/**\n * Writes data to a JSON file\n * @param filePath - Path to write the JSON file\n * @param data - Data to write to the file\n */\nexport async function writeJsonFile(filePath: string, data: unknown) {\n await fs.writeJson(filePath, data, { spaces: 2 });\n}\n\n/**\n * Checks if a file exists\n * @param filePath - Path to check\n * @returns True if the file exists, false otherwise\n */\nexport async function fileExists(filePath: string) {\n return fs.pathExists(filePath);\n}\n\n/**\n * Creates a CSS file with the provided content\n * @param filePath - Path to write the CSS file\n * @param content - CSS content to write\n */\nexport async function writeCssFile(filePath: string, content: string) {\n await fs.writeFile(filePath, content, \"utf-8\");\n}\n","import { PATHS } from \"./constants.js\";\nimport { fileExists, readJsonFile, writeJsonFile } from \"./fs.js\";\n\ninterface ComponentConfig {\n name: string;\n version: string;\n}\n\ninterface TailwindConfig {\n css: string;\n baseColor: \"slate\" | \"gray\" | \"zinc\" | \"neutral\" | \"stone\";\n cssVariables: boolean;\n}\n\n// interface AliasConfig {\n// \tcomponents: string;\n// }\n\nexport interface StarwindConfig {\n $schema: string;\n tailwind: TailwindConfig;\n // aliases: AliasConfig;\n componentDir: string;\n components: ComponentConfig[];\n}\n\nconst defaultConfig: StarwindConfig = {\n $schema: \"https://starwind.dev/config-schema.json\",\n tailwind: {\n css: \"src/styles/starwind.css\",\n baseColor: \"neutral\",\n cssVariables: true,\n },\n // aliases: {\n // \tcomponents: \"@/components\",\n // },\n componentDir: \"src/components/starwind\",\n components: [],\n};\n\n/**\n * Get the current config, ensuring the file is fully read\n */\nexport async function getConfig(): Promise<StarwindConfig> {\n try {\n if (await fileExists(PATHS.LOCAL_CONFIG_FILE)) {\n const config = await readJsonFile(PATHS.LOCAL_CONFIG_FILE);\n return {\n ...defaultConfig,\n ...config,\n components: Array.isArray(config.components) ? config.components : [],\n };\n }\n } catch (error) {\n console.error(\"Error reading config:\", error);\n }\n\n return defaultConfig;\n}\n\n/**\n * Options for updating the config file\n */\nexport interface UpdateConfigOptions {\n /** If true, append new components to existing array. If false, replace the components array. */\n appendComponents?: boolean;\n}\n\n/**\n * Update the config file, ensuring the write operation is completed\n * @param updates - Partial config object to update\n * @param options - Options for updating the config\n */\nexport async function updateConfig(\n updates: Partial<StarwindConfig>,\n options: UpdateConfigOptions = { appendComponents: true },\n): Promise<void> {\n const currentConfig = await getConfig();\n\n // Ensure components array exists\n const currentComponents = Array.isArray(currentConfig.components) ? currentConfig.components : [];\n\n const newConfig = {\n ...currentConfig,\n tailwind: {\n ...currentConfig.tailwind,\n ...(updates.tailwind || {}),\n },\n componentDir: updates.componentDir ? updates.componentDir : currentConfig.componentDir,\n components: updates.components\n ? options.appendComponents\n ? [...currentComponents, ...updates.components]\n : updates.components\n : currentComponents,\n };\n\n try {\n await writeJsonFile(PATHS.LOCAL_CONFIG_FILE, newConfig);\n } catch (error) {\n throw new Error(\n `Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n }\n}\n","import chalk from \"chalk\";\n\nexport const highlighter = {\n error: chalk.red,\n warn: chalk.yellow,\n info: chalk.cyan,\n infoBright: chalk.cyanBright,\n success: chalk.greenBright,\n underline: chalk.underline,\n title: chalk.bgBlue,\n};\n","import * as p from \"@clack/prompts\";\n\nimport { copyComponent, type InstallResult } from \"./component.js\";\nimport { getConfig, updateConfig } from \"./config.js\";\nimport {\n type DependencyResolution,\n filterUninstalledDependencies,\n separateDependencies,\n} from \"./dependency-resolver.js\";\nimport { highlighter } from \"./highlighter.js\";\nimport { installDependencies, requestPackageManager } from \"./package-manager.js\";\nimport { confirmInstall, getStarwindDependencyResolutions } from \"./prompts.js\";\nimport { getComponent } from \"./registry.js\";\n\nexport async function installComponent(name: string): Promise<InstallResult> {\n const component = await getComponent(name);\n\n if (!component) {\n return {\n status: \"failed\",\n name,\n error: \"Component not found in registry\",\n };\n }\n\n // Initialize dependency results\n let dependencyResults: InstallResult[] = [];\n\n // Handle dependencies installation\n if (component.dependencies.length > 0) {\n const confirmed = await confirmInstall(component);\n if (!confirmed) {\n return {\n status: \"failed\",\n name,\n error: \"Installation cancelled by user\",\n };\n }\n\n const { starwindDependencies, npmDependencies } = separateDependencies(component.dependencies);\n\n // Install npm dependencies\n if (npmDependencies.length > 0) {\n try {\n // Filter out already installed dependencies with valid versions\n const dependenciesToInstall = await filterUninstalledDependencies(npmDependencies);\n\n if (dependenciesToInstall.length > 0) {\n const pm = await requestPackageManager();\n\n const installTasks = [\n {\n title: `Installing ${dependenciesToInstall.length === 1 ? \"dependency\" : \"dependencies\"}`,\n task: async () => {\n await installDependencies(dependenciesToInstall, pm);\n return `${highlighter.info(\"Dependencies installed successfully\")}`;\n },\n },\n ];\n\n await p.tasks(installTasks);\n } else {\n // All dependencies are already installed with valid versions\n p.log.info(\n `${highlighter.info(\"All npm dependencies are already installed with valid versions\")}`,\n );\n }\n } catch (error) {\n return {\n status: \"failed\",\n name,\n error: `Failed to install npm dependencies: ${error instanceof Error ? error.message : String(error)}`,\n };\n }\n }\n\n // Install Starwind component dependencies\n if (starwindDependencies.length > 0) {\n let resolutions: DependencyResolution[] = [];\n try {\n resolutions = await getStarwindDependencyResolutions([name]);\n } catch (error) {\n console.warn(\n \"Proceeding without Starwind dependency installs due to resolution error:\",\n error,\n );\n resolutions = [];\n }\n\n if (resolutions.length > 0) {\n const installResults = await installStarwindDependencies(resolutions);\n dependencyResults = installResults;\n\n // Check if any dependency installation failed\n const failedDeps = installResults.filter((r: InstallResult) => r.status === \"failed\");\n if (failedDeps.length > 0) {\n return {\n status: \"failed\",\n name,\n error: `Failed to install Starwind dependencies: ${failedDeps.map((r: InstallResult) => r.name).join(\", \")}`,\n dependencyResults,\n };\n }\n }\n }\n }\n\n // Copy the component files\n const result = await copyComponent(name);\n\n // Include dependency results if any\n if (dependencyResults.length > 0) {\n return {\n ...result,\n dependencyResults,\n };\n }\n\n return result;\n}\n\n/**\n * Installs Starwind component dependencies based on dependency resolutions\n * @param resolutions - Array of dependency resolutions\n * @returns Promise<InstallResult[]> - Array of installation results\n */\nexport async function installStarwindDependencies(\n resolutions: DependencyResolution[],\n): Promise<InstallResult[]> {\n const results: InstallResult[] = [];\n const componentsToInstall: Array<{ name: string; version: string }> = [];\n const componentsToUpdate: Array<{ name: string; version: string }> = [];\n\n for (const resolution of resolutions) {\n if (resolution.needsInstall) {\n // Install the component\n const result = await copyComponent(resolution.component);\n results.push(result);\n\n if (result.status === \"installed\" && result.version) {\n componentsToInstall.push({ name: result.name, version: result.version });\n }\n } else if (resolution.needsUpdate) {\n // Update the component\n const result = await copyComponent(resolution.component, true); // overwrite = true\n results.push(result);\n\n if (result.status === \"installed\" && result.version) {\n componentsToUpdate.push({ name: result.name, version: result.version });\n }\n }\n }\n\n // Update config with newly installed components (append)\n if (componentsToInstall.length > 0) {\n try {\n await updateConfig({ components: componentsToInstall }, { appendComponents: true });\n } catch (error) {\n console.error(\"Failed to update config after installing new dependencies:\", error);\n }\n }\n\n // Update config with updated components (replace existing entries)\n if (componentsToUpdate.length > 0) {\n try {\n await updateExistingComponents(componentsToUpdate);\n } catch (error) {\n console.error(\"Failed to update config after updating dependencies:\", error);\n }\n }\n\n return results;\n}\n\n/**\n * Updates existing components in the config by replacing their versions\n * @param componentsToUpdate - Array of components with their new versions\n */\nasync function updateExistingComponents(\n componentsToUpdate: Array<{ name: string; version: string }>,\n): Promise<void> {\n const config = await getConfig();\n const updatedComponents = [...config.components];\n\n // Update existing components or add new ones\n for (const componentUpdate of componentsToUpdate) {\n const existingIndex = updatedComponents.findIndex((comp) => comp.name === componentUpdate.name);\n\n if (existingIndex >= 0) {\n // Update existing component version\n updatedComponents[existingIndex] = {\n name: componentUpdate.name,\n version: componentUpdate.version,\n };\n } else {\n // Add new component if not found (shouldn't happen in update case, but safety net)\n updatedComponents.push(componentUpdate);\n }\n }\n\n // Replace the entire components array\n await updateConfig({ components: updatedComponents }, { appendComponents: false });\n}\n","import * as path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport * as p from \"@clack/prompts\";\nimport fs from \"fs-extra\";\nimport semver from \"semver\";\n\nimport { getConfig } from \"./config.js\";\nimport { PATHS } from \"./constants.js\";\nimport { highlighter } from \"./highlighter.js\";\nimport { getComponent, getRegistry } from \"./registry.js\";\n\nexport type InstallResult = {\n status: \"installed\" | \"skipped\" | \"failed\";\n name: string;\n version?: string;\n error?: string;\n dependencyResults?: InstallResult[];\n};\n\nexport interface RemoveResult {\n name: string;\n status: \"removed\" | \"failed\";\n error?: string;\n}\n\nexport interface UpdateResult {\n name: string;\n status: \"updated\" | \"skipped\" | \"failed\";\n oldVersion?: string;\n newVersion?: string;\n error?: string;\n}\n\n/**\n * Copies a component from the core package to the local components directory\n * @param name - The name of the component to copy\n * @param overwrite - If true, will overwrite existing component instead of skipping\n * @returns A result object indicating the installation status\n */\nexport async function copyComponent(name: string, overwrite = false): Promise<InstallResult> {\n const config = await getConfig();\n\n // Ensure components array exists\n const currentComponents = Array.isArray(config.components) ? config.components : [];\n\n // Check if component already exists\n if (!overwrite && currentComponents.some((component) => component.name === name)) {\n const existingComponent = currentComponents.find((c) => c.name === name);\n return {\n status: \"skipped\",\n name,\n version: existingComponent?.version,\n };\n }\n\n const componentDir = path.join(config.componentDir, \"starwind\", name);\n\n try {\n await fs.ensureDir(componentDir);\n\n // Get the path to the installed @starwind/core package\n const pkgUrl = import.meta.resolve?.(PATHS.STARWIND_CORE);\n if (!pkgUrl) {\n throw new Error(`Could not resolve ${PATHS.STARWIND_CORE} package, is it installed?`);\n }\n\n const coreDir = path.dirname(fileURLToPath(pkgUrl));\n const sourceDir = path.join(coreDir, PATHS.STARWIND_CORE_COMPONENTS, name);\n\n const files = await fs.readdir(sourceDir);\n\n for (const file of files) {\n const sourcePath = path.join(sourceDir, file);\n const destPath = path.join(componentDir, file);\n await fs.copy(sourcePath, destPath, { overwrite: true });\n }\n\n // Get component version from registry\n const registry = await getRegistry();\n const componentInfo = registry.find((c) => c.name === name);\n if (!componentInfo) {\n throw new Error(`Component ${name} not found in registry`);\n }\n\n return {\n status: \"installed\",\n name,\n version: componentInfo.version,\n };\n } catch (error) {\n return {\n status: \"failed\",\n name,\n error: error instanceof Error ? error.message : \"Unknown error\",\n };\n }\n}\n\n/**\n * Removes a component from the project's component directory\n * @param name - The name of the component to remove\n * @param componentDir - The base directory where components are installed\n * @returns A result object indicating the removal status and any errors\n */\nexport async function removeComponent(name: string, componentDir: string): Promise<RemoveResult> {\n try {\n const componentPath = path.join(componentDir, \"starwind\", name);\n\n // Check if component directory exists\n if (await fs.pathExists(componentPath)) {\n // Remove the component directory\n await fs.remove(componentPath);\n return { name, status: \"removed\" };\n } else {\n return {\n name,\n status: \"failed\",\n error: \"Component directory not found\",\n };\n }\n } catch (error) {\n return {\n name,\n status: \"failed\",\n error: error instanceof Error ? error.message : \"Unknown error\",\n };\n }\n}\n\n/**\n * Updates a component to its latest version from the registry\n * @param name - The name of the component to update\n * @param currentVersion - The currently installed version\n * @param skipConfirm - If true, skips the confirmation prompt\n * @returns A result object indicating the update status\n */\nexport async function updateComponent(\n name: string,\n currentVersion: string,\n skipConfirm?: boolean,\n): Promise<UpdateResult> {\n try {\n // Get latest version from registry\n const registryComponent = await getComponent(name);\n if (!registryComponent) {\n return {\n name,\n status: \"failed\",\n error: \"Component not found in registry\",\n };\n }\n\n // Compare versions\n if (!semver.gt(registryComponent.version, currentVersion)) {\n return {\n name,\n status: \"skipped\",\n oldVersion: currentVersion,\n newVersion: registryComponent.version,\n };\n }\n\n // Confirm the component update with warning about overriding, unless skipConfirm is true\n let confirmUpdate = true; // Default to true if skipping confirmation\n if (!skipConfirm) {\n // Only prompt if skipConfirm is false or undefined\n const confirmedResult = await p.confirm({\n message: `Update component ${highlighter.info(\n name,\n )} from ${highlighter.warn(`v${currentVersion}`)} to ${highlighter.success(\n `v${registryComponent.version}`,\n )}? This will override the existing implementation.`,\n });\n\n // Check for cancellation immediately\n if (p.isCancel(confirmedResult)) {\n p.cancel(\"Update cancelled.\");\n return {\n name,\n status: \"skipped\",\n oldVersion: currentVersion,\n newVersion: registryComponent.version, // Still useful to return the target version\n };\n }\n\n // If not cancelled, confirmedResult is boolean. Assign it.\n confirmUpdate = confirmedResult;\n }\n\n // Now confirmUpdate is guaranteed to be boolean, proceed with the check\n if (!confirmUpdate) {\n // Handle non-confirmation ('No' was selected)\n p.log.info(`Skipping update for ${highlighter.info(name)}`);\n return {\n name,\n status: \"skipped\",\n oldVersion: currentVersion,\n newVersion: registryComponent.version,\n };\n }\n\n // Remove and reinstall component with overwrite enabled\n const result = await copyComponent(name, true);\n\n if (result.status === \"installed\") {\n return {\n name,\n status: \"updated\",\n oldVersion: currentVersion,\n newVersion: result.version,\n };\n } else {\n return {\n name,\n status: \"failed\",\n error: result.error || \"Failed to update component\",\n };\n }\n } catch (error) {\n return {\n name,\n status: \"failed\",\n error: error instanceof Error ? error.message : \"Unknown error\",\n };\n }\n}\n","import { registry as localRegistry } from \"@starwind-ui/core\";\nimport { z } from \"zod\";\n\nimport { PATHS } from \"./constants.js\";\n\n// Configuration to select registry source\nconst REGISTRY_CONFIG = {\n // Set to 'remote' to fetch from remote server or 'local' to use the imported registry\n SOURCE: \"local\" as \"remote\" | \"local\",\n};\n\nconst componentSchema = z.object({\n name: z.string(),\n version: z.string(),\n dependencies: z.array(z.string()).default([]),\n type: z.enum([\"component\"]),\n});\n\nexport type Component = z.infer<typeof componentSchema>;\n\n// Schema for the root registry object\nconst registryRootSchema = z.object({\n $schema: z.string().optional(),\n components: z.array(componentSchema),\n});\n\n// Cache for registry data - stores the promise of fetching to avoid multiple simultaneous requests\nconst registryCache = new Map<string, Promise<Component[]>>();\n\n/**\n * Fetches the component registry from either the remote server or the local import\n * @param forceRefresh Whether to force a refresh of the cache\n * @returns A promise that resolves to an array of Components\n */\nexport async function getRegistry(forceRefresh = false): Promise<Component[]> {\n const cacheKey =\n REGISTRY_CONFIG.SOURCE === \"remote\"\n ? PATHS.STARWIND_REMOTE_COMPONENT_REGISTRY\n : \"local-registry\";\n\n // Return cached promise if available and refresh not forced\n if (!forceRefresh && registryCache.has(cacheKey)) {\n return registryCache.get(cacheKey)!;\n }\n\n // Create a new promise for the registry operation based on source\n const registryPromise =\n REGISTRY_CONFIG.SOURCE === \"remote\"\n ? fetchRemoteRegistry()\n : Promise.resolve(getLocalRegistry());\n\n // Cache the promise\n registryCache.set(cacheKey, registryPromise);\n\n return registryPromise;\n}\n\n/**\n * Internal function to fetch the registry from the remote server\n */\nasync function fetchRemoteRegistry(): Promise<Component[]> {\n try {\n const response = await fetch(PATHS.STARWIND_REMOTE_COMPONENT_REGISTRY);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch registry: ${response.status} ${response.statusText}`);\n }\n\n const data = await response.json();\n const parsedRegistry = registryRootSchema.parse(data);\n\n return parsedRegistry.components;\n } catch (error) {\n console.error(\"Failed to load remote registry:\", error);\n throw error;\n }\n}\n\n/**\n * Internal function to get the registry from the local import\n */\nfunction getLocalRegistry(): Component[] {\n try {\n // Validate the local registry with the schema\n const components = localRegistry.map((comp) => componentSchema.parse(comp));\n return components;\n } catch (error) {\n console.error(\"Failed to validate local registry:\", error);\n throw error;\n }\n}\n\n/**\n * Clear the registry cache\n */\nexport function clearRegistryCache(): void {\n registryCache.clear();\n}\n\n/**\n * Get a component by name from the registry\n * @param name The name of the component to find\n * @param forceRefresh Whether to force a refresh of the registry cache\n * @returns The component or undefined if not found\n */\nexport async function getComponent(\n name: string,\n forceRefresh = false,\n): Promise<Component | undefined> {\n const registry = await getRegistry(forceRefresh);\n return registry.find((component) => component.name === name);\n}\n\n/**\n * Get all components from the registry\n * @param forceRefresh Whether to force a refresh of the registry cache\n * @returns All components in the registry\n */\nexport async function getAllComponents(forceRefresh = false): Promise<Component[]> {\n return getRegistry(forceRefresh);\n}\n\n/**\n * Set the registry source\n * @param source The source to use: 'remote' or 'local'\n */\nexport function setRegistrySource(source: \"remote\" | \"local\"): void {\n if (REGISTRY_CONFIG.SOURCE !== source) {\n REGISTRY_CONFIG.SOURCE = source;\n clearRegistryCache(); // Clear cache when changing sources\n }\n}\n","import semver from \"semver\";\n\nimport { getConfig } from \"./config.js\";\nimport { readJsonFile } from \"./fs.js\";\nimport { getComponent } from \"./registry.js\";\n\n/**\n * Checks if npm dependencies are already installed with valid versions\n * @param dependencies - Array of dependency strings (e.g., [\"react@^18.0.0\", \"typescript@^5.0.0\"])\n * @returns Array of dependencies that need to be installed\n */\nexport async function filterUninstalledDependencies(dependencies: string[]): Promise<string[]> {\n try {\n const pkg = await readJsonFile(\"package.json\");\n const installedDeps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };\n\n const dependenciesToInstall: string[] = [];\n\n for (const dep of dependencies) {\n let packageName: string;\n let requiredVersion: string;\n\n // Handle scoped packages properly (e.g., \"@scope/name@^1.2.3\")\n if (dep.startsWith(\"@\")) {\n // For scoped packages, find the last \"@\" to split package name and version\n const lastAtIndex = dep.lastIndexOf(\"@\");\n if (lastAtIndex > 0) {\n packageName = dep.substring(0, lastAtIndex);\n requiredVersion = dep.substring(lastAtIndex + 1);\n } else {\n // No version specified for scoped package\n packageName = dep;\n requiredVersion = \"*\";\n }\n } else {\n // For non-scoped packages, split on first \"@\"\n const atIndex = dep.indexOf(\"@\");\n if (atIndex > 0) {\n packageName = dep.substring(0, atIndex);\n requiredVersion = dep.substring(atIndex + 1);\n } else {\n // No version specified\n packageName = dep;\n requiredVersion = \"*\";\n }\n }\n\n const installedVersion = installedDeps[packageName];\n\n if (!installedVersion) {\n // Package not installed, needs installation\n dependenciesToInstall.push(dep);\n } else if (requiredVersion && requiredVersion !== \"*\") {\n // Check if installed version satisfies required version\n // Clean the installed version using semver.clean or manual prefix removal\n const cleanInstalledVersion =\n semver.clean(installedVersion) || installedVersion.replace(/^[\\^~>=<= ]+/, \"\");\n\n try {\n if (!semver.satisfies(cleanInstalledVersion, requiredVersion)) {\n dependenciesToInstall.push(dep);\n }\n } catch (error) {\n // If semver comparison fails, assume we need to install\n dependenciesToInstall.push(dep);\n }\n }\n // If no version specified or version satisfies, skip installation\n }\n\n return dependenciesToInstall;\n } catch (error) {\n // If we can't read package.json, install all dependencies\n return dependencies;\n }\n}\n\nexport interface StarwindDependency {\n name: string;\n version: string;\n originalSpec: string;\n}\n\nexport interface DependencyResolution {\n component: string;\n currentVersion?: string;\n requiredVersion: string;\n needsInstall: boolean;\n needsUpdate: boolean;\n isStarwindComponent: boolean;\n}\n\n/**\n * Parses a Starwind component dependency string\n * @param dependency - Dependency string like \"@starwind-ui/core/button@^2.1.0\"\n * @returns Parsed dependency object or null if not a Starwind component\n */\nexport function parseStarwindDependency(dependency: string): StarwindDependency | null {\n const starwindPattern = /^@starwind-ui\\/core\\/([^@]+)@(.+)$/;\n const match = dependency.match(starwindPattern);\n\n if (!match) {\n return null;\n }\n\n const [, name, version] = match;\n return {\n name,\n version,\n originalSpec: dependency,\n };\n}\n\n/**\n * Checks if a dependency is a Starwind component dependency\n * @param dependency - Dependency string to check\n * @returns True if it's a Starwind component dependency\n */\nexport function isStarwindDependency(dependency: string): boolean {\n return parseStarwindDependency(dependency) !== null;\n}\n\n/**\n * Gets the currently installed version of a Starwind component\n * @param componentName - Name of the component to check\n * @returns Version string if installed, undefined if not installed\n */\nexport async function getInstalledComponentVersion(\n componentName: string,\n): Promise<string | undefined> {\n try {\n const config = await getConfig();\n const installedComponent = config.components.find((comp) => comp.name === componentName);\n return installedComponent?.version;\n } catch {\n return undefined;\n }\n}\n\n/**\n * Resolves a single Starwind component dependency\n * @param dependency - Dependency string to resolve\n * @returns Resolution information for the dependency\n */\nexport async function resolveStarwindDependency(\n dependency: string,\n): Promise<DependencyResolution | null> {\n const parsed = parseStarwindDependency(dependency);\n\n if (!parsed) {\n return {\n component: dependency,\n requiredVersion: \"\",\n needsInstall: false,\n needsUpdate: false,\n isStarwindComponent: false,\n };\n }\n\n const currentVersion = await getInstalledComponentVersion(parsed.name);\n const registryComponent = await getComponent(parsed.name);\n\n if (!registryComponent) {\n throw new Error(`Starwind component \"${parsed.name}\" not found in registry`);\n }\n\n let needsInstall = false;\n let needsUpdate = false;\n\n if (!currentVersion) {\n // Component not installed\n needsInstall = true;\n } else {\n // Component is installed, check if version satisfies requirement\n if (!semver.satisfies(currentVersion, parsed.version)) {\n // Current version doesn't satisfy requirement\n // Check if registry version satisfies requirement\n if (semver.satisfies(registryComponent.version, parsed.version)) {\n needsUpdate = true;\n } else {\n throw new Error(\n `No version of \"${parsed.name}\" satisfies requirement \"${parsed.version}\". ` +\n `Latest available: ${registryComponent.version}, currently installed: ${currentVersion}`,\n );\n }\n }\n }\n\n return {\n component: parsed.name,\n currentVersion,\n requiredVersion: parsed.version,\n needsInstall,\n needsUpdate,\n isStarwindComponent: true,\n };\n}\n\n/**\n * Recursively resolves all Starwind component dependencies\n * @param componentNames - Array of component names to resolve dependencies for\n * @param resolved - Set of already resolved components to avoid circular dependencies\n * @returns Array of dependency resolutions\n */\nexport async function resolveAllStarwindDependencies(\n componentNames: string[],\n resolved: Set<string> = new Set(),\n): Promise<DependencyResolution[]> {\n const resolutions: DependencyResolution[] = [];\n\n for (const componentName of componentNames) {\n if (resolved.has(componentName)) {\n continue;\n }\n\n resolved.add(componentName);\n\n const component = await getComponent(componentName);\n if (!component) {\n throw new Error(`Component \"${componentName}\" not found in registry`);\n }\n\n // Process dependencies of this component\n for (const dependency of component.dependencies) {\n const resolution = await resolveStarwindDependency(dependency);\n\n if (resolution && resolution.isStarwindComponent) {\n // Add this dependency to resolutions if it needs action\n if (resolution.needsInstall || resolution.needsUpdate) {\n resolutions.push(resolution);\n }\n\n // Recursively resolve dependencies of this dependency\n const nestedResolutions = await resolveAllStarwindDependencies(\n [resolution.component],\n resolved,\n );\n resolutions.push(...nestedResolutions);\n }\n }\n }\n\n // Remove duplicates and prioritize installs over updates\n const uniqueResolutions = new Map<string, DependencyResolution>();\n\n for (const resolution of resolutions) {\n const existing = uniqueResolutions.get(resolution.component);\n\n if (!existing) {\n uniqueResolutions.set(resolution.component, resolution);\n } else {\n // If we have both install and update for same component, prioritize install\n if (resolution.needsInstall && !existing.needsInstall) {\n uniqueResolutions.set(resolution.component, resolution);\n }\n }\n }\n\n return Array.from(uniqueResolutions.values());\n}\n\n/**\n * Separates regular npm dependencies from Starwind component dependencies\n * @param dependencies - Array of dependency strings\n * @returns Object with separated dependencies\n */\nexport function separateDependencies(dependencies: string[]): {\n starwindDependencies: string[];\n npmDependencies: string[];\n} {\n const starwindDependencies: string[] = [];\n const npmDependencies: string[] = [];\n\n for (const dependency of dependencies) {\n if (isStarwindDependency(dependency)) {\n starwindDependencies.push(dependency);\n } else {\n npmDependencies.push(dependency);\n }\n }\n\n return { starwindDependencies, npmDependencies };\n}\n","import * as p from \"@clack/prompts\";\nimport { execa } from \"execa\";\n\nimport { fileExists } from \"./fs.js\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\n/**\n * Prompts the user to select their preferred package manager\n * @returns The selected package manager, defaults to npm if cancelled\n */\nexport async function requestPackageManager(): Promise<PackageManager> {\n const pm = await p.select({\n message: \"Select your preferred package manager\",\n options: [\n { value: \"pnpm\", label: \"pnpm\", hint: \"Default\" },\n { value: \"npm\", label: \"npm\" },\n { value: \"yarn\", label: \"yarn\" },\n { value: \"bun\", label: \"bun\" },\n ],\n });\n\n if (p.isCancel(pm)) {\n p.log.warn(\"No package manager selected, defaulting to npm\");\n return \"npm\";\n }\n\n return pm as PackageManager;\n}\n\n/**\n * Detects the currently running package manager from user agent\n * @returns The detected package manager, or null if not detected\n */\nexport function getCurrentPackageManager(): PackageManager | null {\n const userAgent = process.env.npm_config_user_agent;\n\n if (userAgent) {\n if (userAgent.includes(\"pnpm\")) {\n return \"pnpm\";\n } else if (userAgent.includes(\"yarn\")) {\n return \"yarn\";\n } else if (userAgent.includes(\"npm\")) {\n return \"npm\";\n } else if (userAgent.includes(\"bun\")) {\n return \"bun\";\n }\n }\n\n return null;\n}\n\n/**\n * Detects and returns the default package manager based on lock files\n * @returns The detected package manager, defaults to npm if no lock file is found\n */\nexport async function getDefaultPackageManager(): Promise<PackageManager> {\n // First try to detect the currently running package manager\n const current = getCurrentPackageManager();\n if (current) {\n return current;\n }\n\n // Fallback to lock file detection\n if (await fileExists(\"yarn.lock\")) {\n return \"yarn\";\n } else if (await fileExists(\"pnpm-lock.yaml\")) {\n return \"pnpm\";\n } else {\n return \"npm\";\n }\n}\n\n/**\n * Gets the appropriate command to run shadcn with the detected package manager\n * @returns The command array for execa\n */\nexport async function getShadcnCommand(): Promise<[string, string[]]> {\n const pm = await getDefaultPackageManager();\n\n switch (pm) {\n case \"pnpm\":\n return [\"pnpm\", [\"dlx\", \"shadcn@3\"]];\n case \"yarn\":\n return [\"yarn\", [\"dlx\", \"shadcn@3\"]];\n case \"bun\":\n return [\"bunx\", [\"shadcn@3\"]];\n case \"npm\":\n default:\n return [\"npx\", [\"shadcn@3\"]];\n }\n}\n\n/**\n * Installs the specified packages using the detected package manager\n * @param packages - Array of package names to install\n * @param pm - The package manager to use\n * @param dev - Whether to install as dev dependencies\n * @param force - Whether to force install packages\n */\nexport async function installDependencies(\n packages: string[],\n pm: PackageManager,\n dev = false,\n force = false,\n): Promise<void> {\n const args = [\n pm === \"npm\" ? \"install\" : \"add\",\n ...packages,\n dev ? (pm === \"npm\" || pm === \"pnpm\" ? \"-D\" : \"--dev\") : \"\",\n force ? \"--force\" : \"\",\n ].filter(Boolean);\n\n await execa(pm, args);\n}\n","import { confirm, multiselect } from \"@clack/prompts\";\n\nimport {\n type DependencyResolution,\n filterUninstalledDependencies,\n resolveAllStarwindDependencies,\n separateDependencies,\n} from \"./dependency-resolver.js\";\nimport { highlighter } from \"./highlighter.js\";\nimport type { Component } from \"./registry.js\";\nimport { getAllComponents } from \"./registry.js\";\n\nexport async function selectComponents(): Promise<string[]> {\n const components = await getAllComponents();\n\n const selected = await multiselect({\n message: \"Select components to add\",\n options: components.map((component) => ({\n label: component.name,\n value: component.name,\n })),\n required: false,\n });\n\n // Return empty array if user cancels selection\n if (typeof selected === \"symbol\") {\n return [];\n }\n\n return selected;\n}\n\n/**\n * Confirms installation of Starwind component dependencies\n * @param componentNames - Array of component names to check dependencies for\n * @returns Promise<boolean> - true if user confirms, false otherwise\n */\nexport async function confirmStarwindDependencies(componentNames: string[]): Promise<boolean> {\n try {\n const resolutions = await resolveAllStarwindDependencies(componentNames);\n\n if (resolutions.length === 0) {\n return true; // No Starwind dependencies to handle\n }\n\n const toInstall = resolutions.filter((r) => r.needsInstall);\n const toUpdate = resolutions.filter((r) => r.needsUpdate);\n\n let message = \"This component has Starwind component dependencies:\\n\\n\";\n\n if (toInstall.length > 0) {\n message += `${highlighter.info(\"Components to install:\")}\\n`;\n for (const dep of toInstall) {\n message += ` • ${dep.component} (requires ${dep.requiredVersion})\\n`;\n }\n message += \"\\n\";\n }\n\n if (toUpdate.length > 0) {\n message += `${highlighter.warn(\"Components to update:\")}\\n`;\n for (const dep of toUpdate) {\n message += ` • ${dep.component} (${dep.currentVersion} → latest, requires ${dep.requiredVersion})\\n`;\n }\n message += \"\\n\";\n }\n\n message += \"Proceed with installation?\";\n\n const confirmed = await confirm({ message });\n\n if (typeof confirmed === \"symbol\") {\n return false;\n }\n\n return confirmed;\n } catch (error) {\n console.error(\"Error resolving Starwind dependencies:\", error);\n const confirmed = await confirm({\n message: `Error resolving dependencies: ${error instanceof Error ? error.message : \"Unknown error\"}. Continue anyway?`,\n });\n\n if (typeof confirmed === \"symbol\") {\n return false;\n }\n\n return confirmed;\n }\n}\n\n/**\n * Gets the dependency resolutions for given component names\n * @param componentNames - Array of component names to resolve dependencies for\n * @returns Promise<DependencyResolution[]> - Array of dependency resolutions\n */\nexport async function getStarwindDependencyResolutions(\n componentNames: string[],\n): Promise<DependencyResolution[]> {\n return resolveAllStarwindDependencies(componentNames);\n}\n\nexport async function confirmInstall(component: Component): Promise<boolean> {\n if (component.dependencies.length === 0) return true;\n\n const { starwindDependencies, npmDependencies } = separateDependencies(component.dependencies);\n\n // Handle npm dependencies - only prompt for dependencies that need to be installed\n if (npmDependencies.length > 0) {\n const dependenciesToInstall = await filterUninstalledDependencies(npmDependencies);\n\n if (dependenciesToInstall.length > 0) {\n const confirmed = await confirm({\n message: `This component requires the following npm dependencies: ${dependenciesToInstall.join(\", \")}. Install them?`,\n });\n\n if (typeof confirmed === \"symbol\" || !confirmed) {\n return false;\n }\n }\n }\n\n // Handle Starwind component dependencies\n if (starwindDependencies.length > 0) {\n const confirmed = await confirmStarwindDependencies([component.name]);\n if (!confirmed) {\n return false;\n }\n }\n\n return true;\n}\n","import { PATHS } from \"./constants.js\";\nimport { fileExists, readJsonFile, writeJsonFile } from \"./fs.js\";\n\nexport interface ShadcnRegistry {\n url: string;\n headers?: Record<string, string>;\n}\n\nexport interface ShadcnConfig {\n $schema?: string;\n registries?: Record<string, ShadcnRegistry>;\n aliases?: {\n components?: string;\n utils?: string;\n };\n tailwind?: {\n config?: string;\n css?: string;\n baseColor?: string;\n cssVariables?: boolean;\n };\n style?: string;\n rsc?: boolean;\n}\n\nconst COMPONENTS_JSON_PATH = \"components.json\";\n\n/**\n * Creates a default shadcn components.json configuration with Starwind Pro registry\n */\nexport function createDefaultShadcnConfig(\n cssFilePath: string,\n baseColor: string = \"neutral\",\n): ShadcnConfig {\n return {\n $schema: \"https://ui.shadcn.com/schema.json\",\n registries: {\n \"@starwind-pro\": {\n url: PATHS.STARWIND_PRO_REGISTRY,\n headers: {\n Authorization: \"Bearer ${STARWIND_LICENSE_KEY}\",\n },\n },\n },\n aliases: {\n components: \"@/components\",\n utils: \"@/lib/utils\",\n },\n tailwind: {\n config: \"\",\n css: cssFilePath,\n baseColor,\n cssVariables: true,\n },\n style: \"default\",\n rsc: true,\n };\n}\n\n/**\n * Checks if components.json exists in the project root\n */\nexport async function componentsJsonExists(): Promise<boolean> {\n return fileExists(COMPONENTS_JSON_PATH);\n}\n\n/**\n * Reads the existing components.json file\n */\nexport async function readComponentsJson(): Promise<ShadcnConfig> {\n try {\n return await readJsonFile(COMPONENTS_JSON_PATH);\n } catch (error) {\n throw new Error(`Failed to read components.json: ${error}`);\n }\n}\n\n/**\n * Writes the components.json file\n */\nexport async function writeComponentsJson(config: ShadcnConfig): Promise<void> {\n try {\n await writeJsonFile(COMPONENTS_JSON_PATH, config);\n } catch (error) {\n throw new Error(`Failed to write components.json: ${error}`);\n }\n}\n\n/**\n * Adds or updates the Starwind Pro registry in an existing components.json\n */\nexport function addStarwindProRegistry(config: ShadcnConfig): ShadcnConfig {\n const updatedConfig = { ...config };\n\n // Initialize registries if it doesn't exist\n if (!updatedConfig.registries) {\n updatedConfig.registries = {};\n }\n\n // Add or update the Starwind Pro registry\n updatedConfig.registries[\"@starwind-pro\"] = {\n url: PATHS.STARWIND_PRO_REGISTRY,\n headers: {\n Authorization: \"Bearer ${STARWIND_LICENSE_KEY}\",\n },\n };\n\n return updatedConfig;\n}\n\n/**\n * Sets up shadcn components.json for Starwind Pro\n * Creates new file if it doesn't exist, or updates existing file\n */\nexport async function setupShadcnProConfig(\n cssFilePath: string,\n baseColor: string = \"neutral\",\n): Promise<void> {\n const exists = await componentsJsonExists();\n\n if (!exists) {\n // Create new components.json with pro registry\n const config = createDefaultShadcnConfig(cssFilePath, baseColor);\n await writeComponentsJson(config);\n } else {\n // Update existing components.json to add pro registry\n const existingConfig = await readComponentsJson();\n const updatedConfig = addStarwindProRegistry(existingConfig);\n await writeComponentsJson(updatedConfig);\n }\n}\n\n/**\n * Checks if the Starwind Pro registry is already configured with authorized URL\n */\nexport async function hasStarwindProRegistry(): Promise<boolean> {\n if (!(await componentsJsonExists())) {\n return false;\n }\n\n try {\n const config = await readComponentsJson();\n const starwindProRegistry = config.registries?.[\"@starwind-pro\"];\n\n if (!starwindProRegistry?.url) {\n return false;\n }\n\n // Validate that the registry URL is from authorized domains\n const url = starwindProRegistry.url;\n const isAuthorized =\n url.startsWith(\"http://localhost\") || url.startsWith(\"https://pro.starwind.dev\");\n\n return isAuthorized;\n } catch {\n return false;\n }\n}\n","/**\n * Pauses execution for the specified number of milliseconds.\n * @param ms - The number of milliseconds to sleep\n */\nexport const sleep = async (ms: number): Promise<void> => {\n await new Promise((resolve) => setTimeout(resolve, ms));\n};\n","import { highlighter } from \"../utils/highlighter.js\";\nimport { type Component, getAllComponents } from \"./registry.js\";\n\n/**\n * Checks if a component name exists in the registry\n * @param component - The component name to validate\n * @param availableComponents - Optional array of available components from registry\n */\nexport async function isValidComponent(\n component: string,\n availableComponents?: Component[],\n): Promise<boolean> {\n const components = availableComponents || (await getAllComponents());\n return components.some((c) => c.name === component);\n}\n\n/**\n * Validates that a component exists in the registry\n * @param component - The component name to validate\n * @throws {Error} If the component is not found in the registry\n */\nexport async function validateComponent(component: string): Promise<void> {\n const components = await getAllComponents();\n if (!(await isValidComponent(component, components))) {\n const availableComponents = components.map((c) => highlighter.info(c.name));\n throw new Error(\n `Invalid component: ${highlighter.error(component)}.\\nAvailable components:\\n ${availableComponents.join(\"\\n \")}`,\n );\n }\n}\n","import path from \"node:path\";\n\nimport * as p from \"@clack/prompts\";\nimport semver from \"semver\";\n\nimport { tailwindConfig } from \"@/templates/starwind.css.js\";\nimport { setupAstroConfig } from \"@/utils/astro-config.js\";\nimport { updateConfig } from \"@/utils/config.js\";\nimport { ASTRO_PACKAGES, getOtherPackages, MIN_ASTRO_VERSION, PATHS } from \"@/utils/constants.js\";\nimport { ensureDirectory, fileExists, readJsonFile, writeCssFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport {\n getDefaultPackageManager,\n installDependencies,\n requestPackageManager,\n} from \"@/utils/package-manager.js\";\nimport { hasStarwindProRegistry, setupShadcnProConfig } from \"@/utils/shadcn-config.js\";\nimport { sleep } from \"@/utils/sleep.js\";\n\nexport async function init(\n withinAdd: boolean = false,\n options?: { defaults?: boolean; pro?: boolean },\n) {\n if (!withinAdd) {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n }\n\n try {\n // Validate project structure\n if (!(await fileExists(\"package.json\"))) {\n throw new Error(\n \"No package.json found. Please run this command in the root of your project.\",\n );\n }\n\n const pkg = await readJsonFile(\"package.json\");\n\n // Check Astro version compatibility\n const installTasks = [];\n const configTasks = [];\n\n // ================================================================\n // Prepare project structure and configuration tasks\n // ================================================================\n let configChoices;\n\n // Use defaults if specified, otherwise prompt user for choices\n if (options?.defaults) {\n configChoices = {\n installLocation: PATHS.LOCAL_COMPONENTS_DIR,\n cssFile: PATHS.LOCAL_CSS_FILE,\n twBaseColor: \"neutral\",\n };\n\n if (!withinAdd) {\n p.log.info(\"Using default configuration values\");\n }\n } else {\n configChoices = await p.group(\n {\n // ask where to install components\n installLocation: () =>\n p.text({\n message: \"What is your components directory?\",\n placeholder: PATHS.LOCAL_COMPONENTS_DIR,\n initialValue: PATHS.LOCAL_COMPONENTS_DIR,\n validate(value) {\n // Check for empty value\n if (value.length === 0) return `Value is required!`;\n\n // Check for absolute paths\n if (path.isAbsolute(value)) return `Please use a relative path`;\n\n // Check for path traversal attempts\n if (value.includes(\"..\")) return `Path traversal is not allowed`;\n\n // Check for invalid characters in path\n const invalidChars = /[<>:\"|?*]/;\n if (invalidChars.test(value)) return `Path contains invalid characters`;\n\n // Check if path starts with system directories\n const systemDirs = [\"windows\", \"program files\", \"system32\"];\n if (systemDirs.some((dir) => value.toLowerCase().startsWith(dir))) {\n return `Cannot install in system directories`;\n }\n },\n }),\n // ask where to add the css file\n cssFile: () =>\n p.text({\n message: `Where would you like to add the Tailwind ${highlighter.info(\".css\")} file?`,\n placeholder: PATHS.LOCAL_CSS_FILE,\n initialValue: PATHS.LOCAL_CSS_FILE,\n validate(value) {\n // Check for empty value\n if (value.length === 0) return `Value is required!`;\n\n // Must end with .css\n if (!value.endsWith(\".css\")) return `File must end with .css extension`;\n\n // Check for absolute paths\n if (path.isAbsolute(value)) return `Please use a relative path`;\n\n // Check for path traversal attempts\n if (value.includes(\"..\")) return `Path traversal is not allowed`;\n\n // Check for invalid characters in path\n const invalidChars = /[<>:\"|?*]/;\n if (invalidChars.test(value)) return `Path contains invalid characters`;\n\n // Check if path starts with system directories\n const systemDirs = [\"windows\", \"program files\", \"system32\"];\n if (systemDirs.some((dir) => value.toLowerCase().startsWith(dir))) {\n return `Cannot use system directories`;\n }\n\n // Ensure the path has a valid filename\n const basename = path.basename(value, \".css\");\n if (!basename || basename.trim().length === 0) {\n return `Invalid filename`;\n }\n },\n }),\n\n twBaseColor: () =>\n p.select({\n message: \"What Tailwind base color would you like to use?\",\n initialValue: \"neutral\",\n options: [\n { label: \"Neutral (default)\", value: \"neutral\" },\n { label: \"Stone\", value: \"stone\" },\n { label: \"Zinc\", value: \"zinc\" },\n { label: \"Gray\", value: \"gray\" },\n { label: \"Slate\", value: \"slate\" },\n ],\n }),\n },\n {\n // On Cancel callback that wraps the group\n // So if the user cancels one of the prompts in the group this function will be called\n onCancel: () => {\n p.cancel(\"Operation cancelled.\");\n process.exit(0);\n },\n },\n );\n }\n\n // ================================================================\n // Make sure appropriate directories exist\n // ================================================================\n const cssFileDir = path.dirname(configChoices.cssFile);\n const componentInstallDir = path.join(configChoices.installLocation, \"starwind\");\n configTasks.push({\n title: \"Creating project structure\",\n task: async () => {\n await ensureDirectory(componentInstallDir);\n await ensureDirectory(cssFileDir);\n await sleep(250);\n return \"Created project structure\";\n },\n });\n\n // ================================================================\n // Prepare Astro config file setup\n // ================================================================\n configTasks.push({\n title: \"Setup Astro config file\",\n task: async () => {\n const success = await setupAstroConfig();\n if (!success) {\n throw new Error(\"Failed to setup Astro config\");\n }\n await sleep(250);\n return \"Astro config setup completed\";\n },\n });\n\n // ================================================================\n // Prepare CSS file\n // ================================================================\n // Check if CSS file already exists\n const cssFileExists = await fileExists(configChoices.cssFile);\n let updatedTailwindConfig = tailwindConfig;\n\n if (configChoices.twBaseColor !== \"neutral\") {\n // replace all \"--color-neutral\" with \"--color-twBaseColor\"\n updatedTailwindConfig = updatedTailwindConfig.replace(\n /--color-neutral-/g,\n `--color-${configChoices.twBaseColor}-`,\n );\n }\n\n if (cssFileExists) {\n const shouldOverride = options?.defaults\n ? true\n : await p.confirm({\n message: `${highlighter.info(configChoices.cssFile)} already exists. Do you want to override it?`,\n });\n\n if (p.isCancel(shouldOverride)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldOverride) {\n p.log.info(\"Skipping Tailwind CSS configuration\");\n } else {\n configTasks.push({\n title: \"Creating Tailwind CSS configuration\",\n task: async () => {\n await writeCssFile(configChoices.cssFile, updatedTailwindConfig);\n await sleep(250);\n return \"Created Tailwind configuration\";\n },\n });\n }\n } else {\n configTasks.push({\n title: \"Creating Tailwind CSS configuration\",\n task: async () => {\n await writeCssFile(configChoices.cssFile, updatedTailwindConfig);\n await sleep(250);\n return \"Created Tailwind configuration\";\n },\n });\n }\n\n // ================================================================\n // Prepare project starwind configuration\n // ================================================================\n configTasks.push({\n title: \"Updating project configuration\",\n task: async () => {\n await updateConfig({\n tailwind: {\n css: configChoices.cssFile,\n baseColor: configChoices.twBaseColor as \"slate\" | \"gray\" | \"zinc\" | \"neutral\" | \"stone\",\n cssVariables: true,\n },\n // aliases: {\n // \tcomponents: \"@/components\",\n // },\n componentDir: configChoices.installLocation,\n components: [],\n });\n await sleep(250);\n return \"Updated project starwind configuration\";\n },\n });\n\n // ================================================================\n // Prepare Starwind Pro configuration (if enabled)\n // ================================================================\n if (options?.pro) {\n const alreadyHasPro = await hasStarwindProRegistry();\n\n if (!alreadyHasPro) {\n if (!withinAdd) {\n p.log.info(highlighter.info(\"Setting up Starwind Pro configuration...\"));\n }\n\n configTasks.push({\n title: \"Setting up Starwind Pro registry\",\n task: async () => {\n await setupShadcnProConfig(configChoices.cssFile, configChoices.twBaseColor);\n await sleep(250);\n return \"Configured Starwind Pro registry in components.json\";\n },\n });\n } else {\n if (!withinAdd) {\n p.log.info(highlighter.info(\"Starwind Pro registry already configured\"));\n }\n }\n }\n\n // ================================================================\n // Prepare astro installation\n // ================================================================\n // Request package manager\n const pm = options?.defaults ? await getDefaultPackageManager() : await requestPackageManager();\n\n if (pkg.dependencies?.astro) {\n const astroVersion = pkg.dependencies.astro.replace(/^\\^|~/, \"\");\n if (!semver.gte(astroVersion, MIN_ASTRO_VERSION)) {\n const shouldUpgrade = options?.defaults\n ? true\n : await p.confirm({\n message: `Starwind requires Astro v${MIN_ASTRO_VERSION} or higher. Would you like to upgrade from v${astroVersion}?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldUpgrade)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldUpgrade) {\n p.cancel(\"Astro v5 or higher is required to use Starwind\");\n return process.exit(1);\n }\n\n installTasks.push({\n title: \"Upgrading Astro\",\n task: async () => {\n await installDependencies([ASTRO_PACKAGES.core], pm);\n return \"Upgraded Astro successfully\";\n },\n });\n }\n } else {\n const shouldInstall = options?.defaults\n ? true\n : await p.confirm({\n message: `Starwind requires Astro v${MIN_ASTRO_VERSION} or higher. Would you like to install it?`,\n initialValue: true,\n });\n\n if (p.isCancel(shouldInstall)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (!shouldInstall) {\n p.cancel(\"Astro is required to use Starwind\");\n return process.exit(1);\n }\n\n installTasks.push({\n title: `Installing ${ASTRO_PACKAGES.core}`,\n task: async () => {\n await installDependencies([ASTRO_PACKAGES.core], pm);\n return `Installed ${highlighter.info(ASTRO_PACKAGES.core)} successfully`;\n },\n });\n }\n\n // ================================================================\n // Prepare tailwind and other package installation\n // ================================================================\n const otherPackages = getOtherPackages();\n\n const shouldInstall = options?.defaults\n ? true\n : await p.confirm({\n message: `Install ${highlighter.info(otherPackages.join(\", \"))} using ${highlighter.info(pm)}?`,\n });\n\n if (p.isCancel(shouldInstall)) {\n p.cancel(\"Operation cancelled\");\n return process.exit(0);\n }\n\n if (shouldInstall) {\n installTasks.push({\n title: `Installing packages`,\n task: async () => {\n await installDependencies(getOtherPackages(), pm, false, false);\n return `${highlighter.info(\"Packages installed successfully\")}`;\n },\n });\n } else {\n p.log.warn(\n highlighter.warn(`Skipped installation of packages. Make sure to install them manually`),\n );\n }\n\n // ================================================================\n // Execute all tasks\n // ================================================================\n if (installTasks.length > 0) {\n await p.tasks(installTasks);\n }\n\n if (configTasks.length > 0) {\n await p.tasks(configTasks);\n }\n\n await sleep(250);\n\n let nextStepsMessage = `Make sure your layout imports the ${highlighter.infoBright(configChoices.cssFile)} file`;\n\n if (options?.pro) {\n nextStepsMessage += `\\n\\nStarwind Pro is now configured! You can install pro components using:\\n${highlighter.info(\"npx starwind@latest add @starwind-pro/component-name\")}\\n\\nMake sure to set your ${highlighter.infoBright(\"STARWIND_LICENSE_KEY\")} environment variable.`;\n }\n\n p.note(nextStepsMessage, \"Next steps\");\n\n if (!withinAdd) {\n sleep(1000);\n const outroMessage = options?.pro\n ? \"Enjoy using Starwind UI with Pro components! 🚀✨\"\n : \"Enjoy using Starwind UI 🚀\";\n p.outro(outroMessage);\n }\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to add components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n","export const tailwindConfig = `@import \"tailwindcss\";\n@import \"tw-animate-css\";\n@plugin \"@tailwindcss/forms\";\n@custom-variant dark (&:where(.dark, .dark *));\n\n@theme {\n --animate-accordion-down: accordion-down 0.2s ease-out;\n --animate-accordion-up: accordion-up 0.2s ease-out;\n\n @keyframes accordion-down {\n from {\n height: 0;\n }\n to {\n height: var(--starwind-accordion-content-height);\n }\n }\n\n @keyframes accordion-up {\n from {\n height: var(--starwind-accordion-content-height);\n }\n to {\n height: 0;\n }\n }\n}\n\n@theme inline {\n --color-background: var(--background);\n --color-foreground: var(--foreground);\n --color-card: var(--card);\n --color-card-foreground: var(--card-foreground);\n --color-popover: var(--popover);\n --color-popover-foreground: var(--popover-foreground);\n --color-primary: var(--primary);\n --color-primary-foreground: var(--primary-foreground);\n --color-primary-accent: var(--primary-accent);\n --color-secondary: var(--secondary);\n --color-secondary-foreground: var(--secondary-foreground);\n --color-secondary-accent: var(--secondary-accent);\n --color-muted: var(--muted);\n --color-muted-foreground: var(--muted-foreground);\n --color-accent: var(--accent);\n --color-accent-foreground: var(--accent-foreground);\n --color-info: var(--info);\n --color-info-foreground: var(--info-foreground);\n --color-success: var(--success);\n --color-success-foreground: var(--success-foreground);\n --color-warning: var(--warning);\n --color-warning-foreground: var(--warning-foreground);\n --color-error: var(--error);\n --color-error-foreground: var(--error-foreground);\n --color-border: var(--border);\n --color-input: var(--input);\n --color-outline: var(--outline);\n\n --radius-xs: calc(var(--radius) - 0.375rem);\n --radius-sm: calc(var(--radius) - 0.25rem);\n --radius-md: calc(var(--radius) - 0.125rem);\n --radius-lg: var(--radius);\n --radius-xl: calc(var(--radius) + 0.25rem);\n --radius-2xl: calc(var(--radius) + 0.5rem);\n --radius-3xl: calc(var(--radius) + 1rem);\n}\n\n:root {\n --background: var(--color-white);\n --foreground: var(--color-neutral-950);\n --card: var(--color-white);\n --card-foreground: var(--color-neutral-950);\n --popover: var(--color-white);\n --popover-foreground: var(--color-neutral-950);\n --primary: var(--color-blue-700);\n --primary-foreground: var(--color-neutral-50);\n --primary-accent: var(--color-blue-700);\n --secondary: var(--color-fuchsia-700);\n --secondary-foreground: var(--color-neutral-50);\n --secondary-accent: var(--color-fuchsia-700);\n --muted: var(--color-neutral-100);\n --muted-foreground: var(--color-neutral-600);\n --accent: var(--color-neutral-100);\n --accent-foreground: var(--color-neutral-900);\n --info: var(--color-sky-300);\n --info-foreground: var(--color-sky-950);\n --success: var(--color-green-300);\n --success-foreground: var(--color-green-950);\n --warning: var(--color-amber-300);\n --warning-foreground: var(--color-amber-950);\n --error: var(--color-red-700);\n --error-foreground: var(--color-neutral-50);\n --border: var(--color-neutral-200);\n --input: var(--color-neutral-200);\n --outline: var(--color-neutral-400);\n --radius: 0.625rem;\n}\n\n.dark {\n --background: var(--color-neutral-950);\n --foreground: var(--color-neutral-50);\n --card: var(--color-neutral-900);\n --card-foreground: var(--color-neutral-50);\n --popover: var(--color-neutral-800);\n --popover-foreground: var(--color-neutral-50);\n --primary: var(--color-blue-700);\n --primary-foreground: var(--color-neutral-50);\n --primary-accent: var(--color-blue-400);\n --secondary: var(--color-fuchsia-700);\n --secondary-foreground: var(--color-neutral-50);\n --secondary-accent: var(--color-fuchsia-400);\n --muted: var(--color-neutral-800);\n --muted-foreground: var(--color-neutral-400);\n --accent: var(--color-neutral-700);\n --accent-foreground: var(--color-neutral-100);\n --info: var(--color-sky-300);\n --info-foreground: var(--color-sky-950);\n --success: var(--color-green-300);\n --success-foreground: var(--color-green-950);\n --warning: var(--color-amber-300);\n --warning-foreground: var(--color-amber-950);\n --error: var(--color-red-800);\n --error-foreground: var(--color-neutral-50);\n --border: --alpha(var(--color-neutral-50) / 10%);\n --input: --alpha(var(--color-neutral-50) / 15%);\n --outline: var(--color-neutral-500);\n}\n\n@layer base {\n * {\n @apply border-border outline-outline/50;\n }\n body {\n @apply bg-background text-foreground scheme-light dark:scheme-dark;\n }\n button {\n @apply cursor-pointer;\n }\n}\n`;\n","import * as p from \"@clack/prompts\";\nimport fs from \"fs-extra\";\nimport semver from \"semver\";\n\nimport { readJsonFile } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\n\nimport { fileExists } from \"./fs.js\";\n\nconst CONFIG_EXTENSIONS = [\"ts\", \"js\", \"mjs\", \"cjs\"] as const;\n// type ConfigExtension = (typeof CONFIG_EXTENSIONS)[number];\n\n/**\n * Finds the Astro config file in the current directory\n * @returns The path to the config file if found, null otherwise\n */\nasync function findAstroConfig(): Promise<string | null> {\n for (const ext of CONFIG_EXTENSIONS) {\n const configPath = `astro.config.${ext}`;\n if (await fileExists(configPath)) {\n return configPath;\n }\n }\n return null;\n}\n\n/**\n * Gets the installed Astro version from the project's package.json\n * @returns The installed Astro version or null if not found\n */\nasync function getAstroVersion(): Promise<string | null> {\n try {\n const pkg = await readJsonFile(\"package.json\");\n if (pkg.dependencies?.astro) {\n const astroVersion = pkg.dependencies.astro.replace(/^\\^|~/, \"\");\n return astroVersion;\n }\n\n p.log.error(\n highlighter.error(\n \"Astro seems not installed in your project, please check your package.json\",\n ),\n );\n return null;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred\";\n p.log.error(highlighter.error(`Failed to check Astro version: ${errorMessage}`));\n return null;\n }\n}\n\n/**\n * Updates or creates the Astro configuration file\n * @returns true if successful, false otherwise\n */\nexport async function setupAstroConfig(): Promise<boolean> {\n try {\n let configPath = await findAstroConfig();\n let content = \"\";\n\n if (configPath) {\n content = await fs.readFile(configPath, \"utf-8\");\n } else {\n configPath = \"astro.config.ts\";\n content = `import { defineConfig } from \"astro/config\";\\n\\nexport default defineConfig({});\\n`;\n }\n\n // Add tailwindcss import if not present\n if (!content.includes('import tailwindcss from \"@tailwindcss/vite\"')) {\n content = `import tailwindcss from \"@tailwindcss/vite\";\\n${content}`;\n }\n\n // Parse the configuration object\n const configStart = content.indexOf(\"defineConfig(\") + \"defineConfig(\".length;\n const configEnd = content.lastIndexOf(\");\");\n let config = content.slice(configStart, configEnd);\n\n // Remove outer braces and trim\n config = config.trim().replace(/^{|}$/g, \"\").trim();\n\n const astroVersion = await getAstroVersion();\n\n if (astroVersion && semver.lt(astroVersion, \"5.7.0\")) {\n // Add experimental configuration\n if (!config.includes(\"experimental\")) {\n // Ensure there's a comma before adding new property if config is not empty\n const needsComma = config.length > 0 && !config.trimEnd().endsWith(\",\");\n config +=\n (needsComma ? \",\" : \"\") +\n `\\n\\texperimental: {\n\t\tsvg: true,\n\t},`;\n } else if (!config.includes(\"svg: true\") && !config.includes(\"svg: {\")) {\n // Insert svg config into existing experimental block\n const expEnd = config.indexOf(\"experimental:\") + \"experimental:\".length;\n const blockStart = config.indexOf(\"{\", expEnd) + 1;\n config = config.slice(0, blockStart) + `\\n\\t\\tsvg: true,` + config.slice(blockStart);\n }\n }\n\n // Add vite configuration\n if (!config.includes(\"vite:\")) {\n // Ensure there's a comma before adding new property if config is not empty\n const needsComma = config.length > 0 && !config.trimEnd().endsWith(\",\");\n config +=\n (needsComma ? \",\" : \"\") +\n `\\n\\tvite: {\n\t\tplugins: [tailwindcss()],\n\t},`;\n } else if (!config.includes(\"plugins: [\")) {\n // Insert plugins into existing vite block\n const viteEnd = config.indexOf(\"vite:\") + \"vite:\".length;\n const blockStart = config.indexOf(\"{\", viteEnd) + 1;\n config =\n config.slice(0, blockStart) + `\\n\\t\\tplugins: [tailwindcss()],` + config.slice(blockStart);\n } else if (!config.includes(\"tailwindcss()\")) {\n // Add tailwindcss to existing plugins array\n const pluginsStart = config.indexOf(\"plugins:\") + \"plugins:\".length;\n const arrayStart = config.indexOf(\"[\", pluginsStart) + 1;\n config = config.slice(0, arrayStart) + `tailwindcss(), ` + config.slice(arrayStart);\n }\n\n // Reconstruct the file content\n const newContent = `${content.slice(0, configStart)}{\\n\\t${config}\\n}${content.slice(configEnd)}`;\n\n await fs.writeFile(configPath, newContent, \"utf-8\");\n return true;\n } catch (error) {\n const errorMessage = error instanceof Error ? error.message : \"An unknown error occurred\";\n p.log.error(highlighter.error(`Failed to setup Astro config: ${errorMessage}`));\n return false;\n }\n}\n","import * as p from \"@clack/prompts\";\n\nimport { removeComponent, type RemoveResult } from \"@/utils/component.js\";\nimport { getConfig, updateConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { sleep } from \"@/utils/sleep.js\";\n\nexport async function remove(components?: string[], options?: { all?: boolean }) {\n try {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n // Check if starwind.config.json exists\n const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n if (!configExists) {\n p.log.error(\"No Starwind configuration found. Please run starwind init first.\");\n process.exit(1);\n }\n\n // Get current config and installed components\n const config = await getConfig();\n const installedComponents = config.components;\n\n if (installedComponents.length === 0) {\n p.log.warn(\"No components are currently installed.\");\n process.exit(0);\n }\n\n let componentsToRemove: string[] = [];\n\n // ================================================================\n // Get components to remove\n // ================================================================\n if (options?.all) {\n // Remove all installed components\n componentsToRemove = installedComponents.map((comp) => comp.name);\n p.log.info(`Removing all ${componentsToRemove.length} installed components...`);\n } else if (components && components.length > 0) {\n // Validate that all specified components are installed\n const invalid = components.filter(\n (comp) => !installedComponents.some((ic) => ic.name === comp),\n );\n\n if (invalid.length > 0) {\n p.log.warn(\n `${highlighter.warn(\"Components not found:\")}\\n${invalid\n .map((name) => ` ${name}`)\n .join(\"\\n\")}`,\n );\n }\n\n componentsToRemove = components.filter((comp) =>\n installedComponents.some((ic) => ic.name === comp),\n );\n\n if (componentsToRemove.length === 0) {\n p.log.warn(\"No valid components to remove\");\n process.exit(0);\n }\n } else {\n // Show interactive prompt with installed components\n const choices = installedComponents.map((comp) => ({\n value: comp.name,\n label: comp.name,\n }));\n\n const selected = await p.multiselect({\n message: \"Select components to remove\",\n options: choices,\n });\n\n if (p.isCancel(selected)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n componentsToRemove = selected as string[];\n }\n\n if (componentsToRemove.length === 0) {\n p.log.warn(\"No components selected for removal\");\n process.exit(0);\n }\n\n // Confirm removal\n const confirmed = await p.confirm({\n message: `Remove ${componentsToRemove\n .map((comp) => highlighter.info(comp))\n .join(\", \")} ${componentsToRemove.length > 1 ? \"components\" : \"component\"}?`,\n });\n\n if (!confirmed || p.isCancel(confirmed)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n const results = {\n removed: [] as RemoveResult[],\n failed: [] as RemoveResult[],\n };\n\n // ================================================================\n // Remove Components\n // ================================================================\n for (const comp of componentsToRemove) {\n const result = await removeComponent(comp, config.componentDir);\n if (result.status === \"removed\") {\n results.removed.push(result);\n } else {\n results.failed.push(result);\n }\n }\n\n // ================================================================\n // Update Config File\n // ================================================================\n // Update config file by writing the filtered components directly\n const updatedComponents = config.components.filter(\n (comp) => !componentsToRemove.includes(comp.name),\n );\n await updateConfig(\n {\n ...config,\n components: updatedComponents,\n },\n { appendComponents: false },\n );\n\n // ================================================================\n // Removal summary\n // ================================================================\n p.log.message(`\\n\\n${highlighter.underline(\"Removal Summary\")}`);\n\n if (results.failed.length > 0) {\n p.log.error(\n `${highlighter.error(\"Failed to remove components:\")}\\n${results.failed\n .map((r) => ` ${r.name} - ${r.error}`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.removed.length > 0) {\n p.log.success(\n `${highlighter.success(\"Successfully removed components:\")}\\n${results.removed\n .map((r) => ` ${r.name}`)\n .join(\"\\n\")}`,\n );\n }\n\n await sleep(1000);\n\n if (results.removed.length > 0) {\n p.outro(\"Components removed successfully 🗑️\");\n } else {\n p.cancel(\"Errors occurred while removing components\");\n process.exit(1);\n }\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to remove components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n","import * as p from \"@clack/prompts\";\n\nimport { updateComponent, type UpdateResult } from \"@/utils/component.js\";\nimport { getConfig } from \"@/utils/config.js\";\nimport { updateConfig } from \"@/utils/config.js\";\nimport { PATHS } from \"@/utils/constants.js\";\nimport { fileExists } from \"@/utils/fs.js\";\nimport { highlighter } from \"@/utils/highlighter.js\";\nimport { sleep } from \"@/utils/sleep.js\";\n\n// Define the type for options more explicitly\ninterface UpdateOptions {\n all?: boolean;\n yes?: boolean;\n}\n\nexport async function update(components?: string[], options?: UpdateOptions) {\n try {\n p.intro(highlighter.title(\" Welcome to the Starwind CLI \"));\n\n // Check if starwind.config.json exists\n const configExists = await fileExists(PATHS.LOCAL_CONFIG_FILE);\n\n if (!configExists) {\n p.log.error(\"No Starwind configuration found. Please run starwind init first.\");\n process.exit(1);\n }\n\n // Get current config and installed components\n const config = await getConfig();\n const installedComponents = config.components;\n\n if (installedComponents.length === 0) {\n p.log.warn(\"No components are currently installed.\");\n process.exit(0);\n }\n\n let componentsToUpdate: string[] = [];\n\n // ================================================================\n // Get components to update\n // ================================================================\n if (options?.all) {\n // Update all installed components\n componentsToUpdate = installedComponents.map((comp) => comp.name);\n p.log.info(`Checking updates for all ${componentsToUpdate.length} installed components...`);\n } else if (components && components.length > 0) {\n // Validate that all specified components are installed\n const invalid = components.filter(\n (comp) => !installedComponents.some((ic) => ic.name === comp),\n );\n\n if (invalid.length > 0) {\n p.log.warn(\n `${highlighter.warn(\"Components not found in project:\")}\\n${invalid\n .map((name) => ` ${name}`)\n .join(\"\\n\")}`,\n );\n }\n\n componentsToUpdate = components.filter((comp) =>\n installedComponents.some((ic) => ic.name === comp),\n );\n\n if (componentsToUpdate.length === 0) {\n p.log.warn(\"No valid components to update\");\n process.exit(0);\n }\n } else {\n // Show interactive prompt with installed components\n const choices = installedComponents.map((comp) => ({\n value: comp.name,\n label: comp.name,\n }));\n\n const selected = await p.multiselect({\n message: \"Select components to update\",\n options: choices,\n });\n\n if (p.isCancel(selected)) {\n p.cancel(\"Operation cancelled\");\n process.exit(0);\n }\n\n componentsToUpdate = selected as string[];\n }\n\n if (componentsToUpdate.length === 0) {\n p.log.warn(\"No components selected for update\");\n process.exit(0);\n }\n\n const results = {\n updated: [] as UpdateResult[],\n skipped: [] as UpdateResult[],\n failed: [] as UpdateResult[],\n };\n\n // ================================================================\n // Update Components\n // ================================================================\n for (const comp of componentsToUpdate) {\n const currentVersion = installedComponents.find((ic) => ic.name === comp)?.version;\n if (!currentVersion) {\n results.failed.push({\n name: comp,\n status: \"failed\",\n error: \"Could not determine current version\",\n });\n continue;\n }\n\n // Pass the 'yes' option down to updateComponent\n const result = await updateComponent(comp, currentVersion, options?.yes);\n switch (result.status) {\n case \"updated\":\n results.updated.push(result);\n break;\n case \"skipped\":\n results.skipped.push(result);\n break;\n case \"failed\":\n results.failed.push(result);\n break;\n }\n }\n\n // ================================================================\n // Update Config File\n // ================================================================\n if (results.updated.length > 0) {\n try {\n // Create a map of current components, excluding updated ones\n const updatedComponentNames = new Set(results.updated.map((r) => r.name));\n const currentComponents = config.components.filter(\n (comp) => !updatedComponentNames.has(comp.name),\n );\n\n // Add the updated components with their new versions\n const updatedComponents = [\n ...currentComponents,\n ...results.updated.map((r) => ({\n name: r.name,\n version: r.newVersion!,\n })),\n ];\n\n await updateConfig(\n {\n components: updatedComponents,\n },\n { appendComponents: false },\n );\n } catch (error) {\n p.log.error(\n `Failed to update config: ${error instanceof Error ? error.message : \"Unknown error\"}`,\n );\n process.exit(1);\n }\n }\n\n // ================================================================\n // Update summary\n // ================================================================\n p.log.message(`\\n\\n${highlighter.underline(\"Update Summary\")}`);\n\n if (results.failed.length > 0) {\n p.log.error(\n `${highlighter.error(\"Failed to update components:\")}\\n${results.failed\n .map((r) => ` ${r.name} - ${r.error}`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.skipped.length > 0) {\n p.log.info(\n `${highlighter.info(\"Components already up to date or skipped:\")}\\n${results.skipped\n .map((r) => ` ${r.name} (${r.oldVersion})`)\n .join(\"\\n\")}`,\n );\n }\n\n if (results.updated.length > 0) {\n p.log.success(\n `${highlighter.success(\"Successfully updated components:\")}\\n${results.updated\n .map((r) => ` ${r.name} (${r.oldVersion} → ${r.newVersion})`)\n .join(\"\\n\")}`,\n );\n }\n\n await sleep(1000);\n\n if (results.updated.length > 0) {\n p.outro(\"Components updated successfully 🚀\");\n } else if (results.skipped.length > 0 && results.failed.length === 0) {\n p.outro(\"Components already up to date or skipped ✨\");\n } else {\n p.cancel(\"No components were updated\");\n process.exit(1);\n }\n } catch (error) {\n p.log.error(error instanceof Error ? error.message : \"Failed to update components\");\n p.cancel(\"Operation cancelled\");\n process.exit(1);\n }\n}\n"],"mappings":";;;AAEA,SAAS,eAAe;;;ACFxB;AAAA,EACE,MAAQ;AAAA,EACR,SAAW;AAAA,EACX,aAAe;AAAA,EACf,SAAW;AAAA,EACX,QAAU;AAAA,IACR,MAAQ;AAAA,IACR,KAAO;AAAA,EACT;AAAA,EACA,YAAc;AAAA,IACZ,MAAQ;AAAA,IACR,KAAO;AAAA,IACP,WAAa;AAAA,EACf;AAAA,EACA,UAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA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D,OAAO,MAAM;AAEhB,QAAQ,MAAM;","names":["p","execa","p","fs","fs","semver","semver","p","confirm","confirm","path","p","semver","p","fs","semver","fs","semver","path","semver","shouldInstall","execa","p","p"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starwind",
3
- "version": "1.12.0",
3
+ "version": "1.12.2",
4
4
  "description": "Add beautifully designed components to your Astro applications",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -35,20 +35,20 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@clack/prompts": "0.11.0",
38
- "@starwind-ui/core": "1.12.0",
39
- "chalk": "5.4.1",
40
- "commander": "14.0.0",
38
+ "@starwind-ui/core": "1.12.1",
39
+ "chalk": "5.6.2",
40
+ "commander": "14.0.2",
41
41
  "execa": "9.6.0",
42
- "fs-extra": "11.2.0",
43
- "semver": "7.7.2",
42
+ "fs-extra": "11.3.2",
43
+ "semver": "7.7.3",
44
44
  "zod": "3.25.74"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@types/fs-extra": "11.0.4",
48
- "@types/node": "24.0.10",
48
+ "@types/node": "24.10.1",
49
49
  "@types/prompts": "2.4.9",
50
- "@types/semver": "7.5.8",
51
- "tsup": "8.5.0"
50
+ "@types/semver": "7.7.1",
51
+ "tsup": "8.5.1"
52
52
  },
53
53
  "engines": {
54
54
  "node": "^20.6.0 || >=22.0.0"