@octen.ai/cli 0.5.5 → 0.7.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/README.md +9 -7
- package/dist/api/constants.d.ts +9 -0
- package/dist/api/constants.js +3 -1
- package/dist/api/mediaSearch.d.ts +0 -3
- package/dist/api/mediaSearch.js +12 -10
- package/dist/api/search.d.ts +8 -1
- package/dist/api/search.js +13 -3
- package/dist/commands/broadSearch.js +1 -1
- package/dist/commands/completion.js +116 -21
- package/dist/commands/imageSearch.js +1 -7
- package/dist/commands/search.js +1 -1
- package/package.json +1 -1
- package/skills/octen-search/SKILL.md +2 -2
package/README.md
CHANGED
|
@@ -61,7 +61,7 @@ Search the live web.
|
|
|
61
61
|
octen search "latest LLM benchmarks" -n 10 --topic news --highlight --time-range week
|
|
62
62
|
```
|
|
63
63
|
|
|
64
|
-
Options: `-n` (result count 1–100), `--topic` (general|news), `--highlight` (+`--highlight-max-tokens`,
|
|
64
|
+
Options: `-n` (result count 1–100), `--topic` (general|news), `--highlight` (+`--highlight-max-tokens`, 100–20000), `--time-range` (day|week|month|year or d|w|m|y), `--start-time`/`--end-time` (YYYY-MM-DD or ISO datetime), `--include-domains`, `--exclude-domains`, `--language` (comma-separated ISO 639-1 codes, e.g. `en,ja` — one of `ar de en es fr hi id it ja ko nl pl pt ru th tr vi zh`), `--full-content` (+`--full-content-max-tokens`, 100–100000), `--images`, `--format` (text|markdown), `--safesearch`.
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
@@ -85,7 +85,7 @@ Use it for comparisons across many sources (pricing, products, vendors), surveys
|
|
|
85
85
|
octen broad-search "compare cloud GPU pricing across providers" --max-queries 5 -n 10
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
Options: `--max-queries` (decompose into up to N sub-queries, 1–30, default 5), plus all `octen search` flags (`-n/--count` per sub-query, `--topic`, `--highlight`, `--full-content`, `--time-range`, `--start-time`/`--end-time`, `--include-domains`/`--exclude-domains`, `--include-text`/`--exclude-text`, `--language`, `--images`, `--
|
|
88
|
+
Options: `--max-queries` (decompose into up to N sub-queries, 1–30, default 5), plus all `octen search` flags (`-n/--count` per sub-query, `--topic`, `--highlight`, `--full-content`, `--time-range`, `--start-time`/`--end-time`, `--include-domains`/`--exclude-domains`, `--include-text`/`--exclude-text`, `--language`, `--images`, `--format`, `--safesearch`).
|
|
89
89
|
|
|
90
90
|
---
|
|
91
91
|
|
|
@@ -164,17 +164,19 @@ Options: `-m/--model` (base|large or full ID), `--fusion`/`--no-fusion`, `--dime
|
|
|
164
164
|
|
|
165
165
|
**In Beta** — contact us to request beta access.
|
|
166
166
|
|
|
167
|
-
Search the web for images by text query
|
|
167
|
+
Search the web for images, either by text query or by example image.
|
|
168
168
|
|
|
169
169
|
```sh
|
|
170
|
-
octen image-search "red sports car" -n 10 --topic design
|
|
170
|
+
octen image-search "red sports car" -n 10 --topic design
|
|
171
171
|
octen image-search --image https://example.com/car.jpg
|
|
172
|
-
octen image-search
|
|
172
|
+
octen image-search --image ./car.png
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
`--image` accepts a public URL or a local file path (read inline as base64, max 5MB).
|
|
175
|
+
The endpoint takes exactly one input, so pass a query **or** `--image`, not both. `--image` accepts a public URL or a local file path (read inline as base64, max 5MB).
|
|
176
176
|
|
|
177
|
-
Options: `--image <url|path>`, `--topic` (general|design), `-n` (result count 1–10), `--include-domains`, `--exclude-domains`, `--
|
|
177
|
+
Options: `--image <url|path>`, `--topic` (general|design), `-n` (result count 1–10), `--include-domains`, `--exclude-domains`, `--safesearch` (off|strict), `--html-snippet` (+`--html-snippet-max-tokens`, 100–100000).
|
|
178
|
+
|
|
179
|
+
Unlike `octen search` and `octen video-search`, this endpoint has no time filters.
|
|
178
180
|
|
|
179
181
|
---
|
|
180
182
|
|
package/dist/api/constants.d.ts
CHANGED
|
@@ -39,6 +39,15 @@ export declare const LIMITS: {
|
|
|
39
39
|
};
|
|
40
40
|
readonly highlightMaxTokens: {
|
|
41
41
|
readonly min: 100;
|
|
42
|
+
readonly max: 20000;
|
|
43
|
+
};
|
|
44
|
+
readonly fullContentMaxTokens: {
|
|
45
|
+
readonly min: 100;
|
|
46
|
+
readonly max: 100000;
|
|
47
|
+
};
|
|
48
|
+
readonly htmlSnippetMaxTokens: {
|
|
49
|
+
readonly min: 100;
|
|
50
|
+
readonly max: 100000;
|
|
42
51
|
};
|
|
43
52
|
readonly vlContents: 20;
|
|
44
53
|
readonly vlImages: 5;
|
package/dist/api/constants.js
CHANGED
|
@@ -28,7 +28,9 @@ export const LIMITS = {
|
|
|
28
28
|
extractUrls: { min: 1, max: 20 },
|
|
29
29
|
extractTimeout: { min: 1, max: 60 },
|
|
30
30
|
cacheWindow: { min: 300, max: 31_536_000, default: 86_400 },
|
|
31
|
-
highlightMaxTokens: { min: 100 },
|
|
31
|
+
highlightMaxTokens: { min: 100, max: 20_000 },
|
|
32
|
+
fullContentMaxTokens: { min: 100, max: 100_000 },
|
|
33
|
+
htmlSnippetMaxTokens: { min: 100, max: 100_000 },
|
|
32
34
|
vlContents: 20,
|
|
33
35
|
vlImages: 5,
|
|
34
36
|
vlVideos: 1,
|
|
@@ -23,9 +23,6 @@ export interface ImageSearchOpts {
|
|
|
23
23
|
count?: number;
|
|
24
24
|
includeDomains?: string[];
|
|
25
25
|
excludeDomains?: string[];
|
|
26
|
-
timeRange?: string;
|
|
27
|
-
startTime?: string;
|
|
28
|
-
endTime?: string;
|
|
29
26
|
safesearch?: "off" | "strict";
|
|
30
27
|
htmlSnippet?: boolean;
|
|
31
28
|
htmlSnippetMaxTokens?: number;
|
package/dist/api/mediaSearch.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync, existsSync, statSync } from "node:fs";
|
|
2
2
|
import { LIMITS, IMAGE_TOPIC_OPTIONS, TIME_RANGE_OPTIONS, SAFESEARCH_OPTIONS, } from "./constants.js";
|
|
3
3
|
import { OctenValidationError } from "./errors.js";
|
|
4
|
-
import { validateEnum, normalizeTimeBound } from "./search.js";
|
|
4
|
+
import { validateEnum, normalizeTimeBound, assertRange } from "./search.js";
|
|
5
5
|
/** Max size of a local image read inline as base64. */
|
|
6
6
|
const MAX_IMAGE_BYTES = 5 * 1024 * 1024; // 5 MB
|
|
7
7
|
/**
|
|
@@ -26,17 +26,22 @@ function resolveImageInput(value) {
|
|
|
26
26
|
return { type: "image", data: buf.toString("base64") };
|
|
27
27
|
}
|
|
28
28
|
export function buildImageSearchRequest(query, o) {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
if (o.image)
|
|
33
|
-
|
|
29
|
+
// The endpoint takes exactly one input, so a query and --image are
|
|
30
|
+
// alternatives. Sending both produced a two-entry array the API answered
|
|
31
|
+
// with 400 "Inputs exceeds 1 entries".
|
|
32
|
+
if (query && o.image)
|
|
33
|
+
throw new OctenValidationError("pass a query or --image, not both: image search accepts exactly one input");
|
|
34
|
+
const inputs = query
|
|
35
|
+
? [{ type: "text", data: query }]
|
|
36
|
+
: o.image
|
|
37
|
+
? [resolveImageInput(o.image)]
|
|
38
|
+
: [];
|
|
34
39
|
if (inputs.length === 0)
|
|
35
40
|
throw new OctenValidationError("provide a query or --image");
|
|
36
41
|
if (o.count != null && (o.count < LIMITS.imageCount.min || o.count > LIMITS.imageCount.max))
|
|
37
42
|
throw new OctenValidationError(`count must be ${LIMITS.imageCount.min}-${LIMITS.imageCount.max}`);
|
|
43
|
+
assertRange("--html-snippet-max-tokens", o.htmlSnippetMaxTokens, LIMITS.htmlSnippetMaxTokens);
|
|
38
44
|
validateEnum("--topic", o.topic, IMAGE_TOPIC_OPTIONS);
|
|
39
|
-
validateEnum("--time-range", o.timeRange, TIME_RANGE_OPTIONS);
|
|
40
45
|
validateEnum("--safesearch", o.safesearch, SAFESEARCH_OPTIONS);
|
|
41
46
|
const req = { inputs };
|
|
42
47
|
const put = (k, v) => { if (v != null)
|
|
@@ -45,9 +50,6 @@ export function buildImageSearchRequest(query, o) {
|
|
|
45
50
|
put("count", o.count);
|
|
46
51
|
put("include_domains", o.includeDomains);
|
|
47
52
|
put("exclude_domains", o.excludeDomains);
|
|
48
|
-
put("time_range", o.timeRange);
|
|
49
|
-
put("start_time", normalizeTimeBound("--start-time", o.startTime, false));
|
|
50
|
-
put("end_time", normalizeTimeBound("--end-time", o.endTime, true));
|
|
51
53
|
put("safesearch", o.safesearch);
|
|
52
54
|
if (o.htmlSnippet)
|
|
53
55
|
req.html_snippet = {
|
package/dist/api/search.d.ts
CHANGED
|
@@ -5,6 +5,14 @@ export declare function validateEnum(flag: string, value: unknown, allowed: read
|
|
|
5
5
|
* (23:59:59Z) of that day; a full datetime passes through. Anything else is
|
|
6
6
|
* rejected client-side with a clear message instead of a server 400.
|
|
7
7
|
*/
|
|
8
|
+
/**
|
|
9
|
+
* Reject a numeric option the API would reject anyway, so the failure names
|
|
10
|
+
* the flag instead of arriving as a 400 several hundred milliseconds later.
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertRange(flag: string, value: number | undefined, bounds: {
|
|
13
|
+
min: number;
|
|
14
|
+
max: number;
|
|
15
|
+
}): void;
|
|
8
16
|
export declare function normalizeTimeBound(flag: string, value: string | undefined, endOfDay: boolean): string | undefined;
|
|
9
17
|
/** A single search result. All fields optional — the server is untyped. */
|
|
10
18
|
export interface SearchResult {
|
|
@@ -49,7 +57,6 @@ export interface SearchOpts {
|
|
|
49
57
|
fullContent?: boolean;
|
|
50
58
|
fullContentMaxTokens?: number;
|
|
51
59
|
images?: boolean;
|
|
52
|
-
videos?: boolean;
|
|
53
60
|
}
|
|
54
61
|
/**
|
|
55
62
|
* Build the per-query search options object (everything except `query`).
|
package/dist/api/search.js
CHANGED
|
@@ -10,6 +10,16 @@ export function validateEnum(flag, value, allowed) {
|
|
|
10
10
|
* (23:59:59Z) of that day; a full datetime passes through. Anything else is
|
|
11
11
|
* rejected client-side with a clear message instead of a server 400.
|
|
12
12
|
*/
|
|
13
|
+
/**
|
|
14
|
+
* Reject a numeric option the API would reject anyway, so the failure names
|
|
15
|
+
* the flag instead of arriving as a 400 several hundred milliseconds later.
|
|
16
|
+
*/
|
|
17
|
+
export function assertRange(flag, value, bounds) {
|
|
18
|
+
if (value == null)
|
|
19
|
+
return;
|
|
20
|
+
if (value < bounds.min || value > bounds.max)
|
|
21
|
+
throw new OctenValidationError(`${flag} must be ${bounds.min}-${bounds.max}`);
|
|
22
|
+
}
|
|
13
23
|
export function normalizeTimeBound(flag, value, endOfDay) {
|
|
14
24
|
if (value == null)
|
|
15
25
|
return undefined;
|
|
@@ -34,8 +44,8 @@ export function buildSearchOptions(o) {
|
|
|
34
44
|
throw new OctenValidationError(`include-text max ${LIMITS.includeText}`);
|
|
35
45
|
if (o.excludeText && o.excludeText.length > LIMITS.excludeText)
|
|
36
46
|
throw new OctenValidationError(`exclude-text max ${LIMITS.excludeText}`);
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
assertRange("highlight-max-tokens", o.highlightMaxTokens, LIMITS.highlightMaxTokens);
|
|
48
|
+
assertRange("full-content-max-tokens", o.fullContentMaxTokens, LIMITS.fullContentMaxTokens);
|
|
39
49
|
validateEnum("--topic", o.topic, TOPIC_OPTIONS);
|
|
40
50
|
validateEnum("--time-basis", o.timeBasis, TIME_BASIS_OPTIONS);
|
|
41
51
|
validateEnum("--time-range", o.timeRange, TIME_RANGE_OPTIONS);
|
|
@@ -57,8 +67,8 @@ export function buildSearchOptions(o) {
|
|
|
57
67
|
put("format", o.format);
|
|
58
68
|
put("safesearch", o.safesearch);
|
|
59
69
|
put("language", o.language);
|
|
70
|
+
// No include_videos: the API reference documents it on /extract only.
|
|
60
71
|
put("include_images", o.images);
|
|
61
|
-
put("include_videos", o.videos);
|
|
62
72
|
if (o.highlight)
|
|
63
73
|
opts.highlight = { enable: true, ...(o.highlightMaxTokens ? { max_tokens: o.highlightMaxTokens } : {}) };
|
|
64
74
|
if (o.fullContent)
|
|
@@ -22,7 +22,7 @@ export function registerBroadSearch(program) {
|
|
|
22
22
|
.option("--language <list>", "ISO 639-1 codes, comma-separated, e.g. en,ja", (v) => v.split(","))
|
|
23
23
|
.option("--highlight").option("--highlight-max-tokens <n>", "max tokens per highlight", parseIntOpt("--highlight-max-tokens"))
|
|
24
24
|
.option("--full-content").option("--full-content-max-tokens <n>", "max tokens per result", parseIntOpt("--full-content-max-tokens"))
|
|
25
|
-
.option("--images")
|
|
25
|
+
.option("--images")
|
|
26
26
|
.action(async (queryArg, opts, command) => {
|
|
27
27
|
const g = command.optsWithGlobals();
|
|
28
28
|
const client = makeClient(g);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, readFileSync,
|
|
1
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { OctenValidationError } from "../api/errors.js";
|
|
@@ -114,6 +114,79 @@ function fishScript(model) {
|
|
|
114
114
|
}
|
|
115
115
|
return lines.join("\n") + "\n";
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* A native zsh completion function — a `#compdef octen` file meant to live on
|
|
119
|
+
* `fpath` and be autoloaded by `compinit`. Unlike the `bashcompinit` `eval` shim,
|
|
120
|
+
* a file on `fpath` is re-discovered every time `compinit` runs, so a later
|
|
121
|
+
* `compinit` (e.g. appended by another tool's installer) reloads it instead of
|
|
122
|
+
* silently dropping the registration. This is the order-robust install target.
|
|
123
|
+
*/
|
|
124
|
+
function zshCompletionFile(model) {
|
|
125
|
+
const subs = model.subcommands.join(" ");
|
|
126
|
+
const globals = model.globalFlags.join(" ");
|
|
127
|
+
const branches = model.subcommands
|
|
128
|
+
.map((sub) => {
|
|
129
|
+
const flags = [...(model.subFlags[sub] ?? []), ...model.globalFlags].join(" ");
|
|
130
|
+
return ` ${sub})\n opts="${flags}"\n ;;`;
|
|
131
|
+
})
|
|
132
|
+
.join("\n");
|
|
133
|
+
return `#compdef octen
|
|
134
|
+
# octen zsh completion (native, fpath-autoloaded). Do not edit by hand;
|
|
135
|
+
# regenerate with: octen completion zsh --install
|
|
136
|
+
_octen() {
|
|
137
|
+
local cur sub i opts
|
|
138
|
+
cur=\${words[CURRENT]}
|
|
139
|
+
sub=""
|
|
140
|
+
for (( i = 2; i < CURRENT; i++ )); do
|
|
141
|
+
case \${words[i]} in
|
|
142
|
+
-*) ;;
|
|
143
|
+
*) sub=\${words[i]}; break ;;
|
|
144
|
+
esac
|
|
145
|
+
done
|
|
146
|
+
if [[ -z $sub ]]; then
|
|
147
|
+
opts="${subs} ${globals}"
|
|
148
|
+
else
|
|
149
|
+
case $sub in
|
|
150
|
+
${branches}
|
|
151
|
+
*)
|
|
152
|
+
opts="${globals}"
|
|
153
|
+
;;
|
|
154
|
+
esac
|
|
155
|
+
fi
|
|
156
|
+
compadd -- \${=opts}
|
|
157
|
+
}
|
|
158
|
+
_octen "$@"
|
|
159
|
+
`;
|
|
160
|
+
}
|
|
161
|
+
/** Native bash completion file body (function + `complete`), for the bash-
|
|
162
|
+
* completion user dir which lazy-loads it on demand regardless of rc ordering. */
|
|
163
|
+
function bashCompletionFile(model) {
|
|
164
|
+
return `${bashFunction(model)}\n`;
|
|
165
|
+
}
|
|
166
|
+
const ZSH_BLOCK_START = "# >>> octen completion >>>";
|
|
167
|
+
const ZSH_BLOCK_END = "# <<< octen completion <<<";
|
|
168
|
+
/** The `~/.zshrc` block that puts our completions dir on `fpath` and (re)runs
|
|
169
|
+
* `compinit` so the `_octen` file is discovered no matter where it lands. */
|
|
170
|
+
function zshRcBlock() {
|
|
171
|
+
return [
|
|
172
|
+
ZSH_BLOCK_START,
|
|
173
|
+
'fpath=("$HOME/.octen/completions" $fpath)',
|
|
174
|
+
"autoload -Uz compinit && compinit",
|
|
175
|
+
ZSH_BLOCK_END,
|
|
176
|
+
].join("\n");
|
|
177
|
+
}
|
|
178
|
+
/** Remove the legacy `# octen CLI completion` + `eval` block older versions
|
|
179
|
+
* appended, so re-running `--install` cleanly upgrades to the fpath approach. */
|
|
180
|
+
function stripLegacyEvalBlock(contents, shell) {
|
|
181
|
+
const evalLine = `eval "$(octen completion ${shell})"`;
|
|
182
|
+
const legacyBlock = `\n# octen CLI completion\n${evalLine}\n`;
|
|
183
|
+
const withoutBlock = contents.split(legacyBlock).join("");
|
|
184
|
+
// Also drop any bare eval line left on its own (e.g. hand-placed).
|
|
185
|
+
return withoutBlock
|
|
186
|
+
.split("\n")
|
|
187
|
+
.filter((l) => l.trim() !== evalLine)
|
|
188
|
+
.join("\n");
|
|
189
|
+
}
|
|
117
190
|
export function buildCompletionScript(program, shell) {
|
|
118
191
|
const model = buildModel(program);
|
|
119
192
|
switch (shell) {
|
|
@@ -128,9 +201,13 @@ export function buildCompletionScript(program, shell) {
|
|
|
128
201
|
}
|
|
129
202
|
}
|
|
130
203
|
/**
|
|
131
|
-
* Persist completion into the user's shell
|
|
132
|
-
* -
|
|
133
|
-
*
|
|
204
|
+
* Persist completion into the user's shell so it survives re-initialization.
|
|
205
|
+
* - zsh: write a native `#compdef` `_octen` file into `~/.octen/completions`
|
|
206
|
+
* (an fpath dir) and ensure `~/.zshrc` adds that dir to `fpath` + runs
|
|
207
|
+
* `compinit`. Because it lives on `fpath`, a later `compinit` re-discovers it
|
|
208
|
+
* instead of dropping it — the failure mode of the old `eval` line.
|
|
209
|
+
* - bash: write a native completion file into the bash-completion user dir,
|
|
210
|
+
* which is lazy-loaded on demand regardless of rc ordering.
|
|
134
211
|
* - fish: write the generated script into the auto-loaded completions dir.
|
|
135
212
|
*/
|
|
136
213
|
function installCompletion(shell, program, home) {
|
|
@@ -141,15 +218,30 @@ function installCompletion(shell, program, home) {
|
|
|
141
218
|
writeFileSync(file, buildCompletionScript(program, "fish"), "utf8");
|
|
142
219
|
return { action: "written", path: file };
|
|
143
220
|
}
|
|
144
|
-
const
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
221
|
+
const model = buildModel(program);
|
|
222
|
+
if (shell === "zsh") {
|
|
223
|
+
// 1) (Re)write the native completion file into an fpath dir.
|
|
224
|
+
const dir = join(home, ".octen/completions");
|
|
225
|
+
mkdirSync(dir, { recursive: true });
|
|
226
|
+
const file = join(dir, "_octen");
|
|
227
|
+
writeFileSync(file, zshCompletionFile(model), "utf8");
|
|
228
|
+
// 2) Ensure ~/.zshrc puts that dir on fpath and runs compinit.
|
|
229
|
+
const rc = join(home, ".zshrc");
|
|
230
|
+
const existing = existsSync(rc) ? readFileSync(rc, "utf8") : "";
|
|
231
|
+
if (existing.includes(ZSH_BLOCK_START)) {
|
|
232
|
+
return { action: "already", path: rc, file };
|
|
233
|
+
}
|
|
234
|
+
const cleaned = stripLegacyEvalBlock(existing, "zsh");
|
|
235
|
+
const prefix = cleaned === "" || cleaned.endsWith("\n") ? "" : "\n";
|
|
236
|
+
writeFileSync(rc, `${cleaned}${prefix}\n${zshRcBlock()}\n`, "utf8");
|
|
237
|
+
return { action: "installed", path: rc, file };
|
|
149
238
|
}
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
239
|
+
// bash: drop a native completion file into the bash-completion user dir.
|
|
240
|
+
const dir = join(home, ".local/share/bash-completion/completions");
|
|
241
|
+
mkdirSync(dir, { recursive: true });
|
|
242
|
+
const file = join(dir, "octen");
|
|
243
|
+
writeFileSync(file, bashCompletionFile(model), "utf8");
|
|
244
|
+
return { action: "written", path: file };
|
|
153
245
|
}
|
|
154
246
|
export function registerCompletion(program, internal = {}) {
|
|
155
247
|
program
|
|
@@ -166,18 +258,21 @@ export function registerCompletion(program, internal = {}) {
|
|
|
166
258
|
}
|
|
167
259
|
const home = internal.home ?? os.homedir();
|
|
168
260
|
const result = installCompletion(shell, program, home);
|
|
169
|
-
if (
|
|
170
|
-
process.stdout.write(`completion already installed in ${quotePath(result.path)}\n`);
|
|
171
|
-
}
|
|
172
|
-
else if (result.action === "written") {
|
|
261
|
+
if (shell === "fish") {
|
|
173
262
|
process.stdout.write(`wrote fish completion to ${quotePath(result.path)} (new shells pick it up automatically)\n`);
|
|
263
|
+
return;
|
|
174
264
|
}
|
|
175
|
-
|
|
176
|
-
process.stdout.write(`
|
|
265
|
+
if (shell === "bash") {
|
|
266
|
+
process.stdout.write(`wrote octen bash completion to ${quotePath(result.path)} (new shells pick it up automatically)\n`);
|
|
267
|
+
return;
|
|
177
268
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
process.stdout.write(`
|
|
269
|
+
// zsh: file on fpath + rc block.
|
|
270
|
+
if (result.action === "already") {
|
|
271
|
+
process.stdout.write(`octen completion already configured in ${quotePath(result.path)} (refreshed ${quotePath(result.file)})\n`);
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
process.stdout.write(`installed octen completion: wrote ${quotePath(result.file)} and updated ${quotePath(result.path)}\n`);
|
|
181
275
|
}
|
|
276
|
+
process.stdout.write("run `source ~/.zshrc` (or open a new terminal) to activate it now\n");
|
|
182
277
|
});
|
|
183
278
|
}
|
|
@@ -7,15 +7,12 @@ export function registerImageSearch(program) {
|
|
|
7
7
|
program
|
|
8
8
|
.command("image-search")
|
|
9
9
|
.argument("[query...]", "search query (optional if --image is given)")
|
|
10
|
-
.description("In Beta. Contact us to request beta access. — Search the web for images by text
|
|
10
|
+
.description("In Beta. Contact us to request beta access. — Search the web for images by text or by image (one or the other). Use --topic design for UI design references (returns a style summary and html_snippet per result)")
|
|
11
11
|
.option("--image <url|path>", "image input: public URL or local file path")
|
|
12
12
|
.option("--topic <t>", "general|design")
|
|
13
13
|
.option("-n, --count <n>", "results 1-10", parseIntOpt("--count"))
|
|
14
14
|
.option("--include-domains <list>", "comma list", (v) => v.split(","))
|
|
15
15
|
.option("--exclude-domains <list>", "comma list", (v) => v.split(","))
|
|
16
|
-
.option("--time-range <r>", "day|week|month|year (or d|w|m|y)")
|
|
17
|
-
.option("--start-time <when>", "YYYY-MM-DD or ISO datetime (e.g. 2024-01-01T00:00:00Z)")
|
|
18
|
-
.option("--end-time <when>", "YYYY-MM-DD or ISO datetime (e.g. 2024-12-31T23:59:59Z)")
|
|
19
16
|
.option("--safesearch <s>", "off|strict")
|
|
20
17
|
.option("--html-snippet", "include HTML snippet for each result")
|
|
21
18
|
.option("--html-snippet-max-tokens <n>", "max tokens per HTML snippet", parseIntOpt("--html-snippet-max-tokens"))
|
|
@@ -29,9 +26,6 @@ export function registerImageSearch(program) {
|
|
|
29
26
|
count: opts.count,
|
|
30
27
|
includeDomains: opts.includeDomains,
|
|
31
28
|
excludeDomains: opts.excludeDomains,
|
|
32
|
-
timeRange: opts.timeRange,
|
|
33
|
-
startTime: opts.startTime,
|
|
34
|
-
endTime: opts.endTime,
|
|
35
29
|
safesearch: opts.safesearch,
|
|
36
30
|
htmlSnippet: opts.htmlSnippet,
|
|
37
31
|
htmlSnippetMaxTokens: opts.htmlSnippetMaxTokens,
|
package/dist/commands/search.js
CHANGED
|
@@ -19,7 +19,7 @@ export function registerSearch(program, fixedTopic) {
|
|
|
19
19
|
.option("--language <list>", "ISO 639-1 codes, comma-separated, e.g. en,ja", (v) => v.split(","))
|
|
20
20
|
.option("--highlight").option("--highlight-max-tokens <n>", "max tokens per highlight", parseIntOpt("--highlight-max-tokens"))
|
|
21
21
|
.option("--full-content").option("--full-content-max-tokens <n>", "max tokens per result", parseIntOpt("--full-content-max-tokens"))
|
|
22
|
-
.option("--images")
|
|
22
|
+
.option("--images");
|
|
23
23
|
if (!fixedTopic)
|
|
24
24
|
cmd.option("--topic <t>", "general|news");
|
|
25
25
|
cmd.action(async (queryArg, opts, command) => {
|
package/package.json
CHANGED
|
@@ -94,8 +94,8 @@ POST https://api.octen.ai/search
|
|
|
94
94
|
|--|--|--|--|--|
|
|
95
95
|
| `query` | string | **Yes** | - | Search query (max 500 chars) |
|
|
96
96
|
| `count` | integer | No | `5` | Number of results (1–100) |
|
|
97
|
-
| `include_domains` | string[] | No | - | Only include results from these domains (max
|
|
98
|
-
| `exclude_domains` | string[] | No | - | Exclude results from these domains (max
|
|
97
|
+
| `include_domains` | string[] | No | - | Only include results from these domains (max 1200 domains, each max 60 chars) |
|
|
98
|
+
| `exclude_domains` | string[] | No | - | Exclude results from these domains (max 1200 domains, each max 60 chars) |
|
|
99
99
|
| `include_text` | string[] | No | - | Strings that must appear in result page text (max 5 items, each max 30 chars) |
|
|
100
100
|
| `exclude_text` | string[] | No | - | Strings that must not appear in result page text (max 5 items, each max 30 chars) |
|
|
101
101
|
| `time_basis` | string | No | `auto` | Time field used for filtering: `auto`, `published`, `crawled` |
|