codedthemes-cli 0.1.11__tar.gz → 0.1.13__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/PKG-INFO +1 -1
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes/cli.py +39 -20
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes/repo_utils.py +4 -3
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes_cli.egg-info/PKG-INFO +1 -1
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/pyproject.toml +1 -1
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/README.md +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes/__init__.py +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes/config.py +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes/mcp_client.py +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes/patch_utils.py +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes/sync_manager.py +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes_cli.egg-info/SOURCES.txt +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes_cli.egg-info/dependency_links.txt +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes_cli.egg-info/entry_points.txt +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes_cli.egg-info/requires.txt +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes_cli.egg-info/top_level.txt +0 -0
- {codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/setup.cfg +0 -0
|
@@ -29,6 +29,7 @@ def handle_login(server_url: str = None):
|
|
|
29
29
|
choice = input("Switch account? (y/N): ").strip().lower()
|
|
30
30
|
if choice not in ['y', 'yes']:
|
|
31
31
|
print("Login cancelled.")
|
|
32
|
+
print("Please enter your credentials to log in.")
|
|
32
33
|
return
|
|
33
34
|
except:
|
|
34
35
|
pass
|
|
@@ -36,7 +37,18 @@ def handle_login(server_url: str = None):
|
|
|
36
37
|
email = input("Email: ").strip()
|
|
37
38
|
license_key = input("License key: ").strip()
|
|
38
39
|
|
|
40
|
+
# Idempotent check: Are we already logged in as this user?
|
|
41
|
+
if existing_token:
|
|
42
|
+
try:
|
|
43
|
+
decoded = jwt.decode(existing_token, options={"verify_signature": False})
|
|
44
|
+
if decoded.get("email") == email:
|
|
45
|
+
print(f"✔ Already logged in as {email}. Nothing changed.")
|
|
46
|
+
return
|
|
47
|
+
except:
|
|
48
|
+
pass
|
|
49
|
+
|
|
39
50
|
device_id = get_device_id()
|
|
51
|
+
|
|
40
52
|
device_name = socket.gethostname()
|
|
41
53
|
|
|
42
54
|
client = MCPClient()
|
|
@@ -51,28 +63,23 @@ def handle_login(server_url: str = None):
|
|
|
51
63
|
"device_name": device_name
|
|
52
64
|
})
|
|
53
65
|
|
|
54
|
-
if
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
elif "message" in result and "Login failed" in result["message"]:
|
|
59
|
-
print(f"✖ {result['message']}")
|
|
66
|
+
if result.get("status") == "success":
|
|
67
|
+
token = result.get("access_token")
|
|
68
|
+
if not token:
|
|
69
|
+
print("✖ Login failed: No access token returned. Please check your credentials.")
|
|
60
70
|
sys.exit(1)
|
|
61
71
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
# LAZY CONFIG: Only save if login succeeded
|
|
73
|
+
save_config({
|
|
74
|
+
"access_token": token,
|
|
75
|
+
"server_url": client.server_url,
|
|
76
|
+
"device_id": device_id
|
|
77
|
+
})
|
|
78
|
+
print(f"✔ {result.get('message')}")
|
|
79
|
+
print("\n🚀 Next Step: Run 'codedthemes init' to initialize your repository and sync it with the cloud.")
|
|
80
|
+
else:
|
|
81
|
+
print(f"✖ {result.get('message', 'Login failed')}")
|
|
67
82
|
sys.exit(1)
|
|
68
|
-
|
|
69
|
-
save_config({
|
|
70
|
-
"server_url": client.server_url,
|
|
71
|
-
"access_token": token
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
print("✔ Login successful.")
|
|
75
|
-
print("\n🚀 Next Step: Run 'codedthemes init' to initialize your repository and sync it with the cloud.")
|
|
76
83
|
except Exception as e:
|
|
77
84
|
err_msg = str(e)
|
|
78
85
|
if "timed out" in err_msg.lower():
|
|
@@ -216,14 +223,26 @@ def handle_apply(query: str):
|
|
|
216
223
|
if workspace_id:
|
|
217
224
|
try:
|
|
218
225
|
check = client.call("check_workspace", {"workspace_id": workspace_id})
|
|
226
|
+
if isinstance(check, dict) and check.get("status") == "error" and check.get("message") == "WORKSPACE_EVICTED":
|
|
227
|
+
print("\n⚠ Your workspace is inactive.")
|
|
228
|
+
print("It was unloaded from the server due to 30 minutes of inactivity.")
|
|
229
|
+
print("\nRun '\033[1mcodedthemes init\033[0m' to restore your workspace.\n")
|
|
230
|
+
sys.exit(0)
|
|
231
|
+
|
|
219
232
|
if isinstance(check, dict) and check.get("status") == "ok":
|
|
220
233
|
# print(f"✔ Using active workspace: {workspace_id}")
|
|
221
234
|
pass
|
|
222
235
|
else:
|
|
223
236
|
workspace_id = None
|
|
224
|
-
except:
|
|
237
|
+
except Exception as e:
|
|
238
|
+
if "WORKSPACE_EVICTED" in str(e):
|
|
239
|
+
print("\n⚠ Your workspace is inactive.")
|
|
240
|
+
print("It was unloaded from the server due to 30 minutes of inactivity.")
|
|
241
|
+
print("\nRun '\033[1mcodedthemes init\033[0m' to restore your workspace.\n")
|
|
242
|
+
sys.exit(0)
|
|
225
243
|
workspace_id = None
|
|
226
244
|
|
|
245
|
+
|
|
227
246
|
if not workspace_id:
|
|
228
247
|
print("📦 Zipping and uploading repository (this may take a moment)...")
|
|
229
248
|
upload_result = client.upload_workspace(repo_abs_path, user_email)
|
|
@@ -105,7 +105,7 @@ def _is_gitignored(rel_path, patterns):
|
|
|
105
105
|
def detect_repo_root(start_path=None):
|
|
106
106
|
"""
|
|
107
107
|
Traverses up from start_path to find a repository root containing
|
|
108
|
-
|
|
108
|
+
ai.json, or .git. Stricter than previous versions to avoid false positives.
|
|
109
109
|
"""
|
|
110
110
|
if not start_path:
|
|
111
111
|
start_path = os.getcwd()
|
|
@@ -113,11 +113,12 @@ def detect_repo_root(start_path=None):
|
|
|
113
113
|
current = Path(start_path).resolve()
|
|
114
114
|
|
|
115
115
|
while current != current.parent:
|
|
116
|
-
if any((current / f).exists() for f in ["
|
|
116
|
+
if any((current / f).exists() for f in ["ai.json", ".git"]):
|
|
117
117
|
return current
|
|
118
118
|
current = current.parent
|
|
119
119
|
|
|
120
|
-
raise Exception("No repository root found.")
|
|
120
|
+
raise Exception("No repository root found. Please run this command inside a Git repository or one initialized with 'codedthemes init'.")
|
|
121
|
+
|
|
121
122
|
|
|
122
123
|
|
|
123
124
|
def zip_repo(repo_root):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{codedthemes_cli-0.1.11 → codedthemes_cli-0.1.13}/codedthemes_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|