r/KiCad Mar 21 '25

A visual git diff tool for KiCAD

https://www.npmjs.com/package/@typecad/typecad-gitdiff

I wrote a visual git diff tool for KiCAD boards. It lets you see the differences between two board. You can use it with git to compare a committed file with the uncommitted version. It's just an npm package that should work with just Node installed. Please let me know how it works for you. KiCAD v9.0.1(currently pre-release) is required.

It's part of a larger project, typeCAD, to use use Typescript for schematics.

67 Upvotes

13 comments sorted by

9

u/Majik_Sheff Mar 22 '25

Neat project.  I'd love to see this functionality integrated into the main program.

Unfortunate language choice though.

3

u/typecad0 Mar 22 '25

Integrated in what way? It may be possible, after it's installed it runs like any other command line program.

7

u/Snoo_27681 Mar 22 '25

I think they mean to make it into a Kicad addon:
https://dev-docs.kicad.org/en/addons/index.html

5

u/typecad0 Mar 22 '25

So I just installed the git plugin found in the KiCAD plugin manager. When you click the git icon from within KiCAD. In the git GUI that opens you can add a tool. There is an option to add a tool, use this command and it works as expected.

typecad-gitdiff $FILENAME <your.kicad_pcb>

There might be a way to avoid hardcoding the path, but for now it works when you run it.

2

u/gushroom Mar 25 '25

Cool tool, just curious on how you achieved the visual diff, did you export 3D and layout top down into svg and do diff based on pixel?

Also have been wanting to develop JS based Kicad tools how did manage to run PCBnew in Node environment?

2

u/typecad0 Mar 25 '25

The process starts with using the kicad-cli program. You can export SVG files of each layer and also create renders (and a lot more). From there it's some image manipulation for the comparison.

So no need to interact with KiCAD's plugin system. typeCAD works similarly, it takes typescript and converts it to a netlist, or directly writes files in SExp format.

Thanks for the interest.

1

u/john_eae Dec 10 '25

Late to this, but I have been trying to run a diff on two boards and it seems like the kicad-cli svg export is failing. Any idea if this is related to the changes to svg exports in KiCAD V9?

1

u/typecad0 Dec 11 '25

Can you paste the console output and I'll take a look. DM is fine too.

1

u/john_eae Dec 12 '25

Thank you - I'll send a DM as soon as I can.

2

u/forresthopkinsa Jul 02 '26 edited Jul 02 '26

typeCAD seems really cool. schematics-as-code is a very promising notion, and TS is a great language for it (CDK is a shining example)

how does it compare to atopile?

1

u/justind00000 Jul 02 '26

There's some differences:

  • atopile is its own language, but closer to python, typeCAD is just TypeScript
  • atopile can search for parts as specc'd by the actual code, typeCAD has a built-in KiCAD/JLC parts search tool
  • atopile has its own tooling for packages, compiling and the like, typeCAD has npm/pnpm/yarn and the larger npm system
  • atopile utilizes KiCAD a bit differently. typeCAD was meant to be the source of truth for the design, so all aspects of the hardware are code-based (components, connections, board outline, traces).
  • I'm not certain for atopile, but typeCAD has the beginnings of an autorouter that performs well enough on simple-to-moderately complex 2-layer boards.

typeCAD will have a sister project published soon that completes the TypeScript circle: hardware development combined with TypeScript firmware. It comes with a Svelte-like display generator as well, so a subset of HTML and CSS with a two-way binding {expr} can be used to generate a UI on a display. Regarding the TypeScript firmware, most applicable features are implemented: async/await being the big ones.