style: apply Prettier formatting to TS/JS/JSON/MD files

Add Prettier as a dev dependency with .prettierrc.json config and
.prettierignore. Hook added via mirrors-prettier in pre-commit config.
All TypeScript, JSON, Markdown, and YAML files auto-formatted.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Eugene Mikhantyev
2026-03-29 13:05:50 +01:00
parent c44bd9205d
commit 7d50fa1d4c
82 changed files with 18314 additions and 17317 deletions

View File

@@ -3,11 +3,11 @@
* Main entry point
*/
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import { KiCADMcpServer } from './server.js';
import { loadConfig } from './config.js';
import { logger } from './logger.js';
import { join, dirname } from "path";
import { fileURLToPath } from "url";
import { KiCADMcpServer } from "./server.js";
import { loadConfig } from "./config.js";
import { logger } from "./logger.js";
// Get the current directory
const __filename = fileURLToPath(import.meta.url);
@@ -26,13 +26,10 @@ async function main() {
const config = await loadConfig(options.configPath);
// Path to the Python script that interfaces with KiCAD
const kicadScriptPath = join(dirname(__dirname), 'python', 'kicad_interface.py');
const kicadScriptPath = join(dirname(__dirname), "python", "kicad_interface.py");
// Create the server
const server = new KiCADMcpServer(
kicadScriptPath,
config.logLevel
);
const server = new KiCADMcpServer(kicadScriptPath, config.logLevel);
// Start the server
await server.start();
@@ -40,8 +37,7 @@ async function main() {
// Setup graceful shutdown
setupGracefulShutdown(server);
logger.info('KiCAD MCP server started with STDIO transport');
logger.info("KiCAD MCP server started with STDIO transport");
} catch (error) {
logger.error(`Failed to start KiCAD MCP server: ${error}`);
process.exit(1);
@@ -55,7 +51,7 @@ function parseCommandLineArgs(args: string[]) {
let configPath = undefined;
for (let i = 0; i < args.length; i++) {
if (args[i] === '--config' && i + 1 < args.length) {
if (args[i] === "--config" && i + 1 < args.length) {
configPath = args[i + 1];
i++;
}
@@ -69,24 +65,24 @@ function parseCommandLineArgs(args: string[]) {
*/
function setupGracefulShutdown(server: KiCADMcpServer) {
// Handle termination signals
process.on('SIGINT', async () => {
logger.info('Received SIGINT signal. Shutting down...');
process.on("SIGINT", async () => {
logger.info("Received SIGINT signal. Shutting down...");
await shutdownServer(server);
});
process.on('SIGTERM', async () => {
logger.info('Received SIGTERM signal. Shutting down...');
process.on("SIGTERM", async () => {
logger.info("Received SIGTERM signal. Shutting down...");
await shutdownServer(server);
});
// Handle uncaught exceptions
process.on('uncaughtException', async (error) => {
process.on("uncaughtException", async (error) => {
logger.error(`Uncaught exception: ${error}`);
await shutdownServer(server);
});
// Handle unhandled promise rejections
process.on('unhandledRejection', async (reason) => {
process.on("unhandledRejection", async (reason) => {
logger.error(`Unhandled promise rejection: ${reason}`);
await shutdownServer(server);
});
@@ -97,9 +93,9 @@ function setupGracefulShutdown(server: KiCADMcpServer) {
*/
async function shutdownServer(server: KiCADMcpServer) {
try {
logger.info('Shutting down KiCAD MCP server...');
logger.info("Shutting down KiCAD MCP server...");
await server.stop();
logger.info('Server shutdown complete. Exiting...');
logger.info("Server shutdown complete. Exiting...");
process.exit(0);
} catch (error) {
logger.error(`Error during shutdown: ${error}`);