@astralkit/cli 3.0.3 → 3.0.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astralkit/cli",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "AstralKit CLI — Install and manage UI components in your project",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "bin": {
@@ -138,7 +138,9 @@ async function tryFetch(type, slug, options) {
138
138
  await getWorkflow(slug, framework);
139
139
  }
140
140
  return true;
141
- } catch {
141
+ } catch (err) {
142
+ // 403 = exists but user doesn't have access — still counts as "found"
143
+ if (err.code === 'PRO_REQUIRED') return true;
142
144
  return false;
143
145
  }
144
146
  }
@@ -233,7 +235,27 @@ async function addComponent(componentSlug, options) {
233
235
  const spinner = ora(`Fetching ${componentSlug} (${FRAMEWORK_LABELS[framework] || framework})...`).start();
234
236
 
235
237
  try {
236
- const data = await getComponent(componentSlug, framework);
238
+ let data;
239
+ try {
240
+ data = await getComponent(componentSlug, framework);
241
+ } catch (fetchErr) {
242
+ // Pro required for React/Next.js — fall back to HTML for free users
243
+ if (fetchErr.code === 'PRO_REQUIRED' && framework !== 'html') {
244
+ spinner.warn(`${FRAMEWORK_LABELS[framework] || framework} requires a Pro subscription.`);
245
+ console.log(chalk.gray(' Fetching HTML version instead (free tier).'));
246
+ const htmlSpinner = ora(`Fetching ${componentSlug} (HTML)...`).start();
247
+ try {
248
+ data = await getComponent(componentSlug, 'html');
249
+ htmlSpinner.succeed(`Fetched ${componentSlug} (HTML)`);
250
+ } catch (htmlErr) {
251
+ htmlSpinner.fail(`Failed to add component.`);
252
+ console.log(chalk.yellow(htmlErr.message));
253
+ return;
254
+ }
255
+ } else {
256
+ throw fetchErr;
257
+ }
258
+ }
237
259
 
238
260
  if (!data.files || data.files.length === 0) {
239
261
  spinner.fail(`No ${framework} code available for "${componentSlug}".`);