codedthemes-cli 0.1.11__tar.gz → 0.1.12__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codedthemes-cli
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: CLI tool for Code Theme and Integration
5
5
  Author: codedthemes
6
6
  Requires-Python: >=3.10
@@ -36,7 +36,18 @@ def handle_login(server_url: str = None):
36
36
  email = input("Email: ").strip()
37
37
  license_key = input("License key: ").strip()
38
38
 
39
+ # Idempotent check: Are we already logged in as this user?
40
+ if existing_token:
41
+ try:
42
+ decoded = jwt.decode(existing_token, options={"verify_signature": False})
43
+ if decoded.get("email") == email:
44
+ print(f"✔ Already logged in as {email}. Nothing changed.")
45
+ return
46
+ except:
47
+ pass
48
+
39
49
  device_id = get_device_id()
50
+
40
51
  device_name = socket.gethostname()
41
52
 
42
53
  client = MCPClient()
@@ -216,14 +227,26 @@ def handle_apply(query: str):
216
227
  if workspace_id:
217
228
  try:
218
229
  check = client.call("check_workspace", {"workspace_id": workspace_id})
230
+ if isinstance(check, dict) and check.get("status") == "error" and check.get("message") == "WORKSPACE_EVICTED":
231
+ print("\n⚠ Your workspace is inactive.")
232
+ print("It was unloaded from the server due to 30 minutes of inactivity.")
233
+ print("\nRun '\033[1mcodedthemes init\033[0m' to restore your workspace.\n")
234
+ sys.exit(0)
235
+
219
236
  if isinstance(check, dict) and check.get("status") == "ok":
220
237
  # print(f"✔ Using active workspace: {workspace_id}")
221
238
  pass
222
239
  else:
223
240
  workspace_id = None
224
- except:
241
+ except Exception as e:
242
+ if "WORKSPACE_EVICTED" in str(e):
243
+ print("\n⚠ Your workspace is inactive.")
244
+ print("It was unloaded from the server due to 30 minutes of inactivity.")
245
+ print("\nRun '\033[1mcodedthemes init\033[0m' to restore your workspace.\n")
246
+ sys.exit(0)
225
247
  workspace_id = None
226
248
 
249
+
227
250
  if not workspace_id:
228
251
  print("📦 Zipping and uploading repository (this may take a moment)...")
229
252
  upload_result = client.upload_workspace(repo_abs_path, user_email)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codedthemes-cli
3
- Version: 0.1.11
3
+ Version: 0.1.12
4
4
  Summary: CLI tool for Code Theme and Integration
5
5
  Author: codedthemes
6
6
  Requires-Python: >=3.10
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "codedthemes-cli"
7
- version = "0.1.11"
7
+ version = "0.1.12"
8
8
  description = "CLI tool for Code Theme and Integration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"