@caravo/cli 0.2.2 → 0.2.3
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/cli.js +6 -0
- package/dist/commands/logout.js +30 -0
- package/package.json +11 -2
package/dist/cli.js
CHANGED
|
@@ -23,6 +23,7 @@ Commands:
|
|
|
23
23
|
Submit a tool request
|
|
24
24
|
request-upvote <req-id> Upvote a tool request
|
|
25
25
|
login Connect your Caravo account via browser (saves API key)
|
|
26
|
+
logout Disconnect account and switch to x402 wallet payments
|
|
26
27
|
wallet Show wallet + balance info
|
|
27
28
|
fetch [METHOD] <url> Raw x402 HTTP request
|
|
28
29
|
|
|
@@ -288,6 +289,11 @@ async function main() {
|
|
|
288
289
|
await runLogin(auth.baseUrl);
|
|
289
290
|
break;
|
|
290
291
|
}
|
|
292
|
+
case "logout": {
|
|
293
|
+
const { runLogout } = await import("./commands/logout.js");
|
|
294
|
+
runLogout();
|
|
295
|
+
break;
|
|
296
|
+
}
|
|
291
297
|
case "wallet": {
|
|
292
298
|
const { run } = await import("./commands/wallet-cmd.js");
|
|
293
299
|
await run(auth, args.compact);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
2
|
+
import { homedir } from "os";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
const CONFIG_DIR = join(homedir(), ".caravo");
|
|
5
|
+
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
6
|
+
function loadConfig() {
|
|
7
|
+
try {
|
|
8
|
+
if (!existsSync(CONFIG_FILE))
|
|
9
|
+
return {};
|
|
10
|
+
return JSON.parse(readFileSync(CONFIG_FILE, "utf-8"));
|
|
11
|
+
}
|
|
12
|
+
catch {
|
|
13
|
+
return {};
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
function saveConfig(data) {
|
|
17
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
18
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(data, null, 2), { mode: 0o600 });
|
|
19
|
+
}
|
|
20
|
+
export function runLogout() {
|
|
21
|
+
const config = loadConfig();
|
|
22
|
+
if (!config.api_key) {
|
|
23
|
+
process.stdout.write("Not logged in — already using x402 wallet payments.\n");
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
delete config.api_key;
|
|
27
|
+
saveConfig(config);
|
|
28
|
+
process.stdout.write(`✓ Logged out. API key removed from ${CONFIG_FILE}\n`);
|
|
29
|
+
process.stdout.write(`Now using x402 wallet payments.\n`);
|
|
30
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@caravo/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Caravo CLI — search, execute, and review tools with API key or x402 USDC payments",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -17,7 +17,16 @@
|
|
|
17
17
|
"typescript": "^5.8.2",
|
|
18
18
|
"@types/node": "^22"
|
|
19
19
|
},
|
|
20
|
-
"keywords": [
|
|
20
|
+
"keywords": [
|
|
21
|
+
"caravo",
|
|
22
|
+
"marketplace",
|
|
23
|
+
"cli",
|
|
24
|
+
"x402",
|
|
25
|
+
"usdc",
|
|
26
|
+
"base",
|
|
27
|
+
"agent",
|
|
28
|
+
"mcp"
|
|
29
|
+
],
|
|
21
30
|
"repository": {
|
|
22
31
|
"type": "git",
|
|
23
32
|
"url": "https://github.com/Caravo-AI/Caravo-CLI"
|