@orth/cli 0.2.9 → 0.2.11

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/api.d.ts CHANGED
@@ -71,6 +71,26 @@ export interface IntegrateResponse {
71
71
  path: string;
72
72
  snippets: Record<string, string>;
73
73
  }
74
+ export interface ListApisResponse {
75
+ success: boolean;
76
+ apis: Array<{
77
+ name: string;
78
+ slug: string;
79
+ description?: string;
80
+ baseUrl: string;
81
+ verified: boolean;
82
+ endpoints: Array<{
83
+ path: string;
84
+ method: string;
85
+ description?: string;
86
+ price?: number;
87
+ isPayable?: boolean;
88
+ }>;
89
+ }>;
90
+ count: number;
91
+ hasMore: boolean;
92
+ }
93
+ export declare function listApis(limit?: number, offset?: number): Promise<ListApisResponse>;
74
94
  export declare function search(prompt: string, limit?: number): Promise<SearchResponse>;
75
95
  export interface ApiBySlugResponse {
76
96
  success: boolean;
package/dist/api.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.apiRequest = apiRequest;
4
+ exports.listApis = listApis;
4
5
  exports.search = search;
5
6
  exports.getApiBySlug = getApiBySlug;
6
7
  exports.getDetails = getDetails;
@@ -54,6 +55,9 @@ async function apiRequest(endpoint, options = {}) {
54
55
  // Return the whole response, not just data field
55
56
  return data;
56
57
  }
58
+ async function listApis(limit = 100, offset = 0) {
59
+ return apiRequest(`/list-endpoints?limit=${limit}&offset=${offset}`);
60
+ }
57
61
  async function search(prompt, limit = 10) {
58
62
  return apiRequest("/search", {
59
63
  method: "POST",
@@ -11,32 +11,41 @@ async function apiCommand(slug, path, options) {
11
11
  const spinner = (0, ora_1.default)("Loading...").start();
12
12
  try {
13
13
  if (!slug) {
14
- // List all APIs - search multiple terms to get broader coverage
15
- const searches = await Promise.all([
16
- (0, api_js_1.search)("api", 50),
17
- (0, api_js_1.search)("data", 50),
18
- (0, api_js_1.search)("search", 50),
19
- (0, api_js_1.search)("email", 50),
20
- ]);
21
- spinner.stop();
22
- // Merge and dedupe results
23
- const allResults = searches.flatMap(s => s.results || []);
24
- const data = {
25
- results: allResults,
26
- count: allResults.length,
27
- apisCount: new Set(allResults.map(r => r.slug)).size,
28
- };
29
- console.log(chalk_1.default.bold("\nAvailable APIs:\n"));
30
- const seen = new Set();
31
- for (const api of data.results) {
32
- if (!api.slug || seen.has(api.slug))
33
- continue;
34
- seen.add(api.slug);
35
- console.log(chalk_1.default.cyan.bold(api.slug.padEnd(20)) +
36
- chalk_1.default.white(api.name || "") +
37
- chalk_1.default.gray(` (${api.endpoints?.length || 0} endpoints)`));
14
+ // List all APIs using the list-endpoints endpoint
15
+ try {
16
+ const data = await (0, api_js_1.listApis)(500);
17
+ spinner.stop();
18
+ console.log(chalk_1.default.bold("\nAvailable APIs:\n"));
19
+ const apis = (data.apis || []).sort((a, b) => a.slug.localeCompare(b.slug));
20
+ for (const api of apis) {
21
+ console.log(chalk_1.default.cyan.bold(api.slug.padEnd(20)) +
22
+ chalk_1.default.white(api.name || "") +
23
+ chalk_1.default.gray(` (${api.endpoints?.length || 0} endpoints)`));
24
+ }
25
+ console.log(chalk_1.default.gray("\nRun 'orth api show <slug>' to see endpoints for an API"));
26
+ }
27
+ catch {
28
+ // Fallback to search-based listing if list-endpoints not available
29
+ const searches = await Promise.all([
30
+ (0, api_js_1.search)("api", 50),
31
+ (0, api_js_1.search)("data", 50),
32
+ (0, api_js_1.search)("search", 50),
33
+ (0, api_js_1.search)("email", 50),
34
+ ]);
35
+ spinner.stop();
36
+ const allResults = searches.flatMap(s => s.results || []);
37
+ console.log(chalk_1.default.bold("\nAvailable APIs:\n"));
38
+ const seen = new Set();
39
+ for (const api of allResults) {
40
+ if (!api.slug || seen.has(api.slug))
41
+ continue;
42
+ seen.add(api.slug);
43
+ console.log(chalk_1.default.cyan.bold(api.slug.padEnd(20)) +
44
+ chalk_1.default.white(api.name || "") +
45
+ chalk_1.default.gray(` (${api.endpoints?.length || 0} endpoints)`));
46
+ }
47
+ console.log(chalk_1.default.gray("\nRun 'orth api show <slug>' to see endpoints for an API"));
38
48
  }
39
- console.log(chalk_1.default.gray("\nRun 'orth api show <slug>' to see endpoints for an API"));
40
49
  return;
41
50
  }
42
51
  if (path) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@orth/cli",
3
- "version": "0.2.9",
3
+ "version": "0.2.11",
4
4
  "description": "CLI to access all APIs and skills on the Orthogonal platform",
5
5
  "main": "dist/index.js",
6
6
  "bin": {