mirror of
https://github.com/leonvanzyl/autocoder.git
synced 2026-01-30 06:12:06 +00:00
fix: consolidate auth error handling and fix start.bat credential check
This commit addresses issues found during review of PRs #12 and #28: ## PR #12 (Auth Error Handling) Fixes - Create shared auth.py module with centralized AUTH_ERROR_PATTERNS, is_auth_error(), and print_auth_error_help() functions - Fix start.bat to use directory check instead of outdated .credentials.json file check (matching start.sh behavior) - Update process_manager.py to import from shared auth module - Update start.py to import from shared auth module - Update documentation comments in autonomous_agent_demo.py and client.py to remove references to deprecated .credentials.json ## PR #28 (Feature Management) Improvements - Add _priority_lock threading lock to feature_mcp.py to prevent race conditions when multiple features are created simultaneously - Apply lock to feature_create, feature_create_bulk, and feature_skip - Add checkAndSendTimeoutRef cleanup in useAssistantChat.ts to prevent memory leaks on component unmount - Clear currentAssistantMessageRef on response_done ## Code Quality - All Python files pass ruff linting - All security tests pass (91/91) - UI passes ESLint and TypeScript compilation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
49
start.py
49
start.py
@@ -9,11 +9,11 @@ Supports two paths for new projects:
|
||||
"""
|
||||
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from auth import is_auth_error, print_auth_error_help
|
||||
from prompts import (
|
||||
get_project_prompts_dir,
|
||||
has_project_prompts,
|
||||
@@ -25,53 +25,6 @@ from registry import (
|
||||
register_project,
|
||||
)
|
||||
|
||||
# Patterns that indicate Claude CLI authentication errors
|
||||
AUTH_ERROR_PATTERNS = [
|
||||
r"not\s+logged\s+in",
|
||||
r"not\s+authenticated",
|
||||
r"authentication\s+(failed|required|error)",
|
||||
r"login\s+required",
|
||||
r"please\s+(run\s+)?['\"]?claude\s+login",
|
||||
r"unauthorized",
|
||||
r"invalid\s+(token|credential|api.?key)",
|
||||
r"expired\s+(token|session|credential)",
|
||||
r"could\s+not\s+authenticate",
|
||||
r"sign\s+in\s+(to|required)",
|
||||
]
|
||||
|
||||
|
||||
def is_auth_error(output: str) -> bool:
|
||||
"""
|
||||
Check if output contains Claude CLI authentication error messages.
|
||||
|
||||
Args:
|
||||
output: Combined stdout/stderr from subprocess
|
||||
|
||||
Returns:
|
||||
True if authentication error detected, False otherwise
|
||||
"""
|
||||
if not output:
|
||||
return False
|
||||
|
||||
output_lower = output.lower()
|
||||
for pattern in AUTH_ERROR_PATTERNS:
|
||||
if re.search(pattern, output_lower):
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def print_auth_error_help() -> None:
|
||||
"""Print helpful message when authentication error is detected."""
|
||||
print("\n" + "=" * 50)
|
||||
print(" Authentication Error Detected")
|
||||
print("=" * 50)
|
||||
print("\nClaude CLI requires authentication to work.")
|
||||
print("\nTo fix this, run:")
|
||||
print(" claude login")
|
||||
print("\nThis will open a browser window to sign in.")
|
||||
print("After logging in, try running this command again.")
|
||||
print("=" * 50 + "\n")
|
||||
|
||||
|
||||
def check_spec_exists(project_dir: Path) -> bool:
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user