vectorvesper 2.0.2 → 2.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.
@@ -85,7 +85,26 @@ function getRegistryBaseUrl() {
85
85
  function getProApiBaseUrl() {
86
86
  return process.env.VV_PRO_API_URL || DEFAULT_PRO_API_URL;
87
87
  }
88
+ var RegistryHttpError = class extends Error {
89
+ constructor(message, status) {
90
+ super(message);
91
+ this.status = status;
92
+ this.name = "RegistryHttpError";
93
+ }
94
+ status;
95
+ };
88
96
  function handleHttpError(status, url) {
97
+ try {
98
+ throwForStatus(status, url);
99
+ } catch (error) {
100
+ throw new RegistryHttpError(
101
+ error instanceof Error ? error.message : String(error),
102
+ status
103
+ );
104
+ }
105
+ throw new RegistryHttpError(`Registry request failed: HTTP ${status}`, status);
106
+ }
107
+ function throwForStatus(status, url) {
89
108
  switch (status) {
90
109
  case 401:
91
110
  throw new Error(
@@ -217,12 +236,39 @@ async function getCachedIndex() {
217
236
  }
218
237
  async function getComponentTier(slug) {
219
238
  const index = await getCachedIndex();
220
- return index?.components.find((c) => c.slug === slug)?.tier;
239
+ if (!index) return { kind: "unreachable" };
240
+ const tier = index.components.find((c) => c.slug === slug)?.tier;
241
+ return tier ? { kind: "tier", tier } : { kind: "absent" };
221
242
  }
222
243
  async function fetchComponent(slug) {
223
244
  validateSlug(slug);
224
- const tier = await getComponentTier(slug);
225
- return tier === "pro" ? fetchProComponent(slug) : fetchFreeComponent(slug);
245
+ const lookup = await getComponentTier(slug);
246
+ if (lookup.kind === "tier") {
247
+ return lookup.tier === "pro" ? fetchProComponent(slug) : fetchFreeComponent(slug);
248
+ }
249
+ if (lookup.kind === "unreachable") return fetchFreeComponent(slug);
250
+ return fetchUnlistedComponent(slug);
251
+ }
252
+ async function fetchUnlistedComponent(slug) {
253
+ if (!getAuthToken()) {
254
+ throw new Error(
255
+ `"${slug}" isn't in the public registry.
256
+ \u2022 If it's a Pro component, authenticate first: ${'"npx vectorvesper login <token>"'}
257
+ Get a token at https://vectorvesper.dev/account
258
+ \u2022 Otherwise run "npx vectorvesper list" to see what's available.`
259
+ );
260
+ }
261
+ try {
262
+ return await fetchProComponent(slug);
263
+ } catch (error) {
264
+ if (error instanceof RegistryHttpError && error.status === 404) {
265
+ throw new Error(
266
+ `No component named "${slug}".
267
+ Run "npx vectorvesper list" to see everything available to your account.`
268
+ );
269
+ }
270
+ throw error;
271
+ }
226
272
  }
227
273
  async function fetchFreeComponent(slug) {
228
274
  const baseUrl = getRegistryBaseUrl();
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  detectProject,
4
4
  fetchComponent,
5
5
  fetchRegistryIndex
6
- } from "./chunk-HOJ3DQSV.js";
6
+ } from "./chunk-5YSVDVLK.js";
7
7
  import {
8
8
  getAuthToken,
9
9
  getGlobalConfigPath,
@@ -194,6 +194,11 @@ import ora2 from "ora";
194
194
  import pc5 from "picocolors";
195
195
  import { confirm as confirm2, isCancel as isCancel2 } from "@clack/prompts";
196
196
 
197
+ // src/utils/tty.ts
198
+ function isInteractive() {
199
+ return Boolean(process.stdin.isTTY && process.stdout.isTTY);
200
+ }
201
+
197
202
  // src/utils/installer.ts
198
203
  import fs2 from "fs";
199
204
  import path2 from "path";
@@ -523,6 +528,13 @@ async function handleDependencies(components, projectRoot, projectInfo, options)
523
528
  console.log(` Run: ${pc5.bold(pc5.cyan(installCmd))}`);
524
529
  return;
525
530
  }
531
+ if (!options.yes && !isInteractive()) {
532
+ console.log(pc5.yellow(`
533
+ \u26A0\uFE0F Missing dependencies: ${depsLabel}`));
534
+ console.log(` Run: ${pc5.bold(pc5.cyan(installCmd))}`);
535
+ console.log(pc5.dim(" (non-interactive shell \u2014 pass --yes to install automatically)"));
536
+ return;
537
+ }
526
538
  let shouldInstall = options.yes === true;
527
539
  if (!shouldInstall) {
528
540
  console.log("");
@@ -571,6 +583,10 @@ async function handlePrune(orphans, slug, options) {
571
583
  console.log(pc5.dim(` Re-run with ${pc5.cyan("--prune")} to remove them.`));
572
584
  return;
573
585
  }
586
+ if (!isInteractive()) {
587
+ console.log(pc5.dim(` Left in place. Run with ${pc5.cyan("--prune")} to remove them.`));
588
+ return;
589
+ }
574
590
  const answer = await confirm2({
575
591
  message: "Remove these orphaned files?",
576
592
  initialValue: true
@@ -651,6 +667,13 @@ async function addCommand(slug, options = {}) {
651
667
  for (const file of planned) {
652
668
  if (file.exists && !options.dryRun && !options.overwrite && !options.yes) {
653
669
  spinner.stop();
670
+ if (!isInteractive()) {
671
+ console.log(
672
+ pc5.dim(` Kept existing file: ${file.relativePath} ${pc5.dim("(pass --overwrite to replace)")}`)
673
+ );
674
+ spinner.start("Continuing installation...");
675
+ continue;
676
+ }
654
677
  const answer = await confirm2({
655
678
  message: pc5.yellow(`File already exists: "${file.relativePath}". Overwrite?`),
656
679
  initialValue: false
@@ -970,7 +993,7 @@ Remove ${slug}
970
993
  import fs6 from "fs";
971
994
  import path6 from "path";
972
995
  import pc8 from "picocolors";
973
- var CLI_VERSION = true ? "2.0.2" : "0.0.0-dev";
996
+ var CLI_VERSION = true ? "2.0.4" : "0.0.0-dev";
974
997
  async function infoCommand() {
975
998
  console.log(pc8.bold(pc8.cyan("\nVector Vesper Diagnostics\n")));
976
999
  const projectInfo = detectProject();
@@ -1268,7 +1291,7 @@ async function whoamiCommand() {
1268
1291
  }
1269
1292
 
1270
1293
  // src/index.ts
1271
- var version = true ? "2.0.2" : "0.0.0-dev";
1294
+ var version = true ? "2.0.4" : "0.0.0-dev";
1272
1295
  var program = new Command();
1273
1296
  program.name("vv").description("Vector Vesper CLI \u2014 add visual components to your React project").version(version).option("--verbose", "Show detailed debug output").hook("preAction", (thisCommand) => {
1274
1297
  const opts = thisCommand.opts();
@@ -1307,7 +1330,7 @@ program.command("whoami", { hidden: true }).description("Show current authentica
1307
1330
  await whoamiCommand();
1308
1331
  });
1309
1332
  program.command("mcp [action]").description("Run as an MCP server (stdio) for AI coding agents. `vv mcp status` checks the setup.").option("--stdio", "Force server mode even from an interactive terminal").action(async (action, options) => {
1310
- const { mcpCommand } = await import("./mcp-IHHFTU4U.js");
1333
+ const { mcpCommand } = await import("./mcp-GRL5KVPI.js");
1311
1334
  await mcpCommand(action, options);
1312
1335
  });
1313
1336
  process.on("unhandledRejection", (error) => {
@@ -7,7 +7,7 @@ import {
7
7
 
8
8
  // src/commands/mcp.ts
9
9
  import pc from "picocolors";
10
- var VERSION = true ? "2.0.2" : "0.0.0-dev";
10
+ var VERSION = true ? "2.0.4" : "0.0.0-dev";
11
11
  var CONFIG_SNIPPET = `{
12
12
  "mcpServers": {
13
13
  "vectorvesper": {
@@ -92,7 +92,7 @@ ${pc.red("\u2717")} Unknown argument "${action}" for \`vv mcp\`.
92
92
  return;
93
93
  }
94
94
  protectStdout();
95
- const { startMcpServer } = await import("./server-P6ZU3IS6.js");
95
+ const { startMcpServer } = await import("./server-OLD3SDPJ.js");
96
96
  try {
97
97
  await startMcpServer();
98
98
  } catch (error) {