@lidianai/cli 0.1.3 → 0.1.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.
package/README.md CHANGED
@@ -2,19 +2,41 @@
2
2
 
3
3
  Bun CLI for Lidian core REST endpoints.
4
4
 
5
- ## Install
5
+ ## Install & Run
6
+
7
+ ### Quick Run (no install)
6
8
 
7
9
  ```bash
8
10
  bunx @lidianai/cli --help
11
+ npm exec @lidianai/cli -- --help
12
+ ```
13
+
14
+ ### Global Install
15
+
16
+ ```bash
17
+ # bun
18
+ bun add -g @lidianai/cli
19
+
20
+ # npm
21
+ npm install -g @lidianai/cli
22
+
23
+ # yarn
24
+ yarn global add @lidianai/cli
25
+
26
+ # pnpm
27
+ pnpm add -g @lidianai/cli
28
+
29
+ # Then run
30
+ lidian --help
9
31
  ```
10
32
 
11
33
  ## Commands
12
34
 
13
35
  ```bash
14
- lidian discover --q "<term>" [--page 1] [--pageSize 1..3] [--category <name>] [--auth-type none|api_key|bearer|basic|oauth2|custom] [--min-price <cents>] [--max-price <cents>] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]
15
- lidian consume --endpoint-id <uuid> --params '<json>' [--payment-rail prepaid_credits|x402] [--network base|ethereum] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]
16
- lidian feedback --execution-id <uuid> --rank <0..10> [--feedback "<text>"] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]
17
- lidian account [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]
36
+ lidian discover --q "<term>" [--page 1] [--pageSize 1..3] [--category <name>] [--auth-type none|api_key|bearer|basic|oauth2|custom] [--min-price <cents>] [--max-price <cents>] [--env production|staging] [--api-base <url>] [--json]
37
+ lidian consume --endpoint-id <uuid> --params '<json>' [--payment-rail prepaid_credits|x402] [--network base|ethereum] [--env production|staging] [--api-base <url>] [--json]
38
+ lidian feedback --execution-id <uuid> --rank <0..10> [--feedback "<text>"] [--env production|staging] [--api-base <url>] [--json]
39
+ lidian account [--env production|staging] [--api-base <url>] [--json]
18
40
  lidian login [--key ld_...] [--json]
19
41
  lidian --help
20
42
  ```
package/dist/index.js CHANGED
@@ -144,7 +144,11 @@ var printDiscoverResult = (result, asJson) => {
144
144
  print(`Found ${result.items.length} of ${result.total} APIs (page ${result.page}).`);
145
145
  for (const item of result.items) {
146
146
  const confidence = item.matchPercent ? ` confidence=${item.matchPercent.toFixed(1)}%` : "";
147
- print(`- ${item.name} (${item.id}) auth=${item.authType} cost=${item.defaultCostPerUse}c (${formatUsd(item.defaultCostPerUse)})${confidence}`);
147
+ const modes = item.paymentModes.join(",");
148
+ print(`- ${item.name} (${item.id}) cost=${item.defaultCostPerUse}c (${formatUsd(item.defaultCostPerUse)}) executable=${String(item.isExecutable)} requiresClientAuth=${String(item.requiresClientAuth)} paymentModes=${modes}${confidence}`);
149
+ for (const endpoint of item.endpoints ?? []) {
150
+ print(` \xB7 endpoint=${endpoint.id} ${endpoint.method} ${endpoint.path} cost=${endpoint.pricingCents}c (${formatUsd(endpoint.pricingCents)})`);
151
+ }
148
152
  }
149
153
  };
150
154
  var printConsumeResult = (result, asJson) => {
@@ -463,11 +467,13 @@ var printUsage = () => {
463
467
  print("Usage:");
464
468
  print(" lidian login [--key ld_...] [--json]");
465
469
  print(' lidian discover --q "<term>" [--page 1] [--pageSize 1..3] [--category <name>] [--auth-type none|api_key|bearer|basic|oauth2|custom]');
466
- print(" [--min-price <cents>] [--max-price <cents>] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]");
467
- print(" lidian consume --endpoint-id <uuid> --params '<json>' [--payment-rail prepaid_credits|x402] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]");
468
- print(" [--network base|ethereum]");
469
- print(' lidian feedback --execution-id <uuid> --rank <0..10> [--feedback "<text>"] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]');
470
- print(" lidian account [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]");
470
+ print(" [--min-price <cents>] [--max-price <cents>] [--env production|staging] [--api-base <url>] [--json]");
471
+ print(" lidian consume --endpoint-id <uuid> --params '<json>' [--payment-rail prepaid_credits|x402] [--network base|ethereum] [--env production|staging] [--api-base <url>] [--json]");
472
+ print(' lidian feedback --execution-id <uuid> --rank <0..10> [--feedback "<text>"] [--env production|staging] [--api-base <url>] [--json]');
473
+ print(" lidian account [--env production|staging] [--api-base <url>] [--json]");
474
+ print("");
475
+ print("Auth (all optional):");
476
+ print(" --api-key <key> | LIDIAN_API_KEY | lidian login");
471
477
  print("");
472
478
  print("Env resolution:");
473
479
  print(" --api-base > LIDIAN_API_BASE > --env > LIDIAN_ENV > production");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lidianai/cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -18,12 +18,21 @@ export interface DiscoverApiResponse {
18
18
  name: string;
19
19
  description: string | null;
20
20
  endpointBase: string;
21
- authType: "none" | "api_key" | "bearer" | "basic" | "oauth2" | "custom";
22
21
  defaultCostPerUse: number;
23
22
  isActive: boolean;
23
+ requiresClientAuth: boolean;
24
+ paymentModes: Array<"x402" | "prepaid_credits">;
25
+ isExecutable: boolean;
24
26
  openapiSpecUrl: string | null;
25
27
  createdAt: string;
26
28
  updatedAt: string;
29
+ endpoints?: Array<{
30
+ id: string;
31
+ path: string;
32
+ method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS";
33
+ description?: string | null;
34
+ pricingCents: number;
35
+ }>;
27
36
  matchScore?: number;
28
37
  matchPercent?: number;
29
38
  }>;
package/src/index.ts CHANGED
@@ -209,19 +209,21 @@ const printUsage = (): void => {
209
209
  ' lidian discover --q "<term>" [--page 1] [--pageSize 1..3] [--category <name>] [--auth-type none|api_key|bearer|basic|oauth2|custom]',
210
210
  );
211
211
  print(
212
- " [--min-price <cents>] [--max-price <cents>] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]",
212
+ " [--min-price <cents>] [--max-price <cents>] [--env production|staging] [--api-base <url>] [--json]",
213
213
  );
214
214
  print(
215
- " lidian consume --endpoint-id <uuid> --params '<json>' [--payment-rail prepaid_credits|x402] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]",
215
+ " lidian consume --endpoint-id <uuid> --params '<json>' [--payment-rail prepaid_credits|x402] [--network base|ethereum] [--env production|staging] [--api-base <url>] [--json]",
216
216
  );
217
- print(" [--network base|ethereum]");
218
217
  print(
219
- ' lidian feedback --execution-id <uuid> --rank <0..10> [--feedback "<text>"] [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]',
218
+ ' lidian feedback --execution-id <uuid> --rank <0..10> [--feedback "<text>"] [--env production|staging] [--api-base <url>] [--json]',
220
219
  );
221
220
  print(
222
- " lidian account [--api-key <key>] [--env production|staging] [--api-base <url>] [--json]",
221
+ " lidian account [--env production|staging] [--api-base <url>] [--json]",
223
222
  );
224
223
  print("");
224
+ print("Auth (all optional):");
225
+ print(" --api-key <key> | LIDIAN_API_KEY | lidian login");
226
+ print("");
225
227
  print("Env resolution:");
226
228
  print(" --api-base > LIDIAN_API_BASE > --env > LIDIAN_ENV > production");
227
229
  print(` production=${API_BASE_BY_ENV.production}`);
package/src/lib/output.ts CHANGED
@@ -42,9 +42,15 @@ export const printDiscoverResult = (
42
42
  const confidence = item.matchPercent
43
43
  ? ` confidence=${item.matchPercent.toFixed(1)}%`
44
44
  : "";
45
+ const modes = item.paymentModes.join(",");
45
46
  print(
46
- `- ${item.name} (${item.id}) auth=${item.authType} cost=${item.defaultCostPerUse}c (${formatUsd(item.defaultCostPerUse)})${confidence}`,
47
+ `- ${item.name} (${item.id}) cost=${item.defaultCostPerUse}c (${formatUsd(item.defaultCostPerUse)}) executable=${String(item.isExecutable)} requiresClientAuth=${String(item.requiresClientAuth)} paymentModes=${modes}${confidence}`,
47
48
  );
49
+ for (const endpoint of item.endpoints ?? []) {
50
+ print(
51
+ ` · endpoint=${endpoint.id} ${endpoint.method} ${endpoint.path} cost=${endpoint.pricingCents}c (${formatUsd(endpoint.pricingCents)})`,
52
+ );
53
+ }
48
54
  }
49
55
  };
50
56