devpy-cli 1.0.1__tar.gz → 1.0.2__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: devpy-cli
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: AI-powered DevOps CLI Assistant for local and remote Docker management
5
5
  Author-email: Eddy Ortega <atrox390@gmail.com>
6
6
  License: MIT
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devpy-cli
3
- Version: 1.0.1
3
+ Version: 1.0.2
4
4
  Summary: AI-powered DevOps CLI Assistant for local and remote Docker management
5
5
  Author-email: Eddy Ortega <atrox390@gmail.com>
6
6
  License: MIT
@@ -1,14 +1,77 @@
1
+ import os
2
+ from importlib.metadata import PackageNotFoundError, version
3
+ from pathlib import Path
4
+ import json
5
+ import urllib.request
6
+ import tomllib
1
7
  from rich.console import Console
2
8
  from rich.prompt import Prompt
3
9
  from rich.markdown import Markdown
4
10
  from backend import run_agent_flow, config_manager, ssh_key_manager, reset_docker_client, permission_manager
5
- import os
6
- from pathlib import Path
7
11
  from setup_wizard import run_setup
8
12
 
9
13
  console = Console()
10
14
 
11
15
 
16
+ def get_cli_version():
17
+ try:
18
+ return version('devpy-cli')
19
+ except PackageNotFoundError:
20
+ pass
21
+
22
+ try:
23
+ root = Path(__file__).resolve().parent
24
+ pyproject_path = root / 'pyproject.toml'
25
+ if pyproject_path.exists():
26
+ data = tomllib.loads(pyproject_path.read_text(encoding='utf-8'))
27
+ project = data.get('project') or {}
28
+ value = project.get('version')
29
+ if isinstance(value, str) and value:
30
+ return value
31
+ except Exception:
32
+ pass
33
+
34
+ return 'unknown'
35
+
36
+
37
+ def fetch_latest_version():
38
+ try:
39
+ with urllib.request.urlopen('https://pypi.org/pypi/devpy-cli/json', timeout=2) as resp:
40
+ if resp.status != 200:
41
+ return None
42
+ data = json.loads(resp.read().decode('utf-8'))
43
+ info = data.get('info') or {}
44
+ value = info.get('version')
45
+ if isinstance(value, str) and value:
46
+ return value
47
+ except Exception:
48
+ return None
49
+
50
+
51
+ def normalize_version(value):
52
+ parts = []
53
+ for part in str(value).split('.'):
54
+ try:
55
+ parts.append(int(part))
56
+ except ValueError:
57
+ break
58
+ return tuple(parts)
59
+
60
+
61
+ def check_for_update():
62
+ current = get_cli_version()
63
+ latest = fetch_latest_version()
64
+ if not current or current == 'unknown' or not latest:
65
+ return
66
+ cur_tuple = normalize_version(current)
67
+ lat_tuple = normalize_version(latest)
68
+ if not cur_tuple or not lat_tuple:
69
+ return
70
+ if cur_tuple < lat_tuple:
71
+ console.print(f'[yellow]A new version of DevPy CLI is available: {latest} (you have {current}).[/yellow]')
72
+ console.print('[dim]Update with: pip install -U devpy-cli[/dim]')
73
+
74
+
12
75
  def handle_config_command(user_input):
13
76
  parts = user_input.split()
14
77
  if len(parts) < 2:
@@ -170,7 +233,8 @@ def handle_permissions_command(user_input):
170
233
 
171
234
  def run_cli():
172
235
  console.print(Markdown('# DevPy CLI'))
173
- console.print('[dim]Version 1.0.0[/dim]\n')
236
+ console.print(f'[dim]Version {get_cli_version()}[/dim]\n')
237
+ check_for_update()
174
238
  dry_run_answer = Prompt.ask(
175
239
  '\n[bold]Enable dry-run mode?[/bold]',
176
240
  choices=['y', 'n'],
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devpy-cli"
7
- version = "1.0.1"
7
+ version = "1.0.2"
8
8
  description = "AI-powered DevOps CLI Assistant for local and remote Docker management"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Eddy Ortega", email = "atrox390@gmail.com" }]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes