@@ -276,7 +276,8 @@ def create_template_metadata(
276276 metadata ["extends" ] = extends
277277
278278 if dependencies :
279- metadata ["dependencies" ] = {"recommended" : dependencies }
279+ deps_dict : Dict [str , Any ] = {"recommended" : dependencies }
280+ metadata ["dependencies" ] = deps_dict
280281
281282 return metadata
282283
@@ -409,9 +410,9 @@ def create_template_structure(
409410 MAX_PATH_LENGTH = 512
410411
411412 # Track main KiCad files
412- main_project_file = None
413- main_schematic_file = None
414- main_pcb_file = None
413+ main_project_file : Optional [ str ] = None
414+ main_schematic_file : Optional [ str ] = None
415+ main_pcb_file : Optional [ str ] = None
415416
416417 # First scan to find main KiCad files
417418 click .echo ("Scanning for main KiCad files..." )
@@ -430,31 +431,32 @@ def create_template_structure(
430431 continue
431432
432433 # Look for KiCad files in the root directory
433- for file in files :
434- rel_path = str (Path (rel_root ) / file )
435- git_path = rel_path .replace (os .sep , "/" )
434+ for file_name in files :
435+ file_path = Path (rel_root ) / file_name
436+ rel_path_str = str (file_path )
437+ git_path = rel_path_str .replace (os .sep , "/" )
436438
437439 # Skip gitignored files
438- if gitignore_spec and gitignore_spec .match_file (git_path ):
440+ if gitignore_spec is not None and gitignore_spec .match_file (git_path ):
439441 continue
440442
441443 # Look for main files in the root directory or top-level folders
442444 if rel_root == "." or len (Path (rel_root ).parts ) <= 1 :
443- file_lower = file .lower ()
445+ file_lower = file_name .lower ()
444446
445447 if file_lower .endswith (KICAD_PROJECT_EXT ) and not main_project_file :
446- main_project_file = str (Path (root ) / file )
447- click .echo (f"Found main project file: { file } " )
448+ main_project_file = str (Path (root ) / file_name )
449+ click .echo (f"Found main project file: { file_name } " )
448450
449451 elif (
450452 file_lower .endswith (KICAD_SCHEMATIC_EXT ) and not main_schematic_file
451453 ):
452- main_schematic_file = str (Path (root ) / file )
453- click .echo (f"Found main schematic file: { file } " )
454+ main_schematic_file = str (Path (root ) / file_name )
455+ click .echo (f"Found main schematic file: { file_name } " )
454456
455457 elif file_lower .endswith (KICAD_PCB_EXT ) and not main_pcb_file :
456- main_pcb_file = str (Path (root ) / file )
457- click .echo (f"Found main PCB file: { file } " )
458+ main_pcb_file = str (Path (root ) / file_name )
459+ click .echo (f"Found main PCB file: { file_name } " )
458460
459461 # Copy files from source to template
460462 for root , dirs , files in os .walk (source_directory ):
@@ -476,7 +478,7 @@ def create_template_structure(
476478
477479 # Ensure proper path format for gitignore matching
478480 # (pathspec expects paths with forward slashes and trailing slash for directories)
479- git_path = rel_path .replace (os .sep , "/" )
481+ git_path = str ( rel_path ) .replace (os .sep , "/" )
480482 if not git_path .endswith ("/" ):
481483 git_path += "/"
482484
@@ -516,7 +518,7 @@ def create_template_structure(
516518 rel_path = Path (rel_root ) / file
517519
518520 # Ensure proper path format for gitignore matching
519- git_path = rel_path .replace (os .sep , "/" )
521+ git_path = str ( rel_path ) .replace (os .sep , "/" )
520522
521523 # Skip gitignored files and additional excluded files
522524 if gitignore_spec and gitignore_spec .match_file (git_path ):
0 commit comments