mirror of
https://github.com/sanjeed5/awesome-cursor-rules-mdc.git
synced 2026-11-30 23:04:59 +08:00
Enhance library scanning workflow with direct input support
- Add flag to track directly provided libraries - Modify scanning logic to skip project scan when libraries are directly input - Optimize library matching for directly provided libraries - Improve logging for direct library input scenario
This commit is contained in:
@@ -203,6 +203,7 @@ def main():
|
|||||||
config = merge_configs(global_config, project_config)
|
config = merge_configs(global_config, project_config)
|
||||||
|
|
||||||
# Handle direct library input if provided
|
# Handle direct library input if provided
|
||||||
|
libraries_directly_provided = False
|
||||||
if args.libraries:
|
if args.libraries:
|
||||||
libraries = [lib.strip() for lib in args.libraries.split(",") if lib.strip()]
|
libraries = [lib.strip() for lib in args.libraries.split(",") if lib.strip()]
|
||||||
if not libraries:
|
if not libraries:
|
||||||
@@ -210,6 +211,7 @@ def main():
|
|||||||
return 1
|
return 1
|
||||||
logger.info(f"Using directly provided libraries: {', '.join(libraries)}")
|
logger.info(f"Using directly provided libraries: {', '.join(libraries)}")
|
||||||
detected_libraries = libraries
|
detected_libraries = libraries
|
||||||
|
libraries_directly_provided = True
|
||||||
else:
|
else:
|
||||||
# Run the scanning phase
|
# Run the scanning phase
|
||||||
try:
|
try:
|
||||||
@@ -356,25 +358,31 @@ def main():
|
|||||||
source_url = f"https://raw.githubusercontent.com/{config['custom_repo']}/main"
|
source_url = f"https://raw.githubusercontent.com/{config['custom_repo']}/main"
|
||||||
logger.info(f"Using custom repository: {Fore.CYAN}{config['custom_repo']}{Style.RESET_ALL}")
|
logger.info(f"Using custom repository: {Fore.CYAN}{config['custom_repo']}{Style.RESET_ALL}")
|
||||||
|
|
||||||
# Run the scanning phase
|
# Run the scanning phase only if libraries were not directly provided
|
||||||
try:
|
try:
|
||||||
# Use quick scan if requested
|
# Skip scanning if libraries were directly provided
|
||||||
scan_start_msg = "Quick scanning" if args.quick_scan else "Scanning"
|
if not libraries_directly_provided:
|
||||||
logger.info(f"{scan_start_msg} for libraries and frameworks...")
|
# Use quick scan if requested
|
||||||
|
scan_start_msg = "Quick scanning" if args.quick_scan else "Scanning"
|
||||||
# Scan project for libraries
|
logger.info(f"{scan_start_msg} for libraries and frameworks...")
|
||||||
logger.info("Scanning for libraries and frameworks...")
|
|
||||||
detected_libraries = scan_project(
|
# Scan project for libraries
|
||||||
project_dir=project_dir,
|
logger.info("Scanning for libraries and frameworks...")
|
||||||
quick_scan=args.quick_scan,
|
detected_libraries = scan_project(
|
||||||
rules_path=config["rules_json"],
|
project_dir=project_dir,
|
||||||
use_cache=not args.force
|
quick_scan=args.quick_scan,
|
||||||
)
|
rules_path=config["rules_json"],
|
||||||
|
use_cache=not args.force
|
||||||
# Get direct match libraries from package files
|
)
|
||||||
direct_match_libraries = scan_package_files(Path(project_dir))
|
|
||||||
|
# Get direct match libraries from package files
|
||||||
logger.info(f"Detected {len(detected_libraries)} libraries/frameworks.")
|
direct_match_libraries = scan_package_files(Path(project_dir))
|
||||||
|
|
||||||
|
logger.info(f"Detected {len(detected_libraries)} libraries/frameworks.")
|
||||||
|
else:
|
||||||
|
# For directly provided libraries, we don't need to scan package files
|
||||||
|
direct_match_libraries = set(detected_libraries)
|
||||||
|
logger.info(f"{Fore.CYAN}Skipping project scan - using directly provided libraries only{Style.RESET_ALL}")
|
||||||
|
|
||||||
# Match libraries with rules
|
# Match libraries with rules
|
||||||
logger.info("Finding relevant rules...")
|
logger.info("Finding relevant rules...")
|
||||||
|
|||||||
Reference in New Issue
Block a user