tsci convert hardcodes KiCad reference placeholder REF** in reusable TSX footprints
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 18
- Forks
- 91
- Avg merge
- 31m
- Merged PRs (30d)
- 349
Description
Problem
Converting a KiCad footprint to a reusable TSX component copies its reference placeholder into a literal text="REF**". Instantiating that component as U1 and U2 prints REF** twice instead of the instance reference designators.
This is about preserving reference-field semantics, not automatically changing text sizes, rearranging arbitrary footprint text, or adding labels to every custom footprint.
Reproduction
Tested on Linux x64 with Bun 1.4.2, @tscircuit/cli@0.1.2057, tscircuit@0.0.2516 (resolving @tscircuit/core@0.0.1892), and TypeScript 5.9.3. These reproductions use only public tscircuit packages and synthetic components.
In an empty directory:
bun init -y
bun add --exact @tscircuit/cli@0.1.2057 tscircuit@0.0.2516 typescript@5.9.3
Use this tsconfig.json:
{"compilerOptions":{"jsx":"react-jsx","moduleResolution":"Bundler","module":"ESNext","target":"ESNext","skipLibCheck":true}}
two-pad.kicad_mod:
(footprint "TwoPad"
(version 20240108)
(generator "pcbnew")
(layer "F.Cu")
(attr smd)
(fp_text reference "REF**" (at 0 -2) (layer "F.SilkS") (effects (font (size 1 1) (thickness 0.15))))
(pad "1" smd rect (at -0.8 0) (size 0.9 1) (layers "F.Cu" "F.Paste" "F.Mask"))
(pad "2" smd rect (at 0.8 0) (size 0.9 1) (layers "F.Cu" "F.Paste" "F.Mask"))
)
bunx tsci convert two-pad.kicad_mod --name TwoPad --output TwoPad.tsx
The generated component includes:
<silkscreentext pcbX={0} pcbY={2} anchorAlignment="center"
fontSize={1} font="tscircuit2024" layer="top" text="REF**" />
converted-labels.tsx:
import { TwoPad } from "./TwoPad"
export default () => (<board width={12} height={8}>
<TwoPad name="U1" pcbX={-3} schX={-2} />
<TwoPad name="U2" pcbX={3} schX={2} />
</board>)
bunx tsci build converted-labels.tsx
In dist/converted-labels/circuit.json, pcb_silkscreen_text values are ["REF", "REF**"]**, while source components are named U1 and U2. The build succeeds.
Expected
The KiCad fp_text reference field should become an instance-aware reference label in generated TSX (for example, a supported reference placeholder or a binding to the component's name). Preserve its placement and styling, and keep ordinary user text literal.
Workaround
Change the generated reference text to text={props.name ?? "REF**"}. This is a local generated-code workaround, not a proposed universal fallback policy.
Scope / related reports
The CLI currently delegates this path to convertCircuitJsonToTscircuit after KiCad conversion, so the eventual fix may belong in that converter or in preservation of text-role metadata upstream of it. Filing here for the user-facing tsci convert reproduction.
- #1708 concerns the opposite conversion direction (mapping names when exporting to KiCad).
- tscircuit/core#2875 concerns generating labels absent from inline footprints. Here the label exists but has lost its reference semantics.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the tsci convert path and trace its delegation to convertCircuitJsonToTscircuit, using the provided two-pad.kicad_mod and generated TwoPad.tsx reproduction. Check how the KiCad reference field is represented versus ordinary text; done means the built U1 and U2 labels are instance-aware while placement, styling, and literal user text remain unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100