codedthemes-cli 0.1.13__tar.gz → 0.1.14__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.13 → codedthemes_cli-0.1.14}/PKG-INFO +10 -2
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/README.md +9 -1
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes/cli.py +46 -1
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes/config.py +22 -8
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes/mcp_client.py +4 -1
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes/repo_utils.py +6 -6
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes_cli.egg-info/PKG-INFO +10 -2
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/pyproject.toml +1 -1
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes/__init__.py +0 -0
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes/patch_utils.py +0 -0
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes/sync_manager.py +0 -0
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes_cli.egg-info/SOURCES.txt +0 -0
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes_cli.egg-info/dependency_links.txt +0 -0
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes_cli.egg-info/entry_points.txt +0 -0
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes_cli.egg-info/requires.txt +0 -0
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes_cli.egg-info/top_level.txt +0 -0
- {codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codedthemes-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.14
|
|
4
4
|
Summary: CLI tool for Code Theme and Integration
|
|
5
5
|
Author: codedthemes
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -38,7 +38,15 @@ codedthemes login
|
|
|
38
38
|
```
|
|
39
39
|
*Enter your registered email and license key when prompted.*
|
|
40
40
|
|
|
41
|
-
### 2.
|
|
41
|
+
### 2. Logout
|
|
42
|
+
|
|
43
|
+
Log out from the current device to free up a license slot on the server.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
codedthemes logout
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Initialization (Optional)
|
|
42
50
|
|
|
43
51
|
Initialize your repository to establish a baseline for synchronization. This is recommended for first-time use in a project.
|
|
44
52
|
|
|
@@ -28,7 +28,15 @@ codedthemes login
|
|
|
28
28
|
```
|
|
29
29
|
*Enter your registered email and license key when prompted.*
|
|
30
30
|
|
|
31
|
-
### 2.
|
|
31
|
+
### 2. Logout
|
|
32
|
+
|
|
33
|
+
Log out from the current device to free up a license slot on the server.
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
codedthemes logout
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Initialization (Optional)
|
|
32
40
|
|
|
33
41
|
Initialize your repository to establish a baseline for synchronization. This is recommended for first-time use in a project.
|
|
34
42
|
|
|
@@ -73,8 +73,10 @@ def handle_login(server_url: str = None):
|
|
|
73
73
|
save_config({
|
|
74
74
|
"access_token": token,
|
|
75
75
|
"server_url": client.server_url,
|
|
76
|
-
"device_id": device_id
|
|
76
|
+
"device_id": device_id,
|
|
77
|
+
"license_key": license_key
|
|
77
78
|
})
|
|
79
|
+
|
|
78
80
|
print(f"✔ {result.get('message')}")
|
|
79
81
|
print("\n🚀 Next Step: Run 'codedthemes init' to initialize your repository and sync it with the cloud.")
|
|
80
82
|
else:
|
|
@@ -89,7 +91,45 @@ def handle_login(server_url: str = None):
|
|
|
89
91
|
sys.exit(1)
|
|
90
92
|
|
|
91
93
|
|
|
94
|
+
def handle_logout():
|
|
95
|
+
"""
|
|
96
|
+
Clears local session and notifies server to de-authenticate this device.
|
|
97
|
+
"""
|
|
98
|
+
try:
|
|
99
|
+
config = load_config()
|
|
100
|
+
token = config.get("access_token")
|
|
101
|
+
license_key = config.get("license_key")
|
|
102
|
+
|
|
103
|
+
if not token:
|
|
104
|
+
print("ℹ Not logged in.")
|
|
105
|
+
return
|
|
106
|
+
|
|
107
|
+
device_id = get_device_id()
|
|
108
|
+
client = MCPClient()
|
|
109
|
+
|
|
110
|
+
print("Logging out...")
|
|
111
|
+
if license_key:
|
|
112
|
+
try:
|
|
113
|
+
client.call("logout", {
|
|
114
|
+
"license_key": license_key,
|
|
115
|
+
"device_id": device_id
|
|
116
|
+
})
|
|
117
|
+
except Exception as e:
|
|
118
|
+
# Silently fail if server logout fails, we still want to clear local state
|
|
119
|
+
pass
|
|
120
|
+
|
|
121
|
+
# Local cleanup: Remove config.json but KEEP device.json
|
|
122
|
+
from .config import CONFIG_FILE
|
|
123
|
+
if CONFIG_FILE.exists():
|
|
124
|
+
CONFIG_FILE.unlink()
|
|
125
|
+
|
|
126
|
+
print("✔ Logged out successfully.")
|
|
127
|
+
except Exception as e:
|
|
128
|
+
print(f"✖ Logout failed: {e}")
|
|
129
|
+
|
|
130
|
+
|
|
92
131
|
def handle_init():
|
|
132
|
+
|
|
93
133
|
"""
|
|
94
134
|
Initializes the local repository and syncs it with the cloud.
|
|
95
135
|
"""
|
|
@@ -409,6 +449,8 @@ def main():
|
|
|
409
449
|
apply_parser.add_argument("query", help="Description of changes to make")
|
|
410
450
|
|
|
411
451
|
subparsers.add_parser("init", help="Initialize repository and sync to cloud")
|
|
452
|
+
subparsers.add_parser("logout", help="Log out from current device")
|
|
453
|
+
|
|
412
454
|
|
|
413
455
|
args = parser.parse_args()
|
|
414
456
|
|
|
@@ -422,6 +464,9 @@ def main():
|
|
|
422
464
|
handle_init()
|
|
423
465
|
elif args.command == "apply":
|
|
424
466
|
handle_apply(args.query)
|
|
467
|
+
elif args.command == "logout":
|
|
468
|
+
handle_logout()
|
|
469
|
+
|
|
425
470
|
|
|
426
471
|
|
|
427
472
|
if __name__ == "__main__":
|
|
@@ -29,27 +29,41 @@ def save_config(data: dict):
|
|
|
29
29
|
|
|
30
30
|
def get_device_id():
|
|
31
31
|
"""
|
|
32
|
-
|
|
32
|
+
Returns a unique device ID, stored globally in ~/.codedthemes/device.json.
|
|
33
33
|
"""
|
|
34
|
+
device_file = CONFIG_DIR / "device.json"
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
if device_file.exists():
|
|
37
|
+
try:
|
|
38
|
+
with open(device_file, "r") as f:
|
|
39
|
+
data = json.load(f)
|
|
40
|
+
if data.get("device_id"):
|
|
41
|
+
return data["device_id"]
|
|
42
|
+
except:
|
|
43
|
+
pass
|
|
44
|
+
|
|
45
|
+
# Generate new device ID
|
|
40
46
|
try:
|
|
41
47
|
hostname = socket.gethostname()
|
|
42
|
-
device_uuid = str(uuid.getnode())
|
|
48
|
+
device_uuid = str(uuid.getnode())
|
|
43
49
|
raw_id = f"{hostname}-{device_uuid}"
|
|
44
50
|
device_id = hashlib.sha256(raw_id.encode()).hexdigest()[:12]
|
|
45
51
|
except:
|
|
46
52
|
device_id = str(uuid.uuid4())[:12]
|
|
53
|
+
|
|
54
|
+
# Save globally (create dir if not exists)
|
|
55
|
+
CONFIG_DIR.mkdir(exist_ok=True)
|
|
56
|
+
try:
|
|
57
|
+
with open(device_file, "w") as f:
|
|
58
|
+
json.dump({"device_id": device_id}, f)
|
|
59
|
+
except:
|
|
60
|
+
pass
|
|
47
61
|
|
|
48
|
-
save_config({"device_id": device_id})
|
|
49
62
|
return device_id
|
|
50
63
|
|
|
51
64
|
|
|
52
65
|
|
|
66
|
+
|
|
53
67
|
def load_config():
|
|
54
68
|
"""
|
|
55
69
|
Loads the configuration data from the config file.
|
|
@@ -66,12 +66,15 @@ class MCPClient:
|
|
|
66
66
|
if self.token:
|
|
67
67
|
headers["Authorization"] = f"Bearer {self.token}"
|
|
68
68
|
|
|
69
|
-
# Login
|
|
69
|
+
# Login and Logout use dedicated endpoints
|
|
70
70
|
if tool_name == "login":
|
|
71
71
|
url = f"{self.server_url}/auth/login"
|
|
72
|
+
elif tool_name == "logout":
|
|
73
|
+
url = f"{self.server_url}/auth/logout"
|
|
72
74
|
else:
|
|
73
75
|
url = f"{self.server_url}/tools/{tool_name}"
|
|
74
76
|
|
|
77
|
+
|
|
75
78
|
response = requests.post(
|
|
76
79
|
url,
|
|
77
80
|
json=payload,
|
|
@@ -104,23 +104,23 @@ def _is_gitignored(rel_path, patterns):
|
|
|
104
104
|
|
|
105
105
|
def detect_repo_root(start_path=None):
|
|
106
106
|
"""
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
Checks if the current directory contains ai.json or .git.
|
|
108
|
+
Strictly restricted to the current path (no upward traversal) to avoid
|
|
109
|
+
incorrectly detecting parent repos.
|
|
109
110
|
"""
|
|
110
111
|
if not start_path:
|
|
111
112
|
start_path = os.getcwd()
|
|
112
113
|
|
|
113
114
|
current = Path(start_path).resolve()
|
|
114
115
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
return current
|
|
118
|
-
current = current.parent
|
|
116
|
+
if any((current / f).exists() for f in ["ai.json", ".git"]):
|
|
117
|
+
return current
|
|
119
118
|
|
|
120
119
|
raise Exception("No repository root found. Please run this command inside a Git repository or one initialized with 'codedthemes init'.")
|
|
121
120
|
|
|
122
121
|
|
|
123
122
|
|
|
123
|
+
|
|
124
124
|
def zip_repo(repo_root):
|
|
125
125
|
"""
|
|
126
126
|
Creates a temporary ZIP archive of the repository with aggressive filtering:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codedthemes-cli
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.14
|
|
4
4
|
Summary: CLI tool for Code Theme and Integration
|
|
5
5
|
Author: codedthemes
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -38,7 +38,15 @@ codedthemes login
|
|
|
38
38
|
```
|
|
39
39
|
*Enter your registered email and license key when prompted.*
|
|
40
40
|
|
|
41
|
-
### 2.
|
|
41
|
+
### 2. Logout
|
|
42
|
+
|
|
43
|
+
Log out from the current device to free up a license slot on the server.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
codedthemes logout
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 3. Initialization (Optional)
|
|
42
50
|
|
|
43
51
|
Initialize your repository to establish a baseline for synchronization. This is recommended for first-time use in a project.
|
|
44
52
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{codedthemes_cli-0.1.13 → codedthemes_cli-0.1.14}/codedthemes_cli.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|