Conversation
`tsci export -f kicad_zip` and `tsci build --kicad-project[-zip]` wrote only `schConverter.getOutputString()`, which for a hierarchical schematic (components using `schSheetName`) is just the root sheet. The root sheet references `sheet_*.kicad_sch` files that were never written, so the exported project opens with an empty schematic and broken sheet links. Use `getOutputFiles()` so the root and every child sheet are written. For non-hierarchical schematics it returns the single root file, so output is unchanged there. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
wroscoe
marked this pull request as ready for review
September 26, 2026 14:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a design uses
schSheetName(hierarchical schematic),tsci export -f kicad_zipandtsci build --kicad-project/--kicad-project-zipproduce a KiCad project whose schematic is empty:CircuitJsonToKicadSchConverter.getOutputString()returns only the root sheet for hierarchical schematics (this.files[0].content).(sheet ...)blocks whoseSheetfileproperties point atsheet_1.kicad_sch,sheet_2.kicad_sch, ...The export still exits 0 and the zip contains exactly one
.kicad_sch, so nothing flags it. PCB output is unaffected.We hit this on a 3-sheet board: the exported
index.circuit.kicad_schwas 2.7 KB with 0 symbols and threeSheetfilereferences to files not in the zip.Fix
circuit-json-to-kicadalready providesgetOutputFiles({ schematicFilename }), which returns the root plus every child sheet (and just the root for non-hierarchical designs). Use it in both places:lib/shared/export-snippet.ts: thekicad_zipexportcli/build/generate-kicad-project.ts:build --kicad-project/--kicad-project-zip, which zips the output dirGeneratedKicadProject.schContentstill holds the root sheet, so its shape is unchanged. Output for non-hierarchical schematics is byte-for-byte the same.Tests
tests/cli/export/export-kicad.test.ts: a two-sheet circuit exported withkicad_zip. Asserts the zip contains the root plussheet_1/sheet_2, that the root references both files, and that each child holds its symbol.tests/cli/build/build-kicad-project-zip.test.ts: the same circuit throughbuild --kicad-project, asserting all three.kicad_schfiles are written.tsc --noEmitandbiome formatpass locally. I couldn't run the test suite locally because my sandbox blocks some outbound hosts the render path uses, so this PR is a draft until CI is green.🤖 Generated with Claude Code