@bigknoxy/exa-cli 0.1.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.
Files changed (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +250 -0
  3. package/dist/commands/code.d.ts +23 -0
  4. package/dist/commands/code.d.ts.map +1 -0
  5. package/dist/commands/code.js +55 -0
  6. package/dist/commands/code.js.map +1 -0
  7. package/dist/commands/company.d.ts +26 -0
  8. package/dist/commands/company.d.ts.map +1 -0
  9. package/dist/commands/company.js +58 -0
  10. package/dist/commands/company.js.map +1 -0
  11. package/dist/commands/completion.d.ts +13 -0
  12. package/dist/commands/completion.d.ts.map +1 -0
  13. package/dist/commands/completion.js +423 -0
  14. package/dist/commands/completion.js.map +1 -0
  15. package/dist/commands/config.d.ts +23 -0
  16. package/dist/commands/config.d.ts.map +1 -0
  17. package/dist/commands/config.js +119 -0
  18. package/dist/commands/config.js.map +1 -0
  19. package/dist/commands/crawl.d.ts +23 -0
  20. package/dist/commands/crawl.d.ts.map +1 -0
  21. package/dist/commands/crawl.js +55 -0
  22. package/dist/commands/crawl.js.map +1 -0
  23. package/dist/commands/index.d.ts +10 -0
  24. package/dist/commands/index.d.ts.map +1 -0
  25. package/dist/commands/index.js +10 -0
  26. package/dist/commands/index.js.map +1 -0
  27. package/dist/commands/people.d.ts +26 -0
  28. package/dist/commands/people.d.ts.map +1 -0
  29. package/dist/commands/people.js +58 -0
  30. package/dist/commands/people.js.map +1 -0
  31. package/dist/commands/research.d.ts +6 -0
  32. package/dist/commands/research.d.ts.map +1 -0
  33. package/dist/commands/research.js +191 -0
  34. package/dist/commands/research.js.map +1 -0
  35. package/dist/commands/search-advanced.d.ts +64 -0
  36. package/dist/commands/search-advanced.d.ts.map +1 -0
  37. package/dist/commands/search-advanced.js +137 -0
  38. package/dist/commands/search-advanced.js.map +1 -0
  39. package/dist/commands/search.d.ts +36 -0
  40. package/dist/commands/search.d.ts.map +1 -0
  41. package/dist/commands/search.js +74 -0
  42. package/dist/commands/search.js.map +1 -0
  43. package/dist/index.d.ts +3 -0
  44. package/dist/index.js +23 -0
  45. package/dist/lib/config.d.ts +29 -0
  46. package/dist/lib/config.d.ts.map +1 -0
  47. package/dist/lib/config.js +62 -0
  48. package/dist/lib/config.js.map +1 -0
  49. package/dist/lib/mcp-client.d.ts +15 -0
  50. package/dist/lib/mcp-client.d.ts.map +1 -0
  51. package/dist/lib/mcp-client.js +103 -0
  52. package/dist/lib/mcp-client.js.map +1 -0
  53. package/dist/lib/output.d.ts +13 -0
  54. package/dist/lib/output.d.ts.map +1 -0
  55. package/dist/lib/output.js +167 -0
  56. package/dist/lib/output.js.map +1 -0
  57. package/dist/types.d.ts +76 -0
  58. package/dist/types.js +5 -0
  59. package/package.json +63 -0
@@ -0,0 +1,423 @@
1
+ /**
2
+ * Completion command - Generate shell completion scripts
3
+ */
4
+ import { defineCommand } from 'citty';
5
+ const SUBCOMMANDS = [
6
+ 'search',
7
+ 'search-advanced',
8
+ 'code',
9
+ 'crawl',
10
+ 'company',
11
+ 'people',
12
+ 'config',
13
+ 'research',
14
+ 'completion',
15
+ ];
16
+ const SUBCOMMANDS_LIST = SUBCOMMANDS.join(' ');
17
+ function generateBashCompletion() {
18
+ return `# exa bash completion
19
+ _exa_completion() {
20
+ local cur prev
21
+ COMPREPLY=()
22
+ cur="\${COMP_WORDS[COMP_CWORD]}"
23
+ prev="\${COMP_WORDS[COMP_CWORD-1]}"
24
+
25
+ # Subcommands
26
+ if [[ $COMP_CWORD -eq 1 ]]; then
27
+ COMPREPLY=($(compgen -W "${SUBCOMMANDS_LIST}" -- "$cur"))
28
+ return 0
29
+ fi
30
+
31
+ # Command-specific options
32
+ case "\${COMP_WORDS[1]}" in
33
+ search)
34
+ case "$prev" in
35
+ --num|--limit|-n)
36
+ return 0
37
+ ;;
38
+ --output|-o)
39
+ COMPREPLY=($(compgen -W "text json markdown" -- "$cur"))
40
+ return 0
41
+ ;;
42
+ --query|-q)
43
+ return 0
44
+ ;;
45
+ esac
46
+ ;;
47
+ search-advanced)
48
+ case "$prev" in
49
+ --num|--limit|-n)
50
+ return 0
51
+ ;;
52
+ --output|-o)
53
+ COMPREPLY=($(compgen -W "text json markdown" -- "$cur"))
54
+ return 0
55
+ ;;
56
+ esac
57
+ ;;
58
+ code)
59
+ case "$prev" in
60
+ --num|--limit|-n)
61
+ return 0
62
+ ;;
63
+ --output|-o)
64
+ COMPREPLY=($(compgen -W "text json markdown" -- "$cur"))
65
+ return 0
66
+ ;;
67
+ --language|-l)
68
+ COMPREPLY=($(compgen -W "javascript typescript python java go rust ruby php c cpp csharp" -- "$cur"))
69
+ return 0
70
+ ;;
71
+ esac
72
+ ;;
73
+ crawl)
74
+ case "$prev" in
75
+ --num|--limit|-n)
76
+ return 0
77
+ ;;
78
+ --output|-o)
79
+ COMPREPLY=($(compgen -W "text json markdown" -- "$cur"))
80
+ return 0
81
+ ;;
82
+ --max-depth|-d)
83
+ return 0
84
+ ;;
85
+ esac
86
+ ;;
87
+ company)
88
+ case "$prev" in
89
+ --num|--limit|-n)
90
+ return 0
91
+ ;;
92
+ --output|-o)
93
+ COMPREPLY=($(compgen -W "text json markdown" -- "$cur"))
94
+ return 0
95
+ ;;
96
+ esac
97
+ ;;
98
+ people)
99
+ case "$prev" in
100
+ --num|--limit|-n)
101
+ return 0
102
+ ;;
103
+ --output|-o)
104
+ COMPREPLY=($(compgen -W "text json markdown" -- "$cur"))
105
+ return 0
106
+ ;;
107
+ esac
108
+ ;;
109
+ config)
110
+ case "$prev" in
111
+ set)
112
+ COMPREPLY=($(compgen -W "apiKey output defaultNum" -- "$cur"))
113
+ return 0
114
+ ;;
115
+ get)
116
+ COMPREPLY=($(compgen -W "apiKey output defaultNum" -- "$cur"))
117
+ return 0
118
+ ;;
119
+ esac
120
+ ;;
121
+ research)
122
+ case "$prev" in
123
+ --num|--limit|-n)
124
+ return 0
125
+ ;;
126
+ --output|-o)
127
+ COMPREPLY=($(compgen -W "text json markdown" -- "$cur"))
128
+ return 0
129
+ ;;
130
+ esac
131
+ ;;
132
+ esac
133
+
134
+ # Global options
135
+ COMPREPLY=($(compgen -W "--help --version" -- "$cur"))
136
+ return 0
137
+ }
138
+
139
+ complete -F _exa_completion exa
140
+ `;
141
+ }
142
+ function generateZshCompletion() {
143
+ return `# exa zsh completion
144
+ #autoload -U compinit
145
+ #compinit
146
+
147
+ local -a _subcommands
148
+ _subcommands=(
149
+ 'search:Search the web'
150
+ 'search-advanced:Advanced search with filters'
151
+ 'code:Search for code'
152
+ 'crawl:Crawl URLs'
153
+ 'company:Search for companies'
154
+ 'people:Search for people'
155
+ 'config:Manage CLI configuration'
156
+ 'research:Research topics deeply'
157
+ 'completion:Generate shell completion scripts'
158
+ )
159
+
160
+ local -a _global_opts
161
+ _global_opts=(
162
+ '--help[Show help]'
163
+ '--version[Show version]'
164
+ )
165
+
166
+ local -a _search_opts
167
+ _search_opts=(
168
+ '--num[Number of results]:number:'
169
+ '--limit[Number of results]:number:'
170
+ '-n[Number of results]:number:'
171
+ '--output[Output format]:format:(text json markdown)'
172
+ '-o[Output format]:format:(text json markdown)'
173
+ '--query[Search query]:query:'
174
+ '-q[Search query]:query:'
175
+ )
176
+
177
+ local -a _code_opts
178
+ _code_opts=(
179
+ '--num[Number of results]:number:'
180
+ '--limit[Number of results]:number:'
181
+ '-n[Number of results]:number:'
182
+ '--output[Output format]:format:(text json markdown)'
183
+ '-o[Output format]:format:(text json markdown)'
184
+ '--language[Programming language]:language:(javascript typescript python java go rust ruby php c cpp csharp)'
185
+ '-l[Programming language]:language:(javascript typescript python java go rust ruby php c cpp csharp)'
186
+ '--query[Code search query]:query:'
187
+ '-q[Code search query]:query:'
188
+ )
189
+
190
+ local -a _crawl_opts
191
+ _crawl_opts=(
192
+ '--num[Number of results]:number:'
193
+ '--limit[Number of results]:number:'
194
+ '-n[Number of results]:number:'
195
+ '--output[Output format]:format:(text json markdown)'
196
+ '-o[Output format]:format:(text json markdown)'
197
+ '--max-depth[Crawl depth]:depth:'
198
+ '-d[Crawl depth]:depth:'
199
+ '--url[URL to crawl]:url:'
200
+ )
201
+
202
+ local -a _company_opts
203
+ _company_opts=(
204
+ '--num[Number of results]:number:'
205
+ '--limit[Number of results]:number:'
206
+ '-n[Number of results]:number:'
207
+ '--output[Output format]:format:(text json markdown)'
208
+ '-o[Output format]:format:(text json markdown)'
209
+ '--name[Company name]:name:'
210
+ )
211
+
212
+ local -a _people_opts
213
+ _people_opts=(
214
+ '--num[Number of results]:number:'
215
+ '--limit[Number of results]:number:'
216
+ '-n[Number of results]:number:'
217
+ '--output[Output format]:format:(text json markdown)'
218
+ '-o[Output format]:format:(text json markdown)'
219
+ '--name[Person name]:name:'
220
+ '--title[Job title]:title:'
221
+ '--company[Company name]:company:'
222
+ )
223
+
224
+ local -a _config_opts
225
+ _config_opts=(
226
+ 'set[Set a config value]'
227
+ 'get[Get a config value]'
228
+ 'list[List all config values]'
229
+ 'clear[Clear config]'
230
+ )
231
+
232
+ local -a _config_keys
233
+ _config_keys=(
234
+ 'apiKey[API key]'
235
+ 'output[Output format]'
236
+ 'defaultNum[Default number of results]'
237
+ )
238
+
239
+ _exa() {
240
+ local -a cmd
241
+ opts_help=('{-h,--help}'[Show help] '{-v,--version}'[Show version])
242
+
243
+ _arguments -C \\
244
+ '1: :_subcommands' \\
245
+ '*:: :->args' \\
246
+ && ret=0
247
+
248
+ case "\$words[1]" in
249
+ search)
250
+ _arguments "\${_search_opts[@]}" && ret=0
251
+ ;;
252
+ search-advanced)
253
+ _arguments "\${_search_opts[@]}" && ret=0
254
+ ;;
255
+ code)
256
+ _arguments "\${_code_opts[@]}" && ret=0
257
+ ;;
258
+ crawl)
259
+ _arguments "\${_crawl_opts[@]}" && ret=0
260
+ ;;
261
+ company)
262
+ _arguments "\${_company_opts[@]}" && ret=0
263
+ ;;
264
+ people)
265
+ _arguments "\${_people_opts[@]}" && ret=0
266
+ ;;
267
+ config)
268
+ _arguments "\${_config_opts[@]}" && ret=0
269
+ ;;
270
+ research)
271
+ _arguments "\${_search_opts[@]}" && ret=0
272
+ ;;
273
+ completion)
274
+ _arguments '1:shell:(bash zsh fish)' && ret=0
275
+ ;;
276
+ esac
277
+
278
+ return ret
279
+ }
280
+
281
+ _exa "$@"
282
+ `;
283
+ }
284
+ function generateFishCompletion() {
285
+ return `# exa fish completion
286
+
287
+ # Main completion function
288
+ complete -c exa -f -a 'search' -d 'Search the web'
289
+ complete -c exa -f -a 'search-advanced' -d 'Advanced search with filters'
290
+ complete -c exa -f -a 'code' -d 'Search for code'
291
+ complete -c exa -f -a 'crawl' -d 'Crawl URLs'
292
+ complete -c exa -f -a 'company' -d 'Search for companies'
293
+ complete -c exa -f -a 'people' -d 'Search for people'
294
+ complete -c exa -f -a 'config' -d 'Manage CLI configuration'
295
+ complete -c exa -f -a 'research' -d 'Research topics deeply'
296
+ complete -c exa -f -a 'completion' -d 'Generate shell completion scripts'
297
+
298
+ # Global options
299
+ complete -c exa -f -l help -d 'Show help'
300
+ complete -c exa -f -l version -d 'Show version'
301
+
302
+ # search command
303
+ complete -c exa -n '__fish_use_subcommand' -f -a 'search'
304
+ complete -c exa -n '__fish_seen_subcommand_from search' -l num -d 'Number of results' -r
305
+ complete -c exa -n '__fish_seen_subcommand_from search' -l limit -d 'Number of results' -r
306
+ complete -c exa -n '__fish_seen_subcommand_from search' -s n -d 'Number of results' -r
307
+ complete -c exa -n '__fish_seen_subcommand_from search' -l output -d 'Output format' -a 'text json markdown' -f
308
+ complete -c exa -n '__fish_seen_subcommand_from search' -s o -d 'Output format' -a 'text json markdown' -f
309
+ complete -c exa -n '__fish_seen_subcommand_from search' -l query -d 'Search query' -r
310
+ complete -c exa -n '__fish_seen_subcommand_from search' -s q -d 'Search query' -r
311
+
312
+ # search-advanced command
313
+ complete -c exa -n '__fish_use_subcommand' -f -a 'search-advanced'
314
+ complete -c exa -n '__fish_seen_subcommand_from search-advanced' -l num -d 'Number of results' -r
315
+ complete -c exa -n '__fish_seen_subcommand_from search-advanced' -l limit -d 'Number of results' -r
316
+ complete -c exa -n '__fish_seen_subcommand_from search-advanced' -s n -d 'Number of results' -r
317
+ complete -c exa -n '__fish_seen_subcommand_from search-advanced' -l output -d 'Output format' -a 'text json markdown' -f
318
+ complete -c exa -n '__fish_seen_subcommand_from search-advanced' -s o -d 'Output format' -a 'text json markdown' -f
319
+
320
+ # code command
321
+ complete -c exa -n '__fish_use_subcommand' -f -a 'code'
322
+ complete -c exa -n '__fish_seen_subcommand_from code' -l num -d 'Number of results' -r
323
+ complete -c exa -n '__fish_seen_subcommand_from code' -l limit -d 'Number of results' -r
324
+ complete -c exa -n '__fish_seen_subcommand_from code' -s n -d 'Number of results' -r
325
+ complete -c exa -n '__fish_seen_subcommand_from code' -l output -d 'Output format' -a 'text json markdown' -f
326
+ complete -c exa -n '__fish_seen_subcommand_from code' -s o -d 'Output format' -a 'text json markdown' -f
327
+ complete -c exa -n '__fish_seen_subcommand_from code' -l language -d 'Programming language' -a 'javascript typescript python java go rust ruby php c cpp csharp' -f
328
+ complete -c exa -n '__fish_seen_subcommand_from code' -s l -d 'Programming language' -a 'javascript typescript python java go rust ruby php c cpp csharp' -f
329
+ complete -c exa -n '__fish_seen_subcommand_from code' -l query -d 'Code search query' -r
330
+ complete -c exa -n '__fish_seen_subcommand_from code' -s q -d 'Code search query' -r
331
+
332
+ # crawl command
333
+ complete -c exa -n '__fish_use_subcommand' -f -a 'crawl'
334
+ complete -c exa -n '__fish_seen_subcommand_from crawl' -l num -d 'Number of results' -r
335
+ complete -c exa -n '__fish_seen_subcommand_from crawl' -l limit -d 'Number of results' -r
336
+ complete -c exa -n '__fish_seen_subcommand_from crawl' -s n -d 'Number of results' -r
337
+ complete -c exa -n '__fish_seen_subcommand_from crawl' -l output -d 'Output format' -a 'text json markdown' -f
338
+ complete -c exa -n '__fish_seen_subcommand_from crawl' -s o -d 'Output format' -a 'text json markdown' -f
339
+ complete -c exa -n '__fish_seen_subcommand_from crawl' -l max-depth -d 'Crawl depth' -r
340
+ complete -c exa -n '__fish_seen_subcommand_from crawl' -s d -d 'Crawl depth' -r
341
+ complete -c exa -n '__fish_seen_subcommand_from crawl' -l url -d 'URL to crawl' -r
342
+
343
+ # company command
344
+ complete -c exa -n '__fish_use_subcommand' -f -a 'company'
345
+ complete -c exa -n '__fish_seen_subcommand_from company' -l num -d 'Number of results' -r
346
+ complete -c exa -n '__fish_seen_subcommand_from company' -l limit -d 'Number of results' -r
347
+ complete -c exa -n '__fish_seen_subcommand_from company' -s n -d 'Number of results' -r
348
+ complete -c exa -n '__fish_seen_subcommand_from company' -l output -d 'Output format' -a 'text json markdown' -f
349
+ complete -c exa -n '__fish_seen_subcommand_from company' -s o -d 'Output format' -a 'text json markdown' -f
350
+ complete -c exa -n '__fish_seen_subcommand_from company' -l name -d 'Company name' -r
351
+
352
+ # people command
353
+ complete -c exa -n '__fish_use_subcommand' -f -a 'people'
354
+ complete -c exa -n '__fish_seen_subcommand_from people' -l num -d 'Number of results' -r
355
+ complete -c exa -n '__fish_seen_subcommand_from people' -l limit -d 'Number of results' -r
356
+ complete -c exa -n '__fish_seen_subcommand_from people' -s n -d 'Number of results' -r
357
+ complete -c exa -n '__fish_seen_subcommand_from people' -l output -d 'Output format' -a 'text json markdown' -f
358
+ complete -c exa -n '__fish_seen_subcommand_from people' -s o -d 'Output format' -a 'text json markdown' -f
359
+ complete -c exa -n '__fish_seen_subcommand_from people' -l name -d 'Person name' -r
360
+ complete -c exa -n '__fish_seen_subcommand_from people' -l title -d 'Job title' -r
361
+ complete -c exa -n '__fish_seen_subcommand_from people' -l company -d 'Company name' -r
362
+
363
+ # config command
364
+ complete -c exa -n '__fish_use_subcommand' -f -a 'config'
365
+ complete -c exa -n '__fish_seen_subcommand_from config' -f -a 'set' -d 'Set a config value'
366
+ complete -c exa -n '__fish_seen_subcommand_from config' -f -a 'get' -d 'Get a config value'
367
+ complete -c exa -n '__fish_seen_subcommand_from config' -f -a 'list' -d 'List all config values'
368
+ complete -c exa -n '__fish_seen_subcommand_from config' -f -a 'clear' -d 'Clear config'
369
+
370
+ # research command
371
+ complete -c exa -n '__fish_use_subcommand' -f -a 'research'
372
+ complete -c exa -n '__fish_seen_subcommand_from research' -l num -d 'Number of results' -r
373
+ complete -c exa -n '__fish_seen_subcommand_from research' -l limit -d 'Number of results' -r
374
+ complete -c exa -n '__fish_seen_subcommand_from research' -s n -d 'Number of results' -r
375
+ complete -c exa -n '__fish_seen_subcommand_from research' -l output -d 'Output format' -a 'text json markdown' -f
376
+ complete -c exa -n '__fish_seen_subcommand_from research' -s o -d 'Output format' -a 'text json markdown' -f
377
+
378
+ # completion command
379
+ complete -c exa -n '__fish_use_subcommand' -f -a 'completion'
380
+ complete -c exa -n '__fish_seen_subcommand_from completion' -f -a 'bash' -d 'Bash completion'
381
+ complete -c exa -n '__fish_seen_subcommand_from completion' -f -a 'zsh' -d 'Zsh completion'
382
+ complete -c exa -n '__fish_seen_subcommand_from completion' -f -a 'fish' -d 'Fish completion'
383
+ `;
384
+ }
385
+ export default defineCommand({
386
+ meta: {
387
+ name: 'completion',
388
+ description: 'Generate shell completion scripts',
389
+ },
390
+ args: {
391
+ shell: {
392
+ type: 'positional',
393
+ required: true,
394
+ description: 'Shell type (bash, zsh, fish)',
395
+ value: (val) => {
396
+ const validShells = ['bash', 'zsh', 'fish'];
397
+ if (!validShells.includes(val)) {
398
+ throw new Error(`Invalid shell: ${val}. Valid shells: ${validShells.join(', ')}`);
399
+ }
400
+ return val;
401
+ },
402
+ },
403
+ },
404
+ run({ args }) {
405
+ const shell = args.shell;
406
+ let completionScript;
407
+ switch (shell) {
408
+ case 'bash':
409
+ completionScript = generateBashCompletion();
410
+ break;
411
+ case 'zsh':
412
+ completionScript = generateZshCompletion();
413
+ break;
414
+ case 'fish':
415
+ completionScript = generateFishCompletion();
416
+ break;
417
+ default:
418
+ throw new Error(`Unsupported shell: ${shell}`);
419
+ }
420
+ console.log(completionScript);
421
+ },
422
+ });
423
+ //# sourceMappingURL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gBACrB,MAAM,WAAW,GAAY,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,CAAA;gBACpD,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,GAAY,CAAC,EAAE,CAAC;oBACxC,MAAM,IAAI,KAAK,CAAC,kBAAkB,GAAG,mBAAmB,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;gBACnF,CAAC;gBACD,OAAO,GAAG,CAAA;YACZ,CAAC;SACF;KACF;IACD,GAAG,CAAC,EAAE,IAAI,EAAE;QACV,MAAM,KAAK,GAAG,IAAI,CAAC,KAAc,CAAA;QAEjC,IAAI,gBAAwB,CAAA;QAE5B,QAAQ,KAAK,EAAE,CAAC;YACd,KAAK,MAAM;gBACT,gBAAgB,GAAG,sBAAsB,EAAE,CAAA;gBAC3C,MAAK;YACP,KAAK,KAAK;gBACR,gBAAgB,GAAG,qBAAqB,EAAE,CAAA;gBAC1C,MAAK;YACP,KAAK,MAAM;gBACT,gBAAgB,GAAG,sBAAsB,EAAE,CAAA;gBAC3C,MAAK;YACP;gBACE,MAAM,IAAI,KAAK,CAAC,sBAAsB,KAAK,EAAE,CAAC,CAAA;QAClD,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAA;IAC/B,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Config command - Manage ~/.exarc configuration file
3
+ */
4
+ declare const _default: import("citty").CommandDef<{
5
+ action: {
6
+ type: "positional";
7
+ required: true;
8
+ description: string;
9
+ value: (val: string) => string;
10
+ };
11
+ key: {
12
+ type: "positional";
13
+ required: false;
14
+ description: string;
15
+ };
16
+ value: {
17
+ type: "positional";
18
+ required: false;
19
+ description: string;
20
+ };
21
+ }>;
22
+ export default _default;
23
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;qBAsBgB,MAAM;;;;;;;;;;;;;AAVzB,wBA0HE"}
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Config command - Manage ~/.exarc configuration file
3
+ */
4
+ import { defineCommand } from 'citty';
5
+ import { consola } from 'consola';
6
+ import { loadConfig, saveConfig } from '../lib/config.js';
7
+ const VALID_KEYS = ['apiKey', 'output', 'defaultNum'];
8
+ const VALID_OUTPUT_VALUES = ['text', 'json', 'markdown'];
9
+ export default defineCommand({
10
+ meta: {
11
+ name: 'config',
12
+ description: 'Manage CLI configuration',
13
+ },
14
+ args: {
15
+ action: {
16
+ type: 'positional',
17
+ required: true,
18
+ description: 'Action to perform (set, get, list, clear)',
19
+ value: (val) => {
20
+ const validActions = ['set', 'get', 'list', 'clear'];
21
+ if (!validActions.includes(val)) {
22
+ throw new Error(`Invalid action: ${val}. Valid actions: ${validActions.join(', ')}`);
23
+ }
24
+ return val;
25
+ },
26
+ },
27
+ key: {
28
+ type: 'positional',
29
+ required: false,
30
+ description: 'Config key (apiKey, output, defaultNum)',
31
+ },
32
+ value: {
33
+ type: 'positional',
34
+ required: false,
35
+ description: 'Config value',
36
+ },
37
+ },
38
+ async run({ args }) {
39
+ const { action, key, value } = args;
40
+ switch (action) {
41
+ case 'list': {
42
+ const config = loadConfig();
43
+ consola.info('Current configuration:');
44
+ consola.box(config);
45
+ break;
46
+ }
47
+ case 'get': {
48
+ if (!key) {
49
+ consola.error('Error: key is required for "get" action');
50
+ process.exit(1);
51
+ }
52
+ if (!VALID_KEYS.includes(key)) {
53
+ consola.error(`Invalid key: ${key}. Valid keys: ${VALID_KEYS.join(', ')}`);
54
+ process.exit(1);
55
+ }
56
+ const config = loadConfig();
57
+ const configKey = key;
58
+ const configValue = config[configKey];
59
+ if (configValue === undefined) {
60
+ consola.warn(`Config key "${key}" is not set`);
61
+ }
62
+ else {
63
+ consola.info(`${key}: ${configValue}`);
64
+ }
65
+ break;
66
+ }
67
+ case 'set': {
68
+ if (!key || value === undefined) {
69
+ consola.error('Error: both key and value are required for "set" action');
70
+ process.exit(1);
71
+ }
72
+ if (!VALID_KEYS.includes(key)) {
73
+ consola.error(`Invalid key: ${key}. Valid keys: ${VALID_KEYS.join(', ')}`);
74
+ process.exit(1);
75
+ }
76
+ const configKey = key;
77
+ // Validate value based on key
78
+ if (configKey === 'defaultNum') {
79
+ const numValue = parseInt(String(value), 10);
80
+ if (isNaN(numValue) || numValue < 1) {
81
+ consola.error('Error: defaultNum must be a positive number');
82
+ process.exit(1);
83
+ }
84
+ }
85
+ if (configKey === 'output' && !VALID_OUTPUT_VALUES.includes(value)) {
86
+ consola.error(`Invalid output value: ${value}. Valid values: ${VALID_OUTPUT_VALUES.join(', ')}`);
87
+ process.exit(1);
88
+ }
89
+ const config = loadConfig();
90
+ // Parse value appropriately and set on config
91
+ if (configKey === 'defaultNum') {
92
+ config.defaultNum = parseInt(String(value), 10);
93
+ }
94
+ else if (configKey === 'apiKey') {
95
+ config.apiKey = value;
96
+ }
97
+ else if (configKey === 'output') {
98
+ config.output = value;
99
+ }
100
+ saveConfig(config);
101
+ consola.success(`Set ${key} = ${value}`);
102
+ break;
103
+ }
104
+ case 'clear': {
105
+ const defaultConfig = {
106
+ output: 'json',
107
+ defaultNum: 10,
108
+ };
109
+ saveConfig(defaultConfig);
110
+ consola.success('Config cleared and reset to defaults');
111
+ break;
112
+ }
113
+ default:
114
+ consola.error(`Unknown action: ${action}`);
115
+ process.exit(1);
116
+ }
117
+ },
118
+ });
119
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/commands/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAEzD,MAAM,UAAU,GAAG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ACP,CAAC;YAED,KAAK,OAAO,CAAC,CAAC,CAAC;gBACb,MAAM,aAAa,GAAG;oBACpB,MAAM,EAAE,MAAM;oBACd,UAAU,EAAE,EAAE;iBACf,CAAA;gBACD,UAAU,CAAC,aAAa,CAAC,CAAA;gBACzB,OAAO,CAAC,OAAO,CAAC,sCAAsC,CAAC,CAAA;gBACvD,MAAK;YACP,CAAC;YAED;gBACE,OAAO,CAAC,KAAK,CAAC,mBAAmB,MAAM,EAAE,CAAC,CAAA;gBAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC;IACH,CAAC;CACF,CAAC,CAAA"}
@@ -0,0 +1,23 @@
1
+ declare const _default: import("citty").CommandDef<{
2
+ url: {
3
+ type: "positional";
4
+ required: true;
5
+ description: string;
6
+ };
7
+ 'max-chars': {
8
+ type: "string";
9
+ default: string;
10
+ description: string;
11
+ };
12
+ format: {
13
+ type: "string";
14
+ default: string;
15
+ description: string;
16
+ };
17
+ 'api-key': {
18
+ type: "string";
19
+ description: string;
20
+ };
21
+ }>;
22
+ export default _default;
23
+ //# sourceMappingURL=crawl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crawl.d.ts","sourceRoot":"","sources":["../../src/commands/crawl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAQA,wBAmDE"}
@@ -0,0 +1,55 @@
1
+ import { defineCommand } from 'citty';
2
+ import { consola } from 'consola';
3
+ import { getMcpClient } from '../lib/mcp-client.js';
4
+ import { formatCrawlResult } from '../lib/output.js';
5
+ const VALID_FORMATS = ['text', 'json', 'markdown'];
6
+ export default defineCommand({
7
+ meta: {
8
+ name: 'crawl',
9
+ description: 'Extract content from a URL',
10
+ },
11
+ args: {
12
+ url: {
13
+ type: 'positional',
14
+ required: true,
15
+ description: 'URL to crawl',
16
+ },
17
+ 'max-chars': {
18
+ type: 'string',
19
+ default: '3000',
20
+ description: 'Maximum characters to extract',
21
+ },
22
+ format: {
23
+ type: 'string',
24
+ default: 'text',
25
+ description: `Output format (${VALID_FORMATS.join(', ')})`,
26
+ },
27
+ 'api-key': {
28
+ type: 'string',
29
+ description: 'Exa API key',
30
+ },
31
+ },
32
+ async run({ args }) {
33
+ const { url, 'max-chars': maxChars, format, 'api-key': apiKey } = args;
34
+ const maxCharacters = parseInt(String(maxChars), 10) || 3000;
35
+ const outputFormat = VALID_FORMATS.includes(format) ? format : 'text';
36
+ const mcpClient = getMcpClient();
37
+ try {
38
+ await mcpClient.connect(apiKey);
39
+ const result = await mcpClient.callTool('crawling_exa', {
40
+ url,
41
+ maxCharacters,
42
+ });
43
+ const formatted = formatCrawlResult(result, outputFormat);
44
+ console.log(formatted);
45
+ }
46
+ catch (error) {
47
+ consola.error('Failed to crawl URL:', error instanceof Error ? error.message : 'Unknown error');
48
+ process.exit(1);
49
+ }
50
+ finally {
51
+ await mcpClient.close();
52
+ }
53
+ },
54
+ });
55
+ //# sourceMappingURL=crawl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"crawl.js","sourceRoot":"","sources":["../../src/commands/crawl.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGpD,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,CAAU,CAAA;AAE3D,eAAe,aAAa,CAAC;IAC3B,IAAI,EAAE;QACJ,IAAI,EAAE,OAAO;QACb,WAAW,EAAE,4BAA4B;KAC1C;IACD,IAAI,EAAE;QACJ,GAAG,EAAE;YACH,IAAI,EAAE,YAAY;YAClB,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,cAAc;SAC5B;QACD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE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