Created
August 1, 2025 10:55
-
-
Save dabing1022/86093f7ca84ff40c6325e1a36a7a6d7b to your computer and use it in GitHub Desktop.
fix ClaudeCode login
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
#!/usr/bin/env python3 | |
# Required parameters: | |
# @raycast.schemaVersion 1 | |
# @raycast.title fix_cc_login | |
# @raycast.mode compact | |
# Optional parameters: | |
# @raycast.icon 🤖 | |
# @raycast.packageName develper | |
# Documentation: | |
# @raycast.description fix cc login | |
# @raycast.author ChildhoodAndy | |
# @raycast.authorURL https://happycoding.tech | |
import os | |
import json | |
# 展开用户目录 | |
file_path = os.path.expanduser("~/.claude.json") | |
# 检查文件是否存在 | |
if os.path.exists(file_path): | |
try: | |
# 读取原始 JSON 数据 | |
with open(file_path, 'r', encoding='utf-8') as f: | |
data = json.load(f) | |
# 删除字段(如果存在) | |
if "customApiKeyResponses" in data: | |
del data["customApiKeyResponses"] | |
print("已删除 customApiKeyResponses 字段。") | |
else: | |
print("customApiKeyResponses 字段不存在。") | |
# 写回文件 | |
with open(file_path, 'w', encoding='utf-8') as f: | |
json.dump(data, f, indent=2, ensure_ascii=False) | |
print("已更新文件。") | |
except Exception as e: | |
print(f"处理过程中发生错误: {e}") | |
else: | |
print("文件 ~/.claude.json 不存在。") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment