kcaa 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kcaa-0.1.0/.env.example +27 -0
- kcaa-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +30 -0
- kcaa-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +19 -0
- kcaa-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +46 -0
- kcaa-0.1.0/.github/workflows/ci.yml +123 -0
- kcaa-0.1.0/.gitignore +83 -0
- kcaa-0.1.0/.python-version +1 -0
- kcaa-0.1.0/LICENSE +21 -0
- kcaa-0.1.0/Makefile +81 -0
- kcaa-0.1.0/PKG-INFO +291 -0
- kcaa-0.1.0/README.md +255 -0
- kcaa-0.1.0/README_CN.md +253 -0
- kcaa-0.1.0/docs/analysis_guide.md +207 -0
- kcaa-0.1.0/docs/bom_guide.md +218 -0
- kcaa-0.1.0/docs/configuration.md +222 -0
- kcaa-0.1.0/docs/development.md +275 -0
- kcaa-0.1.0/docs/drc_guide.md +138 -0
- kcaa-0.1.0/docs/netlist_guide.md +183 -0
- kcaa-0.1.0/docs/pattern_guide.md +251 -0
- kcaa-0.1.0/docs/plugin/architecture.md +193 -0
- kcaa-0.1.0/docs/plugin/capability_inventory.md +160 -0
- kcaa-0.1.0/docs/plugin/context_bridge.md +141 -0
- kcaa-0.1.0/docs/plugin/mutation_safety.md +171 -0
- kcaa-0.1.0/docs/plugin/pcb_feasibility.md +133 -0
- kcaa-0.1.0/docs/plugin/plugin_ux.md +152 -0
- kcaa-0.1.0/docs/plugin/tool_contract.md +377 -0
- kcaa-0.1.0/docs/project_guide.md +185 -0
- kcaa-0.1.0/docs/prompt_guide.md +37 -0
- kcaa-0.1.0/docs/thumbnail_guide.md +73 -0
- kcaa-0.1.0/docs/troubleshooting.md +273 -0
- kcaa-0.1.0/kcaa/__init__.py +29 -0
- kcaa-0.1.0/kcaa/config.py +328 -0
- kcaa-0.1.0/kcaa/context.py +85 -0
- kcaa-0.1.0/kcaa/prompts/__init__.py +3 -0
- kcaa-0.1.0/kcaa/prompts/bom_prompts.py +117 -0
- kcaa-0.1.0/kcaa/prompts/drc_prompt.py +49 -0
- kcaa-0.1.0/kcaa/prompts/pattern_prompts.py +145 -0
- kcaa-0.1.0/kcaa/prompts/templates.py +59 -0
- kcaa-0.1.0/kcaa/resources/__init__.py +3 -0
- kcaa-0.1.0/kcaa/resources/bom_resources.py +281 -0
- kcaa-0.1.0/kcaa/resources/drc_resources.py +255 -0
- kcaa-0.1.0/kcaa/resources/files.py +46 -0
- kcaa-0.1.0/kcaa/resources/netlist_resources.py +253 -0
- kcaa-0.1.0/kcaa/resources/pattern_resources.py +294 -0
- kcaa-0.1.0/kcaa/resources/projects.py +51 -0
- kcaa-0.1.0/kcaa/server.py +304 -0
- kcaa-0.1.0/kcaa/tools/__init__.py +9 -0
- kcaa-0.1.0/kcaa/tools/analysis_tools.py +51 -0
- kcaa-0.1.0/kcaa/tools/bom_tools.py +787 -0
- kcaa-0.1.0/kcaa/tools/component_edit_tools.py +2037 -0
- kcaa-0.1.0/kcaa/tools/drc_impl/__init__.py +3 -0
- kcaa-0.1.0/kcaa/tools/drc_impl/cli_drc.py +168 -0
- kcaa-0.1.0/kcaa/tools/drc_tools.py +140 -0
- kcaa-0.1.0/kcaa/tools/export_tools.py +227 -0
- kcaa-0.1.0/kcaa/tools/kipy_tools.py +280 -0
- kcaa-0.1.0/kcaa/tools/netlist_tools.py +486 -0
- kcaa-0.1.0/kcaa/tools/pattern_tools.py +196 -0
- kcaa-0.1.0/kcaa/tools/pcb_edit_tools.py +443 -0
- kcaa-0.1.0/kcaa/tools/pcb_group_tools.py +1541 -0
- kcaa-0.1.0/kcaa/tools/pcb_library_tools.py +413 -0
- kcaa-0.1.0/kcaa/tools/pcb_placement_helpers.py +1361 -0
- kcaa-0.1.0/kcaa/tools/pcb_placement_tools.py +456 -0
- kcaa-0.1.0/kcaa/tools/pcb_query_tools.py +850 -0
- kcaa-0.1.0/kcaa/tools/pcb_zone_tools.py +492 -0
- kcaa-0.1.0/kcaa/tools/placement_helpers.py +379 -0
- kcaa-0.1.0/kcaa/tools/project_tools.py +59 -0
- kcaa-0.1.0/kcaa/tools/symbol_tools.py +603 -0
- kcaa-0.1.0/kcaa/tools/validation_tools.py +298 -0
- kcaa-0.1.0/kcaa/tools/version_tools.py +133 -0
- kcaa-0.1.0/kcaa/tools/wire_edit_tools.py +1410 -0
- kcaa-0.1.0/kcaa/utils/__init__.py +3 -0
- kcaa-0.1.0/kcaa/utils/boundary_validator.py +365 -0
- kcaa-0.1.0/kcaa/utils/component_utils.py +433 -0
- kcaa-0.1.0/kcaa/utils/drc_history.py +181 -0
- kcaa-0.1.0/kcaa/utils/env.py +121 -0
- kcaa-0.1.0/kcaa/utils/file_utils.py +71 -0
- kcaa-0.1.0/kcaa/utils/footprint_database.py +464 -0
- kcaa-0.1.0/kcaa/utils/footprint_db/kicad_footprints.db +0 -0
- kcaa-0.1.0/kcaa/utils/footprint_db/kicad_footprints.db-shm +0 -0
- kcaa-0.1.0/kcaa/utils/footprint_db/kicad_footprints.db-wal +0 -0
- kcaa-0.1.0/kcaa/utils/footprint_index_manager.py +351 -0
- kcaa-0.1.0/kcaa/utils/kicad_api_detection.py +70 -0
- kcaa-0.1.0/kcaa/utils/kicad_cli.py +241 -0
- kcaa-0.1.0/kcaa/utils/kicad_utils.py +122 -0
- kcaa-0.1.0/kcaa/utils/kipy_reload.py +136 -0
- kcaa-0.1.0/kcaa/utils/netlist_parser.py +539 -0
- kcaa-0.1.0/kcaa/utils/path_validator.py +226 -0
- kcaa-0.1.0/kcaa/utils/pattern_recognition.py +859 -0
- kcaa-0.1.0/kcaa/utils/pcb_board_utils.py +422 -0
- kcaa-0.1.0/kcaa/utils/pcb_footprint_utils.py +237 -0
- kcaa-0.1.0/kcaa/utils/pcb_library_utils.py +351 -0
- kcaa-0.1.0/kcaa/utils/pcb_sexp_utils.py +72 -0
- kcaa-0.1.0/kcaa/utils/schematic_sexp_utils.py +28 -0
- kcaa-0.1.0/kcaa/utils/secure_subprocess.py +294 -0
- kcaa-0.1.0/kcaa/utils/skip_helpers.py +158 -0
- kcaa-0.1.0/kcaa/utils/symbol_database.py +500 -0
- kcaa-0.1.0/kcaa/utils/symbol_db/kicad_symbols.db +0 -0
- kcaa-0.1.0/kcaa/utils/symbol_db/kicad_symbols.db-shm +0 -0
- kcaa-0.1.0/kcaa/utils/symbol_db/kicad_symbols.db-wal +0 -0
- kcaa-0.1.0/kcaa/utils/symbol_extractor.py +196 -0
- kcaa-0.1.0/kcaa/utils/symbol_geometry.py +463 -0
- kcaa-0.1.0/kcaa/utils/symbol_index_manager.py +490 -0
- kcaa-0.1.0/kcaa/utils/symbol_index_reader.py +137 -0
- kcaa-0.1.0/kcaa/utils/temp_dir_manager.py +24 -0
- kcaa-0.1.0/kcaa/utils/version_manager.py +143 -0
- kcaa-0.1.0/kicad_plugin/README.md +111 -0
- kcaa-0.1.0/kicad_plugin/__init__.py +165 -0
- kcaa-0.1.0/kicad_plugin/autorouter.py +278 -0
- kcaa-0.1.0/kicad_plugin/context_bridge.py +126 -0
- kcaa-0.1.0/kicad_plugin/llm_client.py +1458 -0
- kcaa-0.1.0/kicad_plugin/server_manager.py +255 -0
- kcaa-0.1.0/kicad_plugin/settings.py +101 -0
- kcaa-0.1.0/kicad_plugin/setup_plugin.bat +7 -0
- kcaa-0.1.0/kicad_plugin/setup_plugin.ps1 +124 -0
- kcaa-0.1.0/kicad_plugin/setup_plugin.sh +91 -0
- kcaa-0.1.0/kicad_plugin/tool_registry.py +263 -0
- kcaa-0.1.0/kicad_plugin/ui/__init__.py +1 -0
- kcaa-0.1.0/kicad_plugin/ui/panel.py +1938 -0
- kcaa-0.1.0/kicad_plugin/ui/settings_dialog.py +145 -0
- kcaa-0.1.0/kicad_plugin/ui/shell.js +181 -0
- kcaa-0.1.0/main.py +79 -0
- kcaa-0.1.0/pyproject.toml +232 -0
- kcaa-0.1.0/run_tests.py +61 -0
- kcaa-0.1.0/tests/__init__.py +0 -0
- kcaa-0.1.0/tests/integration/__init__.py +0 -0
- kcaa-0.1.0/tests/integration/fixtures/__init__.py +0 -0
- kcaa-0.1.0/tests/integration/fixtures/test_board.kicad_pcb +92 -0
- kcaa-0.1.0/tests/integration/fixtures/test_schematic.kicad_sch +151 -0
- kcaa-0.1.0/tests/integration/test_pcb_advanced_tools.py +737 -0
- kcaa-0.1.0/tests/integration/test_pcb_tools.py +658 -0
- kcaa-0.1.0/tests/integration/test_plugin_smoke.py +196 -0
- kcaa-0.1.0/tests/integration/test_schematic_tools.py +722 -0
- kcaa-0.1.0/tests/integration/test_symbol_tools.py +320 -0
- kcaa-0.1.0/tests/integration/test_version_tools.py +350 -0
- kcaa-0.1.0/tests/unit/__init__.py +0 -0
- kcaa-0.1.0/tests/unit/plugin/__init__.py +1 -0
- kcaa-0.1.0/tests/unit/plugin/test_context_bridge.py +231 -0
- kcaa-0.1.0/tests/unit/plugin/test_llm_client.py +788 -0
- kcaa-0.1.0/tests/unit/plugin/test_server_manager.py +211 -0
- kcaa-0.1.0/tests/unit/plugin/test_settings.py +124 -0
- kcaa-0.1.0/tests/unit/tools/fixtures/TestRes.kicad_mod +18 -0
- kcaa-0.1.0/tests/unit/tools/fixtures/fp-lib-table +4 -0
- kcaa-0.1.0/tests/unit/tools/fixtures/test_board.kicad_pcb +92 -0
- kcaa-0.1.0/tests/unit/tools/fixtures/test_board_with_outline.kicad_pcb +125 -0
- kcaa-0.1.0/tests/unit/tools/fixtures/test_board_with_zones.kicad_pcb +105 -0
- kcaa-0.1.0/tests/unit/tools/fixtures/test_group_placement.kicad_pcb +128 -0
- kcaa-0.1.0/tests/unit/tools/fixtures/test_symbols.kicad_sym +103 -0
- kcaa-0.1.0/tests/unit/tools/fixtures/tools_test.kicad_sch +151 -0
- kcaa-0.1.0/tests/unit/tools/test_component_edit_tools.py +1339 -0
- kcaa-0.1.0/tests/unit/tools/test_connect_pins_auto_junction.py +274 -0
- kcaa-0.1.0/tests/unit/tools/test_footprint_index.py +660 -0
- kcaa-0.1.0/tests/unit/tools/test_kipy_tools.py +446 -0
- kcaa-0.1.0/tests/unit/tools/test_label_tools.py +346 -0
- kcaa-0.1.0/tests/unit/tools/test_netlist_tools.py +400 -0
- kcaa-0.1.0/tests/unit/tools/test_pcb_edit_tools.py +305 -0
- kcaa-0.1.0/tests/unit/tools/test_pcb_group_tools.py +810 -0
- kcaa-0.1.0/tests/unit/tools/test_pcb_placement_tools.py +371 -0
- kcaa-0.1.0/tests/unit/tools/test_pcb_query_tools.py +212 -0
- kcaa-0.1.0/tests/unit/tools/test_pcb_utils.py +206 -0
- kcaa-0.1.0/tests/unit/tools/test_pcb_zone_tools.py +346 -0
- kcaa-0.1.0/tests/unit/tools/test_placement_helpers.py +362 -0
- kcaa-0.1.0/tests/unit/tools/test_symbol_tools.py +622 -0
- kcaa-0.1.0/tests/unit/tools/test_version_tools.py +288 -0
- kcaa-0.1.0/tests/unit/tools/test_wire_tools.py +872 -0
- kcaa-0.1.0/tests/unit/utils/__init__.py +0 -0
- kcaa-0.1.0/tests/unit/utils/fixtures/sym-lib-table +4 -0
- kcaa-0.1.0/tests/unit/utils/fixtures/test_device.kicad_sym +246 -0
- kcaa-0.1.0/tests/unit/utils/fixtures/test_power.kicad_sym +200 -0
- kcaa-0.1.0/tests/unit/utils/test_netlist_parser.py +115 -0
- kcaa-0.1.0/tests/unit/utils/test_path_validator.py +238 -0
- kcaa-0.1.0/tests/unit/utils/test_pcb_board_utils.py +284 -0
- kcaa-0.1.0/tests/unit/utils/test_secure_subprocess.py +275 -0
- kcaa-0.1.0/tests/unit/utils/test_symbol_database.py +308 -0
- kcaa-0.1.0/tests/unit/utils/test_symbol_geometry.py +295 -0
- kcaa-0.1.0/tests/unit/utils/test_symbol_index_manager.py +211 -0
- kcaa-0.1.0/tests/unit/utils/test_symbol_index_reader.py +103 -0
kcaa-0.1.0/.env.example
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# Example environment file for KiCad MCP Server
|
|
2
|
+
# Copy this file to .env and customize the values
|
|
3
|
+
|
|
4
|
+
# Additional directories to search for KiCad projects (comma-separated)
|
|
5
|
+
# KICAD_SEARCH_PATHS=~/pcb,~/Electronics,~/Projects/KiCad
|
|
6
|
+
|
|
7
|
+
# Override the default KiCad user directory
|
|
8
|
+
# KICAD_USER_DIR=~/Documents/KiCad
|
|
9
|
+
|
|
10
|
+
# Override the default KiCad application path
|
|
11
|
+
# macOS:
|
|
12
|
+
# KICAD_APP_PATH=/Applications/KiCad/KiCad.app
|
|
13
|
+
# Windows:
|
|
14
|
+
# KICAD_APP_PATH=C:\Program Files\KiCad
|
|
15
|
+
# Linux:
|
|
16
|
+
# KICAD_APP_PATH=/usr/share/kicad
|
|
17
|
+
|
|
18
|
+
# MCP server transport protocol
|
|
19
|
+
# Supported values: stdio (default), streamable-http, sse
|
|
20
|
+
# MCP_TRANSPORT=stdio
|
|
21
|
+
|
|
22
|
+
# KiCad version (used to build versioned directory paths)
|
|
23
|
+
# KICAD_VERSION=9.0
|
|
24
|
+
|
|
25
|
+
# KiCad symbol library paths (defaults are derived from KICAD_VERSION)
|
|
26
|
+
# KICAD_3RD_PARTY=~/.local/share/kicad/9.0/3rdparty
|
|
27
|
+
# KICAD_CONFIG_DIR=~/.config/kicad/9.0
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
## Bug Description
|
|
2
|
+
<!-- A clear and concise description of the bug -->
|
|
3
|
+
|
|
4
|
+
## Environment
|
|
5
|
+
- Operating System: <!-- e.g., macOS 13.4, Windows 11, Ubuntu 22.04 -->
|
|
6
|
+
- Python Version: <!-- e.g., 3.10.5 -->
|
|
7
|
+
- KiCad Version: <!-- e.g., 9.0.2 -->
|
|
8
|
+
- MCP Client: <!-- e.g., Claude Desktop, custom client -->
|
|
9
|
+
- KiCad MCP Server Version/Commit: <!-- e.g., v0.1.0, commit hash -->
|
|
10
|
+
|
|
11
|
+
## Steps to Reproduce
|
|
12
|
+
<!-- Detailed steps to reproduce the bug -->
|
|
13
|
+
1.
|
|
14
|
+
2.
|
|
15
|
+
3.
|
|
16
|
+
|
|
17
|
+
## Expected Behavior
|
|
18
|
+
<!-- What you expected to happen -->
|
|
19
|
+
|
|
20
|
+
## Actual Behavior
|
|
21
|
+
<!-- What actually happened, including any error messages, logs, or screenshots -->
|
|
22
|
+
|
|
23
|
+
## Logs
|
|
24
|
+
<!-- If applicable, include relevant log output. You can find logs at:
|
|
25
|
+
- On macOS: ~/Library/Logs/Claude/mcp-server-kicad.log
|
|
26
|
+
- On Windows: [Path to logs]
|
|
27
|
+
- On Linux: [Path to logs] -->
|
|
28
|
+
|
|
29
|
+
## Additional Context
|
|
30
|
+
<!-- Any other information that might be relevant to the issue -->
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a new feature or enhancement for the KiCad MCP Server
|
|
4
|
+
title: "[FEATURE] "
|
|
5
|
+
labels: enhancement
|
|
6
|
+
assignees: ''
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Feature Description
|
|
10
|
+
<!-- A clear and concise description of the feature you'd like to see -->
|
|
11
|
+
|
|
12
|
+
## Use Case
|
|
13
|
+
<!-- Describe how this feature would be used and who would benefit from it -->
|
|
14
|
+
|
|
15
|
+
## Proposed Implementation (optional)
|
|
16
|
+
<!-- If you have ideas about how to implement this feature -->
|
|
17
|
+
|
|
18
|
+
## Additional Context
|
|
19
|
+
<!-- Any other information, screenshots, or examples that might be helpful -->
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Pull Request
|
|
3
|
+
about: Submit a pull request to contribute to the KiCad MCP Server
|
|
4
|
+
title: ""
|
|
5
|
+
labels: ""
|
|
6
|
+
assignees: ""
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Description
|
|
10
|
+
<!-- Provide a detailed description of the changes in this PR -->
|
|
11
|
+
|
|
12
|
+
## Related Issue(s)
|
|
13
|
+
<!-- Link any related issues using the format: Fixes #123, Addresses #456 -->
|
|
14
|
+
|
|
15
|
+
## Type of Change
|
|
16
|
+
<!-- Mark the appropriate options with 'x' (e.g., [x]) -->
|
|
17
|
+
- [ ] Bug fix (non-breaking change that fixes an issue)
|
|
18
|
+
- [ ] New feature (non-breaking change that adds functionality)
|
|
19
|
+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
|
20
|
+
- [ ] Documentation update
|
|
21
|
+
- [ ] Performance improvement
|
|
22
|
+
- [ ] Code refactoring (no functional changes)
|
|
23
|
+
- [ ] Other (please describe):
|
|
24
|
+
|
|
25
|
+
## Testing Performed
|
|
26
|
+
<!-- Describe the testing you've done -->
|
|
27
|
+
- [ ] Added new unit tests
|
|
28
|
+
- [ ] Manually tested on macOS
|
|
29
|
+
- [ ] Manually tested on Windows
|
|
30
|
+
- [ ] Manually tested on Linux
|
|
31
|
+
- [ ] Integration tested with Claude Desktop or other MCP client
|
|
32
|
+
|
|
33
|
+
## Screenshots/Output
|
|
34
|
+
<!-- If applicable, add screenshots or output examples -->
|
|
35
|
+
|
|
36
|
+
## Checklist
|
|
37
|
+
<!-- Mark items with 'x' (e.g., [x]) -->
|
|
38
|
+
- [ ] My code follows the project's coding style
|
|
39
|
+
- [ ] I have commented my code, particularly in hard-to-understand areas
|
|
40
|
+
- [ ] I have updated the documentation to reflect my changes
|
|
41
|
+
- [ ] My changes generate no new warnings or errors
|
|
42
|
+
- [ ] I have checked that my changes work on all supported platforms
|
|
43
|
+
- [ ] New and existing unit tests pass with my changes
|
|
44
|
+
|
|
45
|
+
## Additional Notes
|
|
46
|
+
<!-- Any other information that would be useful -->
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, develop ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, develop ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
name: Lint and Format
|
|
13
|
+
|
|
14
|
+
steps:
|
|
15
|
+
- uses: actions/checkout@v4
|
|
16
|
+
|
|
17
|
+
- name: Install uv
|
|
18
|
+
uses: astral-sh/setup-uv@v4
|
|
19
|
+
with:
|
|
20
|
+
enable-cache: true
|
|
21
|
+
|
|
22
|
+
- name: Set up Python 3.12
|
|
23
|
+
run: |
|
|
24
|
+
uv python install 3.12
|
|
25
|
+
uv python pin 3.12
|
|
26
|
+
|
|
27
|
+
- name: Install dependencies
|
|
28
|
+
run: uv sync --group dev
|
|
29
|
+
|
|
30
|
+
- name: Lint with ruff
|
|
31
|
+
run: uv run ruff check kcaa/ tests/
|
|
32
|
+
|
|
33
|
+
- name: Check formatting with ruff
|
|
34
|
+
run: uv run ruff format --check kcaa/ tests/
|
|
35
|
+
|
|
36
|
+
test:
|
|
37
|
+
runs-on: ${{ matrix.os }}
|
|
38
|
+
strategy:
|
|
39
|
+
fail-fast: false
|
|
40
|
+
matrix:
|
|
41
|
+
os: [ubuntu-latest, macos-latest]
|
|
42
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
43
|
+
exclude:
|
|
44
|
+
- os: macos-latest
|
|
45
|
+
python-version: "3.10"
|
|
46
|
+
|
|
47
|
+
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
|
|
48
|
+
|
|
49
|
+
steps:
|
|
50
|
+
- uses: actions/checkout@v4
|
|
51
|
+
|
|
52
|
+
- name: Install uv
|
|
53
|
+
uses: astral-sh/setup-uv@v4
|
|
54
|
+
with:
|
|
55
|
+
enable-cache: true
|
|
56
|
+
|
|
57
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
58
|
+
run: |
|
|
59
|
+
uv python install ${{ matrix.python-version }}
|
|
60
|
+
uv python pin ${{ matrix.python-version }}
|
|
61
|
+
|
|
62
|
+
- name: Install dependencies
|
|
63
|
+
run: uv sync --group dev
|
|
64
|
+
|
|
65
|
+
- name: Run tests
|
|
66
|
+
run: uv run python -m pytest tests/ -v --cov=kcaa --cov-report=xml --cov-fail-under=30
|
|
67
|
+
|
|
68
|
+
- name: Upload coverage to Codecov
|
|
69
|
+
uses: codecov/codecov-action@v4
|
|
70
|
+
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.12'
|
|
71
|
+
with:
|
|
72
|
+
file: ./coverage.xml
|
|
73
|
+
fail_ci_if_error: false
|
|
74
|
+
|
|
75
|
+
security:
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
name: Security Scan
|
|
78
|
+
|
|
79
|
+
steps:
|
|
80
|
+
- uses: actions/checkout@v4
|
|
81
|
+
|
|
82
|
+
- name: Install uv
|
|
83
|
+
uses: astral-sh/setup-uv@v4
|
|
84
|
+
with:
|
|
85
|
+
enable-cache: true
|
|
86
|
+
|
|
87
|
+
- name: Set up Python 3.12
|
|
88
|
+
run: |
|
|
89
|
+
uv python install 3.12
|
|
90
|
+
uv python pin 3.12
|
|
91
|
+
|
|
92
|
+
- name: Install dependencies
|
|
93
|
+
run: uv sync --group dev
|
|
94
|
+
|
|
95
|
+
- name: Run security scan
|
|
96
|
+
run: uv run bandit -r kcaa/
|
|
97
|
+
|
|
98
|
+
build:
|
|
99
|
+
runs-on: ubuntu-latest
|
|
100
|
+
name: Build Package
|
|
101
|
+
needs: [lint, test]
|
|
102
|
+
|
|
103
|
+
steps:
|
|
104
|
+
- uses: actions/checkout@v4
|
|
105
|
+
|
|
106
|
+
- name: Install uv
|
|
107
|
+
uses: astral-sh/setup-uv@v4
|
|
108
|
+
with:
|
|
109
|
+
enable-cache: true
|
|
110
|
+
|
|
111
|
+
- name: Set up Python 3.12
|
|
112
|
+
run: |
|
|
113
|
+
uv python install 3.12
|
|
114
|
+
uv python pin 3.12
|
|
115
|
+
|
|
116
|
+
- name: Build package
|
|
117
|
+
run: uv build
|
|
118
|
+
|
|
119
|
+
- name: Upload artifacts
|
|
120
|
+
uses: actions/upload-artifact@v4
|
|
121
|
+
with:
|
|
122
|
+
name: dist
|
|
123
|
+
path: dist/
|
kcaa-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Virtual Environment
|
|
2
|
+
venv/
|
|
3
|
+
env/
|
|
4
|
+
ENV/
|
|
5
|
+
.venv/
|
|
6
|
+
|
|
7
|
+
# Environment files
|
|
8
|
+
.env
|
|
9
|
+
|
|
10
|
+
# Python cache files
|
|
11
|
+
__pycache__/
|
|
12
|
+
*.py[cod]
|
|
13
|
+
*$py.class
|
|
14
|
+
*.so
|
|
15
|
+
.Python
|
|
16
|
+
|
|
17
|
+
# Distribution / packaging
|
|
18
|
+
dist/
|
|
19
|
+
build/
|
|
20
|
+
*.egg-info/
|
|
21
|
+
*.egg
|
|
22
|
+
*.whl
|
|
23
|
+
|
|
24
|
+
# PyPI
|
|
25
|
+
.pypirc
|
|
26
|
+
|
|
27
|
+
# Unit test / coverage reports
|
|
28
|
+
htmlcov/
|
|
29
|
+
.tox/
|
|
30
|
+
.coverage
|
|
31
|
+
.coverage.*
|
|
32
|
+
.cache
|
|
33
|
+
nosetests.xml
|
|
34
|
+
coverage.xml
|
|
35
|
+
*.cover
|
|
36
|
+
.pytest_cache/
|
|
37
|
+
MagicMock/
|
|
38
|
+
|
|
39
|
+
# Logs
|
|
40
|
+
logs/
|
|
41
|
+
*.log
|
|
42
|
+
|
|
43
|
+
# IDE specific files
|
|
44
|
+
.idea/
|
|
45
|
+
.vscode/
|
|
46
|
+
*.swp
|
|
47
|
+
*.swo
|
|
48
|
+
.DS_Store
|
|
49
|
+
|
|
50
|
+
# MCP specific
|
|
51
|
+
~/.kcaa/drc_history/
|
|
52
|
+
|
|
53
|
+
# Symbol database files (auto-generated, do not commit)
|
|
54
|
+
kicad_mcp/utils/symbol_db/*.db
|
|
55
|
+
kicad_mcp/utils/symbol_db/*.db-shm
|
|
56
|
+
kicad_mcp/utils/symbol_db/*.db-wal
|
|
57
|
+
|
|
58
|
+
# Footprint database files (auto-generated, do not commit)
|
|
59
|
+
kicad_mcp/utils/footprint_db/*.db
|
|
60
|
+
kicad_mcp/utils/footprint_db/*.db-shm
|
|
61
|
+
kicad_mcp/utils/footprint_db/*.db-wal
|
|
62
|
+
|
|
63
|
+
# UV and modern Python tooling
|
|
64
|
+
uv.lock
|
|
65
|
+
.uv-cache/
|
|
66
|
+
.ruff_cache/
|
|
67
|
+
|
|
68
|
+
# Pre-commit
|
|
69
|
+
.pre-commit-config.yaml
|
|
70
|
+
|
|
71
|
+
# KiCad backup files
|
|
72
|
+
*-backups/
|
|
73
|
+
fp-info-cache
|
|
74
|
+
*.bak
|
|
75
|
+
*.backup
|
|
76
|
+
*.kicad_pcb-bak
|
|
77
|
+
*.kicad_sch-bak
|
|
78
|
+
*.kicad_pro-bak
|
|
79
|
+
*.kicad_prl
|
|
80
|
+
*.kicad_prl-bak
|
|
81
|
+
*.kicad_sch.lck
|
|
82
|
+
*.kicad_pcb.lck
|
|
83
|
+
*.kicad_pro.lck
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.10
|
kcaa-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Lama Al Rajih
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
kcaa-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
.PHONY: help install test lint format clean build run dist-plugin
|
|
2
|
+
|
|
3
|
+
help:
|
|
4
|
+
@echo "Available commands:"
|
|
5
|
+
@echo " install Install dependencies"
|
|
6
|
+
@echo " test Run tests"
|
|
7
|
+
@echo " test <file> Run specific test file"
|
|
8
|
+
@echo " lint Run linting"
|
|
9
|
+
@echo " format Format code"
|
|
10
|
+
@echo " clean Clean build artifacts"
|
|
11
|
+
@echo " build Build package"
|
|
12
|
+
@echo " run Start the KiCad MCP server"
|
|
13
|
+
@echo " dist-plugin Build installable KiCad plugin zip"
|
|
14
|
+
|
|
15
|
+
install:
|
|
16
|
+
uv sync --group dev
|
|
17
|
+
|
|
18
|
+
test:
|
|
19
|
+
# Collect extra args; if none, use tests/
|
|
20
|
+
@files="$(filter-out $@,$(MAKECMDGOALS))"; \
|
|
21
|
+
if [ -z "$$files" ]; then files="tests/"; fi; \
|
|
22
|
+
uv run pytest $$files -v
|
|
23
|
+
|
|
24
|
+
# Prevent “No rule to make target …” errors for the extra args
|
|
25
|
+
%::
|
|
26
|
+
@:
|
|
27
|
+
|
|
28
|
+
lint:
|
|
29
|
+
uv run ruff check kcaa/ tests/
|
|
30
|
+
uv run mypy kcaa/
|
|
31
|
+
|
|
32
|
+
format:
|
|
33
|
+
uv run ruff format kcaa/ tests/
|
|
34
|
+
|
|
35
|
+
clean:
|
|
36
|
+
rm -rf dist/
|
|
37
|
+
rm -rf build/
|
|
38
|
+
rm -rf *.egg-info/
|
|
39
|
+
rm -rf .pytest_cache/
|
|
40
|
+
rm -rf htmlcov/
|
|
41
|
+
rm -f coverage.xml
|
|
42
|
+
find . -type d -name __pycache__ -delete
|
|
43
|
+
find . -type f -name "*.pyc" -delete
|
|
44
|
+
|
|
45
|
+
build:
|
|
46
|
+
uv build
|
|
47
|
+
|
|
48
|
+
run:
|
|
49
|
+
uv run python main.py
|
|
50
|
+
|
|
51
|
+
# Build an installable KiCad plugin zip.
|
|
52
|
+
# KiCad discovers plugins by looking for a directory named after the plugin
|
|
53
|
+
# inside its scripting/plugins/ folder. The zip contains:
|
|
54
|
+
# kicad_ai_assistant/ <- KiCad plugin directory
|
|
55
|
+
# __init__.py <- entry point (KiCadAIPlugin)
|
|
56
|
+
# context_bridge.py
|
|
57
|
+
# llm_client.py
|
|
58
|
+
# server_manager.py
|
|
59
|
+
# settings.py
|
|
60
|
+
# ui/
|
|
61
|
+
# README.md
|
|
62
|
+
# Install: unzip into ~/.local/share/kicad/<ver>/scripting/plugins/
|
|
63
|
+
# then run from the plugin dir:
|
|
64
|
+
# ./setup_plugin.sh /path/to/kcaa
|
|
65
|
+
# setup_plugin.sh <- creates .venv with kcaa installed
|
|
66
|
+
PLUGIN_ZIP := dist/kicad_ai_assistant.zip
|
|
67
|
+
PLUGIN_SRC := kicad_plugin
|
|
68
|
+
|
|
69
|
+
dist-plugin:
|
|
70
|
+
@mkdir -p dist
|
|
71
|
+
@rm -f $(PLUGIN_ZIP)
|
|
72
|
+
@echo "Building $(PLUGIN_ZIP)..."
|
|
73
|
+
@rm -rf dist/_stage
|
|
74
|
+
@mkdir -p dist/_stage
|
|
75
|
+
@cp -r $(PLUGIN_SRC) dist/_stage/kicad_ai_assistant
|
|
76
|
+
@find dist/_stage -type d -name __pycache__ -exec rm -rf {} +
|
|
77
|
+
@find dist/_stage -type f -name "*.pyc" -delete
|
|
78
|
+
@cd dist/_stage && zip -r ../$(notdir $(PLUGIN_ZIP)) kicad_ai_assistant
|
|
79
|
+
@rm -rf dist/_stage
|
|
80
|
+
@echo "Created $(PLUGIN_ZIP)"
|
|
81
|
+
|