@tscircuit/cli 0.1.2085 → 0.1.2086

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
@@ -182,6 +182,21 @@ the solver can be reproduced independently. Values that JSON cannot represent
182
182
  directly, such as `undefined`, `NaN`, maps, sets, or circular references, use
183
183
  explicit `value_type` records instead of being silently discarded.
184
184
 
185
+ ## Searching Texas Instruments parts
186
+
187
+ Use `--ti` to search the TI catalog indexed by [tisearch](https://tisearch.tscircuit.com):
188
+
189
+ ```sh
190
+ tsci search --ti TPS62160
191
+ tsci search --ti --json "buck converter"
192
+ tsci search --ti --jlcpcb TPS62160
193
+ ```
194
+
195
+ JSON results identify TI parts with `source: "ti"` and include stored stock,
196
+ pricing, and product links. No TI API credentials are needed. Search reads the
197
+ indexed catalog; stock and metadata reflect the latest completed background
198
+ refresh. This flag provides part discovery, not TSX component import.
199
+
185
200
  ## Development
186
201
 
187
202
  This command will open the `index.tsx` file for editing.
package/dist/cli/main.js CHANGED
@@ -366857,14 +366857,15 @@ var entry_default = Fuse2;
366857
366857
 
366858
366858
  // cli/search/register.ts
366859
366859
  var registerSearch = (program) => {
366860
- program.command("search").description("Search for footprints, CAD models or packages in the tscircuit ecosystem").argument("<query...>", "Search query (e.g. keyword, author, or package name)").option("--kicad", "Search KiCad footprints").option("--jlcpcb", "Search JLCPCB components").option("--lcsc", "Alias for --jlcpcb").option("--tscircuit", "Search tscircuit registry packages").option("--json", "Output search results as JSON").action(async (queryParts, opts) => {
366860
+ program.command("search").description("Search for footprints, CAD models or packages in the tscircuit ecosystem").argument("<query...>", "Search query (e.g. keyword, author, or package name)").option("--kicad", "Search KiCad footprints").option("--jlcpcb", "Search JLCPCB components").option("--lcsc", "Alias for --jlcpcb").option("--ti", "Search Texas Instruments components").option("--tscircuit", "Search tscircuit registry packages").option("--json", "Output search results as JSON").action(async (queryParts, opts) => {
366861
366861
  const query = getQueryFromParts(queryParts);
366862
- const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.tscircuit;
366862
+ const hasFilters = opts.kicad || opts.jlcpcb || opts.lcsc || opts.ti || opts.tscircuit;
366863
366863
  const searchKicad = opts.kicad;
366864
366864
  const searchJlc = opts.jlcpcb || opts.lcsc || !hasFilters;
366865
366865
  const searchTscircuit = opts.tscircuit;
366866
366866
  let results = { packages: [] };
366867
366867
  let jlcResults = [];
366868
+ let tiResults = [];
366868
366869
  let kicadResults = [];
366869
366870
  try {
366870
366871
  if (searchTscircuit) {
@@ -366878,13 +366879,23 @@ var registerSearch = (program) => {
366878
366879
  const jlcResponse = await fetch(jlcSearchUrl).then((r) => r.json());
366879
366880
  jlcResults = jlcResponse?.components ?? [];
366880
366881
  }
366882
+ if (opts.ti) {
366883
+ const tiSearchUrl = "https://tisearch.tscircuit.com/api/search?limit=10&q=" + encodeURIComponent(query);
366884
+ const response = await fetch(tiSearchUrl);
366885
+ if (!response.ok)
366886
+ throw new Error(`TI search failed (HTTP ${response.status})`);
366887
+ const data = await response.json();
366888
+ if (!Array.isArray(data?.components))
366889
+ throw new Error("TI search returned an invalid response");
366890
+ tiResults = data.components;
366891
+ }
366881
366892
  if (searchKicad) {
366882
366893
  const kicadFiles = await fetch("https://kicad-mod-cache.tscircuit.com/kicad_files.json").then((r) => r.json());
366883
366894
  const fuse = new entry_default(kicadFiles);
366884
366895
  kicadResults = fuse.search(query).slice(0, 10).map((r) => r.item);
366885
366896
  }
366886
366897
  } catch (error) {
366887
- console.error(kleur_default.red("Failed to search registry:"), error instanceof Error ? error.message : error);
366898
+ console.error(kleur_default.red("Failed to search:"), error instanceof Error ? error.message : error);
366888
366899
  process.exit(1);
366889
366900
  }
366890
366901
  if (opts.json) {
@@ -366897,6 +366908,10 @@ var registerSearch = (program) => {
366897
366908
  source: "tscircuit",
366898
366909
  ...pkg
366899
366910
  })),
366911
+ ...tiResults.map((comp) => ({
366912
+ ...comp,
366913
+ source: "ti"
366914
+ })),
366900
366915
  ...jlcResults.map((comp) => ({
366901
366916
  source: "jlcpcb",
366902
366917
  ...comp
@@ -366908,10 +366923,11 @@ var registerSearch = (program) => {
366908
366923
  }, null, 2));
366909
366924
  return;
366910
366925
  }
366911
- if (!kicadResults.length && !results.packages.length && !jlcResults.length) {
366926
+ if (!kicadResults.length && !results.packages.length && !jlcResults.length && !tiResults.length) {
366912
366927
  const sources = [
366913
366928
  searchTscircuit && "tscircuit registry",
366914
366929
  searchJlc && "JLCPCB",
366930
+ opts.ti && "Texas Instruments",
366915
366931
  searchKicad && "KiCad"
366916
366932
  ].filter(Boolean);
366917
366933
  console.log(kleur_default.yellow(`No results found for "${query}" in ${sources.join(", ")}.`));
@@ -366938,6 +366954,13 @@ var registerSearch = (program) => {
366938
366954
  console.log(`${idx + 1}. ${comp.mfr} (C${comp.lcsc}) - ${comp.description} (stock: ${comp.stock.toLocaleString("en-US")})`);
366939
366955
  });
366940
366956
  }
366957
+ if (tiResults.length) {
366958
+ console.log();
366959
+ console.log(kleur_default.bold().underline(`Found ${tiResults.length} component(s) in TI search:`));
366960
+ tiResults.forEach((comp, idx) => {
366961
+ console.log(`${idx + 1}. ${comp.mfr} - ${comp.description} (stock: ${comp.stock.toLocaleString("en-US")})`);
366962
+ });
366963
+ }
366941
366964
  console.log(`
366942
366965
  `);
366943
366966
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.2085",
3
+ "version": "0.1.2086",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"