@caravo/cli 0.2.0 → 0.2.1

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
@@ -29,7 +29,7 @@ caravo review EXECUTION_ID --rating 5 --comment "Great quality"
29
29
  # Upvote an existing review
30
30
  caravo upvote REVIEW_ID --exec EXECUTION_ID
31
31
 
32
- # Manage favorites (requires API key)
32
+ # Manage favorites (works with or without API key)
33
33
  caravo fav list
34
34
  caravo fav add fal-ai/flux/schnell
35
35
  caravo fav rm fal-ai/flux/schnell
package/dist/cli.js CHANGED
@@ -169,11 +169,16 @@ function parseArgs(argv) {
169
169
  else if (!arg.startsWith("-")) {
170
170
  args.positional.push(arg);
171
171
  }
172
+ else {
173
+ // Unknown flag
174
+ process.stderr.write(`[caravo] unknown option: ${arg}\n`);
175
+ process.exit(1);
176
+ }
172
177
  i++;
173
178
  }
174
179
  return args;
175
180
  }
176
- const VERSION = "0.2.0";
181
+ const VERSION = "0.2.1";
177
182
  async function main() {
178
183
  const args = parseArgs(process.argv.slice(2));
179
184
  if (args.version) {
@@ -218,8 +223,14 @@ async function main() {
218
223
  break;
219
224
  }
220
225
  case "exec": {
221
- const { run } = await import("./commands/exec.js");
222
- await run(args.positional[0], args.data, auth, args.compact);
226
+ if (args.dryRun) {
227
+ const { runDryRun } = await import("./commands/exec.js");
228
+ await runDryRun(args.positional[0], args.data, auth, args.compact);
229
+ }
230
+ else {
231
+ const { run } = await import("./commands/exec.js");
232
+ await run(args.positional[0], args.data, auth, args.compact);
233
+ }
223
234
  break;
224
235
  }
225
236
  case "dry-run": {
@@ -26,7 +26,18 @@ function localList(compact) {
26
26
  const data = { data: favorites.map((id) => ({ id })), total: favorites.length };
27
27
  outputJson(data, compact);
28
28
  }
29
- function localAdd(toolId) {
29
+ async function localAdd(toolId, baseUrl) {
30
+ // Verify tool exists on server before adding
31
+ try {
32
+ const r = await fetch(`${baseUrl}/api/tools/${toolId}`);
33
+ if (r.status === 404) {
34
+ log(`Tool not found: ${toolId}`);
35
+ process.exit(1);
36
+ }
37
+ }
38
+ catch {
39
+ // Network error — allow offline add
40
+ }
30
41
  const favs = readLocal();
31
42
  if (favs.favorites.includes(toolId)) {
32
43
  log(`${toolId} is already in favorites`);
@@ -90,7 +101,7 @@ export async function run(sub, toolId, auth, compact) {
90
101
  }
91
102
  // No API key → local mode
92
103
  log("[local mode — set CARAVO_API_KEY to sync with server]");
93
- return runLocal(sub, toolId, compact);
104
+ return runLocal(sub, toolId, compact, auth.baseUrl);
94
105
  }
95
106
  async function runServer(sub, toolId, auth, compact) {
96
107
  switch (sub) {
@@ -132,7 +143,7 @@ async function runServer(sub, toolId, auth, compact) {
132
143
  process.exit(1);
133
144
  }
134
145
  }
135
- function runLocal(sub, toolId, compact) {
146
+ async function runLocal(sub, toolId, compact, baseUrl) {
136
147
  switch (sub) {
137
148
  case "list":
138
149
  localList(compact);
@@ -147,7 +158,7 @@ function runLocal(sub, toolId, compact) {
147
158
  log(err);
148
159
  process.exit(1);
149
160
  }
150
- localAdd(toolId);
161
+ await localAdd(toolId, baseUrl);
151
162
  break;
152
163
  }
153
164
  case "rm": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caravo/cli",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Caravo CLI — search, execute, and review tools with API key or x402 USDC payments",
5
5
  "type": "module",
6
6
  "bin": {