change max lenght
This commit is contained in:
@@ -76,7 +76,12 @@ async def fetch_config_tool(args: dict) -> list[TextContent]:
|
||||
# MODE 1: Named Source (highest priority)
|
||||
if source_name:
|
||||
if not config_name:
|
||||
return [TextContent(type="text", text="❌ Error: config_name is required when using source parameter")]
|
||||
return [
|
||||
TextContent(
|
||||
type="text",
|
||||
text="❌ Error: config_name is required when using source parameter",
|
||||
)
|
||||
]
|
||||
|
||||
# Get source from registry
|
||||
source_manager = SourceManager()
|
||||
@@ -97,7 +102,11 @@ async def fetch_config_tool(args: dict) -> list[TextContent]:
|
||||
git_repo = GitConfigRepo()
|
||||
try:
|
||||
repo_path = git_repo.clone_or_pull(
|
||||
source_name=source_name, git_url=git_url, branch=branch, token=token, force_refresh=force_refresh
|
||||
source_name=source_name,
|
||||
git_url=git_url,
|
||||
branch=branch,
|
||||
token=token,
|
||||
force_refresh=force_refresh,
|
||||
)
|
||||
except Exception as e:
|
||||
return [TextContent(type="text", text=f"❌ Git error: {str(e)}")]
|
||||
@@ -139,7 +148,12 @@ Next steps:
|
||||
# MODE 2: Direct Git URL
|
||||
elif git_url:
|
||||
if not config_name:
|
||||
return [TextContent(type="text", text="❌ Error: config_name is required when using git_url parameter")]
|
||||
return [
|
||||
TextContent(
|
||||
type="text",
|
||||
text="❌ Error: config_name is required when using git_url parameter",
|
||||
)
|
||||
]
|
||||
|
||||
# Clone/pull repository
|
||||
git_repo = GitConfigRepo()
|
||||
@@ -237,7 +251,9 @@ Next steps:
|
||||
if tags:
|
||||
result += f" Tags: {tags}\n"
|
||||
|
||||
result += "\n💡 To download a config, use: fetch_config with config_name='<name>'\n"
|
||||
result += (
|
||||
"\n💡 To download a config, use: fetch_config with config_name='<name>'\n"
|
||||
)
|
||||
result += f"📚 API Docs: {API_BASE_URL}/docs\n"
|
||||
|
||||
return [TextContent(type="text", text=result)]
|
||||
@@ -245,7 +261,10 @@ Next steps:
|
||||
# Download specific config
|
||||
if not config_name:
|
||||
return [
|
||||
TextContent(type="text", text="❌ Error: Please provide config_name or set list_available=true")
|
||||
TextContent(
|
||||
type="text",
|
||||
text="❌ Error: Please provide config_name or set list_available=true",
|
||||
)
|
||||
]
|
||||
|
||||
# Get config details first
|
||||
@@ -305,11 +324,14 @@ Next steps:
|
||||
except httpx.HTTPError as e:
|
||||
return [
|
||||
TextContent(
|
||||
type="text", text=f"❌ HTTP Error: {str(e)}\n\nCheck your internet connection or try again later."
|
||||
type="text",
|
||||
text=f"❌ HTTP Error: {str(e)}\n\nCheck your internet connection or try again later.",
|
||||
)
|
||||
]
|
||||
except json.JSONDecodeError as e:
|
||||
return [TextContent(type="text", text=f"❌ JSON Error: Invalid response from API: {str(e)}")]
|
||||
return [
|
||||
TextContent(type="text", text=f"❌ JSON Error: Invalid response from API: {str(e)}")
|
||||
]
|
||||
except Exception as e:
|
||||
return [TextContent(type="text", text=f"❌ Error: {str(e)}")]
|
||||
|
||||
@@ -335,7 +357,10 @@ async def submit_config_tool(args: dict) -> list[TextContent]:
|
||||
from github import Github, GithubException
|
||||
except ImportError:
|
||||
return [
|
||||
TextContent(type="text", text="❌ Error: PyGithub not installed.\n\nInstall with: pip install PyGithub")
|
||||
TextContent(
|
||||
type="text",
|
||||
text="❌ Error: PyGithub not installed.\n\nInstall with: pip install PyGithub",
|
||||
)
|
||||
]
|
||||
|
||||
# Import config validator
|
||||
@@ -359,7 +384,9 @@ async def submit_config_tool(args: dict) -> list[TextContent]:
|
||||
if config_path:
|
||||
config_file = Path(config_path)
|
||||
if not config_file.exists():
|
||||
return [TextContent(type="text", text=f"❌ Error: Config file not found: {config_path}")]
|
||||
return [
|
||||
TextContent(type="text", text=f"❌ Error: Config file not found: {config_path}")
|
||||
]
|
||||
|
||||
with open(config_file) as f:
|
||||
config_data = json.load(f)
|
||||
@@ -374,7 +401,11 @@ async def submit_config_tool(args: dict) -> list[TextContent]:
|
||||
return [TextContent(type="text", text=f"❌ Error: Invalid JSON: {str(e)}")]
|
||||
|
||||
else:
|
||||
return [TextContent(type="text", text="❌ Error: Must provide either config_path or config_json")]
|
||||
return [
|
||||
TextContent(
|
||||
type="text", text="❌ Error: Must provide either config_path or config_json"
|
||||
)
|
||||
]
|
||||
|
||||
# Use ConfigValidator for comprehensive validation
|
||||
if ConfigValidator is None:
|
||||
@@ -404,14 +435,20 @@ async def submit_config_tool(args: dict) -> list[TextContent]:
|
||||
if not is_unified:
|
||||
# Legacy config - check base_url
|
||||
base_url = config_data.get("base_url", "")
|
||||
if base_url and not (base_url.startswith("http://") or base_url.startswith("https://")):
|
||||
raise ValueError(f"Invalid base_url format: '{base_url}'\nURLs must start with http:// or https://")
|
||||
if base_url and not (
|
||||
base_url.startswith("http://") or base_url.startswith("https://")
|
||||
):
|
||||
raise ValueError(
|
||||
f"Invalid base_url format: '{base_url}'\nURLs must start with http:// or https://"
|
||||
)
|
||||
else:
|
||||
# Unified config - check URLs in sources
|
||||
for idx, source in enumerate(config_data.get("sources", [])):
|
||||
if source.get("type") == "documentation":
|
||||
source_url = source.get("base_url", "")
|
||||
if source_url and not (source_url.startswith("http://") or source_url.startswith("https://")):
|
||||
if source_url and not (
|
||||
source_url.startswith("http://") or source_url.startswith("https://")
|
||||
):
|
||||
raise ValueError(
|
||||
f"Source {idx} (documentation): Invalid base_url format: '{source_url}'\nURLs must start with http:// or https://"
|
||||
)
|
||||
@@ -453,7 +490,10 @@ Please fix these issues and try again.
|
||||
# For legacy configs, use name-based detection
|
||||
name_lower = config_name.lower()
|
||||
category = "other"
|
||||
if any(x in name_lower for x in ["react", "vue", "django", "laravel", "fastapi", "astro", "hono"]):
|
||||
if any(
|
||||
x in name_lower
|
||||
for x in ["react", "vue", "django", "laravel", "fastapi", "astro", "hono"]
|
||||
):
|
||||
category = "web-frameworks"
|
||||
elif any(x in name_lower for x in ["godot", "unity", "unreal"]):
|
||||
category = "game-engines"
|
||||
@@ -469,12 +509,16 @@ Please fix these issues and try again.
|
||||
if "max_pages" not in config_data:
|
||||
warnings.append("⚠️ No max_pages set - will use default (100)")
|
||||
elif config_data.get("max_pages") in (None, -1):
|
||||
warnings.append("⚠️ Unlimited scraping enabled - may scrape thousands of pages and take hours")
|
||||
warnings.append(
|
||||
"⚠️ Unlimited scraping enabled - may scrape thousands of pages and take hours"
|
||||
)
|
||||
else:
|
||||
# Unified config warnings
|
||||
for src in config_data.get("sources", []):
|
||||
if src.get("type") == "documentation" and "max_pages" not in src:
|
||||
warnings.append("⚠️ No max_pages set for documentation source - will use default (100)")
|
||||
warnings.append(
|
||||
"⚠️ No max_pages set for documentation source - will use default (100)"
|
||||
)
|
||||
elif src.get("type") == "documentation" and src.get("max_pages") in (None, -1):
|
||||
warnings.append("⚠️ Unlimited scraping enabled for documentation source")
|
||||
|
||||
@@ -529,7 +573,9 @@ Please fix these issues and try again.
|
||||
|
||||
# Create issue
|
||||
issue = repo.create_issue(
|
||||
title=f"[CONFIG] {config_name}", body=issue_body, labels=["config-submission", "needs-review"]
|
||||
title=f"[CONFIG] {config_name}",
|
||||
body=issue_body,
|
||||
labels=["config-submission", "needs-review"],
|
||||
)
|
||||
|
||||
result = f"""✅ Config submitted successfully!
|
||||
|
||||
Reference in New Issue
Block a user