run ruff
This commit is contained in:
@@ -31,9 +31,8 @@ Examples:
|
||||
skill-seekers install-agent output/react/ --agent cursor
|
||||
"""
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
from typing import List, Optional
|
||||
import sys
|
||||
|
||||
|
||||
def create_parser() -> argparse.ArgumentParser:
|
||||
@@ -61,54 +60,27 @@ Examples:
|
||||
skill-seekers upload output/react.zip
|
||||
|
||||
For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
"""
|
||||
""",
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"--version",
|
||||
action="version",
|
||||
version="%(prog)s 2.7.0"
|
||||
)
|
||||
parser.add_argument("--version", action="version", version="%(prog)s 2.7.0")
|
||||
|
||||
subparsers = parser.add_subparsers(
|
||||
dest="command",
|
||||
title="commands",
|
||||
description="Available Skill Seekers commands",
|
||||
help="Command to run"
|
||||
dest="command", title="commands", description="Available Skill Seekers commands", help="Command to run"
|
||||
)
|
||||
|
||||
# === config subcommand ===
|
||||
config_parser = subparsers.add_parser(
|
||||
"config",
|
||||
help="Configure GitHub tokens, API keys, and settings",
|
||||
description="Interactive configuration wizard"
|
||||
)
|
||||
config_parser.add_argument(
|
||||
"--github",
|
||||
action="store_true",
|
||||
help="Go directly to GitHub token setup"
|
||||
)
|
||||
config_parser.add_argument(
|
||||
"--api-keys",
|
||||
action="store_true",
|
||||
help="Go directly to API keys setup"
|
||||
)
|
||||
config_parser.add_argument(
|
||||
"--show",
|
||||
action="store_true",
|
||||
help="Show current configuration and exit"
|
||||
)
|
||||
config_parser.add_argument(
|
||||
"--test",
|
||||
action="store_true",
|
||||
help="Test connections and exit"
|
||||
"config", help="Configure GitHub tokens, API keys, and settings", description="Interactive configuration wizard"
|
||||
)
|
||||
config_parser.add_argument("--github", action="store_true", help="Go directly to GitHub token setup")
|
||||
config_parser.add_argument("--api-keys", action="store_true", help="Go directly to API keys setup")
|
||||
config_parser.add_argument("--show", action="store_true", help="Show current configuration and exit")
|
||||
config_parser.add_argument("--test", action="store_true", help="Test connections and exit")
|
||||
|
||||
# === scrape subcommand ===
|
||||
scrape_parser = subparsers.add_parser(
|
||||
"scrape",
|
||||
help="Scrape documentation website",
|
||||
description="Scrape documentation website and generate skill"
|
||||
"scrape", help="Scrape documentation website", description="Scrape documentation website and generate skill"
|
||||
)
|
||||
scrape_parser.add_argument("--config", help="Config JSON file")
|
||||
scrape_parser.add_argument("--name", help="Skill name")
|
||||
@@ -123,9 +95,7 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
|
||||
# === github subcommand ===
|
||||
github_parser = subparsers.add_parser(
|
||||
"github",
|
||||
help="Scrape GitHub repository",
|
||||
description="Scrape GitHub repository and generate skill"
|
||||
"github", help="Scrape GitHub repository", description="Scrape GitHub repository and generate skill"
|
||||
)
|
||||
github_parser.add_argument("--config", help="Config JSON file")
|
||||
github_parser.add_argument("--repo", help="GitHub repo (owner/repo)")
|
||||
@@ -134,14 +104,14 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
github_parser.add_argument("--enhance", action="store_true", help="AI enhancement (API)")
|
||||
github_parser.add_argument("--enhance-local", action="store_true", help="AI enhancement (local)")
|
||||
github_parser.add_argument("--api-key", type=str, help="Anthropic API key for --enhance")
|
||||
github_parser.add_argument("--non-interactive", action="store_true", help="Non-interactive mode (fail fast on rate limits)")
|
||||
github_parser.add_argument(
|
||||
"--non-interactive", action="store_true", help="Non-interactive mode (fail fast on rate limits)"
|
||||
)
|
||||
github_parser.add_argument("--profile", type=str, help="GitHub profile name from config")
|
||||
|
||||
# === pdf subcommand ===
|
||||
pdf_parser = subparsers.add_parser(
|
||||
"pdf",
|
||||
help="Extract from PDF file",
|
||||
description="Extract content from PDF and generate skill"
|
||||
"pdf", help="Extract from PDF file", description="Extract content from PDF and generate skill"
|
||||
)
|
||||
pdf_parser.add_argument("--config", help="Config JSON file")
|
||||
pdf_parser.add_argument("--pdf", help="PDF file path")
|
||||
@@ -153,7 +123,7 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
unified_parser = subparsers.add_parser(
|
||||
"unified",
|
||||
help="Multi-source scraping (docs + GitHub + PDF)",
|
||||
description="Combine multiple sources into one skill"
|
||||
description="Combine multiple sources into one skill",
|
||||
)
|
||||
unified_parser.add_argument("--config", required=True, help="Unified config JSON file")
|
||||
unified_parser.add_argument("--merge-mode", help="Merge mode (rule-based, claude-enhanced)")
|
||||
@@ -163,7 +133,7 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
enhance_parser = subparsers.add_parser(
|
||||
"enhance",
|
||||
help="AI-powered enhancement (local, no API key)",
|
||||
description="Enhance SKILL.md using Claude Code (local)"
|
||||
description="Enhance SKILL.md using Claude Code (local)",
|
||||
)
|
||||
enhance_parser.add_argument("skill_directory", help="Skill directory path")
|
||||
enhance_parser.add_argument("--background", action="store_true", help="Run in background")
|
||||
@@ -175,7 +145,7 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
enhance_status_parser = subparsers.add_parser(
|
||||
"enhance-status",
|
||||
help="Check enhancement status (for background/daemon modes)",
|
||||
description="Monitor background enhancement processes"
|
||||
description="Monitor background enhancement processes",
|
||||
)
|
||||
enhance_status_parser.add_argument("skill_directory", help="Skill directory path")
|
||||
enhance_status_parser.add_argument("--watch", "-w", action="store_true", help="Watch in real-time")
|
||||
@@ -184,9 +154,7 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
|
||||
# === package subcommand ===
|
||||
package_parser = subparsers.add_parser(
|
||||
"package",
|
||||
help="Package skill into .zip file",
|
||||
description="Package skill directory into uploadable .zip"
|
||||
"package", help="Package skill into .zip file", description="Package skill directory into uploadable .zip"
|
||||
)
|
||||
package_parser.add_argument("skill_directory", help="Skill directory path")
|
||||
package_parser.add_argument("--no-open", action="store_true", help="Don't open output folder")
|
||||
@@ -194,9 +162,7 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
|
||||
# === upload subcommand ===
|
||||
upload_parser = subparsers.add_parser(
|
||||
"upload",
|
||||
help="Upload skill to Claude",
|
||||
description="Upload .zip file to Claude via Anthropic API"
|
||||
"upload", help="Upload skill to Claude", description="Upload .zip file to Claude via Anthropic API"
|
||||
)
|
||||
upload_parser.add_argument("zip_file", help=".zip file to upload")
|
||||
upload_parser.add_argument("--api-key", help="Anthropic API key")
|
||||
@@ -205,7 +171,7 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
estimate_parser = subparsers.add_parser(
|
||||
"estimate",
|
||||
help="Estimate page count before scraping",
|
||||
description="Estimate total pages for documentation scraping"
|
||||
description="Estimate total pages for documentation scraping",
|
||||
)
|
||||
estimate_parser.add_argument("config", nargs="?", help="Config JSON file")
|
||||
estimate_parser.add_argument("--all", action="store_true", help="List all available configs")
|
||||
@@ -215,128 +181,63 @@ For more information: https://github.com/yusufkaraaslan/Skill_Seekers
|
||||
test_examples_parser = subparsers.add_parser(
|
||||
"extract-test-examples",
|
||||
help="Extract usage examples from test files",
|
||||
description="Analyze test files to extract real API usage patterns"
|
||||
description="Analyze test files to extract real API usage patterns",
|
||||
)
|
||||
test_examples_parser.add_argument("directory", nargs="?", help="Directory containing test files")
|
||||
test_examples_parser.add_argument("--file", help="Single test file to analyze")
|
||||
test_examples_parser.add_argument("--language", help="Filter by programming language (python, javascript, etc.)")
|
||||
test_examples_parser.add_argument(
|
||||
"--min-confidence", type=float, default=0.5, help="Minimum confidence threshold (0.0-1.0, default: 0.5)"
|
||||
)
|
||||
test_examples_parser.add_argument(
|
||||
"directory",
|
||||
nargs="?",
|
||||
help="Directory containing test files"
|
||||
)
|
||||
test_examples_parser.add_argument(
|
||||
"--file",
|
||||
help="Single test file to analyze"
|
||||
)
|
||||
test_examples_parser.add_argument(
|
||||
"--language",
|
||||
help="Filter by programming language (python, javascript, etc.)"
|
||||
)
|
||||
test_examples_parser.add_argument(
|
||||
"--min-confidence",
|
||||
type=float,
|
||||
default=0.5,
|
||||
help="Minimum confidence threshold (0.0-1.0, default: 0.5)"
|
||||
)
|
||||
test_examples_parser.add_argument(
|
||||
"--max-per-file",
|
||||
type=int,
|
||||
default=10,
|
||||
help="Maximum examples per file (default: 10)"
|
||||
)
|
||||
test_examples_parser.add_argument(
|
||||
"--json",
|
||||
action="store_true",
|
||||
help="Output JSON format"
|
||||
)
|
||||
test_examples_parser.add_argument(
|
||||
"--markdown",
|
||||
action="store_true",
|
||||
help="Output Markdown format"
|
||||
"--max-per-file", type=int, default=10, help="Maximum examples per file (default: 10)"
|
||||
)
|
||||
test_examples_parser.add_argument("--json", action="store_true", help="Output JSON format")
|
||||
test_examples_parser.add_argument("--markdown", action="store_true", help="Output Markdown format")
|
||||
|
||||
# === install-agent subcommand ===
|
||||
install_agent_parser = subparsers.add_parser(
|
||||
"install-agent",
|
||||
help="Install skill to AI agent directories",
|
||||
description="Copy skill to agent-specific installation directories"
|
||||
description="Copy skill to agent-specific installation directories",
|
||||
)
|
||||
install_agent_parser.add_argument("skill_directory", help="Skill directory path (e.g., output/react/)")
|
||||
install_agent_parser.add_argument(
|
||||
"--agent", required=True, help="Agent name (claude, cursor, vscode, amp, goose, opencode, all)"
|
||||
)
|
||||
install_agent_parser.add_argument(
|
||||
"skill_directory",
|
||||
help="Skill directory path (e.g., output/react/)"
|
||||
"--force", action="store_true", help="Overwrite existing installation without asking"
|
||||
)
|
||||
install_agent_parser.add_argument(
|
||||
"--agent",
|
||||
required=True,
|
||||
help="Agent name (claude, cursor, vscode, amp, goose, opencode, all)"
|
||||
)
|
||||
install_agent_parser.add_argument(
|
||||
"--force",
|
||||
action="store_true",
|
||||
help="Overwrite existing installation without asking"
|
||||
)
|
||||
install_agent_parser.add_argument(
|
||||
"--dry-run",
|
||||
action="store_true",
|
||||
help="Preview installation without making changes"
|
||||
"--dry-run", action="store_true", help="Preview installation without making changes"
|
||||
)
|
||||
|
||||
# === install subcommand ===
|
||||
install_parser = subparsers.add_parser(
|
||||
"install",
|
||||
help="Complete workflow: fetch → scrape → enhance → package → upload",
|
||||
description="One-command skill installation (AI enhancement MANDATORY)"
|
||||
description="One-command skill installation (AI enhancement MANDATORY)",
|
||||
)
|
||||
install_parser.add_argument(
|
||||
"--config",
|
||||
required=True,
|
||||
help="Config name (e.g., 'react') or path (e.g., 'configs/custom.json')"
|
||||
)
|
||||
install_parser.add_argument(
|
||||
"--destination",
|
||||
default="output",
|
||||
help="Output directory (default: output/)"
|
||||
)
|
||||
install_parser.add_argument(
|
||||
"--no-upload",
|
||||
action="store_true",
|
||||
help="Skip automatic upload to Claude"
|
||||
)
|
||||
install_parser.add_argument(
|
||||
"--unlimited",
|
||||
action="store_true",
|
||||
help="Remove page limits during scraping"
|
||||
)
|
||||
install_parser.add_argument(
|
||||
"--dry-run",
|
||||
action="store_true",
|
||||
help="Preview workflow without executing"
|
||||
"--config", required=True, help="Config name (e.g., 'react') or path (e.g., 'configs/custom.json')"
|
||||
)
|
||||
install_parser.add_argument("--destination", default="output", help="Output directory (default: output/)")
|
||||
install_parser.add_argument("--no-upload", action="store_true", help="Skip automatic upload to Claude")
|
||||
install_parser.add_argument("--unlimited", action="store_true", help="Remove page limits during scraping")
|
||||
install_parser.add_argument("--dry-run", action="store_true", help="Preview workflow without executing")
|
||||
|
||||
# === resume subcommand ===
|
||||
resume_parser = subparsers.add_parser(
|
||||
"resume",
|
||||
help="Resume interrupted scraping job",
|
||||
description="Continue from saved progress checkpoint"
|
||||
)
|
||||
resume_parser.add_argument(
|
||||
"job_id",
|
||||
nargs="?",
|
||||
help="Job ID to resume (or use --list to see available jobs)"
|
||||
)
|
||||
resume_parser.add_argument(
|
||||
"--list",
|
||||
action="store_true",
|
||||
help="List all resumable jobs"
|
||||
)
|
||||
resume_parser.add_argument(
|
||||
"--clean",
|
||||
action="store_true",
|
||||
help="Clean up old progress files"
|
||||
"resume", help="Resume interrupted scraping job", description="Continue from saved progress checkpoint"
|
||||
)
|
||||
resume_parser.add_argument("job_id", nargs="?", help="Job ID to resume (or use --list to see available jobs)")
|
||||
resume_parser.add_argument("--list", action="store_true", help="List all resumable jobs")
|
||||
resume_parser.add_argument("--clean", action="store_true", help="Clean up old progress files")
|
||||
|
||||
return parser
|
||||
|
||||
|
||||
def main(argv: Optional[List[str]] = None) -> int:
|
||||
def main(argv: list[str] | None = None) -> int:
|
||||
"""Main entry point for the unified CLI.
|
||||
|
||||
Args:
|
||||
@@ -356,6 +257,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
try:
|
||||
if args.command == "config":
|
||||
from skill_seekers.cli.config_command import main as config_main
|
||||
|
||||
sys.argv = ["config_command.py"]
|
||||
if args.github:
|
||||
sys.argv.append("--github")
|
||||
@@ -369,6 +271,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "scrape":
|
||||
from skill_seekers.cli.doc_scraper import main as scrape_main
|
||||
|
||||
# Convert args namespace to sys.argv format for doc_scraper
|
||||
sys.argv = ["doc_scraper.py"]
|
||||
if args.config:
|
||||
@@ -395,6 +298,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "github":
|
||||
from skill_seekers.cli.github_scraper import main as github_main
|
||||
|
||||
sys.argv = ["github_scraper.py"]
|
||||
if args.config:
|
||||
sys.argv.extend(["--config", args.config])
|
||||
@@ -418,6 +322,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "pdf":
|
||||
from skill_seekers.cli.pdf_scraper import main as pdf_main
|
||||
|
||||
sys.argv = ["pdf_scraper.py"]
|
||||
if args.config:
|
||||
sys.argv.extend(["--config", args.config])
|
||||
@@ -433,6 +338,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "unified":
|
||||
from skill_seekers.cli.unified_scraper import main as unified_main
|
||||
|
||||
sys.argv = ["unified_scraper.py", "--config", args.config]
|
||||
if args.merge_mode:
|
||||
sys.argv.extend(["--merge-mode", args.merge_mode])
|
||||
@@ -442,6 +348,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "enhance":
|
||||
from skill_seekers.cli.enhance_skill_local import main as enhance_main
|
||||
|
||||
sys.argv = ["enhance_skill_local.py", args.skill_directory]
|
||||
if args.background:
|
||||
sys.argv.append("--background")
|
||||
@@ -455,6 +362,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "enhance-status":
|
||||
from skill_seekers.cli.enhance_status import main as enhance_status_main
|
||||
|
||||
sys.argv = ["enhance_status.py", args.skill_directory]
|
||||
if args.watch:
|
||||
sys.argv.append("--watch")
|
||||
@@ -466,6 +374,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "package":
|
||||
from skill_seekers.cli.package_skill import main as package_main
|
||||
|
||||
sys.argv = ["package_skill.py", args.skill_directory]
|
||||
if args.no_open:
|
||||
sys.argv.append("--no-open")
|
||||
@@ -475,6 +384,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "upload":
|
||||
from skill_seekers.cli.upload_skill import main as upload_main
|
||||
|
||||
sys.argv = ["upload_skill.py", args.zip_file]
|
||||
if args.api_key:
|
||||
sys.argv.extend(["--api-key", args.api_key])
|
||||
@@ -482,6 +392,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "estimate":
|
||||
from skill_seekers.cli.estimate_pages import main as estimate_main
|
||||
|
||||
sys.argv = ["estimate_pages.py"]
|
||||
if args.all:
|
||||
sys.argv.append("--all")
|
||||
@@ -493,6 +404,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "extract-test-examples":
|
||||
from skill_seekers.cli.test_example_extractor import main as test_examples_main
|
||||
|
||||
sys.argv = ["test_example_extractor.py"]
|
||||
if args.directory:
|
||||
sys.argv.append(args.directory)
|
||||
@@ -512,6 +424,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "install-agent":
|
||||
from skill_seekers.cli.install_agent import main as install_agent_main
|
||||
|
||||
sys.argv = ["install_agent.py", args.skill_directory, "--agent", args.agent]
|
||||
if args.force:
|
||||
sys.argv.append("--force")
|
||||
@@ -521,6 +434,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "install":
|
||||
from skill_seekers.cli.install_skill import main as install_main
|
||||
|
||||
sys.argv = ["install_skill.py"]
|
||||
if args.config:
|
||||
sys.argv.extend(["--config", args.config])
|
||||
@@ -536,6 +450,7 @@ def main(argv: Optional[List[str]] = None) -> int:
|
||||
|
||||
elif args.command == "resume":
|
||||
from skill_seekers.cli.resume_command import main as resume_main
|
||||
|
||||
sys.argv = ["resume_command.py"]
|
||||
if args.job_id:
|
||||
sys.argv.append(args.job_id)
|
||||
|
||||
Reference in New Issue
Block a user