-
Notifications
You must be signed in to change notification settings - Fork 3
feat(cli): make --debug output structured and useful (ENG-92248)
#536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
blainekasten
wants to merge
8
commits into
main
Choose a base branch
from
cursor/cli-debug-output-8b9e
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1a3758e
feat(cli): make --debug output structured and useful (ENG-92248)
cursoragent 52ed9db
simplify debug output
blainekasten f15bf7c
improve debug logs compatibility with loading spinners
blainekasten f246228
fix(cli): stop doubling the debug prefix on session banner
cursoragent dd89105
fix(cli): address --debug review findings
cursoragent cbca3f5
fix(cli): address remaining --debug review findings
cursoragent 274fed0
fix(cli): avoid Broly flagging the missing-key placeholder
cursoragent 612808f
fix(cli): stop wrapping --debug lines and skip analytics on blocked r…
cursoragent File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,34 @@ | ||
| from __future__ import annotations | ||
|
|
||
| from typing import TypeVar, Awaitable | ||
| from typing import TypeVar, Iterator, Awaitable | ||
| from contextlib import contextmanager | ||
|
|
||
| from together.lib.cli.utils._debug import is_enabled, log_debug_note | ||
| from together.lib.cli.utils._console import console | ||
|
|
||
| T = TypeVar("T") | ||
|
|
||
|
|
||
| async def show_loading_status(message: str, request: Awaitable[T]) -> T: | ||
| @contextmanager | ||
| def loading_status(message: str) -> Iterator[None]: | ||
| """Show a spinner, or a debug line when ``--debug`` is on. | ||
|
|
||
| Rich Live (stdout) and debug logs (stderr) share the terminal cursor, so a | ||
| spinner would overwrite HTTP debug lines. Skip Live UI in debug mode. | ||
| """ | ||
| if is_enabled(): | ||
| if message: | ||
| log_debug_note(message) | ||
| yield | ||
| return | ||
| with console.status( | ||
| f"[progress.description]{message}[/progress.description]", | ||
| spinner="dots", | ||
| spinner_style="bar.pulse", | ||
| ): | ||
| yield | ||
|
|
||
|
|
||
| async def show_loading_status(message: str, request: Awaitable[T]) -> T: | ||
| with loading_status(message): | ||
| return await request |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.