Add verbose CLI debug logging#13
Merged
Merged
Conversation
d48c1fa to
f5c7388
Compare
Add global timeout and max-retries flags, pass timeout into the SDK client, and wrap scrape requests with exponential backoff for 429/5xx failures so transient API errors recover automatically. Co-authored-by: Cursor <cursoragent@cursor.com>
Add a root --verbose flag that traces auth source, request target, retry attempts, and response latency for scrape commands without exposing token values. Keep stdout unchanged so command output remains pipe-friendly. Co-authored-by: Cursor <cursoragent@cursor.com>
Rearranged the properties in the RootOptions interface for consistency. Updated the verbose logging in the scrape execution to improve readability. Adjusted test cases for better formatting of expected error messages and verbose output.
aae2579 to
005f3b4
Compare
Eliminated the --timeout and --max-retries options from the CLI, simplifying the command structure. Updated the createDecodoClient function to remove the timeout parameter. Removed the retryWithBackoff utility and associated tests to streamline error handling in scrape execution. Adjusted related tests to reflect these changes.
…e tests Consolidated the command arguments in the target scrape test to a single line for improved readability and maintainability. This change enhances the clarity of the test setup without altering its functionality.
Added a new `global-opts.ts` file to define root options for CLI commands, including a `verbose` flag. Updated existing commands to utilize the new `getRootOpts` function for improved option handling. Implemented a `verboseLog` function to enhance logging capabilities, allowing for detailed output during command execution. Additionally, created a `formatScrapeRequestLog` function to sanitize and format scrape request logs, ensuring sensitive information is redacted. Added tests for the new logging functionality to ensure correctness.
Merged
9 tasks
ChinchillaLover9000
approved these changes
Jun 8, 2026
| try { | ||
| const parsed = new URL(value); | ||
| for (const key of parsed.searchParams.keys()) { | ||
| if (SENSITIVE_QUERY_PARAM_KEYS.has(key.toLowerCase())) { |
There was a problem hiding this comment.
id suggest flipping this inside out to check if key.toLowerCase() has any of the SENSITIVE_QUERY_PARAM_KEYS. This would catch cases where key may be access_token.
thank u claude
|
|
| verboseLog(verbose, formatScrapeRequestLog(body)); | ||
| const outputContext = getOutputContext?.(input, options); | ||
| await executeScrape(token, schema, body, options, outputContext, input); | ||
| await executeScrape( |
There was a problem hiding this comment.
nit: consider moving params to an object (not necessarily this PR)
domantas-jurkus-dcd
approved these changes
Jun 8, 2026
Eliminated the requireAuthToken function from the resolve-token service, simplifying the authentication token resolution process. Updated tests to remove references to the removed function, ensuring the test suite remains clean and focused on the current functionality.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
-v, --verboseflag; diagnostics go to stderr only, stdout stays machine-readablesrc/cli/services/(global-opts,verbose-log)Example
stderr:
stdout is unchanged (JSON or text per output flags). Without
--verbose, stderr stays silent.Test plan
pnpm test--verboseagainst live API