kicad-mcp-pro 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # kicad-mcp-pro
2
+
3
+ Thin npm launcher for the `kicad-mcp-pro` Python package.
4
+
5
+ - npm package: `kicad-mcp-pro`
6
+ - Python package: `kicad-mcp-pro`
7
+ - MCP name: `io.github.oaslananka/kicad-mcp-pro`
8
+ - Canonical repository: https://github.com/oaslananka/kicad-studio-kit/tree/main/packages/mcp-npm
9
+
10
+ The wrapper resolves the Python package version from `KICAD_MCP_PRO_PYPI_VERSION` or from this package version.
11
+
12
+ ```bash
13
+ npx kicad-mcp-pro@1.0.0 --help
14
+ ```
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+ const { spawn } = require("node:child_process");
7
+ const pkg = require("../package.json");
8
+
9
+ function executableNames() {
10
+ return process.platform === "win32" ? ["uvx.cmd", "uvx.exe", "uvx"] : ["uvx"];
11
+ }
12
+
13
+ function findOnPath(commandNames) {
14
+ const rawPath = process.env.PATH || "";
15
+ const entries = rawPath.split(path.delimiter).filter(Boolean);
16
+ for (const entry of entries) {
17
+ for (const commandName of commandNames) {
18
+ const candidate = path.join(entry, commandName);
19
+ if (fs.existsSync(candidate)) {
20
+ return candidate;
21
+ }
22
+ }
23
+ }
24
+ return null;
25
+ }
26
+
27
+ const uvx = findOnPath(executableNames());
28
+ if (!uvx) {
29
+ console.error(
30
+ [
31
+ "uvx was not found on PATH.",
32
+ "Install uv from https://docs.astral.sh/uv/getting-started/installation/ and retry.",
33
+ "This npm wrapper does not install the Python package during npm install.",
34
+ ].join("\n"),
35
+ );
36
+ process.exit(127);
37
+ }
38
+
39
+ const pythonPackageVersion = process.env.KICAD_MCP_PRO_PYPI_VERSION || pkg.version;
40
+ const pythonPackage = `kicad-mcp-pro@${pythonPackageVersion}`;
41
+ const child = spawn(uvx, [pythonPackage, ...process.argv.slice(2)], {
42
+ stdio: "inherit",
43
+ windowsHide: true,
44
+ });
45
+
46
+ child.on("error", (error) => {
47
+ console.error(`Failed to execute uvx: ${error.message}`);
48
+ process.exit(1);
49
+ });
50
+
51
+ child.on("exit", (code, signal) => {
52
+ if (signal) {
53
+ process.kill(process.pid, signal);
54
+ return;
55
+ }
56
+ if (code !== 0) {
57
+ console.error(
58
+ [
59
+ `${pythonPackage} exited with code ${code}.`,
60
+ "Publish the matching Python package before publishing this npm wrapper,",
61
+ "or set KICAD_MCP_PRO_PYPI_VERSION to an already-published compatible version.",
62
+ ].join("\n"),
63
+ );
64
+ }
65
+ process.exit(code === null ? 1 : code);
66
+ });
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "kicad-mcp-pro",
3
+ "version": "1.0.0",
4
+ "description": "npm wrapper for the KiCad MCP Pro Python package.",
5
+ "license": "MIT",
6
+ "homepage": "https://oaslananka.github.io/kicad-studio-kit",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/oaslananka/kicad-studio-kit.git",
10
+ "directory": "packages/mcp-npm"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/oaslananka/kicad-studio-kit/issues"
14
+ },
15
+ "mcpName": "io.github.oaslananka/kicad-mcp-pro",
16
+ "bin": {
17
+ "kicad-mcp-pro": "bin/kicad-mcp-pro.js"
18
+ },
19
+ "files": [
20
+ "bin/",
21
+ "scripts/",
22
+ "README.md"
23
+ ],
24
+ "engines": {
25
+ "node": ">=22.14.0"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "scripts": {
31
+ "check": "npm pack --dry-run",
32
+ "build": "node scripts/build-smoke.js"
33
+ }
34
+ }
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const path = require("node:path");
5
+ const { spawnSync } = require("node:child_process");
6
+
7
+ const packageRoot = path.resolve(__dirname, "..");
8
+ const wrapperPath = path.join(packageRoot, "bin", "kicad-mcp-pro.js");
9
+
10
+ const result = spawnSync(process.execPath, [wrapperPath, "--help"], {
11
+ cwd: packageRoot,
12
+ encoding: "utf8",
13
+ windowsHide: true,
14
+ });
15
+
16
+ if (result.stdout) {
17
+ process.stdout.write(result.stdout);
18
+ }
19
+
20
+ if (result.stderr) {
21
+ process.stderr.write(result.stderr);
22
+ }
23
+
24
+ if (result.error) {
25
+ console.error(`Failed to execute npm launcher smoke: ${result.error.message}`);
26
+ process.exit(1);
27
+ }
28
+
29
+ if (result.signal) {
30
+ console.error(`npm launcher smoke was interrupted by signal ${result.signal}.`);
31
+ process.exit(1);
32
+ }
33
+
34
+ if (result.status === 0) {
35
+ process.exit(0);
36
+ }
37
+
38
+ const knownPrepublishFailure =
39
+ result.stderr.includes("uvx was not found on PATH.") ||
40
+ result.stderr.includes("Publish the matching Python package before publishing this npm wrapper");
41
+
42
+ if (!knownPrepublishFailure) {
43
+ console.error(`npm launcher smoke failed with unexpected exit code ${result.status ?? 1}.`);
44
+ process.exit(result.status ?? 1);
45
+ }
46
+
47
+ console.error(
48
+ [
49
+ "npm launcher smoke completed with a non-zero wrapper exit.",
50
+ "This is tolerated during repository builds because the matching Python package",
51
+ "may not be published yet. The wrapper itself still exits non-zero for users.",
52
+ ].join("\n"),
53
+ );
54
+ process.exit(0);