Diff CAD Scripts
diff_scriptsUse this when you need to see exactly what changed between two script versions. Structured geometric delta between two versions of a kernelCAD script — a baseline ({ baseFile } or { baseCode }) and a revision ({ file } or { code }). Returns agent-readable JSON: per-part added/removed/renamed/changed (volume mm³ + exact bbox deltas, numbers matching inspect({ of: 'part-stats' })), total interference-volume delta with per-pair detail, mate-graph changes (added/removed/changed mates incl. type, connectors, pose, limits), and param changes (value/min/max). Single-shape scripts diff as one "(root)" pseudo-part. Use after editing a script to verify exactly what changed physically before re-rendering. Read-only — never touches the active session.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | No | Revised script — inline source. | |
| file | No | Revised script — path to a .kcad.ts file. | |
| baseCode | No | Baseline script — inline source. | |
| baseFile | No | Baseline script — path to a .kcad.ts file. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| base | No | Baseline summary { featureCount, partCount, isAssembly } (success). | |
| side | No | Which side failed ('base' | 'revised') (failure). | |
| error | No | Failure message (failure). | |
| mates | No | Mate-graph changes (success). | |
| parts | No | Per-part added/removed/renamed/changed/unchanged (success). | |
| params | No | Param value/min/max changes (success). | |
| revised | No | Revision summary { featureCount, partCount, isAssembly } (success). | |
| errorCode | No | ||
| diagnostics | No | ||
| interference | No | Total interference-volume delta + per-pair detail (success). |