fix: Address critical Windows compatibility and JLCPCB issues (#36, #37, #35)

Phase 1 critical fixes addressing three high-priority issues:

Issue #36 - Windows IPC backend crash (os.getuid not available):
- Add platform detection to skip Unix-specific socket paths on Windows
- Use hasattr check before calling os.getuid()
- Windows now uses auto-detect fallback (named pipes)
- Maintains full Unix socket support on Linux/macOS

Issue #37 - Windows schematic file creation broken:
- Generate unique UUIDs instead of invalid all-zeros UUID
- Add explicit UTF-8 encoding for cross-platform compatibility
- Force Unix line endings (LF) to prevent Windows CRLF issues
- Update template file with valid placeholder UUID
- Fix hardcoded /tmp/ paths in wire_manager.py and pin_locator.py

Issue #35 - JLCPCB download limited to 100 parts:
- Change batch_size from 1000 to 100 to match tscircuit API limit
- Remove premature loop termination when batch < batch_size
- Add documentation explaining API limitation
- Expected result: Full ~2.5M part catalog download (40-60 minutes)

All changes maintain backward compatibility and include detailed comments.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
KiCAD MCP Bot
2026-02-26 10:03:20 -05:00
parent b9bd401b11
commit b4d114ac74
6 changed files with 33 additions and 19 deletions

View File

@@ -2,6 +2,7 @@ from skip import Schematic
import os
import shutil
import logging
import uuid
logger = logging.getLogger('kicad_interface')
@@ -28,9 +29,12 @@ class SchematicManager:
else:
# Fallback: create minimal schematic
logger.warning(f"Template not found at {template_path}, creating minimal schematic")
with open(output_path, 'w') as f:
# Generate unique UUID for this schematic
schematic_uuid = str(uuid.uuid4())
# Write with explicit UTF-8 encoding and Unix line endings for cross-platform compatibility
with open(output_path, 'w', encoding='utf-8', newline='\n') as f:
f.write('(kicad_sch (version 20230121) (generator "KiCAD-MCP-Server")\n\n')
f.write(' (uuid 00000000-0000-0000-0000-000000000000)\n\n')
f.write(f' (uuid {schematic_uuid})\n\n')
f.write(' (paper "A4")\n\n')
f.write(' (lib_symbols\n )\n\n')
f.write(' (sheet_instances\n (path "/" (page "1"))\n )\n')