Skip to content

Comments

Add pin capability enums to PinAttributeMap and remove protocol booleans#601

Merged
seveibar merged 1 commit intomainfrom
codex/add-capabilities-to-pin-attribute-map
Feb 21, 2026
Merged

Add pin capability enums to PinAttributeMap and remove protocol booleans#601
seveibar merged 1 commit intomainfrom
codex/add-capabilities-to-pin-attribute-map

Conversation

@seveibar
Copy link
Contributor

Motivation

  • Consolidate protocol-specific boolean flags into a flexible capability model so pins can declare multiple supported protocols and a current/active protocol.
  • Replace scattered fields like isI2cSda / isSpiMiso / isSpiSck with a single typed set of capability values to simplify typing and runtime validation.
  • Provide explicit runtime schema for capabilities to prevent invalid protocol names and enable typed tooling and docs to reflect the change.

Description

  • Replaced protocol boolean fields in PinAttributeMap with three new fields: capabilities?: Array<...>, activeCapabilities?: Array<...>, and activeCapability?: ... in lib/common/layout.ts using the enum values "i2c_sda", "i2c_scl", "spi_cs", "spi_sck", "spi_mosi", "spi_miso", "uart_tx", "uart_rx".
  • Updated the Zod runtime schema pinAttributeMap to validate the new capabilities, activeCapabilities, and activeCapability fields with constrained z.enum values.
  • Updated tests to use the new fields (modified tests/pinAttributes2.test.ts and tests/chip3-type-tests.test.tsx) so runtime parsing and type-level checks exercise the new model.
  • Regenerated generated documentation artifacts (generated/COMPONENT_TYPES.md, generated/PROPS_OVERVIEW.md) so docs reflect the new PinAttributeMap shape and ran formatting to keep repository consistent.

Testing

  • Ran generation scripts: bun scripts/generate-component-types.ts, bun scripts/generate-manual-edits-docs.ts, bun scripts/generate-readme-docs.ts, and bun scripts/generate-props-overview.ts and updated generated outputs.
  • Ran unit/typetests: bun test tests/pinAttributes2.test.ts tests/chip3-type-tests.test.tsx and observed all tests passing (6 pass, 0 fail).
  • Performed TypeScript typecheck with bunx tsc --noEmit which completed without errors.
  • Ran formatter via bun run format and re-ran bun test to confirm tests still pass after formatting.

Codex Task

@seveibar seveibar merged commit 4039ec9 into main Feb 21, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant