chore: set up pre-commit framework with general hooks
Add .pre-commit-config.yaml with pre-commit-hooks v5.0.0 (trailing whitespace, end-of-file fixer, yaml/json checks, large file guard, merge conflict detection). Add minimal pyproject.toml. Auto-fix trailing whitespace and missing end-of-file newlines across the codebase. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Board management tools for KiCAD MCP server
|
||||
*
|
||||
*
|
||||
* These tools handle board setup, layer management, and board properties
|
||||
*/
|
||||
|
||||
@@ -13,13 +13,13 @@ type CommandFunction = (command: string, params: Record<string, unknown>) => Pro
|
||||
|
||||
/**
|
||||
* Register board management tools with the MCP server
|
||||
*
|
||||
*
|
||||
* @param server MCP server instance
|
||||
* @param callKicadScript Function to call KiCAD script commands
|
||||
*/
|
||||
export function registerBoardTools(server: McpServer, callKicadScript: CommandFunction): void {
|
||||
logger.info('Registering board management tools');
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Set Board Size Tool
|
||||
// ------------------------------------------------------
|
||||
@@ -37,7 +37,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
height,
|
||||
unit
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -70,7 +70,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
position,
|
||||
number
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -91,7 +91,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
async ({ layer }) => {
|
||||
logger.debug(`Setting active layer to: ${layer}`);
|
||||
const result = await callKicadScript("set_active_layer", { layer });
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -110,7 +110,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
async () => {
|
||||
logger.debug('Getting board information');
|
||||
const result = await callKicadScript("get_board_info", {});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -129,7 +129,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
async () => {
|
||||
logger.debug('Getting layer list');
|
||||
const result = await callKicadScript("get_layer_list", {});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -205,7 +205,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
diameter,
|
||||
padDiameter
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -244,7 +244,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
rotation,
|
||||
style
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -284,7 +284,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
minWidth,
|
||||
padConnection
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -305,7 +305,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
async ({ unit }) => {
|
||||
logger.debug('Getting board extents');
|
||||
const result = await callKicadScript("get_board_extents", { unit });
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -334,7 +334,7 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
height,
|
||||
format
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -382,4 +382,3 @@ export function registerBoardTools(server: McpServer, callKicadScript: CommandFu
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -11,16 +11,16 @@ type CommandFunction = (command: string, params: any) => Promise<any>;
|
||||
|
||||
/**
|
||||
* Register component management tools with the MCP server
|
||||
*
|
||||
*
|
||||
* @param server MCP server instance
|
||||
* @param callKicadScript Function to call KiCAD script commands
|
||||
*/
|
||||
export function registerComponentTools(server: McpServer, callKicadScript: CommandFunction): void {
|
||||
logger.info('Registering component management tools');
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Place Component Tool
|
||||
// ------------------------------------------------------
|
||||
server.registerTool({
|
||||
name: "place_component",
|
||||
description: "Places a component on the PCB at the specified location",
|
||||
description: "Places a component on the PCB at the specified location",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Design rules tools for KiCAD MCP server
|
||||
*
|
||||
*
|
||||
* These tools handle design rule checking and configuration
|
||||
*/
|
||||
|
||||
@@ -13,13 +13,13 @@ type CommandFunction = (command: string, params: Record<string, unknown>) => Pro
|
||||
|
||||
/**
|
||||
* Register design rule tools with the MCP server
|
||||
*
|
||||
*
|
||||
* @param server MCP server instance
|
||||
* @param callKicadScript Function to call KiCAD script commands
|
||||
*/
|
||||
export function registerDesignRuleTools(server: McpServer, callKicadScript: CommandFunction): void {
|
||||
logger.info('Registering design rule tools');
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Set Design Rules Tool
|
||||
// ------------------------------------------------------
|
||||
@@ -44,7 +44,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
|
||||
async (params) => {
|
||||
logger.debug('Setting design rules');
|
||||
const result = await callKicadScript("set_design_rules", params);
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -63,7 +63,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
|
||||
async () => {
|
||||
logger.debug('Getting design rules');
|
||||
const result = await callKicadScript("get_design_rules", {});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -84,7 +84,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
|
||||
async ({ reportPath }) => {
|
||||
logger.debug('Running DRC check');
|
||||
const result = await callKicadScript("run_drc", { reportPath });
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -127,7 +127,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
|
||||
diff_pair_gap,
|
||||
nets
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -152,7 +152,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
|
||||
net,
|
||||
netClass
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -183,7 +183,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
|
||||
minViaDiameter,
|
||||
minViaDrill
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -226,7 +226,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
|
||||
item1,
|
||||
item2
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -247,7 +247,7 @@ export function registerDesignRuleTools(server: McpServer, callKicadScript: Comm
|
||||
async ({ severity }) => {
|
||||
logger.debug('Getting DRC violations');
|
||||
const result = await callKicadScript("get_drc_violations", { severity });
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/**
|
||||
* Export tools for KiCAD MCP server
|
||||
*
|
||||
*
|
||||
* These tools handle exporting PCB data to various formats
|
||||
*/
|
||||
|
||||
@@ -13,13 +13,13 @@ type CommandFunction = (command: string, params: Record<string, unknown>) => Pro
|
||||
|
||||
/**
|
||||
* Register export tools with the MCP server
|
||||
*
|
||||
*
|
||||
* @param server MCP server instance
|
||||
* @param callKicadScript Function to call KiCAD script commands
|
||||
*/
|
||||
export function registerExportTools(server: McpServer, callKicadScript: CommandFunction): void {
|
||||
logger.info('Registering export tools');
|
||||
|
||||
|
||||
// ------------------------------------------------------
|
||||
// Export Gerber Tool
|
||||
// ------------------------------------------------------
|
||||
@@ -43,7 +43,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
generateMapFile,
|
||||
useAuxOrigin
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -74,7 +74,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
frameReference,
|
||||
pageSize
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -103,7 +103,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
blackAndWhite,
|
||||
includeComponents
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -136,7 +136,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
includeSolderMask,
|
||||
includeSilkscreen
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -165,7 +165,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
groupByValue,
|
||||
includeAttributes
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -190,7 +190,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
outputPath,
|
||||
format
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -219,7 +219,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
units,
|
||||
side
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
@@ -246,7 +246,7 @@ export function registerExportTools(server: McpServer, callKicadScript: CommandF
|
||||
includeComponents,
|
||||
useRelativePaths
|
||||
});
|
||||
|
||||
|
||||
return {
|
||||
content: [{
|
||||
type: "text",
|
||||
|
||||
Reference in New Issue
Block a user