fritzkit 0.0.0-stage → 0.1.0
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/__pycache__/__init__.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/check_missing_leg_ids.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/connector_numbering.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/fzp_checker_runner.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/fzp_checkers.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/fzp_svg_checkers.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/fzp_utils.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/svg_checkers.cpython-313.pyc +0 -0
- package/tools/fzp-checker/vendor/scripts/checks/__pycache__/svg_utils.cpython-313.pyc +0 -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,22 @@
|
|
|
1
|
+
import { type PartListing } from "../../core/workspace.js";
|
|
2
|
+
import type { PartSpecInput } from "../../core/schema/part.js";
|
|
3
|
+
import { type CommandContext, type CommandResult } from "../context.js";
|
|
4
|
+
export declare function initCommand(ctx: CommandContext): Promise<CommandResult<{
|
|
5
|
+
workspace: string;
|
|
6
|
+
}>>;
|
|
7
|
+
/** Write a new part folder: part.json + assets/.gitkeep. Refuses an existing folder. */
|
|
8
|
+
export declare function createPartFolder(dir: string, raw: PartSpecInput): Promise<{
|
|
9
|
+
dir: string;
|
|
10
|
+
partJson: string;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function newCommand(slug: string, opts: {
|
|
13
|
+
title?: string;
|
|
14
|
+
}, ctx: CommandContext): Promise<CommandResult<{
|
|
15
|
+
slug: string;
|
|
16
|
+
dir: string;
|
|
17
|
+
partJson: string;
|
|
18
|
+
}>>;
|
|
19
|
+
export declare function listCommand(ctx: CommandContext): Promise<CommandResult<{
|
|
20
|
+
workspace: string;
|
|
21
|
+
parts: PartListing[];
|
|
22
|
+
}>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/** `fritzkit init`, `fritzkit new <slug>` and `fritzkit list`. */
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { parsePartSpec } from "../../core/schema/part.js";
|
|
6
|
+
import { ASSETS_DIR, initWorkspace, listParts, newPartTemplate, partDir, writePart, } from "../../core/workspace.js";
|
|
7
|
+
import { CliError, workspaceOf } from "../context.js";
|
|
8
|
+
export async function initCommand(ctx) {
|
|
9
|
+
const workspace = await initWorkspace(workspaceOf(ctx));
|
|
10
|
+
return { exitCode: 0, text: workspace, data: { workspace } };
|
|
11
|
+
}
|
|
12
|
+
/** Write a new part folder: part.json + assets/.gitkeep. Refuses an existing folder. */
|
|
13
|
+
export async function createPartFolder(dir, raw) {
|
|
14
|
+
if (existsSync(dir)) {
|
|
15
|
+
throw new CliError(`${dir} already exists; pick another slug or edit that part`);
|
|
16
|
+
}
|
|
17
|
+
parsePartSpec(raw);
|
|
18
|
+
const partJson = await writePart(dir, raw);
|
|
19
|
+
await mkdir(join(dir, ASSETS_DIR), { recursive: true });
|
|
20
|
+
await writeFile(join(dir, ASSETS_DIR, ".gitkeep"), "");
|
|
21
|
+
return { dir, partJson };
|
|
22
|
+
}
|
|
23
|
+
export async function newCommand(slug, opts, ctx) {
|
|
24
|
+
const dir = partDir(workspaceOf(ctx), slug);
|
|
25
|
+
const { partJson } = await createPartFolder(dir, newPartTemplate(slug, opts.title ?? slug));
|
|
26
|
+
return {
|
|
27
|
+
exitCode: 0,
|
|
28
|
+
text: `created ${partJson}\nedit it, then run: fritzkit validate ${slug}`,
|
|
29
|
+
data: { slug, dir, partJson },
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export async function listCommand(ctx) {
|
|
33
|
+
const workspace = workspaceOf(ctx);
|
|
34
|
+
const parts = await listParts(workspace);
|
|
35
|
+
if (parts.length === 0) {
|
|
36
|
+
return {
|
|
37
|
+
exitCode: 0,
|
|
38
|
+
text: `no parts in ${workspace} (create one with: fritzkit new <slug>)`,
|
|
39
|
+
data: { workspace, parts },
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
const width = Math.max(...parts.map((p) => p.slug.length));
|
|
43
|
+
const text = parts.map((p) => `${p.slug.padEnd(width)} ${p.title}`).join("\n");
|
|
44
|
+
return { exitCode: 0, text, data: { workspace, parts } };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=parts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parts.js","source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AC,CAAC;IAChF,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CommandContext, type CommandResult } from "../context.js";
|
|
2
|
+
export interface PruneData {
|
|
3
|
+
family: string;
|
|
4
|
+
dryRun: boolean;
|
|
5
|
+
keep: string[];
|
|
6
|
+
remove: string[];
|
|
7
|
+
removedDirs: string[];
|
|
8
|
+
}
|
|
9
|
+
/** A workspace slug maps to its spec's family (default: the slug); anything else is a family. */
|
|
10
|
+
export declare function familyFor(arg: string, ctx: CommandContext): Promise<string>;
|
|
11
|
+
export declare function pruneCommand(arg: string, opts: {
|
|
12
|
+
keep?: string;
|
|
13
|
+
yes?: boolean;
|
|
14
|
+
}, ctx: CommandContext): Promise<CommandResult<PruneData>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** `fritzkit prune <family-or-slug> [--keep <moduleId>] [--yes]`: dry run unless --yes. */
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { FritzingRunningError } from "../../core/export/install.js";
|
|
5
|
+
import { listInstalledParts, prune, prunePlan, } from "../../core/export/prune.js";
|
|
6
|
+
import { SLUG_RE } from "../../core/schema/part.js";
|
|
7
|
+
import { PART_FILE, readPartJson } from "../../core/workspace.js";
|
|
8
|
+
import { CliError, EXIT_FRITZING_RUNNING, fritzingPathsFor, fritzingRunningMessage, isRunningOf, workspaceOf, } from "../context.js";
|
|
9
|
+
/** A workspace slug maps to its spec's family (default: the slug); anything else is a family. */
|
|
10
|
+
export async function familyFor(arg, ctx) {
|
|
11
|
+
const dir = join(workspaceOf(ctx), arg);
|
|
12
|
+
if (SLUG_RE.test(arg) && existsSync(join(dir, PART_FILE))) {
|
|
13
|
+
try {
|
|
14
|
+
const raw = await readPartJson(dir);
|
|
15
|
+
if (typeof raw.family === "string" && raw.family)
|
|
16
|
+
return raw.family;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
// fall through: treat the slug as the family
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return arg;
|
|
23
|
+
}
|
|
24
|
+
const describe = (p) => `${p.moduleId}${p.variant ? ` (${p.variant})` : ""}`;
|
|
25
|
+
export async function pruneCommand(arg, opts, ctx) {
|
|
26
|
+
const family = await familyFor(arg, ctx);
|
|
27
|
+
const paths = fritzingPathsFor(ctx.env);
|
|
28
|
+
const installed = await listInstalledParts(paths);
|
|
29
|
+
const plan = prunePlan(installed, { family, ...(opts.keep ? { keep: opts.keep } : {}) });
|
|
30
|
+
const data = {
|
|
31
|
+
family,
|
|
32
|
+
dryRun: !opts.yes,
|
|
33
|
+
keep: plan.keep.map((p) => p.moduleId),
|
|
34
|
+
remove: plan.remove.map((p) => p.moduleId),
|
|
35
|
+
removedDirs: [],
|
|
36
|
+
};
|
|
37
|
+
if (plan.keep.length === 0 && plan.remove.length === 0) {
|
|
38
|
+
return {
|
|
39
|
+
exitCode: 0,
|
|
40
|
+
text: `no installed parts of family "${family}" in ${paths.userPartsDir}`,
|
|
41
|
+
data,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const lines = [
|
|
45
|
+
...plan.keep.map((p) => `keep ${describe(p)}`),
|
|
46
|
+
...plan.remove.map((p) => `remove ${describe(p)} ${p.dir}`),
|
|
47
|
+
];
|
|
48
|
+
if (plan.remove.length === 0) {
|
|
49
|
+
lines.push("nothing to prune");
|
|
50
|
+
return { exitCode: 0, text: lines.join("\n"), data };
|
|
51
|
+
}
|
|
52
|
+
try {
|
|
53
|
+
const r = await prune(plan, { yes: opts.yes === true, paths, isRunning: isRunningOf(ctx) });
|
|
54
|
+
data.removedDirs = r.removedDirs;
|
|
55
|
+
lines.push(r.dryRun
|
|
56
|
+
? `dry run: ${plan.remove.length} folder(s) would be removed; pass --yes to delete`
|
|
57
|
+
: `removed ${r.removedDirs.length} folder(s)`);
|
|
58
|
+
}
|
|
59
|
+
catch (e) {
|
|
60
|
+
if (e instanceof FritzingRunningError) {
|
|
61
|
+
throw new CliError(fritzingRunningMessage("prune"), EXIT_FRITZING_RUNNING);
|
|
62
|
+
}
|
|
63
|
+
throw e;
|
|
64
|
+
}
|
|
65
|
+
return { exitCode: 0, text: lines.join("\n"), data };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=prune.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prune.js","sourceRoot":"","sources":["../../../src/cli/commands/prune.ts"],"names":[],"mappings":"AAAA,2FAA2F;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,EACL,kBAAkB,EAClB,KAAK,EACL,SAAS,GAEV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EACL,QAAQ,EACR,qBAAqB,EACrB,gBAAgB,EAChB,sBAAsB,EACtB,WAAW,EACX,WAAW,GAGZ,MAAM,eAAe,CAAC;AAUvB,iGAAiG;AACjG,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW,EAAE,GAAmB;IAC9D,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACxC,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC;YACpC,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AAE,CAAC;QACX,IAAI,CAAC,YAAY,oBAAoB,EAAE,CAAC;YACtC,MAAM,IAAI,QAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,EAAE,qBAAqB,CAAC,CAAC;QAC7E,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type View } from "../../core/compile/types.js";
|
|
2
|
+
import { type CommandContext, type CommandResult } from "../context.js";
|
|
3
|
+
export type ViewArg = View | "all";
|
|
4
|
+
export interface LoadedSvgs {
|
|
5
|
+
moduleId: string;
|
|
6
|
+
svgs: Partial<Record<View, string>>;
|
|
7
|
+
/** Default output folder: <partdir>/build (or build/ next to the .fzpz). */
|
|
8
|
+
buildDir: string;
|
|
9
|
+
warnings: string[];
|
|
10
|
+
}
|
|
11
|
+
/** Compile a part folder, or read the SVGs out of a .fzpz. */
|
|
12
|
+
export declare function loadSvgs(part: string, ctx: CommandContext): Promise<LoadedSvgs>;
|
|
13
|
+
export declare function parseView(view: string | undefined): ViewArg;
|
|
14
|
+
export interface RenderData {
|
|
15
|
+
moduleId: string;
|
|
16
|
+
files: string[];
|
|
17
|
+
warnings: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare function renderCommand(part: string, opts: {
|
|
20
|
+
view?: string;
|
|
21
|
+
out?: string;
|
|
22
|
+
png?: boolean;
|
|
23
|
+
dpi?: number;
|
|
24
|
+
}, ctx: CommandContext): Promise<CommandResult<RenderData>>;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/** `fritzkit render <part> [--view ...] [--out <dir>] [--png]`. */
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { VIEWS } from "../../core/compile/types.js";
|
|
4
|
+
import { writeFileAtomic } from "../../core/export/bin.js";
|
|
5
|
+
import { readFzpz } from "../../core/export/fzpz.js";
|
|
6
|
+
import { entriesToInput } from "../../core/validate/index.js";
|
|
7
|
+
import { CliError, cwdOf, resolveTarget, } from "../context.js";
|
|
8
|
+
import { svgToPng, DEFAULT_DPI } from "../raster.js";
|
|
9
|
+
import { compileDir } from "./validate.js";
|
|
10
|
+
/** Compile a part folder, or read the SVGs out of a .fzpz. */
|
|
11
|
+
export async function loadSvgs(part, ctx) {
|
|
12
|
+
const target = await resolveTarget(part, ctx);
|
|
13
|
+
if (target.kind === "fzpz") {
|
|
14
|
+
const contents = await readFzpz(target.path);
|
|
15
|
+
return {
|
|
16
|
+
moduleId: contents.moduleId,
|
|
17
|
+
svgs: entriesToInput(contents.entries).svgs,
|
|
18
|
+
buildDir: join(target.dir, "build"),
|
|
19
|
+
warnings: [],
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
const compiled = await compileDir(target.dir, ctx);
|
|
23
|
+
return {
|
|
24
|
+
moduleId: compiled.identity.moduleId,
|
|
25
|
+
svgs: compiled.svgs,
|
|
26
|
+
buildDir: join(target.dir, "build"),
|
|
27
|
+
warnings: compiled.warnings,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
export function parseView(view) {
|
|
31
|
+
const v = view ?? "all";
|
|
32
|
+
if (v === "all" || VIEWS.includes(v))
|
|
33
|
+
return v;
|
|
34
|
+
throw new CliError(`unknown view "${v}"; use one of ${[...VIEWS, "all"].join(", ")}`);
|
|
35
|
+
}
|
|
36
|
+
export async function renderCommand(part, opts, ctx) {
|
|
37
|
+
const view = parseView(opts.view);
|
|
38
|
+
const loaded = await loadSvgs(part, ctx);
|
|
39
|
+
const outDir = opts.out ? resolve(cwdOf(ctx), opts.out) : loaded.buildDir;
|
|
40
|
+
const views = view === "all" ? VIEWS : [view];
|
|
41
|
+
const files = [];
|
|
42
|
+
for (const v of views) {
|
|
43
|
+
const svg = loaded.svgs[v];
|
|
44
|
+
if (svg === undefined)
|
|
45
|
+
throw new CliError(`the part has no ${v} view`);
|
|
46
|
+
const svgPath = join(outDir, `${v}.svg`);
|
|
47
|
+
await writeFileAtomic(svgPath, svg);
|
|
48
|
+
files.push(svgPath);
|
|
49
|
+
if (opts.png) {
|
|
50
|
+
const pngPath = join(outDir, `${v}.png`);
|
|
51
|
+
await writeFileAtomic(pngPath, await svgToPng(svg, opts.dpi ?? DEFAULT_DPI));
|
|
52
|
+
files.push(pngPath);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const text = [...loaded.warnings.map((w) => `warning: ${w}`), ...files].join("\n");
|
|
56
|
+
return {
|
|
57
|
+
exitCode: 0,
|
|
58
|
+
text,
|
|
59
|
+
data: { moduleId: loaded.moduleId, files, warnings: loaded.warnings },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=render.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render.js","sourceRoot":"","sources":["../../../src/cli/commands/render.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAa,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EACL,QAAQ,EACR,KAAK,EACL,aAAa,GAGd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAY3C,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,GAAmB;IAC9D,MAAM,MAAM,GAAG,MAAM,aAAa,CAAC,IAAI,EAAE,GA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ACL,QAAQ,EAAE,CAAC;QACX,IAAI;QACJ,IAAI,EAAE,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE;KACtE,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type CommandContext, type CommandResult } from "../context.js";
|
|
2
|
+
/**
|
|
3
|
+
* Locate part.schema.json relative to this module: src/cli/commands -> src/core/schema in
|
|
4
|
+
* a checkout, dist/cli/commands -> dist/core/schema after `npm run build`.
|
|
5
|
+
*/
|
|
6
|
+
export declare function schemaPath(base?: string | URL): string;
|
|
7
|
+
export declare function readSchemaText(): Promise<string>;
|
|
8
|
+
export declare function schemaCommand(opts: {
|
|
9
|
+
out?: string;
|
|
10
|
+
}, ctx: CommandContext): Promise<CommandResult<unknown>>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/** `fritzkit schema [--out <file>]`: the published JSON Schema for part.json. */
|
|
2
|
+
import { existsSync } from "node:fs";
|
|
3
|
+
import { readFile } from "node:fs/promises";
|
|
4
|
+
import { resolve } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { writeFileAtomic } from "../../core/export/bin.js";
|
|
7
|
+
import { CliError, cwdOf } from "../context.js";
|
|
8
|
+
/**
|
|
9
|
+
* Locate part.schema.json relative to this module: src/cli/commands -> src/core/schema in
|
|
10
|
+
* a checkout, dist/cli/commands -> dist/core/schema after `npm run build`.
|
|
11
|
+
*/
|
|
12
|
+
export function schemaPath(base = import.meta.url) {
|
|
13
|
+
const candidates = [
|
|
14
|
+
new URL("../../core/schema/part.schema.json", base),
|
|
15
|
+
new URL("../../../src/core/schema/part.schema.json", base),
|
|
16
|
+
].map((u) => fileURLToPath(u));
|
|
17
|
+
const found = candidates.find((p) => existsSync(p));
|
|
18
|
+
if (!found)
|
|
19
|
+
throw new CliError(`part.schema.json not found (looked in ${candidates.join(", ")})`);
|
|
20
|
+
return found;
|
|
21
|
+
}
|
|
22
|
+
export async function readSchemaText() {
|
|
23
|
+
return readFile(schemaPath(), "utf8");
|
|
24
|
+
}
|
|
25
|
+
export async function schemaCommand(opts, ctx) {
|
|
26
|
+
const text = await readSchemaText();
|
|
27
|
+
const data = JSON.parse(text);
|
|
28
|
+
if (opts.out) {
|
|
29
|
+
const out = resolve(cwdOf(ctx), opts.out);
|
|
30
|
+
await writeFileAtomic(out, text);
|
|
31
|
+
return { exitCode: 0, text: `wrote ${out}`, data: { path: out } };
|
|
32
|
+
}
|
|
33
|
+
return { exitCode: 0, text: text.replace(/\n$/, ""), data };
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/cli/commands/schema.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,KAAK,EAA2C,MAAM,eAAe,CAAC;AAEzF;;;GAGG;AACH,MAAM,UAAU,UAAU,CAAC,OAAqB,MAAM,CAAC,IAAI,CAAC,GAAG;IAC7D,MAAM,UAAU,GAAG;QACjB,IAAI,GAAG,CAAC,oCAAoC,EAAE,IAAI,CAAC;QACnD,IAAI,GAAG,CAAC,2CAA2C,EAAE,IAAI,CAAC;KAC3D,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/B,MAAM,KAAK,GAAG,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC;IACpD,IAAI,CAAC,KAAK;QAAE,MAAM,IAAI,QAAQ,CAAC,yCAAyC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClG,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,OAAO,QAAQ,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAsB,EACtB,GAAmB;IAEnB,MAAM,IAAI,GAAG,MAAM,cAAc,EAAE,CAAC;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAY,CAAC;IACzC,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1C,MAAM,eAAe,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QACjC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,GAAG,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type CommandContext, type CommandResult } from "../context.js";
|
|
2
|
+
export interface UiData {
|
|
3
|
+
url: string;
|
|
4
|
+
port: number;
|
|
5
|
+
workspace: string;
|
|
6
|
+
slug?: string;
|
|
7
|
+
uiDir: string;
|
|
8
|
+
}
|
|
9
|
+
/** Parse --port: an integer 0-65535 (0 = any free port). */
|
|
10
|
+
export declare function parsePort(port: string | undefined): number | undefined;
|
|
11
|
+
export declare function uiCommand(part: string | undefined, opts: {
|
|
12
|
+
port?: string;
|
|
13
|
+
open?: boolean;
|
|
14
|
+
}, ctx: CommandContext, launch?: (url: string) => void): Promise<CommandResult<UiData | Record<string, never>>>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `fritzkit ui [part] [--port <n>] [--no-open]`: start the local part editor (spec D15/D16).
|
|
3
|
+
* The server lives in src/server; this verb only parses options, checks the app is
|
|
4
|
+
* built, starts it and prints the URL. The listening socket keeps the process alive until
|
|
5
|
+
* Ctrl+C (main.ts sets process.exitCode and never calls process.exit).
|
|
6
|
+
*/
|
|
7
|
+
import { dirname, resolve } from "node:path";
|
|
8
|
+
import { appUrl, defaultUiDir, DEFAULT_PORT, hasBuiltUi, openBrowser, startUi, } from "../../server/index.js";
|
|
9
|
+
import { CliError, EXIT_NOT_IMPLEMENTED, resolveTarget, workspaceOf, } from "../context.js";
|
|
10
|
+
/** Parse --port: an integer 0-65535 (0 = any free port). */
|
|
11
|
+
export function parsePort(port) {
|
|
12
|
+
if (port === undefined)
|
|
13
|
+
return undefined;
|
|
14
|
+
const n = Number(port);
|
|
15
|
+
if (!/^\d+$/.test(port.trim()) || !Number.isInteger(n) || n < 0 || n > 65535) {
|
|
16
|
+
throw new CliError(`--port must be an integer from 0 to 65535 (got "${port}")`);
|
|
17
|
+
}
|
|
18
|
+
return n;
|
|
19
|
+
}
|
|
20
|
+
export async function uiCommand(part, opts, ctx, launch = openBrowser) {
|
|
21
|
+
const port = parsePort(opts.port);
|
|
22
|
+
const uiDir = resolve(ctx.env.FRITZKIT_UI_DIST ?? defaultUiDir());
|
|
23
|
+
if (!hasBuiltUi(uiDir)) {
|
|
24
|
+
return {
|
|
25
|
+
exitCode: EXIT_NOT_IMPLEMENTED,
|
|
26
|
+
text: [
|
|
27
|
+
`fritzkit ui: the editor app is not built (no index.html in ${uiDir}).`,
|
|
28
|
+
"From a fritzkit checkout run `npm run ui:build` (or `npm run build`) and try again,",
|
|
29
|
+
"or run `npm run ui:dev` for the hot-reloading dev server (it serves the API too;",
|
|
30
|
+
"set FRITZKIT_WORKSPACE to choose the workspace).",
|
|
31
|
+
].join("\n"),
|
|
32
|
+
data: {},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
let workspace = workspaceOf(ctx);
|
|
36
|
+
let slug;
|
|
37
|
+
if (part !== undefined) {
|
|
38
|
+
const t = await resolveTarget(part, ctx);
|
|
39
|
+
if (t.kind === "fzpz") {
|
|
40
|
+
throw new CliError(`${t.path} is a .fzpz; fritzkit ui edits part folders (part.json)`);
|
|
41
|
+
}
|
|
42
|
+
slug = t.slug;
|
|
43
|
+
if (resolve(dirname(t.dir)) !== resolve(workspace))
|
|
44
|
+
workspace = dirname(t.dir);
|
|
45
|
+
}
|
|
46
|
+
const ui = await startUi({
|
|
47
|
+
ctx,
|
|
48
|
+
workspace,
|
|
49
|
+
uiDir,
|
|
50
|
+
port: port ?? DEFAULT_PORT,
|
|
51
|
+
strictPort: port !== undefined,
|
|
52
|
+
});
|
|
53
|
+
const url = appUrl(ui.port, slug);
|
|
54
|
+
const lines = [`fritzkit ui: editing ${workspace}`, ` ${url}`];
|
|
55
|
+
if (opts.open === false) {
|
|
56
|
+
lines.push("open that URL in your browser; press Ctrl+C to stop");
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
launch(url);
|
|
60
|
+
lines.push("opened in your browser; press Ctrl+C to stop");
|
|
61
|
+
}
|
|
62
|
+
const data = { url, port: ui.port, workspace, uiDir };
|
|
63
|
+
if (slug !== undefined)
|
|
64
|
+
data.slug = slug;
|
|
65
|
+
return { exitCode: 0, text: lines.join("\n"), data };
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=ui.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../src/cli/commands/ui.ts"],"names":[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AAC;IAC9D,IAAI,IAAI,KAAK,SAAS;QAAE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACzC,OAAO,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;AACvD,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type CheckerResult, type Issue } from "../../core/validate/index.js";
|
|
2
|
+
import { type CompileFromDirResult } from "../../core/workspace.js";
|
|
3
|
+
import { type CommandContext, type CommandResult } from "../context.js";
|
|
4
|
+
export interface ValidateData {
|
|
5
|
+
target: string;
|
|
6
|
+
ok: boolean;
|
|
7
|
+
moduleId?: string;
|
|
8
|
+
issues: Issue[];
|
|
9
|
+
checker?: Pick<CheckerResult, "available" | "exitCode" | "errors" | "warnings"> & {
|
|
10
|
+
/** true when the Fritzing checker actually ran; false when it was skipped. */
|
|
11
|
+
ran: boolean;
|
|
12
|
+
/** The one-line status printed by the CLI. */
|
|
13
|
+
summary: string;
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
/** One-line status of the Fritzing checker run. */
|
|
17
|
+
export declare function checkerSummary(r: CheckerResult): string;
|
|
18
|
+
/** Compile warnings ("photo asset missing ...") as warning issues. */
|
|
19
|
+
export declare function warningIssues(warnings: readonly string[]): Issue[];
|
|
20
|
+
/** Compile a part folder with the context's date. */
|
|
21
|
+
export declare function compileDir(dir: string, ctx: CommandContext): Promise<CompileFromDirResult>;
|
|
22
|
+
export declare function validateCommand(part: string, opts: {
|
|
23
|
+
checker?: boolean;
|
|
24
|
+
}, ctx: CommandContext): Promise<CommandResult<ValidateData>>;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** `fritzkit validate <part> [--checker]`: schema -> compile -> structural -> fzp checker. */
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { writeFzpz } from "../../core/export/fzpz.js";
|
|
4
|
+
import { formatIssues, runFzpChecker, validateCompiled, validateFzpzFile, validateSpecJson, } from "../../core/validate/index.js";
|
|
5
|
+
import { compileFromDir, readPartJson } from "../../core/workspace.js";
|
|
6
|
+
import { dateOf, resolveTarget, SCHEMA_HINT, } from "../context.js";
|
|
7
|
+
/** One-line status of the Fritzing checker run. */
|
|
8
|
+
export function checkerSummary(r) {
|
|
9
|
+
if (!r.available) {
|
|
10
|
+
return `fzp checker: skipped - ${r.errors[0] ?? "not available"}`;
|
|
11
|
+
}
|
|
12
|
+
return `fzp checker: ran (${r.errors.length} errors, ${r.warnings.length} warnings)`;
|
|
13
|
+
}
|
|
14
|
+
/** Compile warnings ("photo asset missing ...") as warning issues. */
|
|
15
|
+
export function warningIssues(warnings) {
|
|
16
|
+
return warnings.map((message) => ({ level: "warning", code: "compile", message }));
|
|
17
|
+
}
|
|
18
|
+
/** Compile a part folder with the context's date. */
|
|
19
|
+
export function compileDir(dir, ctx) {
|
|
20
|
+
return compileFromDir(dir, { date: dateOf(ctx) });
|
|
21
|
+
}
|
|
22
|
+
function checkerIssues(r) {
|
|
23
|
+
if (!r.available) {
|
|
24
|
+
return [
|
|
25
|
+
{
|
|
26
|
+
level: "warning",
|
|
27
|
+
code: "fzp-checker-unavailable",
|
|
28
|
+
message: r.errors[0] ?? "the fzp checker is not available",
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
}
|
|
32
|
+
return [
|
|
33
|
+
...r.errors.map((message) => ({ level: "error", code: "fzp-checker", message })),
|
|
34
|
+
...r.warnings.map((message) => ({ level: "warning", code: "fzp-checker", message })),
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
export async function validateCommand(part, opts, ctx) {
|
|
38
|
+
const target = await resolveTarget(part, ctx);
|
|
39
|
+
const issues = [];
|
|
40
|
+
let moduleId;
|
|
41
|
+
let fzpzPath;
|
|
42
|
+
let label;
|
|
43
|
+
if (target.kind === "fzpz") {
|
|
44
|
+
label = target.path;
|
|
45
|
+
fzpzPath = target.path;
|
|
46
|
+
issues.push(...validateFzpzFile(target.path));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
label = target.dir;
|
|
50
|
+
const raw = await readPartJson(target.dir);
|
|
51
|
+
const specIssues = validateSpecJson(raw);
|
|
52
|
+
if (specIssues.length > 0) {
|
|
53
|
+
return {
|
|
54
|
+
exitCode: 1,
|
|
55
|
+
text: `${formatIssues(specIssues)}\n${SCHEMA_HINT}`,
|
|
56
|
+
data: { target: label, ok: false, issues: specIssues },
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const compiled = await compileDir(target.dir, ctx);
|
|
60
|
+
moduleId = compiled.identity.moduleId;
|
|
61
|
+
issues.push(...validateCompiled(compiled), ...warningIssues(compiled.warnings));
|
|
62
|
+
fzpzPath = join(target.dir, "build", `${moduleId}.fzpz`);
|
|
63
|
+
if (opts.checker)
|
|
64
|
+
await writeFzpz(compiled, fzpzPath);
|
|
65
|
+
}
|
|
66
|
+
let checker;
|
|
67
|
+
if (opts.checker) {
|
|
68
|
+
const r = await (ctx.runChecker ?? runFzpChecker)(fzpzPath);
|
|
69
|
+
checker = {
|
|
70
|
+
available: r.available,
|
|
71
|
+
exitCode: r.exitCode,
|
|
72
|
+
errors: r.errors,
|
|
73
|
+
warnings: r.warnings,
|
|
74
|
+
ran: r.available,
|
|
75
|
+
summary: checkerSummary(r),
|
|
76
|
+
};
|
|
77
|
+
issues.push(...checkerIssues(r));
|
|
78
|
+
}
|
|
79
|
+
const ok = !issues.some((i) => i.level === "error");
|
|
80
|
+
const head = moduleId ? `${label} (${moduleId})` : label;
|
|
81
|
+
const data = { target: label, ok, issues };
|
|
82
|
+
if (moduleId)
|
|
83
|
+
data.moduleId = moduleId;
|
|
84
|
+
if (checker)
|
|
85
|
+
data.checker = checker;
|
|
86
|
+
const lines = [head, formatIssues(issues)];
|
|
87
|
+
if (checker)
|
|
88
|
+
lines.push(checker.summary);
|
|
89
|
+
return { exitCode: ok ? 0 : 1, text: lines.join("\n"), data };
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/cli/commands/validate.ts"],"names":[],"mappings":"AAAA,8FAA8F;AAC9F,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,GAGjB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,YAAY,EAA6B,MAAM,yBAAyB,CAAC;AAClG,OAAO,EACL,MAAM,EACN,aAAa,EACb,WAAW,GAGZ,MAAM,eAAe,CAAC;AAevB,mDAAmD;AACnD,MAAM,UAAU,cAAc,CAAC,CAAgB;IAC7C,IAAI,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC;QACjB,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,eAAe,EAAE,CAAC;IACpE,CAAC;IACD,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,MAAM,YAAY,CAAC,CAAC,QAAQ,CAAC,MAAM,YAAY,CAAC;AACvF,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,aAAa,CAAC,QAA2B;IACvD,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,UAAU,CAAC,GAAW,EAAE,GAAmB;IACzD,OAAO,cAAc,CAAC,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;AACpD,CAAC;AAED,SAAS,aAAa,CAAC,CAAgB;IACrC,IAAI,C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,CAAC,CAAC,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,QAAQ,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;IACzD,MAAM,IAAI,GAAiB,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC;IACzD,IAAI,QAAQ;QAAE,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IACvC,IAAI,OAAO;QAAE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACpC,MAAM,KAAK,GAAG,CAAC,IAAI,EAAE,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3C,IAAI,OAAO;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,OAAO,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC;AAChE,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { type FritzingPaths } from "../core/fritzing.js";
|
|
2
|
+
import type { CheckerOptions, CheckerResult, DoctorOptions } from "../core/validate/index.js";
|
|
3
|
+
export declare const EXIT_OK = 0;
|
|
4
|
+
export declare const EXIT_ERROR = 1;
|
|
5
|
+
export declare const EXIT_NOT_IMPLEMENTED = 2;
|
|
6
|
+
export declare const EXIT_FRITZING_RUNNING = 3;
|
|
7
|
+
export declare const SCHEMA_HINT = "run `fritzkit schema` for the format";
|
|
8
|
+
export interface CommandContext {
|
|
9
|
+
env: NodeJS.ProcessEnv;
|
|
10
|
+
/** Base for relative paths (default process.cwd()). */
|
|
11
|
+
cwd?: string;
|
|
12
|
+
/** --workspace flag (wins over FRITZKIT_WORKSPACE). */
|
|
13
|
+
workspace?: string;
|
|
14
|
+
/** ISO date written into the fzp; default today. Fixed in tests. */
|
|
15
|
+
date?: string;
|
|
16
|
+
/** Injected for tests; defaults to isFritzingRunning. */
|
|
17
|
+
isRunning?: () => Promise<boolean>;
|
|
18
|
+
/** Injected for tests (e.g. skipLxml, a bogus uvPath). */
|
|
19
|
+
doctorOptions?: Omit<DoctorOptions, "env">;
|
|
20
|
+
/** Injected for tests; defaults to runFzpChecker. */
|
|
21
|
+
runChecker?: (fzpzPath: string, opts?: CheckerOptions) => Promise<CheckerResult>;
|
|
22
|
+
}
|
|
23
|
+
export interface CommandResult<T = unknown> {
|
|
24
|
+
exitCode: number;
|
|
25
|
+
/** Human-readable output (no trailing newline). */
|
|
26
|
+
text: string;
|
|
27
|
+
/** Machine-readable output for --json and the MCP server. */
|
|
28
|
+
data: T;
|
|
29
|
+
}
|
|
30
|
+
export declare class CliError extends Error {
|
|
31
|
+
readonly exitCode: number;
|
|
32
|
+
constructor(message: string, exitCode?: number);
|
|
33
|
+
}
|
|
34
|
+
export declare class NotImplementedError extends CliError {
|
|
35
|
+
constructor(message: string);
|
|
36
|
+
}
|
|
37
|
+
interface ZodLikeIssue {
|
|
38
|
+
path: PropertyKey[];
|
|
39
|
+
message: string;
|
|
40
|
+
}
|
|
41
|
+
/** Duck-typed ZodError check (works across zod copies). */
|
|
42
|
+
export declare function isZodError(e: unknown): e is Error & {
|
|
43
|
+
issues: ZodLikeIssue[];
|
|
44
|
+
};
|
|
45
|
+
/** One line per zod issue (" path: message") plus the schema hint. */
|
|
46
|
+
export declare function formatZodIssues(issues: readonly ZodLikeIssue[]): string;
|
|
47
|
+
/** Map any thrown value to an exit code and a human message. */
|
|
48
|
+
export declare function describeError(e: unknown): {
|
|
49
|
+
exitCode: number;
|
|
50
|
+
message: string;
|
|
51
|
+
};
|
|
52
|
+
export declare function fritzingRunningMessage(action?: string): string;
|
|
53
|
+
export declare function cwdOf(ctx: CommandContext): string;
|
|
54
|
+
export declare function workspaceOf(ctx: CommandContext): string;
|
|
55
|
+
export declare function isRunningOf(ctx: CommandContext): () => Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* fritzingPaths(env) with test/CI overrides: FRITZKIT_FRITZING_USER_PARTS replaces the
|
|
58
|
+
* user parts folder, FRITZKIT_FRITZING_BINS the bins folder (my_parts.fzb inside it).
|
|
59
|
+
*/
|
|
60
|
+
export declare function fritzingPathsFor(env: NodeJS.ProcessEnv): FritzingPaths;
|
|
61
|
+
export type Target = {
|
|
62
|
+
kind: "dir";
|
|
63
|
+
dir: string;
|
|
64
|
+
slug: string;
|
|
65
|
+
} | {
|
|
66
|
+
kind: "fzpz";
|
|
67
|
+
path: string;
|
|
68
|
+
dir: string;
|
|
69
|
+
};
|
|
70
|
+
/** "Unknown part" error that lists what the workspace holds. */
|
|
71
|
+
export declare function unknownPart(part: string, workspace: string): Promise<CliError>;
|
|
72
|
+
/**
|
|
73
|
+
* Resolve a <part> argument: a slug in the workspace, a part folder (or its part.json),
|
|
74
|
+
* or a .fzpz file. Slugs win over same-named folders in the current directory.
|
|
75
|
+
*/
|
|
76
|
+
export declare function resolveTarget(part: string, ctx: CommandContext): Promise<Target>;
|
|
77
|
+
/** Today's date (YYYY-MM-DD) unless the context fixes one. */
|
|
78
|
+
export declare function dateOf(ctx: CommandContext): string;
|
|
79
|
+
/** package.json version (same relative path from src/cli and dist/cli). */
|
|
80
|
+
export declare function cliVersion(url?: string | URL): string;
|
|
81
|
+
export {};
|