devlinker 1.3.1__tar.gz → 1.3.3__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.
Files changed (28) hide show
  1. {devlinker-1.3.1 → devlinker-1.3.3}/PKG-INFO +2 -2
  2. devlinker-1.3.3/devlinker/config.py +8 -0
  3. devlinker-1.3.3/devlinker/doctor.py +27 -0
  4. devlinker-1.3.3/devlinker/inspect.py +14 -0
  5. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/main.py +22 -0
  6. devlinker-1.3.3/devlinker/monitor.py +19 -0
  7. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/proxy.py +10 -0
  8. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker.egg-info/PKG-INFO +2 -2
  9. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker.egg-info/SOURCES.txt +3 -0
  10. {devlinker-1.3.1 → devlinker-1.3.3}/pyproject.toml +2 -2
  11. devlinker-1.3.1/devlinker/doctor.py +0 -16
  12. {devlinker-1.3.1 → devlinker-1.3.3}/README.md +0 -0
  13. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/__init__.py +0 -0
  14. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/detection_state.py +0 -0
  15. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/detector.py +0 -0
  16. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/detector_ai.py +0 -0
  17. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/fix.py +0 -0
  18. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/fixer.py +0 -0
  19. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/logger.py +0 -0
  20. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/runner.py +0 -0
  21. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/share.py +0 -0
  22. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker/tunnel.py +0 -0
  23. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker.egg-info/dependency_links.txt +0 -0
  24. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker.egg-info/entry_points.txt +0 -0
  25. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker.egg-info/requires.txt +0 -0
  26. {devlinker-1.3.1 → devlinker-1.3.3}/devlinker.egg-info/top_level.txt +0 -0
  27. {devlinker-1.3.1 → devlinker-1.3.3}/setup.cfg +0 -0
  28. {devlinker-1.3.1 → devlinker-1.3.3}/setup.py +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devlinker
3
- Version: 1.3.1
4
- Summary: AI-powered linking and automation tool
3
+ Version: 1.3.3
4
+ Summary: A lightweight proxy that combines your frontend and backend into one link for easy development and sharing.
5
5
  Author-email: Mani <mani1028@users.noreply.github.com>
6
6
  Requires-Python: >=3.7
7
7
  Description-Content-Type: text/markdown
@@ -0,0 +1,8 @@
1
+ import yaml
2
+ import os
3
+
4
+ def load_config(config_path="devlinker.yaml"):
5
+ if not os.path.exists(config_path):
6
+ return {}
7
+ with open(config_path, "r") as f:
8
+ return yaml.safe_load(f) or {}
@@ -0,0 +1,27 @@
1
+ import click
2
+ from devlinker.detection_state import state
3
+ from devlinker.detector_ai import DevLinkerAI
4
+ from devlinker.logger import print_fix
5
+
6
+ @click.command()
7
+ def doctor():
8
+ """Run DevLinker diagnostics and print a health dashboard."""
9
+ ai = DevLinkerAI()
10
+ print("\n🩺 DevLinker Health Dashboard\n" + ("═" * 36))
11
+ # Grouped status summary
12
+ categories = state.categories
13
+ for category, issues in categories.items():
14
+ if not issues:
15
+ status = "✅"
16
+ else:
17
+ high = any(state.levels.get(issue, "MEDIUM") == "HIGH" for issue in issues)
18
+ warn = any(state.levels.get(issue, "MEDIUM") == "MEDIUM" for issue in issues)
19
+ status = "⚠️" if high or warn else "✅"
20
+ print(f"{category.title():<10}: {status}")
21
+ print("\nDetails:")
22
+ state.report()
23
+ print("\nFix Suggestions:")
24
+ for issue, level, count, category in state.get_issues():
25
+ suggestions = ai.analyze_failure(issue)
26
+ for s in suggestions:
27
+ print_fix(s)
@@ -0,0 +1,14 @@
1
+ import click
2
+ from devlinker.proxy import _recent_requests
3
+
4
+ @click.command()
5
+ def inspect():
6
+ """Show recent API calls and statuses."""
7
+ click.secho("\n🔍 Recent API Calls (last 50):\n" + ("═" * 36), fg="cyan", bold=True)
8
+ if not _recent_requests:
9
+ click.secho("No API calls recorded yet.", fg="yellow")
10
+ return
11
+ for req in _recent_requests[-50:]:
12
+ status = req["status"]
13
+ emoji = "✅" if status < 400 else ("⚠️" if status < 500 else "❌")
14
+ click.secho(f"{emoji} {req['target']:<8} {req['path']:<30} → {status}", fg="white")
@@ -13,7 +13,11 @@ from .runner import detect_backend_port, start_servers
13
13
  from .tunnel import start_tunnel
14
14
  from .doctor import doctor
15
15
  from .fix import fix
16
+
16
17
  from .share import share, unshare
18
+ from .config import load_config
19
+ from .inspect import inspect
20
+ from .monitor import monitor
17
21
 
18
22
 
19
23
  def _is_port_in_use(port: int) -> bool:
@@ -147,6 +151,7 @@ def _wait_for_readiness(
147
151
  help="Show WLAN sharing URL for devices on the same network.",
148
152
  )
149
153
  @click.option("--debug", is_flag=True, hidden=True, help="Enable debug logging.")
154
+
150
155
  def cli(
151
156
  frontend: int | None,
152
157
  backend_port_override: int | None,
@@ -158,6 +163,20 @@ def cli(
158
163
  lan_enabled: bool,
159
164
  debug: bool,
160
165
  ) -> None:
166
+ # Load config file if present
167
+ config = load_config()
168
+ # Use config values as defaults if CLI args are not set
169
+ if frontend is None:
170
+ frontend = config.get("frontend")
171
+ if backend_port_override is None:
172
+ backend_port_override = config.get("backend")
173
+ if proxy_port == 8000 and config.get("proxy_port"):
174
+ proxy_port = config["proxy_port"]
175
+ if not url and config.get("tunnel") is True:
176
+ url = True
177
+ if config.get("api_prefix"):
178
+ # Optionally pass api_prefix to proxy if needed in future
179
+ pass
161
180
 
162
181
  started = time.perf_counter()
163
182
  banner = "\n" + ("═" * 36) + f"\n⚡ Dev Linker v{__version__} ⚡\n" + ("═" * 36)
@@ -272,11 +291,14 @@ def main():
272
291
  pass
273
292
 
274
293
 
294
+
275
295
  main.add_command(cli)
276
296
  main.add_command(doctor)
277
297
  main.add_command(fix)
278
298
  main.add_command(share)
279
299
  main.add_command(unshare)
300
+ main.add_command(inspect)
301
+ main.add_command(monitor)
280
302
 
281
303
  if __name__ == "__main__":
282
304
  main()
@@ -0,0 +1,19 @@
1
+ # API Monitor CLI command for health/status dashboard
2
+ import click
3
+ from devlinker.detection_state import state
4
+
5
+ @click.command()
6
+ def monitor():
7
+ """Show API health/status dashboard."""
8
+ click.secho("\n📡 API Monitor Dashboard\n" + ("═" * 36), fg="cyan", bold=True)
9
+ categories = state.categories
10
+ for category, issues in categories.items():
11
+ if not issues:
12
+ status = "✅"
13
+ else:
14
+ high = any(state.levels.get(issue, "MEDIUM") == "HIGH" for issue in issues)
15
+ warn = any(state.levels.get(issue, "MEDIUM") == "MEDIUM" for issue in issues)
16
+ status = "⚠️" if high or warn else "✅"
17
+ click.secho(f"{category.title():<10}: {status}", fg="white")
18
+ click.secho("\nDetails:", fg="magenta")
19
+ state.report()
@@ -16,7 +16,12 @@ from websockets.exceptions import ConnectionClosed
16
16
  app = FastAPI()
17
17
 
18
18
  # --- RequestInspector: Real-time request analyzer ---
19
+
19
20
  from devlinker.detection_state import state
21
+ import threading
22
+ _recent_requests = []
23
+ _recent_lock = threading.Lock()
24
+
20
25
  class RequestInspector:
21
26
  def analyze(self, path, status, target):
22
27
  warnings = []
@@ -35,6 +40,11 @@ class RequestInspector:
35
40
  issue = "Backend unreachable"
36
41
  state.add(issue, level="HIGH", category="network")
37
42
  warnings.append(issue)
43
+ # Log request for inspector
44
+ with _recent_lock:
45
+ _recent_requests.append({"path": path, "status": status, "target": target})
46
+ if len(_recent_requests) > 50:
47
+ _recent_requests.pop(0)
38
48
  return warnings
39
49
 
40
50
  FRONTEND: Optional[int] = None
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: devlinker
3
- Version: 1.3.1
4
- Summary: AI-powered linking and automation tool
3
+ Version: 1.3.3
4
+ Summary: A lightweight proxy that combines your frontend and backend into one link for easy development and sharing.
5
5
  Author-email: Mani <mani1028@users.noreply.github.com>
6
6
  Requires-Python: >=3.7
7
7
  Description-Content-Type: text/markdown
@@ -2,14 +2,17 @@ README.md
2
2
  pyproject.toml
3
3
  setup.py
4
4
  devlinker/__init__.py
5
+ devlinker/config.py
5
6
  devlinker/detection_state.py
6
7
  devlinker/detector.py
7
8
  devlinker/detector_ai.py
8
9
  devlinker/doctor.py
9
10
  devlinker/fix.py
10
11
  devlinker/fixer.py
12
+ devlinker/inspect.py
11
13
  devlinker/logger.py
12
14
  devlinker/main.py
15
+ devlinker/monitor.py
13
16
  devlinker/proxy.py
14
17
  devlinker/runner.py
15
18
  devlinker/share.py
@@ -4,8 +4,8 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "devlinker"
7
- version = "1.3.1"
8
- description = "AI-powered linking and automation tool"
7
+ version = "1.3.3"
8
+ description = "A lightweight proxy that combines your frontend and backend into one link for easy development and sharing."
9
9
  authors = [
10
10
  { name = "Mani", email = "mani1028@users.noreply.github.com" }
11
11
  ]
@@ -1,16 +0,0 @@
1
- import click
2
- from devlinker.detection_state import state
3
- from devlinker.detector_ai import DevLinkerAI
4
- from devlinker.logger import print_fix
5
-
6
- @click.command()
7
- def doctor():
8
- """Run DevLinker diagnostics and print a doctor report."""
9
- ai = DevLinkerAI()
10
- # Doctor now uses real-time, categorized issues from the global state
11
- state.report()
12
- print("\nFix Suggestions:")
13
- for issue, level, count, category in state.get_issues():
14
- suggestions = ai.analyze_failure(issue)
15
- for s in suggestions:
16
- print_fix(s)
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