omnisearch-cli 0.0.0-stage → 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 OmniSearch SDK Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js ADDED
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/index.ts
4
+ import { parseArgs } from "util";
5
+ import {
6
+ createArxivProvider,
7
+ createBingProvider,
8
+ createBraveProvider,
9
+ createDuckDuckGoProvider,
10
+ createExaProvider,
11
+ createGitHubProvider,
12
+ createGoogleProvider,
13
+ createParallelProvider,
14
+ createPerplexityProvider,
15
+ createPubMedProvider,
16
+ createSearXNGProvider,
17
+ createSemanticScholarProvider,
18
+ createSerpApiProvider,
19
+ createTavilyProvider,
20
+ createYouProvider,
21
+ webSearch
22
+ } from "omnisearch-sdk";
23
+ function showHelp() {
24
+ console.log(`
25
+ OmniSearch CLI - High-performance multi-provider search
26
+
27
+ Usage:
28
+ omnisearch "<query>" [options]
29
+
30
+ Options:
31
+ -p, --provider <name> Provider to use (brave, google, duckduckgo, etc.) Default: auto
32
+ -f, --freshness <period> Freshness filter (day, week, month, year)
33
+ -s, --strategy <mode> Execution strategy (parallel, fallback, race) Default: parallel
34
+ -n, --max-results <num> Maximum results to return. Default: 10
35
+ --type <type> Search type (web, news). Default: web
36
+ --dedupe Enable canonical URL deduplication
37
+ --json Output raw JSON results
38
+ -h, --help Show this help message
39
+
40
+ Environment Variables:
41
+ BRAVE_API_KEY, GOOGLE_API_KEY, GOOGLE_CX, TAVILY_API_KEY, EXA_API_KEY,
42
+ PERPLEXITY_API_KEY, BING_API_KEY, YOU_API_KEY, PARALLEL_API_KEY, SERPAPI_API_KEY
43
+ `);
44
+ }
45
+ function resolveProviders(providerName) {
46
+ const env = process.env;
47
+ const name = providerName?.toLowerCase();
48
+ const registry = {
49
+ duckduckgo: () => createDuckDuckGoProvider(),
50
+ arxiv: () => createArxivProvider(),
51
+ pubmed: () => createPubMedProvider(),
52
+ github: () => createGitHubProvider({ apiKey: env.GITHUB_TOKEN || env.GITHUB_API_KEY }),
53
+ brave: () => env.BRAVE_API_KEY || env.BRAVE_SEARCH_API_KEY ? createBraveProvider({ apiKey: env.BRAVE_API_KEY || env.BRAVE_SEARCH_API_KEY }) : null,
54
+ google: () => env.GOOGLE_API_KEY && env.GOOGLE_CX ? createGoogleProvider({ apiKey: env.GOOGLE_API_KEY, cx: env.GOOGLE_CX }) : null,
55
+ tavily: () => env.TAVILY_API_KEY ? createTavilyProvider({ apiKey: env.TAVILY_API_KEY }) : null,
56
+ exa: () => env.EXA_API_KEY ? createExaProvider({ apiKey: env.EXA_API_KEY }) : null,
57
+ perplexity: () => env.PERPLEXITY_API_KEY ? createPerplexityProvider({ apiKey: env.PERPLEXITY_API_KEY }) : null,
58
+ bing: () => env.BING_API_KEY ? createBingProvider({ apiKey: env.BING_API_KEY }) : null,
59
+ you: () => env.YOU_API_KEY ? createYouProvider({ apiKey: env.YOU_API_KEY }) : null,
60
+ parallel: () => env.PARALLEL_API_KEY ? createParallelProvider({ apiKey: env.PARALLEL_API_KEY }) : null,
61
+ serpapi: () => env.SERPAPI_API_KEY ? createSerpApiProvider({ apiKey: env.SERPAPI_API_KEY }) : null,
62
+ searxng: () => env.SEARXNG_BASE_URL ? createSearXNGProvider({ baseUrl: env.SEARXNG_BASE_URL }) : null,
63
+ semanticscholar: () => createSemanticScholarProvider()
64
+ };
65
+ if (name) {
66
+ const factory = registry[name];
67
+ if (!factory) {
68
+ console.error(`Unknown provider: ${name}`);
69
+ process.exit(1);
70
+ }
71
+ const instance = factory();
72
+ if (!instance) {
73
+ console.error(`Missing required environment variables/API keys for provider: ${name}`);
74
+ process.exit(1);
75
+ }
76
+ return [instance];
77
+ }
78
+ const available = [];
79
+ for (const [_, factory] of Object.entries(registry)) {
80
+ const inst = factory();
81
+ if (inst) available.push(inst);
82
+ }
83
+ if (available.length === 0) {
84
+ available.push(createDuckDuckGoProvider());
85
+ }
86
+ return available;
87
+ }
88
+ async function runCli() {
89
+ const { values, positionals } = parseArgs({
90
+ args: process.argv.slice(2),
91
+ options: {
92
+ provider: { type: "string", short: "p" },
93
+ freshness: { type: "string", short: "f" },
94
+ strategy: { type: "string", short: "s", default: "parallel" },
95
+ "max-results": { type: "string", short: "n", default: "10" },
96
+ type: { type: "string", default: "web" },
97
+ dedupe: { type: "boolean", default: false },
98
+ json: { type: "boolean", default: false },
99
+ help: { type: "boolean", short: "h", default: false }
100
+ },
101
+ allowPositionals: true
102
+ });
103
+ if (values.help || positionals.length === 0) {
104
+ showHelp();
105
+ return;
106
+ }
107
+ const query = positionals.join(" ").trim();
108
+ const providers = resolveProviders(values.provider);
109
+ const maxResults = Number.parseInt(values["max-results"] ?? "10", 10);
110
+ const strategy = values.strategy;
111
+ const freshness = values.freshness;
112
+ const searchType = values.type;
113
+ try {
114
+ const results = await webSearch({
115
+ query,
116
+ provider: providers,
117
+ maxResults,
118
+ strategy,
119
+ freshness,
120
+ searchType,
121
+ deduplicate: values.dedupe
122
+ });
123
+ if (values.json) {
124
+ console.log(JSON.stringify(results, null, 2));
125
+ return;
126
+ }
127
+ if (results.length === 0) {
128
+ console.log(`No results found for "${query}".`);
129
+ return;
130
+ }
131
+ console.log(`
132
+ Found ${results.length} results for "${query}":
133
+ `);
134
+ results.forEach((item, idx) => {
135
+ console.log(`${idx + 1}. [${item.provider}] ${item.title}`);
136
+ console.log(` ${item.url}`);
137
+ if (item.snippet) {
138
+ console.log(` ${item.snippet.slice(0, 160)}${item.snippet.length > 160 ? "..." : ""}`);
139
+ }
140
+ if (item.publishedDate) {
141
+ console.log(` Published: ${item.publishedDate}`);
142
+ }
143
+ console.log("");
144
+ });
145
+ } catch (error) {
146
+ console.error("Search error:", error instanceof Error ? error.message : String(error));
147
+ process.exit(1);
148
+ }
149
+ }
150
+ runCli();
151
+ export {
152
+ runCli
153
+ };
package/package.json CHANGED
@@ -1,6 +1,28 @@
1
1
  {
2
2
  "name": "omnisearch-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.0.0",
4
+ "description": "Command-line interface for OmniSearch SDK",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "bin": {
8
+ "omnisearch": "./dist/index.js",
9
+ "omnisearch-cli": "./dist/index.js"
10
+ },
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "engines": {
15
+ "node": ">=24.0.0"
16
+ },
17
+ "dependencies": {
18
+ "omnisearch-sdk": "5.0.1"
19
+ },
20
+ "devDependencies": {
21
+ "tsup": "^8.5.1",
22
+ "typescript": "~6.0.3"
23
+ },
24
+ "scripts": {
25
+ "build": "tsup",
26
+ "dev": "tsup --watch"
27
+ }
6
28
  }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.