codedthemes-cli 0.1.12__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codedthemes-cli
3
- Version: 0.1.12
3
+ Version: 0.1.13
4
4
  Summary: CLI tool for Code Theme and Integration
5
5
  Author: codedthemes
6
6
  Requires-Python: >=3.10
@@ -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
@@ -62,28 +63,23 @@ def handle_login(server_url: str = None):
62
63
  "device_name": device_name
63
64
  })
64
65
 
65
- if isinstance(result, dict):
66
- if result.get("status") == "error":
67
- print(f"✖ Login failed: {result.get('message', 'Unknown error')}")
68
- sys.exit(1)
69
- elif "message" in result and "Login failed" in result["message"]:
70
- 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.")
71
70
  sys.exit(1)
72
71
 
73
- # Get token from result
74
- token = result.get("access_token") if isinstance(result, dict) else None
75
-
76
- if not token:
77
- print("✖ Login failed: No access token returned. Please check your credentials.")
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')}")
78
82
  sys.exit(1)
79
-
80
- save_config({
81
- "server_url": client.server_url,
82
- "access_token": token
83
- })
84
-
85
- print("✔ Login successful.")
86
- print("\n🚀 Next Step: Run 'codedthemes init' to initialize your repository and sync it with the cloud.")
87
83
  except Exception as e:
88
84
  err_msg = str(e)
89
85
  if "timed out" in err_msg.lower():
@@ -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
- package.json, pyproject.toml, ai.json, or .git.
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 ["package.json", "pyproject.toml", "ai.json", ".git"]):
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):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codedthemes-cli
3
- Version: 0.1.12
3
+ Version: 0.1.13
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.12"
7
+ version = "0.1.13"
8
8
  description = "CLI tool for Code Theme and Integration"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"