style: auto-format 12 files with ruff format (CI formatting check)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -28,6 +28,7 @@ from pathlib import Path
|
||||
# Helpers
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _is_root() -> bool:
|
||||
"""Return True if the current process is running as root (UID 0)."""
|
||||
try:
|
||||
@@ -39,10 +40,7 @@ def _is_root() -> bool:
|
||||
def _get_api_keys() -> dict[str, str | None]:
|
||||
"""Collect API keys from environment."""
|
||||
return {
|
||||
"claude": (
|
||||
os.environ.get("ANTHROPIC_API_KEY")
|
||||
or os.environ.get("ANTHROPIC_AUTH_TOKEN")
|
||||
),
|
||||
"claude": (os.environ.get("ANTHROPIC_API_KEY") or os.environ.get("ANTHROPIC_AUTH_TOKEN")),
|
||||
"gemini": os.environ.get("GOOGLE_API_KEY"),
|
||||
"openai": os.environ.get("OPENAI_API_KEY"),
|
||||
}
|
||||
@@ -95,6 +93,7 @@ def _pick_mode(args) -> tuple[str, str | None]:
|
||||
# API mode runner
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _run_api_mode(args, target: str) -> int:
|
||||
"""Delegate to enhance_skill.py (platform adaptor path)."""
|
||||
from skill_seekers.cli.enhance_skill import main as enhance_api_main
|
||||
@@ -137,6 +136,7 @@ def _run_api_mode(args, target: str) -> int:
|
||||
# LOCAL mode runner
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _run_local_mode(args) -> int:
|
||||
"""Delegate to LocalSkillEnhancer from enhance_skill_local.py."""
|
||||
from skill_seekers.cli.enhance_skill_local import LocalSkillEnhancer
|
||||
@@ -167,6 +167,7 @@ def _run_local_mode(args) -> int:
|
||||
# Main entry point
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def main() -> int:
|
||||
import argparse
|
||||
|
||||
|
||||
@@ -97,6 +97,7 @@ class LlmsTxtParser:
|
||||
# causes httpx to raise "Invalid IPv6 URL" when the URL is fetched.
|
||||
if "[" in url or "]" in url:
|
||||
from urllib.parse import urlparse, urlunparse
|
||||
|
||||
parsed = urlparse(url)
|
||||
# Only encode brackets in the path/query/fragment, not in the host
|
||||
encoded_path = parsed.path.replace("[", "%5B").replace("]", "%5D")
|
||||
|
||||
@@ -563,8 +563,14 @@ class UnifiedScraper:
|
||||
|
||||
# AI enhancement settings (CLI --enhance-level overrides per-source config)
|
||||
cli_args = getattr(self, "_cli_args", None)
|
||||
cli_enhance_level = getattr(cli_args, "enhance_level", None) if cli_args is not None else None
|
||||
enhance_level = cli_enhance_level if cli_enhance_level is not None else source.get("enhance_level", 0)
|
||||
cli_enhance_level = (
|
||||
getattr(cli_args, "enhance_level", None) if cli_args is not None else None
|
||||
)
|
||||
enhance_level = (
|
||||
cli_enhance_level
|
||||
if cli_enhance_level is not None
|
||||
else source.get("enhance_level", 0)
|
||||
)
|
||||
|
||||
# Run codebase analysis
|
||||
logger.info(f" Analysis depth: {analysis_depth}")
|
||||
@@ -991,11 +997,15 @@ class UnifiedScraper:
|
||||
from skill_seekers.cli.workflow_runner import run_workflows
|
||||
|
||||
# Build effective args: use CLI args when provided, otherwise empty namespace
|
||||
effective_args = args if args is not None else argparse.Namespace(
|
||||
enhance_workflow=None,
|
||||
enhance_stage=None,
|
||||
var=None,
|
||||
workflow_dry_run=False,
|
||||
effective_args = (
|
||||
args
|
||||
if args is not None
|
||||
else argparse.Namespace(
|
||||
enhance_workflow=None,
|
||||
enhance_stage=None,
|
||||
var=None,
|
||||
workflow_dry_run=False,
|
||||
)
|
||||
)
|
||||
|
||||
# Merge JSON workflow config into effective_args (JSON appended after CLI)
|
||||
@@ -1008,10 +1018,9 @@ class UnifiedScraper:
|
||||
list(effective_args.enhance_stage or []) + json_stages
|
||||
)
|
||||
if json_vars:
|
||||
effective_args.var = (
|
||||
list(effective_args.var or [])
|
||||
+ [f"{k}={v}" for k, v in json_vars.items()]
|
||||
)
|
||||
effective_args.var = list(effective_args.var or []) + [
|
||||
f"{k}={v}" for k, v in json_vars.items()
|
||||
]
|
||||
|
||||
unified_context = {
|
||||
"name": self.config.get("name", ""),
|
||||
|
||||
Reference in New Issue
Block a user