codedthemes-cli 0.1.16__tar.gz → 0.1.17__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.16
3
+ Version: 0.1.17
4
4
  Summary: CLI tool for Code Theme and Integration
5
5
  Author: codedthemes
6
6
  Requires-Python: >=3.10
@@ -46,15 +46,21 @@ Log out from the current device to free up a license slot on the server.
46
46
  codedthemes logout
47
47
  ```
48
48
 
49
- ### 3. Initialization (Optional)
50
-
49
+ ### 3. Initialization
51
50
  Initialize your repository to establish a baseline for synchronization. This is recommended for first-time use in a project.
52
51
 
53
52
  ```bash
54
53
  codedthemes init
55
54
  ```
56
55
 
57
- ### 3. Applying Changes
56
+ ### 4. Reactivation
57
+ If your project workspace has been evicted due to inactivity (30+ minutes), use `reinit` to quickly restore it.
58
+
59
+ ```bash
60
+ codedthemes reinit
61
+ ```
62
+
63
+ ### 5. Applying Changes
58
64
 
59
65
  Describe the changes you want to make in natural language. The CLI will analyze your repository, plan the changes, and ask for your approval before patching.
60
66
 
@@ -36,15 +36,21 @@ Log out from the current device to free up a license slot on the server.
36
36
  codedthemes logout
37
37
  ```
38
38
 
39
- ### 3. Initialization (Optional)
40
-
39
+ ### 3. Initialization
41
40
  Initialize your repository to establish a baseline for synchronization. This is recommended for first-time use in a project.
42
41
 
43
42
  ```bash
44
43
  codedthemes init
45
44
  ```
46
45
 
47
- ### 3. Applying Changes
46
+ ### 4. Reactivation
47
+ If your project workspace has been evicted due to inactivity (30+ minutes), use `reinit` to quickly restore it.
48
+
49
+ ```bash
50
+ codedthemes reinit
51
+ ```
52
+
53
+ ### 5. Applying Changes
48
54
 
49
55
  Describe the changes you want to make in natural language. The CLI will analyze your repository, plan the changes, and ask for your approval before patching.
50
56
 
@@ -240,6 +240,58 @@ def handle_init():
240
240
  sys.exit(1)
241
241
 
242
242
 
243
+ def handle_reinit():
244
+ """
245
+ Reactivates an evicted workspace by re-uploading the repository to the cloud.
246
+ """
247
+ try:
248
+ repo_root = detect_repo_root()
249
+ print(f"🔍 Found repository at {repo_root}")
250
+
251
+ client = MCPClient()
252
+ if not client.token:
253
+ print("✖ Not logged in. Please run 'codedthemes login' first.")
254
+ sys.exit(1)
255
+
256
+ user_email = "unknown_user"
257
+ try:
258
+ decoded = jwt.decode(client.token, options={"verify_signature": False})
259
+ user_email = decoded.get("email", "unknown_user")
260
+ except:
261
+ pass
262
+
263
+ repo_abs_path = os.path.abspath(repo_root)
264
+ repo_key = repo_abs_path.lower().replace(os.sep, "/")
265
+
266
+ print("🚀 Reactivating repository (this may take a moment)...")
267
+ upload_result = client.upload_workspace(repo_abs_path, user_email)
268
+ workspace_id = upload_result.get("workspace_id")
269
+
270
+ if not workspace_id:
271
+ print("✖ Reactivation failed: No workspace ID returned.")
272
+ sys.exit(1)
273
+
274
+ config = load_config()
275
+ last_workspaces = config.get("workspaces", {})
276
+ last_workspaces[repo_key] = workspace_id
277
+ config["workspaces"] = last_workspaces
278
+ save_config(config)
279
+
280
+ sync_manager = SyncManager()
281
+ sync_manager.update_sync_state(repo_abs_path, workspace_id, user_email)
282
+
283
+ print(f"✔ Workspace reactivated successfully.")
284
+ print(f"✔ Workspace ID: {workspace_id}")
285
+ print("\n" + "="*60)
286
+ print("Your repository is now synced and active in the cloud!")
287
+ print("You can now return to your IDE and continue using the AI assistant.")
288
+ print("="*60)
289
+
290
+ except Exception as e:
291
+ print(f"✖ Error during reactivation: {e}")
292
+ sys.exit(1)
293
+
294
+
243
295
  def clean_remote_path(p: str) -> str:
244
296
  """
245
297
  Strips the deeply nested remote container path if present.
@@ -487,9 +539,11 @@ def main():
487
539
  apply_parser.add_argument("query", help="Description of changes to make")
488
540
 
489
541
  subparsers.add_parser("init", help="Initialize repository and sync to cloud")
542
+ subparsers.add_parser("reinit", help="Reactivate an evicted workspace and sync to cloud")
490
543
  subparsers.add_parser("logout", help="Log out from current device")
491
544
 
492
545
 
546
+
493
547
  args = parser.parse_args()
494
548
 
495
549
  if not args.command:
@@ -500,6 +554,8 @@ def main():
500
554
  handle_login(args.server)
501
555
  elif args.command == "init":
502
556
  handle_init()
557
+ elif args.command == "reinit":
558
+ handle_reinit()
503
559
  elif args.command == "apply":
504
560
  handle_apply(args.query)
505
561
  elif args.command == "logout":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codedthemes-cli
3
- Version: 0.1.16
3
+ Version: 0.1.17
4
4
  Summary: CLI tool for Code Theme and Integration
5
5
  Author: codedthemes
6
6
  Requires-Python: >=3.10
@@ -46,15 +46,21 @@ Log out from the current device to free up a license slot on the server.
46
46
  codedthemes logout
47
47
  ```
48
48
 
49
- ### 3. Initialization (Optional)
50
-
49
+ ### 3. Initialization
51
50
  Initialize your repository to establish a baseline for synchronization. This is recommended for first-time use in a project.
52
51
 
53
52
  ```bash
54
53
  codedthemes init
55
54
  ```
56
55
 
57
- ### 3. Applying Changes
56
+ ### 4. Reactivation
57
+ If your project workspace has been evicted due to inactivity (30+ minutes), use `reinit` to quickly restore it.
58
+
59
+ ```bash
60
+ codedthemes reinit
61
+ ```
62
+
63
+ ### 5. Applying Changes
58
64
 
59
65
  Describe the changes you want to make in natural language. The CLI will analyze your repository, plan the changes, and ask for your approval before patching.
60
66
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "codedthemes-cli"
7
- version = "0.1.16"
7
+ version = "0.1.17"
8
8
  description = "CLI tool for Code Theme and Integration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"