@bankr/cli 0.2.3 → 0.2.5

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.
@@ -210,7 +210,9 @@ export default async function handler(req: Request): Promise<Response> {
210
210
  properties: {
211
211
  [isPost ? "field" : "param"]: {
212
212
  type: "string",
213
- description: isPost ? "Example body field" : "Example query parameter",
213
+ description: isPost
214
+ ? "Example body field"
215
+ : "Example query parameter",
214
216
  },
215
217
  },
216
218
  required: [isPost ? "field" : "param"],
@@ -574,7 +576,6 @@ export async function x402EnvUnsetCommand(key) {
574
576
  }
575
577
  }
576
578
  // ── Schema display helpers ──────────────────────────────────────────────
577
- const P = " │";
578
579
  /**
579
580
  * Detects whether a schema object is JSON Schema format (has `type` and `properties`)
580
581
  * vs the legacy flat Record<string,string> format.
@@ -588,7 +589,7 @@ function isJsonSchema(obj) {
588
589
  }
589
590
  /**
590
591
  * Renders a JSON Schema properties table.
591
- * Output: lines like "symbol* string Token symbol"
592
+ * Output: lines like " symbol* string Token symbol"
592
593
  */
593
594
  function renderJsonSchemaProps(schema) {
594
595
  if (!schema.properties)
@@ -614,7 +615,7 @@ function renderJsonSchemaProps(schema) {
614
615
  const typeStr = prop.type + (prop.enum ? ` (${prop.enum.join("|")})` : "");
615
616
  const typePad = " ".repeat(Math.max(0, maxType + 2 - typeStr.length));
616
617
  const desc = prop.description ? chalk.dim(prop.description) : "";
617
- lines.push(`${P} ${nameStr}${namePad}${chalk.yellow(typeStr)}${typePad}${desc}`);
618
+ lines.push(` ${nameStr}${namePad}${chalk.yellow(typeStr)}${typePad}${desc}`);
618
619
  }
619
620
  return lines;
620
621
  }
@@ -629,12 +630,12 @@ function renderLegacySchema(obj) {
629
630
  const pretty = JSON.stringify(v, null, 2);
630
631
  const indented = pretty
631
632
  .split("\n")
632
- .map((line, i) => (i === 0 ? line : `${P} ${" ".repeat(k.length)}${line}`))
633
+ .map((line, i) => i === 0 ? line : ` ${" ".repeat(k.length)}${line}`)
633
634
  .join("\n");
634
- lines.push(`${P} ${chalk.cyan(k)} ${chalk.dim(indented)}`);
635
+ lines.push(` ${chalk.cyan(k)} ${chalk.dim(indented)}`);
635
636
  }
636
637
  else {
637
- lines.push(`${P} ${chalk.cyan(k)} ${chalk.dim(String(v))}`);
638
+ lines.push(` ${chalk.cyan(k)} ${chalk.dim(String(v))}`);
638
639
  }
639
640
  }
640
641
  return lines;
@@ -656,24 +657,24 @@ function printServiceFormatted(svc) {
656
657
  const methods = route?.methods?.filter((m) => m !== "*").join(", ") || "ANY";
657
658
  const url = svc.url ?? `https://x402.bankr.bot/${svc.slug}`;
658
659
  const isGet = methods === "GET";
659
- // ── Card header ──
660
- console.log(` ${chalk.dim("┌")} ${output.fmt.brandBold(svc.name)}`);
660
+ // ── Header ──
661
+ console.log(` ${output.fmt.brandBold(svc.name)}`);
661
662
  if (svc.description) {
662
- console.log(`${P} ${chalk.dim(svc.description)}`);
663
+ console.log(` ${chalk.dim(svc.description)}`);
663
664
  }
664
- console.log(`${P}`);
665
+ console.log("");
665
666
  // ── Metadata ──
666
- console.log(`${P} ${chalk.dim("URL")} ${url}`);
667
- console.log(`${P} ${chalk.dim("Method")} ${chalk.bold(methods)}`);
668
- console.log(`${P} ${chalk.dim("Price")} ${chalk.green(`$${route?.price ?? "?"} ${route?.currency ?? "USDC"}`)}`);
669
- console.log(`${P} ${chalk.dim("Network")} ${route?.network ?? "base"}`);
667
+ console.log(` ${chalk.dim("URL")} ${url}`);
668
+ console.log(` ${chalk.dim("Method")} ${chalk.bold(methods)}`);
669
+ console.log(` ${chalk.dim("Price")} ${chalk.green(`$${route?.price ?? "?"} ${route?.currency ?? "USDC"}`)}`);
670
+ console.log(` ${chalk.dim("Network")} ${route?.network ?? "base"}`);
670
671
  // ── Schema ──
671
672
  const { input: inputSchema, output: outputSchema } = resolveSchemas(route?.schema);
672
673
  if (inputSchema || outputSchema) {
673
- console.log(`${P}`);
674
+ console.log("");
674
675
  if (inputSchema) {
675
676
  const label = isGet ? "Input (query params)" : "Input (JSON body)";
676
- console.log(`${P} ${chalk.bold(label)}`);
677
+ console.log(` ${chalk.bold(label)}`);
677
678
  if (isJsonSchema(inputSchema)) {
678
679
  for (const line of renderJsonSchemaProps(inputSchema)) {
679
680
  console.log(line);
@@ -686,8 +687,8 @@ function printServiceFormatted(svc) {
686
687
  }
687
688
  }
688
689
  if (outputSchema) {
689
- console.log(`${P}`);
690
- console.log(`${P} ${chalk.bold("Output")}`);
690
+ console.log("");
691
+ console.log(` ${chalk.bold("Output")}`);
691
692
  if (isJsonSchema(outputSchema)) {
692
693
  for (const line of renderJsonSchemaProps(outputSchema)) {
693
694
  console.log(line);
@@ -702,27 +703,27 @@ function printServiceFormatted(svc) {
702
703
  }
703
704
  // ── Example ──
704
705
  if (inputSchema && isJsonSchema(inputSchema) && inputSchema.properties) {
705
- console.log(`${P}`);
706
+ console.log("");
706
707
  const props = Object.entries(inputSchema.properties);
707
708
  if (isGet) {
708
709
  const qs = props.map(([k, p]) => `${k}=<${p.type}>`).join("&");
709
- console.log(`${P} ${chalk.dim("Example")} ${chalk.dim("GET")} ${url}?${qs}`);
710
+ console.log(` ${chalk.dim("Example")} ${chalk.dim("GET")} ${url}?${qs}`);
710
711
  }
711
712
  else {
712
713
  const bodyObj = {};
713
714
  for (const [k, p] of props)
714
715
  bodyObj[k] = `<${p.type}>`;
715
- console.log(`${P} ${chalk.dim("Example")} ${chalk.dim("POST")} ${url}`);
716
- console.log(`${P} ${chalk.dim(JSON.stringify(bodyObj))}`);
716
+ console.log(` ${chalk.dim("Example")} ${chalk.dim("POST")} ${url}`);
717
+ console.log(` ${chalk.dim(JSON.stringify(bodyObj))}`);
717
718
  }
718
719
  }
719
720
  // ── Tags ──
720
721
  if (svc.tags?.length) {
721
- console.log(`${P}`);
722
- console.log(`${P} ${svc.tags.map((t) => chalk.dim(`#${t}`)).join(" ")}`);
722
+ console.log("");
723
+ console.log(` ${svc.tags.map((t) => chalk.dim(`#${t}`)).join(" ")}`);
723
724
  }
724
- console.log(` ${chalk.dim("└" + "─".repeat(60))}`);
725
- console.log();
725
+ console.log(` ${chalk.dim("─".repeat(60))}`);
726
+ console.log("");
726
727
  }
727
728
  export async function x402SearchCommand(queryParts, opts = {}) {
728
729
  const query = queryParts.join(" ").trim();
@@ -736,19 +737,22 @@ export async function x402SearchCommand(queryParts, opts = {}) {
736
737
  const res = await fetch(`${getApiUrl()}/x402/endpoints/discover?${params}`);
737
738
  const result = await handleResponse(res);
738
739
  spin.stop();
739
- if (result.services.length === 0) {
740
+ // Filter low-relevance results client-side
741
+ const MIN_DISPLAY_SCORE = 0.15;
742
+ const services = result.services.filter((s) => !s.score || s.score >= MIN_DISPLAY_SCORE);
743
+ if (services.length === 0) {
740
744
  output.info(`No services found for "${query}"`);
741
745
  return;
742
746
  }
743
747
  // Raw mode: dump JSON and exit
744
748
  if (opts.raw) {
745
- console.log(JSON.stringify(result.services, null, 2));
749
+ console.log(JSON.stringify(services, null, 2));
746
750
  return;
747
751
  }
748
752
  console.log();
749
- console.log(` ${chalk.dim(`Found ${result.services.length} service(s) for`)} "${query}"`);
753
+ console.log(` ${chalk.dim(`Found ${services.length} service(s) for`)} "${query}"`);
750
754
  console.log(` ${chalk.dim("─".repeat(60))}`);
751
- for (const svc of result.services) {
755
+ for (const svc of services) {
752
756
  printServiceFormatted(svc);
753
757
  }
754
758
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bankr/cli",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Official CLI for the Bankr AI agent platform",
5
5
  "type": "module",
6
6
  "bin": {