Skip to content

feat(cli): make --debug output structured and useful (ENG-92248) - #536

Draft
blainekasten wants to merge 2 commits into
mainfrom
cursor/cli-debug-output-8b9e
Draft

feat(cli): make --debug output structured and useful (ENG-92248)#536
blainekasten wants to merge 2 commits into
mainfrom
cursor/cli-debug-output-8b9e

Conversation

@blainekasten

Copy link
Copy Markdown
Collaborator

Fixes ENG-92248.

--debug used to dump Stainless/httpx DEBUG logs as plain text: full Headers(...) objects, request-option dumps (including secrets), analytics internals, and checksum-chunk spam. That’s hard to scan and mostly noise.

This replaces that with a CLI-owned stderr trace:

  • Session banner: CLI/Python versions, command, base URL, project, masked API key, timeout, retries
  • HTTP request/response pairs with color, duration, request id, interesting headers only
  • Pretty-printed JSON bodies (truncated), secrets redacted
  • Stainless boilerplate, Cloudflare/date/server headers, and telemetry logs filtered out
  • --debug is a documented Global Option; JSON mode stays on stdout

Example:

debug  tg 2.31.0  python 3.12.3  linux
debug  tg whoami
debug  https://api.together.ai/v1/
debug  project=proj  key=…0000  timeout=off  retries=0
→ GET /whoami
  authorization: Bearer …0000
  user-agent: AsyncTogether/Python 2.31.0
← 200 OK  48ms  req_abc
  {
    "project_id": "proj",
    ...
  }

Linear Issue: ENG-92248

Open in Web Open in Cursor 

Replace the spammy Stainless/httpx DEBUG dump with Rich-formatted
stderr traces: session context, redacted HTTP request/response
pairs, request ids, timing, and JSON bodies. Hide noise such as
full header objects, analytics internals, and x-stainless boilerplate.

Co-authored-by: Blaine Kasten <blainekasten@gmail.com>
@broly-code-security-scanner

Copy link
Copy Markdown

Broly Security Scan

Note

Clean scan
No vulnerabilities detected in this PR.

Note

Re-scan this PR anytime with /broly scan — useful after /broly undismiss, or to refresh findings without a new push.

Broly — SAST (zai-org/GLM-5.2) · Secrets · SCA · IaC · GH Actions · Base Images · Supply Chain Threats · Exploit Chains · Adversarial Verification

We're continuously improving Broly's accuracy and finding quality — your feedback is valuable. False positives, missed findings, bugs, and feature requests all welcome.

Ask in #security-engineering   Powered by Together AI

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.

2 participants