fritzkit 0.0.0-stage → 0.1.1
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.
- package/.claude-plugin/marketplace.json +12 -0
- package/.claude-plugin/plugin.json +13 -0
- package/CHANGELOG.md +8 -0
- package/LICENSE +21 -0
- package/README.md +429 -2
- package/dist/cli/commands/doctor.d.ts +4 -0
- package/dist/cli/commands/doctor.js +7 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/export.d.ts +17 -0
- package/dist/cli/commands/export.js +81 -0
- package/dist/cli/commands/export.js.map +1 -0
- package/dist/cli/commands/kicad.d.ts +10 -0
- package/dist/cli/commands/kicad.js +22 -0
- package/dist/cli/commands/kicad.js.map +1 -0
- package/dist/cli/commands/parts.d.ts +22 -0
- package/dist/cli/commands/parts.js +46 -0
- package/dist/cli/commands/parts.js.map +1 -0
- package/dist/cli/commands/prune.d.ts +14 -0
- package/dist/cli/commands/prune.js +67 -0
- package/dist/cli/commands/prune.js.map +1 -0
- package/dist/cli/commands/render.d.ts +24 -0
- package/dist/cli/commands/render.js +62 -0
- package/dist/cli/commands/render.js.map +1 -0
- package/dist/cli/commands/schema.d.ts +10 -0
- package/dist/cli/commands/schema.js +35 -0
- package/dist/cli/commands/schema.js.map +1 -0
- package/dist/cli/commands/ui.d.ts +14 -0
- package/dist/cli/commands/ui.js +67 -0
- package/dist/cli/commands/ui.js.map +1 -0
- package/dist/cli/commands/validate.d.ts +24 -0
- package/dist/cli/commands/validate.js +91 -0
- package/dist/cli/commands/validate.js.map +1 -0
- package/dist/cli/context.d.ts +81 -0
- package/dist/cli/context.js +139 -0
- package/dist/cli/context.js.map +1 -0
- package/dist/cli/main.d.ts +2 -0
- package/dist/cli/main.js +8 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/program.d.ts +21 -0
- package/dist/cli/program.js +158 -0
- package/dist/cli/program.js.map +1 -0
- package/dist/cli/raster.d.ts +4 -0
- package/dist/cli/raster.js +9 -0
- package/dist/cli/raster.js.map +1 -0
- package/dist/core/compile/breadboard-util.d.ts +12 -0
- package/dist/core/compile/breadboard-util.js +107 -0
- package/dist/core/compile/breadboard-util.js.map +1 -0
- package/dist/core/compile/breadboard.d.ts +60 -0
- package/dist/core/compile/breadboard.js +513 -0
- package/dist/core/compile/breadboard.js.map +1 -0
- package/dist/core/compile/fzp.d.ts +12 -0
- package/dist/core/compile/fzp.js +183 -0
- package/dist/core/compile/fzp.js.map +1 -0
- package/dist/core/compile/icon.d.ts +17 -0
- package/dist/core/compile/icon.js +27 -0
- package/dist/core/compile/icon.js.map +1 -0
- package/dist/core/compile/index.d.ts +4 -0
- package/dist/core/compile/index.js +62 -0
- package/dist/core/compile/index.js.map +1 -0
- package/dist/core/compile/pcb.d.ts +39 -0
- package/dist/core/compile/pcb.js +164 -0
- package/dist/core/compile/pcb.js.map +1 -0
- package/dist/core/compile/schematic.d.ts +69 -0
- package/dist/core/compile/schematic.js +240 -0
- package/dist/core/compile/schematic.js.map +1 -0
- package/dist/core/compile/style.d.ts +52 -0
- package/dist/core/compile/style.js +72 -0
- package/dist/core/compile/style.js.map +1 -0
- package/dist/core/compile/types.d.ts +50 -0
- package/dist/core/compile/types.js +15 -0
- package/dist/core/compile/types.js.map +1 -0
- package/dist/core/export/bin.d.ts +61 -0
- package/dist/core/export/bin.js +221 -0
- package/dist/core/export/bin.js.map +1 -0
- package/dist/core/export/fzpz.d.ts +37 -0
- package/dist/core/export/fzpz.js +121 -0
- package/dist/core/export/fzpz.js.map +1 -0
- package/dist/core/export/index.d.ts +5 -0
- package/dist/core/export/index.js +6 -0
- package/dist/core/export/index.js.map +1 -0
- package/dist/core/export/install.d.ts +77 -0
- package/dist/core/export/install.js +183 -0
- package/dist/core/export/install.js.map +1 -0
- package/dist/core/export/prune.d.ts +72 -0
- package/dist/core/export/prune.js +165 -0
- package/dist/core/export/prune.js.map +1 -0
- package/dist/core/fritzing.d.ts +22 -0
- package/dist/core/fritzing.js +77 -0
- package/dist/core/fritzing.js.map +1 -0
- package/dist/core/identity.d.ts +29 -0
- package/dist/core/identity.js +70 -0
- package/dist/core/identity.js.map +1 -0
- package/dist/core/image/bbox.d.ts +27 -0
- package/dist/core/image/bbox.js +24 -0
- package/dist/core/image/bbox.js.map +1 -0
- package/dist/core/image/index.d.ts +8 -0
- package/dist/core/image/index.js +9 -0
- package/dist/core/image/index.js.map +1 -0
- package/dist/core/image/key.d.ts +72 -0
- package/dist/core/image/key.js +317 -0
- package/dist/core/image/key.js.map +1 -0
- package/dist/core/image/prepare.d.ts +31 -0
- package/dist/core/image/prepare.js +98 -0
- package/dist/core/image/prepare.js.map +1 -0
- package/dist/core/image/remover.d.ts +17 -0
- package/dist/core/image/remover.js +51 -0
- package/dist/core/image/remover.js.map +1 -0
- package/dist/core/index.d.ts +16 -0
- package/dist/core/index.js +17 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/kicad/footprint.d.ts +104 -0
- package/dist/core/kicad/footprint.js +317 -0
- package/dist/core/kicad/footprint.js.map +1 -0
- package/dist/core/kicad/index.d.ts +25 -0
- package/dist/core/kicad/index.js +197 -0
- package/dist/core/kicad/index.js.map +1 -0
- package/dist/core/kicad/sexpr.d.ts +35 -0
- package/dist/core/kicad/sexpr.js +163 -0
- package/dist/core/kicad/sexpr.js.map +1 -0
- package/dist/core/resolve.d.ts +113 -0
- package/dist/core/resolve.js +301 -0
- package/dist/core/resolve.js.map +1 -0
- package/dist/core/schema/part.d.ts +995 -0
- package/dist/core/schema/part.js +278 -0
- package/dist/core/schema/part.js.map +1 -0
- package/dist/core/schema/part.schema.json +1122 -0
- package/dist/core/svg.d.ts +20 -0
- package/dist/core/svg.js +56 -0
- package/dist/core/svg.js.map +1 -0
- package/dist/core/units.d.ts +28 -0
- package/dist/core/units.js +42 -0
- package/dist/core/units.js.map +1 -0
- package/dist/core/validate/checker.d.ts +46 -0
- package/dist/core/validate/checker.js +142 -0
- package/dist/core/validate/checker.js.map +1 -0
- package/dist/core/validate/doctor.d.ts +25 -0
- package/dist/core/validate/doctor.js +156 -0
- package/dist/core/validate/doctor.js.map +1 -0
- package/dist/core/validate/explain.d.ts +10 -0
- package/dist/core/validate/explain.js +135 -0
- package/dist/core/validate/explain.js.map +1 -0
- package/dist/core/validate/index.d.ts +21 -0
- package/dist/core/validate/index.js +96 -0
- package/dist/core/validate/index.js.map +1 -0
- package/dist/core/validate/structural.d.ts +74 -0
- package/dist/core/validate/structural.js +664 -0
- package/dist/core/validate/structural.js.map +1 -0
- package/dist/core/workspace.d.ts +69 -0
- package/dist/core/workspace.js +213 -0
- package/dist/core/workspace.js.map +1 -0
- package/dist/mcp/jsonpatch.d.ts +30 -0
- package/dist/mcp/jsonpatch.js +145 -0
- package/dist/mcp/jsonpatch.js.map +1 -0
- package/dist/mcp/main.d.ts +2 -0
- package/dist/mcp/main.js +5 -0
- package/dist/mcp/main.js.map +1 -0
- package/dist/mcp/server.d.ts +28 -0
- package/dist/mcp/server.js +310 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/server/api.d.ts +72 -0
- package/dist/server/api.js +507 -0
- package/dist/server/api.js.map +1 -0
- package/dist/server/events.d.ts +28 -0
- package/dist/server/events.js +134 -0
- package/dist/server/events.js.map +1 -0
- package/dist/server/http.d.ts +36 -0
- package/dist/server/http.js +127 -0
- package/dist/server/http.js.map +1 -0
- package/dist/server/index.d.ts +65 -0
- package/dist/server/index.js +193 -0
- package/dist/server/index.js.map +1 -0
- package/dist/ui/assets/index-DLU8opyI.js +63 -0
- package/dist/ui/assets/index-GhUA-T3b.css +1 -0
- package/dist/ui/index.html +14 -0
- package/package.json +89 -4
- package/skills/fritzkit/SKILL.md +690 -0
- package/skills/fritzkit/reference/examples.md +275 -0
- package/skills/fritzkit/reference/part-json.md +333 -0
- package/skills/fritzkit/scripts/measure.py +197 -0
- package/tools/fzp-checker/.python-version +1 -0
- package/tools/fzp-checker/README.md +45 -0
- package/tools/fzp-checker/check_fzp.py +48 -0
- package/tools/fzp-checker/pyproject.toml +26 -0
- package/tools/fzp-checker/uv.lock +266 -0
- package/tools/fzp-checker/vendor/LICENSE.txt +8 -0
- package/tools/fzp-checker/vendor/UPSTREAM.md +25 -0
- package/tools/fzp-checker/vendor/fzp_checker.py +14 -0
- package/tools/fzp-checker/vendor/scripts/checks/__init__.py +26 -0
- package/tools/fzp-checker/vendor/scripts/checks/check_missing_leg_ids.py +44 -0
- package/tools/fzp-checker/vendor/scripts/checks/checkascii.py +27 -0
- package/tools/fzp-checker/vendor/scripts/checks/checkcase.py +156 -0
- package/tools/fzp-checker/vendor/scripts/checks/checkcopies.py +104 -0
- package/tools/fzp-checker/vendor/scripts/checks/connector_numbering.py +79 -0
- package/tools/fzp-checker/vendor/scripts/checks/connectors_misnumbered.py +228 -0
- package/tools/fzp-checker/vendor/scripts/checks/explain_errors.md +95 -0
- package/tools/fzp-checker/vendor/scripts/checks/fzp_checker_runner.py +717 -0
- package/tools/fzp-checker/vendor/scripts/checks/fzp_checkers.py +1069 -0
- package/tools/fzp-checker/vendor/scripts/checks/fzp_svg_checkers.py +62 -0
- package/tools/fzp-checker/vendor/scripts/checks/fzp_utils.py +222 -0
- package/tools/fzp-checker/vendor/scripts/checks/inspector_fc51.png +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/invisibleconnectors.py +118 -0
- package/tools/fzp-checker/vendor/scripts/checks/nolayeridcheck.txt +758 -0
- package/tools/fzp-checker/vendor/scripts/checks/requirements.txt +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/svg_checkers.py +953 -0
- package/tools/fzp-checker/vendor/scripts/checks/svg_utils.py +96 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_checkers.py +839 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/author_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/author_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/buses_missing_id.fzp.test +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/buses_missing_node_members.fzp.test +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/buses_present_valid.fzp.test +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_layers_missing_attributes.fzp.test +16 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_layers_present_valid.fzp.test +14 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_numbering_invalid.fzp.test +70 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_numbering_valid.fzp.test +70 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/connector_refs_valid.fzp.test +53 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_mixed.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_silkscreen_nested.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_style_attr.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_white_stroke.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_invalid_wrong_color.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_inherited.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_legacy.fzp.test +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_nested_copper.fzp.test +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_none.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_standard.fzp.test +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/copper_color_valid_uppercase.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/css_connector.fzp.test +100 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/description_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/description_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/duplicate_ids.fzp.test +27 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/family_property_missing.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/family_property_present_valid.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/font_size.fzp.test +46 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/fritzing_version_invalid_format.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/fritzing_version_missing.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/fritzing_version_present_valid.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/gorn_absent.fzp.test +15 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/gorn_present.fzp.test +15 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/hybrid_connectors.fzp.test +232 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/invalid_xml.fzp.test +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/layer_ids_match.fzp.test +29 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/layer_ids_mismatch.fzp.test +30 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/layer_nesting_invalid.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/layer_nesting_valid.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/matrix_transform.fzp.test +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/missing_connector_refs.fzp.test +63 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/missing_leg_ids.fzp.test +34 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_missing.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_non_alnum.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_special_chars_absent.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_special_chars_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/module_id_too_short.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/no_layer_invalid.fzp.test +19 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/no_layer_namedview.fzp.test +19 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/no_layer_valid.fzp.test +19 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/pcb_only.fzp.test +48 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/property_fields_missing_name.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/property_fields_missing_value.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/property_fields_present.fzp.test +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/required_tags_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/required_tags_present.fzp.test +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/stroke_test.fzp.test +60 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/template_svgs.fzp.test +35 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/title_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/title_present.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/unique_ids.fzp.test +27 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/unique_property_names_duplicates.fzp.test +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/unique_property_names_unique.fzp.test +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/valid_xml.fzp.test +249 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/version_invalid_format.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/version_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/version_present_valid.fzp.test +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/views_missing.fzp.test +3 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/core/views_present.fzp.test +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/connector_refs_valid_breadboard.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/duplicate_ids_breadboard.svg +13 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/gorn_absent_breadboard.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/gorn_present_breadboard.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/hybrid_connectors_breadboard.svg +102 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/layer_nesting_invalid.svg +13 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/layer_nesting_valid.svg +13 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/matrix_transform.svg +11 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/missing_connector_refs_breadboard.svg +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/missing_leg_ids_breadboard.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/test_layer_ids_match_breadboard.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/test_layer_ids_mismatch_breadboard.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/breadboard/unique_ids_breadboard.svg +13 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/hybrid_connectors_icon.svg +78 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/no_layer_invalid.svg +4 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/no_layer_namedview.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/no_layer_valid.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/icon/plain_pcb.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/connector_refs_valid_pcb.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_mixed.svg +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_silkscreen_nested.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_style_attr.svg +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_white_stroke.svg +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_invalid_wrong_color.svg +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_inherited.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_legacy.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_nested_copper.svg +9 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_none.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_standard.svg +10 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/copper_color_valid_uppercase.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/css_connector.svg +25 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/font_size.svg +54 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/hybrid_connectors_pcb.svg +35 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/missing_connector_refs_pcb.svg +14 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/pcb-arduino-shield.svg +25 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/stroke_test.svg +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/test_layer_ids_match_pcb.svg +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/pcb/test_layer_ids_mismatch_pcb.svg +12 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/connector_refs_valid_schematic.svg +7 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/hybrid_connectors_schematic.svg +59 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/missing_connector_refs_schematic.svg +8 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/test_layer_ids_match_schematic.svg +6 -0
- package/tools/fzp-checker/vendor/scripts/checks/test_data/svg/core/schematic/test_layer_ids_mismatch_schematic.svg +6 -0
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* fritzkit MCP server (decision D3): the same verbs as the CLI, as tools, over one core.
|
|
3
|
+
* Every tool takes an optional `workspace`; every failure comes back as an isError result
|
|
4
|
+
* carrying the human message, never as an exception that would kill the server.
|
|
5
|
+
*
|
|
6
|
+
* stdio rule: nothing in here (or in the CLI command code it calls) writes to stdout;
|
|
7
|
+
* stdout belongs to JSON-RPC.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
11
|
+
import { dirname, join, resolve } from "node:path";
|
|
12
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
13
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
14
|
+
import { z } from "zod";
|
|
15
|
+
import { VIEWS } from "../core/compile/types.js";
|
|
16
|
+
import { resolvePart, ResolveError } from "../core/resolve.js";
|
|
17
|
+
import { parsePartSpec } from "../core/schema/part.js";
|
|
18
|
+
import { formatIssues, validateCompiled, validateSpecJson } from "../core/validate/index.js";
|
|
19
|
+
import { ASSETS_DIR, partDir, readPartJson, writePart } from "../core/workspace.js";
|
|
20
|
+
import { CliError, cliVersion, describeError, resolveTarget, SCHEMA_HINT, workspaceOf, } from "../cli/context.js";
|
|
21
|
+
import { doctorCommand } from "../cli/commands/doctor.js";
|
|
22
|
+
import { exportCommand, installCommand } from "../cli/commands/export.js";
|
|
23
|
+
import { importKicadCommand } from "../cli/commands/kicad.js";
|
|
24
|
+
import { initCommand, listCommand, newCommand } from "../cli/commands/parts.js";
|
|
25
|
+
import { pruneCommand } from "../cli/commands/prune.js";
|
|
26
|
+
import { loadSvgs } from "../cli/commands/render.js";
|
|
27
|
+
import { schemaCommand } from "../cli/commands/schema.js";
|
|
28
|
+
import { compileDir, validateCommand, warningIssues } from "../cli/commands/validate.js";
|
|
29
|
+
import { svgToPng } from "../cli/raster.js";
|
|
30
|
+
import { applyPatch } from "./jsonpatch.js";
|
|
31
|
+
function text(t, isError = false) {
|
|
32
|
+
return { content: [{ type: "text", text: t }], ...(isError ? { isError: true } : {}) };
|
|
33
|
+
}
|
|
34
|
+
function fromCommand(r, json = false) {
|
|
35
|
+
const body = json ? JSON.stringify(r.data, null, 2) : r.text;
|
|
36
|
+
return text(body, r.exitCode !== 0);
|
|
37
|
+
}
|
|
38
|
+
/** Run a handler; any throw becomes an isError result with the human message. */
|
|
39
|
+
async function guard(fn) {
|
|
40
|
+
try {
|
|
41
|
+
return await fn();
|
|
42
|
+
}
|
|
43
|
+
catch (e) {
|
|
44
|
+
return text(describeError(e).message, true);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function withWs(ctx, workspace) {
|
|
48
|
+
return workspace === undefined ? ctx : { ...ctx, workspace };
|
|
49
|
+
}
|
|
50
|
+
/** Resolve <part> to a part folder (a .fzpz is refused: it cannot be edited). */
|
|
51
|
+
async function folderOf(part, ctx) {
|
|
52
|
+
const t = await resolveTarget(part, ctx);
|
|
53
|
+
if (t.kind !== "dir")
|
|
54
|
+
throw new CliError(`${t.path} is a .fzpz; edit tools need a part folder`);
|
|
55
|
+
return t.dir;
|
|
56
|
+
}
|
|
57
|
+
/** Summary of the connectors the compiler will emit (ids include not-yet-persisted keys). */
|
|
58
|
+
export function connectorSummary(raw) {
|
|
59
|
+
const resolved = resolvePart(parsePartSpec(raw));
|
|
60
|
+
return {
|
|
61
|
+
connectors: resolved.connectors.map((c) => ({
|
|
62
|
+
key: c.key,
|
|
63
|
+
id: c.fzpId,
|
|
64
|
+
name: c.name,
|
|
65
|
+
role: c.role,
|
|
66
|
+
type: c.type,
|
|
67
|
+
source: c.source,
|
|
68
|
+
xMm: c.xMm,
|
|
69
|
+
yMm: c.yMm,
|
|
70
|
+
tht: c.tht,
|
|
71
|
+
})),
|
|
72
|
+
newPinKeys: resolved.newPinKeys,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Validate a whole spec, write it, then compile for structural issues. Rejected (nothing
|
|
77
|
+
* written) on schema or resolve errors. pinIds on disk survive a body that omits them.
|
|
78
|
+
*/
|
|
79
|
+
export async function saveSpec(dir, raw, ctx) {
|
|
80
|
+
const schemaIssues = validateSpecJson(raw);
|
|
81
|
+
if (schemaIssues.length > 0) {
|
|
82
|
+
return text(`not saved:\n${formatIssues(schemaIssues)}\n${SCHEMA_HINT}`, true);
|
|
83
|
+
}
|
|
84
|
+
let body = raw;
|
|
85
|
+
if (raw.pinIds === undefined && existsSync(join(dir, "part.json"))) {
|
|
86
|
+
const old = await readPartJson(dir).catch(() => undefined);
|
|
87
|
+
if (old?.pinIds)
|
|
88
|
+
body = { ...raw, pinIds: old.pinIds };
|
|
89
|
+
}
|
|
90
|
+
try {
|
|
91
|
+
resolvePart(parsePartSpec(body));
|
|
92
|
+
}
|
|
93
|
+
catch (e) {
|
|
94
|
+
if (e instanceof ResolveError)
|
|
95
|
+
return text(`not saved: ${e.path}: ${e.message}`, true);
|
|
96
|
+
throw e;
|
|
97
|
+
}
|
|
98
|
+
const file = await writePart(dir, body);
|
|
99
|
+
if (!existsSync(join(dir, ASSETS_DIR))) {
|
|
100
|
+
await mkdir(join(dir, ASSETS_DIR), { recursive: true });
|
|
101
|
+
await writeFile(join(dir, ASSETS_DIR, ".gitkeep"), "");
|
|
102
|
+
}
|
|
103
|
+
try {
|
|
104
|
+
const compiled = await compileDir(dir, ctx);
|
|
105
|
+
const issues = [...validateCompiled(compiled), ...warningIssues(compiled.warnings)];
|
|
106
|
+
return text(`saved ${file} (${compiled.identity.moduleId})\n${formatIssues(issues)}`);
|
|
107
|
+
}
|
|
108
|
+
catch (e) {
|
|
109
|
+
return text(`saved ${file}, but it does not compile: ${describeError(e).message}`, true);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const ws = z.string().optional().describe("workspace folder (default ~/fritzkit/parts)");
|
|
113
|
+
const partArg = z.string().describe("part slug in the workspace, a part folder, or a .fzpz path");
|
|
114
|
+
const viewArg = z.enum(VIEWS);
|
|
115
|
+
const patchOp = z.discriminatedUnion("op", [
|
|
116
|
+
z.object({ op: z.literal("add"), path: z.string(), value: z.unknown() }),
|
|
117
|
+
z.object({ op: z.literal("remove"), path: z.string() }),
|
|
118
|
+
z.object({ op: z.literal("replace"), path: z.string(), value: z.unknown() }),
|
|
119
|
+
z.object({ op: z.literal("test"), path: z.string(), value: z.unknown() }),
|
|
120
|
+
]);
|
|
121
|
+
const pinInput = z
|
|
122
|
+
.looseObject({
|
|
123
|
+
key: z.string(),
|
|
124
|
+
name: z.string(),
|
|
125
|
+
xMm: z.number(),
|
|
126
|
+
yMm: z.number(),
|
|
127
|
+
})
|
|
128
|
+
.describe("a part.json pins[] entry (role, type, label, description, pad optional)");
|
|
129
|
+
/** Build the server with every fritzkit tool registered. */
|
|
130
|
+
export function createServer(base = { env: process.env }) {
|
|
131
|
+
const server = new McpServer({ name: "fritzkit", version: cliVersion() });
|
|
132
|
+
server.registerTool("fritzkit_init_workspace", {
|
|
133
|
+
description: "Create the parts workspace folder; returns its path.",
|
|
134
|
+
inputSchema: { workspace: ws },
|
|
135
|
+
}, ({ workspace }) => guard(async () => fromCommand(await initCommand(withWs(base, workspace)))));
|
|
136
|
+
server.registerTool("fritzkit_list_parts", {
|
|
137
|
+
description: "List parts in the workspace (slug, title, folder).",
|
|
138
|
+
inputSchema: { workspace: ws },
|
|
139
|
+
}, ({ workspace }) => guard(async () => fromCommand(await listCommand(withWs(base, workspace)), true)));
|
|
140
|
+
server.registerTool("fritzkit_new_part", {
|
|
141
|
+
description: "Create <workspace>/<slug>/part.json from the minimal template.",
|
|
142
|
+
inputSchema: {
|
|
143
|
+
slug: z.string().describe("new part slug: 3-60 chars, lowercase letters, digits, -"),
|
|
144
|
+
title: z.string().optional().describe("part title (default: the slug)"),
|
|
145
|
+
workspace: ws,
|
|
146
|
+
},
|
|
147
|
+
}, ({ slug, title, workspace }) => guard(async () => fromCommand(await newCommand(slug, title === undefined ? {} : { title }, withWs(base, workspace)))));
|
|
148
|
+
server.registerTool("fritzkit_get_part", {
|
|
149
|
+
description: "Return part.json as written plus the resolved connectors (key, connector id, name, role, position).",
|
|
150
|
+
inputSchema: { part: partArg, workspace: ws },
|
|
151
|
+
}, ({ part, workspace }) => guard(async () => {
|
|
152
|
+
const ctx = withWs(base, workspace);
|
|
153
|
+
const dir = await folderOf(part, ctx);
|
|
154
|
+
const raw = await readPartJson(dir);
|
|
155
|
+
const issues = validateSpecJson(raw);
|
|
156
|
+
const out = { dir, part: raw };
|
|
157
|
+
if (issues.length > 0)
|
|
158
|
+
out.issues = issues;
|
|
159
|
+
else {
|
|
160
|
+
try {
|
|
161
|
+
Object.assign(out, connectorSummary(raw));
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
out.issues = [{ level: "error", code: "resolve", message: describeError(e).message }];
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return text(JSON.stringify(out, null, 2));
|
|
168
|
+
}));
|
|
169
|
+
server.registerTool("fritzkit_set_part", {
|
|
170
|
+
description: "Replace part.json with a whole spec (validated first; nothing is written if invalid). Creates the part if missing. Returns issues.",
|
|
171
|
+
inputSchema: {
|
|
172
|
+
part: z.string().describe("part slug in the workspace, or a part folder"),
|
|
173
|
+
json: z.record(z.string(), z.unknown()).describe("the complete part.json object"),
|
|
174
|
+
workspace: ws,
|
|
175
|
+
},
|
|
176
|
+
}, ({ part, json, workspace }) => guard(async () => {
|
|
177
|
+
const ctx = withWs(base, workspace);
|
|
178
|
+
let dir;
|
|
179
|
+
try {
|
|
180
|
+
dir = await folderOf(part, ctx);
|
|
181
|
+
}
|
|
182
|
+
catch (e) {
|
|
183
|
+
if (/[/\\]/.test(part) || /\.fzpz$/i.test(part))
|
|
184
|
+
throw e;
|
|
185
|
+
dir = partDir(workspaceOf(ctx), part);
|
|
186
|
+
}
|
|
187
|
+
const inWorkspace = resolve(dirname(dir)) === workspaceOf(ctx);
|
|
188
|
+
const slug = json.slug;
|
|
189
|
+
if (inWorkspace && slug !== undefined && slug !== dir.split(/[/\\]/).pop()) {
|
|
190
|
+
return text(`not saved: json.slug "${String(slug)}" does not match the part folder; create a new part to rename`, true);
|
|
191
|
+
}
|
|
192
|
+
return saveSpec(dir, json, ctx);
|
|
193
|
+
}));
|
|
194
|
+
server.registerTool("fritzkit_patch_part", {
|
|
195
|
+
description: "Apply an RFC 6902 JSON Patch (add/remove/replace/test, JSON pointer paths) to part.json; validated before writing.",
|
|
196
|
+
inputSchema: {
|
|
197
|
+
part: partArg,
|
|
198
|
+
patch: z
|
|
199
|
+
.array(patchOp)
|
|
200
|
+
.describe("RFC 6902 ops applied in order; paths are JSON pointers like /pins/0/xMm or /tags/-"),
|
|
201
|
+
workspace: ws,
|
|
202
|
+
},
|
|
203
|
+
}, ({ part, patch, workspace }) => guard(async () => {
|
|
204
|
+
const ctx = withWs(base, workspace);
|
|
205
|
+
const dir = await folderOf(part, ctx);
|
|
206
|
+
const raw = await readPartJson(dir);
|
|
207
|
+
const next = applyPatch(raw, patch);
|
|
208
|
+
return saveSpec(dir, next, ctx);
|
|
209
|
+
}));
|
|
210
|
+
server.registerTool("fritzkit_add_pins", {
|
|
211
|
+
description: "Append free pins (key, name, xMm, yMm in the part frame: origin top-left, y down) to part.json.",
|
|
212
|
+
inputSchema: {
|
|
213
|
+
part: partArg,
|
|
214
|
+
pins: z.array(pinInput).min(1).describe("pins to append to part.json pins[]"),
|
|
215
|
+
workspace: ws,
|
|
216
|
+
},
|
|
217
|
+
}, ({ part, pins, workspace }) => guard(async () => {
|
|
218
|
+
const ctx = withWs(base, workspace);
|
|
219
|
+
const dir = await folderOf(part, ctx);
|
|
220
|
+
const raw = await readPartJson(dir);
|
|
221
|
+
const next = { ...raw, pins: [...(raw.pins ?? []), ...pins] };
|
|
222
|
+
return saveSpec(dir, next, ctx);
|
|
223
|
+
}));
|
|
224
|
+
server.registerTool("fritzkit_validate", {
|
|
225
|
+
description: "Validate a part: schema, compile, structural checks; checker:true also runs Fritzing's fzp checker.",
|
|
226
|
+
inputSchema: {
|
|
227
|
+
part: partArg,
|
|
228
|
+
checker: z.boolean().optional().describe("also run Fritzing's fzp checker (needs uv)"),
|
|
229
|
+
workspace: ws,
|
|
230
|
+
},
|
|
231
|
+
}, ({ part, checker, workspace }) => guard(async () => {
|
|
232
|
+
const r = await validateCommand(part, { checker: checker === true }, withWs(base, workspace));
|
|
233
|
+
return text(r.text);
|
|
234
|
+
}));
|
|
235
|
+
server.registerTool("fritzkit_render", {
|
|
236
|
+
description: "Render one view. Returns the SVG text, or with png:true a PNG image you can look at.",
|
|
237
|
+
inputSchema: {
|
|
238
|
+
part: partArg,
|
|
239
|
+
view: viewArg.default("breadboard").describe("view to render (default breadboard)"),
|
|
240
|
+
png: z.boolean().optional().describe("return a PNG image instead of SVG text"),
|
|
241
|
+
dpi: z.number().int().min(30).max(600).optional().describe("PNG resolution (default 300)"),
|
|
242
|
+
workspace: ws,
|
|
243
|
+
},
|
|
244
|
+
}, ({ part, view, png, dpi, workspace }) => guard(async () => {
|
|
245
|
+
const loaded = await loadSvgs(part, withWs(base, workspace));
|
|
246
|
+
const svg = loaded.svgs[view];
|
|
247
|
+
if (svg === undefined)
|
|
248
|
+
throw new CliError(`the part has no ${view} view`);
|
|
249
|
+
const notes = loaded.warnings.map((w) => `warning: ${w}`);
|
|
250
|
+
if (!png)
|
|
251
|
+
return text([...notes, svg].join("\n"));
|
|
252
|
+
const bytes = await svgToPng(svg, dpi ?? 300);
|
|
253
|
+
return {
|
|
254
|
+
content: [
|
|
255
|
+
{
|
|
256
|
+
type: "text",
|
|
257
|
+
text: [`${loaded.moduleId} ${view} view`, ...notes].join("\n"),
|
|
258
|
+
},
|
|
259
|
+
{ type: "image", data: Buffer.from(bytes).toString("base64"), mimeType: "image/png" },
|
|
260
|
+
],
|
|
261
|
+
};
|
|
262
|
+
}));
|
|
263
|
+
server.registerTool("fritzkit_export", {
|
|
264
|
+
description: "Compile and write <partdir>/<moduleId>.fzpz (validator errors block unless force).",
|
|
265
|
+
inputSchema: {
|
|
266
|
+
part: partArg,
|
|
267
|
+
out: z.string().optional().describe("output .fzpz path"),
|
|
268
|
+
force: z.boolean().optional().describe("export even when the validator reports errors"),
|
|
269
|
+
workspace: ws,
|
|
270
|
+
},
|
|
271
|
+
}, ({ part, out, force, workspace }) => guard(async () => fromCommand(await exportCommand(part, { ...(out ? { out } : {}), force: force === true }, withWs(base, workspace)))));
|
|
272
|
+
server.registerTool("fritzkit_install", {
|
|
273
|
+
description: "Export and install the part into Fritzing's user parts folder. Refuses while Fritzing runs.",
|
|
274
|
+
inputSchema: {
|
|
275
|
+
part: partArg,
|
|
276
|
+
force: z.boolean().optional().describe("install even when the validator reports errors"),
|
|
277
|
+
workspace: ws,
|
|
278
|
+
},
|
|
279
|
+
}, ({ part, force, workspace }) => guard(async () => fromCommand(await installCommand(part, { force: force === true }, withWs(base, workspace)))));
|
|
280
|
+
server.registerTool("fritzkit_prune", {
|
|
281
|
+
description: "Remove older installed versions of a part family. Dry run (prints the plan) unless yes:true.",
|
|
282
|
+
inputSchema: {
|
|
283
|
+
family: z.string().describe("family name, or a workspace slug (uses its family)"),
|
|
284
|
+
keep: z.string().optional().describe("moduleId to keep (default: newest)"),
|
|
285
|
+
yes: z.boolean().optional().describe("actually delete (default: dry run)"),
|
|
286
|
+
workspace: ws,
|
|
287
|
+
},
|
|
288
|
+
}, ({ family, keep, yes, workspace }) => guard(async () => fromCommand(await pruneCommand(family, { ...(keep ? { keep } : {}), yes: yes === true }, withWs(base, workspace)))));
|
|
289
|
+
server.registerTool("fritzkit_import_kicad", {
|
|
290
|
+
description: "Create a new part folder from a KiCad .kicad_mod footprint (exact pad geometry).",
|
|
291
|
+
inputSchema: {
|
|
292
|
+
file: z.string().describe("path to the .kicad_mod file"),
|
|
293
|
+
slug: z.string().describe("slug of the new part"),
|
|
294
|
+
title: z.string().optional().describe("part title (default: the footprint name)"),
|
|
295
|
+
workspace: ws,
|
|
296
|
+
},
|
|
297
|
+
}, ({ file, slug, title, workspace }) => guard(async () => fromCommand(await importKicadCommand(file, { slug, ...(title ? { title } : {}) }, withWs(base, workspace)))));
|
|
298
|
+
server.registerTool("fritzkit_schema", { description: "Return the part.json JSON Schema.", inputSchema: { workspace: ws } }, () => guard(async () => fromCommand(await schemaCommand({}, base))));
|
|
299
|
+
server.registerTool("fritzkit_doctor", {
|
|
300
|
+
description: "Check Node, Fritzing, its folders, uv + the fzp checker and sharp.",
|
|
301
|
+
inputSchema: { workspace: ws },
|
|
302
|
+
}, () => guard(async () => text((await doctorCommand(base)).text)));
|
|
303
|
+
return server;
|
|
304
|
+
}
|
|
305
|
+
/** Serve on stdio until stdin closes (logs, if any, go to stderr). */
|
|
306
|
+
export async function startStdioServer(base = { env: process.env }) {
|
|
307
|
+
const server = createServer(base);
|
|
308
|
+
await server.connect(new StdioServerTransport());
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAa,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAsB,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACpF,OAAO,EACL,QAAQ,EACR,UAAU,EACV,aAAa,EACb,aAAa,EACb,WAAW,EACX,WAAW,GAGZ,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC1E,OAAO,EA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,YAAY,CACjB,iBAAiB,EACjB;QACE,WAAW,EAAE,oEAAoE;QACjF,WAAW,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE;KAC/B,EACD,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,MAAM,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAChE,CAAC;IAEF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,sEAAsE;AACtE,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,OAAuB,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;IAChF,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAClC,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import { type PartSpecInput } from "../core/schema/part.js";
|
|
3
|
+
import { type Issue } from "../core/validate/index.js";
|
|
4
|
+
import { type CommandContext } from "../cli/context.js";
|
|
5
|
+
import { EventHub } from "./events.js";
|
|
6
|
+
export declare const JSON_LIMIT: number;
|
|
7
|
+
export declare const ASSET_LIMIT: number;
|
|
8
|
+
/** Content type for serving an asset: a raster image type, or undefined (send as attachment). */
|
|
9
|
+
export declare function assetMimeOf(name: string): string | undefined;
|
|
10
|
+
/** Content type by file extension (application/octet-stream when unknown). */
|
|
11
|
+
export declare function mimeOf(name: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* An upload name is one safe path segment (no separators, no "..", no leading dot) with a
|
|
14
|
+
* raster image extension (png, jpg/jpeg, webp, gif, avif, tif/tiff), and not a Windows
|
|
15
|
+
* device name (con, nul, com1, ...).
|
|
16
|
+
*/
|
|
17
|
+
export declare function isSafeAssetName(name: string): boolean;
|
|
18
|
+
/** "assets/a/b.png" or "a/b.png" -> absolute path inside <dir>/assets, or undefined if unsafe. */
|
|
19
|
+
export declare function assetPath(dir: string, name: string): string | undefined;
|
|
20
|
+
export interface AssetInfo {
|
|
21
|
+
/** Spec-relative path, e.g. "assets/top.png". */
|
|
22
|
+
name: string;
|
|
23
|
+
size: number;
|
|
24
|
+
}
|
|
25
|
+
/** Files under <dir>/assets (dotfiles skipped), sorted, with sizes. */
|
|
26
|
+
export declare function listAssets(dir: string): Promise<AssetInfo[]>;
|
|
27
|
+
/** Issues with the human explanation attached (the validator panel shows it as is). */
|
|
28
|
+
export declare function withExplain(issues: readonly Issue[]): (Issue & {
|
|
29
|
+
explain: string;
|
|
30
|
+
})[];
|
|
31
|
+
/** What GET /api/parts/:slug returns. `valid: false` still carries the text for the Raw tab. */
|
|
32
|
+
export interface PartPayload {
|
|
33
|
+
slug: string;
|
|
34
|
+
dir: string;
|
|
35
|
+
/** part.json exactly as on disk. */
|
|
36
|
+
text: string;
|
|
37
|
+
hash: string;
|
|
38
|
+
/** Parsed JSON (null when the file is not JSON). */
|
|
39
|
+
raw: unknown;
|
|
40
|
+
valid: boolean;
|
|
41
|
+
issues: (Issue & {
|
|
42
|
+
explain: string;
|
|
43
|
+
})[];
|
|
44
|
+
/** With defaults applied (null when invalid). */
|
|
45
|
+
spec: unknown;
|
|
46
|
+
connectors: unknown[];
|
|
47
|
+
buses: unknown[];
|
|
48
|
+
frame: unknown;
|
|
49
|
+
/** pinIds after allocation (new keys included). */
|
|
50
|
+
pinIds: Record<string, number>;
|
|
51
|
+
assets: AssetInfo[];
|
|
52
|
+
}
|
|
53
|
+
/** Read a part folder into the payload the app works from. Never throws for a bad spec. */
|
|
54
|
+
export declare function partPayload(slug: string, dir: string): Promise<PartPayload>;
|
|
55
|
+
/**
|
|
56
|
+
* Validate a part.json body for PUT. Returns the raw object to write (with connector
|
|
57
|
+
* numbers for new keys merged into pinIds, D12a) or the issues.
|
|
58
|
+
*/
|
|
59
|
+
export declare function preparePut(slug: string, body: unknown): {
|
|
60
|
+
raw: PartSpecInput;
|
|
61
|
+
issues: [];
|
|
62
|
+
} | {
|
|
63
|
+
raw?: undefined;
|
|
64
|
+
issues: Issue[];
|
|
65
|
+
};
|
|
66
|
+
export interface ApiOptions {
|
|
67
|
+
workspace: string;
|
|
68
|
+
ctx: CommandContext;
|
|
69
|
+
hub: EventHub;
|
|
70
|
+
}
|
|
71
|
+
/** Build the /api request handler. Resolves once the response is written. */
|
|
72
|
+
export declare function apiHandler(opts: ApiOptions): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
|