fix: address review issues in schematic tools
- Remove unused imports in move_schematic_component - Add warning log when mirror attribute missing on rotate - Move `import re` out of loop in annotate_schematic - Include global_label in list_schematic_nets - Fix SVG export to use directory for kicad-cli --output flag - Return actual SVG data in get_schematic_view TS handler - Add isError: true to all failure responses in new tools - Add connect_passthrough to schematic category in registry - Simplify power symbol filtering control flow in list_labels - Fix indentation in list_schematic_labels power section Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -97,6 +97,7 @@ export const toolCategories: ToolCategory[] = [
|
||||
"add_schematic_net_label",
|
||||
"delete_schematic_net_label",
|
||||
"connect_to_net",
|
||||
"connect_passthrough",
|
||||
"get_net_connections",
|
||||
"list_schematic_nets",
|
||||
"list_schematic_wires",
|
||||
|
||||
@@ -491,6 +491,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to list components: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -530,6 +531,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
content: [
|
||||
{ type: "text", text: `Failed to list nets: ${result.message || "Unknown error"}` },
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -567,6 +569,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
content: [
|
||||
{ type: "text", text: `Failed to list wires: ${result.message || "Unknown error"}` },
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -604,6 +607,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
content: [
|
||||
{ type: "text", text: `Failed to list labels: ${result.message || "Unknown error"}` },
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -645,6 +649,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to move component: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -686,6 +691,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to rotate component: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -727,6 +733,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to annotate: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -767,6 +774,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to delete wire: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -806,6 +814,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to delete label: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -845,6 +854,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to export SVG: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -884,6 +894,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to export PDF: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
@@ -910,16 +921,15 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
const result = await callKicadScript("get_schematic_view", args);
|
||||
if (result.success) {
|
||||
if (result.format === "svg") {
|
||||
return {
|
||||
content: [
|
||||
{
|
||||
type: "text",
|
||||
text: result.message
|
||||
? `SVG data returned (${result.message})`
|
||||
: `SVG schematic view (${result.imageData?.length || 0} chars)`,
|
||||
},
|
||||
],
|
||||
};
|
||||
const parts: { type: "text"; text: string }[] = [];
|
||||
if (result.message) {
|
||||
parts.push({ type: "text", text: result.message });
|
||||
}
|
||||
parts.push({
|
||||
type: "text",
|
||||
text: result.imageData || "",
|
||||
});
|
||||
return { content: parts };
|
||||
}
|
||||
// PNG — return as base64 image
|
||||
return {
|
||||
@@ -939,6 +949,7 @@ Note: operates on .kicad_sch files only. To modify a PCB footprint use edit_comp
|
||||
text: `Failed to get schematic view: ${result.message || "Unknown error"}`,
|
||||
},
|
||||
],
|
||||
isError: true,
|
||||
};
|
||||
},
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user