@tscircuit/cli 0.1.97 → 0.1.99

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
@@ -49,8 +49,9 @@ Commands:
49
49
  logout Logout from tscircuit registry
50
50
  config Manage tscircuit CLI configuration
51
51
  export [options] <file> Export tscircuit code to various formats
52
- add <component> Add a component from tscircuit.com
52
+ add <component> Add a tscircuit component package to your project
53
53
  upgrade Upgrade CLI to the latest version
54
+ search <query> Search for snippets in the tscircuit registry
54
55
  help [command] display help for command
55
56
  ```
56
57
  <!-- END_HELP_OUTPUT -->
package/dist/main.js CHANGED
@@ -433425,7 +433425,7 @@ import readline from "node:readline";
433425
433425
  import { execSync as execSync2 } from "node:child_process";
433426
433426
  var import_semver = __toESM2(require_semver2(), 1);
433427
433427
  // package.json
433428
- var version = "0.1.96";
433428
+ var version = "0.1.98";
433429
433429
  var package_default = {
433430
433430
  name: "@tscircuit/cli",
433431
433431
  version,
@@ -464440,6 +464440,60 @@ var registerConfigSet = (program3) => {
464440
464440
  });
464441
464441
  };
464442
464442
 
464443
+ // cli/search/register.ts
464444
+ var import_prompts3 = __toESM2(require_prompts3(), 1);
464445
+ var registerSearch = (program3) => {
464446
+ program3.command("search").description("Search for snippets in the tscircuit registry").argument("<query>", "Search query (e.g. keyword, author, or snippet name)").action(async (query) => {
464447
+ const ky2 = getRegistryApiKy();
464448
+ let results = { packages: [] };
464449
+ try {
464450
+ results = await ky2.post("packages/search", {
464451
+ json: { query }
464452
+ }).json();
464453
+ } catch (error) {
464454
+ console.error(kleur_default.red("Failed to search registry:"), error instanceof Error ? error.message : error);
464455
+ process.exit(1);
464456
+ }
464457
+ if (!results.packages.length) {
464458
+ console.log(kleur_default.yellow("No packages found matching your query."));
464459
+ return;
464460
+ }
464461
+ console.log(kleur_default.bold().underline(`Found ${results.packages.length} package(s):`));
464462
+ const choices = results.packages.map((pkg) => ({
464463
+ title: pkg.name,
464464
+ description: pkg.description || "",
464465
+ value: pkg.name
464466
+ }));
464467
+ const { selectedPackage } = await import_prompts3.default({
464468
+ type: "select",
464469
+ name: "selectedPackage",
464470
+ message: "Select a package to add:",
464471
+ choices,
464472
+ initial: 0
464473
+ });
464474
+ if (!selectedPackage) {
464475
+ console.log(kleur_default.yellow("No package selected."));
464476
+ return;
464477
+ }
464478
+ const { confirm } = await import_prompts3.default({
464479
+ type: "confirm",
464480
+ name: "confirm",
464481
+ message: `Do you want to add ${kleur_default.green(selectedPackage)}?`,
464482
+ initial: true
464483
+ });
464484
+ if (confirm) {
464485
+ try {
464486
+ console.log(kleur_default.blue(`Installing ${selectedPackage}...`));
464487
+ await addPackage(selectedPackage);
464488
+ console.log(kleur_default.green(`Successfully installed ${selectedPackage}`));
464489
+ } catch (error) {
464490
+ console.error(kleur_default.red(`Failed to install ${selectedPackage}:`), error);
464491
+ process.exit(1);
464492
+ }
464493
+ }
464494
+ });
464495
+ };
464496
+
464443
464497
  // cli/main.ts
464444
464498
  var program2 = new Command;
464445
464499
  program2.name("tsci").description("CLI for developing tscircuit snippets").version(getVersion());
@@ -464458,6 +464512,7 @@ registerConfigSet(program2);
464458
464512
  registerExport(program2);
464459
464513
  registerAdd(program2);
464460
464514
  registerUpgradeCommand(program2);
464515
+ registerSearch(program2);
464461
464516
  if (process.argv.length === 2) {
464462
464517
  import_perfect_cli.perfectCli(program2, process.argv);
464463
464518
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.97",
3
+ "version": "0.1.99",
4
4
  "main": "dist/main.js",
5
5
  "devDependencies": {
6
6
  "@babel/standalone": "^7.26.9",