pittaya 0.0.5 β†’ 0.0.8

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/README.md CHANGED
@@ -25,7 +25,7 @@ Use the `add` command to add components to your project.
25
25
  The `add` command adds a component to your project and installs all required dependencies.
26
26
 
27
27
  ```bash
28
- npx pittaya add [component]
28
+ npx pittaya add [component]
29
29
  ```
30
30
 
31
31
  ### Example
@@ -40,10 +40,123 @@ You can also run the command without any arguments to view a list of all availab
40
40
  npx pittaya add
41
41
  ```
42
42
 
43
+ ## diff
44
+
45
+ Use the `diff` command to check for component updates.
46
+
47
+ The `diff` command compares your installed components with the registry and shows which ones have updates available.
48
+
49
+ ```bash
50
+ npx pittaya diff [component]
51
+ ```
52
+
53
+ ### Example
54
+
55
+ ```bash
56
+ # Check specific components
57
+ npx pittaya diff button orbit-images
58
+
59
+ # Check all installed components
60
+ npx pittaya diff --all
61
+
62
+ # Interactive mode
63
+ npx pittaya diff
64
+ ```
65
+
66
+ ## update
67
+
68
+ Use the `update` command to update components to the latest version.
69
+
70
+ The `update` command updates your installed components to match the registry version.
71
+
72
+ ```bash
73
+ npx pittaya update [component]
74
+ ```
75
+
76
+ ### Example
77
+
78
+ ```bash
79
+ # Update specific component
80
+ npx pittaya update button
81
+
82
+ # Update all components
83
+ npx pittaya update --all --yes
84
+
85
+ # Force update (even if no changes detected)
86
+ npx pittaya update button --force
87
+ ```
88
+
89
+ ## list
90
+
91
+ Use the `list` command to view all available and installed components.
92
+
93
+ The `list` command shows all components from the registry organized by category with installation status.
94
+
95
+ ```bash
96
+ npx pittaya list
97
+ ```
98
+
99
+ ### Example
100
+
101
+ ```bash
102
+ # List all components
103
+ npx pittaya list
104
+
105
+ # List only installed components
106
+ npx pittaya list --installed
107
+
108
+ # List only available components
109
+ npx pittaya list --available
110
+
111
+ # JSON output for programmatic use
112
+ npx pittaya list --json
113
+ ```
114
+
115
+ ## debug
116
+
117
+ Use the `debug` command to diagnose component installation issues.
118
+
119
+ The `debug` command helps identify why a component is not being detected as installed, showing expected file paths and actual file locations.
120
+
121
+ ```bash
122
+ npx pittaya debug --component [component]
123
+ ```
124
+
125
+ ### Example
126
+
127
+ ```bash
128
+ # Debug general project setup
129
+ npx pittaya debug
130
+
131
+ # Debug specific component
132
+ npx pittaya debug --component installation-section
133
+ ```
134
+
135
+ **What it shows:**
136
+ - Project structure detection (src/ vs root)
137
+ - Resolved alias paths
138
+ - Expected file locations
139
+ - Actual file existence
140
+ - Installation status
141
+ - Similar files found (helps identify naming mismatches)
142
+
143
+ **Common issues it helps diagnose:**
144
+ - File name mismatches (e.g., `InstallationSection.tsx` vs `installation-section.tsx`)
145
+ - Wrong directory structure (e.g., missing `src/` folder)
146
+ - Incorrect `components.json` aliases
147
+ - Components installed in unexpected locations
148
+
43
149
  ## Documentation
44
150
 
45
151
  Visit https://pittaya-ui.vercel.app to view the documentation.
46
152
 
153
+ ### Additional Resources
154
+
155
+ - [Roadmap](../../ROADMAP.md) - πŸ—ΊοΈ Future plans and completed features
156
+ - [Changelog](../../CHANGELOG.md) - Version history and changes
157
+ - [Contributing Guide](../../CONTRIBUTING.md) - How to contribute
158
+ - [ADRs](../../docs/adr/README.md) - Architectural decisions
159
+
47
160
  ## Contributors
48
161
 
49
162
  <a href="https://github.com/pittaya-ui/ui-kit/graphs/contributors">
package/dist/index.js CHANGED
@@ -7,8 +7,8 @@ import { Command } from "commander";
7
7
  import chalk from "chalk";
8
8
  import ora from "ora";
9
9
  import prompts from "prompts";
10
- import path2 from "path";
11
- import fs2 from "fs/promises";
10
+ import path4 from "path";
11
+ import fs4 from "fs/promises";
12
12
  import { execa } from "execa";
13
13
 
14
14
  // src/utils/registry.ts
@@ -96,10 +96,10 @@ async function isPackageInstalled(packageName) {
96
96
  const cwd = process.cwd();
97
97
  try {
98
98
  const packageJsonPath = path.join(cwd, "package.json");
99
- const packageJson = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
99
+ const packageJson2 = JSON.parse(await fs.readFile(packageJsonPath, "utf-8"));
100
100
  const allDeps = {
101
- ...packageJson.dependencies,
102
- ...packageJson.devDependencies
101
+ ...packageJson2.dependencies,
102
+ ...packageJson2.devDependencies
103
103
  };
104
104
  if (allDeps[packageName]) {
105
105
  return true;
@@ -125,13 +125,101 @@ async function checkMissingDependencies(dependencies) {
125
125
  return missing;
126
126
  }
127
127
 
128
+ // src/utils/component-checker.ts
129
+ import path3 from "path";
130
+ import fs3 from "fs/promises";
131
+
132
+ // src/utils/project-structure.ts
133
+ import fs2 from "fs/promises";
134
+ import path2 from "path";
135
+ async function hasSrcDirectory(cwd = process.cwd()) {
136
+ try {
137
+ const srcPath = path2.join(cwd, "src");
138
+ await fs2.access(srcPath);
139
+ const commonDirs = ["app", "components", "lib", "pages"];
140
+ for (const dir of commonDirs) {
141
+ try {
142
+ await fs2.access(path2.join(srcPath, dir));
143
+ return true;
144
+ } catch {
145
+ continue;
146
+ }
147
+ }
148
+ try {
149
+ const tsconfigPath = path2.join(cwd, "tsconfig.json");
150
+ const tsconfig = JSON.parse(await fs2.readFile(tsconfigPath, "utf-8"));
151
+ if (tsconfig.compilerOptions?.paths) {
152
+ const paths = tsconfig.compilerOptions.paths;
153
+ if (paths["@/*"]?.includes("./src/*")) {
154
+ return true;
155
+ }
156
+ }
157
+ } catch {
158
+ console.error("Bro... just in 21st century you not even have a tsconfig.json file in your project. That way you fuck me up :D");
159
+ }
160
+ return false;
161
+ } catch {
162
+ return false;
163
+ }
164
+ }
165
+ async function resolveAliasPath(aliasPath, cwd = process.cwd()) {
166
+ const usesSrc = await hasSrcDirectory(cwd);
167
+ const baseDir = usesSrc ? "src/" : "";
168
+ return aliasPath.replace(/^@\//, baseDir);
169
+ }
170
+ async function getDefaultPaths(cwd = process.cwd()) {
171
+ const usesSrc = await hasSrcDirectory(cwd);
172
+ const baseDir = usesSrc ? "src/" : "";
173
+ return {
174
+ globalsCss: `${baseDir}app/globals.css`,
175
+ components: "@/components",
176
+ utils: "@/lib/utils",
177
+ ui: "@/components/ui",
178
+ lib: "@/lib",
179
+ hooks: "@/hooks",
180
+ baseDir
181
+ };
182
+ }
183
+
184
+ // src/utils/component-checker.ts
185
+ async function isComponentInstalled(name, config) {
186
+ try {
187
+ const component = await getRegistryComponent(name);
188
+ if (!component) return false;
189
+ for (const file of component.files) {
190
+ const targetPath = await resolveTargetPath(file.name, component.type, config);
191
+ const filePath = path3.join(process.cwd(), targetPath);
192
+ const exists = await fs3.access(filePath).then(() => true).catch(() => false);
193
+ if (!exists) return false;
194
+ }
195
+ return true;
196
+ } catch {
197
+ return false;
198
+ }
199
+ }
200
+ async function resolveTargetPath(fileName, type, config) {
201
+ if (type === "registry:ui") {
202
+ const resolvedPath = await resolveAliasPath(config.aliases.ui);
203
+ return path3.join(resolvedPath, fileName);
204
+ }
205
+ if (type === "registry:lib") {
206
+ const resolvedPath = await resolveAliasPath(config.aliases.lib);
207
+ return path3.join(resolvedPath, fileName);
208
+ }
209
+ if (type === "registry:hook") {
210
+ const resolvedPath = await resolveAliasPath(config.aliases.hooks);
211
+ return path3.join(resolvedPath, fileName);
212
+ }
213
+ return fileName;
214
+ }
215
+
128
216
  // src/commands/add.ts
129
217
  async function add(components, options) {
130
218
  const cwd = process.cwd();
131
- const componentsJsonPath = path2.join(cwd, "components.json");
219
+ const componentsJsonPath = path4.join(cwd, "components.json");
132
220
  let config;
133
221
  try {
134
- const configContent = await fs2.readFile(componentsJsonPath, "utf-8");
222
+ const configContent = await fs4.readFile(componentsJsonPath, "utf-8");
135
223
  config = JSON.parse(configContent);
136
224
  } catch (error) {
137
225
  console.log(chalk.red("\n\u274C components.json not found.\n"));
@@ -182,21 +270,6 @@ Adding ${components.length} component(s)...
182
270
  }
183
271
  console.log(chalk.green("\n\u2705 Components added successfully!\n"));
184
272
  }
185
- async function isComponentInstalled(name, config) {
186
- try {
187
- const component = await getRegistryComponent(name);
188
- if (!component) return false;
189
- for (const file of component.files) {
190
- const targetPath = resolveTargetPath(file.name, component.type, config);
191
- const filePath = path2.join(process.cwd(), targetPath);
192
- const exists = await fs2.access(filePath).then(() => true).catch(() => false);
193
- if (!exists) return false;
194
- }
195
- return true;
196
- } catch {
197
- return false;
198
- }
199
- }
200
273
  async function addComponent(name, config, options) {
201
274
  const alreadyInstalled = await isComponentInstalled(name, config);
202
275
  if (alreadyInstalled && !options.overwrite) {
@@ -262,9 +335,9 @@ async function addComponent(name, config, options) {
262
335
  spinner.start(`Installing ${chalk.bold(name)}...`);
263
336
  }
264
337
  for (const file of component.files) {
265
- const targetPath = resolveTargetPath(file.name, component.type, config);
266
- const filePath = path2.join(process.cwd(), targetPath);
267
- const exists = await fs2.access(filePath).then(() => true).catch(() => false);
338
+ const targetPath = await resolveTargetPath(file.name, component.type, config);
339
+ const filePath = path4.join(process.cwd(), targetPath);
340
+ const exists = await fs4.access(filePath).then(() => true).catch(() => false);
268
341
  if (exists && !options.overwrite && !options.yes) {
269
342
  spinner.stop();
270
343
  const { overwrite } = await prompts({
@@ -279,9 +352,9 @@ async function addComponent(name, config, options) {
279
352
  }
280
353
  spinner.start();
281
354
  }
282
- await fs2.mkdir(path2.dirname(filePath), { recursive: true });
355
+ await fs4.mkdir(path4.dirname(filePath), { recursive: true });
283
356
  const content = transformImports(file.content, config);
284
- await fs2.writeFile(filePath, content, "utf-8");
357
+ await fs4.writeFile(filePath, content, "utf-8");
285
358
  }
286
359
  spinner.succeed(`${chalk.bold(name)} installed successfully!`);
287
360
  } catch (error) {
@@ -289,40 +362,19 @@ async function addComponent(name, config, options) {
289
362
  console.error(error);
290
363
  }
291
364
  }
292
- function resolveTargetPath(fileName, type, config) {
293
- if (type === "registry:ui") {
294
- return path2.join(
295
- config.aliases.ui.replace("@/", "src/"),
296
- fileName
297
- );
298
- }
299
- if (type === "registry:lib") {
300
- return path2.join(
301
- config.aliases.lib.replace("@/", "src/"),
302
- fileName
303
- );
304
- }
305
- if (type === "registry:hook") {
306
- return path2.join(
307
- config.aliases.hooks.replace("@/", "src/"),
308
- fileName
309
- );
310
- }
311
- return fileName;
312
- }
313
365
 
314
366
  // src/commands/init.ts
315
367
  import chalk2 from "chalk";
316
368
  import ora2 from "ora";
317
369
  import prompts2 from "prompts";
318
- import path3 from "path";
319
- import fs3 from "fs/promises";
370
+ import path5 from "path";
371
+ import fs5 from "fs/promises";
320
372
  import { execa as execa2 } from "execa";
321
373
  async function init(options) {
322
374
  console.log(chalk2.bold("\nWelcome to Pittaya UI!\n"));
323
375
  const cwd = process.cwd();
324
- const componentsJsonPath = path3.join(cwd, "components.json");
325
- const exists = await fs3.access(componentsJsonPath).then(() => true).catch(() => false);
376
+ const componentsJsonPath = path5.join(cwd, "components.json");
377
+ const exists = await fs5.access(componentsJsonPath).then(() => true).catch(() => false);
326
378
  if (exists && !options.yes) {
327
379
  const { overwrite } = await prompts2({
328
380
  type: "confirm",
@@ -335,7 +387,14 @@ async function init(options) {
335
387
  return;
336
388
  }
337
389
  }
338
- const config = options.yes ? getDefaultConfig() : await prompts2([
390
+ const defaultPaths = await getDefaultPaths(cwd);
391
+ const config = options.yes ? {
392
+ style: "new-york",
393
+ tailwindCss: defaultPaths.globalsCss,
394
+ rsc: true,
395
+ componentsPath: defaultPaths.components,
396
+ utilsPath: defaultPaths.utils
397
+ } : await prompts2([
339
398
  {
340
399
  type: "select",
341
400
  name: "style",
@@ -350,7 +409,7 @@ async function init(options) {
350
409
  type: "text",
351
410
  name: "tailwindCss",
352
411
  message: "Where is your globals.css file?",
353
- initial: "src/app/globals.css"
412
+ initial: defaultPaths.globalsCss
354
413
  },
355
414
  {
356
415
  type: "confirm",
@@ -362,13 +421,13 @@ async function init(options) {
362
421
  type: "text",
363
422
  name: "componentsPath",
364
423
  message: "Path for components?",
365
- initial: "@/components"
424
+ initial: defaultPaths.components
366
425
  },
367
426
  {
368
427
  type: "text",
369
428
  name: "utilsPath",
370
429
  message: "Path for utils?",
371
- initial: "@/lib/utils"
430
+ initial: defaultPaths.utils
372
431
  }
373
432
  ]);
374
433
  if (!config.style && !options.yes) {
@@ -397,7 +456,7 @@ async function init(options) {
397
456
  iconLibrary: "lucide"
398
457
  };
399
458
  const spinner = ora2("Creating components.json...").start();
400
- await fs3.writeFile(
459
+ await fs5.writeFile(
401
460
  componentsJsonPath,
402
461
  JSON.stringify(componentsJson, null, 2)
403
462
  );
@@ -430,23 +489,14 @@ async function init(options) {
430
489
  )
431
490
  );
432
491
  }
433
- function getDefaultConfig() {
434
- return {
435
- style: "new-york",
436
- tailwindCss: "src/app/globals.css",
437
- rsc: true,
438
- componentsPath: "@/components",
439
- utilsPath: "@/lib/utils"
440
- };
441
- }
442
492
  async function detectPackageManager2() {
443
493
  try {
444
- await fs3.access("pnpm-lock.yaml");
494
+ await fs5.access("pnpm-lock.yaml");
445
495
  return "pnpm";
446
496
  } catch {
447
497
  }
448
498
  try {
449
- await fs3.access("yarn.lock");
499
+ await fs5.access("yarn.lock");
450
500
  return "yarn";
451
501
  } catch {
452
502
  }
@@ -463,11 +513,578 @@ async function credits() {
463
513
  console.log(chalk3.dim("\n Thank you for using Pittaya UI! \u2764\uFE0F\n"));
464
514
  }
465
515
 
516
+ // src/commands/diff.ts
517
+ import chalk4 from "chalk";
518
+ import ora3 from "ora";
519
+ import prompts3 from "prompts";
520
+ import path6 from "path";
521
+ import fs6 from "fs/promises";
522
+ async function diff(components, options) {
523
+ const cwd = process.cwd();
524
+ const componentsJsonPath = path6.join(cwd, "components.json");
525
+ let config;
526
+ try {
527
+ const configContent = await fs6.readFile(componentsJsonPath, "utf-8");
528
+ config = JSON.parse(configContent);
529
+ } catch (error) {
530
+ console.log(chalk4.red("\n\u274C components.json not found.\n"));
531
+ console.log(
532
+ chalk4.dim(`Run ${chalk4.bold("npx pittaya init")} first.
533
+ `)
534
+ );
535
+ return;
536
+ }
537
+ const spinner = ora3("Fetching registry...").start();
538
+ let registry;
539
+ try {
540
+ registry = await fetchRegistry();
541
+ spinner.succeed("Registry loaded!");
542
+ } catch (error) {
543
+ spinner.fail("Error loading registry");
544
+ console.error(error);
545
+ return;
546
+ }
547
+ let componentsToCheck = [];
548
+ if (options.all) {
549
+ const allComponents = registry.components.filter((comp) => comp.type === "registry:ui" || comp.type === "registry:lib").map((comp) => comp.name);
550
+ for (const comp of allComponents) {
551
+ const isInstalled = await isComponentInstalled(comp, config);
552
+ if (isInstalled) {
553
+ componentsToCheck.push(comp);
554
+ }
555
+ }
556
+ if (componentsToCheck.length === 0) {
557
+ console.log(chalk4.yellow("\n\u26A0\uFE0F No components installed yet.\n"));
558
+ return;
559
+ }
560
+ } else if (components.length === 0) {
561
+ const allComponents = registry.components.filter((comp) => comp.type === "registry:ui" || comp.type === "registry:lib").map((comp) => comp.name);
562
+ const installedComponents = [];
563
+ for (const comp of allComponents) {
564
+ const isInstalled = await isComponentInstalled(comp, config);
565
+ if (isInstalled) {
566
+ installedComponents.push(comp);
567
+ }
568
+ }
569
+ if (installedComponents.length === 0) {
570
+ console.log(chalk4.yellow("\n\u26A0\uFE0F No components installed yet.\n"));
571
+ return;
572
+ }
573
+ const { selected } = await prompts3({
574
+ type: "multiselect",
575
+ name: "selected",
576
+ message: "Select components to check for updates:",
577
+ choices: installedComponents.map((name) => ({
578
+ title: name,
579
+ value: name
580
+ })),
581
+ min: 1
582
+ });
583
+ if (!selected || selected.length === 0) {
584
+ console.log(chalk4.yellow("\n\u274C No components selected.\n"));
585
+ return;
586
+ }
587
+ componentsToCheck = selected;
588
+ } else {
589
+ componentsToCheck = components;
590
+ }
591
+ console.log(chalk4.dim(`
592
+ Checking ${componentsToCheck.length} component(s)...
593
+ `));
594
+ const results = [];
595
+ for (const componentName of componentsToCheck) {
596
+ const diffResult = await checkComponentDiff(componentName, config);
597
+ if (diffResult) {
598
+ results.push(diffResult);
599
+ }
600
+ }
601
+ displayDiffResults(results);
602
+ }
603
+ async function checkComponentDiff(name, config) {
604
+ try {
605
+ const component = await getRegistryComponent(name);
606
+ if (!component) {
607
+ console.log(chalk4.red(` \u274C Component "${name}" not found in registry.`));
608
+ return null;
609
+ }
610
+ const isInstalled = await isComponentInstalled(name, config);
611
+ if (!isInstalled) {
612
+ console.log(chalk4.dim(` \u23ED\uFE0F ${name} is not installed, skipping...`));
613
+ return null;
614
+ }
615
+ const fileDiffs = [];
616
+ let hasChanges = false;
617
+ for (const file of component.files) {
618
+ const targetPath = await resolveTargetPath(file.name, component.type, config);
619
+ const filePath = path6.join(process.cwd(), targetPath);
620
+ try {
621
+ const localContent = await fs6.readFile(filePath, "utf-8");
622
+ const registryContent = transformImports(file.content, config);
623
+ const contentMatches = localContent.trim() === registryContent.trim();
624
+ fileDiffs.push({
625
+ name: file.name,
626
+ hasChanges: !contentMatches,
627
+ isNew: false,
628
+ isMissing: false
629
+ });
630
+ if (!contentMatches) {
631
+ hasChanges = true;
632
+ }
633
+ } catch (error) {
634
+ fileDiffs.push({
635
+ name: file.name,
636
+ hasChanges: true,
637
+ isNew: false,
638
+ isMissing: true
639
+ });
640
+ hasChanges = true;
641
+ }
642
+ }
643
+ return {
644
+ name,
645
+ hasChanges,
646
+ files: fileDiffs,
647
+ isInstalled: true
648
+ };
649
+ } catch (error) {
650
+ console.log(chalk4.red(` \u274C Error checking ${name}`));
651
+ console.error(error);
652
+ return null;
653
+ }
654
+ }
655
+ function displayDiffResults(results) {
656
+ const componentsWithChanges = results.filter((r) => r.hasChanges);
657
+ const componentsUpToDate = results.filter((r) => !r.hasChanges);
658
+ console.log();
659
+ if (componentsWithChanges.length > 0) {
660
+ console.log(chalk4.yellow(`\u{1F4DD} Components with updates available (${componentsWithChanges.length}):
661
+ `));
662
+ for (const result of componentsWithChanges) {
663
+ console.log(chalk4.yellow(` \u2022 ${chalk4.bold(result.name)}`));
664
+ for (const file of result.files) {
665
+ if (file.hasChanges) {
666
+ if (file.isMissing) {
667
+ console.log(chalk4.red(` \u2514\u2500 ${file.name} (missing locally)`));
668
+ } else {
669
+ console.log(chalk4.dim(` \u2514\u2500 ${file.name} (modified)`));
670
+ }
671
+ }
672
+ }
673
+ }
674
+ console.log();
675
+ console.log(chalk4.dim(`Run ${chalk4.bold("npx pittaya update <component>")} to update.`));
676
+ }
677
+ if (componentsUpToDate.length > 0) {
678
+ console.log(chalk4.green(`
679
+ \u2705 Components up to date (${componentsUpToDate.length}):
680
+ `));
681
+ for (const result of componentsUpToDate) {
682
+ console.log(chalk4.dim(` \u2022 ${result.name}`));
683
+ }
684
+ }
685
+ console.log();
686
+ }
687
+
688
+ // src/commands/update.ts
689
+ import chalk5 from "chalk";
690
+ import ora4 from "ora";
691
+ import prompts4 from "prompts";
692
+ import path7 from "path";
693
+ import fs7 from "fs/promises";
694
+ async function update(components, options) {
695
+ const cwd = process.cwd();
696
+ const componentsJsonPath = path7.join(cwd, "components.json");
697
+ let config;
698
+ try {
699
+ const configContent = await fs7.readFile(componentsJsonPath, "utf-8");
700
+ config = JSON.parse(configContent);
701
+ } catch (error) {
702
+ console.log(chalk5.red("\n\u274C components.json not found.\n"));
703
+ console.log(
704
+ chalk5.dim(`Run ${chalk5.bold("npx pittaya init")} first.
705
+ `)
706
+ );
707
+ return;
708
+ }
709
+ const spinner = ora4("Fetching registry...").start();
710
+ let registry;
711
+ try {
712
+ registry = await fetchRegistry();
713
+ spinner.succeed("Registry loaded!");
714
+ } catch (error) {
715
+ spinner.fail("Error loading registry");
716
+ console.error(error);
717
+ return;
718
+ }
719
+ let componentsToUpdate = [];
720
+ if (options.all) {
721
+ const allComponents = registry.components.filter((comp) => comp.type === "registry:ui" || comp.type === "registry:lib").map((comp) => comp.name);
722
+ for (const comp of allComponents) {
723
+ const isInstalled = await isComponentInstalled(comp, config);
724
+ if (isInstalled) {
725
+ componentsToUpdate.push(comp);
726
+ }
727
+ }
728
+ if (componentsToUpdate.length === 0) {
729
+ console.log(chalk5.yellow("\n\u26A0\uFE0F No components installed yet.\n"));
730
+ return;
731
+ }
732
+ if (!options.yes && !options.force) {
733
+ const { confirm } = await prompts4({
734
+ type: "confirm",
735
+ name: "confirm",
736
+ message: `Update ${componentsToUpdate.length} component(s)?`,
737
+ initial: true
738
+ });
739
+ if (!confirm) {
740
+ console.log(chalk5.yellow("\n\u274C Update cancelled.\n"));
741
+ return;
742
+ }
743
+ }
744
+ } else if (components.length === 0) {
745
+ const allComponents = registry.components.filter((comp) => comp.type === "registry:ui" || comp.type === "registry:lib").map((comp) => comp.name);
746
+ const installedComponents = [];
747
+ for (const comp of allComponents) {
748
+ const isInstalled = await isComponentInstalled(comp, config);
749
+ if (isInstalled) {
750
+ installedComponents.push(comp);
751
+ }
752
+ }
753
+ if (installedComponents.length === 0) {
754
+ console.log(chalk5.yellow("\n\u26A0\uFE0F No components installed yet.\n"));
755
+ return;
756
+ }
757
+ const { selected } = await prompts4({
758
+ type: "multiselect",
759
+ name: "selected",
760
+ message: "Select components to update:",
761
+ choices: installedComponents.map((name) => ({
762
+ title: name,
763
+ value: name
764
+ })),
765
+ min: 1
766
+ });
767
+ if (!selected || selected.length === 0) {
768
+ console.log(chalk5.yellow("\n\u274C No components selected.\n"));
769
+ return;
770
+ }
771
+ componentsToUpdate = selected;
772
+ } else {
773
+ componentsToUpdate = components;
774
+ }
775
+ console.log(chalk5.dim(`
776
+ Checking ${componentsToUpdate.length} component(s) for updates...
777
+ `));
778
+ const results = [];
779
+ for (const componentName of componentsToUpdate) {
780
+ const result = await updateComponent(componentName, config, options);
781
+ results.push(result);
782
+ }
783
+ displayUpdateResults(results);
784
+ }
785
+ async function hasComponentChanges(component, config) {
786
+ for (const file of component.files) {
787
+ const targetPath = await resolveTargetPath(file.name, component.type, config);
788
+ const filePath = path7.join(process.cwd(), targetPath);
789
+ try {
790
+ const localContent = await fs7.readFile(filePath, "utf-8");
791
+ const registryContent = transformImports(file.content, config);
792
+ if (localContent.trim() !== registryContent.trim()) {
793
+ return true;
794
+ }
795
+ } catch {
796
+ return true;
797
+ }
798
+ }
799
+ return false;
800
+ }
801
+ async function updateComponent(name, config, options) {
802
+ try {
803
+ const component = await getRegistryComponent(name);
804
+ if (!component) {
805
+ console.log(chalk5.red(` \u274C Component "${name}" not found in registry.`));
806
+ return { name, updated: false, skipped: true, reason: "not found in registry" };
807
+ }
808
+ const isInstalled = await isComponentInstalled(name, config);
809
+ if (!isInstalled) {
810
+ console.log(chalk5.dim(` \u23ED\uFE0F ${name} is not installed, skipping...`));
811
+ return { name, updated: false, skipped: true, reason: "not installed" };
812
+ }
813
+ const hasChanges = await hasComponentChanges(component, config);
814
+ if (!hasChanges && !options.force) {
815
+ console.log(chalk5.dim(` \u2713 ${name} is already up to date`));
816
+ return { name, updated: false, skipped: true, reason: "already up to date" };
817
+ }
818
+ if (!options.yes && !options.force) {
819
+ const { confirm } = await prompts4({
820
+ type: "confirm",
821
+ name: "confirm",
822
+ message: `Update ${chalk5.bold(name)}?`,
823
+ initial: true
824
+ });
825
+ if (!confirm) {
826
+ console.log(chalk5.yellow(` \u23ED\uFE0F Skipped ${name}`));
827
+ return { name, updated: false, skipped: true, reason: "user cancelled" };
828
+ }
829
+ }
830
+ const spinner = ora4(`Updating ${chalk5.bold(name)}...`).start();
831
+ for (const file of component.files) {
832
+ const targetPath = await resolveTargetPath(file.name, component.type, config);
833
+ const filePath = path7.join(process.cwd(), targetPath);
834
+ await fs7.mkdir(path7.dirname(filePath), { recursive: true });
835
+ const content = transformImports(file.content, config);
836
+ await fs7.writeFile(filePath, content, "utf-8");
837
+ }
838
+ spinner.succeed(`${chalk5.bold(name)} updated successfully!`);
839
+ return { name, updated: true, skipped: false };
840
+ } catch (error) {
841
+ console.log(chalk5.red(` \u274C Error updating ${name}`));
842
+ console.error(error);
843
+ return { name, updated: false, skipped: true, reason: "error" };
844
+ }
845
+ }
846
+ function displayUpdateResults(results) {
847
+ const updated = results.filter((r) => r.updated);
848
+ const skipped = results.filter((r) => r.skipped);
849
+ console.log();
850
+ if (updated.length > 0) {
851
+ console.log(chalk5.green(`\u2705 Updated ${updated.length} component(s):
852
+ `));
853
+ for (const result of updated) {
854
+ console.log(chalk5.dim(` \u2022 ${result.name}`));
855
+ }
856
+ }
857
+ if (skipped.length > 0) {
858
+ console.log(chalk5.yellow(`
859
+ \u23ED\uFE0F Skipped ${skipped.length} component(s):
860
+ `));
861
+ for (const result of skipped) {
862
+ const reason = result.reason ? ` (${result.reason})` : "";
863
+ console.log(chalk5.dim(` \u2022 ${result.name}${reason}`));
864
+ }
865
+ }
866
+ console.log();
867
+ }
868
+
869
+ // src/commands/list.ts
870
+ import chalk6 from "chalk";
871
+ import ora5 from "ora";
872
+ import path8 from "path";
873
+ import fs8 from "fs/promises";
874
+ async function list(options) {
875
+ const cwd = process.cwd();
876
+ const componentsJsonPath = path8.join(cwd, "components.json");
877
+ let config;
878
+ try {
879
+ const configContent = await fs8.readFile(componentsJsonPath, "utf-8");
880
+ config = JSON.parse(configContent);
881
+ } catch (error) {
882
+ console.log(chalk6.red("\n\u274C components.json not found.\n"));
883
+ console.log(
884
+ chalk6.dim(`Run ${chalk6.bold("npx pittaya init")} first.
885
+ `)
886
+ );
887
+ return;
888
+ }
889
+ const spinner = ora5("Fetching components...").start();
890
+ let registry;
891
+ try {
892
+ registry = await fetchRegistry();
893
+ spinner.succeed("Components loaded!");
894
+ } catch (error) {
895
+ spinner.fail("Error loading registry");
896
+ console.error(error);
897
+ return;
898
+ }
899
+ const allComponents = registry.components || [];
900
+ const componentsWithStatus = await Promise.all(
901
+ allComponents.map(async (comp) => {
902
+ const installed = await isComponentInstalled(comp.slug, config);
903
+ return {
904
+ ...comp,
905
+ installed
906
+ };
907
+ })
908
+ );
909
+ let filteredComponents = componentsWithStatus;
910
+ if (options.installed) {
911
+ filteredComponents = componentsWithStatus.filter((comp) => comp.installed);
912
+ } else if (options.available) {
913
+ filteredComponents = componentsWithStatus.filter((comp) => !comp.installed);
914
+ }
915
+ if (options.json) {
916
+ console.log(JSON.stringify(filteredComponents, null, 2));
917
+ return;
918
+ }
919
+ displayComponents(filteredComponents, options);
920
+ }
921
+ function displayComponents(components, options) {
922
+ if (components.length === 0) {
923
+ if (options.installed) {
924
+ console.log(chalk6.yellow("\n\u{1F4E6} No components installed yet.\n"));
925
+ console.log(chalk6.dim(`Run ${chalk6.bold("npx pittaya add")} to install components.
926
+ `));
927
+ } else if (options.available) {
928
+ console.log(chalk6.yellow("\n\u2728 All components are already installed!\n"));
929
+ } else {
930
+ console.log(chalk6.yellow("\n\u26A0\uFE0F No components found in registry.\n"));
931
+ }
932
+ return;
933
+ }
934
+ const categorized = components.reduce((acc, comp) => {
935
+ const category = comp.category || "Other";
936
+ if (!acc[category]) {
937
+ acc[category] = [];
938
+ }
939
+ acc[category].push(comp);
940
+ return acc;
941
+ }, {});
942
+ console.log("\n");
943
+ if (options.installed) {
944
+ console.log(chalk6.bold.green("\u{1F4E6} Installed Components\n"));
945
+ } else if (options.available) {
946
+ console.log(chalk6.bold.blue("\u2728 Available Components\n"));
947
+ } else {
948
+ console.log(chalk6.bold("\u{1F4CB} All Components\n"));
949
+ }
950
+ Object.entries(categorized).sort().forEach(([category, comps]) => {
951
+ console.log(chalk6.bold.cyan(`${category}:`));
952
+ comps.forEach((comp) => {
953
+ const status = comp.installed ? chalk6.green("\u2713") : chalk6.dim("\u25CB");
954
+ const name = comp.installed ? chalk6.bold(comp.slug) : chalk6.dim(comp.slug);
955
+ const description = comp.description ? chalk6.dim(` - ${comp.description}`) : "";
956
+ const deps = comp.dependencies && comp.dependencies.length > 0 ? chalk6.dim.yellow(` [${comp.dependencies.length} deps]`) : "";
957
+ const internalDeps = comp.internalDependencies && comp.internalDependencies.length > 0 ? chalk6.dim.blue(` [requires: ${comp.internalDependencies.join(", ")}]`) : "";
958
+ console.log(` ${status} ${name}${description}${deps}${internalDeps}`);
959
+ });
960
+ console.log();
961
+ });
962
+ const installedCount = components.filter((c) => c.installed).length;
963
+ const totalCount = components.length;
964
+ if (!options.installed && !options.available) {
965
+ console.log(chalk6.dim(`Total: ${totalCount} components (${installedCount} installed, ${totalCount - installedCount} available)
966
+ `));
967
+ } else {
968
+ console.log(chalk6.dim(`Total: ${totalCount} components
969
+ `));
970
+ }
971
+ }
972
+
973
+ // src/commands/debug.ts
974
+ import chalk7 from "chalk";
975
+ import path9 from "path";
976
+ import fs9 from "fs/promises";
977
+ async function debug(options) {
978
+ const cwd = process.cwd();
979
+ const componentsJsonPath = path9.join(cwd, "components.json");
980
+ console.log(chalk7.bold("\n\u{1F50D} Pittaya UI Debug Information\n"));
981
+ console.log(chalk7.dim(`Working directory: ${cwd}
982
+ `));
983
+ let config;
984
+ try {
985
+ const configContent = await fs9.readFile(componentsJsonPath, "utf-8");
986
+ config = JSON.parse(configContent);
987
+ console.log(chalk7.green("\u2705 components.json found"));
988
+ console.log(chalk7.dim(` Path: ${componentsJsonPath}`));
989
+ } catch (error) {
990
+ console.log(chalk7.red("\u274C components.json not found\n"));
991
+ return;
992
+ }
993
+ const usesSrc = await hasSrcDirectory(cwd);
994
+ console.log(chalk7.green(`\u2705 Project structure: ${usesSrc ? "src/" : "root"}`));
995
+ console.log(chalk7.bold("\n\u{1F4CB} Configured Aliases:"));
996
+ console.log(chalk7.dim(` components: ${config.aliases.components}`));
997
+ console.log(chalk7.dim(` utils: ${config.aliases.utils}`));
998
+ console.log(chalk7.dim(` ui: ${config.aliases.ui}`));
999
+ const resolvedUi = await resolveAliasPath(config.aliases.ui, cwd);
1000
+ const resolvedLib = await resolveAliasPath(config.aliases.lib || "@/lib", cwd);
1001
+ console.log(chalk7.bold("\n\u{1F4C2} Resolved Paths:"));
1002
+ console.log(chalk7.dim(` UI components: ${resolvedUi}`));
1003
+ console.log(chalk7.dim(` Libraries: ${resolvedLib}`));
1004
+ if (options.component) {
1005
+ console.log(chalk7.bold(`
1006
+ \u{1F50D} Debugging component: ${options.component}
1007
+ `));
1008
+ try {
1009
+ const component = await getRegistryComponent(options.component);
1010
+ if (!component) {
1011
+ console.log(chalk7.red(`\u274C Component not found in registry
1012
+ `));
1013
+ return;
1014
+ }
1015
+ console.log(chalk7.green(`\u2705 Component found in registry`));
1016
+ console.log(chalk7.dim(` Type: ${component.type}`));
1017
+ console.log(chalk7.dim(` Files: ${component.files.length}`));
1018
+ console.log(chalk7.bold("\n\u{1F4C1} Expected Files:"));
1019
+ for (const file of component.files) {
1020
+ const targetPath = await resolveTargetPath(file.name, component.type, config);
1021
+ const fullPath = path9.join(cwd, targetPath);
1022
+ const exists = await fs9.access(fullPath).then(() => true).catch(() => false);
1023
+ const statusIcon = exists ? chalk7.green("\u2705") : chalk7.red("\u274C");
1024
+ const statusText = exists ? chalk7.green("EXISTS") : chalk7.red("NOT FOUND");
1025
+ console.log(` ${statusIcon} ${file.name}`);
1026
+ console.log(chalk7.dim(` Expected: ${fullPath}`));
1027
+ console.log(chalk7.dim(` Status: ${statusText}`));
1028
+ if (!exists) {
1029
+ const dir = path9.dirname(fullPath);
1030
+ try {
1031
+ const dirExists = await fs9.access(dir).then(() => true).catch(() => false);
1032
+ if (dirExists) {
1033
+ const filesInDir = await fs9.readdir(dir);
1034
+ const baseName = path9.basename(file.name, path9.extname(file.name));
1035
+ const similarFiles = filesInDir.filter(
1036
+ (f) => f.includes(baseName) || f.toLowerCase().includes(baseName.toLowerCase())
1037
+ );
1038
+ if (similarFiles.length > 0) {
1039
+ console.log(chalk7.yellow(` \u{1F4A1} Similar files found in directory:`));
1040
+ similarFiles.forEach((f) => {
1041
+ console.log(chalk7.dim(` - ${f}`));
1042
+ });
1043
+ }
1044
+ } else {
1045
+ console.log(chalk7.red(` \u26A0\uFE0F Directory doesn't exist: ${dir}`));
1046
+ }
1047
+ } catch (err) {
1048
+ }
1049
+ }
1050
+ }
1051
+ const isInstalled = await isComponentInstalled(options.component, config);
1052
+ console.log(chalk7.bold(`
1053
+ \u{1F4CA} Installation Status:`));
1054
+ if (isInstalled) {
1055
+ console.log(chalk7.green(` \u2705 Component is detected as INSTALLED`));
1056
+ } else {
1057
+ console.log(chalk7.red(` \u274C Component is detected as NOT INSTALLED`));
1058
+ console.log(chalk7.yellow(` \u{1F4A1} All files must exist for component to be considered installed`));
1059
+ }
1060
+ } catch (error) {
1061
+ console.log(chalk7.red(`
1062
+ \u274C Error debugging component:`));
1063
+ console.error(error);
1064
+ }
1065
+ } else {
1066
+ console.log(chalk7.yellow("\n\u{1F4A1} To debug a specific component, use:"));
1067
+ console.log(chalk7.dim(" npx pittaya debug --component <name>\n"));
1068
+ }
1069
+ }
1070
+
466
1071
  // src/index.ts
1072
+ import { readFileSync } from "fs";
1073
+ import { fileURLToPath } from "url";
1074
+ import { dirname, join } from "path";
1075
+ var __filename = fileURLToPath(import.meta.url);
1076
+ var __dirname = dirname(__filename);
1077
+ var packageJson = JSON.parse(
1078
+ readFileSync(join(__dirname, "../package.json"), "utf-8")
1079
+ );
467
1080
  var program = new Command();
468
- program.name("pittaya").description("Add Pittaya UI components to your project").version("0.0.1");
1081
+ program.name("pittaya").description("Add Pittaya UI components to your project").version(packageJson.version);
469
1082
  program.command("init").description("Initialize Pittaya UI in your project").option("-y, --yes", "Skip confirmations and use default values").action(init);
470
1083
  program.command("add").description("Add a component to your project").argument("[components...]", "Component names to add").option("-y, --yes", "Skip confirmations and overwrite existing files").option("-o, --overwrite", "Overwrite existing files").option("-a, --all", "Add all available components").option("--add-missing-deps", "Automatically install missing dependencies").action(add);
1084
+ program.command("diff").description("Check for component updates").argument("[components...]", "Component names to check (leave empty for interactive mode)").option("-a, --all", "Check all installed components").action(diff);
1085
+ program.command("update").description("Update components to latest version").argument("[components...]", "Component names to update (leave empty for interactive mode)").option("-a, --all", "Update all installed components").option("-y, --yes", "Skip confirmation prompts").option("-f, --force", "Force update even if no changes detected").action(update);
1086
+ program.command("list").description("List available and installed components").option("--installed", "Show only installed components").option("--available", "Show only available components").option("--json", "Output in JSON format").action(list);
471
1087
  program.command("credits").description("Show Pittaya UI creators").action(credits);
1088
+ program.command("debug").description("Debug component installation issues").option("-c, --component <name>", "Component name to debug").action(debug);
472
1089
  program.parse();
473
1090
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/utils/registry.ts","../src/utils/transformer.ts","../src/utils/package-manager.ts","../src/commands/init.ts","../src/commands/credits.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { Command } from \"commander\";\nimport { add } from \"./commands/add.js\";\nimport { init } from \"./commands/init.js\";\nimport { credits } from \"./commands/credits.js\";\n\nconst program = new Command();\n\nprogram\n .name(\"pittaya\")\n .description(\"Add Pittaya UI components to your project\")\n .version(\"0.0.1\");\n\nprogram\n .command(\"init\")\n .description(\"Initialize Pittaya UI in your project\")\n .option(\"-y, --yes\", \"Skip confirmations and use default values\")\n .action(init);\n\nprogram\n .command(\"add\")\n .description(\"Add a component to your project\")\n .argument(\"[components...]\", \"Component names to add\")\n .option(\"-y, --yes\", \"Skip confirmations and overwrite existing files\")\n .option(\"-o, --overwrite\", \"Overwrite existing files\")\n .option(\"-a, --all\", \"Add all available components\")\n .option(\"--add-missing-deps\", \"Automatically install missing dependencies\")\n .action(add);\n\nprogram\n .command(\"credits\")\n .description(\"Show Pittaya UI creators\")\n .action(credits);\n\nprogram.parse();\n\n","import chalk from \"chalk\";\nimport ora from \"ora\";\nimport prompts from \"prompts\";\nimport path from \"path\";\nimport fs from \"fs/promises\";\nimport { execa } from \"execa\";\nimport { fetchRegistry, getRegistryComponent } from \"../utils/registry.js\";\nimport { transformImports } from \"../utils/transformer.js\";\nimport { detectPackageManager, checkMissingDependencies } from \"../utils/package-manager.js\";\nimport { IAddOptions } from \"../interfaces/IAddOptions\";\nimport { IConfig } from \"../interfaces/IConfig\";\nimport { IRegistryComponent } from \"../interfaces/IRegistryComponent\";\n\nexport async function add(components: string[], options: IAddOptions) {\n const cwd = process.cwd();\n const componentsJsonPath = path.join(cwd, \"components.json\");\n\n let config: IConfig;\n try {\n const configContent = await fs.readFile(componentsJsonPath, \"utf-8\");\n config = JSON.parse(configContent);\n } catch (error) {\n console.log(chalk.red(\"\\n❌ components.json not found.\\n\"));\n console.log(\n chalk.dim(`Run ${chalk.bold(\"npx pittaya init\")} first.\\n`)\n );\n return;\n }\n\n const spinner = ora(\"Fetching available components...\").start();\n let registry;\n try {\n registry = await fetchRegistry();\n spinner.succeed(\"Registry loaded!\");\n } catch (error) {\n spinner.fail(\"Error loading registry\");\n console.error(error);\n return;\n }\n\n if (options.all) {\n components = registry.components\n .filter((comp: any) => comp.type === \"registry:ui\")\n .map((comp: any) => comp.name);\n }\n\n if (components.length === 0) {\n const availableComponents = registry.components\n .filter((comp: any) => comp.type === \"registry:ui\")\n .map((comp: any) => ({\n title: `${comp.name}${comp.description ? ` - ${comp.description}` : \"\"}`,\n value: comp.name,\n }));\n\n const { selected } = await prompts({\n type: \"multiselect\",\n name: \"selected\",\n message: \"Select components to add:\",\n choices: availableComponents,\n min: 1,\n });\n\n if (!selected || selected.length === 0) {\n console.log(chalk.yellow(\"\\n❌ No components selected.\\n\"));\n return;\n }\n\n components = selected;\n }\n\n console.log(\n chalk.dim(`\\nAdding ${components.length} component(s)...\\n`)\n );\n\n for (const componentName of components) {\n await addComponent(componentName, config, options);\n }\n\n console.log(chalk.green(\"\\nβœ… Components added successfully!\\n\"));\n}\n\nasync function isComponentInstalled(\n name: string,\n config: IConfig\n): Promise<boolean> {\n try {\n const component: IRegistryComponent = await getRegistryComponent(name);\n if (!component) return false;\n\n for (const file of component.files) {\n const targetPath = resolveTargetPath(file.name, component.type, config);\n const filePath = path.join(process.cwd(), targetPath);\n\n const exists = await fs\n .access(filePath)\n .then(() => true)\n .catch(() => false);\n\n if (!exists) return false;\n }\n\n return true;\n } catch {\n return false;\n }\n}\n\nasync function addComponent(\n name: string,\n config: IConfig,\n options: IAddOptions\n) {\n const alreadyInstalled = await isComponentInstalled(name, config);\n if (alreadyInstalled && !options.overwrite) {\n console.log(chalk.dim(` ⏭️ ${name} already installed, skipping...`));\n return;\n }\n\n const spinner = ora(`Installing ${chalk.bold(name)}...`).start();\n\n try {\n const component: IRegistryComponent = await getRegistryComponent(name);\n\n if (!component) {\n spinner.fail(`Component \"${name}\" not found in registry.`);\n return;\n }\n\n const packageManager = await detectPackageManager();\n\n if (component.dependencies && component.dependencies.length > 0) {\n const missingDeps = await checkMissingDependencies(component.dependencies);\n\n if (missingDeps.length > 0) {\n spinner.stop();\n\n console.log(chalk.yellow(`\\n⚠️ ${name} requires the following dependencies:\\n`));\n missingDeps.forEach(dep => {\n console.log(chalk.dim(` β€’ ${dep}`));\n });\n console.log();\n\n // If --add-missing-deps was passed, install automatically\n if (options.addMissingDeps) {\n console.log(chalk.dim(\"Installing dependencies automatically...\\n\"));\n } else {\n const { install } = await prompts({\n type: \"confirm\",\n name: \"install\",\n message: \"Do you want to install the dependencies now?\",\n initial: true,\n });\n\n if (!install) {\n console.log(chalk.yellow(\"\\n⚠️ Component not installed. Install the dependencies manually and try again.\\n\"));\n return;\n }\n }\n\n spinner.start(`Installing dependencies for ${name}...`);\n\n try {\n await execa(packageManager, [\n packageManager === \"yarn\" ? \"add\" : \"install\",\n ...missingDeps,\n ]);\n spinner.succeed(`Dependencies installed!`);\n spinner.start(`Installing ${chalk.bold(name)}...`);\n } catch (error) {\n spinner.fail(`Error installing dependencies`);\n console.error(error);\n return;\n }\n }\n }\n\n if (component.registryDependencies && component.registryDependencies.length > 0) {\n spinner.stop();\n console.log(chalk.dim(`\\n πŸ“¦ ${name} requires: ${component.registryDependencies.join(\", \")}`));\n\n for (const dep of component.registryDependencies) {\n await addComponent(dep, config, { ...options, yes: true });\n }\n\n console.log(); // Linha em branco\n spinner.start(`Installing ${chalk.bold(name)}...`);\n }\n\n for (const file of component.files) {\n const targetPath = resolveTargetPath(file.name, component.type, config);\n const filePath = path.join(process.cwd(), targetPath);\n\n const exists = await fs\n .access(filePath)\n .then(() => true)\n .catch(() => false);\n\n if (exists && !options.overwrite && !options.yes) {\n spinner.stop();\n const { overwrite } = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: `${targetPath} already exists. Overwrite?`,\n initial: false,\n });\n\n if (!overwrite) {\n spinner.warn(`Skipping ${targetPath}`);\n continue;\n }\n spinner.start();\n }\n\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n\n const content = transformImports(file.content, config);\n\n await fs.writeFile(filePath, content, \"utf-8\");\n }\n\n spinner.succeed(`${chalk.bold(name)} installed successfully!`);\n } catch (error) {\n spinner.fail(`Error installing ${name}`);\n console.error(error);\n }\n}\n\nfunction resolveTargetPath(\n fileName: string,\n type: string,\n config: IConfig\n): string {\n if (type === \"registry:ui\") {\n return path.join(\n config.aliases.ui.replace(\"@/\", \"src/\"),\n fileName\n );\n }\n\n if (type === \"registry:lib\") {\n return path.join(\n config.aliases.lib.replace(\"@/\", \"src/\"),\n fileName\n );\n }\n\n if (type === \"registry:hook\") {\n return path.join(\n config.aliases.hooks.replace(\"@/\", \"src/\"),\n fileName\n );\n }\n\n return fileName;\n}\n\n","import fetch from \"node-fetch\";\r\nimport { IRegistryComponent } from \"../interfaces/IRegistryComponent\";\r\n\r\nconst REGISTRY_BASE_URL = \"https://raw.githubusercontent.com/pittaya-ui/cli/main/registry\";\r\n\r\n\r\nexport async function fetchRegistry(): Promise<any> {\r\n try {\r\n const response = await fetch(`${REGISTRY_BASE_URL}/index.json`);\r\n if (!response.ok) {\r\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\r\n }\r\n return await response.json();\r\n } catch (error) {\r\n console.error(\"Error fetching registry:\", error);\r\n throw new Error(\"Unable to load the registry of components\");\r\n }\r\n}\r\n\r\nexport async function getRegistryComponent(name: string): Promise<IRegistryComponent> {\r\n try {\r\n const response = await fetch(\r\n `${REGISTRY_BASE_URL}/components/${name}.json`\r\n );\r\n\r\n if (!response.ok) {\r\n throw new Error(`Component \"${name}\" not found in registry`);\r\n }\r\n\r\n return await response.json() as IRegistryComponent;\r\n } catch (error: any) {\r\n throw new Error(`Error loading component \"${name}\": ${error.message}`);\r\n }\r\n}\r\n\r\nexport function setRegistryUrl(url: string) {\r\n process.env.PITTAYA_REGISTRY_URL = url;\r\n}\r\n\r\n","\r\n\r\nimport { IConfig } from \"../interfaces/IConfig\";\r\n\r\nexport function transformImports(content: string, config: IConfig): string {\r\n let transformed = content;\r\n\r\n const aliasMap: Record<string, string> = {\r\n \"@/components/ui\": config.aliases.ui,\r\n \"@/components\": config.aliases.components,\r\n \"@/lib/utils\": config.aliases.utils,\r\n \"@/lib\": config.aliases.lib,\r\n \"@/hooks\": config.aliases.hooks,\r\n };\r\n\r\n const sortedAliases = Object.entries(aliasMap).sort(\r\n ([a], [b]) => b.length - a.length\r\n );\r\n\r\n for (const [from, to] of sortedAliases) {\r\n if (from !== to) {\r\n transformed = transformed.replace(\r\n new RegExp(`from [\"']${escapeRegex(from)}`, \"g\"),\r\n `from \"${to}`\r\n );\r\n transformed = transformed.replace(\r\n new RegExp(`import [\"']${escapeRegex(from)}`, \"g\"),\r\n `import \"${to}`\r\n );\r\n }\r\n }\r\n\r\n return transformed;\r\n}\r\n\r\nfunction escapeRegex(str: string): string {\r\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\r\n}\r\n\r\n","import fs from \"fs/promises\";\r\nimport path from \"path\";\r\n\r\nexport async function detectPackageManager(): Promise<string> {\r\n try {\r\n await fs.access(\"pnpm-lock.yaml\");\r\n return \"pnpm\";\r\n } catch {}\r\n\r\n try {\r\n await fs.access(\"yarn.lock\");\r\n return \"yarn\";\r\n } catch {}\r\n\r\n try {\r\n await fs.access(\"bun.lockb\");\r\n return \"bun\";\r\n } catch {}\r\n\r\n return \"npm\";\r\n}\r\n\r\nexport async function isPackageInstalled(packageName: string): Promise<boolean> {\r\n const cwd = process.cwd();\r\n\r\n try {\r\n const packageJsonPath = path.join(cwd, \"package.json\");\r\n const packageJson = JSON.parse(await fs.readFile(packageJsonPath, \"utf-8\"));\r\n\r\n const allDeps = {\r\n ...packageJson.dependencies,\r\n ...packageJson.devDependencies,\r\n };\r\n\r\n if (allDeps[packageName]) {\r\n return true;\r\n }\r\n } catch {}\r\n\r\n try {\r\n const packagePath = path.join(cwd, \"node_modules\", packageName);\r\n await fs.access(packagePath);\r\n return true;\r\n } catch {}\r\n\r\n return false;\r\n}\r\n\r\nexport async function checkMissingDependencies(\r\n dependencies: string[]\r\n): Promise<string[]> {\r\n const missing: string[] = [];\r\n\r\n for (const dep of dependencies) {\r\n const installed = await isPackageInstalled(dep);\r\n if (!installed) {\r\n missing.push(dep);\r\n }\r\n }\r\n\r\n return missing;\r\n}\r\n\r\n","import chalk from \"chalk\";\nimport ora from \"ora\";\nimport prompts from \"prompts\";\nimport path from \"path\";\nimport fs from \"fs/promises\";\nimport { execa } from \"execa\";\n\ninterface InitOptions {\n yes?: boolean;\n}\n\nexport async function init(options: InitOptions) {\n console.log(chalk.bold(\"\\nWelcome to Pittaya UI!\\n\"));\n\n const cwd = process.cwd();\n const componentsJsonPath = path.join(cwd, \"components.json\");\n\n const exists = await fs\n .access(componentsJsonPath)\n .then(() => true)\n .catch(() => false);\n\n if (exists && !options.yes) {\n const { overwrite } = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: \"components.json already exists. Do you want to overwrite it?\",\n initial: false,\n });\n\n if (!overwrite) {\n console.log(chalk.yellow(\"\\n❌ Operation cancelled.\\n\"));\n return;\n }\n }\n\n const config = options.yes\n ? getDefaultConfig()\n : await prompts([\n {\n type: \"select\",\n name: \"style\",\n message: \"Which style would you like to use?\",\n choices: [\n { title: \"New York\", value: \"new-york\" },\n { title: \"Default\", value: \"default\" },\n { title: \"Recife\", value: \"recife\" },\n ],\n },\n {\n type: \"text\",\n name: \"tailwindCss\",\n message: \"Where is your globals.css file?\",\n initial: \"src/app/globals.css\",\n },\n {\n type: \"confirm\",\n name: \"rsc\",\n message: \"Use React Server Components?\",\n initial: true,\n },\n {\n type: \"text\",\n name: \"componentsPath\",\n message: \"Path for components?\",\n initial: \"@/components\",\n },\n {\n type: \"text\",\n name: \"utilsPath\",\n message: \"Path for utils?\",\n initial: \"@/lib/utils\",\n },\n ]);\n\n if (!config.style && !options.yes) {\n console.log(chalk.yellow(\"\\n❌ Operation cancelled.\\n\"));\n return;\n }\n\n const componentsJson = {\n $schema: \"https://raw.githubusercontent.com/pittaya-ui/cli/main/registry/schema.json\",\n style: config.style || \"new-york\",\n rsc: config.rsc ?? true,\n tsx: true,\n tailwind: {\n config: \"tailwind.config.ts\",\n css: config.tailwindCss || \"src/app/globals.css\",\n baseColor: \"neutral\",\n cssVariables: true,\n prefix: \"\",\n },\n aliases: {\n components: config.componentsPath || \"@/components\",\n utils: config.utilsPath || \"@/lib/utils\",\n ui: `${config.componentsPath || \"@/components\"}/pittaya/ui`,\n lib: \"@/lib\",\n hooks: \"@/hooks\",\n },\n iconLibrary: \"lucide\",\n };\n\n const spinner = ora(\"Creating components.json...\").start();\n await fs.writeFile(\n componentsJsonPath,\n JSON.stringify(componentsJson, null, 2)\n );\n spinner.succeed(\"components.json created successfully!\");\n\n const packageManager = await detectPackageManager();\n\n const depsSpinner = ora(\"Installing base dependencies...\").start();\n try {\n await execa(packageManager, [\n packageManager === \"yarn\" ? \"add\" : \"install\",\n \"class-variance-authority\",\n \"clsx\",\n \"tailwind-merge\",\n ]);\n depsSpinner.succeed(\"Dependencies installed!\");\n } catch (error) {\n depsSpinner.fail(\"Error installing dependencies\");\n console.error(error);\n }\n\n console.log(chalk.green(\"\\nβœ… Pittaya UI configured successfully!\\n\"));\n console.log(chalk.dim(\"Next steps:\"));\n console.log(\n chalk.dim(\n ` ${chalk.bold(\"npx pittaya add button\")} - Add a component`\n )\n );\n console.log(\n chalk.dim(\n ` ${chalk.bold(\"npx pittaya add --all\")} - Add all components\\n`\n )\n );\n}\n\nfunction getDefaultConfig() {\n return {\n style: \"new-york\",\n tailwindCss: \"src/app/globals.css\",\n rsc: true,\n componentsPath: \"@/components\",\n utilsPath: \"@/lib/utils\",\n };\n}\n\nasync function detectPackageManager(): Promise<string> {\n try {\n await fs.access(\"pnpm-lock.yaml\");\n return \"pnpm\";\n } catch {}\n\n try {\n await fs.access(\"yarn.lock\");\n return \"yarn\";\n } catch {}\n\n return \"npm\";\n}\n\n","import chalk from \"chalk\";\r\n\r\nexport async function credits() {\r\n console.log(chalk.bold(\"\\nPittaya UI - Creators\\n\"));\r\n\r\n console.log(chalk.cyan(\" β€’ Marcos Bueno\"));\r\n console.log(chalk.cyan(\" β€’ Lucas Ribeiro\"));\r\n console.log(chalk.cyan(\" β€’ Jarbas Gouveia\"));\r\n\r\n console.log(chalk.dim(\"\\n Thank you for using Pittaya UI! ❀️\\n\"));\r\n}\r\n\r\n"],"mappings":";;;AACA,SAAS,eAAe;;;ACDxB,OAAO,WAAW;AAClB,OAAO,SAAS;AAChB,OAAO,aAAa;AACpB,OAAOA,WAAU;AACjB,OAAOC,SAAQ;AACf,SAAS,aAAa;;;ACLtB,OAAO,WAAW;AAGlB,IAAM,oBAAoB;AAG1B,eAAsB,gBAA8B;AAClD,MAAI;AACF,UAAM,WAAW,MAAM,MAAM,GAAG,iBAAiB,aAAa;AAC9D,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI,MAAM,QAAQ,SAAS,MAAM,KAAK,SAAS,UAAU,EAAE;AAAA,IACnE;AACA,WAAO,MAAM,SAAS,KAAK;AAAA,EAC7B,SAAS,OAAO;AACd,YAAQ,MAAM,4BAA4B,KAAK;AAC/C,UAAM,IAAI,MAAM,2CAA2C;AAAA,EAC7D;AACF;AAEA,eAAsB,qBAAqB,MAA2C;AACpF,MAAI;AACF,UAAM,WAAW,MAAM;AAAA,MACrB,GAAG,iBAAiB,eAAe,IAAI;AAAA,IACzC;AAEA,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI,MAAM,cAAc,IAAI,yBAAyB;AAAA,IAC7D;AAEA,WAAO,MAAM,SAAS,KAAK;AAAA,EAC7B,SAAS,OAAY;AACnB,UAAM,IAAI,MAAM,4BAA4B,IAAI,MAAM,MAAM,OAAO,EAAE;AAAA,EACvE;AACF;;;AC7BO,SAAS,iBAAiB,SAAiB,QAAyB;AACzE,MAAI,cAAc;AAElB,QAAM,WAAmC;AAAA,IACvC,mBAAmB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AAU;AAC9B,UAAQ,IAAIA,OAAM,KAAK,2BAA2B,CAAC;AAEnD,UAAQ,IAAIA,OAAM,KAAK,uBAAkB,CAAC;AAC1C,UAAQ,IAAIA,OAAM,KAAK,wBAAmB,CAAC;AAC3C,UAAQ,IAAIA,OAAM,KAAK,yBAAoB,CAAC;AAE5C,UAAQ,IAAIA,OAAM,IAAI,oDAA0C,CAAC;AACnE;;;ANJA,IAAM,UAAU,IAAI,QAAQ;AAE5B,QACG,KAAK,SAAS,EACd,YAAY,2CAA2C,EACvD,QAAQ,OAAO;AAElB,QACG,QAAQ,MAAM,EACd,YAAY,uCAAuC,EACnD,OAAO,aAAa,2CAA2C,EAC/D,OAAO,IAAI;AAEd,QACG,QAAQ,KAAK,EACb,YAAY,iCAAiC,EAC7C,SAAS,mBAAmB,wBAAwB,EACpD,OAAO,aAAa,iDAAiD,EACrE,OAAO,mBAAmB,0BAA0B,EACpD,OAAO,aAAa,8BAA8B,EAClD,OAAO,sBAAsB,4CAA4C,EACzE,OAAO,GAAG;AAEb,QACG,QAAQ,SAAS,EACjB,YAAY,0BAA0B,EACtC,OAAO,OAAO;AAEjB,QAAQ,MAAM;","names":["path","fs","path","fs","chalk","ora","prompts","path","fs","execa","detectPackageManager","chalk"]}
1
+ {"version":3,"sources":["../src/index.ts","../src/commands/add.ts","../src/utils/registry.ts","../src/utils/transformer.ts","../src/utils/package-manager.ts","../src/utils/component-checker.ts","../src/utils/project-structure.ts","../src/commands/init.ts","../src/commands/credits.ts","../src/commands/diff.ts","../src/commands/update.ts","../src/commands/list.ts","../src/commands/debug.ts"],"sourcesContent":["#!/usr/bin/env node\r\nimport { Command } from \"commander\";\r\nimport { add } from \"./commands/add.js\";\r\nimport { init } from \"./commands/init.js\";\r\nimport { credits } from \"./commands/credits.js\";\r\nimport { diff } from \"./commands/diff.js\";\r\nimport { update } from \"./commands/update.js\";\r\nimport { list } from \"./commands/list.js\";\r\nimport { debug } from \"./commands/debug.js\";\r\nimport { readFileSync } from \"fs\";\r\nimport { fileURLToPath } from \"url\";\r\nimport { dirname, join } from \"path\";\r\n\r\nconst __filename = fileURLToPath(import.meta.url);\r\nconst __dirname = dirname(__filename);\r\nconst packageJson = JSON.parse(\r\n readFileSync(join(__dirname, \"../package.json\"), \"utf-8\")\r\n);\r\n\r\nconst program = new Command();\r\n\r\nprogram\r\n .name(\"pittaya\")\r\n .description(\"Add Pittaya UI components to your project\")\r\n .version(packageJson.version);\r\n\r\nprogram\r\n .command(\"init\")\r\n .description(\"Initialize Pittaya UI in your project\")\r\n .option(\"-y, --yes\", \"Skip confirmations and use default values\")\r\n .action(init);\r\n\r\nprogram\r\n .command(\"add\")\r\n .description(\"Add a component to your project\")\r\n .argument(\"[components...]\", \"Component names to add\")\r\n .option(\"-y, --yes\", \"Skip confirmations and overwrite existing files\")\r\n .option(\"-o, --overwrite\", \"Overwrite existing files\")\r\n .option(\"-a, --all\", \"Add all available components\")\r\n .option(\"--add-missing-deps\", \"Automatically install missing dependencies\")\r\n .action(add);\r\n\r\nprogram\r\n .command(\"diff\")\r\n .description(\"Check for component updates\")\r\n .argument(\"[components...]\", \"Component names to check (leave empty for interactive mode)\")\r\n .option(\"-a, --all\", \"Check all installed components\")\r\n .action(diff);\r\n\r\nprogram\r\n .command(\"update\")\r\n .description(\"Update components to latest version\")\r\n .argument(\"[components...]\", \"Component names to update (leave empty for interactive mode)\")\r\n .option(\"-a, --all\", \"Update all installed components\")\r\n .option(\"-y, --yes\", \"Skip confirmation prompts\")\r\n .option(\"-f, --force\", \"Force update even if no changes detected\")\r\n .action(update);\r\n\r\nprogram\r\n .command(\"list\")\r\n .description(\"List available and installed components\")\r\n .option(\"--installed\", \"Show only installed components\")\r\n .option(\"--available\", \"Show only available components\")\r\n .option(\"--json\", \"Output in JSON format\")\r\n .action(list);\r\n\r\nprogram\r\n .command(\"credits\")\r\n .description(\"Show Pittaya UI creators\")\r\n .action(credits);\r\n\r\nprogram\r\n .command(\"debug\")\r\n .description(\"Debug component installation issues\")\r\n .option(\"-c, --component <name>\", \"Component name to debug\")\r\n .action(debug);\r\n\r\nprogram.parse();\r\n\r\n","import chalk from \"chalk\";\nimport ora from \"ora\";\nimport prompts from \"prompts\";\nimport path from \"path\";\nimport fs from \"fs/promises\";\nimport { execa } from \"execa\";\nimport { fetchRegistry, getRegistryComponent } from \"../utils/registry.js\";\nimport { transformImports } from \"../utils/transformer.js\";\nimport { detectPackageManager, checkMissingDependencies } from \"../utils/package-manager.js\";\nimport { isComponentInstalled, resolveTargetPath } from \"../utils/component-checker.js\";\nimport { IAddOptions } from \"../interfaces/IAddOptions\";\nimport { IConfig } from \"../interfaces/IConfig\";\nimport { IRegistryComponent } from \"../interfaces/IRegistryComponent\";\n\nexport async function add(components: string[], options: IAddOptions) {\n const cwd = process.cwd();\n const componentsJsonPath = path.join(cwd, \"components.json\");\n\n let config: IConfig;\n try {\n const configContent = await fs.readFile(componentsJsonPath, \"utf-8\");\n config = JSON.parse(configContent);\n } catch (error) {\n console.log(chalk.red(\"\\n❌ components.json not found.\\n\"));\n console.log(\n chalk.dim(`Run ${chalk.bold(\"npx pittaya init\")} first.\\n`)\n );\n return;\n }\n\n const spinner = ora(\"Fetching available components...\").start();\n let registry;\n try {\n registry = await fetchRegistry();\n spinner.succeed(\"Registry loaded!\");\n } catch (error) {\n spinner.fail(\"Error loading registry\");\n console.error(error);\n return;\n }\n\n if (options.all) {\n components = registry.components\n .filter((comp: any) => comp.type === \"registry:ui\")\n .map((comp: any) => comp.name);\n }\n\n if (components.length === 0) {\n const availableComponents = registry.components\n .filter((comp: any) => comp.type === \"registry:ui\")\n .map((comp: any) => ({\n title: `${comp.name}${comp.description ? ` - ${comp.description}` : \"\"}`,\n value: comp.name,\n }));\n\n const { selected } = await prompts({\n type: \"multiselect\",\n name: \"selected\",\n message: \"Select components to add:\",\n choices: availableComponents,\n min: 1,\n });\n\n if (!selected || selected.length === 0) {\n console.log(chalk.yellow(\"\\n❌ No components selected.\\n\"));\n return;\n }\n\n components = selected;\n }\n\n console.log(\n chalk.dim(`\\nAdding ${components.length} component(s)...\\n`)\n );\n\n for (const componentName of components) {\n await addComponent(componentName, config, options);\n }\n\n console.log(chalk.green(\"\\nβœ… Components added successfully!\\n\"));\n}\n\nasync function addComponent(\n name: string,\n config: IConfig,\n options: IAddOptions\n) {\n const alreadyInstalled = await isComponentInstalled(name, config);\n if (alreadyInstalled && !options.overwrite) {\n console.log(chalk.dim(` ⏭️ ${name} already installed, skipping...`));\n return;\n }\n\n const spinner = ora(`Installing ${chalk.bold(name)}...`).start();\n\n try {\n const component: IRegistryComponent = await getRegistryComponent(name);\n\n if (!component) {\n spinner.fail(`Component \"${name}\" not found in registry.`);\n return;\n }\n\n const packageManager = await detectPackageManager();\n\n if (component.dependencies && component.dependencies.length > 0) {\n const missingDeps = await checkMissingDependencies(component.dependencies);\n\n if (missingDeps.length > 0) {\n spinner.stop();\n\n console.log(chalk.yellow(`\\n⚠️ ${name} requires the following dependencies:\\n`));\n missingDeps.forEach(dep => {\n console.log(chalk.dim(` β€’ ${dep}`));\n });\n console.log();\n\n // If --add-missing-deps was passed, install automatically\n if (options.addMissingDeps) {\n console.log(chalk.dim(\"Installing dependencies automatically...\\n\"));\n } else {\n const { install } = await prompts({\n type: \"confirm\",\n name: \"install\",\n message: \"Do you want to install the dependencies now?\",\n initial: true,\n });\n\n if (!install) {\n console.log(chalk.yellow(\"\\n⚠️ Component not installed. Install the dependencies manually and try again.\\n\"));\n return;\n }\n }\n\n spinner.start(`Installing dependencies for ${name}...`);\n\n try {\n await execa(packageManager, [\n packageManager === \"yarn\" ? \"add\" : \"install\",\n ...missingDeps,\n ]);\n spinner.succeed(`Dependencies installed!`);\n spinner.start(`Installing ${chalk.bold(name)}...`);\n } catch (error) {\n spinner.fail(`Error installing dependencies`);\n console.error(error);\n return;\n }\n }\n }\n\n if (component.registryDependencies && component.registryDependencies.length > 0) {\n spinner.stop();\n console.log(chalk.dim(`\\n πŸ“¦ ${name} requires: ${component.registryDependencies.join(\", \")}`));\n\n for (const dep of component.registryDependencies) {\n await addComponent(dep, config, { ...options, yes: true });\n }\n\n console.log(); // Linha em branco\n spinner.start(`Installing ${chalk.bold(name)}...`);\n }\n\n for (const file of component.files) {\n const targetPath = await resolveTargetPath(file.name, component.type, config);\n const filePath = path.join(process.cwd(), targetPath);\n\n const exists = await fs\n .access(filePath)\n .then(() => true)\n .catch(() => false);\n\n if (exists && !options.overwrite && !options.yes) {\n spinner.stop();\n const { overwrite } = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: `${targetPath} already exists. Overwrite?`,\n initial: false,\n });\n\n if (!overwrite) {\n spinner.warn(`Skipping ${targetPath}`);\n continue;\n }\n spinner.start();\n }\n\n await fs.mkdir(path.dirname(filePath), { recursive: true });\n\n const content = transformImports(file.content, config);\n\n await fs.writeFile(filePath, content, \"utf-8\");\n }\n\n spinner.succeed(`${chalk.bold(name)} installed successfully!`);\n } catch (error) {\n spinner.fail(`Error installing ${name}`);\n console.error(error);\n }\n}\n\n","import fetch from \"node-fetch\";\r\nimport { IRegistryComponent } from \"../interfaces/IRegistryComponent\";\r\n\r\nconst REGISTRY_BASE_URL = \"https://raw.githubusercontent.com/pittaya-ui/cli/main/registry\";\r\n\r\n\r\nexport async function fetchRegistry(): Promise<any> {\r\n try {\r\n const response = await fetch(`${REGISTRY_BASE_URL}/index.json`);\r\n if (!response.ok) {\r\n throw new Error(`HTTP ${response.status}: ${response.statusText}`);\r\n }\r\n return await response.json();\r\n } catch (error) {\r\n console.error(\"Error fetching registry:\", error);\r\n throw new Error(\"Unable to load the registry of components\");\r\n }\r\n}\r\n\r\nexport async function getRegistryComponent(name: string): Promise<IRegistryComponent> {\r\n try {\r\n const response = await fetch(\r\n `${REGISTRY_BASE_URL}/components/${name}.json`\r\n );\r\n\r\n if (!response.ok) {\r\n throw new Error(`Component \"${name}\" not found in registry`);\r\n }\r\n\r\n return await response.json() as IRegistryComponent;\r\n } catch (error: any) {\r\n throw new Error(`Error loading component \"${name}\": ${error.message}`);\r\n }\r\n}\r\n\r\nexport function setRegistryUrl(url: string) {\r\n process.env.PITTAYA_REGISTRY_URL = url;\r\n}\r\n\r\n","\r\n\r\nimport { IConfig } from \"../interfaces/IConfig\";\r\n\r\nexport function transformImports(content: string, config: IConfig): string {\r\n let transformed = content;\r\n\r\n const aliasMap: Record<string, string> = {\r\n \"@/components/ui\": config.aliases.ui,\r\n \"@/components\": config.aliases.components,\r\n \"@/lib/utils\": config.aliases.utils,\r\n \"@/lib\": config.aliases.lib,\r\n \"@/hooks\": config.aliases.hooks,\r\n };\r\n\r\n const sortedAliases = Object.entries(aliasMap).sort(\r\n ([a], [b]) => b.length - a.length\r\n );\r\n\r\n for (const [from, to] of sortedAliases) {\r\n if (from !== to) {\r\n transformed = transformed.replace(\r\n new RegExp(`from [\"']${escapeRegex(from)}`, \"g\"),\r\n `from \"${to}`\r\n );\r\n transformed = transformed.replace(\r\n new RegExp(`import [\"']${escapeRegex(from)}`, \"g\"),\r\n `import \"${to}`\r\n );\r\n }\r\n }\r\n\r\n return transformed;\r\n}\r\n\r\nfunction escapeRegex(str: string): string {\r\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\r\n}\r\n\r\n","import fs from \"fs/promises\";\r\nimport path from \"path\";\r\n\r\nexport async function detectPackageManager(): Promise<string> {\r\n try {\r\n await fs.access(\"pnpm-lock.yaml\");\r\n return \"pnpm\";\r\n } catch {}\r\n\r\n try {\r\n await fs.access(\"yarn.lock\");\r\n return \"yarn\";\r\n } catch {}\r\n\r\n try {\r\n await fs.access(\"bun.lockb\");\r\n return \"bun\";\r\n } catch {}\r\n\r\n return \"npm\";\r\n}\r\n\r\nexport async function isPackageInstalled(packageName: string): Promise<boolean> {\r\n const cwd = process.cwd();\r\n\r\n try {\r\n const packageJsonPath = path.join(cwd, \"package.json\");\r\n const packageJson = JSON.parse(await fs.readFile(packageJsonPath, \"utf-8\"));\r\n\r\n const allDeps = {\r\n ...packageJson.dependencies,\r\n ...packageJson.devDependencies,\r\n };\r\n\r\n if (allDeps[packageName]) {\r\n return true;\r\n }\r\n } catch {}\r\n\r\n try {\r\n const packagePath = path.join(cwd, \"node_modules\", packageName);\r\n await fs.access(packagePath);\r\n return true;\r\n } catch {}\r\n\r\n return false;\r\n}\r\n\r\nexport async function checkMissingDependencies(\r\n dependencies: string[]\r\n): Promise<string[]> {\r\n const missing: string[] = [];\r\n\r\n for (const dep of dependencies) {\r\n const installed = await isPackageInstalled(dep);\r\n if (!installed) {\r\n missing.push(dep);\r\n }\r\n }\r\n\r\n return missing;\r\n}\r\n\r\n","import path from \"path\";\r\nimport fs from \"fs/promises\";\r\nimport { getRegistryComponent } from \"./registry.js\";\r\nimport { IConfig } from \"../interfaces/IConfig.js\";\r\nimport { IRegistryComponent } from \"../interfaces/IRegistryComponent.js\";\r\nimport { resolveAliasPath } from \"./project-structure.js\";\r\n\r\n/**\r\n * Check if a component is installed in the project\r\n * @param name - The component name/slug\r\n * @param config - The project configuration from components.json\r\n * @returns true if all component files exist, false otherwise\r\n */\r\nexport async function isComponentInstalled(\r\n name: string,\r\n config: IConfig\r\n): Promise<boolean> {\r\n try {\r\n const component: IRegistryComponent = await getRegistryComponent(name);\r\n if (!component) return false;\r\n\r\n for (const file of component.files) {\r\n const targetPath = await resolveTargetPath(file.name, component.type, config);\r\n const filePath = path.join(process.cwd(), targetPath);\r\n\r\n const exists = await fs\r\n .access(filePath)\r\n .then(() => true)\r\n .catch(() => false);\r\n\r\n if (!exists) return false;\r\n }\r\n\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Resolve the target path for a component file based on its type\r\n * @param fileName - The file name\r\n * @param type - The component type (registry:ui, registry:lib, registry:hook)\r\n * @param config - The project configuration\r\n * @returns The resolved file path\r\n */\r\nexport async function resolveTargetPath(\r\n fileName: string,\r\n type: string,\r\n config: IConfig\r\n): Promise<string> {\r\n if (type === \"registry:ui\") {\r\n const resolvedPath = await resolveAliasPath(config.aliases.ui);\r\n return path.join(resolvedPath, fileName);\r\n }\r\n\r\n if (type === \"registry:lib\") {\r\n const resolvedPath = await resolveAliasPath(config.aliases.lib);\r\n return path.join(resolvedPath, fileName);\r\n }\r\n\r\n if (type === \"registry:hook\") {\r\n const resolvedPath = await resolveAliasPath(config.aliases.hooks);\r\n return path.join(resolvedPath, fileName);\r\n }\r\n\r\n return fileName;\r\n}\r\n\r\n","import fs from \"fs/promises\";\r\nimport path from \"path\";\r\n\r\n/**\r\n * Detects if the project uses a \"src/\" directory structure\r\n * by checking for common Next.js directories inside src/\r\n *\r\n * @param cwd - Current working directory (defaults to process.cwd())\r\n * @returns true if project uses src/, false if root structure\r\n */\r\nexport async function hasSrcDirectory(cwd: string = process.cwd()): Promise<boolean> {\r\n try {\r\n // Check if src/ exists\r\n const srcPath = path.join(cwd, \"src\");\r\n await fs.access(srcPath);\r\n\r\n // Verify it's actually being used by checking for common Next.js directories\r\n const commonDirs = [\"app\", \"components\", \"lib\", \"pages\"];\r\n\r\n for (const dir of commonDirs) {\r\n try {\r\n await fs.access(path.join(srcPath, dir));\r\n return true; // Found at least one common directory inside src/\r\n } catch {\r\n continue;\r\n }\r\n }\r\n\r\n try {\r\n const tsconfigPath = path.join(cwd, \"tsconfig.json\");\r\n const tsconfig = JSON.parse(await fs.readFile(tsconfigPath, \"utf-8\"));\r\n\r\n if (tsconfig.compilerOptions?.paths) {\r\n const paths = tsconfig.compilerOptions.paths;\r\n if (paths[\"@/*\"]?.includes(\"./src/*\")) {\r\n return true;\r\n }\r\n }\r\n } catch {\r\n console.error(\"Bro... just in 21st century you not even have a tsconfig.json file in your project. That way you fuck me up :D\");\r\n }\r\n\r\n return false;\r\n } catch {\r\n // Only pretend to be crazy and continue\r\n return false;\r\n }\r\n}\r\n\r\n/**\r\n * Resolves an alias path to an actual file system path\r\n * @param aliasPath - Path with alias (e.g., \"@/components/ui\")\r\n * @param cwd - Current working directory\r\n * @returns Resolved file system path (e.g., \"src/components/ui\" or \"components/ui\")\r\n */\r\nexport async function resolveAliasPath(\r\n aliasPath: string,\r\n cwd: string = process.cwd()\r\n): Promise<string> {\r\n const usesSrc = await hasSrcDirectory(cwd);\r\n const baseDir = usesSrc ? \"src/\" : \"\";\r\n\r\n // Remove @/ prefix and prepend base directory\r\n return aliasPath.replace(/^@\\//, baseDir);\r\n}\r\n\r\n/**\r\n * Gets the default paths configuration based on project structure\r\n * This was necessary due to the fact that the user may not have a src/ directory or a tsconfig.json file.\r\n * @param cwd - Current working directory\r\n * @returns Object with default paths for globals.css, components, utils, etc.\r\n */\r\nexport async function getDefaultPaths(cwd: string = process.cwd()) {\r\n const usesSrc = await hasSrcDirectory(cwd);\r\n const baseDir = usesSrc ? \"src/\" : \"\";\r\n\r\n return {\r\n globalsCss: `${baseDir}app/globals.css`,\r\n components: \"@/components\",\r\n utils: \"@/lib/utils\",\r\n ui: \"@/components/ui\",\r\n lib: \"@/lib\",\r\n hooks: \"@/hooks\",\r\n baseDir,\r\n };\r\n}\r\n\r\n","import chalk from \"chalk\";\nimport ora from \"ora\";\nimport prompts from \"prompts\";\nimport path from \"path\";\nimport fs from \"fs/promises\";\nimport { execa } from \"execa\";\nimport { getDefaultPaths } from \"../utils/project-structure.js\";\n\ninterface InitOptions {\n yes?: boolean;\n}\n\nexport async function init(options: InitOptions) {\n console.log(chalk.bold(\"\\nWelcome to Pittaya UI!\\n\"));\n\n const cwd = process.cwd();\n const componentsJsonPath = path.join(cwd, \"components.json\");\n\n const exists = await fs\n .access(componentsJsonPath)\n .then(() => true)\n .catch(() => false);\n\n if (exists && !options.yes) {\n const { overwrite } = await prompts({\n type: \"confirm\",\n name: \"overwrite\",\n message: \"components.json already exists. Do you want to overwrite it?\",\n initial: false,\n });\n\n if (!overwrite) {\n console.log(chalk.yellow(\"\\n❌ Operation cancelled.\\n\"));\n return;\n }\n }\n\n const defaultPaths = await getDefaultPaths(cwd);\n\n const config = options.yes\n ? {\n style: \"new-york\",\n tailwindCss: defaultPaths.globalsCss,\n rsc: true,\n componentsPath: defaultPaths.components,\n utilsPath: defaultPaths.utils,\n }\n : await prompts([\n {\n type: \"select\",\n name: \"style\",\n message: \"Which style would you like to use?\",\n choices: [\n { title: \"New York\", value: \"new-york\" },\n { title: \"Default\", value: \"default\" },\n { title: \"Recife\", value: \"recife\" },\n ],\n },\n {\n type: \"text\",\n name: \"tailwindCss\",\n message: \"Where is your globals.css file?\",\n initial: defaultPaths.globalsCss,\n },\n {\n type: \"confirm\",\n name: \"rsc\",\n message: \"Use React Server Components?\",\n initial: true,\n },\n {\n type: \"text\",\n name: \"componentsPath\",\n message: \"Path for components?\",\n initial: defaultPaths.components,\n },\n {\n type: \"text\",\n name: \"utilsPath\",\n message: \"Path for utils?\",\n initial: defaultPaths.utils,\n },\n ]);\n\n if (!config.style && !options.yes) {\n console.log(chalk.yellow(\"\\n❌ Operation cancelled.\\n\"));\n return;\n }\n\n const componentsJson = {\n $schema: \"https://raw.githubusercontent.com/pittaya-ui/cli/main/registry/schema.json\",\n style: config.style || \"new-york\",\n rsc: config.rsc ?? true,\n tsx: true,\n tailwind: {\n config: \"tailwind.config.ts\",\n css: config.tailwindCss || \"src/app/globals.css\",\n baseColor: \"neutral\",\n cssVariables: true,\n prefix: \"\",\n },\n aliases: {\n components: config.componentsPath || \"@/components\",\n utils: config.utilsPath || \"@/lib/utils\",\n ui: `${config.componentsPath || \"@/components\"}/pittaya/ui`,\n lib: \"@/lib\",\n hooks: \"@/hooks\",\n },\n iconLibrary: \"lucide\",\n };\n\n const spinner = ora(\"Creating components.json...\").start();\n await fs.writeFile(\n componentsJsonPath,\n JSON.stringify(componentsJson, null, 2)\n );\n spinner.succeed(\"components.json created successfully!\");\n\n const packageManager = await detectPackageManager();\n\n const depsSpinner = ora(\"Installing base dependencies...\").start();\n try {\n await execa(packageManager, [\n packageManager === \"yarn\" ? \"add\" : \"install\",\n \"class-variance-authority\",\n \"clsx\",\n \"tailwind-merge\",\n ]);\n depsSpinner.succeed(\"Dependencies installed!\");\n } catch (error) {\n depsSpinner.fail(\"Error installing dependencies\");\n console.error(error);\n }\n\n console.log(chalk.green(\"\\nβœ… Pittaya UI configured successfully!\\n\"));\n console.log(chalk.dim(\"Next steps:\"));\n console.log(\n chalk.dim(\n ` ${chalk.bold(\"npx pittaya add button\")} - Add a component`\n )\n );\n console.log(\n chalk.dim(\n ` ${chalk.bold(\"npx pittaya add --all\")} - Add all components\\n`\n )\n );\n}\n\nasync function detectPackageManager(): Promise<string> {\n try {\n await fs.access(\"pnpm-lock.yaml\");\n return \"pnpm\";\n } catch {}\n\n try {\n await fs.access(\"yarn.lock\");\n return \"yarn\";\n } catch {}\n\n return \"npm\";\n}\n\n","import chalk from \"chalk\";\r\n\r\nexport async function credits() {\r\n console.log(chalk.bold(\"\\nPittaya UI - Creators\\n\"));\r\n\r\n console.log(chalk.cyan(\" β€’ Marcos Bueno\"));\r\n console.log(chalk.cyan(\" β€’ Lucas Ribeiro\"));\r\n console.log(chalk.cyan(\" β€’ Jarbas Gouveia\"));\r\n\r\n console.log(chalk.dim(\"\\n Thank you for using Pittaya UI! ❀️\\n\"));\r\n}\r\n\r\n","import chalk from \"chalk\";\r\nimport ora from \"ora\";\r\nimport prompts from \"prompts\";\r\nimport path from \"path\";\r\nimport fs from \"fs/promises\";\r\nimport { fetchRegistry, getRegistryComponent } from \"../utils/registry.js\";\r\nimport { transformImports } from \"../utils/transformer.js\";\r\nimport { isComponentInstalled, resolveTargetPath } from \"../utils/component-checker.js\";\r\nimport { IConfig } from \"../interfaces/IConfig\";\r\nimport { IRegistryComponent } from \"../interfaces/IRegistryComponent\";\r\n\r\ninterface DiffOptions {\r\n all?: boolean;\r\n}\r\n\r\ninterface ComponentDiff {\r\n name: string;\r\n hasChanges: boolean;\r\n files: FileDiff[];\r\n isInstalled: boolean;\r\n}\r\n\r\ninterface FileDiff {\r\n name: string;\r\n hasChanges: boolean;\r\n isNew: boolean;\r\n isMissing: boolean;\r\n}\r\n\r\nexport async function diff(components: string[], options: DiffOptions) {\r\n const cwd = process.cwd();\r\n const componentsJsonPath = path.join(cwd, \"components.json\");\r\n\r\n let config: IConfig;\r\n try {\r\n const configContent = await fs.readFile(componentsJsonPath, \"utf-8\");\r\n config = JSON.parse(configContent);\r\n } catch (error) {\r\n console.log(chalk.red(\"\\n❌ components.json not found.\\n\"));\r\n console.log(\r\n chalk.dim(`Run ${chalk.bold(\"npx pittaya init\")} first.\\n`)\r\n );\r\n return;\r\n }\r\n\r\n const spinner = ora(\"Fetching registry...\").start();\r\n let registry;\r\n try {\r\n registry = await fetchRegistry();\r\n spinner.succeed(\"Registry loaded!\");\r\n } catch (error) {\r\n spinner.fail(\"Error loading registry\");\r\n console.error(error);\r\n return;\r\n }\r\n\r\n let componentsToCheck: string[] = [];\r\n\r\n if (options.all) {\r\n // Check all installed components\r\n const allComponents = registry.components\r\n .filter((comp: any) => comp.type === \"registry:ui\" || comp.type === \"registry:lib\")\r\n .map((comp: any) => comp.name);\r\n\r\n for (const comp of allComponents) {\r\n const isInstalled = await isComponentInstalled(comp, config);\r\n if (isInstalled) {\r\n componentsToCheck.push(comp);\r\n }\r\n }\r\n\r\n if (componentsToCheck.length === 0) {\r\n console.log(chalk.yellow(\"\\n⚠️ No components installed yet.\\n\"));\r\n return;\r\n }\r\n } else if (components.length === 0) {\r\n // Interactive mode - show only installed components\r\n const allComponents = registry.components\r\n .filter((comp: any) => comp.type === \"registry:ui\" || comp.type === \"registry:lib\")\r\n .map((comp: any) => comp.name);\r\n\r\n const installedComponents = [];\r\n for (const comp of allComponents) {\r\n const isInstalled = await isComponentInstalled(comp, config);\r\n if (isInstalled) {\r\n installedComponents.push(comp);\r\n }\r\n }\r\n\r\n if (installedComponents.length === 0) {\r\n console.log(chalk.yellow(\"\\n⚠️ No components installed yet.\\n\"));\r\n return;\r\n }\r\n\r\n const { selected } = await prompts({\r\n type: \"multiselect\",\r\n name: \"selected\",\r\n message: \"Select components to check for updates:\",\r\n choices: installedComponents.map(name => ({\r\n title: name,\r\n value: name,\r\n })),\r\n min: 1,\r\n });\r\n\r\n if (!selected || selected.length === 0) {\r\n console.log(chalk.yellow(\"\\n❌ No components selected.\\n\"));\r\n return;\r\n }\r\n\r\n componentsToCheck = selected;\r\n } else {\r\n componentsToCheck = components;\r\n }\r\n\r\n console.log(chalk.dim(`\\nChecking ${componentsToCheck.length} component(s)...\\n`));\r\n\r\n const results: ComponentDiff[] = [];\r\n\r\n for (const componentName of componentsToCheck) {\r\n const diffResult = await checkComponentDiff(componentName, config);\r\n if (diffResult) {\r\n results.push(diffResult);\r\n }\r\n }\r\n\r\n // Display results\r\n displayDiffResults(results);\r\n}\r\n\r\nasync function checkComponentDiff(\r\n name: string,\r\n config: IConfig\r\n): Promise<ComponentDiff | null> {\r\n try {\r\n const component: IRegistryComponent = await getRegistryComponent(name);\r\n if (!component) {\r\n console.log(chalk.red(` ❌ Component \"${name}\" not found in registry.`));\r\n return null;\r\n }\r\n\r\n const isInstalled = await isComponentInstalled(name, config);\r\n if (!isInstalled) {\r\n console.log(chalk.dim(` ⏭️ ${name} is not installed, skipping...`));\r\n return null;\r\n }\r\n\r\n const fileDiffs: FileDiff[] = [];\r\n let hasChanges = false;\r\n\r\n for (const file of component.files) {\r\n const targetPath = await resolveTargetPath(file.name, component.type, config);\r\n const filePath = path.join(process.cwd(), targetPath);\r\n\r\n try {\r\n const localContent = await fs.readFile(filePath, \"utf-8\");\r\n const registryContent = transformImports(file.content, config);\r\n\r\n const contentMatches = localContent.trim() === registryContent.trim();\r\n\r\n fileDiffs.push({\r\n name: file.name,\r\n hasChanges: !contentMatches,\r\n isNew: false,\r\n isMissing: false,\r\n });\r\n\r\n if (!contentMatches) {\r\n hasChanges = true;\r\n }\r\n } catch (error) {\r\n // File exists check passed but can't read - treat as missing\r\n fileDiffs.push({\r\n name: file.name,\r\n hasChanges: true,\r\n isNew: false,\r\n isMissing: true,\r\n });\r\n hasChanges = true;\r\n }\r\n }\r\n\r\n return {\r\n name,\r\n hasChanges,\r\n files: fileDiffs,\r\n isInstalled: true,\r\n };\r\n } catch (error) {\r\n console.log(chalk.red(` ❌ Error checking ${name}`));\r\n console.error(error);\r\n return null;\r\n }\r\n}\r\n\r\nfunction displayDiffResults(results: ComponentDiff[]) {\r\n const componentsWithChanges = results.filter((r) => r.hasChanges);\r\n const componentsUpToDate = results.filter((r) => !r.hasChanges);\r\n\r\n console.log();\r\n\r\n if (componentsWithChanges.length > 0) {\r\n console.log(chalk.yellow(`πŸ“ Components with updates available (${componentsWithChanges.length}):\\n`));\r\n\r\n for (const result of componentsWithChanges) {\r\n console.log(chalk.yellow(` β€’ ${chalk.bold(result.name)}`));\r\n\r\n for (const file of result.files) {\r\n if (file.hasChanges) {\r\n if (file.isMissing) {\r\n console.log(chalk.red(` └─ ${file.name} (missing locally)`));\r\n } else {\r\n console.log(chalk.dim(` └─ ${file.name} (modified)`));\r\n }\r\n }\r\n }\r\n }\r\n console.log();\r\n console.log(chalk.dim(`Run ${chalk.bold(\"npx pittaya update <component>\")} to update.`));\r\n }\r\n\r\n if (componentsUpToDate.length > 0) {\r\n console.log(chalk.green(`\\nβœ… Components up to date (${componentsUpToDate.length}):\\n`));\r\n\r\n for (const result of componentsUpToDate) {\r\n console.log(chalk.dim(` β€’ ${result.name}`));\r\n }\r\n }\r\n\r\n console.log();\r\n}\r\n\r\n","import chalk from \"chalk\";\r\nimport ora from \"ora\";\r\nimport prompts from \"prompts\";\r\nimport path from \"path\";\r\nimport fs from \"fs/promises\";\r\nimport { fetchRegistry, getRegistryComponent } from \"../utils/registry.js\";\r\nimport { transformImports } from \"../utils/transformer.js\";\r\nimport { isComponentInstalled, resolveTargetPath } from \"../utils/component-checker.js\";\r\nimport { IConfig } from \"../interfaces/IConfig\";\r\nimport { IRegistryComponent } from \"../interfaces/IRegistryComponent\";\r\n\r\ninterface UpdateOptions {\r\n all?: boolean;\r\n yes?: boolean;\r\n force?: boolean;\r\n}\r\n\r\ninterface UpdateResult {\r\n name: string;\r\n updated: boolean;\r\n skipped: boolean;\r\n reason?: string;\r\n}\r\n\r\nexport async function update(components: string[], options: UpdateOptions) {\r\n const cwd = process.cwd();\r\n const componentsJsonPath = path.join(cwd, \"components.json\");\r\n\r\n let config: IConfig;\r\n try {\r\n const configContent = await fs.readFile(componentsJsonPath, \"utf-8\");\r\n config = JSON.parse(configContent);\r\n } catch (error) {\r\n console.log(chalk.red(\"\\n❌ components.json not found.\\n\"));\r\n console.log(\r\n chalk.dim(`Run ${chalk.bold(\"npx pittaya init\")} first.\\n`)\r\n );\r\n return;\r\n }\r\n\r\n const spinner = ora(\"Fetching registry...\").start();\r\n let registry;\r\n try {\r\n registry = await fetchRegistry();\r\n spinner.succeed(\"Registry loaded!\");\r\n } catch (error) {\r\n spinner.fail(\"Error loading registry\");\r\n console.error(error);\r\n return;\r\n }\r\n\r\n let componentsToUpdate: string[] = [];\r\n\r\n if (options.all) {\r\n // Update all installed components\r\n const allComponents = registry.components\r\n .filter((comp: any) => comp.type === \"registry:ui\" || comp.type === \"registry:lib\")\r\n .map((comp: any) => comp.name);\r\n\r\n for (const comp of allComponents) {\r\n const isInstalled = await isComponentInstalled(comp, config);\r\n if (isInstalled) {\r\n componentsToUpdate.push(comp);\r\n }\r\n }\r\n\r\n if (componentsToUpdate.length === 0) {\r\n console.log(chalk.yellow(\"\\n⚠️ No components installed yet.\\n\"));\r\n return;\r\n }\r\n\r\n if (!options.yes && !options.force) {\r\n const { confirm } = await prompts({\r\n type: \"confirm\",\r\n name: \"confirm\",\r\n message: `Update ${componentsToUpdate.length} component(s)?`,\r\n initial: true,\r\n });\r\n\r\n if (!confirm) {\r\n console.log(chalk.yellow(\"\\n❌ Update cancelled.\\n\"));\r\n return;\r\n }\r\n }\r\n } else if (components.length === 0) {\r\n // Interactive mode - show only installed components with updates\r\n const allComponents = registry.components\r\n .filter((comp: any) => comp.type === \"registry:ui\" || comp.type === \"registry:lib\")\r\n .map((comp: any) => comp.name);\r\n\r\n const installedComponents = [];\r\n for (const comp of allComponents) {\r\n const isInstalled = await isComponentInstalled(comp, config);\r\n if (isInstalled) {\r\n installedComponents.push(comp);\r\n }\r\n }\r\n\r\n if (installedComponents.length === 0) {\r\n console.log(chalk.yellow(\"\\n⚠️ No components installed yet.\\n\"));\r\n return;\r\n }\r\n\r\n const { selected } = await prompts({\r\n type: \"multiselect\",\r\n name: \"selected\",\r\n message: \"Select components to update:\",\r\n choices: installedComponents.map(name => ({\r\n title: name,\r\n value: name,\r\n })),\r\n min: 1,\r\n });\r\n\r\n if (!selected || selected.length === 0) {\r\n console.log(chalk.yellow(\"\\n❌ No components selected.\\n\"));\r\n return;\r\n }\r\n\r\n componentsToUpdate = selected;\r\n } else {\r\n componentsToUpdate = components;\r\n }\r\n\r\n console.log(chalk.dim(`\\nChecking ${componentsToUpdate.length} component(s) for updates...\\n`));\r\n\r\n const results: UpdateResult[] = [];\r\n\r\n for (const componentName of componentsToUpdate) {\r\n const result = await updateComponent(componentName, config, options);\r\n results.push(result);\r\n }\r\n\r\n // Display results\r\n displayUpdateResults(results);\r\n}\r\n\r\nasync function hasComponentChanges(\r\n component: IRegistryComponent,\r\n config: IConfig\r\n): Promise<boolean> {\r\n for (const file of component.files) {\r\n const targetPath = await resolveTargetPath(file.name, component.type, config);\r\n const filePath = path.join(process.cwd(), targetPath);\r\n\r\n try {\r\n const localContent = await fs.readFile(filePath, \"utf-8\");\r\n const registryContent = transformImports(file.content, config);\r\n\r\n if (localContent.trim() !== registryContent.trim()) {\r\n return true;\r\n }\r\n } catch {\r\n // If we can't read the file, consider it as having changes\r\n return true;\r\n }\r\n }\r\n\r\n return false;\r\n}\r\n\r\nasync function updateComponent(\r\n name: string,\r\n config: IConfig,\r\n options: UpdateOptions\r\n): Promise<UpdateResult> {\r\n try {\r\n const component: IRegistryComponent = await getRegistryComponent(name);\r\n if (!component) {\r\n console.log(chalk.red(` ❌ Component \"${name}\" not found in registry.`));\r\n return { name, updated: false, skipped: true, reason: \"not found in registry\" };\r\n }\r\n\r\n const isInstalled = await isComponentInstalled(name, config);\r\n if (!isInstalled) {\r\n console.log(chalk.dim(` ⏭️ ${name} is not installed, skipping...`));\r\n return { name, updated: false, skipped: true, reason: \"not installed\" };\r\n }\r\n\r\n // Check if there are changes\r\n const hasChanges = await hasComponentChanges(component, config);\r\n\r\n if (!hasChanges && !options.force) {\r\n console.log(chalk.dim(` βœ“ ${name} is already up to date`));\r\n return { name, updated: false, skipped: true, reason: \"already up to date\" };\r\n }\r\n\r\n // Ask for confirmation if not --yes or --force\r\n if (!options.yes && !options.force) {\r\n const { confirm } = await prompts({\r\n type: \"confirm\",\r\n name: \"confirm\",\r\n message: `Update ${chalk.bold(name)}?`,\r\n initial: true,\r\n });\r\n\r\n if (!confirm) {\r\n console.log(chalk.yellow(` ⏭️ Skipped ${name}`));\r\n return { name, updated: false, skipped: true, reason: \"user cancelled\" };\r\n }\r\n }\r\n\r\n const spinner = ora(`Updating ${chalk.bold(name)}...`).start();\r\n\r\n // Update files\r\n for (const file of component.files) {\r\n const targetPath = await resolveTargetPath(file.name, component.type, config);\r\n const filePath = path.join(process.cwd(), targetPath);\r\n\r\n await fs.mkdir(path.dirname(filePath), { recursive: true });\r\n\r\n const content = transformImports(file.content, config);\r\n await fs.writeFile(filePath, content, \"utf-8\");\r\n }\r\n\r\n spinner.succeed(`${chalk.bold(name)} updated successfully!`);\r\n return { name, updated: true, skipped: false };\r\n } catch (error) {\r\n console.log(chalk.red(` ❌ Error updating ${name}`));\r\n console.error(error);\r\n return { name, updated: false, skipped: true, reason: \"error\" };\r\n }\r\n}\r\n\r\nfunction displayUpdateResults(results: UpdateResult[]) {\r\n const updated = results.filter((r) => r.updated);\r\n const skipped = results.filter((r) => r.skipped);\r\n\r\n console.log();\r\n\r\n if (updated.length > 0) {\r\n console.log(chalk.green(`βœ… Updated ${updated.length} component(s):\\n`));\r\n for (const result of updated) {\r\n console.log(chalk.dim(` β€’ ${result.name}`));\r\n }\r\n }\r\n\r\n if (skipped.length > 0) {\r\n console.log(chalk.yellow(`\\n⏭️ Skipped ${skipped.length} component(s):\\n`));\r\n for (const result of skipped) {\r\n const reason = result.reason ? ` (${result.reason})` : \"\";\r\n console.log(chalk.dim(` β€’ ${result.name}${reason}`));\r\n }\r\n }\r\n\r\n console.log();\r\n}\r\n\r\n","import chalk from \"chalk\";\r\nimport ora from \"ora\";\r\nimport path from \"path\";\r\nimport fs from \"fs/promises\";\r\nimport { fetchRegistry } from \"../utils/registry.js\";\r\nimport { isComponentInstalled } from \"../utils/component-checker.js\";\r\nimport { IConfig } from \"../interfaces/IConfig.js\";\r\nimport { IComponentIndexItem } from \"../interfaces/IComponentIndexItem.js\";\r\n\r\ninterface ListOptions {\r\n installed?: boolean;\r\n available?: boolean;\r\n json?: boolean;\r\n}\r\n\r\ninterface ComponentInfo extends IComponentIndexItem {\r\n installed: boolean;\r\n version?: string;\r\n}\r\n\r\nexport async function list(options: ListOptions) {\r\n const cwd = process.cwd();\r\n const componentsJsonPath = path.join(cwd, \"components.json\");\r\n\r\n let config: IConfig;\r\n try {\r\n const configContent = await fs.readFile(componentsJsonPath, \"utf-8\");\r\n config = JSON.parse(configContent);\r\n } catch (error) {\r\n console.log(chalk.red(\"\\n❌ components.json not found.\\n\"));\r\n console.log(\r\n chalk.dim(`Run ${chalk.bold(\"npx pittaya init\")} first.\\n`)\r\n );\r\n return;\r\n }\r\n\r\n const spinner = ora(\"Fetching components...\").start();\r\n let registry;\r\n try {\r\n registry = await fetchRegistry();\r\n spinner.succeed(\"Components loaded!\");\r\n } catch (error) {\r\n spinner.fail(\"Error loading registry\");\r\n console.error(error);\r\n return;\r\n }\r\n\r\n const allComponents: IComponentIndexItem[] = registry.components || [];\r\n\r\n // Check installation status for each component\r\n const componentsWithStatus: ComponentInfo[] = await Promise.all(\r\n allComponents.map(async (comp) => {\r\n const installed = await isComponentInstalled(comp.slug, config);\r\n return {\r\n ...comp,\r\n installed,\r\n };\r\n })\r\n );\r\n\r\n let filteredComponents = componentsWithStatus;\r\n\r\n if (options.installed) {\r\n filteredComponents = componentsWithStatus.filter(comp => comp.installed);\r\n } else if (options.available) {\r\n filteredComponents = componentsWithStatus.filter(comp => !comp.installed);\r\n }\r\n\r\n\r\n if (options.json) {\r\n console.log(JSON.stringify(filteredComponents, null, 2));\r\n return;\r\n }\r\n\r\n\r\n displayComponents(filteredComponents, options);\r\n}\r\n\r\nfunction displayComponents(components: ComponentInfo[], options: ListOptions) {\r\n if (components.length === 0) {\r\n if (options.installed) {\r\n console.log(chalk.yellow(\"\\nπŸ“¦ No components installed yet.\\n\"));\r\n console.log(chalk.dim(`Run ${chalk.bold(\"npx pittaya add\")} to install components.\\n`));\r\n } else if (options.available) {\r\n console.log(chalk.yellow(\"\\n✨ All components are already installed!\\n\"));\r\n } else {\r\n console.log(chalk.yellow(\"\\n⚠️ No components found in registry.\\n\"));\r\n }\r\n return;\r\n }\r\n\r\n\r\n const categorized = components.reduce((acc, comp) => {\r\n const category = comp.category || \"Other\";\r\n if (!acc[category]) {\r\n acc[category] = [];\r\n }\r\n acc[category].push(comp);\r\n return acc;\r\n }, {} as Record<string, ComponentInfo[]>);\r\n\r\n console.log(\"\\n\");\r\n\r\n\r\n if (options.installed) {\r\n console.log(chalk.bold.green(\"πŸ“¦ Installed Components\\n\"));\r\n } else if (options.available) {\r\n console.log(chalk.bold.blue(\"✨ Available Components\\n\"));\r\n } else {\r\n console.log(chalk.bold(\"πŸ“‹ All Components\\n\"));\r\n }\r\n\r\n Object.entries(categorized).sort().forEach(([category, comps]) => {\r\n console.log(chalk.bold.cyan(`${category}:`));\r\n\r\n comps.forEach(comp => {\r\n const status = comp.installed\r\n ? chalk.green(\"βœ“\")\r\n : chalk.dim(\"β—‹\");\r\n\r\n const name = comp.installed\r\n ? chalk.bold(comp.slug)\r\n : chalk.dim(comp.slug);\r\n\r\n const description = comp.description\r\n ? chalk.dim(` - ${comp.description}`)\r\n : \"\";\r\n\r\n const deps = comp.dependencies && comp.dependencies.length > 0\r\n ? chalk.dim.yellow(` [${comp.dependencies.length} deps]`)\r\n : \"\";\r\n\r\n const internalDeps = comp.internalDependencies && comp.internalDependencies.length > 0\r\n ? chalk.dim.blue(` [requires: ${comp.internalDependencies.join(\", \")}]`)\r\n : \"\";\r\n\r\n console.log(` ${status} ${name}${description}${deps}${internalDeps}`);\r\n });\r\n\r\n console.log(); // Empty line between categories\r\n });\r\n\r\n const installedCount = components.filter(c => c.installed).length;\r\n const totalCount = components.length;\r\n\r\n if (!options.installed && !options.available) {\r\n console.log(chalk.dim(`Total: ${totalCount} components (${installedCount} installed, ${totalCount - installedCount} available)\\n`));\r\n } else {\r\n console.log(chalk.dim(`Total: ${totalCount} components\\n`));\r\n }\r\n}\r\n\r\n","import chalk from \"chalk\";\r\nimport path from \"path\";\r\nimport fs from \"fs/promises\";\r\nimport { IConfig } from \"../interfaces/IConfig\";\r\nimport { getRegistryComponent } from \"../utils/registry.js\";\r\nimport { resolveTargetPath, isComponentInstalled } from \"../utils/component-checker.js\";\r\nimport { hasSrcDirectory, resolveAliasPath } from \"../utils/project-structure.js\";\r\n\r\ninterface DebugOptions {\r\n component?: string;\r\n}\r\n\r\nexport async function debug(options: DebugOptions) {\r\n const cwd = process.cwd();\r\n const componentsJsonPath = path.join(cwd, \"components.json\");\r\n\r\n console.log(chalk.bold(\"\\nπŸ” Pittaya UI Debug Information\\n\"));\r\n console.log(chalk.dim(`Working directory: ${cwd}\\n`));\r\n\r\n // Check components.json\r\n let config: IConfig;\r\n try {\r\n const configContent = await fs.readFile(componentsJsonPath, \"utf-8\");\r\n config = JSON.parse(configContent);\r\n console.log(chalk.green(\"βœ… components.json found\"));\r\n console.log(chalk.dim(` Path: ${componentsJsonPath}`));\r\n } catch (error) {\r\n console.log(chalk.red(\"❌ components.json not found\\n\"));\r\n return;\r\n }\r\n\r\n // Check project structure\r\n const usesSrc = await hasSrcDirectory(cwd);\r\n console.log(chalk.green(`βœ… Project structure: ${usesSrc ? \"src/\" : \"root\"}`));\r\n\r\n // Display aliases\r\n console.log(chalk.bold(\"\\nπŸ“‹ Configured Aliases:\"));\r\n console.log(chalk.dim(` components: ${config.aliases.components}`));\r\n console.log(chalk.dim(` utils: ${config.aliases.utils}`));\r\n console.log(chalk.dim(` ui: ${config.aliases.ui}`));\r\n\r\n // Resolve aliases to actual paths\r\n const resolvedUi = await resolveAliasPath(config.aliases.ui, cwd);\r\n const resolvedLib = await resolveAliasPath(config.aliases.lib || \"@/lib\", cwd);\r\n console.log(chalk.bold(\"\\nπŸ“‚ Resolved Paths:\"));\r\n console.log(chalk.dim(` UI components: ${resolvedUi}`));\r\n console.log(chalk.dim(` Libraries: ${resolvedLib}`));\r\n\r\n // Check if component specified\r\n if (options.component) {\r\n console.log(chalk.bold(`\\nπŸ” Debugging component: ${options.component}\\n`));\r\n\r\n try {\r\n const component = await getRegistryComponent(options.component);\r\n\r\n if (!component) {\r\n console.log(chalk.red(`❌ Component not found in registry\\n`));\r\n return;\r\n }\r\n\r\n console.log(chalk.green(`βœ… Component found in registry`));\r\n console.log(chalk.dim(` Type: ${component.type}`));\r\n console.log(chalk.dim(` Files: ${component.files.length}`));\r\n\r\n console.log(chalk.bold(\"\\nπŸ“ Expected Files:\"));\r\n for (const file of component.files) {\r\n const targetPath = await resolveTargetPath(file.name, component.type, config);\r\n const fullPath = path.join(cwd, targetPath);\r\n\r\n const exists = await fs.access(fullPath)\r\n .then(() => true)\r\n .catch(() => false);\r\n\r\n const statusIcon = exists ? chalk.green(\"βœ…\") : chalk.red(\"❌\");\r\n const statusText = exists ? chalk.green(\"EXISTS\") : chalk.red(\"NOT FOUND\");\r\n\r\n console.log(` ${statusIcon} ${file.name}`);\r\n console.log(chalk.dim(` Expected: ${fullPath}`));\r\n console.log(chalk.dim(` Status: ${statusText}`));\r\n\r\n if (!exists) {\r\n // Check if file exists with different name\r\n const dir = path.dirname(fullPath);\r\n try {\r\n const dirExists = await fs.access(dir).then(() => true).catch(() => false);\r\n if (dirExists) {\r\n const filesInDir = await fs.readdir(dir);\r\n const baseName = path.basename(file.name, path.extname(file.name));\r\n const similarFiles = filesInDir.filter(f =>\r\n f.includes(baseName) || f.toLowerCase().includes(baseName.toLowerCase())\r\n );\r\n\r\n if (similarFiles.length > 0) {\r\n console.log(chalk.yellow(` πŸ’‘ Similar files found in directory:`));\r\n similarFiles.forEach(f => {\r\n console.log(chalk.dim(` - ${f}`));\r\n });\r\n }\r\n } else {\r\n console.log(chalk.red(` ⚠️ Directory doesn't exist: ${dir}`));\r\n }\r\n } catch (err) {\r\n // Ignore\r\n }\r\n }\r\n }\r\n\r\n const isInstalled = await isComponentInstalled(options.component, config);\r\n console.log(chalk.bold(`\\nπŸ“Š Installation Status:`));\r\n if (isInstalled) {\r\n console.log(chalk.green(` βœ… Component is detected as INSTALLED`));\r\n } else {\r\n console.log(chalk.red(` ❌ Component is detected as NOT INSTALLED`));\r\n console.log(chalk.yellow(` πŸ’‘ All files must exist for component to be considered installed`));\r\n }\r\n\r\n } catch (error) {\r\n console.log(chalk.red(`\\n❌ Error debugging component:`));\r\n console.error(error);\r\n }\r\n } else {\r\n console.log(chalk.yellow(\"\\nπŸ’‘ To debug a specific component, use:\"));\r\n console.log(chalk.dim(\" npx pittaya debug --component <name>\\n\"));\r\n }\r\n}\r\n\r\n"],"mappings":";;;AACA,SAAS,eAAe;;;ACDxB,OAAO,WAAW;AAClB,OAAO,SAAS;AAChB,OAAO,aAAa;AACpB,OAAOA,WAAU;AACjB,OAAOC,SAAQ;AACf,SAAS,aAAa;;;ACLtB,OAAO,WAAW;AAGlB,IAAM,oBAAoB;AAG1B,eAAsB,gBAA8B;AAClD,MAAI;AACF,UAAM,WAAW,MAAM,MAAM,GAAG,iBAAiB,aAAa;AAC9D,QAAI,CAAC,SAAS,IAAI;AAChB,YAAM,IAAI,MAAM,QAAQ,SAAS,MAAM,KAAK,SAAS,UAAU,EAAE;AAAA,IACnE;AACA,WAAO,MAAM,SAAS,KAAK;AAAA,EAC7B,SAAS,OAAO;AACd,YAAQ,MAAM,4BAA4B,KAAK;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YAAY,yCAAyC,EACrD,OAAO,eAAe,gCAAgC,EACtD,OAAO,eAAe,gCAAgC,EACtD,OAAO,UAAU,uBAAuB,EACxC,OAAO,IAAI;AAEd,QACG,QAAQ,SAAS,EACjB,YAAY,0BAA0B,EACtC,OAAO,OAAO;AAEjB,QACG,QAAQ,OAAO,EACf,YAAY,qCAAqC,EACjD,OAAO,0BAA0B,yBAAyB,EAC1D,OAAO,KAAK;AAEf,QAAQ,MAAM;","names":["path","fs","packageJson","path","fs","fs","path","path","fs","path","fs","chalk","ora","prompts","path","fs","execa","chalk","path","fs","prompts","ora","detectPackageManager","execa","chalk","chalk","ora","prompts","path","fs","path","fs","chalk","ora","prompts","chalk","ora","prompts","path","fs","path","fs","chalk","ora","prompts","chalk","ora","path","fs","path","fs","chalk","ora","chalk","path","fs","path","chalk","fs"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pittaya",
3
- "version": "0.0.5",
4
- "description": "CLI para adicionar componentes Pittaya UI ao seu projeto",
3
+ "version": "0.0.8",
4
+ "description": "Pittaya UI CLI",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "pittaya": "./dist/index.js"