@aryanduntley/pwa-debug 0.1.3 → 0.1.5

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 CHANGED
@@ -194,18 +194,18 @@ claude mcp add chrome-devtools --scope user -- npx -y chrome-devtools-mcp@latest
194
194
 
195
195
  ### Or install `pwa-debug` as a Claude Code plugin
196
196
 
197
- The repo ships a `.claude-plugin/` manifest, so instead of the manual `claude mcp add pwa-debug` above you can install the host as a plugin and pick up updates with **`/reload-plugins`** no full restart:
197
+ The repo ships a `.claude-plugin/` manifest whose MCP server runs the **published npm package** (`npx -y @aryanduntley/pwa-debug@latest`), so the plugin installs with **no clone and no build** — and picks up updates with **`/reload-plugins`**, no full restart:
198
198
 
199
199
  ```sh
200
- # Add this repo as a plugin marketplace (use the local checkout path, or the GitHub URL)
201
- /plugin marketplace add /absolute/path/to/pwa-debug-layer
202
- # Install + enable the pwa-debug plugin from it
200
+ # Add the marketplace straight from GitHub (no checkout needed)
201
+ /plugin marketplace add aryanduntley/pwa-debug-layer
202
+ # Install + enable the pwa-debug plugin
203
203
  /plugin install pwa-debug@pwa-debug
204
- # After enabling (or after a `git pull` + rebuild), bring the MCP server up with no restart:
204
+ # Bring the MCP server up with no restart:
205
205
  /reload-plugins
206
206
  ```
207
207
 
208
- > **Build the host first.** The plugin's MCP entry runs `node ${CLAUDE_PLUGIN_ROOT}/packages/host/dist/main.js`, so `dist/` must exist run `pnpm --filter @aryanduntley/pwa-debug build` in the checkout before enabling.
208
+ > **No build needed.** The plugin's MCP entry is `npx -y @aryanduntley/pwa-debug@latest`, which fetches the prebuilt host (and its bundled extension) from npm. *Working on a local clone instead?* Skip the plugin and register your own build directly: `claude mcp add pwa-debug --scope user -- node /absolute/path/to/pwa-debug-layer/packages/host/dist/main.js`.
209
209
  >
210
210
  > **`chrome-devtools-mcp` is still separate.** The plugin declares **only** the `pwa-debug` host — `chrome-devtools-mcp` stays the optional `claude mcp add chrome-devtools …` above (no version coupling, no owning its launch). The bundled **`chrome-devtools-coexistence`** skill walks you through registering it; with a plugin install, its "make the tools appear" step is `/reload-plugins`.
211
211
 
package/dist/main.js CHANGED
@@ -15027,6 +15027,21 @@ const snapshotConn = (c) => Object.freeze({
15027
15027
  connectedAt: c.connectedAt,
15028
15028
  lastSeenAt: c.lastSeenAt,
15029
15029
  });
15030
+ // Probe whether a unix socket path has a live listener. Resolves 'live' if a
15031
+ // connection is accepted, 'stale' if the path refuses connection (ECONNREFUSED)
15032
+ // or is gone (ENOENT) — i.e. an orphaned socket file left behind by a host that
15033
+ // was hard-killed (SIGKILL / terminal close / crash) before close() could
15034
+ // unlink it. Used to decide whether an EADDRINUSE bind failure is a genuine
15035
+ // conflict (another host is up) or a reclaimable stale file.
15036
+ const probeSocketLiveness = (path) => new Promise((resolve) => {
15037
+ const probe = createConnection(path);
15038
+ const settle = (result) => {
15039
+ probe.destroy();
15040
+ resolve(result);
15041
+ };
15042
+ probe.once('connect', () => settle('live'));
15043
+ probe.once('error', () => settle('stale'));
15044
+ });
15030
15045
  const createIpcServer = async (opts) => {
15031
15046
  const connections = new Map();
15032
15047
  const pending = new Map();
@@ -15117,12 +15132,39 @@ const createIpcServer = async (opts) => {
15117
15132
  const socketPaths = [opts.socketPath, ...(opts.extraSocketPaths ?? [])];
15118
15133
  const servers = socketPaths.map(() => createServer(handleSocket));
15119
15134
  const listenOne = (server, path) => new Promise((resolve, reject) => {
15120
- const onError = (err) => reject(err);
15121
- server.once('error', onError);
15122
- server.listen(path, () => {
15123
- server.off('error', onError);
15124
- resolve();
15125
- });
15135
+ const attempt = (recovered) => {
15136
+ const onError = (err) => {
15137
+ const recoverable = err.code === 'EADDRINUSE' &&
15138
+ !recovered &&
15139
+ process.platform !== 'win32';
15140
+ if (!recoverable) {
15141
+ reject(err);
15142
+ return;
15143
+ }
15144
+ // A prior host may have been hard-killed without unlinking its socket.
15145
+ // Probe before clobbering: only reclaim a path nothing is listening on
15146
+ // — never unlink out from under a host that is genuinely up.
15147
+ void probeSocketLiveness(path).then(async (liveness) => {
15148
+ if (liveness === 'live') {
15149
+ reject(new Error(`ipc server: another pwa-debug host is already listening on ${path}`));
15150
+ return;
15151
+ }
15152
+ try {
15153
+ await unlink(path);
15154
+ }
15155
+ catch {
15156
+ // already gone — fine, just retry the bind
15157
+ }
15158
+ attempt(true);
15159
+ });
15160
+ };
15161
+ server.once('error', onError);
15162
+ server.listen(path, () => {
15163
+ server.off('error', onError);
15164
+ resolve();
15165
+ });
15166
+ };
15167
+ attempt(false);
15126
15168
  });
15127
15169
  await Promise.all(servers.map((s, i) => listenOne(s, socketPaths[i])));
15128
15170
  const sendTo = (extensionId, env) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aryanduntley/pwa-debug",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -41,6 +41,7 @@
41
41
  },
42
42
  "author": "aryanduntley",
43
43
  "bin": {
44
+ "pwa-debug": "./dist/main.js",
44
45
  "pwa-debug-host": "./dist/main.js"
45
46
  },
46
47
  "main": "./dist/main.js",
@@ -62,8 +63,8 @@
62
63
  "@types/winreg": "^1.2.36",
63
64
  "rollup": "^4.27.4",
64
65
  "tslib": "^2.8.1",
65
- "@pwa-debug/extension": "0.1.3",
66
- "@pwa-debug/shared": "0.1.3"
66
+ "@pwa-debug/extension": "0.1.5",
67
+ "@pwa-debug/shared": "0.1.5"
67
68
  },
68
69
  "scripts": {
69
70
  "typecheck": "tsc --noEmit",