fix: Windows cookie diagnostics (#28) and rich output pipe capture (#29)

- Add win32 branch in _diagnose_keychain_issues() with DPAPI/admin/shadowcopy hints
- Add _make_console() helper in formatter.py with force_terminal=False for Windows non-TTY
- Replace all 6 Console() defaults with _make_console()
- Add test for Windows-specific diagnostics
This commit is contained in:
jackwener
2026-03-16 14:27:53 +08:00
parent 07e7f83e6f
commit 74386cebc8
3 changed files with 44 additions and 6 deletions

View File

@@ -65,6 +65,15 @@ def _diagnose_keychain_issues(diagnostics: List[str]) -> Optional[str]:
" Fix: Open Keychain Access → search for \"<Browser> Safe Storage\" → Access Control → add your Terminal app.\n"
" Or click \"Always Allow\" when the Keychain authorization popup appears."
)
if sys.platform == "win32":
return (
"Windows DPAPI cookie decryption failed.\n"
" Possible causes:\n"
" 1. Chrome is running (locks the cookie database). Try closing Chrome first.\n"
" 2. browser_cookie3 may not support the latest Chrome cookie encryption format.\n"
" 3. If Chrome was running, admin privileges may be required for VSS shadowcopy.\n"
" Workaround: Set TWITTER_AUTH_TOKEN and TWITTER_CT0 environment variables manually."
)
# Linux: gnome-keyring / SecretStorage issues
return (
"System keyring access failed — the cookie encryption key could not be retrieved.\n"