@tscircuit/cli 0.1.1167 → 0.1.1168

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
@@ -98409,7 +98409,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
98409
98409
  // lib/getVersion.ts
98410
98410
  import { createRequire as createRequire2 } from "node:module";
98411
98411
  // package.json
98412
- var version = "0.1.1166";
98412
+ var version = "0.1.1167";
98413
98413
  var package_default = {
98414
98414
  name: "@tscircuit/cli",
98415
98415
  version,
@@ -263784,6 +263784,15 @@ function ora(options) {
263784
263784
  return new Ora(options);
263785
263785
  }
263786
263786
 
263787
+ // cli/import/parse-direct-lcsc-part-number.ts
263788
+ var parseDirectLcscPartNumber = (query) => {
263789
+ const normalizedQuery = query.trim().toUpperCase();
263790
+ const directPartMatch = normalizedQuery.match(/^C?(\d+)$/);
263791
+ if (!directPartMatch)
263792
+ return null;
263793
+ return `C${directPartMatch[1]}`;
263794
+ };
263795
+
263787
263796
  // cli/import/register.ts
263788
263797
  var registerImport = (program2) => {
263789
263798
  program2.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").option("--download", "Download 3D model assets (.step, .obj) locally").action(async (queryParts, opts) => {
@@ -263821,6 +263830,22 @@ var registerImport = (program2) => {
263821
263830
  }
263822
263831
  spinner.stop();
263823
263832
  if (!registryResults.length && !jlcResults?.length) {
263833
+ const directLcscPartNumber = searchJlc ? parseDirectLcscPartNumber(query) : null;
263834
+ if (directLcscPartNumber) {
263835
+ const importSpinner = ora({
263836
+ text: `Importing "${directLcscPartNumber}" from JLCPCB...`,
263837
+ stream: process.stdout
263838
+ }).start();
263839
+ try {
263840
+ const { filePath } = await importComponentFromJlcpcb(directLcscPartNumber, process.cwd(), { download: opts.download });
263841
+ importSpinner.succeed(kleur_default.green(`Imported ${filePath}`));
263842
+ return;
263843
+ } catch (error) {
263844
+ importSpinner.fail(kleur_default.red("Failed to import part"));
263845
+ console.error(error instanceof Error ? error.message : error);
263846
+ return process.exit(1);
263847
+ }
263848
+ }
263824
263849
  console.log(kleur_default.yellow(`No results found for "${query}" in the tscircuit registry or JLCPCB.`));
263825
263850
  return;
263826
263851
  }
package/dist/lib/index.js CHANGED
@@ -60678,7 +60678,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
60678
60678
  }));
60679
60679
  };
60680
60680
  // package.json
60681
- var version = "0.1.1166";
60681
+ var version = "0.1.1167";
60682
60682
  var package_default = {
60683
60683
  name: "@tscircuit/cli",
60684
60684
  version,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1167",
3
+ "version": "0.1.1168",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",