diff --git a/src/__tests__/alexandria-beta.test.ts b/src/__tests__/alexandria-beta.test.ts index 3cc1456ea0..e84e17d4de 100644 --- a/src/__tests__/alexandria-beta.test.ts +++ b/src/__tests__/alexandria-beta.test.ts @@ -288,6 +288,7 @@ it('preserves scoped next requests, pagination and discovery receipts', async () output, ]); expect(result.code).toBe(0); + expect(result.stderr).not.toMatch(/Request ID:|Scrape ID:|Credits:/); expect(requests[0].body.alexandria).toEqual([next]); const parsed = JSON.parse(readFileSync(output, 'utf8')); const page = parsed.data.alexandria[0].data; diff --git a/src/commands/alexandria.ts b/src/commands/alexandria.ts index 77f57caa96..0ca1a11a71 100644 --- a/src/commands/alexandria.ts +++ b/src/commands/alexandria.ts @@ -15,6 +15,7 @@ export type AlexandriaOptions = { output?: string; json?: boolean; pretty?: boolean; + showReceipt?: boolean; }; export function requireAlexandriaKey(apiKey?: string): void { @@ -125,7 +126,7 @@ export async function requestAlexandria( throw new Error('Invalid --request-id.'); requireAlexandriaKey(options.apiKey); // Print before execution so even an interrupted request can reuse its identity. - console.error(`Request ID: ${requestId}`); + if (options.showReceipt !== false) console.error(`Request ID: ${requestId}`); let envelope: Record; try { const app = getClient({ apiKey: options.apiKey, apiUrl: options.apiUrl }); @@ -147,7 +148,7 @@ export async function requestAlexandria( envelope = apiFailure(error); } const receipt = receiptFor(envelope, 'scrape', requestId); - printReceipt(receipt, false); + if (options.showReceipt !== false) printReceipt(receipt, false); printRetry(envelope); return { ...envelope, requestId, receipt }; } diff --git a/src/commands/list.ts b/src/commands/list.ts index 4f095a81f1..97ee1bfaec 100644 --- a/src/commands/list.ts +++ b/src/commands/list.ts @@ -330,7 +330,7 @@ export async function handleList( options: selectors, }, ], - options + { ...options, showReceipt: false } ); receipts.push({ requestId: envelope.requestId,