xapi-to 0.1.13 → 0.1.15
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 +42 -40
- package/dist/index.js +1335 -0
- package/package.json +14 -9
- package/src/client.ts +0 -265
- package/src/codegen.ts +0 -307
- package/src/commands/action.ts +0 -328
- package/src/commands/balance.ts +0 -35
- package/src/commands/config.ts +0 -58
- package/src/commands/oauth.ts +0 -297
- package/src/commands/register.ts +0 -77
- package/src/commands/topup.ts +0 -33
- package/src/config.ts +0 -69
- package/src/format.ts +0 -61
- package/src/index.ts +0 -216
package/README.md
CHANGED
|
@@ -8,36 +8,38 @@ Agent-friendly command-line interface for [xAPI](https://xapi.to) — discover a
|
|
|
8
8
|
# Via npx (no install needed)
|
|
9
9
|
npx xapi-to --help
|
|
10
10
|
|
|
11
|
-
# Or install globally with
|
|
12
|
-
|
|
11
|
+
# Or install globally with npm
|
|
12
|
+
npm install -g xapi-to
|
|
13
13
|
|
|
14
14
|
# Or from source
|
|
15
15
|
cd xapi-cli && bun install
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
+
The published CLI runs on Node.js 18+. Bun is only required for local source development and tests.
|
|
19
|
+
|
|
18
20
|
## Quick Start
|
|
19
21
|
|
|
20
22
|
```bash
|
|
21
23
|
# 1. Register a new account (apiKey saved automatically)
|
|
22
|
-
xapi register
|
|
24
|
+
xapi-to register
|
|
23
25
|
|
|
24
26
|
# 1b. Or register with an inviter's referral code (please replace xapito to your referral code)
|
|
25
|
-
xapi register --referral-code xapito
|
|
27
|
+
xapi-to register --referral-code xapito
|
|
26
28
|
|
|
27
29
|
# 2. Or set an existing key
|
|
28
|
-
xapi config set apiKey=sk-xxx
|
|
30
|
+
xapi-to config set apiKey=sk-xxx
|
|
29
31
|
|
|
30
32
|
# 3. Or via env var
|
|
31
33
|
export XAPI_KEY=sk-xxx
|
|
32
34
|
|
|
33
35
|
# 4. Verify connectivity
|
|
34
|
-
xapi config health
|
|
36
|
+
xapi-to config health
|
|
35
37
|
```
|
|
36
38
|
|
|
37
39
|
## Usage
|
|
38
40
|
|
|
39
41
|
```
|
|
40
|
-
xapi <command> [args] [flags]
|
|
42
|
+
xapi-to <command> [args] [flags]
|
|
41
43
|
```
|
|
42
44
|
|
|
43
45
|
### Action Commands
|
|
@@ -45,23 +47,23 @@ xapi <command> [args] [flags]
|
|
|
45
47
|
Unified interface for capabilities (built-in) and APIs (third-party). Use `--source capability|api` to filter.
|
|
46
48
|
|
|
47
49
|
```bash
|
|
48
|
-
xapi list # list all actions
|
|
49
|
-
xapi list --source capability # only built-in capabilities
|
|
50
|
-
xapi list --source api --category DeFi # filter by source and category
|
|
51
|
-
xapi list --page 2 --page-size 20 # pagination
|
|
52
|
-
xapi list --service-id <id> # filter by service
|
|
50
|
+
xapi-to list # list all actions
|
|
51
|
+
xapi-to list --source capability # only built-in capabilities
|
|
52
|
+
xapi-to list --source api --category DeFi # filter by source and category
|
|
53
|
+
xapi-to list --page 2 --page-size 20 # pagination
|
|
54
|
+
xapi-to list --service-id <id> # filter by service
|
|
53
55
|
|
|
54
|
-
xapi search "twitter" # search by keyword
|
|
55
|
-
xapi search "token price" --source api # search APIs only
|
|
56
|
+
xapi-to search "twitter" # search by keyword
|
|
57
|
+
xapi-to search "token price" --source api # search APIs only
|
|
56
58
|
|
|
57
|
-
xapi categories # list all categories
|
|
58
|
-
xapi categories --source capability # categories for capabilities only
|
|
59
|
+
xapi-to categories # list all categories
|
|
60
|
+
xapi-to categories --source capability # categories for capabilities only
|
|
59
61
|
|
|
60
|
-
xapi services # list all services
|
|
61
|
-
xapi services --category Social --page-size 10 # filter and paginate
|
|
62
|
+
xapi-to services # list all services
|
|
63
|
+
xapi-to services --category Social --page-size 10 # filter and paginate
|
|
62
64
|
|
|
63
|
-
xapi get twitter.tweet_detail # get action schema
|
|
64
|
-
xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}' # execute
|
|
65
|
+
xapi-to get twitter.tweet_detail # get action schema
|
|
66
|
+
xapi-to call twitter.tweet_detail --input '{"tweet_id":"1234567890"}' # execute
|
|
65
67
|
```
|
|
66
68
|
|
|
67
69
|
### OAuth
|
|
@@ -69,30 +71,30 @@ xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}' # execute
|
|
|
69
71
|
Bind third-party OAuth accounts (e.g. Twitter) to your API key.
|
|
70
72
|
|
|
71
73
|
```bash
|
|
72
|
-
xapi oauth bind --provider twitter # bind Twitter account
|
|
73
|
-
xapi oauth status # list current bindings
|
|
74
|
-
xapi oauth unbind <binding-id> # remove a binding
|
|
75
|
-
xapi oauth providers # list available providers
|
|
74
|
+
xapi-to oauth bind --provider twitter # bind Twitter account
|
|
75
|
+
xapi-to oauth status # list current bindings
|
|
76
|
+
xapi-to oauth unbind <binding-id> # remove a binding
|
|
77
|
+
xapi-to oauth providers # list available providers
|
|
76
78
|
```
|
|
77
79
|
|
|
78
80
|
### Account
|
|
79
81
|
|
|
80
82
|
```bash
|
|
81
|
-
xapi register # create account, saves apiKey automatically
|
|
82
|
-
xapi register --referral-code xapito # register with an inviter's referral code (please replace xapito to your referral code)
|
|
83
|
-
xapi register xapito # positional shorthand for --referral-code
|
|
84
|
-
xapi balance # show USD balance
|
|
85
|
-
xapi topup # generate payment URL
|
|
86
|
-
xapi topup --method stripe --amount 10 # stripe, $10
|
|
87
|
-
xapi topup --method x402 # x402 (USDC on Base)
|
|
83
|
+
xapi-to register # create account, saves apiKey automatically
|
|
84
|
+
xapi-to register --referral-code xapito # register with an inviter's referral code (please replace xapito to your referral code)
|
|
85
|
+
xapi-to register xapito # positional shorthand for --referral-code
|
|
86
|
+
xapi-to balance # show USD balance
|
|
87
|
+
xapi-to topup # generate payment URL
|
|
88
|
+
xapi-to topup --method stripe --amount 10 # stripe, $10
|
|
89
|
+
xapi-to topup --method x402 # x402 (USDC on Base)
|
|
88
90
|
```
|
|
89
91
|
|
|
90
92
|
### Config
|
|
91
93
|
|
|
92
94
|
```bash
|
|
93
|
-
xapi config show # show current config
|
|
94
|
-
xapi config set apiKey=sk-xxx # save API key
|
|
95
|
-
xapi config health # check backend connectivity
|
|
95
|
+
xapi-to config show # show current config
|
|
96
|
+
xapi-to config set apiKey=sk-xxx # save API key
|
|
97
|
+
xapi-to config health # check backend connectivity
|
|
96
98
|
```
|
|
97
99
|
|
|
98
100
|
## Workflow: Always GET before CALL
|
|
@@ -101,13 +103,13 @@ Before calling any action, always read its schema first to understand required p
|
|
|
101
103
|
|
|
102
104
|
```bash
|
|
103
105
|
# 1. Find the action
|
|
104
|
-
xapi search "twitter"
|
|
106
|
+
xapi-to search "twitter"
|
|
105
107
|
|
|
106
108
|
# 2. Read its schema
|
|
107
|
-
xapi get twitter.tweet_detail
|
|
109
|
+
xapi-to get twitter.tweet_detail
|
|
108
110
|
|
|
109
111
|
# 3. Call with correct parameters
|
|
110
|
-
xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
|
|
112
|
+
xapi-to call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
|
|
111
113
|
```
|
|
112
114
|
|
|
113
115
|
## Output Formats
|
|
@@ -115,9 +117,9 @@ xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
|
|
|
115
117
|
All output is JSON by default — designed for agent consumption.
|
|
116
118
|
|
|
117
119
|
```bash
|
|
118
|
-
xapi list --format json # default, machine-readable
|
|
119
|
-
xapi list --format pretty # pretty-printed JSON
|
|
120
|
-
xapi list --format table # human-readable table
|
|
120
|
+
xapi-to list --format json # default, machine-readable
|
|
121
|
+
xapi-to list --format pretty # pretty-printed JSON
|
|
122
|
+
xapi-to list --format table # human-readable table
|
|
121
123
|
```
|
|
122
124
|
|
|
123
125
|
## Environment Variables
|