Skip to content

Add verbose CLI debug logging#13

Merged
paulius-krutkis-dcd merged 7 commits into
mainfrom
a7/verbose-logging
Jun 8, 2026
Merged

Add verbose CLI debug logging#13
paulius-krutkis-dcd merged 7 commits into
mainfrom
a7/verbose-logging

Conversation

@paulius-krutkis-dcd

@paulius-krutkis-dcd paulius-krutkis-dcd commented Jun 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Add root -v, --verbose flag; diagnostics go to stderr only, stdout stays machine-readable
  • Log auth source, request target/url-or-query (with sensitive URL params redacted), and response latency
  • Move shared CLI plumbing into src/cli/services/ (global-opts, verbose-log)

Example

decodo --verbose google-search coffee

stderr:

[verbose] auth source=config
[verbose] request target=google_search query=coffee
[verbose] response latency_ms=842

stdout is unchanged (JSON or text per output flags). Without --verbose, stderr stays silent.

Test plan

  • pnpm test
  • Manual run with --verbose against live API

@paulius-krutkis-dcd paulius-krutkis-dcd force-pushed the a7/retry-timeout branch 2 times, most recently from d48c1fa to f5c7388 Compare June 8, 2026 06:20
@paulius-krutkis-dcd paulius-krutkis-dcd changed the base branch from a7/retry-timeout to a7/exit-codes June 8, 2026 07:53
paulius-krutkis-dcd and others added 3 commits June 8, 2026 11:09
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.
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.
@paulius-krutkis-dcd paulius-krutkis-dcd mentioned this pull request Jun 8, 2026
9 tasks
try {
const parsed = new URL(value);
for (const key of parsed.searchParams.keys()) {
if (SENSITIVE_QUERY_PARAM_KEYS.has(key.toLowerCase())) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

@domantas-jurkus-dcd

Copy link
Copy Markdown

requireAuthToken can be deleted

verboseLog(verbose, formatScrapeRequestLog(body));
const outputContext = getOutputContext?.(input, options);
await executeScrape(token, schema, body, options, outputContext, input);
await executeScrape(

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consider moving params to an object (not necessarily this PR)

@paulius-krutkis-dcd paulius-krutkis-dcd changed the base branch from a7/exit-codes to main June 8, 2026 11:54
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.
@paulius-krutkis-dcd paulius-krutkis-dcd merged commit 41229fc into main Jun 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants