ionbit-ui 0.2.0 → 0.2.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 +32 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import { Command } from "commander";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import { writeFileSync, existsSync, readFileSync, mkdirSync } from "node:fs";
|
|
5
|
-
import { resolve, dirname, relative } from "node:path";
|
|
6
|
-
import {
|
|
5
|
+
import { resolve, dirname, sep, relative } from "node:path";
|
|
6
|
+
import { spawnSync } from "node:child_process";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
8
|
+
const REGISTRY_REF = "0.2.2".includes("-") ? "main" : `v${"0.2.2"}`;
|
|
9
|
+
const REGISTRY_BASE = `https://raw.githubusercontent.com/rostislaw9/ionbit-ui/${REGISTRY_REF}`;
|
|
10
|
+
const REGISTRY_URL = `${REGISTRY_BASE}/registry.json`;
|
|
11
|
+
const REGISTRY_ITEM_URL = `${REGISTRY_BASE}/registry/items`;
|
|
12
|
+
const THEME_REGISTRY_URL = `${REGISTRY_BASE}/registry/themes.json`;
|
|
11
13
|
const DEFAULT_CONFIG = {
|
|
12
14
|
$schema: "https://ui.shadcn.com/schema/registry.json",
|
|
13
15
|
style: "digital",
|
|
@@ -57,8 +59,16 @@ function resolveTargetPath(target, config, cwd = process.cwd()) {
|
|
|
57
59
|
} else if (target.startsWith("styles/")) {
|
|
58
60
|
resolved = target.replace("styles/", config.aliases.styles + "/");
|
|
59
61
|
}
|
|
60
|
-
|
|
62
|
+
const resolvedPath = resolve(cwd, resolved);
|
|
63
|
+
const root = resolve(cwd);
|
|
64
|
+
if (resolvedPath !== root && !resolvedPath.startsWith(root + sep)) {
|
|
65
|
+
throw new Error(
|
|
66
|
+
`Refusing to write outside the project directory: ${target}`
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return resolvedPath;
|
|
61
70
|
}
|
|
71
|
+
const DEP_SPEC = /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*(@[^\s]+)?$/;
|
|
62
72
|
function detectPackageManager(cwd) {
|
|
63
73
|
if (existsSync(resolve(cwd, "bun.lockb"))) return "bun";
|
|
64
74
|
if (existsSync(resolve(cwd, "bun.lock"))) return "bun";
|
|
@@ -67,10 +77,23 @@ function detectPackageManager(cwd) {
|
|
|
67
77
|
return "npm";
|
|
68
78
|
}
|
|
69
79
|
function installNpmDeps(deps, cwd) {
|
|
80
|
+
const invalid = deps.filter((d) => !DEP_SPEC.test(d));
|
|
81
|
+
if (invalid.length > 0) {
|
|
82
|
+
throw new Error(
|
|
83
|
+
`Refusing to install invalid dependency specifiers: ${invalid.join(", ")}`
|
|
84
|
+
);
|
|
85
|
+
}
|
|
70
86
|
if (deps.length === 0) return;
|
|
71
87
|
const pm = detectPackageManager(cwd);
|
|
72
|
-
const
|
|
73
|
-
|
|
88
|
+
const subcommand = pm === "npm" ? "install" : "add";
|
|
89
|
+
const res = spawnSync(pm, [subcommand, ...deps], {
|
|
90
|
+
cwd,
|
|
91
|
+
stdio: "inherit"
|
|
92
|
+
});
|
|
93
|
+
if (res.error) throw res.error;
|
|
94
|
+
if (res.status !== 0) {
|
|
95
|
+
throw new Error(`${pm} ${subcommand} failed with exit code ${res.status}`);
|
|
96
|
+
}
|
|
74
97
|
}
|
|
75
98
|
const __dirname$1 = dirname(fileURLToPath(import.meta.url));
|
|
76
99
|
function findLocalRegistry() {
|
|
@@ -599,7 +622,7 @@ ${importLine}
|
|
|
599
622
|
const program = new Command();
|
|
600
623
|
program.name("ionbit-ui").description(
|
|
601
624
|
"Ionbit UI CLI — install source-owned components from the Ionbit UI registry."
|
|
602
|
-
).version("0.2.
|
|
625
|
+
).version("0.2.2");
|
|
603
626
|
program.command("init").description(
|
|
604
627
|
"Initialize Ionbit UI in your project. Creates a ionbit-ui.config.json and installs design tokens."
|
|
605
628
|
).option("-y, --yes", "Skip confirmation prompts and use defaults").option("-f, --force", "Force overwrite of existing configuration").option(
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/config.ts","../src/utils/fs.ts","../src/utils/npm.ts","../src/utils/registry.ts","../src/commands/add.ts","../src/commands/init.ts","../src/commands/list.ts","../../tokens/src/theme-css.ts","../src/commands/theme.ts","../src/index.ts"],"sourcesContent":["export const REGISTRY_URL =\n \"https://raw.githubusercontent.com/rostislaw9/ionbit-ui/main/registry.json\";\n\nexport const REGISTRY_ITEM_URL =\n \"https://raw.githubusercontent.com/rostislaw9/ionbit-ui/main/registry/items\";\nexport const THEME_REGISTRY_URL =\n \"https://raw.githubusercontent.com/rostislaw9/ionbit-ui/main/registry/themes.json\";\n\nexport interface RegistryItem {\n name: string;\n type: string;\n title: string;\n description: string;\n dependencies?: string[];\n devDependencies?: string[];\n registryDependencies?: string[];\n files: RegistryFile[];\n}\n\nexport interface RegistryFile {\n path: string;\n type: string;\n content: string;\n}\n\nexport interface Registry {\n $schema: string;\n name: string;\n homepage: string;\n items: RegistryItem[];\n}\n\nexport interface ThemeEntry {\n id: string;\n label: string;\n description: string;\n css: string;\n}\n\nexport interface ThemeRegistry {\n themes: ThemeEntry[];\n}\n\nexport interface Config {\n $schema: string;\n style: string;\n tailwind: {\n css: string;\n cssVariables: boolean;\n };\n aliases: {\n components: string;\n motion: string;\n lib: string;\n styles: string;\n };\n}\n\nexport const DEFAULT_CONFIG: Config = {\n $schema: \"https://ui.shadcn.com/schema/registry.json\",\n style: \"digital\",\n tailwind: {\n css: \"src/index.css\",\n cssVariables: true,\n },\n aliases: {\n components: \"src/components/ui\",\n motion: \"src/components/motion\",\n lib: \"src/lib\",\n styles: \"src/styles\",\n },\n};\n\nexport const CONFIG_FILE = \"ionbit-ui.config.json\";\n","import type { Config } from \"../config\";\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\n\nimport { CONFIG_FILE } from \"../config\";\n\nexport function loadConfig(cwd = process.cwd()): Config | null {\n const configPath = resolve(cwd, CONFIG_FILE);\n if (!existsSync(configPath)) return null;\n return JSON.parse(readFileSync(configPath, \"utf-8\")) as Config;\n}\n\nexport function saveConfig(config: Config, cwd = process.cwd()): void {\n const configPath = resolve(cwd, CONFIG_FILE);\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\");\n}\n\nexport function ensureDir(filePath: string): void {\n const dir = dirname(filePath);\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n}\n\nexport function writeFile(filePath: string, content: string): void {\n ensureDir(filePath);\n writeFileSync(filePath, content);\n}\n\nexport function resolveTargetPath(\n target: string,\n config: Config,\n cwd = process.cwd(),\n): string {\n // Map registry target paths to the user's configured aliases.\n // e.g. \"components/ui/button.tsx\" -> \"{cwd}/components/ui/button.tsx\"\n // \"components/motion/spotlight.tsx\" -> \"{cwd}/components/motion/spotlight.tsx\"\n // \"lib/utils.ts\" -> \"{cwd}/lib/utils.ts\"\n // \"styles/tokens.css\" -> \"{cwd}/styles/tokens.css\"\n let resolved = target;\n\n if (target.startsWith(\"components/ui/\")) {\n resolved = target.replace(\n \"components/ui/\",\n config.aliases.components + \"/\",\n );\n } else if (target.startsWith(\"components/motion/\")) {\n resolved = target.replace(\n \"components/motion/\",\n config.aliases.motion + \"/\",\n );\n } else if (target.startsWith(\"lib/\")) {\n resolved = target.replace(\"lib/\", config.aliases.lib + \"/\");\n } else if (target.startsWith(\"styles/\")) {\n resolved = target.replace(\"styles/\", config.aliases.styles + \"/\");\n }\n\n return resolve(cwd, resolved);\n}\n","import { execSync } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\nexport function detectPackageManager(cwd: string): PackageManager {\n if (existsSync(resolve(cwd, \"bun.lockb\"))) return \"bun\";\n if (existsSync(resolve(cwd, \"bun.lock\"))) return \"bun\";\n if (existsSync(resolve(cwd, \"pnpm-lock.yaml\"))) return \"pnpm\";\n if (existsSync(resolve(cwd, \"yarn.lock\"))) return \"yarn\";\n return \"npm\";\n}\n\nexport function installNpmDeps(deps: string[], cwd: string): void {\n if (deps.length === 0) return;\n const pm = detectPackageManager(cwd);\n const cmd =\n pm === \"pnpm\"\n ? `pnpm add ${deps.join(\" \")}`\n : pm === \"yarn\"\n ? `yarn add ${deps.join(\" \")}`\n : pm === \"bun\"\n ? `bun add ${deps.join(\" \")}`\n : `npm install ${deps.join(\" \")}`;\n execSync(cmd, { cwd, stdio: \"inherit\" });\n}\n","import type { Registry, RegistryItem, ThemeRegistry } from \"../config\";\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { REGISTRY_ITEM_URL, REGISTRY_URL, THEME_REGISTRY_URL } from \"../config\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n/**\n * Find the registry.json — checks local paths first, then falls back to the\n * remote GitHub URL. This allows development/testing without pushing to GitHub.\n */\nfunction findLocalRegistry(): string | null {\n const candidates = [\n // Relative to cwd (user's project)\n resolve(process.cwd(), \"registry.json\"),\n // Relative to CLI dist (packages/cli/dist -> ../../../registry.json)\n resolve(__dirname, \"../../../registry.json\"),\n // Relative to CLI src/utils (packages/cli/src/utils -> ../../../../registry.json)\n resolve(__dirname, \"../../../../registry.json\"),\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return null;\n}\n\nfunction findLocalRegistryItem(name: string): string | null {\n const candidates = [\n resolve(process.cwd(), \"registry/items\", `${name}.json`),\n resolve(__dirname, \"../../../registry/items\", `${name}.json`),\n resolve(__dirname, \"../../../../registry/items\", `${name}.json`),\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return null;\n}\n\nfunction findLocalThemes(): string | null {\n const candidates = [\n resolve(process.cwd(), \"registry/themes.json\"),\n resolve(__dirname, \"../../../registry/themes.json\"),\n resolve(__dirname, \"../../../../registry/themes.json\"),\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return null;\n}\n\nexport async function fetchRegistry(): Promise<Registry> {\n const localPath = findLocalRegistry();\n if (localPath) {\n return JSON.parse(readFileSync(localPath, \"utf-8\")) as Registry;\n }\n\n const res = await fetch(REGISTRY_URL);\n if (!res.ok) {\n throw new Error(\n `Failed to fetch registry: ${res.status} ${res.statusText}`,\n );\n }\n return (await res.json()) as Registry;\n}\n\nexport async function fetchRegistryItem(name: string): Promise<RegistryItem> {\n const localPath = findLocalRegistryItem(name);\n if (localPath) {\n return JSON.parse(readFileSync(localPath, \"utf-8\")) as RegistryItem;\n }\n\n const res = await fetch(`${REGISTRY_ITEM_URL}/${name}.json`);\n if (!res.ok) {\n throw new Error(\n `Failed to fetch registry item \"${name}\": ${res.status} ${res.statusText}`,\n );\n }\n return (await res.json()) as RegistryItem;\n}\n\nexport async function fetchRegistryItems(\n names: string[],\n): Promise<RegistryItem[]> {\n return Promise.all(names.map(fetchRegistryItem));\n}\n\nexport async function fetchThemeRegistry(): Promise<ThemeRegistry> {\n const localPath = findLocalThemes();\n if (localPath) {\n return JSON.parse(readFileSync(localPath, \"utf-8\")) as ThemeRegistry;\n }\n\n const res = await fetch(THEME_REGISTRY_URL);\n if (!res.ok) {\n throw new Error(\n `Failed to fetch theme registry: ${res.status} ${res.statusText}`,\n );\n }\n return (await res.json()) as ThemeRegistry;\n}\n","import type { Config, RegistryItem } from \"../config\";\n\nimport chalk from \"chalk\";\nimport { existsSync } from \"node:fs\";\n\nimport { loadConfig, resolveTargetPath, writeFile } from \"../utils/fs\";\nimport { installNpmDeps } from \"../utils/npm\";\nimport { fetchRegistry, fetchRegistryItems } from \"../utils/registry\";\n\nexport async function add(\n components: string[],\n options: { overwrite?: boolean },\n): Promise<void> {\n const cwd = process.cwd();\n const config = loadConfig(cwd);\n\n if (!config) {\n console.log(\n chalk.red(\"No ionbit-ui.config.json found. Run `ionbit-ui init` first.\"),\n );\n process.exit(1);\n }\n\n // Fetch the full registry to resolve names and dependencies\n const registry = await fetchRegistry();\n const allNames = new Set(registry.items.map((i) => i.name));\n\n // Validate requested components\n for (const name of components) {\n if (!allNames.has(name)) {\n console.log(\n chalk.red(\n `Component \"${name}\" not found in registry. Run \\`ionbit-ui list\\` to see available components.`,\n ),\n );\n process.exit(1);\n }\n }\n\n // Resolve transitive registry dependencies\n const toInstall = resolveDependencies(components, registry.items);\n\n console.log(chalk.dim(`Installing ${toInstall.length} item(s)...`));\n console.log(\"\");\n\n // Fetch all items with embedded content\n const items = await fetchRegistryItems(toInstall);\n\n for (const item of items) {\n await installItem(item, config, cwd, options.overwrite ?? false);\n }\n\n // Collect and install npm dependencies\n const npmDeps = new Set<string>();\n for (const item of items) {\n for (const dep of item.dependencies ?? []) {\n npmDeps.add(dep);\n }\n }\n\n if (npmDeps.size > 0) {\n console.log(\"\");\n installNpmDeps([...npmDeps], cwd);\n }\n\n console.log(\"\");\n console.log(chalk.green(`✓ Added ${items.length} component(s).`));\n}\n\nfunction resolveDependencies(\n names: string[],\n allItems: { name: string; registryDependencies?: string[] }[],\n): string[] {\n const resolved = new Set<string>();\n const queue = [...names];\n\n while (queue.length > 0) {\n const name = queue.shift()!;\n if (resolved.has(name)) continue;\n resolved.add(name);\n\n const item = allItems.find((i) => i.name === name);\n if (item?.registryDependencies) {\n for (const dep of item.registryDependencies) {\n if (!resolved.has(dep)) queue.push(dep);\n }\n }\n }\n\n return [...resolved];\n}\n\nasync function installItem(\n item: RegistryItem,\n config: Config,\n cwd: string,\n overwrite: boolean,\n): Promise<void> {\n for (const file of item.files) {\n const targetPath = resolveTargetPath(file.path, config, cwd);\n\n if (existsSync(targetPath) && !overwrite) {\n console.log(\n chalk.yellow(\n ` ⚠ ${file.path} already exists — skipping (use --overwrite)`,\n ),\n );\n continue;\n }\n\n writeFile(targetPath, file.content);\n console.log(chalk.green(` ✓ ${file.path}`));\n }\n}\n","import type { Config, RegistryItem } from \"../config\";\n\nimport chalk from \"chalk\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { relative, resolve } from \"node:path\";\n\nimport { CONFIG_FILE, DEFAULT_CONFIG } from \"../config\";\nimport { resolveTargetPath, saveConfig, writeFile } from \"../utils/fs\";\nimport { installNpmDeps } from \"../utils/npm\";\nimport { fetchRegistryItems } from \"../utils/registry\";\n\nconst CURSOR_CSS = `@layer base {\n button:not(:disabled),\n [role=\"button\"]:not(:disabled) {\n cursor: pointer;\n }\n}`;\n\n/** Items that every project needs — installed automatically during init. */\nconst BASE_ITEMS = [\"cn\", \"tokens\"];\n\nexport async function init(options: {\n yes?: boolean;\n force?: boolean;\n pointer?: boolean;\n}): Promise<void> {\n const cwd = process.cwd();\n const configPath = resolve(cwd, CONFIG_FILE);\n\n if (existsSync(configPath) && !options.force) {\n console.log(\n chalk.yellow(\n `${CONFIG_FILE} already exists. Use --force to reinitialize.`,\n ),\n );\n return;\n }\n\n const config: Config = { ...DEFAULT_CONFIG };\n\n saveConfig(config, cwd);\n console.log(chalk.green(`✓ Created ${CONFIG_FILE}`));\n\n // Create directory structure\n const dirs = [\n config.aliases.components,\n config.aliases.motion,\n config.aliases.lib,\n config.aliases.styles,\n ];\n\n for (const dir of dirs) {\n const dirPath = resolve(cwd, dir);\n if (!existsSync(dirPath)) {\n mkdirSync(dirPath, { recursive: true });\n console.log(chalk.dim(` Created ${dir}/`));\n }\n }\n\n // Install base items (cn utility + design tokens)\n console.log(chalk.dim(\"Installing base items (cn, tokens)...\"));\n const items = await fetchRegistryItems(BASE_ITEMS);\n for (const item of items) {\n installBaseItem(item, config, cwd);\n }\n\n // Add token CSS imports to the user's stylesheet\n setupCssImports(config, cwd);\n\n // Collect and install npm dependencies for base items\n const npmDeps = new Set<string>();\n for (const item of items) {\n for (const dep of item.dependencies ?? []) {\n npmDeps.add(dep);\n }\n }\n installNpmDeps([...npmDeps], cwd);\n\n // Optionally add cursor: pointer CSS\n if (options.pointer) {\n const cssPath = resolve(cwd, config.tailwind.css);\n if (existsSync(cssPath)) {\n const existing = readFileSync(cssPath, \"utf-8\");\n if (!existing.includes(\"cursor: pointer\")) {\n writeFileSync(cssPath, existing + \"\\n\" + CURSOR_CSS);\n console.log(\n chalk.green(`✓ Added cursor: pointer to ${config.tailwind.css}`),\n );\n } else {\n console.log(\n chalk.dim(\n ` ${config.tailwind.css} already has cursor: pointer — skipping`,\n ),\n );\n }\n } else {\n writeFileSync(cssPath, CURSOR_CSS);\n console.log(\n chalk.green(`✓ Created ${config.tailwind.css} with cursor: pointer`),\n );\n }\n }\n\n console.log(\"\");\n console.log(chalk.bold(\"Ionbit UI initialized!\"));\n console.log(\"\");\n console.log(chalk.dim(\"Next steps:\"));\n console.log(` ${chalk.cyan(\"ionbit-ui add button\")} — add a component`);\n console.log(\n ` ${chalk.cyan(\"ionbit-ui list\")} — browse available components`,\n );\n console.log(\"\");\n}\n\nfunction installBaseItem(\n item: RegistryItem,\n config: Config,\n cwd: string,\n): void {\n for (const file of item.files) {\n const targetPath = resolveTargetPath(file.path, config, cwd);\n if (existsSync(targetPath)) {\n console.log(chalk.dim(` ⚠ ${file.path} already exists — skipping`));\n continue;\n }\n writeFile(targetPath, file.content);\n console.log(chalk.green(` ✓ ${file.path}`));\n }\n}\n\nfunction setupCssImports(config: Config, cwd: string): void {\n const cssPath = resolve(cwd, config.tailwind.css);\n const stylesDir = config.aliases.styles;\n\n // Build the import lines relative to the CSS file's directory\n const tokensImport = `@import \"./${relativePath(cssPath, resolve(cwd, stylesDir, \"tokens.css\"))}\";`;\n const baseImport = `@import \"./${relativePath(cssPath, resolve(cwd, stylesDir, \"base.css\"))}\";`;\n const utilitiesImport = `@import \"./${relativePath(cssPath, resolve(cwd, stylesDir, \"utilities.css\"))}\";`;\n\n if (!existsSync(cssPath)) {\n // Create the CSS file with token imports\n const content = `@import \"tailwindcss\";\\n\\n${tokensImport}\\n${baseImport}\\n${utilitiesImport}\\n`;\n writeFileSync(cssPath, content);\n console.log(\n chalk.green(`✓ Created ${config.tailwind.css} with token imports`),\n );\n return;\n }\n\n const existing = readFileSync(cssPath, \"utf-8\");\n const lines: string[] = [];\n\n if (!existing.includes(\"tokens.css\")) {\n lines.push(tokensImport);\n }\n if (!existing.includes(\"base.css\")) {\n lines.push(baseImport);\n }\n if (!existing.includes(\"utilities.css\")) {\n lines.push(utilitiesImport);\n }\n\n if (lines.length > 0) {\n // Add imports after @import \"tailwindcss\" if present, otherwise at the top\n let updated: string;\n if (existing.includes('@import \"tailwindcss\"')) {\n updated = existing.replace(\n /(@import\\s+\"tailwindcss\"[^\\n]*)/,\n `$1\\n${lines.join(\"\\n\")}`,\n );\n } else {\n updated = lines.join(\"\\n\") + \"\\n\" + existing;\n }\n writeFileSync(cssPath, updated);\n console.log(chalk.green(`✓ Added token imports to ${config.tailwind.css}`));\n } else {\n console.log(\n chalk.dim(\n ` ${config.tailwind.css} already has token imports — skipping`,\n ),\n );\n }\n}\n\nfunction relativePath(from: string, to: string): string {\n let rel = relative(from, to).replace(/\\\\/g, \"/\");\n // Remove the leading \"../\" if the CSS file is in the same or parent directory\n if (rel.startsWith(\"../\")) rel = rel.slice(3);\n return rel;\n}\n","import chalk from \"chalk\";\n\nimport { fetchRegistry } from \"../utils/registry\";\n\nexport async function list(): Promise<void> {\n const registry = await fetchRegistry();\n\n const groups: Record<string, typeof registry.items> = {};\n\n for (const item of registry.items) {\n const category = item.type.replace(\"registry:\", \"\");\n if (!groups[category]) groups[category] = [];\n groups[category].push(item);\n }\n\n const categoryOrder = [\"lib\", \"base\", \"ui\"];\n const sortedCategories = Object.keys(groups).sort((a, b) => {\n const ai = categoryOrder.indexOf(a);\n const bi = categoryOrder.indexOf(b);\n if (ai !== -1 && bi !== -1) return ai - bi;\n if (ai !== -1) return -1;\n if (bi !== -1) return 1;\n return a.localeCompare(b);\n });\n\n for (const category of sortedCategories) {\n const items = groups[category];\n if (!items) continue;\n const label =\n category === \"lib\"\n ? \"Libraries\"\n : category === \"base\"\n ? \"Foundation\"\n : \"Components\";\n\n console.log(chalk.bold(`\\n${label}`));\n\n for (const item of items) {\n const deps = item.dependencies?.length\n ? chalk.dim(` (${item.dependencies.length} deps)`)\n : \"\";\n console.log(` ${chalk.cyan(item.name.padEnd(18))} ${item.title}${deps}`);\n }\n }\n\n console.log(\"\");\n console.log(chalk.dim(`Total: ${registry.items.length} items`));\n console.log(chalk.dim(`Install with: ionbit-ui add <name>`));\n console.log(\"\");\n}\n","import type {\n ShadowIntensity,\n ThemeColors,\n ThemePreset,\n ThemeRadius,\n ThemeSettings,\n} from \"./theme-types\";\n\nfunction mix(color: string, amount: number): string {\n return `color-mix(in oklab, ${color} ${amount}%, transparent)`;\n}\n\n/** Multiplier applied to the mode-specific shadow alphas per tier. */\nconst SHADOW_SCALE: Record<ShadowIntensity, number> = {\n subtle: 0.6,\n normal: 1,\n dramatic: 1.5,\n};\n\nfunction hover(color: string): string {\n return `color-mix(in oklab, ${color} 88%, black)`;\n}\n\nexport function colorsToCss(\n c: ThemeColors,\n s: ThemeSettings,\n isLight: boolean,\n): string {\n const { translucency } = s;\n const k = SHADOW_SCALE[s.shadowIntensity];\n const alpha = (base: number) => (base * k).toFixed(2);\n const borderBase = isLight ? \"0 0 0\" : \"1 0 0\";\n const borderAlpha = translucency.toFixed(2);\n const mutedAmount = Math.round(translucency * 160);\n const subtleAmount = Math.round(translucency * 80);\n\n return [\n ` --background: ${c.background};`,\n ` --surface: ${c.surface};`,\n ` --surface-elevated: ${c.surfaceElevated};`,\n ` --surface-hover: ${c.surfaceHover};`,\n ` --foreground: ${c.foreground};`,\n ` --foreground-muted: ${c.foregroundMuted};`,\n ` --foreground-subtle: ${c.foregroundSubtle};`,\n ` --accent: ${c.accent};`,\n ` --accent-hover: ${c.accentHover};`,\n ` --accent-foreground: ${c.accentForeground};`,\n ` --accent-muted: ${mix(c.accent, mutedAmount)};`,\n ` --accent-subtle: ${mix(c.accent, subtleAmount)};`,\n ` --success: ${c.success};`,\n ` --success-hover: ${hover(c.success)};`,\n ` --success-muted: ${mix(c.success, mutedAmount)};`,\n ` --success-subtle: ${mix(c.success, subtleAmount)};`,\n ` --success-foreground: ${isLight ? \"oklch(0.99 0 0)\" : \"oklch(0.1 0.03 155)\"};`,\n ` --warning: ${c.warning};`,\n ` --warning-hover: ${hover(c.warning)};`,\n ` --warning-muted: ${mix(c.warning, mutedAmount)};`,\n ` --warning-subtle: ${mix(c.warning, subtleAmount)};`,\n ` --warning-foreground: ${isLight ? \"oklch(0.99 0 0)\" : \"oklch(0.1 0.03 80)\"};`,\n ` --error: ${c.error};`,\n ` --error-hover: ${hover(c.error)};`,\n ` --error-muted: ${mix(c.error, mutedAmount)};`,\n ` --error-subtle: ${mix(c.error, subtleAmount)};`,\n ` --error-foreground: ${isLight ? \"oklch(0.99 0 0)\" : \"oklch(0.1 0.04 5)\"};`,\n ` --info: ${c.info};`,\n ` --info-hover: ${hover(c.info)};`,\n ` --info-muted: ${mix(c.info, mutedAmount)};`,\n ` --info-subtle: ${mix(c.info, subtleAmount)};`,\n ` --info-foreground: ${isLight ? \"oklch(0.99 0 0)\" : \"oklch(0.1 0.03 230)\"};`,\n ` --ring: ${c.ring};`,\n ` --border: oklch(${borderBase} / ${borderAlpha});`,\n ` --border-strong: oklch(${borderBase} / ${(translucency * 1.75).toFixed(2)});`,\n ` --border-accent: ${mix(c.accent, 50)};`,\n ` --border-error: ${mix(c.error, 50)};`,\n ` --border-success: ${mix(c.success, 50)};`,\n ` --border-warning: ${mix(c.warning, 50)};`,\n ` --border-info: ${mix(c.info, 50)};`,\n ` --shadow-xs: 0 1px 2px 0 oklch(0 0 0 / ${alpha(isLight ? 0.06 : 0.2)});`,\n ` --shadow-sm: 0 2px 4px -1px oklch(0 0 0 / ${alpha(isLight ? 0.08 : 0.25)}), 0 1px 2px -1px oklch(0 0 0 / ${alpha(isLight ? 0.06 : 0.2)});`,\n ` --shadow-md: 0 4px 8px -2px oklch(0 0 0 / ${alpha(isLight ? 0.1 : 0.3)}), 0 2px 4px -2px oklch(0 0 0 / ${alpha(isLight ? 0.08 : 0.25)});`,\n ` --shadow-lg: 0 12px 24px -8px oklch(0 0 0 / ${alpha(isLight ? 0.12 : 0.4)}), 0 4px 8px -4px oklch(0 0 0 / ${alpha(isLight ? 0.1 : 0.3)});`,\n ].join(\"\\n\");\n}\n\nexport function radiusToCss(r: ThemeRadius): string {\n return [\n ` --radius-sm: ${r.sm};`,\n ` --radius-md: ${r.md};`,\n ` --radius-lg: ${r.lg};`,\n ` --radius-xl: ${r.xl};`,\n ].join(\"\\n\");\n}\n\nexport function settingsToCss(s: ThemeSettings): string {\n return [\n ` --spotlight-intensity: ${s.spotlightIntensity};`,\n ` --magnetic-intensity: ${s.magneticIntensity};`,\n ` --glow-intensity: ${s.glowIntensity};`,\n ` --pulse-intensity: ${s.pulseIntensity};`,\n ` --ripple-intensity: ${s.rippleIntensity};`,\n ` --tilt-intensity: ${s.tiltIntensity};`,\n ` --reflection-intensity: ${s.reflectionIntensity};`,\n ` --scramble-intensity: ${s.scrambleIntensity};`,\n ` --trace-intensity: ${s.traceIntensity};`,\n ].join(\"\\n\");\n}\n\nexport function generateThemeCss(preset: ThemePreset): string {\n const darkBlock = `:root {\\n${colorsToCss(preset.dark, preset.settings, false)}\\n${radiusToCss(preset.radius)}\\n${settingsToCss(preset.settings)}\\n}`;\n const lightBlock = `.light {\\n${colorsToCss(preset.light, preset.settings, true)}\\n${radiusToCss(preset.radius)}\\n${settingsToCss(preset.settings)}\\n}`;\n\n return `/* Ionbit UI — Theme: ${preset.label} */\\n${darkBlock}\\n\\n${lightBlock}`;\n}\n","import type { Config, ThemeEntry } from \"../config\";\nimport type { ThemePreset } from \"@ionbit-ui/tokens/theme-types\";\n\nimport chalk from \"chalk\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, relative, resolve } from \"node:path\";\n\nimport { generateThemeCss } from \"@ionbit-ui/tokens/theme-css\";\n\nimport { ensureDir, loadConfig } from \"../utils/fs\";\nimport { fetchThemeRegistry } from \"../utils/registry\";\n\ninterface CustomTheme {\n dark: Record<string, string>;\n light: Record<string, string>;\n radius: Record<string, string>;\n settings: Record<string, string | number>;\n}\n\nexport async function theme(\n id: string | undefined,\n options: { custom?: string; overwrite?: boolean },\n): Promise<void> {\n const cwd = process.cwd();\n const config = loadConfig(cwd);\n\n if (!config) {\n console.log(\n chalk.red(\"No ionbit-ui.config.json found. Run `ionbit-ui init` first.\"),\n );\n process.exitCode = 1;\n return;\n }\n\n if (id && options.custom) {\n console.log(chalk.red(\"Choose a preset theme or --custom, not both.\"));\n process.exitCode = 1;\n return;\n }\n\n let css: string;\n let label: string;\n if (options.custom) {\n let custom: CustomTheme;\n try {\n custom = JSON.parse(options.custom) as CustomTheme;\n validateCustomTheme(custom);\n } catch (error) {\n const message = error instanceof Error ? error.message : \"invalid JSON\";\n console.log(chalk.red(`Invalid custom theme: ${message}`));\n process.exitCode = 1;\n return;\n }\n label = \"Custom\";\n css = generateThemeCss({\n ...custom,\n id: \"custom\",\n label,\n description: \"\",\n } as unknown as ThemePreset);\n } else {\n if (!id) {\n console.log(chalk.red(\"Provide a theme id or use --custom <json>.\"));\n process.exitCode = 1;\n return;\n }\n const registry = await fetchThemeRegistry();\n const preset = registry.themes.find((entry) => entry.id === id);\n if (!preset) {\n printThemeError(id, registry.themes);\n process.exitCode = 1;\n return;\n }\n label = preset.label;\n css = preset.css;\n }\n\n const themePath = resolve(cwd, config.aliases.styles, \"theme.css\");\n if (existsSync(themePath) && !options.overwrite) {\n console.log(\n chalk.yellow(\n `${config.aliases.styles}/theme.css already exists. Use --overwrite to replace it.`,\n ),\n );\n process.exitCode = 1;\n return;\n }\n\n ensureDir(themePath);\n writeFileSync(themePath, css + \"\\n\");\n addThemeImport(config, cwd, themePath);\n console.log(chalk.green(`✓ Installed ${label} theme`));\n console.log(chalk.dim(` ${config.aliases.styles}/theme.css`));\n}\n\nfunction printThemeError(id: string, themes: ThemeEntry[]): void {\n console.log(chalk.red(`Theme \"${id}\" not found. Available themes:`));\n console.log(themes.map((entry) => ` ${entry.id}`).join(\"\\n\"));\n}\n\nfunction validateCustomTheme(themeConfig: CustomTheme): void {\n for (const mode of [\"dark\", \"light\"] as const) {\n if (!themeConfig[mode] || typeof themeConfig[mode] !== \"object\") {\n throw new Error(`missing ${mode} colors`);\n }\n }\n if (!themeConfig.radius || !themeConfig.settings) {\n throw new Error(\"missing radius or settings\");\n }\n}\n\nfunction addThemeImport(config: Config, cwd: string, themePath: string): void {\n const cssPath = resolve(cwd, config.tailwind.css);\n const importPath = relative(dirname(cssPath), themePath).replace(/\\\\/g, \"/\");\n const importLine = `@import \"./${importPath}\";`;\n const existing = existsSync(cssPath) ? readFileSync(cssPath, \"utf-8\") : \"\";\n\n if (!existing.includes(importLine)) {\n writeFileSync(cssPath, `${existing.trimEnd()}\\n${importLine}\\n`);\n }\n}\n","import { Command } from \"commander\";\n\nimport { add } from \"./commands/add\";\nimport { init } from \"./commands/init\";\nimport { list } from \"./commands/list\";\nimport { theme } from \"./commands/theme\";\n\nconst program = new Command();\n\nprogram\n .name(\"ionbit-ui\")\n .description(\n \"Ionbit UI CLI — install source-owned components from the Ionbit UI registry.\",\n )\n .version(\"0.2.0\");\n\nprogram\n .command(\"init\")\n .description(\n \"Initialize Ionbit UI in your project. Creates a ionbit-ui.config.json and installs design tokens.\",\n )\n .option(\"-y, --yes\", \"Skip confirmation prompts and use defaults\")\n .option(\"-f, --force\", \"Force overwrite of existing configuration\")\n .option(\n \"--pointer\",\n \"Add cursor: pointer CSS for buttons (Tailwind v4 defaults to cursor: default)\",\n )\n .action(init);\n\nprogram\n .command(\"add <components...>\")\n .description(\n \"Add components to your project. e.g. ionbit-ui add button card accordion\",\n )\n .option(\"-o, --overwrite\", \"Overwrite existing files\")\n .action(add);\n\nprogram\n .command(\"list\")\n .description(\"List all available components in the registry.\")\n .action(list);\n\nprogram\n .command(\"theme [id]\")\n .description(\"Install a preset or custom theme.\")\n .option(\"--custom <json>\", \"Install a custom theme from JSON\")\n .option(\"-o, --overwrite\", \"Overwrite the existing theme.css\")\n .action(theme);\n\nprogram.parse();\n"],"names":["__dirname"],"mappings":";;;;;;;AAAO,MAAM,eACX;AAEK,MAAM,oBACX;AACK,MAAM,qBACX;AAoDK,MAAM,iBAAyB;AAAA,EACpC,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAU;AAAA,IACR,KAAK;AAAA,IACL,cAAc;AAAA,EAAA;AAAA,EAEhB,SAAS;AAAA,IACP,YAAY;AAAA,IACZ,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,QAAQ;AAAA,EAAA;AAEZ;AAEO,MAAM,cAAc;AClEpB,SAAS,WAAW,MAAM,QAAQ,OAAsB;AAC7D,QAAM,aAAa,QAAQ,KAAK,WAAW;AAC3C,MAAI,CAAC,WAAW,UAAU,EAAG,QAAO;AACpC,SAAO,KAAK,MAAM,aAAa,YAAY,OAAO,CAAC;AACrD;AAEO,SAAS,WAAW,QAAgB,MAAM,QAAQ,OAAa;AACpE,QAAM,aAAa,QAAQ,KAAK,WAAW;AAC3C,gBAAc,YAAY,KAAK,UAAU,QAAQ,MAAM,CAAC,IAAI,IAAI;AAClE;AAEO,SAAS,UAAU,UAAwB;AAChD,QAAM,MAAM,QAAQ,QAAQ;AAC5B,MAAI,CAAC,WAAW,GAAG,aAAa,KAAK,EAAE,WAAW,MAAM;AAC1D;AAEO,SAAS,UAAU,UAAkB,SAAuB;AACjE,YAAU,QAAQ;AAClB,gBAAc,UAAU,OAAO;AACjC;AAEO,SAAS,kBACd,QACA,QACA,MAAM,QAAQ,OACN;AAMR,MAAI,WAAW;AAEf,MAAI,OAAO,WAAW,gBAAgB,GAAG;AACvC,eAAW,OAAO;AAAA,MAChB;AAAA,MACA,OAAO,QAAQ,aAA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S,GAAG,SAAS,QAAA,CAAS;AAAA,EAAK,UAAU;AAAA,CAAI;AAAA,EACjE;AACF;ACjHA,MAAM,UAAU,IAAI,QAAA;AAEpB,QACG,KAAK,WAAW,EAChB;AAAA,EACC;AACF,EACC,QAAQ,OAAO;AAElB,QACG,QAAQ,MAAM,EACd;AAAA,EACC;AACF,EACC,OAAO,aAAa,4CAA4C,EAChE,OAAO,eAAe,2CAA2C,EACjE;AAAA,EACC;AAAA,EACA;AACF,EACC,OAAO,IAAI;AAEd,QACG,QAAQ,qBAAqB,EAC7B;AAAA,EACC;AACF,EACC,OAAO,mBAAmB,0BAA0B,EACpD,OAAO,GAAG;AAEb,QACG,QAAQ,MAAM,EACd,YAAY,gDAAgD,EAC5D,OAAO,IAAI;AAEd,QACG,QAAQ,YAAY,EACpB,YAAY,mCAAmC,EAC/C,OAAO,mBAAmB,kCAAkC,EAC5D,OAAO,mBAAmB,kCAAkC,EAC5D,OAAO,KAAK;AAEf,QAAQ,MAAA;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/config.ts","../src/utils/fs.ts","../src/utils/npm.ts","../src/utils/registry.ts","../src/commands/add.ts","../src/commands/init.ts","../src/commands/list.ts","../../tokens/src/theme-css.ts","../src/commands/theme.ts","../src/index.ts"],"sourcesContent":["// Pin the remote registry to this CLI's own release tag: a published\n// package reads exactly the registry it shipped with instead of whatever\n// `main` serves at fetch time. Prereleases track `main`.\nconst REGISTRY_REF = __CLI_VERSION__.includes(\"-\")\n ? \"main\"\n : `v${__CLI_VERSION__}`;\n\nconst REGISTRY_BASE = `https://raw.githubusercontent.com/rostislaw9/ionbit-ui/${REGISTRY_REF}`;\n\nexport const REGISTRY_URL = `${REGISTRY_BASE}/registry.json`;\nexport const REGISTRY_ITEM_URL = `${REGISTRY_BASE}/registry/items`;\nexport const THEME_REGISTRY_URL = `${REGISTRY_BASE}/registry/themes.json`;\n\nexport interface RegistryItem {\n name: string;\n type: string;\n title: string;\n description: string;\n dependencies?: string[];\n devDependencies?: string[];\n registryDependencies?: string[];\n files: RegistryFile[];\n}\n\nexport interface RegistryFile {\n path: string;\n type: string;\n content: string;\n}\n\nexport interface Registry {\n $schema: string;\n name: string;\n homepage: string;\n items: RegistryItem[];\n}\n\nexport interface ThemeEntry {\n id: string;\n label: string;\n description: string;\n css: string;\n}\n\nexport interface ThemeRegistry {\n themes: ThemeEntry[];\n}\n\nexport interface Config {\n $schema: string;\n style: string;\n tailwind: {\n css: string;\n cssVariables: boolean;\n };\n aliases: {\n components: string;\n motion: string;\n lib: string;\n styles: string;\n };\n}\n\nexport const DEFAULT_CONFIG: Config = {\n $schema: \"https://ui.shadcn.com/schema/registry.json\",\n style: \"digital\",\n tailwind: {\n css: \"src/index.css\",\n cssVariables: true,\n },\n aliases: {\n components: \"src/components/ui\",\n motion: \"src/components/motion\",\n lib: \"src/lib\",\n styles: \"src/styles\",\n },\n};\n\nexport const CONFIG_FILE = \"ionbit-ui.config.json\";\n","import type { Config } from \"../config\";\n\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, resolve, sep } from \"node:path\";\n\nimport { CONFIG_FILE } from \"../config\";\n\nexport function loadConfig(cwd = process.cwd()): Config | null {\n const configPath = resolve(cwd, CONFIG_FILE);\n if (!existsSync(configPath)) return null;\n return JSON.parse(readFileSync(configPath, \"utf-8\")) as Config;\n}\n\nexport function saveConfig(config: Config, cwd = process.cwd()): void {\n const configPath = resolve(cwd, CONFIG_FILE);\n writeFileSync(configPath, JSON.stringify(config, null, 2) + \"\\n\");\n}\n\nexport function ensureDir(filePath: string): void {\n const dir = dirname(filePath);\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n}\n\nexport function writeFile(filePath: string, content: string): void {\n ensureDir(filePath);\n writeFileSync(filePath, content);\n}\n\nexport function resolveTargetPath(\n target: string,\n config: Config,\n cwd = process.cwd(),\n): string {\n // Map registry target paths to the user's configured aliases.\n // e.g. \"components/ui/button.tsx\" -> \"{cwd}/components/ui/button.tsx\"\n // \"components/motion/spotlight.tsx\" -> \"{cwd}/components/motion/spotlight.tsx\"\n // \"lib/utils.ts\" -> \"{cwd}/lib/utils.ts\"\n // \"styles/tokens.css\" -> \"{cwd}/styles/tokens.css\"\n let resolved = target;\n\n if (target.startsWith(\"components/ui/\")) {\n resolved = target.replace(\n \"components/ui/\",\n config.aliases.components + \"/\",\n );\n } else if (target.startsWith(\"components/motion/\")) {\n resolved = target.replace(\n \"components/motion/\",\n config.aliases.motion + \"/\",\n );\n } else if (target.startsWith(\"lib/\")) {\n resolved = target.replace(\"lib/\", config.aliases.lib + \"/\");\n } else if (target.startsWith(\"styles/\")) {\n resolved = target.replace(\"styles/\", config.aliases.styles + \"/\");\n }\n\n const resolvedPath = resolve(cwd, resolved);\n const root = resolve(cwd);\n // Registry-controlled target paths must stay inside the project.\n if (resolvedPath !== root && !resolvedPath.startsWith(root + sep)) {\n throw new Error(\n `Refusing to write outside the project directory: ${target}`,\n );\n }\n return resolvedPath;\n}\n","import { spawnSync } from \"node:child_process\";\nimport { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\n\nexport type PackageManager = \"npm\" | \"pnpm\" | \"yarn\" | \"bun\";\n\n// npm package specifiers: an optional @scope/, a name, and an optional\n// @version/tag/range. Rejects flag-looking values so registry-supplied\n// strings can't inject arguments into the package-manager call.\nconst DEP_SPEC =\n /^(@[a-z0-9-~][a-z0-9-._~]*\\/)?[a-z0-9-~][a-z0-9-._~]*(@[^\\s]+)?$/;\n\nexport function detectPackageManager(cwd: string): PackageManager {\n if (existsSync(resolve(cwd, \"bun.lockb\"))) return \"bun\";\n if (existsSync(resolve(cwd, \"bun.lock\"))) return \"bun\";\n if (existsSync(resolve(cwd, \"pnpm-lock.yaml\"))) return \"pnpm\";\n if (existsSync(resolve(cwd, \"yarn.lock\"))) return \"yarn\";\n return \"npm\";\n}\n\nexport function installNpmDeps(deps: string[], cwd: string): void {\n const invalid = deps.filter((d) => !DEP_SPEC.test(d));\n if (invalid.length > 0) {\n throw new Error(\n `Refusing to install invalid dependency specifiers: ${invalid.join(\", \")}`,\n );\n }\n if (deps.length === 0) return;\n\n const pm = detectPackageManager(cwd);\n const subcommand = pm === \"npm\" ? \"install\" : \"add\";\n // argv array, no shell — dep strings are never re-parsed as a command.\n const res = spawnSync(pm, [subcommand, ...deps], {\n cwd,\n stdio: \"inherit\",\n });\n if (res.error) throw res.error;\n if (res.status !== 0) {\n throw new Error(`${pm} ${subcommand} failed with exit code ${res.status}`);\n }\n}\n","import type { Registry, RegistryItem, ThemeRegistry } from \"../config\";\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { dirname, resolve } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nimport { REGISTRY_ITEM_URL, REGISTRY_URL, THEME_REGISTRY_URL } from \"../config\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n/**\n * Find the registry.json — checks local paths first, then falls back to the\n * remote GitHub URL. This allows development/testing without pushing to GitHub.\n */\nfunction findLocalRegistry(): string | null {\n const candidates = [\n // Relative to cwd (user's project)\n resolve(process.cwd(), \"registry.json\"),\n // Relative to CLI dist (packages/cli/dist -> ../../../registry.json)\n resolve(__dirname, \"../../../registry.json\"),\n // Relative to CLI src/utils (packages/cli/src/utils -> ../../../../registry.json)\n resolve(__dirname, \"../../../../registry.json\"),\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return null;\n}\n\nfunction findLocalRegistryItem(name: string): string | null {\n const candidates = [\n resolve(process.cwd(), \"registry/items\", `${name}.json`),\n resolve(__dirname, \"../../../registry/items\", `${name}.json`),\n resolve(__dirname, \"../../../../registry/items\", `${name}.json`),\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return null;\n}\n\nfunction findLocalThemes(): string | null {\n const candidates = [\n resolve(process.cwd(), \"registry/themes.json\"),\n resolve(__dirname, \"../../../registry/themes.json\"),\n resolve(__dirname, \"../../../../registry/themes.json\"),\n ];\n for (const p of candidates) {\n if (existsSync(p)) return p;\n }\n return null;\n}\n\nexport async function fetchRegistry(): Promise<Registry> {\n const localPath = findLocalRegistry();\n if (localPath) {\n return JSON.parse(readFileSync(localPath, \"utf-8\")) as Registry;\n }\n\n const res = await fetch(REGISTRY_URL);\n if (!res.ok) {\n throw new Error(\n `Failed to fetch registry: ${res.status} ${res.statusText}`,\n );\n }\n return (await res.json()) as Registry;\n}\n\nexport async function fetchRegistryItem(name: string): Promise<RegistryItem> {\n const localPath = findLocalRegistryItem(name);\n if (localPath) {\n return JSON.parse(readFileSync(localPath, \"utf-8\")) as RegistryItem;\n }\n\n const res = await fetch(`${REGISTRY_ITEM_URL}/${name}.json`);\n if (!res.ok) {\n throw new Error(\n `Failed to fetch registry item \"${name}\": ${res.status} ${res.statusText}`,\n );\n }\n return (await res.json()) as RegistryItem;\n}\n\nexport async function fetchRegistryItems(\n names: string[],\n): Promise<RegistryItem[]> {\n return Promise.all(names.map(fetchRegistryItem));\n}\n\nexport async function fetchThemeRegistry(): Promise<ThemeRegistry> {\n const localPath = findLocalThemes();\n if (localPath) {\n return JSON.parse(readFileSync(localPath, \"utf-8\")) as ThemeRegistry;\n }\n\n const res = await fetch(THEME_REGISTRY_URL);\n if (!res.ok) {\n throw new Error(\n `Failed to fetch theme registry: ${res.status} ${res.statusText}`,\n );\n }\n return (await res.json()) as ThemeRegistry;\n}\n","import type { Config, RegistryItem } from \"../config\";\n\nimport chalk from \"chalk\";\nimport { existsSync } from \"node:fs\";\n\nimport { loadConfig, resolveTargetPath, writeFile } from \"../utils/fs\";\nimport { installNpmDeps } from \"../utils/npm\";\nimport { fetchRegistry, fetchRegistryItems } from \"../utils/registry\";\n\nexport async function add(\n components: string[],\n options: { overwrite?: boolean },\n): Promise<void> {\n const cwd = process.cwd();\n const config = loadConfig(cwd);\n\n if (!config) {\n console.log(\n chalk.red(\"No ionbit-ui.config.json found. Run `ionbit-ui init` first.\"),\n );\n process.exit(1);\n }\n\n // Fetch the full registry to resolve names and dependencies\n const registry = await fetchRegistry();\n const allNames = new Set(registry.items.map((i) => i.name));\n\n // Validate requested components\n for (const name of components) {\n if (!allNames.has(name)) {\n console.log(\n chalk.red(\n `Component \"${name}\" not found in registry. Run \\`ionbit-ui list\\` to see available components.`,\n ),\n );\n process.exit(1);\n }\n }\n\n // Resolve transitive registry dependencies\n const toInstall = resolveDependencies(components, registry.items);\n\n console.log(chalk.dim(`Installing ${toInstall.length} item(s)...`));\n console.log(\"\");\n\n // Fetch all items with embedded content\n const items = await fetchRegistryItems(toInstall);\n\n for (const item of items) {\n await installItem(item, config, cwd, options.overwrite ?? false);\n }\n\n // Collect and install npm dependencies\n const npmDeps = new Set<string>();\n for (const item of items) {\n for (const dep of item.dependencies ?? []) {\n npmDeps.add(dep);\n }\n }\n\n if (npmDeps.size > 0) {\n console.log(\"\");\n installNpmDeps([...npmDeps], cwd);\n }\n\n console.log(\"\");\n console.log(chalk.green(`✓ Added ${items.length} component(s).`));\n}\n\nfunction resolveDependencies(\n names: string[],\n allItems: { name: string; registryDependencies?: string[] }[],\n): string[] {\n const resolved = new Set<string>();\n const queue = [...names];\n\n while (queue.length > 0) {\n const name = queue.shift()!;\n if (resolved.has(name)) continue;\n resolved.add(name);\n\n const item = allItems.find((i) => i.name === name);\n if (item?.registryDependencies) {\n for (const dep of item.registryDependencies) {\n if (!resolved.has(dep)) queue.push(dep);\n }\n }\n }\n\n return [...resolved];\n}\n\nasync function installItem(\n item: RegistryItem,\n config: Config,\n cwd: string,\n overwrite: boolean,\n): Promise<void> {\n for (const file of item.files) {\n const targetPath = resolveTargetPath(file.path, config, cwd);\n\n if (existsSync(targetPath) && !overwrite) {\n console.log(\n chalk.yellow(\n ` ⚠ ${file.path} already exists — skipping (use --overwrite)`,\n ),\n );\n continue;\n }\n\n writeFile(targetPath, file.content);\n console.log(chalk.green(` ✓ ${file.path}`));\n }\n}\n","import type { Config, RegistryItem } from \"../config\";\n\nimport chalk from \"chalk\";\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { relative, resolve } from \"node:path\";\n\nimport { CONFIG_FILE, DEFAULT_CONFIG } from \"../config\";\nimport { resolveTargetPath, saveConfig, writeFile } from \"../utils/fs\";\nimport { installNpmDeps } from \"../utils/npm\";\nimport { fetchRegistryItems } from \"../utils/registry\";\n\nconst CURSOR_CSS = `@layer base {\n button:not(:disabled),\n [role=\"button\"]:not(:disabled) {\n cursor: pointer;\n }\n}`;\n\n/** Items that every project needs — installed automatically during init. */\nconst BASE_ITEMS = [\"cn\", \"tokens\"];\n\nexport async function init(options: {\n yes?: boolean;\n force?: boolean;\n pointer?: boolean;\n}): Promise<void> {\n const cwd = process.cwd();\n const configPath = resolve(cwd, CONFIG_FILE);\n\n if (existsSync(configPath) && !options.force) {\n console.log(\n chalk.yellow(\n `${CONFIG_FILE} already exists. Use --force to reinitialize.`,\n ),\n );\n return;\n }\n\n const config: Config = { ...DEFAULT_CONFIG };\n\n saveConfig(config, cwd);\n console.log(chalk.green(`✓ Created ${CONFIG_FILE}`));\n\n // Create directory structure\n const dirs = [\n config.aliases.components,\n config.aliases.motion,\n config.aliases.lib,\n config.aliases.styles,\n ];\n\n for (const dir of dirs) {\n const dirPath = resolve(cwd, dir);\n if (!existsSync(dirPath)) {\n mkdirSync(dirPath, { recursive: true });\n console.log(chalk.dim(` Created ${dir}/`));\n }\n }\n\n // Install base items (cn utility + design tokens)\n console.log(chalk.dim(\"Installing base items (cn, tokens)...\"));\n const items = await fetchRegistryItems(BASE_ITEMS);\n for (const item of items) {\n installBaseItem(item, config, cwd);\n }\n\n // Add token CSS imports to the user's stylesheet\n setupCssImports(config, cwd);\n\n // Collect and install npm dependencies for base items\n const npmDeps = new Set<string>();\n for (const item of items) {\n for (const dep of item.dependencies ?? []) {\n npmDeps.add(dep);\n }\n }\n installNpmDeps([...npmDeps], cwd);\n\n // Optionally add cursor: pointer CSS\n if (options.pointer) {\n const cssPath = resolve(cwd, config.tailwind.css);\n if (existsSync(cssPath)) {\n const existing = readFileSync(cssPath, \"utf-8\");\n if (!existing.includes(\"cursor: pointer\")) {\n writeFileSync(cssPath, existing + \"\\n\" + CURSOR_CSS);\n console.log(\n chalk.green(`✓ Added cursor: pointer to ${config.tailwind.css}`),\n );\n } else {\n console.log(\n chalk.dim(\n ` ${config.tailwind.css} already has cursor: pointer — skipping`,\n ),\n );\n }\n } else {\n writeFileSync(cssPath, CURSOR_CSS);\n console.log(\n chalk.green(`✓ Created ${config.tailwind.css} with cursor: pointer`),\n );\n }\n }\n\n console.log(\"\");\n console.log(chalk.bold(\"Ionbit UI initialized!\"));\n console.log(\"\");\n console.log(chalk.dim(\"Next steps:\"));\n console.log(` ${chalk.cyan(\"ionbit-ui add button\")} — add a component`);\n console.log(\n ` ${chalk.cyan(\"ionbit-ui list\")} — browse available components`,\n );\n console.log(\"\");\n}\n\nfunction installBaseItem(\n item: RegistryItem,\n config: Config,\n cwd: string,\n): void {\n for (const file of item.files) {\n const targetPath = resolveTargetPath(file.path, config, cwd);\n if (existsSync(targetPath)) {\n console.log(chalk.dim(` ⚠ ${file.path} already exists — skipping`));\n continue;\n }\n writeFile(targetPath, file.content);\n console.log(chalk.green(` ✓ ${file.path}`));\n }\n}\n\nfunction setupCssImports(config: Config, cwd: string): void {\n const cssPath = resolve(cwd, config.tailwind.css);\n const stylesDir = config.aliases.styles;\n\n // Build the import lines relative to the CSS file's directory\n const tokensImport = `@import \"./${relativePath(cssPath, resolve(cwd, stylesDir, \"tokens.css\"))}\";`;\n const baseImport = `@import \"./${relativePath(cssPath, resolve(cwd, stylesDir, \"base.css\"))}\";`;\n const utilitiesImport = `@import \"./${relativePath(cssPath, resolve(cwd, stylesDir, \"utilities.css\"))}\";`;\n\n if (!existsSync(cssPath)) {\n // Create the CSS file with token imports\n const content = `@import \"tailwindcss\";\\n\\n${tokensImport}\\n${baseImport}\\n${utilitiesImport}\\n`;\n writeFileSync(cssPath, content);\n console.log(\n chalk.green(`✓ Created ${config.tailwind.css} with token imports`),\n );\n return;\n }\n\n const existing = readFileSync(cssPath, \"utf-8\");\n const lines: string[] = [];\n\n if (!existing.includes(\"tokens.css\")) {\n lines.push(tokensImport);\n }\n if (!existing.includes(\"base.css\")) {\n lines.push(baseImport);\n }\n if (!existing.includes(\"utilities.css\")) {\n lines.push(utilitiesImport);\n }\n\n if (lines.length > 0) {\n // Add imports after @import \"tailwindcss\" if present, otherwise at the top\n let updated: string;\n if (existing.includes('@import \"tailwindcss\"')) {\n updated = existing.replace(\n /(@import\\s+\"tailwindcss\"[^\\n]*)/,\n `$1\\n${lines.join(\"\\n\")}`,\n );\n } else {\n updated = lines.join(\"\\n\") + \"\\n\" + existing;\n }\n writeFileSync(cssPath, updated);\n console.log(chalk.green(`✓ Added token imports to ${config.tailwind.css}`));\n } else {\n console.log(\n chalk.dim(\n ` ${config.tailwind.css} already has token imports — skipping`,\n ),\n );\n }\n}\n\nfunction relativePath(from: string, to: string): string {\n let rel = relative(from, to).replace(/\\\\/g, \"/\");\n // Remove the leading \"../\" if the CSS file is in the same or parent directory\n if (rel.startsWith(\"../\")) rel = rel.slice(3);\n return rel;\n}\n","import chalk from \"chalk\";\n\nimport { fetchRegistry } from \"../utils/registry\";\n\nexport async function list(): Promise<void> {\n const registry = await fetchRegistry();\n\n const groups: Record<string, typeof registry.items> = {};\n\n for (const item of registry.items) {\n const category = item.type.replace(\"registry:\", \"\");\n if (!groups[category]) groups[category] = [];\n groups[category].push(item);\n }\n\n const categoryOrder = [\"lib\", \"base\", \"ui\"];\n const sortedCategories = Object.keys(groups).sort((a, b) => {\n const ai = categoryOrder.indexOf(a);\n const bi = categoryOrder.indexOf(b);\n if (ai !== -1 && bi !== -1) return ai - bi;\n if (ai !== -1) return -1;\n if (bi !== -1) return 1;\n return a.localeCompare(b);\n });\n\n for (const category of sortedCategories) {\n const items = groups[category];\n if (!items) continue;\n const label =\n category === \"lib\"\n ? \"Libraries\"\n : category === \"base\"\n ? \"Foundation\"\n : \"Components\";\n\n console.log(chalk.bold(`\\n${label}`));\n\n for (const item of items) {\n const deps = item.dependencies?.length\n ? chalk.dim(` (${item.dependencies.length} deps)`)\n : \"\";\n console.log(` ${chalk.cyan(item.name.padEnd(18))} ${item.title}${deps}`);\n }\n }\n\n console.log(\"\");\n console.log(chalk.dim(`Total: ${registry.items.length} items`));\n console.log(chalk.dim(`Install with: ionbit-ui add <name>`));\n console.log(\"\");\n}\n","import type {\n ShadowIntensity,\n ThemeColors,\n ThemePreset,\n ThemeRadius,\n ThemeSettings,\n} from \"./theme-types\";\n\nfunction mix(color: string, amount: number): string {\n return `color-mix(in oklab, ${color} ${amount}%, transparent)`;\n}\n\n/** Multiplier applied to the mode-specific shadow alphas per tier. */\nconst SHADOW_SCALE: Record<ShadowIntensity, number> = {\n subtle: 0.6,\n normal: 1,\n dramatic: 1.5,\n};\n\nfunction hover(color: string): string {\n return `color-mix(in oklab, ${color} 88%, black)`;\n}\n\nexport function colorsToCss(\n c: ThemeColors,\n s: ThemeSettings,\n isLight: boolean,\n): string {\n const { translucency } = s;\n const k = SHADOW_SCALE[s.shadowIntensity];\n const alpha = (base: number) => (base * k).toFixed(2);\n const borderBase = isLight ? \"0 0 0\" : \"1 0 0\";\n const borderAlpha = translucency.toFixed(2);\n const mutedAmount = Math.round(translucency * 160);\n const subtleAmount = Math.round(translucency * 80);\n\n return [\n ` --background: ${c.background};`,\n ` --surface: ${c.surface};`,\n ` --surface-elevated: ${c.surfaceElevated};`,\n ` --surface-hover: ${c.surfaceHover};`,\n ` --foreground: ${c.foreground};`,\n ` --foreground-muted: ${c.foregroundMuted};`,\n ` --foreground-subtle: ${c.foregroundSubtle};`,\n ` --accent: ${c.accent};`,\n ` --accent-hover: ${c.accentHover};`,\n ` --accent-foreground: ${c.accentForeground};`,\n ` --accent-muted: ${mix(c.accent, mutedAmount)};`,\n ` --accent-subtle: ${mix(c.accent, subtleAmount)};`,\n ` --success: ${c.success};`,\n ` --success-hover: ${hover(c.success)};`,\n ` --success-muted: ${mix(c.success, mutedAmount)};`,\n ` --success-subtle: ${mix(c.success, subtleAmount)};`,\n ` --success-foreground: ${isLight ? \"oklch(0.99 0 0)\" : \"oklch(0.1 0.03 155)\"};`,\n ` --warning: ${c.warning};`,\n ` --warning-hover: ${hover(c.warning)};`,\n ` --warning-muted: ${mix(c.warning, mutedAmount)};`,\n ` --warning-subtle: ${mix(c.warning, subtleAmount)};`,\n ` --warning-foreground: ${isLight ? \"oklch(0.99 0 0)\" : \"oklch(0.1 0.03 80)\"};`,\n ` --error: ${c.error};`,\n ` --error-hover: ${hover(c.error)};`,\n ` --error-muted: ${mix(c.error, mutedAmount)};`,\n ` --error-subtle: ${mix(c.error, subtleAmount)};`,\n ` --error-foreground: ${isLight ? \"oklch(0.99 0 0)\" : \"oklch(0.1 0.04 5)\"};`,\n ` --info: ${c.info};`,\n ` --info-hover: ${hover(c.info)};`,\n ` --info-muted: ${mix(c.info, mutedAmount)};`,\n ` --info-subtle: ${mix(c.info, subtleAmount)};`,\n ` --info-foreground: ${isLight ? \"oklch(0.99 0 0)\" : \"oklch(0.1 0.03 230)\"};`,\n ` --ring: ${c.ring};`,\n ` --border: oklch(${borderBase} / ${borderAlpha});`,\n ` --border-strong: oklch(${borderBase} / ${(translucency * 1.75).toFixed(2)});`,\n ` --border-accent: ${mix(c.accent, 50)};`,\n ` --border-error: ${mix(c.error, 50)};`,\n ` --border-success: ${mix(c.success, 50)};`,\n ` --border-warning: ${mix(c.warning, 50)};`,\n ` --border-info: ${mix(c.info, 50)};`,\n ` --shadow-xs: 0 1px 2px 0 oklch(0 0 0 / ${alpha(isLight ? 0.06 : 0.2)});`,\n ` --shadow-sm: 0 2px 4px -1px oklch(0 0 0 / ${alpha(isLight ? 0.08 : 0.25)}), 0 1px 2px -1px oklch(0 0 0 / ${alpha(isLight ? 0.06 : 0.2)});`,\n ` --shadow-md: 0 4px 8px -2px oklch(0 0 0 / ${alpha(isLight ? 0.1 : 0.3)}), 0 2px 4px -2px oklch(0 0 0 / ${alpha(isLight ? 0.08 : 0.25)});`,\n ` --shadow-lg: 0 12px 24px -8px oklch(0 0 0 / ${alpha(isLight ? 0.12 : 0.4)}), 0 4px 8px -4px oklch(0 0 0 / ${alpha(isLight ? 0.1 : 0.3)});`,\n ].join(\"\\n\");\n}\n\nexport function radiusToCss(r: ThemeRadius): string {\n return [\n ` --radius-sm: ${r.sm};`,\n ` --radius-md: ${r.md};`,\n ` --radius-lg: ${r.lg};`,\n ` --radius-xl: ${r.xl};`,\n ].join(\"\\n\");\n}\n\nexport function settingsToCss(s: ThemeSettings): string {\n return [\n ` --spotlight-intensity: ${s.spotlightIntensity};`,\n ` --magnetic-intensity: ${s.magneticIntensity};`,\n ` --glow-intensity: ${s.glowIntensity};`,\n ` --pulse-intensity: ${s.pulseIntensity};`,\n ` --ripple-intensity: ${s.rippleIntensity};`,\n ` --tilt-intensity: ${s.tiltIntensity};`,\n ` --reflection-intensity: ${s.reflectionIntensity};`,\n ` --scramble-intensity: ${s.scrambleIntensity};`,\n ` --trace-intensity: ${s.traceIntensity};`,\n ].join(\"\\n\");\n}\n\nexport function generateThemeCss(preset: ThemePreset): string {\n const darkBlock = `:root {\\n${colorsToCss(preset.dark, preset.settings, false)}\\n${radiusToCss(preset.radius)}\\n${settingsToCss(preset.settings)}\\n}`;\n const lightBlock = `.light {\\n${colorsToCss(preset.light, preset.settings, true)}\\n${radiusToCss(preset.radius)}\\n${settingsToCss(preset.settings)}\\n}`;\n\n return `/* Ionbit UI — Theme: ${preset.label} */\\n${darkBlock}\\n\\n${lightBlock}`;\n}\n","import type { Config, ThemeEntry } from \"../config\";\nimport type { ThemePreset } from \"@ionbit-ui/tokens/theme-types\";\n\nimport chalk from \"chalk\";\nimport { existsSync, readFileSync, writeFileSync } from \"node:fs\";\nimport { dirname, relative, resolve } from \"node:path\";\n\nimport { generateThemeCss } from \"@ionbit-ui/tokens/theme-css\";\n\nimport { ensureDir, loadConfig } from \"../utils/fs\";\nimport { fetchThemeRegistry } from \"../utils/registry\";\n\ninterface CustomTheme {\n dark: Record<string, string>;\n light: Record<string, string>;\n radius: Record<string, string>;\n settings: Record<string, string | number>;\n}\n\nexport async function theme(\n id: string | undefined,\n options: { custom?: string; overwrite?: boolean },\n): Promise<void> {\n const cwd = process.cwd();\n const config = loadConfig(cwd);\n\n if (!config) {\n console.log(\n chalk.red(\"No ionbit-ui.config.json found. Run `ionbit-ui init` first.\"),\n );\n process.exitCode = 1;\n return;\n }\n\n if (id && options.custom) {\n console.log(chalk.red(\"Choose a preset theme or --custom, not both.\"));\n process.exitCode = 1;\n return;\n }\n\n let css: string;\n let label: string;\n if (options.custom) {\n let custom: CustomTheme;\n try {\n custom = JSON.parse(options.custom) as CustomTheme;\n validateCustomTheme(custom);\n } catch (error) {\n const message = error instanceof Error ? error.message : \"invalid JSON\";\n console.log(chalk.red(`Invalid custom theme: ${message}`));\n process.exitCode = 1;\n return;\n }\n label = \"Custom\";\n css = generateThemeCss({\n ...custom,\n id: \"custom\",\n label,\n description: \"\",\n } as unknown as ThemePreset);\n } else {\n if (!id) {\n console.log(chalk.red(\"Provide a theme id or use --custom <json>.\"));\n process.exitCode = 1;\n return;\n }\n const registry = await fetchThemeRegistry();\n const preset = registry.themes.find((entry) => entry.id === id);\n if (!preset) {\n printThemeError(id, registry.themes);\n process.exitCode = 1;\n return;\n }\n label = preset.label;\n css = preset.css;\n }\n\n const themePath = resolve(cwd, config.aliases.styles, \"theme.css\");\n if (existsSync(themePath) && !options.overwrite) {\n console.log(\n chalk.yellow(\n `${config.aliases.styles}/theme.css already exists. Use --overwrite to replace it.`,\n ),\n );\n process.exitCode = 1;\n return;\n }\n\n ensureDir(themePath);\n writeFileSync(themePath, css + \"\\n\");\n addThemeImport(config, cwd, themePath);\n console.log(chalk.green(`✓ Installed ${label} theme`));\n console.log(chalk.dim(` ${config.aliases.styles}/theme.css`));\n}\n\nfunction printThemeError(id: string, themes: ThemeEntry[]): void {\n console.log(chalk.red(`Theme \"${id}\" not found. Available themes:`));\n console.log(themes.map((entry) => ` ${entry.id}`).join(\"\\n\"));\n}\n\nfunction validateCustomTheme(themeConfig: CustomTheme): void {\n for (const mode of [\"dark\", \"light\"] as const) {\n if (!themeConfig[mode] || typeof themeConfig[mode] !== \"object\") {\n throw new Error(`missing ${mode} colors`);\n }\n }\n if (!themeConfig.radius || !themeConfig.settings) {\n throw new Error(\"missing radius or settings\");\n }\n}\n\nfunction addThemeImport(config: Config, cwd: string, themePath: string): void {\n const cssPath = resolve(cwd, config.tailwind.css);\n const importPath = relative(dirname(cssPath), themePath).replace(/\\\\/g, \"/\");\n const importLine = `@import \"./${importPath}\";`;\n const existing = existsSync(cssPath) ? readFileSync(cssPath, \"utf-8\") : \"\";\n\n if (!existing.includes(importLine)) {\n writeFileSync(cssPath, `${existing.trimEnd()}\\n${importLine}\\n`);\n }\n}\n","import { Command } from \"commander\";\n\nimport { add } from \"./commands/add\";\nimport { init } from \"./commands/init\";\nimport { list } from \"./commands/list\";\nimport { theme } from \"./commands/theme\";\n\nconst program = new Command();\n\nprogram\n .name(\"ionbit-ui\")\n .description(\n \"Ionbit UI CLI — install source-owned components from the Ionbit UI registry.\",\n )\n .version(\"0.2.2\");\n\nprogram\n .command(\"init\")\n .description(\n \"Initialize Ionbit UI in your project. Creates a ionbit-ui.config.json and installs design tokens.\",\n )\n .option(\"-y, --yes\", \"Skip confirmation prompts and use defaults\")\n .option(\"-f, --force\", \"Force overwrite of existing configuration\")\n .option(\n \"--pointer\",\n \"Add cursor: pointer CSS for buttons (Tailwind v4 defaults to cursor: default)\",\n )\n .action(init);\n\nprogram\n .command(\"add <components...>\")\n .description(\n \"Add components to your project. e.g. ionbit-ui add button card accordion\",\n )\n .option(\"-o, --overwrite\", \"Overwrite existing files\")\n .action(add);\n\nprogram\n .command(\"list\")\n .description(\"List all available components in the registry.\")\n .action(list);\n\nprogram\n .command(\"theme [id]\")\n .description(\"Install a preset or custom theme.\")\n .option(\"--custom <json>\", \"Install a custom theme from JSON\")\n .option(\"-o, --overwrite\", \"Overwrite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