Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.7.3/schema.json",
"organizeImports": {
"enabled": true
},
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
"formatter": {
"enabled": true,
"indentStyle": "space"
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-pcb-component-overview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Anthropic from "@anthropic-ai/sdk"
import fs from "node:fs"
import path from "node:path"
import Anthropic from "@anthropic-ai/sdk"

// Read all the files in the src/pcb directory
const pcbDir = path.join(__dirname, "../src/pcb")
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-schematic-component-overview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Anthropic from "@anthropic-ai/sdk"
import fs from "node:fs"
import path from "node:path"
import Anthropic from "@anthropic-ai/sdk"

// Read all the files in the src/schematic directory
const schematicDir = path.join(__dirname, "../src/schematic")
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-source-component-overview.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Anthropic from "@anthropic-ai/sdk"
import fs from "node:fs"
import path from "node:path"
import Anthropic from "@anthropic-ai/sdk"

// Read all the files in the src/source directory
const sourceDir = path.join(__dirname, "../src/source")
Expand Down
2 changes: 1 addition & 1 deletion scripts/refactor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import fs from "node:fs"
import Anthropic from "@anthropic-ai/sdk"
// @ts-ignore
import refactorTemplate from "./refactor-template.md" with { type: "text" }
import fs from "node:fs"

const anthropic = new Anthropic()

Expand Down
4 changes: 2 additions & 2 deletions src/any_circuit_element.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { z } from "zod"
import * as cad from "./cad"
import * as pcb from "./pcb"
import * as sch from "./schematic"
import * as src from "./source"
import * as cad from "./cad"
import * as sim from "./simulation"
import * as src from "./source"
import {
expectStringUnionsMatch,
expectTypesMatch,
Expand Down
8 changes: 4 additions & 4 deletions src/cad/cad_component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { z } from "zod"
import { point3, type Point3 } from "../common"
import { rotation, length, type Rotation, type Length } from "../units"
import { layer_ref, type LayerRef } from "src/pcb"
import { type LayerRef, layer_ref } from "src/pcb"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"
import { type Point3, point3 } from "../common"
import { type Length, type Rotation, length, rotation } from "../units"

export const cad_component = z
.object({
Expand Down
8 changes: 4 additions & 4 deletions src/common/CircuitJsonError.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type {
PcbTraceError,
PcbPlacementError,
PcbPortNotMatchedError,
PcbAutoroutingError,
PcbComponentOutsideBoardError,
PcbFootprintOverlapError,
PcbMissingFootprintError,
PcbComponentOutsideBoardError,
PcbPlacementError,
PcbPortNotMatchedError,
PcbTraceError,
} from "src/pcb"
import type { SchematicError } from "src/schematic"

Expand Down
2 changes: 1 addition & 1 deletion src/common/FivePointAnchor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export type FivePointAnchor = "center" | "left" | "right" | "top" | "bottom"

Expand Down
2 changes: 1 addition & 1 deletion src/common/NinePointAnchor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export type NinePointAnchor =
| "top_left"
Expand Down
2 changes: 1 addition & 1 deletion src/common/point.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"
import { distance } from "../units"
import { expectTypesMatch } from "src/utils/expect-types-match"

export const point = z.object({
x: distance,
Expand Down
2 changes: 1 addition & 1 deletion src/common/point3.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"
import { distance } from "../units"
import { expectTypesMatch } from "src/utils/expect-types-match"

export const point3 = z.object({
x: distance,
Expand Down
2 changes: 1 addition & 1 deletion src/common/size.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from "zod"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const size = z.object({
width: z.number(),
Expand Down
2 changes: 1 addition & 1 deletion src/pcb/circuit_json_footprint_load_error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const circuit_json_footprint_load_error = z
.object({
Expand Down
2 changes: 1 addition & 1 deletion src/pcb/external_footprint_load_error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const external_footprint_load_error = z
.object({
Expand Down
48 changes: 24 additions & 24 deletions src/pcb/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,41 @@ export * from "./pcb_thermal_spoke"
export * from "./pcb_copper_pour"
export * from "./pcb_component_outside_board_error"

import type { CircuitJsonFootprintLoadError } from "./circuit_json_footprint_load_error"
import type { ExternalFootprintLoadError } from "./external_footprint_load_error"
import type { PcbAutoroutingError } from "./pcb_autorouting_error"
import type { PcbBoard } from "./pcb_board"
import type { PcbBreakoutPoint } from "./pcb_breakout_point"
import type { PcbComponent } from "./pcb_component"
import type { PcbComponentOutsideBoardError } from "./pcb_component_outside_board_error"
import type { PcbCopperPour } from "./pcb_copper_pour"
import type { PcbCutout } from "./pcb_cutout"
import type { PcbFootprintOverlapError } from "./pcb_footprint_overlap_error"
import type { PcbGroundPlane } from "./pcb_ground_plane"
import type { PcbGroundPlaneRegion } from "./pcb_ground_plane_region"
import type { PcbHole } from "./pcb_hole"
import type { PcbManualEditConflictWarning } from "./pcb_manual_edit_conflict_warning"
import type { PcbMissingFootprintError } from "./pcb_missing_footprint_error"
import type { PcbNet } from "./pcb_net"
import type { PcbPlacementError } from "./pcb_placement_error"
import type { PcbPlatedHole } from "./pcb_plated_hole"
import type { PcbPort } from "./pcb_port"
import type { PcbPortNotConnectedError } from "./pcb_port_not_connected_error"
import type { PcbPortNotMatchedError } from "./pcb_port_not_matched_error"
import type { PcbSilkscreenCircle } from "./pcb_silkscreen_circle"
import type { PcbSilkscreenLine } from "./pcb_silkscreen_line"
import type { PcbSilkscreenPath } from "./pcb_silkscreen_path"
import type { PcbSilkscreenRect } from "./pcb_silkscreen_rect"
import type { PcbSilkscreenText } from "./pcb_silkscreen_text"
import type { PcbSmtPad } from "./pcb_smtpad"
import type { PcbSolderPaste } from "./pcb_solder_paste"
import type { PcbText } from "./pcb_text"
import type { PcbThermalSpoke } from "./pcb_thermal_spoke"
import type { PcbTrace } from "./pcb_trace"
import type { PcbTraceError } from "./pcb_trace_error"
import type { PcbTraceHint } from "./pcb_trace_hint"
import type { PcbTraceMissingError } from "./pcb_trace_missing_error"
import type { PcbPortNotMatchedError } from "./pcb_port_not_matched_error"
import type { PcbPortNotConnectedError } from "./pcb_port_not_connected_error"
import type { PcbVia } from "./pcb_via"
import type { PcbNet } from "./pcb_net"
import type { PcbBoard } from "./pcb_board"
import type { PcbPlacementError } from "./pcb_placement_error"
import type { PcbMissingFootprintError } from "./pcb_missing_footprint_error"
import type { ExternalFootprintLoadError } from "./external_footprint_load_error"
import type { PcbManualEditConflictWarning } from "./pcb_manual_edit_conflict_warning"
import type { PcbTraceHint } from "./pcb_trace_hint"
import type { PcbSilkscreenLine } from "./pcb_silkscreen_line"
import type { PcbSilkscreenPath } from "./pcb_silkscreen_path"
import type { PcbSilkscreenText } from "./pcb_silkscreen_text"
import type { PcbSilkscreenRect } from "./pcb_silkscreen_rect"
import type { PcbSilkscreenCircle } from "./pcb_silkscreen_circle"
import type { PcbAutoroutingError } from "./pcb_autorouting_error"
import type { PcbFootprintOverlapError } from "./pcb_footprint_overlap_error"
import type { PcbCutout } from "./pcb_cutout"
import type { PcbBreakoutPoint } from "./pcb_breakout_point"
import type { PcbGroundPlane } from "./pcb_ground_plane"
import type { PcbGroundPlaneRegion } from "./pcb_ground_plane_region"
import type { PcbThermalSpoke } from "./pcb_thermal_spoke"
import type { PcbCopperPour } from "./pcb_copper_pour"
import type { PcbComponentOutsideBoardError } from "./pcb_component_outside_board_error"
import type { CircuitJsonFootprintLoadError } from "./circuit_json_footprint_load_error"

export type PcbCircuitElement =
| PcbComponent
Expand Down
2 changes: 1 addition & 1 deletion src/pcb/pcb_autorouting_error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_autorouting_error = z
.object({
Expand Down
6 changes: 3 additions & 3 deletions src/pcb/pcb_board.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod"
import { point, type Point, getZodPrefixedIdWithDefault } from "src/common"
import { length, type Length } from "src/units"
import { type Point, getZodPrefixedIdWithDefault, point } from "src/common"
import { type Length, length } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_board = z
.object({
Expand Down
4 changes: 2 additions & 2 deletions src/pcb/pcb_breakout_point.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { distance, type Distance } from "src/units"
import { type Distance, distance } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_breakout_point = z
.object({
Expand Down
8 changes: 4 additions & 4 deletions src/pcb/pcb_component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { z } from "zod"
import { point, type Point, getZodPrefixedIdWithDefault } from "src/common"
import { layer_ref, type LayerRef } from "src/pcb/properties/layer_ref"
import { rotation, length, type Rotation, type Length } from "src/units"
import { type Point, getZodPrefixedIdWithDefault, point } from "src/common"
import { type LayerRef, layer_ref } from "src/pcb/properties/layer_ref"
import { type Length, type Rotation, length, rotation } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_component = z
.object({
Expand Down
4 changes: 2 additions & 2 deletions src/pcb/pcb_component_outside_board_error.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { point, type Point } from "src/common"
import { type Point, point } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_component_outside_board_error = z
.object({
Expand Down
10 changes: 5 additions & 5 deletions src/pcb/pcb_copper_pour.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { z } from "zod"
import { point, type Point, getZodPrefixedIdWithDefault } from "src/common"
import { length, type Length, rotation, type Rotation } from "src/units"
import { layer_ref, type LayerRef } from "./properties/layer_ref"
import { type Point, getZodPrefixedIdWithDefault, point } from "src/common"
import { type Length, type Rotation, length, rotation } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { brep_shape, type BRepShape } from "./properties/brep"
import { z } from "zod"
import { type BRepShape, brep_shape } from "./properties/brep"
import { type LayerRef, layer_ref } from "./properties/layer_ref"

// Common properties base for all pour shapes (internal)
const pcb_copper_pour_base = z.object({
Expand Down
6 changes: 3 additions & 3 deletions src/pcb/pcb_cutout.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod"
import { point, type Point, getZodPrefixedIdWithDefault } from "src/common"
import { length, type Length, rotation, type Rotation } from "src/units"
import { type Point, getZodPrefixedIdWithDefault, point } from "src/common"
import { type Length, type Rotation, length, rotation } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

// Common properties base for all cutout shapes (internal)
const pcb_cutout_base = z.object({
Expand Down
8 changes: 4 additions & 4 deletions src/pcb/pcb_fabrication_note_path.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { type Point, point } from "src/common"
import {
type LayerRef,
layer_ref,
visible_layer,
type LayerRef,
} from "src/pcb/properties/layer_ref"
import { point, type Point } from "src/common"
import { length, type Length } from "src/units"
import { type Length, length } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_fabrication_note_path = z
.object({
Expand Down
10 changes: 5 additions & 5 deletions src/pcb/pcb_fabrication_note_text.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { z } from "zod"
import { point, type Point } from "src/common"
import { distance, type Length } from "src/units"
import { type Point, point } from "src/common"
import { getZodPrefixedIdWithDefault } from "src/common/getZodPrefixedIdWithDefault"
import {
visible_layer,
type LayerRef,
type VisibleLayer,
visible_layer,
} from "src/pcb/properties/layer_ref"
import { getZodPrefixedIdWithDefault } from "src/common/getZodPrefixedIdWithDefault"
import { type Length, distance } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_fabrication_note_text = z
.object({
Expand Down
2 changes: 1 addition & 1 deletion src/pcb/pcb_footprint_overlap_error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_footprint_overlap_error = z
.object({
Expand Down
2 changes: 1 addition & 1 deletion src/pcb/pcb_ground_plane.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_ground_plane = z
.object({
Expand Down
6 changes: 3 additions & 3 deletions src/pcb/pcb_ground_plane_region.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod"
import { point, type Point, getZodPrefixedIdWithDefault } from "src/common"
import { layer_ref, type LayerRef } from "src/pcb/properties/layer_ref"
import { type Point, getZodPrefixedIdWithDefault, point } from "src/common"
import { type LayerRef, layer_ref } from "src/pcb/properties/layer_ref"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_ground_plane_region = z
.object({
Expand Down
6 changes: 3 additions & 3 deletions src/pcb/pcb_group.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod"
import { point, type Point, getZodPrefixedIdWithDefault } from "src/common"
import { length, type Length } from "src/units"
import { type Point, getZodPrefixedIdWithDefault, point } from "src/common"
import { type Length, length } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_group = z
.object({
Expand Down
4 changes: 2 additions & 2 deletions src/pcb/pcb_hole.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { distance, type Distance } from "src/units"
import { type Distance, distance } from "src/units"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

const pcb_hole_circle_or_square = z.object({
type: z.literal("pcb_hole"),
Expand Down
4 changes: 2 additions & 2 deletions src/pcb/pcb_keepout.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"
import { point, type Point } from "../common"
import { type Point, point } from "../common"
import { distance } from "../units"
import { expectTypesMatch } from "src/utils/expect-types-match"

export const pcb_keepout = z
.object({
Expand Down
2 changes: 1 addition & 1 deletion src/pcb/pcb_missing_footprint_error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_missing_footprint_error = z
.object({
Expand Down
2 changes: 1 addition & 1 deletion src/pcb/pcb_net.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_net = z
.object({
Expand Down
2 changes: 1 addition & 1 deletion src/pcb/pcb_placement_error.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod"
import { getZodPrefixedIdWithDefault } from "src/common"
import { expectTypesMatch } from "src/utils/expect-types-match"
import { z } from "zod"

export const pcb_placement_error = z
.object({
Expand Down
Loading