traceforge-pcb 1.0.0__py3-none-any.whl
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.
- traceforge/__init__.py +3 -0
- traceforge/__main__.py +3 -0
- traceforge/acp_server.py +570 -0
- traceforge/agent.py +680 -0
- traceforge/altium/__init__.py +6 -0
- traceforge/altium/cfb.py +70 -0
- traceforge/altium/cli.py +60 -0
- traceforge/altium/model.py +163 -0
- traceforge/altium/outputs.py +24 -0
- traceforge/altium/pcb.py +301 -0
- traceforge/altium/project.py +328 -0
- traceforge/altium/schematic.py +400 -0
- traceforge/altium/tools.py +166 -0
- traceforge/approval.py +219 -0
- traceforge/attachments.py +346 -0
- traceforge/background.py +253 -0
- traceforge/bench/__init__.py +5 -0
- traceforge/bench/adapters.py +337 -0
- traceforge/bench/checks.py +410 -0
- traceforge/bench/cli.py +121 -0
- traceforge/bench/design.py +439 -0
- traceforge/bench/kicad.py +99 -0
- traceforge/bench/partscheck.py +159 -0
- traceforge/bench/review.py +100 -0
- traceforge/bench/runner.py +226 -0
- traceforge/bench/score.py +204 -0
- traceforge/bench/tasks.py +102 -0
- traceforge/chat.py +1185 -0
- traceforge/checks.py +328 -0
- traceforge/checks_sides.py +118 -0
- traceforge/cli.py +2224 -0
- traceforge/clipboard.py +107 -0
- traceforge/config.py +299 -0
- traceforge/context.py +276 -0
- traceforge/design/__init__.py +1 -0
- traceforge/design/constraints.py +397 -0
- traceforge/design/generate.py +1789 -0
- traceforge/design/outline.py +905 -0
- traceforge/design/schematic_layout.py +932 -0
- traceforge/design/schematic_lint.py +329 -0
- traceforge/design/schematic_route.py +207 -0
- traceforge/design/sheets.py +854 -0
- traceforge/design/sides.py +328 -0
- traceforge/design/spec.py +462 -0
- traceforge/design/specsheet.py +2351 -0
- traceforge/design/specsheet_render.py +183 -0
- traceforge/desktop/__init__.py +109 -0
- traceforge/desktop/keys.py +90 -0
- traceforge/desktop/project.py +443 -0
- traceforge/desktop/review.py +20 -0
- traceforge/desktop/server.py +1277 -0
- traceforge/desktop/static/app.css +223 -0
- traceforge/desktop/static/app.js +683 -0
- traceforge/desktop/static/highlight.js +77 -0
- traceforge/desktop/static/index.html +89 -0
- traceforge/desktop/static/md.js +90 -0
- traceforge/desktop/static/viewer.js +213 -0
- traceforge/desktop/symbols.py +212 -0
- traceforge/desktop/update.py +65 -0
- traceforge/diagnostics.py +67 -0
- traceforge/errata.py +219 -0
- traceforge/fab.py +108 -0
- traceforge/fab_layers.py +44 -0
- traceforge/features/__init__.py +6 -0
- traceforge/features/candidates.py +117 -0
- traceforge/features/cli.py +200 -0
- traceforge/features/package.py +433 -0
- traceforge/features/revdiff.py +224 -0
- traceforge/features/sarif.py +145 -0
- traceforge/features/viewer.py +265 -0
- traceforge/firmware/__init__.py +3 -0
- traceforge/firmware/cli.py +174 -0
- traceforge/firmware/drivers.py +372 -0
- traceforge/firmware/drivers_data.py +256 -0
- traceforge/firmware/mcus.py +177 -0
- traceforge/firmware/netlist.py +55 -0
- traceforge/firmware/pinmap.py +296 -0
- traceforge/firmware/scaffold.py +466 -0
- traceforge/firmware/toolchain.py +262 -0
- traceforge/hooks.py +237 -0
- traceforge/kicad/__init__.py +0 -0
- traceforge/kicad/cli.py +519 -0
- traceforge/kicad/diffpair.py +174 -0
- traceforge/kicad/edgegeom.py +191 -0
- traceforge/kicad/edit.py +405 -0
- traceforge/kicad/escape.py +1410 -0
- traceforge/kicad/formats.py +1073 -0
- traceforge/kicad/impedance.py +320 -0
- traceforge/kicad/install.py +75 -0
- traceforge/kicad/libraries.py +490 -0
- traceforge/kicad/models3d.py +942 -0
- traceforge/kicad/outputs.py +81 -0
- traceforge/kicad/pcb.py +787 -0
- traceforge/kicad/planes.py +1242 -0
- traceforge/kicad/project.py +136 -0
- traceforge/kicad/route.py +2698 -0
- traceforge/kicad/routegeom.py +164 -0
- traceforge/kicad/schematic.py +268 -0
- traceforge/kicad/sides.py +34 -0
- traceforge/kicad/stackup.py +424 -0
- traceforge/kicad_plugin/__init__.py +12 -0
- traceforge/kicad_plugin/actions.py +92 -0
- traceforge/kicad_plugin/cli.py +66 -0
- traceforge/kicad_plugin/client.py +86 -0
- traceforge/kicad_plugin/context.py +257 -0
- traceforge/kicad_plugin/discovery.py +81 -0
- traceforge/kicad_plugin/install.py +203 -0
- traceforge/kicad_plugin/overlay.py +60 -0
- traceforge/kicad_plugin/payload/action_plugin.py +65 -0
- traceforge/kicad_plugin/payload/ipc_main.py +42 -0
- traceforge/kicad_plugin/payload/plugin.json +90 -0
- traceforge/kicad_plugin/payload/requirements.txt +1 -0
- traceforge/kicad_plugin/views.py +202 -0
- traceforge/langchain.py +57 -0
- traceforge/local.py +580 -0
- traceforge/mcp_server.py +304 -0
- traceforge/models.py +310 -0
- traceforge/next_steps.py +110 -0
- traceforge/parts/__init__.py +52 -0
- traceforge/parts/alternates.py +488 -0
- traceforge/parts/bom.py +423 -0
- traceforge/parts/brief.py +705 -0
- traceforge/parts/catalog.py +297 -0
- traceforge/parts/cli_sourcing.py +156 -0
- traceforge/parts/data/duty_rates.yaml +37 -0
- traceforge/parts/data/hs_codes.yaml +103 -0
- traceforge/parts/datasheet.py +278 -0
- traceforge/parts/fx.py +100 -0
- traceforge/parts/model.py +185 -0
- traceforge/parts/net.py +187 -0
- traceforge/parts/offers.py +46 -0
- traceforge/parts/packages.py +397 -0
- traceforge/parts/pinout.py +714 -0
- traceforge/parts/providers/__init__.py +17 -0
- traceforge/parts/providers/base.py +100 -0
- traceforge/parts/providers/jlc.py +364 -0
- traceforge/parts/providers/keyed.py +661 -0
- traceforge/parts/report.py +508 -0
- traceforge/parts/supply.py +330 -0
- traceforge/parts/verify.py +455 -0
- traceforge/parts/web.py +575 -0
- traceforge/plans.py +70 -0
- traceforge/preferences.py +127 -0
- traceforge/prices.py +130 -0
- traceforge/prices.yaml +28 -0
- traceforge/prompts/__init__.py +54 -0
- traceforge/prompts/system.md +103 -0
- traceforge/providers.py +764 -0
- traceforge/remote/__init__.py +33 -0
- traceforge/remote/client.py +422 -0
- traceforge/remote/oidc.py +240 -0
- traceforge/remote/orgs.py +510 -0
- traceforge/remote/server.py +690 -0
- traceforge/remote/store.py +100 -0
- traceforge/review_changes.py +187 -0
- traceforge/routing.py +99 -0
- traceforge/runtime.py +435 -0
- traceforge/sessions.py +324 -0
- traceforge/sexpr.py +279 -0
- traceforge/sim/__init__.py +17 -0
- traceforge/sim/acmath.py +234 -0
- traceforge/sim/circuit.py +499 -0
- traceforge/sim/cli.py +162 -0
- traceforge/sim/engine.py +172 -0
- traceforge/sim/ltspice.py +175 -0
- traceforge/sim/measure.py +123 -0
- traceforge/sim/models.py +76 -0
- traceforge/sim/project.py +218 -0
- traceforge/sim/rawfile.py +123 -0
- traceforge/sim/results.py +298 -0
- traceforge/sim/tune.py +172 -0
- traceforge/skill_commands.py +165 -0
- traceforge/skill_library/circuit-simulation/SKILL.md +30 -0
- traceforge/skill_library/compliance-review/SKILL.md +51 -0
- traceforge/skill_library/design-review/SKILL.md +47 -0
- traceforge/skill_library/errata-hunt/SKILL.md +30 -0
- traceforge/skill_library/firmware/SKILL.md +26 -0
- traceforge/skill_library/power-budget/SKILL.md +27 -0
- traceforge/skill_library/release-package/SKILL.md +29 -0
- traceforge/skill_library/sourcing-brief/SKILL.md +24 -0
- traceforge/skill_library/thermal-review/SKILL.md +15 -0
- traceforge/skills.py +131 -0
- traceforge/thermal.py +557 -0
- traceforge/tools/__init__.py +48 -0
- traceforge/tools/agent_tools.py +213 -0
- traceforge/tools/base.py +303 -0
- traceforge/tools/batch.py +155 -0
- traceforge/tools/connections.py +245 -0
- traceforge/tools/files.py +777 -0
- traceforge/tools/firmware_tools.py +218 -0
- traceforge/tools/kicad_tools.py +1072 -0
- traceforge/tools/models3d_tools.py +141 -0
- traceforge/tools/parts_tools.py +473 -0
- traceforge/tools/processes.py +246 -0
- traceforge/tools/review_tools.py +178 -0
- traceforge/tools/sim_tools.py +230 -0
- traceforge/tui.py +620 -0
- traceforge/updates.py +124 -0
- traceforge/validate/__init__.py +77 -0
- traceforge/validate/builtins.py +1091 -0
- traceforge/validate/circuits.py +1240 -0
- traceforge/validate/config.py +410 -0
- traceforge/validate/default.yaml +113 -0
- traceforge/validate/design.py +191 -0
- traceforge/validate/explain.py +112 -0
- traceforge/validate/grounding.py +169 -0
- traceforge/validate/ipc2221.py +350 -0
- traceforge/validate/multilayer.py +805 -0
- traceforge/validate/netmodel.py +261 -0
- traceforge/validate/partcheck.py +472 -0
- traceforge/validate/report.py +280 -0
- traceforge/validate/review.py +322 -0
- traceforge/validate/runner.py +662 -0
- traceforge/workspace.py +171 -0
- traceforge_pcb-1.0.0.dist-info/METADATA +463 -0
- traceforge_pcb-1.0.0.dist-info/RECORD +219 -0
- traceforge_pcb-1.0.0.dist-info/WHEEL +4 -0
- traceforge_pcb-1.0.0.dist-info/entry_points.txt +2 -0
- traceforge_pcb-1.0.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Locate the KiCad project inside a workspace."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
SKIP_DIRS = frozenset(
|
|
9
|
+
{
|
|
10
|
+
".git",
|
|
11
|
+
".venv",
|
|
12
|
+
"venv",
|
|
13
|
+
"node_modules",
|
|
14
|
+
"__pycache__",
|
|
15
|
+
".traceforge",
|
|
16
|
+
"build",
|
|
17
|
+
"dist",
|
|
18
|
+
"backups",
|
|
19
|
+
"fp-info-cache",
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass
|
|
25
|
+
class Workspace:
|
|
26
|
+
root: Path
|
|
27
|
+
project: Path | None
|
|
28
|
+
schematic: Path | None
|
|
29
|
+
pcb: Path | None
|
|
30
|
+
others: dict[str, list[Path]]
|
|
31
|
+
|
|
32
|
+
def relative(self, path: Path | None) -> str | None:
|
|
33
|
+
if path is None:
|
|
34
|
+
return None
|
|
35
|
+
try:
|
|
36
|
+
return path.relative_to(self.root).as_posix()
|
|
37
|
+
except ValueError:
|
|
38
|
+
return str(path)
|
|
39
|
+
|
|
40
|
+
def describe(self) -> dict:
|
|
41
|
+
return {
|
|
42
|
+
"root": str(self.root),
|
|
43
|
+
"project": self.relative(self.project),
|
|
44
|
+
"schematic": self.relative(self.schematic),
|
|
45
|
+
"pcb": self.relative(self.pcb),
|
|
46
|
+
"other_projects": [self.relative(p) for p in self.others.get("projects", [])],
|
|
47
|
+
**(
|
|
48
|
+
{
|
|
49
|
+
"altium": [self.relative(p) for p in self.others["altium"]],
|
|
50
|
+
"altium_hint": ALTIUM_HINT,
|
|
51
|
+
}
|
|
52
|
+
if self.others.get("altium")
|
|
53
|
+
else {}
|
|
54
|
+
),
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
ALTIUM_SUFFIXES = frozenset({".prjpcb", ".schdoc", ".pcbdoc", ".schlib", ".pcblib"})
|
|
59
|
+
ALTIUM_HINT = (
|
|
60
|
+
"Altium files found. Use the altium_project / altium_connections / altium_bom / "
|
|
61
|
+
"altium_review tools (or `traceforge altium info|netlist|bom|convert`) to read them; "
|
|
62
|
+
"kicad_connections also works. To get editable KiCad files, import the project with "
|
|
63
|
+
"KiCad 8+ (File > Import > Non-KiCad Project, choose the .PrjPcb)."
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def walk_files(root: Path, max_depth: int = 6, max_files: int = 5000) -> list[Path]:
|
|
68
|
+
found: list[Path] = []
|
|
69
|
+
stack: list[tuple[Path, int]] = [(root, 0)]
|
|
70
|
+
while stack and len(found) < max_files:
|
|
71
|
+
directory, depth = stack.pop()
|
|
72
|
+
try:
|
|
73
|
+
entries = sorted(directory.iterdir())
|
|
74
|
+
except OSError:
|
|
75
|
+
continue
|
|
76
|
+
for entry in entries:
|
|
77
|
+
if entry.name in SKIP_DIRS or entry.name.startswith(".") and entry.is_dir():
|
|
78
|
+
continue
|
|
79
|
+
if entry.is_dir():
|
|
80
|
+
if depth < max_depth:
|
|
81
|
+
stack.append((entry, depth + 1))
|
|
82
|
+
else:
|
|
83
|
+
found.append(entry)
|
|
84
|
+
if len(found) >= max_files:
|
|
85
|
+
break
|
|
86
|
+
return found
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def discover(root: str | Path, project: str | Path | None = None) -> Workspace:
|
|
90
|
+
"""Find the main ``.kicad_pro`` and its schematic and board.
|
|
91
|
+
|
|
92
|
+
Preference: an explicit project, then the shallowest ``.kicad_pro``, then
|
|
93
|
+
loose ``.kicad_sch``/``.kicad_pcb`` files.
|
|
94
|
+
"""
|
|
95
|
+
root = Path(root).resolve()
|
|
96
|
+
files = walk_files(root)
|
|
97
|
+
projects = sorted(
|
|
98
|
+
(f for f in files if f.suffix == ".kicad_pro"), key=lambda p: (len(p.parts), str(p))
|
|
99
|
+
)
|
|
100
|
+
schematics = [f for f in files if f.suffix == ".kicad_sch"]
|
|
101
|
+
boards = [f for f in files if f.suffix == ".kicad_pcb"]
|
|
102
|
+
chosen: Path | None = None
|
|
103
|
+
if project is not None:
|
|
104
|
+
candidate = Path(project)
|
|
105
|
+
chosen = (candidate if candidate.is_absolute() else root / candidate).resolve()
|
|
106
|
+
elif projects:
|
|
107
|
+
chosen = projects[0]
|
|
108
|
+
schematic = pcb = None
|
|
109
|
+
if chosen is not None:
|
|
110
|
+
sch = chosen.with_suffix(".kicad_sch")
|
|
111
|
+
brd = chosen.with_suffix(".kicad_pcb")
|
|
112
|
+
schematic = sch if sch.exists() else None
|
|
113
|
+
pcb = brd if brd.exists() else None
|
|
114
|
+
if schematic is None and schematics:
|
|
115
|
+
schematic = sorted(schematics, key=lambda p: (len(p.parts), str(p)))[0]
|
|
116
|
+
if pcb is None and boards:
|
|
117
|
+
pcb = sorted(boards, key=lambda p: (len(p.parts), str(p)))[0]
|
|
118
|
+
return Workspace(
|
|
119
|
+
root=root,
|
|
120
|
+
project=chosen,
|
|
121
|
+
schematic=schematic,
|
|
122
|
+
pcb=pcb,
|
|
123
|
+
others={
|
|
124
|
+
"projects": [p for p in projects if p != chosen],
|
|
125
|
+
"altium": sorted(f for f in files if f.suffix.lower() in ALTIUM_SUFFIXES),
|
|
126
|
+
},
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def file_tree(root: Path, limit: int = 400) -> str:
|
|
131
|
+
"""Compact listing used as initial context for the agent."""
|
|
132
|
+
files = walk_files(root, max_files=limit + 1)
|
|
133
|
+
lines = [p.relative_to(root).as_posix() for p in files[:limit]]
|
|
134
|
+
if len(files) > limit:
|
|
135
|
+
lines.append(f"... ({len(files) - limit}+ more files not shown)")
|
|
136
|
+
return "\n".join(lines) if lines else "(empty workspace)"
|