builtwith-official-cli 1.1.0 → 1.2.0
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/lib/cli.js +1 -0
- package/lib/client.js +1 -0
- package/lib/commands/vector.js +30 -0
- package/package.json +1 -1
package/lib/cli.js
CHANGED
|
@@ -35,6 +35,7 @@ function run() {
|
|
|
35
35
|
require('./commands/trends')(program);
|
|
36
36
|
require('./commands/products')(program);
|
|
37
37
|
require('./commands/trust')(program);
|
|
38
|
+
require('./commands/vector')(program);
|
|
38
39
|
require('./commands/account')(program);
|
|
39
40
|
require('./commands/live')(program);
|
|
40
41
|
require('./commands/mcp')(program);
|
package/lib/client.js
CHANGED
|
@@ -36,6 +36,7 @@ const BASE_URLS = {
|
|
|
36
36
|
trends: 'https://api.builtwith.com/trends/v6/api.json',
|
|
37
37
|
products: 'https://api.builtwith.com/productv1/api.json',
|
|
38
38
|
trust: 'https://api.builtwith.com/trustv1/api.json',
|
|
39
|
+
vector: 'https://api.builtwith.com/vector/v1/api.json',
|
|
39
40
|
whoami: 'https://api.builtwith.com/whoamiv1/api.json',
|
|
40
41
|
usage: 'https://api.builtwith.com/usagev2/api.json',
|
|
41
42
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { requireKey } = require('../config');
|
|
4
|
+
const { request } = require('../client');
|
|
5
|
+
const output = require('../output');
|
|
6
|
+
const ora = require('ora');
|
|
7
|
+
|
|
8
|
+
module.exports = function registerVector(program) {
|
|
9
|
+
const vector = program.command('vector').description('Vector search for technologies and categories');
|
|
10
|
+
|
|
11
|
+
vector
|
|
12
|
+
.command('search <query>')
|
|
13
|
+
.description('Search technologies and categories by text using semantic similarity')
|
|
14
|
+
.option('--limit <n>', 'Number of results (default 10, max 100)', parseInt)
|
|
15
|
+
.action(async (queryArg, cmdOpts) => {
|
|
16
|
+
const opts = program.opts();
|
|
17
|
+
if (opts.noColor) output.setNoColor(true);
|
|
18
|
+
const key = requireKey(opts.key);
|
|
19
|
+
const params = { KEY: key, QUERY: queryArg };
|
|
20
|
+
if (cmdOpts.limit) params.LIMIT = cmdOpts.limit;
|
|
21
|
+
const spinner = opts.quiet ? null : ora({ text: `Searching for "${queryArg}"...`, stream: process.stderr }).start();
|
|
22
|
+
try {
|
|
23
|
+
const data = await request('vector', params, { dryRun: opts.dryRun, debug: opts.debug, spinner });
|
|
24
|
+
output.print(data, { format: opts.format });
|
|
25
|
+
} catch (err) {
|
|
26
|
+
if (spinner) spinner.stop();
|
|
27
|
+
throw err;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
};
|