@tiny-fish/cli 0.1.7-next.64 → 0.1.7-next.66

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
@@ -130,6 +130,9 @@ tinyfish fetch content get https://agentql.com --format markdown
130
130
  # Include links and image links
131
131
  tinyfish fetch content get https://agentql.com --links --image-links
132
132
 
133
+ # Bound each URL independently
134
+ tinyfish fetch content get https://agentql.com --per-url-timeout-ms 45000
135
+
133
136
  # Human-readable output
134
137
  tinyfish fetch content get https://agentql.com --pretty
135
138
  ```
@@ -1,6 +1,18 @@
1
+ import { InvalidArgumentError } from "commander";
1
2
  import { getApiKey } from "../lib/auth.js";
2
3
  import { fetchContentGet } from "../lib/client.js";
3
4
  import { handleApiError, out, outLine } from "../lib/output.js";
5
+ const MIN_PER_URL_TIMEOUT_MS = 1;
6
+ const MAX_PER_URL_TIMEOUT_MS = 110000;
7
+ function parsePerUrlTimeoutMs(value) {
8
+ const parsed = Number(value);
9
+ if (!Number.isInteger(parsed) ||
10
+ parsed < MIN_PER_URL_TIMEOUT_MS ||
11
+ parsed > MAX_PER_URL_TIMEOUT_MS) {
12
+ throw new InvalidArgumentError(`must be an integer between ${MIN_PER_URL_TIMEOUT_MS} and ${MAX_PER_URL_TIMEOUT_MS}`);
13
+ }
14
+ return parsed;
15
+ }
4
16
  function printPrettyFetch(response) {
5
17
  outLine(`Results: ${response.results.length}`);
6
18
  outLine(`Errors: ${response.errors.length}`);
@@ -42,6 +54,7 @@ export function registerFetch(program) {
42
54
  .option("--format <format>", "Output format: markdown, html, or json")
43
55
  .option("--links", "Include extracted links")
44
56
  .option("--image-links", "Include extracted image links")
57
+ .option("--per-url-timeout-ms <milliseconds>", "Per-URL timeout budget in milliseconds", parsePerUrlTimeoutMs)
45
58
  .option("--pretty", "Human-readable output")
46
59
  .action(async (urls, opts) => {
47
60
  const apiKey = getApiKey();
@@ -51,6 +64,9 @@ export function registerFetch(program) {
51
64
  ...(opts.format !== undefined ? { format: opts.format } : {}),
52
65
  ...(opts.links !== undefined ? { links: opts.links } : {}),
53
66
  ...(opts.imageLinks !== undefined ? { image_links: opts.imageLinks } : {}),
67
+ ...(opts.perUrlTimeoutMs !== undefined
68
+ ? { per_url_timeout_ms: opts.perUrlTimeoutMs }
69
+ : {}),
54
70
  }, apiKey);
55
71
  if (opts.pretty) {
56
72
  printPrettyFetch(response);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tiny-fish/cli",
3
- "version": "0.1.7-next.64",
3
+ "version": "0.1.7-next.66",
4
4
  "description": "TinyFish CLI — run web automations from your terminal",
5
5
  "type": "module",
6
6
  "bin": {