@intelligentelectron/pcb-lens 0.0.1

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/LICENSE +190 -0
  3. package/NOTICE +4 -0
  4. package/README.md +156 -0
  5. package/dist/cli/commands.d.ts +23 -0
  6. package/dist/cli/commands.d.ts.map +1 -0
  7. package/dist/cli/commands.js +113 -0
  8. package/dist/cli/commands.js.map +1 -0
  9. package/dist/cli/prompts.d.ts +10 -0
  10. package/dist/cli/prompts.d.ts.map +1 -0
  11. package/dist/cli/prompts.js +25 -0
  12. package/dist/cli/prompts.js.map +1 -0
  13. package/dist/cli/shell.d.ts +15 -0
  14. package/dist/cli/shell.d.ts.map +1 -0
  15. package/dist/cli/shell.js +66 -0
  16. package/dist/cli/shell.js.map +1 -0
  17. package/dist/cli/updater.d.ts +50 -0
  18. package/dist/cli/updater.d.ts.map +1 -0
  19. package/dist/cli/updater.js +305 -0
  20. package/dist/cli/updater.js.map +1 -0
  21. package/dist/index.d.ts +15 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +62 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/server.d.ts +16 -0
  26. package/dist/server.d.ts.map +1 -0
  27. package/dist/server.js +175 -0
  28. package/dist/server.js.map +1 -0
  29. package/dist/service.d.ts +13 -0
  30. package/dist/service.d.ts.map +1 -0
  31. package/dist/service.js +1139 -0
  32. package/dist/service.js.map +1 -0
  33. package/dist/types.d.ts +128 -0
  34. package/dist/types.d.ts.map +1 -0
  35. package/dist/types.js +8 -0
  36. package/dist/types.js.map +1 -0
  37. package/dist/version.d.ts +10 -0
  38. package/dist/version.d.ts.map +1 -0
  39. package/dist/version.js +25 -0
  40. package/dist/version.js.map +1 -0
  41. package/dist/wasm-embed.d.ts +3 -0
  42. package/dist/wasm-embed.d.ts.map +1 -0
  43. package/dist/wasm-embed.js +5 -0
  44. package/dist/wasm-embed.js.map +1 -0
  45. package/dist/xml-utils.d.ts +41 -0
  46. package/dist/xml-utils.d.ts.map +1 -0
  47. package/dist/xml-utils.js +81 -0
  48. package/dist/xml-utils.js.map +1 -0
  49. package/package.json +78 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,26 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.0.1] - 2026-02-23
11
+
12
+ ### Fixed
13
+
14
+ - Replace `@resvg/resvg-js` (native napi-rs addon) with `@resvg/resvg-wasm` to fix macOS code signing error (`dlopen` failure) when running as a compiled Bun binary
15
+
16
+ ### Added
17
+
18
+ - Initial project scaffold with MCP server skeleton
19
+ - `get_design_overview` tool for IPC-2581 file metadata and structure
20
+ - `query_components` tool for component placement and BOM lookup
21
+ - `query_net` tool for net routing, trace widths, and via analysis
22
+ - `render_net` tool for SVG-to-PNG net visualization
23
+ - Streaming XML parser for large IPC-2581 files (no DOM loading)
24
+ - Test fixture download script for IPC-2581 consortium samples
25
+ - Release automation with CI workflows and binary compilation
26
+ - Integration tests against IPC-2581 consortium fixtures
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 Valentino Zegna
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,4 @@
1
+ PCB Lens MCP Server
2
+ Copyright 2025 Valentino Zegna
3
+
4
+ This product includes software developed by Valentino Zegna.
package/README.md ADDED
@@ -0,0 +1,156 @@
1
+ # PCB Lens MCP Server
2
+
3
+ The **PCB Lens MCP Server** gives AI agents the tools to query and review your PCB layouts, enabling physical design review through natural conversations.
4
+
5
+ It works with any board layout in IPC-2581 format, exported from any EDA tool that supports the standard.
6
+
7
+ ## Supported Formats
8
+
9
+ | Format | Input Files | Description |
10
+ |--------|------------|-------------|
11
+ | IPC-2581 | `.xml` / `.cvg` | IPC-2581 XML files (RevA, RevB, RevC) from any compliant EDA tool |
12
+
13
+ ## Native Install (Recommended)
14
+
15
+ **macOS / Linux:**
16
+
17
+ ```bash
18
+ curl -fsSL https://raw.githubusercontent.com/IntelligentElectron/pcb-lens/main/install.sh | bash
19
+ ```
20
+
21
+ **Windows (PowerShell):**
22
+
23
+ ```powershell
24
+ irm https://raw.githubusercontent.com/IntelligentElectron/pcb-lens/main/install.ps1 | iex
25
+ ```
26
+
27
+ Why use the native installer:
28
+ - **No dependencies** — standalone binary, no Node.js required
29
+ - **Auto-updates** — checks for updates on startup
30
+ - **Signed binaries** — macOS binaries are notarized by Apple
31
+
32
+ The installer downloads two files:
33
+
34
+ 1. **Binary** - For CLI usage and manual MCP client configuration
35
+ 2. **Claude Desktop extension** (.mcpb) - For easy Claude Desktop integration
36
+
37
+ | Platform | Install Directory |
38
+ |----------|-------------------|
39
+ | macOS | `~/Library/Application Support/pcb-lens/` |
40
+ | Linux | `~/.local/share/pcb-lens/` |
41
+ | Windows | `%LOCALAPPDATA%\pcb-lens\` |
42
+
43
+ ### Update
44
+
45
+ The server checks for updates on startup. To update manually:
46
+
47
+ ```bash
48
+ pcb-lens --update
49
+ ```
50
+
51
+ ## Alternative: Install via npm
52
+
53
+ For developers who prefer npm:
54
+
55
+ ```bash
56
+ npm install -g @intelligentelectron/pcb-lens
57
+ ```
58
+
59
+ Or use with npx (no installation required):
60
+
61
+ ```bash
62
+ npx @intelligentelectron/pcb-lens --help
63
+ ```
64
+
65
+ Requires Node.js 20+.
66
+
67
+ To update:
68
+
69
+ ```bash
70
+ npm update -g @intelligentelectron/pcb-lens
71
+ ```
72
+
73
+ ## Connect the MCP with your favorite AI tool
74
+
75
+ After installing the MCP with one of the methods above, you can connect it to your AI agent of choice.
76
+
77
+ ### Claude Desktop
78
+
79
+ 1. Download the [Claude Desktop app](https://claude.ai/download)
80
+ 2. Open Claude Desktop and go to **Settings** (gear icon)
81
+ 3. Under **Desktop app**, click **Extensions**
82
+ 4. Click **Advanced settings**
83
+ 5. In the **Extension Developer** section, click **Install Extension...**
84
+ 6. Navigate to your install directory and select `pcb-lens.mcpb`:
85
+ - **macOS**: `~/Library/Application Support/pcb-lens/pcb-lens.mcpb`
86
+ - **Windows**: `%LOCALAPPDATA%\pcb-lens\pcb-lens.mcpb`
87
+
88
+ The extension will be available immediately in your conversations.
89
+
90
+ ### Claude Code
91
+
92
+ Install [Claude Code](https://docs.anthropic.com/en/docs/claude-code), then run:
93
+
94
+ ```bash
95
+ claude mcp add --scope user pcb-lens -- pcb-lens
96
+ ```
97
+
98
+ ### OpenAI Codex
99
+
100
+ Install [OpenAI Codex](https://developers.openai.com/codex/cli/), then run:
101
+
102
+ ```bash
103
+ codex mcp add pcb-lens -- pcb-lens
104
+ ```
105
+
106
+ ### Gemini CLI
107
+
108
+ Install [Gemini CLI](https://geminicli.com/docs/get-started/installation/), then run:
109
+
110
+ ```bash
111
+ gemini mcp add --scope user pcb-lens pcb-lens
112
+ ```
113
+
114
+ ### VS Code (GitHub Copilot)
115
+
116
+ Download [VS Code](https://code.visualstudio.com/)
117
+
118
+ Add to `.vscode/mcp.json` in your project:
119
+
120
+ ```json
121
+ {
122
+ "servers": {
123
+ "pcb-lens": {
124
+ "type": "stdio",
125
+ "command": "pcb-lens"
126
+ }
127
+ }
128
+ }
129
+ ```
130
+
131
+ Then enable it in **Configure Tools** (click the tools icon in Copilot chat).
132
+
133
+ ## Supported Platforms
134
+
135
+ | Platform | Binary |
136
+ |----------|--------|
137
+ | macOS (Universal) | `pcb-lens-darwin-universal` |
138
+ | Linux (x64) | `pcb-lens-linux-x64` |
139
+ | Linux (ARM64) | `pcb-lens-linux-arm64` |
140
+ | Windows (x64) | `pcb-lens-windows-x64.exe` |
141
+
142
+ ## Documentation
143
+
144
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.
145
+
146
+ ---
147
+
148
+ ## About
149
+
150
+ Created by **Valentino Zegna**
151
+
152
+ This project is hosted on GitHub under the [IntelligentElectron](https://github.com/IntelligentElectron) organization.
153
+
154
+ ## License
155
+
156
+ Apache License 2.0 - see [LICENSE](LICENSE)
@@ -0,0 +1,23 @@
1
+ /**
2
+ * CLI command handlers for --version, --help, --update, and --uninstall.
3
+ */
4
+ /**
5
+ * Print version information.
6
+ */
7
+ export declare const printVersion: () => void;
8
+ /**
9
+ * Print help message.
10
+ */
11
+ export declare const printHelp: () => void;
12
+ /**
13
+ * Handle --update command.
14
+ * Checks for updates and installs if available.
15
+ * For npm installs, directs users to use npm update instead.
16
+ */
17
+ export declare const handleUpdateCommand: () => Promise<void>;
18
+ /**
19
+ * Handle --uninstall command.
20
+ * Removes the binary and PATH entries from shell rc files.
21
+ */
22
+ export declare const handleUninstallCommand: () => Promise<void>;
23
+ //# sourceMappingURL=commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAcH;;GAEG;AACH,eAAO,MAAM,YAAY,QAAO,IAE/B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,QAAO,IAqB5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAa,OAAO,CAAC,IAAI,CA4CxD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QAAa,OAAO,CAAC,IAAI,CAiC3D,CAAC"}
@@ -0,0 +1,113 @@
1
+ /**
2
+ * CLI command handlers for --version, --help, --update, and --uninstall.
3
+ */
4
+ import { existsSync, rmSync } from "node:fs";
5
+ import { dirname } from "node:path";
6
+ import { VERSION, GITHUB_REPO, BINARY_NAME } from "../version.js";
7
+ import { checkForUpdate, performUpdate, isNpmInstall, getCurrentExecutablePath, } from "./updater.js";
8
+ import { confirm } from "./prompts.js";
9
+ import { removeFromPath } from "./shell.js";
10
+ /**
11
+ * Print version information.
12
+ */
13
+ export const printVersion = () => {
14
+ console.log(`${BINARY_NAME} v${VERSION}`);
15
+ };
16
+ /**
17
+ * Print help message.
18
+ */
19
+ export const printHelp = () => {
20
+ console.log(`
21
+ ${BINARY_NAME} v${VERSION}
22
+
23
+ MCP server for IPC-2581 PCB layout analysis.
24
+
25
+ USAGE:
26
+ ${BINARY_NAME} [OPTIONS]
27
+
28
+ OPTIONS:
29
+ --version, -v Print version and exit
30
+ --help, -h Show this help message
31
+ --update Check for and install updates
32
+ --uninstall Remove binary and PATH entries
33
+ --no-update Disable auto-update check on startup
34
+
35
+ MORE INFO:
36
+ https://github.com/${GITHUB_REPO}
37
+ `.trim());
38
+ };
39
+ /**
40
+ * Handle --update command.
41
+ * Checks for updates and installs if available.
42
+ * For npm installs, directs users to use npm update instead.
43
+ */
44
+ export const handleUpdateCommand = async () => {
45
+ console.log("Checking for updates...");
46
+ const check = await checkForUpdate();
47
+ if (check.error) {
48
+ console.error(`Error checking for updates: ${check.error}`);
49
+ process.exit(1);
50
+ }
51
+ if (!check.updateAvailable) {
52
+ console.log(`Already at latest version (${VERSION})`);
53
+ return;
54
+ }
55
+ console.log(`Update available: ${VERSION} -> ${check.latestVersion}`);
56
+ if (isNpmInstall()) {
57
+ console.log("");
58
+ console.log("To update, run:");
59
+ console.log(" npm update -g @intelligentelectron/pcb-lens");
60
+ return;
61
+ }
62
+ if (!check.downloadUrl) {
63
+ console.error("No download URL available for your platform");
64
+ process.exit(1);
65
+ }
66
+ const confirmed = await confirm("Install update?");
67
+ if (!confirmed) {
68
+ console.log("Update cancelled");
69
+ return;
70
+ }
71
+ console.log("Downloading update...");
72
+ const result = await performUpdate(check.downloadUrl, check.latestVersion);
73
+ if (!result.success) {
74
+ console.error(`Update failed: ${result.error}`);
75
+ process.exit(1);
76
+ }
77
+ console.log(`Updated from ${result.previousVersion} to ${result.newVersion}`);
78
+ console.log("Please restart to use the new version.");
79
+ };
80
+ /**
81
+ * Handle --uninstall command.
82
+ * Removes the binary and PATH entries from shell rc files.
83
+ */
84
+ export const handleUninstallCommand = async () => {
85
+ const confirmed = await confirm(`This will remove ${BINARY_NAME} from your system. Continue?`);
86
+ if (!confirmed) {
87
+ console.log("Uninstall cancelled");
88
+ return;
89
+ }
90
+ const binaryPath = getCurrentExecutablePath();
91
+ const binDir = dirname(binaryPath);
92
+ const installDir = dirname(binDir);
93
+ // Remove PATH entries from shell rc files
94
+ console.log("Removing PATH entries...");
95
+ const modifiedFiles = removeFromPath();
96
+ if (modifiedFiles.length > 0) {
97
+ console.log(`Modified: ${modifiedFiles.join(", ")}`);
98
+ }
99
+ // Remove install directory
100
+ console.log(`Removing install directory: ${installDir}`);
101
+ if (existsSync(installDir)) {
102
+ try {
103
+ rmSync(installDir, { recursive: true });
104
+ }
105
+ catch (error) {
106
+ console.error(`Failed to remove directory: ${error instanceof Error ? error.message : error}`);
107
+ console.log("You may need to remove it manually.");
108
+ }
109
+ }
110
+ console.log("");
111
+ console.log(`${BINARY_NAME} has been uninstalled.`);
112
+ };
113
+ //# sourceMappingURL=commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commands.js","sourceRoot":"","sources":["../../src/cli/commands.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,EACL,cAAc,EACd,aAAa,EACb,YAAY,EACZ,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,GAAS,EAAE;IACrC,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,KAAK,OAAO,EAAE,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,GAAS,EAAE;IAClC,OAAO,CAAC,GAAG,CACT;EACF,WAAW,KAAK,OAAO;;;;;IAKrB,WAAW;;;;;;;;;;uBAUQ,WAAW;CACjC,CAAC,IAAI,EAAE,CACL,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG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AI,EAAE,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CACX,+BAA+B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,EAAE,CAChF,CAAC;YACF,OAAO,CAAC,GAAG,CAAC,qCAAqC,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,GAAG,WAAW,wBAAwB,CAAC,CAAC;AACtD,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * User interaction utilities for CLI prompts.
3
+ */
4
+ /**
5
+ * Prompt user for confirmation with a y/N prompt.
6
+ * @param question - The question to ask the user
7
+ * @returns Promise resolving to true if user confirms, false otherwise
8
+ */
9
+ export declare const confirm: (question: string) => Promise<boolean>;
10
+ //# sourceMappingURL=prompts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/cli/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;GAIG;AACH,eAAO,MAAM,OAAO,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CAgB/D,CAAC"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * User interaction utilities for CLI prompts.
3
+ */
4
+ import * as readline from "node:readline";
5
+ /**
6
+ * Prompt user for confirmation with a y/N prompt.
7
+ * @param question - The question to ask the user
8
+ * @returns Promise resolving to true if user confirms, false otherwise
9
+ */
10
+ export const confirm = async (question) => {
11
+ if (!process.stdin.isTTY) {
12
+ return false;
13
+ }
14
+ const rl = readline.createInterface({
15
+ input: process.stdin,
16
+ output: process.stdout,
17
+ });
18
+ return new Promise((resolve) => {
19
+ rl.question(`${question} [y/N] `, (answer) => {
20
+ rl.close();
21
+ resolve(answer.toLowerCase() === "y" || answer.toLowerCase() === "yes");
22
+ });
23
+ });
24
+ };
25
+ //# sourceMappingURL=prompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/cli/prompts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAE1C;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,QAAgB,EAAoB,EAAE;IAClE,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QACzB,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;QAClC,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,EAAE,CAAC,QAAQ,CAAC,GAAG,QAAQ,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;YAC3C,EAAE,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,KAAK,GAAG,IAAI,MAAM,CAAC,WAAW,EAAE,KAAK,KAAK,CAAC,CAAC;QAC1E,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Shell rc file manipulation for PATH integration.
3
+ */
4
+ /**
5
+ * Get shell configuration file paths to check for PATH entries.
6
+ * @returns Array of paths to shell rc files
7
+ */
8
+ export declare const getShellRcFiles: () => string[];
9
+ /**
10
+ * Remove pcb-lens PATH entries from shell rc files.
11
+ * Looks for "# PCB Lens MCP Server" comment blocks and removes them.
12
+ * @returns Array of file paths that were modified
13
+ */
14
+ export declare const removeFromPath: () => string[];
15
+ //# sourceMappingURL=shell.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.d.ts","sourceRoot":"","sources":["../../src/cli/shell.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAO,MAAM,EASxC,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,QAAO,MAAM,EA2CvC,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Shell rc file manipulation for PATH integration.
3
+ */
4
+ import * as fs from "node:fs";
5
+ import * as path from "node:path";
6
+ import * as os from "node:os";
7
+ /**
8
+ * Get shell configuration file paths to check for PATH entries.
9
+ * @returns Array of paths to shell rc files
10
+ */
11
+ export const getShellRcFiles = () => {
12
+ const home = os.homedir();
13
+ return [
14
+ path.join(home, ".zshrc"),
15
+ path.join(home, ".bashrc"),
16
+ path.join(home, ".bash_profile"),
17
+ path.join(home, ".profile"),
18
+ path.join(home, ".config", "fish", "config.fish"),
19
+ ];
20
+ };
21
+ /**
22
+ * Remove pcb-lens PATH entries from shell rc files.
23
+ * Looks for "# PCB Lens MCP Server" comment blocks and removes them.
24
+ * @returns Array of file paths that were modified
25
+ */
26
+ export const removeFromPath = () => {
27
+ const modified = [];
28
+ for (const rcFile of getShellRcFiles()) {
29
+ if (!fs.existsSync(rcFile))
30
+ continue;
31
+ const content = fs.readFileSync(rcFile, "utf-8");
32
+ const lines = content.split("\n");
33
+ const filtered = [];
34
+ let i = 0;
35
+ let changed = false;
36
+ while (i < lines.length) {
37
+ const line = lines[i];
38
+ // Skip "# PCB Lens MCP Server" comment and the following export/fish_add_path line
39
+ if (line.trim() === "# PCB Lens MCP Server") {
40
+ changed = true;
41
+ i++; // Skip comment
42
+ // Skip the next line if it's the PATH export
43
+ if (i < lines.length && lines[i].includes("pcb-lens")) {
44
+ i++;
45
+ }
46
+ // Skip trailing empty line if present
47
+ if (i < lines.length && lines[i].trim() === "") {
48
+ i++;
49
+ }
50
+ continue;
51
+ }
52
+ filtered.push(line);
53
+ i++;
54
+ }
55
+ if (changed) {
56
+ // Remove trailing newlines
57
+ while (filtered.length > 0 && filtered[filtered.length - 1] === "") {
58
+ filtered.pop();
59
+ }
60
+ fs.writeFileSync(rcFile, filtered.join("\n") + "\n");
61
+ modified.push(rcFile);
62
+ }
63
+ }
64
+ return modified;
65
+ };
66
+ //# sourceMappingURL=shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shell.js","sourceRoot":"","sources":["../../src/cli/shell.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;GAGG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,GAAa,EAAE;IAC5C,MAAM,IAAI,GAAG,EAAE,CAAC,OAAO,EAAE,CAAC;IAC1B,OAAO;QACL,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC;QAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,UAAU,CAAC;QAC3B,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC;KAClD,CAAC;AACJ,CAAC,CAAC;AAEF;;;;GAIG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,GAAa,EAAE;IAC3C,MAAM,QAAQ,GAAa,EAAE,CAAC;IAE9B,KAAK,MAAM,MAAM,IAAI,eAAe,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC;YAAE,SAAS;QAErC,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACjD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,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