tsci-agent 0.1.0

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.
Files changed (101) hide show
  1. package/README.md +60 -0
  2. package/dist/cli.js +280061 -0
  3. package/dist/skill/CHECKLIST.md +26 -0
  4. package/dist/skill/CLI.md +180 -0
  5. package/dist/skill/LICENSE +21 -0
  6. package/dist/skill/README.md +32 -0
  7. package/dist/skill/SKILL.md +163 -0
  8. package/dist/skill/SYNTAX.md +229 -0
  9. package/dist/skill/WORKFLOW.md +92 -0
  10. package/dist/skill/elements/analogsimulation.md +32 -0
  11. package/dist/skill/elements/battery.md +24 -0
  12. package/dist/skill/elements/board.md +23 -0
  13. package/dist/skill/elements/breakout.md +68 -0
  14. package/dist/skill/elements/breakoutpoint.md +27 -0
  15. package/dist/skill/elements/cadassembly.md +39 -0
  16. package/dist/skill/elements/cadmodel.md +31 -0
  17. package/dist/skill/elements/capacitor.md +28 -0
  18. package/dist/skill/elements/chip.md +44 -0
  19. package/dist/skill/elements/connector.md +125 -0
  20. package/dist/skill/elements/constraint.md +73 -0
  21. package/dist/skill/elements/copperpour.md +34 -0
  22. package/dist/skill/elements/coppertext.md +28 -0
  23. package/dist/skill/elements/courtyardcircle.md +32 -0
  24. package/dist/skill/elements/courtyardoutline.md +42 -0
  25. package/dist/skill/elements/courtyardpill.md +29 -0
  26. package/dist/skill/elements/courtyardrect.md +38 -0
  27. package/dist/skill/elements/crystal.md +28 -0
  28. package/dist/skill/elements/currentsource.md +26 -0
  29. package/dist/skill/elements/cutout.md +35 -0
  30. package/dist/skill/elements/diode.md +23 -0
  31. package/dist/skill/elements/fabricationnotedimension.md +27 -0
  32. package/dist/skill/elements/fabricationnotepath.md +29 -0
  33. package/dist/skill/elements/fabricationnoterect.md +40 -0
  34. package/dist/skill/elements/fabricationnotetext.md +32 -0
  35. package/dist/skill/elements/fiducial.md +34 -0
  36. package/dist/skill/elements/footprint.md +95 -0
  37. package/dist/skill/elements/fuse.md +28 -0
  38. package/dist/skill/elements/group.md +29 -0
  39. package/dist/skill/elements/hole.md +23 -0
  40. package/dist/skill/elements/inductor.md +27 -0
  41. package/dist/skill/elements/jumper.md +23 -0
  42. package/dist/skill/elements/led.md +23 -0
  43. package/dist/skill/elements/mosfet.md +26 -0
  44. package/dist/skill/elements/mountedboard.md +26 -0
  45. package/dist/skill/elements/net.md +27 -0
  46. package/dist/skill/elements/netalias.md +25 -0
  47. package/dist/skill/elements/netlabel.md +60 -0
  48. package/dist/skill/elements/opamp.md +30 -0
  49. package/dist/skill/elements/panel.md +24 -0
  50. package/dist/skill/elements/pcbkeepout.md +22 -0
  51. package/dist/skill/elements/pcbnotedimension.md +31 -0
  52. package/dist/skill/elements/pcbnoteline.md +30 -0
  53. package/dist/skill/elements/pcbnotepath.md +31 -0
  54. package/dist/skill/elements/pcbnoterect.md +30 -0
  55. package/dist/skill/elements/pcbnotetext.md +29 -0
  56. package/dist/skill/elements/pcbtrace.md +30 -0
  57. package/dist/skill/elements/pinheader.md +34 -0
  58. package/dist/skill/elements/pinout.md +26 -0
  59. package/dist/skill/elements/platedhole.md +34 -0
  60. package/dist/skill/elements/port.md +38 -0
  61. package/dist/skill/elements/potentiometer.md +27 -0
  62. package/dist/skill/elements/pushbutton.md +26 -0
  63. package/dist/skill/elements/resistor.md +27 -0
  64. package/dist/skill/elements/resonator.md +28 -0
  65. package/dist/skill/elements/schematicarc.md +39 -0
  66. package/dist/skill/elements/schematicbox.md +22 -0
  67. package/dist/skill/elements/schematiccell.md +26 -0
  68. package/dist/skill/elements/schematiccircle.md +36 -0
  69. package/dist/skill/elements/schematicline.md +39 -0
  70. package/dist/skill/elements/schematicpath.md +40 -0
  71. package/dist/skill/elements/schematicrect.md +38 -0
  72. package/dist/skill/elements/schematicrow.md +26 -0
  73. package/dist/skill/elements/schematicsection.md +91 -0
  74. package/dist/skill/elements/schematictable.md +48 -0
  75. package/dist/skill/elements/schematictext.md +23 -0
  76. package/dist/skill/elements/silkscreencircle.md +27 -0
  77. package/dist/skill/elements/silkscreenline.md +31 -0
  78. package/dist/skill/elements/silkscreenpath.md +70 -0
  79. package/dist/skill/elements/silkscreenrect.md +25 -0
  80. package/dist/skill/elements/silkscreentext.md +23 -0
  81. package/dist/skill/elements/smtpad.md +35 -0
  82. package/dist/skill/elements/solderjumper.md +21 -0
  83. package/dist/skill/elements/subcircuit.md +29 -0
  84. package/dist/skill/elements/subpanel.md +26 -0
  85. package/dist/skill/elements/switch.md +21 -0
  86. package/dist/skill/elements/symbol.md +54 -0
  87. package/dist/skill/elements/testpoint.md +26 -0
  88. package/dist/skill/elements/trace.md +28 -0
  89. package/dist/skill/elements/tracehint.md +24 -0
  90. package/dist/skill/elements/transistor.md +25 -0
  91. package/dist/skill/elements/via.md +30 -0
  92. package/dist/skill/elements/voltageprobe.md +36 -0
  93. package/dist/skill/elements/voltagesource.md +36 -0
  94. package/dist/skill/scripts/export_svgs.sh +23 -0
  95. package/dist/skill/scripts/fetch_ai_txt.sh +15 -0
  96. package/dist/skill/scripts/smoke_test.sh +48 -0
  97. package/dist/skill/templates/arduino-shield-led.tsx +14 -0
  98. package/dist/skill/templates/chip-with-pinouts.tsx +65 -0
  99. package/dist/skill/templates/group-layout.tsx +13 -0
  100. package/dist/skill/templates/minimal-board.tsx +13 -0
  101. package/package.json +39 -0
@@ -0,0 +1,35 @@
1
+ # `<smtpad />`
2
+
3
+ The `<smtpad />` element is used to represent a surface mount pad.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <board width="10mm" height="10mm">
10
+ <chip name="U1" footprint={
11
+ <footprint>
12
+ <smtpad
13
+ pcbX="0mm"
14
+ pcbY="0mm"
15
+ layer="top"
16
+ shape="rect"
17
+ width="5mm"
18
+ height="5mm"
19
+ portHints={["pin1"]}
20
+ />
21
+ </footprint>
22
+ } />
23
+ </board>
24
+ )
25
+ ```
26
+
27
+ ## Props
28
+
29
+ Commonly used: `name`, `shape`, `width`, `height`, `rectBorderRadius`, `cornerRadius`, `portHints`, `coveredWithSolderMask`
30
+
31
+ ## References
32
+
33
+ - Props: [RectSmtPadProps](https://github.com/tscircuit/props#rectsmtpadprops-smtpad)
34
+ - Source: [lib/components/smtpad.ts](https://github.com/tscircuit/props/blob/main/lib/components/smtpad.ts)
35
+ - Local docs: [docs/docs/footprints/smtpad.mdx](../docs/docs/footprints/smtpad.mdx)
@@ -0,0 +1,21 @@
1
+ # `<solderjumper />`
2
+
3
+ Small pads that can be cut or bridged with solder for configuration options.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <solderjumper name="SJ1" footprint="solderjumper2_bridged12" bridgedPins={[["1","2"]]} />
10
+ )
11
+ ```
12
+
13
+ ## Props
14
+
15
+ Commonly used: `bridgedPins`, `bridged`, `name`, `footprint`, `connections`
16
+
17
+ ## References
18
+
19
+ - Props: [SolderJumperProps](https://github.com/tscircuit/props#solderjumperprops-solderjumper)
20
+ - Source: [lib/components/solderjumper.ts](https://github.com/tscircuit/props/blob/main/lib/components/solderjumper.ts)
21
+ - Local docs: [docs/docs/elements/solderjumper.mdx](../docs/docs/elements/solderjumper.mdx)
@@ -0,0 +1,29 @@
1
+ # `<subcircuit />`
2
+
3
+ A `<subcircuit />` is a powerful organizational element in tscircuit that represents a collection of elements that are tightly coupled. Subcircuits are often used for a small functional block, such as a voltage regulator.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <board width="10mm" height="10mm">
10
+ <subcircuit name="subcircuit1" schX={-2}>
11
+ <resistor name="R1" resistance="1k" footprint="0402" />
12
+ </subcircuit>
13
+ <subcircuit name="subcircuit2" schX={2}>
14
+ <resistor name="R2" resistance="1k" footprint="0402" />
15
+ </subcircuit>
16
+ <trace from=".subcircuit1 .R1 .pin1" to=".subcircuit2 .R2 .pin1" />
17
+ </board>
18
+ )
19
+ ```
20
+
21
+ ## Props
22
+
23
+ Commonly used: `name`, `footprint`, `connections`
24
+
25
+ ## References
26
+
27
+ - Props: [SubcircuitProps](https://github.com/tscircuit/props#subcircuitprops-subcircuit)
28
+ - Source: [lib/components/subcircuit.ts](https://github.com/tscircuit/props/blob/main/lib/components/subcircuit.ts)
29
+ - Local docs: [docs/docs/elements/subcircuit.mdx](../docs/docs/elements/subcircuit.mdx)
@@ -0,0 +1,26 @@
1
+ # `<subpanel />`
2
+
3
+ Nested grouping inside a manufacturing `<panel />`.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <panel width="100mm" height="80mm">
10
+ <subpanel layoutMode="grid" boardGap="2mm">
11
+ <board width="20mm" height="10mm" />
12
+ <board width="20mm" height="10mm" />
13
+ </subpanel>
14
+ </panel>
15
+ )
16
+ ```
17
+
18
+ ## Props
19
+
20
+ Commonly used: `width`, `height`, `children`
21
+
22
+ ## References
23
+
24
+ - Props: [SubpanelProps](https://github.com/tscircuit/props#subpanelprops-subpanel)
25
+ - Source: [lib/components/subpanel.ts](https://github.com/tscircuit/props/blob/main/lib/components/subpanel.ts)
26
+ - Local docs: [docs/docs/guides/tscircuit-essentials/panelization.mdx](../docs/docs/guides/tscircuit-essentials/panelization.mdx)
@@ -0,0 +1,21 @@
1
+ # `<switch />`
2
+
3
+ A switch is a mechanical device that can be used to connect or disconnect a circuit.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <switch name="SW1" type="spst" />
10
+ )
11
+ ```
12
+
13
+ ## Props
14
+
15
+ Commonly used: `type`, `isNormallyClosed`, `spdt`, `spst`, `dpst`, `dpdt`, `simSwitchFrequency`, `simCloseAt`
16
+
17
+ ## References
18
+
19
+ - Props: [SwitchProps](https://github.com/tscircuit/props#switchprops-switch)
20
+ - Source: [lib/components/switch.ts](https://github.com/tscircuit/props/blob/main/lib/components/switch.ts)
21
+ - Local docs: [docs/docs/elements/switch.mdx](../docs/docs/elements/switch.mdx)
@@ -0,0 +1,54 @@
1
+ # `<symbol />`
2
+
3
+ Used to define custom schematic representations for chips using primitive drawing components like rectangles, circles, lines, and arcs.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <board width="10mm" height="10mm">
10
+ <chip
11
+ name="Q1"
12
+ symbol={
13
+ <symbol>
14
+ {/* Outer circle */}
15
+ <schematiccircle center={{ x: 0.1, y: 0 }} radius={0.55} isFilled={false} strokeWidth={0.05} />
16
+ {/* Base vertical bar */}
17
+ <schematicline x1={-0.1} y1={-0.5} x2={-0.1} y2={0.5} strokeWidth={0.05} />
18
+ {/* Base input line */}
19
+ <schematicline x1={-0.7} y1={0} x2={-0.1} y2={0} strokeWidth={0.05} />
20
+ {/* Collector line (diagonal then vertical) */}
21
+ <schematicline x1={-0.1} y1={0.2} x2={0.35} y2={0.5} strokeWidth={0.05} />
22
+ <schematicline x1={0.35} y1={0.5} x2={0.35} y2={1} strokeWidth={0.05} />
23
+ {/* Emitter line (diagonal then vertical) */}
24
+ <schematicline x1={-0.1} y1={-0.2} x2={0.35} y2={-0.5} strokeWidth={0.05} />
25
+ <schematicline x1={0.35} y1={-0.5} x2={0.35} y2={-1} strokeWidth={0.05} />
26
+ {/* Emitter arrow (V shape pointing outward along emitter line) */}
27
+ <schematicpath
28
+ strokeWidth={0.05}
29
+ points={[
30
+ { x: 0.16, y: -0.25},
31
+ { x: 0.2, y: -0.40 },
32
+ { x: 0.06, y: -0.44 },
33
+ ]}
34
+ />
35
+ {/* Ports */}
36
+ <port name="B" direction="left" schX={-0.7} schY={0} />
37
+ <port name="C" direction="up" schX={0.35} schY={1} />
38
+ <port name="E" direction="down" schX={0.35} schY={-1} />
39
+ </symbol>
40
+ }
41
+ />
42
+ </board>
43
+ )
44
+ ```
45
+
46
+ ## Props
47
+
48
+ Commonly used: `originalFacingDirection`, `width`, `height`, `name`, `footprint`, `connections`
49
+
50
+ ## References
51
+
52
+ - Props: [SymbolProps](https://github.com/tscircuit/props#symbolprops-symbol)
53
+ - Source: [lib/components/symbol.ts](https://github.com/tscircuit/props/blob/main/lib/components/symbol.ts)
54
+ - Local docs: [docs/docs/elements/symbol.mdx](../docs/docs/elements/symbol.mdx)
@@ -0,0 +1,26 @@
1
+ # `<testpoint />`
2
+
3
+ A `<testpoint />` is a designated location on a PCB that provides easy access for testing, debugging, and measuring electrical signals. Test points are essential for troubleshooting circuits and verifying proper operation during development and manufacturing.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <testpoint
10
+ name="TP1"
11
+ footprintVariant="pad"
12
+ padShape="circle"
13
+ padDiameter="1mm"
14
+ />
15
+ )
16
+ ```
17
+
18
+ ## Props
19
+
20
+ Commonly used: `footprintVariant`, `padShape`, `padDiameter`, `holeDiameter`, `width`, `height`, `connections`, `name`
21
+
22
+ ## References
23
+
24
+ - Props: [TestpointProps](https://github.com/tscircuit/props#testpointprops-testpoint)
25
+ - Source: [lib/components/testpoint.ts](https://github.com/tscircuit/props/blob/main/lib/components/testpoint.ts)
26
+ - Local docs: [docs/docs/elements/testpoint.mdx](../docs/docs/elements/testpoint.mdx)
@@ -0,0 +1,28 @@
1
+ # `<trace />`
2
+
3
+ The `<trace />` element represents an electrical connection between two or more points in your circuit. Traces can connect components, nets, or specific pins on components.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <board width="10mm" height="10mm">
10
+ <resistor name="R1" resistance="1k" footprint="0402" pcbX={-2} schX={-2} />
11
+ <capacitor name="C1" capacitance="100nF" footprint="0402" pcbX={2} />
12
+ <trace
13
+ from=".R1 > .pin1"
14
+ to=".C1 > .pin1"
15
+ />
16
+ </board>
17
+ )
18
+ ```
19
+
20
+ ## Props
21
+
22
+ Commonly used: `via`, `fromLayer`, `toLayer`, `code`, `message`, `path`, `key`, `thickness`
23
+
24
+ ## References
25
+
26
+ - Props: [TraceProps](https://github.com/tscircuit/props#traceprops-trace)
27
+ - Source: [lib/components/trace.ts](https://github.com/tscircuit/props/blob/main/lib/components/trace.ts)
28
+ - Local docs: [docs/docs/elements/trace.mdx](../docs/docs/elements/trace.mdx)
@@ -0,0 +1,24 @@
1
+ # `<tracehint />`
2
+
3
+ Autorouter hint that nudges a trace through preferred points.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <board width="20mm" height="12mm">
10
+ <trace from=".U1 > .pin1" to=".R1 > .pin1">
11
+ <tracehint offset={{ x: 0, y: 3 }} />
12
+ </trace>
13
+ </board>
14
+ )
15
+ ```
16
+
17
+ ## Props
18
+
19
+ Commonly used: `x`, `y`, `via`, `toLayer`, `for`, `order`, `offset`, `offsets`
20
+
21
+ ## References
22
+
23
+ - Props: [TraceHintProps](https://github.com/tscircuit/props#tracehintprops-tracehint)
24
+ - Source: [lib/components/trace-hint.ts](https://github.com/tscircuit/props/blob/main/lib/components/trace-hint.ts)
@@ -0,0 +1,25 @@
1
+ # `<transistor />`
2
+
3
+ A transistor is a three-terminal semiconductor device that can amplify or switch electronic signals. It is a fundamental component in many electronic circuits, including amplifiers, oscillators, and digital logic gates.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <transistor
10
+ name="Q1"
11
+ type="npn"
12
+ footprint="sot23"
13
+ />
14
+ )
15
+ ```
16
+
17
+ ## Props
18
+
19
+ Commonly used: `type`, `connections`, `name`, `footprint`
20
+
21
+ ## References
22
+
23
+ - Props: [TransistorProps](https://github.com/tscircuit/props#transistorprops-transistor)
24
+ - Source: [lib/components/transistor.ts](https://github.com/tscircuit/props/blob/main/lib/components/transistor.ts)
25
+ - Local docs: [docs/docs/elements/transistor.mdx](../docs/docs/elements/transistor.mdx)
@@ -0,0 +1,30 @@
1
+ # `<via />`
2
+
3
+ A via is a plated hole that connects different layers of a PCB. Vias are commonly used to route traces between layers and for thermal management.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <board width={5} height={5}>
10
+ <via
11
+ fromLayer="top"
12
+ toLayer="bottom"
13
+ outerDiameter="0.8mm"
14
+ holeDiameter="0.4mm"
15
+ pcbX={0}
16
+ pcbY={0}
17
+ />
18
+ </board>
19
+ )
20
+ ```
21
+
22
+ ## Props
23
+
24
+ Commonly used: `name`, `fromLayer`, `toLayer`, `holeDiameter`, `outerDiameter`, `connectsTo`, `netIsAssignable`, `footprint`
25
+
26
+ ## References
27
+
28
+ - Props: [ViaProps](https://github.com/tscircuit/props#viaprops-via)
29
+ - Source: [lib/components/via.ts](https://github.com/tscircuit/props/blob/main/lib/components/via.ts)
30
+ - Local docs: [docs/docs/elements/via.mdx](../docs/docs/elements/via.mdx)
@@ -0,0 +1,36 @@
1
+ # `<voltageprobe />`
2
+
3
+ Measure voltages at specific nodes during SPICE simulation.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <board routingDisabled>
10
+ <voltagesource name="V1" voltage="5V" />
11
+ <resistor name="R1" resistance="1k" />
12
+ <resistor name="R2" resistance="1k" />
13
+
14
+ <trace from=".V1 > .pin1" to="net.VCC" />
15
+ <trace from="net.VCC" to=".R1 > .pin1" />
16
+ <trace from=".R1 > .pin2" to=".R2 > .pin1" />
17
+ <trace from=".R2 > .pin2" to="net.GND" />
18
+ <trace from="net.GND" to=".V1 > .pin2" />
19
+
20
+ <voltageprobe name="VP_R1" connectsTo=".R1 > .pin1" />
21
+ <voltageprobe name="VP_R2" connectsTo=".R2 > .pin1" />
22
+
23
+ <analogsimulation duration="10ms" timePerStep="0.1ms" spiceEngine="ngspice" />
24
+ </board>
25
+ )
26
+ ```
27
+
28
+ ## Props
29
+
30
+ Commonly used: `name`, `connectsTo`, `referenceTo`, `color`, `footprint`, `connections`
31
+
32
+ ## References
33
+
34
+ - Props: [VoltageProbeProps](https://github.com/tscircuit/props#voltageprobeprops-voltageprobe)
35
+ - Source: [lib/components/voltageprobe.ts](https://github.com/tscircuit/props/blob/main/lib/components/voltageprobe.ts)
36
+ - Local docs: [docs/docs/elements/voltageprobe.mdx](../docs/docs/elements/voltageprobe.mdx)
@@ -0,0 +1,36 @@
1
+ # `<voltagesource />`
2
+
3
+ Add a voltage source for SPICE simulations and schematic power inputs.
4
+
5
+ ## Example
6
+
7
+ ```tsx
8
+ export default () => (
9
+ <board routingDisabled>
10
+ <voltagesource
11
+ name="V1"
12
+ waveShape="square"
13
+ voltage="5V"
14
+ frequency="1kHz"
15
+ dutyCycle={0.5}
16
+ />
17
+ <resistor name="R1" resistance="1k" />
18
+
19
+ <trace from=".V1 > .pin1" to=".R1 > .pin1" />
20
+ <trace from=".V1 > .pin2" to=".R1 > .pin2" />
21
+
22
+ <voltageprobe name="VP_OUT" connectsTo=".R1 > .pin1" />
23
+ <analogsimulation duration="5ms" timePerStep="0.05ms" spiceEngine="ngspice" />
24
+ </board>
25
+ )
26
+ ```
27
+
28
+ ## Props
29
+
30
+ Commonly used: `voltage`, `frequency`, `peakToPeakVoltage`, `waveShape`, `phase`, `dutyCycle`, `connections`, `name`
31
+
32
+ ## References
33
+
34
+ - Props: [VoltageSourceProps](https://github.com/tscircuit/props#voltagesourceprops-voltagesource)
35
+ - Source: [lib/components/voltagesource.ts](https://github.com/tscircuit/props/blob/main/lib/components/voltagesource.ts)
36
+ - Local docs: [docs/docs/elements/voltagesource.mdx](../docs/docs/elements/voltagesource.mdx)
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if ! command -v tsci >/dev/null 2>&1; then
5
+ echo "tsci not found. Install it first:" >&2
6
+ echo " npm install -g tscircuit" >&2
7
+ echo " # or" >&2
8
+ echo " bun install --global tscircuit" >&2
9
+ exit 127
10
+ fi
11
+
12
+ FILE="${1:-index.circuit.tsx}"
13
+ BASE="${FILE%.*}"
14
+
15
+ OUT_SCHEM="${BASE}-schematic.svg"
16
+ OUT_PCB="${BASE}-pcb.svg"
17
+
18
+ tsci export "$FILE" -f schematic-svg -o "$OUT_SCHEM"
19
+ tsci export "$FILE" -f pcb-svg -o "$OUT_PCB"
20
+
21
+ echo "Wrote:" >&2
22
+ echo " $OUT_SCHEM" >&2
23
+ echo " $OUT_PCB" >&2
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ OUT="${1:-ai.txt}"
5
+
6
+ if command -v curl >/dev/null 2>&1; then
7
+ curl -L "https://docs.tscircuit.com/ai.txt" -o "$OUT"
8
+ elif command -v wget >/dev/null 2>&1; then
9
+ wget -O "$OUT" "https://docs.tscircuit.com/ai.txt"
10
+ else
11
+ echo "Neither curl nor wget found. Install one of them to download ai.txt" >&2
12
+ exit 127
13
+ fi
14
+
15
+ echo "Wrote $OUT" >&2
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ if ! command -v tsci >/dev/null 2>&1; then
5
+ echo "tsci not found. Install it first:" >&2
6
+ echo " npm install -g tscircuit" >&2
7
+ echo " # or" >&2
8
+ echo " bun install --global tscircuit" >&2
9
+ exit 127
10
+ fi
11
+
12
+ TARGET="${1:-.}"
13
+
14
+ # Determine starting directory
15
+ if [[ -f "$TARGET" ]]; then
16
+ TARGET_DIR="$(dirname "$TARGET")"
17
+ else
18
+ TARGET_DIR="$TARGET"
19
+ fi
20
+
21
+ # Walk up to find a tscircuit project (has tscircuit.config.json or tscircuit in package.json)
22
+ PROJECT_ROOT="$TARGET_DIR"
23
+ FOUND_PROJECT=false
24
+ while [[ "$PROJECT_ROOT" != "/" ]]; do
25
+ if [[ -f "$PROJECT_ROOT/tscircuit.config.json" ]]; then
26
+ FOUND_PROJECT=true
27
+ break
28
+ fi
29
+ if [[ -f "$PROJECT_ROOT/package.json" ]]; then
30
+ if grep -q '"tscircuit"' "$PROJECT_ROOT/package.json" 2>/dev/null; then
31
+ FOUND_PROJECT=true
32
+ break
33
+ fi
34
+ fi
35
+ PROJECT_ROOT="$(dirname "$PROJECT_ROOT")"
36
+ done
37
+
38
+ if [[ "$FOUND_PROJECT" != "true" ]]; then
39
+ echo "Error: Not inside a tscircuit project." >&2
40
+ echo "No tscircuit.config.json or tscircuit dependency found." >&2
41
+ echo "Create a project with: tsci init" >&2
42
+ exit 1
43
+ fi
44
+
45
+ echo "Running: tsci build ${TARGET}" >&2
46
+ tsci build "$TARGET"
47
+
48
+ echo "OK: tsci build" >&2
@@ -0,0 +1,14 @@
1
+ // Requires: npm install @tscircuit/common
2
+ import React from "react"
3
+ import { ArduinoShield } from "@tscircuit/common"
4
+
5
+ export default () => (
6
+ <ArduinoShield name="example">
7
+ <resistor name="R1" resistance="220ohm" footprint="0805" pcbX={0} pcbY={5} />
8
+ <led name="LED1" color="red" footprint="0603" pcbX={0} pcbY={-5} />
9
+
10
+ <trace from=".D13" to=".R1 > .pin1" />
11
+ <trace from=".R1 > .pin2" to=".LED1 > .pin1" />
12
+ <trace from=".LED1 > .pin2" to=".GND2" />
13
+ </ArduinoShield>
14
+ )
@@ -0,0 +1,65 @@
1
+ import type { ChipProps } from "tscircuit"
2
+
3
+ const pinLabels = {
4
+ pin1: "GND",
5
+ pin2: "TRIG",
6
+ pin3: "OUT",
7
+ pin4: "RESET",
8
+ pin5: "CTRL",
9
+ pin6: "THRES",
10
+ pin7: "DISCH",
11
+ pin8: "VCC",
12
+ } as const
13
+
14
+ export const NE555 = (props: ChipProps<typeof pinLabels>) => (
15
+ <chip
16
+ {...props}
17
+ pinLabels={pinLabels}
18
+ pinAttributes={{
19
+ VCC: { requiresPower: true },
20
+ RESET: { mustBeConnected: true },
21
+ }}
22
+ schPinArrangement={{
23
+ leftSide: {
24
+ direction: "top-to-bottom",
25
+ pins: ["RESET", "CTRL", "THRES", "TRIG"],
26
+ },
27
+ rightSide: {
28
+ direction: "top-to-bottom",
29
+ pins: ["VCC", "OUT", "DISCH", "GND"],
30
+ },
31
+ }}
32
+ supplierPartNumbers={{ jlcpcb: ["C46749"] }}
33
+ footprint="dip8"
34
+ />
35
+ )
36
+
37
+ export default () => (
38
+ <board width="40mm" height="30mm">
39
+ <NE555 name="U1" />
40
+ <resistor name="R1" resistance="1k" footprint="0402" />
41
+ <resistor name="R2" resistance="10k" footprint="0402" />
42
+ <capacitor name="C1" capacitance="10uF" footprint="0805" />
43
+ <capacitor name="C2" capacitance="10nF" footprint="0402" />
44
+ <capacitor name="C3" capacitance="100nF" footprint="0402" />
45
+
46
+ <trace from="U1.VCC" to="net.VCC" />
47
+ <trace from="U1.GND" to="net.GND" />
48
+ <trace from="U1.RESET" to="net.VCC" />
49
+ <trace from="C3.pin1" to="net.VCC" />
50
+ <trace from="C3.pin2" to="net.GND" />
51
+
52
+ <trace from="U1.CTRL" to="C2.pin1" />
53
+ <trace from="C2.pin2" to="net.GND" />
54
+
55
+ <trace from="R1.pin1" to="net.VCC" />
56
+ <trace from="R1.pin2" to="U1.DISCH" />
57
+ <trace from="U1.DISCH" to="R2.pin1" />
58
+ <trace from="R2.pin2" to="net.TIMING" />
59
+
60
+ <trace from="U1.THRES" to="net.TIMING" />
61
+ <trace from="U1.TRIG" to="net.TIMING" />
62
+ <trace from="C1.pin1" to="net.TIMING" />
63
+ <trace from="C1.pin2" to="net.GND" />
64
+ </board>
65
+ )
@@ -0,0 +1,13 @@
1
+ // Demonstrates <group /> for positioning multiple components together.
2
+ // This example focuses on layout—add <trace /> elements for connectivity.
3
+ import React from "react"
4
+
5
+ export default () => (
6
+ <board width="20mm" height="20mm">
7
+ <group pcbX={5} pcbY={5}>
8
+ <resistor name="R1" resistance="1k" footprint="0402" pcbX={2.5} pcbY={2.5} />
9
+ <resistor name="R2" resistance="1k" footprint="0402" pcbX={2.5} pcbY={0} />
10
+ <resistor name="R3" resistance="1k" footprint="0402" pcbX={2.5} pcbY={-2.5} />
11
+ </group>
12
+ </board>
13
+ )
@@ -0,0 +1,13 @@
1
+ // Minimal board with two components and trace connectivity.
2
+ import React from "react"
3
+
4
+ export default () => (
5
+ <board width="10mm" height="10mm">
6
+ <resistor name="R1" resistance="1k" footprint="0402" pcbX={-2} schX={-2} />
7
+ <capacitor name="C1" capacitance="100nF" footprint="0402" pcbX={2} schX={2} />
8
+
9
+ <trace from=".R1 > .pin1" to=".C1 > .pin1" />
10
+ <trace from=".R1 > .pin2" to="net.GND" />
11
+ <trace from=".C1 > .pin2" to="net.GND" />
12
+ </board>
13
+ )
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "tsci-agent",
3
+ "version": "0.1.0",
4
+ "description": "An interactive coding agent and command line utility for coding tscircuit TSX circuits",
5
+ "type": "module",
6
+ "bin": {
7
+ "tsci-agent": "dist/cli.js"
8
+ },
9
+ "files": [
10
+ "dist",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "dev": "bun run src/cli.ts",
15
+ "bundle": "bun build src/cli.ts --target bun --outfile dist/cli.js && bun run scripts/copy-skill.ts && bun run scripts/make-executable.ts",
16
+ "build": "bun run bundle",
17
+ "typecheck": "tsc --noEmit",
18
+ "test": "bun test",
19
+ "smoke": "./dist/cli.js --smoke-test-assets",
20
+ "start": "bun run dist/cli.js",
21
+ "prepack": "bun run build"
22
+ },
23
+ "dependencies": {
24
+ "@earendil-works/pi-coding-agent": "^0.80.2"
25
+ },
26
+ "devDependencies": {
27
+ "@types/bun": "latest",
28
+ "skill": "github:tscircuit/skill",
29
+ "typescript": "latest"
30
+ },
31
+ "keywords": [
32
+ "pi",
33
+ "tscircuit",
34
+ "coding-agent",
35
+ "bun"
36
+ ],
37
+ "license": "MIT",
38
+ "packageManager": "bun@1.3.14"
39
+ }