Commit Graph

51 Commits

Author SHA1 Message Date
Lenny Khazan 565251e97a Bump to 0.2.0-prerelease.4 and add --version 2025-08-19 16:55:35 -04:00
Lenny Khazan d8afaba34b Remove LSP autoimport logic (#83) 2025-08-18 23:07:43 -04:00
Akhil Velagapudi 47190c5821 [DIO-309] Add component_type tag for well-known components (#81)
* Make zen_file path relative to release archive

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Add component_type tag for well-known components

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-18 14:54:40 -07:00
Akhil Velagapudi b9d101e129 Fix package resolution in pcb vendor/release (#80)
* Add [packages] to vendor/release test case

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Fix package resolution in pcb vendor/release

The TrackingLoadResolver middleware couldn't properly resolve packages.
To fix, eliminate the middleware entirely and enhance CoreLoadResolver
to handle all the necessary tracking. This is likely to reduce future
bugs as well.

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use public kicad package

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-18 14:32:31 -07:00
Davide Asnaghi 63e02ca70c [FMT] ignore dotfiles (#78)
* ignore hidden files by default

* formatting
2025-08-16 16:16:58 -04:00
Akhil Velagapudi 2059bccbca Substitute PCB_VERSION, PCB_GIT_HASH in release layout files (#77)
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-15 16:30:23 -07:00
Akhil Velagapudi 23442e6577 Only detect workspace root if pcb.toml has [workspace] (#75)
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-15 15:28:37 -07:00
Akhil Velagapudi 52ae02637b Add more release artifacts (#74)
Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-15 13:09:52 -07:00
Akhil Velagapudi b97d9f053b [DIO-302] Generate 3d models for release (#73)
* Generate 3d models for release

Release file structure:
/a614869/3d
├── model.step
├── model.svg
└── model.wrl

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Ignore spurious kicad-cli errors

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-15 12:47:52 -07:00
Akhil Velagapudi 58549fb924 [DIO-301] Add pcb vendor, pcb build --offline (#72)
* Update Cargo.lock

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Add pcb vendor

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Copy pcb.toml to release if it exists

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use vendor dir in resolver

Add --offline support to build, layout.
Standardize behavior of find_workspace_root. Most of the callsites would
fallback on parent dir of target .zen file. We should just do that
universally to reduce conditional code paths.

Add an option to the resolve to not use the vendor dir in case that's
useful in some cases.

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Drop vendor alias

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Only support pcb vendor in pcb.toml workspaces

Attempting to resolve a common workspace root from multiple zen files in
a dir without pcb.toml just got way too complicated. We can add support
for this in the future if needed.

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Canonicalize zen_path

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-15 12:07:51 -07:00
Lenny Khazan 951f74eb42 Add BOM to WASM API (#71) 2025-08-15 01:32:51 -04:00
Lenny Khazan 9058b71749 Add more context to LSP error diagnostics (#70) 2025-08-15 00:20:01 -04:00
Akhil Velagapudi 1636bc18f7 [DIO-300] Add pcb release command (#69)
* Add pcb release command

Intentially spartan in terms of flags/arguments. All that's needed is
the path to the .zen file.

To test:
cargo run -- release crates/pcb/test-workspace/boards/TestBoard.zen

Implemented:
- Workspace root detection (even without pcb.toml)
- Git-based versioning (e.g. tag > commit hash > dirty commit hash)
- Zen source files copied into release dir (release-dir/src)
- Dependencies are vendored into release dir (release-dir/src/vendor)
- Unmatched bom is generated into release dir (release-dir/bom)
- KiCad layout dir is copied into release dir (release-dir/layout)
- Metadata file is generated into release dir (release-dir/metadata.json)
- Generated artifacts are stored in .pcb/ dir (for now) and not uploaded

TODO:
- Upload the release bundle to API server
- Add a --dry-run to generate release bundle but not upload (similar to
  cargo)
- Use the vendor/ dir for dependency resolution for deterministic builds
- Add pcb vendor subcommand, --offline flag for build/layout
- Add more release artifacts (e.g. gerbers, odb, etc.)

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Fix windows compat

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Add support, test-coverage for workspace-relative loads

Assume that pcb.toml is needed for workspace-relative loads

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use workspace root .pcb dir for staging releases

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-14 18:46:43 -07:00
Akhil Velagapudi f20ac95f64 [DIO-298] [DIO-299] Add pcb bom command to generate unmatched bom (#66)
* Add structured, unmatched BOM export command

Run using `pcb bom <path/to/zen> -o json`

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Test bom command in CI

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Bump stdlib in examples from v0.2.0 to v0.2.2

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Remove default_multiplier, use struct for group key

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use PhysicalValue to do less string parsing

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Add alternatives to group key

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

* Use DynamicFullWidth for the comfy table

Attempts to fit the table within terminal width.

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>

---------

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-14 12:13:20 -07:00
Akhil Velagapudi a41fd301eb Parse unit records as AttributeValue::Physical (#68)
Reduce unnecessary conversions to/from strings.
Use rust_decimal for fixed precision.

Signed-off-by: akhilles <akhilvelagapudi@gmail.com>
2025-08-14 10:21:10 -07:00
Lenny Khazan 208d95e023 resolve workspace in wasm (#65) 2025-08-12 02:19:13 -04:00
Lenny Khazan b29b5865e5 pcb upgrade command (#64)
* `pcb upgrade` command

* remove pending snap

* clippy
2025-08-12 01:56:48 -04:00
Lenny Khazan d3bef1b0a5 Update net naming strategy (#62)
* Consistent net naming

* cargo fmt

* fix clippy

* uniquify net names
2025-08-08 15:52:15 -04:00
Lenny Khazan 4c135e964e Updates for visualizer (#61)
* Updates for visualizer

* update docstring
2025-08-05 18:20:01 -04:00
Davide Asnaghi da1375abbd [FIX] multiple .pcb caches (#59)
* fix .pcb cache instantiation

* fix format
2025-08-05 11:15:11 -04:00
Martin Charles 926864652c add nix flake (#51)
* add nix flake

nix profile install nix profile install github:diodeinc/pcb

kicad isn't packaged here yet but can deal with that later

used crane as there is a bug in nixpkgs rust https://discourse.nixos.org/t/rust-with-git-deps-symbolic-link-error-to-cargo-vendor-dep/28841 and naserk had some issue as well. crane isn't ideal because it doesn't cache properly but now it one click installs so whatever

* allow external buildifier

* fix linux compilation

next up package kicad in a sane way

* fmt

* apply suggestions
2025-08-04 17:33:39 -04:00
Lenny Khazan 834fc645cc [DIO-293] Add dnp/exclude_from_bom support (#58)
* [DIO-293] Add dnp/exclude_from_bom support

* ignore underscored fields
2025-08-04 16:28:07 -04:00
Lenny Khazan 7c2462d1cc add signature annotation to modules in netlist (#57)
* feat: add signature annotation to modules in netlist

* fix clippy

* deterministic interface element ordering
2025-08-03 21:27:03 -04:00
Lenny Khazan 2c836ac395 Fix workspace dependencies in schematics viewer (#54) 2025-07-31 13:58:36 -04:00
Lenny Khazan 92373d47ba Automatically cast int<>float (#52) 2025-07-29 23:39:47 -04:00
Lenny Khazan d40521a818 Improve enum handling for io() and config() (#46)
* Improve handling of enums for io()/config()

* update extraction
2025-07-23 15:13:50 -04:00
Lenny Khazan 7aef7940c2 Fix handling of kicad_sym (extends ...) (#40)
* Fix handling of kicad_sym (extends ...)

* update snaps
2025-07-21 23:02:33 -04:00
Lenny Khazan 53345164bb Fix for relative imports in external dependency (#39)
* Fix for relative imports in external dependency

* expose default value and help text

* Remove duplicate Parameter type

* skip some finicky tests on windows

* unused import
2025-07-21 02:01:47 -04:00
Lenny Khazan 810a7373b5 deterministic parameter ordering (#38) 2025-07-20 18:42:02 -04:00
Lenny Khazan 0682b72e08 Fix schematics when symbol= and pin_defs= are provided (#37) 2025-07-20 16:57:04 -04:00
Lenny Khazan 9f65ebc80a More robust VSCode schematics viewer (#36)
* wip

* RemoteFetcher

* refactor load logic

* update bundle

* updates

* cleanup

* fixes

* skip on windows

* remove unused

* Add sidebar (non-functional for now)

* Misc fixes and speed

* fix for misaligned first-layout

* fix unnamed pins

* remove debugging

* Add edge labels

* net symbol support

* multiple net symbols

* fix eslint

* Pass symbol across module boundary

* Add new Symbol("library.kicad_sym:SYM") syntax

* update spec

* update snaps
2025-07-20 15:04:49 -04:00
Lenny Khazan ad6f0ded3a Refactor load logic into pcb-zen-core (#33)
* wip

* RemoteFetcher

* refactor load logic

* update bundle

* updates

* cleanup

* fixes

* skip on windows

* remove unused
2025-07-18 15:12:53 -04:00
Lenny Khazan 345494f55b Fix symbols with multiple pads per pin + component orientation on back-side components (#34)
* Fix symbols with multiple pads per pin

* remove unused

* update layout syncing

* update snap for kicad 9.0.3

* Fix orientation syncing for back components

* update to kicad 9.0.3 on windows

* more robust kicad version in CI
2025-07-18 14:37:05 -04:00
Lenny Khazan b58d133104 Autogenerate net names for unnamed interface nets (#32) 2025-07-15 21:19:04 -07:00
Lenny Khazan aebd53ce61 Schematic layout persistence (#31)
* port changes from main repo

* persist sch position

* Update tests

* remove unused
2025-07-14 02:20:13 -04:00
Lenny Khazan d3b26cab66 Remove debug log (#29) 2025-07-12 10:30:52 -07:00
Lenny Khazan acff75845c Schematics Viewer v2 (#23)
* Support net symbols

* Run renderer tests in CI

* renderer -> LayoutEngine

* wip

* rename

* add examples

* support symbol "extends"

* start reworking layout engine + snapshot tests

* add examples

* wip add nets

* Add signature to ModuleValue

* tweaks

* per-component net labels

* movable

* WIP with ELK

* wip libavoid

* misc fix

* better

* betterer

* improvements

* more

* update

* junction detection

* better

* snapping and stuff

* fix re-rendering

* more better

* more

* cargo fmt

* update bg

* eslint

* cleanup, tests
2025-07-12 13:24:55 -04:00
Davide Asnaghi 1841f961e4 [TEST] bundler (#27)
* add file provider to bundler

* add tests for bundler

* add tests for bundler, with better load resolution

* unix compliant zip on windows
2025-07-10 23:18:43 -07:00
Davide Asnaghi 3345ba9410 add file provider to bundler (#26) 2025-07-10 21:34:59 -07:00
Davide Asnaghi 44891494ef [FMT] implement formatter (#25)
* add pcb fmt

* unify pcb path in extension

* change the name of the extension

* bundle buildifier

* better path res

* fix clippy

* recursive

* fix format

* fix one more

* cargo info

* fix format on save
2025-07-10 16:24:25 -07:00
Lenny Khazan 47d379eb84 Properly sync component sides (#24) 2025-07-07 16:44:31 -07:00
Davide Asnaghi e7a71f1fdb [MODULE] resolve workspace loads (#19)
* use load resolving with modules

* local package resolution

* fix spec

* update snapshots

* remove unnecessary code

* move to snapshot tests

* revert eval errors

* canonical cache

* make tests work on windows

* refresh snap

* do not shadow alias

* fix: Add serial_test to prevent race conditions in module loading tests

- Add serial_test dependency to pcb-zen crate
- Mark tests that use package aliases with #[serial_test::serial]
- This prevents race conditions with the global ALIAS_CACHE when tests run in parallel
- Fixes test failures on Ubuntu where path canonicalization differs from macOS
2025-07-06 23:34:42 -07:00
Lenny Khazan e36f2d0cc0 Add pcb clean (#22) 2025-07-07 02:28:36 -04:00
Lenny Khazan a8aa30d97e Optimize symbol library loading (#20)
* Fix incorrect symbol rendering in schematics viewer

* Cache symbol library

* update snaps
2025-07-07 01:50:17 -04:00
Davide Asnaghi f1a972ee59 kicad test (#18)
* add test for kicad

* cache dir in snapshots
2025-07-05 18:06:02 -04:00
Lenny Khazan d6ff024281 Update symbol handling, support gitlab packages (#14)
* Add Symbol() primitive

* Add print output to snaps

* gitlab support

* Add gitlab support, handle unnamed pins

* Add @kicad-symbols alias

* cargo fmt

* fmt

* update snap
2025-07-05 00:10:45 -04:00
Lenny Khazan 05ea979f76 Reduce code duplication (#12)
* DRY

* reduce is_list implementation length by 24%

* remove simple.rs
2025-07-04 00:04:54 -04:00
Lenny Khazan f75787dbf3 Standardize crate metadata (#10) 2025-07-02 23:40:29 -04:00
Lenny Khazan 143633eb14 Starlark -> Zener (#8) 2025-07-02 17:25:45 -04:00
Lenny Khazan cbaf6f765b remove net kwarg support 2025-07-02 16:42:02 -04:00