mfcli 0.2.2__tar.gz → 0.2.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. {mfcli-0.2.2 → mfcli-0.2.4}/PKG-INFO +1 -1
  2. mfcli-0.2.4/mfcli/__init__.py +14 -0
  3. mfcli-0.2.4/mfcli/alembic/versions/f1234567890a_make_bom_description_nullable.py +36 -0
  4. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/cli/main.py +12 -1
  5. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/constants/file_types.py +10 -0
  6. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/bom.py +2 -2
  7. mfcli-0.2.4/mfcli/models/schematic_cheatsheet.py +121 -0
  8. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/generator.py +3 -1
  9. mfcli-0.2.4/mfcli/pipeline/analysis/generators/schematic/__init__.py +1 -0
  10. mfcli-0.2.4/mfcli/pipeline/analysis/generators/schematic/instructions.py +257 -0
  11. mfcli-0.2.4/mfcli/pipeline/analysis/generators/schematic/schematic.py +170 -0
  12. mfcli-0.2.4/mfcli/utils/data_cleaner.py +222 -0
  13. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli.egg-info/SOURCES.txt +5 -0
  14. {mfcli-0.2.2 → mfcli-0.2.4}/pyproject.toml +1 -1
  15. mfcli-0.2.2/mfcli/utils/__init__.py +0 -0
  16. mfcli-0.2.2/mfcli/utils/data_cleaner.py +0 -114
  17. {mfcli-0.2.2 → mfcli-0.2.4}/BUILD.md +0 -0
  18. {mfcli-0.2.2 → mfcli-0.2.4}/CONFIGURATION.md +0 -0
  19. {mfcli-0.2.2 → mfcli-0.2.4}/INSTALL.md +0 -0
  20. {mfcli-0.2.2 → mfcli-0.2.4}/LICENSE +0 -0
  21. {mfcli-0.2.2 → mfcli-0.2.4}/MANIFEST.in +0 -0
  22. {mfcli-0.2.2 → mfcli-0.2.4}/MCP_SETUP.md +0 -0
  23. {mfcli-0.2.2 → mfcli-0.2.4}/README.md +0 -0
  24. {mfcli-0.2.2 → mfcli-0.2.4}/install.ps1 +0 -0
  25. {mfcli-0.2.2 → mfcli-0.2.4}/install.sh +0 -0
  26. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/.env.example +0 -0
  27. {mfcli-0.2.2/mfcli → mfcli-0.2.4/mfcli/agents}/__init__.py +0 -0
  28. {mfcli-0.2.2/mfcli/agents → mfcli-0.2.4/mfcli/agents/controller}/__init__.py +0 -0
  29. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/agents/controller/agent.py +0 -0
  30. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/agents/controller/config.yaml +0 -0
  31. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/agents/controller/tools.py +0 -0
  32. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/agents/tools/general.py +0 -0
  33. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic/env.py +0 -0
  34. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic/script.py.mako +0 -0
  35. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic/versions/6ccc0c7c397c_added_fields_to_pdf_parts_model.py +0 -0
  36. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic/versions/769019ef4870_added_gemini_file_path_to_pdf_part_model.py +0 -0
  37. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic/versions/7a2e3a779fdc_added_functional_block_and_component_.py +0 -0
  38. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic/versions/7d5adb2a47a7_added_pdf_parts_model.py +0 -0
  39. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic/versions/7fcb7d6a5836_init.py +0 -0
  40. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic/versions/e0f2b5765c72_added_cascade_delete_for_models_that_.py +0 -0
  41. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/alembic.ini +0 -0
  42. {mfcli-0.2.2/mfcli/agents/controller → mfcli-0.2.4/mfcli/cli}/__init__.py +0 -0
  43. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/cli/dependencies.py +0 -0
  44. {mfcli-0.2.2/mfcli/cli → mfcli-0.2.4/mfcli/client}/__init__.py +0 -0
  45. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/client/chroma_db.py +0 -0
  46. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/client/docling.py +0 -0
  47. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/client/gemini.py +0 -0
  48. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/client/llama_parse.py +0 -0
  49. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/client/vector_db.py +0 -0
  50. {mfcli-0.2.2/mfcli/client → mfcli-0.2.4/mfcli/constants}/__init__.py +0 -0
  51. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/constants/base_enum.py +0 -0
  52. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/constants/directory_names.py +0 -0
  53. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/constants/gemini.py +0 -0
  54. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/constants/openai.py +0 -0
  55. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/constants/pipeline_run_status.py +0 -0
  56. {mfcli-0.2.2/mfcli/constants → mfcli-0.2.4/mfcli/crud}/__init__.py +0 -0
  57. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/crud/file.py +0 -0
  58. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/crud/functional_blocks.py +0 -0
  59. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/crud/netlist.py +0 -0
  60. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/crud/pipeline_run.py +0 -0
  61. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/crud/project.py +0 -0
  62. {mfcli-0.2.2/mfcli/crud → mfcli-0.2.4/mfcli/digikey}/__init__.py +0 -0
  63. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/digikey/digikey.py +0 -0
  64. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/main.py +0 -0
  65. {mfcli-0.2.2/mfcli/digikey → mfcli-0.2.4/mfcli/mcp}/__init__.py +0 -0
  66. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/mcp/configs/cline_mcp_settings.json +0 -0
  67. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/mcp/configs/mfcli.mcp.json +0 -0
  68. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/mcp/mcp_instance.py +0 -0
  69. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/mcp/server.py +0 -0
  70. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/mcp/state_manager.py +0 -0
  71. {mfcli-0.2.2/mfcli/mcp → mfcli-0.2.4/mfcli/mcp/tools}/__init__.py +0 -0
  72. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/mcp/tools/query_knowledgebase.py +0 -0
  73. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/__init__.py +0 -0
  74. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/base.py +0 -0
  75. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/datasheet.py +0 -0
  76. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/debug_setup.py +0 -0
  77. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/file.py +0 -0
  78. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/file_docket.py +0 -0
  79. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/file_metadata.py +0 -0
  80. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/functional_blocks.py +0 -0
  81. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/llm_response.py +0 -0
  82. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/mcu.py +0 -0
  83. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/mcu_errata.py +0 -0
  84. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/netlist.py +0 -0
  85. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/pdf_parts.py +0 -0
  86. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/pipeline_run.py +0 -0
  87. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/project.py +0 -0
  88. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/models/project_metadata.py +0 -0
  89. {mfcli-0.2.2/mfcli/mcp/tools → mfcli-0.2.4/mfcli/pipeline}/__init__.py +0 -0
  90. {mfcli-0.2.2/mfcli/pipeline → mfcli-0.2.4/mfcli/pipeline/analysis}/__init__.py +0 -0
  91. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/bom_netlist_mapper.py +0 -0
  92. {mfcli-0.2.2/mfcli/pipeline/analysis → mfcli-0.2.4/mfcli/pipeline/analysis/generators}/__init__.py +0 -0
  93. {mfcli-0.2.2/mfcli/pipeline/analysis/generators → mfcli-0.2.4/mfcli/pipeline/analysis/generators/bom}/__init__.py +0 -0
  94. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/bom/bom.py +0 -0
  95. {mfcli-0.2.2/mfcli/pipeline/analysis/generators/bom → mfcli-0.2.4/mfcli/pipeline/analysis/generators/debug_setup}/__init__.py +0 -0
  96. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/debug_setup/debug_setup.py +0 -0
  97. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/debug_setup/instructions.py +0 -0
  98. {mfcli-0.2.2/mfcli/pipeline/analysis/generators/debug_setup → mfcli-0.2.4/mfcli/pipeline/analysis/generators/functional_blocks}/__init__.py +0 -0
  99. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/functional_blocks/functional_blocks.py +0 -0
  100. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/functional_blocks/instructions.py +0 -0
  101. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/functional_blocks/validator.py +0 -0
  102. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/generator_base.py +0 -0
  103. {mfcli-0.2.2/mfcli/pipeline/analysis/generators/functional_blocks → mfcli-0.2.4/mfcli/pipeline/analysis/generators/mcu}/__init__.py +0 -0
  104. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/mcu/instructions.py +0 -0
  105. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/mcu/mcu.py +0 -0
  106. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/mcu_errata/__init__.py +0 -0
  107. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/mcu_errata/instructions.py +0 -0
  108. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/mcu_errata/mcu_errata.py +0 -0
  109. {mfcli-0.2.2/mfcli/pipeline/analysis/generators/mcu → mfcli-0.2.4/mfcli/pipeline/analysis/generators/summary}/__init__.py +0 -0
  110. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/analysis/generators/summary/summary.py +0 -0
  111. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/classifier.py +0 -0
  112. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/data_enricher.py +0 -0
  113. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/extractor.py +0 -0
  114. {mfcli-0.2.2/mfcli/pipeline/analysis/generators/summary → mfcli-0.2.4/mfcli/pipeline/extractors}/__init__.py +0 -0
  115. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/extractors/pdf.py +0 -0
  116. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/parser.py +0 -0
  117. {mfcli-0.2.2/mfcli/pipeline/extractors → mfcli-0.2.4/mfcli/pipeline/parsers}/__init__.py +0 -0
  118. {mfcli-0.2.2/mfcli/pipeline/parsers → mfcli-0.2.4/mfcli/pipeline/parsers/netlist}/__init__.py +0 -0
  119. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/parsers/netlist/edif.py +0 -0
  120. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/parsers/netlist/kicad_legacy_net.py +0 -0
  121. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/parsers/netlist/kicad_spice.py +0 -0
  122. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/parsers/netlist/pads.py +0 -0
  123. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/parsers/netlist/protel.py +0 -0
  124. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/parsers/netlist/protel_detector.py +0 -0
  125. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/pipeline.py +0 -0
  126. {mfcli-0.2.2/mfcli/pipeline/parsers/netlist → mfcli-0.2.4/mfcli/pipeline/preprocessors}/__init__.py +0 -0
  127. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/preprocessors/user_guide.py +0 -0
  128. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/run_context.py +0 -0
  129. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/schema_mapper.py +0 -0
  130. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/pipeline/sub_classifier.py +0 -0
  131. {mfcli-0.2.2/mfcli/pipeline/preprocessors → mfcli-0.2.4/mfcli/utils}/__init__.py +0 -0
  132. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/cline_rules.py +0 -0
  133. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/config.py +0 -0
  134. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/configurator.py +0 -0
  135. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/datasheet_vectorizer.py +0 -0
  136. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/directory_manager.py +0 -0
  137. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/file_upload.py +0 -0
  138. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/files.py +0 -0
  139. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/http_requests.py +0 -0
  140. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/kb_lister.py +0 -0
  141. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/kb_remover.py +0 -0
  142. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/logger.py +0 -0
  143. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/mcp_configurator.py +0 -0
  144. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/migrations.py +0 -0
  145. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/orm.py +0 -0
  146. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/pdf_splitter.py +0 -0
  147. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/pre_uninstall.py +0 -0
  148. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/query_service.py +0 -0
  149. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/ssl_installer.py +0 -0
  150. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/system_check.py +0 -0
  151. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/tools.py +0 -0
  152. {mfcli-0.2.2 → mfcli-0.2.4}/mfcli/utils/vectorizer.py +0 -0
  153. {mfcli-0.2.2 → mfcli-0.2.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mfcli
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: AI-powered CLI for analyzing hardware engineering documents
5
5
  Author: Multifactor AI
6
6
  License: MIT
@@ -0,0 +1,14 @@
1
+ """mfcli - AI-powered CLI for analyzing hardware engineering documents"""
2
+
3
+ try:
4
+ from importlib.metadata import version, PackageNotFoundError
5
+ try:
6
+ __version__ = version("mfcli")
7
+ except PackageNotFoundError:
8
+ # Package is not installed, fallback to a default version
9
+ __version__ = "0.2.3"
10
+ except ImportError:
11
+ # Python < 3.8
12
+ __version__ = "0.2.3"
13
+
14
+ __all__ = ["__version__"]
@@ -0,0 +1,36 @@
1
+ """Make BOM description field nullable
2
+
3
+ Revision ID: f1234567890a
4
+ Revises: e0f2b5765c72
5
+ Create Date: 2026-01-18 18:54:00.000000
6
+
7
+ """
8
+ from typing import Sequence, Union
9
+
10
+ from alembic import op
11
+ import sqlalchemy as sa
12
+
13
+
14
+ # revision identifiers, used by Alembic.
15
+ revision: str = 'f1234567890a'
16
+ down_revision: Union[str, Sequence[str], None] = 'e0f2b5765c72'
17
+ branch_labels: Union[str, Sequence[str], None] = None
18
+ depends_on: Union[str, Sequence[str], None] = None
19
+
20
+
21
+ def upgrade() -> None:
22
+ """Upgrade schema - make description nullable."""
23
+ # Make description field nullable
24
+ with op.batch_alter_table('bom', schema=None) as batch_op:
25
+ batch_op.alter_column('description',
26
+ existing_type=sa.String(length=600),
27
+ nullable=True)
28
+
29
+
30
+ def downgrade() -> None:
31
+ """Downgrade schema - make description non-nullable."""
32
+ # Make description field non-nullable again
33
+ with op.batch_alter_table('bom', schema=None) as batch_op:
34
+ batch_op.alter_column('description',
35
+ existing_type=sa.String(length=600),
36
+ nullable=False)
@@ -3,6 +3,7 @@ import argparse
3
3
  import os.path
4
4
  from pathlib import Path
5
5
 
6
+ from mfcli import __version__
6
7
  from mfcli.cli.dependencies import check_dependencies
7
8
  from mfcli.crud.project import init_project, read_project_config_file
8
9
  from mfcli.models.project_metadata import ProjectConfig
@@ -76,6 +77,11 @@ def run_cli():
76
77
  prog=cli_prog_name,
77
78
  description=desc
78
79
  )
80
+ parser.add_argument(
81
+ "-v", "--version",
82
+ action="version",
83
+ version=f"%(prog)s {__version__}"
84
+ )
79
85
  sub = parser.add_subparsers(dest="command", required=True)
80
86
  init_cmd = sub.add_parser(
81
87
  "init",
@@ -107,6 +113,11 @@ def run_cli():
107
113
  action="store_true",
108
114
  help="Skip confirmation prompt"
109
115
  )
116
+ clean_cmd.add_argument(
117
+ "--all",
118
+ action="store_true",
119
+ help="Delete entire ChromaDB and SQLite database for a complete fresh start (instead of just current project)"
120
+ )
110
121
 
111
122
  add_cmd = sub.add_parser(
112
123
  "add",
@@ -175,7 +186,7 @@ def run_cli():
175
186
  if args.command == "init":
176
187
  init_project(args.name)
177
188
  elif args.command == "clean":
178
- clean_app_data(args.accept)
189
+ clean_app_data(args.accept, args.all)
179
190
  else:
180
191
  project_config = read_project_config_file()
181
192
  if args.command == "run":
@@ -11,6 +11,7 @@ class FileTypes(BaseEnum):
11
11
  NET = 3
12
12
  CIR = 4
13
13
  PDF = 5
14
+ SCH = 6
14
15
 
15
16
 
16
17
  class FileSubtypes(BaseEnum):
@@ -119,6 +120,15 @@ SupportedFileTypes = {
119
120
  "MCU_DATASHEET",
120
121
  "REFERENCE_MANUAL"
121
122
  }
123
+ },
124
+ "SCH": {
125
+ "mime_types": {
126
+ "text/plain",
127
+ "application/octet-stream"
128
+ },
129
+ "subtypes": {
130
+ "SCHEMATIC"
131
+ }
122
132
  }
123
133
  }
124
134
 
@@ -14,7 +14,7 @@ class BOMSchema(BaseModel):
14
14
  reference: str = Field(..., description="Reference designators (C1, R3, U2, etc.)")
15
15
  value: str = Field(..., description="Electrical value or part name (10kΩ, MSPM0L1306)")
16
16
  quantity: int = Field(..., description="Quantity of identical components")
17
- description: str = Field(..., description="General text describing component")
17
+ description: Optional[str] = Field(None, description="General text describing component")
18
18
 
19
19
  # Optional fields
20
20
  manufacturer: Optional[str] = Field(None, description="Manufacturer name")
@@ -47,7 +47,7 @@ class BOM(SQLModel, table=True):
47
47
  reference: str = Field(max_length=100, nullable=False)
48
48
  value: str = Field(max_length=255, nullable=False)
49
49
  quantity: int = Field(nullable=False)
50
- description: str = Field(max_length=600, nullable=False)
50
+ description: Optional[str] = Field(default=None, max_length=600, nullable=True)
51
51
 
52
52
  # Optional fields
53
53
  manufacturer: Optional[str] = Field(default=None, max_length=255)
@@ -0,0 +1,121 @@
1
+ from typing import List, Dict, Optional
2
+
3
+ from pydantic import BaseModel, Field
4
+
5
+
6
+ class ClockSource(BaseModel):
7
+ """Clock source information."""
8
+ name: str = Field(..., description="Clock source name (e.g., 'HSE', 'LSE', 'PLL')")
9
+ frequency: str = Field("", description="Clock frequency (e.g., '16MHz', '32.768kHz')")
10
+ source_type: str = Field("", description="Type: crystal, oscillator, RC, external")
11
+ components: List[str] = Field(default_factory=list, description="Associated components (crystals, caps, etc.)")
12
+
13
+
14
+ class MCUSummary(BaseModel):
15
+ """MCU configuration summary."""
16
+ mcu_part: str = Field("", description="MCU part number")
17
+ clock_sources: List[ClockSource] = Field(default_factory=list, description="Clock configuration")
18
+ reset_circuit: str = Field("", description="Reset circuit description (supervisor IC, RC, button, etc.)")
19
+ boot_configuration: str = Field("", description="Boot mode pins and configuration")
20
+ programming_interface: str = Field("", description="Programming interface description (SWD, JTAG, etc.)")
21
+ notes: str = Field("", description="Additional MCU configuration notes")
22
+
23
+
24
+ class PinMapping(BaseModel):
25
+ """Single pin to net mapping."""
26
+ pin_number: str = Field(..., description="MCU pin number or name")
27
+ net_name: str = Field(..., description="Net name from schematic")
28
+ function: str = Field("", description="Pin function/purpose")
29
+ direction: str = Field("", description="Input/Output/Bidirectional")
30
+
31
+
32
+ class PinMap(BaseModel):
33
+ """Pin mappings for meaningful/named nets only."""
34
+ pins: List[PinMapping] = Field(default_factory=list, description="List of pin to net mappings")
35
+ notes: str = Field("", description="Additional notes about pin assignments")
36
+
37
+
38
+ class BusDevice(BaseModel):
39
+ """Device on a communication bus."""
40
+ device_name: str = Field(..., description="Device name or part number")
41
+ ref_des: str = Field(..., description="Reference designator")
42
+ address: str = Field("", description="Bus address (for I2C) or chip select (for SPI)")
43
+ irq_pin: str = Field("", description="Interrupt pin net name")
44
+ reset_pin: str = Field("", description="Reset pin net name")
45
+ enable_pin: str = Field("", description="Enable/chip enable pin net name")
46
+ other_signals: Dict[str, str] = Field(default_factory=dict, description="Other control signals")
47
+
48
+
49
+ class BusDefinition(BaseModel):
50
+ """Communication bus definition."""
51
+ bus_type: str = Field(..., description="Bus type: I2C, SPI, UART, CAN, etc.")
52
+ bus_name: str = Field("", description="Bus instance name (e.g., 'I2C1', 'SPI2')")
53
+ signal_nets: Dict[str, str] = Field(default_factory=dict, description="Signal to net mapping (e.g., {'SCL': 'I2C_SCL', 'SDA': 'I2C_SDA'})")
54
+ devices: List[BusDevice] = Field(default_factory=list, description="Devices connected to this bus")
55
+ notes: str = Field("", description="Additional bus notes")
56
+
57
+
58
+ class BusMap(BaseModel):
59
+ """Map of all communication buses."""
60
+ buses: List[BusDefinition] = Field(default_factory=list, description="List of communication buses")
61
+
62
+
63
+ class Peripheral(BaseModel):
64
+ """External peripheral/component requiring driver."""
65
+ name: str = Field(..., description="Peripheral name/description")
66
+ part_number: str = Field("", description="Part number")
67
+ ref_des: str = Field("", description="Reference designator")
68
+ interface: str = Field("", description="Interface type (I2C, SPI, GPIO, etc.)")
69
+ driver_target: str = Field("", description="Suggested driver or library")
70
+ notes: str = Field("", description="Integration notes")
71
+
72
+
73
+ class PeripheralList(BaseModel):
74
+ """List of peripherals requiring drivers."""
75
+ peripherals: List[Peripheral] = Field(default_factory=list, description="List of peripherals")
76
+
77
+
78
+ class VoltageRail(BaseModel):
79
+ """Power rail information."""
80
+ rail_name: str = Field(..., description="Rail name (e.g., '3V3', 'VBAT', '1V8')")
81
+ voltage: str = Field(..., description="Nominal voltage")
82
+ source: str = Field("", description="Power source (LDO, buck converter, external, etc.)")
83
+ enable_signal: str = Field("", description="Enable signal net name")
84
+ power_good_signal: str = Field("", description="Power good/status signal")
85
+ loads: List[str] = Field(default_factory=list, description="Major loads on this rail")
86
+
87
+
88
+ class PowerSequencing(BaseModel):
89
+ """Power and sequencing information."""
90
+ voltage_rails: List[VoltageRail] = Field(default_factory=list, description="Voltage rails")
91
+ sequencing_requirements: str = Field("", description="Power-up/down sequencing requirements")
92
+ notes: str = Field("", description="Additional power notes")
93
+
94
+
95
+ class ConstraintsGotchas(BaseModel):
96
+ """Design constraints and gotchas."""
97
+ constraints: List[str] = Field(default_factory=list, description="Design constraints")
98
+ gotchas: List[str] = Field(default_factory=list, description="Gotchas, errata references, workarounds")
99
+ recommendations: List[str] = Field(default_factory=list, description="Design recommendations")
100
+
101
+
102
+ class ConnectorPin(BaseModel):
103
+ """Single connector pin."""
104
+ pin_number: str = Field(..., description="Pin number on connector")
105
+ net_name: str = Field(..., description="Net name")
106
+ signal_name: str = Field("", description="Signal name/function")
107
+ direction: str = Field("", description="Signal direction")
108
+ notes: str = Field("", description="Pin notes")
109
+
110
+
111
+ class ConnectorPinout(BaseModel):
112
+ """Connector pinout table."""
113
+ ref_des: str = Field(..., description="Connector reference designator")
114
+ connector_type: str = Field("", description="Connector type/part number")
115
+ description: str = Field("", description="Connector purpose")
116
+ pins: List[ConnectorPin] = Field(default_factory=list, description="Pin definitions")
117
+
118
+
119
+ class ConnectorPinouts(BaseModel):
120
+ """All connector pinouts."""
121
+ connectors: List[ConnectorPinout] = Field(default_factory=list, description="List of connectors")
@@ -19,6 +19,7 @@ from mfcli.pipeline.analysis.generators.functional_blocks.functional_blocks impo
19
19
  from mfcli.pipeline.analysis.generators.generator_base import GeneratorBase
20
20
  from mfcli.pipeline.analysis.generators.mcu.mcu import MCUCheatSheetGenerator
21
21
  from mfcli.pipeline.analysis.generators.mcu_errata.mcu_errata import ErrataCheatSheetGenerator
22
+ from mfcli.pipeline.analysis.generators.schematic.schematic import SchematicCheatSheetGenerator
22
23
  from mfcli.pipeline.analysis.generators.summary.summary import SummaryCheatSheetGenerator
23
24
  from mfcli.pipeline.run_context import PipelineRunContext
24
25
  from mfcli.utils.directory_manager import app_dirs
@@ -29,7 +30,7 @@ logger = get_logger(__name__)
29
30
  FileSubtypeGeneratorMap: Dict[FileSubtypes, List[Type[GeneratorBase]]] = {
30
31
  FileSubtypes.ERRATA: [ErrataCheatSheetGenerator],
31
32
  FileSubtypes.MCU_DATASHEET: [MCUCheatSheetGenerator],
32
- FileSubtypes.SCHEMATIC: [DSCheatSheetGenerator],
33
+ FileSubtypes.SCHEMATIC: [DSCheatSheetGenerator, SchematicCheatSheetGenerator],
33
34
  FileSubtypes.USER_GUIDE: [SummaryCheatSheetGenerator],
34
35
  FileSubtypes.REFERENCE_MANUAL: [SummaryCheatSheetGenerator]
35
36
  }
@@ -39,6 +40,7 @@ GeneratorNameMap: Dict[Any, str] = {
39
40
  ErrataCheatSheetGenerator: "mcu_errata",
40
41
  MCUCheatSheetGenerator: "mcu",
41
42
  DSCheatSheetGenerator: "debug_setup",
43
+ SchematicCheatSheetGenerator: "schematic",
42
44
  FBCheatSheetGenerator: "functional_blocks",
43
45
  SummaryCheatSheetGenerator: "summary"
44
46
  }
@@ -0,0 +1 @@
1
+ # Schematic cheat sheet generator
@@ -0,0 +1,257 @@
1
+ sch_system_instructions = (
2
+ """
3
+ You are the Schematic Cheat Sheet Generator agent. Your role is to analyze hardware schematics
4
+ to extract comprehensive design information for firmware developers and hardware engineers.
5
+
6
+ Your goal is to provide:
7
+ - MCU configuration overview (clocking, reset, boot, programming)
8
+ - Pin mappings for meaningful/named nets
9
+ - Communication bus topology and device connections
10
+ - Peripheral list for driver development
11
+ - Power architecture and sequencing
12
+ - Design constraints and gotchas
13
+ - Connector pinout tables
14
+
15
+ Focus on information relevant to firmware development and system bring-up.
16
+ Extract actual net names and reference designators from the schematic.
17
+ """
18
+ )
19
+
20
+ sch_mcu_summary_instructions = (
21
+ """
22
+ Extract MCU configuration information from the schematic:
23
+
24
+ MCU SUMMARY:
25
+ - mcu_part: Identify the MCU part number from the schematic
26
+ - clock_sources: List all clock sources with details:
27
+ * name: Clock name (HSE, LSE, PLL, internal oscillator, etc.)
28
+ * frequency: Clock frequency if shown
29
+ * source_type: crystal, ceramic resonator, oscillator module, RC, external clock
30
+ * components: Associated components (Y1, C1, C2, etc.)
31
+ - reset_circuit: Describe the reset circuit:
32
+ * Reset supervisor IC (part number and ref des)
33
+ * RC reset network
34
+ * External reset button
35
+ * Brown-out detection
36
+ - boot_configuration: Boot mode configuration:
37
+ * Boot pins and their connections (BOOT0, BOOT1, etc.)
38
+ * Boot mode selection (flash, bootloader, etc.)
39
+ - programming_interface: Programming interface details:
40
+ * Interface type (SWD, JTAG, UART bootloader, etc.)
41
+ * Connector reference and pins
42
+ - notes: Any additional MCU configuration notes
43
+
44
+ Be specific with reference designators and net names.
45
+ """
46
+ )
47
+
48
+ sch_pin_map_instructions = (
49
+ """
50
+ Extract pin mappings for MEANINGFUL/NAMED nets only from the schematic:
51
+
52
+ PIN MAP (exclude generic power/ground):
53
+ - pins: List of pin mappings with:
54
+ * pin_number: MCU pin number or name (PA0, PB5, etc.)
55
+ * net_name: Net name from schematic
56
+ * function: Pin function/purpose
57
+ * direction: Input, Output, Bidirectional, Analog
58
+ - notes: Additional notes about pin assignments
59
+
60
+ EXCLUDE:
61
+ - Generic power nets (VDD, VSS, GND, 3V3, etc.) unless they're special (VBAT, VDDA, etc.)
62
+ - Decoupling capacitor connections
63
+ - Generic ground connections
64
+
65
+ INCLUDE:
66
+ - GPIO with specific functions (LED_STATUS, BUTTON_USER, etc.)
67
+ - Communication bus pins (I2C_SCL, SPI_MOSI, UART_TX, etc.)
68
+ - ADC inputs with meaningful names
69
+ - Control signals (ENABLE, RESET, IRQ, etc.)
70
+ - Special power pins (VBAT, VDDA, VREF, etc.)
71
+
72
+ Focus on nets that firmware developers need to know about.
73
+ """
74
+ )
75
+
76
+ sch_bus_map_instructions = (
77
+ """
78
+ Extract communication bus information from the schematic:
79
+
80
+ BUS MAP:
81
+ For each communication bus (I2C, SPI, UART, CAN, etc.), extract:
82
+
83
+ - bus_type: I2C, SPI, UART, CAN, USB, etc.
84
+ - bus_name: Instance name (I2C1, SPI2, UART3, etc.)
85
+ - signal_nets: Map signal names to net names
86
+ * I2C: SCL, SDA
87
+ * SPI: MOSI, MISO, SCK, (CS for each device)
88
+ * UART: TX, RX, (CTS, RTS if used)
89
+ * CAN: CANH, CANL
90
+ - devices: List all devices connected to this bus:
91
+ * device_name: Device description (e.g., "Temperature Sensor", "EEPROM")
92
+ * ref_des: Reference designator (U5, U8, etc.)
93
+ * address: I2C address or SPI chip select net
94
+ * irq_pin: Interrupt pin net name if connected
95
+ * reset_pin: Reset pin net name if connected
96
+ * enable_pin: Enable/power-down pin net name if connected
97
+ * other_signals: Other control signals (ALERT, DRDY, etc.)
98
+ - notes: Additional bus information
99
+
100
+ Identify devices by looking for:
101
+ - ICs connected to bus lines
102
+ - Pull-up resistors on I2C lines
103
+ - Chip select signals for SPI devices
104
+ - Communication transceivers
105
+
106
+ Be thorough - include all devices on each bus.
107
+ """
108
+ )
109
+
110
+ sch_peripheral_list_instructions = (
111
+ """
112
+ Extract list of peripherals that require firmware drivers:
113
+
114
+ PERIPHERAL LIST (driver targets):
115
+ For each peripheral/sensor/module, extract:
116
+
117
+ - name: Peripheral description (e.g., "IMU Sensor", "OLED Display", "LoRa Module")
118
+ - part_number: IC part number if visible
119
+ - ref_des: Reference designator
120
+ - interface: Communication interface (I2C, SPI, UART, GPIO, Analog, etc.)
121
+ - driver_target: Suggested driver library or development approach
122
+ - notes: Integration notes, special considerations
123
+
124
+ INCLUDE:
125
+ - Sensors (temperature, pressure, IMU, accelerometer, etc.)
126
+ - Displays (LCD, OLED, e-paper, etc.)
127
+ - Communication modules (WiFi, Bluetooth, LoRa, cellular, etc.)
128
+ - Memory devices (EEPROM, Flash, FRAM, etc.)
129
+ - Motor drivers and actuators
130
+ - RTC chips
131
+ - Power management ICs with I2C/SPI control
132
+ - ADCs, DACs
133
+ - GPIO expanders
134
+ - Any IC that requires firmware interaction
135
+
136
+ EXCLUDE:
137
+ - Passive components (resistors, capacitors, inductors)
138
+ - Simple power regulators without control interface
139
+ - Connectors (these go in connector section)
140
+ - The MCU itself
141
+
142
+ Focus on components that firmware developers will need to write drivers for.
143
+ """
144
+ )
145
+
146
+ sch_power_sequencing_instructions = (
147
+ """
148
+ Extract power architecture and sequencing information:
149
+
150
+ POWER & SEQUENCING:
151
+
152
+ voltage_rails: List all voltage rails:
153
+ - rail_name: Rail net name (3V3, 1V8, VBAT, VCCA, etc.)
154
+ - voltage: Nominal voltage
155
+ - source: Where it comes from:
156
+ * Input (battery, USB, external supply)
157
+ * LDO regulator (part number and ref des)
158
+ * Switching regulator (buck, boost, buck-boost)
159
+ * Charge pump
160
+ - enable_signal: Enable control net name if present
161
+ - power_good_signal: Power good/status net name if present
162
+ - loads: Major loads powered by this rail (MCU, sensors, display, etc.)
163
+
164
+ sequencing_requirements: Describe power-up/down sequencing:
165
+ - Order of rail activation
166
+ - Delays required between rails
167
+ - Dependencies (e.g., "VCCA must be up before 3V3")
168
+ - Sequencing control (IC part number if using sequencer)
169
+
170
+ notes: Additional power notes:
171
+ - Load switches and their control
172
+ - Power path management
173
+ - Battery charging
174
+ - Low power modes
175
+ - Brownout protection
176
+
177
+ Analyze:
178
+ - Power regulators (LDOs, switching regulators)
179
+ - Load switches and enable signals
180
+ - Power monitoring/sequencing ICs
181
+ - Power good signals
182
+ - Enable control logic
183
+ """
184
+ )
185
+
186
+ sch_constraints_gotchas_instructions = (
187
+ """
188
+ Identify design constraints, gotchas, and recommendations:
189
+
190
+ CONSTRAINTS / GOTCHAS:
191
+
192
+ constraints: List design constraints:
193
+ - Pin limitations (e.g., "PA9/PA10 used for USB, cannot use for UART1")
194
+ - Resource conflicts (e.g., "Timer 2 used for PWM, unavailable for other functions")
195
+ - Hardware limitations (e.g., "Only 2 hardware I2C peripherals available")
196
+ - Voltage level constraints
197
+ - Current limitations
198
+ - Timing constraints
199
+ - External component requirements
200
+
201
+ gotchas: List potential issues and workarounds:
202
+ - Errata references (e.g., "MCU errata: I2C clock stretching issue, use software I2C")
203
+ - Design quirks (e.g., "BOOT0 must be low at startup or device enters bootloader")
204
+ - Pin conflicts or shared resources
205
+ - Required pull-ups/pull-downs
206
+ - Signal integrity concerns
207
+ - Known bugs or workarounds
208
+
209
+ recommendations: Design recommendations:
210
+ - Best practices for this design
211
+ - Suggested initialization order
212
+ - Debugging tips
213
+ - Optimization opportunities
214
+ - Future design improvements
215
+
216
+ Look for:
217
+ - Comments or notes on schematic
218
+ - Unusual circuit topologies
219
+ - Shared pins (alternate functions)
220
+ - Critical timing or ordering requirements
221
+ - Reference to MCU errata documents
222
+ """
223
+ )
224
+
225
+ sch_connector_pinouts_instructions = (
226
+ """
227
+ Extract connector pinout information:
228
+
229
+ CONNECTOR PINOUTS:
230
+ For each connector on the schematic, create a pinout table:
231
+
232
+ - ref_des: Connector reference designator (J1, P2, CN3, etc.)
233
+ - connector_type: Connector type/part number
234
+ * Examples: "USB-C", "2.54mm header 10-pin", "JST-XH 4-pin", etc.
235
+ - description: Connector purpose
236
+ * Examples: "Debug connector", "External sensor interface", "Power input"
237
+ - pins: List of all pins with:
238
+ * pin_number: Pin number on connector
239
+ * net_name: Net name connected to this pin
240
+ * signal_name: Signal function/name
241
+ * direction: Input/Output/Power/Ground/Bidirectional
242
+ * notes: Pin-specific notes
243
+
244
+ Include ALL connectors:
245
+ - Debug/programming connectors
246
+ - External sensor/module connectors
247
+ - Power input connectors
248
+ - Communication connectors (USB, Ethernet, etc.)
249
+ - Button/switch connectors
250
+ - Display connectors
251
+ - Expansion headers
252
+ - Test points (if grouped as connectors)
253
+
254
+ For each pin, provide complete information.
255
+ Maintain pin order as shown in schematic.
256
+ """
257
+ )