xapi-to 0.1.14 → 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.
Files changed (3) hide show
  1. package/README.md +38 -38
  2. package/dist/index.js +63 -63
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -21,25 +21,25 @@ The published CLI runs on Node.js 18+. Bun is only required for local source dev
21
21
 
22
22
  ```bash
23
23
  # 1. Register a new account (apiKey saved automatically)
24
- xapi register
24
+ xapi-to register
25
25
 
26
26
  # 1b. Or register with an inviter's referral code (please replace xapito to your referral code)
27
- xapi register --referral-code xapito
27
+ xapi-to register --referral-code xapito
28
28
 
29
29
  # 2. Or set an existing key
30
- xapi config set apiKey=sk-xxx
30
+ xapi-to config set apiKey=sk-xxx
31
31
 
32
32
  # 3. Or via env var
33
33
  export XAPI_KEY=sk-xxx
34
34
 
35
35
  # 4. Verify connectivity
36
- xapi config health
36
+ xapi-to config health
37
37
  ```
38
38
 
39
39
  ## Usage
40
40
 
41
41
  ```
42
- xapi <command> [args] [flags]
42
+ xapi-to <command> [args] [flags]
43
43
  ```
44
44
 
45
45
  ### Action Commands
@@ -47,23 +47,23 @@ xapi <command> [args] [flags]
47
47
  Unified interface for capabilities (built-in) and APIs (third-party). Use `--source capability|api` to filter.
48
48
 
49
49
  ```bash
50
- xapi list # list all actions
51
- xapi list --source capability # only built-in capabilities
52
- xapi list --source api --category DeFi # filter by source and category
53
- xapi list --page 2 --page-size 20 # pagination
54
- 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
55
55
 
56
- xapi search "twitter" # search by keyword
57
- 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
58
58
 
59
- xapi categories # list all categories
60
- 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
61
61
 
62
- xapi services # list all services
63
- 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
64
64
 
65
- xapi get twitter.tweet_detail # get action schema
66
- 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
67
67
  ```
68
68
 
69
69
  ### OAuth
@@ -71,30 +71,30 @@ xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}' # execute
71
71
  Bind third-party OAuth accounts (e.g. Twitter) to your API key.
72
72
 
73
73
  ```bash
74
- xapi oauth bind --provider twitter # bind Twitter account
75
- xapi oauth status # list current bindings
76
- xapi oauth unbind <binding-id> # remove a binding
77
- 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
78
78
  ```
79
79
 
80
80
  ### Account
81
81
 
82
82
  ```bash
83
- xapi register # create account, saves apiKey automatically
84
- xapi register --referral-code xapito # register with an inviter's referral code (please replace xapito to your referral code)
85
- xapi register xapito # positional shorthand for --referral-code
86
- xapi balance # show USD balance
87
- xapi topup # generate payment URL
88
- xapi topup --method stripe --amount 10 # stripe, $10
89
- 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)
90
90
  ```
91
91
 
92
92
  ### Config
93
93
 
94
94
  ```bash
95
- xapi config show # show current config
96
- xapi config set apiKey=sk-xxx # save API key
97
- 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
98
98
  ```
99
99
 
100
100
  ## Workflow: Always GET before CALL
@@ -103,13 +103,13 @@ Before calling any action, always read its schema first to understand required p
103
103
 
104
104
  ```bash
105
105
  # 1. Find the action
106
- xapi search "twitter"
106
+ xapi-to search "twitter"
107
107
 
108
108
  # 2. Read its schema
109
- xapi get twitter.tweet_detail
109
+ xapi-to get twitter.tweet_detail
110
110
 
111
111
  # 3. Call with correct parameters
112
- xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
112
+ xapi-to call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
113
113
  ```
114
114
 
115
115
  ## Output Formats
@@ -117,9 +117,9 @@ xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
117
117
  All output is JSON by default — designed for agent consumption.
118
118
 
119
119
  ```bash
120
- xapi list --format json # default, machine-readable
121
- xapi list --format pretty # pretty-printed JSON
122
- 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
123
123
  ```
124
124
 
125
125
  ## Environment Variables
package/dist/index.js CHANGED
@@ -131,7 +131,7 @@ async function request(url, options, timeoutMs = DEFAULT_TIMEOUT_MS) {
131
131
  }
132
132
  if (data?.error === "OAuth Required" || data?.statusCode === 403 && data?.message?.includes("OAuth")) {
133
133
  throw new Error(
134
- (data.message || "OAuth authorization required") + '. Run "xapi oauth bind" to connect your account.'
134
+ (data.message || "OAuth authorization required") + '. Run "xapi-to oauth bind" to connect your account.'
135
135
  );
136
136
  }
137
137
  }
@@ -528,10 +528,10 @@ function generateCode(target, params) {
528
528
 
529
529
  // src/commands/action.ts
530
530
  var VALID_SOURCES = ["capability", "api"];
531
- var LIST_HELP = `xapi list - List all actions
531
+ var LIST_HELP = `xapi-to list - List all actions
532
532
 
533
533
  USAGE
534
- xapi list [flags]
534
+ xapi-to list [flags]
535
535
 
536
536
  FLAGS
537
537
  --source capability|api Filter by source type
@@ -542,14 +542,14 @@ FLAGS
542
542
  --format json|pretty|table Output format
543
543
 
544
544
  EXAMPLES
545
- xapi list
546
- xapi list --source api --format table
547
- xapi list --category social --page 2
545
+ xapi-to list
546
+ xapi-to list --source api --format table
547
+ xapi-to list --category social --page 2
548
548
  `;
549
- var SEARCH_HELP = `xapi search - Search actions by keyword
549
+ var SEARCH_HELP = `xapi-to search - Search actions by keyword
550
550
 
551
551
  USAGE
552
- xapi search <query> [flags]
552
+ xapi-to search <query> [flags]
553
553
 
554
554
  FLAGS
555
555
  --source capability|api Filter by source type
@@ -559,14 +559,14 @@ FLAGS
559
559
  --format json|pretty|table Output format
560
560
 
561
561
  EXAMPLES
562
- xapi search twitter
563
- xapi search "tweet detail" --source api
564
- xapi search weather --category utility --format table
562
+ xapi-to search twitter
563
+ xapi-to search "tweet detail" --source api
564
+ xapi-to search weather --category utility --format table
565
565
  `;
566
- var GET_HELP = `xapi get - Get action schema
566
+ var GET_HELP = `xapi-to get - Get action schema
567
567
 
568
568
  USAGE
569
- xapi get <id> [flags]
569
+ xapi-to get <id> [flags]
570
570
 
571
571
  FLAGS
572
572
  --method GET|POST|... Filter by HTTP method
@@ -591,15 +591,15 @@ CODE TARGETS
591
591
  go Go (net/http)
592
592
 
593
593
  EXAMPLES
594
- xapi get twitter.tweet_detail
595
- xapi get twitter.tweet_detail --method POST
596
- xapi get twitter.tweet_detail --code curl
597
- xapi get twitter.tweet_detail --code python.httpx --format pretty
594
+ xapi-to get twitter.tweet_detail
595
+ xapi-to get twitter.tweet_detail --method POST
596
+ xapi-to get twitter.tweet_detail --code curl
597
+ xapi-to get twitter.tweet_detail --code python.httpx --format pretty
598
598
  `;
599
- var CALL_HELP = `xapi call - Execute an action
599
+ var CALL_HELP = `xapi-to call - Execute an action
600
600
 
601
601
  USAGE
602
- xapi call <id> --input '{"key":"val"}' [flags]
602
+ xapi-to call <id> --input '{"key":"val"}' [flags]
603
603
 
604
604
  FLAGS
605
605
  --input <json> Input payload as JSON (required for execution)
@@ -625,9 +625,9 @@ CODE TARGETS
625
625
  go Go (net/http)
626
626
 
627
627
  EXAMPLES
628
- xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
629
- xapi call twitter.tweet_detail --input '{"tweet_id":"123"}' --code py
630
- xapi call twitter.tweet_detail --input '{"tweet_id":"123"}' --code curl --format pretty
628
+ xapi-to call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
629
+ xapi-to call twitter.tweet_detail --input '{"tweet_id":"123"}' --code py
630
+ xapi-to call twitter.tweet_detail --input '{"tweet_id":"123"}' --code curl --format pretty
631
631
  `;
632
632
  function showHelpIfRequested(flags, helpText) {
633
633
  if (flags.help) {
@@ -688,7 +688,7 @@ async function actionList2(args, flags) {
688
688
  async function actionSearch2(args, flags) {
689
689
  showHelpIfRequested(flags, SEARCH_HELP);
690
690
  const query = args[0];
691
- if (!query) err("usage: xapi search <query>");
691
+ if (!query) err("usage: xapi-to search <query>");
692
692
  const cfg = getConfig();
693
693
  try {
694
694
  const res = await actionSearch(query, cfg, {
@@ -756,7 +756,7 @@ async function actionServices2(args, flags) {
756
756
  async function actionGet2(args, flags) {
757
757
  showHelpIfRequested(flags, GET_HELP);
758
758
  const id = args[0];
759
- if (!id) err("usage: xapi get <id> [--method GET|POST|DELETE|...]");
759
+ if (!id) err("usage: xapi-to get <id> [--method GET|POST|DELETE|...]");
760
760
  if (flags.code) validateCodeFlag(flags);
761
761
  const cfg = getConfig();
762
762
  try {
@@ -788,7 +788,7 @@ async function actionGet2(args, flags) {
788
788
  async function actionCall2(args, flags) {
789
789
  showHelpIfRequested(flags, CALL_HELP);
790
790
  const id = args[0];
791
- if (!id) err(`usage: xapi call <id> --input '{"key":"val"}'`);
791
+ if (!id) err(`usage: xapi-to call <id> --input '{"key":"val"}'`);
792
792
  if (flags.code) validateCodeFlag(flags);
793
793
  const cfg = getConfig();
794
794
  let input = {};
@@ -826,29 +826,29 @@ __export(config_exports, {
826
826
  configSet: () => configSet,
827
827
  configShow: () => configShow
828
828
  });
829
- var CONFIG_HELP = `xapi config - Manage CLI configuration
829
+ var CONFIG_HELP = `xapi-to config - Manage CLI configuration
830
830
 
831
831
  USAGE
832
- xapi config <command> [flags]
832
+ xapi-to config <command> [flags]
833
833
 
834
834
  COMMANDS
835
835
  show Show current config (host, apiKey path, etc.)
836
836
  set apiKey=<key> Save API key to ~/.xapi/config.json
837
- health Check backend connectivity (alias: xapi health)
837
+ health Check backend connectivity (alias: xapi-to health)
838
838
 
839
839
  FLAGS
840
840
  --format json|pretty|table Output format
841
841
 
842
842
  EXAMPLES
843
- xapi config show
844
- xapi config set apiKey=xapi_abc123
845
- xapi config health
843
+ xapi-to config show
844
+ xapi-to config set apiKey=xapi_abc123
845
+ xapi-to config health
846
846
  `;
847
847
  async function configShow(args, flags) {
848
848
  showConfig();
849
849
  }
850
850
  async function configSet(args, flags) {
851
- if (args.length === 0) err("usage: xapi config set apiKey=<key>");
851
+ if (args.length === 0) err("usage: xapi-to config set apiKey=<key>");
852
852
  const updates = {};
853
853
  for (const arg of args) {
854
854
  const eq = arg.indexOf("=");
@@ -1016,10 +1016,10 @@ async function findCurrentKeyRecord(plaintextKey, jwtToken) {
1016
1016
  }
1017
1017
  return match;
1018
1018
  }
1019
- var OAUTH_HELP = `xapi oauth - Manage OAuth bindings
1019
+ var OAUTH_HELP = `xapi-to oauth - Manage OAuth bindings
1020
1020
 
1021
1021
  USAGE
1022
- xapi oauth <command> [flags]
1022
+ xapi-to oauth <command> [flags]
1023
1023
 
1024
1024
  COMMANDS
1025
1025
  bind [--provider <name>] Bind an OAuth account to your API key
@@ -1032,12 +1032,12 @@ FLAGS
1032
1032
  --format json|pretty|table Output format
1033
1033
 
1034
1034
  EXAMPLES
1035
- xapi oauth bind
1036
- xapi oauth bind --provider twitter
1037
- xapi oauth status
1038
- xapi oauth status --format pretty
1039
- xapi oauth unbind abc123
1040
- xapi oauth providers
1035
+ xapi-to oauth bind
1036
+ xapi-to oauth bind --provider twitter
1037
+ xapi-to oauth status
1038
+ xapi-to oauth status --format pretty
1039
+ xapi-to oauth unbind abc123
1040
+ xapi-to oauth providers
1041
1041
  `;
1042
1042
  async function oauthBind(args, flags) {
1043
1043
  const cfg = getConfig();
@@ -1086,7 +1086,7 @@ async function oauthBind(args, flags) {
1086
1086
  `);
1087
1087
  output({ status: "success", provider: provider.name, account }, flags.format);
1088
1088
  } else {
1089
- err("oauth bind timed out", 'Authorization was not completed within 5 minutes. Run "xapi oauth bind" again.');
1089
+ err("oauth bind timed out", 'Authorization was not completed within 5 minutes. Run "xapi-to oauth bind" again.');
1090
1090
  }
1091
1091
  } else {
1092
1092
  output({
@@ -1110,7 +1110,7 @@ async function oauthStatus(args, flags) {
1110
1110
  if (!Array.isArray(bindings) || bindings.length === 0) {
1111
1111
  output({
1112
1112
  status: "no_bindings",
1113
- message: 'No OAuth bindings found. Run "xapi oauth bind" to connect an account.'
1113
+ message: 'No OAuth bindings found. Run "xapi-to oauth bind" to connect an account.'
1114
1114
  }, flags.format);
1115
1115
  return;
1116
1116
  }
@@ -1137,7 +1137,7 @@ async function oauthUnbind(args, flags) {
1137
1137
  const apiKey = cfg.apiKey;
1138
1138
  const bindingId = args[0];
1139
1139
  if (!bindingId) {
1140
- err("usage: xapi oauth unbind <binding-id>", 'Get the binding ID from "xapi oauth status"');
1140
+ err("usage: xapi-to oauth unbind <binding-id>", 'Get the binding ID from "xapi-to oauth status"');
1141
1141
  }
1142
1142
  try {
1143
1143
  const jwtToken = await loginAndGetJwt(apiKey);
@@ -1182,10 +1182,10 @@ function parseArgs(argv) {
1182
1182
  }
1183
1183
  return { positional, flags };
1184
1184
  }
1185
- var HELP = `xapi - agent-friendly CLI for xapi
1185
+ var HELP = `xapi-to - agent-friendly CLI for xapi
1186
1186
 
1187
1187
  USAGE
1188
- xapi <command> [args] [flags]
1188
+ xapi-to <command> [args] [flags]
1189
1189
 
1190
1190
  COMMANDS
1191
1191
  list List all actions
@@ -1223,11 +1223,11 @@ COMMANDS
1223
1223
 
1224
1224
  config show Show current config
1225
1225
  config set apiKey=<key> Save API key to ~/.xapi/config.json
1226
- config health Check backend connectivity (alias: xapi health)
1226
+ config health Check backend connectivity (alias: xapi-to health)
1227
1227
 
1228
1228
  GLOBAL FLAGS
1229
1229
  --format json|pretty|table Output format (default: json)
1230
- --help Show help (use with a command for details, e.g. xapi get --help)
1230
+ --help Show help (use with a command for details, e.g. xapi-to get --help)
1231
1231
 
1232
1232
  ENV VARS
1233
1233
  XAPI_KEY API key (header: XAPI-Key)
@@ -1235,21 +1235,21 @@ ENV VARS
1235
1235
  XAPI_OUTPUT Default output format
1236
1236
 
1237
1237
  EXAMPLES
1238
- xapi register
1239
- xapi register --referral-code xapito # register with an inviter's referral code
1240
- xapi register xapito # positional shorthand
1241
- xapi list --format table
1242
- xapi list --source capability
1243
- xapi search twitter --source api
1244
- xapi get twitter.tweet_detail
1245
- xapi get twitter.tweet_detail --code curl
1246
- xapi get twitter.tweet_detail --code py --format pretty
1247
- xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
1248
- xapi call twitter.tweet_detail --input '{"tweet_id":"1234567890"}' --code python
1249
- xapi categories
1250
- xapi services --format table
1251
- xapi config set apiKey=xapi_abc123
1252
- xapi health
1238
+ xapi-to register
1239
+ xapi-to register --referral-code xapito # register with an inviter's referral code
1240
+ xapi-to register xapito # positional shorthand
1241
+ xapi-to list --format table
1242
+ xapi-to list --source capability
1243
+ xapi-to search twitter --source api
1244
+ xapi-to get twitter.tweet_detail
1245
+ xapi-to get twitter.tweet_detail --code curl
1246
+ xapi-to get twitter.tweet_detail --code py --format pretty
1247
+ xapi-to call twitter.tweet_detail --input '{"tweet_id":"1234567890"}'
1248
+ xapi-to call twitter.tweet_detail --input '{"tweet_id":"1234567890"}' --code python
1249
+ xapi-to categories
1250
+ xapi-to services --format table
1251
+ xapi-to config set apiKey=xapi_abc123
1252
+ xapi-to health
1253
1253
  `;
1254
1254
  async function main() {
1255
1255
  const { positional, flags } = parseArgs(process.argv.slice(2));
@@ -1325,7 +1325,7 @@ async function main() {
1325
1325
  break;
1326
1326
  }
1327
1327
  default:
1328
- console.error(JSON.stringify({ error: `unknown command: ${cmd}`, hint: "run xapi --help" }));
1328
+ console.error(JSON.stringify({ error: `unknown command: ${cmd}`, hint: "run xapi-to --help" }));
1329
1329
  process.exit(1);
1330
1330
  }
1331
1331
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xapi-to",
3
- "version": "0.1.14",
3
+ "version": "0.1.15",
4
4
  "description": "Agent-friendly CLI for xapi - discover and call capabilities and APIs",
5
5
  "type": "module",
6
6
  "bin": {