scoutline 0.19.7 → 0.20.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/dist/command-invocation.d.ts.map +1 -1
- package/dist/command-invocation.js +5 -0
- package/dist/command-invocation.js.map +1 -1
- package/dist/commands/archive.d.ts +111 -0
- package/dist/commands/archive.d.ts.map +1 -0
- package/dist/commands/archive.js +426 -0
- package/dist/commands/archive.js.map +1 -0
- package/dist/commands/doctor.d.ts +8 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +39 -4
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/fetch.d.ts +75 -0
- package/dist/commands/fetch.d.ts.map +1 -0
- package/dist/commands/fetch.js +592 -0
- package/dist/commands/fetch.js.map +1 -0
- package/dist/commands/read.d.ts.map +1 -1
- package/dist/commands/read.js +14 -0
- package/dist/commands/read.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +92 -7
- package/dist/index.js.map +1 -1
- package/dist/lib/artifacts.d.ts +5 -1
- package/dist/lib/artifacts.d.ts.map +1 -1
- package/dist/lib/artifacts.js +7 -2
- package/dist/lib/artifacts.js.map +1 -1
- package/dist/lib/async-file-lock.d.ts +2 -2
- package/dist/lib/async-file-lock.d.ts.map +1 -1
- package/dist/lib/async-file-lock.js +7 -4
- package/dist/lib/async-file-lock.js.map +1 -1
- package/dist/lib/pdf.d.ts +22 -0
- package/dist/lib/pdf.d.ts.map +1 -0
- package/dist/lib/pdf.js +1213 -0
- package/dist/lib/pdf.js.map +1 -0
- package/dist/lib/tty.d.ts.map +1 -1
- package/dist/lib/tty.js +10 -1
- package/dist/lib/tty.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,592 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fetch command — direct, evidentiary HTTP client (ADR-0006).
|
|
3
|
+
*
|
|
4
|
+
* Consolidates binary-safe direct retrieval and raw REST API calls:
|
|
5
|
+
*
|
|
6
|
+
* - Evidentiary GET (default): byte-exact, streaming to --out with --md5
|
|
7
|
+
* hash verification, real browser User-Agent, following redirects.
|
|
8
|
+
* - Structured API: --method, --data (@body.json or inline), --header.
|
|
9
|
+
*
|
|
10
|
+
* This command is credential-free (no AI provider, no adapter, no LLM
|
|
11
|
+
* translation) and is dispatched before credentialed config load.
|
|
12
|
+
*/
|
|
13
|
+
import { createReadStream, createWriteStream } from "node:fs";
|
|
14
|
+
import * as fs from "node:fs/promises";
|
|
15
|
+
import * as path from "node:path";
|
|
16
|
+
import * as crypto from "node:crypto";
|
|
17
|
+
import { Readable } from "node:stream";
|
|
18
|
+
import { invokeCommand } from "../command-invocation.js";
|
|
19
|
+
import { ValidationError, FileError, TimeoutError, NetworkError } from "../lib/errors.js";
|
|
20
|
+
import { isPdfBuffer, extractPdfText, repairPdf } from "../lib/pdf.js";
|
|
21
|
+
export const DEFAULT_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36";
|
|
22
|
+
export const DEFAULT_FETCH_TIMEOUT_MS = 30000;
|
|
23
|
+
/**
|
|
24
|
+
* Headers permitted to follow a redirect to a different origin. An
|
|
25
|
+
* ALLOWLIST, not a denylist: any caller-supplied header (X-API-Key,
|
|
26
|
+
* custom auth schemes, ...) is dropped before the other origin is
|
|
27
|
+
* contacted — only the transport-neutral defaults survive.
|
|
28
|
+
*/
|
|
29
|
+
const CROSS_ORIGIN_ALLOWED_HEADERS = new Set([
|
|
30
|
+
"user-agent",
|
|
31
|
+
"accept",
|
|
32
|
+
"accept-encoding",
|
|
33
|
+
// Non-credential request metadata: 307/308 replay the body, and a
|
|
34
|
+
// JSON endpoint needs its Content-Type to parse it.
|
|
35
|
+
"content-type",
|
|
36
|
+
]);
|
|
37
|
+
/**
|
|
38
|
+
* Incrementally read from a ReadableStream up to maxBytes.
|
|
39
|
+
* Throws ValidationError if incoming data exceeds maxBytes without buffering the remainder.
|
|
40
|
+
*/
|
|
41
|
+
export async function readBoundedResponseBody(body, maxBytes, label = "Response size") {
|
|
42
|
+
if (!body) {
|
|
43
|
+
return Buffer.alloc(0);
|
|
44
|
+
}
|
|
45
|
+
const reader = body.getReader();
|
|
46
|
+
const chunks = [];
|
|
47
|
+
let totalBytes = 0;
|
|
48
|
+
try {
|
|
49
|
+
while (true) {
|
|
50
|
+
const { done, value } = await reader.read();
|
|
51
|
+
if (done)
|
|
52
|
+
break;
|
|
53
|
+
if (value) {
|
|
54
|
+
totalBytes += value.byteLength;
|
|
55
|
+
if (totalBytes > maxBytes) {
|
|
56
|
+
await reader.cancel().catch(() => { });
|
|
57
|
+
throw new ValidationError(`${label} (${totalBytes} bytes) exceeds in-memory ceiling (${Math.round(maxBytes / (1024 * 1024))}MB).`, "Use --out <file> to stream large responses directly to disk.");
|
|
58
|
+
}
|
|
59
|
+
chunks.push(Buffer.from(value.buffer, value.byteOffset, value.byteLength));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return Buffer.concat(chunks);
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
await reader.cancel().catch(() => { });
|
|
66
|
+
throw err;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
export const FETCH_HELP = `
|
|
70
|
+
scoutline fetch <url> [options] - Direct, binary-safe HTTP client
|
|
71
|
+
|
|
72
|
+
Options:
|
|
73
|
+
--out <file> Save response body directly to a local file
|
|
74
|
+
--md5 Compute and report MD5 checksum of the response
|
|
75
|
+
--sha256 Compute and report SHA-256 checksum (evidentiary digest)
|
|
76
|
+
--raw Emit raw body content directly
|
|
77
|
+
--ua <agent> Custom User-Agent string (default: Chromium)
|
|
78
|
+
--method <verb> HTTP method: GET, POST, PUT, DELETE, PATCH, HEAD (default: GET)
|
|
79
|
+
--data <@file|string> Request body (prefix with @ to read from a local file)
|
|
80
|
+
--header, -H <K:V> Custom HTTP header (can be specified multiple times)
|
|
81
|
+
--pdf <text|raw> PDF processing: text (extract text layer) or raw (preserve bytes)
|
|
82
|
+
--pdf-repair Attempt structural/xref repair on broken PDF documents
|
|
83
|
+
--timeout <ms> Request timeout in milliseconds (default: 30000)
|
|
84
|
+
--help, -h Show this help message
|
|
85
|
+
|
|
86
|
+
Global Options:
|
|
87
|
+
--output-format, -O Output format: data, json, pretty, compact, markdown, refs, tty
|
|
88
|
+
`.trim();
|
|
89
|
+
/**
|
|
90
|
+
* Validate that a URL starts with http:// or https://.
|
|
91
|
+
*/
|
|
92
|
+
export function validateFetchUrl(url) {
|
|
93
|
+
if (!url.startsWith("http://") && !url.startsWith("https://")) {
|
|
94
|
+
throw new ValidationError("URL must start with http:// or https://", "Pass a valid HTTP or HTTPS URL, e.g. scoutline fetch https://example.com/data.json");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Parse fetch CLI arguments supporting multi-flag headers (-H / --header).
|
|
99
|
+
*/
|
|
100
|
+
export function parseFetchArgs(args) {
|
|
101
|
+
let out;
|
|
102
|
+
let md5 = false;
|
|
103
|
+
let sha256 = false;
|
|
104
|
+
let raw = false;
|
|
105
|
+
let ua;
|
|
106
|
+
let method;
|
|
107
|
+
let data;
|
|
108
|
+
let pdf;
|
|
109
|
+
let pdfRepair = false;
|
|
110
|
+
let timeout;
|
|
111
|
+
let showHelp = false;
|
|
112
|
+
const headers = [];
|
|
113
|
+
const positional = [];
|
|
114
|
+
let i = 0;
|
|
115
|
+
while (i < args.length) {
|
|
116
|
+
const arg = args[i];
|
|
117
|
+
if (arg === undefined)
|
|
118
|
+
break;
|
|
119
|
+
if (arg === "--help" || arg === "-h") {
|
|
120
|
+
showHelp = true;
|
|
121
|
+
i++;
|
|
122
|
+
}
|
|
123
|
+
else if (arg === "--md5") {
|
|
124
|
+
md5 = true;
|
|
125
|
+
i++;
|
|
126
|
+
}
|
|
127
|
+
else if (arg === "--sha256") {
|
|
128
|
+
sha256 = true;
|
|
129
|
+
i++;
|
|
130
|
+
}
|
|
131
|
+
else if (arg === "--raw") {
|
|
132
|
+
raw = true;
|
|
133
|
+
i++;
|
|
134
|
+
}
|
|
135
|
+
else if (arg === "--out") {
|
|
136
|
+
const next = args[i + 1];
|
|
137
|
+
if (!next || next.startsWith("-")) {
|
|
138
|
+
throw new ValidationError("--out requires a file path argument.");
|
|
139
|
+
}
|
|
140
|
+
out = next;
|
|
141
|
+
i += 2;
|
|
142
|
+
}
|
|
143
|
+
else if (arg === "--ua" || arg === "-A" || arg === "--user-agent") {
|
|
144
|
+
const next = args[i + 1];
|
|
145
|
+
if (!next || next.startsWith("-")) {
|
|
146
|
+
throw new ValidationError(`${arg} requires a User-Agent string argument.`);
|
|
147
|
+
}
|
|
148
|
+
ua = next;
|
|
149
|
+
i += 2;
|
|
150
|
+
}
|
|
151
|
+
else if (arg === "--method" || arg === "-X") {
|
|
152
|
+
const next = args[i + 1];
|
|
153
|
+
if (!next || next.startsWith("-")) {
|
|
154
|
+
throw new ValidationError(`${arg} requires an HTTP verb argument.`);
|
|
155
|
+
}
|
|
156
|
+
method = next.toUpperCase();
|
|
157
|
+
i += 2;
|
|
158
|
+
}
|
|
159
|
+
else if (arg === "--data") {
|
|
160
|
+
const next = args[i + 1];
|
|
161
|
+
if (next === undefined) {
|
|
162
|
+
throw new ValidationError("--data requires a payload argument.");
|
|
163
|
+
}
|
|
164
|
+
data = next;
|
|
165
|
+
i += 2;
|
|
166
|
+
}
|
|
167
|
+
else if (arg === "--header" || arg === "-H") {
|
|
168
|
+
const next = args[i + 1];
|
|
169
|
+
if (!next || !next.includes(":")) {
|
|
170
|
+
throw new ValidationError(`${arg} requires a "Header: Value" argument.`, 'Example: -H "Authorization: Bearer token"');
|
|
171
|
+
}
|
|
172
|
+
headers.push(next);
|
|
173
|
+
i += 2;
|
|
174
|
+
}
|
|
175
|
+
else if (arg === "--pdf") {
|
|
176
|
+
const next = args[i + 1];
|
|
177
|
+
if (next !== "text" && next !== "raw") {
|
|
178
|
+
throw new ValidationError(`Invalid --pdf mode: "${next}".`, "Valid modes: text, raw.");
|
|
179
|
+
}
|
|
180
|
+
pdf = next;
|
|
181
|
+
i += 2;
|
|
182
|
+
}
|
|
183
|
+
else if (arg === "--pdf-repair") {
|
|
184
|
+
pdfRepair = true;
|
|
185
|
+
i++;
|
|
186
|
+
}
|
|
187
|
+
else if (arg === "--timeout") {
|
|
188
|
+
const next = args[i + 1];
|
|
189
|
+
const parsedTimeout = Number(next);
|
|
190
|
+
if (!next ||
|
|
191
|
+
!/^\d+$/.test(next) ||
|
|
192
|
+
parsedTimeout <= 0 ||
|
|
193
|
+
!Number.isSafeInteger(parsedTimeout)) {
|
|
194
|
+
throw new ValidationError("--timeout requires a positive integer in milliseconds.", "The value must be a safe integer (e.g. 30000), not zero or an oversized digit string.");
|
|
195
|
+
}
|
|
196
|
+
timeout = parsedTimeout;
|
|
197
|
+
i += 2;
|
|
198
|
+
}
|
|
199
|
+
else if (!arg.startsWith("-")) {
|
|
200
|
+
positional.push(arg);
|
|
201
|
+
i++;
|
|
202
|
+
}
|
|
203
|
+
else {
|
|
204
|
+
// Global options accepted in rest stream
|
|
205
|
+
if (arg === "-O" || arg === "--output-format" || arg === "--save-format") {
|
|
206
|
+
i += 2;
|
|
207
|
+
}
|
|
208
|
+
else if (arg === "--save" || arg === "--save-force" || arg === "--isolated") {
|
|
209
|
+
i++;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
throw new ValidationError(`Unknown option: "${arg}".`, 'Run "scoutline fetch --help" for available options.');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return {
|
|
217
|
+
options: {
|
|
218
|
+
...(out ? { out } : {}),
|
|
219
|
+
...(md5 ? { md5: true } : {}),
|
|
220
|
+
...(sha256 ? { sha256: true } : {}),
|
|
221
|
+
...(raw ? { raw: true } : {}),
|
|
222
|
+
...(ua ? { ua } : {}),
|
|
223
|
+
...(method ? { method } : {}),
|
|
224
|
+
...(data !== undefined ? { data } : {}),
|
|
225
|
+
...(headers.length > 0 ? { headers } : {}),
|
|
226
|
+
...(pdf ? { pdf } : {}),
|
|
227
|
+
...(pdfRepair ? { pdfRepair: true } : {}),
|
|
228
|
+
...(timeout !== undefined ? { timeout } : {}),
|
|
229
|
+
},
|
|
230
|
+
positional,
|
|
231
|
+
showHelp,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Pure execution of the fetch operation.
|
|
236
|
+
*/
|
|
237
|
+
export async function executeFetch(url, options = {}) {
|
|
238
|
+
validateFetchUrl(url);
|
|
239
|
+
const method = options.method ?? "GET";
|
|
240
|
+
const validMethods = ["GET", "POST", "PUT", "DELETE", "PATCH", "HEAD", "OPTIONS"];
|
|
241
|
+
if (!validMethods.includes(method)) {
|
|
242
|
+
throw new ValidationError(`Unsupported HTTP method "${method}".`, `Valid methods: ${validMethods.join(", ")}`);
|
|
243
|
+
}
|
|
244
|
+
// Parse headers
|
|
245
|
+
const reqHeaders = {
|
|
246
|
+
"User-Agent": options.ua ?? DEFAULT_USER_AGENT,
|
|
247
|
+
Accept: "*/*",
|
|
248
|
+
// Ask the origin for an uncompressed body: undici transparently
|
|
249
|
+
// decodes Content-Encoding, so accepting gzip/br would make --out,
|
|
250
|
+
// --md5, and --sha256 describe DECODED bytes rather than what the
|
|
251
|
+
// origin served. With identity the received body is the wire body.
|
|
252
|
+
"Accept-Encoding": "identity",
|
|
253
|
+
};
|
|
254
|
+
if (options.headers) {
|
|
255
|
+
for (const h of options.headers) {
|
|
256
|
+
const colonIdx = h.indexOf(":");
|
|
257
|
+
if (colonIdx > 0) {
|
|
258
|
+
const k = h.slice(0, colonIdx).trim();
|
|
259
|
+
const v = h.slice(colonIdx + 1).trim();
|
|
260
|
+
reqHeaders[k] = v;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
// Parse body. File-backed payloads (@file) STREAM from disk so a
|
|
265
|
+
// large upload cannot exhaust the CLI's heap before the request
|
|
266
|
+
// starts; the path is validated (regular file) up front and retained
|
|
267
|
+
// so redirect hops can reopen a FRESH stream — undici cannot replay a
|
|
268
|
+
// consumed ReadableStream on 307/308.
|
|
269
|
+
let dataFilePath;
|
|
270
|
+
let inlineData;
|
|
271
|
+
if (options.data !== undefined) {
|
|
272
|
+
if (method === "GET" || method === "HEAD") {
|
|
273
|
+
throw new ValidationError(`Cannot send request body with HTTP ${method}.`);
|
|
274
|
+
}
|
|
275
|
+
if (options.data.startsWith("@")) {
|
|
276
|
+
dataFilePath = path.resolve(process.cwd(), options.data.slice(1));
|
|
277
|
+
try {
|
|
278
|
+
const st = await fs.stat(dataFilePath);
|
|
279
|
+
if (!st.isFile()) {
|
|
280
|
+
throw new FileError(`Request body path "${dataFilePath}" is not a regular file.`);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
catch (err) {
|
|
284
|
+
if (err instanceof FileError)
|
|
285
|
+
throw err;
|
|
286
|
+
throw new FileError(`Failed to read request body file "${dataFilePath}": ${err instanceof Error ? err.message : String(err)}`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
inlineData = options.data;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
const buildRequestBody = () => dataFilePath !== undefined
|
|
294
|
+
? Readable.toWeb(createReadStream(dataFilePath))
|
|
295
|
+
: inlineData;
|
|
296
|
+
const timeoutMs = options.timeout ?? DEFAULT_FETCH_TIMEOUT_MS;
|
|
297
|
+
const controller = new AbortController();
|
|
298
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
299
|
+
let response;
|
|
300
|
+
const resHeaders = {};
|
|
301
|
+
let contentType;
|
|
302
|
+
let contentTypeLower;
|
|
303
|
+
let outPath;
|
|
304
|
+
let rawBuffer = null;
|
|
305
|
+
let bytes = 0;
|
|
306
|
+
let md5;
|
|
307
|
+
let sha256;
|
|
308
|
+
const md5Hasher = options.md5 ? crypto.createHash("md5") : null;
|
|
309
|
+
// SHA-256 is the evidentiary digest (collision-resistant); MD5 stays
|
|
310
|
+
// for transmission-integrity compatibility. Both, when requested,
|
|
311
|
+
// always describe the ORIGINAL response bytes.
|
|
312
|
+
const sha256Hasher = options.sha256 ? crypto.createHash("sha256") : null;
|
|
313
|
+
try {
|
|
314
|
+
// Redirects are followed MANUALLY: each hop rebuilds the request
|
|
315
|
+
// body (a fresh file stream for @file payloads — undici cannot
|
|
316
|
+
// replay a consumed stream on 307/308) and applies the standard
|
|
317
|
+
// method downgrade (301/302/303 POST -> GET, per browser and
|
|
318
|
+
// undici follow semantics).
|
|
319
|
+
let currentMethod = method;
|
|
320
|
+
let requestUrl = url;
|
|
321
|
+
let hopHeaders = reqHeaders;
|
|
322
|
+
for (let hop = 0;; hop++) {
|
|
323
|
+
const hopBody = buildRequestBody();
|
|
324
|
+
response = await fetch(requestUrl, {
|
|
325
|
+
method: currentMethod,
|
|
326
|
+
headers: hopHeaders,
|
|
327
|
+
body: hopBody,
|
|
328
|
+
// Required by undici for streaming request bodies (@file payloads).
|
|
329
|
+
...(hopBody !== undefined && typeof hopBody !== "string" ? { duplex: "half" } : {}),
|
|
330
|
+
redirect: "manual",
|
|
331
|
+
signal: controller.signal,
|
|
332
|
+
});
|
|
333
|
+
const location = response.headers.get("location");
|
|
334
|
+
const redirectable = [301, 302, 303, 307, 308].includes(response.status);
|
|
335
|
+
if (!redirectable || !location)
|
|
336
|
+
break;
|
|
337
|
+
await response.body?.cancel().catch(() => { });
|
|
338
|
+
if (hop >= 10) {
|
|
339
|
+
throw new NetworkError(`Too many redirects (>10) while fetching ${url}`);
|
|
340
|
+
}
|
|
341
|
+
const nextUrl = new URL(location, requestUrl).toString();
|
|
342
|
+
// Cross-origin redirect: never forward credential-bearing headers
|
|
343
|
+
// to the other origin (fetch-spec redirect semantics). Once
|
|
344
|
+
// stripped they stay stripped for later hops.
|
|
345
|
+
if (new URL(nextUrl).origin !== new URL(requestUrl).origin) {
|
|
346
|
+
// Allowlist (case-insensitive): caller headers never cross
|
|
347
|
+
// origins; only the default transport headers survive.
|
|
348
|
+
hopHeaders = Object.fromEntries(Object.entries(hopHeaders).filter(([key]) => CROSS_ORIGIN_ALLOWED_HEADERS.has(key.toLowerCase())));
|
|
349
|
+
}
|
|
350
|
+
requestUrl = nextUrl;
|
|
351
|
+
// 303 downgrades any method except GET and HEAD (a HEAD redirect
|
|
352
|
+
// must stay metadata-only, never switch to a body-downloading
|
|
353
|
+
// GET); 301/302 downgrade POST per browser semantics.
|
|
354
|
+
if ((response.status === 303 && currentMethod !== "GET" && currentMethod !== "HEAD") ||
|
|
355
|
+
((response.status === 301 || response.status === 302) && currentMethod === "POST")) {
|
|
356
|
+
currentMethod = "GET";
|
|
357
|
+
dataFilePath = undefined;
|
|
358
|
+
inlineData = undefined;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
response.headers.forEach((val, key) => {
|
|
362
|
+
resHeaders[key.toLowerCase()] = val;
|
|
363
|
+
});
|
|
364
|
+
contentType = resHeaders["content-type"] || undefined;
|
|
365
|
+
// Media types are case-insensitive (Text/Plain is text): normalize
|
|
366
|
+
// before any classification so mixed-case types are not binary.
|
|
367
|
+
contentTypeLower = contentType?.toLowerCase();
|
|
368
|
+
const isPdfHeader = Boolean(contentTypeLower && contentTypeLower.includes("application/pdf"));
|
|
369
|
+
const MAX_IN_MEMORY_BYTES = 50 * 1024 * 1024; // 50MB ceiling without --out
|
|
370
|
+
if (options.out && response.ok && response.body && !options.pdfRepair && options.pdf !== "text") {
|
|
371
|
+
outPath = path.resolve(process.cwd(), options.out);
|
|
372
|
+
const tempPath = `${outPath}.tmp.${process.pid}.${crypto.randomUUID()}`;
|
|
373
|
+
try {
|
|
374
|
+
await fs.mkdir(path.dirname(outPath), { recursive: true });
|
|
375
|
+
const writeStream = createWriteStream(tempPath);
|
|
376
|
+
const nodeReadable = Readable.fromWeb(response.body);
|
|
377
|
+
await new Promise((resolve, reject) => {
|
|
378
|
+
nodeReadable.on("data", (chunk) => {
|
|
379
|
+
bytes += chunk.length;
|
|
380
|
+
if (md5Hasher)
|
|
381
|
+
md5Hasher.update(chunk);
|
|
382
|
+
if (sha256Hasher)
|
|
383
|
+
sha256Hasher.update(chunk);
|
|
384
|
+
});
|
|
385
|
+
nodeReadable.pipe(writeStream);
|
|
386
|
+
writeStream.on("finish", () => resolve());
|
|
387
|
+
writeStream.on("error", (err) => {
|
|
388
|
+
writeStream.destroy();
|
|
389
|
+
reject(err);
|
|
390
|
+
});
|
|
391
|
+
nodeReadable.on("error", (err) => {
|
|
392
|
+
writeStream.destroy();
|
|
393
|
+
// A body-stream failure is a REMOTE transfer failure, not a
|
|
394
|
+
// local filesystem error — classify it so the JSON error
|
|
395
|
+
// contract reports NETWORK, not FILE.
|
|
396
|
+
reject(new NetworkError(`Response body stream failed while writing to disk: ${err instanceof Error ? err.message : String(err)}`));
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
await fs.rename(tempPath, outPath);
|
|
400
|
+
}
|
|
401
|
+
catch (err) {
|
|
402
|
+
await fs.unlink(tempPath).catch(() => { });
|
|
403
|
+
if (err instanceof NetworkError)
|
|
404
|
+
throw err;
|
|
405
|
+
throw new FileError(`Failed to write output file "${outPath}": ${err instanceof Error ? err.message : String(err)}`);
|
|
406
|
+
}
|
|
407
|
+
if (md5Hasher) {
|
|
408
|
+
md5 = md5Hasher.digest("hex");
|
|
409
|
+
}
|
|
410
|
+
if (sha256Hasher) {
|
|
411
|
+
sha256 = sha256Hasher.digest("hex");
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
else {
|
|
415
|
+
// Every buffered path — including error bodies reached when --out
|
|
416
|
+
// cannot stream (non-ok responses have no evidentiary value worth
|
|
417
|
+
// an unbounded buffer) — is subject to the same in-memory ceiling.
|
|
418
|
+
// Bodiless responses (HEAD, 204, 304) never allocate a body, so
|
|
419
|
+
// their (metadata-only) Content-Length must not trip the ceiling.
|
|
420
|
+
const bodiless = method === "HEAD" || response.status === 204 || response.status === 304;
|
|
421
|
+
const contentLengthHeader = resHeaders["content-length"];
|
|
422
|
+
if (!bodiless &&
|
|
423
|
+
contentLengthHeader &&
|
|
424
|
+
Number(contentLengthHeader) > MAX_IN_MEMORY_BYTES) {
|
|
425
|
+
// Release the connection before throwing: an uncancelled body
|
|
426
|
+
// keeps the keep-alive socket pinned until process exit.
|
|
427
|
+
await response.body?.cancel().catch(() => { });
|
|
428
|
+
throw new ValidationError(`Response size (${contentLengthHeader} bytes) exceeds in-memory ceiling (50MB).`, "Use --out <file> to stream large responses directly to disk.");
|
|
429
|
+
}
|
|
430
|
+
rawBuffer = await readBoundedResponseBody(response.body, MAX_IN_MEMORY_BYTES, "Response size");
|
|
431
|
+
bytes = rawBuffer.length;
|
|
432
|
+
if (md5Hasher) {
|
|
433
|
+
md5 = md5Hasher.update(rawBuffer).digest("hex");
|
|
434
|
+
}
|
|
435
|
+
if (sha256Hasher) {
|
|
436
|
+
sha256 = sha256Hasher.update(rawBuffer).digest("hex");
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
catch (err) {
|
|
441
|
+
if (controller.signal.aborted) {
|
|
442
|
+
throw new TimeoutError(timeoutMs, `Direct fetch timed out after ${timeoutMs}ms`);
|
|
443
|
+
}
|
|
444
|
+
if (err instanceof FileError || err instanceof TimeoutError || err instanceof ValidationError) {
|
|
445
|
+
throw err;
|
|
446
|
+
}
|
|
447
|
+
// A @file payload that vanishes or fails to open mid-flight surfaces
|
|
448
|
+
// as a raw undici TypeError with a filesystem cause: classify it as
|
|
449
|
+
// the local file error it is, not a network failure.
|
|
450
|
+
const causeCode = err?.cause?.code;
|
|
451
|
+
if (causeCode && ["ENOENT", "EISDIR", "EACCES", "EPERM"].includes(causeCode)) {
|
|
452
|
+
throw new FileError(`Failed to read request body file: ${causeCode} (${dataFilePath ?? "unknown path"})`);
|
|
453
|
+
}
|
|
454
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
455
|
+
throw new NetworkError(`Fetch failed: ${msg}`);
|
|
456
|
+
}
|
|
457
|
+
finally {
|
|
458
|
+
clearTimeout(timer);
|
|
459
|
+
}
|
|
460
|
+
const isPdf = (rawBuffer !== null && isPdfBuffer(rawBuffer)) ||
|
|
461
|
+
Boolean(contentTypeLower && contentTypeLower.includes("application/pdf"));
|
|
462
|
+
// Decode content string for text-compatible bodies
|
|
463
|
+
let content;
|
|
464
|
+
if (isPdf && rawBuffer !== null) {
|
|
465
|
+
// The retrieved body is the evidence: --md5, --out, and the byte
|
|
466
|
+
// count always describe the ORIGINAL response bytes. The repaired
|
|
467
|
+
// buffer exists only to make extraction possible (--pdf text) —
|
|
468
|
+
// hashing or persisting it would misdescribe what the origin sent.
|
|
469
|
+
let pdfBuf = rawBuffer;
|
|
470
|
+
if (options.pdfRepair) {
|
|
471
|
+
pdfBuf = Buffer.from(await repairPdf(pdfBuf, timeoutMs));
|
|
472
|
+
}
|
|
473
|
+
if (options.pdf === "text") {
|
|
474
|
+
content = await extractPdfText(pdfBuf, timeoutMs);
|
|
475
|
+
}
|
|
476
|
+
if (options.out && response.ok) {
|
|
477
|
+
outPath = path.resolve(process.cwd(), options.out);
|
|
478
|
+
const tempPath = `${outPath}.tmp.${process.pid}.${crypto.randomUUID()}`;
|
|
479
|
+
try {
|
|
480
|
+
await fs.mkdir(path.dirname(outPath), { recursive: true });
|
|
481
|
+
await fs.writeFile(tempPath, rawBuffer);
|
|
482
|
+
await fs.rename(tempPath, outPath);
|
|
483
|
+
}
|
|
484
|
+
catch (err) {
|
|
485
|
+
await fs.unlink(tempPath).catch(() => { });
|
|
486
|
+
throw new FileError(`Failed to write output file "${outPath}": ${err instanceof Error ? err.message : String(err)}`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
else if (rawBuffer !== null) {
|
|
491
|
+
if (options.out && response.ok) {
|
|
492
|
+
outPath = path.resolve(process.cwd(), options.out);
|
|
493
|
+
const tempPath = `${outPath}.tmp.${process.pid}.${crypto.randomUUID()}`;
|
|
494
|
+
try {
|
|
495
|
+
await fs.mkdir(path.dirname(outPath), { recursive: true });
|
|
496
|
+
await fs.writeFile(tempPath, rawBuffer);
|
|
497
|
+
await fs.rename(tempPath, outPath);
|
|
498
|
+
}
|
|
499
|
+
catch (err) {
|
|
500
|
+
await fs.unlink(tempPath).catch(() => { });
|
|
501
|
+
throw new FileError(`Failed to write output file "${outPath}": ${err instanceof Error ? err.message : String(err)}`);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
const isBinary = contentTypeLower !== undefined &&
|
|
505
|
+
!contentTypeLower.includes("text") &&
|
|
506
|
+
!contentTypeLower.includes("json") &&
|
|
507
|
+
!contentTypeLower.includes("xml") &&
|
|
508
|
+
!contentTypeLower.includes("javascript") &&
|
|
509
|
+
!contentTypeLower.includes("csv") &&
|
|
510
|
+
!contentTypeLower.includes("html");
|
|
511
|
+
// Binary classification is respected on the in-memory path too: a
|
|
512
|
+
// binary body without --out must NOT be decoded as UTF-8 (lossy
|
|
513
|
+
// mojibake); the presentation falls back to the binary summary and
|
|
514
|
+
// byte-exact output remains --out's contract.
|
|
515
|
+
if (!isBinary) {
|
|
516
|
+
try {
|
|
517
|
+
content = rawBuffer.toString("utf8");
|
|
518
|
+
}
|
|
519
|
+
catch {
|
|
520
|
+
// Leave undefined if decoding fails
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
return {
|
|
525
|
+
schemaVersion: 1,
|
|
526
|
+
url,
|
|
527
|
+
finalUrl: response.url || url,
|
|
528
|
+
status: response.status,
|
|
529
|
+
statusText: response.statusText,
|
|
530
|
+
headers: resHeaders,
|
|
531
|
+
bytes,
|
|
532
|
+
...(md5 ? { md5 } : {}),
|
|
533
|
+
...(sha256 ? { sha256 } : {}),
|
|
534
|
+
...(outPath ? { outPath } : {}),
|
|
535
|
+
...(contentType ? { contentType } : {}),
|
|
536
|
+
...(content !== undefined ? { content } : {}),
|
|
537
|
+
};
|
|
538
|
+
}
|
|
539
|
+
/**
|
|
540
|
+
* Invocation-seam command wrapper returning CommandResult.
|
|
541
|
+
*/
|
|
542
|
+
export async function fetchCommand(url, options = {}) {
|
|
543
|
+
const data = await executeFetch(url, options);
|
|
544
|
+
let presentationText = "";
|
|
545
|
+
// Gate on the file that was actually WRITTEN (data.outPath is set only
|
|
546
|
+
// after a successful atomic rename): non-OK responses never produce a
|
|
547
|
+
// file and must not claim one.
|
|
548
|
+
if (data.outPath) {
|
|
549
|
+
const md5Text = data.md5 ? ` (MD5: ${data.md5})` : "";
|
|
550
|
+
presentationText = `Fetched ${data.bytes} bytes from ${data.url} -> ${data.outPath}${md5Text} [HTTP ${data.status}]`;
|
|
551
|
+
}
|
|
552
|
+
else if (data.content !== undefined) {
|
|
553
|
+
// Text-compatible bodies are the presentation in every mode; the
|
|
554
|
+
// raw/non-raw distinction is the OUTPUT ROUTING (the dispatcher
|
|
555
|
+
// sends --raw to a text mode so the body prints without the JSON
|
|
556
|
+
// envelope), not the string itself. Byte-exact binary output is
|
|
557
|
+
// --out's contract — stdout remains a text surface.
|
|
558
|
+
presentationText = data.content;
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
presentationText = `[Binary payload: ${data.bytes} bytes, HTTP ${data.status}]`;
|
|
562
|
+
}
|
|
563
|
+
const presentations = {
|
|
564
|
+
tty: presentationText,
|
|
565
|
+
compact: presentationText,
|
|
566
|
+
markdown: presentationText,
|
|
567
|
+
refs: presentationText,
|
|
568
|
+
};
|
|
569
|
+
return {
|
|
570
|
+
kind: "data",
|
|
571
|
+
data,
|
|
572
|
+
presentations,
|
|
573
|
+
exitCode: data.status >= 400 ? 1 : 0,
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Handler invoked by the dispatcher in `src/index.ts`.
|
|
578
|
+
*/
|
|
579
|
+
export async function handleFetch(args, outputMode, deps, forceRaw = false) {
|
|
580
|
+
const { options, positional, showHelp } = parseFetchArgs(args);
|
|
581
|
+
if (showHelp || positional.length === 0) {
|
|
582
|
+
deps.invocation.writeStdout(FETCH_HELP);
|
|
583
|
+
return 0;
|
|
584
|
+
}
|
|
585
|
+
const effectiveOptions = {
|
|
586
|
+
...options,
|
|
587
|
+
raw: forceRaw || options.raw === true,
|
|
588
|
+
};
|
|
589
|
+
const url = positional[0];
|
|
590
|
+
return invokeCommand(deps.invocation, () => fetchCommand(url, effectiveOptions), outputMode, deps.now, deps.secrets);
|
|
591
|
+
}
|
|
592
|
+
//# sourceMappingURL=fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../src/commands/fetch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAY,MAAM,kBAAkB,CAAC;AACpG,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAGvE,MAAM,CAAC,MAAM,kBAAkB,GAC7B,iHAAiH,CAAC;AAEpH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,CAAC;AAE9C;;;;;GAKG;AACH,MAAM,4BAA4B,GAAG,IAAI,GAAG,CAAC;IAC3C,YAAY;IACZ,QAAQ;IACR,iBAAiB;IACjB,kEAAkE;IAClE,oDAAoD;IACpD,cAAc;CACf,CAAC,CAAC;AAEH;;;GAGG;AACH,MAA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