@tscircuit/cli 0.1.982 → 0.1.983

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/main.js CHANGED
@@ -74395,7 +74395,7 @@ var getGlobalDepsInstallCommand = (packageManager, deps) => {
74395
74395
  import { execSync as execSync2 } from "node:child_process";
74396
74396
  var import_semver2 = __toESM2(require_semver2(), 1);
74397
74397
  // package.json
74398
- var version = "0.1.981";
74398
+ var version = "0.1.982";
74399
74399
  var package_default = {
74400
74400
  name: "@tscircuit/cli",
74401
74401
  main: "dist/cli/main.js",
@@ -174364,27 +174364,34 @@ function ora(options) {
174364
174364
 
174365
174365
  // cli/import/register.ts
174366
174366
  var registerImport = (program3) => {
174367
- program3.command("import").description("Search JLCPCB or the tscircuit registry and import a component").argument("<query>", "Chip name, part number, or package name").action(async (query) => {
174367
+ program3.command("import").description("Search JLCPCB or the tscircuit registry and import a component").argument("<query>", "Chip name, part number, or package name").option("--jlcpcb", "Search JLCPCB components").option("--lcsc", "Alias for --jlcpcb").option("--tscircuit", "Search tscircuit registry packages").action(async (query, opts) => {
174368
+ const hasFilters = opts.jlcpcb || opts.lcsc || opts.tscircuit;
174369
+ const searchJlc = opts.jlcpcb || opts.lcsc || !hasFilters;
174370
+ const searchTscircuit = opts.tscircuit || !hasFilters;
174368
174371
  const ky3 = getRegistryApiKy();
174369
174372
  const spinner = ora("Searching...").start();
174370
174373
  let registryResults = [];
174371
174374
  let jlcResults = [];
174372
- try {
174373
- spinner.text = "Searching tscircuit registry...";
174374
- registryResults = (await ky3.post("packages/search", { json: { query } }).json()).packages;
174375
- } catch (error) {
174376
- spinner.fail("Failed to search registry");
174377
- console.error(kleur_default.red("Error:"), error instanceof Error ? error.message : error);
174378
- spinner.start();
174375
+ if (searchTscircuit) {
174376
+ try {
174377
+ spinner.text = "Searching tscircuit registry...";
174378
+ registryResults = (await ky3.post("packages/search", { json: { query } }).json()).packages;
174379
+ } catch (error) {
174380
+ spinner.fail("Failed to search registry");
174381
+ console.error(kleur_default.red("Error:"), error instanceof Error ? error.message : error);
174382
+ spinner.start();
174383
+ }
174379
174384
  }
174380
- try {
174381
- spinner.text = "Searching JLCPCB parts...";
174382
- const searchUrl = "https://jlcsearch.tscircuit.com/api/search?limit=10&q=" + encodeURIComponent(query);
174383
- const resp = await fetch(searchUrl).then((r4) => r4.json());
174384
- jlcResults = resp.components;
174385
- } catch (error) {
174386
- spinner.fail("Failed to search JLCPCB");
174387
- console.error(kleur_default.red("Error:"), error instanceof Error ? error.message : error);
174385
+ if (searchJlc) {
174386
+ try {
174387
+ spinner.text = "Searching JLCPCB parts...";
174388
+ const searchUrl = `https://jlcsearch.tscircuit.com/api/search?limit=10&q=${encodeURIComponent(query)}`;
174389
+ const resp = await fetch(searchUrl).then((r4) => r4.json());
174390
+ jlcResults = resp.components;
174391
+ } catch (error) {
174392
+ spinner.fail("Failed to search JLCPCB");
174393
+ console.error(kleur_default.red("Error:"), error instanceof Error ? error.message : error);
174394
+ }
174388
174395
  }
174389
174396
  spinner.stop();
174390
174397
  if (!registryResults.length && !jlcResults?.length) {
@@ -174406,12 +174413,13 @@ var registerImport = (program3) => {
174406
174413
  selected: !choices.length && idx === 0
174407
174414
  });
174408
174415
  });
174409
- const { choice } = await prompts({
174416
+ const shouldAutoSelectSingleJlcResult = searchJlc && !searchTscircuit && choices.length === 1;
174417
+ const choice = shouldAutoSelectSingleJlcResult ? choices[0].value : (await prompts({
174410
174418
  type: "select",
174411
174419
  name: "choice",
174412
174420
  message: "Select a part to import",
174413
174421
  choices
174414
- });
174422
+ })).choice;
174415
174423
  if (!choice) {
174416
174424
  console.log("Aborted.");
174417
174425
  return process.exit(0);
package/dist/lib/index.js CHANGED
@@ -60414,7 +60414,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60414
60414
  }));
60415
60415
  };
60416
60416
  // package.json
60417
- var version = "0.1.981";
60417
+ var version = "0.1.982";
60418
60418
  var package_default = {
60419
60419
  name: "@tscircuit/cli",
60420
60420
  main: "dist/cli/main.js",
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  ".": "./dist/cli/main.js",
6
6
  "./lib": "./dist/lib/index.js"
7
7
  },
8
- "version": "0.1.982",
8
+ "version": "0.1.983",
9
9
  "devDependencies": {
10
10
  "@babel/standalone": "^7.26.9",
11
11
  "@biomejs/biome": "^1.9.4",