Skip to content

Add stdlib prelude (Power, Ground, NotConnected, Layout, Board)#606

Merged
akhilles merged 1 commit intomainfrom
add-stdlib-prelude
Mar 6, 2026
Merged

Add stdlib prelude (Power, Ground, NotConnected, Layout, Board)#606
akhilles merged 1 commit intomainfrom
add-stdlib-prelude

Conversation

@akhilles
Copy link
Contributor

@akhilles akhilles commented Mar 6, 2026

Make Power, Ground, NotConnected, Layout, and Board implicitly available in user .zen files without explicit load() statements. Remove now-redundant imports across all .zen files, tests, examples, and docs.


Note

Medium Risk
Touches core evaluation and symbol indexing behavior by injecting globals into every user module, which can affect name resolution, load order, and tests (notably net auto-naming); broad surface-area changes but scoped to a small, explicit symbol set with opt-out.

Overview
Adds an evaluator stdlib prelude that auto-injects Power, Ground, NotConnected, Layout, and Board into user .zen module scope (with an opt-out flag and automatic disabling for stdlib modules to avoid cycles), and ensures LSP symbol indexing also resolves these implicit symbols.

Refactors test harnesses to materialize embedded stdlib .zen sources in-memory (stdlib_files_for_tests/eval_zen) and updates snapshots to account for changed net auto-naming (including regex sanitization in one CLI test).

Cleans up repo usage by removing redundant load() statements across examples/tests/templates/docs, documenting the prelude in docs/pages/spec.mdx, and dropping the embedded stdlib/docs/spec.md.

Written by Cursor Bugbot for commit dede52b. This will update automatically on new commits. Configure here.

@github-actions
Copy link

github-actions bot commented Mar 6, 2026

Build Performance

Board Base (median) Head (median) Change
demo/DM0001 114ms ±6 115ms ±5 +0.7%
demo/DM0002 100ms ±2 101ms ±2 +1.7%
demo/DM0003 109ms ±3 119ms ±2 1.08× ±0.04 slower
arduino/Nano 79ms ±1 85ms ±2 1.08× ±0.03 slower
arduino/UNOQ 159ms ±11 171ms ±3 +7.5%

Measured with hyperfine. Times show median ±stddev.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

("2.54mm", 2, 16, "Vertical", "Male", "SMD"): WR_PHD_2_54_SMD_MALE_DUAL(32),
("2.54mm", 2, 17, "Vertical", "Male", "SMD"): WR_PHD_2_54_SMD_MALE_DUAL(34),
("2.54mm", 2, 18, "Vertical", "Male", "SMD"): WR_PHD_2_54_SMD_MALE_DUAL(36),
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Directory name typo "manufactuers" in new stdlib path

Medium Severity

The new file is placed under stdlib/bom/manufactuers/ which is a misspelling of "manufacturers". Since this becomes part of the stdlib import path (e.g., load("@stdlib/bom/manufactuers/wurth_electronik.zen", ...)), fixing this typo later would be a breaking change for any downstream consumers.

Fix in Cursor Fix in Web

Make Power, Ground, NotConnected, Layout, and Board implicitly available
in user .zen files without explicit load() statements. Remove
now-redundant imports across all .zen files, tests, examples, and docs.
@akhilles akhilles force-pushed the add-stdlib-prelude branch from 49b0dd9 to dede52b Compare March 6, 2026 23:34
@akhilles akhilles merged commit 0a000c5 into main Mar 6, 2026
12 checks passed
@akhilles akhilles deleted the add-stdlib-prelude branch March 6, 2026 23:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants