aline-ai 0.1.10__py3-none-any.whl → 0.2.1__py3-none-any.whl

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.
realign/mcp_server.py CHANGED
@@ -432,62 +432,12 @@ async def async_main():
432
432
  _server_log(f"Current working directory: {Path.cwd()}")
433
433
  _server_log(f"Home directory: {Path.home()}")
434
434
 
435
- # Detect workspace path and start the watcher
436
- # Try multiple methods since MCP server may run in different context
437
- repo_path = None
438
-
435
+ # Start the watcher (no repo_path needed - it will extract dynamically from sessions)
439
436
  try:
440
- # Method 1: Try git rev-parse from current directory
441
- result = subprocess.run(
442
- ["git", "rev-parse", "--show-toplevel"],
443
- capture_output=True,
444
- text=True,
445
- check=False,
446
- )
447
- if result.returncode == 0:
448
- repo_path = Path(result.stdout.strip())
449
- _server_log(f"Detected workspace from git: {repo_path}")
450
- else:
451
- _server_log(f"Not in git repo (cwd: {Path.cwd()})")
452
-
453
- # Method 2: If not in git repo, try to find from Claude session files
454
- if not repo_path:
455
- claude_projects = Path.home() / ".claude" / "projects"
456
- _server_log(f"Checking Claude projects at: {claude_projects}")
457
- if claude_projects.exists():
458
- # Find most recently modified session file
459
- session_files = list(claude_projects.glob("*/*.jsonl"))
460
- _server_log(f"Found {len(session_files)} Claude session files")
461
- if session_files:
462
- # Sort by modification time, newest first
463
- session_files.sort(key=lambda p: p.stat().st_mtime, reverse=True)
464
- _server_log(f"Most recent session: {session_files[0]}")
465
- # Extract project path from directory name
466
- # Format: -Users-jundewu-Downloads-code-noclue -> /Users/jundewu/Downloads/code/noclue
467
- project_dir_name = session_files[0].parent.name
468
- _server_log(f"Project dir name: {project_dir_name}")
469
- if project_dir_name.startswith('-'):
470
- # Convert back to path: -Users-foo-bar -> /Users/foo/bar
471
- # Note: underscores were also replaced with dashes, but we can't distinguish
472
- # So we just replace dashes with slashes
473
- path_str = '/' + project_dir_name[1:].replace('-', '/')
474
- candidate_path = Path(path_str)
475
- _server_log(f"Candidate path: {candidate_path}, exists: {candidate_path.exists()}")
476
- if candidate_path.exists():
477
- repo_path = candidate_path
478
- _server_log(f"Detected workspace from Claude session: {repo_path}")
479
-
480
- # Method 3: Fallback to current directory
481
- if not repo_path:
482
- repo_path = Path.cwd()
483
- _server_log(f"Using current directory: {repo_path}")
484
-
485
- # Start the watcher
486
- _server_log(f"Starting watcher for: {repo_path}")
487
- await start_watcher(repo_path)
488
-
437
+ await start_watcher()
438
+ print("[MCP Server] Watcher started (will auto-detect project paths from sessions)", file=sys.stderr)
489
439
  except Exception as e:
490
- _server_log(f"Warning: Could not start watcher: {e}")
440
+ print(f"[MCP Server] Warning: Could not start watcher: {e}", file=sys.stderr)
491
441
  import traceback
492
442
  traceback.print_exc(file=sys.stderr)
493
443